Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/lib/libc Pull up following revision(s) (requested by chri...



details:   https://anonhg.NetBSD.org/src/rev/7b41696bdac3
branches:  netbsd-7
changeset: 798961:7b41696bdac3
user:      snj <snj%NetBSD.org@localhost>
date:      Sun Feb 08 22:05:55 2015 +0000

description:
Pull up following revision(s) (requested by christos in ticket #472):
        lib/libc/include/namespace.h: revision 1.175
        lib/libc/sys/Makefile.inc: revision 1.225, 1.227
        lib/libc/sys/fdiscard.2: revision 1.3
        lib/libc/sys/fdiscard.c: revision 1.1
        lib/libc/sys/posix_fallocate.c: revision 1.1
Fix argument paddiing for posix_fallocate and fdiscard with gcc 1.x
--
PR/49617: Kirk Russell: posix_fallocate() should be returning an error on
failure, without setting errno, so make it PSEUDO_NOERROR, by adding a new
category GLUENOERR.
--
PR/49617: Kirk Russell: Describe the posix_fallocate return values correctly.

diffstat:

 lib/libc/include/namespace.h   |   4 ++-
 lib/libc/sys/Makefile.inc      |  41 ++++++++++++++++++++++++++------
 lib/libc/sys/fdiscard.2        |  16 +++++++++---
 lib/libc/sys/fdiscard.c        |  52 ++++++++++++++++++++++++++++++++++++++++++
 lib/libc/sys/posix_fallocate.c |  52 ++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 152 insertions(+), 13 deletions(-)

diffs (260 lines):

diff -r 5a56e7d56e6d -r 7b41696bdac3 lib/libc/include/namespace.h
--- a/lib/libc/include/namespace.h      Thu Feb 05 15:14:19 2015 +0000
+++ b/lib/libc/include/namespace.h      Sun Feb 08 22:05:55 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: namespace.h,v 1.174 2014/06/13 15:45:05 joerg Exp $    */
+/*     $NetBSD: namespace.h,v 1.174.2.1 2015/02/08 22:05:55 snj Exp $  */
 
 /*-
  * Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
@@ -281,6 +281,7 @@
 #define execv                  _execv
 #define execvp                 _execvp
 #define explicit_memset                _explicit_memset
+#define fdiscard               _fdiscard
 #define fdopen                 _fdopen
 #define fgetln                 _fgetln
 #define fgetwln                        _fgetwln
@@ -520,6 +521,7 @@
 #define pread                  _pread
 #define printf_l               _printf_l
 #define pselect                        _pselect
+#define posix_fallocate                _posix_fallocate
 #define psignal                        _psignal
 #define pthread_atfork         _pthread_atfork
 #define ptree_init             ptree_init
diff -r 5a56e7d56e6d -r 7b41696bdac3 lib/libc/sys/Makefile.inc
--- a/lib/libc/sys/Makefile.inc Thu Feb 05 15:14:19 2015 +0000
+++ b/lib/libc/sys/Makefile.inc Sun Feb 08 22:05:55 2015 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.224 2014/07/25 08:30:47 dholland Exp $
+#      $NetBSD: Makefile.inc,v 1.224.2.1 2015/02/08 22:05:55 snj Exp $
 #      @(#)Makefile.inc        8.3 (Berkeley) 10/24/94
 
 # sys sources
@@ -30,9 +30,10 @@
 
 # glue to provide compatibility between GCC 1.X and 2.X and for compat
 # with old syscall interfaces.
-GLUE+= ftruncate.c lseek.c mmap.c pread.c preadv.c pwrite.c \
-       pwritev.c truncate.c ntp_adjtime.c mknodat.c
-
+GLUE+= fdiscard.c ftruncate.c lseek.c mmap.c \
+       pread.c preadv.c pwrite.c pwritev.c truncate.c ntp_adjtime.c \
+       mknodat.c
+GLUENOERR+= posix_fallocate.c
 GLUE50+= adjtime.c clock_settime.c settimeofday.c
 
 # 'glue' files might .c or .S depending on the architecture
@@ -53,6 +54,23 @@
 .endfor
 
 # 'glue' files might .c or .S depending on the architecture
+.for glue in ${GLUENOERR}
+. if exists(${glue:.c=.S})
+# Build the ASM glue file
+SRCS+=${glue:.c=.S}
+. else
+.  if exists(__${glue:.c=.S})
+SRCS+=__${glue:.c=.S} ${glue}
+.  else
+# Build the C glue file
+SRCS+= ${glue}
+# and an asm entry for __<syscall>
+ASM_GLUENOERR+= tmp_${glue:.c=.S}
+.  endif
+. endif
+.endfor
+
+# 'glue' files might .c or .S depending on the architecture
 .for glue in ${GLUE50}
 . if exists(${glue:.c=.S})
 # Build the ASM glue file
@@ -147,11 +165,11 @@
 .endfor
 
 WEAKASM= accept.S __aio_suspend50.S close.S connect.S execve.S \
-       fcntl.S fdatasync.S fdiscard.S fsync.S \
+       fcntl.S fdatasync.S fsync.S \
        fsync_range.S __kevent50.S \
        kill.S mq_receive.S mq_send.S __mq_timedreceive50.S __mq_timedsend50.S \
        msgrcv.S msgsnd.S __msync13.S  __nanosleep50.S open.S poll.S \
-       __pollts50.S posix_fallocate.S __pselect50.S read.S readlink.S \
+       __pollts50.S __pselect50.S read.S readlink.S \
        readv.S _sched_setparam.S _sched_getparam.S _sched_setaffinity.S \
        _sched_getaffinity.S sched_yield.S \
        __select50.S setcontext.S __sigprocmask14.S __sigsuspend14.S sysarch.S \
@@ -162,8 +180,11 @@
 
 PSEUDONOERR=   _exit.S
 
-SRCS+=         ${ASM} ${WEAKASM} ${NOERR} ${PSEUDONOERR} ${ASM_GLUE}
-CLEANFILES+=   ${ASM} ${WEAKASM} ${NOERR} ${PSEUDONOERR} ${ASM_GLUE}
+_GENFILES=     ${ASM} ${WEAKASM} ${NOERR} ${PSEUDONOERR} \
+       ${ASM_GLUE} ${ASM_GLUENOERR}
+
+SRCS+=         ${_GENFILES}
+CLEANFILES+=   ${_GENFILES}
 
 ASMDEPS=       ${.CURDIR}/sys/Makefile.inc ${ARCHDIR}/SYS.h \
                ${DESTDIR}/usr/include/sys/syscall.h
@@ -178,6 +199,10 @@
        ${_MKTARGET_CREATE}
        printf '#include "SYS.h"\nPSEUDO(${.PREFIX:S/tmp_/__/},${.PREFIX:S/tmp_//})\n' >${.TARGET}
 
+${ASM_GLUENOERR}: ${ASMDEPS}
+       ${_MKTARGET_CREATE}
+       printf '#include "SYS.h"\nPSEUDO_NOERROR(${.PREFIX:S/tmp_/__/},${.PREFIX:S/tmp_//})\n' >${.TARGET}
+
 ${WEAKASM}: ${ASMDEPS}
        ${_MKTARGET_CREATE}
        printf '#include "SYS.h"\nWSYSCALL(${.PREFIX},_sys_${.PREFIX})\nWEAK_ALIAS(_${.PREFIX},_sys_${.PREFIX})\n' >${.TARGET}
diff -r 5a56e7d56e6d -r 7b41696bdac3 lib/libc/sys/fdiscard.2
--- a/lib/libc/sys/fdiscard.2   Thu Feb 05 15:14:19 2015 +0000
+++ b/lib/libc/sys/fdiscard.2   Sun Feb 08 22:05:55 2015 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: fdiscard.2,v 1.2 2014/07/25 08:47:42 wiz Exp $
+.\"    $NetBSD: fdiscard.2,v 1.2.4.1 2015/02/08 22:05:55 snj Exp $
 .\"
 .\" Copyright (c) 2014 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd July 25, 2014
+.Dd February 1, 2015
 .Dt FDISCARD 2
 .Os
 .Sh NAME
@@ -127,8 +127,16 @@
 may not be persistent after a crash or reboot if the space reserved
 has not yet been written to.
 .Sh RETURN VALUES
-On success these calls return 0.
-On error, \-1 is returned, and the global variable
+If successful, the
+.Fn posix_fallocate
+function will return zero.
+Otherwise an error number will be returned, without setting
+.Va errno .
+.Pp
+If successful, the
+.Fn fdiscard
+function will return zero.
+Otherwise the value \-1 is returned and the global variable
 .Va errno
 is set to indicate the error.
 .Sh ERRORS
diff -r 5a56e7d56e6d -r 7b41696bdac3 lib/libc/sys/fdiscard.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/sys/fdiscard.c   Sun Feb 08 22:05:55 2015 +0000
@@ -0,0 +1,52 @@
+/*     $NetBSD: fdiscard.c,v 1.1.2.2 2015/02/08 22:05:55 snj Exp $ */
+
+/*
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.      
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Emmanuel Dreyfus.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: fdiscard.c,v 1.1.2.2 2015/02/08 22:05:55 snj Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+
+int __fdiscard(int, int, off_t, off_t);
+
+/*
+ * 64-bit offset padding required for gcc 1.x
+ */
+int
+fdiscard(int fd, off_t off, off_t len)
+{
+       return __fdiscard(fd, 0, off, len);
+}
diff -r 5a56e7d56e6d -r 7b41696bdac3 lib/libc/sys/posix_fallocate.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/sys/posix_fallocate.c    Sun Feb 08 22:05:55 2015 +0000
@@ -0,0 +1,52 @@
+/*     $NetBSD: posix_fallocate.c,v 1.1.2.2 2015/02/08 22:05:55 snj Exp $ */
+
+/*
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.      
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Emmanuel Dreyfus.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: posix_fallocate.c,v 1.1.2.2 2015/02/08 22:05:55 snj Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+
+int __posix_fallocate(int, int, off_t, off_t);
+
+/*
+ * 64-bit offset padding required for gcc 1.x
+ */
+int
+posix_fallocate(int fd, off_t off, off_t len)
+{
+       return __posix_fallocate(fd, 0, off, len);
+}



Home | Main Index | Thread Index | Old Index