2 Unix SMB/CIFS implementation.
3 process model manager - main loop
4 Copyright (C) Andrew Tridgell 1992-2003
5 Copyright (C) James J Myers 2003 <myersjj@samba.org>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 /* the list of currently registered process models */
28 struct model_ops *ops;
30 static int num_models;
33 register a process model.
35 The 'name' can be later used by other backends to find the operations
36 structure for this backend.
38 BOOL register_process_model(const char *name, struct model_ops *ops)
40 if (process_model_byname(name) != NULL) {
41 /* its already registered! */
42 DEBUG(2,("process_model '%s' already registered\n",
47 models = Realloc(models, sizeof(models[0]) * (num_models+1));
49 smb_panic("out of memory in register_process_model");
52 models[num_models].name = smb_xstrdup(name);
53 models[num_models].ops = smb_xmemdup(ops, sizeof(*ops));
61 return the operations structure for a named backend of the specified type
63 struct model_ops *process_model_byname(const char *name)
67 for (i=0;i<num_models;i++) {
68 if (strcmp(models[i].name, name) == 0) {
77 /* initialise the builtin process models */
78 void process_model_init(void)
80 process_model_standard_init();
81 process_model_single_init();
83 process_model_thread_init();