Remove dead code

Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
This commit is contained in:
Jeroen Koekkoek 2018-12-28 06:00:17 +01:00
parent 3c0b86df9c
commit a2aab8eab2
6 changed files with 4 additions and 88 deletions

View file

@ -186,31 +186,6 @@ extern "C" {
const char *format,
va_list args);
/** \brief fprintf wrapper with disabled broken pipe signals
*
* A fprintf can cause an broken pipe signal that can result in a deadlock
* if the interrupted thread is holding recourses needed by for example the
* signal handler thread.
*
* Precondition:
* None
* Postcondition:
* None
*
* Possible results:
* - return
* Upon successful completion will return the number of
* bytes written to file
* or a negative value if an error occurred.
* errno will be set in such case
* - Writes formatted output to file.
*/
int
os_vfprintfnosigpipe(
FILE *file,
const char *format,
va_list args);
/** \brief strtoll wrapper
*
* Translate string str to long long value considering base,

View file

@ -17,7 +17,6 @@
* \brief Initialization / Deinitialization
*/
#include <sys/utsname.h>
#include <assert.h>
#include "os/os.h"

View file

@ -58,42 +58,6 @@ os_vsnprintf(
return vsnprintf(str, size, format, args);
}
int
os_vfprintfnosigpipe(
FILE *file,
const char *format,
va_list args)
{
int result;
sigset_t sset_before, sset_omask, sset_pipe, sset_after;
sigemptyset(&sset_pipe);
sigaddset(&sset_pipe, SIGPIPE);
sigpending(&sset_before);
pthread_sigmask(SIG_BLOCK, &sset_pipe, &sset_omask);
result = vfprintf(file, format, args);
sigpending(&sset_after);
if (!sigismember(&sset_before, SIGPIPE) && sigismember(&sset_after, SIGPIPE)) {
/* sigtimedwait appears to be fairly well supported, just not by Mac OS. If other platforms prove to be a problem, we can do a proper indication of platform support in the os defs. The advantage of sigtimedwait is that it protects against a deadlock when SIGPIPE is sent from outside the program and all threads have it blocked. In any case, when SIGPIPE is sent in this manner and we consume the signal here, the signal is lost. Nobody should be abusing system-generated signals in this manner. */
#ifndef __APPLE__
struct timespec timeout = { 0, 0 };
sigtimedwait(&sset_pipe, NULL, &timeout);
#else
int sig;
sigwait(&sset_pipe, &sig);
#endif
#ifndef NDEBUG
sigpending(&sset_after);
assert(!sigismember(&sset_after, SIGPIPE));
#endif
os_setErrno(EPIPE);
result = -1;
}
pthread_sigmask(SIG_SETMASK, &sset_omask, NULL);
return result;
}
ssize_t os_write(int fd, const void *buf, size_t count)
{
return write(fd, buf, count);

View file

@ -88,16 +88,6 @@ os_putenv(
return result;
}
#pragma warning( disable : 4996 )
int
os_vfprintfnosigpipe(
FILE *file,
const char *format,
va_list args)
{
return vfprintf(file, format, args);
}
#pragma warning( disable : 4996 )
int
os_vsnprintf(