sys/freebsd: add posix_fadvise(2) and posix_fallocate(2)

This commit is contained in:
Mark Johnston 2020-03-26 14:53:46 -04:00 committed by Dmitry Vyukov
parent 0645e7c7e9
commit f2e4c4ea82
7 changed files with 65 additions and 4 deletions

4
executor/defs.h generated
View File

@ -20,7 +20,7 @@
#if GOARCH_386
#define GOARCH "386"
#define SYZ_REVISION "55084199fb3df403fce43c2d2a214d5c4737485a"
#define SYZ_REVISION "ce7560b0a32eb01017cb21cee645788bf75a7ed9"
#define SYZ_EXECUTOR_USES_FORK_SERVER 1
#define SYZ_EXECUTOR_USES_SHMEM 1
#define SYZ_PAGE_SIZE 4096
@ -30,7 +30,7 @@
#if GOARCH_amd64
#define GOARCH "amd64"
#define SYZ_REVISION "2eac7eb52a6f14fbda41ca51d881aaddb9a442d4"
#define SYZ_REVISION "649ca6e7f658089a75150592b5117517423f96be"
#define SYZ_EXECUTOR_USES_FORK_SERVER 1
#define SYZ_EXECUTOR_USES_SHMEM 1
#define SYZ_PAGE_SIZE 4096

4
executor/syscalls.h generated
View File

@ -521,6 +521,8 @@ const call_t syscalls[] = {
{"openat$ptmx", 499},
{"pipe2", 542},
{"poll", 209},
{"posix_fadvise", 531},
{"posix_fallocate", 530},
{"ppoll", 545},
{"preadv", 289},
{"pwritev", 290},
@ -1031,6 +1033,8 @@ const call_t syscalls[] = {
{"openat$ptmx", 499},
{"pipe2", 542},
{"poll", 209},
{"posix_fadvise", 531},
{"posix_fallocate", 530},
{"ppoll", 545},
{"preadv", 289},
{"pwritev", 290},

21
sys/freebsd/gen/386.go generated
View File

@ -3418,6 +3418,17 @@ var syscalls_386 = []*Syscall{
&LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "nfds", TypeSize: 4}}, Path: []string{"fds"}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "timeout", TypeSize: 4}}},
}},
{NR: 531, Name: "posix_fadvise", CallName: "posix_fadvise", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "offset", TypeSize: 4}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "len", TypeSize: 4}}},
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "fadvise_advice", FldName: "advice", TypeSize: 4}}, Vals: []uint64{0, 1, 2, 3, 4, 5}},
}},
{NR: 530, Name: "posix_fallocate", CallName: "posix_fallocate", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "offset", TypeSize: 4}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "len", TypeSize: 4}}},
}},
{NR: 545, Name: "ppoll", CallName: "ppoll", Args: []Type{
&PtrType{TypeCommon{TypeName: "ptr", FldName: "fds", TypeSize: 4}, &ArrayType{TypeCommon: TypeCommon{TypeName: "array", IsVarlen: true}, Type: &StructType{Key: StructKey{Name: "pollfd"}}}},
&LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "nfds", TypeSize: 4}}, Path: []string{"fds"}},
@ -5378,6 +5389,12 @@ var consts_386 = []ConstValue{
{"POLLRDNORM", 64},
{"POLLWRBAND", 256},
{"POLLWRNORM", 4},
{"POSIX_FADV_DONTNEED", 4},
{"POSIX_FADV_NOREUSE", 5},
{Name: "POSIX_FADV_NORMAL"},
{"POSIX_FADV_RANDOM", 1},
{"POSIX_FADV_SEQUENTIAL", 2},
{"POSIX_FADV_WILLNEED", 3},
{"PROT_EXEC", 4},
{"PROT_READ", 1},
{"PROT_WRITE", 2},
@ -5651,6 +5668,8 @@ var consts_386 = []ConstValue{
{"SYS_openat", 499},
{"SYS_pipe2", 542},
{"SYS_poll", 209},
{"SYS_posix_fadvise", 531},
{"SYS_posix_fallocate", 530},
{"SYS_ppoll", 545},
{"SYS_preadv", 289},
{"SYS_pwritev", 290},
@ -5778,4 +5797,4 @@ var consts_386 = []ConstValue{
{"WUNTRACED", 2},
}
const revision_386 = "55084199fb3df403fce43c2d2a214d5c4737485a"
const revision_386 = "ce7560b0a32eb01017cb21cee645788bf75a7ed9"

View File

@ -3445,6 +3445,17 @@ var syscalls_amd64 = []*Syscall{
&LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "nfds", TypeSize: 8}}, Path: []string{"fds"}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "timeout", TypeSize: 4}}},
}},
{NR: 531, Name: "posix_fadvise", CallName: "posix_fadvise", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "offset", TypeSize: 8}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "len", TypeSize: 8}}},
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "fadvise_advice", FldName: "advice", TypeSize: 8}}, Vals: []uint64{0, 1, 2, 3, 4, 5}},
}},
{NR: 530, Name: "posix_fallocate", CallName: "posix_fallocate", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "offset", TypeSize: 8}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "len", TypeSize: 8}}},
}},
{NR: 545, Name: "ppoll", CallName: "ppoll", Args: []Type{
&PtrType{TypeCommon{TypeName: "ptr", FldName: "fds", TypeSize: 8}, &ArrayType{TypeCommon: TypeCommon{TypeName: "array", IsVarlen: true}, Type: &StructType{Key: StructKey{Name: "pollfd"}}}},
&LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "nfds", TypeSize: 8}}, Path: []string{"fds"}},
@ -5405,6 +5416,12 @@ var consts_amd64 = []ConstValue{
{"POLLRDNORM", 64},
{"POLLWRBAND", 256},
{"POLLWRNORM", 4},
{"POSIX_FADV_DONTNEED", 4},
{"POSIX_FADV_NOREUSE", 5},
{Name: "POSIX_FADV_NORMAL"},
{"POSIX_FADV_RANDOM", 1},
{"POSIX_FADV_SEQUENTIAL", 2},
{"POSIX_FADV_WILLNEED", 3},
{"PROT_EXEC", 4},
{"PROT_READ", 1},
{"PROT_WRITE", 2},
@ -5678,6 +5695,8 @@ var consts_amd64 = []ConstValue{
{"SYS_openat", 499},
{"SYS_pipe2", 542},
{"SYS_poll", 209},
{"SYS_posix_fadvise", 531},
{"SYS_posix_fallocate", 530},
{"SYS_ppoll", 545},
{"SYS_preadv", 289},
{"SYS_pwritev", 290},
@ -5805,4 +5824,4 @@ var consts_amd64 = []ConstValue{
{"WUNTRACED", 2},
}
const revision_amd64 = "2eac7eb52a6f14fbda41ca51d881aaddb9a442d4"
const revision_amd64 = "649ca6e7f658089a75150592b5117517423f96be"

View File

@ -33,6 +33,8 @@ fstat(fd fd, statbuf ptr[out, stat])
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])
posix_fallocate(fd fd, offset fileoff, len intptr)
posix_fadvise(fd fd, offset fileoff, len intptr, advice flags[fadvise_advice])
pipefd {
rfd fd
@ -103,3 +105,4 @@ open_flags = O_RDONLY, O_WRONLY, O_RDWR, O_APPEND, FASYNC, O_CLOEXEC, O_CREAT, O
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, SEEK_DATA, SEEK_HOLE
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

View File

@ -19,6 +19,12 @@ O_TRUNC = 1024
O_TTY_INIT = 524288
O_VERIFY = 2097152
O_WRONLY = 1
POSIX_FADV_DONTNEED = 4
POSIX_FADV_NOREUSE = 5
POSIX_FADV_NORMAL = 0
POSIX_FADV_RANDOM = 1
POSIX_FADV_SEQUENTIAL = 2
POSIX_FADV_WILLNEED = 3
SEEK_CUR = 1
SEEK_DATA = 3
SEEK_END = 2
@ -36,6 +42,8 @@ SYS_lseek = 478
SYS_open = 5
SYS_openat = 499
SYS_pipe2 = 542
SYS_posix_fadvise = 531
SYS_posix_fallocate = 530
SYS_preadv = 289
SYS_pwritev = 290
SYS_read = 3

View File

@ -19,6 +19,12 @@ O_TRUNC = 1024
O_TTY_INIT = 524288
O_VERIFY = 2097152
O_WRONLY = 1
POSIX_FADV_DONTNEED = 4
POSIX_FADV_NOREUSE = 5
POSIX_FADV_NORMAL = 0
POSIX_FADV_RANDOM = 1
POSIX_FADV_SEQUENTIAL = 2
POSIX_FADV_WILLNEED = 3
SEEK_CUR = 1
SEEK_DATA = 3
SEEK_END = 2
@ -36,6 +42,8 @@ SYS_lseek = 478
SYS_open = 5
SYS_openat = 499
SYS_pipe2 = 542
SYS_posix_fadvise = 531
SYS_posix_fallocate = 530
SYS_preadv = 289
SYS_pwritev = 290
SYS_read = 3