Unix Programming - Is there an ANSI C compatible kill()?

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > January 2008 > Is there an ANSI C compatible kill()?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Is there an ANSI C compatible kill()?
David Mathog

2008-01-04, 7:21 pm

A program which uses fork(), select() etc. had been compiling cleanly with

gcc -Wall -pedantic -std=c99

but when I added a call to kill() the compiler emitted an:

implicit declaration of function 'kill'

which only went away when this was added:

-D_POSIX_SOURCE

Since ANSI C is apparently happy with fork() and fork returns the pid
of the child process, does ANSI C not also provide some other method
(ie, not kill()) to send a signal to the child? I'm aware of raise(),
but that only sends a signal from the process to itself.

Thanks,

David Mathog
Måns Rullgård

2008-01-04, 7:21 pm

David Mathog <mathog@caltech.edu> writes:

> A program which uses fork(), select() etc. had been compiling cleanly with
>
> gcc -Wall -pedantic -std=c99
>
> but when I added a call to kill() the compiler emitted an:
>
> implicit declaration of function 'kill'
>
> which only went away when this was added:
>
> -D_POSIX_SOURCE
>
> Since ANSI C is apparently happy with fork() and fork returns the pid
> of the child process, does ANSI C not also provide some other method
> (ie, not kill()) to send a signal to the child? I'm aware of raise(),
> but that only sends a signal from the process to itself.


ANSI (ISO) C includes neither fork() nor select(). That gcc doesn't
complain only means that your system headers include prototypes for
these functions regardless of compiler flags.

--
Måns Rullgård
mans@mansr.com
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com