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.8.0_pre1^2~973 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=54eb2485b59550ba42569ed3a8d76211a3a35019;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. Change-Id: Ie7b32bbc606a105190d246355f47bd7ea885c6f8 Reviewed-on: http://gerrit.openafs.org/10284 Reviewed-by: Chas Williams - CONTRACTOR Reviewed-by: Derrick Brashear Tested-by: BuildBot --- diff --git a/src/bozo/bnode.c b/src/bozo/bnode.c index 752747482..077a446f0 100644 --- a/src/bozo/bnode.c +++ b/src/bozo/bnode.c @@ -34,7 +34,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 opr_queue allBnodes; /**< List of all bnodes */ static struct opr_queue allProcs; /**< List of all processes for which we're waiting */ @@ -576,9 +575,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 */ @@ -811,7 +808,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 @@ -1002,19 +999,3 @@ bnode_StopProc(struct bnode_proc *aproc, int asignal) bnode_Check(aproc->bnode); return code; } - -#if 0 -int -bnode_Deactivate(struct bnode *abnode) -{ - struct opr_queue *cursor; - if (!(abnode->flags & BNODE_ACTIVE)) - return BZNOTACTIVE; - - if (opr_queue_IsOnQueue(&abnode->q)) { - tb->flags &= ~BNODE_ACTIVE; - return 0; - } - return BZNOENT; -} -#endif diff --git a/src/bozo/bos.c b/src/bozo/bos.c index 1d35973d0..880936a10 100644 --- a/src/bozo/bos.c +++ b/src/bozo/bos.c @@ -85,50 +85,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 5df0cf070..3899efc1b 100644 --- a/src/bozo/bosserver.c +++ b/src/bozo/bosserver.c @@ -641,122 +641,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 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) { @@ -1079,11 +963,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 */