On 07/28/2018 06:04 AM, Matt Darfeuille wrote: > On 7/26/2018 8:41 PM, Tom Eastep wrote: >> On 07/26/2018 09:54 AM, Brian J. Murrell wrote: >>> On Thu, 2018-07-26 at 08:51 -0700, Tom Eastep wrote: >>>> >>>> Brian, >>> >>> Hi Tom, >>> >>>> Can you point me to online documentation that describes how this >>>> 'lock' >>>> utility is supposed to work? >>> >>> It's a busybox applet added to busybox by OpenWRT. Here's the source >>> for it: >>> >>> https://github.com/openwrt/openwrt/blob/154c0c4006daf41e2cbb6c8b7ad5557f83dfea3e/package/utils/busybox/patches/220-add_lock_util.patch >>> >>> There seems to be minimal documentation at: >>> >>> https://wiki.openwrt.org/inbox/script/manual_busybox_functions_openwrt >>> >> >> Thanks Brian, >> >> Please see if this patch resolves the issue. The lib.common file has not >> changed since 5.1.12.3 (other than the banner version) so you can apply >> the patch on your admin system then copy lib.common to the router. >> > > Tom, with MUTEX_ON.patch applied, on LEDE '--pid' is not available or is > it done on purpose?: > > root@LEDE:~# ps --pid > ps: unrecognized option: pid > BusyBox v1.25.1 () multi-call binary. > > Usage: ps > > Show list of processes > > w Wide output > root@LEDE:~# > > Brian, any thoughts on the patch? >
This patch should resolve the 'ps' issue, as 'ps' is no longer invoked on OpenWRT. -Tom -- Tom Eastep \ Q: What do you get when you cross a mobster with Shoreline, \ an international standard? Washington, USA \ A: Someone who makes you an offer you can't http://shorewall.org \ understand \_______________________________________________
diff --git a/Shorewall-core/lib.common b/Shorewall-core/lib.common index 205fc705f..bbebf0936 100644 --- a/Shorewall-core/lib.common +++ b/Shorewall-core/lib.common @@ -751,6 +751,8 @@ mutex_on() lockf=${LOCKFILE:=${VARDIR}/lock} local lockpid local lockd + local lockbin + local openwrt MUTEX_TIMEOUT=${MUTEX_TIMEOUT:-60} @@ -760,28 +762,33 @@ mutex_on() [ -d "$lockd" ] || mkdir -p "$lockd" + lockbin=$(qt mywhich lock) + openwrt=[ -n "$openwrt" -a -h "$openwrt" ] + if [ -f $lockf ]; then lockpid=`cat ${lockf} 2> /dev/null` if [ -z "$lockpid" ] || [ $lockpid = 0 ]; then rm -f ${lockf} error_message "WARNING: Stale lockfile ${lockf} removed" - elif [ $lockpid -eq $$ ]; then - fatal_error "Mutex_on confusion" - elif ! qt ps --pid ${lockpid}; then - rm -f ${lockf} - error_message "WARNING: Stale lockfile ${lockf} from pid ${lockpid} removed" + elif [ -z "$openwrt" ]; then + if [ $lockpid -eq $$ ]; then + fatal_error "Mutex_on confusion" + elif ! qt ps --pid ${lockpid}; then + rm -f ${lockf} + error_message "WARNING: Stale lockfile ${lockf} from pid ${lockpid} removed" + fi fi fi - if qt mywhich lockfile; then + if [ -n "$openwrt" ]; then + lock ${lockf} || fatal_error "Can't lock ${lockf}" + g_havemutex="lock -u ${lockf}" + elif qt mywhich lockfile; then lockfile -${MUTEX_TIMEOUT} -r1 ${lockf} || fatal_error "Can't lock ${lockf}" g_havemutex="rm -f ${lockf}" chmod u+w ${lockf} echo $$ > ${lockf} chmod u-w ${lockf} - elif qt mywhich lock; then - lock ${lockf} || fatal_error "Can't lock ${lockf}" - g_havemutex="lock -u ${lockf}" else while [ -f ${lockf} -a ${try} -lt ${MUTEX_TIMEOUT} ] ; do sleep 1
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________ Shorewall-users mailing list Shorewall-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/shorewall-users