system_xsb.h

00001 /* File:      system_xsb.h
00002 ** Author(s): kifer
00003 ** Contact:   xsb-contact@cs.sunysb.edu
00004 ** 
00005 ** Copyright (C) The Research Foundation of SUNY, 1999
00006 ** 
00007 ** XSB is free software; you can redistribute it and/or modify it under the
00008 ** terms of the GNU Library General Public License as published by the Free
00009 ** Software Foundation; either version 2 of the License, or (at your option)
00010 ** any later version.
00011 ** 
00012 ** XSB is distributed in the hope that it will be useful, but WITHOUT ANY
00013 ** WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00014 ** FOR A PARTICULAR PURPOSE.  See the GNU Library General Public License for
00015 ** more details.
00016 ** 
00017 ** You should have received a copy of the GNU Library General Public License
00018 ** along with XSB; if not, write to the Free Software Foundation,
00019 ** Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00020 **
00021 ** $Id: system_xsb.h,v 1.12 2005/01/14 18:31:33 ruim Exp $
00022 ** 
00023 */
00024 
00025 
00026 #ifdef __cplusplus
00027 extern "C" {
00028 #endif
00029 
00030 #ifndef fileno                          /* fileno may be a  macro */
00031 extern int    fileno(FILE *f);          /* this is defined in POSIX */
00032 #endif
00033 
00034 /* In WIN_NT, this gets redefined into _fdopen by wind2unix.h */
00035 extern FILE *fdopen(int fildes, const char *type);
00036 
00037 #ifndef WIN_NT
00038 extern int kill(pid_t pid, int sig);
00039 #endif
00040 #ifdef _cplusplus
00041 }
00042 #endif
00043 
00044 #ifdef WIN_NT
00045 #define PIPE(filedes_array)  _pipe(filedes_array, 5*MAXBUFSIZE, _O_TEXT)
00046 #define WAIT(pid, status)    _cwait(&status, pid, 0)
00047 #define KILL_FAILED(pid)     !TerminateProcess((HANDLE) pid,-1) /* -1=retval */
00048 #else
00049 #define PIPE(filedes_array)  pipe(filedes_array)
00050 #define WAIT(pid, status)    waitpid(pid, &status, 0)
00051 #define KILL_FAILED(pid)     kill(pid, SIGKILL) < 0
00052 #endif
00053 
00054 #ifdef __cplusplus
00055 }
00056 #endif
00057 
00058 #define FREE_PROC_TABLE_CELL(pid)   ((pid < 0) \
00059                                      || ((process_status(pid) != RUNNING) \
00060                                          && (process_status(pid) != STOPPED)))
00061 
00062 /* return codes from xsb_spawn */
00063 #define  PIPE_TO_PROC_FAILED    -1
00064 #define  PIPE_FROM_PROC_FAILED  -2
00065 #define  SUB_PROC_FAILED        -3
00066 
00067 #define MAX_SUBPROC_PARAMS 50  /* max # of cmdline params in a subprocess */
00068 
00069 #define MAX_SUBPROC_NUMBER 40  /* max number of subrocesses allowed       */
00070 
00071 
00072 #define RUNNING                1
00073 #define STOPPED                2
00074 #define EXITED_NORMALLY        3
00075 #define EXITED_ABNORMALLY      4
00076 #define ABORTED                5
00077 #define INVALID                6
00078 #define UNKNOWN                7

Generated on Wed Jul 26 13:30:42 2006 for XSB by  doxygen 1.4.5