Compare commits

...
Author SHA1 Message Date
dgp b35fa949a5 merge 8.7 2018-10-17 19:49:39 +00:00
dgp 3aa66c1de0 merge 8.7 2018-06-04 13:17:24 +00:00
dgp 4de73c8b34 merge 8.7 2018-05-24 13:26:33 +00:00
dgp fd9ef2531c merge 8.7 2018-05-11 11:44:44 +00:00
dgp 4bd363ee78 merge 8.7 2018-04-25 14:54:11 +00:00
dgp 587124d268 merge 8.7 2018-03-15 14:14:19 +00:00
avl42 33e14f12fb fileevent $ch exception ... 2018-02-04 15:52:49 +00:00
5 changed files with 15 additions and 9 deletions
+3 -3
View File
@@ -8925,8 +8925,8 @@ Tcl_FileEventObjCmd(
const char *chanName;
int modeIndex; /* Index of mode argument. */
int mask;
static const char *const modeOptions[] = {"readable", "writable", NULL};
static const int maskArray[] = {TCL_READABLE, TCL_WRITABLE};
static const char *const modeOptions[] = {"readable", "writable", "exception", NULL};
static const int maskArray[] = {TCL_READABLE, TCL_WRITABLE, TCL_EXCEPTION };
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 1, objv, "channelId event ?script?");
@@ -8945,7 +8945,7 @@ Tcl_FileEventObjCmd(
}
chanPtr = (Channel *) chan;
statePtr = chanPtr->state;
if ((statePtr->flags & mask) == 0) {
if ( ((statePtr->flags | TCL_EXCEPTION) & mask) == 0) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf("channel is not %s",
(mask == TCL_READABLE) ? "readable" : "writable"));
return TCL_ERROR;
+1 -1
View File
@@ -5498,7 +5498,7 @@ test chan-io-41.4 {Tcl_FileeventCmd: errors} -constraints fileevent -body {
} -returnCodes error -result {can not find channel named "gorp"}
test chan-io-41.5 {Tcl_FileeventCmd: errors} -constraints fileevent -body {
chan event gorp who-knows
} -returnCodes error -result {bad event name "who-knows": must be readable or writable}
} -returnCodes error -result {bad event name "who-knows": must be readable, writable, or exception}
#
# Test chan event on a file
+1 -1
View File
@@ -5797,7 +5797,7 @@ test io-41.4 {Tcl_FileeventCmd: errors} {fileevent} {
} {1 {can not find channel named "gorp"}}
test io-41.5 {Tcl_FileeventCmd: errors} {fileevent} {
list [catch {fileevent gorp who-knows} msg] $msg
} {1 {bad event name "who-knows": must be readable or writable}}
} {1 {bad event name "who-knows": must be readable, writable, or exception}}
#
# Test fileevent on a file
+1 -1
View File
@@ -840,7 +840,7 @@ test zlib-10.0 "bug #2818131 (close with null interp)" -constraints {
close $srv
rename bgerror {}
} -returnCodes error \
-result {bad event name "xyzzy": must be readable or writable}
-result {bad event name "xyzzy": must be readable, writable, or exception}
test zlib-10.1 "bug #2818131 (mismatch read)" -constraints {
zlib
} -setup {
+9 -3
View File
@@ -221,7 +221,10 @@ PlatformEventsControl(
struct stat fdStat;
newEvent.events = 0;
if (filePtr->mask & (TCL_READABLE | TCL_EXCEPTION)) {
if (filePtr->mask & TCL_EXCEPTION) {
newEvent.events |= EPOLLERR | EPOLLPRI;
}
if (filePtr->mask & TCL_READABLE) {
newEvent.events |= EPOLLIN;
}
if (filePtr->mask & TCL_WRITABLE) {
@@ -242,7 +245,9 @@ PlatformEventsControl(
* associated with regular files belonging to tsdPtr.
*/
if (fstat(filePtr->fd, &fdStat) == -1) {
if (newEvent.events & EPOLLERR) {
/* if exceptions are requested, ignore file type */
} else if (fstat(filePtr->fd, &fdStat) == -1) {
Tcl_Panic("fstat: %s", strerror(errno));
} else if ((fdStat.st_mode & S_IFMT) == S_IFREG) {
switch (op) {
@@ -256,7 +261,8 @@ PlatformEventsControl(
break;
}
return;
} else if (epoll_ctl(tsdPtr->eventsFd, op, filePtr->fd, &newEvent) == -1) {
}
if (epoll_ctl(tsdPtr->eventsFd, op, filePtr->fd, &newEvent) == -1) {
Tcl_Panic("epoll_ctl: %s", strerror(errno));
}
}