← 返回命令列表

Linux command

sigmap 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Translate SIGWINCH (28) into SIGINT (2)

sigmap -m 28:2 /bin/sleep 30

Forward SIGTERM as SIGHUP

sigmap -m 15:1 [path/to/program] [args]

Remap several signals at once

sigmap -m 1:15 -m 2:15 [path/to/program]

说明

sigmap is a small wrapper that launches a child process and rewrites the signals delivered to it. The wrapper installs a handler for each _from_ signal listed on the command line; when the host kernel delivers _from_ to sigmap, the wrapper instead sends the corresponding _to_ signal to the child. Signals not listed pass through unchanged. This is useful when one process insists on emitting a signal that the wrapped program does not understand, when bridging between shells and applications that disagree on which signal means "reload", or when adapting legacy software to a different supervisor. Because the rewrite happens entirely in the wrapper, the child process sees only the translated signals and needs no modification. sigmap uses execve(2) to spawn the child, so the resolved binary must be a real executable file with a full path. Shell built-ins, aliases, and bare program names that rely on PATH will not work.

参数

-m _from_:_to_, --map=_from_:_to_
Translate signal _from_ into signal _to_ when forwarding to the child process. Both values are integer signal numbers as listed in signal(7). The option may be repeated to install multiple mappings.

FAQ

What is the sigmap command used for?

sigmap is a small wrapper that launches a child process and rewrites the signals delivered to it. The wrapper installs a handler for each _from_ signal listed on the command line; when the host kernel delivers _from_ to sigmap, the wrapper instead sends the corresponding _to_ signal to the child. Signals not listed pass through unchanged. This is useful when one process insists on emitting a signal that the wrapped program does not understand, when bridging between shells and applications that disagree on which signal means "reload", or when adapting legacy software to a different supervisor. Because the rewrite happens entirely in the wrapper, the child process sees only the translated signals and needs no modification. sigmap uses execve(2) to spawn the child, so the resolved binary must be a real executable file with a full path. Shell built-ins, aliases, and bare program names that rely on PATH will not work.

How do I run a basic sigmap example?

Run `sigmap -m 28:2 /bin/sleep 30` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -m _from_:_to_, --map=_from_:_to_ do in sigmap?

Translate signal _from_ into signal _to_ when forwarding to the child process. Both values are integer signal numbers as listed in signal(7). The option may be repeated to install multiple mappings.