strace/tests/pipe.c
Dmitry V. Levin 78ed3f3558 alpha, ia64, sh, sparc, sparc64: fix pipe and pipe2 syscalls decoding
Fix pipe syscall decoding on alpha.
Fix pipe2 syscall decoding on ia64, sh, sparc, and sparc64.

* configure.ac (AC_CHECK_FUNCS): Add pipe2.
* defs.h [ALPHA || IA64 || SH || SPARC || SPARC64] (HAVE_GETRVAL2):
Define.
* net.c (do_pipe): Check HAVE_GETRVAL2 instead of architecture macros.
Do not use getrval2 for pipe2 decoding.
Print address if umove call fails.
* syscall.c (getrval2): Check HAVE_GETRVAL2 instead of architecture
macros.  Implement for [ALPHA].
* tests/pipe.c: New file.
* tests/pipe.expected: New file.
* tests/pipe.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add pipe.
(TESTS): Add pipe.test.
(EXTRA_DIST): Add pipe.expected.
* tests/.gitignore: Add pipe.
2015-03-23 03:16:51 +00:00

28 lines
399 B
C

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
int
main(void)
{
(void) close(0);
(void) close(1);
int fds[2];
if (pipe(fds) || fds[0] != 0 || fds[1] != 1)
return 77;
#ifdef HAVE_PIPE2
(void) close(0);
(void) close(1);
if (pipe2(fds, O_NONBLOCK) || fds[0] != 0 || fds[1] != 1)
return 77;
return 0;
#else
return 77;
#endif
}