create core package

This commit is contained in:
aydemir
2015-02-24 11:18:35 +02:00
parent 0e4b743b82
commit 70b25d0f95
1098 changed files with 169545 additions and 0 deletions
@@ -0,0 +1,34 @@
--- sysvinit-2.86/man/last.1.manpatch 2006-08-10 15:40:01.000000000 -0400
+++ sysvinit-2.86/man/last.1 2006-08-10 15:42:17.000000000 -0400
@@ -60,6 +60,8 @@
useful, e.g., to determine easily who was logged in at a particular
time -- specify that time with \fB\-t\fP and look for "still logged
in".
+.IP "\fB\-f\fP \fIfile\fP"
+Specifies a file to search other than \fB/var/log/wtmp\fP.
.IP \fB\-R\fP
Suppresses the display of the hostname field.
.IP \fB\-a\fP
--- sysvinit-2.86/man/init.8.manpatch 2004-07-29 07:21:31.000000000 -0400
+++ sysvinit-2.86/man/init.8 2006-08-10 15:33:59.000000000 -0400
@@ -64,7 +64,7 @@
.PP
Runlevel \fBS\fP or \fBs\fP bring the system to single user mode
and do not require an \fB/etc/inittab\fP file. In single user mode,
-\fB/sbin/sulogin\fP is invoked on \fB/dev/console\fP.
+a root shell is opened on \fB/dev/console\fP.
.PP
When entering single user mode, \fBinit\fP initializes the consoles
\fBstty\fP settings to sane values. Clocal mode is set. Hardware
diff -up sysvinit-2.87dsf/man/sulogin.8.foo sysvinit-2.87dsf/man/sulogin.8
--- sysvinit-2.87dsf/man/sulogin.8.foo 2009-07-27 12:54:31.000000000 -0400
+++ sysvinit-2.87dsf/man/sulogin.8 2009-07-27 12:54:37.000000000 -0400
@@ -9,7 +9,7 @@ sulogin \- Single-user login
[ \fITTY\fP ]
.SH DESCRIPTION
.I sulogin
-is invoked by \fBinit(8)\fP when the system goes into single user mode.
+can be invoked by \fBinit(8)\fP when the system goes into single user mode.
(This is done through an entry in \fIinittab(5)\fP.)
\fBInit\fP also
tries to execute \fIsulogin\fP when
@@ -0,0 +1,11 @@
--- sysvinit-2.86/src/init.c.foo 2006-09-21 14:46:26.000000000 -0400
+++ sysvinit-2.86/src/init.c 2006-09-21 14:47:00.000000000 -0400
@@ -959,7 +959,7 @@
* for any wait-type subprocess we _force_ the console
* to be its controlling tty.
*/
- if (strchr("*#sS", runlevel) && ch->flags & WAITING) {
+ if ((strchr("*#sS", runlevel) || (ch->id[0] == 'l' && isdigit(ch->id[1]))) && ch->flags & WAITING) {
/*
* We fork once extra. This is so that we can
* wait and change the process group and session
@@ -0,0 +1,11 @@
--- sysvinit-2.86/src/init.c.loginshell 2004-07-30 08:16:20.000000000 -0400
+++ sysvinit-2.86/src/init.c 2005-12-19 15:41:29.000000000 -0500
@@ -1153,7 +1153,7 @@
for(old = newFamily; old; old = old->next)
if (strpbrk(old->rlevel, "S")) break;
if (old == NULL)
- snprintf(buf, sizeof(buf), "~~:S:wait:%s\n", SULOGIN);
+ snprintf(buf, sizeof(buf), "~~:S:wait:%s -l\n", SHELL);
else
continue;
}
@@ -0,0 +1,11 @@
--- sysvinit-2.86/src/init.c.single 2005-12-21 12:21:04.000000000 -0500
+++ sysvinit-2.86/src/init.c 2005-12-21 12:21:40.000000000 -0500
@@ -1153,7 +1153,7 @@
* See if we have a single user entry.
*/
for(old = newFamily; old; old = old->next)
- if (strpbrk(old->rlevel, "S")) break;
+ if (strpbrk(old->rlevel, "S") && !ISPOWER(old->action)) break;
if (old == NULL)
snprintf(buf, sizeof(buf), "~~:S:wait:%s -l\n", SHELL);
else
@@ -0,0 +1,40 @@
diff --git a/src/last.c b/src/last.c
index 5003c7c..02103e0 100644
--- a/src/last.c
+++ b/src/last.c
@@ -318,30 +318,22 @@ int dns_lookup(char *result, int size, int useip, int32_t *a)
struct sockaddr_in6 sin6;
struct sockaddr *sa;
int salen, flags;
- unsigned int topnibble;
- unsigned int azero = 0, sitelocal = 0;
int mapped = 0;
flags = useip ? NI_NUMERICHOST : 0;
/*
- * IPv4 or IPv6 ? We use 2 heuristics:
- * 1. Current IPv6 range uses 2000-3fff or fec0-feff.
- * Outside of that is illegal and must be IPv4.
- * 2. If last 3 bytes are 0, must be IPv4
- * 3. If IPv6 in IPv4, handle as IPv4
+ * IPv4 or IPv6 ?
+ * 1. If last 3 4bytes are 0, must be IPv4
+ * 2. If IPv6 in IPv4, handle as IPv4
+ * 3. Anything else is IPv6
*
* Ugly.
*/
if (a[0] == 0 && a[1] == 0 && a[2] == (int32_t)htonl (0xffff))
mapped = 1;
- topnibble = ntohl((unsigned int)a[0]) >> 28;
- azero = ntohl((unsigned int)a[0]) >> 16;
- sitelocal = (azero >= 0xfec0 && azero <= 0xfeff) ? 1 : 0;
-
- if (((topnibble < 2 || topnibble > 3) && (!sitelocal)) || mapped ||
- (a[1] == 0 && a[2] == 0 && a[3] == 0)) {
+ if (mapped || (a[1] == 0 && a[2] == 0 && a[3] == 0)) {
/* IPv4 */
sin.sin_family = AF_INET;
sin.sin_port = 0;
@@ -0,0 +1,169 @@
diff --git a/man/pidof.8 b/man/pidof.8
index 276a93c..ac5f58a 100644
--- a/man/pidof.8
+++ b/man/pidof.8
@@ -24,6 +24,7 @@ pidof -- find the process ID of a running program.
.RB [ \-c ]
.RB [ \-n ]
.RB [ \-x ]
+.RB [ \-m ]
.RB [ \-o
.IR omitpid[,omitpid..] ]
.RB [ \-o
@@ -63,6 +64,11 @@ shells running the named scripts.
Tells \fIpidof\fP to omit processes with that process id. The special
pid \fB%PPID\fP can be used to name the parent process of the \fIpidof\fP
program, in other words the calling shell or shell script.
+.IP -m
+When used with -o, will also omit any processes that have the same
+argv[0] and argv[1] as any explicitly omitted process ids. This can be
+used to avoid multiple shell scripts concurrently calling pidof returning
+each other's pids.
.SH "EXIT STATUS"
.TP
.B 0
diff --git a/src/killall5.c b/src/killall5.c
index 5937d98..e73885e 100644
--- a/src/killall5.c
+++ b/src/killall5.c
@@ -118,6 +118,7 @@ typedef struct _s_nfs
/* List of processes. */
PROC *plist;
+PROC *olist;
/* List of processes to omit. */
OMIT *omit;
@@ -345,6 +346,20 @@ static void clear_mnt(void)
}
}
+static void clear_omit(void)
+{
+ OMIT *o;
+ PROC *p;
+ for (o = omit; o; o = omit) {
+ omit = omit->next;
+ free(o);
+ }
+ for (p = olist; p; p = olist) {
+ olist = olist->next;
+ free(p);
+ }
+}
+
/*
* Check if path is ia shadow off a NFS partition.
*/
@@ -452,6 +467,7 @@ int readproc(int do_stat)
DIR *dir;
FILE *fp;
PROC *p, *n;
+ OMIT *o, *m;
struct dirent *d;
struct stat st;
char path[PATH_MAX+1];
@@ -624,6 +640,17 @@ int readproc(int do_stat)
p->next = plist;
plist = p;
p->pid = pid;
+ /* Could be smarter, but it's a small list. */
+ m = omit;
+ for (o = omit; m; o = m) {
+ m = o->next;
+ if (o->pid == p->pid) {
+ n = (PROC*)xmalloc(sizeof(PROC));
+ *n = *p;
+ n->next = olist;
+ olist = n;
+ }
+ }
}
closedir(dir);
@@ -813,6 +840,26 @@ PIDQ_HEAD *pidof(char *prog)
return q;
}
+int matches(PROC *o, PROC *p)
+{
+ int ret = 0;
+ char *oargv1, *pargv1;
+ if ((o->argv0 && p->argv0 && !strcmp(o->argv0,p->argv0))) {
+ if (o->argv1 && p->argv1) {
+ if ((oargv1 = canonicalize_file_name(o->argv1)) == NULL)
+ oargv1 = strdup(o->argv1);
+ if ((pargv1 = canonicalize_file_name(p->argv1)) == NULL)
+ pargv1 = strdup(p->argv1);
+ if (! strcmp(oargv1, pargv1)) {
+ ret = 1;
+ }
+ free(oargv1);
+ free(pargv1);
+ }
+ }
+ return ret;
+}
+
/* Give usage message and exit. */
void usage(void)
{
@@ -845,6 +892,7 @@ void nsyslog(int pri, char *fmt, ...)
#define PIDOF_SINGLE 0x01
#define PIDOF_OMIT 0x02
#define PIDOF_NETFS 0x04
+#define PIDOF_OMIT_OMIT_MATCHES 0x08
/*
* Pidof functionality.
@@ -861,6 +909,7 @@ int main_pidof(int argc, char **argv)
struct stat st;
char tmp[512];
+ olist = (PROC*)0;
omit = (OMIT*)0;
nlist = (NFS*)0;
opterr = 0;
@@ -868,7 +917,7 @@ int main_pidof(int argc, char **argv)
if ((token = getenv("PIDOF_NETFS")) && (strcmp(token,"no") != 0))
flags |= PIDOF_NETFS;
- while ((opt = getopt(argc,argv,"hco:sxn")) != EOF) switch (opt) {
+ while ((opt = getopt(argc,argv,"hcmo:sxn")) != EOF) switch (opt) {
case '?':
nsyslog(LOG_ERR,"invalid options on command line!\n");
closelog();
@@ -907,6 +956,9 @@ int main_pidof(int argc, char **argv)
case 'x':
scripts_too++;
break;
+ case 'm':
+ flags |= PIDOF_OMIT_OMIT_MATCHES;
+ break;
case 'n':
flags |= PIDOF_NETFS;
break;
@@ -938,10 +990,13 @@ int main_pidof(int argc, char **argv)
pid_t spid = 0;
while ((p = get_next_from_pid_q(q))) {
if ((flags & PIDOF_OMIT) && omit) {
- OMIT * optr;
- for (optr = omit; optr; optr = optr->next) {
+ PROC * optr;
+ for (optr = olist; optr; optr = optr->next) {
if (optr->pid == p->pid)
break;
+ if (flags & PIDOF_OMIT_OMIT_MATCHES)
+ if (matches(optr, p))
+ break;
}
/*
@@ -977,6 +1032,7 @@ int main_pidof(int argc, char **argv)
if (!first)
printf("\n");
+ clear_omit();
clear_mnt();
closelog();
@@ -0,0 +1,39 @@
diff --git a/src/init.c b/src/init.c
index d2bd121..dc82e28 100644
--- a/src/init.c
+++ b/src/init.c
@@ -135,6 +135,7 @@ struct utmp utproto; /* Only used for sizeof(utproto.ut_id) */
char *console_dev; /* Console device. */
int pipe_fd = -1; /* /dev/initctl */
int did_boot = 0; /* Did we already do BOOT* stuff? */
+int quiet = 0; /* Should we be relatively silent? */
int main(int, char **);
/* Used by re-exec part */
@@ -1800,7 +1801,7 @@ int read_level(int arg)
initlog(L_SY, "Trying to re-exec init");
return 'U';
default:
- initlog(L_VB, "Switching to runlevel: %c", foo);
+ if (!quiet) initlog(L_VB, "Switching to runlevel: %c", foo);
}
if (foo == 'Q') {
@@ -2598,7 +2599,7 @@ void init_main(void)
/*
* Say hello to the world
*/
- initlog(L_CO, bootmsg, "booting");
+ if (!quiet) initlog(L_CO, bootmsg, "booting");
/*
* See if we have to start an emergency shell.
@@ -2859,6 +2860,8 @@ int main(int argc, char **argv)
else if (!strcmp(argv[f], "-z")) {
/* Ignore -z xxx */
if (argv[f + 1]) f++;
+ } else if (!strcmp(argv[f], "quiet")) {
+ quiet = 1;
} else if (strchr("0123456789sS", argv[f][0])
&& strlen(argv[f]) == 1)
dfl_level = argv[f][0];
@@ -0,0 +1,13 @@
diff --git a/src/wall.c b/src/wall.c
index 92ffbc1..9c68338 100644
--- a/src/wall.c
+++ b/src/wall.c
@@ -94,7 +94,7 @@ int main(int argc, char **argv)
i = 0;
for (p = buf; *p; p++) {
- if (*p == '\n' && i++ > MAXLINES) {
+ if (*p == '\n' && ++i >= MAXLINES) {
*++p = 0;
break;
}