www.delorie.com/djgpp/doc/libc/libc_373.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]



#include <io.h>

short _get_dev_info(int handle);


Given a file handle in handle, this function returns the info word from DOS IOCTL function 0 (Int 21h/AX=4400h). handle must refer to an open file or device, otherwise the call will fail (and set errno to EBADF).

In case of success, the returned value is the coded information from the system about the character device or the file which is referenced by the file handle handle. The header <libc/getdinfo.h> defines constants for the individual bits in the return value. The following table shows the meaning of the individual bits in the return value:

For a character device:

Bit(s) Constant Description
14 _DEV_IOCTRL Device can process IOCTL functions 02h and 03h
13 Device supports output-until-busy
11 Device supports OPEN/CLOSE calls
8 Unknown; set by MS-DOS 6.2x `KEYBxx.COM'
7 _DEV_CDEV Always set for character devices
6 End of file on input
5 _DEV_RAW If set, device is in raw (binary) mode
5 _DEV_RAW If clear, device is in cooked (text) mode
4 Device uses Int 29h
3 _DEV_CLOCK Clock device
2 _DEV_NUL NUL device
1 _DEV_STDOUT Standard output device
0 _DEV_STDIN Standard input device

For a block device (a disk file):

Bit(s) Constant Description
15 _DEV_REMOTE Device is remote (networked drive)
14 Don't set file time stamp on close
11 If set, non-removable media
11 If clear, media is removable (e.g. floppy disk)
8 Generate Int 24h if full disk or read past EOF
7 _DEV_CDEV Always clear for disk files
6 File has not been written to
5-0 Drive number (0 = `A:')

Note that the functionality indicated by bit 8 for the block devices is only supported by DOS version 4.

Cooked mode means that on input C-C, C-P, C-S and C-Z are processed, on output `TAB's are expanded into spaces and `CR' character is added before each `LF', and input is terminated when the RET key is pressed. In contrast, in raw mode, all the special characters are passed verbatim, and the read operation waits until the specified number of characters has been read.

Return Value

The device information word described above. In case of error, -1 is returned and errno is set to EBADF.




 int fd = open ("CLOCK$", O_RDONLY | O_BINARY);
 int clock_info = _get_dev_info (fd);

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2004   by DJ Delorie     Updated Apr 2004