<feed xmlns='http://www.w3.org/2005/Atom'>
<title>procd/utils, branch master</title>
<subtitle>OpenWrt service / process manager</subtitle>
<id>https://git.openwrt.org/project/procd/atom?h=master</id>
<link rel='self' href='https://git.openwrt.org/project/procd/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/procd/'/>
<updated>2026-10-25T08:43:34Z</updated>
<entry>
<title>utils: terminate get_active_console() buffer at the read length</title>
<updated>2026-10-25T08:43:34Z</updated>
<author>
<name>Felix Fietkau</name>
</author>
<published>2026-07-04T19:57:16Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/procd/commit/?id=b2f201ec98049050afafe36ad45dafa2c9124029'/>
<id>urn:sha1:b2f201ec98049050afafe36ad45dafa2c9124029</id>
<content type='text'>
The buffer is only terminated at its very end, leaving the bytes
between the data read from /sys/class/tty/console/active and the end
of the buffer uninitialised. If the content does not contain a
newline, strtok() scans into uninitialised stack memory and the
returned console name may contain garbage.

Terminate the string right after the data actually read.

Fixes: 2cfc26f8456a ("inittab: detect active console from kernel if no console= specified")
Signed-off-by: Felix Fietkau &lt;nbd@nbd.name&gt;
</content>
</entry>
<entry>
<title>instance: share the cgroup helpers</title>
<updated>2026-10-18T13:36:08Z</updated>
<author>
<name>Daniel Golle</name>
</author>
<published>2026-10-18T13:36:08Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/procd/commit/?id=10d34ac23961771c8bf8fa612991a0008dd373d3'/>
<id>urn:sha1:10d34ac23961771c8bf8fa612991a0008dd373d3</id>
<content type='text'>
Placing the calling process into a cgroup, killing every process in a
cgroup and reading whether it is still populated live in instance.c
and work on the services tree only, yet the processes procd starts
from inittab need the same operations. Move them to utils/cgroup.c as
cgroup_join(), cgroup_kill() and cgroup_populated(), taking the path
of the cgroup, together with the drain timeout, and let the instance
code build its paths and call them. No functional change.

Signed-off-by: Daniel Golle &lt;daniel@makrotopia.org&gt;
</content>
</entry>
<entry>
<title>utils: add an inotify watch helper</title>
<updated>2026-09-27T16:10:27Z</updated>
<author>
<name>Daniel Golle</name>
</author>
<published>2026-09-24T22:47:15Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/procd/commit/?id=8aff28898f233f0b9ab3ac1ad7aab9964ee54c64'/>
<id>urn:sha1:8aff28898f233f0b9ab3ac1ad7aab9964ee54c64</id>
<content type='text'>
hotplug-dispatch.c hand-rolls the only inotify user in procd: an
inotify fd on a uloop_fd, a read buffer sized for one maximal event,
and a loop walking the events of a single read. Any second watch in
procd would have to repeat all of it.

Move that plumbing into utils.c behind inotify_watch_open(), which
attaches an inotify fd to the loop with a per-event callback, and
inotify_watch_add(), which puts one path on that fd and returns the
watch descriptor. All watches share one read buffer; reads happen
inside the uloop callback, so two of them can never use it at the same
time. The /etc/hotplug.d watch keeps its mask and its IN_ISDIR
filtering.

Signed-off-by: Daniel Golle &lt;daniel@makrotopia.org&gt;
</content>
</entry>
<entry>
<title>inittab: Disable implicit controlling TTY.</title>
<updated>2024-12-11T11:09:18Z</updated>
<author>
<name>Markus Gothe</name>
</author>
<published>2024-10-07T11:30:46Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/procd/commit/?id=30542c94c4255acfaffa8e20b88783b01fa00c4a'/>
<id>urn:sha1:30542c94c4255acfaffa8e20b88783b01fa00c4a</id>
<content type='text'>
Disable the use of implicit controlling
TTYs. They will be enabled on demand.

This fixes a bug where 2 or more
consecutive Ctrl-C at the login prompt
triggers a reboot of the device.

Closes: https://github.com/openwrt/openwrt/issues/11306

Signed-off-by: Markus Gothe &lt;markus.gothe@genexis.eu&gt;
</content>
</entry>
<entry>
<title>utils: use strlcpy when appropriate</title>
<updated>2024-07-07T17:00:35Z</updated>
<author>
<name>Daniel Golle</name>
</author>
<published>2024-07-07T16:54:49Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/procd/commit/?id=f230c11771875adc1f74bef013e8cea1fa1867bc'/>
<id>urn:sha1:f230c11771875adc1f74bef013e8cea1fa1867bc</id>
<content type='text'>
For util functions called with a buffer and length parameter we should
use strlcpy() instead of strncpy(), as those functions are called with
sizeof(buffer) as parameter.

Signed-off-by: Daniel Golle &lt;daniel@makrotopia.org&gt;
</content>
</entry>
<entry>
<title>utils: get_cmdline_val: add missing error check</title>
<updated>2024-07-01T17:13:59Z</updated>
<author>
<name>Daniel Golle</name>
</author>
<published>2024-03-30T13:07:29Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/procd/commit/?id=1e411a58f52ea49e5cb4ef4a067ecdab8befd55c'/>
<id>urn:sha1:1e411a58f52ea49e5cb4ef4a067ecdab8befd55c</id>
<content type='text'>
Add check to prevent read() in case open() has failed.

Coverity CID: 1595922: Error handling issues  (NEGATIVE_RETURNS)
Fixes: 6f52ef3 ("get_cmdline_val: search for entire name, not just suffix")
Signed-off-by: Daniel Golle &lt;daniel@makrotopia.org&gt;
</content>
</entry>
<entry>
<title>utils: add key-value offset support to get_cmdline_val()</title>
<updated>2024-03-25T09:28:50Z</updated>
<author>
<name>INAGAKI Hiroshi</name>
</author>
<published>2024-03-12T04:05:46Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/procd/commit/?id=49ea930a862c8eeb4996170b34a930f5848895e9'/>
<id>urn:sha1:49ea930a862c8eeb4996170b34a930f5848895e9</id>
<content type='text'>
Add offset support of key-value pairs to get_cmdline_val() for getting
multiple values of the same keys.

Signed-off-by: INAGAKI Hiroshi &lt;musashino.open@gmail.com&gt;
</content>
</entry>
<entry>
<title>utils: don't ignore open() return value</title>
<updated>2021-08-30T23:46:49Z</updated>
<author>
<name>Daniel Golle</name>
</author>
<published>2021-08-30T23:35:53Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/procd/commit/?id=86f82f3de1da07ef86a33a8e9302c98dafbfa6ec'/>
<id>urn:sha1:86f82f3de1da07ef86a33a8e9302c98dafbfa6ec</id>
<content type='text'>
In case active console cannot be opened, return NULL early instead
of trying to read from errornous file descriptor.

Coverity CID: 1490087 Argument cannot be negative
Signed-off-by: Daniel Golle &lt;daniel@makrotopia.org&gt;
</content>
</entry>
<entry>
<title>utils: make sure read() string is 0 terminated</title>
<updated>2021-08-24T17:31:46Z</updated>
<author>
<name>Daniel Golle</name>
</author>
<published>2021-08-23T17:01:28Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/procd/commit/?id=6010bd3e126717ef8e16a83d5b489aea42de889d'/>
<id>urn:sha1:6010bd3e126717ef8e16a83d5b489aea42de889d</id>
<content type='text'>
Coverity CID: 1490062 String not null terminated

Signed-off-by: Daniel Golle &lt;daniel@makrotopia.org&gt;
</content>
</entry>
<entry>
<title>inittab: detect active console from kernel if no console= specified</title>
<updated>2021-03-07T23:46:27Z</updated>
<author>
<name>Mathew McBride</name>
</author>
<published>2021-03-05T00:54:15Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/procd/commit/?id=2cfc26f8456a4d5ba3836c914a742f3d00bad781'/>
<id>urn:sha1:2cfc26f8456a4d5ba3836c914a742f3d00bad781</id>
<content type='text'>
The default serial console can be set in the device tree
using the linux,stdout-path parameter (or equivalent from ACPI).

This is important for universal booting (EFI/EBBR) on ARM platforms
where the default console can be different (e.g ttyS0 vs ttyAMA0).

Signed-off-by: Mathew McBride &lt;matt@traverse.com.au&gt;
</content>
</entry>
</feed>
