From 9b668ab2f59eb239408459432b791d62aa5caa3c Mon Sep 17 00:00:00 2001 From: Santiago Gimeno Date: Tue, 28 Aug 2018 13:51:01 +0200 Subject: [PATCH] win: remove uv_get_osfhandle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As it is not needed anymore after implementing LEP-0005. PR-URL: https://github.com/libuv/libuv/pull/1962 Reviewed-By: Saúl Ibarra Corretgé Reviewed-By: Colin Ihrig --- docs/src/fs.rst | 9 --------- include/uv.h | 2 -- src/unix/core.c | 5 ----- src/win/handle.c | 5 ----- test/test-fs.c | 46 ---------------------------------------------- test/test-list.h | 2 -- 6 files changed, 69 deletions(-) diff --git a/docs/src/fs.rst b/docs/src/fs.rst index 030bc213..55645a55 100644 --- a/docs/src/fs.rst +++ b/docs/src/fs.rst @@ -445,15 +445,6 @@ Helper functions .. versionadded:: 2.0.0 replace uv_file with uv_os_fd_t -.. c:function:: int uv_open_osfhandle(uv_os_fd_t os_fd) - - For a OS-dependent handle, get the file descriptor in the C runtime. - On UNIX, returns the ``os_fd`` intact. On Windows, this calls `_open_osfhandle `_. - Note that the return value is still owned by the CRT, - any attempts to close it or to use it after closing the handle may lead to malfunction. - - .. versionadded:: 1.23.0 - File open constants ------------------- diff --git a/include/uv.h b/include/uv.h index c3147982..39b3347c 100644 --- a/include/uv.h +++ b/include/uv.h @@ -1131,8 +1131,6 @@ UV_EXTERN int uv_get_process_title(char* buffer, size_t size); UV_EXTERN int uv_set_process_title(const char* title); UV_EXTERN int uv_resident_set_memory(size_t* rss); UV_EXTERN int uv_uptime(double* uptime); -UV_EXTERN uv_os_fd_t uv_get_osfhandle(int fd); -UV_EXTERN int uv_open_osfhandle(uv_os_fd_t os_fd); typedef struct { long tv_sec; diff --git a/src/unix/core.c b/src/unix/core.c index ed226241..ed0430be 100644 --- a/src/unix/core.c +++ b/src/unix/core.c @@ -1352,11 +1352,6 @@ int uv_os_gethostname(char* buffer, size_t* size) { } -int uv_open_osfhandle(uv_os_fd_t os_fd) { - return os_fd; -} - - uv_pid_t uv_os_getpid(void) { return getpid(); } diff --git a/src/win/handle.c b/src/win/handle.c index 26291697..1912f129 100644 --- a/src/win/handle.c +++ b/src/win/handle.c @@ -148,8 +148,3 @@ void uv_close(uv_handle_t* handle, uv_close_cb cb) { int uv_is_closing(const uv_handle_t* handle) { return !!(handle->flags & (UV_HANDLE_CLOSING | UV_HANDLE_CLOSED)); } - - -int uv_open_osfhandle(uv_os_fd_t os_fd) { - return _open_osfhandle((intptr_t) os_fd, 0); -} diff --git a/test/test-fs.c b/test/test-fs.c index e089b096..9cf6987f 100644 --- a/test/test-fs.c +++ b/test/test-fs.c @@ -3264,52 +3264,6 @@ TEST_IMPL(fs_invalid_filename) { } #endif -TEST_IMPL(open_osfhandle_valid_handle) { - int r; - uv_os_fd_t handle; - int fd; - - /* Setup. */ - unlink("test_file"); - - loop = uv_default_loop(); - - r = uv_fs_open(NULL, - &open_req1, - "test_file", - O_RDWR | O_CREAT, - S_IWUSR | S_IRUSR, - NULL); - ASSERT(r >= 0); - ASSERT(open_req1.result >= 0); - uv_fs_req_cleanup(&open_req1); - - handle = (uv_os_fd_t) open_req1.result; -#ifdef _WIN32 - ASSERT(handle != INVALID_HANDLE_VALUE); -#else - ASSERT(handle >= 0); -#endif - - fd = uv_open_osfhandle(handle); -#ifdef _WIN32 - ASSERT(fd > 0); -#else - ASSERT(fd == open_req1.result); -#endif - - r = uv_fs_close(NULL, &close_req, (uv_os_fd_t) open_req1.result, NULL); - ASSERT(r == 0); - ASSERT(close_req.result == 0); - uv_fs_req_cleanup(&close_req); - - /* Cleanup. */ - unlink("test_file"); - - MAKE_VALGRIND_HAPPY(); - return 0; -} - TEST_IMPL(fs_file_pos_after_op_with_offset) { int r; uv_os_fd_t file; diff --git a/test/test-list.h b/test/test-list.h index e7278351..02c9c42e 100644 --- a/test/test-list.h +++ b/test/test-list.h @@ -352,7 +352,6 @@ TEST_DECLARE (fs_read_write_null_arguments) #ifdef _WIN32 TEST_DECLARE (fs_invalid_filename) #endif -TEST_DECLARE (open_osfhandle_valid_handle) TEST_DECLARE (fs_write_alotof_bufs) TEST_DECLARE (fs_write_alotof_bufs_with_offset) TEST_DECLARE (fs_file_pos_after_op_with_offset) @@ -925,7 +924,6 @@ TASK_LIST_START TEST_ENTRY (fs_open_readonly_acl) TEST_ENTRY (fs_fchmod_archive_readonly) #endif - TEST_ENTRY (open_osfhandle_valid_handle) TEST_ENTRY (threadpool_queue_work_simple) TEST_ENTRY (threadpool_queue_work_einval) TEST_ENTRY (threadpool_multiple_event_loops)