gnunet_child_management_lib.h (2527B)
1 /* 2 This file is part of GNUnet 3 Copyright (C) 2021 GNUnet e.V. 4 5 GNUnet is free software: you can redistribute it and/or modify it 6 under the terms of the GNU Affero General Public License as published 7 by the Free Software Foundation, either version 3 of the License, 8 or (at your option) any later version. 9 10 GNUnet is distributed in the hope that it will be useful, but 11 WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Affero General Public License for more details. 14 15 You should have received a copy of the GNU Affero General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 18 SPDX-License-Identifier: AGPL3.0-or-later 19 */ 20 21 #if ! defined (__GNUNET_UTIL_LIB_H_INSIDE__) 22 #error "Only <gnunet_util_lib.h> can be included directly." 23 #endif 24 25 /** 26 * @addtogroup libgnunetutil 27 * Multi-function utilities library for GNUnet programs 28 * @{ 29 * 30 * @file include/gnunet_child_management_lib.h 31 * @brief GNUnet child management api 32 * @author Christian Grothoff 33 * @author Dominik Meister 34 * @author Dennis Neufeld 35 * @author t3sserakt 36 */ 37 #ifndef GNUNET_CHILD_MANAGEMENT_LIB_H 38 #define GNUNET_CHILD_MANAGEMENT_LIB_H 39 40 /** 41 * Handle for the child management 42 */ 43 struct GNUNET_ChildWaitHandle; 44 45 /** 46 * Defines a GNUNET_ChildCompletedCallback which is sent back 47 * upon death or completion of a child process. 48 * 49 * @param cls handle for the callback 50 * @param type type of the process 51 * @param exit_code status code of the process 52 */ 53 typedef void 54 (*GNUNET_ChildCompletedCallback)(void *cls, 55 enum GNUNET_OS_ProcessStatusType type, 56 long unsigned int exit_code); 57 58 /** 59 * Starts the handling of the child processes. 60 * Function checks the status of the child process and sends back a 61 * GNUNET_ChildCompletedCallback upon completion/death of the child. 62 * 63 * @param proc child process which is monitored 64 * @param cb reference to the callback which is called after completion 65 * @param cb_cls closure for the callback 66 * @return GNUNET_ChildWaitHandle is returned 67 */ 68 struct GNUNET_ChildWaitHandle * 69 GNUNET_wait_child (struct GNUNET_OS_Process *proc, 70 GNUNET_ChildCompletedCallback cb, 71 void *cb_cls); 72 73 /** 74 * Stop waiting on this child. 75 */ 76 void 77 GNUNET_wait_child_cancel (struct GNUNET_ChildWaitHandle *cwh); 78 79 #endif 80 81 /** @} */ /* end of group addition */