summaryrefslogtreecommitdiff
path: root/sys/src/ape/lib/ap/plan9
AgeCommit message (Collapse)Author
2020-12-23ape: re-implement getlogin() by stating /proc/$pid/statuscinap_lenrek
2020-12-19libc: implement getppid() reading /proc/$pid/ppid instead of /dev/ppidcinap_lenrek
The devcons driver is really the wrong place to serve per process information.
2020-03-09fix alignment in ape mallocOri Bernstein
We used to have a padding int in the structure after the next pointer, to align it to 16 bytes. On 64 bit architectures, the pointer was already 8 bits, so the padding misaligned things to 20 bytes. This fixes it so that we're explcit about the data alignment we want, instead of hoping that the various sizes line up.
2019-06-24ape: reimplement rename() - fixing compiler warnings and handling more error ↵cinap_lenrek
cases handle empty filename, dot and dotdot. handle mismatching from/to directory/file type. cleanup destination file on error. error when attempting to copy non-empty directories. little test program: #include <unistd.h> #include <stdio.h> int main(int argc, char *argv[]) { if(argc != 3){ fprintf(stderr, "usage: %s old new\n", argv[0]); return 1; } if(rename(argv[1], argv[2])){ perror("rename"); return 1; } return 0; }
2019-06-23ape: revert rename() changecinap_lenrek
new implementation gets stuck in a infinite loop. backing this out for now.
2019-06-21Turn on warnings when building libap.Ori Bernstein
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-05-10ape: fix malloc to deal with more than 4GB of memory on 64 bit systemscinap_lenrek
2018-07-03ape: fix MAXSIGspew
2018-07-01ape: an implemenation of getitimer setitimerspew
2018-06-20ape: provide bogus chroot implementationspew
2018-06-17ape: add some common fields for stat, grp and pwdspew
2017-10-28libc: improve alignment of QLp structure on amd64, cosmeticscinap_lenrek
the QLp structure used to occupy 24 bytes on amd64. with some rearranging the fields we can get it to 16 bytes, saving 8K in the data section for the 1024 preallocated structs in the ql arena. the rest of the changes are of cosmetic nature: - getqlp() zeros the next pointer, so there is no need to set it when queueing the entry. - always explicitely compare pointers to nil. - delete unused code from ape's qlock.c
2016-08-28ape: add d_stat struct in dirent struct allowing the avoidance of statscinap_lenrek
2016-05-04ape: return plan9 error strings from strerror()cinap_lenrek
when _syserrno() fails to map a plan9 error string to a unix error number, we copy the plan9 error string to the per process error buffer "plan9err" and set errno = EPLAN9. when strerror() is called with EPLAN9, it returns a pointer to the plan9err buffer.
2016-04-10ape: remove broken 9errstr.ccinap_lenrek
2016-04-10ape: add internal _NSEC() function and make gettimeofday() use itcinap_lenrek
2014-02-17prof: properly save and restore RARG for amd64cinap_lenrek
amd64 passes first argument in RARG (BP) register which has the be preserved duing _profin() and _profout() calls. to handle this we introduce _saveret() and _savearg(). _saveret() returns AX, _savearg() returns RARG (BP). for archs other and amd64, _saveret() and _savearg() are the same function, doing nothing. restoing works with dummy function: uintptr _restore(uintptr, uintptr ret) { return ret; } ... ret = _saveret(); arg = _savearg(); ... return _restore(arg, ret); as we pass arg as the first argument, RARG (BP) is restored.
2013-09-26reverting semaphore lock changes from sources (r41ccd6d221da, rb28756e5ba29)cinap_lenrek
semaphore locks have much higher overhead than initially presented in the "Semaphores in Plan9" paper. until the reason for it has been found out i will revert the changes.
2013-09-21ape: change tas/sleep locks to cas/semacquire/semrelease locks (from sources)cinap_lenrek
2013-05-11ape: change types from unsigned long to void* for rendezvous() and ↵cinap_lenrek
segattach()/segbrk() (erik), use uniqueue rendezvous tags for _buf and listen
2013-05-06ape: remove unused variablesppatience0
2013-05-06ape: fix uninitialized variable bug in getfields()ppatience0
2013-05-06mergeppatience0
2013-05-06access: unused variableppatience0
2013-05-03ape: get rid of fixed MUXADDR for buffered i/ocinap_lenrek
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-03ape: remove unused variables from _buf (from erik qunastros _bufupd patch)cinap_lenrek
2013-05-01frexp: handle NaN values (from sources)cinap_lenrek
2013-03-11ape: threadsafe errnocinap_lenrek
store errno on the private process stack so its always per process and not just per memory space. errno itself becomes a macro dereferencing int *_errnoloc; which is initialized from main9.s pointing to the private stack location. various fixes in programs that just imported errno variable with "extern int errno;" instead of including <errno.h>.
2013-03-11ape: fix thread race with close() and select()cinap_lenrek
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-11ape/malloc: make malloc and free threadsafe for pythoncinap_lenrek
2013-03-10ape: check for invalid filedescriptors in select()cinap_lenrek
2013-02-08ape: fix bug in access()ppatience0
2012-12-03ape: fix memory leak and path limit in unlink()cinap_lenrek
db1 was leaked, and newname could overflow. fixed.
2012-12-03ape: forgot to set errno in access() for dir create failcinap_lenrek
2012-12-03ape: fix _grpmems(), access(), getppid(), cleanupcinap_lenrek
_grpmems() was broken tokenizing group list in place. we have to copy it to status buffer before tokenizing. dynamically alloc path for test file to check write permission on directory and add pid to the name to prevent races. use _OPEN instead of ape open to read /dev/ppid in getppid(). use mode enums instead of numeric constants for _OPEN() and _CREATE().
2012-12-03ape: fix putenv()cinap_lenrek
writing /env in putenv() doesnt work. exec will create new enviroment anyway. we have to modify environ array!
2012-12-03ape: fix more bugs, use /env and /proc instead of #e and #p, cleanupcinap_lenrek
remove envname length limitation in _envsetup() by using allocated buffer and use /env instead of #e use /proc and getpid() instead of #p and #c in readprocfdinit() fix buffer overflow in execlp(), check if name of failed exec starts with / . or is \0 make sure not to close our own filedescriptors for FD_CLOEXEC in execve(), fix wrong length check for flushing buffer to /env/_fdinfo. fix error handling cases. copy the enviroment before decoding \1 to \0 because the strings in environ[] array might not be writable. remove bogus close if we fail to open ppid file in getppid() and use /dev/ppid instead of #c/ppid
2012-12-03ape: initialize _tos and use _tos->pid for getpid()cinap_lenrek
2012-12-02ape: fix buffer overflow in _envsetup()cinap_lenrek
2012-07-30import updated compilers from sourcescinap_lenrek
2011-06-04ape: fix symbol name collision for by renaming static timezone struct to tzcinap_lenrek
2011-05-03ape: fix broken chmod for directories. (makes hg work again)cinap_lenrek
2011-03-30Import sources from 2011-03-30 iso image - libTaru Karttunen
2011-03-30Import sources from 2011-03-30 iso imageTaru Karttunen