r3518: fixed some includes to be consistent.
authorAndrew Tridgell <tridge@samba.org>
Thu, 4 Nov 2004 02:19:25 +0000 (02:19 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:05:27 +0000 (13:05 -0500)
 - use #include <XXX.h> for operating system includes
 - use includes relative to include/ for things like system/wait.h

also fixed the thread backend to work somewhat. To fix it properly we need to do this:

 - add a configure test for support for thread local storage (the __thread keyword)
 - refuse to do pthreads if tls doesn't work
 - refuse to do pthreads if seteuid() affects process instead of thread
 - defined THREAD_LOCAL as __thread when WITH_PTHREADS
 - add THREAD_LOCAL to all the global data structures that should be
   thread local (there are quite a few)

right now the thread backend falls over when you hit it with several
connections at once, due to the lack of __thread on some critical
structures.
(This used to be commit 0dc1deabd0b53bc7a6f6cee2ed99e2cbbe422262)

source4/lib/getsmbpass.c
source4/smb_server/smb_server.c
source4/smbd/process_thread.c

index 0d8f4a4b7ea169239b647949617efa5c0ef92ffc..4ffcde8dfd31c03170510d62ae1f67019a432be1 100644 (file)
@@ -19,8 +19,8 @@ Cambridge, MA 02139, USA.  */
 /* Modified to use with samba by Jeremy Allison, 8th July 1995. */
 
 #include "includes.h"
-#include "include/system/terminal.h"
-#include "include/system/wait.h"
+#include "system/terminal.h"
+#include "system/wait.h"
 
 #ifdef REPLACE_GETPASS
 
index 861186a8d7bc981ae837f3e6a9b20ec26ebb745f..3c17abe6fbb3359bbc183cd1f02cddf0efe74900 100644 (file)
@@ -173,7 +173,6 @@ static NTSTATUS receive_smb_request(struct smbsrv_connection *smb_conn)
   These flags determine some of the permissions required to do an operation 
 */
 #define AS_USER (1<<0)
-#define USE_MUTEX (1<<1)
 
 /* 
    define a list of possible SMB messages and their corresponding
@@ -299,12 +298,12 @@ static const struct smb_message_struct
 /* 0x6d */ { NULL, NULL, 0 },
 /* 0x6e */ { NULL, NULL, 0 },
 /* 0x6f */ { NULL, NULL, 0 },
-/* 0x70 */ { "SMBtcon",reply_tcon,USE_MUTEX},
+/* 0x70 */ { "SMBtcon",reply_tcon,0},
 /* 0x71 */ { "SMBtdis",reply_tdis,0},
-/* 0x72 */ { "SMBnegprot",reply_negprot,USE_MUTEX},
-/* 0x73 */ { "SMBsesssetupX",reply_sesssetup,USE_MUTEX},
+/* 0x72 */ { "SMBnegprot",reply_negprot,0},
+/* 0x73 */ { "SMBsesssetupX",reply_sesssetup,0},
 /* 0x74 */ { "SMBulogoffX", reply_ulogoffX, 0}, /* ulogoff doesn't give a valid TID */
-/* 0x75 */ { "SMBtconX",reply_tcon_and_X,USE_MUTEX},
+/* 0x75 */ { "SMBtconX",reply_tcon_and_X,0},
 /* 0x76 */ { NULL, NULL, 0 },
 /* 0x77 */ { NULL, NULL, 0 },
 /* 0x78 */ { NULL, NULL, 0 },
@@ -520,15 +519,7 @@ static void switch_message(int type, struct smbsrv_request *req)
                return;
        }
 
-       /* THREAD TESTING: use mutex to serialize calls to critical
-          functions with global state */
-       if (flags & USE_MUTEX) {
-               MUTEX_LOCK_BY_ID(MUTEX_SMBD);
-       }
        smb_messages[type].fn(req);
-       if (flags & USE_MUTEX) {
-               MUTEX_UNLOCK_BY_ID(MUTEX_SMBD);
-       }
 }
 
 
index da3af9202aa2a7370fcf5fb20b2a6b9d9b1fcc36..0eead7f33cf2d24644b2d0541eb98a7153bfe284 100644 (file)
 */
 
 #include "includes.h"
+#include <pthread.h>
+#ifdef HAVE_BACKTRACE
+#include <execinfo.h>
+#endif
+#include "system/wait.h"
 #include "events.h"
 #include "dlinklist.h"
 #include "smb_server/smb_server.h"
 #include "process_model.h"
-#include "include/system/wait.h"
-#include "pthread.h"
-#ifdef HAVE_BACKTRACE
-#include "execinfo.h"
-#endif
 
 static void *thread_connection_fn(void *thread_parm)
 {
@@ -65,8 +65,6 @@ static void thread_accept_connection(struct event_context *ev, struct fd_event *
        /* accept an incoming connection. */
        status = socket_accept(server_socket->socket, &sock);
        if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(0,("accept_connection_single: accept: %s\n",
-                        nt_errstr(status)));
                return;
        }
        
@@ -79,14 +77,12 @@ static void thread_accept_connection(struct event_context *ev, struct fd_event *
 
        ev = event_context_init(server_socket);
        if (!ev) {
-               DEBUG(0,("thread_accept_connection: failed to create event_context!\n"));
                socket_destroy(sock);
                return; 
        }
 
        conn = server_setup_connection(ev, server_socket, sock, t, pthread_self());
        if (!conn) {
-               DEBUG(0,("server_setup_connection(ev, server_socket, sock, t) failed\n"));
                event_context_destroy(ev);
                socket_destroy(sock);
                return;
@@ -120,7 +116,7 @@ static void thread_accept_connection(struct event_context *ev, struct fd_event *
 /* called when a SMB connection goes down */
 static void thread_terminate_connection(struct server_connection *conn, const char *reason) 
 {
-       DEBUG(0,("thread_terminate_connection: reason[%s]\n",reason));
+       DEBUG(10,("thread_terminate_connection: reason[%s]\n",reason));
 
        if (conn) {
                talloc_free(conn);