-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change
shm_open()
calling ABI on aarch64 Darwin
Beacuse `shm_open()` is a variadic function, if we don't declare it as such, the kernel receives trash as the `permissions` value, which occasionally results in errors when creating shared memory segments. This did not happen on `x86_64` because the calling convention doesn't change so much between variadic and non-vadiadic functions.
- Loading branch information
1 parent
f6b65ca
commit bca1504
Showing
1 changed file
with
9 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -693,9 +693,15 @@ function _shm_mmap_array(T, dims, shm_seg_name, mode) | |
end | ||
|
||
shm_unlink(shm_seg_name) = ccall(:shm_unlink, Cint, (Cstring,), shm_seg_name) | ||
shm_open(shm_seg_name, oflags, permissions) = ccall(:shm_open, Cint, | ||
(Cstring, Cint, Base.Cmode_t), shm_seg_name, oflags, permissions) | ||
|
||
function shm_open(shm_seg_name, oflags, permissions) | ||
# On macOS, `shm_open()` is a variadic function, so to properly match | ||
# calling ABI, we must declare our arguments as variadic as well. | ||
@static if Sys.isapple() | ||
return ccall(:shm_open, Cint, (Cstring, Cint, Base.Cmode_t...), shm_seg_name, oflags, permissions) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
yuyichao
Contributor
|
||
else | ||
return ccall(:shm_open, Cint, (Cstring, Cint, Base.Cmode_t), shm_seg_name, oflags, permissions) | ||
end | ||
end | ||
end # os-test | ||
|
||
end # module |
I thought you needed
@ccall
for variadic arguments and that it wasn't supported with the non-macro version. Might be wrong...