You need do all your forking before you call event_init.  libevent on
Solaris uses /dev/poll, and /dev/poll doesn't support children inheriting a
parent's /dev/poll file descriptor.

>From poll(7d):

     The /dev/poll driver caches a list of polled  file  descrip-
     tors,  which  are   specific  to  a  process. Therefore, the
     /dev/poll file descriptor of a process will be inherited  by
     its child process, just like any other file descriptors. But
     the child process will have very limited access through this
     inherited /dev/poll file descriptor. Any attempt to write or
     do ioctl by the child  process  will  result  in  an  EACCES
     error.   The   child  process  should  close  the  inherited
     /dev/poll file descriptor and open its own if desired.

Andrew


On 8/24/07, Bob Maccione <[EMAIL PROTECTED]> wrote:

>  I have a simple app that I tried to convert to run as a daemon.
>
> This is on Solaris and when i do the fork() I get the following error from
> the event_dispatch()
>
>  ioctl: DP_POLL: Permission denied
> event_dispatch received an error of -1
>
> I'm wondering if anyone has seen this before or has working daemon code
> that they would be willing to share..
>
> I've tried the following
>
> if( fork() ) {
>   exit(0);
> }
>
> setsid();
>
> if( fork() ) {
>   exit(0);
> }
>
> then do the rest of the code....
>
> the 2 forks are recommended in all of the popular texts (i.e.  Stevens
> )...
>
> thanks for any help,
> bobm
>
>
>
> _______________________________________________
> Libevent-users mailing list
> Libevent-users@monkey.org
> http://monkey.org/mailman/listinfo/libevent-users
>
>
_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users

Reply via email to