File: s-posix_spawn.c

package info (click to toggle)
uftrace 0.19-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,372 kB
  • sloc: ansic: 49,879; python: 11,279; asm: 837; makefile: 769; sh: 637; cpp: 627; javascript: 191
file content (26 lines) | stat: -rw-r--r-- 584 bytes parent folder | download | duplicates (2)
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
/*
 * This test calls posix_spawn() to run the t-abc and t-openclose executables.
 */
#include <spawn.h>
#include <stdio.h>
#include <sys/wait.h>
#include <unistd.h>

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

int main(int argc, char *argv[])
{
	int pid;
	char *args1[] = { TEST_PROG1, NULL };
	char *args2[] = { TEST_PROG2, NULL };
	char *envp[] = { "PATH=.", "HOME=/home/user", NULL };

	posix_spawn(&pid, TEST_PROG1, NULL, NULL, args1, envp);
	waitpid(pid, NULL, 0);

	posix_spawn(&pid, TEST_PROG2, NULL, NULL, args2, envp);
	waitpid(pid, NULL, 0);

	return 0;
}