strace/tests/creat.c
Fei Jie 8346e63e43 tests: add creat.test
* tests/creat.c: New file.
* tests/creat.test: New test.
* tests/.gitignore: Add creat.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add creat.test.
2016-03-25 09:47:14 +00:00

30 lines
464 B
C

#include "tests.h"
#include <sys/syscall.h>
#ifdef __NR_creat
# include <errno.h>
# include <stdio.h>
# include <sys/stat.h>
# include <unistd.h>
# define TMP_FILE "creat"
int
main(void)
{
int rc = syscall(__NR_creat, TMP_FILE, S_IRUSR);
printf("creat(\"%s\", %#o) = %d %s (%m)\n",
TMP_FILE, S_IRUSR, rc,
errno == ENOSYS ? "ENOSYS" : "ETXTBSY");
puts("+++ exited with 0 +++");
return 0;
}
#else
SKIP_MAIN_UNDEFINED("__NR_creat")
#endif