Changeset 09d01f2 in mainline
- Timestamp:
- 2017-12-18T17:40:52Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2024096, 23d4515
- Parents:
- 6a32cc5f
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2017-12-18 15:39:01)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2017-12-18 17:40:52)
- Location:
- kernel/generic
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/cap/cap.h
r6a32cc5f r09d01f2 121 121 bool (*)(cap_t *, void *), void *); 122 122 123 extern cap_handle_t cap_alloc(struct task*);123 extern int cap_alloc(struct task *, cap_handle_t *); 124 124 extern void cap_publish(struct task *, cap_handle_t, kobject_t *); 125 125 extern kobject_t *cap_unpublish(struct task *, cap_handle_t, kobject_type_t); -
kernel/generic/include/ipc/ipcrsc.h
r6a32cc5f r09d01f2 40 40 #include <cap/cap.h> 41 41 42 extern cap_handle_t phone_alloc(task_t *);42 extern int phone_alloc(task_t *, cap_handle_t *); 43 43 extern bool phone_connect(cap_handle_t, answerbox_t *); 44 44 extern void phone_dealloc(cap_handle_t); -
kernel/generic/src/cap/cap.c
r6a32cc5f r09d01f2 257 257 * @param task Task for which to allocate the new capability. 258 258 * 259 * @return New capability handle on success. 259 * @param[out] handle New capability handle on success. 260 * 260 261 * @return Negative error code in case of error. 261 262 */ 262 cap_handle_t cap_alloc(task_t *task)263 int cap_alloc(task_t *task, cap_handle_t *handle) 263 264 { 264 265 cap_t *cap = NULL; 265 cap_handle_t handle;266 266 267 267 /* … … 293 293 294 294 cap->state = CAP_STATE_ALLOCATED; 295 handle = cap->handle;296 mutex_unlock(&task->cap_info->lock); 297 298 return handle;295 *handle = cap->handle; 296 mutex_unlock(&task->cap_info->lock); 297 298 return EOK; 299 299 } 300 300 -
kernel/generic/src/ipc/ipcrsc.c
r6a32cc5f r09d01f2 166 166 * @param task Task for which to allocate a new phone. 167 167 * 168 * @return New phone capability handle. 168 * @param[out] out_handle New phone capability handle. 169 * 169 170 * @return Negative error code if a new capability cannot be allocated. 170 171 */ 171 cap_handle_t phone_alloc(task_t *task) 172 { 173 cap_handle_t handle = cap_alloc(task); 174 if (handle >= 0) { 172 int phone_alloc(task_t *task, cap_handle_t *out_handle) 173 { 174 cap_handle_t handle; 175 int rc = cap_alloc(task, &handle); 176 if (rc == EOK) { 175 177 phone_t *phone = slab_alloc(phone_cache, FRAME_ATOMIC); 176 178 if (!phone) { … … 193 195 194 196 cap_publish(task, handle, kobject); 197 198 *out_handle = handle; 195 199 } 196 197 return handle; 200 return rc; 198 201 } 199 202 -
kernel/generic/src/ipc/irq.c
r6a32cc5f r09d01f2 330 330 * Allocate and populate the IRQ kernel object. 331 331 */ 332 cap_handle_t handle = cap_alloc(TASK); 333 if (handle < 0) 334 return handle; 335 336 int rc = copy_to_uspace(uspace_handle, &handle, sizeof(cap_handle_t)); 332 cap_handle_t handle; 333 int rc = cap_alloc(TASK, &handle); 334 if (rc != EOK) 335 return rc; 336 337 rc = copy_to_uspace(uspace_handle, &handle, sizeof(cap_handle_t)); 337 338 if (rc != EOK) { 338 339 cap_free(TASK, handle); -
kernel/generic/src/ipc/kbox.c
r6a32cc5f r09d01f2 252 252 253 253 /* Allocate a new phone. */ 254 cap_handle_t phone_handle = phone_alloc(TASK); 255 if (phone_handle < 0) { 254 cap_handle_t phone_handle; 255 int rc = phone_alloc(TASK, &phone_handle); 256 if (rc != EOK) { 256 257 mutex_unlock(&task->kb.cleanup_lock); 257 return phone_handle;258 return rc; 258 259 } 259 260 -
kernel/generic/src/ipc/ops/conctmeto.c
r6a32cc5f r09d01f2 42 42 static int request_preprocess(call_t *call, phone_t *phone) 43 43 { 44 cap_handle_t phone_handle = phone_alloc(TASK); 44 cap_handle_t phone_handle; 45 int rc = phone_alloc(TASK, &phone_handle); 45 46 46 /* Remember the phone capability or the error. */ 47 call->priv = phone_handle; 48 if (phone_handle < 0) 49 return phone_handle; 47 /* Remember the phone capability or that an error occured. */ 48 call->priv = (rc == EOK) ? phone_handle : -1; 49 50 if (rc != EOK) { 51 return rc; 52 } 50 53 51 54 /* Set arg5 for server */ … … 61 64 { 62 65 cap_handle_t phone_handle = (cap_handle_t) call->priv; 66 67 if (phone_handle < 0) { 68 return EOK; 69 } 70 63 71 phone_dealloc(phone_handle); 64 72 /* Hand over reference from ARG5 to phone->kobject */ -
kernel/generic/src/ipc/ops/concttome.c
r6a32cc5f r09d01f2 42 42 static int request_process(call_t *call, answerbox_t *box) 43 43 { 44 cap_handle_t phone_handle = phone_alloc(TASK); 45 46 IPC_SET_ARG5(call->data, phone_handle); 47 48 return EOK; 44 cap_handle_t phone_handle; 45 int rc = phone_alloc(TASK, &phone_handle); 46 IPC_SET_ARG5(call->data, (rc == EOK) ? phone_handle : -1); 47 return 0; 49 48 } 50 49 -
kernel/generic/src/ipc/sysipc.c
r6a32cc5f r09d01f2 804 804 goto restart; 805 805 806 int rc; 807 cap_handle_t handle = cap_alloc(TASK); 808 if (handle < 0) { 809 rc = handle; 806 cap_handle_t handle; 807 int rc = cap_alloc(TASK, &handle); 808 if (rc != EOK) { 810 809 goto error; 811 810 } -
kernel/generic/src/proc/task.c
r6a32cc5f r09d01f2 245 245 if ((ipc_phone_0) && 246 246 (container_check(ipc_phone_0->task->container, task->container))) { 247 cap_handle_t phone_handle = phone_alloc(task); 248 if (phone_handle < 0) { 247 cap_handle_t phone_handle; 248 int rc = phone_alloc(task, &phone_handle); 249 if (rc != EOK) { 249 250 task->as = NULL; 250 251 task_destroy_arch(task);
Note:
See TracChangeset
for help on using the changeset viewer.