@@ -15,7 +15,7 @@ int poll_set_data(void **_ev) {
1515 return MOD_OK ;
1616}
1717
18- int poll_set_new_evt (module_poll_t * tmp , m_context * c , enum op_type flag ) {
18+ int poll_set_new_evt (module_poll_t * tmp , m_context * c , const enum op_type flag ) {
1919 int f = flag == ADD ? EV_ADD : EV_DELETE ;
2020 struct kevent * _ev = (struct kevent * )tmp -> ev ;
2121 EV_SET (_ev , tmp -> fd , EVFILT_READ , f , 0 , 0 , (void * )tmp );
@@ -27,19 +27,19 @@ int poll_set_new_evt(module_poll_t *tmp, m_context *c, enum op_type flag) {
2727 return ret ;
2828}
2929
30- int poll_init_pevents (void * * pevents , int max_events ) {
30+ int poll_init_pevents (void * * pevents , const int max_events ) {
3131 * pevents = memhook ._calloc (max_events , sizeof (struct kevent ));
3232 MOD_ALLOC_ASSERT (* pevents );
3333 return MOD_OK ;
3434}
3535
36- int poll_wait (int fd , int max_events , void * pevents , int timeout ) {
36+ int poll_wait (const int fd , const int max_events , void * pevents , const int timeout ) {
3737 struct timespec t = {0 };
3838 t .tv_sec = timeout ;
3939 return kevent (fd , NULL , 0 , (struct kevent * )pevents , max_events , timeout >= 0 ? & t : NULL );
4040}
4141
42- module_poll_t * poll_recv (int idx , void * pevents ) {
42+ module_poll_t * poll_recv (const int idx , void * pevents ) {
4343 struct kevent * pev = (struct kevent * )pevents ;
4444 if (pev [idx ].flags & EV_ERROR ) {
4545 return NULL ;
@@ -54,7 +54,7 @@ int poll_destroy_pevents(void **pevents, int *max_events) {
5454 return MOD_OK ;
5555}
5656
57- int poll_close (int fd , void * * pevents , int * max_events ) {
57+ int poll_close (const int fd , void * * pevents , int * max_events ) {
5858 poll_destroy_pevents (pevents , max_events );
5959 return close (fd );
6060}
0 commit comments