diff --git a/libc/Android.mk b/libc/Android.mk index f919e316c..59e8e325d 100644 --- a/libc/Android.mk +++ b/libc/Android.mk @@ -39,10 +39,12 @@ libc_common_src_files := \ unistd/perror.c \ unistd/popen.c \ unistd/pread.c \ + unistd/pread64.c \ unistd/pselect.c \ unistd/ptsname.c \ unistd/ptsname_r.c \ unistd/pwrite.c \ + unistd/pwrite64.c \ unistd/raise.c \ unistd/reboot.c \ unistd/recv.c \ diff --git a/libc/include/unistd.h b/libc/include/unistd.h index 38e2825d6..aa236bd80 100644 --- a/libc/include/unistd.h +++ b/libc/include/unistd.h @@ -133,7 +133,9 @@ extern off64_t lseek64(int, off64_t, int); extern ssize_t read(int, void *, size_t); extern ssize_t write(int, const void *, size_t); extern ssize_t pread(int, void *, size_t, off_t); +extern ssize_t pread64(int, void *, size_t, off64_t); extern ssize_t pwrite(int, const void *, size_t, off_t); +extern ssize_t pwrite64(int, const void *, size_t, off64_t); extern int dup(int); extern int dup2(int, int); diff --git a/libc/unistd/pread.c b/libc/unistd/pread.c index b55623ed3..ec4691a92 100644 --- a/libc/unistd/pread.c +++ b/libc/unistd/pread.c @@ -11,17 +11,20 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * 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. - * * Neither the name of Google Inc. nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. * -*/ + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 + * COPYRIGHT OWNER OR CONTRIBUTORS 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 #include diff --git a/libc/unistd/pread64.c b/libc/unistd/pread64.c new file mode 100644 index 000000000..2a4e08cad --- /dev/null +++ b/libc/unistd/pread64.c @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 + * COPYRIGHT OWNER OR CONTRIBUTORS 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 +#include + +extern int __pread64(int fd, void *buf, size_t nbytes, loff_t offset); + +ssize_t pread64(int fd, void *buf, size_t nbytes, off64_t offset) +{ + return __pread64(fd, buf, nbytes, offset); +} + diff --git a/libc/unistd/pwrite64.c b/libc/unistd/pwrite64.c new file mode 100644 index 000000000..b0846503d --- /dev/null +++ b/libc/unistd/pwrite64.c @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 + * COPYRIGHT OWNER OR CONTRIBUTORS 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 +#include + +extern int __pwrite64(int fd, const void *buf, size_t nbytes, loff_t offset); + +ssize_t pwrite64(int fd, const void *buf, size_t nbytes, off64_t offset) +{ + return __pwrite64(fd, buf, nbytes, offset); +} +