- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to list file locks
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
09-14-2001 12:18 PM
09-14-2001 12:18 PM
How to list file locks
Is there a way to know what processes have locks on a file, and what kind of locks?
I was looking at lslk/lsof, by Victor Abell from Purdue University, but lslk doesn't seems to be ported to HP/UX, and lsof lists only the first entry on the lock table for each given file.
I had made a little and ugly utility that reads the whole file using fcntl, looking for the locked regions, but I think something better must exists, that obtains the information directly from the kernel lock tables.
Cheers,
Mauro
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2001 12:21 PM
09-14-2001 12:21 PM
Re: How to list file locks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2001 12:30 PM
09-14-2001 12:30 PM
Re: How to list file locks
If you have Glance+ installed, you can get the information as below.
$echo "print tbl_file_lock_util " >> test
$glance -j 1 -i 1 -adviser_only -syntax test
This will print the nflock usage.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2001 12:48 PM
09-14-2001 12:48 PM
Re: How to list file locks
Please discard my message... I mistook.
The best tool that is ever known for openfile/locks is lsof. If that doesn't work for you... then I mute myself.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2001 12:58 PM
09-14-2001 12:58 PM
Re: How to list file locks
Thanks for the answers, but:
1) fuser desn't tell me anything about locks(Just about opens)
2) I don't want to know the file lock table utilization percentage, but the list of processes that have locks(read locks and/or write locks)on sectors of a file or in all the file(in the last case, I can use lsof)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2001 08:47 PM
09-16-2001 08:47 PM
Re: How to list file locks
If you are looking for unix command / utility instead of C function, it won't work as, by the time you find out whether file / sector of file is locked / unlocked, the information can become out of date. with lockf, you can avoid this by aquiring lock.
Following is taken from "man lockf" ..
===============================================
Application Usage
Because in the future the variable errno will be set to EAGAIN rather
than EACCES when a section of a file is already locked by another
process, portable application programs should expect and test for
either value. For example:
if (lockf(fd, F_TLOCK, siz) == -1)
if ((errno == EAGAIN) || (errno == EACCES))
/*
* section locked by another process
* check for either EAGAIN or EACCES
* due to different implementations
*/
else if ...
/*
* check for other errors
*/
==============================================
Regards,
Suhas