VirtualBox

source: vbox/trunk/include/iprt/pipe.h@ 26702

Last change on this file since 26702 was 26702, checked in by vboxsync, 15 years ago

iprt/types.h,iprt/pipe.h: Added pipe.h (no code yet) and preparing for polling and RTProcCreateEx.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 KB
Line 
1/** @file
2 * IPRT - Anonymous Pipes.
3 */
4
5/*
6 * Copyright (C) 2010 Sun Microsystems, Inc.
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 *
25 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
26 * Clara, CA 95054 USA or visit http://www.sun.com if you need
27 * additional information or have any questions.
28 */
29
30#ifndef ___iprt_pipe_h
31#define ___iprt_pipe_h
32
33#include <iprt/cdefs.h>
34#include <iprt/types.h>
35#include <iprt/stdarg.h>
36
37RT_C_DECLS_BEGIN
38
39/** @defgroup grp_rt_pipe RTPipe - Anonymous Pipes
40 * @ingroup grp_rt
41 * @{
42 */
43
44/**
45 * Create an anonymous pipe.
46 *
47 * @returns IPRT status code.
48 * @param phPipeRead Where to return the read end of the pipe.
49 * @param phPipeWrite Where to return the write end of the pipe.
50 * @param fFlags A combination of RTPIPE_C_XXX defines.
51 */
52RTDECL(int) RTPipeCreate(PRTPIPE phPipeRead, PRTPIPE phPipeWrite, uint32_t fFlags);
53
54/**
55 * Closes one end of a pipe created by RTPipeCreate.
56 *
57 * @returns IPRT status code.
58 * @param hPipe The pipe end to close.
59 */
60RTDECL(int) RTPipeClose(RTPIPE hPipe);
61
62/**
63 * Gets the native handle for an IPRT pipe handle.
64 *
65 * @returns The native handle.
66 * @param hPipe The IPRT pipe handle.
67 */
68RTR3DECL(RTHCINTPTR) RTPipeToNative(RTPIPE hPipe);
69
70/**
71 * Read bytes from a pipe, non-blocking.
72 *
73 * @returns IPRT status code.
74 * @param hPipe The IPRT pipe handle to read from.
75 * @param pvBuf Where to put the bytes we read.
76 * @param cbToRead How much to read.
77 * @param pcbRead Where to return the number of bytes that has been
78 * read (mandatory).
79 * @sa RTPipeReadBlocking.
80 */
81RTDECL(int) RTPipeRead(RTPIPE hPipe, void *pvBuf, size_t cbToRead, size_t *pcbRead);
82
83/**
84 * Read bytes from a pipe, blocking.
85 *
86 * @returns IPRT status code.
87 * @param hPipe The IPRT pipe handle to read from.
88 * @param pvBuf Where to put the bytes we read.
89 * @param cbToRead How much to read.
90 */
91RTDECL(int) RTPipeReadBlocking(RTPIPE hPipe, void *pvBuf, size_t cbToRead);
92
93/**
94 * Write bytes to a pipe.
95 *
96 * This will block until all bytes are written.
97 *
98 * @returns IPRT status code.
99 * @param hPipe The IPRT pipe handle to write to.
100 * @param pvBuf What to write.
101 * @param cbToWrite How much to write.
102 */
103RTDECL(int) RTPipeWrite(RTPIPE hPipe, const void *pvBuf, size_t cbToWrite);
104
105/**
106 * Flushes the buffers for the specified pipe and making sure the other party
107 * reads them.
108 *
109 * @returns IPRT status code.
110 * @retval VERR_NOT_SUPPORTED if not supported by the OS?
111 *
112 * @param hPipe The IPRT pipe handle to flush.
113 */
114RTDECL(int) RTPipeFlush(RTPIPE hPipe);
115
116/**
117 * Checks if the pipe is ready for reading.
118 *
119 * @returns IPRT status code.
120 * @param hPipe The IPRT read pipe handle to select on.
121 * @param cMillies Number of milliseconds to wait. Use
122 * RT_INDEFINITE_WAIT to wait for ever.
123 */
124RTDECL(int) RTPipeSelectOne(RTPIPE hPipe, RTMSINTERVAL cMillies);
125
126/** @} */
127
128RT_C_DECLS_END
129
130#endif
131
132
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette