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
acd209d6
Commit
acd209d6
authored
May 20, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Move setting the process name to the Unix library.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3d3545b1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
65 deletions
+67
-65
thread.c
dlls/ntdll/thread.c
+0
-65
loader.c
dlls/ntdll/unix/loader.c
+67
-0
No files found.
dlls/ntdll/thread.c
View file @
acd209d6
...
...
@@ -28,9 +28,6 @@
#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
...
...
@@ -187,67 +184,6 @@ int __cdecl __wine_dbg_output( const char *str )
return
unix_funcs
->
dbg_output
(
str
);
}
/***********************************************************************
* 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 */
}
HANDLE
user_shared_data_init_done
(
void
)
{
static
const
WCHAR
wine_usdW
[]
=
{
'\\'
,
'K'
,
'e'
,
'r'
,
'n'
,
'e'
,
'l'
,
'O'
,
'b'
,
'j'
,
'e'
,
'c'
,
't'
,
's'
,
...
...
@@ -382,7 +318,6 @@ TEB *thread_init(void)
unix_funcs
->
dbg_init
();
unix_funcs
->
get_paths
(
&
build_dir
,
&
data_dir
,
&
config_dir
);
set_process_name
(
__wine_main_argc
,
__wine_main_argv
);
/* initialize time values in user_shared_data */
NtQuerySystemTime
(
&
now
);
...
...
dlls/ntdll/unix/loader.c
View file @
acd209d6
...
...
@@ -38,6 +38,9 @@
#ifdef HAVE_SYS_MMAN_H
# include <sys/mman.h>
#endif
#ifdef HAVE_SYS_PRCTL_H
# include <sys/prctl.h>
#endif
#ifdef HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
#endif
...
...
@@ -1193,6 +1196,68 @@ static int pre_exec(void)
/***********************************************************************
* 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 */
}
/***********************************************************************
* check_command_line
*
* Check if command line is one that needs to be handled specially.
...
...
@@ -1260,6 +1325,7 @@ void __wine_main( int argc, char *argv[], char *envp[] )
module
=
load_ntdll
();
fixup_ntdll_imports
(
&
__wine_spec_nt_header
,
module
);
set_process_name
(
argc
,
argv
);
init_unix_codepage
();
#ifdef __APPLE__
...
...
@@ -1294,6 +1360,7 @@ NTSTATUS __cdecl __wine_init_unix_lib( HMODULE module, const void *ptr_in, void
map_so_dll
(
nt
,
module
);
fixup_ntdll_imports
(
&
__wine_spec_nt_header
,
module
);
set_process_name
(
__wine_main_argc
,
__wine_main_argv
);
init_unix_codepage
();
*
(
struct
unix_funcs
**
)
ptr_out
=
&
unix_funcs
;
wine_mmap_enum_reserved_areas
(
add_area
,
NULL
,
0
);
...
...
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