aboutsummaryrefslogtreecommitdiffstats
path: root/sys/netbsd
diff options
context:
space:
mode:
authorAyushi Sharma <35501599+ais2397@users.noreply.github.com>2020-06-27 01:56:51 +0530
committerGitHub <noreply@github.com>2020-06-26 13:26:51 -0700
commitffec44b5d1e024359410f6ba8d5e965973ede8f5 (patch)
treec2ab4af8eb5b35a7de137db035087d4cb0e3a739 /sys/netbsd
parent4b0871d90d4b0805af6324826e00cfc40005862d (diff)
Adding stat(2) and statfs(2) related syscalls (#1855)
* sys/netbsd: adding filesystem and communication syscalls * sys/netbsd: add fix for struct sockaddr_storage and profil(2) * sys/netbsd: add common ioctl(2) commands * sys/netbsd: resolving conflicts * sys/netbsd: adding stat() and statfs() related syscalls * sys/netbsd: adding missing flags for getfsstat(2) Co-authored-by: Siddharth M <siddharth.muralee@gmail.com>
Diffstat (limited to 'sys/netbsd')
-rw-r--r--sys/netbsd/fs.txt57
-rw-r--r--sys/netbsd/fs_amd64.const28
-rw-r--r--sys/netbsd/sys.txt6
-rw-r--r--sys/netbsd/sys_amd64.const6
4 files changed, 95 insertions, 2 deletions
diff --git a/sys/netbsd/fs.txt b/sys/netbsd/fs.txt
index 8bc197ac5..3e0821d8a 100644
--- a/sys/netbsd/fs.txt
+++ b/sys/netbsd/fs.txt
@@ -2,7 +2,11 @@
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
include <sys/types.h>
+include <sys/fstypes.h>
+include <sys/mount.h>
+include <sys/param.h>
include <sys/stat.h>
+include <sys/ucred.h>
include <fcntl.h>
include <unistd.h>
@@ -36,8 +40,11 @@ lseek(fd fd, pad const[0], offset fileoff, whence flags[seek_whence])
compat_43_olseek(fd fd, offset fileoff[int64], whence flags[seek_whence])
dup(oldfd fd) fd
dup2(oldfd fd, newfd fd) fd
+dup3(oldfd fd, newfd fd, flags flags[dup_flags]) fd
pipe2(pipefd ptr[out, pipefd], flags flags[pipe_flags])
+compat_20_getfsstat(buf ptr[out, statfs12], size intptr, f flags[getfsstat_flags])
+
pipefd {
rfd fd
wfd fd
@@ -74,6 +81,26 @@ stat {
spare2 int32
}
+stat12 {
+ dev int32
+ ino int32
+ mode int16
+ nlink int16
+ uid uid
+ gid gid
+ rdev int32
+ atim timespec50
+ mtim timespec50
+ ctim timespec50
+ size int32
+ blocks int64
+ blksize int32
+ flags int32
+ gen int32
+ lspare int32
+ qspare array[int64, 2]
+}
+
stat43 {
dev int16
ino int32
@@ -92,7 +119,37 @@ stat43 {
gen int32
}
+define MFSNAMELEN 16
+define MNAMELEN 90
+
+statfs12 {
+ type int16
+ oflags int16
+ bsize intptr
+ iosize intptr
+ blocks intptr
+ bfree intptr
+ bavail intptr
+ files intptr
+ ffree intptr
+ fsid fsid_t
+ owner uid
+ flags flags[statfs_flags, intptr]
+ swrites intptr
+ aswrites intptr
+ spare array[intptr, 1]
+ fstype array[int8, MFSNAMELEN]
+ mnton array[int8, MNAMELEN]
+ mntfrom array[int8, MNAMELEN]
+}
+
+fsid_t {
+ val array[int32, 2]
+}
+
open_flags = O_RDONLY, O_WRONLY, O_RDWR, O_APPEND, O_CREAT, O_TRUNC, O_EXCL, O_SHLOCK, O_EXLOCK, O_NOFOLLOW, O_CLOEXEC, O_NOSIGPIPE, O_DSYNC, O_SYNC, O_RSYNC, O_ALT_IO, O_NOCTTY, O_DIRECT, O_DIRECTORY, O_ASYNC
open_mode = S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH
seek_whence = SEEK_SET, SEEK_CUR, SEEK_END
pipe_flags = O_NONBLOCK, O_CLOEXEC, O_NOSIGPIPE
+statfs_flags = MNT_RDONLY, MNT_NOEXEC, MNT_NOSUID, MNT_NODEV, MNT_SYNCHRONOUS, MNT_ASYNC, MNT_UNION, MNT_NOCOREDUMP, MNT_SYMPERM, MNT_NODEVMTIME, MNT_SOFTDEP, MNT_LOCAL, MNT_QUOTA, MNT_ROOTFS, MNT_EXRDONLY, MNT_EXPORTED, MNT_DEFEXPORTED, MNT_EXPORTANON, MNT_EXKERB, MNT_EXNORESPORT, MNT_EXPUBLIC
+getfsstat_flags = MNT_NOWAIT, MNT_WAIT, MNT_LAZY
diff --git a/sys/netbsd/fs_amd64.const b/sys/netbsd/fs_amd64.const
index 45aa092c8..a8e73d8d8 100644
--- a/sys/netbsd/fs_amd64.const
+++ b/sys/netbsd/fs_amd64.const
@@ -1,5 +1,31 @@
# AUTOGENERATED FILE
AT_FDCWD = 18446744073709551516
+MFSNAMELEN = 16
+MNAMELEN = 90
+MNT_ASYNC = 64
+MNT_DEFEXPORTED = 512
+MNT_EXKERB = 2048
+MNT_EXNORESPORT = 134217728
+MNT_EXPORTANON = 1024
+MNT_EXPORTED = 256
+MNT_EXPUBLIC = 268435456
+MNT_EXRDONLY = 128
+MNT_LAZY = 3
+MNT_LOCAL = 4096
+MNT_NOCOREDUMP = 32768
+MNT_NODEV = 16
+MNT_NODEVMTIME = 1073741824
+MNT_NOEXEC = 4
+MNT_NOSUID = 8
+MNT_NOWAIT = 2
+MNT_QUOTA = 8192
+MNT_RDONLY = 1
+MNT_ROOTFS = 16384
+MNT_SOFTDEP = 2147483648
+MNT_SYMPERM = 536870912
+MNT_SYNCHRONOUS = 2
+MNT_UNION = 32
+MNT_WAIT = 1
O_ALT_IO = 262144
O_APPEND = 8
O_ASYNC = 64
@@ -25,10 +51,12 @@ SEEK_CUR = 1
SEEK_END = 2
SEEK_SET = 0
SYS_close = 6
+SYS_compat_20_getfsstat = 18
SYS_compat_43_ocreat = 8
SYS_compat_43_olseek = 19
SYS_dup = 41
SYS_dup2 = 90
+SYS_dup3 = 454
SYS_lseek = 199
SYS_open = 5
SYS_openat = 468
diff --git a/sys/netbsd/sys.txt b/sys/netbsd/sys.txt
index b529ca4f9..43c05c14a 100644
--- a/sys/netbsd/sys.txt
+++ b/sys/netbsd/sys.txt
@@ -25,12 +25,17 @@ syz_execute_func(text ptr[in, text[target]])
pipe(pipefd ptr[out, pipefd])
+compat_12_stat12(file ptr[in, filename], ub ptr[out, stat12])
compat_43_stat43(file ptr[in, filename], ua ptr[out, stat43])
__stat50(file ptr[in, filename], ua ptr[out, stat])
+compat_12_lstat12(file ptr[in, filename], ub ptr[out, stat12])
compat_43_lstat43(file ptr[in, filename], ua ptr[out, stat43])
__lstat50(file ptr[in, filename], ua ptr[out, stat])
+compat_12_fstat12(fd fd, sb ptr[out, stat12])
compat_43_fstat43(fd fd, sb ptr[out, stat43])
__fstat50(fd fd, sb ptr[out, stat])
+compat_20_statfs(path ptr[in, filename], buf ptr[out, statfs12])
+compat_20_fstatfs(fd fd, buf ptr[out, statfs12])
profil(samples buffer[inout], size len[samples], offt intptr, scale int32)
compat_12_msync(addr vma, len int32)
@@ -165,7 +170,6 @@ __nanosleep50(rqtp ptr[in, timespec], rmtp ptr[out, timespec, opt])
compat_50_wait4(pid pid, status ptr[out, int32, opt], options flags[wait_options], ru ptr[out, rusage50, opt])
__wait450(pid pid, status ptr[out, int32, opt], options flags[wait_options], ru ptr[out, rusage, opt])
-dup3(oldfd fd, newfd fd, flags flags[dup_flags]) fd
exit(code intptr)
ptrace(request intptr, pid pid, addr ptr[out, intptr], data intptr)
__clone(flags flags[clone_flags], sp buffer[in]) pid
diff --git a/sys/netbsd/sys_amd64.const b/sys/netbsd/sys_amd64.const
index 0b7e66977..c4af74108 100644
--- a/sys/netbsd/sys_amd64.const
+++ b/sys/netbsd/sys_amd64.const
@@ -139,7 +139,12 @@ SYS_chmod = 15
SYS_chown = 16
SYS_chroot = 61
SYS_clock_nanosleep = 477
+SYS_compat_12_fstat12 = 189
+SYS_compat_12_lstat12 = 190
SYS_compat_12_msync = 65
+SYS_compat_12_stat12 = 188
+SYS_compat_20_fstatfs = 158
+SYS_compat_20_statfs = 157
SYS_compat_30_getdents = 272
SYS_compat_43_fstat43 = 62
SYS_compat_43_lstat43 = 40
@@ -159,7 +164,6 @@ SYS_compat_50_select = 93
SYS_compat_50_setitimer = 83
SYS_compat_50_utimes = 138
SYS_compat_50_wait4 = 7
-SYS_dup3 = 454
SYS_execve = 59
SYS_exit = 1
SYS_faccessat = 462