michael@0: // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: michael@0: #ifndef BASE_FILE_DESCRIPTOR_POSIX_H_ michael@0: #define BASE_FILE_DESCRIPTOR_POSIX_H_ michael@0: michael@0: namespace base { michael@0: michael@0: // ----------------------------------------------------------------------------- michael@0: // We introduct a special structure for file descriptors in order that we are michael@0: // able to use template specialisation to special-case their handling. michael@0: // michael@0: // WARNING: (Chromium only) There are subtleties to consider if serialising michael@0: // these objects over IPC. See comments in chrome/common/ipc_message_utils.h michael@0: // above the template specialisation for this structure. michael@0: // ----------------------------------------------------------------------------- michael@0: struct FileDescriptor { michael@0: FileDescriptor() michael@0: : fd(-1), michael@0: auto_close(false) { } michael@0: michael@0: FileDescriptor(int ifd, bool iauto_close) michael@0: : fd(ifd), michael@0: auto_close(iauto_close) { } michael@0: michael@0: int fd; michael@0: // If true, this file descriptor should be closed after it has been used. For michael@0: // example an IPC system might interpret this flag as indicating that the michael@0: // file descriptor it has been given should be closed after use. michael@0: bool auto_close; michael@0: }; michael@0: michael@0: } // namespace base michael@0: michael@0: #endif // BASE_FILE_DESCRIPTOR_POSIX_H_