diff --git a/libc/isystem/unistd.h b/libc/isystem/unistd.h index 942c30e74..78b62edb9 100644 --- a/libc/isystem/unistd.h +++ b/libc/isystem/unistd.h @@ -10,12 +10,8 @@ #include "libc/sysv/consts/o.h" #include "libc/sysv/consts/ok.h" #include "libc/time/time.h" +#include "libc/unistd.h" #include "third_party/getopt/long1.h" #include "third_party/musl/crypt.h" #include "third_party/musl/lockf.h" - -#ifndef _CS_PATH -#define _CS_PATH 0 -#endif - #endif /* _UNISTD_H */ diff --git a/libc/stdio/confstr.c b/libc/stdio/confstr.c index 16b88dcfd..735b9589d 100644 --- a/libc/stdio/confstr.c +++ b/libc/stdio/confstr.c @@ -20,6 +20,7 @@ #include "libc/stdio/stdio.h" #include "libc/str/str.h" #include "libc/sysv/errfuns.h" +#include "libc/unistd.h" size_t confstr(int name, char *buf, size_t len) { if (name == _CS_PATH) { diff --git a/libc/stdio/stdio.h b/libc/stdio/stdio.h index 021aa7c3a..4d385e0ba 100644 --- a/libc/stdio/stdio.h +++ b/libc/stdio/stdio.h @@ -1,12 +1,11 @@ #ifndef COSMOPOLITAN_LIBC_STDIO_H_ #define COSMOPOLITAN_LIBC_STDIO_H_ -#define EOF -1 /* end of file */ -#define WEOF -1u /* end of file (multibyte) */ -#define _IOFBF 0 /* fully buffered */ -#define _IOLBF 1 /* line buffered */ -#define _IONBF 2 /* no buffering */ -#define _CS_PATH 0 +#define EOF -1 /* end of file */ +#define WEOF -1u /* end of file (multibyte) */ +#define _IOFBF 0 /* fully buffered */ +#define _IOLBF 1 /* line buffered */ +#define _IONBF 2 /* no buffering */ #define L_tmpnam 20 #define L_ctermid 20 diff --git a/libc/stdlib.h b/libc/stdlib.h index 9c5bc3b1e..e7ef213f0 100644 --- a/libc/stdlib.h +++ b/libc/stdlib.h @@ -6,5 +6,10 @@ char *fcvt(double, int, int *, int *) libcesque; char *ecvt(double, int, int *, int *) libcesque; char *gcvt(double, int, char *) libcesque; +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || \ + defined(_COSMO_SOURCE) +void setkey(const char *) libcesque; +#endif + COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_STDLIB_H_ */ diff --git a/libc/unistd.h b/libc/unistd.h new file mode 100644 index 000000000..04bf9c95a --- /dev/null +++ b/libc/unistd.h @@ -0,0 +1,14 @@ +#ifndef COSMOPOLITAN_LIBC_UNISTD_H_ +#define COSMOPOLITAN_LIBC_UNISTD_H_ +COSMOPOLITAN_C_START_ + +#define _CS_PATH 0 + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || \ + defined(_COSMO_SOURCE) +void encrypt(char *, int) libcesque; +char *crypt(const char *, const char *) libcesque; +#endif + +COSMOPOLITAN_C_END_ +#endif /* COSMOPOLITAN_LIBC_UNISTD_H_ */ diff --git a/third_party/musl/crypt.h b/third_party/musl/crypt.h index 111c445e8..5fc464f9d 100644 --- a/third_party/musl/crypt.h +++ b/third_party/musl/crypt.h @@ -7,10 +7,8 @@ struct crypt_data { char __buf[256]; }; -void encrypt(char *, int); -void setkey(const char *); -char *crypt(const char *, const char *); -char *crypt_r(const char *, const char *, struct crypt_data *); +char *crypt(const char *, const char *) libcesque; +char *crypt_r(const char *, const char *, struct crypt_data *) libcesque; COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_THIRD_PARTY_MUSL_CRYPT_H_ */ diff --git a/third_party/python/Modules/posixmodule.c b/third_party/python/Modules/posixmodule.c index 98d55bd8f..fee776524 100644 --- a/third_party/python/Modules/posixmodule.c +++ b/third_party/python/Modules/posixmodule.c @@ -89,6 +89,7 @@ #include "third_party/python/Include/warnings.h" #include "third_party/python/Include/yoink.h" #include "third_party/python/Modules/_multiprocessing/multiprocessing.h" +#include "libc/unistd.h" #include "third_party/python/pyconfig.h" PYTHON_PROVIDE("posix"); diff --git a/tool/cosmocc/package.sh b/tool/cosmocc/package.sh index 8f43c94fb..180ea8f9c 100755 --- a/tool/cosmocc/package.sh +++ b/tool/cosmocc/package.sh @@ -130,7 +130,7 @@ for arch in $AMD64 $ARM64; do cp -f o/$arch/libc/crt/crt.o "$OUTDIR/$arch-linux-cosmo/lib/" cp -f o/$arch/cosmopolitan.a "$OUTDIR/$arch-linux-cosmo/lib/libcosmo.a" cp -f o/$arch/third_party/libcxx/libcxx.a "$OUTDIR/$arch-linux-cosmo/lib/" - for lib in c dl gcc_s m pthread resolv rt dl unwind gomp stdc++; do + for lib in c dl gcc_s m crypt pthread resolv rt dl unwind gomp stdc++; do printf '\041\074\141\162\143\150\076\012' >"$OUTDIR/$arch-linux-cosmo/lib/lib$lib.a" done mkdir -p "$OUTDIR/lib/gcc/"