From 5201df3dbc32ce72907a992488070f4bd3e3d513 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Sat, 2 Nov 1996 01:36:25 +0000 Subject: [PATCH] installed --- src/include/os/solaris/osiSock.h | 15 ++++ src/include/os/sun4/osiSock.h | 109 ++++++++++++++---------- src/include/os/vms/osiSock.h | 114 +++++++++++++++++++++++++ src/include/os/vxWorks/osiMutex.h | 126 ++++++++++++++++++++++++++++ src/include/os/vxWorks/osiSock.h | 14 ++++ src/libCom/osi/os/VMS/osiSock.h | 114 +++++++++++++++++++++++++ src/libCom/osi/os/solaris/osdSock.h | 15 ++++ src/libCom/osi/os/sun4/osdSock.h | 109 ++++++++++++++---------- src/libCom/osi/os/vxWorks/osdSock.h | 14 ++++ 9 files changed, 544 insertions(+), 86 deletions(-) create mode 100644 src/include/os/vms/osiSock.h create mode 100644 src/include/os/vxWorks/osiMutex.h create mode 100644 src/libCom/osi/os/VMS/osiSock.h diff --git a/src/include/os/solaris/osiSock.h b/src/include/os/solaris/osiSock.h index ee9338921..061189077 100644 --- a/src/include/os/solaris/osiSock.h +++ b/src/include/os/solaris/osiSock.h @@ -3,11 +3,18 @@ * Solaris specifif socket include */ +#ifndef osiSockH +#define osiSockH #ifdef __cplusplus extern "C" { #endif +#include + +#include +#include /* for MAXHOSTNAMELEN */ +#include #include #include #include @@ -15,14 +22,22 @@ extern "C" { #include #include #include +#include +void ipAddrToA(const struct sockaddr_in *pInetAddr, + char *pBuf, const unsigned bufSize); + #ifdef __cplusplus } #endif typedef int SOCKET; +#define INVALID_SOCKET (-1) #define SOCKERRNO errno #define socket_close(S) close(S) #define socket_ioctl(A,B,C) ioctl(A,B,C) +#define FD_IN_FDSET(FD) ((FD) + +#include +#include #include #include #include @@ -20,61 +23,81 @@ int close (int fd); int gettimeofday (struct timeval *tp, struct timezone *tzp); int gethostname (char *name, int namelen); +void ipAddrToA (const struct sockaddr_in *pInetAddr, + char *pBuf, const unsigned bufSize); + /* * sun's CC defines at least a few of these under sunos4 */ -#if defined(__SUNPRO_CC) +#if defined(__SUNPRO_CC) || defined(__SUNPRO_C) # include -#else +# include +#else /* !defined(__SUNPRO_CC) && !defined(__SUNPRO_C) */ + int listen (int socket, int backlog); + int accept (int socket, struct sockaddr *addr, int *addrlen); + int shutdown (int socket, int how); + int getpeername (int socket, struct sockaddr *name, int *namelen); + int connect (int socket, struct sockaddr *name, int namelen); + int setsockopt (int socket, int level, int optname, + char *optval, int optlen); + void bzero (char *b, int length); + int sendto (int socket, const char *buf, int len, + int flags, struct sockaddr *to, int tolen); + int select (int width, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, struct timeval *timeout); -int listen (int socket, int backlog); -int accept (int socket, struct sockaddr *addr, int *addrlen); -int shutdown (int socket, int how); -int getpeername (int socket, struct sockaddr *name, int *namelen); -int connect (int socket, struct sockaddr *name, int namelen); -int setsockopt (int socket, int level, int optname, - char *optval, int optlen); -void bzero (char *b, int length); -int sendto (int socket, const char *buf, int len, - int flags, struct sockaddr *to, int tolen); -int select (int width, fd_set *readfds, fd_set *writefds, - fd_set *exceptfds, struct timeval *timeout); + int bind (int socket, struct sockaddr *name, int namelen); + int send (int socket, const char *buf, int len, int flags); + int recv (int socket, char *buf, int len, int flags); + int getsockopt (int socket, int level, int optname, + char *optval, int *optlen); + int socket (int domain, int type, int protocol); + int recvfrom (int socket, char *buf, int len, + int flags, struct sockaddr *from, int *fromlen); + int getsockname (int socket, struct sockaddr *name, int *namelen); -int bind (int socket, struct sockaddr *name, int namelen); -int send (int socket, const char *buf, int len, int flags); -int recv (int socket, char *buf, int len, int flags); -int getsockopt (int socket, int level, int optname, - char *optval, int *optlen); -int socket (int domain, int type, int protocol); -int recvfrom (int socket, char *buf, int len, - int flags, struct sockaddr *from, int *fromlen); -int getsockname (int socket, struct sockaddr *name, int *namelen); + /* + * from /usr/include/arpa/inet.h + * (which under sunos4 does not include arguments for C++) + * (__SUNPRO_CC supplies this file but g++ does not supply + * an ansi protottype) + */ + unsigned long inet_addr (char *); + char * inet_ntoa (struct in_addr in); -/* - * from /usr/include/arpa/inet.h - * (which under sunos4 does not include arguments for C++) - * (__SUNPRO_CC supplies this file but g++ does not supply an ansi protottype) - */ -unsigned long inet_addr (char *); -char * inet_ntoa (struct in_addr in); - -/* - * from /usr/include/netdb.h - * (which under sunos4 does not include arguments for C++) - * (__SUNPRO_CC supplies this file but g++ does not) - */ -struct hostent *gethostbyaddr(char *addr, int len, int type); - -#endif /* !defined(__SUNPRO_CC) */ + /* + * from /usr/include/netdb.h + * (which under sunos4 does not include arguments for C++) + * (__SUNPRO_CC supplies an updated version of this file but g++ does not) + */ + struct hostent { + char *h_name; /* official name of host */ + char **h_aliases; /* alias list */ + int h_addrtype; /* host address type */ + int h_length; /* length of address */ + char **h_addr_list; /* list of addresses from name server */ +# define h_addr h_addr_list[0] /* address, for backward compatiblity */ + }; + struct hostent *gethostbyaddr(char *addr, int len, int type); +#endif /* !defined(__SUNPRO_CC) && !defined(__SUNPRO_C) */ #ifdef __cplusplus } #endif typedef int SOCKET; +#define INVALID_SOCKET (-1) #define SOCKERRNO errno #define socket_close(S) close(S) #define socket_ioctl(A,B,C) ioctl(A,B,C) +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 64 +#endif + +#define FD_IN_FDSET(FD) ((FD) +#if !defined(UCX) +# include +# include +# include +#else +# include +#endif +#include +#include +#include +#include + +int ioctl (int fd, int req, ...); +int close (int fd); +int gettimeofday (struct timeval *tp, struct timezone *tzp); +int gethostname (char *name, int namelen); + +/* + * MULTINET defines none of these + */ +int listen (int socket, int backlog); +int accept (int socket, struct sockaddr *addr, int *addrlen); +int shutdown (int socket, int how); +int getpeername (int socket, struct sockaddr *name, int *namelen); +int connect (int socket, struct sockaddr *name, int namelen); +int setsockopt (int socket, int level, int optname, + char *optval, int optlen); +void bzero (char *b, int length); +int sendto (int socket, const char *buf, int len, + int flags, struct sockaddr *to, int tolen); +int select (int width, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, struct timeval *timeout); + +int bind (int socket, struct sockaddr *name, int namelen); +int send (int socket, const char *buf, int len, int flags); +int recv (int socket, char *buf, int len, int flags); +int getsockopt (int socket, int level, int optname, + char *optval, int *optlen); +int socket (int domain, int type, int protocol); +int recvfrom (int socket, char *buf, int len, + int flags, struct sockaddr *from, int *fromlen); + int getsockname (int socket, struct sockaddr *name, int *namelen); + +unsigned long inet_addr (char *); +char * inet_ntoa (struct in_addr in); + +struct hostent { + char *h_name; /* official name of host */ + char **h_aliases; /* alias list */ + int h_addrtype; /* host address type */ + int h_length; /* length of address */ + char **h_addr_list; /* list of addresses from name server */ +#define h_addr h_addr_list[0] /* address, for backward compatiblity */ +}; +struct hostent *gethostbyaddr(char *addr, int len, int type); + +void ipAddrToA (const struct sockaddr_in *pInetAddr, + char *pBuf, const unsigned bufSize); + +#ifdef __cplusplus +} +#endif + +typedef int SOCKET; +#define INVALID_SOCKET (-1) +#define socket_close(S) close(S) +#define socket_ioctl(A,B,C) ioctl(A,B,C) + +#ifdef WINTCP + extern int uerrno; +# define SOCKERRNO uerrno +#else +# ifdef UCX +# define SOCKERRNO errno +# else +# define SOCKERRNO socket_errno +# endif +#endif + +#if defined(WINTCP) /* Wallangong */ + /* (the VAXC runtime lib has its own close */ +# define socket_close(S) netclose(S) +# define socket_ioctl(A,B,C) ioctl(A,B,C) +#endif +#if defined(UCX) /* GeG 09-DEC-1992 */ +# define socket_close(S) close(S) +# define socket_ioctl(A,B,C) ioctl(A,B,C) +#endif +# define POST_IO_EV +# define LOCK +# define UNLOCK +# define LOCKEVENTS +# define UNLOCKEVENTS +# define EVENTLOCKTEST (post_msg_active) +#endif + +#define MAXHOSTNAMELEN 75 + +#define FD_IN_FDSET(FD) ((FD) +#include +#include + +#define DEBUG_OSIMUTEX + +#ifdef DEBUG_OSIMUTEX +#include +#endif + +#ifdef DEBUG_OSIMUTEX +#define osiLock() osiLockI (__FILE__, __LINE__) +#define osiUnlock() osiUnlockI (__FILE__, __LINE__) +#endif + +class osiMutex { +public: + osiMutex() + { + mutex = NULL; + } + // + // constructor that returns status + // (since g++ does not have exceptions) + // + int init () + { + this->mutex = semMCreate(SEM_Q_PRIORITY|SEM_INVERSION_SAFE); + if (this->mutex==NULL) + { + return -1; + } +# ifdef DEBUG_OSIMUTEX + epicsPrintf("created mutex at %lx\n", + (unsigned long) this->mutex); +# endif + return 0; + } + + ~osiMutex() + { + STATUS s; + s = semDelete (this->mutex); + assert (s==OK); +# ifdef DEBUG_OSIMUTEX + epicsPrintf("destroyed mutex at %lx\n", + (unsigned long) this->mutex); +# endif + } + +#ifdef DEBUG_OSIMUTEX + void osiLockI(const char *pFN, unsigned ln) +#else + void osiLock() +#endif + { + STATUS s; + if (!this->mutex) { +# ifdef DEBUG_OSIMUTEX + epicsPrintf( + "osiMutex: lock request before init was ignored from %s at %u\n", + pFN, ln); +# else + epicsPrintf( + "osiMutex: lock request before init was ignored\n"); +# endif + return; + } + assert(this->mutex); + s = semTake (this->mutex, WAIT_FOREVER); + assert (s==OK); +# ifdef DEBUG_OSIMUTEX + epicsPrintf("L%lx in %s at %u\n", + (unsigned long) this->mutex, + pFN, ln); +# endif + } + +#ifdef DEBUG_OSIMUTEX + void osiUnlockI(const char *pFN, unsigned ln) +#else + void osiUnlock() +#endif + { + STATUS s; + + if (!this->mutex) { +# ifdef DEBUG_OSIMUTEX + epicsPrintf( + "osiMutex: unlock request before init was ignored from %s at %u\n", + pFN, ln); +# else + epicsPrintf( + "osiMutex: unlock request before init was ignored\n"); +# endif + return; + } + s = semGive (this->mutex); + assert (s==OK); +# ifdef DEBUG_OSIMUTEX + epicsPrintf("U%lx in %s at %d\n", + (unsigned long) this->mutex, + pFN, ln); +# endif + } + + void show(unsigned level) const + { + semShow(this->mutex, (int) level); + } +private: + SEM_ID mutex; +}; + diff --git a/src/include/os/vxWorks/osiSock.h b/src/include/os/vxWorks/osiSock.h index e74885a14..c573e6c30 100644 --- a/src/include/os/vxWorks/osiSock.h +++ b/src/include/os/vxWorks/osiSock.h @@ -2,11 +2,17 @@ * vxWorks specific socket include */ +#ifndef osiSockH +#define osiSockH #ifdef __cplusplus extern "C" { #endif +#include + +#include +#include #include #include #include @@ -14,13 +20,21 @@ extern "C" { #include #include +void ipAddrToA (const struct sockaddr_in *pInetAddr, + char *pBuf, const unsigned bufSize); + #ifdef __cplusplus } #endif typedef int SOCKET; +#define INVALID_SOCKET (-1) #define SOCKERRNO errno #define socket_close(S) close(S) #define socket_ioctl(A,B,C) ioctl(A,B,(int)C) +#define FD_IN_FDSET(FD) ((FD) +#if !defined(UCX) +# include +# include +# include +#else +# include +#endif +#include +#include +#include +#include + +int ioctl (int fd, int req, ...); +int close (int fd); +int gettimeofday (struct timeval *tp, struct timezone *tzp); +int gethostname (char *name, int namelen); + +/* + * MULTINET defines none of these + */ +int listen (int socket, int backlog); +int accept (int socket, struct sockaddr *addr, int *addrlen); +int shutdown (int socket, int how); +int getpeername (int socket, struct sockaddr *name, int *namelen); +int connect (int socket, struct sockaddr *name, int namelen); +int setsockopt (int socket, int level, int optname, + char *optval, int optlen); +void bzero (char *b, int length); +int sendto (int socket, const char *buf, int len, + int flags, struct sockaddr *to, int tolen); +int select (int width, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, struct timeval *timeout); + +int bind (int socket, struct sockaddr *name, int namelen); +int send (int socket, const char *buf, int len, int flags); +int recv (int socket, char *buf, int len, int flags); +int getsockopt (int socket, int level, int optname, + char *optval, int *optlen); +int socket (int domain, int type, int protocol); +int recvfrom (int socket, char *buf, int len, + int flags, struct sockaddr *from, int *fromlen); + int getsockname (int socket, struct sockaddr *name, int *namelen); + +unsigned long inet_addr (char *); +char * inet_ntoa (struct in_addr in); + +struct hostent { + char *h_name; /* official name of host */ + char **h_aliases; /* alias list */ + int h_addrtype; /* host address type */ + int h_length; /* length of address */ + char **h_addr_list; /* list of addresses from name server */ +#define h_addr h_addr_list[0] /* address, for backward compatiblity */ +}; +struct hostent *gethostbyaddr(char *addr, int len, int type); + +void ipAddrToA (const struct sockaddr_in *pInetAddr, + char *pBuf, const unsigned bufSize); + +#ifdef __cplusplus +} +#endif + +typedef int SOCKET; +#define INVALID_SOCKET (-1) +#define socket_close(S) close(S) +#define socket_ioctl(A,B,C) ioctl(A,B,C) + +#ifdef WINTCP + extern int uerrno; +# define SOCKERRNO uerrno +#else +# ifdef UCX +# define SOCKERRNO errno +# else +# define SOCKERRNO socket_errno +# endif +#endif + +#if defined(WINTCP) /* Wallangong */ + /* (the VAXC runtime lib has its own close */ +# define socket_close(S) netclose(S) +# define socket_ioctl(A,B,C) ioctl(A,B,C) +#endif +#if defined(UCX) /* GeG 09-DEC-1992 */ +# define socket_close(S) close(S) +# define socket_ioctl(A,B,C) ioctl(A,B,C) +#endif +# define POST_IO_EV +# define LOCK +# define UNLOCK +# define LOCKEVENTS +# define UNLOCKEVENTS +# define EVENTLOCKTEST (post_msg_active) +#endif + +#define MAXHOSTNAMELEN 75 + +#define FD_IN_FDSET(FD) ((FD) + +#include +#include /* for MAXHOSTNAMELEN */ +#include #include #include #include @@ -15,14 +22,22 @@ extern "C" { #include #include #include +#include +void ipAddrToA(const struct sockaddr_in *pInetAddr, + char *pBuf, const unsigned bufSize); + #ifdef __cplusplus } #endif typedef int SOCKET; +#define INVALID_SOCKET (-1) #define SOCKERRNO errno #define socket_close(S) close(S) #define socket_ioctl(A,B,C) ioctl(A,B,C) +#define FD_IN_FDSET(FD) ((FD) + +#include +#include #include #include #include @@ -20,61 +23,81 @@ int close (int fd); int gettimeofday (struct timeval *tp, struct timezone *tzp); int gethostname (char *name, int namelen); +void ipAddrToA (const struct sockaddr_in *pInetAddr, + char *pBuf, const unsigned bufSize); + /* * sun's CC defines at least a few of these under sunos4 */ -#if defined(__SUNPRO_CC) +#if defined(__SUNPRO_CC) || defined(__SUNPRO_C) # include -#else +# include +#else /* !defined(__SUNPRO_CC) && !defined(__SUNPRO_C) */ + int listen (int socket, int backlog); + int accept (int socket, struct sockaddr *addr, int *addrlen); + int shutdown (int socket, int how); + int getpeername (int socket, struct sockaddr *name, int *namelen); + int connect (int socket, struct sockaddr *name, int namelen); + int setsockopt (int socket, int level, int optname, + char *optval, int optlen); + void bzero (char *b, int length); + int sendto (int socket, const char *buf, int len, + int flags, struct sockaddr *to, int tolen); + int select (int width, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, struct timeval *timeout); -int listen (int socket, int backlog); -int accept (int socket, struct sockaddr *addr, int *addrlen); -int shutdown (int socket, int how); -int getpeername (int socket, struct sockaddr *name, int *namelen); -int connect (int socket, struct sockaddr *name, int namelen); -int setsockopt (int socket, int level, int optname, - char *optval, int optlen); -void bzero (char *b, int length); -int sendto (int socket, const char *buf, int len, - int flags, struct sockaddr *to, int tolen); -int select (int width, fd_set *readfds, fd_set *writefds, - fd_set *exceptfds, struct timeval *timeout); + int bind (int socket, struct sockaddr *name, int namelen); + int send (int socket, const char *buf, int len, int flags); + int recv (int socket, char *buf, int len, int flags); + int getsockopt (int socket, int level, int optname, + char *optval, int *optlen); + int socket (int domain, int type, int protocol); + int recvfrom (int socket, char *buf, int len, + int flags, struct sockaddr *from, int *fromlen); + int getsockname (int socket, struct sockaddr *name, int *namelen); -int bind (int socket, struct sockaddr *name, int namelen); -int send (int socket, const char *buf, int len, int flags); -int recv (int socket, char *buf, int len, int flags); -int getsockopt (int socket, int level, int optname, - char *optval, int *optlen); -int socket (int domain, int type, int protocol); -int recvfrom (int socket, char *buf, int len, - int flags, struct sockaddr *from, int *fromlen); -int getsockname (int socket, struct sockaddr *name, int *namelen); + /* + * from /usr/include/arpa/inet.h + * (which under sunos4 does not include arguments for C++) + * (__SUNPRO_CC supplies this file but g++ does not supply + * an ansi protottype) + */ + unsigned long inet_addr (char *); + char * inet_ntoa (struct in_addr in); -/* - * from /usr/include/arpa/inet.h - * (which under sunos4 does not include arguments for C++) - * (__SUNPRO_CC supplies this file but g++ does not supply an ansi protottype) - */ -unsigned long inet_addr (char *); -char * inet_ntoa (struct in_addr in); - -/* - * from /usr/include/netdb.h - * (which under sunos4 does not include arguments for C++) - * (__SUNPRO_CC supplies this file but g++ does not) - */ -struct hostent *gethostbyaddr(char *addr, int len, int type); - -#endif /* !defined(__SUNPRO_CC) */ + /* + * from /usr/include/netdb.h + * (which under sunos4 does not include arguments for C++) + * (__SUNPRO_CC supplies an updated version of this file but g++ does not) + */ + struct hostent { + char *h_name; /* official name of host */ + char **h_aliases; /* alias list */ + int h_addrtype; /* host address type */ + int h_length; /* length of address */ + char **h_addr_list; /* list of addresses from name server */ +# define h_addr h_addr_list[0] /* address, for backward compatiblity */ + }; + struct hostent *gethostbyaddr(char *addr, int len, int type); +#endif /* !defined(__SUNPRO_CC) && !defined(__SUNPRO_C) */ #ifdef __cplusplus } #endif typedef int SOCKET; +#define INVALID_SOCKET (-1) #define SOCKERRNO errno #define socket_close(S) close(S) #define socket_ioctl(A,B,C) ioctl(A,B,C) +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 64 +#endif + +#define FD_IN_FDSET(FD) ((FD) + +#include +#include #include #include #include @@ -14,13 +20,21 @@ extern "C" { #include #include +void ipAddrToA (const struct sockaddr_in *pInetAddr, + char *pBuf, const unsigned bufSize); + #ifdef __cplusplus } #endif typedef int SOCKET; +#define INVALID_SOCKET (-1) #define SOCKERRNO errno #define socket_close(S) close(S) #define socket_ioctl(A,B,C) ioctl(A,B,(int)C) +#define FD_IN_FDSET(FD) ((FD)