Commit graph

3283 commits

Author SHA1 Message Date
cinap_lenrek e8111e517d nusb/cam: don't videoclose() when open failed
The fsdestroyfid() is called regardless if the open succeeded
or failed. This causes erroneous videoclose() when opening
the frame or video file while the camera is active.
2020-11-16 19:56:13 +01:00
kvik fc36bf0711 diff: fix change marker for -c mode 2020-11-16 19:19:37 +01:00
kvik 3fbcc5f410 ptrap: fail if invoked with no arguments 2020-11-16 11:45:05 +01:00
cinap_lenrek b80975da8b aux/cpuid: fix final newline on printbits() 2020-11-15 22:47:45 +01:00
Ori Bernstein e543995bba imap4d: imap4date should ignore time and timezone (RFC3501, 6.4.4) 2020-11-08 14:21:14 -08:00
Ori Bernstein 4257a5292a upas/marshal: add -S saveto to save outgoing mail, fix -F
Upas/marshal -F was broken with the '-8' command, and silly
without it: It used aliases passed on the command line, so
the destination address was ignored with -8 was passed.

In addition, it would create a new mailbox for any aliases
being sent to, instead of putting them all in one location.

The new -S option is similar to -F, but specifies where the
message should go.
2020-11-06 18:15:15 -08:00
Ori Bernstein 97de3f67c2 upas/common: delete library on 'mk clean'
libcommon.a$O doesn't end with a .a, so mk
doesn't know how to look inside it in order
to check if the files are up to date.

This means that when 'mk clean' is run,
libcommon.a$O looks up to date:

	% mk clean
	...
	% mk
	mk: 'default' is up to date

Deleting the library works around this problem.
2020-11-02 13:12:34 -08:00
Sigrid f4d2067373 audio/wavdec: add -s option 2020-11-02 11:46:50 +01:00
cinap_lenrek a4c6dc1d3d aux/realemu: use #$/pci/B.D.Fraw to access pci config space
This prevents VESA bios from accessing the pci
CONFIG_ADDRESS/CONFIG_DATA registers (0xCF8/0xCFC)
directly to access pci config space.

This makes sure the access to pci config space is
properly serialized by the kernel.
2020-11-02 01:14:30 +01:00
cinap_lenrek 2063019560 vmx: mask out bits 0:2 and 24:30 of pci CONFIG_ADDRESS on read
These bits are reserved, and by the specification,
must return zero on read.

This is also used by plan 9 for detecting config mode #1.
2020-11-02 01:01:48 +01:00
Ori Bernstein d75d842cf5 rc: show line numbers on error
This change provides a location for errors
like 'null list in concatenation'.
2020-11-01 11:56:26 -08:00
Alex Musolino 51b22d8548 jpg: treat EOF as EOI marker
Some jpegs, rightly or wrongly, do not contain an EOI marker.  This
causes jpg(1) to bail out even after correctly parsing the entire
image.
2020-10-31 15:44:49 +10:30
Ori Bernstein 31eb1b9d72 vt: improve behavior of chording
vt chording behaves slightly differently from other
applications: a chord must be fully released before
the next chord can be applied. This makes any change
in chord apply the action.
2020-10-30 13:23:16 -07:00
cinap_lenrek 5f2cf12f38 ip/cifsd: fix missing int return type for vpack() (thanks pr) 2020-10-29 18:26:35 +01:00
Sigrid d541c7bfd3 aux/cpuid: decode leaf 7; extend leaf 13 decoding 2020-10-29 11:27:26 +01:00
cinap_lenrek 950d970671 ip/tinc: fix reportedge()
supplying a non-ip address in ADD_EDGE crashes the unix tincd.

the reason was that we where misreporting ADD_EDGE messages;
ignoring the information from our peers; and always supplying
the Address string from our configuration instead of the
connections ip address.

now we just report the edge information as is.
2020-10-25 22:27:30 +01:00
Sigrid 55945f6f24 vmx/vga: fix allocimage leaks 2020-10-23 00:16:47 +02:00
khm 19273fdee3 upas/fs/mbox.c: fix cosmetic typo 2020-10-22 13:46:00 -07:00
Ori Bernstein 78bed738e1 vncv: pick an auth type that we support
We used to pick the highest auth type regardless of whether
we supported it. Now we filter down to types that we support.
2020-10-18 19:30:14 -07:00
Ori Bernstein 98c07541bb nusb/serial: add ids for FT230X (thanks mischief) 2020-10-17 19:27:21 -07:00
Ori Bernstein 90601f6e47 merge 2020-10-17 19:04:17 -07:00
Ori Bernstein a41b74059b upas: fix appendfolder timestamps (thanks umbraticus)
When moving messages between folders, mbappend,
deliver, and nedmail were trying to parse the
timestamp ouut of the message. They were doing
it incorrectly, trying to include the user name
as part of the date format.

Change to pass just the date to the date parser.
2020-10-17 18:59:36 -07:00
cinap_lenrek 0b094303f3 ndb/dnsdebug: add -c flag to debug caching dns server behaviour 2020-10-17 21:28:56 +02:00
cinap_lenrek bf18724738 ndb/dns: mark ns record authoritative when in our area for delegation
I have the problem that i need to delegate a subdomain
to another name server that is confused about its own zone
(and its own name) returning unusable ns records.

With this, one can make up a nameserver entry in ndb that
is authoritative and owned by us for that nameserver,
and then put it in the soa=delegated ns entry.

This promotes the ns record in the soa=delegated to
Authoritative, which avoids overriding the ns rr's from
the confused server for the delegated zone.
2020-10-17 21:28:25 +02:00
cinap_lenrek d310da13ba ip/torrent: try harder allocating ports
we used to only allocate ports from 6881 to 6890,
which limits the maximum of parallel torrents to 9.

this change make it go up to 9000, which gives us
at best 2120 ports, which is overkill but ports might
be randomly occupied by other connections.
2020-10-12 02:03:52 +02:00
cinap_lenrek 3e880cd07d upas/fs: fix truncation of plumb date
the new date format introduced by the previous commit;
using numeric timezone offsets; needs one character more,
so increase the date format buffer to 31 characters.
2020-10-11 14:59:49 +02:00
Sigrid 4a75ad5ec8 vmx: add Kmod4 2020-10-09 16:47:34 +02:00
kvik 6f76d00300 rio: move the code for 'send' into a function
Makes the code a bit nicer and allows reusing wsend() in patches.
2020-10-04 22:45:22 +02:00
Ori Bernstein c63cd980a4 acme: revert stray changes
forgot I had local changes when testing, re-revert scrolling.
2020-09-29 07:28:47 -07:00
Ori Bernstein fb42cf0dda vncv: implement rfb 3.8 protocol (thanks Iruatã)
Gnome and bhyve's VNC servers implement the RFB 3.8
protocol, so we need to support it in the client in
order to connect.
2020-09-27 09:43:43 -07:00
Ori Bernstein 16766169e2 aux/vga: eepc igfx support (thanks p.kosyh)
This patch to makes 1024x600x32 work. Without it
only 800x600 is supported.

To load this mode, run:

	aux/vga -m eeepc -l 1024x600x32
2020-09-26 20:47:17 -07:00
Ori Bernstein d9f9e10e7b upas: convert to tmdate, change timezone format
Complete the conversion of upas to remove ctime,
use the new date library, and print time zones
in +hhmm format, instead of NNN format.

This may affect code that expects specific names
for timezones. Fix that code.
2020-09-26 11:20:42 -07:00
Sigrid 878911b628 aux/acpi: connect EC region handler, fixes battery status on eeepc 1000px (thanks Peter Kosyh) 2020-09-25 10:28:25 +02:00
kvik 2968225196 syscall: fix build problem caused by stale tab.h
Recently the script which generates tab.h and the code including it got
incompatibly changed.  People reported problems involving syntax errors
when trying to rebuild the system following a sysupdate.

The problem was with the script being embedded within a mkfile rule,
meaning that mk didn't notice it changing and therefore didn't rebuild
the target file.  For people who were rebuilding the system this meant
that the old tab.h got included, causing syntax errors.

This patch moves the codegen script into a file and tells mk about this
new dependency, so that tab.h will get rebuilt for everyone.  I also
took an opportunity to rewrite the script, hopefuly making it easier to
follow.
2020-09-23 17:17:52 +02:00
Alex Musolino 23de6808f7 ftpd: handle "allo" command by treating it as a no-op
RFC959 says:

	"The ALLO command should be treated as a NOOP (no
	operation) by those servers which do not require
	that the maximum size of the file be declared
	beforehand..."
2020-09-23 12:44:05 +09:30
Ori Bernstein 313aebb964 acme: import changes from plan9port (thanks jxy)
Import the following improvements and bugfixes from plan9port:

	4650064a acme: scale window bodies on resize, not including tag space
	d28913a9 acme: save/restore multiline tags in Dump/Load
	d2df5d6c acme: fix crash in X |cat with multiple windows
	3d6e5cb5 acme: preserve window position and selection during Get
2020-09-22 11:42:15 -07:00
Ori Bernstein 8fe1d622b5 diff: support unified diff via -u
The format produced by `diff -u` is inferior to that
produced by `diff -c`, but it's what ape/patch and
unix patch expect, so it's useful to generate it.

This patch adds `diff -u`.
2020-09-21 09:40:42 -07:00
kvik aa7c8cac11 syscall: utility overhaul
Following is a list of functional changes:

* The -o flag outputs the entire buffer to the length returned
  by the syscall, or, in case of fd2path(2) and errstr(2), to '\0'.
* The -x flag is removed; the above makes it possible to pipe
  into xd(1) to get the same result.
* The -s flag uses dirfmt(2) to format the stat message, instead
  of trying to imitate ls(1).
* Stderr reports are normalized and made easier to parse.

The code also suffered a number of stylistic changes.
2020-09-20 14:49:12 +02:00
Ori Bernstein e3166b4fe8 upas/fs: fix handing of multi-line header fields (thanks theinicke)
Right now, upasfs exposes header lines as is, without stripping
out new lines. It also documents that it provides one header per
line in the info file.

As a result, when we get a mail with headers that span lines,
our tools get confused.

These split lines are not semantically meaningful. From RFC5322:

  2.2.3.  Long Header Fields

   Each header field is logically a single line of characters comprising
   the field name, the colon, and the field body.  For convenience
   however, and to deal with the 998/78 character limitations per line,
   the field body portion of a header field can be split into a
   multiple-line representation; this is called "folding".  The general
   rule is that wherever this specification allows for folding white
   space (not simply WSP characters), a CRLF may be inserted before any
   WSP.

As a result, to simplify processing, we should just strip out the
line separators when exposing the headers from upasfs.
2020-09-17 16:11:10 -07:00
BurnZeZ 77b819d585 ptrap: fix /env/status always being set on main process exit 2020-09-16 20:45:49 +00:00
kvik be876a06ac syscall: don't append '\n' to the output 2020-09-16 13:18:43 +02:00
Ori Bernstein d7b541eaf3 faces: remove log support
Use a damn plumber, you animals!
2020-09-12 17:40:41 -07:00
Ori Bernstein e0278f6917 seconds: tolerate trailing whitespace in dates
This allows handling dates with leading and trailing whitespace,
including newlines.
2020-09-01 19:03:17 -07:00
cinap_lenrek e9cd41467e upas: appendfolder() don't be picky about the timezone of ctime()
This is temporary fix, we should try to emulate the previous
behaviour where we accept at least our local timezone, and
otherwise ignore the offset.
2020-09-01 23:08:58 +02:00
cinap_lenrek 20d8cd0d63 upas: appendfolder(): skip the address from unix header before date 2020-09-01 23:01:45 +02:00
cinap_lenrek feda48624b upas/fs: extract proper date from unix header
do not try to parse the m->unixfrom field, it only contains
the unix mail address.

instead, have parseunix() save a pointer into the unixheader
after the unix mail address for the unixdate, and later use
it to derive the mails timestamp.
2020-09-01 21:39:45 +02:00
Alex Musolino 79b4ec29a1 upas/fs: remove unused function date822tounix 2020-09-01 22:25:06 +09:30
Alex Musolino e6bfbd0d33 png: remove bogus chanlen warning 2020-09-01 21:54:10 +09:30
Ori Bernstein b7b077375f faces(1): remove bespoke date parser
In addition to being more code, this date parser would
treat local times as local, but anything that wasn't a
local time would get parsed as gmt, due to a quirk of
how tm2sec used to work.

This moves the code to tmparse, and fixes timezone parsing
at the same time.
2020-08-27 10:32:02 -07:00
Sigrid 0505f8fb3a nusb/lib: use fmtprint for the entire dump to be printed out 2020-08-23 12:14:32 +02:00
Sigrid de34481f8b oggdec: give it enough chance to seek from the start, where first seek might be still too close to the beginning of the file 2020-08-18 16:45:00 +02:00
Sigrid 5405ee61ae audio/oggdec: allow -s 0 2020-08-12 22:26:06 +02:00
Sigrid 601dd12651 audio/mp3dec: mad timer duration is all wrong, use samples instead 2020-08-12 11:42:00 +02:00
Sigrid 81dba13271 audio/mp3dec: add -s SECONDS option 2020-08-12 10:43:46 +02:00
Sigrid 4ba367d435 audio/oggdec: add -s SECONDS option to seek before decoding 2020-08-11 17:26:33 +02:00
Sigrid 2e6f158f4d audio/flacdec: add -s SECONDS option to seek before decoding 2020-08-11 17:25:53 +02:00
Ori Bernstein 1e315f896d aux/ms2, aux/na: fix warnings
aux/na was comparing the return of putc with <0, when it should
have been comparing against EOF, which is not specified as -ve.

aux/ms2 was zero-extending the mask for the address when it
should have been sign extended.
2020-08-10 19:35:05 -07:00
Ori Bernstein c834f535b7 seconds: use new libc date api 2020-08-10 19:02:09 -07:00
Ori Bernstein 6d3a2e6531 date: use new libc date apis. 2020-08-10 19:01:45 -07:00
Ori Bernstein 9db78003db merge 2020-08-10 19:00:59 -07:00
Sigrid 6e039d7b49 vmx: does not do well with certain fb widths, so restrict it 2020-08-10 16:38:26 +02:00
Ori Bernstein e702cfcafd upas/fs: port date parsing to libc apis
There was a lot of code in upas/fs to deal with dates.
Now there isn't.
2020-08-09 19:46:38 -07:00
Ori Bernstein 9d446410c5 ip/httpd: fix 'mk nuke' 2020-08-09 19:00:06 -07:00
Ori Bernstein 3ba1d83d20 cc: promote integer constants according to c99 spec.
C99 integer constants with no type suffix promote differently
depending on the way that they're written: hex and oct consts
promote as int => uint => long => ulong => vlong => uvlong.
Decimal constants are always signed.

We used to promote all values to uint on overflow, and never
went wider. This change fixes that, and adds a warning when
a decimal constant that would have been promoted to uint in
the past gets promoted to int.
2020-08-08 11:39:25 -07:00
cinap_lenrek ac4e21f52d ndb/dns: allow multiple txt, nullrr, cert, key and sig records (thanks kvik)
The de-duplication of txt, nullrr, cert, key and sig records
reduced all records to a single one.

Also, dblookup1() missed the txt record case and did not return
a unique list of rr's.

Now we consider these records unique if their value is different.
The new txtequiv() function does that for TXT records, which is
a bit tricky as it needs to take different segmentation into account.
2020-08-08 18:37:10 +02:00
Sigrid 93b475981e vmx: set xstart to either nsec or cycles depending on what is available 2020-08-07 17:08:49 +02:00
cinap_lenrek 53800208bd rc: avoid stat calls for directory globbing
On Plan9, we can count on Readdir() onlydirs argument
to work, which allows us to avoid stating every single
file to see if it is a directory.
2020-08-04 16:21:37 +02:00
cinap_lenrek 4bbf1d12b5 7c: now really fix OASxxx operations
the previous patch broke 64-bit ops as the type for the
operation is determined from the first argument to
gopcode() (nod1.type), not the type the result (nod.type).

so we need to include the conversion of nod1 type to
the type of nod.
2020-08-04 00:50:33 +02:00
cinap_lenrek 1d07c2a161 merge 2020-08-03 23:17:32 +02:00
cinap_lenrek d42f9b5110 reverting 7c change, breaks some 64-bit shifts... 2020-08-03 23:16:41 +02:00
cinap_lenrek c4cf92b99e merge 2020-08-03 21:52:22 +02:00
cinap_lenrek 053a6526e2 acme: reverting scroll change, causes continuous scrolling with scrollwheel 2020-08-03 21:51:25 +02:00
cinap_lenrek cbe45e78f9 7c: fix wrong type on OASxxx operations
the bug can be reproduced with the following test case:

#include <u.h>
#include <libc.h>

void
main()
{
	int size = 1;
	size*=1.5;
	exits(0);
}

this produces the following assembly:

	TEXT	main+0(SB),0,$16
	MOVW	$1,R1
	FCVTZSDW	$1.50000000000000000e+00,R2	<- tries to convert rhs to int??
	MULW	R2,R1,R2 <- multiplication done in int? bug!
	MOV	$0,R0
	BL	,exits+0(SB)
	RETURN	,
	END	,

the confusion comes from the *= operation using the wrong type
for the multiplication. in this case we should use the float
type of the rhs, do the operation, and then convert the result
back to int type of the lhs.

this change ports the same logic from 5c's getasop().
2020-08-02 19:48:25 +02:00
Ori Bernstein 9e27ee094c deroff: fix out-of-bounds access if runes above 0X80 are inside EQ clauses (thanks mmnmnnmnmm, via plan9port)
Characters greater than 0X80 will cause a read beyond the bounds of the
array chars[]. For particular unicode characters this can cause deroff
to segfault.

A minimal example:
$ deroff
.EQ
u∈
Segmentation fault

Throughout deroff, charclass() is used instead of directly indexing
chars[] so I presume this was just missed.
2020-08-01 10:54:03 -07:00
Ori Bernstein 6dbecfb457 htmlroff: fix out of bounds access (thanks Rei-sen, via plan9port)
_readx() uses rune count as its argument and not size, so we should
pass nelem() instead of sizeof().
2020-08-01 10:49:29 -07:00
kvik e5894dccea pre-lib9p servers: fix incorrect Tversion handling
version(5) says:

	If the server does not understand the client's version
	string, it should respond with an Rversion message (not
	Rerror) with the version string the 7 characters
	``unknown''.

Pre-lib9p file servers -- all except cwfs(4) -- do return Rerror.

lib9p(2) follows the above spec, although ignoring the next part
concerning comparison after period-stripping.  It assumes an
Fcall.version starting with "9P" is correctly formed and returns
the only supported version of the protocol, which seems alright.

This patch brings pre-lib9p servers in accordance with the spec.
2020-08-01 15:27:28 +02:00
Sigrid 88a468f205 vmx(1): use _tos->cyclefreq (thanks cinap) 2020-08-01 15:23:51 +02:00
Ori Bernstein d287f178aa dc: increase exponent limit (thanks unboe, lyndon)
dc has an arbitrary limit on the size of the exponent. Lets
replace it with a different arbitrary limit.
2020-07-31 08:52:17 -07:00
Sigrid 9965e575f8 vmx(1): add missing file 2020-07-31 15:51:32 +02:00
Sigrid 853f0e33fe vmx(1): use cycles() instead of nsec() when possible
this provides better timing and reduced number of syscalls (~2.7M old
vs ~35K new in a test)
2020-07-31 15:48:54 +02:00
Sigrid de27182a8e vmx: use _actual_ system kbmap 2020-07-31 11:24:02 +02:00
Sigrid eb65fc5e69 aux/acpi: forgot to commit -p option 2020-07-30 15:59:04 +02:00
Sigrid edb6f64d35 aux/acpi: write a man page, fix usage, call threadexits 2020-07-30 11:25:14 +02:00
Alex Musolino 02f19713a1 sshfs: update usage text to match man page 2020-07-29 13:56:03 +09:30
Ori Bernstein c03079ad08 upasfs: make imap debug logging less noisy
The current logging prints a debug line for every
message in an inbox, which is unusably verbose.
This removes the prints for unchanged messages,
and adds a print for flag changes.
2020-07-26 19:12:48 -07:00
Ori Bernstein ea98dafce5 replica: fix mkfile script installation (thanks Amavect)
The $SCRIPTS were added to $TARG, which complicates the all rule, as
each script's object file must be suppressed.
Fix by removing $SCRIPTS from $TARG, removing the script object file
suppression rule, and overriding the install rule.

The script bin install rule assumes that only one script install is
called at a time. Valid calls like 'mk -a /$objtype/replica/changes
/$objtype/replica/pull' will fail.
Fix by adding a for loop.

Remove the unused $UPDATE variable.
2020-07-20 18:58:52 -07:00
Ori Bernstein 0366f11300 cpp: fix mutually recursive macros
Handle cases where parameterless macros expand to each other:

	#define FOO BAR
	#define BAR FOO
	FOO

There were cases where the macros didn't make it into the hidesets,
and we would recurse infinitely. This fixes that.
2020-07-13 18:50:14 -07:00
cinap_lenrek 11fcf41472 aux/cpuid: flush instruction cache of after patching trampoline 2020-07-12 19:37:38 +02:00
cinap_lenrek 2c8c2bc727 hjfs: update mtime and qid.vers for directory on rename
when wstating a file, its directory should be updated to
reflect this change.

here is what the manpage states:

> The mtime field reflects the time of the last change of content
> (except when later changed by wstat). For a directory it is the
> time of the most recent remove, create, or wstat of a file in the
> directory.
2020-07-12 18:54:22 +02:00
cinap_lenrek a469cffafe cwfs: update mtime and qid.vers for directory on rename
when wstating a file, its directory should be updated to
reflect this change.

here is what the manpage states:

> The mtime field reflects the time of the last change of content
> (except when later changed by wstat). For a directory it is the
> time of the most recent remove, create, or wstat of a file in the
> directory.
2020-07-12 18:52:28 +02:00
cinap_lenrek ad26dc48a6 imap4d: fix missing return in %δ format of Dfmt() 2020-07-05 22:15:02 +02:00
cinap_lenrek b33eb658e2 imap4d: get rid of unixdate/unixfrom handling
all this logic is already done by upas/fs, the unixdate and from
fields in the info file will always be correct.
2020-07-05 21:18:26 +02:00
cinap_lenrek 24dcdb54b8 imap4d: fix mkfile to have the correct default target 2020-07-05 21:16:41 +02:00
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 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
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
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
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
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
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 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
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 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
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
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 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 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 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 b599dc0e54 7l: handle dupok flag in TEXT/GLOBL data 2020-05-17 19:08:10 +02:00
cinap_lenrek 8550a2adb5 7l: fix mistake 2020-05-16 16:26:09 +02:00
Ori Bernstein ed4645979c stop fiddling with path construction.
There's fd2path, which gives back the full path directly.
This makes the code even simpler.
2020-05-13 18:50:01 -07:00
Ori Bernstein d332f8a9b5 fix yacc crash with absolute paths
When passing an absolute file path to yacc, we would skip
initializing inpath, leaving it null. This would cause Bopen
to die. We would similarly fail to report an error if we tried
to get the current working directory, and then die when
constructing inpath.

This fixes both cases.
2020-05-13 08:42:00 -07:00
cinap_lenrek 8ca102d42e cc: dont export gethunk(), hunk, nhunk and thunk 2020-05-12 23:18:48 +02:00
cinap_lenrek 34cf2725d2 cc: get rid of hunk pointer fiddling and just use alloc() 2020-05-12 22:45:05 +02:00
cinap_lenrek ecdf3f921e ?l: remove direct hunk manipulation from linkers, just call malloc()
as with recent changes, cc's malloc() could make the hunk pointer
misaligned. in the the compilers, the hunk pointer is used directly
by the lexer with no effort to to keep the hunk pointer aligned.

alloc/malloc still return aligned pointers, but hunk itself can
be on a odd address after allocation of a odd sized amount of bytes.

however, in the linkers, this assumption appears to be differnet. as
most allocations mostly allocate padded structures. however, symbol
lookup allocates strings on byte-size ganularity and the cc's malloc
would misalign the hunk pointer after the malloc() call. while the
rest of the code assumed hunk pointer was always aligned.

this change removes all the hunk pointer fiddling from the linker,
and we just call malloc() (which will use the fast implmenentation
of cc, and should not really make much of a performance difference).
2020-05-12 22:04:30 +02:00
kvik 1c3a6fc67e acme: add missed error checks 2020-05-10 03:18:57 +02:00
kvik 758edf2b14 nusb/kb: add quirks for Elecom HUGE trackball
As said in the code comment:

	Elecom trackball report descriptor lies by
	omission, failing to mention all its buttons.
	We patch the descriptor with a correct count
	which lets us parse full reports. Tested with:
		Elecom HUGE (M-HT1DRBK, M-HT1URBK)

The descriptor fixup is adapted from Linux kernel:
	drivers/hid/hid-elecom.c
in which a more detailed account of why and how this
works may be found.

A followup change to nusb/kb will be needed to expose
these additional events for potential remapping.
2020-05-08 20:49:11 +02:00
Ori Bernstein ec4011acf7 fix typo: mouse->xy, not w->mc.xy 2020-05-07 13:23:15 -07:00
kvik 6d25e194e2 aux/getflags: remove rogue debug print 2020-05-07 18:37:08 +02:00
kvik ccf5d3fb9d aux/getflags: improve flagfmt parser
This makes the flagfmt parser more robust and accepting
a looser input language — namely by allowing whitespace
around specifier fields and ignoring any empty fields.

Long flagfmts can thus be pleasingly displayed:

	flagfmt='
		a, b, c, C:cache,
		m:mtpt mountpoint,
		s:srvn srvname'
2020-05-07 00:10:09 +02:00
Ori Bernstein 0dc9c8d019 Reset click count on mouse motion. 2020-05-06 13:38:39 -07:00
cinap_lenrek ac88ce4f7f make bind(2) error handling consistent
The mount() and bind() syscalls return -1 on error,
and the mountid sequence number on success.

The manpage states that the mountid sequence number
is a positive integer, but the kernels implementation
currently uses a unsigned 32-bit integer and does not
guarantee that the mountid will not become negative.

Most code just cares about the error, so test for
the -1 error value only.
2020-05-02 17:32:01 +02:00
cinap_lenrek 19cc46bc5e sed: accept and ignore -E and -r flags for unix compatibility 2020-05-02 16:56:52 +02:00
cinap_lenrek d0c87bada6 ip/cifsd: implement primitive per-share unix id mapping for wstat() 2020-05-02 16:53:52 +02:00
Ori Bernstein 9b8af27299 facelift for mothra: flat ui is in.
Remove false 3d, add borders for visual separation between
content area and navigation area.
2020-04-28 20:50:10 -07:00
Ori Bernstein dcf96a006d missing headers rate a FATAL. 2020-04-27 20:13:16 -07:00
qwx 0fc1abc73d mothra: fix a few errors in previous patch
- nil check pl_blue allocation, and don't do it every time pl_rtdraw is called
- fix re-adding previously removed flushimage calls
- correct format for pointer
- sysfatal in pl_drawinit on error
2020-04-26 19:43:10 +02:00
Ori Bernstein c6f7989176 copy all the tokens from the tokenrows with a paste.
if we do 'CAT(foo bar, baz quux)', the resulting token row
should have 3 tokens: 'foo', 'barbaz', 'quux'.

tested by jonasa, rebuilding /sys/src, perl, netsurf, and nuklear.
2020-04-26 09:32:42 -07:00
Ori Bernstein d6598a2a31 Support for neo2 keyboard layout
Modify aux/kbdfs to work with neo2 layout.
- add new modifier, increase limit on layers.
- Add Kaltgr for mod3
- Add mod4

This change only implements the alphanumeric
block of the keyboard in the kbmap, as neo2
is mainly used for blind typing and is not
needed that much anywhere else, this leaves
the numpad like it is.

(Thanks, jstsmthrgk@jstsmthrgk.eu)
2020-04-25 20:46:45 -07:00
stanley lieber 2614fa02f7 mothra: make user interface monochrome 2020-04-25 21:55:43 -04:00
stanley lieber 9a7c5d5653 mothra: remove extraneous lines and decoration (fake 3d). patch extracted from my forked mess by Ori_B. 2020-04-25 21:53:54 -04:00
Ori Bernstein 60c34ebb2d tweak selection criteria
grow selection from point of click, not start of selection region.
starting at the beginning of the selection region causes the match
logic to kick in, which is confusing.
2020-04-25 15:18:04 -07:00
cinap_lenrek 7feab4dc59 cc: simplify macexpand() and off-by-one error
the caller of macexpand() needs one more byte in
the buffer to append peekc.

make macexpand() actually check for buffer overflow.

just use strdup() to duplicate include file name
instead of the hunk dance.

move GETC() macro in cc.h
2020-04-25 22:16:44 +02:00
Ori Bernstein 4adb1d68d1 fix typos in time calculation
the results of the time calculation were garbled -- and
apparently negative on my system when testing, so the
test passed when it shouldn't have.
2020-04-25 11:00:27 -07:00
Ori Bernstein d52d7bc121 Backed out changeset 2737b9af622b
not what I wanted to commit.
2020-04-25 10:57:17 -07:00
Ori Bernstein 2de164c51d fix typos in time calculation
the results of the time calculation were garbled -- and
apparently negative on my system when testing, so the
test passed when it shouldn't have.
2020-04-25 10:43:39 -07:00
Ori Bernstein 5d7e9bee3c Bump protocol version for Ttclick 2020-04-25 09:38:02 -07:00
Ori Bernstein 8bc290cc0f triple click selection in acme
see the last 2 commits.
2020-04-25 08:59:14 -07:00
Ori Bernstein 6f44393958 triple click selection in rio
same as sam and vt, three clicks selects a
whitespace-delimited line.
2020-04-25 08:58:24 -07:00
Ori Bernstein f616a0c1bd triple click selection in sam
three clicks selects a whitespace-delimited line.
2020-04-25 08:57:26 -07:00
stanley lieber 27743b56d8 mothra.c: add Plumb menu item, and update man page. my original changes sanity-checked by Ori_B. 2020-04-21 21:12:32 -04:00
stanley lieber bd78cd2dd3 rdhtml.c: restore original fonts. dejavusans was my change, my fault. it never looked right outside of drawterm on osx (mea culpa). this is easy to change for anyone who prefers something else, but it's difficult to imagine native users preferring our very fuzzy dejavusans to anything else. 2020-04-21 21:09:12 -04:00
cinap_lenrek 81c9ede53f samterm: don't scroll invisible (command) window (thanks umbraticus)
with scroll-wheel scrolling, this case can happen with the
command window:

umbraticus → cinap: create fullscreen file buffer by right-clicking in cmd window
2020-04-22 00:55:58 +02:00
cinap_lenrek 2c317dccea merge 2020-04-20 00:08:35 +02:00
cinap_lenrek 8499401ada ?a, ?c: fix macro debug prints 2020-04-19 23:57:33 +02:00
cinap_lenrek 313216e6fb ?c: get rid of sprint(), strcpy() and strcat()/strncat(), cleanup 2020-04-19 23:51:18 +02:00
cinap_lenrek b43720e3f7 [257]l: cleanup fmt routines, replace sprint() 2020-04-19 23:47:23 +02:00
cinap_lenrek c66b3739ac cc: cc.h changes needed by previous commit 2020-04-19 23:42:02 +02:00
cinap_lenrek 0d59a2358a ?a, cc: fix buffer overflows in built-in preprocessor (macbody)
add a buffer size argument to macexpand() and check for
overflow.

check for overflow when parsing #include directives.
2020-04-19 23:37:05 +02:00
cinap_lenrek e24bfa4941 ?a: catch symb[NSYMB] buffer overflow in lexer, cleanup, assume thechar is a rune 2020-04-19 22:59:21 +02:00
cinap_lenrek 3f87ffea44 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().
2020-04-19 20:44:19 +02:00
Ori Bernstein 260d1eaaa7 Make priority array max size explicit.
we were implicitly depending on UMINUS being the last entry
in the operator table -- that's fragile.
2020-04-19 11:26:31 -07:00
Ori Bernstein 15a32f0683 fix cpp operator associativity
We used to treat all operators as right associative,
which means that we would evaluate them incorrecty.
For example, '2 - 1 + 1' would evaluate as '2 - (1 + 2)',
instead of '(2 - 1) + 1'.

This adds an assoc parameter to struct pri, and then uses
it to decide how to evaluate operators.
2020-04-19 11:15:13 -07:00
Ori Bernstein 2c596d0021 merge 2020-04-19 09:03:35 -07:00
Ori Bernstein 21831527cb dont overflow the stack
when pushing expressions in cpp, particularly complex ones could
overflow the stack and silently corrupt our data structures. add
checks when we push, and bump the stack size up.
2020-04-19 09:02:21 -07:00
cinap_lenrek 34a1b1bb22 ?c: fix Bconv() misusage of strncat() 2020-04-19 04:33:07 +02:00
cinap_lenrek e6634fbd0c 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.
2020-04-19 01:25:35 +02:00
Ori Bernstein 380adf8b48 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.
2020-04-18 15:38:38 -07:00
cinap_lenrek 8ae77554dd 7l, ql: dont assume . is in the path for running mkcname (thanks sam-d) 2020-04-18 19:07:06 +02:00
cinap_lenrek 94bd7700aa 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.
2020-04-18 18:20:34 +02:00
Ori Bernstein d68f4adeba merge 2020-04-11 14:20:53 -07:00
Ori Bernstein 2d1dac07f7 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.
2020-04-11 14:19:46 -07:00
cinap_lenrek 3cdbbcd859 merge 2020-04-11 22:37:30 +02:00
cinap_lenrek 0c7da78f45 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).
2020-04-11 22:36:19 +02:00
Ori Bernstein ebb3e31118 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.
2020-04-11 11:56:04 -07:00
cinap_lenrek a7dab2728b 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.
2020-04-11 18:09:48 +02:00
cinap_lenrek d8545806fc vl: remove unused mysbrk() prototype 2020-04-11 14:20:41 +02:00
cinap_lenrek 550b6d1aad qa: remove ALLOC() and ALLOCN() macros 2020-04-11 14:20:13 +02:00
cinap_lenrek ca9d65e40b 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.
2020-04-11 14:19:35 +02:00
cinap_lenrek 49c159b50f 6c: remove mystery sys.c file 2020-04-11 05:19:11 +02:00
cinap_lenrek 1b8a569417 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.
2020-04-11 05:03:49 +02:00
cinap_lenrek 9d46360c9d 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.
2020-04-11 01:26:36 +02:00
cinap_lenrek 1d3644a168 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.
2020-04-10 23:11:25 +02:00
cinap_lenrek e610ffaf1b merge 2020-04-10 22:26:37 +02:00
cinap_lenrek a39cc60c52 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.
2020-04-10 22:25:29 +02:00
Sigrid 2cdf1a3c79 cc, ?a, ?l: change thunk type to uintptr 2020-04-10 20:38:45 +02:00
Sigrid 6018316eef cc: sbrk in bigger chunks as it grows, so it gets a chance to use the ram/swap available 2020-04-10 17:19:44 +02:00
Alex Musolino 80fdafd1d6 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.
2020-04-05 23:26:52 +09:30
cinap_lenrek 0ba0820070 dossrv: fix falloc() for >31 bit sector numbers (thanks sl) 2020-04-05 03:46:47 +02:00
cinap_lenrek ecba7822e3 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.
2020-04-05 03:05:06 +02:00
cinap_lenrek 315f20b9f4 nusb/audio: set frequency only when supported
before setting the sampling rate, check bit D0
"Sampling Frequency" in the audio class specific
endpoint descriptor.
2020-04-05 00:59:47 +02:00
Alex Musolino ad3da2fac2 merge 2020-04-01 22:57:15 +10:30
Alex Musolino c393806718 upas/fs: fix sending of "delete" plumb messages
Broken by changeset 2cc069392228.
2020-04-01 22:49:19 +10:30
cinap_lenrek d3512f60df 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.
2020-03-31 21:57:53 +02: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 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
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 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
Sigrid 446e454c5a sam: ^ does not need current file 2020-03-09 13:58:41 +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 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 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 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 dce28e58e4 dossrv: output iotrack error message to stderr 2020-03-07 14:23:34 +01:00
cinap_lenrek e0cb81af94 ramfs: don't use Srv.nopipe 2020-03-07 13:35:46 +01:00
cinap_lenrek b053f5d060 aux/acpi, aux/apm: remove nopipe -i flag 2020-03-07 13:23:34 +01:00
cinap_lenrek 17136370d8 hgfs: fix loadrevinfo() for empty log bug
loadrevinfo() would fail on a empty log portion due
to a bug in the previous commit.

the loop is supposed to skip all bytes until we encounter
a empty line. the loop starts at the beginning of a line
so when we encounter a \n, we have to terminate, otherwise
read bytes until we see \n (end of a line) and then read
another and test the condition again.
2020-03-01 23:23:01 +01:00
Ori Bernstein 3df95385bc fix special case for null pointer constants in cond expressions
Section 6.5.15 of the C99 spec requires that if
	one argument of a ?: expression is a null pointer
	constant, and the other has a pointer type T*, then
	the type of the expression is T*.

	We were attempting to follow this rule, however,
	we only handled literal expressions when checking
	for null pointers.

	This change looks through casts, so 'nil' and 'NULL',
	and their expansion '(void*)0' are all detected as
	null pointer constants.
2020-02-27 15:09:10 -05:00
cinap_lenrek 219741ac01 sed: allow whitespace after ! negation (thanks k0ga) 2020-02-19 19:26:43 +01:00
spew 234aafb38d acme(1): fix scrolling when swiping text at the top or bottom of a frame 2020-02-13 16:09:25 -05:00
Ori Bernstein 8b59286ef1 upas/fs plumb modify messages for self-changed flags
Currently upas/fs plumbs modify messages only if the flag
	changes are made by another imap connection.  If the flag
	changes are made within the running upas/fs no modify message
	is plumbed.

	This changes upas/fs to set the modify flag if we made the
	change ourself. It also moves the flag setting before the
	imap read, so that we don't clobber flag changes coming
	from the imap server with our own flags.

	(Thanks Tobias Heinicke)
2020-02-05 14:11:15 -08:00
cinap_lenrek 04c4a9ca8b merge 2020-02-02 20:33:40 +01:00
cinap_lenrek be8cbcc852 listen(1): implement one-shot mode flag for listen1 (thanks kivik) 2020-02-02 20:31:48 +01:00
Ori Bernstein 8ce18a6338 fix double free in acme.
in acmerrorproc():
		sendp(s);
		free(s);

	in waitthread():
		recv(&err)
		free(err)

	We only want waitthread to free.
2020-01-31 09:25:39 -08:00
BurnZeZ 2c0ccff286 walk: add D and T fmt characters (fileserver device/type) 2020-01-28 01:27:41 +00:00
BurnZeZ 7facfb5548 walk: remove superfluous newline 2020-01-28 00:44:44 +00:00
cinap_lenrek 09eac381e5 merge 2020-01-19 19:21:10 +01:00
Roberto E. Vargas Caballero 47bae09b33 Apply http://www.9paste.net/qrstuv/patch/acme-movetodelmesg/ 2020-01-19 19:18:12 +01:00
cinap_lenrek a898d31f76 acme: fix off by one in colclose(), make dellist() code consistent 2020-01-19 18:43:51 +01:00
Roberto E. Vargas Caballero b099753597 acme: Restore call to movetodel() in colclose 2020-01-19 18:36:50 +01:00
cinap_lenrek 7cf8369411 vnc/devdraw: fix topnwindows() panic when images are not windows (thanks aiju)
see changeset 319be6cfe7ef
2020-01-12 00:19:39 +01:00
cinap_lenrek 0b12020f10 ip/cifsd: implement SMB_SET_FILE_UNIX_BASIC for wstat 2020-01-11 14:50:52 +01:00
Sigrid e55ee7fafd libFLAC: 1.3.1 -> 1.3.3 2020-01-11 13:25:02 +01:00
Ori Bernstein 8150f68995 show line numbers in dtracy type errors 2020-01-09 11:59:44 -08:00
aiju 826c76f90d dumb bug 2020-01-08 02:27:09 +00:00
aiju 76ed5d2e4b add aux/aout2uimage 2020-01-08 02:22:20 +00:00
cinap_lenrek c739f57ac2 ip/ipconfig: keep on sending router solicitation after initial RA
avm fritzbox uses very long RA period so it effectively only
responds after a router solicitation. when there are multiple
fritzbox routers on the lan, then while configuring one prefix
of the first RA, the ip stack can drop the second router
advertisement and we would never get the second route.

packets can always get lost. so we just keep on sending router
solicitations (up to 3 times) to make sure we got all the RA's.
2020-01-04 11:49:50 +01:00