Re: basic signal problem

From: amsa (amsavarthini_at_yahoo.com)
Date: 08/24/04


Date: 23 Aug 2004 21:35:59 -0700

Hi All,

Thanks for all your help. But I Dont understand one thing in signals.
Signals, like pipes and FIFO's are also used for communication of data
within processes. But learning signals, i feel it is more of error
handling b/w the process-kernel. How is this used for communication
b/w 2 processes (forget the 'kill' system call) ?

'kill' system call is used for communication b/w 2 processes...but why
the name 'kill'...it doesnt represent a meaningful name (i am just
curious abt this system call).

amsa.

"Kurtis D. Rader" <krader@skepticism.us> wrote in message news:<pan.2004.08.22.15.39.55.778962@skepticism.us>...
> On Sun, 22 Aug 2004 02:44:31 -0700, amsa wrote:
>
> > main()
> > {
> > int i=0,j=50;
> > signal(SIGILL, sigkey)
> > j=j/i;
> > }
> >
> > void sigkey(signo)
> > int signo
> > {
> > printf("\n process recieved signal :%d",signo); exit(0);
> > }
> >
> > here actually SIGILL (illegal instruction code) should be passed from
> > the kernel 'cause of DIVIDE-BY-ZERO and such that function sigkey should
> > be called. but that doesnt happen...it gives the output "Floating Point
> > Exception".
>
> Why would you expect SIGILL. Assuming your compiler isn't broken your
> program won't contain an illegal opcode (i.e., machine instruction). There
> isn't a signal for invalid mathematical operations involving integers.
> Instead the kernel uses SIGFPE (floating point exception) for invalid
> operations that involve either floating point or integer operands.
>
> > my 2nd problem:
> >
> > main()
> > {
> > int fd;
> > signal(SIGSYS,abc);
> > fd=open("somefile",O_RDONLY);
> > lseek(fd,0,5);
> > }
> > }
> > void abc()
> > {
> > printf("\n illegal use of system call\n"); exit(0);
> > }
> > }
> > here the function abc should be called, because lseek cannot have 5 as
> > the 3rd parameter. so signal SIGSYS should be passed... but nothing
> > happens...why.
>
> Your man page probably says something like "bad argument to routine" as
> the reason for SIGSYS. But I've never seen a UNIX implementation which
> does that. All the ones I've ever worked with raise SIGSYS only for the
> case where it doesn't recognize the system call being made by the process.
> Invalid arguments will result in a return code of -1 with errno set to
> EINVAL or EFAULT for most syscalls (there are exceptions to this rule so
> read the documentation for the syscall you're concerned about).



Relevant Pages

  • Re: Is Bohm Hidden Variables discredited or not? How?
    ... EPR is local hidden varible where the spins are already ... > However upon measurement, a non-local communication takes ... In QM there is no signal mediating the photon entanglement. ... is not a signal in the sense that I understand signals. ...
    (sci.physics)
  • Re: Is Bohm Hidden Variables discredited or not? How?
    ... EPR is local hidden varible where the spins are already ... >> However upon measurement, a non-local communication takes ... > In QM there is no signal mediating the photon entanglement. ... > is not a signal in the sense that I understand signals. ...
    (sci.physics)
  • Re: genes and language (Homer, Richard Dawkins)
    ... replies to me? ... > every means of getting such help may be called language. ... > tail and give other body signals. ... > All those signals together may be called communication. ...
    (sci.lang)
  • Re: genes and language (Homer, Richard Dawkins)
    ... replies to me? ... > every means of getting such help may be called language. ... > tail and give other body signals. ... > All those signals together may be called communication. ...
    (sci.archaeology)
  • Re: Abolishing sleeps in issignal()
    ... This is fine for signals that would normally abort the sleep anyway, but SIGSTOP actually leaves the thread on the sleep queue and tries to resume the sleep after the stop has cleared. ... For non-restartable syscalls we could have a special issignal variant that is called when msleep/cv_timedwait_sig return interrupted that would check for SIGSTOP/debugger events and sleep within a loop retrying the operation. ...
    (freebsd-arch)