sbin/init/init.c
/*
 * Walk the list of ttys and create sessions for each active line.
 */
Walk the list of ttys and create sessions for each active line.
Walk the list of ttys and create sessions for each active line .
state_func_t
read_ttys()
{
	int session_index = 0;
	register session_t *sp, *snext;
	register struct ttyent *typ;
	for (sp = sessions; sp; sp = snext) {
		if (sp->se_process)
			clear_session_logs(sp);
		snext = sp->se_next;
		free_session(sp);
	}
	sessions = 0;
	if (start_session_db())
		return (state_func_t) single_user;
	while (typ = getttyent())
		if (snext = new_session(sp, ++session_index, typ))
			sp = snext;
	endttyent();
	return (state_func_t) multi_user;
}
state_func_t read_ttys ( ) { int session_index = 0 ; register session_t * sp , * snext ; register struct ttyent * typ ; for ( sp = sessions ; sp ; sp = snext ) { if ( sp -> se_process ) clear_session_logs ( sp ) ; snext = sp -> se_next ; free_session ( sp ) ; } sessions = 0 ; if ( start_session_db ( ) ) return ( state_func_t ) single_user ; while ( typ = getttyent ( ) ) if ( snext = new_session ( sp , ++ session_index , typ ) ) sp = snext ; endttyent ( ) ; return ( state_func_t ) multi_user ; }
Walk the list of ttys and create sessions for each active line.
Walk the list of ttys and create sessions for each active line .
/*
	 * Destroy any previous session state.
	 * There shouldn't be any, but just in case...
	 */ /*
	 * Allocate a session entry for each active port.
	 * Note that sp starts at 0.
	 */