github.com/wasilibs/wazerox@v0.0.0-20240124024944-4923be63ab5f/internal/sysfs/open_file_linux.go (about) 1 package sysfs 2 3 import ( 4 "syscall" 5 6 "github.com/wasilibs/wazerox/experimental/sys" 7 ) 8 9 const supportedSyscallOflag = sys.O_DIRECTORY | sys.O_DSYNC | sys.O_NOFOLLOW | sys.O_NONBLOCK | sys.O_RSYNC 10 11 func withSyscallOflag(oflag sys.Oflag, flag int) int { 12 if oflag&sys.O_DIRECTORY != 0 { 13 flag |= syscall.O_DIRECTORY 14 } 15 if oflag&sys.O_DSYNC != 0 { 16 flag |= syscall.O_DSYNC 17 } 18 if oflag&sys.O_NOFOLLOW != 0 { 19 flag |= syscall.O_NOFOLLOW 20 } 21 if oflag&sys.O_NONBLOCK != 0 { 22 flag |= syscall.O_NONBLOCK 23 } 24 if oflag&sys.O_RSYNC != 0 { 25 flag |= syscall.O_RSYNC 26 } 27 return flag 28 }