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

@ -22,8 +22,7 @@
#include "libc/testlib/testlib.h"
void SetUpOnce(void) {
pledge("stdio", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio", 0));
}
unsigned P[] = {

View file

@ -22,8 +22,7 @@
#include "libc/testlib/testlib.h"
void SetUpOnce(void) {
pledge("stdio", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio", 0));
}
TEST(bitreverse, test) {

View file

@ -21,13 +21,13 @@
#include "libc/calls/calls.h"
#include "libc/mem/mem.h"
#include "libc/runtime/gc.internal.h"
#include "libc/str/str.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/hyperion.h"
#include "libc/testlib/testlib.h"
void SetUpOnce(void) {
pledge("stdio", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio", 0));
}
TEST(_countbits, testLow) {

View file

@ -26,8 +26,7 @@
#define ROL(w, k) ((w) << (k) | CheckUnsigned(w) >> (sizeof(w) * 8 - (k)))
void SetUpOnce(void) {
pledge("stdio", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio", 0));
}
TEST(TwosComplementBane, LiteralsThatAreLiterallyTheSameNumber) {

View file

@ -18,14 +18,14 @@
*/
#include "libc/bits/morton.h"
#include "libc/calls/calls.h"
#include "libc/errno.h"
#include "libc/nexgen32e/kcpuids.h"
#include "libc/str/str.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"
void SetUpOnce(void) {
pledge("stdio rpath", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath", 0));
}
TEST(morton, test) {

View file

@ -23,8 +23,7 @@
#include "libc/testlib/testlib.h"
void SetUpOnce(void) {
pledge("stdio", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio", 0));
}
TEST(popcnt, test) {

View file

@ -18,12 +18,10 @@
*/
#include "libc/bits/bits.h"
#include "libc/calls/calls.h"
#include "libc/errno.h"
#include "libc/testlib/testlib.h"
void SetUpOnce(void) {
pledge("stdio", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio", 0));
}
TEST(rounddown2pow, test) {

View file

@ -18,12 +18,10 @@
*/
#include "libc/bits/bits.h"
#include "libc/calls/calls.h"
#include "libc/errno.h"
#include "libc/testlib/testlib.h"
void SetUpOnce(void) {
pledge("stdio", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio", 0));
}
TEST(roundup2log, test) {

View file

@ -18,7 +18,6 @@
*/
#include "libc/bits/bits.h"
#include "libc/calls/calls.h"
#include "libc/errno.h"
#include "libc/log/check.h"
#include "libc/macros.internal.h"
#include "libc/math.h"
@ -26,8 +25,7 @@
#include "libc/testlib/testlib.h"
void SetUpOnce(void) {
pledge("stdio", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio", 0));
}
TEST(roundup2pow, test) {

View file

@ -59,6 +59,20 @@ TEST(_timespec_frommicros, test) {
_timespec_eq((struct timespec){0, 2000}, _timespec_frommicros(2)));
EXPECT_TRUE(
_timespec_eq((struct timespec){1}, _timespec_frommicros(1000000)));
EXPECT_TRUE(_timespec_eq((struct timespec){2, 123000},
_timespec_frommicros(2000123)));
}
TEST(_timespec_tomillis, test) {
EXPECT_EQ(2123, _timespec_tomillis((struct timespec){2, 123000000}));
}
TEST(_timespec_tomicros, test) {
EXPECT_EQ(2000123, _timespec_tomicros((struct timespec){2, 123000}));
}
TEST(_timespec_tonanos, test) {
EXPECT_EQ(2000123000, _timespec_tonanos((struct timespec){2, 123000}));
}
static long mod(long x, long y) {

View file

@ -30,8 +30,7 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
}
TEST(access, efault) {

View file

@ -25,8 +25,7 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
}
TEST(chdir, efault) {

View file

@ -22,6 +22,7 @@
#include "libc/calls/struct/timeval.h"
#include "libc/calls/syscall_support-sysv.internal.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/nexgen32e/rdtsc.h"
#include "libc/runtime/runtime.h"
#include "libc/sysv/consts/auxv.h"

View file

@ -40,8 +40,7 @@ char pathbuf[PATH_MAX];
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
}
void SetUp(void) {

View file

@ -33,8 +33,9 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
pledge("stdio rpath wpath cpath fattr proc exec", 0);
errno = 0;
ASSERT_SYS(0, 0,
pledge("stdio rpath wpath cpath fattr proc exec prot_exec",
"stdio rpath wpath prot_exec"));
}
static textstartup void TestInit(int argc, char **argv) {

View file

@ -31,8 +31,7 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
}
TEST(fcntl_getfl, testRemembersAccessMode) {

View file

@ -24,8 +24,7 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
}
TEST(fileexists, test) {

View file

@ -33,8 +33,7 @@ struct stat st;
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
pledge("stdio rpath wpath cpath", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath", 0));
}
TEST(ftruncate, test) {

View file

@ -17,7 +17,6 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/calls.h"
#include "libc/errno.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h"
#include "libc/log/check.h"
@ -29,8 +28,7 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
pledge("stdio rpath cpath fattr", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath cpath fattr", 0));
}
TEST(getcwd, test) {

View file

@ -28,8 +28,7 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
pledge("stdio rpath wpath cpath fattr proc", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr proc", 0));
}
TEST(lseek, wat) {

View file

@ -24,6 +24,7 @@
#include "libc/mem/mem.h"
#include "libc/runtime/gc.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/o.h"
#include "libc/testlib/testlib.h"
#include "libc/x/x.h"
@ -31,8 +32,7 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
}
void SetUp(void) {

View file

@ -20,6 +20,7 @@
#include "libc/calls/struct/itimerval.h"
#include "libc/calls/struct/sigaction.h"
#include "libc/calls/struct/timespec.h"
#include "libc/errno.h"
#include "libc/intrin/describeflags.internal.h"
#include "libc/intrin/kprintf.h"
#include "libc/sysv/consts/itimer.h"

View file

@ -19,8 +19,10 @@
#include "libc/calls/internal.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/intrin/kprintf.h"
#include "libc/macros.internal.h"
#include "libc/runtime/gc.internal.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/o.h"
#include "libc/testlib/testlib.h"
#include "libc/x/x.h"
@ -28,8 +30,7 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
}
TEST(open, efault) {
@ -51,7 +52,7 @@ TEST(open, enotdir) {
TEST(open, eexist) {
ASSERT_SYS(0, 0, touch("exists", 0644));
ASSERT_SYS(EEXIST, -1, open("exists", O_WRONLY | O_CREAT | O_EXCL));
ASSERT_SYS(EEXIST, -1, open("exists", O_WRONLY | O_CREAT | O_EXCL, 0644));
}
TEST(open, doubleSlash_worksAndGetsNormalizedOnWindows) {

View file

@ -0,0 +1,61 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2022 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/calls.h"
#include "libc/sysv/consts/o.h"
#include "libc/testlib/testlib.h"
#define SPAWN(METHOD) \
{ \
int ws, pid; \
ASSERT_NE(-1, (pid = METHOD())); \
if (!pid) {
#define EXITS(rc) \
_Exit(0); \
} \
ASSERT_NE(-1, wait(&ws)); \
ASSERT_TRUE(WIFEXITED(ws)); \
ASSERT_EQ(rc, WEXITSTATUS(ws)); \
}
#define TERMS(sig) \
_Exit(0); \
} \
ASSERT_NE(-1, wait(&ws)); \
ASSERT_TRUE(WIFSIGNALED(ws)); \
ASSERT_EQ(sig, WTERMSIG(ws)); \
}
char testlib_enable_tmp_setup_teardown;
TEST(pledge, promisedSyscallsCanBeCalled_ieEnosysIsIgnored) {
SPAWN(fork);
EXPECT_SYS(0, 0, pledge("stdio", 0));
EXPECT_SYS(0, 0, read(0, 0, 0));
EXITS(0);
}
TEST(unveil, pathBecomeVisible_ieEnosysIsIgnored) {
SPAWN(fork);
EXPECT_SYS(0, 0, touch("foo", 0644));
EXPECT_SYS(0, 0, unveil("foo", "r"));
EXPECT_SYS(0, 0, unveil(0, 0));
EXPECT_SYS(0, 3, open("foo", O_RDONLY));
EXITS(0);
}

View file

@ -21,6 +21,7 @@
#include "libc/calls/struct/seccomp.h"
#include "libc/calls/syscall_support-sysv.internal.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/intrin/kprintf.h"
#include "libc/intrin/promises.internal.h"
#include "libc/runtime/runtime.h"
@ -98,7 +99,7 @@ TEST(pledge, testLogMessage_inSoftyMode) {
read(fds[0], msg, sizeof(msg));
close(fds[0]);
if (IsLinux()) {
ASSERT_STARTSWITH("error: maybe pledge inet", msg);
ASSERT_STARTSWITH("error: pledge inet for socket", msg);
}
}
@ -116,7 +117,7 @@ TEST(pledge, testLogMessage_onKillProcess) {
read(fds[0], msg, sizeof(msg));
close(fds[0]);
if (IsLinux()) {
ASSERT_STARTSWITH("error: maybe pledge inet", msg);
ASSERT_STARTSWITH("error: pledge inet for socket", msg);
}
}

View file

@ -82,6 +82,7 @@ int extract(const char *from, const char *to, int mode) {
}
void SetUp(void) {
__enable_threads();
if (!__is_linux_2_6_23() && !IsOpenbsd()) exit(0);
ASSERT_SYS(0, 0, extract("/zip/life.elf", "life.elf", 0755));
ASSERT_SYS(0, 0, extract("/zip/sock.elf", "sock.elf", 0755));

View file

@ -25,8 +25,7 @@ char buf[8];
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
}
TEST(pread, testReadPastEof_returnsZero) {

View file

@ -23,8 +23,7 @@
#include "libc/x/x.h"
void SetUpOnce(void) {
pledge("stdio rpath tty proc", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath tty proc", 0));
}
/**

View file

@ -26,8 +26,7 @@ struct stat st;
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
}
TEST(pwrite, testWritePastEof_extendsFile) {

View file

@ -18,6 +18,7 @@
*/
#include "libc/calls/calls.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "libc/testlib/testlib.h"
#include "libc/time/time.h"
#include "libc/x/x.h"

View file

@ -18,7 +18,6 @@
*/
#include "libc/calls/calls.h"
#include "libc/calls/struct/stat.h"
#include "libc/errno.h"
#include "libc/log/log.h"
#include "libc/runtime/gc.h"
#include "libc/runtime/gc.internal.h"
@ -33,8 +32,7 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
}
TEST(readlink, enoent) {

View file

@ -25,8 +25,7 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
}
TEST(rename, enoent) {

View file

@ -29,7 +29,9 @@
#include "libc/macros.internal.h"
#include "libc/nexgen32e/threaded.h"
#include "libc/rand/rand.h"
#include "libc/runtime/internal.h"
#include "libc/runtime/stack.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/clone.h"
#include "libc/sysv/consts/itimer.h"
#include "libc/sysv/consts/map.h"
@ -48,6 +50,11 @@ STATIC_YOINK("libc/testlib/hyperion.txt");
#define THREADS 8
void SetUpOnce(void) {
__enable_threads();
ASSERT_SYS(0, 0, pledge("stdio rpath", 0));
}
void PullSomeZipFilesIntoLinkage(void) {
gmtime(0);
}

View file

@ -34,8 +34,7 @@
#include "tool/net/sandbox.h"
void SetUpOnce(void) {
pledge("stdio proc", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio proc", 0));
}
// It's been reported that Chromebooks return EINVAL here.

View file

@ -31,8 +31,7 @@
bool gotsig;
void SetUpOnce(void) {
pledge("stdio", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio", 0));
}
void OnSigAlrm(int sig, siginfo_t *si, ucontext_t *ctx) {

View file

@ -34,8 +34,7 @@ struct sigaction oldsa;
volatile bool gotsigint;
void SetUpOnce(void) {
pledge("stdio rpath proc", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath proc", 0));
}
void OnSigInt(int sig) {

View file

@ -31,8 +31,7 @@ testonly void OnUsr1(int sig) {
}
void SetUpOnce(void) {
pledge("stdio proc", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio proc", 0));
}
TEST(signal, test) {

View file

@ -29,8 +29,7 @@
volatile int n;
void SetUpOnce(void) {
pledge("stdio proc", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio proc", 0));
}
void OnSig(int sig, siginfo_t *si, ucontext_t *ctx) {

View file

@ -37,8 +37,7 @@ STATIC_YOINK("zip_uri_support");
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
}
TEST(stat_010, testEmptyFile_sizeIsZero) {

View file

@ -18,6 +18,7 @@
*/
#include "libc/calls/calls.h"
#include "libc/calls/struct/stat.h"
#include "libc/errno.h"
#include "libc/fmt/fmt.h"
#include "libc/fmt/itoa.h"
#include "libc/rand/rand.h"
@ -31,8 +32,7 @@ char p[2][PATH_MAX];
struct stat st;
void SetUpOnce(void) {
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
}
TEST(symlink, enoent) {

View file

@ -73,13 +73,13 @@ o/$(MODE)/test/libc/calls/%.com.dbg: \
@$(APELINK)
o/$(MODE)/test/libc/calls/tiny64.elf.zip.o: test/libc/calls/tiny64.elf
@$(COMPILE) -AZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
@$(COMPILE) -wAZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
o/$(MODE)/test/libc/calls/life-nomod.com.zip.o: o/$(MODE)/test/libc/calls/life-nomod.com
@$(COMPILE) -AZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
@$(COMPILE) -wAZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
o/$(MODE)/test/libc/calls/life-classic.com.zip.o: o/$(MODE)/test/libc/calls/life-classic.com
@$(COMPILE) -AZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
@$(COMPILE) -wAZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
o/$(MODE)/test/libc/calls/life-classic.com.dbg: \
$(LIBC_RUNTIME) \

View file

@ -18,14 +18,14 @@
*/
#include "libc/calls/calls.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/sysv/consts/at.h"
#include "libc/testlib/testlib.h"
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
}
TEST(unlink, efault) {

View file

@ -26,6 +26,7 @@
#include "libc/intrin/kprintf.h"
#include "libc/mem/io.h"
#include "libc/runtime/gc.h"
#include "libc/runtime/internal.h"
#include "libc/runtime/runtime.h"
#include "libc/sock/sock.h"
#include "libc/stdio/stdio.h"
@ -72,6 +73,7 @@ static bool SupportsLandlock(void) {
}
void SetUpOnce(void) {
__enable_threads();
if (!(IsLinux() && SupportsLandlock()) && !IsOpenbsd()) exit(0);
}

View file

@ -30,8 +30,7 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
}
TEST(utimensat, test) {

View file

@ -32,8 +32,7 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
}
TEST(writev, test) {

View file

@ -23,8 +23,7 @@
#include "libc/testlib/testlib.h"
void SetUpOnce(void) {
pledge("stdio rpath", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath", 0));
}
TEST(CompareDnsNames, testEmpty) {

View file

@ -30,6 +30,7 @@
#include "libc/dns/ent.h"
#include "libc/dns/prototxt.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/testlib/testlib.h"
char testlib_enable_tmp_setup_teardown;

View file

@ -17,6 +17,8 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/dns/hoststxt.h"
#include "libc/mem/mem.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/af.h"
#include "libc/testlib/testlib.h"

View file

@ -25,11 +25,11 @@
OTHER DEALINGS IN THE SOFTWARE.
*/
#include "libc/dns/servicestxt.h"
#include "libc/calls/calls.h"
#include "libc/dns/dns.h"
#include "libc/dns/ent.h"
#include "libc/dns/servicestxt.h"
#include "libc/str/str.h"
#include "libc/testlib/testlib.h"
char testlib_enable_tmp_setup_teardown;

View file

@ -18,6 +18,7 @@
*/
#include "libc/fmt/fmt.h"
#include "libc/fmt/itoa.h"
#include "libc/str/str.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"

View file

@ -18,6 +18,7 @@
*/
#include "libc/fmt/fmt.h"
#include "libc/fmt/itoa.h"
#include "libc/str/str.h"
#include "libc/testlib/testlib.h"
char buf[25];

View file

@ -18,6 +18,7 @@
*/
#include "libc/fmt/fmt.h"
#include "libc/fmt/itoa.h"
#include "libc/str/str.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"

View file

@ -18,6 +18,7 @@
*/
#include "libc/fmt/itoa.h"
#include "libc/limits.h"
#include "libc/str/str.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"

View file

@ -143,9 +143,9 @@ TEST(sscanf, testDiscard_notIncludedInCount) {
}
TEST(sscanf, testFixedWidthFormat_Integer) {
int r, g, b;
ASSERT_EQ(3, sscanf("#321030", "#%2x%2b%2d", &r, &g, &b));
ASSERT_EQ(0x32, r);
ASSERT_EQ(2, g);
ASSERT_EQ(30, b);
int r, g, b;
ASSERT_EQ(3, sscanf("#321030", "#%2x%2b%2d", &r, &g, &b));
ASSERT_EQ(0x32, r);
ASSERT_EQ(2, g);
ASSERT_EQ(30, b);
}

View file

@ -54,6 +54,11 @@ _Alignas(64) char slock;
pthread_mutex_t mylock;
struct spawn th[THREADS];
void SetUpOnce(void) {
__enable_threads();
ASSERT_SYS(0, 0, pledge("stdio rpath", 0));
}
TEST(pthread_mutex_lock, normal) {
pthread_mutex_t lock;
pthread_mutexattr_t attr;

View file

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

View file

@ -78,11 +78,11 @@ o/$(MODE)/test/libc/log/backtrace.com.dbg: \
o/$(MODE)/test/libc/log/backtrace.com.zip.o: \
o/$(MODE)/test/libc/log/backtrace.com
@$(COMPILE) -AZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
@$(COMPILE) -wAZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
o/$(MODE)/test/libc/log/backtrace.com.dbg.zip.o: \
o/$(MODE)/test/libc/log/backtrace.com.dbg
@$(COMPILE) -AZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
@$(COMPILE) -wAZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
.PHONY: o/$(MODE)/test/libc/log
o/$(MODE)/test/libc/log: \

View file

@ -46,8 +46,7 @@ void SetUp(void) {
}
void SetUpOnce(void) {
pledge("stdio rpath", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath", 0));
}
TEST(malloc, zeroMeansOne) {

View file

@ -89,17 +89,17 @@ o/$(MODE)/test/libc/mem/prog/life.com.dbg: \
o/$(MODE)/test/libc/mem/prog/life.elf: \
o/$(MODE)/tool/build/assimilate.com \
o/$(MODE)/test/libc/mem/prog/life.com
@$(COMPILE) -ACP -T$@ \
@$(COMPILE) -wACP -T$@ \
build/bootstrap/cp.com \
o/$(MODE)/test/libc/mem/prog/life.com \
o/$(MODE)/test/libc/mem/prog/life.elf
@$(COMPILE) -AASSIMILATE -T$@ \
@$(COMPILE) -wAASSIMILATE -T$@ \
o/$(MODE)/tool/build/assimilate.com \
o/$(MODE)/test/libc/mem/prog/life.elf
o/$(MODE)/test/libc/mem/prog/life.elf.zip.o: \
o/$(MODE)/test/libc/mem/prog/life.elf
@$(COMPILE) -AZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
@$(COMPILE) -wAZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
################################################################################
@ -114,17 +114,17 @@ o/$(MODE)/test/libc/mem/prog/sock.com.dbg: \
o/$(MODE)/test/libc/mem/prog/sock.elf: \
o/$(MODE)/tool/build/assimilate.com \
o/$(MODE)/test/libc/mem/prog/sock.com
@$(COMPILE) -ACP -T$@ \
@$(COMPILE) -wACP -T$@ \
build/bootstrap/cp.com \
o/$(MODE)/test/libc/mem/prog/sock.com \
o/$(MODE)/test/libc/mem/prog/sock.elf
@$(COMPILE) -AASSIMILATE -T$@ \
@$(COMPILE) -wAASSIMILATE -T$@ \
o/$(MODE)/tool/build/assimilate.com \
o/$(MODE)/test/libc/mem/prog/sock.elf
o/$(MODE)/test/libc/mem/prog/sock.elf.zip.o: \
o/$(MODE)/test/libc/mem/prog/sock.elf
@$(COMPILE) -AZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
@$(COMPILE) -wAZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
################################################################################

View file

@ -17,6 +17,7 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/log/log.h"
#include "libc/mem/mem.h"
#include "libc/nexgen32e/gc.internal.h"
#include "libc/nexgen32e/nexgen32e.h"
#include "libc/runtime/gc.internal.h"

View file

@ -17,6 +17,7 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/nexgen32e/nexgen32e.h"
#include "libc/str/str.h"
#include "libc/testlib/testlib.h"
TEST(kBase36, test) {

View file

@ -17,6 +17,7 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/nexgen32e/nexgen32e.h"
#include "libc/str/str.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"

View file

@ -65,7 +65,7 @@ o/$(MODE)/test/libc/nexgen32e/stackrwx_test.com.ok: \
o/$(MODE)/tool/build/runit.com \
o/$(MODE)/tool/build/runitd.com \
o/$(MODE)/test/libc/nexgen32e/stackrwx_test.com
@$(COMPILE) -ATEST -tT$@ $^ $(filter-out openbsd,$(HOSTS))
@$(COMPILE) -ATEST -wtT$@ $^ $(filter-out openbsd,$(HOSTS))
$(TEST_LIBC_NEXGEN32E_OBJS): \
DEFAULT_CCFLAGS += \

View file

@ -17,6 +17,7 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/bits/bits.h"
#include "libc/errno.h"
#include "libc/log/check.h"
#include "libc/macros.internal.h"
#include "libc/mem/mem.h"

View file

@ -29,6 +29,7 @@
#include "libc/mem/mem.h"
#include "libc/nexgen32e/threaded.h"
#include "libc/rand/rand.h"
#include "libc/runtime/internal.h"
#include "libc/runtime/stack.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/clone.h"
@ -47,6 +48,11 @@
int ready;
volatile uint64_t A[THREADS * ENTRIES];
void SetUpOnce(void) {
__enable_threads();
ASSERT_SYS(0, 0, pledge("stdio", 0));
}
void OnChld(int sig) {
// do nothing
}

View file

@ -9,7 +9,7 @@ o/$(MODE)/test/libc/release/cosmopolitan.zip: \
o/$(MODE)/ape/ape-no-modify-self.o \
o/$(MODE)/cosmopolitan.a \
o/$(MODE)/third_party/zip/zip.com
@$(COMPILE) -AZIP -T$@ \
@$(COMPILE) -wAZIP -T$@ \
o/$(MODE)/third_party/zip/zip.com \
-qj $@ \
o/cosmopolitan.h \
@ -88,7 +88,7 @@ o/$(MODE)/test/libc/release/smoke-chibicc.o: \
test/libc/release/smoke.c \
o/cosmopolitan.h \
o/$(MODE)/third_party/chibicc/chibicc.com
@$(COMPILE) -ACHIBICC \
@$(COMPILE) -wACHIBICC \
o/$(MODE)/third_party/chibicc/chibicc.com \
$(CHIBICC_FLAGS) \
-o $@ \

View file

@ -18,7 +18,6 @@
*/
#include "libc/calls/calls.h"
#include "libc/calls/struct/sigaction.h"
#include "libc/errno.h"
#include "libc/intrin/kprintf.h"
#include "libc/mem/io.h"
#include "libc/runtime/runtime.h"
@ -41,8 +40,9 @@ void Extract(const char *from, const char *to, int mode) {
}
void SetUpOnce(void) {
pledge("stdio rpath wpath cpath tty proc exec", 0);
errno = 0;
ASSERT_SYS(0, 0,
pledge("stdio rpath wpath cpath tty proc exec prot_exec",
"stdio rpath prot_exec"));
// nothing to do if we're using elf
if (~SUPPORT_VECTOR & (WINDOWS | XNU)) {

View file

@ -24,8 +24,7 @@
void SetUpOnce(void) {
__tls_enabled = false;
pledge("stdio rpath", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath", 0));
}
TEST(arch_prctl, fs) {

View file

@ -50,8 +50,8 @@ int x, me, tid;
_Atomic(int) thechilde;
void SetUpOnce(void) {
pledge("stdio thread", 0);
errno = 0;
__enable_threads();
ASSERT_SYS(0, 0, pledge("stdio rpath", 0));
}
void *__initialize_tls(char tib[64]) {

View file

@ -30,8 +30,7 @@
#include "libc/testlib/testlib.h"
void SetUpOnce(void) {
pledge("stdio proc", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio proc", 0));
}
TEST(fork, testPipes) {

View file

@ -17,7 +17,6 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/calls.h"
#include "libc/errno.h"
#include "libc/intrin/kprintf.h"
#include "libc/limits.h"
#include "libc/log/check.h"
@ -32,8 +31,7 @@
{ x, y, 0, (y - x) * FRAMESIZE + FRAMESIZE }
void SetUpOnce(void) {
pledge("stdio rpath", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath", 0));
}
static bool AreMemoryIntervalsEqual(const struct MemoryIntervals *mm1,

View file

@ -23,7 +23,6 @@
#include "libc/calls/calls.h"
#include "libc/calls/ucontext.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/fmt/fmt.h"
#include "libc/intrin/kprintf.h"
#include "libc/linux/mmap.h"
@ -50,8 +49,7 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
pledge("stdio rpath wpath cpath proc", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath proc", 0));
}
TEST(mmap, zeroSize) {

View file

@ -27,6 +27,7 @@
#include "libc/runtime/gc.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/map.h"
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/prot.h"

View file

@ -21,6 +21,7 @@
#include "libc/calls/struct/sigaction.h"
#include "libc/calls/struct/siginfo.h"
#include "libc/calls/ucontext.h"
#include "libc/errno.h"
#include "libc/intrin/kprintf.h"
#include "libc/runtime/memtrack.internal.h"
#include "libc/runtime/runtime.h"

View file

@ -40,8 +40,7 @@
#include "tool/decode/lib/pollnames.h"
void SetUpOnce(void) {
pledge("stdio proc inet", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio proc inet", 0));
}
dontdiscard char *FormatPollFd(struct pollfd p[2]) {

View file

@ -24,8 +24,7 @@
#include "libc/time/time.h"
void SetUpOnce(void) {
pledge("stdio", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio", 0));
}
// TEST(select, allZero) {

View file

@ -33,8 +33,7 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
pledge("stdio rpath wpath cpath proc inet", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath proc inet", 0));
}
TEST(sendfile, test) {

View file

@ -22,6 +22,7 @@
#include "libc/runtime/gc.internal.h"
#include "libc/sock/sock.h"
#include "libc/sock/struct/msghdr.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/af.h"
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/sock.h"

View file

@ -18,6 +18,7 @@
*/
#include "libc/calls/calls.h"
#include "libc/calls/struct/timeval.h"
#include "libc/errno.h"
#include "libc/sock/sock.h"
#include "libc/sock/struct/sockaddr.h"
#include "libc/sysv/consts/af.h"
@ -28,8 +29,7 @@
#include "libc/testlib/testlib.h"
void SetUpOnce(void) {
pledge("stdio inet", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio inet", 0));
}
TEST(setsockopt, SO_RCVTIMEO) {

View file

@ -26,8 +26,7 @@
#include "libc/testlib/testlib.h"
void SetUpOnce(void) {
pledge("stdio tty", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio tty", 0));
}
TEST(socketpair, testAfUnixStream) {

View file

@ -25,6 +25,7 @@
#include "libc/runtime/runtime.h"
#include "libc/sock/sock.h"
#include "libc/sock/struct/sockaddr.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/af.h"
#include "libc/sysv/consts/so.h"
#include "libc/sysv/consts/sock.h"
@ -35,8 +36,7 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
pledge("stdio rpath cpath proc unix", 0);
errno = 0;
ASSERT_SYS(0, 0, pledge("stdio rpath cpath proc unix", 0));
}
void DatagramServer(void) {

View file

@ -23,12 +23,14 @@
#include "libc/intrin/kprintf.h"
#include "libc/intrin/spinlock.h"
#include "libc/intrin/wait0.internal.h"
#include "libc/macros.internal.h"
#include "libc/math.h"
#include "libc/mem/mem.h"
#include "libc/runtime/gc.internal.h"
#include "libc/runtime/internal.h"
#include "libc/runtime/stack.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/clone.h"
#include "libc/sysv/consts/map.h"
#include "libc/sysv/consts/prot.h"
@ -51,6 +53,11 @@ union Dub {
double x;
};
void SetUpOnce(void) {
__enable_threads();
ASSERT_SYS(0, 0, pledge("stdio", 0));
}
int Worker(void *p, int tid) {
int i;
char str[64];

View file

@ -18,7 +18,9 @@
*/
#include "libc/calls/calls.h"
#include "libc/runtime/internal.h"
#include "libc/stdio/lock.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"

View file

@ -19,6 +19,7 @@
#include "libc/mem/mem.h"
#include "libc/runtime/gc.internal.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/hyperion.h"
#include "libc/testlib/testlib.h"

View file

@ -25,6 +25,7 @@
#include "libc/runtime/gc.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/sig.h"
#include "libc/testlib/testlib.h"
#include "libc/time/time.h"

View file

@ -20,6 +20,7 @@
#include "libc/runtime/gc.internal.h"
#include "libc/stdio/iconv.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/testlib/testlib.h"
TEST(iconv, test) {

View file

@ -19,6 +19,7 @@
#include "libc/calls/calls.h"
#include "libc/mem/mem.h"
#include "libc/runtime/gc.internal.h"
#include "libc/runtime/internal.h"
#include "libc/stdio/stdio.h"
#include "libc/testlib/testlib.h"
#include "libc/thread/spawn.h"
@ -39,6 +40,11 @@ int Worker(void *arg, int tid) {
return 0;
}
void SetUpOnce(void) {
__enable_threads();
ASSERT_SYS(0, 0, pledge("stdio", 0));
}
TEST(memory, test) {
int i, n = 32;
struct spawn *t = gc(malloc(sizeof(struct spawn) * n));

View file

@ -20,6 +20,7 @@
#include "libc/calls/calls.h"
#include "libc/dce.h"
#include "libc/fmt/conv.h"
#include "libc/runtime/internal.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/spawn.h"
#include "libc/stdio/stdio.h"
@ -28,6 +29,13 @@
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"
void SetUpOnce(void) {
__enable_threads();
ASSERT_SYS(0, 0,
pledge("stdio rpath wpath cpath proc exec prot_exec",
"stdio rpath wpath cpath prot_exec"));
}
TEST(spawn, test) {
int rc, ws, pid;
char *prog = GetProgramExecutableName();
@ -76,13 +84,13 @@ const char kTinyLinuxExit[128] = {
0x6a, 0x2a, 0x5f, 0x6a, 0x3c, 0x58, 0x0f, 0x05, // j*_j<X☼♣
};
BENCH(spawn, bench) {
int fd;
if (IsLinux()) {
fd = open("/tmp/tiny64", O_CREAT | O_TRUNC | O_WRONLY, 0755);
write(fd, kTinyLinuxExit, 128);
close(fd);
EZBENCH2("spawn", donothing, BenchmarkProcessLifecycle());
unlink("/tmp/tiny64");
}
}
/* BENCH(spawn, bench) { */
/* int fd; */
/* if (IsLinux()) { */
/* fd = open("/tmp/tiny64", O_CREAT | O_TRUNC | O_WRONLY, 0755); */
/* write(fd, kTinyLinuxExit, 128); */
/* close(fd); */
/* EZBENCH2("spawn", donothing, BenchmarkProcessLifecycle()); */
/* unlink("/tmp/tiny64"); */
/* } */
/* } */

View file

@ -16,25 +16,15 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/calls.h"
#include "libc/errno.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h"
#include "libc/stdio/temp.h"
#include "libc/testlib/testlib.h"
char testlib_enable_tmp_setup_teardown;
TEST(tmpfile, test) {
FILE *f;
mkdir("doge", 0755);
setenv("TMPDIR", "doge", true);
ASSERT_NE(NULL, (f = tmpfile()));
FILE *f = tmpfile();
EXPECT_NE(-1, fputc('t', f));
EXPECT_NE(-1, fflush(f));
rewind(f);
EXPECT_EQ('t', fgetc(f));
EXPECT_NE(-1, fclose(f));
EXPECT_EQ(-1, rmdir("doge"));
EXPECT_EQ(ENOTEMPTY, errno);
}

View file

@ -17,6 +17,7 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/testlib/hyperion.h"
#include "libc/testlib/testlib.h"

View file

@ -18,7 +18,9 @@
*/
#include "libc/bits/bits.h"
#include "libc/intrin/kprintf.h"
#include "libc/mem/mem.h"
#include "libc/stdio/append.internal.h"
#include "libc/str/str.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"

View file

@ -28,7 +28,7 @@
void SetUpOnce(void) {
GetSymbolTable();
pledge("stdio", 0);
ASSERT_SYS(0, 0, pledge("stdio rpath", 0));
}
TEST(isutf8, good) {

View file

@ -24,6 +24,7 @@
#include "libc/macros.internal.h"
#include "libc/mem/mem.h"
#include "libc/runtime/gc.internal.h"
#include "libc/runtime/internal.h"
#include "libc/testlib/testlib.h"
#include "libc/thread/spawn.h"
#include "libc/thread/thread.h"
@ -32,8 +33,8 @@ _Atomic(int) itworked;
_Thread_local int var;
void SetUpOnce(void) {
pledge("stdio rpath thread", 0);
errno = 0;
__enable_threads();
ASSERT_SYS(0, 0, pledge("stdio", 0));
}
int Worker(void *arg, int tid) {

View file

@ -18,6 +18,7 @@
*/
#include "libc/fmt/fmt.h"
#include "libc/macros.internal.h"
#include "libc/mem/mem.h"
#include "libc/runtime/fenv.h"
#include "libc/runtime/gc.internal.h"
#include "libc/testlib/ezbench.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/runtime/gc.internal.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/hyperion.h"

View file

@ -16,7 +16,9 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/mem/mem.h"
#include "libc/runtime/gc.internal.h"
#include "libc/str/str.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"
#include "libc/x/x.h"