Author: mturk Date: Thu Aug 13 18:18:27 2009 New Revision: 803978 URL: http://svn.apache.org/viewvc?rev=803978&view=rev Log: Add signals skeleton files
Added: commons/sandbox/runtime/trunk/src/main/native/include/acr_signals.h (with props) commons/sandbox/runtime/trunk/src/main/native/os/unix/signals.c (with props) commons/sandbox/runtime/trunk/src/main/native/os/win32/signals.c (with props) Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.in commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.in URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/Makefile.in?rev=803978&r1=803977&r2=803978&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/Makefile.in (original) +++ commons/sandbox/runtime/trunk/src/main/native/Makefile.in Thu Aug 13 18:18:27 2009 @@ -110,6 +110,7 @@ $(SRCDIR)/os/unix/user.$(OBJ) \ $(SRCDIR)/os/unix/pmutex.$(OBJ) \ $(SRCDIR)/os/unix/shm.$(OBJ) \ + $(SRCDIR)/os/unix/signals.$(OBJ) \ $(SRCDIR)/os/unix/syslog.$(OBJ) \ $(SRCDIR)/os/unix/time.$(OBJ) \ $(SRCDIR)/os/unix/uuid.$(OBJ) \ @@ -132,6 +133,7 @@ $(SRCDIR)/os/unix/user.$(OBJ) \ $(SRCDIR)/os/unix/pmutex.$(OBJ) \ $(SRCDIR)/os/unix/shm.$(OBJ) \ + $(SRCDIR)/os/unix/signals.$(OBJ) \ $(SRCDIR)/os/unix/syslog.$(OBJ) \ $(SRCDIR)/os/unix/time.$(OBJ) \ $(SRCDIR)/os/unix/uuid.$(OBJ) \ @@ -151,6 +153,7 @@ $(SRCDIR)/os/unix/group.$(OBJ) \ $(SRCDIR)/os/unix/user.$(OBJ) \ $(SRCDIR)/os/unix/shm.$(OBJ) \ + $(SRCDIR)/os/unix/signals.$(OBJ) \ $(SRCDIR)/os/unix/syslog.$(OBJ) \ $(SRCDIR)/os/unix/time.$(OBJ) \ $(SRCDIR)/os/unix/uuid.$(OBJ) \ @@ -172,6 +175,7 @@ $(SRCDIR)/os/unix/user.$(OBJ) \ $(SRCDIR)/os/unix/pmutex.$(OBJ) \ $(SRCDIR)/os/unix/shm.$(OBJ) \ + $(SRCDIR)/os/unix/signals.$(OBJ) \ $(SRCDIR)/os/unix/syslog.$(OBJ) \ $(SRCDIR)/os/unix/time.$(OBJ) \ $(SRCDIR)/os/unix/uuid.$(OBJ) \ Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in?rev=803978&r1=803977&r2=803978&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in (original) +++ commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in Thu Aug 13 18:18:27 2009 @@ -103,6 +103,7 @@ $(SRCDIR)/os/win32/ios.$(OBJ) \ $(SRCDIR)/os/win32/pmutex.$(OBJ) \ $(SRCDIR)/os/win32/shm.$(OBJ) \ + $(SRCDIR)/os/win32/signals.$(OBJ) \ $(SRCDIR)/os/win32/syslog.$(OBJ) \ $(SRCDIR)/os/win32/group.$(OBJ) \ $(SRCDIR)/os/win32/user.$(OBJ) \ Added: commons/sandbox/runtime/trunk/src/main/native/include/acr_signals.h URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_signals.h?rev=803978&view=auto ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/include/acr_signals.h (added) +++ commons/sandbox/runtime/trunk/src/main/native/include/acr_signals.h Thu Aug 13 18:18:27 2009 @@ -0,0 +1,52 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _ACR_SIGNALS_H +#define _ACR_SIGNALS_H + +#include "acr.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @file acr_signals.h + * @brief + * + * ACR Signal handling functions + * + */ + +/** + * ACR-private function for initializing the signal package + * @internal + */ +void acr_SignalInit(void); + +/** + * Get the description for a specific signal number + * @param signum The signal number + * @return The description of the signal + */ +ACR_DECLARE(const char *) ACR_SignalDescription(int signum); + +#ifdef __cplusplus +} +#endif + +#endif /* _ACR_SIGNALS_H */ + Propchange: commons/sandbox/runtime/trunk/src/main/native/include/acr_signals.h ------------------------------------------------------------------------------ svn:eol-style = native Modified: commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h?rev=803978&r1=803977&r2=803978&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h (original) +++ commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h Thu Aug 13 18:18:27 2009 @@ -367,6 +367,50 @@ wchar_t d_name[8192]; } DIR; +#define _NSIG 32 /* counting 0; could be 33 (mask is 1-32) */ + +#define SIGHUP 1 /* hangup */ +#define SIGINT 2 /* interrupt */ +#define SIGQUIT 3 /* quit */ +#define SIGILL 4 /* illegal instruction (not reset when caught) */ +#define SIGTRAP 5 /* trace trap (not reset when caught) */ +#define SIGABRT 6 /* abort() */ +#define SIGEMT 7 /* EMT instruction */ +#define SIGFPE 8 /* floating point exception */ +#define SIGKILL 9 /* kill (cannot be caught or ignored) */ +#define SIGBUS 10 /* bus error */ +#define SIGSEGV 11 /* segmentation violation */ +#define SIGSYS 12 /* bad argument to system call */ +#define SIGPIPE 13 /* write on a pipe with no one to read it */ +#define SIGALRM 14 /* alarm clock */ +#define SIGTERM 15 /* software termination signal from kill */ +#define SIGURG 16 /* urgent condition on IO channel */ +#define SIGSTOP 17 /* sendable stop signal not from tty */ +#define SIGTSTP 18 /* stop signal from tty */ +#define SIGCONT 19 /* continue a stopped process */ +#define SIGCHLD 20 /* to parent on child stop or exit */ +#define SIGTTIN 21 /* to readers pgrp upon background tty read */ +#define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */ +#define SIGIO 23 /* input/output possible signal */ +#define SIGXCPU 24 /* exceeded CPU time limit */ +#define SIGXFSZ 25 /* exceeded file size limit */ +#define SIGVTALRM 26 /* virtual time alarm */ +#define SIGPROF 27 /* profiling time alarm */ +#define SIGWINCH 28 /* window size changes */ +#define SIGINFO 29 /* information request */ +#define SIGUSR1 30 /* user defined signal 1 */ +#define SIGUSR2 31 /* user defined signal 2 */ + +/* + * Language spec says we must list exactly one parameter, even though we + * actually supply three. Ugh! + */ +#define SIG_DFL (void (*)(int))0 /* default signal action */ +#define SIG_IGN (void (*)(int))1 /* igore signal */ +#define SIG_GET (void (*)(int))2 /* return current value */ +#define SIG_SGE (void (*)(int))3 /* signal gets error */ +#define SIG_ACK (void (*)(int))3 /* acknowledge */ + /* * --------------------------------------------------------------------- * end of POSIX utilities Added: commons/sandbox/runtime/trunk/src/main/native/os/unix/signals.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/signals.c?rev=803978&view=auto ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/os/unix/signals.c (added) +++ commons/sandbox/runtime/trunk/src/main/native/os/unix/signals.c Thu Aug 13 18:18:27 2009 @@ -0,0 +1,50 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "acr.h" +#include "acr_private.h" +#include "acr_arch.h" +#include "acr_clazz.h" +#include "acr_error.h" +#include "acr_memory.h" +#include "acr_string.h" +#include "acr_descriptor.h" +#include "acr_crypto.h" +#include "acr_signals.h" + +#if defined(NSIG) +#define ACR_NUMSIG NSIG +#elif defined(_NSIG) +#define ACR_NUMSIG _NSIG +#elif defined(__NSIG) +#define ACR_NUMSIG __NSIG +#else +#define ACR_NUMSIG 33 +#endif + +void acr_SignalInit() +{ + +} + +ACR_DECLARE(const char *) ACR_SignalDescription(int signum) +{ + if (signum >= 0 && signum < ACR_NUMSIG) + return sys_siglist[signum]; + else + return "unknown signal (number)"; +} + Propchange: commons/sandbox/runtime/trunk/src/main/native/os/unix/signals.c ------------------------------------------------------------------------------ svn:eol-style = native Added: commons/sandbox/runtime/trunk/src/main/native/os/win32/signals.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/signals.c?rev=803978&view=auto ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/os/win32/signals.c (added) +++ commons/sandbox/runtime/trunk/src/main/native/os/win32/signals.c Thu Aug 13 18:18:27 2009 @@ -0,0 +1,87 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * + * signalc.c + * Microsoft Windows Signal Emulation Functions + * + * @author Mladen Turk + * + */ + +#include "acr.h" +#include "acr_private.h" +#include "acr_arch.h" +#include "acr_clazz.h" +#include "acr_error.h" +#include "acr_memory.h" +#include "acr_string.h" +#include "acr_descriptor.h" +#include "acr_crypto.h" +#include "acr_signals.h" + +#define ACR_NUMSIG _NSIG + +static const char *signal_description[] = { + "Signal 0", + "Hangup", + "Interrupt", + "Quit", + "Illegal instruction (not reset when caught)", + "Trace trap (not reset when caught)", + "Abort()", + "EMT instruction", + "floating point exception", + "kill (cannot be caught or ignored)", + "bus error", + "segmentation violation", + "bad argument to system call", + "write on a pipe with no one to read it", + "alarm clock", + "software termination signal from kill", + "urgent condition on IO channel", + "sendable stop signal not from tty", + "stop signal from tty", + "continue a stopped process", + "to parent on child stop or exit", + "to readers pgrp upon background tty read", + "like TTIN for output if (tp->t_local<OSTOP)", + "input/output possible signal", + "exceeded CPU time limit", + "exceeded file size limit", + "virtual time alarm", + "profiling time alarm", + "window size changes", + "information request", + "user defined signal 1", + "user defined signal 2" +}; + +void acr_SignalInit() +{ + +} + +ACR_DECLARE(const char *) ACR_SignalDescription(int signum) +{ + if (signum >= 0 && signum < ACR_NUMSIG) + return signal_description[signum]; + else + return "unknown signal (number)"; +} + + Propchange: commons/sandbox/runtime/trunk/src/main/native/os/win32/signals.c ------------------------------------------------------------------------------ svn:eol-style = native