2 * include/command.h - type representing a command.
\r
4 * Copyright 2008,2009 Martin Quinson, Malek Cherier All right reserved.
\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
10 * This file contains all the declarations of the functions related with
\r
11 * the tesh command type.
\r
24 /*! \brief command_new - create a new fstream.
\r
26 * \param unit The unit contained the command.
\r
27 * \param context The context of the excecution of the command.
\r
28 * \param mutex A mutex to synchronize the access of the properties of its unit.
\r
30 * \return If successful the function returns the newly created
\r
31 * command. Otherwise the function returns NULL and sets the
\r
32 * global variable errno with the appropiate error code.
\r
34 * If the parameter directory is NULL, the parameter name
\r
38 * [EINVAL] if one of the parameters is invalid.
\r
39 * [ENOMEM] if the system has not enough space to allocate
\r
43 command_new(unit_t unit, context_t context, xbt_os_mutex_t mutex);
\r
45 /*! \brief command_free - destroy a command object.
\r
47 * \param ptr A pointer to the command object to destroy.
\r
49 * \return If successful the function returns the 0. Otherwise
\r
50 * the function returns -1 and sets the global variable
\r
51 * errno with the appropiate error code.
\r
54 * [EINVAL] if the command object pointed to by the ptr parameter is invalid.
\r
58 command_free(command_t* ptr);
\r
60 /*! \brief command_run - run a command object.
\r
62 * \param command The command to run.
\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
69 * [EINVAL] if the parameter is invalid.
\r
72 * The type of running (asynchonus or no) depend of the
\r
73 * context of the command.
\r
77 command_run(command_t command);
\r
79 /*! \brief command_exec - execute a command object.
\r
81 * \param command The command object to run.
\r
82 * \param command_line The command line of the process to create.
\r
85 command_exec(command_t command, const char* command_line);
\r
87 /*! \brief command_wait - wait for the end of a command.
\r
89 * \param command The command object to wait for.
\r
92 command_wait(command_t command);
\r
94 /*! \brief command_interrupt - wait for the end of a command.
\r
96 * \param command The command object to interrupt.
\r
99 command_interrupt(command_t command);
\r
101 /*! \brief command_summarize - print the summary of the execution of a command.
\r
103 * \param command The command object to display the summary.
\r
106 * The summary of the command is displayed only if the user
\r
107 * specifies both summary and detail-summary options on the
\r
108 * tesh command line.
\r
111 command_summarize(command_t command);
\r
113 /*! \brief command_handle_failure - handle a failure caused by a command.
\r
115 * \param command The command to handle the failure.
\r
118 * The behavior of the command failure handling depends
\r
119 * of the specification of the options keep-going and
\r
120 * keep-going-unit. If the user has specified the option
\r
121 * keep-going on the command line of tesh, only the unit
\r
122 * containing the failed command is interrupted and all
\r
123 * other units continue.
\r
126 command_handle_failure(command_t command, cs_reason_t reason);
\r
128 void command_kill(command_t command);
\r
131 command_check(command_t command);
\r
137 #endif /* !_COMMAND_H */
\r