1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-30 10:38:37 +00:00
freebsd-ports/graphics/mesa-dri/files/patch-src_util_os__file.c
Emmanuel Vadot 57ce68a0c0 graphics/mesa*: Update to 20.2
Update to 20.2
Move graphics/libxatracker to graphics/mesa-gallium-xa
Remove VAAPI and VDPAU options in mesa-libs in favor of
two new ports : mesa-gallium-va and mesa-gallium-vdpau
Bump needed llvm to llvm10
Change a lot of meson option from false to disabled as it's
deprecated.
Remove the drm and surfaceless platform from mesa* as it's always
enabled now.
Add zstd option, used for shader cache.

Reviewed by:	x11 (zeising@)
Differential Revision:	https://reviews.freebsd.org/D26682
2020-10-12 08:30:54 +00:00

51 lines
1.0 KiB
C

--- src/util/os_file.c.orig 2020-10-05 09:57:28 UTC
+++ src/util/os_file.c
@@ -80,7 +80,7 @@ os_dupfd_cloexec(int fd)
#endif
-#if DETECT_OS_LINUX
+#if DETECT_OS_LINUX || DETECT_OS_FREEBSD
#include <fcntl.h>
#include <sys/stat.h>
@@ -93,7 +93,11 @@ os_dupfd_cloexec(int fd)
static ssize_t
readN(int fd, char *buf, size_t len)
{
+#if DETECT_OS_LINUX
int err = -ENODATA;
+#elif DETECT_OS_FREEBSD
+ int err = -1;
+#endif
size_t total = 0;
do {
ssize_t ret = read(fd, buf + total, len - total);
@@ -185,6 +189,7 @@ os_read_file(const char *filename, size_t *size)
return buf;
}
+#if DETECT_OS_LINUX
int
os_same_file_description(int fd1, int fd2)
{
@@ -196,6 +201,18 @@ os_same_file_description(int fd1, int fd2)
return syscall(SYS_kcmp, pid, pid, KCMP_FILE, fd1, fd2);
}
+#else
+int
+os_same_file_description(int fd1, int fd2)
+{
+ /* Same file descriptor trivially implies same file description */
+ if (fd1 == fd2)
+ return 0;
+
+ /* Otherwise we can't tell */
+ return -1;
+}
+#endif
#else