diff options
| author | Beau McCartney <mccartney.beausl@gmail.com> | 2024-03-15 08:21:48 -0600 |
|---|---|---|
| committer | Beau McCartney <mccartney.beausl@gmail.com> | 2024-03-15 08:32:25 -0600 |
| commit | 24f9e16dfd59711edd0d3276360e9a98b120dfd2 (patch) | |
| tree | 63ce50408ae930c1d4ac9040a75b45bd98d79b94 /core | |
| parent | 56a29685b4407c73f66e03cedabbcf983640774d (diff) | |
sys_open() calls _sys_open_mode() to get a permission flags integer
_sys_open_mode() does exactly what sys_open() was originally doing
inline, I simply factored it into a separate function so that other
wrappers could call it (similar to _sys_permission_mode())
Diffstat (limited to 'core')
| -rw-r--r-- | core/sys/darwin/xnu_system_call_helpers.odin | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/core/sys/darwin/xnu_system_call_helpers.odin b/core/sys/darwin/xnu_system_call_helpers.odin index fab212c16..815f62466 100644 --- a/core/sys/darwin/xnu_system_call_helpers.odin +++ b/core/sys/darwin/xnu_system_call_helpers.odin @@ -128,22 +128,7 @@ sys_open :: proc(path: string, oflag: Open_Flags, mode: Permission) -> (c.int, b cflags = _sys_permission_mode(mode) - cmode |= OPEN_FLAG_RDONLY * u32(Open_Flags.RDONLY in oflag) - cmode |= OPEN_FLAG_WRONLY * u32(Open_Flags.WRONLY in oflag) - cmode |= OPEN_FLAG_RDWR * u32(Open_Flags.RDWR in oflag) - cmode |= OPEN_FLAG_NONBLOCK * u32(Open_Flags.NONBLOCK in oflag) - cmode |= OPEN_FLAG_CREAT * u32(Open_Flags.CREAT in oflag) - cmode |= OPEN_FLAG_APPEND * u32(Open_Flags.APPEND in oflag) - cmode |= OPEN_FLAG_TRUNC * u32(Open_Flags.TRUNC in oflag) - cmode |= OPEN_FLAG_EXCL * u32(Open_Flags.EXCL in oflag) - cmode |= OPEN_FLAG_SHLOCK * u32(Open_Flags.SHLOCK in oflag) - cmode |= OPEN_FLAG_EXLOCK * u32(Open_Flags.EXLOCK in oflag) - cmode |= OPEN_FLAG_DIRECTORY * u32(Open_Flags.DIRECTORY in oflag) - cmode |= OPEN_FLAG_NOFOLLOW * u32(Open_Flags.NOFOLLOW in oflag) - cmode |= OPEN_FLAG_SYMLINK * u32(Open_Flags.SYMLINK in oflag) - cmode |= OPEN_FLAG_EVTONLY * u32(Open_Flags.EVTONLY in oflag) - cmode |= OPEN_FLAG_CLOEXEC * u32(Open_Flags.CLOEXEC in oflag) - cmode |= OPEN_FLAG_NOFOLLOW_ANY * u32(Open_Flags.NOFOLLOW_ANY in oflag) + cmode = _sys_open_mode(oflag) result := syscall_open(cpath, cmode, cflags) state := result != -1 |