summaryrefslogtreecommitdiff
path: root/sys/src/ape/lib
AgeCommit message (Collapse)Author
2020-12-23ape: re-implement getlogin() by stating /proc/$pid/statuscinap_lenrek
2020-12-19libauth: add procsetuser() function to change user id of the calling processcinap_lenrek
Provide a central function to change the user id of the calling process. This is mostly used by programs to become the none user, followed by a call to newns().
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-06-09libplumb: add missing mkfileOri Bernstein
2020-06-05ape: add missing rerrstr.cOri Bernstein
2020-06-05ape: make libplumb available under ape.Ori Bernstein
This adds the mkfiles and plumb.h to ape, similar to how libdraw is made available. This is used for ports such as netsurf.
2020-05-30ape/libdraw: add missing eenter (thanks phil9)Ori Bernstein
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-13ape: fix name clash, have to use _SLEEP syscall instead of ape sleep in ↵cinap_lenrek
plan9 code (thanks jamos) this fixes etimer() from ape built libdraw as posix sleep() uses seconds while plan9 uses miliseconds.
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-03-01libsec: remove hash pickle functions, document ripemd160, cleanup sechash(2) ↵cinap_lenrek
manpage
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-16ape: don't hardcode list of ape library directories in /sys/src/ape/lib/mkfilecinap_lenrek
this change allows one to drop library directories (like freetype) into /sys/src/ape/lib/ and have them built without having to change the mkfile.
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-03ape: remove getitimer setitimer implemenationsspew
2018-07-01ape: improve setitimerspew
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
2018-01-02ape/libauth: remove auth_wep.$O from mkfilecinap_lenrek
2017-12-31ape: make encXchr()/decXchr() functions availablecinap_lenrek
2017-11-20libsec: write optimized _chachablock() function for amd64 / sse2cinap_lenrek
doing 4 quarterround's in parallel using 128-bit vector registers. for second round shuffle the columns and then shuffle back. code is rather obvious. only trick here is for the first quaterround PSHUFLW/PSHUFHW is used to swap the halfwords for the <<<16 rotation.
2017-11-12libsec: AES-NI support for amd64cinap_lenrek
Add assembler versions for aes_encrypt/aes_decrypt and the key setup using AES-NI instruction set. This makes aes_encrypt and aes_decrypt into function pointers which get initialized by the first call to setupAESstate(). Note that the expanded round key words are *NOT* stored in big endian order as with the portable implementation. For that reason the AESstate.ekey and AESstate.dkey fields have been changed to void* forcing an error when someone is accessing the roundkey words. One offender was aesXCBmac, which doesnt appear to be used and the code looks horrible so it has been deleted. The AES-NI implementation is for amd64 only as it requires the kernel to save/restore the FPU state across syscalls and pagefaults.
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
2017-10-17libsec: add AES CFB and AES OFB stream cipherscinap_lenrek
2017-04-23libsec: sha256 support for thumbprint files, use it in ssh as wellcinap_lenrek
initThumbprints() now takes an application tag argument so x509 and ssh can coexist. the thumbprint entries can now hold both sha1 and sha256 hashes. okThumbprint() now takes a len argument for the hash length used. the new function okCertificate() hashes the certificate with both and checks for any matches. on failure, okCertificate() returns 0 and sets error string. we also check for include loops now in thumbfiles, limiting the number of includes to 8.
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-10-30ape/libsec: add secp384r1 curve parameters for tlscinap_lenrek
2016-09-14ape: fix format clash, %z is for size_t (which is a long currently), not ↵cinap_lenrek
pointer sized
2016-09-11ape: bring strtod() in line with plan9's libc versioncinap_lenrek
2016-08-28ape: add d_stat struct in dirent struct allowing the avoidance of statscinap_lenrek
2016-08-04ape/libauth: add PASSWDLEN constant to compile passtokey.c from native ↵cinap_lenrek
libauthsrv (thanks lawler)
2016-07-10libsec: add scrypt password based key derivation functioncinap_lenrek