home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / c / syscall / Fs_IOControl.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-27  |  2.2 KB  |  83 lines

  1. /* 
  2.  * Fs_IOControl.c --
  3.  *
  4.  *    Source code for the Fs_IOControl library procedure.
  5.  *
  6.  * Copyright 1988 Regents of the University of California
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that the above copyright
  10.  * notice appear in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  */
  15.  
  16. #ifndef lint
  17. static char rcsid[] = "$Header: /sprite/src/lib/c/syscall/RCS/Fs_IOControl.c,v 1.2 89/09/27 16:52:47 douglis Exp $ SPRITE (Berkeley)";
  18. #endif not lint
  19.  
  20. #include <sprite.h>
  21. #include <status.h>
  22. #include <fs.h>
  23.  
  24.  
  25. /*
  26.  *----------------------------------------------------------------------
  27.  *
  28.  * Fs_IOControl --
  29.  *
  30.  *      The "normal" Fs_IOControl interface for user code.
  31.  *    Retries some operations when GEN_ABORTED_BY_SIGNAL is
  32.  *    returned from the kernel.  The list of operations is not
  33.  *    yet inclusive.  
  34.  *
  35.  * Results:
  36.  *    An error code.
  37.  *
  38.  * Side effects:
  39.  *    Variable.
  40.  *
  41.  *----------------------------------------------------------------------
  42.  */
  43.  
  44. ReturnStatus
  45. Fs_IOControl(streamID, command, inBufSize, inBuffer, outBufSize, outBuffer)
  46.     int     streamID;    /* User's handle on the stream */
  47.     int     command;    /* IOControl command */
  48.     int     inBufSize;    /* Size of inBuffer */
  49.     Address     inBuffer;    /* Command specific input parameters */
  50.     int     outBufSize;    /* Size of outBuffer */
  51.     Address     outBuffer;    /* Command specific output parameters */
  52. {
  53.     ReturnStatus status;
  54.     do {
  55.     status = Fs_RawIOControl(streamID, command, inBufSize, inBuffer,
  56.                  outBufSize, outBuffer);
  57.     if (status == GEN_ABORTED_BY_SIGNAL) {
  58.         switch(command) {
  59. #ifdef notdef
  60. /*
  61.  * IOC_LOCK can block forever unexpectedly if a signal is suppressed.
  62.  */
  63.         case IOC_LOCK:
  64. #endif
  65.         case IOC_UNLOCK:
  66.         case IOC_NUM_READABLE:
  67.         case IOC_TRUNCATE:
  68.         case IOC_GET_OWNER:
  69.         case IOC_SET_OWNER:
  70.         case IOC_MAP:
  71.         case IOC_REPOSITION:
  72.         case IOC_SET_FLAGS: 
  73.         case IOC_CLEAR_BITS:
  74.         break;
  75.  
  76.         default:
  77.         return(status);
  78.         }
  79.     }
  80.     } while (status == GEN_ABORTED_BY_SIGNAL);
  81.     return(status);
  82. }
  83.