35 static void createInfoMutex (
void *unused)
39 static void lockInfo (
void)
46 static void unlockInfo (
void)
72 int domain,
int type,
int protocol )
74 SOCKET sock = socket ( domain, type, protocol );
79 int status = fcntl ( sock, F_SETFD, FD_CLOEXEC );
84 "epicsSocketCreate: failed to " 85 "fcntl FD_CLOEXEC because \"%s\"\n",
95 int sock,
struct sockaddr * pAddr,
osiSocklen_t * addrlen )
97 int newSock = accept ( sock, pAddr, addrlen );
102 int status = fcntl ( newSock, F_SETFD, FD_CLOEXEC );
107 "epicsSocketCreate: failed to " 108 "fcntl FD_CLOEXEC because \"%s\"\n",
124 "epicsSocketDestroy: failed to " 125 "close a socket because \"%s\"\n",
136 (
const struct in_addr *pAddr,
char *pBuf,
unsigned bufSize)
146 ent = gethostbyaddr((
const char *) pAddr,
sizeof (*pAddr), AF_INET);
148 strncpy (pBuf, ent->h_name, bufSize);
149 pBuf[bufSize-1] =
'\0';
162 (
const char *pHostName,
struct in_addr *pIPA)
168 phe = gethostbyname (pHostName);
169 if (phe && phe->h_addr_list[0]) {
170 if (phe->h_addrtype==AF_INET && phe->h_length<=
sizeof(
struct in_addr)) {
171 struct in_addr *pInAddrIn = (
struct in_addr *) phe->h_addr_list[0];
LIBCOM_API void epicsStdCall epicsSocketDestroy(SOCKET s)
An EPICS-specific replacement for ANSI C's assert.
pvd::StructureConstPtr type
LIBCOM_API int epicsStdCall hostToIPAddr(const char *pHostName, struct in_addr *pIPA)
#define epicsMutexMustCreate()
Create an epicsMutex semaphore for use from C code.
void epicsStdCall epicsMutexUnlock(epicsMutexId pmutexNode)
Release the semaphore.
void epicsSocketConvertErrnoToString(char *pBuf, unsigned bufSize)
LIBCOM_API SOCKET epicsStdCall epicsSocketCreate(int domain, int type, int protocol)
#define EPICS_THREAD_ONCE_INIT
APIs for the epicsMutex mutual exclusion semaphore.
LIBCOM_API void epicsStdCall epicsThreadOnce(epicsThreadOnceId *id, EPICSTHREADFUNC, void *arg)
LIBCOM_API int epicsStdCall epicsSocketAccept(int sock, struct sockaddr *pAddr, osiSocklen_t *addrlen)
int errlogPrintf(const char *pFormat,...)
APIs for the epicsEvent binary semaphore.
LIBCOM_API unsigned epicsStdCall ipAddrToHostName(const struct in_addr *pAddr, char *pBuf, unsigned bufSize)
C++ and C descriptions for a thread.
#define epicsMutexMustLock(ID)
Claim a semaphore (see epicsMutexLock()).