summaryrefslogtreecommitdiff
path: root/sys/src/ape
AgeCommit message (Collapse)Author
2023-02-19mkfiles: add 'mk test' supportOri Bernstein
9front has several tests scattered throughout the source, as well as more tests in an external 'regress' repository. Many of these tests are broken, because there is no easy way to build and track all of them. This pulls in several tests from different sources, deletes the broken tests, tests with missing data, and adds a single command that can be run from the root of the src directory to test our system. The hope is that as we develop new code, we add more tests, and eventually start running the tests on every commit. Please enter the commit message for your changes. Lines starting
2022-10-31ape: fix warning building mkstempOri Bernstein
mkstemp uses mktemp, which is only declared when including files with _BSD_SOURCE, so define _BSD_SOURCE before including the headers
2022-07-06ape/bsd/bind.c, ape/bsd/listen.c: Use _syserrno.Benjamin Riefenstahl
2022-07-06ape/bsd/listen.c: Drop "bind 0".Benjamin Riefenstahl
There does not seem to be a good reason for this. The "bind" command has no practical consequence.
2022-06-11ape/bsd/bind.c: Do not pretend that the port could be negative.Benjamin Riefenstahl
Ports are filtered through "htons" which returns an "unsigned short".
2022-06-10ape/bsd/bind.c, ape/bsd/listen.c: Set local IP.Benjamin Riefenstahl
Despite what the man pages say, local addresses can actually be set so do that.
2022-06-10ape/bsd/listen.c: Do not try to issue "announce *".Benjamin Riefenstahl
"port >= 0" is always true, because the port always gets filtered through "htons" which returns "unsigned short", so we can just drop the "else" branch here. Anyway "announce 0" works fine with the Plan9 API, there is not need for "announce *" here.
2022-06-10ape/bsd/bind.c: Do not issue "bind *".Benjamin Riefenstahl
Despite the documentation, "bind *" is invalid and gives the error "bad numeric port" in devip.c:setladdrport. "bind 0" OTOH is actually supported fine in the Plan9 API and has the right sematics.
2022-03-14ape: fix wrong write size for _assert()cinap_lenrek
2022-01-10reduce: use if() to test for exit status of pipelinecinap_lenrek
The new rc's exit status will be '' for a successfull pipeline execution instead of '|'. This is a bit too tightly coupled, so just use if() statement instead, handling this in a portable way.
2021-12-10ape/mkstemp: better optionsBenjamin Riefenstahl
Use O_EXCL and make the file descriptor writeable. This is more usefull and it conforms to Single Unix and other specs.
2022-01-03ape: allow exporting rc functions in environ[]cinap_lenrek
2021-10-31ape: add missing idn2utf, utf2idn to lib9Ori Bernstein
this fixes the libsec build under ape.
2021-02-20ape/lib9: expose fd2path (thanks phil9)Ori Bernstein
Fd2path is a useful call for the netsurf plan9 frontend, so we should expose it.
2021-02-08ape/lib9: sync arm getfcr.s implementationOri Bernstein
The arm assembler supports movw to handle getfcr and setfcr now, no need to hack it with macros; sync from plan9 libc.
2021-01-30ape/libm: implement log2 in libcOri Bernstein
2021-01-23ape/libm: add back fmod, remove modfOri Bernstein
We removed the wrong file. Put it back.
2021-01-24ape: update mkfile for removed fmod.cqwx
2021-01-23ape: apply infinite recursion in fmod() fix (thanks jxy and ality)cinap_lenrek
Apply changeset 2880:cab2b9d13a73 to ape's fmod() implementation. Remove the unused math/fmod.c copy.
2021-01-19ape/libap: fix _startbuf, check rfork return (thanks pixelherodev)Ori Bernstein
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.
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-07-16ape: simplify mkfile (thanks amavect)Ori Bernstein
ape cp, mv, and cc build with ?c, not pcc ape cp and mv just ignore one or two extra flags, instead of providing posix compatibility it's better to fail then do nothing remove cp.c and mv.c move cc.c to /sys/src/ape/9src so it doesn't need its own mkfile rule
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-23ape/cc: stop spamming arguments that are only needed onceBurnZeZ
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-22ape/cc: add spimcinap_lenrek
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.