Re: [PATCH] emulate dirfd when necessary

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

 



On Thu, Jan 20, 2011 at 06:50:03PM -0500, Mike Frysinger wrote:
> On Thursday, January 20, 2011 18:45:28 Karel Zak wrote:
> > On Tue, Jan 18, 2011 at 05:47:01PM +0100, Fabian Groffen wrote:
> > > +have_dirfd=
> > > +AC_MSG_CHECKING([for dirfd])
> > > +AC_LINK_IFELSE([AC_LANG_PROGRAM([[
> > > +#include <dirent.h>
> > > +]],[[
> > > +	DIR *dir = 0;
> > > +	if (dirfd(dir)) ;
> > > +]])], [have_dirfd=yes], [have_dirfd=no])
> > > +AC_MSG_RESULT([$have_dirfd])
> > 
> >  What about:
> > 
> >  AC_CHECK_FUNCS(dirfd)
> >  AC_CHECK_DECLS([dirfd], , ,
> >          [#include <sys/types.h>
> >           #include <dirent.h>])
> 
> i think macros would confuse these checks ?

AC_CHECK_FUNCS generates:

 #undef dirfd
 char dirfd ();
 int
 main ()
 {
 return dirfd ();
   ;
   return 0;
 }

AC_CHECK_DECLS generates:

 int
 main ()
 {
 #ifndef dirfd
 #ifdef __cplusplus
   (void) dirfd;
 #else
   (void) dirfd;
 #endif
 #endif
 }

 BTW gnulib has dirfd.m4, but it seems like overkill for us.

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux