support kernels with no SYS_open syscall, only SYS_openat
open is handled specially because it is used from so many places, in so many variants (2 or 3 arguments, setting errno or not, and cancellable or not). trying to do it as a function would not only increase bloat, but would also risk subtle breakage. this is the first step towards supporting "new" archs where linux lacks "old" syscalls.
This commit is contained in:
parent
44d28e5512
commit
594c827a22
9 changed files with 26 additions and 10 deletions
|
|
@ -6,7 +6,7 @@ FILE *__fopen_rb_ca(const char *filename, FILE *f, unsigned char *buf, size_t le
|
|||
{
|
||||
memset(f, 0, sizeof *f);
|
||||
|
||||
f->fd = syscall(SYS_open, filename, O_RDONLY|O_LARGEFILE|O_CLOEXEC, 0);
|
||||
f->fd = sys_open(filename, O_RDONLY|O_CLOEXEC);
|
||||
if (f->fd < 0) return 0;
|
||||
|
||||
f->flags = F_NOWR | F_PERM;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ FILE *fopen(const char *restrict filename, const char *restrict mode)
|
|||
/* Compute the flags to pass to open() */
|
||||
flags = __fmodeflags(mode);
|
||||
|
||||
fd = syscall_cp(SYS_open, filename, flags|O_LARGEFILE, 0666);
|
||||
fd = sys_open_cp(filename, flags, 0666);
|
||||
if (fd < 0) return 0;
|
||||
|
||||
f = __fdopen(fd, mode);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ FILE *tmpfile(void)
|
|||
for (try=0; try<MAXTRIES; try++) {
|
||||
s = tmpnam(buf);
|
||||
if (!s) return 0;
|
||||
fd = syscall(SYS_open, s, O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600);
|
||||
fd = sys_open(s, O_RDWR|O_CREAT|O_EXCL, 0600);
|
||||
if (fd >= 0) {
|
||||
f = __fdopen(fd, "w+");
|
||||
__syscall(SYS_unlink, s);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue