VirtualBox

source: vbox/trunk/src/VBox/Runtime/include/internal/pipe.h@ 62477

Last change on this file since 62477 was 62477, checked in by vboxsync, 8 years ago

(C) 2016

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.7 KB
Line 
1/* $Id: pipe.h 62477 2016-07-22 18:27:37Z vboxsync $ */
2/** @file
3 * IPRT - Internal RTPipe header.
4 */
5
6/*
7 * Copyright (C) 2010-2016 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27#ifndef ___internal_pipe_h
28#define ___internal_pipe_h
29
30#include <iprt/pipe.h>
31
32RT_C_DECLS_BEGIN
33
34/**
35 * Internal RTPollSetAdd helper that returns the handle that should be added to
36 * the pollset.
37 *
38 * @returns Valid handle on success, INVALID_HANDLE_VALUE on failure.
39 * @param hPipe The pipe handle.
40 * @param fEvents The events we're polling for.
41 * @param phNative Where to put the primary handle.
42 */
43int rtPipePollGetHandle(RTPIPE hPipe, uint32_t fEvents, PRTHCINTPTR phNative);
44
45/**
46 * Internal RTPoll helper that polls the pipe handle and, if @a fNoWait is
47 * clear, starts whatever actions we've got running during the poll call.
48 *
49 * @returns 0 if no pending events, actions initiated if @a fNoWait is clear.
50 * Event mask (in @a fEvents) and no actions if the handle is ready
51 * already.
52 * UINT32_MAX (asserted) if the pipe handle is busy in I/O or a
53 * different poll set.
54 *
55 * @param hPipe The pipe handle.
56 * @param hPollSet The poll set handle (for access checks).
57 * @param fEvents The events we're polling for.
58 * @param fFinalEntry Set if this is the final entry for this handle
59 * in this poll set. This can be used for dealing
60 * with duplicate entries.
61 * @param fNoWait Set if it's a zero-wait poll call. Clear if
62 * we'll wait for an event to occur.
63 */
64uint32_t rtPipePollStart(RTPIPE hPipe, RTPOLLSET hPollSet, uint32_t fEvents, bool fFinalEntry, bool fNoWait);
65
66/**
67 * Called after a WaitForMultipleObjects returned in order to check for pending
68 * events and stop whatever actions that rtPipePollStart() initiated.
69 *
70 * @returns Event mask or 0.
71 *
72 * @param hPipe The pipe handle.
73 * @param fEvents The events we're polling for.
74 * @param fFinalEntry Set if this is the final entry for this handle
75 * in this poll set. This can be used for dealing
76 * with duplicate entries. Only keep in mind that
77 * this method is called in reverse order, so the
78 * first call will have this set (when the entire
79 * set was processed).
80 * @param fHarvestEvents Set if we should check for pending events.
81 */
82uint32_t rtPipePollDone(RTPIPE hPipe, uint32_t fEvents, bool fFinalEntry, bool fHarvestEvents);
83
84
85/**
86 * Fakes basic query info data for RTPipeQueryInfo.
87 *
88 * @param pObjInfo The output structure.
89 * @param enmAddAttr The extra attribute.
90 * @param fReadPipe Set if read pipe, clear if write pipe.
91 */
92DECLINLINE(void) rtPipeFakeQueryInfo(PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr, bool fReadPipe)
93{
94 RT_ZERO(*pObjInfo);
95 if (fReadPipe)
96 pObjInfo->Attr.fMode = RTFS_TYPE_FIFO | RTFS_UNIX_IRUSR | RTFS_DOS_READONLY;
97 else
98 pObjInfo->Attr.fMode = RTFS_TYPE_FIFO | RTFS_UNIX_IWUSR;
99 pObjInfo->Attr.enmAdditional = enmAddAttr;
100 switch (enmAddAttr)
101 {
102 case RTFSOBJATTRADD_UNIX:
103 pObjInfo->Attr.u.Unix.cHardlinks = 1;
104 break;
105 case RTFSOBJATTRADD_UNIX_OWNER:
106 pObjInfo->Attr.u.UnixOwner.uid = NIL_RTUID;
107 break;
108 case RTFSOBJATTRADD_UNIX_GROUP:
109 pObjInfo->Attr.u.UnixGroup.gid = NIL_RTGID;
110 break;
111 case RTFSOBJATTRADD_EASIZE:
112 break;
113 case RTFSOBJATTRADD_32BIT_SIZE_HACK:
114 case RTFSOBJATTRADD_NOTHING:
115 /* shut up gcc. */
116 break;
117 /* no default, want warnings. */
118 }
119}
120
121
122RT_C_DECLS_END
123
124#endif
125
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