File: freebsd.h

package info (click to toggle)
gps 1.1.0.0-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,212 kB
  • ctags: 987
  • sloc: cpp: 11,600; sh: 381; makefile: 319; ansic: 227; perl: 17
file content (90 lines) | stat: -rw-r--r-- 1,641 bytes parent folder | download | duplicates (4)
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
/* $Id: freebsd.h,v 1.2 2000/03/13 20:53:25 bergo Exp $ */

/* Process/CPU/Memory/etc. polling for FreeBSD*/

#include "transient.h"

#ifdef HAVEFREEBSD

#ifndef FREEBSD_H
#define FREEBSD_H

#include <gtk/gtk.h>
#include "polling.h"

class dpair {
 public:
  gint number;
  char name[64];
};

/// provides ONE kvm object for polling
class Kvm {
  public:
	  Kvm();
	  void *getp();
	  void *reference();
	  void dereference();

  private:
	  void Open();
	  void Close();
	  int refcount;
	  void *kvmp;
};

/// process list polling via FreeBSD
class FreeBSDProcessListPoller : public ProcessListPoller {
 public:
  /// constructor
  FreeBSDProcessListPoller();

  /// dereference kvm
  virtual void terminate();

  /// actual polling done here
  void poll();
};

/// process details via FreeBSD
class FreeBSDProcessDetailsPoller : public ProcessDetailsPoller {
 public:
  /// trivial constructor
  FreeBSDProcessDetailsPoller();

  /// dereference kvm
  virtual void terminate();

  /// actual polling done here
  void poll(int whichpid);

 private:
  void parse_process_flags(unsigned long flags,char *dest);
  void make_signal_string(unsigned long sigs,char *dest);
};

/// system information
class FreeBSDSystemInfoProvider : public SystemInfoProvider {
 public:
  /// trivial constructor.
  FreeBSDSystemInfoProvider();

  /// dereference kvm
  virtual void terminate();

  /// actual gathering done here.
  void update();

 private:
  gulong prevTotal,prevUsed;

  void update_cpu();
  void update_memory();
  int swapmode(unsigned long *retavail, unsigned long *retfree);

};


#endif /* inclusion guards */

#endif /* HAVEFREEBSD */