1// Copyright 2017 The Fuchsia Authors 2// 3// Use of this source code is governed by a MIT-style 4// license that can be found in the LICENSE file or at 5// https://opensource.org/licenses/MIT 6 7#include <inttypes.h> 8 9#include <trace.h> 10 11#include <object/process_dispatcher.h> 12#include <zircon/types.h> 13 14#include "priv.h" 15 16#define LOCAL_TRACE 0 17 18zx_status_t sys_futex_wait(user_in_ptr<const zx_futex_t> value_ptr, int32_t current_value, zx_time_t deadline) { 19 LTRACEF("futex %p current %d\n", value_ptr.get(), current_value); 20 21 return ProcessDispatcher::GetCurrent()->futex_context()->FutexWait( 22 value_ptr, current_value, deadline); 23} 24 25zx_status_t sys_futex_wake(user_in_ptr<const zx_futex_t> value_ptr, uint32_t count) { 26 LTRACEF("futex %p count %" PRIu32 "\n", value_ptr.get(), count); 27 28 return ProcessDispatcher::GetCurrent()->futex_context()->FutexWake( 29 value_ptr, count); 30} 31 32zx_status_t sys_futex_requeue(user_in_ptr<const zx_futex_t> wake_ptr, uint32_t wake_count, int32_t current_value, 33 user_in_ptr<const zx_futex_t> requeue_ptr, uint32_t requeue_count) { 34 LTRACEF("futex %p wake_count %" PRIu32 "current_value %d " 35 "requeue_futex %p requeue_count %" PRIu32 "\n", 36 wake_ptr.get(), wake_count, current_value, requeue_ptr.get(), requeue_count); 37 38 return ProcessDispatcher::GetCurrent()->futex_context()->FutexRequeue( 39 wake_ptr, wake_count, current_value, 40 requeue_ptr, requeue_count); 41} 42