Changeset 569a51a in mainline
- Timestamp:
- 2017-12-08T21:17:27Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0016674
- Parents:
- 071a1ddb
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2017-12-07 16:35:29)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2017-12-08 21:17:27)
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/ipc/kbox.h
r071a1ddb r569a51a 50 50 } kbox_t; 51 51 52 extern int ipc_connect_kbox(task_id_t );52 extern int ipc_connect_kbox(task_id_t, cap_handle_t *); 53 53 extern void ipc_kbox_cleanup(void); 54 54 -
kernel/generic/include/ipc/sysipc.h
r071a1ddb r569a51a 61 61 #ifdef __32_BITS__ 62 62 63 extern sysarg_t sys_ipc_connect_kbox(sysarg64_t * );63 extern sysarg_t sys_ipc_connect_kbox(sysarg64_t *, cap_handle_t *); 64 64 65 65 #endif /* __32_BITS__ */ … … 67 67 #ifdef __64_BITS__ 68 68 69 extern sysarg_t sys_ipc_connect_kbox(sysarg_t );69 extern sysarg_t sys_ipc_connect_kbox(sysarg_t, cap_handle_t *); 70 70 71 71 #endif /* __64_BITS__ */ -
kernel/generic/src/ipc/kbox.c
r071a1ddb r569a51a 206 206 * cleanup code. 207 207 * 208 * @return Phone capability handle on success, or negative error code. 209 * 210 */ 211 int ipc_connect_kbox(task_id_t taskid) 208 * @param[out] out_phone Phone capability handle on success. 209 * @return Error code. 210 * 211 */ 212 int ipc_connect_kbox(task_id_t taskid, cap_handle_t *out_phone) 212 213 { 213 214 irq_spinlock_lock(&tasks_lock, true); … … 250 251 if (task->kb.thread != NULL) { 251 252 mutex_unlock(&task->kb.cleanup_lock); 252 return phone_handle; 253 *out_phone = phone_handle; 254 return EOK; 253 255 } 254 256 … … 257 259 THREAD_FLAG_NONE, "kbox"); 258 260 if (!kb_thread) { 261 // FIXME: Shouldn't we clean up phone_handle? 259 262 mutex_unlock(&task->kb.cleanup_lock); 260 263 return ENOMEM; … … 266 269 mutex_unlock(&task->kb.cleanup_lock); 267 270 268 return phone_handle; 271 *out_phone = phone_handle; 272 return EOK; 269 273 } 270 274 -
kernel/generic/src/ipc/sysipc.c
r071a1ddb r569a51a 901 901 /** Syscall connect to a task by ID (32 bits) 902 902 * 903 * @return Phone id on success, or negative error code.904 * 905 */ 906 sysarg_t sys_ipc_connect_kbox(sysarg64_t *uspace_taskid )903 * @return Error code. 904 * 905 */ 906 sysarg_t sys_ipc_connect_kbox(sysarg64_t *uspace_taskid, cap_handle_t *uspace_phone) 907 907 { 908 908 #ifdef CONFIG_UDEBUG 909 909 sysarg64_t taskid; 910 cap_handle_t phone; 910 911 int rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(sysarg64_t)); 911 if (rc != 0) 912 return (sysarg_t) rc; 913 914 return ipc_connect_kbox((task_id_t) taskid); 912 if (rc == EOK) { 913 rc = ipc_connect_kbox((task_id_t) taskid, &phone); 914 } 915 if (rc == EOK) { 916 rc = copy_to_uspace(uspace_phone, &phone, sizeof(cap_handle_t)); 917 // FIXME: Clean up phone on failure. 918 } 919 920 return (sysarg_t) rc; 915 921 #else 916 922 return (sysarg_t) ENOTSUP; … … 924 930 /** Syscall connect to a task by ID (64 bits) 925 931 * 926 * @return Phone id on success, or negative error code.927 * 928 */ 929 sysarg_t sys_ipc_connect_kbox(sysarg_t taskid )932 * @return Error code. 933 * 934 */ 935 sysarg_t sys_ipc_connect_kbox(sysarg_t taskid, cap_handle_t *uspace_phone) 930 936 { 931 937 #ifdef CONFIG_UDEBUG 932 return ipc_connect_kbox((task_id_t) taskid); 938 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; 933 944 #else 934 945 return (sysarg_t) ENOTSUP; -
uspace/lib/c/generic/async.c
r071a1ddb r569a51a 2398 2398 } 2399 2399 2400 int phone = ipc_connect_kbox(id); 2401 if (phone < 0) { 2402 errno = phone; 2400 cap_handle_t phone; 2401 int rc = ipc_connect_kbox(id, &phone); 2402 if (rc != EOK) { 2403 errno = rc; 2403 2404 free(sess); 2404 2405 return NULL; -
uspace/lib/c/generic/ipc.c
r071a1ddb r569a51a 377 377 * 378 378 */ 379 int ipc_connect_kbox(task_id_t id )379 int ipc_connect_kbox(task_id_t id, cap_handle_t *phone) 380 380 { 381 381 #ifdef __32_BITS__ 382 382 sysarg64_t arg = (sysarg64_t) id; 383 return __SYSCALL 1(SYS_IPC_CONNECT_KBOX, (sysarg_t) &arg);383 return __SYSCALL2(SYS_IPC_CONNECT_KBOX, (sysarg_t) &arg, (sysarg_t) phone); 384 384 #endif 385 386 385 #ifdef __64_BITS__ 387 return __SYSCALL 1(SYS_IPC_CONNECT_KBOX, (sysarg_t) id);386 return __SYSCALL2(SYS_IPC_CONNECT_KBOX, (sysarg_t) id, (sysarg_t) phone); 388 387 #endif 389 388 } -
uspace/lib/c/include/ipc/ipc.h
r071a1ddb r569a51a 122 122 sysarg_t, sysarg_t, sysarg_t, sysarg_t, unsigned int); 123 123 124 extern int ipc_connect_kbox(task_id_t );124 extern int ipc_connect_kbox(task_id_t, cap_handle_t *); 125 125 126 126 #endif
Note:
See TracChangeset
for help on using the changeset viewer.