diff --git a/qa/gnu/gcc/rune.c b/qa/gnu/gcc/rune.c
index a687dcc..d5b4855 100644
--- a/qa/gnu/gcc/rune.c
+++ b/qa/gnu/gcc/rune.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
/* Test rune assignment: should not produce any warning
* see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67132
diff --git a/qa/kern/alarm.c b/qa/kern/alarm.c
index 43a87a0..fb19aa9 100644
--- a/qa/kern/alarm.c
+++ b/qa/kern/alarm.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
/* Test alarm(2):
* - alarms replace each other (the last one wins)
diff --git a/qa/kern/args.c b/qa/kern/args.c
index f7f060b..04e0c87 100644
--- a/qa/kern/args.c
+++ b/qa/kern/args.c
@@ -1,5 +1,5 @@
#include
-#include
+#include
/*
* The whole regression test I am after here is to call qa/kern/args with
diff --git a/qa/kern/awake.c b/qa/kern/awake.c
index ce3fe30..87ce299 100644
--- a/qa/kern/awake.c
+++ b/qa/kern/awake.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
int verbose = 1;
diff --git a/qa/kern/brk.c b/qa/kern/brk.c
index b707195..26bdbf6 100644
--- a/qa/kern/brk.c
+++ b/qa/kern/brk.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
void
main(void)
diff --git a/qa/kern/execl.c b/qa/kern/execl.c
index ae112e6..043ba56 100644
--- a/qa/kern/execl.c
+++ b/qa/kern/execl.c
@@ -1,5 +1,5 @@
#include
-#include
+#include
void
main(int argc, char *argv[])
diff --git a/qa/kern/float.c b/qa/kern/float.c
index 68335bb..7e360a4 100644
--- a/qa/kern/float.c
+++ b/qa/kern/float.c
@@ -1,5 +1,5 @@
#include
-#include
+#include
#define DPRECSTR "0.0000004000000000125"
#define DPREC 0.0000004000000000125
diff --git a/qa/kern/fork.c b/qa/kern/fork.c
index 67d7afd..0df2941 100644
--- a/qa/kern/fork.c
+++ b/qa/kern/fork.c
@@ -8,7 +8,7 @@
*/
#include
-#include
+#include
void
main(void)
diff --git a/qa/kern/frexp.c b/qa/kern/frexp.c
index aa6e8c0..7369c45 100644
--- a/qa/kern/frexp.c
+++ b/qa/kern/frexp.c
@@ -1,5 +1,5 @@
#include
-#include
+#include
#define DEEPS ".5*2^-1073"
#define DENEPS "-.5*2^-1073"
diff --git a/qa/kern/getmainpid.c b/qa/kern/getmainpid.c
index 68fcb7b..e9df7c5 100644
--- a/qa/kern/getmainpid.c
+++ b/qa/kern/getmainpid.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
void
main(void)
diff --git a/qa/kern/getpid.c b/qa/kern/getpid.c
index 50e53b2..487edb2 100644
--- a/qa/kern/getpid.c
+++ b/qa/kern/getpid.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
void
main(void)
diff --git a/qa/kern/getppid.c b/qa/kern/getppid.c
index e6b4142..32ba9ff 100644
--- a/qa/kern/getppid.c
+++ b/qa/kern/getppid.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
void
main(void)
diff --git a/qa/kern/iphash.c b/qa/kern/iphash.c
index 0685e11..6e75ff6 100644
--- a/qa/kern/iphash.c
+++ b/qa/kern/iphash.c
@@ -8,7 +8,7 @@
*/
#include
-#include
+#include
#include
/* from the kernel. Sorry. */
diff --git a/qa/kern/malloc1GiB.c b/qa/kern/malloc1GiB.c
index 7fd2a1e..fceb147 100644
--- a/qa/kern/malloc1GiB.c
+++ b/qa/kern/malloc1GiB.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
#define GiB 1024*1024*1024
diff --git a/qa/kern/memoryisolation.c b/qa/kern/memoryisolation.c
index 049872e..5385ecc 100644
--- a/qa/kern/memoryisolation.c
+++ b/qa/kern/memoryisolation.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
#define MSGTPL "Hello from %d!"
diff --git a/qa/kern/memoryshare.c b/qa/kern/memoryshare.c
index d1c7940..58f796d 100644
--- a/qa/kern/memoryshare.c
+++ b/qa/kern/memoryshare.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
#define MSGTPL "Hello from %d!"
diff --git a/qa/kern/mixedfloat.c b/qa/kern/mixedfloat.c
index 508897b..45c8f2c 100644
--- a/qa/kern/mixedfloat.c
+++ b/qa/kern/mixedfloat.c
@@ -1,5 +1,5 @@
#include
-#include
+#include
#define INT 2
#define FLOAT 2.5
diff --git a/qa/kern/noexecmem.c b/qa/kern/noexecmem.c
index 9ae02c2..55101bf 100644
--- a/qa/kern/noexecmem.c
+++ b/qa/kern/noexecmem.c
@@ -1,5 +1,5 @@
#include
-#include
+#include
#define RET 0xc3
int success;
diff --git a/qa/kern/notify.c b/qa/kern/notify.c
index 0a347e3..7881c7b 100644
--- a/qa/kern/notify.c
+++ b/qa/kern/notify.c
@@ -1,5 +1,5 @@
#include
-#include
+#include
#define RET 0xc3
void
diff --git a/qa/kern/nsec.c b/qa/kern/nsec.c
index 3118e57..c9c344e 100644
--- a/qa/kern/nsec.c
+++ b/qa/kern/nsec.c
@@ -1,5 +1,5 @@
#include
-#include
+#include
int verbose = 0;
void
diff --git a/qa/kern/pipering.c b/qa/kern/pipering.c
index be7d4df..a9e17e8 100644
--- a/qa/kern/pipering.c
+++ b/qa/kern/pipering.c
@@ -1,5 +1,5 @@
#include
-#include
+#include
int nring = 32;
int niter = 1024;
diff --git a/qa/kern/postnote.c b/qa/kern/postnote.c
index af7b9da..0815005 100644
--- a/qa/kern/postnote.c
+++ b/qa/kern/postnote.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
int verbose = 0;
int procNoteReceived;
diff --git a/qa/kern/psx.c b/qa/kern/psx.c
index bc480dc..b5cac3e 100644
--- a/qa/kern/psx.c
+++ b/qa/kern/psx.c
@@ -8,7 +8,7 @@
*/
#include
-#include
+#include
void
main(int argc, char *argv[])
diff --git a/qa/kern/sched0.c b/qa/kern/sched0.c
index f00b76a..781b90b 100644
--- a/qa/kern/sched0.c
+++ b/qa/kern/sched0.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
/* verify that the scheduler give each process a chance to run
* with a single cpu (x86) this test do not pass on plan9/9front
diff --git a/qa/kern/segattach.c b/qa/kern/segattach.c
index f80c1bb..599c007 100644
--- a/qa/kern/segattach.c
+++ b/qa/kern/segattach.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
int verbose = 1;
diff --git a/qa/kern/syscall.c b/qa/kern/syscall.c
index db3051f..222afbd 100644
--- a/qa/kern/syscall.c
+++ b/qa/kern/syscall.c
@@ -1,6 +1,6 @@
#include
-#include
+#include
void
main(void)
diff --git a/qa/kern/sysstatread.c b/qa/kern/sysstatread.c
index c2d92b6..a670cd2 100644
--- a/qa/kern/sysstatread.c
+++ b/qa/kern/sysstatread.c
@@ -1,5 +1,5 @@
#include
-#include
+#include
// Change-Id: I1cfd642d29a3955499b3507f56f0449d1710700e
// sys/src/nxm/port/devcons.c:
diff --git a/qa/kern/tsemacquire.c b/qa/kern/tsemacquire.c
index 45f6124..074dfba 100644
--- a/qa/kern/tsemacquire.c
+++ b/qa/kern/tsemacquire.c
@@ -1,5 +1,5 @@
#include
-#include
+#include
int32_t nprocs = 32;
int32_t nloops = 10000;
diff --git a/qa/kern/waserror.c b/qa/kern/waserror.c
index f135fdd..81a042a 100644
--- a/qa/kern/waserror.c
+++ b/qa/kern/waserror.c
@@ -3,7 +3,7 @@
// -- complete
// Since we're going to improve waserror
#include
-#include
+#include
void
main(void)
diff --git a/qa/lib/c/asmscall.c b/qa/lib/c/asmscall.c
index 262ae3a..4093dbe 100644
--- a/qa/lib/c/asmscall.c
+++ b/qa/lib/c/asmscall.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
int verbose = 1;
diff --git a/qa/lib/c/cleanname.c b/qa/lib/c/cleanname.c
index bf1d8be..c2a5160 100644
--- a/qa/lib/c/cleanname.c
+++ b/qa/lib/c/cleanname.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
void
main(void)
diff --git a/qa/lib/c/conswrite.c b/qa/lib/c/conswrite.c
index 1bfa111..de5a244 100644
--- a/qa/lib/c/conswrite.c
+++ b/qa/lib/c/conswrite.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
#define BUFSZ (32*1024)
void
diff --git a/qa/lib/c/hcube.c b/qa/lib/c/hcube.c
index be74a06..e032590 100644
--- a/qa/lib/c/hcube.c
+++ b/qa/lib/c/hcube.c
@@ -1,5 +1,5 @@
#include
-#include
+#include
int dim = 6;
diff --git a/qa/lib/c/lockt.c b/qa/lib/c/lockt.c
index 630728f..b4698b5 100644
--- a/qa/lib/c/lockt.c
+++ b/qa/lib/c/lockt.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
QLock rl;
Rendez rStart;
@@ -85,7 +85,7 @@ main(void)
resInWaiter = 0xff;
spawnWaiter(&l);
- lock(&l);
+ jehanne_lock(&l);
alarm(20000); /* global timeout, FAIL if reached */
if (!atnotify(failOnTimeout, 1)){
@@ -112,7 +112,7 @@ main(void)
rwakeupall(&rStart);
qunlock(&rl);
sleep(1200);
- unlock(&l);
+ jehanne_unlock(&l);
qlock(&rl);
while(elapsedInWaiter == 0)
diff --git a/qa/lib/c/longjmp.c b/qa/lib/c/longjmp.c
index 853f80e..2e2fa1b 100644
--- a/qa/lib/c/longjmp.c
+++ b/qa/lib/c/longjmp.c
@@ -1,6 +1,6 @@
#include
-#include
+#include
enum {
Njmps = 10000
diff --git a/qa/lib/c/privates.c b/qa/lib/c/privates.c
index a0d47f6..24bfa62 100644
--- a/qa/lib/c/privates.c
+++ b/qa/lib/c/privates.c
@@ -8,7 +8,7 @@
*/
#include
-#include
+#include
extern void **_privates;
extern int _nprivates;
diff --git a/qa/lib/c/privates2.c b/qa/lib/c/privates2.c
index 7d8c35a..af02b54 100644
--- a/qa/lib/c/privates2.c
+++ b/qa/lib/c/privates2.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
int spin;
int ok[2];
diff --git a/qa/lib/c/qlockt0.c b/qa/lib/c/qlockt0.c
index 0b0945b..6c8a721 100644
--- a/qa/lib/c/qlockt0.c
+++ b/qa/lib/c/qlockt0.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
/* verify that qlockt returns 0 on timeout */
diff --git a/qa/lib/c/qlockt1.c b/qa/lib/c/qlockt1.c
index 8a4b536..1066051 100644
--- a/qa/lib/c/qlockt1.c
+++ b/qa/lib/c/qlockt1.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
/* verify that lockt returns 1 if the lock is released and
* it can take it
diff --git a/qa/lib/c/qlockt2.c b/qa/lib/c/qlockt2.c
index f1acfc8..052d674 100644
--- a/qa/lib/c/qlockt2.c
+++ b/qa/lib/c/qlockt2.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
/* verify that qlockt returns 0 even on tight timeouts */
diff --git a/qa/lib/c/rlockt0.c b/qa/lib/c/rlockt0.c
index 79732de..932037b 100644
--- a/qa/lib/c/rlockt0.c
+++ b/qa/lib/c/rlockt0.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
/* verify that rlockt returns 0 on timeout */
diff --git a/qa/lib/c/rlockt1.c b/qa/lib/c/rlockt1.c
index f21e2e9..9f82837 100644
--- a/qa/lib/c/rlockt1.c
+++ b/qa/lib/c/rlockt1.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
/* verify that rlockt returns 1 if the lock is released and
* it can take it
diff --git a/qa/lib/c/rlockt2.c b/qa/lib/c/rlockt2.c
index edec15c..2bf3310 100644
--- a/qa/lib/c/rlockt2.c
+++ b/qa/lib/c/rlockt2.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
/* verify that rlockt returns 0 even on tight timeouts */
diff --git a/qa/lib/c/rsleept0.c b/qa/lib/c/rsleept0.c
index 8fde59b..60b475a 100644
--- a/qa/lib/c/rsleept0.c
+++ b/qa/lib/c/rsleept0.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
/* verify that rsleept returns 0 on timeout */
diff --git a/qa/lib/c/rsleept1.c b/qa/lib/c/rsleept1.c
index 68b1ca6..02d06f4 100644
--- a/qa/lib/c/rsleept1.c
+++ b/qa/lib/c/rsleept1.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
/* verify that lockt returns 1 if the lock is released and
* it can take it
diff --git a/qa/lib/c/rsleept2.c b/qa/lib/c/rsleept2.c
index 73cdf53..314b6a1 100644
--- a/qa/lib/c/rsleept2.c
+++ b/qa/lib/c/rsleept2.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
/* verify that rsleept returns 0 on timeout */
diff --git a/qa/lib/c/rwakeup0.c b/qa/lib/c/rwakeup0.c
index 3e3b972..1f5e3ee 100644
--- a/qa/lib/c/rwakeup0.c
+++ b/qa/lib/c/rwakeup0.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
/* verify that rwakeup returns 0 on Rendez that has already been awaken */
diff --git a/qa/lib/c/sleep.c b/qa/lib/c/sleep.c
index 8faa9ea..d3d26ee 100644
--- a/qa/lib/c/sleep.c
+++ b/qa/lib/c/sleep.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
/* Test sleep(2):
* - sleep cannot be interrupted
diff --git a/qa/lib/c/sqrt.c b/qa/lib/c/sqrt.c
index 403de18..e3650b7 100644
--- a/qa/lib/c/sqrt.c
+++ b/qa/lib/c/sqrt.c
@@ -8,7 +8,7 @@
*/
#include
-#include
+#include
/*
sqrtC returns the square root of its floating
diff --git a/qa/lib/c/sysfatal.c b/qa/lib/c/sysfatal.c
index 158bffd..20a94be 100644
--- a/qa/lib/c/sysfatal.c
+++ b/qa/lib/c/sysfatal.c
@@ -1,6 +1,6 @@
#include
-#include
+#include
void
main(void)
diff --git a/qa/lib/c/va_copy.c b/qa/lib/c/va_copy.c
index ae69174..60f4c76 100644
--- a/qa/lib/c/va_copy.c
+++ b/qa/lib/c/va_copy.c
@@ -1,5 +1,5 @@
#include
-#include
+#include
#include
void
diff --git a/qa/lib/c/vseprint.c b/qa/lib/c/vseprint.c
index 7541f04..d089248 100644
--- a/qa/lib/c/vseprint.c
+++ b/qa/lib/c/vseprint.c
@@ -9,7 +9,7 @@
*/
#include
-#include
+#include
void
testvseprint(char *buf, int n, char *fmt, ...)
{
diff --git a/qa/lib/c/wlockt0.c b/qa/lib/c/wlockt0.c
index d0f9731..b7c9115 100644
--- a/qa/lib/c/wlockt0.c
+++ b/qa/lib/c/wlockt0.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
/* verify that wlockt returns 0 on timeout */
diff --git a/qa/lib/c/wlockt1.c b/qa/lib/c/wlockt1.c
index 49a5ff5..3800085 100644
--- a/qa/lib/c/wlockt1.c
+++ b/qa/lib/c/wlockt1.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
/* verify that wlockt returns 1 if the lock is released and
* it can take it
diff --git a/qa/lib/c/wlockt2.c b/qa/lib/c/wlockt2.c
index d2a96a3..3151e70 100644
--- a/qa/lib/c/wlockt2.c
+++ b/qa/lib/c/wlockt2.c
@@ -16,7 +16,7 @@
* along with Jehanne. If not, see .
*/
#include
-#include
+#include
/* verify that wlockt returns 0 even on tight timeouts */
diff --git a/qa/lib/thread/thread.c b/qa/lib/thread/thread.c
index a671994..8a8ed51 100644
--- a/qa/lib/thread/thread.c
+++ b/qa/lib/thread/thread.c
@@ -1,6 +1,6 @@
#include
-#include
+#include
#include
enum
diff --git a/sys/include/9P2000.h b/sys/include/9P2000.h
index 3e80272..15b16fd 100644
--- a/sys/include/9P2000.h
+++ b/sys/include/9P2000.h
@@ -147,6 +147,7 @@ extern unsigned int convS2M(Fcall*, uint8_t*, uint);
extern unsigned int sizeS2M(Fcall*);
extern int statcheck(uint8_t *abuf, uint nbuf);
+extern int dirfmt(Fmt *fmt);
extern int fcallfmt(Fmt*);
extern int read9pmsg(int, void*, uint);
diff --git a/sys/include/apw/errno.h b/sys/include/apw/errno.h
index e69de29..651ce97 100644
--- a/sys/include/apw/errno.h
+++ b/sys/include/apw/errno.h
@@ -0,0 +1,215 @@
+/*
+ * This file is part of Jehanne.
+ *
+ * Copyright (C) 2016 Giacomo Tesio
+ *
+ * Jehanne is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2 of the License.
+ *
+ * Jehanne is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jehanne. If not, see .
+ */
+#ifndef _POSIX_ERRORS
+#define _POSIX_ERRORS
+
+typedef enum PosixError
+{
+ PosixE2BIG = 2, /* Argument list too long. */
+ PosixEACCES, /* Permission denied. */
+ PosixEADDRINUSE, /* Address in use. */
+ PosixEADDRNOTAVAIL, /* Address not available. */
+ PosixEAFNOSUPPORT, /* Address family not supported. */
+ PosixEAGAIN, /* Resource unavailable, try again (may be the same value as [EWOULDBLOCK]). */
+ PosixEALREADY, /* Connection already in progress. */
+ PosixEBADF, /* Bad file descriptor. */
+ PosixEBADMSG, /* Bad message. */
+ PosixEBUSY, /* Device or resource busy. */
+ PosixECANCELED, /* Operation canceled. */
+ PosixECHILD, /* No child processes. */
+ PosixECONNABORTED, /* Connection aborted. */
+ PosixECONNREFUSED, /* Connection refused. */
+ PosixECONNRESET, /* Connection reset. */
+ PosixEDEADLK, /* Resource deadlock would occur. */
+ PosixEDESTADDRREQ, /* Destination address required. */
+ PosixEDOM, /* Mathematics argument out of domain of function. */
+ PosixEDQUOT, /* Reserved. */
+ PosixEEXIST, /* File exists. */
+ PosixEFAULT, /* Bad address. */
+ PosixEFBIG, /* File too large. */
+ PosixEHOSTUNREACH, /* Host is unreachable. */
+ PosixEIDRM, /* Identifier removed. */
+ PosixEILSEQ, /* Illegal byte sequence. */
+ PosixEINPROGRESS, /* Operation in progress. */
+ PosixEINTR, /* Interrupted function. */
+ PosixEINVAL, /* Invalid argument. */
+ PosixEIO, /* I/O error. */
+ PosixEISCONN, /* Socket is connected. */
+ PosixEISDIR, /* Idirectory. */
+ PosixELOOP, /* Too many levels of symbolic links. */
+ PosixEMFILE, /* File descriptor value too large. */
+ PosixEMLINK, /* Too many links. */
+ PosixEMSGSIZE, /* Message too large. */
+ PosixEMULTIHOP, /* Reserved. */
+ PosixENAMETOOLONG, /* Filename too long. */
+ PosixENETDOWN, /* Network is down. */
+ PosixENETRESET, /* Connection aborted by network. */
+ PosixENETUNREACH, /* Network unreachable. */
+ PosixENFILE, /* Too many files open in system. */
+ PosixENOBUFS, /* No buffer space available. */
+ PosixENODATA, /* No message is available on the STREAM head read queue. */
+ PosixENODEV, /* No such device. */
+ PosixENOENT, /* No such file or directory. */
+ PosixENOEXEC, /* Executable file format error. */
+ PosixENOLCK, /* No locks available. */
+ PosixENOLINK, /* Reserved. */
+ PosixENOMEM, /* Not enough space. */
+ PosixENOMSG, /* No message of the desired type. */
+ PosixENOPROTOOPT, /* Protocol not available. */
+ PosixENOSPC, /* No space left on device. */
+ PosixENOSR, /* No STREAM resources. */
+ PosixENOSTR, /* Not a STREAM. */
+ PosixENOSYS, /* Functionality not supported. */
+ PosixENOTCONN, /* The socket is not connected. */
+ PosixENOTDIR, /* Not a directory osymbolic link tdirectory. */
+ PosixENOTEMPTY, /* Directory not empty. */
+ PosixENOTRECOVERABLE, /* State not recoverable. */
+ PosixENOTSOCK, /* Not a socket. */
+ PosixENOTSUP, /* Not supported (may be the same value as [EOPNOTSUPP]). */
+ PosixENOTTY, /* Inappropriate I/O control operation. */
+ PosixENXIO, /* No such device or address. */
+ PosixEOPNOTSUPP, /* Operation not supported on socket (may be the same value as [ENOTSUP]). */
+ PosixEOVERFLOW, /* Value too large to be stored in data type. */
+ PosixEOWNERDEAD, /* Previous owner died. */
+ PosixEPERM, /* Operation not permitted. */
+ PosixEPIPE, /* Broken pipe. */
+ PosixEPROTO, /* Protocol error. */
+ PosixEPROTONOSUPPORT, /* Protocol not supported. */
+ PosixEPROTOTYPE, /* Protocol wrong type for socket. */
+ PosixERANGE, /* Result too large. */
+ PosixEROFS, /* Read-only file system. */
+ PosixESPIPE, /* Invalid seek. */
+ PosixESRCH, /* No such process. */
+ PosixESTALE, /* Reserved. */
+ PosixETIME, /* Stream ioctl() timeout. */
+ PosixETIMEDOUT, /* Connection timed out. */
+ PosixETXTBSY, /* Text file busy. */
+ PosixEWOULDBLOCK, /* Operation would block (may be the same value as [EAGAIN]). */
+ PosixEXDEV, /* Cross-device link. */
+} PosixError;
+
+#define ERRNO_FIRST PosixE2BIG /* Value of the first error constant */
+#define ERRNO_LAST PosixEXDEV /* Value of the last error constant */
+
+#endif
+
+#ifndef _ERRNO_H
+#define _ERRNO_H
+
+extern int __errno();
+#define errno __errno()
+
+/* See The Open Group Base Specifications Issue 7
+ * IEEE Std 1003.1-2008, 2016 Edition got from
+ * http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html#tag_13_10
+ *
+ * NOTES:
+ * None of these errno will ever be set by the Jehanne kernel.
+ * It's possible however that a file server designed to mimic a Unix
+ * behaviour use them.
+ *
+ * The value 1 is reserved since -1 is the default return value of
+ * failing syscalls.
+ *
+ * The constant values are continuous, thus ERRNO_FIRST and ERRNO_LAST
+ * can be used to create a map from errors to descriptions.
+ */
+
+#define E2BIG PosixE2BIG
+#define EACCES PosixEACCES
+#define EADDRINUSE PosixEADDRINUSE
+#define EADDRNOTAVAIL PosixEADDRNOTAVAIL
+#define EAFNOSUPPORT PosixEAFNOSUPPORT
+#define EAGAIN PosixEAGAIN
+#define EALREADY PosixEALREADY
+#define EBADF PosixEBADF
+#define EBADMSG PosixEBADMSG
+#define EBUSY PosixEBUSY
+#define ECANCELED PosixECANCELED
+#define ECHILD PosixECHILD
+#define ECONNABORTED PosixECONNABORTED
+#define ECONNREFUSED PosixECONNREFUSED
+#define ECONNRESET PosixECONNRESET
+#define EDEADLK PosixEDEADLK
+#define EDESTADDRREQ PosixEDESTADDRREQ
+#define EDOM PosixEDOM
+#define EDQUOT PosixEDQUOT
+#define EEXIST PosixEEXIST
+#define EFAULT PosixEFAULT
+#define EFBIG PosixEFBIG
+#define EHOSTUNREACH PosixEHOSTUNREACH
+#define EIDRM PosixEIDRM
+#define EILSEQ PosixEILSEQ
+#define EINPROGRESS PosixEINPROGRESS
+#define EINTR PosixEINTR
+#define EINVAL PosixEINVAL
+#define EIO PosixEIO
+#define EISCONN PosixEISCONN
+#define EISDIR PosixEISDIR
+#define ELOOP PosixELOOP
+#define EMFILE PosixEMFILE
+#define EMLINK PosixEMLINK
+#define EMSGSIZE PosixEMSGSIZE
+#define EMULTIHOP PosixEMULTIHOP
+#define ENAMETOOLONG PosixENAMETOOLONG
+#define ENETDOWN PosixENETDOWN
+#define ENETRESET PosixENETRESET
+#define ENETUNREACH PosixENETUNREACH
+#define ENFILE PosixENFILE
+#define ENOBUFS PosixENOBUFS
+#define ENODATA PosixENODATA
+#define ENODEV PosixENODEV
+#define ENOENT PosixENOENT
+#define ENOEXEC PosixENOEXEC
+#define ENOLCK PosixENOLCK
+#define ENOLINK PosixENOLINK
+#define ENOMEM PosixENOMEM
+#define ENOMSG PosixENOMSG
+#define ENOPROTOOPT PosixENOPROTOOPT
+#define ENOSPC PosixENOSPC
+#define ENOSR PosixENOSR
+#define ENOSTR PosixENOSTR
+#define ENOSYS PosixENOSYS
+#define ENOTCONN PosixENOTCONN
+#define ENOTDIR PosixENOTDIR
+#define ENOTEMPTY PosixENOTEMPTY
+#define ENOTRECOVERABLE PosixENOTRECOVERABLE
+#define ENOTSOCK PosixENOTSOCK
+#define ENOTSUP PosixENOTSUP
+#define ENOTTY PosixENOTTY
+#define ENXIO PosixENXIO
+#define EOPNOTSUPP PosixEOPNOTSUPP
+#define EOVERFLOW PosixEOVERFLOW
+#define EOWNERDEAD PosixEOWNERDEAD
+#define EPERM PosixEPERM
+#define EPIPE PosixEPIPE
+#define EPROTO PosixEPROTO
+#define EPROTONOSUPPORT PosixEPROTONOSUPPORT
+#define EPROTOTYPE PosixEPROTOTYPE
+#define ERANGE PosixERANGE
+#define EROFS PosixEROFS
+#define ESPIPE PosixESPIPE
+#define ESRCH PosixESRCH
+#define ESTALE PosixESTALE
+#define ETIME PosixETIME
+#define ETIMEDOUT PosixETIMEDOUT
+#define ETXTBSY PosixETXTBSY
+#define EWOULDBLOCK PosixEWOULDBLOCK
+#define EXDEV PosixEXDEV
+
+#endif
diff --git a/sys/include/apw/stdlib.h b/sys/include/apw/stdlib.h
index 0176301..594768a 100644
--- a/sys/include/apw/stdlib.h
+++ b/sys/include/apw/stdlib.h
@@ -22,7 +22,7 @@
#define EXIT_SUCCESS 0
#define EXIT_FAILURE 1 // POSIX
-#define __POSIX_EXIT_PREFIX "posix exit: "
+#include // to get __POSIX_EXIT_PREFIX
typedef struct {
int quot;
diff --git a/sys/include/ip.h b/sys/include/ip.h
index 9942a4a..2095586 100644
--- a/sys/include/ip.h
+++ b/sys/include/ip.h
@@ -192,8 +192,8 @@ uint16_t ptclbsum(uint8_t*, int);
int v6tov4(uint8_t*, uint8_t*);
void v4tov6(uint8_t*, uint8_t*);
-#define ipcmp(x, y) memcmp(x, y, IPaddrlen)
-#define ipmove(x, y) memmove(x, y, IPaddrlen)
+#define ipcmp(x, y) jehanne_memcmp(x, y, IPaddrlen)
+#define ipmove(x, y) jehanne_memmove(x, y, IPaddrlen)
extern uint8_t IPv4bcast[IPaddrlen];
extern uint8_t IPv4bcastobs[IPaddrlen];
diff --git a/sys/include/lib9.h b/sys/include/lib9.h
new file mode 100644
index 0000000..6a17cbb
--- /dev/null
+++ b/sys/include/lib9.h
@@ -0,0 +1,310 @@
+/*
+ * This file is part of Jehanne.
+ *
+ * Copyright (C) 2017 Giacomo Tesio
+ *
+ * Jehanne is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2 of the License.
+ *
+ * Jehanne is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jehanne. If not, see .
+ */
+
+/* lib9.h provides macros to map Plan9's libc functions to Jehanne one */
+
+#include
+
+#define memccpy jehanne_memccpy
+#define memset jehanne_memset
+#define memcmp jehanne_memcmp
+#define memcpy jehanne_memcpy
+#define memmove jehanne_memmove
+#define memchr jehanne_memchr
+#define strcat jehanne_strcat
+#define strchr jehanne_strchr
+#define strcmp jehanne_strcmp
+#define strcpy jehanne_strcpy
+#define strecpy jehanne_strecpy
+#define strdup jehanne_strdup
+#define strncat jehanne_strncat
+#define strncpy jehanne_strncpy
+#define strncmp jehanne_strncmp
+#define strpbrk jehanne_strpbrk
+#define strrchr jehanne_strrchr
+#define strtok jehanne_strtok
+#define strlen jehanne_strlen
+#define strspn jehanne_strspn
+#define strcspn jehanne_strcspn
+#define strstr jehanne_strstr
+#define cistrncmp jehanne_cistrncmp
+#define cistrcmp jehanne_cistrcmp
+#define cistrstr jehanne_cistrstr
+#define tokenize jehanne_tokenize
+#define runetochar jehanne_runetochar
+#define chartorune jehanne_chartorune
+#define runelen jehanne_runelen
+#define runenlen jehanne_runenlen
+#define fullrune jehanne_fullrune
+#define utflen jehanne_utflen
+#define utfnlen jehanne_utfnlen
+#define utfrune jehanne_utfrune
+#define utfrrune jehanne_utfrrune
+#define utfutf jehanne_utfutf
+#define utfecpy jehanne_utfecpy
+#define runestrcat jehanne_runestrcat
+#define runestrchr jehanne_runestrchr
+#define runestrcmp jehanne_runestrcmp
+#define runestrcpy jehanne_runestrcpy
+#define runestrncpy jehanne_runestrncpy
+#define runestrecpy jehanne_runestrecpy
+#define runestrdup jehanne_runestrdup
+#define runestrncat jehanne_runestrncat
+#define runestrncmp jehanne_runestrncmp
+#define runestrrchr jehanne_runestrrchr
+#define runestrlen jehanne_runestrlen
+#define runestrstr jehanne_runestrstr
+#define tolowerrune jehanne_tolowerrune
+#define totitlerune jehanne_totitlerune
+#define toupperrune jehanne_toupperrune
+#define tobaserune jehanne_tobaserune
+#define isalpharune jehanne_isalpharune
+#define isbaserune jehanne_isbaserune
+#define isdigitrune jehanne_isdigitrune
+#define islowerrune jehanne_islowerrune
+#define isspacerune jehanne_isspacerune
+#define istitlerune jehanne_istitlerune
+#define isupperrune jehanne_isupperrune
+#define malloc jehanne_malloc
+#define malloc jehanne_malloc
+#define mallocz jehanne_mallocz
+#define free jehanne_free
+#define msize jehanne_msize
+#define mallocalign jehanne_mallocalign
+#define calloc jehanne_calloc
+#define realloc jehanne_realloc
+#define setmalloctag jehanne_setmalloctag
+#define setrealloctag jehanne_setrealloctag
+#define getmalloctag jehanne_getmalloctag
+#define getrealloctag jehanne_getrealloctag
+#define malloctopoolblock jehanne_malloctopoolblock
+#define print jehanne_print
+#define print jehanne_print
+#define seprint jehanne_seprint
+#define vseprint jehanne_vseprint
+#define snprint jehanne_snprint
+#define vsnprint jehanne_vsnprint
+#define smprint jehanne_smprint
+#define vsmprint jehanne_vsmprint
+#define sprint jehanne_sprint
+#define fprint jehanne_fprint
+#define vfprint jehanne_vfprint
+#define runesprint jehanne_runesprint
+#define runesnprint jehanne_runesnprint
+#define runevsnprint jehanne_runevsnprint
+#define runeseprint jehanne_runeseprint
+#define runevseprint jehanne_runevseprint
+#define runesmprint jehanne_runesmprint
+#define runevsmprint jehanne_runevsmprint
+#define fmtfdinit jehanne_fmtfdinit
+#define fmtfdflush jehanne_fmtfdflush
+#define fmtstrinit jehanne_fmtstrinit
+#define fmtstrflush jehanne_fmtstrflush
+#define runefmtstrinit jehanne_runefmtstrinit
+#define runefmtstrflush jehanne_runefmtstrflush
+#define fmtinstall jehanne_fmtinstall
+#define dofmt jehanne_dofmt
+#define dorfmt jehanne_dorfmt
+#define fmtprint jehanne_fmtprint
+#define fmtvprint jehanne_fmtvprint
+#define fmtrune jehanne_fmtrune
+#define fmtstrcpy jehanne_fmtstrcpy
+#define fmtrunestrcpy jehanne_fmtrunestrcpy
+#define errfmt jehanne_errfmt
+#define unquotestrdup jehanne_unquotestrdup
+#define unquoterunestrdup jehanne_unquoterunestrdup
+#define quotestrdup jehanne_quotestrdup
+#define quoterunestrdup jehanne_quoterunestrdup
+#define quotestrfmt jehanne_quotestrfmt
+#define quoterunestrfmt jehanne_quoterunestrfmt
+#define quotefmtinstall jehanne_quotefmtinstall
+#define needsrcquote jehanne_needsrcquote
+#define srand jehanne_srand
+#define rand jehanne_rand
+#define nrand jehanne_nrand
+#define lrand jehanne_lrand
+#define lnrand jehanne_lnrand
+#define frand jehanne_frand
+#define truerand jehanne_truerand
+#define ntruerand jehanne_ntruerand
+#define getfcr jehanne_getfcr
+#define setfsr jehanne_setfsr
+#define setfcr jehanne_setfcr
+#define NaN jehanne_NaN
+#define Inf jehanne_Inf
+#define isNaN jehanne_isNaN
+#define isInf jehanne_isInf
+#define umuldiv jehanne_umuldiv
+#define muldiv jehanne_muldiv
+#define pow jehanne_pow
+#define atan2 jehanne_atan2
+#define fabs jehanne_fabs
+#define atan jehanne_atan
+#define log jehanne_log
+#define log10 jehanne_log10
+#define exp jehanne_exp
+#define floor jehanne_floor
+#define ceil jehanne_ceil
+#define hypot jehanne_hypot
+#define sin jehanne_sin
+#define cos jehanne_cos
+#define tan jehanne_tan
+#define asin jehanne_asin
+#define acos jehanne_acos
+#define sinh jehanne_sinh
+#define cosh jehanne_cosh
+#define tanh jehanne_tanh
+#define sqrt jehanne_sqrt
+#define fmod jehanne_fmod
+#define gmtime jehanne_gmtime
+#define localtime jehanne_localtime
+#define asctime jehanne_asctime
+#define ctime jehanne_ctime
+#define cputime jehanne_cputime
+#define times jehanne_times
+#define tm2sec jehanne_tm2sec
+#define nsec jehanne_nsec
+#define _assert jehanne__assert
+#define abs jehanne_abs
+#define atexit jehanne_atexit
+#define atexitdont jehanne_atexitdont
+#define atnotify jehanne_atnotify
+#define atof jehanne_atof
+#define atoi jehanne_atoi
+#define atol jehanne_atol
+#define atoll jehanne_atoll
+#define charstod jehanne_charstod
+#define chdir jehanne_chdir
+#define cleanname jehanne_cleanname
+#define dec64 jehanne_dec64
+#define enc64 jehanne_enc64
+#define dec32 jehanne_dec32
+#define enc32 jehanne_enc32
+#define dec16 jehanne_dec16
+#define enc16 jehanne_enc16
+#define encodefmt jehanne_encodefmt
+#define exits jehanne_exits
+#define frexp jehanne_frexp
+#define getcallerpc jehanne_getcallerpc
+#define getenv jehanne_getenv
+#define getfields jehanne_getfields
+#define gettokens jehanne_gettokens
+#define getuser jehanne_getuser
+#define getwd jehanne_getwd
+#define iounit jehanne_iounit
+#define labs jehanne_labs
+#define ldexp jehanne_ldexp
+#define longjmp jehanne_longjmp
+#define mktemp jehanne_mktemp
+#define modf jehanne_modf
+#define notejmp jehanne_notejmp
+#define nsec jehanne_nsec
+#define dup jehanne_dup
+#define ocreate jehanne_ocreate
+#define perror jehanne_perror
+#define pipe jehanne_pipe
+#define postnote jehanne_postnote
+#define pow10 jehanne_pow10
+#define putenv jehanne_putenv
+#define qsort jehanne_qsort
+#define bsearch jehanne_bsearch
+#define setjmp jehanne_setjmp
+#define strtod jehanne_strtod
+#define strtol jehanne_strtol
+#define strtoul jehanne_strtoul
+#define strtoll jehanne_strtoll
+#define strtoull jehanne_strtoull
+#define sysfatal jehanne_sysfatal
+#define syslog jehanne_syslog
+#define time jehanne_time
+#define tolower jehanne_tolower
+#define toupper jehanne_toupper
+#define ainc jehanne_ainc
+#define adec jehanne_adec
+#define _tas jehanne__tas
+#define lock jehanne_lock
+#define lockt jehanne_lockt
+#define unlock jehanne_unlock
+#define canlock jehanne_canlock
+#define lock; jehanne_lock;
+#define qlock jehanne_qlock
+#define qlockt jehanne_qlockt
+#define qunlock jehanne_qunlock
+#define canqlock jehanne_canqlock
+#define _qlockinit jehanne__qlockinit
+#define lock; jehanne_lock;
+#define rlock jehanne_rlock
+#define rlockt jehanne_rlockt
+#define runlock jehanne_runlock
+#define canrlock jehanne_canrlock
+#define wlock jehanne_wlock
+#define wlockt jehanne_wlockt
+#define wunlock jehanne_wunlock
+#define canwlock jehanne_canwlock
+#define rsleep jehanne_rsleep
+#define rsleept jehanne_rsleept
+#define rwakeup jehanne_rwakeup
+#define rwakeupall jehanne_rwakeupall
+#define privalloc jehanne_privalloc
+#define accept jehanne_accept
+#define announce jehanne_announce
+#define dial jehanne_dial
+#define setnetmtpt jehanne_setnetmtpt
+#define hangup jehanne_hangup
+#define listen jehanne_listen
+#define netmkaddr jehanne_netmkaddr
+#define reject jehanne_reject
+#define pushssl jehanne_pushssl
+#define pushtls jehanne_pushtls
+#define getnetconninfo jehanne_getnetconninfo
+#define freenetconninfo jehanne_freenetconninfo
+#define access jehanne_access
+#define awakened jehanne_awakened
+#define brk jehanne_brk
+#define execl jehanne_execl
+#define forgivewkp jehanne_forgivewkp
+#define fork jehanne_fork
+#define readn jehanne_readn
+#define segbrk jehanne_segbrk
+#define segbrk jehanne_segbrk
+#define segattach jehanne_segattach
+#define segdetach jehanne_segdetach
+#define segfree jehanne_segfree
+#define sleep jehanne_sleep
+#define stat jehanne_stat
+#define wait jehanne_wait
+#define waitpid jehanne_waitpid
+#define wstat jehanne_wstat
+#define dirstat jehanne_dirstat
+#define dirfstat jehanne_dirfstat
+#define dirwstat jehanne_dirwstat
+#define dirfwstat jehanne_dirfwstat
+#define dirread jehanne_dirread
+#define nulldir jehanne_nulldir
+#define dirreadall jehanne_dirreadall
+#define getpid jehanne_getpid
+#define getppid jehanne_getppid
+#define getmainpid jehanne_getmainpid
+#define rerrstr jehanne_rerrstr
+#define sysname jehanne_sysname
+#define werrstr jehanne_werrstr
+#define convM2D jehanne_convM2D
+#define convD2M jehanne_convD2M
+#define sizeD2M jehanne_sizeD2M
+#define dirmodefmt jehanne_dirmodefmt
+#define chartorune jehanne_chartorune
diff --git a/sys/include/libc.h b/sys/include/libc.h
index e40e300..de36b13 100644
--- a/sys/include/libc.h
+++ b/sys/include/libc.h
@@ -16,7 +16,7 @@
#define nelem(x) (sizeof(x)/sizeof((x)[0]))
#define offsetof(s, m) (uintptr_t)(&(((s*)0)->m))
-#define assert(x) if(x){}else _assert(#x)
+#define assert(x) if(x){}else jehanne__assert(#x)
extern void (*_abort)(void);
#define abort() if(_abort){_abort();}else{while(*(int*)0);}
@@ -24,36 +24,36 @@ extern void (*_abort)(void);
/*
* mem routines
*/
-extern void* memccpy(void*, const void*, int, uint32_t);
-extern void* memset(void*, int, uint32_t);
-extern int memcmp(const void*, const void*, uint32_t);
-extern void* memcpy(void*, const void*, size_t);
-extern void* memmove(void*, const void*, size_t);
-extern void* memchr(const void*, int, uint32_t);
+extern void* jehanne_memccpy(void*, const void*, int, uint32_t);
+extern void* jehanne_memset(void*, int, uint32_t);
+extern int jehanne_memcmp(const void*, const void*, uint32_t);
+extern void* jehanne_memcpy(void*, const void*, size_t);
+extern void* jehanne_memmove(void*, const void*, size_t);
+extern void* jehanne_memchr(const void*, int, uint32_t);
/*
* string routines
*/
-extern char* strcat(char*, const char*);
-extern char* strchr(const char*, int);
-extern int strcmp(const char*, const char*);
-extern char* strcpy(char*, const char*);
-extern char* strecpy(char*, char *, const char*);
-extern char* strdup(const char*);
-extern char* strncat(char*, const char*, int32_t);
-extern char* strncpy(char*, const char*, uint32_t);
-extern int strncmp(const char*, const char*, int32_t);
-extern char* strpbrk(const char*, const char*);
-extern char* strrchr(const char*, int);
-extern char* strtok(char*, char*);
-extern int strlen(const char*);
-extern int32_t strspn(const char*, const char*);
-extern int32_t strcspn(const char*, const char*);
-extern char* strstr(const char*, const char*);
-extern int cistrncmp(const char*, const char*, int);
-extern int cistrcmp(const char*, const char*);
-extern char* cistrstr(const char*, const char*);
-extern int tokenize(char*, char**, int);
+extern char* jehanne_strcat(char*, const char*);
+extern char* jehanne_strchr(const char*, int);
+extern int jehanne_strcmp(const char*, const char*);
+extern char* jehanne_strcpy(char*, const char*);
+extern char* jehanne_strecpy(char*, char *, const char*);
+extern char* jehanne_strdup(const char*);
+extern char* jehanne_strncat(char*, const char*, int32_t);
+extern char* jehanne_strncpy(char*, const char*, uint32_t);
+extern int jehanne_strncmp(const char*, const char*, int32_t);
+extern char* jehanne_strpbrk(const char*, const char*);
+extern char* jehanne_strrchr(const char*, int);
+extern char* jehanne_strtok(char*, char*);
+extern int jehanne_strlen(const char*);
+extern int32_t jehanne_strspn(const char*, const char*);
+extern int32_t jehanne_strcspn(const char*, const char*);
+extern char* jehanne_strstr(const char*, const char*);
+extern int jehanne_cistrncmp(const char*, const char*, int);
+extern int jehanne_cistrcmp(const char*, const char*);
+extern char* jehanne_cistrstr(const char*, const char*);
+extern int jehanne_tokenize(char*, char**, int);
enum
{
@@ -68,58 +68,58 @@ enum
/*
* rune routines
*/
-extern int runetochar(char*, const Rune*);
-extern int chartorune(Rune*, const char*);
-extern int runelen(Rune);
-extern int runenlen(const Rune*, int);
-extern int fullrune(const char*, int);
-extern int utflen(const char*);
-extern int utfnlen(const char*, int32_t);
-extern char* utfrune(const char*, Rune);
-extern char* utfrrune(const char*, Rune);
-extern char* utfutf(const char*, const char*);
-extern char* utfecpy(char*, char *, const char*);
+extern int jehanne_runetochar(char*, const Rune*);
+extern int jehanne_chartorune(Rune*, const char*);
+extern int jehanne_runelen(Rune);
+extern int jehanne_runenlen(const Rune*, int);
+extern int jehanne_fullrune(const char*, int);
+extern int jehanne_utflen(const char*);
+extern int jehanne_utfnlen(const char*, int32_t);
+extern char* jehanne_utfrune(const char*, Rune);
+extern char* jehanne_utfrrune(const char*, Rune);
+extern char* jehanne_utfutf(const char*, const char*);
+extern char* jehanne_utfecpy(char*, char *, const char*);
-extern Rune* runestrcat(Rune*, const Rune*);
-extern Rune* runestrchr(const Rune*, Rune);
-extern int runestrcmp(const Rune*, const Rune*);
-extern Rune* runestrcpy(Rune*, const Rune*);
-extern Rune* runestrncpy(Rune*, const Rune*, int32_t);
-extern Rune* runestrecpy(Rune*, Rune*, const Rune*);
-extern Rune* runestrdup(const Rune*);
-extern Rune* runestrncat(Rune*, const Rune*, int32_t);
-extern int runestrncmp(const Rune*, const Rune*, int32_t);
-extern Rune* runestrrchr(const Rune*, Rune);
-extern int32_t runestrlen(const Rune*);
-extern Rune* runestrstr(const Rune*, const Rune*);
+extern Rune* jehanne_runestrcat(Rune*, const Rune*);
+extern Rune* jehanne_runestrchr(const Rune*, Rune);
+extern int jehanne_runestrcmp(const Rune*, const Rune*);
+extern Rune* jehanne_runestrcpy(Rune*, const Rune*);
+extern Rune* jehanne_runestrncpy(Rune*, const Rune*, int32_t);
+extern Rune* jehanne_runestrecpy(Rune*, Rune*, const Rune*);
+extern Rune* jehanne_runestrdup(const Rune*);
+extern Rune* jehanne_runestrncat(Rune*, const Rune*, int32_t);
+extern int jehanne_runestrncmp(const Rune*, const Rune*, int32_t);
+extern Rune* jehanne_runestrrchr(const Rune*, Rune);
+extern int32_t jehanne_runestrlen(const Rune*);
+extern Rune* jehanne_runestrstr(const Rune*, const Rune*);
-extern Rune tolowerrune(Rune);
-extern Rune totitlerune(Rune);
-extern Rune toupperrune(Rune);
-extern Rune tobaserune(Rune);
-extern int isalpharune(Rune);
-extern int isbaserune(Rune);
-extern int isdigitrune(Rune);
-extern int islowerrune(Rune);
-extern int isspacerune(Rune);
-extern int istitlerune(Rune);
-extern int isupperrune(Rune);
+extern Rune jehanne_tolowerrune(Rune);
+extern Rune jehanne_totitlerune(Rune);
+extern Rune jehanne_toupperrune(Rune);
+extern Rune jehanne_tobaserune(Rune);
+extern int jehanne_isalpharune(Rune);
+extern int jehanne_isbaserune(Rune);
+extern int jehanne_isdigitrune(Rune);
+extern int jehanne_islowerrune(Rune);
+extern int jehanne_isspacerune(Rune);
+extern int jehanne_istitlerune(Rune);
+extern int jehanne_isupperrune(Rune);
/*
* malloc
*/
-extern void* malloc(size_t);
-extern void* mallocz(uint32_t, int);
-extern void free(void*);
-extern uint32_t msize(void*);
-extern void* mallocalign(uint32_t, uint32_t, int32_t, uint32_t);
-extern void* calloc(uint32_t, size_t);
-extern void* realloc(void*, size_t);
-void setmalloctag(void*, uintptr_t);
-void setrealloctag(void*, uintptr_t);
-uintptr_t getmalloctag(void*);
-uintptr_t getrealloctag(void*);
-void* malloctopoolblock(void*);
+extern void* jehanne_malloc(size_t);
+extern void* jehanne_mallocz(uint32_t, int);
+extern void jehanne_free(void*);
+extern uint32_t jehanne_msize(void*);
+extern void* jehanne_mallocalign(uint32_t, uint32_t, int32_t, uint32_t);
+extern void* jehanne_calloc(uint32_t, size_t);
+extern void* jehanne_realloc(void*, size_t);
+void jehanne_setmalloctag(void*, uintptr_t);
+void jehanne_setrealloctag(void*, uintptr_t);
+uintptr_t jehanne_getmalloctag(void*);
+uintptr_t jehanne_getrealloctag(void*);
+void* jehanne_malloctopoolblock(void*);
/*
* print routines
@@ -158,164 +158,105 @@ enum{
FmtFlag = FmtByte << 1
};
-extern int print(const char*, ...);
-extern char* seprint(char*, char*, const char*, ...);
-extern char* vseprint(char*, char*, const char*, va_list);
-extern int snprint(char*, int, const char*, ...);
-extern int vsnprint(char*, int, const char*, va_list);
-extern char* smprint(const char*, ...);
-extern char* vsmprint(const char*, va_list);
-extern int sprint(char*, const char*, ...);
-extern int fprint(int, const char*, ...);
-extern int vfprint(int, const char*, va_list);
+extern int jehanne_print(const char*, ...);
+extern char* jehanne_seprint(char*, char*, const char*, ...);
+extern char* jehanne_vseprint(char*, char*, const char*, va_list);
+extern int jehanne_snprint(char*, int, const char*, ...);
+extern int jehanne_vsnprint(char*, int, const char*, va_list);
+extern char* jehanne_smprint(const char*, ...);
+extern char* jehanne_vsmprint(const char*, va_list);
+extern int jehanne_sprint(char*, const char*, ...);
+extern int jehanne_fprint(int, const char*, ...);
+extern int jehanne_vfprint(int, const char*, va_list);
-extern int runesprint(Rune*, const char*, ...);
-extern int runesnprint(Rune*, int, const char*, ...);
-extern int runevsnprint(Rune*, int, const char*, va_list);
-extern Rune* runeseprint(Rune*, Rune*, const char*, ...);
-extern Rune* runevseprint(Rune*, Rune*, const char*, va_list);
-extern Rune* runesmprint(const char*, ...);
-extern Rune* runevsmprint(const char*, va_list);
+extern int jehanne_runesprint(Rune*, const char*, ...);
+extern int jehanne_runesnprint(Rune*, int, const char*, ...);
+extern int jehanne_runevsnprint(Rune*, int, const char*, va_list);
+extern Rune* jehanne_runeseprint(Rune*, Rune*, const char*, ...);
+extern Rune* jehanne_runevseprint(Rune*, Rune*, const char*, va_list);
+extern Rune* jehanne_runesmprint(const char*, ...);
+extern Rune* jehanne_runevsmprint(const char*, va_list);
-extern int fmtfdinit(Fmt*, int, char*, int);
-extern int fmtfdflush(Fmt*);
-extern int fmtstrinit(Fmt*);
-extern char* fmtstrflush(Fmt*);
-extern int runefmtstrinit(Fmt*);
-extern Rune* runefmtstrflush(Fmt*);
+extern int jehanne_fmtfdinit(Fmt*, int, char*, int);
+extern int jehanne_fmtfdflush(Fmt*);
+extern int jehanne_fmtstrinit(Fmt*);
+extern char* jehanne_fmtstrflush(Fmt*);
+extern int jehanne_runefmtstrinit(Fmt*);
+extern Rune* jehanne_runefmtstrflush(Fmt*);
-#pragma varargck argpos fmtprint 2
-#pragma varargck argpos fprint 2
-#pragma varargck argpos print 1
-#pragma varargck argpos runeseprint 3
-#pragma varargck argpos runesmprint 1
-#pragma varargck argpos runesnprint 3
-#pragma varargck argpos runesprint 2
-#pragma varargck argpos seprint 3
-#pragma varargck argpos smprint 1
-#pragma varargck argpos snprint 3
-#pragma varargck argpos sprint 2
-
-#pragma varargck type "lld" vlong
-#pragma varargck type "llo" vlong
-#pragma varargck type "llx" vlong
-#pragma varargck type "llb" vlong
-#pragma varargck type "lld" uvlong
-#pragma varargck type "llo" uvlong
-#pragma varargck type "llx" uvlong
-#pragma varargck type "llb" uvlong
-#pragma varargck type "ld" long
-#pragma varargck type "lo" long
-#pragma varargck type "lx" long
-#pragma varargck type "lb" long
-#pragma varargck type "ld" ulong
-#pragma varargck type "lo" ulong
-#pragma varargck type "lx" ulong
-#pragma varargck type "lb" ulong
-#pragma varargck type "d" int
-#pragma varargck type "o" int
-#pragma varargck type "x" int
-#pragma varargck type "c" int
-#pragma varargck type "C" int
-#pragma varargck type "b" int
-#pragma varargck type "d" uint32_t
-#pragma varargck type "x" uint32_t
-#pragma varargck type "c" uint32_t
-#pragma varargck type "C" uint32_t
-#pragma varargck type "b" uint32_t
-#pragma varargck type "f" double
-#pragma varargck type "e" double
-#pragma varargck type "g" double
-#pragma varargck type "s" char*
-#pragma varargck type "q" char*
-#pragma varargck type "S" Rune*
-#pragma varargck type "Q" Rune*
-#pragma varargck type "r" void
-#pragma varargck type "%" void
-#pragma varargck type "n" int*
-#pragma varargck type "p" uintptr_t
-#pragma varargck type "p" void*
-#pragma varargck flag ','
-#pragma varargck flag ' '
-#pragma varargck flag 'h'
-#pragma varargck type "<" void*
-#pragma varargck type "[" void*
-#pragma varargck type "H" void*
-#pragma varargck type "lH" void*
-
-extern int fmtinstall(int, int (*)(Fmt*));
-extern int dofmt(Fmt*, const char*);
-extern int dorfmt(Fmt*, const Rune*);
-extern int fmtprint(Fmt*, const char*, ...);
-extern int fmtvprint(Fmt*, const char*, va_list);
-extern int fmtrune(Fmt*, int);
-extern int fmtstrcpy(Fmt*, const char*);
-extern int fmtrunestrcpy(Fmt*, const Rune*);
+extern int jehanne_fmtinstall(int, int (*)(Fmt*));
+extern int jehanne_dofmt(Fmt*, const char*);
+extern int jehanne_dorfmt(Fmt*, const Rune*);
+extern int jehanne_fmtprint(Fmt*, const char*, ...);
+extern int jehanne_fmtvprint(Fmt*, const char*, va_list);
+extern int jehanne_fmtrune(Fmt*, int);
+extern int jehanne_fmtstrcpy(Fmt*, const char*);
+extern int jehanne_fmtrunestrcpy(Fmt*, const Rune*);
/*
* error string for %r
* supplied on per os basis, not part of fmt library
*/
-extern int errfmt(Fmt *f);
+extern int jehanne_errfmt(Fmt *f);
/*
* quoted strings
*/
-extern char *unquotestrdup(const char*);
-extern Rune *unquoterunestrdup(const Rune*);
-extern char *quotestrdup(const char*);
-extern Rune *quoterunestrdup(const Rune*);
-extern int quotestrfmt(Fmt*);
-extern int quoterunestrfmt(Fmt*);
-extern void quotefmtinstall(void);
+extern char *jehanne_unquotestrdup(const char*);
+extern Rune *jehanne_unquoterunestrdup(const Rune*);
+extern char *jehanne_quotestrdup(const char*);
+extern Rune *jehanne_quoterunestrdup(const Rune*);
+extern int jehanne_quotestrfmt(Fmt*);
+extern int jehanne_quoterunestrfmt(Fmt*);
+extern void jehanne_quotefmtinstall(void);
extern int (*doquote)(int);
-extern int needsrcquote(int);
+extern int jehanne_needsrcquote(int);
/*
* random number
*/
-extern void srand(int32_t);
-extern int rand(void);
-extern int nrand(int);
-extern int32_t lrand(void);
-extern int32_t lnrand(int32_t);
-extern double frand(void);
-extern uint32_t truerand(void); /* uses /dev/random */
-extern uint32_t ntruerand(uint32_t); /* uses /dev/random */
+extern void jehanne_srand(int32_t);
+extern int jehanne_rand(void);
+extern int jehanne_nrand(int);
+extern int32_t jehanne_lrand(void);
+extern int32_t jehanne_lnrand(int32_t);
+extern double jehanne_frand(void);
+extern uint32_t jehanne_truerand(void); /* uses /dev/random */
+extern uint32_t jehanne_ntruerand(uint32_t); /* uses /dev/random */
/*
* math
*/
-extern uint32_t getfcr(void);
-extern void setfsr(uint32_t);
+extern uint32_t jehanne_getfcr(void);
+extern void jehanne_setfsr(uint32_t);
extern uint32_t getfsr(void);
-extern void setfcr(uint32_t);
-extern double NaN(void);
-extern double Inf(int);
-extern int isNaN(double);
-extern int isInf(double, int);
-extern uint32_t umuldiv(uint32_t, uint32_t, uint32_t);
-extern int32_t muldiv(int32_t, int32_t, int32_t);
+extern void jehanne_setfcr(uint32_t);
+extern double jehanne_NaN(void);
+extern double jehanne_Inf(int);
+extern int jehanne_isNaN(double);
+extern int jehanne_isInf(double, int);
+extern uint32_t jehanne_umuldiv(uint32_t, uint32_t, uint32_t);
+extern int32_t jehanne_muldiv(int32_t, int32_t, int32_t);
-extern double pow(double, double);
-extern double atan2(double, double);
-extern double fabs(double);
-extern double atan(double);
-extern double log(double);
-extern double log10(double);
-extern double exp(double);
-extern double floor(double);
-extern double ceil(double);
-extern double hypot(double, double);
-extern double sin(double);
-extern double cos(double);
-extern double tan(double);
-extern double asin(double);
-extern double acos(double);
-extern double sinh(double);
-extern double cosh(double);
-extern double tanh(double);
-extern double sqrt(double);
-extern double fmod(double, double);
+extern double jehanne_pow(double, double);
+extern double jehanne_atan2(double, double);
+extern double jehanne_fabs(double);
+extern double jehanne_atan(double);
+extern double jehanne_log(double);
+extern double jehanne_log10(double);
+extern double jehanne_exp(double);
+extern double jehanne_floor(double);
+extern double jehanne_ceil(double);
+extern double jehanne_hypot(double, double);
+extern double jehanne_sin(double);
+extern double jehanne_cos(double);
+extern double jehanne_tan(double);
+extern double jehanne_asin(double);
+extern double jehanne_acos(double);
+extern double jehanne_sinh(double);
+extern double jehanne_cosh(double);
+extern double jehanne_tanh(double);
+extern double jehanne_sqrt(double);
+extern double jehanne_fmod(double, double);
#define HUGE 3.4028234e38
#define PIO2 1.570796326794896619231e0
@@ -340,14 +281,14 @@ struct Tm
int tzoff;
} Tm;
-extern Tm* gmtime(int32_t);
-extern Tm* localtime(int32_t);
-extern char* asctime(Tm*);
-extern char* ctime(int32_t);
-extern double cputime(void);
-extern int32_t times(int32_t*);
-extern int32_t tm2sec(Tm*);
-//extern int64_t nsec(void);
+extern Tm* jehanne_gmtime(int32_t);
+extern Tm* jehanne_localtime(int32_t);
+extern char* jehanne_asctime(Tm*);
+extern char* jehanne_ctime(int32_t);
+extern double jehanne_cputime(void);
+extern int32_t jehanne_times(int32_t*);
+extern int32_t jehanne_tm2sec(Tm*);
+//extern int64_t jehanne_nsec(void);
extern void cycles(uint64_t*); /* 64-bit value of the cycle counter if there is one, 0 if there isn't */
@@ -360,73 +301,71 @@ enum
PNGROUP = 2,
};
-extern void _assert(const char*) __attribute__ ((noreturn));
-extern int abs(int);
-extern int atexit(void(*)(void));
-extern void atexitdont(void(*)(void));
-extern int atnotify(int(*)(void*, char*), int);
-extern double atof(const char*);
-extern int atoi(const char*);
-extern int32_t atol(const char*);
-extern int64_t atoll(const char*);
-extern double charstod(int(*)(void*), void*);
-extern int chdir(const char *dirname);
-extern char* cleanname(char*);
+extern void jehanne__assert(const char*) __attribute__ ((noreturn));
+extern int jehanne_abs(int);
+extern int jehanne_atexit(void(*)(void));
+extern void jehanne_atexitdont(void(*)(void));
+extern int jehanne_atnotify(int(*)(void*, char*), int);
+extern double jehanne_atof(const char*);
+extern int jehanne_atoi(const char*);
+extern int32_t jehanne_atol(const char*);
+extern int64_t jehanne_atoll(const char*);
+extern double jehanne_charstod(int(*)(void*), void*);
+extern int jehanne_chdir(const char *dirname);
+extern char* jehanne_cleanname(char*);
extern int decrypt(void*, void*, int);
extern int encrypt(void*, void*, int);
-extern int dec64(uint8_t*, int, const char*, int);
-extern int enc64(char*, int, const uint8_t*, int);
-extern int dec32(uint8_t*, int, const char*, int);
-extern int enc32(char*, int, const uint8_t*, int);
-extern int dec16(uint8_t*, int, const char*, int);
-extern int enc16(char*, int, const uint8_t*, int);
-extern int encodefmt(Fmt*);
-extern void exits(const char*) __attribute__ ((noreturn));
-extern double frexp(double, int*);
-extern uintptr_t getcallerpc(void);
-extern char* getenv(const char*);
-extern int getfields(char*, char**, int, int, const char*);
-extern int gettokens(char *, char **, int, const char *);
-extern char* getuser(void);
-extern long getwd(char*, int);
-extern int iounit(int);
-extern int32_t labs(int32_t);
-extern double ldexp(double, int);
-extern void longjmp(jmp_buf, int);
-extern char* mktemp(char*);
-extern double modf(double, double*);
-extern void notejmp(void*, jmp_buf, int);
-extern unsigned long nsec(void);
-extern int dup(int oldfd, int newfd);
-extern int ocreate(const char* path, unsigned int omode, unsigned int perm);
-extern void perror(const char*);
-extern int pipe(int pipes[2]);
-extern int postnote(int, int, const char *);
-extern double pow10(int);
-extern int putenv(const char*, const char*);
-extern void qsort(void*, long, int,
+extern int jehanne_dec64(uint8_t*, int, const char*, int);
+extern int jehanne_enc64(char*, int, const uint8_t*, int);
+extern int jehanne_dec32(uint8_t*, int, const char*, int);
+extern int jehanne_enc32(char*, int, const uint8_t*, int);
+extern int jehanne_dec16(uint8_t*, int, const char*, int);
+extern int jehanne_enc16(char*, int, const uint8_t*, int);
+extern int jehanne_encodefmt(Fmt*);
+extern void jehanne_exits(const char*) __attribute__ ((noreturn));
+extern double jehanne_frexp(double, int*);
+extern uintptr_t jehanne_getcallerpc(void);
+extern char* jehanne_getenv(const char*);
+extern int jehanne_getfields(char*, char**, int, int, const char*);
+extern int jehanne_gettokens(char *, char **, int, const char *);
+extern char* jehanne_getuser(void);
+extern long jehanne_getwd(char*, int);
+extern int jehanne_iounit(int);
+extern int32_t jehanne_labs(int32_t);
+extern double jehanne_ldexp(double, int);
+extern void jehanne_longjmp(jmp_buf, int);
+extern char* jehanne_mktemp(char*);
+extern double jehanne_modf(double, double*);
+extern void jehanne_notejmp(void*, jmp_buf, int);
+extern unsigned long jehanne_nsec(void);
+extern int jehanne_dup(int oldfd, int newfd);
+extern int jehanne_ocreate(const char* path, unsigned int omode, unsigned int perm);
+extern void jehanne_perror(const char*);
+extern int jehanne_pipe(int pipes[2]);
+extern int jehanne_postnote(int, int, const char *);
+extern double jehanne_pow10(int);
+extern int jehanne_putenv(const char*, const char*);
+extern void jehanne_qsort(void*, long, int,
int (*)(const void*, const void*));
-extern void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
+extern void* jehanne_bsearch(const void* key, const void* base, size_t nmemb, size_t size,
int (*compar)(const void*, const void*));
-extern int setjmp(jmp_buf);
-extern double strtod(const char*, const char**);
-extern int32_t strtol(const char*, char**, int);
-extern uint32_t strtoul(const char*, char**, int);
-extern int64_t strtoll(const char*, char**, int);
-extern uint64_t strtoull(const char*, char**, int);
-extern void sysfatal(const char*, ...);
-#pragma varargck argpos sysfatal 1
-extern void syslog(int, const char*, const char*, ...);
-#pragma varargck argpos syslog 3
-extern int32_t time(int32_t*);
-extern int tolower(int);
-extern int toupper(int);
+extern int jehanne_setjmp(jmp_buf);
+extern double jehanne_strtod(const char*, const char**);
+extern int32_t jehanne_strtol(const char*, char**, int);
+extern uint32_t jehanne_strtoul(const char*, char**, int);
+extern int64_t jehanne_strtoll(const char*, char**, int);
+extern uint64_t jehanne_strtoull(const char*, char**, int);
+extern void jehanne_sysfatal(const char*, ...);
+extern void jehanne_syslog(int, const char*, const char*, ...);
+extern int32_t jehanne_time(int32_t*);
+extern int jehanne_tolower(int);
+extern int jehanne_toupper(int);
/*
* atomic
*/
-int32_t ainc(int32_t*);
-int32_t adec(int32_t*);
+int32_t jehanne_ainc(int32_t*);
+int32_t jehanne_adec(int32_t*);
#define cas(ptr, oldval, newval) __sync_bool_compare_and_swap(ptr, oldval, newval)
#define casv(ptr, oldval, newval) __sync_val_compare_and_swap(ptr, oldval, newval)
@@ -439,12 +378,12 @@ struct Lock {
int32_t sem;
} Lock;
-extern int _tas(int*);
+extern int jehanne__tas(int*);
-extern void lock(Lock*);
-extern int lockt(Lock*, uint32_t);
-extern void unlock(Lock*);
-extern int canlock(Lock*);
+extern void jehanne_lock(Lock*);
+extern int jehanne_lockt(Lock*, uint32_t);
+extern void jehanne_unlock(Lock*);
+extern int jehanne_canlock(Lock*);
typedef struct QLp QLp;
struct QLp
@@ -462,11 +401,11 @@ struct QLock
QLp *tail;
} QLock;
-extern void qlock(QLock*);
-extern int qlockt(QLock*, uint32_t);
-extern void qunlock(QLock*);
-extern int canqlock(QLock*);
-extern void _qlockinit(void* (*)(void*, void*)); /* called only by the thread library */
+extern void jehanne_qlock(QLock*);
+extern int jehanne_qlockt(QLock*, uint32_t);
+extern void jehanne_qunlock(QLock*);
+extern int jehanne_canqlock(QLock*);
+extern void jehanne__qlockinit(void* (*)(void*, void*)); /* called only by the thread library */
typedef
struct RWLock
@@ -478,14 +417,14 @@ struct RWLock
QLp *tail;
} RWLock;
-extern void rlock(RWLock*);
-extern int rlockt(RWLock*, uint32_t);
-extern void runlock(RWLock*);
-extern int canrlock(RWLock*);
-extern void wlock(RWLock*);
-extern int wlockt(RWLock*, uint32_t);
-extern void wunlock(RWLock*);
-extern int canwlock(RWLock*);
+extern void jehanne_rlock(RWLock*);
+extern int jehanne_rlockt(RWLock*, uint32_t);
+extern void jehanne_runlock(RWLock*);
+extern int jehanne_canrlock(RWLock*);
+extern void jehanne_wlock(RWLock*);
+extern int jehanne_wlockt(RWLock*, uint32_t);
+extern void jehanne_wunlock(RWLock*);
+extern int jehanne_canwlock(RWLock*);
typedef
struct Rendez
@@ -495,31 +434,31 @@ struct Rendez
QLp *tail;
} Rendez;
-extern void rsleep(Rendez*); /* unlocks r->l, sleeps, locks r->l again */
-extern int rsleept(Rendez*, uint32_t); /* unlocks r->l, sleeps (up to ms), locks r->l again (if not timedout) */
-extern int rwakeup(Rendez*);
-extern int rwakeupall(Rendez*);
-extern void** privalloc(void);
+extern void jehanne_rsleep(Rendez*); /* unlocks r->l, sleeps, locks r->l again */
+extern int jehanne_rsleept(Rendez*, uint32_t); /* unlocks r->l, sleeps (up to ms), locks r->l again (if not timedout) */
+extern int jehanne_rwakeup(Rendez*);
+extern int jehanne_rwakeupall(Rendez*);
+extern void** jehanne_privalloc(void);
/*
* network dialing
*/
#define NETPATHLEN 40
-extern int accept(int, const char*);
-extern int announce(const char*, char*);
-extern int dial(const char*, const char*, char*, int*);
-extern void setnetmtpt(char*, int, const char*);
-extern int hangup(int);
-extern int listen(const char*, char*);
-extern char* netmkaddr(const char*, const char*, const char*);
-extern int reject(int, const char*, const char*);
+extern int jehanne_accept(int, const char*);
+extern int jehanne_announce(const char*, char*);
+extern int jehanne_dial(const char*, const char*, char*, int*);
+extern void jehanne_setnetmtpt(char*, int, const char*);
+extern int jehanne_hangup(int);
+extern int jehanne_listen(const char*, char*);
+extern char* jehanne_netmkaddr(const char*, const char*, const char*);
+extern int jehanne_reject(int, const char*, const char*);
/*
* encryption
*/
-extern int pushssl(int, const char*, const char*, const char*, int*);
-extern int pushtls(int, const char*, const char*, int, const char*,
- char*);
+extern int jehanne_pushssl(int, const char*, const char*, const char*, int*);
+//extern int jehanne_pushtls(int, const char*, const char*, int, const char*,
+// char*);
/*
* network services
@@ -537,8 +476,8 @@ struct NetConnInfo
char *laddr; /* local address */
char *raddr; /* remote address */
};
-extern NetConnInfo* getnetconninfo(const char*, int);
-extern void freenetconninfo(NetConnInfo*);
+extern NetConnInfo* jehanne_getnetconninfo(const char*, int);
+extern void jehanne_freenetconninfo(NetConnInfo*);
/*
* system calls
@@ -571,7 +510,7 @@ extern void freenetconninfo(NetConnInfo*);
/* Access modes */
#define AEXIST 0 /* accessible: exists */
-#define AREAD 4 /* read access */
+#define AREAD 4 /* read ccess */
#define AWRITE 2 /* write access */
#define AEXEC 1 /* execute access */
#define AMASK (AEXIST|AREAD|AWRITE|AEXEC)
@@ -656,47 +595,49 @@ struct Waitmsg
char *msg;
} Waitmsg;
-extern int access(const char*, int);
-extern int awakened(int64_t);
-extern int brk(void*);
-extern int execl(const char*, ...);
-extern int forgivewkp(int64_t);
-extern pid_t fork(void);
-extern int32_t readn(int, void*, int32_t);
-extern void* sbrk(uint32_t);
-extern int32_t oseek(int, int32_t, int);
-extern void* segattach(int, const char*, void*, unsigned long);
-extern int segdetach(void*);
-extern int segfree(void*, unsigned long);
-extern void sleep(int32_t);
-extern int stat(const char*, uint8_t*, int);
-extern Waitmsg* wait(void);
-extern int waitpid(void);
-extern int wstat(const char*, uint8_t*, int);
+extern int jehanne_access(const char*, int);
+extern int jehanne_awakened(int64_t);
+extern int jehanne_brk(void*);
+extern int jehanne_execl(const char*, ...);
+extern int jehanne_forgivewkp(int64_t);
+extern pid_t jehanne_fork(void);
+extern int32_t jehanne_readn(int, void*, int32_t);
+extern void* jehanne_segbrk(uint32_t);
+#define sbrk(incr) jehanne_segbrk(incr)
+extern void* jehanne_segattach(int, const char*, void*, unsigned long);
+extern int jehanne_segdetach(void*);
+extern int jehanne_segfree(void*, unsigned long);
+extern void jehanne_sleep(int32_t);
+extern int jehanne_stat(const char*, uint8_t*, int);
+extern Waitmsg* jehanne_wait(void);
+extern int jehanne_waitpid(void);
+extern int jehanne_wstat(const char*, uint8_t*, int);
-extern Dir* dirstat(const char*);
-extern Dir* dirfstat(int);
-extern int dirwstat(const char*, Dir*);
-extern int dirfwstat(int, Dir*);
-extern int32_t dirread(int, Dir**);
-extern void nulldir(Dir*);
-extern int32_t dirreadall(int, Dir**);
-extern int32_t getpid(void);
-extern int32_t getppid(void);
-extern int32_t getmainpid(void);
-extern void rerrstr(char*, uint32_t);
-extern char* sysname(void);
-extern void werrstr(const char*, ...);
-#pragma varargck argpos werrstr 1
+extern Dir* jehanne_dirstat(const char*);
+extern Dir* jehanne_dirfstat(int);
+extern int jehanne_dirwstat(const char*, Dir*);
+extern int jehanne_dirfwstat(int, Dir*);
+extern int32_t jehanne_dirread(int, Dir**);
+extern void jehanne_nulldir(Dir*);
+extern int32_t jehanne_dirreadall(int, Dir**);
+extern int32_t jehanne_getpid(void);
+extern int32_t jehanne_getppid(void);
+extern int32_t jehanne_getmainpid(void);
+extern void jehanne_rerrstr(char*, uint32_t);
+extern char* jehanne_sysname(void);
+extern void jehanne_werrstr(const char*, ...);
+extern unsigned int jehanne_convM2D(uint8_t*, uint, Dir*, char*);
+extern unsigned int jehanne_convD2M(Dir*, uint8_t*, uint);
+extern unsigned int jehanne_sizeD2M(Dir*);
+extern int jehanne_dirmodefmt(Fmt*);
-extern unsigned int convM2D(uint8_t*, uint, Dir*, char*);
-extern unsigned int convD2M(Dir*, uint8_t*, uint);
-extern unsigned int sizeD2M(Dir*);
-extern int dirfmt(Fmt*);
-extern int dirmodefmt(Fmt*);
-#pragma varargck type "D" Dir*
+#ifndef NPRIVATES
+# define NPRIVATES 16
+#endif
+/* can be overwritten to do anything before calling main */
+extern void __libc_init(int argc, char *argv[]) __attribute__((weak, noreturn));
/* compiler directives on plan 9 */
#define SET(x) ((x)=0)
@@ -723,7 +664,7 @@ extern char *argv0;
argc--; argv++; break;\
}\
_argc = 0;\
- while(*_args && (_args += chartorune(&_argc, _args)))\
+ while(*_args && (_args += jehanne_chartorune(&_argc, _args)))\
switch(_argc)
/* #define ARGEND SET(_argt);USED(_argt,_argc,_args);}USED(argv, argc); */
#define ARGEND SET(_argt);USED(_argt);USED(_argc);USED(_args);}USED(argv);USED(argc);
@@ -734,6 +675,6 @@ extern char *argv0;
#define ARGC() _argc
-/* this is used by sbrk and brk, it's a really bad idea to redefine it */
+/* this is used by segbrk and brk, it's a really bad idea to redefine it */
extern char end[];
diff --git a/sys/src/cmd/acme/acme.c b/sys/src/cmd/acme/acme.c
index ea54fe4..1373d9d 100644
--- a/sys/src/cmd/acme/acme.c
+++ b/sys/src/cmd/acme/acme.c
@@ -8,7 +8,7 @@
*/
#include
-#include
+#include
#include
#include
#include
diff --git a/sys/src/cmd/acme/addr.c b/sys/src/cmd/acme/addr.c
index b90a417..5e09745 100644
--- a/sys/src/cmd/acme/addr.c
+++ b/sys/src/cmd/acme/addr.c
@@ -8,7 +8,7 @@
*/
#include
-#include
+#include
#include
#include
#include
diff --git a/sys/src/cmd/acme/aux/awd.c b/sys/src/cmd/acme/aux/awd.c
index f710728..286c844 100644
--- a/sys/src/cmd/acme/aux/awd.c
+++ b/sys/src/cmd/acme/aux/awd.c
@@ -8,7 +8,7 @@
*/
#include
-#include
+#include
/*
* like fprint but be sure to deliver as a single write.
diff --git a/sys/src/cmd/acme/aux/mkwnew.c b/sys/src/cmd/acme/aux/mkwnew.c
index 99c084b..c3c66ee 100644
--- a/sys/src/cmd/acme/aux/mkwnew.c
+++ b/sys/src/cmd/acme/aux/mkwnew.c
@@ -8,7 +8,7 @@
*/
#include
-#include
+#include
void
main(int argc, char *argv[])
diff --git a/sys/src/cmd/acme/aux/win/fs.c b/sys/src/cmd/acme/aux/win/fs.c
index c35f9fa..69ca6fc 100644
--- a/sys/src/cmd/acme/aux/win/fs.c
+++ b/sys/src/cmd/acme/aux/win/fs.c
@@ -8,7 +8,7 @@
*/
#include
-#include
+#include
#include <9P2000.h>
#include
#include <9p.h>
diff --git a/sys/src/cmd/acme/aux/win/main.c b/sys/src/cmd/acme/aux/win/main.c
index 7530034..c68b3a9 100644
--- a/sys/src/cmd/acme/aux/win/main.c
+++ b/sys/src/cmd/acme/aux/win/main.c
@@ -8,7 +8,7 @@
*/
#include
-#include
+#include
#include
#include
#include <9P2000.h>
diff --git a/sys/src/cmd/acme/aux/win/pipe.c b/sys/src/cmd/acme/aux/win/pipe.c
index a065769..bcaaf3b 100644
--- a/sys/src/cmd/acme/aux/win/pipe.c
+++ b/sys/src/cmd/acme/aux/win/pipe.c
@@ -8,7 +8,7 @@
*/
#include
-#include
+#include
#include <9P2000.h>
#include
#include <9p.h>
diff --git a/sys/src/cmd/acme/aux/win/util.c b/sys/src/cmd/acme/aux/win/util.c
index 2fb39c3..c541b8b 100644
--- a/sys/src/cmd/acme/aux/win/util.c
+++ b/sys/src/cmd/acme/aux/win/util.c
@@ -8,7 +8,7 @@
*/
#include
-#include
+#include
#include
#include
#include "dat.h"
diff --git a/sys/src/cmd/acme/aux/win/win.c b/sys/src/cmd/acme/aux/win/win.c
index 0655eec..c9909b9 100644
--- a/sys/src/cmd/acme/aux/win/win.c
+++ b/sys/src/cmd/acme/aux/win/win.c
@@ -8,7 +8,7 @@
*/
#include
-#include
+#include
#include
#include
#include "dat.h"
diff --git a/sys/src/cmd/acme/buff.c b/sys/src/cmd/acme/buff.c
index 2983142..c51ffbe 100644
--- a/sys/src/cmd/acme/buff.c
+++ b/sys/src/cmd/acme/buff.c
@@ -8,7 +8,7 @@
*/
#include
-#include
+#include
#include
#include
#include
diff --git a/sys/src/cmd/acme/cols.c b/sys/src/cmd/acme/cols.c
index d3f649f..735cbb4 100644
--- a/sys/src/cmd/acme/cols.c
+++ b/sys/src/cmd/acme/cols.c
@@ -8,7 +8,7 @@
*/
#include
-#include
+#include
#include
#include
#include
diff --git a/sys/src/cmd/acme/disk.c b/sys/src/cmd/acme/disk.c
index 369f2c0..a4498d8 100644
--- a/sys/src/cmd/acme/disk.c
+++ b/sys/src/cmd/acme/disk.c
@@ -8,7 +8,7 @@
*/
#include
-#include
+#include
#include
#include
#include
diff --git a/sys/src/cmd/acme/ecmd.c b/sys/src/cmd/acme/ecmd.c
index a6dbfcc..2e99cc5 100644
--- a/sys/src/cmd/acme/ecmd.c
+++ b/sys/src/cmd/acme/ecmd.c
@@ -8,7 +8,7 @@
*/
#include
-#include
+#include
#include
#include
#include
diff --git a/sys/src/cmd/acme/edit.c b/sys/src/cmd/acme/edit.c
index c54f464..9ccbee4 100644
--- a/sys/src/cmd/acme/edit.c
+++ b/sys/src/cmd/acme/edit.c
@@ -8,7 +8,7 @@
*/
#include
-#include
+#include
#include
#include
#include
diff --git a/sys/src/cmd/acme/elog.c b/sys/src/cmd/acme/elog.c
index 31012cc..465bc77 100644
--- a/sys/src/cmd/acme/elog.c
+++ b/sys/src/cmd/acme/elog.c
@@ -8,7 +8,7 @@
*/
#include
-#include
+#include
#include
#include
#include
diff --git a/sys/src/cmd/acme/exec.c b/sys/src/cmd/acme/exec.c
index 3c7ac8b..f6ff946 100644
--- a/sys/src/cmd/acme/exec.c
+++ b/sys/src/cmd/acme/exec.c
@@ -8,7 +8,7 @@
*/
#include
-#include
+#include