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
200f8d95
Commit
200f8d95
authored
Apr 19, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Reuse existing file descriptor objects for duplicate file mappings.
parent
55bfd2ef
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
4 deletions
+22
-4
fd.c
server/fd.c
+14
-0
file.h
server/file.h
+1
-0
mapping.c
server/mapping.c
+7
-4
No files found.
server/fd.c
View file @
200f8d95
...
@@ -1670,6 +1670,20 @@ failed:
...
@@ -1670,6 +1670,20 @@ failed:
return
NULL
;
return
NULL
;
}
}
/* find an existing fd object that can be reused for a mapping */
struct
fd
*
get_fd_object_for_mapping
(
struct
fd
*
fd
,
unsigned
int
access
,
unsigned
int
sharing
)
{
struct
fd
*
fd_ptr
;
if
(
!
fd
->
inode
)
return
NULL
;
LIST_FOR_EACH_ENTRY
(
fd_ptr
,
&
fd
->
inode
->
open
,
struct
fd
,
inode_entry
)
if
(
fd_ptr
->
access
==
access
&&
fd_ptr
->
sharing
==
sharing
)
return
(
struct
fd
*
)
grab_object
(
fd_ptr
);
return
NULL
;
}
/* set the status to return when the fd has no associated unix fd */
/* set the status to return when the fd has no associated unix fd */
void
set_no_fd_status
(
struct
fd
*
fd
,
unsigned
int
status
)
void
set_no_fd_status
(
struct
fd
*
fd
,
unsigned
int
status
)
{
{
...
...
server/file.h
View file @
200f8d95
...
@@ -61,6 +61,7 @@ extern struct fd *create_anonymous_fd( const struct fd_ops *fd_user_ops,
...
@@ -61,6 +61,7 @@ extern struct fd *create_anonymous_fd( const struct fd_ops *fd_user_ops,
int
unix_fd
,
struct
object
*
user
,
unsigned
int
options
);
int
unix_fd
,
struct
object
*
user
,
unsigned
int
options
);
extern
struct
fd
*
dup_fd_object
(
struct
fd
*
orig
,
unsigned
int
access
,
unsigned
int
sharing
,
extern
struct
fd
*
dup_fd_object
(
struct
fd
*
orig
,
unsigned
int
access
,
unsigned
int
sharing
,
unsigned
int
options
);
unsigned
int
options
);
extern
struct
fd
*
get_fd_object_for_mapping
(
struct
fd
*
fd
,
unsigned
int
access
,
unsigned
int
sharing
);
extern
void
*
get_fd_user
(
struct
fd
*
fd
);
extern
void
*
get_fd_user
(
struct
fd
*
fd
);
extern
void
set_fd_user
(
struct
fd
*
fd
,
const
struct
fd_ops
*
ops
,
struct
object
*
user
);
extern
void
set_fd_user
(
struct
fd
*
fd
,
const
struct
fd_ops
*
ops
,
struct
object
*
user
);
extern
unsigned
int
get_fd_options
(
struct
fd
*
fd
);
extern
unsigned
int
get_fd_options
(
struct
fd
*
fd
);
...
...
server/mapping.c
View file @
200f8d95
...
@@ -496,6 +496,7 @@ static struct object *create_mapping( struct directory *root, const struct unico
...
@@ -496,6 +496,7 @@ static struct object *create_mapping( struct directory *root, const struct unico
if
(
handle
)
if
(
handle
)
{
{
const
unsigned
int
sharing
=
FILE_SHARE_READ
|
FILE_SHARE_WRITE
|
FILE_SHARE_DELETE
;
unsigned
int
mapping_access
=
FILE_MAPPING_ACCESS
;
unsigned
int
mapping_access
=
FILE_MAPPING_ACCESS
;
if
(
!
(
protect
&
VPROT_COMMITTED
))
if
(
!
(
protect
&
VPROT_COMMITTED
))
...
@@ -509,14 +510,16 @@ static struct object *create_mapping( struct directory *root, const struct unico
...
@@ -509,14 +510,16 @@ static struct object *create_mapping( struct directory *root, const struct unico
/* file sharing rules for mappings are different so we use magic the access rights */
/* file sharing rules for mappings are different so we use magic the access rights */
if
(
protect
&
VPROT_IMAGE
)
mapping_access
|=
FILE_MAPPING_IMAGE
;
if
(
protect
&
VPROT_IMAGE
)
mapping_access
|=
FILE_MAPPING_IMAGE
;
else
if
(
protect
&
VPROT_WRITE
)
mapping_access
|=
FILE_MAPPING_WRITE
;
else
if
(
protect
&
VPROT_WRITE
)
mapping_access
|=
FILE_MAPPING_WRITE
;
mapping
->
fd
=
dup_fd_object
(
fd
,
mapping_access
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
|
FILE_SHARE_DELETE
,
if
(
!
(
mapping
->
fd
=
get_fd_object_for_mapping
(
fd
,
mapping_access
,
sharing
)))
FILE_SYNCHRONOUS_IO_NONALERT
);
{
mapping
->
fd
=
dup_fd_object
(
fd
,
mapping_access
,
sharing
,
FILE_SYNCHRONOUS_IO_NONALERT
);
if
(
mapping
->
fd
)
set_fd_user
(
mapping
->
fd
,
&
mapping_fd_ops
,
NULL
);
}
release_object
(
file
);
release_object
(
file
);
release_object
(
fd
);
release_object
(
fd
);
if
(
!
mapping
->
fd
)
goto
error
;
if
(
!
mapping
->
fd
)
goto
error
;
set_fd_user
(
mapping
->
fd
,
&
mapping_fd_ops
,
&
mapping
->
obj
);
if
((
unix_fd
=
get_unix_fd
(
mapping
->
fd
))
==
-
1
)
goto
error
;
if
((
unix_fd
=
get_unix_fd
(
mapping
->
fd
))
==
-
1
)
goto
error
;
if
(
protect
&
VPROT_IMAGE
)
if
(
protect
&
VPROT_IMAGE
)
{
{
...
...
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