Tcl Source Code

Check-in [7587b7aeb9]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix for [dcb888ed85adeb86]: epoll, special files, directories, links, epoll_ctl operation not permitted, and abort
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-branch
Files: files | file ages | folders
SHA3-256: 7587b7aeb9ce863cead9f97abfdce76e31427c797f31151fdb906c59611b23f9
User & Date: pooryorick 2021-06-17 08:53:04
References
2021-06-17
08:54 Ticket [dcb888ed85] epoll, special files, directories, links, epoll_ctl operation not permitted, and abort status still Open with 5 other changes artifact: 8a8da0ca62 user: pooryorick
Context
2021-06-18
10:02
Merge 8.7 check-in: 4a94fcba68 user: jan.nijtmans tags: trunk, main
2021-06-17
10:25
tests for [dcb888ed85adeb86] check-in: 4b00bf6318 user: pooryorick tags: core-8-branch
08:53
Fix for [dcb888ed85adeb86]: epoll, special files, directories, links, epoll_ctl operation not permit... check-in: 7587b7aeb9 user: pooryorick tags: core-8-branch
2021-06-16
16:06
Re-apply fix for [67a5eabbd3d1]: refchan, coroutine, and postevent from the "watch" proc check-in: f6aa52e243 user: pooryorick tags: core-8-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to unix/tclEpollNotfy.c.

219
220
221
222
223
224
225

226



227
228
229
230
231
232
233
234
235
236
237

238
239

240
241


242
243
244
245
246
247
248
     * regular files (S_IFREG). Therefore, filePtr is in these cases simply
     * added or deleted from the list of FileHandlers associated with regular
     * files belonging to tsdPtr.
     */

    if (fstat(filePtr->fd, &fdStat) == -1) {
	Tcl_Panic("fstat: %s", strerror(errno));

    } else if ((fdStat.st_mode & S_IFMT) == S_IFREG) {



	switch (op) {
	case EPOLL_CTL_ADD:
	    if (isNew) {
		LIST_INSERT_HEAD(&tsdPtr->firstReadyFileHandlerPtr, filePtr,
			readyNode);
	    }
	    break;
	case EPOLL_CTL_DEL:
	    LIST_REMOVE(filePtr, readyNode);
	    break;
	}

	return;
   } else if (epoll_ctl(tsdPtr->eventsFd, op, filePtr->fd, &newEvent) == -1) {

	Tcl_Panic("epoll_ctl: %s", strerror(errno));
   }


}

/*
 *----------------------------------------------------------------------
 *
 * TclpFinalizeNotifier --
 *







>
|
>
>
>
|
|
|
|
|
|
|
|
|
|
|
>
|
<
>
|
|
>
>







219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243

244
245
246
247
248
249
250
251
252
253
254
255
     * regular files (S_IFREG). Therefore, filePtr is in these cases simply
     * added or deleted from the list of FileHandlers associated with regular
     * files belonging to tsdPtr.
     */

    if (fstat(filePtr->fd, &fdStat) == -1) {
	Tcl_Panic("fstat: %s", strerror(errno));
    }

   if (epoll_ctl(tsdPtr->eventsFd, op, filePtr->fd, &newEvent) == -1) {
       switch (errno) {
	    case EPERM:
		switch (op) {
		case EPOLL_CTL_ADD:
		    if (isNew) {
			LIST_INSERT_HEAD(&tsdPtr->firstReadyFileHandlerPtr, filePtr,
				readyNode);
		    }
		    break;
		case EPOLL_CTL_DEL:
		    LIST_REMOVE(filePtr, readyNode);
		    break;

		}
		break;

	    default:
		Tcl_Panic("epoll_ctl: %s", strerror(errno));
	}
    }
    return;
}

/*
 *----------------------------------------------------------------------
 *
 * TclpFinalizeNotifier --
 *