VirtualBox

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

Last change on this file since 81106 was 76585, checked in by vboxsync, 6 years ago

*: scm --fix-header-guard-endif

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.8 KB
Line 
1/* $Id: pipe.h 76585 2019-01-01 06:31:29Z vboxsync $ */
2/** @file
3 * IPRT - Internal RTPipe header.
4 */
5
6/*
7 * Copyright (C) 2010-2019 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 IPRT_INCLUDED_INTERNAL_pipe_h
28#define IPRT_INCLUDED_INTERNAL_pipe_h
29#ifndef RT_WITHOUT_PRAGMA_ONCE
30# pragma once
31#endif
32
33#include <iprt/pipe.h>
34
35RT_C_DECLS_BEGIN
36
37/**
38 * Internal RTPollSetAdd helper that returns the handle that should be added to
39 * the pollset.
40 *
41 * @returns Valid handle on success, INVALID_HANDLE_VALUE on failure.
42 * @param hPipe The pipe handle.
43 * @param fEvents The events we're polling for.
44 * @param phNative Where to put the primary handle.
45 */
46int rtPipePollGetHandle(RTPIPE hPipe, uint32_t fEvents, PRTHCINTPTR phNative);
47
48/**
49 * Internal RTPoll helper that polls the pipe handle and, if @a fNoWait is
50 * clear, starts whatever actions we've got running during the poll call.
51 *
52 * @returns 0 if no pending events, actions initiated if @a fNoWait is clear.
53 * Event mask (in @a fEvents) and no actions if the handle is ready
54 * already.
55 * UINT32_MAX (asserted) if the pipe handle is busy in I/O or a
56 * different poll set.
57 *
58 * @param hPipe The pipe handle.
59 * @param hPollSet The poll set handle (for access checks).
60 * @param fEvents The events we're polling for.
61 * @param fFinalEntry Set if this is the final entry for this handle
62 * in this poll set. This can be used for dealing
63 * with duplicate entries.
64 * @param fNoWait Set if it's a zero-wait poll call. Clear if
65 * we'll wait for an event to occur.
66 */
67uint32_t rtPipePollStart(RTPIPE hPipe, RTPOLLSET hPollSet, uint32_t fEvents, bool fFinalEntry, bool fNoWait);
68
69/**
70 * Called after a WaitForMultipleObjects returned in order to check for pending
71 * events and stop whatever actions that rtPipePollStart() initiated.
72 *
73 * @returns Event mask or 0.
74 *
75 * @param hPipe The pipe handle.
76 * @param fEvents The events we're polling for.
77 * @param fFinalEntry Set if this is the final entry for this handle
78 * in this poll set. This can be used for dealing
79 * with duplicate entries. Only keep in mind that
80 * this method is called in reverse order, so the
81 * first call will have this set (when the entire
82 * set was processed).
83 * @param fHarvestEvents Set if we should check for pending events.
84 */
85uint32_t rtPipePollDone(RTPIPE hPipe, uint32_t fEvents, bool fFinalEntry, bool fHarvestEvents);
86
87
88/**
89 * Fakes basic query info data for RTPipeQueryInfo.
90 *
91 * @param pObjInfo The output structure.
92 * @param enmAddAttr The extra attribute.
93 * @param fReadPipe Set if read pipe, clear if write pipe.
94 */
95DECLINLINE(void) rtPipeFakeQueryInfo(PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr, bool fReadPipe)
96{
97 RT_ZERO(*pObjInfo);
98 if (fReadPipe)
99 pObjInfo->Attr.fMode = RTFS_TYPE_FIFO | RTFS_UNIX_IRUSR | RTFS_DOS_READONLY;
100 else
101 pObjInfo->Attr.fMode = RTFS_TYPE_FIFO | RTFS_UNIX_IWUSR;
102 pObjInfo->Attr.enmAdditional = enmAddAttr;
103 switch (enmAddAttr)
104 {
105 case RTFSOBJATTRADD_UNIX:
106 pObjInfo->Attr.u.Unix.cHardlinks = 1;
107 break;
108 case RTFSOBJATTRADD_UNIX_OWNER:
109 pObjInfo->Attr.u.UnixOwner.uid = NIL_RTUID;
110 break;
111 case RTFSOBJATTRADD_UNIX_GROUP:
112 pObjInfo->Attr.u.UnixGroup.gid = NIL_RTGID;
113 break;
114 case RTFSOBJATTRADD_EASIZE:
115 break;
116 case RTFSOBJATTRADD_32BIT_SIZE_HACK:
117 case RTFSOBJATTRADD_NOTHING:
118 /* shut up gcc. */
119 break;
120 /* no default, want warnings. */
121 }
122}
123
124
125RT_C_DECLS_END
126
127#endif /* !IPRT_INCLUDED_INTERNAL_pipe_h */
128
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