If you run this:
{for (i in `{seq 1 70000}) echo '½•α·'} | mc | wc
mc will eventually suicide. The error comes from
/sys/src/libdraw/font.c:/^agefont which assumes it has a
display. Normally, this is set up by geninitdraw (usually
via initdraw), but mc.c avoids that to avoid the screen
redraws (flicker, at a minimum, but worse in long-running
cases).
graphics(2) does not prohibit this use, so I made the least
intrusive change to make it work.
cinap_lenrek [Sat, 25 May 2013 20:44:19 +0000 (22:44 +0200)]
kernel: fix floating point exceptions (was broken by sse kernel changes)
the fpenv() instruction stores in x87 format, using mathstate()
would interpret fpsave as FPssestate in case it was enabled!
instead, pass the status word and fppc explicitely to mathnote()
in matherror().
get rid of m->fpsavealign buffer, as we can just use FPssesave struct
which has enougth padding so rounding up base pointer will not overflow.
cinap_lenrek [Mon, 20 May 2013 21:55:38 +0000 (23:55 +0200)]
use resrcwait() when waiting for memory to become available
use resrcwait() when waiting for memory to become available. randomize
the sleep time and properly restore old process status in case tsleep()
gets interrupted.
cinap_lenrek [Sun, 19 May 2013 18:59:55 +0000 (20:59 +0200)]
devsd: don't raise Enomem error if sdmalloc() fails, instead wait for the memory to become available
filesystems do not handle i/o errors well (cwfs will abandon the blocks),
and temporary exhaustion of kernel memory (because of too many i/o's in
parallel) causes read and write on the partition to fail.
i think it is better to wait for the memory to become available in
this case. the single allocation is at max SDmaxio bytes, which makes
it likely to become available. if we havnt even enought fo that, then
rebooting the machine would be the best option. (aux/reboot)
cinap_lenrek [Sat, 11 May 2013 18:54:50 +0000 (20:54 +0200)]
devmnt: fix mount device leak and allocation error handling in mntversion()
the fist problem is that qopen() might return nil and that kstrdup() will
sleep, so we should try to avoid holding the mntalloc lock. so we move
the kstrdup() and qopen() calls before the Mnt allocation, and properly
recover the memory if we fail later.
the second problem was that we error(Eshort) after we already created the Mnt
when returnlen < sizeof(f.version). this check has to happen *before* we
even attempt to allocate the Mnt structures. note that we only copy the
version string once everything is in the clear, so the semantics of the
user buffer not being modified in case of error is not changed.
a little cleanup in muxclose(), getting rid of mntptfree()...
pread does not guarantee that it would read all the data asked for.
But acme usage of disk assumes that. This issues as many reads as
needed to make acme work when read returns less data than it wanted.
ppatience0 [Wed, 8 May 2013 21:47:48 +0000 (17:47 -0400)]
samterm: move cursor to next tabstop or non-space character before backspacing in spaces mode. this makes it less annoying to backspace (it's more like tabs).
cinap_lenrek [Sun, 5 May 2013 23:15:46 +0000 (01:15 +0200)]
pbs: allow 9bootfat start cluster beyond 0xFFFF
pbs failed to load (silently loading garbage) 9BOOTFAT from start
cluster beyond FFFF because we ignored the low word from the
directory entry. now taking the high 16 bit of the directory's
start cluster into account.
cinap_lenrek [Sun, 5 May 2013 02:28:50 +0000 (04:28 +0200)]
devip: dont raise error() out of Fsprotocone()
Fsprotoclone() is not supposed to raise error, but return nil.
ipopen() seemed to assume otherwise as it setup error label
before calling Fsprotoclone(). fix ipopen(), make Fsprotoclone()
return nil instead of raising error.
cinap_lenrek [Sun, 5 May 2013 01:56:11 +0000 (03:56 +0200)]
devip: handle malloc errors, fix queue leaks
Fsprotocone():
qopen() and qbypass() can fail and return nil, so make sure
the connection was not partially created by checking if read
and write queues have been setup by the protocol create hanler.
on error, free any resources of the partial connection and
error out.
cinap_lenrek [Sat, 4 May 2013 18:36:28 +0000 (20:36 +0200)]
libdraw: fix font f->cacheimage nil dereference
the initial fontresize() might fail but its error code is ignored
potentially leaving f->cacheimage == nil. make sure we call
fontresize() in loadchar() when theres no cacheimage and check the
return value to avoid nil pointer dereference.
cinap_lenrek [Fri, 3 May 2013 17:34:48 +0000 (19:34 +0200)]
ape: get rid of fixed MUXADDR for buffered i/o
instead of trying to resize the segment (which will not work when
the kernel picks the address as it will allocate right before
the base of the topmost segment), we create the mux segment with the
maximum size needed (arround 1.4MB) for OPEN_MAX filedescriptors.
buf slots will be reused and slots get demand paged once used.
cinap_lenrek [Wed, 1 May 2013 16:50:07 +0000 (18:50 +0200)]
aoe: updating aoe driver from erik quanstros 9atom
1 the config string was grabbed Aoehsz too far into the packet due to using the wrong pointer to start.
2 never accept a response with tag Tmgmt or Tfree.
3 defend against "malicious" responses; ones with a response Aoehdr.type != request Aoehdr.type. this previously could
cause the initiator to crash.
4 vendor commands were improperly filtered out.
5c: dont emit conditional integer division instructions
the integer division instructions are emulated with _div()
function patched in by 5l which does not handle conditional
execution. so do not optimize away the branch in that case.