Commit 582355f9 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

src: add vlc_close() wrapper

parent 4d205167
......@@ -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);
/**
* @}
*/
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment