aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/gen/usleep.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-231-2/+0
| | | | | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/ Similar commit in main: (cherry picked from commit 1d386b48a555)
* Clean up the vcs ID strings in libc's gen/ directory.John Baldwin2018-07-031-3/+1
| | | | | | | | | | | | | | | | | | | | - Move CSRG IDs into __SCCSID(). - When a file has been copied, consistently use 'From: <tag>' for strings referencing the version of the source file copied from in the license block comment. - Some of the 'From:' tags were using $FreeBSD$ that was being expanded on each checkout. Fix those to hardcode the FreeBSD tag from the file that was copied at the time of the copy. - When multiple strings are present list them in "chronological" order, so CSRG (__SCCSID) before FreeBSD (__FBSDID). If a file came from OtherBSD and contains a CSRG ID from the OtherBSD file, use the order CSRG -> OtherBSD -> FreeBSD. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D15831 Notes: svn path=/head/; revision=335898
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-1/+3
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* Renumber copyright clause 4Warner Losh2017-02-281-1/+1
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* Remove names from some prototypesCraig Rodrigues2015-09-201-1/+1
| | | | Notes: svn path=/head/; revision=288028
* Add declarations to eliminate -Wmissing-prototypes warningsCraig Rodrigues2015-09-201-0/+2
| | | | Notes: svn path=/head/; revision=288008
* Reduce the size of the interposing table and amount ofKonstantin Belousov2015-01-111-13/+5
| | | | | | | | | | | | | | | | | | | | cancellation-handling code in the libthr. Translate some syscalls into their more generic counterpart, and remove translated syscalls from the table. List of the affected syscalls: creat, open -> openat raise -> thr_kill sleep, usleep -> nanosleep pause -> sigsuspend wait, wait3, waitpid -> wait4 Suggested and reviewed by: jilles (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=277032
* Fix known issues which blow up the process after dlopen("libthr.so")Konstantin Belousov2015-01-031-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (or loading a dso linked to libthr.so into process which was not linked against threading library). - Remove libthr interposers of the libc functions, including __error(). Instead, functions calls are indirected through the interposing table, similar to how pthread stubs in libc are already done. Libc by default points either to syscall trampolines or to existing libc implementations. On libthr load, libthr rewrites the pointers to the cancellable implementations already in libthr. The interposition table is separate from pthreads stubs indirection table to not pull pthreads stubs into static binaries. - Postpone the malloc(3) internal mutexes initialization until libthr is loaded. This avoids recursion between calloc(3) and static pthread_mutex_t initialization. - Reinstall signal handlers with wrapper on libthr load. The _rtld_is_dlopened(3) is used to avoid useless calls to sigaction(2) when libthr is statically referenced from the main binary. In the process, fix openat(2), swapcontext(2) and setcontext(2) interposing. The libc symbols were exported at different versions than libthr interposers. Export both libc and libthr versions from libc now, with default set to the higher version from libthr. Remove unused and disconnected swapcontext(3) userspace implementation from libc/gen. No objections from: deischen Tested by: pho, antoine (exp-run) (previous versions) Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=276630
* Fix many "function declaration isn't a prototype" warnings in libc.Ed Schouten2009-12-051-2/+1
| | | | | | | | I've only fixed code that seems to be written by `us'. There are still many warnings like this present in resolv/, rpc/, stdtime/ and yp/. Notes: svn path=/head/; revision=200150
* Per Regents of the University of Calfornia letter, remove advertisingWarner Losh2007-01-091-4/+0
| | | | | | | | | clause. # If I've done so improperly on a file, please let me know. Notes: svn path=/head/; revision=165903
* Make usleep() overridable by the thread libraries so they can provideDaniel Eischen2005-08-031-1/+4
| | | | | | | | | cancellation points. Noticed by: phk Notes: svn path=/head/; revision=148656
* Use `useconds_t' instead of `u_int' or `unsigned int' where appropriate.Mike Barcroft2002-12-291-1/+1
| | | | Notes: svn path=/head/; revision=108380
* Fix SCM ID's.David E. O'Brien2002-02-011-4/+2
| | | | Notes: svn path=/head/; revision=90039
* Remove _THREAD_SAFE and make libc thread-safe by default byDaniel Eischen2001-01-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=71579
* Simplify sytem call renaming. Instead of _foo() <-- _libc_foo <-- foo(),Jason Evans2000-01-271-1/+1
| | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=56698
* Add three-tier symbol naming in support of POSIX thread cancellationJason Evans2000-01-121-1/+1
| | | | | | | | | 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(). Notes: svn path=/head/; revision=55837
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50476
* Don't check for the unlikely case of useconds == 0 here. The kernelBruce Evans1997-11-201-7/+4
| | | | | | | | | checks it. Fixed a style bug. Notes: svn path=/head/; revision=31310
* Back out part of OpenGroup specs about limiting max arg since it may breakAndrey A. Chernov1997-10-221-8/+3
| | | | | | | compatibility. Notes: svn path=/head/; revision=30649
* Changes in spirit of OpenGroup Singe Unix specs:Andrey A. Chernov1997-10-221-5/+11
| | | | | | | | | 1) Limit max allowed argument to 1000000 2) Change return type from void to int to indicate premature termination (by signal) Notes: svn path=/head/; revision=30646
* Add $IdAndrey A. Chernov1997-10-171-0/+4
| | | | Notes: svn path=/head/; revision=30511
* Cleanup #includesAndrey A. Chernov1997-10-161-3/+1
| | | | Notes: svn path=/head/; revision=30479
* Remove old SIGALRM absorbing back-compat code. It wasn't working at allPeter Wemm1997-10-151-83/+1
| | | | | | | | | | | | | | | | for the entire time that it was there, so obviously nothing needs it anymore. Note, unix98/single-unix spec v2 says that usleep() returns an int rather than a void, to indicate whether the entire time period elapsed (0) or an error (eg: signal handler) interrupted it (returns -1, errno = EINTR) It is probably useful to make this change but I'll test it locally first to see if this will break userland programs [much]... Reviewed by: ache, bde Notes: svn path=/head/; revision=30443
* Oops, fix logic for previous commitAndrey A. Chernov1997-08-141-5/+5
| | | | Notes: svn path=/head/; revision=28201
* Break loop if error != EINTR occurse or it can take forever withAndrey A. Chernov1997-08-141-2/+5
| | | | | | | time_remaining unchanged Notes: svn path=/head/; revision=28192
* Handle syscalls error return slightly betterAndrey A. Chernov1997-08-131-6/+12
| | | | Notes: svn path=/head/; revision=28173
* Back out my installation of SIGALRM handler even if it is blockedAndrey A. Chernov1997-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 :-) Notes: svn path=/head/; revision=28125
* 1) Make usleep() terminateable by alarm (or ualarm) as supposedAndrey A. Chernov1997-08-121-4/+8
| | | | | | | | historically 2) Fix end of time loop condition: && -> || Notes: svn path=/head/; revision=28111
* Make sleep() and usleep() "eat" any stray SIGALRM signals during thePeter Wemm1997-07-181-24/+14
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=27502
* Re-activate the nanosleep style using code, but with the signal handlingPeter Wemm1997-06-021-57/+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) Notes: svn path=/head/; revision=26385
* Update the sleep(3)/usleep(3) code to use signanosleep(2) if compiled withPeter Wemm1997-06-011-8/+58
| | | | | | | | | | -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. Notes: svn path=/head/; revision=26338
* Update the nanosleep versions to set a SIGALRM handler while sleeping.Peter Wemm1997-05-181-1/+9
| | | | | | | | This appears to appease Apache, although depending on having sleep(3) changing the SIGALRM handler is a bit bogus. Notes: svn path=/head/; revision=25890
* if nanosleep returns too early, loop. usleep() does not have a returnPeter Wemm1997-05-171-2/+7
| | | | | | | | | value, it appears as though the semantics of usleep are that it doesn't return early. (only in the nanosleep code - the setitimer code does this already) Notes: svn path=/head/; revision=25871
* Allow conditional use (add -DUSE_NANOSLEEP) to CFLAGS of nanosleep() forPeter Wemm1997-05-171-15/+15
| | | | | | | | the backend of sleep(3) and usleep(3). It's off by default until the problem is fixed. Notes: svn path=/head/; revision=25862
* Fix typo from previous commit (tsvsec --> tv_sec).Alexander Langer1996-09-231-1/+1
| | | | Notes: svn path=/head/; revision=18472
* ts_sec -> tv_secNate Williams1996-09-201-2/+2
| | | | | | | ts_nsec -> tv_nsec Notes: svn path=/head/; revision=18414
* Reviewed by: julian and (hsu?)Julian Elischer1996-01-221-1/+18
| | | | | | | | | Submitted by: John Birrel(L?) changes for threadsafe operations Notes: svn path=/head/; revision=13545
* Minor cleanup, mostly unused vars and missing #includes.Poul-Henning Kamp1995-10-221-1/+1
| | | | Notes: svn path=/head/; revision=11659
* BSD 4.4 Lite Lib SourcesRodney W. Grimes1994-05-271-0/+99
Notes: svn path=/cvs2svn/branches/unlabeled-1.1.1/; revision=1573