blob: d94f7cc5463401ede02bb6fb36177ce1f336c406 [file] [log] [blame]
// Copyright 2017 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.
#pragma once
#include <stdint.h>
#include <lib/fdio/io.h>
#include "private.h"
// This defines operations shared by pipe(2) and socketpair(2) primitives.
typedef struct zx_pipe {
fdio_t io;
zx_handle_t h;
} zx_pipe_t;
ssize_t zx_pipe_read(fdio_t* io, void* data, size_t len);
ssize_t zx_pipe_write(fdio_t* io, const void* data, size_t len);
zx_status_t zx_pipe_get_attr(fdio_t* io, vnattr_t* attr);
zx_status_t zx_pipe_close(fdio_t* io);
zx_status_t zx_pipe_clone(fdio_t* io, zx_handle_t* handles, uint32_t* types);
void zx_pipe_wait_begin(fdio_t* io, uint32_t events, zx_handle_t* handle, zx_signals_t* _signals);
void zx_pipe_wait_end(fdio_t* io, zx_signals_t signals, uint32_t* _events);
zx_status_t zx_pipe_unwrap(fdio_t* io, zx_handle_t* handles, uint32_t* types);
ssize_t zx_pipe_posix_ioctl(fdio_t* io, int req, va_list va);
ssize_t zx_pipe_read_internal(zx_handle_t h, void* data, size_t len, int nonblock);
ssize_t zx_pipe_write_internal(zx_handle_t h, const void* data, size_t len, int nonblock);