HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- exclusive access on files
Operating System - Linux
1828590
Members
2425
Online
109983
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
09-09-2005 03:02 AM
09-09-2005 03:02 AM
exclusive access on files
Is there any way in C to open a file (on HP-UX) having an exclusive access for writing?
I mean I have just one process that have to write in this file while other programs can only read. Is it possible?
On other Unix flavour there is the flag “O_RSHARE” for the “open” api. On HP?
Thanks.
I mean I have just one process that have to write in this file while other programs can only read. Is it possible?
On other Unix flavour there is the flag “O_RSHARE” for the “open” api. On HP?
Thanks.
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2005 03:32 AM
09-09-2005 03:32 AM
Re: exclusive access on files
There is no direct equivalent but you can use
lockf() or fcntl() to do this. If you set the setgid bit on the data file then the locks become mandatory rather than advisory.
A far simpler solution and one that would be portable across all flavors of UNIX is to set the permissions to 640 or 644 and the "writer" process would have the effective UID of the owner of the file.
lockf() or fcntl() to do this. If you set the setgid bit on the data file then the locks become mandatory rather than advisory.
A far simpler solution and one that would be portable across all flavors of UNIX is to set the permissions to 640 or 644 and the "writer" process would have the effective UID of the owner of the file.
If it ain't broke, I can fix that.
- Tags:
- lockf
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP