Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
James Carthew
wine
Commits
acd209d6
Commit
acd209d6
authored
4 years ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
ntdll: Move setting the process name to the Unix library.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3d3545b1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/ntdll/thread.c
+0
-65
0 additions, 65 deletions
dlls/ntdll/thread.c
dlls/ntdll/unix/loader.c
+67
-0
67 additions, 0 deletions
dlls/ntdll/unix/loader.c
with
67 additions
and
65 deletions
dlls/ntdll/thread.c
+
0
−
65
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
);
...
...
This diff is collapsed.
Click to expand it.
dlls/ntdll/unix/loader.c
+
67
−
0
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
...
...
@@ -1192,6 +1195,68 @@ static int pre_exec(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 */
}
/***********************************************************************
* check_command_line
*
...
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment