Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] plugins reentrance?



Please check if the plugins contains calls to the functions

alctime
ctime
getgrgid
getgrnam
getpwnam
getpwuid
gmtime
localtime
rand
readdir
strtok

replace them with "_r" counter parts.
Don't rely on any prerequistes that might prohibit
recursive calls in YOUR thread.
You are not alone on the CPU but there is only one clib ;-)
and there is not way to determine an expected sequence.




char *strtok_r( char *s, const char *sep,  char **lasts ); 
char *asctime_r( const struct tm *tm, char *buf ); 
char *ctime_r( const time_t *clock, char *buf ); 
struct tm *gmtime_r( const time_t *clock, struct tm *result ); 
struct tm *localtime_r( const time_t *clock, struct tm *result ); 
int rand_r( unsigned int *seed );


@Klaus
Maybe this should be added to plugins.html?

To avoid such error in problem it may be usefull 
to include init vdr.h or so :

#define alctime "please use alctime_r"
#define ctime "please use ctime_r"
#define getgrgid "please use getgrgid_r"
#define getgrnam "please use getgrnam_r"
#define getpwnam "please use getpwnam_r"
#define getpwuid "please use getpwuid_r"
#define gmtime "please use gmtime_r"
#define localtime "please use localtime_r"
#define rand "please use rand_r"
#define readdir "please use readdir_r"
#define strtok "please use strtok_r"


That must give a syntax errorso it's impossible
to use that functions witout an "undef".

Maybe a "#pragma error" i possible too.







Home | Main Index | Thread Index