[erlang-questions] Using select in a Port

jm jeffm@REDACTED
Wed Oct 24 05:40:42 CEST 2007


jm wrote:
> Per Hedeland wrote:
>> jm <jeffm@REDACTED> wrote:
>>> it appears somthing is causing erlang to close stdin to the port,
>> Yes, that was pretty clear from your earlier results.
> 
> Just had to prove it.

In continuing to debug this port program I recompile with debug enabled 
(-g) and attached gdb to the running process which resulted in it 
writting to a broken pipe as shown

205             while (size < len) {
(gdb) n
207               event = (struct inotify_event *) &buf[i];
(gdb) n
208               size += EVENT_SIZE + event->len;
(gdb) n
211               fprintf(stderr, "encoding event wd=%d, mask=%d, 
cookie=%d, len=%d, name=%s\r\n",
(gdb) n
214               if (ei_x_new_with_version(&result) ||
(gdb) n
216               ei_x_encode_atom(&result, "event"); 
       /* element 1 */
(gdb) n
217               ei_x_encode_ulong(&result, event->wd); 
       /* element 2 */
(gdb) print result
$1 = {buff = 0x804e018 "\203h\005d", buffsz = 203, index = 11}
(gdb) n
219               ei_x_encode_atom(&result, "mask");
(gdb) n
220               ei_x_encode_ulong(&result, event->cookie); 
       /* element 4 */
(gdb) n
221               ei_x_encode_string_len(&result, event->name, 
event->len);   /* element 5 */
(gdb) n
222               fprintf(stderr, "note_read send event\r\n");
(gdb) n
223               write_cmd(&result);
(gdb) n

Program received signal SIGPIPE, Broken pipe.
0xb7e8dbde in write () from /lib/libc.so.6
(gdb)



Jeff.



More information about the erlang-questions mailing list