<div>You need do all your forking before you call event_init.&nbsp; libevent on Solaris uses /dev/poll, and /dev/poll doesn&#39;t support children inheriting a parent&#39;s /dev/poll file descriptor.&nbsp;&nbsp;</div>
<div>&nbsp;</div>
<div>From&nbsp;poll(7d):<br>&nbsp;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp; The /dev/poll driver caches a list of polled&nbsp; file&nbsp; descrip-<br>&nbsp;&nbsp;&nbsp;&nbsp; tors,&nbsp; which&nbsp; are&nbsp;&nbsp; specific&nbsp; to&nbsp; a&nbsp; process. Therefore, the<br>&nbsp;&nbsp;&nbsp;&nbsp; /dev/poll file descriptor of a process will be inherited&nbsp; by<br>&nbsp;&nbsp;&nbsp;&nbsp; its child process, just like any other file descriptors. But
<br>&nbsp;&nbsp;&nbsp;&nbsp; the child process will have very limited access through this<br>&nbsp;&nbsp;&nbsp;&nbsp; inherited /dev/poll file descriptor. Any attempt to write or<br>&nbsp;&nbsp;&nbsp;&nbsp; do ioctl by the child&nbsp; process&nbsp; will&nbsp; result&nbsp; in&nbsp; an&nbsp; EACCES<br>&nbsp;&nbsp;&nbsp;&nbsp; error.&nbsp;&nbsp; The&nbsp;&nbsp; child&nbsp; process&nbsp; should&nbsp; close&nbsp; the&nbsp; inherited
<br>&nbsp;&nbsp;&nbsp;&nbsp; /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> &lt;<a href="mailto:Bob.Maccione@hilton.com">Bob.Maccione@hilton.com</a>&gt; 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">&nbsp;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&#39;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&#39;ve tried the following</font> </p><br>
<p><font face="Arial" size="2">if( fork() ) {</font> <br><font face="Arial" size="2">&nbsp; 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">&nbsp; 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.&nbsp; Stevens )...</font> </p>
<p><font face="Arial" size="2">thanks for any help,</font> <br><font face="Arial" size="2">bobm</font> </p><br>&nbsp;</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>