threads.txt 75 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187
  1. uClibc thread-safety analysis
  2. By Steve Thayer <sthayer@coactive.com>
  3. with updates by Erik Andersen <andersee@debian.org>
  4. Introduction:
  5. The purpose of this document is to identify the things that need to be done
  6. to the uClibc C library in order to make it thread-safe. The goal is to be
  7. able to use a pthreads thread implementation under uClinux, using the uClibc
  8. C library. To help identify the things that require changing, I used David R.
  9. Butenhof's book Programming With POSIX Threads, the source code for the
  10. glibc 2.1.3 C library, and the source code for the C library included in the
  11. Proventhreads distribution.
  12. References:
  13. Butenhof, David R., Programming With POSIX Threads, Addison Wesley Longman, Inc., Reading, MA, ISBN 0-201-63392-2, 1997.
  14. The GNU C library is available from the Free Software Foundation
  15. http://www.gnu.org/software/libc/libc.html
  16. Proventhreads is part of the Inferno Operating system.
  17. http://www.vitanuova.com/inferno/index.html
  18. 1. Stdio:
  19. 1.1 Buffer access mutexes
  20. The following functions are required in order to protect shared
  21. I/O buffers from being accessed by more than one thread at a time.
  22. None of these functions are currently implemented in the uClibc
  23. library, so they must be added.
  24. flockfile <implemented>
  25. ftrylockfile <implemented>
  26. funlockfile <implemented>
  27. 1.2 Functions that must use buffer access mutexes, according to Butenhof
  28. The following functions are identified by Butenhof as needing to use
  29. buffer access mutexes. This does not represent all functions that
  30. need to use the mutexes.
  31. getc <mutex required>
  32. getchar <mutex required>
  33. putc <mutex required>
  34. putchar <mutex required>
  35. 1.3 Functions from glibc (libio) that use buffer access mutexes
  36. The following functions are functions found in glibc that currently
  37. use the buffer access mutexes. Comments in brackets represent
  38. status of uClibc with regard to these functions. Most of these
  39. functions aren't even supported under uClibc, so no work is required.
  40. The rest may require the access mutex. (These must be analyzed on a
  41. case-by-case basis.)
  42. clearerr <mutex required>
  43. feof <mutex required>
  44. ferror <mutex required>
  45. fputc <mutex required>
  46. fputwc <not supported>
  47. freopen <mutex required>
  48. freopen64 <mutex required>
  49. fseek <mutex required>
  50. fseeko <mutex required>
  51. fseeko64 <mutex required>
  52. ftello <mutex required>
  53. ftello64 <mutex required>
  54. fwide <not supported>
  55. getc <mutex required>
  56. getchar <mutex required>
  57. getwc <not supported>
  58. getwchar <not supported>
  59. iofclose <not supported>
  60. iofflush <not supported>
  61. iofgetpos <not supported>
  62. iofgetpos64 <not supported>
  63. iofgets <not supported>
  64. iofgetws <not supported>
  65. iofputs <not supported>
  66. iofputws <not supported>
  67. iofread <not supported>
  68. iofsetpos <not supported>
  69. iofsetpos64 <not supported>
  70. ioftell <not supported>
  71. iofwrite <not supported>
  72. iogetdelim <not supported>
  73. iogets <not supported>
  74. ioputs <not supported>
  75. ioseekoff <not supported>
  76. ioseekpos <not supported>
  77. iosetbuffer <not supported>
  78. iosetvbuf <not supported>
  79. ioungetc <not supported>
  80. ioungetwc <not supported>
  81. oldiofclose <not supported>
  82. oldiofgetpos <not supported>
  83. oldiofgetpos64 <not supported>
  84. oldiofsetpos <not supported>
  85. oldiofsetpos64 <not supported>
  86. peekc <not supported>
  87. putc <mutex required>
  88. putchar <mutex required>
  89. putwc <not supported>
  90. putwchar <not supported>
  91. rewind <mutex required>
  92. 1.4 Functions from Proventhreads that use buffer access mutexes
  93. See description above. This applies only to the C library included
  94. in the proventhreads distribution.
  95. clearerr <mutex required>
  96. fclose <mutex required>
  97. fflush <mutex required>
  98. fgetc <mutex required>
  99. __getc <not supported>
  100. fgetline <not supported>
  101. fgetpos <mutex required>
  102. fgetpos64 <mutex required>
  103. fgets <mutex required>
  104. fpurge <not supported>
  105. fputc <mutex required>
  106. __putc <not supported>
  107. fputs <mutex required>
  108. fread <mutex required>
  109. freopen <mutex required>
  110. fscanf <mutex required>
  111. fseek <mutex required>
  112. ftell <mutex required>
  113. fwalk <not supported>
  114. fwrite <mutex required>
  115. getc <mutex required>
  116. getchar <mutex required>
  117. putc <mutex required>
  118. putchar <mutex required>
  119. puts <mutex required>
  120. putw <mutex _not_ required>
  121. refill <not supported>
  122. rewind <mutex required>
  123. scanf <mutex required>
  124. setvbuf <mutex required>
  125. ungetc <mutex required>
  126. vfprintf <mutex required>
  127. vscanf <mutex required>
  128. 1.5 Unlocked buffer access
  129. These functions get used in situations where speed is important,
  130. and locking isn't necessary, or for use in a section of code that
  131. is already locked. For example, a for-loop that makes multiple calls
  132. to getc could make an exlicit call to flockfile outside the loop, and
  133. then use getc_unlocked within the loop for speed. That way, the lock
  134. only needs to be grabbed and released once, rather than for each call.
  135. getc_unlocked <implemented
  136. getchar_unlocked <implemented
  137. putc_unlocked <implemented
  138. putchar_unlocked <implemented
  139. 1.6 Additional unlocked calls made in glibc
  140. These are additional functions (not mentioned by Butenhof) that the
  141. glibc library uses for unlocked buffer access. Though not strictly
  142. necessary, these may be nice to have in uClibc.
  143. fileno_unlocked <implemented
  144. clearerr_unlocked <implemented
  145. feof_unlocked <implemented
  146. ferror_unlocked <implemented
  147. fputc_unlocked <implemented
  148. fgetc_unlocked <implemented
  149. fflush_unlocked <implemented
  150. fread_unlocked <implemented
  151. fwrite_unlocked <implemented
  152. fgets_unlocked <implemented
  153. fputs_unlocked <implemented
  154. 1.7 Additional unlocked calls made in Proventhreads
  155. Proventhreads only provides the four unlocked function calls above.
  156. <none>
  157. 2. Thread-safe functions:
  158. There are some functions in the C library standard that are
  159. simply not thread-safe and cannot be thread-safe using their
  160. current interface. For example, any function that returns a
  161. pointer to static data, or requires static context between
  162. calls. To resolve this problem, new functions were added to
  163. the standard that perform the same basic task, but use a new
  164. interface that does not require static data. These functions
  165. share their name with the old unsafe functions, but have an
  166. "_r" appended to the name. By definition, these functions are
  167. reentrant and thread-safe. It is important to note that these
  168. functions to do not depend on <pthread.h> and can be used even
  169. if threading is not supported.
  170. 2.1 User and terminal identification:
  171. getlogin_r <implemented>
  172. ctermid <implemented>
  173. ttyname_r <implemented>
  174. 2.2 Directory searching
  175. readdir_r <implemented>
  176. 2.3 String token
  177. strtok_r <implemented>
  178. 2.4 Time representation
  179. asctime_r <implemented>
  180. ctime_r <implemented>
  181. gmtime_r <implemented>
  182. localtime_r <implemented>
  183. 2.5 Random number generation
  184. rand_r <implemented
  185. 2.6 Group and user database
  186. getgrgid_r <required> <---
  187. getgrnam_r <required> <---
  188. getpwuid_r <implemented>
  189. getpwnam_r <implemented>
  190. 2.7 Additional thread-safe functions implemented by glibc
  191. The following is a list of additional functions implemented by glibc
  192. that also provide thread-safe functionality. Most of these functions
  193. are not supported by uClibc, so there is no need to implement the
  194. thread-safe version. Those that do apply, but have not been
  195. implemented yet are highlighted.
  196. fgetpwent_r <implemented>
  197. getttyname_r <not supported>
  198. getmntent_r <implemented>
  199. ecvt_r <not supported>
  200. fcvt_r <not supported>
  201. qecvt_r <not supported>
  202. qfcvt_r <not supported>
  203. hcreate_r <not supported>
  204. hdestroy_r <not supported>
  205. hsearch_r <not supported>
  206. getspent_r <implemented>
  207. getspnam_r <implemented>
  208. sgetspent_r <implemented>
  209. fgetspent_r <implemented>
  210. gethostbyaddr_r <implemented>
  211. gethostbyname2_r <implemented>
  212. gethostbyname_r <implemented>
  213. gethostent_r <desired> <---
  214. getnetbyaddr_r <desired> <---
  215. getnetent_r <desired> <---
  216. getnetbyname_r <desired> <---
  217. getprotobynumber_r <desired> <---
  218. getprotoent_r <desired> <---
  219. getprotobyname_r <desired> <---
  220. getservbyname_r <implemented>
  221. getservbyport_r <implemented>
  222. getservent_r <implemented>
  223. getrpcent_r <desired> <---
  224. getrpcbyname_r <desired> <---
  225. getrpcbynumber_r <implemented>
  226. ether_aton_r <not supported>
  227. ether_ntoa_r <not supported>
  228. getnetgrent_r <not supported>
  229. getaliasent_r <not supported>
  230. getaliasbyname_r <not supported>
  231. nscd_getpw_r <not supported>
  232. nscd_getgr_r <not supported>
  233. nscd_gethst_r <not supported>
  234. getutent_r <desired> <---
  235. getutent_r_unknown <not supported>
  236. getutid_r_unknown <not supported>
  237. getutline_r_unknown <not supported>
  238. getutid_r <desired> <---
  239. getutline_r <required> <---
  240. getutent_r_file <not supported>
  241. getutid_r_file <not supported>
  242. getutline_r_file <not supported>
  243. internal_getut_r <not supported>
  244. getutent_r_daemon <not supported>
  245. getutid_r_daemon <not supported>
  246. getutline_r_daemon <not supported>
  247. ptsname_r <not supported>
  248. __fgetpwent_r <not supported>
  249. __ttyname_r <not supported>
  250. __getmntent_r <not supported>
  251. __getspent_r <not supported>
  252. __getspnam_r <not supported>
  253. __sgetspent_r <not supported>
  254. __fgetspent_r <not supported>
  255. __gethostbyaddr_r <not supported>
  256. __gethostbyname2_r <not supported>
  257. __gethostbyname_r <not supported>
  258. __gethostent_r <not supported
  259. __getnetbyaddr_r <not supported>
  260. __getnetent_r <not supported>
  261. __getnetbyname_r <not supported>
  262. __getprotobynumber_r <not supported>
  263. __getprotoent_r <not supported>
  264. __getprotobyname_r <not supported>
  265. __getservbyname_r <not supported>
  266. __getservbyport_r <not supported>
  267. __getrpcent_r <not supported>
  268. __getservent_r <not supported>
  269. __getrpcbyname_r <not supported>
  270. __getrpcbynumber_r <not supported>
  271. __getnetgrent_r <not supported>
  272. __internal_getnetgrent_r <not supported>
  273. __getaliasent_r <not supported>
  274. __getaliasbyname_r <not supported>
  275. __nscd_getpwnam_r <not supported>
  276. __nscd_getpwuid_r <not supported>
  277. __nscd_getgrgid_r <not supported>
  278. __nscd_getgrnam_r <not supported>
  279. __nscd_gethostbyaddr_r <not supported>
  280. __nscd_gethostbyname2_r <not supported>
  281. __nscd_gethostbyname_r <not supported>
  282. __getutent_r <not supported>
  283. __getutid_r <not supported>
  284. __getutline_r <not supported>
  285. __ptsname_r <not supported>
  286. 2.8 Additional thread-safe functions implemented by Proventhreads
  287. See description above. This applies only to the C library included
  288. in the proventhreads distribution.
  289. inet_ntoa_r <implemented>
  290. gethostbyaddr_r <implemented>
  291. gethostbyname_r <implemented>
  292. gethostent_r <not supported>
  293. getnetbyaddr_r <desired> <---
  294. getnetbyname_r <desired> <---
  295. getnetent_r <desired> <---
  296. getprotobynumber_r <desired> <---
  297. getprotoent_r <desired> <---
  298. getprotobyname_r <desired> <---
  299. getservbyname_r <implemented>
  300. getservbyport_r <implemented>
  301. getservent_r <implemented>
  302. 3. List of functions in uClibc that use static data structures
  303. The following is a list of static data structures found in uClibc,
  304. and the functions that use them. In most cases, static data is not
  305. thread-safe, since multiple threads can access the same data at the
  306. same time. This is an attempt to identify all of the static data that
  307. is not considered thread-safe. Some of these problems will get
  308. resolved by the changes outlines above.
  309. crypt/crypt.c:
  310. static struct crypt_data __crypt_data;
  311. crypt <crypt_r implemented>
  312. setkey <setkey_r implemented>
  313. encrypt <encrypt_r implemented>
  314. --------------------------------------------------------------------
  315. crypt/des.c:
  316. static u_char inv_key_perm[64];
  317. static u_char inv_comp_perm[56];
  318. static u_char u_sbox[8][64];
  319. static u_char u_key_perm[56];
  320. static u_char un_pbox[32];
  321. static u_int32_t en_keysl[16], en_keysr[16];
  322. static u_int32_t de_keysl[16], de_keysr[16];
  323. static u_int32_t ip_maskl[8][256], ip_maskr[8][256];
  324. static u_int32_t fp_maskl[8][256], fp_maskr[8][256];
  325. static u_int32_t key_perm_maskl[8][128], key_perm_maskr[8][128];
  326. static u_int32_t comp_maskl[8][128], comp_maskr[8][128];
  327. static u_int32_t saltbits;
  328. __des_crypt_r <implemented badly!> <---
  329. This needs to be fixed to actually be reentrant. Right now it
  330. just fakes it, which is pretty lame.... All the above should be
  331. moved into a 'struct des_context' or some such...
  332. --------------------------------------------------------------------
  333. crypt/md5.c:
  334. static const char __md5__magic[];
  335. static const unsigned char __md5_itoa64[];
  336. __md5_crypt_r <implemented>
  337. No problems here...
  338. --------------------------------------------------------------------
  339. inet/addr.c:
  340. static char buf[16];
  341. inet_ntoa <implemented>
  342. inet_ntoa_r <implemented>
  343. --------------------------------------------------------------------
  344. inet/getnetent.c:
  345. static FILE *netf = NULL;
  346. static char line[BUFSIZ+1];
  347. static struct netent net;
  348. static char *net_aliases[MAXALIASES];
  349. setnetent <mutex required>
  350. endnetent <mutex required>
  351. getnetent <mutex required>
  352. getnetent_r <not implemented>
  353. NOTE: setnetent and endnetent are not implemented in glibc.
  354. --------------------------------------------------------------------
  355. inet/getproto.c:
  356. static FILE *protof = NULL;
  357. static char line[BUFSIZ+1];
  358. static struct protoent proto;
  359. static char *proto_aliases[MAXALIASES];
  360. static int proto_stayopen;
  361. setprotoent <mutex required>
  362. endprotoent <mutex required>
  363. getprotoent <mutex required>
  364. getprotoent_r <implemented>
  365. getprotobyname <implemented>
  366. getprotobyname_r <not implemented>
  367. getprotobynumber <implemented>
  368. getprotobynumber_r <not implemented>
  369. NOTE: setprotoent and endprotoent are not implemented in glibc.
  370. --------------------------------------------------------------------
  371. inet/getservice.c:
  372. static FILE *servf = NULL;
  373. static char line[BUFSIZ+1];
  374. static struct servent serv;
  375. static char *serv_aliases[MAXALIASES];
  376. static int serv_stayopen;
  377. setservent <mutex required>
  378. endservent <fix mutex required>
  379. getservent <mutex required>
  380. getservent_r <implemented>
  381. getservbyname <mutex required>
  382. getservbyname_r <implemented>
  383. getservbyport <mutex required>
  384. getservbyport_r <implemented>
  385. NOTE: setservent and endservent are not implemented in glibc.
  386. --------------------------------------------------------------------
  387. static struct hostent h;
  388. static char buf[xxx];
  389. gethostbyname <implemented>
  390. static struct hostent h;
  391. static char buf[xxx];
  392. gethostbyname2 <implemented>
  393. static struct hostent h;
  394. static char buf[xxx];
  395. gethostbyaddr <implemented>
  396. static int __stay_open;
  397. static FILE * __gethostent_fp;
  398. static struct hostent h;
  399. static char buf[xxx];
  400. gethostent <mutex required>
  401. sethostent <mutex required>
  402. endhostent <mutex required>
  403. --------------------------------------------------------------------
  404. inet/rpc/auth_none.c:
  405. static struct auth_ops ops
  406. static struct authnone_private
  407. authnone_create <fix required> <---
  408. authnone_marshal <fix required> <---
  409. NOTE: This file makes a lot of use of this static variable and
  410. also a global allocated authentication structure. Care should
  411. be taken in fixing this to make it thread-safe.
  412. --------------------------------------------------------------------
  413. inet/rpc/auth_unix.c:
  414. static struct auth_ops auth_unix_ops
  415. authunix_create <fix required> <---
  416. marshal_new_auth <fix required> <---
  417. NOTE: This file makes a lot of use of this static variable and
  418. also a global allocated authentication structure. Care should
  419. be taken in fixing this to make it thread-safe.
  420. --------------------------------------------------------------------
  421. inet/rpc/bindresvport.c:
  422. static short port;
  423. bindresvport <fix required> <---
  424. --------------------------------------------------------------------
  425. inet/rpc/clnt_perror.c:
  426. static char *buf;
  427. static struct rpc_errtab rpc_errlist[]
  428. static struct auth_errtab auth_errlist[]
  429. NOTE: These static structures all have #if 0 around them, so they
  430. do not get compiled in. Hopefully, we don't have to worry about
  431. them right now, but prehaps a comment should be added to the code
  432. indicating that it is not thread-safe.
  433. --------------------------------------------------------------------
  434. inet/rpc/clnt_raw.c:
  435. static struct clntraw_private
  436. static struct clnt_ops client_ops
  437. clntraw_create <fix required> <---
  438. clntraw_call <fix required> <---
  439. clntraw_freeres <fix required> <---
  440. NOTE: This file makes a lot of use of these static variables and
  441. also a global allocated client structure. Care should
  442. be taken in fixing this to make it thread-safe.
  443. --------------------------------------------------------------------
  444. inet/rpc/clnt_simple.c:
  445. static struct callrpc_private
  446. callrpc <fix required> <---
  447. --------------------------------------------------------------------
  448. inet/rpc/clnt_tcp.c:
  449. static struct clnt_ops tcp_ops
  450. clnttcp_create
  451. NOTE: This static structure is just a group of function pointers.
  452. It could probably be made const, but this might affect the function
  453. signature. This should be investigated further.
  454. --------------------------------------------------------------------
  455. inet/rpc/clnt_udp.c:
  456. static struct clnt_ops udp_ops
  457. clntudp_bufcreate
  458. NOTE: This static structure is just a group of function pointers.
  459. It could probably be made const, but this might affect the function
  460. signature. This should be investigated further.
  461. --------------------------------------------------------------------
  462. inet/rpc/getrpcent.c:
  463. static char RPCDB[] <fix desired> <---
  464. NOTE: This is okay, but should use the const keyword.
  465. --------------------------------------------------------------------
  466. inet/rpc/pmap_clnt.c:
  467. static struct timeval timeout <fix desired> <---
  468. static struct timeval tottimeout <fix desired> <---
  469. NOTE: These are okay, but should use the const keyword.
  470. --------------------------------------------------------------------
  471. inet/rpc/pmap_getport.c:
  472. static struct timeval timeout <fix desired> <---
  473. static struct timeval tottimeout <fix desired> <---
  474. NOTE: These are okay, but should use the const keyword.
  475. --------------------------------------------------------------------
  476. inet/rpc/pmap_rmt.c:
  477. static struct timeval timeout <fix desired> <---
  478. NOTE: This is okay, but should use the const keyword.
  479. --------------------------------------------------------------------
  480. inet/rpc/rpc_dtablesize.c:
  481. static int size;
  482. _rpc_dtablesize <fix required> <---
  483. --------------------------------------------------------------------
  484. inet/rpc/rpc_prot.c:
  485. static struct xdr_discrim reply_dscrm[3] <fix desired> <---
  486. NOTE: This is okay, but should use the const keyword.
  487. --------------------------------------------------------------------
  488. inet/rpc/svc.c:
  489. static SVCXPRT **xports;
  490. static SVCXPRT *xports[NOFILE];
  491. static struct svc_callout
  492. xprt_register <fix required> <---
  493. xprt_unregister <fix required> <---
  494. svc_getreqset <fix required> <---
  495. svc_register <fix required> <---
  496. svc_unregister <fix required> <---
  497. svc_callout <fix required> <---
  498. NOTE: This is intricate code, and care should be taken when making
  499. this thread-safe.
  500. --------------------------------------------------------------------
  501. inet/rpc/svc_auth.c:
  502. static struct svcauthsw <fix desired> <---
  503. NOTE: This is okay, but should use the const keyword.
  504. --------------------------------------------------------------------
  505. net/rpc/svc_raw.c:
  506. static struct svcraw_private
  507. static struct xp_ops server_ops
  508. svcraw_create <fix required> <---
  509. svcraw_recv <fix required> <---
  510. svcraw_reply <fix required> <---
  511. svcraw_getargs <fix required> <---
  512. svcraw_freeargs <fix required> <---
  513. NOTE: This is intricate code, and care should be taken when making
  514. this thread-safe.
  515. --------------------------------------------------------------------
  516. inet/rpc/svc_simple.c:
  517. static struct proglst
  518. static SVCXPRT *transp;
  519. registerrpc <fix required> <---
  520. universal <fix required> <---
  521. NOTE: This is intricate code, and care should be taken when making
  522. this thread-safe.
  523. --------------------------------------------------------------------
  524. inet/rpc/svc_tcp.c:
  525. static struct xp_ops svctcp_op
  526. static struct xp_ops svctcp_rendezvous_op
  527. svctcp_create <fix required> <---
  528. makefd_xprt <fix required> <---
  529. NOTE: This static structure is just a group of function pointers.
  530. It could probably be made const, but this might affect the function
  531. signature. This should be investigated further.
  532. static struct timeval wait_per_try
  533. readtcp <fix required> <---
  534. NOTE: This looks like a bug. This static timeout value is passed
  535. by reference to a select() call. According to the linux man page
  536. for select:
  537. "On Linux, timeout is modified to reflect the amount of
  538. time not slept; most other implementations do not do this.
  539. This causes problems both when Linux code which reads
  540. timeout is ported to other operating systems, and when
  541. code is ported to Linux that reuses a struct timeval for
  542. multiple selects in a loop without reinitializing it.
  543. Consider timeout to be undefined after select returns."
  544. Unless the implementation of select is different than that of Linux,
  545. this needs to be fixed!
  546. --------------------------------------------------------------------
  547. inet/rpc/svc_udp.c:
  548. static struct xp_ops svcudp_op <fix desired> (1)
  549. svcudp_bufcreate
  550. 1: This static structure is just a group of function pointers.
  551. It could probably be made const, but this might affect the function
  552. signature. This should be investigated further.
  553. --------------------------------------------------------------------
  554. inet/rpc/xdr.c:
  555. static char xdr_zero[BYTES_PER_XDR_UNIT] <fix desired> <---
  556. NOTE: This is okay, but should use the const keyword.
  557. static u_long crud[BYTES_PER_XDR_UNIT]
  558. NOTE: This looks like it doesn't matter what's in this array.
  559. --------------------------------------------------------------------
  560. inet/rpc/xdr_float.c:
  561. static struct sgl_limits <fix desired> <---
  562. static struct dbl_limits <fix desired> <---
  563. NOTE: These are okay, but should use the const keyword.
  564. --------------------------------------------------------------------
  565. inet/rpc/xdr_mem.c:
  566. static struct xdr_ops xdrmem_ops <fix desired> (1)
  567. xdrmem_create
  568. 1: This static structure is just a group of function pointers.
  569. It could probably be made const, but this might affect the function
  570. signature. This should be investigated further.
  571. --------------------------------------------------------------------
  572. inet/rpc/xdr_rec.c:
  573. static struct xdr_ops xdrrec_ops <fix desired> (1)
  574. xdrrec_create
  575. 1: This static structure is just a group of function pointers.
  576. It could probably be made const, but this might affect the function
  577. signature. This should be investigated further.
  578. --------------------------------------------------------------------
  579. inet/rpc/xdr_stdio.c:
  580. static struct xdr_ops xdrstdio_ops <fix desired> (1)
  581. xdrstdio_create
  582. 1: This static structure is just a group of function pointers.
  583. It could probably be made const, but this might affect the function
  584. signature. This should be investigated further.
  585. --------------------------------------------------------------------
  586. ld.so-1/d-link/boot1.c:
  587. static char *_dl_malloc_addr
  588. static char *_dl_mmap_zero
  589. static char *_dl_not_lazy
  590. static char *_dl_warn
  591. static char *_dl_trace_loaded_objects
  592. _dl_boot <fix required> <---
  593. _dl_malloc <fix required> <---
  594. _dl_fixup <fix required> <---
  595. These are all part of the shared library loader, and are not
  596. used by applications directly. Therefore, fixing these is not
  597. a high priority item.
  598. --------------------------------------------------------------------
  599. ld.so-1/d-link/readelflib1.c:
  600. static caddr_t _dl_cache_addr
  601. static size_t _dl_cache_size
  602. _dl_map_cache <fix required> <---
  603. _dl_unmap_cache <fix required> <---
  604. _dl_load_shared_library <fix required> <---
  605. These are all part of the shared library loader, and are not
  606. used by applications directly. Therefore, fixing these is not
  607. a high priority item.
  608. --------------------------------------------------------------------
  609. ld.so-1/d-link/string.h:
  610. static char local[22]
  611. _dl_simple_ltoa <fix required> <---
  612. _dl_simple_ltoahex <fix required> <---
  613. These are all part of the shared library loader, and are not
  614. used by applications directly. Therefore, fixing these is not
  615. a high priority item.
  616. --------------------------------------------------------------------
  617. ld.so-1/d-link/arm/elfinterp.c:
  618. static char *_dl_reltypes[] <fix desired> <---
  619. NOTE: This is okay, but should use the const keyword.
  620. --------------------------------------------------------------------
  621. ld.so-1/d-link/i386/elfinterp.c:
  622. static char *_dl_reltypes[] <fix desired> <---
  623. NOTE: This is okay, but should use the const keyword.
  624. These are all part of the shared library loader, and are not
  625. used by applications directly. Therefore, fixing these is not
  626. a high priority item.
  627. --------------------------------------------------------------------
  628. ld.so-1/d-link/m68k/elfinterp.c:
  629. static char *_dl_reltypes[] <fix desired> <---
  630. NOTE: This is okay, but should use the const keyword.
  631. These are all part of the shared library loader, and are not
  632. used by applications directly. Therefore, fixing these is not
  633. a high priority item.
  634. --------------------------------------------------------------------
  635. ld.so-1/d-link/sparc/elfinterp.c:
  636. static char *_dl_reltypes[] <fix desired> <---
  637. NOTE: This is okay, but should use the const keyword.
  638. These are all part of the shared library loader, and are not
  639. used by applications directly. Therefore, fixing these is not
  640. a high priority item.
  641. --------------------------------------------------------------------
  642. ld.so-1/libdl/dlib.c:
  643. static int dl_init
  644. _dlopen <fix required> <---
  645. static int __attribute__ ((unused)) foobar1 <fix required?> (1)
  646. NOTE: The comment for this says it all: "This is a real hack." ;-)
  647. static char *type[] <fix desired> <---
  648. NOTE: This is okay, but should use the const keyword.
  649. These are all part of the shared library loader, and are not
  650. used by applications directly. Therefore, fixing these is not
  651. a high priority item.
  652. --------------------------------------------------------------------
  653. ld.so-1/util/ldconfig.c:
  654. static header_t magic <fix desired> <---
  655. NOTE: This is okay, but should use the const keyword.
  656. static liblist_t *lib_head
  657. cache_dolib <fix required> <---
  658. cache_write <fix required> <---
  659. This is not actually part of the C library, and is not built by
  660. default, so fixing these is not a high priority item.
  661. --------------------------------------------------------------------
  662. misc/internals/tempname.c:
  663. static uint64_t value;
  664. __gen_tempname <no fix required>
  665. This is supposed to be random trash, so the more threading
  666. collisions the better...
  667. --------------------------------------------------------------------
  668. misc/locale/locale.c:
  669. static char C_LOCALE_NAME[]="C"; <fix desired> <---
  670. NOTE: This is okay, but should use the const keyword.
  671. static struct SAV_LOADED_LOCALE sav_loaded_locale [1]
  672. static struct SAV_LOADED_LOCALE * old_locale
  673. setlocale <fix required> <---
  674. NOTE: Can different threads use different locales? I don't see
  675. why not.
  676. --------------------------------------------------------------------
  677. misc/locale/localeconv.c:
  678. static struct lconv result;
  679. localeconv <fix required> <---
  680. NOTE: This function returns a pointer to a static data structure.
  681. static char *blank = ""; <fix desired> <---
  682. static char *decimal = "."; <fix desired> <---
  683. NOTE: These are okay, but should use the const keyword.
  684. --------------------------------------------------------------------
  685. misc/mntent/mntent.c:
  686. static char buff[MNTMAXSTR];
  687. static struct mntent mnt;
  688. getmntent <mutex required>
  689. getmntent_r <implemented>
  690. --------------------------------------------------------------------
  691. misc/regex/regex.c:
  692. static char re_syntax_table[CHAR_SET_SIZE];
  693. static int done = 0;
  694. init_syntax_table <fix required> <---
  695. static int debug;
  696. <several functions> <fix required> <---
  697. NOTE: This is used to turn on debugging, and is used in several
  698. functions. It will need to be fixed if you want differing debug
  699. levels per thread.
  700. static char reg_unset_dummy;
  701. <REG_UNSET...> <fix required> <---
  702. static fail_stack_type fail_stack;
  703. regex_compile <fix required> <---
  704. <FREE_VARIABLES> <fix required> <---
  705. <FAIL_STACK_EMPTY> <fix required> <---
  706. <FAIL_STACK_PTR_EMPTY> <fix required> <---
  707. <FAIL_STACK_FULL> <fix required> <---
  708. <INIT_FAIL_STACK> <fix required> <---
  709. <RESET_FAIL_STACK> <fix required> <---
  710. <DOUBLE_FAIL_STACK> <fix required> <---
  711. <PUSH_FAILURE_POINTER> <fix required> <---
  712. <PUSH_FAILURE_INT> <fix required> <---
  713. <PUSH_FAILURE_ELT> <fix required> <---
  714. <POP_FAILURE_POINTER> <fix required> <---
  715. <POP_FAILURE_INT> <fix required> <---
  716. <POP_FAILURE_ELT> <fix required> <---
  717. <REMAINING_AVAIL_SLOTS> <fix required> <---
  718. static int regs_allocated_size;
  719. regs_grow_registers <fix required> <---
  720. static register_info_type *reg_info;
  721. static register_info_type *reg_info_dummy;
  722. static unsigned failure_id;
  723. static struct re_pattern_buffer re_comp_buf;
  724. <too many to list> <fix required> <---
  725. NOTE: This is just a NASTY file for static variables. A lot of
  726. work needs to be done here to clean this up. But I'm not even
  727. sure if it matters. This code is taken directly from glibc.
  728. This code is also very large (adds over 30k to the C library
  729. all by itself). This file needs a complete rewrite.
  730. --------------------------------------------------------------------
  731. misc/syslog/syslog.c:
  732. static pthread_once__t _once_block = pthread_once_init;
  733. static pthread_mutex_t _syslog_mutex;
  734. NOTE: I think these are okay. ;-)
  735. static int LogFile = -1;
  736. static int connected;
  737. static int LogStat = 0;
  738. static int LogFacility = LOG_USER;
  739. static int LogMask = 0xff;
  740. static char truncate_msg[12]
  741. static struct sockaddr SyslogAddr;
  742. NOTE: These are already protected.
  743. --------------------------------------------------------------------
  744. misc/time/asctime.c:
  745. static char timebuf[26];
  746. asctime <asctime_r implemented>
  747. --------------------------------------------------------------------
  748. misc/time/ctime.c:
  749. static char cbuf[26];
  750. ctime <ctime_r implemented>
  751. --------------------------------------------------------------------
  752. misc/time/gmtime.c:
  753. static struct tm tmb;
  754. gmtime <gmtime_r implemented>
  755. --------------------------------------------------------------------
  756. misc/time/localtime.c:
  757. static struct tm tmb;
  758. localtime <localtime_r implemented>
  759. --------------------------------------------------------------------
  760. misc/time/mktime.c:
  761. static tz_rule tz_rules[2];
  762. tzset <fix required> <---
  763. static time_t localtime_offset;
  764. mktime <fix required> <---
  765. --------------------------------------------------------------------
  766. misc/time/tm_conv.c:
  767. static int moffset[] <fix desired> <---
  768. NOTE: This is okay, but should use the const keyword.
  769. --------------------------------------------------------------------
  770. misc/utmp/utent.c:
  771. static int static_fd = -1;
  772. static struct utmp static_utmp;
  773. static const char default_file_name[] = _PATH_UTMP;
  774. static const char *static_ut_name = (const char *) default_file_name;
  775. setutent <ok>
  776. endutent <ok>
  777. getutent <ok>
  778. getutid <ok>
  779. getutline <ok>
  780. pututline <ok>
  781. utmpname <ok>
  782. __getutent <ok>
  783. --------------------------------------------------------------------
  784. pwd_grp/__getgrent.c:
  785. static char line_buff[GR_MAX_LINE_LEN];
  786. static char *members[GR_MAX_MEMBERS];
  787. static char *line_buff = NULL;
  788. static char **members = NULL;
  789. static struct group group;
  790. __getgrent <fix required> <---
  791. --------------------------------------------------------------------
  792. pwd_grp/fgetpwent.c:
  793. static char line_buff[PWD_BUFFER_SIZE];
  794. static struct passwd pwd;
  795. fgetpwent <fgetpwent_r implemented>
  796. --------------------------------------------------------------------
  797. pwd_grp/getpwnam.c:
  798. static char line_buff[PWD_BUFFER_SIZE];
  799. static struct passwd pwd;
  800. getpwnam <getpwnam_r implemented>
  801. --------------------------------------------------------------------
  802. pwd_grp/getpwuid.c:
  803. static char line_buff[PWD_BUFFER_SIZE];
  804. static struct passwd pwd;
  805. getpwuid <getpwuid_r implemented>
  806. --------------------------------------------------------------------
  807. pwd_grp/grent.c:
  808. static int grp_fd = -1;
  809. setgrent <fix required> <---
  810. endgrent <fix required> <---
  811. getgrent <fix required> <---
  812. --------------------------------------------------------------------
  813. pwd_grp/pwent.c:
  814. static int pw_fd = -1;
  815. setpwent <fix required> <---
  816. endpwent <fix required> <---
  817. getpwent_r <fix required> <---
  818. NOTE: Yeah, this looks weird, but getpwent_r isn't completely
  819. thread-safe.
  820. static char line_buff[PWD_BUFFER_SIZE];
  821. static struct passwd pwd;
  822. getpwent <getpwent_r implemented> <---
  823. --------------------------------------------------------------------
  824. stdio/tmpnam.c:
  825. static char tmpnam_buffer[L_tmpnam];
  826. tmpnam <tmpnam_r implemented>
  827. --------------------------------------------------------------------
  828. stdlib/atexit.c:
  829. static vfuncp __atexit_table[__UCLIBC_MAX_ATEXIT];
  830. static int __atexit_count = 0;
  831. atexit_handler <fix required> <---
  832. atexit <fix required> <---
  833. --------------------------------------------------------------------
  834. stdlib/bsearch.c:
  835. static int _bsearch;
  836. bsearch <ok>
  837. --------------------------------------------------------------------
  838. stdlib/setenv.c:
  839. static char **last_environ;
  840. __add_to_environ <ok>
  841. unsetenv <ok>
  842. setenv <ok>
  843. clearenv <ok>
  844. putenv <ok>
  845. all ok now.
  846. --------------------------------------------------------------------
  847. stdlib/random.c:
  848. static long int seed1 = 1;
  849. static long int seed2 = 1;
  850. static long int seed3 = 1;
  851. random <fix required?> (1)
  852. srandom <fix required?> (1)
  853. 1: I'm not sure if it matters if these are static, since they
  854. are random number seeds. Who cares if more than one thread changes
  855. their value?
  856. --------------------------------------------------------------------
  857. stdlib/malloc/avlmacro.h
  858. static objname *__Avl_##objname##pr##_new_node;
  859. Avl_Tree_no_replace <fix required> <---
  860. NOTE: This will take a bit of study to figure out if it needs fixing.
  861. --------------------------------------------------------------------
  862. stdlib/malloc/malloc.c:
  863. //static mutex_t malloc_lock = MUTEX_INITIALIZER; <---
  864. NOTE: Basically, thread support in malloc is broken and must be
  865. fixed. It looks like the infrastructure is there, but more
  866. investigation is required.
  867. --------------------------------------------------------------------
  868. stdlib/malloc-930716/malloc.c:
  869. A bunch of stuff
  870. malloc <ok>
  871. realloc <ok>
  872. free <ok>
  873. etc <ok>
  874. --------------------------------------------------------------------
  875. string/strerror.c:
  876. static char retbuf[48];
  877. static char retbuf[33];
  878. strerror <fix required> <---
  879. strerror_r <fix required> <---
  880. --------------------------------------------------------------------
  881. string/strsignal.c:
  882. static char retbuf[28];
  883. strsignal <fix required> <---
  884. main <fix required> <---
  885. --------------------------------------------------------------------
  886. string/strtok.c:
  887. static char *save = 0;
  888. strtok <ok>
  889. strtok_r <ok>
  890. --------------------------------------------------------------------
  891. termios/tcgetsid.c:
  892. static int tiocgsid_does_not_work;
  893. tcgestsid <fix required> <---
  894. --------------------------------------------------------------------
  895. termios/ttyname.c:
  896. static char dev[] = "/dev";
  897. ttyname <fix desired> <---
  898. NOTE: This is okay, but should use the const keyword.
  899. static char name[NAME_MAX];
  900. ttyname <ttyname_r required> <---
  901. --------------------------------------------------------------------
  902. test/testsuite.h:
  903. static int failures
  904. error_msg <fix required> <---
  905. done_testing <fix required> <---
  906. init_testsuite <fix required> <---
  907. --------------------------------------------------------------------
  908. unistd/getopt.c:
  909. static int sp = 1;
  910. getopt <fix required> <---
  911. --------------------------------------------------------------------
  912. unistd/getpass.c:
  913. static char buf[PWD_BUFFER_SIZE];
  914. getpass <fix required> <---
  915. NOTE: This function returns a pointer to a static data structure.
  916. This seems like it requires an _r version of this function. Glibc
  917. does the same thing. Oops! So much for thread-safe glibc!
  918. --------------------------------------------------------------------
  919. unistd/gnu_getopt.c:
  920. static char *nextchar;
  921. static enum ordering;
  922. static int first_nonopt;
  923. static int last_nonopt;
  924. _getopt_initialize <fix required> <---
  925. _getopt_internal <fix required> <---
  926. exchange <fix required> <---
  927. static struct option long_options[] <fix desired> <---
  928. NOTE: This is okay, but should use the const keyword.
  929. --------------------------------------------------------------------
  930. unistd/sysconf.c:
  931. static long int ret_vals[_UCLIBC_SYSCONF_NUM_VALID_ARGS];
  932. find_or_add_in_table <fix required?> <---
  933. main <fix required?> <---
  934. NOTE: I'm not sure if this needs to be multi-threaded or not.
  935. --------------------------------------------------------------------
  936. unistd/sysconf_src.c:
  937. static long int ret_vals[_UCLIBC_SYSCONF_NUM_VALID_ARGS];
  938. find_or_add_in_table <fix required?> <---
  939. main <fix required?> <---
  940. NOTE: I'm not sure if this needs to be multi-threaded or not.
  941. --------------------------------------------------------------------
  942. unistd/sysconf_i386.c:
  943. static long int ret_vals[_UCLIBC_SYSCONF_NUM_VALID_ARGS];
  944. find_or_add_in_table <fix required?> <---
  945. main <fix required?> <---
  946. NOTE: I'm not sure if this needs to be multi-threaded or not.
  947. --------------------------------------------------------------------
  948. 4. List of functions that use global variables
  949. The following is a list of functions that make use of global
  950. variables. Since multiple threads can access the same global
  951. variable at the same time, access should be considered unsafe.
  952. This is an attempt to identify all the areas where global
  953. variables are used. This does not necessarily mean that each
  954. of these is unsafe. It just means that there is a potential
  955. for them to be unsafe. If this code never runs in more than
  956. one thread, then there's no problem. More ivestigation will be
  957. required to determine if changes are really required.
  958. Global variable:
  959. __environ (misc/internals/__uClibc_main.c)
  960. __uClibc_main.c:
  961. __uClibc_main <fix required?> (1)
  962. 1: This should only get executed once, so it is probably fine.
  963. stdlib/getenv.c:
  964. getenv <fix required> <---
  965. stdlib/putenv.c:
  966. putenv <fix required> <---
  967. stdlib/setenv.c:
  968. setenv <fix required> <---
  969. unsetenv <fix required> <---
  970. test/args/arg_test.c:
  971. main <fix required> <---
  972. unistd/execl.c:
  973. execl <fix required> <---
  974. unistd/execlp.c:
  975. execlp <fix required> <---
  976. unistd/execv.c:
  977. execv <fix required> <---
  978. unistd/execvp.c:
  979. execvep <fix required> <---
  980. --------------------------------------------------------------------
  981. Global variable:
  982. __uClibc_cleanup (misc/internals/__uClibc_main.c)
  983. stdlib/abort.c:
  984. abort <fix required> <---
  985. stdlib/atexit.c:
  986. atexit_handler <fix required> <---
  987. atexit <fix required> <---
  988. exit <fix required> <---
  989. NOTE: Not sure if multiple threads can be in this code or not.
  990. --------------------------------------------------------------------
  991. Global variable:
  992. environ (misc/internals/__uClibc_main.c)
  993. NOTE: This is a weak alias for __environ, but it doesn't ever get
  994. used in the uClibc library.
  995. --------------------------------------------------------------------
  996. Global variable:
  997. timezone (misc/time/tm_conv.c)
  998. misc/time/tm_conv.c:
  999. __tm_conv <fix required> <---
  1000. --------------------------------------------------------------------
  1001. Global variable:
  1002. re_max_failures (misc/regex/regex.c)
  1003. misc/regex/regex.c:
  1004. DOUBLE_FAIL_STACK <fix required> <---
  1005. regex_compile <fix required> <---
  1006. --------------------------------------------------------------------
  1007. Global variable:
  1008. re_syntax_options (misc/regex/regex.c)
  1009. misc/regex/regex.c:
  1010. re_set_syntax <fix required> <---
  1011. re_compile_pattern <fix required> <---
  1012. re_comp <fix required> <---
  1013. --------------------------------------------------------------------
  1014. Global variable:
  1015. __IO_list (stdio/stdio.c)
  1016. stdio/stdio.c:
  1017. fflush <fix required> <---
  1018. __fopen <fix required> <---
  1019. fclose <fix required> <---
  1020. --------------------------------------------------------------------
  1021. Global variable:
  1022. _fixed_buffers (stdio/stdio.c)
  1023. stdio/stdio.c:
  1024. _alloc_stdio_buffer <fix required> <---
  1025. _free_stdio_buffer_of_file <fix required> <---
  1026. __init_stdio <fix required> <---
  1027. --------------------------------------------------------------------
  1028. Global variable:
  1029. _free_buffer_index (stdio/stdio.c)
  1030. stdio/stdio.c:
  1031. _alloc_stdio_buffer <fix required> <---
  1032. _free_stdio_buffer_of_file <fix required> <---
  1033. __init_stdio <fix required> <---
  1034. --------------------------------------------------------------------
  1035. Global variable:
  1036. _free_file_list (stdio/stdio.c)
  1037. stdio/stdio.c:
  1038. __init_stdio <fix required> <---
  1039. _alloc_stdio_stream <fix required> <---
  1040. _free_stdio_stream <fix required> <---
  1041. --------------------------------------------------------------------
  1042. Global variable:
  1043. _stderr (stdio/stdio.c)
  1044. ld.so-1/util/ldconfig.c:
  1045. warn <fix required> <---
  1046. error <fix required> <---
  1047. usage <fix required> <---
  1048. ld.so-1/util/ldd.c:
  1049. warn <fix required> <---
  1050. error <fix required> <---
  1051. is_bin <fix required> <---
  1052. main <fix required> <---
  1053. misc/locale/locale.c:
  1054. setlocale <fix required> <---
  1055. misc/regex/regex.c:
  1056. printchar <fix required> <---
  1057. stdio/perror.c:
  1058. perror <fix required> <---
  1059. stdlib/malloc/alloc.c:
  1060. calloc_dbg <fix required> <---
  1061. malloc_dbg <fix required> <---
  1062. free_dbg <fix required> <---
  1063. stdlib/malloc/malloc.c:
  1064. __hunk_alloc <fix required?> (1)
  1065. __malloc_init <fix required?> (1)
  1066. malloc <fix required?> (1)
  1067. 1: These are commented out with C++ style comments.
  1068. stdlib/malloc-simple/alloc.c:
  1069. calloc_dbg <fix required> <---
  1070. malloc_dbg <fix required> <---
  1071. free_dbg <fix required> <---
  1072. string/strsignal.c:
  1073. psignal <fix required> <---
  1074. test/args/arg_test.c:
  1075. main <fix required> <---
  1076. test/assert/assert.c:
  1077. main <fix required> <---
  1078. unistd/getopt.c:
  1079. Err <fix required> <---
  1080. unistd/getpass.c:
  1081. getpass <fix required> <---
  1082. unistd/gnu_getopt.c:
  1083. _getopt_internal <fix required> <---
  1084. unistd/sysconf.c:
  1085. main <fix required> <---
  1086. unistd/sysconf_src.c:
  1087. main <fix required> <---
  1088. unistd/sysconf_i386.c:
  1089. main <fix required> <---
  1090. --------------------------------------------------------------------
  1091. Global variable:
  1092. _stdin (stdio/stdio.c)
  1093. include/stdio.h:
  1094. getchar <fix required> <---
  1095. include/bits/stdio.h:
  1096. getchar <fix required> <---
  1097. getchar_unlocked <fix required> <---
  1098. stdio/scanf.c:
  1099. scanf <fix required> <---
  1100. vscanf <fix required> <---
  1101. stdio/stdio.c
  1102. gets <fix required> <---
  1103. getchar <fix required> <---
  1104. sysdeps/linux/i386/bits/stdio.h:
  1105. getchar <fix required> <---
  1106. getchar_unlocked <fix required> <---
  1107. sysdeps/linux/m68k/bits/stdio.h:
  1108. getchar <fix required> <---
  1109. getchar_unlocked <fix required> <---
  1110. sysdeps/linux/sh/bits/stdio.h:
  1111. getchar <fix required> <---
  1112. getchar_unlocked <fix required> <---
  1113. sysdeps/linux/sparc/bits/stdio.h:
  1114. getchar <fix required> <---
  1115. getchar_unlocked <fix required> <---
  1116. unistd/getpass.c:
  1117. getpass <fix required> <---
  1118. --------------------------------------------------------------------
  1119. Global variable:
  1120. _stdio_streams (stdio/stdio.c)
  1121. stdio/stdio.c:
  1122. __init_stdio <fix required> <---
  1123. _free_stdio_stream <fix required> <---
  1124. --------------------------------------------------------------------
  1125. Global variable:
  1126. _stdout (stdio/stdio.c)
  1127. include/stdio.h:
  1128. putchar <fix required> <---
  1129. include/bits/stdio.h:
  1130. vprintf <fix required> <---
  1131. putchar <fix required> <---
  1132. putchar_unlocked <fix required> <---
  1133. ld.so-1/util/ldconfig.c:
  1134. warn <fix required> <---
  1135. error <fix required> <---
  1136. ld.so-1/util/ldd.c:
  1137. warn <fix required> <---
  1138. error <fix required> <---
  1139. main <fix required> <---
  1140. stdio/printf.c:
  1141. printf <fix required> <---
  1142. vprintf <fix required> <---
  1143. stdio/stdio.c:
  1144. puts <fix required> <---
  1145. _uClibc_fread <fix required> <---
  1146. putchar <fix required> <---
  1147. sysdeps/linux/i386/bits/stdio.h:
  1148. vprintf <fix required> <---
  1149. putchar <fix required> <---
  1150. putchar_unlocked <fix required> <---
  1151. sysdeps/linux/m68k/bits/stdio.h:
  1152. vprintf <fix required> <---
  1153. putchar <fix required> <---
  1154. putchar_unlocked <fix required> <---
  1155. sysdeps/linux/sh/bits/stdio.h:
  1156. vprintf <fix required> <---
  1157. putchar <fix required> <---
  1158. putchar_unlocked <fix required> <---
  1159. sysdeps/linux/sparc/bits/stdio.h:
  1160. vprintf <fix required> <---
  1161. putchar <fix required> <---
  1162. putchar_unlocked <fix required> <---
  1163. test/pwd_grp/test_grp.c:
  1164. main <fix required> <---
  1165. test/pwd_grp/test_pwd.c:
  1166. main <fix required> <---
  1167. --------------------------------------------------------------------
  1168. Global variable:
  1169. dns_caught_signal (inet/resolv.c)
  1170. inet/resolv.c:
  1171. dns_catch_signal <fix required> <---
  1172. dns_lookup <fix required> <---
  1173. --------------------------------------------------------------------
  1174. Global variable:
  1175. nameserver (inet/resolv.c)
  1176. nameservers (inet/resolv.c)
  1177. inet/resolv.c:
  1178. open_nameservers <fix required> <---
  1179. close_nameservers <fix required> <---
  1180. resolve_name <fix required> <---
  1181. gethostbyname <fix required> <---
  1182. res_query <fix required> <---
  1183. gethostbyaddr <fix required> <---
  1184. --------------------------------------------------------------------
  1185. Global variable:
  1186. searchdomain (inet/resolv.c)
  1187. searchdomains (inet/resolv.c)
  1188. inet/resolv.c:
  1189. dns_lookup <fix required> <---
  1190. --------------------------------------------------------------------
  1191. Global variable:
  1192. _net_stayopen (inet/getnetent.c)
  1193. inet/getnetbyad.c:
  1194. getnetbyaddr <fix required> <---
  1195. inet/getnetbynm.c:
  1196. getnetbyname <fix required> <---
  1197. inet/getnetent.c:
  1198. setnetent <fix required> <---
  1199. endnetent <fix required> <---
  1200. --------------------------------------------------------------------
  1201. Global variable:
  1202. rpcdata (inet/rpc/getrpcent.c)
  1203. inet/rpc/getrpcent.c:
  1204. _rpcdata <fix required> <---
  1205. --------------------------------------------------------------------
  1206. Global variable:
  1207. _null_auth (inet/rpc/rpc_commondata.c) <fix desired> <---
  1208. NOTE: _null_auth is never actually initialized. It never gets written,
  1209. only read. So it should be thread safe. But it should be declared
  1210. as a const if that is the case. It should also be initialized.
  1211. inet/rpc/auth_none.c:
  1212. authnone_create
  1213. inet/rpc/auth_unix.c:
  1214. authunix_create
  1215. inet/rpc/clnt_raw.c:
  1216. clntraw_call
  1217. inet/rpc/clnt_tcp.c:
  1218. clnttcp_call
  1219. inet/rpc/clnt_udp.c:
  1220. clntudp_call
  1221. inet/rpc/pmap_rmt.c:
  1222. clnt_broadcast
  1223. inet/rpc/svc_auth.c:
  1224. _authenticate
  1225. inet/rpc/svc_tcp.c:
  1226. svctcp_create
  1227. --------------------------------------------------------------------
  1228. Global variable:
  1229. rpc_createerr (inet/rpc/rpc_commondata.c)
  1230. inet/rpc/clnt_generic.c:
  1231. clnt_create <fix required> <---
  1232. inet/rpc/clnt_perror.c:
  1233. clnt_spcreateerror <fix desired?> <---
  1234. NOTE: This piece of code has an "#if 0" around it.
  1235. inet/rpc/clnt_simple.c:
  1236. callrpc <fix required> <---
  1237. inet/rpc/clnt_tcp.c:
  1238. clnttcp_create <fix required> <---
  1239. inet/rpc/clnt_udp.c:
  1240. clntudp_bufcreate <fix required> <---
  1241. inet/rpc/pmap_getport.c:
  1242. pmap_getport <fix required> <---
  1243. --------------------------------------------------------------------
  1244. Global variable:
  1245. svc_fdset (inet/rpc/rpc_commondata.c)
  1246. inet/rpc/svc.c:
  1247. xprt_register <fix required> <---
  1248. xprt_unregister <fix required> <---
  1249. svc_getreq <fix required> <---
  1250. inet/rpc/svc_run.c:
  1251. svc_run <fix required> <---
  1252. NOTE: Be careful to also fix the uses of the "svc_fds" #define.
  1253. --------------------------------------------------------------------
  1254. Global variable:
  1255. pl (inet/rpc/svc_simple.c)
  1256. registerrpc <fix required> <---
  1257. NOTE: proglst is set up to point at pl, so it needs fixing as well.
  1258. (See proglst earlier in this document.)
  1259. --------------------------------------------------------------------
  1260. Global variable:
  1261. _sigintr (signal/signal.c)
  1262. signal/bsd_sig.c:
  1263. __bsd_signal <fix required> <---
  1264. signal/sigintr.c:
  1265. siginterrupt <fix required> <---
  1266. --------------------------------------------------------------------
  1267. Global variable:
  1268. __Avl_Block_tfree_mem_tree (stdlib/malloc/malloc.c)
  1269. stdlib/malloc/malloc.c:
  1270. __free_mem_del_block <fix required> <---
  1271. bl_alloc <fix required> <---
  1272. __malloc_init <fix required> <---
  1273. NOTE: This code is very tricky stuff.
  1274. --------------------------------------------------------------------
  1275. Global variable:
  1276. __Avl_Block_tptrs_tree (stdlib/malloc/malloc.c)
  1277. stdlib/malloc/malloc.c:
  1278. __bl_free <fix required> <---
  1279. __malloc_init <fix required> <---
  1280. free <fix required> <---
  1281. _realloc_no_move <fix required> <---
  1282. realloc <fix required> <---
  1283. --------------------------------------------------------------------
  1284. Global variable:
  1285. __bl_last (stdlib/malloc/malloc.c)
  1286. stdlib/malloc/malloc.c:
  1287. COMBINE_BLOCKS <fix required> <---
  1288. SPLIT_BLOCK <fix required> <---
  1289. bl_mapnew <fix required> <---
  1290. bl_alloc <fix required> <---
  1291. __malloc_init <fix required> <---
  1292. --------------------------------------------------------------------
  1293. Global variable:
  1294. __free_h (stdlib/malloc/malloc.c)
  1295. stdlib/malloc/malloc.c:
  1296. __hunk_alloc <fix required> <---
  1297. __hunk_free <fix required> <---
  1298. __malloc_init <fix required> <---
  1299. --------------------------------------------------------------------
  1300. Global variable:
  1301. __malloc_initialized (stdlib/malloc/malloc.c)
  1302. stdlib/malloc/malloc.c:
  1303. __malloc_init <fix required> <---
  1304. malloc <fix required> <---
  1305. free <fix required> <---
  1306. _realloc_no_move <fix required> <---
  1307. --------------------------------------------------------------------
  1308. Global variable:
  1309. __total_h (stdlib/malloc/malloc.c)
  1310. stdlib/malloc/malloc.c:
  1311. __hunk_alloc <fix required> <---
  1312. __malloc_init <fix required> <---
  1313. --------------------------------------------------------------------
  1314. Global variable:
  1315. errno (sysdeps/linux/common/errno.c)
  1316. sysdeps/linux/common/errno.c:
  1317. __errno_location <fix required> <---
  1318. NOTE: Obviously, errno gets used all over the place. I won't list
  1319. them all here.
  1320. --------------------------------------------------------------------
  1321. Global variable:
  1322. ___brk_addr (sysdeps/linux/i386/__init_brk.c)
  1323. sysdeps/linux/i386/__init_brk.c:
  1324. __init_brk <fix required> <---
  1325. sysdeps/linux/i386/brk.c:
  1326. brk <fix required> <---
  1327. sysdeps/linux/i386/sbrk.c:
  1328. sbrk <fix required> <---
  1329. --------------------------------------------------------------------
  1330. Global variable:
  1331. optarg (unistd/getopt_vars.c)
  1332. extra/locale/gen_ctype_from_glibc.c:
  1333. main <fix required?> (1)
  1334. ld.so-1/util/ldconfig.c:
  1335. main <fix required?> (1)
  1336. unistd/getopt.c:
  1337. getopt <fix required> <---
  1338. unistd/gnu_getopt.c:
  1339. _getopt_internal <fix required> <---
  1340. main <fix required?> (1)
  1341. 1: Probably not required unless this program is run on multiple
  1342. threads.
  1343. --------------------------------------------------------------------
  1344. Global variable:
  1345. opterr (unistd/getopt_vars.c)
  1346. ld.so-1/util/ldconfig.c:
  1347. main <fix required?> (1)
  1348. unistd/getopt.c:
  1349. Err <fix required> <---
  1350. getopt <fix required> <---
  1351. unistd/gnu_getopt.c:
  1352. _getopt_internal <fix required> <---
  1353. 1: Probably not required unless this program is run on multiple
  1354. threads.
  1355. --------------------------------------------------------------------
  1356. Global variable:
  1357. optind (unistd/getopt_vars.c)
  1358. extra/locale/gen_ctype_from_glibc.c:
  1359. main <fix required?> (1)
  1360. ld.so-1/util/ldconfig.c:
  1361. main <fix required?> (1)
  1362. ld.so-1/util/ldd.c:
  1363. main <fix required?> (1)
  1364. unistd/getopt.c:
  1365. Err <fix required> <---
  1366. getopt <fix required> <---
  1367. unistd/gnu_getopt.c:
  1368. exchange <fix required> <---
  1369. _getopt_initialize <fix required> <---
  1370. _getopt_internal <fix required> <---
  1371. main <fix required?> (1)
  1372. main (2nd one) <fix required?> (1)
  1373. 1: Probably not required unless this program is run on multiple
  1374. threads.
  1375. --------------------------------------------------------------------
  1376. Global variable:
  1377. optopt (unistd/getopt_vars.c)
  1378. unistd/getopt.c:
  1379. Err <fix required> <---
  1380. getopt <fix required> <---
  1381. unistd/gnu_getopt.c:
  1382. _getopt_internal <fix required> <---