[go: up one dir, main page]

File: s-forkexec.c

package info (click to toggle)
uftrace 0.9.0-1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 3,896 kB
  • sloc: ansic: 41,425; python: 7,369; makefile: 698; asm: 488; cpp: 461; sh: 349
file content (27 lines) | stat: -rw-r--r-- 476 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
 * This test calls fork() and then exec() to run the t-abc executable.
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/wait.h>

#define TEST_PROG1  "t-abc"
#define TEST_PROG2  "t-openclose"

int main(int argc, char *argv[])
{
	int pid;

	pid = fork();
	if (pid == 0) {
		if (argc == 1)
			execl(TEST_PROG1, TEST_PROG1, NULL);
		else
			execl(TEST_PROG2, TEST_PROG2, NULL);
		exit(2);
	}
	waitpid(pid, NULL, 0);
	return 0;
}