svn commit: samba r13263 - in branches/SAMBA_4_0/source: build/m4 client

jpeach at samba.org jpeach at samba.org
Tue Jan 31 21:56:13 GMT 2006


Author: jpeach
Date: 2006-01-31 21:56:12 +0000 (Tue, 31 Jan 2006)
New Revision: 13263

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=13263

Log:
Check whether open(2) will accept the O_DIRECT flag. This should fix the
build on NetBSD.

Modified:
   branches/SAMBA_4_0/source/build/m4/rewrite.m4
   branches/SAMBA_4_0/source/client/cifsddio.c


Changeset:
Modified: branches/SAMBA_4_0/source/build/m4/rewrite.m4
===================================================================
--- branches/SAMBA_4_0/source/build/m4/rewrite.m4	2006-01-31 21:54:24 UTC (rev 13262)
+++ branches/SAMBA_4_0/source/build/m4/rewrite.m4	2006-01-31 21:56:12 UTC (rev 13263)
@@ -496,6 +496,18 @@
 ;;
 esac
 
+AC_CACHE_CHECK([for O_DIRECT flag to open(2)],samba_cv_HAVE_OPEN_O_DIRECT,[
+AC_TRY_COMPILE([
+#include <unistd.h>
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif],
+[int fd = open("/dev/null", O_DIRECT);],
+samba_cv_HAVE_OPEN_O_DIRECT=yes,samba_cv_HAVE_OPEN_O_DIRECT=no)])
+if test x"$samba_cv_HAVE_OPEN_O_DIRECT" = x"yes"; then
+    AC_DEFINE(HAVE_OPEN_O_DIRECT,1,[Whether the open(2) accepts O_DIRECT])
+fi 
+
 ###############################################
 # test for where we get crypt() from
 AC_CHECK_LIB_EXT(crypt, CRYPT_LIBS, crypt)

Modified: branches/SAMBA_4_0/source/client/cifsddio.c
===================================================================
--- branches/SAMBA_4_0/source/client/cifsddio.c	2006-01-31 21:54:24 UTC (rev 13262)
+++ branches/SAMBA_4_0/source/client/cifsddio.c	2006-01-31 21:56:12 UTC (rev 13263)
@@ -99,8 +99,13 @@
 	fdh->h.io_write = fd_write_func;
 	fdh->h.io_seek = fd_seek_func;
 
-	if (options & DD_DIRECT_IO)
+	if (options & DD_DIRECT_IO) {
+#ifdef HAVE_OPEN_O_DIRECT
 		oflags |= O_DIRECT;
+#else
+		DEBUG(1, ("no support for direct IO on this platform\n"));
+#endif
+	}
 
 	if (options & DD_SYNC_IO)
 		oflags |= O_SYNC;



More information about the samba-cvs mailing list