r6346: Add a counter for the number of SMB operations per connection/file.
authorJeremy Allison <jra@samba.org>
Thu, 14 Apr 2005 23:32:56 +0000 (23:32 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:56:37 +0000 (10:56 -0500)
You will need to do a make clean after SVN updating this. Next will
come a smbcontrol message to dump this info. This should be interesting
to profile client activity.
Jeremy.
(This used to be commit 743174da86ac724fc9ee3d4b7bd9a2a97a234bd8)

source3/include/smb.h
source3/include/smb_macros.h
source3/smbd/process.c

index 80b207565175ca26719839e8c00b19cd4a963fff..f96d79fd06367fea4485e64b73ac2c53932b7bf2 100644 (file)
@@ -412,6 +412,7 @@ typedef struct files_struct {
        int fnum;
        struct connection_struct *conn;
        int fd;
+       unsigned int num_smb_operations;
        uint16 rap_print_jobid;
        SMB_DEV_T dev;
        SMB_INO_T inode;
@@ -533,6 +534,7 @@ typedef struct connection_struct
        time_t lastused;
        BOOL used;
        int num_files_open;
+       unsigned int num_smb_operations; /* Count of smb operations on this tree. */
 
        BOOL case_sensitive;
        BOOL case_preserve;
index ab4ee5ee73b32085a977b15252c8b74cf41bdc57..b7a3a68bec3fd070c6c344bf1eccb15574405e08 100644 (file)
@@ -94,6 +94,7 @@
                                return(ERROR_DOS(ERRDOS,ERRbadfid)); \
                        else if((fsp)->fd == -1) \
                                return(ERROR_DOS(ERRDOS,ERRbadaccess));\
+                       (fsp)->num_smb_operations++;\
                        } while(0)
 
 #define CHECK_READ(fsp) if (!(fsp)->can_read) \
index 1bf6f4f9d1430fa1f585d880493cf33654f9b4bf..e79686b43e2fbd48e4676d039ea04dd9dcf8d9b8 100644 (file)
@@ -962,8 +962,12 @@ static int switch_message(int type,char *inbuf,char *outbuf,int size,int bufsize
                        return(ERROR_DOS(ERRSRV,ERRaccess));        
 
                /* load service specific parameters */
-               if (conn && !set_current_service(conn,SVAL(inbuf,smb_flg),(flags & (AS_USER|DO_CHDIR)?True:False)))
-                       return(ERROR_DOS(ERRSRV,ERRaccess));
+               if (conn) {
+                       if (!set_current_service(conn,SVAL(inbuf,smb_flg),(flags & (AS_USER|DO_CHDIR)?True:False))) {
+                               return(ERROR_DOS(ERRSRV,ERRaccess));
+                       }
+                       conn->num_smb_operations++;
+               }
 
                /* does this protocol need to be run as guest? */
                if ((flags & AS_GUEST) && (!change_to_guest() ||