summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2005-04-06 16:56:45 +0000
committermillert <millert@openbsd.org>2005-04-06 16:56:45 +0000
commitc113771c66e4de6a86b80d51aabce4b89552d157 (patch)
treedcbeebc6930f3257d8b257614d96f2b454fe5c9c
parentmake cvs_findcmd() available to the rest of the program (diff)
downloadwireguard-openbsd-c113771c66e4de6a86b80d51aabce4b89552d157.tar.xz
wireguard-openbsd-c113771c66e4de6a86b80d51aabce4b89552d157.zip
Make __syscall prototypes more consistent. Use register_t as the
return value for system calls that return size_t or ssize_t and quad_t for those that return off_t.
-rw-r--r--lib/libc/sys/ftruncate.c7
-rw-r--r--lib/libc/sys/lseek.c6
-rw-r--r--lib/libc/sys/mmap.c8
-rw-r--r--lib/libc/sys/mquery.c8
-rw-r--r--lib/libc/sys/pread.c17
-rw-r--r--lib/libc/sys/preadv.c17
-rw-r--r--lib/libc/sys/pwrite.c17
-rw-r--r--lib/libc/sys/pwritev.c17
-rw-r--r--lib/libc/sys/truncate.c7
9 files changed, 34 insertions, 70 deletions
diff --git a/lib/libc/sys/ftruncate.c b/lib/libc/sys/ftruncate.c
index 47670e5248d..2657adf1421 100644
--- a/lib/libc/sys/ftruncate.c
+++ b/lib/libc/sys/ftruncate.c
@@ -28,18 +28,15 @@
*/
#if defined(SYSLIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: ftruncate.c,v 1.12 2004/06/07 21:11:23 marc Exp $";
+static char rcsid[] = "$OpenBSD: ftruncate.c,v 1.13 2005/04/06 16:56:45 millert Exp $";
#endif /* SYSLIBC_SCCS and not lint */
#include <sys/types.h>
#include <sys/syscall.h>
-#include <sys/time.h>
#include <unistd.h>
#include "thread_private.h"
-#ifdef lint
-quad_t __syscall(quad_t, ...);
-#endif
+register_t __syscall(quad_t, ...);
/*
* This function provides 64-bit offset padding that
diff --git a/lib/libc/sys/lseek.c b/lib/libc/sys/lseek.c
index b5c629e1b89..d61c159b20f 100644
--- a/lib/libc/sys/lseek.c
+++ b/lib/libc/sys/lseek.c
@@ -28,15 +28,16 @@
*/
#if defined(SYSLIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: lseek.c,v 1.11 2004/06/07 21:11:23 marc Exp $";
+static char rcsid[] = "$OpenBSD: lseek.c,v 1.12 2005/04/06 16:56:45 millert Exp $";
#endif /* SYSLIBC_SCCS and not lint */
#include <sys/types.h>
-#include <sys/time.h>
#include <sys/syscall.h>
#include <unistd.h>
#include "thread_private.h"
+off_t __syscall(quad_t, ...);
+
/*
* This function provides 64-bit offset padding that
* is not supplied by GCC 1.X but is supplied by GCC 2.X.
@@ -44,7 +45,6 @@ static char rcsid[] = "$OpenBSD: lseek.c,v 1.11 2004/06/07 21:11:23 marc Exp $";
off_t
lseek(int fd, off_t offset, int whence)
{
- extern off_t __syscall();
off_t retval;
if (_FD_LOCK(fd, FD_RDWR, NULL) != 0) {
diff --git a/lib/libc/sys/mmap.c b/lib/libc/sys/mmap.c
index eb51fb70f62..de7fb90b38c 100644
--- a/lib/libc/sys/mmap.c
+++ b/lib/libc/sys/mmap.c
@@ -28,16 +28,14 @@
*/
#if defined(SYSLIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: mmap.c,v 1.12 2003/06/11 21:03:10 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: mmap.c,v 1.13 2005/04/06 16:56:45 millert Exp $";
#endif /* SYSLIBC_SCCS and not lint */
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/syscall.h>
-#ifdef lint
-quad_t __syscall(quad_t, ...);
-#endif
+register_t __syscall(quad_t, ...);
/*
* This function provides 64-bit offset padding that
@@ -47,6 +45,6 @@ void *
mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset)
{
- return((void *)(long)__syscall((quad_t)SYS_mmap, addr, len, prot,
+ return((void *)__syscall((quad_t)SYS_mmap, addr, len, prot,
flags, fd, 0, offset));
}
diff --git a/lib/libc/sys/mquery.c b/lib/libc/sys/mquery.c
index a3963ffc905..d22ce89ad26 100644
--- a/lib/libc/sys/mquery.c
+++ b/lib/libc/sys/mquery.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mquery.c,v 1.5 2004/07/15 20:04:37 deraadt Exp $ */
+/* $OpenBSD: mquery.c,v 1.6 2005/04/06 16:56:45 millert Exp $ */
/*
* Written by Artur Grabowski <art@openbsd.org> Public Domain
*/
@@ -7,9 +7,7 @@
#include <sys/mman.h>
#include <sys/syscall.h>
-#ifdef lint
-quad_t __syscall(quad_t, ...);
-#endif
+register_t __syscall(quad_t, ...);
/*
* This function provides 64-bit offset padding.
@@ -17,6 +15,6 @@ quad_t __syscall(quad_t, ...);
void *
mquery(void *addr, size_t len, int prot, int flags, int fd, off_t offset)
{
- return((void *)(long)__syscall((quad_t)SYS_mquery, addr, len, prot,
+ return((void *)__syscall((quad_t)SYS_mquery, addr, len, prot,
flags, fd, 0, offset));
}
diff --git a/lib/libc/sys/pread.c b/lib/libc/sys/pread.c
index 7d214556d2f..5c2bbca33e7 100644
--- a/lib/libc/sys/pread.c
+++ b/lib/libc/sys/pread.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pread.c,v 1.6 2003/06/11 21:03:10 deraadt Exp $ */
+/* $OpenBSD: pread.c,v 1.7 2005/04/06 16:56:45 millert Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -30,13 +30,15 @@
*/
#if defined(SYSLIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: pread.c,v 1.6 2003/06/11 21:03:10 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: pread.c,v 1.7 2005/04/06 16:56:45 millert Exp $";
#endif /* SYSLIBC_SCCS and not lint */
#include <sys/types.h>
#include <sys/syscall.h>
#include <unistd.h>
+register_t __syscall(quad_t, ...);
+
/*
* This function provides 64-bit offset padding that
* is not supplied by GCC 1.X but is supplied by GCC 2.X.
@@ -44,15 +46,6 @@ static char rcsid[] = "$OpenBSD: pread.c,v 1.6 2003/06/11 21:03:10 deraadt Exp $
ssize_t
pread(int fd, void *buf, size_t nbyte, off_t offset)
{
- extern off_t __syscall();
- 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 (__syscall((quad_t)SYS_pread, fd, buf, nbyte, 0, offset));
}
diff --git a/lib/libc/sys/preadv.c b/lib/libc/sys/preadv.c
index baabe0db0b8..3db5a4dad1c 100644
--- a/lib/libc/sys/preadv.c
+++ b/lib/libc/sys/preadv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: preadv.c,v 1.6 2003/06/11 21:03:10 deraadt Exp $ */
+/* $OpenBSD: preadv.c,v 1.7 2005/04/06 16:56:45 millert Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -30,7 +30,7 @@
*/
#if defined(SYSLIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: preadv.c,v 1.6 2003/06/11 21:03:10 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: preadv.c,v 1.7 2005/04/06 16:56:45 millert Exp $";
#endif /* SYSLIBC_SCCS and not lint */
#include <sys/types.h>
@@ -38,6 +38,8 @@ static char rcsid[] = "$OpenBSD: preadv.c,v 1.6 2003/06/11 21:03:10 deraadt Exp
#include <sys/uio.h>
#include <unistd.h>
+register_t __syscall(quad_t, ...);
+
/*
* This function provides 64-bit offset padding that
* is not supplied by GCC 1.X but is supplied by GCC 2.X.
@@ -45,15 +47,6 @@ static char rcsid[] = "$OpenBSD: preadv.c,v 1.6 2003/06/11 21:03:10 deraadt Exp
ssize_t
preadv(int fd, const struct iovec *iovp, int iovcnt, off_t offset)
{
- extern off_t __syscall();
- 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 (__syscall((quad_t)SYS_preadv, fd, iovp, iovcnt, 0, offset));
}
diff --git a/lib/libc/sys/pwrite.c b/lib/libc/sys/pwrite.c
index 04a1c268083..c7c02fcddfc 100644
--- a/lib/libc/sys/pwrite.c
+++ b/lib/libc/sys/pwrite.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pwrite.c,v 1.6 2003/06/11 21:03:10 deraadt Exp $ */
+/* $OpenBSD: pwrite.c,v 1.7 2005/04/06 16:56:45 millert Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -30,13 +30,15 @@
*/
#if defined(SYSLIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: pwrite.c,v 1.6 2003/06/11 21:03:10 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: pwrite.c,v 1.7 2005/04/06 16:56:45 millert Exp $";
#endif /* SYSLIBC_SCCS and not lint */
#include <sys/types.h>
#include <sys/syscall.h>
#include <unistd.h>
+register_t __syscall(quad_t, ...);
+
/*
* This function provides 64-bit offset padding that
* is not supplied by GCC 1.X but is supplied by GCC 2.X.
@@ -44,15 +46,6 @@ static char rcsid[] = "$OpenBSD: pwrite.c,v 1.6 2003/06/11 21:03:10 deraadt Exp
ssize_t
pwrite(int fd, const void *buf, size_t nbyte, off_t offset)
{
- extern off_t __syscall();
- 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 (__syscall((quad_t)SYS_pwrite, fd, buf, nbyte, 0, offset));
}
diff --git a/lib/libc/sys/pwritev.c b/lib/libc/sys/pwritev.c
index 0152c8912e5..d894c8e9722 100644
--- a/lib/libc/sys/pwritev.c
+++ b/lib/libc/sys/pwritev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pwritev.c,v 1.6 2003/06/11 21:03:10 deraadt Exp $ */
+/* $OpenBSD: pwritev.c,v 1.7 2005/04/06 16:56:45 millert Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -30,7 +30,7 @@
*/
#if defined(SYSLIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: pwritev.c,v 1.6 2003/06/11 21:03:10 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: pwritev.c,v 1.7 2005/04/06 16:56:45 millert Exp $";
#endif /* SYSLIBC_SCCS and not lint */
#include <sys/types.h>
@@ -38,6 +38,8 @@ static char rcsid[] = "$OpenBSD: pwritev.c,v 1.6 2003/06/11 21:03:10 deraadt Exp
#include <sys/uio.h>
#include <unistd.h>
+register_t __syscall(quad_t, ...);
+
/*
* This function provides 64-bit offset padding that
* is not supplied by GCC 1.X but is supplied by GCC 2.X.
@@ -45,15 +47,6 @@ static char rcsid[] = "$OpenBSD: pwritev.c,v 1.6 2003/06/11 21:03:10 deraadt Exp
ssize_t
pwritev(int fd, const struct iovec *iovp, int iovcnt, off_t offset)
{
- extern off_t __syscall();
- 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 (__syscall((quad_t)SYS_pwritev, fd, iovp, iovcnt, 0, offset));
}
diff --git a/lib/libc/sys/truncate.c b/lib/libc/sys/truncate.c
index c4a2f8d88d2..992136283db 100644
--- a/lib/libc/sys/truncate.c
+++ b/lib/libc/sys/truncate.c
@@ -28,15 +28,14 @@
*/
#if defined(SYSLIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: truncate.c,v 1.10 2003/06/11 21:03:10 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: truncate.c,v 1.11 2005/04/06 16:56:45 millert Exp $";
#endif /* SYSLIBC_SCCS and not lint */
#include <sys/types.h>
#include <sys/syscall.h>
+#include <unistd.h>
-#ifdef lint
-quad_t __syscall(quad_t, ...);
-#endif
+register_t __syscall(quad_t, ...);
/*
* This function provides 64-bit offset padding that