On Sat Sep 17 18:24:58 2022 +0000, **** wrote:
Zebediah Figura replied on the mailing list: ``` On 9/17/22 12:13, Witold Baryluk wrote:
From: Witold Baryluk <witold.baryluk(a)gmail.com>
--- dlls/ntdll/unix/virtual.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
This looks good, just a few nitpicks occur to me...
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 58afc87375c..6dc2abf4666 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -199,6 +199,10 @@ static BYTE **pages_vprot; static BYTE *pages_vprot; #endif
+#if !defined(HAVE_LIBPROCSTAT) +static int pagemap_fd = -1; +#endif + This doesn't actually need to be moved to global scope. static struct file_view *view_block_start, *view_block_end, *next_free_view; static const size_t view_block_size = 0x100000; static void *preload_reserve_start; @@ -4203,7 +4207,6 @@ static NTSTATUS get_working_set_ex( HANDLE process, LPCVOID addr,
MEMORY_WORKING_SET_EX_INFORMATION *info,
SIZE_T len, SIZE_T *res_len ) { - int pagemap_fd; MEMORY_WORKING_SET_EX_INFORMATION *p; sigset_t sigset;
@@ -4266,14 +4269,16 @@ static NTSTATUS get_working_set_ex( HANDLE
process, LPCVOID addr,
procstat_close( pstat ); } #else - pagemap_fd = open( "/proc/self/pagemap", O_RDONLY, 0 ); - if (pagemap_fd == -1) + server_enter_uninterrupted_section( &virtual_mutex, &sigset ); { - static int once; - if (!once++) WARN( "unable to open /proc/self/pagemap\n" ); + static int once = 0;
Static variables are implicitly initialized to zero. That said, you could get rid of "once" by using some other negative value as a sentinel for pagemap_fd (e.g. -2).
+ if (once == 0 && pagemap_fd == -1) { Braces go on the new line, as in surrounding code.
Ok. Please take another look.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/852#note_8754