Commit graph

2069 commits

Author SHA1 Message Date
cinap_lenrek 4fdc7dbe9c fmt: improved version using less memory
functional identical, but uses different data structure.
instead of reading all words into memory, we read and
tokenize on demand keeping a simple linked list of words
to conume by further calls of getword(). once the list
is empty we read the next line, tokenize it and fill the
list up again. so we only need as mutch memory to hold
all the words of the longest line.
2012-10-23 02:08:35 +02:00
cinap_lenrek 22c7584780 devproc: fix another channel leak, move the cclose(c) from proctext() to procopen. 2012-10-22 21:59:52 +02:00
cinap_lenrek 6680d50d4b fix devproc text chan leak 2012-10-22 18:51:19 +02:00
cinap_lenrek 9ea332aac1 merge 2012-10-22 07:11:51 +02:00
cinap_lenrek 99216e0129 rio: fix deadlock
we can't really change the Window *input from
outside the winctl() thread. the problem is
that the window might end up reading the
mouse (scroll, select) which makes the w->cctl
channel block once you try to talk to the
window again (from the mousethread). this also
means we have to coordinate window switchin
from the winctl proc waiting for the current
window to release the input and then take over.
thers a new Winctl message Topped that basically
does that now using Wakeup and a chan to
synchronize.
2012-10-22 07:03:47 +02:00
stanley lieber 761f673032 pkg/list: handle werc directory listings 2012-10-21 21:44:53 -05:00
cinap_lenrek 54d2424a7c rio: fix cursor for sizing nocurrent window
wrepaint() used to also set the cursor for the window
if it was current. this reset the corner cursors on
bandresize when one tried to attempt to size a window
that was not current. make repaint just repaint the
window and border. set cursor explicitely for hold
toggle.
2012-10-21 18:27:43 +02:00
cinap_lenrek bf13408df2 rio: various fixes
use notefd in killprocs() insead of postnote() as the process
might'v exited. the notefd stays valid even if the particular
process it was originaly opend on exited. remove the Window.pid
field as its not needed.

dup() the notefd for interruptproc as the window might'v gone
away and closed the notefd file descriptor, resulting in us
writing to the wrong thing.

use snprint() instead of sprint() for safety.

fix bogus debug fprint().

add missing "visible" flushimage() after Reshaped winctl message
got handled. i assumed wsetname()/nameimage() would be enough,
it but does a invisible flush so softscreen doesnt get updated
immidiately.

do not make allocimage() failure in scrtemps() fatal. it wont
draw the window properly, but it gives the user a chance to
delete some windows to recover.
2012-10-21 17:00:12 +02:00
cinap_lenrek 5374d09d35 /sys/doc: permissions for cleanps, mkdirlist, mkfilelist 2012-10-20 19:09:54 +02:00
cinap_lenrek 8057e48ae1 rio: colors, flicker reduction, refresh after mouse close
allocate all the colors in iconinit(), remove unused ones
like grey. rename darkgrey to paletextcol because thats
what it is used for. new approach to window image allocation.
we allocate the window with DNofill and let the window fill
itself. this reduces flickering especially with (-b) option
and makes rio resize feel a lot faster.

wrefresh() didnt work. now fixed.
2012-10-20 15:51:32 +02:00
cinap_lenrek c33732a530 rio: wtop() after resize fix
wtop() checked w->topped == topped as a fast exit. if you
had the top most window not being current (== input) which
can happen when you delete the current window, then wtop would
after resize would not make the window current because it
is already top topmost one. wtopme() and wcurrent() both are
non-ops when window is already the topmost or window is already
current, so remove the check as its not needed. also topping
the window feels less sluggish.
2012-10-20 10:38:11 +02:00
cinap_lenrek 624c9f5112 rio: preserve window z-order on resize, fix race conditions
sort the window array by w->topped before reshaping all
windows. this preserves the window z-order.

remove implicit focus change on reshape/move. it called
wcurrent() in wtcl thread which might send a wctl message
to itself, bad... also we might not want to change focus
on reshape, like for the rio resize. so we set the input
window explicitely in all call sites.

window deletion was racy. wclosewin() destroys w->i, but
it is called outside the wctl thread so it might just
free the image under libframe doing some text selection.
this is fixed the following: add wclunk() function,
which basically just marks the window as deleted and
removes the reference from the window[] and hidden[]
arrays. (called on wclose() when refcount drops to
zero). wclosewin() now just frees the image and is only
called from the wctl thread on exit or when handing
the Deleted message.

get a reference to the window when doing sweeping or
moving as the filesystem might just clunk it under
us and we might end up sending wctl messages to
a Exited window.

wctl resize message has to fail if the window is not
current as it might be hidden... would also be annoying.
2012-10-20 22:42:01 +02:00
cinap_lenrek 558b9558d4 more generic way to deal with image chan conversion for resize/resample/rotate
this is to catch crazy color channels like k8a8 and the 15/16 bit
ones and CMAP. basically, just convert to RGBA32 or RGB24 depending
on if it has an alpha channel.
2012-10-18 20:17:12 +02:00
cinap_lenrek 0a3eb7d6b1 rio: copy window labels for menu3
as the menu is displayed, the window might go away or change its
label causing menuhit() to dereference bad memory. just strdup()
the labels before passing to menu3str to prevent accidents.
2012-10-18 18:51:32 +02:00
cinap_lenrek 3730a4df53 document urlencode in hget(1) 2012-10-18 15:23:40 +02:00
cinap_lenrek b5a6a26fd8 hpost: better handling of optional -u flag 2012-10-18 14:55:56 +02:00
cinap_lenrek 7c3ea4360b hpost: add -l flag to get location url after POST 2012-10-18 14:38:07 +02:00
cinap_lenrek 909efb22c5 /sys/src/cmd/auth/mkfile: fix lib.$O.a race 2012-10-18 03:49:40 +02:00
cinap_lenrek 1ee5cd7425 kernel: mnt cache rework
avoid double entries in the cache for copen() and properly handle
locking so we wont just give up if we cant lock the Mntcache entry,
but drop the cache lock, qlock the Mntcache entry, and then recheck
the cache.

general cleanup (cdev -> ccache, use eqchantdqid())
2012-10-17 15:48:30 +02:00
stanley lieber e51845797b fortunes, rob, rsc, troll: the war is over 2012-10-16 11:21:21 -05:00
cinap_lenrek fcacce0f2f kernel: duppage cleanup
remove the sched() call and retry loop from duppage() and just
drop the page lock, then reacquire it after lock(&palloc).
2012-10-16 16:10:26 +02:00
cinap_lenrek 45b99937be kernel: cachedel() lock order, lookpage, cleanup
the lock order of page.Lock -> palloc.hashlock was
violated in cachedel() which is called from the
pager. change the code to do it in the right oder
to prevent deadlock.

change lookpage to retry on false hit. i assume that
a false hit means:

a) we'r low on memory -> cached page got uncached/reused

b) duppage() got called on the page, meaning theres another
cached copy in the image now.

paging in is expensive compared to the hashtable lookup, so
i think retrying is better.

cleanup fixfault, adding comments.
2012-10-16 14:12:21 +02:00
cinap_lenrek 1335be8276 swap: track swap pages with > 255 references, setswapchan() swapimage.c
swaped pages use a 8bit refcount where as the Page uses a 16bit one.
this might be exploited with having a process having a single page
swaped out and then forking 255 times to make the swap map refcount
overflow and panic the kernel.

this condition is probably very rare. so instead of doubling the
size of the swap map, we add a single 32bit refcount swapalloc.xref
which will keep the combined refcount of all swap map entries who
exceeded 255 references.

zero swapimage.c in setswapchan() after closing it as the stat() call
below might error leaving a dangeling pointer.
2012-10-15 14:04:30 +02:00
cinap_lenrek 2f732e9a85 kernel: attachimage / exec error handling
attachimage()'s approach to handling newseg() error is flawed:

a) the the image is on the hash table, but ref is still 0, and
there is no segment/pages attached to it so nobody is going to
reclaim / putimage() it -> leak

b) calling pexit() would deadlock us because exec has acquired
up->seglock when calling attachimage(), so this would just deadlock.

the fix does the following:

attachimage() will putimage() and nexterror() if newseg() fails
instead of pexit(). this is less surprising.

exec now keeps the condition variable commit which is set once
we are commited / reached the point of no return and check this
variable in the highest waserror() handler and pexit() us there.

this way we have released up all the locks and pexit() will
cleanup.

note: this bug shouldnt us hit in with the current newseg()
implementation as it uses smalloc() which would wait to
satisfy the allocation instead of erroring.
2012-10-14 19:48:46 +02:00
cinap_lenrek fef6ff96ad update fshalt(8) manpage 2012-10-14 13:33:10 +02:00
cinap_lenrek 143fcc0a42 formpost becomes hpost 2012-10-14 06:28:58 +02:00
cinap_lenrek 45c0c41280 urlencode: fix /fd/0 use 2012-10-13 15:35:39 +02:00
cinap_lenrek 68537b7e96 ircrc: fix spurious autojoin 2012-10-12 19:13:34 +02:00
stanley lieber 324ab59b08 ircrc(1): man page fixes, thanks pap 2012-10-12 09:17:47 -05:00
stanley lieber 2f83fa7f74 hget(1): fix man page errors, add another example 2012-10-11 22:06:11 -05:00
cinap_lenrek fe13029eb4 ircrc: various improvements (thanks again pap!)
the -t option was ineffective. this fixes is.

fix incompatibility with 9vx as its tcp/status
file returns slightly different format than
Plan 9.

strip annoying  character from nickserv.
2012-10-12 01:05:34 +02:00
stanley lieber b786ff0544 add /rc/bin/formpost; add formpost to hget(1) man page 2012-10-11 16:37:48 -05:00
cinap_lenrek 5cddd21627 cifsd: fix 64bit fileoffset bug
the low 32bit word got *sign-extended* on vlong conversion. m(
2012-10-11 21:38:54 +02:00
stanley lieber 05a0570970 ircrc(1): fix error 2012-10-11 11:34:15 -05:00
stanley lieber 1ef8bffd3c add /sys/man/1/ircrc, thanks pap 2012-10-11 11:31:40 -05:00
cinap_lenrek 16d61d3c97 kernel: try to catch some (rare) mistakes
kstrcpy() did not null terminate for < 4 byte buffers. fixed,
but i dont think there is any case where this can happen in
practice.

always set malloctag in kstrdup(), cleanup.

always use ERRMAX bounded kstrcpy() to set up->errstr, q->err
and note[]->msg. paranoia.

instead of silently truncating interface name in netifinit(),
panic the kernel if interface name is too long as this case
is clearly a mistake.

panic kernel when filename is too long for addbootfile() in
devroot. this might happen if your kernel configuration is
messed up.
2012-10-11 17:29:16 +02:00
cinap_lenrek d9394b0d87 6in4: fix exit status, less strict src filtering, logging (import from sources) 2012-10-11 13:21:30 +02:00
cinap_lenrek 73e7e47d5b kenrel: simplify image cache by use of ccloseq() 2012-10-10 08:22:35 +02:00
cinap_lenrek ca9f286b6c vncv: cleanup 2012-10-09 16:22:19 +02:00
cinap_lenrek 6f2ea28817 vncv: fork tcs with RFNOWAIT as we dont collect wait message 2012-10-09 15:26:45 +02:00
cinap_lenrek 3cc39a0ac7 vncv: snarfvers race, silly walks, add -l option for clipboard charset 2012-10-09 15:15:57 +02:00
cinap_lenrek 14817c4991 /sys/lib/acid/kernel: fix imagecache() and procenv() 2012-10-09 03:52:18 +02:00
cinap_lenrek e52677328b merge 2012-10-09 03:23:21 +02:00
cinap_lenrek eb13b7debc /sys/lib/acid/kernel: needacid("chan") 2012-10-09 03:22:28 +02:00
aiju 4048ceedd6 fortunes 2012-10-08 22:14:19 +02:00
stanley lieber 8b24e40e29 netaudit(8): english 2012-10-07 22:06:47 -05:00
cinap_lenrek b2f404e70b content-driven bullshit 2012-10-08 01:57:52 +02:00
cinap_lenrek df66638fb5 netaudit changes and manual page 2012-10-08 00:56:00 +02:00
stanley lieber e598b6dd31 hjfs(8): fix wording 2012-10-07 15:09:04 -05:00
stanley lieber 104c0eaf29 fortunes, rsc, rob: more 2012-10-07 14:40:29 -05:00