1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

rely on sys/inotify.h for inotify

sys/inotify.h was added to glibc 2.4 in 2006.

Signed-off-by: Jeremy Allison <jra@samba.org>

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Fri Apr 13 21:15:00 CEST 2012 on sn-devel-104
This commit is contained in:
Adrian Bunk 2012-04-09 21:16:12 +03:00 committed by Jeremy Allison
parent 1a8405c320
commit 55cbf7ba34
5 changed files with 11 additions and 94 deletions

View File

@ -2565,19 +2565,10 @@ if test x"$samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" = x"yes"; then
AC_DEFINE(HAVE_KERNEL_CHANGE_NOTIFY,1,[Whether kernel notifies changes]) AC_DEFINE(HAVE_KERNEL_CHANGE_NOTIFY,1,[Whether kernel notifies changes])
fi fi
AC_CACHE_CHECK([for inotify support],samba_cv_HAVE_INOTIFY,[ AC_CHECK_HEADER(sys/inotify.h)
AC_CHECK_HEADERS(linux/inotify.h asm/unistd.h sys/inotify.h)
AC_CHECK_FUNCS(inotify_init)
AC_HAVE_DECL(__NR_inotify_init, [#include <asm/unistd.h>])
],
samba_cv_HAVE_INOTIFY=yes,
samba_cv_HAVE_INOTIFY=no,
samba_cv_HAVE_INOTIFY=cross)
if test x"$ac_cv_func_inotify_init" = x"yes"; then if test x"ac_cv_header_sys_inotify_h" = x"yes"; then
if test x"$ac_cv_header_sys_inotify_h" = x"yes" -o x"$ac_cv_header_linux_inotify_h" = x"yes"; then AC_DEFINE(HAVE_INOTIFY,1,[For inotify support])
AC_DEFINE(HAVE_INOTIFY,1,[Whether kernel or sys has inotify support])
fi
fi fi
################################################# #################################################

View File

@ -27,45 +27,9 @@
#ifdef HAVE_INOTIFY #ifdef HAVE_INOTIFY
#if HAVE_SYS_INOTIFY_H
#include <sys/inotify.h>
#else
#ifdef HAVE_ASM_TYPES_H
#include <asm/types.h>
#endif
#ifndef HAVE_INOTIFY_INIT
#include <linux/inotify.h>
#include <asm/unistd.h>
/*
glibc doesn't define these functions yet (as of March 2006)
*/
static int inotify_init(void)
{
return syscall(__NR_inotify_init);
}
static int inotify_add_watch(int fd, const char *path, __u32 mask)
{
return syscall(__NR_inotify_add_watch, fd, path, mask);
}
static int inotify_rm_watch(int fd, int wd)
{
return syscall(__NR_inotify_rm_watch, fd, wd);
}
#else
#include <sys/inotify.h> #include <sys/inotify.h>
#endif /* glibc < 2.5 headers don't have these defines */
#endif
/* older glibc headers don't have these defines either */
#ifndef IN_ONLYDIR #ifndef IN_ONLYDIR
#define IN_ONLYDIR 0x01000000 #define IN_ONLYDIR 0x01000000
#endif #endif

View File

@ -115,11 +115,9 @@ long ret = splice(0,0,1,0,400,0);
conf.CHECK_DECLS('splice', reverse=True, headers='fcntl.h') conf.CHECK_DECLS('splice', reverse=True, headers='fcntl.h')
# Check for inotify support # Check for inotify support
conf.CHECK_HEADERS('linux/inotify.h asm/unistd.h sys/inotify.h') conf.CHECK_HEADERS('sys/inotify.h')
conf.CHECK_FUNCS('inotify_init') if "HAVE_SYS_INOTIFY_H" in conf.env:
if "HAVE_INOTIFY_INIT" in conf.env: conf.DEFINE('HAVE_INOTIFY', 1)
if "HAVE_LINUX_INOTIFY_H" in conf.env or "HAVE_SYS_INOTIFY_H" in conf.env:
conf.DEFINE('HAVE_INOTIFY', 1)
# Check for kernel change notify support # Check for kernel change notify support
conf.CHECK_CODE(''' conf.CHECK_CODE('''
@ -255,7 +253,7 @@ getcwd _getcwd __getcwd getdents __getdents getdirentries
getgrent getgrnam getgrouplist getgrset getmntent getpagesize getgrent getgrnam getgrouplist getgrset getmntent getpagesize
getproplist get_proplist_entry getpwanam getpwent_r getrlimit gettext getproplist get_proplist_entry getpwanam getpwent_r getrlimit gettext
glob grantpt hstrerror initgroups innetgr glob grantpt hstrerror initgroups innetgr
inotify_init listea listxattr listea listxattr
llseek _llseek __llseek _lseek __lseek llseek _llseek __llseek _lseek __lseek
_lstat __lstat lutimes _lstat __lstat lutimes
__lxstat memalign mknod mlock mlockall munlock munlockall __lxstat memalign mknod mlock mlockall munlock munlockall
@ -1044,8 +1042,6 @@ ssize_t err = posix_fadvise(0,0,0x80000,POSIX_FADV_WILLNEED);
'SYSCONF%s' % v, 'SYSCONF%s' % v,
msg='Checking whether sysconf(%s) is available' % v) msg='Checking whether sysconf(%s) is available' % v)
conf.CHECK_DECLS('__NR_inotify_init', reverse=True, headers='asm/unistd.h')
conf.CHECK_CODE(''' conf.CHECK_CODE('''
#include <sys/syscall.h> #include <sys/syscall.h>
#include <unistd.h> #include <unistd.h>

View File

@ -29,36 +29,9 @@
#include "libcli/raw/smb.h" #include "libcli/raw/smb.h"
#include "param/param.h" #include "param/param.h"
#if HAVE_SYS_INOTIFY_H
#include <sys/inotify.h> #include <sys/inotify.h>
#else
/* for older glibc varients - we can remove this eventually */
#include <linux/inotify.h>
#include <asm/unistd.h>
#ifndef HAVE_INOTIFY_INIT /* glibc < 2.5 headers don't have these defines */
/*
glibc doesn't define these functions yet (as of March 2006)
*/
static int inotify_init(void)
{
return syscall(__NR_inotify_init);
}
static int inotify_add_watch(int fd, const char *path, __u32 mask)
{
return syscall(__NR_inotify_add_watch, fd, path, mask);
}
static int inotify_rm_watch(int fd, int wd)
{
return syscall(__NR_inotify_rm_watch, fd, wd);
}
#endif
#endif
/* older glibc headers don't have these defines either */
#ifndef IN_ONLYDIR #ifndef IN_ONLYDIR
#define IN_ONLYDIR 0x01000000 #define IN_ONLYDIR 0x01000000
#endif #endif

View File

@ -1,16 +1,9 @@
#!/usr/bin/env python #!/usr/bin/env python
conf.CHECK_HEADERS('linux/inotify.h asm/unistd.h sys/inotify.h', add_headers=False) conf.CHECK_HEADERS('sys/inotify.h', add_headers=False)
conf.CHECK_FUNCS('inotify_init')
conf.CHECK_VARIABLE('__NR_inotify_init')
conf.CHECK_DECLS('F_SETLEASE', headers='linux/fcntl.h', reverse=True) conf.CHECK_DECLS('F_SETLEASE', headers='linux/fcntl.h', reverse=True)
conf.CHECK_DECLS('SA_SIGINFO', headers='signal.h', reverse=True) conf.CHECK_DECLS('SA_SIGINFO', headers='signal.h', reverse=True)
conf.CHECK_DECLS('__NR_inotify_init', reverse=True, headers='asm/unistd.h') if (conf.CONFIG_SET('HAVE_SYS_INOTIFY_H')):
if (conf.CONFIG_SET('HAVE___NR_INOTIFY_INIT') and
(conf.CONFIG_SET('HAVE_LINUX_INOTIFY_H') or
conf.CONFIG_SET('HAVE_SYS_INOTIFY_H'))):
conf.DEFINE('HAVE_LINUX_INOTIFY', 1) conf.DEFINE('HAVE_LINUX_INOTIFY', 1)