1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
|
/* @(#)subproc.h 19.1 (ESO-IPG) 02/25/03 13:41:47 */
/*---------------------------------------------------------------------
* $Date: 2003-06-04 14:49:18 $ $Revision: 1.1.1.1 $
*---------------------------------------------------------------------
* Copyright (c) 1992, Visual Edge Software Ltd.
*
* ALL RIGHTS RESERVED. Permission to use, copy, modify, and
* distribute this software and its documentation for any purpose
* and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Visual Edge Software not be
* used in advertising or publicity pertaining to distribution of
* the software without specific, written prior permission. The year
* included in the notice is the year of the creation of the work.
*---------------------------------------------------------------------
* File_Description_Section
*--------------------------------------------------------------------*/
#ifndef SUBPROC_H
#define SUBPROC_H
/*--- include files ---*/
#include "uxproto.h"
#include <ctype.h>
#include <stdio.h>
#include <string.h>
/*
#include <malloc.h>
*/
#include <valloc.h>
#include <X11/Intrinsic.h>
#include <X11/X.h>
#include "UxSubproc.h"
#include "uimx_cat.h"
#include "misc1_ds.h"
#include "global.h"
#ifdef __cplusplus
extern "C" { /* C++ compatability */
#endif /* __cplusplus */
/*--- macro symbolic constants ---*/
#ifdef RUNTIME
#define UxError(msg) UxStandardError((msg))
#endif /* RUNTIME */
/* Provide 32 entries which is the maximum number of
* of tty/pty pairs for one process on most extended
* architectures. Pseudo terminals are only in use if
* a subprocess is between a Run - Exit cycle. Double
* the number of subprocess structures should suffice.
* Refered to in the functions UxDeleteSubproc and GetSp.
*/
#define MAX_SUBPROC 64
/* These are the possible values for the field subprocStatus
* in the structure SubprocInfo_t.
*/
#define UNDEFINED -1 /* the process state is unknown */
#define RUNNING 0 /* the process is running */
#define EXITING 1 /* the process is exiting */
#define DEAD 2 /* the process is dead */
#define DELAYED_EXIT 3 /* the process is in a delayed exit state */
#ifdef SYSV
# define USE_SYSV_TERMIO
# define USE_SYSV_PGRP
#endif /* SYSV */
/*--- macro functions ---*/
/* X/OPEN message catalog macros. These will make the code more compact. */
#define CGETS(ms,ds_ms) UxCatGets(MC_MISC1,ms,ds_ms)
#define error_msg(x) UxStandardError("%s", x);
/*--- types ---*/
typedef struct {
char *process;
char *defarg;
char *output_str;
void (*output_fnt)();
void (*exit_cb)();
int handle;
int echo,
pid;
int subprocStatus;
char *user_data;
XtInputId input_id;
XtInputId except_id;
} SubprocInfo_t;
typedef void (*void_func_ptr)();
typedef int (*int_func_ptr)();
typedef char ** (*char_func_ptr)();
typedef struct {
char_func_ptr prepare_command_m;
int_func_ptr set_parent_side_m;
int_func_ptr setup_parent_communication_m;
int_func_ptr start_child_m;
int_func_ptr set_child_side_m;
void_func_ptr setup_child_communication_m;
int_func_ptr exec_subprocess_m;
void_func_ptr close_communication_m;
} SubprocMgr_t;
/*--- external functions ---*/
extern int UxGetSp UXPROTO((void));
extern int UxCheckIndex UXPROTO((handle index));
extern void UxSyserr UXPROTO((char *msg1, char *msg2));
extern int UxPrintArgs UXPROTO((char **tmp));
extern void UxSpCheck UXPROTO((SubprocInfo_t *sp));
extern void UxOutputHandler UXPROTO((SubprocInfo_t *sp));
extern void UxSpExit UXPROTO((SubprocInfo_t *sp));
extern void UxOnExitRunExitCb UXPROTO((int pid, int status));
extern char **UxBuildArgs UXPROTO((char *process, char *command_line));
extern void UxKillAllSubprocs UXPROTO((void));
/*--- external variables ---*/
extern SubprocInfo_t *UxSpArray[MAX_SUBPROC];
extern SubprocMgr_t UxSubprocMgr;
#ifdef __cplusplus
} /* Close scope of 'extern "C"' declaration which encloses file. */
#endif /* __cplusplus */
#endif
|