]> git.sesse.net Git - vlc/blob - src/modules/cache.c
Factor code to add an entry to the plugins cache in memory
[vlc] / src / modules / cache.c
1 /*****************************************************************************
2  * cache.c: Plugins cache
3  *****************************************************************************
4  * Copyright (C) 2001-2007 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Sam Hocevar <sam@zoy.org>
8  *          Ethan C. Baldridge <BaldridgeE@cadmus.com>
9  *          Hans-Peter Jansen <hpj@urpla.net>
10  *          Gildas Bazin <gbazin@videolan.org>
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25  *****************************************************************************/
26
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
30
31 #include <vlc_common.h>
32 #include "libvlc.h"
33
34 #include <stdlib.h>                                      /* free(), strtol() */
35 #include <stdio.h>                                              /* sprintf() */
36 #include <string.h>                                              /* strdup() */
37 #include <vlc_plugin.h>
38 #include <errno.h>
39
40 #include <sys/types.h>
41 #include <sys/stat.h>
42 #ifdef HAVE_UNISTD_H
43 #   include <unistd.h>
44 #endif
45 #include <assert.h>
46
47 #include "config/configuration.h"
48
49 #include <vlc_fs.h>
50
51 #include "modules/modules.h"
52
53
54 /*****************************************************************************
55  * Local prototypes
56  *****************************************************************************/
57 #ifdef HAVE_DYNAMIC_PLUGINS
58 static int    CacheLoadConfig  ( module_t *, FILE * );
59
60 /* Sub-version number
61  * (only used to avoid breakage in dev version when cache structure changes) */
62 #define CACHE_SUBVERSION_NUM 15
63
64 /* Cache filename */
65 #define CACHE_NAME "plugins.dat"
66 /* Magic for the cache filename */
67 #define CACHE_STRING "cache "PACKAGE_NAME" "PACKAGE_VERSION
68
69
70 void CacheDelete( vlc_object_t *obj, const char *dir )
71 {
72     char *path;
73
74     assert( dir != NULL );
75
76     if( asprintf( &path, "%s"DIR_SEP CACHE_NAME, dir ) == -1 )
77         return;
78     msg_Dbg( obj, "removing plugins cache file %s", path );
79     vlc_unlink( path );
80     free( path );
81 }
82
83 /**
84  * Loads a plugins cache file.
85  *
86  * This function will load the plugin cache if present and valid. This cache
87  * will in turn be queried by AllocateAllPlugins() to see if it needs to
88  * actually load the dynamically loadable module.
89  * This allows us to only fully load plugins when they are actually used.
90  */
91 size_t CacheLoad( vlc_object_t *p_this, const char *dir, module_cache_t ***r )
92 {
93     char *psz_filename;
94     FILE *file;
95     int i_size, i_read;
96     char p_cachestring[sizeof(CACHE_STRING)];
97     size_t i_cache;
98     int32_t i_marker;
99
100     assert( dir != NULL );
101
102     *r = NULL;
103     if( asprintf( &psz_filename, "%s"DIR_SEP CACHE_NAME, dir ) == -1 )
104         return 0;
105
106     msg_Dbg( p_this, "loading plugins cache file %s", psz_filename );
107
108     file = vlc_fopen( psz_filename, "rb" );
109     if( !file )
110     {
111         msg_Warn( p_this, "cannot read %s (%m)",
112                   psz_filename );
113         free( psz_filename );
114         return 0;
115     }
116     free( psz_filename );
117
118     /* Check the file is a plugins cache */
119     i_size = sizeof(CACHE_STRING) - 1;
120     i_read = fread( p_cachestring, 1, i_size, file );
121     if( i_read != i_size ||
122         memcmp( p_cachestring, CACHE_STRING, i_size ) )
123     {
124         msg_Warn( p_this, "This doesn't look like a valid plugins cache" );
125         fclose( file );
126         return 0;
127     }
128
129 #ifdef DISTRO_VERSION
130     /* Check for distribution specific version */
131     char p_distrostring[sizeof( DISTRO_VERSION )];
132     i_size = sizeof( DISTRO_VERSION ) - 1;
133     i_read = fread( p_distrostring, 1, i_size, file );
134     if( i_read != i_size ||
135         memcmp( p_distrostring, DISTRO_VERSION, i_size ) )
136     {
137         msg_Warn( p_this, "This doesn't look like a valid plugins cache" );
138         fclose( file );
139         return 0;
140     }
141 #endif
142
143     /* Check Sub-version number */
144     i_read = fread( &i_marker, 1, sizeof(i_marker), file );
145     if( i_read != sizeof(i_marker) || i_marker != CACHE_SUBVERSION_NUM )
146     {
147         msg_Warn( p_this, "This doesn't look like a valid plugins cache "
148                   "(corrupted header)" );
149         fclose( file );
150         return 0;
151     }
152
153     /* Check header marker */
154     i_read = fread( &i_marker, 1, sizeof(i_marker), file );
155     if( i_read != sizeof(i_marker) ||
156         i_marker != ftell( file ) - (int)sizeof(i_marker) )
157     {
158         msg_Warn( p_this, "This doesn't look like a valid plugins cache "
159                   "(corrupted header)" );
160         fclose( file );
161         return 0;
162     }
163
164     if (fread( &i_cache, 1, sizeof(i_cache), file ) != sizeof(i_cache) )
165     {
166         msg_Warn( p_this, "This doesn't look like a valid plugins cache "
167                   "(file too short)" );
168         fclose( file );
169         return 0;
170     }
171
172     module_cache_t **pp_cache = NULL;
173
174 #define LOAD_IMMEDIATE(a) \
175     if( fread( (void *)&a, sizeof(char), sizeof(a), file ) != sizeof(a) ) goto error
176 #define LOAD_STRING(a) \
177 { \
178     a = NULL; \
179     if( ( fread( &i_size, sizeof(i_size), 1, file ) != 1 ) \
180      || ( i_size > 16384 ) ) \
181         goto error; \
182     if( i_size ) { \
183         char *psz = xmalloc( i_size ); \
184         if( fread( psz, i_size, 1, file ) != 1 ) { \
185             free( psz ); \
186             goto error; \
187         } \
188         if( psz[i_size-1] ) { \
189             free( psz ); \
190             goto error; \
191         } \
192         a = psz; \
193     } \
194 }
195
196     for (size_t count = 0; count < i_cache;)
197     {
198         module_t *module;
199         uint16_t i_size;
200         int i_submodules;
201
202         module = vlc_module_create();
203
204         /* Load additional infos */
205         free (module->psz_object_name);
206         LOAD_STRING(module->psz_object_name);
207         LOAD_STRING(module->psz_shortname);
208         LOAD_STRING(module->psz_longname);
209         LOAD_STRING(module->psz_help);
210
211         LOAD_IMMEDIATE(module->i_shortcuts);
212         if (module->i_shortcuts > MODULE_SHORTCUT_MAX)
213             goto error;
214         else if (module->i_shortcuts == 0)
215             module->pp_shortcuts = NULL;
216         else
217         {
218             module->pp_shortcuts =
219                               xmalloc (sizeof (char **) * module->i_shortcuts);
220             for (unsigned j = 0; j < module->i_shortcuts; j++)
221                 LOAD_STRING(module->pp_shortcuts[j]);
222         }
223
224         LOAD_STRING(module->psz_capability);
225         LOAD_IMMEDIATE(module->i_score);
226         LOAD_IMMEDIATE(module->b_unloadable);
227
228         /* Config stuff */
229         if (CacheLoadConfig (module, file) != VLC_SUCCESS)
230             goto error;
231
232         LOAD_STRING(module->psz_filename);
233         LOAD_STRING(module->domain);
234         if (module->domain != NULL)
235             vlc_bindtextdomain (module->domain);
236
237         LOAD_IMMEDIATE( i_submodules );
238
239         while( i_submodules-- )
240         {
241             module_t *submodule = vlc_submodule_create (module);
242             free (submodule->psz_object_name);
243             free (submodule->pp_shortcuts);
244             LOAD_STRING(submodule->psz_object_name);
245             LOAD_STRING(submodule->psz_shortname);
246             LOAD_STRING(submodule->psz_longname);
247             LOAD_STRING(submodule->psz_help);
248
249             LOAD_IMMEDIATE(submodule->i_shortcuts);
250             if (submodule->i_shortcuts > MODULE_SHORTCUT_MAX)
251                 goto error;
252             else if (submodule->i_shortcuts == 0)
253                 submodule->pp_shortcuts = NULL;
254             else
255             {
256                 submodule->pp_shortcuts =
257                            xmalloc (sizeof (char **) * submodule->i_shortcuts);
258                 for (unsigned j = 0; j < submodule->i_shortcuts; j++)
259                     LOAD_STRING(submodule->pp_shortcuts[j]);
260             }
261
262             LOAD_STRING(submodule->psz_capability);
263             LOAD_IMMEDIATE(submodule->i_score);
264             LOAD_IMMEDIATE(submodule->b_unloadable);
265             LOAD_STRING(submodule->domain);
266         }
267
268         char *path;
269         struct stat st;
270
271         /* Load common info */
272         LOAD_STRING(path);
273         LOAD_IMMEDIATE(st.st_mtime);
274         LOAD_IMMEDIATE(st.st_size);
275
276         CacheAdd (&pp_cache, &count, path, &st, module);
277         free (path);
278         /* TODO: deal with errors */
279     }
280     fclose( file );
281
282     *r = pp_cache;
283     return i_cache;
284
285 error:
286     msg_Warn( p_this, "plugins cache not loaded (corrupted)" );
287
288     /* TODO: cleanup */
289     fclose( file );
290     return 0;
291 }
292
293
294 static int CacheLoadConfig( module_t *p_module, FILE *file )
295 {
296     uint32_t i_lines;
297     uint16_t i_size;
298
299     /* Calculate the structure length */
300     LOAD_IMMEDIATE( p_module->i_config_items );
301     LOAD_IMMEDIATE( p_module->i_bool_items );
302
303     LOAD_IMMEDIATE( i_lines );
304
305     /* Allocate memory */
306     if (i_lines)
307     {
308         p_module->p_config =
309             (module_config_t *)calloc( i_lines, sizeof(module_config_t) );
310         if( p_module->p_config == NULL )
311         {
312             p_module->confsize = 0;
313             return VLC_ENOMEM;
314         }
315     }
316     p_module->confsize = i_lines;
317
318     /* Do the duplication job */
319     for (size_t i = 0; i < i_lines; i++ )
320     {
321         LOAD_IMMEDIATE( p_module->p_config[i] );
322
323         LOAD_STRING( p_module->p_config[i].psz_type );
324         LOAD_STRING( p_module->p_config[i].psz_name );
325         LOAD_STRING( p_module->p_config[i].psz_text );
326         LOAD_STRING( p_module->p_config[i].psz_longtext );
327         LOAD_STRING( p_module->p_config[i].psz_oldname );
328
329         if (IsConfigStringType (p_module->p_config[i].i_type))
330         {
331             LOAD_STRING (p_module->p_config[i].orig.psz);
332             p_module->p_config[i].value.psz =
333                     (p_module->p_config[i].orig.psz != NULL)
334                         ? strdup (p_module->p_config[i].orig.psz) : NULL;
335         }
336         else
337             memcpy (&p_module->p_config[i].value, &p_module->p_config[i].orig,
338                     sizeof (p_module->p_config[i].value));
339
340         p_module->p_config[i].b_dirty = false;
341
342         if( p_module->p_config[i].i_list )
343         {
344             if( p_module->p_config[i].ppsz_list )
345             {
346                 int j;
347                 p_module->p_config[i].ppsz_list =
348                     xmalloc( (p_module->p_config[i].i_list+1) * sizeof(char *));
349                 if( p_module->p_config[i].ppsz_list )
350                 {
351                     for( j = 0; j < p_module->p_config[i].i_list; j++ )
352                         LOAD_STRING( p_module->p_config[i].ppsz_list[j] );
353                     p_module->p_config[i].ppsz_list[j] = NULL;
354                 }
355             }
356             if( p_module->p_config[i].ppsz_list_text )
357             {
358                 int j;
359                 p_module->p_config[i].ppsz_list_text =
360                     xmalloc( (p_module->p_config[i].i_list+1) * sizeof(char *));
361                 if( p_module->p_config[i].ppsz_list_text )
362                 {
363                   for( j = 0; j < p_module->p_config[i].i_list; j++ )
364                       LOAD_STRING( p_module->p_config[i].ppsz_list_text[j] );
365                   p_module->p_config[i].ppsz_list_text[j] = NULL;
366                 }
367             }
368             if( p_module->p_config[i].pi_list )
369             {
370                 p_module->p_config[i].pi_list =
371                     xmalloc( (p_module->p_config[i].i_list + 1) * sizeof(int) );
372                 if( p_module->p_config[i].pi_list )
373                 {
374                     for (int j = 0; j < p_module->p_config[i].i_list; j++)
375                         LOAD_IMMEDIATE( p_module->p_config[i].pi_list[j] );
376                 }
377             }
378         }
379
380         if( p_module->p_config[i].i_action )
381         {
382             p_module->p_config[i].ppf_action =
383                 xmalloc( p_module->p_config[i].i_action * sizeof(void *) );
384             p_module->p_config[i].ppsz_action_text =
385                 xmalloc( p_module->p_config[i].i_action * sizeof(char *) );
386
387             for (int j = 0; j < p_module->p_config[i].i_action; j++)
388             {
389                 p_module->p_config[i].ppf_action[j] = NULL;
390                 LOAD_STRING( p_module->p_config[i].ppsz_action_text[j] );
391             }
392         }
393     }
394
395     return VLC_SUCCESS;
396
397  error:
398
399     return VLC_EGENERIC;
400 }
401
402 static int CacheSaveBank( FILE *file, module_cache_t *const *, size_t );
403
404 /**
405  * Saves a module cache to disk, and release cache data from memory.
406  */
407 void CacheSave (vlc_object_t *p_this, const char *dir,
408                module_cache_t **entries, size_t n)
409 {
410     char *filename = NULL, *tmpname = NULL;
411
412     if (asprintf (&filename, "%s"DIR_SEP CACHE_NAME, dir ) == -1)
413         goto out;
414
415     if (asprintf (&tmpname, "%s.%"PRIu32, filename, (uint32_t)getpid ()) == -1)
416         goto out;
417     msg_Dbg (p_this, "saving plugins cache %s", filename);
418
419     FILE *file = vlc_fopen (tmpname, "wb");
420     if (file == NULL)
421     {
422         if (errno != EACCES && errno != ENOENT)
423             msg_Warn (p_this, "cannot create %s (%m)", tmpname);
424         goto out;
425     }
426
427     if (CacheSaveBank (file, entries, n))
428     {
429         msg_Warn (p_this, "cannot write %s (%m)", tmpname);
430         clearerr (file);
431         fclose (file);
432         vlc_unlink (tmpname);
433         goto out;
434     }
435
436 #if !defined( WIN32 ) && !defined( __OS2__ )
437     vlc_rename (tmpname, filename); /* atomically replace old cache */
438     fclose (file);
439 #else
440     vlc_unlink (filename);
441     fclose (file);
442     vlc_rename (tmpname, filename);
443 #endif
444 out:
445     free (filename);
446     free (tmpname);
447
448     for (size_t i = 0; i < n; i++)
449     {
450         free (entries[i]->path);
451         free (entries[i]);
452     }
453     free (entries);
454 }
455
456 static int CacheSaveConfig (FILE *, const module_t *);
457 static int CacheSaveSubmodule (FILE *, const module_t *);
458
459 static int CacheSaveBank (FILE *file, module_cache_t *const *pp_cache,
460                           size_t i_cache)
461 {
462     uint32_t i_file_size = 0;
463
464     /* Contains version number */
465     if (fputs (CACHE_STRING, file) == EOF)
466         goto error;
467 #ifdef DISTRO_VERSION
468     /* Allow binary maintaner to pass a string to detect new binary version*/
469     if (fputs( DISTRO_VERSION, file ) == EOF)
470         goto error;
471 #endif
472     /* Sub-version number (to avoid breakage in the dev version when cache
473      * structure changes) */
474     i_file_size = CACHE_SUBVERSION_NUM;
475     if (fwrite (&i_file_size, sizeof (i_file_size), 1, file) != 1 )
476         goto error;
477
478     /* Header marker */
479     i_file_size = ftell( file );
480     if (fwrite (&i_file_size, sizeof (i_file_size), 1, file) != 1)
481         goto error;
482
483     if (fwrite( &i_cache, sizeof (i_cache), 1, file) != 1)
484         goto error;
485
486 #define SAVE_IMMEDIATE( a ) \
487     if (fwrite (&a, sizeof(a), 1, file) != 1) \
488         goto error
489 #define SAVE_STRING( a ) \
490     { \
491         uint16_t i_size = (a != NULL) ? (strlen (a) + 1) : 0; \
492         if ((fwrite (&i_size, sizeof (i_size), 1, file) != 1) \
493          || (a && (fwrite (a, 1, i_size, file) != i_size))) \
494             goto error; \
495     } while(0)
496
497     for (unsigned i = 0; i < i_cache; i++)
498     {
499         uint32_t i_submodule;
500
501         /* Save additional infos */
502         SAVE_STRING( pp_cache[i]->p_module->psz_object_name );
503         SAVE_STRING( pp_cache[i]->p_module->psz_shortname );
504         SAVE_STRING( pp_cache[i]->p_module->psz_longname );
505         SAVE_STRING( pp_cache[i]->p_module->psz_help );
506         SAVE_IMMEDIATE( pp_cache[i]->p_module->i_shortcuts );
507         for (unsigned j = 0; j < pp_cache[i]->p_module->i_shortcuts; j++)
508             SAVE_STRING( pp_cache[i]->p_module->pp_shortcuts[j] );
509
510         SAVE_STRING( pp_cache[i]->p_module->psz_capability );
511         SAVE_IMMEDIATE( pp_cache[i]->p_module->i_score );
512         SAVE_IMMEDIATE( pp_cache[i]->p_module->b_unloadable );
513
514         /* Config stuff */
515         if (CacheSaveConfig (file, pp_cache[i]->p_module))
516             goto error;
517
518         SAVE_STRING( pp_cache[i]->p_module->psz_filename );
519         SAVE_STRING( pp_cache[i]->p_module->domain );
520
521         i_submodule = pp_cache[i]->p_module->submodule_count;
522         SAVE_IMMEDIATE( i_submodule );
523         if( CacheSaveSubmodule( file, pp_cache[i]->p_module->submodule ) )
524             goto error;
525
526         /* Save common info */
527         SAVE_STRING(pp_cache[i]->path);
528         SAVE_IMMEDIATE(pp_cache[i]->mtime);
529         SAVE_IMMEDIATE(pp_cache[i]->size);
530     }
531
532     if (fflush (file)) /* flush libc buffers */
533         goto error;
534     return 0; /* success! */
535
536 error:
537     return -1;
538 }
539
540 static int CacheSaveSubmodule( FILE *file, const module_t *p_module )
541 {
542     if( !p_module )
543         return 0;
544     if( CacheSaveSubmodule( file, p_module->next ) )
545         goto error;
546
547     SAVE_STRING( p_module->psz_object_name );
548     SAVE_STRING( p_module->psz_shortname );
549     SAVE_STRING( p_module->psz_longname );
550     SAVE_STRING( p_module->psz_help );
551     SAVE_IMMEDIATE( p_module->i_shortcuts );
552     for( unsigned j = 0; j < p_module->i_shortcuts; j++ )
553          SAVE_STRING( p_module->pp_shortcuts[j] );
554
555     SAVE_STRING( p_module->psz_capability );
556     SAVE_IMMEDIATE( p_module->i_score );
557     SAVE_IMMEDIATE( p_module->b_unloadable );
558     SAVE_STRING( p_module->domain );
559     return 0;
560
561 error:
562     return -1;
563 }
564
565
566 static int CacheSaveConfig (FILE *file, const module_t *p_module)
567 {
568     uint32_t i_lines = p_module->confsize;
569
570     SAVE_IMMEDIATE( p_module->i_config_items );
571     SAVE_IMMEDIATE( p_module->i_bool_items );
572     SAVE_IMMEDIATE( i_lines );
573
574     for (size_t i = 0; i < i_lines ; i++)
575     {
576         SAVE_IMMEDIATE( p_module->p_config[i] );
577
578         SAVE_STRING( p_module->p_config[i].psz_type );
579         SAVE_STRING( p_module->p_config[i].psz_name );
580         SAVE_STRING( p_module->p_config[i].psz_text );
581         SAVE_STRING( p_module->p_config[i].psz_longtext );
582         SAVE_STRING( p_module->p_config[i].psz_oldname );
583
584         if (IsConfigStringType (p_module->p_config[i].i_type))
585             SAVE_STRING( p_module->p_config[i].orig.psz );
586
587         if( p_module->p_config[i].i_list )
588         {
589             if( p_module->p_config[i].ppsz_list )
590             {
591                 for (int j = 0; j < p_module->p_config[i].i_list; j++)
592                     SAVE_STRING( p_module->p_config[i].ppsz_list[j] );
593             }
594
595             if( p_module->p_config[i].ppsz_list_text )
596             {
597                 for (int j = 0; j < p_module->p_config[i].i_list; j++)
598                     SAVE_STRING( p_module->p_config[i].ppsz_list_text[j] );
599             }
600             if( p_module->p_config[i].pi_list )
601             {
602                 for (int j = 0; j < p_module->p_config[i].i_list; j++)
603                     SAVE_IMMEDIATE( p_module->p_config[i].pi_list[j] );
604             }
605         }
606
607         for (int j = 0; j < p_module->p_config[i].i_action; j++)
608             SAVE_STRING( p_module->p_config[i].ppsz_action_text[j] );
609     }
610     return 0;
611
612 error:
613     return -1;
614 }
615
616 /*****************************************************************************
617  * CacheMerge: Merge a cache module descriptor with a full module descriptor.
618  *****************************************************************************/
619 void CacheMerge( vlc_object_t *p_this, module_t *p_cache, module_t *p_module )
620 {
621     (void)p_this;
622
623     p_cache->pf_activate = p_module->pf_activate;
624     p_cache->pf_deactivate = p_module->pf_deactivate;
625     p_cache->handle = p_module->handle;
626
627     /* FIXME: This looks too simplistic an algorithm to me. What if the module
628      * file was altered such that the number of order of submodules was
629      * altered... after VLC started -- Courmisch, 09/2008 */
630     module_t *p_child = p_module->submodule,
631              *p_cchild = p_cache->submodule;
632     while( p_child && p_cchild )
633     {
634         p_cchild->pf_activate = p_child->pf_activate;
635         p_cchild->pf_deactivate = p_child->pf_deactivate;
636         p_child = p_child->next;
637         p_cchild = p_cchild->next;
638     }
639
640     p_cache->b_loaded = true;
641     p_module->b_loaded = false;
642 }
643
644 /**
645  * Looks up a plugin file in a table of cached plugins.
646  */
647 module_t *CacheFind (module_cache_t *const *entries, size_t count,
648                      const char *path, const struct stat *st)
649 {
650     while (count > 0)
651     {
652         module_cache_t *entry = *(entries++);
653
654         if (!strcmp (entry->path, path)
655          && entry->mtime == st->st_mtime
656          && entry->size == st->st_size)
657        {
658             module_t *module = entry->p_module;
659             entry->p_module = NULL; /* Return NULL next time */
660             return module;
661        }
662        count--;
663     }
664
665     return NULL;
666 }
667
668 /** Adds entry to the cache */
669 int CacheAdd (module_cache_t ***cache, size_t *count,
670               const char *path, const struct stat *st, module_t *module)
671 {
672     module_cache_t **entries;
673
674     entries = realloc (*cache, (*count + 1) * sizeof (*entries));
675     if (unlikely(entries == NULL))
676         return -1;
677     *cache = entries;
678
679     entries[*count] = malloc (sizeof (**entries));
680     if (unlikely(entries[*count] == NULL))
681         return -1;
682     /* NOTE: strdup() could be avoided, but it would be a bit ugly */
683     entries[*count]->path = strdup (path);
684     entries[*count]->mtime = st->st_mtime;
685     entries[*count]->size = st->st_size;
686     entries[*count]->p_module = module;
687     (*count)++;
688     return 0;
689 }
690
691 #endif /* HAVE_DYNAMIC_PLUGINS */