Commit graph

3814 commits

Author SHA1 Message Date
Russ Cox
1857120806 libthread: simplify
Now that everything uses pthreads and pthreadperthread,
can delete various conditionals, all the custom context code,
and so on. Also update documents.

Fixes #355.
2020-12-30 07:53:28 -05:00
Russ Cox
e68f07d46f libthread: make pthreadperthread the default 2020-12-30 00:20:26 -05:00
Russ Cox
b73633b1b4 libthread: fix pthreadperthread bugs 2020-12-30 00:15:37 -05:00
Russ Cox
b3a20a96eb libthread: add threadmaybackground
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.
2020-12-30 00:12:14 -05:00
Russ Cox
5b37d91264 libthread: delete NetBSD special case
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.
2020-12-30 00:06:35 -05:00
Russ Cox
69439fae67 9c: use -fcommon for clang
Fixes #469.
2020-12-30 00:06:35 -05:00
Russ Cox
2991442aef libthread: fix use after free of first thread in each proc
This was causing sporadic but frequent crashes at startup
in 9pserve on the new M1 Macs, correctly diagnosing a
use-after-free.
2020-12-15 00:06:03 -05:00
Russ Cox
a012d17433 time: print 1s of milliseconds 2020-12-15 00:06:03 -05:00
Anthony Sorace
291f741178 9c, 9l: updates for macOS arm64. 2020-09-27 06:45:02 -04:00
Russ Cox
1f098efb73 all: a few more #define tricks for AIX
This should make the AIX build finally work.

Fixes #400.
2020-08-15 20:46:23 -04:00
Russ Cox
d32deab17b tmac: rename IM (italic manual) to MR (manual reference)
Suggested by G. Brandon Robinson.
2020-08-15 20:09:40 -04:00
Russ Cox
9843fc0d82 fontsrv: fix handling of colored glyphs (emoji)
Drawing as white on black to produce a mask only works if
the white on black is the inversion of black on white.
Emoji that force use of specific colors don't respect that.
Draw black on white and invert to mask separately.
2020-08-15 09:10:54 -04:00
Russ Cox
977b25a76a tmac: introduce real manual reference macro instead of overloading IR
The overloading of IR emits magic \X'...' sequences that turn into HTML manual links.
But not all such IR invocations should be manual links;
those had to be written to avoid the IR macro before.
Worse, the \X'...' ending the IR causes troff to emit only a single space after a period.

Defining a new IM macro for manual references fixes both problems.

Fixes #441.
2020-08-13 23:43:43 -04:00
James Cook
a1c4307800 touch: fix for OpenBSD.
This fixes https://github.com/9fans/plan9port/issues/436

This doesn't necessarily address the underlying issue: calling p9create with
mode = OREAD should probably be allowed, but currently doesn't work on
OpenBSD.
2020-08-08 12:11:37 -04:00
Russ Cox
dd7c4e5104 fontsrv(4): update man page for size of fontsrv subfonts
Fixes #432.
2020-07-22 20:03:55 -04:00
Igor Böhm
afa34a73a9
devdraw, libdraw: fix memory leaks by freeing getns() malloced string (#431) 2020-07-22 14:59:58 -04:00
Russ Cox
057d8a76a9 acme: add font control message 2020-07-18 21:54:06 -04:00
Russ Cox
951446a774 draw: use int for Cacheinfo x field
With very large fonts (72pt or so) I see bad cache glyphs,
and this fixes it. Not entirely sure exactly which code
is overflowing, but something is.
2020-07-18 19:51:24 -04:00
Russ Cox
95ab1308b4 src/cmd: rm dformat
Unclear why it is here (wkj added it long ago).
It has never been installed into $PLAN9/bin,
so it's doubtful that anyone has ever used it.

Arnold Robbins has an alternate version at
https://github.com/arnoldrobbins/dformat.

Fixes #421.
2020-06-22 11:22:27 -04:00
Xiao-Yong
329831171d
libthread: use libc functions in ucontext for macOS (#417) 2020-06-15 23:18:03 -04:00
Gregor Best
c3d31baca0
fontsrv: fix compilation on X11 (#420) 2020-06-04 13:55:26 -04:00
Russ Cox
799f330f6d osxvers: use swvers -productVersion to skip one awk call
Fixes #406. Suggested by nms42.
2020-05-30 06:36:14 -04:00
Russ Cox
01b5056135 ed(1): fix documentation for list mode
I changed from 6 to 8 digits but forgot to update the man page.
2020-05-29 21:43:10 -04:00
sean
95220bf887 ed: handle Unicode beyond the BMP correctly in list mode.
List mode was constrained to the BMP. This change introduces
the following new list mode convention, using Go string literal syntax:

Non-printing ASCII characters display as \xhh.
Non-ASCII characters in the BMP display as \uhhhh.
Characters beyond the BMP display as \Uhhhhhhhh.
2020-05-29 21:42:23 -04:00
Russ Cox
3850e6e177 devdraw: accept 5- and 6-byte Unicode hex values
Alt X 1234 for U+1234
Alt X X 12345 for U+12345
Alt X X X 103456 for U+103456.
2020-05-29 21:28:59 -04:00
dzklaim
2c70acc3ab
fontsrv: scale f->originy to match f->height on x11
Co-authored-by: dzklaim <smmoth.rp@gmail.com>
2020-05-29 21:02:10 -04:00
Russ Cox
5f0fa185d0 fontsrv: handle non-BMP runes on X11
Have to adjust algorithms to deal with
much larger number of subfont files as well.
2020-05-29 20:58:37 -04:00
Russ Cox
a6ad39aaaa libdraw: handle larger number of subfonts 2020-05-29 20:58:37 -04:00
Russ Cox
bfe4377e40 man: update man pages to say $HOME when accurate
Fixes #386.
2020-05-18 23:51:35 -04:00
Russ Cox
d25d0ca1a3 devdraw, libdraw: handle keyboard runes > U+FFFF
Runes in Plan 9 were limited to the 16-bit BMP when I drew up
the RPC protocol between graphical programs and devdraw
a long time ago. Now that they can be 32-bit, use a 32-bit wire
encoding too. A new message number to avoid problems with
other clients (like 9fans.net/go).

Add keyboard shortcut alt : , for U+1F602, face with tears of joy,
to test that it all works.
2020-05-18 23:45:03 -04:00
Russ Cox
b4cc38f943 build: drop _XOPEN_SOURCE in u.h on AIX 2020-05-18 22:58:09 -04:00
Russ Cox
6c1235d234 build: use installbsd instead of install on AIX
Even in mkmk.sh.
2020-05-18 22:46:42 -04:00
Russ Cox
fa157263c8 9c: fix tab 2020-05-18 22:38:54 -04:00
Ben Huntsman
53bf1f1ccf 9l: xlc_r automatically adds -lpthread. 2020-05-18 22:36:53 -04:00
Ben Huntsman
7a371bf936 lib9: use __builtin_return_address on IBM XL/C 2020-05-18 22:36:17 -04:00
Russ Cox
20c841bac1 rc: avoid problematic internal names "var", "thread"
For AIX.
2020-05-18 22:35:17 -04:00
Russ Cox
dea4dbdba6 acme: avoid global named "class"
For AIX.
2020-05-18 22:35:17 -04:00
Russ Cox
079f5e9445 libdiskfs: avoid problematic internal constant names
AIX defines some of these constants in its C header files.
2020-05-18 22:35:17 -04:00
Russ Cox
d4a4b66a40 diff: rename class to fix AIX
math.h defines a function named class on AIX.
2020-05-18 21:41:35 -04:00
Gabriel Diaz
84167be4ad devdraw: use indirect impl interface in x11 2020-05-18 17:07:25 -04:00
Russ Cox
c53ad837a7 lib9: avoid unportable use of d_namlen in dirread
Fixes #395.
2020-05-18 17:04:36 -04:00
Russ Cox
587933c161 devdraw: use global drawlk instead of per-client
Setting up for a real window system.
2020-05-17 23:24:29 -04:00
Russ Cox
94d381ec9d devdraw: use indirect impl interface
Setting up for a real window system.
2020-05-17 23:19:24 -04:00
Russ Cox
162d0d5cd9 libthread: handle spurious _procsleep wakeups, fix $LIBTHREAD handling 2020-05-17 23:18:33 -04:00
Russ Cox
baef953da2 libthread: add pthreadperthread mode and use under ASAN
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.
2020-05-17 20:15:41 -04:00
Russ Cox
06687f70ba INSTALL: build mk all the time
If mk gets into a bad state, it's not obvious that you can
remove the binary to force the rebuild. Also, not rebuilding
means that bugs in mkmk.sh are not noticed.
Just rebuild from scratch every time. It doesn't take too long
compared to the rest of INSTALL.
2020-05-17 20:15:41 -04:00
Russ Cox
9444b8e4bc 9c, 9l: accept CC9FLAGS from config
Also, if CC9FLAGS includes -fsanitize=address (ASAN),
predefine PLAN9PORT_ASAN for use by programs that need
to know (mainly libthread).

The 9c script used to have a variable called ngflags, which
was ccflags except -g (ng stood for "no g"), but nothing needs
it split out anymore, so simplify to just ccflags.
2020-05-17 20:15:41 -04:00
Russ Cox
154140a22b mk: replace overlapping strcpy with memmove
Found by ASAN.
2020-05-17 20:15:41 -04:00
Russ Cox
8cb7308f3a lib9: use opendir/readdir to read directories
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.
2020-05-17 20:15:41 -04:00
Russ Cox
16f60479e1 lib9: move seek into open.c
More preparation for opendir.
2020-05-17 20:15:41 -04:00