Doug Horn | 1427b6a | 2018-12-11 13:19:16 -0800 | [diff] [blame] | 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 | |
| 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 | |
| 21 | 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 |