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 / f.src < prev    next >
Encoding:
Text File  |  1993-02-17  |  35.2 KB  |  1,070 lines

  1. screen(capsensitive("Fchmod"))
  2. NAME
  3.     Fchmod - set file access permissions
  4.  
  5. SYNOPSIS
  6.     #include <filesys.h>
  7.  
  8.     LONG Fchmod(char *name, WORD mode);
  9.  
  10. DESCRIPTION
  11.     Fchmod changes the file access  permissions for the file
  12.     named name. The new access permissions are given in the
  13.     word mode, which may be constructed by or'ing together the
  14.     following symbolic constants (defined in filesys.h):
  15.  
  16.     S_IRUSR,
  17.         Read, write, and execute permission (respectively) for
  18.         the owner of the file.
  19.  
  20.     S_IRGRP,
  21.         Read, write, and execute permission (respectively) for
  22.         the file's group.
  23.  
  24.     S_IROTH,
  25.         Read, write, and execute permission for everybody else.
  26.  
  27.     Note that not all file systems support all of these bits;
  28.     bits not supported by a file system will be ignored.
  29.  
  30.     Note also that "execute" permission for a directory means
  31.     permission to search the directory for a file name or name
  32.     component.
  33.  
  34. RETURNS
  35.     0       on success
  36.  
  37.     EACCDN  if the calling process has an effective uid which
  38.             differs from the owner of the file and which is
  39.             not 0.
  40.  
  41.     EFILNF  if the file is not found.
  42.  
  43.     EPTHNF  if the path to the file is not found.
  44.  
  45. SEE ALSO
  46.     \#Fattrib\#, \#Fxattr\#
  47.  
  48. Last change: Oct. 7, 1991\end
  49.  
  50. screen(capsensitive("Fchown"))
  51. NAME
  52.     Fchown - change a file's ownership
  53.  
  54. SYNOPSIS
  55.     LONG Fchown(char *name, WORD uid, WORD gid);
  56.  
  57. DESCRIPTION
  58.     Fchown changes a file's user and group ownership to uid and
  59.     gid respectively. These ownerships determine access rights
  60.     to the file.
  61.  
  62.     Only a process with effective uid 0 or whose effective uid
  63.     matches the user ownership of the file may make this call.
  64.     In the latter case, the new uid must match the old one, and
  65.     the calling process must also be a member of the group
  66.     specified by gid.
  67.  
  68. RETURNS
  69.     0       on success
  70.  
  71.     EACCDN  if the calling process has an effective uid which
  72.             differs from the owner of the file and which is
  73.             not 0.
  74.  
  75.     EINVFN  if the file system on which the file is located does
  76.             not support a notion of ownership. (This is true of
  77.             the normal TOS file system.)
  78.  
  79.     EFILNF  if the file is not found.
  80.  
  81.     EPTHNF  if the path to the file is not found.
  82.  
  83. SEE ALSO
  84.     \#Fchmod\#, \#Fxattr\#
  85.  
  86. BUGS
  87.     Most file systems don't understand file ownership.
  88.  
  89.     In practice, the call is useful only to processes with
  90.     effective uid 0.
  91.  
  92. Last change: Dec. 12, 1991\end
  93.  
  94. screen(capsensitive("Fcntl"))
  95. NAME
  96.     Fcntl - perform various control operations on a file
  97.  
  98. SYNOPSIS
  99.     #include <filesys.h>
  100.  
  101.     LONG Fcntl(WORD fh, LONG arg, WORD cmd);
  102.  
  103. DESCRIPTION
  104.     Fcntl performs various control operations on the open file
  105.     with GEMDOS file handle fh. The specific command to perform
  106.     is given by cmd; the possible commands are given by symbolic
  107.     constants in filesys.h, and are listed below. arg is an
  108.     argument whose meaning depends on the command.
  109.  
  110.     The following commands are applicable to any file descriptor:
  111.  
  112.     \link("Fcntl file commands")F_DUPFD\#
  113.  
  114.     \link("Fcntl file commands")F_GETFD\#
  115.  
  116.     \link("Fcntl file commands")F_SETFD\#
  117.  
  118.     \link("Fcntl file commands")F_GETFL\#
  119.  
  120.     \link("Fcntl file commands")F_SETFL\#
  121.  
  122.     \link("Fcntl file commands")F_GETLK\#
  123.  
  124.     \link("Fcntl file commands")F_SETLK\#
  125.  
  126.     \link("Fcntl file commands")F_SETLKW\#
  127.     
  128.     \link("Fcntl file commands")FSTAT\#
  129.  
  130.     \link("Fcntl file commands")FIONREAD\#
  131.  
  132.     \link("Fcntl file commands")FIONWRITE\#
  133.  
  134.     The following commands are valid for any terminal device,
  135.     e.g. the console or a pseudo-terminal:
  136.  
  137.     \link("Fcntl terminal commands")TIOCGETP\#
  138.  
  139.     \link("Fcntl terminal commands")TIOCSETP\#
  140.  
  141.     \link("Fcntl terminal commands")TIOCGETC\#
  142.  
  143.     \link("Fcntl terminal commands")TIOCSETC\#
  144.  
  145.     \link("Fcntl terminal commands")TIOCGLTC\#
  146.  
  147.     \link("Fcntl terminal commands")TIOCSLTC\#
  148.  
  149.     \link("Fcntl terminal commands")TIOCGWINSZ\#
  150.  
  151.     \link("Fcntl terminal commands")TIOCSWINSZ\#
  152.  
  153.     \link("Fcntl terminal commands")TIOCGPGRP\#
  154.  
  155.     \link("Fcntl terminal commands")TIOCSPGRP\#
  156.  
  157.     \link("Fcntl terminal commands")TIOCSTART\#
  158.  
  159.     \link("Fcntl terminal commands")TIOCSTOP\#
  160.  
  161.     \link("Fcntl terminal commands")TIOCGXKEY\#
  162.  
  163.     \link("Fcntl terminal commands")TIOCSXKEY\#
  164.  
  165.     The following commands are valid only for processes opened
  166.     as files:
  167.  
  168.     \link("Fcntl process commands")PBASEADDR\#
  169.  
  170.     \link("Fcntl process commands")PPROCADDR\#
  171.  
  172.     \link("Fcntl process commands")PCTXTSIZE\#
  173.     
  174.     The following commands are valid only for files which
  175.     represent shared memory:
  176.  
  177.     \link("Fcntl shared memory commands")SHMSETBLK\#
  178.     
  179.     \link("Fcntl shared memory commands")SHMGETBLK\#
  180.     
  181. RETURNS
  182.     0       or a positive number if successful (for most commands,
  183.             0, but see the specific descriptions above).
  184.  
  185.     EIHNDL  if fh is not a valid GEMDOS open handle.
  186.  
  187.     EINVFN  if the specified command is not valid for this file
  188.             handle.
  189.  
  190.     Some other (LONG) negative error number if an error occurs;
  191.     different commands may recognize different possible errors.
  192.  
  193. SEE ALSO
  194.     \#Fdup\#, \#Flock\#, \#Fopen\#, \#Fxattr\#, \#Pgetpgrp\#, \#Psetpgrp\#
  195.  
  196. BUGS
  197.     Very little error checking is done. In particular, ownership
  198.     of terminals is not properly checked, nor is read/write
  199.     access to the files. Do not rely on this bug; it will be
  200.     fixed some day.
  201.  
  202.     File locking is not yet implemented for most file systems.
  203.  
  204.     Very few of the terminal control options have effect on ter-
  205.     minals connected via serial ports or midi. In particular, it
  206.     is not possible to set the baud rate, parity, flow control,
  207.     or similar options with Fcntl. However, this bug will be
  208.     fixed in future versions of the operating system, so pro-
  209.     grams should never modify the sg_ispeed, sg_ospeed, or
  210.     sg_flags fields of the \link("struct sgttyb")sgttyb structure\#, and should always
  211.     use TIOCGETP to obtain the original settings of these fields
  212.     before calling TIOCSETP.
  213.  
  214. Last change: July 20, 1992\end
  215.  
  216. screen("Fcntl file commands")
  217. The following \#Fcntl\# commands are applicable to any file descriptor:
  218.  
  219. F_DUPFD
  220.     Return a duplicate for the file handle. The new (dupli-
  221.     cate) handle will be an integer >= arg and < 32. If no
  222.     free handles exist in that range, ENHNDL will be
  223.     returned. The \#Fdup\# system call is equivalent to
  224.     Fcntl(fh, 6L, F_DUPFD)
  225.  
  226. F_GETFD
  227.     Return the noinherit flag for the file descriptor. This
  228.     flag is 1 if child processes started by Pexec should
  229.     inherit this open file, and 0 if not. arg is ignored.
  230.  
  231. F_SETFD
  232.     Set the noinherit flag for the file descriptor from the
  233.     low order bit of arg. The default value of the flag is
  234.     0 for handles 0-5 (the "standard" handles) and 1 for
  235.     other (non-standard) handles. Note that the noinherit
  236.     flag applies only to this particular file descriptor;
  237.     another descriptor obtained from fh by the \#Fdup\# system
  238.     call or by use of the F_DUPFD option to \#Fcntl\# will have
  239.     the noinherit flag set to the default. Also note that
  240.     these defaults are not the same as for the Unix operat-
  241.     ing system.
  242.  
  243. F_GETFL
  244.     Returns the user-settable file descriptor flags. These
  245.     flags are the same as the mode passed to \#Fopen\#, unless
  246.     they have been further modified by another \#Fcntl\# opera-
  247.     tion. arg is ignored.
  248.  
  249. F_SETFL
  250.     Set user-settable file descriptor flags from the argu-
  251.     ment arg. Only the user-settable bits in arg are con-
  252.     sidered; the settings of other bits are ignored, but
  253.     should be 0 for future compatibility. Moreover, it is
  254.     not possible to change a file's read-write mode or
  255.     sharing modes with this call; attempts to do so will
  256.     (silently) fail.
  257.  
  258. F_GETLK
  259.     arg is a pointer to an \link("struct flock")flock structure\#.
  260.     If a lock exists which would prevent this lock from
  261.     being applied to the file, the existing lock is copied
  262.     into the structure and the l_pid field is set to the
  263.     process id of the locking process. Otherwise, l_type is
  264.     set to F_UNLCK. If a conflicting lock is held by a pro-
  265.     cess on a different machine on a network, then the
  266.     l_pid field will be set to a value defined by the net-
  267.     work file system. This value will be in the range
  268.     0x1000 to 0xFFFF, and will therefore not conflict with
  269.     any process id since process id's must be less than
  270.     0x1000.
  271.  
  272. F_SETLK
  273.     Set (if l_type is F_RDLCK or F_WRLCK) or clear (if l_type
  274.     is F_UNLCK) an advisory lock on a file. If the file is a
  275.     FIFO, the whole file must be locked or unlocked at once,
  276.     i.e. l_whence, l_start, and l_len must be 0.
  277.     If this lock would conflict with a lock held by another
  278.     process, ELOCKED is returned. If an attempt is made to
  279.     clear a non-existent lock, ENSLOCK is returned.
  280.     More than one read lock may be placed on the same region
  281.     of a file, but no write lock may overlap with any other
  282.     sort of lock. If a process holds locks on a file, then
  283.     the locks are automatically released whenever the process
  284.     closes an open file handle referring to that file, or
  285.     when the process terminates.
  286.  
  287. F_SETLKW
  288.     Similar to F_SETLK, but will never fail on a legal
  289.     request; the process will be blocked until the lock
  290.     can be obtained.
  291.     Note: this mode has not been documented yet by Eric Smith!
  292.     
  293. FSTAT
  294.     arg points to an XATTR structure, which is filled in
  295.     with the appropriate extended file attributes for
  296.     the file to which fd refers just as though the \#Fxattr\#
  297.     system call had been made on the file.
  298.  
  299. FIONREAD
  300.     arg points to a 32 bit integer, into which is written
  301.     the number of bytes that are currently available to be
  302.     read from this descriptor; a read of this number of
  303.     bytes or less should not cause the process to block
  304.     (wait for more input). Note that for some files only
  305.     an estimate can be provided, so the number is not
  306.     always completely accurate.
  307.  
  308. FIONWRITE
  309.     arg points to a 32 bit integer, into which is written
  310.     the number of bytes that may be written to the indi-
  311.     cated file descriptor without causing the process to
  312.     block. Note that for some files only an estimate can
  313.     be provided, so the number is not always completely
  314.     accurate.
  315.         
  316. Last change: July 20, 1992\end
  317.  
  318. screen("struct flock")
  319. The file lock structure is used in a \link("Fcntl file commands")F_GETLK\# or \link("Fcntl file commands")F_SETLK\#
  320. command in a \#Fcntl\# call.
  321.  
  322. The flock structure is defined in FILESYS.H:
  323.  
  324. struct flock 
  325. {
  326.     short   l_type;     /* type of lock                   */
  327.     #define F_RDLCK 0
  328.     #define F_WRLCK 1
  329.     #define F_UNLCK 3
  330.     short   l_whence;   /* 0:file start, 1:current, 2:EOF */
  331.     long    l_start;    /* offset of locked region        */
  332.     long    l_len;      /* 0 for rest of file             */
  333.     short   l_pid;      /* set by F_GETLK                 */
  334. };\end
  335.  
  336. screen("Fcntl terminal commands")
  337. The following \#Fcntl\# commands are valid for any terminal device,
  338. e.g. the console or a pseudo-terminal:
  339.  
  340. TIOCGETP
  341.     Get terminal parameters from the \link("struct sgttyb")terminal description\# 
  342.     \link("struct sgttyb")structure\# pointed to by arg.
  343.  
  344. TIOCSETP
  345.     Set terminal parameters from the \#struct sgttyb\# pointed
  346.     to by arg.
  347.  
  348. TIOCGETC
  349.     Get terminal control characters. arg is a pointer to
  350.     a \link("struct tchars")terminal control structure\#.
  351.  
  352. TIOCSETC
  353.     Set terminal control characters from the \#struct tchars\#
  354.     pointed to by arg. Setting any character to the value
  355.     0 causes the corresponding function to become unavail-
  356.     able.
  357.  
  358. TIOCGLTC
  359.     Get extended terminal control characters, and put them
  360.     in the \link("struct ltchars")ltchars structure\# pointed to by arg.
  361.  
  362. TIOCSLTC
  363.     Set extended terminal control characters from the
  364.     \#struct ltchars\# pointed to by arg. Setting any of the
  365.     characters to 0 causes the corresponding function to
  366.     become unavailable.
  367.  
  368. TIOCGWINSZ
  369.     arg has type \link("struct winsize")struct winsize *\#. The current window
  370.     size for this window is placed in the structure pointed
  371.     to by arg.
  372.  
  373. TIOCSWINSZ
  374.     arg has type \link("struct winsize")struct winsize *\#. The current window
  375.     size for the window is set from the structure pointed
  376.     to by arg. Note that the kernel maintains the informa-
  377.     tion but does not act upon it in any way; it is up to
  378.     window managers to perform whatever physical changes
  379.     are necessary to alter the window size, and to raise
  380.     the SIGWINCH signal if necessary.
  381.  
  382. TIOCGPGRP
  383.     arg has type "long *"; the process group for the termi-
  384.     nal is placed into the long pointed to by it.
  385.  
  386. TIOCSPGRP
  387.     arg has type "long *"; the process group for the termi-
  388.     nal is set from the long pointed to by it. Processes in
  389.     any other process group will be sent job control sig-
  390.     nals if they attempt input or output to the terminal.
  391.  
  392. TIOCSTART
  393.     Restart output to the terminal (as though the user
  394.     typed control-Q) if it was stopped by a control-S or
  395.     TIOCSTOP command. arg is ignored.
  396.  
  397. TIOCSTOP
  398.     Stop output to the terminal (as though the user typed
  399.     control-S). arg is ignored.
  400.  
  401. TIOCGXKEY
  402.     Get the definition of a function or cursor key. arg is
  403.     a pointer to an \link("struct xkey")xkey structure\#.
  404.  
  405. TIOCSXKEY
  406.     arg is a structure of type \#struct xkey\#, as defined
  407.     above. Both the xk_num and the xk_def fields must be
  408.     defined. After execution of this command, and if the
  409.     XKEY bit is set in the sg_flags field of the \link("struct sgttyb")sgttyb\#
  410.     \link("struct sgttyb")structure\# associated with the terminal, then if the
  411.     indicated key is pressed on the affected terminal, any
  412.     MiNT domain process using \#Fread\# to read the key will
  413.     get the string in xk_def instead of ASCII 0. Note that
  414.     this translation occurs only for MiNT domain processes
  415.     and only for the \#Fread\# system call. Also note that the
  416.     string in xk_def must be null terminated, and so at
  417.     most 7 characters may be assigned to any key.
  418.         
  419. Last change: July 20, 1992\end
  420.  
  421. screen("struct sgttyb")
  422. The terminal description structure is used in a \link("Fcntl terminal commands")TIOCGETP\#
  423. or \link("Fcntl terminal commands")TIOCSETP\# command in a \#Fcntl\# call.
  424.  
  425. The sgttyb structure is defined in FILESYS.H:
  426.  
  427. struct sgttyb
  428. {
  429.     char    sg_ispeed;  /* reserved               */
  430.     char    sg_ospeed;  /* reserved               */
  431.     char    sg_erase;   /* erase character        */
  432.     char    sg_kill;    /* line kill character    */
  433.     short   sg_flags;   /* terminal control flags */
  434. };\end
  435.  
  436. screen("struct tchars")
  437. The terminal control structure is used in a \link("Fcntl terminal commands")TIOCGETC\#
  438. or \link("Fcntl terminal commands")TIOCSETC\# command in a \#Fcntl\# call.
  439.  
  440. The tchars structure is defined in FILESYS.H:
  441.  
  442. struct tchars
  443. {
  444.     char    t_intrc;    /* raises SIGINT          */
  445.     char    t_quitc;    /* raises SIGQUIT         */
  446.     char    t_startc;   /* starts terminal output */
  447.     char    t_stopc;    /* stops terminal output  */
  448.     char    t_eofc;     /* marks end of file      */
  449.     char    t_brkc;     /* marks end of line      */
  450. };\end
  451.  
  452. screen("struct ltchars")
  453. The extended terminal control structure is used in a 
  454. \link("Fcntl terminal commands")TIOCGLTC\# or \link("Fcntl terminal commands")TIOCSLTC\# command in a \#Fcntl\# call.
  455.  
  456. The ltchars structure is defined in FILESYS.H:
  457.  
  458. struct ltchars
  459. {
  460.     char    t_suspc;    /* raises SIGTSTP now       */
  461.     char    t_dsuspc;   /* raises SIGTSTP when read */
  462.     char    t_rprntc;   /* redraws the input line   */
  463.     char    t_flushc;   /* flushes output           */
  464.     char    t_werasc;   /* erases a word            */
  465.     char    t_lnextc;   /* quotes a character       */
  466. };\end
  467.  
  468. screen("struct winsize")
  469. The window size structure is used in a \link("Fcntl terminal commands")TIOCGWINSZ\#
  470. or \link("Fcntl terminal commands")TIOCSWINSZ\# command in a \#Fcntl\# call.
  471.  
  472. The winsize structure is defined in FILESYS.H:
  473.  
  474. struct winsize
  475. {
  476.     short   ws_row;     /* # of rows of text in window */
  477.     short   ws_col;     /* # of columns of text        */
  478.     short   ws_xpixel;  /* width of window in pixels   */
  479.     short   ws_ypixel;  /* height of window in pixels  */
  480. };
  481.  
  482. If any fields in the structure are 0, this means that
  483. the corresponding value is unknown.\end
  484.  
  485. screen("struct xkey")
  486. The key definition structure is used in a \link("Fcntl terminal commands")TIOCGXKEY\#
  487. or \link("Fcntl terminal commands")TIOCSXKEY\# command in a \#Fcntl\# call.
  488.  
  489. The xkey structure is defined in FILESYS.H:
  490.  
  491. struct xkey
  492. {
  493.     short   xk_num;    /* function key number */
  494.     char    xk_def[8]; /* associated string   */
  495. };
  496.     
  497. The xk_num field must be initialized with the number of
  498. the desired key:
  499.  
  500. xk_num      Key
  501.    0-9      F1-F10
  502.  10-19      F11-F20 (shift F1-shift F10)
  503.     20      cursor up
  504.     21      cursor down
  505.     22      cursor right
  506.     23      cursor left
  507.     24      help
  508.     25      undo
  509.     26      insert
  510.     27      clr/home
  511.     28      shift+cursor up
  512.     29      shift+cursor down
  513.     30      shift+cursor right
  514.     31      shift+cursor left
  515.  
  516. The string currently associated with the indicated key
  517. is copied into xk_def; this string is always nullterminated.\end
  518.     
  519. screen("Fcntl process commands")
  520. The following \#Fcntl\# commands are valid only for processes opened
  521. as files:
  522.  
  523. PBASEADDR
  524.     arg is a pointer to a 32 bit integer, into which the
  525.     address of the process basepage for the process to
  526.     which fh refers is written.
  527.  
  528. PPROCADDR
  529.     arg is a pointer to a 32 bit integer, into which the
  530.     address of the process control structure for the pro-
  531.     cess is written. Note that this control structure
  532.     differs from the one found in previous versions (before
  533.     0.93) of MiNT; it no longer includes the process con-
  534.     text, so that this part of the structure may be changed
  535.     without causing compatibility problems. See the
  536.     PCTXTSIZE command.
  537.  
  538. PCTXTSIZE
  539.     arg is a pointer to a 32 bit integer, into which the
  540.     length of a process context structure is written. There
  541.     are two of these structures located in memory just
  542.     before the process control structure whose address is
  543.     returned by the PPROCADDR command. The first is the
  544.     current process context; the second is the saved con-
  545.     text from the last system call.
  546.  
  547. Last change: July 20, 1992\end
  548.  
  549. screen(capsensitive("Fcntl shared memory commands"))
  550. The following \#Fcntl\# commands are valid only for files which
  551. represent shared memory:
  552.  
  553. SHMSETBLK
  554.     arg is a pointer to a block of memory previously allocated
  555.     by \#Mxalloc\#. The memory will be offered for sharing
  556.     under the name of the file represented by fd (which
  557.     must be a file in the U:\\SHM directory).
  558.   
  559. SHMGETBLK
  560.     arg must be 0, for future compatibility. Returns the
  561.     address of the block of memory previously associated
  562.     with the file via SHMSETBLK, or a NULL pointer if an
  563.     error occurs. Note that different processes may see
  564.     the shared memory block at different addresses in their
  565.     address spaces. Therefore, the shared memory block
  566.     should not contain any absolute pointers to data.
  567.   
  568. Last change: July 20, 1992\end
  569. screen(capsensitive("Fgetchar"))
  570. NAME
  571.     Fgetchar - read a character from a file
  572.  
  573. SYNOPSIS
  574.     LONG Fgetchar(WORD fh, WORD mode);
  575.  
  576. DESCRIPTION
  577.     Fgetchar reads a character from the open file whose handle
  578.     is fh. The parameter mode has an effect only if the open
  579.     file is a terminal or pseudo-terminal, in which case the
  580.     bits of mode have the following meanings:
  581.  
  582.     0x0001
  583.         Cooked mode; special control characters (control-C and
  584.         control-Z) are checked for and interpreted if found
  585.         (they cause SIGINT and SIGTSTP, respectively, to be
  586.         raised); also, flow control with control-S and
  587.         control-Q is activated.
  588.  
  589.     0x0002
  590.         Echo mode; characters read are echoed back to the ter-
  591.         minal.
  592.  
  593.     The ASCII value of the character read is put in the low byte
  594.     of the long word that is returned. If the file is a terminal
  595.     or pseudo-terminal, the scan code of the character pressed
  596.     and (possibly) the shift key status are also returned in the
  597.     long word, just as with the BIOS \#Bconin\# system call.
  598.  
  599. RETURNS
  600.     The character read, if successful.
  601.  
  602.     0x0000FF1A  if end of file is detected.
  603.  
  604.     EIHNDL      if fh is not a valid handle for an open file.
  605.  
  606. SEE ALSO
  607.     \#Bconin\#, \#Cconin\#, \#Cauxin\#, \#Fputchar\#, \#Fread\#
  608.  
  609. Last change: Oct. 1, 1991\end
  610.  
  611. screen(capsensitive("Finstat"))
  612. NAME
  613.     Finstat - determine input status for a file
  614.  
  615. SYNOPSIS
  616.     LONG Finstat(WORD fh);
  617.  
  618. DESCRIPTION
  619.     Finstat returns the number of bytes of input waiting on the
  620.     file whose GEMDOS handle is fh, or 0 if no input is avail-
  621.     able on that handle.
  622.  
  623. RETURNS
  624.     0       or a positive number if successful
  625.  
  626.     EIHNDL  if fh is not a valid handle for an open file.
  627.  
  628. SEE ALSO
  629.     \#Cauxis\#, \#Cconis\#, \#Fcntl\#, \#Foutstat\#
  630.  
  631. BUGS
  632.     Always returns 1 for disk files.
  633.  
  634.     Doesn't check to see if the indicated file was opened for
  635.     reading.
  636.  
  637. Last change: Oct. 1, 1991\end
  638.  
  639. screen(capsensitive("Flink"))
  640. NAME
  641.     Flink - create a new link to a file
  642.  
  643. SYNOPSIS
  644.     LONG Flink(char *oldname, char *newname);
  645.  
  646. DESCRIPTION
  647.     Flink creates a new name (a "hard link") for the file
  648.     currently named oldname. If the Flink call is successful,
  649.     then after the call the file may be referred to by either
  650.     name, and a call to \#Fdelete\# on either name will not affect
  651.     access to the file through the other name. oldname and
  652.     newname must both refer to files on the same physical dev-
  653.     ice. Note also that not all file systems allow links.
  654.  
  655. RETURNS
  656.     0       on success
  657.  
  658.     EXDEV   if oldname and newname refer to files on different
  659.             physical devices
  660.  
  661.     EINVFN  if the file system does not allow hard links
  662.  
  663.     EFILNF  if the file named oldname does not currently exist
  664.  
  665. SEE ALSO
  666.     \#Frename\#, \#Fsymlink\#
  667.     
  668. Last change: Oct. 7, 1991\end
  669.  
  670. screen(capsensitive("Fmidipipe"))
  671. NAME
  672.     Fmidipipe - redirect MIDI input and output
  673.  
  674. SYNOPSIS
  675.     LONG Fmidipipe(WORD pid, WORD in, WORD out);
  676.  
  677. DESCRIPTION
  678.     Fmidipipe changes the MIDI input and output file handles
  679.     (GEMDOS file handles -4 and -5 respectively) for process
  680.     pid. in is the GEMDOS handle (for the calling process) which
  681.     will become the MIDI input for the receiving process, and
  682.     out is the GEMDOS handle which is to become the MIDI output.
  683.  
  684.     If pid is 0, then the call affects the current process; in
  685.     this case, it is roughly equivalent to the sequence
  686.         Fforce(-4, in);
  687.         Fforce(-5, out);
  688.  
  689. RETURNS
  690.     0       on success
  691.  
  692.     EFILNF  if the indicated process is not found
  693.  
  694.     EIHNDL  if either in or out is not a valid open handle.
  695.  
  696.     EACCDN  if in is not open for reading or if out is not open
  697.             for writing.
  698.  
  699. SEE ALSO
  700.     \#Fdup\#, \#Fforce\#
  701.  
  702. BUGS
  703.     Any user can change the MIDI input and output of any pro-
  704.     cess. This will eventually be corrected.
  705.  
  706. Last change: Oct. 1, 1991\end
  707.  
  708. screen(capsensitive("Foutstat"))
  709. NAME
  710.     Foutstat - determine output status for a file
  711.  
  712. SYNOPSIS
  713.     LONG Foutstat(WORD fh);
  714.  
  715. DESCRIPTION
  716.     Foutstat returns the number of bytes of output that may be
  717.     written to the file whose GEMDOS handle is fh, without
  718.     blocking.
  719.  
  720. RETURNS
  721.     0       or a positive number if successful
  722.  
  723.     EIHNDL  if fh is not a valid handle for an open file.
  724.  
  725. SEE ALSO
  726.     \#Cauxos\#, \#Cconos\#, \#Cprnos\#, \#Fcntl\#, \#Finstat\#
  727.  
  728. BUGS
  729.     Always returns 1 for disk files.
  730.  
  731.     Doesn't check to see if the indicated file  was opened for
  732.     writing.
  733.  
  734. Last Change: Oct. 1, 1991\end
  735.  
  736. screen(capsensitive("Fpipe"))
  737. NAME
  738.     Fpipe - create a pipe
  739.  
  740. SYNOPSIS
  741.     LONG Fpipe(WORD usrh[2]);
  742.  
  743. DESCRIPTION
  744.     Fpipe creates a pipe that may be used for interprocess com-
  745.     munication. If it is successful, two GEMDOS handles are
  746.     returned in usrh[0] and usrh[1]. usrh[0] will contain a han-
  747.     dle for the read end of the pipe, (opened for reading only),
  748.     and usrh[1] will contain a handle for the write end of the
  749.     pipe (opened for writing only).
  750.  
  751.     The created pipe has the name "sys$pipe.xxx", where "xxx" is
  752.     a three digit integer.
  753.  
  754. USAGE
  755.     Typically used by shells; the shell redirects its standard
  756.     input (or standard output) to the read (or write) end of the
  757.     pipe using \#Fdup\# and \#Fforce\# before launching a child; the
  758.     child will then read from (or write to) the pipe by default.
  759.  
  760. RETURNS
  761.     0       if successful
  762.  
  763.     ENHNDL  if there are not 2 free handles to allocate for the
  764.             pipe
  765.  
  766.     ENSMEM  if there is not enough free memory to create the pipe
  767.  
  768.     EACCDN  if too many pipes already exist in the system
  769.  
  770. BUGS
  771.     There cannot be more than 999 open pipes in the system at
  772.     one time.
  773.  
  774. Last change: Oct. 1, 1991\end
  775.  
  776. screen(capsensitive("Fputchar"))
  777. NAME
  778.     Fputchar - read a character from a file
  779.  
  780. SYNOPSIS
  781.     LONG Fputchar(WORD fh, LONG ch, WORD mode);
  782.  
  783. DESCRIPTION
  784.     Fputchar outputs a character to the GEMDOS file whose handle
  785.     is  fh. The parameter mode has an effect only if the open
  786.     file is a terminal or pseudo-terminal, in which case the
  787.     bits of mode have the following meanings:
  788.  
  789.     0x0001
  790.         Cooked mode; special control characters (control-C and
  791.         control-Z) are checked for  and interpreted if found
  792.         (they cause SIGINT and SIGTSTP, respectively, to be
  793.         raised); also, flow control with control-S and
  794.         control-Q is activated.
  795.  
  796.     If the file receiving output is a pseudo-terminal, then all
  797.     4 bytes of ch are recorded in the write, and may be
  798.     retreived by a Fputchar call on the other side of the
  799.     pseudo-terminal; this allows programs to pass simulated BIOS
  800.     scan codes and shift key status through the pseudo-terminal.
  801.  
  802.     If the file receiving output is not a terminal, then only
  803.     the low order byte of ch is written to the file.
  804.  
  805. RETURNS
  806.     4       (the number of bytes of data transferred) if the write
  807.              was to a terminal
  808.  
  809.     1       if the write was not to a terminal and was successful
  810.  
  811.     0       if the bytes could not be output (for example, because
  812.             of flow control)
  813.  
  814.     EIHNDL  if fh is not a valid handle for an open file.
  815.  
  816.     A (long) negative BIOS error code if an error occured during
  817.     physical I/O.
  818.  
  819. SEE ALSO
  820.     \#Bconout\#, \#Cauxout\#, \#Cconout\#, \#Crawio\#, \#Fgetchar\#, \#Fwrite\#
  821.     
  822. Last change: Oct. 1, 1991\end
  823.  
  824. screen(capsensitive("Freadlink"))
  825. NAME
  826.     Freadlink - determine contents of a symbolic link
  827.  
  828. SYNOPSIS
  829.     LONG Freadlink(WORD bufsiz, char *buf, char *name);
  830.  
  831. DESCRIPTION
  832.     Freadlink determines what file the symbolic link name points
  833.     to, i.e. what the first argument to the \#Fsymlink\# call that
  834.     created name was. This 0-terminated string is placed in the
  835.     memory  region pointed to by buf. The total size of this
  836.     region is given by bufsiz; this must be enough to hold the
  837.     terminating 0.
  838.  
  839. RETURNS
  840.     0       on success
  841.  
  842.     ERANGE  if the symbolic link contents could not fit in buf.
  843.  
  844.     EFILNF  if name is not found.
  845.  
  846.     EACCDN  if name is not the name of a symbolic link.
  847.  
  848.     EINVFN  if the file system containing name does not support
  849.             symbolic links.
  850.  
  851. SEE ALSO
  852.     \#Fsymlink\#
  853.  
  854. BUGS
  855.     The Unix readlink call returns the number of bytes read on
  856.     success, rather than 0.
  857.  
  858. Last change: Oct. 7, 1992\end
  859.  
  860. screen(capsensitive("Fselect"))
  861. NAME
  862.     Fselect - select file descriptors that are ready for reading
  863.     or writing
  864.  
  865. SYNOPSIS
  866.     WORD Fselect(WORD timeout, LONG *rfds, LONG *wfds, ((long)0));
  867.  
  868. DESCRIPTION
  869.     Fselect checks two sets of open file descriptors and deter-
  870.     mines which have data ready to read, and/or which are ready
  871.     to be written to. If none are ready yet, the process goes to
  872.     sleep until some member of the sets are ready or until a
  873.     specified amount of time has elapsed.
  874.  
  875.     rfds points to a long word which represents a set of GEMDOS
  876.     file descriptors; bit n of this long word is set if file
  877.     descriptor n is to be checked for input data. An empty set
  878.     may optionally be represented by a NULL pointer instead of a
  879.     pointer to 0. Similarly, wfds points to a 32 bit long word
  880.     which indicates which file descriptors are to be checked for
  881.     output status. When Fselect returns, the old values pointed
  882.     to by rfds and wfds (if non-NULL) are overwritten by new
  883.     long words indicating which file descriptors are actually
  884.     ready for reading or writing; these will always form subsets
  885.     of the file descriptors originally  specified as being of
  886.     interest.
  887.  
  888.     timeout is a 16 bit unsigned integer specifying a maximum
  889.     number of milliseconds to wait before returning; if this
  890.     number is 0, no maximum is set and the call will block until
  891.     one of the file descriptors specified is ready for reading
  892.     or writing, as appropriate. Thus, Fselect(0,0L,0L,0L) will
  893.     block forever, whereas Fselect(1,0L,0L,0L) will pause for 1
  894.     millisecond.
  895.  
  896.     The final argument, a long word, must always be 0 (it is
  897.     reserved for future enhancements).
  898.  
  899. RETURNS
  900.     The sum of the numbers of bits set in the long words pointed
  901.     to  by rfds and wfds. This will be 0 if the timeout expires
  902.     without any of the specified file descriptors becoming ready
  903.     for reading or writing, as appropriate, and nonzero other-
  904.     wise.
  905.  
  906.     EIHNDL if any handle specified by the long words pointed to
  907.     by rfds or wfds is not a valid (open) GEMDOS handle.
  908.  
  909. SEE ALSO
  910.     \#Finstat\#, \#Foutstat\#
  911.  
  912. BUGS
  913.     The system timer is not actually accurate to the nearest
  914.     millisecond, so the timeout could last for up to 19 mil-
  915.     liseconds longer than specified.
  916.  
  917.     Fselect does not work correctly on any BIOS device except
  918.     the keyboard.
  919.  
  920.     Note that if an error condition occurs on one of the file
  921.     descriptors (for example, if the read status of a pipe with
  922.     no more writers is being requested) then Fselect will mark
  923.     that file descriptor as being ready for reading (or writing,
  924.     as appropriate). This is not strictly speaking a bug, since
  925.     a subsequent read will not block (it will return an error
  926.     condition), but programmers should be aware of the possibil-
  927.     ity.
  928.  
  929. Last change: Oct. 1, 1991\end
  930.  
  931. screen(capsensitive("Fsymlink"))
  932. NAME
  933.     Fsymlink - create a symbolic link to a file
  934.  
  935. SYNOPSIS
  936.     LONG Fsymlink(char *oldname, char *newname);
  937.  
  938. DESCRIPTION
  939.     Fsymlink creates a new symbolic link (a "soft link") for the
  940.     file currently named oldname. If the Fsymlink call is suc-
  941.     cessful, then after the call the file may be referred to by
  942.     either name. A call to \#Fdelete\# on the new name will not
  943.     affect the existence of the file, just of the symbolic link.
  944.     A a call to \#Fdelete\# with the name oldname will actually
  945.     delete the file, and future references with newname will
  946.     fail.
  947.  
  948.     Unlike hard links, symbolic links may be made between files
  949.     on  different devices or even different types of file systems.
  950.  
  951. RETURNS
  952.     0       on success
  953.  
  954.     EINVFN  if the file system does not allow symbolic links
  955.  
  956.     An appropriate error code if the new symbolic link cannot be
  957.     created.
  958.  
  959. SEE ALSO
  960.     \#Flink\#, \#Freadlink\#, \#Frename\#
  961.  
  962. BUGS
  963.     No check is made for the existence of the file named old-
  964.     name; this could be construed as a feature.
  965.  
  966. Last change: Oct. 7, 1991\end
  967.  
  968. screen(capsensitive("Fxattr"))
  969. NAME
  970.     Fxattr - get extended attributes for a file
  971.  
  972. SYNOPSIS
  973.     #include <filesys.h>
  974.  
  975.     LONG Fxattr(WORD flag, char *name, XATTR *xattr);
  976.  
  977. DESCRIPTION
  978.     Fxattr gets file attributes for the file named name and
  979.     stores them in the structure pointed to by xattr. This
  980.     structure is defined in the file filesys.h, and contains the
  981.     following fields of interest:
  982.  
  983.     unsigned short mode
  984.         This field gives the file type and access permissions;
  985.         (mode & S_IFMT) gives the file type (one of S_IFCHR,
  986.         S_IFDIR, S_IFREG, S_IFIFO, S_IMEM, or S_IFLNK); (mode &
  987.         ~S_IFMT) gives the file access mode according to the
  988.         POSIX standard. See filesys.h for the definitions and
  989.         meanings of the constants.
  990.  
  991.     long index
  992.         An index for the file. Together with the "dev" field,
  993.         this is intended to give a unique way of identifying
  994.         the file. Note, however, that not all file systems  are
  995.         able to support this meaning, so it is best not to use
  996.         this field unless absolutely necessary.
  997.  
  998.     unsigned short dev
  999.         The device number for the file. This may be a BIOS device
  1000.         number as passed to the \#Rwabs\# function, or it may be a
  1001.         device number concocted by the file system to represent
  1002.         a remote device.
  1003.  
  1004.     unsigned short nlink
  1005.         Number of hard links to the file. Normally this field
  1006.         will be 1.
  1007.  
  1008.     unsigned short uid
  1009.         The user id of the owner of the file.
  1010.  
  1011.     unsigned short gid
  1012.         The group id of the owner of the file.
  1013.  
  1014.     long size
  1015.         The length of the file, in bytes.
  1016.  
  1017.     long blksize
  1018.         The size of blocks on this file system.
  1019.  
  1020.     long nblocks
  1021.         The number of physical blocks occupied by the file on
  1022.         the disk; this count includes any blocks that have been
  1023.         reserved for the file but do not yet have data in them,
  1024.         and any blocks that the file system uses internally to
  1025.         keep track of file data (e.g. Unix indirect blocks).
  1026.  
  1027.     short mtime
  1028.         The time of the last modification to the file, in stan-
  1029.         dard GEMDOS format.
  1030.  
  1031.     short mdate
  1032.         The date of the last modification, in standard GEMDOS
  1033.         format.
  1034.  
  1035.     short atime, adate
  1036.         The time and date of the last access to the file, in
  1037.         GEMDOS format. Filesystems that do not keep this time
  1038.         will return the values given in "mtime" and "mdate" for
  1039.         these fields as well.
  1040.  
  1041.     short ctime, cdate
  1042.         The time and date of the file's creation, in GEMDOS
  1043.         format. Filesystems that do not keep this time will
  1044.         return the values given in "mtime" and "mdate" for
  1045.         these fields as well.
  1046.  
  1047.     short attr
  1048.         The standard TOS attributes for the file, as returned
  1049.         by \#Fattrib\# and/or \#Fsfirst\#.
  1050.  
  1051.     The flag parameter controls whether or not symbolic links
  1052.     should be followed. If it is 0, then symbolic links are fol-
  1053.     lowed (like the Unix stat function). If flag is 1, then
  1054.     links are not followed and the information returned is for
  1055.     the symbolic link itself (if the named file is a symbolic
  1056.     link); this behavior is like that of the Unix lstat system
  1057.     call.
  1058.  
  1059. RETURNS
  1060.     0       on success
  1061.  
  1062.     EFILNF  if the file is not found
  1063.  
  1064.     EPTHNF  if the path to the file is not found.
  1065.  
  1066. SEE ALSO
  1067.     \#Fattrib\#, \#Fsnext\#
  1068.  
  1069. Last change: Oct. 1, 1991\end
  1070.