+#define NORMAL_SYSCALL(name) \
+ [BSC_INDEX(BSC_##name)] = {#name, FMT_DEFAULT}
+
+#define SYSCALL(name, format) \
+ [BSC_INDEX(BSC_##name)] = {#name, format}
+
+#define SYSCALL_NAMED(name, displayname, format) \
+ [BSC_INDEX(BSC_##name)] = {#displayname, format}
+
+#define SYSCALL_WITH_NOCANCEL(name, format) \
+ [BSC_INDEX(BSC_##name)] = {#name, format}, \
+ [BSC_INDEX(BSC_##name##_nocancel)] = {#name, format}
+
+const struct bsd_syscall bsd_syscalls[MAX_BSD_SYSCALL] = {
+ SYSCALL(sendfile, FMT_FD), /* this should be changed to FMT_SENDFILE once we add an extended info trace event */
+ SYSCALL_WITH_NOCANCEL(recvmsg, FMT_FD_IO),
+ SYSCALL_WITH_NOCANCEL(sendmsg, FMT_FD_IO),
+ SYSCALL_WITH_NOCANCEL(recvfrom, FMT_FD_IO),
+ SYSCALL_WITH_NOCANCEL(sendto, FMT_FD_IO),
+ SYSCALL_WITH_NOCANCEL(select, FMT_SELECT),
+ SYSCALL_WITH_NOCANCEL(accept, FMT_FD_2),
+ SYSCALL(socket, FMT_SOCKET),
+ SYSCALL_WITH_NOCANCEL(connect, FMT_FD),
+ SYSCALL(bind, FMT_FD),
+ SYSCALL(listen, FMT_FD),
+ SYSCALL(mmap, FMT_MMAP),
+ NORMAL_SYSCALL(socketpair),
+ NORMAL_SYSCALL(getxattr),
+ NORMAL_SYSCALL(setxattr),
+ NORMAL_SYSCALL(removexattr),
+ NORMAL_SYSCALL(listxattr),
+ NORMAL_SYSCALL(stat),
+ NORMAL_SYSCALL(stat64),
+ NORMAL_SYSCALL(stat_extended),
+ SYSCALL_NAMED(stat64_extended, stat_extended64, FMT_DEFAULT), /* should be stat64_extended ? */
+ SYSCALL(mount, FMT_MOUNT),
+ SYSCALL(unmount, FMT_UNMOUNT),
+ NORMAL_SYSCALL(exit),
+ NORMAL_SYSCALL(execve),
+ NORMAL_SYSCALL(posix_spawn),
+ SYSCALL_WITH_NOCANCEL(open, FMT_OPEN),
+ SYSCALL(open_extended, FMT_OPEN),
+ SYSCALL(guarded_open_np, FMT_GUARDED_OPEN),
+ SYSCALL_NAMED(open_dprotected_np, open_dprotected, FMT_OPEN),
+ SYSCALL(guarded_open_dprotected_np, FMT_GUARDED_OPEN),
+ SYSCALL(dup, FMT_FD_2),
+ SYSCALL(dup2, FMT_FD_2),
+ SYSCALL_WITH_NOCANCEL(close, FMT_FD),
+ SYSCALL(guarded_close_np, FMT_FD),
+ SYSCALL_WITH_NOCANCEL(read, FMT_FD_IO),
+ SYSCALL_WITH_NOCANCEL(write, FMT_FD_IO),
+ SYSCALL(guarded_write_np, FMT_FD_IO),
+ SYSCALL(guarded_pwrite_np, FMT_PREAD),
+ SYSCALL(guarded_writev_np, FMT_FD_IO),
+ SYSCALL(fgetxattr, FMT_FD),
+ SYSCALL(fsetxattr, FMT_FD),
+ SYSCALL(fremovexattr, FMT_FD),
+ SYSCALL(flistxattr, FMT_FD),
+ SYSCALL(fstat, FMT_FD),
+ SYSCALL(fstat64, FMT_FD),
+ SYSCALL(fstat_extended, FMT_FD),
+ SYSCALL(fstat64_extended, FMT_FD),
+ NORMAL_SYSCALL(lstat),
+ NORMAL_SYSCALL(lstat64),
+ NORMAL_SYSCALL(lstat_extended),
+ SYSCALL_NAMED(lstat64_extended, lstat_extended64, FMT_DEFAULT),
+ NORMAL_SYSCALL(link),
+ NORMAL_SYSCALL(unlink),
+ NORMAL_SYSCALL(mknod),
+ SYSCALL(umask, FMT_UMASK),
+ SYSCALL(umask_extended, FMT_UMASK),
+ SYSCALL(chmod, FMT_CHMOD),
+ SYSCALL(chmod_extended, FMT_CHMOD_EXT),
+ SYSCALL(fchmod, FMT_FCHMOD),
+ SYSCALL(fchmod_extended, FMT_FCHMOD_EXT),
+ NORMAL_SYSCALL(chown),
+ NORMAL_SYSCALL(lchown),
+ SYSCALL(fchown, FMT_FD),
+ SYSCALL(access, FMT_ACCESS),
+ NORMAL_SYSCALL(access_extended),
+ NORMAL_SYSCALL(chdir),
+ NORMAL_SYSCALL(pthread_chdir),
+ NORMAL_SYSCALL(chroot),
+ NORMAL_SYSCALL(utimes),
+ SYSCALL_NAMED(delete, delete-Carbon, FMT_DEFAULT),
+ NORMAL_SYSCALL(undelete),
+ NORMAL_SYSCALL(revoke),
+ NORMAL_SYSCALL(fsctl),
+ SYSCALL(ffsctl, FMT_FD),
+ SYSCALL(chflags, FMT_CHFLAGS),
+ SYSCALL(fchflags, FMT_FCHFLAGS),
+ SYSCALL(fchdir, FMT_FD),
+ SYSCALL(pthread_fchdir, FMT_FD),
+ SYSCALL(futimes, FMT_FD),
+ NORMAL_SYSCALL(sync),
+ NORMAL_SYSCALL(symlink),
+ NORMAL_SYSCALL(readlink),
+ SYSCALL_WITH_NOCANCEL(fsync, FMT_FD),
+ SYSCALL(fdatasync, FMT_FD),
+ SYSCALL_WITH_NOCANCEL(readv, FMT_FD_IO),
+ SYSCALL_WITH_NOCANCEL(writev, FMT_FD_IO),
+ SYSCALL_WITH_NOCANCEL(pread, FMT_PREAD),
+ SYSCALL_WITH_NOCANCEL(pwrite, FMT_PREAD),
+ NORMAL_SYSCALL(mkdir),
+ NORMAL_SYSCALL(mkdir_extended),
+ NORMAL_SYSCALL(mkfifo),
+ NORMAL_SYSCALL(mkfifo_extended),
+ NORMAL_SYSCALL(rmdir),
+ NORMAL_SYSCALL(statfs),
+ NORMAL_SYSCALL(statfs64),
+ NORMAL_SYSCALL(getfsstat),
+ NORMAL_SYSCALL(getfsstat64),
+ SYSCALL(fstatfs, FMT_FD),
+ SYSCALL(fstatfs64, FMT_FD),
+ NORMAL_SYSCALL(pathconf),
+ SYSCALL(fpathconf, FMT_FD),
+ SYSCALL(getdirentries, FMT_FD_IO),
+ SYSCALL(getdirentries64, FMT_FD_IO),
+ SYSCALL(lseek, FMT_LSEEK),
+ SYSCALL(truncate, FMT_TRUNC),
+ SYSCALL(ftruncate, FMT_FTRUNC),
+ SYSCALL(flock, FMT_FLOCK),
+ NORMAL_SYSCALL(getattrlist),
+ NORMAL_SYSCALL(setattrlist),
+ SYSCALL(fgetattrlist, FMT_FD),
+ SYSCALL(fsetattrlist, FMT_FD),
+ SYSCALL(getdirentriesattr, FMT_FD),
+ NORMAL_SYSCALL(exchangedata),
+ NORMAL_SYSCALL(rename),
+ NORMAL_SYSCALL(copyfile),
+ NORMAL_SYSCALL(checkuseraccess),
+ NORMAL_SYSCALL(searchfs),
+ SYSCALL(aio_fsync, FMT_AIO_FSYNC),
+ SYSCALL(aio_return, FMT_AIO_RETURN),
+ SYSCALL_WITH_NOCANCEL(aio_suspend, FMT_AIO_SUSPEND),
+ SYSCALL(aio_cancel, FMT_AIO_CANCEL),
+ SYSCALL(aio_error, FMT_AIO),
+ SYSCALL(aio_read, FMT_AIO),
+ SYSCALL(aio_write, FMT_AIO),
+ SYSCALL(lio_listio, FMT_LIO_LISTIO),
+ SYSCALL_WITH_NOCANCEL(msync, FMT_MSYNC),
+ SYSCALL_WITH_NOCANCEL(fcntl, FMT_FCNTL),
+ SYSCALL(ioctl, FMT_IOCTL),
+ NORMAL_SYSCALL(fsgetpath),
+ NORMAL_SYSCALL(getattrlistbulk),
+ SYSCALL_WITH_NOCANCEL(openat, FMT_OPENAT), /* open_nocancel() was previously shown as "open_nocanel" (note spelling) */
+ SYSCALL(renameat, FMT_RENAMEAT),
+ SYSCALL(chmodat, FMT_CHMODAT),
+ SYSCALL(chownat, FMT_AT),
+ SYSCALL(fstatat, FMT_AT),
+ SYSCALL(fstatat64, FMT_AT),
+ SYSCALL(linkat, FMT_AT),
+ SYSCALL(unlinkat, FMT_AT),
+ SYSCALL(readlinkat, FMT_AT),
+ SYSCALL(symlinkat, FMT_AT),
+ SYSCALL(mkdirat, FMT_AT),
+ SYSCALL(getattrlistat, FMT_AT),
+};