Commit graph

7241 commits

Author SHA1 Message Date
cinap_lenrek
fc2a3496fe upas/fs: wait until the index becomes unlocked
For big mailboxes with imap4d, ignoring the index and trying to scan
the mailbox concurrently is not very productive. Just wait for the
other upas/fs to write the whole index.

The issue is that imap might time out and make another connection
spawning even more upas/fs instances that all then try to rebuild
the index concurrently.
2020-07-05 21:15:55 +02:00
cinap_lenrek
786ec28b7b upas/fs: fix wrong nparts field index (changed in previous commit) 2020-07-05 19:51:59 +02:00
cinap_lenrek
e844c77845 nedmail: don't try to shoot down subcommand on interrupt
this breaks interrupt key handling in rio. theres also no
point in trying todo so as rio sends the note to the whole
process group so the subcommand should have got the note
already.

just wait for the subprocess to terminate.
2020-07-05 18:17:20 +02:00
cinap_lenrek
43e56e26de upas/fs: put date822 into the index, fix from and replyto handling
the date, from and replyto fields where unstable, in that the value
read depended on the state of the cache.

fixing the from and replyto fields is easy, we just handle the
substitution in parsebody().

the date field however requires us to put the date822 into the index
so it can be recovered without requiering to reparse the header
(and body, as we might have a message/rfc822 message with promoted
fields).

with these changes, the fields will be consistent and independnet
of the cache state.

a small optimization also has been added:

after parsing the body, attachments and substitution of from/replyto,
the boundary and unixfrom strings are not needed anymore and can
be freed early.
2020-07-05 17:44:32 +02:00
cinap_lenrek
e161f1c8ba upas/fs: fix memory leak in ref822() 2020-07-05 17:05:49 +02:00
Ori Bernstein
a71450412a imap4d: respect errors from read(), remove debug prints
When read() failed, we were casting the -1 return to
unsigned, which would cause us to index out of bounds.
found using dovecot imap test suite. While we're here,
let's remove the stray debug prints.
2020-07-03 11:29:45 -07:00
Alex Musolino
a3a4f5c3e3 kbdfs/mklatin: allow >16 bit runes in /lib/keyboard 2020-07-03 22:14:49 +09:30
cinap_lenrek
03852d9408 bcm64: increase maximum segment size to 8GB
make it possible for one process to use all
of physical memory.
2020-07-03 01:17:38 +02:00
cinap_lenrek
91994dc5d8 bcm64: handle 8GB of physical memory for raspberry pi4
widen and move the KMAP window to a new address so we can
handle the 8GB of physical memory of the new raspberry pi4.

the new memory map on pi4 uses the following 4 banks:

0x000000000	0x03e600000
0x040000000	0x0fc000000 <- soc.dramsize (only < 4GB)
0x100000000	0x180000000
0x180000000 0x200000000
2020-07-02 21:12:40 +02:00
cinap_lenrek
bd23963c8f bcm64: fix usb xhci controller on pi4 8GB variant (thanks richard miller)
On the 8GB variant of the raspberry pi 4,
the eeprom chip for the xhci controller is missing and
instead loaded from sdram (by the gpu firmware).

for this, the gpu firmware needs to be notified of
the xhci controllers pci bus address (after reset)
that was assigned by our pci enumeration code.
2020-07-02 21:04:01 +02:00
cinap_lenrek
91c277a724 merge 2020-06-29 00:24:45 +02:00
cinap_lenrek
85132f197b upas/fs: move unixheader handling to parseheaders()
parsing the unixheader in mdir fetch routine is the wrong place,
as no invalid character handling has been performed yet. also
the string is not neccesarily null terminated.

avoid duplication with plan9 mbox parsing and just do it in
parseheaders(), which already handles faking the unix headers
for pop3 and imap.
2020-06-29 00:23:37 +02:00
kvik
359362395f graphics(2): fix typo 2020-06-28 23:45:18 +02:00
cinap_lenrek
30ab804b58 kernel: segflush() needs to flush tlb of other processes
instruction cache maintenance is done on tlb miss;
when a page gets fauled in; with putmmu() checking
the page->txtflush cpu bitmap.

syssegflush() used to only call flushmmu() after
segflush() for the calling process, but when a segment
is shared with other processes, we have to flush the
other processes tlb as well.

this adds the missing procflushseg() call into segflush().

note that procflushseg() leaves the calling process alone,
so the flushmmu() call in syssegflush() is still required.

segmentioproc() does not need to call flushmmu() after
segflush() as it is never going to jump to the modified
page, hence the stale icache does not matter.
2020-06-28 16:26:59 +02:00
cinap_lenrek
675ebaeca3 aux/trampoline: Implement inactivity timeout (-t option)
Using aux/trampoline to relay udp traffic needs a inactivity
timeout to be practical as there is no explicit connection
termination.
2020-06-27 16:40:53 +02:00
kvik
f0ea4af5ef 9p(2): fix typo 2020-06-25 23:23:23 +02:00
cinap_lenrek
739bb1a06f upas/fs: remove now unused Mtrunc mimeflags constant 2020-06-24 19:21:47 +02:00
cinap_lenrek
d7613e356c upas/fs: use memchr() instead of strchr() in hdrlen()
make sure we look for the end of the header within the
pointer range, and not accidentally read beyond hend.

also, messages are not null terminated, so this could
even go beyond the email data buffer.

get rid of mimeflag which was only used for some assert
checks.

take header length into account when comparing header
against ignored header strings.
2020-06-24 19:18:37 +02:00
cinap_lenrek
1e8eb61a37 merge 2020-06-24 18:47:03 +02:00
cinap_lenrek
b33773def8 ip/tinc: run script sub-shell in its own environment 2020-06-24 18:45:58 +02:00
Alex Musolino
200c18bc15 upas/marshal: make attachment failure fatal 2020-06-22 16:34:31 +09:30
cinap_lenrek
55d8082842 usbxhci: implement isochronous in transfers (for webcam, audio recording) 2020-06-21 21:42:13 +02:00
cinap_lenrek
4fb65ae3e8 devusb: keep isochronous ep->hz consistent with maxpkt, ntds and pollival
The sample frequency is an artificial parameter used for
isochronous out transfers to better match the target
frequency (usually, a sound card).

when hz is set, devusb adjusts the endpoint's maxpkt to get
the requested frequency and a multiple of the samplesize per
packet.

however, when hz is not set, then we should calculate the
frequency from maxpkt, ntds and pollival, so all parameters
will be consistent with each other.
2020-06-21 21:36:50 +02:00
Alex Musolino
78a6eb52c8 abaco: add fonts.h to HFILES in mkfile (thanks eekee) 2020-06-21 19:34:54 +09:30
cinap_lenrek
7c3477cb61 ip/torrent: fix size check in 64-bit "v" unpack (thanks pr) 2020-06-19 20:19:57 +02:00
Alex Musolino
86a77e5088 cifsd(8): fix typo (thanks senthil) 2020-06-18 12:11:06 +09:30
cinap_lenrek
febe84af75 libc: revert date change again. this is getting ridicuoulus.
this breaks the sample from the seconds manpage, and overall
produces funky results. this needs alot more testing.

term% seconds '23 may 2011'
seconds: tmparse: invalid date 23 may 2011 near 'may 2011'

term% seconds '2019-01-01 00:00:00'
-118370073600
2020-06-15 00:12:57 +02:00
Ori Bernstein
8b3efcfc4e libc, seconds: new time and date apis (try 2)
Redo date handling in libc almost entirely. This allows
handling dates and times from outside your timezones,
fixes timezone loading in multithreaded applications,
and allows parsing and formatting using custom format
strings.

As a test of the APIs, we replace the formatting code in
seconds(1), shrinking it massively.

The last commit missed a few removals, and made it
unnecessarily hard to do an update.
2020-06-14 09:33:32 -07:00
cinap_lenrek
f380851ddb libc: reverting previous change until ori can fix it 2020-06-14 04:47:22 +02:00
Ori Bernstein
e2ee991490 libc, seconds: new time and date apis.
Redo date handling in libc almost entirely. This allows
handling dates and times from outside your timezones,
fixes timezone loading in multithreaded applications,
and allows parsing and formatting using custom format
strings.

As a test of the APIs, we replace the formatting code in
seconds(1), shrinking it massively.
2020-06-13 12:38:49 -07:00
cinap_lenrek
8ffcc91b1b merge 2020-06-12 01:36:50 +02:00
cinap_lenrek
ac6cb9af29 ramfs: make Elocked[] more consistent (thanks fazlul)
Go expects the error to be one of the three errors returned in
Bell Labs Plan 9. As listed in
f7ba82d68f/src/cmd/go/internal/lockedfile/lockedfile_plan9.go (L16):

	// Opening an exclusive-use file returns an error.
	// The expected error strings are:
	//
	//  - "open/create -- file is locked" (cwfs, kfs)
	//  - "exclusive lock" (fossil)
	//  - "exclusive use file already open" (ramfs)
	var lockedErrStrings = [...]string{
		"file is locked",
		"exclusive lock",
		"exclusive use file already open",
	}
2020-06-12 01:35:37 +02:00
kvik
57362e0c8c acme: implement position-dependent scroll-wheel scrolling
This brings acme scrolling behaviour in line with that of 9front's rio
and sam, where the amount scrolled varies with a vertical position of
the pointer within the window, similar to how the scrollbar works.

At some point it would be good to implement a line-at-a-time scrolling
when the Shift key is pressed, as seen in rio.  For this to happen the
acme keyboard input needs to be rewritten in terms of /dev/kbd instead
of relying on keyboard(2) -- that is, the /dev/cons interface.
2020-06-11 15:33:57 +02:00
Ori Bernstein
db6e26d55e libplumb: add missing mkfile 2020-06-09 12:23:24 -07:00
Ori Bernstein
ebb9acecdd acme: document log file in manpage 2020-06-07 08:27:36 -07:00
cinap_lenrek
7c8d75a309 acme: add missing logf.c 2020-06-07 17:06:33 +02:00
cinap_lenrek
29fee6a8ed ip/6in4: request ipv4 packets only in ipmux filter 2020-06-07 16:56:54 +02:00
cinap_lenrek
5474646164 devip: implement ipv6 support in ipmux packet filter
Added a ver= field to the filter to distinguish the ip version.
By default, a filter is parsed as ipv6, and after parsing
proto, src and dst fields are converted to ipv4. When no
ver= field is specified, a ip version filter is implicitely
added and both protocols are parsed.

This change also gets rid of the fast compare types as the
filed might not be aligned correctly in the packet.

This also fixes the ifc= filter, as we have to check any
local address.
2020-06-07 16:56:01 +02:00
cinap_lenrek
8f087e019f snoopy: add ipmux pseudo protocol
the ipmux pseudo protocol handles the extra ipv6 interface address
prefixed to the ip header as used by /net/ipmux packet filter.
2020-06-07 16:48:04 +02:00
cinap_lenrek
85ffa283f6 devip: fix parseipmask() prototype in ip.h 2020-06-07 16:45:55 +02:00
Ori Bernstein
d2be4787c6 acme: import event log from plan9port (thanks fshahriar)
Based off the following 3 commits:

	4a3fb87264f8bc03fc62f00ef335056f30d18023
	45f8ba54143323f08a21343633764caa59aa3ea3
	fdf6ef333705c844bcf3ccf2f93b2773f1a6aa41

Reading /mnt/acme/log reports a log of window create,
put, focus, and delete events, as they happen. It blocks
until the next event is available.

Example log output:

	8 new /Users/rsc/foo.go
	8 put /Users/rsc/foo.go
	8 del /Users/rsc/foo.go

This lets acme-aware programs react to file writes, for example
compiling code, running a test, or updating an import block.
2020-06-06 19:05:00 -07:00
cinap_lenrek
e46000f076 devip: pick less surprising interface address in header for incoming UDP packets
We used to just return the first address of the incoming
interface regardless of if the address matches the source
ip type and scope.

This change tries to find the best interface address that
will match the source ip so it can be used as a source
address when replying to the packet.
2020-06-06 23:46:01 +02:00
cinap_lenrek
1a5dafcc3d merge 2020-06-06 16:52:01 +02:00
cinap_lenrek
301148756e aux/vga: use 64-bit physical addresses for pci membar 2020-06-06 16:44:14 +02:00
cinap_lenrek
4c8d2b0ebf devlml: use 64-bit physical addresses 2020-06-06 16:31:39 +02:00
cinap_lenrek
7db23bb2f0 audiosb16: cleanup audioprobe(), cast ISAConf.port to ulong 2020-06-06 16:31:07 +02:00
cinap_lenrek
652508728d audioac97: use 64-bit physical addresses 2020-06-06 16:25:00 +02:00
cinap_lenrek
966cf77439 audiohda: use 64-bit physical addresses, check pci membar types 2020-06-06 16:23:58 +02:00
cinap_lenrek
aff63ef284 pc/pcmciamodem: cast i/o port to ulong 2020-06-06 16:21:42 +02:00
cinap_lenrek
7347012d42 pc/pmmc: check pci membar type 2020-06-06 16:19:25 +02:00
cinap_lenrek
e49d187dff uartaxp: use 64-bit physical addresses and check pci membar types 2020-06-06 16:18:52 +02:00
cinap_lenrek
403fef45c1 pc/wavelan: print Ether.port as 64-bit value 2020-06-06 16:18:06 +02:00
cinap_lenrek
13963cd5e0 sd53c8xx: use 64-bit physical addresses 2020-06-06 16:16:48 +02:00
cinap_lenrek
8003f4f00f sdmv50xx: use 64-bit physical addresses and check pci membar type 2020-06-06 16:16:03 +02:00
cinap_lenrek
15e90cedc1 sdiahci: use 64-bit physical addresses 2020-06-06 16:14:58 +02:00
cinap_lenrek
caf8df6478 sdodin: use 64-bit physical addresses and check pci membar type 2020-06-06 16:14:02 +02:00
cinap_lenrek
2907f7ffc4 sdnvme: make sure pci membar type is memory 2020-06-06 16:10:58 +02:00
cinap_lenrek
dd2d6c9430 usbuhci: make sure pci membar type is i/o 2020-06-06 16:10:04 +02:00
cinap_lenrek
a3626a6efa usbehcipc: use 64-bit physical addresses and check pci membar type 2020-06-06 16:05:40 +02:00
cinap_lenrek
8243b6600f pc/ether*: use 64-bit physical addresses and check pci membar types and sizes 2020-06-06 16:04:24 +02:00
cinap_lenrek
3bebd3f5e2 pc/vga*: use 64-bit physical addresses and check pci membar types and sizes 2020-06-06 15:58:18 +02:00
cinap_lenrek
a8f64e53fe archacpi: use 64-bit uvlong for physical addresses 2020-06-06 15:44:17 +02:00
cinap_lenrek
6184a4ef2e devvga: use 64-bit physical addresses for framebuffer 2020-06-06 15:23:50 +02:00
cinap_lenrek
182e18ecff devpccard: use 64-bit physical addresses 2020-06-06 15:21:27 +02:00
cinap_lenrek
4eeaedbcaf usbxhci: use 64-bit physical addresses 2020-06-06 15:18:18 +02:00
cinap_lenrek
b6becc7a64 devpnp, devether, devusb: cast ISAConf.port to uvlong (for 32-bit implementations)
The ISAConf.port might still be 32-bit on some archs.
2020-06-06 15:17:08 +02:00
cinap_lenrek
6ae50ce330 devusb: print Hci.port as 64-bit uvlong 2020-06-06 15:12:50 +02:00
cinap_lenrek
d4213dbce5 devether: print Ether.port as 64-bit uvlong 2020-06-06 15:11:56 +02:00
cinap_lenrek
0a96d33a1c devpnp: print pci membar as 64-bit uvlong 2020-06-06 15:10:23 +02:00
cinap_lenrek
7bf5c61ea5 bcm64: bring pci code in line with the pc/pc64 2020-06-06 15:06:07 +02:00
cinap_lenrek
142bb6d5cf bcm64: use uvlong for ISAConf.port 2020-06-06 15:01:56 +02:00
cinap_lenrek
c7d9da8f5a bcm64: use 64-bit uvlong physical address in vmap() 2020-06-06 15:01:20 +02:00
cinap_lenrek
3bcc34f276 pc, pc64: implement 64-bit pci membar support 2020-06-06 14:58:20 +02:00
cinap_lenrek
93f6ce24f4 pc, pc64: use 64-bit physical addresses for ISAConf.port 2020-06-06 14:52:16 +02:00
cinap_lenrek
21e4d88a51 pc, pc64: use 64-bit physical addresses for vmap() and upaalloc() 2020-06-06 14:43:24 +02:00
Ori Bernstein
702bb7a508 ape: add missing rerrstr.c 2020-06-05 18:52:22 -07:00
Ori Bernstein
f08e95cd93 ape: make libplumb available under ape.
This adds the mkfiles and plumb.h to ape,
similar to how libdraw is made available.
This is used for ports such as netsurf.
2020-06-05 11:28:47 -07:00
Ori Bernstein
2327b48d77 aux/getflags: fix named rune arguments.
Flags can be runes. That means that we can't just
look at p[1] to decide if we have a named argument,
we need to look one rune forward. This change
does that.
2020-06-04 11:41:03 -07:00
cinap_lenrek
5f3e72eb84 merge 2020-06-01 00:07:01 +02:00
kvik
8918bd5981 acme: implement 'scratch' ctl command (thanks Drew DeVault)
The new command marks the target window as a scratch window -- a window
whose state cannot be "dirtied" by changes made to its body, therefore
avoiding warnings about unsaved changes when deleting the window or
exiting acme.

Existing examples of scratch windows are error, directory, and guide
windows, whose scratchness is set internally.

With the new command users and programs alike can create their own
scratch windows.  This is put to use in acme's own win(1).
2020-05-31 22:39:46 +02:00
cinap_lenrek
94916808dd kernel: remove unused segment argument in freepte() 2020-05-31 17:25:16 +02:00
cinap_lenrek
30bf1c45ca pc, xen: make PAT support optional (for xen) 2020-05-31 14:32:19 +02:00
Ori Bernstein
5cd7f7b0ec ape/libdraw: add missing eenter (thanks phil9) 2020-05-30 10:06:21 -07:00
cinap_lenrek
07a1df8c3a imap4d: reject invalid month in date2tm() 2020-05-30 13:03:05 +02:00
cinap_lenrek
a48b462e44 rc: avoid forking for final command that has variable assignments (to get $apid right)
basically, we want the following commands to print
the same pid twice:

rc -c 'cat /dev/pid &;echo $apid'

vs:

rc -c 'a=1 cat /dev/pid &;echo $apid'

basically, Xsimple() calls exitnext() to determine if
a simple command should be promoted to exec, by peeking
ahead into the code and searching for Xexit instruction.

Xexit might not follow immediately after the Xsimple
instruction because of redirections, which exitnext()
would skip.

but it would not skip the Xunlocal instructions that
where added by the variable assignment.
2020-05-30 02:03:18 +02:00
cinap_lenrek
0e97c8d1d7 ip/cifsd: add FIND_FIRST2 SMB_FIND_FILE_FULL_DIRECTORY_INFO info level 2020-05-27 00:09:46 +02:00
cinap_lenrek
b72af6a27d sshnet: prevent ssh process from keeping the mount alive 2020-05-26 21:37:25 +02:00
cinap_lenrek
153fcabb00 pc, pc64: fix wrong mtrr physmask() for machines without extended address size msr 2020-05-24 17:50:37 +02:00
cinap_lenrek
9960a125a3 awk: fix race condition with sub-mk in mkfile
the maketab helper program was generated in parallel, which
had a dependency to y.tab.h which lead to yacc running
twice in parallel.

this removes the dependency to y.tab.h in the virtual
maketab.$objtype target to prevent this race condition.

the dependency to y.tab.h is resolved in the main mk at the
$cputype.maketab target which serializes with the other
targets.
2020-05-24 16:00:45 +02:00
cinap_lenrek
f59101231a usbehci: release ctlr ilock before calling pollcheck() 2020-05-24 02:43:21 +02:00
cinap_lenrek
9b28790494 merge 2020-05-24 02:12:47 +02:00
cinap_lenrek
3869d7a843 usbehci: avoid kproc() while holding poll lock 2020-05-24 02:11:37 +02:00
cinap_lenrek
e06f8e061a man(9): remove accidentally commited indices 2020-05-24 00:26:11 +02:00
cinap_lenrek
81918373d2 merge 2020-05-23 23:32:24 +02:00
cinap_lenrek
a54804ed24 ip/tinc: accept udp connection from any udp source port
the remote host might be behind a NAT which translates the
source port, so if no host could be found, lookup the ip
address only.
2020-05-23 23:31:11 +02:00
Sigrid
a8e4b50cb2 paint: change colors in the palette with button 3 2020-05-23 20:41:20 +02:00
cinap_lenrek
ec737b6a2e libaml: implement ToDecimalString and ToHexString operations 2020-05-23 17:44:30 +02:00
cinap_lenrek
b86bb35c7d pc, pc64: do page attribute table (PAT) init early in cpuidentify()
the page attribute table was initialized in mmuinit(), which is
too late for bootscreen(). So now we check for PAT support and
insert the write-combine entry early in cpuidentify().

this might have been the cause of some slow EFI framebuffers on
machines with overlapping or insufficient MTRR entries.
2020-05-22 23:58:24 +02:00
cinap_lenrek
0002fd0cf7 libc/arm64: work arround linker bug for cas()
at the _cas0 label, the linker would generate spurious stack
adjustment before the return:

atexitdont+0x84 0x000000000003614c	CLREX	$0xf
atexitdont+0x88 0x0000000000036150	MOVW	R31,R0
atexitdont+0x8c 0x0000000000036154	MOV	(SP)16!,R30 <- ????????????
atexitdont+0x90 0x0000000000036158	RETURN

the work arround is to move the code into its own cas0
text symbol.

this fixes impossible cwfs crashes in srvi().
2020-05-17 23:46:09 +02:00
cinap_lenrek
b599dc0e54 7l: handle dupok flag in TEXT/GLOBL data 2020-05-17 19:08:10 +02:00