@@ -79,7 +79,6 @@ static struct _st_kqdata {
79
79
int dellist_size ;
80
80
int dellist_cnt ;
81
81
int kq ;
82
- pid_t pid ;
83
82
} * _st_kq_data ;
84
83
85
84
#ifndef ST_KQ_MIN_EVTLIST_SIZE
@@ -108,7 +107,6 @@ static struct _st_epolldata {
108
107
int evtlist_cnt ;
109
108
int fd_hint ;
110
109
int epfd ;
111
- pid_t pid ;
112
110
} * _st_epoll_data ;
113
111
114
112
#ifndef ST_EPOLL_EVTLIST_SIZE
@@ -152,7 +150,6 @@ ST_HIDDEN int _st_kq_init(void)
152
150
goto cleanup_kq ;
153
151
}
154
152
fcntl (_st_kq_data -> kq , F_SETFD , FD_CLOEXEC );
155
- _st_kq_data -> pid = getpid ();
156
153
157
154
/*
158
155
* Allocate file descriptor data array.
@@ -388,7 +385,6 @@ ST_HIDDEN void _st_kq_dispatch(void)
388
385
tsp = & timeout ;
389
386
}
390
387
391
- retry_kevent :
392
388
/* Check for I/O operations */
393
389
nfd = kevent (_st_kq_data -> kq ,
394
390
_st_kq_data -> addlist , _st_kq_data -> addlist_cnt ,
@@ -482,24 +478,6 @@ ST_HIDDEN void _st_kq_dispatch(void)
482
478
osfd = _st_kq_data -> evtlist [i ].ident ;
483
479
_ST_KQ_REVENTS (osfd ) = 0 ;
484
480
}
485
-
486
- } else if (nfd < 0 ) {
487
- if (errno == EBADF && _st_kq_data -> pid != getpid ()) {
488
- /* We probably forked, reinitialize kqueue */
489
- if ((_st_kq_data -> kq = kqueue ()) < 0 ) {
490
- /* There is nothing we can do here, will retry later */
491
- return ;
492
- }
493
- fcntl (_st_kq_data -> kq , F_SETFD , FD_CLOEXEC );
494
- _st_kq_data -> pid = getpid ();
495
- /* Re-register all descriptors on ioq with new kqueue */
496
- memset (_st_kq_data -> fd_data , 0 , _st_kq_data -> fd_data_size * sizeof (_kq_fd_data_t ));
497
- for (q = _ST_IOQ .next ; q != & _ST_IOQ ; q = q -> next ) {
498
- pq = _ST_POLLQUEUE_PTR (q );
499
- _st_kq_pollset_add (pq -> pds , pq -> npds );
500
- }
501
- goto retry_kevent ;
502
- }
503
481
}
504
482
}
505
483
@@ -565,7 +543,6 @@ ST_HIDDEN int _st_epoll_init(void)
565
543
goto cleanup_epoll ;
566
544
}
567
545
fcntl (_st_epoll_data -> epfd , F_SETFD , FD_CLOEXEC );
568
- _st_epoll_data -> pid = getpid ();
569
546
570
547
/* Allocate file descriptor data array */
571
548
_st_epoll_data -> fd_data_size = _st_epoll_data -> fd_hint ;
@@ -765,26 +742,6 @@ ST_HIDDEN void _st_epoll_dispatch(void)
765
742
}
766
743
}
767
744
768
- if (_st_epoll_data -> pid != getpid ()) {
769
- /* We probably forked, reinitialize epoll set */
770
- close (_st_epoll_data -> epfd );
771
- _st_epoll_data -> epfd = epoll_create (_st_epoll_data -> fd_hint );
772
- if (_st_epoll_data -> epfd < 0 ) {
773
- /* There is nothing we can do here, will retry later */
774
- return ;
775
- }
776
- fcntl (_st_epoll_data -> epfd , F_SETFD , FD_CLOEXEC );
777
- _st_epoll_data -> pid = getpid ();
778
-
779
- /* Put all descriptors on ioq into new epoll set */
780
- memset (_st_epoll_data -> fd_data , 0 , _st_epoll_data -> fd_data_size * sizeof (_epoll_fd_data_t ));
781
- _st_epoll_data -> evtlist_cnt = 0 ;
782
- for (q = _ST_IOQ .next ; q != & _ST_IOQ ; q = q -> next ) {
783
- pq = _ST_POLLQUEUE_PTR (q );
784
- _st_epoll_pollset_add (pq -> pds , pq -> npds );
785
- }
786
- }
787
-
788
745
/* Check for I/O operations */
789
746
nfd = epoll_wait (_st_epoll_data -> epfd , _st_epoll_data -> evtlist , _st_epoll_data -> evtlist_size , timeout );
790
747
0 commit comments