~ubuntu-branches/ubuntu/trusty/checkpolicy/trusty

« back to all changes in this revision

Viewing changes to global.h

  • Committer: Bazaar Package Importer
  • Author(s): Manoj Srivastava
  • Date: 2004-11-24 14:01:41 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20041124140141-2w64gbhqynveunlv
Tags: 1.18-2
Update download location and copyright file, since the locations we
were pointing to are now forbidden (return a code 403).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* FLASK */
2
 
 
3
 
/* 
4
 
 * Global definitions that are included at the beginning
5
 
 * of every file using the -include directive.
6
 
 *
7
 
 * These definitions are used to permit the same
8
 
 * source code to be used to build both the security
9
 
 * server component of the kernel and the checkpolicy
10
 
 * program.
11
 
 */
12
 
 
13
 
#ifndef __SS_GLOBAL_H
14
 
#define __SS_GLOBAL_H
15
 
 
16
 
#include <stdio.h>
17
 
#include <stdlib.h>
18
 
#include <unistd.h>
19
 
#include <string.h>
20
 
#include <ctype.h>
21
 
#include <limits.h>
22
 
#include <errno.h>
23
 
#include <sys/types.h>
24
 
#include <netinet/in.h>
25
 
#include <arpa/inet.h>
26
 
#include <byteswap.h>
27
 
#include <endian.h>
28
 
 
29
 
typedef unsigned int security_id_t;
30
 
#define SECSID_NULL 0
31
 
#define SELINUX_MAGIC 0xf97cff8c 
32
 
 
33
 
#define selinux_enforcing 1
34
 
 
35
 
#include "flask.h"
36
 
#include "security.h"
37
 
#include "avc_ss.h"
38
 
#include "av_permissions.h"
39
 
 
40
 
#define NIPQUAD(addr) \
41
 
        ((unsigned char *)&addr)[0], \
42
 
        ((unsigned char *)&addr)[1], \
43
 
        ((unsigned char *)&addr)[2], \
44
 
        ((unsigned char *)&addr)[3]
45
 
 
46
 
#if __BYTE_ORDER == __LITTLE_ENDIAN
47
 
#define cpu_to_le32(x) (x)
48
 
#define le32_to_cpu(x) (x)
49
 
#define cpu_to_le64(x) (x)
50
 
#define le64_to_cpu(x) (x)
51
 
#else
52
 
#define cpu_to_le32(x) bswap_32(x)
53
 
#define le32_to_cpu(x) bswap_32(x)
54
 
#define cpu_to_le64(x) bswap_64(x)
55
 
#define le64_to_cpu(x) bswap_64(x)
56
 
#endif
57
 
 
58
 
#define wmb() 
59
 
 
60
 
#define kmalloc(size, flags) malloc(size)
61
 
#define kfree(ptr) free(ptr)
62
 
#define vmalloc(size) malloc(size)
63
 
#define vfree(ptr) free(ptr)
64
 
 
65
 
#define printk printf
66
 
 
67
 
typedef unsigned int spinlock_t;
68
 
#define spin_lock_init(x) *(x) = 0
69
 
#define spin_lock_irq(x)
70
 
#define spin_unlock_irq(x)
71
 
 
72
 
typedef unsigned int rwlock_t;
73
 
#define read_lock(x) *(x) = 1
74
 
#define read_unlock(x)
75
 
#define write_lock_irq(x)
76
 
#define write_unlock_irq(x)
77
 
#define RW_LOCK_UNLOCKED 0
78
 
 
79
 
#define DECLARE_MUTEX(x) unsigned int x
80
 
#define down(x) *(x) = 1
81
 
#define up(x) 
82
 
 
83
 
#define BUG_ON(x) do { if (x) printf("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); } while (0)
84
 
 
85
 
#define BUG() do { printf("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); } while (0)
86
 
 
87
 
static inline void selinux_complete_init(void) {}
88
 
 
89
 
#endif /* __SS_GLOBAL_H */