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
a5a872ef
Commit
a5a872ef
authored
Mar 22, 2001
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the new send_fd mechanism for the set_console_fd server request.
parent
9fd15a9f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
54 deletions
+31
-54
server.h
include/server.h
+3
-3
process.c
scheduler/process.c
+6
-8
console.c
server/console.c
+7
-27
trace.c
server/trace.c
+2
-2
console.c
win32/console.c
+13
-14
No files found.
include/server.h
View file @
a5a872ef
...
...
@@ -757,8 +757,8 @@ struct set_console_fd_request
{
REQUEST_HEADER
;
/* request header */
IN
handle_t
handle
;
/* handle to the console */
IN
handle_t
handle_in
;
/* handle of file
to use as input */
IN
handle_t
handle_out
;
/* handle of file
to use as output */
IN
int
fd_in
;
/* file descriptor
to use as input */
IN
int
fd_out
;
/* file descriptor
to use as output */
IN
int
pid
;
/* pid of xterm (hack) */
};
...
...
@@ -1611,7 +1611,7 @@ union generic_request
struct
async_result_request
async_result
;
};
#define SERVER_PROTOCOL_VERSION 4
2
#define SERVER_PROTOCOL_VERSION 4
3
/* ### make_requests end ### */
/* Everything above this line is generated automatically by tools/make_requests */
...
...
scheduler/process.c
View file @
a5a872ef
...
...
@@ -229,20 +229,18 @@ void PROCESS_CallUserSignalProc( UINT uCode, HMODULE hModule )
*/
static
void
set_console_handles
(
HANDLE
console
)
{
HANDLE
in
=
FILE_DupUnixHandle
(
0
,
GENERIC_READ
);
HANDLE
out
=
FILE_DupUnixHandle
(
1
,
GENERIC_WRITE
);
wine_server_send_fd
(
0
);
wine_server_send_fd
(
1
);
SERVER_START_REQ
(
set_console_fd
)
{
req
->
handle
=
console
;
req
->
handle_in
=
in
;
req
->
handle_out
=
out
;
req
->
pid
=
0
;
req
->
handle
=
console
;
req
->
fd_in
=
0
;
req
->
fd_out
=
1
;
req
->
pid
=
0
;
SERVER_CALL
();
}
SERVER_END_REQ
;
NtClose
(
in
);
NtClose
(
out
);
}
...
...
server/console.c
View file @
a5a872ef
...
...
@@ -477,36 +477,16 @@ DECL_HANDLER(get_console_info)
/* set a console fd */
DECL_HANDLER
(
set_console_fd
)
{
struct
object
*
obj_in
,
*
obj_out
;
int
fd_in
,
fd_out
;
int
fd_out
,
fd_in
=
thread_get_inflight_fd
(
current
,
req
->
fd_in
);
if
(
!
(
obj_in
=
get_handle_obj
(
current
->
process
,
req
->
handle_in
,
GENERIC_READ
,
NULL
)))
return
;
if
((
fd_in
=
dup
(
obj_in
->
ops
->
get_fd
(
obj_in
)))
==
-
1
)
{
release_object
(
obj_in
);
return
;
}
release_object
(
obj_in
);
if
(
req
->
fd_out
==
req
->
fd_in
)
fd_out
=
dup
(
fd_in
);
else
fd_out
=
thread_get_inflight_fd
(
current
,
req
->
fd_out
);
if
(
!
(
obj_out
=
get_handle_obj
(
current
->
process
,
req
->
handle_out
,
GENERIC_WRITE
,
NULL
)))
{
close
(
fd_in
);
return
;
}
if
((
fd_out
=
dup
(
obj_out
->
ops
->
get_fd
(
obj_out
)))
==
-
1
)
{
release_object
(
obj_out
);
close
(
fd_in
);
return
;
}
release_object
(
obj_out
);
if
(
fd_in
==
-
1
||
fd_out
==
-
1
)
set_error
(
STATUS_INVALID_HANDLE
);
else
if
(
set_console_fd
(
req
->
handle
,
fd_in
,
fd_out
,
req
->
pid
))
return
;
if
(
!
set_console_fd
(
req
->
handle
,
fd_in
,
fd_out
,
req
->
pid
))
{
close
(
fd_out
);
close
(
fd_in
);
}
if
(
fd_in
!=
-
1
)
close
(
fd_in
);
if
(
fd_out
!=
-
1
)
close
(
fd_out
);
}
/* get a console mode (input or output) */
...
...
server/trace.c
View file @
a5a872ef
...
...
@@ -869,8 +869,8 @@ static void dump_open_console_reply( const struct open_console_request *req )
static
void
dump_set_console_fd_request
(
const
struct
set_console_fd_request
*
req
)
{
fprintf
(
stderr
,
" handle=%d,"
,
req
->
handle
);
fprintf
(
stderr
,
"
handle_in=%d,"
,
req
->
handle
_in
);
fprintf
(
stderr
,
"
handle_out=%d,"
,
req
->
handle
_out
);
fprintf
(
stderr
,
"
fd_in=%d,"
,
req
->
fd
_in
);
fprintf
(
stderr
,
"
fd_out=%d,"
,
req
->
fd
_out
);
fprintf
(
stderr
,
" pid=%d"
,
req
->
pid
);
}
...
...
win32/console.c
View file @
a5a872ef
...
...
@@ -42,7 +42,6 @@
#include "wine/winuser16.h"
#include "wine/keyboard16.h"
#include "thread.h"
#include "file.h"
#include "winerror.h"
#include "wincon.h"
#include "heap.h"
...
...
@@ -580,7 +579,6 @@ static BOOL CONSOLE_make_complex(HANDLE handle)
char
buf
[
256
];
char
c
=
'\0'
;
int
i
,
xpid
,
master
,
slave
;
HANDLE
pty_handle
;
if
(
CONSOLE_GetPid
(
handle
))
return
TRUE
;
/* already complex */
...
...
@@ -605,36 +603,37 @@ static BOOL CONSOLE_make_complex(HANDLE handle)
ERR
(
"error creating AllocConsole xterm
\n
"
);
exit
(
1
);
}
pty_handle
=
FILE_DupUnixHandle
(
slave
,
GENERIC_READ
|
GENERIC_WRITE
);
close
(
master
);
close
(
slave
);
if
(
!
pty_handle
)
return
FALSE
;
/* most xterms like to print their window ID when used with -S;
* read it and continue before the user has a chance...
*/
for
(
i
=
0
;
i
<
10000
;
i
++
)
{
BOOL
ok
=
ReadFile
(
pty_handle
,
&
c
,
1
,
NULL
,
NULL
);
if
(
!
ok
&&
!
c
)
usleep
(
100
);
/* wait for xterm to be created */
else
if
(
c
==
'\n'
)
break
;
if
(
read
(
slave
,
&
c
,
1
)
==
1
)
{
if
(
c
==
'\n'
)
break
;
}
else
usleep
(
100
);
/* wait for xterm to be created */
}
if
(
i
==
10000
)
{
ERR
(
"can't read xterm WID
\n
"
);
CloseHandle
(
pty_handl
e
);
close
(
slav
e
);
return
FALSE
;
}
wine_server_send_fd
(
slave
);
SERVER_START_REQ
(
set_console_fd
)
{
req
->
handle
=
handle
;
req
->
handle_in
=
pty_handl
e
;
req
->
handle_out
=
pty_handl
e
;
req
->
pid
=
xpid
;
req
->
handle
=
handle
;
req
->
fd_in
=
slav
e
;
req
->
fd_out
=
slav
e
;
req
->
pid
=
xpid
;
SERVER_CALL
();
close
(
slave
);
}
SERVER_END_REQ
;
CloseHandle
(
pty_handle
);
/* enable mouseclicks */
strcpy
(
buf
,
"
\033
[?1002h"
);
...
...
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