Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

The <signal.h> header shall define the timespec structure as described in <time.h>

2 views
Skip to first unread message

Kamil Rytarowski

unread,
Jun 22, 2015, 4:31:30 AM6/22/15
to
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html says:
'The <signal.h> header shall define the timespec structure as described
in <time.h>.'

For the following code:
#include <signal.h>
struct timespec ts;
int main(){}

I get:
error: storage size of ‘ts’ isn’t known
struct timespec ts;

I added <sys/time.h> to <sys/siginfo.h> to follow
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/sys/siginfo.h.diff?r1=1.5&r2=1.6&f=h

Is this change ok?

Index: sys/sys/siginfo.h
===================================================================
RCS file: /cvsroot/src/sys/sys/siginfo.h,v
retrieving revision 1.25
diff -u -r1.25 siginfo.h
--- sys/sys/siginfo.h 22 Nov 2013 21:04:11 -0000 1.25
+++ sys/sys/siginfo.h 22 Jun 2015 07:25:46 -0000
@@ -34,6 +34,7 @@

#include <machine/signal.h>
#include <sys/featuretest.h>
+#include <sys/time.h>
#ifdef _KERNEL
#include <sys/queue.h>
#endif
Index: include/signal.h
===================================================================
RCS file: /cvsroot/src/include/signal.h,v
retrieving revision 1.54
diff -u -r1.54 signal.h
--- include/signal.h 27 Aug 2010 08:40:38 -0000 1.54
+++ include/signal.h 22 Jun 2015 07:25:46 -0000
@@ -183,7 +183,6 @@
void psiginfo(const siginfo_t *, const char *);

#ifndef __LIBC12_SOURCE__
-struct timespec;
int sigtimedwait(const sigset_t * __restrict,
siginfo_t * __restrict, const struct timespec * __restrict)
__RENAME(__sigtimedwait50);


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-...@muc.de

Christos Zoulas

unread,
Jun 22, 2015, 4:01:50 PM6/22/15
to
In article <5587B93B...@gmx.com>, Kamil Rytarowski <n...@gmx.com> wrote:
>http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html says:
>'The <signal.h> header shall define the timespec structure as described
>in <time.h>.'
>
>For the following code:
>#include <signal.h>
>struct timespec ts;
>int main(){}
>
>I get:
>error: storage size of ‘ts’ isn’t known
> struct timespec ts;
>
>I added <sys/time.h> to <sys/siginfo.h> to follow
>http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/sys/siginfo.h.diff?r1=1.5&r2=1.6&f=h
>
>Is this change ok?

Yes, I think it is fine since siginfo.h is not included from any other
userland visible posix headers aside signal related ones (it is included
in sys/proc.h too but that is not posix).

christos

Kamil Rytarowski

unread,
Jun 22, 2015, 7:31:48 PM6/22/15
to
On 22.06.2015 16:14, Christos Zoulas wrote:
> In article <5587B93B...@gmx.com>, Kamil Rytarowski <n...@gmx.com> wrote:
>> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html says:
>> 'The <signal.h> header shall define the timespec structure as described
>> in <time.h>.'
>>
>> For the following code:
>> #include <signal.h>
>> struct timespec ts;
>> int main(){}
>>
>> I get:
>> error: storage size of ‘ts’ isn’t known
>> struct timespec ts;
>>
>> I added <sys/time.h> to <sys/siginfo.h> to follow
>> http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/sys/siginfo.h.diff?r1=1.5&r2=1.6&f=h
>>
>> Is this change ok?
>
> Yes, I think it is fine since siginfo.h is not included from any other
> userland visible posix headers aside signal related ones (it is included
> in sys/proc.h too but that is not posix).
>
> christos
>

Thanks, I request to commit it for -current. I've run into a situation
when a piece of software requires this POSIX behavior.

Kamil Rytarowski

unread,
Jul 11, 2015, 8:04:44 PM7/11/15
to
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 23.06.2015 00:46, Kamil Rytarowski wrote:
> On 22.06.2015 16:14, Christos Zoulas wrote:
>> In article <5587B93B...@gmx.com>, Kamil Rytarowski
>> <n...@gmx.com> wrote:
>>> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.ht
ml
>>> says: 'The <signal.h> header shall define the timespec
>>> structure as described in <time.h>.'
>>>
>>> For the following code: #include <signal.h> struct timespec
>>> ts; int main(){}
>>>
>>> I get: error: storage size of ‘ts’ isn’t known struct
>>> timespec ts;
>>>
>>> I added <sys/time.h> to <sys/siginfo.h> to follow
>>> http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/sys/siginfo.h.diff?
r1=1.5&r2=1.6&f=h
>>>
>>>
>>>
Is this change ok?
>>
>> Yes, I think it is fine since siginfo.h is not included from any
>> other userland visible posix headers aside signal related ones
>> (it is included in sys/proc.h too but that is not posix).
>>
>> christos
>>
>
> Thanks, I request to commit it for -current. I've run into a
> situation when a piece of software requires this POSIX behavior.
>

I'm going to commit this change after 24h. In case of comments please
let me know.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJVoRLmAAoJEEuzCOmwLnZsSOwP/3RhPDZtqGLaq0HW5VH3a1sV
F6jyLZ1+pBLxR1gwX7p4Q0NhnCdHj/royH13pHoQ3nsyXIZ7QpohcT7TzZS6OWxn
sZ4T9lyAiGW0w3Bwe1OUHPY0El/5k68x31OqRybkXzoKzhj50nC+4OukxnRsijzh
klQWEt0J8a6rn69GpeXJttavhyCDFYo91WwpSrq7+V05DFPW5brZ8cVsfV7GM7qN
pT6YmZC6LIh8OLd3QFmtsD8kgdEQ5LUwI78nNBzok9u4dqPeVu7sQdR64ipY0ZuD
1bdTcFvBuet+D5E8tEjAncMRGdrO4DuJvtGLGYFfHx9OWI+OZ73KC9rgcue9AaRu
DkxA0Y8N1BMYVn2QGja4EoUDP8HmX0pwgxg7wnZJ+yGkAgOgqxziWZkhfB9nOAoc
Z0EUd3ANd7zFhjSuuZSpb9PV54iTwjzepcII3/QFqlsbA7pCXqfL0awX2L7Mk0Vz
KaYCJwjSaVGD/lB3DRa8byh4lzpt545tBPzcKoVr0ka4QejbSzk7pmxLSwy/bIum
IGG8TN9aZF8g0vIttnb5g5WqABxHQ8X01S3mW7HmvlbjtO+iYz4TH6U9HEVBT542
newXeBaWIDiKGRd2vP731DOPwyzwVUFWmpMUz9ttTqRsUmY0Lak9+hdmZUGbLaL2
a39r8pu/EMnqLQ1Jqt/D
=1OXF
-----END PGP SIGNATURE-----

David Holland

unread,
Jul 11, 2015, 11:16:35 PM7/11/15
to
On Sat, Jul 11, 2015 at 02:58:16PM +0200, Kamil Rytarowski wrote:
> > Thanks, I request to commit it for -current. I've run into a
> > situation when a piece of software requires this POSIX behavior.
>
> I'm going to commit this change after 24h. In case of comments please
> let me know.

Is it really ok to expose the rest of sys/time.h in signal.h? That
doesn't entirely sound like a good idea...

--
David A. Holland
dhol...@netbsd.org

Kamil Rytarowski

unread,
Jul 12, 2015, 6:29:14 AM7/12/15
to
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 12.07.2015 05:16, David Holland wrote:
> On Sat, Jul 11, 2015 at 02:58:16PM +0200, Kamil Rytarowski wrote:
>>> Thanks, I request to commit it for -current. I've run into a
>>> situation when a piece of software requires this POSIX
>>> behavior.
>>
>> I'm going to commit this change after 24h. In case of comments
>> please let me know.
>
> Is it really ok to expose the rest of sys/time.h in signal.h? That
> doesn't entirely sound like a good idea...
>

What's your alternative? The change is inspired by OpenBSD.

FreeBSD doesn't seem to expose definition of struct timespec, but I
might be wrong.

GLIBC has the following lines in signal.h:

72 #ifdef __USE_POSIX199309
73 /* We need `struct timespec' later on. */
74 # define __need_timespec
75 # include <time.h>
76 #endif

https://sourceware.org/git/?p=glibc.git;a=blob;f=signal/signal.h;h=712cd
95c7695c83d3a3e33a85397a20cf4002e6e;hb=HEAD

MUSL defines it:

#define __NEED_size_t
#define __NEED_pid_t
#define __NEED_uid_t
#define __NEED_struct_timespec
#define __NEED_pthread_t
#define __NEED_pthread_attr_t
#define __NEED_time_t
#define __NEED_clock_t
#define __NEED_sigset_t

#include <bits/alltypes.h>

http://git.musl-libc.org/cgit/musl/tree/include/signal.h

ULIBC defines it:

#if defined __USE_POSIX199309 && defined __UCLIBC_HAS_REALTIME__
/* We need `struct timespec' later on. */
# define __need_timespec
# include <time.h>
#endif

http://git.uclibc.org/uClibc/tree/include/signal.h
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJVokBMAAoJEEuzCOmwLnZsUTwQAMax0nfhcS2fsE2VFEfK0f4y
x7uBzPlibdFC4J7NMwIOUofDV2BgP6pKnaA0n4o95ZMMaWHExOlXaHFQyWnmTFNW
UlpXTtDQj7DNmkICo9EQY6OZSyA6BPC7MH/5j6DnTH9Mqgs484McppIbbG4LTg6Y
yYNLgFRW6kCqWTk6s3ZZXlZFjYtOxJDHMz0hpRd9TJotr4nhbcA/FyEeO4/4Tizx
5reCdHb+7/8LzLPMygHhOukHkcAA3mGJMWtPwHBO5+n/4OggLOFBPzoQGHdCoeEL
dfU6XQi2mIUiLmm3uLG+iKLywbOK1BSezIjSpledmLZJOY3afxAtf5EqCzojXCXV
hoY6FH7wAJnE4QceWWVNkqcM3x1CmYO9i/GP8tAklw2/SPnKNunRC1G60OZY4T/D
cGqNnPM8cVx1PI62WD7BrvL8ulWO/sDOtno7PkT4CHDMroeKzS5Pg0tzAz3CDvk5
YXQysrb1zpJakfkiwYISJRPesk7QadyI+9Tui/J1SAwB76jYgSuAYEsYlnegQfXK
ztbE8YqMYU1NRqj+p2QgzylDZC5aj331JaxU7OFESpqcQ5WDoqFyMlCXzOgKynH+
0/cvH8JLA9sMj4llG73axVjfT5xVRwhMab0ZazGJFoVqcwABvmzqYWoaxyx9E7Wl
WsoWNRXS75yzomvOFcw8
=GMgs

Joerg Sonnenberger

unread,
Jul 12, 2015, 7:12:18 AM7/12/15
to
On Sun, Jul 12, 2015 at 12:24:16PM +0200, Kamil Rytarowski wrote:
> What's your alternative? The change is inspired by OpenBSD.

The alternative is to just define timespec in both headers, like we do
for a variety of types already (e.g. size_t).

Joerg

David Holland

unread,
Jul 12, 2015, 1:38:03 PM7/12/15
to
On Sun, Jul 12, 2015 at 01:12:00PM +0200, Joerg Sonnenberger wrote:
> > What's your alternative? The change is inspired by OpenBSD.
>
> The alternative is to just define timespec in both headers, like we do
> for a variety of types already (e.g. size_t).

That or put it in its own header; the current layout of includes would
make that awkward but it's the best solution in the long run.
0 new messages