summaryrefslogtreecommitdiffhomepage
path: root/Makefile
Commit message (Collapse)AuthorAgeFilesLines
* repo: drop patches/, move spec-pdf.sh out of scripts/Sean Kurtz5 days1-1/+1
| | | | | | | patches/ held one file, a byte-identical copy of LICENSE; no port patches anything (ZOPEN_TYPE=LOCAL builds the checkout). The single script was the typst spec builder, which is a build step, so it lives beside the other build machinery.
* C23: compile as C23 and use its spellingSean Kurtz5 days1-1/+1
| | | | | | | | | | | | | | | | | | | | | | | The z/OS toolchain would not take C23 when this was first written; IBM Open XL C/C++ 2.2 does (clang 21.1, __STDC_VERSION__ 202311), and so does the clang on Linux. -std=c23 in the Makefile, and the standard attributes in place of the ones that were macros: _Noreturn -> [[noreturn]] (on declarations and definitions) _Static_assert -> static_assert _Alignas -> alignas NODISCARD -> [[nodiscard]] FALLTHROUGH -> [[fallthrough]] PRINTFLIKE and UNREACHABLE() stay macros: [[gnu::format]] and [[gnu::unreachable]] are vendor attributes, and the standard has no [[format]] or [[unreachable]] for a header-only project yet. Standard-library additions newer than the libc of either system (<stdbit.h>, <stdckdint.h>) are not used, so gcc -std=c2x still builds the tree warning-free. The suite, ASan/UBSan and the z/OS lint pass as before; linux/i-dscomplete remains the one local failure it was on main.
* build: make the 64-bit z/OS build the defaultSean Kurtz5 days1-1/+8
| | | | | | | | | | | | | | | | | | | | | | zash is built 64-bit on z/OS now: -m64 for the ASCII and the EBCDIC build and for the debug build, and `make` as well as `make zash` land on zos-ascii there. The 31-bit build existed for the 64-bit start and fork costs, which were the C run-time being loaded out of the linklist; with CELQ* in the LPA the widths measure the same and the shell is built at the width IBM builds for. The catalog and dynamic-allocation modules are AMODE 31 and OS_UPSTACK does not exist at -m64, so both are declared with plain OS linkage, which is the 64-bit glue for an AMODE 31 callee. Neither module is installed on the test system, so that path is unverified there; csi_call() still catches a program check and retires the catalog. IGGCSI00's VL bit comes from the width of a pointer, not 0x80000000. Documentation follows: README gains a Recommendations section for the LPA change and loses the 31-bit rationale; DESIGN.md's cost model, catalog linkage and open questions match the measurements; bench/README states the current width and the rerun numbers; investigation.md records the decision.
* build: 64-bit on z/OSSean Kurtz5 days1-6/+7
| | | | | | | | | | | | | | | | | | The 31-bit choice existed for one reason: a 64-bit start cost 29 ms against 1 ms and a 64-bit fork() 4.2 ms against 0.10. That was the 64-bit C run-time being loaded out of CEE.SCEERUN2 on the linklist on every start; with CELQ* in the dynamic LPA both widths cost 1.5 ms and fork() 0.10 ms (notes/investigation.md has the before and after). So build the shell at the width IBM builds for: -m64 for both the ASCII and the EBCDIC build, and for the debug build. OS_UPSTACK does not exist at -m64, so the two AMODE 31 services (IGGCSI00, BPXWDY2) are declared with plain OS linkage, which is what the 64-bit glue implements. IGGCSI00's VL bit is set from the width of a pointer now, not with 0x80000000. Neither module loads on this system, so the linkage itself stays unverified; csi_call() still traps a program check and retires the catalog if it abends.
* Measure why 64-bit start-up is slow, and record the answer (#16)Sean Kurtz6 days1-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * bench: time one start with a parent that is not an LE program `bench/startup.sh` times a shell loop, so on z/OS every child pays the 31-bit shell's own price and the 64-bit start-up cost cannot be separated from it. `tests/tools/spawn` forks one child at a time and reports wall and child CPU per start, and `bench/le-init.sh` builds the 31-bit, 64-bit and HLASM programs it times in a work directory, so the table needs nothing checked in but the script. The child's environment is built by hand and passed to `execve`: `putenv` after LE has initialized is not handed to the child, and `_CEE_RUNOPTS` exported to an LE parent makes that parent's `execl` fail, which a fork loop that does not check exit status reports as a fast start. * notes: the 64-bit start-up cost is LE waiting, not the address mode Measured on the CBT z/OS 29.00 system: a 64-bit HLASM program with no LE starts in 1.39 ms, the same source at -m32 in 1.5-1.8 ms, so the address space, the loader and XPLINK are free. A -m64 start spends 4.5-28 ms before the first instruction of main, of which only 1.0-1.25 ms is charged to the child: the rest is wall time on something shared, which does not overlap between concurrent starts while it is at 28 ms and does once it drops to 5.8 ms. No _CEE_RUNOPTS option moves it. That retracts an earlier POSIX(OFF) result in these notes: exporting the option to an LE parent makes its execl fail, so the run timed failed execs. Applied to the child, POSIX(OFF) changes nothing.
* Merge pull request #15 from skurtz97/bench/startupSean Kurtz6 days1-1/+16
|\ | | | | bench: measure start-up wall time against the other shells
| * bench: measure start-up wall time against the other shellsSean Kurtz6 days1-1/+16
| | | | | | | | | | | | | | | | | | | | | | run.sh times CPU, so the milliseconds a process spends before it runs anything never appear in it: zash can read 0.00 in a subshell row while zash -c : costs a few ms of wall time. bench/startup.sh measures that directly, one start per command, and bench/README.md now has a table instead of a warning that the number is missing. The clock is tests/tools/now.c, ten lines, because /bin/date on z/OS has no sub-second format.
* | Merge pull request #14 from skurtz97/test/zos-leakcheckSean Kurtz6 days1-2/+20
|\| | | | | test: fail when zash leaks under LE's heap checker
| * test: fail when zash leaks under LE's heap checkerSean Kurtz6 days1-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | HEAPCHK with a call depth and no per-call walk makes LE write the heap storage diagnostics into a CEEDUMP at normal termination: every allocation still live at exit, with the traceback that made it. A shell leaves working storage live on purpose, so the total says nothing by itself; a leak shows as the total growing with the work done. tests/zos/leak.sh therefore runs one builtin-only loop body at 100 and 1000 iterations in the same shell, sums the live bytes out of each report, and fails if the second run is more than 2 KiB larger. `make zos-leakcheck` is the target: it points _CEE_DMPTARG at build/leaks and skips zash/limits, which recurses deep enough to run out of storage under the checker.
* | fix: stop make check after the z/OS test passesSean Kurtz6 days1-2/+5
|/
* fix: make the zopen build use GNU make and install without rebuildingSean Kurtz6 days1-1/+3
|
* fix: keep the Makefile readable by IBM makeSean Kurtz6 days1-8/+13
| | | | Remove ?= and $(shell) from the docs browser lookup, use $(MAKE) for recursion, and make the z/OS default naming explicit.
* Merge origin/main into docs/logo-and-cleandocs/logo-and-cleanSean Kurtz7 days1-38/+110
|\ | | | | | | | | | | | | Resolutions: README.md and DESIGN.md keep the new colour logo (packaging/zash-logo.svg) at width 220; the Makefile keeps main's newer shellcheck header, lists `make docs` in the usage block, and `clean` removes docs, cov and $(ZTOOLS) along with the branch's new tools.
| * z/OS: run 31-bit and load IGGCSI00 through the C librarySean Kurtz7 days1-37/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | zash was AMODE 64, so calling the AMODE 31 IGGCSI00 needed assembler glue (zos_csi.s) that switched addressing mode around the branch. Built with -m32 the program is 31-bit itself: the call goes through a plain function pointer, the work area and the saved registers live in one 31-bit block in C, and the glue is gone. The rest of the tree follows the change: the build, the off-z/OS lint shim, DESIGN.md and README.md, the benches, the Lean spec of the pattern matcher, and the tests that recorded what the extra address bits had changed.
* | make: add other-docs, and bring the usage comment up to dateSean Kurtz7 days1-5/+25
| | | | | | | | | | | | | | | | | | | | | | make other-docs runs the documentation that needs a tool z/OS does not have: the specification through typst, the source reference through Doxygen. The comment at the top listed fourteen of the targets and missed the rest; it lists them all now, grouped the way the file is, with the argument each one takes where it takes one. Doxygen's output is doc/, not docs/, which the comment had wrong.
* | formal: typeset the spec from a script, and with the new coverSean Kurtz7 days1-1/+5
| | | | | | | | | | | | | | | | | | | | formal/zash-spec.pdf could not be rebuilt from anything in the tree. scripts/spec-pdf.sh does it: the typst CLI when present, the Python package otherwise, with the repository root as typst's root so the cover can reach ../packaging/zash-logo.svg. `make spec` runs it. The PDF is rebuilt from the same source, so the cover carries the new logo; the page count is unchanged at 27.
* | docs: one centred logo, and clean removes what this makefile buildsSean Kurtz7 days1-3/+5
|/ | | | | | | | | | | README and DESIGN.md showed a light/dark <picture> pair, copied from a layout that had no centring; both now use packaging/zash-logo.svg inside a centred paragraph, the same header the typst spec already uses. make clean listed neither zash-debug nor fuzz-mvsfmt, so both survived a clean. The shellcheck directive at the top of the makefile now also covers the $(OBJS)-style expansions and the recipe `if` it reads as shell syntax.
* z/OS: a wider spawn map, and the suite runs both buildsSean Kurtz12 days1-2/+3
| | | | | | | | | The map carried SYS_NFD+16 descriptors, so a script holding more pushed the terminal's duplicate out of reach and its commands lost the controlling terminal. 64 leaves room. `make zos-check` now builds the EBCDIC program too and runs the character-set tests against it, which nothing did before.
* z/OS: give the EBCDIC build its own nameSean Kurtz12 days1-1/+5
| | | | | | | | Both zos-ascii and zos-ebcdic wrote ./zash, so `make zos-ascii` after an EBCDIC build was "up to date" and left the EBCDIC program in place -- which cost a debugging session: the "ASCII" binary on cbt was EBCDIC. ASCII is the build zopen uses and the one the tests run, so it keeps ./zash; EBCDIC is ./zash-ebcdic.
* Document what dbx and AMBLIST actually do hereSean Kurtz12 days1-4/+7
| | | | | | | | Checked on the mainframe: `make zos-debug` builds, `st in main` stops at src/main.c:401 with the source shown, and next/where keep reporting file and line, but `st at "file":line" cannot resolve the source on ibm-clang's debug info. `make zos-amblist` writes a 48545-line map of ./zash (RMODE ANY, XPLINK, PO format 4, main entry AMODE 64).
* Makefile: zos-debug exists, and zos-amblist names the object it mapsSean Kurtz12 days1-1/+3
| | | | | The rule was zash-dbg, and the AMBLIST target asked for zos_csi.o where every other rule says src/zos_csi.o.
* Makefile: use plain `NAME = value` so z/OS make can read itSean Kurtz12 days1-5/+8
| | | | | | z/OS make rejects `?=` outright (FSUM8232, nothing builds), so go back to the assignment form the rest of the file uses and tell the linter, which reads makefiles as shell, that this is make syntax.
* z/OS: dbx, an AMBLIST map and heap-checked test runsSean Kurtz12 days1-4/+49
| | | | | | | | | | | | | lldb is not on z/OS, so the debug story there is dbx, which needs -g and an unoptimised load: make zos-debug builds ./zash-dbg, zos-dbx runs it, zos-attach attaches to a running shell and zos-dump reads a dump (SVC and SYSMDUMP only: dbx does not read SYSUDUMP or CEEDUMP). AMBLIST maps CSECTs, AMODE/RMODE and entry points of a program object, which is the one question a debugger cannot answer from source: make zos-amblist lists ./zash and the HLASM routine's object module. The docs catch up with C17 and the new targets.
* z/OS: check the heap the way z/OS canSean Kurtz12 days1-0/+9
| | | | | | | | | | | | There is no ASan there, but Language Environment can put a check zone after every heap element (above and below the 2 GB bar) and validate the heap on every request: an overlay then abends with U4042 and prints CEE3716I instead of staying silent. A small C program that writes 8 bytes past a malloc() calibrated the options against the real system. tests/zos/fuzz.sh now runs its 200 cases under those options, and make zos-heapcheck runs the whole suite under them. Its generator also stays inside 32 bits now, so /bin/sh can run the script too.
* Build with C17 on every platformSean Kurtz12 days1-1/+1
| | | | | | | | | | C17 is C11 plus its defect reports, so no source changes; what it buys is the current z/OS compiler's documented language level rather than the provisional C11 of earlier releases. Verified with clang (clean) and gcc (only the pre-existing -Wclobbered warnings in src/exec.c and src/trap.c), and with make zos-lint. The Linux suite is unchanged at 93 passed and linux/i-startup failed.
* Fixes for z/OS build and signals.Sean Kurtz13 days1-4/+13
|
* fix issues with z/os build, header visibility, signalsSean Kurtz13 days1-1/+5
|
* Added LLDB debug builds and support to Makefile and VSCode.Sean Kurtz13 days1-0/+23
|
* z/OS: file tagging, catalog completion, time, and per-command optionsSean Kurtz2026-11-151-11/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tagging and conversion (sys_zos.c, redir.c, input.c, var.c, exec.c): - _TAG_REDIR_IN/OUT/ERR as /bin/sh documents them, cached by variable hooks so redirection tests a byte; honoured as a prefix on external commands and on pipeline stages. - ASCII builds tag new output and here-document files as text, tag pipes IBM-1047 (set +o pipetag to stop), and switch on autoconvert. - Scripts, . files, profile and ENV are read in either character set: tagged files get F_CONTROL_CVT, untagged ones are sniffed. - tag/chtag primitives (sys_tag_get/sys_tag_set) for a builtin to come. Data set completion (complete.c, mvsfmt.[ch], zos_csi.s): - //'HLQ.PART, "//'HLQ.PART, //NAME (user HLQ), //'DSN(MEM, //DD:NAME complete one qualifier at a time from the Catalog Search Interface, PDS directories and the TIOT. - IGGCSI00 is called through HLASM glue that switches to AMODE 31 and keeps every register and parameter below the bar (VERIFY). - The work-area, directory and TIOT decoders are portable and run on Linux against a stand-in catalog that produces the real EBCDIC bytes, including CSI resume and directory-block splits; fuzzed with libFuzzer (make fuzz). - A lone completion inside quotes now closes the quote. Other z/OS features: - time [-p] keyword with shell/children CPU split. - set -o jobnames (_BPX_JOBNAME per command), set -o shareas (_BPX_SHAREAS=YES for foreground commands only), set -o msgid (ZSHnnnnE/W message IDs), ulimit -M (MEMLIMIT), ZOS_SYSNAME, ZOS_SYSPLEX, ZOS_RELEASE, ZOS_ASID, ZOS_JOBNAME, prompt \S. - BPXWDYN entry point for an alloc builtin to come. Checking z/OS code off z/OS: - make zos-lint compiles sys_zos.c against declarations transcribed from the z/OS headers, and the rest with the MVS paths forced on. - make mvs-asan runs the suite with the MVS paths on, under ASan/UBSan. - make asan and make valgrind now check for leaks.
* Add [[ ]], make coverage, and fixes found by edge-case testsSean Kurtz2026-11-151-4/+19
| | | | | | | [[ ]] is parsed into a tree and evaluated without argv or lookup. Fixes: errexit inside a tested subshell, the ${x:?} message, arithmetic on variables holding expressions, printf %c of an empty argument, job text for arithmetic, and \n and \e prompt escapes.
* Add extensions, job control and the interactive layer; convert to C11Sean Kurtz2026-11-131-18/+36
| | | | | | | | | | | | | | | | | Language: $'...', aliases, function keyword, (( )) and let, typeset and integer, print, whence, setvar, ulimit, read -t, RANDOM, SECONDS, the ERR trap, trap -p, chdir, and more set -o names. Job control: a job table, process groups, terminal hand-over through the spawn layer, jobs/fg/bg, wait %n and kill %n. Interactive: prompt expansion, a built-in line editor with emacs and vi modes, completion, history with fc and HISTFILE, and libedit as a compile-time alternative (make EDIT=libedit LDLIBS=-ledit). The source is now C11 (was C23), uses typedef'd structs and enums, and has Doxygen comments throughout. Adds .clang-tidy, .clangd and a Doxyfile.
* zash: scripting core, test suite and benchmarksSean Kurtz2026-11-121-0/+113
A clean-slate POSIX shell for z/OS UNIX in the Almquist tradition, written in C23 for Clang (Linux) and IBM Open XL C/C++ (z/OS). - Parser, expansion, arithmetic, redirection, traps and builtins. - Spawn-first execution: fd plans instead of fork+dup2, in-shell pure builtins for pipelines and command substitution, $(a | b) without a subshell. - Flat .POSIX Makefile; asan, valgrind, bench, compdb and z/OS targets. - Tests: posix (dash-generated), zash, process accounting, linux, zos. Nothing has been compiled or run on z/OS yet.