]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
bozo: build notifier sample program
authorMichael Meffie <mmeffie@sinenomine.net>
Thu, 6 Oct 2011 12:33:37 +0000 (08:33 -0400)
committerStephan Wiesand <stephan.wiesand@desy.de>
Wed, 11 Sep 2013 22:12:08 +0000 (15:12 -0700)
Build the smail-notifier sample program.

Reviewed-on: http://gerrit.openafs.org/5555
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit ac88af748e25a40d062c888396aab8670ff8426a)

Change-Id: Idb845fe0a3f7fd6581f6756b899be140db625123
Reviewed-on: http://gerrit.openafs.org/9568
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/bozo/.gitignore
src/bozo/Makefile.in
src/bozo/smail-notifier.c
src/bozo/test/Makefile.in
src/bozo/test/testproc.c

index 515ed0c2f805f2ef86c6cb9b94d1914e431777b0..9d9c800959f4902e5e298b78a5cbe3ee96ced105 100644 (file)
@@ -8,3 +8,5 @@
 /boserr.c
 /bosint.h
 /bosserver
+/smail-notifier
+/test/testproc
index a89898f980e171e078991a9a3ea1fa0f691c830c..de114bceb430fbee46f6c353db07e66dda3f1112 100644 (file)
@@ -43,7 +43,8 @@ LIBS=${TOP_LIBDIR}/librx.a \
 OBJS=bosserver.o bnode.o ezbnodeops.o fsbnodeops.o bosint.ss.o bosint.xdr.o \
 bosoprocs.o cronbnodeops.o
 
-all: bosserver ${TOP_INCDIR}/afs/bosint.h bos ${TOP_LIBDIR}/libbos.a bos_util
+all: bosserver ${TOP_INCDIR}/afs/bosint.h bos ${TOP_LIBDIR}/libbos.a bos_util \
+    smail-notifier
 
 generated: bosint.ss.c bosint.xdr.c bosint.cs.c bosint.h bnode.h boserr.c
 
@@ -116,6 +117,11 @@ libbos.a: bosint.xdr.o bosint.cs.o boserr.o AFS_component_version_number.o
 bosserver: $(OBJS) $(LIBS)
        ${CC} $(CFLAGS) -o bosserver $(OBJS) ${TOP_LIBDIR}/libaudit.a $(LIBS)  ${XLIBS} ${KRB5_LIBS}
 
+smail-notifier.o: smail-notifier.c ${INCLS}
+
+smail-notifier: smail-notifier.o $(LIBS)
+       ${CC} $(CFLAGS) -o smail-notifier smail-notifier.o $(LIBS) ${XLIBS}
+
 #
 # Install targets
 #
@@ -150,7 +156,7 @@ dest: bosserver bos bos_util libbos.a bosint.h bnode.h
 # Misc. targets
 #
 clean:
-       $(RM) -f  *.a *.o bos bosserver testproc bos_util \
+       $(RM) -f  *.a *.o bos bosserver smail-notifier bos_util \
                bosint.cs.c bosint.ss.c bosint.xdr.c bosint.h \
                core boserr.c bnode.h AFS_component_version_number.c 
 
index 3c52be3da9b716e6f4ecbb3819b0c864dc632855..17eb1e66a0d8a47ebab77e0c67c6640f8313593f 100644 (file)
 #include <netdb.h>
 #include <netinet/in.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
 #include <afs/afsutil.h>
+#include <fcntl.h>
 
 /*
  * XXX CHANGE the following depedent stuff XXX
 
 #include "AFS_component_version_number.c"
 
-main(argc, argv)
-     int argc;
-     char **argv;
+int
+main(int argc, char **argv)
 {
     struct stat tstat;
     FILE *fin = stdin;
     char buf[BUFSIZ], *bufp, *bufp1, *typep, *cmd, *bp;
-    afs_int32 code, c, fd, id, pflags = -1, len, core = 0, lastE = 0;
-    char comLine[60], coreName[40], name[40], lastErrorName[50];
-    afs_int32 pid = -1, lastExit = -1, lastSignal = -1, rsCount = -1;
+    afs_int32 code, c, fd, pflags = -1, len, core = 0;
+    char comLine[60], coreName[40], name[40];
+    afs_int32 pid = -1, rsCount = -1;
     afs_int32 procStarts = -1;
     afs_int32 errorCode = -1, errorSignal = -1, goal = -1;
     time_t procStartTime = -1, rsTime = -1, lastAnyExit = -1, lastErrorExit = -1;
@@ -68,12 +70,6 @@ main(argc, argv)
                    strcpy(coreName, cmd);
                else if (!strcmp(typep, "pid:"))
                    pid = atoi(cmd);
-#ifdef notdef
-               else if (!strcmp(typep, "lastExit:"))
-                   lastExit = atoi(cmd);
-               else if (!strcmp(typep, "lastSignal:"))
-                   lastSignal = atoi(cmd);
-#endif
                else if (!strcmp(typep, "flags:"))
                    pflags = atoi(cmd);
                else if (!strcmp(typep, "END")) {
@@ -171,12 +167,6 @@ main(argc, argv)
                  (core ? (c ? "a recent " : "an 'old' ") : "no "),
                  (core ? bp : ""));
     bufp += strlen(bufp);
-#ifdef notdef
-    (void)sprintf(bufp, "Last Exit code %d\n", lastExit);
-    bufp += strlen(bufp);
-    (void)sprintf(bufp, "Last Signal number %d\n", lastSignal);
-    bufp += strlen(bufp);
-#endif
     if (pflags == 1)
        strcpy(bp, "PROCESS STARTED");
     else if (pflags == 2)
@@ -216,16 +206,6 @@ main(argc, argv)
     bufp += strlen(bufp);
     (void)sprintf(bufp, "Last process terminating signal %d\n", errorSignal);
     bufp += strlen(bufp);
-#ifdef notdef
-    if (strcmp(lastErrorName, "(null)"))
-       lastE = 1;
-    if (lastE) {
-       (void)sprintf(bufp,
-                     "Short name of process that failed last in this bnode is: %s\n",
-                     lastErrorName);
-       bufp += strlen(bufp);
-    }
-#endif
     (void)sprintf(bufp, "The server is now %srunning\n",
                  (goal ? "" : "not "));
     bufp += strlen(bufp);
index 92317606099afabdb085dfb68c9b1906e81e4ab2..c8a3e6bdaa70f0320b67290151f00be03a4a03a9 100644 (file)
@@ -17,7 +17,7 @@ LDIRS=-L${TOP_LIBDIR} -L${DESTDIR}/lib/afs -L..
 
 CFLAGS = ${OPTIMIZE} ${INCDIRS} ${LDIRS} ${LIBS} ${XCFLAGS} ${ARCHFLAGS}
 
-all: testproc smail-notifier
+all: testproc
 
 install:  
 
@@ -34,7 +34,7 @@ smail-notifier: smail-notifier.c
 # Misc targets
 #
 clean:
-       $(RM) -f  *.a *.o testproc smail-notifier core
+       $(RM) -f  *.a *.o testproc core
 
 dest:  
 
index 06dec34fa153b6e467aa5b5bd37e78df44c7b00e..cb071ac2456628fdb4f5e84e7b063663655e83a7 100644 (file)
@@ -12,6 +12,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 
 static int ignore = 0;
 static int sleepTime = 10;
@@ -27,7 +28,7 @@ trim(char *s)
     }
 }
 
-int
+void
 readfile(void)
 {
     FILE *fp;