BSD syscalls: Filesystem mounts and control
Dispatch and catalog guide · Every number and configuration alternative
This page is generated from syscalls.master and authored descriptions.json. The signature is the master declaration, not the internal handler's (proc, args, retval) ABI. Descriptions identify selected local mechanisms; they do not claim every branch was audited.
18: getfsstat
int getfsstat(user_addr_t buf, int bufsize, int flags);
Declaration: syscalls.master · Condition: always · Audit event: AUE_GETFSSTAT.
Enumerate mounted filesystem statistics, optionally with MAC label output.
Implementation: getfsstat. Use vfs_iterate and size-limited output callbacks; the legacy entry delegates to __mac_getfsstat, while the 64-bit entry selects its own record layout.
36: sync
int sync(void);
Declaration: syscalls.master · Condition: always · Audit event: AUE_SYNC.
Request synchronization of mounted filesystems and report dirty-buffer accounting internally.
Implementation: sync. vfs_iterate visits eligible mounts for sync work; VM/buffer statistics are consulted separately. It is not a per-fd completion token or a universal hardware durability guarantee.
95: fsync
int fsync(int fd);
Declaration: syscalls.master · Condition: always · Audit event: AUE_FSYNC.
Synchronize an open file; fdatasync selects the data-focused common mode.
Implementation: fsync. All reach fsync_common, which performs file/vnode synchronization. Ordinary fsync and fdatasync test cancellation; fsync_nocancel directly enters the common operation.
155: nfssvc
int nfssvc(int flag, caddr_t argp);
Declaration: syscalls.master · Condition: (NFSSERVER) · Audit event: AUE_NFS_SVC.
Operate the in-kernel NFS server using an operation flag set.
Implementation: nfssvc. Privilege/MAC checks precede socket installation, server-worker entry, export management or statistics helpers such as nfssvc_addsock, nfssvc_nfsd and nfssvc_export; peer/server protocol work lives in the NFS implementation.
157: statfs
int statfs(char *path, struct statfs *buf);
Declaration: syscalls.master · Condition: always · Audit event: AUE_STATFS.
Read filesystem statistics by path or open descriptor using the legacy ABI.
Implementation: statfs. Resolve a vnode and call statfs_internal, which updates/collects mount information and copies the selected filesystem-stat structure.
158: fstatfs
int fstatfs(int fd, struct statfs *buf);
Declaration: syscalls.master · Condition: always · Audit event: AUE_FSTATFS.
Read filesystem statistics by path or open descriptor using the legacy ABI.
Implementation: fstatfs. Resolve a vnode and call statfs_internal, which updates/collects mount information and copies the selected filesystem-stat structure.
159: unmount
int unmount(user_addr_t path, int flags);
Declaration: syscalls.master · Condition: always · Audit event: AUE_UNMOUNT.
Unmount a filesystem selected by path or descriptor.
Implementation: unmount. Resolve and retain the mount, apply mount/MAC checks and call safedounmount; busy/drain and failed-unmount state belong to the common VFS teardown path.
161: getfh
int getfh(char *fname, fhandle_t *fhp);
Declaration: syscalls.master · Condition: (NFSSERVER) · Audit event: AUE_NFS_GETFH.
Obtain an exported filesystem handle for a pathname.
Implementation: getfh. Resolves the vnode and export context under NFS export protection, translates to an NFS filehandle and copies the bounded result out; requires appropriate privilege/server support.
164: funmount
int funmount(int fd, int flags);
Declaration: syscalls.master · Condition: always · Audit event: AUE_FUNMOUNT.
Unmount a filesystem selected by path or descriptor.
Implementation: funmount. Resolve and retain the mount, apply mount/MAC checks and call safedounmount; busy/drain and failed-unmount state belong to the common VFS teardown path.
165: quotactl
int quotactl(const char *path, int cmd, int uid, caddr_t arg);
Declaration: syscalls.master · Condition: always · Audit event: AUE_QUOTACTL.
Manage or query filesystem quota state.
Implementation: quotactl, quotactl. Under QUOTA, the handler imports command-specific data and invokes VFS_QUOTACTL while holding a mount reference; without it the alternate body returns EOPNOTSUPP. Commands include quota-file/control and per-ID usage/limit operations.
167: mount
int mount(char *type, char *path, int flags, caddr_t data);
Declaration: syscalls.master · Condition: always · Audit event: AUE_MOUNT.
Mount or update a filesystem, with optional MAC-label input in the extended entry.
Implementation: mount. mount forwards to __mac_mount; the latter imports type/options, resolves the mount point and enters mount_common/filesystem mount dispatch, coordinating authorization and publication.
187: fdatasync
int fdatasync(int fd);
Declaration: syscalls.master · Condition: always · Audit event: AUE_FDATASYNC.
Synchronize an open file; fdatasync selects the data-focused common mode.
Implementation: fdatasync. All reach fsync_common, which performs file/vnode synchronization. Ordinary fsync and fdatasync test cancellation; fsync_nocancel directly enters the common operation.
242: fsctl
int fsctl(const char *path, u_long cmd, caddr_t data, u_int options);
Declaration: syscalls.master · Condition: always · Audit event: AUE_FSCTL.
Issue filesystem-specific control commands by path or descriptor.
Implementation: fsctl. Resolve/pin the vnode, apply mount-control MAC checks and call fsctl_internal. It rejects character/block vnodes with ENOTTY, decodes common commands and forwards permitted filesystem-specific controls through VNOP_IOCTL. Output copyout occurs after the operation and can fail independently. This catalog scopes the multiplexor, not every filesystem-private command. See type rejection and filesystem dispatch/output.
245: ffsctl
int ffsctl(int fd, u_long cmd, caddr_t data, u_int options);
Declaration: syscalls.master · Condition: always · Audit event: AUE_FFSCTL.
Issue filesystem-specific control commands by path or descriptor.
Implementation: ffsctl. Resolve/pin the vnode, apply mount-control MAC checks and call fsctl_internal. It rejects character/block vnodes with ENOTTY, decodes common commands and forwards permitted filesystem-specific controls through VNOP_IOCTL. Output copyout occurs after the operation and can fail independently. This catalog scopes the multiplexor, not every filesystem-private command. See type rejection and filesystem dispatch/output.
248: fhopen
int fhopen(const struct fhandle *u_fhp, int flags);
Declaration: syscalls.master · Condition: (NFSSERVER) · Audit event: AUE_FHOPEN.
Open an exported object using a filehandle.
Implementation: fhopen. Imports the handle, resolves it with nfsrv_fhtovp under export protection, then validates vnode/open rights and constructs descriptor state.
345: statfs64
int statfs64(char *path, struct statfs64 *buf);
Declaration: syscalls.master · Condition: always · Audit event: AUE_STATFS64.
Read filesystem statistics using the 64-bit statfs layout.
Implementation: statfs64. Pin the vnode/mount, apply mount-stat authorization, call vfs_update_vfsstat/vfs_get_statfs64, and copy the assembled record out.
346: fstatfs64
int fstatfs64(int fd, struct statfs64 *buf);
Declaration: syscalls.master · Condition: always · Audit event: AUE_FSTATFS64.
Read filesystem statistics using the 64-bit statfs layout.
Implementation: fstatfs64. Pin the vnode/mount, apply mount-stat authorization, call vfs_update_vfsstat/vfs_get_statfs64, and copy the assembled record out.
347: getfsstat64
int getfsstat64(user_addr_t buf, int bufsize, int flags);
Declaration: syscalls.master · Condition: always · Audit event: AUE_GETFSSTAT64.
Enumerate mounted filesystem statistics, optionally with MAC label output.
Implementation: getfsstat64. Use vfs_iterate and size-limited output callbacks; the legacy entry delegates to __mac_getfsstat, while the 64-bit entry selects its own record layout.
408: fsync_nocancel
int fsync_nocancel(int fd) NO_SYSCALL_STUB;
Declaration: syscalls.master · Condition: always · Audit event: AUE_FSYNC.
Synchronize an open file; fdatasync selects the data-focused common mode.
Implementation: fsync_nocancel. All reach fsync_common, which performs file/vnode synchronization. Ordinary fsync and fdatasync test cancellation; fsync_nocancel directly enters the common operation.
424: __mac_mount
int __mac_mount(char *type, char *path, int flags, caddr_t data, struct mac *mac_p);
Declaration: syscalls.master · Condition: always · Audit event: AUE_MAC_MOUNT.
Mount or update a filesystem, with optional MAC-label input in the extended entry.
Implementation: __mac_mount. mount forwards to __mac_mount; the latter imports type/options, resolves the mount point and enters mount_common/filesystem mount dispatch, coordinating authorization and publication.
425: __mac_get_mount
int __mac_get_mount(char *path, struct mac *mac_p);
Declaration: syscalls.master · Condition: (CONFIG_MACF) · Audit event: AUE_MAC_GET_MOUNT.
Read a mount's externalized MAC label by pathname.
Implementation: __mac_get_mount. Resolve/retain the mount, invoke mac_mount_label_get, and drop the mount reference after output handling.
426: __mac_getfsstat
int __mac_getfsstat(user_addr_t buf, int bufsize, user_addr_t mac, int macsize, int flags);
Declaration: syscalls.master · Condition: always · Audit event: AUE_MAC_GETFSSTAT.
Enumerate mounted filesystem statistics, optionally with MAC label output.
Implementation: __mac_getfsstat. Use vfs_iterate and size-limited output callbacks; the legacy entry delegates to __mac_getfsstat, while the 64-bit entry selects its own record layout.
455: vfs_purge
int vfs_purge(void);
Declaration: syscalls.master · Condition: always · Audit event: AUE_NULL.
Request privileged purge of filesystem caches/file-backed pager resources.
Implementation: vfs_purge. Iterates VFS purge callbacks and calls vm_purge_filebacked_pagers; it is broader than closing descriptors and does not imply every referenced vnode can be destroyed.
518: fs_snapshot
int fs_snapshot(uint32_t op, int dirfd, user_addr_t name1, user_addr_t name2, user_addr_t data, uint32_t flags) NO_SYSCALL_STUB;
Declaration: syscalls.master · Condition: always · Audit event: AUE_NULL.
Manage filesystem snapshots through a directory fd and operation selector.
Implementation: fs_snapshot. Checks snapshot authorization, resolves mount/root objects and dispatches create/delete/rename/mount/revert-related helpers. Actual snapshot storage is a filesystem operation, not reconstructed APFS code.
526: fmount
int fmount(const char *type, int fd, int flags, void *data);
Declaration: syscalls.master · Condition: always · Audit event: AUE_FMOUNT.
Mount using an already-open mount-point descriptor.
Implementation: fmount. Imports the filesystem type, obtains the vnode and parent/path context, then calls mount_common; supported update cases can use the shared MAC mount path.
537: pivot_root
int pivot_root(const char *new_rootfs_path_before, const char *old_rootfs_path_after);
Declaration: syscalls.master · Condition: always · Audit event: AUE_NULL.
Switch the root filesystem under the supported platform/authorization configuration.
Implementation: pivot_root, pivot_root. Under XNU_TARGET_OS_OSX, the handler validates privileged inputs and calls vfs_switch_root after vnode/ioctl checks; the alternate definition invokes nosys. It is not enabled uniformly merely because a master number exists.
549: graftdmg
int graftdmg(int dmg_fd, const char *mountdir, uint32_t graft_type, graftdmg_args_un *gda);
Declaration: syscalls.master · Condition: always · Audit event: AUE_NULL.
Graft an authenticated disk-image/cryptex filesystem at a mount location.
Implementation: graftdmg. Imports the type-specific argument union, pins source/target vnodes, checks entitlements/MAC and calls the secure-boot graft helper, then sends policy notifications and releases lookup state.
555: ungraftdmg
int ungraftdmg(const char *mountdir, uint64_t flags);
Declaration: syscalls.master · Condition: always · Audit event: AUE_NULL.
Remove a grafted image association.
Implementation: ungraftdmg. Checks entitlement/MAC policy, resolves the target, issues the filesystem ungraft ioctl and performs notification/reference cleanup.