aboutsummaryrefslogtreecommitdiff
path: root/src/lib9
AgeCommit message (Collapse)AuthorFilesLines
2021-01-14lib9: reject postnote with special pidsRuss Cox1-0/+5
2020-05-18lib9: avoid unportable use of d_namlen in dirreadRuss Cox1-2/+1
Fixes #395.
2020-05-17lib9: use opendir/readdir to read directoriesRuss Cox1-183/+187
getdirentries(2) has been deprecated on macOS since 10.5 (ten releases ago). Using it requires disabling 64-bit inodes, but that in turn makes binaries incompatible with some dynamic libraries, most notably ASAN. At some point getdirentries(2) will actually be removed. For both these reasons, switch to opendir/readdir. A little clunky since we have to keep the DIR* hidden away to preserve the int fd interfaces, but it lets us remove a bunch of OS-specific code too.
2020-05-17lib9: move seek into open.cRuss Cox3-10/+6
More preparation for opendir.
2020-05-17lib9: add closeRuss Cox1-0/+7
More preparation for opendir.
2020-05-17lib9: merge create, open, dirread into open.cRuss Cox4-284/+270
Preparation for using opendir.
2020-05-08fmt: adjust GCC version checkKurt H Maier1-2/+2
atomics were added in GCC 4.9: https://gcc.gnu.org/gcc-4.9/changes.html
2020-05-07all: fix #includes for AIX, add a few AIX "implementation" filesBen Huntsman1-0/+2
2020-05-07fmt: disable use of stdatomic on AIX XL C and old GCCRuss Cox1-0/+21
C11 is apparently too new for these systems. Fixes #55.
2020-01-16malloc: remove lockingDan Cross2-31/+3
The issue manifests in fork: POSIX fork mandates that a fork'd process is created with a single thread. If a multithreaded program forks, and some thread was in malloc() when the fork() happened, then in the child the lock will be held but there will be no thread to release it. We assume the system malloc() must already know how to deal with this and is thread-safe, but it won't know about our custom spinlock. Judging that this is no longer necessary (the lock code was added 15 years ago) we remove it. Signed-off-by: Dan Cross <cross@gajendra.net>
2020-01-16lib9: putenv wraps POSIX setenv, not legacy putenvDan Cross1-7/+1
POSIX setenv does everything that p9putenv's body, so just delegate to that. Signed-off-by: Dan Cross <cross@gajendra.net>
2020-01-14lib9: make formatting lock-free againRuss Cox4-124/+83
First use of <stdatomic.h>. We will see if any supported systems don't have it yet. (C11 was so last decade.) Fixes #338.
2020-01-13lib9: do not fetch disk size for character devicesRuss Cox1-1/+1
Real disk devices should be block devices anyway. One user reported the disksize check causing a system reboot during vac of a tree with an "interesting" device. Fixes #103.
2020-01-13lib9: rm unused _p9translate.cRuss Cox1-46/+0
Fixes #238.
2020-01-13lib9/fmt: avoid racy access to installed fmt formatsRuss Cox4-22/+55
2020-01-13lib9: fix memory leak in dial of regular file (#284)jvd231-1/+3
2020-01-12lib9: make a p9frexp function wrapping system frexpRuss Cox2-0/+10
Under certain conditions it looks like frexp gets #defined to something else on macOS during system headers, which then breaks the declaration in libc.h.
2020-01-12all: fix or silence various gcc warningsRuss Cox2-8/+6
As usual, gcc finds some real problems but also reports a ton of noise. Fix the problems and quiet the noise.
2020-01-10Trivial changes: whitespace and modes.Dan Cross69-128/+83
Remote whitespace at the ends of lines. Remove blank lines from the ends of files. Change modes on source files so that they are not executable. Signed-off-by: Dan Cross <cross@gajendra.net>
2020-01-08lib9: add getcallerpc.c (fixes build)Russ Cox1-0/+13
2020-01-07lib9, libndb: exclude terminating null from strncpy boundNeven Sajko1-1/+1
GCC pointed this out with some "warning: ‘strncpy’ specified bound NUM equals destination size [-Wstringop-truncation]" warnings. Change-Id: Id8408b165f6e4ae82c96a77599d89f658d979b32
2020-01-07lib9: remove getcallerpc implementationsRuss Cox8-55/+1
These make no sense and are not really needed at all. Add a best-effort attempt to get at the gcc/clang macro in lib9.h, but if it fails, no big deal. Fixes #324.
2017-09-01lib9: import frand function from Plan 9David du Colombier2-0/+18
Fixes #15.
2017-06-19lib9: fix needsrcquoteRuss Cox1-1/+1
As written, it is passing a rune to strchr, which likely ignores all but the bottom 8 bits of the rune. Long-standing Plan 9 bug too. Fixes #87. Change-Id: I6a833373b308bed8760d6989972c7f77b4ef3838 Reviewed-on: https://plan9port-review.googlesource.com/2921 Reviewed-by: Russ Cox <rsc@swtch.com>
2016-11-20include: define _DEFAULT_SOURCEDavid du Colombier1-0/+1
Since glibc 2.20, the _BSD_SOURCE and _SVID_SOURCE macros are deprecated in favor of the _DEFAULT_SOURCE macro. See https://sourceware.org/glibc/wiki/Release/2.20#Packaging_Changes Change-Id: I18dd6a698f3f5aa51d1e45bf53b031bb061e17e8 Reviewed-on: https://plan9port-review.googlesource.com/1500 Reviewed-by: David du Colombier <0intro@gmail.com>
2015-06-03all: linux/arm64 portAram Hăvărneanu1-0/+8
Really trivial port. Change-Id: Ib2e3ad48df555ca4bd9339ddf79a832be895bd95 Reviewed-on: https://plan9port-review.googlesource.com/1030 Reviewed-by: Russ Cox <rsc@google.com>
2015-06-03all: linux/mips portAram Hăvărneanu1-0/+8
Change-Id: I0af67bc44c7bb62a8e5a47eac597367f521f1c11 Reviewed-on: https://plan9port-review.googlesource.com/1210 Reviewed-by: Russ Cox <rsc@google.com>
2015-06-03all: fix openbsd buildAram Hăvărneanu1-2/+2
Change-Id: I6eaeebc9b6a4d78ce07efe7680ba8f2eff16462f Reviewed-on: https://plan9port-review.googlesource.com/1230 Reviewed-by: Minux Ma <minux@golang.org> Reviewed-by: Russ Cox <rsc@google.com>
2014-02-27all: DragonFly port.Shenghou Ma1-5/+11
Fix compilation problems, libdraw still doesn't work right yet. LGTM=rsc R=rsc https://codereview.appspot.com/67820046
2012-10-21fix clang warnings reported by Tuncer AyazRuss Cox1-7/+5
R=rsc http://codereview.appspot.com/6744054
2012-10-20lib9: fix Mac warningRuss Cox1-1/+8
R=rsc http://codereview.appspot.com/6749053
2012-09-11lib9/p9dialparse: fix segfault on gethostbynameDavid du Colombier1-1/+1
In some situations, gethostbyname can return an empty address list. R=rsc http://codereview.appspot.com/6443097
2012-09-08lib9: remove ss_len manipulation in _p9dialparseRuss Cox1-3/+0
Not all systems have ss_len, and we've never set it before. R=rsc http://codereview.appspot.com/6497102
2012-09-08lib9: fix announce on OS XRuss Cox1-5/+7
R=rsc http://codereview.appspot.com/6495109
2012-09-04lib9/dial: fix addrlen in connect() and bind()David du Colombier2-7/+35
On some systems, the third argument of connect() and bind() is expected to be the length of the address family instead of the length of the sockaddr structure. R=rsc http://codereview.appspot.com/6489072
2012-08-03lib9/getnetconn: add support for IPv6David du Colombier1-0/+27
R=rsc http://codereview.appspot.com/6457077
2012-06-27lib9: fix openbsd buildDavid du Colombier2-1/+2
Fix build error and warning on OpenBSD 5.1, as reported by Dimitri Sokolyuk. R=rsc http://codereview.appspot.com/6350044
2012-06-02lib9/dial: add support for IPv6David du Colombier3-100/+86
The function p9dialparse() returns the host as a sockaddr_storage structure instead of a u32int, to be able to handle both IPv4 and IPv6 addresses. Because the sockaddr_storage structure also handle port numbers and Unix path names, there is no longer need to set them in the calling functions. However, these values are still returned for convenience. The sockaddr_in and sockaddr_un structures have been replaced by sockaddr_storage to handle Unix, IPv4 and IPv6 sockets. Names and addresses are resolved using either gethostbyname() or getaddrinfo() functions. The getaddrinfo() function is documented in RFC2553 and standardized since POSIX.1-2001. It supports both IPv4 and IPv6 addresses. The gethostbyname() function is deprecated since POSIX.1-2008. However, some libc implementations don't handle getaddrinfo() properly, thus we preferred to try gethostbyname() first. I've tried to preserve most of the old code logic to prevent from surprising or unwanted behavior. R=rsc http://codereview.appspot.com/6255068
2011-08-16lib9: fix local addr in dialJani Lahtinen1-1/+1
R=rsc CC=plan9port.codebot http://codereview.appspot.com/4826049
2011-08-02build: OS X 64-bit buildRuss Cox1-1/+1
R=rsc http://codereview.appspot.com/4838047
2011-05-01lib9: restore SIGCHLD handler in rforkRuss Cox1-6/+5
R=rsc http://codereview.appspot.com/4436071
2010-12-07delete 9P2000.uRuss Cox4-133/+8
thanks to Erik Quanstrom R=rsc http://codereview.appspot.com/3469042
2010-07-11lib9: add <sys/dkio.h> for OpenBSDRuss Cox1-0/+1
R=, rsc CC= http://codereview.appspot.com/1762045
2010-03-10more type-punned pointersRuss Cox1-1/+1
R=rsc http://codereview.appspot.com/376045
2010-03-10fix type-punned pointer warnings from gccRuss Cox3-3/+5
R=rsc http://codereview.appspot.com/396042
2009-09-24lib9: do not include st_dev in qid.pathRuss Cox1-1/+8
http://codereview.appspot.com/123050
2009-09-13lib9: fix dirread/stat mismatch on Snow LeopardRuss Cox1-4/+0
http://codereview.appspot.com/116096
2009-09-11convert to 4-byte UTF-8 and 32-bit RuneRuss Cox2-24/+65
http://codereview.appspot.com/116075
2009-09-11INSTALL: fix build on Snow LeopardRuss Cox1-0/+4
http://codereview.appspot.com/116073
2009-08-20lib9: dotu fixes in convS2M, convM2STim Newsham2-6/+34
http://codereview.appspot.com/109049