aboutsummaryrefslogtreecommitdiff
path: root/src/libthread
Commit message (Collapse)AuthorAgeFilesLines
* SunOS: silence some warningsDan Cross2025-07-251-1/+1
| | | | | | Give `-Wformat=0` on illumos/Solaris so that the build does not complain about `execlp` not having a sentinel (it's nil). Also fix an integer size issue when casting to a void pointer.
* libthread: remove check for LinuxThreadsDan Cross2025-07-251-15/+0
| | | | | | | | | | | libthread had code in `_pthreadinit` to test for LinuxThreads, and error if it was in use. This hasn't been relevant since Linux 2.6, and I can't imagine there are many people trying to build (recent) plan9port on systems that old. Unfortunately, this code violated aliasing rules, and compilers were complaining about it. But, since it likely hasn't had much relevance in 20ish years, we can probably just remove it.
* all: remove need for `-fcommon`Dan Cross2025-07-251-0/+1
| | | | | | | | | | Use `extern` where appropriate so that we can remove `-fcommon` on macOS and others. On macOS, `-fcommon` generates a number of linker warnings. I've tested building on macOS, Linux, FreeBSD, NetBSD, OpenBSD and illumos. I am not in a position to test on AIX or other more esoteric platforms, however.
* libthread: use setpgid instead of setpgrpAnthony Sorace2021-04-221-1/+1
|
* libthread: call setpgrp in programs that will backgroundRuss Cox2021-01-141-0/+7
| | | | | | | This fixes the 'run stats from rc; exit rc; stats dies' problem. It's unclear whether this is the right fix or whether rc should be starting all its interactive commands in their own process groups. But at least it does fix stats dying.
* libthread: drop schedlockRuss Cox2020-12-302-2/+1
| | | | Having two locks in the proc was causing deadlocks.
* libthread: simplifyRuss Cox2020-12-3021-1469/+11
| | | | | | | | Now that everything uses pthreads and pthreadperthread, can delete various conditionals, all the custom context code, and so on. Also update documents. Fixes #355.
* libthread: make pthreadperthread the defaultRuss Cox2020-12-301-1/+1
|
* libthread: fix pthreadperthread bugsRuss Cox2020-12-302-107/+187
|
* libthread: add threadmaybackgroundRuss Cox2020-12-304-7/+15
| | | | | | | | Programs that want to background themselves now need to define threadmaybackground returning 1. This avoids a confusing (to people and debuggers) extra parent process for all the threaded programs that will never want to background themselves.
* libthread: delete NetBSD special caseRuss Cox2020-12-304-465/+4
| | | | | | | I added a direct call from thread.c to pthread.c's _threadpthreadstart in May, and no one has complained about NetBSD being broken. So probably no one is using this on NetBSD at all. Make pthread the only option.
* libthread: fix use after free of first thread in each procRuss Cox2020-12-151-1/+9
| | | | | | This was causing sporadic but frequent crashes at startup in 9pserve on the new M1 Macs, correctly diagnosing a use-after-free.
* libthread: use libc functions in ucontext for macOS (#417)Xiao-Yong2020-06-153-81/+3
|
* libthread: handle spurious _procsleep wakeups, fix $LIBTHREAD handlingRuss Cox2020-05-172-6/+26
|
* libthread: add pthreadperthread mode and use under ASANRuss Cox2020-05-174-18/+120
| | | | | | | | | | | | | | | | | | ASAN can't deal with the coroutine stacks. In theory we can call into ASAN runtime to let it know about them, but ASAN still has problems with fork or exit happening from a non-system stack. Bypass all possible problems by just having a full OS thread for each libthread thread. The threads are still cooperatively scheduled within a proc (in thos mode, a group of OS threads). Setting the environment variable LIBTHREAD=pthreadperthread will enable the pthreadperthread mode, as will building with CC9FLAGS='-fsanitize=address' in $PLAN9/config. This solution is much more general than ASAN - for example if you are trying to find all the thread stacks in a reproducible crash you can use pthreadperthread mode with any debugger that knows only about OS threads.
* libthread: fix ARM build by renaming fileNeven Sajko2020-02-111-0/+0
| | | | | | Fixes #363 Change-Id: Ic8ad5ccce3935fdf00732d78d3024b535db90447
* libthread: comment stack border a bit moreRuss Cox2020-01-241-4/+10
|
* libthread: fix test deps, cleanup in mkfileRuss Cox2020-01-191-1/+4
|
* libthread: clean up sysofiles.sh a bit moreRuss Cox2020-01-191-25/+10
|
* libthread: rm OpenBSD tas implementationsRuss Cox2020-01-192-23/+1
| | | | OpenBSD is using pthreads now, so no need for tas.
* libthread: use consistent stack calculation code in makecontextRuss Cox2020-01-1911-83/+36
| | | | | | Also reduce duplication: makecontext is per-arch not per-os-arch. May fix #353.
* libthread: rm NetBSD pthread reference in sysofiles.shRuss Cox2020-01-191-1/+1
| | | | | | | | | | | | | | | | | | It may be that pthreads on NetBSD is now good enough, but the build as written (introduced in 23a2368 at my suggestion) is certainly broken, since both NetBSD.c and pthread.c define the same functions. If NetBSD does support pthreads now, then a few things should happen together: - libthread/sysofiles.sh should drop its top NetBSD case entirely - libthread/NetBSD.c should be deleted - libthread/NetBSD-*-asm.s should be deleted - include/u.h's NetBSD case should define PLAN9PORT_USING_PTHREADS and #include <pthread.h> For now, restore to less clearly broken build.
* all: remove Linux 2.4 vs 2.6 detectionRuss Cox2020-01-192-44/+3
| | | | | Linux 2.4 is dead. (The libthread code hasn't worked for Linux 2.4 for a long time.)
* libthread: remove Linux 2.4 codeRuss Cox2020-01-197-513/+462
| | | | | | | | Linux.c was for Linux 2.4 and is no longer used directly, only indirectly because NetBSD.c was a 1-line file #including Linux.c. So mv Linux.c NetBSD.c. Also rm Linux-*-asm.s which was for Linux 2.4 as well.
* libthread: rm unused sparc-ucontext.hRuss Cox2020-01-192-37/+0
| | | | More dead code.
* libthread: rm Darwin pre-11.0.0 supportRuss Cox2020-01-195-192/+0
| | | | | | Darwin 11.0.0 was Mac OS X 10.7.0 aka Lion. The previous version was Snow Leopard, which has been unsupported by Apple since February 2014.
* libthread: rm FreeBSD 4 codeRuss Cox2020-01-196-500/+52
| | | | Pretty sure FreeBSD 4 is gone now. :-)
* libthread: rm OpenBSD.cRuss Cox2020-01-191-145/+0
| | | | | This should have been deleted in 20f5692b (2012-07-14), which removed the mkfile and sysofiles.sh references to it.
* libthread: rm unused ARM (get|set)mcontext (#354)Neven Sajko2020-01-191-43/+0
| | | | | | They were just a duplicate of my(get|set)mcontext from the other assembly file, and unused from threadimpl.h. Change-Id: Id8003e5177ed9d37a7f0210037acbe55bbf7f708
* libthread: NetBSD supports pthreads, remove ancient systems in sysofiles.shDan Cross2020-01-161-8/+1
| | | | Signed-off-by: Dan Cross <cross@gajendra.net>
* libthread: use mmap to allocate OpenBSD stacksRuss Cox2020-01-146-8/+61
| | | | | | | Should fix faults on OpenBSD. Fixes #218. Fixes #226.
* libthread: fix fault in teardown of procRuss Cox2020-01-132-1/+2
| | | | Fixes #332.
* libthread: fix nbrecvul, recvul to match man page, Plan 9Russ Cox2020-01-131-2/+2
| | | | | | | They return 0 on failure, not -1. Bug introduced in my original libthread-for-Unix code. Fixes #230.
* libthread: run first thread in proc on system stackRuss Cox2020-01-123-17/+47
| | | | | | | For pthread systems that are fussy about which stack is used, this makes sure that threadmain runs on a system stack. If you only use proccreate (never threadcreate), all threads run on system stacks.
* Trivial changes: whitespace and modes.Dan Cross2020-01-1023-54/+29
| | | | | | | | | Remote whitespace at the ends of lines. Remove blank lines from the ends of files. Change modes on source files so that they are not executable. Signed-off-by: Dan Cross <cross@gajendra.net>
* libthread: add threadspawndRuss Cox2012-10-222-6/+16
| | | | | R=rsc http://codereview.appspot.com/6742064
* fix gcc 4.7 warnings (thanks Tuncer Ayaz)Russ Cox2012-10-201-2/+1
| | | | | R=rsc http://codereview.appspot.com/6744053
* openbsd updates (thanks Pascal Stumpf)Russ Cox2012-07-147-138/+80
| | | | | R=rsc http://codereview.appspot.com/6401049
* OS X PowerPC fixes (thanks Cameron Kaiser)Russ Cox2011-10-232-2/+2
|
* libthread: fix 10.5.8 build - uname says 9.8.0Russ Cox2011-10-141-1/+1
|
* libthread: Lion context routinesRuss Cox2011-10-136-3/+129
|
* build: OS X 64-bit buildRuss Cox2011-08-025-18/+27
| | | | | R=rsc http://codereview.appspot.com/4838047
* arm: build fixesRichard Miller2011-05-183-20/+17
| | | | | | | | Get p9p to build cleanly for ARM - based on suggestions from rsc and eekee, plus a final tweak from me. Tested (a bit) on sheevaplug (ubuntu jaunty), Nokia N800 (maemo 4) and Nokia N900 (maemo 5). R=rsc CC=plan9port.codebot http://codereview.appspot.com/4524056
* libthread: context switching for arm, still not completeRuss Cox2009-11-184-4/+78
|
* INSTALL: fix build on Snow LeopardRuss Cox2009-09-111-0/+3
| | | | http://codereview.appspot.com/116073
* libthread: make page work on OS XRuss Cox2009-08-172-0/+5
|
* libthread: work around gcc warning on FreeBSDRuss Cox2008-12-231-1/+1
|
* libthread: correct sysfatal handler prototypeRuss Cox2008-10-261-4/+2
|
* libthread: add proper sysfatalTim Wiess2008-07-201-0/+16
|
* libthread: abort on single-threaded lock contentionRuss Cox2008-07-091-0/+24
|