"Tom G. Christensen" <t...@jupiterrise.com> writes: > It fails to build on IRIX 5.3 due to missing siginterrupt function: > ld: ERROR 33: Unresolved text symbol "siginterrupt" -- 1st referenced by > tests.o. > > Since gnulib does not provide a siginterrupt replacement I instead added > the replacement used by bash 4.0 to tests.c:
Thanks for the report, I believe this should be fixed in gnulib. I propose to add this new module. Objections? I'll push it shortly otherwise. /Simon >From a8e36ca9cb9539b2ba7a52837d9aa29e1a41cd5c Mon Sep 17 00:00:00 2001 From: Simon Josefsson <si...@josefsson.org> Date: Mon, 17 Aug 2009 16:32:16 +0200 Subject: [PATCH] siginterrupt: Add new module. Missing on IRIX 5.3 reported by "Tom G. Christensen" <t...@jupiterrise.com> in <http://permalink.gmane.org/gmane.comp.encryption.gpg.gnutls.devel/3782>. --- ChangeLog | 10 +++++++++ doc/posix-functions/siginterrupt.texi | 8 +++--- lib/siginterrupt.c | 36 +++++++++++++++++++++++++++++++++ lib/signal.in.h | 3 ++ m4/siginterrupt.m4 | 23 +++++++++++++++++++++ m4/signal_h.m4 | 2 + modules/siginterrupt | 24 ++++++++++++++++++++++ modules/signal | 2 + 8 files changed, 104 insertions(+), 4 deletions(-) create mode 100644 lib/siginterrupt.c create mode 100644 m4/siginterrupt.m4 create mode 100644 modules/siginterrupt diff --git a/ChangeLog b/ChangeLog index da55331..d1d1c0a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2009-08-17 Simon Josefsson <si...@josefsson.org> + + * modules/siginterrupt: New module. + * m4/siginterrupt.m4: New file. + * lib/siginterrupt.c: New file. + * lib/signal.in.h: Provide prototype for siginterrupt when needed. + * m4/signal_h.m4: Add defaults for siginterrupt. + * modules/signal: Substitute siginterrupt variables. + * doc/posix-functions/siginterrupt.texi: Mention new module. + 2009-08-16 Bruno Haible <br...@clisp.org> Fix test failures on Solaris 10. diff --git a/doc/posix-functions/siginterrupt.texi b/doc/posix-functions/siginterrupt.texi index cd021a3..afd660e 100644 --- a/doc/posix-functions/siginterrupt.texi +++ b/doc/posix-functions/siginterrupt.texi @@ -4,17 +4,17 @@ POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/siginterrupt.html} -Gnulib module: --- +Gnulib module: siginterrupt Portability problems fixed by Gnulib: @itemize +...@item +This function is missing on some platforms: +IRIX 5.3, Solaris 2.5.1, mingw, Interix 3.5, BeOS. @end itemize Portability problems not fixed by Gnulib: @itemize -...@item -This function is missing on some platforms: -IRIX 5.3, Solaris 2.5.1, mingw, Interix 3.5, BeOS. @end itemize Note: POSIX recommends using @code{sigaction} with SA_RESTART instead of diff --git a/lib/siginterrupt.c b/lib/siginterrupt.c new file mode 100644 index 0000000..95bdcb5 --- /dev/null +++ b/lib/siginterrupt.c @@ -0,0 +1,36 @@ +/* POSIX compatible siginterrupt replacement. + Copyright (C) 2009 Free Software Foundation, Inc. + + This program 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 3 of the License, or + (at your option) any later version. + + This program 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, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include <signal.h> + +int +siginterrupt (int sig, int flag) +{ + struct sigaction act; + + if (sigaction (sig, NULL, &act) < 0) + return -1; + + if (flag) + act.sa_flags &= ˜SA_RESTART; + else + act.sa_flags |= SA_RESTART; + + return sigaction (sig, &act, NULL); +} diff --git a/lib/signal.in.h b/lib/signal.in.h index 5c42fe9..0183901 100644 --- a/lib/signal.in.h +++ b/lib/signal.in.h @@ -192,6 +192,9 @@ extern int sigaction (int, const struct sigaction *restrict, # define SA_NODEFER 0 #endif +#if !...@have_siginterrupt@ +extern int siginterrupt (int sig, int flag); +#endif /* !...@have_siginterrupt@ */ #ifdef __cplusplus } diff --git a/m4/siginterrupt.m4 b/m4/siginterrupt.m4 new file mode 100644 index 0000000..18075e0 --- /dev/null +++ b/m4/siginterrupt.m4 @@ -0,0 +1,23 @@ +# siginterrupt.m4 serial 1 +dnl Copyright (C) 2009 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# Determine if siginterrupt is present. +AC_DEFUN([gl_SIGINTERRUPT], +[ + AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) + AC_CHECK_FUNCS_ONCE([siginterrupt]) + if test $ac_cv_func_sigaction = no; then + HAVE_SIGINTERRUPT=0 + AC_LIBOBJ([siginterrupt]) + gl_PREREQ_SIGINTERRUPT + fi +]) + +# Prerequisites of the part of lib/signal.in.h and of lib/siginterrupt.c. +AC_DEFUN([gl_PREREQ_SIGINTERRUPT], +[ + : +]) diff --git a/m4/signal_h.m4 b/m4/signal_h.m4 index e69befd..3d955e8 100644 --- a/m4/signal_h.m4 +++ b/m4/signal_h.m4 @@ -28,6 +28,7 @@ AC_DEFUN([gl_SIGNAL_H_DEFAULTS], GNULIB_SIGNAL_H_SIGPIPE=0; AC_SUBST([GNULIB_SIGNAL_H_SIGPIPE]) GNULIB_SIGPROCMASK=0; AC_SUBST([GNULIB_SIGPROCMASK]) GNULIB_SIGACTION=0; AC_SUBST([GNULIB_SIGACTION]) + GNULIB_SIGINTERRUPT=0; AC_SUBST([GNULIB_SIGINTERRUPT]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_POSIX_SIGNALBLOCKING=1; AC_SUBST([HAVE_POSIX_SIGNALBLOCKING]) HAVE_SIGSET_T=1; AC_SUBST([HAVE_SIGSET_T]) @@ -37,4 +38,5 @@ AC_DEFUN([gl_SIGNAL_H_DEFAULTS], AC_SUBST([HAVE_STRUCT_SIGACTION_SA_SIGACTION]) HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=1; AC_SUBST([HAVE_TYPE_VOLATILE_SIG_ATOMIC_T]) + HAVE_SIGINTERRUPT=1; AC_SUBST([HAVE_SIGINTERRUPT]) ]) diff --git a/modules/siginterrupt b/modules/siginterrupt new file mode 100644 index 0000000..ea6f490 --- /dev/null +++ b/modules/siginterrupt @@ -0,0 +1,24 @@ +Description: +POSIX compatible siginterrupt replacement. + +Files: +lib/siginterrupt.c +m4/siginterrupt.m4 + +Depends-on: +sigaction + +configure.ac: +gl_SIGINTERRUPT +gl_SIGNAL_MODULE_INDICATOR([siginterrupt]) + +Makefile.am: + +Include: +<signal.h> + +License: +LGPL + +Maintainer: +Simon Josefsson diff --git a/modules/signal b/modules/signal index bfef96f..1a9007b 100644 --- a/modules/signal +++ b/modules/signal @@ -26,12 +26,14 @@ signal.h: signal.in.h -e 's|@''GNULIB_SIGNAL_H_SIGPIPE''@|$(GNULIB_SIGNAL_H_SIGPIPE)|g' \ -e 's|@''GNULIB_SIGPROCMASK''@|$(GNULIB_SIGPROCMASK)|g' \ -e 's|@''GNULIB_SIGACTION''@|$(GNULIB_SIGACTION)|g' \ + -e 's|@''GNULIB_SIGINTERRUPT''@|$(GNULIB_SIGINTERRUPT)|g' \ -e 's|@''HAVE_POSIX_SIGNALBLOCKING''@|$(HAVE_POSIX_SIGNALBLOCKING)|g' \ -e 's|@''HAVE_SIGSET_T''@|$(HAVE_SIGSET_T)|g' \ -e 's|@''HAVE_SIGINFO_T''@|$(HAVE_SIGINFO_T)|g' \ -e 's|@''HAVE_SIGACTION''@|$(HAVE_SIGACTION)|g' \ -e 's|@''HAVE_STRUCT_SIGACTION_SA_SIGACTION''@|$(HAVE_STRUCT_SIGACTION_SA_SIGACTION)|g' \ -e 's|@''HAVE_TYPE_VOLATILE_SIG_ATOMIC_T''@|$(HAVE_TYPE_VOLATILE_SIG_ATOMIC_T)|g' \ + -e 's|@''HAVE_SIGINTERRUPT''@|$(HAVE_SIGINTERRUPT)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ < $(srcdir)/signal.in.h; \ } > $...@-t -- 1.6.3.3