Implement TERMINAL_DIMENSIONS op for the terminal device, CE add terminfo command
All checks were successful
Build documentation / build-and-deploy (push) Successful in 1m59s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 1m59s
This commit is contained in:
@@ -86,6 +86,7 @@ struct device* device_create (const char* key, device_op_func_t* ops, size_t ops
|
||||
void terminal_device_init (void) {
|
||||
device_op_func_t ops[] = {
|
||||
[TERMINAL_PUTSTR] = &terminal_putstr,
|
||||
[TERMINAL_DIMENSIONS] = &terminal_dimensions,
|
||||
};
|
||||
device_create ("TERMINAL", ops, lengthof (ops), &terminal_init, &terminal_fini, NULL);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ void terminal_fini (struct device* device) { (void)device; }
|
||||
|
||||
int terminal_putstr (struct device* device, struct proc* proc, struct reschedule_ctx* rctx,
|
||||
void* a1, void* a2, void* a3, void* a4) {
|
||||
(void)a2, (void)a3, (void)a4, (void)device;
|
||||
(void)a2, (void)a3, (void)a4, (void)device, (void)rctx;
|
||||
|
||||
if (!(proc->procgroup->capabilities & PROC_CAP_TERMINAL))
|
||||
return -ST_PERMISSION_ERROR;
|
||||
@@ -52,3 +52,15 @@ int terminal_putstr (struct device* device, struct proc* proc, struct reschedule
|
||||
|
||||
return ST_OK;
|
||||
}
|
||||
|
||||
int terminal_dimensions (struct device* device, struct proc* proc, struct reschedule_ctx* rctx,
|
||||
void* a1, void* a2, void* a3, void* a4) {
|
||||
(void)proc, (void)rctx, (void)a3, (void)a4, (void)device;
|
||||
|
||||
if (a1 == NULL || a2 == NULL)
|
||||
return -ST_BAD_ADDRESS_SPACE;
|
||||
|
||||
flanterm_get_dimensions (ft_ctx, (size_t*)a1, (size_t*)a2);
|
||||
|
||||
return ST_OK;
|
||||
}
|
||||
|
||||
@@ -16,4 +16,7 @@ void terminal_fini (struct device* device);
|
||||
int terminal_putstr (struct device* device, struct proc* proc, struct reschedule_ctx* rctx,
|
||||
void* a1, void* a2, void* a3, void* a4);
|
||||
|
||||
int terminal_dimensions (struct device* device, struct proc* proc, struct reschedule_ctx* rctx,
|
||||
void* a1, void* a2, void* a3, void* a4);
|
||||
|
||||
#endif // _KERNEL_DEVICE_TERMINAL_H
|
||||
|
||||
Reference in New Issue
Block a user