Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
convert svn logs into ChangeLog (up to r7858 for now)
[simgrid.git] / tools / tesh2 / include / command.h
1 /*\r
2  * include/command.h - type representing a command.\r
3  *\r
4  * Copyright 2008,2009 Martin Quinson, Malek Cherier All right reserved. \r
5  *\r
6  * This program is free software; you can redistribute it and/or modify it \r
7  * under the terms of the license (GNU LGPL) which comes with this package.\r
8  *\r
9  * Purpose:\r
10  *              This file contains all the declarations of the functions related with\r
11  *              the tesh command type.\r
12  *\r
13  */  \r
14     \r
15 #ifndef __COMMAND_H\r
16 #define __COMMAND_H\r
17     \r
18 #include <com.h>\r
19     \r
20 #ifdef __cplusplus\r
21 extern "C" {
22   \r
23 #endif  /* \r */
24   \r
25 /*! \brief command_new - create a new fstream.\r
26  *\r
27  * \param unit                  The unit contained the command.\r
28  * \param context               The context of the excecution of the command.\r
29  * \param mutex                 A mutex to synchronize the access of the properties of its unit.\r
30  *\r
31  * \return                              If successful the function returns the newly created\r
32  *                                              command. Otherwise the function returns NULL and sets the\r
33  *                                              global variable errno with the appropiate error code.\r
34  * remarks:\r
35  *                                              If the parameter directory is NULL, the parameter name\r
36  *                                              must be `stdin`.\r
37  *\r
38  * errors :\r
39  *                                              [EINVAL] if one of the parameters is invalid.\r
40  *                                              [ENOMEM] if the system has not enough space to allocate\r
41  *                                                               the command.\r
42  */ \r
43   command_t \r
44       command_new(unit_t unit, context_t context, xbt_os_mutex_t mutex);
45   \r \r
46 /*! \brief command_free - destroy a command object.\r
47  *\r
48  * \param ptr                   A pointer to the command object to destroy.\r
49  *\r
50  * \return                              If successful the function returns the 0. Otherwise \r
51  *                                              the function returns -1 and sets the global variable \r
52  *                                              errno with the appropiate error code.\r
53  *\r
54  * errors :\r
55  *                                              [EINVAL] if the command object pointed to by the ptr parameter is invalid.\r
56  *                                      \r
57  */ \r
58   int \r command_free(command_t * ptr);
59   \r \r
60 /*! \brief command_run - run a command object.\r
61  *\r
62  * \param command               The command to run.\r
63  *\r
64  * \return                              If successful the function returns the 0. Otherwise \r
65  *                                              the function returns -1 and sets the global variable \r
66  *                                              errno with the appropiate error code.\r
67  *\r
68  * errors :\r
69  *                                              [EINVAL] if the parameter is invalid.\r
70  *\r
71  * remarks :\r
72  *                                              The type of running (asynchonus or no) depend of the\r
73  *                                              context of the command.\r
74  *                                      \r
75  */ \r
76   int \r command_run(command_t command);
77   \r \r
78 /*! \brief command_exec - execute a command object.\r
79  *\r
80  * \param command               The command object to run.\r
81  * \param command_line  The command line of the process to create.                              \r
82  */ \r
83   void \r command_exec(command_t command, const char *command_line);
84   \r\r
85 /*! \brief command_wait - wait for the end of a command.\r
86  *\r
87  * \param command               The command object to wait for.         \r
88  */ \r
89   void \r command_wait(command_t command);
90   \r \r
91 /*! \brief command_interrupt - wait for the end of a command.\r
92  *\r
93  * \param command               The command object to interrupt.                \r
94  */ \r
95   void \r command_interrupt(command_t command);
96   \r \r
97 /*! \brief command_summarize - print the summary of the execution of a command.\r
98  *\r
99  * \param command               The command object to display the summary.      \r
100  *\r
101  * remark:\r
102  *                                              The summary of the command is displayed only if the user\r
103  *                                              specifies both summary and detail-summary options on the\r
104  *                                              tesh command line.\r
105  */ \r
106   void \r command_summarize(command_t command);
107   \r \r
108 /*! \brief command_handle_failure - handle a failure caused by a command.\r
109  *\r
110  * \param command               The command to handle the failure.      \r
111  *\r
112  * remark:\r
113  *                                              The behavior of the command failure handling depends\r
114  *                                              of the specification of the options keep-going and\r
115  *                                              keep-going-unit. If the user has specified the option\r
116  *                                              keep-going on the command line of tesh, only the unit \r
117  *                                              containing the failed command is interrupted and all \r
118  *                                              other units continue.\r
119  */ \r
120   void \r command_handle_failure(command_t command, cs_reason_t reason);
121   \r \r void command_kill(command_t command);
122   \r \r void \r command_check(command_t command);
123   \r \r
124 #ifdef __cplusplus\r
125\r
126 #endif  /* \r */
127 \r
128 #endif  /* !_COMMAND_H */\r