<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7651.59">
<TITLE>running as a forked process errors out</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P><FONT SIZE=2 FACE="Arial">I have a simple app that I tried to convert to run as a daemon.</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">This is on Solaris and when i do the fork() I get the following error from the event_dispatch()</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">&nbsp;ioctl: DP_POLL: Permission denied</FONT>

<BR><FONT SIZE=2 FACE="Arial">event_dispatch received an error of -1</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">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 SIZE=2 FACE="Arial">I've tried the following</FONT>
</P>
<BR>

<P><FONT SIZE=2 FACE="Arial">if( fork() ) {</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp; exit(0);</FONT>

<BR><FONT SIZE=2 FACE="Arial">}</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">setsid();</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">if( fork() ) {</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp; exit(0);</FONT>

<BR><FONT SIZE=2 FACE="Arial">}</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">then do the rest of the code....</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">the 2 forks are recommended in all of the popular texts (i.e.&nbsp; Stevens )...</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">thanks for any help,</FONT>

<BR><FONT SIZE=2 FACE="Arial">bobm</FONT>
</P>
<BR>

</BODY>
</HTML>