From owner-svn-src-all@FreeBSD.ORG Sat Feb 8 13:51:16 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 617237C6; Sat, 8 Feb 2014 13:51:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 401A91D3E; Sat, 8 Feb 2014 13:51:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s18DpGXF006641; Sat, 8 Feb 2014 13:51:16 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s18DpGSS006640; Sat, 8 Feb 2014 13:51:16 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201402081351.s18DpGSS006640@svn.freebsd.org> From: Jilles Tjoelker Date: Sat, 8 Feb 2014 13:51:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r261635 - head/sbin/init X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Feb 2014 13:51:16 -0000 Author: jilles Date: Sat Feb 8 13:51:15 2014 New Revision: 261635 URL: http://svnweb.freebsd.org/changeset/base/261635 Log: init: Remove code to track line numbers in /etc/ttys. The tracking generated warnings when the line number of an existing tty in /etc/ttys changed, which would corrupt utmp (as it was indexed by the line number). With utmpx, the line number no longer matters, so the tracking is no longer needed. Modified: head/sbin/init/init.c Modified: head/sbin/init/init.c ============================================================================== --- head/sbin/init/init.c Sat Feb 8 13:37:02 2014 (r261634) +++ head/sbin/init/init.c Sat Feb 8 13:51:15 2014 (r261635) @@ -143,7 +143,6 @@ static const char *get_shell(void); static void write_stderr(const char *message); typedef struct init_session { - int se_index; /* index of entry in ttys file */ pid_t se_process; /* controlling process */ time_t se_started; /* used to avoid thrashing */ int se_flags; /* status of session */ @@ -163,7 +162,7 @@ typedef struct init_session { } session_t; static void free_session(session_t *); -static session_t *new_session(session_t *, int, struct ttyent *); +static session_t *new_session(session_t *, struct ttyent *); static session_t *sessions; static char **construct_argv(char *); @@ -1005,7 +1004,7 @@ free_session(session_t *sp) * Mark it SE_PRESENT. */ static session_t * -new_session(session_t *sprev, int session_index, struct ttyent *typ) +new_session(session_t *sprev, struct ttyent *typ) { session_t *sp; int fd; @@ -1017,7 +1016,6 @@ new_session(session_t *sprev, int sessio sp = (session_t *) calloc(1, sizeof (session_t)); - sp->se_index = session_index; sp->se_flags |= SE_PRESENT; sp->se_device = malloc(sizeof(_PATH_DEV) + strlen(typ->ty_name)); @@ -1107,7 +1105,6 @@ setupargv(session_t *sp, struct ttyent * static state_func_t read_ttys(void) { - int session_index = 0; session_t *sp, *snext; struct ttyent *typ; @@ -1128,7 +1125,7 @@ read_ttys(void) * Note that sp starts at 0. */ while ((typ = getttyent()) != NULL) - if ((snext = new_session(sp, ++session_index, typ)) != NULL) + if ((snext = new_session(sp, typ)) != NULL) sp = snext; endttyent(); @@ -1380,7 +1377,6 @@ clean_ttys(void) { session_t *sp, *sprev; struct ttyent *typ; - int session_index = 0; int devlen; char *old_getty, *old_window, *old_type; @@ -1394,8 +1390,6 @@ clean_ttys(void) devlen = sizeof(_PATH_DEV) - 1; while ((typ = getttyent()) != NULL) { - ++session_index; - for (sprev = 0, sp = sessions; sp; sprev = sp, sp = sp->se_next) if (strcmp(typ->ty_name, sp->se_device + devlen) == 0) break; @@ -1403,12 +1397,6 @@ clean_ttys(void) if (sp) { /* we want this one to live */ sp->se_flags |= SE_PRESENT; - if (sp->se_index != session_index) { - warning("port %s changed utmp index from %d to %d", - sp->se_device, sp->se_index, - session_index); - sp->se_index = session_index; - } if ((typ->ty_status & TTY_ON) == 0 || typ->ty_getty == 0) { sp->se_flags |= SE_SHUTDOWN; @@ -1448,7 +1436,7 @@ clean_ttys(void) continue; } - new_session(sprev, session_index, typ); + new_session(sprev, typ); } endttyent();