Iain Hibbert | 22 Jun 2011 14:26
Picon
Gravatar

obexftp patches

Some build fixes for obexftp relevant to NetBSD follow, and one
to add Bluetooth and Service Discovery support in a generic
way for BSD; this works fully on NetBSD-current and should
work on FreeBSD-current (except the SDP part), and also be
portable to other BSDs with ease (they don't include libbluetooth
in base systems)

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
Iain Hibbert | 22 Jun 2011 14:26
Picon
Gravatar

[PATCH 1/4] use (void) when prototyping functions with no arguments

From: Iain Hibbert <plunky <at> rya-online.net>

---
 obexftp/bt_kit.c |    4 ++--
 obexftp/bt_kit.h |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/obexftp/bt_kit.c b/obexftp/bt_kit.c
index db48161..41aa224 100644
--- a/obexftp/bt_kit.c
+++ b/obexftp/bt_kit.c
 <at>  <at>  -78,7 +78,7  <at>  <at> 

 	\note Needed for win32 winsock compatibility.
  */
-int btkit_init()
+int btkit_init(void)
 {
 #ifdef _WIN32
 	WORD wVersionRequired = MAKEWORD(WSA_VER_MAJOR,WSA_VER_MINOR);
 <at>  <at>  -103,7 +103,7  <at>  <at>  int btkit_init()

 	\note Needed for win32 winsock compatibility.
  */
-int btkit_exit()
+int btkit_exit(void)
 {
 #ifdef _WIN32
 	if (WSACleanup() != 0) {
diff --git a/obexftp/bt_kit.h b/obexftp/bt_kit.h
(Continue reading)

Iain Hibbert | 22 Jun 2011 14:26
Picon
Gravatar

[PATCH 2/4] fix up build conflicts

From: Iain Hibbert <plunky <at> rya-online.net>

add "-Wall foreign nostdinc" to the automake arguments

nostdinc cuts the -I. -I$(top_srcdir) out of the C makefiles as otherwise
it is not possible to include <uuid.h> and "uuid.h" on NetBSD

change the Makefile.am to include $(top_builddir) so that <config.h> can
still be found

add BLUETOOTH_CFLAGS to Makefiles where BLUETOOTH_LIBS is used
---
 apps/Makefile.am       |    3 ++-
 bfb/Makefile.am        |    3 ++-
 configure.in           |    2 +-
 multicobex/Makefile.am |    3 ++-
 obexftp/Makefile.am    |    3 ++-
 5 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/apps/Makefile.am b/apps/Makefile.am
index 9f727e6..f949ce1 100644
--- a/apps/Makefile.am
+++ b/apps/Makefile.am
 <at>  <at>  -1,5 +1,6  <at>  <at> 
 AM_CFLAGS =			 <at> OPENOBEX_CFLAGS <at>  \
-				-I$(top_srcdir) \
+				 <at> BLUETOOTH_CFLAGS <at>  \
+				-I$(top_builddir) \
 				-I$(top_srcdir)/includes

(Continue reading)

Hendrik Sattler | 27 Jun 2011 13:13
Picon

Re: [PATCH 2/4] fix up build conflicts

Zitat von Iain Hibbert <plunky <at> netbsd.org>:

> From: Iain Hibbert <plunky <at> rya-online.net>
>
> add "-Wall foreign nostdinc" to the automake arguments

Why "-Wall"? That's not strictly needed, is it?

> nostdinc cuts the -I. -I$(top_srcdir) out of the C makefiles as otherwise
> it is not possible to include <uuid.h> and "uuid.h" on NetBSD

apps/obexftp.c does the following:
#include <obexftp/obexftp.h>
#include <obexftp/client.h>
#include <obexftp/uuid.h>

That's not possible if you strip -I$(top_srcdir). Maybe it works for  
you because you have those in a standard include path?

> change the Makefile.am to include $(top_builddir) so that <config.h> can
> still be found

That's a good start for allow out-of-source builds. :-)

HS

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
(Continue reading)

Iain Hibbert | 29 Jun 2011 18:49

Re: [PATCH 2/4] fix up build conflicts

On Mon, 27 Jun 2011, Hendrik Sattler wrote:

> Zitat von Iain Hibbert <plunky <at> netbsd.org>:
>
> > From: Iain Hibbert <plunky <at> rya-online.net>
> >
> > add "-Wall foreign nostdinc" to the automake arguments
>
> Why "-Wall"? That's not strictly needed, is it?

depends if you think that the compiler has anything useful to say.. you
can look at it like assert(), its not necessary but it will show up
problems that might otherwise slip through and cause unrelated trouble
that is very difficult to track down.

> > nostdinc cuts the -I. -I$(top_srcdir) out of the C makefiles as otherwise
> > it is not possible to include <uuid.h> and "uuid.h" on NetBSD
>
> apps/obexftp.c does the following:
> #include <obexftp/obexftp.h>
> #include <obexftp/client.h>
> #include <obexftp/uuid.h>
>
> That's not possible if you strip -I$(top_srcdir). Maybe it works for
> you because you have those in a standard include path?

it was obexftp/client.c that caused the problem, but I'm not able to build
obexftp with the new openobex so difficult to diagnose at the moment..

iain
(Continue reading)

Hendrik Sattler | 29 Jun 2011 23:47
Picon

Re: [PATCH 2/4] fix up build conflicts

Am Mittwoch, 29. Juni 2011, 18:49:34 schrieb Iain Hibbert:
> On Mon, 27 Jun 2011, Hendrik Sattler wrote:
> > Zitat von Iain Hibbert <plunky <at> netbsd.org>:
> > > From: Iain Hibbert <plunky <at> rya-online.net>
> > > 
> > > add "-Wall foreign nostdinc" to the automake arguments
> > 
> > Why "-Wall"? That's not strictly needed, is it?
> 
> depends if you think that the compiler has anything useful to say.. you
> can look at it like assert(), its not necessary but it will show up
> problems that might otherwise slip through and cause unrelated trouble
> that is very difficult to track down.

That -Wall is for autotools, not for the compiler.

> > > nostdinc cuts the -I. -I$(top_srcdir) out of the C makefiles as
> > > otherwise it is not possible to include <uuid.h> and "uuid.h" on
> > > NetBSD
> > 
> > apps/obexftp.c does the following:
> > #include <obexftp/obexftp.h>
> > #include <obexftp/client.h>
> > #include <obexftp/uuid.h>
> > 
> > That's not possible if you strip -I$(top_srcdir). Maybe it works for
> > you because you have those in a standard include path?
> 
> it was obexftp/client.c that caused the problem, but I'm not able to build
> obexftp with the new openobex so difficult to diagnose at the moment..
(Continue reading)

Iain Hibbert | 30 Jun 2011 17:55

Re: [PATCH 2/4] fix up build conflicts

On Wed, 29 Jun 2011, Hendrik Sattler wrote:

> Am Mittwoch, 29. Juni 2011, 18:49:34 schrieb Iain Hibbert:
> > On Mon, 27 Jun 2011, Hendrik Sattler wrote:
> > > Zitat von Iain Hibbert <plunky <at> netbsd.org>:
> > > > From: Iain Hibbert <plunky <at> rya-online.net>
> > > >
> > > > add "-Wall foreign nostdinc" to the automake arguments
> > >
> > > Why "-Wall"? That's not strictly needed, is it?
> >
> > depends if you think that the compiler has anything useful to say.. you
> > can look at it like assert(), its not necessary but it will show up
> > problems that might otherwise slip through and cause unrelated trouble
> > that is very difficult to track down.
>
> That -Wall is for autotools, not for the compiler.

Ok, have revised patch to follow to just add "nostdinc" since the other
two are merely extra warnings and suchlike, and explicitly included
$(top_srcdir) as an include path. That means that

  #include "xxx"

includes xxx from the current directory, and

  #include <xxx>

includes xxx from the standard search path, which makes it possible to
include <uuid.h> and "uuid.h" in the same sources..
(Continue reading)

Iain Hibbert | 22 Jun 2011 14:26
Picon
Gravatar

[PATCH 3/4] use times() function correctly

From: Iain Hibbert <plunky <at> galant.ukfsn.org>

  - don't test for HAVE_SYS_TIMES_H before we include "config.h"
    (in common.h)

  - Opengroup specification says that a struct tms * must be
    passed to times() and some implementations don't validate
    that, causing a segmentation fault if you pass NULL.

  - Opengroup also notes that the value of clock ticks per second
    can be retrieved by sysconf(), use that to produce output in
    milliseconds.

  - cast the clock_t to long for printing.
---
 apps/obexftp.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/apps/obexftp.c b/apps/obexftp.c
index bc1da89..4538c0f 100644
--- a/apps/obexftp.c
+++ b/apps/obexftp.c
 <at>  <at>  -29,10 +29,6  <at>  <at> 

 #include <sys/types.h>

-#ifdef HAVE_SYS_TIMES_H
-#include <sys/times.h>
-#endif
-
(Continue reading)

Iain Hibbert | 22 Jun 2011 14:26
Picon
Gravatar

[PATCH 4/4] add generic BSD Bluetooth and Service Discovery support

From: Iain Hibbert <plunky <at> galant.ukfsn.org>

this should work on NetBSD and FreeBSD
and possibly OpenBSD and DragonflyBSD also with a little work
---
 acinclude.m4     |   84 ++++++--------
 obexftp/bt_kit.c |  347 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 obexftp/bt_kit.h |   34 +++---
 obexftp/client.c |    7 +-
 4 files changed, 405 insertions(+), 67 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 9326885..c8ba777 100644
--- a/acinclude.m4
+++ b/acinclude.m4
 <at>  <at>  -50,31 +50,44  <at>  <at>  AC_DEFUN([AC_PATH_WINBT], [
 	AC_MSG_RESULT([$winbt_found]) 
 ])

-AC_DEFUN([AC_PATH_NETBSDBT], [
-	AC_CACHE_CHECK([for NetBSD Bluetooth support], netbsdbt_found, [
+AC_DEFUN([AC_PATH_BSDBT], [
+	AC_CACHE_CHECK([for BSD Bluetooth support], bsdbt_found, [
 		AC_TRY_COMPILE([
 				#include <bluetooth.h>
 			], [
-				struct sockaddr_bt *bt;
-			], netbsdbt_found=yes, netbsdbt_found=no)
+				#ifndef BTPROTO_RFCOMM
+				#define BTPROTO_RFCOMM BLUETOOTH_PROTO_RFCOMM
(Continue reading)

Hendrik Sattler | 27 Jun 2011 13:38
Picon

Re: [PATCH 4/4] add generic BSD Bluetooth and Service Discovery support

Zitat von Iain Hibbert <plunky <at> netbsd.org>:

> From: Iain Hibbert <plunky <at> galant.ukfsn.org>
>
> this should work on NetBSD and FreeBSD
> and possibly OpenBSD and DragonflyBSD also with a little work
> ---
>  acinclude.m4     |   84 ++++++--------
>  obexftp/bt_kit.c |  347  
> +++++++++++++++++++++++++++++++++++++++++++++++++++++-
>  obexftp/bt_kit.h |   34 +++---
>  obexftp/client.c |    7 +-
>  4 files changed, 405 insertions(+), 67 deletions(-)
>
> diff --git a/acinclude.m4 b/acinclude.m4
> index 9326885..c8ba777 100644
> --- a/acinclude.m4
> +++ b/acinclude.m4
>  <at>  <at>  -50,31 +50,44  <at>  <at>  AC_DEFUN([AC_PATH_WINBT], [
>  	AC_MSG_RESULT([$winbt_found])
>  ])
>
> -AC_DEFUN([AC_PATH_NETBSDBT], [
> -	AC_CACHE_CHECK([for NetBSD Bluetooth support], netbsdbt_found, [
> +AC_DEFUN([AC_PATH_BSDBT], [
> +	AC_CACHE_CHECK([for BSD Bluetooth support], bsdbt_found, [
>  		AC_TRY_COMPILE([
>  				#include <bluetooth.h>
>  			], [
> -				struct sockaddr_bt *bt;
(Continue reading)

Iain Hibbert | 29 Jun 2011 18:39

Re: [PATCH 4/4] add generic BSD Bluetooth and Service Discovery support

On Mon, 27 Jun 2011, Hendrik Sattler wrote:

> > +#if defined(__NetBSD__) || defined(__FreeBSD__)
>
> Is it possible with the build system (autotools) to no used ifdef here
> but separate files like bt_kit_bsd.c, bt_kit_win32.c, bt_kit_linux.c
> and bt_kit_dummy.c? If not, enlarging this one file is ok, too.

it should be, you can do things like

if [ BSD ]; then
	BLUETOOTH_SRC=	bt_kit_bsd.c
fi

if [ BLUEZ ]; then
	BLUETOOTH_SRC=	bt_kit_bluez.c
fi

AC_SUBST(BLUETOOTH_SRC)

in the configure script, then just add  <at> BLUETOOTH_SRC <at>  to the sources in
the Makefile.am. But, I'm not sure how much work it is worth putting into
obexftp, BlueZ does have another obex project that likely has the bigger
future..

> > +/* Various BSD systems */
> > +#elif defined(__NetBSD__) || defined(__FreeBSD__)
> > +#define COMPAT_BLUEZ
>
> Can this be used without problems? Should be use it in OpenOBEX, too?
(Continue reading)


Gmane