* inet/test-ifaddrs.c: Fight warnings.

	* argp/argp-help.c: Fight warnings.

	* include/time.h: Declare __difftime.
This commit is contained in:
Ulrich Drepper 2004-04-04 00:41:39 +00:00
parent 6472c918f7
commit abca9f7f58
8 changed files with 67 additions and 51 deletions

View File

@ -1,5 +1,11 @@
2004-04-03 Ulrich Drepper <drepper@redhat.com>
* inet/test-ifaddrs.c: Fight warnings.
* argp/argp-help.c: Fight warnings.
* include/time.h: Declare __difftime.
* sysdeps/unix/sysv/linux/internal_statvfs.c: Restructure to avoid
duplication in 64-bit version.
* sysdeps/unix/sysv/linux/wordsize-64/internal_statvfs64.c: New file.

View File

@ -1,5 +1,5 @@
/* Hierarchial argument parsing help output
Copyright (C) 1995-2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 1995-2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
@ -47,6 +47,7 @@ char *alloca ();
#include <assert.h>
#include <stdarg.h>
#include <ctype.h>
#include <limits.h>
#ifdef USE_IN_LIBIO
# include <wchar.h>
#endif
@ -452,8 +453,10 @@ make_hol (const struct argp *argp, struct hol_cluster *cluster)
hol->entries = malloc (sizeof (struct hol_entry) * hol->num_entries);
hol->short_options = malloc (num_short_options + 1);
assert (hol->entries && hol->short_options
&& hol->num_entries <= SIZE_MAX / sizeof (struct hol_entry));
assert (hol->entries && hol->short_options);
#if SIZE_MAX <= UINT_MAX
assert (hol->num_entries <= SIZE_MAX / sizeof (struct hol_entry));
#endif
/* Fill in the entries. */
so = hol->short_options;
@ -846,8 +849,10 @@ hol_append (struct hol *hol, struct hol *more)
char *short_options =
malloc (hol_so_len + strlen (more->short_options) + 1);
assert (entries && short_options
&& num_entries <= SIZE_MAX / sizeof (struct hol_entry));
assert (entries && short_options);
#if SIZE_MAX <= UINT_MAX
assert (num_entries <= SIZE_MAX / sizeof (struct hol_entry));
#endif
__mempcpy (__mempcpy (entries, hol->entries,
hol->num_entries * sizeof (struct hol_entry)),

View File

@ -95,6 +95,7 @@ extern char * __strptime_internal (const char *rp, const char *fmt,
int era_cnt, __locale_t loc)
internal_function;
extern double __difftime (time_t time1, time_t time0);
/* Use in the clock_* functions. Size of the field representing the

View File

@ -1,5 +1,5 @@
/* Test listing of network interface addresses.
Copyright (C) 2002 Free Software Foundation, Inc.
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -25,10 +25,44 @@
#include <netinet/in.h>
#include <arpa/inet.h>
static int failures;
static const char *
addr_string (struct sockaddr *sa, char *buf, size_t size)
{
if (sa == NULL)
return "<none>";
switch (sa->sa_family)
{
case AF_INET:
return inet_ntop (AF_INET, &((struct sockaddr_in *) sa)->sin_addr,
buf, size);
case AF_INET6:
return inet_ntop (AF_INET6, &((struct sockaddr_in6 *) sa)->sin6_addr,
buf, size);
#ifdef AF_LINK
case AF_LINK:
return "<link>";
#endif
case AF_UNSPEC:
return "---";
case AF_PACKET:
return "<packet>";
default:
++failures;
printf ("sa_family=%d %08x\n", sa->sa_family,
*(int*)&((struct sockaddr_in *) sa)->sin_addr.s_addr);
return "<unexpected sockaddr family>";
}
}
int
main (void)
{
int failures = 0;
struct ifaddrs *ifaces, *ifa;
if (getifaddrs (&ifaces) < 0)
@ -48,43 +82,11 @@ Name Flags Address Netmask Broadcast/Destination");
for (ifa = ifaces; ifa != NULL; ifa = ifa->ifa_next)
{
char abuf[64], mbuf[64], dbuf[64];
inline const char *addr_string (struct sockaddr *sa, char *buf)
{
if (sa == NULL)
return "<none>";
switch (sa->sa_family)
{
case AF_INET:
return inet_ntop (AF_INET,
&((struct sockaddr_in *) sa)->sin_addr,
buf, sizeof abuf);
case AF_INET6:
return inet_ntop (AF_INET6,
&((struct sockaddr_in6 *) sa)->sin6_addr,
buf, sizeof abuf);
#ifdef AF_LINK
case AF_LINK:
return "<link>";
#endif
case AF_UNSPEC:
return "---";
case AF_PACKET:
return "<packet>";
default:
++failures;
printf ("sa_family=%d %08x\n", sa->sa_family,
*(int*)&((struct sockaddr_in *) sa)->sin_addr.s_addr);
return "<unexpected sockaddr family>";
}
}
printf ("%-15s%#.4x %-15s %-15s %-15s\n",
ifa->ifa_name, ifa->ifa_flags,
addr_string (ifa->ifa_addr, abuf),
addr_string (ifa->ifa_netmask, mbuf),
addr_string (ifa->ifa_broadaddr, dbuf));
addr_string (ifa->ifa_addr, abuf, sizeof (abuf)),
addr_string (ifa->ifa_netmask, mbuf, sizeof (mbuf)),
addr_string (ifa->ifa_broadaddr, dbuf, sizeof (dbuf)));
}
freeifaddrs (ifaces);

View File

@ -25,6 +25,7 @@
#include <unistd.h>
#if _POSIX_THREAD_CPUTIME
static pthread_barrier_t b2;
static pthread_barrier_t bN;
@ -48,6 +49,7 @@ tf (void *arg)
return NULL;
}
#endif
int
@ -68,15 +70,15 @@ do_test (void)
pthread_t th[N + 1];
clockid_t cl[N + 1];
#ifndef CLOCK_THREAD_CPUTIME_ID
# ifndef CLOCK_THREAD_CPUTIME_ID
if (pthread_getcpuclockid (pthread_self (), &cl[0]) != 0)
{
puts ("own pthread_getcpuclockid failed");
return 1;
}
#else
# else
cl[0] = CLOCK_THREAD_CPUTIME_ID;
#endif
# endif
pthread_attr_t at;

View File

@ -1,5 +1,5 @@
/* Globally disable events.
Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 1999.
@ -28,7 +28,7 @@ td_ta_clear_event (ta_arg, event)
{
td_thragent_t *const ta = (td_thragent_t *) ta_arg;
td_err_e err;
psaddr_t eventmask;
psaddr_t eventmask = 0;
void *copy;
LOG ("td_ta_clear_event");

View File

@ -1,5 +1,5 @@
/* Globally enable events.
Copyright (C) 1999,2001,2002,2003 Free Software Foundation, Inc.
Copyright (C) 1999,2001,2002,2003,2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 1999.
@ -28,7 +28,7 @@ td_ta_set_event (ta_arg, event)
{
td_thragent_t *const ta = (td_thragent_t *) ta_arg;
td_err_e err;
psaddr_t eventmask;
psaddr_t eventmask = 0;
void *copy;
LOG ("td_ta_set_event");

View File

@ -1,5 +1,5 @@
/* Iterate over a process's threads.
Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 1999.
@ -119,7 +119,7 @@ td_ta_thr_iter (const td_thragent_t *ta_arg, td_thr_iter_f *callback,
{
td_thragent_t *const ta = (td_thragent_t *) ta_arg;
td_err_e err;
psaddr_t list;
psaddr_t list = 0;
LOG ("td_ta_thr_iter");