From: RĂ©mi Denis-Courmont Date: Sun, 7 Jul 2013 17:25:41 +0000 (+0300) Subject: Lua: disable net.(poll|read|write) on Windows and document X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=deb38e43ecf62699d62e2dc80fd4c4aea4ac0d32;p=vlc Lua: disable net.(poll|read|write) on Windows and document These functions assume that sockets are file descriptors, never worked properly on Windows. See also 3841c0859053d29058682650e87bf085632eea54. --- diff --git a/modules/lua/libs/net.c b/modules/lua/libs/net.c index 0f6b3939d6..dd0719c2b0 100644 --- a/modules/lua/libs/net.c +++ b/modules/lua/libs/net.c @@ -189,6 +189,7 @@ static int vlclua_net_recv( lua_State *L ) return 1; } +#ifndef _WIN32 /***************************************************************************** * *****************************************************************************/ @@ -277,6 +278,7 @@ static int vlclua_fd_read( lua_State *L ) lua_pushnil( L ); return 1; } +#endif /***************************************************************************** * @@ -366,9 +368,11 @@ static const luaL_Reg vlclua_net_reg[] = { { "close", vlclua_net_close }, { "send", vlclua_net_send }, { "recv", vlclua_net_recv }, +#ifndef _WIN32 { "poll", vlclua_net_poll }, { "read", vlclua_fd_read }, { "write", vlclua_fd_write }, +#endif { "stat", vlclua_stat }, /* Not really "net" */ { "opendir", vlclua_opendir }, /* Not really "net" */ { NULL, NULL } diff --git a/share/lua/README.txt b/share/lua/README.txt index 9c9c8ac8a8..dc506afbdc 100644 --- a/share/lua/README.txt +++ b/share/lua/README.txt @@ -185,10 +185,13 @@ net.send( fd, string, [length] ): Send data on fd. net.recv( fd, [max length] ): Receive data from fd. net.poll( { fd = events } ): Implement poll function. Returns the numbers of file descriptors with a non 0 revent. The function - modifies the input table to { fd = revents }. See "man poll". + modifies the input table to { fd = revents }. See "man poll". This function + is not available on Windows. net.POLLIN/POLLPRI/POLLOUT/POLLRDHUP/POLLERR/POLLHUP/POLLNVAL: poll event flags -net.read( fd, [max length] ): Read data from fd. -net.write( fd, string, [length] ): Write data to fd. +net.read( fd, [max length] ): Read data from fd. This function is not + available on Windows. +net.write( fd, string, [length] ): Write data to fd. This function is not + available on Windows. net.stat( path ): Stat a file. Returns a table with the following fields: .type .mode