Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
c8c7d545
Commit
c8c7d545
authored
Jun 10, 2015
by
KO Myung-Hun
Committed by
Rémi Denis-Courmont
Jun 12, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
os2: filesystem: implement vlc_write() and vlc_writev()
Signed-off-by:
Rémi Denis-Courmont
<
remi@remlab.net
>
parent
c932b5e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
src/os2/filesystem.c
src/os2/filesystem.c
+41
-0
No files found.
src/os2/filesystem.c
View file @
c8c7d545
...
...
@@ -39,6 +39,7 @@
#include <sys/stat.h>
#include <dirent.h>
#include <sys/socket.h>
#include <signal.h>
#include <vlc_common.h>
#include <vlc_charset.h>
...
...
@@ -346,6 +347,46 @@ int vlc_pipe (int fds[2])
return
0
;
}
/**
* Writes data to a file descriptor. Unlike write(), if EPIPE error occurs,
* this function does not generate a SIGPIPE signal.
* @note If the file descriptor is known to be neither a pipe/FIFO nor a
* connection-oriented socket, the normal write() should be used.
*/
ssize_t
vlc_write
(
int
fd
,
const
void
*
buf
,
size_t
len
)
{
struct
iovec
iov
=
{
.
iov_base
=
(
void
*
)
buf
,
.
iov_len
=
len
};
return
vlc_writev
(
fd
,
&
iov
,
1
);
}
/**
* Writes data from an iovec structure to a file descriptor. Unlike writev(),
* if EPIPE error occurs, this function does not generate a SIGPIPE signal.
*/
ssize_t
vlc_writev
(
int
fd
,
const
struct
iovec
*
iov
,
int
count
)
{
sigset_t
set
,
oset
;
sigemptyset
(
&
set
);
sigaddset
(
&
set
,
SIGPIPE
);
pthread_sigmask
(
SIG_BLOCK
,
&
set
,
&
oset
);
ssize_t
val
=
writev
(
fd
,
iov
,
count
);
if
(
val
<
0
&&
errno
==
EPIPE
)
{
siginfo_t
info
;
struct
timespec
ts
=
{
0
,
0
};
while
(
sigtimedwait
(
&
set
,
&
info
,
&
ts
)
>=
0
||
errno
!=
EAGAIN
);
}
if
(
!
sigismember
(
&
oset
,
SIGPIPE
))
/* Restore the signal mask if changed */
pthread_sigmask
(
SIG_SETMASK
,
&
oset
,
NULL
);
return
val
;
}
#include <vlc_network.h>
/**
...
...
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