DIO_FUNCTION
Section: Misc. Reference Manual Pages (2L)
Updated: Data Logic Limited
Index
Return to Main Contents
NAME
dio_functions - MSDOS Raw Disk/Memory I/O Functions
SYNOPSIS
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <ms_dio.h>
int dio_access (path, amode)
int dio_chmod (path, mode)
int dio_close (fildes)
int dio_creat (path, mode)
int dio_dup (fildes)
int dio_isatty (fildes)
long dio_lseek (fildes, offset, whence)
int dio_open (path, oflag [ , mode ] )
int dio_read (fildes, buf, nbyte)
int dio_stat (path, statb)
int dio_fstat (fildes, statb)
int dio_write (fildes, buf, nbyte)
long dio_tell (fildes)
char *path;
char *buf;
int amode;
int mode;
int fildes;
int whence;
int oflag;
long offset;
unsigned int nbyte;
struct stat *statb;
DESCRIPTION
These functions provide replacements for the standard MS-DOS library
function of similar name. The object of these functions is to allow the
user to access either the files, or raw disks or memory using standard
library calls, in a similar manner to UNIX where files or devices can be
accessed using the standard library functions. A set of macros is provided
in the include file ms_dio.h which maps the standard library functions
onto one of these functions. If the file name or file descriptor refers to
a normal MSDOS file, the standard library function is invoked to perform
the required function. Otherwise, the appropriate action is taken by these
replacement functions. The functionality of the libraries is described on
the appropriate manual pages for the standard function.
These libraries recognise three devices - hard disks, floppy disks or
memory and these are accessed using the following file names:
- /dev/fdn
-
This device allows the user to access a floppy disk. The digit n
gives the drive number (from 0 to 9). The topological information for
this device (heads, tracks, sectors) is obtained from MS-DOS. The open
function then checks to see what type of disk is loaded. The following
disks are recognised (8, 9 or 15 sectors, 1 or 2 heads, double or single
density). The drive density is selected when necessary by attempting to
read sector 0 from the disk.
- /dev/hdxy
-
This device allows the user to access a hard disk. The first digit x
gives the drive number (from 0 to 9) and the second digit y gives the
partition number on the disk (from 0 to 9). Partition zero refers to the
whole disk. Note that the open function sorts the partition table before
deciding which partition is referred to. All topological information for
this device (heads, tracks, sectors) is obtained from MS-DOS.
- /dev/mem
-
This device allows the user to access memory from location 0 to location
0xFFFFF.
The libraries use/return file descriptors in the range 30000 to 32767 and
use this as a check to see if they are processing one of the special files
mentioned above. This value can be changed by modifying the value of
MS_MODIFIER in the library source.
Note: File descriptors for these special devices cannot be passed via
exec or spawn to new or child processes.
RETURN VALUE
See standard library functions. If an error occurs, errno is set to EIO if
the error occurs when reading or writing the device.
SEE ALSO
access(2), chmod(2), close(2), creat(2), dup(2), isatty(3), lseek(2), open(2),
read(2), stat(2), fstat(2), write(2).
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- RETURN VALUE
-
- SEE ALSO
-
This document was created by
man2html,
using the manual pages.
Time: 05:47:12 GMT, March 28, 2025