threads.txt 82 KB

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