seeking into /dev/{null,zero}

Alexander Best arundel at freebsd.org
Tue Feb 22 14:11:12 UTC 2011


hi there,

there's a PR [1] regarding seeking into /dev/null and /dev/zero. i just wanted
to ask what the overall opinion is on this matter. technically it's quite easy
to seek into those files upon fwrite(3) and fread(3). the point is, if the file
position should be repositioned according the the amount of bytes read or
written.

the zero(4) and null(4) manual pages claim that both devices act as "ordinary"
files. right now only reading from /dev/zero will seek into the file. writing
to /dev/zero and reading/writing to /dev/null will *not* adjust the file
position.

cheers.
alex

[1] http://www.freebsd.org/cgi/query-pr.cgi?pr=misc/152485

ps: i might also be worth thinking about turning null(4) and zero(4) into a
single manual page, since their contents seem quite similar.

-- 
a13x


More information about the freebsd-hackers mailing list