cdblockedread man page on MirBSD

Man page or keyword search:  
man Server   6113 pages
apropos Keyword Search (all sections)
Output format
MirBSD logo
[printable version]

CDBLOCKEDREAD(3)	   BSD Programmer's Manual	      CDBLOCKEDREAD(3)

NAME
     cdblockedread - seek and read with 2048-byte alignment

SYNOPSIS
     #include <mbfun.h>

     ssize_t
     cdblockedread(int fd, void *dst, size_t len, off_t ofs);

DESCRIPTION
     The cdblockedread() function equals the following calls:

	   lseek(fd, ofs, SEEK_SET);
	   read(fd, dst, len);

     It however differs from that sequence in that it does proper error check-
     ing and I/O aligned to 2048 bytes, that is ofs is truncated down to a
     multiple of 2048, the difference is added to len which then is rounded up
     to a multiple of 2048, a temporary buffer is allocated to which the bytes
     are read, the correct bytes are then copied to dst and another lseek(2)
     to the original ofs + len is done to set the file seek pointer to the
     same value the above sequence of calls would have.

     This function is of limited use cases; one would be to read a random
     512-byte sector from a CD-ROM using the raw mode (character) device;
     disklabel(8) does that.

RETURN VALUES
     If no error occured and the call to read(2) returned exactly len bytes in
     one operation, cdblockedread() returns len. Otherwise, if the last call
     to lseek(2) failed but everything else succeeded, 0 is returned, -1 oth-
     erwise. This is because the seek pointer after reading is irrelevant to
     most applications using it.

SEE ALSO
     lseek(2), read(2), cd(4)

HISTORY
     The cdblockedread function is an MirOS BSD extension and first appeared
     in MirOS #11.

AUTHORS
     Thorsten Glaser <tg@mirbsd.org>

MirOS BSD #10-current	       August 14, 2010				     1
[top]

List of man pages available for MirBSD

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net