| version 1.2, 2001/09/21 19:44:51 |
version 1.3, 2001/12/02 23:30:07 |
|
|
| /* |
/* |
| * $Log$ |
* $Log$ |
| |
* Revision 1.3 2001/12/02 23:30:07 jombik9 |
| |
* A lot of new functions added. |
| |
* Various improvements. |
| |
* |
| * Revision 1.2 2001/09/21 19:44:51 host8 |
* Revision 1.2 2001/09/21 19:44:51 host8 |
| * Added $Log$ keyword substitution |
* Added $Log$ |
| |
* Added Revision 1.3 2001/12/02 23:30:07 jombik9 |
| |
* Added A lot of new functions added. |
| |
* Added Various improvements. |
| |
* Added keyword substitution |
| * |
* |
| */ |
*/ |
| #ifndef _PROCTABLE_H |
#ifndef _PROCTABLE_H |
|
|
| /* We need fd_set. */ |
/* We need fd_set. */ |
| #include <sys/types.h> |
#include <sys/types.h> |
| |
|
| |
#define proctable_free(p_ptbl) proctable_destroy(p_ptbl) |
| |
|
| typedef struct process** PROCTABLE; |
typedef struct process** PROCTABLE; |
| |
|
| |
|
| /* Get size of valid process table. */ |
/* Get size of valid process table. */ |
| int proctable_get_size (PROCTABLE ptbl); |
int proctable_get_size(PROCTABLE ptbl); |
| |
|
| |
/* Create process table with appropriate size. */ |
| |
PROCTABLE proctable_create(const int size); |
| |
|
| /* Return process table initialized by command line. */ |
/* Return process table initialized by command line. */ |
| PROCTABLE proctable_get_from_cmdline(int argc, char** argv); |
PROCTABLE proctable_get_from_cmdline(int argc, char** argv); |
| Line 28 PROCTABLE proctable_get_from_array(int s |
|
| Line 40 PROCTABLE proctable_get_from_array(int s |
|
| /* Destroy proctable. */ |
/* Destroy proctable. */ |
| void proctable_destroy(PROCTABLE *p_ptbl); |
void proctable_destroy(PROCTABLE *p_ptbl); |
| |
|
| /* Get index of proc in process table by pid. */ |
/* Get index of process in process table by pid. */ |
| int proctable_get_process_index_by_pid (PROCTABLE ptbl, int pid); |
int proctable_get_process_index_by_pid(PROCTABLE ptbl, int pid); |
| |
|
| |
/* Get index of process in process table by its name. */ |
| |
int proctable_get_process_index_by_name(PROCTABLE ptbl, char *name); |
| |
|
| /* Add standart process with streams stdin, stdout, stderr to proc. */ |
/* Add standart process with streams stdin, stdout, stderr to proc. */ |
| /* Index it as ptbl[0] and move all ptbl[x] to ptbl[x+1]. */ |
/* Index it as ptbl[0] and move all ptbl[x] to ptbl[x+1]. */ |
| int proctable_add_std_process (PROCTABLE *p_ptbl); |
int proctable_add_std_process(PROCTABLE *p_ptbl); |
| |
|
| /* Update processes. */ |
/* Update processes. */ |
| int proctable_update (PROCTABLE ptbl); |
int proctable_update(PROCTABLE ptbl); |
| |
|
| /* Creates the pipes in process table. */ |
/* Creates the pipes in process table. */ |
| int proctable_create_pipes (PROCTABLE ptbl); |
int proctable_create_pipes(PROCTABLE ptbl); |
| |
|
| /* Fork processes and dup pipes. Exec the processes. */ |
/* Fork processes and dup pipes. Exec the processes. */ |
| int proctable_exec (PROCTABLE ptbl); |
int proctable_exec(PROCTABLE ptbl); |
| |
|
| /* Closing 2nd sides of pipes. */ |
/* Closing 2nd sides of pipes. */ |
| void proctable_close_2nd_sides_of_pipes (PROCTABLE ptbl); |
void proctable_close_2nd_sides_of_pipes(PROCTABLE ptbl); |
| |
|
| |
|
| /* Remove process from process table, when exited. */ |
/* Remove process from process table, when exited. */ |
| int proctable_remove_process (PROCTABLE *p_ptbl, const int index); |
int proctable_remove_process(PROCTABLE *p_ptbl, const int index); |
| |
|
| /* Prints the whole processes hierarchy to stdout. */ |
/* Prints the whole processes hierarchy to stdout. */ |
| void proctable_print (PROCTABLE ptbl); |
void proctable_print(PROCTABLE ptbl); |
| |
|
| /* Function read on opened filedescriptors and write */ |
/* Function read on opened filedescriptors and write */ |
| /* to 2nd sides pipes. */ |
/* to 2nd sides pipes. */ |
| int proctable_read( |
int proctable_read(PROCTABLE *p_ptbl, fd_set *p_fds); |
| PROCTABLE *p_ptbl, |
|
| fd_set *p_fds); |
|
| |
|
| /* Check if processes are still running. */ |
/* Check if processes are still running. */ |
| int proctable_wait (PROCTABLE *p_ptbl); |
int proctable_wait(PROCTABLE *p_ptbl); |
| |
|
| |
|
| #endif /* #ifndef _PROCTABLE_H */ |
#endif /* #ifndef _PROCTABLE_H */ |
| |
|