Initial Commit
This commit is contained in:
173
database/perl/lib/CORE/sys/errno2.h
Normal file
173
database/perl/lib/CORE/sys/errno2.h
Normal file
@@ -0,0 +1,173 @@
|
||||
#ifndef _INC_SYS_ERRNO2
|
||||
#define _INC_SYS_ERRNO2
|
||||
|
||||
/* Too late to include winsock2.h if winsock.h has already been loaded */
|
||||
#ifndef _WINSOCKAPI_
|
||||
# include <winsock2.h>
|
||||
#endif
|
||||
|
||||
/* Ensure all the Exxx constants required by convert_wsa_error_to_errno() in
|
||||
* win32/win32sck.c are defined. Many are defined in <errno.h> already (more so
|
||||
* in VC++ 2010 and above and some MinGW/gcc-4.8 and above, which have an extra
|
||||
* "POSIX supplement") so, for the sake of compatibility with third-party code
|
||||
* linked into XS modules, we must be careful not to redefine them; for the
|
||||
* remainder we define our own values, namely the corresponding WSAExxx values.
|
||||
*
|
||||
* These definitions are also used as a supplement to the use of <errno.h> in
|
||||
* the Errno and POSIX modules, both of which may be used to test the value of
|
||||
* $!, which may have these values assigned to it (via code in win32/win32sck.c
|
||||
* and the $! case in Perl_magic_set()). It also provides numerous otherwise
|
||||
* missing values in the (hard-coded) list of Exxx constants exported by POSIX.
|
||||
* Finally, three of the non-standard errno.h values (actually all now in the
|
||||
* POSIX supplement in VC10+ and some MinGW/gcc-4.8+) are used in the perl core.
|
||||
*
|
||||
* This list is in the same order as that in convert_wsa_error_to_errno(). A
|
||||
* handful of WSAExxx constants used by that function have no corresponding Exxx
|
||||
* constant in any errno.h so there is no point in making up values for them;
|
||||
* they are just returned unchanged by that function so we do not need to worry
|
||||
* about them here.
|
||||
*/
|
||||
|
||||
/* EINTR is a standard errno.h value */
|
||||
/* EBADF is a standard errno.h value */
|
||||
/* EACCES is a standard errno.h value */
|
||||
/* EFAULT is a standard errno.h value */
|
||||
/* EINVAL is a standard errno.h value */
|
||||
/* EMFILE is a standard errno.h value */
|
||||
|
||||
#ifndef EWOULDBLOCK /* New in VC10 */
|
||||
# define EWOULDBLOCK WSAEWOULDBLOCK
|
||||
#endif
|
||||
#ifndef EINPROGRESS /* New in VC10 */
|
||||
# define EINPROGRESS WSAEINPROGRESS
|
||||
#endif
|
||||
#ifndef EALREADY /* New in VC10 */
|
||||
# define EALREADY WSAEALREADY
|
||||
#endif
|
||||
#ifndef ENOTSOCK /* New in VC10 and needed in doio.c */
|
||||
# define ENOTSOCK WSAENOTSOCK
|
||||
#endif
|
||||
#ifndef EDESTADDRREQ /* New in VC10 */
|
||||
# define EDESTADDRREQ WSAEDESTADDRREQ
|
||||
#endif
|
||||
#ifndef EMSGSIZE /* New in VC10 */
|
||||
# define EMSGSIZE WSAEMSGSIZE
|
||||
#endif
|
||||
#ifndef EPROTOTYPE /* New in VC10 */
|
||||
# define EPROTOTYPE WSAEPROTOTYPE
|
||||
#endif
|
||||
#ifndef ENOPROTOOPT /* New in VC10 */
|
||||
# define ENOPROTOOPT WSAENOPROTOOPT
|
||||
#endif
|
||||
#ifndef EPROTONOSUPPORT /* New in VC10 */
|
||||
# define EPROTONOSUPPORT WSAEPROTONOSUPPORT
|
||||
#endif
|
||||
#ifndef ESOCKTNOSUPPORT /* Not in errno.h but wanted by POSIX.pm */
|
||||
# define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
|
||||
#endif
|
||||
#ifndef EOPNOTSUPP /* New in VC10 */
|
||||
# define EOPNOTSUPP WSAEOPNOTSUPP
|
||||
#endif
|
||||
#ifndef EPFNOSUPPORT /* Not in errno.h but wanted by POSIX.pm */
|
||||
# define EPFNOSUPPORT WSAEPFNOSUPPORT
|
||||
#endif
|
||||
#ifndef EAFNOSUPPORT /* New in VC10 and needed in util.c */
|
||||
# define EAFNOSUPPORT WSAEAFNOSUPPORT
|
||||
#endif
|
||||
#ifndef EADDRINUSE /* New in VC10 */
|
||||
# define EADDRINUSE WSAEADDRINUSE
|
||||
#endif
|
||||
#ifndef EADDRNOTAVAIL /* New in VC10 */
|
||||
# define EADDRNOTAVAIL WSAEADDRNOTAVAIL
|
||||
#endif
|
||||
#ifndef ENETDOWN /* New in VC10 */
|
||||
# define ENETDOWN WSAENETDOWN
|
||||
#endif
|
||||
#ifndef ENETUNREACH /* New in VC10 */
|
||||
# define ENETUNREACH WSAENETUNREACH
|
||||
#endif
|
||||
#ifndef ENETRESET /* New in VC10 */
|
||||
# define ENETRESET WSAENETRESET
|
||||
#endif
|
||||
#ifndef ECONNABORTED /* New in VC10 and needed in util.c */
|
||||
# define ECONNABORTED WSAECONNABORTED
|
||||
#endif
|
||||
#ifndef ECONNRESET /* New in VC10 */
|
||||
# define ECONNRESET WSAECONNRESET
|
||||
#endif
|
||||
#ifndef ENOBUFS /* New in VC10 */
|
||||
# define ENOBUFS WSAENOBUFS
|
||||
#endif
|
||||
#ifndef EISCONN /* New in VC10 */
|
||||
# define EISCONN WSAEISCONN
|
||||
#endif
|
||||
#ifndef ENOTCONN /* New in VC10 */
|
||||
# define ENOTCONN WSAENOTCONN
|
||||
#endif
|
||||
#ifndef ESHUTDOWN /* Not in errno.h but wanted by POSIX.pm */
|
||||
# define ESHUTDOWN WSAESHUTDOWN
|
||||
#endif
|
||||
#ifndef ETOOMANYREFS /* Not in errno.h but wanted by POSIX.pm */
|
||||
# define ETOOMANYREFS WSAETOOMANYREFS
|
||||
#endif
|
||||
#ifndef ETIMEDOUT /* New in VC10 */
|
||||
# define ETIMEDOUT WSAETIMEDOUT
|
||||
#endif
|
||||
#ifndef ECONNREFUSED /* New in VC10 */
|
||||
# define ECONNREFUSED WSAECONNREFUSED
|
||||
#endif
|
||||
#ifndef ELOOP /* New in VC10 */
|
||||
# define ELOOP WSAELOOP
|
||||
#endif
|
||||
|
||||
/* ENAMETOOLONG is a standard errno.h value */
|
||||
|
||||
/* EHOSTDOWN is not in errno.h and despite being wanted by POSIX.pm we cannot
|
||||
* provide any sane value since there is no WSAEHOSTDOWN */
|
||||
|
||||
#ifndef EHOSTUNREACH /* New in VC10 */
|
||||
# define EHOSTUNREACH WSAEHOSTUNREACH
|
||||
#endif
|
||||
|
||||
/* ENOTEMPTY is a standard errno.h value */
|
||||
|
||||
#ifndef EPROCLIM /* Not in errno.h but wanted by POSIX.pm */
|
||||
# define EPROCLIM WSAEPROCLIM
|
||||
#endif
|
||||
#ifndef EUSERS /* Not in errno.h but wanted by POSIX.pm */
|
||||
# define EUSERS WSAEUSERS
|
||||
#endif
|
||||
#ifndef EDQUOT /* Not in errno.h but wanted by POSIX.pm */
|
||||
# define EDQUOT WSAEDQUOT
|
||||
#endif
|
||||
#ifndef ESTALE /* Not in errno.h but wanted by POSIX.pm */
|
||||
# define ESTALE WSAESTALE
|
||||
#endif
|
||||
#ifndef EREMOTE /* Not in errno.h but wanted by POSIX.pm */
|
||||
# define EREMOTE WSAEREMOTE
|
||||
#endif
|
||||
|
||||
/* EDISCON is not an errno.h value at all */
|
||||
/* ENOMORE is not an errno.h value at all */
|
||||
|
||||
#ifndef ECANCELED /* New in VC10 */
|
||||
# ifdef WSAECANCELLED /* New in WinSock2 */
|
||||
# define ECANCELED WSAECANCELLED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* EINVALIDPROCTABLE is not an errno.h value at all */
|
||||
/* EINVALIDPROVIDER is not an errno.h value at all */
|
||||
/* EPROVIDERFAILEDINIT is not an errno.h value at all */
|
||||
/* EREFUSED is not an errno.h value at all */
|
||||
|
||||
/* Set a flag indicating whether <errno.h> has the POSIX supplement (the first
|
||||
* constant in which is EADDRINUSE). If so then we won't have just defined it as
|
||||
* WSAEADDRINUSE above.
|
||||
*/
|
||||
#undef ERRNO_HAS_POSIX_SUPPLEMENT
|
||||
#if EADDRINUSE != WSAEADDRINUSE
|
||||
# define ERRNO_HAS_POSIX_SUPPLEMENT
|
||||
#endif
|
||||
|
||||
#endif /* _INC_SYS_ERRNO2 */
|
||||
174
database/perl/lib/CORE/sys/socket.h
Normal file
174
database/perl/lib/CORE/sys/socket.h
Normal file
@@ -0,0 +1,174 @@
|
||||
/* sys/socket.h */
|
||||
|
||||
/* djl */
|
||||
/* Provide UNIX compatibility */
|
||||
|
||||
#ifndef _INC_SYS_SOCKET
|
||||
#define _INC_SYS_SOCKET
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#ifdef __GNUC__
|
||||
# define Win32_Winsock
|
||||
#endif
|
||||
#include <windows.h>
|
||||
|
||||
/* Too late to include winsock2.h if winsock.h has already been loaded */
|
||||
#ifndef _WINSOCKAPI_
|
||||
# include <winsock2.h>
|
||||
# include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
/* Early Platform SDKs have an incorrect definition of EAI_NODATA */
|
||||
#if (EAI_NODATA == EAI_NONAME)
|
||||
# undef EAI_NODATA
|
||||
# define EAI_NODATA WSANO_DATA
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "errno2.h"
|
||||
|
||||
#ifndef PERL_FD_SETSIZE
|
||||
#define PERL_FD_SETSIZE 64
|
||||
#endif
|
||||
|
||||
#define PERL_BITS_PER_BYTE 8
|
||||
#define PERL_NFDBITS (sizeof(Perl_fd_mask)*PERL_BITS_PER_BYTE)
|
||||
|
||||
typedef int Perl_fd_mask;
|
||||
|
||||
typedef struct Perl_fd_set {
|
||||
Perl_fd_mask bits[(PERL_FD_SETSIZE+PERL_NFDBITS-1)/PERL_NFDBITS];
|
||||
} Perl_fd_set;
|
||||
|
||||
#define PERL_FD_CLR(n,p) \
|
||||
((p)->bits[(n)/PERL_NFDBITS] &= ~((unsigned)1 << ((n)%PERL_NFDBITS)))
|
||||
|
||||
#define PERL_FD_SET(n,p) \
|
||||
((p)->bits[(n)/PERL_NFDBITS] |= ((unsigned)1 << ((n)%PERL_NFDBITS)))
|
||||
|
||||
#define PERL_FD_ZERO(p) memset((char *)(p),0,sizeof(*(p)))
|
||||
|
||||
#define PERL_FD_ISSET(n,p) \
|
||||
((p)->bits[(n)/PERL_NFDBITS] & ((unsigned)1 << ((n)%PERL_NFDBITS)))
|
||||
|
||||
SOCKET win32_accept (SOCKET s, struct sockaddr *addr, int *addrlen);
|
||||
int win32_bind (SOCKET s, const struct sockaddr *addr, int namelen);
|
||||
int win32_closesocket (SOCKET s);
|
||||
int win32_connect (SOCKET s, const struct sockaddr *name, int namelen);
|
||||
int win32_ioctlsocket (SOCKET s, long cmd, u_long *argp);
|
||||
int win32_getpeername (SOCKET s, struct sockaddr *name, int * namelen);
|
||||
int win32_getsockname (SOCKET s, struct sockaddr *name, int * namelen);
|
||||
int win32_getsockopt (SOCKET s, int level, int optname, char * optval, int *optlen);
|
||||
u_long win32_htonl (u_long hostlong);
|
||||
u_short win32_htons (u_short hostshort);
|
||||
unsigned long win32_inet_addr (const char * cp);
|
||||
char * win32_inet_ntoa (struct in_addr in);
|
||||
int win32_listen (SOCKET s, int backlog);
|
||||
u_long win32_ntohl (u_long netlong);
|
||||
u_short win32_ntohs (u_short netshort);
|
||||
int win32_recv (SOCKET s, char * buf, int len, int flags);
|
||||
int win32_recvfrom (SOCKET s, char * buf, int len, int flags,
|
||||
struct sockaddr *from, int * fromlen);
|
||||
int win32_select (int nfds, Perl_fd_set *rfds, Perl_fd_set *wfds, Perl_fd_set *xfds,
|
||||
const struct timeval *timeout);
|
||||
int win32_send (SOCKET s, const char * buf, int len, int flags);
|
||||
int win32_sendto (SOCKET s, const char * buf, int len, int flags,
|
||||
const struct sockaddr *to, int tolen);
|
||||
int win32_setsockopt (SOCKET s, int level, int optname,
|
||||
const char * optval, int optlen);
|
||||
SOCKET win32_socket (int af, int type, int protocol);
|
||||
int win32_shutdown (SOCKET s, int how);
|
||||
|
||||
/* Database function prototypes */
|
||||
|
||||
struct hostent * win32_gethostbyaddr(const char * addr, int len, int type);
|
||||
struct hostent * win32_gethostbyname(const char * name);
|
||||
int win32_gethostname (char * name, int namelen);
|
||||
struct servent * win32_getservbyport(int port, const char * proto);
|
||||
struct servent * win32_getservbyname(const char * name, const char * proto);
|
||||
struct protoent * win32_getprotobynumber(int proto);
|
||||
struct protoent * win32_getprotobyname(const char * name);
|
||||
struct protoent *win32_getprotoent(void);
|
||||
struct servent *win32_getservent(void);
|
||||
void win32_sethostent(int stayopen);
|
||||
void win32_setnetent(int stayopen);
|
||||
struct netent * win32_getnetent(void);
|
||||
struct netent * win32_getnetbyname(char *name);
|
||||
struct netent * win32_getnetbyaddr(long net, int type);
|
||||
void win32_setprotoent(int stayopen);
|
||||
void win32_setservent(int stayopen);
|
||||
void win32_endhostent(void);
|
||||
void win32_endnetent(void);
|
||||
void win32_endprotoent(void);
|
||||
void win32_endservent(void);
|
||||
|
||||
#ifndef WIN32SCK_IS_STDSCK
|
||||
|
||||
/* direct to our version */
|
||||
|
||||
#define htonl win32_htonl
|
||||
#define htons win32_htons
|
||||
#define ntohl win32_ntohl
|
||||
#define ntohs win32_ntohs
|
||||
#define inet_addr win32_inet_addr
|
||||
#define inet_ntoa win32_inet_ntoa
|
||||
|
||||
#define socket win32_socket
|
||||
#define bind win32_bind
|
||||
#define listen win32_listen
|
||||
#define accept win32_accept
|
||||
#define connect win32_connect
|
||||
#define send win32_send
|
||||
#define sendto win32_sendto
|
||||
#define recv win32_recv
|
||||
#define recvfrom win32_recvfrom
|
||||
#define shutdown win32_shutdown
|
||||
#define closesocket win32_closesocket
|
||||
#define ioctlsocket win32_ioctlsocket
|
||||
#define setsockopt win32_setsockopt
|
||||
#define getsockopt win32_getsockopt
|
||||
#define getpeername win32_getpeername
|
||||
#define getsockname win32_getsockname
|
||||
#define gethostname win32_gethostname
|
||||
#define gethostbyname win32_gethostbyname
|
||||
#define gethostbyaddr win32_gethostbyaddr
|
||||
#define getprotobyname win32_getprotobyname
|
||||
#define getprotobynumber win32_getprotobynumber
|
||||
#define getservbyname win32_getservbyname
|
||||
#define getservbyport win32_getservbyport
|
||||
#define select win32_select
|
||||
#define endhostent win32_endhostent
|
||||
#define endnetent win32_endnetent
|
||||
#define endprotoent win32_endprotoent
|
||||
#define endservent win32_endservent
|
||||
#define getnetent win32_getnetent
|
||||
#define getnetbyname win32_getnetbyname
|
||||
#define getnetbyaddr win32_getnetbyaddr
|
||||
#define getprotoent win32_getprotoent
|
||||
#define getservent win32_getservent
|
||||
#define sethostent win32_sethostent
|
||||
#define setnetent win32_setnetent
|
||||
#define setprotoent win32_setprotoent
|
||||
#define setservent win32_setservent
|
||||
|
||||
#undef fd_set
|
||||
#undef FD_SET
|
||||
#undef FD_CLR
|
||||
#undef FD_ISSET
|
||||
#undef FD_ZERO
|
||||
#define fd_set Perl_fd_set
|
||||
#define FD_SET(n,p) PERL_FD_SET(n,p)
|
||||
#define FD_CLR(n,p) PERL_FD_CLR(n,p)
|
||||
#define FD_ISSET(n,p) PERL_FD_ISSET(n,p)
|
||||
#define FD_ZERO(p) PERL_FD_ZERO(p)
|
||||
|
||||
#endif /* WIN32SCK_IS_STDSCK */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _INC_SYS_SOCKET */
|
||||
Reference in New Issue
Block a user