The Pedigree Project  0.1
InfoBlock.h
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef _INFO_BLOCK_H
21 #define _INFO_BLOCK_H
22 
23 #ifdef __cplusplus
24 
25 #include "pedigree/kernel/processor/types.h"
26 
27 #endif
28 
29 struct InfoBlock
30 {
32  uint64_t now;
33 
35  uint64_t now_s;
36 
38  size_t pid;
39 
41  char sysname[64];
42  char release[64];
43  char version[64];
44  char machine[64];
45 };
46 
47 #ifdef __cplusplus
48 
49 #include "pedigree/kernel/machine/TimerHandler.h"
50 
51 class InfoBlockManager : public TimerHandler
52 {
53  public:
54  InfoBlockManager();
55  virtual ~InfoBlockManager();
56 
57  static InfoBlockManager &instance();
58 
59  bool initialise();
60 
61  virtual void timer(uint64_t delta, InterruptState &state);
62 
63  void setPid(size_t value);
64 
65  private:
66  static InfoBlockManager m_Instance;
67 
68  bool m_bInitialised;
69 
70  struct InfoBlock *m_pInfoBlock;
71 };
72 
73 #endif
74 
75 #endif
size_t pid
Current process' ID.
Definition: InfoBlock.h:38
char sysname[64]
uname fields.
Definition: InfoBlock.h:41
uint64_t now
Current timestamp in nanoseconds since the UNIX epoch.
Definition: InfoBlock.h:32
uint64_t now_s
Current timestamp in seconds since the UNIX epoch.
Definition: InfoBlock.h:35