本文整理汇总了C++中self_exec函数的典型用法代码示例。如果您正苦于以下问题:C++ self_exec函数的具体用法?C++ self_exec怎么用?C++ self_exec使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了self_exec函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create_server
int create_server(void)
{
static int count = 0;
sockfd = socket(PF_INET, SOCK_DGRAM, 0);
if (sockfd < 0) {
tst_brkm(TBROK, cleanup, "call to socket() failed: %s",
strerror(errno));
return -1;
}
sin1.sin_family = AF_INET;
sin1.sin_port = htons((getpid() % 32768) + 11000 + count);
sin1.sin_addr.s_addr = INADDR_ANY;
count++;
if (bind(sockfd, (struct sockaddr *)&sin1, sizeof(sin1)) < 0) {
tst_brkm(TBROK, cleanup, "call to bind() failed: %s",
strerror(errno));
return -1;
}
child_pid = FORK_OR_VFORK();
if (child_pid < 0) {
tst_brkm(TBROK, cleanup, "client/server fork failed: %s",
strerror(errno));
return -1;
}
if (!child_pid) { /* child */
#ifdef UCLINUX
if (self_exec(argv0, "") < 0) {
tst_brkm(TBROK, cleanup, "self_exec failed");
return -1;
}
#else
do_child();
#endif
}
s = socket(PF_INET, SOCK_DGRAM, 0);
inet_aton("127.0.0.1", &sin1.sin_addr);
if (s < 0) {
tst_brkm(TBROK, cleanup, "call to socket() failed: %s",
strerror(errno));
return -1;
}
if (connect(s, (struct sockaddr *)&sin1, sizeof(sin1)) < 0) {
tst_brkm(TBROK, cleanup, "call to connect() failed: %s",
strerror(errno));
}
return s;
}
示例2: do_fork
static void do_fork(void)
{
int fork_pid, wait_pid;
int status, i;
wait_for_parent();
/*
* Fork a kid. Keep track of the kid's pid, have the kid do_mkdir,
* and wait for it. Compare the fork_pid with the wait_pid to be
* sure they are the same.
*/
for (i = 0; i < 50; i++) {
fork_pid = FORK_OR_VFORK();
if (fork_pid < 0) {
tst_resm(TFAIL, "Fork failed");
tst_exit();
}
if (fork_pid == 0) {
#ifdef UCLINUX
if (self_exec(argv0, "n", 5) < 0) {
tst_resm(TFAIL, "do_fork self_exec failed");
tst_exit();
}
#else
do_mkdir();
#endif
}
errno = 0;
while (((wait_pid = waitpid(fork_pid, &status, 0)) != -1) ||
(errno == EINTR)) {
if (wait_pid == -1)
continue;
if (fork_pid != wait_pid) {
tst_resm(TFAIL, "Didnt get a pid returned "
"from waitpid that matches the one "
"returned by fork");
tst_resm(TFAIL, "fork pid = %d, wait pid = "
"%d", fork_pid, wait_pid);
fail = 1;
}
}
}
exit(4);
}
示例3: start_server
pid_t start_server(struct sockaddr_in *sin0)
{
pid_t pid;
socklen_t slen = sizeof(*sin0);
sin0->sin_family = AF_INET;
sin0->sin_port = 0; /* pick random free port */
sin0->sin_addr.s_addr = INADDR_ANY;
sfd = socket(PF_INET, SOCK_STREAM, 0);
if (sfd < 0) {
tst_brkm(TBROK | TERRNO, cleanup, "server socket failed");
return -1;
}
if (bind(sfd, (struct sockaddr *)sin0, sizeof(*sin0)) < 0) {
tst_brkm(TBROK | TERRNO, cleanup, "server bind failed");
return -1;
}
if (listen(sfd, 10) < 0) {
tst_brkm(TBROK | TERRNO, cleanup, "server listen failed");
return -1;
}
if (getsockname(sfd, (struct sockaddr *)sin0, &slen) == -1)
tst_brkm(TBROK | TERRNO, cleanup, "getsockname failed");
switch ((pid = FORK_OR_VFORK())) {
case 0: /* child */
#ifdef UCLINUX
if (self_exec(argv0, "d", sfd) < 0) {
tst_brkm(TBROK, cleanup, "server self_exec failed");
}
#else
do_child();
#endif
break;
case -1:
tst_brkm(TBROK | TERRNO, cleanup, "server fork failed");
/* fall through */
default: /* parent */
(void)close(sfd);
return pid;
}
exit(1);
}
示例4: main
int main(int ac, char **av)
{
int lc;
pid_t pid;
char *argv[2] = {TEST_APP, NULL};
char *env[1] = {NULL};
tst_parse_opts(ac, av, NULL, NULL);
#ifdef UCLINUX
maybe_run_child(&do_child, "");
#endif
setup();
for (lc = 0; TEST_LOOPING(lc); lc++) {
if ((pid = FORK_OR_VFORK()) == -1) {
tst_brkm(TBROK, cleanup, "fork failed");
} else if (pid == 0) {
#ifdef UCLINUX
if (self_exec(av[0], "") < 0)
tst_brkm(TBROK, cleanup, "self_exec failed");
#else
do_child();
#endif
}
TST_SAFE_CHECKPOINT_WAIT(cleanup, 0);
TEST(execve(TEST_APP, argv, env));
if (TEST_ERRNO != ETXTBSY)
tst_resm(TFAIL | TTERRNO, "execve succeeded, expected failure");
else
tst_resm(TPASS | TTERRNO, "execve failed as expected");
TST_SAFE_CHECKPOINT_WAKE(cleanup, 0);
SAFE_WAIT(cleanup, NULL);
}
cleanup();
tst_exit();
}
示例5: main
int main(int ac, char **av)
{
int sig;
int lc;
tst_parse_opts(ac, av, NULL, NULL);
#ifdef UCLINUX
maybe_run_child(&do_child, "");
#endif
setup();
for (lc = 0; TEST_LOOPING(lc); lc++) {
if ((pid = FORK_OR_VFORK()) < 0) {
tst_brkm(TBROK | TERRNO, NULL, "fork() failed");
} else if (pid > 0) {
TST_SAFE_CHECKPOINT_WAIT(NULL, 0);
for (sig = 1; sig < NUMSIGS; sig++) {
if (skip_sig(sig))
continue;
SAFE_KILL(NULL, pid, sig);
}
TST_SAFE_CHECKPOINT_WAKE(NULL, 0);
tst_record_childstatus(cleanup, pid);
} else {
#ifdef UCLINUX
if (self_exec(av[0], "") < 0) {
tst_brkm(TBROK | TERRNO, NULL,
"self_exec() failed");
}
#else
do_child();
#endif
}
}
cleanup();
tst_exit();
}
示例6: cnt_setup
/*
* cnt_setup() - set up for the GETNCNT and GETZCNT commands with semctl()
*/
static void cnt_setup(int opval)
{
int pid, i;
sops.sem_num = SEM4;
sops.sem_flg = 0;
/*
* if seting up for GETZCNT, the semaphore value needs to be positive
*/
if (opval == 0) {
/* initialize the semaphore value to ONE */
sops.sem_op = ONE;
if (semop(sem_id_1, &sops, 1) == -1)
tst_brkm(TBROK, cleanup, "semop #1 failed - cnt_setup");
}
/* set the correct operation */
sops.sem_op = opval;
for (i = 0; i < NCHILD; i++) {
/* fork five children to wait */
pid = FORK_OR_VFORK();
if (pid == -1)
tst_brkm(TBROK, cleanup, "fork failed in cnt_setup");
if (pid == 0) {
#ifdef UCLINUX
sem_op = sops.sem_op;
if (self_exec(argv0, "ndd", 2, sem_id_1, sem_op) < 0)
tst_brkm(TBROK, cleanup, "self_exec failed "
"in cnt_setup");
#else
child_cnt();
#endif
} else {
TST_PROCESS_STATE_WAIT(cleanup, pid, 'S');
/* save the pid so we can kill it later */
pid_arr[i] = pid;
}
}
}
示例7: stat_setup
/*
* stat_setup() - Set up for the IPC_STAT command with shmctl().
* Make things interesting by forking some children
* that will either attach or inherit the shared memory.
*/
void stat_setup(void)
{
void *set_shmat();
pid_t pid;
/*
* The first time through, let the children attach the memory.
* The second time through, attach the memory first and let
* the children inherit the memory.
*/
if (stat_time == SECOND)
/*
* use the global "set_shared" variable here so that
* it can be removed in the stat_func() routine.
*/
set_shared = set_shmat();
tst_flush();
for (stat_i = 0; stat_i < N_ATTACH; stat_i++) {
pid = FORK_OR_VFORK();
if (pid == -1)
tst_brkm(TBROK, cleanup, "could not fork");
if (pid == 0) {
#ifdef UCLINUX
if (self_exec(argv0, "ddd", stat_i, stat_time,
shm_id_1) < 0)
tst_brkm(TBROK, cleanup, "could not self_exec");
#else
do_child();
#endif
} else {
/* save the child's pid for cleanup later */
pid_arr[stat_i] = pid;
TST_PROCESS_STATE_WAIT(cleanup, pid, 'S');
}
}
}
示例8: start_server
pid_t start_server(struct sockaddr_in *sin0)
{
struct sockaddr_in sin1 = *sin0;
pid_t pid;
sfd = socket(PF_INET, SOCK_STREAM, 0);
if (sfd < 0) {
tst_brkm(TBROK | TERRNO, cleanup, "server socket failed");
return -1;
}
if (bind(sfd, (struct sockaddr *)&sin1, sizeof(sin1)) < 0) {
tst_brkm(TBROK | TERRNO, cleanup, "server bind failed");
return -1;
}
if (listen(sfd, 10) < 0) {
tst_brkm(TBROK | TERRNO, cleanup, "server listen failed");
return -1;
}
switch ((pid = FORK_OR_VFORK())) {
case 0: /* child */
#ifdef UCLINUX
if (self_exec(argv0, "d", sfd) < 0) {
tst_brkm(TBROK, cleanup, "server self_exec failed");
}
#else
do_child();
#endif
break;
case -1:
tst_brkm(TBROK | TERRNO, cleanup, "server fork failed");
/* fall through */
default: /* parent */
(void)close(sfd);
return pid;
}
exit(1);
}
示例9: pid_setup
/*
* pid_setup() - set up for the GETPID command with semctl()
*/
static void pid_setup(void)
{
int pid;
/*
* Fork a child to do a semop that will pass.
*/
pid = FORK_OR_VFORK();
if (pid == -1)
tst_brkm(TBROK, cleanup, "fork failed in pid_setup()");
if (pid == 0) { /* child */
#ifdef UCLINUX
if (self_exec(argv0, "nd", 1, sem_id_1) < 0)
tst_brkm(TBROK, cleanup, "self_exec failed "
"in pid_setup()");
#else
child_pid();
#endif
} else {
pid_arr[SEM2] = pid;
TST_PROCESS_STATE_WAIT(cleanup, pid, 'Z');
}
}
示例10: main
int main(int argc, char **argv)
{
int lc;
int pid, npid, sig, nsig;
int nexno, status;
tst_parse_opts(argc, argv, NULL, NULL);
#ifdef UCLINUX
maybe_run_child(&do_child, "");
#endif
setup();
for (lc = 0; TEST_LOOPING(lc); lc++) {
tst_count = 0;
sig = SIGFPE;
pid = FORK_OR_VFORK();
if (pid < 0)
tst_brkm(TBROK|TERRNO, NULL, "fork failed");
if (pid == 0) {
#ifdef UCLINUX
self_exec(argv[0], "");
/* No fork() error check is done so don't check here */
#else
do_child();
#endif
} else {
kill(pid, sig);
errno = 0;
while (((npid = waitpid(pid, &status, 0)) != -1) ||
(errno == EINTR)) {
if (errno == EINTR)
continue;
if (npid != pid) {
tst_resm(TFAIL, "waitpid error: "
"unexpected pid returned");
} else {
tst_resm(TPASS,
"recieved expected pid");
}
nsig = WTERMSIG(status);
/*
* nsig is the signal number returned by
* waitpid
*/
if (nsig != sig) {
tst_resm(TFAIL, "waitpid error: "
"unexpected signal returned");
} else {
tst_resm(TPASS, "recieved expected "
"signal");
}
/*
* nexno is the exit number returned by
* waitpid
*/
nexno = WEXITSTATUS(status);
if (nexno != 0) {
tst_resm(TFAIL, "signal error: "
"unexpected exit number "
"returned");
} else {
tst_resm(TPASS, "recieved expected "
"exit value");
}
}
}
}
tst_exit();
}
示例11: main
int main(int ac, char **av)
{
int lc; /* loop counter */
char *msg; /* message returned from parse_opts */
pid_t c1pid, c2pid;
int wtstatus;
int bytesread;
int acnt = 0, bcnt = 0;
char rbuf[BUFSIZ];
/* parse standard options */
if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL)
tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
#ifdef UCLINUX
maybe_run_child(&c1func, "ndd", 1, &fildes[0], &fildes[1]);
maybe_run_child(&c2func, "ndd", 2, &fildes[0], &fildes[1]);
#endif
setup();
for (lc = 0; TEST_LOOPING(lc); lc++) {
/* reset Tst_count in case we are looping */
Tst_count = 0;
if (pipe(fildes) == -1)
tst_brkm(TBROK, cleanup, "pipe() failed - errno %d",
errno);
if ((c1pid = FORK_OR_VFORK()) == -1)
tst_brkm(TBROK, cleanup, "fork() failed - "
"errno %d", errno);
if (c1pid == 0)
#ifdef UCLINUX
if (self_exec(av[0], "ndd", 1, fildes[0], fildes[1]) <
0) {
tst_brkm(TBROK, cleanup, "self_exec failed");
}
#else
c1func();
#endif
if ((c2pid = FORK_OR_VFORK()) == -1)
tst_brkm(TBROK, cleanup, "fork() failed - "
"errno %d", errno);
if (c2pid == 0)
#ifdef UCLINUX
if (self_exec(av[0], "ndd", 2, fildes[0], fildes[1]) <
0) {
tst_brkm(TBROK, cleanup, "self_exec failed");
}
#else
c2func();
#endif
/* PARENT */
if (close(fildes[1]) == -1)
tst_resm(TWARN, "Could not close fildes[1] - errno %d",
errno);
/*
* Read a bit from the children first
*/
while ((acnt < 100) && (bcnt < 100)) {
bytesread = safe_read(fildes[0], rbuf, sizeof(rbuf));
if (bytesread < 0) {
tst_resm(TFAIL, "Unable to read from pipe, "
"errno=%d", errno);
break;
}
switch (rbuf[1]) {
case 'A':
acnt++;
break;
case 'b':
bcnt++;
break;
default:
tst_resm(TFAIL, "Got bogus '%c' "
"character", rbuf[1]);
break;
}
}
/*
* Try to kill the children
*/
if (kill(c1pid, SIGKILL) == -1)
tst_resm(TFAIL, "failed to kill child 1, errno=%d",
errno);
if (kill(c2pid, SIGKILL) == -1)
tst_resm(TFAIL, "failed to kill child 1, errno=%d",
errno);
/*
* Set action for the alarm
*/
if (signal(SIGALRM, alarmfunc) == SIG_ERR)
tst_resm(TWARN|TERRNO, "call to signal failed");
/*
* Set an alarm for 60 seconds just in case the child
//.........这里部分代码省略.........
示例12: main
int main(int ac, char **av)
{
int lc;
int rval;
const char *msg;
msg = parse_opts(ac, av, options, &help);
if (msg != NULL)
tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
#ifdef UCLINUX
maybe_run_child(&do_child_uclinux, "dS", &parentpid, &childtty);
#endif
if (!Devflag)
tst_brkm(TBROK, NULL, "You must specify a tty device with "
"the -D option.");
tst_require_root(NULL);
setup();
for (lc = 0; TEST_LOOPING(lc); lc++) {
tst_count = 0;
parenttty = devname;
childtty = devname;
parentpid = getpid();
childpid = FORK_OR_VFORK();
if (childpid < 0)
tst_brkm(TBROK, cleanup, "fork failed");
if (childpid == 0) { /* child */
#ifdef UCLINUX
if (self_exec(av[0], "dS", parentpid, childtty) < 0)
tst_brkm(TBROK, cleanup, "self_exec failed");
#else
do_child();
#endif
}
while (!sigusr1)
sleep(1);
sigusr1 = 0;
parentfd = do_parent_setup();
if (parentfd < 0) {
kill(childpid, SIGTERM);
waitpid(childpid, NULL, 0);
cleanup();
}
/* run the parent test */
rval = run_ptest();
if (rval == -1) {
/*
* Parent cannot set/get ioctl parameters.
* SIGTERM the child and cleanup.
*/
kill(childpid, SIGTERM);
waitpid(childpid, NULL, 0);
cleanup();
}
if (rval != 0)
tst_resm(TFAIL, "TCGETA/TCSETA tests FAILED with "
"%d %s", rval, rval > 1 ? "errors" : "error");
else
tst_resm(TPASS, "TCGETA/TCSETA tests SUCCEEDED");
/* FIXME: check return codes. */
(void)kill(childpid, SIGTERM);
(void)waitpid(childpid, NULL, 0);
/*
* Clean up things from the parent by restoring the
* tty device information that was saved in setup()
* and closing the tty file descriptor.
*/
if (ioctl(parentfd, TCSETA, &save_io) == -1)
tst_resm(TINFO, "ioctl restore failed in main");
if (close(parentfd) == -1)
tst_brkm(TBROK, cleanup, "close() failed in main");
closed = 1;
}
cleanup();
tst_exit();
}
示例13: main
int main(int ac, char **av)
{
int lc;
int i;
pid_t pid;
void do_child();
tst_parse_opts(ac, av, NULL, NULL);
#ifdef UCLINUX
maybe_run_child(&do_child_uclinux, "dd", &i_uclinux, &sem_id_1);
#endif
setup(); /* global setup */
/* The following loop checks looping state if -i option given */
for (lc = 0; TEST_LOOPING(lc); lc++) {
/* reset tst_count in case we are looping */
tst_count = 0;
for (i = 0; i < TST_TOTAL; i++) {
/* initialize the s_buf buffer */
s_buf.sem_op = TC[i].op;
s_buf.sem_flg = TC[i].flg;
s_buf.sem_num = TC[i].num;
/* initialize all of the primitive semaphores */
if (semctl(sem_id_1, TC[i].num, SETVAL, TC[i].semunptr)
== -1) {
tst_brkm(TBROK, cleanup, "semctl() failed");
}
if ((pid = FORK_OR_VFORK()) == -1) {
tst_brkm(TBROK, cleanup, "could not fork");
}
if (pid == 0) { /* child */
#ifdef UCLINUX
if (self_exec(av[0], "dd", i, sem_id_1) < 0) {
tst_brkm(TBROK, cleanup,
"could not self_exec");
}
#else
do_child(i);
#endif
} else {
TST_PROCESS_STATE_WAIT(cleanup, pid, 'S');
/*
* If we are testing for EIDRM then remove
* the semaphore, else send a signal that
* must be caught as we are testing for
* EINTR.
*/
if (TC[i].error == EIDRM) {
/* remove the semaphore resource */
rm_sema(sem_id_1);
} else {
if (kill(pid, SIGHUP) == -1) {
tst_brkm(TBROK, cleanup,
"kill failed");
}
}
/* let the child carry on */
waitpid(pid, NULL, 0);
}
/*
* recreate the semaphore resource if needed
*/
if (TC[i].error == EINTR) {
continue;
}
if ((sem_id_1 = semget(semkey, PSEMS, IPC_CREAT |
IPC_EXCL | SEM_RA)) == -1) {
tst_brkm(TBROK, cleanup, "couldn't recreate "
"semaphore");
}
}
}
cleanup();
tst_exit();
}
示例14: main
int main(int ac, char **av)
{
int lc;
char *msg;
pid_t pid, fake_pid;
int exno, status, fake_status, nsig;
if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL) {
tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
}
#ifdef UCLINUX
maybe_run_child(&do_child, "");
#endif
setup(); /* global setup */
TEST_EXP_ENOS(exp_enos);
/* The following loop checks looping state if -i option given */
for (lc = 0; TEST_LOOPING(lc); lc++) {
/* reset tst_count in case we are looping */
tst_count = 0;
status = 1;
exno = 1;
pid = FORK_OR_VFORK();
if (pid < 0) {
tst_brkm(TBROK, cleanup, "Fork failed");
} else if (pid == 0) {
#ifdef UCLINUX
if (self_exec(av[0], "") < 0) {
tst_brkm(TBROK, cleanup,
"self_exec of child failed");
}
#else
do_child();
#endif
} else {
fake_pid = FORK_OR_VFORK();
if (fake_pid < 0) {
tst_brkm(TBROK, cleanup, "Second fork failed");
} else if (fake_pid == 0) {
#ifdef UCLINUX
if (self_exec(av[0], "") < 0) {
tst_brkm(TBROK, cleanup,
"second self_exec "
"of child failed");
}
#else
do_child();
#endif
}
kill(fake_pid, TEST_SIG);
waitpid(fake_pid, &fake_status, 0);
TEST(kill(fake_pid, TEST_SIG));
kill(pid, TEST_SIG);
waitpid(pid, &status, 0);
}
if (TEST_RETURN != -1) {
tst_brkm(TFAIL, cleanup, "%s failed - errno = %d : %s "
"Expected a return value of -1 got %ld",
TCID, TEST_ERRNO, strerror(TEST_ERRNO),
TEST_RETURN);
}
if (STD_FUNCTIONAL_TEST) {
/*
* Check to see if the errno was set to the expected
* value of 3 : ESRCH
*/
nsig = WTERMSIG(status);
TEST_ERROR_LOG(TEST_ERRNO);
if (TEST_ERRNO == ESRCH) {
tst_resm(TPASS, "errno set to %d : %s, as "
"expected", TEST_ERRNO,
strerror(TEST_ERRNO));
} else {
tst_resm(TFAIL, "errno set to %d : %s expected "
"%d : %s", TEST_ERRNO,
strerror(TEST_ERRNO), 3, strerror(3));
}
}
}
cleanup();
tst_exit();
}
示例15: main
int main(int ac, char **av)
{
int lc;
char *msg;
pid_t c_pid;
int status, e_code;
if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL) {
tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
}
#ifdef UCLINUX
#define PIPE_NAME "msgsnd06"
maybe_run_child(&do_child, "d", &msg_q_1);
#endif
setup(); /* global setup */
if (sync_pipe_create(sync_pipes, PIPE_NAME) == -1)
tst_brkm(TBROK, cleanup, "sync_pipe_create failed");
/* The following loop checks looping state if -i option given */
for (lc = 0; TEST_LOOPING(lc); lc++) {
/* reset Tst_count in case we are looping */
Tst_count = 0;
msgkey = getipckey();
/* create a message queue with read/write permission */
if ((msg_q_1 = msgget(msgkey, IPC_CREAT | IPC_EXCL | MSG_RW))
== -1) {
tst_brkm(TBROK, cleanup, "Can't create message queue");
}
/* initialize the message buffer */
init_buf(&msg_buf, MSGTYPE, MSGSIZE);
/* write messages to the queue until it is full */
while (msgsnd(msg_q_1, &msg_buf, MSGSIZE, IPC_NOWAIT) != -1) {
msg_buf.mtype += 1;
}
/*
* fork a child that will attempt to write a message
* to the queue without IPC_NOWAIT
*/
if ((c_pid = FORK_OR_VFORK()) == -1) {
tst_brkm(TBROK, cleanup, "could not fork");
}
if (c_pid == 0) { /* child */
#ifdef UCLINUX
if (self_exec(av[0], "d", msg_q_1) < 0) {
tst_brkm(TBROK, cleanup, "could not self_exec");
}
#else
do_child();
#endif
} else { /* parent */
if (sync_pipe_wait(sync_pipes) == -1)
tst_brkm(TBROK, cleanup,
"sync_pipe_wait failed");
if (sync_pipe_close(sync_pipes, PIPE_NAME) == -1)
tst_brkm(TBROK, cleanup,
"sync_pipe_close failed");
/* After son has been created, give it a chance to execute the
* msgsnd command before we continue. Without this sleep, on SMP machine
* the father rm_queue could be executed before the son msgsnd.
*/
sleep(2);
/* remove the queue */
rm_queue(msg_q_1);
/* wait for the child to finish */
wait(&status);
/* make sure the child returned a good exit status */
e_code = status >> 8;
if (e_code != 0) {
tst_resm(TFAIL, "Failures reported above");
}
}
}
cleanup();
tst_exit();
}