From: Ben Kaduk Date: Wed, 17 Jul 2013 19:00:11 +0000 (-0400) Subject: bozo: Remove dead code and minor cleanup X-Git-Tag: upstream/1.6.10_pre1^2~124 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=63e35976933c8e24c2153fb55a46842a8dc04414;p=packages%2Fo%2Fopenafs.git bozo: Remove dead code and minor cleanup This stuff has been #if 0'd for ages; put it out of its misery. While here, remove the global bnode_waiting which is not used for anything. bnode_SoftInt claims to return a pointer, so return NULL instead of 0. Reviewed-on: http://gerrit.openafs.org/10284 Reviewed-by: Chas Williams - CONTRACTOR Reviewed-by: Derrick Brashear Tested-by: BuildBot (cherry picked from commit 54eb2485b59550ba42569ed3a8d76211a3a35019) Change-Id: Ife2604f1a99ef81e2075a82cb97d94ae5373031c Reviewed-on: http://gerrit.openafs.org/10864 Reviewed-by: D Brashear Reviewed-by: Andrew Deason Reviewed-by: Benjamin Kaduk Tested-by: BuildBot Reviewed-by: Stephan Wiesand --- diff --git a/src/bozo/bnode.c b/src/bozo/bnode.c index 82e7bcafb..4eaf12f69 100644 --- a/src/bozo/bnode.c +++ b/src/bozo/bnode.c @@ -49,7 +49,6 @@ #define BNODE_ERROR_COUNT_MAX 16 /* maximum number of retries */ #define BNODE_ERROR_DELAY_MAX 60 /* maximum retry delay (seconds) */ -int bnode_waiting = 0; static PROCESS bproc_pid; /* pid of waker-upper */ static struct bnode *allBnodes = 0; /* list of all bnodes */ static struct bnode_proc *allProcs = 0; /* list of all processes for which we're waiting */ @@ -616,9 +615,7 @@ bproc(void *unused) /* signalled, probably by incoming signal */ while (1) { options = WNOHANG; - bnode_waiting = options | 0x800000; code = waitpid((pid_t) - 1, &status, options); - bnode_waiting = 0; if (code == 0 || code == -1) break; /* all done */ /* otherwise code has a process id, which we now search for */ @@ -847,7 +844,7 @@ bnode_SoftInt(void *param) /* int asignal = (int) param; */ IOMGR_Cancel(bproc_pid); - return 0; + return NULL; } /* Called at signal interrupt level; queues function to be called @@ -1038,21 +1035,3 @@ bnode_StopProc(struct bnode_proc *aproc, int asignal) bnode_Check(aproc->bnode); return code; } - -int -bnode_Deactivate(struct bnode *abnode) -{ - struct bnode **pb, *tb; - struct bnode *nb; - if (!(abnode->flags & BNODE_ACTIVE)) - return BZNOTACTIVE; - for (pb = &allBnodes, tb = *pb; tb; tb = nb) { - nb = tb->next; - if (tb == abnode) { - *pb = nb; - tb->flags &= ~BNODE_ACTIVE; - return 0; - } - } - return BZNOENT; -} diff --git a/src/bozo/bos.c b/src/bozo/bos.c index 15bf343af..47490faa0 100644 --- a/src/bozo/bos.c +++ b/src/bozo/bos.c @@ -100,50 +100,6 @@ em(afs_int32 acode) return (char *)afs_error_message(acode); } -/* get partition id from a name */ -/* XXX - unused code - could be removed? */ -#if 0 -static afs_int32 -GetPartitionID(char *aname) -{ - char tc; - char ascii[3]; - - tc = *aname; - if (tc == 0) - return -1; /* unknown */ - /* numbers go straight through */ - if (tc >= '0' && tc <= '9') { - return atoi(aname); - } - /* otherwise check for vicepa or /vicepa, or just plain "a" */ - ascii[2] = 0; - if (strlen(aname) <= 2) { - strcpy(ascii, aname); - } else if (!strncmp(aname, "/vicep", 6)) { - strncpy(ascii, aname + 6, 2); - } else if (!strncmp(aname, "vicep", 5)) { - strncpy(ascii, aname + 5, 2); - } else - return -1; /* bad partition name */ - /* now partitions are named /vicepa ... /vicepz, /vicepaa, /vicepab, - * .../vicepzz, and are numbered from 0. Do the appropriate conversion */ - if (ascii[1] == 0) { - /* one char name, 0..25 */ - if (ascii[0] < 'a' || ascii[0] > 'z') - return -1; /* wrongo */ - return ascii[0] - 'a'; - } else { - /* two char name, 26 .. */ - if (ascii[0] < 'a' || ascii[0] > 'z') - return -1; /* wrongo */ - if (ascii[1] < 'a' || ascii[1] > 'z') - return -1; /* just as bad */ - return (ascii[0] - 'a') * 26 + (ascii[1] - 'a') + 26; - } -} -#endif - /* make ctime easier to use */ static char * DateOf(time_t atime) diff --git a/src/bozo/bosserver.c b/src/bozo/bosserver.c index 6277c8ac2..95cf318ca 100644 --- a/src/bozo/bosserver.c +++ b/src/bozo/bosserver.c @@ -561,130 +561,6 @@ tweak_config(void) } #endif -#if 0 -/* - * This routine causes the calling process to go into the background and - * to lose its controlling tty. - * - * It does not close or otherwise alter the standard file descriptors. - * - * It writes warning messages to the standard error output if certain - * fundamental errors occur. - * - * This routine requires - * - * #include - * #include - * #include - * #include - * #include - * - * and has been tested on: - * - * AIX 4.2 - * Digital Unix 4.0D - * HP-UX 11.0 - * IRIX 6.5 - * Linux 2.1.125 - * Solaris 2.5 - * Solaris 2.6 - */ - -#ifndef AFS_NT40_ENV -static void -background(void) -{ - /* - * A process is a process group leader if its process ID - * (getpid()) and its process group ID (getpgrp()) are the same. - */ - - /* - * To create a new session (and thereby lose our controlling - * terminal) we cannot be a process group leader. - * - * To guarantee we are not a process group leader, we fork and - * let the parent process exit. - */ - - if (getpid() == getpgrp()) { - pid_t pid; - pid = fork(); - switch (pid) { - case -1: - abort(); /* leave footprints */ - break; - case 0: /* child */ - break; - default: /* parent */ - exit(0); - break; - } - } - - /* - * By here, we are not a process group leader, so we can make a - * new session and become the session leader. - */ - - { - pid_t sid = setsid(); - - if (sid == -1) { - static char err[] = "bosserver: WARNING: setsid() failed\n"; - write(STDERR_FILENO, err, sizeof err - 1); - } - } - - /* - * Once we create a new session, the current process is a - * session leader without a controlling tty. - * - * On some systems, the first tty device the session leader - * opens automatically becomes the controlling tty for the - * session. - * - * So, to guarantee we do not acquire a controlling tty, we fork - * and let the parent process exit. The child process is not a - * session leader, and so it will not acquire a controlling tty - * even if it should happen to open a tty device. - */ - - if (getpid() == getpgrp()) { - pid_t pid; - pid = fork(); - switch (pid) { - case -1: - abort(); /* leave footprints */ - break; - case 0: /* child */ - break; - default: /* parent */ - exit(0); - break; - } - } - - /* - * check that we no longer have a controlling tty - */ - - { - int fd; - - fd = open("/dev/tty", O_RDONLY); - - if (fd >= 0) { - static char err[] = - "bosserver: WARNING: /dev/tty still attached\n"; - close(fd); - write(STDERR_FILENO, err, sizeof err - 1); - } - } -} -#endif /* ! AFS_NT40_ENV */ -#endif - static char * make_pid_filename(char *ainst, char *aname) { @@ -1024,11 +900,6 @@ main(int argc, char **argv, char **envp) else chdir(AFSDIR_SERVER_LOGS_DIRPATH); -#if 0 - fputs(AFS_GOVERNMENT_MESSAGE, stdout); - fflush(stdout); -#endif - /* go into the background and remove our controlling tty, close open file desriptors */