Skip to content
BSD syscall#221

svc · unix #221

setattrlist

Writes a selected set of file attributes in a single syscall using a packed attrlist.

Prototype

int setattrlist(const char *path, struct attrlist *alist, void *attributeBuffer, size_t bufferSize, u_long options);

Returns: int

Arguments

NameTypeDirDescription
pathconst char-
aliststruct attrlist-
attributeBuffervoid-
bufferSizesize_t-
optionsu_long-

Version history

XNU tagmacOS#
xnu-1456.1.26macOS 10.6 Snow Leopard221
xnu-1486.2.11221
xnu-1504.15.3221
xnu-1504.3.12221
xnu-1504.7.4221
xnu-1504.9.17221
xnu-1504.9.26221
xnu-1504.9.37221

Notes

Used to set timestamps, BSD flags, Finder info and APFS firmlink/dataless properties atomically. Many writable attributes require root or specific entitlements; the kernel rejects bits it does not understand with EINVAL.

Detection

ES emits multiple specific events (SETTIME, SETFLAGS, etc.) depending on which attribute bits are written.

Related APIs

fsetattrlistsetattrlistatgetattrlistchflags