/* * ep - extended pipelining * * fd.h - filedescriptor structure header file * ____________________________________________________________ * * Developed by Ondrej Jombik * and Lubomir Host * 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/fd.h,v 1.11 2003/05/03 09:58:19 nepto Exp $ */ #ifndef _FD_H #define _FD_H #include "proclink.h" #define N_FD 3 #define FD_IN 0 #define FD_OUT 1 #define FD_ERR 2 #define INVALID_FD 0xffff #define N_FD_STR (4) struct fd { /* ID */ /* int id; */ /* Number of links. */ int n_link; /* Dynamic array of links with size n_link. */ struct proclink *link; /* Link's pipe. */ int pipe[2]; }; /* Returns the fd str of fd id. */ char *fd_id_to_fd_str(int id); /* Returns the fd id of string fd str. */ int fd_str_to_fd_id(char *str); /* Add link to fd.. */ /* Return 1 if OK, 0 for errors. */ int fd_add_proclink( struct fd *fd, const struct proclink *link); /* Remove link from fd. */ /* Return 1 if OK, 0 for errors. */ int fd_remove_proclink( struct fd *fd, const struct proclink *link); int fd_remove_proclink2( struct fd *fd, int link_proc_id, int link_fd_id); int fd_remove_proclink_by_index( struct fd *fd, const int index); /* Check existence of link in process according to fd_no. */ /* Return index + 1 of link if link exists, 0 if not. */ int fd_is_proclink( struct fd *fd, const struct proclink *link); int fd_is_proclink2( struct fd *fd, int link_proc_id, int link_fd_id); #endif /* #ifndef _FD_H */