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
34884bf5
Commit
34884bf5
authored
Mar 24, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Remove the no longer needed exec_process() function.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
28fe84da
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
6 additions
and
229 deletions
+6
-229
loader.c
dlls/ntdll/unix/loader.c
+5
-1
process.c
dlls/ntdll/unix/process.c
+0
-155
unix_private.h
dlls/ntdll/unix/unix_private.h
+0
-1
server_protocol.h
include/wine/server_protocol.h
+1
-18
process.c
server/process.c
+0
-33
protocol.def
server/protocol.def
+0
-7
request.h
server/request.h
+0
-5
trace.c
server/trace.c
+0
-9
No files found.
dlls/ntdll/unix/loader.c
View file @
34884bf5
...
...
@@ -1763,7 +1763,11 @@ static void start_main_thread(void)
load_ntdll
();
load_libwine
();
status
=
p__wine_set_unix_funcs
(
NTDLL_UNIXLIB_VERSION
,
&
unix_funcs
);
if
(
status
)
exec_process
(
status
);
if
(
status
==
STATUS_REVISION_MISMATCH
)
{
ERR
(
"ntdll library version mismatch
\n
"
);
NtTerminateProcess
(
GetCurrentProcess
(),
status
);
}
server_init_process_done
();
}
...
...
dlls/ntdll/unix/process.c
View file @
34884bf5
...
...
@@ -50,10 +50,6 @@
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef __APPLE__
# include <CoreFoundation/CoreFoundation.h>
# include <pthread.h>
#endif
#ifdef HAVE_MACH_MACH_H
# include <mach/mach.h>
#endif
...
...
@@ -162,55 +158,6 @@ static char **build_argv( const UNICODE_STRING *cmdline, int reserved )
}
#ifdef __APPLE__
/***********************************************************************
* terminate_main_thread
*
* On some versions of Mac OS X, the execve system call fails with
* ENOTSUP if the process has multiple threads. Wine is always multi-
* threaded on Mac OS X because it specifically reserves the main thread
* for use by the system frameworks (see apple_main_thread() in
* libs/wine/loader.c). So, when we need to exec without first forking,
* we need to terminate the main thread first. We do this by installing
* a custom run loop source onto the main run loop and signaling it.
* The source's "perform" callback is pthread_exit and it will be
* executed on the main thread, terminating it.
*
* Returns TRUE if there's still hope the main thread has terminated or
* will soon. Return FALSE if we've given up.
*/
static
BOOL
terminate_main_thread
(
void
)
{
static
int
delayms
;
if
(
!
delayms
)
{
CFRunLoopSourceContext
source_context
=
{
0
};
CFRunLoopSourceRef
source
;
source_context
.
perform
=
pthread_exit
;
if
(
!
(
source
=
CFRunLoopSourceCreate
(
NULL
,
0
,
&
source_context
)))
return
FALSE
;
CFRunLoopAddSource
(
CFRunLoopGetMain
(),
source
,
kCFRunLoopCommonModes
);
CFRunLoopSourceSignal
(
source
);
CFRunLoopWakeUp
(
CFRunLoopGetMain
()
);
CFRelease
(
source
);
delayms
=
20
;
}
if
(
delayms
>
1000
)
return
FALSE
;
usleep
(
delayms
*
1000
);
delayms
*=
2
;
return
TRUE
;
}
#endif
static
inline
const
WCHAR
*
get_params_string
(
const
RTL_USER_PROCESS_PARAMETERS
*
params
,
const
UNICODE_STRING
*
str
)
{
...
...
@@ -625,108 +572,6 @@ static NTSTATUS spawn_process( const RTL_USER_PROCESS_PARAMETERS *params, int so
/***********************************************************************
* exec_process
*/
void
DECLSPEC_NORETURN
exec_process
(
NTSTATUS
status
)
{
RTL_USER_PROCESS_PARAMETERS
*
params
=
NtCurrentTeb
()
->
Peb
->
ProcessParameters
;
pe_image_info_t
pe_info
;
int
unixdir
,
socketfd
[
2
];
char
**
argv
;
HANDLE
handle
;
if
(
startup_info_size
)
goto
done
;
/* started from another Win32 process */
switch
(
status
)
{
case
STATUS_CONFLICTING_ADDRESSES
:
case
STATUS_NO_MEMORY
:
case
STATUS_INVALID_IMAGE_FORMAT
:
case
STATUS_INVALID_IMAGE_NOT_MZ
:
{
UNICODE_STRING
image
;
if
(
getenv
(
"WINEPRELOADRESERVE"
))
goto
done
;
image
.
Buffer
=
get_nt_pathname
(
&
params
->
ImagePathName
);
image
.
Length
=
wcslen
(
image
.
Buffer
)
*
sizeof
(
WCHAR
);
if
((
status
=
get_pe_file_info
(
&
image
,
&
handle
,
&
pe_info
)))
goto
done
;
break
;
}
case
STATUS_INVALID_IMAGE_WIN_16
:
case
STATUS_INVALID_IMAGE_NE_FORMAT
:
case
STATUS_INVALID_IMAGE_PROTECT
:
/* we'll start winevdm */
memset
(
&
pe_info
,
0
,
sizeof
(
pe_info
)
);
pe_info
.
machine
=
IMAGE_FILE_MACHINE_I386
;
break
;
default:
goto
done
;
}
unixdir
=
get_unix_curdir
(
params
);
if
(
socketpair
(
PF_UNIX
,
SOCK_STREAM
,
0
,
socketfd
)
==
-
1
)
{
status
=
STATUS_TOO_MANY_OPENED_FILES
;
goto
done
;
}
#ifdef SO_PASSCRED
else
{
int
enable
=
1
;
setsockopt
(
socketfd
[
0
],
SOL_SOCKET
,
SO_PASSCRED
,
&
enable
,
sizeof
(
enable
)
);
}
#endif
wine_server_send_fd
(
socketfd
[
1
]
);
close
(
socketfd
[
1
]
);
SERVER_START_REQ
(
exec_process
)
{
req
->
socket_fd
=
socketfd
[
1
];
req
->
cpu
=
get_machine_cpu
(
&
pe_info
);
status
=
wine_server_call
(
req
);
}
SERVER_END_REQ
;
if
(
!
status
)
{
if
(
!
(
argv
=
build_argv
(
&
params
->
CommandLine
,
2
)))
{
status
=
STATUS_NO_MEMORY
;
goto
done
;
}
fchdir
(
unixdir
);
do
{
status
=
exec_wineloader
(
argv
,
socketfd
[
0
],
&
pe_info
);
}
#ifdef __APPLE__
while
(
errno
==
ENOTSUP
&&
terminate_main_thread
());
#else
while
(
0
);
#endif
free
(
argv
);
}
close
(
socketfd
[
0
]
);
done:
switch
(
status
)
{
case
STATUS_INVALID_IMAGE_FORMAT
:
case
STATUS_INVALID_IMAGE_NOT_MZ
:
ERR
(
"%s not supported on this system
\n
"
,
debugstr_us
(
&
params
->
ImagePathName
)
);
break
;
case
STATUS_REVISION_MISMATCH
:
ERR
(
"ntdll library version mismatch
\n
"
);
break
;
default:
ERR
(
"failed to load %s error %x
\n
"
,
debugstr_us
(
&
params
->
ImagePathName
),
status
);
break
;
}
for
(;;)
NtTerminateProcess
(
GetCurrentProcess
(),
status
);
}
/***********************************************************************
* fork_and_exec
*
* Fork and exec a new Unix binary, checking for errors.
...
...
dlls/ntdll/unix/unix_private.h
View file @
34884bf5
...
...
@@ -224,7 +224,6 @@ extern void *signal_init_syscalls(void) DECLSPEC_HIDDEN;
extern
void
DECLSPEC_NORETURN
signal_start_thread
(
PRTL_THREAD_START_ROUTINE
entry
,
void
*
arg
,
BOOL
suspend
,
void
*
thunk
,
TEB
*
teb
)
DECLSPEC_HIDDEN
;
extern
void
DECLSPEC_NORETURN
signal_exit_thread
(
int
status
,
void
(
*
func
)(
int
)
)
DECLSPEC_HIDDEN
;
extern
void
DECLSPEC_NORETURN
exec_process
(
NTSTATUS
status
)
DECLSPEC_HIDDEN
;
extern
void
__wine_syscall_dispatcher
(
void
)
DECLSPEC_HIDDEN
;
extern
void
signal_restore_full_cpu_context
(
void
)
DECLSPEC_HIDDEN
;
extern
void
fill_vm_counters
(
VM_COUNTERS_EX
*
pvmi
,
int
unix_pid
)
DECLSPEC_HIDDEN
;
...
...
include/wine/server_protocol.h
View file @
34884bf5
...
...
@@ -857,20 +857,6 @@ struct new_process_reply
struct
exec_process_request
{
struct
request_header
__header
;
int
socket_fd
;
client_cpu_t
cpu
;
char
__pad_20
[
4
];
};
struct
exec_process_reply
{
struct
reply_header
__header
;
};
struct
get_new_process_info_request
{
struct
request_header
__header
;
...
...
@@ -5406,7 +5392,6 @@ struct resume_process_reply
enum
request
{
REQ_new_process
,
REQ_exec_process
,
REQ_get_new_process_info
,
REQ_new_thread
,
REQ_get_startup_info
,
...
...
@@ -5687,7 +5672,6 @@ union generic_request
struct
request_max_size
max_size
;
struct
request_header
request_header
;
struct
new_process_request
new_process_request
;
struct
exec_process_request
exec_process_request
;
struct
get_new_process_info_request
get_new_process_info_request
;
struct
new_thread_request
new_thread_request
;
struct
get_startup_info_request
get_startup_info_request
;
...
...
@@ -5966,7 +5950,6 @@ union generic_reply
struct
request_max_size
max_size
;
struct
reply_header
reply_header
;
struct
new_process_reply
new_process_reply
;
struct
exec_process_reply
exec_process_reply
;
struct
get_new_process_info_reply
get_new_process_info_reply
;
struct
new_thread_reply
new_thread_reply
;
struct
get_startup_info_reply
get_startup_info_reply
;
...
...
@@ -6243,7 +6226,7 @@ union generic_reply
/* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 68
7
#define SERVER_PROTOCOL_VERSION 68
8
/* ### protocol_version end ### */
...
...
server/process.c
View file @
34884bf5
...
...
@@ -1212,39 +1212,6 @@ DECL_HANDLER(new_process)
release_object
(
info
);
}
/* execute a new process, replacing the existing one */
DECL_HANDLER
(
exec_process
)
{
struct
process
*
process
;
int
socket_fd
=
thread_get_inflight_fd
(
current
,
req
->
socket_fd
);
if
(
socket_fd
==
-
1
)
{
set_error
(
STATUS_INVALID_PARAMETER
);
return
;
}
if
(
fcntl
(
socket_fd
,
F_SETFL
,
O_NONBLOCK
)
==
-
1
)
{
set_error
(
STATUS_INVALID_HANDLE
);
close
(
socket_fd
);
return
;
}
if
(
shutdown_stage
)
{
set_error
(
STATUS_SHUTDOWN_IN_PROGRESS
);
close
(
socket_fd
);
return
;
}
if
(
!
is_cpu_supported
(
req
->
cpu
))
{
close
(
socket_fd
);
return
;
}
if
(
!
(
process
=
create_process
(
socket_fd
,
NULL
,
0
,
NULL
,
NULL
,
NULL
,
0
,
NULL
)))
return
;
create_thread
(
-
1
,
process
,
NULL
);
release_object
(
process
);
}
/* Retrieve information about a newly started process */
DECL_HANDLER
(
get_new_process_info
)
{
...
...
server/protocol.def
View file @
34884bf5
...
...
@@ -865,13 +865,6 @@ typedef struct
@END
/* Execute a process, replacing the current one */
@REQ(exec_process)
int socket_fd; /* file descriptor for process socket */
client_cpu_t cpu; /* CPU that the new process will use */
@END
/* Retrieve information about a newly started process */
@REQ(get_new_process_info)
obj_handle_t info; /* info handle returned from new_process_request */
...
...
server/request.h
View file @
34884bf5
...
...
@@ -120,7 +120,6 @@ static inline void set_reply_data_ptr( void *data, data_size_t size )
/* ### make_requests begin ### */
DECL_HANDLER
(
new_process
);
DECL_HANDLER
(
exec_process
);
DECL_HANDLER
(
get_new_process_info
);
DECL_HANDLER
(
new_thread
);
DECL_HANDLER
(
get_startup_info
);
...
...
@@ -400,7 +399,6 @@ typedef void (*req_handler)( const void *req, void *reply );
static
const
req_handler
req_handlers
[
REQ_NB_REQUESTS
]
=
{
(
req_handler
)
req_new_process
,
(
req_handler
)
req_exec_process
,
(
req_handler
)
req_get_new_process_info
,
(
req_handler
)
req_new_thread
,
(
req_handler
)
req_get_startup_info
,
...
...
@@ -721,9 +719,6 @@ C_ASSERT( FIELD_OFFSET(struct new_process_reply, info) == 8 );
C_ASSERT
(
FIELD_OFFSET
(
struct
new_process_reply
,
pid
)
==
12
);
C_ASSERT
(
FIELD_OFFSET
(
struct
new_process_reply
,
handle
)
==
16
);
C_ASSERT
(
sizeof
(
struct
new_process_reply
)
==
24
);
C_ASSERT
(
FIELD_OFFSET
(
struct
exec_process_request
,
socket_fd
)
==
12
);
C_ASSERT
(
FIELD_OFFSET
(
struct
exec_process_request
,
cpu
)
==
16
);
C_ASSERT
(
sizeof
(
struct
exec_process_request
)
==
24
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_new_process_info_request
,
info
)
==
12
);
C_ASSERT
(
sizeof
(
struct
get_new_process_info_request
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_new_process_info_reply
,
success
)
==
8
);
...
...
server/trace.c
View file @
34884bf5
...
...
@@ -1388,12 +1388,6 @@ static void dump_new_process_reply( const struct new_process_reply *req )
fprintf
(
stderr
,
", handle=%04x"
,
req
->
handle
);
}
static
void
dump_exec_process_request
(
const
struct
exec_process_request
*
req
)
{
fprintf
(
stderr
,
" socket_fd=%d"
,
req
->
socket_fd
);
dump_client_cpu
(
", cpu="
,
&
req
->
cpu
);
}
static
void
dump_get_new_process_info_request
(
const
struct
get_new_process_info_request
*
req
)
{
fprintf
(
stderr
,
" info=%04x"
,
req
->
info
);
...
...
@@ -4462,7 +4456,6 @@ static void dump_resume_process_request( const struct resume_process_request *re
static
const
dump_func
req_dumpers
[
REQ_NB_REQUESTS
]
=
{
(
dump_func
)
dump_new_process_request
,
(
dump_func
)
dump_exec_process_request
,
(
dump_func
)
dump_get_new_process_info_request
,
(
dump_func
)
dump_new_thread_request
,
(
dump_func
)
dump_get_startup_info_request
,
...
...
@@ -4739,7 +4732,6 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
static
const
dump_func
reply_dumpers
[
REQ_NB_REQUESTS
]
=
{
(
dump_func
)
dump_new_process_reply
,
NULL
,
(
dump_func
)
dump_get_new_process_info_reply
,
(
dump_func
)
dump_new_thread_reply
,
(
dump_func
)
dump_get_startup_info_reply
,
...
...
@@ -5016,7 +5008,6 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
static
const
char
*
const
req_names
[
REQ_NB_REQUESTS
]
=
{
"new_process"
,
"exec_process"
,
"get_new_process_info"
,
"new_thread"
,
"get_startup_info"
,
...
...
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