/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1989-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
*
* process status stream PSS_METHOD_procfs implementation
*/
#include "psslib.h"
#if PSS_METHOD != PSS_METHOD_procfs
#else
#if !defined(pr_clname) && !_mem_pr_clname_prpsinfo
#define PSS_sched 0
#endif
#if !defined(pr_gid) && !_mem_pr_gid_prpsinfo
#define PSS_gid 0
#endif
#if !defined(pr_lttydev) && !_mem_pr_lttydev_prpsinfo
#define _mem_pr_lttydev_prpsinfo 0
#endif
#if !defined(pr_ntpid) && !_mem_pr_ntpid_prpsinfo
#define PSS_npid 0
#else
#endif
#endif
#if !defined(pr_pgrp) && !_mem_pr_pgrp_prpsinfo
#define _mem_pr_pgrp_prpsinfo 1
#else
#define PSS_pgrp 0
#endif
#endif
#if !defined(pr_psargs) && !_mem_pr_psargs_prpsinfo
#define _mem_pr_psargs_prpsinfo 0
#endif
#if !defined(pr_refcount) && !_mem_pr_refcount_prpsinfo
#define PSS_refcount 0
#endif
#if !defined(pr_rssize) && !_mem_pr_rssize_prpsinfo
#define PSS_rss 0
#endif
#if !defined(pr_sonproc) && !_mem_pr_sonproc_prpsinfo
#define PSS_proc 0
#endif
#if !defined(pr_sid) && !_mem_pr_sid_prpsinfo
#define PSS_sid 0
#endif
#if !defined(pr_tgrp) && !_mem_pr_tgrp_prpsinfo
#define PSS_tgrp 0
#endif
typedef struct State_s
{
} State_t;
static int
{
int fd;
return -1;
{
return -1;
}
{
return -1;
}
return 1;
}
static int
{
return 1;
}
static int
{
char* e;
if (pid)
else
do
{
return 0;
} while (*e);
return 1;
}
static int
{
register int fd;
int n;
#if defined(_PS_scan_binary) || defined(_PS_scan_format)
#endif
{
return 0;
}
#ifdef _PS_scan_format
{
n = -1;
}
else
{
if (n < _PS_scan_count)
{
register char* s;
if (*s == '(')
{
for (; *s && *s != ')'; s++)
if (isspace(*s))
*s = '_';
break;
}
if (n < _PS_scan_count)
}
#ifdef _PS_scan_fix
#endif
#ifdef _PS_task
#endif
#endif
#ifdef _PS_scan_boot
{
register char* s;
{
{
break;
}
}
}
#endif
}
#else
#ifdef _PS_scan_binary
#else
#endif
#endif
if (n < 0)
{
return 0;
}
#if _UTS
#endif
#if PSS_gid
#endif
#if PSS_pgrp
#endif
#if PSS_sid
#endif
#if PSS_tgrp
#endif
return 1;
}
static int
{
char* s;
int i;
{
{
#else
#ifdef _PS_args
s = "<unknown>";
{
int n;
close(i);
if (n > 0)
{
for (i = 0; i < n; i++)
if (!s[i])
s[i] = ' ';
s[i] = 0;
}
}
#else
{
s[i] = 0;
s++;
}
#endif
#endif
}
if (fields & PSS_command)
{
{
s[i] = 0;
s++;
}
}
}
#endif
#else
#endif
#endif
#endif
#endif
#endif
return 1;
}
static Pssmeth_t procfs_method =
{
"/proc",
"[-version?@(#)$Id: pss /proc (AT&T Research) 2011-12-13 $\n]"
"[-author?Glenn Fowler <gsf@research.att.com>]",
0,
0,
0,
};
#endif