Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
cac95992
Commit
cac95992
authored
Oct 22, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Move process name initialization to ntdll.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
305b5a44
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
66 deletions
+67
-66
process.c
dlls/kernel32/process.c
+0
-66
thread.c
dlls/ntdll/thread.c
+67
-0
No files found.
dlls/kernel32/process.c
View file @
cac95992
...
...
@@ -37,9 +37,6 @@
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_SYS_PRCTL_H
# include <sys/prctl.h>
#endif
#include <sys/types.h>
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
...
...
@@ -1232,68 +1229,6 @@ void WINAPI start_process( LPTHREAD_START_ROUTINE entry, PEB *peb )
/***********************************************************************
* set_process_name
*
* Change the process name in the ps output.
*/
static
void
set_process_name
(
int
argc
,
char
*
argv
[]
)
{
BOOL
shift_strings
;
char
*
p
,
*
name
;
int
i
;
#ifdef HAVE_SETPROCTITLE
setproctitle
(
"-%s"
,
argv
[
1
]);
shift_strings
=
FALSE
;
#else
p
=
argv
[
0
];
shift_strings
=
(
argc
>=
2
);
for
(
i
=
1
;
i
<
argc
;
i
++
)
{
p
+=
strlen
(
p
)
+
1
;
if
(
p
!=
argv
[
i
])
{
shift_strings
=
FALSE
;
break
;
}
}
#endif
if
(
shift_strings
)
{
int
offset
=
argv
[
1
]
-
argv
[
0
];
char
*
end
=
argv
[
argc
-
1
]
+
strlen
(
argv
[
argc
-
1
])
+
1
;
memmove
(
argv
[
0
],
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
;
}
else
{
/* remove argv[0] */
memmove
(
argv
,
argv
+
1
,
argc
*
sizeof
(
argv
[
0
])
);
}
name
=
argv
[
0
];
if
((
p
=
strrchr
(
name
,
'\\'
)))
name
=
p
+
1
;
if
((
p
=
strrchr
(
name
,
'/'
)))
name
=
p
+
1
;
#if defined(HAVE_SETPROGNAME)
setprogname
(
name
);
#endif
#ifdef HAVE_PRCTL
#ifndef PR_SET_NAME
# define PR_SET_NAME 15
#endif
prctl
(
PR_SET_NAME
,
name
);
#endif
/* HAVE_PRCTL */
}
/***********************************************************************
* __wine_kernel_init
*
* Wine initialisation: load and start the main exe file.
...
...
@@ -1334,7 +1269,6 @@ void * CDECL __wine_kernel_init(void)
init_windows_dirs
();
set_process_name
(
__wine_main_argc
,
__wine_main_argv
);
set_library_wargv
(
__wine_main_argv
);
boot_events
[
0
]
=
boot_events
[
1
]
=
0
;
...
...
dlls/ntdll/thread.c
View file @
cac95992
...
...
@@ -28,6 +28,9 @@
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
#ifdef HAVE_SYS_PRCTL_H
# include <sys/prctl.h>
#endif
#ifdef HAVE_SYS_TIMES_H
#include <sys/times.h>
#endif
...
...
@@ -147,6 +150,69 @@ static ULONG_PTR get_image_addr(void)
}
#endif
/***********************************************************************
* set_process_name
*
* Change the process name in the ps output.
*/
static
void
set_process_name
(
int
argc
,
char
*
argv
[]
)
{
BOOL
shift_strings
;
char
*
p
,
*
name
;
int
i
;
#ifdef HAVE_SETPROCTITLE
setproctitle
(
"-%s"
,
argv
[
1
]);
shift_strings
=
FALSE
;
#else
p
=
argv
[
0
];
shift_strings
=
(
argc
>=
2
);
for
(
i
=
1
;
i
<
argc
;
i
++
)
{
p
+=
strlen
(
p
)
+
1
;
if
(
p
!=
argv
[
i
])
{
shift_strings
=
FALSE
;
break
;
}
}
#endif
if
(
shift_strings
)
{
int
offset
=
argv
[
1
]
-
argv
[
0
];
char
*
end
=
argv
[
argc
-
1
]
+
strlen
(
argv
[
argc
-
1
])
+
1
;
memmove
(
argv
[
0
],
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
;
}
else
{
/* remove argv[0] */
memmove
(
argv
,
argv
+
1
,
argc
*
sizeof
(
argv
[
0
])
);
}
name
=
argv
[
0
];
if
((
p
=
strrchr
(
name
,
'\\'
)))
name
=
p
+
1
;
if
((
p
=
strrchr
(
name
,
'/'
)))
name
=
p
+
1
;
#if defined(HAVE_SETPROGNAME)
setprogname
(
name
);
#endif
#ifdef HAVE_PRCTL
#ifndef PR_SET_NAME
# define PR_SET_NAME 15
#endif
prctl
(
PR_SET_NAME
,
name
);
#endif
/* HAVE_PRCTL */
}
/***********************************************************************
* thread_init
*
...
...
@@ -245,6 +311,7 @@ void thread_init(void)
exit
(
1
);
}
set_process_name
(
__wine_main_argc
,
__wine_main_argv
);
init_directories
();
init_user_process_params
(
info_size
);
...
...
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