Subversion Repositories HelenOS-historic

Rev

Rev 1297 | Rev 1702 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1297 Rev 1588
Line 110... Line 110...
110
    if (!t) {
110
    if (!t) {
111
        spinlock_unlock(&tasks_lock);
111
        spinlock_unlock(&tasks_lock);
112
        interrupts_restore(ipl);
112
        interrupts_restore(ipl);
113
        return (__native) ENOENT;
113
        return (__native) ENOENT;
114
    }
114
    }
115
    spinlock_unlock(&tasks_lock);
-
 
116
   
115
   
-
 
116
    spinlock_lock(&t->lock);
117
    cap_set(t, cap_get(t) | caps);
117
    cap_set(t, cap_get(t) | caps);
-
 
118
    spinlock_unlock(&t->lock);
-
 
119
   
-
 
120
    spinlock_unlock(&tasks_lock);
-
 
121
   
-
 
122
 
118
   
123
   
119
    interrupts_restore(ipl);   
124
    interrupts_restore(ipl);   
120
    return 0;
125
    return 0;
121
}
126
}
122
 
127
 
Line 147... Line 152...
147
    if (!t) {
152
    if (!t) {
148
        spinlock_unlock(&tasks_lock);
153
        spinlock_unlock(&tasks_lock);
149
        interrupts_restore(ipl);
154
        interrupts_restore(ipl);
150
        return (__native) ENOENT;
155
        return (__native) ENOENT;
151
    }
156
    }
152
    spinlock_unlock(&tasks_lock);
-
 
153
 
157
 
154
    /*
158
    /*
155
     * Revoking capabilities is different from granting them in that
159
     * Revoking capabilities is different from granting them in that
156
     * a task can revoke capabilities from itself even if it
160
     * a task can revoke capabilities from itself even if it
157
     * doesn't have CAP_CAP.
161
     * doesn't have CAP_CAP.
158
     */
162
     */
159
    if (!(cap_get(TASK) & CAP_CAP) || !(t == TASK)) {
163
    if (!(cap_get(TASK) & CAP_CAP) || !(t == TASK)) {
-
 
164
        spinlock_unlock(&tasks_lock);
160
        interrupts_restore(ipl);
165
        interrupts_restore(ipl);
161
        return (__native) EPERM;
166
        return (__native) EPERM;
162
    }
167
    }
163
 
-
 
164
    cap_set(t, cap_get(t) & ~caps);
-
 
165
   
168
   
-
 
169
    spinlock_lock(&t->lock);
-
 
170
    cap_set(t, cap_get(t) & ~caps);
-
 
171
    spinlock_unlock(&t->lock);
-
 
172
 
-
 
173
    spinlock_unlock(&tasks_lock);
-
 
174
 
166
    interrupts_restore(ipl);
175
    interrupts_restore(ipl);
167
    return 0;
176
    return 0;
168
}
177
}