diff --git a/contrib/win32/openssh/openbsd_compat.vcxproj b/contrib/win32/openssh/openbsd_compat.vcxproj
index 5a69ee4..3158bb0 100644
--- a/contrib/win32/openssh/openbsd_compat.vcxproj
+++ b/contrib/win32/openssh/openbsd_compat.vcxproj
@@ -75,7 +75,6 @@
-
@@ -121,7 +120,6 @@
-
diff --git a/contrib/win32/openssh/openbsd_compat.vcxproj.filters b/contrib/win32/openssh/openbsd_compat.vcxproj.filters
index 5db7122..826f9eb 100644
--- a/contrib/win32/openssh/openbsd_compat.vcxproj.filters
+++ b/contrib/win32/openssh/openbsd_compat.vcxproj.filters
@@ -180,9 +180,6 @@
Source Files
-
- Source Files
-
Source Files
@@ -314,9 +311,6 @@
Header Files
-
- Header Files
-
Header Files
diff --git a/contrib/win32/win32compat/inc/defs.h b/contrib/win32/win32compat/inc/defs.h
index f68b33e..d1429ca 100644
--- a/contrib/win32/win32compat/inc/defs.h
+++ b/contrib/win32/win32compat/inc/defs.h
@@ -30,44 +30,34 @@
#define FD_CLOEXEC 0x1
/* signal related defs*/
+/* signal types */
+#define W32_SIGINT 0
+#define W32_SIGSEGV 1
+
+#define W32_SIGPIPE 2
+#define W32_SIGCHLD 3
+#define W32_SIGALRM 4
+#define W32_SIGTSTP 5
+
+#define W32_SIGHUP 6
+#define W32_SIGQUIT 7
+#define W32_SIGTERM 8
+#define W32_SIGTTIN 9
+#define W32_SIGTTOU 10
+
+#define W32_SIGMAX 11
+
+/* signal action codes*/
+#define W32_SIG_DFL 0
+#define W32_SIG_IGN 1
+
+/* singprocmask "how" codes*/
+#define SIG_BLOCK 0
+#define SIG_UNBLOCK 1
+#define SIG_SETMASK 2
+
typedef void(*sighandler_t)(int);
-// Signal types
-#define SIGINT 2 // interrupt
-#define SIGSEGV 11 // segment violation
-
-#define SIGPIPE 27
-#define SIGCHLD 26
-#define SIGALRM 14
-#define SIGTSTP 5 //"CTRL+Z" - no portable number
-
-#define SIGHUP 1 //Terminate from console
-#define SIGQUIT 3
-#define SIGTERM 15// Software termination signal from kill
-#define SIGTTIN 6//noportabel number
-#define SIGTTOU 7 //no portable number
-
-
-
-//#define SIGINT 2 // interrupt
-//#define SIGILL 4 // illegal instruction - invalid function image
-//#define SIGFPE 8 // floating point exception
-//#define SIGSEGV 11 // segment violation
-//#define SIGTERM 15 // Software termination signal from kill
-//#define SIGBREAK 21 // Ctrl-Break sequence
-//#define SIGABRT 22 // abnormal termination triggered by abort call
-//#define SIGWINCH
-//
-//#define SIGABRT_COMPAT 6 // SIGABRT compatible with other platforms, same as SIGABRT
-//
-//#define SIGALRM 14
-//#define SIGCHLD 26
-//#define SIGHUP 1
-//#define SIGPIPE 27
-//#define SIGQUIT 3
-
-// Signal action codes
-#define SIG_DFL (0) // default signal action
-#define SIG_IGN (1) // ignore signal
-#define SIG_GET (2) // return current value
-#define SIG_SGE (3) // signal gets error
-#define SIG_ACK (4) // acknowledge
+typedef int sigset_t;
+#define sigemptyset(set) (memset( (set), 0, sizeof(sigset_t)))
+#define sigaddset(set, sig) ( (*(set)) |= (0x80000000 >> (sig)))
+#define sigismember(set, sig) ( (*(set) & (0x80000000 >> (sig)))?1:0 )
diff --git a/contrib/win32/win32compat/inc/signal.h b/contrib/win32/win32compat/inc/signal.h
index 506706a..ca35423 100644
--- a/contrib/win32/win32compat/inc/signal.h
+++ b/contrib/win32/win32compat/inc/signal.h
@@ -10,6 +10,23 @@
#define signal(a,b) w32_signal((a), (b))
#define mysignal(a,b) w32_signal((a), (b))
+#define raise(a) w32_raise(a)
+#define kill(a,b) w32_kill((a), (b))
+#define sigprocmask(a,b,c) w32_sigprocmask((a), (b), (c))
+#define SIGINT W32_SIGINT
+#define SIGSEGV W32_SIGSEGV
+#define SIGPIPE W32_SIGPIPE
+#define SIGCHLD W32_SIGCHLD
+#define SIGALRM W32_SIGALRM
+#define SIGSTP W32_SIGTSTP
+#define SIGHUP W32_SIGHUP
+#define SIGQUIT W32_SIGQUIT
+#define SIGTERM W32_SIGTERM
+#define SIGTTIN W32_SIGTTIN
+#define SIGTTOU W32_SIGTTOU
+
+#define SIG_DFL W32_SIG_DFL
+#define SIG_IGN W32_SIG_IGN
#endif
\ No newline at end of file
diff --git a/contrib/win32/win32compat/inc/w32posix.h b/contrib/win32/win32compat/inc/w32posix.h
index 20c107d..6bce5ab 100644
--- a/contrib/win32/win32compat/inc/w32posix.h
+++ b/contrib/win32/win32compat/inc/w32posix.h
@@ -68,6 +68,10 @@ int w32_dup2(int oldfd, int newfd);
/* misc */
unsigned int w32_alarm(unsigned int seconds);
sighandler_t w32_signal(int signum, sighandler_t handler);
+int w32_sigprocmask(int how, const sigset_t *set, sigset_t *oldset);
+int w32_raise(int sig);
+int w32_kill(int pid, int sig);
+
/* Shutdown constants */
#define SHUT_WR SD_SEND
@@ -106,7 +110,7 @@ int w32_temp_DelChildToWatch(HANDLE processtowatch);
int w32_temp_AddChildToWatch(HANDLE processtowatch);
HANDLE w32_fd_to_handle(int fd);
int w32_allocate_fd_for_handle(HANDLE h, BOOL is_sock);
-int signalio_add_child(HANDLE child);
+int sw_add_child(HANDLE child);
/* temporary definitions to aid in transition */
#define WSHELPDelChildToWatch(a) w32_temp_DelChildToWatch((a))
diff --git a/contrib/win32/win32compat/signal.c b/contrib/win32/win32compat/signal.c
index 654ccf3..65cf178 100644
--- a/contrib/win32/win32compat/signal.c
+++ b/contrib/win32/win32compat/signal.c
@@ -44,17 +44,12 @@ struct _children {
} children;
void
-signalio_initialize() {
+sw_initialize() {
memset(&children, 0, sizeof(children));
}
-sighandler_t w32_signal(int signum, sighandler_t handler) {
- /*TODO - implement signal()*/
- return 0;
-}
-
int
-signalio_add_child(HANDLE child) {
+sw_add_child(HANDLE child) {
if (children.num_children == MAX_CHILDREN) {
errno = ENOTSUP;
return -1;
@@ -64,7 +59,7 @@ signalio_add_child(HANDLE child) {
}
int
-signalio_remove_child_at_index(DWORD index) {
+sw_remove_child_at_index(DWORD index) {
if (index >= children.num_children) {
errno = EINVAL;
return -1;
@@ -81,13 +76,13 @@ signalio_remove_child_at_index(DWORD index) {
int
-signalio_remove_child(HANDLE child) {
+sw_remove_child(HANDLE child) {
HANDLE* handles = children.handles;
DWORD num_children = children.num_children;
while (num_children) {
if (*handles == child)
- return signalio_remove_child_at_index(children.num_children - num_children);
+ return sw_remove_child_at_index(children.num_children - num_children);
handles++;
num_children--;
}
@@ -97,6 +92,32 @@ signalio_remove_child(HANDLE child) {
}
+unsigned int
+sw_alarm(unsigned int seconds) {
+ return 0;
+}
+
+
+sighandler_t
+sw_signal(int signum, sighandler_t handler) {
+ return NULL;
+}
+
+int
+sw_sigprocmask(int how, const sigset_t *set, sigset_t *oldset) {
+ return 0;
+}
+
+int
+sw_raise(int sig) {
+ return 0;
+}
+
+int
+sw_kill(int pid, int sig) {
+ return 0;
+}
+
/*
* Main wait routine used by all blocking calls.
* It wakes up on
@@ -131,7 +152,7 @@ wait_for_any_event(HANDLE* events, int num_events, DWORD milli_seconds)
/* is this due to a child process going down*/
if (children.num_children && ((ret - WAIT_OBJECT_0) < children.num_children)) {
/* TODO - enable this once all direct closes are removed in core code*/
- //signalio_remove_child(ret - WAIT_OBJECT_0);
+ //sw_remove_child(ret - WAIT_OBJECT_0);
errno = EINTR;
return -1;
}
diff --git a/contrib/win32/win32compat/w32fd.c b/contrib/win32/win32compat/w32fd.c
index 0b46df9..99f4fac 100644
--- a/contrib/win32/win32compat/w32fd.c
+++ b/contrib/win32/win32compat/w32fd.c
@@ -124,7 +124,7 @@ w32posix_initialize() {
|| (socketio_initialize() != 0))
DebugBreak();
main_thread = OpenThread(THREAD_SET_CONTEXT, FALSE, GetCurrentThreadId());
- signalio_initialize();
+ sw_initialize();
}
void
@@ -739,21 +739,6 @@ w32_dup2(int oldfd, int newfd) {
return -1;
}
-unsigned int
-w32_alarm(unsigned int seconds) {
- /*TODO - implement alarm */
- return 0;
-}
-
-int
-w32_temp_DelChildToWatch(HANDLE processtowatch) {
- return 0;
-}
-
-int w32_temp_AddChildToWatch(HANDLE processtowatch) {
- return 0;
-}
-
HANDLE
w32_fd_to_handle(int fd) {
HANDLE h = fd_table.w32_ios[fd]->handle;
@@ -782,3 +767,28 @@ int w32_allocate_fd_for_handle(HANDLE h, BOOL is_sock) {
fd_table_set(pio, min_index);
return min_index;
}
+
+
+unsigned int
+w32_alarm(unsigned int seconds) {
+ return 0;
+}
+sighandler_t
+w32_signal(int signum, sighandler_t handler) {
+ return sw_signal(signum, handler);
+}
+
+int
+w32_sigprocmask(int how, const sigset_t *set, sigset_t *oldset) {
+ return sw_sigprocmask(how, set, oldset);
+}
+
+int
+w32_raise(int sig) {
+ return sw_raise(sig);
+}
+
+int
+w32_kill(int pid, int sig) {
+ return sw_kill(pid, sig);
+}
\ No newline at end of file
diff --git a/contrib/win32/win32compat/w32fd.h b/contrib/win32/win32compat/w32fd.h
index ba70181..96e2a9e 100644
--- a/contrib/win32/win32compat/w32fd.h
+++ b/contrib/win32/win32compat/w32fd.h
@@ -8,7 +8,7 @@
#include
#include
-#include "debug.h"
+#include "inc\defs.h"
enum w32_io_type {
UNKNOWN_FD = 0,
@@ -122,9 +122,14 @@ FILE* fileio_fdopen(struct w32_io* pio, const char *mode);
int termio_close(struct w32_io* pio);
/* signal related APIs*/
-void signalio_initialize();
-//int signalio_add_child(HANDLE child);
-//int signalio_remove_child(HANDLE child);
+void sw_initialize();
+int sw_add_child(HANDLE child);
+int sw_remove_child(HANDLE child);
+unsigned int sw_alarm(unsigned int seconds);
+sighandler_t sw_signal(int signum, sighandler_t handler);
+int sw_sigprocmask(int how, const sigset_t *set, sigset_t *oldset);
+int sw_raise(int sig);
+int sw_kill(int pid, int sig);
/*
* open() flags and modes
diff --git a/serverloop.c b/serverloop.c
index 321e868..738d60d 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -882,7 +882,7 @@ collect_children(void)
session_close_by_pid(s->pid, status);
- signalio_remove_child(process);
+ sw_remove_child(process);
}
}
diff --git a/session.c b/session.c
index b18eb35..ab1784c 100644
--- a/session.c
+++ b/session.c
@@ -920,7 +920,7 @@ do_exec_no_pty(Session *s, const char *command)
s -> pid = pi.hProcess;
s -> processId = pi.dwProcessId;
- signalio_add_child(pi.hProcess);
+ sw_add_child(pi.hProcess);
// Add the child process created to select mux so that during our select data call we know if the process has exited
/* TODO - fix thi s*/