Commit 5537dbbf authored by Alexandre Julliard's avatar Alexandre Julliard

Replaced WINE_CHECK_STRUCT_MEMBER autoconf macro by the standard

AC_CHECK_MEMBERS. Added check for si_fd in siginfo_t.
parent d56f063c
......@@ -50,16 +50,6 @@ then AC_DEFINE_UNQUOTED(AS_TR_CPP(SONAME_LIB$1),"$ac_cv_lib_soname_$1",
[Define to the soname of the lib$1 library.])dnl
fi])
dnl **** Check if a structure contains a specified member ****
dnl
dnl Usage: WINE_CHECK_STRUCT_MEMBER(struct,member,[includes,[action-if-found,[action-if-not-found]]])
dnl
AC_DEFUN([WINE_CHECK_STRUCT_MEMBER],
[AC_CACHE_CHECK([for $2 in struct $1], ac_cv_c_$1_$2,
AC_TRY_COMPILE([$3],[struct $1 s; s.$2 = 0],ac_cv_c_$1_$2="yes",ac_cv_c_$1_$2="no"))
AS_IF([ test "x$ac_cv_c_$1_$2" = "xyes"],[$4],[$5])
])
dnl **** Check for reentrant libc ****
dnl
dnl Usage: WINE_CHECK_ERRNO(errno-name,[action-if-yes,[action-if-no]])
......
......@@ -1294,7 +1294,8 @@ fi
dnl **** FIXME: what about mixed cases, where we need two of them? ***
WINE_CHECK_STRUCT_MEMBER(statfs,f_bfree,
dnl Check for statfs members
AC_CHECK_MEMBERS([struct statfs.f_bfree, struct statfs.f_bavail],,,
[#include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
......@@ -1309,53 +1310,20 @@ WINE_CHECK_STRUCT_MEMBER(statfs,f_bfree,
# include <sys/statfs.h>
# endif
# endif
#endif],
[AC_DEFINE(STATFS_HAS_BFREE, 1, [Define if the struct statfs has the member bfree])])
#endif])
WINE_CHECK_STRUCT_MEMBER(statfs,f_bavail,
[#include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
#ifdef STATFS_DEFINED_BY_SYS_MOUNT
# include <sys/mount.h>
#else
# ifdef STATFS_DEFINED_BY_SYS_VFS
# include <sys/vfs.h>
# else
# ifdef STATFS_DEFINED_BY_SYS_STATFS
# include <sys/statfs.h>
# endif
# endif
#endif],
[AC_DEFINE(STATFS_HAS_BAVAIL, 1, [Define if the struct statfs has the member bavail])])
dnl Check for file descriptor passing with msg_accrights
WINE_CHECK_STRUCT_MEMBER(msghdr,msg_accrights,
[#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif],
[AC_DEFINE(HAVE_MSGHDR_ACCRIGHTS, 1, [Define if struct msghdr contains msg_accrights])])
dnl Check for the sa_len member in struct sockaddr
WINE_CHECK_STRUCT_MEMBER(sockaddr,sa_len,
[#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif],
[AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if struct sockaddr contains sa_len])])
dnl Check for the sun_len member in struct sockaddr_un
WINE_CHECK_STRUCT_MEMBER(sockaddr_un,sun_len,
dnl Check for socket structure members
AC_CHECK_MEMBERS([struct msghdr.msg_accrights, struct sockaddr.sa_len, struct sockaddr_un.sun_len],,,
[#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_SYS_UN_H
# include <sys/un.h>
#endif],
[AC_DEFINE(HAVE_SOCKADDR_SUN_LEN, 1, [Define if struct sockaddr_un contains sun_len])])
#endif])
dnl Check for siginfo_t members
AC_CHECK_MEMBERS([siginfo_t.si_fd],,,[#include <signal.h>])
dnl *** check for the need to define platform-specific symbols
......
......@@ -52,7 +52,7 @@
# include <netinet/in.h>
#endif
#ifdef HAVE_SOCKADDR_SA_LEN
#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
# ifndef max
# define max(a,b) ((a) > (b) ? (a) : (b))
# endif
......@@ -60,7 +60,7 @@
sizeof((i).ifr_name)+(i).ifr_addr.sa_len)
# else
# define ifreq_size(i) sizeof(struct ifreq)
# endif /* defined(HAVE_SOCKADDR_SA_LEN) */
# endif /* HAVE_STRUCT_SOCKADDR_SA_LEN */
WINE_DEFAULT_DEBUG_CHANNEL(netbios);
......
......@@ -338,7 +338,7 @@ RPC_STATUS WINAPI UuidCreate(UUID *Uuid)
* However, under earlier systems, sa_len isn't present, so
* the size is just sizeof(struct ifreq)
*/
#ifdef HAVE_SOCKADDR_SA_LEN
#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
# ifndef max
# define max(a,b) ((a) > (b) ? (a) : (b))
# endif
......@@ -346,7 +346,7 @@ RPC_STATUS WINAPI UuidCreate(UUID *Uuid)
sizeof((i).ifr_name)+(i).ifr_addr.sa_len)
# else
# define ifreq_size(i) sizeof(struct ifreq)
# endif /* defined(HAVE_SOCKADDR_SA_LEN) */
# endif /* HAVE_STRUCT_SOCKADDR_SA_LEN */
sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
if (sd < 0) {
......
......@@ -1150,7 +1150,7 @@ static int WS2_recv ( int fd, struct iovec* iov, int count,
hdr.msg_iov = iov;
hdr.msg_iovlen = count;
#ifdef HAVE_MSGHDR_ACCRIGHTS
#ifdef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
hdr.msg_accrights = NULL;
hdr.msg_accrightslen = 0;
#else
......@@ -1259,7 +1259,7 @@ static int WS2_send ( int fd, struct iovec* iov, int count,
hdr.msg_iov = iov;
hdr.msg_iovlen = count;
#ifdef HAVE_MSGHDR_ACCRIGHTS
#ifdef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
hdr.msg_accrights = NULL;
hdr.msg_accrightslen = 0;
#else
......
......@@ -1314,10 +1314,10 @@ static int DRIVE_GetFreeSpace( int drive, PULARGE_INTEGER size,
}
size->QuadPart = RtlEnlargedUnsignedMultiply( info.f_bsize, info.f_blocks );
#ifdef STATFS_HAS_BAVAIL
#ifdef HAVE_STRUCT_STATFS_F_BAVAIL
available->QuadPart = RtlEnlargedUnsignedMultiply( info.f_bavail, info.f_bsize );
#else
# ifdef STATFS_HAS_BFREE
# ifdef HAVE_STRUCT_STATFS_F_BFREE
available->QuadPart = RtlEnlargedUnsignedMultiply( info.f_bfree, info.f_bsize );
# else
# error "statfs has no bfree/bavail member!"
......
......@@ -320,9 +320,6 @@
/* Define to 1 if the system has the type `mode_t'. */
#undef HAVE_MODE_T
/* Define if struct msghdr contains msg_accrights */
#undef HAVE_MSGHDR_ACCRIGHTS
/* Define if you have NAS including devel headers */
#undef HAVE_NAS
......@@ -431,18 +428,15 @@
/* Define to 1 if you have the `sigaltstack' function. */
#undef HAVE_SIGALTSTACK
/* Define to 1 if `si_fd' is member of `siginfo_t'. */
#undef HAVE_SIGINFO_T_SI_FD
/* Define to 1 if the system has the type `size_t'. */
#undef HAVE_SIZE_T
/* Define to 1 if you have the `snprintf' function. */
#undef HAVE_SNPRINTF
/* Define if struct sockaddr contains sa_len */
#undef HAVE_SOCKADDR_SA_LEN
/* Define if struct sockaddr_un contains sun_len */
#undef HAVE_SOCKADDR_SUN_LEN
/* Define to 1 if you have the <socket.h> header file. */
#undef HAVE_SOCKET_H
......@@ -476,6 +470,21 @@
/* Define to 1 if you have the `strncasecmp' function. */
#undef HAVE_STRNCASECMP
/* Define to 1 if `msg_accrights' is member of `struct msghdr'. */
#undef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
/* Define to 1 if `sa_len' is member of `struct sockaddr'. */
#undef HAVE_STRUCT_SOCKADDR_SA_LEN
/* Define to 1 if `sun_len' is member of `struct sockaddr_un'. */
#undef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
/* Define to 1 if `f_bavail' is member of `struct statfs'. */
#undef HAVE_STRUCT_STATFS_F_BAVAIL
/* Define to 1 if `f_bfree' is member of `struct statfs'. */
#undef HAVE_STRUCT_STATFS_F_BFREE
/* Define to 1 if you have the <syscall.h> header file. */
#undef HAVE_SYSCALL_H
......@@ -751,12 +760,6 @@
/* Define if the struct statfs is defined by <sys/vfs.h> */
#undef STATFS_DEFINED_BY_SYS_VFS
/* Define if the struct statfs has the member bavail */
#undef STATFS_HAS_BAVAIL
/* Define if the struct statfs has the member bfree */
#undef STATFS_HAS_BFREE
/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
#undef STAT_MACROS_BROKEN
......
......@@ -63,7 +63,7 @@ typedef int ssize_t;
#ifndef HAVE_STATFS
# ifdef __BEOS__
# define STATFS_HAS_BFREE
# define HAVE_STRUCT_STATFS_F_BFREE
struct statfs {
long f_bsize; /* block_size */
long f_blocks; /* total_blocks */
......
......@@ -64,7 +64,7 @@
#define SOCKETNAME "socket" /* name of the socket file */
#define LOCKNAME "lock" /* name of the lock file */
#ifndef HAVE_MSGHDR_ACCRIGHTS
#ifndef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
/* data structure used to pass an fd with sendmsg/recvmsg */
struct cmsg_fd
{
......@@ -73,7 +73,7 @@ struct cmsg_fd
int type; /* SCM_RIGHTS */
int fd; /* fd to pass */
};
#endif /* HAVE_MSGHDR_ACCRIGHTS */
#endif /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */
static DWORD boot_thread_id;
static sigset_t block_set; /* signals to block during server calls */
......@@ -238,7 +238,7 @@ unsigned int wine_server_call( void *req_ptr )
*/
void wine_server_send_fd( int fd )
{
#ifndef HAVE_MSGHDR_ACCRIGHTS
#ifndef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
struct cmsg_fd cmsg;
#endif
struct send_fd data;
......@@ -254,10 +254,10 @@ void wine_server_send_fd( int fd )
msghdr.msg_iov = &vec;
msghdr.msg_iovlen = 1;
#ifdef HAVE_MSGHDR_ACCRIGHTS
#ifdef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
msghdr.msg_accrights = (void *)&fd;
msghdr.msg_accrightslen = sizeof(fd);
#else /* HAVE_MSGHDR_ACCRIGHTS */
#else /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */
cmsg.len = sizeof(cmsg);
cmsg.level = SOL_SOCKET;
cmsg.type = SCM_RIGHTS;
......@@ -265,7 +265,7 @@ void wine_server_send_fd( int fd )
msghdr.msg_control = &cmsg;
msghdr.msg_controllen = sizeof(cmsg);
msghdr.msg_flags = 0;
#endif /* HAVE_MSGHDR_ACCRIGHTS */
#endif /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */
data.tid = GetCurrentThreadId();
data.fd = fd;
......@@ -291,13 +291,13 @@ static int receive_fd( obj_handle_t *handle )
struct iovec vec;
int ret, fd;
#ifdef HAVE_MSGHDR_ACCRIGHTS
#ifdef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
struct msghdr msghdr;
fd = -1;
msghdr.msg_accrights = (void *)&fd;
msghdr.msg_accrightslen = sizeof(fd);
#else /* HAVE_MSGHDR_ACCRIGHTS */
#else /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */
struct msghdr msghdr;
struct cmsg_fd cmsg;
......@@ -308,7 +308,7 @@ static int receive_fd( obj_handle_t *handle )
msghdr.msg_control = &cmsg;
msghdr.msg_controllen = sizeof(cmsg);
msghdr.msg_flags = 0;
#endif /* HAVE_MSGHDR_ACCRIGHTS */
#endif /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */
msghdr.msg_name = NULL;
msghdr.msg_namelen = 0;
......@@ -321,7 +321,7 @@ static int receive_fd( obj_handle_t *handle )
{
if ((ret = recvmsg( fd_socket, &msghdr, 0 )) > 0)
{
#ifndef HAVE_MSGHDR_ACCRIGHTS
#ifndef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
fd = cmsg.fd;
#endif
if (fd == -1) server_protocol_error( "no fd received for handle %d\n", *handle );
......@@ -586,7 +586,7 @@ static int server_connect( const char *oldcwd, const char *serverdir )
addr.sun_family = AF_UNIX;
strcpy( addr.sun_path, SOCKETNAME );
slen = sizeof(addr) - sizeof(addr.sun_path) + strlen(addr.sun_path) + 1;
#ifdef HAVE_SOCKADDR_SUN_LEN
#ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
addr.sun_len = slen;
#endif
if ((s = socket( AF_UNIX, SOCK_STREAM, 0 )) == -1) fatal_perror( "socket" );
......
......@@ -113,7 +113,7 @@ static struct master_socket *master_socket; /* the master socket object */
/* socket communication static structures */
static struct iovec myiovec;
static struct msghdr msghdr;
#ifndef HAVE_MSGHDR_ACCRIGHTS
#ifndef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
struct cmsg_fd
{
int len; /* sizeof structure */
......@@ -122,7 +122,7 @@ struct cmsg_fd
int fd; /* fd to pass */
};
static struct cmsg_fd cmsg = { sizeof(cmsg), SOL_SOCKET, SCM_RIGHTS, -1 };
#endif /* HAVE_MSGHDR_ACCRIGHTS */
#endif /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */
/* complain about a protocol error and terminate the client connection */
void fatal_protocol_error( struct thread *thread, const char *err, ... )
......@@ -335,20 +335,20 @@ int receive_fd( struct process *process )
struct send_fd data;
int fd, ret;
#ifdef HAVE_MSGHDR_ACCRIGHTS
#ifdef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
msghdr.msg_accrightslen = sizeof(int);
msghdr.msg_accrights = (void *)&fd;
#else /* HAVE_MSGHDR_ACCRIGHTS */
#else /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */
msghdr.msg_control = &cmsg;
msghdr.msg_controllen = sizeof(cmsg);
cmsg.fd = -1;
#endif /* HAVE_MSGHDR_ACCRIGHTS */
#endif /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */
myiovec.iov_base = (void *)&data;
myiovec.iov_len = sizeof(data);
ret = recvmsg( get_unix_fd( process->msg_fd ), &msghdr, 0 );
#ifndef HAVE_MSGHDR_ACCRIGHTS
#ifndef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
fd = cmsg.fd;
#endif
......@@ -405,14 +405,14 @@ int send_client_fd( struct process *process, int fd, obj_handle_t handle )
fprintf( stderr, "%04x: *fd* %p -> %d\n",
current ? current->id : process->id, handle, fd );
#ifdef HAVE_MSGHDR_ACCRIGHTS
#ifdef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
msghdr.msg_accrightslen = sizeof(fd);
msghdr.msg_accrights = (void *)&fd;
#else /* HAVE_MSGHDR_ACCRIGHTS */
#else /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */
msghdr.msg_control = &cmsg;
msghdr.msg_controllen = sizeof(cmsg);
cmsg.fd = fd;
#endif /* HAVE_MSGHDR_ACCRIGHTS */
#endif /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */
myiovec.iov_base = (void *)&handle;
myiovec.iov_len = sizeof(handle);
......@@ -678,7 +678,7 @@ static void acquire_lock(void)
addr.sun_family = AF_UNIX;
strcpy( addr.sun_path, server_socket_name );
slen = sizeof(addr) - sizeof(addr.sun_path) + strlen(addr.sun_path) + 1;
#ifdef HAVE_SOCKADDR_SUN_LEN
#ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
addr.sun_len = slen;
#endif
if (bind( fd, (struct sockaddr *)&addr, slen ) == -1)
......
......@@ -198,7 +198,9 @@ static void do_sigchld()
static void do_sigio( int signum, siginfo_t *si, void *x )
{
do_signal( handler_sigio );
#ifdef HAVE_SIGINFO_T_SI_FD
do_change_notify( si->si_fd );
#endif
}
void init_signals(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment