Is there any way to figure out what process sent a signal

Is there any way to figure out what process sent a signal

Post by Denismo » Wed, 18 Dec 1996 04:00:00



I have some processes receiving kill signals, but I have not
been able to identify where they were coming from.
Is there a way to find out the process id of the signal sender....

Thanks for helping.

Denis Montandon

 
 
 

Is there any way to figure out what process sent a signal

Post by Boyd Rober » Thu, 19 Dec 1996 04:00:00



Quote:

>Is there a way to find out the process id of the signal sender....

No.  Signals were never intended for IPC.

--

``Not only is UNIX dead, but it's starting to smell really bad.''  -- rob

 
 
 

Is there any way to figure out what process sent a signal

Post by Can Eking » Sat, 21 Dec 1996 04:00:00



>>Is there a way to find out the process id of the signal sender....

 use sigaction with SA_SIGINFO flag. In signal handler you can read siginfo
structure.

C.EKINGEN

 
 
 

Is there any way to figure out what process sent a signal

Post by Gordon Burdi » Mon, 30 Dec 1996 04:00:00


Quote:>>Is there a way to find out the process id of the signal sender....

No.  The signal sender also need not even HAVE a process id.
Some signals originate from characters typed at a tty, loss
of carrier detect, or closing a net connection.
Some signals originate from timers (although I suppose here
the process could be said to have sent itself the signal).

                                        Gordon L. Burditt
                                        sneaky.lerctr.org!gordon

 
 
 

1. sending signal sends -1 to the receiving process (question)

Hello,
  I have a question regarding signals.  This question occurs to me when
I'm trying to write a curses based package.  I'd like certain area on
the screen to blink, but SUN terminal does not support blinking (am I right?),
so I produce a child process and have the child process interrupt the parent
process, say, every 0.2 seconds, and then certain area on the screen changes
state accordingly (A related problem is, the visual effect produced in this way
is not really pleasing, is there any way to get around the problem?).  The
problem comes in when I notice that the parent process keeps receiving unwanted
characters.  This I did not know before; it looks like when a process sends a
signal to another process, it puts something in the other process's input
stream as well.  I tried to write a very much simplified program and then I
realized the problem has nothing to do with the cursor package.  I can get
around the problem because the unwanted character is always (char)(-1), so
I simply ignore that, but still I'm wondering what is the reason for this.
Anyone care to explain?  The programs are appended.
  BTW, if it is relevant, I'm using a SPARC IPC running SunOS 4.1 and
compiled the programs with /usr/5bin/cc and relevant libraries & includes,
where appropriate.
  Thanks in advance,
        Lite

========================================================================
#include <signal.h>

void blink();

main()
{
  int pid;
  char ch;

  if ((pid=fork()) == -1) {  /* forks off a process which would interrupt
                                once in a while; help do blinking */
    perror("fork");
    exit(1);
  }
  else if (pid == 0) {
    execl("/sol3/cs1/lin/599/sysv-nopad/nap", "nap", "2000000", (char *)0);
    perror("execl");
  }
  else
    signal(SIGALRM, blink);
  while (ch=getchar()) {
    printf("%d\n", ch); /* this prints -1 */
    printf("%c", ch);
  }

void blink()
{
  signal(SIGALRM, blink);
========================================================================

#include <signal.h> /* the "nap" program */
#include <sys/types.h>
#include <stdio.h>

main(argc, argv, envp)
int argc;
char *argv[], *envp[];
{
  int usec = 0;
  char *ptr;
  int ppid;

  ppid = getppid();
  ptr = argv[1];
  while (*ptr) {
    usec = usec*10 + *ptr - '0';
    ptr++;
  }
  for (;;) {
    usleep(usec);
    kill(ppid, SIGALRM);
  }

2. Can't allocate colors for 16 bit display - works for 8 bits

3. Can a signal be sent to process when another process dies or stops?

4. Free Beer for All Linuxers!

5. Ways to figure out what started a diald

6. Help with permissions

7. How does one send stop/start signals to a process?

8. mkfs.ext2 fails even after fdisk

9. Hang on "Sending all processes the TERM signal"

10. how to send control-break(ctrl-c) signal to a background process?

11. Any function like sigsend() for device driver to send signal to a specific process?

12. Sending signals to process running /etc/rc

13. alllow only a no. of users to send signal to a process, how ?