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

     1  # Copyright 2021 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[opt], 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  write(fd fd, buf buffer[in], count len[buf])
    24  writev(fd fd, vec ptr[in, array[iovec_in]], vlen len[vec])
    25  lseek(fd fd, offset fileoff, whence flags[seek_whence])
    26  dup(oldfd fd) fd
    27  dup2(oldfd fd, newfd fd) fd
    28  fstat(fd fd, statbuf ptr[out, stat])
    29  pathconf(file ptr[in, filename], name flags[conf_value])
    30  fpathconf(fd fd, name flags[conf_value])
    31  
    32  iovec_in {
    33  	addr	buffer[in]
    34  	len	len[addr, intptr]
    35  }
    36  
    37  iovec_out {
    38  	addr	buffer[out]
    39  	len	len[addr, intptr]
    40  }
    41  
    42  stat {
    43  	dev	int64
    44  	ino	int64
    45  	nlink	int64
    46  	mode	int16
    47  	__pad0	const[0, int16]
    48  	uid	uid
    49  	gid	gid
    50  	__pad1	const[0, int32]
    51  	rdev	int64
    52  	atime	int64
    53  	ansec	int64
    54  	mtime	int64
    55  	mnsec	int64
    56  	ctime	int64
    57  	cnsec	int64
    58  	btime	int64
    59  	bnsec	int64
    60  	size	int64
    61  	blocks	int64
    62  	blksize	int32
    63  	flags	int32
    64  	gen	int64
    65  	__spare	array[int64, 10]
    66  }
    67  
    68  open_flags = O_RDONLY, O_WRONLY, O_RDWR, O_NONBLOCK, O_APPEND, O_CREAT, O_TRUNC, O_EXCL, O_SHLOCK, O_EXLOCK, O_NOFOLLOW, O_SYMLINK, O_EVTONLY, O_CLOEXEC, O_NOFOLLOW_ANY
    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, SEEK_DATA, SEEK_HOLE
    71  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_XATTR_SIZE_BITS, _PC_MIN_HOLE_SIZE