- Timestamp:
- Nov 5, 2004, 3:16:17 AM (21 years ago)
- Location:
- trunk/src/emx
- Files:
-
- 40 added
- 12 deleted
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/CompileOne.sh
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r1613 r1614 9 9 #set -x 10 10 gcc -c -O3 -o $TMP/compileO3.o -fmessage-length=0 -std=gnu99 -Wundef -Wall -Wmissing-prototypes -pedantic -Wno-long-long \ 11 -DIN_INNOTEK_LIBC -D_NFILES=20 \12 -I$SRCDIR -I$ROOTDIR/include -I$ROOTDIR/src/include -I$OUTDIR/emx -I$ROOTDIR/src/lib/lgpl/include -DHAVE_CONFIG_H$1 \11 -DIN_INNOTEK_LIBC -D_NFILES=20 -DHAVE_CONFIG_H \ 12 -I$SRCDIR -I$ROOTDIR/include -I$ROOTDIR/src/include -I$OUTDIR/emx -I$ROOTDIR/src/lib/lgpl/include $1 \ 13 13 && gcc -c -O3 -o $TMP/compileLg.o -fmessage-length=0 -std=gnu99 -Wundef -Wall -Wmissing-prototypes -pedantic -Wno-long-long \ 14 14 -DIN_INNOTEK_LIBC -D_NFILES=20 -DHAVE_CONFIG_H -DDEBUG_LOGGING -D__LIBC_STRICT \ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/Makefile
-
Property cvs2svn:cvs-rev
changed from
1.54
to1.55
-
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/InnoTekLIBC/sharedpm.h
-
Property cvs2svn:cvs-rev
changed from
1.10
to1.11
r1613 r1614 598 598 * 599 599 * @returns 0 on success. 600 * @returns -1 and errnoon failure.600 * @returns Negative error code (errno.h) on failure. 601 601 * @param iSocket The new socket. 602 602 */ … … 607 607 * 608 608 * @returns The new reference count. 609 * @returns -1 and errnoon failure.609 * @returns Negative error code (errno.h) on failure. 610 610 * @param iSocket socket to reference. 611 611 */ … … 617 617 * @returns The new reference count. 618 618 * The caller must close the socket if 0 is returned. 619 * @returns -1 and errnoon failure.619 * @returns Negative error code (errno.h) on failure. 620 620 * @param iSocket Socket to dereference. 621 621 */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/InnoTekLIBC/signals.h
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1613 r1614 97 97 int __libc_back_signalVerifyPGrp(pid_t pgid); 98 98 int __libc_back_signalSendPid(pid_t pid, int iSignalNo); 99 int __libc_back_signalSendPidOther(pid_t pid, int iSignalNo); 99 100 int __libc_back_signalSendPGrp(pid_t pgrp, int iSignalNo); 100 101 int __libc_back_signalAction(int iSignalNo, const struct sigaction *pSigAct, struct sigaction *pSigActOld); 101 102 unsigned __libc_back_signalRaise(int iSignalNo, siginfo_t *pSigInfo, void *pvXcptOrQueued, unsigned fFlags); 102 103 int __libc_back_signalRaisePoked(void *pvXcptParams, int tidPoker); 104 void __libc_back_signalOS2V1Handler16bit(unsigned short uSignal, unsigned short uArg); 105 void __libc_back_signalOS2V1Handler32bit(unsigned uSignal, unsigned uArg); 103 106 104 107 __END_DECLS -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/InnoTekLIBC/thread.h
-
Property cvs2svn:cvs-rev
changed from
1.7
to1.8
r1613 r1614 68 68 struct _uheap * pRegularHeap; 69 69 /** Reference count. */ 70 unsignedcRefs;70 volatile unsigned cRefs; 71 71 /** Thread Id. */ 72 72 unsigned tid; … … 145 145 * read without owning the semaphore. 146 146 */ 147 unsignedfSigBeingPoked;147 volatile unsigned fSigBeingPoked; 148 148 149 149 … … 189 189 struct __libc_sys 190 190 { 191 #ifndef __NEW_SIGNALS__192 /** Blocked signal mask. */193 sigset_t sig_blocked;194 /** Pending signal mask. */195 sigset_t sig_pending;196 /** Signal actions. */197 struct sigaction signals[NSIG];198 #endif /* !__NEW_SIGNALS__ */199 191 /** Directory find data entry. 200 192 * Used by __findfirst() and __findnext(). */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/emx/syscalls.h
-
Property cvs2svn:cvs-rev
changed from
1.14
to1.15
r1613 r1614 5 5 6 6 #include <sys/types.h> 7 #ifdef __NEW_SIGNALS__8 7 #include <sys/_sigset.h> 9 #endif10 8 11 9 #if defined (__cplusplus) … … 31 29 #define _SO_SYNC 0x00100000 32 30 #define _SO_SIZE 0x00200000 33 34 #ifndef __NEW_SIGNALS__35 #include <sys/types.h>36 /* For debugging of signal handlers. */37 #define _SIG_MAGIC1 0xfeed666638 #define _SIG_MAGIC2 0x47dead1139 #define _SIG_MAGIC3 0x9999beef40 #define _SIG_MAGIC4 0xaffe081541 42 #if !defined (_SIGSET_T)43 #define _SIGSET_T44 typedef unsigned long sigset_t;45 #endif46 #endif /* !__NEW_SIGNALS__ */47 48 31 49 32 struct hostent; -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/signal.h
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r1613 r1614 1 #ifdef __NEW_SIGNALS__2 1 /** @file 3 2 * FreeBSD 5.1 … … 136 135 #endif /* !_SIGNAL_H_ */ 137 136 138 #else /* !__NEW_SIGNALS__ */139 140 /* signal.h (emx+gcc) */141 142 #ifndef _SIGNAL_H143 #define _SIGNAL_H144 #include <sys/cdefs.h>145 #include <sys/signal.h>146 147 #if __BSD_VISIBLE148 /*149 * XXX should enlarge these, if only to give empty names instead of bounds150 * errors for large signal numbers.151 */152 extern __const char *__const sys_signame[NSIG];153 extern __const char *__const sys_siglist[NSIG];154 extern __const int sys_nsig;155 #endif156 157 158 #endif /* not _SIGNAL_H */159 160 #endif /* !__NEW_SIGNALS__ */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/sys/select.h
-
Property cvs2svn:cvs-rev
changed from
1.8
to1.9
r1613 r1614 10 10 11 11 #include <sys/cdefs.h> 12 #ifdef __NEW_SIGNALS__13 12 #include <sys/_sigset.h> 14 13 … … 18 17 typedef __sigset_t sigset_t; 19 18 #endif 20 21 #else /* !__NEW_SIGNALS__ */22 23 /** Define sigset_t here for pselect(). */24 #if !defined (_SIGSET_T)25 #define _SIGSET_T26 typedef unsigned long sigset_t;27 #endif28 29 #endif /* !__NEW_SIGNALS__ */30 31 19 32 20 /** Define the number of file handles in the select buffer. -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/sys/signal.h
-
Property cvs2svn:cvs-rev
changed from
1.5
to1.6
r1613 r1614 1 #ifdef __NEW_SIGNALS__2 1 /* $Id: $ */ 3 2 /** @file … … 530 529 #endif /* not _SYS_SIGNAL_H */ 531 530 532 533 #else /* !__NEW_SIGNALS__ */534 535 536 /* sys/signal.h (emx+gcc) */537 538 #ifndef _SYS_SIGNAL_H539 #define _SYS_SIGNAL_H540 541 #if defined (__cplusplus)542 extern "C" {543 #endif544 545 typedef int sig_atomic_t;546 547 #define SIGHUP 1 /* Hangup */548 #define SIGINT 2 /* Interrupt (Ctrl-C) */549 #define SIGQUIT 3 /* Quit */550 #define SIGILL 4 /* Illegal instruction */551 #define SIGTRAP 5 /* Single step (debugging) */552 #define SIGABRT 6 /* abort () */553 #define SIGEMT 7 /* EMT instruction */554 #define SIGFPE 8 /* Floating point */555 #define SIGKILL 9 /* Kill process */556 #define SIGBUS 10 /* Bus error */557 #define SIGSEGV 11 /* Segmentation fault */558 #define SIGSYS 12 /* Invalid argument to system call */559 #define SIGPIPE 13 /* Broken pipe */560 #define SIGALRM 14 /* Alarm */561 #define SIGTERM 15 /* Termination, process killed */562 #define SIGUSR1 16 /* User-defined signal #1 */563 #define SIGUSR2 17 /* User-defined signal #2 */564 #define SIGCHLD 18 /* Death of a child process */565 #define SIGBREAK 21 /* Break (Ctrl-Break) */566 #define SIGWINCH 28 /* Window size change (not implemented) */567 568 #define SIGPTRACENOTIFY 128 /* Notification from ptrace() */569 570 #define SIGCLD SIGCHLD571 572 #define SIG_DFL ((void (*)(int))0)573 #define SIG_IGN ((void (*)(int))1)574 #define SIG_ERR ((void (*)(int))-1)575 576 void (*signal (int, void (*)(int)))(int);577 int raise (int);578 579 580 #if !defined (__STRICT_ANSI__)581 582 #define NSIG 29583 584 #define SA_NOCLDSTOP 0x0001585 586 #define SIG_BLOCK 1587 #define SIG_UNBLOCK 2588 #define SIG_SETMASK 3589 590 #if !defined (_SIGSET_T)591 #define _SIGSET_T592 typedef unsigned long sigset_t;593 #endif594 595 struct sigaction596 {597 void (*sa_handler)(int);598 sigset_t sa_mask;599 int sa_flags;600 };601 602 603 int kill (int, int);604 int pause (void);605 606 int sigaction (int, __const__ struct sigaction *, struct sigaction *);607 int sigpending (sigset_t *);608 int sigprocmask (int, __const__ sigset_t *, sigset_t *);609 int sigsuspend (__const__ sigset_t *);610 611 int sigaddset (sigset_t *, int);612 int sigdelset (sigset_t *, int);613 int sigemptyset (sigset_t *);614 int sigfillset (sigset_t *);615 int sigismember (__const__ sigset_t *, int);616 617 #define _SIGMASK(sig) ((sigset_t)1 << ((sig) - 1))618 #define __sigaddset(set,sig) (*(set) |= _SIGMASK (sig), 0)619 #define __sigdelset(set,sig) (*(set) &= ~_SIGMASK (sig), 0)620 #define __sigemptyset(set) (*(set) = 0, 0)621 #define __sigfillset(set) (*(set) = ~(sigset_t)0, 0)622 #define __sigismember(set,sig) ((*(set) & _SIGMASK (sig)) ? 1 : 0)623 624 int _kill (int, int);625 int _pause (void);626 627 int _sigaction (int, __const__ struct sigaction *, struct sigaction *);628 int _sigpending (sigset_t *);629 int _sigprocmask (int, __const__ sigset_t *, sigset_t *);630 int _sigsuspend (__const__ sigset_t *);631 632 int _sigaddset (sigset_t *, int);633 int _sigdelset (sigset_t *, int);634 int _sigemptyset (sigset_t *);635 int _sigfillset (sigset_t *);636 int _sigismember (__const__ sigset_t *, int);637 638 #endif639 640 641 #if !defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE) || defined(__USE_EMX)642 643 #define SIG_ACK ((void (*)(int))4)644 645 #define SA_SYSV 0x0002 /* Reset to SIG_DFL */646 #define SA_ACK 0x0004 /* Don't unblock automatically */647 648 #define SIGTY void649 650 #endif651 652 653 #include <sys/_types.h>654 655 typedef union sigval656 {657 int sigval_int;658 void *sigval_ptr;659 } sigval_t;660 661 typedef struct __siginfo662 {663 /** Signal number. */664 int si_signo;665 /** Associated errno. */666 int si_errno;667 /** Signal code. (See SI_* and FPE_* macros.) */668 int si_code;669 /** Timestamp when the signal was generated - LIBC extension. */670 unsigned si_timestamp;671 /** Process sending the signal. */672 __pid_t si_pid;673 /** Thread sending the signal - LIBC extension. */674 unsigned si_tid;675 /** User sending the signal (ruid). (Usually 0 for OS/2) */676 __uid_t si_uid;677 /** Exit value. (SIGCHLD) */678 int si_status;679 /** Pointer to the faulting instruction or memory reference. (SIGSEGV, SIGILL, SIGFPE, SIGBUS) */680 void *si_addr;681 /** Signal value. */682 union sigval si_value;683 /** Band event for SIGPOLL. */684 long si_band;685 /** Filehandle for SIGPOLL. */686 int si_fd;687 /** Reserve a little bit for future usage. */688 unsigned auReserved[4];689 } siginfo_t;690 691 #if defined (__cplusplus)692 }693 #endif694 695 #endif /* not _SYS_SIGNAL_H */696 697 698 #endif /* !__NEW_SIGNALS__ */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/libc.def
-
Property cvs2svn:cvs-rev
changed from
1.71
to1.72
r1613 r1614 1090 1090 "_setprogname" @1112 1091 1091 "_setstate" @1113 1092 "_sig_info" @11141092 ; "_sig_info" @1114 1093 1093 "_sradixsort" @1115 1094 1094 "_srandom" @1116 … … 1101 1101 "_strsep" @1123 1102 1102 "_strsignal" @1124 1103 "_sys_exception" @11251103 ; "_sys_exception" @1125 1104 1104 "_sys_nsig" @1126 1105 1105 "_sys_siglist" @1127 … … 1211 1211 "___libc_Back_mmanProtect" @1233 1212 1212 "__std_mprotect" @1234 1213 "__libc_Back_exceptionHandler" @1235 1214 "__signal_os2" @1236 1215 "__signal_sysv" @1237 1216 "___sigpause_bsd" @1238 1217 "__std_bsd_signal" @1239 1218 "__std_killpg" @1240 1219 "__std_psignal" @1241 1220 "__std_sigaltstack" @1242 1221 "__std_sigblock" @1243 1222 "__std_sighold" @1244 1223 "__std_sigignore" @1245 1224 "__std_siginterrupt" @1246 1225 "__std_sigpause" @1247 1226 "__std_sigrelse" @1248 1227 "__std_sigsetmask" @1249 1228 "__std_sigtimedwait" @1250 1229 "__std_sigvec" @1251 1230 "__std_sigwait" @1252 1231 "__std_sigwaitinfo" @1253 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/libc.smak
-
Property cvs2svn:cvs-rev
changed from
1.49
to1.50
r1613 r1614 43 43 .TARGET := libc_s.a 44 44 .TKIND := aout 45 .TKEEP := 1 46 include mklib.smak 47 48 .TARGET := libc_omf386.lib 49 .TKIND := omf 50 .TSRC := $(wildcard src/lib/sys/386/*.asm) 51 .TDEP := 52 .TCF := 45 53 .TKEEP := 1 46 54 include mklib.smak … … 106 114 $.omf/src/lib/startup/dll0hi.obj \ 107 115 $(LIBC.OBJS.COMMON) 108 LIBC.LIBS := $.omf/libc_s.lib $.omf/libc_app.lib 116 LIBC.LIBS := $.omf/libc_s.lib $.omf/libc_app.lib $.omf/libc_omf386.lib 109 117 LIBC.DEPS := $(LIBC.STUB) $.omf/libc_alias.lib $.omf/liblazyimp.lib $.omf-lazy/libos2_unicode_lazy.lib $.omf/libos2.lib $.omf/libend.lib 110 118 LIBC.DLL.OBJS := … … 116 124 $.omf/src/lib/startup/dll0hi.obj \ 117 125 $(subst /omf/,/omf-prof/,$(LIBC.OBJS.COMMON)) 118 LIBC.PRF.LIBS := $.omf-prof/libc_p_s.lib $.omf-prof/libc_app_p.lib 126 LIBC.PRF.LIBS := $.omf-prof/libc_p_s.lib $.omf-prof/libc_app_p.lib $.omf/libc_omf386.lib 119 127 LIBC.PRF.DEPS := $(LIBC.STUB) $.omf/libc_alias.lib $.omf-prof/liblazyimp_p.lib $.omf-lazy/libos2_unicode_lazy.lib $.omf-prof/libos2_p.lib $.omf/libend.lib 120 128 LIBC.PRF.DIRS := $(sort $(dir $(LIBC.PRF.OBJS) $(LIBC.PRF.DEPS))) … … 134 142 $.omf/src/lib/startup/dll0hi.obj \ 135 143 $(subst /omf/,/omf-log/,$(LIBC.OBJS.COMMON)) 136 LIBC.LOG.LIBS := $.omf-log/libc_l_s.lib $.omf-log/libc_app_l.lib 144 LIBC.LOG.LIBS := $.omf-log/libc_l_s.lib $.omf-log/libc_app_l.lib $.omf/libc_omf386.lib 137 145 LIBC.LOG.DEPS := $(LIBC.DEPS) 138 146 LIBC.LOG.DIRS := $(sort $(dir $(LIBC.LOG.OBJS) $(LIBC.LOG.DEPS))) $.omf-log/ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/386/gettid.s
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r1613 r1614 10 10 11 11 __gettid: 12 push %fs 13 movl $DosTIB, %eax 14 movl %eax, %fs 12 15 fs 13 16 movl 12, %eax /* ptib2 */ 14 17 movl 0(%eax), %eax /* TID */ 18 pop %fs 15 19 EPILOGUE(_gettid) -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/386/threadid.s
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1613 r1614 10 10 11 11 ___threadid: 12 push %fs 13 movl $DosTIB, %eax 14 movl %eax, %fs 12 15 fs 13 16 movl 12, %eax /* ptib2 */ 17 pop %fs 14 18 EPILOGUE(__threadid) -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/sigempty.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r1613 r1614 1 /* sigempty.c (emx+gcc) -- Copyright (c) 1994-1995 by Eberhard Mattes */ 1 /* $Id: $ */ 2 /** @file 3 * 4 * LIBC - sigemptyset() 5 * 6 * Copyright (c) 2004 knut st. osmundsen <bird-srcspam@anduin.net> 7 * 8 * 9 * This file is part of InnoTek LIBC. 10 * 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 * (at your option) any later version. 15 * 16 * InnoTek LIBC is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * along with InnoTek LIBC; if not, write to the Free Software 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 * 25 */ 2 26 27 28 /******************************************************************************* 29 * Header Files * 30 *******************************************************************************/ 3 31 #include "libc-alias.h" 4 32 #include <signal.h> … … 6 34 #include <InnoTekLIBC/logstrict.h> 7 35 8 int _STD(sigemptyset)(sigset_t *set) 36 37 /** 38 * Empties (i.e. deletes all signals) a signal set. 39 * 40 * @returns 0 indicating success. 41 * @param pSigSet Pointer to signal set to empty. 42 */ 43 int _STD(sigemptyset)(sigset_t *pSigSet) 9 44 { 10 LIBCLOG_ENTER("set=%p\n", set); 11 int rc = __sigemptyset(set); 12 LIBCLOG_RETURN_INT(rc); 45 LIBCLOG_ENTER("pSigSet=%p\n", (void*)pSigSet); 46 47 /* 48 * Empty signal set. 49 */ 50 __SIGSET_EMPTY(pSigSet); 51 LIBCLOG_RETURN_INT(0); 13 52 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/sigfills.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r1613 r1614 1 /* sigfills.c (emx+gcc) -- Copyright (c) 1994-1995 by Eberhard Mattes */ 1 /* $Id: $ *//* sigfills.c (emx+gcc) -- Copyright (c) 1994-1995 by Eberhard Mattes */ 2 /** @file 3 * 4 * LIBC - sigfillset(). 5 * 6 * Copyright (c) 2004 knut st. osmundsen <bird-srcspam@anduin.net> 7 * 8 * 9 * This file is part of InnoTek LIBC. 10 * 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 * (at your option) any later version. 15 * 16 * InnoTek LIBC is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * along with InnoTek LIBC; if not, write to the Free Software 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 * 25 */ 2 26 27 28 /******************************************************************************* 29 * Header Files * 30 *******************************************************************************/ 3 31 #include "libc-alias.h" 4 32 #include <signal.h> … … 6 34 #include <InnoTekLIBC/logstrict.h> 7 35 8 int _STD(sigfillset)(sigset_t *set) 36 37 /** 38 * Fills (i.e. add all possible signals) to a signal set. 39 * 40 * @returns 0 indicating success. 41 * @param pSigSet Pointer to signal set. 42 */ 43 int _STD(sigfillset)(sigset_t *pSigSet) 9 44 { 10 LIBCLOG_ENTER("set=%p\n", set); 11 int rc = __sigfillset(set); 12 LIBCLOG_RETURN_INT(rc); 45 LIBCLOG_ENTER("pSigSet=%p\n", (void*)pSigSet); 46 47 /* 48 * Fill set. 49 */ 50 __SIGSET_FILL(pSigSet); 51 LIBCLOG_RETURN_INT(0); 13 52 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/thread_internals.c
-
Property cvs2svn:cvs-rev
changed from
1.7
to1.8
r1613 r1614 94 94 * Gain exclusive access to the signal stuff. 95 95 */ 96 #ifdef __NEW_SIGNALS__97 96 int rc = __libc_back_signalSemRequest(); 98 #endif99 97 100 98 /* … … 111 109 * Release semaphore. 112 110 */ 113 #ifdef __NEW_SIGNALS__114 111 if (!rc) 115 112 __libc_back_signalSemRelease(); 116 #endif117 113 } 118 114 else -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__init.c
-
Property cvs2svn:cvs-rev
changed from
1.15
to1.16
r1613 r1614 16 16 #include "libc-alias.h" 17 17 #define INCL_DOS 18 #define INCL_DOSSIGNALS 18 19 #define INCL_FSMACROS 19 20 #include <os2emx.h> … … 27 28 #include <InnoTekLIBC/thread.h> 28 29 #include <InnoTekLIBC/sharedpm.h> 30 #include <InnoTekLIBC/backend.h> 31 #include <InnoTekLIBC/signals.h> 29 32 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_INITTERM 30 33 #include <InnoTekLIBC/logstrict.h> … … 173 176 /** somewhere after this comes the string. */ 174 177 } * pStackFrame; 175 ULONGrc;178 int rc; 176 179 PTIB ptib; 177 180 PPIB ppib; … … 224 227 * Install exception handler. 225 228 */ 226 _sys_xreg = &pStackFrame->ExcpRegReg; 227 _sys_xreg->prev_structure = (void *)0xffffffff; 228 _sys_xreg->ExceptionHandler = _sys_exception; 229 rc = DosSetExceptionHandler(_sys_xreg); 229 pStackFrame->ExcpRegReg.prev_structure = END_OF_CHAIN; 230 pStackFrame->ExcpRegReg.ExceptionHandler = __libc_Back_exceptionHandler; 231 rc = DosSetExceptionHandler(&pStackFrame->ExcpRegReg); 230 232 if (rc != 0) 231 233 goto failure; … … 234 236 DosSetSignalExceptionFocus(SIG_SETFOCUS, ×); 235 237 238 /* 239 * Install 16-bit signal handler. 240 */ 241 rc = DosSetSigHandler((PFNSIGHANDLER)__libc_back_signalOS2V1Handler16bit, NULL, NULL, SIGA_ACCEPT, SIG_PFLG_C); 242 if (rc) 243 { 244 LIBC_ASSERTM_FAILED("DosSetSigHandler failed with rc=%d\n", rc); 245 goto failure; 246 } 247 248 236 249 /* Return to the program. */ 237 250 _sys_init_ret(pStackFrame); 238 251 239 252 failure: 240 253 DosExit(EXIT_PROCESS, 255); 241 254 } 242 255 243 244 char const _sys_sig_valid[NSIG] =245 {246 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1247 };248 249 struct sig_descr const sig_info[NSIG] =250 {251 {"SIG0", ST_TERM, ST_TERM},252 {"SIGHUP", ST_TERM, ST_IGNORE},253 {"SIGINT", ST_TERM, ST_IGNORE},254 {"SIGQUIT", ST_TERM, ST_IGNORE},255 {"SIGILL", ST_NEXT, ST_NEXT},256 {"SIGTRAP", ST_NEXT, ST_NEXT},257 {"SIGABRT", ST_TERM, ST_TERM},258 {"SIGEMT", ST_TERM, ST_TERM},259 {"SIGFPE", ST_NEXT, ST_NEXT},260 {"SIGKILL", ST_TERM, ST_TERM},261 {"SIGBUS", ST_TERM, ST_TERM},262 {"SIGSEGV", ST_NEXT, ST_NEXT},263 {"SIGSYS", ST_TERM, ST_TERM},264 {"SIGPIPE", ST_TERM, ST_IGNORE},265 {"SIGALRM", ST_TERM, ST_IGNORE},266 {"SIGTERM", ST_NEXT, ST_IGNORE},267 {"SIGUSR1", ST_IGNORE, ST_IGNORE},268 {"SIGUSR2", ST_IGNORE, ST_IGNORE},269 {"SIGCLD", ST_IGNORE, ST_IGNORE},270 {"SIG19", ST_TERM, ST_TERM},271 {"SIG20", ST_TERM, ST_TERM},272 {"SIGBREAK", ST_TERM, ST_IGNORE}273 };274 275 276 static void say(const char *msg)277 {278 __write(2, msg, strlen (msg));279 }280 281 282 static void _sys_terminate(int signo)283 {284 PPIB pPib;285 PTIB pTib;286 FS_VAR();287 DosGetInfoBlocks(&pTib, &pPib);288 say("\r\n");289 say(pPib->pib_pchcmd);290 say(":");291 292 if (signo == SIGABRT)293 say("\r\nAbnormal program termination\r\n");294 else295 {296 say("\r\nProcess terminated by ");297 say(sig_info[signo].name);298 say("\r\n");299 }300 FS_SAVE_LOAD();301 while (1)302 DosExit(EXIT_PROCESS, 3);303 }304 305 306 static void _sys_signal_acknowledge(int signo)307 {308 FS_VAR();309 FS_SAVE_LOAD();310 switch (signo)311 {312 case SIGINT:313 DosAcknowledgeSignalException(XCPT_SIGNAL_INTR);314 break;315 case SIGTERM:316 DosAcknowledgeSignalException(XCPT_SIGNAL_KILLPROC);317 break;318 case SIGBREAK:319 DosAcknowledgeSignalException(XCPT_SIGNAL_BREAK);320 break;321 }322 FS_RESTORE();323 }324 325 326 /* Called from OS/2 exception handler for signal exceptions. */327 328 static ULONG _sys_signal(int signo)329 {330 __LIBC_PTHREAD pThrd = __libc_threadCurrentNoAuto();331 if (pThrd == NULL)332 return XCPT_CONTINUE_SEARCH;333 __sigaddset (&pThrd->b.sys.sig_pending, signo);334 _sys_signal_acknowledge(signo);335 _sys_deliver_pending_signals(pThrd);336 switch (sig_info[signo].fun_action)337 {338 case ST_TERM:339 _sys_terminate(signo);340 case ST_NEXT:341 return XCPT_CONTINUE_SEARCH;342 case ST_IGNORE:343 return XCPT_CONTINUE_EXECUTION;344 }345 return XCPT_CONTINUE_SEARCH; /* Keep the optimizer happy */346 }347 348 349 /* Called from OS/2 exception handler for traps. */350 351 static ULONG _sys_trap(int signo)352 {353 __LIBC_PTHREAD pThrd;354 void (*handler)(int signo);355 356 pThrd = __libc_threadCurrentNoAuto();357 if (pThrd == NULL)358 return XCPT_CONTINUE_SEARCH;359 handler = pThrd->b.sys.signals[signo].sa_handler;360 if (handler != SIG_IGN && handler != SIG_DFL)361 handler(signo);362 switch (sig_info[signo].fun_action)363 {364 case ST_TERM:365 _sys_terminate(signo);366 case ST_NEXT:367 return XCPT_CONTINUE_SEARCH;368 case ST_IGNORE:369 return XCPT_CONTINUE_EXECUTION;370 }371 return XCPT_CONTINUE_SEARCH; /* Keep the optimizer happy */372 }373 374 375 static void _sys_deliver_signal(__LIBC_PTHREAD pThrd, int signo)376 {377 struct sigaction *p;378 void (*handler)(int signo);379 sigset_t mask, old_blocked;380 381 /* TODO: Critical section */382 383 mask = _SIGMASK(signo);384 p = &pThrd->b.sys.signals[signo];385 386 pThrd->b.sys.sig_pending &= ~mask;387 handler = p->sa_handler;388 389 if (handler == SIG_IGN)390 {391 /* Ignore the signal. */392 }393 else if (handler == SIG_DFL)394 {395 if (sig_info[signo].dfl_action != ST_IGNORE)396 _sys_terminate(signo);397 }398 else399 {400 if (p->sa_flags & SA_SYSV)401 {402 p->sa_handler = SIG_DFL;403 handler(signo);404 }405 else if (p->sa_flags & SA_ACK)406 {407 pThrd->b.sys.sig_blocked |= mask;408 handler(signo);409 }410 else411 {412 old_blocked = pThrd->b.sys.sig_blocked;413 SET_BLOCKED(&pThrd->b.sys, pThrd->b.sys.sig_blocked | mask | p->sa_mask);414 handler(signo);415 pThrd->b.sys.sig_blocked = old_blocked;416 }417 }418 }419 420 421 void _sys_deliver_pending_signals(__LIBC_PTHREAD pThrd)422 {423 int signo;424 425 /* TODO: Critical section */426 while ((pThrd->b.sys.sig_pending & ~pThrd->b.sys.sig_blocked) != 0)427 {428 for (signo = 1; signo < NSIG; ++signo)429 if (pThrd->b.sys.sig_pending & ~pThrd->b.sys.sig_blocked & _SIGMASK(signo))430 _sys_deliver_signal(pThrd, signo);431 }432 }433 434 /* from kLib/kHeapDbg.h */435 typedef enum436 {437 enmRead, enmWrite, enmUnknown438 } ENMACCESS;439 extern BOOL _Optlink kHeapDbgException(void * pvAccess,440 ENMACCESS enmAccess,441 void * pvIP,442 void * pvOS);443 /* Weak on _Optlink and _System doesn't work because of underscoring. */444 asm (".weak kHeapDbgException");445 446 ULONG _System _sys_exception(PEXCEPTIONREPORTRECORD report,447 PEXCEPTIONREGISTRATIONRECORD registration,448 PCONTEXTRECORD context,449 PVOID whatever)450 {451 __asm__ ("cld"); /* Don't trust */452 LIBCLOG_MSG2("!!! num %08lx flags %08lx nested %p whatever %p\n",453 report->ExceptionNum, report->fHandlerFlags, (void *)report->NestedExceptionReportRecord, whatever);454 if (report->fHandlerFlags & (EH_UNWINDING | EH_EXIT_UNWIND))455 return XCPT_CONTINUE_SEARCH;456 switch (report->ExceptionNum)457 {458 case XCPT_SIGNAL:459 if (report->cParameters >= 1)460 {461 if (report->ExceptionInfo[0] == XCPT_SIGNAL_INTR)462 return _sys_signal(SIGINT);463 else if (report->ExceptionInfo[0] == XCPT_SIGNAL_KILLPROC)464 return _sys_signal(SIGTERM);465 else if (report->ExceptionInfo[0] == XCPT_SIGNAL_BREAK)466 return _sys_signal(SIGBREAK);467 }468 break;469 case XCPT_ACCESS_VIOLATION:470 /* If we're linking libc01.elh or someone is linking static libc471 together with kLib the electric fence heap will get the opportunity472 to check if any access violation was caused by someone touching any473 of the electric fences. */474 if ( kHeapDbgException475 && ( report->ExceptionInfo[0] == XCPT_READ_ACCESS476 || report->ExceptionInfo[0] == XCPT_WRITE_ACCESS477 || report->ExceptionInfo[0] == XCPT_EXECUTE_ACCESS478 || report->ExceptionInfo[0] == XCPT_UNKNOWN_ACCESS)479 )480 {481 ENMACCESS enmAccess = enmRead;482 switch (report->ExceptionInfo[0])483 {484 case XCPT_WRITE_ACCESS: enmAccess = enmWrite; break;485 case XCPT_UNKNOWN_ACCESS: enmAccess = enmUnknown; break;486 }487 /* This call returns true if the page was commited in order488 to workaround the immediate problem. If it returns false489 the default action should be taken. */490 if (kHeapDbgException((void*)report->ExceptionInfo[1],491 enmAccess,492 report->ExceptionAddress,493 report))494 return XCPT_CONTINUE_EXECUTION;495 }496 case XCPT_DATATYPE_MISALIGNMENT:497 return _sys_trap(SIGSEGV);498 499 case XCPT_INTEGER_DIVIDE_BY_ZERO:500 case XCPT_INTEGER_OVERFLOW:501 case XCPT_ARRAY_BOUNDS_EXCEEDED:502 case XCPT_FLOAT_DENORMAL_OPERAND:503 case XCPT_FLOAT_DIVIDE_BY_ZERO:504 case XCPT_FLOAT_INEXACT_RESULT:505 case XCPT_FLOAT_INVALID_OPERATION:506 case XCPT_FLOAT_OVERFLOW:507 case XCPT_FLOAT_STACK_CHECK:508 case XCPT_FLOAT_UNDERFLOW:509 return _sys_trap(SIGFPE);510 511 case XCPT_ILLEGAL_INSTRUCTION:512 case XCPT_INVALID_LOCK_SEQUENCE:513 case XCPT_PRIVILEGED_INSTRUCTION:514 return _sys_trap(SIGILL);515 }516 return XCPT_CONTINUE_SEARCH;517 }518 519 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__initdll.c
-
Property cvs2svn:cvs-rev
changed from
1.16
to1.17
r1613 r1614 37 37 #include <InnoTekLIBC/thread.h> 38 38 #include <InnoTekLIBC/libc.h> 39 #include <InnoTekLIBC/signals.h> 39 40 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_INITTERM 40 41 #include <InnoTekLIBC/logstrict.h> … … 196 197 if (rc) 197 198 { 198 LIBC_ASSERTM_FAILED("__libc_fhInit(%p) failed\n", pSelf->pInherit ? (void *)pSelf->pInherit->pFHBundles : NULL); 199 LIBC_ASSERTM_FAILED("__libc_fhInit() failed\n"); 200 return -1; 201 } 202 203 /* 204 * Init signals 205 */ 206 rc = __libc_back_signalInit(); 207 if (rc) 208 { 209 LIBC_ASSERTM_FAILED("__libc_back_signalInit() failed\n"); 199 210 return -1; 200 211 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/b_threadInit.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r1613 r1614 39 39 void __libc_Back_threadInit(__LIBC_PTHREAD pThrd, const __LIBC_PTHREAD pParentThrd) 40 40 { 41 unsigned i;42 43 __sigemptyset(&pThrd->b.sys.sig_blocked);44 __sigemptyset(&pThrd->b.sys.sig_pending);45 for (i = 0; i < NSIG; ++i)46 {47 pThrd->b.sys.signals[i].sa_handler = SIG_DFL;48 pThrd->b.sys.signals[i].sa_flags = SA_ACK;49 __sigemptyset(&pThrd->b.sys.signals[i].sa_mask);50 }51 41 pThrd->b.sys.fd.hdir = HDIR_CREATE; 52 42 pThrd->b.sys.fd.cFiles = 0; -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/b_threadStartup.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r1613 r1614 1 /* $Id$ */ /* sys/initthre.c (emx+gcc) -- Copyright (c) 1993-1996 by Eberhard Mattes */1 /* $Id$ */ 2 2 /** @file 3 3 * … … 30 30 *******************************************************************************/ 31 31 #include "libc-alias.h" 32 #include <errno.h>33 32 #define INCL_DOS 34 33 #define INCL_FSMACROS 35 34 #include <os2emx.h> 36 #include "syscalls.h"37 35 #include <InnoTekLIBC/backend.h> 36 38 37 39 38 void __libc_Back_threadStartup(void *pExpRegRec) 40 39 { 41 40 FS_VAR(); 42 ((PEXCEPTIONREGISTRATIONRECORD)pExpRegRec)->ExceptionHandler = _ sys_exception;43 ((PEXCEPTIONREGISTRATIONRECORD)pExpRegRec)->prev_structure = NULL;41 ((PEXCEPTIONREGISTRATIONRECORD)pExpRegRec)->ExceptionHandler = __libc_Back_exceptionHandler; 42 ((PEXCEPTIONREGISTRATIONRECORD)pExpRegRec)->prev_structure = END_OF_CHAIN; 44 43 FS_SAVE_LOAD(); 45 44 DosSetExceptionHandler(pExpRegRec); -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/syscalls.h
-
Property cvs2svn:cvs-rev
changed from
1.14
to1.15
r1613 r1614 6 6 #include "libc-alias.h" 7 7 #include <sys/signal.h> 8 #include <sys/types.h> 8 9 #include <InnoTekLIBC/sharedpm.h> 9 10 … … 91 92 #define FDATEZEROP(x) (*(PUSHORT)&(x) == 0) 92 93 93 #if defined (INCL_DOSEXCEPTIONS)94 EXTERN PEXCEPTIONREGISTRATIONRECORD _sys_xreg INIT (NULL);95 ULONG _System _sys_exception (PEXCEPTIONREPORTRECORD report,96 PEXCEPTIONREGISTRATIONRECORD registration, PCONTEXTRECORD context,97 PVOID whatever);98 #endif /* defined (INCL_DOSEXCEPTIONS) */99 100 /* TODO: SIGSTOP */101 #define SET_BLOCKED(tp,set) ((tp)->sig_blocked = (set) & ~_SIGMASK (SIGKILL))102 103 enum sig_type104 {105 ST_TERM, /* Terminate process (SIGINT for instance) */106 ST_NEXT, /* Pass on to next exception handler */107 ST_IGNORE /* Ignore exception and continue thread */108 };109 110 struct sig_descr111 {112 const char *name; /* Name of the signal */113 enum sig_type dfl_action; /* Default action */114 enum sig_type fun_action; /* Action taken after calling handler */115 };116 117 extern char const _sys_sig_valid[NSIG];118 extern struct sig_descr const sig_info[NSIG];119 120 94 long _sys_p2t(FTIME t, FDATE d); 121 void _sys_deliver_pending_signals(__LIBC_PTHREAD pThrd);122 95 123 96 #endif /* _OS2EMX_H */ … … 162 135 /** @} */ 163 136 164 165 137 /** @group Error code and errno Functions. 166 138 * @{ */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/version.smak
-
Property cvs2svn:cvs-rev
changed from
1.16
to1.17
r1613 r1614 4 4 VH = 0 5 5 # Middle part of version number 6 VM = 6 a36 VM = 6s3 7 7 # Low part of version number 8 8 VL = 0 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.