1// Copyright 2016 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 <runtime/message.h>
6
7#include <zircon/syscalls.h>
8#include <stddef.h>
9
10zx_status_t zxr_message_size(zx_handle_t msg_pipe,
11                             uint32_t* nbytes, uint32_t* nhandles) {
12    zx_status_t status = _zx_channel_read(
13        msg_pipe, 0, NULL, NULL, 0, 0, nbytes, nhandles);
14    if (status == ZX_ERR_BUFFER_TOO_SMALL)
15        status = ZX_OK;
16    return status;
17}
18