Title: | DIGITAL UNIX (FORMERLY KNOWN AS DEC OSF/1) |
Notice: | Welcome to the Digital UNIX Conference |
Moderator: | SMURF::DENHAM |
Created: | Thu Mar 16 1995 |
Last Modified: | Fri Jun 06 1997 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 10068 |
Total number of notes: | 35879 |
I have a question regarding signal handling. A time watch program sends a signal once to a copy program. The copy program uses ftp to copy programs from remote sites. The signal is sent via socket. If this copy program receives a signal, it will stop. But if this copy program is in the middle of copying, it should wait to stop until finish copying. For this signal handling, signal() is used. But because of spec. of socket's select function, ftp gets this signal instead of the copy program and disconnects the link. So I used sigblock() to block the signal as follows: signal(SIGUSR2, function) . . . for (3) { . . . mask=0 mask = sigmask(SIGUSR2) org = sigblock(mask) for (n) { cftp_get_file . . . } sigblock(org) } I want to get the signal while copying. Is it possible to get this signal from stack? Or is there anyway to get back the signal from sigblock() ? I do not want to change the program structure much because this program is customer's. Thanks in advance. Yoji
T.R | Title | User | Personal Name | Date | Lines |
---|---|---|---|---|---|
9124.1 | SMURF::DENHAM | Digital UNIX Kernel | Wed Mar 12 1997 20:58 | 18 | |
I'm really not sure that I understand the question, so I'll answer what I think you might be asking. Blocking the signal doesn't make it go away, only ignoring (or taking) the signal does that. Blocking it forces it to be held until such time that the signal becomes unblocked. The return from the sigblock call that restores the original mask will initiated the delivery of the signal. OK, so what was the real question. BTW, the prefered interface for blocking signals is the POSIX function sigprocmask(). It uses a sigset_t, which covers all 48 supported signals. Sigblock and friends only deal\ with the original 32 signals. Which is usually good enough. But if this code will ever be ported to other UNIXes, use the POSIX interfaces. |