@@ -145,7 +145,7 @@ uc_uloop_vm_call(uc_vm_t *vm, bool mcall, size_t nargs)
145145}
146146
147147static void
148- uc_uloop_cb_invoke (uc_uloop_cb_t * cb , uc_value_t * arg )
148+ uc_uloop_cb_invoke (uc_uloop_cb_t * cb , uc_value_t * * args , size_t nargs )
149149{
150150 uc_vm_t * vm = cb -> vm ;
151151 uc_value_t * func = ucv_resource_value_get (cb -> obj , 0 );
@@ -155,9 +155,10 @@ uc_uloop_cb_invoke(uc_uloop_cb_t *cb, uc_value_t *arg)
155155
156156 uc_vm_stack_push (vm , ucv_get (cb -> obj ));
157157 uc_vm_stack_push (vm , ucv_get (func ));
158- uc_vm_stack_push (vm , ucv_get (arg ));
158+ for (size_t i = 0 ; i < nargs ; i ++ )
159+ uc_vm_stack_push (vm , ucv_get (args [i ]));
159160
160- if (uc_uloop_vm_call (vm , true, 1 ))
161+ if (uc_uloop_vm_call (vm , true, nargs ))
161162 ucv_put (uc_vm_stack_pop (vm ));
162163}
163164
@@ -536,7 +537,7 @@ uc_uloop_timer_cb(struct uloop_timeout *timeout)
536537{
537538 uc_uloop_timer_t * timer = container_of (timeout , uc_uloop_timer_t , timeout );
538539
539- uc_uloop_cb_invoke (& timer -> cb , NULL );
540+ uc_uloop_cb_invoke (& timer -> cb , NULL , 0 );
540541}
541542
542543/**
@@ -724,10 +725,16 @@ static void
724725uc_uloop_handle_cb (struct uloop_fd * fd , unsigned int flags )
725726{
726727 uc_uloop_handle_t * handle = container_of (fd , uc_uloop_handle_t , fd );
727- uc_value_t * f = ucv_uint64_new (flags );
728+ uc_value_t * args [3 ] = {
729+ ucv_uint64_new (flags ),
730+ ucv_boolean_new (fd -> eof ),
731+ ucv_boolean_new (fd -> error ),
732+ };
728733
729- uc_uloop_cb_invoke (& handle -> cb , f );
730- ucv_put (f );
734+ uc_uloop_cb_invoke (& handle -> cb , args , 3 );
735+ ucv_put (args [0 ]);
736+ ucv_put (args [1 ]);
737+ ucv_put (args [2 ]);
731738}
732739
733740static int
@@ -951,7 +958,7 @@ uc_uloop_process_cb(struct uloop_process *proc, int exitcode)
951958 uc_uloop_process_t * process = container_of (proc , uc_uloop_process_t , process );
952959 uc_value_t * e = ucv_int64_new (exitcode >> 8 );
953960
954- uc_uloop_cb_invoke (& process -> cb , e );
961+ uc_uloop_cb_invoke (& process -> cb , & e , 1 );
955962 uc_uloop_process_clear (process );
956963 ucv_put (e );
957964}
@@ -1947,7 +1954,7 @@ uc_uloop_interval_cb(struct uloop_interval *uintv)
19471954{
19481955 uc_uloop_interval_t * interval = container_of (uintv , uc_uloop_interval_t , interval );
19491956
1950- uc_uloop_cb_invoke (& interval -> cb , NULL );
1957+ uc_uloop_cb_invoke (& interval -> cb , NULL , 0 );
19511958}
19521959
19531960/**
@@ -2105,7 +2112,7 @@ uc_uloop_signal_cb(struct uloop_signal *usig)
21052112{
21062113 uc_uloop_signal_t * signal = container_of (usig , uc_uloop_signal_t , signal );
21072114
2108- uc_uloop_cb_invoke (& signal -> cb , NULL );
2115+ uc_uloop_cb_invoke (& signal -> cb , NULL , 0 );
21092116}
21102117
21112118static int
0 commit comments