* tst-cancel4.c (tf_msgrcv): Use IPC_PRIVATE in msgget call.
	(tf_msgsnd): Likewise.
This commit is contained in:
Ulrich Drepper 2003-06-27 17:53:52 +00:00
parent 7d7ff54cb9
commit 483e95d09b
2 changed files with 12 additions and 4 deletions

View File

@ -1,5 +1,8 @@
2003-06-27 Ulrich Drepper <drepper@redhat.com> 2003-06-27 Ulrich Drepper <drepper@redhat.com>
* tst-cancel4.c (tf_msgrcv): Use IPC_PRIVATE in msgget call.
(tf_msgsnd): Likewise.
* tst-cancel4.c (tf_msgrcv): Strengthen test against valid * tst-cancel4.c (tf_msgrcv): Strengthen test against valid
premature returns a bit more. premature returns a bit more.

View File

@ -80,6 +80,10 @@ static int tempmsg = -1;
static pthread_barrier_t b2; static pthread_barrier_t b2;
#ifndef IPC_ADDVAL
# define IPC_ADDVAL 0
#endif
/* Cleanup handling test. */ /* Cleanup handling test. */
static int cl_called; static int cl_called;
@ -90,6 +94,7 @@ cl (void *arg)
} }
static void * static void *
tf_read (void *arg) tf_read (void *arg)
{ {
@ -1872,7 +1877,7 @@ tf_tcdrain (void *arg)
static void * static void *
tf_msgrcv (void *arg) tf_msgrcv (void *arg)
{ {
tempmsg = msgget (random (), 0666 | IPC_CREAT); tempmsg = msgget (IPC_PRIVATE, 0666 | IPC_CREAT);
int r = pthread_barrier_wait (&b2); int r = pthread_barrier_wait (&b2);
if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
@ -1903,7 +1908,7 @@ tf_msgrcv (void *arg)
int randnr; int randnr;
/* We need a positive random number. */ /* We need a positive random number. */
do do
randnr = random (); randnr = random () % 64000;
while (randnr <= 0); while (randnr <= 0);
do do
{ {
@ -1928,7 +1933,7 @@ tf_msgsnd (void *arg)
// blocks we can enable this test to run in both rounds. // blocks we can enable this test to run in both rounds.
abort (); abort ();
tempmsg = msgget (random (), 0666 | IPC_CREAT); tempmsg = msgget (IPC_PRIVATE, 0666 | IPC_CREAT);
int r = pthread_barrier_wait (&b2); int r = pthread_barrier_wait (&b2);
if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
@ -1953,7 +1958,7 @@ tf_msgsnd (void *arg)
} m; } m;
/* We need a positive random number. */ /* We need a positive random number. */
do do
m.type = random (); m.type = random () % 64000;
while (m.type <= 0); while (m.type <= 0);
msgsnd (tempmsg, (struct msgbuf *) &m, sizeof (m.mem), 0); msgsnd (tempmsg, (struct msgbuf *) &m, sizeof (m.mem), 0);