summaryrefslogtreecommitdiff
path: root/sys/src/ape/lib/ap
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-12-18strndup: don't assume buffer is terminatedOri Bernstein
Using strlen in strndup will walk past the first n bytes up to the terminator, which may not be present. This is not what we want. While we're here, do some cleanups.
2020-12-17libap: add strndupOri Bernstein
strndup is part of POSIX.1, so APE should provide it. This patch adds it, so need to patch it out of fewer programs going forward.
2020-08-29ape/ctype.h: add isblank, fix functions (thanks staalmannen)Ori Bernstein
Our ctype.h mistakenly ommitted isblank. Add it in. While we're here, the make the 'isfoo()' functions are broken: they're offsetting into the array, and don't work with negative character values. Sync the function bodies with the macros, and make them produce correct results.
2020-05-15Fix scans of more than one character in %[]Ori Bernstein
This got broken in d8e877a89dae, where we returned 0 on the first mismatch; we want to return 0 only when we consumed no characters.
2020-05-12[ape] add missing conversion flags for scanfOri Bernstein
We're missing type flags for: hh: char ll: vlong z: size_t t: ptrdiff_t j: intmax_t The lack of '%lld' was causing us to fail when parsing timezone files. This brings us in line with the specifiers in the C99 standard, section 7.19.6.2p11
2020-05-09fix '%[]' specifiers and '%n' (thanks phil9)Ori Bernstein
When a match() fails, we need to unget the character we tried to match against, rather than leaving it consumed. Also, we can't break out of a conversion before we reach the end of a format string, because things like the '%n' conversion do not consume anything, and should still be handled.
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.
2020-02-10remove C99_SPRINTF_EXTENSION define.Ori Bernstein
It's been 20 years since c99 came out. By now, if code hasn't been fixed, it's not going to be. Requiring this define just confuses porters.
2019-09-09ape: Add mkstemp to /sys/src/ape/lib/ap/gen/mkfileRoberto E. Vargas Caballero
2019-09-09Add mkstemp to stdlib.hRoberto E. Vargas Caballero
q
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
2019-05-09libc: fix return value for arm64 memset() and memove()cinap_lenrek
2019-05-09libc: use MOVP instruction for arm64 memmove() and memset()cinap_lenrek
2019-05-09libc: provide arm64 assembly versions for memmove() and memset()cinap_lenrek
just a first approximation, uses unaligned 8 byte loads and stores. MOVP not yet implemented by the linker. no ZVA cache magic yet.
2019-05-03ape: initial support for arm64cinap_lenrek
2018-07-03ape: fix MAXSIGspew
2018-07-01ape: an implemenation of getitimer setitimerspew
2018-06-21ape: add strnlenspew
2018-06-20ape: provide bogus chroot implementationspew
2018-06-17ape: add some common fields for stat, grp and pwdspew
2018-05-24ape: floating point improvements (thanks spew)aiju
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-11-27stdio: fix sclose() buffer overrun when terminating string, realloc() error ↵cinap_lenrek
handling (thanks porlock) theres a bug is in sclose() where it doesnt check if wp is beyond the buffer. also wp was not updated after realloc(). bug was reported by porlock on 9fans: Plan 9's implementation of the standard C functions snprintf and vsnprintf have a buffer overrun bug. If the buffer length equals the output length (without the terminating null), then one too many characters is written to the buffer. For example, snprintf(buf, 4, "ABCD"); will write 5 characters to buf.
2016-08-28ape: add d_stat struct in dirent struct allowing the avoidance of statscinap_lenrek
2016-05-04retire the dec alpha portcinap_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
2016-01-07ape/stdio: %z format is VLONG on amd64cinap_lenrek
2015-10-04ape: add missing _subv() function to 386/vlop.scinap_lenrek
2015-10-04ape: add machine specific code for spimcinap_lenrek
2015-10-04libc: add _uv2d()/uv2f() and _vas*d() functions to vlrt.ccinap_lenrek
on 32 bit archs, implement 64 bit vasop with floatingpoint right hand side. also added is uvlong->double conversion function.
2015-08-08ape: fix build for objtype=spimcinap_lenrek
2015-08-04ape: implement altzone for tzset()cinap_lenrek
2015-08-04ape: fix mktime() againcinap_lenrek
2015-07-07ape: port libc smp tas() for armcinap_lenrek
2015-03-25ape: fix main9 for mipscinap_lenrek
2015-03-25ape: fix lockinit() for mipscinap_lenrek
2015-03-18ape: silence compiler "no return at end of function" for mips lock.ccinap_lenrek
2014-12-25getfcr: change getfcr/setfcr to use VFPcinap_lenrek
2014-12-22ape: add fprint %z format (thanks Ori_B)cinap_lenrek
2014-05-29ape/stdio: set errno to EMFILE when running out of streamscinap_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.
2014-02-01libc and ape support for amd64cinap_lenrek
2014-01-20ape: remove local copy of memccpy()cinap_lenrek