From aa398f56fa398f2202b04e82c67f822f3233786f Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sun, 20 Mar 2011 00:16:43 -0400 Subject: global cleanup to use the new syscall interface --- src/stdio/__fdopen.c | 6 +++--- src/stdio/__fopen_rb_ca.c | 2 +- src/stdio/__lockfile.c | 2 +- src/stdio/__stdio_close.c | 2 +- src/stdio/__stdio_read.c | 2 +- src/stdio/__stdio_seek.c | 6 +++--- src/stdio/__stdio_write.c | 2 +- src/stdio/fopen.c | 4 ++-- src/stdio/freopen.c | 6 +++--- src/stdio/remove.c | 2 +- src/stdio/rename.c | 2 +- src/stdio/tmpfile.c | 2 +- 12 files changed, 19 insertions(+), 19 deletions(-) (limited to 'src/stdio') diff --git a/src/stdio/__fdopen.c b/src/stdio/__fdopen.c index 6ad7c57d..235d348f 100644 --- a/src/stdio/__fdopen.c +++ b/src/stdio/__fdopen.c @@ -20,8 +20,8 @@ FILE *__fdopen(int fd, const char *mode) /* Set append mode on fd if opened for append */ if (*mode == 'a') { - int flags = __syscall_fcntl(fd, F_GETFL, 0); - __syscall_fcntl(fd, F_SETFL, flags | O_APPEND); + int flags = syscall(SYS_fcntl, fd, F_GETFL, 0); + syscall(SYS_fcntl, fd, F_SETFL, flags | O_APPEND); } f->fd = fd; @@ -30,7 +30,7 @@ FILE *__fdopen(int fd, const char *mode) /* Activate line buffered mode for terminals */ f->lbf = EOF; - if (!(f->flags & F_NOWR) && !__syscall_ioctl(fd, TCGETS, &tio)) + if (!(f->flags & F_NOWR) && !syscall(SYS_ioctl, fd, TCGETS, &tio)) f->lbf = '\n'; /* Initialize op ptrs. No problem if some are unneeded. */ diff --git a/src/stdio/__fopen_rb_ca.c b/src/stdio/__fopen_rb_ca.c index 57d9b73c..4ba50d61 100644 --- a/src/stdio/__fopen_rb_ca.c +++ b/src/stdio/__fopen_rb_ca.c @@ -4,7 +4,7 @@ FILE *__fopen_rb_ca(const char *filename, FILE *f, unsigned char *buf, size_t le { memset(f, 0, sizeof *f); - f->fd = __syscall_open(filename, O_RDONLY, 0); + f->fd = syscall(SYS_open, filename, O_RDONLY|O_LARGEFILE, 0); if (f->fd < 0) return 0; f->flags = F_NOWR | F_PERM; diff --git a/src/stdio/__lockfile.c b/src/stdio/__lockfile.c index 82f50b42..e4320f05 100644 --- a/src/stdio/__lockfile.c +++ b/src/stdio/__lockfile.c @@ -13,7 +13,7 @@ void __lockfile(FILE *f) spins = 100000; while (a_swap(&f->lock, 1)) if (spins) spins--, a_spin(); - else syscall0(__NR_sched_yield); + else syscall(SYS_sched_yield); f->owner = __pthread_self()->tid; f->lockcount = 1; } diff --git a/src/stdio/__stdio_close.c b/src/stdio/__stdio_close.c index 24fef33f..9f7ee18c 100644 --- a/src/stdio/__stdio_close.c +++ b/src/stdio/__stdio_close.c @@ -2,5 +2,5 @@ int __stdio_close(FILE *f) { - return __syscall_close(f->fd); + return syscall(SYS_close, f->fd); } diff --git a/src/stdio/__stdio_read.c b/src/stdio/__stdio_read.c index ee7e1258..d9bb3269 100644 --- a/src/stdio/__stdio_read.c +++ b/src/stdio/__stdio_read.c @@ -2,5 +2,5 @@ size_t __stdio_read(FILE *f, unsigned char *buf, size_t len) { - return __syscall_read(f->fd, buf, len); + return syscall(SYS_read, f->fd, buf, len); } diff --git a/src/stdio/__stdio_seek.c b/src/stdio/__stdio_seek.c index c7a5b730..c205ab82 100644 --- a/src/stdio/__stdio_seek.c +++ b/src/stdio/__stdio_seek.c @@ -8,11 +8,11 @@ static off_t retneg1(FILE *f, off_t off, int whence) off_t __stdio_seek(FILE *f, off_t off, int whence) { off_t ret; -#ifdef __NR__llseek - if (syscall5(__NR__llseek, f->fd, off>>32, off, (long)&ret, whence)<0) +#ifdef SYS__llseek + if (syscall(SYS__llseek, f->fd, off>>32, off, &ret, whence)<0) ret = -1; #else - ret = syscall3(__NR_lseek, f->fd, off, whence); + ret = syscall(SYS_lseek, f->fd, off, whence); #endif /* Detect unseekable files and optimize future failures out */ if (ret < 0 && off == 0 && whence == SEEK_CUR) diff --git a/src/stdio/__stdio_write.c b/src/stdio/__stdio_write.c index 78545626..d4264eff 100644 --- a/src/stdio/__stdio_write.c +++ b/src/stdio/__stdio_write.c @@ -4,6 +4,6 @@ size_t __stdio_write(FILE *f, const unsigned char *buf, size_t len) { const unsigned char *stop = buf+len; ssize_t cnt = 1; - for (; buffd, buf, len))>0; buf+=cnt); + for (; buffd, buf, len))>0; buf+=cnt); return len-(stop-buf); } diff --git a/src/stdio/fopen.c b/src/stdio/fopen.c index 670cf5f3..c2a350d1 100644 --- a/src/stdio/fopen.c +++ b/src/stdio/fopen.c @@ -21,13 +21,13 @@ FILE *fopen(const char *filename, const char *mode) if (*mode == 'w') flags |= O_TRUNC; if (*mode == 'a') flags |= O_APPEND; - fd = __syscall_open(filename, flags, 0666); + fd = syscall(SYS_open, filename, flags|O_LARGEFILE, 0666); if (fd < 0) return 0; f = __fdopen(fd, mode); if (f) return f; - __syscall_close(fd); + syscall(SYS_close, fd); return 0; } diff --git a/src/stdio/freopen.c b/src/stdio/freopen.c index 8d3af9fc..958dbd20 100644 --- a/src/stdio/freopen.c +++ b/src/stdio/freopen.c @@ -17,13 +17,13 @@ FILE *freopen(const char *filename, const char *mode, FILE *f) if (!filename) { f2 = fopen("/dev/null", mode); if (!f2) goto fail; - fl = __syscall_fcntl(f2->fd, F_GETFL, 0); - if (fl < 0 || __syscall_fcntl(f->fd, F_SETFL, fl) < 0) + fl = syscall(SYS_fcntl, f2->fd, F_GETFL, 0); + if (fl < 0 || syscall(SYS_fcntl, f->fd, F_SETFL, fl) < 0) goto fail2; } else { f2 = fopen(filename, mode); if (!f2) goto fail; - if (__syscall_dup2(f2->fd, f->fd) < 0) + if (syscall(SYS_dup2, f2->fd, f->fd) < 0) goto fail2; } diff --git a/src/stdio/remove.c b/src/stdio/remove.c index 8e338277..9e1de7f2 100644 --- a/src/stdio/remove.c +++ b/src/stdio/remove.c @@ -3,5 +3,5 @@ int remove(const char *path) { - return __syscall_unlink(path); + return syscall(SYS_unlink, path); } diff --git a/src/stdio/rename.c b/src/stdio/rename.c index 4eced08a..97f14535 100644 --- a/src/stdio/rename.c +++ b/src/stdio/rename.c @@ -3,5 +3,5 @@ int rename(const char *old, const char *new) { - return syscall2(__NR_rename, (long)old, (long)new); + return syscall(SYS_rename, old, new); } diff --git a/src/stdio/tmpfile.c b/src/stdio/tmpfile.c index 185025f1..b050f7fd 100644 --- a/src/stdio/tmpfile.c +++ b/src/stdio/tmpfile.c @@ -11,7 +11,7 @@ FILE *tmpfile(void) for (;;) { s = tmpnam(buf); if (!s) return NULL; - fd = __syscall_open(s, O_RDWR | O_CREAT | O_EXCL, 0600); + fd = syscall(SYS_open, s, O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600); if (fd >= 0) { f = __fdopen(fd, "w+"); remove(s); -- cgit v1.2.1