Rearranged option group bits to only require 32 bits on older systems

This commit is contained in:
Gerhard Rieger 2023-09-30 10:16:01 +02:00
parent 2cddaf22b1
commit c01722ac3e
7 changed files with 24 additions and 7 deletions

View file

@ -12,6 +12,8 @@ Features:
Coding:
Introduced groups_t instead of uint32_t, for more flexibility
Rearranged option group bits to only require 32 bits on older systems.
####################### V 1.7.4.5 (not released):
Corrections:

View file

@ -51,7 +51,7 @@ int xioopen_socket_recvfrom(int argc, const char *argv[], struct opt *opts,
int dummy1, int socktype, int dummy3);
static
int xioopen_socket_recv(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xfd, groups_t groups,
int xioflags, xiofile_t *xfd, groups_t groups,
int dummy1, int dummy2, int dummy3);
static

View file

@ -586,7 +586,7 @@ static int xioopen_unix_client(int argc, const char *argv[], struct opt *opts, i
OPT_PROTOCOL_FAMILY, OPT_UNIX_TIGHTSOCKLEN, OPT_UNLINK_CLOSE, OPT_BIND,
OPT_SO_TYPE, OPT_SO_PROTOTYPE, OPT_CLOEXEC, OPT_USER, OPT_GROUP, ?OPT_FORK,
*/
int
int
_xioopen_unix_client(xiosingle_t *xfd, int xioflags, groups_t groups,
int abstract, struct opt *opts, const char *name) {
const struct opt *namedopt;

6
xio.h
View file

@ -89,8 +89,14 @@ enum xiotag {
streams */
} ;
/* Keep condition consistent with xioopts.h:GROUP_*! */
#if WITH_SCTP
typedef uint64_t groups_t;
#define F_groups_t F_uint64_x
#else
typedef uint32_t groups_t;
#define F_groups_t F_uint32_x
#endif
/* global XIO options/parameters */
typedef struct {

View file

@ -48,10 +48,10 @@ static const char *addressgroupnames[] = {
"TERMIOS", "RANGE", "PTY", "PARENT",
"UNIX", "IP4", "IP6", "INTERFACE",
"UDP", "TCP", "SOCKS4", "OPENSSL",
"PROCESS", "APPL", "HTTP", "SCTP"
"PROCESS", "APPL", "HTTP", "undef",
"SCTP"
} ;
/* keep consistent with xioopts.h:enum ephase ! */
static char *optionphasenames[] = {
"ALL", "INIT", "EARLY",

View file

@ -2780,7 +2780,7 @@ groups_t _groupbits(mode_t mode) {
result = GROUP_SOCKET|GROUP_SOCK_UNIX; break;
#endif
}
Debug2("_groupbits(%d) -> %d", mode, result);
Debug2("_groupbits("F_mode") -> "F_groups_t, mode, result);
return result;
}

View file

@ -176,10 +176,19 @@ enum e_func {
#define GROUP_PROCESS 0x10000000 /* a process related option */
#define GROUP_APPL 0x20000000 /* option handled by data loop */
#define GROUP_HTTP 0x40000000 /* any HTTP client */
#define GROUP_IP_SCTP 0x80000000U
#define GROUP_ANY (GROUP_PROCESS|GROUP_APPL)
/* Keep condition consistent with xio.h:groups_t! */
#if WITH_SCTP
/* The following groups are not expected on systems without uint64_t */
#define GROUP_IP_SCTP 0x0100000000U
#define GROUP_ALL 0x03ffffffffU
#else
#define GROUP_IP_SCTP 0
#define GROUP_ALL 0xffffffffU
#endif
#define GROUP_IPAPP (GROUP_IP_UDP|GROUP_IP_TCP|GROUP_IP_SCTP) /* true: indicates one of UDP, TCP, SCTP */
#define GROUP_ANY (GROUP_PROCESS|GROUP_APPL)
/* no IP multicasts, no error queue yet */