[Sony Cross-Device General] mionica:
release v2.4 - experimental

Right lads. Here's the treat I threatened you with: release 2.4 :)

This is highly recommended to all those who are having issues with high-load resets with v2.3 or earlier.

Now, this is pretty stable - I tested the living **** out of it - but I don't want this published on #123, attched to #1, or even mentioned on #1 yet - this is experimental stuff.

Changelog:

flimits are reverted for the entire zygote process tree (previously, only zygote and its first-order children were restored);

ironically, this restores the functionality that was available in v2(.0) and v1 - which reverted the flimits for all the zygote descendants - the ol' busybox ps|busybox awk '{ print $1 }' thing :p

function scan_ptree()
{
pids="$pids $1"
local lpids=$($BB pgrep -P $1)
for pid in $lpids
do
scan_ptree $pid
done
}
[color=silver]...[/color]
pids=
scan_ptree $($BB pidof zygote)

fully configurable limits (via .prop file)

a sample .prop file exists in the .zip, but is not copied anywhere; that's just for you to have the syntax handy;

the .prop file is not required - I expect most users to never have one; if not found, the default values are used, which are exactly the same as in v2.3

reverting the limits once boot completes can optionally be disabled

renamed the restore script to 98* - there was already a 99 entry (SuperSU)

and yes, the installer does remove the old 99* script - without disturbing SuperSU :p

after seeing how long the flimit restore step actually took, I changed the delay between iterations back to 1s (up from 100ms)

just for cleanliness, busybox applets are always invoked using "busybox name" instead of "name"

The prop file has to be named flimit.prop, and is searched for in the following folders, in the following order:

external_sd/XZDualRecovery/

external_sd/

internal_sd/XZDualRecovery/

internal_sd/

Search stops on the first path featuring the .prop file; if no .prop file is found, the defaults are used.

Supported flimit.prop parameters:

fl.during.boot.soft - defaults to 2047;

fl.during.boot.hard - defaults to 4095;

fl.keep.boot.limit - defaults to false; any value except "true" also means false, including things like TRUE, 1, yes and on:p

fl.after.boot.soft - defaults to 1024;

fl.after.boot.hard - defaults to 4096.

The names should be pretty self-explanatory.

The behavior is pretty much what you'd expect:

on boot, zygote's flimits are set as indicated by the fl.during.boot.* properties

if fl.keep.boot.limit is true, those values are kept even after boot completes;

if fl.keep.boot.limit is anything except true (or missing), the flimits of zygote and all its descendants which didn't change their own flimits are set as indicated by the fl.after.boot.* properties

To noob-proof the scripts now that they can be configured, I put a hack in the code: if either one of the fl.during.boot.* properties are even, it gets decremented before use; this is needed in order to be able to detect which processes didn't change their own flimits. So if you attempt to set them to 2048:4096, 2047:4095 will be used instead; or if you say 1536:4095, 1535:4095 will be used instead.

NSOFT="$(fgetprop $dir/flimit.prop fl.during.boot.soft)"
NSOFT=$(( $NSOFT ))
if $BB test $NSOFT -eq 0; then NSOFT=${DEF_NSOFT}; fi
if $BB test $(( $NSOFT % 2 )) -eq 0; then NSOFT=$(( $NSOFT - 1 )); fi

One more thing; I looked at [MENTION=4904057][NUT][/MENTION] 's DRGETPROP, didn't like the awk $NF thing, and implemented this:

# string fgetprop( string file, string name )
function fgetprop {
PAT=$($BB echo -n $2 | $BB sed 's,\.,\\.,g')
$BB grep -E "^[ \t]*$PAT[ \t]*=" "$1" 2>/dev/null | $BB tail -1 \
| $BB sed 's,^[^=]*=[ \t]*,,' | $BB sed 's,#.*,,' \
| $BB sed 's,^[ \t]*,,' | $BB sed 's,[ \t]*$,,'
}

Which I hope would meet his quality standards :) - it surely meets mine (except for the missing quotes around $2 in the $PAT definition :|).

So finally, all you need to do to experiment is to edit a file from the sdcard and reboot; phone no longer booting with the settings you just tried? No problem, just reboot with the sdcard removed. I STRONGLY suggest that people shouldn't keep a flimit.prop on their internal sdcard at all!!! - .prop on internal sdcard is supported for a reason, which isn't to be used as a playground; I'm not documenting that in the official changelog, and I reserve the right to remove it as I damn well please ;)