Annotation of coherent/b/lib/libc/gen/ftok.c, revision 1.1

1.1     ! root        1: /* 
        !             2:  * libc/gen/ftok.c
        !             3:  * Return key based on path and id.
        !             4:  * Return -1 if path is not accesible.
        !             5:  */
        !             6: 
        !             7: #include <sys/ipc.h>
        !             8: #include <sys/stat.h>
        !             9: 
        !            10: key_t
        !            11: ftok(name, id)
        !            12: char   *name;          /* name of file, could be special file or directory */
        !            13: int    id;                             /* project id */
        !            14: {
        !            15:        register key_t  key;            /* key value */
        !            16:        struct  stat    s;              /* stat buffer */
        !            17: 
        !            18:        return ((key = stat(name, &s)) < 0) ? key
        !            19:                : (key_t)(s.st_ino<<8 | ((key_t)(id & 0xFF))<<24 | minor(s.st_dev));
        !            20: }
        !            21: 
        !            22: /* end of ftok.c */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.