diff options
Diffstat (limited to 'misc')
-rw-r--r-- | misc/Makefile | 4 | ||||
-rw-r--r-- | misc/Versions | 3 | ||||
-rw-r--r-- | misc/preadv2.c | 30 | ||||
-rw-r--r-- | misc/preadv64v2.c | 30 | ||||
-rw-r--r-- | misc/pwritev2.c | 30 | ||||
-rw-r--r-- | misc/pwritev64v2.c | 30 | ||||
-rw-r--r-- | misc/sys/uio.h | 41 | ||||
-rw-r--r-- | misc/tst-preadvwritev-common.c | 19 | ||||
-rw-r--r-- | misc/tst-preadvwritev2.c | 31 | ||||
-rw-r--r-- | misc/tst-preadvwritev64v2.c | 33 |
10 files changed, 246 insertions, 5 deletions
diff --git a/misc/Makefile b/misc/Makefile index 2db1fd8..c393fa7 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -39,6 +39,7 @@ headers := sys/uio.h bits/uio.h sys/ioctl.h bits/ioctls.h bits/ioctl-types.h \ routines := brk sbrk sstk ioctl \ readv writev preadv preadv64 pwritev pwritev64 \ + preadv2 preadv64v2 pwritev2 pwritev64v2 \ setreuid setregid \ seteuid setegid \ getpagesize \ @@ -79,7 +80,8 @@ gpl2lgpl := error.c error.h tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \ tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1 \ tst-mntent-blank-corrupt tst-mntent-blank-passno bug18240 \ - tst-preadvwritev tst-preadvwritev64 tst-makedev tst-empty + tst-preadvwritev tst-preadvwritev64 tst-makedev tst-empty \ + tst-preadvwritev2 tst-preadvwritev64v2 tests-internal := tst-atomic tst-atomic-long tests-static := tst-empty diff --git a/misc/Versions b/misc/Versions index f2c90ff..bafda78 100644 --- a/misc/Versions +++ b/misc/Versions @@ -155,6 +155,9 @@ libc { GLIBC_2.25 { gnu_dev_major; gnu_dev_minor; gnu_dev_makedev; } + GLIBC_2.26 { + preadv2; preadv64v2; pwritev2; pwritev64v2; + } GLIBC_PRIVATE { __madvise; __mktemp; diff --git a/misc/preadv2.c b/misc/preadv2.c new file mode 100644 index 0000000..a62dcaa --- /dev/null +++ b/misc/preadv2.c @@ -0,0 +1,30 @@ +/* Default implementation of preadv2. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sys/uio.h> + +/* Same as preadv but with an additional flags argument. */ +ssize_t +preadv2 (int fd, const struct iovec *vector, int count, off_t offset, + int flags) +{ + __set_errno (ENOSYS); + return -1; +} + +stub_warning (preadv2) diff --git a/misc/preadv64v2.c b/misc/preadv64v2.c new file mode 100644 index 0000000..a802c2f --- /dev/null +++ b/misc/preadv64v2.c @@ -0,0 +1,30 @@ +/* Default implementation of preadv2 (LFS version). + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sys/uio.h> + +/* Same as preadv64 but with an addional flag argument. */ +ssize_t +preadv64v2 (int fd, const struct iovec *vector, int count, off64_t offset, + int flags) +{ + __set_errno (ENOSYS); + return -1; +} + +stub_warning (preadv64v2) diff --git a/misc/pwritev2.c b/misc/pwritev2.c new file mode 100644 index 0000000..b9e0727 --- /dev/null +++ b/misc/pwritev2.c @@ -0,0 +1,30 @@ +/* Default implementation of pwritev2. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sys/uio.h> + +/* Same as pwritev but with an additional flags argument. */ +ssize_t +pwritev2 (int fd, const struct iovec *vector, int count, off_t offset, + int flags) +{ + __set_errno (ENOSYS); + return -1; +} + +stub_warning (pwritev2) diff --git a/misc/pwritev64v2.c b/misc/pwritev64v2.c new file mode 100644 index 0000000..1f874f0 --- /dev/null +++ b/misc/pwritev64v2.c @@ -0,0 +1,30 @@ +/* Default implementation of pwritev2 (LFS version). + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sys/uio.h> + +/* Same as preadv64 but with an addional flag argument. */ +ssize_t +pwritev64v2 (int fd, const struct iovec *vector, int count, off64_t offset, + int flags) +{ + __set_errno (ENOSYS); + return -1; +} + +stub_warning (pwritev64v2) diff --git a/misc/sys/uio.h b/misc/sys/uio.h index e80f013..66c22f0 100644 --- a/misc/sys/uio.h +++ b/misc/sys/uio.h @@ -76,6 +76,7 @@ extern ssize_t preadv (int __fd, const struct iovec *__iovec, int __count, __THROW. */ extern ssize_t pwritev (int __fd, const struct iovec *__iovec, int __count, __off_t __offset) __wur; + # else # ifdef __REDIRECT extern ssize_t __REDIRECT (preadv, (int __fd, const struct iovec *__iovec, @@ -117,6 +118,46 @@ extern ssize_t pwritev64 (int __fd, const struct iovec *__iovec, int __count, # endif #endif /* Use misc. */ + +#ifdef __USE_GNU +# ifndef __USE_FILE_OFFSET64 +/* Same as preadv but with an additional flag argumenti defined at uio.h. */ +extern ssize_t preadv2 (int __fp, const struct iovec *__iovec, int __count, + __off_t __offset, int ___flags) __wur; + +/* Same as preadv but with an additional flag argument defined at uio.h. */ +extern ssize_t pwritev2 (int __fd, const struct iovec *__iodev, int __count, + __off_t __offset, int __flags) __wur; + +# else +# ifdef __REDIRECT +extern ssize_t __REDIRECT (pwritev2, (int __fd, const struct iovec *__iovec, + int __count, __off64_t __offset, + int __flags), + pwritev64v2) __wur; +extern ssize_t __REDIRECT (preadv2, (int __fd, const struct iovec *__iovec, + int __count, __off64_t __offset, + int __flags), + preadv64v2) __wur; +# else +# define preadv2 preadv64v2 +# define pwritev2 pwritev64v2 +# endif +# endif + +# ifdef __USE_LARGEFILE64 +/* Same as preadv but with an additional flag argumenti defined at uio.h. */ +extern ssize_t preadv64v2 (int __fp, const struct iovec *__iovec, + int __count, __off64_t __offset, + int ___flags) __wur; + +/* Same as preadv but with an additional flag argument defined at uio.h. */ +extern ssize_t pwritev64v2 (int __fd, const struct iovec *__iodev, + int __count, __off64_t __offset, + int __flags) __wur; +# endif +#endif /* Use GNU. */ + __END_DECLS #endif /* sys/uio.h */ diff --git a/misc/tst-preadvwritev-common.c b/misc/tst-preadvwritev-common.c index 5540dfb..676d495 100644 --- a/misc/tst-preadvwritev-common.c +++ b/misc/tst-preadvwritev-common.c @@ -18,6 +18,7 @@ #include <stdio.h> #include <stdint.h> +#include <errno.h> #include <string.h> #include <sys/uio.h> #include <sys/stat.h> @@ -39,6 +40,16 @@ do_prepare (int argc, char **argv) } #define PREPARE do_prepare +#ifndef PREADV +# define PREADV(__fd, __iov, __iovcnt, __offset) \ + preadv (__fd, __iov, __iovcnt, __offset) +#endif + +#ifndef PWRITEV +# define PWRITEV(__fd, __iov, __iovcnt, __offset) \ + pwritev (__fd, __iov, __iovcnt, __offset) +#endif + static int do_test_with_offset (off_t offset) { @@ -58,13 +69,13 @@ do_test_with_offset (off_t offset) iov[1].iov_base = buf2; iov[1].iov_len = sizeof buf2; - ret = pwritev (temp_fd, iov, 2, offset); + ret = PWRITEV (temp_fd, iov, 2, offset); if (ret == -1) FAIL_RET ("first pwritev returned -1"); if (ret != (sizeof buf1 + sizeof buf2)) FAIL_RET ("first pwritev returned an unexpected value"); - ret = pwritev (temp_fd, iov, 2, sizeof buf1 + sizeof buf2 + offset); + ret = PWRITEV (temp_fd, iov, 2, sizeof buf1 + sizeof buf2 + offset); if (ret == -1) FAIL_RET ("second pwritev returned -1"); if (ret != (sizeof buf1 + sizeof buf2)) @@ -82,7 +93,7 @@ do_test_with_offset (off_t offset) iov[1].iov_len = sizeof buf4; /* Now read two buffer with 32 and 64 bytes respectively. */ - ret = preadv (temp_fd, iov, 2, offset); + ret = PREADV (temp_fd, iov, 2, offset); if (ret == -1) FAIL_RET ("first preadv returned -1"); if (ret != (sizeof buf3 + sizeof buf4)) @@ -93,7 +104,7 @@ do_test_with_offset (off_t offset) if (memcmp (buf2, buf4, sizeof buf2) != 0) FAIL_RET ("second buffer from first preadv different than expected"); - ret = preadv (temp_fd, iov, 2, sizeof buf3 + sizeof buf4 + offset); + ret = PREADV (temp_fd, iov, 2, sizeof buf3 + sizeof buf4 + offset); if (ret == -1) FAIL_RET ("second preadv returned -1"); if (ret != (sizeof buf3 + sizeof buf4)) diff --git a/misc/tst-preadvwritev2.c b/misc/tst-preadvwritev2.c new file mode 100644 index 0000000..cf36272 --- /dev/null +++ b/misc/tst-preadvwritev2.c @@ -0,0 +1,31 @@ +/* Tests for preadv2 and pwritev2. + Copyright (C) 2016-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#define PREADV(__fd, __iov, __iovcnt, __offset) \ + preadv2 (__fd, __iov, __iovcnt, __offset, 0) + +#define PWRITEV(__fd, __iov, __iovcnt, __offset) \ + pwritev2 (__fd, __iov, __iovcnt, __offset, 0) + +#include "tst-preadvwritev-common.c" + +static int +do_test (void) +{ + return do_test_with_offset (0); +} diff --git a/misc/tst-preadvwritev64v2.c b/misc/tst-preadvwritev64v2.c new file mode 100644 index 0000000..8d0c48e --- /dev/null +++ b/misc/tst-preadvwritev64v2.c @@ -0,0 +1,33 @@ +/* Tests for preadv2 and pwritev2 (LFS version). + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#define _FILE_OFFSET_BITS 64 + +#define PREADV(__fd, __iov, __iovcnt, __offset) \ + preadv2 (__fd, __iov, __iovcnt, __offset, 0) + +#define PWRITEV(__fd, __iov, __iovcnt, __offset) \ + pwritev2 (__fd, __iov, __iovcnt, __offset, 0) + +#include "tst-preadvwritev-common.c" + +static int +do_test (void) +{ + return do_test_with_offset (0); +} |