s3-server_id Add id2 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>
Mon, 2 May 2011 01:11:56 +0000 (11:11 +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
id2 to indicate the different tasks within a single unix process.

Andrew Bartlett

source3/lib/serverid.c
source3/lib/util.c
source3/librpc/idl/server_id.idl

index f13c66e2c912c4eab66cc252a6ff5eadca80a08f..a6a34c7e13fcae26b2d8c6055893c20f410ecb12 100644 (file)
@@ -24,6 +24,7 @@
 
 struct serverid_key {
        pid_t pid;
+       uint32_t id2;
        uint32_t vnn;
 };
 
@@ -70,6 +71,7 @@ static void serverid_fill_key(const struct server_id *id,
 {
        ZERO_STRUCTP(key);
        key->pid = id->pid;
+       key->id2 = id->id2;
        key->vnn = id->vnn;
 }
 
@@ -273,6 +275,7 @@ static bool serverid_rec_parse(const struct db_record *rec,
        memcpy(&data, rec->value.dptr, sizeof(data));
 
        id->pid = key.pid;
+       id->id2 = key.id2;
        id->vnn = key.vnn;
        id->unique_id = data.unique_id;
        *msg_flags = data.msg_flags;
index 8805197f2d8297a59072c9328534a0ebb0773730..db340000430fbbacdf9ef26c39a796c411bf8304 100644 (file)
@@ -2283,6 +2283,7 @@ struct server_id pid_to_procid(pid_t pid)
 {
        struct server_id result;
        result.pid = pid;
+       result.id2 = 0;
        result.unique_id = my_unique_id;
        result.vnn = my_vnn;
        return result;
@@ -2297,6 +2298,8 @@ bool procid_equal(const struct server_id *p1, const struct server_id *p2)
 {
        if (p1->pid != p2->pid)
                return False;
+       if (p1->id2 != p2->id2)
+               return False;
        if (p1->vnn != p2->vnn)
                return False;
        return True;
@@ -2312,6 +2315,8 @@ bool procid_is_me(const struct server_id *pid)
 {
        if (pid->pid != sys_getpid())
                return False;
+       if (pid->id2 != 0)
+               return False;
        if (pid->vnn != my_vnn)
                return False;
        return True;
index ed727881c7362db59af046073d97759a0fb00471..3cb1b3e0948309dbc826bfbe66377245474e40ba 100644 (file)
@@ -19,6 +19,7 @@ interface server_id
 
        typedef [public] struct {
                uint32 pid;
+               uint32 id2;
                uint32 vnn;
                udlong unique_id;
        } server_id;