Index: trunk/src/kash/Makefile.kmk
===================================================================
--- trunk/src/kash/Makefile.kmk	(revision 1778)
+++ trunk/src/kash/Makefile.kmk	(revision 1784)
@@ -38,4 +38,5 @@
 kash_DEFS.linux = BSD
 kash_DEFS.solaris = BSD
+## @todo bring over PC_SLASHES?
 kash_DEFS.win = \
 	BSD PC_PATH_SEP PC_DRIVE_LETTERS PC_EXE_EXTS YY_NO_UNISTD_H
@@ -50,4 +51,7 @@
 	HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME
 kash_INCS = $(PATH_kash) . # (the last is because of error.h)
+if "$(USER)" == "bird" && "$(KBUILD_TARGET)" != "win"
+kash_CFLAGS += -std=gnu99
+endif
 kash_SOURCES = \
 	main.c \
@@ -97,5 +101,5 @@
 	strlcpy.c
 
-kash_ORDERDEPS = \
+kash_INTERMEDIATES = \
 	$(PATH_kash)/arith.h \
 	$(PATH_kash)/builtins.h \
@@ -103,5 +107,5 @@
 	$(PATH_kash)/token.h
 kash_CLEAN = \
-	$(kash_ORDERDEPS)	\
+	$(kash_INTERMEDIATES) \
 	$(PATH_kash)/arith.c \
 	$(PATH_kash)/arith_lex.c \
@@ -118,5 +122,5 @@
 
 
-ifeq ($(filter-out win,$(KBUILD_TARGET)),)
+if1of ($(KBUILD_TARGET), win)
 
 #
@@ -127,9 +131,5 @@
 kash_SOURCES := $(patsubst $(PATH_kash)/%,generated/%,$(kash_SOURCES))
 
-include $(FILE_KBUILD_SUB_FOOTER)
-
 else
-
-include $(FILE_KBUILD_SUB_FOOTER)
 
 #
@@ -142,29 +142,45 @@
 #
 BOOTSTRAP_SHELL ?= $(SHELL)
-YACC ?= yacc
+ifndef YACC
+ YACC := $(firstword $(which byacc) $(which yacc) yacc)
+endif
 
-$(PATH_kash)/arith.h $(PATH_kash)/arith.c: arith.y | $(call DIRDEP,$(PATH_kash))
+$$(PATH_kash)/arith.h + $$(PATH_kash)/arith.c: arith.y | $$(dir $$@)
 	$(YACC) -ld $^
 	$(MV) -f y.tab.c $(PATH_kash)/arith.c
 	$(MV) -f y.tab.h $(PATH_kash)/arith.h
 
-$(PATH_kash)/arith_lex.c: arith_lex.l | $(call DIRDEP,$(PATH_kash))
+$$(PATH_kash)/arith_lex.c: $$(kash_DEFPATH)/arith_lex.l | $$(dir $$@)
 	flex -8 -o$@ $^                     # 8-bit lex scanner for arithmetic
 
-$(PATH_kash)/builtins.h $(PATH_kash)/builtins.c: $(kash_PATH)/mkbuiltins shell.h builtins.def | $(call DIRDEP,$(PATH_kash))
+$$(PATH_kash)/builtins.h + $$(PATH_kash)/builtins.c: \
+		$$(kash_DEFPATH)/mkbuiltins \
+		$$(kash_DEFPATH)/shell.h \
+		$$(kash_DEFPATH)/builtins.def \
+		| $$(dir $$@)
 	$(BOOTSTRAP_SHELL) $+ $(dir $@)
 	[ -f $(PATH_kash)/builtins.h ]
 
-$(PATH_kash)/nodes.h $(PATH_kash)/nodes.c: $(kash_PATH)/mknodes.sh nodetypes nodes.c.pat | $(call DIRDEP,$(PATH_kash))
+$$(PATH_kash)/nodes.h + $$(PATH_kash)/nodes.c: \
+	$$(kash_DEFPATH)/mknodes.sh \
+	$$(kash_DEFPATH)/nodetypes \
+	$$(kash_DEFPATH)/nodes.c.pat \
+	| $$(dir $$@)
 	$(BOOTSTRAP_SHELL) $+ $(dir $@)
 	[ -f $(dir $@)/nodes.h ]
 
-$(PATH_kash)/token.h: $(kash_PATH)/mktokens | $(call DIRDEP,$(PATH_kash))
+$$(PATH_kash)/token.h: $$(kash_DEFPATH)/mktokens | $$(dir $$@)
 	$(BOOTSTRAP_SHELL) $+
 	$(MV) token.h $@
 
-$(PATH_kash)/init.c: $(kash_PATH)/mkinit.sh $(filter-out $(PATH_kash)/%,$(kash_SOURCES)) | $(call DIRDEP,$(PATH_kash))
+$$(PATH_kash)/init.c: \
+		$$(kash_DEFPATH)/mkinit.sh \
+		$$(abspathex $$(filter-out $$(PATH_kash)/%,$$(kash_SOURCES)), $$(kash_DEFPATH)) \
+		| $$(dir $$@)
 	$(BOOTSTRAP_SHELL) $+
 	$(MV) init.c $@
 
 endif
+
+include $(FILE_KBUILD_SUB_FOOTER)
+
Index: trunk/src/kash/output.c
===================================================================
--- trunk/src/kash/output.c	(revision 1778)
+++ trunk/src/kash/output.c	(revision 1784)
@@ -133,5 +133,5 @@
 	while (*p)
 		outc(*p++, file);
-	if (file == file->psh->out2)
+	if (file->psh && file == file->psh->out2)
 		flushout(file);
 }
Index: trunk/src/kash/shfile.h
===================================================================
--- trunk/src/kash/shfile.h	(revision 1778)
+++ trunk/src/kash/shfile.h	(revision 1784)
@@ -91,5 +91,5 @@
 # define R_OK       4
 
-# define O_NONBLOCK 0 /// @todo
+# define O_NONBLOCK 0 /** @todo */
 
 #endif
Index: trunk/src/kash/shinstance.c
===================================================================
--- trunk/src/kash/shinstance.c	(revision 1778)
+++ trunk/src/kash/shinstance.c	(revision 1784)
@@ -25,6 +25,10 @@
  */
 
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
 #include <string.h>
 #include <stdlib.h>
+#include <assert.h>
 #ifndef _MSC_VER
 # include <unistd.h>
@@ -35,4 +39,126 @@
 
 
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+/** The mutex protecting the the globals and some shell instance members (sigs). */
+static shmtx        g_sh_mtx;
+/** The root shell instance. */
+static shinstance  *g_sh_root;
+/** The first shell instance. */
+static shinstance  *g_sh_head;
+/** The last shell instance. */
+static shinstance  *g_sh_tail;
+/** The number of shells. */
+static int          g_num_shells;
+/** Per signal state for determining a common denominator.
+ * @remarks defaults and unmasked actions aren't counted. */
+struct shsigstate
+{
+    /** The current signal action. */
+#ifndef _MSC_VER
+    struct sigaction sa;
+#else
+    struct
+    {
+        void      (*sa_handler)(int);
+        int         sa_flags;
+        shsigset_t  sa_mask;
+    } sa;
+#endif
+    /** The number of restarts (siginterrupt / SA_RESTART). */
+    int num_restart;
+    /** The number of ignore handlers. */
+    int num_ignore;
+    /** The number of specific handlers. */
+    int num_specific;
+    /** The number of threads masking it. */
+    int num_masked;
+}                   g_sig_state[NSIG];
+
+
+
+typedef struct shmtxtmp { int i; } shmtxtmp;
+
+int shmtx_init(shmtx *pmtx)
+{
+    pmtx->b[0] = 0;
+    return 0;
+}
+
+void shmtx_delete(shmtx *pmtx)
+{
+    pmtx->b[0] = 0;
+}
+
+void shmtx_enter(shmtx *pmtx, shmtxtmp *ptmp)
+{
+    pmtx->b[0] = 0;
+    ptmp->i = 0;
+}
+
+void shmtx_leave(shmtx *pmtx, shmtxtmp *ptmp)
+{
+    pmtx->b[0] = 0;
+    ptmp->i = 432;
+}
+
+
+/**
+ * Links the shell instance.
+ *
+ * @param   psh     The shell.
+ */
+static void sh_int_link(shinstance *psh)
+{
+    shmtxtmp tmp;
+    shmtx_enter(&g_sh_mtx, &tmp);
+
+    if (psh->rootshell)
+        g_sh_root = psh;
+
+    psh->next = NULL;
+    psh->prev = g_sh_tail;
+    if (g_sh_tail)
+        g_sh_tail->next = psh;
+    else
+        g_sh_tail = g_sh_head = psh;
+    g_sh_tail = psh;
+
+    g_num_shells++;
+
+    shmtx_leave(&g_sh_mtx, &tmp);
+}
+
+
+/**
+ * Unlink the shell instance.
+ *
+ * @param   psh     The shell.
+ */
+static void sh_int_unlink(shinstance *psh)
+{
+    shmtxtmp tmp;
+    shmtx_enter(&g_sh_mtx, &tmp);
+
+    g_num_shells--;
+
+    if (g_sh_tail == psh)
+        g_sh_tail = psh->prev;
+    else
+        psh->next->prev = psh->prev;
+
+    if (g_sh_head == psh)
+        g_sh_head = psh->next;
+    else
+        psh->prev->next = psh->next;
+
+    if (g_sh_root == psh)
+        g_sh_root = 0;
+
+    shmtx_leave(&g_sh_mtx, &tmp);
+}
+
+
 /**
  * Creates a root shell instance.
@@ -47,4 +173,5 @@
 {
     shinstance *psh;
+    int i;
 
     psh = calloc(sizeof(*psh), 1);
@@ -57,4 +184,7 @@
         psh->pid = getpid();
 #endif
+        /*sh_sigemptyset(&psh->sigrestartset);*/
+        for (i = 0; i < NSIG; i++)
+            psh->sigactions[i].sh_handler = SH_SIG_UNK;
 
         /* memalloc.c */
@@ -85,6 +215,11 @@
 #if JOBS
         psh->curjob = -1;
+#else
+# error asdf
 #endif
         psh->ttyfd = -1;
+
+        /* link it. */
+        sh_int_link(psh);
 
     }
@@ -98,4 +233,5 @@
     return NULL;
 #elif defined(SH_STUB_MODE)
+    (void)psh;
     return getenv(var);
 #else
@@ -109,4 +245,5 @@
     return &s_null[0];
 #elif defined(SH_STUB_MODE)
+    (void)psh;
     return environ;
 #else
@@ -119,4 +256,5 @@
     return NULL;
 #elif defined(SH_STUB_MODE)
+    (void)psh;
 # ifdef _MSC_VER
     return NULL;
@@ -129,34 +267,219 @@
 }
 
+/**
+ * Lazy initialization of a signal state, globally.
+ *
+ * @param   psh         The shell doing the lazy work.
+ * @param   signo       The signal (valid).
+ */
+static void sh_int_lazy_init_sigaction(shinstance *psh, int signo)
+{
+    if (psh->sigactions[signo].sh_handler == SH_SIG_UNK)
+    {
+        shmtxtmp tmp;
+        shmtx_enter(&g_sh_mtx, &tmp);
+
+        if (psh->sigactions[signo].sh_handler == SH_SIG_UNK)
+        {
+            shsigaction_t shold;
+            shinstance *cur;
+#ifndef _MSC_VER
+            struct sigaction old;
+            if (!sigaction(signo, NULL, &old))
+            {
+                /* convert */
+                shold.sh_flags = old.sa_flags;
+                shold.sh_mask = old.sa_mask;
+                if (old.sa_handler == SIG_DFL)
+                    shold.sh_handler = SH_SIG_DFL;
+                else
+                {
+                    assert(old.sa_handler == SIG_IGN);
+                    shold.sh_handler = SH_SIG_IGN;
+                }
+            }
+            else
+#endif
+            {
+                /* fake */
+#ifndef _MSC_VER
+                assert(0);
+                old.sa_handler = SIG_DFL;
+                old.sa_flags = 0;
+                sigemptyset(&shold.sh_mask);
+                sigaddset(&shold.sh_mask, signo);
+#endif
+                shold.sh_flags = 0;
+                sh_sigemptyset(&shold.sh_mask);
+                sh_sigaddset(&shold.sh_mask, signo);
+                shold.sh_handler = SH_SIG_DFL;
+            }
+
+            /* update globals */
+#ifndef _MSC_VER
+            g_sig_state[signo].sa = old;
+#else
+            g_sig_state[signo].sa.sa_handle = SIG_DFL;
+            g_sig_state[signo].sa.sa_flags = 0;
+            g_sig_state[signo].sa.sa_mask = shold.sh_mask;
+#endif
+
+            /* update all shells */
+            for (cur = g_sh_head; cur; cur = cur->next)
+            {
+                assert(cur->sigactions[signo].sh_handler == SH_SIG_UNK);
+                cur->sigactions[signo] = shold;
+            }
+        }
+
+        shmtx_leave(&g_sh_mtx, &tmp);
+    }
+}
+
+
+/**
+ * Handler for external signals.
+ *
+ * @param   signo       The signal.
+ */
+static void sh_sig_common_handler(int signo)
+{
+
+}
+
+
 int sh_sigaction(shinstance *psh, int signo, const struct shsigaction *newp, struct shsigaction *oldp)
 {
-#ifdef SH_PURE_STUB_MODE
-    return -1;
-#elif defined(SH_STUB_MODE)
-# ifdef _MSC_VER
-    return -1;
-# else
-    struct sigaction old;
-    if (newp)
+    printf("sh_sigaction: signo=%d newp=%p oldp=%p\n", signo, newp, oldp);
+
+    /*
+     * Input validation.
+     */
+    if (signo >= NSIG || signo <= 0)
+    {
+        errno = EINVAL;
         return -1;
-    if (sigaction(signo, NULL, &old))
+    }
+
+#ifdef SH_PURE_STUB_MODE
+    return -1;
+#else
+
+    /*
+     * Make sure our data is correct.
+     */
+    sh_int_lazy_init_sigaction(psh, signo);
+
+    /*
+     * Get the old one if requested.
+     */
+    if (oldp)
+        *oldp = psh->sigactions[signo];
+
+    /*
+     * Set the new one if it has changed.
+     *
+     * This will be attempted coordinated with the other signal handlers so
+     * that we can arrive at a common denominator.
+     */
+    if (    newp
+        &&  memcmp(&psh->sigactions[signo], newp, sizeof(*newp)))
+    {
+        shmtxtmp tmp;
+        shmtx_enter(&g_sh_mtx, &tmp);
+
+        /* Undo the accounting for the current entry. */
+        if (psh->sigactions[signo].sh_handler == SH_SIG_IGN)
+            g_sig_state[signo].num_ignore--;
+        else if (psh->sigactions[signo].sh_handler != SH_SIG_DFL)
+            g_sig_state[signo].num_specific--;
+        if (psh->sigactions[signo].sh_flags & SA_RESTART)
+            g_sig_state[signo].num_restart--;
+
+        /* Set the new entry. */
+        psh->sigactions[signo] = *newp;
+
+        /* Add the bits for the new action entry. */
+        if (psh->sigactions[signo].sh_handler == SH_SIG_IGN)
+            g_sig_state[signo].num_ignore++;
+        else if (psh->sigactions[signo].sh_handler != SH_SIG_DFL)
+            g_sig_state[signo].num_specific++;
+        if (psh->sigactions[signo].sh_flags & SA_RESTART)
+            g_sig_state[signo].num_restart++;
+
+        /*
+         * Calc new common action.
+         *
+         * This is quit a bit ASSUMPTIVE about the limited use. We will not
+         * bother synching the mask, and we pretend to care about SA_RESTART.
+         * The only thing we really actually care about is the sh_handler.
+         *
+         * On second though, it's possible we should just tie this to the root
+         * shell since it only really applies to external signal ...
+         */
+        if (    g_sig_state[signo].num_specific
+            ||  g_sig_state[signo].num_ignore != g_num_shells)
+            g_sig_state[signo].sa.sa_handler = sh_sig_common_handler;
+        else if (g_sig_state[signo].num_ignore)
+            g_sig_state[signo].sa.sa_handler = SIG_DFL;
+        else
+            g_sig_state[signo].sa.sa_handler = SIG_DFL;
+        g_sig_state[signo].sa.sa_flags = psh->sigactions[signo].sh_flags & SA_RESTART;
+
+# ifdef _MSC_VER
+        if (signal(signo, g_sig_state[signo].sa.sa_handler) == SIG_ERR)
+# else
+        if (sigaction(signo, &g_sig_state[signo].sa, NULL))
+# endif
+            assert(0);
+
+        shmtx_leave(&g_sh_mtx, &tmp);
+    }
+
+    return 0;
+#endif
+}
+
+shsig_t sh_signal(shinstance *psh, int signo, shsig_t handler)
+{
+    shsigaction_t sa;
+    shsig_t ret;
+
+    /*
+     * Implementation using sh_sigaction.
+     */
+    if (sh_sigaction(psh, signo, NULL, &sa))
+        return SH_SIG_ERR;
+
+    ret = sa.sh_handler;
+    sa.sh_flags &= SA_RESTART;
+    sa.sh_handler = handler;
+    sh_sigemptyset(&sa.sh_mask);
+    sh_sigaddset(&sa.sh_mask, signo); /* ?? */
+    if (sh_sigaction(psh, signo, &sa, NULL))
+        return SH_SIG_ERR;
+
+    return ret;
+}
+
+int sh_siginterrupt(shinstance *psh, int signo, int interrupt)
+{
+    shsigaction_t sa;
+    int oldflags = 0;
+
+    /*
+     * Implementation using sh_sigaction.
+     */
+    if (sh_sigaction(psh, signo, NULL, &sa))
         return -1;
-    oldp->sh_flags = old.sa_flags;
-    oldp->sh_handler = old.sa_handler;
-    oldp->sh_mask = old.sa_mask;
-    return 0;
-# endif
-#else
-#endif
-}
-
-shsig_t sh_signal(shinstance *psh, int signo, shsig_t handler)
-{
-    return (shsig_t)-1;
-}
-
-int sh_siginterrupt(shinstance *psh, int signo, int interrupt)
-{
-    return -1;
+    oldflags = sa.sh_flags;
+    if (interrupt)
+        sa.sh_flags &= ~SA_RESTART;
+    else
+        sa.sh_flags |= ~SA_RESTART;
+    if (!((oldflags ^ sa.sh_flags) & SA_RESTART))
+        return 0; /* unchanged. */
+
+    return sh_sigaction(psh, signo, &sa, NULL);
 }
 
@@ -166,7 +489,44 @@
 }
 
+void sh_sigaddset(shsigset_t *setp, int signo)
+{
+#ifdef _MSC_VER
+    *setp |= 1U << signo;
+#else
+    sigaddset(setp, signo);
+#endif
+}
+
+void sh_sigdelset(shsigset_t *setp, int signo)
+{
+#ifdef _MSC_VER
+    *setp &= ~(1U << signo);
+#else
+    sigdelset(setp, signo);
+#endif
+}
+
+int sh_sigismember(shsigset_t *setp, int signo)
+{
+#ifdef _MSC_VER
+    return !!(*setp & (1U << signo));
+#else
+    return !!sigismember(setp, signo);
+#endif
+}
+
 int sh_sigprocmask(shinstance *psh, int operation, shsigset_t const *newp, shsigset_t *oldp)
 {
-    return -1;
+#ifdef SH_PURE_STUB_MODE
+    return -1;
+#elif defined(SH_STUB_MODE)
+    (void)psh;
+# ifdef _MSC_VER
+    return -1;
+# else
+    return sigprocmask(operation, newp, oldp);
+# endif
+#else
+#endif
 }
 
@@ -175,4 +535,5 @@
 #ifdef SH_PURE_STUB_MODE
 #elif defined(SH_STUB_MODE)
+    (void)psh;
     abort();
 #else
@@ -184,4 +545,5 @@
 #ifdef SH_PURE_STUB_MODE
 #elif defined(SH_STUB_MODE)
+    (void)psh;
     raise(SIGINT);
 #else
@@ -194,4 +556,5 @@
     return -1;
 #elif defined(SH_STUB_MODE)
+    (void)psh;
 # ifdef _MSC_VER
     return -1;
@@ -209,4 +572,5 @@
     return -1;
 #elif defined(SH_STUB_MODE)
+    (void)psh;
 # ifdef _MSC_VER
     return -1;
@@ -224,4 +588,5 @@
     return 0;
 #elif defined(SH_STUB_MODE)
+    (void)psh;
 # ifdef _MSC_VER
     return 0;
@@ -251,4 +616,5 @@
     return -1;
 #elif defined(SH_STUB_MODE)
+    (void)psh;
 # ifdef _MSC_VER
     return -1;
@@ -266,4 +632,5 @@
     return -1;
 #elif defined(SH_STUB_MODE)
+    (void)psh;
 # ifdef _MSC_VER
     return -1;
@@ -282,4 +649,5 @@
     return -1;
 #elif defined(SH_STUB_MODE)
+    (void)psh;
     _exit(rc);
 #else
@@ -292,4 +660,5 @@
     return -1;
 #elif defined(SH_STUB_MODE)
+    (void)psh;
 # ifdef _MSC_VER
     return -1;
@@ -306,4 +675,5 @@
     return 0;
 #elif defined(SH_STUB_MODE)
+    (void)psh;
 # ifdef _MSC_VER
     return 0;
@@ -320,4 +690,5 @@
     return 0;
 #elif defined(SH_STUB_MODE)
+    (void)psh;
 # ifdef _MSC_VER
     return 0;
@@ -334,4 +705,5 @@
     return 0;
 #elif defined(SH_STUB_MODE)
+    (void)psh;
 # ifdef _MSC_VER
     return 0;
@@ -348,4 +720,5 @@
     return 0;
 #elif defined(SH_STUB_MODE)
+    (void)psh;
 # ifdef _MSC_VER
     return 0;
@@ -362,4 +735,5 @@
     return 0;
 #elif defined(SH_STUB_MODE)
+    (void)psh;
 # ifdef _MSC_VER
     return _getpid();
@@ -376,4 +750,5 @@
     return 0;
 #elif defined(SH_STUB_MODE)
+    (void)psh;
 # ifdef _MSC_VER
     return _getpid();
@@ -390,4 +765,5 @@
     return pid;
 #elif defined(SH_STUB_MODE)
+    (void)psh;
 # ifdef _MSC_VER
     return pid;
@@ -404,4 +780,5 @@
     return -1;
 #elif defined(SH_STUB_MODE)
+    (void)psh;
 # ifdef _MSC_VER
     return -1;
@@ -421,4 +798,5 @@
     return -1;
 #elif defined(SH_STUB_MODE)
+    (void)psh;
 # ifdef _MSC_VER
     return -1;
@@ -435,4 +813,5 @@
     return -1;
 #elif defined(SH_STUB_MODE)
+    (void)psh;
 # ifdef _MSC_VER
     return -1;
@@ -449,4 +828,5 @@
     return -1;
 #elif defined(SH_STUB_MODE)
+    (void)psh;
 # ifdef _MSC_VER
     return -1;
@@ -463,4 +843,5 @@
     return -1;
 #elif defined(SH_STUB_MODE)
+    (void)psh;
 # ifdef _MSC_VER
     return -1;
Index: trunk/src/kash/shinstance.h
===================================================================
--- trunk/src/kash/shinstance.h	(revision 1778)
+++ trunk/src/kash/shinstance.h	(revision 1784)
@@ -43,4 +43,5 @@
 #include "shthread.h"
 #include "shfile.h"
+#include "shell.h"
 #include "output.h"
 #include "options.h"
@@ -128,4 +129,5 @@
     shtid               tid;            /**< The thread identifier of the thread for this shell. */
     shfdtab             fdtab;          /**< The file descriptor table. */
+    shsigaction_t       sigactions[NSIG]; /**< The signal actions registered with this shell instance. */
 
     /* alias.c */
@@ -332,18 +334,8 @@
 
 /* signals */
-typedef void (*shsig_t)(shinstance *, int);
-#ifdef _MSC_VER
-    typedef uint32_t shsigset_t;
-#else
-    typedef sigset_t shsigset_t;
-#endif
-struct shsigaction
-{
-    shsig_t     sh_handler;
-    shsigset_t  sh_mask;
-    int         sh_flags;
-};
+#define SH_SIG_UNK ((shsig_t)(intptr_t)-199)
 #define SH_SIG_DFL ((shsig_t)SIG_DFL)
 #define SH_SIG_IGN ((shsig_t)SIG_IGN)
+#define SH_SIG_ERR ((shsig_t)SIG_ERR)
 #ifdef _MSC_VER
 #   define SIG_BLOCK         1
@@ -370,4 +362,8 @@
 int sh_siginterrupt(shinstance *, int, int);
 void sh_sigemptyset(shsigset_t *);
+int sh_sigfillset(shsigset_t *);
+void sh_sigaddset(shsigset_t *, int);
+void sh_sigdelset(shsigset_t *, int);
+int sh_sigismember(shsigset_t *, int);
 int sh_sigprocmask(shinstance *, int, shsigset_t const *, shsigset_t *);
 void sh_abort(shinstance *) __attribute__((__noreturn__));
@@ -418,5 +414,5 @@
 pid_t sh_fork(shinstance *);
 pid_t sh_waitpid(shinstance *, pid_t, int *, int);
-void sh__exit(shinstance *, int) __attribute__((__noreturn__));;
+void sh__exit(shinstance *, int) __attribute__((__noreturn__));
 int sh_execve(shinstance *, const char *, const char * const*, const char * const *);
 uid_t sh_getuid(shinstance *);
Index: trunk/src/kash/shtypes.h
===================================================================
--- trunk/src/kash/shtypes.h	(revision 1778)
+++ trunk/src/kash/shtypes.h	(revision 1784)
@@ -32,4 +32,7 @@
 #include <sys/types.h>
 #include <stdlib.h>
+#ifndef _MSC_VER
+# include <sys/signal.h>
+#endif
 
 #ifdef _MSC_VER
@@ -96,4 +99,18 @@
 typedef struct shinstance shinstance;
 
+#ifdef _MSC_VER
+typedef uint32_t shsigset_t;
+#else
+typedef sigset_t shsigset_t;
 #endif
 
+typedef void (*shsig_t)(shinstance *, int);
+typedef struct shsigaction
+{
+    shsig_t     sh_handler;
+    shsigset_t  sh_mask;
+    int         sh_flags;
+} shsigaction_t;
+
+#endif
+
