API changes

This commit is contained in:
Jeff Hill
1997-04-10 19:51:14 +00:00
parent 8e363122b3
commit eda3aae608
5 changed files with 111 additions and 1 deletions
+10
View File
@@ -0,0 +1,10 @@
#include "sigPipeIgnore.h"
/*
* NOOP
*/
void installSigPipeIgnore (void)
{
}
+10
View File
@@ -0,0 +1,10 @@
#include "sigPipeIgnore.h"
/*
* NOOP
*/
void installSigPipeIgnore (void)
{
}
+2 -1
View File
@@ -40,7 +40,8 @@
#include <osiSock.h>
/*
* inetAddrToHostName()
* ipAddrToA()
* (convert IP address to ASCII host name)
*/
void ipAddrToA (const struct sockaddr_in *pInetAddr, char *pBuf,
const unsigned bufSize)
+79
View File
@@ -0,0 +1,79 @@
/*
* install NOOP SIGPIPE handler
*
* escape into C to call signal because of a brain dead
* signal() func proto supplied in signal.h by gcc 2.7.2
*/
#include <signal.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include "sigPipeIgnore.h"
typedef void (*pSigFunc) ();
static pSigFunc pReplacedFunc;
static void localInstallSigPipeIgnore (void);
/*
* ignoreSigPipe ()
*/
static void ignoreSigPipe (int param)
{
if (pReplacedFunc) {
(*pReplacedFunc) (param);
}
/*
* some versios of unix reset to SIG_DFL
* each time that the signal occurs
*/
localInstallSigPipeIgnore ();
}
/*
* installSigPipeIgnore ()
*/
void installSigPipeIgnore (void)
{
static int init;
if (init) {
return;
}
localInstallSigPipeIgnore();
init = 1;
}
/*
* localInstallSigPipeIgnore ()
*
* dont allow disconnect to terminate process
* when running in UNIX environment
*
* allow error to be returned to sendto()
* instead of handling disconnect at interrupt
*/
static void localInstallSigPipeIgnore (void)
{
pSigFunc sigRet;
sigRet = signal (SIGPIPE, ignoreSigPipe);
if (sigRet==SIG_ERR) {
fprintf (stderr, "%s replace of SIGPIPE failed beacuse %s\n",
__FILE__, strerror(errno));
}
else if (sigRet!=SIG_DFL && sigRet!=SIG_IGN) {
pReplacedFunc = sigRet;
}
/*
* no infinite loops
*/
if (pReplacedFunc==ignoreSigPipe) {
pReplacedFunc = NULL;
}
}
+10
View File
@@ -0,0 +1,10 @@
#include "sigPipeIgnore.h"
/*
* NOOP
*/
void installSigPipeIgnore (void)
{
}