[PATCH] ltq-dsl-base: only lock the dsl pipe once for all stats

Andre Heider a.heider at gmail.com
Fri Dec 4 07:25:09 EST 2020


Hi,

On 04/12/2020 13:03, Jo-Philipp Wich wrote:
> Hi,
> 
> is there any reason not to use the flock style below? It should be more
> reliable wrt. unlocking if the script is prematurely terminated.

I guess because it gets more difficult to fish out the answer for each 
command then (I didn't check if it's guaranteed to be one line for each)?

But with `trap` I introduced it should be just as reliable I think?

In the end the script is still a mess... The two cleanups I did were 
just the low hanging fruit.

The proper performance fix would be to move 'lucistat' to ltq-vdsl-app 
itself. But there's ltq-adsl-app too, so maybe that's not desired from a 
maintenance point of view.

Thanks,
Andre


> -- 8< --
>    {
>        flock -x 1000
> 
>        command
>        command
>        command
>        ...
>    } 1000>/var/lock/dsl_pipe
> -- >8 --
> 
> 
> See also the fourth example at
> https://man7.org/linux/man-pages/man1/flock.1.html#EXAMPLES
> 
> ~ Jo
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> 




More information about the openwrt-devel mailing list