Skip to content

Instantly share code, notes, and snippets.

@BlueFalconHD
Last active October 12, 2024 03:16
Show Gist options
  • Save BlueFalconHD/da39227ec22908c8e9d12e458a5155d4 to your computer and use it in GitHub Desktop.
Save BlueFalconHD/da39227ec22908c8e9d12e458a5155d4 to your computer and use it in GitHub Desktop.
XNU syscalls list.
Number/ID Name Description Arguments
1 exit Terminates the calling process. It is used to exit a program with a specific return value, signaling the operating system about the program’s status. int rval
2 fork Creates a new process by duplicating the calling process. The new process is referred to as the child process. None
3 read Reads data from a file descriptor into a buffer. Commonly used for input operations in programs. int fd, user_addr_t cbuf, user_size_t nbyte
4 write Writes data from a buffer to a file descriptor. Commonly used for output operations in programs. int fd, user_addr_t cbuf, user_size_t nbyte
5 open Opens a file specified by the pathname and returns a file descriptor for subsequent operations. user_addr_t path, int flags, int mode
6 close Closes a file descriptor, so that it no longer refers to any file and may be reused. int fd
7 wait4 Waits for state changes in a child process, such as termination, and can retrieve resource usage information. int pid, user_addr_t status, int options, user_addr_t rusage
8 execve Executes a program referred to by a pathname, replacing the current process image with a new process image. char *fname, char **argp, char **envp
12 chdir Changes the current working directory of the calling process to the directory specified in the pathname. user_addr_t path
20 getpid Returns the process ID of the calling process. Useful for identifying the process within the system. None
23 setuid Sets the user ID of the calling process, altering its privileges. uid_t uid
24 getuid Returns the real user ID of the calling process. None
25 geteuid Returns the effective user ID of the calling process, which determines its privileges. None
26 ptrace Provides a means by which a parent process may observe and manipulate the execution of another process, and examine and change its memory and registers. int req, pid_t pid, caddr_t addr, int data
33 access Checks a user’s permissions for a file specified by pathname. user_addr_t path, int flags
35 fchflags Changes the file flags of the open file specified by the file descriptor. int fd, int flags
36 sync Flushes all modified file system data to disk, ensuring data integrity. None
37 kill Sends a signal to a process or a group of processes, allowing for inter-process communication and control. int pid, int signum, int posix
39 getppid Returns the parent process ID of the calling process. None
41 dup Duplicates an existing file descriptor, returning a new file descriptor that refers to the same open file description. u_int fd
42 pipe Creates a unidirectional data channel that can be used for interprocess communication. None
43 getegid Returns the effective group ID of the calling process. None
46 sigaction Examines and changes a signal action, providing fine-grained control over signal handling. int signum, struct __sigaction *nsa, struct sigaction *osa
48 sigprocmask Examines and changes the signal mask, controlling which signals are blocked from being delivered. int how, user_addr_t mask, user_addr_t omask
50 setlogin Sets the login name for the current session. char *namebuf
54 ioctl Manipulates the underlying device parameters of special files. Commonly used for device-specific operations. int fd, u_long com, caddr_t data
59 execve Executes a program, replacing the current process image with a new one. char *fname, char **argp, char **envp
60 umask Sets the file mode creation mask of the calling process, affecting the permissions of newly created files and directories. int newmask
63 getpagesize Returns the number of bytes in a memory page, which is useful for memory management and optimization. None
65 msync Synchronizes a mapped memory region with the underlying file, ensuring that changes are written to disk. caddr_t addr, size_t len, int flags
73 munmap Unmaps a previously mapped memory region, freeing the associated resources. caddr_ut addr, size_ut len
74 mprotect Changes the protection on a region of memory, such as making it read-only or executable. caddr_t addr, size_t len, int prot
78 mincore Determines whether pages are resident in memory (i.e., currently loaded into RAM) for a specified address range. user_addr_t addr, user_size_t len, user_addr_t vec
89 getdtablesize Returns the maximum number of file descriptors that the calling process can have open at any time. None
90 dup2 Duplicates a file descriptor to a specific value, allowing for redirection of standard input/output streams. u_int from, u_int to
92 fcntl Performs various operations on file descriptors, such as setting flags or managing file locks. int fd, int cmd, long arg
93 select Monitors multiple file descriptors to see if any of them is ready for I/O operations. int nd, u_int32_t *in, u_int32_t *ou, u_int32_t *ex, struct timeval *tv
95 fsync Forces a file descriptor to synchronize its state with the underlying storage device, ensuring data integrity. int fd
96 setpriority Sets the scheduling priority of a process, allowing for control over CPU allocation. int which, id_t who, int prio
97 socket Creates an endpoint for communication and returns a file descriptor for the socket. int domain, int type, int protocol
98 connect Initiates a connection on a socket to a specified address. int s, caddr_t name, socklen_t namelen
100 getpriority Retrieves the scheduling priority of a process, helping in monitoring and managing process execution. int which, id_t who
102 recv Receives messages from a socket, allowing for data reception in network communications. int s, void *buf, size_t len, int flags
103 sigreturn Returns from a signal handler, restoring the process state prior to signal delivery. struct ucontext *uctx, int infostyle, user_addr_t token
104 bind Assigns a local protocol address to a socket, enabling it to listen for incoming connections. int s, caddr_t name, socklen_t namelen
105 setsockopt Sets options on a socket, allowing for customization of socket behavior. int s, int level, int name, caddr_t val, socklen_t valsize
106 listen Marks a socket as a passive socket, indicating that it will be used to accept incoming connection requests. int s, int backlog
111 sigsuspend Temporarily replaces the process’s signal mask and suspends execution until a signal is received. sigset_t mask
116 gettimeofday Retrieves the current time, providing high-resolution time information. struct timeval *tp, struct timezone *tzp, uint64_t *mach_absolute_time
117 getrusage Returns resource usage measures for the calling process, such as CPU time and memory usage. int who, struct rusage *rusage
120 readv Reads data from a file descriptor into multiple buffers (scatter input). int fd, struct iovec *iovp, u_int iovcnt
121 writev Writes data from multiple buffers to a file descriptor (gather output). int fd, struct iovec *iovp, u_int iovcnt
122 settimeofday Sets the system’s idea of the current time and timezone. struct timeval *tv, struct timezone *tzp
124 fchmod Changes the permissions of an open file specified by the file descriptor. int fd, int mode
128 rename Renames a file, moving it to a new location within the filesystem. char *from, char *to
131 flock Applies or removes an advisory lock on an open file, allowing for synchronization between processes. int fd, int how
132 mkfifo Creates a named pipe (FIFO), enabling inter-process communication through a file-like interface. user_addr_t path, int mode
136 mkdir Creates a new directory with the specified pathname and mode. user_addr_t path, int mode
137 rmdir Removes a directory specified by pathname. char *path
138 utimes Sets the access and modification times of a file specified by pathname. char *path, struct timeval *tptr
140 adjtime Adjusts the system clock by a specified amount, allowing for fine-grained time corrections. struct timeval *delta, struct timeval *olddelta
142 sysctl Reads and writes kernel parameters at runtime, enabling dynamic system configuration. int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen
143 sethostid Sets the identifier for the current host. (Deprecated; often returns an error.) int
146 killpg Sends a signal to a process group, allowing for group-based signal handling. int
147 setsid Creates a new session and sets the process group ID, detaching the process from any controlling terminal. None
150 getsockname Retrieves the current address to which the socket fd is bound, which is useful for obtaining the local address of a socket. int fd, caddr_t asa, socklen_t *alen
151 getpgid Gets the process group ID of the specified process, useful for managing process groups. pid_t pid
152 setpgid Sets the process group ID for a specified process, enabling control over process grouping. int pid, int pgid
153 pread Reads data from a file descriptor at a given offset without changing the file pointer, allowing for random access reads. int fd, user_addr_t buf, user_size_t nbyte, off_t offset
154 pwrite Writes data to a file descriptor at a given offset without changing the file pointer, enabling random access writes. int fd, user_addr_t buf, user_size_t nbyte, off_t offset
157 statfs Returns file system statistics for the file system containing the file specified by pathname. char *path, struct statfs *buf
158 fstatfs Returns file system statistics for the file system containing the open file specified by file descriptor. int fd, struct statfs *buf
159 unmount Unmounts the file system specified by pathname, detaching it from the directory hierarchy. user_addr_t path, int flags
161 getfh Retrieves a file handle for the specified file, useful for network file systems. char *fname, fhandle_t *fhp
165 quotactl Manipulates disk quotas for users and groups, allowing administrators to set and retrieve quota information. const char *path, int cmd, int uid, caddr_t arg
167 mount Mounts a file system, making it accessible at a specified directory in the filesystem hierarchy. char *type, char *path, int flags, caddr_t data
169 csops Performs operations on the code signing status of a process, enhancing security by enforcing code integrity. pid_t pid, uint32_t ops, useraddr_t useraddr, user_size_t usersize
173 waitid Waits for state changes in a child process, providing more granular control compared to wait4. idtype_t idtype, id_t id, siginfo_t *infop, int options
178 getxattr Retrieves the value of an extended attribute associated with a file. user_addr_t path, user_addr_t attrname, user_addr_t value, size_t size, uint32_t position, int options
179 fgetxattr Retrieves the value of an extended attribute associated with an open file descriptor. int fd, user_addr_t attrname, user_addr_t value, size_t size, uint32_t position, int options
180 setxattr Sets the value of an extended attribute associated with a file. user_addr_t path, user_addr_t attrname, user_addr_t value, size_t size, uint32_t position, int options
181 setgid Sets the group ID of the calling process, altering its group privileges. gid_t gid
182 setegid Sets the effective group ID of the calling process, modifying its group privileges. gid_t egid
183 seteuid Sets the effective user ID of the calling process, altering its user privileges. uid_t euid
185 thread_selfcounts Retrieves thread-specific usage counts, useful for monitoring thread performance and resource usage. uint32_t kind, user_addr_t buf, user_size_t size
187 fdatasync Synchronizes a file’s in-core state with storage device, ensuring that all modified data is written to disk. int fd
190 lstat Retrieves file status, similar to stat, but does not follow symbolic links. user_addr_t path, user_addr_t ub
191 pathconf Retrieves configuration values for a given pathname, such as maximum length of filenames or number of links. char *path, int name
192 fpathconf Retrieves configuration values for an open file descriptor, similar to pathconf. int fd, int name
193 getrlimit Retrieves resource limits for the current process, such as maximum file size or number of open files. u_int which, struct rlimit *rlp
194 getrlimit Retrieves resource limits for the current process, allowing programs to query their resource usage constraints. u_int which, struct rlimit *rlp
197 mmap Maps files or devices into memory, enabling file I/O through memory operations. caddr_ut addr, size_ut len, int prot, int flags, int fd, off_t pos
199 lseek Repositions the offset of the file descriptor, enabling random access within a file. int fd, off_t offset, int whence
200 truncate Truncates a file to a specified length, allowing for reduction of file size. char *path, off_t length
201 ftruncate Truncates an open file to a specified length, modifying the file size without changing its pathname. int fd, off_t length
202 sysctl Reads and writes kernel parameters at runtime, enabling dynamic system configuration. int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen
207 clonefileat Clones a file from one directory file descriptor to another, allowing for efficient file duplication within the filesystem hierarchy. int src_fd, int dst_dirfd, user_addr_t dst, uint32_t flags
208 fs_snapshot Creates a snapshot of the filesystem, capturing the state of the filesystem at a specific point in time for backup or recovery purposes. uint32_t op, int dirfd, user_addr_t name1, user_addr_t name2, user_addr_t data, uint32_t flags
210 getsgroups Retrieves supplementary group IDs for the calling process, aiding in group-based access control. user_addr_t setlen, user_addr_t guidset
213 shared_region_map_and_slide_np Maps and slides a shared region, facilitating dynamic linking and memory management for shared libraries and frameworks. uint32_t files_count, const struct shared_file_np *files, uint32_t mappings_count, const struct shared_file_mapping_slide_np *mappings
220 getattrlist Retrieves a list of attributes for a specified file, allowing for efficient bulk attribute retrieval. const char *path, struct attrlist *alist, void *attributeBuffer, size_t bufferSize, u_long options
221 setattrlist Sets a list of attributes for a specified file, enabling bulk attribute modification. const char *path, struct attrlist *alist, void *attributeBuffer, size_t bufferSize, u_long options
224 searchfs Searches the filesystem based on specified criteria, enabling efficient file searches. const char *path, struct fssearchblock *searchblock, uint32_t *nummatches, uint32_t scriptcode, uint32_t options, struct searchstate *state
226 delete Deletes a file with Carbon semantics, providing a high-level interface for file deletion operations. user_addr_t path
227 copyfile Copies a file from one location to another, supporting various flags for copying behavior. char *from, char *to, int mode, int flags
230 poll Monitors multiple file descriptors to see if any of them is ready for I/O operations, similar to select but more scalable. struct pollfd *fds, u_int nfds, int timeout
310 getsid Retrieves the session ID of the specified process, useful for session-based process management. pid_t pid
311 settid_with_pid Sets the thread ID for a specified process, enabling thread management within processes. pid_t pid, int assume
324 mlockall Locks all pages mapped into the address space of the calling process, preventing them from being paged to disk. int how
325 munlockall Unlocks all pages mapped into the address space of the calling process, allowing them to be paged to disk again. int how
327 issetugid Checks if the process is running with elevated privileges, useful for security checks. None
330 sigwait Waits for a signal to be delivered, suspending execution until one of the specified signals is received. user_addr_t set, user_addr_t sig
332 __pthread_markcancel Marks a pthread as cancelable, allowing for thread cancellation. int
335 proc_info Retrieves information about a process, such as resource usage or scheduling details. int32_t callnum, int32_t pid, uint32_t flavor, uint64_t arg, user_addr_t buffer, int32_t buffersize
337 stat64 Retrieves file status using 64-bit structures, supporting larger files and file systems. user_addr_t path, user_addr_t ub
340 lstat64 Retrieves file status using 64-bit structures without following symbolic links. user_addr_t path, user_addr_t ub
344 getdirentries64 Retrieves directory entries with support for large directories, using 64-bit offsets. int fd, void *buf, user_size_t bufsize, off_t *position
346 getfsstat64 Retrieves file system statistics using 64-bit structures, supporting larger file systems. user_addr_t buf, int bufsize, int flags
350 audit Records an audit record with specified data, facilitating system auditing and monitoring. void *record, int length
351 auditon Controls the behavior of the audit system, allowing for configuration and management of audit settings. int cmd, void *data, int length
352 getauid Retrieves the audit user ID of the calling process, used in auditing for tracking user actions. au_id_t *auid
354 setauid Sets the audit user ID of the calling process, enabling customized auditing based on user identity. au_id_t *auid
357 getaudit_addr Retrieves the audit information for the calling process, including audit flags and privileges. struct auditinfo_addr *auditinfo_addr, int length
358 setaudit_addr Sets the audit information for the calling process, defining audit flags and privileges. struct auditinfo_addr *auditinfo_addr, int length
359 auditctl Controls the audit subsystem, allowing for dynamic changes to audit policies and settings. char *path
362 kqueue Creates a new kernel event queue, enabling efficient event notification mechanisms. None
363 kevent Registers or deregisters events with a kernel event queue, facilitating event-driven programming. int fd, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout
364 lchown Changes the owner and group of a symbolic link without affecting the target file. user_addr_t path, uid_t owner, gid_t group
367 workq_open Opens a new work queue, enabling asynchronous task execution and management. None
368 workq_kernreturn Returns control from the kernel to the work queue, allowing for task completion signaling. int options, user_addr_t item, int affinity, int prio
373 ledger Manipulates process ledgers, which track resource usage such as memory and CPU consumption, aiding in system monitoring and management. int cmd, caddr_t arg1, caddr_t arg2, caddr_t arg3
375 kevent_id Manages events associated with a specific identifier, enabling targeted event handling. uint64_t id, const struct kevent_qos_s *changelist, int nchanges, struct kevent_qos_s *eventlist, int nevents, void *data_out, size_t *data_available, unsigned int flags
376 nosys Placeholder for unimplemented system calls, typically returns an error indicating the syscall is not available. None
380 __mac_execve Executes a program with Mandatory Access Control (MAC) policies applied, enhancing security by enforcing access restrictions. char *fname, char **argp, char **envp, struct mac *mac_p
382 __mac_get_file Retrieves the MAC label of a file, allowing programs to inspect access control attributes. char *path_p, struct mac *mac_p
384 __mac_set_link Sets the MAC label of a symbolic link, enabling access control on symbolic links. char *path_p, struct mac *mac_p
388 __mac_set_fd Sets the MAC label of an open file descriptor, enforcing access control policies on file operations. int fd, struct mac *mac_p
390 __mac_get_pid Retrieves the MAC label of a process, allowing inspection of process-level access controls. pid_t pid, struct mac *mac_p
393 select Performs a high-resolution I/O multiplexing operation, monitoring multiple file descriptors to see if any are ready for I/O. int nd, u_int32_t *in, u_int32_t *ou, u_int32_t *ex, const struct timespec *ts, const struct sigset_t *mask
394 pselect Similar to select, but with support for signal masks and high-resolution timeouts, offering enhanced control over I/O multiplexing. int nd, u_int32_t *in, u_int32_t *ou, u_int32_t *ex, const struct timespec *ts, const struct sigset_t *mask
395 pselect_nocancel Performs a pselect operation without the ability to cancel, ensuring the operation completes even if a cancellation request is received. int nd, u_int32_t *in, u_int32_t *ou, u_int32_t *ex, const struct timespec *ts, const struct sigset_t *mask
400 wait4_nocancel Waits for state changes in a child process without being interruptible by cancellation, ensuring reliable process synchronization. int pid, user_addr_t status, int options, user_addr_t rusage
410 sigsuspend_nocancel Temporarily replaces the process’s signal mask and suspends execution until a signal is received, without being interruptible by cancellation. sigset_t mask
414 pread_nocancel Reads data from a file descriptor at a given offset without changing the file pointer and without being interruptible by cancellation. int fd, user_addr_t buf, user_size_t nbyte, off_t offset
415 pwrite_nocancel Writes data to a file descriptor at a given offset without changing the file pointer and without being interruptible by cancellation. int fd, user_addr_t buf, user_size_t nbyte, off_t offset
418 msgsnd_nocancel Sends a message to a message queue without being interruptible by cancellation, ensuring the message is sent reliably. int msqid, void *msgp, size_t msgsz, int msgflg
419 msgrcv_nocancel Receives a message from a message queue without being interruptible by cancellation, ensuring message retrieval reliability. int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg
420 sem_wait_nocancel Waits on a semaphore without being interruptible by cancellation, ensuring semaphore acquisition reliability. sem_t *sem
424 usrctl Performs user-level control operations, enabling custom control commands and configurations. uint32_t flags
428 fsgetpath Retrieves the filesystem path for a given filesystem ID and object ID, useful for file system operations and diagnostics. user_addr_t buf, size_t bufsize, user_addr_t fsid, uint64_t objid
430 map_with_linking_np Maps a memory region with linking information, facilitating dynamic linking and memory management for shared libraries. void *regions, uint32_t region_count, void *link_info, uint32_t link_info_size
434 memorystatus_control Controls memory status features, allowing for memory pressure monitoring and management. uint32_t command, int32_t pid, uint32_t flags, user_addr_t buffer, size_t buffersize
440 memorystatus_available_memory Retrieves the amount of available memory, aiding in memory management and optimization tasks. None
450 netagent_trigger Triggers a network agent based on a UUID, enabling dynamic network configuration and management. uuid_t agent_uuid, size_t agent_uuidlen
455 sfi_ctl Controls Secure File Integrity (SFI) settings, enhancing file system security through integrity checks. uint32_t operation, uint32_t sfi_class, uint64_t time, uint64_t *out_time
458 coalition_ledger Sets or gets ledger information for a coalition, allowing for resource usage tracking and management across process groups. uint64_t cid, uint32_t flavor, void *buffer, size_t *bufsize
460 necp_match_policy Matches network policies based on provided parameters, facilitating advanced network configuration and management. uint8_t *parameters, size_t parameters_size, struct necp_aggregate_result *returned_result
464 renameat_nocancel Renames a file within a directory file descriptor context without being interruptible by cancellation, ensuring reliable file operations. int fromfd, char *from, int tofd, char *to
468 fchownat Changes the owner and group of a file specified by a directory file descriptor and pathname, enabling ownership modifications within directories. int fd, user_addr_t path, uid_t uid, gid_t gid, int flag
473 readlinkat Reads the value of a symbolic link specified by a directory file descriptor and pathname, enabling symbolic link resolution. int fd, user_addr_t path, user_addr_t buf, size_t bufsize
474 symlinkat Creates a symbolic link within a directory file descriptor context, enabling link creation relative to directories. user_addr_t *path1, int fd, user_addr_t path2
475 mkdirat Creates a directory within a directory file descriptor context, allowing for directory creation relative to specific directories. int fd, user_addr_t path, int mode
477 net_qos_guideline Provides network Quality of Service (QoS) guidelines based on specified parameters, aiding in network performance optimization. struct net_qos_param *param, uint32_t param_len
480 recvmsg_x Receives messages from a socket with extended message headers, enabling advanced message handling features. int s, struct msghdr_x *msgp, u_int cnt, int flags
481 sendmsg_x Sends messages through a socket with extended message headers, allowing for advanced message composition and transmission. int s, struct msghdr_x *msgp, u_int cnt, int flags
482 thread_selfusage Retrieves the current thread’s usage statistics, aiding in performance monitoring and optimization. None
490 necp_match_policy Matches network policies based on provided parameters, facilitating advanced network configuration and management. uint8_t *parameters, size_t parameters_size, struct necp_aggregate_result *returned_result
492 microstackshot Captures a microstackshot, which is a lightweight snapshot of thread stacks for debugging and profiling purposes. user_addr_t tracebuf, uint32_t tracebuf_size, uint32_t flags
496 kas_info Retrieves Kernel Address Space (KAS) information, useful for low-level system diagnostics and debugging. int selector, void *value, size_t *size
500 getentropy Fills a buffer with random data, providing secure random numbers for cryptographic operations and other security-related tasks. void *buffer, size_t size

Notes:

  • user_addr_t and caddr_t represent user-space memory addresses.
  • NO_SYSCALL_STUB indicates that no user-space syscall stub will be generated for that syscall.
  • Some syscalls may have additional flags or parameters not fully listed here

-----------------------------------------------------------------------------------------------------------------------------------------------
Number/ID Name Description Arguments
----------- -------------------------------- -------------------------------------------- -----------------------------------------------------
1 exit Terminates the calling process. It is used int rval
to exit a program with a specific return
value, signaling the operating system about
the program’s status.
2 fork Creates a new process by duplicating the None
calling process. The new process is referred
to as the child process.
3 read Reads data from a file descriptor into a int fd, user_addr_t cbuf, user_size_t nbyte
buffer. Commonly used for input operations
in programs.
4 write Writes data from a buffer to a file int fd, user_addr_t cbuf, user_size_t nbyte
descriptor. Commonly used for output
operations in programs.
5 open Opens a file specified by the pathname and user_addr_t path, int flags, int mode
returns a file descriptor for subsequent
operations.
6 close Closes a file descriptor, so that it no int fd
longer refers to any file and may be reused.
7 wait4 Waits for state changes in a child process, int pid, user_addr_t status, int options,
such as termination, and can retrieve user_addr_t rusage
resource usage information.
8 execve Executes a program referred to by a char *fname, char **argp, char **envp
pathname, replacing the current process
image with a new process image.
12 chdir Changes the current working directory of the user_addr_t path
calling process to the directory specified
in the pathname.
20 getpid Returns the process ID of the calling None
process. Useful for identifying the process
within the system.
23 setuid Sets the user ID of the calling process, uid_t uid
altering its privileges.
24 getuid Returns the real user ID of the calling None
process.
25 geteuid Returns the effective user ID of the calling None
process, which determines its privileges.
26 ptrace Provides a means by which a parent process int req, pid_t pid, caddr_t addr, int data
may observe and manipulate the execution of
another process, and examine and change its
memory and registers.
33 access Checks a user’s permissions for a file user_addr_t path, int flags
specified by pathname.
35 fchflags Changes the file flags of the open file int fd, int flags
specified by the file descriptor.
36 sync Flushes all modified file system data to None
disk, ensuring data integrity.
37 kill Sends a signal to a process or a group of int pid, int signum, int posix
processes, allowing for inter-process
communication and control.
39 getppid Returns the parent process ID of the calling None
process.
41 dup Duplicates an existing file descriptor, u_int fd
returning a new file descriptor that refers
to the same open file description.
42 pipe Creates a unidirectional data channel that None
can be used for interprocess communication.
43 getegid Returns the effective group ID of the None
calling process.
46 sigaction Examines and changes a signal action, int signum, struct __sigaction *nsa,
providing fine-grained control over signal struct sigaction *osa
handling.
48 sigprocmask Examines and changes the signal mask, int how, user_addr_t mask, user_addr_t omask
controlling which signals are blocked from
being delivered.
50 setlogin Sets the login name for the current session. char *namebuf
54 ioctl Manipulates the underlying device parameters int fd, u_long com, caddr_t data
of special files. Commonly used for
device-specific operations.
59 execve Executes a program, replacing the current char *fname, char **argp, char **envp
process image with a new one.
60 umask Sets the file mode creation mask of the int newmask
calling process, affecting the permissions
of newly created files and directories.
63 getpagesize Returns the number of bytes in a memory None
page, which is useful for memory management
and optimization.
65 msync Synchronizes a mapped memory region with the caddr_t addr, size_t len, int flags
underlying file, ensuring that changes are
written to disk.
73 munmap Unmaps a previously mapped memory region, caddr_ut addr, size_ut len
freeing the associated resources.
74 mprotect Changes the protection on a region of caddr_t addr, size_t len, int prot
memory, such as making it read-only or
executable.
78 mincore Determines whether pages are resident in user_addr_t addr, user_size_t len, user_addr_t vec
memory (i.e., currently loaded into RAM) for
a specified address range.
89 getdtablesize Returns the maximum number of file None
descriptors that the calling process can
have open at any time.
90 dup2 Duplicates a file descriptor to a specific u_int from, u_int to
value, allowing for redirection of standard
input/output streams.
92 fcntl Performs various operations on file int fd, int cmd, long arg
descriptors, such as setting flags or
managing file locks.
93 select Monitors multiple file descriptors to see if int nd, u_int32_t *in, u_int32_t *ou, u_int32_t *ex,
any of them is ready for I/O operations. struct timeval *tv
95 fsync Forces a file descriptor to synchronize its int fd
state with the underlying storage device,
ensuring data integrity.
96 setpriority Sets the scheduling priority of a process, int which, id_t who, int prio
allowing for control over CPU allocation.
97 socket Creates an endpoint for communication and int domain, int type, int protocol
returns a file descriptor for the socket.
98 connect Initiates a connection on a socket to a int s, caddr_t name, socklen_t namelen
specified address.
100 getpriority Retrieves the scheduling priority of a int which, id_t who
process, helping in monitoring and managing
process execution.
102 recv Receives messages from a socket, allowing int s, void *buf, size_t len, int flags
for data reception in network
communications.
103 sigreturn Returns from a signal handler, restoring the struct ucontext *uctx, int infostyle,
process state prior to signal delivery. user_addr_t token
104 bind Assigns a local protocol address to a int s, caddr_t name, socklen_t namelen
socket, enabling it to listen for incoming
connections.
105 setsockopt Sets options on a socket, allowing for int s, int level, int name, caddr_t val,
customization of socket behavior. socklen_t valsize
106 listen Marks a socket as a passive socket, int s, int backlog
indicating that it will be used to accept
incoming connection requests.
111 sigsuspend Temporarily replaces the process’s signal sigset_t mask
mask and suspends execution until a signal
is received.
116 gettimeofday Retrieves the current time, providing struct timeval *tp, struct timezone *tzp,
high-resolution time information. uint64_t *mach_absolute_time
117 getrusage Returns resource usage measures for the int who, struct rusage *rusage
calling process, such as CPU time and memory
usage.
120 readv Reads data from a file descriptor into int fd, struct iovec *iovp, u_int iovcnt
multiple buffers (scatter input).
121 writev Writes data from multiple buffers to a file int fd, struct iovec *iovp, u_int iovcnt
descriptor (gather output).
122 settimeofday Sets the system’s idea of the current time struct timeval *tv, struct timezone *tzp
and timezone.
124 fchmod Changes the permissions of an open file int fd, int mode
specified by the file descriptor.
128 rename Renames a file, moving it to a new location char *from, char *to
within the filesystem.
131 flock Applies or removes an advisory lock on an int fd, int how
open file, allowing for synchronization
between processes.
132 mkfifo Creates a named pipe (FIFO), enabling user_addr_t path, int mode
inter-process communication through a
file-like interface.
136 mkdir Creates a new directory with the specified user_addr_t path, int mode
pathname and mode.
137 rmdir Removes a directory specified by pathname. char *path
138 utimes Sets the access and modification times of a char *path, struct timeval *tptr
file specified by pathname.
140 adjtime Adjusts the system clock by a specified struct timeval *delta, struct timeval *olddelta
amount, allowing for fine-grained time
corrections.
142 sysctl Reads and writes kernel parameters at int *name, u_int namelen, void *old, size_t *oldlenp,
runtime, enabling dynamic system void *new, size_t newlen
configuration.
143 sethostid Sets the identifier for the current host. int
(Deprecated; often returns an error.)
146 killpg Sends a signal to a process group, allowing int
for group-based signal handling.
147 setsid Creates a new session and sets the process None
group ID, detaching the process from any
controlling terminal.
150 getsockname Retrieves the current address to which the int fd, caddr_t asa, socklen_t *alen
socket fd is bound, which is useful for
obtaining the local address of a socket.
151 getpgid Gets the process group ID of the specified pid_t pid
process, useful for managing process groups.
152 setpgid Sets the process group ID for a specified int pid, int pgid
process, enabling control over process
grouping.
153 pread Reads data from a file descriptor at a given int fd, user_addr_t buf, user_size_t nbyte,
offset without changing the file pointer, off_t offset
allowing for random access reads.
154 pwrite Writes data to a file descriptor at a given int fd, user_addr_t buf, user_size_t nbyte,
offset without changing the file pointer, off_t offset
enabling random access writes.
157 statfs Returns file system statistics for the file char *path, struct statfs *buf
system containing the file specified by
pathname.
158 fstatfs Returns file system statistics for the file int fd, struct statfs *buf
system containing the open file specified by
file descriptor.
159 unmount Unmounts the file system specified by user_addr_t path, int flags
pathname, detaching it from the directory
hierarchy.
161 getfh Retrieves a file handle for the specified char *fname, fhandle_t *fhp
file, useful for network file systems.
165 quotactl Manipulates disk quotas for users and const char *path, int cmd, int uid, caddr_t arg
groups, allowing administrators to set and
retrieve quota information.
167 mount Mounts a file system, making it accessible char *type, char *path, int flags, caddr_t data
at a specified directory in the filesystem
hierarchy.
169 csops Performs operations on the code signing pid_t pid, uint32_t ops, useraddr_t useraddr,
status of a process, enhancing security by user_size_t usersize
enforcing code integrity.
173 waitid Waits for state changes in a child process, idtype_t idtype, id_t id, siginfo_t *infop,
providing more granular control compared to int options
wait4.
178 getxattr Retrieves the value of an extended attribute user_addr_t path, user_addr_t attrname,
associated with a file. user_addr_t value, size_t size, uint32_t position,
int options
179 fgetxattr Retrieves the value of an extended attribute int fd, user_addr_t attrname, user_addr_t value,
associated with an open file descriptor. size_t size, uint32_t position, int options
180 setxattr Sets the value of an extended attribute user_addr_t path, user_addr_t attrname,
associated with a file. user_addr_t value, size_t size, uint32_t position,
int options
181 setgid Sets the group ID of the calling process, gid_t gid
altering its group privileges.
182 setegid Sets the effective group ID of the calling gid_t egid
process, modifying its group privileges.
183 seteuid Sets the effective user ID of the calling uid_t euid
process, altering its user privileges.
185 thread_selfcounts Retrieves thread-specific usage counts, uint32_t kind, user_addr_t buf, user_size_t size
useful for monitoring thread performance and
resource usage.
187 fdatasync Synchronizes a file’s in-core state with int fd
storage device, ensuring that all modified
data is written to disk.
190 lstat Retrieves file status, similar to stat, but user_addr_t path, user_addr_t ub
does not follow symbolic links.
191 pathconf Retrieves configuration values for a given char *path, int name
pathname, such as maximum length of
filenames or number of links.
192 fpathconf Retrieves configuration values for an open int fd, int name
file descriptor, similar to pathconf.
193 getrlimit Retrieves resource limits for the current u_int which, struct rlimit *rlp
process, such as maximum file size or number
of open files.
194 getrlimit Retrieves resource limits for the current u_int which, struct rlimit *rlp
process, allowing programs to query their
resource usage constraints.
197 mmap Maps files or devices into memory, enabling caddr_ut addr, size_ut len, int prot, int flags,
file I/O through memory operations. int fd, off_t pos
199 lseek Repositions the offset of the file int fd, off_t offset, int whence
descriptor, enabling random access within a
file.
200 truncate Truncates a file to a specified length, char *path, off_t length
allowing for reduction of file size.
201 ftruncate Truncates an open file to a specified int fd, off_t length
length, modifying the file size without
changing its pathname.
202 sysctl Reads and writes kernel parameters at int *name, u_int namelen, void *old, size_t *oldlenp,
runtime, enabling dynamic system void *new, size_t newlen
configuration.
207 clonefileat Clones a file from one directory file int src_fd, int dst_dirfd, user_addr_t dst,
descriptor to another, allowing for uint32_t flags
efficient file duplication within the
filesystem hierarchy.
208 fs_snapshot Creates a snapshot of the filesystem, uint32_t op, int dirfd, user_addr_t name1,
capturing the state of the filesystem at a user_addr_t name2, user_addr_t data, uint32_t flags
specific point in time for backup or
recovery purposes.
210 getsgroups Retrieves supplementary group IDs for the user_addr_t setlen, user_addr_t guidset
calling process, aiding in group-based
access control.
213 shared_region_map_and_slide_np Maps and slides a shared region, uint32_t files_count,
facilitating dynamic linking and memory const struct shared_file_np *files,
management for shared libraries and uint32_t mappings_count,
frameworks. const struct shared_file_mapping_slide_np *mappings
220 getattrlist Retrieves a list of attributes for a const char *path, struct attrlist *alist,
specified file, allowing for efficient bulk void *attributeBuffer, size_t bufferSize,
attribute retrieval. u_long options
221 setattrlist Sets a list of attributes for a specified const char *path, struct attrlist *alist,
file, enabling bulk attribute modification. void *attributeBuffer, size_t bufferSize,
u_long options
224 searchfs Searches the filesystem based on specified const char *path, struct fssearchblock *searchblock,
criteria, enabling efficient file searches. uint32_t *nummatches, uint32_t scriptcode,
uint32_t options, struct searchstate *state
226 delete Deletes a file with Carbon semantics, user_addr_t path
providing a high-level interface for file
deletion operations.
227 copyfile Copies a file from one location to another, char *from, char *to, int mode, int flags
supporting various flags for copying
behavior.
230 poll Monitors multiple file descriptors to see if struct pollfd *fds, u_int nfds, int timeout
any of them is ready for I/O operations,
similar to select but more scalable.
310 getsid Retrieves the session ID of the specified pid_t pid
process, useful for session-based process
management.
311 settid_with_pid Sets the thread ID for a specified process, pid_t pid, int assume
enabling thread management within processes.
324 mlockall Locks all pages mapped into the address int how
space of the calling process, preventing
them from being paged to disk.
325 munlockall Unlocks all pages mapped into the address int how
space of the calling process, allowing them
to be paged to disk again.
327 issetugid Checks if the process is running with None
elevated privileges, useful for security
checks.
330 sigwait Waits for a signal to be delivered, user_addr_t set, user_addr_t sig
suspending execution until one of the
specified signals is received.
332 __pthread_markcancel Marks a pthread as cancelable, allowing for int
thread cancellation.
335 proc_info Retrieves information about a process, such int32_t callnum, int32_t pid, uint32_t flavor,
as resource usage or scheduling details. uint64_t arg, user_addr_t buffer, int32_t buffersize
337 stat64 Retrieves file status using 64-bit user_addr_t path, user_addr_t ub
structures, supporting larger files and file
systems.
340 lstat64 Retrieves file status using 64-bit user_addr_t path, user_addr_t ub
structures without following symbolic links.
344 getdirentries64 Retrieves directory entries with support for int fd, void *buf, user_size_t bufsize,
large directories, using 64-bit offsets. off_t *position
346 getfsstat64 Retrieves file system statistics using user_addr_t buf, int bufsize, int flags
64-bit structures, supporting larger file
systems.
350 audit Records an audit record with specified data, void *record, int length
facilitating system auditing and monitoring.
351 auditon Controls the behavior of the audit system, int cmd, void *data, int length
allowing for configuration and management of
audit settings.
352 getauid Retrieves the audit user ID of the calling au_id_t *auid
process, used in auditing for tracking user
actions.
354 setauid Sets the audit user ID of the calling au_id_t *auid
process, enabling customized auditing based
on user identity.
357 getaudit_addr Retrieves the audit information for the struct auditinfo_addr *auditinfo_addr, int length
calling process, including audit flags and
privileges.
358 setaudit_addr Sets the audit information for the calling struct auditinfo_addr *auditinfo_addr, int length
process, defining audit flags and
privileges.
359 auditctl Controls the audit subsystem, allowing for char *path
dynamic changes to audit policies and
settings.
362 kqueue Creates a new kernel event queue, enabling None
efficient event notification mechanisms.
363 kevent Registers or deregisters events with a int fd, const struct kevent *changelist,
kernel event queue, facilitating int nchanges, struct kevent *eventlist, int nevents,
event-driven programming. const struct timespec *timeout
364 lchown Changes the owner and group of a symbolic user_addr_t path, uid_t owner, gid_t group
link without affecting the target file.
367 workq_open Opens a new work queue, enabling None
asynchronous task execution and management.
368 workq_kernreturn Returns control from the kernel to the work int options, user_addr_t item, int affinity, int prio
queue, allowing for task completion
signaling.
373 ledger Manipulates process ledgers, which track int cmd, caddr_t arg1, caddr_t arg2, caddr_t arg3
resource usage such as memory and CPU
consumption, aiding in system monitoring and
management.
375 kevent_id Manages events associated with a specific uint64_t id, const struct kevent_qos_s *changelist,
identifier, enabling targeted event int nchanges, struct kevent_qos_s *eventlist,
handling. int nevents, void *data_out, size_t *data_available,
unsigned int flags
376 nosys Placeholder for unimplemented system calls, None
typically returns an error indicating the
syscall is not available.
380 __mac_execve Executes a program with Mandatory Access char *fname, char **argp, char **envp,
Control (MAC) policies applied, enhancing struct mac *mac_p
security by enforcing access restrictions.
382 __mac_get_file Retrieves the MAC label of a file, allowing char *path_p, struct mac *mac_p
programs to inspect access control
attributes.
384 __mac_set_link Sets the MAC label of a symbolic link, char *path_p, struct mac *mac_p
enabling access control on symbolic links.
388 __mac_set_fd Sets the MAC label of an open file int fd, struct mac *mac_p
descriptor, enforcing access control
policies on file operations.
390 __mac_get_pid Retrieves the MAC label of a process, pid_t pid, struct mac *mac_p
allowing inspection of process-level access
controls.
393 select Performs a high-resolution I/O multiplexing int nd, u_int32_t *in, u_int32_t *ou, u_int32_t *ex,
operation, monitoring multiple file const struct timespec *ts,
descriptors to see if any are ready for I/O. const struct sigset_t *mask
394 pselect Similar to select, but with support for int nd, u_int32_t *in, u_int32_t *ou, u_int32_t *ex,
signal masks and high-resolution timeouts, const struct timespec *ts,
offering enhanced control over I/O const struct sigset_t *mask
multiplexing.
395 pselect_nocancel Performs a pselect operation without the int nd, u_int32_t *in, u_int32_t *ou, u_int32_t *ex,
ability to cancel, ensuring the operation const struct timespec *ts,
completes even if a cancellation request is const struct sigset_t *mask
received.
400 wait4_nocancel Waits for state changes in a child process int pid, user_addr_t status, int options,
without being interruptible by cancellation, user_addr_t rusage
ensuring reliable process synchronization.
410 sigsuspend_nocancel Temporarily replaces the process’s signal sigset_t mask
mask and suspends execution until a signal
is received, without being interruptible by
cancellation.
414 pread_nocancel Reads data from a file descriptor at a given int fd, user_addr_t buf, user_size_t nbyte,
offset without changing the file pointer and off_t offset
without being interruptible by cancellation.
415 pwrite_nocancel Writes data to a file descriptor at a given int fd, user_addr_t buf, user_size_t nbyte,
offset without changing the file pointer and off_t offset
without being interruptible by cancellation.
418 msgsnd_nocancel Sends a message to a message queue without int msqid, void *msgp, size_t msgsz, int msgflg
being interruptible by cancellation,
ensuring the message is sent reliably.
419 msgrcv_nocancel Receives a message from a message queue int msqid, void *msgp, size_t msgsz, long msgtyp,
without being interruptible by cancellation, int msgflg
ensuring message retrieval reliability.
420 sem_wait_nocancel Waits on a semaphore without being sem_t *sem
interruptible by cancellation, ensuring
semaphore acquisition reliability.
424 usrctl Performs user-level control operations, uint32_t flags
enabling custom control commands and
configurations.
428 fsgetpath Retrieves the filesystem path for a given user_addr_t buf, size_t bufsize, user_addr_t fsid,
filesystem ID and object ID, useful for file uint64_t objid
system operations and diagnostics.
430 map_with_linking_np Maps a memory region with linking void *regions, uint32_t region_count,
information, facilitating dynamic linking void *link_info, uint32_t link_info_size
and memory management for shared libraries.
434 memorystatus_control Controls memory status features, allowing uint32_t command, int32_t pid, uint32_t flags,
for memory pressure monitoring and user_addr_t buffer, size_t buffersize
management.
440 memorystatus_available_memory Retrieves the amount of available memory, None
aiding in memory management and optimization
tasks.
450 netagent_trigger Triggers a network agent based on a UUID, uuid_t agent_uuid, size_t agent_uuidlen
enabling dynamic network configuration and
management.
455 sfi_ctl Controls Secure File Integrity (SFI) uint32_t operation, uint32_t sfi_class,
settings, enhancing file system security uint64_t time, uint64_t *out_time
through integrity checks.
458 coalition_ledger Sets or gets ledger information for a uint64_t cid, uint32_t flavor, void *buffer,
coalition, allowing for resource usage size_t *bufsize
tracking and management across process
groups.
460 necp_match_policy Matches network policies based on provided uint8_t *parameters, size_t parameters_size,
parameters, facilitating advanced network struct necp_aggregate_result *returned_result
configuration and management.
464 renameat_nocancel Renames a file within a directory file int fromfd, char *from, int tofd, char *to
descriptor context without being
interruptible by cancellation, ensuring
reliable file operations.
468 fchownat Changes the owner and group of a file int fd, user_addr_t path, uid_t uid, gid_t gid,
specified by a directory file descriptor and int flag
pathname, enabling ownership modifications
within directories.
473 readlinkat Reads the value of a symbolic link specified int fd, user_addr_t path, user_addr_t buf,
by a directory file descriptor and pathname, size_t bufsize
enabling symbolic link resolution.
474 symlinkat Creates a symbolic link within a directory user_addr_t *path1, int fd, user_addr_t path2
file descriptor context, enabling link
creation relative to directories.
475 mkdirat Creates a directory within a directory file int fd, user_addr_t path, int mode
descriptor context, allowing for directory
creation relative to specific directories.
477 net_qos_guideline Provides network Quality of Service (QoS) struct net_qos_param *param, uint32_t param_len
guidelines based on specified parameters,
aiding in network performance optimization.
480 recvmsg_x Receives messages from a socket with int s, struct msghdr_x *msgp, u_int cnt, int flags
extended message headers, enabling advanced
message handling features.
481 sendmsg_x Sends messages through a socket with int s, struct msghdr_x *msgp, u_int cnt, int flags
extended message headers, allowing for
advanced message composition and
transmission.
482 thread_selfusage Retrieves the current thread’s usage None
statistics, aiding in performance monitoring
and optimization.
490 necp_match_policy Matches network policies based on provided uint8_t *parameters, size_t parameters_size,
parameters, facilitating advanced network struct necp_aggregate_result *returned_result
configuration and management.
492 microstackshot Captures a microstackshot, which is a user_addr_t tracebuf, uint32_t tracebuf_size,
lightweight snapshot of thread stacks for uint32_t flags
debugging and profiling purposes.
496 kas_info Retrieves Kernel Address Space (KAS) int selector, void *value, size_t *size
information, useful for low-level system
diagnostics and debugging.
500 getentropy Fills a buffer with random data, providing void *buffer, size_t size
secure random numbers for cryptographic
operations and other security-related tasks.
-----------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------
Notes:
- user_addr_t and caddr_t represent user-space memory addresses.
- NO_SYSCALL_STUB indicates that no user-space syscall stub will be
generated for that syscall.
- Some syscalls may have additional flags or parameters not fully
listed here
------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment