home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2610 / lock-file.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-01-25  |  1.6 KB  |  56 lines

  1. /* @(#)lock-file.h    1.1 91/01/24 */
  2. /* copyright (c) Mike Howard & Miller/Howard Investments, Inc. 1990,
  3.    all rights reseved */
  4.  
  5. /* lock_errno values */
  6. #define LCK_OK       0
  7. #define LCK_BLOCK    1  /* the requested lock was blocked */
  8. #define LCK_BADFD    2  /* fd is not a valid file descriptor */
  9. #define LCK_DEADLOCK 3  /* a deadlock was detected */
  10. #define LCK_INTR     4  /* an interupt aborted system call */
  11. #define LCK_OTHER    9  /* some other error - errno may give more information
  12.                            if you know how to interpret it */
  13.  
  14. /* lock_support values */
  15. #define LCK_RECORD      1
  16. #define LCK_SHARED      2
  17. #define LCK_EXCLUSIVE   4
  18. #define LCK_NO_BLOCK    8
  19.  
  20. #ifndef lock_errno
  21. extern int lock_errno;
  22. extern int lock_support;
  23. #endif
  24.  
  25. #ifndef off_t
  26. #define off_t long
  27. #define RM_OFF_T_DEF
  28. #endif
  29. #ifdef PROTOTYPES_OK
  30. int lock_record_shared_wait(int fd, off_t offset, off_t len);
  31. int lock_record_exclusive_wait(int fd, off_t offset, off_t len);
  32. int lock_record_shared_nowait(int fd, off_t offset, off_t len);
  33. int lock_record_exclusive_nowait(int fd, off_t offset, off_t len);
  34. int unlock_record(int fd, off_t offset, off_t len);
  35. int lock_file_shared_wait(int fd);
  36. int lock_file_exclusive_wait(int fd);
  37. int lock_file_shared_nowait(int fd);
  38. int lock_file_exclusive_nowait(int fd);
  39. int unlock_file(int fd);
  40. #else
  41. int lock_record_shared_wait();
  42. int lock_record_exclusive_wait();
  43. int lock_record_shared_nowait();
  44. int lock_record_exclusive_nowait();
  45. int unlock_record();
  46. int lock_file_shared_wait();
  47. int lock_file_exclusive_wait();
  48. int lock_file_shared_nowait();
  49. int lock_file_exclusive_nowait();
  50. int unlock_file();
  51. #endif
  52.  
  53. #ifdef RM_OFF_T_DEF
  54. # undef off_t
  55. #endif
  56.