1*b0b7248dSdsl /* $NetBSD: pwrite.c,v 1.9 2007/11/22 21:11:32 dsl Exp $ */
2637dff35Sthorpej
3637dff35Sthorpej /*
4637dff35Sthorpej * Copyright (c) 1992, 1993
5637dff35Sthorpej * The Regents of the University of California. All rights reserved.
6637dff35Sthorpej *
7637dff35Sthorpej * Redistribution and use in source and binary forms, with or without
8637dff35Sthorpej * modification, are permitted provided that the following conditions
9637dff35Sthorpej * are met:
10637dff35Sthorpej * 1. Redistributions of source code must retain the above copyright
11637dff35Sthorpej * notice, this list of conditions and the following disclaimer.
12637dff35Sthorpej * 2. Redistributions in binary form must reproduce the above copyright
13637dff35Sthorpej * notice, this list of conditions and the following disclaimer in the
14637dff35Sthorpej * documentation and/or other materials provided with the distribution.
15eb7c1594Sagc * 3. Neither the name of the University nor the names of its contributors
16637dff35Sthorpej * may be used to endorse or promote products derived from this software
17637dff35Sthorpej * without specific prior written permission.
18637dff35Sthorpej *
19637dff35Sthorpej * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20637dff35Sthorpej * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21637dff35Sthorpej * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22637dff35Sthorpej * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23637dff35Sthorpej * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24637dff35Sthorpej * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25637dff35Sthorpej * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26637dff35Sthorpej * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27637dff35Sthorpej * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28637dff35Sthorpej * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29637dff35Sthorpej * SUCH DAMAGE.
30637dff35Sthorpej */
31637dff35Sthorpej
32637dff35Sthorpej #include <sys/cdefs.h>
33637dff35Sthorpej #if defined(LIBC_SCCS) && !defined(lint)
34*b0b7248dSdsl __RCSID("$NetBSD: pwrite.c,v 1.9 2007/11/22 21:11:32 dsl Exp $");
35637dff35Sthorpej #endif /* LIBC_SCCS and not lint */
36637dff35Sthorpej
37dc86984bSkleink #include "namespace.h"
38637dff35Sthorpej #include <sys/types.h>
39637dff35Sthorpej #include <sys/syscall.h>
40637dff35Sthorpej #include <unistd.h>
41637dff35Sthorpej
42dc86984bSkleink #ifdef __weak_alias
433fdac2b8Sthorpej __weak_alias(pwrite,_sys_pwrite)
443fdac2b8Sthorpej __weak_alias(_pwrite,_sys_pwrite)
45dc86984bSkleink #endif
468a264b33Schristos #ifdef __lint__
478a264b33Schristos #define _sys_pwrite pwrite
488a264b33Schristos #endif
49dc86984bSkleink
508a264b33Schristos ssize_t _sys_pwrite(int, const void *, size_t, off_t);
51*b0b7248dSdsl ssize_t __pwrite(int, const void *, size_t, int, off_t);
523fdac2b8Sthorpej
53637dff35Sthorpej /*
54637dff35Sthorpej * This function provides 64-bit offset padding that
55637dff35Sthorpej * is not supplied by GCC 1.X but is supplied by GCC 2.X.
56637dff35Sthorpej */
57a644188bSthorpej ssize_t
_sys_pwrite(int fd,const void * buf,size_t nbyte,off_t offset)588a264b33Schristos _sys_pwrite(int fd, const void *buf, size_t nbyte, off_t offset)
59637dff35Sthorpej {
60637dff35Sthorpej
61*b0b7248dSdsl return __pwrite(fd, buf, nbyte, 0, offset);
62637dff35Sthorpej }
63