22#include "poll_priv.h"
33#include <string.h>
44#include <stdarg.h>
5- #include <errno.h>
65
76static module_ret_code init_ctx (const char * ctx_name , m_context * * context );
87static void destroy_ctx (const char * ctx_name , m_context * context );
@@ -13,7 +12,6 @@ static int tell_if(void *data, void *m);
1312static pubsub_msg_t * create_pubsub_msg (const unsigned char * message , const self_t * sender , const char * topic , enum msg_type type , const size_t size );
1413static module_ret_code tell_pubsub_msg (pubsub_msg_t * m , module * mod , m_context * c );
1514static int manage_fds (module * mod , m_context * c , int flag , int stop );
16- static int _poll_set_new_evt (module_poll_t * t , m_context * c , int flag );
1715static module_ret_code start (const self_t * self , const enum module_states mask , const char * err_str );
1816static module_ret_code stop (const self_t * self , const enum module_states mask , const char * err_str , int stop );
1917
@@ -198,7 +196,7 @@ module_ret_code module_register_fd(const self_t *self, const int fd, const bool
198196
199197 /* If a fd is registered at runtime, start polling on it */
200198 if (module_is (self , RUNNING )) {
201- int ret = _poll_set_new_evt (tmp , c , ADD );
199+ int ret = poll_set_new_evt (tmp , c , ADD );
202200 return !ret ? MOD_OK : MOD_ERR ;
203201 }
204202 return MOD_OK ;
@@ -218,7 +216,7 @@ module_ret_code module_deregister_fd(const self_t *self, const int fd) {
218216 * tmp = (* tmp )-> prev ;
219217 /* If a fd is deregistered for a RUNNING module, stop polling on it */
220218 if (module_is (self , RUNNING )) {
221- ret = _poll_set_new_evt (t , c , RM );
219+ ret = poll_set_new_evt (t , c , RM );
222220 }
223221 if (t -> autoclose ) {
224222 close (t -> fd );
@@ -447,26 +445,12 @@ static int manage_fds(module *mod, m_context *c, int flag, int stop) {
447445 if (flag == RM && stop ) {
448446 ret = module_deregister_fd (& mod -> self , t -> fd );
449447 } else {
450- ret = _poll_set_new_evt (t , c , flag );
448+ ret = poll_set_new_evt (t , c , flag );
451449 }
452450 }
453451 return ret ;
454452}
455453
456- /*
457- * Just a call to poll_set_new_evt + some filtering:
458- * STDIN_FILENO returns EPERM but it is actually pollable
459- */
460- static int _poll_set_new_evt (module_poll_t * t , m_context * c , int flag ) {
461- int ret = poll_set_new_evt (t , c , flag );
462- printf ("Ret: %d, errno: %d\n" , ret , errno );
463- /* Workaround for STDIN_FILENO */
464- if (ret == -1 && t -> fd == STDIN_FILENO && errno == EPERM ) {
465- ret = 0 ;
466- }
467- return ret ;
468- }
469-
470454static module_ret_code start (const self_t * self , const enum module_states mask , const char * err_str ) {
471455 GET_MOD_IN_STATE (self , mask );
472456
0 commit comments