summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/sleep.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix SCM ID's.obrien2002-02-011-4/+2
|
* Remove _THREAD_SAFE and make libc thread-safe by default bydeischen2001-01-241-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | adding (weak definitions to) stubs for some of the pthread functions. If the threads library is linked in, the real pthread functions will pulled in. Use the following convention for system calls wrapped by the threads library: __sys_foo - actual system call _foo - weak definition to __sys_foo foo - weak definition to __sys_foo Change all libc uses of system calls wrapped by the threads library from foo to _foo. In order to define the prototypes for _foo(), we introduce namespace.h and un-namespace.h (suggested by bde). All files that need to reference these system calls, should include namespace.h before any standard includes, then include un-namespace.h after the standard includes and before any local includes. <db.h> is an exception and shouldn't be included in between namespace.h and un-namespace.h namespace.h will define foo to _foo, and un-namespace.h will undefine foo. Try to eliminate some of the recursive calls to MT-safe functions in libc/stdio in preparation for adding a mutex to FILE. We have recursive mutexes, but would like to avoid using them if possible. Remove uneeded includes of <errno.h> from a few files. Add $FreeBSD$ to a few files in order to pass commitprep. Approved by: -arch
* Take care to avoid having "strong" and "weak" symbols of the same name injasone2000-03-161-0/+2
| | | | libc_r.
* Simplify sytem call renaming. Instead of _foo() <-- _libc_foo <-- foo(),jasone2000-01-271-3/+2
| | | | | | | | | | | | | | | | | just use _foo() <-- foo(). In the case of a libpthread that doesn't do call conversion (such as linuxthreads and our upcoming libpthread), this is adequate. In the case of libc_r, we still need three names, which are now _thread_sys_foo() <-- _foo() <-- foo(). Convert all internal libc usage of: aio_suspend(), close(), fsync(), msync(), nanosleep(), open(), fcntl(), read(), and write() to _foo() instead of foo(). Remove all internal libc usage of: creat(), pause(), sleep(), system(), tcdrain(), wait(), and waitpid(). Make thread cancellation fully POSIX-compliant. Suggested by: deischen
* Add three-tier symbol naming in support of POSIX thread cancellationjasone2000-01-121-3/+6
| | | | | | points. For library functions, the pattern is __sleep() <-- _libc_sleep() <-- sleep(). The arrows represent weak aliases. For system calls, the pattern is _read() <-- _libc_read() <-- read().
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* restore rev 1.23 to give clear SIGALRM handling example, 68 yearsache1998-09-081-28/+16
| | | | are too long to affect real code
* Reviewed by: Andrey A. Chernov <ache@nagual.pp.ru>, Doug Rabson ↵dillon1998-09-061-17/+29
| | | | | | | <dfr@nlsystems.com> Rewrote sleep() to remove int/long typing assumptions between the argument to the function and the timespec structure.
* Use INT_MAX instead of LONG_MAX since the variable being comparedjb1998-09-051-4/+4
| | | | is an int, not a long.
* Fix LONG_MAX overflowingache1997-10-171-10/+21
| | | | | | Return seconds if errno other than EINTR Add $Id Submitted by: bde with minor optimization by me
* Copy time_to_sleep to time_remaining since it can be leftache1997-10-161-0/+1
| | | | uninitialized if nanosleep returns early with agr error
* Cleanup #includesache1997-10-161-2/+1
|
* Give up on the "try and compensate for broken programs" cruft and revertpeter1997-10-151-70/+0
| | | | | | | | | | | | | back to the original single nanosleep() implementation. This is POSIX and Unix98 (aka single-unix spec v2) compliant behavior. If a program sets alarm(2) or an interval timer (setitimer(2)) without a SIGALRM handler being active, sleep(3) will no longer absorb it, and the program will get what it asked for..... :-] The original reason for this in the first place (apache) doesn't seem to need it anymore, according to Andrey. Reviewed by: ache, bde
* Back out itimerfix hack since nanosleep1 fixed nowache1997-08-131-58/+19
| | | | Handle syscalls error return slightly better
* Rearrange itimerfix loop doing it inside SIGALRM handling sectionache1997-08-121-19/+20
|
* Solve itimerfix() problem completely by using loop in 100000000 secs chunksache1997-08-121-0/+19
|
* Back out my installation of SIGALRM handler even if it is blockedache1997-08-121-19/+29
| | | | | | | and return to previous Peter's variant. POSIX says that this place is implementation defined and old variant allows application block SIGALRM and sleep and not be killed by external SIGALRMs. BTW, GNU sleep f.e. sleeps forever in blocked SIGALRM :-)
* Make itimerfix hack better: return the time we can't sleep at onceache1997-08-121-12/+20
|
* Hack^H^H^H^Hworkaround for itimerfix(9) gratuitously limiting thejoerg1997-08-101-0/+16
| | | | | | | | | acceptable range for tv_sec to the magic number 100000000 (which at least ought to be declared in a header file, and explained in the non-existing man page, as well as in the existing man pages for nanosleep(2) & Co.). PR: bin/4259
* Make sleep() and usleep() "eat" any stray SIGALRM signals during thepeter1997-07-181-25/+15
| | | | | | | | lifetime of the call, just like the old implementation did. Previously, we were only eating them if the application did not call sleep()/usleep() with SIGALRM masked. Submitted by: ache
* Re-activate the nanosleep style using code, but with the signal handlingpeter1997-06-021-53/+1
| | | | | | | | | | semantics of the old sleep for compatability with a few decades of expected side effects. Apache breaks if we just use nanosleep() for some reason, here we use a new signanosleep() syscall which is kinda like a hybrid of sigsuspend and nanosleep.. Reviewed by: ache (and tested on his apache that was failing when sleep used plain nanosleep)
* Update the sleep(3)/usleep(3) code to use signanosleep(2) if compiled withpeter1997-06-011-9/+59
| | | | | | | -DUSE_NANOSLEEP. Also, seperate the code for _THREAD_SAFE so that it uses the simpler threaded nanosleep() call in libc_r.. We don't go to the same extremes for emulating traditional sleep semantics (ie: eating any SIGALRM that might happen) which things like apache seem to depend on.
* Update the nanosleep versions to set a SIGALRM handler while sleeping.peter1997-05-181-2/+9
| | | | | This appears to appease Apache, although depending on having sleep(3) changing the SIGALRM handler is a bit bogus.
* round-up non-zero nanoseconds in #ifdef'ed code.peter1997-05-171-0/+2
|
* Allow conditional use (add -DUSE_NANOSLEEP) to CFLAGS of nanosleep() forpeter1997-05-171-19/+18
| | | | | the backend of sleep(3) and usleep(3). It's off by default until the problem is fixed.
* Temporarily restore old (itimer) sleep variant because new oneache1997-05-171-9/+70
| | | | | | | | | | | | | | | (nanosleep) breaks Apache httpd badly: his childs died quickly after number of requests (SIGPIPE). To reproduce this bug start gdb /usr/local/sbin/httpd run -X and make some bunch of concurent requests (load the server pages from 3 different places f.e.) After short time httpd dies via SIGPIPE. It never dies with old sleep.c In real life it looks like lots of broken images on the pages or missing pages. Lynx says about Network read error, etc. It seems something wrong in nanosleep signal handling.
* Use nanosleep() in all cases, not just in the reentrant libc (_THREAD_SAFE)peter1997-05-121-70/+9
| | | | version.
* ts_sec -> tv_secnate1996-09-201-3/+3
| | | | ts_nsec -> tv_nsec
* Reviewed by: julian and (hsu?)julian1996-01-221-0/+20
| | | | | | Submitted by: John Birrel(L?) changes for threadsafe operations
* Minor cleanup, mostly unused vars and missing #includes.phk1995-10-221-1/+1
|
* BSD 4.4 Lite Lib Sourcesrgrimes1994-05-271-0/+97
OpenPOWER on IntegriCloud