I believe the advisory locking is very "old hat" (i.e.
BSD 2, SYSV, etc...), and the more modern/proper way
to get a file lock is to use:

  fcntl(fd, F_GETLK, ...);

  fcntl(fd, F_SETLK, ...);

This is not an 'advisory lock' like flock(), but a lock
in the operating/file system.


fcntl() should be supported by the underlying file system
and is supported across networking (NFSv3 and later, I believe
and SMB.)

So - I believe, UNIX does have this facility.  Just one
of those "gotta know where to look" situations.

Check out the 'man page' for fcntl(2) for more details.

        - Dave Rivers -


zMan wrote:
What is the overall locking mechanism? If program A is reading /some/file
and program B does a rm on it, what happens? From observed behavior, I think
the file doesn't go away until A is done with it. I'm told that:

Unix uses shared memory and mutex locks to ensure that files are locked
between processes.  How was that implemented on z/OS?
...and I'd like to understand it more. Anyone have any pointers?

On Fri, Jul 2, 2010 at 8:19 AM, McKown, John
<john.mck...@healthmarkets.com>wrote:


-----Original Message-----
From: IBM Mainframe Discussion List
[mailto:ibm-m...@bama.ua.edu] On Behalf Of Itschak Mugzach
Sent: Friday, July 02, 2010 7:13 AM
To: IBM-MAIN@bama.ua.edu
Subject: Unix systems and Serialization mechanism

I am looking for a product that will serialize access to file
(like the
Enqueue/Dequeue in GRS) in Unix systems. Does this animal exist?

ITschak

No. UNIX does not have that functionality. I've looked for it. The closest
is called an "advisory lock". This is the flock() function in UNIX. But all
programs which access the file must code the flock() themselves.

http://linux.about.com/library/cmd/blcmdl2_flock.htm



--
riv...@dignus.com                        Work: (919) 676-0847
Get your mainframe programming tools at http://www.dignus.com

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to