ipc/chromium/src/base/file_descriptor_posix.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ipc/chromium/src/base/file_descriptor_posix.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,36 @@
     1.4 +// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
     1.5 +// Use of this source code is governed by a BSD-style license that can be
     1.6 +// found in the LICENSE file.
     1.7 +
     1.8 +#ifndef BASE_FILE_DESCRIPTOR_POSIX_H_
     1.9 +#define BASE_FILE_DESCRIPTOR_POSIX_H_
    1.10 +
    1.11 +namespace base {
    1.12 +
    1.13 +// -----------------------------------------------------------------------------
    1.14 +// We introduct a special structure for file descriptors in order that we are
    1.15 +// able to use template specialisation to special-case their handling.
    1.16 +//
    1.17 +// WARNING: (Chromium only) There are subtleties to consider if serialising
    1.18 +// these objects over IPC. See comments in chrome/common/ipc_message_utils.h
    1.19 +// above the template specialisation for this structure.
    1.20 +// -----------------------------------------------------------------------------
    1.21 +struct FileDescriptor {
    1.22 +  FileDescriptor()
    1.23 +      : fd(-1),
    1.24 +        auto_close(false) { }
    1.25 +
    1.26 +  FileDescriptor(int ifd, bool iauto_close)
    1.27 +      : fd(ifd),
    1.28 +        auto_close(iauto_close) { }
    1.29 +
    1.30 +  int fd;
    1.31 +  // If true, this file descriptor should be closed after it has been used. For
    1.32 +  // example an IPC system might interpret this flag as indicating that the
    1.33 +  // file descriptor it has been given should be closed after use.
    1.34 +  bool auto_close;
    1.35 +};
    1.36 +
    1.37 +}  // namespace base
    1.38 +
    1.39 +#endif  // BASE_FILE_DESCRIPTOR_POSIX_H_

mercurial