mirror of
https://github.com/GnoConsortium/gno.git
synced 2024-12-27 00:29:55 +00:00
prototyped
This commit is contained in:
parent
51ae0e883d
commit
b5b9abc713
@ -34,6 +34,7 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef __GNO__
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
static char copyright[] =
|
||||||
"@(#) Copyright (c) 1991, 1993\n\
|
"@(#) Copyright (c) 1991, 1993\n\
|
||||||
@ -43,6 +44,7 @@ static char copyright[] =
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 7/15/93";
|
static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 7/15/93";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
@ -169,9 +171,7 @@ DB *session_db;
|
|||||||
* The mother of all processes.
|
* The mother of all processes.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
@ -266,6 +266,12 @@ main(argc, argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __ORCAC__
|
||||||
|
/* we need this for variadic functions */
|
||||||
|
#pragma optimize 72
|
||||||
|
#pragma debug 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Associate a function with a signal handler.
|
* Associate a function with a signal handler.
|
||||||
*/
|
*/
|
||||||
@ -410,6 +416,10 @@ emergency(va_alist)
|
|||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __ORCAC__
|
||||||
|
/* end of variadic functions */
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Catch a SIGSYS signal.
|
* Catch a SIGSYS signal.
|
||||||
*
|
*
|
||||||
@ -417,8 +427,7 @@ emergency(va_alist)
|
|||||||
* We tolerate up to 25 of these, then throw in the towel.
|
* We tolerate up to 25 of these, then throw in the towel.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
badsys(sig)
|
badsys(int sig)
|
||||||
int sig;
|
|
||||||
{
|
{
|
||||||
static int badcount = 0;
|
static int badcount = 0;
|
||||||
|
|
||||||
@ -431,8 +440,7 @@ badsys(sig)
|
|||||||
* Catch an unexpected signal.
|
* Catch an unexpected signal.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
disaster(sig)
|
disaster(int sig)
|
||||||
int sig;
|
|
||||||
{
|
{
|
||||||
emergency("fatal signal: %s",
|
emergency("fatal signal: %s",
|
||||||
sig < (unsigned) NSIG ? sys_siglist[sig] : "unknown signal");
|
sig < (unsigned) NSIG ? sys_siglist[sig] : "unknown signal");
|
||||||
@ -500,8 +508,7 @@ setsecuritylevel(newlevel)
|
|||||||
* The initial state is passed as an argument.
|
* The initial state is passed as an argument.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
transition(s)
|
transition(state_t s)
|
||||||
state_t s;
|
|
||||||
{
|
{
|
||||||
for (;;)
|
for (;;)
|
||||||
s = (state_t) (*s)();
|
s = (state_t) (*s)();
|
||||||
@ -512,8 +519,7 @@ transition(s)
|
|||||||
* NB: should send a message to the session logger to avoid blocking.
|
* NB: should send a message to the session logger to avoid blocking.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
clear_session_logs(sp)
|
clear_session_logs(session_t *sp)
|
||||||
session_t *sp;
|
|
||||||
{
|
{
|
||||||
char *line = sp->se_device + sizeof(_PATH_DEV) - 1;
|
char *line = sp->se_device + sizeof(_PATH_DEV) - 1;
|
||||||
|
|
||||||
@ -526,8 +532,7 @@ clear_session_logs(sp)
|
|||||||
* Only called by children of init after forking.
|
* Only called by children of init after forking.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
setctty(name)
|
setctty(char *name)
|
||||||
char *name;
|
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
@ -546,7 +551,7 @@ setctty(name)
|
|||||||
* Bring the system up single user.
|
* Bring the system up single user.
|
||||||
*/
|
*/
|
||||||
state_func_t
|
state_func_t
|
||||||
single_user()
|
single_user(void)
|
||||||
{
|
{
|
||||||
pid_t pid, wpid;
|
pid_t pid, wpid;
|
||||||
int status;
|
int status;
|
||||||
@ -699,7 +704,7 @@ single_user()
|
|||||||
* Run the system startup script.
|
* Run the system startup script.
|
||||||
*/
|
*/
|
||||||
state_func_t
|
state_func_t
|
||||||
runcom()
|
runcom(void)
|
||||||
{
|
{
|
||||||
pid_t pid, wpid;
|
pid_t pid, wpid;
|
||||||
int status;
|
int status;
|
||||||
@ -788,7 +793,7 @@ runcom()
|
|||||||
* NB: We could pass in the size here; is it necessary?
|
* NB: We could pass in the size here; is it necessary?
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
start_session_db()
|
start_session_db(void)
|
||||||
{
|
{
|
||||||
if (session_db && (*session_db->close)(session_db))
|
if (session_db && (*session_db->close)(session_db))
|
||||||
emergency("session database close: %s", strerror(errno));
|
emergency("session database close: %s", strerror(errno));
|
||||||
@ -804,8 +809,7 @@ start_session_db()
|
|||||||
* Add a new login session.
|
* Add a new login session.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
add_session(sp)
|
add_session(session_t *sp)
|
||||||
session_t *sp;
|
|
||||||
{
|
{
|
||||||
DBT key;
|
DBT key;
|
||||||
DBT data;
|
DBT data;
|
||||||
@ -823,8 +827,7 @@ add_session(sp)
|
|||||||
* Delete an old login session.
|
* Delete an old login session.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
del_session(sp)
|
del_session(session_t *sp)
|
||||||
session_t *sp;
|
|
||||||
{
|
{
|
||||||
DBT key;
|
DBT key;
|
||||||
|
|
||||||
@ -862,8 +865,7 @@ find_session(pid)
|
|||||||
* Construct an argument vector from a command line.
|
* Construct an argument vector from a command line.
|
||||||
*/
|
*/
|
||||||
char **
|
char **
|
||||||
construct_argv(command)
|
construct_argv(char *command)
|
||||||
char *command;
|
|
||||||
{
|
{
|
||||||
char *strk (char *);
|
char *strk (char *);
|
||||||
register int argc = 0;
|
register int argc = 0;
|
||||||
@ -881,8 +883,7 @@ construct_argv(command)
|
|||||||
* Deallocate a session descriptor.
|
* Deallocate a session descriptor.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
free_session(sp)
|
free_session(register session_t *sp)
|
||||||
register session_t *sp;
|
|
||||||
{
|
{
|
||||||
free(sp->se_device);
|
free(sp->se_device);
|
||||||
if (sp->se_getty) {
|
if (sp->se_getty) {
|
||||||
@ -904,10 +905,7 @@ free_session(sp)
|
|||||||
* Allocate a new session descriptor.
|
* Allocate a new session descriptor.
|
||||||
*/
|
*/
|
||||||
session_t *
|
session_t *
|
||||||
new_session(sprev, session_index, typ)
|
new_session(session_t *sprev, int session_index, register struct ttyent *typ)
|
||||||
session_t *sprev;
|
|
||||||
int session_index;
|
|
||||||
register struct ttyent *typ;
|
|
||||||
{
|
{
|
||||||
register session_t *sp;
|
register session_t *sp;
|
||||||
|
|
||||||
@ -945,9 +943,7 @@ new_session(sprev, session_index, typ)
|
|||||||
* Calculate getty and if useful window argv vectors.
|
* Calculate getty and if useful window argv vectors.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
setupargv(sp, typ)
|
setupargv(session_t *sp, struct ttyent *typ)
|
||||||
session_t *sp;
|
|
||||||
struct ttyent *typ;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (sp->se_getty) {
|
if (sp->se_getty) {
|
||||||
@ -996,7 +992,7 @@ setupargv(sp, typ)
|
|||||||
* 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
|
state_func_t
|
||||||
read_ttys()
|
read_ttys(void)
|
||||||
{
|
{
|
||||||
int session_index = 0;
|
int session_index = 0;
|
||||||
register session_t *sp, *snext;
|
register session_t *sp, *snext;
|
||||||
@ -1033,8 +1029,7 @@ read_ttys()
|
|||||||
* Start a window system running.
|
* Start a window system running.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
start_window_system(sp)
|
start_window_system(session_t *sp)
|
||||||
session_t *sp;
|
|
||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
sigset_t mask;
|
sigset_t mask;
|
||||||
@ -1075,8 +1070,7 @@ start_window_system(sp)
|
|||||||
* Start a login session running.
|
* Start a login session running.
|
||||||
*/
|
*/
|
||||||
pid_t
|
pid_t
|
||||||
start_getty(sp)
|
start_getty(session_t *sp)
|
||||||
session_t *sp;
|
|
||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
sigset_t mask;
|
sigset_t mask;
|
||||||
@ -1183,8 +1177,7 @@ collect_child(pid)
|
|||||||
* Catch a signal and request a state transition.
|
* Catch a signal and request a state transition.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
transition_handler(sig)
|
transition_handler(int sig)
|
||||||
int sig;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (sig) {
|
switch (sig) {
|
||||||
@ -1209,7 +1202,7 @@ transition_handler(sig)
|
|||||||
* Take the system multiuser.
|
* Take the system multiuser.
|
||||||
*/
|
*/
|
||||||
state_func_t
|
state_func_t
|
||||||
multi_user()
|
multi_user(void)
|
||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
register session_t *sp;
|
register session_t *sp;
|
||||||
@ -1249,7 +1242,7 @@ multi_user()
|
|||||||
* This is an n-squared algorithm. We hope it isn't run often...
|
* This is an n-squared algorithm. We hope it isn't run often...
|
||||||
*/
|
*/
|
||||||
state_func_t
|
state_func_t
|
||||||
clean_ttys()
|
clean_ttys(void)
|
||||||
{
|
{
|
||||||
register session_t *sp, *sprev;
|
register session_t *sp, *sprev;
|
||||||
register struct ttyent *typ;
|
register struct ttyent *typ;
|
||||||
@ -1326,7 +1319,7 @@ clean_ttys()
|
|||||||
* Block further logins.
|
* Block further logins.
|
||||||
*/
|
*/
|
||||||
state_func_t
|
state_func_t
|
||||||
catatonia()
|
catatonia(void)
|
||||||
{
|
{
|
||||||
register session_t *sp;
|
register session_t *sp;
|
||||||
|
|
||||||
@ -1340,8 +1333,7 @@ catatonia()
|
|||||||
* Note SIGALRM.
|
* Note SIGALRM.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
alrm_handler(sig)
|
alrm_handler(int sig)
|
||||||
int sig;
|
|
||||||
{
|
{
|
||||||
clang = 1;
|
clang = 1;
|
||||||
}
|
}
|
||||||
@ -1350,7 +1342,7 @@ alrm_handler(sig)
|
|||||||
* Bring the system down to single user.
|
* Bring the system down to single user.
|
||||||
*/
|
*/
|
||||||
state_func_t
|
state_func_t
|
||||||
death()
|
death(void)
|
||||||
{
|
{
|
||||||
register session_t *sp;
|
register session_t *sp;
|
||||||
register int i;
|
register int i;
|
||||||
@ -1382,6 +1374,7 @@ death()
|
|||||||
|
|
||||||
return (state_func_t) single_user;
|
return (state_func_t) single_user;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
strk (char *p)
|
strk (char *p)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user