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: Coding:
Introduced groups_t instead of uint32_t, for more flexibility 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): ####################### V 1.7.4.5 (not released):
Corrections: Corrections:

6
xio.h
View file

@ -89,8 +89,14 @@ enum xiotag {
streams */ 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; typedef uint32_t groups_t;
#define F_groups_t F_uint32_x #define F_groups_t F_uint32_x
#endif
/* global XIO options/parameters */ /* global XIO options/parameters */
typedef struct { typedef struct {

View file

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

View file

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

View file

@ -176,10 +176,19 @@ enum e_func {
#define GROUP_PROCESS 0x10000000 /* a process related option */ #define GROUP_PROCESS 0x10000000 /* a process related option */
#define GROUP_APPL 0x20000000 /* option handled by data loop */ #define GROUP_APPL 0x20000000 /* option handled by data loop */
#define GROUP_HTTP 0x40000000 /* any HTTP client */ #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 #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 */ /* no IP multicasts, no error queue yet */