summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-05-17 07:17:51 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:53:48 -0500
commitb340a61cb935e014090eed7105f8f50c3a00e71b (patch)
treeeb3b1a64fb9203bea975a16215452fc04487d30d
parent92dd542aa01f2c3b64ca104696c731919f4d7ec7 (diff)
downloadsamba-b340a61cb935e014090eed7105f8f50c3a00e71b.tar.gz
samba-b340a61cb935e014090eed7105f8f50c3a00e71b.tar.bz2
samba-b340a61cb935e014090eed7105f8f50c3a00e71b.zip
r755: - disallow process_model _thread when we don't have pwread/pwrite
and have to use the nonthreadsafe wrapper - add pread/pwrite wrapper to ntvfs_simple - fix const warning in ntvfs_simple metze (This used to be commit f0b2e42978a28204f497cccb07e407f409e3bf50)
-rw-r--r--source4/ntvfs/simple/vfs_simple.c22
-rw-r--r--source4/smbd/process_model.m43
2 files changed, 24 insertions, 1 deletions
diff --git a/source4/ntvfs/simple/vfs_simple.c b/source4/ntvfs/simple/vfs_simple.c
index 37edd8aa11..1abf5ed9af 100644
--- a/source4/ntvfs/simple/vfs_simple.c
+++ b/source4/ntvfs/simple/vfs_simple.c
@@ -35,6 +35,26 @@
#define CHECK_READ_ONLY(req) do { if (lp_readonly(req->conn->service)) return NT_STATUS_ACCESS_DENIED; } while (0)
+#ifndef HAVE_PREAD
+static ssize_t pread(int __fd, void *__buf, size_t __nbytes, off_t __offset)
+{
+ if (lseek(__fd, __offset, SEEK_SET) != __offset) {
+ return -1;
+ }
+ return read(__fd, __buf, __nbytes);
+}
+#endif
+
+#ifndef HAVE_PWRITE
+static ssize_t pwrite(int __fd, const void *__buf, size_t __nbytes, off_t __offset)
+{
+ if (lseek(__fd, __offset, SEEK_SET) != __offset) {
+ return -1;
+ }
+ return write(__fd, __buf, __nbytes);
+}
+#endif
+
/*
connect to a share - used when a tree_connect operation comes
in. For a disk based backend we needs to ensure that the base
@@ -151,7 +171,7 @@ static NTSTATUS svfs_map_fileinfo(struct request_context *req, union smb_fileinf
struct svfs_dir *dir = NULL;
char *pattern = NULL;
int i;
- char *s, *short_name;
+ const char *s, *short_name;
s = strrchr(unix_path, '/');
if (s) {
diff --git a/source4/smbd/process_model.m4 b/source4/smbd/process_model.m4
index 93dfeddcef..cbeedd1729 100644
--- a/source4/smbd/process_model.m4
+++ b/source4/smbd/process_model.m4
@@ -11,6 +11,9 @@ AC_ARG_WITH(pthreads,
[ case "$withval" in
yes)
AC_MSG_RESULT(yes)
+ if test x"$ac_cv_func_pread" != x"yes" -o x"$ac_cv_func_pwrite" != x"yes";then
+ AC_MSG_ERROR([You cannot enable threads when you don't have pread/pwrite!])
+ fi
SMB_MODULE_DEFAULT(process_model_thread,STATIC)
SMB_EXT_LIB_ENABLE(PTHREAD,YES)
;;