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