s3-server_id Add task_id to server_id to match Samba4
authorAndrew Bartlett <abartlet@samba.org>
Mon, 2 May 2011 00:27:36 +0000 (10:27 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 8 Jun 2011 04:40:48 +0000 (14:40 +1000)
This will allow this structure to be shared, and allow us to create a
common messaging system between all Samba processes.  Samba4 uses the
task_id to indicate the different tasks within a single unix process.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
source3/lib/serverid.c
source3/lib/util.c
source3/librpc/idl/server_id.idl

index b1f6a5711ef65abac9d7939f600c9cca143066bf..e63818e1b87a7bf584b789daf23c863b526fd0a1 100644 (file)
@@ -26,6 +26,7 @@
 
 struct serverid_key {
        pid_t pid;
+       uint32_t task_id;
        uint32_t vnn;
 };
 
@@ -72,6 +73,7 @@ static void serverid_fill_key(const struct server_id *id,
 {
        ZERO_STRUCTP(key);
        key->pid = id->pid;
+       key->task_id = id->task_id;
        key->vnn = id->vnn;
 }
 
@@ -275,6 +277,7 @@ static bool serverid_rec_parse(const struct db_record *rec,
        memcpy(&data, rec->value.dptr, sizeof(data));
 
        id->pid = key.pid;
+       id->task_id = key.task_id;
        id->vnn = key.vnn;
        id->unique_id = data.unique_id;
        *msg_flags = data.msg_flags;
index a596385bfb3947e4c946fb87726a2b70c09d97b1..0b28c913ad45978eeaac3d15c4933a78dafe1211 100644 (file)
@@ -1924,6 +1924,7 @@ struct server_id pid_to_procid(pid_t pid)
 {
        struct server_id result;
        result.pid = pid;
+       result.task_id = 0;
        result.unique_id = my_unique_id;
        result.vnn = my_vnn;
        return result;
@@ -1938,6 +1939,8 @@ bool procid_equal(const struct server_id *p1, const struct server_id *p2)
 {
        if (p1->pid != p2->pid)
                return False;
+       if (p1->task_id != p2->task_id)
+               return False;
        if (p1->vnn != p2->vnn)
                return False;
        return True;
@@ -1953,6 +1956,8 @@ bool procid_is_me(const struct server_id *pid)
 {
        if (pid->pid != sys_getpid())
                return False;
+       if (pid->task_id != 0)
+               return False;
        if (pid->vnn != my_vnn)
                return False;
        return True;
index ed727881c7362db59af046073d97759a0fb00471..095405af56d6ba042fe80d5b56a21f21e84f45af 100644 (file)
@@ -19,6 +19,7 @@ interface server_id
 
        typedef [public] struct {
                uint32 pid;
+               uint32 task_id;
                uint32 vnn;
                udlong unique_id;
        } server_id;