]> git.lizzy.rs Git - plan9front.git/log
plan9front.git
3 years agogit/send: pick minimal delta set correctly (thanks igor)
Ori Bernstein [Tue, 1 Jun 2021 01:02:23 +0000 (18:02 -0700)]
git/send: pick minimal delta set correctly (thanks igor)

We weren't giving all objects to the twixt() function, and
it was making bad life choices -- gambling, smoking, drinking,
and packing in too much data.

With more information, it doesn't do the last.

3 years agosdvirtio: accept multi-queue devices
Ori Bernstein [Mon, 31 May 2021 17:59:45 +0000 (10:59 -0700)]
sdvirtio: accept multi-queue devices

Sdvirtio supports multiple queues per device.
We only use one queue, but we shouldn't skip the
devices because of that.

3 years agogit/branch: ...all the debug prints.
Ori Bernstein [Mon, 31 May 2021 02:21:57 +0000 (19:21 -0700)]
git/branch: ...all the debug prints.

3 years agogit/branch: remove debug prints
Ori Bernstein [Mon, 31 May 2021 02:07:11 +0000 (19:07 -0700)]
git/branch: remove debug prints

3 years agogit/branch: reduce execs to sync working dir
Ori Bernstein [Mon, 31 May 2021 02:06:01 +0000 (19:06 -0700)]
git/branch: reduce execs to sync working dir

We were execing a lot to copy the data -- do less of it.

3 years agogit/fs: move mount point to $repo/.git/fs
Ori Bernstein [Mon, 31 May 2021 00:46:21 +0000 (17:46 -0700)]
git/fs: move mount point to $repo/.git/fs

Moving the mount point to within the repo
directory means that we can have multiple
git repos mounted at once with no conflict.

3 years agovac: add -t flag to exclude temporary files and directories (thanks foura)
cinap_lenrek [Sun, 30 May 2021 12:30:50 +0000 (14:30 +0200)]
vac: add -t flag to exclude temporary files and directories (thanks foura)

3 years ago[9front] vga: Add U+29FA DOUBLE PLUS (thanks jmi2k)
cinap_lenrek [Sun, 30 May 2021 12:26:28 +0000 (14:26 +0200)]
[9front] vga: Add U+29FA DOUBLE PLUS (thanks jmi2k)

3 years agomerge
cinap_lenrek [Sat, 29 May 2021 12:20:04 +0000 (14:20 +0200)]
merge

3 years agokernel: use 64-bit virtual entry point for expanded header, document behaviour in...
cinap_lenrek [Sat, 29 May 2021 12:18:35 +0000 (14:18 +0200)]
kernel: use 64-bit virtual entry point for expanded header, document behaviour in a.out(6)

For 64-bit architectures, the a.out header has the HDR_MAGIC flag set
in the magic and is expanded by 8 bytes containing the 64-bit virtual
address of the programs entry point. While Exec.entry contains physical
address for kernel images.

Our sysexec() would always use Exec.entry, even for 64-bit a.out binaries,
which worked because PADDR(entry) == entry for userspace pointers.

This change fixes it, having the kernel use the 64-bit entry point
and document the behaviour in the manpage.

3 years agozuke: treat toggle as play in stopped state
Sigrid [Fri, 28 May 2021 11:02:58 +0000 (13:02 +0200)]
zuke: treat toggle as play in stopped state

3 years agozuke: fix seeking in paused mode
Sigrid [Thu, 27 May 2021 05:47:10 +0000 (07:47 +0200)]
zuke: fix seeking in paused mode

3 years agomkpaqfs(8): allow setting compression level
cinap_lenrek [Sun, 23 May 2021 15:06:14 +0000 (17:06 +0200)]
mkpaqfs(8): allow setting compression level

3 years ago/sys/lib/kbmap/colemak: map capslock to backspace (thanks jacob wb)
cinap_lenrek [Thu, 20 May 2021 19:29:43 +0000 (21:29 +0200)]
/sys/lib/kbmap/colemak: map capslock to backspace (thanks jacob wb)

3 years agogit: add missing file
Ori Bernstein [Mon, 17 May 2021 20:46:44 +0000 (13:46 -0700)]
git: add missing file

Forgot to add common.rc in the initial commit.

3 years ago9pfid(2): document Srv* in Req (thanks kjn)
Ori Bernstein [Mon, 17 May 2021 16:17:22 +0000 (09:17 -0700)]
9pfid(2): document Srv* in Req (thanks kjn)

This struct member is available for any user of
the library, and is not part of our internal API.
It should be documented.

3 years agogit: got git?
Ori Bernstein [Mon, 17 May 2021 01:49:45 +0000 (18:49 -0700)]
git: got git?

Add a snapshot of git9 to 9front.

3 years agomemory(2): mention tsmemcmp (thanks kemal)
cinap_lenrek [Sat, 15 May 2021 10:40:11 +0000 (12:40 +0200)]
memory(2): mention tsmemcmp (thanks kemal)

3 years agoip/ftpd: Add explict and implicit FTPS support.
foura [Sun, 2 May 2021 14:29:43 +0000 (15:29 +0100)]
ip/ftpd: Add explict and implicit FTPS support.

Removed:
- Challenge reponse auth.
- Noworld login.
- Anonymous users writing files to /incoming.

3 years agolibpanel: fix text sliding around in libpanel text entry widgets.
james palmer [Thu, 13 May 2021 20:29:19 +0000 (21:29 +0100)]
libpanel: fix text sliding around in libpanel text entry widgets.

3 years agopc64: avoid getcr3() in mmuflushtlb()
cinap_lenrek [Wed, 12 May 2021 20:40:51 +0000 (22:40 +0200)]
pc64: avoid getcr3() in mmuflushtlb()

it turns out that calculating physical address of pml4 is faster
than reading the machine register, so pass it explicitely.

3 years agodevvmx: remove unncessary locking in gotcmd() sleep test function
cinap_lenrek [Wed, 12 May 2021 20:24:36 +0000 (22:24 +0200)]
devvmx: remove unncessary locking in gotcmd() sleep test function

3 years agovmx: fix 9p debug server and make it compatible to /proc
cinap_lenrek [Wed, 12 May 2021 16:17:06 +0000 (18:17 +0200)]
vmx: fix 9p debug server and make it compatible to /proc

The 9p debug server was broken as it assumed the first
tree file added would have a qid of 0 (it has a qid
of 1 as the root directory is using 0 already).

Instead, just compare File* pointers and get rid of
the table (less code).

When passing 64-bit unsigned addresses as 64-bit signed
file offsets, we have to make sure to not pass negative
offsets (filtered out by kernel and lib9p)!
This is solved by clearing and sign bit in encoding and
63-bit sign extension on decoding.

Make the mem file writable (needed for acid).

The 9p debug server provided a single directory containing
mem and regs files. This patch renames the regs file
(which is in vmx specific text format) to "xregs" and
adds "regs" and "kregs" file which use the same format
as exported by the kernels /proc filesystem.

This allows one to bind the vmx directory over a proc
directory and attach acid to a running system like:

mount -b /srv/vmx /proc/1
acid -k -lkernel 1 /sys/src/9/pc64/9pc64

3 years agovmx: avoid strdup() register names for register cache
cinap_lenrek [Wed, 12 May 2021 16:04:25 +0000 (18:04 +0200)]
vmx: avoid strdup() register names for register cache

If we tokenize the register file contents in a static buffer,
we can avoid having to duplicate the register names.

All callers to rpoke() provide constant register arguments
so they also do not need to be duplicated.

3 years agovmx: implement long mode page table translation
cinap_lenrek [Wed, 12 May 2021 16:00:46 +0000 (18:00 +0200)]
vmx: implement long mode page table translation

This allows vmx to translate virtual addresses to physical
when the gues runs in long mode.

3 years agoiwhois: add some improvements (thanks gall0ws)
cinap_lenrek [Sun, 9 May 2021 13:19:05 +0000 (15:19 +0200)]
iwhois: add some improvements (thanks gall0ws)

patch from gall0ws:

> It's impossible to get whois right and probably nobody cares about it,
> nevertheless this small patch fixes some issues with the current version:
>
> * use a more common filter for default boilerplate (useful when
>   following the referral chain)
> * updated boilerplate for *.co.uk *.net.uk *.org.uk
> * added case *.com *.net (got it from iana.org)
> * use ARIN for IPv6 addresses
> * when unsure, check first whether whois.nic.$tld exists otherwise
>   usual fallback to InterNIC
> * fixed regexp for the referral chain (case, extra spaces or /)

- add usage handling.

--
cinap

3 years agogames/opl3: use correct sampling rate
qwx [Wed, 5 May 2021 14:57:19 +0000 (16:57 +0200)]
games/opl3: use correct sampling rate

games/dmid uses the same sample rate as the chip for music, but other
applications do not.  opl3 and its older version opl2 (not in 9front)
read an input stream of commands in basically IMF format, something
used in other id Software games and some others, which assumes a
given input sampling rate:  700 Hz for Wolfenstein 3D music, 560 Hz
for Commander Keen, 60 Hz for Ultima 6, etc.

The opl3 emulation on the other hand is not really intended to run at
a sampling rate different that the chip's 49.716 kHz sampling rate.
Previously, we assumed it runs at 44.1 kHz and just used the input
rate as a divisor to get the number of samples per delay tic.

From what I understand, the correct way to use it for accurate
emulation is to run the opl chip emulator at its intended sampling
frequency, then downsample to 44.1 kHz.  This means better output
but more code.  The alternative is to basically do the same as
before rev 8433, except with no buffering, but at accuracy/quality
loss.  This change implements the former and just forks pcmconv to
deal with resampling.

3 years agomerge
cinap_lenrek [Tue, 4 May 2021 23:51:20 +0000 (01:51 +0200)]
merge

3 years agocpu: properly handle end of file in readstr()
cinap_lenrek [Tue, 4 May 2021 23:50:09 +0000 (01:50 +0200)]
cpu: properly handle end of file in readstr()

3 years agozuke(1): more fixes (thanks humm)
Sigrid [Tue, 4 May 2021 13:32:35 +0000 (15:32 +0200)]
zuke(1): more fixes (thanks humm)

3 years agozuke(1): engrish (thanks qwx)
Sigrid [Tue, 4 May 2021 13:21:44 +0000 (15:21 +0200)]
zuke(1): engrish (thanks qwx)

3 years agoadd zuke(1) manpage (thanks kemal & humm)
Sigrid [Tue, 4 May 2021 12:52:05 +0000 (14:52 +0200)]
add zuke(1) manpage (thanks kemal & humm)

3 years agolibtags: upstream updates
Sigrid [Mon, 3 May 2021 19:04:39 +0000 (21:04 +0200)]
libtags: upstream updates

3 years agoMail: remove message about cyclic threads
Ori Bernstein [Sat, 1 May 2021 19:33:31 +0000 (15:33 -0400)]
Mail: remove message about cyclic threads

They happen, and we break the cycle. There's nothing
the user can do, so there's no point in warning.

3 years agolib9p: remove Srv.srvfd, make postsrv() and threadpostsrv() return the mountable...
cinap_lenrek [Sat, 1 May 2021 17:58:58 +0000 (19:58 +0200)]
lib9p: remove Srv.srvfd, make postsrv() and threadpostsrv() return the mountable file descriptor, update documentation

Now that we have these new functions,
we can also make them return an error
instead of calling sysfatal() like
postmountsrv().

Remove the confusing Srv.srvfd, as it
is only temporarily used and return
it from postsrv() instead.

3 years agolib9p: remove unneccesary headers
cinap_lenrek [Sat, 1 May 2021 15:03:03 +0000 (17:03 +0200)]
lib9p: remove unneccesary headers

3 years agolib9p: expose Srv.forker handler and srvforker(), threadsrvforker() and threadsrv...
cinap_lenrek [Sat, 1 May 2021 14:37:00 +0000 (16:37 +0200)]
lib9p: expose Srv.forker handler and srvforker(), threadsrvforker() and threadsrv() functions

To use srvrease()/srvaquire() we need to have a way to spawn
new processes to handle the service loop. This functionality
was provided by the internal _forker() function which was
eigther rfork or libthread based implementation depending on
if postmountsrv() or threadpostmountsrv() where called.

For servers who want to use srv() directly, _forker would not
be initialized so srvrelease() could not be used.

To untangle this, we get rid of the global _forker handler
and put the handler in the Srv structure. Which will get
initialized (when nil) to eigther srvforker() or threadsrvforker()
depending on if the thread or non-thread entry points where used.

For symmetry, we provde new threadsrv() and threadpostsrv()
functions which handle the default initialization of Srv.forker.

This also allows a user to provide his own forker function,
maybe to conserve stack space.

To avoid dead code, we put each of these function in their
own object file. Note, this also allows a user to define its
own srvforker() symbol.

3 years agolibtags: use nelem
Sigrid [Fri, 30 Apr 2021 10:36:01 +0000 (12:36 +0200)]
libtags: use nelem

3 years agolibtags: trim text tags and ignore empty values
Sigrid [Thu, 29 Apr 2021 22:20:39 +0000 (00:20 +0200)]
libtags: trim text tags and ignore empty values

3 years agolibtags: modules: ignore empty title
Sigrid [Thu, 29 Apr 2021 21:35:52 +0000 (23:35 +0200)]
libtags: modules: ignore empty title

3 years agolibtags: use CP437 as the default encoding for module formats
Sigrid [Thu, 29 Apr 2021 19:44:06 +0000 (21:44 +0200)]
libtags: use CP437 as the default encoding for module formats

3 years agoopl3(1), exec(2): fix manpage typos (thanks umbraticus)
qwx [Tue, 27 Apr 2021 14:08:06 +0000 (16:08 +0200)]
opl3(1), exec(2): fix manpage typos (thanks umbraticus)

3 years agogames/opl3: don't buffer output and simplify (thanks umbraticus)
qwx [Tue, 27 Apr 2021 07:48:14 +0000 (09:48 +0200)]
games/opl3: don't buffer output and simplify (thanks umbraticus)

this fixes real-time applications.

-n previously specified a rate divisor rather than the rate itself,
which was used for specific applications outside of 9front.  instead,
just set the rate directly, more useful and straightforward.

3 years agofile: partially revert 8419 to detect <?xml as html
Sigrid [Sun, 25 Apr 2021 19:49:01 +0000 (21:49 +0200)]
file: partially revert 8419 to detect <?xml as html

3 years agokernel: clean up Mach structure
cinap_lenrek [Sun, 25 Apr 2021 15:41:34 +0000 (17:41 +0200)]
kernel: clean up Mach structure

Remove unused fields and factor common fields into a
new PMach struct in port/portdat.h.

The fields machno, splpc and proc are not moved to
PMach as they are part of the known offsets from
assembly (l.s).

3 years agobcm: try ATAGS/DTB pointer from R2 on entry
cinap_lenrek [Sun, 25 Apr 2021 15:36:11 +0000 (17:36 +0200)]
bcm: try ATAGS/DTB pointer from R2 on entry

3 years agorio: avoid re-triggering clicks on resize/hide/unhide and send wctl when focus is...
cinap_lenrek [Sun, 25 Apr 2021 10:41:20 +0000 (12:41 +0200)]
rio: avoid re-triggering clicks on resize/hide/unhide and send wctl when focus is lost

3 years agoresample: improve performance (thanks José Miguel Sánchez García)
cinap_lenrek [Sun, 25 Apr 2021 10:16:40 +0000 (12:16 +0200)]
resample: improve performance (thanks José Miguel Sánchez García)

Resample is well known for taking a long time to resize an image. This
patch brings an important performance boost (in my test image, time
was reduced from ~2850ms to ~500ms). It does that by extracting FP
multiplication and division out of the innermost loop of
resamplex/resampley.

The results differ slightly from the current implementation: in my
test: ~0.3% of the bytes had a ±2 difference in their value, which I
attribute to rounding errors. I'm personally not concerned with that
deviation, given the performance gains. However, I recommend testing
it just to be sure I didn't overlook anything.

José Miguel Sánchez García

3 years agolibtags, zuke: add *.mod support (thanks kemal)
Sigrid [Sat, 24 Apr 2021 14:07:24 +0000 (16:07 +0200)]
libtags, zuke: add *.mod support (thanks kemal)

3 years agozuke: fix middle-click restarting playback if held while mouse pointer is moving
Sigrid [Fri, 23 Apr 2021 09:20:30 +0000 (11:20 +0200)]
zuke: fix middle-click restarting playback if held while mouse pointer is moving

3 years agozuke: fix position formatter using a wrong type
Sigrid [Thu, 22 Apr 2021 06:40:50 +0000 (08:40 +0200)]
zuke: fix position formatter using a wrong type

3 years agomerge
cinap_lenrek [Wed, 21 Apr 2021 14:58:27 +0000 (16:58 +0200)]
merge

3 years agovgadb: revert previous commit, the pci device id 8086/1c3a is the embedded controller!
cinap_lenrek [Wed, 21 Apr 2021 14:57:13 +0000 (16:57 +0200)]
vgadb: revert previous commit, the pci device id 8086/1c3a is the embedded controller!

3 years agoplumber: fix substrings in match rules
Humm [Wed, 21 Apr 2021 06:28:32 +0000 (08:28 +0200)]
plumber: fix substrings in match rules

Unmatched substrings are nil, so we can't rely on nil terminating the
array of substrings.

3 years agonusbrc: rndis with csp 0104ef
Sigrid [Tue, 20 Apr 2021 16:12:54 +0000 (18:12 +0200)]
nusbrc: rndis with csp 0104ef

3 years agonusb/ether: rndis: add standard class code (tested by jmi2k with OnePlus 8)
Sigrid [Tue, 20 Apr 2021 16:08:58 +0000 (18:08 +0200)]
nusb/ether: rndis: add standard class code (tested by jmi2k with OnePlus 8)

3 years agofile: recognize executable scripts, etc.
kemal [Mon, 19 Apr 2021 23:40:31 +0000 (01:40 +0200)]
file: recognize executable scripts, etc.

The patch does the following:

1. Adds recognition of executable script (shebang) files.
2. Returns correct MIME type for mbox files (RFC 4155).
3. Returns XML instead of HTML type in some cases.

3 years agodevloopback: fix wrong device character (thanks romano)
cinap_lenrek [Sun, 18 Apr 2021 14:20:04 +0000 (16:20 +0200)]
devloopback: fix wrong device character (thanks romano)

devloopback was changed from using #X to #λ awhile ago; one bit was missed.

3 years agopatch for imap when imap fails
unobe [Sun, 18 Apr 2021 01:52:11 +0000 (18:52 -0700)]
patch for imap when imap fails
changeset:   8411:19f6a88ea241
branch:      mbp-2011
user:        Romano <unobe@cpan.org>
date:        Sat Apr 17 14:35:21 2021 -0700
files:       sys/src/cmd/upas/fs/imap.c
description:
When an imap fetch fails, it's helpful at times to know the underlying
cause.  This provides more details by providing the underlying error
message.

3 years agoMail: remove impliicit headers (thanks unobe)
Ori Bernstein [Sun, 18 Apr 2021 01:46:02 +0000 (18:46 -0700)]
Mail: remove impliicit headers (thanks unobe)

Setting headers from Mail can cause conflicts
with the headers that upas/marshal adds when
sending attachments.

So, let's not set them.

3 years agoacme: fix border size, autoindent undo: imported from plan9port (thanks jxy)
Ori Bernstein [Thu, 15 Apr 2021 03:30:24 +0000 (20:30 -0700)]
acme: fix border size, autoindent undo: imported from plan9port (thanks jxy)

origin:

https://github.com/9fans/plan9port/pull/493
https://github.com/9fans/plan9port/pull/489
https://github.com/9fans/plan9port/pull/461

3 years agozuke: include libtags in CFLAGS
Sigrid [Tue, 13 Apr 2021 13:55:19 +0000 (15:55 +0200)]
zuke: include libtags in CFLAGS

3 years agozuke: remove -G option (old playlists not supported anymore)
Sigrid [Tue, 13 Apr 2021 11:28:31 +0000 (13:28 +0200)]
zuke: remove -G option (old playlists not supported anymore)

3 years agoremove juke (use play or zuke instead)
Sigrid [Tue, 13 Apr 2021 11:25:24 +0000 (13:25 +0200)]
remove juke (use play or zuke instead)

3 years agoaudio/: zuke, mkplist, readtags
Sigrid [Tue, 13 Apr 2021 11:20:27 +0000 (13:20 +0200)]
audio/: zuke, mkplist, readtags

3 years agoremove old, broken scripts: fedex, u(s)ps, weather (thanks fulton)
Sigrid [Tue, 13 Apr 2021 09:26:55 +0000 (11:26 +0200)]
remove old, broken scripts: fedex, u(s)ps, weather (thanks fulton)

3 years agoMail: correctly track the number of messages (thanks igor)
Ori Bernstein [Mon, 12 Apr 2021 16:22:48 +0000 (09:22 -0700)]
Mail: correctly track the number of messages (thanks igor)

We forgot to update the message count when deleting
messages in mail, meaning we could access trailing
messages that had been freed.

3 years agocrop: allow no-ops for pipelines
qwx [Mon, 12 Apr 2021 08:29:54 +0000 (10:29 +0200)]
crop: allow no-ops for pipelines

unlike other tools like iconv(1), a crop(1) without arguments or with
ones resulting in a no-op, like `-t 0 0', errors out.  other options
like `-i 0' do not error.  this breaks assumptions and results in
tedious intermediary steps or hacks like:

foo | {crop -t $1 $2 >[2]/null || cat} > baz.bit

instead, just ignore the check.  subsequent code doesn't make
assumptions on that.

3 years agoip/tftpd: add a syslog message about what error we return to the client on a NAK
cinap_lenrek [Sun, 11 Apr 2021 21:58:30 +0000 (23:58 +0200)]
ip/tftpd: add a syslog message about what error we return to the client on a NAK

3 years agoip/dhcpd: work around raspberry pi pxe firmware by providing dhcp option 66
cinap_lenrek [Sun, 11 Apr 2021 18:20:41 +0000 (20:20 +0200)]
ip/dhcpd: work around raspberry pi pxe firmware by providing dhcp option 66

The raspberry pi 4 PXE firmware insists on finding the tftp
server address by parsing dhcp option 66 as an ip address
string.

3 years agoip/ipconfig: ODtftpserver (dhcp option 66) is of type string
cinap_lenrek [Sun, 11 Apr 2021 18:18:03 +0000 (20:18 +0200)]
ip/ipconfig: ODtftpserver (dhcp option 66) is of type string

3 years agotermrc, cpurc: silence /net/ether* error message when there are no ethernet devices
cinap_lenrek [Sat, 10 Apr 2021 13:01:09 +0000 (15:01 +0200)]
termrc, cpurc: silence /net/ether* error message when there are no ethernet devices

3 years agolibthread: generate correct acid files
Humm [Fri, 9 Apr 2021 14:48:07 +0000 (16:48 +0200)]
libthread: generate correct acid files

/sys/src/cmd/mksyslib uses `{basename $stem .$objtype}^.c to get the
source file name for *.acid files.  /sys/lib/acid/thread expects
sched.$objtype.acid.  This lets /sys/src/libthread/mkfile generate
that file.

3 years agopage: fix for kerTeX dvi
Humm [Fri, 9 Apr 2021 14:40:56 +0000 (16:40 +0200)]
page: fix for kerTeX dvi

3 years agodisk/fdisk: add OpenBSD partition type
Humm [Fri, 9 Apr 2021 14:11:48 +0000 (16:11 +0200)]
disk/fdisk: add OpenBSD partition type

3 years agoprintfont: load all fonts for `printfont all`
Humm [Fri, 9 Apr 2021 14:09:31 +0000 (16:09 +0200)]
printfont: load all fonts for `printfont all`

3 years agotrofftable.rc: make work
Humm [Fri, 9 Apr 2021 14:05:30 +0000 (16:05 +0200)]
trofftable.rc: make work

3 years agog: add lua, mk, ml, mli, myr, and sh suffixes
kvik [Fri, 9 Apr 2021 01:18:53 +0000 (03:18 +0200)]
g: add lua, mk, ml, mli, myr, and sh suffixes

3 years agonusbrc: ignore rndis ethernet in /rc/bin/nusbed, handled by /sys/src/9/boot/nusbrc...
cinap_lenrek [Thu, 8 Apr 2021 19:57:24 +0000 (21:57 +0200)]
nusbrc: ignore rndis ethernet in /rc/bin/nusbed, handled by /sys/src/9/boot/nusbrc (thanks romano)

3 years agominor man page typos
Romano [Thu, 8 Apr 2021 19:42:31 +0000 (21:42 +0200)]
minor man page typos

3 years agovgadb: igfx: add vid/did for early 2011 apple mbp (thanks Romano)
Sigrid [Wed, 7 Apr 2021 10:21:06 +0000 (12:21 +0200)]
vgadb: igfx: add vid/did for early 2011 apple mbp (thanks Romano)

3 years ago[9front] walk: properly format permissions
Stephen Gregoratto [Tue, 6 Apr 2021 12:43:38 +0000 (14:43 +0200)]
[9front] walk: properly format permissions
This patch adds dirmodefmt from fcall.h to pretty-print file
permissions, similarly to ls -l. I didn't notice any performance
degradation.

I hope no-one relied on the old behaviour.

3 years agofile: detect webp files (thanks kemal)
cinap_lenrek [Sat, 3 Apr 2021 17:32:47 +0000 (19:32 +0200)]
file: detect webp files (thanks kemal)

this patch adds a small check to the "iff" function, so this
way file can detect webp files. tested with a webp file i
found randomly.

3 years agogames/glendy: your complication had a complication (god damn it kemal)
cinap_lenrek [Fri, 2 Apr 2021 20:23:40 +0000 (22:23 +0200)]
games/glendy: your complication had a complication (god damn it kemal)

3 years agogames/glendy: don't use lucida sans in menus by default and bugfix (thanks kemal)
cinap_lenrek [Fri, 2 Apr 2021 20:05:15 +0000 (22:05 +0200)]
games/glendy: don't use lucida sans in menus by default and bugfix (thanks kemal)

i have found one bug. when i put glenda in a position like this

i somehow win, but the glenda can escape from there.

in addition, i have changed the games manpage to include more info about glendy.

3 years agokernel: get rid of physical page bank array and use conf.mem[] instead
cinap_lenrek [Fri, 2 Apr 2021 18:23:25 +0000 (20:23 +0200)]
kernel: get rid of physical page bank array and use conf.mem[] instead

We can take advantage of the fact that xinit() allocates
kernel memory from conf.mem[] banks always at the beginning
of a bank, so the separate palloc.mem[] array can be eleminated
as we can calculate the amount of non-kernel memory like:

upages = cm->npage - (PGROUND(cm->klimit - cm->kbase)/BY2PG)

for the number of reserved kernel pages,
we provide the new function: ulong nkpages(Confmem*)

This eleminates the error case of running out of slots in
the array and avoids wasting memory in ports that have simple
memory configurations (compared to pc/pc64).

3 years agowhois: suppress missing file errors (thanks kivik)
cinap_lenrek [Fri, 2 Apr 2021 15:26:34 +0000 (17:26 +0200)]
whois: suppress missing file errors (thanks kivik)

3 years agoacme: fix suicide *and* resource leak in ecmd.c (thanks igor)
cinap_lenrek [Fri, 2 Apr 2021 13:51:15 +0000 (15:51 +0200)]
acme: fix suicide *and* resource leak in ecmd.c (thanks igor)

To reproduce the suicide try running the following in acme:

• 'Edit B <ls lib'

by select and middle clicking in a window that is in your $home.

There is a very high chance acme will commit suicide like this:

<snip>
cpu% broke
echo kill>/proc/333310/ctl # acme
cpu% acid 333310
/proc/333310/text:amd64 plan 9 executable
/sys/lib/acid/port
/sys/lib/acid/amd64
acid: lstk()
edittext(nr=0x31,q=0x0,r=0x45aa10)+0x8 /sys/src/cmd/acme/ecmd.c:135
xfidwrite(x=0x461230)+0x28a /sys/src/cmd/acme/xfid.c:479
        w=0x0
        qid=0x5
        fc=0x461390
        t=0x1
        nr=0x100000031
        r=0x45aa10
        eval=0x3100000000
        a=0x405621
        nb=0x500000001
        err=0x419310
        q0=0x100000000
        tq0=0x80
        tq1=0x8000000000
        buf=0x41e8d800000000
xfidctl(arg=0x461230)+0x35 /sys/src/cmd/acme/xfid.c:52
        x=0x461230
launcheramd64(arg=0x461230,f=0x22357e)+0x10 /sys/src/libthread/amd64.c:11
0xfefefefefefefefe ?file?:0
</snap>

The suicide issue is caused by the following chain of events:

• /sys/src/cmd/acme/ecmd.c:/^edittext is called at
/sys/src/cmd/acme/xfid.c:479 passing nil as its first parameter:

<snip>
...
        case QWeditout:
                r = fullrunewrite(x, &nr);
                if(w)
                        err = edittext(w, w->wrselrange.q1, r, nr);
                else
                        err = edittext(nil, 0, r, nr);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
</snap>

...and /sys/src/cmd/acme/ecmd.c:/^edittext dereferences the
first parameter that is *nil* at the first statement:

<snip>
char*
edittext(Window *w, int q, Rune *r, int nr)
{
        File *f;

        f = w->body.file;
^^^^^^^^^^^^^^^^^^^^^
This will crash if 'w' is *nil*

        switch(editing){
...
</snap>

Moving the the derefernce of 'w' into the case where it is
needed (see above patch) fixes the suicude.

The memory leak is fixed in /sys/src/cmd/acme/ecmd.c:/^filelist.  The
current implementation of filelist(...) breaks its contract with its
caller, thereby leading to a memory leak in /sys/src/cmd/acme/ecmd.c:/^B_cmd
and /sys/src/cmd/acme/ecmd.c:/^D_cmd.

The contract /sys/src/cmd/acme/ecmd.c:/^filelist seems to have with
its callers is that in case of success it fills up a 'collection' that
callers can then clear with a call to clearcollection(...).

The fix above honours this contract and thereby removes the leak.

After you apply the patch the following two tests should succeed:

• Execute by select and middle click in a Tag:
        'Edit B lib/profile'

• Execute by select and middle click in a Tag:
        'Edit B <ls lib'

The former lead to a resource leak that is now fixed.

The latter lead to a suicide that is now fixed by moving the statement
that dereferences the parameter to the location where it is needed,
which is not the path used in the case of 'Edit B <ls'.

Cheers,
Igor

3 years ago[9front] [patch] nusb/ether -t rndis
Romano [Thu, 1 Apr 2021 10:54:08 +0000 (12:54 +0200)]
[9front] [patch] nusb/ether -t rndis

3 years agomerge
cinap_lenrek [Wed, 31 Mar 2021 15:50:25 +0000 (17:50 +0200)]
merge

3 years agodevfs: fix locking and ignore undocumented "fsdev:\n" configuration signature
cinap_lenrek [Wed, 31 Mar 2021 15:49:10 +0000 (17:49 +0200)]
devfs: fix locking and ignore undocumented "fsdev:\n" configuration signature

The confstr was shared between readers so seprintconf() could
write concurrently to that buffer which is not safe.

This replaces the shared static confstr[Maxconf] buffer with a
pointer that is initially nil and a buffer that is alloced on
demand.

The new confstr pointer (and buffer) is now only updated while
wlock()ed from the new setconfstr() function.

This is now done by mconfig() / mdelctl() just before releasing
the wlock.

Now, rdconf() will check if confstr has been initialized, and
test for it again while wlock()ed; making sure the configuration
is read only once.

Also, rdconf() used to check for a undocumented "fsdev:\n" string
at the beginning of config data tho that was never documented.

This changes mconfig() to ignore that particular signature so
the example from the manpage will work as documented.

3 years agomerge
Ori Bernstein [Mon, 29 Mar 2021 16:29:35 +0000 (09:29 -0700)]
merge

3 years agolibsunrpc: work around arm64 compiler bug in sunStringUnpack()
cinap_lenrek [Mon, 29 Mar 2021 15:13:50 +0000 (17:13 +0200)]
libsunrpc: work around arm64 compiler bug in sunStringUnpack()

The sunStringUnpack() routine was miscompiled by 7c, as
pointer arithmetic is done in 64 bit but the constant -1
offset got expended to a unsigned 32 bit integer.

3 years agokbmap/tr: add one missing key to Turkish keymap (thanks kemal)
Ori Bernstein [Wed, 24 Mar 2021 03:49:07 +0000 (20:49 -0700)]
kbmap/tr: add one missing key to Turkish keymap (thanks kemal)

while we're here, change the hex values to  unicode chars.

3 years agolegal: mit neuer lizenz: mit
Ori Bernstein [Tue, 23 Mar 2021 23:33:32 +0000 (16:33 -0700)]
legal: mit neuer lizenz: mit

The Plan 9 foundation has ownership of the Plan 9 code now,
and has made it accessible under the MIT license, so we're
taking that version of the code as our base now.

3 years agokernel: remove ucalloc.c duplicates
cinap_lenrek [Sat, 13 Mar 2021 13:57:53 +0000 (14:57 +0100)]
kernel: remove ucalloc.c duplicates

3 years agokernel: use 64-bit mask to avoid compiler warning in port/pci.c
cinap_lenrek [Sat, 13 Mar 2021 13:20:00 +0000 (14:20 +0100)]
kernel: use 64-bit mask to avoid compiler warning in port/pci.c

3 years ago5c, 6c, 7c, 8c, kc, qc, vc: use explicit gmove(... , nn) in cgen() for result of...
cinap_lenrek [Sat, 13 Mar 2021 12:56:40 +0000 (13:56 +0100)]
5c, 6c, 7c, 8c, kc, qc, vc: use explicit gmove(... , nn) in cgen() for result of OAS*, OPREINC, OPOSTINC

The expression value of the assignment operation was
returned implicitely by relying on regalloc() on the
right hand side "nod" borrowing the register from nn.

But this only works if nn is a register.

In case of 6c, it can also be a ONAME from a .safe
rathole returned by regsalloc().

This change adds explicit gmove() calls to assign the
expression value. Note that gmove() checks if source
and destination are the same register so it wont emit
redundant move operations in the common case.

The same is applied also to OPREINC and OPOSTINC operations.

3 years agoaudio(1): fix little typo.
rgl [Sat, 13 Mar 2021 08:47:48 +0000 (09:47 +0100)]
audio(1): fix little typo.

3 years agocorrect off-by-one nul termination.
rgl [Thu, 11 Mar 2021 18:37:44 +0000 (19:37 +0100)]
correct off-by-one nul termination.