smbprofile: Add dst pid to smbprofile_cleanup
authorVolker Lendecke <vl@samba.org>
Fri, 6 Nov 2015 13:55:35 +0000 (14:55 +0100)
committerVolker Lendecke <vl@samba.org>
Mon, 16 Nov 2015 13:51:33 +0000 (14:51 +0100)
The consolidation will soon be done by a separate process. We need to
avoid the getpid() call in smbprofile_cleanup().

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/include/smbprofile.h
source3/profile/profile.c
source3/smbd/server.c

index 76d9d2b6f6fd75f750da9965f2939e3c330af5b0..c771fd431d62543a4303ece653b3dc28c34683df 100644 (file)
@@ -533,7 +533,7 @@ static inline bool smbprofile_dump_pending(void)
 
 void smbprofile_dump(void);
 
-void smbprofile_cleanup(pid_t pid);
+void smbprofile_cleanup(pid_t pid, pid_t dst);
 void smbprofile_stats_accumulate(struct profile_stats *acc,
                                 const struct profile_stats *add);
 void smbprofile_collect(struct profile_stats *stats);
@@ -610,7 +610,7 @@ static inline void smbprofile_dump(void)
        return;
 }
 
-static inline void smbprofile_cleanup(pid_t pid)
+static inline void smbprofile_cleanup(pid_t pid, pid_t dst)
 {
        return;
 }
index 00cb3e550c42b6b19ead6aec3fbdc3e446c71aeb..1464a421b4d56040ff92853985f4c00b861438fa 100644 (file)
@@ -312,7 +312,7 @@ void smbprofile_dump(void)
        return;
 }
 
-void smbprofile_cleanup(pid_t pid)
+void smbprofile_cleanup(pid_t pid, pid_t dst)
 {
        TDB_DATA key = { .dptr = (uint8_t *)&pid, .dsize = sizeof(pid) };
        struct profile_stats s = {};
@@ -336,7 +336,7 @@ void smbprofile_cleanup(pid_t pid)
        tdb_delete(smbprofile_state.internal.db->tdb, key);
        tdb_chainunlock(smbprofile_state.internal.db->tdb, key);
 
-       pid = getpid();
+       pid = dst;
        ret = tdb_chainlock(smbprofile_state.internal.db->tdb, key);
        if (ret != 0) {
                return;
index c7a17332403665d4beb7a49f72e84cb758dc3cec..46e655a6e4f45f83516039247c775c5ef716a5fe 100644 (file)
@@ -579,7 +579,7 @@ static void remove_child_pid(struct smbd_parent_context *parent,
                           __func__, strerror(ret)));
        }
 
-       smbprofile_cleanup(pid);
+       smbprofile_cleanup(pid, getpid());
 
        for (child = parent->children; child != NULL; child = child->next) {
                if (child->pid == pid) {