NetBSD Problem Report #1504

From gnats  Mon Sep 25 11:49:13 1995
Received: from yarrina.connect.com.au (yarrina.connect.com.au [192.189.54.17]) by sun-lamp.pc.cs.cmu.edu (8.6.11/8.6.10) with ESMTP id LAA00845 for <gnats-bugs@gnats.netbsd.org>; Mon, 25 Sep 1995 11:49:11 -0400
Message-Id: <199509242223.IAA00305@topaz.nemeton.com.au>
Date: Mon, 25 Sep 1995 08:23:48 +1000
From: Giles Lean <giles@nemeton.com.au>
Reply-To: giles@nemeton.com.au
To: gnats-bugs@gnats.netbsd.org
Subject: init doesn't notice lines deleted from /etc/ttys
X-Send-Pr-Version: 3.2

>Number:         1504
>Category:       bin
>Synopsis:       init doesn't notice lines deleted from /etc/ttys
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 25 11:50:03 +0000 1995
>Closed-Date:    Tue Oct 10 02:13:04 +0000 1995
>Last-Modified:  Tue Oct 10 02:13:26 +0000 1995
>Originator:     Giles Lean
>Release:        September 22 1995
>Organization:
Giles Lean                                             Nemeton Pty Ltd
<giles@nemeton.com.au>                           phone: +61 3 480 2118        
>Environment:

System: NetBSD topaz.nemeton.com.au 1.0A NetBSD 1.0A (TOPAZ) #10: Sun Sep 24 16:55:33 EST 1995 giles@topaz.nemeton.com.au:/usr/src/sys/arch/i386/compile/TOPAZ i386


>Description:
	If line(s) are deleted from /etc/ttys, init merrily continues
	to create processes for those lines.  This is surprising, at
	least.
>How-To-Repeat:
	Turn on a getty in /etc/ttys and signal init. Verify a getty
	is running.  Delete the line from /etc/ttys and signal init.
	Check that the getty is still running, then kill it and see
	that init spawns a new getty.
>Fix:
	The following patch arranges for init to delete such sessions.

*** src/sbin/init/init.c.orig	Sun Sep 24 17:24:05 1995
--- src/sbin/init/init.c	Sun Sep 24 17:23:58 1995
***************
*** 136,141 ****
--- 136,142 ----
  	time_t	se_started;		/* used to avoid thrashing */
  	int	se_flags;		/* status of session */
  #define	SE_SHUTDOWN	0x1		/* session won't be restarted */
+ #define	SE_CURRENT	0x2		/* session is in /etc/ttys */
  	char	*se_device;		/* filename of port */
  	char	*se_getty;		/* what to run on that port */
  	char	**se_getty_argv;	/* pre-parsed argument array */
***************
*** 1228,1233 ****
--- 1229,1235 ----
  				break;

  		if (sp) {
+ 			sp->se_flags |= SE_CURRENT;
  			if (sp->se_index != session_index) {
  				warning("port %s changed utmp index from %d to %d",
  				       sp->se_device, sp->se_index,
***************
*** 1254,1259 ****
--- 1256,1269 ----
  	}

  	endttyent();
+ 
+ 	for (sp = sessions; sp; sp = sp->se_next)
+ 		if (sp->se_flags & SE_CURRENT) {
+ 			sp->se_flags &= ~SE_CURRENT;
+ 		} else {
+ 			sp->se_flags |= SE_SHUTDOWN;
+ 			kill(sp->se_process, SIGHUP);
+ 		}

  	return (state_func_t) multi_user;
  }
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: mycroft 
State-Changed-When: Mon Oct 9 22:13:04 EDT 1995 
State-Changed-Why:  
Fixed. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.