[Previo por Fecha] [Siguiente por Fecha] [Previo por Hilo] [Siguiente por Hilo]
[Hilos de Discusión] [Fecha] [Tema] [Autor]On Wed, 29 May 2002, Carlos Castaños wrote: > "ROLANDO HERMIDA." escribió: > > > SALUDOS: EN KILL-9 ¿QUE SIGNIFICA EL > > 9? > > GRACIAS. No, me encanta la respuesta. Kill es un programa que manda señales a los procesos. Las señales activan handlers dentro del programa, que hacen que reaccione de cierta manera. Por ejemplo, si a un servidor le envias la señal SIGHUP (Hang UP), lo más común es que el servidor cargue de nuevo su configuración y haga reset. Las señales son un invento de BSD, según recuerdo, y se usan sobre todo para comunicarse con procesos que no tienen una terminal asociada (como los demonios). Cada señal tiene un número. Para ver todas las señales que hay, da el comando kill -l. Ahora, hay ciertas señales que un programa no puede cachar: $ kill -l 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR1 11) SIGSEGV 12) SIGUSR2 13) SIGPIPE 14) SIGALRM 15) SIGTERM 17) SIGCHLD 18) SIGCONT 19) SIGSTOP 20) SIGTSTP 21) SIGTTIN 22) SIGTTOU 23) SIGURG 24) SIGXCPU 25) SIGXFSZ 26) SIGVTALRM 27) SIGPROF 28) SIGWINCH 29) SIGIO 30) SIGPWR 31) SIGSYS Cuando das kill proceso, se selecciona por default SIGINT (INTerrupt, la 2), la cual es cachable. Por convención, SIGINT termina el proceso, pero bajo el control de éste: o sea, es una manera de pedirle que termine. Cuando se recibe una señal cachable, pero no hay handler asignado, el programa termina. Cuando das kill -9 proceso, estás llamando a SIGTERM (TERMinate, la 9). SIGTERM no se puede cachar, y provoca que el kernel mate el proceso. Pero, como el proceso no puede controlar su terminación, puede que sus archivos de recursos, locks, memoria compartida o lo que sea que use, queden bloqueados. Siempre es bueno dar kill con SIGINT, antes de usar SIGTERM. Cosas interesantes: - si mandas a un proceso la señal 11 (SIGSEGV), harás que se caiga con segmentation fault y genere un core, si la opción estaba activada. Esto te permite examinar el estado de una aplicación en el momento que le enviaste la señal. Esta señal no es cachable. - SIGBUS se genera cuando se manipula memoria con la alineación incorrecta y otro tipo de casos relacionados. No cachable. - SIGFPE sucede cuando haces matemáticas inválidas de punto flotante. Creo que es cachable. - SIGPIPE se genera cuando un proceso al que enviabas datos por un pipe anónimo ha muerto. Lo puedes cachar para que tu programa pueda manejar el error emergente. - SIGINT es lo mismo que ^C - SIGSTOP es lo mismo que ^Z - SIGCONT es usado por fg y bg - SIGALRM se usa mucho para pedir al kernel que envie esa señal cada cierto tiempo. Mas info en tu libro básico de UNIX más cercano. Saludos, Arturo > NAME > kill - terminate a process > > SYNOPSIS > kill [ -s signal | -p ] [ -a ] [ -- ] pid ... > kill -l [ signal ] > > DESCRIPTION > The command kill sends the specified signal to the speci > fied process or process group. If no signal is specified, > the TERM signal is sent. The TERM signal will kill pro > cesses which do not catch this signal. For other pro > cesses, it may be necessary to use the KILL (9) signal, > since this signal cannot be caught. > > Most modern shells have a builtin kill function, with a > usage rather similar to that of the command described > here. The `-a' and `-p' options, and the possibility to > specify pids by command name is a local extension. > > OPTIONS > pid... Specify the list of processes that kill should sig > nal. Each pid can be one of five things: > > n where n is larger than 0. The process with > pid n will be signaled. > > 0 All processes in the current process group > are signaled. > > -1 All processes with pid larger than 1 will be > signaled. > > -n where n is larger than 1. All processes in > process group n are signaled. When an argu > ment of the form `-n' is given, and it is > meant to denote a process group, either the > signal must be specified first, or the argu > ment must be preceded by a `--' option, oth > erwise it will be taken as the signal to > send. > > commandname > All processes invoked using that name will > be signaled. > > -s signal > Specify the signal to send. The signal may be > given as a signal name or number. > > -l Print a list of signal names. These are found in > /usr/include/linux/signal.h > > -a Do not restrict the commandname-to-pid conversion > to processes with the same uid as the present pro > cess. > > -p Specify that kill should only print the process id > (pid) of the named processes, and not send any sig > nals. > > SEE ALSO > bash(1), tcsh(1), kill(2), sigvec(2), signal(7) > > AUTHOR > Taken from BSD 4.4. The ability to translate process > names to process ids was added by Salvatore Valente <sva > lente en mit edu>. > > Linux Utilities 14 October 1994 KILL(1) > > > Saludos > _______________________________________________ Ayuda mailing list Ayuda en linux org mx Para salir de la lista: http://mail.linux.org.mx/mailman/listinfo/ayuda/