bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: declare getloadavg in stdlib.h


From: Jim Meyering
Subject: Re: declare getloadavg in stdlib.h
Date: Sun, 19 Oct 2008 08:49:30 +0200

Bruno Haible <address@hidden> wrote:

> Hi Jim,
>
> We have been adopting the approach to declare functions provided by glibc
> (but not specified by POSIX) in the same header file as glibc does. This
> makes sense because most development takes place on glibc systems today.
>
> The ones that not yet follow this idiom:
>   - getloadavg, getusershell - not declared by any gnulib header file,
>   - euidaccess.h, dirfd.h, isnanl.h, lchmod.h, getdomainname.h: declared
>     by gnulib but not in the same header file as in glibc.
>
> Here's first a proposed patch for getloadavg. glibc declares it in <stdlib.h>.
>
> 2008-10-18  Bruno Haible  <address@hidden>
>
>       * lib/stdlib.in.h; Include <sys/loadavg.h> when needed for the
>       getloadavg declaration.
>       (getloadavg): New declaration.
>       * lib/getloadavg.c: Include <stdlib.h> first.
>       * m4/getloadavg.m4 (gl_GETLOADAVG): Require gl_STDLIB_H_DEFAULTS.
>       Test whether sys/loadavg.h exists. Set HAVE_SYS_LOADAVG_H and
>       HAVE_DECL_GETLOADAVG.
>       * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize GNULIB_GETLOADAVG,
>       HAVE_SYS_LOADAVG_H, HAVE_DECL_GETLOADAVG.
>       * modules/getloadavg (Depends-on): Add stdlib.
>       (configure.ac): Invoke gl_STDLIB_MODULE_INDICATOR.
>       (Include): Specify <stdlib.h>.
>       * modules/stdlib (Makefile.am): Substitute GNULIB_GETLOADAVG,
>       HAVE_SYS_LOADAVG_H, HAVE_DECL_GETLOADAVG.

These changes (and the others you've posted) all sound fine.
The only question is whether to remove the header files
at the same time -- or later.

Personally, I'd prefer to remove them now, because
I'm going to remove references to them right away,
and if they remain, I'll have to take the trouble
(albeit minimal) to ensure no unwanted use sneaks back in,
by adding a syntax-check rule that does something like this:

  grep -E '^#include "(euidaccess|dirfd|lchmod|isnanl|getdomainname)\.h'

However, I assume in delaying, your goal is to minimize disruption
for other gnulib clients.  No big deal.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]