Commit graph

11 commits

Author SHA1 Message Date
Ori Bernstein 1047b53efc ape/libap: fix _startbuf, check rfork return (thanks pixelherodev)
When _startbuf is invoked, it would crash on the second invocation
if creating a mux segment failed. This is because the first attempt
would assign the return value -1 to the global mux variable, and
the second attempt would notice that the global mux was not nil,
and would attempt to use it.

This change only assigns to the global variable if the allocation
of the segment was a success.

While we're here, we should also check the return of the rfork call.
2021-01-19 19:56:38 -08:00
Ori Bernstein d4bc9052be Turn on warnings when building libap.
For ape, we never enabled warnings in cflags.
Turning it on brings up a lot of warnings. Most are noise,
but a few caught unused variables and trunctaions of pointers.
to smaller integers (int, long).

A few warnings remain.
2019-06-21 10:00:58 -07:00
cinap_lenrek 389d6a1054 ape: change types from unsigned long to void* for rendezvous() and segattach()/segbrk() (erik), use uniqueue rendezvous tags for _buf and listen 2013-05-11 18:34:40 +02:00
ppatience0 36287edc88 ape: remove unused variables 2013-05-06 20:51:18 -04:00
cinap_lenrek 9de8d61fe6 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.
2013-05-03 19:34:48 +02:00
cinap_lenrek d1905d8063 ape: remove unused variables from _buf (from erik qunastros _bufupd patch) 2013-05-03 13:46:27 +02:00
cinap_lenrek 631aef280d ape: fix thread race with close() and select()
in ape close(), do the real filedescriptor _CLOSE() *after* we cleared
the _fdinfo[] slot because once closed, we dont own the slot anymore and
another process doing open() can trash the slot. make sure open() retuns
fd < OPEN_MAX.

double check in _startbuf() holding mux->lock if the fd is already buffered
preveting running double copyprocs on a fd.

dont zero the mux->rwant/ewant bitmaps at the end of select() as we do not
hold the mix->lock.

in _closebuf() kill copyproc while holding the mux->lock to make sure the
copyproc isnt holding it at the time it is killed. run kill() multiple times
to make sure the proc is gone.
2013-03-11 01:16:34 +01:00
cinap_lenrek 530a2bc5e9 ape: check for invalid filedescriptors in select() 2013-03-10 18:35:07 +01:00
cinap_lenrek 4f33c88a51 import updated compilers from sources 2012-07-30 19:11:16 +02:00
Taru Karttunen a9060cc06b Import sources from 2011-03-30 iso image - lib 2011-03-30 19:35:09 +03:00
Taru Karttunen e5888a1ffd Import sources from 2011-03-30 iso image 2011-03-30 15:46:40 +03:00