- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- HP UNIX open and lockf
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2011 12:36 PM
02-23-2011 12:36 PM
HP UNIX open and lockf
I have a case of the data in the file seemingly getting corrupted.
More than one process can call the function that opens the file, locks the file reads the file, adds 1 to a field in the file, writes it back and then unlocks the file. The value being incremented is getting incremented by alot. Note these calls are happening from copies of a program that are potentially handling lots of data (many calls).
- Tags:
- lockf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2011 01:06 PM - last edited on 08-04-2011 11:33 AM by Kevin_Paul
02-23-2011 01:06 PM - last edited on 08-04-2011 11:33 AM by Kevin_Paul
Re: HP UNIX open and lockf
Hi:
> Will the inclusion of O_SYNC effect the use of lockf?
No. 'O_SYNC' simply means that the writing process will not be informed of an IO complete until both the updated data and the file's metadata are committed to disk.
As for file locking, remember that locking is only advisory regardless of whether they are exclusive attempts or shared ones. Hence, if all of your code isn't "playing nice" and observing locks, not-so-nice things can happen.
by the way, it would be appropriate for you to evaluate the responses you received in your earlier thread:
http://h30499.www3.hp.com/t5/Languages-and-Scripting/Automatic-Dayligh-Saving-Setting/m-p/4714709#M29056
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2011 01:53 PM
02-23-2011 01:53 PM
Re: HP UNIX open and lockf
There is a comment in the man page that I want to be sure I understand. It is "All locks for a process are released upon
the first close of the file, even if the process still has the file
opened,"
Can I assume the first close for this process is what is meant and it will not affect locks for another process?
Thanks,
Ron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2011 02:48 AM
02-24-2011 02:48 AM
Re: HP UNIX open and lockf
The words seem clear in lockf(2):
WARNINGS When a file descriptor is closed, all locks on the file from the calling process are deleted, even if other file descriptors for that file still exist.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2011 06:34 AM
02-24-2011 06:34 AM
Re: HP UNIX open and lockf
Ron