summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* rc: avoid problematic internal names "var", "thread"Russ Cox2020-05-181-0/+6
| | | | For AIX.
* acme: avoid global named "class"Russ Cox2020-05-181-0/+3
| | | | For AIX.
* libdiskfs: avoid problematic internal constant namesRuss Cox2020-05-182-0/+66
| | | | AIX defines some of these constants in its C header files.
* diff: rename class to fix AIXRuss Cox2020-05-181-0/+3
| | | | math.h defines a function named class on AIX.
* devdraw: use indirect impl interface in x11Gabriel Diaz2020-05-181-0/+21
|
* lib9: avoid unportable use of d_namlen in dirreadRuss Cox2020-05-181-2/+1
| | | | Fixes #395.
* devdraw: use global drawlk instead of per-clientRuss Cox2020-05-173-18/+20
| | | | Setting up for a real window system.
* devdraw: use indirect impl interfaceRuss Cox2020-05-174-30/+61
| | | | Setting up for a real window system.
* 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.
* mk: replace overlapping strcpy with memmoveRuss Cox2020-05-171-1/+2
| | | | Found by ASAN.
* lib9: use opendir/readdir to read directoriesRuss Cox2020-05-171-183/+187
| | | | | | | | | | | | | getdirentries(2) has been deprecated on macOS since 10.5 (ten releases ago). Using it requires disabling 64-bit inodes, but that in turn makes binaries incompatible with some dynamic libraries, most notably ASAN. At some point getdirentries(2) will actually be removed. For both these reasons, switch to opendir/readdir. A little clunky since we have to keep the DIR* hidden away to preserve the int fd interfaces, but it lets us remove a bunch of OS-specific code too.
* lib9: move seek into open.cRuss Cox2020-05-174-12/+7
| | | | More preparation for opendir.
* lib9: add closeRuss Cox2020-05-171-0/+7
| | | | More preparation for opendir.
* lib9: merge create, open, dirread into open.cRuss Cox2020-05-175-292/+273
| | | | Preparation for using opendir.
* fmt: adjust GCC version checkKurt H Maier2020-05-081-2/+2
| | | | atomics were added in GCC 4.9: https://gcc.gnu.org/gcc-4.9/changes.html
* all: fix #includes for AIX, add a few AIX "implementation" filesBen Huntsman2020-05-078-0/+21
|
* mk: support Big Archive Format under AIXBen Huntsman2020-05-071-0/+4
|
* all: update build scripts to fix AIX XL/C compatibilityBen Huntsman2020-05-073-2/+8
|
* fmt: disable use of stdatomic on AIX XL C and old GCCRuss Cox2020-05-071-0/+21
| | | | | | C11 is apparently too new for these systems. Fixes #55.
* rc: clean up parser levels, disallow free carats on listsRuss Cox2020-05-054-31/+37
|
* rc: allow unquoted = in command argumentsRuss Cox2020-05-042-10/+27
| | | | | | dd fans rejoice! Also helps with commands like go test -run=x.
* rc: move free carat handling into parserRuss Cox2020-05-044-74/+103
| | | | | | | | | | | | | | | | | | | | | | | | This fixes at least one shell script (printfont) that expected 'x'`{y}'z' to mean 'x'^`{y}^'z' as it now does. Before it meant: 'x'^`{y} 'z' One surprise is that adjacent lists get a free carat: (x y z)(1 2 3) is (x1 y2 z3) This doesn't affect any rc script in Plan 9 or plan9port.
* rc: move newline handling into parserRuss Cox2020-05-046-24/+67
|
* rc: add recursive descent parserRuss Cox2020-05-0413-9/+730
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old yacc-based parser is available with the -Y flag, which will probably be removed at some point. The new -D flag dumps a parse tree of the input, without executing it. This allows comparing the output of rc -D and rc -DY on different scripts to see that the two parsers behave the same. The rc paper ends by saying: It is remarkable that in the four most recent editions of the UNIX system programmer’s manual the Bourne shell grammar described in the manual page does not admit the command who|wc. This is surely an oversight, but it suggests something darker: nobody really knows what the Bourne shell’s grammar is. Even examination of the source code is little help. The parser is implemented by recursive descent, but the routines corresponding to the syntactic categories all have a flag argument that subtly changes their operation depending on the context. Rc’s parser is implemented using yacc, so I can say precisely what the grammar is. The new recursive descent parser here has no such flags. It is a straightforward translation of the yacc. The new parser will make it easier to handle free carats in more generality as well as potentially allow the use of unquoted = as a word character. Going through this exercise has highlighted a few dark corners here as well. For example, I was surprised to find that x >f | y >f x | y are different commands (the latter redirects y's output). It is similarly surprising that a=b x | y sets a during the execution of y. It is also a bit counter-intuitive x | y | z x | if(c) y | z are not both 3-phase pipelines. These are certainly not things we should change, but they are not entirely obvious from the man page description, undercutting the quoted claim a bit. On the other hand, who | wc is clearly accepted by the grammar in the manual page, and the new parser still handles that test case.
* acme: scale window bodies on resize, not including tag spaceRuss Cox2020-03-301-3/+5
| | | | This avoids reopening collapsed windows after a large vertical resize.
* libthread: fix ARM build by renaming fileNeven Sajko2020-02-111-0/+0
| | | | | | Fixes #363 Change-Id: Ic8ad5ccce3935fdf00732d78d3024b535db90447
* devdraw: fix `cmd-r` to toggle retina vs. non-retina mode on macOS (#361)Martin Palma2020-02-031-1/+1
| | | | | and not unexpectedly quitting an application. Fixes #360
* libthread: comment stack border a bit moreRuss Cox2020-01-241-4/+10
|
* acme: report close failure in Put, this time for sureRuss Cox2020-01-241-5/+5
| | | | Missed in 0b349f6f that Bterm is not closing fd.
* 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
* devdraw: abort alt sequence on window change on macOSRuss Cox2020-01-161-0/+4
| | | | Fixes #3.
* libthread: NetBSD supports pthreads, remove ancient systems in sysofiles.shDan Cross2020-01-161-8/+1
| | | | Signed-off-by: Dan Cross <cross@gajendra.net>
* malloc: remove lockingDan Cross2020-01-163-41/+3
| | | | | | | | | | | | | | | | | The issue manifests in fork: POSIX fork mandates that a fork'd process is created with a single thread. If a multithreaded program forks, and some thread was in malloc() when the fork() happened, then in the child the lock will be held but there will be no thread to release it. We assume the system malloc() must already know how to deal with this and is thread-safe, but it won't know about our custom spinlock. Judging that this is no longer necessary (the lock code was added 15 years ago) we remove it. Signed-off-by: Dan Cross <cross@gajendra.net>
* lib9: putenv wraps POSIX setenv, not legacy putenvDan Cross2020-01-161-7/+1
| | | | | | | POSIX setenv does everything that p9putenv's body, so just delegate to that. Signed-off-by: Dan Cross <cross@gajendra.net>
* devdraw: avoid deadlock in x11 resizeRuss Cox2020-01-152-0/+3
| | | | Fixes #347.
* cmd/rio: xshove: set geometry by window idNicola Girardi2020-01-151-1/+6
|
* libmach: Fix type errors in FreeBSD.cDan Cross2020-01-151-4/+4
| | | | | | | The ptrace handlers wanted to take u64int arguments, not ulong. Signed-off-by: Dan Cross <cross@gajendra.net>
* devdraw: set windowrect correctly on x11 if window gets unexpected sizeRuss Cox2020-01-151-2/+2
| | | | Fixes #54.