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
8d1550d1
Commit
8d1550d1
authored
Mar 23, 2002
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Export the FILE_GetUnixHandle functionality from ntdll.
parent
ead22121
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
46 deletions
+59
-46
ntdll.spec
dlls/ntdll/ntdll.spec
+1
-0
file.c
files/file.c
+5
-31
server.h
include/wine/server.h
+2
-1
client.c
scheduler/client.c
+51
-14
No files found.
dlls/ntdll/ntdll.spec
View file @
8d1550d1
...
...
@@ -1041,6 +1041,7 @@ debug_channels (atom cdrom console debug delayhlp dll dosfs dosmem file fixup
# Server interface
@ cdecl -norelay wine_server_call(ptr) wine_server_call
@ cdecl wine_server_handle_to_fd(long long ptr ptr ptr) wine_server_handle_to_fd
# Codepages
@ cdecl __wine_init_codepages(ptr ptr) __wine_init_codepages
files/file.c
View file @
8d1550d1
...
...
@@ -227,36 +227,12 @@ HANDLE FILE_DupUnixHandle( int fd, DWORD access, BOOL inherit )
* Retrieve the Unix handle corresponding to a file handle.
* Returns -1 on failure.
*/
static
int
FILE_GetUnixHandleType
(
HANDLE
handle
,
DWORD
access
,
enum
fd_type
*
type
,
DWORD
*
flags
)
static
int
FILE_GetUnixHandleType
(
HANDLE
handle
,
DWORD
access
,
enum
fd_type
*
type
,
int
*
flags
)
{
int
ret
,
fd
=
-
1
;
do
{
SERVER_START_REQ
(
get_handle_fd
)
{
req
->
handle
=
handle
;
req
->
access
=
access
;
if
(
!
(
ret
=
wine_server_call_err
(
req
)))
{
fd
=
reply
->
fd
;
}
if
(
type
)
*
type
=
reply
->
type
;
if
(
flags
)
*
flags
=
reply
->
flags
;
}
SERVER_END_REQ
;
if
(
ret
)
return
-
1
;
if
(
fd
==
-
1
)
/* it wasn't in the cache, get it from the server */
fd
=
wine_server_recv_fd
(
handle
);
}
while
(
fd
==
-
2
);
/* -2 means race condition, so restart from scratch */
if
(
fd
!=
-
1
)
{
if
((
fd
=
dup
(
fd
))
==
-
1
)
SetLastError
(
ERROR_TOO_MANY_OPEN_FILES
);
}
ret
=
wine_server_handle_to_fd
(
handle
,
access
,
&
fd
,
type
,
flags
);
if
(
ret
)
SetLastError
(
RtlNtStatusToDosError
(
ret
)
);
return
fd
;
}
...
...
@@ -1467,9 +1443,8 @@ static BOOL FILE_TimeoutRead(HANDLE hFile, LPVOID buffer, DWORD bytesToRead, LPD
BOOL
WINAPI
ReadFile
(
HANDLE
hFile
,
LPVOID
buffer
,
DWORD
bytesToRead
,
LPDWORD
bytesRead
,
LPOVERLAPPED
overlapped
)
{
int
unix_handle
,
result
;
int
unix_handle
,
result
,
flags
;
enum
fd_type
type
;
DWORD
flags
;
TRACE
(
"%d %p %ld %p %p
\n
"
,
hFile
,
buffer
,
bytesToRead
,
bytesRead
,
overlapped
);
...
...
@@ -1693,9 +1668,8 @@ BOOL WINAPI WriteFileEx(HANDLE hFile, LPCVOID buffer, DWORD bytesToWrite,
BOOL
WINAPI
WriteFile
(
HANDLE
hFile
,
LPCVOID
buffer
,
DWORD
bytesToWrite
,
LPDWORD
bytesWritten
,
LPOVERLAPPED
overlapped
)
{
int
unix_handle
,
result
;
int
unix_handle
,
result
,
flags
;
enum
fd_type
type
;
DWORD
flags
;
TRACE
(
"%d %p %ld %p %p
\n
"
,
hFile
,
buffer
,
bytesToWrite
,
bytesWritten
,
overlapped
);
...
...
include/wine/server.h
View file @
8d1550d1
...
...
@@ -51,7 +51,8 @@ struct __server_request_info
extern
unsigned
int
wine_server_call
(
void
*
req_ptr
);
extern
void
wine_server_send_fd
(
int
fd
);
extern
int
wine_server_recv_fd
(
handle_t
handle
);
extern
int
wine_server_handle_to_fd
(
handle_t
handle
,
unsigned
int
access
,
int
*
unix_fd
,
enum
fd_type
*
type
,
int
*
flags
);
/* do a server call and set the last error code */
inline
static
unsigned
int
wine_server_call_err
(
void
*
req_ptr
)
...
...
scheduler/client.c
View file @
8d1550d1
...
...
@@ -330,23 +330,17 @@ static int receive_fd( handle_t *handle )
/***********************************************************************
*
wine_server_recv
_fd
*
store_cached
_fd
*
*
Receive a file descriptor passed from
the server.
*
The file descriptor must not be closed.
*
Return -2 if a race condition stole our file descriptor
.
*
Store the cached fd value for a given handle back into
the server.
*
Returns the new fd, which can be different if there was already an
*
fd in the cache for that handle
.
*/
in
t
wine_server_recv_fd
(
handle_t
handle
)
in
line
static
int
store_cached_fd
(
int
fd
,
handle_t
handle
)
{
handle_t
fd_handle
;
int
fd
=
receive_fd
(
&
fd_handle
);
/* now store it in the server fd cache for this handle */
SERVER_START_REQ
(
set_handle_info
)
{
req
->
handle
=
fd_
handle
;
req
->
handle
=
handle
;
req
->
flags
=
0
;
req
->
mask
=
0
;
req
->
fd
=
fd
;
...
...
@@ -366,13 +360,56 @@ int wine_server_recv_fd( handle_t handle )
}
}
SERVER_END_REQ
;
if
(
handle
!=
fd_handle
)
fd
=
-
2
;
/* not the one we expected */
return
fd
;
}
/***********************************************************************
* wine_server_handle_to_fd (NTDLL.@)
*
* Retrieve the Unix fd corresponding to a file handle.
*/
int
wine_server_handle_to_fd
(
handle_t
handle
,
unsigned
int
access
,
int
*
unix_fd
,
enum
fd_type
*
type
,
int
*
flags
)
{
handle_t
fd_handle
;
int
ret
,
fd
=
-
1
;
*
unix_fd
=
-
1
;
for
(;;)
{
SERVER_START_REQ
(
get_handle_fd
)
{
req
->
handle
=
handle
;
req
->
access
=
access
;
if
(
!
(
ret
=
wine_server_call
(
req
)))
fd
=
reply
->
fd
;
if
(
type
)
*
type
=
reply
->
type
;
if
(
flags
)
*
flags
=
reply
->
flags
;
}
SERVER_END_REQ
;
if
(
ret
)
return
ret
;
if
(
fd
!=
-
1
)
break
;
/* it wasn't in the cache, get it from the server */
fd
=
receive_fd
(
&
fd_handle
);
/* and store it back into the cache */
fd
=
store_cached_fd
(
fd
,
fd_handle
);
if
(
fd_handle
==
handle
)
break
;
/* if we received a different handle this means there was
* a race with another thread; we restart everything from
* scratch in this case.
*/
}
if
((
fd
!=
-
1
)
&&
((
fd
=
dup
(
fd
))
==
-
1
))
return
STATUS_TOO_MANY_OPENED_FILES
;
*
unix_fd
=
fd
;
return
STATUS_SUCCESS
;
}
/***********************************************************************
* get_config_dir
*
* Return the configuration directory ($WINEPREFIX or $HOME/.wine)
...
...
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