]> git.lizzy.rs Git - plan9front.git/log
plan9front.git
4 years ago?a: catch symb[NSYMB] buffer overflow in lexer, cleanup, assume thechar is a rune
cinap_lenrek [Sun, 19 Apr 2020 20:59:21 +0000 (22:59 +0200)]
?a: catch symb[NSYMB] buffer overflow in lexer, cleanup, assume thechar is a rune

4 years agocc: get rid of sprint() and temporary buffer for type conversion fuction
cinap_lenrek [Sun, 19 Apr 2020 18:44:19 +0000 (20:44 +0200)]
cc: get rid of sprint() and temporary buffer for type conversion fuction

slookup() copies to symb, so use the symb[NSYMB] buffer directly
to declare type conversion functions and get rid of the arbitrary
sized local buffer. replace sprint() with snprint().

4 years agolibmemdraw: remove inexistent build targets
rgl [Sun, 19 Apr 2020 13:30:58 +0000 (15:30 +0200)]
libmemdraw: remove inexistent build targets

4 years agomerge
cinap_lenrek [Sun, 19 Apr 2020 02:34:16 +0000 (04:34 +0200)]
merge

4 years ago?c: fix Bconv() misusage of strncat()
cinap_lenrek [Sun, 19 Apr 2020 02:33:07 +0000 (04:33 +0200)]
?c: fix Bconv() misusage of strncat()

4 years agofortunes: As much as I'd love to I feel I have to let it go -- rminnich
stanley lieber [Sun, 19 Apr 2020 01:37:53 +0000 (21:37 -0400)]
fortunes: As much as I'd love to I feel I have to let it go -- rminnich

4 years ago6c: conserve registers for floating point operations
cinap_lenrek [Sat, 18 Apr 2020 23:25:35 +0000 (01:25 +0200)]
6c: conserve registers for floating point operations

for floating point operations, reuse the return register
on the right hand side if it has higher complex number
than the left hand side to conserve registers.

this makes the following code compile, that was previously
run out of floating point register:

float
f(float r[15])
{
return (r[0] + (r[1] * (r[2] + r[3] * (r[4] + r[5] * (r[6] + r[7] * (r[8] + r[9] * (r[10] + r[11] * (r[12] + r[13] * r[14]))))))));
}

the downside is that this produces extra move operations.

4 years agoaux/getflags: support named flags
Ori Bernstein [Sat, 18 Apr 2020 22:38:38 +0000 (15:38 -0700)]
aux/getflags: support named flags

When using aux/getflags, it produces unnecessarily obscure
names for the flags. This allows the caller of aux/getflags
to support arbitrary names.

4 years ago7l, ql: dont assume . is in the path for running mkcname (thanks sam-d)
cinap_lenrek [Sat, 18 Apr 2020 17:07:06 +0000 (19:07 +0200)]
7l, ql: dont assume . is in the path for running mkcname (thanks sam-d)

4 years agorc: fix code serialization for PIPEFD (thanks BurnZeZ)
cinap_lenrek [Sat, 18 Apr 2020 16:20:34 +0000 (18:20 +0200)]
rc: fix code serialization for PIPEFD (thanks BurnZeZ)

BurnZeZ reported this the other day. It seems like if we have
a pipeline that looks like:

fn foo{cat < <{echo hi}}

then the '<' will get merged in /env/'fn#foo'. This change
fixes pcmd to add a space. It looks to me like this is the
only token that can get merged this way by pcmd.

4 years agoacme/win: pass on flags to winfs (fix undocumented -e flag)
cinap_lenrek [Fri, 17 Apr 2020 17:18:28 +0000 (19:18 +0200)]
acme/win: pass on flags to winfs (fix undocumented -e flag)

4 years agoip(3): remove outdated maximum ipstack number limit.
cinap_lenrek [Wed, 15 Apr 2020 16:16:22 +0000 (18:16 +0200)]
ip(3): remove outdated maximum ipstack number limit.

the maximum number of ip stacks is a implementation detail
of devip. it is 128 currently, instead of 16 as suggested
in the manpage.

4 years agodraw(3): typo dp
23hiro [Sun, 12 Apr 2020 22:33:26 +0000 (00:33 +0200)]
draw(3): typo dp

4 years agomerge
cinap_lenrek [Sun, 12 Apr 2020 14:12:41 +0000 (16:12 +0200)]
merge

4 years agokernel: remove unused mem2bl() prototype
cinap_lenrek [Sun, 12 Apr 2020 14:11:41 +0000 (16:11 +0200)]
kernel: remove unused mem2bl() prototype

4 years agomerge
Ori Bernstein [Sat, 11 Apr 2020 21:20:53 +0000 (14:20 -0700)]
merge

4 years agotriple-click to select non-whitespace segment
Ori Bernstein [Sat, 11 Apr 2020 21:19:46 +0000 (14:19 -0700)]
triple-click to select non-whitespace segment

The previous patch to plumb non-whitespace segments was
confusing due to lack of visual feedback. This removes
the empty selecton plumb behavior, and instead makes
triple clicking work to get a plumbable selection.

4 years agomerge
cinap_lenrek [Sat, 11 Apr 2020 20:37:30 +0000 (22:37 +0200)]
merge

4 years agoip/ipconfig: ignore default routes targeting ourselfs
cinap_lenrek [Sat, 11 Apr 2020 20:36:19 +0000 (22:36 +0200)]
ip/ipconfig: ignore default routes targeting ourselfs

when running ndb configuration, we might inherit the ipgw=
attribute from the ipnet pointing to our own ip address
(we are the default gateway). ignore such entries.

do not add default routes with gateway equal to our own
local (ip4) or link-local ip address (ipv6).

4 years agovt plumbing: don't require selection
Ori Bernstein [Sat, 11 Apr 2020 18:56:04 +0000 (11:56 -0700)]
vt plumbing: don't require selection

Plumbing text in vt requires selecting the text that you
want to plumb precisely. This patch makes plumbing behave
the same way that it does in rio.

4 years agoip/ipconfig: resolve ipgw to an ip address as neccesary (thanks k0ga)
cinap_lenrek [Sat, 11 Apr 2020 16:09:48 +0000 (18:09 +0200)]
ip/ipconfig: resolve ipgw to an ip address as neccesary (thanks k0ga)

ndb(6) states that ipgw needs to be an ip address,
however, attempting to resolve ipgw is not difficult
and already done by ip/dhcpd.

4 years agovl: remove unused mysbrk() prototype
cinap_lenrek [Sat, 11 Apr 2020 12:20:41 +0000 (14:20 +0200)]
vl: remove unused mysbrk() prototype

4 years agoqa: remove ALLOC() and ALLOCN() macros
cinap_lenrek [Sat, 11 Apr 2020 12:20:13 +0000 (14:20 +0200)]
qa: remove ALLOC() and ALLOCN() macros

4 years agocc: remove mysbrk(), exponentially increase gethunk() allocation delta
cinap_lenrek [Sat, 11 Apr 2020 12:19:35 +0000 (14:19 +0200)]
cc: remove mysbrk(), exponentially increase gethunk() allocation delta

mysbrk() was only used in gethunk() and should not be
called by anyone, so dont export the symbol.

simplify gethunk() using brk().

double allocation size on each call until we reach
1000*NHUNK.

use signed long for nhunk as alignment rountin might
make it negative and handle that case.

4 years ago6c: remove mystery sys.c file
cinap_lenrek [Sat, 11 Apr 2020 03:19:11 +0000 (05:19 +0200)]
6c: remove mystery sys.c file

4 years agocc, ?[acl]: fix gethunk() and move common memory allocator code to cc/compat
cinap_lenrek [Sat, 11 Apr 2020 03:03:49 +0000 (05:03 +0200)]
cc, ?[acl]: fix gethunk() and move common memory allocator code to cc/compat

for gethunk() to work, all allocators have to use it,
including allocations done by libc thru malloc(),
so the fake allocation functions are mandatory for
everyone.

to avoid duplication the code is moved to cc/compat
and prototypes provided in new cc/compat.h header.

4 years agobackout the gethunk() again, as that breaks the assemblers
cinap_lenrek [Fri, 10 Apr 2020 23:26:36 +0000 (01:26 +0200)]
backout the gethunk() again, as that breaks the assemblers

the assemblers share gethunk() cc/macbody but are compiled
without compat.c, so calls such as getenv() trigger malloc()
which does its own sbrk() calls, breaking the continuity
of the hunk.

so this change needs another revision. until then, this is
backed out.

4 years agocc, ?l: fix gethunk() to actually grow allocation
cinap_lenrek [Fri, 10 Apr 2020 21:11:25 +0000 (23:11 +0200)]
cc, ?l: fix gethunk() to actually grow allocation

the compilers and linkers use ther own memory allocator.
free memory is between hunk and hunk+nhunk. allocation
works by checking if nhunk is bigger or equal to the
amount needed, and if not, repeatedly call gethunk()
until there is. after that, the allocated amount is added
from hunk and subtracted from nhunk by the user.

the problem was when the needed amount was bigger than
the default NHUNK size gethunk() allocates per call.
gethunk() would not actually grow nhunk, but instead
just set hunk and nhunk variables to the last allocated
block. this resulted in a infinite loop of calls to
gethunk() until sbrk() would hit the maximum size for
the BSS segment.

this change makes gethunk() actually grow the hunk space,
increasing nhunk, and only updating hunk when nhunk was
previously zero. we assume that mysbrk() retuns increasing
addresses and that the space between the previous hunk+nhunk
and the new block base returned by mysbrk() is usable.

4 years agomerge
cinap_lenrek [Fri, 10 Apr 2020 20:26:37 +0000 (22:26 +0200)]
merge

4 years agocc: backout gethunk() change
cinap_lenrek [Fri, 10 Apr 2020 20:25:29 +0000 (22:25 +0200)]
cc: backout gethunk() change

the real problem is that gethunk() does not grow the allocation
but just allocates a new hunk, so repeated calls to gethunk()
wont make nhunk grow to satisfy the allocation.

this will be fixed in a upcoming commit.

4 years agocc, ?a, ?l: change thunk type to uintptr
Sigrid [Fri, 10 Apr 2020 18:38:45 +0000 (20:38 +0200)]
cc, ?a, ?l: change thunk type to uintptr

4 years agocc: sbrk in bigger chunks as it grows, so it gets a chance to use the ram/swap available
Sigrid [Fri, 10 Apr 2020 15:19:44 +0000 (17:19 +0200)]
cc: sbrk in bigger chunks as it grows, so it gets a chance to use the ram/swap available

4 years agokernel: cleanup the software mouse cursor mess
cinap_lenrek [Fri, 10 Apr 2020 15:12:51 +0000 (17:12 +0200)]
kernel: cleanup the software mouse cursor mess

The swcursor used a 32x32 image for saving/restoring
screen contents for no reason.

Add a doflush argument to swcursorhide(), so that
disabling software cursor with a double buffered
softscreen is properly hidden. The doflush parameter
should be set to 0 in all other cases as swcursordraw()
will flushes both (current and previours) locations.

Make sure swcursorinit() and swcursorhide() clear the
visibility flag, even when gscreen is nil.

Remove the cursor locking and just do everything within
the drawlock. All cursor functions such as curson(),
cursoff() and setcursor() will be called drawlock
locked. This also means &cursor can be read.

Fix devmouse cursor reads and writes. We now have the
global cursor variable that is only modified under
the drawlock. So copy under drawlock.

Move the pc software cursor implementation into vgasoft
driver, so screen.c does not need to handle it as
a special case.

Remove unused functions such as drawhasclients().

4 years agopc, pc64: remove "got unassigned irq" prints
cinap_lenrek [Thu, 9 Apr 2020 11:05:10 +0000 (13:05 +0200)]
pc, pc64: remove "got unassigned irq" prints

most pc's are multiprocessors these days, that use apic or
msi interrupts, then the irq does not matter anymore. and
uefi does not even assign irq to pci devices anymore. if
we have a problem enabling an interrupt, we will print.

4 years ago9bootpxe: simplify
cinap_lenrek [Wed, 8 Apr 2020 21:48:09 +0000 (23:48 +0200)]
9bootpxe: simplify

4 years ago9bootpxe: continues the war against random DHCPv6 DUIDs
cinap_lenrek [Wed, 8 Apr 2020 21:37:38 +0000 (23:37 +0200)]
9bootpxe: continues the war against random DHCPv6 DUIDs

Some UEFI implementations use random UUID based DUID instead of
ethernet address, but use ethernet derived link-local addresses.
So extract the MAC from our IPv6 address.

4 years ago/lib/face: add .dict entries for andrew.1 face files
Alex Musolino [Wed, 8 Apr 2020 02:22:06 +0000 (11:52 +0930)]
/lib/face: add .dict entries for andrew.1 face files

4 years agonotify(2): fix typo
Alex Musolino [Tue, 7 Apr 2020 02:44:12 +0000 (12:14 +0930)]
notify(2): fix typo

4 years agomerge
cinap_lenrek [Sun, 5 Apr 2020 23:31:35 +0000 (01:31 +0200)]
merge

4 years agopc64: remove rampage() nil check
cinap_lenrek [Sun, 5 Apr 2020 23:29:12 +0000 (01:29 +0200)]
pc64: remove rampage() nil check

rampage() never returns nil

4 years agopc: zero rampage() memory (thanks LordCreepity)
cinap_lenrek [Sun, 5 Apr 2020 23:28:34 +0000 (01:28 +0200)]
pc: zero rampage() memory (thanks LordCreepity)

memory returned by rampage() is not zeroed, so we have to
zero it ourselfs. apparently, this bug didnt show up as we
where zeroing conventional low memory before the new memory
map code. also rampage() never returns nil.

4 years agofile: try ismp4() before ismp3()
Alex Musolino [Sun, 5 Apr 2020 13:56:52 +0000 (23:26 +0930)]
file: try ismp4() before ismp3()

It is possible to find the mp3 sync word near the start of an mp4
file.  As such, file(1) could incorrectly identify some mp4s as mp3s.

4 years agodossrv: fix falloc() for >31 bit sector numbers (thanks sl)
cinap_lenrek [Sun, 5 Apr 2020 01:46:47 +0000 (03:46 +0200)]
dossrv: fix falloc() for >31 bit sector numbers (thanks sl)

4 years agonusb/usbd: fix portreset error handling
cinap_lenrek [Sun, 5 Apr 2020 01:05:06 +0000 (03:05 +0200)]
nusb/usbd: fix portreset error handling

error handling in portreset() was wrong. we called closedev()
on the device without changing the reference.

just call portdetach() when the reset fails.

4 years agonusb/audio: set frequency only when supported
cinap_lenrek [Sat, 4 Apr 2020 22:59:47 +0000 (00:59 +0200)]
nusb/audio: set frequency only when supported

before setting the sampling rate, check bit D0
"Sampling Frequency" in the audio class specific
endpoint descriptor.

4 years agomerge
cinap_lenrek [Sat, 4 Apr 2020 15:17:15 +0000 (17:17 +0200)]
merge

4 years agomtx, ppc: use proctab() to index into process table
cinap_lenrek [Sat, 4 Apr 2020 14:52:08 +0000 (16:52 +0200)]
mtx, ppc: use proctab() to index into process table

4 years agokernel: remove scheddump() comment for delay() in */fns.h
cinap_lenrek [Sat, 4 Apr 2020 14:50:37 +0000 (16:50 +0200)]
kernel: remove scheddump() comment for delay() in */fns.h

4 years agopc, pc64: new memory map code
cinap_lenrek [Sat, 4 Apr 2020 14:48:37 +0000 (16:48 +0200)]
pc, pc64: new memory map code

This replaces the memory map code for both pc and pc64
kernels with a unified implementation using the new
portable memory map code.

The main motivation is to be robust against broken
e820 memory maps by the bios and delay the Conf.mem[]
allocation after archinit(), so mp and acpi tables
can be reserved and excluded from user memory.

There are a few changes:

new memreserve() function has been added for archinit()
to reserve bios and acpi tables.

upareserve() has been replaced by upaalloc(), which now
has an address argument.

umbrwmalloc() and umbmalloc() have been replaced by
umballoc().

both upaalloc() and umballoc() return physical addresses
or -1 on error. the physical address -1 is now used as
a sentinel value instead of 0 when dealing with physical
addresses.

archmp and archacpi now always use vmap() to access
the bios tables and reserve the ranges. more overflow
checks have been added.

ramscan() has been rewritten using vmap().

to handle the population of kernel memory, pc and pc64
now have pmap() and punmap() functions to do permanent
mappings.

4 years agokernel: add portable memory map code (port/memmap.c)
cinap_lenrek [Sat, 4 Apr 2020 14:04:27 +0000 (16:04 +0200)]
kernel: add portable memory map code (port/memmap.c)

This is a generic memory map for physical addresses. Entries
can be added with memmapadd() giving a range and a type.
Ranges can be allocated and freed from the map. The code
automatically resolves overlapping ranges by type priority.

4 years agoether8390: remove unused variables
cinap_lenrek [Sat, 4 Apr 2020 13:55:48 +0000 (15:55 +0200)]
ether8390: remove unused variables

4 years agoether8003: use physical addresses for ISAConfig ether->mem
cinap_lenrek [Sat, 4 Apr 2020 13:47:50 +0000 (15:47 +0200)]
ether8003: use physical addresses for ISAConfig ether->mem

Fix the inconsistent use of ether->mem. Always use physical
addresses. Let ether8390 convert to virtual addresses using
KADDR() when we have to copy data in/out.

4 years agomerge
Alex Musolino [Wed, 1 Apr 2020 12:27:15 +0000 (22:57 +1030)]
merge

4 years agoupas/fs: fix sending of "delete" plumb messages
Alex Musolino [Wed, 1 Apr 2020 12:19:19 +0000 (22:49 +1030)]
upas/fs: fix sending of "delete" plumb messages

Broken by changeset 2cc069392228.

4 years agokbd(1): revert repeat/delay change
Sigrid [Wed, 1 Apr 2020 09:42:35 +0000 (11:42 +0200)]
kbd(1): revert repeat/delay change

4 years agodevkbd: bits bad! revert repeat/delay, better patches welcome
Sigrid [Wed, 1 Apr 2020 09:31:19 +0000 (11:31 +0200)]
devkbd: bits bad! revert repeat/delay, better patches welcome

4 years agoip/dhcp6d: work arround non-ethernet based client duid
cinap_lenrek [Tue, 31 Mar 2020 19:57:53 +0000 (21:57 +0200)]
ip/dhcp6d: work arround non-ethernet based client duid

in ndb, we use the ethernet mac to identify the client.
in dhcpv6, there is just a uniqueue device id that
might even be generated randomly. to find the ethernet
address of a client, check the duid type and only use
it when the dudid is of type 1 (link layer) or 3 (link
layer address + time) and the link layer address type
is 1 (ethernet). otherwise, assume the source ip is
a link local address and extract it from that.

this hack works for thinkpad t495, which uses random
uuid based client duid.

4 years agoaudiohda: add pci vid/did for AMD Raven HD Audio Controller (T495)
cinap_lenrek [Tue, 31 Mar 2020 17:00:32 +0000 (19:00 +0200)]
audiohda: add pci vid/did for AMD Raven HD Audio Controller (T495)

4 years agokbd(3): fix a typo (thanks Alex Musolino)
Sigrid [Tue, 31 Mar 2020 08:04:24 +0000 (10:04 +0200)]
kbd(3): fix a typo (thanks Alex Musolino)

4 years agoxen: fix rebootcode linkage
cinap_lenrek [Sun, 29 Mar 2020 20:47:42 +0000 (22:47 +0200)]
xen: fix rebootcode linkage

need to strip the a.out header, just like with the pc
kernel.

4 years agolib9p: fix re-use of root Qid when using createfile(); remove unused dirqidgen
BurnZeZ [Sun, 29 Mar 2020 17:39:30 +0000 (17:39 +0000)]
lib9p: fix re-use of root Qid when using createfile(); remove unused dirqidgen

4 years agopc64: enable uartpci (thanks taw9 for testing)
Sigrid [Sun, 29 Mar 2020 17:28:39 +0000 (19:28 +0200)]
pc64: enable uartpci (thanks taw9 for testing)

4 years agomerge
Ori Bernstein [Sun, 29 Mar 2020 03:33:47 +0000 (20:33 -0700)]
merge

4 years agowe prefer nil over 0, make the example show it.
Ori Bernstein [Sun, 29 Mar 2020 03:32:53 +0000 (20:32 -0700)]
we prefer nil over 0, make the example show it.

4 years agopc, pc64: ignore the 64-bit bar flag when reserving membar
cinap_lenrek [Sat, 28 Mar 2020 23:49:07 +0000 (00:49 +0100)]
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.

4 years agopc: fix mp boot regression due mistake in mkfile
cinap_lenrek [Sat, 28 Mar 2020 23:44:09 +0000 (00:44 +0100)]
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.

4 years agokbd: add "repeat" file to set typematic repeat rate/delay on PS/2 keyboards
Sigrid [Sat, 28 Mar 2020 14:37:48 +0000 (15:37 +0100)]
kbd: add "repeat" file to set typematic repeat rate/delay on PS/2 keyboards

4 years agogrep: fix handling of -b flag
Alex Musolino [Thu, 26 Mar 2020 07:54:39 +0000 (18:24 +1030)]
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.

4 years agoturn ptrdiff_t into a 64 bit type
Ori Bernstein [Tue, 24 Mar 2020 21:45:15 +0000 (14:45 -0700)]
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.

4 years agoadd intmax_t/uintmax_t as required by c99 7.18.1.5
Ori Bernstein [Tue, 24 Mar 2020 21:41:31 +0000 (14:41 -0700)]
add intmax_t/uintmax_t as required by c99 7.18.1.5

4 years agoevaluate #if expressions using vlong
Ori Bernstein [Mon, 23 Mar 2020 16:18:44 +0000 (09:18 -0700)]
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.

4 years agomerge
Ori Bernstein [Mon, 23 Mar 2020 00:34:22 +0000 (17:34 -0700)]
merge

4 years agoadd va_copy macro, conforming to c99 7.15.1.2
Ori Bernstein [Mon, 23 Mar 2020 00:31:39 +0000 (17:31 -0700)]
add va_copy macro, conforming to c99 7.15.1.2

4 years agoupdate colemak kbmap, simpler version with scroll working (thanks jeremy)
Sigrid [Sat, 21 Mar 2020 00:50:11 +0000 (01:50 +0100)]
update colemak kbmap, simpler version with scroll working (thanks jeremy)

4 years agoadd colemak kbmap (thanks Silas McCroskey)
Sigrid [Sat, 21 Mar 2020 00:40:03 +0000 (01:40 +0100)]
add colemak kbmap (thanks Silas McCroskey)

4 years agoadd swiss german kbmap (thanks mike)
Sigrid [Sat, 21 Mar 2020 00:07:40 +0000 (01:07 +0100)]
add swiss german kbmap (thanks mike)

4 years agobell labs is dead, man
Ori Bernstein [Fri, 20 Mar 2020 21:12:23 +0000 (14:12 -0700)]
bell labs is dead, man

remove the last reference from 9fs.

4 years agokbdfs: fix kbmapread() not accounting for reads smaller than the size of the line
BurnZeZ [Fri, 20 Mar 2020 18:08:34 +0000 (18:08 +0000)]
kbdfs: fix kbmapread() not accounting for reads smaller than the size of the line

4 years agoImprove the posix preprocessor.
Ori Bernstein [Wed, 18 Mar 2020 05:03:25 +0000 (22:03 -0700)]
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.

4 years agofix ccom idempotency
Ori Bernstein [Sun, 15 Mar 2020 22:08:04 +0000 (15:08 -0700)]
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

4 years agoimprove usage messages (thanks henesy)
Ori Bernstein [Tue, 10 Mar 2020 17:09:34 +0000 (10:09 -0700)]
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.

4 years agofix -T option for doctype
Ori Bernstein [Tue, 10 Mar 2020 16:35:06 +0000 (09:35 -0700)]
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.

4 years agofix heredoc crash
Ori Bernstein [Mon, 9 Mar 2020 21:24:02 +0000 (14:24 -0700)]
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.

4 years agofix alignment in ape malloc
Ori Bernstein [Mon, 9 Mar 2020 15:02:22 +0000 (08:02 -0700)]
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.

4 years agosam: ^ does not need current file
Sigrid [Mon, 9 Mar 2020 12:58:41 +0000 (13:58 +0100)]
sam: ^ does not need current file

4 years agosam(1): document $% and $%dot
Sigrid [Mon, 9 Mar 2020 12:22:10 +0000 (13:22 +0100)]
sam(1): document $% and $%dot

4 years agosam: add $%dot (thanks kvik)
Sigrid [Mon, 9 Mar 2020 12:21:50 +0000 (13:21 +0100)]
sam: add $%dot (thanks kvik)

4 years agoadd usage messages to auth/(enable disable status).
Ori Bernstein [Sun, 8 Mar 2020 23:31:30 +0000 (16:31 -0700)]
add usage messages to auth/(enable disable status).

print useful message when user invokes these commands incorrectly
(thanks henesy)

4 years agolib9p: implement automatic remove-on-close cleanup in postsharesrv(), remove postfd...
cinap_lenrek [Sun, 8 Mar 2020 21:00:23 +0000 (22:00 +0100)]
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.

4 years agomerge
cinap_lenrek [Sun, 8 Mar 2020 19:55:58 +0000 (20:55 +0100)]
merge

4 years agoboorc, nusbrc: fix wrong redirections after &
cinap_lenrek [Sun, 8 Mar 2020 19:53:30 +0000 (20:53 +0100)]
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.

4 years ago"": output previous action to stderr
Ori Bernstein [Sun, 8 Mar 2020 18:46:34 +0000 (11:46 -0700)]
"": 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.

4 years agodevshr: unmount service on #σc/share/mount removal
cinap_lenrek [Sun, 8 Mar 2020 17:23:07 +0000 (18:23 +0100)]
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.

4 years agonusb/usbd: cleanup processes on unmount
cinap_lenrek [Sun, 8 Mar 2020 15:06:37 +0000 (16:06 +0100)]
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.

4 years ago9p(2): document all the effective rfork flags for postmountsrv()
cinap_lenrek [Sun, 8 Mar 2020 14:29:32 +0000 (15:29 +0100)]
9p(2): document all the effective rfork flags for postmountsrv()

4 years ago9p(2): document the filedescriptor sharing behaviour of postmountsrv()
cinap_lenrek [Sun, 8 Mar 2020 13:49:34 +0000 (14:49 +0100)]
9p(2): document the filedescriptor sharing behaviour of postmountsrv()

4 years agodevproc: return process id when reading /proc/n/ctl file
cinap_lenrek [Sun, 8 Mar 2020 13:11:23 +0000 (14:11 +0100)]
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.

4 years agogames/playlistfs: open /proc/n/ctl OWRITE, not ORDWR
cinap_lenrek [Sun, 8 Mar 2020 12:13:25 +0000 (13:13 +0100)]
games/playlistfs: open /proc/n/ctl OWRITE, not ORDWR

4 years agolib9p: restore previous behaviour of fd group sharing
cinap_lenrek [Sun, 8 Mar 2020 04:52:23 +0000 (05:52 +0100)]
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.

4 years agosshnet: fix fork race conditions
cinap_lenrek [Sun, 8 Mar 2020 03:54:37 +0000 (04:54 +0100)]
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.