aboutsummaryrefslogtreecommitdiff
path: root/jim-signal.c
AgeCommit message (Collapse)AuthorFilesLines
2020-05-04signal check: fix error returnSteve Bennett1-1/+1
If the signal is invalid, indicate that Signed-off-by: Steve Bennett <steveb@workware.net.au>
2019-09-06signal: Add 'signal block' supportSteve Bennett1-16/+30
This allows a signal to be blocked by setting it's handler to SIG_IGN Can be used to block SIGPIPE for exec Signed-off-by: Steve Bennett <steveb@workware.net.au>
2018-09-04Tidy some signed/unsigned comparisonsSteve Bennett1-2/+2
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2017-10-17signal, exec, wait, pid: improvements, especially to execSteve Bennett1-10/+0
- fix popen [open "|pipeline ..."] to return meaningful status in close (but note that stderr is not captured) - popen pipelines can now be used as the target of exec redirection - overally improvements to exec on windows. Now crt file descriptors are used throughout - add support for [pid], [wait] and popen on windows - os.wait is now wait, and integrates with [exec ... &] to be able to wait for running background tasks - [socket pipe] is now also [pipe] and is supported on windows - [file tempfile] is supported on windows - move duplicated code between jim-aio.c and jim-exec.c to jimiocompat.c - Fix [exec] on windows to match unix semantics wrt sharing the parent stream unless redirected rather than using /dev/null - On windows redirect to or from /dev/null is automatically converted to NUL: - If signal support is disabled, implement a minimal Jim_SignalId() for exec and wait - aio now supports getfd, to return the underlying file descriptor. This is used by exec to support redirection, and allows popen channels to support exec redirection. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2016-10-12signal: restore default signal handlingSteve Bennett1-1/+20
If the interpreter or signal command is deleted, restore default signal handling and free allocated memory. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2016-09-09signal: Remove the signal command from child interpretersSteve Bennett1-8/+12
Currently signals can only be delivered to a single interpreter. To avoid confusion where currently this is the most recently created interpreter, don't create the signal command and handle signals in child interpreters. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2016-03-27Don't include unistd.h unless configure has found itEvan Hunter1-1/+3
2014-12-09signal: don't define more than NSIG signalsSteve Bennett1-1/+6
If NSIG is defined, limit the number of supported signals to that number Signed-off-by: Steve Bennett <steveb@workware.net.au>
2014-04-24signal: remote a coverity false positiveSteve Bennett1-2/+1
Just use memset to initialise the sigaction Signed-off-by: Steve Bennett <steveb@workware.net.au>
2014-01-15signal: make signal name lookup more efficientSteve Bennett1-60/+73
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2014-01-15signal: minor code cleanupSteve Bennett1-11/+10
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2014-01-15sleep: support sub-second sleep > 1Steve Bennett1-5/+2
e.g. sleep 1.5 Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-11-24Create build-jim-ext for building extensionsSteve Bennett1-3/+2
Simplifies the process of building loadable extensions Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-11-07Remove use of designated initialisersSteve Bennett1-31/+31
For better compatibility c89 compatibility. Also simplify jim-subcmd. Remove -usage and command descriptions. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-09-12Remove all trailing whitespace in sourceSteve Bennett1-1/+1
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-07-22Help Jim Tcl build on HaikuSteve Bennett1-0/+2
Don't use -Werror Prefer user CFLAGS over default options Haiku needs -lnetwork for networking functions Haiku does not have -lm Haiku does not have SIGIO Silence some warnings Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-06-01Add Jim_String() macroSteve Bennett1-4/+4
It is very common to get the string value without the length. Jim_String() is a macro which does that. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-11-17For ctype macros, cast to unsigned charSteve Bennett1-1/+1
Instead of unsigned. Add UCHAR() macro for this. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-11-09Allow jim to be used as an autoconf subdirSteve Bennett1-0/+1
Ensure that no public headers include the autoconf header, jimautoconf.h, as it leads to problems with redefined symbols. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Some systems insist that ctype macros use unsignedSteve Bennett1-1/+1
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Portability fixesSteve Bennett1-2/+3
Especially for eCos, mingw32 and cygwin Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Ensure that Tcl extensions can be built-in or externalSteve Bennett1-0/+3
All C extensions must call Jim_PackageProvide() make-c-ext ensures that Tcl extensions call Jim_PackageProvide() if compiled in. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Set $::errorCode from execSteve Bennett1-0/+10
This allows the return code from a failed 'exec' command to be retrieved. Also support -errorcode in catch and return. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Clean up the indentation messSteve Bennett1-9/+10
Use 'indent'. Not perfect, but at least consistent. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15More reliable approach to handling signal namesSteve Bennett1-107/+45
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Improvements to catch, return, signal, trySteve Bennett1-16/+82
Improve the ability to rethrow errors * Allow return to rethrow an error by accepting '-errorinfo stacktrace' * Also, 'catch ... opts' now also stores opts(-errorinfo) on error * Use these to provide better stack traces from 'case' and 'try' * Implement 'return -level' Make try/on/finally more Tcl 8.6 compatible * With support for 'on' handlers and docs Add support for catch options to try * Otherwise it's hard to use try to catch signals Improvements to signal handling * catch -signal now sets a list of the handled signals as the result * catch -signal won't execute the body at all if a handled signal is pending * up to 64 (jim_wide) signals can now be handled * if catch -signal is nested, the innermost catch will catch the error * new 'signal catch' allows ignored/blocked signals to be examined and cleared. * update docs on signal handling exec should indicate which signal killed the child Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Various general fixes and cleanupsSteve Bennett1-41/+41
Add lsearch -command, update case to use lsearch Rename tcl6.tcl to tclcompat.tcl Remove // style comments Expand some tabs to spaces Fix some compiler warnings Remove some unused functions Don't close fd=-1 in exec
2010-10-15Build improvements, bug fixes and compiler warningsSteve Bennett1-2/+2
Remove unimplemented 'after restart|expire' from eventloop Allow libjim to be build as a shared library On some platforms, regex.h needs stdlib.h first Use ualarm() only for times < 1 second Fix warnings found by clang static analyser *: printf/syslog %m isn't portable *: some variables set but never read *: some possible null pointer references (although mostly impossible) *: also minor fixes to jim unit tests Fix 'syslog -options <n>' Must null terminate readlink() result
2010-10-15Lots of improvementsSteve Bennett1-0/+492
jim --- Add a unique id facility to jim (Jim_GetId()) Remove unused jim_vasprintf(), Jim_AppendString_sprintf() Remove duplicate output in Jim_Panic() Add support for catch -signal aio --- Use this for aio handles aio automatically creates stdin, stdout and stderr channels Jim_AioFilehandle() returns the 'FILE *' filehandle for a channel If JIM_TCL_COMPAT is set, create top level open, close, read, puts, etc. load ---- load core command split out into jim-load.c package ------- package core command split out into jim-package.c added 'package list' posix ----- Remove os.sleep, os.usleep, os.sethostname, os.signal, pit, Jpit Most of these are in 'signal'