OpenNet
LinuxCpp.h
Aller à la documentation de ce fichier.
1 
2 // Product OpenNet
3 
8 
9 #pragma once
10 
11 // Data types
13 
14 typedef long unsigned int size_t;
15 
16 // Constantes
18 
19 #define _IOC_NONE ( 0 )
20 #define _IOC_READ ( 2 )
21 #define _IOC_WRITE ( 1 )
22 
23 #define _IOC_NRBITS ( 8 )
24 #define _IOC_TYPEBITS ( 8 )
25 #define _IOC_SIZEBITS ( 14 )
26 #define _IOC_DIRBITS ( 2 )
27 
28 #define _IOC_NRSHIFT ( 0 )
29 #define _IOC_TYPESHIFT ( _IOC_NRSHIFT + _IOC_NRBITS )
30 #define _IOC_SIZESHIFT ( _IOC_TYPESHIFT + _IOC_TYPEBITS )
31 #define _IOC_DIRSHIFT ( _IOC_SIZESHIFT + _IOC_SIZEBITS )
32 
33 #define KERN_SOH "\001"
34 
35 #define KERN_EMERG KERN_SOH "0"
36 #define KERN_ALERT KERN_SOH "1"
37 #define KERN_CRIT KERN_SOH "2"
38 #define KERN_ERR KERN_SOH "3"
39 #define KERN_WARNING KERN_SOH "4"
40 #define KERN_NOTICE KERN_SOH "5"
41 #define KERN_INFO KERN_SOH "6"
42 #define KERN_DEBUG KERN_SOH "7"
43 
44 #define KERN_DEFAULT KERN_SOH "d"
45 
46 #define NULL ( 0 )
47 
48 // Macro
50 
51 #define _IOC(D,T,N,S) static_cast< unsigned int >( ( (D) << _IOC_DIRSHIFT ) | ( (T) << _IOC_TYPESHIFT ) | ( (N) << _IOC_NRSHIFT ) | ( (S) << _IOC_SIZESHIFT ) )
52 
53 #define _IO(T,N) _IOC( _IOC_NONE , (T), (N), 0 )
54 #define _IOR(T,N,S) _IOC( _IOC_READ , (T), (N), sizeof( S ) )
55 #define _IOW(T,N,S) _IOC( _IOC_WRITE , (T), (N), sizeof( S ) )
56 #define _IOW_BAD(T,N,S) _IOC( _IOC_WRITE , (T), (N), sizeof( S ) )
57 #define _IOWR(T,N,S) _IOC( _IOC_READ | _IOC_WRITE, (T), (N), sizeof( S ) )
58 
59 #define SIZE_OF(S) static_cast< uint32_t >( sizeof( S ) )
60 
61 // Function
63 
64 extern "C"
65 {
66 
67  void * memcpy(void * aOut, const void * aIn, size_t aSize_byte);
68  void * memset(void * aPtr, int aValue, size_t aSize_byte);
69 
70  int printk(const char * aFormat, ...);
71 
72  char * strcpy(char * aOut, const char * aIn);
73 
74 }