* serial device and fsync
@ 2009-05-25 9:50 Ramagudi Naziir
2009-05-25 13:36 ` Alan Cox
0 siblings, 1 reply; 3+ messages in thread
From: Ramagudi Naziir @ 2009-05-25 9:50 UTC (permalink / raw)
To: linux-kernel
Hi all,
I need to write(2) a certain character to a serial device (using the
standard /dev/ttySx), and make sure it was transferred to the device
before I continue. I tried fsync(2), but that failed (does fsync even
apply to character devices or only block devices ?).
Any idea ?
Is it even possible or should I just usleep(500ms) after write(2) ? (I
know, it's ugly..).
Thanks in advance,
Naziir.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: serial device and fsync
2009-05-25 9:50 serial device and fsync Ramagudi Naziir
@ 2009-05-25 13:36 ` Alan Cox
2009-05-25 13:50 ` Ramagudi Naziir
0 siblings, 1 reply; 3+ messages in thread
From: Alan Cox @ 2009-05-25 13:36 UTC (permalink / raw)
To: Ramagudi Naziir; +Cc: linux-kernel
On Mon, 25 May 2009 12:50:22 +0300
Ramagudi Naziir <naziirr@gmail.com> wrote:
> Hi all,
>
> I need to write(2) a certain character to a serial device (using the
> standard /dev/ttySx), and make sure it was transferred to the device
> before I continue. I tried fsync(2), but that failed (does fsync even
> apply to character devices or only block devices ?).
Block devices
>
> Any idea ?
Most hardware UARTs actually can't do this but the kernel will do its
best. The POSIX interface you want is tcdrain(fd). Quite why POSIX didn't
use fsync is a very good question.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-05-25 13:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-25 9:50 serial device and fsync Ramagudi Naziir
2009-05-25 13:36 ` Alan Cox
2009-05-25 13:50 ` Ramagudi Naziir
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).