1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
[Wayland] Fall back to ftruncate if posix_fallocate isn't supported by filesystem.
diff --git widget/gtk/WindowSurfaceWayland.cpp widget/gtk/WindowSurfaceWayland.cpp
index 9a73326399bd5..9e42a7f1c5d18 100644
--- widget/gtk/WindowSurfaceWayland.cpp
+++ widget/gtk/WindowSurfaceWayland.cpp
@@ -221,7 +221,9 @@ static int WaylandAllocateShmMemory(int aSize) {
do {
ret = posix_fallocate(fd, 0, aSize);
} while (ret == EINTR);
- if (ret != 0) {
+ if (ret == 0) {
+ return fd;
+ } else if (ret != ENODEV && ret != EINVAL && ret != EOPNOTSUPP) {
NS_WARNING(
nsPrintfCString("posix_fallocate() fails to allocate shm memory: %s",
strerror(ret))
@@ -229,7 +231,7 @@ static int WaylandAllocateShmMemory(int aSize) {
close(fd);
return -1;
}
-#else
+#endif
do {
ret = ftruncate(fd, aSize);
} while (ret < 0 && errno == EINTR);
@@ -240,7 +242,6 @@ static int WaylandAllocateShmMemory(int aSize) {
close(fd);
fd = -1;
}
-#endif
return fd;
}
@@ -253,7 +254,7 @@ static bool WaylandReAllocateShmMemory(int aFd, int aSize) {
do {
errno = posix_fallocate(aFd, 0, aSize);
} while (errno == EINTR);
- if (errno != 0) {
+ if (errno != 0 && errno != ENODEV && errno != EINVAL && errno != EOPNOTSUPP) {
return false;
}
#endif
|