public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] 'select' failure or signal should not update timeout
@ 2002-07-20  3:59 dank
  0 siblings, 0 replies; 23+ messages in thread
From: dank @ 2002-07-20  3:59 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org

Alan Cox wrote:
> > <http://www.opengroup.org/onlinepubs/007904975/functions/select.html>
> > says that 'select' may modify its timeout argument only "upon
> > successful completion".  However, the Linux kernel sometimes modifies
> > the timeout argument even when 'select' fails or is interrupted.
> 
> This is extremely useful behaviour. POSIX is broken here. 

I tried to make use of this behavior back in 2.2 days, I think,
and ran into trouble.  The time remaining wasn't quite right, I seem
to recall, making this nifty feature less useful.  I've since
given up on it.

> Fix it in the C library or somewhere it doesn't harm the clueful

Can you give an example of a clueful package that makes
use of this feature and would be harmed if select() suddenly
became posix-compliant?

- Dan

^ permalink raw reply	[flat|nested] 23+ messages in thread
* Re: [PATCH] 'select' failure or signal should not update timeout
@ 2002-07-21  3:34 Peter T. Breuer
  0 siblings, 0 replies; 23+ messages in thread
From: Peter T. Breuer @ 2002-07-21  3:34 UTC (permalink / raw)
  To: linux-kernel


Dan writes:
> Alan Cox wrote:
> > > <http://www.opengroup.org/onlinepubs/007904975/functions/select.html>
> > > says that 'select' may modify its timeout argument only "upon
> > > successful completion".  However, the Linux kernel sometimes modifies
> > > the timeout argument even when 'select' fails or is interrupted.
> > 
> > This is extremely useful behaviour. POSIX is broken here. 
> 
> I tried to make use of this behavior back in 2.2 days, I think,
> and ran into trouble.  The time remaining wasn't quite right, I seem
> to recall, making this nifty feature less useful.  I've since
> given up on it.
> 
> > Fix it in the C library or somewhere it doesn't harm the clueful
> 
> Can you give an example of a clueful package that makes
> use of this feature and would be harmed if select() suddenly
> became posix-compliant?

Daemons that I've written for linux-specific tasks all 
use the select timeout in order to wait for an event for a fixed
amount of time, across possible interrupts.

That is to say, they watch the errno after return from select, and if
it was EINTR, then they reenter the select without further ado.
Since the timeout has changed to reflect the time remaining, that's
quite right.

This is typical of deamons doing tcp/ip. I guess one answer would be to
make tcp timeout more configurable.


Peter

^ permalink raw reply	[flat|nested] 23+ messages in thread
* Re: [PATCH] 'select' failure or signal should not update timeout
@ 2002-07-28 10:33 linux
  0 siblings, 0 replies; 23+ messages in thread
From: linux @ 2002-07-28 10:33 UTC (permalink / raw)
  To: linux-kernel

Chris Friesen asked for:
> waitonmonotonicallyincreasingnonadjustablehighres64bittime()

Well, take the POSIX clock_gettime() interface and add clock_waittime().
Oh, wait.. they already did it.  clock_nanosleep().

The POSIX folks realized that people want a variety of tiemrs, and
so the functions take a clockid_t first argument, which is just an enum.
They defined two values, but leave the field open to others:
- CLOCK_MONOTONIC, which is what you want.  Unspecified epoch
  (possibly boot time), and never gets adjusted
- CLOCK_REALTIME, which is the classig time() UTC time.

Extensions define CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID.

The clock weenies are welcome to add CLOCK_TAI, CLOCK_GPS, CLOCK_UTS
(see Markus Kuhn's suggestion), CLOCK_UTC (with some "better" leap-second
handling), CLOCK_FREQADJUST (uses frequency but not phase adjustments),
CLOCK_NOSTEP (frequency and phase adjustments, but doesn't step),
and anything else you like.

Astronomers might add CLOCK_UT1, CLOCK_UT0, CLOCK_SIDERIAL, CLOCK_TDB,
CLOCK_TDT, CLOCK_TCG, CLOCK_TCB, and maybe a few things I haven't thought
of.  The interface doesn't require that all of these be implemented in
the kernel, of course.

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2002-07-28 10:30 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <200207171430.g6HEUvY23619@aztec.santafe.edu>
2002-07-19  9:52 ` [PATCH] 'select' failure or signal should not update timeout Paul Eggert
2002-07-20  0:38   ` Alan Cox
2002-07-20  5:57     ` Linus Torvalds
2002-07-21 15:36       ` Eric W. Biederman
2002-07-24 13:44         ` Jamie Lokier
2002-07-24 18:48           ` Linus Torvalds
2002-07-24 19:07             ` Chris Friesen
2002-07-24 23:30             ` Jamie Lokier
2002-07-25  6:32             ` Rusty Russell
2002-07-25 18:31               ` george anzinger
2002-07-28  5:40               ` David Schwartz
2002-07-25 16:35             ` Eric W. Biederman
2002-07-25 17:15               ` Jamie Lokier
2002-07-21 16:00       ` Christoph Rohland
2002-07-21 16:43         ` Linus Torvalds
2002-07-21 17:51           ` dean gaudet
2002-07-22  3:59           ` Edgar Toernig
2002-07-22  6:51           ` Christoph Rohland
2002-07-21 16:26       ` Ingo Molnar
2002-07-21 20:14     ` Richard Stallman
2002-07-20  3:59 dank
  -- strict thread matches above, loose matches on Subject: below --
2002-07-21  3:34 Peter T. Breuer
2002-07-28 10:33 linux

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox