David Schwartz a écrit :Events are not necessarly reported "by descriptors". epoll uses an opaque field provided by the user. It's up to the user to properly chose a tag that will makes sense if the user app is playing dup()/close() games for example. typedef union epoll_data { void *ptr; int fd; uint32_t u32; uint64_t u64; } epoll_data_t; It's true some applications are using 'fd' field from epoll_data_t, but in this case they should not play dup()/close() games that could change the meaning of their 'epoll tags'. They would better use 'ptr/u64' for example to map the event to an application object. In this object they might find the correct handle (fd) to communicate with the kernel for a given 'file'. This handle could then be remapped to another handle using dup()/fcntl()/close()... Yes, it would be nonsense that the child still tries to get events from the epoll set while he cannot possibly use the socket. If you use 'ptr' field to retrieve an object, this object probably would have no meaning in the child anyway, especially after an exec() syscall. That kind of user error can also happens with select()/poll(), if you do for example : FD_ZERO(&fdset); FD_SET(fd, &fdset); select(fd+1,&fdset, NULL, NULL, NULL); newfd = dup(fd); close(fd); for (i = 0 ; i < maxfd ; i++) if (FD_ISSET(i, &fdset)) read(i, ...) -
| David Miller | Re: Slow DOWN, please!!! |
| Greg Kroah-Hartman | [PATCH 013/196] Documentation: Replace obsolete "driverfs" with "sysfs". |
| James Bottomley | Re: Integration of SCST in the mainstream Linux kernel |
| Jeff Garzik | Re: [RFC] Heads up on sys_fallocate() |
git: | |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| Linus Torvalds | Re: [GIT]: Networking |
| Andrew Morton | Re: [BUG] New Kernel Bugs |
