Unbloat build config

- 10.5% reduction of o//depend dependency graph
- 8.8% reduction in latency of make command
- Fix issue with temporary file cleanup

There's a new -w option in compile.com that turns off the recent
Landlock output path workaround for "good commands" which do not
unlink() the output file like GNU tooling does.

Our new GNU Make unveil sandboxing appears to have zero overhead
in the grand scheme of things. Full builds are pretty fast since
the only thing that's actually slowed us down is probably libcxx

    make -j16 MODE=rel
    RL: took 85,732,063µs wall time
    RL: ballooned to 323,612kb in size
    RL: needed 828,560,521µs cpu (11% kernel)
    RL: caused 39,080,670 page faults (99% memcpy)
    RL: 350,073 context switches (72% consensual)
    RL: performed 0 reads and 11,494,960 write i/o operations

pledge() and unveil() no longer consider ENOSYS to be an error.
These functions have also been added to Python's cosmo module.

This change also removes some WIN32 APIs and System Five magnums
which we're not using and it's doubtful anyone else would be too
This commit is contained in:
Justine Tunney 2022-08-10 01:32:17 -07:00
parent 133c693650
commit ae5d06dc53
1423 changed files with 2213 additions and 5560 deletions

View file

@ -2,8 +2,10 @@
#include "libc/errno.h"
#include "libc/fmt/fmt.h"
#include "libc/log/log.h"
#include "libc/mem/mem.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
/* clang-format off */
/*-----------------------------------------------------------*/

View file

@ -30,6 +30,7 @@
*/
#include "libc/calls/calls.h"
#include "libc/mem/mem.h"
#include "third_party/bzip2/bzlib_private.inc"

View file

@ -72,7 +72,7 @@ o/$(MODE)/third_party/chibicc/test/%.com.dbg: \
o/$(MODE)/third_party/chibicc/test/%.o: \
third_party/chibicc/test/%.c \
$(CHIBICC)
@$(COMPILE) -AOBJECTIFY.c $(CHIBICC) $(CHIBICC_FLAGS) $(OUTPUT_OPTION) -c $<
@$(COMPILE) -wAOBJECTIFY.c $(CHIBICC) $(CHIBICC_FLAGS) $(OUTPUT_OPTION) -c $<
o/$(MODE)/third_party/chibicc/test/int128_test.o: QUOTA = -M1024m

View file

@ -13,6 +13,7 @@
#include "libc/runtime/runtime.h"
#include "libc/runtime/sysconf.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/map.h"
#include "libc/sysv/consts/prot.h"
#include "third_party/dlmalloc/dlmalloc.h"

View file

@ -122,39 +122,39 @@ THIRD_PARTY_DOUBLECONVERSION_TEST_RUNS = \
o/$(MODE)/third_party/double-conversion/test-strtod.runs: \
o/$(MODE)/third_party/double-conversion/double-conversion-tester.com
@$(COMPILE) -ACHECK -tT$@ $< test-strtod
@$(COMPILE) -wACHECK -tT$@ $< test-strtod
o/$(MODE)/third_party/double-conversion/test-ieee.runs: \
o/$(MODE)/third_party/double-conversion/double-conversion-tester.com
@$(COMPILE) -ACHECK -tT$@ $< test-ieee
@$(COMPILE) -wACHECK -tT$@ $< test-ieee
o/$(MODE)/third_party/double-conversion/test-fixed-dtoa.runs: \
o/$(MODE)/third_party/double-conversion/double-conversion-tester.com
@$(COMPILE) -ACHECK -tT$@ $< test-fixed-dtoa
@$(COMPILE) -wACHECK -tT$@ $< test-fixed-dtoa
o/$(MODE)/third_party/double-conversion/test-fast-dtoa.runs: \
o/$(MODE)/third_party/double-conversion/double-conversion-tester.com
@$(COMPILE) -ACHECK -tT$@ $< test-fast-dtoa
@$(COMPILE) -wACHECK -tT$@ $< test-fast-dtoa
o/$(MODE)/third_party/double-conversion/test-dtoa.runs: \
o/$(MODE)/third_party/double-conversion/double-conversion-tester.com
@$(COMPILE) -ACHECK -tT$@ $< test-dtoa
@$(COMPILE) -wACHECK -tT$@ $< test-dtoa
o/$(MODE)/third_party/double-conversion/test-diy-fp.runs: \
o/$(MODE)/third_party/double-conversion/double-conversion-tester.com
@$(COMPILE) -ACHECK -tT$@ $< test-diy-fp
@$(COMPILE) -wACHECK -tT$@ $< test-diy-fp
o/$(MODE)/third_party/double-conversion/test-conversions.runs: \
o/$(MODE)/third_party/double-conversion/double-conversion-tester.com
@$(COMPILE) -ACHECK -tT$@ $< test-conversions
@$(COMPILE) -wACHECK -tT$@ $< test-conversions
o/$(MODE)/third_party/double-conversion/test-bignum-dtoa.runs: \
o/$(MODE)/third_party/double-conversion/double-conversion-tester.com
@$(COMPILE) -ACHECK -tT$@ $< test-bignum-dtoa
@$(COMPILE) -wACHECK -tT$@ $< test-bignum-dtoa
o/$(MODE)/third_party/double-conversion/test-bignum.runs: \
o/$(MODE)/third_party/double-conversion/double-conversion-tester.com
@$(COMPILE) -ACHECK -tT$@ $< test-bignum
@$(COMPILE) -wACHECK -tT$@ $< test-bignum
THIRD_PARTY_DOUBLECONVERSION_LIBS = $(foreach x,$(THIRD_PARTY_DOUBLECONVERSION_ARTIFACTS),$($(x)))
THIRD_PARTY_DOUBLECONVERSION_SRCS = $(foreach x,$(THIRD_PARTY_DOUBLECONVERSION_ARTIFACTS),$($(x)_SRCS))

View file

@ -39,6 +39,7 @@
#include "libc/calls/termios.h"
#include "libc/fmt/fmt.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/fileno.h"
#include "libc/sysv/consts/termios.h"
#include "third_party/finger/finger.h"

View file

@ -37,10 +37,13 @@
#include "libc/calls/struct/stat.h"
#include "libc/calls/weirdtypes.h"
#include "libc/fmt/fmt.h"
#include "libc/mem/mem.h"
#include "libc/nt/struct/msg.h"
#include "libc/runtime/runtime.h"
#include "libc/runtime/utmp.h"
#include "libc/sock/sock.h"
#include "libc/sock/struct/sockaddr.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/fileno.h"
#include "libc/time/time.h"
#include "third_party/finger/finger.h"

View file

@ -38,7 +38,9 @@
#include "libc/calls/struct/stat.macros.h"
#include "libc/errno.h"
#include "libc/fmt/fmt.h"
#include "libc/mem/mem.h"
#include "libc/paths.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/o.h"
#include "third_party/finger/finger.h"

View file

@ -15,6 +15,7 @@
#include "third_party/libcxx/stdlib.h"
#include "libc/mem/fmt.h"
#include "libc/unicode/unicode.h"
#include "third_party/libcxx/memory"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)

View file

@ -11,6 +11,7 @@
#define _LIBCPP_CSTDLIB
#include "third_party/libcxx/__config"
#include "libc/str/str.h"
#include "third_party/libcxx/stdlib.h"
/*

View file

@ -29,6 +29,8 @@
#define LUA_LIB
#include "libc/calls/calls.h"
#include "libc/errno.h"
#include "libc/mem/mem.h"
#include "libc/str/str.h"
#include "third_party/lua/lauxlib.h"
#include "third_party/lua/lprefix.h"
#include "third_party/lua/lua.h"

View file

@ -27,6 +27,7 @@
*/
#define lbaselib_c
#define LUA_LIB
#include "libc/str/str.h"
#include "third_party/lua/lauxlib.h"
#include "third_party/lua/lprefix.h"
#include "third_party/lua/lua.h"

View file

@ -27,6 +27,7 @@
*/
#define ldblib_c
#define LUA_LIB
#include "libc/str/str.h"
#include "third_party/lua/lauxlib.h"
#include "third_party/lua/lprefix.h"
#include "third_party/lua/lua.h"

View file

@ -27,6 +27,7 @@
*/
#define ldebug_c
#define LUA_CORE
#include "libc/str/str.h"
#include "third_party/lua/lapi.h"
#include "third_party/lua/lcode.h"
#include "third_party/lua/ldebug.h"

View file

@ -32,6 +32,7 @@
#include "libc/runtime/gc.h"
#include "libc/runtime/internal.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "third_party/lua/lapi.h"
#include "third_party/lua/ldebug.h"
#include "third_party/lua/ldo.h"

View file

@ -27,6 +27,7 @@
*/
#define lgc_c
#define LUA_CORE
#include "libc/str/str.h"
#include "third_party/lua/ldebug.h"
#include "third_party/lua/ldo.h"
#include "third_party/lua/lfunc.h"

View file

@ -30,8 +30,10 @@
#include "libc/calls/calls.h"
#include "libc/calls/weirdtypes.h"
#include "libc/errno.h"
#include "libc/stdio/lock.h"
#include "libc/stdio/stdio.h"
#include "libc/stdio/temp.h"
#include "libc/str/str.h"
#include "third_party/lua/lauxlib.h"
#include "third_party/lua/lprefix.h"
#include "third_party/lua/lua.h"

View file

@ -27,6 +27,8 @@
*/
#define loadlib_c
#define LUA_LIB
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "third_party/lua/lauxlib.h"
#include "third_party/lua/lprefix.h"
#include "third_party/lua/lua.h"

View file

@ -27,6 +27,7 @@
*/
#define lobject_c
#define LUA_CORE
#include "libc/str/str.h"
#include "third_party/lua/lctype.h"
#include "third_party/lua/ldebug.h"
#include "third_party/lua/ldo.h"

View file

@ -32,6 +32,7 @@
#include "libc/errno.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/temp.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/exit.h"
#include "libc/time/struct/tm.h"
#include "libc/time/time.h"

View file

@ -27,6 +27,7 @@
*/
#define lparser_c
#define LUA_CORE
#include "libc/str/str.h"
#include "third_party/lua/lcode.h"
#include "third_party/lua/ldebug.h"
#include "third_party/lua/ldo.h"

View file

@ -27,6 +27,7 @@
*/
#define lstate_c
#define LUA_CORE
#include "libc/str/str.h"
#include "libc/time/time.h"
#include "third_party/lua/lapi.h"
#include "third_party/lua/ldebug.h"

View file

@ -27,6 +27,7 @@
*/
#define lstring_c
#define LUA_CORE
#include "libc/str/str.h"
#include "third_party/lua/ldebug.h"
#include "third_party/lua/ldo.h"
#include "third_party/lua/lmem.h"

View file

@ -28,6 +28,7 @@
#define lstrlib_c
#define LUA_LIB
#include "libc/math.h"
#include "libc/str/str.h"
#include "third_party/lua/cosmo.h"
#include "third_party/lua/lauxlib.h"
#include "third_party/lua/lprefix.h"

View file

@ -28,6 +28,7 @@
#define ltablib_c
#define LUA_LIB
#include "libc/calls/weirdtypes.h"
#include "libc/str/str.h"
#include "libc/time/time.h"
#include "third_party/lua/lauxlib.h"
#include "third_party/lua/lprefix.h"

View file

@ -30,6 +30,8 @@
#include "libc/calls/calls.h"
#include "libc/calls/struct/sigaction.h"
#include "libc/errno.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/exit.h"
#include "third_party/lua/lauxlib.h"
#include "third_party/lua/ldebug.h"

View file

@ -4,6 +4,7 @@
#include "libc/dce.h"
#include "libc/fmt/fmt.h"
#include "libc/limits.h"
#include "libc/unicode/unicode.h"
#include "third_party/gdtoa/gdtoa.h"
#define LUA_USE_POSIX

View file

@ -16,6 +16,8 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/mem/mem.h"
#include "libc/str/str.h"
#include "libc/x/x.h"
#include "net/http/url.h"
#include "third_party/lua/cosmo.h"

View file

@ -16,6 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/mem/mem.h"
#include "libc/stdio/stdio.h"
#include "third_party/lua/cosmo.h"
#include "third_party/lua/lua.h"

View file

@ -16,6 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/mem/mem.h"
#include "net/http/http.h"
#include "third_party/lua/cosmo.h"
#include "third_party/lua/lauxlib.h"

View file

@ -16,6 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/mem/mem.h"
#include "net/http/escape.h"
#include "net/http/http.h"
#include "third_party/lua/cosmo.h"

View file

@ -7,6 +7,7 @@
#define lundump_c
#define LUA_CORE
#include "libc/str/str.h"
#include "third_party/lua/ldebug.h"
#include "third_party/lua/ldo.h"
#include "third_party/lua/lfunc.h"

View file

@ -27,6 +27,7 @@
*/
#define lvm_c
#define LUA_CORE
#include "libc/str/str.h"
#include "third_party/lua/ldebug.h"
#include "third_party/lua/ldo.h"
#include "third_party/lua/lfunc.h"

View file

@ -27,6 +27,7 @@
*/
#define lzio_c
#define LUA_CORE
#include "libc/str/str.h"
#include "third_party/lua/llimits.h"
#include "third_party/lua/lmem.h"
#include "third_party/lua/lprefix.h"

View file

@ -25,6 +25,8 @@
#include "libc/stdio/stdio.h"
#include "libc/fmt/fmt.h"
#include "libc/fmt/fmt.h"
#include "libc/str/str.h"
#include "libc/runtime/runtime.h"
#include "third_party/make/stdio.h"
#if !_LIBC && ENABLE_NLS

View file

@ -414,24 +414,6 @@ jhash(unsigned const char *k, int length)
#define UINTSZ sizeof (unsigned int)
#ifdef WORDS_BIGENDIAN
/* The ifs are ordered from the first byte in memory to the last. */
#define sum_up_to_nul(r, p, plen, flag) \
do { \
unsigned int val = 0; \
size_t pn = (plen); \
size_t n = pn < UINTSZ ? pn : UINTSZ; \
memcpy (&val, (p), n); \
if ((val & 0xFF000000) == 0) \
flag = 1; \
else if ((val & 0xFF0000) == 0) \
r += val & ~0xFFFF, flag = 1; \
else if ((val & 0xFF00) == 0) \
r += val & ~0xFF, flag = 1; \
else \
r += val, flag = (val & 0xFF) == 0; \
} while (0)
#else
/* First detect the presence of zeroes. If there is none, we can
sum the 4 bytes directly. Otherwise, the ifs are ordered as in the
big endian case, from the first byte in memory to the last. */
@ -454,7 +436,6 @@ jhash(unsigned const char *k, int length)
r += val; \
} \
} while (0)
#endif
unsigned int
jhash_string(unsigned const char *k)

View file

@ -74,8 +74,6 @@ THIRD_PARTY_MAKE_SRCS_LIB = \
third_party/make/xmalloc.c
THIRD_PARTY_MAKE_SRCS_BASE = \
third_party/make/ar.c \
third_party/make/arscan.c \
third_party/make/commands.c \
third_party/make/default.c \
third_party/make/dir.c \
@ -164,6 +162,7 @@ o/$(MODE)/third_party/make/hash.o: \
$(THIRD_PARTY_MAKE_OBJS): \
OVERRIDE_CFLAGS += \
-DNO_ARCHIVES \
-DSTACK_FRAME_UNLIMITED \
-DHAVE_CONFIG_H \
-DINCLUDEDIR=\".\" \

View file

@ -26,8 +26,10 @@
#include "libc/inttypes.h"
#include "libc/limits.h"
#include "libc/mem/mem.h"
#include "libc/runtime/runtime.h"
#include "libc/sock/struct/sockaddr6.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/af.h"
#include "libc/sysv/consts/map.h"
#include "libc/sysv/consts/o.h"

View file

@ -17,6 +17,7 @@
*/
#include "libc/bits/bits.h"
#include "libc/nexgen32e/x86feature.h"
#include "libc/str/str.h"
#include "third_party/mbedtls/aes.h"
#include "third_party/mbedtls/aesni.h"
#include "third_party/mbedtls/common.h"

View file

@ -1,5 +1,6 @@
#ifndef MBEDTLS_ASN1_H
#define MBEDTLS_ASN1_H
#include "libc/str/str.h"
#include "third_party/mbedtls/bignum.h"
#include "third_party/mbedtls/config.h"
/* clang-format off */

View file

@ -15,6 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "libc/str/str.h"
#include "third_party/mbedtls/asn1.h"
#include "third_party/mbedtls/bignum.h"
#include "third_party/mbedtls/common.h"

View file

@ -15,6 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "libc/str/str.h"
#include "third_party/mbedtls/asn1write.h"
#include "third_party/mbedtls/common.h"
#include "third_party/mbedtls/error.h"

View file

@ -15,6 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "libc/str/str.h"
#include "third_party/mbedtls/base64.h"
#include "third_party/mbedtls/common.h"
#include "third_party/mbedtls/platform.h"

View file

@ -26,6 +26,7 @@
#include "libc/nexgen32e/nexgen32e.h"
#include "libc/nexgen32e/x86feature.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "third_party/mbedtls/bignum.h"
#include "third_party/mbedtls/bignum_internal.h"
#include "third_party/mbedtls/chk.h"

View file

@ -15,6 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "libc/str/str.h"
#include "third_party/mbedtls/ccm.h"
#include "third_party/mbedtls/common.h"
#include "third_party/mbedtls/error.h"

View file

@ -17,6 +17,7 @@
*/
#include "libc/bits/bits.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "third_party/mbedtls/chacha20.h"
#include "third_party/mbedtls/common.h"
#include "third_party/mbedtls/error.h"

View file

@ -15,6 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "libc/str/str.h"
#include "third_party/mbedtls/chachapoly.h"
#include "third_party/mbedtls/chk.h"
#include "third_party/mbedtls/common.h"

View file

@ -15,6 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "libc/str/str.h"
#include "third_party/mbedtls/ccm.h"
#include "third_party/mbedtls/chacha20.h"
#include "third_party/mbedtls/chachapoly.h"

View file

@ -15,6 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "libc/str/str.h"
#include "third_party/mbedtls/common.h"
#include "third_party/mbedtls/debug.h"
#include "third_party/mbedtls/error.h"

View file

@ -16,6 +16,7 @@
limitations under the License.
*/
#include "libc/calls/calls.h"
#include "libc/str/str.h"
#include "third_party/mbedtls/asn1.h"
#include "third_party/mbedtls/bignum.h"
#include "third_party/mbedtls/common.h"

View file

@ -15,6 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "libc/str/str.h"
#include "third_party/mbedtls/ecdh_everest.h"
#include "third_party/mbedtls/everest.h"
#if defined(MBEDTLS_ECDH_C) && defined(MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED)

View file

@ -15,6 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "libc/str/str.h"
#include "third_party/mbedtls/asn1write.h"
#include "third_party/mbedtls/common.h"
#include "third_party/mbedtls/ecdsa.h"

View file

@ -20,6 +20,7 @@
#include "libc/log/log.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "third_party/mbedtls/bignum.h"
#include "third_party/mbedtls/bignum_internal.h"
#include "third_party/mbedtls/common.h"

View file

@ -21,6 +21,7 @@
#include "libc/nexgen32e/x86feature.h"
#include "libc/runtime/gc.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "third_party/mbedtls/bignum_internal.h"
#include "third_party/mbedtls/ecp.h"
#include "third_party/mbedtls/ecp_internal.h"

View file

@ -22,6 +22,7 @@
#include "libc/nexgen32e/x86feature.h"
#include "libc/runtime/gc.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "third_party/mbedtls/bignum_internal.h"
#include "third_party/mbedtls/ecp.h"
#include "third_party/mbedtls/ecp_internal.h"

View file

@ -15,6 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "libc/str/str.h"
#include "third_party/mbedtls/common.h"
#include "third_party/mbedtls/ecp.h"
#include "third_party/mbedtls/error.h"

View file

@ -17,6 +17,7 @@
*/
#include "libc/calls/calls.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "third_party/mbedtls/common.h"
#include "third_party/mbedtls/entropy.h"
#include "third_party/mbedtls/entropy_poll.h"

View file

@ -16,6 +16,7 @@
limitations under the License.
*/
#include "libc/fmt/fmt.h"
#include "libc/str/str.h"
#include "third_party/mbedtls/aes.h"
#include "third_party/mbedtls/asn1.h"
#include "third_party/mbedtls/base64.h"

View file

@ -18,6 +18,7 @@
#include "libc/mem/mem.h"
#include "libc/stdio/stdio.h"
#include "libc/str/blake2.h"
#include "libc/str/str.h"
#include "third_party/mbedtls/common.h"
#include "third_party/mbedtls/error.h"
#include "third_party/mbedtls/md.h"

View file

@ -16,6 +16,7 @@
limitations under the License.
*/
#include "libc/bits/bits.h"
#include "libc/str/str.h"
#include "third_party/mbedtls/common.h"
#include "third_party/mbedtls/error.h"
#include "third_party/mbedtls/md.h"

View file

@ -15,6 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "libc/str/str.h"
#include "third_party/mbedtls/common.h"
#include "third_party/mbedtls/endian.h"
#include "third_party/mbedtls/error.h"

View file

@ -16,6 +16,7 @@
limitations under the License.
*/
#include "libc/fmt/fmt.h"
#include "libc/str/str.h"
#include "third_party/mbedtls/common.h"
#include "third_party/mbedtls/error.h"
#include "third_party/mbedtls/oid.h"

View file

@ -20,6 +20,7 @@
#include "libc/fmt/itoa.h"
#include "libc/mem/mem.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "third_party/mbedtls/platform.h"
void mbedtls_param_failed(const char *msg, const char *file, int line) {

View file

@ -16,6 +16,7 @@
limitations under the License.
*/
#include "libc/mem/mem.h"
#include "libc/str/str.h"
#include "third_party/mbedtls/aes.h"
#include "third_party/mbedtls/base64.h"
#include "third_party/mbedtls/chk.h"

View file

@ -15,6 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "libc/str/str.h"
#include "third_party/mbedtls/asn1.h"
#include "third_party/mbedtls/asn1write.h"
#include "third_party/mbedtls/common.h"

View file

@ -18,6 +18,7 @@
*/
#include "libc/rand/rand.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"
#include "third_party/mbedtls/config.h"

View file

@ -137,7 +137,7 @@ o/$(MODE)/third_party/mbedtls/test/%.com: o/$(MODE)/third_party/mbedtls/test/%.c
@$(COMPILE) -AOBJCOPY -T$@ $(OBJCOPY) -S -O binary $< $@
o/$(MODE)/third_party/mbedtls/test/%.com.runs: o/$(MODE)/third_party/mbedtls/test/%.com
@$(COMPILE) -ACHECK -tT$@ $< $(TESTARGS)
@$(COMPILE) -wACHECK -tT$@ $< $(TESTARGS)
$(THIRD_PARTY_MBEDTLS_TEST_OBJS): \
OVERRIDE_CFLAGS += \

View file

@ -3,6 +3,7 @@
#define Py_PYDEBUG_H
COSMOPOLITAN_C_START_
/* clang-format off */
#include "libc/runtime/runtime.h"
/* These global variable are defined in pylifecycle.c */
/* XXX (ncoghlan): move these declarations to pylifecycle.h? */

View file

@ -30,6 +30,7 @@
#include "libc/errno.h"
#include "libc/fmt/fmt.h"
#include "libc/unicode/locale.h"
#include "libc/unicode/unicode.h"
#include "third_party/python/Modules/_decimal/libmpdec/bits.h"
#include "third_party/python/Modules/_decimal/libmpdec/constants.h"
#include "third_party/python/Modules/_decimal/libmpdec/io.h"

View file

@ -27,6 +27,7 @@
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libc/mem/mem.h"
#include "third_party/python/Modules/_decimal/libmpdec/mpalloc.h"
#include "third_party/python/Modules/_decimal/libmpdec/mpdecimal.h"
#include "third_party/python/Modules/_decimal/libmpdec/typearith.h"

View file

@ -3,6 +3,7 @@
#include "libc/fmt/conv.h"
#include "libc/inttypes.h"
#include "libc/limits.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h"
#include "third_party/python/pyconfig.h"
COSMOPOLITAN_C_START_

View file

@ -7,6 +7,7 @@
#define PY_SSIZE_T_CLEAN
#include "libc/unicode/langinfo.h"
#include "libc/unicode/locale.h"
#include "libc/unicode/unicode.h"
#include "third_party/python/Include/dictobject.h"
#include "third_party/python/Include/fileutils.h"
#include "third_party/python/Include/import.h"

View file

@ -12,6 +12,7 @@
#include "libc/fmt/fmt.h"
#include "libc/limits.h"
#include "libc/math.h"
#include "libc/mem/mem.h"
#include "libc/sysv/consts/sig.h"
#include "libc/time/time.h"
#include "third_party/python/Include/abstract.h"

View file

@ -6,6 +6,7 @@
*/
#include "libc/errno.h"
#include "libc/fmt/conv.h"
#include "libc/mem/mem.h"
#include "third_party/python/Include/boolobject.h"
#include "third_party/python/Include/dictobject.h"
#include "third_party/python/Include/fileutils.h"

View file

@ -3,6 +3,7 @@
#include "libc/calls/struct/timeval.h"
#include "libc/errno.h"
#include "libc/limits.h"
#include "libc/mem/mem.h"
#include "libc/nexgen32e/rdtsc.h"
#include "libc/nexgen32e/x86feature.h"
#include "libc/rand/rand.h"

View file

@ -9,6 +9,7 @@
#include "libc/calls/struct/rusage.h"
#include "libc/calls/weirdtypes.h"
#include "libc/errno.h"
#include "libc/runtime/runtime.h"
#include "libc/sysv/consts/rlim.h"
#include "libc/sysv/consts/rlimit.h"
#include "libc/sysv/consts/rusage.h"

View file

@ -7,6 +7,7 @@
#define PY_SSIZE_T_CLEAN
#include "libc/calls/calls.h"
#include "libc/errno.h"
#include "libc/stdio/lock.h"
#include "third_party/python/Include/abstract.h"
#include "third_party/python/Include/boolobject.h"
#include "third_party/python/Include/bytesobject.h"

View file

@ -10,6 +10,7 @@
#include "libc/dce.h"
#include "libc/fmt/fmt.h"
#include "libc/intrin/asan.internal.h"
#include "libc/mem/mem.h"
#include "libc/runtime/runtime.h"
#include "libc/sysv/consts/map.h"
#include "libc/sysv/consts/prot.h"

View file

@ -4,6 +4,7 @@
Python 3
https://docs.python.org/3/license.html │
*/
#include "libc/runtime/runtime.h"
#include "third_party/python/Include/grammar.h"
#include "third_party/python/Include/node.h"
#include "third_party/python/Include/objimpl.h"

View file

@ -4,6 +4,7 @@
Python 3
https://docs.python.org/3/license.html │
*/
#include "libc/mem/mem.h"
#include "third_party/python/Include/grammar.h"
#include "third_party/python/Include/objimpl.h"
#include "third_party/python/Include/pgenheaders.h"

View file

@ -19,7 +19,9 @@
#define PY_SSIZE_T_CLEAN
#include "dsp/scale/cdecimate2xuint8x8.h"
#include "libc/bits/popcnt.h"
#include "libc/calls/calls.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/macros.internal.h"
#include "libc/math.h"
#include "libc/mem/mem.h"
@ -27,6 +29,7 @@
#include "libc/nexgen32e/rdtsc.h"
#include "libc/nexgen32e/rdtscp.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "third_party/python/Include/abstract.h"
#include "third_party/python/Include/import.h"
#include "third_party/python/Include/longobject.h"
@ -187,6 +190,59 @@ cosmo_popcount(PyObject *self, PyObject *args)
return PyLong_FromSize_t(_countbits(p, n));
}
PyDoc_STRVAR(pledge_doc,
"pledge($module, promises, execpromises)\n\
--\n\n\
Permits syscall operations, e.g.\n\
\n\
>>> cosmo.pledge('stdio rpath tty', None)\n\
\n\
This function implements the OpenBSD pledge() API for\n\
OpenBSD and Linux, where we use SECCOMP BPF. Read the\n\
Cosmopolitan Libc documentation to learn more.");
static PyObject *
cosmo_pledge(PyObject *self, PyObject *args)
{
int e = errno;
const char *x, *y;
if (!PyArg_ParseTuple(args, "sz:pledge", &x, &y)) return 0;
if (!pledge(x, y)) {
Py_RETURN_NONE;
} else {
PyErr_SetString(PyExc_SystemError, strerror(errno));
errno = e;
return 0;
}
}
PyDoc_STRVAR(unveil_doc,
"unveil($module, path, permissions)\n\
--\n\n\
Permits filesystem operations, e.g.\n\
\n\
>>> cosmo.unveil('.', 'rwcx')\n\
>>> cosmo.unveil(None, None)\n\
\n\
This function implements the OpenBSD unveil() API for\n\
OpenBSD and Linux where we use Landlock LSM. Read the\n\
Cosmopolitan Libc documentation to learn more.");
static PyObject *
cosmo_unveil(PyObject *self, PyObject *args)
{
int e = errno;
const char *x, *y;
if (!PyArg_ParseTuple(args, "zz:unveil", &x, &y)) return 0;
if (!unveil(x, y)) {
Py_RETURN_NONE;
} else {
PyErr_SetString(PyExc_SystemError, strerror(errno));
errno = e;
return 0;
}
}
PyDoc_STRVAR(exit1_doc,
"exit1($module)\n\
--\n\n\
@ -269,6 +325,8 @@ static PyMethodDef cosmo_methods[] = {
{"exit1", cosmo_exit1, METH_NOARGS, exit1_doc},
{"rdtsc", cosmo_rdtsc, METH_NOARGS, rdtsc_doc},
{"crc32c", cosmo_crc32c, METH_VARARGS, crc32c_doc},
{"pledge", cosmo_pledge, METH_VARARGS, pledge_doc},
{"unveil", cosmo_unveil, METH_VARARGS, unveil_doc},
{"syscount", cosmo_syscount, METH_NOARGS, syscount_doc},
{"popcount", cosmo_popcount, METH_VARARGS, popcount_doc},
{"decimate", cosmo_decimate, METH_VARARGS, decimate_doc},

View file

@ -7,6 +7,7 @@
#include "libc/assert.h"
#include "libc/errno.h"
#include "libc/math.h"
#include "libc/runtime/runtime.h"
#include "third_party/python/Include/pymem.h"
#include "third_party/python/Include/pyport.h"
/* clang-format off */

View file

@ -5,6 +5,7 @@
https://docs.python.org/3/license.html │
*/
#include "libc/errno.h"
#include "libc/mem/mem.h"
#include "libc/nt/enum/formatmessageflags.h"
#include "libc/nt/enum/lang.h"
#include "libc/nt/memory.h"

View file

@ -15,6 +15,7 @@
#include "libc/sysv/consts/fio.h"
#include "libc/sysv/consts/o.h"
#include "libc/unicode/locale.h"
#include "libc/unicode/unicode.h"
#include "third_party/python/Include/bytesobject.h"
#include "third_party/python/Include/ceval.h"
#include "third_party/python/Include/fileutils.h"

View file

@ -11,14 +11,15 @@
#include "libc/calls/struct/stat.macros.h"
#include "libc/fmt/conv.h"
#include "libc/macros.internal.h"
#include "libc/mem/mem.h"
#include "libc/runtime/gc.h"
#include "libc/x/x.h"
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/s.h"
#include "libc/x/x.h"
#include "third_party/python/Include/Python-ast.h"
#include "third_party/python/Include/abstract.h"
#include "third_party/python/Include/boolobject.h"
#include "third_party/python/Include/bltinmodule.h"
#include "third_party/python/Include/boolobject.h"
#include "third_party/python/Include/ceval.h"
#include "third_party/python/Include/code.h"
#include "third_party/python/Include/dictobject.h"

View file

@ -5,6 +5,7 @@
https://docs.python.org/3/license.html │
*/
#include "libc/assert.h"
#include "libc/mem/mem.h"
#include "third_party/python/Include/bytesobject.h"
#include "third_party/python/Include/compile.h"
#include "third_party/python/Include/fileutils.h"

View file

@ -9,6 +9,7 @@
#include "libc/intrin/kprintf.h"
#include "libc/log/libfatal.internal.h"
#include "libc/log/log.h"
#include "libc/mem/mem.h"
#include "libc/runtime/runtime.h"
#include "libc/testlib/testlib.h"
#include "libc/x/x.h"

File diff suppressed because it is too large Load diff

View file

@ -1 +0,0 @@
2021-03-27

View file

@ -22,6 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "libc/str/str.h"
#include "third_party/quickjs/internal.h"
asm(".ident\t\"\\n\\n\

View file

@ -23,6 +23,8 @@
* THE SOFTWARE.
*/
#include "libc/assert.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "third_party/gdtoa/gdtoa.h"
#include "third_party/quickjs/internal.h"

View file

@ -24,6 +24,7 @@
*/
#include "libc/assert.h"
#include "libc/fmt/fmt.h"
#include "libc/str/str.h"
#include "third_party/quickjs/internal.h"
#include "third_party/quickjs/libregexp.h"
#include "third_party/quickjs/quickjs.h"

View file

@ -22,6 +22,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "third_party/quickjs/internal.h"
asm(".ident\t\"\\n\\n\

View file

@ -23,6 +23,7 @@
* THE SOFTWARE.
*/
#include "libc/assert.h"
#include "libc/runtime/runtime.h"
#include "third_party/quickjs/internal.h"
asm(".ident\t\"\\n\\n\

View file

@ -23,6 +23,8 @@
* THE SOFTWARE.
*/
#include "libc/assert.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "third_party/quickjs/internal.h"
#include "third_party/quickjs/leb128.h"
#include "third_party/quickjs/libregexp.h"

View file

@ -23,6 +23,8 @@
* THE SOFTWARE.
*/
#include "libc/fmt/fmt.h"
#include "libc/mem/mem.h"
#include "libc/str/str.h"
#include "third_party/quickjs/internal.h"
#include "third_party/quickjs/libregexp.h"
#include "third_party/quickjs/quickjs.h"

View file

@ -22,6 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "libc/runtime/runtime.h"
#include "third_party/quickjs/internal.h"
asm(".ident\t\"\\n\\n\

View file

@ -23,6 +23,7 @@
* THE SOFTWARE.
*/
#include "libc/assert.h"
#include "libc/runtime/runtime.h"
#include "third_party/quickjs/internal.h"
asm(".ident\t\"\\n\\n\

View file

@ -23,6 +23,7 @@
* THE SOFTWARE.
*/
#include "libc/assert.h"
#include "libc/runtime/runtime.h"
#include "third_party/quickjs/internal.h"
asm(".ident\t\"\\n\\n\

View file

@ -24,6 +24,7 @@
*/
#include "libc/assert.h"
#include "libc/fmt/fmt.h"
#include "libc/str/str.h"
#include "third_party/quickjs/internal.h"
#include "third_party/quickjs/libregexp.h"
#include "third_party/quickjs/quickjs.h"

Some files were not shown because too many files have changed in this diff Show more