Skip to contentSkip to conversation

cobalt: allow to compile without __USE_LARGEFILE64

PATCH Superseded Norbert Lange 2 participants 3 messages Apr 16, 2020 – Apr 17, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cobalt: allow to compile without __USE_LARGEFILE64

A header uses the off64_t which is only conditionally available, causing compile failures.
The macro might be necessary to compile cobalt libraries, but should not be needed for software depending on them.

---
 include/cobalt/sys/mman.h | 2 ++
 1 file changed, 2 insertions(+)
include/cobalt/sys/mman.h +2 -0
index 1c47777a2..9428c4cec 100644
@@ -31,8 +31,10 @@ extern "C" {
 COBALT_DECL(void *, mmap(void *addr, size_t length, int prot, int flags,
 			 int fd, off_t offset));
 
+#ifdef __USE_LARGEFILE64
 COBALT_DECL(void *, mmap64(void *addr, size_t length, int prot, int flags,
 			   int fd, off64_t offset));
+#endif
 
 #ifdef __cplusplus
 }
#1 lore raw
Quoted 15 lines · Norbert Lange via Xenomai

A header uses the off64_t which is only conditionally available, causing compile failures.
The macro might be necessary to compile cobalt libraries, but should not be needed for software depending on them.

---
  include/cobalt/sys/mman.h | 2 ++
  1 file changed, 2 insertions(+)
include/cobalt/sys/mman.h +0 -0
index 1c47777a2..9428c4cec 100644

include/cobalt/sys/mman.h extern "C" { · line 34

Quoted 4 lines
include/cobalt/sys/mman.h +1 -0
@@ -31,8 +31,10 @@ extern "C" {
  COBALT_DECL(void *, mmap(void *addr, size_t length, int prot, int flags,
  			 int fd, off_t offset));
 
+#ifdef __USE_LARGEFILE64

Good catch, but I think this should be _LARGEFILE64_SOURCE instead.

Jan

Quoted 7 lines
include/cobalt/sys/mman.h +1 -0
  COBALT_DECL(void *, mmap64(void *addr, size_t length, int prot, int flags,
  			   int fd, off64_t offset));
+#endif
 
  #ifdef __cplusplus
  }
Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
#2 lore raw

True, rolled a v2 after reading up a bit.
The new check was ultimately copied over from musl, should suit some additional cases.
(I guess I wasn't running into it till now, as I mostly use _GNU_SOURCE)

Norbert

Am Fr., 17. Apr. 2020 um 08:10 Uhr schrieb Jan Kiszka <[email protected]>:

Quoted 37 lines · Norbert Lange via Xenomai
Quoted 15 lines

A header uses the off64_t which is only conditionally available, causing compile failures.
The macro might be necessary to compile cobalt libraries, but should not be needed for software depending on them.

---
  include/cobalt/sys/mman.h | 2 ++
  1 file changed, 2 insertions(+)
include/cobalt/sys/mman.h +0 -0
index 1c47777a2..9428c4cec 100644

include/cobalt/sys/mman.h extern "C" { · line 34

Quoted 4 lines
include/cobalt/sys/mman.h +1 -0
@@ -31,8 +31,10 @@ extern "C" {
  COBALT_DECL(void *, mmap(void *addr, size_t length, int prot, int flags,
                       int fd, off_t offset));
 
+#ifdef __USE_LARGEFILE64

Good catch, but I think this should be _LARGEFILE64_SOURCE instead.

Jan

include/cobalt/sys/mman.h extern "C" { · line 40

Quoted 7 lines
include/cobalt/sys/mman.h +1 -0
  COBALT_DECL(void *, mmap64(void *addr, size_t length, int prot, int flags,
                         int fd, off64_t offset));
+#endif
 
  #ifdef __cplusplus
  }

--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux