]> git.proxmox.com Git - mirror_qemu.git/blame - ui/udmabuf.c
bsd-user: Implement stat related syscalls
[mirror_qemu.git] / ui / udmabuf.c
CommitLineData
87f12216
VK
1/*
2 * udmabuf helper functions.
3 *
4 * This work is licensed under the terms of the GNU GPL, version 2 or later.
5 * See the COPYING file in the top-level directory.
6 */
7#include "qemu/osdep.h"
8#include "qapi/error.h"
9#include "ui/console.h"
5feed38c 10#include "qemu/error-report.h"
87f12216 11
87f12216
VK
12#include <sys/ioctl.h>
13
14int udmabuf_fd(void)
15{
16 static bool first = true;
17 static int udmabuf;
18
19 if (!first) {
20 return udmabuf;
21 }
22 first = false;
23
24 udmabuf = open("/dev/udmabuf", O_RDWR);
25 if (udmabuf < 0) {
26 warn_report("open /dev/udmabuf: %s", strerror(errno));
27 }
28 return udmabuf;
29}