From e53f7ca2cb7880ca4f6acfaedb020c2523eaf105 Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Tue, 18 Mar 2014 11:33:41 +0000 Subject: [PATCH 01/18] gnu: base: Added glibc/hurd * gnu/packages/base.scm (glibc/hurd): Added glibc/hurd gnu: crossbase: Added cross-toolchain for the hurd * gnu/packages/crossbase.scm (cross-gcc/hurd): Added a new cross-gcc so I can try different config flags * gnu/packages/crossbase.scm (cross-mig): Added cross-mig because it is need to build the headers * gnu/packages/crossbase.scm (cross-libc/hurd): Added cross-libc/hurd --- gnu/packages/base.scm | 111 ++++++++++++++++++++++++ gnu/packages/cross-base.scm | 205 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 316 insertions(+) diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index e17933b..ea90c27 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -30,6 +30,10 @@ #:use-module (gnu packages guile) #:use-module (gnu packages multiprecision) #:use-module (gnu packages perl) + #:use-module (gnu packages perl) + #:use-module (guix git-download) + #:use-module (gnu packages autotools) + #:use-module (gnu packages hurd) #:use-module (gnu packages linux) #:use-module (guix packages) #:use-module (guix download) @@ -484,6 +488,113 @@ with the Linux kernel.") (license lgpl2.0+) (home-page "http://www.gnu.org/software/libc/"))) +(define-public glibc/hurd + (package (inherit glibc) + (name "glibc-hurd") + (source (origin + (method git-fetch) + (uri (git-reference + (url "git://git.sv.gnu.org/hurd/glibc") + (commit "bdb7a18d78b04ac3ef7a2d905485500f13bb69fb"))) + (sha256 + (base32 + "0v4hy6yimshbvhbhdbbjdir5fm3xr56zj3lnpf01d4nfa0c1h8k1")) + + )) + (propagated-inputs `(("gnumach-headers" ,gnumach-headers) + ("hurd-headers" ,hurd-headers))) + (native-inputs + `( + ("patch/glibc-make" ,(search-patch "glibc-make-4.0.patch")) + ("mig" ,mig) + ("perl" ,perl) + ("autoconf" ,autoconf-wrapper) + ("automake" ,automake) + ("libpthread" ,(origin + (method git-fetch) + (uri (git-reference + (url "git://git.sv.gnu.org/hurd/libpthread") + (commit "fa9eb2c255e1d46beadcd81edd459b9c3d7dcb8c"))) + (sha256 + (base32 + "0bb8m0pk7b53sww4ahjds77bvqy0alz54g3aylzwncfca52gacqp")) + (file-name "libpthread" ))))) + + (arguments + `(#:out-of-source? #t + #:configure-flags + (list "--without-cvs" + "--enable-add-ons=" + ;;"--sysconfdir=/etc" + "--disable-profile" + "--disable-multi-arch" + + (string-append "libc_cv_localedir=" + (assoc-ref %outputs "locales") + "/share/locale") + + ;; Use our Bash instead of /bin/sh. + (string-append "BASH_SHELL=" + (assoc-ref %build-inputs "bash") + "/bin/bash")) + + #:phases (alist-cons-before + 'pre-configure 'autoconf + (lambda _ + (system* "autoreconf" "-vi" "libpthread")) + (alist-cons-before + 'configure 'pre-configure + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (bin (string-append out "/bin"))) + ;; Use `pwd', not `/bin/pwd'. + (substitute* "configure" + (("/bin/pwd") "pwd")) + + ;; Copy a statically-linked Bash in the output, with + ;; no references to other store paths. + (mkdir-p bin) + (copy-file (string-append (assoc-ref inputs "static-bash") + "/bin/bash") + (string-append bin "/bash")) + (remove-store-references (string-append bin "/bash")) + (chmod (string-append bin "/bash") #o555) + + ;; Keep a symlink, for `patch-shebang' resolution. + (with-directory-excursion bin + (symlink "bash" "sh")) + + ;; Have `system' use that Bash. + (substitute* "sysdeps/posix/system.c" + (("#define[[:blank:]]+SHELL_PATH.*$") + (format #f "#define SHELL_PATH \"~a/bin/bash\"\n" + out))) + + ;; Same for `popen'. + (substitute* "libio/iopopen.c" + (("/bin/sh") + (string-append out "/bin/bash"))))) + (alist-cons-after + 'install 'install-locales + (lambda _ + (zero? (system* "make" "localedata/install-locales"))) + + (alist-cons-after + 'unpack 'apply-patch + (lambda _ + (zero? (system* "patch" "-p1" "-i" (assoc-ref %build-inputs "patch/glibc-make")))) + (alist-replace + 'unpack + ;; FIXME: Remove this when gnu-build-system handles that + ;; case correctly. + (lambda* (#:key inputs source #:allow-other-keys) + (mkdir "source") + (chdir "source") + (copy-recursively source ".") + (copy-recursively (assoc-ref inputs "libpthread") "libpthread") + #t) + %standard-phases))))))) )) + (define-public tzdata (package (name "tzdata") diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 41128b7..2dad637 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -21,6 +21,10 @@ #:use-module (gnu packages) #:use-module (gnu packages gcc) #:use-module (gnu packages base) + #:use-module (gnu packages perl);; + #:use-module (guix git-download);; + #:use-module (gnu packages autotools);; + #:use-module (gnu packages hurd) #:use-module (gnu packages linux) #:use-module (guix packages) #:use-module (guix download) @@ -256,6 +260,207 @@ XBINUTILS and the cross tool chain." ("cross-binutils" ,xbinutils) ,@(package-native-inputs glibc))))) +(define* (cross-gcc/hurd target + #:optional (xbinutils (cross-binutils target)) libc) + "Return a cross-compiler for TARGET, where TARGET is a GNU triplet. Use +XBINUTILS as the associated cross-Binutils. If LIBC is false, then build a +GCC that does not target a libc; otherwise, target that libc." + (package (inherit gcc-4.8) + (name (string-append "gcc-cross-hurd-" + (if libc "" "sans-libc-") + target)) + (source (origin (inherit (package-source gcc-4.8)) + (patches + (list (search-patch "gcc-cross-environment-variables.patch"))))) + (arguments + `(#:implicit-inputs? #f + #:modules ((guix build gnu-build-system) + (guix build utils) + (ice-9 regex) + (srfi srfi-1) + (srfi srfi-26)) + + ,@(substitute-keyword-arguments (package-arguments gcc-4.8) + ((#:configure-flags flags) + `(append (list ,(string-append "--target=" target) + ,@(gcc-configure-flags-for-triplet target) + ,@(if libc + '() + `( + ;; Disable features not needed at this stage. + "--disable-shared" "--enable-static" + "--without-headers" + + ;; Disable C++ because libstdc++'s + ;; configure script otherwise fails with + ;; "Link tests are not allowed after + ;; GCC_NO_EXECUTABLES." + "--enable-languages=c" + + ;; Disabling things according to other hurd building + ;; scripts I saw, I will explain everything with my final patch + + "--disable-threads" ; libgcc, would need libc + "--disable-libatomic" + "--disable-libmudflap" + "--disable-libgomp" + "--disable-libssp" + "--disable-libquadmath" + "--disable-decimal-float" ; would need libc + "--with-arch=i686" + ))) + + ,(if libc + flags + `(remove (cut string-match "--enable-languages.*" <>) + ,flags)))) + ((#:make-flags flags) + (if libc + `(let ((libc (assoc-ref %build-inputs "libc"))) + ;; FLAGS_FOR_TARGET are needed for the target libraries to + ;; receive the -Bxxx for the startfiles. + (cons (string-append "FLAGS_FOR_TARGET=-B" libc "/lib") + ,flags)) + flags)) + ((#:phases phases) + (let ((phases + `(alist-cons-after + 'install 'make-cross-binutils-visible + (lambda* (#:key outputs inputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (libexec (string-append out "/libexec/gcc/" + ,target)) + (binutils (string-append + (assoc-ref inputs "binutils-cross") + "/bin/" ,target "-"))) + (for-each (lambda (file) + (symlink (string-append binutils file) + (string-append libexec "/" + file))) + '("as" "ld" "nm")) + #t)) + ,phases)))phases));;) + ((#:strip-binaries? _) + ;; Disable stripping as this can break binaries, with object files + ;; of libgcc.a showing up as having an unknown architecture. See + ;; + ;; for instance. + #f)))) + + (native-inputs + `(("binutils-cross" ,xbinutils) + + ;; Call it differently so that the builder can check whether the "libc" + ;; input is #f. + ("libc-native" ,@(assoc-ref %final-inputs "libc")) + + ;; Remaining inputs. + ,@(let ((inputs (append (package-inputs gcc-4.8) + (alist-delete "libc" %final-inputs)))) + (if libc + `(("libc" ,libc) + ,@inputs) + inputs)))) + + (inputs '()) + + ;; Only search target inputs, not host inputs. + (search-paths + (list (search-path-specification + (variable "CROSS_CPATH") + (directories '("include"))) + (search-path-specification + (variable "CROSS_LIBRARY_PATH") + (directories '("lib" "lib64"))))) + (native-search-paths '()))) + +(define* (cross-mig target + #:optional + (xgcc (cross-gcc/hurd target)) + (xbinutils (cross-binutils target))) + + (define xgnumach-headers + (package (inherit gnumach-headers) + (name (string-append (package-name gnumach-headers) + "-cross-" target)) + + (native-inputs `(("cross-gcc-hurd" ,xgcc) + ("cross-binutils" ,xbinutils) + ,@(package-native-inputs gnumach-headers))))) + + (package (inherit mig) + (name (string-append "mig-cross")) + (arguments + (substitute-keyword-arguments (package-arguments mig) + ((#:configure-flags flags) + `(cons ,(string-append "--target=" target) + ,flags)) + )) + (propagated-inputs `(("cross-gnumach-headers" ,xgnumach-headers))) + (native-inputs `(("cross-gcc-hurd" ,xgcc) + ("cross-binutils" ,xbinutils) + ,@(package-native-inputs mig))))) + +(define* (cross-libc/hurd target + #:optional + (xgcc (cross-gcc/hurd target)) + (xbinutils (cross-binutils target)) + (xmig (cross-mig target))) + "Return a libc cross-built for TARGET, a GNU triplet. Use XGCC and +XBINUTILS and the cross tool chain." + + (define xgnumach-headers + (package (inherit gnumach-headers) + (name (string-append (package-name gnumach-headers) + "-cross-" target)) + + (native-inputs `(("cross-gcc-hurd" ,xgcc) + ("cross-binutils" ,xbinutils) + ,@(package-native-inputs gnumach-headers))))) + + (define xhurd-headers + (package (inherit hurd-headers) + (name (string-append (package-name hurd-headers) + "-cross-" target)) + + ;;removing the --host flag because I am getting the error that gcc cannot produce executables + (arguments + (substitute-keyword-arguments + `(#:modules ((guix build gnu-build-system) + (guix build utils) + (ice-9 regex) + (srfi srfi-1) + (srfi srfi-26)) + ,@(package-arguments hurd-headers)) + ((#:configure-flags flags) + `(remove (cut string-match "--host.*" <>) + ,flags)))) + (native-inputs `(("cross-gcc-hurd" ,xgcc) + ("cross-binutils" ,xbinutils) + ("cross-mig" ,xmig) + ,@(alist-delete "mig"(package-native-inputs hurd-headers)))))) + + + (package (inherit glibc/hurd) + (name (string-append "glibc-hurd-cross-" target)) + (arguments + (substitute-keyword-arguments + `(#:strip-binaries? #f ; disable stripping (see above) + ,@(package-arguments glibc/hurd)) + ((#:configure-flags flags) + `(cons ,(string-append "--target=" target) + ,flags)))) + + (propagated-inputs `(("cross-gnumach-headers" ,xgnumach-headers) + ("cross-hurd-headers" ,xhurd-headers))) + + (native-inputs `(("cross-gcc-hurd" ,xgcc) + ("cross-binutils" ,xbinutils) + ("cross-mig" ,xmig) + ,@(alist-delete "mig"(package-native-inputs glibc/hurd)))) + + )) + ;;; ;;; Concrete cross toolchains. -- 1.9.0 From 76b8bf336de89025b77c6f6a1c28cc97310ae0a2 Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Thu, 20 Mar 2014 23:57:29 +0000 Subject: [PATCH 02/18] added hurd-minimal --- gnu/packages/base.scm | 11 +++++--- gnu/packages/cross-base.scm | 69 +++++++++++++++++++++++++++++++++++++-------- gnu/packages/hurd.scm | 45 +++++++++++++++++++++++++++++ 3 files changed, 110 insertions(+), 15 deletions(-) diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index ea90c27..a998ff1 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -510,6 +510,8 @@ with the Linux kernel.") ("perl" ,perl) ("autoconf" ,autoconf-wrapper) ("automake" ,automake) + ("libtool" ,libtool) + ("libtool" ,libtool "bin") ("libpthread" ,(origin (method git-fetch) (uri (git-reference @@ -518,17 +520,18 @@ with the Linux kernel.") (sha256 (base32 "0bb8m0pk7b53sww4ahjds77bvqy0alz54g3aylzwncfca52gacqp")) - (file-name "libpthread" ))))) + (file-name "libpthread" ))))) (arguments `(#:out-of-source? #t #:configure-flags (list "--without-cvs" - "--enable-add-ons=" + "--enable-add-ons=libpthread" + "--build=i686-pc-gnu" ;;"--sysconfdir=/etc" "--disable-profile" "--disable-multi-arch" - + "--disable-sanity-checks" (string-append "libc_cv_localedir=" (assoc-ref %outputs "locales") "/share/locale") @@ -541,7 +544,7 @@ with the Linux kernel.") #:phases (alist-cons-before 'pre-configure 'autoconf (lambda _ - (system* "autoreconf" "-vi" "libpthread")) + (system* "autoreconf" "-vif" "libpthread")) (alist-cons-before 'configure 'pre-configure (lambda* (#:key inputs outputs #:allow-other-keys) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 2dad637..bc56f49 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -424,17 +424,63 @@ XBINUTILS and the cross tool chain." "-cross-" target)) ;;removing the --host flag because I am getting the error that gcc cannot produce executables + ;; (arguments + ;; (substitute-keyword-arguments + ;; `(#:modules ((guix build gnu-build-system) + ;; (guix build utils) + ;; (ice-9 regex) + ;; (srfi srfi-1) + ;; (srfi srfi-26)) + ;; ,@(package-arguments hurd-headers)) + ;; ((#:configure-flags flags) + ;; `(remove (cut string-match "--host.*" <>) + ;; ,(cons ,(string-append "--target=" target) + ;; ,flags))))) (arguments - (substitute-keyword-arguments - `(#:modules ((guix build gnu-build-system) - (guix build utils) - (ice-9 regex) - (srfi srfi-1) - (srfi srfi-26)) - ,@(package-arguments hurd-headers)) - ((#:configure-flags flags) - `(remove (cut string-match "--host.*" <>) - ,flags)))) + `(#:phases (alist-replace + 'install + (lambda _ + (zero? (system* "make" "install-headers" "no_deps=t"))) + (alist-delete 'build %standard-phases)) + + #:configure-flags '(;; Pretend we're on GNU/Hurd; 'configure' wants + ;; that. + "--build=i686-pc-gnu" + + ;; Reduce set of dependencies. + "--without-parted") + + #:tests? #f)) + (native-inputs `(("cross-gcc-hurd" ,xgcc) + ("cross-binutils" ,xbinutils) + ("cross-mig" ,xmig) + ,@(alist-delete "mig"(package-native-inputs hurd-headers)))))) + + + (define xhurd-minimal + (package (inherit hurd-minimal) + (name (string-append (package-name hurd-minimal) + "-cross-" target)) + + (arguments + `(#:phases (alist-replace + 'install + (lambda _ + (zero? (system* "make" "libihash-install"))) + (alist-replace + 'build + (lambda _ + (zero? (system* "make" "libihash" ))) + %standard-phases)) + + #:configure-flags '(;; Pretend we're on GNU/Hurd; 'configure' wants + ;; that. + "--build=i686-pc-gnu" + + ;; Reduce set of dependencies. + "--without-parted") + + #:tests? #f)) (native-inputs `(("cross-gcc-hurd" ,xgcc) ("cross-binutils" ,xbinutils) ("cross-mig" ,xmig) @@ -452,7 +498,8 @@ XBINUTILS and the cross tool chain." ,flags)))) (propagated-inputs `(("cross-gnumach-headers" ,xgnumach-headers) - ("cross-hurd-headers" ,xhurd-headers))) + ("cross-hurd-headers" ,xhurd-headers) + ("cross-hurd-minimal" ,xhurd-minimal))) (native-inputs `(("cross-gcc-hurd" ,xgcc) ("cross-binutils" ,xbinutils) diff --git a/gnu/packages/hurd.scm b/gnu/packages/hurd.scm index f1e7dbc..8487d0c 100644 --- a/gnu/packages/hurd.scm +++ b/gnu/packages/hurd.scm @@ -128,3 +128,48 @@ communication.") "This package provides C headers of the GNU Hurd, used to build the GNU C Library and other user programs.") (license gpl2+))) + +(define-public hurd-minimal + (package + (name "hurd-minimal") + (version "0.5") + (source (origin + (method url-fetch) + (uri (string-append "mirror://gnu/hurd/hurd-" + version ".tar.gz")) + (sha256 + (base32 + "0lvkz3r0ngb4bsn2hzdc9vjpyrfa3ls36jivrvy1n7f7f55zan7q")))) + (build-system gnu-build-system) + (native-inputs + `(;; Autoconf shouldn't be necessary but there seems to be a bug in the + ;; build system triggering its use. + ("autoconf" ,autoconf) + + ("mig" ,mig))) + ;;Build libihash which we need to build libpthread + (arguments + `(#:phases (alist-replace + 'install + (lambda _ + (zero? (system* "make" "libihash-install"))) + (alist-replace + 'build + (lambda _ + (zero? (system* "make" "libihash"))) + %standard-phases)) + + #:configure-flags '(;; Pretend we're on GNU/Hurd; 'configure' wants + ;; that. + "--host=i686-pc-gnu" + + ;; Reduce set of dependencies. + "--without-parted") + + #:tests? #f)) + (home-page "http://www.gnu.org/software/hurd/hurd.html") + (synopsis "GNU Hurd libraries") + (description + "This package provides some minimal libs of the GNU Hurd, used to build the GNU C +Library and other user programs.") + (license gpl2+))) -- 1.9.0 From d0cd8420bfa34a94531b95f1411955608b392f90 Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Tue, 25 Mar 2014 09:20:48 +0000 Subject: [PATCH 03/18] fix --- gnu/packages/base.scm | 9 +++++---- gnu/packages/cross-base.scm | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index a998ff1..e01b9df 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -508,7 +508,7 @@ with the Linux kernel.") ("patch/glibc-make" ,(search-patch "glibc-make-4.0.patch")) ("mig" ,mig) ("perl" ,perl) - ("autoconf" ,autoconf-wrapper) + ("autoconf" ,(autoconf-wrapper "autoconf-2.68")) ("automake" ,automake) ("libtool" ,libtool) ("libtool" ,libtool "bin") @@ -516,7 +516,7 @@ with the Linux kernel.") (method git-fetch) (uri (git-reference (url "git://git.sv.gnu.org/hurd/libpthread") - (commit "fa9eb2c255e1d46beadcd81edd459b9c3d7dcb8c"))) + (commit "3b391db91f70b2166951413ee1eccc78cd398a44"))) (sha256 (base32 "0bb8m0pk7b53sww4ahjds77bvqy0alz54g3aylzwncfca52gacqp")) @@ -526,8 +526,9 @@ with the Linux kernel.") `(#:out-of-source? #t #:configure-flags (list "--without-cvs" - "--enable-add-ons=libpthread" + "--enable-add-ons=" "--build=i686-pc-gnu" + "--target=i686-pc-gnu" ;;"--sysconfdir=/etc" "--disable-profile" "--disable-multi-arch" @@ -544,7 +545,7 @@ with the Linux kernel.") #:phases (alist-cons-before 'pre-configure 'autoconf (lambda _ - (system* "autoreconf" "-vif" "libpthread")) + (system* "autoreconf" "-vif")) (alist-cons-before 'configure 'pre-configure (lambda* (#:key inputs outputs #:allow-other-keys) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index bc56f49..cc43b88 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -253,7 +253,8 @@ XBINUTILS and the cross tool chain." (setenv "CROSS_CPATH" (string-append linux "/include")) #t)) - ,phases)))) + ,phases)) + )) (propagated-inputs `(("cross-linux-headers" ,xlinux-headers))) (native-inputs `(("cross-gcc" ,xgcc) @@ -290,7 +291,6 @@ GCC that does not target a libc; otherwise, target that libc." ;; Disable features not needed at this stage. "--disable-shared" "--enable-static" "--without-headers" - ;; Disable C++ because libstdc++'s ;; configure script otherwise fails with ;; "Link tests are not allowed after @@ -307,7 +307,7 @@ GCC that does not target a libc; otherwise, target that libc." "--disable-libssp" "--disable-libquadmath" "--disable-decimal-float" ; would need libc - "--with-arch=i686" + ;;"--with-arch=i686" ))) ,(if libc -- 1.9.0 From 56aff4e263b9b2165e4f1538f15a314c999de7b1 Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Wed, 26 Mar 2014 00:28:08 +0000 Subject: [PATCH 04/18] getting the message autom4te: cannot open configure: Permission denied --- gnu/packages/base.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 412d489..a28f8cd 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -509,7 +509,7 @@ with the Linux kernel.") ("patch/glibc-make" ,(search-patch "glibc-make-4.0.patch")) ("mig" ,mig) ("perl" ,perl) - ("autoconf" ,(autoconf-wrapper "autoconf-2.68")) + ("autoconf" ,(autoconf-wrapper autoconf-2.68)) ("automake" ,automake) ("libtool" ,libtool) ("libtool" ,libtool "bin") -- 1.9.0 From e9176d8f73465db04e314e93e2a2d99955ac1ac2 Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Thu, 27 Mar 2014 00:38:52 +0000 Subject: [PATCH 05/18] Added patch that helps to integrate libpthread as a glibc module. --- .../libpthread-0.3-3b391d-glibc-preparation.patch | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch diff --git a/gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch b/gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch new file mode 100644 index 0000000..d83ac37 --- /dev/null +++ b/gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch @@ -0,0 +1,22 @@ +From 4067112197e4f8f5975c8647cab355e06736177d Mon Sep 17 00:00:00 2001 +From: Manolis Ragkousis +Date: Thu, 27 Mar 2014 00:21:36 +0000 +Subject: [PATCH] This helps to integrate libpthread as a glibc module. + +--- + configure | 2 ++ + 1 file changed, 2 insertions(+) + create mode 100644 configure + +diff --git a/configure b/configure +new file mode 100644 +index 0000000..2cdbc71 +--- /dev/null ++++ b/configure +@@ -0,0 +1,2 @@ ++libc_add_on_canonical=libpthread ++libc_add_on_subdirs=. +\ No newline at end of file +-- +1.9.0 + -- 1.9.0 From 86ee6a81b0affc8ec9243bdd1a07ce5d594aaa08 Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Thu, 27 Mar 2014 00:42:43 +0000 Subject: [PATCH 06/18] libpthread addon builds succesfully --- gnu/packages/base.scm | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index a28f8cd..b63dc50 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -496,7 +496,9 @@ with the Linux kernel.") (method git-fetch) (uri (git-reference (url "git://git.sv.gnu.org/hurd/glibc") - (commit "bdb7a18d78b04ac3ef7a2d905485500f13bb69fb"))) + (commit "bdb7a18d78b04ac3ef7a2d905485500f13bb69fb") + ;;(commit "9a079e270a9bec7e1fe28aeda63e07c1bb808d44") + )) (sha256 (base32 "0v4hy6yimshbvhbhdbbjdir5fm3xr56zj3lnpf01d4nfa0c1h8k1")) @@ -507,6 +509,7 @@ with the Linux kernel.") (native-inputs `( ("patch/glibc-make" ,(search-patch "glibc-make-4.0.patch")) + ("patch/libpthread-patch" ,(search-patch "libpthread-0.3-3b391d-glibc-preparation.patch")) ("mig" ,mig) ("perl" ,perl) ("autoconf" ,(autoconf-wrapper autoconf-2.68)) @@ -517,7 +520,7 @@ with the Linux kernel.") (method git-fetch) (uri (git-reference (url "git://git.sv.gnu.org/hurd/libpthread") - (commit "3b391db91f70b2166951413ee1eccc78cd398a44"))) + (commit "69e89a859882e4f675dd5491edc969159d8a4002"))) (sha256 (base32 "0bb8m0pk7b53sww4ahjds77bvqy0alz54g3aylzwncfca52gacqp")) @@ -527,7 +530,7 @@ with the Linux kernel.") `(#:out-of-source? #t #:configure-flags (list "--without-cvs" - "--enable-add-ons=" + "--enable-add-ons" "--build=i686-pc-gnu" "--target=i686-pc-gnu" ;;"--sysconfdir=/etc" @@ -543,10 +546,20 @@ with the Linux kernel.") (assoc-ref %build-inputs "bash") "/bin/bash")) - #:phases (alist-cons-before - 'pre-configure 'autoconf - (lambda _ - (system* "autoreconf" "-vif")) + #:phases (alist-cons-after + 'autoconf 'apply-patch + (lambda _ + (zero? (system* "patch" "-p1" "-i" (assoc-ref %build-inputs "patch/glibc-make"))) + (chdir "libpthread") + (zero? (system* "patch" "-p1" "-i" (assoc-ref %build-inputs "patch/libpthread-patch"))) + (chdir "..") + ) + (alist-cons-before + 'pre-configure 'autoconf + (lambda _ + (chmod "configure" #o777) + ;;(system* "autoreconf" "-vif") + ) (alist-cons-before 'configure 'pre-configure (lambda* (#:key inputs outputs #:allow-other-keys) @@ -583,11 +596,6 @@ with the Linux kernel.") 'install 'install-locales (lambda _ (zero? (system* "make" "localedata/install-locales"))) - - (alist-cons-after - 'unpack 'apply-patch - (lambda _ - (zero? (system* "patch" "-p1" "-i" (assoc-ref %build-inputs "patch/glibc-make")))) (alist-replace 'unpack ;; FIXME: Remove this when gnu-build-system handles that -- 1.9.0 From c6edbf966bb703617eed3c64e3554e8015797469 Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Thu, 27 Mar 2014 01:03:14 +0000 Subject: [PATCH 07/18] added libpthread patch to gnu-system.am --- gnu-system.am | 1 + 1 file changed, 1 insertion(+) diff --git a/gnu-system.am b/gnu-system.am index f19a668..14cccea 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -300,6 +300,7 @@ dist_patch_DATA = \ gnu/packages/patches/libtheora-config-guess.patch \ gnu/packages/patches/libtool-skip-tests.patch \ gnu/packages/patches/libtool-skip-tests-for-mips.patch \ + gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch\ gnu/packages/patches/luit-posix.patch \ gnu/packages/patches/m4-gets-undeclared.patch \ gnu/packages/patches/m4-readlink-EINVAL.patch \ -- 1.9.0 From 003d97cf0c34f25a815a07fee2f9fa3001e62344 Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Thu, 27 Mar 2014 01:23:24 +0000 Subject: [PATCH 08/18] start using the default xgcc, commented out xgcc/hurd I had created --- gnu/packages/cross-base.scm | 250 +++++++++++++++++++++----------------------- 1 file changed, 118 insertions(+), 132 deletions(-) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index cc43b88..071602e 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -261,122 +261,122 @@ XBINUTILS and the cross tool chain." ("cross-binutils" ,xbinutils) ,@(package-native-inputs glibc))))) -(define* (cross-gcc/hurd target - #:optional (xbinutils (cross-binutils target)) libc) - "Return a cross-compiler for TARGET, where TARGET is a GNU triplet. Use -XBINUTILS as the associated cross-Binutils. If LIBC is false, then build a -GCC that does not target a libc; otherwise, target that libc." - (package (inherit gcc-4.8) - (name (string-append "gcc-cross-hurd-" - (if libc "" "sans-libc-") - target)) - (source (origin (inherit (package-source gcc-4.8)) - (patches - (list (search-patch "gcc-cross-environment-variables.patch"))))) - (arguments - `(#:implicit-inputs? #f - #:modules ((guix build gnu-build-system) - (guix build utils) - (ice-9 regex) - (srfi srfi-1) - (srfi srfi-26)) - - ,@(substitute-keyword-arguments (package-arguments gcc-4.8) - ((#:configure-flags flags) - `(append (list ,(string-append "--target=" target) - ,@(gcc-configure-flags-for-triplet target) - ,@(if libc - '() - `( - ;; Disable features not needed at this stage. - "--disable-shared" "--enable-static" - "--without-headers" - ;; Disable C++ because libstdc++'s - ;; configure script otherwise fails with - ;; "Link tests are not allowed after - ;; GCC_NO_EXECUTABLES." - "--enable-languages=c" +;; (define* (cross-gcc/hurd target +;; #:optional (xbinutils (cross-binutils target)) libc) +;; "Return a cross-compiler for TARGET, where TARGET is a GNU triplet. Use +;; XBINUTILS as the associated cross-Binutils. If LIBC is false, then build a +;; GCC that does not target a libc; otherwise, target that libc." +;; (package (inherit gcc-4.8) +;; (name (string-append "gcc-cross-hurd-" +;; (if libc "" "sans-libc-") +;; target)) +;; (source (origin (inherit (package-source gcc-4.8)) +;; (patches +;; (list (search-patch "gcc-cross-environment-variables.patch"))))) +;; (arguments +;; `(#:implicit-inputs? #f +;; #:modules ((guix build gnu-build-system) +;; (guix build utils) +;; (ice-9 regex) +;; (srfi srfi-1) +;; (srfi srfi-26)) + +;; ,@(substitute-keyword-arguments (package-arguments gcc-4.8) +;; ((#:configure-flags flags) +;; `(append (list ,(string-append "--target=" target) +;; ,@(gcc-configure-flags-for-triplet target) +;; ,@(if libc +;; '() +;; `( +;; ;; Disable features not needed at this stage. +;; "--disable-shared" "--enable-static" +;; "--without-headers" +;; ;; Disable C++ because libstdc++'s +;; ;; configure script otherwise fails with +;; ;; "Link tests are not allowed after +;; ;; GCC_NO_EXECUTABLES." +;; "--enable-languages=c" - ;; Disabling things according to other hurd building - ;; scripts I saw, I will explain everything with my final patch - - "--disable-threads" ; libgcc, would need libc - "--disable-libatomic" - "--disable-libmudflap" - "--disable-libgomp" - "--disable-libssp" - "--disable-libquadmath" - "--disable-decimal-float" ; would need libc - ;;"--with-arch=i686" - ))) +;; ;; Disabling things according to other hurd building +;; ;; scripts I saw, I will explain everything with my final patch + +;; "--disable-threads" ; libgcc, would need libc +;; "--disable-libatomic" +;; "--disable-libmudflap" +;; "--disable-libgomp" +;; "--disable-libssp" +;; "--disable-libquadmath" +;; "--disable-decimal-float" ; would need libc +;; ;;"--with-arch=i686" +;; ))) - ,(if libc - flags - `(remove (cut string-match "--enable-languages.*" <>) - ,flags)))) - ((#:make-flags flags) - (if libc - `(let ((libc (assoc-ref %build-inputs "libc"))) - ;; FLAGS_FOR_TARGET are needed for the target libraries to - ;; receive the -Bxxx for the startfiles. - (cons (string-append "FLAGS_FOR_TARGET=-B" libc "/lib") - ,flags)) - flags)) - ((#:phases phases) - (let ((phases - `(alist-cons-after - 'install 'make-cross-binutils-visible - (lambda* (#:key outputs inputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (libexec (string-append out "/libexec/gcc/" - ,target)) - (binutils (string-append - (assoc-ref inputs "binutils-cross") - "/bin/" ,target "-"))) - (for-each (lambda (file) - (symlink (string-append binutils file) - (string-append libexec "/" - file))) - '("as" "ld" "nm")) - #t)) - ,phases)))phases));;) - ((#:strip-binaries? _) - ;; Disable stripping as this can break binaries, with object files - ;; of libgcc.a showing up as having an unknown architecture. See - ;; - ;; for instance. - #f)))) - - (native-inputs - `(("binutils-cross" ,xbinutils) - - ;; Call it differently so that the builder can check whether the "libc" - ;; input is #f. - ("libc-native" ,@(assoc-ref %final-inputs "libc")) - - ;; Remaining inputs. - ,@(let ((inputs (append (package-inputs gcc-4.8) - (alist-delete "libc" %final-inputs)))) - (if libc - `(("libc" ,libc) - ,@inputs) - inputs)))) - - (inputs '()) - - ;; Only search target inputs, not host inputs. - (search-paths - (list (search-path-specification - (variable "CROSS_CPATH") - (directories '("include"))) - (search-path-specification - (variable "CROSS_LIBRARY_PATH") - (directories '("lib" "lib64"))))) - (native-search-paths '()))) +;; ,(if libc +;; flags +;; `(remove (cut string-match "--enable-languages.*" <>) +;; ,flags)))) +;; ((#:make-flags flags) +;; (if libc +;; `(let ((libc (assoc-ref %build-inputs "libc"))) +;; ;; FLAGS_FOR_TARGET are needed for the target libraries to +;; ;; receive the -Bxxx for the startfiles. +;; (cons (string-append "FLAGS_FOR_TARGET=-B" libc "/lib") +;; ,flags)) +;; flags)) +;; ((#:phases phases) +;; (let ((phases +;; `(alist-cons-after +;; 'install 'make-cross-binutils-visible +;; (lambda* (#:key outputs inputs #:allow-other-keys) +;; (let* ((out (assoc-ref outputs "out")) +;; (libexec (string-append out "/libexec/gcc/" +;; ,target)) +;; (binutils (string-append +;; (assoc-ref inputs "binutils-cross") +;; "/bin/" ,target "-"))) +;; (for-each (lambda (file) +;; (symlink (string-append binutils file) +;; (string-append libexec "/" +;; file))) +;; '("as" "ld" "nm")) +;; #t)) +;; ,phases)))phases));;) +;; ((#:strip-binaries? _) +;; ;; Disable stripping as this can break binaries, with object files +;; ;; of libgcc.a showing up as having an unknown architecture. See +;; ;; +;; ;; for instance. +;; #f)))) + +;; (native-inputs +;; `(("binutils-cross" ,xbinutils) + +;; ;; Call it differently so that the builder can check whether the "libc" +;; ;; input is #f. +;; ("libc-native" ,@(assoc-ref %final-inputs "libc")) + +;; ;; Remaining inputs. +;; ,@(let ((inputs (append (package-inputs gcc-4.8) +;; (alist-delete "libc" %final-inputs)))) +;; (if libc +;; `(("libc" ,libc) +;; ,@inputs) +;; inputs)))) + +;; (inputs '()) + +;; ;; Only search target inputs, not host inputs. +;; (search-paths +;; (list (search-path-specification +;; (variable "CROSS_CPATH") +;; (directories '("include"))) +;; (search-path-specification +;; (variable "CROSS_LIBRARY_PATH") +;; (directories '("lib" "lib64"))))) +;; (native-search-paths '()))) (define* (cross-mig target #:optional - (xgcc (cross-gcc/hurd target)) + (xgcc (cross-gcc target)) (xbinutils (cross-binutils target))) (define xgnumach-headers @@ -384,7 +384,7 @@ GCC that does not target a libc; otherwise, target that libc." (name (string-append (package-name gnumach-headers) "-cross-" target)) - (native-inputs `(("cross-gcc-hurd" ,xgcc) + (native-inputs `(("cross-gcc" ,xgcc) ("cross-binutils" ,xbinutils) ,@(package-native-inputs gnumach-headers))))) @@ -397,13 +397,13 @@ GCC that does not target a libc; otherwise, target that libc." ,flags)) )) (propagated-inputs `(("cross-gnumach-headers" ,xgnumach-headers))) - (native-inputs `(("cross-gcc-hurd" ,xgcc) + (native-inputs `(("cross-gcc" ,xgcc) ("cross-binutils" ,xbinutils) ,@(package-native-inputs mig))))) (define* (cross-libc/hurd target #:optional - (xgcc (cross-gcc/hurd target)) + (xgcc (cross-gcc target)) (xbinutils (cross-binutils target)) (xmig (cross-mig target))) "Return a libc cross-built for TARGET, a GNU triplet. Use XGCC and @@ -414,7 +414,7 @@ XBINUTILS and the cross tool chain." (name (string-append (package-name gnumach-headers) "-cross-" target)) - (native-inputs `(("cross-gcc-hurd" ,xgcc) + (native-inputs `(("cross-gcc" ,xgcc) ("cross-binutils" ,xbinutils) ,@(package-native-inputs gnumach-headers))))) @@ -422,20 +422,6 @@ XBINUTILS and the cross tool chain." (package (inherit hurd-headers) (name (string-append (package-name hurd-headers) "-cross-" target)) - - ;;removing the --host flag because I am getting the error that gcc cannot produce executables - ;; (arguments - ;; (substitute-keyword-arguments - ;; `(#:modules ((guix build gnu-build-system) - ;; (guix build utils) - ;; (ice-9 regex) - ;; (srfi srfi-1) - ;; (srfi srfi-26)) - ;; ,@(package-arguments hurd-headers)) - ;; ((#:configure-flags flags) - ;; `(remove (cut string-match "--host.*" <>) - ;; ,(cons ,(string-append "--target=" target) - ;; ,flags))))) (arguments `(#:phases (alist-replace 'install @@ -451,7 +437,7 @@ XBINUTILS and the cross tool chain." "--without-parted") #:tests? #f)) - (native-inputs `(("cross-gcc-hurd" ,xgcc) + (native-inputs `(("cross-gcc" ,xgcc) ("cross-binutils" ,xbinutils) ("cross-mig" ,xmig) ,@(alist-delete "mig"(package-native-inputs hurd-headers)))))) @@ -481,7 +467,7 @@ XBINUTILS and the cross tool chain." "--without-parted") #:tests? #f)) - (native-inputs `(("cross-gcc-hurd" ,xgcc) + (native-inputs `(("cross-gcc" ,xgcc) ("cross-binutils" ,xbinutils) ("cross-mig" ,xmig) ,@(alist-delete "mig"(package-native-inputs hurd-headers)))))) @@ -501,7 +487,7 @@ XBINUTILS and the cross tool chain." ("cross-hurd-headers" ,xhurd-headers) ("cross-hurd-minimal" ,xhurd-minimal))) - (native-inputs `(("cross-gcc-hurd" ,xgcc) + (native-inputs `(("cross-gcc" ,xgcc) ("cross-binutils" ,xbinutils) ("cross-mig" ,xmig) ,@(alist-delete "mig"(package-native-inputs glibc/hurd)))) -- 1.9.0 From 661c9862115827052293dbb3d036890ba94e0f80 Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Thu, 27 Mar 2014 02:57:23 +0000 Subject: [PATCH 09/18] Something tries to get built in glibc as a 64 bit while hurd does not like that Neither do I --- gnu/packages/base.scm | 3 +++ gnu/packages/gcc.scm | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index b63dc50..1a86d0b 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -537,6 +537,9 @@ with the Linux kernel.") "--disable-profile" "--disable-multi-arch" "--disable-sanity-checks" + "--disable-nscd" + "--enable-obsolete-rpc" + "--enable-stackguard-randomization" (string-append "libc_cv_localedir=" (assoc-ref %outputs "locales") "/share/locale") diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm index cb7817c..a422edf 100644 --- a/gnu/packages/gcc.scm +++ b/gnu/packages/gcc.scm @@ -45,6 +45,10 @@ where the OS part is overloaded to denote a specific ABI---into GCC ;; Triplets recognized by glibc as denoting the N64 ABI; see ;; ports/sysdeps/mips/preconfigure. '("--with-abi=64")) + ((string-match "i686-pc-gnu" target) + ;; Triplets recognized by glibc as denoting the N64 ABI; see + ;; ports/sysdeps/mips/preconfigure. + '("--with-arch=i686")) (else ;; TODO: Add `armel.*gnueabi', `hf', etc. '()))) -- 1.9.0 From 8e5e7a8be42a0882d3e360fffbe6fec57199292a Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Thu, 27 Mar 2014 23:36:18 +0000 Subject: [PATCH 10/18] Problem with lto-wrapper It's using the wrong one --- gnu/packages/base.scm | 3 ++- gnu/packages/cross-base.scm | 26 ++++++++++++++++---------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 1a86d0b..4437d8b 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -529,7 +529,8 @@ with the Linux kernel.") (arguments `(#:out-of-source? #t #:configure-flags - (list "--without-cvs" + (list "LDFLAGS=-m32" + "--without-cvs" "--enable-add-ons" "--build=i686-pc-gnu" "--target=i686-pc-gnu" diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 071602e..11ed551 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -95,7 +95,7 @@ GCC that does not target a libc; otherwise, target that libc." ,@(gcc-configure-flags-for-triplet target) ,@(if libc '() - `( ;; Disable features not needed at this stage. + `(;; Disable features not needed at this stage. "--disable-shared" "--enable-static" ;; Disable C++ because libstdc++'s @@ -376,7 +376,7 @@ XBINUTILS and the cross tool chain." (define* (cross-mig target #:optional - (xgcc (cross-gcc target)) + (xgcc-i686-pc-gnu (cross-gcc target)) (xbinutils (cross-binutils target))) (define xgnumach-headers @@ -384,7 +384,7 @@ XBINUTILS and the cross tool chain." (name (string-append (package-name gnumach-headers) "-cross-" target)) - (native-inputs `(("cross-gcc" ,xgcc) + (native-inputs `(("cross-gcc" ,xgcc-i686-pc-gnu) ("cross-binutils" ,xbinutils) ,@(package-native-inputs gnumach-headers))))) @@ -397,13 +397,13 @@ XBINUTILS and the cross tool chain." ,flags)) )) (propagated-inputs `(("cross-gnumach-headers" ,xgnumach-headers))) - (native-inputs `(("cross-gcc" ,xgcc) + (native-inputs `(("cross-gcc" ,xgcc-i686-pc-gnu) ("cross-binutils" ,xbinutils) ,@(package-native-inputs mig))))) (define* (cross-libc/hurd target #:optional - (xgcc (cross-gcc target)) + (xgcc-i686-pc-gnu (cross-gcc target)) (xbinutils (cross-binutils target)) (xmig (cross-mig target))) "Return a libc cross-built for TARGET, a GNU triplet. Use XGCC and @@ -414,7 +414,7 @@ XBINUTILS and the cross tool chain." (name (string-append (package-name gnumach-headers) "-cross-" target)) - (native-inputs `(("cross-gcc" ,xgcc) + (native-inputs `(("cross-gcc" ,xgcc-i686-pc-gnu) ("cross-binutils" ,xbinutils) ,@(package-native-inputs gnumach-headers))))) @@ -437,7 +437,7 @@ XBINUTILS and the cross tool chain." "--without-parted") #:tests? #f)) - (native-inputs `(("cross-gcc" ,xgcc) + (native-inputs `(("cross-gcc" ,xgcc-i686-pc-gnu) ("cross-binutils" ,xbinutils) ("cross-mig" ,xmig) ,@(alist-delete "mig"(package-native-inputs hurd-headers)))))) @@ -467,7 +467,7 @@ XBINUTILS and the cross tool chain." "--without-parted") #:tests? #f)) - (native-inputs `(("cross-gcc" ,xgcc) + (native-inputs `(("cross-gcc" ,xgcc-i686-pc-gnu) ("cross-binutils" ,xbinutils) ("cross-mig" ,xmig) ,@(alist-delete "mig"(package-native-inputs hurd-headers)))))) @@ -477,7 +477,7 @@ XBINUTILS and the cross tool chain." (name (string-append "glibc-hurd-cross-" target)) (arguments (substitute-keyword-arguments - `(#:strip-binaries? #f ; disable stripping (see above) + `(#:strip-binaries? #f ; disable stripping (see above) ,@(package-arguments glibc/hurd)) ((#:configure-flags flags) `(cons ,(string-append "--target=" target) @@ -487,7 +487,7 @@ XBINUTILS and the cross tool chain." ("cross-hurd-headers" ,xhurd-headers) ("cross-hurd-minimal" ,xhurd-minimal))) - (native-inputs `(("cross-gcc" ,xgcc) + (native-inputs `(("cross-gcc" ,xgcc-i686-pc-gnu) ("cross-binutils" ,xbinutils) ("cross-mig" ,xmig) ,@(alist-delete "mig"(package-native-inputs glibc/hurd)))) @@ -505,6 +505,12 @@ XBINUTILS and the cross tool chain." (cross-binutils triplet) (cross-libc triplet)))) +(define-public xgcc-i686-pc-gnu + (let ((triplet "i686-pc-gnu")) ; + (cross-gcc triplet + (cross-binutils triplet) + (cross-libc/hurd triplet)))) + ;; (define-public xgcc-armel ;; (let ((triplet "armel-linux-gnueabi")) ;; (cross-gcc triplet -- 1.9.0 From fc4578c28daad7fe625f43bb3dd528ad9a87d27c Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Sat, 29 Mar 2014 02:36:55 +0000 Subject: [PATCH 11/18] removed build,target flags, added host --- gnu/packages/base.scm | 9 +++++---- gnu/packages/cross-base.scm | 11 ++++++----- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 4437d8b..bd14c39 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -520,7 +520,7 @@ with the Linux kernel.") (method git-fetch) (uri (git-reference (url "git://git.sv.gnu.org/hurd/libpthread") - (commit "69e89a859882e4f675dd5491edc969159d8a4002"))) + (commit "3b391db91f70b2166951413ee1eccc78cd398a44"))) (sha256 (base32 "0bb8m0pk7b53sww4ahjds77bvqy0alz54g3aylzwncfca52gacqp")) @@ -529,11 +529,12 @@ with the Linux kernel.") (arguments `(#:out-of-source? #t #:configure-flags - (list "LDFLAGS=-m32" + (list ;;"LDFLAGS=-m32" "--without-cvs" "--enable-add-ons" - "--build=i686-pc-gnu" - "--target=i686-pc-gnu" + "--host=i686-pc-gnu" + ;;"--build=i686-pc-gnu" + ;;"--target=i686-pc-gnu" ;;"--sysconfdir=/etc" "--disable-profile" "--disable-multi-arch" diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 11ed551..b1aa461 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -394,8 +394,8 @@ XBINUTILS and the cross tool chain." (substitute-keyword-arguments (package-arguments mig) ((#:configure-flags flags) `(cons ,(string-append "--target=" target) - ,flags)) - )) + ,flags)))) + (propagated-inputs `(("cross-gnumach-headers" ,xgnumach-headers))) (native-inputs `(("cross-gcc" ,xgcc-i686-pc-gnu) ("cross-binutils" ,xbinutils) @@ -479,9 +479,10 @@ XBINUTILS and the cross tool chain." (substitute-keyword-arguments `(#:strip-binaries? #f ; disable stripping (see above) ,@(package-arguments glibc/hurd)) - ((#:configure-flags flags) - `(cons ,(string-append "--target=" target) - ,flags)))) + ;; ((#:configure-flags flags) + ;; `(cons ,(string-append "--target=" target) + ;; ,flags)) + )) (propagated-inputs `(("cross-gnumach-headers" ,xgnumach-headers) ("cross-hurd-headers" ,xhurd-headers) -- 1.9.0 From 2540d681313063dfd3569d49d4a067eeb0aca0b4 Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Sat, 29 Mar 2014 13:35:32 +0000 Subject: [PATCH 12/18] set-env cross_path --- gnu/packages/cross-base.scm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index b1aa461..71ffa21 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -482,6 +482,17 @@ XBINUTILS and the cross tool chain." ;; ((#:configure-flags flags) ;; `(cons ,(string-append "--target=" target) ;; ,flags)) + ((#:phases phases) + `(alist-cons-before + 'pre-configure 'set-cross-hurd-headers-path + (lambda* (#:key inputs #:allow-other-keys) + (let ((mach (assoc-ref inputs "cross-gnumach-headers")) + (hurd (assoc-ref inputs "cross-hurd-headers"))) + (setenv "CROSS_CPATH" + (string-append mach "/include:" + hurd "/include")) + #t)) + ,phases)) )) (propagated-inputs `(("cross-gnumach-headers" ,xgnumach-headers) -- 1.9.0 From 37c44233f9650ff24e8d8ba253b214de2e28850d Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Sun, 30 Mar 2014 02:48:39 +0000 Subject: [PATCH 13/18] hacks to get pthread headers in the place glibc wants them --- gnu/packages/base.scm | 9 ++++++- .../libpthread-0.3-3b391d-glibc-preparation.patch | 28 +++++++++++++++++++++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index bd14c39..953ab9e 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -498,6 +498,7 @@ with the Linux kernel.") (url "git://git.sv.gnu.org/hurd/glibc") (commit "bdb7a18d78b04ac3ef7a2d905485500f13bb69fb") ;;(commit "9a079e270a9bec7e1fe28aeda63e07c1bb808d44") + ;;(commit "56e49b714ecd32c72c334802b00e3d62008d98e3") )) (sha256 (base32 @@ -551,7 +552,7 @@ with the Linux kernel.") (assoc-ref %build-inputs "bash") "/bin/bash")) - #:phases (alist-cons-after + #:phases (alist-cons-after 'autoconf 'apply-patch (lambda _ (zero? (system* "patch" "-p1" "-i" (assoc-ref %build-inputs "patch/glibc-make"))) @@ -610,6 +611,12 @@ with the Linux kernel.") (chdir "source") (copy-recursively source ".") (copy-recursively (assoc-ref inputs "libpthread") "libpthread") + (chmod "bits/pthreadtypes.h" #o777) + ;; (copy-file "libpthread/sysdeps/generic/bits/pthread.h" "bits/pthread.h") + ;; (copy-file "libpthread/sysdeps/generic/bits/thread-attr.h" "bits/thread-attr.h") + ;; (copy-file "libpthread/sysdeps/generic/bits/mutex-attr.h" "bits/mutex-attr.h") + ;; (copy-file "libpthread/sysdeps/generic/bits/mutex.h" "bits/mutex.h") + (copy-recursively "libpthread/sysdeps/generic/bits" "bits") #t) %standard-phases))))))) )) diff --git a/gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch b/gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch index d83ac37..dd7d928 100644 --- a/gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch +++ b/gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch @@ -1,7 +1,7 @@ From 4067112197e4f8f5975c8647cab355e06736177d Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Thu, 27 Mar 2014 00:21:36 +0000 -Subject: [PATCH] This helps to integrate libpthread as a glibc module. +Subject: [PATCH 1/2] This helps to integrate libpthread as a glibc module. --- configure | 2 ++ @@ -20,3 +20,29 @@ index 0000000..2cdbc71 -- 1.9.0 + +From 7f5f718b4a231c1e08d9ed1676cb18e265b715d6 Mon Sep 17 00:00:00 2001 +From: Manolis Ragkousis +Date: Sat, 29 Mar 2014 23:29:44 +0000 +Subject: [PATCH 2/2] fix + +--- + signal/signal.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/signal/signal.h b/signal/signal.h +index a33d995..6e22d05 100644 +--- a/signal/signal.h ++++ b/signal/signal.h +@@ -26,7 +26,7 @@ + + typedef volatile int sig_atomic_t; + +-typedef uint64_t sigset_t; ++/*typedef uint64_t sigset_t;*/ + + int sigaddset (sigset_t *, int); + int sigdelset (sigset_t *, int); +-- +1.9.0 + -- 1.9.0 From 100342dbd0ddf5e6034f3070d764be8838a474c8 Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Sun, 30 Mar 2014 17:31:14 +0000 Subject: [PATCH 14/18] More patches for hurd's libpthread --- gnu/packages/base.scm | 8 +- .../libpthread-0.3-3b391d-glibc-preparation.patch | 5708 ++++++++++++++++++++ 2 files changed, 5710 insertions(+), 6 deletions(-) diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 953ab9e..339551b 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -611,12 +611,8 @@ with the Linux kernel.") (chdir "source") (copy-recursively source ".") (copy-recursively (assoc-ref inputs "libpthread") "libpthread") - (chmod "bits/pthreadtypes.h" #o777) - ;; (copy-file "libpthread/sysdeps/generic/bits/pthread.h" "bits/pthread.h") - ;; (copy-file "libpthread/sysdeps/generic/bits/thread-attr.h" "bits/thread-attr.h") - ;; (copy-file "libpthread/sysdeps/generic/bits/mutex-attr.h" "bits/mutex-attr.h") - ;; (copy-file "libpthread/sysdeps/generic/bits/mutex.h" "bits/mutex.h") - (copy-recursively "libpthread/sysdeps/generic/bits" "bits") + ;; (chmod "bits/pthreadtypes.h" #o777) + ;; (copy-recursively "libpthread/sysdeps/generic/bits" "bits") #t) %standard-phases))))))) )) diff --git a/gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch b/gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch index dd7d928..0ba23f0 100644 --- a/gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch +++ b/gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch @@ -1,6 +1,5714 @@ From 4067112197e4f8f5975c8647cab355e06736177d Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Thu, 27 Mar 2014 00:21:36 +0000 +Subject: [PATCH 1/4] This helps to integrate libpthread as a glibc module. + +--- + configure | 2 ++ + 1 file changed, 2 insertions(+) + create mode 100644 configure + +diff --git a/configure b/configure +new file mode 100644 +index 0000000..2cdbc71 +--- /dev/null ++++ b/configure +@@ -0,0 +1,2 @@ ++libc_add_on_canonical=libpthread ++libc_add_on_subdirs=. +\ No newline at end of file +-- +1.9.0 + + +From 7f5f718b4a231c1e08d9ed1676cb18e265b715d6 Mon Sep 17 00:00:00 2001 +From: Manolis Ragkousis +Date: Sat, 29 Mar 2014 23:29:44 +0000 +Subject: [PATCH 2/4] fix + +--- + signal/signal.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/signal/signal.h b/signal/signal.h +index a33d995..6e22d05 100644 +--- a/signal/signal.h ++++ b/signal/signal.h +@@ -26,7 +26,7 @@ + + typedef volatile int sig_atomic_t; + +-typedef uint64_t sigset_t; ++/*typedef uint64_t sigset_t;*/ + + int sigaddset (sigset_t *, int); + int sigdelset (sigset_t *, int); +-- +1.9.0 + + +From b8639799ae3b571eb44edd2b3dec109957393d3e Mon Sep 17 00:00:00 2001 +From: Manolis Ragkousis +Date: Sun, 30 Mar 2014 16:56:09 +0000 +Subject: [PATCH 3/4] These come from the l4 implementation and come in the way + of the glibc Makefiles, drop them. + +--- + include/libc-symbols.h | 395 -------------------------------------------- + include/set-hooks.h | 72 -------- + signal/README | 12 -- + signal/TODO | 29 ---- + signal/kill.c | 70 -------- + signal/pt-kill-siginfo-np.c | 88 ---------- + signal/sig-internal.c | 26 --- + signal/sig-internal.h | 177 -------------------- + signal/sigaction.c | 72 -------- + signal/sigaltstack.c | 69 -------- + signal/signal-dispatch.c | 117 ------------- + signal/signal.h | 275 ------------------------------ + signal/sigpending.c | 38 ----- + signal/sigsuspend.c | 29 ---- + signal/sigtimedwait.c | 30 ---- + signal/sigwaiter.c | 91 ---------- + signal/sigwaitinfo.c | 74 --------- + 17 files changed, 1664 deletions(-) + delete mode 100644 include/libc-symbols.h + delete mode 100644 include/set-hooks.h + delete mode 100644 signal/README + delete mode 100644 signal/TODO + delete mode 100644 signal/kill.c + delete mode 100644 signal/pt-kill-siginfo-np.c + delete mode 100644 signal/sig-internal.c + delete mode 100644 signal/sig-internal.h + delete mode 100644 signal/sigaction.c + delete mode 100644 signal/sigaltstack.c + delete mode 100644 signal/signal-dispatch.c + delete mode 100644 signal/signal.h + delete mode 100644 signal/sigpending.c + delete mode 100644 signal/sigsuspend.c + delete mode 100644 signal/sigtimedwait.c + delete mode 100644 signal/sigwaiter.c + delete mode 100644 signal/sigwaitinfo.c + +diff --git a/include/libc-symbols.h b/include/libc-symbols.h +deleted file mode 100644 +index 54dd6e2..0000000 +--- a/include/libc-symbols.h ++++ /dev/null +@@ -1,395 +0,0 @@ +-/* Support macros for making weak and strong aliases for symbols, +- and for using symbol sets and linker warnings with GNU ld. +- Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2008 +- Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- +- The GNU C Library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2.1 of the License, or (at your option) any later version. +- +- The GNU C Library is distributed in the hope that it will be useful, +- but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with the GNU C Library; if not, write to the Free +- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +- 02111-1307 USA. */ +- +-#ifndef _LIBC_SYMBOLS_H +-#define _LIBC_SYMBOLS_H 1 +- +-/* This file's macros are included implicitly in the compilation of every +- file in the C library by -imacros. +- +- We include config.h which is generated by configure. +- It should define for us the following symbols: +- +- * HAVE_ASM_SET_DIRECTIVE if we have `.set B, A' instead of `A = B'. +- * ASM_GLOBAL_DIRECTIVE with `.globl' or `.global'. +- * HAVE_GNU_LD if using GNU ld, with support for weak symbols in a.out, +- and for symbol set and warning messages extensions in a.out and ELF. +- * HAVE_ELF if using ELF, which supports weak symbols using `.weak'. +- * HAVE_ASM_WEAK_DIRECTIVE if we have weak symbols using `.weak'. +- * HAVE_ASM_WEAKEXT_DIRECTIVE if we have weak symbols using `.weakext'. +- +- */ +- +-/* This is defined for the compilation of all C library code. features.h +- tests this to avoid inclusion of stubs.h while compiling the library, +- before stubs.h has been generated. Some library code that is shared +- with other packages also tests this symbol to see if it is being +- compiled as part of the C library. We must define this before including +- config.h, because it makes some definitions conditional on whether libc +- itself is being compiled, or just some generator program. */ +-// #define _LIBC 1 +- +-/* Enable declarations of GNU extensions, since we are compiling them. */ +-#define _GNU_SOURCE 1 +-/* And we also need the data for the reentrant functions. */ +-#define _REENTRANT 1 +- +-// #include +-#define HAVE_ASM_WEAK_DIRECTIVE +-#define HAVE_WEAK_SYMBOLS +-#define HAVE_ASM_SET_DIRECTIVE +-#define HAVE_BUILTIN_EXPECT +-#define HAVE_GNU_LD +-#define HAVE_ELF +-#define HAVE_SECTION_QUOTES +-#define HAVE_VISIBILITY_ATTRIBUTE +-#define HAVE_ASM_PREVIOUS_DIRECTIVE +-// #define SHARED +- +-/* The symbols in all the user (non-_) macros are C symbols. +- HAVE_GNU_LD without HAVE_ELF implies a.out. */ +- +-#if defined HAVE_ASM_WEAK_DIRECTIVE || defined HAVE_ASM_WEAKEXT_DIRECTIVE +-# define HAVE_WEAK_SYMBOLS +-#endif +- +-#ifndef __SYMBOL_PREFIX +-# ifdef NO_UNDERSCORES +-# define __SYMBOL_PREFIX +-# else +-# define __SYMBOL_PREFIX "_" +-# endif +-#endif +- +-#ifndef C_SYMBOL_NAME +-# ifdef NO_UNDERSCORES +-# define C_SYMBOL_NAME(name) name +-# else +-# define C_SYMBOL_NAME(name) _##name +-# endif +-#endif +- +-#ifndef ASM_LINE_SEP +-# define ASM_LINE_SEP ; +-#endif +- +-#ifndef C_SYMBOL_DOT_NAME +-# define C_SYMBOL_DOT_NAME(name) .##name +-#endif +- +-#ifndef __ASSEMBLER__ +-/* GCC understands weak symbols and aliases; use its interface where +- possible, instead of embedded assembly language. */ +- +-/* Define ALIASNAME as a strong alias for NAME. */ +-# define strong_alias(name, aliasname) _strong_alias(name, aliasname) +-# define _strong_alias(name, aliasname) \ +- extern __typeof (name) aliasname __attribute__ ((alias (#name))); +- +-/* This comes between the return type and function name in +- a function definition to make that definition weak. */ +-# define weak_function __attribute__ ((weak)) +-# define weak_const_function __attribute__ ((weak, __const__)) +- +-# ifdef HAVE_WEAK_SYMBOLS +- +-/* Define ALIASNAME as a weak alias for NAME. +- If weak aliases are not available, this defines a strong alias. */ +-# define weak_alias(name, aliasname) _weak_alias (name, aliasname) +-# define _weak_alias(name, aliasname) \ +- extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))); +- +-/* Declare SYMBOL as weak undefined symbol (resolved to 0 if not defined). */ +-# define weak_extern(symbol) _weak_extern (symbol) +-# ifdef HAVE_ASM_WEAKEXT_DIRECTIVE +-# define _weak_extern(symbol) asm (".weakext " __SYMBOL_PREFIX #symbol); +-# else +-# define _weak_extern(symbol) asm (".weak " __SYMBOL_PREFIX #symbol); +-# endif +- +-# else +- +-# define weak_alias(name, aliasname) strong_alias(name, aliasname) +-# define weak_extern(symbol) /* Nothing. */ +- +-# endif +- +-#else /* __ASSEMBLER__ */ +- +-# ifdef HAVE_ASM_SET_DIRECTIVE +-# define strong_alias(original, alias) \ +- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ +- .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original) +-# else +-# ifdef HAVE_ASM_GLOBAL_DOT_NAME +-# define strong_alias(original, alias) \ +- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ +- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \ +- ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ +- C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original) +-# else +-# define strong_alias(original, alias) \ +- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ +- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) +-# endif +-# endif +- +-# ifdef HAVE_WEAK_SYMBOLS +-# ifdef HAVE_ASM_WEAKEXT_DIRECTIVE +-# define weak_alias(original, alias) \ +- .weakext C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original) +-# define weak_extern(symbol) \ +- .weakext C_SYMBOL_NAME (symbol) +- +-# else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */ +- +-# ifdef HAVE_ASM_GLOBAL_DOT_NAME +-# define weak_alias(original, alias) \ +- .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \ +- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \ +- ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ +- C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original) +-# else +-# define weak_alias(original, alias) \ +- .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \ +- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) +-# endif +- +-# define weak_extern(symbol) \ +- .weak C_SYMBOL_NAME (symbol) +- +-# endif /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */ +- +-# else /* ! HAVE_WEAK_SYMBOLS */ +- +-# define weak_alias(original, alias) strong_alias(original, alias) +-# define weak_extern(symbol) /* Nothing */ +-# endif /* ! HAVE_WEAK_SYMBOLS */ +- +-#endif /* __ASSEMBLER__ */ +- +-/* On some platforms we can make internal function calls (i.e., calls of +- functions not exported) a bit faster by using a different calling +- convention. */ +-#ifndef internal_function +-# define internal_function /* empty */ +-#endif +- +-/* Prepare for the case that `__builtin_expect' is not available. */ +-#ifndef HAVE_BUILTIN_EXPECT +-# define __builtin_expect(expr, val) (expr) +-#endif +- +-/* Determine the return address. */ +-#define RETURN_ADDRESS(nr) \ +- __builtin_extract_return_addr (__builtin_return_address (nr)) +- +-/* When a reference to SYMBOL is encountered, the linker will emit a +- warning message MSG. */ +-#ifdef HAVE_GNU_LD +-# ifdef HAVE_ELF +- +-/* We want the .gnu.warning.SYMBOL section to be unallocated. */ +-# ifdef HAVE_ASM_PREVIOUS_DIRECTIVE +-# define __make_section_unallocated(section_string) \ +- asm (".section " section_string "\n\t.previous"); +-# elif defined HAVE_ASM_POPSECTION_DIRECTIVE +-# define __make_section_unallocated(section_string) \ +- asm (".pushsection " section_string "\n\t.popsection"); +-# else +-# define __make_section_unallocated(section_string) +-# endif +- +-/* Tacking on "\n\t#" to the section name makes gcc put it's bogus +- section attributes on what looks like a comment to the assembler. */ +-# ifdef HAVE_SECTION_QUOTES +-# define link_warning(symbol, msg) \ +- __make_section_unallocated (".gnu.warning." #symbol) \ +- static const char __evoke_link_warning_##symbol[] \ +- __attribute__ ((unused, section (".gnu.warning." #symbol "\"\n\t#\""))) \ +- = msg; +-# else +-# define link_warning(symbol, msg) \ +- __make_section_unallocated (".gnu.warning." #symbol) \ +- static const char __evoke_link_warning_##symbol[] \ +- __attribute__ ((unused, section (".gnu.warning." #symbol "\n\t#"))) = msg; +-# endif +-# else /* Not ELF: a.out */ +-# ifdef HAVE_XCOFF +-/* XCOFF does not support .stabs. +- The native aix linker will remove the .stab and .stabstr sections +- The gnu linker will have a fatal error if there is a relocation for +- symbol in the .stab section. Silently disable this macro. */ +-# define link_warning(symbol, msg) +-# else +-# define link_warning(symbol, msg) \ +- asm (".stabs \"" msg "\",30,0,0,0\n\t" \ +- ".stabs \"" __SYMBOL_PREFIX #symbol "\",1,0,0,0\n"); +-# endif /* XCOFF */ +-# endif +-#else +-/* We will never be heard; they will all die horribly. */ +-# define link_warning(symbol, msg) +-#endif +- +-/* A canned warning for sysdeps/stub functions. */ +-#define stub_warning(name) \ +- link_warning (name, \ +- "warning: " #name " is not implemented and will always fail") +- +-/* +- +-*/ +- +-#ifdef HAVE_GNU_LD +- +-/* Symbol set support macros. */ +- +-# ifdef HAVE_ELF +- +-/* Make SYMBOL, which is in the text segment, an element of SET. */ +-# define text_set_element(set, symbol) _elf_set_element(set, symbol) +-/* Make SYMBOL, which is in the data segment, an element of SET. */ +-# define data_set_element(set, symbol) _elf_set_element(set, symbol) +-/* Make SYMBOL, which is in the bss segment, an element of SET. */ +-# define bss_set_element(set, symbol) _elf_set_element(set, symbol) +- +-/* These are all done the same way in ELF. +- There is a new section created for each set. */ +-# ifdef SHARED +-/* When building a shared library, make the set section writable, +- because it will need to be relocated at run time anyway. */ +-# define _elf_set_element(set, symbol) \ +- static const void *__elf_set_##set##_element_##symbol##__ \ +- __attribute__ ((unused, section (#set))) = &(symbol) +-# else +-# define _elf_set_element(set, symbol) \ +- static const void *const __elf_set_##set##_element_##symbol##__ \ +- __attribute__ ((unused, section (#set))) = &(symbol) +-# endif +- +-/* Define SET as a symbol set. This may be required (it is in a.out) to +- be able to use the set's contents. */ +-# define symbol_set_define(set) symbol_set_declare(set) +- +-/* Declare SET for use in this module, if defined in another module. */ +-# define symbol_set_declare(set) \ +- extern void *const __start_##set __attribute__ ((__weak__)); \ +- extern void *const __stop_##set __attribute__ ((__weak__)); \ +- weak_extern (__start_##set) weak_extern (__stop_##set) +- +-/* Return a pointer (void *const *) to the first element of SET. */ +-# define symbol_set_first_element(set) (&__start_##set) +- +-/* Return true iff PTR (a void *const *) has been incremented +- past the last element in SET. */ +-# define symbol_set_end_p(set, ptr) ((ptr) >= &__stop_##set) +- +-# else /* Not ELF: a.out. */ +- +-# ifdef HAVE_XCOFF +-/* XCOFF does not support .stabs. +- The native aix linker will remove the .stab and .stabstr sections +- The gnu linker will have a fatal error if there is a relocation for +- symbol in the .stab section. Silently disable these macros. */ +-# define text_set_element(set, symbol) +-# define data_set_element(set, symbol) +-# define bss_set_element(set, symbol) +-# else +-# define text_set_element(set, symbol) \ +- asm (".stabs \"" __SYMBOL_PREFIX #set "\",23,0,0," __SYMBOL_PREFIX #symbol) +-# define data_set_element(set, symbol) \ +- asm (".stabs \"" __SYMBOL_PREFIX #set "\",25,0,0," __SYMBOL_PREFIX #symbol) +-# define bss_set_element(set, symbol) ?error Must use initialized data. +-# endif /* XCOFF */ +-# define symbol_set_define(set) void *const (set)[1]; +-# define symbol_set_declare(set) extern void *const (set)[1]; +- +-# define symbol_set_first_element(set) &(set)[1] +-# define symbol_set_end_p(set, ptr) (*(ptr) == 0) +- +-# endif /* ELF. */ +-#else +-/* We cannot do anything in generial. */ +-# define text_set_element(set, symbol) asm ("") +-# define data_set_element(set, symbol) asm ("") +-# define bss_set_element(set, symbol) asm ("") +-# define symbol_set_define(set) void *const (set)[1]; +-# define symbol_set_declare(set) extern void *const (set)[1]; +- +-# define symbol_set_first_element(set) &(set)[1] +-# define symbol_set_end_p(set, ptr) (*(ptr) == 0) +-#endif /* Have GNU ld. */ +- +-#if DO_VERSIONING +-# define symbol_version(real, name, version) \ +- _symbol_version(real, name, version) +-# define default_symbol_version(real, name, version) \ +- _default_symbol_version(real, name, version) +-# ifdef __ASSEMBLER__ +-# define _symbol_version(real, name, version) \ +- .symver real, address@hidden +-# define _default_symbol_version(real, name, version) \ +- .symver real, address@hidden@##version +-# else +-# define _symbol_version(real, name, version) \ +- __asm__ (".symver " #real "," #name "@" #version) +-# define _default_symbol_version(real, name, version) \ +- __asm__ (".symver " #real "," #name "@@" #version) +-# endif +-#else +-# define symbol_version(real, name, version) +-# define default_symbol_version(real, name, version) \ +- strong_alias(real, name) +-#endif +- +-#if defined HAVE_VISIBILITY_ATTRIBUTE && defined SHARED +-# define attribute_hidden __attribute__ ((visibility ("hidden"))) +-#else +-# define attribute_hidden +-#endif +- +-/* Handling on non-exported internal names. We have to do this only +- for shared code. */ +-#ifdef SHARED +-# define INTUSE(name) name##_internal +-# define INTDEF(name) strong_alias (name, name##_internal) +-# define INTVARDEF(name) \ +- _INTVARDEF (name, name##_internal) +-# if defined HAVE_VISIBILITY_ATTRIBUTE +-# define _INTVARDEF(name, aliasname) \ +- extern __typeof (name) aliasname __attribute__ ((alias (#name), \ +- visibility ("hidden"))); +-# else +-# define _INTVARDEF(name, aliasname) \ +- extern __typeof (name) aliasname __attribute__ ((alias (#name))); +-# endif +-# define INTDEF2(name, newname) strong_alias (name, newname##_internal) +-# define INTVARDEF2(name, newname) _INTVARDEF (name, newname##_internal) +-#else +-# define INTUSE(name) name +-# define INTDEF(name) +-# define INTVARDEF(name) +-# define INTDEF2(name, newname) +-# define INTVARDEF2(name, newname) +-#endif +- +-#endif /* libc-symbols.h */ +diff --git a/include/set-hooks.h b/include/set-hooks.h +deleted file mode 100644 +index 9ed71b3..0000000 +--- a/include/set-hooks.h ++++ /dev/null +@@ -1,72 +0,0 @@ +-/* Macros for using symbol sets for running lists of functions. +- Copyright (C) 1994, 1995, 1997, 2000 Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- +- The GNU C Library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2.1 of the License, or (at your option) any later version. +- +- The GNU C Library is distributed in the hope that it will be useful, +- but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with the GNU C Library; if not, write to the Free +- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +- 02111-1307 USA. */ +- +-#ifndef _SET_HOOKS_H +-#define _SET_HOOKS_H 1 +- +-#define __need_size_t +-#include +-// #include +-#define __unbounded +- +-#ifdef symbol_set_define +-/* Define a hook variable called NAME. Functions put on this hook take +- arguments described by PROTO. Use `text_set_element (NAME, FUNCTION)' +- from gnu-stabs.h to add a function to the hook. */ +- +-# define DEFINE_HOOK(NAME, PROTO) \ +- typedef void __##NAME##_hook_function_t PROTO; \ +- symbol_set_define (NAME) +- +-# define DECLARE_HOOK(NAME, PROTO) \ +- typedef void __##NAME##_hook_function_t PROTO;\ +- symbol_set_declare (NAME) +- +-/* Run all the functions hooked on the set called NAME. +- Each function is called like this: `function ARGS'. */ +- +-# define RUN_HOOK(NAME, ARGS) \ +-do { \ +- void *const *__unbounded ptr; \ +- for (ptr = symbol_set_first_element (NAME); \ +- ! symbol_set_end_p (NAME, ptr); ++ptr) \ +- (*(__##NAME##_hook_function_t *) *ptr) ARGS; \ +-} while (0) +- +-/* Define a hook variable with NAME and PROTO, and a function called RUNNER +- which calls each function on the hook in turn, with ARGS. */ +- +-# define DEFINE_HOOK_RUNNER(name, runner, proto, args) \ +-DEFINE_HOOK (name, proto); \ +-extern void runner proto; void runner proto { RUN_HOOK (name, args); } +- +-#else +- +-/* The system does not provide necessary support for this. */ +-# define DEFINE_HOOK(NAME, PROTO) +- +-# define DECLARE_HOOK(NAME, PROTO) +- +-# define RUN_HOOK(NAME, ARGS) +- +-# define DEFINE_HOOK_RUNNER(name, runner, proto, args) +- +-#endif +- +-#endif /* set-hooks.h */ +diff --git a/signal/README b/signal/README +deleted file mode 100644 +index 4963b26..0000000 +--- a/signal/README ++++ /dev/null +@@ -1,12 +0,0 @@ +-This directory provides a signal implementation, which is appropriate +-for operating systems where signals are managed at user-level. It is +-up to the run-time to catch the signals and forward them to the +-implementation via, e.g., the pthread_kill_info_np call. +- +-The files in this directory are accompanied by the generic implementations +-found in sysdeps/generic/: killpg.c, raise.c, sigaddset.c, sigdelset.c, +-sigemptyset.c, sigfillset.c, siginterrupt.c, sigismember.c, signal.c, +-sigwait.c. +- +-This implementation was once used for a native port running on L4, but is not +-currently used in any libpthread port bundled in this release. +diff --git a/signal/TODO b/signal/TODO +deleted file mode 100644 +index 1148abb..0000000 +--- a/signal/TODO ++++ /dev/null +@@ -1,29 +0,0 @@ +-Unimplemented Functionality +---------------------------- +- +-We don't support interruptible functions. That is, if a signal is +-delivered when a thread is in e.g. the write system call, then the +-write function should be interrupted and return EINTR when the signal +-handler is finished. To realize this behavior, we could have a thread +-local interruptible flag and a setjmp buffer. A function that is +-interruptible would fill the jump buffer and set the interruptible +-flag. If a signal comes in and the interruptible flag is set, rather +-than resuming the thread, we longjmp to the buffer. +- +-If a signal action has set the SA_SIGINFO, the third argument must be +-a pointer to a ucontext describing the thread's interrupted state; +-this implementation passes NULL. This isn't as bad as it sounds as +-the the ucontext family of functions are marked obsolete in SUSv3 with +-the advisory that any use of them should be replaced by the use of +-pthread functionality (cf. makecontext rationale). +- +-stop and continue signals are not implemented (as we need to stop all +-threads, this requires being in bed with libpthread). +- +-Implementation is not yet cancellation-safe. +- +-There are not even stubs for sighold, sigingore, sigpause, sigrelse, +-however, according to posix: "Use of any of these functions is +-unspecified in a multi-threaded process." +- +-Implement sigtimedwait, sigqueue. +\ No newline at end of file +diff --git a/signal/kill.c b/signal/kill.c +deleted file mode 100644 +index 27c9c32..0000000 +--- a/signal/kill.c ++++ /dev/null +@@ -1,70 +0,0 @@ +-/* kill.c - Generic kill implementation. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include "sig-internal.h" +- +-int +-kill (pid_t pid, int signo) +-{ +- if (pid != getpid ()) +- { +- errno = EOPNOTSUPP; +- return -1; +- } +- +- /* "Signals generated for the process shall be delivered to exactly +- one of those threads within the process which is in a call to a +- sigwait() function selecting that signal or has not blocked +- delivery of the signal. If there are no threads in a call to a +- sigwait() function selecting that signal, and if all threads +- within the process block delivery of the signal, the signal shall +- remaing pending on the process" (2.4.1). */ +- +- /* First, see if there is a waiter, which is interested in this +- signal. */ +- pthread_mutex_lock (&sig_lock); +- +- struct sigwaiter *waiter; +- for (waiter = sigwaiters; waiter; waiter = waiter->next) +- if ((waiter->signals & sigmask (signo))) +- /* Got a winner. */ +- { +- sigdelset (&process_pending, signo); +- +- pthread_mutex_lock (&waiter->ss->lock); +- sigdelset (&waiter->ss->pending, signo); +- +- memset (&waiter->info, 0, sizeof (waiter->info)); +- waiter->info.si_signo = signo; +- +- sigwaiter_unblock (waiter); +- +- return 0; +- } +- +- pthread_mutex_unlock (&sig_lock); +- +- /* XXX: We just generate the signal for the current thread. If the +- current thread has blocked the signal, the correct thing to do is +- to iterate over all the other threads and find on that hasn't +- blocked it. */ +- return pthread_kill (pthread_self (), signo); +-} +- +diff --git a/signal/pt-kill-siginfo-np.c b/signal/pt-kill-siginfo-np.c +deleted file mode 100644 +index 9bdf6cc..0000000 +--- a/signal/pt-kill-siginfo-np.c ++++ /dev/null +@@ -1,88 +0,0 @@ +-/* pthread-kill-siginfo-np.c - Generic pthread_kill_siginfo_np implementation. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include "pt-internal.h" +-#include "sig-internal.h" +- +-int +-pthread_kill_siginfo_np (pthread_t tid, siginfo_t si) +-{ +- int sig = si.si_signo; +- +- if (sig < 0 || sig >= NSIG) +- return EINVAL; +- +- if (sig == 0) +- return 0; +- +- struct signal_state *ss = &__pthread_getid (tid)->ss; +- +- pthread_mutex_lock (&sig_lock); +- pthread_mutex_lock (&ss->lock); +- +- if (ss->sigwaiter && (ss->sigwaiter->signals & sigmask (si.si_signo))) +- /* The thread is in a call to sigwait. */ +- { +- ss->sigwaiter->info = si; +- sigwaiter_unblock (ss->sigwaiter); +- return 0; +- } +- +- pthread_mutex_unlock (&sig_lock); +- +- if (ss->actions[sig - 1].sa_handler == (void *) SIG_IGN +- || (ss->actions[sig - 1].sa_handler == (void *) SIG_DFL +- && default_action (sig) == sig_ignore)) +- /* It is unclear (to me) what is supposed to happen when a signal +- is generated for a thread, which is blocking that signal and +- ignoring it. POSIX does say that when the action associated +- with a pending, blocked signal is set to SIG_IGN, the pending +- signal is to be cleared. Thus, it makes sense that any signal +- set to ignore is discarded at generation. */ +- { +- pthread_mutex_unlock (&ss->lock); +- return 0; +- } +- +- +- if ((sigmask (sig) & ss->blocked)) +- /* The signal is blocked. Mark it pending. */ +- { +- ss->pending |= sigmask (sig); +- pthread_mutex_unlock (&ss->lock); +- return 0; +- } +- +- if (pthread_self () == tid +- && (! (ss->actions[si.si_signo - 1].sa_flags & SA_ONSTACK) +- || (ss->stack.ss_flags & SS_DISABLE) +- || (ss->stack.ss_flags & SS_ONSTACK))) +- /* We are sending a signal to ourself and we don't use an +- alternate stack. */ +- signal_dispatch (ss, &si); +- else +- signal_dispatch_lowlevel (ss, tid, si); +- +- /* Don't unlock ss: signal_dispatch and signal_dispatch_lowlevel +- assume ownership of the lock. */ +- +- return 0; +-} +- +diff --git a/signal/sig-internal.c b/signal/sig-internal.c +deleted file mode 100644 +index f73f38b..0000000 +--- a/signal/sig-internal.c ++++ /dev/null +@@ -1,26 +0,0 @@ +-/* sig-internal.c - Signal state functions. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include "sig-internal.h" +- +-pthread_mutex_t sig_lock = PTHREAD_MUTEX_INITIALIZER; +- +-sigset_t process_pending; +-siginfo_t process_pending_info[NSIG]; +diff --git a/signal/sig-internal.h b/signal/sig-internal.h +deleted file mode 100644 +index 6c86c79..0000000 +--- a/signal/sig-internal.h ++++ /dev/null +@@ -1,177 +0,0 @@ +-/* sig-internal.h - Internal signal handling interface. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#ifndef SIG_INTERNAL_H +-#define SIG_INTERNAL_H +- +-#include +- +-#include +- +-#define sigmask(sig) (1ULL << (sig - 1)) +-#define STOPSIGS (sigmask (SIGTTIN) | sigmask (SIGTTOU) | \ +- sigmask (SIGSTOP) | sigmask (SIGTSTP)) +- +-/* General lock. Protects PROCESS_PENDING, PROCESS_PENDING_INFO, +- SIGWAITERS. */ +-extern pthread_mutex_t sig_lock; +- +-/* "Signals generated for the process shall be delivered to exactly +- one of those threads within the process which is in a call to a +- sigwait() function selecting that signal or has not blocked +- delivery of the signal. If there are no threads in a call to a +- sigwait() function selecting that signal, and if all threads within +- the process block delivery of the signal, the signal shall remaing +- pending on the process" (2.4.1). +- +- This variable is protected by SIG_LOCK. */ +-extern sigset_t process_pending; +-extern siginfo_t process_pending_info[NSIG]; +- +-struct sigwaiter; +- +-/* The per-thread signal state. */ +-struct signal_state +-{ +- /* Protects the following fields. STACK.SA_FLAGS may be accessed +- using atomic operations. */ +- pthread_mutex_t lock; +- +- /* Pending signals. */ +- sigset_t pending; +- +- /* Blocked signals (i.e., the signal mask). */ +- sigset_t blocked; +- +- stack_t stack; +- struct sigaction actions[NSIG]; +- siginfo_t info[NSIG]; +- +- /* If the thread is blocked in a call to sigwait. */ +- struct sigwaiter *sigwaiter; +-}; +- +-#define PTHREAD_SIGNAL_MEMBERS struct signal_state ss; +- +-/* Arranges for thread TID to call signal_dispatch. Must not be +- called if TID is the caller and an alternate stack is not required. +- In this case, the caller should call signal_dispatch directly. */ +-extern void signal_dispatch_lowlevel (struct signal_state *ss, +- pthread_t tid, siginfo_t si); +- +-/* This is the signal handler entry point. A thread is forced into +- this state when it receives a signal. We need to save the thread's +- state and then invoke the high-level signal dispatcher. SS->LOCK +- is locked by the caller. */ +-extern void signal_dispatch (struct signal_state *ss, siginfo_t *si); +- +-#ifndef SIGNAL_DISPATCH_ENTRY +-#define SIGNAL_DISPATCH_ENTRY +-#endif +- +-#ifndef SIGNAL_DISPATCH_EXIT +-#define SIGNAL_DISPATCH_EXIT +-#endif +- +-/* When a thread calls sigwait and a requested signal is not pending, +- it allocates the following structure, fills it in, adds it to +- sigwaiters and sleeps. */ +-struct sigwaiter +-{ +- struct sigwaiter *next; +- struct sigwaiter *prev; +- +- /* Thread's signal state. */ +- struct signal_state *ss; +- +- /* Signals this thread is waiting for. */ +- sigset_t signals; +- +- /* The selected signal is returned here. The waiter also +- futex_waits on this info.si_signo. */ +- siginfo_t info; +-}; +- +-/* This variable is protected by SIG_LOCK. */ +-extern struct sigwaiter *sigwaiters; +- +-/* Block the caller waiting for a signal in set SET. SIG_LOCK and +- SS->LOCK must be held and will be unlocked by this function before +- blocking. */ +-extern siginfo_t sigwaiter_block (struct signal_state *ss, +- const sigset_t *restrict set); +- +-/* Unblock the waiter WAITER. SIG_LOCK and WAITER->SS->LOCK must be +- held. Both will be dropped on return. */ +-extern void sigwaiter_unblock (struct sigwaiter *waiter); +- +-enum sig_action { sig_core, sig_terminate, sig_ignore, sig_cont, sig_stop }; +- +-static inline enum sig_action +-default_action (int signo) +-{ +- switch (signo) +- { +- case SIGABRT: +- case SIGBUS: +- case SIGFPE: +- case SIGILL: +- case SIGQUIT: +- case SIGSEGV: +- case SIGSTKFLT: +- case SIGSYS: +- case SIGTRAP: +- case SIGXCPU: +- case SIGXFSZ: +- return sig_core; +- +- case SIGALRM: +- case SIGHUP: +- case SIGINT: +- case SIGIO: /* Perhaps ignore? */ +- case SIGKILL: +- case SIGPIPE: +- case SIGPROF: +- case SIGTERM: +- case SIGUSR1: +- case SIGUSR2: +- case SIGVTALRM: +- return sig_terminate; +- +- case SIGCHLD: +- case SIGPWR: +- case SIGURG: +- case SIGWINCH: +- return sig_ignore; +- +- case SIGCONT: +- return sig_cont; +- +- case SIGSTOP: +- case SIGTSTP: +- case SIGTTIN: +- case SIGTTOU: +- return sig_stop; +- } +- +- panic ("Unknown signal number: %d", signo); +-} +- +-#endif +diff --git a/signal/sigaction.c b/signal/sigaction.c +deleted file mode 100644 +index 0126c99..0000000 +--- a/signal/sigaction.c ++++ /dev/null +@@ -1,72 +0,0 @@ +-/* sigaction.c - Generic sigaction implementation. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include "sig-internal.h" +-#include "pt-internal.h" +- +-int +-sigaction (int sig, const struct sigaction *restrict sa, +- struct sigaction *restrict osa) +-{ +- if (sig <= 0 || sig >= NSIG) +- { +- errno = EINVAL; +- return -1; +- } +- +- struct signal_state *ss = &_pthread_self ()->ss; +- +- pthread_mutex_lock (&ss->lock); +- +- if (osa) +- *osa = ss->actions[sig - 1]; +- +- if (sa) +- { +- ss->actions[sig - 1] = *sa; +- +- /* "The SIGKILL and SIGSTOP signals shall not be added to the +- signal mask using this mechanism; this restriction shall be +- enforced by the system without causing an error to be +- indicated" (sigaction). */ +- sigdelset (&ss->blocked, SIGKILL); +- sigdelset (&ss->blocked, SIGSTOP); +- +- /* A "signal shall remain pending on the process until it is +- unblocked, it is accepted when ..., or the action associated +- with it is set to ignore the signal" (2.4.1). +- +- "Setting a signal action to SIG_DFL for a signal that is +- pending, and whose default action is to ignore the signal, +- ..., shall cause the pending signal to be discarded, whether +- or not it is blocked" (2.4.3). */ +- if (sa->sa_handler == SIG_IGN +- || (sa->sa_handler == SIG_DFL && default_action (sig) == sig_ignore)) +- { +- sigdelset (&ss->pending, sig); +- sigdelset (&process_pending, sig); +- } +- } +- +- pthread_mutex_unlock (&ss->lock); +- +- return 0; +-} +- +diff --git a/signal/sigaltstack.c b/signal/sigaltstack.c +deleted file mode 100644 +index 8334811..0000000 +--- a/signal/sigaltstack.c ++++ /dev/null +@@ -1,69 +0,0 @@ +-/* sigaltstack.c - Generic sigaltstack implementation. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include "sig-internal.h" +-#include "pt-internal.h" +- +-int +-sigaltstack (const stack_t *restrict stack, stack_t *restrict old) +-{ +- int err = 0; +- struct signal_state *ss = &_pthread_self ()->ss; +- +- pthread_mutex_lock (&ss->lock); +- +- if (old) +- *old = ss->stack; +- +- if (stack) +- { +- if (stack->ss_size < MINSIGSTKSZ) +- { +- err = ENOMEM; +- goto out; +- } +- +- if ((stack->ss_flags & ~(SS_DISABLE))) +- /* Flags contains a value other than SS_DISABLE. */ +- { +- err = EINVAL; +- goto out; +- } +- +- if ((ss->stack.ss_flags & SS_ONSTACK)) +- /* Stack in use. */ +- { +- err = EPERM; +- goto out; +- } +- +- ss->stack = *stack; +- } +- +- out: +- pthread_mutex_unlock (&ss->lock); +- +- if (err) +- { +- errno = err; +- return -1; +- } +- return 0; +-} +diff --git a/signal/signal-dispatch.c b/signal/signal-dispatch.c +deleted file mode 100644 +index 40440b7..0000000 +--- a/signal/signal-dispatch.c ++++ /dev/null +@@ -1,117 +0,0 @@ +-/* signal-dispatch.c - Signal dispatcher. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include "sig-internal.h" +- +-/* This is the signal handler entry point. A thread is forced into +- this state when it receives a signal. We need to save the thread's +- state and then invoke the high-level signal dispatcher. SS->LOCK +- is locked by the caller. */ +-void +-signal_dispatch (struct signal_state *ss, siginfo_t *si) +-{ +- SIGNAL_DISPATCH_ENTRY; +- +- int signo = si->si_signo; +- +- assert (signo > 0 && signo < NSIG); +- assert (pthread_mutex_trylock (&ss->lock) == EBUSY); +- +- do +- { +- if ((sigmask (signo) & STOPSIGS)) +- /* Stop signals clear a pending SIGCONT even if they +- are handled or ignored (but not if preempted). */ +- { +- sigdelset (&ss->pending, SIGCONT); +- sigdelset (&process_pending, SIGCONT); +- } +- else if ((signo == SIGCONT)) +- /* Even if handled or ignored (but not preempted), SIGCONT +- clears stop signals and resumes the process. */ +- { +- ss->pending &= ~STOPSIGS; +- process_pending &= ~STOPSIGS; +- } +- +- void (*handler)(int, siginfo_t *, void *) +- = ss->actions[signo - 1].sa_sigaction; +- +- /* Reset to SIG_DFL if requested. SIGILL and SIGTRAP cannot +- be automatically reset when delivered; the system silently +- enforces this restriction (sigaction). */ +- if (ss->actions[signo - 1].sa_flags & SA_RESETHAND +- && signo != SIGILL && signo != SIGTRAP) +- ss->actions[signo - 1].sa_handler = SIG_DFL; +- +- sigset_t orig_blocked = ss->blocked; +- /* Block requested signals while running the handler. */ +- ss->blocked |= ss->actions[signo - 1].sa_mask; +- +- /* Block SIGNO unless we're asked not to. */ +- if (! (ss->actions[signo - 1].sa_flags & (SA_RESETHAND | SA_NODEFER))) +- sigaddset (&ss->blocked, signo); +- +- sigdelset (&ss->pending, signo); +- pthread_mutex_unlock (&ss->lock); +- +- pthread_mutex_lock (&sig_lock); +- sigdelset (&process_pending, signo); +- pthread_mutex_unlock (&sig_lock); +- +- if (handler == (void *) SIG_DFL) +- { +- enum sig_action action = default_action (signo); +- +- if (action == sig_terminate || action == sig_core) +- _exit (128 + signo); +- +- if (action == sig_stop) +- /* XXX: Implement me. */ +- panic ("Stopping process unimplemented."); +- +- if (action == sig_cont) +- /* XXX: Implement me. */; +- panic ("Continuing process unimplemented."); +- } +- else if (handler == (void *) SIG_IGN) +- ; +- else +- handler (signo, si, NULL); +- +- pthread_mutex_lock (&ss->lock); +- +- /* "When a thread's signal mask is changed in a signal-catching +- function that is installed by sigaction(), the restoration of +- the signal mask on return from the signal-catching function +- overrides that change (see sigaction())" (sigprocmask). */ +- ss->blocked = orig_blocked; +- +- sigset_t pending = ~ss->blocked & ss->pending; +- if (! pending) +- pending = ~ss->blocked & process_pending; +- signo = l4_lsb64 (pending); +- } +- while (signo); +- +- pthread_mutex_unlock (&ss->lock); +- +- SIGNAL_DISPATCH_EXIT; +-} +diff --git a/signal/signal.h b/signal/signal.h +deleted file mode 100644 +index 6e22d05..0000000 +--- a/signal/signal.h ++++ /dev/null +@@ -1,275 +0,0 @@ +-/* signal.h - Signal handling interface. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#ifndef _SIGNAL_H +-#define _SIGNAL_H 1 +- +-#include +-#include +- +-typedef volatile int sig_atomic_t; +- +-/*typedef uint64_t sigset_t;*/ +- +-int sigaddset (sigset_t *, int); +-int sigdelset (sigset_t *, int); +-int sigemptyset (sigset_t *); +-int sigfillset (sigset_t *); +-int sigismember (const sigset_t *, int); +- +-/* These values are consistent with Linux. */ +-#define SIGRTMIN 34 +-#define SIGRTMAX 64 +- +-enum +- { +- SIGHUP = 1, +-#define SIGHUP SIGHUP +- SIGINT, +-#define SIGINT SIGINT +- SIGQUIT, +-#define SIGQUIT SIGQUIT +- SIGILL, +-#define SIGILL SIGILL +- SIGTRAP, +-#define SIGTRAP SIGTRAP +- SIGABRT, +-#define SIGABRT SIGABRT +- SIGBUS, +-#define SIGBUS SIGBUS +- SIGFPE, +-#define SIGFPE SIGFPE +- SIGKILL, +-#define SIGKILL SIGKILL +- SIGUSR1, +-#define SIGUSR1 SIGUSR1 +- SIGSEGV, +-#define SIGSEGV SIGSEGV +- SIGUSR2, +-#define SIGUSR2 SIGUSR2 +- SIGPIPE, +-#define SIGPIPE SIGPIPE +- SIGALRM, +-#define SIGALRM SIGALRM +- SIGTERM, +-#define SIGTERM SIGTERM +- SIGSTKFLT, +-#define SIGSTKFLT SIGSTKFLT +- SIGCHLD, +-#define SIGCHLD SIGCHLD +- SIGCONT, +-#define SIGCONT SIGCONT +- SIGSTOP, +-#define SIGSTOP SIGSTOP +- SIGTSTP, +-#define SIGTSTP SIGTSTP +- SIGTTIN, +-#define SIGTTIN SIGTTIN +- SIGTTOU, +-#define SIGTTOU SIGTTOU +- SIGURG, +-#define SIGURG SIGURG +- SIGXCPU, +-#define SIGXCPU SIGXCPU +- SIGXFSZ, +-#define SIGXFSZ SIGXFSZ +- SIGVTALRM, +-#define SIGVTALRM SIGVTALRM +- SIGPROF, +-#define SIGPROF SIGPROF +- SIGWINCH, +-#define SIGWINCH SIGWINCH +- SIGIO, +-#define SIGIO SIGIO +- SIGPWR, +-#define SIGPWR SIGPWR +- SIGSYS, +-#define SIGSYS SIGSYS +- NSIG +- }; +- +-/* The resulting set is the union of the current set and the signal +- set pointed to by the argument set. */ +-#define SIG_BLOCK 1 +-/* The resulting set is the intersection of the current set and the +- complement of the signal set pointed to by the argument set. */ +-#define SIG_UNBLOCK 2 +-/* The resulting set is the signal set pointed to by the argument +- set. */ +-#define SIG_SETMASK 3 +- +-int pthread_sigmask (int how, const sigset_t *mask, sigset_t *old); +-int sigprocmask (int how, const sigset_t *restrict mask, +- sigset_t *restrict old); +- +-/* Return set of pending signals. */ +-int sigpending(sigset_t *set); +- +-union sigval +-{ +- int sival_int; +- void *sival_ptr; +-}; +- +-#define SIG_DFL ((void (*)(int)) (0)) +-#define SIG_ERR ((void (*)(int)) (-1)) +-#define SIG_IGN ((void (*)(int)) (1)) +- +-/* Causes signal delivery to occur on an alternate stack. */ +-#define SA_ONSTACK (1 << 0) +-/* Do not generate SIGCHLD when children stop or stopped children +- continue. */ +-#define SA_NOCLDSTOP (1 << 1) +-/* Causes signal dispositions to be set to SIG_DFL on entry to signal +- handlers. */ +-#define SA_RESETHAND (1 << 2) +-/* Causes certain functions to become restartable. */ +-#define SA_RESTART (1 << 3) +-/* Causes extra information to be passed to signal handlers at the +- time of receipt of a signal. */ +-#define SA_SIGINFO (1 << 4) +-/* Causes implementations not to create zombie processes on child +- death. */ +-#define SA_NOCLDWAIT (1 << 5) +-/* Causes signal not to be automatically blocked on entry to +- signal handler. */ +-#define SA_NODEFER (1 << 6) +- +-typedef struct +-{ +- int si_signo; +- int si_code; +- int si_errno; +- pid_t si_pid; +- uid_t si_uid; +- void *si_addr; +- int si_status; +- long si_band; +- union sigval si_value; +-} siginfo_t; +- +-struct sigaction +-{ +- union +- { +- /* Pointer to a signal-catching function or one of the macros +- SIG_IGN or SIG_DFL. */ +- void (*sa_handler)(int); +- +- /* Pointer to a signal-catching function. */ +- void (*sa_sigaction)(int, siginfo_t *, void *); +- }; +- +- /* Set of signals to be blocked during execution of the signal +- handling function. */ +- sigset_t sa_mask; +- +- /* Special flags. */ +- int sa_flags; +-}; +- +-int sigaction (int signo, const struct sigaction *restrict newaction, +- struct sigaction *restrict oldaction); +- +-void (*signal (int signo, void (*handler)(int)))(int); +-void (*bsd_signal (int signo, void (*handler)(int)))(int); +- +-/* Process is executing on an alternate signal stack. */ +-#define SS_ONSTACK (1 << 0) +-/* Alternate signal stack is disabled. */ +-#define SS_DISABLE (1 << 1) +- +-/* Minimum stack size for a signal handler. */ +-#define MINSIGSTKSZ PAGESIZE +-/* Default size in bytes for the alternate signal stack. */ +-#define SIGSTKSZ (16 * PAGESIZE) +- +-typedef struct +-{ +- void *ss_sp; +- size_t ss_size; +- int ss_flags; +-} stack_t; +- +-int sigaltstack(const stack_t *restrict stack, stack_t *restrict old); +- +-#include +- +-/* Send SIGNO to the process PID. */ +-int kill(pid_t pid, int signo); +- +-/* Send SIGNO to the process group PG. */ +-int killpg(pid_t pg, int signo); +- +-/* Send SIGNO to thread TID. */ +-int pthread_kill(pthread_t tid, int signo); +- +-/* Send a signal to thread TID using SIGINFO. */ +-int pthread_kill_siginfo_np (pthread_t tid, siginfo_t siginfo); +- +-/* Send SIGNO to the calling thread. */ +-int raise(int signo); +- +-typedef struct sigevent +-{ +- /* Notification type. */ +- int sigev_notify; +- +- /* Signal number. */ +- int sigev_signo; +- +- /* Signal value. */ +- union sigval sigev_value; +- +- /* Notification function. */ +- void (*sigev_notify_function) (union sigval); +- +- /* Notification attributes. */ +- pthread_attr_t *sigev_notify_attributes; +-} sigevent_t; +- +-enum +- { +- SIGEV_NONE = 0, +-#define SIGEV_NONE SIGEV_NONE +- SIGEV_SIGNAL, +-#define SIGEV_SIGNAL SIGEV_SIGNAL +- SIGEV_THREAD +-#define SIGEV_THREAD SIGEV_THREAD +- }; +- +-#define SIG_HOLD +- +-int sighold (int); +-int sigignore (int); +-int siginterrupt (int, int); +-int sigpause (int); +-int sigqueue (pid_t, int, const union sigval); +-int sigrelse (int); +-void (*sigset (int, void (*)(int)))(int); +-int sigsuspend (const sigset_t *); +- +-/* Wait for a signal. */ +-int sigwait (const sigset_t *restrict set, int *restrict signo); +-int sigwaitinfo (const sigset_t *restrict set, siginfo_t *restrict info); +-int sigtimedwait (const sigset_t *restrict set, siginfo_t *restrict info, +- const struct timespec *restrict timespec); +- +-#endif +diff --git a/signal/sigpending.c b/signal/sigpending.c +deleted file mode 100644 +index 609b55d..0000000 +--- a/signal/sigpending.c ++++ /dev/null +@@ -1,38 +0,0 @@ +-/* sigpending.c - Generic sigpending implementation. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include +-#include +- +-int +-sigpending (sigset_t *set) +-{ +- struct signal_state *ss = &_pthread_self ()->ss; +- +- pthread_mutex_lock (&ss->lock); +- +- /* There is no need to lock SIG_LOCK for process_pending since we +- just read it, which is atomic. */ +- *set = (ss->pending | process_pending) & ss->blocked; +- +- pthread_mutex_unlock (&ss->lock); +- +- return 0; +-} +diff --git a/signal/sigsuspend.c b/signal/sigsuspend.c +deleted file mode 100644 +index 73cf12a..0000000 +--- a/signal/sigsuspend.c ++++ /dev/null +@@ -1,29 +0,0 @@ +-/* sigsuspend.c - Generic sigsuspend implementation. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include "sig-internal.h" +- +-int +-sigsuspend (const sigset_t *set) +-{ +- /* XXX: Implement me. */ +- errno = EOPNOTSUPP; +- return -1; +-} +diff --git a/signal/sigtimedwait.c b/signal/sigtimedwait.c +deleted file mode 100644 +index 52cd017..0000000 +--- a/signal/sigtimedwait.c ++++ /dev/null +@@ -1,30 +0,0 @@ +-/* sigtimedwait.c - Generic sigtimedwait implementation. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include "sig-internal.h" +- +-int +-sigtimedwait (const sigset_t *restrict set, siginfo_t *restrict info, +- const struct timespec *restrict timeout) +-{ +- errno = EOPNOTSUPP; +- return -1; +-} +- +diff --git a/signal/sigwaiter.c b/signal/sigwaiter.c +deleted file mode 100644 +index 8d041ac..0000000 +--- a/signal/sigwaiter.c ++++ /dev/null +@@ -1,91 +0,0 @@ +-/* sigwaiter.c - Signal handling functions. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include "sig-internal.h" +- +-#include +- +-struct sigwaiter *sigwaiters; +- +-siginfo_t +-sigwaiter_block (struct signal_state *ss, const sigset_t *restrict set) +-{ +- assert (pthread_mutex_trylock (&sig_lock) == EBUSY); +- assert (pthread_mutex_trylock (&ss->lock) == EBUSY); +- +- assert (! ss->sigwaiter); +- +- struct sigwaiter waiter; +- +- waiter.next = sigwaiters; +- if (waiter.next) +- { +- assert (! waiter.next->prev); +- waiter.next->prev = &waiter; +- } +- waiter.prev = 0; +- sigwaiters = &waiter; +- +- waiter.ss = ss; +- waiter.info.si_signo = 0; +- waiter.signals = *set; +- +- ss->sigwaiter = &waiter; +- +- pthread_mutex_unlock (&ss->lock); +- pthread_mutex_unlock (&sig_lock); +- +- futex_wait (&waiter.info.si_signo, 0); +- +-#ifndef NDEBUG +- pthread_mutex_lock (&ss->lock); +- ss->sigwaiter = 0; +- pthread_mutex_unlock (&ss->lock); +-#endif +- +- assert (waiter.info.si_signo); +- return waiter.info; +-} +- +-void +-sigwaiter_unblock (struct sigwaiter *waiter) +-{ +- assert (pthread_mutex_trylock (&sig_lock) == EBUSY); +- assert (pthread_mutex_trylock (&waiter->ss->lock) == EBUSY); +- +- struct sigwaiter *prev = waiter->prev; +- struct sigwaiter *next = waiter->next; +- +- if (next) +- next->prev = prev; +- +- if (prev) +- prev->next = next; +- else +- sigwaiters = next; +- +- sigdelset (&process_pending, waiter->info.si_signo); +- sigdelset (&waiter->ss->pending, waiter->info.si_signo); +- +- pthread_mutex_unlock (&waiter->ss->lock); +- pthread_mutex_unlock (&sig_lock); +- +- futex_wake (&waiter->info.si_signo, 1); +-} +diff --git a/signal/sigwaitinfo.c b/signal/sigwaitinfo.c +deleted file mode 100644 +index 1b47079..0000000 +--- a/signal/sigwaitinfo.c ++++ /dev/null +@@ -1,74 +0,0 @@ +-/* sigwaitinfo.c - Generic sigwaitinfo implementation. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include +-#include +- +-int +-sigwaitinfo (const sigset_t *restrict set, siginfo_t *restrict info) +-{ +- pthread_mutex_lock (&sig_lock); +- +- struct signal_state *ss = &_pthread_self ()->ss; +- +- pthread_mutex_lock (&ss->lock); +- +- if ((process_pending & *set) || (ss->pending & *set)) +- /* There is at least one signal pending. */ +- { +- bool local = true; +- sigset_t extant = process_pending & *set; +- if (! extant) +- { +- local = false; +- extant = ss->pending & *set; +- } +- +- assert (extant); +- +- int signo = l4_msb64 (extant); +- +- if (info) +- { +- if (local) +- *info = ss->info[signo - 1]; +- else +- *info = process_pending_info[signo - 1]; +- info->si_signo = signo; +- } +- +- sigdelset (&process_pending, signo); +- sigdelset (&ss->pending, signo); +- +- pthread_mutex_unlock (&ss->lock); +- pthread_mutex_unlock (&sig_lock); +- return 0; +- } +- +- siginfo_t i = sigwaiter_block (ss, set); +- assert (i.si_signo); +- assert ((sigmask (i.si_signo) & *set)); +- +- if (info) +- *info = i; +- +- return 0; +-} +- +-- +1.9.0 + + +From 6eaedb37037965b99608cb8afbfc934c3396892e Mon Sep 17 00:00:00 2001 +From: Manolis Ragkousis +Date: Sun, 30 Mar 2014 17:23:12 +0000 +Subject: [PATCH 4/4] Revert + +commit 69e89a859882e4f675dd5491edc969159d8a4002 +Author: Pino Toscano +Date: Sun Apr 22 00:38:26 2012 +0200 + + __pthread_timedblock: switch to clock_gettime + + Use `clock_gettime' with the provided clock instead of +`gettimeofday', + linking to rt. + + * sysdeps/mach/pt-timedblock.c (__pthread_timedblock): Switch to + `clock_gettime'. + * Makefile [!IN_GLIBC] (LDLIBS): Link to rt. + [IN_GLIBC] ($(objpfx)libpthread.so): Likewise. + * Makefile.am (libpthread_a_LDADD): Likewise. +--- + Makefile | 2 -- + sysdeps/generic/pt-condattr-setclock.c | 28 ++++------------------------ + sysdeps/mach/pt-timedblock.c | 13 +++++++------ + 3 files changed, 11 insertions(+), 32 deletions(-) + +diff --git a/Makefile b/Makefile +index 8ef990e..2f45c1c 100644 +--- a/Makefile ++++ b/Makefile +@@ -216,10 +216,8 @@ VPATH += $(SYSDEP_PATH) + + ifeq ($(IN_GLIBC),no) + HURDLIBS = ihash +-LDLIBS = -lrt + else + LDLIBS-pthread.so = -lihash +-$(objpfx)libpthread.so: $(common-objpfx)rt/librt.so + endif + + ifeq ($(IN_GLIBC),no) +diff --git a/sysdeps/generic/pt-condattr-setclock.c b/sysdeps/generic/pt-condattr-setclock.c +index c5a78ef..c9a9948 100644 +--- a/sysdeps/generic/pt-condattr-setclock.c ++++ b/sysdeps/generic/pt-condattr-setclock.c +@@ -23,30 +23,10 @@ + int + pthread_condattr_setclock (pthread_condattr_t *attr, clockid_t clock) + { +- /* Only a few clocks are allowed. CLOCK_REALTIME is always allowed. +- CLOCK_MONOTONIC only if the kernel has the necessary support. */ +- if (clock == CLOCK_MONOTONIC) ++ if (__pthread_default_condattr.clock == clock) + { +- /* Check whether the clock is available. */ +- static int avail; +- +- if (avail == 0) +- { +- struct timespec ts; +- int res; +- +- res = clock_getres (CLOCK_MONOTONIC, &ts); +- avail = res < 0 ? -1 : 1; +- } +- +- if (avail < 0) +- /* Not available. */ +- return EINVAL; ++ attr->clock = clock; ++ return 0; + } +- else if (clock != CLOCK_REALTIME) +- return EINVAL; +- +- attr->clock = clock; +- +- return 0; ++ return EINVAL; + } +diff --git a/sysdeps/mach/pt-timedblock.c b/sysdeps/mach/pt-timedblock.c +index d72ef73..88beaa2 100644 +--- a/sysdeps/mach/pt-timedblock.c ++++ b/sysdeps/mach/pt-timedblock.c +@@ -36,26 +36,27 @@ __pthread_timedblock (struct __pthread *thread, + error_t err; + mach_msg_header_t msg; + mach_msg_timeout_t timeout; +- struct timespec now; ++ struct timeval now; + + /* We have an absolute time and now we have to convert it to a + relative time. Arg. */ + +- err = clock_gettime (clock_id, &now); ++ err = gettimeofday(&now, NULL); + assert (! err); + + if (now.tv_sec > abstime->tv_sec + || (now.tv_sec == abstime->tv_sec +- && now.tv_nsec > abstime->tv_nsec)) ++ && now.tv_usec > ((abstime->tv_nsec + 999) / 1000))) + return ETIMEDOUT; + + timeout = (abstime->tv_sec - now.tv_sec) * 1000; + +- if (abstime->tv_nsec >= now.tv_nsec) +- timeout += (abstime->tv_nsec - now.tv_nsec + 999999) / 1000000; ++ if (((abstime->tv_nsec + 999) / 1000) >= now.tv_usec) ++ timeout += (((abstime->tv_nsec + 999) / 1000) - now.tv_usec + 999) / 1000; + else + /* Need to do a carry. */ +- timeout -= (now.tv_nsec - abstime->tv_nsec + 999999) / 1000000; ++ timeout -= (now.tv_usec + 999) / 1000 - ++ ((abstime->tv_nsec + 999999) / 1000000); + + err = __mach_msg (&msg, MACH_RCV_MSG | MACH_RCV_TIMEOUT, 0, + sizeof msg, thread->wakeupmsg.msgh_remote_port, +-- +1.9.0 + +From 4067112197e4f8f5975c8647cab355e06736177d Mon Sep 17 00:00:00 2001 +From: Manolis Ragkousis +Date: Thu, 27 Mar 2014 00:21:36 +0000 +Subject: [PATCH 1/3] This helps to integrate libpthread as a glibc module. + +--- + configure | 2 ++ + 1 file changed, 2 insertions(+) + create mode 100644 configure + +diff --git a/configure b/configure +new file mode 100644 +index 0000000..2cdbc71 +--- /dev/null ++++ b/configure +@@ -0,0 +1,2 @@ ++libc_add_on_canonical=libpthread ++libc_add_on_subdirs=. +\ No newline at end of file +-- +1.9.0 + + +From 7f5f718b4a231c1e08d9ed1676cb18e265b715d6 Mon Sep 17 00:00:00 2001 +From: Manolis Ragkousis +Date: Sat, 29 Mar 2014 23:29:44 +0000 +Subject: [PATCH 2/3] fix + +--- + signal/signal.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/signal/signal.h b/signal/signal.h +index a33d995..6e22d05 100644 +--- a/signal/signal.h ++++ b/signal/signal.h +@@ -26,7 +26,7 @@ + + typedef volatile int sig_atomic_t; + +-typedef uint64_t sigset_t; ++/*typedef uint64_t sigset_t;*/ + + int sigaddset (sigset_t *, int); + int sigdelset (sigset_t *, int); +-- +1.9.0 + + +From b8639799ae3b571eb44edd2b3dec109957393d3e Mon Sep 17 00:00:00 2001 +From: Manolis Ragkousis +Date: Sun, 30 Mar 2014 16:56:09 +0000 +Subject: [PATCH 3/3] These come from the l4 implementation and come in the way + of the glibc Makefiles, drop them. + +--- + include/libc-symbols.h | 395 -------------------------------------------- + include/set-hooks.h | 72 -------- + signal/README | 12 -- + signal/TODO | 29 ---- + signal/kill.c | 70 -------- + signal/pt-kill-siginfo-np.c | 88 ---------- + signal/sig-internal.c | 26 --- + signal/sig-internal.h | 177 -------------------- + signal/sigaction.c | 72 -------- + signal/sigaltstack.c | 69 -------- + signal/signal-dispatch.c | 117 ------------- + signal/signal.h | 275 ------------------------------ + signal/sigpending.c | 38 ----- + signal/sigsuspend.c | 29 ---- + signal/sigtimedwait.c | 30 ---- + signal/sigwaiter.c | 91 ---------- + signal/sigwaitinfo.c | 74 --------- + 17 files changed, 1664 deletions(-) + delete mode 100644 include/libc-symbols.h + delete mode 100644 include/set-hooks.h + delete mode 100644 signal/README + delete mode 100644 signal/TODO + delete mode 100644 signal/kill.c + delete mode 100644 signal/pt-kill-siginfo-np.c + delete mode 100644 signal/sig-internal.c + delete mode 100644 signal/sig-internal.h + delete mode 100644 signal/sigaction.c + delete mode 100644 signal/sigaltstack.c + delete mode 100644 signal/signal-dispatch.c + delete mode 100644 signal/signal.h + delete mode 100644 signal/sigpending.c + delete mode 100644 signal/sigsuspend.c + delete mode 100644 signal/sigtimedwait.c + delete mode 100644 signal/sigwaiter.c + delete mode 100644 signal/sigwaitinfo.c + +diff --git a/include/libc-symbols.h b/include/libc-symbols.h +deleted file mode 100644 +index 54dd6e2..0000000 +--- a/include/libc-symbols.h ++++ /dev/null +@@ -1,395 +0,0 @@ +-/* Support macros for making weak and strong aliases for symbols, +- and for using symbol sets and linker warnings with GNU ld. +- Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2008 +- Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- +- The GNU C Library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2.1 of the License, or (at your option) any later version. +- +- The GNU C Library is distributed in the hope that it will be useful, +- but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with the GNU C Library; if not, write to the Free +- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +- 02111-1307 USA. */ +- +-#ifndef _LIBC_SYMBOLS_H +-#define _LIBC_SYMBOLS_H 1 +- +-/* This file's macros are included implicitly in the compilation of every +- file in the C library by -imacros. +- +- We include config.h which is generated by configure. +- It should define for us the following symbols: +- +- * HAVE_ASM_SET_DIRECTIVE if we have `.set B, A' instead of `A = B'. +- * ASM_GLOBAL_DIRECTIVE with `.globl' or `.global'. +- * HAVE_GNU_LD if using GNU ld, with support for weak symbols in a.out, +- and for symbol set and warning messages extensions in a.out and ELF. +- * HAVE_ELF if using ELF, which supports weak symbols using `.weak'. +- * HAVE_ASM_WEAK_DIRECTIVE if we have weak symbols using `.weak'. +- * HAVE_ASM_WEAKEXT_DIRECTIVE if we have weak symbols using `.weakext'. +- +- */ +- +-/* This is defined for the compilation of all C library code. features.h +- tests this to avoid inclusion of stubs.h while compiling the library, +- before stubs.h has been generated. Some library code that is shared +- with other packages also tests this symbol to see if it is being +- compiled as part of the C library. We must define this before including +- config.h, because it makes some definitions conditional on whether libc +- itself is being compiled, or just some generator program. */ +-// #define _LIBC 1 +- +-/* Enable declarations of GNU extensions, since we are compiling them. */ +-#define _GNU_SOURCE 1 +-/* And we also need the data for the reentrant functions. */ +-#define _REENTRANT 1 +- +-// #include +-#define HAVE_ASM_WEAK_DIRECTIVE +-#define HAVE_WEAK_SYMBOLS +-#define HAVE_ASM_SET_DIRECTIVE +-#define HAVE_BUILTIN_EXPECT +-#define HAVE_GNU_LD +-#define HAVE_ELF +-#define HAVE_SECTION_QUOTES +-#define HAVE_VISIBILITY_ATTRIBUTE +-#define HAVE_ASM_PREVIOUS_DIRECTIVE +-// #define SHARED +- +-/* The symbols in all the user (non-_) macros are C symbols. +- HAVE_GNU_LD without HAVE_ELF implies a.out. */ +- +-#if defined HAVE_ASM_WEAK_DIRECTIVE || defined HAVE_ASM_WEAKEXT_DIRECTIVE +-# define HAVE_WEAK_SYMBOLS +-#endif +- +-#ifndef __SYMBOL_PREFIX +-# ifdef NO_UNDERSCORES +-# define __SYMBOL_PREFIX +-# else +-# define __SYMBOL_PREFIX "_" +-# endif +-#endif +- +-#ifndef C_SYMBOL_NAME +-# ifdef NO_UNDERSCORES +-# define C_SYMBOL_NAME(name) name +-# else +-# define C_SYMBOL_NAME(name) _##name +-# endif +-#endif +- +-#ifndef ASM_LINE_SEP +-# define ASM_LINE_SEP ; +-#endif +- +-#ifndef C_SYMBOL_DOT_NAME +-# define C_SYMBOL_DOT_NAME(name) .##name +-#endif +- +-#ifndef __ASSEMBLER__ +-/* GCC understands weak symbols and aliases; use its interface where +- possible, instead of embedded assembly language. */ +- +-/* Define ALIASNAME as a strong alias for NAME. */ +-# define strong_alias(name, aliasname) _strong_alias(name, aliasname) +-# define _strong_alias(name, aliasname) \ +- extern __typeof (name) aliasname __attribute__ ((alias (#name))); +- +-/* This comes between the return type and function name in +- a function definition to make that definition weak. */ +-# define weak_function __attribute__ ((weak)) +-# define weak_const_function __attribute__ ((weak, __const__)) +- +-# ifdef HAVE_WEAK_SYMBOLS +- +-/* Define ALIASNAME as a weak alias for NAME. +- If weak aliases are not available, this defines a strong alias. */ +-# define weak_alias(name, aliasname) _weak_alias (name, aliasname) +-# define _weak_alias(name, aliasname) \ +- extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))); +- +-/* Declare SYMBOL as weak undefined symbol (resolved to 0 if not defined). */ +-# define weak_extern(symbol) _weak_extern (symbol) +-# ifdef HAVE_ASM_WEAKEXT_DIRECTIVE +-# define _weak_extern(symbol) asm (".weakext " __SYMBOL_PREFIX #symbol); +-# else +-# define _weak_extern(symbol) asm (".weak " __SYMBOL_PREFIX #symbol); +-# endif +- +-# else +- +-# define weak_alias(name, aliasname) strong_alias(name, aliasname) +-# define weak_extern(symbol) /* Nothing. */ +- +-# endif +- +-#else /* __ASSEMBLER__ */ +- +-# ifdef HAVE_ASM_SET_DIRECTIVE +-# define strong_alias(original, alias) \ +- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ +- .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original) +-# else +-# ifdef HAVE_ASM_GLOBAL_DOT_NAME +-# define strong_alias(original, alias) \ +- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ +- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \ +- ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ +- C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original) +-# else +-# define strong_alias(original, alias) \ +- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ +- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) +-# endif +-# endif +- +-# ifdef HAVE_WEAK_SYMBOLS +-# ifdef HAVE_ASM_WEAKEXT_DIRECTIVE +-# define weak_alias(original, alias) \ +- .weakext C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original) +-# define weak_extern(symbol) \ +- .weakext C_SYMBOL_NAME (symbol) +- +-# else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */ +- +-# ifdef HAVE_ASM_GLOBAL_DOT_NAME +-# define weak_alias(original, alias) \ +- .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \ +- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \ +- ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ +- C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original) +-# else +-# define weak_alias(original, alias) \ +- .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \ +- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) +-# endif +- +-# define weak_extern(symbol) \ +- .weak C_SYMBOL_NAME (symbol) +- +-# endif /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */ +- +-# else /* ! HAVE_WEAK_SYMBOLS */ +- +-# define weak_alias(original, alias) strong_alias(original, alias) +-# define weak_extern(symbol) /* Nothing */ +-# endif /* ! HAVE_WEAK_SYMBOLS */ +- +-#endif /* __ASSEMBLER__ */ +- +-/* On some platforms we can make internal function calls (i.e., calls of +- functions not exported) a bit faster by using a different calling +- convention. */ +-#ifndef internal_function +-# define internal_function /* empty */ +-#endif +- +-/* Prepare for the case that `__builtin_expect' is not available. */ +-#ifndef HAVE_BUILTIN_EXPECT +-# define __builtin_expect(expr, val) (expr) +-#endif +- +-/* Determine the return address. */ +-#define RETURN_ADDRESS(nr) \ +- __builtin_extract_return_addr (__builtin_return_address (nr)) +- +-/* When a reference to SYMBOL is encountered, the linker will emit a +- warning message MSG. */ +-#ifdef HAVE_GNU_LD +-# ifdef HAVE_ELF +- +-/* We want the .gnu.warning.SYMBOL section to be unallocated. */ +-# ifdef HAVE_ASM_PREVIOUS_DIRECTIVE +-# define __make_section_unallocated(section_string) \ +- asm (".section " section_string "\n\t.previous"); +-# elif defined HAVE_ASM_POPSECTION_DIRECTIVE +-# define __make_section_unallocated(section_string) \ +- asm (".pushsection " section_string "\n\t.popsection"); +-# else +-# define __make_section_unallocated(section_string) +-# endif +- +-/* Tacking on "\n\t#" to the section name makes gcc put it's bogus +- section attributes on what looks like a comment to the assembler. */ +-# ifdef HAVE_SECTION_QUOTES +-# define link_warning(symbol, msg) \ +- __make_section_unallocated (".gnu.warning." #symbol) \ +- static const char __evoke_link_warning_##symbol[] \ +- __attribute__ ((unused, section (".gnu.warning." #symbol "\"\n\t#\""))) \ +- = msg; +-# else +-# define link_warning(symbol, msg) \ +- __make_section_unallocated (".gnu.warning." #symbol) \ +- static const char __evoke_link_warning_##symbol[] \ +- __attribute__ ((unused, section (".gnu.warning." #symbol "\n\t#"))) = msg; +-# endif +-# else /* Not ELF: a.out */ +-# ifdef HAVE_XCOFF +-/* XCOFF does not support .stabs. +- The native aix linker will remove the .stab and .stabstr sections +- The gnu linker will have a fatal error if there is a relocation for +- symbol in the .stab section. Silently disable this macro. */ +-# define link_warning(symbol, msg) +-# else +-# define link_warning(symbol, msg) \ +- asm (".stabs \"" msg "\",30,0,0,0\n\t" \ +- ".stabs \"" __SYMBOL_PREFIX #symbol "\",1,0,0,0\n"); +-# endif /* XCOFF */ +-# endif +-#else +-/* We will never be heard; they will all die horribly. */ +-# define link_warning(symbol, msg) +-#endif +- +-/* A canned warning for sysdeps/stub functions. */ +-#define stub_warning(name) \ +- link_warning (name, \ +- "warning: " #name " is not implemented and will always fail") +- +-/* +- +-*/ +- +-#ifdef HAVE_GNU_LD +- +-/* Symbol set support macros. */ +- +-# ifdef HAVE_ELF +- +-/* Make SYMBOL, which is in the text segment, an element of SET. */ +-# define text_set_element(set, symbol) _elf_set_element(set, symbol) +-/* Make SYMBOL, which is in the data segment, an element of SET. */ +-# define data_set_element(set, symbol) _elf_set_element(set, symbol) +-/* Make SYMBOL, which is in the bss segment, an element of SET. */ +-# define bss_set_element(set, symbol) _elf_set_element(set, symbol) +- +-/* These are all done the same way in ELF. +- There is a new section created for each set. */ +-# ifdef SHARED +-/* When building a shared library, make the set section writable, +- because it will need to be relocated at run time anyway. */ +-# define _elf_set_element(set, symbol) \ +- static const void *__elf_set_##set##_element_##symbol##__ \ +- __attribute__ ((unused, section (#set))) = &(symbol) +-# else +-# define _elf_set_element(set, symbol) \ +- static const void *const __elf_set_##set##_element_##symbol##__ \ +- __attribute__ ((unused, section (#set))) = &(symbol) +-# endif +- +-/* Define SET as a symbol set. This may be required (it is in a.out) to +- be able to use the set's contents. */ +-# define symbol_set_define(set) symbol_set_declare(set) +- +-/* Declare SET for use in this module, if defined in another module. */ +-# define symbol_set_declare(set) \ +- extern void *const __start_##set __attribute__ ((__weak__)); \ +- extern void *const __stop_##set __attribute__ ((__weak__)); \ +- weak_extern (__start_##set) weak_extern (__stop_##set) +- +-/* Return a pointer (void *const *) to the first element of SET. */ +-# define symbol_set_first_element(set) (&__start_##set) +- +-/* Return true iff PTR (a void *const *) has been incremented +- past the last element in SET. */ +-# define symbol_set_end_p(set, ptr) ((ptr) >= &__stop_##set) +- +-# else /* Not ELF: a.out. */ +- +-# ifdef HAVE_XCOFF +-/* XCOFF does not support .stabs. +- The native aix linker will remove the .stab and .stabstr sections +- The gnu linker will have a fatal error if there is a relocation for +- symbol in the .stab section. Silently disable these macros. */ +-# define text_set_element(set, symbol) +-# define data_set_element(set, symbol) +-# define bss_set_element(set, symbol) +-# else +-# define text_set_element(set, symbol) \ +- asm (".stabs \"" __SYMBOL_PREFIX #set "\",23,0,0," __SYMBOL_PREFIX #symbol) +-# define data_set_element(set, symbol) \ +- asm (".stabs \"" __SYMBOL_PREFIX #set "\",25,0,0," __SYMBOL_PREFIX #symbol) +-# define bss_set_element(set, symbol) ?error Must use initialized data. +-# endif /* XCOFF */ +-# define symbol_set_define(set) void *const (set)[1]; +-# define symbol_set_declare(set) extern void *const (set)[1]; +- +-# define symbol_set_first_element(set) &(set)[1] +-# define symbol_set_end_p(set, ptr) (*(ptr) == 0) +- +-# endif /* ELF. */ +-#else +-/* We cannot do anything in generial. */ +-# define text_set_element(set, symbol) asm ("") +-# define data_set_element(set, symbol) asm ("") +-# define bss_set_element(set, symbol) asm ("") +-# define symbol_set_define(set) void *const (set)[1]; +-# define symbol_set_declare(set) extern void *const (set)[1]; +- +-# define symbol_set_first_element(set) &(set)[1] +-# define symbol_set_end_p(set, ptr) (*(ptr) == 0) +-#endif /* Have GNU ld. */ +- +-#if DO_VERSIONING +-# define symbol_version(real, name, version) \ +- _symbol_version(real, name, version) +-# define default_symbol_version(real, name, version) \ +- _default_symbol_version(real, name, version) +-# ifdef __ASSEMBLER__ +-# define _symbol_version(real, name, version) \ +- .symver real, address@hidden +-# define _default_symbol_version(real, name, version) \ +- .symver real, address@hidden@##version +-# else +-# define _symbol_version(real, name, version) \ +- __asm__ (".symver " #real "," #name "@" #version) +-# define _default_symbol_version(real, name, version) \ +- __asm__ (".symver " #real "," #name "@@" #version) +-# endif +-#else +-# define symbol_version(real, name, version) +-# define default_symbol_version(real, name, version) \ +- strong_alias(real, name) +-#endif +- +-#if defined HAVE_VISIBILITY_ATTRIBUTE && defined SHARED +-# define attribute_hidden __attribute__ ((visibility ("hidden"))) +-#else +-# define attribute_hidden +-#endif +- +-/* Handling on non-exported internal names. We have to do this only +- for shared code. */ +-#ifdef SHARED +-# define INTUSE(name) name##_internal +-# define INTDEF(name) strong_alias (name, name##_internal) +-# define INTVARDEF(name) \ +- _INTVARDEF (name, name##_internal) +-# if defined HAVE_VISIBILITY_ATTRIBUTE +-# define _INTVARDEF(name, aliasname) \ +- extern __typeof (name) aliasname __attribute__ ((alias (#name), \ +- visibility ("hidden"))); +-# else +-# define _INTVARDEF(name, aliasname) \ +- extern __typeof (name) aliasname __attribute__ ((alias (#name))); +-# endif +-# define INTDEF2(name, newname) strong_alias (name, newname##_internal) +-# define INTVARDEF2(name, newname) _INTVARDEF (name, newname##_internal) +-#else +-# define INTUSE(name) name +-# define INTDEF(name) +-# define INTVARDEF(name) +-# define INTDEF2(name, newname) +-# define INTVARDEF2(name, newname) +-#endif +- +-#endif /* libc-symbols.h */ +diff --git a/include/set-hooks.h b/include/set-hooks.h +deleted file mode 100644 +index 9ed71b3..0000000 +--- a/include/set-hooks.h ++++ /dev/null +@@ -1,72 +0,0 @@ +-/* Macros for using symbol sets for running lists of functions. +- Copyright (C) 1994, 1995, 1997, 2000 Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- +- The GNU C Library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2.1 of the License, or (at your option) any later version. +- +- The GNU C Library is distributed in the hope that it will be useful, +- but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with the GNU C Library; if not, write to the Free +- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +- 02111-1307 USA. */ +- +-#ifndef _SET_HOOKS_H +-#define _SET_HOOKS_H 1 +- +-#define __need_size_t +-#include +-// #include +-#define __unbounded +- +-#ifdef symbol_set_define +-/* Define a hook variable called NAME. Functions put on this hook take +- arguments described by PROTO. Use `text_set_element (NAME, FUNCTION)' +- from gnu-stabs.h to add a function to the hook. */ +- +-# define DEFINE_HOOK(NAME, PROTO) \ +- typedef void __##NAME##_hook_function_t PROTO; \ +- symbol_set_define (NAME) +- +-# define DECLARE_HOOK(NAME, PROTO) \ +- typedef void __##NAME##_hook_function_t PROTO;\ +- symbol_set_declare (NAME) +- +-/* Run all the functions hooked on the set called NAME. +- Each function is called like this: `function ARGS'. */ +- +-# define RUN_HOOK(NAME, ARGS) \ +-do { \ +- void *const *__unbounded ptr; \ +- for (ptr = symbol_set_first_element (NAME); \ +- ! symbol_set_end_p (NAME, ptr); ++ptr) \ +- (*(__##NAME##_hook_function_t *) *ptr) ARGS; \ +-} while (0) +- +-/* Define a hook variable with NAME and PROTO, and a function called RUNNER +- which calls each function on the hook in turn, with ARGS. */ +- +-# define DEFINE_HOOK_RUNNER(name, runner, proto, args) \ +-DEFINE_HOOK (name, proto); \ +-extern void runner proto; void runner proto { RUN_HOOK (name, args); } +- +-#else +- +-/* The system does not provide necessary support for this. */ +-# define DEFINE_HOOK(NAME, PROTO) +- +-# define DECLARE_HOOK(NAME, PROTO) +- +-# define RUN_HOOK(NAME, ARGS) +- +-# define DEFINE_HOOK_RUNNER(name, runner, proto, args) +- +-#endif +- +-#endif /* set-hooks.h */ +diff --git a/signal/README b/signal/README +deleted file mode 100644 +index 4963b26..0000000 +--- a/signal/README ++++ /dev/null +@@ -1,12 +0,0 @@ +-This directory provides a signal implementation, which is appropriate +-for operating systems where signals are managed at user-level. It is +-up to the run-time to catch the signals and forward them to the +-implementation via, e.g., the pthread_kill_info_np call. +- +-The files in this directory are accompanied by the generic implementations +-found in sysdeps/generic/: killpg.c, raise.c, sigaddset.c, sigdelset.c, +-sigemptyset.c, sigfillset.c, siginterrupt.c, sigismember.c, signal.c, +-sigwait.c. +- +-This implementation was once used for a native port running on L4, but is not +-currently used in any libpthread port bundled in this release. +diff --git a/signal/TODO b/signal/TODO +deleted file mode 100644 +index 1148abb..0000000 +--- a/signal/TODO ++++ /dev/null +@@ -1,29 +0,0 @@ +-Unimplemented Functionality +---------------------------- +- +-We don't support interruptible functions. That is, if a signal is +-delivered when a thread is in e.g. the write system call, then the +-write function should be interrupted and return EINTR when the signal +-handler is finished. To realize this behavior, we could have a thread +-local interruptible flag and a setjmp buffer. A function that is +-interruptible would fill the jump buffer and set the interruptible +-flag. If a signal comes in and the interruptible flag is set, rather +-than resuming the thread, we longjmp to the buffer. +- +-If a signal action has set the SA_SIGINFO, the third argument must be +-a pointer to a ucontext describing the thread's interrupted state; +-this implementation passes NULL. This isn't as bad as it sounds as +-the the ucontext family of functions are marked obsolete in SUSv3 with +-the advisory that any use of them should be replaced by the use of +-pthread functionality (cf. makecontext rationale). +- +-stop and continue signals are not implemented (as we need to stop all +-threads, this requires being in bed with libpthread). +- +-Implementation is not yet cancellation-safe. +- +-There are not even stubs for sighold, sigingore, sigpause, sigrelse, +-however, according to posix: "Use of any of these functions is +-unspecified in a multi-threaded process." +- +-Implement sigtimedwait, sigqueue. +\ No newline at end of file +diff --git a/signal/kill.c b/signal/kill.c +deleted file mode 100644 +index 27c9c32..0000000 +--- a/signal/kill.c ++++ /dev/null +@@ -1,70 +0,0 @@ +-/* kill.c - Generic kill implementation. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include "sig-internal.h" +- +-int +-kill (pid_t pid, int signo) +-{ +- if (pid != getpid ()) +- { +- errno = EOPNOTSUPP; +- return -1; +- } +- +- /* "Signals generated for the process shall be delivered to exactly +- one of those threads within the process which is in a call to a +- sigwait() function selecting that signal or has not blocked +- delivery of the signal. If there are no threads in a call to a +- sigwait() function selecting that signal, and if all threads +- within the process block delivery of the signal, the signal shall +- remaing pending on the process" (2.4.1). */ +- +- /* First, see if there is a waiter, which is interested in this +- signal. */ +- pthread_mutex_lock (&sig_lock); +- +- struct sigwaiter *waiter; +- for (waiter = sigwaiters; waiter; waiter = waiter->next) +- if ((waiter->signals & sigmask (signo))) +- /* Got a winner. */ +- { +- sigdelset (&process_pending, signo); +- +- pthread_mutex_lock (&waiter->ss->lock); +- sigdelset (&waiter->ss->pending, signo); +- +- memset (&waiter->info, 0, sizeof (waiter->info)); +- waiter->info.si_signo = signo; +- +- sigwaiter_unblock (waiter); +- +- return 0; +- } +- +- pthread_mutex_unlock (&sig_lock); +- +- /* XXX: We just generate the signal for the current thread. If the +- current thread has blocked the signal, the correct thing to do is +- to iterate over all the other threads and find on that hasn't +- blocked it. */ +- return pthread_kill (pthread_self (), signo); +-} +- +diff --git a/signal/pt-kill-siginfo-np.c b/signal/pt-kill-siginfo-np.c +deleted file mode 100644 +index 9bdf6cc..0000000 +--- a/signal/pt-kill-siginfo-np.c ++++ /dev/null +@@ -1,88 +0,0 @@ +-/* pthread-kill-siginfo-np.c - Generic pthread_kill_siginfo_np implementation. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include "pt-internal.h" +-#include "sig-internal.h" +- +-int +-pthread_kill_siginfo_np (pthread_t tid, siginfo_t si) +-{ +- int sig = si.si_signo; +- +- if (sig < 0 || sig >= NSIG) +- return EINVAL; +- +- if (sig == 0) +- return 0; +- +- struct signal_state *ss = &__pthread_getid (tid)->ss; +- +- pthread_mutex_lock (&sig_lock); +- pthread_mutex_lock (&ss->lock); +- +- if (ss->sigwaiter && (ss->sigwaiter->signals & sigmask (si.si_signo))) +- /* The thread is in a call to sigwait. */ +- { +- ss->sigwaiter->info = si; +- sigwaiter_unblock (ss->sigwaiter); +- return 0; +- } +- +- pthread_mutex_unlock (&sig_lock); +- +- if (ss->actions[sig - 1].sa_handler == (void *) SIG_IGN +- || (ss->actions[sig - 1].sa_handler == (void *) SIG_DFL +- && default_action (sig) == sig_ignore)) +- /* It is unclear (to me) what is supposed to happen when a signal +- is generated for a thread, which is blocking that signal and +- ignoring it. POSIX does say that when the action associated +- with a pending, blocked signal is set to SIG_IGN, the pending +- signal is to be cleared. Thus, it makes sense that any signal +- set to ignore is discarded at generation. */ +- { +- pthread_mutex_unlock (&ss->lock); +- return 0; +- } +- +- +- if ((sigmask (sig) & ss->blocked)) +- /* The signal is blocked. Mark it pending. */ +- { +- ss->pending |= sigmask (sig); +- pthread_mutex_unlock (&ss->lock); +- return 0; +- } +- +- if (pthread_self () == tid +- && (! (ss->actions[si.si_signo - 1].sa_flags & SA_ONSTACK) +- || (ss->stack.ss_flags & SS_DISABLE) +- || (ss->stack.ss_flags & SS_ONSTACK))) +- /* We are sending a signal to ourself and we don't use an +- alternate stack. */ +- signal_dispatch (ss, &si); +- else +- signal_dispatch_lowlevel (ss, tid, si); +- +- /* Don't unlock ss: signal_dispatch and signal_dispatch_lowlevel +- assume ownership of the lock. */ +- +- return 0; +-} +- +diff --git a/signal/sig-internal.c b/signal/sig-internal.c +deleted file mode 100644 +index f73f38b..0000000 +--- a/signal/sig-internal.c ++++ /dev/null +@@ -1,26 +0,0 @@ +-/* sig-internal.c - Signal state functions. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include "sig-internal.h" +- +-pthread_mutex_t sig_lock = PTHREAD_MUTEX_INITIALIZER; +- +-sigset_t process_pending; +-siginfo_t process_pending_info[NSIG]; +diff --git a/signal/sig-internal.h b/signal/sig-internal.h +deleted file mode 100644 +index 6c86c79..0000000 +--- a/signal/sig-internal.h ++++ /dev/null +@@ -1,177 +0,0 @@ +-/* sig-internal.h - Internal signal handling interface. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#ifndef SIG_INTERNAL_H +-#define SIG_INTERNAL_H +- +-#include +- +-#include +- +-#define sigmask(sig) (1ULL << (sig - 1)) +-#define STOPSIGS (sigmask (SIGTTIN) | sigmask (SIGTTOU) | \ +- sigmask (SIGSTOP) | sigmask (SIGTSTP)) +- +-/* General lock. Protects PROCESS_PENDING, PROCESS_PENDING_INFO, +- SIGWAITERS. */ +-extern pthread_mutex_t sig_lock; +- +-/* "Signals generated for the process shall be delivered to exactly +- one of those threads within the process which is in a call to a +- sigwait() function selecting that signal or has not blocked +- delivery of the signal. If there are no threads in a call to a +- sigwait() function selecting that signal, and if all threads within +- the process block delivery of the signal, the signal shall remaing +- pending on the process" (2.4.1). +- +- This variable is protected by SIG_LOCK. */ +-extern sigset_t process_pending; +-extern siginfo_t process_pending_info[NSIG]; +- +-struct sigwaiter; +- +-/* The per-thread signal state. */ +-struct signal_state +-{ +- /* Protects the following fields. STACK.SA_FLAGS may be accessed +- using atomic operations. */ +- pthread_mutex_t lock; +- +- /* Pending signals. */ +- sigset_t pending; +- +- /* Blocked signals (i.e., the signal mask). */ +- sigset_t blocked; +- +- stack_t stack; +- struct sigaction actions[NSIG]; +- siginfo_t info[NSIG]; +- +- /* If the thread is blocked in a call to sigwait. */ +- struct sigwaiter *sigwaiter; +-}; +- +-#define PTHREAD_SIGNAL_MEMBERS struct signal_state ss; +- +-/* Arranges for thread TID to call signal_dispatch. Must not be +- called if TID is the caller and an alternate stack is not required. +- In this case, the caller should call signal_dispatch directly. */ +-extern void signal_dispatch_lowlevel (struct signal_state *ss, +- pthread_t tid, siginfo_t si); +- +-/* This is the signal handler entry point. A thread is forced into +- this state when it receives a signal. We need to save the thread's +- state and then invoke the high-level signal dispatcher. SS->LOCK +- is locked by the caller. */ +-extern void signal_dispatch (struct signal_state *ss, siginfo_t *si); +- +-#ifndef SIGNAL_DISPATCH_ENTRY +-#define SIGNAL_DISPATCH_ENTRY +-#endif +- +-#ifndef SIGNAL_DISPATCH_EXIT +-#define SIGNAL_DISPATCH_EXIT +-#endif +- +-/* When a thread calls sigwait and a requested signal is not pending, +- it allocates the following structure, fills it in, adds it to +- sigwaiters and sleeps. */ +-struct sigwaiter +-{ +- struct sigwaiter *next; +- struct sigwaiter *prev; +- +- /* Thread's signal state. */ +- struct signal_state *ss; +- +- /* Signals this thread is waiting for. */ +- sigset_t signals; +- +- /* The selected signal is returned here. The waiter also +- futex_waits on this info.si_signo. */ +- siginfo_t info; +-}; +- +-/* This variable is protected by SIG_LOCK. */ +-extern struct sigwaiter *sigwaiters; +- +-/* Block the caller waiting for a signal in set SET. SIG_LOCK and +- SS->LOCK must be held and will be unlocked by this function before +- blocking. */ +-extern siginfo_t sigwaiter_block (struct signal_state *ss, +- const sigset_t *restrict set); +- +-/* Unblock the waiter WAITER. SIG_LOCK and WAITER->SS->LOCK must be +- held. Both will be dropped on return. */ +-extern void sigwaiter_unblock (struct sigwaiter *waiter); +- +-enum sig_action { sig_core, sig_terminate, sig_ignore, sig_cont, sig_stop }; +- +-static inline enum sig_action +-default_action (int signo) +-{ +- switch (signo) +- { +- case SIGABRT: +- case SIGBUS: +- case SIGFPE: +- case SIGILL: +- case SIGQUIT: +- case SIGSEGV: +- case SIGSTKFLT: +- case SIGSYS: +- case SIGTRAP: +- case SIGXCPU: +- case SIGXFSZ: +- return sig_core; +- +- case SIGALRM: +- case SIGHUP: +- case SIGINT: +- case SIGIO: /* Perhaps ignore? */ +- case SIGKILL: +- case SIGPIPE: +- case SIGPROF: +- case SIGTERM: +- case SIGUSR1: +- case SIGUSR2: +- case SIGVTALRM: +- return sig_terminate; +- +- case SIGCHLD: +- case SIGPWR: +- case SIGURG: +- case SIGWINCH: +- return sig_ignore; +- +- case SIGCONT: +- return sig_cont; +- +- case SIGSTOP: +- case SIGTSTP: +- case SIGTTIN: +- case SIGTTOU: +- return sig_stop; +- } +- +- panic ("Unknown signal number: %d", signo); +-} +- +-#endif +diff --git a/signal/sigaction.c b/signal/sigaction.c +deleted file mode 100644 +index 0126c99..0000000 +--- a/signal/sigaction.c ++++ /dev/null +@@ -1,72 +0,0 @@ +-/* sigaction.c - Generic sigaction implementation. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include "sig-internal.h" +-#include "pt-internal.h" +- +-int +-sigaction (int sig, const struct sigaction *restrict sa, +- struct sigaction *restrict osa) +-{ +- if (sig <= 0 || sig >= NSIG) +- { +- errno = EINVAL; +- return -1; +- } +- +- struct signal_state *ss = &_pthread_self ()->ss; +- +- pthread_mutex_lock (&ss->lock); +- +- if (osa) +- *osa = ss->actions[sig - 1]; +- +- if (sa) +- { +- ss->actions[sig - 1] = *sa; +- +- /* "The SIGKILL and SIGSTOP signals shall not be added to the +- signal mask using this mechanism; this restriction shall be +- enforced by the system without causing an error to be +- indicated" (sigaction). */ +- sigdelset (&ss->blocked, SIGKILL); +- sigdelset (&ss->blocked, SIGSTOP); +- +- /* A "signal shall remain pending on the process until it is +- unblocked, it is accepted when ..., or the action associated +- with it is set to ignore the signal" (2.4.1). +- +- "Setting a signal action to SIG_DFL for a signal that is +- pending, and whose default action is to ignore the signal, +- ..., shall cause the pending signal to be discarded, whether +- or not it is blocked" (2.4.3). */ +- if (sa->sa_handler == SIG_IGN +- || (sa->sa_handler == SIG_DFL && default_action (sig) == sig_ignore)) +- { +- sigdelset (&ss->pending, sig); +- sigdelset (&process_pending, sig); +- } +- } +- +- pthread_mutex_unlock (&ss->lock); +- +- return 0; +-} +- +diff --git a/signal/sigaltstack.c b/signal/sigaltstack.c +deleted file mode 100644 +index 8334811..0000000 +--- a/signal/sigaltstack.c ++++ /dev/null +@@ -1,69 +0,0 @@ +-/* sigaltstack.c - Generic sigaltstack implementation. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include "sig-internal.h" +-#include "pt-internal.h" +- +-int +-sigaltstack (const stack_t *restrict stack, stack_t *restrict old) +-{ +- int err = 0; +- struct signal_state *ss = &_pthread_self ()->ss; +- +- pthread_mutex_lock (&ss->lock); +- +- if (old) +- *old = ss->stack; +- +- if (stack) +- { +- if (stack->ss_size < MINSIGSTKSZ) +- { +- err = ENOMEM; +- goto out; +- } +- +- if ((stack->ss_flags & ~(SS_DISABLE))) +- /* Flags contains a value other than SS_DISABLE. */ +- { +- err = EINVAL; +- goto out; +- } +- +- if ((ss->stack.ss_flags & SS_ONSTACK)) +- /* Stack in use. */ +- { +- err = EPERM; +- goto out; +- } +- +- ss->stack = *stack; +- } +- +- out: +- pthread_mutex_unlock (&ss->lock); +- +- if (err) +- { +- errno = err; +- return -1; +- } +- return 0; +-} +diff --git a/signal/signal-dispatch.c b/signal/signal-dispatch.c +deleted file mode 100644 +index 40440b7..0000000 +--- a/signal/signal-dispatch.c ++++ /dev/null +@@ -1,117 +0,0 @@ +-/* signal-dispatch.c - Signal dispatcher. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include "sig-internal.h" +- +-/* This is the signal handler entry point. A thread is forced into +- this state when it receives a signal. We need to save the thread's +- state and then invoke the high-level signal dispatcher. SS->LOCK +- is locked by the caller. */ +-void +-signal_dispatch (struct signal_state *ss, siginfo_t *si) +-{ +- SIGNAL_DISPATCH_ENTRY; +- +- int signo = si->si_signo; +- +- assert (signo > 0 && signo < NSIG); +- assert (pthread_mutex_trylock (&ss->lock) == EBUSY); +- +- do +- { +- if ((sigmask (signo) & STOPSIGS)) +- /* Stop signals clear a pending SIGCONT even if they +- are handled or ignored (but not if preempted). */ +- { +- sigdelset (&ss->pending, SIGCONT); +- sigdelset (&process_pending, SIGCONT); +- } +- else if ((signo == SIGCONT)) +- /* Even if handled or ignored (but not preempted), SIGCONT +- clears stop signals and resumes the process. */ +- { +- ss->pending &= ~STOPSIGS; +- process_pending &= ~STOPSIGS; +- } +- +- void (*handler)(int, siginfo_t *, void *) +- = ss->actions[signo - 1].sa_sigaction; +- +- /* Reset to SIG_DFL if requested. SIGILL and SIGTRAP cannot +- be automatically reset when delivered; the system silently +- enforces this restriction (sigaction). */ +- if (ss->actions[signo - 1].sa_flags & SA_RESETHAND +- && signo != SIGILL && signo != SIGTRAP) +- ss->actions[signo - 1].sa_handler = SIG_DFL; +- +- sigset_t orig_blocked = ss->blocked; +- /* Block requested signals while running the handler. */ +- ss->blocked |= ss->actions[signo - 1].sa_mask; +- +- /* Block SIGNO unless we're asked not to. */ +- if (! (ss->actions[signo - 1].sa_flags & (SA_RESETHAND | SA_NODEFER))) +- sigaddset (&ss->blocked, signo); +- +- sigdelset (&ss->pending, signo); +- pthread_mutex_unlock (&ss->lock); +- +- pthread_mutex_lock (&sig_lock); +- sigdelset (&process_pending, signo); +- pthread_mutex_unlock (&sig_lock); +- +- if (handler == (void *) SIG_DFL) +- { +- enum sig_action action = default_action (signo); +- +- if (action == sig_terminate || action == sig_core) +- _exit (128 + signo); +- +- if (action == sig_stop) +- /* XXX: Implement me. */ +- panic ("Stopping process unimplemented."); +- +- if (action == sig_cont) +- /* XXX: Implement me. */; +- panic ("Continuing process unimplemented."); +- } +- else if (handler == (void *) SIG_IGN) +- ; +- else +- handler (signo, si, NULL); +- +- pthread_mutex_lock (&ss->lock); +- +- /* "When a thread's signal mask is changed in a signal-catching +- function that is installed by sigaction(), the restoration of +- the signal mask on return from the signal-catching function +- overrides that change (see sigaction())" (sigprocmask). */ +- ss->blocked = orig_blocked; +- +- sigset_t pending = ~ss->blocked & ss->pending; +- if (! pending) +- pending = ~ss->blocked & process_pending; +- signo = l4_lsb64 (pending); +- } +- while (signo); +- +- pthread_mutex_unlock (&ss->lock); +- +- SIGNAL_DISPATCH_EXIT; +-} +diff --git a/signal/signal.h b/signal/signal.h +deleted file mode 100644 +index 6e22d05..0000000 +--- a/signal/signal.h ++++ /dev/null +@@ -1,275 +0,0 @@ +-/* signal.h - Signal handling interface. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#ifndef _SIGNAL_H +-#define _SIGNAL_H 1 +- +-#include +-#include +- +-typedef volatile int sig_atomic_t; +- +-/*typedef uint64_t sigset_t;*/ +- +-int sigaddset (sigset_t *, int); +-int sigdelset (sigset_t *, int); +-int sigemptyset (sigset_t *); +-int sigfillset (sigset_t *); +-int sigismember (const sigset_t *, int); +- +-/* These values are consistent with Linux. */ +-#define SIGRTMIN 34 +-#define SIGRTMAX 64 +- +-enum +- { +- SIGHUP = 1, +-#define SIGHUP SIGHUP +- SIGINT, +-#define SIGINT SIGINT +- SIGQUIT, +-#define SIGQUIT SIGQUIT +- SIGILL, +-#define SIGILL SIGILL +- SIGTRAP, +-#define SIGTRAP SIGTRAP +- SIGABRT, +-#define SIGABRT SIGABRT +- SIGBUS, +-#define SIGBUS SIGBUS +- SIGFPE, +-#define SIGFPE SIGFPE +- SIGKILL, +-#define SIGKILL SIGKILL +- SIGUSR1, +-#define SIGUSR1 SIGUSR1 +- SIGSEGV, +-#define SIGSEGV SIGSEGV +- SIGUSR2, +-#define SIGUSR2 SIGUSR2 +- SIGPIPE, +-#define SIGPIPE SIGPIPE +- SIGALRM, +-#define SIGALRM SIGALRM +- SIGTERM, +-#define SIGTERM SIGTERM +- SIGSTKFLT, +-#define SIGSTKFLT SIGSTKFLT +- SIGCHLD, +-#define SIGCHLD SIGCHLD +- SIGCONT, +-#define SIGCONT SIGCONT +- SIGSTOP, +-#define SIGSTOP SIGSTOP +- SIGTSTP, +-#define SIGTSTP SIGTSTP +- SIGTTIN, +-#define SIGTTIN SIGTTIN +- SIGTTOU, +-#define SIGTTOU SIGTTOU +- SIGURG, +-#define SIGURG SIGURG +- SIGXCPU, +-#define SIGXCPU SIGXCPU +- SIGXFSZ, +-#define SIGXFSZ SIGXFSZ +- SIGVTALRM, +-#define SIGVTALRM SIGVTALRM +- SIGPROF, +-#define SIGPROF SIGPROF +- SIGWINCH, +-#define SIGWINCH SIGWINCH +- SIGIO, +-#define SIGIO SIGIO +- SIGPWR, +-#define SIGPWR SIGPWR +- SIGSYS, +-#define SIGSYS SIGSYS +- NSIG +- }; +- +-/* The resulting set is the union of the current set and the signal +- set pointed to by the argument set. */ +-#define SIG_BLOCK 1 +-/* The resulting set is the intersection of the current set and the +- complement of the signal set pointed to by the argument set. */ +-#define SIG_UNBLOCK 2 +-/* The resulting set is the signal set pointed to by the argument +- set. */ +-#define SIG_SETMASK 3 +- +-int pthread_sigmask (int how, const sigset_t *mask, sigset_t *old); +-int sigprocmask (int how, const sigset_t *restrict mask, +- sigset_t *restrict old); +- +-/* Return set of pending signals. */ +-int sigpending(sigset_t *set); +- +-union sigval +-{ +- int sival_int; +- void *sival_ptr; +-}; +- +-#define SIG_DFL ((void (*)(int)) (0)) +-#define SIG_ERR ((void (*)(int)) (-1)) +-#define SIG_IGN ((void (*)(int)) (1)) +- +-/* Causes signal delivery to occur on an alternate stack. */ +-#define SA_ONSTACK (1 << 0) +-/* Do not generate SIGCHLD when children stop or stopped children +- continue. */ +-#define SA_NOCLDSTOP (1 << 1) +-/* Causes signal dispositions to be set to SIG_DFL on entry to signal +- handlers. */ +-#define SA_RESETHAND (1 << 2) +-/* Causes certain functions to become restartable. */ +-#define SA_RESTART (1 << 3) +-/* Causes extra information to be passed to signal handlers at the +- time of receipt of a signal. */ +-#define SA_SIGINFO (1 << 4) +-/* Causes implementations not to create zombie processes on child +- death. */ +-#define SA_NOCLDWAIT (1 << 5) +-/* Causes signal not to be automatically blocked on entry to +- signal handler. */ +-#define SA_NODEFER (1 << 6) +- +-typedef struct +-{ +- int si_signo; +- int si_code; +- int si_errno; +- pid_t si_pid; +- uid_t si_uid; +- void *si_addr; +- int si_status; +- long si_band; +- union sigval si_value; +-} siginfo_t; +- +-struct sigaction +-{ +- union +- { +- /* Pointer to a signal-catching function or one of the macros +- SIG_IGN or SIG_DFL. */ +- void (*sa_handler)(int); +- +- /* Pointer to a signal-catching function. */ +- void (*sa_sigaction)(int, siginfo_t *, void *); +- }; +- +- /* Set of signals to be blocked during execution of the signal +- handling function. */ +- sigset_t sa_mask; +- +- /* Special flags. */ +- int sa_flags; +-}; +- +-int sigaction (int signo, const struct sigaction *restrict newaction, +- struct sigaction *restrict oldaction); +- +-void (*signal (int signo, void (*handler)(int)))(int); +-void (*bsd_signal (int signo, void (*handler)(int)))(int); +- +-/* Process is executing on an alternate signal stack. */ +-#define SS_ONSTACK (1 << 0) +-/* Alternate signal stack is disabled. */ +-#define SS_DISABLE (1 << 1) +- +-/* Minimum stack size for a signal handler. */ +-#define MINSIGSTKSZ PAGESIZE +-/* Default size in bytes for the alternate signal stack. */ +-#define SIGSTKSZ (16 * PAGESIZE) +- +-typedef struct +-{ +- void *ss_sp; +- size_t ss_size; +- int ss_flags; +-} stack_t; +- +-int sigaltstack(const stack_t *restrict stack, stack_t *restrict old); +- +-#include +- +-/* Send SIGNO to the process PID. */ +-int kill(pid_t pid, int signo); +- +-/* Send SIGNO to the process group PG. */ +-int killpg(pid_t pg, int signo); +- +-/* Send SIGNO to thread TID. */ +-int pthread_kill(pthread_t tid, int signo); +- +-/* Send a signal to thread TID using SIGINFO. */ +-int pthread_kill_siginfo_np (pthread_t tid, siginfo_t siginfo); +- +-/* Send SIGNO to the calling thread. */ +-int raise(int signo); +- +-typedef struct sigevent +-{ +- /* Notification type. */ +- int sigev_notify; +- +- /* Signal number. */ +- int sigev_signo; +- +- /* Signal value. */ +- union sigval sigev_value; +- +- /* Notification function. */ +- void (*sigev_notify_function) (union sigval); +- +- /* Notification attributes. */ +- pthread_attr_t *sigev_notify_attributes; +-} sigevent_t; +- +-enum +- { +- SIGEV_NONE = 0, +-#define SIGEV_NONE SIGEV_NONE +- SIGEV_SIGNAL, +-#define SIGEV_SIGNAL SIGEV_SIGNAL +- SIGEV_THREAD +-#define SIGEV_THREAD SIGEV_THREAD +- }; +- +-#define SIG_HOLD +- +-int sighold (int); +-int sigignore (int); +-int siginterrupt (int, int); +-int sigpause (int); +-int sigqueue (pid_t, int, const union sigval); +-int sigrelse (int); +-void (*sigset (int, void (*)(int)))(int); +-int sigsuspend (const sigset_t *); +- +-/* Wait for a signal. */ +-int sigwait (const sigset_t *restrict set, int *restrict signo); +-int sigwaitinfo (const sigset_t *restrict set, siginfo_t *restrict info); +-int sigtimedwait (const sigset_t *restrict set, siginfo_t *restrict info, +- const struct timespec *restrict timespec); +- +-#endif +diff --git a/signal/sigpending.c b/signal/sigpending.c +deleted file mode 100644 +index 609b55d..0000000 +--- a/signal/sigpending.c ++++ /dev/null +@@ -1,38 +0,0 @@ +-/* sigpending.c - Generic sigpending implementation. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include +-#include +- +-int +-sigpending (sigset_t *set) +-{ +- struct signal_state *ss = &_pthread_self ()->ss; +- +- pthread_mutex_lock (&ss->lock); +- +- /* There is no need to lock SIG_LOCK for process_pending since we +- just read it, which is atomic. */ +- *set = (ss->pending | process_pending) & ss->blocked; +- +- pthread_mutex_unlock (&ss->lock); +- +- return 0; +-} +diff --git a/signal/sigsuspend.c b/signal/sigsuspend.c +deleted file mode 100644 +index 73cf12a..0000000 +--- a/signal/sigsuspend.c ++++ /dev/null +@@ -1,29 +0,0 @@ +-/* sigsuspend.c - Generic sigsuspend implementation. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include "sig-internal.h" +- +-int +-sigsuspend (const sigset_t *set) +-{ +- /* XXX: Implement me. */ +- errno = EOPNOTSUPP; +- return -1; +-} +diff --git a/signal/sigtimedwait.c b/signal/sigtimedwait.c +deleted file mode 100644 +index 52cd017..0000000 +--- a/signal/sigtimedwait.c ++++ /dev/null +@@ -1,30 +0,0 @@ +-/* sigtimedwait.c - Generic sigtimedwait implementation. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include "sig-internal.h" +- +-int +-sigtimedwait (const sigset_t *restrict set, siginfo_t *restrict info, +- const struct timespec *restrict timeout) +-{ +- errno = EOPNOTSUPP; +- return -1; +-} +- +diff --git a/signal/sigwaiter.c b/signal/sigwaiter.c +deleted file mode 100644 +index 8d041ac..0000000 +--- a/signal/sigwaiter.c ++++ /dev/null +@@ -1,91 +0,0 @@ +-/* sigwaiter.c - Signal handling functions. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include "sig-internal.h" +- +-#include +- +-struct sigwaiter *sigwaiters; +- +-siginfo_t +-sigwaiter_block (struct signal_state *ss, const sigset_t *restrict set) +-{ +- assert (pthread_mutex_trylock (&sig_lock) == EBUSY); +- assert (pthread_mutex_trylock (&ss->lock) == EBUSY); +- +- assert (! ss->sigwaiter); +- +- struct sigwaiter waiter; +- +- waiter.next = sigwaiters; +- if (waiter.next) +- { +- assert (! waiter.next->prev); +- waiter.next->prev = &waiter; +- } +- waiter.prev = 0; +- sigwaiters = &waiter; +- +- waiter.ss = ss; +- waiter.info.si_signo = 0; +- waiter.signals = *set; +- +- ss->sigwaiter = &waiter; +- +- pthread_mutex_unlock (&ss->lock); +- pthread_mutex_unlock (&sig_lock); +- +- futex_wait (&waiter.info.si_signo, 0); +- +-#ifndef NDEBUG +- pthread_mutex_lock (&ss->lock); +- ss->sigwaiter = 0; +- pthread_mutex_unlock (&ss->lock); +-#endif +- +- assert (waiter.info.si_signo); +- return waiter.info; +-} +- +-void +-sigwaiter_unblock (struct sigwaiter *waiter) +-{ +- assert (pthread_mutex_trylock (&sig_lock) == EBUSY); +- assert (pthread_mutex_trylock (&waiter->ss->lock) == EBUSY); +- +- struct sigwaiter *prev = waiter->prev; +- struct sigwaiter *next = waiter->next; +- +- if (next) +- next->prev = prev; +- +- if (prev) +- prev->next = next; +- else +- sigwaiters = next; +- +- sigdelset (&process_pending, waiter->info.si_signo); +- sigdelset (&waiter->ss->pending, waiter->info.si_signo); +- +- pthread_mutex_unlock (&waiter->ss->lock); +- pthread_mutex_unlock (&sig_lock); +- +- futex_wake (&waiter->info.si_signo, 1); +-} +diff --git a/signal/sigwaitinfo.c b/signal/sigwaitinfo.c +deleted file mode 100644 +index 1b47079..0000000 +--- a/signal/sigwaitinfo.c ++++ /dev/null +@@ -1,74 +0,0 @@ +-/* sigwaitinfo.c - Generic sigwaitinfo implementation. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include +-#include +- +-int +-sigwaitinfo (const sigset_t *restrict set, siginfo_t *restrict info) +-{ +- pthread_mutex_lock (&sig_lock); +- +- struct signal_state *ss = &_pthread_self ()->ss; +- +- pthread_mutex_lock (&ss->lock); +- +- if ((process_pending & *set) || (ss->pending & *set)) +- /* There is at least one signal pending. */ +- { +- bool local = true; +- sigset_t extant = process_pending & *set; +- if (! extant) +- { +- local = false; +- extant = ss->pending & *set; +- } +- +- assert (extant); +- +- int signo = l4_msb64 (extant); +- +- if (info) +- { +- if (local) +- *info = ss->info[signo - 1]; +- else +- *info = process_pending_info[signo - 1]; +- info->si_signo = signo; +- } +- +- sigdelset (&process_pending, signo); +- sigdelset (&ss->pending, signo); +- +- pthread_mutex_unlock (&ss->lock); +- pthread_mutex_unlock (&sig_lock); +- return 0; +- } +- +- siginfo_t i = sigwaiter_block (ss, set); +- assert (i.si_signo); +- assert ((sigmask (i.si_signo) & *set)); +- +- if (info) +- *info = i; +- +- return 0; +-} +- +-- +1.9.0 + +From 4067112197e4f8f5975c8647cab355e06736177d Mon Sep 17 00:00:00 2001 +From: Manolis Ragkousis +Date: Thu, 27 Mar 2014 00:21:36 +0000 +Subject: [PATCH 1/3] This helps to integrate libpthread as a glibc module. + +--- + configure | 2 ++ + 1 file changed, 2 insertions(+) + create mode 100644 configure + +diff --git a/configure b/configure +new file mode 100644 +index 0000000..2cdbc71 +--- /dev/null ++++ b/configure +@@ -0,0 +1,2 @@ ++libc_add_on_canonical=libpthread ++libc_add_on_subdirs=. +\ No newline at end of file +-- +1.9.0 + + +From 7f5f718b4a231c1e08d9ed1676cb18e265b715d6 Mon Sep 17 00:00:00 2001 +From: Manolis Ragkousis +Date: Sat, 29 Mar 2014 23:29:44 +0000 +Subject: [PATCH 2/3] fix + +--- + signal/signal.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/signal/signal.h b/signal/signal.h +index a33d995..6e22d05 100644 +--- a/signal/signal.h ++++ b/signal/signal.h +@@ -26,7 +26,7 @@ + + typedef volatile int sig_atomic_t; + +-typedef uint64_t sigset_t; ++/*typedef uint64_t sigset_t;*/ + + int sigaddset (sigset_t *, int); + int sigdelset (sigset_t *, int); +-- +1.9.0 + + +From b8639799ae3b571eb44edd2b3dec109957393d3e Mon Sep 17 00:00:00 2001 +From: Manolis Ragkousis +Date: Sun, 30 Mar 2014 16:56:09 +0000 +Subject: [PATCH 3/3] These come from the l4 implementation and come in the way + of the glibc Makefiles, drop them. + +--- + include/libc-symbols.h | 395 -------------------------------------------- + include/set-hooks.h | 72 -------- + signal/README | 12 -- + signal/TODO | 29 ---- + signal/kill.c | 70 -------- + signal/pt-kill-siginfo-np.c | 88 ---------- + signal/sig-internal.c | 26 --- + signal/sig-internal.h | 177 -------------------- + signal/sigaction.c | 72 -------- + signal/sigaltstack.c | 69 -------- + signal/signal-dispatch.c | 117 ------------- + signal/signal.h | 275 ------------------------------ + signal/sigpending.c | 38 ----- + signal/sigsuspend.c | 29 ---- + signal/sigtimedwait.c | 30 ---- + signal/sigwaiter.c | 91 ---------- + signal/sigwaitinfo.c | 74 --------- + 17 files changed, 1664 deletions(-) + delete mode 100644 include/libc-symbols.h + delete mode 100644 include/set-hooks.h + delete mode 100644 signal/README + delete mode 100644 signal/TODO + delete mode 100644 signal/kill.c + delete mode 100644 signal/pt-kill-siginfo-np.c + delete mode 100644 signal/sig-internal.c + delete mode 100644 signal/sig-internal.h + delete mode 100644 signal/sigaction.c + delete mode 100644 signal/sigaltstack.c + delete mode 100644 signal/signal-dispatch.c + delete mode 100644 signal/signal.h + delete mode 100644 signal/sigpending.c + delete mode 100644 signal/sigsuspend.c + delete mode 100644 signal/sigtimedwait.c + delete mode 100644 signal/sigwaiter.c + delete mode 100644 signal/sigwaitinfo.c + +diff --git a/include/libc-symbols.h b/include/libc-symbols.h +deleted file mode 100644 +index 54dd6e2..0000000 +--- a/include/libc-symbols.h ++++ /dev/null +@@ -1,395 +0,0 @@ +-/* Support macros for making weak and strong aliases for symbols, +- and for using symbol sets and linker warnings with GNU ld. +- Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2008 +- Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- +- The GNU C Library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2.1 of the License, or (at your option) any later version. +- +- The GNU C Library is distributed in the hope that it will be useful, +- but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with the GNU C Library; if not, write to the Free +- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +- 02111-1307 USA. */ +- +-#ifndef _LIBC_SYMBOLS_H +-#define _LIBC_SYMBOLS_H 1 +- +-/* This file's macros are included implicitly in the compilation of every +- file in the C library by -imacros. +- +- We include config.h which is generated by configure. +- It should define for us the following symbols: +- +- * HAVE_ASM_SET_DIRECTIVE if we have `.set B, A' instead of `A = B'. +- * ASM_GLOBAL_DIRECTIVE with `.globl' or `.global'. +- * HAVE_GNU_LD if using GNU ld, with support for weak symbols in a.out, +- and for symbol set and warning messages extensions in a.out and ELF. +- * HAVE_ELF if using ELF, which supports weak symbols using `.weak'. +- * HAVE_ASM_WEAK_DIRECTIVE if we have weak symbols using `.weak'. +- * HAVE_ASM_WEAKEXT_DIRECTIVE if we have weak symbols using `.weakext'. +- +- */ +- +-/* This is defined for the compilation of all C library code. features.h +- tests this to avoid inclusion of stubs.h while compiling the library, +- before stubs.h has been generated. Some library code that is shared +- with other packages also tests this symbol to see if it is being +- compiled as part of the C library. We must define this before including +- config.h, because it makes some definitions conditional on whether libc +- itself is being compiled, or just some generator program. */ +-// #define _LIBC 1 +- +-/* Enable declarations of GNU extensions, since we are compiling them. */ +-#define _GNU_SOURCE 1 +-/* And we also need the data for the reentrant functions. */ +-#define _REENTRANT 1 +- +-// #include +-#define HAVE_ASM_WEAK_DIRECTIVE +-#define HAVE_WEAK_SYMBOLS +-#define HAVE_ASM_SET_DIRECTIVE +-#define HAVE_BUILTIN_EXPECT +-#define HAVE_GNU_LD +-#define HAVE_ELF +-#define HAVE_SECTION_QUOTES +-#define HAVE_VISIBILITY_ATTRIBUTE +-#define HAVE_ASM_PREVIOUS_DIRECTIVE +-// #define SHARED +- +-/* The symbols in all the user (non-_) macros are C symbols. +- HAVE_GNU_LD without HAVE_ELF implies a.out. */ +- +-#if defined HAVE_ASM_WEAK_DIRECTIVE || defined HAVE_ASM_WEAKEXT_DIRECTIVE +-# define HAVE_WEAK_SYMBOLS +-#endif +- +-#ifndef __SYMBOL_PREFIX +-# ifdef NO_UNDERSCORES +-# define __SYMBOL_PREFIX +-# else +-# define __SYMBOL_PREFIX "_" +-# endif +-#endif +- +-#ifndef C_SYMBOL_NAME +-# ifdef NO_UNDERSCORES +-# define C_SYMBOL_NAME(name) name +-# else +-# define C_SYMBOL_NAME(name) _##name +-# endif +-#endif +- +-#ifndef ASM_LINE_SEP +-# define ASM_LINE_SEP ; +-#endif +- +-#ifndef C_SYMBOL_DOT_NAME +-# define C_SYMBOL_DOT_NAME(name) .##name +-#endif +- +-#ifndef __ASSEMBLER__ +-/* GCC understands weak symbols and aliases; use its interface where +- possible, instead of embedded assembly language. */ +- +-/* Define ALIASNAME as a strong alias for NAME. */ +-# define strong_alias(name, aliasname) _strong_alias(name, aliasname) +-# define _strong_alias(name, aliasname) \ +- extern __typeof (name) aliasname __attribute__ ((alias (#name))); +- +-/* This comes between the return type and function name in +- a function definition to make that definition weak. */ +-# define weak_function __attribute__ ((weak)) +-# define weak_const_function __attribute__ ((weak, __const__)) +- +-# ifdef HAVE_WEAK_SYMBOLS +- +-/* Define ALIASNAME as a weak alias for NAME. +- If weak aliases are not available, this defines a strong alias. */ +-# define weak_alias(name, aliasname) _weak_alias (name, aliasname) +-# define _weak_alias(name, aliasname) \ +- extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))); +- +-/* Declare SYMBOL as weak undefined symbol (resolved to 0 if not defined). */ +-# define weak_extern(symbol) _weak_extern (symbol) +-# ifdef HAVE_ASM_WEAKEXT_DIRECTIVE +-# define _weak_extern(symbol) asm (".weakext " __SYMBOL_PREFIX #symbol); +-# else +-# define _weak_extern(symbol) asm (".weak " __SYMBOL_PREFIX #symbol); +-# endif +- +-# else +- +-# define weak_alias(name, aliasname) strong_alias(name, aliasname) +-# define weak_extern(symbol) /* Nothing. */ +- +-# endif +- +-#else /* __ASSEMBLER__ */ +- +-# ifdef HAVE_ASM_SET_DIRECTIVE +-# define strong_alias(original, alias) \ +- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ +- .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original) +-# else +-# ifdef HAVE_ASM_GLOBAL_DOT_NAME +-# define strong_alias(original, alias) \ +- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ +- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \ +- ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ +- C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original) +-# else +-# define strong_alias(original, alias) \ +- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ +- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) +-# endif +-# endif +- +-# ifdef HAVE_WEAK_SYMBOLS +-# ifdef HAVE_ASM_WEAKEXT_DIRECTIVE +-# define weak_alias(original, alias) \ +- .weakext C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original) +-# define weak_extern(symbol) \ +- .weakext C_SYMBOL_NAME (symbol) +- +-# else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */ +- +-# ifdef HAVE_ASM_GLOBAL_DOT_NAME +-# define weak_alias(original, alias) \ +- .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \ +- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \ +- ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ +- C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original) +-# else +-# define weak_alias(original, alias) \ +- .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \ +- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) +-# endif +- +-# define weak_extern(symbol) \ +- .weak C_SYMBOL_NAME (symbol) +- +-# endif /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */ +- +-# else /* ! HAVE_WEAK_SYMBOLS */ +- +-# define weak_alias(original, alias) strong_alias(original, alias) +-# define weak_extern(symbol) /* Nothing */ +-# endif /* ! HAVE_WEAK_SYMBOLS */ +- +-#endif /* __ASSEMBLER__ */ +- +-/* On some platforms we can make internal function calls (i.e., calls of +- functions not exported) a bit faster by using a different calling +- convention. */ +-#ifndef internal_function +-# define internal_function /* empty */ +-#endif +- +-/* Prepare for the case that `__builtin_expect' is not available. */ +-#ifndef HAVE_BUILTIN_EXPECT +-# define __builtin_expect(expr, val) (expr) +-#endif +- +-/* Determine the return address. */ +-#define RETURN_ADDRESS(nr) \ +- __builtin_extract_return_addr (__builtin_return_address (nr)) +- +-/* When a reference to SYMBOL is encountered, the linker will emit a +- warning message MSG. */ +-#ifdef HAVE_GNU_LD +-# ifdef HAVE_ELF +- +-/* We want the .gnu.warning.SYMBOL section to be unallocated. */ +-# ifdef HAVE_ASM_PREVIOUS_DIRECTIVE +-# define __make_section_unallocated(section_string) \ +- asm (".section " section_string "\n\t.previous"); +-# elif defined HAVE_ASM_POPSECTION_DIRECTIVE +-# define __make_section_unallocated(section_string) \ +- asm (".pushsection " section_string "\n\t.popsection"); +-# else +-# define __make_section_unallocated(section_string) +-# endif +- +-/* Tacking on "\n\t#" to the section name makes gcc put it's bogus +- section attributes on what looks like a comment to the assembler. */ +-# ifdef HAVE_SECTION_QUOTES +-# define link_warning(symbol, msg) \ +- __make_section_unallocated (".gnu.warning." #symbol) \ +- static const char __evoke_link_warning_##symbol[] \ +- __attribute__ ((unused, section (".gnu.warning." #symbol "\"\n\t#\""))) \ +- = msg; +-# else +-# define link_warning(symbol, msg) \ +- __make_section_unallocated (".gnu.warning." #symbol) \ +- static const char __evoke_link_warning_##symbol[] \ +- __attribute__ ((unused, section (".gnu.warning." #symbol "\n\t#"))) = msg; +-# endif +-# else /* Not ELF: a.out */ +-# ifdef HAVE_XCOFF +-/* XCOFF does not support .stabs. +- The native aix linker will remove the .stab and .stabstr sections +- The gnu linker will have a fatal error if there is a relocation for +- symbol in the .stab section. Silently disable this macro. */ +-# define link_warning(symbol, msg) +-# else +-# define link_warning(symbol, msg) \ +- asm (".stabs \"" msg "\",30,0,0,0\n\t" \ +- ".stabs \"" __SYMBOL_PREFIX #symbol "\",1,0,0,0\n"); +-# endif /* XCOFF */ +-# endif +-#else +-/* We will never be heard; they will all die horribly. */ +-# define link_warning(symbol, msg) +-#endif +- +-/* A canned warning for sysdeps/stub functions. */ +-#define stub_warning(name) \ +- link_warning (name, \ +- "warning: " #name " is not implemented and will always fail") +- +-/* +- +-*/ +- +-#ifdef HAVE_GNU_LD +- +-/* Symbol set support macros. */ +- +-# ifdef HAVE_ELF +- +-/* Make SYMBOL, which is in the text segment, an element of SET. */ +-# define text_set_element(set, symbol) _elf_set_element(set, symbol) +-/* Make SYMBOL, which is in the data segment, an element of SET. */ +-# define data_set_element(set, symbol) _elf_set_element(set, symbol) +-/* Make SYMBOL, which is in the bss segment, an element of SET. */ +-# define bss_set_element(set, symbol) _elf_set_element(set, symbol) +- +-/* These are all done the same way in ELF. +- There is a new section created for each set. */ +-# ifdef SHARED +-/* When building a shared library, make the set section writable, +- because it will need to be relocated at run time anyway. */ +-# define _elf_set_element(set, symbol) \ +- static const void *__elf_set_##set##_element_##symbol##__ \ +- __attribute__ ((unused, section (#set))) = &(symbol) +-# else +-# define _elf_set_element(set, symbol) \ +- static const void *const __elf_set_##set##_element_##symbol##__ \ +- __attribute__ ((unused, section (#set))) = &(symbol) +-# endif +- +-/* Define SET as a symbol set. This may be required (it is in a.out) to +- be able to use the set's contents. */ +-# define symbol_set_define(set) symbol_set_declare(set) +- +-/* Declare SET for use in this module, if defined in another module. */ +-# define symbol_set_declare(set) \ +- extern void *const __start_##set __attribute__ ((__weak__)); \ +- extern void *const __stop_##set __attribute__ ((__weak__)); \ +- weak_extern (__start_##set) weak_extern (__stop_##set) +- +-/* Return a pointer (void *const *) to the first element of SET. */ +-# define symbol_set_first_element(set) (&__start_##set) +- +-/* Return true iff PTR (a void *const *) has been incremented +- past the last element in SET. */ +-# define symbol_set_end_p(set, ptr) ((ptr) >= &__stop_##set) +- +-# else /* Not ELF: a.out. */ +- +-# ifdef HAVE_XCOFF +-/* XCOFF does not support .stabs. +- The native aix linker will remove the .stab and .stabstr sections +- The gnu linker will have a fatal error if there is a relocation for +- symbol in the .stab section. Silently disable these macros. */ +-# define text_set_element(set, symbol) +-# define data_set_element(set, symbol) +-# define bss_set_element(set, symbol) +-# else +-# define text_set_element(set, symbol) \ +- asm (".stabs \"" __SYMBOL_PREFIX #set "\",23,0,0," __SYMBOL_PREFIX #symbol) +-# define data_set_element(set, symbol) \ +- asm (".stabs \"" __SYMBOL_PREFIX #set "\",25,0,0," __SYMBOL_PREFIX #symbol) +-# define bss_set_element(set, symbol) ?error Must use initialized data. +-# endif /* XCOFF */ +-# define symbol_set_define(set) void *const (set)[1]; +-# define symbol_set_declare(set) extern void *const (set)[1]; +- +-# define symbol_set_first_element(set) &(set)[1] +-# define symbol_set_end_p(set, ptr) (*(ptr) == 0) +- +-# endif /* ELF. */ +-#else +-/* We cannot do anything in generial. */ +-# define text_set_element(set, symbol) asm ("") +-# define data_set_element(set, symbol) asm ("") +-# define bss_set_element(set, symbol) asm ("") +-# define symbol_set_define(set) void *const (set)[1]; +-# define symbol_set_declare(set) extern void *const (set)[1]; +- +-# define symbol_set_first_element(set) &(set)[1] +-# define symbol_set_end_p(set, ptr) (*(ptr) == 0) +-#endif /* Have GNU ld. */ +- +-#if DO_VERSIONING +-# define symbol_version(real, name, version) \ +- _symbol_version(real, name, version) +-# define default_symbol_version(real, name, version) \ +- _default_symbol_version(real, name, version) +-# ifdef __ASSEMBLER__ +-# define _symbol_version(real, name, version) \ +- .symver real, address@hidden +-# define _default_symbol_version(real, name, version) \ +- .symver real, address@hidden@##version +-# else +-# define _symbol_version(real, name, version) \ +- __asm__ (".symver " #real "," #name "@" #version) +-# define _default_symbol_version(real, name, version) \ +- __asm__ (".symver " #real "," #name "@@" #version) +-# endif +-#else +-# define symbol_version(real, name, version) +-# define default_symbol_version(real, name, version) \ +- strong_alias(real, name) +-#endif +- +-#if defined HAVE_VISIBILITY_ATTRIBUTE && defined SHARED +-# define attribute_hidden __attribute__ ((visibility ("hidden"))) +-#else +-# define attribute_hidden +-#endif +- +-/* Handling on non-exported internal names. We have to do this only +- for shared code. */ +-#ifdef SHARED +-# define INTUSE(name) name##_internal +-# define INTDEF(name) strong_alias (name, name##_internal) +-# define INTVARDEF(name) \ +- _INTVARDEF (name, name##_internal) +-# if defined HAVE_VISIBILITY_ATTRIBUTE +-# define _INTVARDEF(name, aliasname) \ +- extern __typeof (name) aliasname __attribute__ ((alias (#name), \ +- visibility ("hidden"))); +-# else +-# define _INTVARDEF(name, aliasname) \ +- extern __typeof (name) aliasname __attribute__ ((alias (#name))); +-# endif +-# define INTDEF2(name, newname) strong_alias (name, newname##_internal) +-# define INTVARDEF2(name, newname) _INTVARDEF (name, newname##_internal) +-#else +-# define INTUSE(name) name +-# define INTDEF(name) +-# define INTVARDEF(name) +-# define INTDEF2(name, newname) +-# define INTVARDEF2(name, newname) +-#endif +- +-#endif /* libc-symbols.h */ +diff --git a/include/set-hooks.h b/include/set-hooks.h +deleted file mode 100644 +index 9ed71b3..0000000 +--- a/include/set-hooks.h ++++ /dev/null +@@ -1,72 +0,0 @@ +-/* Macros for using symbol sets for running lists of functions. +- Copyright (C) 1994, 1995, 1997, 2000 Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- +- The GNU C Library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2.1 of the License, or (at your option) any later version. +- +- The GNU C Library is distributed in the hope that it will be useful, +- but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with the GNU C Library; if not, write to the Free +- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +- 02111-1307 USA. */ +- +-#ifndef _SET_HOOKS_H +-#define _SET_HOOKS_H 1 +- +-#define __need_size_t +-#include +-// #include +-#define __unbounded +- +-#ifdef symbol_set_define +-/* Define a hook variable called NAME. Functions put on this hook take +- arguments described by PROTO. Use `text_set_element (NAME, FUNCTION)' +- from gnu-stabs.h to add a function to the hook. */ +- +-# define DEFINE_HOOK(NAME, PROTO) \ +- typedef void __##NAME##_hook_function_t PROTO; \ +- symbol_set_define (NAME) +- +-# define DECLARE_HOOK(NAME, PROTO) \ +- typedef void __##NAME##_hook_function_t PROTO;\ +- symbol_set_declare (NAME) +- +-/* Run all the functions hooked on the set called NAME. +- Each function is called like this: `function ARGS'. */ +- +-# define RUN_HOOK(NAME, ARGS) \ +-do { \ +- void *const *__unbounded ptr; \ +- for (ptr = symbol_set_first_element (NAME); \ +- ! symbol_set_end_p (NAME, ptr); ++ptr) \ +- (*(__##NAME##_hook_function_t *) *ptr) ARGS; \ +-} while (0) +- +-/* Define a hook variable with NAME and PROTO, and a function called RUNNER +- which calls each function on the hook in turn, with ARGS. */ +- +-# define DEFINE_HOOK_RUNNER(name, runner, proto, args) \ +-DEFINE_HOOK (name, proto); \ +-extern void runner proto; void runner proto { RUN_HOOK (name, args); } +- +-#else +- +-/* The system does not provide necessary support for this. */ +-# define DEFINE_HOOK(NAME, PROTO) +- +-# define DECLARE_HOOK(NAME, PROTO) +- +-# define RUN_HOOK(NAME, ARGS) +- +-# define DEFINE_HOOK_RUNNER(name, runner, proto, args) +- +-#endif +- +-#endif /* set-hooks.h */ +diff --git a/signal/README b/signal/README +deleted file mode 100644 +index 4963b26..0000000 +--- a/signal/README ++++ /dev/null +@@ -1,12 +0,0 @@ +-This directory provides a signal implementation, which is appropriate +-for operating systems where signals are managed at user-level. It is +-up to the run-time to catch the signals and forward them to the +-implementation via, e.g., the pthread_kill_info_np call. +- +-The files in this directory are accompanied by the generic implementations +-found in sysdeps/generic/: killpg.c, raise.c, sigaddset.c, sigdelset.c, +-sigemptyset.c, sigfillset.c, siginterrupt.c, sigismember.c, signal.c, +-sigwait.c. +- +-This implementation was once used for a native port running on L4, but is not +-currently used in any libpthread port bundled in this release. +diff --git a/signal/TODO b/signal/TODO +deleted file mode 100644 +index 1148abb..0000000 +--- a/signal/TODO ++++ /dev/null +@@ -1,29 +0,0 @@ +-Unimplemented Functionality +---------------------------- +- +-We don't support interruptible functions. That is, if a signal is +-delivered when a thread is in e.g. the write system call, then the +-write function should be interrupted and return EINTR when the signal +-handler is finished. To realize this behavior, we could have a thread +-local interruptible flag and a setjmp buffer. A function that is +-interruptible would fill the jump buffer and set the interruptible +-flag. If a signal comes in and the interruptible flag is set, rather +-than resuming the thread, we longjmp to the buffer. +- +-If a signal action has set the SA_SIGINFO, the third argument must be +-a pointer to a ucontext describing the thread's interrupted state; +-this implementation passes NULL. This isn't as bad as it sounds as +-the the ucontext family of functions are marked obsolete in SUSv3 with +-the advisory that any use of them should be replaced by the use of +-pthread functionality (cf. makecontext rationale). +- +-stop and continue signals are not implemented (as we need to stop all +-threads, this requires being in bed with libpthread). +- +-Implementation is not yet cancellation-safe. +- +-There are not even stubs for sighold, sigingore, sigpause, sigrelse, +-however, according to posix: "Use of any of these functions is +-unspecified in a multi-threaded process." +- +-Implement sigtimedwait, sigqueue. +\ No newline at end of file +diff --git a/signal/kill.c b/signal/kill.c +deleted file mode 100644 +index 27c9c32..0000000 +--- a/signal/kill.c ++++ /dev/null +@@ -1,70 +0,0 @@ +-/* kill.c - Generic kill implementation. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include "sig-internal.h" +- +-int +-kill (pid_t pid, int signo) +-{ +- if (pid != getpid ()) +- { +- errno = EOPNOTSUPP; +- return -1; +- } +- +- /* "Signals generated for the process shall be delivered to exactly +- one of those threads within the process which is in a call to a +- sigwait() function selecting that signal or has not blocked +- delivery of the signal. If there are no threads in a call to a +- sigwait() function selecting that signal, and if all threads +- within the process block delivery of the signal, the signal shall +- remaing pending on the process" (2.4.1). */ +- +- /* First, see if there is a waiter, which is interested in this +- signal. */ +- pthread_mutex_lock (&sig_lock); +- +- struct sigwaiter *waiter; +- for (waiter = sigwaiters; waiter; waiter = waiter->next) +- if ((waiter->signals & sigmask (signo))) +- /* Got a winner. */ +- { +- sigdelset (&process_pending, signo); +- +- pthread_mutex_lock (&waiter->ss->lock); +- sigdelset (&waiter->ss->pending, signo); +- +- memset (&waiter->info, 0, sizeof (waiter->info)); +- waiter->info.si_signo = signo; +- +- sigwaiter_unblock (waiter); +- +- return 0; +- } +- +- pthread_mutex_unlock (&sig_lock); +- +- /* XXX: We just generate the signal for the current thread. If the +- current thread has blocked the signal, the correct thing to do is +- to iterate over all the other threads and find on that hasn't +- blocked it. */ +- return pthread_kill (pthread_self (), signo); +-} +- +diff --git a/signal/pt-kill-siginfo-np.c b/signal/pt-kill-siginfo-np.c +deleted file mode 100644 +index 9bdf6cc..0000000 +--- a/signal/pt-kill-siginfo-np.c ++++ /dev/null +@@ -1,88 +0,0 @@ +-/* pthread-kill-siginfo-np.c - Generic pthread_kill_siginfo_np implementation. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include "pt-internal.h" +-#include "sig-internal.h" +- +-int +-pthread_kill_siginfo_np (pthread_t tid, siginfo_t si) +-{ +- int sig = si.si_signo; +- +- if (sig < 0 || sig >= NSIG) +- return EINVAL; +- +- if (sig == 0) +- return 0; +- +- struct signal_state *ss = &__pthread_getid (tid)->ss; +- +- pthread_mutex_lock (&sig_lock); +- pthread_mutex_lock (&ss->lock); +- +- if (ss->sigwaiter && (ss->sigwaiter->signals & sigmask (si.si_signo))) +- /* The thread is in a call to sigwait. */ +- { +- ss->sigwaiter->info = si; +- sigwaiter_unblock (ss->sigwaiter); +- return 0; +- } +- +- pthread_mutex_unlock (&sig_lock); +- +- if (ss->actions[sig - 1].sa_handler == (void *) SIG_IGN +- || (ss->actions[sig - 1].sa_handler == (void *) SIG_DFL +- && default_action (sig) == sig_ignore)) +- /* It is unclear (to me) what is supposed to happen when a signal +- is generated for a thread, which is blocking that signal and +- ignoring it. POSIX does say that when the action associated +- with a pending, blocked signal is set to SIG_IGN, the pending +- signal is to be cleared. Thus, it makes sense that any signal +- set to ignore is discarded at generation. */ +- { +- pthread_mutex_unlock (&ss->lock); +- return 0; +- } +- +- +- if ((sigmask (sig) & ss->blocked)) +- /* The signal is blocked. Mark it pending. */ +- { +- ss->pending |= sigmask (sig); +- pthread_mutex_unlock (&ss->lock); +- return 0; +- } +- +- if (pthread_self () == tid +- && (! (ss->actions[si.si_signo - 1].sa_flags & SA_ONSTACK) +- || (ss->stack.ss_flags & SS_DISABLE) +- || (ss->stack.ss_flags & SS_ONSTACK))) +- /* We are sending a signal to ourself and we don't use an +- alternate stack. */ +- signal_dispatch (ss, &si); +- else +- signal_dispatch_lowlevel (ss, tid, si); +- +- /* Don't unlock ss: signal_dispatch and signal_dispatch_lowlevel +- assume ownership of the lock. */ +- +- return 0; +-} +- +diff --git a/signal/sig-internal.c b/signal/sig-internal.c +deleted file mode 100644 +index f73f38b..0000000 +--- a/signal/sig-internal.c ++++ /dev/null +@@ -1,26 +0,0 @@ +-/* sig-internal.c - Signal state functions. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include "sig-internal.h" +- +-pthread_mutex_t sig_lock = PTHREAD_MUTEX_INITIALIZER; +- +-sigset_t process_pending; +-siginfo_t process_pending_info[NSIG]; +diff --git a/signal/sig-internal.h b/signal/sig-internal.h +deleted file mode 100644 +index 6c86c79..0000000 +--- a/signal/sig-internal.h ++++ /dev/null +@@ -1,177 +0,0 @@ +-/* sig-internal.h - Internal signal handling interface. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#ifndef SIG_INTERNAL_H +-#define SIG_INTERNAL_H +- +-#include +- +-#include +- +-#define sigmask(sig) (1ULL << (sig - 1)) +-#define STOPSIGS (sigmask (SIGTTIN) | sigmask (SIGTTOU) | \ +- sigmask (SIGSTOP) | sigmask (SIGTSTP)) +- +-/* General lock. Protects PROCESS_PENDING, PROCESS_PENDING_INFO, +- SIGWAITERS. */ +-extern pthread_mutex_t sig_lock; +- +-/* "Signals generated for the process shall be delivered to exactly +- one of those threads within the process which is in a call to a +- sigwait() function selecting that signal or has not blocked +- delivery of the signal. If there are no threads in a call to a +- sigwait() function selecting that signal, and if all threads within +- the process block delivery of the signal, the signal shall remaing +- pending on the process" (2.4.1). +- +- This variable is protected by SIG_LOCK. */ +-extern sigset_t process_pending; +-extern siginfo_t process_pending_info[NSIG]; +- +-struct sigwaiter; +- +-/* The per-thread signal state. */ +-struct signal_state +-{ +- /* Protects the following fields. STACK.SA_FLAGS may be accessed +- using atomic operations. */ +- pthread_mutex_t lock; +- +- /* Pending signals. */ +- sigset_t pending; +- +- /* Blocked signals (i.e., the signal mask). */ +- sigset_t blocked; +- +- stack_t stack; +- struct sigaction actions[NSIG]; +- siginfo_t info[NSIG]; +- +- /* If the thread is blocked in a call to sigwait. */ +- struct sigwaiter *sigwaiter; +-}; +- +-#define PTHREAD_SIGNAL_MEMBERS struct signal_state ss; +- +-/* Arranges for thread TID to call signal_dispatch. Must not be +- called if TID is the caller and an alternate stack is not required. +- In this case, the caller should call signal_dispatch directly. */ +-extern void signal_dispatch_lowlevel (struct signal_state *ss, +- pthread_t tid, siginfo_t si); +- +-/* This is the signal handler entry point. A thread is forced into +- this state when it receives a signal. We need to save the thread's +- state and then invoke the high-level signal dispatcher. SS->LOCK +- is locked by the caller. */ +-extern void signal_dispatch (struct signal_state *ss, siginfo_t *si); +- +-#ifndef SIGNAL_DISPATCH_ENTRY +-#define SIGNAL_DISPATCH_ENTRY +-#endif +- +-#ifndef SIGNAL_DISPATCH_EXIT +-#define SIGNAL_DISPATCH_EXIT +-#endif +- +-/* When a thread calls sigwait and a requested signal is not pending, +- it allocates the following structure, fills it in, adds it to +- sigwaiters and sleeps. */ +-struct sigwaiter +-{ +- struct sigwaiter *next; +- struct sigwaiter *prev; +- +- /* Thread's signal state. */ +- struct signal_state *ss; +- +- /* Signals this thread is waiting for. */ +- sigset_t signals; +- +- /* The selected signal is returned here. The waiter also +- futex_waits on this info.si_signo. */ +- siginfo_t info; +-}; +- +-/* This variable is protected by SIG_LOCK. */ +-extern struct sigwaiter *sigwaiters; +- +-/* Block the caller waiting for a signal in set SET. SIG_LOCK and +- SS->LOCK must be held and will be unlocked by this function before +- blocking. */ +-extern siginfo_t sigwaiter_block (struct signal_state *ss, +- const sigset_t *restrict set); +- +-/* Unblock the waiter WAITER. SIG_LOCK and WAITER->SS->LOCK must be +- held. Both will be dropped on return. */ +-extern void sigwaiter_unblock (struct sigwaiter *waiter); +- +-enum sig_action { sig_core, sig_terminate, sig_ignore, sig_cont, sig_stop }; +- +-static inline enum sig_action +-default_action (int signo) +-{ +- switch (signo) +- { +- case SIGABRT: +- case SIGBUS: +- case SIGFPE: +- case SIGILL: +- case SIGQUIT: +- case SIGSEGV: +- case SIGSTKFLT: +- case SIGSYS: +- case SIGTRAP: +- case SIGXCPU: +- case SIGXFSZ: +- return sig_core; +- +- case SIGALRM: +- case SIGHUP: +- case SIGINT: +- case SIGIO: /* Perhaps ignore? */ +- case SIGKILL: +- case SIGPIPE: +- case SIGPROF: +- case SIGTERM: +- case SIGUSR1: +- case SIGUSR2: +- case SIGVTALRM: +- return sig_terminate; +- +- case SIGCHLD: +- case SIGPWR: +- case SIGURG: +- case SIGWINCH: +- return sig_ignore; +- +- case SIGCONT: +- return sig_cont; +- +- case SIGSTOP: +- case SIGTSTP: +- case SIGTTIN: +- case SIGTTOU: +- return sig_stop; +- } +- +- panic ("Unknown signal number: %d", signo); +-} +- +-#endif +diff --git a/signal/sigaction.c b/signal/sigaction.c +deleted file mode 100644 +index 0126c99..0000000 +--- a/signal/sigaction.c ++++ /dev/null +@@ -1,72 +0,0 @@ +-/* sigaction.c - Generic sigaction implementation. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include "sig-internal.h" +-#include "pt-internal.h" +- +-int +-sigaction (int sig, const struct sigaction *restrict sa, +- struct sigaction *restrict osa) +-{ +- if (sig <= 0 || sig >= NSIG) +- { +- errno = EINVAL; +- return -1; +- } +- +- struct signal_state *ss = &_pthread_self ()->ss; +- +- pthread_mutex_lock (&ss->lock); +- +- if (osa) +- *osa = ss->actions[sig - 1]; +- +- if (sa) +- { +- ss->actions[sig - 1] = *sa; +- +- /* "The SIGKILL and SIGSTOP signals shall not be added to the +- signal mask using this mechanism; this restriction shall be +- enforced by the system without causing an error to be +- indicated" (sigaction). */ +- sigdelset (&ss->blocked, SIGKILL); +- sigdelset (&ss->blocked, SIGSTOP); +- +- /* A "signal shall remain pending on the process until it is +- unblocked, it is accepted when ..., or the action associated +- with it is set to ignore the signal" (2.4.1). +- +- "Setting a signal action to SIG_DFL for a signal that is +- pending, and whose default action is to ignore the signal, +- ..., shall cause the pending signal to be discarded, whether +- or not it is blocked" (2.4.3). */ +- if (sa->sa_handler == SIG_IGN +- || (sa->sa_handler == SIG_DFL && default_action (sig) == sig_ignore)) +- { +- sigdelset (&ss->pending, sig); +- sigdelset (&process_pending, sig); +- } +- } +- +- pthread_mutex_unlock (&ss->lock); +- +- return 0; +-} +- +diff --git a/signal/sigaltstack.c b/signal/sigaltstack.c +deleted file mode 100644 +index 8334811..0000000 +--- a/signal/sigaltstack.c ++++ /dev/null +@@ -1,69 +0,0 @@ +-/* sigaltstack.c - Generic sigaltstack implementation. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include "sig-internal.h" +-#include "pt-internal.h" +- +-int +-sigaltstack (const stack_t *restrict stack, stack_t *restrict old) +-{ +- int err = 0; +- struct signal_state *ss = &_pthread_self ()->ss; +- +- pthread_mutex_lock (&ss->lock); +- +- if (old) +- *old = ss->stack; +- +- if (stack) +- { +- if (stack->ss_size < MINSIGSTKSZ) +- { +- err = ENOMEM; +- goto out; +- } +- +- if ((stack->ss_flags & ~(SS_DISABLE))) +- /* Flags contains a value other than SS_DISABLE. */ +- { +- err = EINVAL; +- goto out; +- } +- +- if ((ss->stack.ss_flags & SS_ONSTACK)) +- /* Stack in use. */ +- { +- err = EPERM; +- goto out; +- } +- +- ss->stack = *stack; +- } +- +- out: +- pthread_mutex_unlock (&ss->lock); +- +- if (err) +- { +- errno = err; +- return -1; +- } +- return 0; +-} +diff --git a/signal/signal-dispatch.c b/signal/signal-dispatch.c +deleted file mode 100644 +index 40440b7..0000000 +--- a/signal/signal-dispatch.c ++++ /dev/null +@@ -1,117 +0,0 @@ +-/* signal-dispatch.c - Signal dispatcher. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include "sig-internal.h" +- +-/* This is the signal handler entry point. A thread is forced into +- this state when it receives a signal. We need to save the thread's +- state and then invoke the high-level signal dispatcher. SS->LOCK +- is locked by the caller. */ +-void +-signal_dispatch (struct signal_state *ss, siginfo_t *si) +-{ +- SIGNAL_DISPATCH_ENTRY; +- +- int signo = si->si_signo; +- +- assert (signo > 0 && signo < NSIG); +- assert (pthread_mutex_trylock (&ss->lock) == EBUSY); +- +- do +- { +- if ((sigmask (signo) & STOPSIGS)) +- /* Stop signals clear a pending SIGCONT even if they +- are handled or ignored (but not if preempted). */ +- { +- sigdelset (&ss->pending, SIGCONT); +- sigdelset (&process_pending, SIGCONT); +- } +- else if ((signo == SIGCONT)) +- /* Even if handled or ignored (but not preempted), SIGCONT +- clears stop signals and resumes the process. */ +- { +- ss->pending &= ~STOPSIGS; +- process_pending &= ~STOPSIGS; +- } +- +- void (*handler)(int, siginfo_t *, void *) +- = ss->actions[signo - 1].sa_sigaction; +- +- /* Reset to SIG_DFL if requested. SIGILL and SIGTRAP cannot +- be automatically reset when delivered; the system silently +- enforces this restriction (sigaction). */ +- if (ss->actions[signo - 1].sa_flags & SA_RESETHAND +- && signo != SIGILL && signo != SIGTRAP) +- ss->actions[signo - 1].sa_handler = SIG_DFL; +- +- sigset_t orig_blocked = ss->blocked; +- /* Block requested signals while running the handler. */ +- ss->blocked |= ss->actions[signo - 1].sa_mask; +- +- /* Block SIGNO unless we're asked not to. */ +- if (! (ss->actions[signo - 1].sa_flags & (SA_RESETHAND | SA_NODEFER))) +- sigaddset (&ss->blocked, signo); +- +- sigdelset (&ss->pending, signo); +- pthread_mutex_unlock (&ss->lock); +- +- pthread_mutex_lock (&sig_lock); +- sigdelset (&process_pending, signo); +- pthread_mutex_unlock (&sig_lock); +- +- if (handler == (void *) SIG_DFL) +- { +- enum sig_action action = default_action (signo); +- +- if (action == sig_terminate || action == sig_core) +- _exit (128 + signo); +- +- if (action == sig_stop) +- /* XXX: Implement me. */ +- panic ("Stopping process unimplemented."); +- +- if (action == sig_cont) +- /* XXX: Implement me. */; +- panic ("Continuing process unimplemented."); +- } +- else if (handler == (void *) SIG_IGN) +- ; +- else +- handler (signo, si, NULL); +- +- pthread_mutex_lock (&ss->lock); +- +- /* "When a thread's signal mask is changed in a signal-catching +- function that is installed by sigaction(), the restoration of +- the signal mask on return from the signal-catching function +- overrides that change (see sigaction())" (sigprocmask). */ +- ss->blocked = orig_blocked; +- +- sigset_t pending = ~ss->blocked & ss->pending; +- if (! pending) +- pending = ~ss->blocked & process_pending; +- signo = l4_lsb64 (pending); +- } +- while (signo); +- +- pthread_mutex_unlock (&ss->lock); +- +- SIGNAL_DISPATCH_EXIT; +-} +diff --git a/signal/signal.h b/signal/signal.h +deleted file mode 100644 +index 6e22d05..0000000 +--- a/signal/signal.h ++++ /dev/null +@@ -1,275 +0,0 @@ +-/* signal.h - Signal handling interface. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#ifndef _SIGNAL_H +-#define _SIGNAL_H 1 +- +-#include +-#include +- +-typedef volatile int sig_atomic_t; +- +-/*typedef uint64_t sigset_t;*/ +- +-int sigaddset (sigset_t *, int); +-int sigdelset (sigset_t *, int); +-int sigemptyset (sigset_t *); +-int sigfillset (sigset_t *); +-int sigismember (const sigset_t *, int); +- +-/* These values are consistent with Linux. */ +-#define SIGRTMIN 34 +-#define SIGRTMAX 64 +- +-enum +- { +- SIGHUP = 1, +-#define SIGHUP SIGHUP +- SIGINT, +-#define SIGINT SIGINT +- SIGQUIT, +-#define SIGQUIT SIGQUIT +- SIGILL, +-#define SIGILL SIGILL +- SIGTRAP, +-#define SIGTRAP SIGTRAP +- SIGABRT, +-#define SIGABRT SIGABRT +- SIGBUS, +-#define SIGBUS SIGBUS +- SIGFPE, +-#define SIGFPE SIGFPE +- SIGKILL, +-#define SIGKILL SIGKILL +- SIGUSR1, +-#define SIGUSR1 SIGUSR1 +- SIGSEGV, +-#define SIGSEGV SIGSEGV +- SIGUSR2, +-#define SIGUSR2 SIGUSR2 +- SIGPIPE, +-#define SIGPIPE SIGPIPE +- SIGALRM, +-#define SIGALRM SIGALRM +- SIGTERM, +-#define SIGTERM SIGTERM +- SIGSTKFLT, +-#define SIGSTKFLT SIGSTKFLT +- SIGCHLD, +-#define SIGCHLD SIGCHLD +- SIGCONT, +-#define SIGCONT SIGCONT +- SIGSTOP, +-#define SIGSTOP SIGSTOP +- SIGTSTP, +-#define SIGTSTP SIGTSTP +- SIGTTIN, +-#define SIGTTIN SIGTTIN +- SIGTTOU, +-#define SIGTTOU SIGTTOU +- SIGURG, +-#define SIGURG SIGURG +- SIGXCPU, +-#define SIGXCPU SIGXCPU +- SIGXFSZ, +-#define SIGXFSZ SIGXFSZ +- SIGVTALRM, +-#define SIGVTALRM SIGVTALRM +- SIGPROF, +-#define SIGPROF SIGPROF +- SIGWINCH, +-#define SIGWINCH SIGWINCH +- SIGIO, +-#define SIGIO SIGIO +- SIGPWR, +-#define SIGPWR SIGPWR +- SIGSYS, +-#define SIGSYS SIGSYS +- NSIG +- }; +- +-/* The resulting set is the union of the current set and the signal +- set pointed to by the argument set. */ +-#define SIG_BLOCK 1 +-/* The resulting set is the intersection of the current set and the +- complement of the signal set pointed to by the argument set. */ +-#define SIG_UNBLOCK 2 +-/* The resulting set is the signal set pointed to by the argument +- set. */ +-#define SIG_SETMASK 3 +- +-int pthread_sigmask (int how, const sigset_t *mask, sigset_t *old); +-int sigprocmask (int how, const sigset_t *restrict mask, +- sigset_t *restrict old); +- +-/* Return set of pending signals. */ +-int sigpending(sigset_t *set); +- +-union sigval +-{ +- int sival_int; +- void *sival_ptr; +-}; +- +-#define SIG_DFL ((void (*)(int)) (0)) +-#define SIG_ERR ((void (*)(int)) (-1)) +-#define SIG_IGN ((void (*)(int)) (1)) +- +-/* Causes signal delivery to occur on an alternate stack. */ +-#define SA_ONSTACK (1 << 0) +-/* Do not generate SIGCHLD when children stop or stopped children +- continue. */ +-#define SA_NOCLDSTOP (1 << 1) +-/* Causes signal dispositions to be set to SIG_DFL on entry to signal +- handlers. */ +-#define SA_RESETHAND (1 << 2) +-/* Causes certain functions to become restartable. */ +-#define SA_RESTART (1 << 3) +-/* Causes extra information to be passed to signal handlers at the +- time of receipt of a signal. */ +-#define SA_SIGINFO (1 << 4) +-/* Causes implementations not to create zombie processes on child +- death. */ +-#define SA_NOCLDWAIT (1 << 5) +-/* Causes signal not to be automatically blocked on entry to +- signal handler. */ +-#define SA_NODEFER (1 << 6) +- +-typedef struct +-{ +- int si_signo; +- int si_code; +- int si_errno; +- pid_t si_pid; +- uid_t si_uid; +- void *si_addr; +- int si_status; +- long si_band; +- union sigval si_value; +-} siginfo_t; +- +-struct sigaction +-{ +- union +- { +- /* Pointer to a signal-catching function or one of the macros +- SIG_IGN or SIG_DFL. */ +- void (*sa_handler)(int); +- +- /* Pointer to a signal-catching function. */ +- void (*sa_sigaction)(int, siginfo_t *, void *); +- }; +- +- /* Set of signals to be blocked during execution of the signal +- handling function. */ +- sigset_t sa_mask; +- +- /* Special flags. */ +- int sa_flags; +-}; +- +-int sigaction (int signo, const struct sigaction *restrict newaction, +- struct sigaction *restrict oldaction); +- +-void (*signal (int signo, void (*handler)(int)))(int); +-void (*bsd_signal (int signo, void (*handler)(int)))(int); +- +-/* Process is executing on an alternate signal stack. */ +-#define SS_ONSTACK (1 << 0) +-/* Alternate signal stack is disabled. */ +-#define SS_DISABLE (1 << 1) +- +-/* Minimum stack size for a signal handler. */ +-#define MINSIGSTKSZ PAGESIZE +-/* Default size in bytes for the alternate signal stack. */ +-#define SIGSTKSZ (16 * PAGESIZE) +- +-typedef struct +-{ +- void *ss_sp; +- size_t ss_size; +- int ss_flags; +-} stack_t; +- +-int sigaltstack(const stack_t *restrict stack, stack_t *restrict old); +- +-#include +- +-/* Send SIGNO to the process PID. */ +-int kill(pid_t pid, int signo); +- +-/* Send SIGNO to the process group PG. */ +-int killpg(pid_t pg, int signo); +- +-/* Send SIGNO to thread TID. */ +-int pthread_kill(pthread_t tid, int signo); +- +-/* Send a signal to thread TID using SIGINFO. */ +-int pthread_kill_siginfo_np (pthread_t tid, siginfo_t siginfo); +- +-/* Send SIGNO to the calling thread. */ +-int raise(int signo); +- +-typedef struct sigevent +-{ +- /* Notification type. */ +- int sigev_notify; +- +- /* Signal number. */ +- int sigev_signo; +- +- /* Signal value. */ +- union sigval sigev_value; +- +- /* Notification function. */ +- void (*sigev_notify_function) (union sigval); +- +- /* Notification attributes. */ +- pthread_attr_t *sigev_notify_attributes; +-} sigevent_t; +- +-enum +- { +- SIGEV_NONE = 0, +-#define SIGEV_NONE SIGEV_NONE +- SIGEV_SIGNAL, +-#define SIGEV_SIGNAL SIGEV_SIGNAL +- SIGEV_THREAD +-#define SIGEV_THREAD SIGEV_THREAD +- }; +- +-#define SIG_HOLD +- +-int sighold (int); +-int sigignore (int); +-int siginterrupt (int, int); +-int sigpause (int); +-int sigqueue (pid_t, int, const union sigval); +-int sigrelse (int); +-void (*sigset (int, void (*)(int)))(int); +-int sigsuspend (const sigset_t *); +- +-/* Wait for a signal. */ +-int sigwait (const sigset_t *restrict set, int *restrict signo); +-int sigwaitinfo (const sigset_t *restrict set, siginfo_t *restrict info); +-int sigtimedwait (const sigset_t *restrict set, siginfo_t *restrict info, +- const struct timespec *restrict timespec); +- +-#endif +diff --git a/signal/sigpending.c b/signal/sigpending.c +deleted file mode 100644 +index 609b55d..0000000 +--- a/signal/sigpending.c ++++ /dev/null +@@ -1,38 +0,0 @@ +-/* sigpending.c - Generic sigpending implementation. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include +-#include +- +-int +-sigpending (sigset_t *set) +-{ +- struct signal_state *ss = &_pthread_self ()->ss; +- +- pthread_mutex_lock (&ss->lock); +- +- /* There is no need to lock SIG_LOCK for process_pending since we +- just read it, which is atomic. */ +- *set = (ss->pending | process_pending) & ss->blocked; +- +- pthread_mutex_unlock (&ss->lock); +- +- return 0; +-} +diff --git a/signal/sigsuspend.c b/signal/sigsuspend.c +deleted file mode 100644 +index 73cf12a..0000000 +--- a/signal/sigsuspend.c ++++ /dev/null +@@ -1,29 +0,0 @@ +-/* sigsuspend.c - Generic sigsuspend implementation. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include "sig-internal.h" +- +-int +-sigsuspend (const sigset_t *set) +-{ +- /* XXX: Implement me. */ +- errno = EOPNOTSUPP; +- return -1; +-} +diff --git a/signal/sigtimedwait.c b/signal/sigtimedwait.c +deleted file mode 100644 +index 52cd017..0000000 +--- a/signal/sigtimedwait.c ++++ /dev/null +@@ -1,30 +0,0 @@ +-/* sigtimedwait.c - Generic sigtimedwait implementation. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include "sig-internal.h" +- +-int +-sigtimedwait (const sigset_t *restrict set, siginfo_t *restrict info, +- const struct timespec *restrict timeout) +-{ +- errno = EOPNOTSUPP; +- return -1; +-} +- +diff --git a/signal/sigwaiter.c b/signal/sigwaiter.c +deleted file mode 100644 +index 8d041ac..0000000 +--- a/signal/sigwaiter.c ++++ /dev/null +@@ -1,91 +0,0 @@ +-/* sigwaiter.c - Signal handling functions. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include "sig-internal.h" +- +-#include +- +-struct sigwaiter *sigwaiters; +- +-siginfo_t +-sigwaiter_block (struct signal_state *ss, const sigset_t *restrict set) +-{ +- assert (pthread_mutex_trylock (&sig_lock) == EBUSY); +- assert (pthread_mutex_trylock (&ss->lock) == EBUSY); +- +- assert (! ss->sigwaiter); +- +- struct sigwaiter waiter; +- +- waiter.next = sigwaiters; +- if (waiter.next) +- { +- assert (! waiter.next->prev); +- waiter.next->prev = &waiter; +- } +- waiter.prev = 0; +- sigwaiters = &waiter; +- +- waiter.ss = ss; +- waiter.info.si_signo = 0; +- waiter.signals = *set; +- +- ss->sigwaiter = &waiter; +- +- pthread_mutex_unlock (&ss->lock); +- pthread_mutex_unlock (&sig_lock); +- +- futex_wait (&waiter.info.si_signo, 0); +- +-#ifndef NDEBUG +- pthread_mutex_lock (&ss->lock); +- ss->sigwaiter = 0; +- pthread_mutex_unlock (&ss->lock); +-#endif +- +- assert (waiter.info.si_signo); +- return waiter.info; +-} +- +-void +-sigwaiter_unblock (struct sigwaiter *waiter) +-{ +- assert (pthread_mutex_trylock (&sig_lock) == EBUSY); +- assert (pthread_mutex_trylock (&waiter->ss->lock) == EBUSY); +- +- struct sigwaiter *prev = waiter->prev; +- struct sigwaiter *next = waiter->next; +- +- if (next) +- next->prev = prev; +- +- if (prev) +- prev->next = next; +- else +- sigwaiters = next; +- +- sigdelset (&process_pending, waiter->info.si_signo); +- sigdelset (&waiter->ss->pending, waiter->info.si_signo); +- +- pthread_mutex_unlock (&waiter->ss->lock); +- pthread_mutex_unlock (&sig_lock); +- +- futex_wake (&waiter->info.si_signo, 1); +-} +diff --git a/signal/sigwaitinfo.c b/signal/sigwaitinfo.c +deleted file mode 100644 +index 1b47079..0000000 +--- a/signal/sigwaitinfo.c ++++ /dev/null +@@ -1,74 +0,0 @@ +-/* sigwaitinfo.c - Generic sigwaitinfo implementation. +- Copyright (C) 2008 Free Software Foundation, Inc. +- Written by Neal H. Walfield . +- +- This file is part of the GNU Hurd. +- +- The GNU Hurd is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public License +- as published by the Free Software Foundation; either version 3 of +- the License, or (at your option) any later version. +- +- The GNU Hurd is distributed in the hope that it will be useful, but +- WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this program. If not, see +- . */ +- +-#include +-#include +- +-int +-sigwaitinfo (const sigset_t *restrict set, siginfo_t *restrict info) +-{ +- pthread_mutex_lock (&sig_lock); +- +- struct signal_state *ss = &_pthread_self ()->ss; +- +- pthread_mutex_lock (&ss->lock); +- +- if ((process_pending & *set) || (ss->pending & *set)) +- /* There is at least one signal pending. */ +- { +- bool local = true; +- sigset_t extant = process_pending & *set; +- if (! extant) +- { +- local = false; +- extant = ss->pending & *set; +- } +- +- assert (extant); +- +- int signo = l4_msb64 (extant); +- +- if (info) +- { +- if (local) +- *info = ss->info[signo - 1]; +- else +- *info = process_pending_info[signo - 1]; +- info->si_signo = signo; +- } +- +- sigdelset (&process_pending, signo); +- sigdelset (&ss->pending, signo); +- +- pthread_mutex_unlock (&ss->lock); +- pthread_mutex_unlock (&sig_lock); +- return 0; +- } +- +- siginfo_t i = sigwaiter_block (ss, set); +- assert (i.si_signo); +- assert ((sigmask (i.si_signo) & *set)); +- +- if (info) +- *info = i; +- +- return 0; +-} +- +-- +1.9.0 + +From 4067112197e4f8f5975c8647cab355e06736177d Mon Sep 17 00:00:00 2001 +From: Manolis Ragkousis +Date: Thu, 27 Mar 2014 00:21:36 +0000 Subject: [PATCH 1/2] This helps to integrate libpthread as a glibc module. --- -- 1.9.0 From 4186086e309c78cd88cfceb347df584d85a0c83d Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Sun, 30 Mar 2014 23:00:01 +0000 Subject: [PATCH 15/18] Handpicked many patches, it almost builds It fails with Makefile:233: recipe for target 'elf/subdir_lib' failed --- gnu/packages/base.scm | 4 +- gnu/packages/cross-base.scm | 2 +- .../libpthread-0.3-3b391d-glibc-preparation.patch | 3822 +------------------- 3 files changed, 68 insertions(+), 3760 deletions(-) diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 339551b..bc57bd0 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -611,8 +611,8 @@ with the Linux kernel.") (chdir "source") (copy-recursively source ".") (copy-recursively (assoc-ref inputs "libpthread") "libpthread") - ;; (chmod "bits/pthreadtypes.h" #o777) - ;; (copy-recursively "libpthread/sysdeps/generic/bits" "bits") + (chmod "bits/pthreadtypes.h" #o777) + (copy-recursively "libpthread/sysdeps/generic/bits" "bits") #t) %standard-phases))))))) )) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 71ffa21..7e74c11 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -393,7 +393,7 @@ XBINUTILS and the cross tool chain." (arguments (substitute-keyword-arguments (package-arguments mig) ((#:configure-flags flags) - `(cons ,(string-append "--target=" target) + `(cons ,(string-append "--host=" target) ,flags)))) (propagated-inputs `(("cross-gnumach-headers" ,xgnumach-headers))) diff --git a/gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch b/gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch index 0ba23f0..c37eb0a 100644 --- a/gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch +++ b/gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch @@ -1,7 +1,7 @@ From 4067112197e4f8f5975c8647cab355e06736177d Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Thu, 27 Mar 2014 00:21:36 +0000 -Subject: [PATCH 1/4] This helps to integrate libpthread as a glibc module. +Subject: [PATCH 1/6] This helps to integrate libpthread as a glibc module. --- configure | 2 ++ @@ -24,7 +24,7 @@ index 0000000..2cdbc71 From 7f5f718b4a231c1e08d9ed1676cb18e265b715d6 Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Sat, 29 Mar 2014 23:29:44 +0000 -Subject: [PATCH 2/4] fix +Subject: [PATCH 2/6] fix --- signal/signal.h | 2 +- @@ -50,7 +50,7 @@ index a33d995..6e22d05 100644 From b8639799ae3b571eb44edd2b3dec109957393d3e Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Sun, 30 Mar 2014 16:56:09 +0000 -Subject: [PATCH 3/4] These come from the l4 implementation and come in the way +Subject: [PATCH 3/6] These come from the l4 implementation and come in the way of the glibc Makefiles, drop them. --- @@ -1864,7 +1864,7 @@ index 1b47079..0000000 From 6eaedb37037965b99608cb8afbfc934c3396892e Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Sun, 30 Mar 2014 17:23:12 +0000 -Subject: [PATCH 4/4] Revert +Subject: [PATCH 4/6] Revert commit 69e89a859882e4f675dd5491edc969159d8a4002 Author: Pino Toscano @@ -1982,3775 +1982,83 @@ index d72ef73..88beaa2 100644 -- 1.9.0 -From 4067112197e4f8f5975c8647cab355e06736177d Mon Sep 17 00:00:00 2001 -From: Manolis Ragkousis -Date: Thu, 27 Mar 2014 00:21:36 +0000 -Subject: [PATCH 1/3] This helps to integrate libpthread as a glibc module. - ---- - configure | 2 ++ - 1 file changed, 2 insertions(+) - create mode 100644 configure - -diff --git a/configure b/configure -new file mode 100644 -index 0000000..2cdbc71 ---- /dev/null -+++ b/configure -@@ -0,0 +1,2 @@ -+libc_add_on_canonical=libpthread -+libc_add_on_subdirs=. -\ No newline at end of file --- -1.9.0 - - -From 7f5f718b4a231c1e08d9ed1676cb18e265b715d6 Mon Sep 17 00:00:00 2001 -From: Manolis Ragkousis -Date: Sat, 29 Mar 2014 23:29:44 +0000 -Subject: [PATCH 2/3] fix - ---- - signal/signal.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/signal/signal.h b/signal/signal.h -index a33d995..6e22d05 100644 ---- a/signal/signal.h -+++ b/signal/signal.h -@@ -26,7 +26,7 @@ - - typedef volatile int sig_atomic_t; - --typedef uint64_t sigset_t; -+/*typedef uint64_t sigset_t;*/ - - int sigaddset (sigset_t *, int); - int sigdelset (sigset_t *, int); --- -1.9.0 - - -From b8639799ae3b571eb44edd2b3dec109957393d3e Mon Sep 17 00:00:00 2001 -From: Manolis Ragkousis -Date: Sun, 30 Mar 2014 16:56:09 +0000 -Subject: [PATCH 3/3] These come from the l4 implementation and come in the way - of the glibc Makefiles, drop them. - ---- - include/libc-symbols.h | 395 -------------------------------------------- - include/set-hooks.h | 72 -------- - signal/README | 12 -- - signal/TODO | 29 ---- - signal/kill.c | 70 -------- - signal/pt-kill-siginfo-np.c | 88 ---------- - signal/sig-internal.c | 26 --- - signal/sig-internal.h | 177 -------------------- - signal/sigaction.c | 72 -------- - signal/sigaltstack.c | 69 -------- - signal/signal-dispatch.c | 117 ------------- - signal/signal.h | 275 ------------------------------ - signal/sigpending.c | 38 ----- - signal/sigsuspend.c | 29 ---- - signal/sigtimedwait.c | 30 ---- - signal/sigwaiter.c | 91 ---------- - signal/sigwaitinfo.c | 74 --------- - 17 files changed, 1664 deletions(-) - delete mode 100644 include/libc-symbols.h - delete mode 100644 include/set-hooks.h - delete mode 100644 signal/README - delete mode 100644 signal/TODO - delete mode 100644 signal/kill.c - delete mode 100644 signal/pt-kill-siginfo-np.c - delete mode 100644 signal/sig-internal.c - delete mode 100644 signal/sig-internal.h - delete mode 100644 signal/sigaction.c - delete mode 100644 signal/sigaltstack.c - delete mode 100644 signal/signal-dispatch.c - delete mode 100644 signal/signal.h - delete mode 100644 signal/sigpending.c - delete mode 100644 signal/sigsuspend.c - delete mode 100644 signal/sigtimedwait.c - delete mode 100644 signal/sigwaiter.c - delete mode 100644 signal/sigwaitinfo.c - -diff --git a/include/libc-symbols.h b/include/libc-symbols.h -deleted file mode 100644 -index 54dd6e2..0000000 ---- a/include/libc-symbols.h -+++ /dev/null -@@ -1,395 +0,0 @@ --/* Support macros for making weak and strong aliases for symbols, -- and for using symbol sets and linker warnings with GNU ld. -- Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2008 -- Free Software Foundation, Inc. -- This file is part of the GNU C Library. -- -- The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- -- The GNU C Library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with the GNU C Library; if not, write to the Free -- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -- 02111-1307 USA. */ -- --#ifndef _LIBC_SYMBOLS_H --#define _LIBC_SYMBOLS_H 1 -- --/* This file's macros are included implicitly in the compilation of every -- file in the C library by -imacros. -- -- We include config.h which is generated by configure. -- It should define for us the following symbols: -- -- * HAVE_ASM_SET_DIRECTIVE if we have `.set B, A' instead of `A = B'. -- * ASM_GLOBAL_DIRECTIVE with `.globl' or `.global'. -- * HAVE_GNU_LD if using GNU ld, with support for weak symbols in a.out, -- and for symbol set and warning messages extensions in a.out and ELF. -- * HAVE_ELF if using ELF, which supports weak symbols using `.weak'. -- * HAVE_ASM_WEAK_DIRECTIVE if we have weak symbols using `.weak'. -- * HAVE_ASM_WEAKEXT_DIRECTIVE if we have weak symbols using `.weakext'. -- -- */ -- --/* This is defined for the compilation of all C library code. features.h -- tests this to avoid inclusion of stubs.h while compiling the library, -- before stubs.h has been generated. Some library code that is shared -- with other packages also tests this symbol to see if it is being -- compiled as part of the C library. We must define this before including -- config.h, because it makes some definitions conditional on whether libc -- itself is being compiled, or just some generator program. */ --// #define _LIBC 1 -- --/* Enable declarations of GNU extensions, since we are compiling them. */ --#define _GNU_SOURCE 1 --/* And we also need the data for the reentrant functions. */ --#define _REENTRANT 1 -- --// #include --#define HAVE_ASM_WEAK_DIRECTIVE --#define HAVE_WEAK_SYMBOLS --#define HAVE_ASM_SET_DIRECTIVE --#define HAVE_BUILTIN_EXPECT --#define HAVE_GNU_LD --#define HAVE_ELF --#define HAVE_SECTION_QUOTES --#define HAVE_VISIBILITY_ATTRIBUTE --#define HAVE_ASM_PREVIOUS_DIRECTIVE --// #define SHARED -- --/* The symbols in all the user (non-_) macros are C symbols. -- HAVE_GNU_LD without HAVE_ELF implies a.out. */ -- --#if defined HAVE_ASM_WEAK_DIRECTIVE || defined HAVE_ASM_WEAKEXT_DIRECTIVE --# define HAVE_WEAK_SYMBOLS --#endif -- --#ifndef __SYMBOL_PREFIX --# ifdef NO_UNDERSCORES --# define __SYMBOL_PREFIX --# else --# define __SYMBOL_PREFIX "_" --# endif --#endif -- --#ifndef C_SYMBOL_NAME --# ifdef NO_UNDERSCORES --# define C_SYMBOL_NAME(name) name --# else --# define C_SYMBOL_NAME(name) _##name --# endif --#endif -- --#ifndef ASM_LINE_SEP --# define ASM_LINE_SEP ; --#endif -- --#ifndef C_SYMBOL_DOT_NAME --# define C_SYMBOL_DOT_NAME(name) .##name --#endif -- --#ifndef __ASSEMBLER__ --/* GCC understands weak symbols and aliases; use its interface where -- possible, instead of embedded assembly language. */ -- --/* Define ALIASNAME as a strong alias for NAME. */ --# define strong_alias(name, aliasname) _strong_alias(name, aliasname) --# define _strong_alias(name, aliasname) \ -- extern __typeof (name) aliasname __attribute__ ((alias (#name))); -- --/* This comes between the return type and function name in -- a function definition to make that definition weak. */ --# define weak_function __attribute__ ((weak)) --# define weak_const_function __attribute__ ((weak, __const__)) -- --# ifdef HAVE_WEAK_SYMBOLS -- --/* Define ALIASNAME as a weak alias for NAME. -- If weak aliases are not available, this defines a strong alias. */ --# define weak_alias(name, aliasname) _weak_alias (name, aliasname) --# define _weak_alias(name, aliasname) \ -- extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))); -- --/* Declare SYMBOL as weak undefined symbol (resolved to 0 if not defined). */ --# define weak_extern(symbol) _weak_extern (symbol) --# ifdef HAVE_ASM_WEAKEXT_DIRECTIVE --# define _weak_extern(symbol) asm (".weakext " __SYMBOL_PREFIX #symbol); --# else --# define _weak_extern(symbol) asm (".weak " __SYMBOL_PREFIX #symbol); --# endif -- --# else -- --# define weak_alias(name, aliasname) strong_alias(name, aliasname) --# define weak_extern(symbol) /* Nothing. */ -- --# endif -- --#else /* __ASSEMBLER__ */ -- --# ifdef HAVE_ASM_SET_DIRECTIVE --# define strong_alias(original, alias) \ -- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ -- .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original) --# else --# ifdef HAVE_ASM_GLOBAL_DOT_NAME --# define strong_alias(original, alias) \ -- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ -- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \ -- ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ -- C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original) --# else --# define strong_alias(original, alias) \ -- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ -- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) --# endif --# endif -- --# ifdef HAVE_WEAK_SYMBOLS --# ifdef HAVE_ASM_WEAKEXT_DIRECTIVE --# define weak_alias(original, alias) \ -- .weakext C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original) --# define weak_extern(symbol) \ -- .weakext C_SYMBOL_NAME (symbol) -- --# else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */ -- --# ifdef HAVE_ASM_GLOBAL_DOT_NAME --# define weak_alias(original, alias) \ -- .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \ -- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \ -- ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ -- C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original) --# else --# define weak_alias(original, alias) \ -- .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \ -- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) --# endif -- --# define weak_extern(symbol) \ -- .weak C_SYMBOL_NAME (symbol) -- --# endif /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */ -- --# else /* ! HAVE_WEAK_SYMBOLS */ -- --# define weak_alias(original, alias) strong_alias(original, alias) --# define weak_extern(symbol) /* Nothing */ --# endif /* ! HAVE_WEAK_SYMBOLS */ -- --#endif /* __ASSEMBLER__ */ -- --/* On some platforms we can make internal function calls (i.e., calls of -- functions not exported) a bit faster by using a different calling -- convention. */ --#ifndef internal_function --# define internal_function /* empty */ --#endif -- --/* Prepare for the case that `__builtin_expect' is not available. */ --#ifndef HAVE_BUILTIN_EXPECT --# define __builtin_expect(expr, val) (expr) --#endif -- --/* Determine the return address. */ --#define RETURN_ADDRESS(nr) \ -- __builtin_extract_return_addr (__builtin_return_address (nr)) -- --/* When a reference to SYMBOL is encountered, the linker will emit a -- warning message MSG. */ --#ifdef HAVE_GNU_LD --# ifdef HAVE_ELF -- --/* We want the .gnu.warning.SYMBOL section to be unallocated. */ --# ifdef HAVE_ASM_PREVIOUS_DIRECTIVE --# define __make_section_unallocated(section_string) \ -- asm (".section " section_string "\n\t.previous"); --# elif defined HAVE_ASM_POPSECTION_DIRECTIVE --# define __make_section_unallocated(section_string) \ -- asm (".pushsection " section_string "\n\t.popsection"); --# else --# define __make_section_unallocated(section_string) --# endif -- --/* Tacking on "\n\t#" to the section name makes gcc put it's bogus -- section attributes on what looks like a comment to the assembler. */ --# ifdef HAVE_SECTION_QUOTES --# define link_warning(symbol, msg) \ -- __make_section_unallocated (".gnu.warning." #symbol) \ -- static const char __evoke_link_warning_##symbol[] \ -- __attribute__ ((unused, section (".gnu.warning." #symbol "\"\n\t#\""))) \ -- = msg; --# else --# define link_warning(symbol, msg) \ -- __make_section_unallocated (".gnu.warning." #symbol) \ -- static const char __evoke_link_warning_##symbol[] \ -- __attribute__ ((unused, section (".gnu.warning." #symbol "\n\t#"))) = msg; --# endif --# else /* Not ELF: a.out */ --# ifdef HAVE_XCOFF --/* XCOFF does not support .stabs. -- The native aix linker will remove the .stab and .stabstr sections -- The gnu linker will have a fatal error if there is a relocation for -- symbol in the .stab section. Silently disable this macro. */ --# define link_warning(symbol, msg) --# else --# define link_warning(symbol, msg) \ -- asm (".stabs \"" msg "\",30,0,0,0\n\t" \ -- ".stabs \"" __SYMBOL_PREFIX #symbol "\",1,0,0,0\n"); --# endif /* XCOFF */ --# endif --#else --/* We will never be heard; they will all die horribly. */ --# define link_warning(symbol, msg) --#endif -- --/* A canned warning for sysdeps/stub functions. */ --#define stub_warning(name) \ -- link_warning (name, \ -- "warning: " #name " is not implemented and will always fail") -- --/* -- --*/ -- --#ifdef HAVE_GNU_LD -- --/* Symbol set support macros. */ -- --# ifdef HAVE_ELF -- --/* Make SYMBOL, which is in the text segment, an element of SET. */ --# define text_set_element(set, symbol) _elf_set_element(set, symbol) --/* Make SYMBOL, which is in the data segment, an element of SET. */ --# define data_set_element(set, symbol) _elf_set_element(set, symbol) --/* Make SYMBOL, which is in the bss segment, an element of SET. */ --# define bss_set_element(set, symbol) _elf_set_element(set, symbol) -- --/* These are all done the same way in ELF. -- There is a new section created for each set. */ --# ifdef SHARED --/* When building a shared library, make the set section writable, -- because it will need to be relocated at run time anyway. */ --# define _elf_set_element(set, symbol) \ -- static const void *__elf_set_##set##_element_##symbol##__ \ -- __attribute__ ((unused, section (#set))) = &(symbol) --# else --# define _elf_set_element(set, symbol) \ -- static const void *const __elf_set_##set##_element_##symbol##__ \ -- __attribute__ ((unused, section (#set))) = &(symbol) --# endif -- --/* Define SET as a symbol set. This may be required (it is in a.out) to -- be able to use the set's contents. */ --# define symbol_set_define(set) symbol_set_declare(set) -- --/* Declare SET for use in this module, if defined in another module. */ --# define symbol_set_declare(set) \ -- extern void *const __start_##set __attribute__ ((__weak__)); \ -- extern void *const __stop_##set __attribute__ ((__weak__)); \ -- weak_extern (__start_##set) weak_extern (__stop_##set) -- --/* Return a pointer (void *const *) to the first element of SET. */ --# define symbol_set_first_element(set) (&__start_##set) -- --/* Return true iff PTR (a void *const *) has been incremented -- past the last element in SET. */ --# define symbol_set_end_p(set, ptr) ((ptr) >= &__stop_##set) -- --# else /* Not ELF: a.out. */ -- --# ifdef HAVE_XCOFF --/* XCOFF does not support .stabs. -- The native aix linker will remove the .stab and .stabstr sections -- The gnu linker will have a fatal error if there is a relocation for -- symbol in the .stab section. Silently disable these macros. */ --# define text_set_element(set, symbol) --# define data_set_element(set, symbol) --# define bss_set_element(set, symbol) --# else --# define text_set_element(set, symbol) \ -- asm (".stabs \"" __SYMBOL_PREFIX #set "\",23,0,0," __SYMBOL_PREFIX #symbol) --# define data_set_element(set, symbol) \ -- asm (".stabs \"" __SYMBOL_PREFIX #set "\",25,0,0," __SYMBOL_PREFIX #symbol) --# define bss_set_element(set, symbol) ?error Must use initialized data. --# endif /* XCOFF */ --# define symbol_set_define(set) void *const (set)[1]; --# define symbol_set_declare(set) extern void *const (set)[1]; -- --# define symbol_set_first_element(set) &(set)[1] --# define symbol_set_end_p(set, ptr) (*(ptr) == 0) -- --# endif /* ELF. */ --#else --/* We cannot do anything in generial. */ --# define text_set_element(set, symbol) asm ("") --# define data_set_element(set, symbol) asm ("") --# define bss_set_element(set, symbol) asm ("") --# define symbol_set_define(set) void *const (set)[1]; --# define symbol_set_declare(set) extern void *const (set)[1]; -- --# define symbol_set_first_element(set) &(set)[1] --# define symbol_set_end_p(set, ptr) (*(ptr) == 0) --#endif /* Have GNU ld. */ -- --#if DO_VERSIONING --# define symbol_version(real, name, version) \ -- _symbol_version(real, name, version) --# define default_symbol_version(real, name, version) \ -- _default_symbol_version(real, name, version) --# ifdef __ASSEMBLER__ --# define _symbol_version(real, name, version) \ -- .symver real, address@hidden --# define _default_symbol_version(real, name, version) \ -- .symver real, address@hidden@##version --# else --# define _symbol_version(real, name, version) \ -- __asm__ (".symver " #real "," #name "@" #version) --# define _default_symbol_version(real, name, version) \ -- __asm__ (".symver " #real "," #name "@@" #version) --# endif --#else --# define symbol_version(real, name, version) --# define default_symbol_version(real, name, version) \ -- strong_alias(real, name) --#endif -- --#if defined HAVE_VISIBILITY_ATTRIBUTE && defined SHARED --# define attribute_hidden __attribute__ ((visibility ("hidden"))) --#else --# define attribute_hidden --#endif -- --/* Handling on non-exported internal names. We have to do this only -- for shared code. */ --#ifdef SHARED --# define INTUSE(name) name##_internal --# define INTDEF(name) strong_alias (name, name##_internal) --# define INTVARDEF(name) \ -- _INTVARDEF (name, name##_internal) --# if defined HAVE_VISIBILITY_ATTRIBUTE --# define _INTVARDEF(name, aliasname) \ -- extern __typeof (name) aliasname __attribute__ ((alias (#name), \ -- visibility ("hidden"))); --# else --# define _INTVARDEF(name, aliasname) \ -- extern __typeof (name) aliasname __attribute__ ((alias (#name))); --# endif --# define INTDEF2(name, newname) strong_alias (name, newname##_internal) --# define INTVARDEF2(name, newname) _INTVARDEF (name, newname##_internal) --#else --# define INTUSE(name) name --# define INTDEF(name) --# define INTVARDEF(name) --# define INTDEF2(name, newname) --# define INTVARDEF2(name, newname) --#endif -- --#endif /* libc-symbols.h */ -diff --git a/include/set-hooks.h b/include/set-hooks.h -deleted file mode 100644 -index 9ed71b3..0000000 ---- a/include/set-hooks.h -+++ /dev/null -@@ -1,72 +0,0 @@ --/* Macros for using symbol sets for running lists of functions. -- Copyright (C) 1994, 1995, 1997, 2000 Free Software Foundation, Inc. -- This file is part of the GNU C Library. -- -- The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- -- The GNU C Library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with the GNU C Library; if not, write to the Free -- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -- 02111-1307 USA. */ -- --#ifndef _SET_HOOKS_H --#define _SET_HOOKS_H 1 -- --#define __need_size_t --#include --// #include --#define __unbounded -- --#ifdef symbol_set_define --/* Define a hook variable called NAME. Functions put on this hook take -- arguments described by PROTO. Use `text_set_element (NAME, FUNCTION)' -- from gnu-stabs.h to add a function to the hook. */ -- --# define DEFINE_HOOK(NAME, PROTO) \ -- typedef void __##NAME##_hook_function_t PROTO; \ -- symbol_set_define (NAME) -- --# define DECLARE_HOOK(NAME, PROTO) \ -- typedef void __##NAME##_hook_function_t PROTO;\ -- symbol_set_declare (NAME) -- --/* Run all the functions hooked on the set called NAME. -- Each function is called like this: `function ARGS'. */ -- --# define RUN_HOOK(NAME, ARGS) \ --do { \ -- void *const *__unbounded ptr; \ -- for (ptr = symbol_set_first_element (NAME); \ -- ! symbol_set_end_p (NAME, ptr); ++ptr) \ -- (*(__##NAME##_hook_function_t *) *ptr) ARGS; \ --} while (0) -- --/* Define a hook variable with NAME and PROTO, and a function called RUNNER -- which calls each function on the hook in turn, with ARGS. */ -- --# define DEFINE_HOOK_RUNNER(name, runner, proto, args) \ --DEFINE_HOOK (name, proto); \ --extern void runner proto; void runner proto { RUN_HOOK (name, args); } -- --#else -- --/* The system does not provide necessary support for this. */ --# define DEFINE_HOOK(NAME, PROTO) -- --# define DECLARE_HOOK(NAME, PROTO) -- --# define RUN_HOOK(NAME, ARGS) -- --# define DEFINE_HOOK_RUNNER(name, runner, proto, args) -- --#endif -- --#endif /* set-hooks.h */ -diff --git a/signal/README b/signal/README -deleted file mode 100644 -index 4963b26..0000000 ---- a/signal/README -+++ /dev/null -@@ -1,12 +0,0 @@ --This directory provides a signal implementation, which is appropriate --for operating systems where signals are managed at user-level. It is --up to the run-time to catch the signals and forward them to the --implementation via, e.g., the pthread_kill_info_np call. -- --The files in this directory are accompanied by the generic implementations --found in sysdeps/generic/: killpg.c, raise.c, sigaddset.c, sigdelset.c, --sigemptyset.c, sigfillset.c, siginterrupt.c, sigismember.c, signal.c, --sigwait.c. -- --This implementation was once used for a native port running on L4, but is not --currently used in any libpthread port bundled in this release. -diff --git a/signal/TODO b/signal/TODO -deleted file mode 100644 -index 1148abb..0000000 ---- a/signal/TODO -+++ /dev/null -@@ -1,29 +0,0 @@ --Unimplemented Functionality ----------------------------- -- --We don't support interruptible functions. That is, if a signal is --delivered when a thread is in e.g. the write system call, then the --write function should be interrupted and return EINTR when the signal --handler is finished. To realize this behavior, we could have a thread --local interruptible flag and a setjmp buffer. A function that is --interruptible would fill the jump buffer and set the interruptible --flag. If a signal comes in and the interruptible flag is set, rather --than resuming the thread, we longjmp to the buffer. -- --If a signal action has set the SA_SIGINFO, the third argument must be --a pointer to a ucontext describing the thread's interrupted state; --this implementation passes NULL. This isn't as bad as it sounds as --the the ucontext family of functions are marked obsolete in SUSv3 with --the advisory that any use of them should be replaced by the use of --pthread functionality (cf. makecontext rationale). -- --stop and continue signals are not implemented (as we need to stop all --threads, this requires being in bed with libpthread). -- --Implementation is not yet cancellation-safe. -- --There are not even stubs for sighold, sigingore, sigpause, sigrelse, --however, according to posix: "Use of any of these functions is --unspecified in a multi-threaded process." -- --Implement sigtimedwait, sigqueue. -\ No newline at end of file -diff --git a/signal/kill.c b/signal/kill.c -deleted file mode 100644 -index 27c9c32..0000000 ---- a/signal/kill.c -+++ /dev/null -@@ -1,70 +0,0 @@ --/* kill.c - Generic kill implementation. -- Copyright (C) 2008 Free Software Foundation, Inc. -- Written by Neal H. Walfield . -- -- This file is part of the GNU Hurd. -- -- The GNU Hurd is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public License -- as published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -- -- The GNU Hurd is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this program. If not, see -- . */ -- --#include "sig-internal.h" -- --int --kill (pid_t pid, int signo) --{ -- if (pid != getpid ()) -- { -- errno = EOPNOTSUPP; -- return -1; -- } -- -- /* "Signals generated for the process shall be delivered to exactly -- one of those threads within the process which is in a call to a -- sigwait() function selecting that signal or has not blocked -- delivery of the signal. If there are no threads in a call to a -- sigwait() function selecting that signal, and if all threads -- within the process block delivery of the signal, the signal shall -- remaing pending on the process" (2.4.1). */ -- -- /* First, see if there is a waiter, which is interested in this -- signal. */ -- pthread_mutex_lock (&sig_lock); -- -- struct sigwaiter *waiter; -- for (waiter = sigwaiters; waiter; waiter = waiter->next) -- if ((waiter->signals & sigmask (signo))) -- /* Got a winner. */ -- { -- sigdelset (&process_pending, signo); -- -- pthread_mutex_lock (&waiter->ss->lock); -- sigdelset (&waiter->ss->pending, signo); -- -- memset (&waiter->info, 0, sizeof (waiter->info)); -- waiter->info.si_signo = signo; -- -- sigwaiter_unblock (waiter); -- -- return 0; -- } -- -- pthread_mutex_unlock (&sig_lock); -- -- /* XXX: We just generate the signal for the current thread. If the -- current thread has blocked the signal, the correct thing to do is -- to iterate over all the other threads and find on that hasn't -- blocked it. */ -- return pthread_kill (pthread_self (), signo); --} -- -diff --git a/signal/pt-kill-siginfo-np.c b/signal/pt-kill-siginfo-np.c -deleted file mode 100644 -index 9bdf6cc..0000000 ---- a/signal/pt-kill-siginfo-np.c -+++ /dev/null -@@ -1,88 +0,0 @@ --/* pthread-kill-siginfo-np.c - Generic pthread_kill_siginfo_np implementation. -- Copyright (C) 2008 Free Software Foundation, Inc. -- Written by Neal H. Walfield . -- -- This file is part of the GNU Hurd. -- -- The GNU Hurd is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public License -- as published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -- -- The GNU Hurd is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this program. If not, see -- . */ -- --#include "pt-internal.h" --#include "sig-internal.h" -- --int --pthread_kill_siginfo_np (pthread_t tid, siginfo_t si) --{ -- int sig = si.si_signo; -- -- if (sig < 0 || sig >= NSIG) -- return EINVAL; -- -- if (sig == 0) -- return 0; -- -- struct signal_state *ss = &__pthread_getid (tid)->ss; -- -- pthread_mutex_lock (&sig_lock); -- pthread_mutex_lock (&ss->lock); -- -- if (ss->sigwaiter && (ss->sigwaiter->signals & sigmask (si.si_signo))) -- /* The thread is in a call to sigwait. */ -- { -- ss->sigwaiter->info = si; -- sigwaiter_unblock (ss->sigwaiter); -- return 0; -- } -- -- pthread_mutex_unlock (&sig_lock); -- -- if (ss->actions[sig - 1].sa_handler == (void *) SIG_IGN -- || (ss->actions[sig - 1].sa_handler == (void *) SIG_DFL -- && default_action (sig) == sig_ignore)) -- /* It is unclear (to me) what is supposed to happen when a signal -- is generated for a thread, which is blocking that signal and -- ignoring it. POSIX does say that when the action associated -- with a pending, blocked signal is set to SIG_IGN, the pending -- signal is to be cleared. Thus, it makes sense that any signal -- set to ignore is discarded at generation. */ -- { -- pthread_mutex_unlock (&ss->lock); -- return 0; -- } -- -- -- if ((sigmask (sig) & ss->blocked)) -- /* The signal is blocked. Mark it pending. */ -- { -- ss->pending |= sigmask (sig); -- pthread_mutex_unlock (&ss->lock); -- return 0; -- } -- -- if (pthread_self () == tid -- && (! (ss->actions[si.si_signo - 1].sa_flags & SA_ONSTACK) -- || (ss->stack.ss_flags & SS_DISABLE) -- || (ss->stack.ss_flags & SS_ONSTACK))) -- /* We are sending a signal to ourself and we don't use an -- alternate stack. */ -- signal_dispatch (ss, &si); -- else -- signal_dispatch_lowlevel (ss, tid, si); -- -- /* Don't unlock ss: signal_dispatch and signal_dispatch_lowlevel -- assume ownership of the lock. */ -- -- return 0; --} -- -diff --git a/signal/sig-internal.c b/signal/sig-internal.c -deleted file mode 100644 -index f73f38b..0000000 ---- a/signal/sig-internal.c -+++ /dev/null -@@ -1,26 +0,0 @@ --/* sig-internal.c - Signal state functions. -- Copyright (C) 2008 Free Software Foundation, Inc. -- Written by Neal H. Walfield . -- -- This file is part of the GNU Hurd. -- -- The GNU Hurd is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public License -- as published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -- -- The GNU Hurd is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this program. If not, see -- . */ -- --#include "sig-internal.h" -- --pthread_mutex_t sig_lock = PTHREAD_MUTEX_INITIALIZER; -- --sigset_t process_pending; --siginfo_t process_pending_info[NSIG]; -diff --git a/signal/sig-internal.h b/signal/sig-internal.h -deleted file mode 100644 -index 6c86c79..0000000 ---- a/signal/sig-internal.h -+++ /dev/null -@@ -1,177 +0,0 @@ --/* sig-internal.h - Internal signal handling interface. -- Copyright (C) 2008 Free Software Foundation, Inc. -- Written by Neal H. Walfield . -- -- This file is part of the GNU Hurd. -- -- The GNU Hurd is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public License -- as published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -- -- The GNU Hurd is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this program. If not, see -- . */ -- --#ifndef SIG_INTERNAL_H --#define SIG_INTERNAL_H -- --#include -- --#include -- --#define sigmask(sig) (1ULL << (sig - 1)) --#define STOPSIGS (sigmask (SIGTTIN) | sigmask (SIGTTOU) | \ -- sigmask (SIGSTOP) | sigmask (SIGTSTP)) -- --/* General lock. Protects PROCESS_PENDING, PROCESS_PENDING_INFO, -- SIGWAITERS. */ --extern pthread_mutex_t sig_lock; -- --/* "Signals generated for the process shall be delivered to exactly -- one of those threads within the process which is in a call to a -- sigwait() function selecting that signal or has not blocked -- delivery of the signal. If there are no threads in a call to a -- sigwait() function selecting that signal, and if all threads within -- the process block delivery of the signal, the signal shall remaing -- pending on the process" (2.4.1). -- -- This variable is protected by SIG_LOCK. */ --extern sigset_t process_pending; --extern siginfo_t process_pending_info[NSIG]; -- --struct sigwaiter; -- --/* The per-thread signal state. */ --struct signal_state --{ -- /* Protects the following fields. STACK.SA_FLAGS may be accessed -- using atomic operations. */ -- pthread_mutex_t lock; -- -- /* Pending signals. */ -- sigset_t pending; -- -- /* Blocked signals (i.e., the signal mask). */ -- sigset_t blocked; -- -- stack_t stack; -- struct sigaction actions[NSIG]; -- siginfo_t info[NSIG]; -- -- /* If the thread is blocked in a call to sigwait. */ -- struct sigwaiter *sigwaiter; --}; -- --#define PTHREAD_SIGNAL_MEMBERS struct signal_state ss; -- --/* Arranges for thread TID to call signal_dispatch. Must not be -- called if TID is the caller and an alternate stack is not required. -- In this case, the caller should call signal_dispatch directly. */ --extern void signal_dispatch_lowlevel (struct signal_state *ss, -- pthread_t tid, siginfo_t si); -- --/* This is the signal handler entry point. A thread is forced into -- this state when it receives a signal. We need to save the thread's -- state and then invoke the high-level signal dispatcher. SS->LOCK -- is locked by the caller. */ --extern void signal_dispatch (struct signal_state *ss, siginfo_t *si); -- --#ifndef SIGNAL_DISPATCH_ENTRY --#define SIGNAL_DISPATCH_ENTRY --#endif -- --#ifndef SIGNAL_DISPATCH_EXIT --#define SIGNAL_DISPATCH_EXIT --#endif -- --/* When a thread calls sigwait and a requested signal is not pending, -- it allocates the following structure, fills it in, adds it to -- sigwaiters and sleeps. */ --struct sigwaiter --{ -- struct sigwaiter *next; -- struct sigwaiter *prev; -- -- /* Thread's signal state. */ -- struct signal_state *ss; -- -- /* Signals this thread is waiting for. */ -- sigset_t signals; -- -- /* The selected signal is returned here. The waiter also -- futex_waits on this info.si_signo. */ -- siginfo_t info; --}; -- --/* This variable is protected by SIG_LOCK. */ --extern struct sigwaiter *sigwaiters; -- --/* Block the caller waiting for a signal in set SET. SIG_LOCK and -- SS->LOCK must be held and will be unlocked by this function before -- blocking. */ --extern siginfo_t sigwaiter_block (struct signal_state *ss, -- const sigset_t *restrict set); -- --/* Unblock the waiter WAITER. SIG_LOCK and WAITER->SS->LOCK must be -- held. Both will be dropped on return. */ --extern void sigwaiter_unblock (struct sigwaiter *waiter); -- --enum sig_action { sig_core, sig_terminate, sig_ignore, sig_cont, sig_stop }; -- --static inline enum sig_action --default_action (int signo) --{ -- switch (signo) -- { -- case SIGABRT: -- case SIGBUS: -- case SIGFPE: -- case SIGILL: -- case SIGQUIT: -- case SIGSEGV: -- case SIGSTKFLT: -- case SIGSYS: -- case SIGTRAP: -- case SIGXCPU: -- case SIGXFSZ: -- return sig_core; -- -- case SIGALRM: -- case SIGHUP: -- case SIGINT: -- case SIGIO: /* Perhaps ignore? */ -- case SIGKILL: -- case SIGPIPE: -- case SIGPROF: -- case SIGTERM: -- case SIGUSR1: -- case SIGUSR2: -- case SIGVTALRM: -- return sig_terminate; -- -- case SIGCHLD: -- case SIGPWR: -- case SIGURG: -- case SIGWINCH: -- return sig_ignore; -- -- case SIGCONT: -- return sig_cont; -- -- case SIGSTOP: -- case SIGTSTP: -- case SIGTTIN: -- case SIGTTOU: -- return sig_stop; -- } -- -- panic ("Unknown signal number: %d", signo); --} -- --#endif -diff --git a/signal/sigaction.c b/signal/sigaction.c -deleted file mode 100644 -index 0126c99..0000000 ---- a/signal/sigaction.c -+++ /dev/null -@@ -1,72 +0,0 @@ --/* sigaction.c - Generic sigaction implementation. -- Copyright (C) 2008 Free Software Foundation, Inc. -- Written by Neal H. Walfield . -- -- This file is part of the GNU Hurd. -- -- The GNU Hurd is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public License -- as published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -- -- The GNU Hurd is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this program. If not, see -- . */ -- --#include "sig-internal.h" --#include "pt-internal.h" -- --int --sigaction (int sig, const struct sigaction *restrict sa, -- struct sigaction *restrict osa) --{ -- if (sig <= 0 || sig >= NSIG) -- { -- errno = EINVAL; -- return -1; -- } -- -- struct signal_state *ss = &_pthread_self ()->ss; -- -- pthread_mutex_lock (&ss->lock); -- -- if (osa) -- *osa = ss->actions[sig - 1]; -- -- if (sa) -- { -- ss->actions[sig - 1] = *sa; -- -- /* "The SIGKILL and SIGSTOP signals shall not be added to the -- signal mask using this mechanism; this restriction shall be -- enforced by the system without causing an error to be -- indicated" (sigaction). */ -- sigdelset (&ss->blocked, SIGKILL); -- sigdelset (&ss->blocked, SIGSTOP); -- -- /* A "signal shall remain pending on the process until it is -- unblocked, it is accepted when ..., or the action associated -- with it is set to ignore the signal" (2.4.1). -- -- "Setting a signal action to SIG_DFL for a signal that is -- pending, and whose default action is to ignore the signal, -- ..., shall cause the pending signal to be discarded, whether -- or not it is blocked" (2.4.3). */ -- if (sa->sa_handler == SIG_IGN -- || (sa->sa_handler == SIG_DFL && default_action (sig) == sig_ignore)) -- { -- sigdelset (&ss->pending, sig); -- sigdelset (&process_pending, sig); -- } -- } -- -- pthread_mutex_unlock (&ss->lock); -- -- return 0; --} -- -diff --git a/signal/sigaltstack.c b/signal/sigaltstack.c -deleted file mode 100644 -index 8334811..0000000 ---- a/signal/sigaltstack.c -+++ /dev/null -@@ -1,69 +0,0 @@ --/* sigaltstack.c - Generic sigaltstack implementation. -- Copyright (C) 2008 Free Software Foundation, Inc. -- Written by Neal H. Walfield . -- -- This file is part of the GNU Hurd. -- -- The GNU Hurd is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public License -- as published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -- -- The GNU Hurd is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this program. If not, see -- . */ -- --#include "sig-internal.h" --#include "pt-internal.h" -- --int --sigaltstack (const stack_t *restrict stack, stack_t *restrict old) --{ -- int err = 0; -- struct signal_state *ss = &_pthread_self ()->ss; -- -- pthread_mutex_lock (&ss->lock); -- -- if (old) -- *old = ss->stack; -- -- if (stack) -- { -- if (stack->ss_size < MINSIGSTKSZ) -- { -- err = ENOMEM; -- goto out; -- } -- -- if ((stack->ss_flags & ~(SS_DISABLE))) -- /* Flags contains a value other than SS_DISABLE. */ -- { -- err = EINVAL; -- goto out; -- } -- -- if ((ss->stack.ss_flags & SS_ONSTACK)) -- /* Stack in use. */ -- { -- err = EPERM; -- goto out; -- } -- -- ss->stack = *stack; -- } -- -- out: -- pthread_mutex_unlock (&ss->lock); -- -- if (err) -- { -- errno = err; -- return -1; -- } -- return 0; --} -diff --git a/signal/signal-dispatch.c b/signal/signal-dispatch.c -deleted file mode 100644 -index 40440b7..0000000 ---- a/signal/signal-dispatch.c -+++ /dev/null -@@ -1,117 +0,0 @@ --/* signal-dispatch.c - Signal dispatcher. -- Copyright (C) 2008 Free Software Foundation, Inc. -- Written by Neal H. Walfield . -- -- This file is part of the GNU Hurd. -- -- The GNU Hurd is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public License -- as published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -- -- The GNU Hurd is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this program. If not, see -- . */ -- --#include "sig-internal.h" -- --/* This is the signal handler entry point. A thread is forced into -- this state when it receives a signal. We need to save the thread's -- state and then invoke the high-level signal dispatcher. SS->LOCK -- is locked by the caller. */ --void --signal_dispatch (struct signal_state *ss, siginfo_t *si) --{ -- SIGNAL_DISPATCH_ENTRY; -- -- int signo = si->si_signo; -- -- assert (signo > 0 && signo < NSIG); -- assert (pthread_mutex_trylock (&ss->lock) == EBUSY); -- -- do -- { -- if ((sigmask (signo) & STOPSIGS)) -- /* Stop signals clear a pending SIGCONT even if they -- are handled or ignored (but not if preempted). */ -- { -- sigdelset (&ss->pending, SIGCONT); -- sigdelset (&process_pending, SIGCONT); -- } -- else if ((signo == SIGCONT)) -- /* Even if handled or ignored (but not preempted), SIGCONT -- clears stop signals and resumes the process. */ -- { -- ss->pending &= ~STOPSIGS; -- process_pending &= ~STOPSIGS; -- } -- -- void (*handler)(int, siginfo_t *, void *) -- = ss->actions[signo - 1].sa_sigaction; -- -- /* Reset to SIG_DFL if requested. SIGILL and SIGTRAP cannot -- be automatically reset when delivered; the system silently -- enforces this restriction (sigaction). */ -- if (ss->actions[signo - 1].sa_flags & SA_RESETHAND -- && signo != SIGILL && signo != SIGTRAP) -- ss->actions[signo - 1].sa_handler = SIG_DFL; -- -- sigset_t orig_blocked = ss->blocked; -- /* Block requested signals while running the handler. */ -- ss->blocked |= ss->actions[signo - 1].sa_mask; -- -- /* Block SIGNO unless we're asked not to. */ -- if (! (ss->actions[signo - 1].sa_flags & (SA_RESETHAND | SA_NODEFER))) -- sigaddset (&ss->blocked, signo); -- -- sigdelset (&ss->pending, signo); -- pthread_mutex_unlock (&ss->lock); -- -- pthread_mutex_lock (&sig_lock); -- sigdelset (&process_pending, signo); -- pthread_mutex_unlock (&sig_lock); -- -- if (handler == (void *) SIG_DFL) -- { -- enum sig_action action = default_action (signo); -- -- if (action == sig_terminate || action == sig_core) -- _exit (128 + signo); -- -- if (action == sig_stop) -- /* XXX: Implement me. */ -- panic ("Stopping process unimplemented."); -- -- if (action == sig_cont) -- /* XXX: Implement me. */; -- panic ("Continuing process unimplemented."); -- } -- else if (handler == (void *) SIG_IGN) -- ; -- else -- handler (signo, si, NULL); -- -- pthread_mutex_lock (&ss->lock); -- -- /* "When a thread's signal mask is changed in a signal-catching -- function that is installed by sigaction(), the restoration of -- the signal mask on return from the signal-catching function -- overrides that change (see sigaction())" (sigprocmask). */ -- ss->blocked = orig_blocked; -- -- sigset_t pending = ~ss->blocked & ss->pending; -- if (! pending) -- pending = ~ss->blocked & process_pending; -- signo = l4_lsb64 (pending); -- } -- while (signo); -- -- pthread_mutex_unlock (&ss->lock); -- -- SIGNAL_DISPATCH_EXIT; --} -diff --git a/signal/signal.h b/signal/signal.h -deleted file mode 100644 -index 6e22d05..0000000 ---- a/signal/signal.h -+++ /dev/null -@@ -1,275 +0,0 @@ --/* signal.h - Signal handling interface. -- Copyright (C) 2008 Free Software Foundation, Inc. -- Written by Neal H. Walfield . -- -- This file is part of the GNU Hurd. -- -- The GNU Hurd is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public License -- as published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -- -- The GNU Hurd is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this program. If not, see -- . */ -- --#ifndef _SIGNAL_H --#define _SIGNAL_H 1 -- --#include --#include -- --typedef volatile int sig_atomic_t; -- --/*typedef uint64_t sigset_t;*/ -- --int sigaddset (sigset_t *, int); --int sigdelset (sigset_t *, int); --int sigemptyset (sigset_t *); --int sigfillset (sigset_t *); --int sigismember (const sigset_t *, int); -- --/* These values are consistent with Linux. */ --#define SIGRTMIN 34 --#define SIGRTMAX 64 -- --enum -- { -- SIGHUP = 1, --#define SIGHUP SIGHUP -- SIGINT, --#define SIGINT SIGINT -- SIGQUIT, --#define SIGQUIT SIGQUIT -- SIGILL, --#define SIGILL SIGILL -- SIGTRAP, --#define SIGTRAP SIGTRAP -- SIGABRT, --#define SIGABRT SIGABRT -- SIGBUS, --#define SIGBUS SIGBUS -- SIGFPE, --#define SIGFPE SIGFPE -- SIGKILL, --#define SIGKILL SIGKILL -- SIGUSR1, --#define SIGUSR1 SIGUSR1 -- SIGSEGV, --#define SIGSEGV SIGSEGV -- SIGUSR2, --#define SIGUSR2 SIGUSR2 -- SIGPIPE, --#define SIGPIPE SIGPIPE -- SIGALRM, --#define SIGALRM SIGALRM -- SIGTERM, --#define SIGTERM SIGTERM -- SIGSTKFLT, --#define SIGSTKFLT SIGSTKFLT -- SIGCHLD, --#define SIGCHLD SIGCHLD -- SIGCONT, --#define SIGCONT SIGCONT -- SIGSTOP, --#define SIGSTOP SIGSTOP -- SIGTSTP, --#define SIGTSTP SIGTSTP -- SIGTTIN, --#define SIGTTIN SIGTTIN -- SIGTTOU, --#define SIGTTOU SIGTTOU -- SIGURG, --#define SIGURG SIGURG -- SIGXCPU, --#define SIGXCPU SIGXCPU -- SIGXFSZ, --#define SIGXFSZ SIGXFSZ -- SIGVTALRM, --#define SIGVTALRM SIGVTALRM -- SIGPROF, --#define SIGPROF SIGPROF -- SIGWINCH, --#define SIGWINCH SIGWINCH -- SIGIO, --#define SIGIO SIGIO -- SIGPWR, --#define SIGPWR SIGPWR -- SIGSYS, --#define SIGSYS SIGSYS -- NSIG -- }; -- --/* The resulting set is the union of the current set and the signal -- set pointed to by the argument set. */ --#define SIG_BLOCK 1 --/* The resulting set is the intersection of the current set and the -- complement of the signal set pointed to by the argument set. */ --#define SIG_UNBLOCK 2 --/* The resulting set is the signal set pointed to by the argument -- set. */ --#define SIG_SETMASK 3 -- --int pthread_sigmask (int how, const sigset_t *mask, sigset_t *old); --int sigprocmask (int how, const sigset_t *restrict mask, -- sigset_t *restrict old); -- --/* Return set of pending signals. */ --int sigpending(sigset_t *set); -- --union sigval --{ -- int sival_int; -- void *sival_ptr; --}; -- --#define SIG_DFL ((void (*)(int)) (0)) --#define SIG_ERR ((void (*)(int)) (-1)) --#define SIG_IGN ((void (*)(int)) (1)) -- --/* Causes signal delivery to occur on an alternate stack. */ --#define SA_ONSTACK (1 << 0) --/* Do not generate SIGCHLD when children stop or stopped children -- continue. */ --#define SA_NOCLDSTOP (1 << 1) --/* Causes signal dispositions to be set to SIG_DFL on entry to signal -- handlers. */ --#define SA_RESETHAND (1 << 2) --/* Causes certain functions to become restartable. */ --#define SA_RESTART (1 << 3) --/* Causes extra information to be passed to signal handlers at the -- time of receipt of a signal. */ --#define SA_SIGINFO (1 << 4) --/* Causes implementations not to create zombie processes on child -- death. */ --#define SA_NOCLDWAIT (1 << 5) --/* Causes signal not to be automatically blocked on entry to -- signal handler. */ --#define SA_NODEFER (1 << 6) -- --typedef struct --{ -- int si_signo; -- int si_code; -- int si_errno; -- pid_t si_pid; -- uid_t si_uid; -- void *si_addr; -- int si_status; -- long si_band; -- union sigval si_value; --} siginfo_t; -- --struct sigaction --{ -- union -- { -- /* Pointer to a signal-catching function or one of the macros -- SIG_IGN or SIG_DFL. */ -- void (*sa_handler)(int); -- -- /* Pointer to a signal-catching function. */ -- void (*sa_sigaction)(int, siginfo_t *, void *); -- }; -- -- /* Set of signals to be blocked during execution of the signal -- handling function. */ -- sigset_t sa_mask; -- -- /* Special flags. */ -- int sa_flags; --}; -- --int sigaction (int signo, const struct sigaction *restrict newaction, -- struct sigaction *restrict oldaction); -- --void (*signal (int signo, void (*handler)(int)))(int); --void (*bsd_signal (int signo, void (*handler)(int)))(int); -- --/* Process is executing on an alternate signal stack. */ --#define SS_ONSTACK (1 << 0) --/* Alternate signal stack is disabled. */ --#define SS_DISABLE (1 << 1) -- --/* Minimum stack size for a signal handler. */ --#define MINSIGSTKSZ PAGESIZE --/* Default size in bytes for the alternate signal stack. */ --#define SIGSTKSZ (16 * PAGESIZE) -- --typedef struct --{ -- void *ss_sp; -- size_t ss_size; -- int ss_flags; --} stack_t; -- --int sigaltstack(const stack_t *restrict stack, stack_t *restrict old); -- --#include -- --/* Send SIGNO to the process PID. */ --int kill(pid_t pid, int signo); -- --/* Send SIGNO to the process group PG. */ --int killpg(pid_t pg, int signo); -- --/* Send SIGNO to thread TID. */ --int pthread_kill(pthread_t tid, int signo); -- --/* Send a signal to thread TID using SIGINFO. */ --int pthread_kill_siginfo_np (pthread_t tid, siginfo_t siginfo); -- --/* Send SIGNO to the calling thread. */ --int raise(int signo); -- --typedef struct sigevent --{ -- /* Notification type. */ -- int sigev_notify; -- -- /* Signal number. */ -- int sigev_signo; -- -- /* Signal value. */ -- union sigval sigev_value; -- -- /* Notification function. */ -- void (*sigev_notify_function) (union sigval); -- -- /* Notification attributes. */ -- pthread_attr_t *sigev_notify_attributes; --} sigevent_t; -- --enum -- { -- SIGEV_NONE = 0, --#define SIGEV_NONE SIGEV_NONE -- SIGEV_SIGNAL, --#define SIGEV_SIGNAL SIGEV_SIGNAL -- SIGEV_THREAD --#define SIGEV_THREAD SIGEV_THREAD -- }; -- --#define SIG_HOLD -- --int sighold (int); --int sigignore (int); --int siginterrupt (int, int); --int sigpause (int); --int sigqueue (pid_t, int, const union sigval); --int sigrelse (int); --void (*sigset (int, void (*)(int)))(int); --int sigsuspend (const sigset_t *); -- --/* Wait for a signal. */ --int sigwait (const sigset_t *restrict set, int *restrict signo); --int sigwaitinfo (const sigset_t *restrict set, siginfo_t *restrict info); --int sigtimedwait (const sigset_t *restrict set, siginfo_t *restrict info, -- const struct timespec *restrict timespec); -- --#endif -diff --git a/signal/sigpending.c b/signal/sigpending.c -deleted file mode 100644 -index 609b55d..0000000 ---- a/signal/sigpending.c -+++ /dev/null -@@ -1,38 +0,0 @@ --/* sigpending.c - Generic sigpending implementation. -- Copyright (C) 2008 Free Software Foundation, Inc. -- Written by Neal H. Walfield . -- -- This file is part of the GNU Hurd. -- -- The GNU Hurd is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public License -- as published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -- -- The GNU Hurd is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this program. If not, see -- . */ -- --#include --#include -- --int --sigpending (sigset_t *set) --{ -- struct signal_state *ss = &_pthread_self ()->ss; -- -- pthread_mutex_lock (&ss->lock); -- -- /* There is no need to lock SIG_LOCK for process_pending since we -- just read it, which is atomic. */ -- *set = (ss->pending | process_pending) & ss->blocked; -- -- pthread_mutex_unlock (&ss->lock); -- -- return 0; --} -diff --git a/signal/sigsuspend.c b/signal/sigsuspend.c -deleted file mode 100644 -index 73cf12a..0000000 ---- a/signal/sigsuspend.c -+++ /dev/null -@@ -1,29 +0,0 @@ --/* sigsuspend.c - Generic sigsuspend implementation. -- Copyright (C) 2008 Free Software Foundation, Inc. -- Written by Neal H. Walfield . -- -- This file is part of the GNU Hurd. -- -- The GNU Hurd is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public License -- as published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -- -- The GNU Hurd is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this program. If not, see -- . */ -- --#include "sig-internal.h" -- --int --sigsuspend (const sigset_t *set) --{ -- /* XXX: Implement me. */ -- errno = EOPNOTSUPP; -- return -1; --} -diff --git a/signal/sigtimedwait.c b/signal/sigtimedwait.c -deleted file mode 100644 -index 52cd017..0000000 ---- a/signal/sigtimedwait.c -+++ /dev/null -@@ -1,30 +0,0 @@ --/* sigtimedwait.c - Generic sigtimedwait implementation. -- Copyright (C) 2008 Free Software Foundation, Inc. -- Written by Neal H. Walfield . -- -- This file is part of the GNU Hurd. -- -- The GNU Hurd is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public License -- as published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -- -- The GNU Hurd is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this program. If not, see -- . */ -- --#include "sig-internal.h" -- --int --sigtimedwait (const sigset_t *restrict set, siginfo_t *restrict info, -- const struct timespec *restrict timeout) --{ -- errno = EOPNOTSUPP; -- return -1; --} -- -diff --git a/signal/sigwaiter.c b/signal/sigwaiter.c -deleted file mode 100644 -index 8d041ac..0000000 ---- a/signal/sigwaiter.c -+++ /dev/null -@@ -1,91 +0,0 @@ --/* sigwaiter.c - Signal handling functions. -- Copyright (C) 2008 Free Software Foundation, Inc. -- Written by Neal H. Walfield . -- -- This file is part of the GNU Hurd. -- -- The GNU Hurd is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public License -- as published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -- -- The GNU Hurd is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this program. If not, see -- . */ -- --#include "sig-internal.h" -- --#include -- --struct sigwaiter *sigwaiters; -- --siginfo_t --sigwaiter_block (struct signal_state *ss, const sigset_t *restrict set) --{ -- assert (pthread_mutex_trylock (&sig_lock) == EBUSY); -- assert (pthread_mutex_trylock (&ss->lock) == EBUSY); -- -- assert (! ss->sigwaiter); -- -- struct sigwaiter waiter; -- -- waiter.next = sigwaiters; -- if (waiter.next) -- { -- assert (! waiter.next->prev); -- waiter.next->prev = &waiter; -- } -- waiter.prev = 0; -- sigwaiters = &waiter; -- -- waiter.ss = ss; -- waiter.info.si_signo = 0; -- waiter.signals = *set; -- -- ss->sigwaiter = &waiter; -- -- pthread_mutex_unlock (&ss->lock); -- pthread_mutex_unlock (&sig_lock); -- -- futex_wait (&waiter.info.si_signo, 0); -- --#ifndef NDEBUG -- pthread_mutex_lock (&ss->lock); -- ss->sigwaiter = 0; -- pthread_mutex_unlock (&ss->lock); --#endif -- -- assert (waiter.info.si_signo); -- return waiter.info; --} -- --void --sigwaiter_unblock (struct sigwaiter *waiter) --{ -- assert (pthread_mutex_trylock (&sig_lock) == EBUSY); -- assert (pthread_mutex_trylock (&waiter->ss->lock) == EBUSY); -- -- struct sigwaiter *prev = waiter->prev; -- struct sigwaiter *next = waiter->next; -- -- if (next) -- next->prev = prev; -- -- if (prev) -- prev->next = next; -- else -- sigwaiters = next; -- -- sigdelset (&process_pending, waiter->info.si_signo); -- sigdelset (&waiter->ss->pending, waiter->info.si_signo); -- -- pthread_mutex_unlock (&waiter->ss->lock); -- pthread_mutex_unlock (&sig_lock); -- -- futex_wake (&waiter->info.si_signo, 1); --} -diff --git a/signal/sigwaitinfo.c b/signal/sigwaitinfo.c -deleted file mode 100644 -index 1b47079..0000000 ---- a/signal/sigwaitinfo.c -+++ /dev/null -@@ -1,74 +0,0 @@ --/* sigwaitinfo.c - Generic sigwaitinfo implementation. -- Copyright (C) 2008 Free Software Foundation, Inc. -- Written by Neal H. Walfield . -- -- This file is part of the GNU Hurd. -- -- The GNU Hurd is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public License -- as published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -- -- The GNU Hurd is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this program. If not, see -- . */ -- --#include --#include -- --int --sigwaitinfo (const sigset_t *restrict set, siginfo_t *restrict info) --{ -- pthread_mutex_lock (&sig_lock); -- -- struct signal_state *ss = &_pthread_self ()->ss; -- -- pthread_mutex_lock (&ss->lock); -- -- if ((process_pending & *set) || (ss->pending & *set)) -- /* There is at least one signal pending. */ -- { -- bool local = true; -- sigset_t extant = process_pending & *set; -- if (! extant) -- { -- local = false; -- extant = ss->pending & *set; -- } -- -- assert (extant); -- -- int signo = l4_msb64 (extant); -- -- if (info) -- { -- if (local) -- *info = ss->info[signo - 1]; -- else -- *info = process_pending_info[signo - 1]; -- info->si_signo = signo; -- } -- -- sigdelset (&process_pending, signo); -- sigdelset (&ss->pending, signo); -- -- pthread_mutex_unlock (&ss->lock); -- pthread_mutex_unlock (&sig_lock); -- return 0; -- } -- -- siginfo_t i = sigwaiter_block (ss, set); -- assert (i.si_signo); -- assert ((sigmask (i.si_signo) & *set)); -- -- if (info) -- *info = i; -- -- return 0; --} -- --- -1.9.0 - -From 4067112197e4f8f5975c8647cab355e06736177d Mon Sep 17 00:00:00 2001 -From: Manolis Ragkousis -Date: Thu, 27 Mar 2014 00:21:36 +0000 -Subject: [PATCH 1/3] This helps to integrate libpthread as a glibc module. - ---- - configure | 2 ++ - 1 file changed, 2 insertions(+) - create mode 100644 configure - -diff --git a/configure b/configure -new file mode 100644 -index 0000000..2cdbc71 ---- /dev/null -+++ b/configure -@@ -0,0 +1,2 @@ -+libc_add_on_canonical=libpthread -+libc_add_on_subdirs=. -\ No newline at end of file --- -1.9.0 - - -From 7f5f718b4a231c1e08d9ed1676cb18e265b715d6 Mon Sep 17 00:00:00 2001 -From: Manolis Ragkousis -Date: Sat, 29 Mar 2014 23:29:44 +0000 -Subject: [PATCH 2/3] fix - ---- - signal/signal.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/signal/signal.h b/signal/signal.h -index a33d995..6e22d05 100644 ---- a/signal/signal.h -+++ b/signal/signal.h -@@ -26,7 +26,7 @@ - - typedef volatile int sig_atomic_t; - --typedef uint64_t sigset_t; -+/*typedef uint64_t sigset_t;*/ - - int sigaddset (sigset_t *, int); - int sigdelset (sigset_t *, int); --- -1.9.0 - - -From b8639799ae3b571eb44edd2b3dec109957393d3e Mon Sep 17 00:00:00 2001 -From: Manolis Ragkousis -Date: Sun, 30 Mar 2014 16:56:09 +0000 -Subject: [PATCH 3/3] These come from the l4 implementation and come in the way - of the glibc Makefiles, drop them. - ---- - include/libc-symbols.h | 395 -------------------------------------------- - include/set-hooks.h | 72 -------- - signal/README | 12 -- - signal/TODO | 29 ---- - signal/kill.c | 70 -------- - signal/pt-kill-siginfo-np.c | 88 ---------- - signal/sig-internal.c | 26 --- - signal/sig-internal.h | 177 -------------------- - signal/sigaction.c | 72 -------- - signal/sigaltstack.c | 69 -------- - signal/signal-dispatch.c | 117 ------------- - signal/signal.h | 275 ------------------------------ - signal/sigpending.c | 38 ----- - signal/sigsuspend.c | 29 ---- - signal/sigtimedwait.c | 30 ---- - signal/sigwaiter.c | 91 ---------- - signal/sigwaitinfo.c | 74 --------- - 17 files changed, 1664 deletions(-) - delete mode 100644 include/libc-symbols.h - delete mode 100644 include/set-hooks.h - delete mode 100644 signal/README - delete mode 100644 signal/TODO - delete mode 100644 signal/kill.c - delete mode 100644 signal/pt-kill-siginfo-np.c - delete mode 100644 signal/sig-internal.c - delete mode 100644 signal/sig-internal.h - delete mode 100644 signal/sigaction.c - delete mode 100644 signal/sigaltstack.c - delete mode 100644 signal/signal-dispatch.c - delete mode 100644 signal/signal.h - delete mode 100644 signal/sigpending.c - delete mode 100644 signal/sigsuspend.c - delete mode 100644 signal/sigtimedwait.c - delete mode 100644 signal/sigwaiter.c - delete mode 100644 signal/sigwaitinfo.c - -diff --git a/include/libc-symbols.h b/include/libc-symbols.h -deleted file mode 100644 -index 54dd6e2..0000000 ---- a/include/libc-symbols.h -+++ /dev/null -@@ -1,395 +0,0 @@ --/* Support macros for making weak and strong aliases for symbols, -- and for using symbol sets and linker warnings with GNU ld. -- Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2008 -- Free Software Foundation, Inc. -- This file is part of the GNU C Library. -- -- The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- -- The GNU C Library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with the GNU C Library; if not, write to the Free -- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -- 02111-1307 USA. */ -- --#ifndef _LIBC_SYMBOLS_H --#define _LIBC_SYMBOLS_H 1 -- --/* This file's macros are included implicitly in the compilation of every -- file in the C library by -imacros. -- -- We include config.h which is generated by configure. -- It should define for us the following symbols: -- -- * HAVE_ASM_SET_DIRECTIVE if we have `.set B, A' instead of `A = B'. -- * ASM_GLOBAL_DIRECTIVE with `.globl' or `.global'. -- * HAVE_GNU_LD if using GNU ld, with support for weak symbols in a.out, -- and for symbol set and warning messages extensions in a.out and ELF. -- * HAVE_ELF if using ELF, which supports weak symbols using `.weak'. -- * HAVE_ASM_WEAK_DIRECTIVE if we have weak symbols using `.weak'. -- * HAVE_ASM_WEAKEXT_DIRECTIVE if we have weak symbols using `.weakext'. -- -- */ -- --/* This is defined for the compilation of all C library code. features.h -- tests this to avoid inclusion of stubs.h while compiling the library, -- before stubs.h has been generated. Some library code that is shared -- with other packages also tests this symbol to see if it is being -- compiled as part of the C library. We must define this before including -- config.h, because it makes some definitions conditional on whether libc -- itself is being compiled, or just some generator program. */ --// #define _LIBC 1 -- --/* Enable declarations of GNU extensions, since we are compiling them. */ --#define _GNU_SOURCE 1 --/* And we also need the data for the reentrant functions. */ --#define _REENTRANT 1 -- --// #include --#define HAVE_ASM_WEAK_DIRECTIVE --#define HAVE_WEAK_SYMBOLS --#define HAVE_ASM_SET_DIRECTIVE --#define HAVE_BUILTIN_EXPECT --#define HAVE_GNU_LD --#define HAVE_ELF --#define HAVE_SECTION_QUOTES --#define HAVE_VISIBILITY_ATTRIBUTE --#define HAVE_ASM_PREVIOUS_DIRECTIVE --// #define SHARED -- --/* The symbols in all the user (non-_) macros are C symbols. -- HAVE_GNU_LD without HAVE_ELF implies a.out. */ -- --#if defined HAVE_ASM_WEAK_DIRECTIVE || defined HAVE_ASM_WEAKEXT_DIRECTIVE --# define HAVE_WEAK_SYMBOLS --#endif -- --#ifndef __SYMBOL_PREFIX --# ifdef NO_UNDERSCORES --# define __SYMBOL_PREFIX --# else --# define __SYMBOL_PREFIX "_" --# endif --#endif -- --#ifndef C_SYMBOL_NAME --# ifdef NO_UNDERSCORES --# define C_SYMBOL_NAME(name) name --# else --# define C_SYMBOL_NAME(name) _##name --# endif --#endif -- --#ifndef ASM_LINE_SEP --# define ASM_LINE_SEP ; --#endif -- --#ifndef C_SYMBOL_DOT_NAME --# define C_SYMBOL_DOT_NAME(name) .##name --#endif -- --#ifndef __ASSEMBLER__ --/* GCC understands weak symbols and aliases; use its interface where -- possible, instead of embedded assembly language. */ -- --/* Define ALIASNAME as a strong alias for NAME. */ --# define strong_alias(name, aliasname) _strong_alias(name, aliasname) --# define _strong_alias(name, aliasname) \ -- extern __typeof (name) aliasname __attribute__ ((alias (#name))); -- --/* This comes between the return type and function name in -- a function definition to make that definition weak. */ --# define weak_function __attribute__ ((weak)) --# define weak_const_function __attribute__ ((weak, __const__)) -- --# ifdef HAVE_WEAK_SYMBOLS -- --/* Define ALIASNAME as a weak alias for NAME. -- If weak aliases are not available, this defines a strong alias. */ --# define weak_alias(name, aliasname) _weak_alias (name, aliasname) --# define _weak_alias(name, aliasname) \ -- extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))); -- --/* Declare SYMBOL as weak undefined symbol (resolved to 0 if not defined). */ --# define weak_extern(symbol) _weak_extern (symbol) --# ifdef HAVE_ASM_WEAKEXT_DIRECTIVE --# define _weak_extern(symbol) asm (".weakext " __SYMBOL_PREFIX #symbol); --# else --# define _weak_extern(symbol) asm (".weak " __SYMBOL_PREFIX #symbol); --# endif -- --# else -- --# define weak_alias(name, aliasname) strong_alias(name, aliasname) --# define weak_extern(symbol) /* Nothing. */ -- --# endif -- --#else /* __ASSEMBLER__ */ -- --# ifdef HAVE_ASM_SET_DIRECTIVE --# define strong_alias(original, alias) \ -- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ -- .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original) --# else --# ifdef HAVE_ASM_GLOBAL_DOT_NAME --# define strong_alias(original, alias) \ -- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ -- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \ -- ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ -- C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original) --# else --# define strong_alias(original, alias) \ -- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ -- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) --# endif --# endif -- --# ifdef HAVE_WEAK_SYMBOLS --# ifdef HAVE_ASM_WEAKEXT_DIRECTIVE --# define weak_alias(original, alias) \ -- .weakext C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original) --# define weak_extern(symbol) \ -- .weakext C_SYMBOL_NAME (symbol) -- --# else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */ -- --# ifdef HAVE_ASM_GLOBAL_DOT_NAME --# define weak_alias(original, alias) \ -- .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \ -- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \ -- ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ -- C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original) --# else --# define weak_alias(original, alias) \ -- .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \ -- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) --# endif -- --# define weak_extern(symbol) \ -- .weak C_SYMBOL_NAME (symbol) -- --# endif /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */ -- --# else /* ! HAVE_WEAK_SYMBOLS */ -- --# define weak_alias(original, alias) strong_alias(original, alias) --# define weak_extern(symbol) /* Nothing */ --# endif /* ! HAVE_WEAK_SYMBOLS */ -- --#endif /* __ASSEMBLER__ */ -- --/* On some platforms we can make internal function calls (i.e., calls of -- functions not exported) a bit faster by using a different calling -- convention. */ --#ifndef internal_function --# define internal_function /* empty */ --#endif -- --/* Prepare for the case that `__builtin_expect' is not available. */ --#ifndef HAVE_BUILTIN_EXPECT --# define __builtin_expect(expr, val) (expr) --#endif -- --/* Determine the return address. */ --#define RETURN_ADDRESS(nr) \ -- __builtin_extract_return_addr (__builtin_return_address (nr)) -- --/* When a reference to SYMBOL is encountered, the linker will emit a -- warning message MSG. */ --#ifdef HAVE_GNU_LD --# ifdef HAVE_ELF -- --/* We want the .gnu.warning.SYMBOL section to be unallocated. */ --# ifdef HAVE_ASM_PREVIOUS_DIRECTIVE --# define __make_section_unallocated(section_string) \ -- asm (".section " section_string "\n\t.previous"); --# elif defined HAVE_ASM_POPSECTION_DIRECTIVE --# define __make_section_unallocated(section_string) \ -- asm (".pushsection " section_string "\n\t.popsection"); --# else --# define __make_section_unallocated(section_string) --# endif -- --/* Tacking on "\n\t#" to the section name makes gcc put it's bogus -- section attributes on what looks like a comment to the assembler. */ --# ifdef HAVE_SECTION_QUOTES --# define link_warning(symbol, msg) \ -- __make_section_unallocated (".gnu.warning." #symbol) \ -- static const char __evoke_link_warning_##symbol[] \ -- __attribute__ ((unused, section (".gnu.warning." #symbol "\"\n\t#\""))) \ -- = msg; --# else --# define link_warning(symbol, msg) \ -- __make_section_unallocated (".gnu.warning." #symbol) \ -- static const char __evoke_link_warning_##symbol[] \ -- __attribute__ ((unused, section (".gnu.warning." #symbol "\n\t#"))) = msg; --# endif --# else /* Not ELF: a.out */ --# ifdef HAVE_XCOFF --/* XCOFF does not support .stabs. -- The native aix linker will remove the .stab and .stabstr sections -- The gnu linker will have a fatal error if there is a relocation for -- symbol in the .stab section. Silently disable this macro. */ --# define link_warning(symbol, msg) --# else --# define link_warning(symbol, msg) \ -- asm (".stabs \"" msg "\",30,0,0,0\n\t" \ -- ".stabs \"" __SYMBOL_PREFIX #symbol "\",1,0,0,0\n"); --# endif /* XCOFF */ --# endif --#else --/* We will never be heard; they will all die horribly. */ --# define link_warning(symbol, msg) --#endif -- --/* A canned warning for sysdeps/stub functions. */ --#define stub_warning(name) \ -- link_warning (name, \ -- "warning: " #name " is not implemented and will always fail") -- --/* -- --*/ -- --#ifdef HAVE_GNU_LD -- --/* Symbol set support macros. */ -- --# ifdef HAVE_ELF -- --/* Make SYMBOL, which is in the text segment, an element of SET. */ --# define text_set_element(set, symbol) _elf_set_element(set, symbol) --/* Make SYMBOL, which is in the data segment, an element of SET. */ --# define data_set_element(set, symbol) _elf_set_element(set, symbol) --/* Make SYMBOL, which is in the bss segment, an element of SET. */ --# define bss_set_element(set, symbol) _elf_set_element(set, symbol) -- --/* These are all done the same way in ELF. -- There is a new section created for each set. */ --# ifdef SHARED --/* When building a shared library, make the set section writable, -- because it will need to be relocated at run time anyway. */ --# define _elf_set_element(set, symbol) \ -- static const void *__elf_set_##set##_element_##symbol##__ \ -- __attribute__ ((unused, section (#set))) = &(symbol) --# else --# define _elf_set_element(set, symbol) \ -- static const void *const __elf_set_##set##_element_##symbol##__ \ -- __attribute__ ((unused, section (#set))) = &(symbol) --# endif -- --/* Define SET as a symbol set. This may be required (it is in a.out) to -- be able to use the set's contents. */ --# define symbol_set_define(set) symbol_set_declare(set) -- --/* Declare SET for use in this module, if defined in another module. */ --# define symbol_set_declare(set) \ -- extern void *const __start_##set __attribute__ ((__weak__)); \ -- extern void *const __stop_##set __attribute__ ((__weak__)); \ -- weak_extern (__start_##set) weak_extern (__stop_##set) -- --/* Return a pointer (void *const *) to the first element of SET. */ --# define symbol_set_first_element(set) (&__start_##set) -- --/* Return true iff PTR (a void *const *) has been incremented -- past the last element in SET. */ --# define symbol_set_end_p(set, ptr) ((ptr) >= &__stop_##set) -- --# else /* Not ELF: a.out. */ -- --# ifdef HAVE_XCOFF --/* XCOFF does not support .stabs. -- The native aix linker will remove the .stab and .stabstr sections -- The gnu linker will have a fatal error if there is a relocation for -- symbol in the .stab section. Silently disable these macros. */ --# define text_set_element(set, symbol) --# define data_set_element(set, symbol) --# define bss_set_element(set, symbol) --# else --# define text_set_element(set, symbol) \ -- asm (".stabs \"" __SYMBOL_PREFIX #set "\",23,0,0," __SYMBOL_PREFIX #symbol) --# define data_set_element(set, symbol) \ -- asm (".stabs \"" __SYMBOL_PREFIX #set "\",25,0,0," __SYMBOL_PREFIX #symbol) --# define bss_set_element(set, symbol) ?error Must use initialized data. --# endif /* XCOFF */ --# define symbol_set_define(set) void *const (set)[1]; --# define symbol_set_declare(set) extern void *const (set)[1]; -- --# define symbol_set_first_element(set) &(set)[1] --# define symbol_set_end_p(set, ptr) (*(ptr) == 0) -- --# endif /* ELF. */ --#else --/* We cannot do anything in generial. */ --# define text_set_element(set, symbol) asm ("") --# define data_set_element(set, symbol) asm ("") --# define bss_set_element(set, symbol) asm ("") --# define symbol_set_define(set) void *const (set)[1]; --# define symbol_set_declare(set) extern void *const (set)[1]; -- --# define symbol_set_first_element(set) &(set)[1] --# define symbol_set_end_p(set, ptr) (*(ptr) == 0) --#endif /* Have GNU ld. */ -- --#if DO_VERSIONING --# define symbol_version(real, name, version) \ -- _symbol_version(real, name, version) --# define default_symbol_version(real, name, version) \ -- _default_symbol_version(real, name, version) --# ifdef __ASSEMBLER__ --# define _symbol_version(real, name, version) \ -- .symver real, address@hidden --# define _default_symbol_version(real, name, version) \ -- .symver real, address@hidden@##version --# else --# define _symbol_version(real, name, version) \ -- __asm__ (".symver " #real "," #name "@" #version) --# define _default_symbol_version(real, name, version) \ -- __asm__ (".symver " #real "," #name "@@" #version) --# endif --#else --# define symbol_version(real, name, version) --# define default_symbol_version(real, name, version) \ -- strong_alias(real, name) --#endif -- --#if defined HAVE_VISIBILITY_ATTRIBUTE && defined SHARED --# define attribute_hidden __attribute__ ((visibility ("hidden"))) --#else --# define attribute_hidden --#endif -- --/* Handling on non-exported internal names. We have to do this only -- for shared code. */ --#ifdef SHARED --# define INTUSE(name) name##_internal --# define INTDEF(name) strong_alias (name, name##_internal) --# define INTVARDEF(name) \ -- _INTVARDEF (name, name##_internal) --# if defined HAVE_VISIBILITY_ATTRIBUTE --# define _INTVARDEF(name, aliasname) \ -- extern __typeof (name) aliasname __attribute__ ((alias (#name), \ -- visibility ("hidden"))); --# else --# define _INTVARDEF(name, aliasname) \ -- extern __typeof (name) aliasname __attribute__ ((alias (#name))); --# endif --# define INTDEF2(name, newname) strong_alias (name, newname##_internal) --# define INTVARDEF2(name, newname) _INTVARDEF (name, newname##_internal) --#else --# define INTUSE(name) name --# define INTDEF(name) --# define INTVARDEF(name) --# define INTDEF2(name, newname) --# define INTVARDEF2(name, newname) --#endif -- --#endif /* libc-symbols.h */ -diff --git a/include/set-hooks.h b/include/set-hooks.h -deleted file mode 100644 -index 9ed71b3..0000000 ---- a/include/set-hooks.h -+++ /dev/null -@@ -1,72 +0,0 @@ --/* Macros for using symbol sets for running lists of functions. -- Copyright (C) 1994, 1995, 1997, 2000 Free Software Foundation, Inc. -- This file is part of the GNU C Library. -- -- The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- -- The GNU C Library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with the GNU C Library; if not, write to the Free -- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -- 02111-1307 USA. */ -- --#ifndef _SET_HOOKS_H --#define _SET_HOOKS_H 1 -- --#define __need_size_t --#include --// #include --#define __unbounded -- --#ifdef symbol_set_define --/* Define a hook variable called NAME. Functions put on this hook take -- arguments described by PROTO. Use `text_set_element (NAME, FUNCTION)' -- from gnu-stabs.h to add a function to the hook. */ -- --# define DEFINE_HOOK(NAME, PROTO) \ -- typedef void __##NAME##_hook_function_t PROTO; \ -- symbol_set_define (NAME) -- --# define DECLARE_HOOK(NAME, PROTO) \ -- typedef void __##NAME##_hook_function_t PROTO;\ -- symbol_set_declare (NAME) -- --/* Run all the functions hooked on the set called NAME. -- Each function is called like this: `function ARGS'. */ -- --# define RUN_HOOK(NAME, ARGS) \ --do { \ -- void *const *__unbounded ptr; \ -- for (ptr = symbol_set_first_element (NAME); \ -- ! symbol_set_end_p (NAME, ptr); ++ptr) \ -- (*(__##NAME##_hook_function_t *) *ptr) ARGS; \ --} while (0) -- --/* Define a hook variable with NAME and PROTO, and a function called RUNNER -- which calls each function on the hook in turn, with ARGS. */ -- --# define DEFINE_HOOK_RUNNER(name, runner, proto, args) \ --DEFINE_HOOK (name, proto); \ --extern void runner proto; void runner proto { RUN_HOOK (name, args); } -- --#else -- --/* The system does not provide necessary support for this. */ --# define DEFINE_HOOK(NAME, PROTO) -- --# define DECLARE_HOOK(NAME, PROTO) -- --# define RUN_HOOK(NAME, ARGS) -- --# define DEFINE_HOOK_RUNNER(name, runner, proto, args) -- --#endif -- --#endif /* set-hooks.h */ -diff --git a/signal/README b/signal/README -deleted file mode 100644 -index 4963b26..0000000 ---- a/signal/README -+++ /dev/null -@@ -1,12 +0,0 @@ --This directory provides a signal implementation, which is appropriate --for operating systems where signals are managed at user-level. It is --up to the run-time to catch the signals and forward them to the --implementation via, e.g., the pthread_kill_info_np call. -- --The files in this directory are accompanied by the generic implementations --found in sysdeps/generic/: killpg.c, raise.c, sigaddset.c, sigdelset.c, --sigemptyset.c, sigfillset.c, siginterrupt.c, sigismember.c, signal.c, --sigwait.c. -- --This implementation was once used for a native port running on L4, but is not --currently used in any libpthread port bundled in this release. -diff --git a/signal/TODO b/signal/TODO -deleted file mode 100644 -index 1148abb..0000000 ---- a/signal/TODO -+++ /dev/null -@@ -1,29 +0,0 @@ --Unimplemented Functionality ----------------------------- -- --We don't support interruptible functions. That is, if a signal is --delivered when a thread is in e.g. the write system call, then the --write function should be interrupted and return EINTR when the signal --handler is finished. To realize this behavior, we could have a thread --local interruptible flag and a setjmp buffer. A function that is --interruptible would fill the jump buffer and set the interruptible --flag. If a signal comes in and the interruptible flag is set, rather --than resuming the thread, we longjmp to the buffer. -- --If a signal action has set the SA_SIGINFO, the third argument must be --a pointer to a ucontext describing the thread's interrupted state; --this implementation passes NULL. This isn't as bad as it sounds as --the the ucontext family of functions are marked obsolete in SUSv3 with --the advisory that any use of them should be replaced by the use of --pthread functionality (cf. makecontext rationale). -- --stop and continue signals are not implemented (as we need to stop all --threads, this requires being in bed with libpthread). -- --Implementation is not yet cancellation-safe. -- --There are not even stubs for sighold, sigingore, sigpause, sigrelse, --however, according to posix: "Use of any of these functions is --unspecified in a multi-threaded process." -- --Implement sigtimedwait, sigqueue. -\ No newline at end of file -diff --git a/signal/kill.c b/signal/kill.c -deleted file mode 100644 -index 27c9c32..0000000 ---- a/signal/kill.c -+++ /dev/null -@@ -1,70 +0,0 @@ --/* kill.c - Generic kill implementation. -- Copyright (C) 2008 Free Software Foundation, Inc. -- Written by Neal H. Walfield . -- -- This file is part of the GNU Hurd. -- -- The GNU Hurd is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public License -- as published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -- -- The GNU Hurd is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this program. If not, see -- . */ -- --#include "sig-internal.h" -- --int --kill (pid_t pid, int signo) --{ -- if (pid != getpid ()) -- { -- errno = EOPNOTSUPP; -- return -1; -- } -- -- /* "Signals generated for the process shall be delivered to exactly -- one of those threads within the process which is in a call to a -- sigwait() function selecting that signal or has not blocked -- delivery of the signal. If there are no threads in a call to a -- sigwait() function selecting that signal, and if all threads -- within the process block delivery of the signal, the signal shall -- remaing pending on the process" (2.4.1). */ -- -- /* First, see if there is a waiter, which is interested in this -- signal. */ -- pthread_mutex_lock (&sig_lock); -- -- struct sigwaiter *waiter; -- for (waiter = sigwaiters; waiter; waiter = waiter->next) -- if ((waiter->signals & sigmask (signo))) -- /* Got a winner. */ -- { -- sigdelset (&process_pending, signo); -- -- pthread_mutex_lock (&waiter->ss->lock); -- sigdelset (&waiter->ss->pending, signo); -- -- memset (&waiter->info, 0, sizeof (waiter->info)); -- waiter->info.si_signo = signo; -- -- sigwaiter_unblock (waiter); -- -- return 0; -- } -- -- pthread_mutex_unlock (&sig_lock); -- -- /* XXX: We just generate the signal for the current thread. If the -- current thread has blocked the signal, the correct thing to do is -- to iterate over all the other threads and find on that hasn't -- blocked it. */ -- return pthread_kill (pthread_self (), signo); --} -- -diff --git a/signal/pt-kill-siginfo-np.c b/signal/pt-kill-siginfo-np.c -deleted file mode 100644 -index 9bdf6cc..0000000 ---- a/signal/pt-kill-siginfo-np.c -+++ /dev/null -@@ -1,88 +0,0 @@ --/* pthread-kill-siginfo-np.c - Generic pthread_kill_siginfo_np implementation. -- Copyright (C) 2008 Free Software Foundation, Inc. -- Written by Neal H. Walfield . -- -- This file is part of the GNU Hurd. -- -- The GNU Hurd is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public License -- as published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -- -- The GNU Hurd is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this program. If not, see -- . */ -- --#include "pt-internal.h" --#include "sig-internal.h" -- --int --pthread_kill_siginfo_np (pthread_t tid, siginfo_t si) --{ -- int sig = si.si_signo; -- -- if (sig < 0 || sig >= NSIG) -- return EINVAL; -- -- if (sig == 0) -- return 0; -- -- struct signal_state *ss = &__pthread_getid (tid)->ss; -- -- pthread_mutex_lock (&sig_lock); -- pthread_mutex_lock (&ss->lock); -- -- if (ss->sigwaiter && (ss->sigwaiter->signals & sigmask (si.si_signo))) -- /* The thread is in a call to sigwait. */ -- { -- ss->sigwaiter->info = si; -- sigwaiter_unblock (ss->sigwaiter); -- return 0; -- } -- -- pthread_mutex_unlock (&sig_lock); -- -- if (ss->actions[sig - 1].sa_handler == (void *) SIG_IGN -- || (ss->actions[sig - 1].sa_handler == (void *) SIG_DFL -- && default_action (sig) == sig_ignore)) -- /* It is unclear (to me) what is supposed to happen when a signal -- is generated for a thread, which is blocking that signal and -- ignoring it. POSIX does say that when the action associated -- with a pending, blocked signal is set to SIG_IGN, the pending -- signal is to be cleared. Thus, it makes sense that any signal -- set to ignore is discarded at generation. */ -- { -- pthread_mutex_unlock (&ss->lock); -- return 0; -- } -- -- -- if ((sigmask (sig) & ss->blocked)) -- /* The signal is blocked. Mark it pending. */ -- { -- ss->pending |= sigmask (sig); -- pthread_mutex_unlock (&ss->lock); -- return 0; -- } -- -- if (pthread_self () == tid -- && (! (ss->actions[si.si_signo - 1].sa_flags & SA_ONSTACK) -- || (ss->stack.ss_flags & SS_DISABLE) -- || (ss->stack.ss_flags & SS_ONSTACK))) -- /* We are sending a signal to ourself and we don't use an -- alternate stack. */ -- signal_dispatch (ss, &si); -- else -- signal_dispatch_lowlevel (ss, tid, si); -- -- /* Don't unlock ss: signal_dispatch and signal_dispatch_lowlevel -- assume ownership of the lock. */ -- -- return 0; --} -- -diff --git a/signal/sig-internal.c b/signal/sig-internal.c -deleted file mode 100644 -index f73f38b..0000000 ---- a/signal/sig-internal.c -+++ /dev/null -@@ -1,26 +0,0 @@ --/* sig-internal.c - Signal state functions. -- Copyright (C) 2008 Free Software Foundation, Inc. -- Written by Neal H. Walfield . -- -- This file is part of the GNU Hurd. -- -- The GNU Hurd is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public License -- as published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -- -- The GNU Hurd is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this program. If not, see -- . */ -- --#include "sig-internal.h" -- --pthread_mutex_t sig_lock = PTHREAD_MUTEX_INITIALIZER; -- --sigset_t process_pending; --siginfo_t process_pending_info[NSIG]; -diff --git a/signal/sig-internal.h b/signal/sig-internal.h -deleted file mode 100644 -index 6c86c79..0000000 ---- a/signal/sig-internal.h -+++ /dev/null -@@ -1,177 +0,0 @@ --/* sig-internal.h - Internal signal handling interface. -- Copyright (C) 2008 Free Software Foundation, Inc. -- Written by Neal H. Walfield . -- -- This file is part of the GNU Hurd. -- -- The GNU Hurd is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public License -- as published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -- -- The GNU Hurd is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this program. If not, see -- . */ -- --#ifndef SIG_INTERNAL_H --#define SIG_INTERNAL_H -- --#include -- --#include -- --#define sigmask(sig) (1ULL << (sig - 1)) --#define STOPSIGS (sigmask (SIGTTIN) | sigmask (SIGTTOU) | \ -- sigmask (SIGSTOP) | sigmask (SIGTSTP)) -- --/* General lock. Protects PROCESS_PENDING, PROCESS_PENDING_INFO, -- SIGWAITERS. */ --extern pthread_mutex_t sig_lock; -- --/* "Signals generated for the process shall be delivered to exactly -- one of those threads within the process which is in a call to a -- sigwait() function selecting that signal or has not blocked -- delivery of the signal. If there are no threads in a call to a -- sigwait() function selecting that signal, and if all threads within -- the process block delivery of the signal, the signal shall remaing -- pending on the process" (2.4.1). -- -- This variable is protected by SIG_LOCK. */ --extern sigset_t process_pending; --extern siginfo_t process_pending_info[NSIG]; -- --struct sigwaiter; -- --/* The per-thread signal state. */ --struct signal_state --{ -- /* Protects the following fields. STACK.SA_FLAGS may be accessed -- using atomic operations. */ -- pthread_mutex_t lock; -- -- /* Pending signals. */ -- sigset_t pending; -- -- /* Blocked signals (i.e., the signal mask). */ -- sigset_t blocked; -- -- stack_t stack; -- struct sigaction actions[NSIG]; -- siginfo_t info[NSIG]; -- -- /* If the thread is blocked in a call to sigwait. */ -- struct sigwaiter *sigwaiter; --}; -- --#define PTHREAD_SIGNAL_MEMBERS struct signal_state ss; -- --/* Arranges for thread TID to call signal_dispatch. Must not be -- called if TID is the caller and an alternate stack is not required. -- In this case, the caller should call signal_dispatch directly. */ --extern void signal_dispatch_lowlevel (struct signal_state *ss, -- pthread_t tid, siginfo_t si); -- --/* This is the signal handler entry point. A thread is forced into -- this state when it receives a signal. We need to save the thread's -- state and then invoke the high-level signal dispatcher. SS->LOCK -- is locked by the caller. */ --extern void signal_dispatch (struct signal_state *ss, siginfo_t *si); -- --#ifndef SIGNAL_DISPATCH_ENTRY --#define SIGNAL_DISPATCH_ENTRY --#endif -- --#ifndef SIGNAL_DISPATCH_EXIT --#define SIGNAL_DISPATCH_EXIT --#endif -- --/* When a thread calls sigwait and a requested signal is not pending, -- it allocates the following structure, fills it in, adds it to -- sigwaiters and sleeps. */ --struct sigwaiter --{ -- struct sigwaiter *next; -- struct sigwaiter *prev; -- -- /* Thread's signal state. */ -- struct signal_state *ss; -- -- /* Signals this thread is waiting for. */ -- sigset_t signals; -- -- /* The selected signal is returned here. The waiter also -- futex_waits on this info.si_signo. */ -- siginfo_t info; --}; -- --/* This variable is protected by SIG_LOCK. */ --extern struct sigwaiter *sigwaiters; -- --/* Block the caller waiting for a signal in set SET. SIG_LOCK and -- SS->LOCK must be held and will be unlocked by this function before -- blocking. */ --extern siginfo_t sigwaiter_block (struct signal_state *ss, -- const sigset_t *restrict set); -- --/* Unblock the waiter WAITER. SIG_LOCK and WAITER->SS->LOCK must be -- held. Both will be dropped on return. */ --extern void sigwaiter_unblock (struct sigwaiter *waiter); -- --enum sig_action { sig_core, sig_terminate, sig_ignore, sig_cont, sig_stop }; -- --static inline enum sig_action --default_action (int signo) --{ -- switch (signo) -- { -- case SIGABRT: -- case SIGBUS: -- case SIGFPE: -- case SIGILL: -- case SIGQUIT: -- case SIGSEGV: -- case SIGSTKFLT: -- case SIGSYS: -- case SIGTRAP: -- case SIGXCPU: -- case SIGXFSZ: -- return sig_core; -- -- case SIGALRM: -- case SIGHUP: -- case SIGINT: -- case SIGIO: /* Perhaps ignore? */ -- case SIGKILL: -- case SIGPIPE: -- case SIGPROF: -- case SIGTERM: -- case SIGUSR1: -- case SIGUSR2: -- case SIGVTALRM: -- return sig_terminate; -- -- case SIGCHLD: -- case SIGPWR: -- case SIGURG: -- case SIGWINCH: -- return sig_ignore; -- -- case SIGCONT: -- return sig_cont; -- -- case SIGSTOP: -- case SIGTSTP: -- case SIGTTIN: -- case SIGTTOU: -- return sig_stop; -- } -- -- panic ("Unknown signal number: %d", signo); --} -- --#endif -diff --git a/signal/sigaction.c b/signal/sigaction.c -deleted file mode 100644 -index 0126c99..0000000 ---- a/signal/sigaction.c -+++ /dev/null -@@ -1,72 +0,0 @@ --/* sigaction.c - Generic sigaction implementation. -- Copyright (C) 2008 Free Software Foundation, Inc. -- Written by Neal H. Walfield . -- -- This file is part of the GNU Hurd. -- -- The GNU Hurd is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public License -- as published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -- -- The GNU Hurd is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this program. If not, see -- . */ -- --#include "sig-internal.h" --#include "pt-internal.h" -- --int --sigaction (int sig, const struct sigaction *restrict sa, -- struct sigaction *restrict osa) --{ -- if (sig <= 0 || sig >= NSIG) -- { -- errno = EINVAL; -- return -1; -- } -- -- struct signal_state *ss = &_pthread_self ()->ss; -- -- pthread_mutex_lock (&ss->lock); -- -- if (osa) -- *osa = ss->actions[sig - 1]; -- -- if (sa) -- { -- ss->actions[sig - 1] = *sa; -- -- /* "The SIGKILL and SIGSTOP signals shall not be added to the -- signal mask using this mechanism; this restriction shall be -- enforced by the system without causing an error to be -- indicated" (sigaction). */ -- sigdelset (&ss->blocked, SIGKILL); -- sigdelset (&ss->blocked, SIGSTOP); -- -- /* A "signal shall remain pending on the process until it is -- unblocked, it is accepted when ..., or the action associated -- with it is set to ignore the signal" (2.4.1). -- -- "Setting a signal action to SIG_DFL for a signal that is -- pending, and whose default action is to ignore the signal, -- ..., shall cause the pending signal to be discarded, whether -- or not it is blocked" (2.4.3). */ -- if (sa->sa_handler == SIG_IGN -- || (sa->sa_handler == SIG_DFL && default_action (sig) == sig_ignore)) -- { -- sigdelset (&ss->pending, sig); -- sigdelset (&process_pending, sig); -- } -- } -- -- pthread_mutex_unlock (&ss->lock); -- -- return 0; --} -- -diff --git a/signal/sigaltstack.c b/signal/sigaltstack.c -deleted file mode 100644 -index 8334811..0000000 ---- a/signal/sigaltstack.c -+++ /dev/null -@@ -1,69 +0,0 @@ --/* sigaltstack.c - Generic sigaltstack implementation. -- Copyright (C) 2008 Free Software Foundation, Inc. -- Written by Neal H. Walfield . -- -- This file is part of the GNU Hurd. -- -- The GNU Hurd is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public License -- as published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -- -- The GNU Hurd is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this program. If not, see -- . */ -- --#include "sig-internal.h" --#include "pt-internal.h" -- --int --sigaltstack (const stack_t *restrict stack, stack_t *restrict old) --{ -- int err = 0; -- struct signal_state *ss = &_pthread_self ()->ss; -- -- pthread_mutex_lock (&ss->lock); -- -- if (old) -- *old = ss->stack; -- -- if (stack) -- { -- if (stack->ss_size < MINSIGSTKSZ) -- { -- err = ENOMEM; -- goto out; -- } -- -- if ((stack->ss_flags & ~(SS_DISABLE))) -- /* Flags contains a value other than SS_DISABLE. */ -- { -- err = EINVAL; -- goto out; -- } -- -- if ((ss->stack.ss_flags & SS_ONSTACK)) -- /* Stack in use. */ -- { -- err = EPERM; -- goto out; -- } -- -- ss->stack = *stack; -- } -- -- out: -- pthread_mutex_unlock (&ss->lock); -- -- if (err) -- { -- errno = err; -- return -1; -- } -- return 0; --} -diff --git a/signal/signal-dispatch.c b/signal/signal-dispatch.c -deleted file mode 100644 -index 40440b7..0000000 ---- a/signal/signal-dispatch.c -+++ /dev/null -@@ -1,117 +0,0 @@ --/* signal-dispatch.c - Signal dispatcher. -- Copyright (C) 2008 Free Software Foundation, Inc. -- Written by Neal H. Walfield . -- -- This file is part of the GNU Hurd. -- -- The GNU Hurd is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public License -- as published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -- -- The GNU Hurd is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this program. If not, see -- . */ -- --#include "sig-internal.h" -- --/* This is the signal handler entry point. A thread is forced into -- this state when it receives a signal. We need to save the thread's -- state and then invoke the high-level signal dispatcher. SS->LOCK -- is locked by the caller. */ --void --signal_dispatch (struct signal_state *ss, siginfo_t *si) --{ -- SIGNAL_DISPATCH_ENTRY; -- -- int signo = si->si_signo; -- -- assert (signo > 0 && signo < NSIG); -- assert (pthread_mutex_trylock (&ss->lock) == EBUSY); -- -- do -- { -- if ((sigmask (signo) & STOPSIGS)) -- /* Stop signals clear a pending SIGCONT even if they -- are handled or ignored (but not if preempted). */ -- { -- sigdelset (&ss->pending, SIGCONT); -- sigdelset (&process_pending, SIGCONT); -- } -- else if ((signo == SIGCONT)) -- /* Even if handled or ignored (but not preempted), SIGCONT -- clears stop signals and resumes the process. */ -- { -- ss->pending &= ~STOPSIGS; -- process_pending &= ~STOPSIGS; -- } -- -- void (*handler)(int, siginfo_t *, void *) -- = ss->actions[signo - 1].sa_sigaction; -- -- /* Reset to SIG_DFL if requested. SIGILL and SIGTRAP cannot -- be automatically reset when delivered; the system silently -- enforces this restriction (sigaction). */ -- if (ss->actions[signo - 1].sa_flags & SA_RESETHAND -- && signo != SIGILL && signo != SIGTRAP) -- ss->actions[signo - 1].sa_handler = SIG_DFL; -- -- sigset_t orig_blocked = ss->blocked; -- /* Block requested signals while running the handler. */ -- ss->blocked |= ss->actions[signo - 1].sa_mask; -- -- /* Block SIGNO unless we're asked not to. */ -- if (! (ss->actions[signo - 1].sa_flags & (SA_RESETHAND | SA_NODEFER))) -- sigaddset (&ss->blocked, signo); -- -- sigdelset (&ss->pending, signo); -- pthread_mutex_unlock (&ss->lock); -- -- pthread_mutex_lock (&sig_lock); -- sigdelset (&process_pending, signo); -- pthread_mutex_unlock (&sig_lock); -- -- if (handler == (void *) SIG_DFL) -- { -- enum sig_action action = default_action (signo); -- -- if (action == sig_terminate || action == sig_core) -- _exit (128 + signo); -- -- if (action == sig_stop) -- /* XXX: Implement me. */ -- panic ("Stopping process unimplemented."); -- -- if (action == sig_cont) -- /* XXX: Implement me. */; -- panic ("Continuing process unimplemented."); -- } -- else if (handler == (void *) SIG_IGN) -- ; -- else -- handler (signo, si, NULL); -- -- pthread_mutex_lock (&ss->lock); -- -- /* "When a thread's signal mask is changed in a signal-catching -- function that is installed by sigaction(), the restoration of -- the signal mask on return from the signal-catching function -- overrides that change (see sigaction())" (sigprocmask). */ -- ss->blocked = orig_blocked; -- -- sigset_t pending = ~ss->blocked & ss->pending; -- if (! pending) -- pending = ~ss->blocked & process_pending; -- signo = l4_lsb64 (pending); -- } -- while (signo); -- -- pthread_mutex_unlock (&ss->lock); -- -- SIGNAL_DISPATCH_EXIT; --} -diff --git a/signal/signal.h b/signal/signal.h -deleted file mode 100644 -index 6e22d05..0000000 ---- a/signal/signal.h -+++ /dev/null -@@ -1,275 +0,0 @@ --/* signal.h - Signal handling interface. -- Copyright (C) 2008 Free Software Foundation, Inc. -- Written by Neal H. Walfield . -- -- This file is part of the GNU Hurd. -- -- The GNU Hurd is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public License -- as published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -- -- The GNU Hurd is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this program. If not, see -- . */ -- --#ifndef _SIGNAL_H --#define _SIGNAL_H 1 -- --#include --#include -- --typedef volatile int sig_atomic_t; -- --/*typedef uint64_t sigset_t;*/ -- --int sigaddset (sigset_t *, int); --int sigdelset (sigset_t *, int); --int sigemptyset (sigset_t *); --int sigfillset (sigset_t *); --int sigismember (const sigset_t *, int); -- --/* These values are consistent with Linux. */ --#define SIGRTMIN 34 --#define SIGRTMAX 64 -- --enum -- { -- SIGHUP = 1, --#define SIGHUP SIGHUP -- SIGINT, --#define SIGINT SIGINT -- SIGQUIT, --#define SIGQUIT SIGQUIT -- SIGILL, --#define SIGILL SIGILL -- SIGTRAP, --#define SIGTRAP SIGTRAP -- SIGABRT, --#define SIGABRT SIGABRT -- SIGBUS, --#define SIGBUS SIGBUS -- SIGFPE, --#define SIGFPE SIGFPE -- SIGKILL, --#define SIGKILL SIGKILL -- SIGUSR1, --#define SIGUSR1 SIGUSR1 -- SIGSEGV, --#define SIGSEGV SIGSEGV -- SIGUSR2, --#define SIGUSR2 SIGUSR2 -- SIGPIPE, --#define SIGPIPE SIGPIPE -- SIGALRM, --#define SIGALRM SIGALRM -- SIGTERM, --#define SIGTERM SIGTERM -- SIGSTKFLT, --#define SIGSTKFLT SIGSTKFLT -- SIGCHLD, --#define SIGCHLD SIGCHLD -- SIGCONT, --#define SIGCONT SIGCONT -- SIGSTOP, --#define SIGSTOP SIGSTOP -- SIGTSTP, --#define SIGTSTP SIGTSTP -- SIGTTIN, --#define SIGTTIN SIGTTIN -- SIGTTOU, --#define SIGTTOU SIGTTOU -- SIGURG, --#define SIGURG SIGURG -- SIGXCPU, --#define SIGXCPU SIGXCPU -- SIGXFSZ, --#define SIGXFSZ SIGXFSZ -- SIGVTALRM, --#define SIGVTALRM SIGVTALRM -- SIGPROF, --#define SIGPROF SIGPROF -- SIGWINCH, --#define SIGWINCH SIGWINCH -- SIGIO, --#define SIGIO SIGIO -- SIGPWR, --#define SIGPWR SIGPWR -- SIGSYS, --#define SIGSYS SIGSYS -- NSIG -- }; -- --/* The resulting set is the union of the current set and the signal -- set pointed to by the argument set. */ --#define SIG_BLOCK 1 --/* The resulting set is the intersection of the current set and the -- complement of the signal set pointed to by the argument set. */ --#define SIG_UNBLOCK 2 --/* The resulting set is the signal set pointed to by the argument -- set. */ --#define SIG_SETMASK 3 -- --int pthread_sigmask (int how, const sigset_t *mask, sigset_t *old); --int sigprocmask (int how, const sigset_t *restrict mask, -- sigset_t *restrict old); -- --/* Return set of pending signals. */ --int sigpending(sigset_t *set); -- --union sigval --{ -- int sival_int; -- void *sival_ptr; --}; -- --#define SIG_DFL ((void (*)(int)) (0)) --#define SIG_ERR ((void (*)(int)) (-1)) --#define SIG_IGN ((void (*)(int)) (1)) -- --/* Causes signal delivery to occur on an alternate stack. */ --#define SA_ONSTACK (1 << 0) --/* Do not generate SIGCHLD when children stop or stopped children -- continue. */ --#define SA_NOCLDSTOP (1 << 1) --/* Causes signal dispositions to be set to SIG_DFL on entry to signal -- handlers. */ --#define SA_RESETHAND (1 << 2) --/* Causes certain functions to become restartable. */ --#define SA_RESTART (1 << 3) --/* Causes extra information to be passed to signal handlers at the -- time of receipt of a signal. */ --#define SA_SIGINFO (1 << 4) --/* Causes implementations not to create zombie processes on child -- death. */ --#define SA_NOCLDWAIT (1 << 5) --/* Causes signal not to be automatically blocked on entry to -- signal handler. */ --#define SA_NODEFER (1 << 6) -- --typedef struct --{ -- int si_signo; -- int si_code; -- int si_errno; -- pid_t si_pid; -- uid_t si_uid; -- void *si_addr; -- int si_status; -- long si_band; -- union sigval si_value; --} siginfo_t; -- --struct sigaction --{ -- union -- { -- /* Pointer to a signal-catching function or one of the macros -- SIG_IGN or SIG_DFL. */ -- void (*sa_handler)(int); -- -- /* Pointer to a signal-catching function. */ -- void (*sa_sigaction)(int, siginfo_t *, void *); -- }; -- -- /* Set of signals to be blocked during execution of the signal -- handling function. */ -- sigset_t sa_mask; -- -- /* Special flags. */ -- int sa_flags; --}; -- --int sigaction (int signo, const struct sigaction *restrict newaction, -- struct sigaction *restrict oldaction); -- --void (*signal (int signo, void (*handler)(int)))(int); --void (*bsd_signal (int signo, void (*handler)(int)))(int); -- --/* Process is executing on an alternate signal stack. */ --#define SS_ONSTACK (1 << 0) --/* Alternate signal stack is disabled. */ --#define SS_DISABLE (1 << 1) -- --/* Minimum stack size for a signal handler. */ --#define MINSIGSTKSZ PAGESIZE --/* Default size in bytes for the alternate signal stack. */ --#define SIGSTKSZ (16 * PAGESIZE) -- --typedef struct --{ -- void *ss_sp; -- size_t ss_size; -- int ss_flags; --} stack_t; -- --int sigaltstack(const stack_t *restrict stack, stack_t *restrict old); -- --#include -- --/* Send SIGNO to the process PID. */ --int kill(pid_t pid, int signo); -- --/* Send SIGNO to the process group PG. */ --int killpg(pid_t pg, int signo); -- --/* Send SIGNO to thread TID. */ --int pthread_kill(pthread_t tid, int signo); -- --/* Send a signal to thread TID using SIGINFO. */ --int pthread_kill_siginfo_np (pthread_t tid, siginfo_t siginfo); -- --/* Send SIGNO to the calling thread. */ --int raise(int signo); -- --typedef struct sigevent --{ -- /* Notification type. */ -- int sigev_notify; -- -- /* Signal number. */ -- int sigev_signo; -- -- /* Signal value. */ -- union sigval sigev_value; -- -- /* Notification function. */ -- void (*sigev_notify_function) (union sigval); -- -- /* Notification attributes. */ -- pthread_attr_t *sigev_notify_attributes; --} sigevent_t; -- --enum -- { -- SIGEV_NONE = 0, --#define SIGEV_NONE SIGEV_NONE -- SIGEV_SIGNAL, --#define SIGEV_SIGNAL SIGEV_SIGNAL -- SIGEV_THREAD --#define SIGEV_THREAD SIGEV_THREAD -- }; -- --#define SIG_HOLD -- --int sighold (int); --int sigignore (int); --int siginterrupt (int, int); --int sigpause (int); --int sigqueue (pid_t, int, const union sigval); --int sigrelse (int); --void (*sigset (int, void (*)(int)))(int); --int sigsuspend (const sigset_t *); -- --/* Wait for a signal. */ --int sigwait (const sigset_t *restrict set, int *restrict signo); --int sigwaitinfo (const sigset_t *restrict set, siginfo_t *restrict info); --int sigtimedwait (const sigset_t *restrict set, siginfo_t *restrict info, -- const struct timespec *restrict timespec); -- --#endif -diff --git a/signal/sigpending.c b/signal/sigpending.c -deleted file mode 100644 -index 609b55d..0000000 ---- a/signal/sigpending.c -+++ /dev/null -@@ -1,38 +0,0 @@ --/* sigpending.c - Generic sigpending implementation. -- Copyright (C) 2008 Free Software Foundation, Inc. -- Written by Neal H. Walfield . -- -- This file is part of the GNU Hurd. -- -- The GNU Hurd is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public License -- as published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -- -- The GNU Hurd is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this program. If not, see -- . */ -- --#include --#include -- --int --sigpending (sigset_t *set) --{ -- struct signal_state *ss = &_pthread_self ()->ss; -- -- pthread_mutex_lock (&ss->lock); -- -- /* There is no need to lock SIG_LOCK for process_pending since we -- just read it, which is atomic. */ -- *set = (ss->pending | process_pending) & ss->blocked; -- -- pthread_mutex_unlock (&ss->lock); -- -- return 0; --} -diff --git a/signal/sigsuspend.c b/signal/sigsuspend.c -deleted file mode 100644 -index 73cf12a..0000000 ---- a/signal/sigsuspend.c -+++ /dev/null -@@ -1,29 +0,0 @@ --/* sigsuspend.c - Generic sigsuspend implementation. -- Copyright (C) 2008 Free Software Foundation, Inc. -- Written by Neal H. Walfield . -- -- This file is part of the GNU Hurd. -- -- The GNU Hurd is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public License -- as published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -- -- The GNU Hurd is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this program. If not, see -- . */ -- --#include "sig-internal.h" -- --int --sigsuspend (const sigset_t *set) --{ -- /* XXX: Implement me. */ -- errno = EOPNOTSUPP; -- return -1; --} -diff --git a/signal/sigtimedwait.c b/signal/sigtimedwait.c -deleted file mode 100644 -index 52cd017..0000000 ---- a/signal/sigtimedwait.c -+++ /dev/null -@@ -1,30 +0,0 @@ --/* sigtimedwait.c - Generic sigtimedwait implementation. -- Copyright (C) 2008 Free Software Foundation, Inc. -- Written by Neal H. Walfield . -- -- This file is part of the GNU Hurd. -- -- The GNU Hurd is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public License -- as published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -- -- The GNU Hurd is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this program. If not, see -- . */ -- --#include "sig-internal.h" -- --int --sigtimedwait (const sigset_t *restrict set, siginfo_t *restrict info, -- const struct timespec *restrict timeout) --{ -- errno = EOPNOTSUPP; -- return -1; --} -- -diff --git a/signal/sigwaiter.c b/signal/sigwaiter.c -deleted file mode 100644 -index 8d041ac..0000000 ---- a/signal/sigwaiter.c -+++ /dev/null -@@ -1,91 +0,0 @@ --/* sigwaiter.c - Signal handling functions. -- Copyright (C) 2008 Free Software Foundation, Inc. -- Written by Neal H. Walfield . -- -- This file is part of the GNU Hurd. -- -- The GNU Hurd is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public License -- as published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -- -- The GNU Hurd is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this program. If not, see -- . */ -- --#include "sig-internal.h" -- --#include -- --struct sigwaiter *sigwaiters; -- --siginfo_t --sigwaiter_block (struct signal_state *ss, const sigset_t *restrict set) --{ -- assert (pthread_mutex_trylock (&sig_lock) == EBUSY); -- assert (pthread_mutex_trylock (&ss->lock) == EBUSY); -- -- assert (! ss->sigwaiter); -- -- struct sigwaiter waiter; -- -- waiter.next = sigwaiters; -- if (waiter.next) -- { -- assert (! waiter.next->prev); -- waiter.next->prev = &waiter; -- } -- waiter.prev = 0; -- sigwaiters = &waiter; -- -- waiter.ss = ss; -- waiter.info.si_signo = 0; -- waiter.signals = *set; -- -- ss->sigwaiter = &waiter; -- -- pthread_mutex_unlock (&ss->lock); -- pthread_mutex_unlock (&sig_lock); -- -- futex_wait (&waiter.info.si_signo, 0); -- --#ifndef NDEBUG -- pthread_mutex_lock (&ss->lock); -- ss->sigwaiter = 0; -- pthread_mutex_unlock (&ss->lock); --#endif -- -- assert (waiter.info.si_signo); -- return waiter.info; --} -- --void --sigwaiter_unblock (struct sigwaiter *waiter) --{ -- assert (pthread_mutex_trylock (&sig_lock) == EBUSY); -- assert (pthread_mutex_trylock (&waiter->ss->lock) == EBUSY); -- -- struct sigwaiter *prev = waiter->prev; -- struct sigwaiter *next = waiter->next; -- -- if (next) -- next->prev = prev; -- -- if (prev) -- prev->next = next; -- else -- sigwaiters = next; -- -- sigdelset (&process_pending, waiter->info.si_signo); -- sigdelset (&waiter->ss->pending, waiter->info.si_signo); -- -- pthread_mutex_unlock (&waiter->ss->lock); -- pthread_mutex_unlock (&sig_lock); -- -- futex_wake (&waiter->info.si_signo, 1); --} -diff --git a/signal/sigwaitinfo.c b/signal/sigwaitinfo.c -deleted file mode 100644 -index 1b47079..0000000 ---- a/signal/sigwaitinfo.c -+++ /dev/null -@@ -1,74 +0,0 @@ --/* sigwaitinfo.c - Generic sigwaitinfo implementation. -- Copyright (C) 2008 Free Software Foundation, Inc. -- Written by Neal H. Walfield . -- -- This file is part of the GNU Hurd. -- -- The GNU Hurd is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public License -- as published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -- -- The GNU Hurd is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this program. If not, see -- . */ -- --#include --#include -- --int --sigwaitinfo (const sigset_t *restrict set, siginfo_t *restrict info) --{ -- pthread_mutex_lock (&sig_lock); -- -- struct signal_state *ss = &_pthread_self ()->ss; -- -- pthread_mutex_lock (&ss->lock); -- -- if ((process_pending & *set) || (ss->pending & *set)) -- /* There is at least one signal pending. */ -- { -- bool local = true; -- sigset_t extant = process_pending & *set; -- if (! extant) -- { -- local = false; -- extant = ss->pending & *set; -- } -- -- assert (extant); -- -- int signo = l4_msb64 (extant); -- -- if (info) -- { -- if (local) -- *info = ss->info[signo - 1]; -- else -- *info = process_pending_info[signo - 1]; -- info->si_signo = signo; -- } -- -- sigdelset (&process_pending, signo); -- sigdelset (&ss->pending, signo); -- -- pthread_mutex_unlock (&ss->lock); -- pthread_mutex_unlock (&sig_lock); -- return 0; -- } -- -- siginfo_t i = sigwaiter_block (ss, set); -- assert (i.si_signo); -- assert ((sigmask (i.si_signo) & *set)); -- -- if (info) -- *info = i; -- -- return 0; --} -- --- -1.9.0 -From 4067112197e4f8f5975c8647cab355e06736177d Mon Sep 17 00:00:00 2001 +From 3efea8fcd703838e110ca1d98dcda54ac407e4cb Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis -Date: Thu, 27 Mar 2014 00:21:36 +0000 -Subject: [PATCH 1/2] This helps to integrate libpthread as a glibc module. +Date: Sun, 30 Mar 2014 20:47:54 +0000 +Subject: [PATCH 5/6] fix --- - configure | 2 ++ - 1 file changed, 2 insertions(+) - create mode 100644 configure + sysdeps/mach/hurd/pt-sigstate.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) -diff --git a/configure b/configure -new file mode 100644 -index 0000000..2cdbc71 ---- /dev/null -+++ b/configure -@@ -0,0 +1,2 @@ -+libc_add_on_canonical=libpthread -+libc_add_on_subdirs=. -\ No newline at end of file +diff --git a/sysdeps/mach/hurd/pt-sigstate.c b/sysdeps/mach/hurd/pt-sigstate.c +index 68c79c5..d3f4368 100644 +--- a/sysdeps/mach/hurd/pt-sigstate.c ++++ b/sysdeps/mach/hurd/pt-sigstate.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #include + +@@ -31,11 +32,12 @@ __pthread_sigstate (struct __pthread *thread, int how, + { + error_t err = 0; + struct hurd_sigstate *ss; ++ sigset_t pending; + + ss = _hurd_thread_sigstate (thread->kernel_thread); + assert (ss); + +- __pthread_spin_lock (&ss->lock); ++ _hurd_sigstate_lock (ss); + + if (oset) + *oset = ss->blocked; +@@ -63,7 +65,13 @@ __pthread_sigstate (struct __pthread *thread, int how, + if (! err && clear_pending) + __sigemptyset (&ss->pending); + +- __pthread_spin_unlock (&ss->lock); ++ pending = _hurd_sigstate_pending (ss) & ~ss->blocked; ++ _hurd_sigstate_unlock (ss); ++ ++ if (! err && pending) ++ /* Send a message to the signal thread so it ++ will wake up and check for pending signals. */ ++ __msg_sig_post (_hurd_msgport, 0, 0, __mach_task_self ()); + + return err; + } -- 1.9.0 -From 7f5f718b4a231c1e08d9ed1676cb18e265b715d6 Mon Sep 17 00:00:00 2001 +From 9b364debeebf32cd97fd619ff77334f089816aa8 Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis -Date: Sat, 29 Mar 2014 23:29:44 +0000 -Subject: [PATCH 2/2] fix +Date: Sun, 30 Mar 2014 22:43:07 +0000 +Subject: [PATCH 6/6] Defines missing macro --- - signal/signal.h | 2 +- + sysdeps/mach/bits/spin-lock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/signal/signal.h b/signal/signal.h -index a33d995..6e22d05 100644 ---- a/signal/signal.h -+++ b/signal/signal.h -@@ -26,7 +26,7 @@ +diff --git a/sysdeps/mach/bits/spin-lock.h b/sysdeps/mach/bits/spin-lock.h +index 537dac9..4f2ae4c 100644 +--- a/sysdeps/mach/bits/spin-lock.h ++++ b/sysdeps/mach/bits/spin-lock.h +@@ -30,7 +30,7 @@ typedef __spin_lock_t __pthread_spinlock_t; - typedef volatile int sig_atomic_t; - --typedef uint64_t sigset_t; -+/*typedef uint64_t sigset_t;*/ + /* Initializer for a spin lock object. */ + #ifndef __PTHREAD_SPIN_LOCK_INITIALIZER +-#error __PTHREAD_SPIN_LOCK_INITIALIZER undefined: should be defined by . ++#define __PTHREAD_SPIN_LOCK_INITIALIZER ((__pthread_spinlock_t) 0) + #endif - int sigaddset (sigset_t *, int); - int sigdelset (sigset_t *, int); + __END_DECLS -- 1.9.0 -- 1.9.0 From be2de82f2f60a13f9e056c0d628707ce684d296e Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Wed, 2 Apr 2014 00:59:36 +0000 Subject: [PATCH 16/18] Some modifications to the patches --- gnu-system.am | 4 + gnu/packages/base.scm | 10 +- gnu/packages/cross-base.scm | 2 +- ...libc-2.17.90-bdb7a1-create-gnumach-header.patch | 36 ++++ .../glibc-2.17.90-bdb7a1-pthread-posix.patch | 166 +++++++++++++++ .../libpthread-0.3-3b391d-glibc-preparation.patch | 235 ++------------------- 6 files changed, 239 insertions(+), 214 deletions(-) create mode 100644 gnu/packages/patches/glibc-2.17.90-bdb7a1-create-gnumach-header.patch create mode 100644 gnu/packages/patches/glibc-2.17.90-bdb7a1-pthread-posix.patch diff --git a/gnu-system.am b/gnu-system.am index 14cccea..c8b637a 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -278,6 +278,9 @@ dist_patch_DATA = \ gnu/packages/patches/glibc-bootstrap-system.patch \ gnu/packages/patches/glibc-ldd-x86_64.patch \ gnu/packages/patches/glibc-make-4.0.patch \ + gnu/packages/patches/glibc-2.17.90-bdb7a1-create-gnumach-header.patch\ + gnu/packages/patches/glibc-2.17.90-bdb7a1-pthread-posix.patch \ + gnu/packages/patches/glibc-lock.patch \ gnu/packages/patches/gnunet-fix-scheduler.patch \ gnu/packages/patches/gnunet-fix-tests.patch \ gnu/packages/patches/gobject-introspection-cc.patch \ @@ -301,6 +304,7 @@ dist_patch_DATA = \ gnu/packages/patches/libtool-skip-tests.patch \ gnu/packages/patches/libtool-skip-tests-for-mips.patch \ gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch\ + gnu/packages/patches/libpthread_hurd_clean.patch \ gnu/packages/patches/luit-posix.patch \ gnu/packages/patches/m4-gets-undeclared.patch \ gnu/packages/patches/m4-readlink-EINVAL.patch \ diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index bc57bd0..9c4264b 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -35,6 +35,7 @@ #:use-module (guix git-download) #:use-module (gnu packages autotools) #:use-module (gnu packages hurd) + #:use-module (gnu packages bison) #:use-module (gnu packages linux) #:use-module (guix packages) #:use-module (guix download) @@ -510,9 +511,13 @@ with the Linux kernel.") (native-inputs `( ("patch/glibc-make" ,(search-patch "glibc-make-4.0.patch")) + ("patch/glibc-create-gnumach" ,(search-patch "glibc-2.17.90-bdb7a1-create-gnumach-header.patch")) + ("patch/glibc-pthread" ,(search-patch "glibc-2.17.90-bdb7a1-pthread-posix.patch")) ("patch/libpthread-patch" ,(search-patch "libpthread-0.3-3b391d-glibc-preparation.patch")) + ("patch/glibc-lock-patch" ,(search-patch "glibc-lock.patch")) ("mig" ,mig) ("perl" ,perl) + ("bison" ,bison) ("autoconf" ,(autoconf-wrapper autoconf-2.68)) ("automake" ,automake) ("libtool" ,libtool) @@ -530,7 +535,7 @@ with the Linux kernel.") (arguments `(#:out-of-source? #t #:configure-flags - (list ;;"LDFLAGS=-m32" + (list ;;"LDFLAGS=-DEBUG" "--without-cvs" "--enable-add-ons" "--host=i686-pc-gnu" @@ -556,6 +561,9 @@ with the Linux kernel.") 'autoconf 'apply-patch (lambda _ (zero? (system* "patch" "-p1" "-i" (assoc-ref %build-inputs "patch/glibc-make"))) + (zero? (system* "patch" "-p1" "-i" (assoc-ref %build-inputs "patch/glibc-create-gnumach"))) + (zero? (system* "patch" "-p1" "-i" (assoc-ref %build-inputs "patch/glibc-pthread"))) + ;;(zero? (system* "patch" "-p1" "-i" (assoc-ref %build-inputs "patch/glibc-lock-patch"))) (chdir "libpthread") (zero? (system* "patch" "-p1" "-i" (assoc-ref %build-inputs "patch/libpthread-patch"))) (chdir "..") diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 7e74c11..8053599 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -497,7 +497,7 @@ XBINUTILS and the cross tool chain." (propagated-inputs `(("cross-gnumach-headers" ,xgnumach-headers) ("cross-hurd-headers" ,xhurd-headers) - ("cross-hurd-minimal" ,xhurd-minimal))) + ("cross--minimal" ,xhurd-minimal))) (native-inputs `(("cross-gcc" ,xgcc-i686-pc-gnu) ("cross-binutils" ,xbinutils) diff --git a/gnu/packages/patches/glibc-2.17.90-bdb7a1-create-gnumach-header.patch b/gnu/packages/patches/glibc-2.17.90-bdb7a1-create-gnumach-header.patch new file mode 100644 index 0000000..b7fc7d0 --- /dev/null +++ b/gnu/packages/patches/glibc-2.17.90-bdb7a1-create-gnumach-header.patch @@ -0,0 +1,36 @@ +This generates and some object files that are required to +succesfully build libpthread. + +--- mach/Makefile ++++ mach/Makefile +@@ -111,7 +111,7 @@ ifndef mach-shortcuts + # $(mach-shortcuts) will be set, and that will change how + # mach_interface.defs is processed: it will get the -D flags below. + user-interfaces := $(filter-out $(mach-interface-list:%=mach/%) \ +- mach/mach_port mach/mach_host mach/mach4 \ ++ mach/mach_port mach/mach_host mach/mach4 mach/gnumach \ + device/device_request,\ + $(user-interfaces)) + endif +--- sysdeps/mach/configure ++++ sysdeps/mach/configure +@@ -277,7 +277,7 @@ if test $libc_cv_mach_task_creation_time = no; then + fi + + mach_interface_list= +-for ifc in mach mach4 \ ++for ifc in mach mach4 gnumach \ + clock clock_priv host_priv host_security ledger lock_set \ + processor processor_set task thread_act vm_map \ + memory_object memory_object_default default_pager \ +--- sysdeps/mach/configure.in ++++ sysdeps/mach/configure.in +@@ -54,7 +54,7 @@ dnl but we don't do a check for that here because in a bare + dnl environment the compile against those headers will fail. + dnl + mach_interface_list= +-for ifc in mach mach4 \ ++for ifc in mach mach4 gnumach \ + clock clock_priv host_priv host_security ledger lock_set \ + processor processor_set task thread_act vm_map \ + memory_object memory_object_default default_pager \ diff --git a/gnu/packages/patches/glibc-2.17.90-bdb7a1-pthread-posix.patch b/gnu/packages/patches/glibc-2.17.90-bdb7a1-pthread-posix.patch new file mode 100644 index 0000000..594b913 --- /dev/null +++ b/gnu/packages/patches/glibc-2.17.90-bdb7a1-pthread-posix.patch @@ -0,0 +1,166 @@ +Even if glibc doesn't have an integrated pthread library, it depends on the hurd +packages which have a pthread library, so we should provide all the defines etc. + +Avoid letting glibc try to install its own headers for libpthread. + +No topgit branch, TODO? + +--- + +Note that this also tacks on some versioning information at the end. + + sysdeps/mach/hurd/Makefile | 4 +++ + sysdeps/mach/hurd/bits/posix_opt.h | 40 ++++++++++++++++++++++----------- + sysdeps/mach/hurd/gai_misc.h | 44 +++++++++++++++++++++++++++++++++++++ + 3 files changed, 75 insertions(+), 13 deletions(-) + +--- a/sysdeps/mach/hurd/bits/posix_opt.h ++++ b/sysdeps/mach/hurd/bits/posix_opt.h +@@ -71,24 +71,38 @@ + /* XPG4.2 shared memory is supported. */ + #define _XOPEN_SHM 1 + +-/* We do not have the POSIX threads interface. */ +-#define _POSIX_THREADS -1 ++/* Tell we have POSIX threads. */ ++#define _POSIX_THREADS 200112L + + /* We have the reentrant functions described in POSIX. */ + #define _POSIX_REENTRANT_FUNCTIONS 1 + #define _POSIX_THREAD_SAFE_FUNCTIONS 200809L + +-/* These are all things that won't be supported when _POSIX_THREADS is not. */ ++/* We do not provide priority scheduling for threads. */ + #define _POSIX_THREAD_PRIORITY_SCHEDULING -1 +-#define _POSIX_THREAD_ATTR_STACKSIZE -1 +-#define _POSIX_THREAD_ATTR_STACKADDR -1 ++ ++/* We support user-defined stack sizes. */ ++#define _POSIX_THREAD_ATTR_STACKSIZE 200112L ++ ++/* We support user-defined stacks. */ ++#define _POSIX_THREAD_ATTR_STACKADDR 200112L ++ ++/* We do not support priority inheritence. */ + #define _POSIX_THREAD_PRIO_INHERIT -1 ++ ++/* We do not support priority protection. */ + #define _POSIX_THREAD_PRIO_PROTECT -1 ++ + #ifdef __USE_XOPEN2K8 ++/* We do not support priority inheritence for robust mutexes. */ + # define _POSIX_THREAD_ROBUST_PRIO_INHERIT -1 ++ ++/* We do not support priority protection for robust mutexes. */ + # define _POSIX_THREAD_ROBUST_PRIO_PROTECT -1 + #endif +-#define _POSIX_SEMAPHORES -1 ++ ++/* We support POSIX.1b semaphores. */ ++#define _POSIX_SEMAPHORES 200112L + + /* Real-time signals are not yet supported. */ + #define _POSIX_REALTIME_SIGNALS -1 +@@ -121,17 +135,17 @@ + /* GNU libc provides regular expression handling. */ + #define _POSIX_REGEXP 1 + +-/* Reader/Writer locks are not available. */ +-#define _POSIX_READER_WRITER_LOCKS -1 ++/* Reader/Writer locks are available. */ ++#define _POSIX_READER_WRITER_LOCKS 200112L + + /* We have a POSIX shell. */ + #define _POSIX_SHELL 1 + +-/* We cannot support the Timeouts option without _POSIX_THREADS. */ +-#define _POSIX_TIMEOUTS -1 ++/* We support the Timeouts option. */ ++#define _POSIX_TIMEOUTS 200112L + +-/* We do not support spinlocks. */ +-#define _POSIX_SPIN_LOCKS -1 ++/* We support spinlocks. */ ++#define _POSIX_SPIN_LOCKS 200112L + + /* The `spawn' function family is supported. */ + #define _POSIX_SPAWN 200809L +@@ -140,7 +154,7 @@ + #define _POSIX_TIMERS 0 + + /* The barrier functions are not available. */ +-#define _POSIX_BARRIERS -1 ++#define _POSIX_BARRIERS 200112L + + /* POSIX message queues could be available in future. */ + #define _POSIX_MESSAGE_PASSING 0 +--- a/sysdeps/mach/hurd/Makefile ++++ b/sysdeps/mach/hurd/Makefile +@@ -167,6 +167,10 @@ + CFLAGS-dl-load.c = -DEXTERNAL_MAP_FROM_FD + endif + ++ifeq ($(subdir),posix) ++CFLAGS-confstr.c += -DLIBPTHREAD_VERSION='"libpthread 0.3"' ++endif ++ + # Override the generic Makeconfig values so we link against the RPC libs. + link-libc-static := -Wl,--start-group \ + $(patsubst %,$(common-objpfx)%.a,\ +--- /dev/null ++++ b/sysdeps/mach/hurd/gai_misc.h +@@ -0,0 +1,44 @@ ++#include ++#include ++ ++#define gai_start_notify_thread __gai_start_notify_thread ++#define gai_create_helper_thread __gai_create_helper_thread ++ ++extern inline void ++__gai_start_notify_thread (void) ++{ ++ sigset_t ss; ++ sigemptyset (&ss); ++ sigprocmask(SIG_SETMASK, &ss, NULL); ++} ++ ++extern inline int ++__gai_create_helper_thread (pthread_t *threadp, void *(*tf) (void *), ++ void *arg) ++{ ++ pthread_attr_t attr; ++ ++ /* Make sure the thread is created detached. */ ++ pthread_attr_init (&attr); ++ pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED); ++ ++ /* The helper thread needs only very little resources. */ ++ (void) pthread_attr_setstacksize (&attr, 0x10000); ++ ++ /* Block all signals in the helper thread. To do this thoroughly we ++ temporarily have to block all signals here. */ ++ sigset_t ss; ++ sigset_t oss; ++ sigfillset (&ss); ++ sigprocmask(SIG_SETMASK, &ss, &oss); ++ ++ int ret = pthread_create (threadp, &attr, tf, arg); ++ ++ /* Restore the signal mask. */ ++ sigprocmask(SIG_SETMASK, &oss, NULL); ++ ++ (void) pthread_attr_destroy (&attr); ++ return ret; ++} ++ ++#include_next +--- a/Versions.def ++++ b/Versions.def +@@ -102,6 +102,7 @@ libpthread { + GLIBC_2.6 + GLIBC_2.11 + GLIBC_2.12 ++ GLIBC_2.17 + GLIBC_PRIVATE + } + libresolv { diff --git a/gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch b/gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch index c37eb0a..b26c5ee 100644 --- a/gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch +++ b/gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch @@ -1,7 +1,7 @@ From 4067112197e4f8f5975c8647cab355e06736177d Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Thu, 27 Mar 2014 00:21:36 +0000 -Subject: [PATCH 1/6] This helps to integrate libpthread as a glibc module. +Subject: [PATCH 1/3] This helps to integrate libpthread as a glibc module. --- configure | 2 ++ @@ -21,36 +21,10 @@ index 0000000..2cdbc71 1.9.0 -From 7f5f718b4a231c1e08d9ed1676cb18e265b715d6 Mon Sep 17 00:00:00 2001 +From 75a043e399e536f4f37fe8ab2178e29d2cd0ca82 Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis -Date: Sat, 29 Mar 2014 23:29:44 +0000 -Subject: [PATCH 2/6] fix - ---- - signal/signal.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/signal/signal.h b/signal/signal.h -index a33d995..6e22d05 100644 ---- a/signal/signal.h -+++ b/signal/signal.h -@@ -26,7 +26,7 @@ - - typedef volatile int sig_atomic_t; - --typedef uint64_t sigset_t; -+/*typedef uint64_t sigset_t;*/ - - int sigaddset (sigset_t *, int); - int sigdelset (sigset_t *, int); --- -1.9.0 - - -From b8639799ae3b571eb44edd2b3dec109957393d3e Mon Sep 17 00:00:00 2001 -From: Manolis Ragkousis -Date: Sun, 30 Mar 2014 16:56:09 +0000 -Subject: [PATCH 3/6] These come from the l4 implementation and come in the way +Date: Tue, 1 Apr 2014 22:49:52 +0000 +Subject: [PATCH 2/3] These come from the l4 implementation and come in the way of the glibc Makefiles, drop them. --- @@ -1286,7 +1260,7 @@ index 40440b7..0000000 -} diff --git a/signal/signal.h b/signal/signal.h deleted file mode 100644 -index 6e22d05..0000000 +index a33d995..0000000 --- a/signal/signal.h +++ /dev/null @@ -1,275 +0,0 @@ @@ -1318,7 +1292,7 @@ index 6e22d05..0000000 - -typedef volatile int sig_atomic_t; - --/*typedef uint64_t sigset_t;*/ +-typedef uint64_t sigset_t; - -int sigaddset (sigset_t *, int); -int sigdelset (sigset_t *, int); @@ -1861,191 +1835,28 @@ index 1b47079..0000000 1.9.0 -From 6eaedb37037965b99608cb8afbfc934c3396892e Mon Sep 17 00:00:00 2001 -From: Manolis Ragkousis -Date: Sun, 30 Mar 2014 17:23:12 +0000 -Subject: [PATCH 4/6] Revert - -commit 69e89a859882e4f675dd5491edc969159d8a4002 -Author: Pino Toscano -Date: Sun Apr 22 00:38:26 2012 +0200 - - __pthread_timedblock: switch to clock_gettime - - Use `clock_gettime' with the provided clock instead of -`gettimeofday', - linking to rt. - - * sysdeps/mach/pt-timedblock.c (__pthread_timedblock): Switch to - `clock_gettime'. - * Makefile [!IN_GLIBC] (LDLIBS): Link to rt. - [IN_GLIBC] ($(objpfx)libpthread.so): Likewise. - * Makefile.am (libpthread_a_LDADD): Likewise. ---- - Makefile | 2 -- - sysdeps/generic/pt-condattr-setclock.c | 28 ++++------------------------ - sysdeps/mach/pt-timedblock.c | 13 +++++++------ - 3 files changed, 11 insertions(+), 32 deletions(-) - -diff --git a/Makefile b/Makefile -index 8ef990e..2f45c1c 100644 ---- a/Makefile -+++ b/Makefile -@@ -216,10 +216,8 @@ VPATH += $(SYSDEP_PATH) - - ifeq ($(IN_GLIBC),no) - HURDLIBS = ihash --LDLIBS = -lrt - else - LDLIBS-pthread.so = -lihash --$(objpfx)libpthread.so: $(common-objpfx)rt/librt.so - endif - - ifeq ($(IN_GLIBC),no) -diff --git a/sysdeps/generic/pt-condattr-setclock.c b/sysdeps/generic/pt-condattr-setclock.c -index c5a78ef..c9a9948 100644 ---- a/sysdeps/generic/pt-condattr-setclock.c -+++ b/sysdeps/generic/pt-condattr-setclock.c -@@ -23,30 +23,10 @@ - int - pthread_condattr_setclock (pthread_condattr_t *attr, clockid_t clock) - { -- /* Only a few clocks are allowed. CLOCK_REALTIME is always allowed. -- CLOCK_MONOTONIC only if the kernel has the necessary support. */ -- if (clock == CLOCK_MONOTONIC) -+ if (__pthread_default_condattr.clock == clock) - { -- /* Check whether the clock is available. */ -- static int avail; -- -- if (avail == 0) -- { -- struct timespec ts; -- int res; -- -- res = clock_getres (CLOCK_MONOTONIC, &ts); -- avail = res < 0 ? -1 : 1; -- } -- -- if (avail < 0) -- /* Not available. */ -- return EINVAL; -+ attr->clock = clock; -+ return 0; - } -- else if (clock != CLOCK_REALTIME) -- return EINVAL; -- -- attr->clock = clock; -- -- return 0; -+ return EINVAL; - } -diff --git a/sysdeps/mach/pt-timedblock.c b/sysdeps/mach/pt-timedblock.c -index d72ef73..88beaa2 100644 ---- a/sysdeps/mach/pt-timedblock.c -+++ b/sysdeps/mach/pt-timedblock.c -@@ -36,26 +36,27 @@ __pthread_timedblock (struct __pthread *thread, - error_t err; - mach_msg_header_t msg; - mach_msg_timeout_t timeout; -- struct timespec now; -+ struct timeval now; - - /* We have an absolute time and now we have to convert it to a - relative time. Arg. */ - -- err = clock_gettime (clock_id, &now); -+ err = gettimeofday(&now, NULL); - assert (! err); - - if (now.tv_sec > abstime->tv_sec - || (now.tv_sec == abstime->tv_sec -- && now.tv_nsec > abstime->tv_nsec)) -+ && now.tv_usec > ((abstime->tv_nsec + 999) / 1000))) - return ETIMEDOUT; - - timeout = (abstime->tv_sec - now.tv_sec) * 1000; - -- if (abstime->tv_nsec >= now.tv_nsec) -- timeout += (abstime->tv_nsec - now.tv_nsec + 999999) / 1000000; -+ if (((abstime->tv_nsec + 999) / 1000) >= now.tv_usec) -+ timeout += (((abstime->tv_nsec + 999) / 1000) - now.tv_usec + 999) / 1000; - else - /* Need to do a carry. */ -- timeout -= (now.tv_nsec - abstime->tv_nsec + 999999) / 1000000; -+ timeout -= (now.tv_usec + 999) / 1000 - -+ ((abstime->tv_nsec + 999999) / 1000000); - - err = __mach_msg (&msg, MACH_RCV_MSG | MACH_RCV_TIMEOUT, 0, - sizeof msg, thread->wakeupmsg.msgh_remote_port, --- -1.9.0 - - -From 3efea8fcd703838e110ca1d98dcda54ac407e4cb Mon Sep 17 00:00:00 2001 -From: Manolis Ragkousis -Date: Sun, 30 Mar 2014 20:47:54 +0000 -Subject: [PATCH 5/6] fix - ---- - sysdeps/mach/hurd/pt-sigstate.c | 12 ++++++++++-- - 1 file changed, 10 insertions(+), 2 deletions(-) - -diff --git a/sysdeps/mach/hurd/pt-sigstate.c b/sysdeps/mach/hurd/pt-sigstate.c -index 68c79c5..d3f4368 100644 ---- a/sysdeps/mach/hurd/pt-sigstate.c -+++ b/sysdeps/mach/hurd/pt-sigstate.c -@@ -21,6 +21,7 @@ - #include - #include - #include -+#include - - #include - -@@ -31,11 +32,12 @@ __pthread_sigstate (struct __pthread *thread, int how, - { - error_t err = 0; - struct hurd_sigstate *ss; -+ sigset_t pending; - - ss = _hurd_thread_sigstate (thread->kernel_thread); - assert (ss); - -- __pthread_spin_lock (&ss->lock); -+ _hurd_sigstate_lock (ss); - - if (oset) - *oset = ss->blocked; -@@ -63,7 +65,13 @@ __pthread_sigstate (struct __pthread *thread, int how, - if (! err && clear_pending) - __sigemptyset (&ss->pending); - -- __pthread_spin_unlock (&ss->lock); -+ pending = _hurd_sigstate_pending (ss) & ~ss->blocked; -+ _hurd_sigstate_unlock (ss); -+ -+ if (! err && pending) -+ /* Send a message to the signal thread so it -+ will wake up and check for pending signals. */ -+ __msg_sig_post (_hurd_msgport, 0, 0, __mach_task_self ()); - - return err; - } --- -1.9.0 - - -From 9b364debeebf32cd97fd619ff77334f089816aa8 Mon Sep 17 00:00:00 2001 +From 822891596a11a55e559aaa5e4d4d1324ad066bdf Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis -Date: Sun, 30 Mar 2014 22:43:07 +0000 -Subject: [PATCH 6/6] Defines missing macro +Date: Tue, 1 Apr 2014 23:28:36 +0000 +Subject: [PATCH 3/3] Defines some missing macros --- + not-in-libc.h | 1 + sysdeps/mach/bits/spin-lock.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + 2 files changed, 2 insertions(+), 1 deletion(-) +diff --git a/not-in-libc.h b/not-in-libc.h +index 516d4d1..7c5f0bc 100644 +--- a/not-in-libc.h ++++ b/not-in-libc.h +@@ -6,6 +6,7 @@ + #define __thread_resume thread_resume + #define __thread_set_state thread_set_state + #define __thread_terminate thread_terminate ++#define __thread_terminate_release thread_terminate_release + #define __vm_allocate vm_allocate + #define __vm_deallocate vm_deallocate + #define __sched_yield sched_yield diff --git a/sysdeps/mach/bits/spin-lock.h b/sysdeps/mach/bits/spin-lock.h index 537dac9..4f2ae4c 100644 --- a/sysdeps/mach/bits/spin-lock.h -- 1.9.0 From d7237b29e8bd066a98ff28601557656f7fd11a11 Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Sat, 5 Apr 2014 18:19:22 +0000 Subject: [PATCH 17/18] Added a patch to bypass the linking problem Now some undefined declarations in libpthread --- gnu-system.am | 2 +- gnu/packages/base.scm | 68 +++-- gnu/packages/cross-base.scm | 116 -------- gnu/packages/gcc.scm | 9 +- gnu/packages/patches/glibc-lock.patch | 58 ++++ .../patches/libpthread-0.3-3b391d-fix.patch | 322 +++++++++++++++++++++ 6 files changed, 431 insertions(+), 144 deletions(-) create mode 100644 gnu/packages/patches/glibc-lock.patch create mode 100644 gnu/packages/patches/libpthread-0.3-3b391d-fix.patch diff --git a/gnu-system.am b/gnu-system.am index c8b637a..bfe5e7d 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -304,7 +304,7 @@ dist_patch_DATA = \ gnu/packages/patches/libtool-skip-tests.patch \ gnu/packages/patches/libtool-skip-tests-for-mips.patch \ gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch\ - gnu/packages/patches/libpthread_hurd_clean.patch \ + gnu/packages/patches/libpthread-0.3-3b391d-fix.patch \ gnu/packages/patches/luit-posix.patch \ gnu/packages/patches/m4-gets-undeclared.patch \ gnu/packages/patches/m4-readlink-EINVAL.patch \ diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 9c4264b..a03e440 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -36,6 +36,8 @@ #:use-module (gnu packages autotools) #:use-module (gnu packages hurd) #:use-module (gnu packages bison) + #:use-module (gnu packages texinfo) + #:use-module (gnu packages gettext) #:use-module (gnu packages linux) #:use-module (guix packages) #:use-module (guix download) @@ -504,8 +506,9 @@ with the Linux kernel.") (sha256 (base32 "0v4hy6yimshbvhbhdbbjdir5fm3xr56zj3lnpf01d4nfa0c1h8k1")) - - )) + (modules '((guix build utils))) + (imported-modules modules) + )) (propagated-inputs `(("gnumach-headers" ,gnumach-headers) ("hurd-headers" ,hurd-headers))) (native-inputs @@ -515,9 +518,12 @@ with the Linux kernel.") ("patch/glibc-pthread" ,(search-patch "glibc-2.17.90-bdb7a1-pthread-posix.patch")) ("patch/libpthread-patch" ,(search-patch "libpthread-0.3-3b391d-glibc-preparation.patch")) ("patch/glibc-lock-patch" ,(search-patch "glibc-lock.patch")) + ("patch/libpthread-fix-patch" ,(search-patch "libpthread-0.3-3b391d-fix.patch")) ("mig" ,mig) ("perl" ,perl) - ("bison" ,bison) + ;;("bison" ,bison) + ("texinfo",texinfo) + ("gettext" ,gnu-gettext) ("autoconf" ,(autoconf-wrapper autoconf-2.68)) ("automake" ,automake) ("libtool" ,libtool) @@ -535,13 +541,15 @@ with the Linux kernel.") (arguments `(#:out-of-source? #t #:configure-flags - (list ;;"LDFLAGS=-DEBUG" + (list ;;"LD_DEBUG=all" + ;;"CFLAGS=-02" + ;;"LDFLAGS=libs" "--without-cvs" - "--enable-add-ons" + "--enable-add-ons=libidn,libpthread" "--host=i686-pc-gnu" ;;"--build=i686-pc-gnu" ;;"--target=i686-pc-gnu" - ;;"--sysconfdir=/etc" + "--sysconfdir=/etc" "--disable-profile" "--disable-multi-arch" "--disable-sanity-checks" @@ -558,22 +566,17 @@ with the Linux kernel.") "/bin/bash")) #:phases (alist-cons-after - 'autoconf 'apply-patch + 'unpack 'apply-patch (lambda _ (zero? (system* "patch" "-p1" "-i" (assoc-ref %build-inputs "patch/glibc-make"))) (zero? (system* "patch" "-p1" "-i" (assoc-ref %build-inputs "patch/glibc-create-gnumach"))) (zero? (system* "patch" "-p1" "-i" (assoc-ref %build-inputs "patch/glibc-pthread"))) - ;;(zero? (system* "patch" "-p1" "-i" (assoc-ref %build-inputs "patch/glibc-lock-patch"))) + (zero? (system* "patch" "-p1" "-i" (assoc-ref %build-inputs "patch/glibc-lock-patch"))) (chdir "libpthread") + (zero? (system* "patch" "-p1" "-i" (assoc-ref %build-inputs "patch/libpthread-fix-patch"))) (zero? (system* "patch" "-p1" "-i" (assoc-ref %build-inputs "patch/libpthread-patch"))) (chdir "..") ) - (alist-cons-before - 'pre-configure 'autoconf - (lambda _ - (chmod "configure" #o777) - ;;(system* "autoreconf" "-vif") - ) (alist-cons-before 'configure 'pre-configure (lambda* (#:key inputs outputs #:allow-other-keys) @@ -592,15 +595,18 @@ with the Linux kernel.") (remove-store-references (string-append bin "/bash")) (chmod (string-append bin "/bash") #o555) + ;; (substitute* "Makeconfig" + ;; ((" -lgcc_s") "")) + ;; Keep a symlink, for `patch-shebang' resolution. - (with-directory-excursion bin - (symlink "bash" "sh")) + ;; (with-directory-excursion bin + ;; (symlink "bash" "sh")) - ;; Have `system' use that Bash. - (substitute* "sysdeps/posix/system.c" - (("#define[[:blank:]]+SHELL_PATH.*$") - (format #f "#define SHELL_PATH \"~a/bin/bash\"\n" - out))) + ;; ;; Have `system' use that Bash. + ;; (substitute* "sysdeps/posix/system.c" + ;; (("#define[[:blank:]]+SHELL_PATH.*$") + ;; (format #f "#define SHELL_PATH \"~a/bin/bash\"\n" + ;; out))) ;; Same for `popen'. (substitute* "libio/iopopen.c" @@ -618,11 +624,25 @@ with the Linux kernel.") (mkdir "source") (chdir "source") (copy-recursively source ".") + (copy-recursively (assoc-ref inputs "libpthread") "libpthread") - (chmod "bits/pthreadtypes.h" #o777) - (copy-recursively "libpthread/sysdeps/generic/bits" "bits") + ;;(chmod "bits/pthreadtypes.h" #o777) + (copy-file "libpthread/sysdeps/generic/bits/pthread.h" "bits/pthread.h") + (copy-file "libpthread/sysdeps/generic/bits/thread-attr.h" "bits/thread-attr.h") + (copy-file "libpthread/sysdeps/generic/bits/mutex-attr.h" "bits/mutex-attr.h") + (copy-file "libpthread/sysdeps/generic/bits/thread-specific.h" "bits/thread-specific.h") + (copy-file "libpthread/sysdeps/generic/bits/mutex.h" "bits/mutex.h") + (copy-file "libpthread/sysdeps/generic/bits/condition-attr.h" "bits/condition-attr.h") + (copy-file "libpthread/sysdeps/generic/bits/condition.h" "bits/condition.h") + (copy-file "libpthread/sysdeps/generic/bits/rwlock-attr.h" "bits/rwlock-attr.h") + (copy-file "libpthread/sysdeps/generic/bits/rwlock.h" "bits/rwlock.h") + (copy-file "libpthread/sysdeps/generic/bits/barrier-attr.h" "bits/barrier-attr.h") + (copy-file "libpthread/sysdeps/generic/bits/barrier.h" "bits/barrier.h") + (copy-file "libpthread/sysdeps/generic/bits/once.h" "bits/once.h") + (copy-file "libpthread/sysdeps/generic/bits/cancelation.h" "bits/cancelation.h") + (copy-file "libpthread/sysdeps/generic/bits/pthread-np.h" "bits/pthread-np.h") #t) - %standard-phases))))))) )) + %standard-phases))))))) ) (define-public tzdata (package diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 8053599..22152ef 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -261,119 +261,6 @@ XBINUTILS and the cross tool chain." ("cross-binutils" ,xbinutils) ,@(package-native-inputs glibc))))) -;; (define* (cross-gcc/hurd target -;; #:optional (xbinutils (cross-binutils target)) libc) -;; "Return a cross-compiler for TARGET, where TARGET is a GNU triplet. Use -;; XBINUTILS as the associated cross-Binutils. If LIBC is false, then build a -;; GCC that does not target a libc; otherwise, target that libc." -;; (package (inherit gcc-4.8) -;; (name (string-append "gcc-cross-hurd-" -;; (if libc "" "sans-libc-") -;; target)) -;; (source (origin (inherit (package-source gcc-4.8)) -;; (patches -;; (list (search-patch "gcc-cross-environment-variables.patch"))))) -;; (arguments -;; `(#:implicit-inputs? #f -;; #:modules ((guix build gnu-build-system) -;; (guix build utils) -;; (ice-9 regex) -;; (srfi srfi-1) -;; (srfi srfi-26)) - -;; ,@(substitute-keyword-arguments (package-arguments gcc-4.8) -;; ((#:configure-flags flags) -;; `(append (list ,(string-append "--target=" target) -;; ,@(gcc-configure-flags-for-triplet target) -;; ,@(if libc -;; '() -;; `( -;; ;; Disable features not needed at this stage. -;; "--disable-shared" "--enable-static" -;; "--without-headers" -;; ;; Disable C++ because libstdc++'s -;; ;; configure script otherwise fails with -;; ;; "Link tests are not allowed after -;; ;; GCC_NO_EXECUTABLES." -;; "--enable-languages=c" - -;; ;; Disabling things according to other hurd building -;; ;; scripts I saw, I will explain everything with my final patch - -;; "--disable-threads" ; libgcc, would need libc -;; "--disable-libatomic" -;; "--disable-libmudflap" -;; "--disable-libgomp" -;; "--disable-libssp" -;; "--disable-libquadmath" -;; "--disable-decimal-float" ; would need libc -;; ;;"--with-arch=i686" -;; ))) - -;; ,(if libc -;; flags -;; `(remove (cut string-match "--enable-languages.*" <>) -;; ,flags)))) -;; ((#:make-flags flags) -;; (if libc -;; `(let ((libc (assoc-ref %build-inputs "libc"))) -;; ;; FLAGS_FOR_TARGET are needed for the target libraries to -;; ;; receive the -Bxxx for the startfiles. -;; (cons (string-append "FLAGS_FOR_TARGET=-B" libc "/lib") -;; ,flags)) -;; flags)) -;; ((#:phases phases) -;; (let ((phases -;; `(alist-cons-after -;; 'install 'make-cross-binutils-visible -;; (lambda* (#:key outputs inputs #:allow-other-keys) -;; (let* ((out (assoc-ref outputs "out")) -;; (libexec (string-append out "/libexec/gcc/" -;; ,target)) -;; (binutils (string-append -;; (assoc-ref inputs "binutils-cross") -;; "/bin/" ,target "-"))) -;; (for-each (lambda (file) -;; (symlink (string-append binutils file) -;; (string-append libexec "/" -;; file))) -;; '("as" "ld" "nm")) -;; #t)) -;; ,phases)))phases));;) -;; ((#:strip-binaries? _) -;; ;; Disable stripping as this can break binaries, with object files -;; ;; of libgcc.a showing up as having an unknown architecture. See -;; ;; -;; ;; for instance. -;; #f)))) - -;; (native-inputs -;; `(("binutils-cross" ,xbinutils) - -;; ;; Call it differently so that the builder can check whether the "libc" -;; ;; input is #f. -;; ("libc-native" ,@(assoc-ref %final-inputs "libc")) - -;; ;; Remaining inputs. -;; ,@(let ((inputs (append (package-inputs gcc-4.8) -;; (alist-delete "libc" %final-inputs)))) -;; (if libc -;; `(("libc" ,libc) -;; ,@inputs) -;; inputs)))) - -;; (inputs '()) - -;; ;; Only search target inputs, not host inputs. -;; (search-paths -;; (list (search-path-specification -;; (variable "CROSS_CPATH") -;; (directories '("include"))) -;; (search-path-specification -;; (variable "CROSS_LIBRARY_PATH") -;; (directories '("lib" "lib64"))))) -;; (native-search-paths '()))) - (define* (cross-mig target #:optional (xgcc-i686-pc-gnu (cross-gcc target)) @@ -479,9 +366,6 @@ XBINUTILS and the cross tool chain." (substitute-keyword-arguments `(#:strip-binaries? #f ; disable stripping (see above) ,@(package-arguments glibc/hurd)) - ;; ((#:configure-flags flags) - ;; `(cons ,(string-append "--target=" target) - ;; ,flags)) ((#:phases phases) `(alist-cons-before 'pre-configure 'set-cross-hurd-headers-path diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm index a422edf..fca6c39 100644 --- a/gnu/packages/gcc.scm +++ b/gnu/packages/gcc.scm @@ -46,9 +46,12 @@ where the OS part is overloaded to denote a specific ABI---into GCC ;; ports/sysdeps/mips/preconfigure. '("--with-abi=64")) ((string-match "i686-pc-gnu" target) - ;; Triplets recognized by glibc as denoting the N64 ABI; see - ;; ports/sysdeps/mips/preconfigure. - '("--with-arch=i686")) + '("--with-arch=i686" + "--disable-nls" + "--disable-shared" + "--without-headers" + "--enable-build-with-cxx" + )) (else ;; TODO: Add `armel.*gnueabi', `hf', etc. '()))) diff --git a/gnu/packages/patches/glibc-lock.patch b/gnu/packages/patches/glibc-lock.patch new file mode 100644 index 0000000..af9f7a6 --- /dev/null +++ b/gnu/packages/patches/glibc-lock.patch @@ -0,0 +1,58 @@ +From 82f3b6517f923653a33fccd3df6b8d01d7f6a12f Mon Sep 17 00:00:00 2001 +From: Manolis Ragkousis +Date: Wed, 2 Apr 2014 02:07:24 +0000 +Subject: [PATCH 1/2] fix + +--- + signal/sigsetops.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/signal/sigsetops.c b/signal/sigsetops.c +index 0317662..77bd1dc 100644 +--- a/signal/sigsetops.c ++++ b/signal/sigsetops.c +@@ -3,7 +3,6 @@ + + #include + +-#define _EXTERN_INLINE + #ifndef __USE_EXTERN_INLINES + # define __USE_EXTERN_INLINES 1 + #endif +-- +1.9.0 + + +From 207d830da0a741e3b29abcb068e718b379b987a5 Mon Sep 17 00:00:00 2001 +From: Manolis Ragkousis +Date: Sat, 5 Apr 2014 17:45:49 +0000 +Subject: [PATCH 2/2] Add link rules to sort hooks + + otherwise they are not properly recorded +--- + Makerules | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/Makerules b/Makerules +index fe967ad..bf263c6 100644 +--- a/Makerules ++++ b/Makerules +@@ -521,6 +521,15 @@ $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules + PROVIDE(__start__hurd_fork_locks = .);\ + _hurd_fork_locks : { *(_hurd_fork_locks) }\ + PROVIDE(__stop__hurd_fork_locks = .);\ ++ PROVIDE(__start__hurd_atfork_prepare_hook = .);\ ++ _hurd_atfork_prepare_hook : { *(_hurd_atfork_prepare_hook) }\ ++ PROVIDE(__stop__hurd_atfork_prepare_hook = .);\ ++ PROVIDE(__start__hurd_atfork_child_hook = .);\ ++ _hurd_atfork_child_hook : { *(_hurd_atfork_child_hook) }\ ++ PROVIDE(__stop__hurd_atfork_child_hook = .);\ ++ PROVIDE(__start__hurd_atfork_parent_hook = .);\ ++ _hurd_atfork_parent_hook : { *(_hurd_atfork_parent_hook) }\ ++ PROVIDE(__stop__hurd_atfork_parent_hook = .);\ + PROVIDE(__start___pthread_init = .);\ + __pthread_init : { *(__pthread_init) }\ + PROVIDE(__stop___pthread_init = .);\ +-- +1.9.0 + diff --git a/gnu/packages/patches/libpthread-0.3-3b391d-fix.patch b/gnu/packages/patches/libpthread-0.3-3b391d-fix.patch new file mode 100644 index 0000000..0bdd21f --- /dev/null +++ b/gnu/packages/patches/libpthread-0.3-3b391d-fix.patch @@ -0,0 +1,322 @@ +From 15514fbbb60b890e9d9f76d9fcaac42e6a8308be Mon Sep 17 00:00:00 2001 +From: Manolis Ragkousis +Date: Wed, 2 Apr 2014 03:04:33 +0000 +Subject: [PATCH 1/3] New Makefile.am + +--- + Makefile.am | 170 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 170 insertions(+) + create mode 100644 Makefile.am + +diff --git a/Makefile.am b/Makefile.am +new file mode 100644 +index 0000000..36ede54 +--- /dev/null ++++ b/Makefile.am +@@ -0,0 +1,170 @@ ++# Makefile.am - Makefile template for libpthread. ++# Copyright (C) 2003, 2008 Free Software Foundation, Inc. ++# ++# This file is part of the GNU Hurd. ++# ++# The GNU Hurd is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# The GNU Hurd is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA ++ ++if ARCH_IA32 ++ arch=ia32 ++endif ++if ARCH_POWERPC ++ arch=powerpc ++endif ++ ++# The source files are scattered over several directories. Add ++# all these directories to the vpath. ++SYSDEP_PATH = $(srcdir)/sysdeps/l4/hurd/${arch} \ ++ $(srcdir)/sysdeps/l4/${arch} \ ++ $(srcdir)/sysdeps/${arch} \ ++ $(srcdir)/sysdeps/l4/hurd \ ++ $(srcdir)/sysdeps/l4 \ ++ $(srcdir)/sysdeps/hurd \ ++ $(srcdir)/sysdeps/generic \ ++ $(srcdir)/sysdeps/posix \ ++ $(srcdir)/pthread \ ++ $(srcdir)/signal \ ++ $(srcdir)/include ++vpath %.c $(SYSDEP_PATH) ++ ++AM_CPPFLAGS = $(USER_CPPFLAGS) -I$(srcdir)/pthread \ ++ $(addprefix -I, $(SYSDEP_PATH)) -imacros $(srcdir)/include/libc-symbols.h ++AM_CFLAGS = $(USER_CFLAGS) ++ ++# Sources. ++SYSDEPS := lockfile.c ++ ++if ! ENABLE_TESTS ++noinst_LIBRARIES = libpthread.a ++endif ++ ++libpthread_a_SOURCES = pt-attr.c pt-attr-destroy.c pt-attr-getdetachstate.c \ ++ pt-attr-getguardsize.c pt-attr-getinheritsched.c \ ++ pt-attr-getschedparam.c pt-attr-getschedpolicy.c pt-attr-getscope.c \ ++ pt-attr-getstack.c pt-attr-getstackaddr.c pt-attr-getstacksize.c \ ++ pt-attr-init.c pt-attr-setdetachstate.c pt-attr-setguardsize.c \ ++ pt-attr-setinheritsched.c pt-attr-setschedparam.c \ ++ pt-attr-setschedpolicy.c pt-attr-setscope.c pt-attr-setstack.c \ ++ pt-attr-setstackaddr.c pt-attr-setstacksize.c pt-attr.c \ ++ pt-barrier-destroy.c pt-barrier-init.c pt-barrier-wait.c \ ++ pt-barrier.c pt-barrierattr-destroy.c pt-barrierattr-init.c \ ++ pt-barrierattr-getpshared.c pt-barrierattr-setpshared.c \ ++ pt-destroy-specific.c pt-init-specific.c \ ++ pt-key-create.c pt-key-delete.c \ ++ pt-getspecific.c pt-setspecific.c \ ++ pt-once.c \ ++ pt-alloc.c \ ++ pt-create.c \ ++ pt-getattr.c \ ++ pt-pool-np.c \ ++ pt-equal.c \ ++ pt-dealloc.c \ ++ pt-detach.c \ ++ pt-exit.c \ ++ pt-initialize.c \ ++ pt-join.c \ ++ pt-self.c \ ++ pt-sigmask.c \ ++ pt-spin-inlines.c \ ++ pt-cleanup.c \ ++ pt-setcancelstate.c \ ++ pt-setcanceltype.c \ ++ pt-testcancel.c \ ++ pt-cancel.c \ ++ pt-mutexattr.c \ ++ pt-mutexattr-destroy.c pt-mutexattr-init.c \ ++ pt-mutexattr-getprioceiling.c pt-mutexattr-getprotocol.c \ ++ pt-mutexattr-getpshared.c pt-mutexattr-gettype.c \ ++ pt-mutexattr-setprioceiling.c pt-mutexattr-setprotocol.c \ ++ pt-mutexattr-setpshared.c pt-mutexattr-settype.c \ ++ pt-mutex-init.c pt-mutex-destroy.c \ ++ pt-mutex-lock.c pt-mutex-trylock.c pt-mutex-timedlock.c \ ++ pt-mutex-unlock.c \ ++ pt-mutex-transfer-np.c \ ++ pt-mutex-getprioceiling.c pt-mutex-setprioceiling.c \ ++ pt-rwlock-attr.c \ ++ pt-rwlockattr-init.c pt-rwlockattr-destroy.c \ ++ pt-rwlockattr-getpshared.c pt-rwlockattr-setpshared.c \ ++ pt-rwlock-init.c pt-rwlock-destroy.c \ ++ pt-rwlock-rdlock.c pt-rwlock-tryrdlock.c \ ++ pt-rwlock-trywrlock.c pt-rwlock-wrlock.c \ ++ pt-rwlock-timedrdlock.c pt-rwlock-timedwrlock.c \ ++ pt-rwlock-unlock.c \ ++ pt-cond.c \ ++ pt-condattr-init.c pt-condattr-destroy.c \ ++ pt-condattr-getclock.c pt-condattr-getpshared.c \ ++ pt-condattr-setclock.c pt-condattr-setpshared.c \ ++ pt-cond-destroy.c pt-cond-init.c \ ++ pt-cond-brdcast.c \ ++ pt-cond-signal.c \ ++ pt-cond-wait.c \ ++ pt-cond-timedwait.c \ ++ pt-stack-alloc.c \ ++ pt-thread-alloc.c \ ++ pt-thread-dealloc.c \ ++ pt-thread-start.c \ ++ pt-thread-halt.c \ ++ pt-startup.c \ ++ pt-getconcurrency.c pt-setconcurrency.c \ ++ pt-block.c \ ++ pt-timedblock.c \ ++ pt-wakeup.c \ ++ pt-docancel.c \ ++ pt-sysdep.c \ ++ pt-setup.c \ ++ pt-machdep.c \ ++ pt-spin.c \ ++ pt-sigstate-init.c \ ++ pt-sigstate-destroy.c \ ++ pt-sigstate.c \ ++ pt-atfork.c \ ++ pt-kill.c \ ++ pt-getcpuclockid.c \ ++ pt-getschedparam.c pt-setschedparam.c pt-setschedprio.c \ ++ pt-yield.c \ ++ sem-close.c sem-init.c sem-timedwait.c sem-wait.c \ ++ sem-destroy.c sem-open.c sem-trywait.c sem-getvalue.c \ ++ sem-post.c sem-unlink.c \ ++ \ ++ pt-setactivity-np.c \ ++ \ ++ kill.c \ ++ killpg.c \ ++ pt-kill-siginfo-np.c \ ++ raise.c \ ++ sigaction.c \ ++ sigaddset.c \ ++ sigaltstack.c \ ++ sigdelset.c \ ++ sigemptyset.c \ ++ sigfillset.c \ ++ sig-internal.c \ ++ sig-internal.h \ ++ siginterrupt.c \ ++ sigismember.c \ ++ signal.c \ ++ signal-dispatch.c \ ++ signal.h \ ++ sigpending.c \ ++ sigprocmask.c \ ++ sigsuspend.c \ ++ sigtimedwait.c \ ++ sigwait.c \ ++ sigwaiter.c \ ++ sigwaitinfo.c \ ++ signal-dispatch-lowlevel.c \ ++ sigprocmask.c ++ ++libpthread_a_LDADD = -lrt +-- +1.9.0 + + +From f6397bdc194fea8bdff4e34c94fe2802c6de543e Mon Sep 17 00:00:00 2001 +From: Manolis Ragkousis +Date: Wed, 2 Apr 2014 03:05:01 +0000 +Subject: [PATCH 2/3] Revert "pthread_condattr_setclock: allow a monotonic + clock, if present" + +This reverts commit 581b822ea36002817f4c22b9ea715b72a0647166. +--- + sysdeps/generic/pt-condattr-setclock.c | 27 ++++----------------------- + 1 file changed, 4 insertions(+), 23 deletions(-) + +diff --git a/sysdeps/generic/pt-condattr-setclock.c b/sysdeps/generic/pt-condattr-setclock.c +index c5a78ef..984c17e 100644 +--- a/sysdeps/generic/pt-condattr-setclock.c ++++ b/sysdeps/generic/pt-condattr-setclock.c +@@ -23,30 +23,11 @@ + int + pthread_condattr_setclock (pthread_condattr_t *attr, clockid_t clock) + { +- /* Only a few clocks are allowed. CLOCK_REALTIME is always allowed. +- CLOCK_MONOTONIC only if the kernel has the necessary support. */ +- if (clock == CLOCK_MONOTONIC) ++ if (__pthread_default_condattr.clock == clock) + { +- /* Check whether the clock is available. */ +- static int avail; +- +- if (avail == 0) +- { +- struct timespec ts; +- int res; +- +- res = clock_getres (CLOCK_MONOTONIC, &ts); +- avail = res < 0 ? -1 : 1; +- } +- +- if (avail < 0) +- /* Not available. */ +- return EINVAL; ++ attr->clock = clock; ++ return 0; + } +- else if (clock != CLOCK_REALTIME) +- return EINVAL; +- +- attr->clock = clock; + +- return 0; ++ return EINVAL; + } +-- +1.9.0 + + +From 1feb6969662f7500dc0f1cea16f4552825842ca5 Mon Sep 17 00:00:00 2001 +From: Manolis Ragkousis +Date: Wed, 2 Apr 2014 03:05:01 +0000 +Subject: [PATCH 3/3] Revert "__pthread_timedblock: switch to clock_gettime" + +This reverts commit 69e89a859882e4f675dd5491edc969159d8a4002. +--- + Makefile | 2 -- + Makefile.am | 2 -- + sysdeps/mach/pt-timedblock.c | 13 +++++++------ + 3 files changed, 7 insertions(+), 10 deletions(-) + +diff --git a/Makefile b/Makefile +index 8ef990e..2f45c1c 100644 +--- a/Makefile ++++ b/Makefile +@@ -216,10 +216,8 @@ VPATH += $(SYSDEP_PATH) + + ifeq ($(IN_GLIBC),no) + HURDLIBS = ihash +-LDLIBS = -lrt + else + LDLIBS-pthread.so = -lihash +-$(objpfx)libpthread.so: $(common-objpfx)rt/librt.so + endif + + ifeq ($(IN_GLIBC),no) +diff --git a/Makefile.am b/Makefile.am +index 36ede54..e1c062c 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -166,5 +166,3 @@ libpthread_a_SOURCES = pt-attr.c pt-attr-destroy.c pt-attr-getdetachstate.c \ + sigwaitinfo.c \ + signal-dispatch-lowlevel.c \ + sigprocmask.c +- +-libpthread_a_LDADD = -lrt +diff --git a/sysdeps/mach/pt-timedblock.c b/sysdeps/mach/pt-timedblock.c +index d72ef73..88beaa2 100644 +--- a/sysdeps/mach/pt-timedblock.c ++++ b/sysdeps/mach/pt-timedblock.c +@@ -36,26 +36,27 @@ __pthread_timedblock (struct __pthread *thread, + error_t err; + mach_msg_header_t msg; + mach_msg_timeout_t timeout; +- struct timespec now; ++ struct timeval now; + + /* We have an absolute time and now we have to convert it to a + relative time. Arg. */ + +- err = clock_gettime (clock_id, &now); ++ err = gettimeofday(&now, NULL); + assert (! err); + + if (now.tv_sec > abstime->tv_sec + || (now.tv_sec == abstime->tv_sec +- && now.tv_nsec > abstime->tv_nsec)) ++ && now.tv_usec > ((abstime->tv_nsec + 999) / 1000))) + return ETIMEDOUT; + + timeout = (abstime->tv_sec - now.tv_sec) * 1000; + +- if (abstime->tv_nsec >= now.tv_nsec) +- timeout += (abstime->tv_nsec - now.tv_nsec + 999999) / 1000000; ++ if (((abstime->tv_nsec + 999) / 1000) >= now.tv_usec) ++ timeout += (((abstime->tv_nsec + 999) / 1000) - now.tv_usec + 999) / 1000; + else + /* Need to do a carry. */ +- timeout -= (now.tv_nsec - abstime->tv_nsec + 999999) / 1000000; ++ timeout -= (now.tv_usec + 999) / 1000 - ++ ((abstime->tv_nsec + 999999) / 1000000); + + err = __mach_msg (&msg, MACH_RCV_MSG | MACH_RCV_TIMEOUT, 0, + sizeof msg, thread->wakeupmsg.msgh_remote_port, +-- +1.9.0 + -- 1.9.0 From 269316a79792adc7761703e9eae3077bf630c501 Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Wed, 9 Apr 2014 11:26:51 +0000 Subject: [PATCH 18/18] Everything okay, fails with lihash not found --- gnu-system.am | 3 -- gnu/packages/base.scm | 19 ++++-------- gnu/packages/cross-base.scm | 5 ++-- .../libpthread-0.3-3b391d-glibc-preparation.patch | 34 ++++++++++++++++++++-- 4 files changed, 40 insertions(+), 21 deletions(-) diff --git a/gnu-system.am b/gnu-system.am index bfe5e7d..74f809e 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -278,9 +278,7 @@ dist_patch_DATA = \ gnu/packages/patches/glibc-bootstrap-system.patch \ gnu/packages/patches/glibc-ldd-x86_64.patch \ gnu/packages/patches/glibc-make-4.0.patch \ - gnu/packages/patches/glibc-2.17.90-bdb7a1-create-gnumach-header.patch\ gnu/packages/patches/glibc-2.17.90-bdb7a1-pthread-posix.patch \ - gnu/packages/patches/glibc-lock.patch \ gnu/packages/patches/gnunet-fix-scheduler.patch \ gnu/packages/patches/gnunet-fix-tests.patch \ gnu/packages/patches/gobject-introspection-cc.patch \ @@ -304,7 +302,6 @@ dist_patch_DATA = \ gnu/packages/patches/libtool-skip-tests.patch \ gnu/packages/patches/libtool-skip-tests-for-mips.patch \ gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch\ - gnu/packages/patches/libpthread-0.3-3b391d-fix.patch \ gnu/packages/patches/luit-posix.patch \ gnu/packages/patches/m4-gets-undeclared.patch \ gnu/packages/patches/m4-readlink-EINVAL.patch \ diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index a03e440..e2e42f2 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -514,11 +514,9 @@ with the Linux kernel.") (native-inputs `( ("patch/glibc-make" ,(search-patch "glibc-make-4.0.patch")) - ("patch/glibc-create-gnumach" ,(search-patch "glibc-2.17.90-bdb7a1-create-gnumach-header.patch")) ("patch/glibc-pthread" ,(search-patch "glibc-2.17.90-bdb7a1-pthread-posix.patch")) ("patch/libpthread-patch" ,(search-patch "libpthread-0.3-3b391d-glibc-preparation.patch")) - ("patch/glibc-lock-patch" ,(search-patch "glibc-lock.patch")) - ("patch/libpthread-fix-patch" ,(search-patch "libpthread-0.3-3b391d-fix.patch")) + ;;("patch/libpthread-fix-patch" ,(search-patch "libpthread-0.3-3b391d-fix.patch")) ("mig" ,mig) ("perl" ,perl) ;;("bison" ,bison) @@ -532,19 +530,16 @@ with the Linux kernel.") (method git-fetch) (uri (git-reference (url "git://git.sv.gnu.org/hurd/libpthread") - (commit "3b391db91f70b2166951413ee1eccc78cd398a44"))) + (commit "e2ae1c43d168fc6f8b34332cbb0656e5d107cbf3"))) (sha256 (base32 - "0bb8m0pk7b53sww4ahjds77bvqy0alz54g3aylzwncfca52gacqp")) + "0h4k81bkygswcm8s4nwbq9p3gyy3v11syd70vdi5h0sj0jr93y55")) (file-name "libpthread" ))))) (arguments `(#:out-of-source? #t #:configure-flags - (list ;;"LD_DEBUG=all" - ;;"CFLAGS=-02" - ;;"LDFLAGS=libs" - "--without-cvs" + (list "--without-cvs" "--enable-add-ons=libidn,libpthread" "--host=i686-pc-gnu" ;;"--build=i686-pc-gnu" @@ -569,11 +564,8 @@ with the Linux kernel.") 'unpack 'apply-patch (lambda _ (zero? (system* "patch" "-p1" "-i" (assoc-ref %build-inputs "patch/glibc-make"))) - (zero? (system* "patch" "-p1" "-i" (assoc-ref %build-inputs "patch/glibc-create-gnumach"))) (zero? (system* "patch" "-p1" "-i" (assoc-ref %build-inputs "patch/glibc-pthread"))) - (zero? (system* "patch" "-p1" "-i" (assoc-ref %build-inputs "patch/glibc-lock-patch"))) (chdir "libpthread") - (zero? (system* "patch" "-p1" "-i" (assoc-ref %build-inputs "patch/libpthread-fix-patch"))) (zero? (system* "patch" "-p1" "-i" (assoc-ref %build-inputs "patch/libpthread-patch"))) (chdir "..") ) @@ -610,7 +602,7 @@ with the Linux kernel.") ;; Same for `popen'. (substitute* "libio/iopopen.c" - (("/bin/sh") + (("/bin/sh") (string-append out "/bin/bash"))))) (alist-cons-after 'install 'install-locales @@ -644,6 +636,7 @@ with the Linux kernel.") #t) %standard-phases))))))) ) + (define-public tzdata (package (name "tzdata") diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 22152ef..ef17eb5 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -371,7 +371,8 @@ XBINUTILS and the cross tool chain." 'pre-configure 'set-cross-hurd-headers-path (lambda* (#:key inputs #:allow-other-keys) (let ((mach (assoc-ref inputs "cross-gnumach-headers")) - (hurd (assoc-ref inputs "cross-hurd-headers"))) + (hurd (assoc-ref inputs "cross-hurd-headers")) + ) (setenv "CROSS_CPATH" (string-append mach "/include:" hurd "/include")) @@ -381,7 +382,7 @@ XBINUTILS and the cross tool chain." (propagated-inputs `(("cross-gnumach-headers" ,xgnumach-headers) ("cross-hurd-headers" ,xhurd-headers) - ("cross--minimal" ,xhurd-minimal))) + ("cross-hurd-minimal" ,xhurd-minimal) )) (native-inputs `(("cross-gcc" ,xgcc-i686-pc-gnu) ("cross-binutils" ,xbinutils) diff --git a/gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch b/gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch index b26c5ee..cb748e8 100644 --- a/gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch +++ b/gnu/packages/patches/libpthread-0.3-3b391d-glibc-preparation.patch @@ -1,7 +1,7 @@ From 4067112197e4f8f5975c8647cab355e06736177d Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Thu, 27 Mar 2014 00:21:36 +0000 -Subject: [PATCH 1/3] This helps to integrate libpthread as a glibc module. +Subject: [PATCH 1/4] This helps to integrate libpthread as a glibc module. --- configure | 2 ++ @@ -24,7 +24,7 @@ index 0000000..2cdbc71 From 75a043e399e536f4f37fe8ab2178e29d2cd0ca82 Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Tue, 1 Apr 2014 22:49:52 +0000 -Subject: [PATCH 2/3] These come from the l4 implementation and come in the way +Subject: [PATCH 2/4] These come from the l4 implementation and come in the way of the glibc Makefiles, drop them. --- @@ -1838,7 +1838,7 @@ index 1b47079..0000000 From 822891596a11a55e559aaa5e4d4d1324ad066bdf Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Tue, 1 Apr 2014 23:28:36 +0000 -Subject: [PATCH 3/3] Defines some missing macros +Subject: [PATCH 3/4] Defines some missing macros --- not-in-libc.h | 1 + @@ -1873,3 +1873,31 @@ index 537dac9..4f2ae4c 100644 -- 1.9.0 + +From 29cfd394c551ebf206ce02355fa8069c0d8d38ff Mon Sep 17 00:00:00 2001 +From: Manolis Ragkousis +Date: Wed, 9 Apr 2014 01:55:37 +0000 +Subject: [PATCH 4/4] Fixed libihash + +--- + Makefile | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/Makefile b/Makefile +index 8ef990e..2f45c1c 100644 +--- a/Makefile ++++ b/Makefile +@@ -216,10 +216,8 @@ VPATH += $(SYSDEP_PATH) + + ifeq ($(IN_GLIBC),no) + HURDLIBS = ihash +-LDLIBS = -lrt + else + LDLIBS-pthread.so = -lihash +-$(objpfx)libpthread.so: $(common-objpfx)rt/librt.so + endif + + ifeq ($(IN_GLIBC),no) +-- +1.9.0 + -- 1.9.0