summaryrefslogtreecommitdiff
path: root/sys/src/libc/9sys
AgeCommit message (Collapse)Author
2022-12-25libsec: use /net/tls instead of #a/tlscinap_lenrek
Namespace files have been updated and the tls device is now available under /net.
2022-12-23libc: use /fd instead of #d in iounit()cinap_lenrek
2021-12-13devssl, cpu, import, oexportfs: deleteOri Bernstein
SSL is implemented by devssl. It's extremely obsolete by now, and is not used anywhere but cpu, import, and oexportfs. This change strips out the devssl bits, but does not (yet) remove the code from libsec.
2021-10-31libc: idn2utf()/utf2idn(): check for < 1 buffer, can't insert terminating NUL.cinap_lenrek
2021-10-31libc: fix overflow of domain component rune buffer for idn2utf()cinap_lenrek
If the source string has a run of more than 256 runes without a "." dot, we'd overflow the runebuffer in idn2utf(). The utf2idn() routine had a check in the while loop, but that is actually wrong too, as it would insert a dot and restart the loop in the middle of a domain component. Just error out if a domain component is too long.
2021-07-25libc: use usize for sbrk() incrementcinap_lenrek
2020-12-23libc: re-implement getuser() by stating /proc/$pid/statuscinap_lenrek
The idea is to avoid the magic files that contain per process information in devcons when possible. It will make it easier to deprecate them in the future.
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-09backout OCEXEC changes when potentially opening /srv filescinap_lenrek
Opening a /srv file sets the close-on-exec flag on the shared channel breaking the exportfs openmount() hack. The devsrv tries to prevent posting a channel with the close-on-exec or remove-on-close flags. but nothing currently prevents this poisoning on open. Until this gets fixed in eigther exportfs or devsrv, i'll back out the changes that could have potential side effects like this.
2020-12-07libc: open internal file-descriptor with OCEXEC flagcinap_lenrek
2020-08-24tm2sec: clear new fields in tmOri Bernstein
Old users of the time APIs would hand-craft time structs without first zeroing all the members. When this got into tmnorm(), we would try to access the new members, and things would go off the rails. This makes tm2sec() clear the new fields before passing them to the new APIs, so that the hand-crafted structs remain valid.
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-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.
2018-09-26libc: add procsetname()cinap_lenrek
2018-09-26libc: return number of bytes produced for idn2utf() and utf2idn()cinap_lenrek
2018-09-25libc: add utf2idn() and idn2utf() functions to deal with internationalized ↵cinap_lenrek
domain names
2018-04-14libc: allow /net/cs to specify local address for dial()cinap_lenrek
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-26libc: wunlock() part 2cinap_lenrek
the initial issue was that wunlock() would wakeup readers while holding the spinlock causing deadlock in libthread programs where rendezvous() would do a thread switch within the same process which then can acquire the RWLock again. the first fix tried to prevent holding the spinlock, waking up one reader at a time with releasing an re-acquiering the spinlock. this violates the invariant that readers can only wakup writers in runlock() when multiple readers where queued at the time of wunlock(). at the first wakeup, q->head != nil so runlock() would find a reader queued on runlock() when it expected a writer. this (hopefully last) fix unlinks *all* the reader QLp's atomically and in order while holding the spinlock and then traverses the dequeued chain of QLp structures again to call rendezvous() so the invariant described above holds.
2016-04-13libc: fix out of bounds access in dirpackage(), simplifycinap_lenrek
- dirpackage() was not checking if the stat entry lies within the buffer. fixed. - simplify dirpackage(), as we process all the bytes from the buffer, we do not need to track "ss" here as its the same as "ts". - zero Dir* array pointer early in dirread() and dirreadall() and avoid calling dirpackage on <= buffer length.
2016-03-19libc: trailing whitespace cleanupBurnZeZ
2015-09-06libc: remove privfree(), simplify privalloc()cinap_lenrek
2015-08-10libc: fix wunlock() libthread deadlockcinap_lenrek
when wunlock() was used by threads running within the same proc, the wunlock() can deadlock as it keeps holding the RWLock.lock spinlock while indirectly calling _threadrendezvous(). when _threadrendezvous() switches to another thread in the same proc, then that thread can hang at rlock()/wlock()/runlock() again waiting for wunlock() to release the spinlock which will never happen as lock() does not schedule threads. wunlock() is changed to release the spinlock during rendezvous wakeup of readers. note that this is a bit dangerous as more readers might queue concurrently now which means that if we cannot keep up with the wakeups, we might keep on waking readers forever. that will be another patch for the future.
2015-02-11libc: check name in getvent()/putenv()cinap_lenrek
passing "", "." or ".." as name caused a crash in getenv() as it would open the directory; then seek() to determine the file size would fail and return -1. now checking for these special names and set error string when its bad. doing a single read() will not work when /env has a 9p fileserver mounted onto it and the file size is bigger than the i/o unit. so doing incremental reads until we get eof.
2014-11-07libc: import cleaned up syslog() function from sourcescinap_lenrek
this fixes a potential format string problem where the error string is passed to werrstr() as fmt. also, the directory comparsion is simplified in this version using a helper function.
2014-11-07libc: improve dial error handlingcinap_lenrek
when dial is called with a generic dialstring, it will try /net and /net.alt in sequence. error out if the /net dial gets interrupted and do not continue dialing /net.alt. reduce stack usage by using the swaping nature of errstr() instead of keeping two error string buffers on the stack.
2014-11-05libc: allow dial to be interruptedmischief
previously, if dial was interrupted by an alarm or other note while connecting to a host that resolved to multiple ips, dial would ignore the interruption and try the next host. now dial properly returns with error when it is interrupted.
2014-05-23libc: avoid static table and supurious reads in nsec()cinap_lenrek
use two per process memory slots, one for the pid and one for the fd instead of a global table avoiding the case when the table gets full. instead of calling pread() on the cached fd (dangerous as it has side effects when the fd was not closed), we check if the cached fd is still good using fd2path() when called the first time in this process.
2014-05-20libc: revert nsec() change, bring back filedescriptor cachingcinap_lenrek
theres big performance regression with this using cwfs. cwfs calls time() to update atime on every read/write which now causes walks on /dev. reverting to the previous version for now. in the long run, we'll use new _nsec() syscall but this has to wait for a later release once new kernels are established.
2014-05-20libc: dont cache /dev/bintime filedescriptor for nsec()cinap_lenrek
2014-04-09libc: allow announce address of the form #I1/tcp!*!564cinap_lenrek
we allow protocol path to begin with # for dial, so should allow this for announce as well. this is primarily usefull when booting the fileserver to listen on alternate ip stack.
2014-02-25csdial: avoid useless werrstr() call on success (thanks mischief)cinap_lenrek
2013-08-11tm2sec: assume local timezone when Tm.zone[0] == 0 (fixes dossrv, zipfs ↵cinap_lenrek
timestamps) from the manual: Tm2sec converts a broken-down time to seconds since the start of the epoch. It ignores wday, and assumes the local time zone if zone is not GMT. so we can assume localtime if Tm.zone is not set to GMT. all code that wants no localtime conversion should set Tm.zone explicitely to GMT. (see previous commits) tm2sec() now does the reverse of localtime() when Tm.zone[0] == 0 which seems to be what the calling code (dossrv, zipfs) assumes. this also makes sense because theres no simple way todo it outside of libc as theres otherwise no access to the timezone structure with the daylight saving periods.
2013-04-03pushtls: remove unneccesary include <auth.h> (from sources)cinap_lenrek
2012-09-01isodate in libc? revert every commit for great justice!cinap_lenrek
2012-09-02Add isotime() and isodate() functions to libc.google
2012-09-02Fix date formatting in asctime after year 2099.google
2012-05-22allow # netpath in dial stringcinap_lenrek
2012-01-10libc: restoring simple sequential version of dial()cinap_lenrek
2011-08-20getpid: use tosaiju
2011-08-17fix broken perm formatcinap_lenrek
2011-03-30Import sources from 2011-03-30 iso image - libTaru Karttunen
2011-03-30Import sources from 2011-03-30 iso imageTaru Karttunen