summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixChan.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-03-04 13:42:42 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-03-04 13:42:42 (GMT)
commit8defb7d10b69cdbe3219de6ae2dc169dc8df8bb9 (patch)
treed2f706832df81f622d3246731bef82f25668218a /unix/tclUnixChan.c
parenta4154b246b048a378dd83998031d103263856c8f (diff)
downloadtcl-8defb7d10b69cdbe3219de6ae2dc169dc8df8bb9.zip
tcl-8defb7d10b69cdbe3219de6ae2dc169dc8df8bb9.tar.gz
tcl-8defb7d10b69cdbe3219de6ae2dc169dc8df8bb9.tar.bz2
Implement WideSeekProc() for all channels which have a SeekProc(). Implement Close2Proc() for all channels, as minimal wrapper around CloseProc().
Backported (with comments) and adapted from core-8-branch.
Diffstat (limited to 'unix/tclUnixChan.c')
-rw-r--r--unix/tclUnixChan.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c
index 27f2710..2df7b28 100644
--- a/unix/tclUnixChan.c
+++ b/unix/tclUnixChan.c
@@ -99,6 +99,8 @@ typedef struct TtyAttrs {
static int FileBlockModeProc(ClientData instanceData, int mode);
static int FileCloseProc(ClientData instanceData,
Tcl_Interp *interp);
+static int FileClose2Proc(ClientData instanceData,
+ Tcl_Interp *interp, int flags);
static int FileGetHandleProc(ClientData instanceData,
int direction, ClientData *handlePtr);
static int FileInputProc(ClientData instanceData, char *buf,
@@ -144,7 +146,7 @@ static const Tcl_ChannelType fileChannelType = {
NULL, /* Get option proc. */
FileWatchProc, /* Initialize notifier. */
FileGetHandleProc, /* Get OS handles out of channel. */
- NULL, /* close2proc. */
+ FileClose2Proc, /* close2proc. */
FileBlockModeProc, /* Set blocking or non-blocking mode.*/
NULL, /* flush proc. */
NULL, /* handler proc. */
@@ -170,7 +172,7 @@ static const Tcl_ChannelType ttyChannelType = {
TtyGetOptionProc, /* Get option proc. */
FileWatchProc, /* Initialize notifier. */
FileGetHandleProc, /* Get OS handles out of channel. */
- NULL, /* close2proc. */
+ FileClose2Proc, /* close2proc. */
FileBlockModeProc, /* Set blocking or non-blocking mode.*/
NULL, /* flush proc. */
NULL, /* handler proc. */
@@ -347,6 +349,17 @@ FileCloseProc(
ckfree(fsPtr);
return errorCode;
}
+static int
+FileClose2Proc(
+ ClientData instanceData, /* File state. */
+ Tcl_Interp *interp, /* For error reporting - unused. */
+ int flags)
+{
+ if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) == 0) {
+ return FileCloseProc(instanceData, interp);
+ }
+ return EINVAL;
+}
/*
*----------------------------------------------------------------------