Changeset 0016674 in mainline for kernel/generic/src
- Timestamp:
- 2017-12-09T18:04:23Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0722869
- Parents:
- 569a51a
- Location:
- kernel/generic/src/ipc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ipc/kbox.c
r569a51a r0016674 232 232 } 233 233 234 if (task->kb.finished != false) {234 if (task->kb.finished) { 235 235 mutex_unlock(&task->kb.cleanup_lock); 236 236 return EINVAL; 237 237 } 238 238 239 /* Create a kbox thread if necessary. */ 240 if (task->kb.thread == NULL) { 241 thread_t *kb_thread = thread_create(kbox_thread_proc, NULL, task, 242 THREAD_FLAG_NONE, "kbox"); 243 244 if (!kb_thread) { 245 mutex_unlock(&task->kb.cleanup_lock); 246 return ENOMEM; 247 } 248 249 task->kb.thread = kb_thread; 250 thread_ready(kb_thread); 251 } 252 253 /* Allocate a new phone. */ 239 254 cap_handle_t phone_handle = phone_alloc(TASK); 240 255 if (phone_handle < 0) { … … 249 264 (void) ipc_phone_connect(phone_obj->phone, &task->kb.box); 250 265 251 if (task->kb.thread != NULL) {252 mutex_unlock(&task->kb.cleanup_lock);253 *out_phone = phone_handle;254 return EOK;255 }256 257 /* Create a kbox thread */258 thread_t *kb_thread = thread_create(kbox_thread_proc, NULL, task,259 THREAD_FLAG_NONE, "kbox");260 if (!kb_thread) {261 // FIXME: Shouldn't we clean up phone_handle?262 mutex_unlock(&task->kb.cleanup_lock);263 return ENOMEM;264 }265 266 task->kb.thread = kb_thread;267 thread_ready(kb_thread);268 269 266 mutex_unlock(&task->kb.cleanup_lock); 270 271 267 *out_phone = phone_handle; 272 268 return EOK; -
kernel/generic/src/ipc/sysipc.c
r569a51a r0016674 897 897 } 898 898 899 #ifdef __32_BITS__ 900 901 /** Syscall connect to a task by ID (32 bits) 899 /** Syscall connect to a task by ID 902 900 * 903 901 * @return Error code. 904 902 * 905 903 */ 906 sysarg_t sys_ipc_connect_kbox( sysarg64_t *uspace_taskid, cap_handle_t *uspace_phone)904 sysarg_t sys_ipc_connect_kbox(task_id_t *uspace_taskid, cap_handle_t *uspace_phone) 907 905 { 908 906 #ifdef CONFIG_UDEBUG 909 sysarg64_t taskid;907 task_id_t taskid; 910 908 cap_handle_t phone; 911 int rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(sysarg64_t)); 909 910 int rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(task_id_t)); 912 911 if (rc == EOK) { 913 912 rc = ipc_connect_kbox((task_id_t) taskid, &phone); 914 913 } 914 915 915 if (rc == EOK) { 916 916 rc = copy_to_uspace(uspace_phone, &phone, sizeof(cap_handle_t)); 917 // FIXME: Clean up phone on failure. 917 if (rc != EOK) { 918 // Clean up the phone on failure. 919 sys_ipc_hangup(phone); 920 } 918 921 } 919 922 … … 924 927 } 925 928 926 #endif /* __32_BITS__ */927 928 #ifdef __64_BITS__929 930 /** Syscall connect to a task by ID (64 bits)931 *932 * @return Error code.933 *934 */935 sysarg_t sys_ipc_connect_kbox(sysarg_t taskid, cap_handle_t *uspace_phone)936 {937 #ifdef CONFIG_UDEBUG938 cap_handle_t phone;939 int rc = ipc_connect_kbox((task_id_t) taskid, &phone);940 if (rc == EOK) {941 rc = copy_to_uspace(uspace_phone, &phone, sizeof(cap_handle_t));942 }943 return (sysarg_t) rc;944 #else945 return (sysarg_t) ENOTSUP;946 #endif947 }948 949 #endif /* __64_BITS__ */950 951 929 /** @} 952 930 */
Note:
See TracChangeset
for help on using the changeset viewer.