Skip to content

Commit

Permalink
src: add vlc_close() wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
Rémi Denis-Courmont committed Apr 21, 2016
1 parent 4d20516 commit 582355f
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
22 changes: 22 additions & 0 deletions include/vlc_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,28 @@ VLC_API ssize_t vlc_write(int, const void *, size_t);
*/
VLC_API ssize_t vlc_writev(int, const struct iovec *, int);

/**
* Closes a file descriptor.
*
* This closes a file descriptor. If this is a last file descriptor for the
* underlying open file, the file is closed too; the exact semantics depend
* on the type of file.
*
* @note The file descriptor is always closed when the function returns, even
* if the function returns an error. The sole exception is if the file
* descriptor was not currently valid, and thus cannot be closed (errno will
* then be set to EBADF).
*
* @param fd file descriptor
* @return Normally, zero is returned.
* If an I/O error is detected before or while closing, the function may return
* -1. Such an error is unrecoverable since the descriptor is closed.
*
* A nul return value does not necessarily imply that all pending I/O
* succeeded, since I/O might still occur asynchronously afterwards.
*/
VLC_API int vlc_close(int fd);

/**
* @}
*/
Expand Down
5 changes: 5 additions & 0 deletions src/os2/filesystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ int vlc_memfd (void)
return -1;
}

int vlc_close (int fd)
{
return close (fd);
}

int vlc_mkdir (const char *dirname, mode_t mode)
{
char *locname = ToLocaleDup (dirname);
Expand Down
5 changes: 5 additions & 0 deletions src/posix/filesystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ int vlc_memfd (void)
return fd;
}

int vlc_close (int fd)
{
return close (fd);
}

int vlc_mkdir (const char *dirname, mode_t mode)
{
return mkdir (dirname, mode);
Expand Down
5 changes: 5 additions & 0 deletions src/win32/filesystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ int vlc_memfd (void)
#endif
}

int vlc_close (int fd)
{
return close (fd);
}

int vlc_mkdir( const char *dirname, mode_t mode )
{
wchar_t *wpath = widen_path (dirname);
Expand Down

0 comments on commit 582355f

Please sign in to comment.