summary |
tags |
clone url |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
bbe9362)
SCCS-vsn: old/init/init.c 5.2
SCCS-vsn: sbin/init/init.c 5.2
/*
* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
/*
* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
-static char sccsid[] = "@(#)init.c 5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)init.c 5.2 (Berkeley) %G%";
#endif not lint
#include <signal.h>
#endif not lint
#include <signal.h>
char wcmd[CMDSIZ]; /* command to start window system process */
time_t gettytime;
int gettycnt;
char wcmd[CMDSIZ]; /* command to start window system process */
time_t gettytime;
int gettycnt;
+ time_t windtime;
+ int windcnt;
if (pid == 0) {
signal(SIGTERM, SIG_DFL);
signal(SIGHUP, SIG_IGN);
if (pid == 0) {
signal(SIGTERM, SIG_DFL);
signal(SIGHUP, SIG_IGN);
+ sigsetmask(0); /* since can be called from masked code */
if (dowait) {
syslog(LOG_ERR, "'%s %s' failing, sleeping", p->comn, p->line);
closelog();
if (dowait) {
syslog(LOG_ERR, "'%s %s' failing, sleeping", p->comn, p->line);
closelog();
* of error detection code in dfork.
*/
p->gettytime = 0;
* of error detection code in dfork.
*/
p->gettytime = 0;
wstart(p)
register struct tab *p;
{
wstart(p)
register struct tab *p;
{
+ register pid;
+ time_t t;
+ int dowait = 0;
+ time(&t);
+ p->windcnt++;
+ if ((t - p->windtime) >= 60) {
+ p->windtime = t;
+ p->windcnt = 1;
+ } else if (p->windcnt >= 5) {
+ dowait = 1;
+ p->windtime = t;
+ p->windcnt = 1;
+ }
+
+ pid = fork();
+
+ if (pid == 0) {
signal(SIGTERM, SIG_DFL);
signal(SIGTERM, SIG_DFL);
- signal(SIGHUP, SIG_DFL);
- signal(SIGALRM, SIG_DFL);
- signal(SIGTSTP, SIG_IGN);
-*/
+ signal(SIGHUP, SIG_IGN);
+ sigsetmask(0); /* since can be called from masked code */
+ if (dowait) {
+ syslog(LOG_ERR, "'%s %s' failing, sleeping", p->wcmd, p->line);
+ closelog();
+ sleep(30);
+ }
execit(p->wcmd, p->line);
exit(0);
}
execit(p->wcmd, p->line);
exit(0);
}
-#define NARGS 20 /* must be at lease 4 */
+#define NARGS 20 /* must be at least 4 */
#define ARGLEN 512 /* total size for all the argument strings */
execit(s, arg)
#define ARGLEN 512 /* total size for all the argument strings */
execit(s, arg)
/*
* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
/*
* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
-static char sccsid[] = "@(#)init.c 5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)init.c 5.2 (Berkeley) %G%";
#endif not lint
#include <signal.h>
#endif not lint
#include <signal.h>
char wcmd[CMDSIZ]; /* command to start window system process */
time_t gettytime;
int gettycnt;
char wcmd[CMDSIZ]; /* command to start window system process */
time_t gettytime;
int gettycnt;
+ time_t windtime;
+ int windcnt;
if (pid == 0) {
signal(SIGTERM, SIG_DFL);
signal(SIGHUP, SIG_IGN);
if (pid == 0) {
signal(SIGTERM, SIG_DFL);
signal(SIGHUP, SIG_IGN);
+ sigsetmask(0); /* since can be called from masked code */
if (dowait) {
syslog(LOG_ERR, "'%s %s' failing, sleeping", p->comn, p->line);
closelog();
if (dowait) {
syslog(LOG_ERR, "'%s %s' failing, sleeping", p->comn, p->line);
closelog();
* of error detection code in dfork.
*/
p->gettytime = 0;
* of error detection code in dfork.
*/
p->gettytime = 0;
wstart(p)
register struct tab *p;
{
wstart(p)
register struct tab *p;
{
+ register pid;
+ time_t t;
+ int dowait = 0;
+ time(&t);
+ p->windcnt++;
+ if ((t - p->windtime) >= 60) {
+ p->windtime = t;
+ p->windcnt = 1;
+ } else if (p->windcnt >= 5) {
+ dowait = 1;
+ p->windtime = t;
+ p->windcnt = 1;
+ }
+
+ pid = fork();
+
+ if (pid == 0) {
signal(SIGTERM, SIG_DFL);
signal(SIGTERM, SIG_DFL);
- signal(SIGHUP, SIG_DFL);
- signal(SIGALRM, SIG_DFL);
- signal(SIGTSTP, SIG_IGN);
-*/
+ signal(SIGHUP, SIG_IGN);
+ sigsetmask(0); /* since can be called from masked code */
+ if (dowait) {
+ syslog(LOG_ERR, "'%s %s' failing, sleeping", p->wcmd, p->line);
+ closelog();
+ sleep(30);
+ }
execit(p->wcmd, p->line);
exit(0);
}
execit(p->wcmd, p->line);
exit(0);
}
-#define NARGS 20 /* must be at lease 4 */
+#define NARGS 20 /* must be at least 4 */
#define ARGLEN 512 /* total size for all the argument strings */
execit(s, arg)
#define ARGLEN 512 /* total size for all the argument strings */
execit(s, arg)