cleanup some qemu/util code
This commit is contained in:
@ -137,47 +137,3 @@ void qemu_anon_ram_free(void *ptr, size_t size)
|
||||
munmap(ptr, size);
|
||||
}
|
||||
}
|
||||
|
||||
void qemu_set_cloexec(int fd)
|
||||
{
|
||||
int f;
|
||||
f = fcntl(fd, F_GETFD);
|
||||
fcntl(fd, F_SETFD, f | FD_CLOEXEC);
|
||||
}
|
||||
|
||||
/*
|
||||
* Creates a pipe with FD_CLOEXEC set on both file descriptors
|
||||
*/
|
||||
int qemu_pipe(int pipefd[2])
|
||||
{
|
||||
int ret;
|
||||
|
||||
#ifdef CONFIG_PIPE2
|
||||
ret = pipe2(pipefd, O_CLOEXEC);
|
||||
if (ret != -1 || errno != ENOSYS) {
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
ret = pipe(pipefd);
|
||||
if (ret == 0) {
|
||||
qemu_set_cloexec(pipefd[0]);
|
||||
qemu_set_cloexec(pipefd[1]);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void qemu_set_tty_echo(int fd, bool echo)
|
||||
{
|
||||
struct termios tty;
|
||||
|
||||
tcgetattr(fd, &tty);
|
||||
|
||||
if (echo) {
|
||||
tty.c_lflag |= ECHO | ECHONL | ICANON | IEXTEN;
|
||||
} else {
|
||||
tty.c_lflag &= ~(ECHO | ECHONL | ICANON | IEXTEN);
|
||||
}
|
||||
|
||||
tcsetattr(fd, TCSANOW, &tty);
|
||||
}
|
||||
|
@ -115,21 +115,6 @@ struct tm *localtime_r(const time_t *timep, struct tm *result)
|
||||
return p;
|
||||
}
|
||||
|
||||
/*
|
||||
int inet_aton(const char *cp, struct in_addr *ia)
|
||||
{
|
||||
uint32_t addr = inet_addr(cp);
|
||||
if (addr == 0xffffffff) {
|
||||
return 0;
|
||||
}
|
||||
ia->s_addr = addr;
|
||||
return 1;
|
||||
}*/
|
||||
|
||||
void qemu_set_cloexec(int fd)
|
||||
{
|
||||
}
|
||||
|
||||
/* Offset between 1/1/1601 and 1/1/1970 in 100 nanosec units */
|
||||
#define _W32_FT_OFFSET (116444736000000000ULL)
|
||||
|
||||
@ -150,25 +135,6 @@ int qemu_gettimeofday(qemu_timeval *tp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void qemu_set_tty_echo(int fd, bool echo)
|
||||
{
|
||||
HANDLE handle = (HANDLE)_get_osfhandle(fd);
|
||||
DWORD dwMode = 0;
|
||||
|
||||
if (handle == INVALID_HANDLE_VALUE) {
|
||||
return;
|
||||
}
|
||||
|
||||
GetConsoleMode(handle, &dwMode);
|
||||
|
||||
if (echo) {
|
||||
SetConsoleMode(handle, dwMode | ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT);
|
||||
} else {
|
||||
SetConsoleMode(handle,
|
||||
dwMode & ~(ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT));
|
||||
}
|
||||
}
|
||||
|
||||
size_t getpagesize(void)
|
||||
{
|
||||
SYSTEM_INFO system_info;
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user