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
eb2fe39d
Commit
eb2fe39d
authored
Apr 18, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Add support for opening a new file handle from a mapping object.
parent
35431ed0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
8 deletions
+55
-8
file.c
server/file.c
+25
-0
file.h
server/file.h
+9
-0
mapping.c
server/mapping.c
+21
-4
object.h
server/object.h
+0
-4
No files found.
server/file.c
View file @
eb2fe39d
...
...
@@ -141,6 +141,31 @@ struct file *create_file_for_fd( int fd, unsigned int access, unsigned int shari
return
file
;
}
/* create a file by duplicating an fd object */
struct
file
*
create_file_for_fd_obj
(
struct
fd
*
fd
,
unsigned
int
access
,
unsigned
int
sharing
)
{
struct
file
*
file
;
struct
stat
st
;
if
(
fstat
(
get_unix_fd
(
fd
),
&
st
)
==
-
1
)
{
file_set_error
();
return
NULL
;
}
if
((
file
=
alloc_object
(
&
file_ops
)))
{
file
->
mode
=
st
.
st_mode
;
file
->
access
=
default_fd_map_access
(
&
file
->
obj
,
access
);
if
(
!
(
file
->
fd
=
dup_fd_object
(
fd
,
access
,
sharing
,
FILE_SYNCHRONOUS_IO_NONALERT
)))
{
release_object
(
file
);
return
NULL
;
}
}
return
file
;
}
static
struct
object
*
create_file_obj
(
struct
fd
*
fd
,
unsigned
int
access
,
mode_t
mode
)
{
struct
file
*
file
=
alloc_object
(
&
file_ops
);
...
...
server/file.h
View file @
eb2fe39d
...
...
@@ -116,11 +116,20 @@ extern struct file *get_file_obj( struct process *process, obj_handle_t handle,
extern
int
get_file_unix_fd
(
struct
file
*
file
);
extern
int
is_same_file
(
struct
file
*
file1
,
struct
file
*
file2
);
extern
struct
file
*
create_file_for_fd
(
int
fd
,
unsigned
int
access
,
unsigned
int
sharing
);
extern
struct
file
*
create_file_for_fd_obj
(
struct
fd
*
fd
,
unsigned
int
access
,
unsigned
int
sharing
);
extern
struct
file
*
grab_file_unless_removable
(
struct
file
*
file
);
extern
void
file_set_error
(
void
);
extern
struct
security_descriptor
*
mode_to_sd
(
mode_t
mode
,
const
SID
*
user
,
const
SID
*
group
);
extern
mode_t
sd_to_mode
(
const
struct
security_descriptor
*
sd
,
const
SID
*
owner
);
/* file mapping functions */
extern
struct
mapping
*
get_mapping_obj
(
struct
process
*
process
,
obj_handle_t
handle
,
unsigned
int
access
);
extern
obj_handle_t
open_mapping_file
(
struct
process
*
process
,
struct
mapping
*
mapping
,
unsigned
int
access
,
unsigned
int
sharing
);
extern
int
get_page_size
(
void
);
/* change notification functions */
extern
void
do_change_notify
(
int
unix_fd
);
...
...
server/mapping.c
View file @
eb2fe39d
...
...
@@ -565,6 +565,24 @@ static struct object *create_mapping( struct directory *root, const struct unico
return
NULL
;
}
struct
mapping
*
get_mapping_obj
(
struct
process
*
process
,
obj_handle_t
handle
,
unsigned
int
access
)
{
return
(
struct
mapping
*
)
get_handle_obj
(
process
,
handle
,
access
,
&
mapping_ops
);
}
/* open a new file handle to the file backing the mapping */
obj_handle_t
open_mapping_file
(
struct
process
*
process
,
struct
mapping
*
mapping
,
unsigned
int
access
,
unsigned
int
sharing
)
{
obj_handle_t
handle
;
struct
file
*
file
=
create_file_for_fd_obj
(
mapping
->
fd
,
access
,
sharing
);
if
(
!
file
)
return
0
;
handle
=
alloc_handle
(
process
,
file
,
access
,
0
);
release_object
(
file
);
return
handle
;
}
static
void
mapping_dump
(
struct
object
*
obj
,
int
verbose
)
{
struct
mapping
*
mapping
=
(
struct
mapping
*
)
obj
;
...
...
@@ -682,8 +700,7 @@ DECL_HANDLER(get_mapping_info)
struct
mapping
*
mapping
;
struct
fd
*
fd
;
if
((
mapping
=
(
struct
mapping
*
)
get_handle_obj
(
current
->
process
,
req
->
handle
,
req
->
access
,
&
mapping_ops
)))
if
((
mapping
=
get_mapping_obj
(
current
->
process
,
req
->
handle
,
req
->
access
)))
{
reply
->
size
=
mapping
->
size
;
reply
->
protect
=
mapping
->
protect
;
...
...
@@ -713,7 +730,7 @@ DECL_HANDLER(get_mapping_committed_range)
{
struct
mapping
*
mapping
;
if
((
mapping
=
(
struct
mapping
*
)
get_handle_obj
(
current
->
process
,
req
->
handle
,
0
,
&
mapping_ops
)))
if
((
mapping
=
get_mapping_obj
(
current
->
process
,
req
->
handle
,
0
)))
{
if
(
!
(
req
->
offset
&
page_mask
)
&&
req
->
offset
<
mapping
->
size
)
reply
->
committed
=
find_committed_range
(
mapping
,
req
->
offset
,
&
reply
->
size
);
...
...
@@ -729,7 +746,7 @@ DECL_HANDLER(add_mapping_committed_range)
{
struct
mapping
*
mapping
;
if
((
mapping
=
(
struct
mapping
*
)
get_handle_obj
(
current
->
process
,
req
->
handle
,
0
,
&
mapping_ops
)))
if
((
mapping
=
get_mapping_obj
(
current
->
process
,
req
->
handle
,
0
)))
{
if
(
!
(
req
->
size
&
page_mask
)
&&
!
(
req
->
offset
&
page_mask
)
&&
...
...
server/object.h
View file @
eb2fe39d
...
...
@@ -180,10 +180,6 @@ extern void generate_debug_event( struct thread *thread, int code, const void *a
extern
void
generate_startup_debug_events
(
struct
process
*
process
,
client_ptr_t
entry
);
extern
void
debug_exit_thread
(
struct
thread
*
thread
);
/* mapping functions */
extern
int
get_page_size
(
void
);
/* registry functions */
extern
unsigned
int
get_prefix_cpu_mask
(
void
);
...
...
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