home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / mntdoc01.zoo / mintdoc / pure_src / d.src next >
Encoding:
C/C++ Source or Header  |  1993-02-04  |  14.6 KB  |  406 lines

  1. screen( capsensitive("Dclosedir"))
  2. NAME
  3.     Dclosedir - close a directory
  4.  
  5. SYNOPSIS
  6.     LONG Dclosedir( LONG dirhandle );
  7.  
  8. DESCRIPTION
  9.     Dclosedir closes the directory whose handle (returned
  10.     from \#Dopendir\#) is dirhandle.
  11.  
  12. RETURNS
  13.     0       on success
  14.     EIHNDL  if dirhandle is not valid
  15.  
  16. SEE ALSO
  17.     \#Dopendir\#, \#Dreaddir\#
  18.  
  19. Last change: Oct. 1, 1991\end
  20.  
  21. screen(capsensitive("Dcntl"))
  22. NAME
  23.     Dcntl - perform a file system specific operation on a file
  24.     or directory
  25.  
  26. SYNOPSIS
  27.     #include <filesys.h>
  28.  
  29.     LONG Dcntl(WORD cmd, char *name, LONG arg);
  30.  
  31. DESCRIPTION
  32.     Dcntl performs a file system specific command, given by cmd,
  33.     upon the file or directory specified by name. The exact
  34.     nature of the operation performed depends upon the file sys-
  35.     tem on which name resides. The interpretation of the third
  36.     argument arg depends upon the specific command.
  37.     
  38.     Dcntl commands are:
  39.     
  40.     \link("Dcntl commands")DEV_INSTALL\#
  41.     
  42.     \link("Dcntl commands")DEV_NEWTTY\#
  43.     
  44.     \link("Dcntl commands")DEV_NEWBIOS\#
  45.  
  46. RETURNS
  47.     The value returned depends on the specific operation
  48.     requested and the file system involved. Generally, a 0 or
  49.     positive return value should mean success, and a negative
  50.     one failure. An exception is the value returned by
  51.     DEV_INSTALL, which is either a pointer to a kernel informa-
  52.     tion structure, or NULL on failure.
  53.  
  54. SEE ALSO
  55.     \#Bconmap\#, \#Fcntl\#
  56.  
  57. Last change: Dec. 12, 1991\end
  58.  
  59. screen("Dcntl commands")
  60. The only built-in file system which supports \#Dcntl\# opera-
  61. tions is the device file system U:\\DEV, which understands
  62. the following commands:
  63.  
  64.     DEV_INSTALL
  65.         Installs a new device driver whose name is given by
  66.         name (which must be the complete path and file name,
  67.         e.g. U:\\DEV\\FOO). The device may be accessed only
  68.         through GEMDOS file operations; the BIOS will not be
  69.         aware of it. arg is a pointer to a \link("dev_descr")device descriptor\#
  70.         structure.
  71.  
  72.         If the attempt to install the device is successful,
  73.         Dcntl will return a pointer to a structure with type
  74.         "struct kerinfo" that describes the kernel (see the
  75.         documentation for loadable file systems for more infor-
  76.         mation on this structure). This structure is in pro-
  77.         tected memory and can be accessed only in supervisor
  78.         mode. Moreover, the structure is read only; attempts to
  79.         write to it will produce unpredictable errors. If
  80.         there is not enough memory to install the new device, a
  81.         null pointer will be returned.
  82.  
  83.     DEV_NEWTTY
  84.         Installs a driver for a new BIOS terminal device whose
  85.         name is name (this must be the full path name, e.g.
  86.         U:\\DEV\\BAR). arg is the BIOS device number of this
  87.         device. Note that the BIOS must have been told about
  88.         the device already via the \#Bconmap\# system call or some
  89.         similar mechanism; otherwise, any attempt to access the
  90.         file will result in an unknown device error (EUNDEV).
  91.         This command simply informs the kernel about a BIOS
  92.         device that already exists, unlike DEV_INSTALL which
  93.         actually creates a new device.
  94.  
  95.     DEV_NEWBIOS
  96.         Installs a driver for a new BIOS non-terminal device
  97.         whose name is name (this must be the full path name,
  98.         e.g. U:\\DEV\\BAR). arg is the BIOS device number of
  99.         this device. Note that the BIOS must have been told
  100.         about the device already via the \#Bconmap\# system call or
  101.         some similar mechanism; otherwise, any attempt to
  102.         access the file will result in an unknown device error
  103.         (EUNDEV). Like DEV_NEWTTY, this command informs the
  104.         kernel of the existence of a BIOS device. The differ-
  105.         ence between the two commands is that DEV_NEWTTY should
  106.         be used for devices which may be used as terminal devices 
  107.         (e.g. serial lines), whereas DEV_NEWBIOS is useful for 
  108.         devices for which data must be always transmitted "raw" 
  109.         (e.g. a SCSI tape device, or perhaps a LAN device).
  110.  
  111. Last change: Dec. 12, 1991\end
  112.  
  113. screen("dev_descr")
  114. The device descriptor structure is used in a \link("Dcntl commands")DEV_INSTALL\# 
  115. command in a \#Dcntl\# call.
  116.  
  117. The dev_descr structure is defined in FILESYS.H:
  118.  
  119. struct dev_descr
  120. {
  121.     DEVDRV      *driver;  /* pointer to device driver structure */
  122.     short       dinfo;    /* placed in the "aux" field of file  */
  123.                           /* cookies                            */
  124.     short       flags;    /* either 0 or O_TTY                  */
  125.     struct tty  *tty;     /* if flags & O_TTY, this points to   */
  126.                           /* the tty structure associated with  */
  127.                           /* the device                         */
  128.     long reserved[4];     /* reserved for future expansion -    */
  129.                           /* set to 0                           */
  130. };\end
  131.  
  132. screen( capsensitive("Dgetcwd"))
  133. NAME
  134.     Dgetcwd - get current working directory for a process
  135.  
  136. SYNOPSIS
  137.     LONG Dgetcwd(char *path, WORD drv, WORD size);
  138.  
  139. DESCRIPTION
  140.     Dgetcwd may be used to retrieve the current working
  141.     directory on the indicated drive for the current process.
  142.     The directory is copied into the buffer pointed to by
  143.     path, which is at least size bytes long.
  144.  
  145. RETURNS
  146.     0       on success
  147.     ERANGE  if the supplied buffer is not long enough to hold
  148.             the path
  149.     EDRIVE  if drv is not a valid GEMDOS drive.
  150.  
  151. SEE ALSO
  152.     \#Dgetpath\#
  153.  
  154. Last change: Dec. 1, 1992\end
  155.  
  156. screen(capsensitive("Dlock"))
  157. NAME
  158.     Dlock - lock or unlock a BIOS disk device
  159.  
  160. SYNOPSIS
  161.     LONG Dlock( WORD mode, WORD drv );
  162.  
  163. DESCRIPTION
  164.     Dlock is used to lock or unlock the BIOS device indicated
  165.     by drv. No GEMDOS file operations are permitted on a
  166.     locked drive. Thus, the Dlock call provides a mechanism for
  167.     disk formatters or re-organizers to lock out other processes
  168.     while low-level BIOS or XBIOS operations are in progress on
  169.     the device.
  170.  
  171.     If bit 0 of mode is 1, the drive is locked; if it is 0 then
  172.     the drive is unlocked and may be used again by other programs.
  173.     If a process terminates while holding a lock on a drive, that
  174.     drive is automatically unlocked.
  175.  
  176.     Bit 1 of mode indicates what return values are desired. If this
  177.     bit is 1, and if the drive is locked by a user process different
  178.     from the caller, or if some process has files open on the drive,
  179.     then that process' id will be returned (see below). This may be
  180.     used to report a more useful error message to the user (by
  181.     telling him or her which process is using the drive in question
  182.     when a lock operation fails).
  183.  
  184.     All other bits of mode are reserved and must be set to 0.
  185.  
  186.     A lock operation followed immediately by an unlock is very
  187.     similar to a media change, except that the lock operation will
  188.     fail if there are open files that refer to the indicated drive.
  189.  
  190. RETURNS
  191.     0       if the lock/unlock operation was successful
  192.     EDRIVE  if drv is not a valid BIOS device number
  193.  
  194.     For a lock operation, the following error codes may be
  195.     returned:
  196.  
  197.     A positive process id if bit 1 of mode is set, and the drive
  198.     is already locked or in use by another user process.
  199.  
  200.     EACCDN  if bit 1 of mode is clear and either open files exist
  201.             on the drive or another process is searching a directory
  202.             on the drive, or if bit 1 of mode is set and the drive is
  203.             in use by the operating system.
  204.  
  205.     ELOCKED if bit 1 of mode is clear and another process has locked
  206.             the drive, or if bit 1 of mode is set and the operating
  207.             system has locked the drive.
  208.  
  209.     For an unlock operation the following error codes may be
  210.     returned:
  211.  
  212.     ENSLOCK if mode is 0 and the drive was not locked by this
  213.             process.
  214.  
  215. SEE ALSO
  216.     \#Fxattr\#
  217.  
  218. NOTES
  219.     Note that Dlock operates on BIOS devices, which may not
  220.     always be in 1-1 correspondence with GEMDOS drive letters.
  221.     For this reason, to lock GEMDOS drive A: (for example), the
  222.     programmer should call \#Fxattr\# on the root directory of A:
  223.     ("A:\\e") and then use the dev field of the structure returned
  224.     in order to determine the BIOS device corresponding to the
  225.     GEMDOS drive.
  226.  
  227. BUGS
  228.     All GEMDOS operations are forbidden on a locked drive, even by
  229.     the process that created the lock. It would be useful to have
  230.     a mode which allowed the locking process (and only the locking
  231.     process) to still make GEMDOS calls on the drive, but
  232.     unfortunately the structure of the OS makes this difficult;
  233.     there is also the above-mentioned difference between BIOS and
  234.     GEMDOS devices to consider.
  235.  
  236. Last change: Jan. 8, 1993\end
  237.  
  238. screen(capsensitive("Dopendir"))
  239. NAME
  240.     Dopendir - open a directory for reading
  241.  
  242. SYNOPSIS
  243.     LONG Dopendir(char *name, WORD flag);
  244.  
  245. DESCRIPTION
  246.     Dopendir opens the directory whose name is pointed to by
  247.     name for reading. A 32 bit directory handle is returned
  248.     which may be passed to Dreaddir to actually read the direc-
  249.     tory. flag controls the way directory operations are per-
  250.     formed. If flag == 1, then the directory is read in "compa-
  251.     tibility" mode, if flag == 0 then directory operations are
  252.     performed in "normal" mode. In  "compatibility" mode, file
  253.     systems act as if the \#Fsfirst\# and \#Fsnext\# functions were
  254.     being used; in particular, if it is possible file names will
  255.     be restricted to the DOS 8 character name + 3 character
  256.     extension convention, and will be in upper case. In "normal"
  257.     mode, file systems do not attempt to restrict the range of
  258.     names. Moreover, in this mode the \#Dreaddir\# system call
  259.     will also return a file index number (similar to the Unix
  260.     inode number) along with the file name.
  261.  
  262.     New programs should generally use normal mode where possi-
  263.     ble.
  264.  
  265. RETURNS
  266.     A 32 bit directory handle, on success. Note that this handle 
  267.     may be negative, but will never contain the pattern 0xFF
  268.     in the upper byte, whereas all errors do contain this pat-
  269.     tern in the upper byte.
  270.  
  271.     EPTHNF  if name is not a valid directory
  272.  
  273.     EACCDN  if the directory is not accessible by this program
  274.  
  275.     ENSMEM  if the kernel is unable to allocate memory needed for
  276.             the directory operations
  277.  
  278. SEE ALSO
  279.     \#Dclosedir\#, \#Dreaddir\#, \#Drewinddir\#
  280.  
  281. BUGS
  282.     With every Dopendir call, some kernel memory is allocated
  283.     that is only freed when \#Dclosedir\# is called or the process
  284.     exits. Therefore, every long-running program that calls
  285.     Dopendir should always make corresponding calls to \#Dclosedir\#.
  286.  
  287. Last change: Jan. 8, 1993\end
  288.  
  289. screen(capsensitive("Dpathconf"))
  290. NAME
  291.     Dpathconf - get information about file system configuration
  292.  
  293. SYNOPSIS
  294.     LONG Dpathconf(char *name, WORD mode);
  295.  
  296. DESCRIPTION
  297.     Dpathconf returns information about various limits or capa-
  298.     bilities of the file system containing the file named name.
  299.     The variable mode controls which limit or capability is
  300.     being queried, as follows:
  301.        mode Value Returned
  302.  
  303.        -1   return max. legal value for n in Dpathconf(n)
  304.         0   return internal limit on the number of open files
  305.         1   return max. number of links to a file
  306.         2   return max. length of a full path name
  307.         3   return max. length of an individual file name
  308.         4   return number of bytes that can be written atomically
  309.         5   return information about file name truncation
  310.     If any of these items are unlimited, then 0x7fffffffL is
  311.     returned.
  312.  
  313.     For mode 5, return information about file name truncation,
  314.     the returned value has the following meaning:
  315.  
  316.     0   File names are never truncated; if the file name in any
  317.         system call affecting this directory exceeds the max-
  318.         imum length (returned by mode 3), then the error value
  319.         ERANGE is returned from that system call.
  320.  
  321.     1   File names are automatically truncated to the maximum
  322.         length.
  323.  
  324.     2   File names are truncated according to DOS rules, i.e.
  325.         to a maximum 8 character base name and a maximum 3
  326.         character extension.
  327.  
  328. SEE ALSO
  329.     \#Sysconf\#
  330.  
  331. Last change: Oct. 1, 1991\end
  332.  
  333. screen(capsensitive("Dreaddir"))
  334. NAME
  335.     Dreaddir - read directory information
  336.  
  337. SYNOPSIS
  338.     LONG Dreaddir(WORD len, LONG dirhandle, char *buf);
  339.  
  340. DESCRIPTION
  341.     Dreaddir returns the next file in the directory whose handle
  342.     (from the \#Dopendir\# system call) is dirhandle. The file's
  343.     name and (optionally) a 4 byte index for the file are placed
  344.     in  the buffer pointed to by buf. The file index is omitted
  345.     if the directory was opened in  "compatibility" mode (see
  346.     \#Dopendir\# for details); otherwise, it is placed first in
  347.     the buffer, followed by the (null terminated) name. If two
  348.     names have the same index, then they refer to the same file;
  349.     the converse, however, is not true.
  350.  
  351.     len is the size of the buffer, in total; it should be large
  352.     enough to hold the index (if any), the file name, and the
  353.     trailing 0.
  354.  
  355.     Successive calls to Dreaddir will return all the names in
  356.     the directory, one after another, unless the Drewinddir sys-
  357.     tem call is used to restart the reading at the beginning of
  358.     the directory.
  359.  
  360. RETURNS
  361.     0       if successful
  362.  
  363.     ERANGE  if the buffer was not large enough to hold the index
  364.             (if present) and name
  365.  
  366.     ENMFIL  if there are no more file names to be read from the
  367.             directory
  368.  
  369. SEE ALSO
  370.     \#Dclosedir\#, \#Dopendir\#, \#Drewinddir\#
  371.  
  372. BUGS
  373.     Failure to call Dclosedir() when the search is done could
  374.     result in the system eventually running out of file indices;
  375.     this is fatal. So always call Dclosedir() when you're fin-
  376.     ished with the directory search!
  377.  
  378. Last change: Oct. 1, 1991\end
  379.  
  380. screen(capsensitive("Drewinddir"))
  381. NAME
  382.     Drewinddir - rewind an open directory
  383.  
  384. SYNOPSIS
  385.     LONG Drewinddir(LONG handle);
  386.  
  387. DESCRIPTION
  388.     Drewinddir rewinds the open directory whose handle (returned
  389.     from the \#Dopendir\# system call) is handle. After the
  390.     Drewinddir call, the next call to \#Dreaddir\# will read the
  391.     first file in the directory.
  392.  
  393. RETURNS
  394.     0       on success
  395.  
  396.     EIHNDL  if handle does not refer to a valid open directory
  397.  
  398.     EINVFN  if the directory cannot be rewound (for example,
  399.             because of the type of file system on which it
  400.             is located)
  401.  
  402. SEE ALSO
  403.     \#Dopendir\#, \#Dreaddir\#
  404.  
  405. Last change: Oct. 1, 1991\end
  406.