diff options
author | Christian Pointner <equinox@spreadspace.org> | 2010-11-18 22:05:39 +0000 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2010-11-18 22:05:39 +0000 |
commit | 9379a3e13b0dac435c7ad43e678b8b159e075816 (patch) | |
tree | dd46d437ae793937d86d378ef06bebc81bafb581 | |
parent | added util module with own select (diff) |
removed now useles dirty functions
fixed timeout at util.select
git-svn-id: https://svn.spreadspace.org/gcsd/trunk@40 ac14a137-c7f1-4531-abe0-07747231d213
-rw-r--r-- | src/l_sig_handler.c | 9 | ||||
-rw-r--r-- | src/l_util.c | 8 | ||||
-rw-r--r-- | src/modules/debug_shell.lua | 2 | ||||
-rw-r--r-- | src/modules/dummy.lua | 1 | ||||
-rw-r--r-- | src/modules/stdio.lua | 2 | ||||
-rw-r--r-- | src/modules/stdout.lua | 1 |
6 files changed, 4 insertions, 19 deletions
diff --git a/src/l_sig_handler.c b/src/l_sig_handler.c index 2f2018e..07f99b0 100644 --- a/src/l_sig_handler.c +++ b/src/l_sig_handler.c @@ -47,12 +47,6 @@ static int l_signal_getfd(lua_State *L) return 1; } -static int l_signal_dirty(lua_State *L) -{ - lua_pushboolean(L, 0); - return 1; -} - static int l_signal_init(lua_State *L) { int sig_fd = signal_init(); @@ -66,9 +60,6 @@ static int l_signal_init(lua_State *L) lua_pushliteral(L, "getfd"); lua_pushcfunction(L, l_signal_getfd); lua_settable(L, -3); - lua_pushliteral(L, "dirty"); - lua_pushcfunction(L, l_signal_dirty); - lua_settable(L, -3); return 1; } diff --git a/src/l_util.c b/src/l_util.c index 778c5b7..b08682a 100644 --- a/src/l_util.c +++ b/src/l_util.c @@ -44,7 +44,7 @@ static int get_fd(lua_State *L) if(!lua_istable(L, -1)) return -1; - lua_pushstring(L, "getfd"); + lua_pushliteral(L, "getfd"); lua_gettable(L, -2); if(lua_isnil(L, -1)) { lua_pop(L,1); @@ -116,7 +116,7 @@ static int l_util_select(lua_State *L) struct timeval tv; struct timeval* timeout = NULL; - if(timeout > 0) { + if(ms > 0) { tv.tv_sec = 0; tv.tv_usec = ms * 1000; timeout = &tv; @@ -126,9 +126,9 @@ static int l_util_select(lua_State *L) lua_pushnil(L); lua_pushnil(L); if(!ret) - lua_pushstring(L, "timeout"); + lua_pushliteral(L, "timeout"); else if(errno == EINTR) - lua_pushstring(L, "signal"); + lua_pushliteral(L, "signal"); else lua_pushstring(L, strerror(errno)); // FIXXXXXME: strerror is not threadsafe!!! return 3; diff --git a/src/modules/debug_shell.lua b/src/modules/debug_shell.lua index 576e1cc..652be45 100644 --- a/src/modules/debug_shell.lua +++ b/src/modules/debug_shell.lua @@ -84,7 +84,6 @@ function debug_shell:new(config) local server_sock = {} server_sock.sock = server_sock_raw function server_sock:getfd() return self.sock:getfd() end - function server_sock:dirty() return self.sock:dirty() end function server_sock:read() local client_sock_raw, err = self.sock:accept() if(client_sock_raw == nil) then @@ -98,7 +97,6 @@ function debug_shell:new(config) local client_sock = {} client_sock.sock = client_sock_raw function client_sock:getfd() return self.sock:getfd() end - function client_sock:dirty() return self.sock:dirty() end client_sock.client_instance = nil client_sock.in_buffer = "" client_sock.out_buffer = "" diff --git a/src/modules/dummy.lua b/src/modules/dummy.lua index 96341b1..62fe6ec 100644 --- a/src/modules/dummy.lua +++ b/src/modules/dummy.lua @@ -53,7 +53,6 @@ function dummy:new(config) handle.fd = 0 handle.client_instance = nil function handle:getfd() return self.fd end - function handle:dirty() return 0 end function handle:read() end function handle:write() end diff --git a/src/modules/stdio.lua b/src/modules/stdio.lua index e4c8282..8fb6f09 100644 --- a/src/modules/stdio.lua +++ b/src/modules/stdio.lua @@ -53,7 +53,6 @@ function stdio:new(config) in_handle.client_instance = nil in_handle.in_buffer = "" function in_handle:getfd() return self.fd end - function in_handle:dirty() return 0 end function in_handle:read() -- TODO: support read until matched command local buffer, err = rawio.read(0, 100) @@ -76,7 +75,6 @@ function stdio:new(config) out_handle.client_instance = nil out_handle.out_buffer = "" function out_handle:getfd() return self.fd end - function out_handle:dirty() return 0 end function out_handle:read() end function out_handle:write() local len, err = rawio.write(1, self.out_buffer) diff --git a/src/modules/stdout.lua b/src/modules/stdout.lua index b6b6c55..a508336 100644 --- a/src/modules/stdout.lua +++ b/src/modules/stdout.lua @@ -54,7 +54,6 @@ function stdout:new(config) handle.client_instance = nil handle.out_buffer = nil function handle:getfd() return self.fd end - function handle:dirty() return 0 end function handle:read() end function handle:write() local len, err = rawio.write(1, self.out_buffer) |