On Thu, 2009-01-22 at 11:09 +0800, sonic zhang wrote:
> Send again.
>
> In NOMMU arch, anonymous PIPE can't be accessed in child process if it is
> started
> by vfork/execve. This patch uses named PIPE instead and changes related test
> cases accordingly.
>
>
> Signed-off-by: Sonic Zhang <[email protected]>
Merged. Send us more fixes if you have apart from these 2 patches.
Regards--
Subrata
> ---
> testcases/kernel/syscalls/execve/execve05.c
> testcases/kernel/syscalls/ftruncate/ftruncate04.c
> testcases/kernel/syscalls/ipc/msgrcv/msgrcv05.c
> testcases/kernel/syscalls/ipc/msgrcv/msgrcv06.c
> testcases/kernel/syscalls/ipc/msgsnd/msgsnd05.c
> testcases/kernel/syscalls/ipc/msgsnd/msgsnd06.c
> testcases/kernel/syscalls/ipc/semop/semop05.c
> testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
>
>
> Index: testcases/kernel/syscalls/execve/execve05.c
> ===================================================================
> --- testcases/kernel/syscalls/execve/execve05.c (revision 147)
> +++ testcases/kernel/syscalls/execve/execve05.c (revision 150)
> @@ -77,6 +77,15 @@
> int Fflag = 0;
> char *test_name;
>
> +#ifdef UCLINUX
> +#define PIPE_NAME_START "execve05_start"
> +#define PIPE_NAME_END "execve05_end"
> +#else
> +#define PIPE_NAME_START NULL
> +#define PIPE_NAME_END NULL
> +#endif
> +
> +
> /* for test specific parse_opts options - in this case "-F" */
> option_t options[] = {
> {"F:", &Fflag, &test_name},
> @@ -118,9 +127,9 @@
> /* reset Tst_count in case we are looping */
> Tst_count = 0;
>
> - if (sync_pipe_create(start_sync_pipes) == -1)
> + if (sync_pipe_create(start_sync_pipes, PIPE_NAME_START) == -1)
> tst_brkm(TBROK, cleanup, "sync_pipe_create failed");
> - if (sync_pipe_create(end_sync_pipes) == -1)
> + if (sync_pipe_create(end_sync_pipes, PIPE_NAME_END) == -1)
> tst_brkm(TBROK, cleanup, "sync_pipe_create failed");
>
> /*
> @@ -145,7 +154,7 @@
> if (sync_pipe_wait(start_sync_pipes) == -1)
> tst_brkm(TBROK, cleanup, "sync_pipe_wait failed");
>
> - if (sync_pipe_close(start_sync_pipes) == -1)
> + if (sync_pipe_close(start_sync_pipes, PIPE_NAME_START) == -1)
> tst_brkm(TBROK, cleanup, "sync_pipe_close failed");
>
> if ((pid1 = FORK_OR_VFORK()) == -1)
> @@ -157,7 +166,7 @@
>
> /* do not interfere with end synchronization of first
> * child */
> - sync_pipe_close(end_sync_pipes);
> + sync_pipe_close(end_sync_pipes, PIPE_NAME_END);
>
> TEST(execve(test_name, argv, env));
>
> @@ -246,6 +255,13 @@
> {
> int fildes;
>
> +#ifdef UCLINUX
> + if (sync_pipe_create(start_sync_pipes, PIPE_NAME_START) == -1)
> + tst_brkm(TBROK, cleanup, "sync_pipe_create failed");
> + if (sync_pipe_create(end_sync_pipes, PIPE_NAME_END) == -1)
> + tst_brkm(TBROK, cleanup, "sync_pipe_create failed");
> +#endif
> +
> if ((fildes = open(test_name, O_WRONLY|O_CREAT, S_IRWXU)) == -1) {
> tst_brkm(TBROK, NULL, "open(2) failed");
> exit(1);
> @@ -256,7 +272,7 @@
> exit(1);
> }
>
> - if (sync_pipe_close(start_sync_pipes) == -1) {
> + if (sync_pipe_close(start_sync_pipes, PIPE_NAME_START) == -1) {
> tst_brkm(TBROK, NULL, "sync_pipe_close failed");
> exit(1);
> }
> Index: testcases/kernel/syscalls/ipc/msgrcv/msgrcv05.c
> ===================================================================
> --- testcases/kernel/syscalls/ipc/msgrcv/msgrcv05.c (revision 147)
> +++ testcases/kernel/syscalls/ipc/msgrcv/msgrcv05.c (revision 150)
> @@ -69,6 +69,7 @@
> void setup(void);
> void sighandler(int);
> #ifdef UCLINUX
> +#define PIPE_NAME "msgrcv05"
> void do_child_uclinux(void);
> #endif
>
> @@ -80,6 +81,8 @@
>
> int msg_q_1 = -1; /* The message queue id created in setup */
>
> +int sync_pipes[2];
> +
> MSGBUF rcv_buf;
> pid_t c_pid;
>
> @@ -87,7 +90,6 @@
> {
> int lc; /* loop counter */
> char *msg; /* message returned from parse_opts */
> - int sync_pipes[2];
>
> /* parse standard options */
> if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
> @@ -100,7 +102,7 @@
>
> setup(); /* global setup */
>
> - if (sync_pipe_create(sync_pipes) == -1)
> + 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 */
> @@ -123,11 +125,6 @@
> * With no message to read, the child sleeps.
> */
>
> - if (sync_pipe_notify(sync_pipes) == -1)
> - tst_brkm(TBROK, cleanup, "sync_pipe_notify
> failed");
> -
> - if (sync_pipe_close(sync_pipes) == -1)
> - tst_brkm(TBROK, cleanup, "sync_pipe_close
> failed");
> #ifdef UCLINUX
> if (self_exec(av[0], "d", msg_q_1) < 0) {
> tst_brkm(TBROK, cleanup, "could not self_exec");
> @@ -140,7 +137,7 @@
> if (sync_pipe_wait(sync_pipes) == -1)
> tst_brkm(TBROK, cleanup, "sync_pipe_wait
> failed");
>
> - if (sync_pipe_close(sync_pipes) == -1)
> + 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
> @@ -170,6 +167,12 @@
> void
> do_child()
> {
> + if (sync_pipe_notify(sync_pipes) == -1)
> + tst_brkm(TBROK, cleanup, "sync_pipe_notify failed");
> +
> + if (sync_pipe_close(sync_pipes, PIPE_NAME) == -1)
> + tst_brkm(TBROK, cleanup, "sync_pipe_close failed");
> +
> TEST(msgrcv(msg_q_1, &rcv_buf, MSGSIZE, 1, 0));
>
> if (TEST_RETURN != -1) {
> @@ -200,6 +203,9 @@
> void
> do_child_uclinux()
> {
> + if (sync_pipe_create(sync_pipes, PIPE_NAME) == -1)
> + tst_brkm(TBROK, cleanup, "sync_pipe_create failed");
> +
> tst_sig(FORK, sighandler, cleanup);
>
> do_child();
> Index: testcases/kernel/syscalls/ipc/msgrcv/msgrcv06.c
> ===================================================================
> --- testcases/kernel/syscalls/ipc/msgrcv/msgrcv06.c (revision 147)
> +++ testcases/kernel/syscalls/ipc/msgrcv/msgrcv06.c (revision 150)
> @@ -71,6 +71,7 @@
> void setup(void);
> void sighandler(int);
> #ifdef UCLINUX
> +#define PIPE_NAME "msgrcv06"
> void do_child_uclinux(void);
> #endif
>
> @@ -82,6 +83,8 @@
>
> int msg_q_1 = -1; /* The message queue id created in setup */
>
> +int sync_pipes[2];
> +
> MSGBUF rcv_buf;
> pid_t c_pid;
>
> @@ -89,7 +92,6 @@
> {
> int lc; /* loop counter */
> char *msg; /* message returned from parse_opts */
> - int sync_pipes[2];
>
> /* parse standard options */
> if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
> @@ -102,7 +104,7 @@
>
> setup(); /* global setup */
>
> - if (sync_pipe_create(sync_pipes) == -1)
> + 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 */
> @@ -137,11 +139,6 @@
> * With no message to read, the child sleeps.
> */
>
> - if (sync_pipe_notify(sync_pipes) == -1)
> - tst_brkm(TBROK, cleanup, "sync_pipe_notify
> failed");
> -
> - if (sync_pipe_close(sync_pipes) == -1)
> - tst_brkm(TBROK, cleanup, "sync_pipe_close
> failed");
> #ifdef UCLINUX
> if (self_exec(av[0], "d", msg_q_1) < 0) {
> tst_brkm(TBROK, cleanup, "could not self_exec");
> @@ -154,7 +151,7 @@
> if (sync_pipe_wait(sync_pipes) == -1)
> tst_brkm(TBROK, cleanup, "sync_pipe_wait
> failed");
>
> - if (sync_pipe_close(sync_pipes) == -1)
> + if (sync_pipe_close(sync_pipes, PIPE_NAME) == -1)
> tst_brkm(TBROK, cleanup, "sync_pipe_close
> failed");
>
> sleep(1);
> @@ -176,6 +173,12 @@
> void
> do_child()
> {
> + if (sync_pipe_notify(sync_pipes) == -1)
> + tst_brkm(TBROK, cleanup, "sync_pipe_notify failed");
> +
> + if (sync_pipe_close(sync_pipes, PIPE_NAME) == -1)
> + tst_brkm(TBROK, cleanup, "sync_pipe_close failed");
> +
> TEST(msgrcv(msg_q_1, &rcv_buf, MSGSIZE, 1, 0));
>
> if (TEST_RETURN != -1) {
> @@ -212,6 +215,9 @@
> void
> do_child_uclinux()
> {
> + if (sync_pipe_create(sync_pipes, PIPE_NAME) == -1)
> + tst_brkm(TBROK, cleanup, "sync_pipe_create failed");
> +
> tst_sig(FORK, sighandler, cleanup);
>
> do_child();
> Index: testcases/kernel/syscalls/ipc/semop/semop05.c
> ===================================================================
> --- testcases/kernel/syscalls/ipc/semop/semop05.c (revision 147)
> +++ testcases/kernel/syscalls/ipc/semop/semop05.c (revision 150)
> @@ -76,6 +76,8 @@
>
> int sem_id_1 = -1;
>
> +int sync_pipes[2];
> +
> struct sembuf s_buf;
>
> struct test_case_t {
> @@ -99,6 +101,7 @@
> };
>
> #ifdef UCLINUX
> +#define PIPE_NAME "semop05"
> void do_child_uclinux();
> static int i_uclinux;
> #endif
> @@ -129,9 +132,8 @@
> Tst_count = 0;
>
> for (i=0; i<TST_TOTAL; i++) {
> - int sync_pipes[2];
>
> - if (sync_pipe_create(sync_pipes) == -1)
> + if (sync_pipe_create(sync_pipes, PIPE_NAME) == -1)
> tst_brkm(TBROK, cleanup, "sync_pipe_create
> failed");
>
> /* initialize the s_buf buffer */
> @@ -151,12 +153,6 @@
>
> if (pid == 0) { /* child */
>
> - if (sync_pipe_notify(sync_pipes) == -1)
> - tst_brkm(TBROK, cleanup,
> "sync_pipe_notify failed: %d", errno);
> -
> - if (sync_pipe_close(sync_pipes) == -1)
> - tst_brkm(TBROK, cleanup,
> "sync_pipe_close failed: %d", errno);
> -
> #ifdef UCLINUX
> if (self_exec(av[0], "dd", i, sem_id_1) < 0) {
> tst_brkm(TBROK, cleanup,
> @@ -170,7 +166,7 @@
> if (sync_pipe_wait(sync_pipes) == -1)
> tst_brkm(TBROK, cleanup,
> "sync_pipe_wait failed: %d", errno);
>
> - if (sync_pipe_close(sync_pipes) == -1)
> + if (sync_pipe_close(sync_pipes, PIPE_NAME) ==
> -1)
> tst_brkm(TBROK, cleanup,
> "sync_pipe_close failed: %d", errno);
>
> /* After son has been created, give it a chance
> to execute the
> @@ -226,6 +222,16 @@
> void
> do_child(int i)
> {
> +#ifdef UCLINUX
> + if (sync_pipe_create(sync_pipes, PIPE_NAME) == -1)
> + tst_brkm(TBROK, cleanup, "sync_pipe_create failed");
> +#endif
> + if (sync_pipe_notify(sync_pipes) == -1)
> + tst_brkm(TBROK, cleanup, "sync_pipe_notify failed: %d", errno);
> +
> + if (sync_pipe_close(sync_pipes, PIPE_NAME) == -1)
> + tst_brkm(TBROK, cleanup, "sync_pipe_close failed: %d", errno);
> +
> /*
> * make the call with the TEST macro
> */
> Index: testcases/kernel/syscalls/ipc/semctl/semctl01.c
> ===================================================================
> --- testcases/kernel/syscalls/ipc/semctl/semctl01.c (revision 147)
> +++ testcases/kernel/syscalls/ipc/semctl/semctl01.c (revision 150)
> @@ -71,6 +71,8 @@
>
> int sem_id_1 = -1; /* a semaphore set with read and alter permissions */
>
> +int sync_pipes[2];
> +
> /*
> * These are the various setup and check functions for the 10 different
> * commands that are available for the semctl() call.
> @@ -112,7 +114,9 @@
> int pid_arr[NCHILD];
>
> #ifdef UCLINUX
> +#define PIPE_NAME "semctl01"
> static char *argv0;
> +int sem_op;
> #endif
>
> struct test_case_t {
> @@ -157,7 +161,7 @@
> #ifdef UCLINUX
> argv0 = av[0];
> maybe_run_child(&child_pid, "nd", 1, &sem_id_1);
> - maybe_run_child(&child_cnt, "ndd", 2, &sem_id_1, &sops.sem_op);
> + maybe_run_child(&child_cnt, "ndd", 2, &sem_id_1, &sem_op);
> #endif
>
> setup(); /* global setup */
> @@ -174,7 +178,6 @@
> /*
> * Set up any conditions if needed
> */
> -
> if (TC[i].func_setup != NULL) {
> /* call the setup function */
> switch (TC[i].cmd) {
> @@ -332,7 +335,6 @@
> cnt_setup(int opval)
> {
> int pid, i;
> - int sync_pipes[2];
>
> sops.sem_num = SEM4;
> sops.sem_flg = 0;
> @@ -349,9 +351,8 @@
> }
>
> sops.sem_op = opval; /* set the correct operation */
> -
> for (i=0; i<NCHILD; i++) {
> - if (sync_pipe_create(sync_pipes) == -1)
> + if (sync_pipe_create(sync_pipes, PIPE_NAME) == -1)
> tst_brkm(TBROK, cleanup, "sync_pipe_create failed");
>
> /* fork five children to wait */
> @@ -359,14 +360,10 @@
> tst_brkm(TBROK, cleanup, "fork failed in cnt_setup");
>
> if (pid == 0) { /* child */
> - if (sync_pipe_notify(sync_pipes) == -1)
> - tst_brkm(TBROK, cleanup, "sync_pipe_notify
> failed");
> -
> - if (sync_pipe_close(sync_pipes) == -1)
> - tst_brkm(TBROK, cleanup, "sync_pipe_close
> failed");
> #ifdef UCLINUX
> + sem_op = sops.sem_op;
> if (self_exec(argv0, "ndd", 2, sem_id_1,
> - sops.sem_op) < 0) {
> + sem_op) < 0) {
> tst_brkm(TBROK, cleanup, "self_exec failed "
> "in cnt_setup");
> }
> @@ -377,7 +374,7 @@
> if (sync_pipe_wait(sync_pipes) == -1)
> tst_brkm(TBROK, cleanup, "sync_pipe_wait
> failed");
>
> - if (sync_pipe_close(sync_pipes) == -1)
> + if (sync_pipe_close(sync_pipes, PIPE_NAME) == -1)
> tst_brkm(TBROK, cleanup, "sync_pipe_close
> failed");
>
> /* save the pid so we can kill it later */
> @@ -394,6 +391,18 @@
> void
> child_cnt()
> {
> +#ifdef UCLINUX
> + sops.sem_op = (short int)sem_op;
> + if (sync_pipe_create(sync_pipes, PIPE_NAME) == -1)
> + tst_brkm(TBROK, cleanup, "sync_pipe_create failed");
> +#endif
> +
> + if (sync_pipe_notify(sync_pipes) == -1)
> + tst_brkm(TBROK, cleanup, "sync_pipe_notify failed");
> +
> + if (sync_pipe_close(sync_pipes, PIPE_NAME) == -1)
> + tst_brkm(TBROK, cleanup, "sync_pipe_close failed");
> +
> sops.sem_num = SEM4;
> sops.sem_flg = 0;
>
> @@ -431,9 +440,8 @@
> pid_setup()
> {
> int pid;
> - int sync_pipes[2];
>
> - if (sync_pipe_create(sync_pipes) == -1) {
> + if (sync_pipe_create(sync_pipes, PIPE_NAME) == -1) {
> tst_brkm(TBROK, cleanup, "sync_pipe_create failed");
> }
>
> @@ -445,11 +453,6 @@
> }
>
> if (pid == 0) { /* child */
> - if (sync_pipe_notify(sync_pipes) == -1)
> - tst_brkm(TBROK, cleanup, "sync_pipe_notify failed");
> -
> - if (sync_pipe_close(sync_pipes) == -1)
> - tst_brkm(TBROK, cleanup, "sync_pipe_close failed");
> #ifdef UCLINUX
> if (self_exec(argv0, "nd", 1, sem_id_1) < 0) {
> tst_brkm(TBROK, cleanup, "self_exec failed "
> @@ -462,7 +465,7 @@
> if (sync_pipe_wait(sync_pipes) == -1)
> tst_brkm(TBROK, cleanup, "sync_pipe_wait failed");
>
> - if (sync_pipe_close(sync_pipes) == -1)
> + if (sync_pipe_close(sync_pipes, PIPE_NAME) == -1)
> tst_brkm(TBROK, cleanup, "sync_pipe_close failed");
> sleep(1);
> pid_arr[SEM2] = pid;
> @@ -472,6 +475,17 @@
> void
> child_pid()
> {
> +#ifdef UCLINUX
> + if (sync_pipe_create(sync_pipes, PIPE_NAME) == -1)
> + tst_brkm(TBROK, cleanup, "sync_pipe_create failed");
> +#endif
> +
> + if (sync_pipe_notify(sync_pipes) == -1)
> + tst_brkm(TBROK, cleanup, "sync_pipe_notify failed");
> +
> + if (sync_pipe_close(sync_pipes, PIPE_NAME) == -1)
> + tst_brkm(TBROK, cleanup, "sync_pipe_close failed");
> +
> sops.sem_num = SEM2; /* semaphore to change */
> sops.sem_op = ONE; /* operation is to increment semaphore */
> sops.sem_flg = 0;
> Index: testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
> ===================================================================
> --- testcases/kernel/syscalls/ipc/shmctl/shmctl01.c (revision 147)
> +++ testcases/kernel/syscalls/ipc/shmctl/shmctl01.c (revision 150)
> @@ -127,6 +127,7 @@
> #define NEWMODE 0066
>
> #ifdef UCLINUX
> +#define PIPE_NAME "shmctl01"
> static char *argv0;
> #endif
>
> @@ -270,7 +271,7 @@
>
> tst_flush();
> for (stat_i=0; stat_i<N_ATTACH; stat_i++) {
> - if (sync_pipe_create(sync_pipes) == -1)
> + if (sync_pipe_create(sync_pipes, PIPE_NAME) == -1)
> tst_brkm(TBROK, cleanup, "sync_pipe_create failed");
>
> if ((pid = FORK_OR_VFORK()) == -1) {
> @@ -293,7 +294,7 @@
> if (sync_pipe_wait(sync_pipes) == -1)
> tst_brkm(TBROK, cleanup, "sync_pipe_wait
> failed");
>
> - if (sync_pipe_close(sync_pipes) == -1)
> + if (sync_pipe_close(sync_pipes, PIPE_NAME) == -1)
> tst_brkm(TBROK, cleanup, "sync_pipe_close
> failed");
> }
> }
> @@ -310,6 +311,11 @@
> int rval;
> void *test;
>
> +#ifdef UCLINUX
> + if (sync_pipe_create(sync_pipes, PIPE_NAME) == -1)
> + tst_brkm(TBROK, cleanup, "sync_pipe_create failed");
> +#endif
> +
> if (stat_time == FIRST) {
> test = set_shmat();
> } else {
> @@ -319,7 +325,7 @@
> if (sync_pipe_notify(sync_pipes) == -1)
> tst_brkm(TBROK, cleanup, "sync_pipe_notify failed");
>
> - if (sync_pipe_close(sync_pipes) == -1)
> + if (sync_pipe_close(sync_pipes, PIPE_NAME) == -1)
> tst_brkm(TBROK, cleanup, "sync_pipe_close failed");
>
> /* do an assignement for fun */
> Index: testcases/kernel/syscalls/ipc/msgsnd/msgsnd05.c
> ===================================================================
> --- testcases/kernel/syscalls/ipc/msgsnd/msgsnd05.c (revision 147)
> +++ testcases/kernel/syscalls/ipc/msgsnd/msgsnd05.c (revision 150)
> @@ -73,6 +73,7 @@
> void setup(void);
> void sighandler(int);
> #ifdef UCLINUX
> +#define PIPE_NAME "msgsnd05"
> void do_child_uclinux(void);
> #endif
>
> @@ -83,6 +84,9 @@
> int exp_enos[] = {EINTR, 0}; /* 0 terminated list of expected errnos */
>
> int msg_q_1 = -1; /* The message queue id created in setup */
> +
> +int sync_pipes[2];
> +
> MSGBUF msg_buf;
>
> int main(int ac, char **av)
> @@ -90,7 +94,6 @@
> int lc; /* loop counter */
> char *msg; /* message returned from parse_opts */
> pid_t c_pid;
> - int sync_pipes[2];
>
> /* parse standard options */
> if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
> @@ -103,7 +106,7 @@
>
> setup(); /* global setup */
>
> - if (sync_pipe_create(sync_pipes) == -1)
> + 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 */
> @@ -126,11 +129,6 @@
> * Without the IPC_NOWAIT flag, the child sleeps
> */
>
> - if (sync_pipe_notify(sync_pipes) == -1)
> - tst_brkm(TBROK, cleanup, "sync_pipe_notify
> failed");
> -
> - if (sync_pipe_close(sync_pipes) == -1)
> - tst_brkm(TBROK, cleanup, "sync_pipe_close
> failed");
> #ifdef UCLINUX
> if (self_exec(av[0], "d", msg_q_1) < 0) {
> tst_brkm(TBROK, cleanup, "could not self_exec");
> @@ -143,7 +141,7 @@
> if (sync_pipe_wait(sync_pipes) == -1)
> tst_brkm(TBROK, cleanup, "sync_pipe_wait
> failed");
>
> - if (sync_pipe_close(sync_pipes) == -1)
> + 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
> @@ -173,6 +171,12 @@
> void
> do_child()
> {
> + if (sync_pipe_notify(sync_pipes) == -1)
> + tst_brkm(TBROK, cleanup, "sync_pipe_notify failed");
> +
> + if (sync_pipe_close(sync_pipes, PIPE_NAME) == -1)
> + tst_brkm(TBROK, cleanup, "sync_pipe_close failed");
> +
> TEST(msgsnd(msg_q_1, &msg_buf, MSGSIZE, 0));
>
> if (TEST_RETURN != -1) {
> @@ -206,6 +210,9 @@
> /* initialize the message buffer */
> init_buf(&msg_buf, MSGTYPE, MSGSIZE);
>
> + if (sync_pipe_create(sync_pipes, PIPE_NAME) == -1)
> + tst_brkm(TBROK, cleanup, "sync_pipe_create failed");
> +
> tst_sig(FORK, sighandler, cleanup);
>
> do_child();
> Index: testcases/kernel/syscalls/ipc/msgsnd/msgsnd06.c
> ===================================================================
> --- testcases/kernel/syscalls/ipc/msgsnd/msgsnd06.c (revision 147)
> +++ testcases/kernel/syscalls/ipc/msgsnd/msgsnd06.c (revision 150)
> @@ -77,6 +77,9 @@
> int exp_enos[] = { EIDRM, 0 }; /* 0 terminated list of expected errnos
> */
>
> int msg_q_1 = -1; /* The message queue id created in setup */
> +
> +int sync_pipes[2];
> +
> MSGBUF msg_buf;
>
> int main(int ac, char **av)
> @@ -85,7 +88,6 @@
> char *msg; /* message returned from parse_opts */
> pid_t c_pid;
> int status, e_code;
> - int sync_pipes[2];
>
> /* parse standard options */
> if ((msg =
> @@ -94,12 +96,13 @@
> }
>
> #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) == -1)
> + 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 */
> @@ -134,11 +137,6 @@
>
> if (c_pid == 0) { /* child */
>
> - if (sync_pipe_notify(sync_pipes) == -1)
> - tst_brkm(TBROK, cleanup, "sync_pipe_notify failed");
> -
> - if (sync_pipe_close(sync_pipes) == -1)
> - tst_brkm(TBROK, cleanup, "sync_pipe_close failed");
> #ifdef UCLINUX
> if (self_exec(av[0], "d", msg_q_1) < 0) {
> tst_brkm(TBROK, cleanup, "could not self_exec");
> @@ -151,7 +149,7 @@
> if (sync_pipe_wait(sync_pipes) == -1)
> tst_brkm(TBROK, cleanup, "sync_pipe_wait failed");
>
> - if (sync_pipe_close(sync_pipes) == -1)
> + 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
> @@ -189,8 +187,16 @@
> #ifdef UCLINUX
> /* initialize the message buffer */
> init_buf(&msg_buf, MSGTYPE, MSGSIZE);
> +
> + if (sync_pipe_create(sync_pipes, PIPE_NAME) == -1)
> + tst_brkm(TBROK, cleanup, "sync_pipe_create failed");
> #endif
>
> + if (sync_pipe_notify(sync_pipes) == -1)
> + tst_brkm(TBROK, cleanup, "sync_pipe_notify failed");
> +
> + if (sync_pipe_close(sync_pipes, PIPE_NAME) == -1)
> + tst_brkm(TBROK, cleanup, "sync_pipe_close failed");
> /*
> * Attempt to write another message to the full queue.
> * Without the IPC_NOWAIT flag, the child sleeps
> Index: testcases/kernel/syscalls/ftruncate/ftruncate04.c
> ===================================================================
> --- testcases/kernel/syscalls/ftruncate/ftruncate04.c (revision 147)
> +++ testcases/kernel/syscalls/ftruncate/ftruncate04.c (revision 150)
> @@ -243,6 +243,12 @@
> int fd;
> struct flock flocks;
>
> +#ifdef UCLINUX
> +#define PIPE_NAME "ftruncate04"
> + if (sync_pipe_create(sync_pipes, PIPE_NAME) == -1)
> + tst_brkm(TBROK, cleanup, "sync_pipe_create failed");
> +#endif
> +
> if ((fd = open(filename, O_RDWR)) < 0) {
> tst_resm(TFAIL,"child open");
> tst_exit();
> @@ -265,7 +271,7 @@
> if (sync_pipe_notify(sync_pipes) == -1)
> tst_brkm(TBROK, cleanup, "sync_pipe_notify failed");
>
> - if (sync_pipe_close(sync_pipes) == -1)
> + if (sync_pipe_close(sync_pipes, PIPE_NAME) == -1)
> tst_brkm(TBROK, cleanup, "sync_pipe_close failed");
> pause();
> tst_exit();
> @@ -362,7 +368,7 @@
> */
> recstart = RECLEN + rand()%(len - 3*RECLEN);
>
> - if (sync_pipe_create(sync_pipes) == -1)
> + if (sync_pipe_create(sync_pipes, PIPE_NAME) == -1)
> tst_brkm(TBROK, cleanup, "sync_pipe_create
> failed");
>
> if ((cpid = FORK_OR_VFORK()) < 0) {
> @@ -392,7 +398,7 @@
> if (sync_pipe_wait(sync_pipes) == -1)
> tst_brkm(TBROK, cleanup, "sync_pipe_wait
> failed");
>
> - if (sync_pipe_close(sync_pipes) == -1)
> + if (sync_pipe_close(sync_pipes, PIPE_NAME) == -1)
> tst_brkm(TBROK, cleanup, "sync_pipe_close
> failed");
>
> doparent();
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> Ltp-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ltp-list
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list