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
95e7acb9
Commit
95e7acb9
authored
Jan 04, 2000
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved allocation of the socket pair for a new thread to the server.
parent
79b1ec82
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
26 deletions
+21
-26
thread.c
scheduler/thread.c
+2
-15
thread.c
server/thread.c
+19
-11
No files found.
scheduler/thread.c
View file @
95e7acb9
...
...
@@ -9,9 +9,6 @@
#include <assert.h>
#include <fcntl.h>
#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
...
...
@@ -213,7 +210,6 @@ TEB *THREAD_Create( PDB *pdb, DWORD flags, DWORD stack_size, BOOL alloc_stack16,
LPSECURITY_ATTRIBUTES
sa
,
int
*
server_handle
)
{
struct
new_thread_request
*
req
=
get_req_buffer
();
int
fd
[
2
];
HANDLE
cleanup_object
;
TEB
*
teb
=
VirtualAlloc
(
0
,
0x1000
,
MEM_COMMIT
,
PAGE_EXECUTE_READWRITE
);
...
...
@@ -233,24 +229,15 @@ TEB *THREAD_Create( PDB *pdb, DWORD flags, DWORD stack_size, BOOL alloc_stack16,
teb
->
teb_sel
=
SELECTOR_AllocBlock
(
teb
,
0x1000
,
SEGMENT_DATA
,
TRUE
,
FALSE
);
if
(
!
teb
->
teb_sel
)
goto
error
;
/* Create the socket pair for server communication */
if
(
socketpair
(
AF_UNIX
,
SOCK_STREAM
,
0
,
fd
)
==
-
1
)
{
SetLastError
(
ERROR_TOO_MANY_OPEN_FILES
);
/* FIXME */
goto
error
;
}
teb
->
socket
=
fd
[
0
];
fcntl
(
fd
[
0
],
F_SETFD
,
1
);
/* set close on exec flag */
/* Create the thread on the server side */
req
->
pid
=
teb
->
process
->
server_pid
;
req
->
suspend
=
((
flags
&
CREATE_SUSPENDED
)
!=
0
);
req
->
inherit
=
(
sa
&&
(
sa
->
nLength
>=
sizeof
(
*
sa
))
&&
sa
->
bInheritHandle
);
if
(
server_call_fd
(
REQ_NEW_THREAD
,
fd
[
1
],
NULL
))
goto
error
;
if
(
server_call_fd
(
REQ_NEW_THREAD
,
-
1
,
&
teb
->
socket
))
goto
error
;
teb
->
tid
=
req
->
tid
;
*
server_handle
=
req
->
handle
;
fcntl
(
teb
->
socket
,
F_SETFD
,
1
);
/* set close on exec flag */
/* Do the rest of the initialization */
...
...
server/thread.c
View file @
95e7acb9
...
...
@@ -16,6 +16,9 @@
#include <sys/mman.h>
#endif
#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#include <sys/uio.h>
#include <unistd.h>
#include <stdarg.h>
...
...
@@ -546,24 +549,29 @@ DECL_HANDLER(new_thread)
{
struct
thread
*
thread
;
struct
process
*
process
;
int
sock
[
2
];
if
(
!
(
process
=
get_process_from_id
(
req
->
pid
)))
return
;
if
(
(
process
=
get_process_from_id
(
req
->
pid
))
)
if
(
socketpair
(
AF_UNIX
,
SOCK_STREAM
,
0
,
sock
)
!=
-
1
)
{
if
((
fd
=
dup
(
fd
))
!=
-
1
)
if
((
thread
=
create_thread
(
sock
[
0
],
process
,
req
->
suspend
))
)
{
if
((
thread
=
create_thread
(
fd
,
process
,
req
->
suspend
)))
req
->
tid
=
thread
;
if
((
req
->
handle
=
alloc_handle
(
current
->
process
,
thread
,
THREAD_ALL_ACCESS
,
req
->
inherit
))
!=
-
1
)
{
req
->
tid
=
thread
;
if
((
req
->
handle
=
alloc_handle
(
current
->
process
,
thread
,
THREAD_ALL_ACCESS
,
req
->
inherit
))
==
-
1
)
release_object
(
thread
);
/* else will be released when the thread gets killed */
set_reply_fd
(
current
,
sock
[
1
]
);
release_object
(
process
);
/* thread object will be released when the thread gets killed */
return
;
}
else
close
(
f
d
);
release_object
(
threa
d
);
}
else
file_set_error
();
release_object
(
process
);
close
(
sock
[
1
]
);
}
else
file_set_error
();
release_object
(
process
);
}
/* retrieve the thread buffer file descriptor */
...
...
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