Am Sonntag, 4. März 2007 schrieb Dennis Schridde: > Am Sonntag, 4. März 2007 schrieb Per Inge Mathisen: > > On 3/4/07, Dennis Schridde <[EMAIL PROTECTED]> wrote: > > > It can't... At least on compile time it is fixed in one way or the > > > other. And if eg. 3 is defined to SIGQUIT at compiletime, it can never > > > change ever thereafter... If a library compiled with SIGQUIT being 3 > > > would communicate with a program compiled with SIGQUIT defined to 4, > > > then they would not be able to talk to each other... So this must be a > > > standard, otherwise the whole Linux-land would not work... > > > > It would have to be standardized on the same system (eg Linux), but > > for all I know it could be standardized differently on other systems > > (eg FreeBSD, MacOSX). > > > > Not sure how this can best be solved, though. Making wz_strsignal() > > use a switch that checks the various SIG* enums and returns a string > > for each is one solution. > > At least on my system SIG* are not enums, but defines... > My current wz_strsignal uses the signum as an index into the description > table, like strsignal does. I don't know how that is different from a > switch. If you know that some signals have a different meaning on another > OS, you could use preprocessor checks to give that signum a different > description. But I don't think that these system dependend signals will be > many, as most of them are either defined by C99 or POSIX. > Maybe some of the newer BSD signals have a different meaning on other OSes, > I don't know that. But at least they have the same meaning on BSD and > Linux, so this leaves only MacOS for which we need to check. > I don't even use the defines, but only their numbers, so even on a system > where those signals are not defined, we wont get into trouble. If the OS > leaves the definition of a certain number empty, I doubt that it will ever > send that signal. So I think it is save the way it is... > But feel free to fix it however you like. > > --Dennis
Ordered by origin: POSIX: #define SIGHUP 1 /* Hangup (POSIX). */ #define SIGQUIT 3 /* Quit (POSIX). */ #define SIGTRAP 5 /* Trace trap (POSIX). */ #define SIGKILL 9 /* Kill, unblockable (POSIX). */ #define SIGUSR1 10 /* User-defined signal 1 (POSIX). */ #define SIGUSR2 12 /* User-defined signal 2 (POSIX). */ #define SIGPIPE 13 /* Broken pipe (POSIX). */ #define SIGALRM 14 /* Alarm clock (POSIX). */ #define SIGCHLD 17 /* Child status has changed (POSIX). */ #define SIGCONT 18 /* Continue (POSIX). */ #define SIGSTOP 19 /* Stop, unblockable (POSIX). */ #define SIGTSTP 20 /* Keyboard stop (POSIX). */ #define SIGTTIN 21 /* Background read from tty (POSIX). */ #define SIGTTOU 22 /* Background write to tty (POSIX). */ ANSI (C99?): #define SIGINT 2 /* Interrupt (ANSI). */ #define SIGILL 4 /* Illegal instruction (ANSI). */ #define SIGABRT 6 /* Abort (ANSI). */ #define SIGFPE 8 /* Floating-point exception (ANSI). */ #define SIGSEGV 11 /* Segmentation violation (ANSI). */ #define SIGTERM 15 /* Termination (ANSI). */ BSD: #define SIGBUS 7 /* BUS error (4.2 BSD). */ #define SIGURG 23 /* Urgent condition on socket (4.2 BSD). */ #define SIGXCPU 24 /* CPU limit exceeded (4.2 BSD). */ #define SIGXFSZ 25 /* File size limit exceeded (4.2 BSD). */ #define SIGVTALRM 26 /* Virtual alarm clock (4.2 BSD). */ #define SIGPROF 27 /* Profiling alarm clock (4.2 BSD). */ #define SIGWINCH 28 /* Window size change (4.3 BSD, Sun). */ #define SIGIO 29 /* I/O now possible (4.2 BSD). */ SystemV: #define SIGPWR 30 /* Power failure restart (System V). */ Unknown (GNU?): #define SIGSTKFLT 16 /* Stack fault. */ #define SIGSYS 31 /* Bad system call. */ So the majority is defined by POSIX and ANSI. At least SIGXFSZ seems to also be part of POSIX (man 3p write) and if you look at http://www.opengroup.org/onlinepubs/009695399/basedefs/signal.h.html there seem to be several more used by it.
pgpJ4frYAG0u3.pgp
Description: PGP signature
_______________________________________________ Warzone-dev mailing list Warzone-dev@gna.org https://mail.gna.org/listinfo/warzone-dev