diff options
| author | Michael Adam <obnox@samba.org> | 2011-11-25 16:36:40 +0100 |
|---|---|---|
| committer | Michael Adam <obnox@samba.org> | 2011-11-26 00:34:54 +0100 |
| commit | 2c0abf2dcf040e6e32612e65f04ff488745612ae (patch) | |
| tree | d2c86b044dd2727e469f65e66bca49fe958d6b66 /ctdb/lib/replace/system | |
| parent | 5d94dff27e96e09e1f81d4811ce1e2492edff13f (diff) | |
update lib/replace to current upstream version (samba master)
(This used to be ctdb commit 17bcffab19fdbb435b4745ff90c327342bbbf0f8)
Diffstat (limited to 'ctdb/lib/replace/system')
| -rw-r--r-- | ctdb/lib/replace/system/config.m4 | 61 | ||||
| -rw-r--r-- | ctdb/lib/replace/system/filesys.h | 37 | ||||
| -rw-r--r-- | ctdb/lib/replace/system/kerberos.h | 123 | ||||
| -rw-r--r-- | ctdb/lib/replace/system/locale.h | 4 | ||||
| -rw-r--r-- | ctdb/lib/replace/system/network.h | 117 | ||||
| -rw-r--r-- | ctdb/lib/replace/system/passwd.h | 31 | ||||
| -rw-r--r-- | ctdb/lib/replace/system/readline.h | 8 | ||||
| -rw-r--r-- | ctdb/lib/replace/system/select.h | 36 | ||||
| -rw-r--r-- | ctdb/lib/replace/system/time.h | 37 | ||||
| -rw-r--r-- | ctdb/lib/replace/system/wait.h | 12 | ||||
| -rw-r--r-- | ctdb/lib/replace/system/wscript_configure | 26 |
11 files changed, 344 insertions, 148 deletions
diff --git a/ctdb/lib/replace/system/config.m4 b/ctdb/lib/replace/system/config.m4 index 799187af7d..b7cdf1414a 100644 --- a/ctdb/lib/replace/system/config.m4 +++ b/ctdb/lib/replace/system/config.m4 @@ -1,14 +1,29 @@ # filesys AC_HEADER_DIRENT AC_CHECK_HEADERS(fcntl.h sys/fcntl.h sys/resource.h sys/ioctl.h sys/mode.h sys/filio.h sys/fs/s5param.h sys/filsys.h) -AC_CHECK_HEADERS(sys/acl.h acl/libacl.h) +AC_CHECK_HEADERS(sys/acl.h acl/libacl.h sys/file.h) # select AC_CHECK_HEADERS(sys/select.h) +# poll +AC_CHECK_HEADERS(poll.h) +AC_CHECK_FUNCS(poll,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/poll.o"]) + # time AC_CHECK_HEADERS(sys/time.h utime.h) AC_HEADER_TIME +AC_CHECK_FUNCS(utime utimes) + +AC_CACHE_CHECK([if gettimeofday takes TZ argument],libreplace_cv_HAVE_GETTIMEOFDAY_TZ,[ +AC_TRY_RUN([ +#include <sys/time.h> +#include <unistd.h> +main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}], + libreplace_cv_HAVE_GETTIMEOFDAY_TZ=yes,libreplace_cv_HAVE_GETTIMEOFDAY_TZ=no,libreplace_cv_HAVE_GETTIMEOFDAY_TZ=yes)]) +if test x"$libreplace_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then + AC_DEFINE(HAVE_GETTIMEOFDAY_TZ,1,[Whether gettimeofday() is available]) +fi # wait AC_HEADER_SYS_WAIT @@ -18,7 +33,7 @@ AC_CHECK_HEADERS(sys/capability.h) case "$host_os" in *linux*) -AC_CACHE_CHECK([for broken RedHat 7.2 system header files],samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[ +AC_CACHE_CHECK([for broken RedHat 7.2 system header files],libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[ AC_TRY_COMPILE([ #ifdef HAVE_SYS_VFS_H #include <sys/vfs.h> @@ -29,14 +44,14 @@ AC_TRY_COMPILE([ ],[ int i; ], - samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no, - samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes + libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no, + libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes )]) -if test x"$samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then +if test x"$libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS,1,[Broken RedHat 7.2 system header files]) fi -AC_CACHE_CHECK([for broken RHEL5 sys/capability.h],samba_cv_BROKEN_RHEL5_SYS_CAP_HEADER,[ +AC_CACHE_CHECK([for broken RHEL5 sys/capability.h],libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER,[ AC_TRY_COMPILE([ #ifdef HAVE_SYS_CAPABILITY_H #include <sys/capability.h> @@ -45,10 +60,10 @@ AC_TRY_COMPILE([ ],[ __s8 i; ], - samba_cv_BROKEN_RHEL5_SYS_CAP_HEADER=no, - samba_cv_BROKEN_RHEL5_SYS_CAP_HEADER=yes + libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER=no, + libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER=yes )]) -if test x"$samba_cv_BROKEN_RHEL5_SYS_CAP_HEADER" = x"yes"; then +if test x"$libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER" = x"yes"; then AC_DEFINE(BROKEN_RHEL5_SYS_CAP_HEADER,1,[Broken RHEL5 sys/capability.h]) fi ;; @@ -73,6 +88,18 @@ AC_VERIFY_C_PROTOTYPE([struct passwd *getpwent_r(struct passwd *src, char *buf, #include <unistd.h> #include <pwd.h> ]) +AC_VERIFY_C_PROTOTYPE([struct passwd *getpwent_r(struct passwd *src, char *buf, size_t buflen)], + [ + #ifndef HAVE_GETPWENT_R_DECL + #error missing getpwent_r prototype + #endif + return NULL; + ],[ + AC_DEFINE(SOLARIS_GETPWENT_R, 1, [getpwent_r irix (similar to solaris) function prototype]) + ],[],[ + #include <unistd.h> + #include <pwd.h> + ]) AC_CHECK_FUNCS(getgrnam_r getgrgid_r getgrent_r) AC_HAVE_DECL(getgrent_r, [ #include <unistd.h> @@ -91,8 +118,22 @@ AC_VERIFY_C_PROTOTYPE([struct group *getgrent_r(struct group *src, char *buf, in #include <grp.h> ]) +AC_VERIFY_C_PROTOTYPE([struct group *getgrent_r(struct group *src, char *buf, size_t buflen)], + [ + #ifndef HAVE_GETGRENT_R_DECL + #error missing getgrent_r prototype + #endif + return NULL; + ],[ + AC_DEFINE(SOLARIS_GETGRENT_R, 1, [getgrent_r irix (similar to solaris) function prototype]) + ],[],[ + #include <unistd.h> + #include <grp.h> + ]) +AC_CHECK_FUNCS(getgrouplist) + # locale -AC_CHECK_HEADERS(ctype.h locale.h) +AC_CHECK_HEADERS(ctype.h locale.h langinfo.h) # glob AC_CHECK_HEADERS(fnmatch.h) diff --git a/ctdb/lib/replace/system/filesys.h b/ctdb/lib/replace/system/filesys.h index 4bf1f64865..e2c3c1dd72 100644 --- a/ctdb/lib/replace/system/filesys.h +++ b/ctdb/lib/replace/system/filesys.h @@ -1,16 +1,16 @@ #ifndef _system_filesys_h #define _system_filesys_h -/* +/* Unix SMB/CIFS implementation. filesystem system include wrappers Copyright (C) Andrew Tridgell 2004 - + ** NOTE! The following LGPL license applies to the replace ** library. This does NOT imply that all of Samba is released ** under the LGPL - + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either @@ -53,23 +53,23 @@ #include <acl/libacl.h> #endif -#ifdef HAVE_SYS_FS_S5PARAM_H +#ifdef HAVE_SYS_FS_S5PARAM_H #include <sys/fs/s5param.h> #endif #if defined (HAVE_SYS_FILSYS_H) && !defined (_CRAY) -#include <sys/filsys.h> +#include <sys/filsys.h> #endif #ifdef HAVE_SYS_STATFS_H # include <sys/statfs.h> #endif -#ifdef HAVE_DUSTAT_H +#ifdef HAVE_DUSTAT_H #include <sys/dustat.h> #endif -#ifdef HAVE_SYS_STATVFS_H +#ifdef HAVE_SYS_STATVFS_H #include <sys/statvfs.h> #endif @@ -77,7 +77,9 @@ #include <sys/filio.h> #endif +#ifdef HAVE_SYS_FILE_H #include <sys/file.h> +#endif #ifdef HAVE_FCNTL_H #include <fcntl.h> @@ -98,6 +100,10 @@ #include <sys/ioctl.h> #endif +#ifdef HAVE_SYS_UIO_H +#include <sys/uio.h> +#endif + /* * Veritas File System. Often in addition to native. * Quotas different. @@ -123,7 +129,7 @@ #endif /* Some POSIX definitions for those without */ - + #ifndef S_IFDIR #define S_IFDIR 0x4000 #endif @@ -179,4 +185,19 @@ #define SEEK_SET 0 #endif +#ifdef _WIN32 +#define mkdir(d,m) _mkdir(d) +#endif + +#ifdef UID_WRAPPER +# ifndef UID_WRAPPER_DISABLE +# ifndef UID_WRAPPER_NOT_REPLACE +# define UID_WRAPPER_REPLACE +# endif /* UID_WRAPPER_NOT_REPLACE */ +# include "../uid_wrapper/uid_wrapper.h" +# endif /* UID_WRAPPER_DISABLE */ +#else /* UID_WRAPPER */ +# define uwrap_enabled() 0 +#endif /* UID_WRAPPER */ + #endif diff --git a/ctdb/lib/replace/system/kerberos.h b/ctdb/lib/replace/system/kerberos.h index 78aa7b943f..7762d4be46 100644 --- a/ctdb/lib/replace/system/kerberos.h +++ b/ctdb/lib/replace/system/kerberos.h @@ -28,109 +28,28 @@ */ #ifdef HAVE_KRB5 -/* Whether the krb5_address struct has a addrtype property */ -/* #undef HAVE_ADDRTYPE_IN_KRB5_ADDRESS */ -/* Whether the krb5_address struct has a addr_type property */ -#define HAVE_ADDR_TYPE_IN_KRB5_ADDRESS 1 -/* Define to 1 if you have the `gsskrb5_extract_authz_data_from_sec_context' */ -#define HAVE_GSSKRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT 1 -/* Define to 1 if you have the `gsskrb5_get_initiator_subkey' function. */ -#define HAVE_GSSKRB5_GET_INITIATOR_SUBKEY 1 -/* Define to 1 if you have the `gsskrb5_register_acceptor_identity' function. */ -#define HAVE_GSSKRB5_REGISTER_ACCEPTOR_IDENTITY 1 -/* Define to 1 if you have the `gss_krb5_ccache_name' function. */ -#define HAVE_GSS_KRB5_CCACHE_NAME 1 -/* Define to 1 if you have the `krb5_addlog_func' function. */ -#define HAVE_KRB5_ADDLOG_FUNC 1 -/* Define to 1 if you have the `krb5_auth_con_setkey' function. */ -#define HAVE_KRB5_AUTH_CON_SETKEY 1 -/* Define to 1 if you have the `krb5_auth_con_setuseruserkey' function. */ -/* #undef HAVE_KRB5_AUTH_CON_SETUSERUSERKEY */ -/* Define to 1 if you have the `krb5_c_enctype_compare' function. */ -#define HAVE_KRB5_C_ENCTYPE_COMPARE 1 -/* Define to 1 if you have the `krb5_c_verify_checksum' function. */ -#define HAVE_KRB5_C_VERIFY_CHECKSUM 1 -/* Whether the type krb5_encrypt_block exists */ -/* #undef HAVE_KRB5_ENCRYPT_BLOCK */ -/* Define to 1 if you have the `krb5_encrypt_data' function. */ -/* #undef HAVE_KRB5_ENCRYPT_DATA */ -/* Define to 1 if you have the `krb5_enctypes_compatible_keys' function. */ -#define HAVE_KRB5_ENCTYPES_COMPATIBLE_KEYS 1 -/* Define to 1 if you have the `krb5_free_data_contents' function. */ -#define HAVE_KRB5_FREE_DATA_CONTENTS 1 -/* Define to 1 if you have the `krb5_free_error_string' function. */ -#define HAVE_KRB5_FREE_ERROR_STRING 1 -/* Define to 1 if you have the `krb5_free_keytab_entry_contents' function. */ -/* #undef HAVE_KRB5_FREE_KEYTAB_ENTRY_CONTENTS */ -/* Define to 1 if you have the `krb5_free_ktypes' function. */ -/* #undef HAVE_KRB5_FREE_KTYPES */ -/* Define to 1 if you have the `krb5_free_unparsed_name' function. */ -/* #undef HAVE_KRB5_FREE_UNPARSED_NAME */ -/* Define to 1 if you have the `krb5_get_default_in_tkt_etypes' function. */ -#define HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES 1 -/* Define to 1 if you have the `krb5_get_error_string' function. */ -#define HAVE_KRB5_GET_ERROR_STRING 1 -/* Define to 1 if you have the `krb5_get_permitted_enctypes' function. */ -/* #undef HAVE_KRB5_GET_PERMITTED_ENCTYPES */ -/* Define to 1 if you have the `krb5_get_pw_salt' function. */ -#define HAVE_KRB5_GET_PW_SALT 1 -/* Define to 1 if you have the <krb5.h> header file. */ -#define HAVE_KRB5_H 1 -/* Define to 1 if you have the `krb5_initlog' function. */ -#define HAVE_KRB5_INITLOG 1 -/* Define to 1 if you have the `krb5_kdc_default_config' function. */ -#define HAVE_KRB5_KDC_DEFAULT_CONFIG 1 -/* Whether the krb5_creds struct has a keyblock property */ -/* #undef HAVE_KRB5_KEYBLOCK_IN_CREDS */ -/* Whether the krb5_keyblock struct has a keyvalue property */ -#define HAVE_KRB5_KEYBLOCK_KEYVALUE 1 -/* Whether krb5_keytab_entry has key member */ -/* #undef HAVE_KRB5_KEYTAB_ENTRY_KEY */ -/* Whether krb5_keytab_entry has keyblock member */ -#define HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK 1 -/* Define to 1 if you have the `krb5_krbhst_get_addrinfo' function. */ -#define HAVE_KRB5_KRBHST_GET_ADDRINFO 1 -/* Define to 1 if you have the `krb5_kt_compare' function. */ -#define HAVE_KRB5_KT_COMPARE 1 -/* Define to 1 if you have the `krb5_kt_free_entry' function. */ -#define HAVE_KRB5_KT_FREE_ENTRY 1 -/* Whether the type krb5_log_facility exists */ -#define HAVE_KRB5_LOG_FACILITY 1 -/* Define to 1 if you have the `krb5_mk_req_extended' function. */ -#define HAVE_KRB5_MK_REQ_EXTENDED 1 -/* Define to 1 if you have the `krb5_principal2salt' function. */ -/* #undef HAVE_KRB5_PRINCIPAL2SALT */ -/* Define to 1 if you have the `krb5_principal_get_comp_string' function. */ -#define HAVE_KRB5_PRINCIPAL_GET_COMP_STRING 1 -/* Whether krb5_princ_component is available */ -/* #undef HAVE_KRB5_PRINC_COMPONENT */ -/* Whether the krb5_creds struct has a session property */ -#define HAVE_KRB5_SESSION_IN_CREDS 1 -/* Define to 1 if you have the `krb5_set_default_in_tkt_etypes' function. */ -#define HAVE_KRB5_SET_DEFAULT_IN_TKT_ETYPES 1 -/* Define to 1 if you have the `krb5_set_default_tgs_ktypes' function. */ -/* #undef HAVE_KRB5_SET_DEFAULT_TGS_KTYPES */ -/* Define to 1 if you have the `krb5_set_real_time' function. */ -#define HAVE_KRB5_SET_REAL_TIME 1 -/* Define to 1 if you have the `krb5_set_warn_dest' function. */ -#define HAVE_KRB5_SET_WARN_DEST 1 -/* Define to 1 if you have the `krb5_string_to_key' function. */ -#define HAVE_KRB5_STRING_TO_KEY 1 -/* Define to 1 if you have the `krb5_string_to_key_salt' function. */ -#define HAVE_KRB5_STRING_TO_KEY_SALT 1 -/* Define to 1 if you have the `krb5_ticket_get_authorization_data_type' */ -#define HAVE_KRB5_TICKET_GET_AUTHORIZATION_DATA_TYPE 1 -/* Whether the krb5_ticket struct has a enc_part2 property */ -/* #undef HAVE_KRB5_TKT_ENC_PART2 */ -/* Define to 1 if you have the `krb5_use_enctype' function. */ -/* #undef HAVE_KRB5_USE_ENCTYPE */ -/* Define to 1 if you have the `krb5_verify_checksum' function. */ -#define HAVE_KRB5_VERIFY_CHECKSUM 1 -/* Whether krb5_princ_realm returns krb5_realm or krb5_data */ -#define KRB5_PRINC_REALM_RETURNS_REALM 1 -#include "heimdal/lib/krb5/krb5.h" -#include "heimdal/lib/com_err/com_err.h" +#if HAVE_KRB5_H +#include <krb5.h> #endif +#if HAVE_COM_ERR_H +#include <com_err.h> +#endif + +#ifdef HAVE_GSSAPI_GSSAPI_EXT_H +#include <gssapi/gssapi_ext.h> +#elif HAVE_GSSAPI_GSSAPI_H +#include <gssapi/gssapi.h> +#elif HAVE_GSSAPI_GSSAPI_GENERIC_H +#include <gssapi/gssapi_generic.h> +#elif HAVE_GSSAPI_H +#include <gssapi.h> +#endif + +#if HAVE_GSSAPI_GSSAPI_KRB5_H +#include <gssapi/gssapi_krb5.h> +#endif + +#endif #endif diff --git a/ctdb/lib/replace/system/locale.h b/ctdb/lib/replace/system/locale.h index e73a9bb274..504a3bb470 100644 --- a/ctdb/lib/replace/system/locale.h +++ b/ctdb/lib/replace/system/locale.h @@ -35,4 +35,8 @@ #include <locale.h> #endif +#ifdef HAVE_LANGINFO_H +#include <langinfo.h> +#endif + #endif diff --git a/ctdb/lib/replace/system/network.h b/ctdb/lib/replace/system/network.h index e2fad5f686..7cb8d7becf 100644 --- a/ctdb/lib/replace/system/network.h +++ b/ctdb/lib/replace/system/network.h @@ -27,6 +27,12 @@ */ +#ifndef LIBREPLACE_NETWORK_CHECKS +#error "AC_LIBREPLACE_NETWORK_CHECKS missing in configure" +#endif + +#include <unistd.h> + #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif @@ -79,7 +85,20 @@ #include <sys/ioctl.h> #endif -#ifdef REPLACE_INET_NTOA +#ifdef HAVE_SYS_UIO_H +#include <sys/uio.h> +#endif + +#ifdef HAVE_STROPTS_H +#include <stropts.h> +#endif + +#ifndef HAVE_SOCKLEN_T +#define HAVE_SOCKLEN_T +typedef int socklen_t; +#endif + +#if !defined (HAVE_INET_NTOA) || defined(REPLACE_INET_NTOA) /* define is in "replace.h" */ char *rep_inet_ntoa(struct in_addr ip); #endif @@ -94,6 +113,21 @@ int rep_inet_pton(int af, const char *src, void *dst); const char *rep_inet_ntop(int af, const void *src, char *dst, socklen_t size); #endif +#ifndef HAVE_INET_ATON +/* define is in "replace.h" */ +int rep_inet_aton(const char *src, struct in_addr *dst); +#endif + +#ifndef HAVE_CONNECT +/* define is in "replace.h" */ +int rep_connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen); +#endif + +#ifndef HAVE_GETHOSTBYNAME +/* define is in "replace.h" */ +struct hostent *rep_gethostbyname(const char *name); +#endif + #ifdef HAVE_IFADDRS_H #include <ifaddrs.h> #endif @@ -119,6 +153,11 @@ int rep_getifaddrs(struct ifaddrs **); void rep_freeifaddrs(struct ifaddrs *); #endif +#ifndef HAVE_SOCKETPAIR +/* define is in "replace.h" */ +int rep_socketpair(int d, int type, int protocol, int sv[2]); +#endif + /* * Some systems have getaddrinfo but not the * defines needed to use it. @@ -158,9 +197,30 @@ void rep_freeifaddrs(struct ifaddrs *); #endif #endif +/* + * Some of the functions in source3/lib/util_sock.c use AI_ADDRCONFIG. On QNX + * 6.3.0, this macro is defined but, if it's used, getaddrinfo will fail. This + * prevents smbd from opening any sockets. + * + * If I undefine AI_ADDRCONFIG on such systems and define it to be 0, + * this works around the issue. + */ +#ifdef __QNX__ +#include <sys/neutrino.h> +#if _NTO_VERSION == 630 +#undef AI_ADDRCONFIG +#endif +#endif #ifndef AI_ADDRCONFIG +/* + * logic copied from AI_NUMERICHOST + */ +#if defined(HAVE_STRUCT_ADDRINFO) && defined(HAVE_GETADDRINFO) +#define AI_ADDRCONFIG 0 +#else #define AI_ADDRCONFIG 0x0020 #endif +#endif #ifndef AI_NUMERICSERV /* @@ -231,12 +291,11 @@ void rep_freeifaddrs(struct ifaddrs *); #endif #ifndef HOST_NAME_MAX -#define HOST_NAME_MAX 256 +#define HOST_NAME_MAX 255 #endif -#ifndef HAVE_SOCKLEN_T -#define HAVE_SOCKLEN_T -typedef int socklen_t; +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN HOST_NAME_MAX #endif #ifndef HAVE_SA_FAMILY_T @@ -250,12 +309,12 @@ typedef unsigned short int sa_family_t; #define sockaddr_storage sockaddr_in6 #define ss_family sin6_family #define HAVE_SS_FAMILY 1 -#else +#else /*HAVE_STRUCT_SOCKADDR_IN6*/ #define sockaddr_storage sockaddr_in #define ss_family sin_family #define HAVE_SS_FAMILY 1 -#endif -#endif +#endif /*HAVE_STRUCT_SOCKADDR_IN6*/ +#endif /*HAVE_STRUCT_SOCKADDR_STORAGE*/ #ifndef HAVE_SS_FAMILY #ifdef HAVE___SS_FAMILY @@ -264,6 +323,20 @@ typedef unsigned short int sa_family_t; #endif #endif +#ifndef IOV_MAX +# ifdef UIO_MAXIOV +# define IOV_MAX UIO_MAXIOV +# else +# ifdef __sgi + /* + * IRIX 6.5 has sysconf(_SC_IOV_MAX) + * which might return 512 or bigger + */ +# define IOV_MAX 512 +# endif +# endif +#endif + #ifndef HAVE_STRUCT_ADDRINFO #define HAVE_STRUCT_ADDRINFO struct addrinfo { @@ -284,14 +357,34 @@ struct addrinfo { /* Needed for some systems that don't define it (Solaris). */ #ifndef ifr_netmask -#define ifr_netmask ifr_addrs +#define ifr_netmask ifr_addr #endif +/* Some old Linux systems have broken header files */ +#ifdef HAVE_IPV6 +#ifdef HAVE_LINUX_IPV6_V6ONLY_26 +#define IPV6_V6ONLY 26 +#endif /* HAVE_LINUX_IPV6_V6ONLY_26 */ +#endif /* HAVE_IPV6 */ + #ifdef SOCKET_WRAPPER +#ifndef SOCKET_WRAPPER_DISABLE #ifndef SOCKET_WRAPPER_NOT_REPLACE #define SOCKET_WRAPPER_REPLACE -#endif -#include "lib/socket_wrapper/socket_wrapper.h" -#endif +#endif /* SOCKET_WRAPPER_NOT_REPLACE */ +#include "../socket_wrapper/socket_wrapper.h" +#endif /* SOCKET_WRAPPER_DISABLE */ +#endif /* SOCKET_WRAPPER */ + +#ifdef UID_WRAPPER +# ifndef UID_WRAPPER_DISABLE +# ifndef UID_WRAPPER_NOT_REPLACE +# define UID_WRAPPER_REPLACE +# endif /* UID_WRAPPER_NOT_REPLACE */ +# include "../uid_wrapper/uid_wrapper.h" +# endif /* UID_WRAPPER_DISABLE */ +#else /* UID_WRAPPER */ +# define uwrap_enabled() 0 +#endif /* UID_WRAPPER */ #endif diff --git a/ctdb/lib/replace/system/passwd.h b/ctdb/lib/replace/system/passwd.h index 36fca7b4f8..f630012f00 100644 --- a/ctdb/lib/replace/system/passwd.h +++ b/ctdb/lib/replace/system/passwd.h @@ -1,17 +1,17 @@ #ifndef _system_passwd_h #define _system_passwd_h -/* +/* Unix SMB/CIFS implementation. passwd system include wrappers Copyright (C) Andrew Tridgell 2004 - + ** NOTE! The following LGPL license applies to the replace ** library. This does NOT imply that all of Samba is released ** under the LGPL - + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either @@ -68,15 +68,19 @@ #endif #ifdef REPLACE_GETPASS +#if defined(REPLACE_GETPASS_BY_GETPASSPHRASE) +#define getpass(prompt) getpassphrase(prompt) +#else #define getpass(prompt) rep_getpass(prompt) char *rep_getpass(const char *prompt); #endif +#endif #ifndef NGROUPS_MAX #define NGROUPS_MAX 32 /* Guess... */ #endif -/* what is the longest significant password available on your system? +/* what is the longest significant password available on your system? Knowing this speeds up password searches a lot */ #ifndef PASSWORD_LENGTH #define PASSWORD_LENGTH 8 @@ -97,10 +101,23 @@ char *rep_getpass(const char *prompt); #endif #ifdef NSS_WRAPPER +#ifndef NSS_WRAPPER_DISABLE #ifndef NSS_WRAPPER_NOT_REPLACE #define NSS_WRAPPER_REPLACE -#endif -#include "lib/nss_wrapper/nss_wrapper.h" -#endif +#endif /* NSS_WRAPPER_NOT_REPLACE */ +#include "../nss_wrapper/nss_wrapper.h" +#endif /* NSS_WRAPPER_DISABLE */ +#endif /* NSS_WRAPPER */ + +#ifdef UID_WRAPPER +# ifndef UID_WRAPPER_DISABLE +# ifndef UID_WRAPPER_NOT_REPLACE +# define UID_WRAPPER_REPLACE +# endif /* UID_WRAPPER_NOT_REPLACE */ +# include "../uid_wrapper/uid_wrapper.h" +# endif /* UID_WRAPPER_DISABLE */ +#else /* UID_WRAPPER */ +# define uwrap_enabled() 0 +#endif /* UID_WRAPPER */ #endif diff --git a/ctdb/lib/replace/system/readline.h b/ctdb/lib/replace/system/readline.h index ba34dc6a61..e6b8fb9129 100644 --- a/ctdb/lib/replace/system/readline.h +++ b/ctdb/lib/replace/system/readline.h @@ -43,7 +43,13 @@ #endif #ifdef HAVE_NEW_LIBREADLINE -# define RL_COMPLETION_CAST (rl_completion_func_t *) +#ifdef HAVE_CPPFUNCTION +# define RL_COMPLETION_CAST (CPPFunction *) +#elif HAVE_RL_COMPLETION_T +# define RL_COMPLETION_CAST (rl_completion_t *) +#else +# define RL_COMPLETION_CAST +#endif #else /* This type is missing from libreadline<4.0 (approximately) */ # define RL_COMPLETION_CAST diff --git a/ctdb/lib/replace/system/select.h b/ctdb/lib/replace/system/select.h index da18de0cfc..11c5390d90 100644 --- a/ctdb/lib/replace/system/select.h +++ b/ctdb/lib/replace/system/select.h @@ -38,4 +38,40 @@ #define SELECT_CAST #endif +#ifdef HAVE_POLL + +#include <poll.h> + +#else + +/* Type used for the number of file descriptors. */ +typedef unsigned long int nfds_t; + +/* Data structure describing a polling request. */ +struct pollfd +{ + int fd; /* File descriptor to poll. */ + short int events; /* Types of events poller cares about. */ + short int revents; /* Types of events that actually occurred. */ +}; + +/* Event types that can be polled for. These bits may be set in `events' + to indicate the interesting event types; they will appear in `revents' + to indicate the status of the file descriptor. */ +#define POLLIN 0x001 /* There is data to read. */ +#define POLLPRI 0x002 /* There is urgent data to read. */ +#define POLLOUT 0x004 /* Writing now will not block. */ +#define POLLRDNORM 0x040 /* Normal data may be read. */ +#define POLLRDBAND 0x080 /* Priority data may be read. */ +#define POLLWRNORM 0x100 /* Writing now will not block. */ +#define POLLWRBAND 0x200 /* Priority data may be written. */ +#define POLLERR 0x008 /* Error condition. */ +#define POLLHUP 0x010 /* Hung up. */ +#define POLLNVAL 0x020 /* Invalid polling request. */ + +/* define is in "replace.h" */ +int rep_poll(struct pollfd *fds, nfds_t nfds, int timeout); + +#endif + #endif diff --git a/ctdb/lib/replace/system/time.h b/ctdb/lib/replace/system/time.h index 036812ab8f..b6d2609289 100644 --- a/ctdb/lib/replace/system/time.h +++ b/ctdb/lib/replace/system/time.h @@ -39,6 +39,18 @@ #ifdef HAVE_UTIME_H #include <utime.h> +#else +struct utimbuf { + time_t actime; /* access time */ + time_t modtime; /* modification time */ +}; +#endif + +#ifndef HAVE_STRUCT_TIMESPEC +struct timespec { + time_t tv_sec; /* Seconds. */ + long tv_nsec; /* Nanoseconds. */ +}; #endif #ifndef HAVE_MKTIME @@ -51,4 +63,29 @@ time_t rep_mktime(struct tm *t); time_t rep_timegm(struct tm *tm); #endif +#ifndef HAVE_UTIME +/* define is in "replace.h" */ +int rep_utime(const char *filename, const struct utimbuf *buf); +#endif + +#ifndef HAVE_UTIMES +/* define is in "replace.h" */ +int rep_utimes(const char *filename, const struct timeval tv[2]); +#endif + +#ifndef HAVE_CLOCK_GETTIME +/* CLOCK_REALTIME is required by POSIX */ +#define CLOCK_REALTIME 0 +typedef int clockid_t; +int rep_clock_gettime(clockid_t clk_id, struct timespec *tp); +#endif +/* make sure we have a best effort CUSTOM_CLOCK_MONOTONIC we can rely on */ +#if defined(CLOCK_MONOTONIC) +#define CUSTOM_CLOCK_MONOTONIC CLOCK_MONOTONIC +#elif defined(CLOCK_HIGHRES) +#define CUSTOM_CLOCK_MONOTONIC CLOCK_HIGHRES +#else +#define CUSTOM_CLOCK_MONOTONIC CLOCK_REALTIME +#endif + #endif diff --git a/ctdb/lib/replace/system/wait.h b/ctdb/lib/replace/system/wait.h index 5784b1ae92..f0c3bdccab 100644 --- a/ctdb/lib/replace/system/wait.h +++ b/ctdb/lib/replace/system/wait.h @@ -36,20 +36,16 @@ #define SIGCLD SIGCHLD #endif -#ifndef SIGNAL_CAST -#define SIGNAL_CAST (RETSIGTYPE (*)(int)) -#endif - #ifdef HAVE_SETJMP_H #include <setjmp.h> #endif -#ifndef SA_RESETHAND -#define SA_RESETHAND SA_ONESHOT -#endif - #if !defined(HAVE_SIG_ATOMIC_T_TYPE) typedef int sig_atomic_t; #endif +#if !defined(HAVE_WAITPID) && defined(HAVE_WAIT4) +int rep_waitpid(pid_t pid,int *status,int options) +#endif + #endif diff --git a/ctdb/lib/replace/system/wscript_configure b/ctdb/lib/replace/system/wscript_configure new file mode 100644 index 0000000000..2035474b32 --- /dev/null +++ b/ctdb/lib/replace/system/wscript_configure @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +conf.CHECK_HEADERS('sys/capability.h') +conf.CHECK_FUNCS('getpwnam_r getpwuid_r getpwent_r') + +# solaris varients of getXXent_r +conf.CHECK_C_PROTOTYPE('getpwent_r', + 'struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)', + define='SOLARIS_GETPWENT_R', headers='pwd.h') +conf.CHECK_C_PROTOTYPE('getgrent_r', + 'struct group *getgrent_r(struct group *src, char *buf, int buflen)', + define='SOLARIS_GETGRENT_R', headers='grp.h') + +# the irix varients +conf.CHECK_C_PROTOTYPE('getpwent_r', + 'struct passwd *getpwent_r(struct passwd *src, char *buf, size_t buflen)', + define='SOLARIS_GETPWENT_R', headers='pwd.h') +conf.CHECK_C_PROTOTYPE('getgrent_r', + 'struct group *getgrent_r(struct group *src, char *buf, size_t buflen)', + define='SOLARIS_GETGRENT_R', headers='grp.h') + +conf.CHECK_FUNCS('getgrouplist') +conf.CHECK_HEADERS('ctype.h locale.h langinfo.h') +conf.CHECK_HEADERS('fnmatch.h locale.h langinfo.h') +conf.CHECK_HEADERS('sys/ipc.h sys/mman.h sys/shm.h') +conf.CHECK_HEADERS('termios.h termio.h sys/termio.h') |
