| www.delorie.com/djgpp/doc/libc-2.01/libc_416.html | search |
The DOSish version of ioctl performs an
interrupt 0x21, function 0x44. It takes care of supplying transfer buffers in
low address regions, if they are needed. For an exhaustive description of the
various commands and subcommands, see Ralph Browns interrupt list.
It is highly recommended to use only the DOS_* functions listed in `sys/ioctl.h'.
Syntax
ioctl(fd, cmd, ... );
#include <sys/ioctl.h>
int main(int argc, char **argv){
char buf[6];
short *s;
open(fd,"EMMQXXX0",O_RDONLY);
mybuf[0] = '\0';
s = mybuf;
ioctl(fd,DOS_SNDDATA,6, (int) &mybuf);
if(*s ==0x25 )printf("EMM386 >= 4.45\n");
mybuf[0]='\x02';
ioctl(fd,DOS_SNDDATA,2,(int )&mybuf);
printf("EMM Version %d.%d\n",(int )mybuf[0],(int) mybuf[1]);
close(fd);
}
The parameter fd must refer to a file descriptor for character device
functions, or the number of a block device (usually current=0, A:=1, ...).
The following constants can be used for the cmd parameter:
DOS_GETDEVDATA
DX.
DOS_SETDEVDATA
DX
or -1
DOS_RCVDATA
cmd must follow the
number of requested bytes to read and a pointer to a buffer. Returns the number
of bytes actually read or -1 on error.
DOS_SNDDATA
cmd must follow the
number of bytes to write and a pointer to a buffer holding the data.
Returns the number of bytes actually written.
DOS_RCVCTLDATA
DOS_RCVDATA.
DOS_SNDCTLDATA
DOS_SNDDATA.
DOS_CHKINSTAT
0xff
if file is ready.
DOS_CHKOUTSTAT
0xff
if file is ready.
DOS_ISCHANGEABLE
DOS_ISREDIRBLK
DOS_ISREDIRHND
DOS_SETRETRY
DOS_GENCHARREQ
DOS_GENBLKREQ
DOS_GLDRVMAP
DOS_SLDRVMAP
DOS_QGIOCTLCAPH
DOS_QGIOCTLCAPD
If your specific device driver requires different commands, they must be or'ed together with the flags listed in `ioctl.h' to tell the drive about transfer buffers and what to return.
See description above.
The bits of the device information word have the following meaning:\\ Character device:
Disk file:
Go to the first, previous, next, last section, table of contents.
| prev next webmaster | delorie software privacy |
| Copyright © 1997 | Updated Apr 1997 |