paul@483 | 1 | /* |
paul@483 | 2 | * Process-related convenience functions and types. |
paul@483 | 3 | * |
paul@483 | 4 | * Copyright (C) 2023 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 | /* C compatibility types (defined in the implementation). */ |
paul@483 | 32 | |
paul@483 | 33 | struct process_notifier; |
paul@483 | 34 | |
paul@483 | 35 | typedef struct process_notifier process_notifier_t; |
paul@483 | 36 | |
paul@483 | 37 | |
paul@483 | 38 | |
paul@483 | 39 | EXTERN_C_BEGIN |
paul@483 | 40 | |
paul@483 | 41 | /* File access abstraction compatible with notifiable_base_t. */ |
paul@483 | 42 | |
paul@483 | 43 | typedef struct |
paul@483 | 44 | { |
paul@483 | 45 | /* File object reference. */ |
paul@483 | 46 | |
paul@483 | 47 | l4_cap_idx_t ref; |
paul@483 | 48 | |
paul@483 | 49 | /* Notification structure. */ |
paul@483 | 50 | |
paul@483 | 51 | notifiable_t notifiable; |
paul@483 | 52 | |
paul@483 | 53 | } process_t; |
paul@483 | 54 | |
paul@483 | 55 | |
paul@483 | 56 | |
paul@483 | 57 | /* Principal functions. */ |
paul@483 | 58 | |
paul@483 | 59 | process_t *process_new(); |
paul@492 | 60 | void process_close(process_t *process); |
paul@483 | 61 | void process_init(process_t *process); |
paul@491 | 62 | long process_start(process_t *process, int argc, char *argv[]); |
paul@483 | 63 | |
paul@483 | 64 | /* Notification support. */ |
paul@483 | 65 | |
paul@483 | 66 | notifiable_t *process_notifiable(process_t *process); |
paul@483 | 67 | notify_flags_t process_notifications(process_t *process); |
paul@483 | 68 | notify_values_t process_notification_values(process_t *process); |
paul@483 | 69 | void process_notify_close(process_notifier_t *notifier); |
paul@483 | 70 | process_notifier_t *process_notify_local(); |
paul@483 | 71 | process_notifier_t *process_notify_task(); |
paul@484 | 72 | long process_notify_subscribe(process_t *process, notify_flags_t flags, process_notifier_t *notifier); |
paul@484 | 73 | long process_notify_unsubscribe(process_t *process, process_notifier_t *notifier); |
paul@483 | 74 | long process_notify_wait_process(process_t *process, process_notifier_t *notifier); |
paul@483 | 75 | long process_notify_wait_processes(process_t **process, process_notifier_t *notifier); |
paul@483 | 76 | |
paul@483 | 77 | EXTERN_C_END |
paul@483 | 78 | |
paul@483 | 79 | // vim: tabstop=2 expandtab shiftwidth=2 |