koid.h 850 B

123456789101112131415161718192021222324252627
  1. // Copyright 2021 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. #ifndef BASE_FUCHSIA_KOID_H_
  5. #define BASE_FUCHSIA_KOID_H_
  6. #include <lib/zx/object.h>
  7. #include <zircon/types.h>
  8. #include "base/base_export.h"
  9. #include "third_party/abseil-cpp/absl/types/optional.h"
  10. namespace base {
  11. // Returns the Kernel Object IDentifier for the object referred to by |handle|,
  12. // if it is valid.
  13. BASE_EXPORT absl::optional<zx_koid_t> GetKoid(const zx::object_base& handle);
  14. // Returns the Kernel Object IDentifier for the peer of the paired object (i.e.
  15. // a channel, socket, eventpair, etc) referred to by |handle|.
  16. BASE_EXPORT absl::optional<zx_koid_t> GetRelatedKoid(
  17. const zx::object_base& handle);
  18. } // namespace base
  19. #endif // BASE_FUCHSIA_KOID_H_