File:  [MW Coherent from dump] / coherent / b / lib / libc / gen / ftok.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:35 2019 UTC (7 years ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

/* 
 * libc/gen/ftok.c
 * Return key based on path and id.
 * Return -1 if path is not accesible.
 */

#include <sys/ipc.h>
#include <sys/stat.h>

key_t
ftok(name, id)
char	*name;		/* name of file, could be special file or directory */
int	id;				/* project id */
{
	register key_t	key;		/* key value */
	struct	stat	s;		/* stat buffer */

	return ((key = stat(name, &s)) < 0) ? key
		: (key_t)(s.st_ino<<8 | ((key_t)(id & 0xFF))<<24 | minor(s.st_dev));
}

/* 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.