
Unfortunately the calling convention for variadic functions is different from the calling convention of regular functions on darwin/arm64, and open happens to be such a variadic function. The syscall package treated it like a regular function, which resulted in buggy behavior. This fix introduces a wrapper function. This is the cleanest change I could come up with.
7 строки
283 Б
C
7 строки
283 Б
C
// Wrapper function because 'open' is a variadic function and variadic functions
|
|
// use a different (incompatible) calling convention on darwin/arm64.
|
|
|
|
#include <fcntl.h>
|
|
int syscall_libc_open(const char *pathname, int flags, mode_t mode) {
|
|
return open(pathname, flags, mode);
|
|
}
|