2 static char sfs_c_subSid[] = "@(#)sfs_c_sub.c 2.1 97/10/23";
6 * Copyright (c) 1992-1997,2001 by Standard Performance Evaluation Corporation
8 * Standard Performance Evaluation Corporation (SPEC)
9 * 6585 Merchant Place, Suite 100
12 * This product contains benchmarks acquired from several sources who
13 * understand and agree with SPEC's goal of creating fair and objective
14 * benchmarks to measure computer performance.
16 * This copyright notice is placed here only to protect SPEC in the
17 * event the source is misused in any manner that is contrary to the
18 * spirit, the goals and the intent of SPEC.
20 * The source code is provided to the user or company under the license
21 * agreement for the SPEC Benchmark Suite for this product.
24 /*****************************************************************
26 * Copyright 1991,1992 Legato Systems, Inc. *
27 * Copyright 1991,1992 Auspex Systems, Inc. *
28 * Copyright 1991,1992 Data General Corporation *
29 * Copyright 1991,1992 Digital Equipment Corporation *
30 * Copyright 1991,1992 Interphase Corporation *
31 * Copyright 1991,1992 Sun Microsystems, Inc. *
33 *****************************************************************/
36 * ---------------------- sfs_c_sub.c ---------------------
38 * Subroutines common to both sfs and sfs_prime_client.
41 * int generic_kill(int, int)
42 * void generic_catcher(int)
43 * char * lad_timestamp(void)
49 * 16-Dec-91 Wittle Created.
54 * ------------------------- Include Files -------------------------
68 #include <sys/types.h>
71 #include <sys/signal.h>
75 #include "sfs_c_def.h"
78 * Common data shared between sfs and sfs_prime
80 * Values for invalid runs
82 char *invalid_str[INVALID_MAX] = {
85 "IO distribution file",
91 "Number client directories",
103 * ------------------------- Signal Handlers -------------------------
107 * Signal Sender. Send signal 'sig' to process 'pid'.
114 if (DEBUG_PARENT_SIGNAL)
115 (void) fprintf(stderr,
116 "%s: sending Pid %d Signal %d\n", sfs_Myname, pid ,signal);
117 return(kill((pid_t)pid, signal));
123 * Signal Handler. Catch and reset the handler for signal 'i'.
129 #if !(defined(_XOPEN_SOURCE) || defined(USE_POSIX_SIGNALS))
130 (void) signal(i, generic_catcher);
132 if (DEBUG_CHILD_SIGNAL)
133 (void) fprintf(stderr, "%s: caught Signal %d\n", sfs_Myname, i);
134 (void) fflush(stderr);
136 } /* generic_catcher */
141 * get the date and time and return a string, remove the END-OF-LINE (\n)
146 static time_t run_date;
147 static char date_string[26];
149 run_date = time((time_t *)NULL);
150 (void) strncpy((char *) date_string, (char *) ctime(&run_date), 24);
153 } /* lad_timestamp */
156 set_debug_level(char *s)
161 unsigned int level = 0;
163 if (s == NULL || *s == '\0')
172 /* find first flag to set */
175 i = i * 10 + (*s++ - '0');
178 /* find last flag to set */
181 while (isdigit(*++s))
182 i = i * 10 + (*s - '0');
186 if (first != 0 && last != 0 && first < 32 && last < 32) {
187 for (i = first - 1; i < last; i++) {
192 /* more arguments? */