now working with libuv v1.34.x
This commit is contained in:
parent
8f868995fc
commit
ed766f709a
@ -16,7 +16,7 @@ endif()
|
|||||||
# Project configuration
|
# Project configuration
|
||||||
#
|
#
|
||||||
|
|
||||||
project(uvw VERSION 2.2.0)
|
project(uvw VERSION 2.3.0)
|
||||||
|
|
||||||
if(NOT CMAKE_BUILD_TYPE)
|
if(NOT CMAKE_BUILD_TYPE)
|
||||||
set(CMAKE_BUILD_TYPE Debug)
|
set(CMAKE_BUILD_TYPE Debug)
|
||||||
|
|||||||
@ -17,7 +17,7 @@ ExternalProject_Add(
|
|||||||
ExternalProject_Add(
|
ExternalProject_Add(
|
||||||
libuv
|
libuv
|
||||||
GIT_REPOSITORY https://github.com/libuv/libuv.git
|
GIT_REPOSITORY https://github.com/libuv/libuv.git
|
||||||
GIT_TAG v1.33.0
|
GIT_TAG v1.34.0
|
||||||
SOURCE_DIR @LIBUV_DEPS_DIR@
|
SOURCE_DIR @LIBUV_DEPS_DIR@
|
||||||
CONFIGURE_COMMAND ""
|
CONFIGURE_COMMAND ""
|
||||||
BUILD_COMMAND ""
|
BUILD_COMMAND ""
|
||||||
|
|||||||
@ -14,7 +14,7 @@ class UVMConan(ConanFile):
|
|||||||
exports = "LICENSE"
|
exports = "LICENSE"
|
||||||
exports_sources = "src/*"
|
exports_sources = "src/*"
|
||||||
no_copy_source = True
|
no_copy_source = True
|
||||||
requires = "libuv/1.32.0@bincrafters/stable"
|
requires = "libuv/1.34.0@bincrafters/stable"
|
||||||
|
|
||||||
def package(self):
|
def package(self):
|
||||||
self.copy(pattern="LICENSE", dst="licenses")
|
self.copy(pattern="LICENSE", dst="licenses")
|
||||||
|
|||||||
@ -53,7 +53,8 @@ enum class UVFsType: std::underlying_type_t<uv_fs_type> {
|
|||||||
OPENDIR = UV_FS_OPENDIR,
|
OPENDIR = UV_FS_OPENDIR,
|
||||||
READDIR = UV_FS_READDIR,
|
READDIR = UV_FS_READDIR,
|
||||||
CLOSEDIR = UV_FS_CLOSEDIR,
|
CLOSEDIR = UV_FS_CLOSEDIR,
|
||||||
STATFS = UV_FS_STATFS
|
STATFS = UV_FS_STATFS,
|
||||||
|
MKSTEMP = UV_FS_MKSTEMP
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -152,6 +153,7 @@ enum class UVSymLinkFlags: int {
|
|||||||
* * `FsRequest::Type::READDIR`
|
* * `FsRequest::Type::READDIR`
|
||||||
* * `FsRequest::Type::CLOSEDIR`
|
* * `FsRequest::Type::CLOSEDIR`
|
||||||
* * `FsRequest::Type::STATFS`
|
* * `FsRequest::Type::STATFS`
|
||||||
|
* * `FsRequest::Type::MKSTEMP`
|
||||||
*
|
*
|
||||||
* It will be emitted by FsReq and/or FileReq according with their
|
* It will be emitted by FsReq and/or FileReq according with their
|
||||||
* functionalities.
|
* functionalities.
|
||||||
@ -288,6 +290,23 @@ struct FsEvent<details::UVFsType::STATFS> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief FsEvent event specialization for `FsRequest::Type::MKSTEMP`.
|
||||||
|
*
|
||||||
|
* It will be emitted by FsReq and/or FileReq according with their
|
||||||
|
* functionalities.
|
||||||
|
*/
|
||||||
|
template<>
|
||||||
|
struct FsEvent<details::UVFsType::MKSTEMP> {
|
||||||
|
FsEvent(const char *pathname, std::size_t desc) noexcept
|
||||||
|
: path{pathname}, descriptor{desc}
|
||||||
|
{}
|
||||||
|
|
||||||
|
const char * path; /*!< The created file path. */
|
||||||
|
std::size_t descriptor; /*!< The file descriptor as an integer. */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief FsEvent event specialization for `FsRequest::Type::SCANDIR`.
|
* @brief FsEvent event specialization for `FsRequest::Type::SCANDIR`.
|
||||||
*
|
*
|
||||||
@ -974,7 +993,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @return A `std::pair` composed as it follows:
|
* @return A `std::pair` composed as it follows:
|
||||||
* * A boolean value that is true in case of success, false otherwise.
|
* * A boolean value that is true in case of success, false otherwise.
|
||||||
* * The actual path of the newly created directoy.
|
* * The actual path of the newly created directory.
|
||||||
*/
|
*/
|
||||||
std::pair<bool, const char *> mkdtempSync(std::string tpl) {
|
std::pair<bool, const char *> mkdtempSync(std::string tpl) {
|
||||||
auto req = get();
|
auto req = get();
|
||||||
@ -982,6 +1001,52 @@ public:
|
|||||||
return std::make_pair(!(req->result < 0), req->path);
|
return std::make_pair(!(req->result < 0), req->path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Async [mkstemp](https://linux.die.net/man/3/mkstemp).
|
||||||
|
*
|
||||||
|
* Emit a `FsEvent<FsReq::Type::MKSTEMP>` event when completed.<br/>
|
||||||
|
* Emit an ErrorEvent event in case of errors.
|
||||||
|
*
|
||||||
|
* @param tpl Template, as described in the official documentation.
|
||||||
|
*/
|
||||||
|
void mkstemp(std::string tpl) {
|
||||||
|
cleanupAndInvoke(&uv_fs_mkstemp, parent(), get(), tpl.data(), &fsResultCallback<Type::MKSTEMP>);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sync [mkstemp](https://linux.die.net/man/3/mkstemp).
|
||||||
|
*
|
||||||
|
* Returns a composed value where:
|
||||||
|
*
|
||||||
|
* * The first parameter indicates the created file path.
|
||||||
|
* * The second parameter is the file descriptor as an integer.
|
||||||
|
*
|
||||||
|
* See the official
|
||||||
|
* [documentation](http://docs.libuv.org/en/v1.x/fs.html#c.uv_fs_mkstemp)
|
||||||
|
* for further details.
|
||||||
|
*
|
||||||
|
* @param tpl Template, as described in the official documentation.
|
||||||
|
*
|
||||||
|
* @return A pair where:
|
||||||
|
|
||||||
|
* * The first parameter is a boolean value that is true in case of success,
|
||||||
|
* false otherwise.
|
||||||
|
* * The second parameter is a composed value (see above).
|
||||||
|
*/
|
||||||
|
std::pair<bool, std::pair<std::string, std::size_t>> mkstempSync(std::string tpl) {
|
||||||
|
std::pair<bool, std::pair<std::string, std::size_t>> ret{false, {}};
|
||||||
|
auto req = get();
|
||||||
|
cleanupAndInvokeSync(&uv_fs_mkdtemp, parent(), req, tpl.data());
|
||||||
|
ret.first = !(req->result < 0);
|
||||||
|
|
||||||
|
if(ret.first) {
|
||||||
|
ret.second.first = req->path;
|
||||||
|
ret.second.second = static_cast<std::size_t>(req->result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Async [rmdir](http://linux.die.net/man/2/rmdir).
|
* @brief Async [rmdir](http://linux.die.net/man/2/rmdir).
|
||||||
*
|
*
|
||||||
|
|||||||
@ -1004,11 +1004,19 @@ struct Utilities {
|
|||||||
* [`gettimeofday`](https://linux.die.net/man/2/gettimeofday)
|
* [`gettimeofday`](https://linux.die.net/man/2/gettimeofday)
|
||||||
* @return The current time.
|
* @return The current time.
|
||||||
*/
|
*/
|
||||||
static TimeVal64 timeOfDay() {
|
static TimeVal64 timeOfDay() noexcept {
|
||||||
uv_timeval64_t ret;
|
uv_timeval64_t ret;
|
||||||
uv_gettimeofday(&ret);
|
uv_gettimeofday(&ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Causes the calling thread to sleep for a while.
|
||||||
|
* @param msec Number of milliseconds to sleep.
|
||||||
|
*/
|
||||||
|
static void sleep(unsigned int msec) noexcept {
|
||||||
|
uv_sleep(msec);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user