lib/module.c

ソースコードを見る。

データ構造

struct  smb_idle_list_ent

関数

static NTSTATUS do_smb_load_module (const char *module_name, BOOL is_probe)
NTSTATUS smb_load_module (const char *module_name)
int smb_load_modules (const char **modules)
NTSTATUS smb_probe_module (const char *subsystem, const char *module)
void init_modules (void)
smb_event_id_t smb_register_idle_event (smb_idle_event_fn *fn, void *data, time_t interval)
BOOL smb_unregister_idle_event (smb_event_id_t id)
void smb_run_idle_events (time_t now)

変数

static smb_event_id_t smb_idle_event_id = 1
static struct smb_idle_list_entsmb_idle_event_list = NULL


関数

static NTSTATUS do_smb_load_module ( const char *  module_name,
BOOL  is_probe 
) [static]

module.c30 行で定義されています。

参照先 errorget_friendly_nt_error_msg()handleinit()levelstatussys_dlerror()sys_dlopen()sys_dlsym().

参照元 smb_load_module()smb_probe_module().

00031 {
00032         void *handle;
00033         init_module_function *init;
00034         NTSTATUS status;
00035         const char *error;
00036 
00037         /* Always try to use LAZY symbol resolving; if the plugin has 
00038          * backwards compatibility, there might be symbols in the 
00039          * plugin referencing to old (removed) functions
00040          */
00041         handle = sys_dlopen(module_name, RTLD_LAZY);
00042 
00043         /* This call should reset any possible non-fatal errors that 
00044            occured since last call to dl* functions */
00045         error = sys_dlerror();
00046 
00047         if(!handle) {
00048                 int level = is_probe ? 3 : 0;
00049                 DEBUG(level, ("Error loading module '%s': %s\n", module_name, error ? error : ""));
00050                 return NT_STATUS_UNSUCCESSFUL;
00051         }
00052 
00053         init = (init_module_function *)sys_dlsym(handle, "init_module");
00054 
00055         /* we must check sys_dlerror() to determine if it worked, because
00056            sys_dlsym() can validly return NULL */
00057         error = sys_dlerror();
00058         if (error) {
00059                 DEBUG(0, ("Error trying to resolve symbol 'init_module' in %s: %s\n", 
00060                           module_name, error));
00061                 return NT_STATUS_UNSUCCESSFUL;
00062         }
00063 
00064         DEBUG(2, ("Module '%s' loaded\n", module_name));
00065 
00066         status = init();
00067         if (!NT_STATUS_IS_OK(status)) {
00068                 DEBUG(0, ("Module '%s' initialization failed: %s\n",
00069                             module_name, get_friendly_nt_error_msg(status)));
00070         }
00071 
00072         return status;
00073 }

NTSTATUS smb_load_module ( const char *  module_name  ) 

module.c75 行で定義されています。

参照先 do_smb_load_module().

参照元 smb_load_modules().

00076 {
00077         return do_smb_load_module(module_name, False);
00078 }

int smb_load_modules ( const char **  modules  ) 

module.c82 行で定義されています。

参照先 smb_load_module().

参照元 init_modules()main().

00083 {
00084         int i;
00085         int success = 0;
00086 
00087         for(i = 0; modules[i]; i++){
00088                 if(NT_STATUS_IS_OK(smb_load_module(modules[i]))) {
00089                         success++;
00090                 }
00091         }
00092 
00093         DEBUG(2, ("%d modules successfully loaded\n", success));
00094 
00095         return success;
00096 }

NTSTATUS smb_probe_module ( const char *  subsystem,
const char *  module 
)

module.c98 行で定義されています。

参照先 do_smb_load_module()lib_path()shlib_ext().

参照元 idmap_init()load_auth_module()make_pdb_method_name()nss_init()smb_iconv_open()vfs_init_custom().

00099 {
00100         pstring full_path;
00101         
00102         /* Check for absolute path */
00103 
00104         /* if we make any 'samba multibyte string' 
00105            calls here, we break 
00106            for loading string modules */
00107 
00108         DEBUG(5, ("Probing module '%s'\n", module));
00109 
00110         if (module[0] == '/')
00111                 return do_smb_load_module(module, True);
00112         
00113         pstrcpy(full_path, lib_path(subsystem));
00114         pstrcat(full_path, "/");
00115         pstrcat(full_path, module);
00116         pstrcat(full_path, ".");
00117         pstrcat(full_path, shlib_ext());
00118 
00119         DEBUG(5, ("Probing module '%s': Trying to load from %s\n", module, full_path));
00120         
00121         return do_smb_load_module(full_path, True);
00122 }

void init_modules ( void   ) 

module.c146 行で定義されています。

参照先 smb_load_modules().

参照元 main().

00147 {
00148         /* FIXME: This can cause undefined symbol errors :
00149          *  smb_register_vfs() isn't available in nmbd, for example */
00150         if(lp_preload_modules()) 
00151                 smb_load_modules(lp_preload_modules());
00152 }

smb_event_id_t smb_register_idle_event ( smb_idle_event_fn fn,
void *  data,
time_t  interval 
)

module.c174 行で定義されています。

参照先 smb_idle_list_ent::datasmb_idle_list_ent::fnsmb_idle_list_ent::idsmb_idle_list_ent::intervalsmb_idle_list_ent::lastrunsmb_idle_event_list.

参照元 set_disp_info_cache_timeout()smbldap_init().

00175 {
00176         struct smb_idle_list_ent *event;
00177 
00178         if (!fn) {      
00179                 return SMB_EVENT_ID_INVALID;
00180         }
00181 
00182         event = SMB_MALLOC_P(struct smb_idle_list_ent);
00183         if (!event) {
00184                 DEBUG(0,("malloc() failed!\n"));
00185                 return SMB_EVENT_ID_INVALID;
00186         }
00187         event->fn = fn;
00188         event->data = data;
00189         event->interval = interval;
00190         event->lastrun = 0;
00191         event->id = smb_idle_event_id++;
00192 
00193         DLIST_ADD(smb_idle_event_list,event);
00194 
00195         return event->id;
00196 }

BOOL smb_unregister_idle_event ( smb_event_id_t  id  ) 

module.c198 行で定義されています。

参照先 smb_idle_list_ent::idsmb_idle_list_ent::nextsmb_idle_event_list.

参照元 disp_info_cache_idle_timeout_handler()force_flush_samr_cache()set_disp_info_cache_timeout()smbldap_free_struct().

00199 {
00200         struct smb_idle_list_ent *event = smb_idle_event_list;
00201         
00202         while(event) {
00203                 if (event->id == id) {
00204                         DLIST_REMOVE(smb_idle_event_list,event);
00205                         SAFE_FREE(event);
00206                         return True;
00207                 }
00208                 event = event->next;
00209         }
00210         
00211         return False;
00212 }

void smb_run_idle_events ( time_t  now  ) 

module.c214 行で定義されています。

参照先 smb_idle_list_ent::datasmb_idle_list_ent::fnsmb_idle_list_ent::intervalsmb_idle_list_ent::lastrunsmb_idle_list_ent::nextsmb_idle_event_list.

参照元 timeout_processing().

00215 {
00216         struct smb_idle_list_ent *event = smb_idle_event_list;
00217 
00218         while (event) {
00219                 struct smb_idle_list_ent *next = event->next;
00220                 time_t interval;
00221 
00222                 if (event->interval <= 0) {
00223                         interval = SMB_IDLE_EVENT_DEFAULT_INTERVAL;
00224                 } else if (event->interval >= SMB_IDLE_EVENT_MIN_INTERVAL) {
00225                         interval = event->interval;
00226                 } else {
00227                         interval = SMB_IDLE_EVENT_MIN_INTERVAL;
00228                 }
00229                 if (now >(event->lastrun+interval)) {
00230                         event->lastrun = now;
00231                         event->fn(&event->data,&event->interval,now);
00232                 }
00233                 event = next;
00234         }
00235 
00236         return;
00237 }


変数

smb_event_id_t smb_idle_event_id = 1 [static]

module.c161 行で定義されています。

struct smb_idle_list_ent* smb_idle_event_list = NULL [static]

module.c172 行で定義されています。

参照元 smb_register_idle_event()smb_run_idle_events()smb_unregister_idle_event().


Sambaに対してSat Aug 29 21:23:36 2009に生成されました。  doxygen 1.4.7