Thanks William, you tell me (and help me) a lot.<br><br>So looks I will output the trace to a socket port and create a receiver to write it to disk.<br><br>Cheers,<br><br>Arthur<br><br><div><span class="gmail_quote">On 10/9/07, 
<b class="gmail_sendername">William Ahern</b> &lt;<a href="mailto:william@25thandclement.com">william@25thandclement.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Tue, Oct 09, 2007 at 11:06:21AM -0400, arthur zhang wrote:<br>&gt; Hi All,<br>&gt;<br>&gt; As my understanding, with libevent, any io should be non_blocking, and here<br>&gt; comes my dumb q;-)<br>&gt;<br>&gt; I want log stuffs(trace) to a disk file in my comm callback, so I open a
<br>&gt; file like below, but I didn&#39;t get any write event to call back. I am using<br>&gt; Ubuntu Dapper and my target system is Solaris 10.<br><br>1) You can&#39;t do non-blocking file I/O in Unix using the standard interfaces.
<br>&nbsp;&nbsp; You need to use a horrible and poorly implemented interfaces like POSIX<br>&nbsp;&nbsp; Asynchronous I/O, which is impossible to use with libevent.<br><br>2) A file descriptor (to a realfile) will _always_ poll as ready for reading
<br>&nbsp;&nbsp; or writing.&nbsp;&nbsp;(The logic being, even though the disk might be slow, it&#39;s<br>&nbsp;&nbsp; still always available for I/O--the disk is one gigantic buffer.) Thus,<br>&nbsp;&nbsp; if your code was written properly your complaint should have been that
<br>&nbsp;&nbsp; you got an endless succession of write readiness callbacks suspicously<br>&nbsp;&nbsp; lacking any gap.<br><br>&gt; Using stdout worked.<br><br>If stdout was a pipe, then it would work. Thus, you could shamefully (but<br>with good reason) pipe to cat, and redirect cat&#39;s stdout to a file.
<br></blockquote></div><br>