/***********************************************************************
* *
* 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 Bell Laboratories
*
* remote coshell service definitions
*/
int pid; /* pid */ \
int rid; /* user request id */ \
int sig; /* last signal sent to job */ \
int fd; /* con USER fd */ \
int ref; /* drop reference count */ \
char* cmd; /* cmd msg text */ \
unsigned long busy; /* time when job becomes hog */ \
unsigned long lost; /* time when job is lost */ \
unsigned long start; /* start time */ \
/* end of private additions */
char* access; /* host access expression */ \
char* bypass; /* idle bypass expression */ \
unsigned long addr; /* host address */ \
unsigned long rank; /* scheduling rank */ \
unsigned long temp; /* scheduling temperature */ \
int mode; /* extra flags */ \
int bias; /* scheduling bias */ \
int cpu; /* cpu count */ \
int errors; /* csstat() error count */ \
int fd; /* con SHELL fd */ \
int home; /* # users calling this home */ \
int idle; /* min # login idle secs */ \
int idle_override; /* restore idle override */ \
int pid; /* shell pid */ \
int open; /* number of successful opens */ \
int rating; /* cpu rating */ \
int scale; /* load average scale */ \
unsigned long override; /* override expiration */ \
unsigned long start; /* connect start time */ \
unsigned long update; /* time stat last updated */ \
/* end of private additions */
#include <ast.h>
#include <cs.h>
#include <coshell.h>
#include <ctype.h>
#include <debug.h>
#include <error.h>
#include <sig.h>
#include <tm.h>
#include <tok.h>
#include <wait.h>
#define match(p,a,o) ((!((a)->set&SETNAME)||strmatch((p)->name,(a)->name))&&((((a)->set|o)&(SETMISC|DEF|NEW|SET))==SETMISC?miscmatch(p,(a)->misc):((a)->set&SETNAME)?1:streq((p)->type,state.home->type)))
typedef struct
{
char* access;
char* bypass;
int bias;
int cpu;
int idle;
int ignore;
int rating;
int scale;
unsigned long set;
struct
{
char* file;
char* identify;
char* migrate;
char* profile;
char* remote;
char* schedule;
char* shell;
int busy;
int debug;
unsigned long disable;
int grace;
int maxidle;
int maxload;
int percpu;
int perhost;
int perserver;
int peruser;
int pool;
unsigned long set;
} global;
} Coattr_t;
typedef struct
{
int pid;
} Coident_t;
typedef struct
{
short fd;
} Copass_t;
typedef struct
{
char* pump;
char* expr;
short flags;
short pid;
short running;
short total;
} Couser_t;
typedef struct
{
union
{
Coident_t ident;
} info;
short type;
short error;
short flags;
} Connection_t;
typedef struct
{
int con;
int cmd;
int err;
int msg;
int out;
char* pump;
} Indirect_t;
typedef struct
{
unsigned long access;
char** argv;
char* buf;
int buflen;
unsigned long busy;
unsigned long clock;
int cmds;
int connect;
unsigned long disable;
int fdtotal;
unsigned long grace;
char* identify;
int jobs;
int joblimit;
int jobwait;
int maxidle;
int maxload;
char* mesg;
char* migrate;
int open;
int override;
int percpu;
int perhost;
int perserver;
int peruser;
int pool;
char* profile;
char* pump;
unsigned long real;
char* remote;
int running;
struct
{
char* name;
int fd;
} scheduler;
char* service;
int set;
char* sh;
int shellc;
int shelln;
int shells;
int shellwait;
unsigned long start;
unsigned long sys;
unsigned long toss;
unsigned long user;
unsigned long wakeup;
int users;
char* version;
} State_t;
/*
* coshell specific globals
*/
extern const char corinit[];
extern int byname(const char*, const char*);
extern int byrank(const char*, const char*);
extern int bytemp(const char*, const char*);
extern int command(int, char**);
extern void drop(int);
extern char* fmtfloat(int);
extern void server(int, int, int, int, char*);
extern void shellcheck(void);
extern void shellclose(Coshell_t*, int);
extern char* stream(int, char*);