Page 1 of 1

Re-target newlib, but always errno=9.

Posted: Sun Jun 11, 2017 12:36 am
by bernard.xiong
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;
}

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

Posted: Sun Jun 11, 2017 4:50 am
by ESP_igrr
Can you show the part of the code where you register /dev/console via esp_vfs_register?