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
72ff2bf3
Commit
72ff2bf3
authored
Apr 12, 2007
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Create a separate fd object for each mailslot writer. Make them first-class file handles.
parent
7c434992
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
16 deletions
+34
-16
mailslot.c
server/mailslot.c
+34
-16
No files found.
server/mailslot.c
View file @
72ff2bf3
...
...
@@ -56,7 +56,7 @@ struct mailslot
{
struct
object
obj
;
struct
fd
*
fd
;
struct
fd
*
write_fd
;
int
write_fd
;
unsigned
int
max_msgsize
;
int
read_timeout
;
struct
list
writers
;
...
...
@@ -105,6 +105,7 @@ static const struct fd_ops mailslot_fd_ops =
struct
mail_writer
{
struct
object
obj
;
struct
fd
*
fd
;
struct
mailslot
*
mailslot
;
struct
list
entry
;
unsigned
int
access
;
...
...
@@ -137,12 +138,13 @@ static enum server_fd_type mail_writer_get_fd_type( struct fd *fd );
static
const
struct
fd_ops
mail_writer_fd_ops
=
{
NULL
,
/* get_poll_events */
NULL
,
/* poll_event */
default_fd_get_poll_events
,
/* get_poll_events */
default_poll_event
,
/* poll_event */
no_flush
,
/* flush */
mail_writer_get_fd_type
,
/* get_fd_type */
no_queue_async
,
/* queue_async */
NULL
/* cancel_async */
default_fd_queue_async
,
/* queue_async */
default_fd_reselect_async
,
/* reselect_async */
default_fd_cancel_async
/* cancel_async */
};
...
...
@@ -195,11 +197,13 @@ static void mailslot_destroy( struct object *obj)
struct
mailslot
*
mailslot
=
(
struct
mailslot
*
)
obj
;
assert
(
mailslot
->
fd
);
assert
(
mailslot
->
write_fd
);
shutdown
(
get_unix_fd
(
mailslot
->
fd
),
SHUT_RDWR
);
if
(
mailslot
->
write_fd
!=
-
1
)
{
shutdown
(
mailslot
->
write_fd
,
SHUT_RDWR
);
close
(
mailslot
->
write_fd
);
}
release_object
(
mailslot
->
fd
);
release_object
(
mailslot
->
write_fd
);
}
static
void
mailslot_dump
(
struct
object
*
obj
,
int
verbose
)
...
...
@@ -236,6 +240,7 @@ static struct object *mailslot_open_file( struct object *obj, unsigned int acces
{
struct
mailslot
*
mailslot
=
(
struct
mailslot
*
)
obj
;
struct
mail_writer
*
writer
;
int
unix_fd
;
if
(
!
(
sharing
&
FILE_SHARE_READ
))
{
...
...
@@ -258,13 +263,27 @@ static struct object *mailslot_open_file( struct object *obj, unsigned int acces
}
}
if
(
!
(
writer
=
alloc_object
(
&
mail_writer_ops
)))
return
NULL
;
if
((
unix_fd
=
dup
(
mailslot
->
write_fd
))
==
-
1
)
{
file_set_error
();
return
NULL
;
}
if
(
!
(
writer
=
alloc_object
(
&
mail_writer_ops
)))
{
close
(
unix_fd
);
return
NULL
;
}
grab_object
(
mailslot
);
writer
->
mailslot
=
mailslot
;
writer
->
access
=
mail_writer_map_access
(
&
writer
->
obj
,
access
);
writer
->
sharing
=
sharing
;
list_add_head
(
&
mailslot
->
writers
,
&
writer
->
entry
);
if
(
!
(
writer
->
fd
=
create_anonymous_fd
(
&
mail_writer_fd_ops
,
unix_fd
,
&
writer
->
obj
,
options
)))
{
release_object
(
writer
);
return
NULL
;
}
return
&
writer
->
obj
;
}
...
...
@@ -396,7 +415,7 @@ static struct mailslot *create_mailslot( struct directory *root,
if
(
!
mailslot
)
return
NULL
;
mailslot
->
fd
=
NULL
;
mailslot
->
write_fd
=
NULL
;
mailslot
->
write_fd
=
-
1
;
mailslot
->
max_msgsize
=
max_msgsize
;
mailslot
->
read_timeout
=
read_timeout
;
list_init
(
&
mailslot
->
writers
);
...
...
@@ -406,11 +425,10 @@ static struct mailslot *create_mailslot( struct directory *root,
fcntl
(
fds
[
0
],
F_SETFL
,
O_NONBLOCK
);
fcntl
(
fds
[
1
],
F_SETFL
,
O_NONBLOCK
);
shutdown
(
fds
[
0
],
SHUT_RD
);
mailslot
->
write_fd
=
fds
[
0
];
mailslot
->
fd
=
create_anonymous_fd
(
&
mailslot_fd_ops
,
fds
[
1
],
&
mailslot
->
obj
,
FILE_SYNCHRONOUS_IO_NONALERT
);
mailslot
->
write_fd
=
create_anonymous_fd
(
&
mail_writer_fd_ops
,
fds
[
0
],
&
mailslot
->
obj
,
FILE_SYNCHRONOUS_IO_NONALERT
);
if
(
mailslot
->
fd
&&
mailslot
->
write_fd
)
return
mailslot
;
if
(
mailslot
->
fd
)
return
mailslot
;
}
else
file_set_error
();
...
...
@@ -427,6 +445,7 @@ static void mail_writer_destroy( struct object *obj)
{
struct
mail_writer
*
writer
=
(
struct
mail_writer
*
)
obj
;
if
(
writer
->
fd
)
release_object
(
writer
->
fd
);
list_remove
(
&
writer
->
entry
);
release_object
(
writer
->
mailslot
);
}
...
...
@@ -439,8 +458,7 @@ static enum server_fd_type mail_writer_get_fd_type( struct fd *fd )
static
struct
fd
*
mail_writer_get_fd
(
struct
object
*
obj
)
{
struct
mail_writer
*
writer
=
(
struct
mail_writer
*
)
obj
;
return
(
struct
fd
*
)
grab_object
(
writer
->
mailslot
->
write_fd
);
return
(
struct
fd
*
)
grab_object
(
writer
->
fd
);
}
static
unsigned
int
mail_writer_map_access
(
struct
object
*
obj
,
unsigned
int
access
)
...
...
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