Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Friday, March 29, 2024

File: [Platon] / ep / src / proctable.h (download)

Revision 1.17, Fri Nov 28 17:35:11 2003 UTC (20 years, 4 months ago) by nepto


Changes since 1.16: +3 -3 lines

Changed URL from www.platon.sk to platon.sk.

/*
 * ep - extended pipelining
 *
 * proctable.h - process table header file
 * ____________________________________________________________
 *
 * Developed by Ondrej Jombik <nepto@platon.sk>
 *          and Lubomir Host <rajo@platon.sk>
 * Copyright (c) 2000-2003 Platon SDG, http://platon.sk/
 * All rights reserved.
 *
 * See README file for more information about this software.
 * See COPYING file for license information.
 *
 * Download the latest version from
 * http://platon.sk/projects/ep/
 */

/* $Platon: ep/src/proctable.h,v 1.16 2003/05/03 09:58:19 nepto Exp $ */

#ifndef _PROCTABLE_H
#define _PROCTABLE_H

#include "process.h"

/* We need fd_set. */
#include <sys/types.h>

#define BUFSIZE        150U

#define proctable_free(p_ptbl)    proctable_destroy(p_ptbl)

typedef struct process** PROCTABLE;


/* Get size of valid process table. */
int proctable_get_size(PROCTABLE ptbl);

/* Create process table with appropriate size. */
PROCTABLE proctable_create(const int size);

/* Destroy proctable. */
void proctable_destroy(PROCTABLE *p_ptbl);

/* Join two proctables. Appends src_ptbl to p_dest_ptbl. */
/* Returns 0 on error, -1 on success. */
int proctable_join(PROCTABLE *p_dest_ptbl, PROCTABLE src_ptbl);

/* Get index of process in process table by pid. */
int proctable_get_process_index_by_pid(PROCTABLE ptbl, int pid);

/* Get index of process in process table by its name. */
/* Returns -1 when not found, index on sucess. */
int proctable_get_process_index_by_name(PROCTABLE ptbl, char *name);

/* Add standart process with streams stdin, stdout, stderr to proc. */
/* Index it as ptbl[0] and move all ptbl[x] to ptbl[x+1].            */
/* Returns -1 on error, 0 on success. */
int proctable_add_std_process(PROCTABLE *p_ptbl);

/* Update processes. */
int proctable_update(PROCTABLE ptbl);

/* Creates the pipes in process table. */
int proctable_create_pipes(PROCTABLE ptbl);

/* Fork processes and dup pipes. Exec the processes. */
int proctable_exec(PROCTABLE ptbl);

/* Closing 2nd sides of pipes. */
void proctable_close_2nd_sides_of_pipes(PROCTABLE ptbl);

/* Remove process from process table, when exited. */
int proctable_remove_process(PROCTABLE *p_ptbl, const int proc_id);

/* Remove all specified process and fd links with appropriate equivalents. */
int proctable_remove_process_fd_links(PROCTABLE ptbl, int proc_id, int fd_id);

/* Prints the whole processes hierarchy to stdout. */
void proctable_print(PROCTABLE ptbl);

/* Function read on opened filedescriptors and write    */
/* to 2nd sides pipes.                                    */
int proctable_read(
        PROCTABLE *p_ptbl,
        fd_set *p_rfds,
        fd_set *p_wfds,
        fd_set *p_efds);

/* Check if processes are still running.                */
int proctable_wait(PROCTABLE *p_ptbl);

/* Same as above, but only processes with closed fds. */
int proctable_wait2(PROCTABLE *p_ptbl);

#endif /* #ifndef _PROCTABLE_H */


Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top