blob: 4826730672d67095f3ac78e6fd2eb7911fde8fbe [file] [log] [blame]
// Copyright 2020 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/// Provides safe implementations of common low level functions that assume a Linux environment.
use libc::{syscall, SYS_gettid};
pub type Pid = libc::pid_t;
pub fn getpid() -> Pid {
// Calling getpid() is always safe.
unsafe { libc::getpid() }
pub fn gettid() -> Pid {
// Calling the gettid() sycall is always safe.
unsafe { syscall(SYS_gettid) as Pid }