Date: Mon, 26 Jan 1998 01:49:45 -0500 From: Geoffrey Robinson <grobin@accessv.com> To: questions@FreeBSD.ORG Subject: How Do You Lock File in UNIX? Message-ID: <34CC3209.55603446@accessv.com>
next in thread | raw e-mail | index | archive | help
I'm working on a CGI program in C that will be running very frequently and will undoubtedly corrupt its data files if I don't lock them. I discovered the flock command, which I think will do what I need but I've never dealt with file locking in UNIX before and it uses terminology I'm not familiar with like file descriptor and shared vs. exclusive locks so I'm not quite sure how to use it. I simply want to be able to lock a file for either reading, writing or both but I'll settle for just both if that's the only option. Could somebody please explain how to properly lock a file and give me an example, it would be a big help. thanks. -- Geoffrey Robinson grobin@accessv.com Oakville, Ontario, Canada.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?34CC3209.55603446>