免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 8201 | 回复: 5
打印 上一主题 下一主题

[故障求助] 请教trap用法,求signal信号列表 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-07-17 10:21 |只看该作者 |倒序浏览
大家帮帮忙啊

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
2 [报告]
发表于 2003-07-17 11:18 |只看该作者

请教trap用法,求signal信号列表

1) HUP                   14) ALRM                  27) MSG                   40) bad trap              53) bad trap
2) INT                   15) TERM                  2 WINCH                 41) bad trap              54) bad trap
3) QUIT                  16 ) URG                   29) PWR                   42) bad trap              55) bad trap
4) ILL                   17) STOP                  30) USR1                  43) bad trap              56) bad trap
5) TRAP                  1 TSTP                  31) USR2                  44) bad trap              57) bad trap
6 ) ABRT                  19) CONT                  32) PROF                  45) bad trap              5 bad trap
7) EMT                   20) CHLD                  33) DANGER                46 ) bad trap              59) CPUFAIL
FPE                   21) TTIN                  34) VTALRM                47) bad trap              60) GRANT
9) KILL                  22) TTOU                  35) MIGRATE               4 bad trap              61) RETRACT
10) BUS                   23) IO                    36 ) PRE                   49) bad trap              62) SOUND
11) SEGV                  24) XCPU                  37) bad trap              50) bad trap              63) SAK
12) SYS                   25) XFSZ                  3 bad trap              51) bad trap
13) PIPE                  26 ) bad trap              39) bad trap              52) bad trap

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
3 [报告]
发表于 2003-07-17 11:23 |只看该作者

请教trap用法,求signal信号列表

faint!
“6   )”
居然被解释成6)

论坛徽章:
0
4 [报告]
发表于 2003-07-17 12:52 |只看该作者

请教trap用法,求signal信号列表

一般trap写在shell menu中,避免客户用类似ctrl c键等退回命令行状态
参考:
trap "" 1 2 3 9 15

论坛徽章:
0
5 [报告]
发表于 2003-07-17 15:57 |只看该作者

请教trap用法,求signal信号列表

The sig argument can be assigned any one of the following values except
  SIGKILL and SIGSTOP:

   ---------------------------------------------------------------------------------------
   Signal     Value    Description                                   XPG 3   POSIX   ANSI
   ---------------------------------------------------------------------------------------
   SIGHUP     01       hangup                                          o       o
   SIGINT     02       interrupt                                       o       o       o
   SIGQUIT    03[1]    quit                                            o       o
   SIGILL     04[1]    illegal instruction (not reset when caught)     o       o       o
   SIGTRAP    05[1]    trace trap (not reset when caught)
   SIGIOT     06[1]    IOT instruction
   SIGABRT    06[1]    used by abort, replaces SIGIOT                  o       o       o
   SIGEMT     07[1]    EMT instruction
   SIGFPE     08[1]    floating point exception                        o       o       o
   SIGKILL    09       kill (cannot be caught or ignored)              o       o
   SIGBUS     10[1]    bus error
   SIGSEGV    11[1]    segmentation violation                          o       o       o
   SIGSYS     12[1]    bad argument to system call
   SIGPIPE    13       write on a pipe with no one to read it          o       o
   SIGALRM    14       alarm clock                                     o       o
   SIGTERM    15       software termination signal                     o       o       o
   SIGUSR1    16       user-defined signal 1                           o       o
   SIGUSR2    17       user-defined signal 2                           o       o
   SIGCLD     18[3]    death of a child
   SIGCHLD    18[3]    synonym for SIGCLD
   SIGPWR     19[3]    power fail
   SIGWINCH   20       window change
   SIGPOLL    22[4]    selectable event pending
   SIGSTOP    23[2]    sendable stop signal not from tty               o       o
   SIGTSTP    24[2]    stop signal from tty                            o       o
   SIGCONT    25[2]    continue a stopped process                      o       o
   SIGTTIN    26[2]    background tty read attempt                     o       o
   SIGTTOU    27[2]    background tty write attempt                    o       o
   SIGVTALRM  28       virtual timer alarm
   SIGPROF    29       profile alarm

  The func argument is assigned one of the following three values: SIG_DFL,
  SIG_IGN, or an address of a function defined by the user. SIG_DFL, and
  SIG_IGN, are defined in the header file <signal.h>;. Each is a macro that
  expands to a constant expression of type pointer to function returning
  void, and having a unique value that does not match a declarable function.

  The actions prescribed by the values of the func argument are as follows:

  SIG_DFL -- execute default signal action
          Upon receipt of the signal specified by sig, the receiving process
          will take the default action. The default action usually results in
          the termination of the process with all of the consequences
          outlined in exit(S). Those signals with a [1] or a [2] are
          exceptions to this rule. Their default behavior is described in the
          corresponding Note section.

  SIG_IGN -- ignore signal
          Upon receipt of the signal specified by sig, the signal is ignored.

  ____________________________________________________________________________
          NOTE: The SIGKILL and SIGSTOP signals cannot be ignored.
  ____________________________________________________________________________

  signal-catching function -- execute user-defined action
          Upon receipt of the signal sig, the receiving process executes the
          signal-catching function pointed to by func. The signal number
          sig is passed as the only argument to the signal-catching function.
          Additional arguments are passed to the signal-catching function for
          hardware-generated signals. Before entering the signal-catching
          function, the value of func for the caught signal is set to SIG_DFL
          unless the signal is SIGILL, SIGTRAP, or SIGPWR.

          Upon return from the signal-catching function, the receiving process
          resumes execution at the point it was interrupted.

          The signal catching function is not executed during certain slow
          processes even though a signal has been caught. Slow processes are
          considered to be read(S), write(S), open(S), or ioctl(S) system
          calls on a slow device (like a terminal; but not a file), a pause
          (S) routine, or during a wait(S) routine that does not return
          immediately due to the existence of a previously stopped or zombie
          process. Then the interrupted system call may return a -1 to the
          calling process with errno set to EINTR.

          The signal routine does not catch an invalid function argument,
          func, and results are undefined when an attempt is made to execute
          the function at the bad address.

  ____________________________________________________________________________
          NOTE: The SIGKILL and SIGSTOP signals cannot be caught.
  ____________________________________________________________________________

  A call to signal cancels a pending signal sig except for a pending SIGKILL
  or SIGSTOP signal.

论坛徽章:
0
6 [报告]
发表于 2003-07-17 16:00 |只看该作者

请教trap用法,求signal信号列表

#define SIGHUP     1    /* hangup, generated when terminal disconnects */
#define SIGINT     2    /* interrupt, generated from terminal special char */
#define SIGQUIT    3    /* (*) quit, generated from terminal special char */
#define SIGILL     4    /* (*) illegal instruction (not reset when caught)*/
#define SIGTRAP    5    /* (*) trace trap (not reset when caught) */
#define SIGABRT    6    /* (*) abort process */
#define SIGEMT     7    /* EMT intruction */
#define SIGFPE     8    /* (*) floating point exception */
#define SIGKILL    9    /* kill (cannot be caught or ignored) */
#define SIGBUS    10    /* (*) bus error (specification exception) */
#define SIGSEGV   11    /* (*) segmentation violation */
#define SIGSYS    12    /* (*) bad argument to system call */
#define SIGPIPE   13    /* write on a pipe with no one to read it */
#define SIGALRM   14    /* alarm clock timeout */
#define SIGTERM   15    /* software termination signal */
#define SIGURG    16    /* (+) urgent contition on I/O channel */
#define SIGSTOP   17    /* (@) stop (cannot be caught or ignored) */
#define SIGTSTP   18    /* (@) interactive stop */
#define SIGCONT   19    /* (!) continue (cannot be caught or ignored) */
#define SIGCHLD   20    /* (+) sent to parent on child stop or exit */
#define SIGTTIN   21    /* (@) background read attempted from control terminal*/
#define SIGTTOU   22    /* (@) background write attempted to control terminal */
#define SIGIO     23    /* (+) I/O possible, or completed */
#define SIGXCPU   24    /* cpu time limit exceeded (see setrlimit()) */
#define SIGXFSZ   25    /* file size limit exceeded (see setrlimit()) */
#define SIGMSG    27    /* input data is in the ring buffer */
#define SIGWINCH  28    /* (+) window size changed */
#define SIGPWR    29    /* (+) power-fail restart */
#define SIGUSR1   30    /* user defined signal 1 */
#define SIGUSR2   31    /* user defined signal 2 */
#define SIGPROF   32    /* profiling time alarm (see setitimer) */
#define SIGDANGER 33    /* system crash imminent; free up some page space */
#define SIGVTALRM 34    /* virtual time alarm (see setitimer) */
#define SIGMIGRATE 35   /* migrate process */
#define SIGPRE    36    /* programming exception */
#define SIGVIRT   37    /* AIX virtual time alarm */
#define SIGALRM1  38    /* m:n condition variables - RESERVED - DON'T USE */
#define SIGWAITING 39   /* m:n scheduling - RESERVED - DON'T USE */
#define SIGCPUFAIL 59   /* Predictive De-configuration of Processors - */
                        /*      RESERVED - DON'T USE */
#define SIGKAP    60    /* keep alive poll from native keyboard */
#define SIGGRANT  SIGKAP /* monitor mode granted */
#define SIGRETRACT 61   /* monitor mode should be relinguished */
#define SIGSOUND  62    /* sound control has completed */
#define SIGSAK    63    /* secure attention key */
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP