diff --git a/winsup/cygwin/flock.cc b/winsup/cygwin/flock.cc index bd7a16d91..2f12fc07e 100644 --- a/winsup/cygwin/flock.cc +++ b/winsup/cygwin/flock.cc @@ -216,22 +216,6 @@ allow_others_to_sync () done = true; } -/* Get the handle count of an object. */ -static ULONG -get_obj_handle_count (HANDLE h) -{ - OBJECT_BASIC_INFORMATION obi; - NTSTATUS status; - ULONG hdl_cnt = 0; - - status = NtQueryObject (h, ObjectBasicInformation, &obi, sizeof obi, NULL); - if (!NT_SUCCESS (status)) - debug_printf ("NtQueryObject: %y", status); - else - hdl_cnt = obi.HandleCount; - return hdl_cnt; -} - /* Helper struct to construct a local OBJECT_ATTRIBUTES on the stack. */ struct lockfattr_t { diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc index 024ad70ba..adf9a3d0f 100644 --- a/winsup/cygwin/miscfuncs.cc +++ b/winsup/cygwin/miscfuncs.cc @@ -18,6 +18,22 @@ details. */ #include "tls_pbuf.h" #include "mmap_alloc.h" +/* Get handle count of an object. */ +ULONG +get_obj_handle_count (HANDLE h) +{ + OBJECT_BASIC_INFORMATION obi; + NTSTATUS status; + ULONG hdl_cnt = 0; + + status = NtQueryObject (h, ObjectBasicInformation, &obi, sizeof obi, NULL); + if (!NT_SUCCESS (status)) + debug_printf ("NtQueryObject: %y", status); + else + hdl_cnt = obi.HandleCount; + return hdl_cnt; +} + int __reg2 check_invalid_virtual_addr (const void *s, unsigned sz) { diff --git a/winsup/cygwin/miscfuncs.h b/winsup/cygwin/miscfuncs.h index 1ff7ee0d3..47cef6f20 100644 --- a/winsup/cygwin/miscfuncs.h +++ b/winsup/cygwin/miscfuncs.h @@ -98,6 +98,9 @@ transform_chars (PUNICODE_STRING upath, USHORT start_idx) PWCHAR transform_chars_af_unix (PWCHAR, const char *, __socklen_t); +/* Get handle count of an object. */ +ULONG get_obj_handle_count (HANDLE h); + /* Memory checking */ int __reg2 check_invalid_virtual_addr (const void *s, unsigned sz);