Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
c0b2d638
Commit
c0b2d638
authored
Feb 12, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
poll() replacement
parent
f9944743
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
101 additions
and
0 deletions
+101
-0
include/vlc_network.h
include/vlc_network.h
+22
-0
src/Makefile.am
src/Makefile.am
+1
-0
src/network/poll.c
src/network/poll.c
+78
-0
No files found.
include/vlc_network.h
View file @
c0b2d638
...
...
@@ -2,6 +2,7 @@
* vlc_network.h: interface to communicate with network plug-ins
*****************************************************************************
* Copyright (C) 2002-2005 the VideoLAN team
* Copyright © 2006-2007 Rémi Denis-Courmont
* $Id$
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
...
...
@@ -140,6 +141,27 @@ VLC_EXPORT( int, __net_vaPrintf, ( vlc_object_t *p_this, int fd, const v_socket_
int
inet_pton
(
int
af
,
const
char
*
src
,
void
*
dst
);
#endif
#ifndef HAVE_POLL
enum
{
POLLIN
=
1
,
POLLOUT
=
2
,
POLLPRI
=
4
POLLERR
=
8
,
// unsupported stub
POLLHUP
=
16
,
// unsupported stub
POLLNVAL
=
32
// unsupported stub
};
struct
pollfd
{
int
fd
;
int
events
;
int
revents
;
};
int
poll
(
struct
pollfd
*
fds
,
unsigned
nfds
,
int
timeout
);
#endif
/*****************************************************************************
* net_StopRecv/Send
...
...
src/Makefile.am
View file @
c0b2d638
...
...
@@ -275,6 +275,7 @@ SOURCES_libvlc_common = \
network/httpd.c
\
network/rootwrap.c
\
network/tls.c
\
network/poll.c
\
text/charset.c
\
text/strings.c
\
text/unicode.c
\
...
...
src/network/poll.c
0 → 100644
View file @
c0b2d638
/*****************************************************************************
* poll.c: I/O event multiplexing
*****************************************************************************
* Copyright © 2007 Rémi Denis-Courmont
* $Id$
*
* Author: Rémi Denis-Courmont
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <vlc/vlc.h>
#ifndef HAVE_POLL
#include <string.h>
#include <stdlib.h>
#include <vlc_network.h>
int
poll
(
struct
pollfd
*
fds
,
unsigned
nfds
,
int
timeout
)
{
fd_set
rdset
,
wrset
,
exset
;
struct
timeval
tv
=
{
0
,
0
};
int
val
=
-
1
;
FD_ZERO
(
&
rdset
);
FD_ZERO
(
&
wrset
);
FD_ZERO
(
&
exset
);
for
(
unsigned
i
=
0
;
i
<
nfds
;
i
++
)
{
int
fd
=
fds
[
i
].
fd
;
if
(
val
<
fd
)
val
=
fd
;
/* I assume the OS has a solution select overflow if it does not have
* poll(). If it did not, we are screwed anyway. */
if
(
fds
[
i
].
events
&
POLLIN
)
FD_SET
(
fd
,
&
rdset
);
if
(
fds
[
i
].
events
&
POLLOUT
)
FD_SET
(
fd
,
&
wrset
);
if
(
fds
[
i
].
events
&
POLLPRI
)
FD_SET
(
fd
,
&
exset
);
}
if
(
timeout
>=
0
)
{
div_t
d
=
div
(
timeout
,
1000
);
tv
.
tv_sec
=
d
.
quot
;
tv
.
tv_usec
=
d
.
rem
*
1000
;
}
val
=
select
(
val
+
1
,
&
rdset
,
&
wrset
,
NULL
,
(
timeout
>=
0
)
?
&
tv
:
NULL
);
if
(
val
==
-
1
)
return
-
1
;
for
(
unsigned
i
=
0
;
i
<
nfds
;
i
++
)
{
int
fd
=
fds
[
i
].
fd
;
fds
[
i
].
revents
=
(
FD_ISSET
(
fds
[
i
].
fd
,
&
rdset
)
?
POLLIN
:
0
)
|
(
FD_ISSET
(
fds
[
i
].
fd
,
&
wrset
)
?
POLLOUT
:
0
)
|
(
FD_ISSET
(
fds
[
i
].
fd
,
&
exset
)
?
POLLPRI
:
0
);
}
return
val
;
}
#endif
/* !HAVE_POLL */
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