blob: 3a55719ff223492c55487d99e377a9a64886ca2e [file] [log] [blame]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "utils.h"
#include <zircon/process.h>
#include <zircon/syscalls.h>
namespace trace {
namespace internal {
zx_koid_t GetPid() {
auto self = zx_process_self();
zx_info_handle_basic_t info;
zx_status_t status =
zx_object_get_info(self, ZX_INFO_HANDLE_BASIC, &info, sizeof(info), nullptr, nullptr);
if (status != ZX_OK) {
return ZX_KOID_INVALID;
}
return info.koid;
}
} // namespace internal
} // namespace trace