Changeset 745 for trunk/server/source3/lib/messages_local.c
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source3/lib/messages_local.c
r414 r745 3 3 Samba internal messaging functions 4 4 Copyright (C) 2007 by Volker Lendecke 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of the GNU General Public License as published by 8 8 the Free Software Foundation; either version 3 of the License, or 9 9 (at your option) any later version. 10 10 11 11 This program is distributed in the hope that it will be useful, 12 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 GNU General Public License for more details. 15 15 16 16 You should have received a copy of the GNU General Public License 17 17 along with this program. If not, see <http://www.gnu.org/licenses/>. … … 22 22 @{ 23 23 @file messages.c 24 24 25 25 @brief Module for internal messaging between Samba daemons. 26 26 … … 44 44 45 45 #include "includes.h" 46 #include "librpc/gen_ndr/messaging.h" 47 #include "librpc/gen_ndr/ndr_messaging.h" 46 #include "system/filesys.h" 47 #include "messages.h" 48 #include "lib/util/tdb_wrap.h" 48 49 49 50 struct messaging_tdb_context { … … 104 105 105 106 ctx->tdb = tdb_wrap_open(ctx, lock_path("messages.tdb"), 0, 106 TDB_CLEAR_IF_FIRST|TDB_DEFAULT|TDB_VOLATILE ,107 TDB_CLEAR_IF_FIRST|TDB_DEFAULT|TDB_VOLATILE|TDB_INCOMPATIBLE_HASH, 107 108 O_RDWR|O_CREAT,0600); 108 109 109 110 if (!ctx->tdb) { 110 111 NTSTATUS status = map_nt_error_from_unix(errno); 111 DEBUG( 0, ("ERROR: Failed to initialise messages database: "112 DEBUG(2, ("ERROR: Failed to initialise messages database: " 112 113 "%s\n", strerror(errno))); 113 114 TALLOC_FREE(result); … … 134 135 } 135 136 137 bool messaging_tdb_parent_init(TALLOC_CTX *mem_ctx) 138 { 139 struct tdb_wrap *db; 140 141 /* 142 * Open the tdb in the parent process (smbd) so that our 143 * CLEAR_IF_FIRST optimization in tdb_reopen_all can properly 144 * work. 145 */ 146 147 db = tdb_wrap_open(mem_ctx, lock_path("messages.tdb"), 0, 148 TDB_CLEAR_IF_FIRST|TDB_DEFAULT|TDB_VOLATILE|TDB_INCOMPATIBLE_HASH, 149 O_RDWR|O_CREAT,0600); 150 if (db == NULL) { 151 DEBUG(1, ("could not open messaging.tdb: %s\n", 152 strerror(errno))); 153 return false; 154 } 155 return true; 156 } 157 136 158 /******************************************************************* 137 159 Form a static tdb key from a pid. … … 146 168 147 169 SMB_ASSERT(key != NULL); 148 170 149 171 kbuf.dptr = (uint8 *)key; 150 172 kbuf.dsize = strlen(key)+1; … … 180 202 181 203 ndr_err = ndr_pull_struct_blob( 182 &blob, result, NULL,result,204 &blob, result, result, 183 205 (ndr_pull_flags_fn_t)ndr_pull_messaging_array); 184 206 … … 222 244 } 223 245 224 ndr_err = ndr_push_struct_blob( 225 &blob, mem_ctx, NULL, array, 246 ndr_err = ndr_push_struct_blob(&blob, mem_ctx, array, 226 247 (ndr_push_flags_fn_t)ndr_push_messaging_array); 227 248 … … 361 382 rec[msg_array->num_messages].msg_type = msg_type & MSG_TYPE_MASK; 362 383 rec[msg_array->num_messages].dest = pid; 363 rec[msg_array->num_messages].src = procid_self();384 rec[msg_array->num_messages].src = msg_ctx->id; 364 385 rec[msg_array->num_messages].buf = *data; 365 386 … … 372 393 goto done; 373 394 } 374 395 375 396 status = message_notify(pid); 376 397 … … 388 409 389 410 /**************************************************************************** 390 Retrieve all messages for the currentprocess.411 Retrieve all messages for a process. 391 412 ****************************************************************************/ 392 413 393 414 static NTSTATUS retrieve_all_messages(TDB_CONTEXT *msg_tdb, 415 struct server_id id, 394 416 TALLOC_CTX *mem_ctx, 395 417 struct messaging_array **presult) 396 418 { 397 419 struct messaging_array *result; 398 TDB_DATA key = message_key_pid(mem_ctx, procid_self());420 TDB_DATA key = message_key_pid(mem_ctx, id); 399 421 NTSTATUS status; 400 422 … … 444 466 ctx->received_messages)); 445 467 446 status = retrieve_all_messages(tdb->tdb, NULL, &msg_array);468 status = retrieve_all_messages(tdb->tdb, msg_ctx->id, NULL, &msg_array); 447 469 if (!NT_STATUS_IS_OK(status)) { 448 470 DEBUG(0, ("message_dispatch: failed to retrieve messages: %s\n",
Note:
See TracChangeset
for help on using the changeset viewer.