linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/4] Wrap LFS64 functions only if __GLIBC__
@ 2015-01-25 20:36 Felix Janda
  2015-05-05 12:34 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 5+ messages in thread
From: Felix Janda @ 2015-01-25 20:36 UTC (permalink / raw)
  To: linux-media

The functions open64 and mmap64 are glibc specific.

Signed-off-by: Felix Janda <felix.janda@posteo.de>
---
 lib/libv4l1/v4l1compat.c  | 4 ++--
 lib/libv4l2/v4l2convert.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/libv4l1/v4l1compat.c b/lib/libv4l1/v4l1compat.c
index 282173b..c78adb4 100644
--- a/lib/libv4l1/v4l1compat.c
+++ b/lib/libv4l1/v4l1compat.c
@@ -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 fd
 	return 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)
 {
diff --git a/lib/libv4l2/v4l2convert.c b/lib/libv4l2/v4l2convert.c
index c79f9da..9345641 100644
--- a/lib/libv4l2/v4l2convert.c
+++ b/lib/libv4l2/v4l2convert.c
@@ -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 fd
 	return 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)
 {
-- 
2.0.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 3/4] Wrap LFS64 functions only if __GLIBC__
  2015-01-25 20:36 [PATCH 3/4] Wrap LFS64 functions only if __GLIBC__ Felix Janda
@ 2015-05-05 12:34 ` Mauro Carvalho Chehab
  2015-05-05 19:02   ` [PATCHv2 3/4] Wrap LFS64 functions only if linux && __GLIBC__ Felix Janda
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2015-05-05 12:34 UTC (permalink / raw)
  To: Felix Janda, Hans Petter Selasky; +Cc: linux-media

Em Sun, 25 Jan 2015 21:36:36 +0100
Felix Janda <felix.janda@posteo.de> escreveu:

> The functions open64 and mmap64 are glibc specific.
> 
> Signed-off-by: Felix Janda <felix.janda@posteo.de>
> ---
>  lib/libv4l1/v4l1compat.c  | 4 ++--
>  lib/libv4l2/v4l2convert.c | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/libv4l1/v4l1compat.c b/lib/libv4l1/v4l1compat.c
> index 282173b..c78adb4 100644
> --- a/lib/libv4l1/v4l1compat.c
> +++ b/lib/libv4l1/v4l1compat.c
> @@ -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: hans@rhel5-devel.localdomain <hans@rhel5-devel.localdomain>
Date:   Tue Jun 2 15:34:34 2009 +0200

    libv4l: initial support for compiling on FreeBSD
    
    From: Hans Petter Selasky <hselasky@freebsd.org>

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



>  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 fd
>  	return 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)
>  {
> diff --git a/lib/libv4l2/v4l2convert.c b/lib/libv4l2/v4l2convert.c
> index c79f9da..9345641 100644
> --- a/lib/libv4l2/v4l2convert.c
> +++ b/lib/libv4l2/v4l2convert.c
> @@ -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 fd
>  	return 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)
>  {

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCHv2 3/4] Wrap LFS64 functions only if linux && __GLIBC__
  2015-05-05 12:34 ` Mauro Carvalho Chehab
@ 2015-05-05 19:02   ` Felix Janda
  2015-05-05 19:22   ` [PATCH 3/4] Wrap LFS64 functions only if __GLIBC__ Gregor Jasny
  2015-05-06 13:30   ` Hans Petter Selasky
  2 siblings, 0 replies; 5+ messages in thread
From: Felix Janda @ 2015-05-05 19:02 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: Hans Petter Selasky, linux-media

For musl libc, open64 is #define'd to open. Therefore we should not try
to wrap both open and open64.

Signed-off-by: Felix Janda <felix.janda@posteo.de>
---
v2: Test for linux as well

Mauro Carvalho Chehab wrote:
[..]
> Hmm... linux was added here to avoid breaking on FreeBSD, on this
> changeset:
> 
> commit 9026d3cc277e9211a89345846dea95af7208383c
> Author: hans@rhel5-devel.localdomain <hans@rhel5-devel.localdomain>
> Date:   Tue Jun 2 15:34:34 2009 +0200
> 
>     libv4l: initial support for compiling on FreeBSD
>     
>     From: Hans Petter Selasky <hselasky@freebsd.org>
> 
> 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.

> 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(-)

diff --git a/lib/libv4l1/v4l1compat.c b/lib/libv4l1/v4l1compat.c
index 282173b..0d433c6 100644
--- a/lib/libv4l1/v4l1compat.c
+++ b/lib/libv4l1/v4l1compat.c
@@ -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 fd
 	return 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)
 {
diff --git a/lib/libv4l2/v4l2convert.c b/lib/libv4l2/v4l2convert.c
index 2c2f12a..6abccbf 100644
--- a/lib/libv4l2/v4l2convert.c
+++ b/lib/libv4l2/v4l2convert.c
@@ -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 fd
 	return 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)
 {
-- 
2.3.6


















^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 3/4] Wrap LFS64 functions only if __GLIBC__
  2015-05-05 12:34 ` Mauro Carvalho Chehab
  2015-05-05 19:02   ` [PATCHv2 3/4] Wrap LFS64 functions only if linux && __GLIBC__ Felix Janda
@ 2015-05-05 19:22   ` Gregor Jasny
  2015-05-06 13:30   ` Hans Petter Selasky
  2 siblings, 0 replies; 5+ messages in thread
From: Gregor Jasny @ 2015-05-05 19:22 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Felix Janda, Hans Petter Selasky; +Cc: linux-media

On 05/05/15 14:34, Mauro Carvalho Chehab wrote:
> Em Sun, 25 Jan 2015 21:36:36 +0100
> Felix Janda <felix.janda@posteo.de> escreveu:
>> -#ifdef linux
>> +#ifdef __GLIBC__
> 
> Hmm... linux was added here to avoid breaking on FreeBSD, on this
> changeset:
> 
> 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 3/4] Wrap LFS64 functions only if __GLIBC__
  2015-05-05 12:34 ` Mauro Carvalho Chehab
  2015-05-05 19:02   ` [PATCHv2 3/4] Wrap LFS64 functions only if linux && __GLIBC__ Felix Janda
  2015-05-05 19:22   ` [PATCH 3/4] Wrap LFS64 functions only if __GLIBC__ Gregor Jasny
@ 2015-05-06 13:30   ` Hans Petter Selasky
  2 siblings, 0 replies; 5+ messages in thread
From: Hans Petter Selasky @ 2015-05-06 13:30 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Felix Janda; +Cc: linux-media

On 05/05/15 14:34, Mauro Carvalho Chehab wrote:
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-05-06 13:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-25 20:36 [PATCH 3/4] Wrap LFS64 functions only if __GLIBC__ Felix Janda
2015-05-05 12:34 ` Mauro Carvalho Chehab
2015-05-05 19:02   ` [PATCHv2 3/4] Wrap LFS64 functions only if linux && __GLIBC__ Felix Janda
2015-05-05 19:22   ` [PATCH 3/4] Wrap LFS64 functions only if __GLIBC__ Gregor Jasny
2015-05-06 13:30   ` Hans Petter Selasky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).