# HG changeset patch # User John W. Eaton # Date 1466160148 14400 # Node ID da9b960b1b2d7884e055a98e72660efe4f882c47 # Parent 55f7de37b6181d091e7d4e12aa65116de60e0439 use gnulib strsignal module * bootstrap.conf: Use gnulib strsignal module. * liboctave/wrappers/signal-wrappers.c, liboctave/wrappers/signal-wrappers.h: New files. * liboctave/wrappers/module.mk: Update. * sighandlers.cc, octave.cc: Don't include siglist.h. * octave.cc (octave_initialize_interpreter): Don't call init_signals. * sighandlers.cc: Include signal-wrappers.h. Use octave_strsignal_wrapper function. * siglist.c, siglist.h: Delete. * libinterp/corefcn/module.mk: Update. diff -r 55f7de37b618 -r da9b960b1b2d bootstrap.conf --- a/bootstrap.conf Fri Jun 17 05:52:21 2016 -0400 +++ b/bootstrap.conf Fri Jun 17 06:42:28 2016 -0400 @@ -98,6 +98,7 @@ strerror strftime strptime + strsignal symlink sys_stat sys_time diff -r 55f7de37b618 -r da9b960b1b2d libinterp/corefcn/module.mk --- a/libinterp/corefcn/module.mk Fri Jun 17 05:52:21 2016 -0400 +++ b/libinterp/corefcn/module.mk Fri Jun 17 06:42:28 2016 -0400 @@ -102,13 +102,9 @@ libinterp/corefcn/jit-ir.cc \ libinterp/corefcn/pt-jit.cc -C_COREFCN_SRC = \ - libinterp/corefcn/siglist.c - NOINSTALL_COREFCN_INC = \ libinterp/corefcn/oct-hdf5.h \ - libinterp/corefcn/oct-opengl.h \ - libinterp/corefcn/siglist.h + libinterp/corefcn/oct-opengl.h ## oct-tex-parser.h is in the SRC list so that it will be distributed ## but not installed. @@ -257,7 +253,6 @@ libinterp/corefcn/xpow.cc \ libinterp/corefcn/zfstream.cc \ $(JIT_SRC) \ - $(C_COREFCN_SRC) \ $(NOINSTALL_COREFCN_INC) COREFCN_FT2_DF = \ diff -r 55f7de37b618 -r da9b960b1b2d libinterp/corefcn/sighandlers.cc --- a/libinterp/corefcn/sighandlers.cc Fri Jun 17 05:52:21 2016 -0400 +++ b/libinterp/corefcn/sighandlers.cc Fri Jun 17 06:42:28 2016 -0400 @@ -33,6 +33,7 @@ #include "oct-syscalls.h" #include "quit.h" #include "singleton-cleanup.h" +#include "signal-wrappers.h" #include "debug.h" #include "defun.h" @@ -44,7 +45,6 @@ #include "pt-bp.h" #include "pt-eval.h" #include "sighandlers.h" -#include "siglist.h" #include "sysdep.h" #include "toplev.h" #include "utils.h" @@ -374,7 +374,7 @@ static void generic_sig_handler (int sig) { - my_friendly_exit (strsignal (sig), sig); + my_friendly_exit (octave_strsignal_wrapper (sig), sig); } // Handle SIGCHLD. @@ -517,9 +517,9 @@ sigint_handler (int sig) { #if defined (__WIN32__) && ! defined (__CYGWIN__) - w32_interrupt_manager::user_abort (strsignal (sig), sig); + w32_interrupt_manager::user_abort (octave_strsignal_wrapper (sig), sig); #else - user_abort (strsignal (sig), sig); + user_abort (octave_strsignal_wrapper (sig), sig); #endif } diff -r 55f7de37b618 -r da9b960b1b2d libinterp/corefcn/siglist.c --- a/libinterp/corefcn/siglist.c Fri Jun 17 05:52:21 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,238 +0,0 @@ -/* - -Copyright (C) 2000-2015 John W. Eaton - -This file is part of Octave. - -Octave 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. - -Octave 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 Octave; see the file COPYING. If not, see -. - -*/ - -#if defined (HAVE_CONFIG_H) -#include "config.h" -#endif - -#include - -#include "siglist.h" - -/* The following is all borrowed from Emacs. */ - -#if ! (defined HAVE_STRSIGNAL || HAVE_DECL_SYS_SIGLIST) - -static char *my_sys_siglist[NSIG]; - -#if defined (sys_siglist) -#undef sys_siglist -#endif -#define sys_siglist my_sys_siglist - -#endif - -void -init_signals (void) -{ -#if ! (defined HAVE_STRSIGNAL || HAVE_DECL_SYS_SIGLIST) - - static int initialized = 0; - - if (! initialized) - { - initialized = 1; - -# if defined (SIGABRT) - sys_siglist[SIGABRT] = "Aborted"; -# endif -# if defined (SIGAIO) - sys_siglist[SIGAIO] = "LAN I/O interrupt"; -# endif -# if defined (SIGALRM) - sys_siglist[SIGALRM] = "Alarm clock"; -# endif -# if defined (SIGBUS) - sys_siglist[SIGBUS] = "Bus error"; -# endif -# if defined (SIGCLD) - sys_siglist[SIGCLD] = "Child status changed"; -# endif -# if defined (SIGCHLD) - sys_siglist[SIGCHLD] = "Child status changed"; -# endif -# if defined (SIGCONT) - sys_siglist[SIGCONT] = "Continued"; -# endif -# if defined (SIGDANGER) - sys_siglist[SIGDANGER] = "Swap space dangerously low"; -# endif -# if defined (SIGDGNOTIFY) - sys_siglist[SIGDGNOTIFY] = "Notification message in queue"; -# endif -# if defined (SIGEMT) - sys_siglist[SIGEMT] = "Emulation trap"; -# endif -# if defined (SIGFPE) - sys_siglist[SIGFPE] = "Arithmetic exception"; -# endif -# if defined (SIGFREEZE) - sys_siglist[SIGFREEZE] = "SIGFREEZE"; -# endif -# if defined (SIGGRANT) - sys_siglist[SIGGRANT] = "Monitor mode granted"; -# endif -# if defined (SIGHUP) - sys_siglist[SIGHUP] = "Hangup"; -# endif -# if defined (SIGILL) - sys_siglist[SIGILL] = "Illegal instruction"; -# endif -# if defined (SIGINT) - sys_siglist[SIGINT] = "Interrupt"; -# endif -# if defined (SIGIO) - sys_siglist[SIGIO] = "I/O possible"; -# endif -# if defined (SIGIOINT) - sys_siglist[SIGIOINT] = "I/O intervention required"; -# endif -# if defined (SIGIOT) - sys_siglist[SIGIOT] = "IOT trap"; -# endif -# if defined (SIGKILL) - sys_siglist[SIGKILL] = "Killed"; -# endif -# if defined (SIGLOST) - sys_siglist[SIGLOST] = "Resource lost"; -# endif -# if defined (SIGLWP) - sys_siglist[SIGLWP] = "SIGLWP"; -# endif -# if defined (SIGMSG) - sys_siglist[SIGMSG] = "Monitor mode data available"; -# endif -# if defined (SIGPHONE) - sys_siglist[SIGPHONE] = "SIGPHONE"; -# endif -# if defined (SIGPIPE) - sys_siglist[SIGPIPE] = "Broken pipe"; -# endif -# if defined (SIGPOLL) - sys_siglist[SIGPOLL] = "Pollable event occurred"; -# endif -# if defined (SIGPROF) - sys_siglist[SIGPROF] = "Profiling timer expired"; -# endif -# if defined (SIGPTY) - sys_siglist[SIGPTY] = "PTY I/O interrupt"; -# endif -# if defined (SIGPWR) - sys_siglist[SIGPWR] = "Power-fail restart"; -# endif -# if defined (SIGQUIT) - sys_siglist[SIGQUIT] = "Quit"; -# endif -# if defined (SIGRETRACT) - sys_siglist[SIGRETRACT] = "Need to relinguish monitor mode"; -# endif -# if defined (SIGSAK) - sys_siglist[SIGSAK] = "Secure attention"; -# endif -# if defined (SIGSEGV) - sys_siglist[SIGSEGV] = "Segmentation violation"; -# endif -# if defined (SIGSOUND) - sys_siglist[SIGSOUND] = "Sound completed"; -# endif -# if defined (SIGSTKFLT) - sys_siglist[SIGSTKFLT] = "Stack fault"; -# endif -# if defined (SIGSTOP) - sys_siglist[SIGSTOP] = "Stopped (signal)"; -# endif -# if defined (SIGSTP) - sys_siglist[SIGSTP] = "Stopped (user)"; -# endif -# if defined (SIGSYS) - sys_siglist[SIGSYS] = "Bad argument to system call"; -# endif -# if defined (SIGTERM) - sys_siglist[SIGTERM] = "Terminated"; -# endif -# if defined (SIGTHAW) - sys_siglist[SIGTHAW] = "SIGTHAW"; -# endif -# if defined (SIGTRAP) - sys_siglist[SIGTRAP] = "Trace/breakpoint trap"; -# endif -# if defined (SIGTSTP) - sys_siglist[SIGTSTP] = "Stopped (user)"; -# endif -# if defined (SIGTTIN) - sys_siglist[SIGTTIN] = "Stopped (tty input)"; -# endif -# if defined (SIGTTOU) - sys_siglist[SIGTTOU] = "Stopped (tty output)"; -# endif -# if defined (SIGUNUSED) - sys_siglist[SIGUNUSED] = "SIGUNUSED"; -# endif -# if defined (SIGURG) - sys_siglist[SIGURG] = "Urgent I/O condition"; -# endif -# if defined (SIGUSR1) - sys_siglist[SIGUSR1] = "User defined signal 1"; -# endif -# if defined (SIGUSR2) - sys_siglist[SIGUSR2] = "User defined signal 2"; -# endif -# if defined (SIGVTALRM) - sys_siglist[SIGVTALRM] = "Virtual timer expired"; -# endif -# if defined (SIGWAITING) - sys_siglist[SIGWAITING] = "Process's LWPs are blocked"; -# endif -# if defined (SIGWINCH) - sys_siglist[SIGWINCH] = "Window size changed"; -# endif -# if defined (SIGWIND) - sys_siglist[SIGWIND] = "SIGWIND"; -# endif -# if defined (SIGXCPU) - sys_siglist[SIGXCPU] = "CPU time limit exceeded"; -# endif -# if defined (SIGXFSZ) - sys_siglist[SIGXFSZ] = "File size limit exceeded"; -# endif - } - -#endif -} - -#if ! defined (HAVE_STRSIGNAL) - -char * -strsignal (int code) -{ - char *signame = ""; - - if (0 <= code && code < NSIG) - { - /* Cast to suppress warning if the table has const char *. */ - signame = (char *) sys_siglist[code]; - } - - return signame; -} - -#endif diff -r 55f7de37b618 -r da9b960b1b2d libinterp/corefcn/siglist.h --- a/libinterp/corefcn/siglist.h Fri Jun 17 05:52:21 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* - -Copyright (C) 2000-2015 John W. Eaton - -This file is part of Octave. - -Octave 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. - -Octave 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 Octave; see the file COPYING. If not, see -. - -*/ - -#if ! defined (octave_siglist_h) -#define octave_siglist_h 1 - -#include "octave-config.h" - -#if defined (__cplusplus) -extern "C" -{ -#endif - -/* This is borrowed from Emacs. */ - -#if ! defined (HAVE_DECL_SYS_SIGLIST) -extern char *sys_siglist[]; -#endif - -extern void init_signals (void); - -#if ! defined (HAVE_STRSIGNAL) -extern char *strsignal (int); -#endif - -#if defined (__cplusplus) -} -#endif - -#endif diff -r 55f7de37b618 -r da9b960b1b2d libinterp/octave.cc --- a/libinterp/octave.cc Fri Jun 17 05:52:21 2016 -0400 +++ b/libinterp/octave.cc Fri Jun 17 06:42:28 2016 -0400 @@ -72,7 +72,6 @@ #include "parse.h" #include "procstream.h" #include "sighandlers.h" -#include "siglist.h" #include "sysdep.h" #include "unwind-prot.h" #include "utils.h" @@ -801,8 +800,6 @@ if (traditional) maximum_braindamage (); - init_signals (); - octave_ieee_init (); // The idea here is to force xerbla to be referenced so that we will link to diff -r 55f7de37b618 -r da9b960b1b2d liboctave/wrappers/module.mk --- a/liboctave/wrappers/module.mk Fri Jun 17 05:52:21 2016 -0400 +++ b/liboctave/wrappers/module.mk Fri Jun 17 06:42:28 2016 -0400 @@ -15,6 +15,7 @@ liboctave/wrappers/octave-popen2.h \ liboctave/wrappers/putenv-wrapper.h \ liboctave/wrappers/set-program-name-wrapper.h \ + liboctave/wrappers/signal-wrappers.h \ liboctave/wrappers/stat-wrappers.h \ liboctave/wrappers/strftime-wrapper.h \ liboctave/wrappers/strmode-wrapper.h \ @@ -44,6 +45,7 @@ liboctave/wrappers/octave-popen2.c \ liboctave/wrappers/putenv-wrapper.c \ liboctave/wrappers/set-program-name-wrapper.c \ + liboctave/wrappers/signal-wrappers.c \ liboctave/wrappers/stat-wrappers.c \ liboctave/wrappers/strftime-wrapper.c \ liboctave/wrappers/strmode-wrapper.c \ diff -r 55f7de37b618 -r da9b960b1b2d liboctave/wrappers/signal-wrappers.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/signal-wrappers.c Fri Jun 17 06:42:28 2016 -0400 @@ -0,0 +1,42 @@ +/* + +Copyright (C) 2016 John W. Eaton + +This file is part of Octave. + +Octave 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. + +Octave 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 Octave; see the file COPYING. If not, see +. + +*/ + +// These functions may be provided by gnulib. We don't include gnulib +// headers directly in Octave's C++ source files to avoid problems that +// may be caused by the way that gnulib overrides standard library +// functions. + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include +#include +#include + +#include "signal-wrappers.h" + +char * +octave_strsignal_wrapper (int signum) +{ + return strsignal (signum); +} diff -r 55f7de37b618 -r da9b960b1b2d liboctave/wrappers/signal-wrappers.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/signal-wrappers.h Fri Jun 17 06:42:28 2016 -0400 @@ -0,0 +1,36 @@ +/* + +Copyright (C) 2016 John W. Eaton + +This file is part of Octave. + +Octave 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. + +Octave 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 Octave; see the file COPYING. If not, see +. + +*/ + +#if ! defined (octave_signal_wrappers_h) +#define octave_signal_wrappers_h 1 + +#if defined __cplusplus +extern "C" { +#endif + +extern char *octave_strsignal_wrapper (int signum); + +#if defined __cplusplus +} +#endif + +#endif