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
c00a4473
Commit
c00a4473
authored
May 20, 2003
by
Eric Pouech
Committed by
Alexandre Julliard
May 20, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement anonymous pipes on top of named pipes.
parent
97f216c9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
38 additions
and
292 deletions
+38
-292
sync.c
dlls/kernel/sync.c
+37
-0
Makefile.in
dlls/ntdll/Makefile.in
+0
-1
server_protocol.h
include/wine/server_protocol.h
+1
-18
pipe.c
scheduler/pipe.c
+0
-45
Makefile.in
server/Makefile.in
+0
-1
pipe.c
server/pipe.c
+0
-202
protocol.def
server/protocol.def
+0
-9
request.h
server/request.h
+0
-2
trace.c
server/trace.c
+0
-14
No files found.
dlls/kernel/sync.c
View file @
c00a4473
...
...
@@ -32,6 +32,7 @@
#ifdef HAVE_SYS_POLL_H
#include <sys/poll.h>
#endif
#include <stdio.h>
#include "winbase.h"
#include "winerror.h"
...
...
@@ -1064,3 +1065,39 @@ BOOL WINAPI CallNamedPipeW(
lpOutput
,
lpOutputSize
,
lpBytesRead
,
nTimeout
);
return
FALSE
;
}
/******************************************************************
* CreatePipe (KERNEL32.@)
*
*/
BOOL
WINAPI
CreatePipe
(
PHANDLE
hReadPipe
,
PHANDLE
hWritePipe
,
LPSECURITY_ATTRIBUTES
sa
,
DWORD
size
)
{
static
unsigned
index
=
0
;
char
name
[
64
];
HANDLE
hr
,
hw
;
unsigned
in_index
=
index
;
*
hReadPipe
=
*
hWritePipe
=
INVALID_HANDLE_VALUE
;
/* generate a unique pipe name (system wide) */
do
{
sprintf
(
name
,
"
\\\\
.
\\
pipe
\\
Win32.Pipes.%08lu.%08u"
,
GetCurrentProcessId
(),
++
index
);
hr
=
CreateNamedPipeA
(
name
,
PIPE_ACCESS_INBOUND
,
PIPE_TYPE_BYTE
|
PIPE_WAIT
,
1
,
size
,
size
,
NMPWAIT_USE_DEFAULT_WAIT
,
sa
);
}
while
(
hr
==
INVALID_HANDLE_VALUE
&&
index
!=
in_index
);
/* from completion sakeness, I think system resources might be exhausted before this happens !! */
if
(
hr
==
INVALID_HANDLE_VALUE
)
return
FALSE
;
hw
=
CreateFileA
(
name
,
GENERIC_WRITE
,
0
,
sa
,
OPEN_EXISTING
,
0
,
0
);
if
(
hw
==
INVALID_HANDLE_VALUE
)
{
CloseHandle
(
hr
);
return
FALSE
;
}
*
hReadPipe
=
hr
;
*
hWritePipe
=
hw
;
return
TRUE
;
}
dlls/ntdll/Makefile.in
View file @
c00a4473
...
...
@@ -52,7 +52,6 @@ C_SRCS = \
$(TOPOBJDIR)
/scheduler/critsection.c
\
$(TOPOBJDIR)
/scheduler/fiber.c
\
$(TOPOBJDIR)
/scheduler/handle.c
\
$(TOPOBJDIR)
/scheduler/pipe.c
\
$(TOPOBJDIR)
/scheduler/process.c
\
$(TOPOBJDIR)
/scheduler/pthread.c
\
$(TOPOBJDIR)
/scheduler/synchro.c
\
...
...
include/wine/server_protocol.h
View file @
c00a4473
...
...
@@ -939,20 +939,6 @@ struct unlock_file_reply
struct
create_pipe_request
{
struct
request_header
__header
;
int
inherit
;
};
struct
create_pipe_reply
{
struct
reply_header
__header
;
obj_handle_t
handle_read
;
obj_handle_t
handle_write
;
};
struct
create_socket_request
{
struct
request_header
__header
;
...
...
@@ -3092,7 +3078,6 @@ enum request
REQ_get_file_info
,
REQ_lock_file
,
REQ_unlock_file
,
REQ_create_pipe
,
REQ_create_socket
,
REQ_accept_socket
,
REQ_set_socket_event
,
...
...
@@ -3274,7 +3259,6 @@ union generic_request
struct
get_file_info_request
get_file_info_request
;
struct
lock_file_request
lock_file_request
;
struct
unlock_file_request
unlock_file_request
;
struct
create_pipe_request
create_pipe_request
;
struct
create_socket_request
create_socket_request
;
struct
accept_socket_request
accept_socket_request
;
struct
set_socket_event_request
set_socket_event_request
;
...
...
@@ -3454,7 +3438,6 @@ union generic_reply
struct
get_file_info_reply
get_file_info_reply
;
struct
lock_file_reply
lock_file_reply
;
struct
unlock_file_reply
unlock_file_reply
;
struct
create_pipe_reply
create_pipe_reply
;
struct
create_socket_reply
create_socket_reply
;
struct
accept_socket_reply
accept_socket_reply
;
struct
set_socket_event_reply
set_socket_event_reply
;
...
...
@@ -3585,6 +3568,6 @@ union generic_reply
struct
get_next_hook_reply
get_next_hook_reply
;
};
#define SERVER_PROTOCOL_VERSION 10
7
#define SERVER_PROTOCOL_VERSION 10
8
#endif
/* __WINE_WINE_SERVER_PROTOCOL_H */
scheduler/pipe.c
deleted
100644 → 0
View file @
97f216c9
/*
* Win32 pipes
*
* Copyright 1998 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <assert.h>
#include "winerror.h"
#include "winbase.h"
#include "wine/server.h"
/***********************************************************************
* CreatePipe (KERNEL32.@)
*/
BOOL
WINAPI
CreatePipe
(
PHANDLE
hReadPipe
,
PHANDLE
hWritePipe
,
LPSECURITY_ATTRIBUTES
sa
,
DWORD
size
)
{
BOOL
ret
;
SERVER_START_REQ
(
create_pipe
)
{
req
->
inherit
=
(
sa
&&
(
sa
->
nLength
>=
sizeof
(
*
sa
))
&&
sa
->
bInheritHandle
);
if
((
ret
=
!
wine_server_call_err
(
req
)))
{
*
hReadPipe
=
reply
->
handle_read
;
*
hWritePipe
=
reply
->
handle_write
;
}
}
SERVER_END_REQ
;
return
ret
;
}
server/Makefile.in
View file @
c00a4473
...
...
@@ -25,7 +25,6 @@ C_SRCS = \
mutex.c
\
named_pipe.c
\
object.c
\
pipe.c
\
process.c
\
ptrace.c
\
queue.c
\
...
...
server/pipe.c
deleted
100644 → 0
View file @
97f216c9
/*
* Server-side pipe management
*
* Copyright (C) 1998 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <assert.h>
#include <fcntl.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include "winbase.h"
#include "file.h"
#include "handle.h"
#include "thread.h"
#include "request.h"
enum
side
{
READ_SIDE
,
WRITE_SIDE
};
struct
pipe
{
struct
object
obj
;
/* object header */
struct
fd
*
fd
;
/* pipe file descriptor */
struct
pipe
*
other
;
/* the pipe other end */
enum
side
side
;
/* which side of the pipe is this */
};
static
void
pipe_dump
(
struct
object
*
obj
,
int
verbose
);
static
struct
fd
*
pipe_get_fd
(
struct
object
*
obj
);
static
void
pipe_destroy
(
struct
object
*
obj
);
static
int
pipe_get_poll_events
(
struct
fd
*
fd
);
static
int
pipe_get_info
(
struct
fd
*
fd
,
struct
get_file_info_reply
*
reply
,
int
*
flags
);
static
const
struct
object_ops
pipe_ops
=
{
sizeof
(
struct
pipe
),
/* size */
pipe_dump
,
/* dump */
default_fd_add_queue
,
/* add_queue */
default_fd_remove_queue
,
/* remove_queue */
default_fd_signaled
,
/* signaled */
no_satisfied
,
/* satisfied */
pipe_get_fd
,
/* get_fd */
pipe_destroy
/* destroy */
};
static
const
struct
fd_ops
pipe_fd_ops
=
{
pipe_get_poll_events
,
/* get_poll_events */
default_poll_event
,
/* poll_event */
no_flush
,
/* flush */
pipe_get_info
,
/* get_file_info */
no_queue_async
/* queue_async */
};
static
struct
pipe
*
create_pipe_side
(
int
fd
,
int
side
)
{
struct
pipe
*
pipe
;
if
((
pipe
=
alloc_object
(
&
pipe_ops
)))
{
pipe
->
other
=
NULL
;
pipe
->
side
=
side
;
}
if
(
!
(
pipe
->
fd
=
create_anonymous_fd
(
&
pipe_fd_ops
,
fd
,
&
pipe
->
obj
)))
{
release_object
(
pipe
);
return
NULL
;
}
return
pipe
;
}
static
int
create_pipe
(
struct
object
*
obj
[
2
]
)
{
struct
pipe
*
read_pipe
;
struct
pipe
*
write_pipe
;
int
fd
[
2
];
if
(
pipe
(
fd
)
==
-
1
)
{
file_set_error
();
return
0
;
}
if
((
read_pipe
=
create_pipe_side
(
fd
[
0
],
READ_SIDE
)))
{
if
((
write_pipe
=
create_pipe_side
(
fd
[
1
],
WRITE_SIDE
)))
{
write_pipe
->
other
=
read_pipe
;
read_pipe
->
other
=
write_pipe
;
obj
[
0
]
=
&
read_pipe
->
obj
;
obj
[
1
]
=
&
write_pipe
->
obj
;
return
1
;
}
release_object
(
read_pipe
);
}
else
close
(
fd
[
1
]
);
return
0
;
}
static
void
pipe_dump
(
struct
object
*
obj
,
int
verbose
)
{
struct
pipe
*
pipe
=
(
struct
pipe
*
)
obj
;
assert
(
obj
->
ops
==
&
pipe_ops
);
fprintf
(
stderr
,
"Pipe %s-side fd=%p
\n
"
,
(
pipe
->
side
==
READ_SIDE
)
?
"read"
:
"write"
,
pipe
->
fd
);
}
static
int
pipe_get_poll_events
(
struct
fd
*
fd
)
{
struct
pipe
*
pipe
=
get_fd_user
(
fd
);
assert
(
pipe
->
obj
.
ops
==
&
pipe_ops
);
return
(
pipe
->
side
==
READ_SIDE
)
?
POLLIN
:
POLLOUT
;
}
static
struct
fd
*
pipe_get_fd
(
struct
object
*
obj
)
{
struct
pipe
*
pipe
=
(
struct
pipe
*
)
obj
;
assert
(
obj
->
ops
==
&
pipe_ops
);
if
(
!
pipe
->
other
)
{
set_error
(
STATUS_PIPE_BROKEN
);
return
NULL
;
}
return
(
struct
fd
*
)
grab_object
(
pipe
->
fd
);
}
static
int
pipe_get_info
(
struct
fd
*
fd
,
struct
get_file_info_reply
*
reply
,
int
*
flags
)
{
if
(
reply
)
{
reply
->
type
=
FILE_TYPE_PIPE
;
reply
->
attr
=
0
;
reply
->
access_time
=
0
;
reply
->
write_time
=
0
;
reply
->
size_high
=
0
;
reply
->
size_low
=
0
;
reply
->
links
=
0
;
reply
->
index_high
=
0
;
reply
->
index_low
=
0
;
reply
->
serial
=
0
;
}
*
flags
=
0
;
return
FD_TYPE_DEFAULT
;
}
static
void
pipe_destroy
(
struct
object
*
obj
)
{
struct
pipe
*
pipe
=
(
struct
pipe
*
)
obj
;
assert
(
obj
->
ops
==
&
pipe_ops
);
if
(
pipe
->
other
)
pipe
->
other
->
other
=
NULL
;
if
(
pipe
->
fd
)
release_object
(
pipe
->
fd
);
}
/* create an anonymous pipe */
DECL_HANDLER
(
create_pipe
)
{
struct
object
*
obj
[
2
];
obj_handle_t
hread
=
0
,
hwrite
=
0
;
if
(
create_pipe
(
obj
))
{
hread
=
alloc_handle
(
current
->
process
,
obj
[
0
],
STANDARD_RIGHTS_REQUIRED
|
SYNCHRONIZE
|
GENERIC_READ
,
req
->
inherit
);
if
(
hread
)
{
hwrite
=
alloc_handle
(
current
->
process
,
obj
[
1
],
STANDARD_RIGHTS_REQUIRED
|
SYNCHRONIZE
|
GENERIC_WRITE
,
req
->
inherit
);
if
(
!
hwrite
)
close_handle
(
current
->
process
,
hread
,
NULL
);
}
release_object
(
obj
[
0
]
);
release_object
(
obj
[
1
]
);
}
reply
->
handle_read
=
hread
;
reply
->
handle_write
=
hwrite
;
}
server/protocol.def
View file @
c00a4473
...
...
@@ -712,15 +712,6 @@ enum fd_type
@END
/* Create an anonymous pipe */
@REQ(create_pipe)
int inherit; /* inherit flag */
@REPLY
obj_handle_t handle_read; /* handle to the read-side of the pipe */
obj_handle_t handle_write; /* handle to the write-side of the pipe */
@END
/* Create a socket */
@REQ(create_socket)
unsigned int access; /* wanted access rights */
...
...
server/request.h
View file @
c00a4473
...
...
@@ -149,7 +149,6 @@ DECL_HANDLER(flush_file);
DECL_HANDLER
(
get_file_info
);
DECL_HANDLER
(
lock_file
);
DECL_HANDLER
(
unlock_file
);
DECL_HANDLER
(
create_pipe
);
DECL_HANDLER
(
create_socket
);
DECL_HANDLER
(
accept_socket
);
DECL_HANDLER
(
set_socket_event
);
...
...
@@ -330,7 +329,6 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(
req_handler
)
req_get_file_info
,
(
req_handler
)
req_lock_file
,
(
req_handler
)
req_unlock_file
,
(
req_handler
)
req_create_pipe
,
(
req_handler
)
req_create_socket
,
(
req_handler
)
req_accept_socket
,
(
req_handler
)
req_set_socket_event
,
...
...
server/trace.c
View file @
c00a4473
...
...
@@ -927,17 +927,6 @@ static void dump_unlock_file_request( const struct unlock_file_request *req )
fprintf
(
stderr
,
" count_high=%08x"
,
req
->
count_high
);
}
static
void
dump_create_pipe_request
(
const
struct
create_pipe_request
*
req
)
{
fprintf
(
stderr
,
" inherit=%d"
,
req
->
inherit
);
}
static
void
dump_create_pipe_reply
(
const
struct
create_pipe_reply
*
req
)
{
fprintf
(
stderr
,
" handle_read=%p,"
,
req
->
handle_read
);
fprintf
(
stderr
,
" handle_write=%p"
,
req
->
handle_write
);
}
static
void
dump_create_socket_request
(
const
struct
create_socket_request
*
req
)
{
fprintf
(
stderr
,
" access=%08x,"
,
req
->
access
);
...
...
@@ -2506,7 +2495,6 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(
dump_func
)
dump_get_file_info_request
,
(
dump_func
)
dump_lock_file_request
,
(
dump_func
)
dump_unlock_file_request
,
(
dump_func
)
dump_create_pipe_request
,
(
dump_func
)
dump_create_socket_request
,
(
dump_func
)
dump_accept_socket_request
,
(
dump_func
)
dump_set_socket_event_request
,
...
...
@@ -2684,7 +2672,6 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
(
dump_func
)
dump_get_file_info_reply
,
(
dump_func
)
dump_lock_file_reply
,
(
dump_func
)
0
,
(
dump_func
)
dump_create_pipe_reply
,
(
dump_func
)
dump_create_socket_reply
,
(
dump_func
)
dump_accept_socket_reply
,
(
dump_func
)
0
,
...
...
@@ -2862,7 +2849,6 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"get_file_info"
,
"lock_file"
,
"unlock_file"
,
"create_pipe"
,
"create_socket"
,
"accept_socket"
,
"set_socket_event"
,
...
...
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