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
5f195f8c
Commit
5f195f8c
authored
Feb 20, 2001
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small server protocol cleanups.
parent
cf354d8c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
34 deletions
+27
-34
server.h
include/server.h
+3
-3
virtual.c
memory/virtual.c
+2
-6
client.c
scheduler/client.c
+20
-21
mapping.c
server/mapping.c
+0
-1
request.h
server/request.h
+1
-1
trace.c
server/trace.c
+1
-2
No files found.
include/server.h
View file @
5f195f8c
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
struct
request_header
struct
request_header
{
{
IN
int
req
;
/* request code */
IN
int
req
;
/* request code */
IN
unsigned
short
fixed_size
;
/* size of the fixed
part of the request */
IN
unsigned
short
var_offset
;
/* offset of the variable
part of the request */
IN
unsigned
short
var_size
;
/* size of the variable part of the request */
IN
unsigned
short
var_size
;
/* size of the variable part of the request */
OUT
unsigned
int
error
;
/* error result */
OUT
unsigned
int
error
;
/* error result */
};
};
...
@@ -864,7 +864,6 @@ struct get_mapping_info_request
...
@@ -864,7 +864,6 @@ struct get_mapping_info_request
OUT
void
*
base
;
/* default base addr (for VPROT_IMAGE mapping) */
OUT
void
*
base
;
/* default base addr (for VPROT_IMAGE mapping) */
OUT
handle_t
shared_file
;
/* shared mapping file handle */
OUT
handle_t
shared_file
;
/* shared mapping file handle */
OUT
int
shared_size
;
/* shared mapping size */
OUT
int
shared_size
;
/* shared mapping size */
OUT
int
anonymous
;
/* anonymous mapping? */
};
};
...
@@ -1594,7 +1593,7 @@ union generic_request
...
@@ -1594,7 +1593,7 @@ union generic_request
struct
async_result_request
async_result
;
struct
async_result_request
async_result
;
};
};
#define SERVER_PROTOCOL_VERSION 3
7
#define SERVER_PROTOCOL_VERSION 3
8
/* ### make_requests end ### */
/* ### make_requests end ### */
/* Everything above this line is generated automatically by tools/make_requests */
/* Everything above this line is generated automatically by tools/make_requests */
...
@@ -1622,6 +1621,7 @@ struct server_buffer_info
...
@@ -1622,6 +1621,7 @@ struct server_buffer_info
extern
unsigned
int
wine_server_call
(
enum
request
req
);
extern
unsigned
int
wine_server_call
(
enum
request
req
);
extern
unsigned
int
server_call_fd
(
enum
request
req
,
int
fd_out
);
extern
unsigned
int
server_call_fd
(
enum
request
req
,
int
fd_out
);
extern
void
server_protocol_error
(
const
char
*
err
,
...
)
WINE_NORETURN
;
extern
void
server_protocol_error
(
const
char
*
err
,
...
)
WINE_NORETURN
;
extern
void
server_protocol_perror
(
const
char
*
err
)
WINE_NORETURN
;
extern
void
*
wine_server_alloc_req
(
size_t
fixed_size
,
size_t
var_size
);
extern
void
*
wine_server_alloc_req
(
size_t
fixed_size
,
size_t
var_size
);
extern
int
wine_server_recv_fd
(
int
handle
,
int
cache
);
extern
int
wine_server_recv_fd
(
int
handle
,
int
cache
);
extern
const
char
*
get_config_dir
(
void
);
extern
const
char
*
get_config_dir
(
void
);
...
...
memory/virtual.c
View file @
5f195f8c
...
@@ -1494,7 +1494,7 @@ LPVOID WINAPI MapViewOfFileEx(
...
@@ -1494,7 +1494,7 @@ LPVOID WINAPI MapViewOfFileEx(
UINT
ptr
=
(
UINT
)
-
1
,
size
=
0
;
UINT
ptr
=
(
UINT
)
-
1
,
size
=
0
;
int
flags
=
MAP_PRIVATE
;
int
flags
=
MAP_PRIVATE
;
int
unix_handle
=
-
1
;
int
unix_handle
=
-
1
;
int
prot
,
anonymous
,
res
;
int
prot
,
res
;
void
*
base
;
void
*
base
;
DWORD
size_low
,
size_high
,
header_size
,
shared_size
;
DWORD
size_low
,
size_high
,
header_size
,
shared_size
;
HANDLE
shared_file
;
HANDLE
shared_file
;
...
@@ -1520,15 +1520,11 @@ LPVOID WINAPI MapViewOfFileEx(
...
@@ -1520,15 +1520,11 @@ LPVOID WINAPI MapViewOfFileEx(
header_size
=
req
->
header_size
;
header_size
=
req
->
header_size
;
shared_file
=
req
->
shared_file
;
shared_file
=
req
->
shared_file
;
shared_size
=
req
->
shared_size
;
shared_size
=
req
->
shared_size
;
anonymous
=
req
->
anonymous
;
}
}
SERVER_END_REQ
;
SERVER_END_REQ
;
if
(
res
)
goto
error
;
if
(
res
)
goto
error
;
if
(
!
anonymous
)
if
((
unix_handle
=
FILE_GetUnixHandle
(
handle
,
0
))
==
-
1
)
goto
error
;
{
if
((
unix_handle
=
FILE_GetUnixHandle
(
handle
,
0
))
==
-
1
)
goto
error
;
}
if
(
prot
&
VPROT_IMAGE
)
if
(
prot
&
VPROT_IMAGE
)
return
map_image
(
handle
,
unix_handle
,
base
,
size_low
,
header_size
,
return
map_image
(
handle
,
unix_handle
,
base
,
size_low
,
header_size
,
...
...
scheduler/client.c
View file @
5f195f8c
...
@@ -102,9 +102,9 @@ void server_protocol_error( const char *err, ... )
...
@@ -102,9 +102,9 @@ void server_protocol_error( const char *err, ... )
/***********************************************************************
/***********************************************************************
* server_perror
* server_p
rotocol_p
error
*/
*/
static
void
server
_perror
(
const
char
*
err
)
void
server_protocol
_perror
(
const
char
*
err
)
{
{
fprintf
(
stderr
,
"Client protocol error:%p: "
,
NtCurrentTeb
()
->
tid
);
fprintf
(
stderr
,
"Client protocol error:%p: "
,
NtCurrentTeb
()
->
tid
);
perror
(
err
);
perror
(
err
);
...
@@ -141,7 +141,7 @@ void *wine_server_alloc_req( size_t fixed_size, size_t var_size )
...
@@ -141,7 +141,7 @@ void *wine_server_alloc_req( size_t fixed_size, size_t var_size )
server_protocol_error
(
"buffer overflow %d bytes
\n
"
,
server_protocol_error
(
"buffer overflow %d bytes
\n
"
,
(
char
*
)
req
+
size
-
(
char
*
)
NtCurrentTeb
()
->
buffer_info
);
(
char
*
)
req
+
size
-
(
char
*
)
NtCurrentTeb
()
->
buffer_info
);
NtCurrentTeb
()
->
buffer_info
->
cur_pos
=
pos
+
size
;
NtCurrentTeb
()
->
buffer_info
->
cur_pos
=
pos
+
size
;
req
->
header
.
fixed_size
=
fixed_size
;
req
->
header
.
var_offset
=
pos
+
sizeof
(
*
req
)
;
req
->
header
.
var_size
=
var_size
;
req
->
header
.
var_size
=
var_size
;
return
req
;
return
req
;
}
}
...
@@ -152,15 +152,15 @@ void *wine_server_alloc_req( size_t fixed_size, size_t var_size )
...
@@ -152,15 +152,15 @@ void *wine_server_alloc_req( size_t fixed_size, size_t var_size )
*
*
* Send a request to the server.
* Send a request to the server.
*/
*/
static
void
send_request
(
enum
request
req
,
struct
request_header
*
header
)
static
void
send_request
(
enum
request
req
,
union
generic_request
*
request
)
{
{
header
->
req
=
req
;
request
->
header
.
req
=
req
;
NtCurrentTeb
()
->
buffer_info
->
cur_req
=
(
char
*
)
header
-
(
char
*
)
NtCurrentTeb
()
->
buffer
;
NtCurrentTeb
()
->
buffer_info
->
cur_req
=
(
char
*
)
request
-
(
char
*
)
NtCurrentTeb
()
->
buffer
;
/* write a single byte; the value is ignored anyway */
/* write a single byte; the value is ignored anyway */
if
(
write
(
NtCurrentTeb
()
->
request_fd
,
header
,
1
)
==
-
1
)
if
(
write
(
NtCurrentTeb
()
->
request_fd
,
request
,
1
)
==
-
1
)
{
{
if
(
errno
==
EPIPE
)
SYSDEPS_ExitThread
(
0
);
if
(
errno
==
EPIPE
)
SYSDEPS_ExitThread
(
0
);
server_perror
(
"sendmsg"
);
server_p
rotocol_p
error
(
"sendmsg"
);
}
}
}
}
...
@@ -169,7 +169,7 @@ static void send_request( enum request req, struct request_header *header )
...
@@ -169,7 +169,7 @@ static void send_request( enum request req, struct request_header *header )
*
*
* Send a request to the server, passing a file descriptor.
* Send a request to the server, passing a file descriptor.
*/
*/
static
void
send_request_fd
(
enum
request
req
,
struct
request_header
*
header
,
int
fd
)
static
void
send_request_fd
(
enum
request
req
,
union
generic_request
*
request
,
int
fd
)
{
{
#ifndef HAVE_MSGHDR_ACCRIGHTS
#ifndef HAVE_MSGHDR_ACCRIGHTS
struct
cmsg_fd
cmsg
;
struct
cmsg_fd
cmsg
;
...
@@ -178,7 +178,7 @@ static void send_request_fd( enum request req, struct request_header *header, in
...
@@ -178,7 +178,7 @@ static void send_request_fd( enum request req, struct request_header *header, in
struct
iovec
vec
;
struct
iovec
vec
;
/* write a single byte; the value is ignored anyway */
/* write a single byte; the value is ignored anyway */
vec
.
iov_base
=
(
void
*
)
header
;
vec
.
iov_base
=
(
void
*
)
request
;
vec
.
iov_len
=
1
;
vec
.
iov_len
=
1
;
msghdr
.
msg_name
=
NULL
;
msghdr
.
msg_name
=
NULL
;
...
@@ -199,12 +199,12 @@ static void send_request_fd( enum request req, struct request_header *header, in
...
@@ -199,12 +199,12 @@ static void send_request_fd( enum request req, struct request_header *header, in
msghdr
.
msg_flags
=
0
;
msghdr
.
msg_flags
=
0
;
#endif
/* HAVE_MSGHDR_ACCRIGHTS */
#endif
/* HAVE_MSGHDR_ACCRIGHTS */
header
->
req
=
req
;
request
->
header
.
req
=
req
;
if
(
sendmsg
(
NtCurrentTeb
()
->
socket
,
&
msghdr
,
0
)
==
-
1
)
if
(
sendmsg
(
NtCurrentTeb
()
->
socket
,
&
msghdr
,
0
)
==
-
1
)
{
{
if
(
errno
==
EPIPE
)
SYSDEPS_ExitThread
(
0
);
if
(
errno
==
EPIPE
)
SYSDEPS_ExitThread
(
0
);
server_perror
(
"sendmsg"
);
server_p
rotocol_p
error
(
"sendmsg"
);
}
}
}
}
...
@@ -224,7 +224,7 @@ static void wait_reply(void)
...
@@ -224,7 +224,7 @@ static void wait_reply(void)
if
(
!
ret
)
break
;
if
(
!
ret
)
break
;
if
(
errno
==
EINTR
)
continue
;
if
(
errno
==
EINTR
)
continue
;
if
(
errno
==
EPIPE
)
break
;
if
(
errno
==
EPIPE
)
break
;
server_perror
(
"read"
);
server_p
rotocol_p
error
(
"read"
);
}
}
/* the server closed the connection; time to die... */
/* the server closed the connection; time to die... */
SYSDEPS_ExitThread
(
0
);
SYSDEPS_ExitThread
(
0
);
...
@@ -238,10 +238,10 @@ static void wait_reply(void)
...
@@ -238,10 +238,10 @@ static void wait_reply(void)
*/
*/
unsigned
int
wine_server_call
(
enum
request
req
)
unsigned
int
wine_server_call
(
enum
request
req
)
{
{
void
*
req_ptr
=
NtCurrentTeb
()
->
buffer
;
union
generic_request
*
req_ptr
=
NtCurrentTeb
()
->
buffer
;
send_request
(
req
,
req_ptr
);
send_request
(
req
,
req_ptr
);
wait_reply
();
wait_reply
();
return
((
struct
request_header
*
)
req_ptr
)
->
error
;
return
req_ptr
->
header
.
error
;
}
}
...
@@ -253,13 +253,12 @@ unsigned int wine_server_call( enum request req )
...
@@ -253,13 +253,12 @@ unsigned int wine_server_call( enum request req )
unsigned
int
server_call_fd
(
enum
request
req
,
int
fd_out
)
unsigned
int
server_call_fd
(
enum
request
req
,
int
fd_out
)
{
{
unsigned
int
res
;
unsigned
int
res
;
void
*
req_ptr
=
NtCurrentTeb
()
->
buffer
;
union
generic_request
*
req_ptr
=
NtCurrentTeb
()
->
buffer
;
send_request_fd
(
req
,
req_ptr
,
fd_out
);
send_request_fd
(
req
,
req_ptr
,
fd_out
);
wait_reply
();
wait_reply
();
if
((
res
=
((
struct
request_header
*
)
req_ptr
)
->
error
))
if
((
res
=
req_ptr
->
header
.
error
))
SetLastError
(
RtlNtStatusToDosError
(
res
)
);
SetLastError
(
RtlNtStatusToDosError
(
res
)
);
return
res
;
/* error code */
return
res
;
/* error code */
}
}
...
@@ -356,7 +355,7 @@ int wine_server_recv_fd( int handle, int cache )
...
@@ -356,7 +355,7 @@ int wine_server_recv_fd( int handle, int cache )
if
(
!
ret
)
break
;
if
(
!
ret
)
break
;
if
(
errno
==
EINTR
)
continue
;
if
(
errno
==
EINTR
)
continue
;
if
(
errno
==
EPIPE
)
break
;
if
(
errno
==
EPIPE
)
break
;
server_perror
(
"recvmsg"
);
server_p
rotocol_p
error
(
"recvmsg"
);
}
}
/* the server closed the connection; time to die... */
/* the server closed the connection; time to die... */
SYSDEPS_ExitThread
(
0
);
SYSDEPS_ExitThread
(
0
);
...
@@ -613,10 +612,10 @@ int CLIENT_InitThread(void)
...
@@ -613,10 +612,10 @@ int CLIENT_InitThread(void)
fd
=
wine_server_recv_fd
(
0
,
0
);
fd
=
wine_server_recv_fd
(
0
,
0
);
if
(
fd
==
-
1
)
server_protocol_error
(
"no fd received for thread buffer
\n
"
);
if
(
fd
==
-
1
)
server_protocol_error
(
"no fd received for thread buffer
\n
"
);
if
((
size
=
lseek
(
fd
,
0
,
SEEK_END
))
==
-
1
)
server_perror
(
"lseek"
);
if
((
size
=
lseek
(
fd
,
0
,
SEEK_END
))
==
-
1
)
server_p
rotocol_p
error
(
"lseek"
);
teb
->
buffer
=
mmap
(
0
,
size
,
PROT_READ
|
PROT_WRITE
,
MAP_SHARED
,
fd
,
0
);
teb
->
buffer
=
mmap
(
0
,
size
,
PROT_READ
|
PROT_WRITE
,
MAP_SHARED
,
fd
,
0
);
close
(
fd
);
close
(
fd
);
if
(
teb
->
buffer
==
(
void
*
)
-
1
)
server_perror
(
"mmap"
);
if
(
teb
->
buffer
==
(
void
*
)
-
1
)
server_p
rotocol_p
error
(
"mmap"
);
teb
->
buffer_info
=
(
struct
server_buffer_info
*
)((
char
*
)
teb
->
buffer
+
size
)
-
1
;
teb
->
buffer_info
=
(
struct
server_buffer_info
*
)((
char
*
)
teb
->
buffer
+
size
)
-
1
;
wait_reply
();
wait_reply
();
...
...
server/mapping.c
View file @
5f195f8c
...
@@ -338,7 +338,6 @@ DECL_HANDLER(get_mapping_info)
...
@@ -338,7 +338,6 @@ DECL_HANDLER(get_mapping_info)
req
->
base
=
mapping
->
base
;
req
->
base
=
mapping
->
base
;
req
->
shared_file
=
0
;
req
->
shared_file
=
0
;
req
->
shared_size
=
mapping
->
shared_size
;
req
->
shared_size
=
mapping
->
shared_size
;
req
->
anonymous
=
!
mapping
->
file
;
if
(
mapping
->
shared_file
)
if
(
mapping
->
shared_file
)
req
->
shared_file
=
alloc_handle
(
current
->
process
,
mapping
->
shared_file
,
req
->
shared_file
=
alloc_handle
(
current
->
process
,
mapping
->
shared_file
,
GENERIC_READ
|
GENERIC_WRITE
,
0
);
GENERIC_READ
|
GENERIC_WRITE
,
0
);
...
...
server/request.h
View file @
5f195f8c
...
@@ -52,7 +52,7 @@ static inline void *get_req_ptr( struct thread *thread )
...
@@ -52,7 +52,7 @@ static inline void *get_req_ptr( struct thread *thread )
/* get the request vararg data */
/* get the request vararg data */
inline
static
void
*
get_req_data
(
const
void
*
req
)
inline
static
void
*
get_req_data
(
const
void
*
req
)
{
{
return
(
(
union
generic_request
*
)
req
+
1
)
;
return
(
char
*
)
current
->
buffer
+
((
struct
request_header
*
)
req
)
->
var_offset
;
}
}
/* get the request vararg size */
/* get the request vararg size */
...
...
server/trace.c
View file @
5f195f8c
...
@@ -985,8 +985,7 @@ static void dump_get_mapping_info_reply( const struct get_mapping_info_request *
...
@@ -985,8 +985,7 @@ static void dump_get_mapping_info_reply( const struct get_mapping_info_request *
fprintf
(
stderr
,
" header_size=%d,"
,
req
->
header_size
);
fprintf
(
stderr
,
" header_size=%d,"
,
req
->
header_size
);
fprintf
(
stderr
,
" base=%p,"
,
req
->
base
);
fprintf
(
stderr
,
" base=%p,"
,
req
->
base
);
fprintf
(
stderr
,
" shared_file=%d,"
,
req
->
shared_file
);
fprintf
(
stderr
,
" shared_file=%d,"
,
req
->
shared_file
);
fprintf
(
stderr
,
" shared_size=%d,"
,
req
->
shared_size
);
fprintf
(
stderr
,
" shared_size=%d"
,
req
->
shared_size
);
fprintf
(
stderr
,
" anonymous=%d"
,
req
->
anonymous
);
}
}
static
void
dump_create_device_request
(
const
struct
create_device_request
*
req
)
static
void
dump_create_device_request
(
const
struct
create_device_request
*
req
)
...
...
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