Altera_Forum
Honored Contributor
21 years agoWhere is fcntl
alt_avalon_uart_read() and alt_avalon_uart_write() routines support a 'O_NONBLOCK' parameter. I'd like to control this flag from my code using the following function:
static void set_block_mode(bool block_mode) {
int cntl = fcntl(STDIN_FILENO, F_GETFL);
if (cntl & O_NONBLOCK)
{
if (block_mode)
fcntl(STDIN_FILENO, F_SETFL, cntl & ~O_NONBLOCK);
}
else
{
if (! block_mode)
fcntl(STDIN_FILENO, F_SETFL, cntl | O_NONBLOCK);
}
} I included <fcntl.h> and compiled my code, but I was not able to link it successfully because fcntl() is not defined in libc. I found another potential way of doing this from the thread entitled "Nios II UART Troubles", but would prefer to handle things with the above routine. Where did the fcntl routine go? Thanks, -Mark