From e5b75ecd7efb550bac974ce6968f022aa2a19d69 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 21 Oct 2002 09:32:14 +0000 Subject: 2002-10-21 Roland McGrath * configure.in: Check for oskit/dev/stream.h. * configure, config.h.in: Regenerated. * oskit/ds_routines.c (dev_open_com): Query for an oskit_streamdev_t and open it. --- config.h.in | 3 +++ configure | 47 ++++++++++++++++++++++++++++++++++++++++++++--- configure.in | 2 ++ oskit/ds_routines.c | 29 +++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 3 deletions(-) diff --git a/config.h.in b/config.h.in index d391df81..3c60e134 100644 --- a/config.h.in +++ b/config.h.in @@ -7,3 +7,6 @@ /* Define this to nonzero to enable the software FPU emulator, used on machines that have no FPU. */ #undef FPE + +/* Define if you have the header file. */ +#undef HAVE_OSKIT_DEV_STREAM_H diff --git a/configure b/configure index bc7b2792..3b1f3fb8 100755 --- a/configure +++ b/configure @@ -1257,10 +1257,51 @@ else echo "$ac_t""yes, ok" 1>&6 fi +for ac_hdr in oskit/dev/stream.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1265: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1275: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + + SMP_LIBS= if test $MAXCPUS -gt 1; then echo $ac_n "checking for smp_init in -loskit_smp""... $ac_c" 1>&6 -echo "configure:1264: checking for smp_init in -loskit_smp" >&5 +echo "configure:1305: checking for smp_init in -loskit_smp" >&5 ac_lib_var=`echo oskit_smp'_'smp_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1268,7 +1309,7 @@ else ac_save_LIBS="$LIBS" LIBS="-loskit_smp $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1324: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else diff --git a/configure.in b/configure.in index 89a3b199..41e9280b 100644 --- a/configure.in +++ b/configure.in @@ -96,6 +96,8 @@ else AC_MSG_RESULT([yes, ok]) fi +AC_CHECK_HEADERS(oskit/dev/stream.h) + AC_SUBST(SMP_LIBS)SMP_LIBS= if test $MAXCPUS -gt 1; then AC_CHECK_LIB(oskit_smp, smp_init, [SMP_LIBS=-loskit_smp], [ diff --git a/oskit/ds_routines.c b/oskit/ds_routines.c index 1af34757..c674e0cd 100644 --- a/oskit/ds_routines.c +++ b/oskit/ds_routines.c @@ -49,6 +49,9 @@ #include #include #include +#ifdef HAVE_OSKIT_DEV_STREAM_H +# include +#endif #include #include #include @@ -401,6 +404,9 @@ dev_open_com (oskit_device_t *com_device, dev_mode_t mode, device_t *devp, oskit_bus_t *bus; oskit_blkdev_t *blkdev; oskit_netdev_t *netdev; +#ifdef oskit_streamdev_open + oskit_streamdev_t *streamdev; +#endif oskit_error_t rc; inline void asyncio_init (device_t dev) { @@ -465,6 +471,29 @@ dev_open_com (oskit_device_t *com_device, dev_mode_t mode, device_t *devp, ops = &net_device_ops; rc = ds_netdev_open (dev, netdev); } +#ifdef oskit_streamdev_open + else if (oskit_device_query (com_device, &oskit_streamdev_iid, + (void **) &streamdev) == 0) + { + rc = oskit_streamdev_open (streamdev, + ((mode & D_READ) ? OSKIT_DEV_OPEN_READ : 0) + | ((mode & D_WRITE) + ? OSKIT_DEV_OPEN_WRITE : 0), + &dev->com.stream.io); + oskit_streamdev_release (streamdev); + if (OSKIT_SUCCEEDED (rc)) + { + if (oskit_stream_query (dev->com.stream.io, &oskit_asyncio_iid, + (void **) &dev->com.stream.aio) == 0) + { + asyncio_init (dev); + ops = &asyncio_device_ops; + } + else + ops = &stream_device_ops; + } + } +#endif if (OSKIT_FAILED (rc)) { -- cgit v1.2.3