kernel: Show the exe name instead of wine-[kp]thread in ps and top.
This commit is contained in:
parent
992a1af44b
commit
9603ee0756
|
@ -7037,6 +7037,7 @@ done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for ac_header in \
|
for ac_header in \
|
||||||
|
@ -7118,6 +7119,7 @@ for ac_header in \
|
||||||
sys/mtio.h \
|
sys/mtio.h \
|
||||||
sys/param.h \
|
sys/param.h \
|
||||||
sys/poll.h \
|
sys/poll.h \
|
||||||
|
sys/prctl.h \
|
||||||
sys/ptrace.h \
|
sys/ptrace.h \
|
||||||
sys/reg.h \
|
sys/reg.h \
|
||||||
sys/resource.h \
|
sys/resource.h \
|
||||||
|
@ -14870,6 +14872,7 @@ fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for ac_func in \
|
for ac_func in \
|
||||||
|
@ -14913,6 +14916,7 @@ for ac_func in \
|
||||||
mmap \
|
mmap \
|
||||||
pclose \
|
pclose \
|
||||||
popen \
|
popen \
|
||||||
|
prctl \
|
||||||
pread \
|
pread \
|
||||||
pwrite \
|
pwrite \
|
||||||
readlink \
|
readlink \
|
||||||
|
|
|
@ -250,6 +250,7 @@ AC_CHECK_HEADERS(\
|
||||||
sys/mtio.h \
|
sys/mtio.h \
|
||||||
sys/param.h \
|
sys/param.h \
|
||||||
sys/poll.h \
|
sys/poll.h \
|
||||||
|
sys/prctl.h \
|
||||||
sys/ptrace.h \
|
sys/ptrace.h \
|
||||||
sys/reg.h \
|
sys/reg.h \
|
||||||
sys/resource.h \
|
sys/resource.h \
|
||||||
|
@ -1188,6 +1189,7 @@ AC_CHECK_FUNCS(\
|
||||||
mmap \
|
mmap \
|
||||||
pclose \
|
pclose \
|
||||||
popen \
|
popen \
|
||||||
|
prctl \
|
||||||
pread \
|
pread \
|
||||||
pwrite \
|
pwrite \
|
||||||
readlink \
|
readlink \
|
||||||
|
|
|
@ -31,6 +31,9 @@
|
||||||
#ifdef HAVE_SYS_TIME_H
|
#ifdef HAVE_SYS_TIME_H
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_SYS_PRCTL_H
|
||||||
|
# include <sys/prctl.h>
|
||||||
|
#endif
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include "ntstatus.h"
|
#include "ntstatus.h"
|
||||||
|
@ -836,6 +839,64 @@ static void start_process( void *arg )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* set_process_name
|
||||||
|
*
|
||||||
|
* Change the process name in the ps output.
|
||||||
|
*/
|
||||||
|
static void set_process_name( int *argc, char *argv[], char *name )
|
||||||
|
{
|
||||||
|
#ifdef HAVE_PRCTL
|
||||||
|
int i, offset;
|
||||||
|
char *prctl_name = NULL;
|
||||||
|
char *end = argv[*argc-1] + strlen(argv[*argc-1]) + 1;
|
||||||
|
|
||||||
|
#ifndef PR_SET_NAME
|
||||||
|
# define PR_SET_NAME 15
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!name)
|
||||||
|
{
|
||||||
|
char *p;
|
||||||
|
prctl_name = argv[1];
|
||||||
|
if ((p = strrchr( prctl_name, '\\' ))) prctl_name = p + 1;
|
||||||
|
if ((p = strrchr( prctl_name, '/' ))) prctl_name = p + 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (strlen(name) <= strlen(argv[0])) prctl_name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prctl_name && prctl( PR_SET_NAME, prctl_name ) != -1)
|
||||||
|
{
|
||||||
|
if (name)
|
||||||
|
{
|
||||||
|
strcpy( argv[0], name );
|
||||||
|
offset = argv[1] - (argv[0] + strlen(name) + 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
offset = argv[1] - argv[0];
|
||||||
|
}
|
||||||
|
memmove( argv[1] - offset, argv[1], end - argv[1] );
|
||||||
|
memset( end - offset, 0, offset );
|
||||||
|
for (i = 1; i < *argc; i++) argv[i-1] = argv[i] - offset;
|
||||||
|
argv[i-1] = NULL;
|
||||||
|
(*argc)--;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif /* HAVE_PRCTL */
|
||||||
|
|
||||||
|
if (name) argv[0] = name;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* remove argv[0] */
|
||||||
|
memmove( argv, argv + 1, *argc * sizeof(argv[0]) );
|
||||||
|
(*argc)--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* __wine_kernel_init
|
* __wine_kernel_init
|
||||||
*
|
*
|
||||||
|
@ -845,18 +906,17 @@ void __wine_kernel_init(void)
|
||||||
{
|
{
|
||||||
static const WCHAR dotW[] = {'.',0};
|
static const WCHAR dotW[] = {'.',0};
|
||||||
static const WCHAR exeW[] = {'.','e','x','e',0};
|
static const WCHAR exeW[] = {'.','e','x','e',0};
|
||||||
|
static char winevdm[] = "winevdm.exe";
|
||||||
|
|
||||||
WCHAR *p, main_exe_name[MAX_PATH];
|
WCHAR *p, main_exe_name[MAX_PATH];
|
||||||
HMODULE module;
|
HMODULE module;
|
||||||
DWORD type, error = 0;
|
DWORD type, error = 0;
|
||||||
PEB *peb = NtCurrentTeb()->Peb;
|
PEB *peb = NtCurrentTeb()->Peb;
|
||||||
|
char *new_argv0 = NULL;
|
||||||
|
|
||||||
/* Initialize everything */
|
/* Initialize everything */
|
||||||
if (!process_init()) exit(1);
|
if (!process_init()) exit(1);
|
||||||
|
|
||||||
__wine_main_argv++; /* remove argv[0] (wine itself) */
|
|
||||||
__wine_main_argc--;
|
|
||||||
|
|
||||||
if (peb->ProcessParameters->ImagePathName.Buffer)
|
if (peb->ProcessParameters->ImagePathName.Buffer)
|
||||||
{
|
{
|
||||||
strcpyW( main_exe_name, peb->ProcessParameters->ImagePathName.Buffer );
|
strcpyW( main_exe_name, peb->ProcessParameters->ImagePathName.Buffer );
|
||||||
|
@ -865,11 +925,11 @@ void __wine_kernel_init(void)
|
||||||
{
|
{
|
||||||
WCHAR exe_nameW[MAX_PATH];
|
WCHAR exe_nameW[MAX_PATH];
|
||||||
|
|
||||||
MultiByteToWideChar( CP_UNIXCP, 0, __wine_main_argv[0], -1, exe_nameW, MAX_PATH );
|
MultiByteToWideChar( CP_UNIXCP, 0, __wine_main_argv[1], -1, exe_nameW, MAX_PATH );
|
||||||
if (!SearchPathW( NULL, exe_nameW, exeW, MAX_PATH, main_exe_name, NULL ) &&
|
if (!SearchPathW( NULL, exe_nameW, exeW, MAX_PATH, main_exe_name, NULL ) &&
|
||||||
!get_builtin_path( exe_nameW, exeW, main_exe_name, MAX_PATH ))
|
!get_builtin_path( exe_nameW, exeW, main_exe_name, MAX_PATH ))
|
||||||
{
|
{
|
||||||
MESSAGE( "wine: cannot find '%s'\n", __wine_main_argv[0] );
|
MESSAGE( "wine: cannot find '%s'\n", __wine_main_argv[1] );
|
||||||
ExitProcess( GetLastError() );
|
ExitProcess( GetLastError() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -879,7 +939,7 @@ void __wine_kernel_init(void)
|
||||||
if (!p || strchrW( p, '/' ) || strchrW( p, '\\' )) strcatW( main_exe_name, dotW );
|
if (!p || strchrW( p, '/' ) || strchrW( p, '\\' )) strcatW( main_exe_name, dotW );
|
||||||
|
|
||||||
TRACE( "starting process name=%s argv[0]=%s\n",
|
TRACE( "starting process name=%s argv[0]=%s\n",
|
||||||
debugstr_w(main_exe_name), debugstr_a(__wine_main_argv[0]) );
|
debugstr_w(main_exe_name), debugstr_a(__wine_main_argv[1]) );
|
||||||
|
|
||||||
RtlInitUnicodeString( &NtCurrentTeb()->Peb->ProcessParameters->DllPath,
|
RtlInitUnicodeString( &NtCurrentTeb()->Peb->ProcessParameters->DllPath,
|
||||||
MODULE_get_dll_load_path(main_exe_name) );
|
MODULE_get_dll_load_path(main_exe_name) );
|
||||||
|
@ -893,9 +953,7 @@ void __wine_kernel_init(void)
|
||||||
if (type == SCS_WOW_BINARY || type == SCS_DOS_BINARY ||
|
if (type == SCS_WOW_BINARY || type == SCS_DOS_BINARY ||
|
||||||
type == SCS_OS216_BINARY || type == SCS_PIF_BINARY)
|
type == SCS_OS216_BINARY || type == SCS_PIF_BINARY)
|
||||||
{
|
{
|
||||||
__wine_main_argv--;
|
new_argv0 = winevdm;
|
||||||
__wine_main_argc++;
|
|
||||||
__wine_main_argv[0] = "winevdm.exe";
|
|
||||||
module = LoadLibraryExW( winevdmW, 0, DONT_RESOLVE_DLL_REFERENCES );
|
module = LoadLibraryExW( winevdmW, 0, DONT_RESOLVE_DLL_REFERENCES );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -909,6 +967,8 @@ void __wine_kernel_init(void)
|
||||||
ExitProcess( error );
|
ExitProcess( error );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_process_name( &__wine_main_argc, __wine_main_argv, new_argv0 );
|
||||||
|
|
||||||
peb->ImageBaseAddress = module;
|
peb->ImageBaseAddress = module;
|
||||||
|
|
||||||
/* build command line */
|
/* build command line */
|
||||||
|
|
|
@ -482,6 +482,9 @@
|
||||||
/* Define if we can use ppdev.h for parallel port access */
|
/* Define if we can use ppdev.h for parallel port access */
|
||||||
#undef HAVE_PPDEV
|
#undef HAVE_PPDEV
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `prctl' function. */
|
||||||
|
#undef HAVE_PRCTL
|
||||||
|
|
||||||
/* Define to 1 if you have the `pread' function. */
|
/* Define to 1 if you have the `pread' function. */
|
||||||
#undef HAVE_PREAD
|
#undef HAVE_PREAD
|
||||||
|
|
||||||
|
@ -731,6 +734,9 @@
|
||||||
/* Define to 1 if you have the <sys/poll.h> header file. */
|
/* Define to 1 if you have the <sys/poll.h> header file. */
|
||||||
#undef HAVE_SYS_POLL_H
|
#undef HAVE_SYS_POLL_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/prctl.h> header file. */
|
||||||
|
#undef HAVE_SYS_PRCTL_H
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/ptrace.h> header file. */
|
/* Define to 1 if you have the <sys/ptrace.h> header file. */
|
||||||
#undef HAVE_SYS_PTRACE_H
|
#undef HAVE_SYS_PTRACE_H
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue