Commit graph

7783 commits

Author SHA1 Message Date
Sigrid f5f37ba5eb pc64: enable uartpci (thanks taw9 for testing) 2020-03-29 19:28:39 +02:00
Ori Bernstein 7ae64cec10 merge 2020-03-28 20:33:47 -07:00
Ori Bernstein 8589a591de we prefer nil over 0, make the example show it. 2020-03-28 20:32:53 -07:00
cinap_lenrek 1b8d87555a pc, pc64: ignore the 64-bit bar flag when reserving membar
a bar with bit 3 set means the bar is the low half of
a 64-bit wide bar.
2020-03-29 00:49:07 +01:00
cinap_lenrek 3c36cadefd pc: fix mp boot regression due mistake in mkfile
the previous mkfile had a sneaky hack that would use
sed to delete the first 2 lines of hex output to strip
the 32 byte long a.out header for apbootstrap and rebootcode.

use 8l -H3 flag to strip the header from the output file.
2020-03-29 00:44:09 +01:00
Sigrid 9014360921 kbd: add "repeat" file to set typematic repeat rate/delay on PS/2 keyboards 2020-03-28 15:37:48 +01:00
Alex Musolino 47e3c088c9 grep: fix handling of -b flag
Output buffering is automatically disabled when reading from stdin.
In this case, supplying the -b flag ought to be redundant.  However,
since Bflag was being XORed into the flag set - rather than simply
ORed - supplying -b would actually enable output buffering.
2020-03-26 18:24:39 +10:30
Ori Bernstein 2f67e21393 turn ptrdiff_t into a 64 bit type
while technically a 32 bit ptrdiff_t is in spec on
systems with 64 bit ponters as long as we guarantee
that individual objects are small enough, this can
confuse legitimate code, so lets fix this.
2020-03-24 14:45:15 -07:00
Ori Bernstein 0e1fec841e add intmax_t/uintmax_t as required by c99 7.18.1.5 2020-03-24 14:41:31 -07:00
Ori Bernstein 3fe2924287 evaluate #if expressions using vlong
#if expressions are expected to be evaluated using intmax_t,
according to the C99 spec, 6.10.1 p3. On plan9, intmax_t maps
to vlong.
2020-03-23 09:18:44 -07:00
Ori Bernstein 9a4b5f2e61 merge 2020-03-22 17:34:22 -07:00
Ori Bernstein a654b94db8 add va_copy macro, conforming to c99 7.15.1.2 2020-03-22 17:31:39 -07:00
Sigrid 87e437a856 update colemak kbmap, simpler version with scroll working (thanks jeremy) 2020-03-21 01:50:11 +01:00
Sigrid 3377b78cd3 add colemak kbmap (thanks Silas McCroskey) 2020-03-21 01:40:03 +01:00
Sigrid 5da2b91989 add swiss german kbmap (thanks mike) 2020-03-21 01:07:40 +01:00
Ori Bernstein 7364a96b28 bell labs is dead, man
remove the last reference from 9fs.
2020-03-20 14:12:23 -07:00
BurnZeZ aa5e86a8ca kbdfs: fix kbmapread() not accounting for reads smaller than the size of the line 2020-03-20 18:08:34 +00:00
Ori Bernstein 37b86df09f Improve the posix preprocessor.
This fixes token pasting, making it expand when
it should expand, and paste before expansion when
it should paste before expanding.

	#define CAT(a, b) a ## b
	#define BAR	3
	#define FOO	CAT(BAR, 3)
	FOO

now produces 33, while

	#define CAT(a, b) a ## b
	#define EOF	(-1)
	#define NOP(x)	x
	NOP(CAT(foo, EOF))
	CAT(,EOF)
	CAT(,)

produces

	fooEOF
	(-1)
	<empty>

respectively.
2020-03-17 22:03:25 -07:00
Ori Bernstein 52dc943702 fix ccom idempotency
ccom may be called multiple times on the same
node, via 'goto loop' calls from the commute
label, OADD, and a few other places.

Casts to void could null out the LHS of the
node, which would cause the compiler to crash
if the cast was revisited due to one of these
cases, because we tried frobbing n->left.

Now, if n->left is nil, we just return.w
2020-03-15 15:08:04 -07:00
Ori Bernstein 5bc9b0c3ca improve usage messages (thanks henesy)
Fix inconsistencies between programs and their usage
messages,  correct instances where information seems
to be missing or lost. This  includes missing arguments,
making usage consistent with manuals, and so on.
2020-03-10 10:09:34 -07:00
Ori Bernstein 06ea44c895 fix -T option for doctype
We used to set $dev to -T, and leave the device type
in the argument list. Now, we set it to -T$2, and shift
it out of the list.
2020-03-10 09:35:06 -07:00
Ori Bernstein fc90f7a666 fix heredoc crash
we emitted an error on heredoc tags, but we
continued on, and added a heredoc entry to
the list, with a tag that we couldn't handle.

when processing this heredoc, rc would segfault.

fix: don't add a heredoc to the list on error.
2020-03-09 14:24:02 -07:00
Ori Bernstein 698837e715 fix alignment in ape malloc
We used to have a padding int in the structure
after the next pointer, to align it to 16 bytes.
On 64 bit architectures, the pointer was already
8 bits, so the padding misaligned things to 20
bytes.

This fixes it so that we're explcit about the
data alignment we want, instead of hoping that
the various sizes line up.
2020-03-09 08:02:22 -07:00
Sigrid 446e454c5a sam: ^ does not need current file 2020-03-09 13:58:41 +01:00
Sigrid 290c921d1d sam(1): document $% and $%dot 2020-03-09 13:22:10 +01:00
Sigrid 27f36483d4 sam: add $%dot (thanks kvik) 2020-03-09 13:21:50 +01:00
Ori Bernstein 50791b8755 add usage messages to auth/(enable disable status).
print useful message when user invokes these commands incorrectly
(thanks henesy)
2020-03-08 16:31:30 -07:00
cinap_lenrek e9e55a21f6 lib9p: implement automatic remove-on-close cleanup in postsharesrv(), remove postfd() and sharefd() functions
with the latest changes to shr(3), we can use ORCLOSE on
the control file to get the mount in the share automatically
removed when the server exits or something goes wrong during
postsharesrv().

do not expose postfd() and sharefd() functions. they where
undocumented and leak the control file descriptors.
2020-03-08 22:00:23 +01:00
cinap_lenrek 11628e90fb merge 2020-03-08 20:55:58 +01:00
cinap_lenrek 28f3a3aad8 boorc, nusbrc: fix wrong redirections after &
the rc & operator changes stdin to /dev/null, so we
have to do the <[0=1] inside the {}

this never showed up as an issue because many
fileservers just read 9p messages from standard
output.
2020-03-08 20:53:30 +01:00
Ori Bernstein e652be5559 "": output previous action to stderr
When redirecting output from "", it prints the command
to stdout, which garbles things like:

	% foo
	<inspect output>
	% "" > /dev/snarf

Now, we send it to stderr.
2020-03-08 11:46:34 -07:00
cinap_lenrek f99b9cae6a devshr: unmount service on #σc/share/mount removal
when the control mountpoint side gets removed, close
mount channel immediately. this is usefull for implementing
automatic cleanup with ORCLOSE create mode.
2020-03-08 18:23:07 +01:00
cinap_lenrek fe39388250 nusb/usbd: cleanup processes on unmount
this makes sure that when postsharesrv() fails (for
example because the shr file already exists), the
worker process gets killed and all file descriptors
to devusb get closed.
2020-03-08 16:06:37 +01:00
cinap_lenrek 06b9aa5039 9p(2): document all the effective rfork flags for postmountsrv() 2020-03-08 15:29:32 +01:00
cinap_lenrek bc1212faf2 9p(2): document the filedescriptor sharing behaviour of postmountsrv() 2020-03-08 14:49:34 +01:00
cinap_lenrek a609c1a2f8 devproc: return process id when reading /proc/n/ctl file
allow reading the control file of a process and return
its pid number. if the process has exited, return an error.

this can be usefull as a way to test if a process is
still alive. and also makes it behave similar to
network protocol directories.

another side effect is that processes who erroneously
open the ctl file ORDWR would be allowed todo so as
along as they have write permission and the process is
not a kernel process.
2020-03-08 14:11:23 +01:00
cinap_lenrek 57741d473f games/playlistfs: open /proc/n/ctl OWRITE, not ORDWR 2020-03-08 13:13:25 +01:00
cinap_lenrek 5826140ce3 lib9p: restore previous behaviour of fd group sharing
it appears that too many fileservers rely on the fileserver
process sharing the filedescriptors with children of the
caller to postmntsrv() or threadpostmntsrv().

restoring previous behaviour for now.
2020-03-08 05:52:23 +01:00
cinap_lenrek 59fdb3a12c sshnet: fix fork race conditions
sshreadproc() needs to be started after opening the sshfd file
descriptor.

fsnetproc() needs to run in the same filedescriptor group as
the fileserver.
2020-03-08 04:54:37 +01:00
cinap_lenrek 2c53dd32b5 aux/realemu: fix exit code 2020-03-08 03:34:55 +01:00
cinap_lenrek cea9e2267a aux/realemu: run cpuproc in same fd group as fileserver 2020-03-08 03:25:35 +01:00
cinap_lenrek 7aaa481f9f aux/timesync: open /proc/n/ctl with OWRITE, not ORDWR 2020-03-08 03:12:00 +01:00
cinap_lenrek a0879abae4 devproc: don't allow /proc/$pid/ctl to be opens for reading 2020-03-07 23:58:47 +01:00
cinap_lenrek efd64da989 nusb/usbd: fix /env/usbbusy bug
run the usb hub poll "work()" proc in the same filedescriptor
group as the fileserver by forking the process in Srv.start
callback.

this also prevents the usbbusy filedescriptor from being kept
open by the fileserver process.
2020-03-07 22:26:49 +01:00
cinap_lenrek 1a1b4b54b3 rio: fix goodrect() bug (thanks mike)
mike from eff0ff.net reported the following:

> I was running a second instance of rio inside a rio window and
> suddenly weird things started happening. The second instance started
> imposing arbitrary limits on the size of its windows and refused to
> resize some of its windows when its own window was resized.
> Turns out this happens if rio's screen is 3 times as high as wide
> because of a tiny mistake in its goodrect function.

... and kindly provided a patch. thanks!
2020-03-07 20:41:46 +01:00
cinap_lenrek feb6d6f0a3 dossrv, 9660srv, hjfs: stop *READING* standard *OUTPUT* with -s flag
with the -s flag, we should read 9P messages from
standard *INPUT* (fd 0) and write responses to
standard *OUTPUT* (fd 1).

before these servers where reading from fd 1,
assuming they where both the same files.
2020-03-07 20:27:20 +01:00
cinap_lenrek 225c359bea lib9p: get rid of Srv.nopipe and Srv.leavefdsopen hacks
it is unclear how Srv.nopipe flag should work inside
postmountserv(). if a server wants to serve on stdio
descriptors, he can just call srv() after initializing
Srv.infd and Srv.outfd.

The Srv.leavefdsopen hack can be removed now that acme
win has been fixed.
2020-03-07 20:19:14 +01:00
cinap_lenrek e1cdcfdb17 acme: split win into winfs and rc script, get rid of lib9p leavefdsopen hack
split the acme win command into a winfs fileserver which
handles /dev/cons emulation and a rc script responsible
for launching the command.

with these changes, the fd fiddling is not neccesary anymore
and we can get rid of the leavefdsopen hack.
2020-03-07 20:06:55 +01:00
cinap_lenrek 022087cdcd lib9p: fix typo 2020-03-07 15:20:07 +01:00
cinap_lenrek 8f64e44854 lib9p: zero out per connection state in Srv template for listensrv()
in case listensrv() is called with a previously active Srv,
we have to make sure that per connection state is zeroed
out (locks and reference conuts).

also, dont assume anything about the Ref structure. there
might be implementations that have a spinlock in them.
2020-03-07 15:01:29 +01:00