File: rtl_cpp.h

package info (click to toggle)
rtlinux 3.1pre3-2
  • links: PTS
  • area: non-free
  • in suites: sarge, woody
  • size: 4,892 kB
  • ctags: 4,228
  • sloc: ansic: 26,204; sh: 2,069; makefile: 1,414; perl: 855; tcl: 489; asm: 380; cpp: 42
file content (63 lines) | stat: -rw-r--r-- 947 bytes parent folder | download | duplicates (2)
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
/*
 * rtlcpp.h - C++ support for RTL
 * Michael Barabanov, <baraban@fsmlabs.com>
 *
 * Ideas and code from David Olofson, Yunho Jeon and myself
 */

#ifndef __KERNELCPP__
#define __KERNELCPP__

#ifdef __cplusplus
extern "C" {
#endif

#define new _new
#define virtual _virtual
#define NULL 0
#include <linux/kernel.h>
#include <linux/module.h>
#include <rtl_sched.h>
#include <rtl_fifo.h>
#include <rtl_time.h>
#include <pthread.h>

#undef new
#undef virtual
#ifdef __cplusplus
}
#endif

extern "C" {

void *kmalloc(unsigned size, int prio);
void kfree(const void *p);
};

extern "C" {
	int __do_global_ctors_aux();
	int __do_global_dtors_aux();
}

void *operator new (unsigned size) {
  return kmalloc(size,0);
}

void *operator new[] (unsigned size) {
  return kmalloc(size,0);
}

void operator delete (void *p) {
  kfree(p);
}

void operator delete[] (void *p) {
  kfree(p);
}

extern "C" {
	int init_module();
	void cleanup_module();
}

#endif