[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: relaxing xnanosleep
From: |
Jim Meyering |
Subject: |
Re: relaxing xnanosleep |
Date: |
Thu, 25 Mar 2010 08:23:04 +0100 |
Eric Blake wrote:
> Right now, xnanosleep is GPL. But I don't see it calling exit() (which
> is normally the reason why most x*() interfaces are GPL), and it would
> be useful to use in libvirt. Any objections to relaxing the license to
> LGPLv2+, including a technical reason I might be overlooking? nanosleep
> and sigaction would also need relaxing from LGPLv3+ to LGPLv2+, but
> those are easier to justify.
Relaxing those is fine by me, but nanosleep has two problems:
- it is inappropriate for library use, since it manipulates signal masks.
- its implementation is incomplete:
/* Suspend execution for at least *REQUESTED_DELAY seconds. The
*REMAINING_DELAY part isn't implemented yet. */
int
rpl_nanosleep (const struct timespec *requested_delay,
struct timespec *remaining_delay)
...
if (suspended)
{
/* Calculate time remaining. */
/* FIXME: the code in sleep doesn't use this, so there's no
rush to implement it. */
errno = EINTR;
}
But both of those are in order to handle being suspended a la control-Z,
and in a library context that might not be a concern.
Hence, it might be better to optionally stub out the suspend-handling
for applications that would prefer no signal handling interference.