diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 1998-11-22 18:21:07 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 1998-11-22 18:21:07 +0000 |
commit | de4597cb5b86db37759ed7b6341e933f7aac9aa6 (patch) | |
tree | 8b8f91bd1ce71e93501b8e6a502037ed76f22634 /ext/Socket | |
parent | 12940611cd66eff0427cdf2e912e870058b20252 (diff) | |
download | perl-de4597cb5b86db37759ed7b6341e933f7aac9aa6.tar.gz |
MSG_PROXY for GNU/Hurd (previously we believed that
all GNU libc platforms have MSG_PROXY. Untrue).
In fact this ended up as a major MSG_* and SCM_*
update. The MSG_XXX known to be enums in some
versions of the glibc are now probed for and respective
HAS_MSG_XXX are defined. While I was at it I noticed
SCM_RIGHTS being similarly an enum. This reminded me of
an ancient discussion in perl5-porters:
http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/9612/msg01017.html
The BSD socket interface has a nifty feature for passing
file descriptors and credentials--via sockets. It may be
too late to add this functionality to the CORE but
at least Configure now probes for the functions,
structs, and includes, defining the appropriate
HAS_YYY and I_ZZZ, and the Socket extension exports
the constants, in case somebody wants to write an
extension for this interface.
p4raw-id: //depot/cfgperl@2285
Diffstat (limited to 'ext/Socket')
-rw-r--r-- | ext/Socket/Socket.pm | 20 | ||||
-rw-r--r-- | ext/Socket/Socket.xs | 114 |
2 files changed, 128 insertions, 6 deletions
diff --git a/ext/Socket/Socket.pm b/ext/Socket/Socket.pm index 5a4870f4af..1ed19f713d 100644 --- a/ext/Socket/Socket.pm +++ b/ext/Socket/Socket.pm @@ -193,10 +193,25 @@ require DynaLoader; AF_UNIX AF_UNSPEC AF_X25 + MSG_CTLFLAGS + MSG_CTLIGNORE + MSG_CTRUNC MSG_DONTROUTE + MSG_DONTWAIT + MSG_EOF + MSG_EOR + MSG_ERRQUEUE + MSG_FIN MSG_MAXIOVLEN + MSG_NOSIGNAL MSG_OOB MSG_PEEK + MSG_PROXY + MSG_RST + MSG_SYN + MSG_TRUNC + MSG_URG + MSG_WAITALL PF_802 PF_APPLETALK PF_CCITT @@ -221,6 +236,11 @@ require DynaLoader; PF_UNIX PF_UNSPEC PF_X25 + SCM_CONNECT + SCM_CREDENTIALS + SCM_CREDS + SCM_RIGHTS + SCM_TIMESTAMP SOCK_DGRAM SOCK_RAW SOCK_RDM diff --git a/ext/Socket/Socket.xs b/ext/Socket/Socket.xs index de0217bdb4..f0ba57f72d 100644 --- a/ext/Socket/Socket.xs +++ b/ext/Socket/Socket.xs @@ -330,42 +330,114 @@ constant(char *name, int arg) case 'L': break; case 'M': + if (strEQ(name, "MSG_CTLFLAGS")) +#ifdef MSG_CTLFLAGS + return MSG_CTLFLAGS; +#else + goto not_there; +#endif + if (strEQ(name, "MSG_CTLIGNORE")) +#ifdef MSG_CTLIGNORE + return MSG_CTLIGNORE; +#else + goto not_there; +#endif if (strEQ(name, "MSG_CTRUNC")) -#if defined(MSG_CTRUNC) || defined(HAS_GNULIBC) /* XXX it's an enum */ +#ifdef HAS_MSG_CTRUNC /* might be an enum */ return MSG_CTRUNC; #else goto not_there; #endif if (strEQ(name, "MSG_DONTROUTE")) -#if defined(MSG_DONTROUTE) || defined(HAS_GNULIBC) /* XXX it's an enum */ +#ifdef HAS_MSG_DONTROUTE /* might be an enum */ return MSG_DONTROUTE; #else goto not_there; #endif + if (strEQ(name, "MSG_DONTWAIT")) +#ifdef MSG_DONTWAIT + return MSG_DONTWAIT; +#else + goto not_there; +#endif + if (strEQ(name, "MSG_EOF")) +#ifdef MSG_EOF + return MSG_EOF; +#else + goto not_there; +#endif + if (strEQ(name, "MSG_EOR")) +#ifdef MSG_EOR + return MSG_EOR; +#else + goto not_there; +#endif + if (strEQ(name, "MSG_ERRQUEUE")) +#ifdef MSG_ERRQUEUE + return MSG_ERRQUEUE; +#else + goto not_there; +#endif + if (strEQ(name, "MSG_FIN")) +#ifdef MSG_FIN + return MSG_FIN; +#else + goto not_there; +#endif if (strEQ(name, "MSG_MAXIOVLEN")) -#ifdef MSG_MAXIOVLEN +#ifdef MSG_MAXIOVLEN /* might be an enum */ return MSG_MAXIOVLEN; #else goto not_there; #endif + if (strEQ(name, "MSG_NOSIGNAL")) +#ifdef MSG_NOSIGNAL + return MSG_NOSIGNAL; +#else + goto not_there; +#endif if (strEQ(name, "MSG_OOB")) -#if defined(MSG_OOB) || defined(HAS_GNULIBC) /* XXX it's an enum */ +#ifdef HAS_MSG_OOB /* might be an enum */ return MSG_OOB; #else goto not_there; #endif if (strEQ(name, "MSG_PEEK")) -#if defined(MSG_PEEK) || defined(HAS_GNULIBC) /* XXX it's an enum */ +#ifdef HAS_MSG_PEEK /* might be an enum */ return MSG_PEEK; #else goto not_there; #endif if (strEQ(name, "MSG_PROXY")) -#if defined(MSG_PROXY) || defined(HAS_GNULIBC) /* XXX it's an enum */ +#ifdef HAS_MSG_PROXY /* might be an enum */ return MSG_PROXY; #else goto not_there; #endif + if (strEQ(name, "MSG_RST")) +#ifdef MSG_RST + return MSG_RST; +#else + goto not_there; +#endif + if (strEQ(name, "MSG_SYN")) +#ifdef MSG_SYN + return MSG_SYN; +#else + goto not_there; +#endif + if (strEQ(name, "MSG_TRUNC")) +#ifdef MSG_TRUNC + return MSG_TRUNC; +#else + goto not_there; +#endif + if (strEQ(name, "MSG_WAITALL")) +#ifdef MSG_WAITALL + return MSG_WAITALL; +#else + goto not_there; +#endif break; case 'N': break; @@ -522,6 +594,36 @@ constant(char *name, int arg) case 'R': break; case 'S': + if (strEQ(name, "SCM_CONNECT")) +#ifdef SCM_CONNECT + return SCM_CONNECT; +#else + goto not_there; +#endif + if (strEQ(name, "SCM_CREDENTIALS")) +#ifdef SCM_CREDENTIALS + return SCM_CREDENTIALSS; +#else + goto not_there; +#endif + if (strEQ(name, "SCM_CREDS")) +#ifdef SCM_CREDS + return SCM_CREDS; +#else + goto not_there; +#endif + if (strEQ(name, "SCM_RIGHTS")) +#ifdef HAS_SCM_RIGHTS /* might be an enum */ + return SCM_RIGHTS; +#else + goto not_there; +#endif + if (strEQ(name, "SCM_TIMESTAMP")) +#ifdef SCM_TIMESTAMP + return SCM_TIMESTAMP; +#else + goto not_there; +#endif if (strEQ(name, "SOCK_DGRAM")) #ifdef SOCK_DGRAM return SOCK_DGRAM; |