3
** Contact: xsb-contact@cs.sunysb.edu
5
** Copyright (C) The Research Foundation of SUNY, 1999
7
** XSB is free software; you can redistribute it and/or modify it under the
8
** terms of the GNU Library General Public License as published by the Free
9
** Software Foundation; either version 2 of the License, or (at your option)
12
** XSB is distributed in the hope that it will be useful, but WITHOUT ANY
13
** WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14
** FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for
17
** You should have received a copy of the GNU Library General Public License
18
** along with XSB; if not, write to the Free Software Foundation,
19
** Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21
** $Id: system_xsb.h,v 1.12 2005/01/14 18:31:33 ruim Exp $
30
#ifndef fileno /* fileno may be a macro */
31
extern int fileno(FILE *f); /* this is defined in POSIX */
34
/* In WIN_NT, this gets redefined into _fdopen by wind2unix.h */
35
extern FILE *fdopen(int fildes, const char *type);
38
extern int kill(pid_t pid, int sig);
45
#define PIPE(filedes_array) _pipe(filedes_array, 5*MAXBUFSIZE, _O_TEXT)
46
#define WAIT(pid, status) _cwait(&status, pid, 0)
47
#define KILL_FAILED(pid) !TerminateProcess((HANDLE) pid,-1) /* -1=retval */
49
#define PIPE(filedes_array) pipe(filedes_array)
50
#define WAIT(pid, status) waitpid(pid, &status, 0)
51
#define KILL_FAILED(pid) kill(pid, SIGKILL) < 0
58
#define FREE_PROC_TABLE_CELL(pid) ((pid < 0) \
59
|| ((process_status(pid) != RUNNING) \
60
&& (process_status(pid) != STOPPED)))
62
/* return codes from xsb_spawn */
63
#define PIPE_TO_PROC_FAILED -1
64
#define PIPE_FROM_PROC_FAILED -2
65
#define SUB_PROC_FAILED -3
67
#define MAX_SUBPROC_PARAMS 50 /* max # of cmdline params in a subprocess */
69
#define MAX_SUBPROC_NUMBER 40 /* max number of subrocesses allowed */
74
#define EXITED_NORMALLY 3
75
#define EXITED_ABNORMALLY 4