blob: 6989589aa76f9f9febde477b8803d7e642b29d7f [file] [log] [blame]
Doug Horn1427b6a2018-12-11 13:19:16 -08001// 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 <lib/zx/job.h>
6
7#include <lib/zx/process.h>
8#include <zircon/syscalls.h>
9
10namespace zx {
11
12zx_status_t job::create(const job& parent, uint32_t flags, job* result) {
13 // Allow for aliasing of the same container to |result| and |parent|.
14 job h;
15 zx_status_t status =
16 zx_job_create(parent.get(), flags, h.reset_and_get_address());
17 result->reset(h.release());
18 return status;
19}
20
21zx_status_t job::get_child(uint64_t koid, zx_rights_t rights,
22 process* result) const {
23 // Assume |result| and |this| are distinct containers, due to strict
24 // aliasing.
25 return zx_object_get_child(
26 value_, koid, rights, result->reset_and_get_address());
27}
28
29} // namespace zx