#include "libComAPI.h"
#include "osiSock.h"
#include "iocLog.h"
Go to the source code of this file.
LIBCOM_API void epicsStdCall iocLogPrefix |
( |
const char * |
prefix | ) |
|
Definition at line 549 of file logClient.c.
558 if (logClientPrefix) {
559 printf (
"iocLogPrefix: The prefix was already set to \"%s\" " 560 "and can't be changed.\n", logClientPrefix);
565 unsigned prefixLen = strlen(prefix);
567 char * localCopy = malloc(prefixLen+1);
568 strcpy(localCopy, prefix);
569 logClientPrefix = localCopy;
LIBCOM_API logClientId epicsStdCall logClientCreate |
( |
struct in_addr |
server_addr, |
|
|
unsigned short |
server_port |
|
) |
| |
Definition at line 453 of file logClient.c.
458 pClient = calloc (1,
sizeof (*pClient));
463 pClient->
addr.sin_family = AF_INET;
464 pClient->
addr.sin_addr = server_addr;
465 pClient->
addr.sin_port = htons(server_port);
469 if ( ! pClient->
mutex ) {
500 logClientRestart, pClient );
506 fprintf(
stderr,
"log client: unable to start reconnection thread\n");
510 return (
void *) pClient;
void epicsStdCall epicsMutexDestroy(epicsMutexId pmutexNode)
Destroy an epicsMutex semaphore.
epicsEventId stateChangeNotify
LIBCOM_API unsigned int epicsStdCall epicsThreadGetStackSize(epicsThreadStackSizeClass size)
epicsThreadId epicsStdCall epicsThreadCreate(const char *name, unsigned int priority, unsigned int stackSize, EPICSTHREADFUNC funptr, void *parm)
epicsEventId shutdownNotify
#define epicsThreadPriorityLow
LIBCOM_API void epicsEventDestroy(epicsEventId id)
Destroy an epicsEvent and any resources it holds.
#define epicsMutexCreate()
Create an epicsMutex semaphore for use from C code.
#define epicsAtExit(F, A)
Convenience macro to register a function and context value to be run when the process exits...
LIBCOM_API epicsEventId epicsEventCreate(epicsEventInitialState initialState)
Create an epicsEvent for use from C code, or return NULL.
epicsThreadId restartThreadId
unsigned epicsStdCall ipAddrToDottedIP(const struct sockaddr_in *paddr, char *pBuf, unsigned bufSize)
LIBCOM_API void epicsStdCall logClientFlush |
( |
logClientId |
id | ) |
|
Definition at line 219 of file logClient.c.
226 if ( ! pClient || ! pClient->
connected ) {
233 while ( nSent < pClient->nextMsgIndex && pClient->
connected ) {
234 status = send ( pClient->
sock, pClient->
msgBuf + nSent,
236 if ( status < 0 )
break;
240 if ( pClient->
backlog > 0 && status >= 0 ) {
244 status = send ( pClient->
sock,
NULL, 0, 0 );
250 char sockErrBuf[128];
252 fprintf(
stderr,
"log client: lost contact with log server at '%s'\n" 253 " because \"%s\"\n", pClient->
name, sockErrBuf);
256 logClientClose ( pClient );
int epicsSocketUnsentCount(SOCKET sock)
void epicsStdCall epicsMutexUnlock(epicsMutexId pmutexNode)
Release the semaphore.
void epicsSocketConvertErrnoToString(char *pBuf, unsigned bufSize)
#define epicsMutexMustLock(ID)
Claim a semaphore (see epicsMutexLock()).
LIBCOM_API logClientId epicsStdCall logClientInit |
( |
void |
| ) |
|
Definition at line 157 of file iocLog.c.
159 return iocLogClientInit ();
LIBCOM_API void epicsStdCall logClientSend |
( |
logClientId |
id, |
|
|
const char * |
message |
|
) |
| |
Definition at line 200 of file logClient.c.
204 if ( ! pClient || ! message ) {
210 if (logClientPrefix) {
211 sendMessageChunk(pClient, logClientPrefix);
213 sendMessageChunk(pClient, message);
void epicsStdCall epicsMutexUnlock(epicsMutexId pmutexNode)
Release the semaphore.
#define epicsMutexMustLock(ID)
Claim a semaphore (see epicsMutexLock()).
LIBCOM_API void epicsStdCall logClientShow |
( |
logClientId |
id, |
|
|
unsigned |
level |
|
) |
| |
Definition at line 516 of file logClient.c.
521 printf (
"log client: connected to log server at '%s'\n", pClient->
name);
524 printf (
"log client: disconnected from log server at '%s'\n",
528 if (logClientPrefix) {
529 printf (
"log client: prefix is \"%s\"\n", logClientPrefix);
533 printf (
"log client: sock %s, connect cycles = %u\n",
540 printf(
"-------------------------\n" 541 "%.*s-------------------------\n",