Looks good.
On Wed, May 1, 2013 at 11:32 AM, Ben Pfaff <b...@nicira.com> wrote: > getmntent_r() is a GNU extension so we test for its existence and just > disable this feature of system stats if it is not present, because this > feature is not very important. > > Signed-off-by: Ben Pfaff <b...@nicira.com> > --- > configure.ac | 2 +- > vswitchd/system-stats.c | 8 +++++--- > 2 files changed, 6 insertions(+), 4 deletions(-) > > diff --git a/configure.ac b/configure.ac > index 7af8afb..bbb6dea 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -60,7 +60,7 @@ OVS_CHECK_IF_DL > OVS_CHECK_STRTOK_R > AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec, struct stat.st_mtimensec], > [], [], [[#include <sys/stat.h>]]) > -AC_CHECK_FUNCS([mlockall strnlen strsignal getloadavg statvfs setmntent]) > +AC_CHECK_FUNCS([mlockall strnlen strsignal getloadavg statvfs > getmntent_r]) > AC_CHECK_HEADERS([mntent.h sys/statvfs.h linux/types.h linux/if_ether.h]) > > OVS_CHECK_PKIDIR > diff --git a/vswitchd/system-stats.c b/vswitchd/system-stats.c > index 2e18b1b..842bc20 100644 > --- a/vswitchd/system-stats.c > +++ b/vswitchd/system-stats.c > @@ -447,9 +447,11 @@ get_process_stats(struct smap *stats) > static void > get_filesys_stats(struct smap *stats OVS_UNUSED) > { > -#if HAVE_SETMNTENT && HAVE_STATVFS > +#if HAVE_GETMNTENT_R && HAVE_STATVFS > static const char file_name[] = "/etc/mtab"; > + struct mntent mntent; > struct mntent *me; > + char buf[4096]; > FILE *stream; > struct ds s; > > @@ -460,7 +462,7 @@ get_filesys_stats(struct smap *stats OVS_UNUSED) > } > > ds_init(&s); > - while ((me = getmntent(stream)) != NULL) { > + while ((me = getmntent_r(stream, &mntent, buf, sizeof buf)) != NULL) { > unsigned long long int total, free; > struct statvfs vfs; > char *p; > @@ -494,7 +496,7 @@ get_filesys_stats(struct smap *stats OVS_UNUSED) > smap_add(stats, "file_systems", ds_cstr(&s)); > } > ds_destroy(&s); > -#endif /* HAVE_SETMNTENT && HAVE_STATVFS */ > +#endif /* HAVE_GETMNTENT_R && HAVE_STATVFS */ > } > > #define SYSTEM_STATS_INTERVAL (5 * 1000) /* In milliseconds. */ > -- > 1.7.2.5 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev >
_______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev