imsd, engine: the registration through a sleep

The refresh of the registration was due after so many awake seconds: its
gate ran on the steady clock, which stands still in a suspend, while the
network counts the registration's lifetime on. A phone that slept most
of two hours sent no refresh and lost its registration (the dev phone,
KPN, 1.1.0, 2026-11-19: registered 09:15:48 for 7200 s, the network's
NOTIFY of the expiry at 11:16:37, registered again 11:37:38 behind the
fresh-SA throttle). Until now the image imsd was written on did not let
its phone suspend.

The refresh's gate and the renewal of the reg-event subscription ahead
of its granted lifetime's end now run on the boot clock, as the recovery
policy's waits already did. And a timer on CLOCK_BOOTTIME_ALARM, which
the kernel turns into the RTC's alarm for a suspend, is armed at the end
of every turn of the loop that takes no command off the queue (one that
takes a command handles it and goes straight to the next turn) for the
time the new WakeAt names (Imsd:Engine): now while a call or a text is
in flight (the hold below); else, with a registration on a live flow,
the refresh's due time, or the subscription's renewal where that comes
first; with a dead flow under a registration the recovery policy's word;
none where nothing waits to be done. The timer is never read: the waking
is the whole of it, and the loop's own clock checks act once the phone
is awake. A resume by itself sends nothing. Where the kernel gives no
such timer (it takes CAP_WAKE_ALARM) or has no RTC behind it, the
journal says so once.

What imsd waits for with the phone awake must not be cut off by a
suspend either. Beside the call's lock the main thread asks for a second
block inhibitor, in the way it asks for the call's, while a step of the
registration exchanges with the network (the refresh, a reconnect, a
fresh registration, the bring-up) and while a text is being sent, whose
waits (128 s for a MESSAGE's final, 130 s for the report) count awake
seconds; not while a bring-up waits out a hold the network set, which
can be an hour. A step can begin before the bus connection is there: its
lock, like a call's, is asked for when the connection comes. For a
suspend that begins all the same (logind refused such a lock where a
suspend's operation was already running; a request can tell it to ignore
inhibitors) there is the alarm: under a call and under a text in flight,
and where a step is due that the next turn runs (but for the look after
a local wait, which has its own slower time), it is set 1.9 s ahead at
every such turn, and the kernel refuses a suspend under an alarm less
than two seconds ahead (alarmtimer_suspend, read at v7.3) where the
suspend comes to that check before the alarm has fired: it syncs and
freezes the processes first. A registration step keeps it at most 30 s
ahead while it waits for the network, whatever else is in flight, so
that a sleep that begins under the step ends there. The alarm fires
once, and a wait can outlast the sleep it ended: it is set anew before
every second of such a wait (a connect's answer, the pause before the
next try, a REGISTER's answer). One of those waits is a receive with a
timeout (the fresh registration's first answer, on a socket of its own),
which the kernel ends with EINTR when a suspend freezes the thread: it
is taken up again for the rest of its time. The connect for a call's
resend is no step and sets the 1.9 s anew the same way, before every
second. A wait for a helper program keeps the alarm that stood when it
began.

A coverage gap must not cost the phone its sleep. The recovery tried a
reconnect 5 s after each one that failed, over TCP 34 s of waiting for
an answer that cannot come: with a lock around the step and an alarm for
the next, a phone in a cellar would have been held awake 34 s of every
39. While the modem reports no packet service the recovery tries nothing
now and takes no lock, and a dead flow's socket that is still open then
is closed without the FIN's exchange (Abort): over TCP, left open it is
readable at every turn of the loop, which would spin instead of waiting,
and a FIN sent into the gap would hold the address pair against the
reconnect after it, as the FIN of a step that closed its flow after an
unanswered wait does. A Dial that finds the flow dead in a gap ends at
once: the recovery's one immediate try for it tries nothing either, and
the INVITE fails on a flow that is gone. Awake and with no call up, the
modem is asked again every 5 s, the pause that was between two
reconnects. A sleeping phone is woken for the next look after as long
again as the modem has been without service, 10 s at the least and 15
min at the most (RegRecovery::WakeTime), counted from the modem's first
word of no service since the network last answered: the modem's word for
its service starts no count over, and where it alternates at the edge of
coverage an attempt made on it costs its wait under the lock while the
looks keep their pace. Every step that follows no local wait is woken
for at the policy's own time: a reconnect cycle the network was silent
to is no local wait where the modem has service, a fresh attempt it was
silent to never is. The kernel refuses a connect locally for as long as
the old flow's socket holds the address pair, which clears in awake
seconds. That is the other local wait: awake and with no call up, the
next look comes 5 s after each; a sleeping phone is woken for it after
as long again as the kernel's refusals have lasted, 10 s at the least
and 15 min at the most, counted from its first refusal since the modem's
last word of no service or the network's last answer, whichever came
later.

Left as they were, among others: the CRLF keepalive, the reg-event
subscription's Timer F, its retries and its renewal after the network
has ended it, the times SMS over IP measures (its two waits, the
30-minute age-out, its tables) and a step's own waits for the network
count awake seconds. Nothing holds a sleep off under the bring-up
script, which runs before the daemon, nor in the wait before a restart
after a failure: a phone suspended there does not register until it is
awake again. And between the alarm's waking the phone and the step it
woke it for, the loop's next turn, there is neither alarm nor lock; nor
is the alarm set again yet, for up to a second, after it has ended a
sleep under a step's wait (where the freeze has ended the receive of the
fresh registration's first wait with time left, it is set at once), and
a helper program the step goes on to in that second has none until the
step's next wait for the network.

Tested: the suites (WakeAt and the policy's wake after a local wait are
pinned in tests/Engine; the rest is the shell's). On the workstation
(the fp6 journal's 2026-11-25-through-sleep capture,
bench/bench-sleep.sh) the sleep is a preloaded clock_gettime under which
the boot clock runs ahead of the steady clock: with it 50 s ahead a
refresh set for 60 s went out 20 s into the registration, and 1.2.4's
did not; with it 599500 s ahead the subscription was renewed, and
1.2.4's was not; with no jump the refresh came at its awake time and not
before. The second lock was taken and released around a refresh, asked
for again at the stand-in logind's PrepareForSleep(false) where that had
refused it at a refresh's start, and held for the 256 s from a text's
sending to its "failed" where the stand-in network answered no MESSAGE.
In a gap of 40 s (the stand-in modem without packet service, no SYN let
through, the flow closed by the network) no connect was tried and no
lock taken, the daemon's own processor time stayed under a second (an
earlier build of this change, which kept the dead flow's socket through
the gap, used 33.9 s of it), and the reconnect came 3 to 5 s after the
gap's end; a Dial inside such a gap ended at once with nothing reopened
under it, the reconnect then 0.5 to 1.5 s after the gap's end; and in a
gap that let no segment through the daemon had no socket of the old flow
at the gap's end; a daemon started inside a hold of 60 s held no lock
for it. With WAKE_TRACE=1, a test seam, the daemon writes a line
whenever the time the alarm is armed for changes (by the second; one
line for a run of times less than two seconds ahead), with a timer or
without: in a gap that a refresh ran into, with the boot clock put 1000
s ahead inside it, the alarm named 900 s ahead; after the gap's end,
where the old flow's socket had two connects refused, it named no more
than 30 s ahead, and the reconnect came 15 to 16 s after the gap's end;
where the stand-in modem reported service twice inside such a gap, the
alarm named 900 s ahead again after each; where the modem still reported
service when the refresh failed, where the network stayed silent for 80
s after the modem's return, and over UDP, it named no more than 30 s
ahead from the modem's return to the recovery; while a step waited for
the network (a refresh's 12 s, a connect's 12 s and the 10 s before the
next try, a fresh registration's two waits with the stand-in holding its
answers back) it named a new time every second, and through the connect
for a call's resend, which the stand-in answered at once, no time 2 s or
more ahead. Stopped 1.5 s into a fresh registration's wait for its first
401 and continued 2 s later (a stop and a continue end a datagram
receive under a timeout as a freeze does), the daemon registered when
the stand-in's held-back 401 came, five runs of five; an earlier build
of this change and 1.2.4 gave the wait up at the continue, five of five
each. The bench's namespace gives no CAP_WAKE_ALARM: every life of this
daemon there says "no wake alarm (Operation not permitted)" and runs on.
The alarm is the dev phone's (KPN, a 7.3 kernel, this commit's daemon
built with the next commit's version string, the capture's phone/,
2026-11-28), with REFRESH_INTERVAL=120 and deep suspends asked of
logind: every refresh that fell due under a sleep went out within 3 s of
its due time, after a resume whose first interrupt was the RTC's alarm
(1.2.4, in three sleeps of that script as it was on 2026-11-25, on the
same kernel build, sent no refresh in seven minutes); under a call a
suspend told to ignore inhibitors was refused by the kernel (alarmtimer,
-16), twice, systemd-sleep having tried its second state; under a text
in flight logind refused a suspend and the kernel a forced one; and
under a refresh whose REGISTER the phone itself dropped, a forced
suspend a second into the wait was ended by imsd's alarm (the RTC's the
first interrupt, 30.6 s in), after which imsd's timer, zero at the
test's first look, read 29 to 30 s ahead at each of its 32 looks from
0.2 s later to the wait's end, which the test saw about 10 s after that
first look (an earlier build of this change, which set the alarm once
for the wait, read zero at every reading until the wait had ended; in
another run, with two more forced suspends in that wait, it slept to the
test's own alarm of 75 s both times). The re-registration after that
refresh came 71 s after its "no reply", the kernel refusing nine
connects over a minute first (the old flow's socket). Seven recovery
steps that fell due under a sleep ran 1.5 to 3 s after their time (an
earlier build, 2026-11-25). A test program's datagram receive under a
timeout returned EINTR at the phone's resume from a suspend
(evidence/recv-eintr/ there). Not run: a suspend under a fresh
registration's first wait with the daemon on a phone; an alarm clock
with no RTC behind it ("no RTC that can wake the phone"), and a
timerfd_settime that fails ("wake alarm not set"); the alarm's disarming
and "wake trace: none", which nothing reaches once the loop runs; a
second forced suspend under one wait with this commit's daemon on a
phone (the dev phone is not to be suspended within ten seconds of a
resume: the earlier build's run with three did so, and its wifi firmware
crashed; and the wait the test stages, an unanswered refresh's 12 s, is
over at about that time); the 1.9 s through a connect for a call's
resend that waits; a fresh registration's look at the modem finding no
packet service (the reconnect's has run); a bring-up the network defers
or refuses, and a stop during a bring-up's hold; the work's lock asked
for at the bus connection's coming (no record tells that request from
the step's own); a coverage gap on a phone, and the wake for its slower
look; on a phone, a sleep longer than a refresh interval of 1800 s; the
alarm at most 30 s ahead through a step's wait while a text is in
flight, which is read from the code; the subscription's renewal on a
network.
This commit is contained in:
Jorijn van der Graaf 2026-11-29 14:30:43 +01:00
commit 3b9c0fed98
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB
4 changed files with 848 additions and 72 deletions

421
AGENTS.md
View file

@ -50,7 +50,7 @@ PipeWire. The verified device/carrier combinations are in the README.
| `interfaces/Imsd-Aka.cppm` | `imsd::aka` — the card's side of a registration: the AKAv1-MD5 digest (RFC 3310), IMPI/IMPU/realm from IMSI + MCC/MNC, parsers for `qmicli --uim-get-card-status` and `mmcli` output, the AUTHENTICATE APDU and its response; since 1.2.3 the ISIM: the application of the slot in use out of the card status (`ParseIsimApp`, in whatever state the modem lists it), the SELECT and the two READ commands its identity files are read with, a card's answer (`ApduAnswer`: `90 00`, `91 XX` and `92 XX` are its normal endings; `HoldsRead` takes a read's data under `62 82` as well) and the command it asks for next (`ApduFollowUp`, for an answer without data: GET RESPONSE for `61 XX`, a command without data again for `6C XX`), the value a file holds (`ParseIsimValue`: the data object with tag `80`, the `FF` bytes at the end of its length cut, no blank and no byte outside printable ASCII) and `IsimIdentity`, the check of the three values — an `@` between two parts, a domain of labels of letters, digits and inner hyphens, 63 characters a label and 253 in all at most, a `sip:` at the start and more after it, the two identities 255 characters at most, no blank, no byte outside printable ASCII and no `"`, `\`, `<` or `>` — before they replace the derived names. |
| `interfaces/Imsd-Ipsec.cppm` | `imsd::ipsec` — the two ESP SA pairs (TS 33.203) as `ip xfrm` argv lists, the ESP ciphers offered (`ParseEalgOffer`, `DefaultEalgOffer`), the Security-Server mechanism selection, and the reader that reconstructs SPIs/ports from `ip xfrm state`/`policy` text for a warm resume, and (1.0.0) `SaPeer`, the P-CSCF the kernel's pair is to, read from the `dir out` policies that carry imsd's fingerprint, `OwnXfrmDeleteCommands`, the deletes by exact key of what two rules select — the policies carrying imsd's fingerprint and the reqid-1/2 transport-mode ESP states in their direction or on the UE's ims-PDN address, whoever installed them (§12), and `FileNamesAnotherPair`, whether a state file's `spi_uc`/`spi_us` name the kernel's pair (unknown on either side decides nothing). |
| `interfaces/Imsd-Messages.cppm` | `imsd::msg` — every SIP request and response imsd sends, built from an explicit `Context` and per-request variables so the builders are pure functions; `tests/Messages` is their suite. Also `IsEmergency`. Since 1.2.0 the SIP MESSAGE of SMS over IP (`BuildMessageSms`: an RP-DATA to the service centre's PSI, or an RP-ACK/RP-ERROR to the IP-SM-GW with In-Reply-To — TS 24.341 5.3.1.2 and 5.3.2.4), the `+g.3gpp.smsip` Contact tag behind `Context::smsOverIp`, `BuildResponse`, the final for an inbound MESSAGE outside a call's dialog (the 200, the 480, the 488): each Via row echoed in order and the To echoed with a tag added unless it already holds `tag=` (RFC 3261 8.2.6.2); since 1.2.1 `BuildBadRequest`, the 400 to a request cut short of the Content-Length read from it — any but an ACK or a CANCEL, in a call's dialog or not —, in that shape, a To tag it adds made from the request's header section and a secret of the run (RFC 3261 8.2.7); of requests that came whole, in-dialog requests, a MESSAGE among them, and the shell's answers to any other request outside a call — a NOTIFY, an OPTIONS, a method it does not handle; not an INVITE, whose 486 while a call exists is `BuildInviteResponse`'s — keep `BuildResponse200`'s hop-by-hop shape; and `ScPsi`, the service centre's PSI from its international number — never a dialled-number guess. |
| `interfaces/Imsd-Engine.cppm` | `imsd::engine` — the decisions as pure reducers: `CallMachine` (one call's dialog, returning `Action`s for the shell), `RegRecovery` (the registration recovery policy, §7.4) and, since 1.2.0, SMS over IP (§7.9): `SmsOutbound` (one short message of ours on its way to the service centre, segment by segment, since 1.2.1 a segment that gets no answer, or an RP-ERROR with cause 41, sent once more with TP-RD set — TS 23.040 9.2.3.6 —, returning `SmsAction`s) and `OnSmsMessage` (what an inbound MESSAGE outside a call's dialog leads to: its final, the message or status report it delivered, the delivery report to send), and `RecentTransactions` (an inbound request's retransmission — the same Call-ID, CSeq and Via branch within 32 s (`TimerJ`), the branch being the value of the first `branch=` of its first Via row and a request with none or an empty one never matched — answered with the same final and not handled again) and, since 1.2.1, `RecentSubmissions` (the Call-IDs of the MESSAGEs our submissions went out in, an hour each, by which a submit report for one that is no longer in flight is known for ours — TS 24.341 5.3.1.2); `SameRecipient` and `StatusReportBook`, a status report's match to the message that asked for one — TP-MR and recipient — and its word for the whole message, with `SmsWordOrder`, the order of a message's words: the submission's first, a report's held until then (§7.9); `RunToken`, `SentSmsId` and `ReceivedSmsId`, the ids (§8.4); `StoredSms` with `FormatStoredSms`/`ParseStoredSms`, the record codec of the received-message store, and `StoredSmsBefore`, `List`'s order. |
| `interfaces/Imsd-Engine.cppm` | `imsd::engine` — the decisions as pure reducers: `CallMachine` (one call's dialog, returning `Action`s for the shell), `RegRecovery` (the registration recovery policy, §7.4) and, since 1.2.0, SMS over IP (§7.9): `SmsOutbound` (one short message of ours on its way to the service centre, segment by segment, since 1.2.1 a segment that gets no answer, or an RP-ERROR with cause 41, sent once more with TP-RD set — TS 23.040 9.2.3.6 —, returning `SmsAction`s) and `OnSmsMessage` (what an inbound MESSAGE outside a call's dialog leads to: its final, the message or status report it delivered, the delivery report to send), and `RecentTransactions` (an inbound request's retransmission — the same Call-ID, CSeq and Via branch within 32 s (`TimerJ`), the branch being the value of the first `branch=` of its first Via row and a request with none or an empty one never matched — answered with the same final and not handled again) and, since 1.2.1, `RecentSubmissions` (the Call-IDs of the MESSAGEs our submissions went out in, an hour each, by which a submit report for one that is no longer in flight is known for ours — TS 24.341 5.3.1.2); `SameRecipient` and `StatusReportBook`, a status report's match to the message that asked for one — TP-MR and recipient — and its word for the whole message, with `SmsWordOrder`, the order of a message's words: the submission's first, a report's held until then (§7.9); `RunToken`, `SentSmsId` and `ReceivedSmsId`, the ids (§8.4); `StoredSms` with `FormatStoredSms`/`ParseStoredSms`, the record codec of the received-message store, and `StoredSmsBefore`, `List`'s order. Since 1.2.5 also `WakeAt`: when the phone has to be awake for imsd (§7.10). |
| `interfaces/Imsd-Qmi.cppm` | `imsd::qmi` — the QMI WDS request bytes `imsd-pcscf` sends (Bind Mux Data Port, Set IP Family, Get Packet Service Status, Get Current Settings, Get Profile Settings), the message/TLV parser, the P-CSCF list readers (0x22 flag, 0x23 IPv4, 0x24 FQDN, 0x2E IPv6 — the last one libqmi does not model). |
| `interfaces/ImsdBus.cppm` | `imsd::bus` — the polkit gate in front of call control and messaging (`Gated`'s `Action` parameter names the action), shared by imsd and imsd-ofonod. GLib, so outside `imsd-core`. |
| `implementations/main.cpp` | The `imsd` daemon shell: GLib main loop, GDBus service, sockets, subprocesses, the registration sequence and the run loop that pumps the core. |
@ -121,8 +121,14 @@ the second refusal, the count travelling in the holds (`Reconnectable()` and
`Fresh()`, decided once after both catch arms) — and taken out of the kernel,
§7.2 step 1), the `OnLink` read that writes the old registration off
when its address has left the netdev (`FreshRecover` after a failed move,
`AddressGone`), and `PacketServiceUp`'s read of
ModemManager before a silent cycle is counted; the no-target reads and
`AddressGone`), `PacketServiceUp`'s read of
ModemManager before a silent cycle is counted and, since 1.2.5, before
every reconnect cycle and every fresh registration of the recovery
(`NoService`; a bring-up's registrations and the connect for a call's
resend do not ask), and the shell's word that the network has answered,
which starts a coverage gap's counts over (`OnNetworkAnswered`: an
answered TCP connect of the resume or of a reconnect, a response to a
REGISTER); the no-target reads and
reactions (1.0.0): the kernel text behind `SaPeer`, the holds' `old_gone`
and the script's `PCSCF_DISCOVERY=` — whether a pair is resumable (`SaPeer`
finds one and the holds' `old_gone` does not write it off: `!peer ||
@ -169,7 +175,12 @@ old registration may be reconnected over) ran against a stand-in network on
the workstation and on the dev phone (§5). The sleep inhibitor for a call
(1.2.5, §7.6) is all in the shell (`HoldSleepOff` and its callers);
what of it ran against a stand-in logind on the workstation and what on
the dev phone is in §5. SMS over IP
the dev phone is in §5. The registration through a
sleep (1.2.5, §7.10) is the shell's but for when the phone has to be
awake (`WakeAt`) and the policy's wake after a local wait
(`RegRecovery::WakeTime`), which are `Imsd:Engine`'s, with tests; §7.10
has what the shell does for it, and §5 what of that ran against
stand-ins on the workstation and what on the dev phone. SMS over IP
(1.2.0, §7.9) keeps in the
shell, among others, the service centre's source (`SMSC=` over EF_SMSP, `LoadSmsParameters`),
the three counters (TP-MR, RP-MR, the concatenation reference), their
@ -442,7 +453,24 @@ What the suites pin:
`RegRecovery` (thresholds, backoffs, the throttle
schedule, Retry-After, which waits a Dial may cut short, when the old
registration counts as gone, the holds a restart takes over, a binding the
network terminated); and SMS over IP (TS 24.341): `SmsOutbound` through a
network terminated; the look after a local wait: 5 s after the
refusal is reported, and the time a sleeping phone is to be woken for
it, 10 s to 15 min by value, counted for no packet service from the
modem's first such word since the network's last answer and for the
kernel's refusals (the kind of a refusal that names none) from the
first since the modem was last without service or the network last
answered, where what starts a count over is the shell's word of an
answer, a refused reconnect, a refused or throttled fresh attempt or
a terminated binding, and not a silent cycle or attempt (a success
starts everything over); a step that
follows no local wait, and a
registration written off meanwhile, at the policy's own time) and
`WakeAt` (when the phone has to be awake for imsd: now while a call
or a text is in flight; with a registration on a live flow the
refresh's due time or the subscription's renewal, whichever comes
first; with a dead flow under a registration the recovery's word,
a due step as now; never where nothing waits);
and SMS over IP (TS 24.341): `SmsOutbound` through a
submission — the MESSAGE with the RP-DATA to the SC's PSI, its 202, the
RP-ACK ending it as sent with the SC's time stamp; a refused final; an
RP-ERROR with its cause and TP-FCS; the final's wait and the report's
@ -530,12 +558,17 @@ Rules:
named here. The known gaps: the reg-event subscription schedule (the
arming and KPN's
`noresource` closure have run on hardware, the 60 s retry only on a
pre-fix build that renewed that closure; the retry on this code, the
renewal firing, Timer F, the doubling, a SUBSCRIBE `Retry-After`, the
pre-fix build that renewed that closure, and the renewal firing on
the workstation, with the boot clock set ahead, 1.2.5's record below;
the retry on this code, Timer F, the doubling, a SUBSCRIBE
`Retry-After`, the
renew arm and the back-off's survival across a refresh have run nowhere —
§3, §7.4); a `Dial` bringing a recovery step
forward (imsd-ofonod refuses the `Dial` itself and imsd-dialerd forwards
it) is pinned in `tests/Engine` only;
it) has run on the workstation in a coverage gap, where the step it
brought forward was the look at the modem (1.2.5's record below); one
that brings a reconnect, or a fresh attempt that is due, forward is
pinned in `tests/Engine` only;
the escalation by one refused refresh that carries a `Retry-After` — the
escalation to a fresh registration is pinned in `tests/Engine` only; a
resume echoing a multi-mechanism Security-Server list on the wire (the
@ -622,11 +655,17 @@ Rules:
error, a bind() refused while the address is still on the link — which
no bench reaches without fault injection (§3); a coverage gap on the air
(no bench stages a radio gap without an RF shield) — the packet-service
read's rule has run through a fake `mmcli` only (2026-10-03: `searching`
and `detached` not counted, `connecting` with `unknown` counted), its
other states, ModemManager not answering and its second site (a refresh
unanswered over a reconnected flow) not at all, and `tests/Engine` pin
nothing of it; the REGISTER wait's diverting arms — a response to
read's rule has run through a fake `mmcli` (2026-10-03: `searching`
and `detached` not counted, `connecting` with `unknown` counted; the
bench of 1.2.5's record below: `searching` with `detached`,
`registered` with `attached`) and against the dev phone's own
ModemManager (2026-10-03: `connected` with `attached`, two silent
cycles counted); the read that follows a refresh unanswered over a
reconnected flow has found no packet service on no run (`refresh
unanswered while the modem reports no packet service`); and
`tests/Engine`
pin what the policy does with the modem's word, nothing
of the read; the REGISTER wait's diverting arms — a response to
another transaction ignored, a provisional
restarting the wait, a request (an INVITE among them) dispatched and
answered under the wait; an incoming call answered from a session's
@ -1146,10 +1185,112 @@ Rules:
removal (a Dial refused under a call that has no lock); a second
refusal before a lock is given, which prints no line; an answer of
logind's without a descriptor; a `PrepareForSleep` whose argument is
not one boolean; the lock wanted where it is held, which asks nothing
(a suspend told to ignore inhibitors under it; a Dial refused under
a call that has it); a desktop's own
request for a suspend under the lock.
not one boolean; a Dial refused under a call that has its lock, which
asks nothing, and what logind signals after a suspend told to ignore
inhibitors under a call (the next entry has such a suspend; its run's
log has the lock listed before and after it, and no line of logind's
for the signal); a desktop's own request for a suspend under the lock.
- The registration through a sleep (§7.10) is shell code but for
`WakeAt` and the recovery policy's wake after a local wait, which
`tests/Engine` pins. On the workstation
(`bench/bench-sleep.sh` of the capture above) the bench's sleep is a
preloaded `clock_gettime` under which the boot clock runs ahead of the
steady clock by the seconds a file names: with the boot clock 50 s
ahead a refresh set for 60 s went out 20 s into the registration, and
1.2.4's did not; with it 599500 s ahead the reg-event subscription was
renewed, and 1.2.4's was not; with no jump the refresh came at its
awake time and not before. The second lock was taken and released
around a refresh, asked for again at the stand-in logind's
`PrepareForSleep(false)` where that had refused it at a refresh's
start, and held from a text's sending to its `failed` where the
stand-in network answered no MESSAGE (256 s). In a gap of 40 s
(the stand-in modem without packet service, no SYN let through, the
flow closed by the network) no connect was tried and no lock taken,
the modem was asked every 5 s, the daemon's own processor time
stayed under a second (an earlier build, which kept the dead flow's
socket through the gap, used 33.9 s of it), and the reconnect came
3 to 5 s after the gap's end; a `Dial` inside such a gap ended at
once, with nothing reopened under it, and the reconnect then came
0.5 to 1.5 s after the gap's end. In a gap of 70 s that let no
segment through, the daemon had no socket of the old flow at the
gap's end, and the reconnect came 3 to 5 s after it, 0.5 to 1.5 s
where a `Dial` had been tried inside the gap. A
daemon started inside a hold of 60 s held no lock for
it. With `WAKE_TRACE=1`, a test seam, the daemon writes a line
whenever the time the alarm is armed for changes (by the second; one
line for a run of times less than two seconds ahead), with a timer
or without: in a gap
that a refresh ran into, with the boot clock put 1000 s ahead inside
it, the alarm named 900 s ahead; after the gap's end, where the old
flow's socket had two connects refused, it named no more than 30 s
ahead, and the reconnect came 15 to 16 s after the gap's end; and
where the stand-in modem reported service twice inside such a gap,
the alarm named 900 s ahead again after each. Where the modem still
reported service when the refresh failed, where the network stayed
silent for 80 s after the modem's return (two silent cycles, then a
fresh registration) and over UDP, the alarm named no more than 30 s
ahead from the modem's return to the recovery. While a step waited
for the network (a refresh's 12 s without a reply, a connect's 12 s
without an answer and the 10 s before the next try, a fresh
registration's two waits with the stand-in network holding its
answers back) the alarm was named a new time every second, and
through the connect for a call's resend it was named no time 2 s or
more ahead. Stopped 1.5 s into a fresh registration's wait for its
first 401 and continued 2 s later (a stop and a continue end a
datagram receive under a timeout as a suspend's freeze does, §13),
the daemon
registered when the stand-in's held-back 401 came, five runs of five;
an earlier build and 1.2.4 gave the wait up at the continue, five of
five each. The bench's
namespace gives no `CAP_WAKE_ALARM`: every life of this daemon there
says `no wake
alarm (Operation not permitted)` and runs on. The alarm is the dev
phone's (KPN, a 7.3 kernel, this commit's code under the next
commit's version string, `phone/` there, 2026-11-28), with
`REFRESH_INTERVAL=120` and deep suspends asked of logind: every
refresh that fell due under a sleep went out within 3 s of its due
time, after a resume whose first interrupt was the RTC's alarm
(1.2.4, in three sleeps of that script as it was on 2026-11-25, on
the same kernel build, sent no refresh in seven minutes); seven
recovery steps that fell due under a sleep ran 1.5 to 3 s after
their time (an earlier build, 2026-11-25); under a call a suspend
told to ignore inhibitors was refused by the kernel (`alarmtimer`,
-16), twice, systemd-sleep having tried its second state; and under
a refresh whose REGISTER the phone itself dropped, such a suspend a
second into the wait was ended by imsd's alarm (the RTC's the first
interrupt, 30.6 s in), after which imsd's timer, zero at the test's
first look, read 29 to 30 s ahead at each of its 32 looks from 0.2 s
later to the wait's end, which the test saw about 10 s after that
first look (an earlier build, which set the alarm once
for the wait, read zero at every reading until the wait had ended;
in another run, with two more such suspends in that wait, it slept
to the test's own alarm of 75 s both times). The re-registration
after that refresh came 71 s after its `no reply`, the kernel
refusing nine connects over a minute first (the old flow's socket,
§7.10). Not run: a
suspend under a fresh registration's first wait with the daemon on a
phone (the receive's `EINTR` at a resume was seen there with a test
program, §13); an alarm clock with no RTC behind it (`no RTC that
can wake the phone`), and a `timerfd_settime` that fails (`wake
alarm not set`); the alarm's disarming and `wake trace: none`,
which nothing reaches once the loop runs; a second suspend told to
ignore
inhibitors under one wait with this daemon on a phone (the dev
phone is not to be suspended within ten seconds of a resume: the
earlier build's run with three did so, and its wifi firmware
crashed; and the wait the test stages, an unanswered refresh's
12 s, is over at about that time); the 1.9 s through a connect for
a call's resend that waits (the bench's is answered at once); a
fresh registration's look at the modem finding no packet service
(the reconnect's has run); a bring-up the network defers or refuses,
and a stop during a bring-up's hold; the work's lock asked for at
the bus connection's coming (no record tells that request from the
step's own); a coverage gap on a
phone, and the wake for its slower look; on a phone, a sleep longer
than a refresh interval of 1800 s; the alarm at most 30 s ahead
through a step's wait while a text is in flight, which is read from
the code;
the reg-event subscription's renewal on a network.
- `imsd-pcscf` ran on the dev phone (KPN) on 2026-10-11 against the live ims
bearer: the `--mux 1 --profile 2 -v` sequence, a plain run, and `OutOfCall`
on an unbound mux (the fp6 journal's `2026-10-11-pcscf-pco-probe` capture,
@ -1230,8 +1371,8 @@ the status snapshot live (main thread only). The Messaging interface's
`List` and `Delete` read and unlink the received-message store there while
the engine thread writes it — safe through the `.tmp` + `link(2)` publish
(§7.9). On the same bus imsd is a client of logind's
(`org.freedesktop.login1`): the main thread takes its sleep inhibitor
there and listens for its `PrepareForSleep` (§7.6).
(`org.freedesktop.login1`): the main thread takes its sleep inhibitors
there and listens for its `PrepareForSleep` (§7.6, §7.10).
Per answered call imsd forks `imsd-media` (`IMSD_MEDIA`, default next to the
`imsd` binary, else `/usr/libexec/imsd-media`) with the addresses, ports and
@ -1400,8 +1541,12 @@ The daemon's own bring-up (`BringUp()` in `main.cpp`):
with `ip xfrm`, the protected REGISTER over the negotiated transport
(§10.1, `SIP_TRANSPORT`), `REGISTERED (fresh)`. Then the reg-event
SUBSCRIBE (§7.4).
5. A keepalive re-REGISTER refresh at half the granted lifetime, within
120–1800 s (`REFRESH_INTERVAL`), only while idle. Besides it an idle
5. A keepalive re-REGISTER refresh at half the granted lifetime (of
3600 s where none was granted), within
120–1800 s (`REFRESH_INTERVAL`), only while idle; the time runs
through a suspend, and a sleeping phone is woken for it where imsd
has its wake alarm (§7.10).
Besides it an idle
phone whose registration stands sends what its reg-event subscription
needs (§7.4). The CRLF keepalive (RFC 5626 4.4.1) imsd sent every 30 s
until 1.2.3 is off unless `CRLF_KEEPALIVE` names an interval in whole
@ -1654,7 +1799,9 @@ configuration file's path — the bench's seam too).
### 7.4 Registration recovery (`RegRecovery`, `Imsd-Engine.cppm`)
What the daemon does when the registration stops working after bring-up, as
a pure reducer the shell feeds with the clock and the network's answers. Two
a pure reducer the shell feeds with the clock, the network's answers and its
local waits (a connect the kernel refused, the modem without packet
service). Two
kinds of failure reach it: a **refusal** (the network answered a refresh with
a final other than 200 — a 401, re-authentication, included — or a fresh
registration's REGISTER with a final other than the expected one: from 300
@ -1673,6 +1820,7 @@ The policy, with its constants:
|---|---|
| Reconnect | Through the existing SA, then refresh. Back-off 5 s → 5 min (`ReconnectDelayMin`/`Max`). |
| Escalate to a fresh registration | After one refused refresh whose `Retry-After` is at least a second (the network's considered answer; a `Retry-After` of 0 or one that does not parse counts as none; O2 2026-10-08: the refresh refused 503 with Retry-After 414 s, the refresh after that wait 503 with Retry-After 772 s) or a 401 (re-authentication, which imsd answers with a fresh registration rather than over temporary SAs), after two refused refreshes without one (`RefusalsBeforeFresh`), or two reconnect cycles that end without an answer (`SilentCyclesBeforeFresh`) while the modem reports packet service (`PacketServiceUp`: ModemManager's registration and packet-service state, as `ims-pdn-up.sh` reads them). A cycle that fails during a coverage gap is the phone's silence, not the network's: not counted, retried on the local-refusal pace, so a radio gap across a refresh does not escalate into a fresh registration, which KPN refuses while the registration is live and drops it for (§13). New Call-ID, new challenge, new SA pair (`registering fresh (recovery attempt N)`; with no fresh target the daemon restarts instead, §7.2 step 3). |
| No packet service | While the modem reports none (`PacketServiceUp`) the recovery tries no reconnect and no fresh attempt and holds no sleep off (§7.10; a bring-up does not ask the modem): the modem is asked again 5 s after each look while the phone is awake and no call is up (`LocalRetry`, the pause after a connect the kernel refuses locally as well), and where imsd has its wake alarm a sleeping phone is woken for the next look after as long again as that kind of wait has lasted, within 10 s and 15 min (`LocalWakeMin`/`Max`): where the modem has no service, since its first such word since the network last answered (an answered TCP connect of the resume or of a reconnect, a response to a REGISTER, a terminated binding, a success); where the kernel refuses the connect, since its first refusal since the modem was last without service or the network last answered, whichever came later. A report of service from the modem starts neither count over. A step that follows no local wait (the rows above and below) is woken for at its own time. A `Dial` on the dead flow meanwhile ends at once: nothing is reopened under it (§7.10). |
| A refused or throttled fresh attempt | Waits on the **throttle schedule**: 21 min, growing ×1.5 to 60 (`ThrottleMinutesMin`/`Max`). KPN refuses a fresh SA pair on an address whose registration is live (§13), and drops that registration the moment an initial REGISTER arrives. |
| A silent fresh attempt | Backs off 30 s → 10 min (`FreshDelayMin`/`Max`). |
| `Retry-After` | Always wins over a shorter wait, honoured up to an hour (`RetryAfterMax`, the schedule's longest wait); a longer one is cut to an hour and the refusal heard again then. On a refused fresh attempt it replaces the schedule's wait, shorter or longer, never below 30 s (`FreshDelayMin`). |
@ -1719,11 +1867,16 @@ even after the holds run out, so a restart does not start it over at 21 min.
When nothing is held the file is removed — when it is a regular file;
`/dev/null` switches the knob off and anything that is not a regular file is
emptied, never unlinked. The recovery policy's waits and the holds are
measured on the boot clock (`CLOCK_BOOTTIME`), so a suspend counts; the
keepalive refresh gate, the CRLF keepalive (where `CRLF_KEEPALIVE` sets one), the reg-event retry and
renewal timers and the times SMS over IP measures (§7.9: its two waits,
the 30-minute age-out, the retransmission table's 32 s, the submissions
table's hour) run on the steady clock and count awake seconds only.
measured on the boot clock (`CLOCK_BOOTTIME`), so a suspend counts, and
so are the keepalive refresh's gate and the reg-event subscription's
renewal ahead of its granted lifetime's end (§7.10; awake seconds in
the releases up to 1.2.4); the CRLF keepalive (where `CRLF_KEEPALIVE`
sets one), the reg-event subscription's Timer F, its retries (after a
refusal, an unanswered SUBSCRIBE, a send that failed) and its renewal
after the S-CSCF has ended it, and the times SMS over IP measures
(§7.9: its two waits, the 30-minute age-out, the retransmission table's
32 s, the submissions table's hour) run on the steady clock and count
awake seconds only.
The **reg-event subscription** (RFC 3680; the network's own view of the
binding) is one live dialog per registration, subscribed anew ahead of the
@ -1889,7 +2042,9 @@ sent, emit this D-Bus state change, arm this deadline). States and reasons are t
sends `PrepareForSleep` with false, and one
wanted before the bus connection was there when the connection
comes. Where logind gives none at all (`--session`: the session bus
has no logind) calls go on without one.
has no logind) calls go on without one. For a suspend that is told to
ignore inhibitors there is the wake alarm: what it holds under a call
and what it does not is in §7.10.
- Emergency: a number `IsEmergency` classifies (112, 911, plus
`EMERGENCY_NUMBERS`; SIM `EF_ECC` is not read yet) is tried as
`urn:service:sos` first, with one fallback to a plain INVITE of the digits;
@ -2094,6 +2249,19 @@ Lines the operator (and the scripts) look for, all prefixed `imsd: `:
(§7.6): where no lock was held, no such line; `no sleep inhibitor from
logind (…): asked again when it says a sleep is over` where logind gave
none, once until a call's lock is next given.
- `wake alarm: a sleeping phone is woken when the registration's refresh
is due` when the alarm is first armed, `no wake alarm (…): a sleeping
phone is not woken for the registration's refresh` where the kernel
gives no such timer (its error) or has no RTC behind it (`no RTC that
can wake the phone`), `wake alarm not set: …` where setting it fails
(§7.10).
- `the modem reports no packet service: the reconnect waits until it has
it again` (or `the fresh registration waits …`) where a recovery step
finds the modem without packet service: once, and again after a look
that found it with service (§7.10). A cycle that was tried and went
unanswered, the modem then reporting none, has the line it had: `…
while the modem reports no packet service: not counted; next: …`
(§7.4). `wake trace: …` only with `WAKE_TRACE=1`, a test seam (§5).
- `media <codec> pt=N octet=true|false -> [X]:P, telephone-event pt N|none` at a
call's media start (`… pt N (theirs M)` when `DTMF_RX_PT` differs from
the one we send with); `call X: DTMF '…' -> media leg (telephone-event pt
@ -2586,6 +2754,140 @@ do that answers without state.
— its flatpak on the `flatpak.catcrafts.net` remote accompanies this
release.
### 7.10 A phone that sleeps
Nothing of imsd runs while the phone is suspended. What it has to do at
a certain time the phone has to be awake for, and what it waits for
must not be cut off by a suspend. This is what sees to that.
- **The refresh, and the subscription's renewal ahead of its expiry, run
on the boot clock.**
The network counts
a registration's lifetime while the phone sleeps. The refresh (§7.2
step 5) is due on `CLOCK_BOOTTIME`, as the recovery policy's waits are
(§7.4), and so is the renewal of the reg-event subscription ahead of
its granted lifetime's end. In the releases up to 1.2.4 both counted
awake seconds, and a registration lapsed on a phone that slept most
of its two hours (§13).
- **A wake alarm.** A timer on `CLOCK_BOOTTIME_ALARM` (the kernel's alarm
timer, which sets the RTC's alarm for a suspend; it takes
`CAP_WAKE_ALARM`, which the service has) is armed at the end of every
turn of the loop that takes no command off the queue (a turn that
takes one handles it and goes straight to the next turn) for the time
`WakeAt` names (`Imsd:Engine`): now while a call or a text is in
flight (the hold of the next entry); else, with a
registration on a live flow the refresh's due time, or the reg-event
subscription's renewal where that comes first; with a dead flow under
a registration the recovery policy's word (`RegRecovery::WakeTime`: its
next step, and the slower look after a local wait, below); and none
where nothing waits to be done. A bring-up's wait for the policy arms
the policy's time itself. The timer is never read: the waking is the
whole of it, and the loop's own clock checks act once the phone is
awake. Where the kernel gives no such timer, or has no RTC behind it,
the journal says so once, and nothing wakes the phone for imsd. A
resume by itself sends nothing: a refresh that is not due does not go
out.
- **Work in flight has a lock and the alarm.** Beside the call's lock
(§7.6) the main thread asks for a second block inhibitor of
logind's, in the way it asks for the call's
(its reason `a registration step or a text in flight`), while a step
of the
registration exchanges with the network (the refresh, a reconnect, a
fresh registration, the bring-up: `Engine::Step`) and while a text is
being sent, whose two waits count awake seconds (§7.9); not while a
bring-up waits out a hold the network set, which can be an hour
(§7.4). For a suspend that begins all the same (logind refused such
a lock where a suspend's operation was already running, §13; a request
can tell it to ignore inhibitors) there is the alarm. Under a call
and under a text in
flight, and where a step is due that the next turn runs (but for the
look after a local wait, below, which has its own slower time), it
is set 1.9 s ahead at every such turn, and the kernel refuses a
suspend under an alarm less than two seconds ahead (§13); that holds
where there is
an alarm and while the loop turns or a call's resend waits for its
connect, not through a turn that takes longer otherwise (a media leg
being stopped, a helper program) and not through a registration
step; and the suspend has to come to the kernel's check before the
alarm set last has fired, after its sync and its freeze of the
processes (§13). A step keeps the
alarm at most 30 s ahead while it waits for
the network, whatever else is in flight: where imsd has its wake
alarm, a sleep that begins under such a wait ends there, and the
step goes on (this section's last paragraph has what is left). The
alarm fires once
(§13), and a wait can outlast the sleep it ended, so it is set anew
before every second of a wait for the network (a connect's answer,
the pause before the next try, a REGISTER's answer): where the wait
goes on after a wake, it stands again within a second. One of those
waits, for the fresh registration's first answer, is a receive with a
timeout, which a suspend's freeze ends with `EINTR` (§13): it is
taken up again for the rest of its time. A wait for a helper program
keeps the alarm that stood when it began.
- **A coverage gap costs little sleep.** While the modem reports no
packet service the recovery tries no reconnect and no fresh
registration, and no lock is taken for one: either would wait for
answers that cannot come. A dead flow's socket that is still open at
that look is closed there without the FIN's exchange (`Abort`): over
TCP,
left open it is readable at every turn of the loop, which would
spin instead of waiting, and closed with a FIN it would hold the
address pair against the reconnect after the gap, as the socket of
a flow does that a step closed after a wait without an answer (the
kernel's refusals, below). (The refresh that
runs into the gap waits its 12 s under the lock, once. A bring-up
does not ask the modem: one that meets a gap makes its attempts
under the lock. A `Dial` that finds the flow dead in the gap ends
at once: the recovery's immediate try for it tries nothing either,
and the INVITE fails on a flow that is gone.) Awake and with no call
up, the modem is
asked again every 5 s; a sleeping phone is woken for the next look
after as long again as the modem has been without service, 10 s at
the least and 15 min at the most (§7.4's table). That time is
counted from the modem's first word of no service since the network
last answered (§7.4's table has what counts as its answer): the
modem's word for its
service starts no count over, and where it alternates at the edge
of coverage an attempt made on it costs its wait under the lock
(a TCP reconnect's 34 s where nothing answers) while the looks keep
their pace. Every
step that follows no local wait is woken for at the policy's own
time (§7.4's table): a reconnect cycle the network was silent to is
no local wait where the modem has service, a fresh attempt it was
silent to never is.
The kernel refuses a connect locally for as long as the
old flow's socket holds the address pair, which clears in awake
seconds (TIME_WAIT's 60, an unanswered FIN's retransmissions): two
tries 10 s apart under the lock at each look. That is the other
local wait: awake and with no call up, the next look comes 5 s after
each; a sleeping phone is woken for it after as long again as the
kernel's refusals have lasted, 10 s at the least and 15 min at the
most, counted from its first refusal since the
modem's last word of no service or the network's last answer,
whichever came later. The slower look does not know
the registration's lifetime: a gap that ends shortly before the
lifetime does can cost the registration.
What of the registration's schedule and of the texts' times still
counts awake seconds is in §7.4's paragraph on the clocks; a step's own
waits for the network (a connect's answer, the pause before the next
try, a REGISTER's answer) count them too, under the step's lock.
Nothing holds a sleep off under the bring-up script, which runs before
the daemon (§7.3), nor in the wait before a restart after a failure: a
phone suspended there does not register until it is awake again. And
from the
moment the alarm has woken the phone to the step it woke it for, the
loop's next turn (up to a second where a bring-up waited out a hold),
there is neither alarm nor lock: a desktop that asked for a suspend
again within that time would have the phone sleep through the step
until something else woke it. For up to a second after the alarm has
ended a sleep under a step's wait it is not set again yet either
(where the freeze has ended the receive of the fresh registration's
first wait with time left, §13, it is set at once), and a helper
program the step goes on to from a wait in that second has none until
the step's next wait for the network: a suspend told to ignore
inhibitors that began there would not be ended by imsd.
## 8. D-Bus ABI and desktop integration
### 8.1 `net.catcrafts.IMS1` (frozen)
@ -2854,7 +3156,8 @@ line, having a fresh target decides what a refused or failed resume
leads to — the fresh registration (a refusal without a Retry-After is not
counted) or, with none, the pair kept for the restart, removed, or the idle
(§7.2 step 1) — and a comma-separated `PCSCF=` stops the bring-up before the
resume.
resume. `WAKE_TRACE=1` is a test seam of the wake alarm's (§5, §7.8), no
configuration, and in none of the README's tables.
### 10.2 imsd-media (per call, set through imsd's environment)
@ -3144,11 +3447,12 @@ the related code.
packet on the ims netdev: the modem ended none of six sleeps in one
and one of seven in the other, for a file-system request that no
packet had preceded (2026-11-24). What an idle phone with a standing
registration still sends is the refresh, once in 1800 awake seconds on
KPN (three packets out, the dormancy report 11 to 13 s and the request
102 to 104 s after them), and what its reg-event subscription needs
(§7.4): on KPN a renewal once in 599400 awake seconds (the grant of
600000 s less 600). Awake and idle
registration still sends is the refresh, once in 1800 s on KPN, awake or,
where imsd has its wake alarm, asleep (§7.10; three packets out, the
dormancy report 11 to 13 s and
the request 102 to 104 s after them), and what its reg-event
subscription needs (§7.4): on KPN a renewal once in 599400 s (the grant
of 600000 s less 600). Awake and idle
on a 100-mA USB port the dev phone's battery lost 140 mA under 1.2.3's
ping and 59 mA without it (its own counter over one window of 40 min
and one of 33; 2026-11-24).
@ -3158,6 +3462,55 @@ the related code.
between). Where a network's P-CSCF closes or forgets a flow it hears
nothing on, `CRLF_KEEPALIVE` is that network's setting (§7.2 step 5
has what imsd does without it).
- **A registration counted in awake seconds lapsed on a phone that
slept most of its two hours** (the dev phone, KPN, imsd 1.1.0,
2026-11-19; the fp6
journal's power lane, `2026-11-19-wake-tests`): registered at 09:15:48
with a lifetime of 7200 s, the phone in a loop of suspends from 09:26
to 11:22, no refresh
went out; the network's NOTIFY that the binding had expired woke the
phone at 11:16:37, the fresh registration met the throttle above, and
the phone registered again at 11:37:38.
- **The kernel refuses a suspend under an alarm timer less than two
seconds ahead** (`alarmtimer_suspend`, `kernel/time/alarmtimer.c`,
read at v7.3: -EBUSY, and a wakeup event of two seconds, where an
RTC stands behind the alarm timer; without one it lets the suspend
pass). The check is in the suspend's device phase, after the kernel
has synced and frozen the processes: an alarm that has fired by then
is off the queue and refuses nothing. On the dev
phone (2026-11-25 and 2026-11-28), `systemctl suspend -i` under a call
or a text in flight: logind let it through, the kernel refused it,
systemd-sleep tried the next state of its list and was refused again,
and the phone did not suspend; each refused attempt has its line in
the kernel's log, `alarmtimer alarmtimer.0.auto: PM: failed to
suspend: error -16` (six of six in the boot of 2026-11-28 13:22).
- **A timer on an alarm clock made with `timerfd_create` and set with no
interval fires once**
(read at v7.3: `alarmtimer_fired`, `kernel/time/alarmtimer.c`, takes
the alarm off the kernel's queue and restarts nothing;
`timerfd_alarmproc`, `fs/timerfd.c`, marks the timer expired, counts
a tick and wakes whoever waits on the descriptor; an interval would
be applied only when the timer is next accessed, by a read or by
`timerfd_gettime`). imsd sets no interval and neither reads nor
queries its timer: after it has fired there is no alarm of imsd's
until the next `timerfd_settime`, which is why a wait sets it every
second (§7.10).
- **A suspend's freeze ends a datagram receive that has a timeout with
`EINTR`**
(read at v7.3: `freeze_task`, `kernel/freezer.c`, wakes a user thread
that it cannot freeze where it sleeps as a pending signal would; a
datagram receive sleeps interruptibly and not freezably and leaves
with `sock_intr_errno`, `net/core/datagram.c` and
`include/net/sock.h`, which under a finite `SO_RCVTIMEO` is `-EINTR`,
and that the kernel does not take up again as it does an interrupted
`poll`). On the dev phone (2026-11-28) a test program's `recvfrom`
under a timeout returned `EINTR` at the resume from a suspend, in
pieces of a second and in one long wait alike (the fp6 journal's
`2026-11-25-through-sleep` capture, `evidence/recv-eintr/`). A stop
and a continue (`SIGSTOP`, `SIGCONT`) end such a receive the same
way, which is how the bench stages it (§5). The daemon's wait for a
fresh registration's first answer is such a receive
(`AwaitInitialFinal`).
- **logind refused a block inhibitor for sleep where it was asked for
during a suspend's operation**
(systemd 262.2, the dev phone, 2026-11-25 and 2026-11-28): `Inhibit`