Fix Landlock Make so it can read pattern rule vars

It turned out that specifying all SRCS and INCS as dependencies on the
pattern rules for all headers, caused `make` memory usage to skyrocket
from 40mb ot 160mb. This change also reduces the build graph another 4%.
This commit is contained in:
Justine Tunney 2022-08-13 17:20:50 -07:00
parent 62ca1b0902
commit ead3fc2b31
53 changed files with 105 additions and 93 deletions

View file

@ -377,17 +377,6 @@ $(SRCS): \
libc/integral/lp64arg.inc \ libc/integral/lp64arg.inc \
libc/integral/lp64.inc libc/integral/lp64.inc
o/%.h.ok: %.h $(HDRS) $(INCS)
@$(COMPILE) -ACHECK.h $(COMPILE.c) -xc -g0 -o $@ $<
o/$(MODE)/%.h.ok: %.h $(HDRS) $(INCS)
@$(COMPILE) -ACHECK.h $(COMPILE.c) -xc -g0 -o $@ $<
o/$(MODE)/%.hh.ok: %.hh $(HDRS) $(INCS)
@$(COMPILE) -ACHECK.h $(COMPILE.cxx) -xc++ -g0 -o $@ $<
o/%.okk: % $(HDRS) $(INCS)
@$(COMPILE) -ACHECK.h $(COMPILE.cxx) -xc++ -g0 -o $@ $<
o/$(MODE)/%.okk: % $(HDRS) $(INCS)
@$(COMPILE) -ACHECK.h $(COMPILE.cxx) -xc++ -g0 -o $@ $<
# UNSPECIFIED PREREQUISITES TUTORIAL # UNSPECIFIED PREREQUISITES TUTORIAL
# #
# A build rule must exist for all files that make needs to consider in # A build rule must exist for all files that make needs to consider in

View file

@ -99,3 +99,27 @@ o/$(MODE)/%.lua.runs: %.lua o/$(MODE)/tool/net/redbean.com
o/$(MODE)/%: o/$(MODE)/%.com o/$(MODE)/tool/build/cp.com o/$(MODE)/tool/build/assimilate.com o/$(MODE)/%: o/$(MODE)/%.com o/$(MODE)/tool/build/cp.com o/$(MODE)/tool/build/assimilate.com
@$(COMPILE) -wACP -T$@ o/$(MODE)/tool/build/cp.com $< $@ @$(COMPILE) -wACP -T$@ o/$(MODE)/tool/build/cp.com $< $@
@$(COMPILE) -wAASSIMILATE -T$@ o/$(MODE)/tool/build/assimilate.com $@ @$(COMPILE) -wAASSIMILATE -T$@ o/$(MODE)/tool/build/assimilate.com $@
################################################################################
# strict header checking
# these rules are unsandboxed since they're kind of a sandboxing test themselves
o/%.h.ok: .UNSANDBOXED = 1
o/%.h.ok: %.h
@$(COMPILE) -ACHECK.h $(COMPILE.c) -xc -g0 -o $@ $<
o/$(MODE)/%.h.ok: .UNSANDBOXED = 1
o/$(MODE)/%.h.ok: %.h
@$(COMPILE) -ACHECK.h $(COMPILE.c) -xc -g0 -o $@ $<
o/$(MODE)/%.hh.ok: .UNSANDBOXED = 1
o/$(MODE)/%.hh.ok: %.hh
@$(COMPILE) -ACHECK.h $(COMPILE.cxx) -xc++ -g0 -o $@ $<
o/%.okk: .UNSANDBOXED = 1
o/%.okk: %
@$(COMPILE) -ACHECK.h $(COMPILE.cxx) -xc++ -g0 -o $@ $<
o/$(MODE)/%.okk: .UNSANDBOXED = 1
o/$(MODE)/%.okk: %
@$(COMPILE) -ACHECK.h $(COMPILE.cxx) -xc++ -g0 -o $@ $<

View file

@ -192,6 +192,7 @@ int unlink(const char *);
int unlink_s(const char **); int unlink_s(const char **);
int unlinkat(int, const char *, int); int unlinkat(int, const char *, int);
int unveil(const char *, const char *); int unveil(const char *, const char *);
int usleep(unsigned);
int vfork(void) returnstwice; int vfork(void) returnstwice;
int wait(int *); int wait(int *);
int waitpid(int, int *, int); int waitpid(int, int *, int);

View file

@ -24,6 +24,7 @@
#include "libc/calls/struct/termios.h" #include "libc/calls/struct/termios.h"
#include "libc/calls/struct/winsize.h" #include "libc/calls/struct/winsize.h"
#include "libc/calls/syscall_support-nt.internal.h" #include "libc/calls/syscall_support-nt.internal.h"
#include "libc/errno.h"
#include "libc/intrin/spinlock.h" #include "libc/intrin/spinlock.h"
#include "libc/intrin/weaken.h" #include "libc/intrin/weaken.h"
#include "libc/log/log.h" #include "libc/log/log.h"

View file

@ -16,11 +16,11 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/calls/calls.h"
#include "libc/calls/syscall-sysv.internal.h" #include "libc/calls/syscall-sysv.internal.h"
#include "libc/calls/termios.h" #include "libc/calls/termios.h"
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/sysv/consts/termios.h" #include "libc/sysv/consts/termios.h"
#include "libc/time/time.h"
int tcsendbreak(int fd, int len) { int tcsendbreak(int fd, int len) {
if (!IsBsd()) { if (!IsBsd()) {

View file

@ -17,6 +17,7 @@
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/errno.h"
#include "libc/intrin/promises.internal.h" #include "libc/intrin/promises.internal.h"
#include "libc/log/libfatal.internal.h" #include "libc/log/libfatal.internal.h"
#include "libc/log/log.h" #include "libc/log/log.h"

View file

@ -2,6 +2,7 @@
#define COSMOPOLITAN_LIBC_LOG_GDB_H_ #define COSMOPOLITAN_LIBC_LOG_GDB_H_
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/calls/wait4.h" #include "libc/calls/wait4.h"
#include "libc/dce.h"
#include "libc/sysv/consts/nr.h" #include "libc/sysv/consts/nr.h"
#include "libc/sysv/consts/w.h" #include "libc/sysv/consts/w.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0) #if !(__ASSEMBLER__ + __LINKER__ + 0)

View file

@ -16,6 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/dce.h"
#include "libc/fmt/itoa.h" #include "libc/fmt/itoa.h"
#include "libc/log/log.h" #include "libc/log/log.h"
#include "libc/str/str.h" #include "libc/str/str.h"

View file

@ -1,8 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_LOG_INTERNAL_H_ #ifndef COSMOPOLITAN_LIBC_LOG_INTERNAL_H_
#define COSMOPOLITAN_LIBC_LOG_INTERNAL_H_ #define COSMOPOLITAN_LIBC_LOG_INTERNAL_H_
#include "libc/calls/struct/sigaction.h"
#include "libc/calls/struct/siginfo.h" #include "libc/calls/struct/siginfo.h"
#include "libc/calls/struct/termios.h"
#include "libc/calls/ucontext.h" #include "libc/calls/ucontext.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0) #if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_

View file

@ -1,19 +1,14 @@
#ifndef COSMOPOLITAN_LIBC_LOG_LOG_H_ #ifndef COSMOPOLITAN_LIBC_LOG_LOG_H_
#define COSMOPOLITAN_LIBC_LOG_LOG_H_ #define COSMOPOLITAN_LIBC_LOG_LOG_H_
#include "libc/intrin/likely.h"
#include "libc/intrin/weaken.h"
#include "libc/calls/struct/rusage.h" #include "libc/calls/struct/rusage.h"
#include "libc/calls/struct/sigset.h" #include "libc/calls/struct/sigset.h"
#include "libc/calls/struct/winsize.h" #include "libc/calls/struct/winsize.h"
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/errno.h" #include "libc/errno.h"
#include "libc/intrin/likely.h"
#include "libc/nexgen32e/stackframe.h" #include "libc/nexgen32e/stackframe.h"
#include "libc/runtime/internal.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
/*───────────────────────────────────────────────────────────────────────────│─╗
cosmopolitan § liblog
*/
#define kLogFatal 0 #define kLogFatal 0
#define kLogError 1 #define kLogError 1
@ -65,9 +60,6 @@ void CheckForMemoryLeaks(void);
#define showcrashreports() ShowCrashReports() #define showcrashreports() ShowCrashReports()
/*───────────────────────────────────────────────────────────────────────────│─╗
cosmopolitan § liblog » logging
*/
#ifndef __STRICT_ANSI__ #ifndef __STRICT_ANSI__
extern unsigned __log_level; /* log level for runtime check */ extern unsigned __log_level; /* log level for runtime check */
@ -194,10 +186,6 @@ extern unsigned __log_level; /* log level for runtime check */
} \ } \
} while (0) } while (0)
/*───────────────────────────────────────────────────────────────────────────│─╗
cosmopolitan § liblog » on error resume next
*/
#define LOGIFNEG1(FORM) \ #define LOGIFNEG1(FORM) \
({ \ ({ \
int e = errno; \ int e = errno; \
@ -224,10 +212,6 @@ extern unsigned __log_level; /* log level for runtime check */
Ax; \ Ax; \
}) })
/*───────────────────────────────────────────────────────────────────────────│─╗
cosmopolitan § liblog » implementation details
*/
void __logerrno(const char *, int, const char *) relegated; void __logerrno(const char *, int, const char *) relegated;
#define ARGS unsigned, const char *, int, FILE *, const char * #define ARGS unsigned, const char *, int, FILE *, const char *

View file

@ -19,6 +19,7 @@
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/calls/struct/sigaction.h" #include "libc/calls/struct/sigaction.h"
#include "libc/calls/struct/sigaltstack.h" #include "libc/calls/struct/sigaltstack.h"
#include "libc/errno.h"
#include "libc/log/internal.h" #include "libc/log/internal.h"
#include "libc/log/log.h" #include "libc/log/log.h"
#include "libc/macros.internal.h" #include "libc/macros.internal.h"

View file

@ -29,7 +29,6 @@ extern unsigned char _tls_content[];
void _init(void) hidden; void _init(void) hidden;
void __enable_tls(void); void __enable_tls(void);
void __enable_threads(void) hidden; void __enable_threads(void) hidden;
void __restorewintty(void) hidden;
void *__cxa_finalize(void *) hidden; void *__cxa_finalize(void *) hidden;
void cosmo(int, char **, char **, long (*)[2]) hidden wontreturn; void cosmo(int, char **, char **, long (*)[2]) hidden wontreturn;
void __stack_chk_fail(void) wontreturn relegated; void __stack_chk_fail(void) wontreturn relegated;

View file

@ -125,6 +125,7 @@ void __print_maps(void);
void __warn_if_powersave(void); void __warn_if_powersave(void);
const char *__describe_os(void); const char *__describe_os(void);
bool IsDynamicExecutable(const char *); bool IsDynamicExecutable(const char *);
void __restorewintty(void);
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -16,9 +16,10 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/intrin/bits.h"
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/calls/struct/sigaction.h"
#include "libc/errno.h" #include "libc/errno.h"
#include "libc/intrin/bits.h"
#include "libc/intrin/kprintf.h" #include "libc/intrin/kprintf.h"
#include "libc/log/backtrace.internal.h" #include "libc/log/backtrace.internal.h"
#include "libc/log/internal.h" #include "libc/log/internal.h"
@ -29,6 +30,7 @@
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/sysv/consts/sig.h"
#include "libc/testlib/testlib.h" #include "libc/testlib/testlib.h"
#include "third_party/dlmalloc/dlmalloc.h" #include "third_party/dlmalloc/dlmalloc.h"

View file

@ -16,9 +16,6 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/intrin/bits.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/intrin/weaken.h"
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/calls/strace.internal.h" #include "libc/calls/strace.internal.h"
#include "libc/calls/struct/rlimit.h" #include "libc/calls/struct/rlimit.h"
@ -26,8 +23,12 @@
#include "libc/calls/struct/sigset.h" #include "libc/calls/struct/sigset.h"
#include "libc/calls/syscall-sysv.internal.h" #include "libc/calls/syscall-sysv.internal.h"
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/errno.h"
#include "libc/intrin/asan.internal.h" #include "libc/intrin/asan.internal.h"
#include "libc/intrin/bits.h"
#include "libc/intrin/kprintf.h" #include "libc/intrin/kprintf.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/intrin/weaken.h"
#include "libc/log/check.h" #include "libc/log/check.h"
#include "libc/log/color.internal.h" #include "libc/log/color.internal.h"
#include "libc/log/libfatal.internal.h" #include "libc/log/libfatal.internal.h"

View file

@ -1,5 +1,6 @@
#include "libc/fmt/fmt.h" #include "libc/fmt/fmt.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/time/struct/tm.h"
#include "libc/time/time.h" #include "libc/time/time.h"
#include "libc/time/tz.internal.h" #include "libc/time/tz.internal.h"
#include "third_party/python/Include/object.h" #include "third_party/python/Include/object.h"

View file

@ -1,4 +1,5 @@
#include "libc/calls/weirdtypes.h" #include "libc/calls/weirdtypes.h"
#include "libc/time/struct/tm.h"
#include "libc/time/time.h" #include "libc/time/time.h"
char *ctime(const time_t *timep) { char *ctime(const time_t *timep) {

View file

@ -12,6 +12,7 @@
#include "libc/runtime/gc.h" #include "libc/runtime/gc.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/sysv/consts/o.h" #include "libc/sysv/consts/o.h"
#include "libc/time/struct/tm.h"
#include "libc/time/time.h" #include "libc/time/time.h"
#include "libc/time/tz.internal.h" #include "libc/time/tz.internal.h"
#include "libc/time/tzfile.internal.h" #include "libc/time/tzfile.internal.h"

View file

@ -17,19 +17,21 @@ struct tm {
const char *tm_zone; const char *tm_zone;
}; };
struct tm *gmtime_r(const int64_t *, struct tm *);
struct tm *localtime_r(const int64_t *, struct tm *);
int64_t timegm(struct tm *);
int64_t mktime(struct tm *);
int64_t timelocal(struct tm *);
int64_t timeoff(struct tm *, long);
char *strptime(const char *, const char *, struct tm *);
size_t strftime(char *, size_t, const char *, const struct tm *)
strftimeesque(3);
char *asctime(const struct tm *); char *asctime(const struct tm *);
char *asctime_r(const struct tm *, char[hasatleast 64]); char *asctime_r(const struct tm *, char[hasatleast 64]);
char *iso8601(char[hasatleast 20], struct tm *); char *iso8601(char[hasatleast 20], struct tm *);
char *strptime(const char *, const char *, struct tm *);
int64_t mktime(struct tm *);
int64_t timegm(struct tm *);
int64_t timelocal(struct tm *);
int64_t timeoff(struct tm *, long);
size_t strftime(char *, size_t, const char *, const struct tm *)
strftimeesque(3);
size_t wcsftime(wchar_t *, size_t, const wchar_t *, const struct tm *); size_t wcsftime(wchar_t *, size_t, const wchar_t *, const struct tm *);
struct tm *gmtime(const int64_t *);
struct tm *gmtime_r(const int64_t *, struct tm *);
struct tm *localtime(const int64_t *);
struct tm *localtime_r(const int64_t *, struct tm *);
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -8,6 +8,8 @@ struct utimbuf {
int64_t modtime; /* modified time */ int64_t modtime; /* modified time */
}; };
int utime(const char *, const struct utimbuf *);
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_TIME_STRUCT_UTIMBUF_H_ */ #endif /* COSMOPOLITAN_LIBC_TIME_STRUCT_UTIMBUF_H_ */

View file

@ -1,7 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_TIME_TIME_H_ #ifndef COSMOPOLITAN_LIBC_TIME_TIME_H_
#define COSMOPOLITAN_LIBC_TIME_TIME_H_ #define COSMOPOLITAN_LIBC_TIME_TIME_H_
#include "libc/time/struct/tm.h"
#include "libc/time/struct/utimbuf.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0) #if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_
@ -20,8 +18,6 @@ char *ctime(const int64_t *);
char *ctime_r(const int64_t *, char[hasatleast 64]); char *ctime_r(const int64_t *, char[hasatleast 64]);
double difftime(int64_t, int64_t) dontthrow pureconst; double difftime(int64_t, int64_t) dontthrow pureconst;
extern long double (*nowl)(void); extern long double (*nowl)(void);
int usleep(uint32_t);
int utime(const char *, const struct utimbuf *);
int64_t clock(void); int64_t clock(void);
int64_t posix2time(int64_t) pureconst; int64_t posix2time(int64_t) pureconst;
int64_t time(int64_t *); int64_t time(int64_t *);
@ -29,8 +25,6 @@ int64_t time2posix(int64_t) pureconst;
long double ConvertTicksToNanos(uint64_t); long double ConvertTicksToNanos(uint64_t);
long double dsleep(long double); long double dsleep(long double);
long double dtime(int); long double dtime(int);
struct tm *gmtime(const int64_t *);
struct tm *localtime(const int64_t *);
unsigned alarm(unsigned); unsigned alarm(unsigned);
unsigned sleep(unsigned); unsigned sleep(unsigned);
void RefreshTime(void); void RefreshTime(void);

View file

@ -16,12 +16,12 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/intrin/bits.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/calls/struct/stat.h" #include "libc/calls/struct/stat.h"
#include "libc/errno.h" #include "libc/errno.h"
#include "libc/intrin/bits.h"
#include "libc/intrin/lockcmpxchg.h" #include "libc/intrin/lockcmpxchg.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/log/check.h" #include "libc/log/check.h"
#include "libc/log/log.h" #include "libc/log/log.h"
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
@ -31,6 +31,7 @@
#include "libc/sysv/consts/map.h" #include "libc/sysv/consts/map.h"
#include "libc/sysv/consts/o.h" #include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/prot.h" #include "libc/sysv/consts/prot.h"
#include "libc/time/time.h"
#include "net/https/sslcache.h" #include "net/https/sslcache.h"
#include "third_party/mbedtls/ssl.h" #include "third_party/mbedtls/ssl.h"
#include "third_party/mbedtls/x509_crt.h" #include "third_party/mbedtls/x509_crt.h"

View file

@ -28,9 +28,9 @@
#include "libc/intrin/wait0.internal.h" #include "libc/intrin/wait0.internal.h"
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
#include "libc/nexgen32e/threaded.h" #include "libc/nexgen32e/threaded.h"
#include "libc/stdio/rand.h"
#include "libc/runtime/internal.h" #include "libc/runtime/internal.h"
#include "libc/runtime/stack.h" #include "libc/runtime/stack.h"
#include "libc/stdio/rand.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/sysv/consts/clone.h" #include "libc/sysv/consts/clone.h"
#include "libc/sysv/consts/itimer.h" #include "libc/sysv/consts/itimer.h"
@ -43,6 +43,7 @@
#include "libc/testlib/hyperion.h" #include "libc/testlib/hyperion.h"
#include "libc/testlib/testlib.h" #include "libc/testlib/testlib.h"
#include "libc/thread/spawn.h" #include "libc/thread/spawn.h"
#include "libc/time/struct/tm.h"
#include "libc/time/time.h" #include "libc/time/time.h"
STATIC_YOINK("zip_uri_support"); STATIC_YOINK("zip_uri_support");

View file

@ -20,6 +20,7 @@
#include "libc/limits.h" #include "libc/limits.h"
#include "libc/log/log.h" #include "libc/log/log.h"
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
#include "libc/runtime/internal.h"
#include "libc/runtime/symbols.internal.h" #include "libc/runtime/symbols.internal.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
#include "libc/str/str.h" #include "libc/str/str.h"

View file

@ -20,6 +20,7 @@
#include "libc/limits.h" #include "libc/limits.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/testlib/testlib.h" #include "libc/testlib/testlib.h"
#include "libc/time/struct/tm.h"
#include "libc/time/time.h" #include "libc/time/time.h"
textstartup static void strftime_test_init(void) { textstartup static void strftime_test_init(void) {

View file

@ -41,6 +41,7 @@
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/sysv/consts/o.h" #include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/s.h" #include "libc/sysv/consts/s.h"
#include "libc/time/struct/tm.h"
#include "libc/time/time.h" #include "libc/time/time.h"
#include "third_party/finger/finger.h" #include "third_party/finger/finger.h"
// clang-format off // clang-format off

View file

@ -37,6 +37,7 @@
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/time/struct/tm.h"
#include "libc/time/time.h" #include "libc/time/time.h"
#include "third_party/finger/finger.h" #include "third_party/finger/finger.h"
// clang-format off // clang-format off

View file

@ -1773,7 +1773,11 @@ child_execute_job (struct childbase *child, int good_stdin, char **argv)
(STRING_SIZE_TUPLE(".UNSANDBOXED"))) && (STRING_SIZE_TUPLE(".UNSANDBOXED"))) &&
(!c || !Vartoi (lookup_variable_in_set (!c || !Vartoi (lookup_variable_in_set
(STRING_SIZE_TUPLE(".UNSANDBOXED"), (STRING_SIZE_TUPLE(".UNSANDBOXED"),
c->file->variables->set)))); c->file->variables->set))) &&
(!c || !c->file->pat_variables ||
!Vartoi (lookup_variable_in_set
(STRING_SIZE_TUPLE(".UNSANDBOXED"),
c->file->pat_variables->set))));
/* resolve command into executable path */ /* resolve command into executable path */
if (!g_strict || !sandboxed) if (!g_strict || !sandboxed)
@ -1919,6 +1923,12 @@ child_execute_job (struct childbase *child, int good_stdin, char **argv)
(lookup_variable_in_set (lookup_variable_in_set
(STRING_SIZE_TUPLE (".UNVEIL"), (STRING_SIZE_TUPLE (".UNVEIL"),
c->file->variables->set))); c->file->variables->set)));
if (c->file->pat_variables)
RETURN_ON_ERROR
(UnveilVariable
(lookup_variable_in_set
(STRING_SIZE_TUPLE (".UNVEIL"),
c->file->pat_variables->set)));
/* commit sandbox */ /* commit sandbox */
RETURN_ON_ERROR (Unveil (0, 0)); RETURN_ON_ERROR (Unveil (0, 0));

View file

@ -1,6 +1,5 @@
#ifndef COSMOPOLITAN_THIRD_PARTY_MBEDTLS_BIGNUM_INTERNAL_H_ #ifndef COSMOPOLITAN_THIRD_PARTY_MBEDTLS_BIGNUM_INTERNAL_H_
#define COSMOPOLITAN_THIRD_PARTY_MBEDTLS_BIGNUM_INTERNAL_H_ #define COSMOPOLITAN_THIRD_PARTY_MBEDTLS_BIGNUM_INTERNAL_H_
#include "third_party/mbedtls/bignum.h"
#include "third_party/mbedtls/platform.h" #include "third_party/mbedtls/platform.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0) #if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_

View file

@ -33,8 +33,6 @@ typedef struct mbedtls_chachapoly_context
} }
mbedtls_chachapoly_context; mbedtls_chachapoly_context;
#else /* !MBEDTLS_CHACHAPOLY_ALT */
/* #include "third_party/mbedtls/chachapoly_alt.h" */
#endif /* !MBEDTLS_CHACHAPOLY_ALT */ #endif /* !MBEDTLS_CHACHAPOLY_ALT */
/** /**

View file

@ -1,12 +1,5 @@
#ifndef MBEDTLS_CONFIG_H_ #ifndef MBEDTLS_CONFIG_H_
#define MBEDTLS_CONFIG_H_ #define MBEDTLS_CONFIG_H_
#include "libc/dce.h"
/* /\* uncomment for testing old cpu code paths *\/ */
/* #include "libc/nexgen32e/x86feature.h" */
/* #undef X86_HAVE */
/* #define X86_HAVE(x) 0 */
/* #undef __x86_64__ */
/* protocols */ /* protocols */
#define MBEDTLS_SSL_PROTO_TLS1_2 #define MBEDTLS_SSL_PROTO_TLS1_2
@ -146,7 +139,7 @@
#define MBEDTLS_ZLIB_SUPPORT #define MBEDTLS_ZLIB_SUPPORT
#endif #endif
#if IsModeDbg() #ifdef MODE_DBG
#define MBEDTLS_CHECK_PARAMS #define MBEDTLS_CHECK_PARAMS
#endif #endif

View file

@ -47,8 +47,6 @@ typedef struct mbedtls_dhm_context
} }
mbedtls_dhm_context; mbedtls_dhm_context;
#else /* MBEDTLS_DHM_ALT */
/* #include "third_party/mbedtls/dhm_alt.h" */
#endif /* MBEDTLS_DHM_ALT */ #endif /* MBEDTLS_DHM_ALT */
/** /**

View file

@ -1,6 +1,5 @@
#ifndef COSMOPOLITAN_THIRD_PARTY_MBEDTLS_ECP_H_ #ifndef COSMOPOLITAN_THIRD_PARTY_MBEDTLS_ECP_H_
#define COSMOPOLITAN_THIRD_PARTY_MBEDTLS_ECP_H_ #define COSMOPOLITAN_THIRD_PARTY_MBEDTLS_ECP_H_
#include "libc/log/backtrace.internal.h"
#include "third_party/mbedtls/bignum.h" #include "third_party/mbedtls/bignum.h"
#include "third_party/mbedtls/config.h" #include "third_party/mbedtls/config.h"
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_
@ -233,8 +232,6 @@ mbedtls_ecp_group;
/* \} name SECTION: Module settings */ /* \} name SECTION: Module settings */
#else /* MBEDTLS_ECP_ALT */
/* #include "third_party/mbedtls/ecp_alt.h" */
#endif /* MBEDTLS_ECP_ALT */ #endif /* MBEDTLS_ECP_ALT */
#if defined(MBEDTLS_ECP_RESTARTABLE) #if defined(MBEDTLS_ECP_RESTARTABLE)

View file

@ -29,8 +29,6 @@ typedef struct {
mbedtls_cipher_context_t cipher_ctx; /*!< The cipher context used. */ mbedtls_cipher_context_t cipher_ctx; /*!< The cipher context used. */
} mbedtls_nist_kw_context; } mbedtls_nist_kw_context;
#else /* MBEDTLS_NIST_key wrapping_ALT */
/* #include "third_party/mbedtls/nist_kw_alt.h" */
#endif /* MBEDTLS_NIST_KW_ALT */ #endif /* MBEDTLS_NIST_KW_ALT */
/** /**

View file

@ -1,13 +1,11 @@
#ifndef COSMOPOLITAN_THIRD_PARTY_MBEDTLS_PLATFORM_H_ #ifndef COSMOPOLITAN_THIRD_PARTY_MBEDTLS_PLATFORM_H_
#define COSMOPOLITAN_THIRD_PARTY_MBEDTLS_PLATFORM_H_ #define COSMOPOLITAN_THIRD_PARTY_MBEDTLS_PLATFORM_H_
#include "libc/assert.h" #include "libc/assert.h"
#include "libc/intrin/likely.h"
#include "libc/calls/weirdtypes.h"
#include "libc/fmt/fmt.h" #include "libc/fmt/fmt.h"
#include "libc/intrin/likely.h"
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
#include "libc/time/time.h"
#include "third_party/mbedtls/config.h" #include "third_party/mbedtls/config.h"
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_
@ -19,7 +17,7 @@ COSMOPOLITAN_C_START_
#define mbedtls_snprintf snprintf #define mbedtls_snprintf snprintf
#define mbedtls_vsnprintf vsnprintf #define mbedtls_vsnprintf vsnprintf
#define mbedtls_exit exit #define mbedtls_exit exit
#define mbedtls_time_t time_t #define mbedtls_time_t int64_t
#define mbedtls_time time #define mbedtls_time time
#define mbedtls_platform_gmtime_r gmtime_r #define mbedtls_platform_gmtime_r gmtime_r

View file

@ -29,8 +29,6 @@ typedef struct mbedtls_poly1305_context
} }
mbedtls_poly1305_context; mbedtls_poly1305_context;
#else /* MBEDTLS_POLY1305_ALT */
/* #include "third_party/mbedtls/poly1305_alt.h" */
#endif /* MBEDTLS_POLY1305_ALT */ #endif /* MBEDTLS_POLY1305_ALT */
/** /**

View file

@ -4,7 +4,6 @@
#include "libc/log/log.h" #include "libc/log/log.h"
#include "libc/nexgen32e/bench.h" #include "libc/nexgen32e/bench.h"
#include "libc/nexgen32e/rdtsc.h" #include "libc/nexgen32e/rdtsc.h"
#include "libc/time/time.h"
#if 1 #if 1
#define START() \ #define START() \

View file

@ -16,6 +16,7 @@
limitations under the License. limitations under the License.
*/ */
#include "libc/log/log.h" #include "libc/log/log.h"
#include "libc/time/time.h"
#include "third_party/mbedtls/common.h" #include "third_party/mbedtls/common.h"
#include "third_party/mbedtls/platform.h" #include "third_party/mbedtls/platform.h"
#include "third_party/mbedtls/ssl_cache.h" #include "third_party/mbedtls/ssl_cache.h"

View file

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

View file

@ -18,6 +18,7 @@
#include "libc/log/log.h" #include "libc/log/log.h"
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/time/time.h"
#include "third_party/mbedtls/common.h" #include "third_party/mbedtls/common.h"
#include "third_party/mbedtls/debug.h" #include "third_party/mbedtls/debug.h"
#include "third_party/mbedtls/ecp.h" #include "third_party/mbedtls/ecp.h"

View file

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

View file

@ -6142,7 +6142,7 @@ static int ssl_session_load( mbedtls_ssl_session *session,
start = Read64be(p); start = Read64be(p);
p += 8; p += 8;
session->start = (time_t) start; session->start = (int64_t) start;
#endif /* MBEDTLS_HAVE_TIME */ #endif /* MBEDTLS_HAVE_TIME */
/* /*

View file

@ -1,5 +1,6 @@
#include "libc/intrin/bits.h" #include "libc/intrin/bits.h"
#include "libc/limits.h" #include "libc/limits.h"
#include "libc/time/time.h"
#include "third_party/mbedtls/asn1.h" #include "third_party/mbedtls/asn1.h"
#include "third_party/mbedtls/bignum.h" #include "third_party/mbedtls/bignum.h"
#include "third_party/mbedtls/common.h" #include "third_party/mbedtls/common.h"

View file

@ -15,13 +15,13 @@
* limitations under the License. * limitations under the License.
*/ */
#include "libc/assert.h" #include "libc/assert.h"
#include "libc/intrin/bits.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/fmt/conv.h" #include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h" #include "libc/fmt/fmt.h"
#include "libc/intrin/bits.h"
#include "libc/intrin/kprintf.h" #include "libc/intrin/kprintf.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/log/backtrace.internal.h" #include "libc/log/backtrace.internal.h"
#include "libc/log/check.h" #include "libc/log/check.h"
#include "libc/log/libfatal.internal.h" #include "libc/log/libfatal.internal.h"
@ -29,15 +29,16 @@
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
#include "libc/nexgen32e/vendor.internal.h" #include "libc/nexgen32e/vendor.internal.h"
#include "libc/nt/runtime.h" #include "libc/nt/runtime.h"
#include "libc/stdio/rand.h"
#include "libc/runtime/internal.h" #include "libc/runtime/internal.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/runtime/symbols.internal.h" #include "libc/runtime/symbols.internal.h"
#include "libc/stdio/append.internal.h" #include "libc/stdio/append.internal.h"
#include "libc/stdio/rand.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/sysv/consts/exit.h" #include "libc/sysv/consts/exit.h"
#include "libc/sysv/consts/nr.h" #include "libc/sysv/consts/nr.h"
#include "libc/time/time.h"
#include "libc/x/x.h" #include "libc/x/x.h"
#include "third_party/mbedtls/config.h" #include "third_party/mbedtls/config.h"
#include "third_party/mbedtls/endian.h" #include "third_party/mbedtls/endian.h"

View file

@ -19,6 +19,7 @@
#include "third_party/mbedtls/ssl_invasive.h" #include "third_party/mbedtls/ssl_invasive.h"
#include "libc/testlib/testlib.h" #include "libc/testlib/testlib.h"
#include "libc/log/log.h" #include "libc/log/log.h"
#include "libc/time/time.h"
#include "libc/stdio/rand.h" #include "libc/stdio/rand.h"
#include "libc/intrin/safemacros.internal.h" #include "libc/intrin/safemacros.internal.h"
#include "third_party/mbedtls/test/test.inc" #include "third_party/mbedtls/test/test.inc"

View file

@ -19,6 +19,7 @@
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
#include "libc/time/struct/tm.h" #include "libc/time/struct/tm.h"
#include "libc/time/time.h"
#include "third_party/mbedtls/asn1.h" #include "third_party/mbedtls/asn1.h"
#include "third_party/mbedtls/certs.h" #include "third_party/mbedtls/certs.h"
#include "third_party/mbedtls/common.h" #include "third_party/mbedtls/common.h"

View file

@ -33,6 +33,7 @@
#include "libc/log/log.h" #include "libc/log/log.h"
#include "libc/time/time.h" #include "libc/time/time.h"
#include "third_party/unzip/unzip.h" #include "third_party/unzip/unzip.h"
#include "libc/time/struct/utimbuf.h"
#include "third_party/unzip/globals.h" #include "third_party/unzip/globals.h"
#ifdef USE_ICONV_MAPPING #ifdef USE_ICONV_MAPPING

View file

@ -7,6 +7,7 @@
#include "libc/calls/struct/stat.macros.h" #include "libc/calls/struct/stat.macros.h"
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "third_party/zip/osdep.h" #include "third_party/zip/osdep.h"
#include "libc/time/struct/utimbuf.h"
#include "libc/sysv/consts/dt.h" #include "libc/sysv/consts/dt.h"
/* /*

View file

@ -30,6 +30,7 @@
#include "libc/calls/termios.h" #include "libc/calls/termios.h"
#include "libc/calls/ucontext.h" #include "libc/calls/ucontext.h"
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/errno.h"
#include "libc/fmt/bing.internal.h" #include "libc/fmt/bing.internal.h"
#include "libc/fmt/conv.h" #include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h" #include "libc/fmt/fmt.h"

View file

@ -16,7 +16,6 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/intrin/safemacros.internal.h"
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/calls/struct/stat.h" #include "libc/calls/struct/stat.h"
#include "libc/dce.h" #include "libc/dce.h"
@ -25,7 +24,9 @@
#include "libc/elf/struct/rela.h" #include "libc/elf/struct/rela.h"
#include "libc/elf/struct/shdr.h" #include "libc/elf/struct/shdr.h"
#include "libc/elf/struct/sym.h" #include "libc/elf/struct/sym.h"
#include "libc/errno.h"
#include "libc/fmt/itoa.h" #include "libc/fmt/itoa.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/log/check.h" #include "libc/log/check.h"
#include "libc/log/log.h" #include "libc/log/log.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"

View file

@ -76,6 +76,7 @@
#include "libc/sysv/consts/w.h" #include "libc/sysv/consts/w.h"
#include "libc/sysv/errfuns.h" #include "libc/sysv/errfuns.h"
#include "libc/time/struct/timezone.h" #include "libc/time/struct/timezone.h"
#include "libc/time/struct/utimbuf.h"
#include "libc/time/time.h" #include "libc/time/time.h"
#include "libc/x/x.h" #include "libc/x/x.h"
#include "third_party/mbedtls/endian.h" #include "third_party/mbedtls/endian.h"

View file

@ -23,7 +23,6 @@
#include "libc/calls/struct/flock.h" #include "libc/calls/struct/flock.h"
#include "libc/calls/struct/iovec.h" #include "libc/calls/struct/iovec.h"
#include "libc/calls/struct/rusage.h" #include "libc/calls/struct/rusage.h"
#include "libc/calls/struct/seccomp.h"
#include "libc/calls/struct/sigaction.h" #include "libc/calls/struct/sigaction.h"
#include "libc/calls/struct/stat.h" #include "libc/calls/struct/stat.h"
#include "libc/calls/struct/termios.h" #include "libc/calls/struct/termios.h"
@ -57,6 +56,7 @@
#include "libc/runtime/gc.h" #include "libc/runtime/gc.h"
#include "libc/runtime/gc.internal.h" #include "libc/runtime/gc.internal.h"
#include "libc/runtime/internal.h" #include "libc/runtime/internal.h"
#include "libc/runtime/memtrack.internal.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/runtime/stack.h" #include "libc/runtime/stack.h"
#include "libc/sock/goodsocket.internal.h" #include "libc/sock/goodsocket.internal.h"

View file

@ -5,17 +5,17 @@ import re
import sys import sys
def GetDeps(path): def GetDeps(path):
deps = set() def Dive(path, depth, visited):
def Dive(path, depth): sys.stdout.write('%s%s' % ('\t' * depth, path))
if path in deps: if path in visited:
sys.stdout.write(' cycle\n')
return return
deps.add(path) sys.stdout.write('\n')
sys.stdout.write('%s%s\n' % ('\t' * depth, path))
with open(path) as f: with open(path) as f:
code = f.read() code = f.read()
for dep in re.findall(r'[.#]include "([^"]+)"', code): for dep in re.findall(r'[.#]include "([^"]+)"', code):
Dive(dep, depth + 1) Dive(dep, depth + 1, visited + [path])
Dive(path, 0) Dive(path, 0, [])
sys.stdout.write('\n') sys.stdout.write('\n')
for arg in sys.argv[1:]: for arg in sys.argv[1:]: