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
25 /*! \brief command_new - create a new fstream.
\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
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
35 * If the parameter directory is NULL, the parameter name
\r
39 * [EINVAL] if one of the parameters is invalid.
\r
40 * [ENOMEM] if the system has not enough space to allocate
\r
44 command_new(unit_t unit, context_t context, xbt_os_mutex_t mutex);
46 /*! \brief command_free - destroy a command object.
\r
48 * \param ptr A pointer to the command object to destroy.
\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
55 * [EINVAL] if the command object pointed to by the ptr parameter is invalid.
\r
58 int
\r command_free(command_t * ptr);
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
76 int
\r command_run(command_t command);
78 /*! \brief command_exec - execute a command object.
\r
80 * \param command The command object to run.
\r
81 * \param command_line The command line of the process to create.
\r
83 void
\r command_exec(command_t command, const char *command_line);
85 /*! \brief command_wait - wait for the end of a command.
\r
87 * \param command The command object to wait for.
\r
89 void
\r command_wait(command_t command);
91 /*! \brief command_interrupt - wait for the end of a command.
\r
93 * \param command The command object to interrupt.
\r
95 void
\r command_interrupt(command_t command);
97 /*! \brief command_summarize - print the summary of the execution of a command.
\r
99 * \param command The command object to display the summary.
\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
106 void
\r command_summarize(command_t command);
108 /*! \brief command_handle_failure - handle a failure caused by a command.
\r
110 * \param command The command to handle the failure.
\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
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);
128 #endif /* !_COMMAND_H */
\r