Suspend process waiting for keyboard input
All checks were successful
Build documentation / build-and-deploy (push) Successful in 1m35s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 1m35s
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include <proc/capability.h>
|
||||
#include <proc/proc.h>
|
||||
#include <sys/debug.h>
|
||||
#include <sys/smp.h>
|
||||
|
||||
struct flanterm_context* ft_ctx;
|
||||
|
||||
@@ -34,19 +35,25 @@ bool terminal_init (void* arg) {
|
||||
|
||||
void terminal_fini (void) {}
|
||||
|
||||
int terminal_putstr (struct proc* proc, void* a1, void* a2, void* a3, void* a4) {
|
||||
(void)a2, (void)a3, (void)a4;
|
||||
bool terminal_putstr (struct proc* proc, struct cpu** reschedule_cpu, int* ret, void* a1, void* a2,
|
||||
void* a3, void* a4) {
|
||||
(void)reschedule_cpu, (void)a2, (void)a3, (void)a4;
|
||||
|
||||
if (!(proc->procgroup->capabilities & PROC_CAP_TERMINAL))
|
||||
return -ST_PERMISSION_ERROR;
|
||||
if (!(proc->procgroup->capabilities & PROC_CAP_TERMINAL)) {
|
||||
*ret = -ST_PERMISSION_ERROR;
|
||||
return PROC_NO_RESCHEDULE;
|
||||
}
|
||||
|
||||
char* string = (char*)a1;
|
||||
size_t* len = (size_t*)a2;
|
||||
|
||||
if (string == NULL || len == NULL)
|
||||
return -ST_BAD_ADDRESS_SPACE;
|
||||
if (string == NULL || len == NULL) {
|
||||
*ret = -ST_BAD_ADDRESS_SPACE;
|
||||
return PROC_NO_RESCHEDULE;
|
||||
}
|
||||
|
||||
flanterm_write (ft_ctx, string, *len);
|
||||
|
||||
return ST_OK;
|
||||
*ret = ST_OK;
|
||||
return PROC_NO_RESCHEDULE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user