Source-Changes-HG archive

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

[src/trunk]: src/lib/libc Fix argument paddiing for posix_fallocate and fdisc...



details:   https://anonhg.NetBSD.org/src/rev/e4a144620333
branches:  trunk
changeset: 332509:e4a144620333
user:      manu <manu%NetBSD.org@localhost>
date:      Thu Sep 25 15:08:29 2014 +0000

description:
Fix argument paddiing for posix_fallocate and fdiscard with gcc 1.x

diffstat:

 lib/libc/include/namespace.h   |   4 ++-
 lib/libc/sys/Makefile.inc      |  11 ++++----
 lib/libc/sys/fdiscard.c        |  52 ++++++++++++++++++++++++++++++++++++++++++
 lib/libc/sys/posix_fallocate.c |  52 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 113 insertions(+), 6 deletions(-)

diffs (172 lines):

diff -r 820eff014ab3 -r e4a144620333 lib/libc/include/namespace.h
--- a/lib/libc/include/namespace.h      Thu Sep 25 11:33:33 2014 +0000
+++ b/lib/libc/include/namespace.h      Thu Sep 25 15:08:29 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: namespace.h,v 1.174 2014/06/13 15:45:05 joerg Exp $    */
+/*     $NetBSD: namespace.h,v 1.175 2014/09/25 15:08:29 manu 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 820eff014ab3 -r e4a144620333 lib/libc/sys/Makefile.inc
--- a/lib/libc/sys/Makefile.inc Thu Sep 25 11:33:33 2014 +0000
+++ b/lib/libc/sys/Makefile.inc Thu Sep 25 15:08:29 2014 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.224 2014/07/25 08:30:47 dholland Exp $
+#      $NetBSD: Makefile.inc,v 1.225 2014/09/25 15:08:29 manu Exp $
 #      @(#)Makefile.inc        8.3 (Berkeley) 10/24/94
 
 # sys sources
@@ -30,8 +30,9 @@
 
 # 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 posix_fallocate.c \
+       pread.c preadv.c pwrite.c pwritev.c truncate.c ntp_adjtime.c \
+       mknodat.c
 
 GLUE50+= adjtime.c clock_settime.c settimeofday.c
 
@@ -147,11 +148,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 \
diff -r 820eff014ab3 -r e4a144620333 lib/libc/sys/fdiscard.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/sys/fdiscard.c   Thu Sep 25 15:08:29 2014 +0000
@@ -0,0 +1,52 @@
+/*     $NetBSD: fdiscard.c,v 1.1 2014/09/25 15:08:29 manu 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 2014/09/25 15:08:29 manu 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 820eff014ab3 -r e4a144620333 lib/libc/sys/posix_fallocate.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/sys/posix_fallocate.c    Thu Sep 25 15:08:29 2014 +0000
@@ -0,0 +1,52 @@
+/*     $NetBSD: posix_fallocate.c,v 1.1 2014/09/25 15:08:29 manu 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 2014/09/25 15:08:29 manu 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