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