Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

266
Visualizações
What key combinations are associated with signals

I am writing some perl scripts and I want to utilize signals to perform certain routines at any time. I see all over the place the ability to print out what the signals are,

perl -e 'foreach (keys %SIG) { print "$_\n" }'

and I have already been using "INT" to go to a subroutine which is activated with ctrl+c.

I cant find anywhere what key combinations are associated with the other signals. Is there a list somewhere? The script I'm writing should work on mac and linux computers.

I know the ctrl+c signal is analogous between systems, what other "signals" can be utilized in perl and what keys activate them?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

what other "signals" can be utilized in perl

These are the signal names recognized by Perl:

$ perl -V:sig_name
sig_name='ZERO HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH IO PWR SYS NUM32 NUM33 RTMIN NUM35 NUM36 NUM37 NUM38 NUM39 NUM40 NUM41 NUM42 NUM43 NUM44 NUM45 NUM46 NUM4 NUM48 NUM49 NUM50 NUM51 NUM52 NUM53 NUM54 NUM55 NUM56 NUM57 NUM58 NUM59 NUM60 NUM61 NUM62 NUM63 RTMAX IOT CLD POLL UNUSED ';

The above list can also be obtained from Config.pm's $Config{sig_name}.

There's also the two pseudo signals, __WARN__ and __DIE__.

and what keys activate them?

The following signals are often sent in response to terminal input:

  • SIGINT
  • SIGQUIT is a more "serious" version of SIGINT that provides a core dump.
  • SIGTSTP sends a process to the background.
  • SIGSTOP is an uncatchable signal that freezes the process.
  • SIGCONT resumes a process frozen by SIGSTOP.

You can see to what key these are bound using the following:

$ stty -a | perl -ne'
   $b{$1}=$2 while /\b(intr|quit|susp|stop|start)\s*=\s*([^\s;]+)/g;
   END {
      print "SIGINT:  $b{intr}\n";
      print "SIGQUIT: $b{quit}\n";
      print "SIGTSTP: $b{susp}\n";
      print "SIGSTOP: $b{stop}\n";
      print "SIGCONT: $b{start}\n";
   }
'
SIGINT:  ^C
SIGQUIT: ^\
SIGTSTP: ^Z
SIGSTOP: ^S
SIGCONT: ^Q

Most signals aren't sent as a result of terminal input. The following a commonly used signals and what normally causes them to be sent:

  • SIGSEGV is sent when the program does an illegal operation (often the result of using a bad pointer).
  • SIGHUP is sent when the session's terminal disconnects.
  • SIGTERM is sent to request that a process exits.
  • SIGKILL can't be caught. It's sent to forcibly terminate a process.
  • SIGCHLD is sent when a child exits.
  • SIGALRM is sent by alarm.
  • SIGPIPE is sent when writing a pipe with a closed read end.
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda