diff options
| author | dsl <dsl@NetBSD.org> | 2007-11-22 21:11:30 +0000 |
|---|---|---|
| committer | dsl <dsl@NetBSD.org> | 2007-11-22 21:11:30 +0000 |
| commit | b0b7248d927796fbeda167a42fe9bdc2fb5792cd (patch) | |
| tree | f3cb5ec0ce63a3742230d33c1794d50a62ce65d3 /lib/libc | |
| parent | 5dec3ab6673af234eaf1539a73273b4722f3bb13 (diff) | |
Change all the syscall C 'glue' functions (most of which just add in an
extra argument to ensure that 'off_t' parameters are even numbered
parameters for stack alignment reasons on 32 bit systems) to use a normal
'syscall' wrapper for __foo instead of using __syscall(SYS_foo, ... ).
This saves all the faffing needed to get a 32bit return value on sparc.
Auto-generate the extra syscall wrappers.
Move swapon.c into the correct list (swapon() uses swapctl()).
This probably means there are very few users of syscall() and __syscall() left.
Diffstat (limited to 'lib/libc')
| -rw-r--r-- | lib/libc/sys/Makefile.inc | 29 | ||||
| -rw-r--r-- | lib/libc/sys/adjtime.c | 14 | ||||
| -rw-r--r-- | lib/libc/sys/clock_settime.c | 14 | ||||
| -rw-r--r-- | lib/libc/sys/ftruncate.c | 16 | ||||
| -rw-r--r-- | lib/libc/sys/lseek.c | 8 | ||||
| -rw-r--r-- | lib/libc/sys/mmap.c | 16 | ||||
| -rw-r--r-- | lib/libc/sys/ntp_adjtime.c | 14 | ||||
| -rw-r--r-- | lib/libc/sys/pread.c | 15 | ||||
| -rw-r--r-- | lib/libc/sys/preadv.c | 16 | ||||
| -rw-r--r-- | lib/libc/sys/pwrite.c | 15 | ||||
| -rw-r--r-- | lib/libc/sys/pwritev.c | 16 | ||||
| -rw-r--r-- | lib/libc/sys/settimeofday.c | 14 | ||||
| -rw-r--r-- | lib/libc/sys/truncate.c | 16 |
13 files changed, 81 insertions, 122 deletions
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index 52d809e48b3..45b023f8b48 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.180 2007/11/13 15:21:19 ad Exp $ +# $NetBSD: Makefile.inc,v 1.181 2007/11/22 21:11:30 dsl Exp $ # @(#)Makefile.inc 8.3 (Berkeley) 10/24/94 # sys sources @@ -23,14 +23,27 @@ CLEANFILES+= ${_LSRC:MLintSys*.c} .endif # glue to offer userland wrappers for some syscalls -SRCS+= sigtimedwait.c sigwait.c sigwaitinfo.c statvfs.c +SRCS+= sigtimedwait.c sigwait.c sigwaitinfo.c statvfs.c swapon.c # glue to provide compatibility between GCC 1.X and 2.X and for compat # with old syscall interfaces. -SRCS+= adjtime.c clock_settime.c ftruncate.c \ +GLUE+= adjtime.c clock_settime.c ftruncate.c \ lseek.c mmap.c ntp_adjtime.c pread.c preadv.c pwrite.c \ pwritev.c settimeofday.c \ - swapon.c truncate.c + truncate.c + +# 'glue' files might .c or .S depending on the architecture +.for glue in ${GLUE} +.if exists(${glue:.c=.S}) +# Build the ASM glue file +SRCS+=${glue:.c=.S} +.else +# Build the C glue file +SRCS+= ${glue} +# and an asm entry for __<syscall> +ASM_GLUE+= __${glue:.c=.S} +.endif +.endfor # glue to syscalls that may pass structs or unions, which cannot be # handled portably and easily by the syscall interface. The glue @@ -108,8 +121,8 @@ NOERR= getegid.S geteuid.S getgid.S getpid.S getppid.S getuid.S \ PSEUDONOERR= _exit.S -SRCS+= ${ASM} ${WEAKASM} ${NOERR} ${PSEUDONOERR} -CLEANFILES+= ${ASM} ${WEAKASM} ${NOERR} ${PSEUDONOERR} +SRCS+= ${ASM} ${WEAKASM} ${NOERR} ${PSEUDONOERR} ${ASM_GLUE} +CLEANFILES+= ${ASM} ${WEAKASM} ${NOERR} ${PSEUDONOERR} ${ASM_GLUE} ASMDEPS= ${.CURDIR}/sys/Makefile.inc ${ARCHDIR}/SYS.h \ ${DESTDIR}/usr/include/sys/syscall.h @@ -120,6 +133,10 @@ ${ASM}: ${ASMDEPS} ${_MKTARGET_CREATE} printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' >${.TARGET} +${ASM_GLUE}: ${ASMDEPS} + ${_MKTARGET_CREATE} + printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/__//})\n' >${.TARGET} + ${WEAKASM}: ${ASMDEPS} ${_MKTARGET_CREATE} printf '#include "SYS.h"\nWSYSCALL(${.PREFIX},_sys_${.PREFIX})\nWEAK_ALIAS(_${.PREFIX},_sys_${.PREFIX})\n' >${.TARGET} diff --git a/lib/libc/sys/adjtime.c b/lib/libc/sys/adjtime.c index 14a4ed310a9..f0429c79232 100644 --- a/lib/libc/sys/adjtime.c +++ b/lib/libc/sys/adjtime.c @@ -1,4 +1,4 @@ -/* $NetBSD: adjtime.c,v 1.8 2006/10/07 20:02:01 kardel Exp $ */ +/* $NetBSD: adjtime.c,v 1.9 2007/11/22 21:11:31 dsl Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: adjtime.c,v 1.8 2006/10/07 20:02:01 kardel Exp $"); +__RCSID("$NetBSD: adjtime.c,v 1.9 2007/11/22 21:11:31 dsl Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -55,13 +55,14 @@ __weak_alias(adjtime,_adjtime) extern int __clockctl_fd; +int __adjtime(const struct timeval *delta, struct timeval *olddelta); + int adjtime(delta, olddelta) const struct timeval *delta; struct timeval *olddelta; { struct clockctl_adjtime args; - quad_t q; int rv; /* @@ -69,12 +70,7 @@ adjtime(delta, olddelta) * clockctl if that fails with EPERM */ if (__clockctl_fd == -1) { - q = __syscall((quad_t)SYS_adjtime, delta, olddelta); - if (/* LINTED constant */ sizeof (quad_t) == sizeof (register_t) - || /* LINTED constant */ BYTE_ORDER == LITTLE_ENDIAN) - rv = (int)q; - else - rv = (int)((u_quad_t)q >> 32); + rv = __adjtime(delta, olddelta); /* * try via clockctl if the call fails with EPERM diff --git a/lib/libc/sys/clock_settime.c b/lib/libc/sys/clock_settime.c index f3c41a0204e..13c16f7e3ef 100644 --- a/lib/libc/sys/clock_settime.c +++ b/lib/libc/sys/clock_settime.c @@ -1,4 +1,4 @@ -/* $NetBSD: clock_settime.c,v 1.8 2006/10/07 20:02:01 kardel Exp $ */ +/* $NetBSD: clock_settime.c,v 1.9 2007/11/22 21:11:31 dsl Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: clock_settime.c,v 1.8 2006/10/07 20:02:01 kardel Exp $"); +__RCSID("$NetBSD: clock_settime.c,v 1.9 2007/11/22 21:11:31 dsl Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -57,13 +57,14 @@ __weak_alias(clock_settime,_clock_settime) extern int __clockctl_fd; +int __clock_settime(clockid_t clock_id, const struct timespec *tp); + int clock_settime(clock_id, tp) clockid_t clock_id; const struct timespec *tp; { struct clockctl_clock_settime args; - quad_t q; int rv; /* @@ -71,12 +72,7 @@ clock_settime(clock_id, tp) * clockctl if that fails. */ if (__clockctl_fd == -1) { - q = __syscall((quad_t)SYS_clock_settime, clock_id, tp); - if (/* LINTED constant */ sizeof (quad_t) == sizeof (register_t) - || /* LINTED constant */ BYTE_ORDER == LITTLE_ENDIAN) - rv = (int)q; - else - rv = (int)((u_quad_t)q >> 32); + rv = __clock_settime(clock_id, tp); /* * return unless we failed with EPERM diff --git a/lib/libc/sys/ftruncate.c b/lib/libc/sys/ftruncate.c index 8972c3fde53..baa41c22357 100644 --- a/lib/libc/sys/ftruncate.c +++ b/lib/libc/sys/ftruncate.c @@ -1,4 +1,4 @@ -/* $NetBSD: ftruncate.c,v 1.11 2003/08/07 16:43:57 agc Exp $ */ +/* $NetBSD: ftruncate.c,v 1.12 2007/11/22 21:11:31 dsl Exp $ */ /* * Copyright (c) 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)ftruncate.c 8.1 (Berkeley) 6/17/93"; #else -__RCSID("$NetBSD: ftruncate.c,v 1.11 2003/08/07 16:43:57 agc Exp $"); +__RCSID("$NetBSD: ftruncate.c,v 1.12 2007/11/22 21:11:31 dsl Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -47,6 +47,8 @@ __RCSID("$NetBSD: ftruncate.c,v 1.11 2003/08/07 16:43:57 agc Exp $"); __weak_alias(ftruncate,_ftruncate) #endif +int __ftruncate(int fd, int, off_t length); + /* * This function provides 64-bit offset padding that * is not supplied by GCC 1.X but is supplied by GCC 2.X. @@ -56,14 +58,6 @@ ftruncate(fd, length) int fd; off_t length; { - quad_t q; - int rv; - q = __syscall((quad_t)SYS_ftruncate, fd, 0, length); - if (/* LINTED constant */ sizeof (quad_t) == sizeof (register_t) || - /* LINTED constant */ BYTE_ORDER == LITTLE_ENDIAN) - rv = (int)q; - else - rv = (int)((u_quad_t)q >> 32); - return rv; + return __ftruncate(fd, 0, length); } diff --git a/lib/libc/sys/lseek.c b/lib/libc/sys/lseek.c index ac0efaf725b..0c6a1118a0a 100644 --- a/lib/libc/sys/lseek.c +++ b/lib/libc/sys/lseek.c @@ -1,4 +1,4 @@ -/* $NetBSD: lseek.c,v 1.8 2003/08/07 16:44:01 agc Exp $ */ +/* $NetBSD: lseek.c,v 1.9 2007/11/22 21:11:31 dsl Exp $ */ /* * Copyright (c) 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)lseek.c 8.1 (Berkeley) 6/17/93"; #else -__RCSID("$NetBSD: lseek.c,v 1.8 2003/08/07 16:44:01 agc Exp $"); +__RCSID("$NetBSD: lseek.c,v 1.9 2007/11/22 21:11:31 dsl Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -47,6 +47,8 @@ __RCSID("$NetBSD: lseek.c,v 1.8 2003/08/07 16:44:01 agc Exp $"); __weak_alias(lseek,_lseek) #endif +off_t __lseek(int fd, int, off_t offset, int whence); + /* * This function provides 64-bit offset padding that * is not supplied by GCC 1.X but is supplied by GCC 2.X. @@ -58,5 +60,5 @@ lseek(fd, offset, whence) int whence; { - return(__syscall((quad_t)SYS_lseek, fd, 0, offset, whence)); + return __lseek(fd, 0, offset, whence); } diff --git a/lib/libc/sys/mmap.c b/lib/libc/sys/mmap.c index 628a192a826..7431ad839b4 100644 --- a/lib/libc/sys/mmap.c +++ b/lib/libc/sys/mmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: mmap.c,v 1.12 2003/08/07 16:44:02 agc Exp $ */ +/* $NetBSD: mmap.c,v 1.13 2007/11/22 21:11:31 dsl Exp $ */ /* * Copyright (c) 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)mmap.c 8.1 (Berkeley) 6/17/93"; #else -__RCSID("$NetBSD: mmap.c,v 1.12 2003/08/07 16:44:02 agc Exp $"); +__RCSID("$NetBSD: mmap.c,v 1.13 2007/11/22 21:11:31 dsl Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -48,6 +48,8 @@ __RCSID("$NetBSD: mmap.c,v 1.12 2003/08/07 16:44:02 agc Exp $"); __weak_alias(mmap,_mmap) #endif +void *__mmap(void *addr, size_t len, int prot, int flags, int fd, int, off_t offset); + /* * This function provides 64-bit offset padding that * is not supplied by GCC 1.X but is supplied by GCC 2.X. @@ -61,14 +63,6 @@ mmap(addr, len, prot, flags, fd, offset) int fd; off_t offset; { - quad_t q; - caddr_t rv; - q = __syscall((quad_t)SYS_mmap, addr, len, prot, flags, fd, 0, offset); - if (/* LINTED constant */ sizeof (quad_t) == sizeof (register_t) || - /* LINTED constant */ BYTE_ORDER == LITTLE_ENDIAN) - rv = (caddr_t)(long)q; - else - rv = (caddr_t)(long)((u_quad_t)q >> 32); - return rv; + return __mmap(addr, len, prot, flags, fd, 0, offset); } diff --git a/lib/libc/sys/ntp_adjtime.c b/lib/libc/sys/ntp_adjtime.c index 1b9aead59ff..5599bca8bee 100644 --- a/lib/libc/sys/ntp_adjtime.c +++ b/lib/libc/sys/ntp_adjtime.c @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_adjtime.c,v 1.9 2007/01/17 23:24:22 hubertf Exp $ */ +/* $NetBSD: ntp_adjtime.c,v 1.10 2007/11/22 21:11:31 dsl Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: ntp_adjtime.c,v 1.9 2007/01/17 23:24:22 hubertf Exp $"); +__RCSID("$NetBSD: ntp_adjtime.c,v 1.10 2007/11/22 21:11:31 dsl Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -57,13 +57,14 @@ __weak_alias(ntp_adjtime,_ntp_adjtime) extern int __clockctl_fd; +int __ntp_adjtime(struct timex *tp); + int ntp_adjtime(tp) struct timex *tp; { struct clockctl_ntp_adjtime args; int error; - quad_t q; int rv; /* @@ -73,12 +74,7 @@ ntp_adjtime(tp) * ntp_adjtime() is callable for mortals if tp->modes == 0 ! */ if (__clockctl_fd == -1) { - q = __syscall((quad_t)SYS_ntp_adjtime, tp); - if (/* LINTED constant */ sizeof (quad_t) == sizeof (register_t) - || /* LINTED constant */ BYTE_ORDER == LITTLE_ENDIAN) - rv = (int)q; - else - rv = (int)((u_quad_t)q >> 32); + rv = __ntp_adjtime(tp); /* * if we fail with EPERM we try the clockctl device diff --git a/lib/libc/sys/pread.c b/lib/libc/sys/pread.c index c1ba6141b3e..d8352f4f550 100644 --- a/lib/libc/sys/pread.c +++ b/lib/libc/sys/pread.c @@ -1,4 +1,4 @@ -/* $NetBSD: pread.c,v 1.8 2006/11/10 17:37:39 christos Exp $ */ +/* $NetBSD: pread.c,v 1.9 2007/11/22 21:11:31 dsl Exp $ */ /* * Copyright (c) 1992, 1993 @@ -31,7 +31,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: pread.c,v 1.8 2006/11/10 17:37:39 christos Exp $"); +__RCSID("$NetBSD: pread.c,v 1.9 2007/11/22 21:11:31 dsl Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -48,6 +48,7 @@ __weak_alias(_pread,_sys_pread) #endif ssize_t _sys_pread(int, void *, size_t, off_t); +ssize_t __pread(int, void *, size_t, int, off_t); /* * This function provides 64-bit offset padding that @@ -56,14 +57,6 @@ ssize_t _sys_pread(int, void *, size_t, off_t); ssize_t _sys_pread(int fd, void *buf, size_t nbyte, off_t offset) { - quad_t q; - int rv; - q = __syscall((quad_t)SYS_pread, fd, buf, nbyte, 0, offset); - if (/* LINTED constant */ sizeof (quad_t) == sizeof (register_t) || - /* LINTED constant */ BYTE_ORDER == LITTLE_ENDIAN) - rv = (int)q; - else - rv = (int)((u_quad_t)q >> 32); - return rv; + return __pread(fd, buf, nbyte, 0, offset); } diff --git a/lib/libc/sys/preadv.c b/lib/libc/sys/preadv.c index 3cafa3b3733..d1236697099 100644 --- a/lib/libc/sys/preadv.c +++ b/lib/libc/sys/preadv.c @@ -1,4 +1,4 @@ -/* $NetBSD: preadv.c,v 1.4 2003/08/07 16:44:04 agc Exp $ */ +/* $NetBSD: preadv.c,v 1.5 2007/11/22 21:11:32 dsl Exp $ */ /* * Copyright (c) 1992, 1993 @@ -31,7 +31,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: preadv.c,v 1.4 2003/08/07 16:44:04 agc Exp $"); +__RCSID("$NetBSD: preadv.c,v 1.5 2007/11/22 21:11:32 dsl Exp $"); #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -39,6 +39,8 @@ __RCSID("$NetBSD: preadv.c,v 1.4 2003/08/07 16:44:04 agc Exp $"); #include <sys/uio.h> #include <unistd.h> +ssize_t __preadv(int fd, const struct iovec *iovp, int iovcnt, int, off_t offset); + /* * This function provides 64-bit offset padding that * is not supplied by GCC 1.X but is supplied by GCC 2.X. @@ -50,14 +52,6 @@ preadv(fd, iovp, iovcnt, offset) int iovcnt; off_t offset; { - quad_t q; - int rv; - q = __syscall((quad_t)SYS_preadv, fd, iovp, iovcnt, 0, offset); - if (/* LINTED constant */ sizeof (quad_t) == sizeof (register_t) || - /* LINTED constant */ BYTE_ORDER == LITTLE_ENDIAN) - rv = (int)q; - else - rv = (int)((u_quad_t)q >> 32); - return rv; + return __preadv(fd, iovp, iovcnt, 0, offset); } diff --git a/lib/libc/sys/pwrite.c b/lib/libc/sys/pwrite.c index 558868e3ff9..2a7b23342ca 100644 --- a/lib/libc/sys/pwrite.c +++ b/lib/libc/sys/pwrite.c @@ -1,4 +1,4 @@ -/* $NetBSD: pwrite.c,v 1.8 2006/11/10 17:37:39 christos Exp $ */ +/* $NetBSD: pwrite.c,v 1.9 2007/11/22 21:11:32 dsl Exp $ */ /* * Copyright (c) 1992, 1993 @@ -31,7 +31,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: pwrite.c,v 1.8 2006/11/10 17:37:39 christos Exp $"); +__RCSID("$NetBSD: pwrite.c,v 1.9 2007/11/22 21:11:32 dsl Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -48,6 +48,7 @@ __weak_alias(_pwrite,_sys_pwrite) #endif ssize_t _sys_pwrite(int, const void *, size_t, off_t); +ssize_t __pwrite(int, const void *, size_t, int, off_t); /* * This function provides 64-bit offset padding that @@ -56,14 +57,6 @@ ssize_t _sys_pwrite(int, const void *, size_t, off_t); ssize_t _sys_pwrite(int fd, const void *buf, size_t nbyte, off_t offset) { - quad_t q; - int rv; - q = __syscall((quad_t)SYS_pwrite, fd, buf, nbyte, 0, offset); - if (/* LINTED constant */ sizeof (quad_t) == sizeof (register_t) || - /* LINTED constant */ BYTE_ORDER == LITTLE_ENDIAN) - rv = (int)q; - else - rv = (int)((u_quad_t)q >> 32); - return rv; + return __pwrite(fd, buf, nbyte, 0, offset); } diff --git a/lib/libc/sys/pwritev.c b/lib/libc/sys/pwritev.c index deaecc3caab..0d502c7838f 100644 --- a/lib/libc/sys/pwritev.c +++ b/lib/libc/sys/pwritev.c @@ -1,4 +1,4 @@ -/* $NetBSD: pwritev.c,v 1.4 2003/08/07 16:44:04 agc Exp $ */ +/* $NetBSD: pwritev.c,v 1.5 2007/11/22 21:11:32 dsl Exp $ */ /* * Copyright (c) 1992, 1993 @@ -31,7 +31,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: pwritev.c,v 1.4 2003/08/07 16:44:04 agc Exp $"); +__RCSID("$NetBSD: pwritev.c,v 1.5 2007/11/22 21:11:32 dsl Exp $"); #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -39,6 +39,8 @@ __RCSID("$NetBSD: pwritev.c,v 1.4 2003/08/07 16:44:04 agc Exp $"); #include <sys/uio.h> #include <unistd.h> +ssize_t __pwritev(int fd, const struct iovec *iovp, int iovcnt, int, off_t offset); + /* * This function provides 64-bit offset padding that * is not supplied by GCC 1.X but is supplied by GCC 2.X. @@ -50,14 +52,6 @@ pwritev(fd, iovp, iovcnt, offset) int iovcnt; off_t offset; { - quad_t q; - int rv; - q = __syscall((quad_t)SYS_pwritev, fd, iovp, iovcnt, 0, offset); - if (/* LINTED constant */ sizeof (quad_t) == sizeof (register_t) || - /* LINTED constant */ BYTE_ORDER == LITTLE_ENDIAN) - rv = (int)q; - else - rv = (int)((u_quad_t)q >> 32); - return rv; + return __pwritev(fd, iovp, iovcnt, 0, offset); } diff --git a/lib/libc/sys/settimeofday.c b/lib/libc/sys/settimeofday.c index 17d669fcc34..98b6dc2a20e 100644 --- a/lib/libc/sys/settimeofday.c +++ b/lib/libc/sys/settimeofday.c @@ -1,4 +1,4 @@ -/* $NetBSD: settimeofday.c,v 1.10 2006/10/07 20:02:01 kardel Exp $ */ +/* $NetBSD: settimeofday.c,v 1.11 2007/11/22 21:11:32 dsl Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: settimeofday.c,v 1.10 2006/10/07 20:02:01 kardel Exp $"); +__RCSID("$NetBSD: settimeofday.c,v 1.11 2007/11/22 21:11:32 dsl Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -57,13 +57,14 @@ __weak_alias(settimeofday,_settimeofday) int __clockctl_fd = -1; +int __settimeofday(const struct timeval *tv, const void *tzp); + int settimeofday(tv, tzp) const struct timeval *tv; const void *tzp; { struct clockctl_settimeofday args; - quad_t q; int rv; /* @@ -71,12 +72,7 @@ settimeofday(tv, tzp) * if that fails with EPERM */ if (__clockctl_fd == -1) { - q = __syscall((quad_t)SYS_settimeofday, tv, tzp); - if (/* LINTED constant */ sizeof (quad_t) == sizeof (register_t) - || /* LINTED constant */ BYTE_ORDER == LITTLE_ENDIAN) - rv = (int)q; - else - rv = (int)((u_quad_t)q >> 32); + rv = __settimeofday(tv, tzp); /* * switch to clockctl if we fail with EPERM, this diff --git a/lib/libc/sys/truncate.c b/lib/libc/sys/truncate.c index 17c689376bf..416fbfa327f 100644 --- a/lib/libc/sys/truncate.c +++ b/lib/libc/sys/truncate.c @@ -1,4 +1,4 @@ -/* $NetBSD: truncate.c,v 1.10 2003/08/07 16:44:10 agc Exp $ */ +/* $NetBSD: truncate.c,v 1.11 2007/11/22 21:11:32 dsl Exp $ */ /* * Copyright (c) 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)truncate.c 8.1 (Berkeley) 6/17/93"; #else -__RCSID("$NetBSD: truncate.c,v 1.10 2003/08/07 16:44:10 agc Exp $"); +__RCSID("$NetBSD: truncate.c,v 1.11 2007/11/22 21:11:32 dsl Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -42,6 +42,8 @@ __RCSID("$NetBSD: truncate.c,v 1.10 2003/08/07 16:44:10 agc Exp $"); #include <sys/syscall.h> #include <unistd.h> +int __truncate(const char *path, int, off_t length); + /* * This function provides 64-bit offset padding that * is not supplied by GCC 1.X but is supplied by GCC 2.X. @@ -51,14 +53,6 @@ truncate(path, length) const char *path; off_t length; { - quad_t q; - int rv; - q = __syscall((quad_t)SYS_truncate, path, 0, length); - if (/* LINTED constant */ sizeof (quad_t) == sizeof (register_t) || - /* LINTED constant */ BYTE_ORDER == LITTLE_ENDIAN) - rv = (int)q; - else - rv = (int)((u_quad_t)q >> 32); - return rv; + return __truncate(path, 0, length); } |
