Commit graph

8193 commits

Author SHA1 Message Date
cinap_lenrek
fc5070c600 libauth: add procsetuser() function to change user id of the calling process
Provide a central function to change the user id
of the calling process.

This is mostly used by programs to become the none
user, followed by a call to newns().
2020-12-19 17:46:55 +01:00
cinap_lenrek
daccd2b226 aux/kbdfs: use getuser() from libc 2020-12-19 15:52:41 +01:00
cinap_lenrek
ba20914d01 acme: use global user string variable instead of getuser() 2020-12-19 15:50:30 +01:00
cinap_lenrek
c7fc69bd6a acme: use getuser() in fsinit() 2020-12-19 15:36:07 +01:00
cinap_lenrek
672cf179a1 libc: implement getppid() reading /proc/$pid/ppid instead of /dev/ppid
The devcons driver is really the wrong place to
serve per process information.
2020-12-19 15:15:38 +01:00
cinap_lenrek
d919ad3b5e devsons: remove #c/pgrpid
The process group id is essentially a unique id
of the namespace but it was never well documented
nor is it used by any program.
2020-12-19 14:59:19 +01:00
Sigrid
d0cc9e2eb6 g: initialize files env var 2020-12-19 13:33:11 +01:00
Ori Bernstein
4dc437c076 vt: rfork environment varibles (thanks fshahriar)
vt sets several environment variables ($TERM, $COLS, $LINES)
after exiting. This change rforks the environment so that this
detritus doesn't get left behind.
2020-12-18 19:23:48 -08:00
Ori Bernstein
2db3642b8d strndup: don't assume buffer is terminated
Using strlen in strndup will walk past the first
n bytes up to the terminator, which may not be
present. This is not what we want.

While we're here, do some cleanups.
2020-12-18 07:16:29 -08:00
kvik
f097883644 kbmap: add Turkish keymap (thanks Kemal) 2020-12-18 15:15:49 +01:00
Ori Bernstein
c2aa8c997a hpost: support custom headers (thanks julienxx)
hget supports adding custom headers with -r;
it makes sense for hpost to do the same, both
because custom headers are more likely necessary
with POSTs, and for consistency.
2020-12-17 20:26:38 -08:00
Ori Bernstein
658c1b9f68 libap: add strndup
strndup is part of POSIX.1, so APE should provide it.
This patch adds it, so need to patch it out of fewer
programs going forward.
2020-12-17 19:20:04 -08:00
cinap_lenrek
646c502b15 ether2114x: make sure pci bar0 is I/O 2020-12-17 21:02:11 +01:00
cinap_lenrek
318fe6a702 ether2114x: vetting the driver for pc64
the tulip driver is used in microsofts hypver-v
as the legacy ethernet adapter for pxe booting.

to make the driver work on pc64, we need to
store the Block* pointers in a separate array
instead of stuffing them into buffer address 2
of the hardware descriptor.

also, enable the driver in the pc64 kernel.
2020-12-17 20:55:59 +01:00
Sigrid
5016ac0c63 pc: set exit status depending on errors 2020-12-15 14:37:36 +01:00
Sigrid
d0c6ade53d pc: treat EOF gracefully, allowing easier use within sam command language 2020-12-15 14:25:59 +01:00
Alex Musolino
3749e92cdb merge 2020-12-15 20:55:41 +10:30
Alex Musolino
404c901f29 ico: avoid potential nil pointer dereferences
Bgeticon can fail, leaving the Icon img pointers nil.
2020-12-15 20:45:26 +10:30
Alex Musolino
81647c2025 ico: fix interpretation of 0 widths/heights 2020-12-15 20:44:11 +10:30
cinap_lenrek
32291b52bc iostats: dup 9p pipe to both fd 0 and fd 1 for exportfs 2020-12-13 20:23:03 +01:00
cinap_lenrek
08a9a6952d cpu(1): refer to oexportfs(4) 2020-12-13 20:11:44 +01:00
cinap_lenrek
6f932de718 import(4): refer to oexportfs(4) 2020-12-13 20:11:30 +01:00
cinap_lenrek
27a83106f4 oexportfs: move legacy code for cpu and import to separate program
The initial protocol handling in exportfs for
cpu and import services is a huge mess.

Saparate the code out into its own program with
its own oexportfs(4) manpage.
2020-12-13 20:09:03 +01:00
cinap_lenrek
0b33b3b8ad kernel: implement per file descriptor OCEXEC flag, reject ORCLOSE when opening /fd, /srv and /shr
The OCEXEC flag used to be maintained per channel,
making it shared between all the file desciptors.

This has a unexpected side effects with regard to
channel passing drivers such as devdup (/fd),
devsrv (/srv) and devshr (/shr).

For example, opening a /srv file with OCEXEC
makes it impossible to be remounted by exportfs
as it internally does a exec() to mount and
re-export it. There is no way to reset the flag.

This change makes the OCEXEC flag per file descriptor,
so a open with the OCEXEC flag only affects the fd
group of the calling process, and not the channel
itself.

On rfork(RFFDG), the per file descriptor flags get
copied.

On dup(), the per file descriptor flags are reset.

The second modification is that /fd, /srv and /shr
should reject the ORCLOSE flag, as the files that
are returned have already been opend.
2020-12-13 16:04:09 +01:00
cinap_lenrek
b2b2d2cb4c sdiahci: assume 64-bit PCIWADDR() 2020-12-12 18:16:06 +01:00
cinap_lenrek
5ea540e75d sdiahci: enable pci busmaster before ahciconfigdrive() (fix qemu crash)
enable pci busmaster before set the fis-receive-enable
bit in the port command register.

not doing so triggers a crash in qemu like:

address_space_unmap: Assertion `mr != NULL' failed.

as qemu tries to process the dma command list as soon
as we set that flag and busmaster dma needs to be enabled
at this point.
2020-12-12 18:00:41 +01:00
cinap_lenrek
b1d1fa04b9 merge 2020-12-11 15:24:35 +01:00
cinap_lenrek
fc0f08c651 pc, pc64: make sure write combining is supported in MTRR's before setting it 2020-12-11 15:23:03 +01:00
cinap_lenrek
658c994cff pc, pc64: ignore MTRR's when MTRRCap.vcnt and MTRRCap.fix are zero
Bhyve returns 0 in MTRRCap register, so we
can use that instead on relying on cpuid only
to see if MTRR's are supported.

That way we can get rid of the sanity check
in memory.c.
2020-12-11 15:21:44 +01:00
Sigrid
345e93dd4c update Finnish kbmap: fix ¤ on shift+4 and add more AltGr variants 2020-12-11 15:18:41 +01:00
Sigrid
f5d1fce9b5 vmx: clean up mksegment, memset only if segment existed (devsegment clears new ones) 2020-12-10 12:19:45 +01:00
Sigrid
d7120ecb77 src: work on awk scripts too, see "src valley" (thanks phil9) 2020-12-10 10:33:42 +01:00
cinap_lenrek
cef91f23e7 pc, pc64: work around bhyve all uncached MTRR's 2020-12-10 01:47:19 +01:00
cinap_lenrek
635be84831 merge 2020-12-09 01:05:14 +01:00
cinap_lenrek
eb3d055eb3 backout OCEXEC changes when potentially opening /srv files
Opening a /srv file sets the close-on-exec flag on the
shared channel breaking the exportfs openmount() hack.

The devsrv tries to prevent posting a channel with the
close-on-exec or remove-on-close flags. but nothing
currently prevents this poisoning on open.

Until this gets fixed in eigther exportfs or devsrv,
i'll back out the changes that could have potential side
effects like this.
2020-12-09 01:04:03 +01:00
kvik
07d3d9bf0c sega(1): fix keys (thanks bigato) 2020-12-08 21:20:13 +01:00
cinap_lenrek
5149f204b7 plan9.ini(8): document *nomtrr= and order the table 2020-12-08 17:16:12 +01:00
cinap_lenrek
8efbd243e1 pc, pc64: cleanup cpuidentify() and some comments 2020-12-08 16:58:41 +01:00
cinap_lenrek
b2ffb6ccc5 pc, pc64: add *nomtrr= kernel parameter 2020-12-08 16:34:36 +01:00
cinap_lenrek
263dc8093d pc64: preserve reserved bits in CR0/CR4 for amd64 in mtrr setstate()
On AMD64, CR0/CR4 are 64-bit registers, with
the upper half reserved. So use uintptr type
to store the register values to get 32 bit on 386
and 64 bit on AMD64.
2020-12-08 16:00:57 +01:00
cinap_lenrek
4db8a82f5a vncv: backing out previous change, this needs another revision 2020-12-08 15:15:13 +01:00
Sigrid
b1da2bb10b vncv: do NOT map Kaltgr to meta, introduce Mod4 (Super) as an extra key to use instead 2020-12-08 14:32:28 +01:00
Sigrid
93c6f8cb0d vmx(1): build vmxgdb by default, clean it up as well 2020-12-08 13:18:10 +01:00
cinap_lenrek
4ba5cb6c6a vmx: nanosec(): fix non-interruptable temporary, assign fasthz only once after xstart 2020-12-08 13:04:52 +01:00
cinap_lenrek
01eb04060b pc: move ldmxcsr() prototype to fpu.c 2020-12-08 12:42:36 +01:00
cinap_lenrek
de5770c352 vmx: add fmt checking, fix fmt errors, remove duplication for vmdebug 2020-12-08 12:40:28 +01:00
Sigrid
07805ac892 nusb/kb: update button state if event was actually received, fix typos (thanks umbraticus) 2020-12-08 11:47:15 +01:00
Sigrid
3d9abd96ae devmouse: remove redundant check 2020-12-08 11:21:18 +01:00
Sigrid
e812aa617f mouse(3): blankS, setS to follow the convention (thanks umbraticus) 2020-12-08 10:34:10 +01:00
Sigrid
014bf3fe7c mouse(3): document "scrollswap" ctl message, fix style a bit (thanks umbraticus) 2020-12-08 10:21:17 +01:00