summaryrefslogtreecommitdiff
path: root/posix/test-errno.c
AgeCommit message (Collapse)Author
2018-01-01Update copyright dates with scripts/update-copyrights.Joseph Myers
* All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
2017-04-25Fix sys/socket.h namespace issues from sys/uio.h inclusion (bug 21426).Joseph Myers
sys/socket.h includes sys/uio.h to get the definition of the iovec structure. POSIX allows sys/socket.h to make all sys/uio.h symbols visible. However, all of sys/uio.h is XSI-shaded, so for non-XSI POSIX this results in conformtest failures (for sys/socket.h and other headers that include it): Namespace violation: "UIO_MAXIOV" Namespace violation: "readv" Namespace violation: "writev" Now, there is some ambiguity in POSIX about what namespace reservations apply in this case - see http://austingroupbugs.net/view.php?id=1127 - but glibc convention would still avoid declaring readv and writev, for example, for feature test macros that don't include them (if only headers from the relevant standard are included), even if such declarations are permitted, so there is a bug here according to glibc conventions. This patch moves the struct iovec definition to a new bits/types/struct_iovec.h header and includes that from sys/socket.h instead of including the whole of sys/uio.h. This fixes the namespace issue; however, three files in glibc that were relying on the implicit inclusion needed to be updated to include sys/uio.h explicitly. So there is a question of whether sys/socket.h should continue to include sys/uio.h under some conditions, such as __USE_XOPEN or __USE_MISC or __USE_XOPEN || __USE_MISC, for greater compatibility with code that (wrongly) expects this optional inclusion to be present there. (I think the three affected files in glibc should still have explicit sys/uio.h inclusions added in any case, however.) Tested for x86_64. [BZ #21426] * misc/bits/types/struct_iovec.h: New file. * misc/Makefile (headers): Add bits/types/struct_iovec.h. * include/bits/types/struct_iovec.h: New file. * bits/uio.h (struct iovec): Replace by inclusion of <bits/types/struct_iovec.h>. * sysdeps/unix/sysv/linux/bits/uio.h (struct iovec): Likewise. * socket/sys/socket.h: Include <bits/types/struct_iovec.h> instead of <sys/uio.h>. * nptl/tst-cancel4.c: Include <sys/uio.h> * posix/test-errno.c: Likewise. * support/resolv_test.c: Likewise. * conform/Makefile (test-xfail-POSIX2008/arpa/inet.h/conform): Remove. (test-xfail-POSIX2008/netdb.h/conform): Likewise. (test-xfail-POSIX2008/netinet/in.h/conform): Likewise. (test-xfail-POSIX2008/sys/socket.h/conform): Likewise.
2017-03-15Fix test-errno issuesAdhemerval Zanella
This patch fixes multiple issues of test-errno.c (9a56f8718341): - Rename Linux test-errno.c to test-errno-linux.c to avoid build the same source for both tests. - Add a mlock check for 32 bits build running on 64 bits kernels. Althuough man pages states that mlock fails with EINVAL if final address overflows, kernels does not return it for aforementioned condition (it returns ENOMEM instead). Although it seems to be a kernel issue for compat syscall handling, I think it is worth to still check syscall return and document the behavior. - Initialize option lenght for setsockopt check. - Change open test from EINVAL to EISDIR. Checked on x86_64-linux-gnu and i686-linux-gnu (running on 64 bits kernel). * posix/test-errno.c (do_test): Initialize setsockopt optlen. * sysdeps/unix/sysv/linux/test-errno.c: Move to ... * sysdeps/unix/sysv/linux/test-errno-linux.c: ... here. (test_wrp_rv): Fix format. (test_wrp_rv2): New macro. (do_test): Handle mlock return on 64 bits kernels with 32 bits binaries.
2017-03-08Test for correct setting of errno.Yury Norov
This patch adds tests for POSIX and Linux specific syscalls that implemented with syscall templates machinery. The reason of tests is to receive the expected error code and test if it's handled properly by glibc. 2017-03-08 Yury Norov <ynorov@caviumnetworks.com> Zack Weinberg <zackw@panix.com> * posix/test-errno.c: New file. * posix/Makefile (tests): Add test-errno. * sysdeps/unix/sysv/linux/test-errno.c: New file. * sysdeps/unix/sysv/linux/Makefile (tests): Add test-errno.