blob: 0bcd4b6c6955663a83a6727be2bfeab237d81ebd [file] [log] [blame]
[email protected]5fe733de2009-02-11 18:59:201// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef BASE_FILE_DESCRIPTOR_POSIX_H_
6#define BASE_FILE_DESCRIPTOR_POSIX_H_
7
8namespace base {
9
10// -----------------------------------------------------------------------------
11// We introduct a special structure for file descriptors in order that we are
12// able to use template specialisation to special-case their handling.
[email protected]2749885f2009-03-05 21:40:1113//
14// WARNING: (Chromium only) There are subtleties to consider if serialising
15// these objects over IPC. See comments in chrome/common/ipc_message_utils.h
16// above the template specialisation for this structure.
[email protected]5fe733de2009-02-11 18:59:2017// -----------------------------------------------------------------------------
18struct FileDescriptor {
19 FileDescriptor()
20 : fd(-1),
21 auto_close(false) { }
22
23 FileDescriptor(int ifd, bool iauto_close)
24 : fd(ifd),
25 auto_close(iauto_close) { }
26
27 int fd;
28 // If true, this file descriptor should be closed after it has been used. For
29 // example an IPC system might interpret this flag as indicating that the
30 // file descriptor it has been given should be closed after use.
31 bool auto_close;
32};
33
34} // namespace base
35
36#endif // BASE_FILE_DESCRIPTOR_POSIX_H_