home *** CD-ROM | disk | FTP | other *** search
/ Serving the Web / ServingTheWeb1995.disc1of1.iso / linux / slacksrce / d / libc / libc-4.6 / libc-4 / libc-linux / misc / ftok.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-29  |  362 b   |  20 lines

  1. #include <sys/stat.h>
  2. #include <sys/ipc.h>
  3.  
  4. key_t
  5. ftok (char *path, char id)
  6. {
  7.     struct stat buf;
  8.     key_t key;
  9.  
  10.     if (__stat (path, &buf)) {
  11.     return (key_t) -1;
  12.     }
  13. #if 0
  14.     key = (buf.st_ino & 0xFFFF) | ((buf.st_uid & 0xFF) << 16) | (id << 24);
  15. #else
  16.     key = (buf.st_ino & 0xFFFF) | ((buf.st_dev & 0xFF) << 16) | (id << 24);
  17. #endif
  18.     return key;
  19. }
  20.