Hi Bruno

OK, the highest number for any SIG<something> is 31, so NSIG should really be 
32.

The only SA_<something> Macros I can find are SA_DATA_SITE in <sys/socket.h>, 
most probably unrated, and SA_NOCLDSTOP and SA_RESERVED_31 in <signal.h>, and 
nothing that looks remotely like a replacement, signal.h attached

Bye, Jojo

-----Original Message-----
From: Bruno Haible [mailto:br...@clisp.org] 
Sent: Thursday, December 23, 2010 1:30 PM
To: Joachim Schmitz
Cc: bug-gnulib@gnu.org
Subject: Re: <signal.h> on HP-NonStop

Hello Joachim,

Please, let's use different mails with different subject for each topic.
Otherwise I cannot keep track which issues have been dealt with, and the 
conversation dies down in confusion.

> During compile of gllib:
> NSIG missing, I added it to gllib/spwani.c, in  a brute force fashion 
> (#define NSIG 32) without really know what I'm doing here...
> "/bin/kill -l | wc -w" returns 33.

NSIG should be larger than any predefined signal value. Since you say that your 
system has 33 signals, the value 32 is not right. Probably 33, 34, or 64 is 
better then. You need to look at the values in your <signal.h>.

And the definition belongs in <signal.h>.

> SA_RESTART and SA_RESETHAND are missing source='test-sigaction.c' 
> object='test-sigaction.o' libtool=no  DEPDIR=.deps depmode=none /bin/sh 
> ./../build-aux/depcomp  cc -DHAVE_CONFIG_H -I.  -DGNULIB_STRICT_CHECKING=1  
> -I. -I.  -I.. -I./..  -I../gllib -I./../gllib  -I/usr/local/include  -g 
> -Wnowarn -c -o test-sigaction.o test-sigaction.c
>         ASSERT ((sa.sa_flags & SA_RESETHAND) == 0);
>         ^
> "/usr/local/Floss/gnulib/testdir-posix/gltests/test-sigaction.c", line 67: 
> error(114):
>           identifier "SA_RESETHAND" is undefined ...
>     ASSERT ((old_sa.sa_flags & MASK_SA_FLAGS) == 0);
>     ^
> "/usr/local/Floss/gnulib/testdir-posix/gltests/test-sigaction.c", line 97: 
> error(114):
>           identifier "SA_RESTART" is undefined

These two are specified by POSIX
<http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html>.
Does NonStop Kernel really lack these flags, or are they merely available under 
different names?

Bruno
#ifdef __TANDEM
#pragma columns 80
#if _TANDEM_ARCH_ != 0
#pragma ONCE
#endif
#endif
#ifndef _SIGNAL
#define _SIGNAL

/* T8645H02 - (21MAY2008) - signal.h   signal/job-control definitions */
/* T8645G08^AAX - (10MAY2007)                                         */

/*
 *  Copyright 2008 Hewlett Packard Development Company, L.P.
 *
 *     ALL RIGHTS RESERVED
 */

#ifdef __cplusplus
   extern "C" {
#endif

#ifdef __OLDCALLS                      /* TNS C legacy header */
#pragma nooldcalls
#define REVERT_TO_OLDCALLS
#endif


/* Supports TNS and TNS/R (where both Guardian and OSS processes
 * can have signals); and native mode 128-bit signal facilities
 */

#if defined(_POSIX_SOURCE) || _POSIX_C_SOURCE == 1 || \
    defined(_XOPEN_SOURCE) || _POSIX_C_SOURCE == 2 || \
    defined(_TANDEM_SOURCE)

#ifndef _GUARDIAN_TARGET
#ifndef _GUARDIAN_HOST
#include <sys/types.h>
#else
#include <systype.h> nolist
#endif /* _GUARDIAN_HOST */
#endif /* !_GUARDIAN_TARGET */

/* sigset_t required even for TNS because parts of SL need it */
#if _TANDEM_ARCH_ != 0 || !defined(__TANDEM)
   #ifdef __TANDEM
   #pragma fieldalign shared8 __sigset_template
   #endif
   struct __sigset_template { long long item64[2]; }; /* 128 bit */
   typedef struct __sigset_template sigset_t; /* native size 128 bits */
#else  /* _TANDEM_ARCH_ == 0 */
   typedef long  sigset_t;                    /* TNS size 32 bits */
#endif /* _TANDEM_ARCH_ == 0 */

#if _TANDEM_ARCH_ != 0 || !defined(_GUARDIAN_TARGET)  /* native or TNS OSS */

   #ifdef __TANDEM
   #pragma fieldalign shared8 sigaction
   #endif

   #if _TANDEM_ARCH_ != 0 || !defined(__TANDEM)   /* native */
      struct sigaction
      {
      sigset_t  sa_mask;
      void    (*sa_handler)(int);
      int       sa_flags;
      };
   #else  /* OSS TNS (sigaction meaningful) */
      struct sigaction
      {
      void    (*sa_handler)(int);
      sigset_t  sa_mask;
      int       sa_flags;
   #ifndef filler_0
      char      filler_0[8];
   #else
      char      __filler_0[8];
   #endif /* !filler_0 */
      };
   #endif /* OSS TNS (sigaction meaningful) */

   #ifdef _TANDEM_SOURCE
   typedef  struct sigaction sigaction_t;
   #endif /* _TANDEM_SOURCE */

#endif /* _TANDEM_ARCH_ != 0 || !_GUARDIAN_TARGET */

#endif /* _POSIX_SOURCE || ... || _XOPEN_SOURCE || _TANDEM_SOURCE */

typedef short sig_atomic_t;


/* signal numbers and miscellaneous definitions:
      OSS/native signals are a superset of TNS-Guardian signals (same numbers).
      OSS/native values for SIG_DFL, SIG_IGN and SIG_ERR don't agree with
          Guardian TNS definitions.  The OSS values represent invalid
          routine addresses in both TNS and TNS/R realms.
*/
#if _TANDEM_ARCH_ == 0 && defined(_GUARDIAN_TARGET)
   /* Standard C signals for TNS Guardian */

   #define SIGINT        2  /* Interactive Attention                         */
   #define SIGILL        4  /* Instruction Failure        (Guardian OS trap) */
   #define SIGABRT       6  /* Abnormal termination                          */
   #define SIGFPE        8  /* Arithmetic Overflow        (Guardian OS trap) */
   #define SIGSEGV      11  /* Illegal address ref.       (Guardian OS trap) */
   #define SIGTERM      15  /* Termination request                           */

   /* Tandem implementation-defined signals */

   #define SIGMEMERR    22  /* Uncorrectable memory error (Guardian OS trap) */
   #define SIGNOMEM     23  /* No memory available        (Guardian OS trap) */
   #define SIGMEMMGR    24  /* Memory Mgr. disk read err  (Guardian OS trap) */
   #define SIGSTK       25  /* Stack overflow             (Guardian OS trap) */
   #define SIGTIMEOUT   26  /* Process loop-timer timeout (Guardian OS trap) */
   #define SIGLIMIT     27  /* Guardian Limit exceeded    (Guardian OS trap) */

   /* non-public types */

   typedef void (*_signal_handler)(int);

   /* Standard C defines for signal actions */

   #define  SIG_DFL ((_signal_handler) 0x00)       /* default handler */
   #ifdef __XMEM
      #define  SIG_IGN ((_signal_handler) 0x10000) /* ignore signal */
   #else
      #define  SIG_IGN ((_signal_handler) 0x01)    /* ignore signal */
   #endif

   /* Standard C defines for error returns from the signal function */

   #define  SIG_ERR ((_signal_handler) 0x200)

#else /* _TANDEM_ARCH_ != 0 || !_GUARDIAN_TARGET */
   /* TNS OSS or native C */

   #define SIGHUP        1
   #define SIGINT        2
   #define SIGQUIT       3
   #define SIGILL        4
   #define SIGURG        5
   #define SIGABRT       6
   #define SIGIO         7
   #define SIGFPE        8
   #define SIGKILL       9
   #define SIGSEGV      11
   #define SIGPIPE      13
   #define SIGALRM      14
   #define SIGTERM      15
   #define SIGUSR1      16
   #define SIGUSR2      17
   #define SIGCHLD      18
   /* POSIX permits duplicate names, X/OPEN does not; so SIGCLD not here */
   #define SIGSTOP      20
   #define SIGTSTP      21
   #define SIGCONT      28
   #define SIGTTIN      29
   #define SIGTTOU      30

   #ifdef _TANDEM_SOURCE
    #if _TANDEM_ARCH_ > 1
     #define SIGUNCP      10
    #endif
     #define SIGWINCH     12
     #define SIGRECV      19
     #define SIGMEMERR    22
     #define SIGNOMEM     23
     #define SIGMEMMGR    24
     #define SIGSTK       25
     #define SIGTIMEOUT   26
     #define SIGLIMIT     27
     #define SIGABEND     31
   #endif /* _TANDEM_SOURCE */

   #define SIG_BLOCK     1
   #define SIG_SETMASK   2
   #define SIG_UNBLOCK   3

   #define SA_NOCLDSTOP   (1)
   #define SA_RESERVED_31 (1 << 31)

   #define SIG_DFL ((void (*)(int)) 0xFFFC0000)
   #define SIG_IGN ((void (*)(int)) 0xFFFC0001)
   #define SIG_ERR ((void (*)(int)) 0xFFFC0002)

#endif /* _TANDEM_ARCH_ != 0 || !_GUARDIAN_TARGET */


#if _TANDEM_ARCH_ == 0 && defined(_GUARDIAN_TARGET)
   /* TNS Guardian */

   int             raise (int);
   _signal_handler signal(int, _signal_handler);
   sig_atomic_t _is_system_trap(void);       /* Tandem extension function */

   #if defined(__TANDEM)
     #ifdef __XMEM
        #ifdef __INT32
          /*
           * Wide Model
           */
           #pragma function raise            (alias("_C_LG_raise_32_"))
           #pragma function signal           (alias("_C_LG_signal_32_"))
           #pragma function _is_system_trap  (alias("C_IS_SYSTEM_TRAP_"), tal)
        #else
          /*
           * Large Model
           */
           #pragma function raise            (alias("_C_LG_raise_"))
           #pragma function signal           (alias("_C_LG_signal_"))
           #pragma function _is_system_trap  (alias("C_IS_SYSTEM_TRAP_"), tal)
        #endif
     #else
          /*
           * Small Model
           */
           #pragma function raise            (alias("_C_SM_raise_"))
           #pragma function signal           (alias("_C_SM_signal_"))
           #pragma function _is_system_trap  (alias("C_IS_SYSTEM_TRAP_"), tal)
     #endif
   #endif /* __TANDEM */

#else  /* _TANDEM_ARCH_ != 0 || !_GUARDIAN_TARGET */

   int raise(int);
   void ( *signal(int, void (*)(int)) ) (int);
   #if defined(__TANDEM) && _TANDEM_ARCH_ == 0   /* TNS OSS aliases */
      #pragma function raise           (alias("PK_RAISE_"  ), unspecified)
      #pragma function signal          (alias("PK_SIGNAL_" ), unspecified)
   #endif /* __TANDEM && _TANDEM_ARCH_ == 0 */

   #if defined(_POSIX_SOURCE) || _POSIX_C_SOURCE == 1 || \
       defined(_XOPEN_SOURCE) || _POSIX_C_SOURCE == 2 || defined(_TANDEM_SOURCE)
   #ifndef _GUARDIAN_TARGET
   int kill (pid_t, int);  /* not avail to Guardian */
   #endif
   int sigaction  (int, const struct sigaction *, struct sigaction *);
   int sigaddset  (sigset_t *, int);
   int sigdelset  (sigset_t *, int);
   int sigemptyset(sigset_t *);
   int sigfillset (sigset_t *);
   int sigismember(const sigset_t *, int);
   int sigpending (sigset_t *);
   int sigprocmask(int, const sigset_t *, sigset_t *);
   int sigsuspend (const sigset_t *);

   #if defined(__TANDEM) && _TANDEM_ARCH_ == 0   /* TNS OSS aliases */
      #ifndef _GUARDIAN_TARGET
      #pragma function kill            (unspecified)
      #endif
      #pragma function sigaction       (unspecified)
      #pragma function sigaddset       (unspecified)
      #pragma function sigdelset       (unspecified)
      #pragma function sigemptyset     (unspecified)
      #pragma function sigfillset      (unspecified)
      #pragma function sigismember     (unspecified)
      #pragma function sigpending      (unspecified)
      #pragma function sigprocmask     (unspecified)
      #pragma function sigsuspend      (unspecified)
   #endif /* __TANDEM && _TANDEM_ARCH_ == 0 */
   #endif /* _POSIX_SOURCE || ... || _XOPEN_SOURCE || _TANDEM_SOURCE */

#endif /* _TANDEM_ARCH_ != 0 || !_GUARDIAN_TARGET */


#ifdef REVERT_TO_OLDCALLS
#undef REVERT_TO_OLDCALLS
#pragma oldcalls
#endif

#ifdef __cplusplus
   }
#endif

#endif  /* _SIGNAL defined */

Reply via email to