mirror of
https://github.com/kdlucas/byte-unixbench.git
synced 2024-12-11 23:30:07 +08:00
fix compiler warnings
const correctness format string safety remove assigned, but unused, variables fix arguments to execl() remove defined but unused warnings (for code used only by some tests)
This commit is contained in:
parent
7f1ddef4e8
commit
58e83b663b
@ -48,7 +48,7 @@
|
||||
/* Can't seem to get this declared in the headers... */
|
||||
extern int kill(pid_t pid, int sig);
|
||||
|
||||
void wrapup(char *);
|
||||
void wrapup(const char *);
|
||||
void onalarm(int);
|
||||
void pipeerr();
|
||||
void grunt();
|
||||
@ -56,7 +56,7 @@ void getwork(void);
|
||||
#if debug
|
||||
void dumpwork(void);
|
||||
#endif
|
||||
void fatal(char *s);
|
||||
void fatal(const char *s);
|
||||
|
||||
float thres;
|
||||
float est_rate = DEF_RATE;
|
||||
@ -420,7 +420,7 @@ void pipeerr()
|
||||
sigpipe++;
|
||||
}
|
||||
|
||||
void wrapup(char *reason)
|
||||
void wrapup(const char *reason)
|
||||
{
|
||||
int i;
|
||||
int killed = 0;
|
||||
@ -449,7 +449,6 @@ void getwork(void)
|
||||
char *q = (void *)0;
|
||||
struct st_work *w = (void *)0;
|
||||
char line[MAXLINE];
|
||||
char c;
|
||||
|
||||
while (fgets(line, MAXLINE, stdin) != NULL) {
|
||||
if (nwork >= MAXWORK) {
|
||||
@ -492,7 +491,6 @@ void getwork(void)
|
||||
/* standard input for this job */
|
||||
q = ++lp;
|
||||
while (*lp && *lp != ' ') lp++;
|
||||
c = *lp;
|
||||
*lp = '\0';
|
||||
if ((f = open(q, 0)) == -1) {
|
||||
fprintf(stderr, "cannot open input file (%s) for job %d\n",
|
||||
@ -580,10 +578,10 @@ void dumpwork(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
void fatal(char *s)
|
||||
void fatal(const char *s)
|
||||
{
|
||||
int i;
|
||||
fprintf(stderr, s);
|
||||
fprintf(stderr, "%s", s);
|
||||
fflush(stderr);
|
||||
perror("Reason?");
|
||||
fflush(stderr);
|
||||
|
@ -90,7 +90,7 @@ char *argv[];
|
||||
fprintf(stderr,"%s: fork failed\n", argv[0]);
|
||||
exit(1);
|
||||
} else if (pid == 0) {
|
||||
execl("/bin/true", (char *) 0);
|
||||
execl("/bin/true", "/bin/true", (char *) 0);
|
||||
fprintf(stderr,"%s: exec /bin/true failed\n", argv[0]);
|
||||
exit(1);
|
||||
} else {
|
||||
|
@ -80,6 +80,8 @@
|
||||
typedef int flag;
|
||||
|
||||
|
||||
#ifdef HAS_SELECT
|
||||
|
||||
/*
|
||||
static inline int find_first_set_bit (CONST void *array, int size)
|
||||
*/
|
||||
@ -144,6 +146,8 @@ static int find_next_set_bit (CONST void *array, int size, int offset)
|
||||
return (find_first_set_bit (++ul_array, size - index) + index);
|
||||
} /* End Function find_next_set_bit */
|
||||
|
||||
#endif /* HAS_SELECT */
|
||||
|
||||
|
||||
struct callback_struct
|
||||
{
|
||||
@ -245,7 +249,7 @@ static void time_poll (struct pollfd *pollfd_array, int start_index,
|
||||
short revents;
|
||||
int fd, count, nready;
|
||||
struct timeval time1, time2;
|
||||
struct pollfd *pollfd_ptr, *stop_pollfd;
|
||||
struct pollfd *pollfd_ptr;
|
||||
|
||||
/* Warm the cache a bit */
|
||||
poll (pollfd_array + start_index, num_to_test, 0);
|
||||
@ -264,11 +268,11 @@ static void time_poll (struct pollfd *pollfd_array, int start_index,
|
||||
fprintf (stderr, "Error: nready: %d\n", nready);
|
||||
exit (1);
|
||||
}
|
||||
stop_pollfd = pollfd_array + start_index + num_to_test;
|
||||
for (pollfd_ptr = pollfd_array + start_index; TRUE; ++pollfd_ptr)
|
||||
for (pollfd_ptr = pollfd_array + start_index; nready; ++pollfd_ptr)
|
||||
{
|
||||
if (pollfd_ptr->revents == 0) continue;
|
||||
/* Have an active descriptor */
|
||||
--nready;
|
||||
revents = pollfd_ptr->revents;
|
||||
fd = pollfd_ptr->fd;
|
||||
if (revents & POLLPRI)
|
||||
@ -277,7 +281,6 @@ static void time_poll (struct pollfd *pollfd_array, int start_index,
|
||||
(*callbacks[fd].input_func) (callbacks[fd].info);
|
||||
if (revents & POLLOUT)
|
||||
(*callbacks[fd].output_func) (callbacks[fd].info);
|
||||
if (--nready == 0) break;
|
||||
}
|
||||
gettimeofday (&time2, NULL);
|
||||
times[count] = (time2.tv_sec - time1.tv_sec) * 1000000;
|
||||
|
Loading…
Reference in New Issue
Block a user