1 /* 2 * Copyright 2008, Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Salvatore Benedetto <salvatore.benedetto@gmail.com> 7 */ 8 9 #include <sys/ipc.h> 10 #include <sys/stat.h> 11 12 13 key_t 14 ftok(const char *path, int id) 15 { 16 struct stat st; 17 18 if (stat(path, &st) < 0) 19 return (key_t)-1; 20 21 return (key_t)(id << 24 | (st.st_dev & 0xff) << 16 | (st.st_ino & 0xffff)); 22 } 23