Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
9603ee07
Commit
9603ee07
authored
Apr 06, 2006
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel: Show the exe name instead of wine-[kp]thread in ps and top.
parent
992a1af4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
81 additions
and
9 deletions
+81
-9
configure
configure
+4
-0
configure.ac
configure.ac
+2
-0
process.c
dlls/kernel/process.c
+69
-9
config.h.in
include/config.h.in
+6
-0
No files found.
configure
View file @
9603ee07
...
@@ -7039,6 +7039,7 @@ done
...
@@ -7039,6 +7039,7 @@ done
for
ac_header
in
\
for
ac_header
in
\
IOKit/IOKitLib.h
\
IOKit/IOKitLib.h
\
alsa/asoundlib.h
\
alsa/asoundlib.h
\
...
@@ -7118,6 +7119,7 @@ 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
\
...
@@ -14872,6 +14874,7 @@ fi
...
@@ -14872,6 +14874,7 @@ fi
for
ac_func
in
\
for
ac_func
in
\
_lwp_create
\
_lwp_create
\
_lwp_self
\
_lwp_self
\
...
@@ -14913,6 +14916,7 @@ 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
\
...
...
configure.ac
View file @
9603ee07
...
@@ -250,6 +250,7 @@ AC_CHECK_HEADERS(\
...
@@ -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(\
...
@@ -1188,6 +1189,7 @@ AC_CHECK_FUNCS(\
mmap \
mmap \
pclose \
pclose \
popen \
popen \
prctl \
pread \
pread \
pwrite \
pwrite \
readlink \
readlink \
...
...
dlls/kernel/process.c
View file @
9603ee07
...
@@ -31,6 +31,9 @@
...
@@ -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"
...
@@ -837,6 +840,64 @@ static void start_process( void *arg )
...
@@ -837,6 +840,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
*
*
* Wine initialisation: load and start the main exe file.
* Wine initialisation: load and start the main exe file.
...
@@ -845,18 +906,17 @@ void __wine_kernel_init(void)
...
@@ -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)
...
@@ -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)
...
@@ -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)
...
@@ -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)
...
@@ -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 */
...
...
include/config.h.in
View file @
9603ee07
...
@@ -482,6 +482,9 @@
...
@@ -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 @@
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment