diff options
Diffstat (limited to 'tests/features/open_and_sleep.c')
-rw-r--r-- | tests/features/open_and_sleep.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/features/open_and_sleep.c b/tests/features/open_and_sleep.c new file mode 100644 index 00000000000..7d0e22a2503 --- /dev/null +++ b/tests/features/open_and_sleep.c @@ -0,0 +1,27 @@ +#include <unistd.h> +#include <stdio.h> +#include <fcntl.h> + +int +main(int argc, char **argv) +{ + pid_t pid; + int fd; + + if (argc >= 2) { + fd = open(argv[1], O_RDWR | O_CREAT, 0644); + if (fd == -1) { + fprintf(stderr, "cannot open/create %s\n", argv[1]); + return 1; + } + } + + pid = getpid(); + printf("%d\n", pid); + fflush(stdout); + + for (;;) + sleep(1); + + return 0; +} |