mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
qemu_pipe() is used only by POSIX code, so move to oslib-posix.c
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
parent
9549e764bd
commit
70e72ce45e
2 changed files with 22 additions and 22 deletions
|
@ -87,3 +87,25 @@ void qemu_set_cloexec(int fd)
|
|||
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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue