Does anyone know what's going on here? I'm not on the kernel mailing list,
please reply to me directly.
Thanks - Jim
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/file.h>
main()
{
int fd;
printf("Opening file\n");
if (fd=open("lockfile",O_RDWR) < 0) {
printf("Open failed\n");
exit(1);
}
printf("File opened, locking for write\n");
if (flock(fd,LOCK_EX)) {
printf("Lock failed\n");
exit(1);
}
printf("File locked for write, sleeping 15 seconds\n");
sleep(15);
if (flock(fd,LOCK_UN)) {
printf("Unlock failed\n");
exit(1);
}
printf("File unlocked from write, exiting\n");
close(fd);
exit(0);
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html