:: Re: [DNG] High level language primi…
Top Page
Delete this message
Reply to this message
Author: Enrico Weigelt, metux IT consult
Date:  
To: dng
Subject: Re: [DNG] High level language primitives [ was Please keep 32-bits alive]
On 27.07.2017 08:22, Didier Kryn wrote:

> At first glance at least, it means that file offsets are managed in the
> kernel or VFS


Of course they are. That's required for any sane multiprocessing
implementation. And some files/devices don't even have the notion
of a current position (IOW: not seekable at all).

> but they can be bypassed by pwrite(). AFAIR pwrite()
> doesn't change the "current" file offset; it simply ignores and bypasses
> it, which isn't exactly what your example does.


Yes, that's an separate syscall for direct access. Simple streams
(eg. tty's, pipes, stream sockets, etc) usually don't support it.

> Using unistd's read() and write() in C means you are dealing with low
> level issues; otherwise why would you bother with the complexity it
> introduces - not only you need to deal with buffering but also with
> retries when interrupted by signals.


Usually you wanna care about signals - they actually mean something.
The ansi stream functions might or might not make it easier - depending
on your actual usecase. If you care about performance, you likely
don't wanna use them.

--mtx