paul@483 | 1 | /* |
paul@483 | 2 | * Process-related convenience functions and types. |
paul@483 | 3 | * |
paul@598 | 4 | * Copyright (C) 2023, 2024 Paul Boddie <paul@boddie.org.uk> |
paul@483 | 5 | * |
paul@483 | 6 | * This program is free software; you can redistribute it and/or |
paul@483 | 7 | * modify it under the terms of the GNU General Public License as |
paul@483 | 8 | * published by the Free Software Foundation; either version 2 of |
paul@483 | 9 | * the License, or (at your option) any later version. |
paul@483 | 10 | * |
paul@483 | 11 | * This program is distributed in the hope that it will be useful, |
paul@483 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@483 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@483 | 14 | * GNU General Public License for more details. |
paul@483 | 15 | * |
paul@483 | 16 | * You should have received a copy of the GNU General Public License |
paul@483 | 17 | * along with this program; if not, write to the Free Software |
paul@483 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@483 | 19 | * Boston, MA 02110-1301, USA |
paul@483 | 20 | */ |
paul@483 | 21 | |
paul@483 | 22 | #pragma once |
paul@483 | 23 | |
paul@483 | 24 | #include <l4/sys/types.h> |
paul@483 | 25 | |
paul@483 | 26 | #include <fsclient/file.h> |
paul@483 | 27 | #include <systypes/base.h> |
paul@483 | 28 | |
paul@483 | 29 | |
paul@483 | 30 | |
paul@483 | 31 | EXTERN_C_BEGIN |
paul@483 | 32 | |
paul@483 | 33 | /* File access abstraction compatible with notifiable_base_t. */ |
paul@483 | 34 | |
paul@483 | 35 | typedef struct |
paul@483 | 36 | { |
paul@483 | 37 | /* File object reference. */ |
paul@483 | 38 | |
paul@483 | 39 | l4_cap_idx_t ref; |
paul@483 | 40 | |
paul@483 | 41 | /* Notification structure. */ |
paul@483 | 42 | |
paul@483 | 43 | notifiable_t notifiable; |
paul@483 | 44 | |
paul@483 | 45 | } process_t; |
paul@483 | 46 | |
paul@483 | 47 | |
paul@483 | 48 | |
paul@483 | 49 | /* Principal functions. */ |
paul@483 | 50 | |
paul@598 | 51 | process_t *process_new(void); |
paul@492 | 52 | void process_close(process_t *process); |
paul@559 | 53 | long process_error(process_t *process); |
paul@578 | 54 | void process_free(process_t *process); |
paul@483 | 55 | void process_init(process_t *process); |
paul@584 | 56 | long process_spawn(int argc, const char *argv[], file_t *writer, process_t **process); |
paul@584 | 57 | long process_start(process_t *process, int argc, const char *argv[], file_t *writer); |
paul@578 | 58 | long process_wait(process_t *process, notify_flags_t *flags, notify_values_t *values); |
paul@483 | 59 | |
paul@483 | 60 | /* Notification support. */ |
paul@483 | 61 | |
paul@483 | 62 | notifiable_t *process_notifiable(process_t *process); |
paul@483 | 63 | notify_flags_t process_notifications(process_t *process); |
paul@483 | 64 | notify_values_t process_notification_values(process_t *process); |
paul@575 | 65 | |
paul@575 | 66 | long process_notify_wait_process(process_t *process, notifier_t *notifier); |
paul@575 | 67 | long process_notify_wait_processes(process_t **process, notifier_t *notifier); |
paul@483 | 68 | |
paul@483 | 69 | EXTERN_C_END |
paul@483 | 70 | |
paul@483 | 71 | // vim: tabstop=2 expandtab shiftwidth=2 |