/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1990-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* AT&T Research
*
* send an action to the coshell for execution
*/
#include "colib.h"
#include <proc.h>
#include <ls.h>
static Cojob_t*
{
size_t n;
int i;
int j;
char* s;
char** a;
{
goto nospace;
}
{
return 0;
}
for (i = 0; i < elementsof(fds); i++)
{
fds[i] = j;
}
ops[3] = 0;
{
errormsg(state.lib, ERROR_LIBRARY|ERROR_SYSTEM|2, "%s: cannot connect to %s service", cs->path, cs->name);
return 0;
}
goto bad;
goto bad;
co->svc_outstanding++;
co->svc_running++;
goto bad;
return cj;
bad:
return 0;
}
static Cojob_t*
{
ssize_t n;
ssize_t i;
{
return 0;
}
goto bad;
goto bad;
action += i;
sfstrclose(sp);
if (n)
goto bad;
co->svc_outstanding++;
co->svc_running++;
return cj;
bad:
return 0;
}
coexec(register Coshell_t* co, const char* action, int flags, const char* out, const char* err, const char* att)
{
int n;
int i;
int og;
int cg;
char* s;
char* t;
char* env;
char* red;
/*
* get a free job slot
*/
break;
if (cj)
return 0;
else
{
}
/*
* set the flags
*/
/*
* check service intercepts
*/
{
if (!*s && *t == ' ')
}
/*
* package the action
*/
return 0;
return 0;
{
/*
* leave it to server
*/
0,
out,
err);
if (att)
else
}
{
env,
}
{
#if !_lib_fork && defined(_map_spawnve)
#endif
sfprintf(sp, "{\ntrap 'set %s$?; trap \"\" 0; IFS=\"\n\"; print -u$%s x %d $1 $(times); exit $1' 0 HUP INT QUIT TERM%s\n%s%s%s",
env,
if (n > CO_MAXEVAL)
else
{
}
if (out)
{
if (*out == '/')
else
}
if (err)
{
else if (*err == '/')
else
}
else if (flags & CO_SERIALIZE)
{
if (!out && !fstat(1, &sto) && !fstat(2, &ste) && sto.st_dev == ste.st_dev && sto.st_ino == ste.st_ino)
}
#if !_lib_fork && defined(_map_spawnve)
{
return 0;
sfstrclose(sp);
}
#endif
}
else
{
#if !_lib_fork && defined(_map_spawnve)
#endif
{
flags &= ~CO_SERIALIZE;
og = '{';
cg = '}';
}
else
{
og = '(';
cg = ')';
}
og,
env,
if (n > CO_MAXEVAL)
else
{
}
if (out)
{
if (*out == '/')
else
}
if (err)
{
else if (*err == '/')
else
}
else if (flags & CO_SERIALIZE)
{
if (out)
}
{
else
}
#if !_lib_fork && defined(_map_spawnve)
{
return 0;
sfstrclose(sp);
}
#endif
}
return 0;
{
sh[2] = s;
sh[3] = 0;
sfstrclose(sp);
co->outstanding++;
}
else
{
/*
* send it off
*/
s += i;
sfstrclose(sp);
if (n)
return 0;
/*
* it's a job
*/
co->outstanding++;
}
return cj;
}