From bc600ecc3bdf0f189861dfb840f70c2339a7a853 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Fri, 24 May 2024 13:24:27 +0300 Subject: rename common to src + I keep starting to type src and wondering why autocomplete won't work, I guess src is just uncounciously a better name --- src/uapi/irq.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/uapi/irq.c (limited to 'src/uapi/irq.c') diff --git a/src/uapi/irq.c b/src/uapi/irq.c new file mode 100644 index 0000000..6687826 --- /dev/null +++ b/src/uapi/irq.c @@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: copyleft-next-0.3.1 */ +/* Copyright 2023, Kim Kuparinen < kimi.h.kuparinen@gmail.com > */ + +/** + * @file irq.c + * IRQ request syscall handling implementation. + */ + +#include +#include + +/** + * Actual IRQ handling request syscall handler. + * + * @param t Current tcb. + * @param id IRQ id to request to handle. + * + * @return OK on success, non-zero otherwise. + */ +SYSCALL_DEFINE1(irq_req)(struct tcb *t, sys_arg_t id) +{ + if (!has_cap(t->caps, CAP_IRQ)) + return_args1(t, ERR_PERM); + + if (!t->callback) + return_args1(t, ERR_NF); + + return_args1(t, register_irq(t, id)); +} -- cgit v1.3