From: Chen Qi <[email protected]> Checking whether the lock file exists is sufficient for runqemu. The contents of the lock file is not important.
This patch simplifies the lock acquire/release logic by removing the flock mechanism. Also, we give more information to user indicating why a tap interface is skipped. As a side effect, the user now can easily create a lock file to make runqemu skip a specific tap interface. [YOCTO #5048] Signed-off-by: Chen Qi <[email protected]> --- scripts/runqemu-internal | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal index 8165e13..3f8674c 100755 --- a/scripts/runqemu-internal +++ b/scripts/runqemu-internal @@ -135,15 +135,12 @@ else return 1 fi - touch $lockfile.lock - exec 8>$lockfile.lock - flock -n -x 8 - if [ $? -ne 0 ]; then - exec 8>&- + if [ -e $lockfile.lock ]; then return 1 + else + touch $lockfile.lock + return 0 fi - - return 0 } release_lock() { @@ -154,7 +151,6 @@ else fi rm -f $lockfile.lock - exec 8>&- } LOCKDIR="/tmp/qemu-tap-locks" @@ -184,6 +180,8 @@ else TAP=$tap USE_PRECONF_TAP="yes" break + else + echo "Skipping $tap as it's locked by $LOCKFILE.lock" fi done -- 1.7.9.5 _______________________________________________ Openembedded-core mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-core
