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 #ifdef __Fuchsia__
6 
7 #include <string.h>
8 
9 #include <lib/fidl/epitaph.h>
10 #include <zircon/fidl.h>
11 #include <zircon/syscalls.h>
12 
fidl_epitaph_write(zx_handle_t channel,zx_status_t error)13 zx_status_t fidl_epitaph_write(zx_handle_t channel, zx_status_t error) {
14     fidl_epitaph_t epitaph;
15     memset(&epitaph, 0, sizeof(epitaph));
16     epitaph.hdr.ordinal = FIDL_EPITAPH_ORDINAL;
17     epitaph.hdr.reserved0 = error;
18 
19     return zx_channel_write(channel, 0, &epitaph, sizeof(epitaph), NULL, 0);
20 }
21 
22 #endif // __Fuchsia__
23