🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: uw.mfcf.software
Article #246

/usr/source/.xlsource/mfcf/misc/flock/flock.c

#246
From: rjwhite
Date: Fri, 08 Sep 1989 18:31
22 lines
1445 bytes
From: RJ White <rjwhite>

flock(2) sorta doesnt work on Mips machines.
Ive beat on the flock (1) user command  to work there.
source updated on math, not installed anywhere.  Not really sure where
its supposed to be.

The main problems with flock(2) on Mips are that for exclusive locks,
the file has be be opened for write, and flocks are not inherited
by children.  And the return error message is dumb: No permission.
So in flock(1), the flock has to be done in the child, after opening
the file RDWR, then pass the process-id of itself back to the parent
who can print it out and then exit so you can still do stuff like:
	pid=`flock file`
in scripts.  If the flock fails for ANY reason, it writes out the
...Operation would block... message on Mips to be consistent with the
other machines in case anybody actually checks the return message in scripts.

The Mips docu claims that fcntl's and flock's dont work together.
I found that they did when trying two differnt versions of flock(1)
using both fcntl and flock(2), so I used the flock(2) so it was the least
amount of changes.
Technical Details
Message-ID: <28987@watmath.waterloo.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!rjwhite

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!rjwhite
From: rjwhite@watmath.waterloo.edu
Newsgroups: uw.mfcf.software
Subject: /usr/source/.xlsource/mfcf/misc/flock/flock.c
Message-ID: <28987@watmath.waterloo.edu>
Date: 8 Sep 89 18:31:28 GMT
Sender: rjwhite@watmath.waterloo.edu
Reply-To: rjwhite@watmath.waterloo.edu
Distribution: uw
Lines: 22