diff --git a/elks/arch/i86/mm/malloc.c b/elks/arch/i86/mm/malloc.c index 0e638fef3..06aae746d 100644 --- a/elks/arch/i86/mm/malloc.c +++ b/elks/arch/i86/mm/malloc.c @@ -1,5 +1,5 @@ /* - * Memory management support. + * Memory management support. */ #include @@ -30,30 +30,30 @@ static list_s _seg_free; static segment_s * seg_split (segment_s * s1, segext_t size0) { - segext_t size2 = s1->size - size0; + segext_t size2 = s1->size - size0; - if (size2 >= SEG_MIN_SIZE) { + if (size2 >= SEG_MIN_SIZE) { - // TODO: use pool_alloc - segment_s * s2 = (segment_s *) heap_alloc (sizeof (segment_s), HEAP_TAG_SEG); - if (!s2) - return 0; // heap_alloc gives heap full message + // TODO: use pool_alloc + segment_s * s2 = (segment_s *) heap_alloc (sizeof (segment_s), HEAP_TAG_SEG); + if (!s2) + return 0; // heap_alloc gives heap full message - s2->base = s1->base + size0; - s2->size = size2; - s2->flags = SEG_FLAG_FREE; - s2->ref_count = 0; - s2->pid = 0; + s2->base = s1->base + size0; + s2->size = size2; + s2->flags = SEG_FLAG_FREE; + s2->ref_count = 0; + s2->pid = 0; - list_insert_after (&s1->all, &s2->all); - list_insert_after (&s1->free, &s2->free); + list_insert_after (&s1->all, &s2->all); + list_insert_after (&s1->free, &s2->free); - s1->size = size0; + s1->size = size0; - return s2; // return upper segment if split - } + return s2; // return upper segment if split + } - return s1; // no split + return s1; // no split } @@ -61,42 +61,42 @@ static segment_s * seg_split (segment_s * s1, segext_t size0) static segment_s * seg_free_get (segext_t size0, word_t type) { - // First get the smallest suitable free segment - - segment_s * best_seg = 0; - segext_t best_size = 0xFFFF; - list_s * n = _seg_free.next; - segext_t size00 = size0, incr = 0; - - while (n != &_seg_free) { - segment_s * seg = structof (n, segment_s, free); - segext_t size1 = seg->size; - - if (type & SEG_FLAG_ALIGN1K) - size00 = size0 + ((~seg->base + 1) & ((1024 >> 4) - 1)); - if ((seg->flags == SEG_FLAG_FREE) && (size1 >= size00) && (size1 < best_size)) { - best_seg = seg; - best_size = size1; - incr = size00 - size0; - if (size1 == size00) break; - } - - n = seg->free.next; - } - - // Then allocate that free segment - - if (best_seg) { - seg_split (best_seg, size00); // split off upper segment - if (incr) - best_seg = seg_split (best_seg, incr); // split off lower segment - - best_seg->flags = SEG_FLAG_USED | type; - best_seg->ref_count = 1; - list_remove (&(best_seg->free)); - } - - return best_seg; + // First get the smallest suitable free segment + + segment_s * best_seg = 0; + segext_t best_size = 0xFFFF; + list_s * n = _seg_free.next; + segext_t size00 = size0, incr = 0; + + while (n != &_seg_free) { + segment_s * seg = structof (n, segment_s, free); + segext_t size1 = seg->size; + + if (type & SEG_FLAG_ALIGN1K) + size00 = size0 + ((~seg->base + 1) & ((1024 >> 4) - 1)); + if ((seg->flags == SEG_FLAG_FREE) && (size1 >= size00) && (size1 < best_size)) { + best_seg = seg; + best_size = size1; + incr = size00 - size0; + if (size1 == size00) break; + } + + n = seg->free.next; + } + + // Then allocate that free segment + + if (best_seg) { + seg_split (best_seg, size00); // split off upper segment + if (incr) + best_seg = seg_split (best_seg, incr); // split off lower segment + + best_seg->flags = SEG_FLAG_USED | type; + best_seg->ref_count = 1; + list_remove (&(best_seg->free)); + } + + return best_seg; } @@ -104,10 +104,10 @@ static segment_s * seg_free_get (segext_t size0, word_t type) static void seg_merge (segment_s * s1, segment_s * s2) { - list_remove (&s2->all); - s1->size += s2->size; - s1->pid = 0; - heap_free (s2); + list_remove (&s2->all); + s1->size += s2->size; + s1->pid = 0; + heap_free (s2); } @@ -115,11 +115,11 @@ static void seg_merge (segment_s * s1, segment_s * s2) segment_s * seg_alloc (segext_t size, word_t type) { - segment_s * seg = 0; - seg = seg_free_get (size, type); - if (seg && (type & SEG_FLAG_ALIGN1K)) - seg->base += ((~seg->base + 1) & ((1024 >> 4) - 1)); - return seg; + segment_s * seg = 0; + seg = seg_free_get (size, type); + if (seg && (type & SEG_FLAG_ALIGN1K)) + seg->base += ((~seg->base + 1) & ((1024 >> 4) - 1)); + return seg; } @@ -127,42 +127,42 @@ segment_s * seg_alloc (segext_t size, word_t type) void seg_free (segment_s * seg) { - // Free segment will be inserted to free list: - // - tail if merged to previous or next free segment - // - head if still alone to increase 'exact hit' - // chance on next allocation of same size - - list_s * i = &_seg_free; - seg->flags = SEG_FLAG_FREE; - seg->pid = 0; - - // Try to merge with previous segment if free - list_s * p = seg->all.prev; - if (&_seg_all != p) { - segment_s * prev = structof (p, segment_s, all); - if ((prev->flags == SEG_FLAG_FREE) && (prev->base + prev->size == seg->base)) { - list_remove (&(prev->free)); - seg_merge (prev, seg); - i = _seg_free.prev; - seg = prev; - } - } - - // Try to merge with next segment if free - - list_s * n = seg->all.next; - if (n != &_seg_all) { - segment_s * next = structof (n, segment_s, all); - if ((next->flags == SEG_FLAG_FREE) && (seg->base + seg->size == next->base)) { - list_remove (&(next->free)); - seg_merge (seg, next); - i = _seg_free.prev; - } - } - - // Insert to free list head or tail - - list_insert_after (i, &(seg->free)); + // Free segment will be inserted to free list: + // - tail if merged to previous or next free segment + // - head if still alone to increase 'exact hit' + // chance on next allocation of same size + + list_s * i = &_seg_free; + seg->flags = SEG_FLAG_FREE; + seg->pid = 0; + + // Try to merge with previous segment if free + list_s * p = seg->all.prev; + if (&_seg_all != p) { + segment_s * prev = structof (p, segment_s, all); + if ((prev->flags == SEG_FLAG_FREE) && (prev->base + prev->size == seg->base)) { + list_remove (&(prev->free)); + seg_merge (prev, seg); + i = _seg_free.prev; + seg = prev; + } + } + + // Try to merge with next segment if free + + list_s * n = seg->all.next; + if (n != &_seg_all) { + segment_s * next = structof (n, segment_s, all); + if ((next->flags == SEG_FLAG_FREE) && (seg->base + seg->size == next->base)) { + list_remove (&(next->free)); + seg_merge (seg, next); + i = _seg_free.prev; + } + } + + // Insert to free list head or tail + + list_insert_after (i, &(seg->free)); } @@ -170,8 +170,8 @@ void seg_free (segment_s * seg) segment_s * seg_get (segment_s * seg) { - seg->ref_count++; - return seg; + seg->ref_count++; + return seg; } @@ -180,8 +180,8 @@ segment_s * seg_get (segment_s * seg) void seg_put (segment_s * seg) { - if (!--seg->ref_count) - seg_free (seg); + if (!--seg->ref_count) + seg_free (seg); } @@ -190,10 +190,10 @@ void seg_put (segment_s * seg) segment_s * seg_dup (segment_s * src) { - segment_s * dst = seg_free_get (src->size, src->flags); - if (dst) - fmemcpyw(0, dst->base, 0, src->base, src->size << 3); - return dst; + segment_s * dst = seg_free_get (src->size, src->flags); + if (dst) + fmemcpyw(0, dst->base, 0, src->base, src->size << 3); + return dst; } @@ -201,30 +201,30 @@ segment_s * seg_dup (segment_s * src) void mm_get_usage (unsigned int * pfree, unsigned int * pused) { - unsigned int free = 0; - unsigned int used = 0; + unsigned int free = 0; + unsigned int used = 0; - list_s * n = _seg_all.next; + list_s * n = _seg_all.next; - while (n != &_seg_all) { - segment_s * seg = structof (n, segment_s, all); + while (n != &_seg_all) { + segment_s * seg = structof (n, segment_s, all); - /*if (used) printk ("seg %X: size %u used %u count %u\n", - seg->base, seg->size, seg->flags, seg->ref_count);*/ + /*if (used) printk ("seg %X: size %u used %u count %u\n", + seg->base, seg->size, seg->flags, seg->ref_count);*/ - if (seg->flags == SEG_FLAG_FREE) - free += seg->size; - else - used += seg->size; + if (seg->flags == SEG_FLAG_FREE) + free += seg->size; + else + used += seg->size; - n = seg->all.next; - } + n = seg->all.next; + } - // Convert paragraphs to kilobytes - // Floor, not ceiling, so average return + // Convert paragraphs to kilobytes + // Floor, not ceiling, so average return - *pfree = ((free + 31) >> 6); - *pused = ((used + 31) >> 6); + *pfree = ((free + 31) >> 6); + *pused = ((used + 31) >> 6); } @@ -232,22 +232,22 @@ void mm_get_usage (unsigned int * pfree, unsigned int * pused) int sys_brk(segoff_t newbrk) { - /***unsigned int memfree, memused; - mm_get_usage(&memfree, &memused); - printk("brk(%P): new %x, edat %x, ebrk %x, free %x sp %x, eseg %x, %d/%dK\n", - newbrk, current->t_enddata, current->t_endbrk, - current->t_regs.sp - current->t_endbrk, - current->t_regs.sp, current->t_endseg, memfree, memused);***/ + /***unsigned int memfree, memused; + mm_get_usage(&memfree, &memused); + printk("brk(%P): new %x, edat %x, ebrk %x, free %x sp %x, eseg %x, %d/%dK\n", + newbrk, current->t_enddata, current->t_endbrk, + current->t_regs.sp - current->t_endbrk, + current->t_regs.sp, current->t_endseg, memfree, memused);***/ if (newbrk < current->t_enddata) return -ENOMEM; - if (current->t_begstack > current->t_endbrk) { /* stack above heap?*/ + if (current->t_begstack > current->t_endbrk) { /* stack above heap?*/ if (newbrk > current->t_begstack - current->t_minstack) { - printk("(%d)CAN'T EXPAND HEAP by %u\n", - current->pid, newbrk - (current->t_begstack - current->t_minstack)); + printk("(%d)CAN'T EXPAND HEAP by %u\n", + current->pid, newbrk - (current->t_begstack - current->t_minstack)); return -ENOMEM; - } + } } #ifdef CONFIG_EXEC_LOW_STACK if (newbrk > current->t_endseg) @@ -261,99 +261,99 @@ int sys_brk(segoff_t newbrk) int sys_sbrk (int increment, segoff_t *pbrk) { - segoff_t brk = current->t_endbrk; /* always return start of old break*/ - int err; - - debug("sbrk incr %u pointer %04x curbreak %04x\n", increment, pbrk, brk); - err = verify_area(VERIFY_WRITE, pbrk, sizeof(*pbrk)); - if (err) - return err; - if (increment) { - err = sys_brk(brk + increment); - if (err) return err; - } - - put_user (brk, pbrk); - return 0; + segoff_t brk = current->t_endbrk; /* always return start of old break*/ + int err; + + debug("sbrk incr %u pointer %04x curbreak %04x\n", increment, pbrk, brk); + err = verify_area(VERIFY_WRITE, pbrk, sizeof(*pbrk)); + if (err) + return err; + if (increment) { + err = sys_brk(brk + increment); + if (err) return err; + } + + put_user (brk, pbrk); + return 0; } // allocate memory for process, return segment int sys_fmemalloc(int paras, unsigned short *pseg) { - segment_s *seg; - int err; - - err = verify_area(VERIFY_WRITE, pseg, sizeof(*pseg)); - if (err) - return err; - seg = seg_alloc((segext_t)paras, SEG_FLAG_FDAT); - if (!seg) - return -ENOMEM; - seg->pid = current->pid; - put_user(seg->base, pseg); - return 0; + segment_s *seg; + int err; + + err = verify_area(VERIFY_WRITE, pseg, sizeof(*pseg)); + if (err) + return err; + seg = seg_alloc((segext_t)paras, SEG_FLAG_FDAT); + if (!seg) + return -ENOMEM; + seg->pid = current->pid; + put_user(seg->base, pseg); + return 0; } // free process allocated memory int sys_fmemfree(unsigned short segment) { - list_s *n; - - for (n = _seg_all.next; n != &_seg_all; ) { - segment_s * seg = structof (n, segment_s, all); - - if (seg->base == segment) { - if (seg->pid == current->pid) { - seg_free(seg); - return 0; - } - debug("sys_fmemfree: not owner %04x\n", segment); - return -EACCES; - } - n = seg->all.next; - } - debug("sys_fmemfree: segment not found %04x\n", segment); - return -EINVAL; + list_s *n; + + for (n = _seg_all.next; n != &_seg_all; ) { + segment_s * seg = structof (n, segment_s, all); + + if (seg->base == segment) { + if (seg->pid == current->pid) { + seg_free(seg); + return 0; + } + debug("sys_fmemfree: not owner %04x\n", segment); + return -EACCES; + } + n = seg->all.next; + } + debug("sys_fmemfree: segment not found %04x\n", segment); + return -EINVAL; } // free all program allocated segments for PID pid void seg_free_pid(pid_t pid) { - list_s *n; + list_s *n; again: - for (n = _seg_all.next; n != &_seg_all; ) { - segment_s * seg = structof (n, segment_s, all); - - if (seg->pid == pid) { - seg_free(seg); - goto again; /* free may have changed linked list */ - } - n = seg->all.next; - } + for (n = _seg_all.next; n != &_seg_all; ) { + segment_s * seg = structof (n, segment_s, all); + + if (seg->pid == pid) { + seg_free(seg); + goto again; /* free may have changed linked list */ + } + n = seg->all.next; + } } void INITPROC seg_add(seg_t start, seg_t end) { - segment_s * seg = (segment_s *) heap_alloc (sizeof (segment_s), HEAP_TAG_SEG); - if(seg) { - seg->base = start; - seg->size = end - start; - seg->flags = SEG_FLAG_FREE; - seg->ref_count = 0; - seg->pid = 0; - - list_insert_before (&_seg_all, &(seg->all)); // add tail - list_insert_before (&_seg_free, &(seg->free)); // add tail - } + segment_s * seg = (segment_s *) heap_alloc (sizeof (segment_s), HEAP_TAG_SEG); + if(seg) { + seg->base = start; + seg->size = end - start; + seg->flags = SEG_FLAG_FREE; + seg->ref_count = 0; + seg->pid = 0; + + list_insert_before (&_seg_all, &(seg->all)); // add tail + list_insert_before (&_seg_free, &(seg->free)); // add tail + } } // Initialize the memory manager. void INITPROC mm_init(seg_t start, seg_t end) { - list_init (&_seg_all); - list_init (&_seg_free); + list_init (&_seg_all); + list_init (&_seg_free); - seg_add(start, end); + seg_add(start, end); } diff --git a/elks/include/linuxmt/signal.h b/elks/include/linuxmt/signal.h index 3ffd09c30..09e710b97 100644 --- a/elks/include/linuxmt/signal.h +++ b/elks/include/linuxmt/signal.h @@ -12,76 +12,76 @@ #include #include -#define __SMALLSIG /* 16-bit sigset_t*/ +#define __SMALLSIG /* 16-bit sigset_t*/ #ifdef __SMALLSIG -typedef unsigned short sigset_t; /* at least 16 bits */ - -#define SIGHUP 1 -#define SIGINT 2 -#define SIGQUIT 3 -#define SIGWINCH 4 -#define SIGSTOP 5 -#define SIGABRT 6 -#define SIGTSTP 7 -#define SIGCONT 8 -#define SIGKILL 9 -#define SIGUSR1 10 -#define SIGSEGV 11 -#define SIGCHLD 12 -#define SIGPIPE 13 -#define SIGALRM 14 -#define SIGTERM 15 -#define SIGURG 16 -#define SIGTTIN 0 /* FIXME not implemented*/ -#define SIGUSR2 0 /* FIXME not implemented*/ - -#define _NSIG 16 +typedef unsigned short sigset_t; /* at least 16 bits */ + +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGWINCH 4 +#define SIGSTOP 5 +#define SIGABRT 6 +#define SIGTSTP 7 +#define SIGCONT 8 +#define SIGKILL 9 +#define SIGUSR1 10 +#define SIGSEGV 11 +#define SIGCHLD 12 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGURG 16 +#define SIGTTIN 0 /* FIXME not implemented*/ +#define SIGUSR2 0 /* FIXME not implemented*/ + +#define _NSIG 16 #else -typedef unsigned long sigset_t; /* at least 32 bits */ - -#define SIGHUP 1 -#define SIGINT 2 -#define SIGQUIT 3 -#define SIGILL 4 -#define SIGTRAP 5 -#define SIGABRT 6 -#define SIGIOT 6 -#define SIGBUS 7 -#define SIGFPE 8 -#define SIGKILL 9 -#define SIGUSR1 10 -#define SIGSEGV 11 -#define SIGUSR2 12 -#define SIGPIPE 13 -#define SIGALRM 14 -#define SIGTERM 15 -#define SIGSTKFLT 16 -#define SIGCHLD 17 -#define SIGCONT 18 -#define SIGSTOP 19 -#define SIGTSTP 20 -#define SIGTTIN 21 -#define SIGTTOU 22 -#define SIGURG 23 -#define SIGXCPU 24 -#define SIGXFSZ 25 -#define SIGVTALRM 26 -#define SIGPROF 27 -#define SIGWINCH 28 -#define SIGIO 29 -#define SIGPOLL SIGIO -#define SIGPWR 30 -#define SIGUNUSED 31 - -#define _NSIG 32 +typedef unsigned long sigset_t; /* at least 32 bits */ + +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGIOT 6 +#define SIGBUS 7 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGUSR1 10 +#define SIGSEGV 11 +#define SIGUSR2 12 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGSTKFLT 16 +#define SIGCHLD 17 +#define SIGCONT 18 +#define SIGSTOP 19 +#define SIGTSTP 20 +#define SIGTTIN 21 +#define SIGTTOU 22 +#define SIGURG 23 +#define SIGXCPU 24 +#define SIGXFSZ 25 +#define SIGVTALRM 26 +#define SIGPROF 27 +#define SIGWINCH 28 +#define SIGIO 29 +#define SIGPOLL SIGIO +#define SIGPWR 30 +#define SIGUNUSED 31 + +#define _NSIG 32 #endif -#define NSIG _NSIG +#define NSIG _NSIG /* * sa_flags values: SA_STACK is not supported @@ -89,12 +89,12 @@ typedef unsigned long sigset_t; /* at least 32 bits */ * SA_RESTART flag to get restarting signals (which were the default long ago) */ -#define SA_NOCLDSTOP 1 -#define SA_STACK 0x08000000 -#define SA_RESTART 0x10000000 -#define SA_INTERRUPT 0x20000000 -#define SA_NOMASK 0x40000000 -#define SA_ONESHOT 0x80000000 +#define SA_NOCLDSTOP 1 +#define SA_STACK 0x08000000 +#define SA_RESTART 0x10000000 +#define SA_INTERRUPT 0x20000000 +#define SA_NOMASK 0x40000000 +#define SA_ONESHOT 0x80000000 #ifdef __KERNEL__ /* @@ -108,72 +108,72 @@ typedef unsigned long sigset_t; /* at least 32 bits */ #ifdef __SMALLSIG -#define SM_SIGHUP (1 << (SIGHUP - 1)) -#define SM_SIGINT (1 << (SIGINT - 1)) -#define SM_SIGQUIT (1 << (SIGQUIT - 1)) -#define SM_SIGWINCH (1 << (SIGWINCH - 1)) -#define SM_SIGSTOP (1 << (SIGSTOP - 1)) -#define SM_SIGABRT (1 << (SIGABRT - 1)) -#define SM_SIGTSTP (1 << (SIGTSTP - 1)) -#define SM_SIGCONT (1 << (SIGCONT - 1)) -#define SM_SIGKILL (1 << (SIGKILL - 1)) -#define SM_SIGUSR1 (1 << (SIGUSR1 - 1)) -#define SM_SIGSEGV (1 << (SIGSEGV - 1)) -#define SM_SIGCHLD (1 << (SIGCHLD - 1)) -#define SM_SIGPIPE (1 << (SIGPIPE - 1)) -#define SM_SIGALRM (1 << (SIGALRM - 1)) -#define SM_SIGTERM (1 << (SIGTERM - 1)) -#define SM_SIGURG (1 << (SIGURG - 1)) - -#define SM_SIGILL 0 -#define SM_SIGFPE 0 -#define SM_SIGTTIN 0 -#define SM_SIGTTOU 0 -#define SM_SIGTRAP 0 +#define SM_SIGHUP (1 << (SIGHUP - 1)) +#define SM_SIGINT (1 << (SIGINT - 1)) +#define SM_SIGQUIT (1 << (SIGQUIT - 1)) +#define SM_SIGWINCH (1 << (SIGWINCH - 1)) +#define SM_SIGSTOP (1 << (SIGSTOP - 1)) +#define SM_SIGABRT (1 << (SIGABRT - 1)) +#define SM_SIGTSTP (1 << (SIGTSTP - 1)) +#define SM_SIGCONT (1 << (SIGCONT - 1)) +#define SM_SIGKILL (1 << (SIGKILL - 1)) +#define SM_SIGUSR1 (1 << (SIGUSR1 - 1)) +#define SM_SIGSEGV (1 << (SIGSEGV - 1)) +#define SM_SIGCHLD (1 << (SIGCHLD - 1)) +#define SM_SIGPIPE (1 << (SIGPIPE - 1)) +#define SM_SIGALRM (1 << (SIGALRM - 1)) +#define SM_SIGTERM (1 << (SIGTERM - 1)) +#define SM_SIGURG (1 << (SIGURG - 1)) + +#define SM_SIGILL 0 +#define SM_SIGFPE 0 +#define SM_SIGTTIN 0 +#define SM_SIGTTOU 0 +#define SM_SIGTRAP 0 #else -#define SM_SIGHUP (1L << (SIGHUP - 1)) -#define SM_SIGINT (1L << (SIGINT - 1)) -#define SM_SIGQUIT (1L << (SIGQUIT - 1)) -#define SM_SIGILL (1L << (SIGILL - 1)) -#define SM_SIGTRAP (1L << (SIGTRAP - 1)) -#define SM_SIGABRT (1L << (SIGABRT - 1)) -#define SM_SIGIOT (1L << (SIGIOT - 1)) -#define SM_SIGBUS (1L << (SIGBUS - 1)) -#define SM_SIGFPE (1L << (SIGFPE - 1)) -#define SM_SIGKILL (1L << (SIGKILL - 1)) -#define SM_SIGUSR1 (1L << (SIGUSR1 - 1)) -#define SM_SIGSEGV (1L << (SIGSEGV - 1)) -#define SM_SIGUSR2 (1L << (SIGUSR2 - 1)) -#define SM_SIGPIPE (1L << (SIGPIPE - 1)) -#define SM_SIGALRM (1L << (SIGALRM - 1)) -#define SM_SIGTERM (1L << (SIGTERM - 1)) -#define SM_SIGSTKFLT (1L << (SIGSTKFLT - 1)) -#define SM_SIGCHLD (1L << (SIGCHLD - 1)) -#define SM_SIGCONT (1L << (SIGCONT - 1)) -#define SM_SIGSTOP (1L << (SIGSTOP - 1)) -#define SM_SIGTSTP (1L << (SIGTSTP - 1)) -#define SM_SIGTTIN (1L << (SIGTTIN - 1)) -#define SM_SIGTTOU (1L << (SIGTTOU - 1)) -#define SM_SIGURG (1L << (SIGURG - 1)) -#define SM_SIGXCPU (1L << (SIGXCPU - 1)) -#define SM_SIGXFSZ (1L << (SIGXFSZ - 1)) -#define SM_SIGVTALRM (1L << (SIGVTALRM - 1)) -#define SM_SIGPROF (1L << (SIGPROF - 1)) -#define SM_SIGWINCH (1L << (SIGWINCH - 1)) -#define SM_SIGIO (1L << (SIGIO - 1)) -#define SM_SIGPOLL (1L << (SIGPOLL - 1)) -#define SM_SIGPWR (1L << (SIGPWR - 1)) -#define SM_SIGUNUSED (1L << (SIGUNUSED - 1)) +#define SM_SIGHUP (1L << (SIGHUP - 1)) +#define SM_SIGINT (1L << (SIGINT - 1)) +#define SM_SIGQUIT (1L << (SIGQUIT - 1)) +#define SM_SIGILL (1L << (SIGILL - 1)) +#define SM_SIGTRAP (1L << (SIGTRAP - 1)) +#define SM_SIGABRT (1L << (SIGABRT - 1)) +#define SM_SIGIOT (1L << (SIGIOT - 1)) +#define SM_SIGBUS (1L << (SIGBUS - 1)) +#define SM_SIGFPE (1L << (SIGFPE - 1)) +#define SM_SIGKILL (1L << (SIGKILL - 1)) +#define SM_SIGUSR1 (1L << (SIGUSR1 - 1)) +#define SM_SIGSEGV (1L << (SIGSEGV - 1)) +#define SM_SIGUSR2 (1L << (SIGUSR2 - 1)) +#define SM_SIGPIPE (1L << (SIGPIPE - 1)) +#define SM_SIGALRM (1L << (SIGALRM - 1)) +#define SM_SIGTERM (1L << (SIGTERM - 1)) +#define SM_SIGSTKFLT (1L << (SIGSTKFLT - 1)) +#define SM_SIGCHLD (1L << (SIGCHLD - 1)) +#define SM_SIGCONT (1L << (SIGCONT - 1)) +#define SM_SIGSTOP (1L << (SIGSTOP - 1)) +#define SM_SIGTSTP (1L << (SIGTSTP - 1)) +#define SM_SIGTTIN (1L << (SIGTTIN - 1)) +#define SM_SIGTTOU (1L << (SIGTTOU - 1)) +#define SM_SIGURG (1L << (SIGURG - 1)) +#define SM_SIGXCPU (1L << (SIGXCPU - 1)) +#define SM_SIGXFSZ (1L << (SIGXFSZ - 1)) +#define SM_SIGVTALRM (1L << (SIGVTALRM - 1)) +#define SM_SIGPROF (1L << (SIGPROF - 1)) +#define SM_SIGWINCH (1L << (SIGWINCH - 1)) +#define SM_SIGIO (1L << (SIGIO - 1)) +#define SM_SIGPOLL (1L << (SIGPOLL - 1)) +#define SM_SIGPWR (1L << (SIGPWR - 1)) +#define SM_SIGUNUSED (1L << (SIGUNUSED - 1)) #endif #endif /* __KERNEL__*/ -#define SIG_BLOCK 0 /* for blocking signals */ -#define SIG_UNBLOCK 1 /* for unblocking signals */ -#define SIG_SETMASK 2 /* for setting the signal mask */ +#define SIG_BLOCK 0 /* for blocking signals */ +#define SIG_UNBLOCK 1 /* for unblocking signals */ +#define SIG_SETMASK 2 /* for setting the signal mask */ /* Type of a signal handler within userland. */ typedef void (*sighandler_t)(int); @@ -207,9 +207,9 @@ typedef void stdcall (__far *__kern_sighandler_t)(int); * values can be 8-bit or smaller. -- tkchia 20200512 */ -#define SIG_DFL ((sighandler_t) 0) /* default signal handling */ -#define SIG_IGN ((sighandler_t) 1) /* ignore signal */ -#define SIG_ERR ((sighandler_t) -1) /* error return from signal */ +#define SIG_DFL ((sighandler_t) 0) /* default signal handling */ +#define SIG_IGN ((sighandler_t) 1) /* ignore signal */ +#define SIG_ERR ((sighandler_t) -1) /* error return from signal */ typedef unsigned char __sigdisposition_t; @@ -217,9 +217,9 @@ typedef unsigned char __sigdisposition_t; #define KERN_SIG_DFL ((__kern_sighandler_t) 0L) /* default signal handling */ #define KERN_SIG_IGN ((__kern_sighandler_t) 1L) /* ignore signal */ -#define SIGDISP_DFL ((__sigdisposition_t) 0) -#define SIGDISP_IGN ((__sigdisposition_t) 1) -#define SIGDISP_CUSTOM ((__sigdisposition_t) 2) +#define SIGDISP_DFL ((__sigdisposition_t) 0) +#define SIGDISP_IGN ((__sigdisposition_t) 1) +#define SIGDISP_CUSTOM ((__sigdisposition_t) 2) #endif struct __kern_sigaction_struct {