File: classPassenger_1_1FileDescriptor.html

package info (click to toggle)
passenger 2.2.11debian-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 11,576 kB
  • ctags: 28,138
  • sloc: cpp: 66,323; ruby: 9,646; ansic: 2,425; python: 141; sh: 56; makefile: 29
file content (159 lines) | stat: -rw-r--r-- 10,107 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Passenger: Passenger::FileDescriptor Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.8 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="namespacePassenger.html">Passenger</a>::<a class="el" href="classPassenger_1_1FileDescriptor.html">FileDescriptor</a>
  </div>
</div>
<div class="contents">
<h1>Passenger::FileDescriptor Class Reference</h1><!-- doxytag: class="Passenger::FileDescriptor" -->Wrapper class around a file descriptor integer, for RAII behavior.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="FileDescriptor_8h-source.html">FileDescriptor.h</a>&gt;</code>
<p>

<p>
<a href="classPassenger_1_1FileDescriptor-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1FileDescriptor.html#05d83ad9cc77c493a3ce4f2b51d44559">FileDescriptor</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Creates a new empty <a class="el" href="classPassenger_1_1FileDescriptor.html" title="Wrapper class around a file descriptor integer, for RAII behavior.">FileDescriptor</a> instance that has no underlying file descriptor.  <a href="#05d83ad9cc77c493a3ce4f2b51d44559"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1FileDescriptor.html#62c05b925cb1cf964169cef7635650ee">FileDescriptor</a> (int fd)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Creates a new <a class="el" href="classPassenger_1_1FileDescriptor.html" title="Wrapper class around a file descriptor integer, for RAII behavior.">FileDescriptor</a> instance with the given fd as a handle.  <a href="#62c05b925cb1cf964169cef7635650ee"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1FileDescriptor.html#d7c1a99531181878cbab74a7400c5432">close</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Close the underlying file descriptor.  <a href="#d7c1a99531181878cbab74a7400c5432"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1FileDescriptor.html#c335c2a97f3a6c8e3920f573b0d04081">operator int</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Overloads the integer cast operator so that it will return the underlying file descriptor handle as an integer.  <a href="#c335c2a97f3a6c8e3920f573b0d04081"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Wrapper class around a file descriptor integer, for RAII behavior. 
<p>
A <a class="el" href="classPassenger_1_1FileDescriptor.html" title="Wrapper class around a file descriptor integer, for RAII behavior.">FileDescriptor</a> object behaves just like an int, so that you can pass it to system calls such as read(). It performs reference counting. When the last copy of a <a class="el" href="classPassenger_1_1FileDescriptor.html" title="Wrapper class around a file descriptor integer, for RAII behavior.">FileDescriptor</a> has been destroyed, the underlying file descriptor will be automatically closed. In this case, any <a class="el" href="classPassenger_1_1FileDescriptor.html#d7c1a99531181878cbab74a7400c5432" title="Close the underlying file descriptor.">close()</a> system call errors are silently ignored. If you are interested in whether the <a class="el" href="classPassenger_1_1FileDescriptor.html#d7c1a99531181878cbab74a7400c5432" title="Close the underlying file descriptor.">close()</a> system call succeeded, then you should call <a class="el" href="classPassenger_1_1FileDescriptor.html#d7c1a99531181878cbab74a7400c5432" title="Close the underlying file descriptor.">FileDescriptor::close()</a>.<p>
This class is *not* thread-safe. It is safe to call system calls on the underlying file descriptor from multiple threads, but it's not safe to call <a class="el" href="classPassenger_1_1FileDescriptor.html#d7c1a99531181878cbab74a7400c5432" title="Close the underlying file descriptor.">FileDescriptor::close()</a> from multiple threads if all those <a class="el" href="classPassenger_1_1FileDescriptor.html" title="Wrapper class around a file descriptor integer, for RAII behavior.">FileDescriptor</a> objects point to the same underlying file descriptor. <hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="05d83ad9cc77c493a3ce4f2b51d44559"></a><!-- doxytag: member="Passenger::FileDescriptor::FileDescriptor" ref="05d83ad9cc77c493a3ce4f2b51d44559" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Passenger::FileDescriptor::FileDescriptor           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Creates a new empty <a class="el" href="classPassenger_1_1FileDescriptor.html" title="Wrapper class around a file descriptor integer, for RAII behavior.">FileDescriptor</a> instance that has no underlying file descriptor. 
<p>
<dl class="post" compact><dt><b>Postcondition:</b></dt><dd>*this == -1 </dd></dl>

</div>
</div><p>
<a class="anchor" name="62c05b925cb1cf964169cef7635650ee"></a><!-- doxytag: member="Passenger::FileDescriptor::FileDescriptor" ref="62c05b925cb1cf964169cef7635650ee" args="(int fd)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Passenger::FileDescriptor::FileDescriptor           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>fd</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Creates a new <a class="el" href="classPassenger_1_1FileDescriptor.html" title="Wrapper class around a file descriptor integer, for RAII behavior.">FileDescriptor</a> instance with the given fd as a handle. 
<p>
<dl class="post" compact><dt><b>Postcondition:</b></dt><dd>*this == fd </dd></dl>

</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="d7c1a99531181878cbab74a7400c5432"></a><!-- doxytag: member="Passenger::FileDescriptor::close" ref="d7c1a99531181878cbab74a7400c5432" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Passenger::FileDescriptor::close           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Close the underlying file descriptor. 
<p>
If it was already closed, then nothing will happen.<p>
<dl compact><dt><b>Exceptions:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a></em>&nbsp;</td><td>Something went wrong while closing the file descriptor. </td></tr>
  </table>
</dl>
<dl class="post" compact><dt><b>Postcondition:</b></dt><dd>*this == -1 </dd></dl>

</div>
</div><p>
<a class="anchor" name="c335c2a97f3a6c8e3920f573b0d04081"></a><!-- doxytag: member="Passenger::FileDescriptor::operator int" ref="c335c2a97f3a6c8e3920f573b0d04081" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Passenger::FileDescriptor::operator int           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td> const<code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Overloads the integer cast operator so that it will return the underlying file descriptor handle as an integer. 
<p>
Returns -1 if <a class="el" href="classPassenger_1_1FileDescriptor.html#d7c1a99531181878cbab74a7400c5432" title="Close the underlying file descriptor.">FileDescriptor::close()</a> was called. 
</div>
</div><p>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="FileDescriptor_8h-source.html">FileDescriptor.h</a></ul>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Feb 21 12:22:48 2010 for Passenger by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
</body>
</html>