Print this page
8485 Remove set but unused variables in usr/src/cmd


   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License, Version 1.0 only
   6  * (the "License").  You may not use this file except in compliance
   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*

  23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 /*      Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
  28 /*        All Rights Reserved   */
  29 
  30 /*
  31  * Portions of this source code were derived from Berkeley 4.3 BSD
  32  * under license from the Regents of the University of California.
  33  */
  34 
  35 #pragma ident   "%Z%%M% %I%     %E% SMI"
  36 
  37 /*
  38  * This contains the mainline code for the YP server.  Data
  39  * structures which are process-global are also in this module.
  40  */
  41 
  42 /* this is so that ypserv will compile under 5.5 */
  43 #define _SVID_GETTOD
  44 #include <sys/time.h>
  45 extern int gettimeofday(struct timeval *);
  46 
  47 #include "ypsym.h"
  48 #include <sys/types.h>
  49 #include <sys/wait.h>
  50 #include <fcntl.h>
  51 #include <rpc/rpc.h>
  52 #include <netconfig.h>
  53 #include <netdir.h>
  54 #include <sys/select.h>
  55 #include <stdlib.h>
  56 #include <unistd.h>


 157 } ypservice_t;
 158 
 159 ypservice_t     service[] = {
 160         { "udp", -1, 1, 4, 0, 0 },
 161         { "tcp", -1, 1, 4, 0, 0 },
 162         { "udp6", -1, 0, 6, 0, 0 },
 163         { "tcp6", -1, 0, 6, 0, 0 }
 164 };
 165 
 166 #define MAXSERVICES     (sizeof (service)/sizeof (service[0]))
 167 
 168 int             service_classes[MAXSERVICES];
 169 
 170 /*
 171  * Does startup processing for the yp server.
 172  */
 173 static void
 174 ypinit(int argc, char **argv)
 175 {
 176         int pid;
 177         int stat, t;
 178         struct sigaction act;
 179         int ufd, tfd;
 180         SVCXPRT *utransp, *ttransp;
 181         struct netconfig *nconf;
 182         int connmaxrec = RPC_MAXDATASIZE;
 183         int i, j, services = 0;
 184 
 185 
 186         /*
 187          * Init yptol flags. Will get redone by init_lock_system() but we need
 188          * to know if we should parse yptol cmd line options.
 189          */
 190         init_yptol_flag();
 191 
 192         ypget_command_line_args(argc, argv);
 193 
 194         if (silent) {
 195                 pid = (int)fork();
 196 
 197                 if (pid == -1) {


 220                 if (stat == 1) {
 221                         logprintf("NIS to LDAP mapping inactive.\n");
 222                 } else if (stat != 0) {
 223                         logprintf("Aborting after NIS to LDAP mapping "
 224                                                         "error.\n");
 225                         fflush(stderr);
 226                         exit(-1);
 227                 }
 228         }
 229 
 230         if (silent) {
 231                 freopen("/dev/null", "r", stdin);
 232                 if (access(logfile, _IOWRT)) {
 233                     freopen("/dev/null", "w", stdout);
 234                     freopen("/dev/null", "w", stderr);
 235                 } else {
 236                     freopen(logfile, "a", stdout);
 237                     freopen(logfile, "a", stderr);
 238                 }
 239 
 240                 t = open("/dev/tty", 2);
 241 
 242                 setpgrp();
 243         }
 244 
 245 #ifdef  SYSVCONFIG
 246         sigset(SIGHUP, (void (*)())sysvconfig);
 247 #else
 248         sigset(SIGHUP, SIG_IGN);
 249 #endif
 250 
 251         /*
 252          * Setting disposition to SIG_IGN will not create zombies when child
 253          * processes terminate.
 254          */
 255         sigset(SIGCHLD, SIG_IGN);
 256 
 257         act.sa_handler = cleanup_resolv;
 258         sigemptyset(&act.sa_mask);
 259         act.sa_flags = SA_RESETHAND;
 260         sigaction(SIGTERM, &act, (struct sigaction *)NULL);




   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License, Version 1.0 only
   6  * (the "License").  You may not use this file except in compliance
   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2017 Gary Mills
  24  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  25  * Use is subject to license terms.
  26  */
  27 
  28 /*      Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
  29 /*        All Rights Reserved   */
  30 
  31 /*
  32  * Portions of this source code were derived from Berkeley 4.3 BSD
  33  * under license from the Regents of the University of California.
  34  */
  35 


  36 /*
  37  * This contains the mainline code for the YP server.  Data
  38  * structures which are process-global are also in this module.
  39  */
  40 
  41 /* this is so that ypserv will compile under 5.5 */
  42 #define _SVID_GETTOD
  43 #include <sys/time.h>
  44 extern int gettimeofday(struct timeval *);
  45 
  46 #include "ypsym.h"
  47 #include <sys/types.h>
  48 #include <sys/wait.h>
  49 #include <fcntl.h>
  50 #include <rpc/rpc.h>
  51 #include <netconfig.h>
  52 #include <netdir.h>
  53 #include <sys/select.h>
  54 #include <stdlib.h>
  55 #include <unistd.h>


 156 } ypservice_t;
 157 
 158 ypservice_t     service[] = {
 159         { "udp", -1, 1, 4, 0, 0 },
 160         { "tcp", -1, 1, 4, 0, 0 },
 161         { "udp6", -1, 0, 6, 0, 0 },
 162         { "tcp6", -1, 0, 6, 0, 0 }
 163 };
 164 
 165 #define MAXSERVICES     (sizeof (service)/sizeof (service[0]))
 166 
 167 int             service_classes[MAXSERVICES];
 168 
 169 /*
 170  * Does startup processing for the yp server.
 171  */
 172 static void
 173 ypinit(int argc, char **argv)
 174 {
 175         int pid;
 176         int stat;
 177         struct sigaction act;
 178         int ufd, tfd;
 179         SVCXPRT *utransp, *ttransp;
 180         struct netconfig *nconf;
 181         int connmaxrec = RPC_MAXDATASIZE;
 182         int i, j, services = 0;
 183 
 184 
 185         /*
 186          * Init yptol flags. Will get redone by init_lock_system() but we need
 187          * to know if we should parse yptol cmd line options.
 188          */
 189         init_yptol_flag();
 190 
 191         ypget_command_line_args(argc, argv);
 192 
 193         if (silent) {
 194                 pid = (int)fork();
 195 
 196                 if (pid == -1) {


 219                 if (stat == 1) {
 220                         logprintf("NIS to LDAP mapping inactive.\n");
 221                 } else if (stat != 0) {
 222                         logprintf("Aborting after NIS to LDAP mapping "
 223                                                         "error.\n");
 224                         fflush(stderr);
 225                         exit(-1);
 226                 }
 227         }
 228 
 229         if (silent) {
 230                 freopen("/dev/null", "r", stdin);
 231                 if (access(logfile, _IOWRT)) {
 232                     freopen("/dev/null", "w", stdout);
 233                     freopen("/dev/null", "w", stderr);
 234                 } else {
 235                     freopen(logfile, "a", stdout);
 236                     freopen(logfile, "a", stderr);
 237                 }
 238 
 239                 (void) open("/dev/tty", 2);
 240 
 241                 setpgrp();
 242         }
 243 
 244 #ifdef  SYSVCONFIG
 245         sigset(SIGHUP, (void (*)())sysvconfig);
 246 #else
 247         sigset(SIGHUP, SIG_IGN);
 248 #endif
 249 
 250         /*
 251          * Setting disposition to SIG_IGN will not create zombies when child
 252          * processes terminate.
 253          */
 254         sigset(SIGCHLD, SIG_IGN);
 255 
 256         act.sa_handler = cleanup_resolv;
 257         sigemptyset(&act.sa_mask);
 258         act.sa_flags = SA_RESETHAND;
 259         sigaction(SIGTERM, &act, (struct sigaction *)NULL);