Commit Graph

37 Commits

Author SHA1 Message Date
rillig 388550b026 lib: remove CONSTCOND comment
Since 2021-01-31, lint doesn't need it anymore for the common pattern of
'do ... while (0)'.
2022-04-19 20:32:14 +00:00
jdolecek 8e29352f70 change libc sched_yield() stub to actually still call the syscall
instead of doing nothing when app is not linked with pthread; this matches
other systems

suggested by Mateusz Guzik in:
http://mail-index.netbsd.org/tech-kern/2020/07/19/msg026620.html
2021-02-06 00:08:58 +00:00
kamil e4e4859de1 Adjust the error return value of pthread_sigmask for !libpthread usage
Instead of returning -1, return errno on error.

Catch up after the fix in libpthread by Andrew Doran in 2008
in lib/libpthread/pthread_misc.c r.1.9.

It's an open question whether this function shall be used without linked
in the POSIX thread library.

Detected by Bruno Haible (GNU) and documented in gnulib in commit
"pthread_sigmask: Avoid test failure on NetBSD 8.0. " r. 4d16a83b0c1fcb6c.
2020-01-14 18:18:59 +00:00
christos 939c050d54 Transfer all the keys that were created in the libc stub implementation
to the pthread tsd implementation when the main thread is created.
This corrects a problem where a process created keys before libpthread
was loaded (either from the libc constructor or because libpthread
was dlopened later). This fixes a problem with jemalloc which creates
keys in the constructor.
2019-03-05 01:35:52 +00:00
kamil 3b2abf0b2a Add CHECK_NOT_THREADED() in __libc_mutexattr_settype_stub()
This makes this function consistent with __libc_mutex_catchall_stub()
and others in the same group.

Approved by <christos>.
2016-10-31 18:10:11 +00:00
matt 8caf10303e Put the startup code in .text.startup 2013-08-19 22:14:37 +00:00
christos 8265b8412c mark __libc_thr_exit_stub dead here too 2013-05-28 17:29:41 +00:00
joerg eb3cdf8761 Provide stubs for pthread_detach/pthread_join. 2013-04-27 20:36:47 +00:00
joerg 5dd13d5b75 Weak alias directly to the catchall stub and don't strong alias twice. 2013-04-12 18:14:22 +00:00
christos 644dcf797e split init and errno to a separate file. No point in growing rtld 10K. 2013-04-05 20:15:42 +00:00
christos 71d484f921 - Allow libpthread to be dlopened again, by providing libc stubs to libpthread.
- Fail if the dlopened libpthread does pthread_create(). From manu@
- Discussed at length in the mailing lists; approved by core@
- This was chosen as the least intrusive patch that will provide
  the necessary functionality.
XXX: pullup to 6
2013-03-21 16:49:11 +00:00
joerg 67f518f496 Use __dead 2011-09-16 16:05:58 +00:00
explorer 7ba2798f6e Assign copyright to TNF 2009-12-01 01:33:25 +00:00
ad c984f259af Make threaded programs die correctly:
kill(getpid(), SIGFOO) -> raise(SIGFOO)
2009-01-30 23:21:02 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
christos b31749e77b add fw decl. 2007-12-14 17:06:07 +00:00
christos b76677eda5 fix obvious bogon [can't alias symbol to itself] 2007-12-14 17:04:28 +00:00
ad 4084ca7f3f Add thr_curcpu(), pthread_curcpu_np(). 2007-11-27 20:58:26 +00:00
drochner 095b25e7dd Add pthread_equal() to libc stubs; this makes a lot of sense for
threadsafe libraries implementing own locking functions.
Ride on yesterday's minor version bumps.
2007-11-14 19:28:23 +00:00
ad ec4d182d4a - stack_protector.c doesn't really belong under sys/. Add a new directory
for misc support routines and put it there.
- Add a libc constructor. Use this to initialize threading and the
  stack protector stuff. libpthread cannot be initialized safely using
  its own constructor because libc and libpthread are deeply intertwined.
  PR bin/37347
2007-11-13 15:21:19 +00:00
christos 03256c6e55 WARNS=4 2005-11-29 03:11:58 +00:00
lukem 88c3eadbfa Add missing __RCSID() 2005-06-12 05:21:25 +00:00
nathanw 9ae878eb94 Fix the __libc_thr_yield_stub() signature. 2004-12-14 00:21:40 +00:00
nathanw 50df45f4e5 The __libc_thr_yield_stub() for scched_yield() should return int (and
a 0), not void.
2004-12-13 16:07:13 +00:00
nathanw 08c663a3c0 Implement __libc_thr_sigsetmask_stub() in terms of sigprocmask(),
instead of having a dummy function.
2004-12-06 18:58:12 +00:00
nathanw d271509d77 Add a stub for setcancelstate(). 2003-07-18 21:44:38 +00:00
matt 0b61283edc Add #include <stdlib.h> for exit definition. 2003-03-01 22:11:40 +00:00
thorpej d504e2bb9c Simple TSD implementation, since some thread-safe libraries want
to use it.
2003-01-20 01:58:54 +00:00
thorpej 71b91cf442 Make thr_self() not return NULL. 2003-01-20 01:30:15 +00:00
thorpej 7dc01dbfab Add some threadlib stubs that are used by X:
* thr_create() (stub in libc aborts)
* thr_exit() (stub in libc calls exit())
* thr_yield() (stub in libc does nothing)

Also make the libc thr_self() stub not abort.

XXX Should we add thrattr_*() stubs for setting the detach-state?
2003-01-19 21:58:21 +00:00
thorpej 592409d356 Add mutexattr_init(), mutexattr_destroy(), and mutexattr_settype() (recursive
mutexes are used by the X libraries).
2003-01-19 20:46:11 +00:00
thorpej 036383cc03 Make the libc thr_once() stub functional. 2003-01-19 19:48:45 +00:00
thorpej 3fdac2b8c5 Merge the nathanw_sa branch. 2003-01-18 10:52:16 +00:00
mycroft 605490369c Delint.
Remove trailing ; from uses of __weak_alias().  The macro inserts this if
needed.
2000-01-22 22:19:07 +00:00
explorer 179a2df725 add. This holds the global __isthreaded variable, to indicate that threading
is (or is not) present.
1999-12-03 06:37:34 +00:00
explorer 7d1b0fabbc typo 1999-12-03 06:36:55 +00:00
explorer 3dde14339c add stub thread functions. These are not (yet) used, and always return
success.  They are weak-aliased, so if linked with a real pthreads library
the correct magic will happen.
1999-11-14 18:34:15 +00:00