Changeset 0016674 in mainline for kernel/generic/src/ipc/sysipc.c


Ignore:
Timestamp:
2017-12-09T18:04:23Z (6 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0722869
Parents:
569a51a
Message:

Properly handle errors in SYS_IPC_KBOX.

Also, merge the separate 32/64-bit versions.
There is no reason to optimize such a function this way.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ipc/sysipc.c

    r569a51a r0016674  
    897897}
    898898
    899 #ifdef __32_BITS__
    900 
    901 /** Syscall connect to a task by ID (32 bits)
     899/** Syscall connect to a task by ID
    902900 *
    903901 * @return Error code.
    904902 *
    905903 */
    906 sysarg_t sys_ipc_connect_kbox(sysarg64_t *uspace_taskid, cap_handle_t *uspace_phone)
     904sysarg_t sys_ipc_connect_kbox(task_id_t *uspace_taskid, cap_handle_t *uspace_phone)
    907905{
    908906#ifdef CONFIG_UDEBUG
    909         sysarg64_t taskid;
     907        task_id_t taskid;
    910908        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));
    912911        if (rc == EOK) {
    913912                rc = ipc_connect_kbox((task_id_t) taskid, &phone);
    914913        }
     914       
    915915        if (rc == EOK) {
    916916                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                }
    918921        }
    919922       
     
    924927}
    925928
    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_UDEBUG
    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;
    944 #else
    945         return (sysarg_t) ENOTSUP;
    946 #endif
    947 }
    948 
    949 #endif  /* __64_BITS__ */
    950 
    951929/** @}
    952930 */
Note: See TracChangeset for help on using the changeset viewer.