Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
5ac9e88e
Commit
5ac9e88e
authored
Jan 09, 2010
by
Antoine Cellerier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove vlc.net.select() and fd_set.
parent
5f5d7794
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
103 deletions
+1
-103
modules/misc/lua/libs/net.c
modules/misc/lua/libs/net.c
+0
-94
share/lua/README.txt
share/lua/README.txt
+1
-9
No files found.
modules/misc/lua/libs/net.c
View file @
5ac9e88e
...
...
@@ -216,98 +216,6 @@ static int vlclua_net_poll( lua_State *L )
return
1
;
}
static
int
vlclua_net_select
(
lua_State
*
L
)
{
int
i_ret
;
size_t
i_nfds
=
luaL_checkint
(
L
,
1
);
fd_set
*
fds_read
=
(
fd_set
*
)
luaL_checkudata
(
L
,
2
,
"fd_set"
);
fd_set
*
fds_write
=
(
fd_set
*
)
luaL_checkudata
(
L
,
3
,
"fd_set"
);
double
f_timeout
=
luaL_checknumber
(
L
,
4
);
struct
timeval
timeout
;
#ifndef WIN32
if
(
i_nfds
>
FD_SETSIZE
)
i_nfds
=
FD_SETSIZE
;
#endif
if
(
f_timeout
>=
0
.
)
{
timeout
.
tv_sec
=
(
int
)
f_timeout
;
timeout
.
tv_usec
=
(
int
)(
1e6
*
(
f_timeout
-
(
double
)((
int
)
f_timeout
)));
}
i_ret
=
select
(
i_nfds
,
fds_read
,
fds_write
,
0
,
f_timeout
>=
0
.
?
&
timeout
:
NULL
);
lua_pushinteger
(
L
,
i_ret
);
return
1
;
}
/*****************************************************************************
*
*****************************************************************************/
static
int
vlclua_fd_clr
(
lua_State
*
);
static
int
vlclua_fd_isset
(
lua_State
*
);
static
int
vlclua_fd_set
(
lua_State
*
);
static
int
vlclua_fd_zero
(
lua_State
*
);
static
const
luaL_Reg
vlclua_fd_set_reg
[]
=
{
{
"clr"
,
vlclua_fd_clr
},
{
"isset"
,
vlclua_fd_isset
},
{
"set"
,
vlclua_fd_set
},
{
"zero"
,
vlclua_fd_zero
},
{
NULL
,
NULL
}
};
static
int
vlclua_fd_set_new
(
lua_State
*
L
)
{
fd_set
*
fds
=
(
fd_set
*
)
lua_newuserdata
(
L
,
sizeof
(
fd_set
)
);
FD_ZERO
(
fds
);
if
(
luaL_newmetatable
(
L
,
"fd_set"
)
)
{
lua_newtable
(
L
);
luaL_register
(
L
,
NULL
,
vlclua_fd_set_reg
);
lua_setfield
(
L
,
-
2
,
"__index"
);
}
lua_setmetatable
(
L
,
-
2
);
return
1
;
}
static
int
vlclua_fd_clr
(
lua_State
*
L
)
{
fd_set
*
fds
=
(
fd_set
*
)
luaL_checkudata
(
L
,
1
,
"fd_set"
);
int
i_fd
=
luaL_checkint
(
L
,
2
);
FD_CLR
(
i_fd
,
fds
);
return
0
;
}
static
int
vlclua_fd_isset
(
lua_State
*
L
)
{
fd_set
*
fds
=
(
fd_set
*
)
luaL_checkudata
(
L
,
1
,
"fd_set"
);
int
i_fd
=
luaL_checkint
(
L
,
2
);
lua_pushboolean
(
L
,
FD_ISSET
(
i_fd
,
fds
)
);
return
1
;
}
static
int
vlclua_fd_set
(
lua_State
*
L
)
{
fd_set
*
fds
=
(
fd_set
*
)
luaL_checkudata
(
L
,
1
,
"fd_set"
);
size_t
i_fd
=
luaL_checkint
(
L
,
2
);
/* FIXME: we should really use poll() instead here, but that breaks the
* VLC/LUA API. On Windows, overflow protection is built-in FD_SET, not
* on POSIX. In both cases, run-time behavior will however be wrong. */
#ifndef WIN32
if
(
i_fd
<
FD_SETSIZE
)
#endif
FD_SET
(
i_fd
,
fds
);
return
0
;
}
static
int
vlclua_fd_zero
(
lua_State
*
L
)
{
fd_set
*
fds
=
(
fd_set
*
)
luaL_checkudata
(
L
,
1
,
"fd_set"
);
FD_ZERO
(
fds
);
return
0
;
}
/*****************************************************************************
*
*****************************************************************************/
...
...
@@ -432,8 +340,6 @@ static const luaL_Reg vlclua_net_reg[] = {
{
"send"
,
vlclua_net_send
},
{
"recv"
,
vlclua_net_recv
},
{
"poll"
,
vlclua_net_poll
},
{
"select"
,
vlclua_net_select
},
{
"fd_set_new"
,
vlclua_fd_set_new
},
{
"read"
,
vlclua_fd_read
},
{
"write"
,
vlclua_fd_write
},
{
"stat"
,
vlclua_stat
},
/* Not really "net" */
...
...
share/lua/README.txt
View file @
5ac9e88e
...
...
@@ -114,7 +114,7 @@ net.url_parse( url, [option delimiter] ): Parse URL. Returns a table with
net.listen_tcp( host, port ): Listen to TCP connections. This returns an
object with an accept and an fds method. accept is blocking (Poll on the
fds with the net.POLLIN flag if you want to be non blockin).
The fds method returns a list of fds you can call
select
on before using
The fds method returns a list of fds you can call
poll
on before using
the accept method. For example:
local l = vlc.net.listen_tcp( "localhost", 1234 )
while true do
...
...
@@ -131,14 +131,6 @@ net.poll( { fd = events }, [timeout in seconds] ): Implement poll function.
Retruns the numbers of file descriptors with a non 0 revent. The function
modifies the input table to { fd = revents }. See "man poll".
net.POLLIN/POLLPRI/POLLOUT/POLLRDHUP/POLLERR/POLLHUP/POLLNVAL: poll event flags
net.select( nfds, fds_read, fds_write, timeout ): Monitor a bunch of file
descriptors. Returns number of fds to handle. See "man select".
net.fd_set_new(): Create a new fd_set.
local fds = vlc.net.fd_set_new()
fds:clr( fd ) -- remove fd from set
fds:isset( fd ) -- check if fd is set
fds:set( fd ) -- add fd to set
fds:zero() -- clear the set
net.fd_read( fd, [max length] ): Read data from fd.
net.fd_write( fd, string, [length] ): Write data to fd.
net.stat( path ): Stat a file. Returns a table with the following fields:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment