r755: - disallow process_model _thread when we don't have pwread/pwrite
authorStefan Metzmacher <metze@samba.org>
Mon, 17 May 2004 07:17:51 +0000 (07:17 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:53:48 +0000 (12:53 -0500)
  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)

source4/ntvfs/simple/vfs_simple.c
source4/smbd/process_model.m4

index 37edd8aa11667c3e9f418a02e47eb8416bb9618c..1abf5ed9af20e40b79fa6eb15b7a84ff58f65694 100644 (file)
 
 #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) {
index 93dfeddcef6cb43297e5a82e6bb414b6a6b02647..cbeedd1729555fa7805f09854227a8c7e9915b97 100644 (file)
@@ -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)
        ;;