- Community Home
- >
- Servers and Operating Systems
- >
- Legacy
- >
- Operating System - Tru64 Unix
- >
- Perl / flock oddity
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
Discussions
Discussions
Forums
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
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
тАО10-21-2005 09:20 AM
тАО10-21-2005 09:20 AM
Tru64 5.1B / Patch Kit 4
I'm trying to use the 'flock' system call from within a perl script. The code is attached. It turns out that if I don't explicity reset the OS_ERROR variable '$!' in the program, it never detects that the lock has been released. I.E. with the line commented out as in the attachment, the second and all subsequent invocations of the program just wait in the 15 second loop indefinitely. If you uncomment the line '$! = 0;' it works just fine.
Does this make sense to anybody? What am I missing?
TIA...
Solved! Go to Solution.
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-24-2005 09:33 PM
тАО10-24-2005 09:33 PM
Re: Perl / flock oddity
I tried executing the attached program. It works as expected (even with commenting the statement " $! == 0; ". I tested on system with V5.1B + patchkit4. Can you let us knwo the version of the perl you are using "perl -v". Logs are attached.
/Sreedhar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-25-2005 03:31 AM
тАО10-25-2005 03:31 AM
Re: Perl / flock oddity
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-25-2005 04:02 AM
тАО10-25-2005 04:02 AM
Re: Perl / flock oddity
as my perl book says, $! is only set in case of an os system error. You probably have to reset it yourself.
greetings,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-26-2005 12:07 AM
тАО10-26-2005 12:07 AM
Re: Perl / flock oddity
I am able to reproduce the reported problem with multiple invocations. I tested in other flavours of UNIX (Solaris and HP-UX). Logs are attached. There perl is behaving differently. No difference is seen in behaviour with/with out commenting out the statement "$! == 0".
/Sreedhar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-26-2005 02:37 AM
тАО10-26-2005 02:37 AM
Solutionthe code should work as follows.
Got that with the help of procura.
greetings,
Michael
if (flock (HANDLE, (LOCK_EX|LOCK_NB)))
{
print STDOUT "Lock acquired - sleeping for one minute\n" ;
$waiting = 0;
sleep 60 ;
} else
{
if ( $! == EWOULDBLOCK )
{
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-26-2005 04:46 AM
тАО10-26-2005 04:46 AM