Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 9233e9d in mainline


Ignore:
Timestamp:
2017-12-08T21:17:27Z (4 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master
Children:
071a1ddb
Parents:
6deb2cd
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2017-12-07 16:48:51)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2017-12-08 21:17:27)
Message:

Return capability handle in SYS_IPC_IRQ_SUBSCRIBE separately from error code.

Files:
7 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/ipc/irq.h

    r6deb2cd r9233e9d  
    5151extern void ipc_irq_top_half_handler(irq_t *);
    5252
    53 extern int ipc_irq_subscribe(answerbox_t *, inr_t, sysarg_t, irq_code_t *);
     53extern int ipc_irq_subscribe(answerbox_t *, inr_t, sysarg_t, irq_code_t *,
     54    cap_handle_t *);
    5455extern int ipc_irq_unsubscribe(answerbox_t *, int);
    5556
  • kernel/generic/include/ipc/sysipc.h

    r6deb2cd r9233e9d  
    5656extern sysarg_t sys_ipc_hangup(sysarg_t);
    5757
    58 extern sysarg_t sys_ipc_irq_subscribe(inr_t, sysarg_t, irq_code_t *);
     58extern sysarg_t sys_ipc_irq_subscribe(inr_t, sysarg_t, irq_code_t *, cap_handle_t *);
    5959extern sysarg_t sys_ipc_irq_unsubscribe(sysarg_t);
    6060
  • kernel/generic/src/ipc/irq.c

    r6deb2cd r9233e9d  
    308308 * @param ucode   Uspace pointer to top-half IRQ code.
    309309 *
    310  * @return  IRQ capability handle.
    311  * @return  Negative error code.
     310 * @param[out] uspace_handle  Uspace pointer to IRQ capability handle
     311 *
     312 * @return  Error code.
    312313 *
    313314 */
    314315int ipc_irq_subscribe(answerbox_t *box, inr_t inr, sysarg_t imethod,
    315     irq_code_t *ucode)
     316    irq_code_t *ucode, cap_handle_t *uspace_handle)
    316317{
    317318        if ((inr < 0) || (inr > last_inr))
     
    333334                return handle;
    334335       
     336        int rc = copy_to_uspace(uspace_handle, &handle, sizeof(cap_handle_t));
     337        if (rc != EOK) {
     338                cap_free(TASK, handle);
     339                return rc;
     340        }
     341
    335342        irq_t *irq = (irq_t *) slab_alloc(irq_cache, FRAME_ATOMIC);
    336343        if (!irq) {
     
    371378        cap_publish(TASK, handle, kobject);
    372379       
    373         return handle;
     380        return EOK;
    374381}
    375382
  • kernel/generic/src/ipc/sysipc.c

    r6deb2cd r9233e9d  
    864864 * @param ucode   Uspace pointer to the top-half pseudocode.
    865865 *
    866  * @return IRQ kernel object capability
     866 * @param[out] uspace_handle  Uspace pointer to IRQ kernel object capability
     867 *
    867868 * @return EPERM
    868869 * @return Error code returned by ipc_irq_subscribe().
    869870 *
    870871 */
    871 sysarg_t sys_ipc_irq_subscribe(inr_t inr, sysarg_t imethod, irq_code_t *ucode)
     872sysarg_t sys_ipc_irq_subscribe(inr_t inr, sysarg_t imethod, irq_code_t *ucode,
     873        cap_handle_t *uspace_handle)
    872874{
    873875        if (!(perm_get(TASK) & PERM_IRQ_REG))
    874876                return EPERM;
    875877       
    876         return ipc_irq_subscribe(&TASK->answerbox, inr, imethod, ucode);
     878        return ipc_irq_subscribe(&TASK->answerbox, inr, imethod, ucode, uspace_handle);
    877879}
    878880
  • uspace/lib/c/generic/async.c

    r6deb2cd r9233e9d  
    10761076        futex_up(&async_futex);
    10771077       
    1078         return ipc_irq_subscribe(inr, imethod, ucode);
     1078        cap_handle_t cap;
     1079        int rc = ipc_irq_subscribe(inr, imethod, ucode, &cap);
     1080        if (rc != EOK) {
     1081                return rc;
     1082        }
     1083        return cap;
    10791084}
    10801085
  • uspace/lib/c/generic/irq.c

    r6deb2cd r9233e9d  
    5858 * @param ucode  Top-half pseudocode handler.
    5959 *
    60  * @return IRQ capability handle returned by the kernel.
     60 * @param[out] out_handle  IRQ capability handle returned by the kernel.
     61 *
    6162 * @return Error code returned by the kernel.
    6263 *
    6364 */
    64 int ipc_irq_subscribe(int inr, sysarg_t method, const irq_code_t *ucode)
     65int ipc_irq_subscribe(int inr, sysarg_t method, const irq_code_t *ucode,
     66    cap_handle_t *out_handle)
    6567{
    6668        if (ucode == NULL)
    6769                ucode = &default_ucode;
    6870       
    69         return __SYSCALL3(SYS_IPC_IRQ_SUBSCRIBE, inr, method, (sysarg_t) ucode);
     71        return __SYSCALL4(SYS_IPC_IRQ_SUBSCRIBE, inr, method, (sysarg_t) ucode,
     72            (sysarg_t) out_handle);
    7073}
    7174
     
    7780 *
    7881 */
    79 int ipc_irq_unsubscribe(int cap)
     82int ipc_irq_unsubscribe(cap_handle_t cap)
    8083{
    8184        return __SYSCALL1(SYS_IPC_IRQ_UNSUBSCRIBE, cap);
  • uspace/lib/c/include/ipc/irq.h

    r6deb2cd r9233e9d  
    3838#include <types/common.h>
    3939#include <abi/ddi/irq.h>
     40#include <abi/cap.h>
    4041
    41 extern int ipc_irq_subscribe(int, sysarg_t, const irq_code_t *);
    42 extern int ipc_irq_unsubscribe(int);
     42extern int ipc_irq_subscribe(int, sysarg_t, const irq_code_t *, cap_handle_t *);
     43extern int ipc_irq_unsubscribe(cap_handle_t);
    4344
    4445#endif
Note: See TracChangeset for help on using the changeset viewer.