aboutsummaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorSimran Kathpalia <skathpalia3@gmail.com>2021-04-10 14:19:01 +0530
committerMark Johnston <markjdb@gmail.com>2021-04-14 12:54:17 -0400
commit5c9ed2bcc8d10336c1389d63db51a4bde97b16a0 (patch)
tree9363898b9d176db7d6d37db54b30b85534905315 /sys
parent7c7e90dfd1801788a85fb4a2e16ea9f8bfd8d217 (diff)
sys/freebsd: added mount(2), statfs(2), getlogin(2) related syscalls
Diffstat (limited to 'sys')
-rw-r--r--sys/freebsd/fh.txt3
-rw-r--r--sys/freebsd/fh.txt.const1
-rw-r--r--sys/freebsd/posix_fs.txt67
-rw-r--r--sys/freebsd/posix_fs.txt.const32
-rw-r--r--sys/freebsd/sys.txt11
-rw-r--r--sys/freebsd/sys.txt.const10
6 files changed, 123 insertions, 1 deletions
diff --git a/sys/freebsd/fh.txt b/sys/freebsd/fh.txt
index e82f6c5bf..29507b8ca 100644
--- a/sys/freebsd/fh.txt
+++ b/sys/freebsd/fh.txt
@@ -16,7 +16,8 @@ fhlinkat(fhp ptr[in, fhandle], fd fd, to ptr[in, filename])
fhopen(fhp ptr[in, fhandle], flags flags[open_flags]) fd
fhstat(fhp ptr[in, fhandle], statbuf ptr[out, stat])
-fhstatfs(fhp ptr[in, fhandle], buf buffer[out])
+fhstatfs(fhp ptr[in, fhandle], buf ptr[out, statfs])
+freebsd11_fhstatfs(fhp ptr[in, fhandle], buf ptr[out, freebsd11_statfs])
fhreadlink(fhp ptr[in, fhandle], buf buffer[out], bufsize len[buf])
diff --git a/sys/freebsd/fh.txt.const b/sys/freebsd/fh.txt.const
index be6c075ac..16dd3e4a0 100644
--- a/sys/freebsd/fh.txt.const
+++ b/sys/freebsd/fh.txt.const
@@ -8,6 +8,7 @@ SYS_fhopen = 298
SYS_fhreadlink = 567
SYS_fhstat = 553
SYS_fhstatfs = 558
+SYS_freebsd11_fhstatfs = 398
SYS_getfh = 161
SYS_getfhat = 564
SYS_lgetfh = 160
diff --git a/sys/freebsd/posix_fs.txt b/sys/freebsd/posix_fs.txt
index 8a7a7a2d4..629822756 100644
--- a/sys/freebsd/posix_fs.txt
+++ b/sys/freebsd/posix_fs.txt
@@ -3,6 +3,9 @@
include <sys/types.h>
include <sys/stat.h>
+include <sys/mount.h>
+include <sys/param.h>
+include <sys/ucred.h>
include <fcntl.h>
include <unistd.h>
@@ -38,11 +41,16 @@ freebsd11_stat(file ptr[in, filename], statbuf ptr[out, freebsd11_stat])
freebsd11_fstat(fd fd, statbuf ptr[out, freebsd11_stat])
freebsd11_lstat(file ptr[in, filename], statbuf ptr[out, freebsd11_stat])
fstatat(fd fd, path ptr[in, filename], statbuf ptr[out, stat], flag flags[fstatat_flags])
+freebsd11_fstatat(fd fd, path ptr[in, filename], statbuf ptr[out, freebsd11_stat], flag flags[fstatat_flags])
+freebsd11_getfsstat(buf ptr[out, freebsd11_statfs], size len[buf], mode flags[getfsstat_flags])
+getfsstat(buf ptr[out, statfs], size len[buf], mode flags[getfsstat_flags])
posix_fallocate(fd fd, offset fileoff, len intptr)
posix_fadvise(fd fd, offset fileoff, len intptr, advice flags[fadvise_advice])
pathconf(file ptr[in, filename], name flags[conf_value])
lpathconf(file ptr[in, filename], name flags[conf_value])
fpathconf(fd fd, name flags[conf_value])
+unmount(path ptr[in, filename], flags flags[mount_flags])
+mount(type ptr[in, string[filesystem_types]], path ptr[in, filename], flags flags[mount_flags], data buffer[in])
pipefd {
rfd fd
@@ -109,6 +117,63 @@ stat {
__spare array[int64, 10]
}
+define MFSNAMELEN 16
+define MNAMELEN 1025
+define STATFS_VERSION 0x20140518
+
+statfs {
+ version int32
+ type int32
+ flags flags[mount_flags, int64]
+ bsize int64
+ iosize int64
+ blocks int64
+ bfree int64
+ bavail int64
+ files int64
+ ffree int64
+ syncwrites int64
+ asyncwrites int64
+ syncreads int64
+ asyncreads int64
+ spare array[int64, 10]
+ namemax int32
+ owner uid
+ fsid fsid
+ cspare array[int8, 80]
+ fstype array[int8, MFSNAMELEN]
+ mnton array[int8, MNAMELEN]
+ mntfrom array[int8, MNAMELEN]
+}
+
+define FREEBSD11_STATFS_VERSION 0x20030518
+
+freebsd11_statfs {
+ version int32
+ type int32
+ flags flags[mount_flags, int64]
+ bsize int64
+ iosize int64
+ blocks int64
+ bfree int64
+ bavail int64
+ files int64
+ ffree int64
+ syncwrites int64
+ asyncwrites int64
+ syncreads int64
+ asyncreads int64
+ spare array[int64, 10]
+ namemax int32
+ owner uid
+ fsid fsid
+ cspare array[int8, 80]
+ fstype array[int8, 16]
+ mnton array[int8, 88]
+ mntfrom array[int8, 88]
+}
+
+filesystem_types = "apfs", "cd9660", "exfat", "ext2fs", "geli", "hammer", "hammer2", "hfsp", "msdosfs", "ntfs", "ufs", "zfs"
open_flags = O_RDONLY, O_WRONLY, O_RDWR, O_APPEND, FASYNC, O_CLOEXEC, O_CREAT, O_DIRECT, O_DIRECTORY, O_EXCL, O_NOCTTY, O_NOFOLLOW, O_NONBLOCK, O_SYNC, O_TRUNC, O_EXEC, O_TTY_INIT, O_VERIFY
open_mode = S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH
close_range_flags = 0
@@ -117,3 +182,5 @@ pipe_flags = O_NONBLOCK, O_CLOEXEC
fadvise_advice = POSIX_FADV_NORMAL, POSIX_FADV_RANDOM, POSIX_FADV_SEQUENTIAL, POSIX_FADV_WILLNEED, POSIX_FADV_DONTNEED, POSIX_FADV_NOREUSE
conf_value = _PC_LINK_MAX, _PC_MAX_CANON, _PC_MAX_INPUT, _PC_NAME_MAX, _PC_PATH_MAX, _PC_PIPE_BUF, _PC_CHOWN_RESTRICTED, _PC_NO_TRUNC, _PC_VDISABLE, _PC_ASYNC_IO, _PC_PRIO_IO, _PC_SYNC_IO, _PC_ALLOC_SIZE_MIN, _PC_FILESIZEBITS, _PC_REC_INCR_XFER_SIZE, _PC_REC_MAX_XFER_SIZE, _PC_REC_MIN_XFER_SIZE, _PC_REC_XFER_ALIGN, _PC_SYMLINK_MAX, _PC_ACL_EXTENDED, _PC_ACL_NFS4, _PC_ACL_PATH_MAX, _PC_CAP_PRESENT, _PC_INF_PRESENT, _PC_MAC_PRESENT, _PC_MIN_HOLE_SIZE
fstatat_flags = AT_SYMLINK_NOFOLLOW
+mount_flags = MNT_RDONLY, MNT_SYNCHRONOUS, MNT_NOEXEC, MNT_NOSUID, MNT_ASYNC, MNT_NOATIME, MNT_SNAPSHOT, MNT_SUIDDIR, MNT_FORCE, MNT_NOCLUSTERR, MNT_NOCLUSTERW, MNT_NFS4ACLS, MNT_SOFTDEP, MNT_NOSYMFOLLOW, MNT_GJOURNAL, MNT_MULTILABEL, MNT_ACLS, MNT_EXRDONLY, MNT_EXPORTED, MNT_DEFEXPORTED, MNT_EXPORTANON
+getfsstat_flags = MNT_WAIT, MNT_NOWAIT
diff --git a/sys/freebsd/posix_fs.txt.const b/sys/freebsd/posix_fs.txt.const
index 67bb1b2f5..3ea24b8cc 100644
--- a/sys/freebsd/posix_fs.txt.const
+++ b/sys/freebsd/posix_fs.txt.const
@@ -3,6 +3,32 @@ arches = 386, amd64
AT_FDCWD = 18446744073709551516
AT_SYMLINK_NOFOLLOW = 512
FASYNC = 64
+FREEBSD11_STATFS_VERSION = 537068824
+MFSNAMELEN = 16
+MNAMELEN = 1024
+MNT_ACLS = 134217728
+MNT_ASYNC = 64
+MNT_DEFEXPORTED = 512
+MNT_EXPORTANON = 1024
+MNT_EXPORTED = 256
+MNT_EXRDONLY = 128
+MNT_FORCE = 524288
+MNT_GJOURNAL = 33554432
+MNT_MULTILABEL = 67108864
+MNT_NFS4ACLS = 16
+MNT_NOATIME = 268435456
+MNT_NOCLUSTERR = 1073741824
+MNT_NOCLUSTERW = 2147483648
+MNT_NOEXEC = 4
+MNT_NOSUID = 8
+MNT_NOSYMFOLLOW = 4194304
+MNT_NOWAIT = 2
+MNT_RDONLY = 1
+MNT_SNAPSHOT = 16777216
+MNT_SOFTDEP = 2097152
+MNT_SUIDDIR = 1048576
+MNT_SYNCHRONOUS = 2
+MNT_WAIT = 1
O_APPEND = 8
O_CLOEXEC = 1048576
O_CREAT = 512
@@ -31,6 +57,7 @@ SEEK_DATA = 3
SEEK_END = 2
SEEK_HOLE = 4
SEEK_SET = 0
+STATFS_VERSION = 538182936
SYS_close = 6
SYS_close_range = 575
SYS_dup = 41
@@ -38,13 +65,17 @@ SYS_dup2 = 90
SYS_fpathconf = 192
SYS_freebsd10_pipe = 42
SYS_freebsd11_fstat = 189
+SYS_freebsd11_fstatat = 493
+SYS_freebsd11_getfsstat = 395
SYS_freebsd11_lstat = 190
SYS_freebsd11_stat = 188
SYS_freebsd12_closefrom = 509
SYS_fstat = 551
SYS_fstatat = 552
+SYS_getfsstat = 557
SYS_lpathconf = 513
SYS_lseek = 478
+SYS_mount = 21
SYS_open = 5
SYS_openat = 499
SYS_pathconf = 191
@@ -57,6 +88,7 @@ SYS_pwrite = 476
SYS_pwritev = 290
SYS_read = 3
SYS_readv = 120
+SYS_unmount = 22
SYS_write = 4
SYS_writev = 121
S_IRGRP = 32
diff --git a/sys/freebsd/sys.txt b/sys/freebsd/sys.txt
index 0c7cd384f..91fb692ed 100644
--- a/sys/freebsd/sys.txt
+++ b/sys/freebsd/sys.txt
@@ -67,6 +67,7 @@ fchflags(fd fd, flags flags[chflags_flags])
lchflags(file ptr[in, filename], flags flags[chflags_flags])
faccessat(dirfd fd_dir, pathname ptr[in, filename], mode flags[access_mode], flags flags[faccessat_flags])
access(pathname ptr[in, filename], mode flags[access_mode])
+eaccess(pathname ptr[in, filename], mode flags[access_mode])
profil(samples buffer[inout], size len[samples], offt intptr, scale int32)
utimes(filename ptr[in, filename], times ptr[in, itimerval])
futimesat(dir fd_dir, pathname ptr[in, filename], times ptr[in, itimerval])
@@ -84,6 +85,7 @@ setegid(egid gid)
seteuid(euid uid)
getsid(pid pid) pid
issetugid()
+setsid() pid
setpgid(pid pid, pgid pid)
getpgid(pid pid) pid
getpgrp(pid pid) pid
@@ -99,6 +101,10 @@ getgroups(size len[list], list ptr[inout, array[gid]])
setgroups(size len[list], list ptr[in, array[gid]])
getpriority(which flags[priority_which], who int32)
setpriority(which flags[priority_which], who int32, prio int32)
+getlogin(buf buffer[out], size len[buf])
+setlogin(buf buffer[in])
+getloginclass(buf buffer[out], size len[buf])
+setloginclass(buf buffer[in])
link(old ptr[in, filename], new ptr[in, filename])
linkat(oldfd fd_dir, old ptr[in, filename], newfd fd_dir, new ptr[in, filename], flags flags[linkat_flags])
@@ -133,6 +139,11 @@ getrusage(who flags[rusage_who], usage ptr[out, rusage])
getrlimit(res flags[rlimit_type], rlim ptr[out, rlimit])
setrlimit(res flags[rlimit_type], rlim ptr[in, rlimit])
+freebsd11_statfs(path ptr[in, filename], buf ptr[out, freebsd11_statfs])
+freebsd11_fstatfs(fd fd, buf ptr[out, freebsd11_statfs])
+statfs(path ptr[in, filename], buf ptr[out, statfs])
+fstatfs(fd fd, buf ptr[out, statfs])
+
clock_gettime(id flags[clock_id], tp ptr[out, timespec])
clock_settime(id flags[clock_id], tp ptr[in, timespec])
clock_getres(id flags[clock_id], tp ptr[out, timespec])
diff --git a/sys/freebsd/sys.txt.const b/sys/freebsd/sys.txt.const
index ccd48ffea..1b727bb05 100644
--- a/sys/freebsd/sys.txt.const
+++ b/sys/freebsd/sys.txt.const
@@ -106,6 +106,7 @@ SYS_clock_gettime = 232
SYS_clock_nanosleep = 244
SYS_clock_settime = 233
SYS_copy_file_range = 569
+SYS_eaccess = 376
SYS_execve = 59
SYS_exit = 1
SYS_faccessat = 489
@@ -119,9 +120,12 @@ SYS_fcntl = 92
SYS_fdatasync = 550
SYS_flock = 131
SYS_fork = 2
+SYS_freebsd11_fstatfs = 397
SYS_freebsd11_getdents = 272
SYS_freebsd11_mknod = 14
SYS_freebsd11_mknodat = 498
+SYS_freebsd11_statfs = 396
+SYS_fstatfs = 556
SYS_fsync = 95
SYS_ftruncate = 480
SYS_futimesat = 494
@@ -130,6 +134,8 @@ SYS_geteuid = 25
SYS_getgid = 47
SYS_getgroups = 79
SYS_getitimer = 86
+SYS_getlogin = 49
+SYS_getloginclass = 523
SYS_getpgid = 207
SYS_getpgrp = 81
SYS_getpid = 20
@@ -171,6 +177,8 @@ SYS_seteuid = 183
SYS_setgid = 181
SYS_setgroups = 80
SYS_setitimer = 83
+SYS_setlogin = 50
+SYS_setloginclass = 524
SYS_setpgid = 82
SYS_setpriority = 96
SYS_setregid = 127
@@ -178,8 +186,10 @@ SYS_setresgid = 312
SYS_setresuid = 311
SYS_setreuid = 126
SYS_setrlimit = 195
+SYS_setsid = 147
SYS_setuid = 23
SYS_sigaltstack = 53
+SYS_statfs = 555
SYS_symlink = 57
SYS_symlinkat = 502
SYS_sync = 36