2012-09-22 Paul Eggert <eggert@cs.ucla.edu>
+ fchmodat, fchownat, fstatat: use extern-inline
+ * lib/fchmodat.c, lib/openat.h (FCHMODAT_INLINE):
+ * lib/fchownat.c, lib/openat.h (FCHOWNAT_INLINE):
+ * lib/fstatat.c, lib/openat.h (FSTATAT_INLINE):
+ New macros.
+ * lib/openat.h:
+ Replace all uses of 'static inline' with them.
+ Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END.
+ * modules/fchmodat, modules/fchownat, modules/fstatat:
+ * modules/openat-h:
+ (Depends-on):
+ Add extern-inline.
+ (configure.ac): Remove AC_C_INLINE.
+
acl, mbchar, priv-set: use extern-inline
* lib/set-mode-acl.c, lib/acl-internal.h (ACL_INTERNAL_INLINE):
* lib/mbchar.c, lib/mbchar.h (MBCHAR_INLINE):
#include <config.h>
+#include FCHMODAT_INLINE _GL_EXTERN_INLINE
+
#include <sys/stat.h>
#include <errno.h>
#include <config.h>
+#include FCHOWNAT_INLINE _GL_EXTERN_INLINE
+
#include <unistd.h>
#include <errno.h>
#define __need_system_sys_stat_h
#include <config.h>
+#include FSTATAT_INLINE _GL_EXTERN_INLINE
+
/* Get the original definition of fstatat. It might be defined as a macro. */
#include <sys/types.h>
#include <sys/stat.h>
#undef __need_system_sys_stat_h
#if HAVE_FSTATAT
-static inline int
+static int
orig_fstatat (int fd, char const *filename, struct stat *buf, int flags)
{
return fstatat (fd, filename, buf, flags);
because the preprocessor sees a use of a macro that requires two
arguments but is only given one. Hence, we need an inline
forwarder to get past the preprocessor. */
-static inline int
+static int
stat_func (char const *name, struct stat *st)
{
return stat (name, st);
#include <unistd.h>
#include <stdbool.h>
+_GL_INLINE_HEADER_BEGIN
+
#if !HAVE_OPENAT
int openat_permissive (int fd, char const *file, int flags, mode_t mode,
#if GNULIB_FCHOWNAT
-static inline int
+# ifndef FCHOWNAT_INLINE
+# define FCHOWNAT_INLINE _GL_INLINE
+# endif
+
+FCHOWNAT_INLINE int
chownat (int fd, char const *file, uid_t owner, gid_t group)
{
return fchownat (fd, file, owner, group, 0);
}
-static inline int
+FCHOWNAT_INLINE int
lchownat (int fd, char const *file, uid_t owner, gid_t group)
{
return fchownat (fd, file, owner, group, AT_SYMLINK_NOFOLLOW);
#if GNULIB_FCHMODAT
-static inline int
+# ifndef FCHMODAT_INLINE
+# define FCHMODAT_INLINE _GL_INLINE
+# endif
+
+FCHMODAT_INLINE int
chmodat (int fd, char const *file, mode_t mode)
{
return fchmodat (fd, file, mode, 0);
}
-static inline int
+FCHMODAT_INLINE int
lchmodat (int fd, char const *file, mode_t mode)
{
return fchmodat (fd, file, mode, AT_SYMLINK_NOFOLLOW);
#if GNULIB_FSTATAT
-static inline int
+# ifndef FSTATAT_INLINE
+# define FSTATAT_INLINE _GL_INLINE
+# endif
+
+FSTATAT_INLINE int
statat (int fd, char const *name, struct stat *st)
{
return fstatat (fd, name, st, 0);
}
-static inline int
+FSTATAT_INLINE int
lstatat (int fd, char const *name, struct stat *st)
{
return fstatat (fd, name, st, AT_SYMLINK_NOFOLLOW);
wrappers are not provided for accessat or euidaccessat, so as to
avoid dragging in -lgen on some platforms. */
+_GL_INLINE_HEADER_END
+
#endif /* _GL_HEADER_OPENAT */
at-internal [test $HAVE_FCHMODAT = 0]
dosname [test $HAVE_FCHMODAT = 0]
errno [test $HAVE_FCHMODAT = 0]
+extern-inline [test $HAVE_FCHMODAT = 0]
fchdir [test $HAVE_FCHMODAT = 0]
fcntl-h [test $HAVE_FCHMODAT = 0]
openat-die [test $HAVE_FCHMODAT = 0]
if test $HAVE_FCHMODAT = 0; then
AC_LIBOBJ([fchmodat])
fi
-AC_REQUIRE([AC_C_INLINE]) dnl because 'inline' is used in lib/openat.h
gl_MODULE_INDICATOR([fchmodat]) dnl for lib/openat.h
gl_SYS_STAT_MODULE_INDICATOR([fchmodat])
at-internal [test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1]
dosname [test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1]
errno [test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1]
+extern-inline [test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1]
fchdir [test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1]
fcntl-h [test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1]
lchown [test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1]
if test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1; then
AC_LIBOBJ([fchownat])
fi
-AC_REQUIRE([AC_C_INLINE]) dnl because 'inline' is used in lib/openat.h
gl_MODULE_INDICATOR([fchownat]) dnl for lib/openat.h
gl_UNISTD_MODULE_INDICATOR([fchownat])
at-internal [test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1]
dosname [test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1]
errno [test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1]
+extern-inline [test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1]
fchdir [test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1]
fcntl-h [test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1]
lstat [test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1]
if test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1; then
AC_LIBOBJ([fstatat])
fi
-AC_REQUIRE([AC_C_INLINE]) dnl because 'inline' is used in lib/openat.h
gl_MODULE_INDICATOR([fstatat]) dnl for lib/openat.h
gl_SYS_STAT_MODULE_INDICATOR([fstatat])
lib/openat.h
Depends-on:
+extern-inline
fcntl-h
stdbool
sys_stat