git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Support to multi-threading and pthread interface (POSIX.1-2008) (#23)
[lunaix-os.git]
/
lunaix-os
/
hal
/
term
/
term.c
diff --git
a/lunaix-os/hal/term/term.c
b/lunaix-os/hal/term/term.c
index 3cc9741cce9ca47e00bb40801d7283c6580185a4..3db875903761375fd575a265662659279fd9d4df 100644
(file)
--- a/
lunaix-os/hal/term/term.c
+++ b/
lunaix-os/hal/term/term.c
@@
-136,7
+136,7
@@
tdev_do_write(struct device* dev, void* buf, off_t fpos, size_t len)
if (!rbuffer_empty(deref(current))) {
term_flush(tdev);
}
if (!rbuffer_empty(deref(current))) {
term_flush(tdev);
}
- return
0
;
+ return
wrsz
;
}
static int
}
static int
@@
-170,6
+170,14
@@
load_default_setting(struct term* tdev)
memcpy(tdev->cc, default_cc, _NCCS * sizeof(cc_t));
}
memcpy(tdev->cc, default_cc, _NCCS * sizeof(cc_t));
}
+static void
+alloc_term_buffer(struct term* terminal, size_t sz_hlf)
+{
+ line_alloc(&terminal->line_in, sz_hlf);
+ line_alloc(&terminal->line_out, sz_hlf);
+ terminal->scratch_pad = valloc(sz_hlf);
+}
+
struct term*
term_create(struct device* chardev, char* suffix)
{
struct term*
term_create(struct device* chardev, char* suffix)
{
@@
-189,8
+197,7
@@
term_create(struct device* chardev, char* suffix)
// TODO choice of lcntl can be flexible
terminal->lcntl = line_controls[ANSI_LCNTL];
// TODO choice of lcntl can be flexible
terminal->lcntl = line_controls[ANSI_LCNTL];
- line_alloc(&terminal->line_in, 1024);
- line_alloc(&terminal->line_out, 1024);
+ alloc_term_buffer(terminal, 1024);
if (chardev) {
int cdev_var = DEV_VAR_FROM(chardev->ident.unique);
if (chardev) {
int cdev_var = DEV_VAR_FROM(chardev->ident.unique);