numam-dpdk/lib/cmdline/cmdline_os_unix.c
Bruce Richardson 99a2dd955f lib: remove librte_ prefix from directory names
There is no reason for the DPDK libraries to all have 'librte_' prefix on
the directory names. This prefix makes the directory names longer and also
makes it awkward to add features referring to individual libraries in the
build - should the lib names be specified with or without the prefix.
Therefore, we can just remove the library prefix and use the library's
unique name as the directory name, i.e. 'eal' rather than 'librte_eal'

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2021-04-21 14:04:09 +02:00

54 lines
858 B
C

/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (c) 2020 Dmitry Kozlyuk
*/
#include <poll.h>
#include <string.h>
#include <unistd.h>
#include "cmdline_private.h"
void
terminal_adjust(struct cmdline *cl)
{
struct termios term;
tcgetattr(0, &cl->oldterm);
memcpy(&term, &cl->oldterm, sizeof(term));
term.c_lflag &= ~(ICANON | ECHO | ISIG);
tcsetattr(0, TCSANOW, &term);
setbuf(stdin, NULL);
}
void
terminal_restore(const struct cmdline *cl)
{
tcsetattr(fileno(stdin), TCSANOW, &cl->oldterm);
}
int
cmdline_poll_char(struct cmdline *cl)
{
struct pollfd pfd;
pfd.fd = cl->s_in;
pfd.events = POLLIN;
pfd.revents = 0;
return poll(&pfd, 1, 0);
}
ssize_t
cmdline_read_char(struct cmdline *cl, char *c)
{
return read(cl->s_in, c, 1);
}
int
cmdline_vdprintf(int fd, const char *format, va_list op)
{
return vdprintf(fd, format, op);
}