Index: Makefile
===================================================================
--- Makefile (nonexistent)
+++ Makefile (revision 5)
@@ -0,0 +1,56 @@
+
+COMPONENT_TARGETS = $(HARDWARE_NOARCH)
+
+
+include ../../../../build-system/constants.mk
+
+
+url = $(DOWNLOAD_SERVER)/sources/packages/a/initscripts
+
+versions = 8.54
+pkgname = function-src
+suffix = tar.xz
+
+tarballs = $(addsuffix .$(suffix), $(addprefix $(pkgname)-, $(versions)))
+sha1s = $(addsuffix .sha1sum, $(tarballs))
+
+patches = $(CURDIR)/patches/function-src-8.54-make.patch
+
+.NOTPARALLEL: $(patches)
+
+
+BUILD_TARGETS = $(tarballs) $(sha1s) $(patches)
+
+
+include ../../../../build-system/core.mk
+
+
+.PHONY: download_clean
+
+
+$(tarballs):
+ @echo -e "\n======= Downloading source tarballs =======" ; \
+ for tarball in $(tarballs) ; do \
+ echo "$(url)/$$tarball" | xargs -n 1 -P 100 wget $(WGET_OPTIONS) - & \
+ done ; wait
+
+$(sha1s): $(tarballs)
+ @for sha in $@ ; do \
+ echo -e "\n======= Downloading '$$sha' signature =======\n" ; \
+ echo "$(url)/$$sha" | xargs -n 1 -P 100 wget $(WGET_OPTIONS) - & wait %1 ; \
+ touch $$sha ; \
+ echo -e "\n======= Check the '$$sha' sha1sum =======\n" ; \
+ sha1sum --check $$sha ; ret="$$?" ; \
+ if [ "$$ret" == "1" ]; then \
+ echo -e "\n======= ERROR: Bad '$$sha' sha1sum =======\n" ; \
+ exit 1 ; \
+ fi ; \
+ done
+
+$(patches): $(sha1s)
+ @echo -e "\n======= Create Patches =======\n" ; \
+ ( cd create-8.54-patch ; ./create.patch.sh ) ; \
+ echo -e "\n"
+
+download_clean:
+ @rm -f $(tarballs) $(sha1s) $(patches)
Index: create-8.54-patch/create.patch.sh
===================================================================
--- create-8.54-patch/create.patch.sh (nonexistent)
+++ create-8.54-patch/create.patch.sh (revision 5)
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+VERSION=8.54
+
+tar --files-from=file.list -xJvf ../function-src-$VERSION.tar.xz
+mv function-src-$VERSION function-src-$VERSION-orig
+
+cp -rf ./function-src-$VERSION-new ./function-src-$VERSION
+
+diff --unified -Nr function-src-$VERSION-orig function-src-$VERSION > function-src-$VERSION-make.patch
+
+mv function-src-$VERSION-make.patch ../patches
+
+rm -rf ./function-src-$VERSION
+rm -rf ./function-src-$VERSION-orig
Property changes on: create-8.54-patch/create.patch.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: create-8.54-patch/file.list
===================================================================
--- create-8.54-patch/file.list (nonexistent)
+++ create-8.54-patch/file.list (revision 5)
@@ -0,0 +1,3 @@
+function-src-8.54/initlog.c
+function-src-8.54/process.c
+function-src-8.54/usleep.c
Index: create-8.54-patch/function-src-8.54-new/Makefile
===================================================================
--- create-8.54-patch/function-src-8.54-new/Makefile (nonexistent)
+++ create-8.54-patch/function-src-8.54-new/Makefile (revision 5)
@@ -0,0 +1,31 @@
+
+CFLAGS ?= -O2 -Wall -D_GNU_SOURCE
+
+PROGS = usleep initlog fstab-decode consoletype
+INITLOG_OBJS = initlog.o process.o
+USLEEP_OBJS = usleep.o
+
+mandir = /usr/share/man
+
+all: $(PROGS)
+
+clean:
+ rm -f $(PROGS) *.o
+
+install:
+ mkdir -p $(DESTDIR)/bin $(DESTDIR)/sbin $(DESTDIR)$(mandir)/man{1,8}
+ install -m 755 usleep $(DESTDIR)/bin/usleep
+ install -m 755 fstab-decode $(DESTDIR)/sbin/fstab-decode
+ install -m 755 initlog $(DESTDIR)/sbin/initlog
+ install -m 755 consoletype $(DESTDIR)/sbin/consoletype
+ install -m 644 initlog.1 $(DESTDIR)$(mandir)/man1
+ install -m 644 usleep.1 $(DESTDIR)$(mandir)/man1
+ install -m 644 fstab-decode.8 $(DESTDIR)$(mandir)/man8
+ install -m 644 consoletype.1 $(DESTDIR)$(mandir)/man1
+
+initlog: $(INITLOG_OBJS)
+ $(CC) $(LDFLAGS) -o $@ $(INITLOG_OBJS) -Wl,-Bstatic -lpopt -Wl,-Bdynamic
+
+usleep: $(USLEEP_OBJS)
+ $(CC) $(LDFLAGS) -o $@ $(USLEEP_OBJS) -Wl,-Bstatic -lpopt -Wl,-Bdynamic
+
Index: create-8.54-patch/function-src-8.54-new/initlog.c
===================================================================
--- create-8.54-patch/function-src-8.54-new/initlog.c (nonexistent)
+++ create-8.54-patch/function-src-8.54-new/initlog.c (revision 5)
@@ -0,0 +1,448 @@
+/*
+ * Copyright (c) 1999-2003 Red Hat, Inc. All rights reserved.
+ *
+ * This software may be freely redistributed under the terms of the GNU
+ * public license.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <libintl.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define SYSLOG_NAMES
+#include <syslog.h>
+
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/un.h>
+#include <sys/wait.h>
+
+#define _(String) gettext((String))
+
+#include <popt.h>
+
+#include <regex.h>
+
+#include "initlog.h"
+#include "process.h"
+
+static int logfacility=LOG_DAEMON;
+static int logpriority=LOG_NOTICE;
+static int reexec=0;
+static int quiet=0;
+int debug=0;
+
+regex_t **regList = NULL;
+
+static int logEntries = 0;
+struct logInfo *logData = NULL;
+
+void readConfiguration(char *fname) {
+ int fd,num=0;
+ struct stat sbuf;
+ char *data,*line, *d;
+ regex_t *regexp;
+ int lfac=-1,lpri=-1;
+
+ if ((fd=open(fname,O_RDONLY))==-1) return;
+ if (fstat(fd,&sbuf)) {
+ close(fd);
+ return;
+ }
+ d = data=malloc(sbuf.st_size+1);
+ if (read(fd,data,sbuf.st_size)!=sbuf.st_size) {
+ close(fd);
+ free(data);
+ return;
+ }
+ close(fd);
+ data[sbuf.st_size] = '\0';
+ while ((line=getLine(&data))) {
+ if (line[0]=='#') continue;
+ if (!strncmp(line,"ignore ",7)) {
+ regexp = malloc(sizeof(regex_t));
+ if (!regcomp(regexp,line+7,REG_EXTENDED|REG_NOSUB|REG_NEWLINE)) {
+ regList = realloc(regList,(num+2) * sizeof(regex_t *));
+ regList[num] = regexp;
+ regList[num+1] = NULL;
+ num++;
+ }
+ }
+ if (!strncmp(line,"facility ",9)) {
+ lfac=atoi(line+9);
+ if ((lfac == 0) && strcmp(line+9,"0")) {
+ int x =0;
+
+ lfac = LOG_DAEMON;
+ for (x=0;facilitynames[x].c_name;x++) {
+ if (!strcmp(line+9,facilitynames[x].c_name)) {
+ lfac = facilitynames[x].c_val;
+ break;
+ }
+ }
+ }
+ }
+ if (!strncmp(line,"priority ",9)) {
+ lpri = atoi(line+9);
+ if ((lpri == 0) && strcmp(line+9,"0")) {
+ int x=0;
+
+ lpri = LOG_NOTICE;
+ for (x=0;prioritynames[x].c_name;x++) {
+ if (!strcmp(line+9,prioritynames[x].c_name)) {
+ lpri = prioritynames[x].c_val;
+ break;
+ }
+ }
+ }
+ }
+ }
+ if (lfac!=-1) logfacility=lfac;
+ if (lpri!=-1) logpriority=lpri;
+ free(d);
+}
+
+char *getLine(char **data) {
+ /* Get one line from data */
+ /* Anything up to a carraige return (\r) or a backspace (\b) is discarded. */
+ /* If this really bothers you, mail me and I might make it configurable. */
+ /* It's here to avoid confilcts with fsck's progress bar. */
+ char *x, *y;
+
+ if (!*data) return NULL;
+ x=*data;
+ while (*x && (*x != '\n')) {
+ while (*x && (*x != '\n') && (*x != '\r') && (*x != '\b')) x++;
+ if (*x && (*x=='\r' || *x =='\b')) {
+ *data = x+1;
+ x++;
+ }
+ }
+ if (*x) {
+ x++;
+ } else {
+ if (x-*data) {
+ y=malloc(x-*data+1);
+ y[x-*data] = 0;
+ y[x-*data-1] = '\n';
+ memcpy(y,*data,x-*data);
+ } else {
+ y=NULL;
+ }
+ *data = NULL;
+ return y;
+ }
+ y = malloc(x-*data);
+ y[x-*data-1] = 0;
+ memcpy(y,*data,x-*data-1);
+ *data = x;
+ return y;
+}
+
+char **toArray(char *line, int *num) {
+ /* Converts a long string into an array of lines. */
+ char **lines;
+ char *tmpline;
+
+ *num = 0;
+ lines = NULL;
+
+ while ((tmpline=getLine(&line))) {
+ if (!*num)
+ lines = (char **) malloc(sizeof(char *));
+ else
+ lines = (char **) realloc(lines, (*num+1)*sizeof(char *));
+ lines[*num] = tmpline;
+ (*num)++;
+ }
+ return lines;
+}
+
+int trySocket() {
+ int s;
+ struct sockaddr_un addr;
+
+ s = socket(AF_LOCAL, SOCK_DGRAM, 0);
+ if (s<0)
+ return 1;
+
+ bzero(&addr,sizeof(addr));
+ addr.sun_family = AF_LOCAL;
+ strncpy(addr.sun_path,_PATH_LOG,sizeof(addr.sun_path)-1);
+
+ if (connect(s,(struct sockaddr *) &addr,sizeof(addr))<0) {
+ if (errno == EPROTOTYPE || errno == ECONNREFUSED) {
+ DDEBUG("connect failed (EPROTOTYPE), trying stream\n");
+ close(s);
+ s = socket(AF_LOCAL, SOCK_STREAM, 0);
+ if (connect(s,(struct sockaddr *) &addr, sizeof(addr)) < 0) {
+ DDEBUG("connect failed: %s\n",strerror(errno));
+ close(s);
+ return 1;
+ }
+ close(s);
+ return 0;
+ }
+ close(s);
+ DDEBUG("connect failed: %s\n",strerror(errno));
+ return 1;
+ } else {
+ close(s);
+ return 0;
+ }
+}
+
+int logLine(struct logInfo *logEnt) {
+ /* Logs a line... somewhere. */
+ int x;
+ struct stat statbuf;
+
+ /* Don't log empty or null lines */
+ if (!logEnt->line || !strcmp(logEnt->line,"\n")) return 0;
+
+
+ if ((stat(_PATH_LOG,&statbuf)==-1) || trySocket()) {
+ DDEBUG("starting daemon failed, pooling entry %d\n",logEntries);
+ logData=realloc(logData,(logEntries+1)*sizeof(struct logInfo));
+ logData[logEntries].fac = logEnt->fac;
+ logData[logEntries].pri = logEnt->pri;
+ logData[logEntries].cmd = strdup(logEnt->cmd);
+ logData[logEntries].line = strdup(logEnt->line);
+ logEntries++;
+ } else {
+ if (logEntries>0) {
+ for (x=0;x<logEntries;x++) {
+ DDEBUG("flushing log entry %d =%s=\n",x,logData[x].line);
+ openlog(logData[x].cmd,0,logData[x].fac);
+ syslog(logData[x].pri,"%s",logData[x].line);
+ closelog();
+ }
+ free(logData);
+ logEntries = 0;
+ }
+ DDEBUG("logging =%s= via syslog\n",logEnt->line);
+ openlog(logEnt->cmd,0,logEnt->fac);
+ syslog(logEnt->pri,"%s",logEnt->line);
+ closelog();
+ }
+ return 0;
+}
+
+int logEvent(char *cmd, int eventtype,char *string) {
+ char *eventtable [] = {
+ _("%s babbles incoherently"),
+ _("%s succeeded"),
+ _("%s failed"),
+ _("%s cancelled at user request"),
+ _("%s failed due to a failed dependency"),
+ /* insert more here */
+ NULL
+ };
+ int x=0,len, rc;
+ struct logInfo logentry;
+
+ if (cmd) {
+ logentry.cmd = basename(cmd);
+ if ((logentry.cmd[0] =='K' || logentry.cmd[0] == 'S') &&
+ ( logentry.cmd[1] >= '0' && logentry.cmd[1] <= '9' ) &&
+ ( logentry.cmd[2] >= '0' && logentry.cmd[2] <= '9' ) )
+ logentry.cmd+=3;
+ logentry.cmd = strdup(logentry.cmd);
+ } else
+ logentry.cmd = strdup(_("(none)"));
+ if (!string) {
+ string = alloca(strlen(cmd)+1);
+ strcpy(string,cmd);
+ }
+
+ while (eventtable[x] && x<eventtype) x++;
+ if (!(eventtable[x])) x=0;
+
+ len=strlen(eventtable[x])+strlen(string);
+ logentry.line=malloc(len);
+ snprintf(logentry.line,len,eventtable[x],string);
+
+ logentry.pri = logpriority;
+ logentry.fac = logfacility;
+
+ rc = logLine(&logentry);
+ free(logentry.line);
+ free(logentry.cmd);
+ return rc;
+}
+
+int logString(char *cmd, char *string) {
+ struct logInfo logentry;
+ int rc;
+
+ if (cmd) {
+ logentry.cmd = basename(cmd);
+ if ((logentry.cmd[0] =='K' || logentry.cmd[0] == 'S') &&
+ ( logentry.cmd[1] >= '0' && logentry.cmd[1] <= 0x39 ) &&
+ ( logentry.cmd[2] >= '0' && logentry.cmd[2] <= 0x39 ) )
+ logentry.cmd+=3;
+ logentry.cmd = strdup(logentry.cmd);
+ } else
+ logentry.cmd = strdup(_(""));
+ logentry.line = strdup(string);
+ logentry.pri = logpriority;
+ logentry.fac = logfacility;
+
+ rc = logLine(&logentry);
+ free(logentry.line);
+ free(logentry.cmd);
+ return rc;
+}
+
+int processArgs(int argc, char **argv, int silent) {
+ char *cmdname=NULL;
+ char *conffile=NULL;
+ int cmdevent=0;
+ char *cmd=NULL;
+ char *logstring=NULL;
+ char *fac=NULL,*pri=NULL;
+ int lfac=-1, lpri=-1;
+ poptContext context;
+ int rc;
+ struct poptOption optTable[] = {
+ POPT_AUTOHELP
+ { "conf", 0, POPT_ARG_STRING, &conffile, 0,
+ "configuration file (default: /etc/initlog.conf)", NULL
+ },
+ { "name", 'n', POPT_ARG_STRING, &cmdname, 0,
+ "name of service being logged", NULL
+ },
+ { "event", 'e', POPT_ARG_INT, &cmdevent, 0,
+ "event being logged (see man page)", NULL
+ },
+ { "cmd", 'c', POPT_ARG_STRING, &cmd, 0,
+ "command to run, logging output", NULL
+ },
+ { "debug", 'd', POPT_ARG_NONE, &debug, 0,
+ "print lots of verbose debugging info", NULL
+ },
+ { "run", 'r', POPT_ARG_STRING, &cmd, 3,
+ "command to run, accepting input on open fd", NULL
+ },
+ { "string", 's', POPT_ARG_STRING, &logstring, 0,
+ "string to log", NULL
+ },
+ { "facility", 'f', POPT_ARG_STRING, &fac, 1,
+ "facility to log at (default: 'local7')", NULL
+ },
+ { "priority", 'p', POPT_ARG_STRING, &pri, 2,
+ "priority to log at (default: 'notice')", NULL
+ },
+ { "quiet", 'q', POPT_ARG_NONE, &quiet, 0,
+ "suppress stdout/stderr", NULL
+ },
+ { 0, 0, 0, 0, 0, 0 }
+ };
+
+ context = poptGetContext("initlog", argc, (const char **)argv, optTable, 0);
+
+ while ((rc = poptGetNextOpt(context)) > 0) {
+ switch (rc) {
+ case 1:
+ lfac=atoi(fac);
+ if ((lfac == 0) && strcmp(fac,"0")) {
+ int x =0;
+
+ lfac = LOG_DAEMON;
+ for (x=0;facilitynames[x].c_name;x++) {
+ if (!strcmp(fac,facilitynames[x].c_name)) {
+ lfac = facilitynames[x].c_val;
+ break;
+ }
+ }
+ }
+ break;
+ case 2:
+ lpri = atoi(pri);
+ if ((lpri == 0) && strcmp(pri,"0")) {
+ int x=0;
+
+ lpri = LOG_NOTICE;
+ for (x=0;prioritynames[x].c_name;x++) {
+ if (!strcmp(pri,prioritynames[x].c_name)) {
+ lpri = prioritynames[x].c_val;
+ break;
+ }
+ }
+ }
+ break;
+ case 3:
+ reexec = 1;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if ((rc < -1)) {
+ if (!silent)
+ fprintf(stderr, "%s: %s\n",
+ poptBadOption(context, POPT_BADOPTION_NOALIAS),
+ poptStrerror(rc));
+
+ return -1;
+ }
+ if ( (cmd && logstring) || (cmd && cmdname) ) {
+ if (!silent)
+ fprintf(stderr, _("--cmd and --run are incompatible with --string or --name\n"));
+ return -1;
+ }
+ if ( cmdname && (!logstring && !cmdevent)) {
+ if (!silent)
+ fprintf(stderr, _("--name requires one of --event or --string\n"));
+ return -1;
+ }
+ if (cmdevent && cmd) {
+ if (!silent)
+ fprintf(stderr, _("--cmd and --run are incompatible with --event\n"));
+ return -1;
+ }
+ if (conffile) {
+ readConfiguration(conffile);
+ } else {
+ readConfiguration("/etc/initlog.conf");
+ }
+ if (cmd) {
+ while (isspace(*cmd)) cmd++;
+ }
+ if (lpri!=-1) logpriority=lpri;
+ if (lfac!=-1) logfacility=lfac;
+ if (cmdevent) {
+ logEvent(cmdname,cmdevent,logstring);
+ } else if (logstring) {
+ logString(cmdname,logstring);
+ } else if ( cmd && *cmd) {
+ return(runCommand(cmd,reexec,quiet,debug));
+ } else {
+ if (!silent)
+ fprintf(stderr,"nothing to do! (see \"initlog --help\")\n");
+ return -1;
+ }
+ return 0;
+}
+
+int main(int argc, char **argv) {
+
+ setlocale(LC_ALL,"");
+ bindtextdomain("initlog","/etc/locale");
+ textdomain("initlog");
+ /* Well this seems pretty damn dumb */
+ /* fprintf(stderr, _("WARNING: initlog is deprecated and will be removed in a future release\n")); */
+ exit(processArgs(argc,argv,0));
+}
Index: create-8.54-patch/function-src-8.54-new/process.c
===================================================================
--- create-8.54-patch/function-src-8.54-new/process.c (nonexistent)
+++ create-8.54-patch/function-src-8.54-new/process.c (revision 5)
@@ -0,0 +1,324 @@
+/*
+ * Copyright (c) 1999-2003 Red Hat, Inc. All rights reserved.
+ *
+ * This software may be freely redistributed under the terms of the GNU
+ * public license.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sys/signal.h>
+#include <sys/poll.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+
+#include <popt.h>
+
+#include <regex.h>
+
+#include "initlog.h"
+#include "process.h"
+
+extern regex_t **regList;
+
+int forkCommand(char **args, int *outfd, int *errfd, int *cmdfd, int quiet) {
+ /* Fork command 'cmd', returning pid, and optionally pointer
+ * to open file descriptor fd */
+ int fdout=-1, fderr=-1, fdcmd=-1, pid;
+ int outpipe[2], errpipe[2], fdpipe[2];
+ int ourpid;
+
+ if ( (pipe(outpipe)==-1) || (pipe(errpipe)==-1) || (pipe(fdpipe)==-1) ) {
+ perror("pipe");
+ return -1;
+ }
+
+ if (outfd) {
+ fdout = outpipe[1];
+ *outfd = outpipe[0];
+ } else {
+ if (!quiet)
+ fdout=dup(1);
+ }
+ if (errfd) {
+ fderr = errpipe[1];
+ *errfd = errpipe[0];
+ } else {
+ if (!quiet)
+ fderr=dup(2);
+ }
+
+ if (cmdfd) {
+ *cmdfd = fdpipe[0];
+ fdcmd = fdpipe[1];
+ } else {
+ fdcmd = open("/dev/null",O_WRONLY);
+ }
+ if (fdout==-1 || fderr==-1 || fdcmd==-1)
+ return -1;
+ ourpid = getpid();
+ if ((pid = fork())==-1) {
+ perror("fork");
+ return -1;
+ }
+ /* We exec the command normally as the child. However, if we're getting passed
+ * back arguments via an fd, we'll exec it as the parent. Therefore, if Bill
+ * fucks up and we segfault or something, we don't kill rc.sysinit. */
+ if ( (cmdfd&&!pid) || (pid &&!cmdfd)) {
+ /* parent */
+ close(fdout);
+ close(fderr);
+ close(fdcmd);
+ if (!pid)
+ return ourpid;
+ else
+ return pid;
+ } else {
+ /* kid */
+ int sc_open_max;
+
+ if (outfd) {
+ if ( (dup2(fdout,1)==-1) ) {
+ perror("dup2");
+ exit(-1);
+ }
+ } else if (quiet)
+ if ((dup2(open("/dev/null",O_WRONLY),1))==-1) {
+ perror("dup2");
+ exit(-1);
+ }
+
+ if (errfd) {
+ if ((dup2(fderr,2)==-1)) {
+ perror("dup2");
+ exit(-1);
+ }
+ } else if (quiet)
+ if ((dup2(open("/dev/null",O_WRONLY),2))==-1) {
+ perror("dup2");
+ exit(-1);
+ }
+
+
+ if ((dup2(fdcmd,CMD_FD)==-1)) {
+ perror("dup2");
+ exit(-1);
+ }
+ close(fdout);
+ close(fderr);
+ close(fdcmd);
+ if (outfd)
+ close(*outfd);
+ if (errfd)
+ close(*errfd);
+ if (cmdfd)
+ close(*cmdfd);
+
+ /* close up extra fds, and hope this doesn't break anything */
+ sc_open_max = sysconf(_SC_OPEN_MAX);
+ if(sc_open_max > 1) {
+ int fd;
+ for(fd = 3; fd < sc_open_max; fd++) {
+ if (!(cmdfd && fd == CMD_FD))
+ close(fd);
+ }
+ }
+
+ execvp(args[0],args);
+ perror("execvp");
+ exit(-1);
+ }
+}
+
+int monitor(char *cmdname, int pid, int numfds, int *fds, int reexec, int quiet, int debug) {
+ struct pollfd *pfds;
+ char *outbuf=NULL;
+ char *tmpstr=NULL;
+ int x,y,rc=-1;
+ int done=0;
+ int output=0;
+ char **cmdargs=NULL;
+ char **tmpargs=NULL;
+ int cmdargc;
+ char *procpath = NULL;
+
+ if (reexec) {
+ procpath=malloc(20*sizeof(char));
+ snprintf(procpath,20,"/proc/%d",pid);
+ }
+
+ pfds = malloc(numfds*sizeof(struct pollfd));
+ for (x=0;x<numfds;x++) {
+ pfds[x].fd = fds[x];
+ pfds[x].events = POLLIN | POLLPRI;
+ }
+
+ while (!done) {
+ usleep(500);
+ if (((x=poll(pfds,numfds,500))==-1)&&errno!=EINTR) {
+ perror("poll");
+ free(pfds);
+ if (procpath)
+ free(procpath);
+ return -1;
+ }
+ if (!reexec) {
+ if (waitpid(pid,&rc,WNOHANG))
+ done=1;
+ } else {
+ struct stat sbuf;
+ /* if /proc/pid ain't there and /proc is, it's dead... */
+ if (stat(procpath,&sbuf)&&!stat("/proc/cpuinfo",&sbuf))
+ done=1;
+ }
+ if (x<0)
+ continue;
+ y=0;
+ while (y<numfds) {
+ if ( x && ((pfds[y].revents & (POLLIN | POLLPRI)) )) {
+ int bytesread = 0;
+
+ do {
+ char *b, *buf=calloc(8193,sizeof(char));
+ b = buf;
+ bytesread = read(pfds[y].fd,buf,8192);
+ if (bytesread==-1) {
+ perror("read");
+ free(pfds);
+ if (procpath)
+ free(procpath);
+ free(buf);
+ return -1;
+ }
+ if (bytesread) {
+ if (!quiet && !reexec)
+ write(1,buf,bytesread);
+ if (quiet) {
+ outbuf=realloc(outbuf,(outbuf ? strlen(outbuf)+bytesread+1 : bytesread+1));
+ if (!output) outbuf[0]='\0';
+ strcat(outbuf,buf);
+ output = 1;
+ }
+ while ((tmpstr=getLine(&buf))) {
+ int ignore=0;
+
+ if (regList) {
+ int count=0;
+
+ while (regList[count]) {
+ if (!regexec(regList[count],tmpstr,0,NULL,0)) {
+ ignore=1;
+ break;
+ }
+ count++;
+ }
+ }
+ if (!ignore) {
+ if (!reexec) {
+ if (getenv("IN_INITLOG")) {
+ char *buffer=calloc(8192,sizeof(char));
+ DDEBUG("sending =%s= to initlog parent\n",tmpstr);
+ snprintf(buffer,8192,"-n %s -s \"%s\"\n",
+ cmdname,tmpstr);
+ /* don't blow up if parent isn't there */
+ signal(SIGPIPE,SIG_IGN);
+ write(CMD_FD,buffer,strlen(buffer));
+ signal(SIGPIPE,SIG_DFL);
+ free(buffer);
+ } else {
+ logString(cmdname,tmpstr);
+ }
+ } else {
+ int z;
+
+ cmdargs=NULL;
+ tmpargs=NULL;
+ cmdargc=0;
+
+ poptParseArgvString(tmpstr,&cmdargc,(const char ***)&tmpargs);
+ cmdargs=malloc( (cmdargc+2) * sizeof(char *) );
+ cmdargs[0]=strdup("initlog");
+ for (z=0;z<(cmdargc);z++) {
+ cmdargs[z+1]=tmpargs[z];
+ }
+ cmdargs[cmdargc+1]=NULL;
+ processArgs(cmdargc+1,cmdargs,1);
+ free(cmdargs[0]);
+ free(tmpargs);
+ free(cmdargs);
+ }
+ }
+ if (tmpstr) free(tmpstr);
+ }
+ }
+ free(b);
+ } while ( bytesread==8192 );
+ }
+ y++;
+ }
+ }
+ if ((!WIFEXITED(rc)) || (rc=WEXITSTATUS(rc))) {
+ /* If there was an error and we're quiet, be loud */
+
+ if (quiet && output) {
+ write(1,outbuf,strlen(outbuf));
+ }
+ free(pfds);
+ if (procpath)
+ free(procpath);
+ if(outbuf)
+ free(outbuf);
+ return (rc);
+ }
+ free(pfds);
+ if (procpath)
+ free(procpath);
+ if(outbuf)
+ free(outbuf);
+ return 0;
+}
+
+int runCommand(char *cmd, int reexec, int quiet, int debug) {
+ int fds[2];
+ int pid,x;
+ char **args, **tmpargs;
+ char *cmdname;
+
+ poptParseArgvString(cmd,&x,(const char ***)&tmpargs);
+ args = malloc((x+1)*sizeof(char *));
+ for ( pid = 0; pid < x ; pid++) {
+ args[pid] = strdup(tmpargs[pid]);
+ }
+ args[pid] = NULL;
+ if (strcmp(args[0],"sh") && strcmp(args[0],"/bin/sh"))
+ cmdname = basename(args[0]);
+ else
+ cmdname = basename(args[1]);
+ if ((cmdname[0] =='K' || cmdname[0] == 'S') &&
+ ( cmdname[1] >= '0' && cmdname[1] <= '9' ) &&
+ ( cmdname[2] >= '0' && cmdname[2] <= '9' ) )
+ cmdname+=3;
+ if (!reexec) {
+ pid=forkCommand(args,&fds[0],&fds[1],NULL,quiet);
+ if (pid == -1)
+ return -1;
+ x=monitor(cmdname,pid,2,fds,reexec,quiet,debug);
+ } else {
+ setenv("IN_INITLOG","yes",1);
+ pid=forkCommand(args,NULL,NULL,&fds[0],quiet);
+ if (pid == -1)
+ return -1;
+ unsetenv("IN_INITLOG");
+ x=monitor(cmdname,pid,1,&fds[0],reexec,quiet,debug);
+ }
+ return x;
+}
Index: create-8.54-patch/function-src-8.54-new/usleep.c
===================================================================
--- create-8.54-patch/function-src-8.54-new/usleep.c (nonexistent)
+++ create-8.54-patch/function-src-8.54-new/usleep.c (revision 5)
@@ -0,0 +1,76 @@
+/*
+ * usleep
+ *
+ * Written by Donald Barnes <djb@redhat.com> for Red Hat, Inc.
+ *
+ * Copyright (c) 1997-2003 Red Hat, Inc. All rights reserved.
+ *
+ * This software may be freely redistributed under the terms of the GNU
+ * public license.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "popt.h"
+
+int main(int argc, char **argv) {
+ unsigned long count;
+ poptContext optCon;
+ int showVersion = 0;
+ int showOot = 0;
+ int rc;
+ char * countStr = NULL;
+ struct poptOption options[] = {
+ { "version", 'v', POPT_ARG_NONE, &showVersion, 0,
+ "Display the version of this program, and exit" },
+ { "oot", 'o', POPT_ARG_NONE, &showOot, 0,
+ "oot says hey!" },
+ POPT_AUTOHELP
+ { 0, 0, 0, 0, 0 }
+ };
+
+ optCon = poptGetContext("usleep", argc, (const char **)argv, options,0);
+ /*poptReadDefaultConfig(optCon, 1);*/
+ poptSetOtherOptionHelp(optCon, "[microseconds]");
+
+ if ((rc = poptGetNextOpt(optCon)) < -1) {
+ fprintf(stderr, "usleep: bad argument %s: %s\n",
+ poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
+ poptStrerror(rc));
+ return 2;
+ }
+
+ if (showVersion) {
+ printf("usleep version 1.2\n usleep --help for more info\n");
+ return 0;
+ }
+
+ if (showOot) {
+ printf("oot says hey!\n");
+ return 0;
+ }
+
+ countStr = (char *)poptGetArg(optCon);
+
+ if (countStr == NULL) count = 1;
+
+ else if (countStr && poptGetArg(optCon)) {
+ fprintf(stderr, "%s: exactly one argument (number of microseconds) "
+ "must be used\n", argv[0]);
+ return 2;
+ }
+
+ else count = strtoul(countStr, NULL, 0);
+
+ usleep(count);
+ return 0;
+}
Index: create-8.54-patch/function-src-8.54-new
===================================================================
--- create-8.54-patch/function-src-8.54-new (nonexistent)
+++ create-8.54-patch/function-src-8.54-new (revision 5)
Property changes on: create-8.54-patch/function-src-8.54-new
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,73 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~
Index: create-8.54-patch
===================================================================
--- create-8.54-patch (nonexistent)
+++ create-8.54-patch (revision 5)
Property changes on: create-8.54-patch
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,73 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~
Index: patches/README
===================================================================
--- patches/README (nonexistent)
+++ patches/README (revision 5)
@@ -0,0 +1,6 @@
+
+/* begin *
+
+ TODO: Leave some comment here.
+
+ * end */
Index: patches
===================================================================
--- patches (nonexistent)
+++ patches (revision 5)
Property changes on: patches
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,73 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~
Index: .
===================================================================
--- . (nonexistent)
+++ . (revision 5)
Property changes on: .
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,73 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~