* SUMMARY: How to: File locking with perl
@ 1997-02-05 14:56 Brian Sherwood
0 siblings, 0 replies; only message in thread
From: Brian Sherwood @ 1997-02-05 14:56 UTC (permalink / raw)
To: tru64-unix-managers
Thanks to all that replied.
I ended up using peices of a script from Eric Z. Ayers to create the
following small test program.
I was using "sslli" for my flags to pack. Eric's "ssiii" worked much
better.
Something strange though, I could not get the "open" to open a file
read/write without first truncating it. I had to use "sysopen".
#!/usr/local/bin/perl
use Fcntl;
use POSIX;
$INFILE="qwqwqwqw";
$flags="ssiii";
$s_flock = pack ($flags,F_WRLCK,SEEK_CUR,1,0,0);
@ary=unpack $flags,$s_flock;
print "@ary\n";
sysopen (INFILE,$INFILE,O_RDWR|O_EXCL) or die "sysopen infile";
fcntl (INFILE,F_SETLKW,$s_flock) or die "fcntl:$!:";
print "After fcntl\n";
$ttt=<STDIN>;
seek (INFILE,0,SEEK_END);
print INFILE $ttt;
close (INFILE);
-------------------------------------------------------
Brian Sherwood E-mail: sherwood@esu.edu
Network Administrator Phone: 717-422-3299
East Stroudsburg University
East Stroudsburg PA 18301
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1997-02-05 14:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-02-05 14:56 SUMMARY: How to: File locking with perl Brian Sherwood
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox