benilla-re systems structs docs

__unguarded_readlc_active

global · crt

Address
0xcf7290 · 4 bytes, up to 0xcf7293
Type
int32_t
Meaning
Counts the locale readers running without the locale lock, raised and lowered around each
Confidence
verified, proof one
Finding
crt/time#the-strftime-format-loop

Finding: The strftime format loop in crt: calendar time

strftime(out, max, format, tm) calls _Strftime with no time record, which takes __lc_time_curr, the C locale's record. It copies each byte of the format that is not % while room is left. A % clears the # mark, takes a # after it as the mark, and expands the next byte, whatever it is: a format that ends in % expands its NUL, which writes nothing, and reads on past it. The loop ends when the room or the format runs out; with room left it writes a NUL and answers the bytes before it, else it answers 0 with no NUL written.

The derivation is in the doc.