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
c295dd6b
Commit
c295dd6b
authored
Oct 09, 2017
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 09, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Store named pipe fd in pipe_end throughout its whole life time.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
4e17ff7c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
49 deletions
+14
-49
named_pipe.c
server/named_pipe.c
+14
-49
No files found.
server/named_pipe.c
View file @
c295dd6b
...
...
@@ -75,7 +75,6 @@ struct pipe_end
struct
pipe_server
{
struct
pipe_end
pipe_end
;
/* common header for pipe_client and pipe_server */
struct
fd
*
ioctl_fd
;
/* file descriptor for ioctls when not connected */
struct
list
entry
;
/* entry in named pipe servers list */
enum
pipe_state
state
;
/* server state */
struct
pipe_client
*
client
;
/* client that this server is connected to */
...
...
@@ -142,6 +141,7 @@ static const struct object_ops named_pipe_ops =
/* common server and client pipe end functions */
static
enum
server_fd_type
pipe_end_get_fd_type
(
struct
fd
*
fd
);
static
struct
fd
*
pipe_end_get_fd
(
struct
object
*
obj
);
static
int
pipe_end_read
(
struct
fd
*
fd
,
struct
async
*
async
,
file_pos_t
pos
);
static
int
pipe_end_write
(
struct
fd
*
fd
,
struct
async
*
async_data
,
file_pos_t
pos
);
static
int
pipe_end_flush
(
struct
fd
*
fd
,
struct
async
*
async
);
...
...
@@ -150,7 +150,6 @@ static void pipe_end_reselect_async( struct fd *fd, struct async_queue *queue );
/* server end functions */
static
void
pipe_server_dump
(
struct
object
*
obj
,
int
verbose
);
static
struct
fd
*
pipe_server_get_fd
(
struct
object
*
obj
);
static
void
pipe_server_destroy
(
struct
object
*
obj
);
static
int
pipe_server_ioctl
(
struct
fd
*
fd
,
ioctl_code_t
code
,
struct
async
*
async
);
...
...
@@ -164,7 +163,7 @@ static const struct object_ops pipe_server_ops =
default_fd_signaled
,
/* signaled */
no_satisfied
,
/* satisfied */
no_signal
,
/* signal */
pipe_
server_get_fd
,
/* get_fd */
pipe_
end_get_fd
,
/* get_fd */
default_fd_map_access
,
/* map_access */
default_get_sd
,
/* get_sd */
default_set_sd
,
/* set_sd */
...
...
@@ -193,7 +192,6 @@ static const struct fd_ops pipe_server_fd_ops =
/* client end functions */
static
void
pipe_client_dump
(
struct
object
*
obj
,
int
verbose
);
static
int
pipe_client_signaled
(
struct
object
*
obj
,
struct
wait_queue_entry
*
entry
);
static
struct
fd
*
pipe_client_get_fd
(
struct
object
*
obj
);
static
void
pipe_client_destroy
(
struct
object
*
obj
);
static
int
pipe_client_ioctl
(
struct
fd
*
fd
,
ioctl_code_t
code
,
struct
async
*
async
);
...
...
@@ -207,7 +205,7 @@ static const struct object_ops pipe_client_ops =
pipe_client_signaled
,
/* signaled */
no_satisfied
,
/* satisfied */
no_signal
,
/* signal */
pipe_
client_get_fd
,
/* get_fd */
pipe_
end_get_fd
,
/* get_fd */
default_fd_map_access
,
/* map_access */
default_get_sd
,
/* get_sd */
default_set_sd
,
/* set_sd */
...
...
@@ -324,13 +322,10 @@ static void named_pipe_destroy( struct object *obj)
free_async_queue
(
&
pipe
->
waiters
);
}
static
struct
fd
*
pipe_
client
_get_fd
(
struct
object
*
obj
)
static
struct
fd
*
pipe_
end
_get_fd
(
struct
object
*
obj
)
{
struct
pipe_client
*
client
=
(
struct
pipe_client
*
)
obj
;
if
(
client
->
pipe_end
.
fd
)
return
(
struct
fd
*
)
grab_object
(
client
->
pipe_end
.
fd
);
set_error
(
STATUS_PIPE_DISCONNECTED
);
return
NULL
;
struct
pipe_end
*
pipe_end
=
(
struct
pipe_end
*
)
obj
;
return
(
struct
fd
*
)
grab_object
(
pipe_end
->
fd
);
}
static
void
set_server_state
(
struct
pipe_server
*
server
,
enum
pipe_state
state
)
...
...
@@ -341,27 +336,17 @@ static void set_server_state( struct pipe_server *server, enum pipe_state state
{
case
ps_connected_server
:
case
ps_wait_disconnect
:
assert
(
server
->
pipe_end
.
fd
);
break
;
case
ps_wait_open
:
case
ps_idle_server
:
assert
(
!
server
->
pipe_end
.
fd
);
set_no_fd_status
(
server
->
ioctl_fd
,
STATUS_PIPE_LISTENING
);
set_no_fd_status
(
server
->
pipe_end
.
fd
,
STATUS_PIPE_LISTENING
);
break
;
case
ps_wait_connect
:
assert
(
!
server
->
pipe_end
.
fd
);
set_no_fd_status
(
server
->
ioctl_fd
,
STATUS_PIPE_DISCONNECTED
);
set_no_fd_status
(
server
->
pipe_end
.
fd
,
STATUS_PIPE_DISCONNECTED
);
break
;
}
}
static
struct
fd
*
pipe_server_get_fd
(
struct
object
*
obj
)
{
struct
pipe_server
*
server
=
(
struct
pipe_server
*
)
obj
;
return
(
struct
fd
*
)
grab_object
(
server
->
pipe_end
.
fd
?
server
->
pipe_end
.
fd
:
server
->
ioctl_fd
);
}
static
void
wake_message
(
struct
pipe_message
*
message
)
{
...
...
@@ -411,19 +396,6 @@ static void pipe_end_disconnect( struct pipe_end *pipe_end, unsigned int status
}
}
static
void
do_disconnect
(
struct
pipe_server
*
server
)
{
/* we may only have a server fd, if the client disconnected */
if
(
server
->
client
)
{
assert
(
server
->
client
->
server
==
server
);
assert
(
server
->
client
->
pipe_end
.
fd
);
}
assert
(
server
->
pipe_end
.
fd
);
release_object
(
server
->
pipe_end
.
fd
);
server
->
pipe_end
.
fd
=
NULL
;
}
static
void
pipe_end_destroy
(
struct
pipe_end
*
pipe_end
)
{
struct
pipe_message
*
message
;
...
...
@@ -437,6 +409,7 @@ static void pipe_end_destroy( struct pipe_end *pipe_end )
free_async_queue
(
&
pipe_end
->
read_q
);
free_async_queue
(
&
pipe_end
->
write_q
);
if
(
pipe_end
->
fd
)
release_object
(
pipe_end
->
fd
);
}
static
void
pipe_server_destroy
(
struct
object
*
obj
)
...
...
@@ -447,8 +420,6 @@ static void pipe_server_destroy( struct object *obj)
pipe_end_disconnect
(
&
server
->
pipe_end
,
STATUS_PIPE_BROKEN
);
if
(
server
->
pipe_end
.
fd
)
do_disconnect
(
server
);
pipe_end_destroy
(
&
server
->
pipe_end
);
if
(
server
->
client
)
{
...
...
@@ -459,7 +430,6 @@ static void pipe_server_destroy( struct object *obj)
assert
(
server
->
pipe
->
instances
);
server
->
pipe
->
instances
--
;
if
(
server
->
ioctl_fd
)
release_object
(
server
->
ioctl_fd
);
list_remove
(
&
server
->
entry
);
release_object
(
server
->
pipe
);
}
...
...
@@ -494,7 +464,6 @@ static void pipe_client_destroy( struct object *obj)
}
pipe_end_destroy
(
&
client
->
pipe_end
);
if
(
client
->
pipe_end
.
fd
)
release_object
(
client
->
pipe_end
.
fd
);
}
static
void
named_pipe_device_dump
(
struct
object
*
obj
,
int
verbose
)
...
...
@@ -849,7 +818,7 @@ static int pipe_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *as
{
case
ps_idle_server
:
case
ps_wait_connect
:
fd_queue_async
(
server
->
ioctl_
fd
,
async
,
ASYNC_TYPE_WAIT
);
fd_queue_async
(
server
->
pipe_end
.
fd
,
async
,
ASYNC_TYPE_WAIT
);
set_server_state
(
server
,
ps_wait_open
);
async_wake_up
(
&
server
->
pipe
->
waiters
,
STATUS_SUCCESS
);
set_error
(
STATUS_PENDING
);
...
...
@@ -871,11 +840,9 @@ static int pipe_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *as
{
case
ps_connected_server
:
assert
(
server
->
client
);
assert
(
server
->
client
->
pipe_end
.
fd
);
/* dump the client and server fds - client loses all waiting data */
pipe_end_disconnect
(
&
server
->
pipe_end
,
STATUS_PIPE_DISCONNECTED
);
do_disconnect
(
server
);
server
->
client
->
server
=
NULL
;
server
->
client
=
NULL
;
set_server_state
(
server
,
ps_wait_connect
);
...
...
@@ -883,7 +850,6 @@ static int pipe_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *as
case
ps_wait_disconnect
:
assert
(
!
server
->
client
);
pipe_end_disconnect
(
&
server
->
pipe_end
,
STATUS_PIPE_DISCONNECTED
);
do_disconnect
(
server
);
set_server_state
(
server
,
ps_wait_connect
);
break
;
case
ps_idle_server
:
...
...
@@ -953,12 +919,12 @@ static struct pipe_server *create_pipe_server( struct named_pipe *pipe, unsigned
list_add_head
(
&
pipe
->
servers
,
&
server
->
entry
);
grab_object
(
pipe
);
if
(
!
(
server
->
ioctl_
fd
=
alloc_pseudo_fd
(
&
pipe_server_fd_ops
,
&
server
->
pipe_end
.
obj
,
options
)))
if
(
!
(
server
->
pipe_end
.
fd
=
alloc_pseudo_fd
(
&
pipe_server_fd_ops
,
&
server
->
pipe_end
.
obj
,
options
)))
{
release_object
(
server
);
return
NULL
;
}
set_fd_signaled
(
server
->
ioctl_
fd
,
1
);
set_fd_signaled
(
server
->
pipe_end
.
fd
,
1
);
set_server_state
(
server
,
ps_idle_server
);
return
server
;
}
...
...
@@ -1048,11 +1014,10 @@ static struct object *named_pipe_open_file( struct object *obj, unsigned int acc
if
((
client
=
create_pipe_client
(
options
,
pipe
->
flags
,
pipe
->
outsize
,
options
)))
{
server
->
pipe_end
.
fd
=
(
struct
fd
*
)
grab_object
(
server
->
ioctl_fd
);
set_no_fd_status
(
server
->
ioctl_fd
,
STATUS_BAD_DEVICE_TYPE
);
set_no_fd_status
(
server
->
pipe_end
.
fd
,
STATUS_BAD_DEVICE_TYPE
);
allow_fd_caching
(
server
->
pipe_end
.
fd
);
if
(
server
->
state
==
ps_wait_open
)
fd_async_wake_up
(
server
->
ioctl_
fd
,
ASYNC_TYPE_WAIT
,
STATUS_SUCCESS
);
fd_async_wake_up
(
server
->
pipe_end
.
fd
,
ASYNC_TYPE_WAIT
,
STATUS_SUCCESS
);
set_server_state
(
server
,
ps_connected_server
);
server
->
client
=
client
;
client
->
server
=
server
;
...
...
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