mirror of
https://github.com/jart/cosmopolitan.git
synced 2026-11-09 02:39:44 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
450d9b1d43 | ||
|
|
69ba516466 | ||
|
|
9e9d2c0006 | ||
|
|
a0f599ce12 | ||
|
|
d95d61b1af | ||
|
|
f0bfabba07 | ||
|
|
7845495a93 | ||
|
|
d1a745c17c | ||
|
|
6556dd2673 | ||
|
|
14bf57180f | ||
|
|
9315ebbfd9 | ||
|
|
879bb84244 | ||
|
|
4b7ba9a4c5 | ||
|
|
26c70e08bf | ||
|
|
20938a45e6 | ||
|
|
7b3d7ee07b | ||
|
|
ff955aaa01 | ||
|
|
70155df7a9 | ||
|
|
2b960bb249 | ||
|
|
b7e1dc81c2 | ||
|
|
41c06c6325 | ||
|
|
4427581a05 | ||
|
|
96185e1ac0 | ||
|
|
ca5e361919 | ||
|
|
9cad66aa11 | ||
|
|
03de761890 | ||
|
|
43de12db55 | ||
|
|
fa20edc44d | ||
|
|
96f979dfc5 | ||
|
|
0bffd09433 | ||
|
|
cc5c5319bf |
No files matched your search
@@ -93,7 +93,7 @@ endif
|
||||
ifeq ($(TOOLCHAIN),) # if TOOLCHAIN isn't defined
|
||||
ifeq ("$(wildcard o/third_party/gcc/bin/x86_64-linux-cosmo-*)","") # if our gcc isn't unbundled
|
||||
ifneq ($(UNAME_M)-$(UNAME_S), x86_64-Linux) # if this is not amd64 linux
|
||||
$(error you need to download https://cosmo.zip/pub/cosmocc/cosmocc-0.0.18.zip and unzip it inside the cosmo directory)
|
||||
$(error please run tool/cosmocc/fetch.sh)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
@@ -123,6 +123,11 @@ o/$(MODE): \
|
||||
o/$(MODE)/examples \
|
||||
o/$(MODE)/third_party
|
||||
|
||||
# TODO(jart): Make Emacs `C-c C-c` shortcut not need this.
|
||||
.PHONY: o/$(MODE)/ o/$(MODE)/.
|
||||
o/$(MODE)/: o/$(MODE)
|
||||
o/$(MODE)/.: o/$(MODE)
|
||||
|
||||
# check if we're using o//third_party/make/make.com
|
||||
# we added sandboxing to guarantee cosmo's makefile is hermetic
|
||||
# it also shaves away 200ms of startup latency with native $(uniq)
|
||||
@@ -166,153 +171,153 @@ include build/definitions.mk # ├──META
|
||||
include build/config.mk # │ You can build
|
||||
include build/rules.mk # │ You can topologically order
|
||||
include build/online.mk #─┘
|
||||
include libc/nexgen32e/nexgen32e.mk #─┐
|
||||
include libc/sysv/sysv.mk # ├──SYSTEM SUPPORT
|
||||
include libc/nt/nt.mk # │ You can do math
|
||||
include libc/intrin/intrin.mk # │ You can use the stack
|
||||
include third_party/compiler_rt/compiler_rt.mk # │ You can manipulate arrays
|
||||
include libc/tinymath/tinymath.mk # │ You can issue raw system calls
|
||||
include libc/str/str.mk # │
|
||||
include third_party/xed/xed.mk # │
|
||||
include third_party/puff/puff.mk # │
|
||||
include libc/elf/elf.mk # │
|
||||
include ape/ape.mk # │
|
||||
include libc/fmt/fmt.mk # │
|
||||
include libc/vga/vga.mk # │
|
||||
include libc/irq/irq.mk #─┘
|
||||
include libc/calls/calls.mk #─┐
|
||||
include libc/irq/irq.mk # ├──SYSTEMS RUNTIME
|
||||
include third_party/nsync/nsync.mk # │ You can issue system calls
|
||||
include libc/runtime/runtime.mk # │
|
||||
include third_party/double-conversion/dc.mk # │
|
||||
include libc/crt/crt.mk # │
|
||||
include third_party/dlmalloc/dlmalloc.mk #─┘
|
||||
include libc/mem/mem.mk #─┐
|
||||
include third_party/gdtoa/gdtoa.mk # ├──DYNAMIC RUNTIME
|
||||
include third_party/nsync/mem/mem.mk # │ You can now use stdio
|
||||
include libc/proc/proc.mk # │ You can now use threads
|
||||
include libc/dlopen/dlopen.mk # │ You can now use processes
|
||||
include libc/thread/thread.mk # │ You can finally call malloc()
|
||||
include tool/hello/hello.mk # │
|
||||
include third_party/zlib/zlib.mk # │
|
||||
include libc/stdio/stdio.mk # │
|
||||
include libc/time/time.mk # │
|
||||
include net/net.mk # │
|
||||
include third_party/vqsort/vqsort.mk # │
|
||||
include libc/log/log.mk # │
|
||||
include third_party/getopt/getopt.mk # │
|
||||
include third_party/bzip2/bzip2.mk # │
|
||||
include dsp/core/core.mk # │
|
||||
include third_party/musl/musl.mk # │
|
||||
include libc/x/x.mk # │
|
||||
include third_party/stb/stb.mk # │
|
||||
include dsp/scale/scale.mk # │
|
||||
include dsp/mpeg/mpeg.mk # │
|
||||
include dsp/dsp.mk # │
|
||||
include third_party/zlib/gz/gz.mk # │
|
||||
include third_party/intel/intel.mk # │
|
||||
include third_party/aarch64/aarch64.mk # │
|
||||
include libc/libc.mk #─┘
|
||||
include libc/sock/sock.mk #─┐
|
||||
include dsp/tty/tty.mk # ├──ONLINE RUNTIME
|
||||
include libc/dns/dns.mk # │ You can communicate with the network
|
||||
include net/http/http.mk # │
|
||||
include third_party/mbedtls/mbedtls.mk # │
|
||||
include third_party/libcxx/libcxx.mk # │
|
||||
include third_party/ggml/ggml.mk # │
|
||||
include third_party/radpajama/radpajama.mk # │
|
||||
include net/https/https.mk # │
|
||||
include third_party/regex/regex.mk #─┘
|
||||
include third_party/tidy/tidy.mk
|
||||
include third_party/third_party.mk
|
||||
include third_party/nsync/testing/testing.mk
|
||||
include libc/testlib/testlib.mk
|
||||
include tool/viz/lib/vizlib.mk
|
||||
include tool/args/args.mk
|
||||
include test/posix/test.mk
|
||||
include test/tool/args/test.mk
|
||||
include third_party/linenoise/linenoise.mk
|
||||
include third_party/maxmind/maxmind.mk
|
||||
include net/finger/finger.mk
|
||||
include third_party/double-conversion/test/test.mk
|
||||
include third_party/lua/lua.mk
|
||||
include third_party/tree/tree.mk
|
||||
include third_party/zstd/zstd.mk
|
||||
include third_party/tr/tr.mk
|
||||
include third_party/sed/sed.mk
|
||||
include third_party/awk/awk.mk
|
||||
include third_party/hiredis/hiredis.mk
|
||||
include third_party/make/make.mk
|
||||
include third_party/ctags/ctags.mk
|
||||
include third_party/finger/finger.mk
|
||||
include third_party/argon2/argon2.mk
|
||||
include third_party/smallz4/smallz4.mk
|
||||
include third_party/sqlite3/sqlite3.mk
|
||||
include third_party/mbedtls/test/test.mk
|
||||
include third_party/quickjs/quickjs.mk
|
||||
include third_party/lz4cli/lz4cli.mk
|
||||
include third_party/zip/zip.mk
|
||||
include third_party/xxhash/xxhash.mk
|
||||
include third_party/unzip/unzip.mk
|
||||
include tool/build/lib/buildlib.mk
|
||||
include third_party/chibicc/chibicc.mk
|
||||
include third_party/chibicc/test/test.mk
|
||||
include third_party/python/python.mk
|
||||
include tool/build/build.mk
|
||||
include tool/curl/curl.mk
|
||||
include third_party/qemu/qemu.mk
|
||||
include examples/examples.mk
|
||||
include examples/pyapp/pyapp.mk
|
||||
include examples/pylife/pylife.mk
|
||||
include tool/decode/lib/decodelib.mk
|
||||
include tool/decode/decode.mk
|
||||
include tool/lambda/lib/lib.mk
|
||||
include tool/lambda/lambda.mk
|
||||
include tool/plinko/lib/lib.mk
|
||||
include tool/plinko/plinko.mk
|
||||
include test/tool/plinko/test.mk
|
||||
include tool/net/net.mk
|
||||
include tool/viz/viz.mk
|
||||
include tool/tool.mk
|
||||
include net/turfwar/turfwar.mk
|
||||
include test/libc/tinymath/test.mk
|
||||
include test/libc/intrin/test.mk
|
||||
include test/libc/mem/test.mk
|
||||
include test/libc/nexgen32e/test.mk
|
||||
include test/libc/runtime/test.mk
|
||||
include test/libc/thread/test.mk
|
||||
include test/libc/sock/test.mk
|
||||
include test/libc/str/test.mk
|
||||
include test/libc/log/test.mk
|
||||
include test/libc/str/test.mk
|
||||
include test/libc/calls/test.mk
|
||||
include test/libc/x/test.mk
|
||||
include test/libc/xed/test.mk
|
||||
include test/libc/fmt/test.mk
|
||||
include test/libc/dns/test.mk
|
||||
include test/libc/time/test.mk
|
||||
include test/libc/proc/test.mk
|
||||
include test/libc/stdio/test.mk
|
||||
include test/libc/release/test.mk
|
||||
include test/libc/test.mk
|
||||
include test/net/http/test.mk
|
||||
include test/net/https/test.mk
|
||||
include test/net/finger/test.mk
|
||||
include test/net/test.mk
|
||||
include test/tool/build/lib/test.mk
|
||||
include test/tool/build/test.mk
|
||||
include test/tool/viz/lib/test.mk
|
||||
include test/tool/viz/test.mk
|
||||
include test/tool/net/test.mk
|
||||
include test/tool/test.mk
|
||||
include test/dsp/core/test.mk
|
||||
include test/dsp/scale/test.mk
|
||||
include test/dsp/tty/test.mk
|
||||
include test/dsp/test.mk
|
||||
include examples/package/lib/build.mk
|
||||
include examples/package/build.mk
|
||||
include libc/nexgen32e/BUILD.mk #─┐
|
||||
include libc/sysv/BUILD.mk # ├──SYSTEM SUPPORT
|
||||
include libc/nt/BUILD.mk # │ You can do math
|
||||
include libc/intrin/BUILD.mk # │ You can use the stack
|
||||
include third_party/compiler_rt/BUILD.mk # │ You can manipulate arrays
|
||||
include libc/tinymath/BUILD.mk # │ You can issue raw system calls
|
||||
include libc/str/BUILD.mk # │
|
||||
include third_party/xed/BUILD.mk # │
|
||||
include third_party/puff/BUILD.mk # │
|
||||
include libc/elf/BUILD.mk # │
|
||||
include ape/BUILD.mk # │
|
||||
include libc/fmt/BUILD.mk # │
|
||||
include libc/vga/BUILD.mk # │
|
||||
include libc/irq/BUILD.mk #─┘
|
||||
include libc/calls/BUILD.mk #─┐
|
||||
include libc/irq/BUILD.mk # ├──SYSTEMS RUNTIME
|
||||
include third_party/nsync/BUILD.mk # │ You can issue system calls
|
||||
include libc/runtime/BUILD.mk # │
|
||||
include third_party/double-conversion/BUILD.mk # │
|
||||
include libc/crt/BUILD.mk # │
|
||||
include third_party/dlmalloc/BUILD.mk #─┘
|
||||
include libc/mem/BUILD.mk #─┐
|
||||
include third_party/gdtoa/BUILD.mk # ├──DYNAMIC RUNTIME
|
||||
include third_party/nsync/mem/BUILD.mk # │ You can now use stdio
|
||||
include libc/proc/BUILD.mk # │ You can now use threads
|
||||
include libc/dlopen/BUILD.mk # │ You can now use processes
|
||||
include libc/thread/BUILD.mk # │ You can finally call malloc()
|
||||
include tool/hello/BUILD.mk # │
|
||||
include third_party/zlib/BUILD.mk # │
|
||||
include libc/stdio/BUILD.mk # │
|
||||
include libc/time/BUILD.mk # │
|
||||
include net/BUILD.mk # │
|
||||
include third_party/vqsort/BUILD.mk # │
|
||||
include libc/log/BUILD.mk # │
|
||||
include third_party/getopt/BUILD.mk # │
|
||||
include third_party/bzip2/BUILD.mk # │
|
||||
include dsp/core/BUILD.mk # │
|
||||
include third_party/musl/BUILD.mk # │
|
||||
include libc/x/BUILD.mk # │
|
||||
include third_party/stb/BUILD.mk # │
|
||||
include dsp/scale/BUILD.mk # │
|
||||
include dsp/mpeg/BUILD.mk # │
|
||||
include dsp/BUILD.mk # │
|
||||
include third_party/zlib/gz/BUILD.mk # │
|
||||
include third_party/intel/BUILD.mk # │
|
||||
include third_party/aarch64/BUILD.mk # │
|
||||
include libc/BUILD.mk #─┘
|
||||
include libc/sock/BUILD.mk #─┐
|
||||
include dsp/tty/BUILD.mk # ├──ONLINE RUNTIME
|
||||
include libc/dns/BUILD.mk # │ You can communicate with the network
|
||||
include net/http/BUILD.mk # │
|
||||
include third_party/mbedtls/BUILD.mk # │
|
||||
include third_party/libcxx/BUILD.mk # │
|
||||
include third_party/ggml/BUILD.mk # │
|
||||
include third_party/radpajama/BUILD.mk # │
|
||||
include net/https/BUILD.mk # │
|
||||
include third_party/regex/BUILD.mk #─┘
|
||||
include third_party/tidy/BUILD.mk
|
||||
include third_party/BUILD.mk
|
||||
include third_party/nsync/testing/BUILD.mk
|
||||
include libc/testlib/BUILD.mk
|
||||
include tool/viz/lib/BUILD.mk
|
||||
include tool/args/BUILD.mk
|
||||
include test/posix/BUILD.mk
|
||||
include test/tool/args/BUILD.mk
|
||||
include third_party/linenoise/BUILD.mk
|
||||
include third_party/maxmind/BUILD.mk
|
||||
include net/finger/BUILD.mk
|
||||
include third_party/double-conversion/test/BUILD.mk
|
||||
include third_party/lua/BUILD.mk
|
||||
include third_party/tree/BUILD.mk
|
||||
include third_party/zstd/BUILD.mk
|
||||
include third_party/tr/BUILD.mk
|
||||
include third_party/sed/BUILD.mk
|
||||
include third_party/awk/BUILD.mk
|
||||
include third_party/hiredis/BUILD.mk
|
||||
include third_party/make/BUILD.mk
|
||||
include third_party/ctags/BUILD.mk
|
||||
include third_party/finger/BUILD.mk
|
||||
include third_party/argon2/BUILD.mk
|
||||
include third_party/smallz4/BUILD.mk
|
||||
include third_party/sqlite3/BUILD.mk
|
||||
include third_party/mbedtls/test/BUILD.mk
|
||||
include third_party/quickjs/BUILD.mk
|
||||
include third_party/lz4cli/BUILD.mk
|
||||
include third_party/zip/BUILD.mk
|
||||
include third_party/xxhash/BUILD.mk
|
||||
include third_party/unzip/BUILD.mk
|
||||
include tool/build/lib/BUILD.mk
|
||||
include third_party/chibicc/BUILD.mk
|
||||
include third_party/chibicc/test/BUILD.mk
|
||||
include third_party/python/BUILD.mk
|
||||
include tool/build/BUILD.mk
|
||||
include tool/curl/BUILD.mk
|
||||
include third_party/qemu/BUILD.mk
|
||||
include examples/BUILD.mk
|
||||
include examples/pyapp/BUILD.mk
|
||||
include examples/pylife/BUILD.mk
|
||||
include tool/decode/lib/BUILD.mk
|
||||
include tool/decode/BUILD.mk
|
||||
include tool/lambda/lib/BUILD.mk
|
||||
include tool/lambda/BUILD.mk
|
||||
include tool/plinko/lib/BUILD.mk
|
||||
include tool/plinko/BUILD.mk
|
||||
include test/tool/plinko/BUILD.mk
|
||||
include tool/net/BUILD.mk
|
||||
include tool/viz/BUILD.mk
|
||||
include tool/BUILD.mk
|
||||
include net/turfwar/BUILD.mk
|
||||
include test/libc/tinymath/BUILD.mk
|
||||
include test/libc/intrin/BUILD.mk
|
||||
include test/libc/mem/BUILD.mk
|
||||
include test/libc/nexgen32e/BUILD.mk
|
||||
include test/libc/runtime/BUILD.mk
|
||||
include test/libc/thread/BUILD.mk
|
||||
include test/libc/sock/BUILD.mk
|
||||
include test/libc/str/BUILD.mk
|
||||
include test/libc/log/BUILD.mk
|
||||
include test/libc/str/BUILD.mk
|
||||
include test/libc/calls/BUILD.mk
|
||||
include test/libc/x/BUILD.mk
|
||||
include test/libc/xed/BUILD.mk
|
||||
include test/libc/fmt/BUILD.mk
|
||||
include test/libc/dns/BUILD.mk
|
||||
include test/libc/time/BUILD.mk
|
||||
include test/libc/proc/BUILD.mk
|
||||
include test/libc/stdio/BUILD.mk
|
||||
include test/libc/release/BUILD.mk
|
||||
include test/libc/BUILD.mk
|
||||
include test/net/http/BUILD.mk
|
||||
include test/net/https/BUILD.mk
|
||||
include test/net/finger/BUILD.mk
|
||||
include test/net/BUILD.mk
|
||||
include test/tool/build/lib/BUILD.mk
|
||||
include test/tool/build/BUILD.mk
|
||||
include test/tool/viz/lib/BUILD.mk
|
||||
include test/tool/viz/BUILD.mk
|
||||
include test/tool/net/BUILD.mk
|
||||
include test/tool/BUILD.mk
|
||||
include test/dsp/core/BUILD.mk
|
||||
include test/dsp/scale/BUILD.mk
|
||||
include test/dsp/tty/BUILD.mk
|
||||
include test/dsp/BUILD.mk
|
||||
include examples/package/lib/BUILD.mk
|
||||
include examples/package/BUILD.mk
|
||||
#-φ-examples/package/new.sh
|
||||
include test/test.mk
|
||||
include test/BUILD.mk
|
||||
|
||||
OBJS = $(foreach x,$(PKGS),$($(x)_OBJS))
|
||||
SRCS := $(foreach x,$(PKGS),$($(x)_SRCS))
|
||||
|
||||
@@ -221,6 +221,7 @@ You can fix that by registering APE with `binfmt_misc`:
|
||||
|
||||
```sh
|
||||
sudo wget -O /usr/bin/ape https://cosmo.zip/pub/cosmos/bin/ape-$(uname -m).elf
|
||||
sudo chmod +x /usr/bin/ape
|
||||
sudo sh -c "echo ':APE:M::MZqFpD::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register"
|
||||
sudo sh -c "echo ':APE-jart:M::jartsr::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register"
|
||||
```
|
||||
|
||||
@@ -46,7 +46,6 @@ o/$(MODE)/ape: $(APE)
|
||||
o/$(MODE)/ape/aarch64.lds: \
|
||||
ape/aarch64.lds \
|
||||
libc/zip.internal.h \
|
||||
libc/intrin/bits.h \
|
||||
libc/thread/tls.h \
|
||||
libc/calls/struct/timespec.h \
|
||||
libc/macros.internal.h \
|
||||
@@ -274,7 +273,6 @@ o/$(MODE)/ape/ape.lds: \
|
||||
ape/macros.internal.h \
|
||||
ape/relocations.h \
|
||||
ape/ape.internal.h \
|
||||
libc/intrin/bits.h \
|
||||
libc/thread/tls.h \
|
||||
libc/calls/struct/timespec.h \
|
||||
libc/thread/thread.h \
|
||||
@@ -1,6 +1,5 @@
|
||||
#ifndef COSMOPOLITAN_APE_SECTIONS_INTERNAL_H_
|
||||
#define COSMOPOLITAN_APE_SECTIONS_INTERNAL_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
extern const char __comment_start[] __attribute__((__weak__));
|
||||
@@ -25,5 +24,4 @@ extern uint8_t __bss_start[] __attribute__((__weak__));
|
||||
extern uint8_t __bss_end[] __attribute__((__weak__));
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_APE_SECTIONS_INTERNAL_H_ */
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -228,6 +228,27 @@ PYFLAGS += \
|
||||
-O2 \
|
||||
-B
|
||||
endif
|
||||
ifeq ($(MODE), x86_64-tiny)
|
||||
CONFIG_CPPFLAGS += \
|
||||
-DTINY \
|
||||
-DNDEBUG \
|
||||
-DTRUSTWORTHY
|
||||
CONFIG_CCFLAGS += \
|
||||
-Os \
|
||||
-fno-align-functions \
|
||||
-fno-align-jumps \
|
||||
-fno-align-labels \
|
||||
-fno-align-loops \
|
||||
-fschedule-insns2 \
|
||||
-momit-leaf-frame-pointer \
|
||||
-foptimize-sibling-calls \
|
||||
-DDWARFLESS
|
||||
TARGET_ARCH ?= \
|
||||
-msse3
|
||||
PYFLAGS += \
|
||||
-O2 \
|
||||
-B
|
||||
endif
|
||||
ifeq ($(MODE), aarch64-tiny)
|
||||
# TODO(jart): -mcmodel=tiny
|
||||
CONFIG_CPPFLAGS += \
|
||||
|
||||
@@ -92,6 +92,8 @@ ARCH = x86_64
|
||||
HOSTS ?= freebsd rhel7 xnu win10 openbsd netbsd
|
||||
endif
|
||||
|
||||
ZIPOBJ_FLAGS += -a$(ARCH)
|
||||
|
||||
ifeq ($(PREFIX),)
|
||||
ifeq ($(USE_SYSTEM_TOOLCHAIN),)
|
||||
ifeq ($(ARCH),x86_64)
|
||||
|
||||
File renamed without changes.
@@ -55,7 +55,7 @@ DSP_CORE_SRCS = $(foreach x,$(DSP_CORE_ARTIFACTS),$($(x)_SRCS))
|
||||
DSP_CORE_HDRS = $(foreach x,$(DSP_CORE_ARTIFACTS),$($(x)_HDRS))
|
||||
DSP_CORE_CHECKS = $(foreach x,$(DSP_CORE_ARTIFACTS),$($(x)_CHECKS))
|
||||
DSP_CORE_OBJS = $(foreach x,$(DSP_CORE_ARTIFACTS),$($(x)_OBJS))
|
||||
$(DSP_CORE_OBJS): $(BUILD_FILES) dsp/core/core.mk
|
||||
$(DSP_CORE_OBJS): $(BUILD_FILES) dsp/core/BUILD.mk
|
||||
|
||||
.PHONY: o/$(MODE)/dsp/core
|
||||
o/$(MODE)/dsp/core: $(DSP_CORE_CHECKS)
|
||||
@@ -1,6 +1,5 @@
|
||||
#ifndef COSMOPOLITAN_DSP_CORE_C11_H_
|
||||
#define COSMOPOLITAN_DSP_CORE_C11_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
|
||||
/**
|
||||
* Fixed-point 8-bit rounded mean kernel.
|
||||
@@ -17,5 +16,4 @@ __funline unsigned char C11(unsigned char al, unsigned char bl) {
|
||||
return al;
|
||||
}
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_CORE_C11_H_ */
|
||||
@@ -1,6 +1,5 @@
|
||||
#ifndef COSMOPOLITAN_DSP_CORE_C121_H_
|
||||
#define COSMOPOLITAN_DSP_CORE_C121_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
__funline unsigned char C121(unsigned char al, unsigned char bl,
|
||||
@@ -16,5 +15,4 @@ __funline unsigned char C121(unsigned char al, unsigned char bl,
|
||||
}
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_CORE_C121_H_ */
|
||||
@@ -1,6 +1,5 @@
|
||||
#ifndef COSMOPOLITAN_DSP_CORE_C121S_H_
|
||||
#define COSMOPOLITAN_DSP_CORE_C121S_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
|
||||
__funline signed char C121S(signed char al, signed char bl, signed char cl) {
|
||||
short ax;
|
||||
@@ -13,5 +12,4 @@ __funline signed char C121S(signed char al, signed char bl, signed char cl) {
|
||||
return ax;
|
||||
}
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_CORE_C121S_H_ */
|
||||
@@ -1,6 +1,5 @@
|
||||
#ifndef COSMOPOLITAN_DSP_CORE_C1331_H_
|
||||
#define COSMOPOLITAN_DSP_CORE_C1331_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
|
||||
/**
|
||||
* Byte sized kernel for resampling memory in half.
|
||||
@@ -24,5 +23,4 @@ __funline unsigned char C1331(unsigned char al, unsigned char bl,
|
||||
return al;
|
||||
}
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_CORE_C1331_H_ */
|
||||
@@ -1,6 +1,5 @@
|
||||
#ifndef COSMOPOLITAN_DSP_CORE_C1331S_H_
|
||||
#define COSMOPOLITAN_DSP_CORE_C1331S_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
|
||||
/**
|
||||
* Byte sized kernel for resampling difference samples in half.
|
||||
@@ -22,5 +21,4 @@ __funline signed char C1331S(signed char al, signed char bl, signed char cl,
|
||||
return ax;
|
||||
}
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_CORE_C1331S_H_ */
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef COSMOPOLITAN_DSP_CORE_C161_H_
|
||||
#define COSMOPOLITAN_DSP_CORE_C161_H_
|
||||
#include "libc/macros.internal.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
|
||||
#define EXTRA_SHARP 2
|
||||
|
||||
@@ -28,5 +27,4 @@ __funline unsigned char C161(unsigned char al, unsigned char bl,
|
||||
return MIN(255, MAX(0, ax));
|
||||
}
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_CORE_C161_H_ */
|
||||
@@ -2,7 +2,6 @@
|
||||
#define COSMOPOLITAN_DSP_CORE_C161S_H_
|
||||
#include "dsp/core/c161.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
|
||||
__funline signed char C161S(signed char al, signed char bl, signed char cl) {
|
||||
short ax, bx, cx;
|
||||
@@ -20,5 +19,4 @@ __funline signed char C161S(signed char al, signed char bl, signed char cl) {
|
||||
return al;
|
||||
}
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_CORE_C161S_H_ */
|
||||
@@ -1,6 +1,5 @@
|
||||
#ifndef COSMOPOLITAN_DSP_CORE_C331_H_
|
||||
#define COSMOPOLITAN_DSP_CORE_C331_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
/**
|
||||
@@ -25,5 +24,4 @@ __funline unsigned char C331(unsigned char al, unsigned char bl,
|
||||
}
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_CORE_C331_H_ */
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef COSMOPOLITAN_DSP_CORE_GAMMA_H_
|
||||
#define COSMOPOLITAN_DSP_CORE_GAMMA_H_
|
||||
#include "libc/math.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
|
||||
#define COMPANDLUMA(X, ...) COMPANDLUMA_(X, __VA_ARGS__)
|
||||
#define COMPANDLUMA_(X, K1, K2, K3, K4) \
|
||||
@@ -19,5 +18,4 @@
|
||||
#define COMPANDLUMA_BT1886(X) COMPANDLUMA(X, COMPANDLUMA_BT1886_MAGNUM)
|
||||
#define UNCOMPANDLUMA_BT1886(X) UNCOMPANDLUMA(X, COMPANDLUMA_BT1886_MAGNUM)
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_CORE_GAMMA_H_ */
|
||||
@@ -1,12 +1,10 @@
|
||||
#ifndef COSMOPOLITAN_DSP_CORE_HALF_H_
|
||||
#define COSMOPOLITAN_DSP_CORE_HALF_H_
|
||||
#include "libc/macros.internal.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
|
||||
/**
|
||||
* Divides integer in half w/ rounding.
|
||||
*/
|
||||
#define HALF(X) (((X) + 1) / 2)
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_CORE_HALF_H_ */
|
||||
@@ -1,6 +1,5 @@
|
||||
#ifndef COSMOPOLITAN_DSP_CORE_ILLUMINANT_H_
|
||||
#define COSMOPOLITAN_DSP_CORE_ILLUMINANT_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
extern const double kBradford[3][3];
|
||||
@@ -27,5 +26,4 @@ void *GetChromaticAdaptationMatrix(double[3][3], const double[3],
|
||||
const double[3]);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_CORE_ILLUMINANT_H_ */
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef COSMOPOLITAN_DSP_CORE_ITUROUND_H_
|
||||
#define COSMOPOLITAN_DSP_CORE_ITUROUND_H_
|
||||
#include "libc/math.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
|
||||
/**
|
||||
* An ITU recommended rounding function.
|
||||
@@ -19,5 +18,4 @@ __funline int ituroundf(float x) {
|
||||
return floorf(x + .5f);
|
||||
}
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_CORE_ITUROUND_H_ */
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef COSMOPOLITAN_DSP_CORE_KS8_H_
|
||||
#define COSMOPOLITAN_DSP_CORE_KS8_H_
|
||||
#include "libc/macros.internal.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
|
||||
/**
|
||||
* Performs 16-bit scaled rounded madd w/ eight coefficients or fewer.
|
||||
@@ -43,5 +42,4 @@
|
||||
x1; \
|
||||
})
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_CORE_KS8_H_ */
|
||||
@@ -2,7 +2,6 @@
|
||||
#define COSMOPOLITAN_DSP_CORE_KSS8_H_
|
||||
#include "libc/limits.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
|
||||
/**
|
||||
* Performs 16-bit scaled rounded saturated madd w/ eight coefficients or fewer.
|
||||
@@ -39,5 +38,4 @@
|
||||
x1; \
|
||||
})
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_CORE_KSS8_H_ */
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "libc/limits.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/math.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
|
||||
/**
|
||||
* @fileoverview Fixed point arithmetic macros.
|
||||
@@ -23,5 +22,4 @@ long GetIntegerCoefficients(long[static 6], const double[static 6], long, long,
|
||||
long GetIntegerCoefficients8(long[static 8], const double[static 8], long, long,
|
||||
long);
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_CORE_Q_H_ */
|
||||
@@ -17,7 +17,6 @@
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "dsp/core/core.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/intrin/safemacros.internal.h"
|
||||
#include "libc/limits.h"
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#ifndef COSMOPOLITAN_DSP_CORE_TWIXT8_H_
|
||||
#define COSMOPOLITAN_DSP_CORE_TWIXT8_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
/**
|
||||
@@ -19,5 +18,4 @@ __funline unsigned char twixt8(unsigned char al, unsigned char bl,
|
||||
}
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_CORE_TWIXT8_H_ */
|
||||
@@ -59,7 +59,7 @@ DSP_MPEG_SRCS = $(foreach x,$(DSP_MPEG_ARTIFACTS),$($(x)_SRCS))
|
||||
DSP_MPEG_HDRS = $(foreach x,$(DSP_MPEG_ARTIFACTS),$($(x)_HDRS))
|
||||
DSP_MPEG_CHECKS = $(foreach x,$(DSP_MPEG_ARTIFACTS),$($(x)_CHECKS))
|
||||
DSP_MPEG_OBJS = $(foreach x,$(DSP_MPEG_ARTIFACTS),$($(x)_OBJS))
|
||||
$(DSP_MPEG_OBJS): $(BUILD_FILES) dsp/mpeg/mpeg.mk
|
||||
$(DSP_MPEG_OBJS): $(BUILD_FILES) dsp/mpeg/BUILD.mk
|
||||
|
||||
.PHONY: o/$(MODE)/dsp/mpeg
|
||||
o/$(MODE)/dsp/mpeg: $(DSP_MPEG_CHECKS)
|
||||
@@ -1,6 +1,5 @@
|
||||
#ifndef COSMOPOLITAN_DSP_MPEG_BLOCKSET_H_
|
||||
#define COSMOPOLITAN_DSP_MPEG_BLOCKSET_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
|
||||
#define PLM_BLOCK_SET(DEST, DEST_INDEX, DEST_WIDTH, SOURCE_INDEX, \
|
||||
SOURCE_WIDTH, BLOCK_SIZE, OP) \
|
||||
@@ -18,5 +17,4 @@
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_MPEG_BLOCKSET_H_ */
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef COSMOPOLITAN_DSP_MPEG_BUFFER_H_
|
||||
#define COSMOPOLITAN_DSP_MPEG_BUFFER_H_
|
||||
#include "dsp/mpeg/mpeg.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
struct FILE;
|
||||
@@ -159,5 +158,4 @@ forceinline uint16_t plm_buffer_read_vlc_uint(plm_buffer_t *self,
|
||||
}
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_MPEG_BUFFER_H_ */
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef COSMOPOLITAN_DSP_MPEG_DEMUX_H_
|
||||
#define COSMOPOLITAN_DSP_MPEG_DEMUX_H_
|
||||
#include "dsp/mpeg/mpeg.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
#define START_PACK 0xBA
|
||||
@@ -27,5 +26,4 @@ plm_packet_t *plm_demux_decode_packet(plm_demux_t *self, int start_code);
|
||||
plm_packet_t *plm_demux_get_packet(plm_demux_t *self);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_MPEG_DEMUX_H_ */
|
||||
@@ -1,10 +1,8 @@
|
||||
#ifndef COSMOPOLITAN_DSP_MPEG_IDCT_H_
|
||||
#define COSMOPOLITAN_DSP_MPEG_IDCT_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
void plm_video_idct(int *);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_MPEG_IDCT_H_ */
|
||||
@@ -1,6 +1,5 @@
|
||||
#ifndef COSMOPOLITAN_DSP_MPEG_MPEG_H_
|
||||
#define COSMOPOLITAN_DSP_MPEG_MPEG_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
struct FILE;
|
||||
@@ -446,5 +445,4 @@ plm_samples_t *plm_audio_decode(plm_audio_t *self);
|
||||
extern long plmpegdecode_latency_;
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_MPEG_MPEG_H_ */
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef COSMOPOLITAN_DSP_MPEG_VIDEO_H_
|
||||
#define COSMOPOLITAN_DSP_MPEG_VIDEO_H_
|
||||
#include "dsp/mpeg/mpeg.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
typedef struct {
|
||||
@@ -58,5 +57,4 @@ void plm_video_process_macroblock_16(plm_video_t *, uint8_t *restrict,
|
||||
uint8_t *restrict, int, int, bool);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_MPEG_VIDEO_H_ */
|
||||
@@ -58,7 +58,7 @@ DSP_SCALE_SRCS = $(foreach x,$(DSP_SCALE_ARTIFACTS),$($(x)_SRCS))
|
||||
DSP_SCALE_HDRS = $(foreach x,$(DSP_SCALE_ARTIFACTS),$($(x)_HDRS))
|
||||
DSP_SCALE_CHECKS = $(foreach x,$(DSP_SCALE_ARTIFACTS),$($(x)_CHECKS))
|
||||
DSP_SCALE_OBJS = $(foreach x,$(DSP_SCALE_ARTIFACTS),$($(x)_OBJS))
|
||||
$(DSP_SCALE_OBJS): $(BUILD_FILES) dsp/scale/scale.mk
|
||||
$(DSP_SCALE_OBJS): $(BUILD_FILES) dsp/scale/BUILD.mk
|
||||
|
||||
.PHONY: o/$(MODE)/dsp/scale
|
||||
o/$(MODE)/dsp/scale: $(DSP_SCALE_CHECKS)
|
||||
@@ -1,11 +1,9 @@
|
||||
#ifndef COSMOPOLITAN_DSP_SCALE_CDECIMATE2XUINT8X8_H_
|
||||
#define COSMOPOLITAN_DSP_SCALE_CDECIMATE2XUINT8X8_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
void *cDecimate2xUint8x8(unsigned long n, unsigned char[n],
|
||||
const signed char[8]);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_SCALE_CDECIMATE2XUINT8X8_H_ */
|
||||
@@ -1,6 +1,5 @@
|
||||
#ifndef COSMOPOLITAN_DSP_SCALE_SCALE_H_
|
||||
#define COSMOPOLITAN_DSP_SCALE_SCALE_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
extern long gyarados_latency_;
|
||||
@@ -33,5 +32,4 @@ void *EzGyarados(long, long, long, void *, long, long, long, const void *, long,
|
||||
long, long, long, long, long, double, double, double, double);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_SCALE_SCALE_H_ */
|
||||
@@ -67,7 +67,7 @@ DSP_TTY_SRCS = $(foreach x,$(DSP_TTY_ARTIFACTS),$($(x)_SRCS))
|
||||
DSP_TTY_HDRS = $(foreach x,$(DSP_TTY_ARTIFACTS),$($(x)_HDRS))
|
||||
DSP_TTY_CHECKS = $(foreach x,$(DSP_TTY_ARTIFACTS),$($(x)_CHECKS))
|
||||
DSP_TTY_OBJS = $(foreach x,$(DSP_TTY_ARTIFACTS),$($(x)_OBJS))
|
||||
$(DSP_TTY_OBJS): $(BUILD_FILES) dsp/tty/tty.mk
|
||||
$(DSP_TTY_OBJS): $(BUILD_FILES) dsp/tty/BUILD.mk
|
||||
|
||||
.PHONY: o/$(MODE)/dsp/tty
|
||||
o/$(MODE)/dsp/tty: $(DSP_TTY_CHECKS)
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "dsp/tty/quant.h"
|
||||
#include "dsp/tty/ttyrgb.h"
|
||||
#include "third_party/intel/xmmintrin.internal.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
struct TtyRgb rgb2tty24f_(ttyrgb_m128);
|
||||
@@ -30,5 +29,4 @@ char *setbgfg24_(char *, struct TtyRgb, struct TtyRgb);
|
||||
struct TtyRgb rgb2ansi8_(int, int, int);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_TTY_INTERNAL_H_ */
|
||||
@@ -17,7 +17,6 @@
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "dsp/tty/itoa8.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/str/str.h"
|
||||
|
||||
struct Itoa8 kItoa8;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef COSMOPOLITAN_DSP_TTY_ITOA8_H_
|
||||
#define COSMOPOLITAN_DSP_TTY_ITOA8_H_
|
||||
#include "libc/str/str.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
struct Itoa8 {
|
||||
@@ -17,5 +16,4 @@ forceinline char *itoa8(char *p, uint8_t c) {
|
||||
}
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_TTY_ITOA8_H_ */
|
||||
@@ -2,10 +2,8 @@
|
||||
#define DSP_TTY_QUANT_H_
|
||||
#include "dsp/tty/ttyrgb.h"
|
||||
#include "libc/assert.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/limits.h"
|
||||
#include "libc/str/str.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
#define TL 0
|
||||
@@ -90,5 +88,4 @@ forceinline bool ttyeq(struct TtyRgb x, struct TtyRgb y) {
|
||||
}
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* DSP_TTY_QUANT_H_ */
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#define kTtyIdScreen 83
|
||||
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
struct FILE;
|
||||
@@ -55,5 +54,4 @@ void ttyhisto(uint32_t[hasatleast 256], uint8_t[hasatleast 256],
|
||||
const uint8_t *, const uint8_t *, size_t);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_TTY_TTY_H_ */
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "dsp/tty/ttyrgb.h"
|
||||
#include "dsp/tty/windex.h"
|
||||
#include "libc/assert.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/intrin/safemacros.internal.h"
|
||||
#include "libc/limits.h"
|
||||
#include "libc/log/check.h"
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#ifndef COSMOPOLITAN_DSP_TTY_RGB_H_
|
||||
#define COSMOPOLITAN_DSP_TTY_RGB_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
struct TtyRgb {
|
||||
@@ -8,5 +7,4 @@ struct TtyRgb {
|
||||
};
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_TTY_RGB_H_ */
|
||||
@@ -1,10 +1,8 @@
|
||||
#ifndef COSMOPOLITAN_DSP_TTY_WINDEX_H_
|
||||
#define COSMOPOLITAN_DSP_TTY_WINDEX_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
extern unsigned (*windex)(uint16_t *, size_t);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_TTY_WINDEX_H_ */
|
||||
@@ -1,10 +1,8 @@
|
||||
#ifndef COSMOPOLITAN_DSP_TTY_XTERMNAME_H_
|
||||
#define COSMOPOLITAN_DSP_TTY_XTERMNAME_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
extern const char kXtermName[];
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_TTY_XTERMNAME_H_ */
|
||||
@@ -157,7 +157,7 @@ o/$(MODE)/examples/picol.com.dbg: \
|
||||
o/$(MODE)/examples/nesemu1.o: private QUOTA += -M512m
|
||||
o/$(MODE)/usr/share/dict/words.zip.o: private ZIPOBJ_FLAGS += -C2
|
||||
|
||||
$(EXAMPLES_OBJS): examples/examples.mk
|
||||
$(EXAMPLES_OBJS): examples/BUILD.mk
|
||||
|
||||
o/$(MODE)/usr/share/dict/words: \
|
||||
usr/share/dict/words.gz
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "libc/dce.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/intrin/safemacros.internal.h"
|
||||
#include "libc/inttypes.h"
|
||||
#include "libc/log/check.h"
|
||||
|
||||
@@ -63,7 +63,7 @@ o/$(MODE)/examples/package/%.com.dbg: \
|
||||
@$(APELINK)
|
||||
|
||||
# Invalidates objects in package when makefile is edited.
|
||||
$(EXAMPLES_PACKAGE_OBJS): examples/package/build.mk
|
||||
$(EXAMPLES_PACKAGE_OBJS): examples/package/BUILD.mk
|
||||
|
||||
# Creates target building everything in package and subpackages.
|
||||
.PHONY: o/$(MODE)/examples/package
|
||||
@@ -93,7 +93,7 @@ $(EXAMPLES_PACKAGE_LIB_A).pkg: \
|
||||
$(foreach x,$(EXAMPLES_PACKAGE_LIB_A_DIRECTDEPS),$($(x)_A).pkg)
|
||||
|
||||
# Invalidates objects in package when makefile is edited.
|
||||
$(EXAMPLES_PACKAGE_LIB_A_OBJS): examples/package/lib/build.mk
|
||||
$(EXAMPLES_PACKAGE_LIB_A_OBJS): examples/package/lib/BUILD.mk
|
||||
|
||||
# let these assembly objects build on aarch64
|
||||
o/$(MODE)/examples/package/lib/myasm.o: examples/package/lib/myasm.S
|
||||
@@ -1,11 +1,9 @@
|
||||
#ifndef COSMOPOLITAN_EXAMPLES_PACKAGE_LIB_MYPRINT_H_
|
||||
#define COSMOPOLITAN_EXAMPLES_PACKAGE_LIB_MYPRINT_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
void MyPrint(const char *);
|
||||
void MyAsm(const char *);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_EXAMPLES_PACKAGE_LIB_MYPRINT_H_ */
|
||||
@@ -106,7 +106,7 @@ o/$(MODE)/examples/pyapp/pyapp.com.dbg: \
|
||||
|
||||
# Ensure that build config changes will invalidate build artifacts.
|
||||
o/$(MODE)/examples/pyapp/pyapp.o: \
|
||||
examples/pyapp/pyapp.mk
|
||||
examples/pyapp/BUILD.mk
|
||||
|
||||
# By convention we want to be able to say `make -j8 o//examples/pyapp`
|
||||
# and have it build all targets the package defines.
|
||||
@@ -106,7 +106,7 @@ o/$(MODE)/examples/pylife/pylife.com.dbg: \
|
||||
|
||||
# Ensure that build config changes will invalidate build artifacts.
|
||||
o/$(MODE)/examples/pylife/pylife.o: \
|
||||
examples/pylife/pylife.mk
|
||||
examples/pylife/BUILD.mk
|
||||
|
||||
# By convention we want to be able to say `make -j8 o//examples/pylife`
|
||||
# and have it build all targets the package defines.
|
||||
@@ -147,6 +147,7 @@ libc/isystem/pmmintrin.h \
|
||||
libc/isystem/poll.h \
|
||||
libc/isystem/popcntintrin.h \
|
||||
libc/isystem/pthread.h \
|
||||
libc/isystem/pty.h \
|
||||
libc/isystem/pwd.h \
|
||||
libc/isystem/queue \
|
||||
libc/isystem/random \
|
||||
@@ -266,12 +267,7 @@ LIBC_HDRS = $(filter %.h,$(LIBC_FILES)) $(LIBC_ISYSTEM)
|
||||
LIBC_HDRS_H = $(filter %.h,$(LIBC_HDRS))
|
||||
LIBC_INCS = $(filter %.inc,$(LIBC_FILES))
|
||||
LIBC_CHECKS = $(LIBC_HDRS_H:%=o/$(MODE)/%.ok)
|
||||
|
||||
ifneq ($(MODE), llvm)
|
||||
LIBC_FILES := $(wildcard libc/*)
|
||||
else
|
||||
LIBC_FILES := $(wildcard libc/*)
|
||||
endif
|
||||
|
||||
.PHONY: o/$(MODE)/libc
|
||||
o/$(MODE)/libc: o/$(MODE)/libc/calls \
|
||||
@@ -1,6 +1,5 @@
|
||||
#ifndef COSMOPOLITAN_LIBC_AR_H_
|
||||
#define COSMOPOLITAN_LIBC_AR_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
#define ARMAG "!<arch>\n"
|
||||
@@ -18,5 +17,4 @@ struct ar_hdr {
|
||||
};
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_AR_H_ */
|
||||
File renamed without changes.
@@ -4,7 +4,6 @@
|
||||
#include "libc/calls/struct/timeval.h"
|
||||
#include "libc/intrin/asan.internal.h"
|
||||
#include "libc/intrin/asmflag.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
forceinline bool __asan_is_valid_timespec(const struct timespec *ts) {
|
||||
@@ -25,5 +24,4 @@ forceinline bool __asan_is_valid_timeval(const struct timeval *tv) {
|
||||
}
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_ASAN_INTERNAL_H_ */
|
||||
@@ -1,6 +1,5 @@
|
||||
#ifndef COSMOPOLITAN_LIBC_CALLS_BLOCKCANCEL_H_
|
||||
#define COSMOPOLITAN_LIBC_CALLS_BLOCKCANCEL_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
#define BLOCK_CANCELATION \
|
||||
@@ -17,5 +16,4 @@ int _pthread_block_cancelation(void);
|
||||
void _pthread_allow_cancelation(int);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_BLOCKCANCEL_H_ */
|
||||
@@ -1,7 +1,7 @@
|
||||
/*-*- 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 2020 Justine Alexandra Roberts Tunney │
|
||||
│ 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 │
|
||||
@@ -16,16 +16,32 @@
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/intrin/bswap.h"
|
||||
|
||||
#include "libc/calls/cachestat.h"
|
||||
#include "libc/intrin/strace.internal.h"
|
||||
|
||||
int sys_cachestat(int, struct cachestat_range *, struct cachestat *, uint32_t);
|
||||
|
||||
/**
|
||||
* Reverses bits in 64-bit word.
|
||||
* Query the page cache statistics of a file.
|
||||
*
|
||||
* @param fd The open file descriptor to retrieve statistics from.
|
||||
* @param cstat_range The byte range in `fd` to query. When `len > 0`, the range
|
||||
* is `[off..off + len]`. When `len` == 0, the range is from `off` to the end of
|
||||
* `fd`.
|
||||
* @param cstat The structure where page cache statistics are stored.
|
||||
* @param flags Currently unused, and must be set to `0`.
|
||||
* @return 0 on success, or -1 w/ errno.
|
||||
* @raise EFAULT if `cstat_range` or `cstat` points to invalid memory
|
||||
* @raise EINVAL if `flags` is nonzero
|
||||
* @raise EBADF if `fd` is negative or not open
|
||||
* @raise EOPNOTSUPP if `fd` refers to a hugetlbfs file
|
||||
* @raise ENOSYS if not Linux 6.5
|
||||
*/
|
||||
uint64_t _bitreverse64(uint64_t x) {
|
||||
x = bswap_64(x);
|
||||
x = (x & 0xaaaaaaaaaaaaaaaa) >> 1 | (x & 0x5555555555555555) << 1;
|
||||
x = (x & 0xcccccccccccccccc) >> 2 | (x & 0x3333333333333333) << 2;
|
||||
x = (x & 0xf0f0f0f0f0f0f0f0) >> 4 | (x & 0x0f0f0f0f0f0f0f0f) << 4;
|
||||
return x;
|
||||
}
|
||||
int cachestat(int fd, struct cachestat_range *cstat_range,
|
||||
struct cachestat *cstat, uint32_t flags) {
|
||||
int rc;
|
||||
rc = sys_cachestat(fd, cstat_range, cstat, flags);
|
||||
STRACE("cachestat(%d, %p, %p, %#x) → %d% m", fd, cstat_range, cstat, flags);
|
||||
return rc;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef COSMOPOLITAN_LIBC_CALLS_CACHESTAT_H_
|
||||
#define COSMOPOLITAN_LIBC_CALLS_CACHESTAT_H_
|
||||
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
struct cachestat_range {
|
||||
uint64_t off;
|
||||
uint64_t len;
|
||||
};
|
||||
|
||||
struct cachestat {
|
||||
/** Number of cached pages. */
|
||||
uint64_t nr_cache;
|
||||
/** Number of dirty pages */
|
||||
uint64_t nr_dirty;
|
||||
/** Number of pages marked for writeback. */
|
||||
uint64_t nr_writeback;
|
||||
/** Number of pages evicted from the cache. */
|
||||
uint64_t nr_evicted;
|
||||
/**
|
||||
* Number of recently evicted pages.
|
||||
* A page is recently evicted if its last eviction was recent enough that its
|
||||
* reentry to the cache would indicate that it is actively being used by the
|
||||
* system, and that there is memory pressure on the system.
|
||||
*/
|
||||
uint64_t nr_recently_evicted;
|
||||
};
|
||||
|
||||
int cachestat(int, struct cachestat_range *, struct cachestat *, uint32_t);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_LANDLOCK_H_ */
|
||||
@@ -65,7 +65,6 @@
|
||||
#define tmpfd __tmpfd
|
||||
#endif
|
||||
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
/*───────────────────────────────────────────────────────────────────────────│─╗
|
||||
│ cosmopolitan § system calls ─╬─│┼
|
||||
@@ -260,5 +259,4 @@ int __wifsignaled(int) pureconst;
|
||||
#endif
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_SYSCALLS_H_ */
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "libc/nt/enum/filetype.h"
|
||||
#include "libc/nt/files.h"
|
||||
#include "libc/nt/runtime.h"
|
||||
#include "libc/runtime/zipos.internal.h"
|
||||
#include "libc/sock/syscall_fd.internal.h"
|
||||
#include "libc/sysv/consts/o.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
@@ -32,6 +33,8 @@ textwindows int sys_close_nt(int fd, int fildes) {
|
||||
if (fd + 0u >= g_fds.n) return ebadf();
|
||||
struct Fd *f = g_fds.p + fd;
|
||||
switch (f->kind) {
|
||||
case kFdZip:
|
||||
return _weaken(__zipos_close)(fd);
|
||||
case kFdEmpty:
|
||||
return ebadf();
|
||||
case kFdFile:
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#ifndef COSMOPOLITAN_LIBC_CALLS_CP_INTERNAL_H_
|
||||
#define COSMOPOLITAN_LIBC_CALLS_CP_INTERNAL_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
int begin_cancelation_point(void);
|
||||
@@ -21,5 +20,4 @@ void end_cancelation_point(int);
|
||||
#endif
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_CP_INTERNAL_H_ */
|
||||
+22
-12
@@ -24,9 +24,11 @@
|
||||
#include "libc/calls/struct/sigset.internal.h"
|
||||
#include "libc/calls/syscall_support-nt.internal.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/intrin/kprintf.h"
|
||||
#include "libc/intrin/weaken.h"
|
||||
#include "libc/nt/files.h"
|
||||
#include "libc/nt/runtime.h"
|
||||
#include "libc/runtime/zipos.internal.h"
|
||||
#include "libc/sock/internal.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/o.h"
|
||||
@@ -61,22 +63,30 @@ static textwindows int sys_dup_nt_impl(int oldfd, int newfd, int flags,
|
||||
}
|
||||
}
|
||||
|
||||
if (DuplicateHandle(GetCurrentProcess(), g_fds.p[oldfd].handle,
|
||||
GetCurrentProcess(), &handle, 0, true,
|
||||
kNtDuplicateSameAccess)) {
|
||||
g_fds.p[newfd] = g_fds.p[oldfd];
|
||||
g_fds.p[newfd].handle = handle;
|
||||
if (flags & _O_CLOEXEC) {
|
||||
g_fds.p[newfd].flags |= _O_CLOEXEC;
|
||||
} else {
|
||||
g_fds.p[newfd].flags &= ~_O_CLOEXEC;
|
||||
}
|
||||
if (__isfdkind(oldfd, kFdZip)) {
|
||||
handle = (intptr_t)_weaken(__zipos_keep)(
|
||||
(struct ZiposHandle *)(intptr_t)g_fds.p[oldfd].handle);
|
||||
rc = newfd;
|
||||
} else {
|
||||
__releasefd(newfd);
|
||||
rc = __winerr();
|
||||
if (DuplicateHandle(GetCurrentProcess(), g_fds.p[oldfd].handle,
|
||||
GetCurrentProcess(), &handle, 0, true,
|
||||
kNtDuplicateSameAccess)) {
|
||||
rc = newfd;
|
||||
} else {
|
||||
rc = __winerr();
|
||||
__releasefd(newfd);
|
||||
__fds_unlock();
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
g_fds.p[newfd] = g_fds.p[oldfd];
|
||||
g_fds.p[newfd].handle = handle;
|
||||
if (flags & _O_CLOEXEC) {
|
||||
g_fds.p[newfd].flags |= _O_CLOEXEC;
|
||||
} else {
|
||||
g_fds.p[newfd].flags &= ~_O_CLOEXEC;
|
||||
}
|
||||
__fds_unlock();
|
||||
return rc;
|
||||
}
|
||||
|
||||
+6
-3
@@ -22,7 +22,9 @@
|
||||
#include "libc/calls/syscall-sysv.internal.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/intrin/strace.internal.h"
|
||||
#include "libc/intrin/weaken.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
#include "libc/runtime/zipos.internal.h"
|
||||
|
||||
/**
|
||||
* Duplicates file descriptor.
|
||||
@@ -51,10 +53,11 @@
|
||||
*/
|
||||
int dup(int fd) {
|
||||
int rc;
|
||||
if (__isfdkind(fd, kFdZip)) {
|
||||
rc = enotsup();
|
||||
} else if (!IsWindows()) {
|
||||
if (!IsWindows()) {
|
||||
rc = sys_dup(fd);
|
||||
if (rc != -1 && __isfdkind(fd, kFdZip)) {
|
||||
_weaken(__zipos_postdup)(fd, rc);
|
||||
}
|
||||
} else {
|
||||
rc = sys_dup_nt(fd, -1, 0, -1);
|
||||
}
|
||||
|
||||
+17
-5
@@ -18,12 +18,15 @@
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/internal.h"
|
||||
#include "libc/calls/state.internal.h"
|
||||
#include "libc/calls/syscall-nt.internal.h"
|
||||
#include "libc/calls/syscall-sysv.internal.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/intrin/kprintf.h"
|
||||
#include "libc/intrin/strace.internal.h"
|
||||
#include "libc/intrin/weaken.h"
|
||||
#include "libc/runtime/zipos.internal.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
|
||||
/**
|
||||
@@ -64,16 +67,25 @@ int dup2(int oldfd, int newfd) {
|
||||
int rc;
|
||||
// helps guarantee stderr log gets duplicated before user closes
|
||||
if (_weaken(kloghandle)) _weaken(kloghandle)();
|
||||
if (__isfdkind(oldfd, kFdZip)) {
|
||||
rc = enotsup();
|
||||
#ifdef __aarch64__
|
||||
} else if (oldfd == newfd) {
|
||||
if (oldfd == newfd) {
|
||||
// linux aarch64 defines dup3() but not dup2(), which wasn't such a
|
||||
// great decision, since the two syscalls don't behave the same way
|
||||
if (!(rc = read(oldfd, 0, 0))) rc = oldfd;
|
||||
} else
|
||||
#endif
|
||||
} else if (!IsWindows()) {
|
||||
rc = sys_dup2(oldfd, newfd, 0);
|
||||
if (!IsWindows()) {
|
||||
if (__isfdkind(oldfd, kFdZip) || __isfdkind(newfd, kFdZip)) {
|
||||
if (__vforked) {
|
||||
return enotsup();
|
||||
}
|
||||
rc = sys_dup2(oldfd, newfd, 0);
|
||||
if (rc != -1) {
|
||||
_weaken(__zipos_postdup)(oldfd, newfd);
|
||||
}
|
||||
} else {
|
||||
rc = sys_dup2(oldfd, newfd, 0);
|
||||
}
|
||||
} else if (newfd < 0) {
|
||||
rc = ebadf();
|
||||
} else if (oldfd == newfd) {
|
||||
|
||||
+14
-3
@@ -18,12 +18,15 @@
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/internal.h"
|
||||
#include "libc/calls/state.internal.h"
|
||||
#include "libc/calls/syscall-nt.internal.h"
|
||||
#include "libc/calls/syscall-sysv.internal.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/intrin/kprintf.h"
|
||||
#include "libc/intrin/strace.internal.h"
|
||||
#include "libc/intrin/weaken.h"
|
||||
#include "libc/runtime/zipos.internal.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/o.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
|
||||
@@ -67,10 +70,18 @@ int dup3(int oldfd, int newfd, int flags) {
|
||||
rc = einval(); // NetBSD doesn't do this
|
||||
} else if (oldfd < 0 || newfd < 0) {
|
||||
rc = ebadf();
|
||||
} else if (__isfdkind(oldfd, kFdZip)) {
|
||||
rc = enotsup();
|
||||
} else if (!IsWindows()) {
|
||||
rc = sys_dup3(oldfd, newfd, flags);
|
||||
if (__isfdkind(oldfd, kFdZip) || __isfdkind(newfd, kFdZip)) {
|
||||
if (__vforked) {
|
||||
return enotsup();
|
||||
}
|
||||
rc = sys_dup3(oldfd, newfd, flags);
|
||||
if (rc != -1) {
|
||||
_weaken(__zipos_postdup)(oldfd, newfd);
|
||||
}
|
||||
} else {
|
||||
rc = sys_dup3(oldfd, newfd, flags);
|
||||
}
|
||||
} else {
|
||||
rc = sys_dup_nt(oldfd, newfd, flags, -1);
|
||||
}
|
||||
|
||||
+14
-1
@@ -16,10 +16,12 @@
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/blockcancel.internal.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/syscall-nt.internal.h"
|
||||
#include "libc/calls/syscall-sysv.internal.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/intrin/asan.internal.h"
|
||||
#include "libc/intrin/describeflags.internal.h"
|
||||
#include "libc/intrin/strace.internal.h"
|
||||
@@ -28,6 +30,7 @@
|
||||
#include "libc/sysv/errfuns.h"
|
||||
|
||||
int sys_fchmodat_linux(int, const char *, unsigned, int);
|
||||
int sys_fchmodat2(int, const char *, unsigned, int);
|
||||
|
||||
/**
|
||||
* Changes permissions on file, e.g.:
|
||||
@@ -40,6 +43,9 @@ int sys_fchmodat_linux(int, const char *, unsigned, int);
|
||||
* @param mode contains octal flags (base 8)
|
||||
* @param flags can have `AT_SYMLINK_NOFOLLOW`
|
||||
* @raise EROFS if `dirfd` or `path` use zip file system
|
||||
* @raise EOPNOTSUP on Linux if `path` is a symbolic link, `AT_SYMLINK_NOFOLLOW`
|
||||
* is set in `flags`, and filesystem does not support setting the mode of
|
||||
* symbolic links.
|
||||
* @errors ENOENT, ENOTDIR, ENOSYS
|
||||
* @asyncsignalsafe
|
||||
* @see fchmod()
|
||||
@@ -53,7 +59,14 @@ int fchmodat(int dirfd, const char *path, uint32_t mode, int flags) {
|
||||
rc = erofs();
|
||||
} else if (!IsWindows()) {
|
||||
if (IsLinux() && flags) {
|
||||
rc = sys_fchmodat_linux(dirfd, path, mode, flags);
|
||||
int serrno = errno;
|
||||
rc = sys_fchmodat2(dirfd, path, mode, flags);
|
||||
if (rc == -1 && errno == ENOSYS) {
|
||||
errno = serrno;
|
||||
BLOCK_CANCELATION;
|
||||
rc = sys_fchmodat_linux(dirfd, path, mode, flags);
|
||||
ALLOW_CANCELATION;
|
||||
}
|
||||
} else {
|
||||
rc = sys_fchmodat(dirfd, path, mode, flags);
|
||||
}
|
||||
|
||||
+6
-1
@@ -28,6 +28,7 @@
|
||||
#include "libc/intrin/strace.internal.h"
|
||||
#include "libc/intrin/weaken.h"
|
||||
#include "libc/runtime/zipos.internal.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/f.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
|
||||
@@ -125,6 +126,10 @@ int fcntl(int fd, int cmd, ...) {
|
||||
END_CANCELATION_POINT;
|
||||
} else {
|
||||
rc = sys_fcntl(fd, cmd, arg, __sys_fcntl);
|
||||
if (rc != -1 && (cmd == F_DUPFD || cmd == F_DUPFD_CLOEXEC) &&
|
||||
__isfdkind(rc, kFdZip)) {
|
||||
_weaken(__zipos_postdup)(fd, rc);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
rc = sys_fcntl_nt(fd, cmd, arg);
|
||||
@@ -136,7 +141,7 @@ int fcntl(int fd, int cmd, ...) {
|
||||
rc = ebadf();
|
||||
}
|
||||
|
||||
#ifdef SYSDEBUG
|
||||
#if SYSDEBUG
|
||||
if (rc != -1 && cmd == F_GETFL) {
|
||||
STRACE("fcntl(%d, F_GETFL) → %s", fd, DescribeOpenFlags(rc));
|
||||
} else if (cmd == F_SETFL) {
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "libc/elf/def.h"
|
||||
#include "libc/elf/tinyelf.internal.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/serialize.h"
|
||||
#include "libc/intrin/directmap.internal.h"
|
||||
#include "libc/nt/memory.h"
|
||||
#include "libc/nt/runtime.h"
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "libc/cosmo.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/serialize.h"
|
||||
#include "libc/limits.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/nt/runtime.h"
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include "libc/errno.h"
|
||||
#include "libc/intrin/asan.internal.h"
|
||||
#include "libc/intrin/asmflag.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/intrin/strace.internal.h"
|
||||
#include "libc/intrin/weaken.h"
|
||||
#include "libc/macros.internal.h"
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#ifndef COSMOPOLITAN_LIBC_CALLS_GROUPS_INTERNAL_H_
|
||||
#define COSMOPOLITAN_LIBC_CALLS_GROUPS_INTERNAL_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
int sys_getgroups(int size, uint32_t list[]);
|
||||
@@ -11,5 +10,4 @@ const char *DescribeGidList(char[128], int, int, const uint32_t list[]);
|
||||
DescribeGidList(alloca(128), rc, length, gidlist)
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_GROUPS_INTERNAL_H_ */
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#define kSigactionMinRva 8 /* >SIG_{ERR,DFL,IGN,...} */
|
||||
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
#define kIoMotion ((const int8_t[3]){1, 0, 0})
|
||||
@@ -54,5 +53,4 @@ bool __iswsl1(void);
|
||||
#endif
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_INTERNAL_H_ */
|
||||
+2
-2
@@ -24,7 +24,7 @@
|
||||
#include "libc/calls/termios.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/serialize.h"
|
||||
#include "libc/intrin/cmpxchg.h"
|
||||
#include "libc/intrin/strace.internal.h"
|
||||
#include "libc/intrin/weaken.h"
|
||||
@@ -66,7 +66,7 @@ static struct HostAdapterInfoNode {
|
||||
struct sockaddr netmask;
|
||||
struct sockaddr broadcast;
|
||||
short flags;
|
||||
} * __hostInfo;
|
||||
} *__hostInfo;
|
||||
|
||||
static int ioctl_default(int fd, unsigned long request, void *arg) {
|
||||
int rc;
|
||||
|
||||
@@ -10,11 +10,9 @@
|
||||
#define IPC_EXCL 02000
|
||||
#define IPC_NOWAIT 04000
|
||||
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
int ftok(const char *, int);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_IPC_H_ */
|
||||
@@ -16,8 +16,8 @@
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/serialize.h"
|
||||
#include "libc/proc/execve.internal.h"
|
||||
|
||||
/**
|
||||
* Returns true if executable image is supported by APE Loader.
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
*/
|
||||
#define LANDLOCK_ACCESS_FS_TRUNCATE 0x4000ul
|
||||
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
enum landlock_rule_type {
|
||||
@@ -58,5 +57,4 @@ int landlock_create_ruleset(const struct landlock_ruleset_attr *, size_t,
|
||||
uint32_t);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_LANDLOCK_H_ */
|
||||
@@ -1,6 +1,5 @@
|
||||
#ifndef COSMOPOLITAN_LIBC_CALLS_MAKEDEV_H_
|
||||
#define COSMOPOLITAN_LIBC_CALLS_MAKEDEV_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
|
||||
uint64_t makedev(uint32_t, uint32_t);
|
||||
uint32_t major(uint64_t);
|
||||
@@ -10,5 +9,4 @@ uint32_t minor(uint64_t);
|
||||
#define minor(x) minor(x)
|
||||
#define makedev(x, y) makedev(x, y)
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_MAKEDEV_H_ */
|
||||
@@ -18,7 +18,7 @@
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/serialize.h"
|
||||
#include "libc/stdio/rand.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#ifndef COSMOPOLITAN_LIBC_CALLS_MOUNT_H_
|
||||
#define COSMOPOLITAN_LIBC_CALLS_MOUNT_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
int mount(const char *, const char *, const char *, unsigned long,
|
||||
@@ -13,5 +12,4 @@ int umount2(const char *, int);
|
||||
#endif
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_MOUNT_H_ */
|
||||
@@ -18,7 +18,7 @@
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/serialize.h"
|
||||
#include "libc/stdio/rand.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/o.h"
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#ifndef COSMOPOLITAN_LIBC_COMPAT_OPENBSD_H_
|
||||
#define COSMOPOLITAN_LIBC_COMPAT_OPENBSD_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
typedef unsigned char u_char;
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_COMPAT_OPENBSD_H_ */
|
||||
+7
-4
@@ -19,6 +19,7 @@
|
||||
#include "libc/calls/internal.h"
|
||||
#include "libc/calls/sig.internal.h"
|
||||
#include "libc/intrin/atomic.h"
|
||||
#include "libc/intrin/weaken.h"
|
||||
#include "libc/nt/synchronization.h"
|
||||
#include "libc/sysv/consts/sicode.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
@@ -30,9 +31,11 @@
|
||||
// raises ECANCELED if this POSIX thread was canceled in masked mode
|
||||
static textwindows int _park_thread(uint32_t msdelay, sigset_t waitmask,
|
||||
bool restartable) {
|
||||
int sig;
|
||||
int sig, handler_was_called;
|
||||
if (_check_cancel() == -1) return -1;
|
||||
if ((sig = __sig_get(waitmask))) goto HandleSignal;
|
||||
if (_weaken(__sig_get) && (sig = _weaken(__sig_get)(waitmask))) {
|
||||
goto HandleSignal;
|
||||
}
|
||||
int expect = 0;
|
||||
atomic_int futex = 0;
|
||||
struct PosixThread *pt = _pthread_self();
|
||||
@@ -40,9 +43,9 @@ static textwindows int _park_thread(uint32_t msdelay, sigset_t waitmask,
|
||||
atomic_store_explicit(&pt->pt_blocker, &futex, memory_order_release);
|
||||
bool32 ok = WaitOnAddress(&futex, &expect, sizeof(int), msdelay);
|
||||
atomic_store_explicit(&pt->pt_blocker, 0, memory_order_release);
|
||||
if (ok && (sig = __sig_get(waitmask))) {
|
||||
if (ok && _weaken(__sig_get) && (sig = _weaken(__sig_get)(waitmask))) {
|
||||
HandleSignal:
|
||||
int handler_was_called = __sig_relay(sig, SI_KERNEL, waitmask);
|
||||
handler_was_called = _weaken(__sig_relay)(sig, SI_KERNEL, waitmask);
|
||||
if (_check_cancel() == -1) return -1;
|
||||
if (!restartable || (handler_was_called & SIG_HANDLED_NO_RESTART)) {
|
||||
return eintr();
|
||||
|
||||
@@ -7,11 +7,9 @@
|
||||
#define PLEDGE_PENALTY_MASK 0x000f
|
||||
#define PLEDGE_STDERR_LOGGING 0x0010
|
||||
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
extern int __pledge_mode;
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_PLEDGE_H_ */
|
||||
@@ -2,7 +2,6 @@
|
||||
#define COSMOPOLITAN_LIBC_CALLS_PLEDGE_INTERNAL_H_
|
||||
#include "libc/calls/pledge.h"
|
||||
#include "libc/intrin/promises.internal.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
struct Pledges {
|
||||
@@ -17,5 +16,4 @@ int sys_pledge_linux(unsigned long, int);
|
||||
int ParsePromises(const char *, unsigned long *, unsigned long);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_PLEDGE_INTERNAL_H_ */
|
||||
@@ -27,7 +27,6 @@
|
||||
#include "libc/dce.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/intrin/atomic.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/intrin/strace.internal.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/mem/mem.h"
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ int prctl(int operation, ...) {
|
||||
rc = enosys();
|
||||
}
|
||||
|
||||
#ifdef SYSDEBUG
|
||||
#if SYSDEBUG
|
||||
if (operation == PR_CAPBSET_READ || operation == PR_CAPBSET_DROP) {
|
||||
STRACE("prctl(%s, %s) → %d% m", DescribePrctlOperation(operation),
|
||||
DescribeCapability(a), rc);
|
||||
|
||||
Loaded 100 of 3289 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user