Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Writing a Unix Daemon

0 views
Skip to first unread message

NS

unread,
May 18, 2006, 11:53:24 PM5/18/06
to
Hi,
I am trying to write a UNIX daemon and I happened to come across a
sample at this link: http://www.enderunix.org/docs/eng/daemon.php

I downloaded the examped.c program and when I trying to compile it I
keep getting the following error message (since we don't have the C
compiler installed I had to use gcc compiler). The UNIX OS that I am
using is Sun 5.9

Start of error message
-----------------------------------------------------------------------------------------------------------------------------------------------------
In file included from
/tool/depot/cygnus-95q4/lib/gcc-lib/sparc-sun-solaris2.5/2.7-95q4/include/time.h:90,
from /usr/include/sys/time.h:418,
from /usr/include/sys/select.h:20,
from
/tool/depot/cygnus-95q4/lib/gcc-lib/sparc-sun-solaris2.5/2.7-95q4/include/sys/types.h:278,
from /usr/include/fcntl.h:23,
from examped.c:14:
/usr/include/sys/siginfo.h:74: syntax error before `pthread_attr_t'
In file included from
/tool/depot/cygnus-95q4/lib/gcc-lib/sparc-sun-solaris2.5/2.7-95q4/include/time.h:90,
from /usr/include/sys/time.h:418,
from /usr/include/sys/select.h:20,
from
/tool/depot/cygnus-95q4/lib/gcc-lib/sparc-sun-solaris2.5/2.7-95q4/include/sys/types.h:278,
from /usr/include/fcntl.h:23,
from examped.c:14:
/usr/include/sys/siginfo.h:284: syntax error before `int32_t'
/usr/include/sys/siginfo.h:415: syntax error before `int32_t'
-----------------------------------------------------------------------------------------------------------------------------------------------------
End of error message


I am essentially trying to build a daemon that can sense changes made
to a particular file and then do some actions based on the type of
change made to that file.

Any help in this matter is greatly appreciated.


Thanks,
NS

Gordon Burditt

unread,
May 19, 2006, 1:07:14 AM5/19/06
to
> I am trying to write a UNIX daemon and I happened to come across a
>sample at this link: http://www.enderunix.org/docs/eng/daemon.php
>
> I downloaded the examped.c program and when I trying to compile it I
>keep getting the following error message (since we don't have the C
>compiler installed I had to use gcc compiler). The UNIX OS that I am
>using is Sun 5.9

If you get syntax errors in system include files, it probably means
that you forgot to include a prerequesite include file FIRST that
defines some typedefs. <sys/types.h> is often a prerequesite for <sys/*.h>.

What include file defines int32_t (<inttypes.h>?) and pthread_attr_t?

Gordon L. Burditt

Spoon

unread,
May 19, 2006, 8:19:36 AM5/19/06
to
Gordon Burditt wrote:
> What include file defines int32_t (<inttypes.h>?)

http://www.opengroup.org/onlinepubs/000095399/basedefs/stdint.h.html

> and pthread_attr_t?

http://www.opengroup.org/onlinepubs/000095399/basedefs/sys/types.h.html

NS

unread,
May 19, 2006, 10:24:33 AM5/19/06
to
Gordon and Spoon,
Thanks for your response. I included both <stdint.h> and <sys/types.h>
and when try to compile it I am getting following error.

Start of error message
--------------------------------------------------------------------------------
examped.c:17: stdint.h: No such file or directory
--------------------------------------------------------------------------------
End of error message

Does this mean that I don't have the stdint.h file or am I not
including any prerequisites?

Thanks and really appreciate your help.

Thanks,
NS

NS

unread,
May 19, 2006, 2:12:36 PM5/19/06
to
Hi,
I was able get the examped.c program (which is available at the above
mentioned link) compiled after I followed your suggestions. I had to
include the following headers to compile the sample.

#include </usr/include/sys/types.h>
#include </usr/include/sys/int_types.h>
#include <stdio.h>
#include <fcntl.h>
#include <signal.h>
#include <unistd.h>

Now I am trying to see if I create my own daemon program based on this
example.

As I mentioned earlier, what I am trying to do is to create a daemon
that will watch a specific file and upon any edits to that file, the
daemon will spawn a child process to execute certain tasks based on the
type of modification done the file and then report back to the daemon
server.

Since I am very new to writing daemons, if you could give me some
pointers or examples on how to achieve what I described, it would have
great help.

Thanks again,
NS

0 new messages