Obezyan
Committed by David PHAM-VAN

Replace function memfd_create by syscall(SYS_memfd_create) to reduce required glibc version

@@ -12,6 +12,7 @@ @@ -12,6 +12,7 @@
12 - Use RENDER_MODE_FOR_DISPLAY on Android 12 - Use RENDER_MODE_FOR_DISPLAY on Android
13 - Enable usage of printer's settings on Windows [Alban Lecuivre] 13 - Enable usage of printer's settings on Windows [Alban Lecuivre]
14 - Update android projects (mavenCentral, compileSdkVersion 30, gradle:4.1.0) 14 - Update android projects (mavenCentral, compileSdkVersion 30, gradle:4.1.0)
  15 +- Use syscall(SYS_memfd_create) instead of glibc function memfd_create
15 16
16 ## 5.6.6 17 ## 5.6.6
17 18
@@ -17,9 +17,11 @@ @@ -17,9 +17,11 @@
17 #include "print_job.h" 17 #include "print_job.h"
18 18
19 #include <stdlib.h> 19 #include <stdlib.h>
20 -#include <sys/mman.h> 20 +#include <unistd.h>
  21 +#include <sys/syscall.h>
21 #include <sys/types.h> 22 #include <sys/types.h>
22 #include <sys/wait.h> 23 #include <sys/wait.h>
  24 +#include <linux/memfd.h>
23 #include <cstring> 25 #include <cstring>
24 #include <string> 26 #include <string>
25 27
@@ -200,7 +202,7 @@ bool print_job::print_pdf(const gchar* name, @@ -200,7 +202,7 @@ bool print_job::print_pdf(const gchar* name,
200 } 202 }
201 203
202 void print_job::write_job(const uint8_t data[], size_t size) { 204 void print_job::write_job(const uint8_t data[], size_t size) {
203 - auto fd = memfd_create("printing", 0); 205 + auto fd = syscall(SYS_memfd_create, "printing", 0);
204 size_t offset = 0; 206 size_t offset = 0;
205 ssize_t n; 207 ssize_t n;
206 while ((n = write(fd, data + offset, size - offset)) >= 0 && 208 while ((n = write(fd, data + offset, size - offset)) >= 0 &&