summaryrefslogtreecommitdiff
path: root/sys/include
AgeCommit message (Collapse)Author
2021-05-01lib9p: remove Srv.srvfd, make postsrv() and threadpostsrv() return the ↵cinap_lenrek
mountable file descriptor, update documentation Now that we have these new functions, we can also make them return an error instead of calling sysfatal() like postmountsrv(). Remove the confusing Srv.srvfd, as it is only temporarily used and return it from postsrv() instead.
2021-05-01lib9p: expose Srv.forker handler and srvforker(), threadsrvforker() and ↵cinap_lenrek
threadsrv() functions To use srvrease()/srvaquire() we need to have a way to spawn new processes to handle the service loop. This functionality was provided by the internal _forker() function which was eigther rfork or libthread based implementation depending on if postmountsrv() or threadpostmountsrv() where called. For servers who want to use srv() directly, _forker would not be initialized so srvrelease() could not be used. To untangle this, we get rid of the global _forker handler and put the handler in the Srv structure. Which will get initialized (when nil) to eigther srvforker() or threadsrvforker() depending on if the thread or non-thread entry points where used. For symmetry, we provde new threadsrv() and threadpostsrv() functions which handle the default initialization of Srv.forker. This also allows a user to provide his own forker function, maybe to conserve stack space. To avoid dead code, we put each of these function in their own object file. Note, this also allows a user to define its own srvforker() symbol.
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-01-30ape/libm: implement log2 in libcOri Bernstein
2021-01-23[9front] ape: remove _SUSV2_SOURCE guard from inttypes.hMichael Forney
inttypes.h was added to C99, and this is the only header that used _SUSV2_SOURCE. Also, remove now unneeded _SUSV2_SOURCE from python mkfile.
2021-01-09libdraw: add bezierptsOri Bernstein
This patch exposes the bezierpts function, providing a way to get the points on a path, similar how bezsplinepts gives them for b splines.
2021-01-01ape: unify math.h copiesOri Bernstein
/$objtype/include/ape/math.h contained an almost identical copy of math.h for each architecture. The only difference between them architectures was that some had an incorrect version of isinf defined. This change picks one of the versions of math.h with a correct definition, moves it to /sys/include, and removes the redundant versions.
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-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-11-01libbio: add aux pointer to bioOri Bernstein
This allows us to attach additional context to the biobuf so can read from some sort of data structure without a global variable.
2020-09-21ape/limits.h: fix typo in (U)LLONG_MAXOri Bernstein
Fix missing 'L' in the size suffix, so we were overflowing the maximum size.
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-08-10stdio.h: correct return type of putcOri Bernstein
The putc macro is specified as returning an int, but our type conversion rules turned it into a uint. Put in the appropriate cast to make the type what we want.
2020-08-09libc: new date apisOri Bernstein
The current date and time APIs on Plan 9 are not good. They're inflexible, non-threadsafe, and don't expose timezone information. This commit adds new time APIs that allow parsing arbitrary dates, work from multiple threads, and can handle timezones effectively.
2020-07-19stdio: fix warnings, make code more standardOri Bernstein
Masking with _IO_CHMASK after the assignment causes a warning. We're better off masking before, but casting the assignment to prevent sign extension.
2020-07-11stdio, ape/stdio: fix order of operations in putcOri Bernstein
When calling putc, we need to return either EOF or the character returned. To distinguish the two, we need to avoid sign extending 0xff. The code attempted to do this, but the order of operations was wrong, so we ended up masking, setting a character, and then sign extending the character. This fixes things so we mask after assignment.
2020-06-15libc: revert date change again. this is getting ridicuoulus.cinap_lenrek
this breaks the sample from the seconds manpage, and overall produces funky results. this needs alot more testing. term% seconds '23 may 2011' seconds: tmparse: invalid date 23 may 2011 near 'may 2011' term% seconds '2019-01-01 00:00:00' -118370073600
2020-06-14libc, seconds: new time and date apis (try 2)Ori Bernstein
Redo date handling in libc almost entirely. This allows handling dates and times from outside your timezones, fixes timezone loading in multithreaded applications, and allows parsing and formatting using custom format strings. As a test of the APIs, we replace the formatting code in seconds(1), shrinking it massively. The last commit missed a few removals, and made it unnecessarily hard to do an update.
2020-06-14libc: reverting previous change until ori can fix itcinap_lenrek
2020-06-13libc, seconds: new time and date apis.Ori Bernstein
Redo date handling in libc almost entirely. This allows handling dates and times from outside your timezones, fixes timezone loading in multithreaded applications, and allows parsing and formatting using custom format strings. As a test of the APIs, we replace the formatting code in seconds(1), shrinking it massively.
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-17Add stdbool.h to apeOri Bernstein
in accordance with c99:7.16. Used by perl, trivial enough that I feel ok with adding it before the port is fully done.
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-06bring stdint.h closer to specOri Bernstein
C99 requires that if intXX_t types are defined, int_fastxx_t and int_leastxx_t types are defined as well. We define all three to be identical (intXX_t == int_fastXX_t == int_leastXX_t).
2020-05-01use #error when missing defineOri Bernstein
This makes it easier to figure out what's going wrong when we forget to define _POSIX_SOURCE.
2020-04-26add missing header change (thanks qwx)Ori Bernstein
2020-03-29lib9p: fix re-use of root Qid when using createfile(); remove unused dirqidgenBurnZeZ
2020-03-24turn ptrdiff_t into a 64 bit typeOri Bernstein
while technically a 32 bit ptrdiff_t is in spec on systems with 64 bit ponters as long as we guarantee that individual objects are small enough, this can confuse legitimate code, so lets fix this.
2020-03-24add intmax_t/uintmax_t as required by c99 7.18.1.5Ori Bernstein
2020-03-08lib9p: implement automatic remove-on-close cleanup in postsharesrv(), remove ↵cinap_lenrek
postfd() and sharefd() functions with the latest changes to shr(3), we can use ORCLOSE on the control file to get the mount in the share automatically removed when the server exits or something goes wrong during postsharesrv(). do not expose postfd() and sharefd() functions. they where undocumented and leak the control file descriptors.
2020-03-07lib9p: get rid of Srv.nopipe and Srv.leavefdsopen hackscinap_lenrek
it is unclear how Srv.nopipe flag should work inside postmountserv(). if a server wants to serve on stdio descriptors, he can just call srv() after initializing Srv.infd and Srv.outfd. The Srv.leavefdsopen hack can be removed now that acme win has been fixed.
2020-03-01libsec: move AES XTS function prototypes to AES definition section in the ↵cinap_lenrek
header file
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-09Add toascii() to apeRoberto E. Vargas Caballero
2019-09-09Add mkstemp to stdlib.hRoberto E. Vargas Caballero
q
2019-09-06Include integer limits from generic stdint.h in system-specific stdint.hOri Bernstein
2019-09-06Add missing UINTsz_MIN defines to ape stdint.hOri Bernstein
2019-09-06sys/src/libventi: define VtEntryNoArchive constantDavid du Colombier
2019-09-06sys/src/libventi: implement vtsha1 and vtsha1check functionsDavid du Colombier
2019-09-06sys/src/libventi: implement vtreconn and vtredial functionsDavid du Colombier
2019-08-30auth/rsa2asn1: implement private key export with -a flag (thanks kvik)cinap_lenrek
kvik writes: I needed to convert the RSA private key that was laying around in secstore into a format understood by UNIX® tools like SSH. With asn12rsa(8) we can go from the ASN.1/DER to Plan 9 format, but not back - so I wrote the libsec function asn1encodeRSApriv(2) and used it in rsa2asn1(8) by adding the -a flag which causes the full private key to be encoded and output.
2019-06-20stdio: fix putc(), plan9 versioncinap_lenrek
2019-06-19ape: fix stdio putc() macro, avoiding "result of operation not used" warningcinap_lenrek
moving _IO_CHMASK masking on the right hand side fixes it.
2019-05-06Sand edges down on GBIT64()/PBIT64() macros.Ori Bernstein
Now, you can safely use them in unbraced if statements, and with char*s.
2019-03-30dtracy: avoid dmachlock() racecinap_lenrek
between being commited to a machno and having acquired the lock, the scheduler could come in an schedule us on a different processor. the solution is to have dtmachlock() take a special -1 argument to mean "current mach" and return the actual mach number after the lock has been acquired and interrupts being disabled.
2019-02-11libip: replace v4parsecidr() with new parseipandmask()cinap_lenrek
we want to accept V4 subnets in CIDR notation consistently which means we need to interpret the mask in context of the IP address. so parseipmask() now has an additional v4 flag argument which offsets the prefixlength by 96 so a /24 will be interpreted as a /120. parseipandmask() is the new function which handles this automatically depending on the ip address type. v4parsecidr() is now obsolete.
2018-12-13dtracy: get rid of DTName struct, support more than three parts in a probe ↵aiju
name, wildcard matching
2018-12-11forgotten filesaiju
2018-12-09dtracy: call dtptrigger with a struct pointer rather than a list of ↵aiju
arguments; put return value in arg9