mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-22 01:22:19 +00:00
Stop using .com extension in monorepo
The WIN32 CreateProcess() function does not require an .exe or .com suffix in order to spawn an executable. Now that we have Cosmo bash we're no longer so dependent on the cmd.exe prompt.
This commit is contained in:
parent
c8383f25b4
commit
a6baba1b07
239 changed files with 2092 additions and 2244 deletions
|
@ -23,7 +23,7 @@
|
|||
* Changes permissions on file, e.g.:
|
||||
*
|
||||
* CHECK_NE(-1, chmod("foo/bar.txt", 0644));
|
||||
* CHECK_NE(-1, chmod("o/default/program.com", 0755));
|
||||
* CHECK_NE(-1, chmod("o/default/program", 0755));
|
||||
* CHECK_NE(-1, chmod("privatefolder/", 0700));
|
||||
*
|
||||
* The esoteric bits generally available on System Five are:
|
||||
|
|
|
@ -36,7 +36,7 @@ int sys_fchmodat2(int, const char *, unsigned, int);
|
|||
* Changes permissions on file, e.g.:
|
||||
*
|
||||
* CHECK_NE(-1, fchmodat(AT_FDCWD, "foo/bar.txt", 0644));
|
||||
* CHECK_NE(-1, fchmodat(AT_FDCWD, "o/default/program.com", 0755));
|
||||
* CHECK_NE(-1, fchmodat(AT_FDCWD, "o/default/program", 0755));
|
||||
* CHECK_NE(-1, fchmodat(AT_FDCWD, "privatefolder/", 0700));
|
||||
*
|
||||
* @param path must exist
|
||||
|
|
|
@ -118,6 +118,8 @@ static char *CopyWithCwd(const char *q, char *p, char *e) {
|
|||
|
||||
// if q exists then turn it into an absolute path. we also try adding
|
||||
// a .com suffix since the ape auto-appends it when resolving
|
||||
//
|
||||
// TODO(jart): is this still relevant?
|
||||
static int TryPath(const char *q, int com) {
|
||||
char *p;
|
||||
if (!(p = CopyWithCwd(q, g_prog.u.buf,
|
||||
|
|
|
@ -950,14 +950,14 @@ static const uint16_t kPledgeUnveil[] = {
|
|||
|
||||
// placeholder group
|
||||
//
|
||||
// pledge.com checks this to do auto-unveiling
|
||||
// pledge checks this to do auto-unveiling
|
||||
static const uint16_t kPledgeVminfo[] = {
|
||||
__NR_linux_sched_yield, //
|
||||
};
|
||||
|
||||
// placeholder group
|
||||
//
|
||||
// pledge.com uses this to auto-unveil /tmp and $TMPPATH with rwc
|
||||
// pledge uses this to auto-unveil /tmp and $TMPPATH with rwc
|
||||
// permissions. pledge() alone (without unveil() too) offers very
|
||||
// little security here. consider using them together.
|
||||
static const uint16_t kPledgeTmppath[] = {
|
||||
|
|
|
@ -163,7 +163,7 @@
|
|||
* interpreted, and ape binaries, you'll usually want `rpath` and
|
||||
* `prot_exec` too. With APE it's possible to work around this
|
||||
* requirement, by "assimilating" your binaries beforehand. See the
|
||||
* assimilate.com program and `--assimilate` flag which can be used to
|
||||
* assimilate program and `--assimilate` flag which can be used to
|
||||
* turn APE binaries into static native binaries.
|
||||
*
|
||||
* - "prot_exec" allows mmap(PROT_EXEC) and mprotect(PROT_EXEC). This is
|
||||
|
@ -176,13 +176,13 @@
|
|||
* calls on Linux.
|
||||
*
|
||||
* - "vminfo" OpenBSD defines this for programs like `top`. On Linux,
|
||||
* this is a placeholder group that lets tools like pledge.com check
|
||||
* this is a placeholder group that lets tools like pledge check
|
||||
* `__promises` and automatically unveil() a subset of files top would
|
||||
* need, e.g. /proc/stat, /proc/meminfo.
|
||||
*
|
||||
* - "tmppath" allows unlink, unlinkat, and lstat. This is mostly a
|
||||
* placeholder group for pledge.com, which reads the `__promises`
|
||||
* global to determine if /tmp and $TMPPATH should be unveiled.
|
||||
* placeholder group for pledge, which reads the `__promises` global
|
||||
* to determine if /tmp and $TMPPATH should be unveiled.
|
||||
*
|
||||
* `execpromises` only matters if "exec" is specified in `promises`. In
|
||||
* that case, this specifies the promises that'll apply once execve()
|
||||
|
|
|
@ -368,7 +368,7 @@ static textwindows int ProcessKeyEvent(const struct NtInputRecord *r, char *p) {
|
|||
// To use the tty mouse events feature:
|
||||
// - write(1, "\e[?1000;1002;1015;1006h") to enable
|
||||
// - write(1, "\e[?1000;1002;1015;1006l") to disable
|
||||
// See o//examples/ttyinfo.com and o//tool/viz/life.com
|
||||
// See o//examples/ttyinfo and o//tool/viz/life
|
||||
static textwindows int ProcessMouseEvent(const struct NtInputRecord *r,
|
||||
char *b) {
|
||||
char *p = b;
|
||||
|
|
|
@ -116,7 +116,6 @@ _start:
|
|||
9: .unreachable
|
||||
|
||||
// strongly link main() function (discarded by linker)
|
||||
// libc_runtime had to weakly link, due to package.com
|
||||
.section .yoink
|
||||
call main
|
||||
.previous
|
||||
|
@ -154,7 +153,6 @@ _start:
|
|||
.unreachable
|
||||
|
||||
// strongly link main() function (discarded by linker)
|
||||
// libc_runtime had to weakly link, due to package.com
|
||||
.section .yoink
|
||||
bl main
|
||||
.previous
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "libc/errno.h"
|
||||
#include "libc/intrin/asan.internal.h"
|
||||
#include "libc/intrin/atomic.h"
|
||||
#include "libc/serialize.h"
|
||||
#include "libc/intrin/cmpxchg.h"
|
||||
#include "libc/intrin/describebacktrace.internal.h"
|
||||
#include "libc/intrin/directmap.internal.h"
|
||||
|
@ -45,6 +44,7 @@
|
|||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/runtime/stack.h"
|
||||
#include "libc/runtime/symbols.internal.h"
|
||||
#include "libc/serialize.h"
|
||||
#include "libc/stdckdint.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/str/tab.internal.h"
|
||||
|
@ -767,7 +767,7 @@ static void __asan_report_memory_origin_image(intptr_t a, int z) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
kprintf("\tunknown please supply .com.dbg symbols or set COMDBG\n");
|
||||
kprintf("\tunknown please supply .dbg symbols or set COMDBG\n");
|
||||
}
|
||||
} else {
|
||||
kprintf("\tunknown please __static_yoink(\"GetSymbolTable\");\n");
|
||||
|
|
|
@ -97,7 +97,7 @@ __excep0_isr:
|
|||
xor %eax,%eax # kprintf is variadic, remember to
|
||||
# pass no. of vector regs. used (= 0)
|
||||
.weak kprintf # weakly link kprintf() because we
|
||||
ezlea kprintf,bx # want to keep life.com tiny
|
||||
ezlea kprintf,bx # want to keep examples/life tiny
|
||||
test %ebx,%ebx
|
||||
jz 8f
|
||||
call *%rbx # print error message
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
*
|
||||
* This handler (1) makes binaries smaller by not embedding source code;
|
||||
* and therefore (2) less likely to leak sensitive information. This can
|
||||
* still print backtraces with function names if the .com.dbg file is in
|
||||
* the same folder.
|
||||
* still print backtraces with function names if the .dbg file is in the
|
||||
* same folder.
|
||||
*
|
||||
* @see libc/log/thunks/__check_fail_ndebug.S
|
||||
*/
|
||||
|
|
|
@ -44,12 +44,12 @@
|
|||
*
|
||||
* delimited by spaces. For example, to see peak malloc usage:
|
||||
*
|
||||
* ./myprog.com 2>log
|
||||
* ./myprog 2>log
|
||||
* grep ^MEM log | sort -nk4 | tail -n10
|
||||
*
|
||||
* To see the largest allocations:
|
||||
*
|
||||
* ./myprog.com 2>log
|
||||
* ./myprog 2>log
|
||||
* grep ^MEM log | grep -v free | sort -nk7 | tail -n10
|
||||
*/
|
||||
|
||||
|
|
|
@ -25,12 +25,12 @@
|
|||
#include "libc/fmt/conv.h"
|
||||
#include "libc/fmt/itoa.h"
|
||||
#include "libc/fmt/magnumstrs.internal.h"
|
||||
#include "libc/serialize.h"
|
||||
#include "libc/intrin/getenv.internal.h"
|
||||
#include "libc/intrin/weaken.h"
|
||||
#include "libc/limits.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/serialize.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/lock.h"
|
||||
|
@ -986,7 +986,7 @@ int _cocmd(int argc, char **argv, char **envp) {
|
|||
size_t globCount = 0;
|
||||
int globFlags = 0;
|
||||
glob_t globTheBuilder;
|
||||
prog = argc > 0 ? argv[0] : "cocmd.com";
|
||||
prog = argc > 0 ? argv[0] : "cocmd";
|
||||
|
||||
for (i = 1; i < 32; ++i) {
|
||||
unsupported[i] = true;
|
||||
|
|
|
@ -53,23 +53,19 @@ static struct {
|
|||
} g_execve;
|
||||
|
||||
static bool IsApeFile(const char *path) {
|
||||
if (endswith(path, ".com")) {
|
||||
return true;
|
||||
} else {
|
||||
bool res = false;
|
||||
BLOCK_SIGNALS;
|
||||
BLOCK_CANCELATION;
|
||||
int fd;
|
||||
char buf[8];
|
||||
int flags = O_RDONLY | O_NOCTTY | O_NONBLOCK | O_CLOEXEC;
|
||||
if ((fd = sys_openat(AT_FDCWD, path, flags, 0)) != -1) {
|
||||
res = sys_pread(fd, buf, 8, 0, 0) == 8 && IsApeLoadable(buf);
|
||||
sys_close(fd);
|
||||
}
|
||||
ALLOW_CANCELATION;
|
||||
ALLOW_SIGNALS;
|
||||
return res;
|
||||
bool res = false;
|
||||
BLOCK_SIGNALS;
|
||||
BLOCK_CANCELATION;
|
||||
int fd;
|
||||
char buf[8];
|
||||
int flags = O_RDONLY | O_NOCTTY | O_NONBLOCK | O_CLOEXEC;
|
||||
if ((fd = sys_openat(AT_FDCWD, path, flags, 0)) != -1) {
|
||||
res = sys_pread(fd, buf, 8, 0, 0) == 8 && IsApeLoadable(buf);
|
||||
sys_close(fd);
|
||||
}
|
||||
ALLOW_CANCELATION;
|
||||
ALLOW_SIGNALS;
|
||||
return res;
|
||||
}
|
||||
|
||||
static const char *Join(const char *a, const char *b, char buf[PATH_MAX]) {
|
||||
|
|
|
@ -160,7 +160,7 @@ static void EfiInitAcpi(struct mman *mm, EFI_SYSTEM_TABLE *SystemTable) {
|
|||
* -net none \
|
||||
* -drive format=raw,file=fat:rw:o/tool/viz
|
||||
* FS0:
|
||||
* deathstar.com
|
||||
* deathstar
|
||||
*
|
||||
* @see libc/dce.h
|
||||
*/
|
||||
|
|
|
@ -88,7 +88,7 @@ static struct SymbolTable *GetSymbolTableFromZip(struct Zipos *zipos) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Reads symbol table from .com.dbg file.
|
||||
* Reads symbol table from .dbg file.
|
||||
* @note This code can't depend on dlmalloc()
|
||||
*/
|
||||
static struct SymbolTable *GetSymbolTableFromElf(void) {
|
||||
|
@ -109,11 +109,11 @@ static struct SymbolTable *GetSymbolTableFromElf(void) {
|
|||
* __static_yoink("__zipos_get");
|
||||
*
|
||||
* In that case, the symbol table may be read from `/zip/.symtab` which
|
||||
* is generated by `o//tool/build/symtab.com`. The second strategy is to
|
||||
* look for the concomitant `.com.dbg` executable, which may very well
|
||||
* be the one currently executing, or it could be placed in the same
|
||||
* folder as your `.com` binary, or lastly, it could be explicitly
|
||||
* specified via the `COMDBG` environment variable.
|
||||
* is generated by `o//tool/build/symtab`. The second strategy is to
|
||||
* look for the concomitant `.dbg` executable, which may very well be
|
||||
* the one currently executing, or it could be placed in the same folder
|
||||
* as your binary, or lastly, it could be explicitly specified via the
|
||||
* `COMDBG` environment variable.
|
||||
*
|
||||
* Function tracing is disabled throughout the duration of this call.
|
||||
* Backtraces and other core runtime functionality depend on this.
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#!/bin/sh
|
||||
[ -d libc/str ] || exit
|
||||
[ -x o//examples/curl.com ] || make -j8 o//examples/curl.com || exit
|
||||
[ -x o//tool/curl/curl ] || make -j8 o//tool/curl/curl || exit
|
||||
mkdir -p o/tmp/ || exit
|
||||
|
||||
shineget() {
|
||||
echo $2
|
||||
o//examples/curl.com $2 >o/tmp/$$ || exit
|
||||
o//tool/curl/curl $2 >o/tmp/$$ || exit
|
||||
mv o/tmp/$$ $1 || exit
|
||||
}
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@ COSMOPOLITAN_C_START_
|
|||
/**
|
||||
* Declares benchmark function.
|
||||
*
|
||||
* These only run if (1) the -b flag is passed to the FOO_test.com; and
|
||||
* (2) the unit tests passed. It's just an ordinary function, that gets
|
||||
* These only run if (1) the -b flag is passed to the FOO_test; and (2)
|
||||
* the unit tests passed. It's just an ordinary function, that gets
|
||||
* registered with the linker. It should print things to stdout.
|
||||
*
|
||||
* @see EZBENCH()
|
||||
|
|
|
@ -162,7 +162,7 @@ dontasan int main(int argc, char *argv[]) {
|
|||
// we're done!
|
||||
int status = MIN(255, g_testlib_failed);
|
||||
if (!status && IsRunningUnderMake()) {
|
||||
return 254; // compile.com considers this 0 and propagates output
|
||||
return 254; // compile considers this 0 and propagates output
|
||||
} else if (!status && _weaken(pthread_exit)) {
|
||||
_weaken(pthread_exit)(0);
|
||||
} else {
|
||||
|
|
|
@ -81,10 +81,10 @@ void testlib_runtestcases(const testfn_t *start, const testfn_t *end,
|
|||
// getpid() calls are inserted to help visually see tests in traces
|
||||
// which can be performed on Linux, FreeBSD, OpenBSD, and XNU:
|
||||
//
|
||||
// strace -f o/default/test.com |& less
|
||||
// truss o/default/test.com |& less
|
||||
// ktrace -f trace o/default/test.com </dev/null; kdump -f trace | less
|
||||
// dtruss o/default/test.com |& less
|
||||
// strace -f o/default/test |& less
|
||||
// truss o/default/test |& less
|
||||
// ktrace -f trace o/default/test </dev/null; kdump -f trace | less
|
||||
// dtruss o/default/test |& less
|
||||
//
|
||||
// Test cases are iterable via a decentralized section. Your TEST()
|
||||
// macro inserts .testcase.SUITENAME sections into the binary which
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue