summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-05-02 10:27:36 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-06-09 12:40:08 +0200
commitcc3b75b807c6dd63b6dde3b449054f6640826f7c (patch)
treed3886063e2bea4ddc8c9e112468316f078c30310
parent8d803d5a0a9a7815c4e6fcbd9b7c652fb85e94dd (diff)
downloadsamba-cc3b75b807c6dd63b6dde3b449054f6640826f7c.tar.gz
samba-cc3b75b807c6dd63b6dde3b449054f6640826f7c.tar.bz2
samba-cc3b75b807c6dd63b6dde3b449054f6640826f7c.zip
s3-server_id Add task_id to server_id to match Samba4
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>
-rw-r--r--source3/lib/serverid.c3
-rw-r--r--source3/lib/util.c5
-rw-r--r--source3/librpc/idl/server_id.idl1
3 files changed, 9 insertions, 0 deletions
diff --git a/source3/lib/serverid.c b/source3/lib/serverid.c
index b1f6a5711e..e63818e1b8 100644
--- a/source3/lib/serverid.c
+++ b/source3/lib/serverid.c
@@ -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;
diff --git a/source3/lib/util.c b/source3/lib/util.c
index af5f63995b..a0b6d9f55d 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -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;
diff --git a/source3/librpc/idl/server_id.idl b/source3/librpc/idl/server_id.idl
index ed727881c7..095405af56 100644
--- a/source3/librpc/idl/server_id.idl
+++ b/source3/librpc/idl/server_id.idl
@@ -19,6 +19,7 @@ interface server_id
typedef [public] struct {
uint32 pid;
+ uint32 task_id;
uint32 vnn;
udlong unique_id;
} server_id;