This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
FreeBSD port (50): assumptions about struct sigevent
- From: Bruno Haible <bruno at clisp dot org>
- To: Roland McGrath <roland at frob dot com>
- Cc: libc-alpha at sources dot redhat dot com
- Date: Thu, 5 Sep 2002 14:19:23 +0200 (CEST)
- Subject: FreeBSD port (50): assumptions about struct sigevent
One of the Linuxthreads tests assumes a particular layout of 'struct sigevent'.
On FreeBSD it is different, simpler, with no _sigev_un. Here is a patch
to increase the portability of the test.
linuxthreads/ChangeLog:
2002-09-04 Bruno Haible <bruno@clisp.org>
* sysdeps/pthread/tst-timer.c (main): Don't assume anything about
the structure of 'struct sigevent'.
diff -r -c3 glibc-20020828.bak/linuxthreads/sysdeps/pthread/tst-timer.c glibc-20020828/linuxthreads/sysdeps/pthread/tst-timer.c
*** glibc-20020828.bak/linuxthreads/sysdeps/pthread/tst-timer.c Tue Aug 27 13:38:44 2002
--- glibc-20020828/linuxthreads/sysdeps/pthread/tst-timer.c Fri Aug 30 11:04:30 2002
***************
*** 1,5 ****
/* Tests for POSIX timer implementation.
! Copyright (C) 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Kaz Kylheku <kaz@ashi.footprints.net>.
--- 1,5 ----
/* Tests for POSIX timer implementation.
! Copyright (C) 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Kaz Kylheku <kaz@ashi.footprints.net>.
***************
*** 66,82 ****
.sigev_notify = SIGEV_SIGNAL,
.sigev_signo = ZSIGALRM
};
! struct sigevent sigev2 =
! {
! .sigev_notify = SIGEV_THREAD,
! ._sigev_un =
! {
! ._sigev_thread =
! {
! ._function = notify_func
! }
! }
! };
struct itimerspec itimer1 = { { 0, 200000000 }, { 0, 200000000 } };
struct itimerspec itimer2 = { { 0, 100000000 }, { 0, 500000000 } };
struct itimerspec itimer3 = { { 0, 150000000 }, { 0, 300000000 } };
--- 66,72 ----
.sigev_notify = SIGEV_SIGNAL,
.sigev_signo = ZSIGALRM
};
! struct sigevent sigev2;
struct itimerspec itimer1 = { { 0, 200000000 }, { 0, 200000000 } };
struct itimerspec itimer2 = { { 0, 100000000 }, { 0, 500000000 } };
struct itimerspec itimer3 = { { 0, 150000000 }, { 0, 300000000 } };
***************
*** 84,89 ****
--- 74,82 ----
retval = clock_gettime (CLOCK_REALTIME, &ts);
+ sigev2.sigev_notify = SIGEV_THREAD;
+ sigev2.sigev_notify_function = notify_func;
+
setvbuf (stdout, 0, _IOLBF, 0);
printf ("clock_gettime returned %d, timespec = { %ld, %ld }\n",