home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_08_04 / 8n04084a < prev    next >
Text File  |  1990-03-20  |  1KB  |  42 lines

  1. *****Listing 1*****
  2.  
  3. semaphor.h
  4.  
  5. #ifndef SEMAPHOR_H    /* prevent multiple includes */
  6. #define SEMAPHOR_H
  7.  
  8. #include <limits.h>
  9. #ifndef PATH_MAX
  10. #define PATH_MAX    (256)        /* max # of characters in a path name */
  11. #endif
  12.  
  13. /* constants */
  14. #define SEMOPEN_MAX    (60)        /* max # semaphore sets open at once */
  15.  
  16. /* type definitions */
  17. typedef struct {            /* semaphore set control structure */
  18.     char semdir[PATH_MAX + 1];    /* semaphore directory path name */
  19.     int semc;            /* semaphore count */
  20. } semset_t;
  21.  
  22. /* function declarations */
  23. int        semclose(semset_t *ssp);
  24. #define        semcount(ssp)    ((ssp)->semc)
  25. int        semlower(semset_t *ssp, int semno);
  26. semset_t *    semopen(char *semdir, int flags, int semc);
  27. int        semraise(semset_t *ssp, int semno);
  28. int        semremove(char *semdir);
  29.  
  30. /* semopen command flags */
  31. #define SEM_CREAT    (01000)        /* create and open */
  32. #define SEM_EXCL    (02000)        /* exclusive open */
  33.  
  34. /* error codes */
  35. #define SEMEOS        (0)        /* start of error code domain */
  36. #define SEMEMFILE    (SEMEOS - 1)    /* too many semaphore sets open */
  37. #define SEMPANIC    (SEMEOS - 2)    /* internal semaphore error */
  38.  
  39. #endif    /* #ifndef SEMAPHOR_H */
  40.  
  41.  
  42.