Commit 797e0544 authored by Kevin Wolf's avatar Kevin Wolf

kernel2: LIO_IOCTL_ISATTY

+ kernel2: Unterstützung für LIO_IOCTL_ISATTY, was einfach bei Terminals
  Erfolg und bei allem anderen einen Fehler zurückgibt

+ vterm: Terminals als solche markieren, damit der Kernel das bei
  LIO_IOCTL_ISATTY berücksichtigen kann
Signed-off-by: Kevin Wolf's avatarKevin Wolf <kevin@tyndur.org>
parent 9d840e8b
......@@ -196,6 +196,11 @@ enum lio_stat_flags {
LIO_FLAG_PIPE = 128,
};
enum lio_ioctl_cmds {
/** Gibt Erfolg zurück, wenn die Ressource ein Terminal ist */
LIO_IOCTL_ISATTY = 1,
};
/**
* Beschreibt eine Ressource
*/
......@@ -575,6 +580,7 @@ enum lio_server_flags {
LIO_SRV_RETARGETABLE = 128,
LIO_SRV_PIPE = 256,
LIO_SRV_TRANSLATED = 512,
LIO_SRV_IS_TERMINAL = 1024,
};
......
......@@ -752,7 +752,15 @@ int lio_close(struct lio_stream* s)
*/
int lio_ioctl(struct lio_stream* s, int cmd)
{
return -ENOTTY;
switch (cmd) {
case LIO_IOCTL_ISATTY:
if (s->res->is_terminal) {
return 0;
}
return -ENOTTY;
default:
return -ENOTTY;
}
}
/**
......
......@@ -187,6 +187,7 @@ struct lio_resource {
bool changeable;
bool resolvable;
bool retargetable;
bool is_terminal;
/**
* Wird aufgerufen, wenn sich die Größe einer Ressource ändert (dies
......
......@@ -278,6 +278,7 @@ int syscall_lio_srv_res_upload(struct lio_server_resource* resource)
if (translated) {
return -EINVAL;
}
res->is_terminal = ((resource->flags & LIO_SRV_IS_TERMINAL) ? 1 : 0);
res->opaque = resource->opaque;
/* Auch aufrufen falls sich die Größe nicht geändert hat: moredata könnte
......
......@@ -348,6 +348,7 @@ struct lio_resource {
bool retargetable;
bool ispipe;
bool translated;
bool is_terminal;
struct lio_tree* tree;
void* opaque;
......
......@@ -469,7 +469,8 @@ void lio_resource_modified(struct lio_resource* res)
(res->resolvable ? LIO_SRV_RESOLVABLE : 0) |
(res->retargetable ? LIO_SRV_RETARGETABLE : 0) |
(res->ispipe ? LIO_SRV_PIPE : 0) |
(res->translated ? LIO_SRV_TRANSLATED : 0);
(res->translated ? LIO_SRV_TRANSLATED : 0) |
(res->is_terminal ? LIO_SRV_IS_TERMINAL: 0);
res->server.tree = res->tree->id;
res->server.opaque = res;
......
......@@ -73,6 +73,7 @@ static void lio_add_vterm_dir(vterminal_t* vterm)
in_node->readable = 1;
in_node->blocksize = 1;
in_node->moredata = 1;
in_node->is_terminal = true;
in_node->opaque = lv;
lio_resource_modified(in_node);
lio_node_create(dir, in_node, "in");
......@@ -89,6 +90,7 @@ static void lio_add_vterm_dir(vterminal_t* vterm)
out_node = lio_resource_create(tree);
out_node->writable = 1;
out_node->blocksize = 1;
out_node->is_terminal = true;
out_node->opaque = lv;
lio_resource_modified(out_node);
lio_node_create(dir, out_node, "out");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment