@@ -63,6 +63,7 @@ typedef int (*orig_close_f_type)(int fd);
6363typedef FILE * (* orig_fopen_f_type )(const char * pathname , const char * mode );
6464typedef int (* orig_fclose_f_type )(FILE * fp );
6565typedef int (* orig_io_setup_f_type )(int nr_events , io_context_t * ctx_idp );
66+ typedef int (* orig_io_destroy_f_type )(io_context_t ctx_id );
6667typedef int (* orig_io_submit_f_type )(io_context_t ctx_id , long nr , struct iocb * ios []);
6768typedef int (* orig_io_getevents_f_type )(io_context_t ctx_id , long min_nr , long nr ,
6869 struct io_event * events , struct timespec * timeout );
@@ -93,6 +94,7 @@ static orig_close_f_type orig_close = NULL;
9394static orig_fopen_f_type orig_fopen = NULL ;
9495static orig_fclose_f_type orig_fclose = NULL ;
9596static orig_io_setup_f_type orig_io_setup = NULL ;
97+ static orig_io_destroy_f_type orig_io_destroy = NULL ;
9698static orig_io_submit_f_type orig_io_submit = NULL ;
9799static orig_io_getevents_f_type orig_io_getevents = NULL ;
98100static orig_io_cancel_f_type orig_io_cancel = NULL ;
@@ -158,6 +160,7 @@ init (void)
158160 exit (1 );
159161 }
160162 orig_io_setup = (orig_io_setup_f_type )dlsym_fatal (handle ,"io_setup" );
163+ orig_io_destroy = (orig_io_destroy_f_type )dlsym_fatal (handle ,"io_destroy" );
161164 orig_io_submit = (orig_io_submit_f_type )dlsym_fatal (handle ,"io_submit" );
162165 orig_io_getevents = (orig_io_getevents_f_type )dlsym_fatal (handle ,"io_getevents" );
163166 orig_io_cancel = (orig_io_cancel_f_type )dlsym_fatal (handle ,"io_cancel" );
@@ -625,6 +628,19 @@ int io_setup(int nr_events, io_context_t *ctx_idp)
625628 return 0 ;
626629}
627630
631+ int io_destroy (io_context_t ctx_id )
632+ {
633+ init ();
634+
635+ if (!translate_aio ) {
636+ return orig_io_destroy (ctx_id );
637+ }
638+
639+ if (ctx_id != & our_io_context ) {
640+ return EINVAL ;
641+ }
642+ return 0 ;
643+ }
628644
629645int io_submit (io_context_t ctx_id , long nr , struct iocb * ios [])
630646{
0 commit comments