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 <lib/zx/job.h>
6 
7 #include <lib/zx/process.h>
8 #include <zircon/syscalls.h>
9 
10 namespace zx {
11 
create(const job & parent,uint32_t flags,job * result)12 zx_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 
get_child(uint64_t koid,zx_rights_t rights,process * result) const21 zx_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
30