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

Scott James Remnant scott at netsplit.com
Thu Jan 6 07:38:41 UTC 2011


Could you explain the 3rd patch a bit more for me, how do you see the
utmp entries working throughout the lifecycle - what would both
Upstart and mingetty do?

On Wed, Jan 5, 2011 at 3:36 PM, Petr Lautrbach <plautrba at redhat.com> wrote:
> 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.
>
> --
> upstart-devel mailing list
> upstart-devel at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/upstart-devel
>
>



More information about the upstart-devel mailing list