/usr/bin/locker is in flowscan 1.006-13.2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | #! /usr/bin/perl
# locker - a utility to run a command under the protection of a file lock
# Dave Plonka, Mar 5 1998
require 5.004;
require 'getopts.pl';
use Fcntl ':flock';
use POSIX; # strftime
$format = "%b %d %H:%M:%S"; # format argument to strftime
$script = $0;
$script =~ s:^.*/::;
if (!&Getopts("e:s:nvV") || !($opt_e || $opt_s)) {
print STDERR <<_EOF_
usage: $script < -e file | -s file > [ -n ] command [ args ... ]
-e file - lock specified file for exclusive (write) access
-s file - lock specified file for shared (read) access
-n - do an "non-blocking" attempt to lock specified file
_EOF_
;
exit 2
}
if ($opt_e) {
$file = $opt_e;
open(LOCK, "+<$file") || die "open \"$file\" for update failed: $!\n";
$operation = LOCK_EX;
} else { # $opt_s
$file = $opt_s;
open(LOCK, "<$file") || die "open \"$file\" for read failed: $!\n";
$operation = LOCK_SH;
}
if ($opt_n) {
$operation |= LOCK_NB;
}
if (!flock(LOCK, $operation)) {
print(STDERR strftime($format, localtime), " - \"@ARGV\" - ") if $opt_v;
die "flock failed: $!\n"
}
print("system \"@ARGV\"\n") if $opt_V;
$saved = int(system("@ARGV")/256);
print(strftime($format, localtime), " - \"@ARGV\" - exit: ", $saved, "\n") if $opt_v;
if (!flock(LOCK, LOCK_UN)) {
print(STDERR &ftime(time), " - \"@ARGV\" - ") if $opt_v;
warn "flock (unlock) failed: $!\n"
}
exit $saved
|