summaryrefslogtreecommitdiff
path: root/src/compat.c
diff options
context:
space:
mode:
authortrystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b <trystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2005-02-06 19:18:15 +0000
committertrystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b <trystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2005-02-06 19:18:15 +0000
commit9b3a357193a020c53624b29f84e0bca4795722f0 (patch)
treebe1a500c8a469dad8164a72d1266780ac8c28510 /src/compat.c
parentf8ac398b86ea6a26dba62064d9810796466e4118 (diff)
BUILD : 1.7.8 (565) BUGS : 293 NOTES : Merge of Win32 branch into the main, support for Unreal +I, German language updated, fixed bug vidents not updating, Setting and Removal of sqlines on forbid or drop
git-svn-id: svn://svn.anope.org/anope/trunk@567 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@417 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/compat.c')
-rw-r--r--src/compat.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/compat.c b/src/compat.c
index 9db98fc0f..b9931ced9 100644
--- a/src/compat.c
+++ b/src/compat.c
@@ -136,19 +136,27 @@ char *strerror(int errnum)
/*************************************************************************/
#if !HAVE_STRSIGNAL
+/* Windows only supports 6 signals:
+ * SIGINT, SIGILL, SIGABRT, SIGFPE, SIGSEGV, SIGTERM
+ * -- codemastr
+ */
char *strsignal(int signum)
{
static char buf[32];
switch (signum) {
+#ifndef _WIN32
case SIGHUP:
strscpy(buf, "Hangup", sizeof(buf));
break;
+#endif
case SIGINT:
strscpy(buf, "Interrupt", sizeof(buf));
break;
+#ifndef _WIN32
case SIGQUIT:
strscpy(buf, "Quit", sizeof(buf));
break;
+#endif
#ifdef SIGILL
case SIGILL:
strscpy(buf, "Illegal instruction", sizeof(buf));
@@ -172,15 +180,18 @@ char *strsignal(int signum)
case SIGFPE:
strscpy(buf, "Floating point exception", sizeof(buf));
break;
+#ifndef _WIN32
case SIGKILL:
strscpy(buf, "Killed", sizeof(buf));
break;
case SIGUSR1:
strscpy(buf, "User signal 1", sizeof(buf));
break;
+#endif
case SIGSEGV:
strscpy(buf, "Segmentation fault", sizeof(buf));
break;
+#ifndef _WIN32
case SIGUSR2:
strscpy(buf, "User signal 2", sizeof(buf));
break;
@@ -190,9 +201,11 @@ char *strsignal(int signum)
case SIGALRM:
strscpy(buf, "Alarm clock", sizeof(buf));
break;
+#endif
case SIGTERM:
strscpy(buf, "Terminated", sizeof(buf));
break;
+#ifndef _WIN32
case SIGSTOP:
strscpy(buf, "Suspended (signal)", sizeof(buf));
break;
@@ -202,6 +215,7 @@ char *strsignal(int signum)
case SIGIO:
strscpy(buf, "I/O error", sizeof(buf));
break;
+#endif
default:
snprintf(buf, sizeof(buf), "Signal %d\n", signum);
break;
@@ -210,4 +224,25 @@ char *strsignal(int signum)
}
#endif
+#ifdef _WIN32
+
+#ifdef USE_THREADS
+/* Simulate pthread conditional variable waiting */
+int ano_cond_wait(ano_cond_t cond, ano_mutex_t mutex)
+{
+ ReleaseMutex(mutex);
+ if (WaitForSingleObject(cond, INFINITE) == WAIT_FAILED)
+ return 1;
+ if (WaitForSingleObject(mutex, INFINITE) == WAIT_FAILED)
+ return 1;
+ return 0;
+}
+
+/* Used for the cleanup functions */
+ano_thread_start __declspec(thread) cleanup_func = NULL;
+
+#endif
+
+#endif
+
/*************************************************************************/