
Raymond Toy pushed to branch issue-373-handle-temp-files at cmucl / cmucl Commits: ef48eb2a by Carl Shapiro at 2025-02-18T22:46:55-08:00 Document sap-ref-64 and signed-sap-ref-64 These functions have existed on almost all targets for many years now. - - - - - 6c8861a0 by Raymond Toy at 2025-02-20T13:55:13+00:00 Fix #384: Use correct header guard in elf.h - - - - - 5b452f9a by Raymond Toy at 2025-02-20T13:55:13+00:00 Merge branch 'issue-384-use-correct-header-guard' into 'master' Fix #384: Use correct header guard in elf.h Closes #384 See merge request cmucl/cmucl!270 - - - - - a6846d44 by Raymond Toy at 2025-02-21T03:13:50+00:00 Fix #385: Fix compiler warning about type mismatch between %p and the arg in Linux-os.c - - - - - f21c6507 by Raymond Toy at 2025-02-21T03:13:51+00:00 Merge branch 'issue-385-fix-compiler-warning-linux-os' into 'master' Fix #385: Fix compiler warning about type mismatch between %p and the arg in Linux-os.c Closes #385 See merge request cmucl/cmucl!271 - - - - - f370206e by Raymond Toy at 2025-02-21T13:25:03+00:00 Fix #365: Add Unix interface to strerror and use in get-unix-error-msg - - - - - 8ea8e2a0 by Raymond Toy at 2025-02-21T13:25:03+00:00 Merge branch 'issue-365-get-unix-error-msg-uses-strerror' into 'master' Fix #365: Add Unix interface to strerror and use in get-unix-error-msg Closes #365 See merge request cmucl/cmucl!272 - - - - - 576f422e by Raymond Toy at 2025-02-21T05:42:51-08:00 Update pot file due to changes introduced in !272 Some docstrings changed, so the pot file needs updating. Don't need to run CI for this change. [SKIP-CI] - - - - - cb65bb7e by Raymond Toy at 2025-02-21T05:52:50-08:00 Add recently closed issues to release notes Don't need CI for this change [SKIP-CI] - - - - - 490b48a3 by Raymond Toy at 2025-02-24T04:03:16+00:00 Fix #388: Analyzer stage needs cmucl-version.h - - - - - c0b4f40a by Raymond Toy at 2025-02-24T04:03:16+00:00 Merge branch 'issue-388-fix-linux-analyzer-stage' into 'master' Fix #388: Analyzer stage needs cmucl-version.h Closes #388 See merge request cmucl/cmucl!273 - - - - - bf0a4435 by Raymond Toy at 2025-02-27T22:21:25+00:00 Address #386: Group all errno symbols by OS feature - - - - - 8335d636 by Raymond Toy at 2025-02-27T22:21:25+00:00 Merge branch 'issue-386-group-errno-syms' into 'master' Address #386: Group all errno symbols by OS feature See merge request cmucl/cmucl!274 - - - - - d5c2ab6a by Raymond Toy at 2025-03-02T06:05:53-08:00 Forgot to rename UNIX-ERRNO to ERRNO In !274, we renamed the package to ERRNO, but forgot to do the renaming in a few other places in exports.lisp. Fix that. - - - - - de2abad2 by Raymond Toy at 2025-03-25T14:10:15+00:00 Fix #389: Reduce duplication in CI rules - - - - - 7aaca65e by Raymond Toy at 2025-03-25T14:10:15+00:00 Merge branch 'issue-389-reduce-duplication-in-ci-rules' into 'master' Fix #389: Reduce duplication in CI rules Closes #389 See merge request cmucl/cmucl!275 - - - - - 7e2d05db by Raymond Toy at 2025-03-30T21:16:32+00:00 Address #381: Handle OS-specific docstring in pathname.lisp - - - - - fea9f546 by Raymond Toy at 2025-03-30T21:16:32+00:00 Merge branch 'issue-381-darwin-pathname-docstring' into 'master' Address #381: Handle OS-specific docstring in pathname.lisp See merge request cmucl/cmucl!280 - - - - - e90fa5af by Raymond Toy at 2025-03-30T20:10:38-07:00 Update cmucl.pot This was updated in !280 landed and I forgot to update it there, so we're doing it now. - - - - - 78cb9dbd by Raymond Toy at 2025-05-09T06:55:39-07:00 Fix #401: FILE-POSITION returns correct position after setting it - - - - - 3e8a929d by Raymond Toy at 2025-05-09T06:55:39-07:00 Merge branch 'issue-401-file-position-setter-wrong' into 'master' Fix #401: FILE-POSITION returns correct position after setting it Closes #401 See merge request cmucl/cmucl!290 - - - - - b37ed3a9 by Raymond Toy at 2025-05-10T08:30:16-07:00 Merge branch 'master' into issue-373-handle-temp-files - - - - - 12 changed files: - .gitlab-ci.yml - src/code/exports.lisp - src/code/fd-stream.lisp - src/code/pathname.lisp - src/code/unix.lisp - src/docs/cmu-user/unix.tex - src/general-info/release-21f.md - src/i18n/locale/cmucl-unix.pot - src/i18n/locale/cmucl.pot - src/lisp/Linux-os.c - src/lisp/elf.h - tests/fd-streams.lisp Changes: ===================================== .gitlab-ci.yml ===================================== @@ -3,44 +3,38 @@ variables: version: "2024-08-x86" bootstrap: "-B boot-2024-08" - -stages: - - install - - build - - test - - ansi-test - - benchmark - - analyze - -cache: - - -linux:install: +# Default install configuration to download the cmucl tarballs to use +# for building. +.install_template: &install_configuration stage: install - tags: - - linux artifacts: paths: - snapshot/ script: - - wget -nv $download_url/cmucl-$version-linux.tar.bz2 - - wget -nv $download_url/cmucl-$version-linux.extra.tar.bz2 + - echo PATH = $PATH + - ls -F /usr/local/bin + - type -all gitlab-runner + # Download binaries. (Do we really need the extras tarball?) + - $CURL -o cmucl-$version-$osname.tar.bz2 $download_url/cmucl-$version-$osname.tar.bz2 + - $CURL -o cmucl-$version-$osname.extra.tar.bz2 $download_url/cmucl-$version-$osname.extra.tar.bz2 - mkdir snapshot - - (cd snapshot; tar xjf ../cmucl-$version-linux.tar.bz2; tar xjf ../cmucl-$version-linux.extra.tar.bz2) + - (cd snapshot; tar xjf ../cmucl-$version-$osname.tar.bz2; tar xjf ../cmucl-$version-$osname.extra.tar.bz2) -linux:build: +# Default build configuration to be added to each build stage for each +# OS. This assumes we don't need anything special between OSes, and +# the option '-C ""' is good enough. We also override the default +# build dirs by using the -b option so that we know where the results +# are, independent of OS. +.build_template: &build_configuration stage: build - tags: - - linux artifacts: paths: - dist/ - - linux-2/*.log - - linux-3/*.log - - linux-4/ - needs: - - job: linux:install - artifacts: true + - build-2/*.log + - build-3/*.log + - build-4/ + # Needed by Linux analyzer stage + - src/lisp/cmucl-version.h script: # Do cross compile first #- bin/create-target.sh xtarget x86_linux_clang @@ -49,11 +43,79 @@ linux:build: # Regular build using the cross-compiled result or snapshot. The # analyzer job requires gcc, so make sure we build with gcc here # instead of clang. - - bin/build.sh $bootstrap -R -C "x86_linux" -o snapshot/bin/lisp - # - bin/build.sh $bootstrap -R -C "x86_linux" -o snapshot/bin/lisp + - bin/build.sh $bootstrap -b build -R -C "" -o snapshot/bin/lisp # When the result of `git describe` cannot be used as a version # string, an alternative can be provided with the -V flag - - bin/make-dist.sh -I dist linux-4 + - bin/make-dist.sh -I dist build-4 + +# Default configuration for running the ansi-tests. +.ansi_test_template: &ansi_test_configuration + stage: ansi-test + artifacts: + paths: + - ansi-test/test.out + script: + - bin/run-ansi-tests.sh -l dist/bin/lisp + +# Default configuration for running unit tests. +.unit_test_template: &unit_test_configuration + stage: test + artifacts: + paths: + - ansi-test/test.out + - test.log + script: + - echo LANG = $LANG + - bin/run-unit-tests.sh -l dist/bin/lisp 2>&1 | tee test.log + +# Default configuration to test creation of lisp executable and +# testing the exectuable works. +.exec_test_template: &exec_test_configuration + stage: test + script: + # Create an executable and test it by printing the version. + - dist/bin/lisp -eval '(save-lisp "saved-lisp-executable" :executable t)' + - ./saved-lisp-executable --version + +# Default configuration for running the benchmarks. +.benchmark_template: &benchmark_configuration + stage: benchmark + artifacts: + paths: + - benchmarks/cl-bench/results + script: + - cd benchmarks/cl-bench + - mkdir tmp + - CMUCL=../../snapshot/bin/lisp ./run-cmucl.sh + - CMUCL=../../dist/bin/lisp ./run-cmucl.sh + - ../../snapshot/bin/lisp -load report + +stages: + - install + - build + - test + - ansi-test + - benchmark + - analyze + +cache: + +#### Linux jobs #### +linux:install: + <<: *install_configuration + tags: + - linux + variables: + osname: "linux" + CURL: "curl" + +linux:build: + <<: *build_configuration + tags: + - linux + needs: + - job: linux:install + artifacts: true linux:cross-build: stage: build @@ -84,31 +146,21 @@ linux:cross-build: - bin/make-dist.sh -I xdist xlinux-4 linux:test: - stage: test + <<: *unit_test_configuration tags: - linux - artifacts: - paths: - - ansi-test/test.out - - test.log needs: # Needs artifacts from build (dist/) - job: linux:build artifacts: true - script: - - bin/run-unit-tests.sh -l dist/bin/lisp 2>&1 | tee test.log linux:exec-test: - stage: test + <<: *exec_test_configuration tags: - linux needs: - job: linux:build artifacts: true - script: - # Create an executable and test it by printing the version. - - dist/bin/lisp -eval '(save-lisp "saved-lisp-executable" :executable t)' - - ./saved-lisp-executable --version linux:cross-test: stage: test @@ -126,141 +178,76 @@ linux:cross-test: - bin/run-unit-tests.sh -l xdist/bin/lisp 2>&1 | tee cross-test.log linux:ansi-test: - stage: ansi-test + <<: *ansi_test_configuration tags: - linux - artifacts: - paths: - - ansi-test/test.out needs: # Needs artifacts from build (dist/) - job: linux:build artifacts: true - script: - - bin/run-ansi-tests.sh -l dist/bin/lisp linux:benchmark: - stage: benchmark + <<: *benchmark_configuration tags: - linux - artifacts: - paths: - - benchmarks/cl-bench/results needs: # Needs artifacts from install (snapshot/) and build (dist/) - job: linux:install artifacts: true - job: linux:build - script: - - cd benchmarks/cl-bench - - mkdir tmp - - CMUCL=../../snapshot/bin/lisp ./run-cmucl.sh - - CMUCL=../../dist/bin/lisp ./run-cmucl.sh - - ../../snapshot/bin/lisp -load report +#### OSX (Mac) jobs #### osx:install: - stage: install + <<: *install_configuration tags: - macos-virtualbox - artifacts: - paths: - - snapshot/ - script: - - echo PATH = $PATH - - ls -F /usr/local/bin - - type -all gitlab-runner - - /opt/local/bin/curl -o cmucl-$version-darwin.tar.bz2 $download_url/cmucl-$version-darwin.tar.bz2 - - mkdir snapshot - - (cd snapshot; tar xjf ../cmucl-$version-darwin.tar.bz2) + variables: + osname: "darwin" + CURL: "/opt/local/bin/curl" osx:build: - stage: build + <<: *build_configuration tags: - macos-virtualbox - artifacts: - paths: - - dist/ - - darwin-2/*.log - - darwin-3/*.log - - darwin-4/*.log needs: - job: osx:install artifacts: true - script: - # Do cross compile first - #- bin/create-target.sh xtarget x86_darwin - #- bin/create-target.sh xcross x86_darwin - #- bin/cross-build-world.sh -crl -B boot-2020-04-1 xtarget xcross src/tools/cross-scripts/cross-x86-x86.lisp snapshot/bin/lisp - # Regular build using the cross-compiled result or snapshot. - # Need /opt/local/bin to get msgmerge and msgfmt programs. - - PATH=/opt/local/bin:$PATH bin/build.sh $bootstrap -R -C "" -o snapshot/bin/lisp - # If needed use -V to specify the version in case some tag makes git - # describe return something that make-dist.sh doesn't like. - - bin/make-dist.sh -I dist darwin-4 osx:test: - stage: test + <<: *unit_test_configuration tags: - macos-virtualbox - artifacts: - paths: - - ansi-test/test.out - - test.log needs: # Needs artifacts from build (dist/) - job: osx:build artifacts: true - script: - - echo LANG = $LANG - - bin/run-unit-tests.sh -l dist/bin/lisp 2>&1 | tee test.log osx:exec-test: - stage: test + <<: *exec_test_configuration tags: - macos-virtualbox needs: - job: osx:build artifacts: true - script: - # Create an executable and test it by printing the version. - - dist/bin/lisp -eval '(save-lisp "saved-lisp-executable" :executable t)' - - ./saved-lisp-executable --version osx:ansi-test: - stage: ansi-test + <<: *ansi_test_configuration tags: - macos-virtualbox - artifacts: - paths: - - ansi-test/test.out needs: # Needs artifacts from build (dist/) - job: osx:build artifacts: true - script: - # NB: sometimes we can't clone the ansi-test repo (bad cert!?!). - # Manually cloning it in the gitlab build dir helps with this - # issue until we can figure out what's going on. - - bin/run-ansi-tests.sh -l dist/bin/lisp osx:benchmark: - stage: benchmark + <<: *benchmark_configuration tags: - macos-virtualbox - artifacts: - paths: - - benchmarks/cl-bench/results needs: # Needs artifacts from install (snapshot/) and build (dist/) - job: osx:install artifacts: true - job: osx:build - script: - - cd benchmarks/cl-bench - - mkdir tmp - - CMUCL=../../snapshot/bin/lisp ./run-cmucl.sh - - CMUCL=../../dist/bin/lisp ./run-cmucl.sh - - ../../snapshot/bin/lisp -load report # Optional job that runs the static analyzer. It needs the files from # the linux-4 directory built in the linux:build job. @@ -280,75 +267,41 @@ linux:static-analyzer: # the results to the log file instead of also having it go to the # console. If someday there's less or no output, we can consider # having the logs go to the console too. - - make -C linux-4/lisp clean - - make -C linux-4/lisp CFLAGS=-fanalyzer > analyzer.log 2>&1 + - make -C build-4/lisp clean + - make -C build-4/lisp CFLAGS=-fanalyzer > analyzer.log 2>&1 +#### OpenSUSE jobs #### opensuse:install: - stage: install + <<: *install_configuration tags: - opensuse - artifacts: - paths: - - snapshot/ - script: - - wget -nv $download_url/cmucl-$version-linux.tar.bz2 - - wget -nv $download_url/cmucl-$version-linux.extra.tar.bz2 - - mkdir snapshot - - (cd snapshot; tar xjf ../cmucl-$version-linux.tar.bz2; tar xjf ../cmucl-$version-linux.extra.tar.bz2) + variables: + osname: "linux" + CURL: "curl" opensuse:build: - stage: build + <<: *build_configuration tags: - opensuse - artifacts: - paths: - - dist/ - - linux-2/*.log - - linux-3/*.log - - linux-4/ needs: - job: opensuse:install artifacts: true - script: - # Do cross compile first - #- bin/create-target.sh xtarget x86_linux_clang - #- bin/create-target.sh xcross x86_linux_clang - #- bin/cross-build-world.sh -crl -B boot-2020-04-1 xtarget xcross src/tools/cross-scripts/cross-x86-x86.lisp snapshot/bin/lisp - # Regular build using the cross-compiled result or snapshot. The - # analyzer job requires gcc, so make sure we build with gcc here - # instead of clang. - - bin/build.sh $bootstrap -R -C "x86_linux" -o snapshot/bin/lisp - # - bin/build.sh $bootstrap -R -C "x86_linux" -o snapshot/bin/lisp - # If needed use -V to specify the version in case some tag makes git - # describe return something that make-dist.sh doesn't like. - - bin/make-dist.sh -I dist linux-4 opensuse:test: - stage: test + <<: *unit_test_configuration tags: - - linux - artifacts: - paths: - - ansi-test/test.out - - test.log + - opensuse needs: # Needs artifacts from build (dist/) - job: opensuse:build artifacts: true - script: - - bin/run-unit-tests.sh -l dist/bin/lisp 2>&1 | tee test.log opensuse:ansi-test: - stage: ansi-test + <<: *ansi_test_configuration tags: - - linux - artifacts: - paths: - - ansi-test/test.out + - opensuse needs: # Needs artifacts from build (dist/) - job: opensuse:build artifacts: true - script: - - bin/run-ansi-tests.sh -l dist/bin/lisp ===================================== src/code/exports.lisp ===================================== @@ -31,6 +31,9 @@ (if (find-package "BIGNUM") (rename-package "BIGNUM" "BIGNUM" 'nil) (make-package "BIGNUM" :nicknames 'nil :use nil)) +(if (find-package "ERRNO") + (rename-package "ERRNO" "ERRNO" 'nil) + (make-package "ERRNO" :nicknames 'nil :use nil)) (if (find-package "UNIX") (rename-package "UNIX" "UNIX" 'nil) (make-package "UNIX" :nicknames 'nil :use nil)) @@ -196,6 +199,450 @@ "MULTIPLY-BIGNUM-AND-FIXNUM" "MULTIPLY-BIGNUMS" "MULTIPLY-FIXNUMS" "NEGATE-BIGNUM" "SUBTRACT-BIGNUM")) +(defpackage "ERRNO" + #+linux + (:export "E2BIG" + "EACCES" + "EADDRINUSE" + "EADDRNOTAVAIL" + "EADV" + "EAFNOSUPPORT" + "EAGAIN" + "EALREADY" + "EBADE" + "EBADF" + "EBADFD" + "EBADMSG" + "EBADR" + "EBADRQC" + "EBADSLT" + "EBFONT" + "EBUSY" + "ECHILD" + "ECHRNG" + "ECOMM" + "ECONNABORTED" + "ECONNREFUSED" + "ECONNRESET" + "EDEADLK" + "EDEADLOCK" + "EDESTADDRREQ" + "EDOM" + "EDOTDOT" + "EDQUOT" + "EEXIST" + "EFAULT" + "EFBIG" + "EHOSTDOWN" + "EHOSTUNREACH" + "EIDRM" + "EILSEQ" + "EINPROGRESS" + "EINTR" + "EINVAL" + "EIO" + "EISCONN" + "EISDIR" + "EISNAM" + "EL2HLT" + "EL2NSYNC" + "EL3HLT" + "EL3RST" + "ELIBACC" + "ELIBBAD" + "ELIBEXEC" + "ELIBMAX" + "ELIBSCN" + "ELNRNG" + "ELOOP" + "EMFILE" + "EMLINK" + "EMSGSIZE" + "EMULTIHOP" + "ENAMETOOLONG" + "ENAVAIL" + "ENETDOWN" + "ENETRESET" + "ENETUNREACH" + "ENFILE" + "ENOANO" + "ENOBUFS" + "ENOCSI" + "ENODATA" + "ENODEV" + "ENOENT" + "ENOEXEC" + "ENOLCK" + "ENOLINK" + "ENOMEM" + "ENOMSG" + "ENONET" + "ENOPKG" + "ENOPROTOOPT" + "ENOSPC" + "ENOSR" + "ENOSTR" + "ENOSYS" + "ENOTBLK" + "ENOTCONN" + "ENOTDIR" + "ENOTEMPTY" + "ENOTNAM" + "ENOTSOCK" + "ENOTTY" + "ENOTUNIQ" + "ENXIO" + "EOPNOTSUPP" + "EOVERFLOW" + "EPERM" + "EPFNOSUPPORT" + "EPIPE" + "EPROTO" + "EPROTONOSUPPORT" + "EPROTOTYPE" + "ERANGE" + "EREMCHG" + "EREMOTE" + "EREMOTEIO" + "ERESTART" + "EROFS" + "ESHUTDOWN" + "ESOCKTNOSUPPORT" + "ESPIPE" + "ESRCH" + "ESRMNT" + "ESTALE" + "ESTRPIPE" + "ESUCCESS" + "ETIME" + "ETIMEDOUT" + "ETOOMANYREFS" + "ETXTBSY" + "EUCLEAN" + "EUNATCH" + "EUSERS" + "EWOULDBLOCK" + "EXDEV" + "EXFULL" + ) + #+(or bsd darwin) + (:export "E2BIG" + "EACCES" + "EADDRINUSE" + "EADDRNOTAVAIL" + "EAFNOSUPPORT" + "EAGAIN" + "EALREADY" + "EBADF" + "EBUSY" + "ECHILD" + "ECONNABORTED" + "ECONNREFUSED" + "ECONNRESET" + "EDEADLK" + "EDESTADDRREQ" + "EDOM" + "EDQUOT" + "EEXIST" + "EFAULT" + "EFBIG" + "EHOSTDOWN" + "EHOSTUNREACH" + "EINPROGRESS" + "EINTR" + "EINVAL" + "EIO" + "EISCONN" + "EISDIR" + "ELOCAL" + "ELOOP" + "EMFILE" + "EMLINK" + "EMSGSIZE" + "ENAMETOOLONG" + "ENETDOWN" + "ENETRESET" + "ENETUNREACH" + "ENFILE" + "ENOBUFS" + "ENODEV" + "ENOENT" + "ENOEXEC" + "ENOMEM" + "ENOPROTOOPT" + "ENOSPC" + "ENOTBLK" + "ENOTCONN" + "ENOTDIR" + "ENOTEMPTY" + "ENOTSOCK" + "ENOTTY" + "ENXIO" + "EOPNOTSUPP" + "EPERM" + "EPFNOSUPPORT" + "EPIPE" + "EPROCLIM" + "EPROTONOSUPPORT" + "EPROTOTYPE" + "ERANGE" + "EREMOTE" + "EROFS" + "ESHUTDOWN" + "ESOCKTNOSUPPORT" + "ESPIPE" + "ESRCH" + "ESUCCESS" + "ETIMEDOUT" + "ETOOMANYREFS" + "ETXTBSY" + "EUSERS" + "EVICEERR" + "EVICEOP" + "EWOULDBLOCK" + "EXDEV" + ) + #+solaris + (:export "E2BIG" + "EACCES" + "EADDRINUSE" + "EADDRNOTAVAIL" + "EADV" + "EAFNOSUPPORT" + "EAGAIN" + "EALREADY" + "EBADE" + "EBADF" + "EBADFD" + "EBADMSG" + "EBADR" + "EBADRQC" + "EBADSLT" + "EBFONT" + "EBUSY" + "ECANCELED" + "ECHILD" + "ECHRNG" + "ECOMM" + "ECONNABORTED" + "ECONNREFUSED" + "ECONNRESET" + "EDEADLK" + "EDEADLOCK" + "EDESTADDRREQ" + "EDOM" + "EEXIST" + "EFAULT" + "EFBIG" + "EHOSTDOWN" + "EHOSTUNREACH" + "EIDRM" + "EILSEQ" + "EINPROGRESS" + "EINTR" + "EINVAL" + "EIO" + "EISCONN" + "EISDIR" + "EL2HLT" + "EL2NSYNC" + "EL3HLT" + "EL3RST" + "ELIBACC" + "ELIBBAD" + "ELIBEXEC" + "ELIBMAX" + "ELIBSCN" + "ELNRNG" + "ELOOP" + "EMFILE" + "EMLINK" + "EMSGSIZE" + "EMULTIHOP" + "ENAMETOOLONG" + "ENETDOWN" + "ENETRESET" + "ENETUNREACH" + "ENFILE" + "ENOANO" + "ENOBUFS" + "ENOCSI" + "ENODATA" + "ENODEV" + "ENOENT" + "ENOEXEC" + "ENOLCK" + "ENOLINK" + "ENOMEM" + "ENOMSG" + "ENONET" + "ENOPKG" + "ENOPROTOOPT" + "ENOSPC" + "ENOSR" + "ENOSTR" + "ENOSYS" + "ENOTBLK" + "ENOTCONN" + "ENOTDIR" + "ENOTEMPTY" + "ENOTSOCK" + "ENOTSUP" + "ENOTTY" + "ENOTUNIQ" + "ENXIO" + "EOPNOTSUPP" + "EOVERFLOW" + "EPERM" + "EPFNOSUPPORT" + "EPIPE" + "EPROTO" + "EPROTONOSUPPORT" + "EPROTOTYPE" + "ERANGE" + "EREMCHG" + "EREMOTE" + "ERESTART" + "EROFS" + "ESHUTDOWN" + "ESOCKTNOSUPPORT" + "ESPIPE" + "ESRCH" + "ESRMNT" + "ESTALE" + "ESTRPIPE" + "ESUCCESS" + "ETIME" + "ETIMEDOUT" + "ETOOMANYREFS" + "ETXTBSY" + "EUNATCH" + "EUSERS" + "EWOULDBLOCK" + "EXDEV" + "EXFULL" + ) + #-(or linux solaris bsd darwin) + (:export "E2BIG" + "EACCES" + "EADDRINUSE" + "EADDRNOTAVAIL" + "EADV" + "EAFNOSUPPORT" + "EAGAIN" + "EALREADY" + "EBADE" + "EBADF" + "EBADFD" + "EBADMSG" + "EBADR" + "EBADRQC" + "EBADSLT" + "EBFONT" + "EBUSY" + "ECANCELED" + "ECHILD" + "ECHRNG" + "ECOMM" + "ECONNABORTED" + "ECONNREFUSED" + "ECONNRESET" + "EDEADLK" + "EDEADLOCK" + "EDESTADDRREQ" + "EDOM" + "EEXIST" + "EFAULT" + "EFBIG" + "EHOSTDOWN" + "EHOSTUNREACH" + "EIDRM" + "EILSEQ" + "EINPROGRESS" + "EINTR" + "EINVAL" + "EIO" + "EISCONN" + "EISDIR" + "EL2HLT" + "EL2NSYNC" + "EL3HLT" + "EL3RST" + "ELIBACC" + "ELIBBAD" + "ELIBEXEC" + "ELIBMAX" + "ELIBSCN" + "ELNRNG" + "ELOOP" + "EMFILE" + "EMLINK" + "EMSGSIZE" + "EMULTIHOP" + "ENAMETOOLONG" + "ENETDOWN" + "ENETRESET" + "ENETUNREACH" + "ENFILE" + "ENOANO" + "ENOBUFS" + "ENOCSI" + "ENODATA" + "ENODEV" + "ENOENT" + "ENOEXEC" + "ENOLCK" + "ENOLINK" + "ENOMEM" + "ENOMSG" + "ENONET" + "ENOPKG" + "ENOPROTOOPT" + "ENOSPC" + "ENOSR" + "ENOSTR" + "ENOSYS" + "ENOTBLK" + "ENOTCONN" + "ENOTDIR" + "ENOTEMPTY" + "ENOTSOCK" + "ENOTSUP" + "ENOTTY" + "ENOTUNIQ" + "ENXIO" + "EOPNOTSUPP" + "EOVERFLOW" + "EPERM" + "EPFNOSUPPORT" + "EPIPE" + "EPROTO" + "EPROTONOSUPPORT" + "EPROTOTYPE" + "ERANGE" + "EREMCHG" + "EREMOTE" + "ERESTART" + "EROFS" + "ESHUTDOWN" + "ESOCKTNOSUPPORT" + "ESPIPE" + "ESRCH" + "ESRMNT" + "ESTALE" + "ESTRPIPE" + "ESUCCESS" + "ETIME" + "ETIMEDOUT" + "ETOOMANYREFS" + "ETXTBSY" + "EUNATCH" + "EUSERS" + "EWOULDBLOCK" + "EXDEV" + "EXFULL" + )) + (defpackage "UNIX" (:export "UNIX-CURRENT-DIRECTORY" "UNIX-OPEN" @@ -309,18 +756,8 @@ ;; Other symbols from structures, etc. "C-CC" "C-CFLAG" "C-IFLAG" "C-ISPEED" "C-LFLAG" "C-OFLAG" "C-OSPEED" - "CHECK" "D-NAME" "D-RECLEN" "E2BIG" "EACCES" "EADDRINUSE" "EADDRNOTAVAIL" - "EAFNOSUPPORT" "EAGAIN" "EALREADY" "EBADF" "EBUSY" "ECHILD" - "ECONNABORTED" "ECONNREFUSED" "ECONNRESET" "EDEADLK" "EDESTADDRREQ" - "EDOM" "EDQUOT" "EEXIST" "EFAULT" "EFBIG" "EHOSTDOWN" "EHOSTUNREACH" - "EINPROGRESS" "EINTR" "EINVAL" "EIO" "EISCONN" "EISDIR" "ELOOP" "EMFILE" - "EMLINK" "EMSGSIZE" "ENAMETOOLONG" "ENETDOWN" "ENETRESET" "ENETUNREACH" - "ENFILE" "ENOBUFS" "ENODEV" "ENOENT" "ENOEXEC" "ENOMEM" "ENOPROTOOPT" - "ENOSPC" "ENOTBLK" "ENOTCONN" "ENOTDIR" "ENOTEMPTY" "ENOTSOCK" "ENOTTY" - "ENXIO" "EOPNOTSUPP" "EPERM" "EPFNOSUPPORT" "EPIPE" "EPROTONOSUPPORT" - "EPROTOTYPE" "ERANGE" "EREMOTE" "EROFS" "ESHUTDOWN" "ESOCKTNOSUPPORT" - "ESPIPE" "ESRCH" "ESUCCESS" "ETIMEDOUT" "ETOOMANYREFS" "ETXTBSY" "EUSERS" - "EWOULDBLOCK" "EXDEV" "F-GETFL" "F-GETOWN" "F-SETFL" "F-SETOWN" "FAPPEND" + "CHECK" "D-NAME" "D-RECLEN" + "F-GETFL" "F-GETOWN" "F-SETFL" "F-SETOWN" "FAPPEND" "FASYNC" "FD-SET" "FD-ZERO" "FNDELAY" "F_OK" "GID-T" "IT-INTERVAL" "IT-VALUE" "ITIMERVAL" "L_INCR" "L_SET" "L_XTND" "MAP_ANONYMOUS" "MAP_FIXED" "MAP_PRIVATE" "MAP_SHARED" "MS_ASYNC" "MS_INVALIDATE" @@ -368,7 +805,6 @@ (:export "TCHARS" "LTCHARS" "D-NAMLEN" - ;; run-program.lisp "SGTTYB" @@ -396,14 +832,8 @@ "SGTTYB" ;; Other symbols - "BLKCNT-T" "D-INO" "D-OFF" "EADV" "EBADE" "EBADFD" "EBADMSG" "EBADR" - "EBADRQC" "EBADSLT" "EBFONT" "ECHRNG" "ECOMM" "EDEADLOCK" "EDOTDOT" - "EIDRM" "EILSEQ" "EISNAM" "EL2HLT" "EL2NSYNC" "EL3HLT" "EL3RST" "ELIBACC" - "ELIBBAD" "ELIBEXEC" "ELIBMAX" "ELIBSCN" "ELNRNG" "EMULTIHOP" "ENAVAIL" - "ENOANO" "ENOCSI" "ENODATA" "ENOLCK" "ENOLINK" "ENOMSG" "ENONET" "ENOPKG" - "ENOSR" "ENOSTR" "ENOSYS" "ENOTNAM" "ENOTUNIQ" "EOVERFLOW" "EPROTO" - "EREMCHG" "EREMOTEIO" "ERESTART" "ESRMNT" "ESTALE" "ESTRPIPE" "ETIME" - "EUCLEAN" "EUNATCH" "EXFULL" "O_NOCTTY" "SIGSTKFLT" + "BLKCNT-T" "D-INO" "D-OFF" + "O_NOCTTY" "SIGSTKFLT" "SG-FLAGS" "TIOCGETP" "TIOCSETP" @@ -416,57 +846,10 @@ (:export "D-INO" "D-OFF" "DIRECT" - "EADV" - "EBADE" - "EBADFD" - "EBADMSG" - "EBADR" - "EBADRQC" - "EBADSLT" - "EBFONT" - "ECANCELED" - "ECHRNG" - "ECOMM" - "EDEADLOCK" - "EIDRM" - "EILSEQ" - "EL2HLT" - "EL2NSYNC" - "EL3HLT" - "EL3RST" - "ELIBACC" - "ELIBBAD" - "ELIBEXEC" - "ELIBMAX" - "ELIBSCN" - "ELNRNG" - "EMULTIHOP" - "ENOANO" - "ENOCSI" - "ENODATA" - "ENOLCK" - "ENOLINK" - "ENOMSG" - "ENONET" - "ENOPKG" - "ENOSR" - "ENOSTR" - "ENOSYS" - "ENOTSUP" - "ENOTUNIQ" - "EOVERFLOW" - "EPROTO" - "EREMCHG" - "ERESTART" - "ESRMNT" - "ESTALE" - "ESTRPIPE" - "ETIME" - "EUNATCH" "EXECGRP" "EXECOTH" "EXECOWN" - "EXFULL" + "F-DUPFD" "F-GETFD" "F-SETFD" @@ -553,7 +936,15 @@ "WRITEGRP" "WRITEOTH" "XMT1EN" - )) + ) + ) + +;; Import all of the symbols from UNIX-ERRNO into UNIX and the export +;; them. +(ext:without-package-locks + (do-external-symbols (sym "ERRNO") + (shadowing-import sym "UNIX") + (export sym "UNIX"))) (defpackage "FORMAT") ===================================== src/code/fd-stream.lisp ===================================== @@ -1764,7 +1764,8 @@ (progn (format t "in-buffer-length = ~D~%" in-buffer-length) (format t "in-length = ~D~%" (fd-stream-in-length stream)) - (format t "fd-stream-in-index = ~D~%" (fd-stream-in-index stream))) + (format t "fd-stream-in-index = ~D~%" (fd-stream-in-index stream)) + (format t "posn = ~A~%" posn)) (decf posn (- (fd-stream-in-length stream) (fd-stream-in-index stream)))) #+nil @@ -1795,9 +1796,14 @@ (setf (fd-stream-unread stream) nil) ;;@@ #+unicode (progn + ;; Clear out any pending input from the string buffer (setf (fd-stream-last-char-read-size stream) 0) (setf (fd-stream-string-index stream) (fd-stream-string-buffer-len stream))) + ;; Mark the in-buffer as empty. + (setf (fd-stream-in-index stream) + (fd-stream-in-length stream)) + ;; Mark the ibuf as empty. (setf (fd-stream-ibuf-head stream) 0) (setf (fd-stream-ibuf-tail stream) 0) ;; Trash cached value for listen, so that we check next time. ===================================== src/code/pathname.lisp ===================================== @@ -269,7 +269,7 @@ #+darwin (defvar *enable-darwin-path-normalization* nil - "When non-NIL, pathnames are on Darwin are normalized when created. + _N"When non-NIL, pathnames are on Darwin are normalized when created. Otherwise, the pathnames are unchanged. This must be NIL during bootstrapping because Unicode is not yet ===================================== src/code/unix.lisp ===================================== @@ -2053,9 +2053,7 @@ _N"Returns a string describing the error number which was returned by a UNIX system call." (declare (type integer error-number)) - (if (array-in-bounds-p *unix-errors* error-number) - (svref *unix-errors* error-number) - (format nil _"Unknown error [~d]" error-number))) + (unix::unix-strerror error-number)) ;;;; Lisp types used by syscalls. @@ -2975,3 +2973,14 @@ (if (null-alien result) (values nil (unix-errno)) (%file->name (cast result c-call:c-string))))))) + +(defun unix-strerror (errno) + _N"Returns a string that describes the error code Errno" + (let ((result + (alien-funcall + (extern-alien "strerror" + (function (* char) int)) + errno))) + ;; Result from strerror can be localized so we need to decode + ;; those octets to get a proper Lisp string. + (string-decode (cast result c-string) :default))) ===================================== src/docs/cmu-user/unix.tex ===================================== @@ -244,9 +244,10 @@ for SAPs when possible, so the consing overhead is generally minimal. \begin{defun}{system:}{sap-ref-8}{\args{\var{sap} \var{offset}}} \defunx[system:]{sap-ref-16}{\args{\var{sap} \var{offset}}} - \defunx[system:]{sap-ref-32}{\args{\var{sap} \var{offset}}} - - These functions return the 8, 16 or 32 bit unsigned integer at + \defunx[system:]{sap-ref-32}{\args{\var{sap} \var{offset}} + \defunx[system:]{sap-ref-64}{\args{\var{sap} \var{offset}}} + + These functions return the 8, 16, 32 or 64 bit unsigned integer at \var{offset} from \var{sap}. The \var{offset} is always a byte offset, regardless of the number of bits accessed. \code{setf} may be used with the these functions to deposit values into virtual @@ -256,7 +257,8 @@ for SAPs when possible, so the consing overhead is generally minimal. \begin{defun}{system:}{signed-sap-ref-8}{\args{\var{sap} \var{offset}}} \defunx[system:]{signed-sap-ref-16}{\args{\var{sap} \var{offset}}} \defunx[system:]{signed-sap-ref-32}{\args{\var{sap} \var{offset}}} - + \defunx[system:]{signed-sap-ref-64}{\args{\var{sap} \var{offset}}} + These functions are the same as the above unsigned operations, except that they sign-extend, returning a negative number if the high bit is set. ===================================== src/general-info/release-21f.md ===================================== @@ -117,9 +117,12 @@ public domain. * ~~#363~~ Version numbers added to files and directories. The distribution layout has changed. * ~~#364~~ Add interface to `mkdtemp` and `mkstemp` - * ~~#367~~ Add stream:string-count-octets to count octets in a string + * ~~#367~~ Add `stream:string-count-octets` to count octets in a string * ~~#369~~ Improve docstring for `unix::unix-setlocale` + * ~~#375~~ `unix-mkstemp` and `unix-mkdtemp` actually returns the + file names now. * ~~#379~~ Support GNU-style command-line option names + * ~~#382~~ Command-line options are case-sensitive * Other changes: * Improvements to the PCL implementation of CLOS: * Changes to building procedure: ===================================== src/i18n/locale/cmucl-unix.pot ===================================== @@ -1284,10 +1284,6 @@ msgid "" " UNIX system call." msgstr "" -#: src/code/unix.lisp -msgid "Unknown error [~d]" -msgstr "" - #: src/code/unix.lisp msgid "" "Perform the UNIX select(2) system call.\n" @@ -1454,3 +1450,7 @@ msgid "" " returned." msgstr "" +#: src/code/unix.lisp +msgid "Returns a string that describes the error code Errno" +msgstr "" + ===================================== src/i18n/locale/cmucl.pot ===================================== @@ -9667,6 +9667,15 @@ msgid "" " an otherwise undefined logical host." msgstr "" +#: src/code/pathname.lisp +msgid "" +"When non-NIL, pathnames are on Darwin are normalized when created.\n" +" Otherwise, the pathnames are unchanged.\n" +"\n" +" This must be NIL during bootstrapping because Unicode is not yet\n" +" available." +msgstr "" + #: src/code/pathname.lisp msgid "A path specification, either a string, file-stream or pathname." msgstr "" ===================================== src/lisp/Linux-os.c ===================================== @@ -476,7 +476,7 @@ sigsegv_handler(HANDLER_ARGS) #endif if (gc_write_barrier(code->si_addr)) return; - DPRINTF(0, (stderr, "sigsegv: PC: %p\n", SC_PC(os_context))); + DPRINTF(0, (stderr, "sigsegv: PC: %#lx\n", SC_PC(os_context))); #ifdef RED_ZONE_HIT { ===================================== src/lisp/elf.h ===================================== @@ -9,7 +9,7 @@ * interface to both elf and mach-o support. I (rtoy) was too lazy to * change the name to something more descriptive. */ -#if !defined(_ELF_H_INCLUDED_) +#if !defined(ELF_H_INCLUDED) #define ELF_H_INCLUDED ===================================== tests/fd-streams.lisp ===================================== @@ -36,19 +36,58 @@ (file-length s)) (delete-file *test-file*)))) -(define-test clear-output-1 - (:tag :trac) - (assert-eql - 0 - (ext:with-temporary-file (test-file) - (let ((s (open test-file - :direction :output - :if-exists :supersede))) - ;; Write a character to the (fully buffered) output - ;; stream. Clear the output and close the file. Nothing - ;; should have been written to the file. - (write-char #\a s) - (clear-output s) - (close s) - (setf s (open test-file)) - (file-length s))))) +(define-test file-position.1 + (:tag :issues) + ;; Create a short test file + (let ((test-file (merge-pathnames #p"file-pos.txt" *test-path*))) + (with-open-file (s test-file + :direction :output + :if-exists :supersede) + (write-string "aaaaaa" s) + (write-char #\newline s)) + (with-open-file (s test-file) + (read-line s) + (assert-true (file-position s 0)) + (assert-equal (file-position s) 0)))) + +(define-test file-position.2 + (:tag :issues) + ;; Create a test file just longer than the internal in-buffer length + ;; and the first line is more than 512 characters long. + (let ((test-file (merge-pathnames #p"file-pos.txt" *test-path*))) + (with-open-file (s test-file + :direction :output + :if-exists :supersede) + (write-string (make-string 512 :initial-element #\a) s) + (write-char #\newline s) + (write-string "zzzzz" s) + (write-char #\newline s)) + (with-open-file (s test-file) + (read-line s) + (assert-true (file-position s 0)) + (assert-equal (file-position s) 0)))) + +(define-test file-position.3 + (:tag :issues) + ;; Create a test file just longer than the internal in-buffer + ;; length. This tests the case where the in-buffer does not have + ;; enough octets to form a complete character. (See comment in + ;; fd-stream-file-position. + (let ((test-file (merge-pathnames #p"file-pos.txt" *test-path*))) + (with-open-file (s test-file + :external-format :utf-8 + :direction :output + :if-exists :supersede) + (write-char #\a s) + ;; STR is a string consisting of the single codepoint #x11000 + ;; which is 4 octets when encoded using utf-8. + (let ((str (lisp::codepoints-string '(#x11000)))) + (dotimes (k 128) + (write-string str s))) + (write-char #\newline s) + (write-string "zzzzz" s) + (write-char #\newline s)) + (with-open-file (s test-file :external-format :utf-8) + (read-line s) + (assert-true (file-position s 0)) + (assert-equal (file-position s) 0)))) View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/087eb17fc9bd72d49b43e53... -- View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/087eb17fc9bd72d49b43e53... You're receiving this email because of your account on gitlab.common-lisp.net.