2012-11-29 Paul Eggert <eggert@cs.ucla.edu>
+ selinux-h: better 'inline'
+ * lib/se-context.c, lib/se-selinux.c: New files.
+ * lib/getfilecon.c (map_to_failure): Omit 'inline' for static function.
+ * lib/se-context.in.h (SE_CONTEXT_INLINE):
+ New macro. Replace all uses of 'static inline' with it.
+ Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END.
+ * lib/se-selinux.in.h (SE_SELINUX_INLINE):
+ New macro. Replace all uses of 'static inline' with it.
+ Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END.
+ * modules/selinux-h (Files, lib_SOURCES):
+ Add lib/se-context.c, lib/se-selinux.c.
+ (Depends-on): Add extern-inline.
+ (configure.ac): Do not require AC_C_INLINE.
+
pthread: better 'inline'
* lib/pthread.c: New file.
* lib/pthread.in.h (_GL_PTHREAD_INLINE):
# include <errno.h>
+_GL_INLINE_HEADER_BEGIN
+#ifndef SE_CONTEXT_INLINE
+# define SE_CONTEXT_INLINE _GL_INLINE
+#endif
+
/* The definition of _GL_UNUSED_PARAMETER is copied here. */
typedef int context_t;
-static inline context_t context_new (char const *s _GL_UNUSED_PARAMETER)
+SE_CONTEXT_INLINE context_t context_new (char const *s _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return 0; }
-static inline char *context_str (context_t con _GL_UNUSED_PARAMETER)
+SE_CONTEXT_INLINE char *context_str (context_t con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return (void *) 0; }
-static inline void context_free (context_t c _GL_UNUSED_PARAMETER) {}
+SE_CONTEXT_INLINE void context_free (context_t c _GL_UNUSED_PARAMETER) {}
-static inline int context_user_set (context_t sc _GL_UNUSED_PARAMETER,
- char const *s _GL_UNUSED_PARAMETER)
+SE_CONTEXT_INLINE int context_user_set (context_t sc _GL_UNUSED_PARAMETER,
+ char const *s _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline int context_role_set (context_t sc _GL_UNUSED_PARAMETER,
- char const *s _GL_UNUSED_PARAMETER)
+SE_CONTEXT_INLINE int context_role_set (context_t sc _GL_UNUSED_PARAMETER,
+ char const *s _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline int context_range_set (context_t sc _GL_UNUSED_PARAMETER,
- char const *s _GL_UNUSED_PARAMETER)
+SE_CONTEXT_INLINE int context_range_set (context_t sc _GL_UNUSED_PARAMETER,
+ char const *s _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline int context_type_set (context_t sc _GL_UNUSED_PARAMETER,
- char const *s _GL_UNUSED_PARAMETER)
+SE_CONTEXT_INLINE int context_type_set (context_t sc _GL_UNUSED_PARAMETER,
+ char const *s _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
+_GL_INLINE_HEADER_END
+
#endif
# include <sys/types.h>
# include <errno.h>
+_GL_INLINE_HEADER_BEGIN
+# ifndef SE_SELINUX_INLINE
+# define SE_SELINUX_INLINE _GL_INLINE
+# endif
+
/* The definition of _GL_UNUSED_PARAMETER is copied here. */
# if !GNULIB_defined_security_types
# define security_context_t char*
# define is_selinux_enabled() 0
-static inline int getcon (security_context_t *con _GL_UNUSED_PARAMETER)
+SE_SELINUX_INLINE int
+getcon (security_context_t *con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline void freecon (security_context_t con _GL_UNUSED_PARAMETER) {}
+SE_SELINUX_INLINE void
+freecon (security_context_t con _GL_UNUSED_PARAMETER) {}
-
-static inline int getfscreatecon (security_context_t *con _GL_UNUSED_PARAMETER)
+SE_SELINUX_INLINE int
+getfscreatecon (security_context_t *con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline int setfscreatecon (security_context_t con _GL_UNUSED_PARAMETER)
+SE_SELINUX_INLINE int
+setfscreatecon (security_context_t con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline int matchpathcon (char const *file _GL_UNUSED_PARAMETER,
- mode_t m _GL_UNUSED_PARAMETER,
- security_context_t *con _GL_UNUSED_PARAMETER)
+SE_SELINUX_INLINE int
+matchpathcon (char const *file _GL_UNUSED_PARAMETER,
+ mode_t m _GL_UNUSED_PARAMETER,
+ security_context_t *con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline int getfilecon (char const *file _GL_UNUSED_PARAMETER,
- security_context_t *con _GL_UNUSED_PARAMETER)
+SE_SELINUX_INLINE int
+getfilecon (char const *file _GL_UNUSED_PARAMETER,
+ security_context_t *con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline int lgetfilecon (char const *file _GL_UNUSED_PARAMETER,
- security_context_t *con _GL_UNUSED_PARAMETER)
+SE_SELINUX_INLINE int
+lgetfilecon (char const *file _GL_UNUSED_PARAMETER,
+ security_context_t *con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline int fgetfilecon (int fd,
- security_context_t *con _GL_UNUSED_PARAMETER)
+SE_SELINUX_INLINE int
+fgetfilecon (int fd, security_context_t *con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline int setfilecon (char const *file _GL_UNUSED_PARAMETER,
- security_context_t con _GL_UNUSED_PARAMETER)
+SE_SELINUX_INLINE int
+setfilecon (char const *file _GL_UNUSED_PARAMETER,
+ security_context_t con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline int lsetfilecon (char const *file _GL_UNUSED_PARAMETER,
- security_context_t con _GL_UNUSED_PARAMETER)
+SE_SELINUX_INLINE int
+lsetfilecon (char const *file _GL_UNUSED_PARAMETER,
+ security_context_t con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline int fsetfilecon (int fd _GL_UNUSED_PARAMETER,
- security_context_t con _GL_UNUSED_PARAMETER)
+SE_SELINUX_INLINE int
+fsetfilecon (int fd _GL_UNUSED_PARAMETER,
+ security_context_t con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline int security_check_context
- (security_context_t con _GL_UNUSED_PARAMETER)
+SE_SELINUX_INLINE int
+security_check_context (security_context_t con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline int security_check_context_raw
- (security_context_t con _GL_UNUSED_PARAMETER)
+SE_SELINUX_INLINE int
+security_check_context_raw (security_context_t con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline int setexeccon (security_context_t con _GL_UNUSED_PARAMETER)
+SE_SELINUX_INLINE int
+setexeccon (security_context_t con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline int security_compute_create
- (security_context_t scon _GL_UNUSED_PARAMETER,
- security_context_t tcon _GL_UNUSED_PARAMETER,
- security_class_t tclass _GL_UNUSED_PARAMETER,
- security_context_t *newcon _GL_UNUSED_PARAMETER)
+SE_SELINUX_INLINE int
+security_compute_create (security_context_t scon _GL_UNUSED_PARAMETER,
+ security_context_t tcon _GL_UNUSED_PARAMETER,
+ security_class_t tclass _GL_UNUSED_PARAMETER,
+ security_context_t *newcon _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline int matchpathcon_init_prefix
- (char const *path _GL_UNUSED_PARAMETER,
- char const *prefix _GL_UNUSED_PARAMETER)
+SE_SELINUX_INLINE int
+matchpathcon_init_prefix (char const *path _GL_UNUSED_PARAMETER,
+ char const *prefix _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
# define GNULIB_defined_security_types 1
# endif
+_GL_INLINE_HEADER_BEGIN
+
# endif
#endif /* _@GUARD_PREFIX@_SELINUX_SELINUX_H */