~ubuntu-branches/ubuntu/raring/rtkit/raring-security

« back to all changes in this revision

Viewing changes to debian/patches/01_rename_user_struct.patch

  • Committer: Bazaar Package Importer
  • Author(s): Luke Yelavich
  • Date: 2009-08-05 09:59:35 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090805095935-i4o105n5cfj9oyly
Tags: 0.4-0ubuntu1
* New upstream release
* 01_rename_user_struct.patch: Dropped, applied upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
diff --git a/rtkit-daemon.c b/rtkit-daemon.c
2
 
index 69b48e0..11852e6 100644
3
 
--- a/rtkit-daemon.c
4
 
+++ b/rtkit-daemon.c
5
 
@@ -183,7 +183,7 @@ struct process {
6
 
         struct process *next;
7
 
 };
8
 
 
9
 
-struct user {
10
 
+struct rtkit_user {
11
 
         uid_t uid;
12
 
 
13
 
         time_t timestamp;
14
 
@@ -193,10 +193,10 @@ struct user {
15
 
         unsigned n_processes;
16
 
         unsigned n_threads;
17
 
 
18
 
-        struct user *next;
19
 
+        struct rtkit_user *next;
20
 
 };
21
 
 
22
 
-static struct user *users = NULL;
23
 
+static struct rtkit_user *users = NULL;
24
 
 static unsigned n_users = 0;
25
 
 static unsigned n_total_processes = 0;
26
 
 static unsigned n_total_threads = 0;
27
 
@@ -291,7 +291,7 @@ static void free_process(struct process *p) {
28
 
         free(p);
29
 
 }
30
 
 
31
 
-static void free_user(struct user *u) {
32
 
+static void free_user(struct rtkit_user *u) {
33
 
         struct process *p;
34
 
 
35
 
         while ((p = u->processes)) {
36
 
@@ -302,13 +302,13 @@ static void free_user(struct user *u) {
37
 
         free(u);
38
 
 }
39
 
 
40
 
-static bool user_in_burst(struct user *u) {
41
 
+static bool user_in_burst(struct rtkit_user *u) {
42
 
         time_t now = time(NULL);
43
 
 
44
 
         return now < u->timestamp + actions_burst_sec;
45
 
 }
46
 
 
47
 
-static bool verify_burst(struct user *u) {
48
 
+static bool verify_burst(struct rtkit_user *u) {
49
 
 
50
 
         if (!user_in_burst(u)) {
51
 
                 /* Restart burst phase */
52
 
@@ -327,8 +327,8 @@ static bool verify_burst(struct user *u) {
53
 
         return true;
54
 
 }
55
 
 
56
 
-static int find_user(struct user **_u, uid_t uid) {
57
 
-        struct user *u;
58
 
+static int find_user(struct rtkit_user **_u, uid_t uid) {
59
 
+        struct rtkit_user *u;
60
 
 
61
 
         for (u = users; u; u = u->next)
62
 
                 if (u->uid == uid) {
63
 
@@ -341,7 +341,7 @@ static int find_user(struct user **_u, uid_t uid) {
64
 
                 return -EBUSY;
65
 
         }
66
 
 
67
 
-        if (!(u = malloc(sizeof(struct user))))
68
 
+        if (!(u = malloc(sizeof(struct rtkit_user))))
69
 
                 return -ENOMEM;
70
 
 
71
 
         u->uid = uid;
72
 
@@ -357,7 +357,7 @@ static int find_user(struct user **_u, uid_t uid) {
73
 
         return 0;
74
 
 }
75
 
 
76
 
-static int find_process(struct process** _p, struct user *u, pid_t pid, unsigned long long starttime) {
77
 
+static int find_process(struct process** _p, struct rtkit_user *u, pid_t pid, unsigned long long starttime) {
78
 
         struct process *p;
79
 
 
80
 
         for (p = u->processes; p; p = p->next)
81
 
@@ -387,7 +387,7 @@ static int find_process(struct process** _p, struct user *u, pid_t pid, unsigned
82
 
         return 0;
83
 
 }
84
 
 
85
 
-static int find_thread(struct thread** _t, struct user *u, struct process *p, pid_t pid, unsigned long long starttime) {
86
 
+static int find_thread(struct thread** _t, struct rtkit_user *u, struct process *p, pid_t pid, unsigned long long starttime) {
87
 
         struct thread *t;
88
 
 
89
 
         for (t = p->threads; t; t = t->next)
90
 
@@ -472,7 +472,7 @@ static bool thread_relevant(struct process *p, struct thread *t) {
91
 
         return FALSE;
92
 
 }
93
 
 
94
 
-static void thread_gc(struct user *u, struct process *p) {
95
 
+static void thread_gc(struct rtkit_user *u, struct process *p) {
96
 
         struct thread *t, *n, *l;
97
 
 
98
 
         /* Cleanup dead theads of a specific user we don't need to keep track about anymore */
99
 
@@ -499,7 +499,7 @@ static void thread_gc(struct user *u, struct process *p) {
100
 
         assert(!p->threads || u->n_threads);
101
 
 }
102
 
 
103
 
-static void process_gc(struct user *u) {
104
 
+static void process_gc(struct rtkit_user *u) {
105
 
         struct process *p, *n, *l;
106
 
 
107
 
         /* Cleanup dead processes of a specific user we don't need to keep track about anymore */
108
 
@@ -528,7 +528,7 @@ static void process_gc(struct user *u) {
109
 
 }
110
 
 
111
 
 static void user_gc(void) {
112
 
-        struct user *u, *n, *l;
113
 
+        struct rtkit_user *u, *n, *l;
114
 
 
115
 
         /* Cleanup all users we don't need to keep track about anymore */
116
 
 
117
 
@@ -637,7 +637,7 @@ static int verify_process_rttime(struct process *p) {
118
 
         return good ? 0 : -EPERM;
119
 
 }
120
 
 
121
 
-static int verify_process_user(struct user *u, struct process *p) {
122
 
+static int verify_process_user(struct rtkit_user *u, struct process *p) {
123
 
         char fn[128];
124
 
         int r;
125
 
         struct stat st;
126
 
@@ -726,7 +726,7 @@ static char* get_exe_name(pid_t pid, char *exe, size_t len) {
127
 
         return exe;
128
 
 }
129
 
 
130
 
-static int process_set_realtime(struct user *u, struct process *p, struct thread *t, unsigned priority) {
131
 
+static int process_set_realtime(struct rtkit_user *u, struct process *p, struct thread *t, unsigned priority) {
132
 
         int r;
133
 
         struct sched_param param;
134
 
         char user[64], exe[128];
135
 
@@ -796,7 +796,7 @@ finish:
136
 
         return r;
137
 
 }
138
 
 
139
 
-static int process_set_high_priority(struct user *u, struct process *p, struct thread *t, int priority) {
140
 
+static int process_set_high_priority(struct rtkit_user *u, struct process *p, struct thread *t, int priority) {
141
 
         int r;
142
 
         struct sched_param param;
143
 
         char user[64], exe[128];
144
 
@@ -861,7 +861,7 @@ finish:
145
 
 }
146
 
 
147
 
 static void reset_known(void) {
148
 
-        struct user *u;
149
 
+        struct rtkit_user *u;
150
 
         struct process *p;
151
 
         struct thread *t;
152
 
 
153
 
@@ -1024,7 +1024,7 @@ finish:
154
 
 }
155
 
 
156
 
 static int lookup_client(
157
 
-                struct user **_u,
158
 
+                struct rtkit_user **_u,
159
 
                 struct process **_p,
160
 
                 struct thread **_t,
161
 
                 DBusConnection *c,
162
 
@@ -1035,7 +1035,7 @@ static int lookup_client(
163
 
         int r;
164
 
         unsigned long pid, uid;
165
 
         unsigned long long starttime;
166
 
-        struct user *u;
167
 
+        struct rtkit_user *u;
168
 
         struct process *p;
169
 
         struct thread *t;
170
 
 
171
 
@@ -1115,7 +1115,7 @@ static int translate_error_backwards(const char *name) {
172
 
         return -EIO;
173
 
 }
174
 
 
175
 
-static int verify_polkit(DBusConnection *c, struct user *u, struct process *p, const char *action) {
176
 
+static int verify_polkit(DBusConnection *c, struct rtkit_user *u, struct process *p, const char *action) {
177
 
         DBusError error;
178
 
         DBusMessage *m = NULL, *r = NULL;
179
 
         const char *unix_process = "unix-process";
180
 
@@ -1236,7 +1236,7 @@ static DBusHandlerResult dbus_handler(DBusConnection *c, DBusMessage *m, void *u
181
 
 
182
 
                 uint64_t thread;
183
 
                 uint32_t priority;
184
 
-                struct user *u;
185
 
+                struct rtkit_user *u;
186
 
                 struct process *p;
187
 
                 struct thread *t;
188
 
                 int ret;
189
 
@@ -1278,7 +1278,7 @@ static DBusHandlerResult dbus_handler(DBusConnection *c, DBusMessage *m, void *u
190
 
 
191
 
                 uint64_t thread;
192
 
                 int32_t priority;
193
 
-                struct user *u;
194
 
+                struct rtkit_user *u;
195
 
                 struct process *p;
196
 
                 struct thread *t;
197
 
                 int ret;
198
 
@@ -2147,7 +2147,7 @@ static int parse_command_line(int argc, char *argv[], int *ret) {
199
 
 int main(int argc, char *argv[]) {
200
 
         DBusConnection *bus = NULL;
201
 
         int ret = 1;
202
 
-        struct user *u;
203
 
+        struct rtkit_user *u;
204
 
 
205
 
         if (parse_command_line(argc, argv, &ret) <= 0)
206
 
                 goto finish;