mirror of
https://github.com/postgres/postgres.git
synced 2025-04-25 21:42:33 +03:00
Remove check for accept() argument types
This check was used to accommodate a staggering variety in particular in the type of the third argument of accept(). This is no longer of concern on currently supported systems. We can just use socklen_t in the code and put in a simple check that substitutes int for socklen_t if it's missing, to cover the few stragglers. Reviewed-by: Andres Freund <andres@anarazel.de> Discussion: https://www.postgresql.org/message-id/3538f4c4-1886-64f2-dcff-aaad8267fb82@enterprisedb.com
This commit is contained in:
parent
4cd046c203
commit
ee3a1a5b63
1
aclocal.m4
vendored
1
aclocal.m4
vendored
@ -1,5 +1,4 @@
|
|||||||
dnl aclocal.m4
|
dnl aclocal.m4
|
||||||
m4_include([config/ac_func_accept_argtypes.m4])
|
|
||||||
m4_include([config/ax_prog_perl_modules.m4])
|
m4_include([config/ax_prog_perl_modules.m4])
|
||||||
m4_include([config/ax_pthread.m4])
|
m4_include([config/ax_pthread.m4])
|
||||||
m4_include([config/c-compiler.m4])
|
m4_include([config/c-compiler.m4])
|
||||||
|
@ -1,78 +0,0 @@
|
|||||||
# config/ac_func_accept_argtypes.m4
|
|
||||||
# This comes from the official Autoconf macro archive at
|
|
||||||
# <http://research.cys.de/autoconf-archive/>
|
|
||||||
|
|
||||||
|
|
||||||
dnl @synopsis AC_FUNC_ACCEPT_ARGTYPES
|
|
||||||
dnl
|
|
||||||
dnl Checks the data types of the three arguments to accept(). Results are
|
|
||||||
dnl placed into the symbols ACCEPT_TYPE_RETURN and ACCEPT_TYPE_ARG[123],
|
|
||||||
dnl consistent with the following example:
|
|
||||||
dnl
|
|
||||||
dnl #define ACCEPT_TYPE_RETURN int
|
|
||||||
dnl #define ACCEPT_TYPE_ARG1 int
|
|
||||||
dnl #define ACCEPT_TYPE_ARG2 struct sockaddr *
|
|
||||||
dnl #define ACCEPT_TYPE_ARG3 socklen_t
|
|
||||||
dnl
|
|
||||||
dnl NOTE: This is just a modified version of the AC_FUNC_SELECT_ARGTYPES
|
|
||||||
dnl macro. Credit for that one goes to David MacKenzie et. al.
|
|
||||||
dnl
|
|
||||||
dnl @version $Id: ac_func_accept_argtypes.m4,v 1.1 1999/12/03 11:29:29 simons Exp $
|
|
||||||
dnl @author Daniel Richard G. <skunk@mit.edu>
|
|
||||||
dnl
|
|
||||||
|
|
||||||
# PostgreSQL local changes: In the original version ACCEPT_TYPE_ARG3
|
|
||||||
# is a pointer type. That's kind of useless because then you can't
|
|
||||||
# use the macro to define a corresponding variable. We also make the
|
|
||||||
# reasonable(?) assumption that you can use arg3 for getsocktype etc.
|
|
||||||
# as well (i.e., anywhere POSIX.2 has socklen_t).
|
|
||||||
#
|
|
||||||
# arg2 can also be `const' (e.g., RH 4.2). Change the order of tests
|
|
||||||
# for arg3 so that `int' is first, in case there is no prototype at all.
|
|
||||||
#
|
|
||||||
# Solaris 7 and 8 have arg3 as 'void *' (disguised as 'Psocklen_t'
|
|
||||||
# which is *not* 'socklen_t *'). If we detect that, then we assume
|
|
||||||
# 'int' as the result, because that ought to work best.
|
|
||||||
#
|
|
||||||
# On Win32, accept() returns 'unsigned int PASCAL'
|
|
||||||
# Win64 uses SOCKET for return and arg1
|
|
||||||
|
|
||||||
AC_DEFUN([AC_FUNC_ACCEPT_ARGTYPES],
|
|
||||||
[AC_MSG_CHECKING([types of arguments for accept()])
|
|
||||||
AC_CACHE_VAL(ac_cv_func_accept_return,dnl
|
|
||||||
[AC_CACHE_VAL(ac_cv_func_accept_arg1,dnl
|
|
||||||
[AC_CACHE_VAL(ac_cv_func_accept_arg2,dnl
|
|
||||||
[AC_CACHE_VAL(ac_cv_func_accept_arg3,dnl
|
|
||||||
[for ac_cv_func_accept_return in 'int' 'SOCKET WSAAPI' 'unsigned int PASCAL'; do
|
|
||||||
for ac_cv_func_accept_arg1 in 'int' 'SOCKET' 'unsigned int'; do
|
|
||||||
for ac_cv_func_accept_arg2 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do
|
|
||||||
for ac_cv_func_accept_arg3 in 'int' 'size_t' 'socklen_t' 'unsigned int' 'void'; do
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
|
|
||||||
[#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
extern $ac_cv_func_accept_return accept ($ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *);])],
|
|
||||||
[ac_not_found=no; break 4], [ac_not_found=yes])
|
|
||||||
done
|
|
||||||
done
|
|
||||||
done
|
|
||||||
done
|
|
||||||
if test "$ac_not_found" = yes; then
|
|
||||||
AC_MSG_ERROR([could not determine argument types])
|
|
||||||
fi
|
|
||||||
if test "$ac_cv_func_accept_arg3" = "void"; then
|
|
||||||
ac_cv_func_accept_arg3=int
|
|
||||||
fi
|
|
||||||
])dnl AC_CACHE_VAL
|
|
||||||
])dnl AC_CACHE_VAL
|
|
||||||
])dnl AC_CACHE_VAL
|
|
||||||
])dnl AC_CACHE_VAL
|
|
||||||
AC_MSG_RESULT([$ac_cv_func_accept_return, $ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *])
|
|
||||||
AC_DEFINE_UNQUOTED(ACCEPT_TYPE_RETURN, $ac_cv_func_accept_return,
|
|
||||||
[Define to the return type of 'accept'])
|
|
||||||
AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG1, $ac_cv_func_accept_arg1,
|
|
||||||
[Define to the type of arg 1 of 'accept'])
|
|
||||||
AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG2, $ac_cv_func_accept_arg2,
|
|
||||||
[Define to the type of arg 2 of 'accept'])
|
|
||||||
AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG3, $ac_cv_func_accept_arg3,
|
|
||||||
[Define to the type of arg 3 of 'accept'])
|
|
||||||
])
|
|
82
configure
vendored
82
configure
vendored
@ -14615,6 +14615,17 @@ cat >>confdefs.h <<_ACEOF
|
|||||||
_ACEOF
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" "#include <sys/socket.h>
|
||||||
|
"
|
||||||
|
if test "x$ac_cv_type_socklen_t" = xyes; then :
|
||||||
|
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define HAVE_SOCKLEN_T 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ac_fn_c_check_type "$LINENO" "struct sockaddr_un" "ac_cv_type_struct_sockaddr_un" "#include <sys/types.h>
|
ac_fn_c_check_type "$LINENO" "struct sockaddr_un" "ac_cv_type_struct_sockaddr_un" "#include <sys/types.h>
|
||||||
@ -15327,77 +15338,6 @@ if test x"$pgac_cv_var_int_timezone" = xyes ; then
|
|||||||
$as_echo "#define HAVE_INT_TIMEZONE 1" >>confdefs.h
|
$as_echo "#define HAVE_INT_TIMEZONE 1" >>confdefs.h
|
||||||
|
|
||||||
fi
|
fi
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking types of arguments for accept()" >&5
|
|
||||||
$as_echo_n "checking types of arguments for accept()... " >&6; }
|
|
||||||
if ${ac_cv_func_accept_return+:} false; then :
|
|
||||||
$as_echo_n "(cached) " >&6
|
|
||||||
else
|
|
||||||
if ${ac_cv_func_accept_arg1+:} false; then :
|
|
||||||
$as_echo_n "(cached) " >&6
|
|
||||||
else
|
|
||||||
if ${ac_cv_func_accept_arg2+:} false; then :
|
|
||||||
$as_echo_n "(cached) " >&6
|
|
||||||
else
|
|
||||||
if ${ac_cv_func_accept_arg3+:} false; then :
|
|
||||||
$as_echo_n "(cached) " >&6
|
|
||||||
else
|
|
||||||
for ac_cv_func_accept_return in 'int' 'SOCKET WSAAPI' 'unsigned int PASCAL'; do
|
|
||||||
for ac_cv_func_accept_arg1 in 'int' 'SOCKET' 'unsigned int'; do
|
|
||||||
for ac_cv_func_accept_arg2 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do
|
|
||||||
for ac_cv_func_accept_arg3 in 'int' 'size_t' 'socklen_t' 'unsigned int' 'void'; do
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
||||||
/* end confdefs.h. */
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
extern $ac_cv_func_accept_return accept ($ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *);
|
|
||||||
_ACEOF
|
|
||||||
if ac_fn_c_try_compile "$LINENO"; then :
|
|
||||||
ac_not_found=no; break 4
|
|
||||||
else
|
|
||||||
ac_not_found=yes
|
|
||||||
fi
|
|
||||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
|
||||||
done
|
|
||||||
done
|
|
||||||
done
|
|
||||||
done
|
|
||||||
if test "$ac_not_found" = yes; then
|
|
||||||
as_fn_error $? "could not determine argument types" "$LINENO" 5
|
|
||||||
fi
|
|
||||||
if test "$ac_cv_func_accept_arg3" = "void"; then
|
|
||||||
ac_cv_func_accept_arg3=int
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_accept_return, $ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *" >&5
|
|
||||||
$as_echo "$ac_cv_func_accept_return, $ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *" >&6; }
|
|
||||||
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
|
||||||
#define ACCEPT_TYPE_RETURN $ac_cv_func_accept_return
|
|
||||||
_ACEOF
|
|
||||||
|
|
||||||
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
|
||||||
#define ACCEPT_TYPE_ARG1 $ac_cv_func_accept_arg1
|
|
||||||
_ACEOF
|
|
||||||
|
|
||||||
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
|
||||||
#define ACCEPT_TYPE_ARG2 $ac_cv_func_accept_arg2
|
|
||||||
_ACEOF
|
|
||||||
|
|
||||||
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
|
||||||
#define ACCEPT_TYPE_ARG3 $ac_cv_func_accept_arg3
|
|
||||||
_ACEOF
|
|
||||||
|
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gettimeofday takes only one argument" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gettimeofday takes only one argument" >&5
|
||||||
$as_echo_n "checking whether gettimeofday takes only one argument... " >&6; }
|
$as_echo_n "checking whether gettimeofday takes only one argument... " >&6; }
|
||||||
if ${pgac_cv_func_gettimeofday_1arg+:} false; then :
|
if ${pgac_cv_func_gettimeofday_1arg+:} false; then :
|
||||||
|
@ -1552,6 +1552,7 @@ PGAC_C_BUILTIN_UNREACHABLE
|
|||||||
PGAC_C_COMPUTED_GOTO
|
PGAC_C_COMPUTED_GOTO
|
||||||
PGAC_STRUCT_TIMEZONE
|
PGAC_STRUCT_TIMEZONE
|
||||||
PGAC_UNION_SEMUN
|
PGAC_UNION_SEMUN
|
||||||
|
AC_CHECK_TYPES(socklen_t, [], [], [#include <sys/socket.h>])
|
||||||
PGAC_STRUCT_SOCKADDR_UN
|
PGAC_STRUCT_SOCKADDR_UN
|
||||||
PGAC_STRUCT_SOCKADDR_STORAGE
|
PGAC_STRUCT_SOCKADDR_STORAGE
|
||||||
PGAC_STRUCT_SOCKADDR_STORAGE_MEMBERS
|
PGAC_STRUCT_SOCKADDR_STORAGE_MEMBERS
|
||||||
@ -1686,7 +1687,6 @@ fi
|
|||||||
##
|
##
|
||||||
|
|
||||||
PGAC_VAR_INT_TIMEZONE
|
PGAC_VAR_INT_TIMEZONE
|
||||||
AC_FUNC_ACCEPT_ARGTYPES
|
|
||||||
PGAC_FUNC_GETTIMEOFDAY_1ARG
|
PGAC_FUNC_GETTIMEOFDAY_1ARG
|
||||||
PGAC_FUNC_WCSTOMBS_L
|
PGAC_FUNC_WCSTOMBS_L
|
||||||
|
|
||||||
|
@ -3026,7 +3026,7 @@ PerformRadiusTransaction(const char *server, const char *secret, const char *por
|
|||||||
struct addrinfo hint;
|
struct addrinfo hint;
|
||||||
struct addrinfo *serveraddrs;
|
struct addrinfo *serveraddrs;
|
||||||
int port;
|
int port;
|
||||||
ACCEPT_TYPE_ARG3 addrsize;
|
socklen_t addrsize;
|
||||||
fd_set fdset;
|
fd_set fdset;
|
||||||
struct timeval endtime;
|
struct timeval endtime;
|
||||||
int i,
|
int i,
|
||||||
|
@ -1632,7 +1632,7 @@ pq_getkeepalivesidle(Port *port)
|
|||||||
if (port->default_keepalives_idle == 0)
|
if (port->default_keepalives_idle == 0)
|
||||||
{
|
{
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
ACCEPT_TYPE_ARG3 size = sizeof(port->default_keepalives_idle);
|
socklen_t size = sizeof(port->default_keepalives_idle);
|
||||||
|
|
||||||
if (getsockopt(port->sock, IPPROTO_TCP, PG_TCP_KEEPALIVE_IDLE,
|
if (getsockopt(port->sock, IPPROTO_TCP, PG_TCP_KEEPALIVE_IDLE,
|
||||||
(char *) &port->default_keepalives_idle,
|
(char *) &port->default_keepalives_idle,
|
||||||
@ -1717,7 +1717,7 @@ pq_getkeepalivesinterval(Port *port)
|
|||||||
if (port->default_keepalives_interval == 0)
|
if (port->default_keepalives_interval == 0)
|
||||||
{
|
{
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
ACCEPT_TYPE_ARG3 size = sizeof(port->default_keepalives_interval);
|
socklen_t size = sizeof(port->default_keepalives_interval);
|
||||||
|
|
||||||
if (getsockopt(port->sock, IPPROTO_TCP, TCP_KEEPINTVL,
|
if (getsockopt(port->sock, IPPROTO_TCP, TCP_KEEPINTVL,
|
||||||
(char *) &port->default_keepalives_interval,
|
(char *) &port->default_keepalives_interval,
|
||||||
@ -1800,7 +1800,7 @@ pq_getkeepalivescount(Port *port)
|
|||||||
|
|
||||||
if (port->default_keepalives_count == 0)
|
if (port->default_keepalives_count == 0)
|
||||||
{
|
{
|
||||||
ACCEPT_TYPE_ARG3 size = sizeof(port->default_keepalives_count);
|
socklen_t size = sizeof(port->default_keepalives_count);
|
||||||
|
|
||||||
if (getsockopt(port->sock, IPPROTO_TCP, TCP_KEEPCNT,
|
if (getsockopt(port->sock, IPPROTO_TCP, TCP_KEEPCNT,
|
||||||
(char *) &port->default_keepalives_count,
|
(char *) &port->default_keepalives_count,
|
||||||
@ -1875,7 +1875,7 @@ pq_gettcpusertimeout(Port *port)
|
|||||||
|
|
||||||
if (port->default_tcp_user_timeout == 0)
|
if (port->default_tcp_user_timeout == 0)
|
||||||
{
|
{
|
||||||
ACCEPT_TYPE_ARG3 size = sizeof(port->default_tcp_user_timeout);
|
socklen_t size = sizeof(port->default_tcp_user_timeout);
|
||||||
|
|
||||||
if (getsockopt(port->sock, IPPROTO_TCP, TCP_USER_TIMEOUT,
|
if (getsockopt(port->sock, IPPROTO_TCP, TCP_USER_TIMEOUT,
|
||||||
(char *) &port->default_tcp_user_timeout,
|
(char *) &port->default_tcp_user_timeout,
|
||||||
|
@ -391,7 +391,7 @@ static void pgstat_recv_tempfile(PgStat_MsgTempFile *msg, int len);
|
|||||||
void
|
void
|
||||||
pgstat_init(void)
|
pgstat_init(void)
|
||||||
{
|
{
|
||||||
ACCEPT_TYPE_ARG3 alen;
|
socklen_t alen;
|
||||||
struct addrinfo *addrs = NULL,
|
struct addrinfo *addrs = NULL,
|
||||||
*addr,
|
*addr,
|
||||||
hints;
|
hints;
|
||||||
@ -624,7 +624,7 @@ retry2:
|
|||||||
{
|
{
|
||||||
int old_rcvbuf;
|
int old_rcvbuf;
|
||||||
int new_rcvbuf;
|
int new_rcvbuf;
|
||||||
ACCEPT_TYPE_ARG3 rcvbufsize = sizeof(old_rcvbuf);
|
socklen_t rcvbufsize = sizeof(old_rcvbuf);
|
||||||
|
|
||||||
if (getsockopt(pgStatSock, SOL_SOCKET, SO_RCVBUF,
|
if (getsockopt(pgStatSock, SOL_SOCKET, SO_RCVBUF,
|
||||||
(char *) &old_rcvbuf, &rcvbufsize) < 0)
|
(char *) &old_rcvbuf, &rcvbufsize) < 0)
|
||||||
|
@ -62,7 +62,7 @@ struct sockaddr_storage
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
struct sockaddr_storage addr;
|
struct sockaddr_storage addr;
|
||||||
ACCEPT_TYPE_ARG3 salen;
|
socklen_t salen;
|
||||||
} SockAddr;
|
} SockAddr;
|
||||||
|
|
||||||
/* Configure the UNIX socket location for the well known port. */
|
/* Configure the UNIX socket location for the well known port. */
|
||||||
|
@ -1,17 +1,5 @@
|
|||||||
/* src/include/pg_config.h.in. Generated from configure.ac by autoheader. */
|
/* src/include/pg_config.h.in. Generated from configure.ac by autoheader. */
|
||||||
|
|
||||||
/* Define to the type of arg 1 of 'accept' */
|
|
||||||
#undef ACCEPT_TYPE_ARG1
|
|
||||||
|
|
||||||
/* Define to the type of arg 2 of 'accept' */
|
|
||||||
#undef ACCEPT_TYPE_ARG2
|
|
||||||
|
|
||||||
/* Define to the type of arg 3 of 'accept' */
|
|
||||||
#undef ACCEPT_TYPE_ARG3
|
|
||||||
|
|
||||||
/* Define to the return type of 'accept' */
|
|
||||||
#undef ACCEPT_TYPE_RETURN
|
|
||||||
|
|
||||||
/* Define if building universal (internal helper macro) */
|
/* Define if building universal (internal helper macro) */
|
||||||
#undef AC_APPLE_UNIVERSAL_BUILD
|
#undef AC_APPLE_UNIVERSAL_BUILD
|
||||||
|
|
||||||
@ -518,6 +506,9 @@
|
|||||||
/* Define to 1 if you have the `shm_open' function. */
|
/* Define to 1 if you have the `shm_open' function. */
|
||||||
#undef HAVE_SHM_OPEN
|
#undef HAVE_SHM_OPEN
|
||||||
|
|
||||||
|
/* Define to 1 if the system has the type `socklen_t'. */
|
||||||
|
#undef HAVE_SOCKLEN_T
|
||||||
|
|
||||||
/* Define to 1 if you have spinlocks. */
|
/* Define to 1 if you have spinlocks. */
|
||||||
#undef HAVE_SPINLOCKS
|
#undef HAVE_SPINLOCKS
|
||||||
|
|
||||||
|
@ -37,6 +37,10 @@ typedef SOCKET pgsocket;
|
|||||||
#define PGINVALID_SOCKET INVALID_SOCKET
|
#define PGINVALID_SOCKET INVALID_SOCKET
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_SOCKLEN_T
|
||||||
|
typedef int socklen_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* non-blocking */
|
/* non-blocking */
|
||||||
extern bool pg_set_noblock(pgsocket sock);
|
extern bool pg_set_noblock(pgsocket sock);
|
||||||
extern bool pg_set_block(pgsocket sock);
|
extern bool pg_set_block(pgsocket sock);
|
||||||
|
@ -2744,7 +2744,7 @@ keep_going: /* We will come back to here until there is
|
|||||||
|
|
||||||
case CONNECTION_STARTED:
|
case CONNECTION_STARTED:
|
||||||
{
|
{
|
||||||
ACCEPT_TYPE_ARG3 optlen = sizeof(optval);
|
socklen_t optlen = sizeof(optval);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write ready, since we've made it here, so the connection
|
* Write ready, since we've made it here, so the connection
|
||||||
|
@ -37,7 +37,7 @@ getpeereid(int sock, uid_t *uid, gid_t *gid)
|
|||||||
#if defined(SO_PEERCRED)
|
#if defined(SO_PEERCRED)
|
||||||
/* Linux: use getsockopt(SO_PEERCRED) */
|
/* Linux: use getsockopt(SO_PEERCRED) */
|
||||||
struct ucred peercred;
|
struct ucred peercred;
|
||||||
ACCEPT_TYPE_ARG3 so_len = sizeof(peercred);
|
socklen_t so_len = sizeof(peercred);
|
||||||
|
|
||||||
if (getsockopt(sock, SOL_SOCKET, SO_PEERCRED, &peercred, &so_len) != 0 ||
|
if (getsockopt(sock, SOL_SOCKET, SO_PEERCRED, &peercred, &so_len) != 0 ||
|
||||||
so_len != sizeof(peercred))
|
so_len != sizeof(peercred))
|
||||||
@ -48,7 +48,7 @@ getpeereid(int sock, uid_t *uid, gid_t *gid)
|
|||||||
#elif defined(LOCAL_PEERCRED)
|
#elif defined(LOCAL_PEERCRED)
|
||||||
/* Debian with FreeBSD kernel: use getsockopt(LOCAL_PEERCRED) */
|
/* Debian with FreeBSD kernel: use getsockopt(LOCAL_PEERCRED) */
|
||||||
struct xucred peercred;
|
struct xucred peercred;
|
||||||
ACCEPT_TYPE_ARG3 so_len = sizeof(peercred);
|
socklen_t so_len = sizeof(peercred);
|
||||||
|
|
||||||
if (getsockopt(sock, 0, LOCAL_PEERCRED, &peercred, &so_len) != 0 ||
|
if (getsockopt(sock, 0, LOCAL_PEERCRED, &peercred, &so_len) != 0 ||
|
||||||
so_len != sizeof(peercred) ||
|
so_len != sizeof(peercred) ||
|
||||||
|
@ -205,10 +205,6 @@ sub GenerateFiles
|
|||||||
# Every symbol in pg_config.h.in must be accounted for here. Set
|
# Every symbol in pg_config.h.in must be accounted for here. Set
|
||||||
# to undef if the symbol should not be defined.
|
# to undef if the symbol should not be defined.
|
||||||
my %define = (
|
my %define = (
|
||||||
ACCEPT_TYPE_ARG1 => 'unsigned int',
|
|
||||||
ACCEPT_TYPE_ARG2 => 'struct sockaddr *',
|
|
||||||
ACCEPT_TYPE_ARG3 => 'int',
|
|
||||||
ACCEPT_TYPE_RETURN => 'unsigned int PASCAL',
|
|
||||||
ALIGNOF_DOUBLE => 8,
|
ALIGNOF_DOUBLE => 8,
|
||||||
ALIGNOF_INT => 4,
|
ALIGNOF_INT => 4,
|
||||||
ALIGNOF_LONG => 4,
|
ALIGNOF_LONG => 4,
|
||||||
@ -365,6 +361,7 @@ sub GenerateFiles
|
|||||||
HAVE_SETPROCTITLE_FAST => undef,
|
HAVE_SETPROCTITLE_FAST => undef,
|
||||||
HAVE_SETSID => undef,
|
HAVE_SETSID => undef,
|
||||||
HAVE_SHM_OPEN => undef,
|
HAVE_SHM_OPEN => undef,
|
||||||
|
HAVE_SOCKLEN_T => 1,
|
||||||
HAVE_SPINLOCKS => 1,
|
HAVE_SPINLOCKS => 1,
|
||||||
HAVE_SRANDOM => undef,
|
HAVE_SRANDOM => undef,
|
||||||
HAVE_STDBOOL_H => 1,
|
HAVE_STDBOOL_H => 1,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user