<div>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. </div>
<div> </div>
<div>From poll(7d):<br> </div>
<div> The /dev/poll driver caches a list of polled file descrip-<br> tors, which are specific to a process. Therefore, the<br> /dev/poll file descriptor of a process will be inherited by<br> its child process, just like any other file descriptors. But
<br> the child process will have very limited access through this<br> inherited /dev/poll file descriptor. Any attempt to write or<br> do ioctl by the child process will result in an EACCES<br> error. The child process should close the inherited
<br> /dev/poll file descriptor and open its own if desired.</div>
<div>
<p>Andrew</p>
<p><br><span class="gmail_quote">On 8/24/07, <b class="gmail_sendername">Bob Maccione</b> <<a href="mailto:Bob.Maccione@hilton.com">Bob.Maccione@hilton.com</a>> wrote:</span></p></div>
<div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>
<p><font face="Arial" size="2">I have a simple app that I tried to convert to run as a daemon.</font> </p>
<p><font face="Arial" size="2">This is on Solaris and when i do the fork() I get the following error from the event_dispatch()</font> </p>
<p><font face="Arial" size="2"> ioctl: DP_POLL: Permission denied</font> <br><font face="Arial" size="2">event_dispatch received an error of -1</font> </p>
<p><font face="Arial" size="2">I'm wondering if anyone has seen this before or has working daemon code that they would be willing to share..</font> </p>
<p><font face="Arial" size="2">I've tried the following</font> </p><br>
<p><font face="Arial" size="2">if( fork() ) {</font> <br><font face="Arial" size="2"> exit(0);</font> <br><font face="Arial" size="2">}</font> </p>
<p><font face="Arial" size="2">setsid();</font> </p>
<p><font face="Arial" size="2">if( fork() ) {</font> <br><font face="Arial" size="2"> exit(0);</font> <br><font face="Arial" size="2">}</font> </p>
<p><font face="Arial" size="2">then do the rest of the code....</font> </p>
<p><font face="Arial" size="2">the 2 forks are recommended in all of the popular texts (i.e. Stevens )...</font> </p>
<p><font face="Arial" size="2">thanks for any help,</font> <br><font face="Arial" size="2">bobm</font> </p><br> </div><br>_______________________________________________<br>Libevent-users mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:Libevent-users@monkey.org">
Libevent-users@monkey.org</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://monkey.org/mailman/listinfo/libevent-users" target="_blank">http://monkey.org/mailman/listinfo/libevent-users</a><br>
<br></blockquote></div><br>