[PATCH] set DEAD_PROCESS for died proccess with pid in utmp table

Petr Lautrbach plautrba at redhat.com
Wed Jan 5 15:36:58 UTC 2011


On 06/15/2010 04:39 PM, Petr Lautrbach wrote:
> Hello,
>
> Attached patch tries to fix #183729.
>
> If we assume that *getty takes care about setting INIT_PROCESS/LOGIN_PROCESS itself, we need
> just set DEAD_PROCESS for dead processes with pid in utmp table and log it into wtmp.
>
> Init goes through the utmp table, tries to find entry with dead process pid and sets it
> to DEAD_PROCESS. There is no need to create/set up "utmp" stanza.
>
> Test covers utmp table with 2 entries and with 2 situation - process is in LOGIN_PROCESS or USER_PROCESS.
>

Hello.

Sorry for very late response.

There should not be setutxent() on job_process.c:1180. If there are more than one record in utmp table then
it causes that only first entry will be overwritten every time. Attached patch [1] adds test which covers this situation and
[2] removes this call.

But this is not still ideal. It seems that mingetty doesn't use DEAD_PROCESS entry if it's not last entry in table.
So if there are some sequence of login/logout on various consoles utmp will grow. It's fixed by patch [3].
When utmp entry for dead process is found then job->utmp_id is set. When new process is spawned and job->utmp_id is set
then INIT_PROCESS utmp entry for its id is created. This works well for respawning processes.

[1] 0001-test-multiple-entries-with-same-ut_id.patch
[2] 0002-remove-setutxent-when-setting-DEAD_PROCESS.patch
[3] 0003-set-INIT_PROCESS-entry.patch

Petr
-- 
Petr Lautrbach, Red Hat, Inc.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0001-test-multiple-entries-with-same-ut_id.patch
URL: <https://lists.ubuntu.com/archives/upstart-devel/attachments/20110105/ab27f4e9/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0002-remove-setutxent-when-setting-DEAD_PROCESS.patch
URL: <https://lists.ubuntu.com/archives/upstart-devel/attachments/20110105/ab27f4e9/attachment-0001.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0003-set-INIT_PROCESS-entry.patch
URL: <https://lists.ubuntu.com/archives/upstart-devel/attachments/20110105/ab27f4e9/attachment-0002.ksh>


More information about the upstart-devel mailing list