lockfile/unix/c

S.RAVIKUMAR iluvu at homxc.ATT.COM
Thu Apr 13 07:26:32 AEST 1989


I tried to restrict access to a shared resource between
processes using the unix system call "lockf". The piece of code
is as follows:

	fd = open(FILENAME, O_CREAT, 0666);
	lockf(fd, F_LOCK, (long)0);

"lockf" always returns with an error and errno is set to "Bad
file descriptor". Any help or suggestions are welcome.

Thanks.

--ravi
skumar at hocus.att.com



More information about the Comp.unix.questions mailing list