Thanks everyone. For application side, it looks the behavior (how unread data should be handled on close(2)) is something like "implementation-defined." I'll try to put some workaround into the application. ("tcflush(s, TCIOFLUSH)" might work around) --- Izumi Tsutsui