Skip to content
BSD syscall#364

svc · unix #364

lchown

chown variant that operates on a symbolic link itself rather than its target.

Prototype

int lchown(user_addr_t path, uid_t owner, gid_t group);

Returns: int

Arguments

NameTypeDirDescription
pathuser_addr_t-
owneruid_t-
groupgid_t-

Version history

XNU tagmacOS#
xnu-1456.1.26macOS 10.6 Snow Leopard364
xnu-1486.2.11364
xnu-1504.15.3364
xnu-1504.3.12364
xnu-1504.7.4364
xnu-1504.9.17364
xnu-1504.9.26364
xnu-1504.9.37364

Notes

Useful when a tool needs to restore link ownership during archive extraction (tar, cp -p). On APFS symlink ownership is stored alongside the link metadata.

Detection

ES NOTIFY_SETOWNER with the link vnode.

Related APIs

chownfchownatsymlinklstat