github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/openbsd/fs.txt (about)

     1  # Copyright 2017 syzkaller project authors. All rights reserved.
     2  # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  include <sys/types.h>
     5  include <sys/stat.h>
     6  include <fcntl.h>
     7  include <unistd.h>
     8  
     9  resource fd[int32]: 0xffffffffffffffff, AT_FDCWD
    10  resource fd_dir[fd]
    11  
    12  resource pid[int32]: 0, 0xffffffffffffffff
    13  resource uid[int32]: 0, 0xffffffffffffffff
    14  resource gid[int32]: 0, 0xffffffffffffffff
    15  
    16  open(file ptr[in, filename], flags flags[open_flags], mode flags[open_mode]) fd
    17  # Just so that we have something that creates fd_dir resources.
    18  open$dir(file ptr[in, filename], flags flags[open_flags], mode flags[open_mode]) fd_dir
    19  openat(fd fd_dir, file ptr[in, filename], flags flags[open_flags], mode flags[open_mode]) fd
    20  close(fd fd)
    21  read(fd fd, buf buffer[out], count len[buf])
    22  readv(fd fd, vec ptr[in, array[iovec_out]], vlen len[vec])
    23  pread(fd fd, buf buffer[in], nbyte len[buf], off fileoff)
    24  preadv(fd fd, vec ptr[in, array[iovec_out]], vlen len[vec], off fileoff)
    25  write(fd fd, buf buffer[in], count len[buf])
    26  writev(fd fd, vec ptr[in, array[iovec_in]], vlen len[vec])
    27  pwrite(fd fd, buf buffer[in], nbyte len[buf], off fileoff)
    28  pwritev(fd fd, vec ptr[in, array[iovec_in]], vlen len[vec], off fileoff)
    29  lseek(fd fd, offset fileoff, whence flags[seek_whence])
    30  dup(oldfd fd) fd
    31  dup2(oldfd fd, newfd fd) fd
    32  pipe2(pipefd ptr[out, pipefd], flags flags[pipe_flags])
    33  
    34  pipefd {
    35  	rfd	fd
    36  	wfd	fd
    37  }
    38  
    39  iovec_in {
    40  	addr	buffer[in]
    41  	len	len[addr, intptr]
    42  }
    43  
    44  iovec_out {
    45  	addr	buffer[out]
    46  	len	len[addr, intptr]
    47  }
    48  
    49  stat {
    50  	dev	int64
    51  	ino	int64
    52  	mode	int32
    53  	nlink	int32
    54  	rdev	int64
    55  	size	int64
    56  	blksize	int32
    57  	blocks	int64
    58  	atime	int64
    59  	ansec	int64
    60  	mtime	int64
    61  	mnsec	int64
    62  	ctime	int64
    63  	cnsec	int64
    64  	pad1	const[0, int32]
    65  	pad2	const[0, int32]
    66  }
    67  
    68  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_DSYNC, O_SYNC, O_RSYNC, O_NOCTTY, O_DIRECTORY, O_ASYNC
    69  open_mode = S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH
    70  seek_whence = SEEK_SET, SEEK_CUR, SEEK_END
    71  pipe_flags = O_NONBLOCK, O_CLOEXEC