home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / A / PS / PROCPS-0.000 / PROCPS-0 / procps-0.97 / ps.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-25  |  2.7 KB  |  101 lines

  1. /*
  2.  * ps.h
  3.  *
  4.  * Copyright (c) 1992 Branko Lankester
  5.  *
  6.  * Modified heavily by Michael K. Johnson
  7.  *
  8.  * $Log: ps.h,v $
  9.  * Revision 1.6  1994/09/14  03:36:40  cb
  10.  * changes for bauke's forest feature.
  11.  *
  12.  * Revision 1.5  1994/07/27  22:56:54  cb
  13.  * shields revisions for multi-pids
  14.  *
  15.  * Revision 1.4  1994/04/03  15:06:41  johnsonm
  16.  * Added dump_keys() so that it can be called from ps.c.
  17.  * May need to change it later to take a FILE* to print to so that
  18.  *   ps and/or other programs can automagically pipe it through more or
  19.  *   screen-oriented programs can display it on the screen.
  20.  *   Remember that the GNU library can use file streams...
  21.  *
  22.  * Revision 1.3  1994/04/03  13:08:13  johnsonm
  23.  * Added support for compare.c
  24.  *
  25.  * Revision 1.2  1994/01/01  11:16:30  johnsonm
  26.  * Removed devline(), added dev3().
  27.  *
  28.  */
  29.  
  30.  
  31. #include <sys/types.h>
  32. #include <linux/sched.h>
  33.  
  34.  
  35. #define    MAXCMD    1024    /* max # bytes to write from the command line */
  36.  
  37.  
  38. struct ps_statm {
  39.   int size, resident, share, trs, lrs, drs, dt;
  40. };
  41.  
  42. struct ps_proc {
  43.   char cmdline[256], user[10], cmd[40], state, ttyc[4];
  44.   int uid, pid, ppid, pgrp, session, tty, tpgid, utime, stime,
  45.     cutime, cstime, counter, priority, start_time, signal, blocked,
  46.     sigignore, sigcatch;
  47.   unsigned int flags, min_flt, cmin_flt, maj_flt, cmaj_flt, timeout,
  48.     it_real_value, vsize, rss, rss_rlim, start_code, end_code,
  49.     start_stack, kstk_esp, kstk_eip, wchan;
  50.   struct ps_statm statm;
  51.   struct ps_proc *next;
  52. };
  53.  
  54. struct ps_proc_head {
  55.   struct ps_proc *head;
  56.   int count;
  57. };
  58.  
  59. struct tree_node 
  60. {
  61.     struct ps_proc *proc;
  62.     pid_t pid;
  63.     pid_t ppid;
  64.     char *line;
  65.     char *cmd;
  66.     int children;
  67.     int maxchildren;
  68.     int *child;
  69.     int have_parent;
  70. };
  71.  
  72. char *find_func();
  73. void dev_to_tty(char *tty, int dev);
  74. char *dev3(char *ttyname);
  75. char *wchan(unsigned int);
  76. char *status();
  77. void *xcalloc(void *pointer, int size);
  78. int mult_lvl_cmp(void* a, void* b);
  79. int node_mult_lvl_cmp(void* a, void* b);
  80. void dump_keys(void);
  81.  
  82. /* a, u, x, m, and r correspond to those command line options: if the
  83.    variable is set, then the corresponding command line option was
  84.    chosen. */
  85. struct ps_proc_head *take_snapshot(char a, char u, char x, char m, char r,
  86.                    uid_t uid, int ctty);
  87. struct ps_proc_head *refresh_snapshot(struct ps_proc_head *ph,
  88.                       char a, char u, char x, char m, char r,
  89.                       uid_t uid, int ctty);
  90. struct ps_proc_head *get_process(pid_t pid, int m);
  91. struct ps_proc_head *get_processes(pid_t *pids, int m);
  92. void free_psproc(struct ps_proc *this);
  93. void dev_to_tty(char *tty, int dev);
  94. int tty_to_dev(char *tty);
  95. char *user_from_uid(int uid);
  96. int open_psdb(void);
  97. void close_psdb(void);
  98.  
  99. #define PZERO 15
  100. char *status(struct ps_proc *task);
  101.