blob: 2f91889948ef3201ce7eccb1e7ce2a6f603aea50 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
We remove the perl snippet to verify the lockfile with lockfd to
avoid perl dependency
use a tiny C app to do the same job.
--- ./tools/hotplug/Linux/locking.sh.orig
+++ ./tools/hotplug/Linux/locking.sh
@@ -51,14 +51,8 @@
# actually a synthetic symlink in /proc and we aren't
# guaranteed that our stat(2) won't lose the race with an
# rm(1) between reading the synthetic link and traversing the
- # file system to find the inum. Perl is very fast so use that.
- rightfile=$( perl -e '
- open STDIN, "<&'$_lockfd'" or die $!;
- my $fd_inum = (stat STDIN)[1]; die $! unless defined $fd_inum;
- my $file_inum = (stat $ARGV[0])[1];
- print "y\n" if $fd_inum eq $file_inum;
- ' "$_lockfile" )
- if [ x$rightfile = xy ]; then break; fi
+ # file system to find the inum. We use tiny C file for that
+ if /usr/lib/xen/bin/xen-fd-is-file $_lockfd $_lockfile; then break; fi
# Some versions of bash appear to be buggy if the same
# $_lockfile is opened repeatedly. Close the current fd here.
eval "exec $_lockfd<&-"
|