diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2014-05-13 10:52:30 -0400 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2014-05-13 10:53:21 -0400 |
commit | 47ef6b2c66048f898d22c8dddee581d3f55a48c8 (patch) | |
tree | 98a5fca0e1b6f24e96ed0ded76aa1d9b0a00c740 | |
parent | a19b50448ac6f99ddbc3cfabd61c141192308257 (diff) |
src/libudev/missing.h: clean up and fix build on uclibc and musl
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/libudev/missing.h | 176 | ||||
-rw-r--r-- | src/libudev/util.h | 1 |
3 files changed, 7 insertions, 172 deletions
diff --git a/configure.ac b/configure.ac index 61fabe8d10..1ed3aa1ea7 100644 --- a/configure.ac +++ b/configure.ac @@ -60,7 +60,7 @@ AC_C_INLINE AC_TYPE_MODE_T AC_TYPE_PID_T AC_CHECK_MEMBERS([struct stat.st_rdev]) -AC_CHECK_DECLS([gettid, pivot_root, name_to_handle_at, accept4, mkostemp], [], [], [[#include <sys/types.h> +AC_CHECK_DECLS([gettid, name_to_handle_at, accept4, mkostemp], [], [], [[#include <sys/types.h> #include <unistd.h> #include <sys/mount.h> #include <fcntl.h> diff --git a/src/libudev/missing.h b/src/libudev/missing.h index a2ca518948..cb97c93a6c 100644 --- a/src/libudev/missing.h +++ b/src/libudev/missing.h @@ -30,11 +30,8 @@ #include <unistd.h> #include <linux/oom.h> -#ifdef HAVE_AUDIT -#include <libaudit.h> -#endif - #include "macro.h" +#include "config.h" #ifdef ARCH_MIPS #include <asm/sgidefs.h> @@ -44,173 +41,18 @@ #define RLIMIT_RTTIME 15 #endif -#ifndef F_LINUX_SPECIFIC_BASE -#define F_LINUX_SPECIFIC_BASE 1024 -#endif - -#ifndef F_SETPIPE_SZ -#define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7) -#endif - -#ifndef F_GETPIPE_SZ -#define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8) -#endif - -#ifndef IP_FREEBIND -#define IP_FREEBIND 15 -#endif - -#ifndef OOM_SCORE_ADJ_MIN -#define OOM_SCORE_ADJ_MIN (-1000) -#endif - -#ifndef OOM_SCORE_ADJ_MAX -#define OOM_SCORE_ADJ_MAX 1000 -#endif - -#ifndef AUDIT_SERVICE_START -#define AUDIT_SERVICE_START 1130 /* Service (daemon) start */ -#endif - -#ifndef AUDIT_SERVICE_STOP -#define AUDIT_SERVICE_STOP 1131 /* Service (daemon) stop */ -#endif - -#ifndef TIOCVHANGUP -#define TIOCVHANGUP 0x5437 -#endif - -#ifndef IP_TRANSPARENT -#define IP_TRANSPARENT 19 -#endif - -#if !HAVE_DECL_PIVOT_ROOT -static inline int pivot_root(const char *new_root, const char *put_old) { - return syscall(SYS_pivot_root, new_root, put_old); -} -#endif - -#ifdef __x86_64__ -# ifndef __NR_fanotify_init -# define __NR_fanotify_init 300 -# endif -# ifndef __NR_fanotify_mark -# define __NR_fanotify_mark 301 -# endif -#elif defined _MIPS_SIM -# if _MIPS_SIM == _MIPS_SIM_ABI32 -# ifndef __NR_fanotify_init -# define __NR_fanotify_init 4336 -# endif -# ifndef __NR_fanotify_mark -# define __NR_fanotify_mark 4337 -# endif -# elif _MIPS_SIM == _MIPS_SIM_NABI32 -# ifndef __NR_fanotify_init -# define __NR_fanotify_init 6300 -# endif -# ifndef __NR_fanotify_mark -# define __NR_fanotify_mark 6301 -# endif -# elif _MIPS_SIM == _MIPS_SIM_ABI64 -# ifndef __NR_fanotify_init -# define __NR_fanotify_init 5295 -# endif -# ifndef __NR_fanotify_mark -# define __NR_fanotify_mark 5296 -# endif -# endif -#else -# ifndef __NR_fanotify_init -# define __NR_fanotify_init 338 -# endif -# ifndef __NR_fanotify_mark -# define __NR_fanotify_mark 339 -# endif -#endif - -#ifndef HAVE_FANOTIFY_INIT -static inline int fanotify_init(unsigned int flags, unsigned int event_f_flags) { - return syscall(__NR_fanotify_init, flags, event_f_flags); -} -#endif - -#ifndef HAVE_FANOTIFY_MARK -static inline int fanotify_mark(int fanotify_fd, unsigned int flags, uint64_t mask, - int dfd, const char *pathname) { -#if defined _MIPS_SIM && _MIPS_SIM == _MIPS_SIM_ABI32 || defined __powerpc__ && !defined __powerpc64__ \ - || defined __arm__ && !defined __aarch64__ - union { - uint64_t _64; - uint32_t _32[2]; - } _mask; - _mask._64 = mask; - - return syscall(__NR_fanotify_mark, fanotify_fd, flags, - _mask._32[0], _mask._32[1], dfd, pathname); -#else - return syscall(__NR_fanotify_mark, fanotify_fd, flags, mask, dfd, pathname); -#endif -} -#endif - -#ifndef BTRFS_IOCTL_MAGIC -#define BTRFS_IOCTL_MAGIC 0x94 -#endif - -#ifndef BTRFS_PATH_NAME_MAX -#define BTRFS_PATH_NAME_MAX 4087 -#endif - -struct btrfs_ioctl_vol_args { - int64_t fd; - char name[BTRFS_PATH_NAME_MAX + 1]; -}; - -#ifndef BTRFS_IOC_DEFRAG -#define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, struct btrfs_ioctl_vol_args) -#endif - -#ifndef BTRFS_SUPER_MAGIC -#define BTRFS_SUPER_MAGIC 0x9123683E -#endif - -#ifndef MS_MOVE -#define MS_MOVE 8192 -#endif - #ifndef MS_PRIVATE #define MS_PRIVATE (1 << 18) #endif -#if !HAVE_DECL_GETTID -static inline pid_t gettid(void) { - return (pid_t) syscall(SYS_gettid); -} -#endif - -#ifndef SCM_SECURITY -#define SCM_SECURITY 0x03 -#endif - -#ifndef MS_STRICTATIME -#define MS_STRICTATIME (1<<24) -#endif - #ifndef MS_REC #define MS_REC 16384 #endif -#ifndef MS_SHARED -#define MS_SHARED (1<<20) -#endif - -#ifndef PR_SET_NO_NEW_PRIVS -#define PR_SET_NO_NEW_PRIVS 38 -#endif - -#ifndef PR_SET_CHILD_SUBREAPER -#define PR_SET_CHILD_SUBREAPER 36 +#if !HAVE_DECL_GETTID +static inline pid_t gettid(void) { + return (pid_t) syscall(SYS_gettid); +} #endif #ifndef MAX_HANDLE_SZ @@ -250,11 +92,3 @@ static inline int name_to_handle_at(int fd, const char *name, struct file_handle return syscall(__NR_name_to_handle_at, fd, name, handle, mnt_id, flags); } #endif - -#ifndef CIFS_MAGIC_NUMBER -#define CIFS_MAGIC_NUMBER 0xFF534D42 -#endif - -#ifndef TFD_TIMER_CANCEL_ON_SET -#define TFD_TIMER_CANCEL_ON_SET (1 << 1) -#endif diff --git a/src/libudev/util.h b/src/libudev/util.h index 4efa4e062a..4e0f310889 100644 --- a/src/libudev/util.h +++ b/src/libudev/util.h @@ -33,6 +33,7 @@ #include <sys/socket.h> #include "macro.h" +#include "missing.h" union dirent_storage { struct dirent de; |