OpenMPI  0.1.1
notifier_command.h
1 /* -*- C -*-
2  *
3  * Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
4  * University Research and Technology
5  * Corporation. All rights reserved.
6  * Copyright (c) 2004-2006 The University of Tennessee and The University
7  * of Tennessee Research Foundation. All rights
8  * reserved.
9  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
10  * University of Stuttgart. All rights reserved.
11  * Copyright (c) 2004-2005 The Regents of the University of California.
12  * All rights reserved.
13  * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
14  * $COPYRIGHT$
15  *
16  * Additional copyrights may follow
17  *
18  * $HEADER$
19  *
20  */
21 #ifndef NOTIFIER_COMMAND_H
22 #define NOTIFIER_COMMAND_H
23 
24 #include "orte_config.h"
25 
26 #ifdef HAVE_UNISTD_H
27 #include <unistd.h>
28 #endif
29 
31 
32 BEGIN_C_DECLS
33 
34 typedef struct {
36 
37  /* Command to execute */
38  char *cmd;
39 
40  /* Timeout of the command (seconds) */
41  int timeout;
42 
43  /* Priority of this component */
44  int priority;
45 
46  /* Child PID */
47  pid_t child_pid;
48 
49  /* Pipe to the child */
50  int to_child[2];
51 
52  /* Pipe to the parent */
53  int to_parent[2];
54 
55  /* Do we want data sent to child via stdin? */
56  bool pass_via_stdin;
58 
59 
60 /*
61  * Notifier interfaces
62  */
63 ORTE_MODULE_DECLSPEC extern orte_notifier_command_component_t
64  mca_notifier_command_component;
65 extern orte_notifier_base_module_t orte_notifier_command_module;
66 
67 /*
68  * Pipe commands
69  */
70 typedef enum {
71  /* Fork/exec a command */
72  CMD_EXEC,
73 
74  /* Time to quit */
75  CMD_TIME_TO_QUIT,
76 
77  /* Sentinel value */
78  CMD_MAX
79 } orte_notifier_command_pipe_cmd_t;
80 
81 
82 /**
83  * Simple blocking function to read a specific number of bytes from an
84  * fd.
85  */
86 int orte_notifier_command_read_fd(int fd, int len, void *buffer);
87 
88 /**
89  * Simple blocking function to write a specific number of bytes to an
90  * fd.
91  */
92 int orte_notifier_command_write_fd(int fd, int len, void *buffer);
93 
94 /**
95  * Main entry point for child
96  */
97 void orte_notifier_command_child_main(void) __opal_attribute_noreturn__;
98 
99 /**
100  * Function to split a spint into argv, honoring quoting, etc. (and do
101  * some error checking of the string)
102  */
103 int orte_notifier_command_split(const char *cmd, char ***argv);
104 
105 END_C_DECLS
106 
107 #endif
Definition: notifier_command.h:34
Definition: notifier.h:98
Definition: notifier.h:138
The OpenRTE Notifier Framework.