Merge pull request #1162 from armink/fix_libc

[libc] Add libc_stdio_get_console .
This commit is contained in:
Bernard Xiong 2018-01-12 20:53:28 +08:00 committed by GitHub
commit 15e7342745
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 0 deletions

View File

@ -31,6 +31,7 @@
int libc_system_init(void);
int libc_stdio_set_console(const char* device_name, int mode);
int libc_stdio_get_console(void);
int libc_stdio_read (void *buffer, size_t size);
int libc_stdio_write(const void *buffer, size_t size);

View File

@ -58,6 +58,11 @@ int libc_stdio_set_console(const char* device_name, int mode)
return std_fd;
}
int libc_stdio_get_console(void)
{
return std_fd;
}
int libc_stdio_read(void *buffer, size_t size)
{
return read(std_fd, buffer, size);

View File

@ -32,6 +32,7 @@
int libc_system_init(void);
int libc_stdio_set_console(const char* device_name, int mode);
int libc_stdio_get_console(void);
int libc_stdio_read (void *buffer, size_t size);
int libc_stdio_write(const void *buffer, size_t size);

View File

@ -58,6 +58,10 @@ int libc_stdio_set_console(const char* device_name, int mode)
return std_fd;
}
int libc_stdio_get_console(void) {
return std_fd;
}
int libc_stdio_read(void *buffer, size_t size)
{
return read(std_fd, buffer, size);

View File

@ -38,6 +38,7 @@
int libc_system_init(void);
int libc_stdio_set_console(const char* device_name, int mode);
int libc_stdio_get_console(void);
/* some time related function */
int libc_set_time(const struct timespec *time);

View File

@ -83,3 +83,10 @@ int libc_stdio_set_console(const char* device_name, int mode)
return fileno(std_console);
}
int libc_stdio_get_console(void) {
if (std_console)
return fileno(std_console);
else
return -1;
}