diff options
| author | Khem Raj <raj.khem@gmail.com> | 2022-12-21 09:55:50 -0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-12-22 23:05:50 +0000 |
| commit | 556f09df23ad77f91cd48757fb89980750d2c489 (patch) | |
| tree | 8bcb36d9cab27aa45757793b37fd6e2c9a9f8114 | |
| parent | 2120e7d10cf4ca480a76062db4820ac09e0695fe (diff) | |
| download | poky-556f09df23ad77f91cd48757fb89980750d2c489.tar.gz | |
numactl: Enable largefile support
(From OE-Core rev: 4ec9e05e7276bee6952669212d129549500338ec)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
3 files changed, 93 insertions, 0 deletions
diff --git a/meta/recipes-support/numactl/numactl/0001-configure-Check-for-largefile-support.patch b/meta/recipes-support/numactl/numactl/0001-configure-Check-for-largefile-support.patch new file mode 100644 index 0000000000..152eb2807b --- /dev/null +++ b/meta/recipes-support/numactl/numactl/0001-configure-Check-for-largefile-support.patch | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | From 61f910f5d12d6f6a66223b5af6d74e30ace3a2e1 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Thu, 15 Dec 2022 12:10:37 -0800 | ||
| 4 | Subject: [PATCH] configure: Check for largefile support | ||
| 5 | |||
| 6 | This helps in using 64bit versions of off_t related functions | ||
| 7 | |||
| 8 | Upstream-Status: Backport [https://github.com/numactl/numactl/pull/159] | ||
| 9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 10 | --- | ||
| 11 | configure.ac | 3 +++ | ||
| 12 | 1 file changed, 3 insertions(+) | ||
| 13 | |||
| 14 | diff --git a/configure.ac b/configure.ac | ||
| 15 | index 8510fc5..d74bc6e 100644 | ||
| 16 | --- a/configure.ac | ||
| 17 | +++ b/configure.ac | ||
| 18 | @@ -14,6 +14,9 @@ LT_INIT | ||
| 19 | |||
| 20 | AC_PROG_CC | ||
| 21 | |||
| 22 | +# Check for enabling LFS support | ||
| 23 | +AC_SYS_LARGEFILE | ||
| 24 | + | ||
| 25 | # Override CFLAGS so that we can specify custom CFLAGS for numademo. | ||
| 26 | AX_AM_OVERRIDE_VAR([CFLAGS]) | ||
| 27 | |||
diff --git a/meta/recipes-support/numactl/numactl/0002-shm.c-Replace-stat64-fstat64-ftruncate64mmap64-with-.patch b/meta/recipes-support/numactl/numactl/0002-shm.c-Replace-stat64-fstat64-ftruncate64mmap64-with-.patch new file mode 100644 index 0000000000..03b98e0a2c --- /dev/null +++ b/meta/recipes-support/numactl/numactl/0002-shm.c-Replace-stat64-fstat64-ftruncate64mmap64-with-.patch | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | From 8a08d3583d77bebeb1763fb9b378899201ce5afa Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Thu, 15 Dec 2022 12:11:13 -0800 | ||
| 4 | Subject: [PATCH] shm.c: Replace stat64/fstat64/ftruncate64mmap64 with normal functions | ||
| 5 | |||
| 6 | These functions were needed when _FILE_OFFSET_BITS was not 64, using | ||
| 7 | AC_SYS_LARGEFILE will detect it correctly and make the normal variants | ||
| 8 | of these functions behave same as their *64 counterparts. | ||
| 9 | |||
| 10 | Upstream-Status: Backport [https://github.com/numactl/numactl/pull/159] | ||
| 11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 12 | --- | ||
| 13 | shm.c | 10 +++++----- | ||
| 14 | 1 file changed, 5 insertions(+), 5 deletions(-) | ||
| 15 | |||
| 16 | diff --git a/shm.c b/shm.c | ||
| 17 | index 20537d9..5d0d1ab 100644 | ||
| 18 | --- a/shm.c | ||
| 19 | +++ b/shm.c | ||
| 20 | @@ -24,8 +24,8 @@ | ||
| 21 | #include <sys/mman.h> | ||
| 22 | #include <sys/ipc.h> | ||
| 23 | #include <sys/shm.h> | ||
| 24 | -#include <sys/fcntl.h> | ||
| 25 | #include <sys/stat.h> | ||
| 26 | +#include <fcntl.h> | ||
| 27 | #include <stdarg.h> | ||
| 28 | #include <errno.h> | ||
| 29 | #include <unistd.h> | ||
| 30 | @@ -135,7 +135,7 @@ void attach_sysvshm(char *name, char *opt) | ||
| 31 | /* Attach a shared memory file. */ | ||
| 32 | void attach_shared(char *name, char *opt) | ||
| 33 | { | ||
| 34 | - struct stat64 st; | ||
| 35 | + struct stat st; | ||
| 36 | |||
| 37 | shmfd = open(name, O_RDWR); | ||
| 38 | if (shmfd < 0) { | ||
| 39 | @@ -146,14 +146,14 @@ void attach_shared(char *name, char *opt) | ||
| 40 | if (shmfd < 0) | ||
| 41 | nerror("cannot create file %s", name); | ||
| 42 | } | ||
| 43 | - if (fstat64(shmfd, &st) < 0) | ||
| 44 | + if (fstat(shmfd, &st) < 0) | ||
| 45 | err("shm stat"); | ||
| 46 | /* the file size must be larger than mmap shmlen + shmoffset, otherwise SIGBUS | ||
| 47 | * will be caused when we access memory, because mmaped memory is no longer in | ||
| 48 | * the range of the file laster. | ||
| 49 | */ | ||
| 50 | if ((shmlen + shmoffset) > st.st_size) { | ||
| 51 | - if (ftruncate64(shmfd, shmlen + shmoffset) < 0) { | ||
| 52 | + if (ftruncate(shmfd, shmlen + shmoffset) < 0) { | ||
| 53 | /* XXX: we could do it by hand, but it would it | ||
| 54 | would be impossible to apply policy then. | ||
| 55 | need to fix that in the kernel. */ | ||
| 56 | @@ -168,7 +168,7 @@ void attach_shared(char *name, char *opt) | ||
| 57 | |||
| 58 | /* RED-PEN For shmlen > address space may need to map in pieces. | ||
| 59 | Left for some poor 32bit soul. */ | ||
| 60 | - shmptr = mmap64(NULL, shmlen, PROT_READ | PROT_WRITE, MAP_SHARED, shmfd, shmoffset); | ||
| 61 | + shmptr = mmap(NULL, shmlen, PROT_READ | PROT_WRITE, MAP_SHARED, shmfd, shmoffset); | ||
| 62 | if (shmptr == (char*)-1) | ||
| 63 | err("shm mmap"); | ||
| 64 | } | ||
diff --git a/meta/recipes-support/numactl/numactl_git.bb b/meta/recipes-support/numactl/numactl_git.bb index 23be0a3b4f..0f71258bc3 100644 --- a/meta/recipes-support/numactl/numactl_git.bb +++ b/meta/recipes-support/numactl/numactl_git.bb | |||
| @@ -18,6 +18,8 @@ SRC_URI = "git://github.com/numactl/numactl;branch=master;protocol=https \ | |||
| 18 | file://Makefile \ | 18 | file://Makefile \ |
| 19 | file://run-ptest \ | 19 | file://run-ptest \ |
| 20 | file://0001-define-run-test-target.patch \ | 20 | file://0001-define-run-test-target.patch \ |
| 21 | file://0001-configure-Check-for-largefile-support.patch \ | ||
| 22 | file://0002-shm.c-Replace-stat64-fstat64-ftruncate64mmap64-with-.patch \ | ||
| 21 | " | 23 | " |
| 22 | 24 | ||
| 23 | S = "${WORKDIR}/git" | 25 | S = "${WORKDIR}/git" |
