1// Copyright 2018 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 <string.h>
6#include <zircon/fidl.h>
7#include <zircon/syscalls.h>
8
9zx_status_t fidl_epitaph_write(zx_handle_t channel, zx_status_t sys_error,
10                               int32_t app_error) {
11    fidl_epitaph_t epitaph;
12    memset(&epitaph, 0, sizeof(epitaph));
13    epitaph.hdr.ordinal = FIDL_EPITAPH_ORDINAL;
14    epitaph.sys_error = sys_error;
15    epitaph.app_error = app_error;
16
17    return zx_channel_write(channel, 0, &epitaph, sizeof(epitaph), NULL, 0);
18}
19