Wrap LFS64 functions only if __GLIBC__
PATCH 3/4 Wrap LFS64 functions only if __GLIBC__
The functions open64 and mmap64 are glibc specific.
--- lib/libv4l1/v4l1compat.c | 4 ++-- lib/libv4l2/v4l2convert.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
lib/libv4l1/v4l1compat.c +2 -2
@@ -61,7 +61,7 @@ LIBV4L_PUBLIC int open(const char *file, int oflag, ...)return fd; } -#ifdef linux +#ifdef __GLIBC__ LIBV4L_PUBLIC int open64(const char *file, int oflag, ...) {int fd;
@@ -120,7 +120,7 @@ LIBV4L_PUBLIC void *mmap(void *start, size_t length, int prot, int flags, int fdreturn v4l1_mmap (start, length, prot, flags, fd, offset); } -#ifdef linux +#ifdef __GLIBC__ LIBV4L_PUBLIC void *mmap64(void *start, size_t length, int prot, int flags, int fd,off64_t offset) {
lib/libv4l2/v4l2convert.c +2 -2
@@ -86,7 +86,7 @@ LIBV4L_PUBLIC int open(const char *file, int oflag, ...)return fd; } -#ifdef linux +#ifdef __GLIBC__ LIBV4L_PUBLIC int open64(const char *file, int oflag, ...) {int fd;
@@ -148,7 +148,7 @@ LIBV4L_PUBLIC void *mmap(void *start, size_t length, int prot, int flags, int fdreturn v4l2_mmap (start, length, prot, flags, fd, offset); } -#ifdef linux +#ifdef __GLIBC__ LIBV4L_PUBLIC void *mmap64(void *start, size_t length, int prot, int flags, int fd,off64_t offset) {
Signature · 1 line
2.0.5
Em Sun, 25 Jan 2015 21:36:36 +0100
Felix Janda <[email protected]> escreveu:
Quoted 13 lines
The functions open64 and mmap64 are glibc specific.
Signed-off-by Felix Janda <[email protected]>--- lib/libv4l1/v4l1compat.c | 4 ++-- lib/libv4l2/v4l2convert.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)lib/libv4l1/v4l1compat.c +0
-0
lib/libv4l1/v4l1compat.c LIBV4L_PUBLIC int open(const char *file, int oflag, ...) · line 64
Quoted 5 lines
lib/libv4l1/v4l1compat.c +1
-1@@ -61,7 +61,7 @@ LIBV4L_PUBLIC int open(const char *file, int oflag, ...)return fd; } -#ifdef linux +#ifdef __GLIBC__
Hmm... linux was added here to avoid breaking on FreeBSD, on this changeset:
commit 9026d3cc277e9211a89345846dea95af7208383c
Author: [email protected] <[email protected]> Date: Tue Jun 2 15:34:34 2009 +0200
libv4l: initial support for compiling on FreeBSD
From: Hans Petter Selasky <[email protected]>
I'm afraid that removing the above would break for FreeBSD, as I think it also uses glibc, but not 100% sure.
So, either we should get an ack from Hans Peter, or you should change the tests to:
#if linux && __GLIBC__
Regards,
Mauro
Quoted 34 lines
lib/libv4l1/v4l1compat.c +1
-1LIBV4L_PUBLIC int open64(const char *file, int oflag, ...) {int fd;@@ -120,7 +120,7 @@ LIBV4L_PUBLIC void *mmap(void *start, size_t length, int prot, int flags, int fdreturn v4l1_mmap (start, length, prot, flags, fd, offset); } -#ifdef linux +#ifdef __GLIBC__ LIBV4L_PUBLIC void *mmap64(void *start, size_t length, int prot, int flags, int fd,off64_t offset) {lib/libv4l2/v4l2convert.c +2
-2@@ -86,7 +86,7 @@ LIBV4L_PUBLIC int open(const char *file, int oflag, ...)return fd; } -#ifdef linux +#ifdef __GLIBC__ LIBV4L_PUBLIC int open64(const char *file, int oflag, ...) {int fd;@@ -148,7 +148,7 @@ LIBV4L_PUBLIC void *mmap(void *start, size_t length, int prot, int flags, int fdreturn v4l2_mmap (start, length, prot, flags, fd, offset); } -#ifdef linux +#ifdef __GLIBC__ LIBV4L_PUBLIC void *mmap64(void *start, size_t length, int prot, int flags, int fd,off64_t offset) {
PATCH v2 3/4 Wrap LFS64 functions only if linux && __GLIBC__
For musl libc, open64 is #define'd to open. Therefore we should not try to wrap both open and open64.
---
v2: Test for linux as well
Mauro Carvalho Chehab wrote:
[..]
Quoted 7 lines
Hmm... linux was added here to avoid breaking on FreeBSD, on this changeset:
commit
9026d3cc277e9211a89345846dea95af7208383cAuthor: [email protected] <[email protected]> Date: Tue Jun 2 15:34:34 2009 +0200
Quoted 6 lines
libv4l: initial support for compiling on FreeBSD
From: Hans Petter Selasky <[email protected]>
I'm afraid that removing the above would break for FreeBSD, as I think it also uses glibc, but not 100% sure.
Usually FreeBSD has its own libc (which does not define __GLIBC__). However (as I've didn't know at the time) there is also kFreeBSD, which has a FreeBSD kernel but still uses glibc.
Quoted 4 lines
So, either we should get an ack from Hans Peter, or you should change the tests to:
#if linux && __GLIBC__
I've changed them to
#if defined(linux) && defined(__GLIBC__)
Thanks for the review!
--- lib/libv4l1/v4l1compat.c | 4 ++-- lib/libv4l2/v4l2convert.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
lib/libv4l1/v4l1compat.c +2 -2
@@ -61,7 +61,7 @@ LIBV4L_PUBLIC int open(const char *file, int oflag, ...)return fd; } -#ifdef linux +#if defined(linux) && defined(__GLIBC__) LIBV4L_PUBLIC int open64(const char *file, int oflag, ...) {int fd;
@@ -120,7 +120,7 @@ LIBV4L_PUBLIC void *mmap(void *start, size_t length, int prot, int flags, int fdreturn v4l1_mmap (start, length, prot, flags, fd, offset); } -#ifdef linux +#if defined(linux) && defined(__GLIBC__) LIBV4L_PUBLIC void *mmap64(void *start, size_t length, int prot, int flags, int fd,off64_t offset) {
lib/libv4l2/v4l2convert.c +2 -2
@@ -89,7 +89,7 @@ LIBV4L_PUBLIC int open(const char *file, int oflag, ...)return fd; } -#ifdef linux +#if defined(linux) && defined(__GLIBC__) LIBV4L_PUBLIC int open64(const char *file, int oflag, ...) {int fd;
@@ -152,7 +152,7 @@ LIBV4L_PUBLIC void *mmap(void *start, size_t length, int prot, int flags, int fdreturn v4l2_mmap (start, length, prot, flags, fd, offset); } -#ifdef linux +#if defined(linux) && defined(__GLIBC__) LIBV4L_PUBLIC void *mmap64(void *start, size_t length, int prot, int flags, int fd,off64_t offset) {
Signature · 1 line
2.3.6
Quoted 8 lines · Mauro Carvalho Chehab
Em Sun, 25 Jan 2015 21:36:36 +0100
Felix Janda <[email protected]> escreveu:Review
Quoted 2 lines
(quoted diff) +1
-1-#ifdef linux +#ifdef __GLIBC__Hmm... linux was added here to avoid breaking on FreeBSD, on this changeset:
Quoted 4 lines
So, either we should get an ack from Hans Peter, or you should change the tests to:
#if linux && __GLIBC__
That would be needed to not break Debian/kFreeBSD which is a FreeBSD Kernel with GNU C library.
Quoted 7 lines · Mauro Carvalho Chehab
I'm afraid that removing the above would break for FreeBSD, as I think it also uses glibc, but not 100% sure.
So, either we should get an ack from Hans Peter, or you should change the tests to:
#if linux && __GLIBC__
Hi,
Linux might be defined when compiling webcamd. The following should be fine:
-#ifdef linux
+#if defined(linux) && defined(__GLIBC__)
Thank you!
--HPS