From 5b14ccee8539f346cec001b1dcdb7f061965d3af Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Tue, 18 Jun 2002 10:12:17 +0000 Subject: update as far as i've double checked things thus far -Erik --- docs/threads.txt | 540 +++++++++++++++++++++++-------------------------------- 1 file changed, 226 insertions(+), 314 deletions(-) (limited to 'docs/threads.txt') diff --git a/docs/threads.txt b/docs/threads.txt index 2d5d9e623..d31a56d58 100644 --- a/docs/threads.txt +++ b/docs/threads.txt @@ -33,9 +33,9 @@ http://www.vitanuova.com/inferno/index.html None of these functions are currently implemented in the uClibc library, so they must be added. - flockfile <--- - ftrylockfile <--- - funlockfile <--- + flockfile + ftrylockfile + funlockfile 1.2 Functions that must use buffer access mutexes, according to Butenhof @@ -43,10 +43,10 @@ http://www.vitanuova.com/inferno/index.html buffer access mutexes. This does not represent all functions that need to use the mutexes. - getc <--- - getchar <--- - putc <--- - putchar <--- + getc + getchar + putc + putchar 1.3 Functions from glibc (libio) that use buffer access mutexes @@ -57,21 +57,21 @@ http://www.vitanuova.com/inferno/index.html The rest may require the access mutex. (These must be analyzed on a case-by-case basis.) - clearerr <--- - feof <--- - ferror <--- - fputc <--- + clearerr + feof + ferror + fputc fputwc - freopen <--- - freopen64 - fseek <--- - fseeko - fseeko64 - ftello - ftello64 + freopen + freopen64 + fseek + fseeko + fseeko64 + ftello + ftello64 fwide - getc - getchar + getc + getchar getwc getwchar iofclose @@ -102,49 +102,50 @@ http://www.vitanuova.com/inferno/index.html oldiofsetpos oldiofsetpos64 peekc - putc - putchar + putc + putchar putwc putwchar - rewind <--- + rewind 1.4 Functions from Proventhreads that use buffer access mutexes See description above. This applies only to the C library included in the proventhreads distribution. - clearerr <--- - fclose <--- - fflush <--- - fgetc <--- + clearerr + fclose + fflush + fgetc __getc fgetline - fgetpos <--- - fgets <--- + fgetpos + fgetpos64 + fgets fpurge - fputc <--- + fputc __putc - fputs <--- - fread <--- - freopen <--- - fscanf <--- - fseek <--- - ftell <--- + fputs + fread + freopen + fscanf + fseek + ftell fwalk - fwrite <--- - getc - getchar <--- - putc - putchar <--- - puts <--- - putw + fwrite + getc + getchar + putc + putchar + puts + putw refill - rewind <--- - scanf <--- - setvbuf <--- - ungetc <--- - vfprintf <--- - vscanf <--- + rewind + scanf + setvbuf + ungetc + vfprintf + vscanf 1.5 Unlocked buffer access @@ -155,10 +156,10 @@ http://www.vitanuova.com/inferno/index.html then use getc_unlocked within the loop for speed. That way, the lock only needs to be grabbed and released once, rather than for each call. - getc_unlocked <--- - getchar_unlocked <--- - putc_unlocked <--- - putchar_unlocked <--- + getc_unlocked <--- - clearerr_unlocked <--- - feof_unlocked <--- - ferror_unlocked <--- - fputc_unlocked <--- - fgetc_unlocked <--- - fflush_unlocked <--- - fread_unlocked <--- - fwrite_unlocked <--- - fgets_unlocked <--- - fputs_unlocked <--- + fileno_unlocked - ctermid (1) - ttyname_r <--- + ctermid + ttyname_r - 1. ctermid is a special case. The signature has not changed, but a - requirement has been added that its parameter point to a structure - of exactly L_ctermid bytes. 2.2 Directory searching - readdir_r <--- + readdir_r 2.3 String token @@ -227,7 +225,7 @@ http://www.vitanuova.com/inferno/index.html 2.5 Random number generation - rand_r <--- + rand_r fgetpwent_r - __ttyname_r getttyname_r - __getmntent_r - getmntent_r <--- + getmntent_r ecvt_r fcvt_r qecvt_r @@ -257,83 +252,86 @@ http://www.vitanuova.com/inferno/index.html hcreate_r hdestroy_r hsearch_r + getspent_r + getspnam_r + sgetspent_r + fgetspent_r + gethostbyaddr_r + gethostbyname2_r + gethostbyname_r + gethostent_r <--- + getnetbyaddr_r <--- + getnetent_r <--- + getnetbyname_r <--- + getprotobynumber_r <--- + getprotoent_r <--- + getprotobyname_r <--- + getservbyname_r + getservbyport_r + getservent_r + getrpcent_r <--- + getrpcbyname_r <--- + getrpcbynumber_r + ether_aton_r + ether_ntoa_r + getnetgrent_r + getaliasent_r + getaliasbyname_r + nscd_getpw_r + nscd_getgr_r + nscd_gethst_r + getutent_r <--- + getutent_r_unknown + getutid_r_unknown + getutline_r_unknown + getutid_r <--- + getutline_r <--- + getutent_r_file + getutid_r_file + getutline_r_file + internal_getut_r + getutent_r_daemon + getutid_r_daemon + getutline_r_daemon + ptsname_r + __fgetpwent_r + __ttyname_r + __getmntent_r __getspent_r - getspent_r __getspnam_r - getspnam_r __sgetspent_r - sgetspent_r __fgetspent_r - fgetspent_r __gethostbyaddr_r - gethostbyaddr_r <--- __gethostbyname2_r - gethostbyname2_r __gethostbyname_r - gethostbyname_r <--- __gethostent_r __getnetbyaddr_r - getnetbyaddr_r <--- __getnetent_r - getnetent_r <--- __getnetbyname_r - getnetbyname_r <--- __getprotobynumber_r - getprotobynumber_r <--- __getprotoent_r - getprotoent_r <--- __getprotobyname_r - getprotobyname_r <--- __getservbyname_r - getservbyname_r <--- __getservbyport_r - getservbyport_r <--- - __getservent_r - getservent_r <--- __getrpcent_r - getrpcent_r <--- + __getservent_r __getrpcbyname_r - getrpcbyname_r <--- __getrpcbynumber_r - getrpcbynumber_r <--- - ether_aton_r - ether_ntoa_r __getnetgrent_r __internal_getnetgrent_r - getnetgrent_r __getaliasent_r - getaliasent_r __getaliasbyname_r - getaliasbyname_r __nscd_getpwnam_r __nscd_getpwuid_r - nscd_getpw_r __nscd_getgrgid_r __nscd_getgrnam_r - nscd_getgr_r __nscd_gethostbyaddr_r __nscd_gethostbyname2_r __nscd_gethostbyname_r - nscd_gethst_r - __getutent_r <--- - getutent_r <--- - getutent_r_unknown - getutid_r_unknown - getutline_r_unknown + __getutent_r __getutid_r - getutid_r <--- __getutline_r - getutline_r <--- - getutent_r_file - getutid_r_file - getutline_r_file - internal_getut_r - getutent_r_daemon - getutid_r_daemon - getutline_r_daemon __ptsname_r - ptsname_r 2.8 Additional thread-safe functions implemented by Proventhreads @@ -341,9 +339,9 @@ http://www.vitanuova.com/inferno/index.html See description above. This applies only to the C library included in the proventhreads distribution. - inet_ntoa_r <--- - gethostbyaddr_r <--- - gethostbyname_r <--- + inet_ntoa_r + gethostbyaddr_r + gethostbyname_r gethostent_r getnetbyaddr_r <--- getnetbyname_r <--- @@ -351,9 +349,9 @@ http://www.vitanuova.com/inferno/index.html getprotobynumber_r <--- getprotoent_r <--- getprotobyname_r <--- - getservbyname_r <--- - getservbyport_r <--- - getservent_r <--- + getservbyname_r + getservbyport_r + getservent_r 3. List of functions in uClibc that use static data structures @@ -375,11 +373,38 @@ http://www.vitanuova.com/inferno/index.html -------------------------------------------------------------------- + crypt/des.c: + + static u_char inv_key_perm[64]; + static u_char inv_comp_perm[56]; + static u_char u_sbox[8][64]; + static u_char u_key_perm[56]; + static u_char un_pbox[32]; + static u_int32_t en_keysl[16], en_keysr[16]; + static u_int32_t de_keysl[16], de_keysr[16]; + static u_int32_t ip_maskl[8][256], ip_maskr[8][256]; + static u_int32_t fp_maskl[8][256], fp_maskr[8][256]; + static u_int32_t key_perm_maskl[8][128], key_perm_maskr[8][128]; + static u_int32_t comp_maskl[8][128], comp_maskr[8][128]; + static u_int32_t saltbits; + + __des_crypt_r <--- + + This needs to be fixed to actually be reentrant. Right now it + just fakes it, which is pretty lame.... All the above should be + moved into a 'struct des_context' or some such... + + -------------------------------------------------------------------- + crypt/md5.c: - static unsigned char PADDING[64] <--- + static const char __md5__magic[]; + static const unsigned char __md5_itoa64[]; - NOTE: This is okay, but should use the const keyword. + __md5_crypt_r + + No problems here... + -------------------------------------------------------------------- @@ -387,7 +412,8 @@ http://www.vitanuova.com/inferno/index.html static char buf[16]; - inet_ntoa <--- + inet_ntoa + inet_ntoa_r -------------------------------------------------------------------- @@ -398,12 +424,12 @@ http://www.vitanuova.com/inferno/index.html static struct netent net; static char *net_aliases[MAXALIASES]; - setnetent <--- - endnetent <--- - getnetent <--- + setnetent + endnetent + getnetent + getnetent_r NOTE: setnetent and endnetent are not implemented in glibc. - Proventhreads uses pthread mutexes to protect this static data. -------------------------------------------------------------------- @@ -415,14 +441,16 @@ http://www.vitanuova.com/inferno/index.html static char *proto_aliases[MAXALIASES]; static int proto_stayopen; - setprotoent <--- - endprotoent <--- - getprotoent <--- - getprotobyname <--- - getprotobynumber <--- + setprotoent + endprotoent + getprotoent + getprotoent_r + getprotobyname + getprotobyname_r + getprotobynumber + getprotobynumber_r NOTE: setprotoent and endprotoent are not implemented in glibc. - Proventhreads uses pthread mutexes to protect this static data. -------------------------------------------------------------------- @@ -434,48 +462,44 @@ http://www.vitanuova.com/inferno/index.html static char *serv_aliases[MAXALIASES]; static int serv_stayopen; - setservent <--- - endservent <--- - getservent <--- - getservbyname <--- - getservbyport <--- + setservent + endservent + getservent + getservent_r + getservbyname + getservbyname_r + getservbyport + getservbyport_r NOTE: setservent and endservent are not implemented in glibc. - Proventhreads uses pthread mutexes to protect this static data. -------------------------------------------------------------------- - net/resolv.c: + static struct hostent h; + static char buf[xxx]; - static int id = 1; - static int ns = 0; + gethostbyname - dns_lookup <--- - NOTE: dns_lookup is not implemented by glibc or Proventhreads. + static struct hostent h; + static char buf[xxx]; - static struct hostent h; - static char namebuf[256]; - static struct in_addr in; - static struct in_addr *addr_list[2]; + gethostbyname2 - gethostbyname <--- + static struct hostent h; + static char buf[xxx]; - static struct hostent h; - static char namebuf[256]; - static struct in_addr in; - static struct in_addr *addr_list[2]; + gethostbyaddr - gethostbyaddr <--- - static struct hostent h; - static struct in_addr in; - static struct in_addr *addr_list[2]; - static char line[80]; + static int __stay_open; + static FILE * __gethostent_fp; + static struct hostent h; + static char buf[xxx]; - read_etc_hosts <--- - - NOTE: dns_lookup is not implemented by glibc or Proventhreads. + gethostent + sethostent + endhostent -------------------------------------------------------------------- @@ -912,7 +936,10 @@ http://www.vitanuova.com/inferno/index.html static uint64_t value; - __gen_tempname <--- + __gen_tempname + + This is supposed to be random trash, so the more threading + collisions the better... -------------------------------------------------------------------- @@ -952,7 +979,8 @@ http://www.vitanuova.com/inferno/index.html static char buff[MNTMAXSTR]; static struct mntent mnt; - getmntent <--- + getmntent + getmntent_r -------------------------------------------------------------------- @@ -1086,19 +1114,20 @@ http://www.vitanuova.com/inferno/index.html misc/utmp/utent.c: - static int ut_fd = -1; + static int static_fd = -1; + static struct utmp static_utmp; + static const char default_file_name[] = _PATH_UTMP; + static const char *static_ut_name = (const char *) default_file_name; - setutent <--- - endutent <--- - getutent <--- - getutid <--- - getutline <--- - pututline <--- - utmpname <--- - - static struct utmp utmp; - __getutent <--- + setutent + endutent + getutent + getutid + getutline + pututline + utmpname + __getutent -------------------------------------------------------------------- @@ -1191,16 +1220,21 @@ http://www.vitanuova.com/inferno/index.html static int _bsearch; - bsearch <--- + bsearch -------------------------------------------------------------------- - stdlib/putenv.c: + stdlib/setenv.c: - static char **mall_env = 0; - static int extras = 0; + static char **last_environ; - putenv <--- + __add_to_environ + unsetenv + setenv + clearenv + putenv + + all ok now. -------------------------------------------------------------------- @@ -1219,17 +1253,6 @@ http://www.vitanuova.com/inferno/index.html -------------------------------------------------------------------- - stdlib/setenv.c: - - static pthread_once__t _once_block = pthread_once_init; (1) - static pthread_mutex_t _setenv_mutex; (1) - static char **last_environ = NULL; (1) - - 1: Obviously, nothing to do here. (Unless I change the way we - deal with threads). - - -------------------------------------------------------------------- - stdlib/malloc/avlmacro.h static objname *__Avl_##objname##pr##_new_node; @@ -1252,30 +1275,12 @@ http://www.vitanuova.com/inferno/index.html stdlib/malloc-930716/malloc.c: - static int heapsize; - static int initialized; - static size_t pagesize; + A bunch of stuff - inititalize <--- - morecore <--- - malloc <--- - - -------------------------------------------------------------------- - - stdlib/malloc-930716/valloc.c: - - static size_t pagesize; - - valloc <--- - - -------------------------------------------------------------------- - - string/config.c: - - static char *args[16]; - static char cfgbuf[128]; - - cfgread <--- + malloc + realloc + free + etc -------------------------------------------------------------------- @@ -1285,7 +1290,7 @@ http://www.vitanuova.com/inferno/index.html static char retbuf[33]; strerror <--- - main <--- + strerror_r <--- -------------------------------------------------------------------- @@ -1302,87 +1307,8 @@ http://www.vitanuova.com/inferno/index.html static char *save = 0; - strtok <--- - - -------------------------------------------------------------------- - - sysdeps/linux/common/kernel_version.c: - - static int __linux_kernel_version = -1; - - __get_linux_kernel_version (1) - - 1: This static value never actually gets updated! This a bug. - - -------------------------------------------------------------------- - - sysdeps/linux/i386/bits/huge_val.h: - - static __huge_val_t __huge_val <--- - static __huge_valf_t __huge_valf <--- - static __huge_vall_t __huge_vall <--- - - NOTE: These are okay, but should use the const keyword. - - -------------------------------------------------------------------- - - sysdeps/linux/i386/bits/nan.h: - - static union { ... } __nan_union <--- - - NOTE: This is okay, but should use the const keyword. - - -------------------------------------------------------------------- - - sysdeps/linux/m68k/bits/huge_val.h: - - static union { ... } __huge_val <--- - static union { ... } __huge_valf <--- - static union { ... } __huge_vall <--- - - NOTE: These are okay, but should use the const keyword. - - -------------------------------------------------------------------- - - sysdeps/linux/m68k/bits/nan.h: - - static union { ... } __nan_union <--- - - NOTE: This is okay, but should use the const keyword. - - -------------------------------------------------------------------- - - sysdeps/linux/sh/bits/huge_val.h: - - static __huge_val_t __huge_val <--- - static __huge_valf_t __huge_valf <--- - - NOTE: These are okay, but should use the const keyword. - - -------------------------------------------------------------------- - - sysdeps/linux/sh/bits/nan.h: - - static union { ... } __nan_union <--- - - NOTE: This is okay, but should use the const keyword. - - -------------------------------------------------------------------- - - sysdeps/linux/sparc/bits/huge_val.h: - - static __huge_val_t __huge_val <--- - static __huge_valf_t __huge_valf <--- - - NOTE: These are okay, but should use the const keyword. - - -------------------------------------------------------------------- - - sysdeps/linux/sparc/bits/nan.h: - - static union { ... } __nan_union <--- - - NOTE: This is okay, but should use the const keyword. + strtok + strtok_r -------------------------------------------------------------------- @@ -1418,20 +1344,6 @@ http://www.vitanuova.com/inferno/index.html -------------------------------------------------------------------- - unistd/getcwd.c: - - static char *path_buf; - static int path_size; - static dev_t root_dev; - static ino_t root_ino; - static struct stat st; - - getswd <--- - recurser <--- - search_dir <--- - - -------------------------------------------------------------------- - unistd/getopt.c: static int sp = 1; -- cgit v1.2.3