Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

140
Views
¿Por qué no puedo iniciar el comando superior en modo por lotes, detenerlo y luego reanudarlo con fg?

No sé por qué, así que me gustaría preguntarle a Gen...

$top -b

y luego Ctrl + Z para detenerlo, y luego presione

fg %1(jobID)

no funciona como se desea. La pantalla parece estar rota y, sobre todo, no acepta entradas como Ctrl + C. Si sabe por qué, hágamelo saber...

(Primer comentario)

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Parece que es un pequeño error en top .

Ver código fuente top.c :

 645 /* 646 * Catches: 647 * SIGTSTP, SIGTTIN and SIGTTOU */ 648 static void sig_paused (int dont_care_sig) { 661 fflush(stdout); 662 raise(SIGSTOP); 663 // later, after SIGCONT... 664 if (-1 == tcsetattr(STDIN_FILENO, TCSAFLUSH, &Tty_raw)) 665 error_exit(fmtmk(N_fmt(FAIL_tty_set_fmt), strerror(errno))); 666 #ifndef RMAN_IGNORED 667 putp(Cap_rmam); 668 #endif 669 if (keypad_xmit) putp(keypad_xmit); 670 putp(Cursor_state); 671 Frames_signal = BREAK_sig; 672 (void)dont_care_sig; 673 } // end: sig_paused ... 3798 // lastly, establish a robust signals environment 3799 memset(&sa, 0, sizeof(sa)); 3800 sigemptyset(&sa.sa_mask); 3801 //with user position preserved through SIGWINCH,we must avoid SA_RESTART 3802 sa.sa_flags = 0; 3803 for (i = SIGRTMAX; i; i--) { 3804 switch (i) { .... 3810 case SIGTSTP: case SIGTTIN: case SIGTTOU: 3811 sa.sa_handler = sig_paused; 3812 break; .... 3823 } 3824 sigaction(i, &sa, NULL); 3825 }

Esto es lo que pasa:

  1. En la línea 3810, top registra explícitamente su controlador SIGTSTP sig_paused() .
  2. Cuando se presiona CTRL-Z, envía SIGTSTP a top -b .
  3. Cuando top recibe SIGTSTP, en sig_paused() se detiene enviando SIGSTOP (línea 662).
  4. fg envía SIGCONT al top y lo activa.
  5. En la línea 664, cuando se activa top , pone el tty en modo sin procesar (no debería hacer esto cuando se especifica -b ) .
  6. Cuando el tty está en modo sin procesar , las teclas como CTRL-C no generarán SIGINT, por lo que CTRL-C no puede eliminarlo.
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!