Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 1/3] bnep: avoid use of caddr_t
@ 2014-01-17 12:08 Natanael Copa
  2014-01-17 12:08 ` [PATCH 2/3] various header include fixes for building with musl libc Natanael Copa
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Natanael Copa @ 2014-01-17 12:08 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Natanael Copa

caddr_t is legacy BSD and should be avoided.

This fixes building against musl libc.
---
 profiles/network/bnep.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/profiles/network/bnep.c b/profiles/network/bnep.c
index 2a74016..4f9b801 100644
--- a/profiles/network/bnep.c
+++ b/profiles/network/bnep.c
@@ -202,7 +202,7 @@ static int bnep_if_up(const char *devname)
 	ifr.ifr_flags |= IFF_UP;
 	ifr.ifr_flags |= IFF_MULTICAST;
 
-	err = ioctl(sk, SIOCSIFFLAGS, (caddr_t) &ifr);
+	err = ioctl(sk, SIOCSIFFLAGS, (void *) &ifr);
 
 	close(sk);
 
@@ -227,7 +227,7 @@ static int bnep_if_down(const char *devname)
 	ifr.ifr_flags &= ~IFF_UP;
 
 	/* Bring down the interface */
-	err = ioctl(sk, SIOCSIFFLAGS, (caddr_t) &ifr);
+	err = ioctl(sk, SIOCSIFFLAGS, (void *) &ifr);
 
 	close(sk);
 
-- 
1.8.5.3


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

* [PATCH 2/3] various header include fixes for building with musl libc
  2014-01-17 12:08 [PATCH 1/3] bnep: avoid use of caddr_t Natanael Copa
@ 2014-01-17 12:08 ` Natanael Copa
  2014-01-17 12:08 ` [PATCH 3/3] unit: prevent use of glibc's error(3) Natanael Copa
  2014-01-17 14:47 ` [PATCH 1/3] bnep: avoid use of caddr_t Luiz Augusto von Dentz
  2 siblings, 0 replies; 16+ messages in thread
From: Natanael Copa @ 2014-01-17 12:08 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Natanael Copa

we need:
 sys/stat.h for mode_t
 limits.h for PATH_MAX
---
 src/textfile.h  | 2 ++
 tools/csr_usb.c | 1 +
 tools/hid2hci.c | 1 +
 3 files changed, 4 insertions(+)

diff --git a/src/textfile.h b/src/textfile.h
index b779bd2..e26da5d 100644
--- a/src/textfile.h
+++ b/src/textfile.h
@@ -24,6 +24,8 @@
 #ifndef __TEXTFILE_H
 #define __TEXTFILE_H
 
+#include <sys/stat.h>
+
 int create_file(const char *filename, const mode_t mode);
 int create_name(char *buf, size_t size, const char *path,
 				const char *address, const char *name);
diff --git a/tools/csr_usb.c b/tools/csr_usb.c
index a483bc1..5fb6bdc 100644
--- a/tools/csr_usb.c
+++ b/tools/csr_usb.c
@@ -33,6 +33,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <dirent.h>
+#include <limits.h>
 #include <sys/ioctl.h>
 
 #include "csr.h"
diff --git a/tools/hid2hci.c b/tools/hid2hci.c
index 95b4abf..2dbfca7 100644
--- a/tools/hid2hci.c
+++ b/tools/hid2hci.c
@@ -35,6 +35,7 @@
 #include <string.h>
 #include <dirent.h>
 #include <getopt.h>
+#include <limits.h>
 #include <sys/ioctl.h>
 #include <linux/types.h>
 #include <linux/hiddev.h>
-- 
1.8.5.3


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

* [PATCH 3/3] unit: prevent use of glibc's error(3)
  2014-01-17 12:08 [PATCH 1/3] bnep: avoid use of caddr_t Natanael Copa
  2014-01-17 12:08 ` [PATCH 2/3] various header include fixes for building with musl libc Natanael Copa
@ 2014-01-17 12:08 ` Natanael Copa
  2014-01-17 14:37   ` Luiz Augusto von Dentz
  2014-01-17 14:47 ` [PATCH 1/3] bnep: avoid use of caddr_t Luiz Augusto von Dentz
  2 siblings, 1 reply; 16+ messages in thread
From: Natanael Copa @ 2014-01-17 12:08 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Natanael Copa

When building the test-sdp we don't want src/sdpd-request.c end up
using the incompatible GNU libc's error(3).

This also fixes building on musl libc which misses the error(3) GNU
extension.
---
 unit/test-sdp.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/unit/test-sdp.c b/unit/test-sdp.c
index 6d699e2..eeed0cb 100644
--- a/unit/test-sdp.c
+++ b/unit/test-sdp.c
@@ -134,6 +134,12 @@ void btd_debug(const char *format, ...)
 {
 }
 
+void error(const char *format, ...);
+
+void error(const char *format, ...)
+{
+}
+
 static void context_quit(struct context *context)
 {
 	g_main_loop_quit(context->main_loop);
-- 
1.8.5.3


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

* Re: [PATCH 3/3] unit: prevent use of glibc's error(3)
  2014-01-17 12:08 ` [PATCH 3/3] unit: prevent use of glibc's error(3) Natanael Copa
@ 2014-01-17 14:37   ` Luiz Augusto von Dentz
  2014-01-17 15:07     ` Natanael Copa
  0 siblings, 1 reply; 16+ messages in thread
From: Luiz Augusto von Dentz @ 2014-01-17 14:37 UTC (permalink / raw)
  To: Natanael Copa; +Cc: linux-bluetooth@vger.kernel.org, Natanael Copa

Hi Natanael,

On Fri, Jan 17, 2014 at 2:08 PM, Natanael Copa <natanael.copa@gmail.com> wrote:
> When building the test-sdp we don't want src/sdpd-request.c end up
> using the incompatible GNU libc's error(3).
>
> This also fixes building on musl libc which misses the error(3) GNU
> extension.
> ---
>  unit/test-sdp.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/unit/test-sdp.c b/unit/test-sdp.c
> index 6d699e2..eeed0cb 100644
> --- a/unit/test-sdp.c
> +++ b/unit/test-sdp.c
> @@ -134,6 +134,12 @@ void btd_debug(const char *format, ...)
>  {
>  }
>
> +void error(const char *format, ...);
> +
> +void error(const char *format, ...)
> +{
> +}
> +
>  static void context_quit(struct context *context)
>  {
>         g_main_loop_quit(context->main_loop);
> --
> 1.8.5.3

We could perhaps do the same thing we did in test-avdtp.c, build with
log support and add the following check:

if (g_test_verbose())
__btd_log_init("*", 0);


-- 
Luiz Augusto von Dentz

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

* Re: [PATCH 1/3] bnep: avoid use of caddr_t
  2014-01-17 12:08 [PATCH 1/3] bnep: avoid use of caddr_t Natanael Copa
  2014-01-17 12:08 ` [PATCH 2/3] various header include fixes for building with musl libc Natanael Copa
  2014-01-17 12:08 ` [PATCH 3/3] unit: prevent use of glibc's error(3) Natanael Copa
@ 2014-01-17 14:47 ` Luiz Augusto von Dentz
  2014-01-22 13:50   ` [PATCH v2 0/3] Various fixes for building bluez with musl libc Natanael Copa
  2 siblings, 1 reply; 16+ messages in thread
From: Luiz Augusto von Dentz @ 2014-01-17 14:47 UTC (permalink / raw)
  To: Natanael Copa; +Cc: linux-bluetooth@vger.kernel.org, Natanael Copa

Hi Natanael,

On Fri, Jan 17, 2014 at 2:08 PM, Natanael Copa <natanael.copa@gmail.com> wrote:
> caddr_t is legacy BSD and should be avoided.
>
> This fixes building against musl libc.

The patches looks good, but could please also add to the description
the actual errors you got.

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

* Re: [PATCH 3/3] unit: prevent use of glibc's error(3)
  2014-01-17 14:37   ` Luiz Augusto von Dentz
@ 2014-01-17 15:07     ` Natanael Copa
  0 siblings, 0 replies; 16+ messages in thread
From: Natanael Copa @ 2014-01-17 15:07 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth@vger.kernel.org

On Fri, 17 Jan 2014 16:37:15 +0200
Luiz Augusto von Dentz <luiz.dentz@gmail.com> wrote:

> Hi Natanael,
> 
> On Fri, Jan 17, 2014 at 2:08 PM, Natanael Copa <natanael.copa@gmail.com> wrote:
> > When building the test-sdp we don't want src/sdpd-request.c end up
> > using the incompatible GNU libc's error(3).
> >
> > This also fixes building on musl libc which misses the error(3) GNU
> > extension.
> > ---
> >  unit/test-sdp.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/unit/test-sdp.c b/unit/test-sdp.c
> > index 6d699e2..eeed0cb 100644
> > --- a/unit/test-sdp.c
> > +++ b/unit/test-sdp.c
> > @@ -134,6 +134,12 @@ void btd_debug(const char *format, ...)
> >  {
> >  }
> >
> > +void error(const char *format, ...);
> > +
> > +void error(const char *format, ...)
> > +{
> > +}
> > +
> >  static void context_quit(struct context *context)
> >  {
> >         g_main_loop_quit(context->main_loop);
> > --
> > 1.8.5.3
> 
> We could perhaps do the same thing we did in test-avdtp.c, build with
> log support and add the following check:
> 
> if (g_test_verbose())
> __btd_log_init("*", 0);
> 
> 

sounds good to me.

-nc

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

* [PATCH v2 0/3] Various fixes for building bluez with musl libc
  2014-01-17 14:47 ` [PATCH 1/3] bnep: avoid use of caddr_t Luiz Augusto von Dentz
@ 2014-01-22 13:50   ` Natanael Copa
  2014-01-22 13:50     ` [PATCH v2 1/3] various header include fixes for building " Natanael Copa
                       ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Natanael Copa @ 2014-01-22 13:50 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Natanael Copa

Changes since v1:
- Add the compile errors in commit message
- Build unit testing with log support

Natanael Copa (3):
  various header include fixes for building with musl libc
  bnep: avoid use of caddr_t
  unit: prevent use of glibc's error(3)

 Makefile.am             | 1 +
 profiles/network/bnep.c | 4 ++--
 src/textfile.h          | 2 ++
 tools/csr_usb.c         | 1 +
 tools/hid2hci.c         | 1 +
 unit/test-sdp.c         | 9 +++------
 6 files changed, 10 insertions(+), 8 deletions(-)

-- 
1.8.5.3


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

* [PATCH v2 1/3] various header include fixes for building with musl libc
  2014-01-22 13:50   ` [PATCH v2 0/3] Various fixes for building bluez with musl libc Natanael Copa
@ 2014-01-22 13:50     ` Natanael Copa
  2014-01-22 15:16       ` Anderson Lizardo
  2014-01-22 13:50     ` [PATCH v2 2/3] bnep: avoid use of caddr_t Natanael Copa
  2014-01-22 13:50     ` [PATCH v2 3/3] unit: prevent use of glibc's error(3) Natanael Copa
  2 siblings, 1 reply; 16+ messages in thread
From: Natanael Copa @ 2014-01-22 13:50 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Natanael Copa

we need:
 sys/stat.h for mode_t
 limits.h for PATH_MAX

Fixes compile errors:
In file included from tools/hciconfig.c:45:0:
./src/textfile.h:27:1: error: unknown type name 'mode_t'
 int create_file(const char *filename, const mode_t mode);
 ^

tools/csr_usb.c: In function 'read_value':
tools/csr_usb.c:71:12: error: 'PATH_MAX' undeclared (first use in this function)
  char path[PATH_MAX];
            ^
---
 src/textfile.h  | 2 ++
 tools/csr_usb.c | 1 +
 tools/hid2hci.c | 1 +
 3 files changed, 4 insertions(+)

diff --git a/src/textfile.h b/src/textfile.h
index b779bd2..e26da5d 100644
--- a/src/textfile.h
+++ b/src/textfile.h
@@ -24,6 +24,8 @@
 #ifndef __TEXTFILE_H
 #define __TEXTFILE_H
 
+#include <sys/stat.h>
+
 int create_file(const char *filename, const mode_t mode);
 int create_name(char *buf, size_t size, const char *path,
 				const char *address, const char *name);
diff --git a/tools/csr_usb.c b/tools/csr_usb.c
index a483bc1..5fb6bdc 100644
--- a/tools/csr_usb.c
+++ b/tools/csr_usb.c
@@ -33,6 +33,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <dirent.h>
+#include <limits.h>
 #include <sys/ioctl.h>
 
 #include "csr.h"
diff --git a/tools/hid2hci.c b/tools/hid2hci.c
index 95b4abf..2dbfca7 100644
--- a/tools/hid2hci.c
+++ b/tools/hid2hci.c
@@ -35,6 +35,7 @@
 #include <string.h>
 #include <dirent.h>
 #include <getopt.h>
+#include <limits.h>
 #include <sys/ioctl.h>
 #include <linux/types.h>
 #include <linux/hiddev.h>
-- 
1.8.5.3


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

* [PATCH v2 2/3] bnep: avoid use of caddr_t
  2014-01-22 13:50   ` [PATCH v2 0/3] Various fixes for building bluez with musl libc Natanael Copa
  2014-01-22 13:50     ` [PATCH v2 1/3] various header include fixes for building " Natanael Copa
@ 2014-01-22 13:50     ` Natanael Copa
  2014-01-22 13:50     ` [PATCH v2 3/3] unit: prevent use of glibc's error(3) Natanael Copa
  2 siblings, 0 replies; 16+ messages in thread
From: Natanael Copa @ 2014-01-22 13:50 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Natanael Copa

caddr_t is legacy BSD and should be avoided.

This fixes the following compile error with musl libc:
profiles/network/bnep.c: In function 'bnep_if_up':
profiles/network/bnep.c:205:33: error: 'caddr_t' undeclared (first use in this function)
  err = ioctl(sk, SIOCSIFFLAGS, (caddr_t) &ifr);
---
 profiles/network/bnep.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/profiles/network/bnep.c b/profiles/network/bnep.c
index 2a74016..4f9b801 100644
--- a/profiles/network/bnep.c
+++ b/profiles/network/bnep.c
@@ -202,7 +202,7 @@ static int bnep_if_up(const char *devname)
 	ifr.ifr_flags |= IFF_UP;
 	ifr.ifr_flags |= IFF_MULTICAST;
 
-	err = ioctl(sk, SIOCSIFFLAGS, (caddr_t) &ifr);
+	err = ioctl(sk, SIOCSIFFLAGS, (void *) &ifr);
 
 	close(sk);
 
@@ -227,7 +227,7 @@ static int bnep_if_down(const char *devname)
 	ifr.ifr_flags &= ~IFF_UP;
 
 	/* Bring down the interface */
-	err = ioctl(sk, SIOCSIFFLAGS, (caddr_t) &ifr);
+	err = ioctl(sk, SIOCSIFFLAGS, (void *) &ifr);
 
 	close(sk);
 
-- 
1.8.5.3


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

* [PATCH v2 3/3] unit: prevent use of glibc's error(3)
  2014-01-22 13:50   ` [PATCH v2 0/3] Various fixes for building bluez with musl libc Natanael Copa
  2014-01-22 13:50     ` [PATCH v2 1/3] various header include fixes for building " Natanael Copa
  2014-01-22 13:50     ` [PATCH v2 2/3] bnep: avoid use of caddr_t Natanael Copa
@ 2014-01-22 13:50     ` Natanael Copa
  2 siblings, 0 replies; 16+ messages in thread
From: Natanael Copa @ 2014-01-22 13:50 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Natanael Copa

When building the test-sdp we don't want src/sdpd-request.c end up
using the incompatible GNU libc's error(3).

This also fixes the following compile error with musl libc which
misses the error(3) GNU extension:

src/sdpd-request.o: In function `extract_des':
/home/ncopa/src/bluez/src/sdpd-request.c:126: undefined reference to `error'
src/sdpd-request.o: In function `process_request':
/home/ncopa/src/bluez/src/sdpd-request.c:1022: undefined reference to `error'
/home/ncopa/src/bluez/src/sdpd-request.c:1045: undefined reference to `error'
---
 Makefile.am     | 1 +
 unit/test-sdp.c | 9 +++------
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 917f545..a05cacc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -251,6 +251,7 @@ unit_tests += unit/test-sdp
 unit_test_sdp_SOURCES = unit/test-sdp.c \
 				src/shared/util.h src/shared/util.c \
 				src/sdpd.h src/sdpd-database.c \
+				src/log.h src/log.c \
 				src/sdpd-service.c src/sdpd-request.c
 unit_test_sdp_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@
 
diff --git a/unit/test-sdp.c b/unit/test-sdp.c
index 6d699e2..ba0e637 100644
--- a/unit/test-sdp.c
+++ b/unit/test-sdp.c
@@ -128,12 +128,6 @@ static void sdp_debug(const char *str, void *user_data)
 	g_print("%s%s\n", prefix, str);
 }
 
-void btd_debug(const char *format, ...);
-
-void btd_debug(const char *format, ...)
-{
-}
-
 static void context_quit(struct context *context)
 {
 	g_main_loop_quit(context->main_loop);
@@ -797,6 +791,9 @@ int main(int argc, char *argv[])
 {
 	g_test_init(&argc, &argv, NULL);
 
+	if (g_test_verbose())
+		__btd_log_init("*", 0);
+
 	/*
 	 * Service Search Request
 	 *
-- 
1.8.5.3


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

* Re: [PATCH v2 1/3] various header include fixes for building with musl libc
  2014-01-22 13:50     ` [PATCH v2 1/3] various header include fixes for building " Natanael Copa
@ 2014-01-22 15:16       ` Anderson Lizardo
  2014-01-22 16:03         ` Marcel Holtmann
  2014-01-22 16:07         ` Natanael Copa
  0 siblings, 2 replies; 16+ messages in thread
From: Anderson Lizardo @ 2014-01-22 15:16 UTC (permalink / raw)
  To: Natanael Copa; +Cc: BlueZ development, Natanael Copa

Hi Natanael,

On Wed, Jan 22, 2014 at 9:50 AM, Natanael Copa <natanael.copa@gmail.com> wrote:
> diff --git a/src/textfile.h b/src/textfile.h
> index b779bd2..e26da5d 100644
> --- a/src/textfile.h
> +++ b/src/textfile.h
> @@ -24,6 +24,8 @@
>  #ifndef __TEXTFILE_H
>  #define __TEXTFILE_H
>
> +#include <sys/stat.h>
> +

I believe the correct approach here is to include sys/stat.h on all
files that include textfile.h. We (usually) don't #include system
headers inside internal headers.

>  int create_file(const char *filename, const mode_t mode);
>  int create_name(char *buf, size_t size, const char *path,
>                                 const char *address, const char *name);

Best Regards,
-- 
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil

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

* Re: [PATCH v2 1/3] various header include fixes for building with musl libc
  2014-01-22 15:16       ` Anderson Lizardo
@ 2014-01-22 16:03         ` Marcel Holtmann
  2014-01-22 16:07         ` Natanael Copa
  1 sibling, 0 replies; 16+ messages in thread
From: Marcel Holtmann @ 2014-01-22 16:03 UTC (permalink / raw)
  To: Anderson Lizardo; +Cc: Natanael Copa, BlueZ development, Natanael Copa

Hi Anderson,

>> diff --git a/src/textfile.h b/src/textfile.h
>> index b779bd2..e26da5d 100644
>> --- a/src/textfile.h
>> +++ b/src/textfile.h
>> @@ -24,6 +24,8 @@
>> #ifndef __TEXTFILE_H
>> #define __TEXTFILE_H
>> 
>> +#include <sys/stat.h>
>> +
> 
> I believe the correct approach here is to include sys/stat.h on all
> files that include textfile.h. We (usually) don't #include system
> headers inside internal headers.

with code in src/shared/*.h we started to include the system headers that are required from the header, but you are correct, we don’t do that for internal src/*.h headers.

Also we do not use circular inclusion protection from internal headers. So I ripped the stupid __TEXTFILE_H stuff out now.

Regards

Marcel


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

* Re: [PATCH v2 1/3] various header include fixes for building with musl libc
  2014-01-22 15:16       ` Anderson Lizardo
  2014-01-22 16:03         ` Marcel Holtmann
@ 2014-01-22 16:07         ` Natanael Copa
  2014-01-22 18:06           ` Anderson Lizardo
  1 sibling, 1 reply; 16+ messages in thread
From: Natanael Copa @ 2014-01-22 16:07 UTC (permalink / raw)
  To: Anderson Lizardo; +Cc: BlueZ development, Natanael Copa

On Wed, 22 Jan 2014 11:16:20 -0400
Anderson Lizardo <anderson.lizardo@openbossa.org> wrote:

> Hi Natanael,
> 
> On Wed, Jan 22, 2014 at 9:50 AM, Natanael Copa <natanael.copa@gmail.com> wrote:
> > diff --git a/src/textfile.h b/src/textfile.h
> > index b779bd2..e26da5d 100644
> > --- a/src/textfile.h
> > +++ b/src/textfile.h
> > @@ -24,6 +24,8 @@
> >  #ifndef __TEXTFILE_H
> >  #define __TEXTFILE_H
> >
> > +#include <sys/stat.h>
> > +
> 
> I believe the correct approach here is to include sys/stat.h on all
> files that include textfile.h. We (usually) don't #include system
> headers inside internal headers.

The header itself uses mode_t:
./src/textfile.h:27:1: error: unknown type name 'mode_t'

So all the files that include textfiles.h needs to include sys/stat.h
*before* the include textfile.h in that case.

I'd say that all filesm that uses mode_t including textfile.h should
include sys/stat.h.

I can make a new patch for either. Just let me know what you want.


-nc

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

* Re: [PATCH v2 1/3] various header include fixes for building with musl libc
  2014-01-22 16:07         ` Natanael Copa
@ 2014-01-22 18:06           ` Anderson Lizardo
  2014-01-22 21:20             ` [PATCH v3] " Natanael Copa
  0 siblings, 1 reply; 16+ messages in thread
From: Anderson Lizardo @ 2014-01-22 18:06 UTC (permalink / raw)
  To: Natanael Copa; +Cc: BlueZ development, Natanael Copa

Hi Natanael,

On Wed, Jan 22, 2014 at 12:07 PM, Natanael Copa <natanael.copa@gmail.com> wrote:
> The header itself uses mode_t:
> ./src/textfile.h:27:1: error: unknown type name 'mode_t'
>
> So all the files that include textfiles.h needs to include sys/stat.h
> *before* the include textfile.h in that case.
>
> I'd say that all filesm that uses mode_t including textfile.h should
> include sys/stat.h.
>
> I can make a new patch for either. Just let me know what you want.

This is how we have done so far for files in src/* (for src/shared/ as
Marcel mentioned this is being done differently). So I suggest you do
this way.

Note that several files (about 5 out of 10) already include
sys/stat.h, according to a quick grep I did. Maybe they are just not
in the right order.

Best Regards,
-- 
Anderson Lizardo
INdT - Manaus - Brazil

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

* [PATCH v3] various header include fixes for building with musl libc
  2014-01-22 18:06           ` Anderson Lizardo
@ 2014-01-22 21:20             ` Natanael Copa
  2014-03-05 20:32               ` Johan Hedberg
  0 siblings, 1 reply; 16+ messages in thread
From: Natanael Copa @ 2014-01-22 21:20 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Natanael Copa

we need:
 sys/stat.h for mode_t
 limits.h for PATH_MAX

Fixes compile errors:
In file included from tools/hciconfig.c:45:0:
./src/textfile.h:27:1: error: unknown type name 'mode_t'
 int create_file(const char *filename, const mode_t mode);
 ^

tools/csr_usb.c: In function 'read_value':
tools/csr_usb.c:71:12: error: 'PATH_MAX' undeclared (first use in this function)
  char path[PATH_MAX];
            ^
---
Changes v2 -> v3:
 - include the sys/stat.h in hciconfig.c instead of textfile.h. This was
   the only needed change for defining mode_t everywhere.

 tools/csr_usb.c   | 1 +
 tools/hciconfig.c | 1 +
 tools/hid2hci.c   | 1 +
 3 files changed, 3 insertions(+)

diff --git a/tools/csr_usb.c b/tools/csr_usb.c
index a483bc1..5fb6bdc 100644
--- a/tools/csr_usb.c
+++ b/tools/csr_usb.c
@@ -33,6 +33,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <dirent.h>
+#include <limits.h>
 #include <sys/ioctl.h>
 
 #include "csr.h"
diff --git a/tools/hciconfig.c b/tools/hciconfig.c
index 6c7f8ed..a81dc9c 100644
--- a/tools/hciconfig.c
+++ b/tools/hciconfig.c
@@ -37,6 +37,7 @@
 #include <sys/param.h>
 #include <sys/ioctl.h>
 #include <sys/socket.h>
+#include <sys/stat.h>
 
 #include <bluetooth/bluetooth.h>
 #include <bluetooth/hci.h>
diff --git a/tools/hid2hci.c b/tools/hid2hci.c
index 95b4abf..2dbfca7 100644
--- a/tools/hid2hci.c
+++ b/tools/hid2hci.c
@@ -35,6 +35,7 @@
 #include <string.h>
 #include <dirent.h>
 #include <getopt.h>
+#include <limits.h>
 #include <sys/ioctl.h>
 #include <linux/types.h>
 #include <linux/hiddev.h>
-- 
1.8.5.3


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

* Re: [PATCH v3] various header include fixes for building with musl libc
  2014-01-22 21:20             ` [PATCH v3] " Natanael Copa
@ 2014-03-05 20:32               ` Johan Hedberg
  0 siblings, 0 replies; 16+ messages in thread
From: Johan Hedberg @ 2014-03-05 20:32 UTC (permalink / raw)
  To: Natanael Copa; +Cc: linux-bluetooth, Natanael Copa

Hi Natanael,

On Wed, Jan 22, 2014, Natanael Copa wrote:
> we need:
>  sys/stat.h for mode_t
>  limits.h for PATH_MAX
> 
> Fixes compile errors:
> In file included from tools/hciconfig.c:45:0:
> ./src/textfile.h:27:1: error: unknown type name 'mode_t'
>  int create_file(const char *filename, const mode_t mode);
>  ^
> 
> tools/csr_usb.c: In function 'read_value':
> tools/csr_usb.c:71:12: error: 'PATH_MAX' undeclared (first use in this function)
>   char path[PATH_MAX];
>             ^
> ---
> Changes v2 -> v3:
>  - include the sys/stat.h in hciconfig.c instead of textfile.h. This was
>    the only needed change for defining mode_t everywhere.
> 
>  tools/csr_usb.c   | 1 +
>  tools/hciconfig.c | 1 +
>  tools/hid2hci.c   | 1 +
>  3 files changed, 3 insertions(+)

Seems this patch was forgotten. It has now finally been applied
upstream.

Johan

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

end of thread, other threads:[~2014-03-05 20:32 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-17 12:08 [PATCH 1/3] bnep: avoid use of caddr_t Natanael Copa
2014-01-17 12:08 ` [PATCH 2/3] various header include fixes for building with musl libc Natanael Copa
2014-01-17 12:08 ` [PATCH 3/3] unit: prevent use of glibc's error(3) Natanael Copa
2014-01-17 14:37   ` Luiz Augusto von Dentz
2014-01-17 15:07     ` Natanael Copa
2014-01-17 14:47 ` [PATCH 1/3] bnep: avoid use of caddr_t Luiz Augusto von Dentz
2014-01-22 13:50   ` [PATCH v2 0/3] Various fixes for building bluez with musl libc Natanael Copa
2014-01-22 13:50     ` [PATCH v2 1/3] various header include fixes for building " Natanael Copa
2014-01-22 15:16       ` Anderson Lizardo
2014-01-22 16:03         ` Marcel Holtmann
2014-01-22 16:07         ` Natanael Copa
2014-01-22 18:06           ` Anderson Lizardo
2014-01-22 21:20             ` [PATCH v3] " Natanael Copa
2014-03-05 20:32               ` Johan Hedberg
2014-01-22 13:50     ` [PATCH v2 2/3] bnep: avoid use of caddr_t Natanael Copa
2014-01-22 13:50     ` [PATCH v2 3/3] unit: prevent use of glibc's error(3) Natanael Copa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox