diff --git a/lib/libc/include/namespace.h b/lib/libc/include/namespace.h index ffe73381cd76..65d12cb38de4 100644 --- a/lib/libc/include/namespace.h +++ b/lib/libc/include/namespace.h @@ -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 --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index 12c3363fa8c4..92fabb8c59e5 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -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 @@ SRCS+= posix_fadvise.c posix_madvise.c sched.c sigqueue.c sigtimedwait.c \ # 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 @@ ASM_MD= _lwp_getprivate.S mremap.S .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 --git a/lib/libc/sys/fdiscard.c b/lib/libc/sys/fdiscard.c new file mode 100644 index 000000000000..ff1892b9cb8f --- /dev/null +++ b/lib/libc/sys/fdiscard.c @@ -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 +#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 +#include +#include + +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 --git a/lib/libc/sys/posix_fallocate.c b/lib/libc/sys/posix_fallocate.c new file mode 100644 index 000000000000..ee8b079d5eef --- /dev/null +++ b/lib/libc/sys/posix_fallocate.c @@ -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 +#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 +#include +#include + +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); +}