1// Copyright 2017 The Fuchsia 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 5#include <lib/zx/fifo.h> 6 7#include <zircon/syscalls.h> 8 9namespace zx { 10 11zx_status_t fifo::create(uint32_t elem_count, uint32_t elem_size, 12 uint32_t options, fifo* out0, fifo* out1) { 13 // Ensure aliasing of both out parameters to the same container 14 // has a well-defined result, and does not leak. 15 fifo h0; 16 fifo h1; 17 zx_status_t status = zx_fifo_create( 18 elem_count, elem_size, options, h0.reset_and_get_address(), 19 h1.reset_and_get_address()); 20 out0->reset(h0.release()); 21 out1->reset(h1.release()); 22 return status; 23} 24 25} // namespace zx 26