Re-target newlib, but always errno=9.

bernard.xiong
Posts: 6
Joined: Thu May 04, 2017 1:32 pm
Location: Shanghai, China
Contact:

Re-target newlib, but always errno=9.

Postby bernard.xiong » Sun Jun 11, 2017 12:36 am

Hi,
In order to adapt to our VFS interface, I re-target the newlib system call. However, when I invoke printf interface, it always does not call write/write_r interface, and the errno is 9 (EBADF, bad file number). How can I check this issue? And how to compile newlib by myself?

My reent initialization code:

Code: Select all

int reent_std_init(void)
{
    FILE* std_console;
    const char* console = "/dev/console";

    std_console = fopen(console, "w"); // <-- I have checked this position, the open successfully. 

    _GLOBAL_REENT->_stdin  = std_console;
    _GLOBAL_REENT->_stdout = std_console;
    _GLOBAL_REENT->_stderr = std_console;

    return 0;
}

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: Re-target newlib, but always errno=9.

Postby ESP_igrr » Sun Jun 11, 2017 4:50 am

Can you show the part of the code where you register /dev/console via esp_vfs_register?

Who is online

Users browsing this forum: alhimik, Bing [Bot] and 87 guests