ccgo_linux_arm.go 538 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817
  1. // Code generated for linux/arm by 'gcc -no-main-minimize --prefix-enumerator=_ --prefix-external=x_ --prefix-field=F --prefix-macro=m_ --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-enum=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -extended-errors -ignore-link-errors -ignore-unsupported-alignment -ignore-link-errors -I /home/jnml/src/modernc.org/builder/.exclude/modernc.org/libc/include/linux/arm -I /home/jnml/src/modernc.org/builder/.exclude/modernc.org/limd/include/linux/arm -shared -DPIC .libs/arc4random.o.go .libs/arc4random_uniform.o.go .libs/bsd_getopt.o.go .libs/closefrom.o.go .libs/dehumanize_number.o.go .libs/err.o.go .libs/expand_number.o.go .libs/explicit_bzero.o.go .libs/fgetln.o.go .libs/freezero.o.go .libs/fgetwln.o.go .libs/flopen.o.go .libs/fmtcheck.o.go .libs/fparseln.o.go .libs/fpurge.o.go .libs/funopen.o.go .libs/getbsize.o.go .libs/getpeereid.o.go .libs/heapsort.o.go .libs/humanize_number.o.go .libs/inet_net_pton.o.go .libs/md5.o.go .libs/merge.o.go .libs/nlist.o.go .libs/pidfile.o.go .libs/progname.o.go .libs/pwcache.o.go .libs/radixsort.o.go .libs/readpassphrase.o.go .libs/reallocarray.o.go .libs/reallocf.o.go .libs/recallocarray.o.go .libs/setmode.o.go .libs/setproctitle.o.go .libs/strlcat.o.go .libs/strlcpy.o.go .libs/stringlist.o.go .libs/strmode.o.go .libs/strnstr.o.go .libs/strtoi.o.go .libs/strtonum.o.go .libs/strtou.o.go .libs/timeconv.o.go .libs/unvis.o.go .libs/vis.o.go .libs/wcslcat.o.go .libs/wcslcpy.o.go .libs/getentropy.o.go -lmd -o .libs/libbsd.so.0.11.7.go', DO NOT EDIT.
  2. //go:build linux && arm
  3. package libbsd
  4. import (
  5. "reflect"
  6. "unsafe"
  7. "modernc.org/libc"
  8. "modernc.org/libmd"
  9. )
  10. var _ reflect.Type
  11. var _ unsafe.Pointer
  12. const m_ARG_MAX = 131072
  13. const m_AT_EACCESS = 0x200
  14. const m_AT_EMPTY_PATH = 0x1000
  15. const m_AT_NO_AUTOMOUNT = 0x800
  16. const m_AT_RECURSIVE = 0x8000
  17. const m_AT_REMOVEDIR = 0x200
  18. const m_AT_STATX_DONT_SYNC = 0x4000
  19. const m_AT_STATX_FORCE_SYNC = 0x2000
  20. const m_AT_STATX_SYNC_AS_STAT = 0x0000
  21. const m_AT_STATX_SYNC_TYPE = 0x6000
  22. const m_AT_SYMLINK_FOLLOW = 0x400
  23. const m_AT_SYMLINK_NOFOLLOW = 0x100
  24. const m_BC_BASE_MAX = 99
  25. const m_BC_DIM_MAX = 2048
  26. const m_BC_SCALE_MAX = 99
  27. const m_BC_STRING_MAX = 1000
  28. const m_BIG_ENDIAN = "__BIG_ENDIAN"
  29. const m_BLOCKSZ = 64
  30. const m_BUFSIZ = 1024
  31. const m_BUS_ADRALN = 1
  32. const m_BUS_ADRERR = 2
  33. const m_BUS_MCEERR_AO = 5
  34. const m_BUS_MCEERR_AR = 4
  35. const m_BUS_OBJERR = 3
  36. const m_BYTE_ORDER = "__BYTE_ORDER"
  37. const m_CANBSIZ = 255
  38. const m_CHARCLASS_NAME_MAX = 14
  39. const m_CHAR_BIT = 8
  40. const m_CHAR_MAX = 255
  41. const m_CHAR_MIN = 0
  42. const m_CLD_CONTINUED = 6
  43. const m_CLD_DUMPED = 3
  44. const m_CLD_EXITED = 1
  45. const m_CLD_KILLED = 2
  46. const m_CLD_STOPPED = 5
  47. const m_CLD_TRAPPED = 4
  48. const m_CLOCKS_PER_SEC = 1000000
  49. const m_CLOCK_BOOTTIME = 7
  50. const m_CLOCK_BOOTTIME_ALARM = 9
  51. const m_CLOCK_MONOTONIC = 1
  52. const m_CLOCK_MONOTONIC_COARSE = 6
  53. const m_CLOCK_MONOTONIC_RAW = 4
  54. const m_CLOCK_PROCESS_CPUTIME_ID = 2
  55. const m_CLOCK_REALTIME = 0
  56. const m_CLOCK_REALTIME_ALARM = 8
  57. const m_CLOCK_REALTIME_COARSE = 5
  58. const m_CLOCK_SGI_CYCLE = 10
  59. const m_CLOCK_TAI = 11
  60. const m_CLOCK_THREAD_CPUTIME_ID = 3
  61. const m_CLONE_CHILD_CLEARTID = 0x00200000
  62. const m_CLONE_CHILD_SETTID = 0x01000000
  63. const m_CLONE_DETACHED = 0x00400000
  64. const m_CLONE_FILES = 0x00000400
  65. const m_CLONE_FS = 0x00000200
  66. const m_CLONE_IO = 0x80000000
  67. const m_CLONE_NEWCGROUP = 0x02000000
  68. const m_CLONE_NEWIPC = 0x08000000
  69. const m_CLONE_NEWNET = 0x40000000
  70. const m_CLONE_NEWNS = 0x00020000
  71. const m_CLONE_NEWPID = 0x20000000
  72. const m_CLONE_NEWTIME = 0x00000080
  73. const m_CLONE_NEWUSER = 0x10000000
  74. const m_CLONE_NEWUTS = 0x04000000
  75. const m_CLONE_PARENT = 0x00008000
  76. const m_CLONE_PARENT_SETTID = 0x00100000
  77. const m_CLONE_PIDFD = 0x00001000
  78. const m_CLONE_PTRACE = 0x00002000
  79. const m_CLONE_SETTLS = 0x00080000
  80. const m_CLONE_SIGHAND = 0x00000800
  81. const m_CLONE_SYSVSEM = 0x00040000
  82. const m_CLONE_THREAD = 0x00010000
  83. const m_CLONE_UNTRACED = 0x00800000
  84. const m_CLONE_VFORK = 0x00004000
  85. const m_CLONE_VM = 0x00000100
  86. const m_COLL_WEIGHTS_MAX = 2
  87. const m_CPU_SETSIZE = 1024
  88. const m_CSIGNAL = 0x000000ff
  89. const m_DELAYTIMER_MAX = 0x7fffffff
  90. const m_DEV_BSIZE = 512
  91. const m_DN_ACCESS = 0x00000001
  92. const m_DN_ATTRIB = 0x00000020
  93. const m_DN_CREATE = 0x00000004
  94. const m_DN_DELETE = 0x00000008
  95. const m_DN_MODIFY = 0x00000002
  96. const m_DN_MULTISHOT = 0x80000000
  97. const m_DN_RENAME = 0x00000010
  98. const m_EXIT_FAILURE = 1
  99. const m_EXIT_SUCCESS = 0
  100. const m_EXPR_NEST_MAX = 32
  101. const m_FALLOC_FL_KEEP_SIZE = 1
  102. const m_FALLOC_FL_PUNCH_HOLE = 2
  103. const m_FAPPEND = "O_APPEND"
  104. const m_FASYNC = "O_ASYNC"
  105. const m_FD_CLOEXEC = 1
  106. const m_FD_SETSIZE = 1024
  107. const m_FFSYNC = "O_SYNC"
  108. const m_FILENAME_MAX = 4096
  109. const m_FILESIZEBITS = 64
  110. const m_FNDELAY = "O_NDELAY"
  111. const m_FNONBLOCK = "O_NONBLOCK"
  112. const m_FOPEN_MAX = 1000
  113. const m_FPARSELN_UNESCALL = 0x0f
  114. const m_FPARSELN_UNESCCOMM = 0x04
  115. const m_FPARSELN_UNESCCONT = 0x02
  116. const m_FPARSELN_UNESCESC = 0x01
  117. const m_FPARSELN_UNESCREST = 0x08
  118. const m_FPE_FLTDIV = 3
  119. const m_FPE_FLTINV = 7
  120. const m_FPE_FLTOVF = 4
  121. const m_FPE_FLTRES = 6
  122. const m_FPE_FLTSUB = 8
  123. const m_FPE_FLTUND = 5
  124. const m_FPE_INTDIV = 1
  125. const m_FPE_INTOVF = 2
  126. const m_F_ADD_SEALS = 1033
  127. const m_F_CANCELLK = 1029
  128. const m_F_DUPFD = 0
  129. const m_F_DUPFD_CLOEXEC = 1030
  130. const m_F_GETFD = 1
  131. const m_F_GETFL = 3
  132. const m_F_GETLEASE = 1025
  133. const m_F_GETLK = 12
  134. const m_F_GETOWN = 9
  135. const m_F_GETOWNER_UIDS = 17
  136. const m_F_GETOWN_EX = 16
  137. const m_F_GETPIPE_SZ = 1032
  138. const m_F_GETSIG = 11
  139. const m_F_GET_FILE_RW_HINT = 1037
  140. const m_F_GET_RW_HINT = 1035
  141. const m_F_GET_SEALS = 1034
  142. const m_F_LOCK = 1
  143. const m_F_NOTIFY = 1026
  144. const m_F_OFD_GETLK = 36
  145. const m_F_OFD_SETLK = 37
  146. const m_F_OFD_SETLKW = 38
  147. const m_F_OK = 0
  148. const m_F_OWNER_GID = 2
  149. const m_F_OWNER_PGRP = 2
  150. const m_F_OWNER_PID = 1
  151. const m_F_OWNER_TID = 0
  152. const m_F_RDLCK = 0
  153. const m_F_SEAL_FUTURE_WRITE = 0x0010
  154. const m_F_SEAL_GROW = 0x0004
  155. const m_F_SEAL_SEAL = 0x0001
  156. const m_F_SEAL_SHRINK = 0x0002
  157. const m_F_SEAL_WRITE = 0x0008
  158. const m_F_SETFD = 2
  159. const m_F_SETFL = 4
  160. const m_F_SETLEASE = 1024
  161. const m_F_SETLK = 13
  162. const m_F_SETLKW = 14
  163. const m_F_SETOWN = 8
  164. const m_F_SETOWN_EX = 15
  165. const m_F_SETPIPE_SZ = 1031
  166. const m_F_SETSIG = 10
  167. const m_F_SET_FILE_RW_HINT = 1038
  168. const m_F_SET_RW_HINT = 1036
  169. const m_F_TEST = 3
  170. const m_F_TLOCK = 2
  171. const m_F_ULOCK = 0
  172. const m_F_UNLCK = 2
  173. const m_F_WRLCK = 1
  174. const m_HAVE_CLEARENV = 1
  175. const m_HAVE_CONFIG_H = 1
  176. const m_HAVE_DIRENT_H = 1
  177. const m_HAVE_DIRFD = 1
  178. const m_HAVE_DLFCN_H = 1
  179. const m_HAVE_FOPENCOOKIE = 1
  180. const m_HAVE_GETAUXVAL = 1
  181. const m_HAVE_GETENTROPY = 1
  182. const m_HAVE_GETLINE = 1
  183. const m_HAVE_GRP_H = 1
  184. const m_HAVE_INTTYPES_H = 1
  185. const m_HAVE_PROGRAM_INVOCATION_SHORT_NAME = 1
  186. const m_HAVE_PWD_H = 1
  187. const m_HAVE_STDINT_H = 1
  188. const m_HAVE_STDIO_H = 1
  189. const m_HAVE_STDLIB_H = 1
  190. const m_HAVE_STRINGS_H = 1
  191. const m_HAVE_STRING_H = 1
  192. const m_HAVE_SYSCONF = 1
  193. const m_HAVE_SYS_DIR_H = 1
  194. const m_HAVE_SYS_STAT_H = 1
  195. const m_HAVE_SYS_TYPES_H = 1
  196. const m_HAVE_TYPEOF = 1
  197. const m_HAVE_UNISTD_H = 1
  198. const m_HAVE_WCHAR_H = 1
  199. const m_HAVE___FPURGE = 1
  200. const m_HAVE___PROGNAME = 1
  201. const m_HN_AUTOSCALE = 0x20
  202. const m_HN_B = 0x04
  203. const m_HN_DECIMAL = 0x01
  204. const m_HN_DIVISOR_1000 = 0x08
  205. const m_HN_GETSCALE = 0x10
  206. const m_HN_IEC_PREFIXES = 0x10
  207. const m_HN_NOSPACE = 0x02
  208. const m_HOST_NAME_MAX = 255
  209. const m_ILL_BADSTK = 8
  210. const m_ILL_COPROC = 7
  211. const m_ILL_ILLADR = 3
  212. const m_ILL_ILLOPC = 1
  213. const m_ILL_ILLOPN = 2
  214. const m_ILL_ILLTRP = 4
  215. const m_ILL_PRVOPC = 5
  216. const m_ILL_PRVREG = 6
  217. const m_INT16_MAX = 0x7fff
  218. const m_INT32_MAX = 0x7fffffff
  219. const m_INT64_MAX = 0x7fffffffffffffff
  220. const m_INT8_MAX = 0x7f
  221. const m_INTMAX_MAX = "INT64_MAX"
  222. const m_INTMAX_MIN = "INT64_MIN"
  223. const m_INTPTR_MAX = "INT32_MAX"
  224. const m_INTPTR_MIN = "INT32_MIN"
  225. const m_INT_FAST16_MAX = "INT32_MAX"
  226. const m_INT_FAST16_MIN = "INT32_MIN"
  227. const m_INT_FAST32_MAX = "INT32_MAX"
  228. const m_INT_FAST32_MIN = "INT32_MIN"
  229. const m_INT_FAST64_MAX = "INT64_MAX"
  230. const m_INT_FAST64_MIN = "INT64_MIN"
  231. const m_INT_FAST8_MAX = "INT8_MAX"
  232. const m_INT_FAST8_MIN = "INT8_MIN"
  233. const m_INT_LEAST16_MAX = "INT16_MAX"
  234. const m_INT_LEAST16_MIN = "INT16_MIN"
  235. const m_INT_LEAST32_MAX = "INT32_MAX"
  236. const m_INT_LEAST32_MIN = "INT32_MIN"
  237. const m_INT_LEAST64_MAX = "INT64_MAX"
  238. const m_INT_LEAST64_MIN = "INT64_MIN"
  239. const m_INT_LEAST8_MAX = "INT8_MAX"
  240. const m_INT_LEAST8_MIN = "INT8_MIN"
  241. const m_INT_MAX = 0x7fffffff
  242. const m_IOV_MAX = 1024
  243. const m_ITIMER_PROF = 2
  244. const m_ITIMER_REAL = 0
  245. const m_ITIMER_VIRTUAL = 1
  246. const m_IVSZ = 8
  247. const m_KEYSZ = 32
  248. const m_LIBBSD_DISABLE_DEPRECATED = 1
  249. const m_LIBBSD_OVERLAY = 1
  250. const m_LINE_MAX = 4096
  251. const m_LITTLE_ENDIAN = "__LITTLE_ENDIAN"
  252. const m_LLONG_MAX = 0x7fffffffffffffff
  253. const m_LOGIN_NAME_MAX = 256
  254. const m_LONG_BIT = 32
  255. const m_LONG_MAX = "__LONG_MAX"
  256. const m_LT_OBJDIR = ".libs/"
  257. const m_L_INCR = 1
  258. const m_L_SET = 0
  259. const m_L_XTND = 2
  260. const m_L_ctermid = 20
  261. const m_L_cuserid = 20
  262. const m_L_tmpnam = 20
  263. const m_MADV_COLD = 20
  264. const m_MADV_DODUMP = 17
  265. const m_MADV_DOFORK = 11
  266. const m_MADV_DONTDUMP = 16
  267. const m_MADV_DONTFORK = 10
  268. const m_MADV_DONTNEED = 4
  269. const m_MADV_FREE = 8
  270. const m_MADV_HUGEPAGE = 14
  271. const m_MADV_HWPOISON = 100
  272. const m_MADV_KEEPONFORK = 19
  273. const m_MADV_MERGEABLE = 12
  274. const m_MADV_NOHUGEPAGE = 15
  275. const m_MADV_NORMAL = 0
  276. const m_MADV_PAGEOUT = 21
  277. const m_MADV_RANDOM = 1
  278. const m_MADV_REMOVE = 9
  279. const m_MADV_SEQUENTIAL = 2
  280. const m_MADV_SOFT_OFFLINE = 101
  281. const m_MADV_UNMERGEABLE = 13
  282. const m_MADV_WILLNEED = 3
  283. const m_MADV_WIPEONFORK = 18
  284. const m_MAP_ANON = 32
  285. const m_MAP_ANONYMOUS = "MAP_ANON"
  286. const m_MAP_DENYWRITE = 0x0800
  287. const m_MAP_EXECUTABLE = 0x1000
  288. const m_MAP_FILE = 0
  289. const m_MAP_FIXED = 0x10
  290. const m_MAP_FIXED_NOREPLACE = 0x100000
  291. const m_MAP_GROWSDOWN = 0x0100
  292. const m_MAP_HUGETLB = 0x40000
  293. const m_MAP_HUGE_MASK = 0x3f
  294. const m_MAP_HUGE_SHIFT = 26
  295. const m_MAP_LOCKED = 0x2000
  296. const m_MAP_NONBLOCK = 0x10000
  297. const m_MAP_NORESERVE = 0x4000
  298. const m_MAP_POPULATE = 0x8000
  299. const m_MAP_PRIVATE = 2
  300. const m_MAP_SHARED = 0x01
  301. const m_MAP_SHARED_VALIDATE = 0x03
  302. const m_MAP_STACK = 0x20000
  303. const m_MAP_SYNC = 0x80000
  304. const m_MAP_TYPE = 0x0f
  305. const m_MAXHOSTNAMELEN = 64
  306. const m_MAXNAMLEN = 255
  307. const m_MAXPATHLEN = 4096
  308. const m_MAXSYMLINKS = 20
  309. const m_MAX_HANDLE_SZ = 128
  310. const m_MB_LEN_MAX = 4
  311. const m_MCL_CURRENT = 1
  312. const m_MCL_FUTURE = 2
  313. const m_MCL_ONFAULT = 4
  314. const m_MFD_ALLOW_SEALING = 0x0002
  315. const m_MFD_CLOEXEC = 0x0001
  316. const m_MFD_HUGETLB = 0x0004
  317. const m_MINSIGSTKSZ = 2048
  318. const m_MLOCK_ONFAULT = 0x01
  319. const m_MQ_PRIO_MAX = 32768
  320. const m_MREMAP_DONTUNMAP = 4
  321. const m_MREMAP_FIXED = 2
  322. const m_MREMAP_MAYMOVE = 1
  323. const m_MS_ASYNC = 1
  324. const m_MS_INVALIDATE = 2
  325. const m_MS_SYNC = 4
  326. const m_NAME_MAX = 255
  327. const m_NBBY = 8
  328. const m_NCARGS = 131072
  329. const m_NDEBUG = 1
  330. const m_NGROUPS = 32
  331. const m_NGROUPS_MAX = 32
  332. const m_NL_ARGMAX = 9
  333. const m_NL_LANGMAX = 32
  334. const m_NL_MSGMAX = 32767
  335. const m_NL_NMAX = 16
  336. const m_NL_SETMAX = 255
  337. const m_NL_TEXTMAX = 2048
  338. const m_NOFILE = 256
  339. const m_NSIG = "_NSIG"
  340. const m_NZERO = 20
  341. const m_O_APPEND = 02000
  342. const m_O_ASYNC = 020000
  343. const m_O_CLOEXEC = 02000000
  344. const m_O_CREAT = 0100
  345. const m_O_DIRECT = 0200000
  346. const m_O_DIRECTORY = 040000
  347. const m_O_DSYNC = 010000
  348. const m_O_EXCL = 0200
  349. const m_O_EXEC = "O_PATH"
  350. const m_O_LARGEFILE = 0400000
  351. const m_O_NDELAY = "O_NONBLOCK"
  352. const m_O_NOATIME = 01000000
  353. const m_O_NOCTTY = 0400
  354. const m_O_NOFOLLOW = 0100000
  355. const m_O_NONBLOCK = 04000
  356. const m_O_PATH = 010000000
  357. const m_O_RDONLY = 00
  358. const m_O_RDWR = 02
  359. const m_O_RSYNC = 04010000
  360. const m_O_SEARCH = "O_PATH"
  361. const m_O_SYNC = 04010000
  362. const m_O_TMPFILE = 020040000
  363. const m_O_TRUNC = 01000
  364. const m_O_TTY_INIT = 0
  365. const m_O_WRONLY = 01
  366. const m_PACKAGE = "libbsd"
  367. const m_PACKAGE_BUGREPORT = "libbsd@lists.freedesktop.org"
  368. const m_PACKAGE_NAME = "libbsd"
  369. const m_PACKAGE_STRING = "libbsd 0.11.7"
  370. const m_PACKAGE_TARNAME = "libbsd"
  371. const m_PACKAGE_URL = ""
  372. const m_PACKAGE_VERSION = "0.11.7"
  373. const m_PATH_MAX = 4096
  374. const m_PDP_ENDIAN = "__PDP_ENDIAN"
  375. const m_PIC = 1
  376. const m_PIPE_BUF = 4096
  377. const m_POLL_ERR = 4
  378. const m_POLL_HUP = 6
  379. const m_POLL_IN = 1
  380. const m_POLL_MSG = 3
  381. const m_POLL_OUT = 2
  382. const m_POLL_PRI = 5
  383. const m_POSIX_CLOSE_RESTART = 0
  384. const m_POSIX_FADV_DONTNEED = 4
  385. const m_POSIX_FADV_NOREUSE = 5
  386. const m_POSIX_FADV_NORMAL = 0
  387. const m_POSIX_FADV_RANDOM = 1
  388. const m_POSIX_FADV_SEQUENTIAL = 2
  389. const m_POSIX_FADV_WILLNEED = 3
  390. const m_POSIX_MADV_DONTNEED = 4
  391. const m_POSIX_MADV_NORMAL = 0
  392. const m_POSIX_MADV_RANDOM = 1
  393. const m_POSIX_MADV_SEQUENTIAL = 2
  394. const m_POSIX_MADV_WILLNEED = 3
  395. const m_PRIO_MAX = 20
  396. const m_PRIO_PGRP = 1
  397. const m_PRIO_PROCESS = 0
  398. const m_PRIO_USER = 2
  399. const m_PROT_EXEC = 4
  400. const m_PROT_GROWSDOWN = 0x01000000
  401. const m_PROT_GROWSUP = 0x02000000
  402. const m_PROT_NONE = 0
  403. const m_PROT_READ = 1
  404. const m_PROT_WRITE = 2
  405. const m_PTHREAD_CANCEL_ASYNCHRONOUS = 1
  406. const m_PTHREAD_CANCEL_DEFERRED = 0
  407. const m_PTHREAD_CANCEL_DISABLE = 1
  408. const m_PTHREAD_CANCEL_ENABLE = 0
  409. const m_PTHREAD_CANCEL_MASKED = 2
  410. const m_PTHREAD_CREATE_DETACHED = 1
  411. const m_PTHREAD_CREATE_JOINABLE = 0
  412. const m_PTHREAD_DESTRUCTOR_ITERATIONS = 4
  413. const m_PTHREAD_EXPLICIT_SCHED = 1
  414. const m_PTHREAD_INHERIT_SCHED = 0
  415. const m_PTHREAD_KEYS_MAX = 128
  416. const m_PTHREAD_MUTEX_DEFAULT = 0
  417. const m_PTHREAD_MUTEX_ERRORCHECK = 2
  418. const m_PTHREAD_MUTEX_NORMAL = 0
  419. const m_PTHREAD_MUTEX_RECURSIVE = 1
  420. const m_PTHREAD_MUTEX_ROBUST = 1
  421. const m_PTHREAD_MUTEX_STALLED = 0
  422. const m_PTHREAD_ONCE_INIT = 0
  423. const m_PTHREAD_PRIO_INHERIT = 1
  424. const m_PTHREAD_PRIO_NONE = 0
  425. const m_PTHREAD_PRIO_PROTECT = 2
  426. const m_PTHREAD_PROCESS_PRIVATE = 0
  427. const m_PTHREAD_PROCESS_SHARED = 1
  428. const m_PTHREAD_SCOPE_PROCESS = 1
  429. const m_PTHREAD_SCOPE_SYSTEM = 0
  430. const m_PTHREAD_STACK_MIN = 2048
  431. const m_PTRDIFF_MAX = "INT32_MAX"
  432. const m_PTRDIFF_MIN = "INT32_MIN"
  433. const m_P_tmpdir = "/tmp"
  434. const m_RAND_MAX = 0x7fffffff
  435. const m_RE_DUP_MAX = 255
  436. const m_RLIMIT_AS = 9
  437. const m_RLIMIT_CORE = 4
  438. const m_RLIMIT_CPU = 0
  439. const m_RLIMIT_DATA = 2
  440. const m_RLIMIT_FSIZE = 1
  441. const m_RLIMIT_LOCKS = 10
  442. const m_RLIMIT_MEMLOCK = 8
  443. const m_RLIMIT_MSGQUEUE = 12
  444. const m_RLIMIT_NICE = 13
  445. const m_RLIMIT_NLIMITS = 16
  446. const m_RLIMIT_NOFILE = 7
  447. const m_RLIMIT_NPROC = 6
  448. const m_RLIMIT_RSS = 5
  449. const m_RLIMIT_RTPRIO = 14
  450. const m_RLIMIT_RTTIME = 15
  451. const m_RLIMIT_SIGPENDING = 11
  452. const m_RLIMIT_STACK = 3
  453. const m_RLIM_NLIMITS = "RLIMIT_NLIMITS"
  454. const m_RLIM_SAVED_CUR = "RLIM_INFINITY"
  455. const m_RLIM_SAVED_MAX = "RLIM_INFINITY"
  456. const m_RUSAGE_SELF = 0
  457. const m_RUSAGE_THREAD = 1
  458. const m_RWF_WRITE_LIFE_NOT_SET = 0
  459. const m_RWH_WRITE_LIFE_EXTREME = 5
  460. const m_RWH_WRITE_LIFE_LONG = 4
  461. const m_RWH_WRITE_LIFE_MEDIUM = 3
  462. const m_RWH_WRITE_LIFE_NONE = 1
  463. const m_RWH_WRITE_LIFE_SHORT = 2
  464. const m_R_OK = 4
  465. const m_SA_EXPOSE_TAGBITS = 0x00000800
  466. const m_SA_NOCLDSTOP = 1
  467. const m_SA_NOCLDWAIT = 2
  468. const m_SA_NODEFER = 0x40000000
  469. const m_SA_NOMASK = "SA_NODEFER"
  470. const m_SA_ONESHOT = "SA_RESETHAND"
  471. const m_SA_ONSTACK = 0x08000000
  472. const m_SA_RESETHAND = 0x80000000
  473. const m_SA_RESTART = 0x10000000
  474. const m_SA_RESTORER = 0x04000000
  475. const m_SA_SIGINFO = 4
  476. const m_SA_UNSUPPORTED = 0x00000400
  477. const m_SCHAR_MAX = 127
  478. const m_SCHED_BATCH = 3
  479. const m_SCHED_DEADLINE = 6
  480. const m_SCHED_FIFO = 1
  481. const m_SCHED_IDLE = 5
  482. const m_SCHED_OTHER = 0
  483. const m_SCHED_RESET_ON_FORK = 0x40000000
  484. const m_SCHED_RR = 2
  485. const m_SEEK_DATA = 3
  486. const m_SEEK_HOLE = 4
  487. const m_SEGV_ACCERR = 2
  488. const m_SEGV_BNDERR = 3
  489. const m_SEGV_MAPERR = 1
  490. const m_SEGV_MTEAERR = 8
  491. const m_SEGV_MTESERR = 9
  492. const m_SEGV_PKUERR = 4
  493. const m_SEM_NSEMS_MAX = 256
  494. const m_SEM_VALUE_MAX = 0x7fffffff
  495. const m_SHRT_MAX = 0x7fff
  496. const m_SIGABRT = 6
  497. const m_SIGALRM = 14
  498. const m_SIGBUS = 7
  499. const m_SIGCHLD = 17
  500. const m_SIGCONT = 18
  501. const m_SIGEV_NONE = 1
  502. const m_SIGEV_SIGNAL = 0
  503. const m_SIGEV_THREAD = 2
  504. const m_SIGEV_THREAD_ID = 4
  505. const m_SIGFPE = 8
  506. const m_SIGHUP = 1
  507. const m_SIGILL = 4
  508. const m_SIGINT = 2
  509. const m_SIGIO = 29
  510. const m_SIGIOT = "SIGABRT"
  511. const m_SIGKILL = 9
  512. const m_SIGPIPE = 13
  513. const m_SIGPOLL = 29
  514. const m_SIGPROF = 27
  515. const m_SIGPWR = 30
  516. const m_SIGQUIT = 3
  517. const m_SIGSEGV = 11
  518. const m_SIGSTKFLT = 16
  519. const m_SIGSTKSZ = 8192
  520. const m_SIGSTOP = 19
  521. const m_SIGSYS = 31
  522. const m_SIGTERM = 15
  523. const m_SIGTRAP = 5
  524. const m_SIGTSTP = 20
  525. const m_SIGTTIN = 21
  526. const m_SIGTTOU = 22
  527. const m_SIGUNUSED = "SIGSYS"
  528. const m_SIGURG = 23
  529. const m_SIGUSR1 = 10
  530. const m_SIGUSR2 = 12
  531. const m_SIGVTALRM = 26
  532. const m_SIGWINCH = 28
  533. const m_SIGXCPU = 24
  534. const m_SIGXFSZ = 25
  535. const m_SIG_ATOMIC_MAX = "INT32_MAX"
  536. const m_SIG_ATOMIC_MIN = "INT32_MIN"
  537. const m_SIG_BLOCK = 0
  538. const m_SIG_SETMASK = 2
  539. const m_SIG_UNBLOCK = 1
  540. const m_SIZE_MAX = "UINT32_MAX"
  541. const m_SI_KERNEL = 128
  542. const m_SI_USER = 0
  543. const m_SPLICE_F_GIFT = 8
  544. const m_SPLICE_F_MORE = 4
  545. const m_SPLICE_F_MOVE = 1
  546. const m_SPLICE_F_NONBLOCK = 2
  547. const m_SSIZE_MAX = "LONG_MAX"
  548. const m_SS_DISABLE = 2
  549. const m_SS_FLAG_BITS = "SS_AUTODISARM"
  550. const m_SS_ONSTACK = 1
  551. const m_STATX_ALL = 0xfff
  552. const m_STATX_ATIME = 0x20
  553. const m_STATX_BASIC_STATS = 0x7ff
  554. const m_STATX_BLOCKS = 0x400
  555. const m_STATX_BTIME = 0x800
  556. const m_STATX_CTIME = 0x80
  557. const m_STATX_GID = 0x10
  558. const m_STATX_INO = 0x100
  559. const m_STATX_MODE = 2
  560. const m_STATX_MTIME = 0x40
  561. const m_STATX_NLINK = 4
  562. const m_STATX_SIZE = 0x200
  563. const m_STATX_TYPE = 1
  564. const m_STATX_UID = 8
  565. const m_STDC_HEADERS = 1
  566. const m_STDERR_FILENO = 2
  567. const m_STDIN_FILENO = 0
  568. const m_STDOUT_FILENO = 1
  569. const m_SYMLOOP_MAX = 40
  570. const m_SYNC_FILE_RANGE_WAIT_AFTER = 4
  571. const m_SYNC_FILE_RANGE_WAIT_BEFORE = 1
  572. const m_SYNC_FILE_RANGE_WRITE = 2
  573. const m_SYS_SECCOMP = 1
  574. const m_SYS_USER_DISPATCH = 2
  575. const m_S_IEXEC = "S_IXUSR"
  576. const m_S_IFBLK = 0060000
  577. const m_S_IFCHR = 0020000
  578. const m_S_IFDIR = 0040000
  579. const m_S_IFIFO = 0010000
  580. const m_S_IFLNK = 0120000
  581. const m_S_IFMT = 0170000
  582. const m_S_IFREG = 0100000
  583. const m_S_IFSOCK = 0140000
  584. const m_S_IREAD = "S_IRUSR"
  585. const m_S_IRGRP = 0040
  586. const m_S_IROTH = 0004
  587. const m_S_IRUSR = 0400
  588. const m_S_IRWXG = 0070
  589. const m_S_IRWXO = 0007
  590. const m_S_IRWXU = 0700
  591. const m_S_ISGID = 02000
  592. const m_S_ISTXT = "S_ISVTX"
  593. const m_S_ISUID = 04000
  594. const m_S_ISVTX = 01000
  595. const m_S_IWGRP = 0020
  596. const m_S_IWOTH = 0002
  597. const m_S_IWRITE = "S_IWUSR"
  598. const m_S_IWUSR = 0200
  599. const m_S_IXGRP = 0010
  600. const m_S_IXOTH = 0001
  601. const m_S_IXUSR = 0100
  602. const m_TIMER_ABSTIME = 1
  603. const m_TIME_UTC = 1
  604. const m_TMP_MAX = 10000
  605. const m_TRAP_BRANCH = 3
  606. const m_TRAP_BRKPT = 1
  607. const m_TRAP_HWBKPT = 4
  608. const m_TRAP_TRACE = 2
  609. const m_TRAP_UNK = 5
  610. const m_TTY_NAME_MAX = 32
  611. const m_TZNAME_MAX = 6
  612. const m_UCHAR_MAX = 255
  613. const m_UINT16_MAX = 0xffff
  614. const m_UINT32_MAX = "0xffffffffu"
  615. const m_UINT64_MAX = "0xffffffffffffffffu"
  616. const m_UINT8_MAX = 0xff
  617. const m_UINTMAX_MAX = "UINT64_MAX"
  618. const m_UINTPTR_MAX = "UINT32_MAX"
  619. const m_UINT_FAST16_MAX = "UINT32_MAX"
  620. const m_UINT_FAST32_MAX = "UINT32_MAX"
  621. const m_UINT_FAST64_MAX = "UINT64_MAX"
  622. const m_UINT_FAST8_MAX = "UINT8_MAX"
  623. const m_UINT_LEAST16_MAX = "UINT16_MAX"
  624. const m_UINT_LEAST32_MAX = "UINT32_MAX"
  625. const m_UINT_LEAST64_MAX = "UINT64_MAX"
  626. const m_UINT_LEAST8_MAX = "UINT8_MAX"
  627. const m_UINT_MAX = 0xffffffff
  628. const m_USHRT_MAX = 0xffff
  629. const m_UTIME_NOW = 0x3fffffff
  630. const m_UTIME_OMIT = 0x3ffffffe
  631. const m_VERSION = "0.11.7"
  632. const m_WINT_MAX = "UINT32_MAX"
  633. const m_WINT_MIN = 0
  634. const m_WNOHANG = 1
  635. const m_WORD_BIT = 32
  636. const m_WUNTRACED = 2
  637. const m_W_OK = 2
  638. const m_X_OK = 1
  639. const m__ALL_SOURCE = 1
  640. const m__CS_GNU_LIBC_VERSION = 2
  641. const m__CS_GNU_LIBPTHREAD_VERSION = 3
  642. const m__CS_PATH = 0
  643. const m__CS_POSIX_V5_WIDTH_RESTRICTED_ENVS = 4
  644. const m__CS_POSIX_V6_ILP32_OFF32_CFLAGS = 1116
  645. const m__CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 1117
  646. const m__CS_POSIX_V6_ILP32_OFF32_LIBS = 1118
  647. const m__CS_POSIX_V6_ILP32_OFF32_LINTFLAGS = 1119
  648. const m__CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 1120
  649. const m__CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 1121
  650. const m__CS_POSIX_V6_ILP32_OFFBIG_LIBS = 1122
  651. const m__CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS = 1123
  652. const m__CS_POSIX_V6_LP64_OFF64_CFLAGS = 1124
  653. const m__CS_POSIX_V6_LP64_OFF64_LDFLAGS = 1125
  654. const m__CS_POSIX_V6_LP64_OFF64_LIBS = 1126
  655. const m__CS_POSIX_V6_LP64_OFF64_LINTFLAGS = 1127
  656. const m__CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 1128
  657. const m__CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 1129
  658. const m__CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 1130
  659. const m__CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS = 1131
  660. const m__CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 1
  661. const m__CS_POSIX_V7_ILP32_OFF32_CFLAGS = 1132
  662. const m__CS_POSIX_V7_ILP32_OFF32_LDFLAGS = 1133
  663. const m__CS_POSIX_V7_ILP32_OFF32_LIBS = 1134
  664. const m__CS_POSIX_V7_ILP32_OFF32_LINTFLAGS = 1135
  665. const m__CS_POSIX_V7_ILP32_OFFBIG_CFLAGS = 1136
  666. const m__CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS = 1137
  667. const m__CS_POSIX_V7_ILP32_OFFBIG_LIBS = 1138
  668. const m__CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS = 1139
  669. const m__CS_POSIX_V7_LP64_OFF64_CFLAGS = 1140
  670. const m__CS_POSIX_V7_LP64_OFF64_LDFLAGS = 1141
  671. const m__CS_POSIX_V7_LP64_OFF64_LIBS = 1142
  672. const m__CS_POSIX_V7_LP64_OFF64_LINTFLAGS = 1143
  673. const m__CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS = 1144
  674. const m__CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS = 1145
  675. const m__CS_POSIX_V7_LPBIG_OFFBIG_LIBS = 1146
  676. const m__CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS = 1147
  677. const m__CS_POSIX_V7_THREADS_CFLAGS = 1150
  678. const m__CS_POSIX_V7_THREADS_LDFLAGS = 1151
  679. const m__CS_POSIX_V7_WIDTH_RESTRICTED_ENVS = 5
  680. const m__CS_V6_ENV = 1148
  681. const m__CS_V7_ENV = 1149
  682. const m__DARWIN_C_SOURCE = 1
  683. const m__FILE_OFFSET_BITS = 64
  684. const m__GNU_SOURCE = 1
  685. const m__HPUX_ALT_XOPEN_SOCKET_API = 1
  686. const m__IOFBF = 0
  687. const m__IOLBF = 1
  688. const m__IONBF = 2
  689. const m__NETBSD_SOURCE = 1
  690. const m__NSIG = 65
  691. const m__OPENBSD_SOURCE = 1
  692. const m__PC_2_SYMLINKS = 20
  693. const m__PC_ALLOC_SIZE_MIN = 18
  694. const m__PC_ASYNC_IO = 10
  695. const m__PC_CHOWN_RESTRICTED = 6
  696. const m__PC_FILESIZEBITS = 13
  697. const m__PC_LINK_MAX = 0
  698. const m__PC_MAX_CANON = 1
  699. const m__PC_MAX_INPUT = 2
  700. const m__PC_NAME_MAX = 3
  701. const m__PC_NO_TRUNC = 7
  702. const m__PC_PATH_MAX = 4
  703. const m__PC_PIPE_BUF = 5
  704. const m__PC_PRIO_IO = 11
  705. const m__PC_REC_INCR_XFER_SIZE = 14
  706. const m__PC_REC_MAX_XFER_SIZE = 15
  707. const m__PC_REC_MIN_XFER_SIZE = 16
  708. const m__PC_REC_XFER_ALIGN = 17
  709. const m__PC_SOCK_MAXBUF = 12
  710. const m__PC_SYMLINK_MAX = 19
  711. const m__PC_SYNC_IO = 9
  712. const m__PC_VDISABLE = 8
  713. const m__POSIX2_BC_BASE_MAX = 99
  714. const m__POSIX2_BC_DIM_MAX = 2048
  715. const m__POSIX2_BC_SCALE_MAX = 99
  716. const m__POSIX2_BC_STRING_MAX = 1000
  717. const m__POSIX2_CHARCLASS_NAME_MAX = 14
  718. const m__POSIX2_COLL_WEIGHTS_MAX = 2
  719. const m__POSIX2_C_BIND = "_POSIX_VERSION"
  720. const m__POSIX2_EXPR_NEST_MAX = 32
  721. const m__POSIX2_LINE_MAX = 2048
  722. const m__POSIX2_RE_DUP_MAX = 255
  723. const m__POSIX2_VERSION = "_POSIX_VERSION"
  724. const m__POSIX_ADVISORY_INFO = "_POSIX_VERSION"
  725. const m__POSIX_AIO_LISTIO_MAX = 2
  726. const m__POSIX_AIO_MAX = 1
  727. const m__POSIX_ARG_MAX = 4096
  728. const m__POSIX_ASYNCHRONOUS_IO = "_POSIX_VERSION"
  729. const m__POSIX_BARRIERS = "_POSIX_VERSION"
  730. const m__POSIX_CHILD_MAX = 25
  731. const m__POSIX_CHOWN_RESTRICTED = 1
  732. const m__POSIX_CLOCKRES_MIN = 20000000
  733. const m__POSIX_CLOCK_SELECTION = "_POSIX_VERSION"
  734. const m__POSIX_CPUTIME = "_POSIX_VERSION"
  735. const m__POSIX_DELAYTIMER_MAX = 32
  736. const m__POSIX_FSYNC = "_POSIX_VERSION"
  737. const m__POSIX_HOST_NAME_MAX = 255
  738. const m__POSIX_IPV6 = "_POSIX_VERSION"
  739. const m__POSIX_JOB_CONTROL = 1
  740. const m__POSIX_LINK_MAX = 8
  741. const m__POSIX_LOGIN_NAME_MAX = 9
  742. const m__POSIX_MAPPED_FILES = "_POSIX_VERSION"
  743. const m__POSIX_MAX_CANON = 255
  744. const m__POSIX_MAX_INPUT = 255
  745. const m__POSIX_MEMLOCK = "_POSIX_VERSION"
  746. const m__POSIX_MEMLOCK_RANGE = "_POSIX_VERSION"
  747. const m__POSIX_MEMORY_PROTECTION = "_POSIX_VERSION"
  748. const m__POSIX_MESSAGE_PASSING = "_POSIX_VERSION"
  749. const m__POSIX_MONOTONIC_CLOCK = "_POSIX_VERSION"
  750. const m__POSIX_MQ_OPEN_MAX = 8
  751. const m__POSIX_MQ_PRIO_MAX = 32
  752. const m__POSIX_NAME_MAX = 14
  753. const m__POSIX_NGROUPS_MAX = 8
  754. const m__POSIX_NO_TRUNC = 1
  755. const m__POSIX_OPEN_MAX = 20
  756. const m__POSIX_PATH_MAX = 256
  757. const m__POSIX_PIPE_BUF = 512
  758. const m__POSIX_PTHREAD_SEMANTICS = 1
  759. const m__POSIX_RAW_SOCKETS = "_POSIX_VERSION"
  760. const m__POSIX_READER_WRITER_LOCKS = "_POSIX_VERSION"
  761. const m__POSIX_REALTIME_SIGNALS = "_POSIX_VERSION"
  762. const m__POSIX_REGEXP = 1
  763. const m__POSIX_RE_DUP_MAX = 255
  764. const m__POSIX_RTSIG_MAX = 8
  765. const m__POSIX_SAVED_IDS = 1
  766. const m__POSIX_SEMAPHORES = "_POSIX_VERSION"
  767. const m__POSIX_SEM_NSEMS_MAX = 256
  768. const m__POSIX_SEM_VALUE_MAX = 32767
  769. const m__POSIX_SHARED_MEMORY_OBJECTS = "_POSIX_VERSION"
  770. const m__POSIX_SHELL = 1
  771. const m__POSIX_SIGQUEUE_MAX = 32
  772. const m__POSIX_SPAWN = "_POSIX_VERSION"
  773. const m__POSIX_SPIN_LOCKS = "_POSIX_VERSION"
  774. const m__POSIX_SSIZE_MAX = 32767
  775. const m__POSIX_SS_REPL_MAX = 4
  776. const m__POSIX_STREAM_MAX = 8
  777. const m__POSIX_SYMLINK_MAX = 255
  778. const m__POSIX_SYMLOOP_MAX = 8
  779. const m__POSIX_THREADS = "_POSIX_VERSION"
  780. const m__POSIX_THREAD_ATTR_STACKADDR = "_POSIX_VERSION"
  781. const m__POSIX_THREAD_ATTR_STACKSIZE = "_POSIX_VERSION"
  782. const m__POSIX_THREAD_CPUTIME = "_POSIX_VERSION"
  783. const m__POSIX_THREAD_DESTRUCTOR_ITERATIONS = 4
  784. const m__POSIX_THREAD_KEYS_MAX = 128
  785. const m__POSIX_THREAD_PRIORITY_SCHEDULING = "_POSIX_VERSION"
  786. const m__POSIX_THREAD_PROCESS_SHARED = "_POSIX_VERSION"
  787. const m__POSIX_THREAD_SAFE_FUNCTIONS = "_POSIX_VERSION"
  788. const m__POSIX_THREAD_THREADS_MAX = 64
  789. const m__POSIX_TIMEOUTS = "_POSIX_VERSION"
  790. const m__POSIX_TIMERS = "_POSIX_VERSION"
  791. const m__POSIX_TIMER_MAX = 32
  792. const m__POSIX_TRACE_EVENT_NAME_MAX = 30
  793. const m__POSIX_TRACE_NAME_MAX = 8
  794. const m__POSIX_TRACE_SYS_MAX = 8
  795. const m__POSIX_TRACE_USER_EVENT_MAX = 32
  796. const m__POSIX_TTY_NAME_MAX = 9
  797. const m__POSIX_TZNAME_MAX = 6
  798. const m__POSIX_V6_ILP32_OFFBIG = 1
  799. const m__POSIX_V7_ILP32_OFFBIG = 1
  800. const m__POSIX_VDISABLE = 0
  801. const m__POSIX_VERSION = 200809
  802. const m__REDIR_TIME64 = 1
  803. const m__SC_2_CHAR_TERM = 95
  804. const m__SC_2_C_BIND = 47
  805. const m__SC_2_C_DEV = 48
  806. const m__SC_2_FORT_DEV = 49
  807. const m__SC_2_FORT_RUN = 50
  808. const m__SC_2_LOCALEDEF = 52
  809. const m__SC_2_PBS = 168
  810. const m__SC_2_PBS_ACCOUNTING = 169
  811. const m__SC_2_PBS_CHECKPOINT = 175
  812. const m__SC_2_PBS_LOCATE = 170
  813. const m__SC_2_PBS_MESSAGE = 171
  814. const m__SC_2_PBS_TRACK = 172
  815. const m__SC_2_SW_DEV = 51
  816. const m__SC_2_UPE = 97
  817. const m__SC_2_VERSION = 46
  818. const m__SC_ADVISORY_INFO = 132
  819. const m__SC_AIO_LISTIO_MAX = 23
  820. const m__SC_AIO_MAX = 24
  821. const m__SC_AIO_PRIO_DELTA_MAX = 25
  822. const m__SC_ARG_MAX = 0
  823. const m__SC_ASYNCHRONOUS_IO = 12
  824. const m__SC_ATEXIT_MAX = 87
  825. const m__SC_AVPHYS_PAGES = 86
  826. const m__SC_BARRIERS = 133
  827. const m__SC_BC_BASE_MAX = 36
  828. const m__SC_BC_DIM_MAX = 37
  829. const m__SC_BC_SCALE_MAX = 38
  830. const m__SC_BC_STRING_MAX = 39
  831. const m__SC_CHILD_MAX = 1
  832. const m__SC_CLK_TCK = 2
  833. const m__SC_CLOCK_SELECTION = 137
  834. const m__SC_COLL_WEIGHTS_MAX = 40
  835. const m__SC_CPUTIME = 138
  836. const m__SC_DELAYTIMER_MAX = 26
  837. const m__SC_EXPR_NEST_MAX = 42
  838. const m__SC_FSYNC = 15
  839. const m__SC_GETGR_R_SIZE_MAX = 69
  840. const m__SC_GETPW_R_SIZE_MAX = 70
  841. const m__SC_HOST_NAME_MAX = 180
  842. const m__SC_IOV_MAX = 60
  843. const m__SC_IPV6 = 235
  844. const m__SC_JOB_CONTROL = 7
  845. const m__SC_LINE_MAX = 43
  846. const m__SC_LOGIN_NAME_MAX = 71
  847. const m__SC_MAPPED_FILES = 16
  848. const m__SC_MEMLOCK = 17
  849. const m__SC_MEMLOCK_RANGE = 18
  850. const m__SC_MEMORY_PROTECTION = 19
  851. const m__SC_MESSAGE_PASSING = 20
  852. const m__SC_MINSIGSTKSZ = 249
  853. const m__SC_MONOTONIC_CLOCK = 149
  854. const m__SC_MQ_OPEN_MAX = 27
  855. const m__SC_MQ_PRIO_MAX = 28
  856. const m__SC_NGROUPS_MAX = 3
  857. const m__SC_NPROCESSORS_CONF = 83
  858. const m__SC_NPROCESSORS_ONLN = 84
  859. const m__SC_NZERO = 109
  860. const m__SC_OPEN_MAX = 4
  861. const m__SC_PAGESIZE = 30
  862. const m__SC_PAGE_SIZE = 30
  863. const m__SC_PASS_MAX = 88
  864. const m__SC_PHYS_PAGES = 85
  865. const m__SC_PRIORITIZED_IO = 13
  866. const m__SC_PRIORITY_SCHEDULING = 10
  867. const m__SC_RAW_SOCKETS = 236
  868. const m__SC_READER_WRITER_LOCKS = 153
  869. const m__SC_REALTIME_SIGNALS = 9
  870. const m__SC_REGEXP = 155
  871. const m__SC_RE_DUP_MAX = 44
  872. const m__SC_RTSIG_MAX = 31
  873. const m__SC_SAVED_IDS = 8
  874. const m__SC_SEMAPHORES = 21
  875. const m__SC_SEM_NSEMS_MAX = 32
  876. const m__SC_SEM_VALUE_MAX = 33
  877. const m__SC_SHARED_MEMORY_OBJECTS = 22
  878. const m__SC_SHELL = 157
  879. const m__SC_SIGQUEUE_MAX = 34
  880. const m__SC_SIGSTKSZ = 250
  881. const m__SC_SPAWN = 159
  882. const m__SC_SPIN_LOCKS = 154
  883. const m__SC_SPORADIC_SERVER = 160
  884. const m__SC_SS_REPL_MAX = 241
  885. const m__SC_STREAMS = 174
  886. const m__SC_STREAM_MAX = 5
  887. const m__SC_SYMLOOP_MAX = 173
  888. const m__SC_SYNCHRONIZED_IO = 14
  889. const m__SC_THREADS = 67
  890. const m__SC_THREAD_ATTR_STACKADDR = 77
  891. const m__SC_THREAD_ATTR_STACKSIZE = 78
  892. const m__SC_THREAD_CPUTIME = 139
  893. const m__SC_THREAD_DESTRUCTOR_ITERATIONS = 73
  894. const m__SC_THREAD_KEYS_MAX = 74
  895. const m__SC_THREAD_PRIORITY_SCHEDULING = 79
  896. const m__SC_THREAD_PRIO_INHERIT = 80
  897. const m__SC_THREAD_PRIO_PROTECT = 81
  898. const m__SC_THREAD_PROCESS_SHARED = 82
  899. const m__SC_THREAD_ROBUST_PRIO_INHERIT = 247
  900. const m__SC_THREAD_ROBUST_PRIO_PROTECT = 248
  901. const m__SC_THREAD_SAFE_FUNCTIONS = 68
  902. const m__SC_THREAD_SPORADIC_SERVER = 161
  903. const m__SC_THREAD_STACK_MIN = 75
  904. const m__SC_THREAD_THREADS_MAX = 76
  905. const m__SC_TIMEOUTS = 164
  906. const m__SC_TIMERS = 11
  907. const m__SC_TIMER_MAX = 35
  908. const m__SC_TRACE = 181
  909. const m__SC_TRACE_EVENT_FILTER = 182
  910. const m__SC_TRACE_EVENT_NAME_MAX = 242
  911. const m__SC_TRACE_INHERIT = 183
  912. const m__SC_TRACE_LOG = 184
  913. const m__SC_TRACE_NAME_MAX = 243
  914. const m__SC_TRACE_SYS_MAX = 244
  915. const m__SC_TRACE_USER_EVENT_MAX = 245
  916. const m__SC_TTY_NAME_MAX = 72
  917. const m__SC_TYPED_MEMORY_OBJECTS = 165
  918. const m__SC_TZNAME_MAX = 6
  919. const m__SC_UIO_MAXIOV = 60
  920. const m__SC_V6_ILP32_OFF32 = 176
  921. const m__SC_V6_ILP32_OFFBIG = 177
  922. const m__SC_V6_LP64_OFF64 = 178
  923. const m__SC_V6_LPBIG_OFFBIG = 179
  924. const m__SC_V7_ILP32_OFF32 = 237
  925. const m__SC_V7_ILP32_OFFBIG = 238
  926. const m__SC_V7_LP64_OFF64 = 239
  927. const m__SC_V7_LPBIG_OFFBIG = 240
  928. const m__SC_VERSION = 29
  929. const m__SC_XBS5_ILP32_OFF32 = 125
  930. const m__SC_XBS5_ILP32_OFFBIG = 126
  931. const m__SC_XBS5_LP64_OFF64 = 127
  932. const m__SC_XBS5_LPBIG_OFFBIG = 128
  933. const m__SC_XOPEN_CRYPT = 92
  934. const m__SC_XOPEN_ENH_I18N = 93
  935. const m__SC_XOPEN_LEGACY = 129
  936. const m__SC_XOPEN_REALTIME = 130
  937. const m__SC_XOPEN_REALTIME_THREADS = 131
  938. const m__SC_XOPEN_SHM = 94
  939. const m__SC_XOPEN_STREAMS = 246
  940. const m__SC_XOPEN_UNIX = 91
  941. const m__SC_XOPEN_VERSION = 89
  942. const m__SC_XOPEN_XCU_VERSION = 90
  943. const m__SC_XOPEN_XPG2 = 98
  944. const m__SC_XOPEN_XPG3 = 99
  945. const m__SC_XOPEN_XPG4 = 100
  946. const m__STDC_PREDEF_H = 1
  947. const m__SYS_CDEFS_H = 1
  948. const m__TANDEM_SOURCE = 1
  949. const m__XOPEN_ENH_I18N = 1
  950. const m__XOPEN_IOV_MAX = 16
  951. const m__XOPEN_NAME_MAX = 255
  952. const m__XOPEN_PATH_MAX = 1024
  953. const m__XOPEN_UNIX = 1
  954. const m__XOPEN_VERSION = 700
  955. const m___ACCUM_EPSILON__ = "0x1P-15K"
  956. const m___ACCUM_FBIT__ = 15
  957. const m___ACCUM_IBIT__ = 16
  958. const m___ACCUM_MAX__ = "0X7FFFFFFFP-15K"
  959. const m___APCS_32__ = 1
  960. const m___ARMEL__ = 1
  961. const m___ARM_32BIT_STATE = 1
  962. const m___ARM_ARCH = 6
  963. const m___ARM_ARCH_6__ = 1
  964. const m___ARM_ARCH_ISA_ARM = 1
  965. const m___ARM_ARCH_ISA_THUMB = 1
  966. const m___ARM_EABI__ = 1
  967. const m___ARM_FEATURE_CLZ = 1
  968. const m___ARM_FEATURE_COPROC = 15
  969. const m___ARM_FEATURE_DSP = 1
  970. const m___ARM_FEATURE_LDREX = 4
  971. const m___ARM_FEATURE_QBIT = 1
  972. const m___ARM_FEATURE_SAT = 1
  973. const m___ARM_FEATURE_SIMD32 = 1
  974. const m___ARM_FEATURE_UNALIGNED = 1
  975. const m___ARM_FP = 12
  976. const m___ARM_PCS_VFP = 1
  977. const m___ARM_SIZEOF_MINIMAL_ENUM = 4
  978. const m___ARM_SIZEOF_WCHAR_T = 4
  979. const m___ATOMIC_ACQUIRE = 2
  980. const m___ATOMIC_ACQ_REL = 4
  981. const m___ATOMIC_CONSUME = 1
  982. const m___ATOMIC_RELAXED = 0
  983. const m___ATOMIC_RELEASE = 3
  984. const m___ATOMIC_SEQ_CST = 5
  985. const m___BIGGEST_ALIGNMENT__ = 8
  986. const m___BIG_ENDIAN = 4321
  987. const m___BYTE_ORDER = 1234
  988. const m___BYTE_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  989. const m___CCGO__ = 1
  990. const m___CHAR_BIT__ = 8
  991. const m___CHAR_UNSIGNED__ = 1
  992. const m___DA_FBIT__ = 31
  993. const m___DA_IBIT__ = 32
  994. const m___DBL_DECIMAL_DIG__ = 17
  995. const m___DBL_DIG__ = 15
  996. const m___DBL_HAS_DENORM__ = 1
  997. const m___DBL_HAS_INFINITY__ = 1
  998. const m___DBL_HAS_QUIET_NAN__ = 1
  999. const m___DBL_IS_IEC_60559__ = 2
  1000. const m___DBL_MANT_DIG__ = 53
  1001. const m___DBL_MAX_10_EXP__ = 308
  1002. const m___DBL_MAX_EXP__ = 1024
  1003. const m___DECIMAL_DIG__ = 17
  1004. const m___DEC_EVAL_METHOD__ = 2
  1005. const m___DQ_FBIT__ = 63
  1006. const m___DQ_IBIT__ = 0
  1007. const m___ELF__ = 1
  1008. const m___EXTENSIONS__ = 1
  1009. const m___FINITE_MATH_ONLY__ = 0
  1010. const m___FLOAT_WORD_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  1011. const m___FLT32X_DECIMAL_DIG__ = 17
  1012. const m___FLT32X_DENORM_MIN__ = 4.9406564584124654e-324
  1013. const m___FLT32X_DIG__ = 15
  1014. const m___FLT32X_EPSILON__ = 2.2204460492503131e-16
  1015. const m___FLT32X_HAS_DENORM__ = 1
  1016. const m___FLT32X_HAS_INFINITY__ = 1
  1017. const m___FLT32X_HAS_QUIET_NAN__ = 1
  1018. const m___FLT32X_IS_IEC_60559__ = 2
  1019. const m___FLT32X_MANT_DIG__ = 53
  1020. const m___FLT32X_MAX_10_EXP__ = 308
  1021. const m___FLT32X_MAX_EXP__ = 1024
  1022. const m___FLT32X_MAX__ = 1.7976931348623157e+308
  1023. const m___FLT32X_MIN__ = 2.2250738585072014e-308
  1024. const m___FLT32X_NORM_MAX__ = 1.7976931348623157e+308
  1025. const m___FLT32_DECIMAL_DIG__ = 9
  1026. const m___FLT32_DENORM_MIN__ = 1.4012984643248171e-45
  1027. const m___FLT32_DIG__ = 6
  1028. const m___FLT32_EPSILON__ = 1.1920928955078125e-7
  1029. const m___FLT32_HAS_DENORM__ = 1
  1030. const m___FLT32_HAS_INFINITY__ = 1
  1031. const m___FLT32_HAS_QUIET_NAN__ = 1
  1032. const m___FLT32_IS_IEC_60559__ = 2
  1033. const m___FLT32_MANT_DIG__ = 24
  1034. const m___FLT32_MAX_10_EXP__ = 38
  1035. const m___FLT32_MAX_EXP__ = 128
  1036. const m___FLT32_MAX__ = 3.4028234663852886e+38
  1037. const m___FLT32_MIN__ = 1.1754943508222875e-38
  1038. const m___FLT32_NORM_MAX__ = 3.4028234663852886e+38
  1039. const m___FLT64_DECIMAL_DIG__ = 17
  1040. const m___FLT64_DENORM_MIN__ = 4.9406564584124654e-324
  1041. const m___FLT64_DIG__ = 15
  1042. const m___FLT64_EPSILON__ = 2.2204460492503131e-16
  1043. const m___FLT64_HAS_DENORM__ = 1
  1044. const m___FLT64_HAS_INFINITY__ = 1
  1045. const m___FLT64_HAS_QUIET_NAN__ = 1
  1046. const m___FLT64_IS_IEC_60559__ = 2
  1047. const m___FLT64_MANT_DIG__ = 53
  1048. const m___FLT64_MAX_10_EXP__ = 308
  1049. const m___FLT64_MAX_EXP__ = 1024
  1050. const m___FLT64_MAX__ = 1.7976931348623157e+308
  1051. const m___FLT64_MIN__ = 2.2250738585072014e-308
  1052. const m___FLT64_NORM_MAX__ = 1.7976931348623157e+308
  1053. const m___FLT_DECIMAL_DIG__ = 9
  1054. const m___FLT_DENORM_MIN__ = 1.4012984643248171e-45
  1055. const m___FLT_DIG__ = 6
  1056. const m___FLT_EPSILON__ = 1.1920928955078125e-7
  1057. const m___FLT_EVAL_METHOD_TS_18661_3__ = 0
  1058. const m___FLT_EVAL_METHOD__ = 0
  1059. const m___FLT_HAS_DENORM__ = 1
  1060. const m___FLT_HAS_INFINITY__ = 1
  1061. const m___FLT_HAS_QUIET_NAN__ = 1
  1062. const m___FLT_IS_IEC_60559__ = 2
  1063. const m___FLT_MANT_DIG__ = 24
  1064. const m___FLT_MAX_10_EXP__ = 38
  1065. const m___FLT_MAX_EXP__ = 128
  1066. const m___FLT_MAX__ = 3.4028234663852886e+38
  1067. const m___FLT_MIN__ = 1.1754943508222875e-38
  1068. const m___FLT_NORM_MAX__ = 3.4028234663852886e+38
  1069. const m___FLT_RADIX__ = 2
  1070. const m___FRACT_EPSILON__ = "0x1P-15R"
  1071. const m___FRACT_FBIT__ = 15
  1072. const m___FRACT_IBIT__ = 0
  1073. const m___FRACT_MAX__ = "0X7FFFP-15R"
  1074. const m___FUNCTION__ = "__func__"
  1075. const m___GCC_ASM_FLAG_OUTPUTS__ = 1
  1076. const m___GCC_ATOMIC_BOOL_LOCK_FREE = 1
  1077. const m___GCC_ATOMIC_CHAR16_T_LOCK_FREE = 1
  1078. const m___GCC_ATOMIC_CHAR32_T_LOCK_FREE = 2
  1079. const m___GCC_ATOMIC_CHAR_LOCK_FREE = 1
  1080. const m___GCC_ATOMIC_INT_LOCK_FREE = 2
  1081. const m___GCC_ATOMIC_LLONG_LOCK_FREE = 1
  1082. const m___GCC_ATOMIC_LONG_LOCK_FREE = 2
  1083. const m___GCC_ATOMIC_POINTER_LOCK_FREE = 2
  1084. const m___GCC_ATOMIC_SHORT_LOCK_FREE = 1
  1085. const m___GCC_ATOMIC_TEST_AND_SET_TRUEVAL = 1
  1086. const m___GCC_ATOMIC_WCHAR_T_LOCK_FREE = 2
  1087. const m___GCC_CONSTRUCTIVE_SIZE = 64
  1088. const m___GCC_DESTRUCTIVE_SIZE = 64
  1089. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 = 1
  1090. const m___GCC_IEC_559 = 2
  1091. const m___GCC_IEC_559_COMPLEX = 2
  1092. const m___GNUC_EXECUTION_CHARSET_NAME = "UTF-8"
  1093. const m___GNUC_MINOR__ = 2
  1094. const m___GNUC_PATCHLEVEL__ = 0
  1095. const m___GNUC_STDC_INLINE__ = 1
  1096. const m___GNUC_WIDE_EXECUTION_CHARSET_NAME = "UTF-32LE"
  1097. const m___GNUC__ = 12
  1098. const m___GXX_ABI_VERSION = 1017
  1099. const m___GXX_TYPEINFO_EQUALITY_INLINE = 0
  1100. const m___HAVE_GENERIC_SELECTION = 0
  1101. const m___HAVE_SPECULATION_SAFE_VALUE = 1
  1102. const m___HA_FBIT__ = 7
  1103. const m___HA_IBIT__ = 8
  1104. const m___HQ_FBIT__ = 15
  1105. const m___HQ_IBIT__ = 0
  1106. const m___INT16_MAX__ = 0x7fff
  1107. const m___INT32_MAX__ = 0x7fffffff
  1108. const m___INT32_TYPE__ = "int"
  1109. const m___INT64_MAX__ = 0x7fffffffffffffff
  1110. const m___INT8_MAX__ = 0x7f
  1111. const m___INTMAX_MAX__ = 0x7fffffffffffffff
  1112. const m___INTMAX_WIDTH__ = 64
  1113. const m___INTPTR_MAX__ = 0x7fffffff
  1114. const m___INTPTR_TYPE__ = "int"
  1115. const m___INTPTR_WIDTH__ = 32
  1116. const m___INT_FAST16_MAX__ = 0x7fffffff
  1117. const m___INT_FAST16_TYPE__ = "int"
  1118. const m___INT_FAST16_WIDTH__ = 32
  1119. const m___INT_FAST32_MAX__ = 0x7fffffff
  1120. const m___INT_FAST32_TYPE__ = "int"
  1121. const m___INT_FAST32_WIDTH__ = 32
  1122. const m___INT_FAST64_MAX__ = 0x7fffffffffffffff
  1123. const m___INT_FAST64_WIDTH__ = 64
  1124. const m___INT_FAST8_MAX__ = 0x7f
  1125. const m___INT_FAST8_WIDTH__ = 8
  1126. const m___INT_LEAST16_MAX__ = 0x7fff
  1127. const m___INT_LEAST16_WIDTH__ = 16
  1128. const m___INT_LEAST32_MAX__ = 0x7fffffff
  1129. const m___INT_LEAST32_TYPE__ = "int"
  1130. const m___INT_LEAST32_WIDTH__ = 32
  1131. const m___INT_LEAST64_MAX__ = 0x7fffffffffffffff
  1132. const m___INT_LEAST64_WIDTH__ = 64
  1133. const m___INT_LEAST8_MAX__ = 0x7f
  1134. const m___INT_LEAST8_WIDTH__ = 8
  1135. const m___INT_MAX__ = 0x7fffffff
  1136. const m___INT_WIDTH__ = 32
  1137. const m___LACCUM_EPSILON__ = "0x1P-31LK"
  1138. const m___LACCUM_FBIT__ = 31
  1139. const m___LACCUM_IBIT__ = 32
  1140. const m___LACCUM_MAX__ = "0X7FFFFFFFFFFFFFFFP-31LK"
  1141. const m___LDBL_DECIMAL_DIG__ = 17
  1142. const m___LDBL_DENORM_MIN__ = 4.9406564584124654e-324
  1143. const m___LDBL_DIG__ = 15
  1144. const m___LDBL_EPSILON__ = 2.2204460492503131e-16
  1145. const m___LDBL_HAS_DENORM__ = 1
  1146. const m___LDBL_HAS_INFINITY__ = 1
  1147. const m___LDBL_HAS_QUIET_NAN__ = 1
  1148. const m___LDBL_IS_IEC_60559__ = 2
  1149. const m___LDBL_MANT_DIG__ = 53
  1150. const m___LDBL_MAX_10_EXP__ = 308
  1151. const m___LDBL_MAX_EXP__ = 1024
  1152. const m___LDBL_MAX__ = 1.7976931348623157e+308
  1153. const m___LDBL_MIN__ = 2.2250738585072014e-308
  1154. const m___LDBL_NORM_MAX__ = 1.7976931348623157e+308
  1155. const m___LDOUBLE_REDIRECTS_TO_FLOAT128_ABI = 0
  1156. const m___LFRACT_EPSILON__ = "0x1P-31LR"
  1157. const m___LFRACT_FBIT__ = 31
  1158. const m___LFRACT_IBIT__ = 0
  1159. const m___LFRACT_MAX__ = "0X7FFFFFFFP-31LR"
  1160. const m___LITTLE_ENDIAN = 1234
  1161. const m___LLACCUM_EPSILON__ = "0x1P-31LLK"
  1162. const m___LLACCUM_FBIT__ = 31
  1163. const m___LLACCUM_IBIT__ = 32
  1164. const m___LLACCUM_MAX__ = "0X7FFFFFFFFFFFFFFFP-31LLK"
  1165. const m___LLFRACT_EPSILON__ = "0x1P-63LLR"
  1166. const m___LLFRACT_FBIT__ = 63
  1167. const m___LLFRACT_IBIT__ = 0
  1168. const m___LLFRACT_MAX__ = "0X7FFFFFFFFFFFFFFFP-63LLR"
  1169. const m___LONG_LONG_MAX__ = 0x7fffffffffffffff
  1170. const m___LONG_LONG_WIDTH__ = 64
  1171. const m___LONG_MAX = 0x7fffffff
  1172. const m___LONG_MAX__ = 0x7fffffff
  1173. const m___LONG_WIDTH__ = 32
  1174. const m___NO_INLINE__ = 1
  1175. const m___NO_LONG_DOUBLE_MATH = 1
  1176. const m___ORDER_BIG_ENDIAN__ = 4321
  1177. const m___ORDER_LITTLE_ENDIAN__ = 1234
  1178. const m___ORDER_PDP_ENDIAN__ = 3412
  1179. const m___PDP_ENDIAN = 3412
  1180. const m___PRAGMA_REDEFINE_EXTNAME = 1
  1181. const m___PRETTY_FUNCTION__ = "__func__"
  1182. const m___PTRDIFF_MAX__ = 0x7fffffff
  1183. const m___PTRDIFF_TYPE__ = "int"
  1184. const m___PTRDIFF_WIDTH__ = 32
  1185. const m___QQ_FBIT__ = 7
  1186. const m___QQ_IBIT__ = 0
  1187. const m___REENTRANT = 1
  1188. const m___SACCUM_EPSILON__ = "0x1P-7HK"
  1189. const m___SACCUM_FBIT__ = 7
  1190. const m___SACCUM_IBIT__ = 8
  1191. const m___SACCUM_MAX__ = "0X7FFFP-7HK"
  1192. const m___SA_FBIT__ = 15
  1193. const m___SA_IBIT__ = 16
  1194. const m___SCHAR_MAX__ = 0x7f
  1195. const m___SCHAR_WIDTH__ = 8
  1196. const m___SFRACT_EPSILON__ = "0x1P-7HR"
  1197. const m___SFRACT_FBIT__ = 7
  1198. const m___SFRACT_IBIT__ = 0
  1199. const m___SFRACT_MAX__ = "0X7FP-7HR"
  1200. const m___SHRT_MAX__ = 0x7fff
  1201. const m___SHRT_WIDTH__ = 16
  1202. const m___SIG_ATOMIC_MAX__ = 0x7fffffff
  1203. const m___SIG_ATOMIC_TYPE__ = "int"
  1204. const m___SIG_ATOMIC_WIDTH__ = 32
  1205. const m___SIZEOF_DOUBLE__ = 8
  1206. const m___SIZEOF_FLOAT__ = 4
  1207. const m___SIZEOF_INT__ = 4
  1208. const m___SIZEOF_LONG_DOUBLE__ = 8
  1209. const m___SIZEOF_LONG_LONG__ = 8
  1210. const m___SIZEOF_LONG__ = 4
  1211. const m___SIZEOF_POINTER__ = 4
  1212. const m___SIZEOF_PTRDIFF_T__ = 4
  1213. const m___SIZEOF_SHORT__ = 2
  1214. const m___SIZEOF_SIZE_T__ = 4
  1215. const m___SIZEOF_WCHAR_T__ = 4
  1216. const m___SIZEOF_WINT_T__ = 4
  1217. const m___SIZE_MAX__ = 0xffffffff
  1218. const m___SIZE_WIDTH__ = 32
  1219. const m___SQ_FBIT__ = 31
  1220. const m___SQ_IBIT__ = 0
  1221. const m___STDC_HOSTED__ = 1
  1222. const m___STDC_IEC_559_COMPLEX__ = 1
  1223. const m___STDC_IEC_559__ = 1
  1224. const m___STDC_IEC_60559_BFP__ = 201404
  1225. const m___STDC_IEC_60559_COMPLEX__ = 201404
  1226. const m___STDC_ISO_10646__ = 201706
  1227. const m___STDC_UTF_16__ = 1
  1228. const m___STDC_UTF_32__ = 1
  1229. const m___STDC_VERSION__ = 201710
  1230. const m___STDC_WANT_IEC_60559_ATTRIBS_EXT__ = 1
  1231. const m___STDC_WANT_IEC_60559_BFP_EXT__ = 1
  1232. const m___STDC_WANT_IEC_60559_DFP_EXT__ = 1
  1233. const m___STDC_WANT_IEC_60559_FUNCS_EXT__ = 1
  1234. const m___STDC_WANT_IEC_60559_TYPES_EXT__ = 1
  1235. const m___STDC_WANT_LIB_EXT2__ = 1
  1236. const m___STDC_WANT_MATH_SPEC_FUNCS__ = 1
  1237. const m___STDC__ = 1
  1238. const m___TA_FBIT__ = 63
  1239. const m___TA_IBIT__ = 64
  1240. const m___THUMB_INTERWORK__ = 1
  1241. const m___TQ_FBIT__ = 127
  1242. const m___TQ_IBIT__ = 0
  1243. const m___UACCUM_EPSILON__ = "0x1P-16UK"
  1244. const m___UACCUM_FBIT__ = 16
  1245. const m___UACCUM_IBIT__ = 16
  1246. const m___UACCUM_MAX__ = "0XFFFFFFFFP-16UK"
  1247. const m___UACCUM_MIN__ = "0.0UK"
  1248. const m___UDA_FBIT__ = 32
  1249. const m___UDA_IBIT__ = 32
  1250. const m___UDQ_FBIT__ = 64
  1251. const m___UDQ_IBIT__ = 0
  1252. const m___UFRACT_EPSILON__ = "0x1P-16UR"
  1253. const m___UFRACT_FBIT__ = 16
  1254. const m___UFRACT_IBIT__ = 0
  1255. const m___UFRACT_MAX__ = "0XFFFFP-16UR"
  1256. const m___UFRACT_MIN__ = "0.0UR"
  1257. const m___UHA_FBIT__ = 8
  1258. const m___UHA_IBIT__ = 8
  1259. const m___UHQ_FBIT__ = 16
  1260. const m___UHQ_IBIT__ = 0
  1261. const m___UINT16_MAX__ = 0xffff
  1262. const m___UINT32_MAX__ = 0xffffffff
  1263. const m___UINT64_MAX__ = "0xffffffffffffffffU"
  1264. const m___UINT8_MAX__ = 0xff
  1265. const m___UINTMAX_MAX__ = "0xffffffffffffffffU"
  1266. const m___UINTPTR_MAX__ = 0xffffffff
  1267. const m___UINT_FAST16_MAX__ = 0xffffffff
  1268. const m___UINT_FAST32_MAX__ = 0xffffffff
  1269. const m___UINT_FAST64_MAX__ = "0xffffffffffffffffU"
  1270. const m___UINT_FAST8_MAX__ = 0xff
  1271. const m___UINT_LEAST16_MAX__ = 0xffff
  1272. const m___UINT_LEAST32_MAX__ = 0xffffffff
  1273. const m___UINT_LEAST64_MAX__ = "0xffffffffffffffffU"
  1274. const m___UINT_LEAST8_MAX__ = 0xff
  1275. const m___ULACCUM_EPSILON__ = "0x1P-32ULK"
  1276. const m___ULACCUM_FBIT__ = 32
  1277. const m___ULACCUM_IBIT__ = 32
  1278. const m___ULACCUM_MAX__ = "0XFFFFFFFFFFFFFFFFP-32ULK"
  1279. const m___ULACCUM_MIN__ = "0.0ULK"
  1280. const m___ULFRACT_EPSILON__ = "0x1P-32ULR"
  1281. const m___ULFRACT_FBIT__ = 32
  1282. const m___ULFRACT_IBIT__ = 0
  1283. const m___ULFRACT_MAX__ = "0XFFFFFFFFP-32ULR"
  1284. const m___ULFRACT_MIN__ = "0.0ULR"
  1285. const m___ULLACCUM_EPSILON__ = "0x1P-32ULLK"
  1286. const m___ULLACCUM_FBIT__ = 32
  1287. const m___ULLACCUM_IBIT__ = 32
  1288. const m___ULLACCUM_MAX__ = "0XFFFFFFFFFFFFFFFFP-32ULLK"
  1289. const m___ULLACCUM_MIN__ = "0.0ULLK"
  1290. const m___ULLFRACT_EPSILON__ = "0x1P-64ULLR"
  1291. const m___ULLFRACT_FBIT__ = 64
  1292. const m___ULLFRACT_IBIT__ = 0
  1293. const m___ULLFRACT_MAX__ = "0XFFFFFFFFFFFFFFFFP-64ULLR"
  1294. const m___ULLFRACT_MIN__ = "0.0ULLR"
  1295. const m___UQQ_FBIT__ = 8
  1296. const m___UQQ_IBIT__ = 0
  1297. const m___USACCUM_EPSILON__ = "0x1P-8UHK"
  1298. const m___USACCUM_FBIT__ = 8
  1299. const m___USACCUM_IBIT__ = 8
  1300. const m___USACCUM_MAX__ = "0XFFFFP-8UHK"
  1301. const m___USACCUM_MIN__ = "0.0UHK"
  1302. const m___USA_FBIT__ = 16
  1303. const m___USA_IBIT__ = 16
  1304. const m___USE_TIME_BITS64 = 1
  1305. const m___USFRACT_EPSILON__ = "0x1P-8UHR"
  1306. const m___USFRACT_FBIT__ = 8
  1307. const m___USFRACT_IBIT__ = 0
  1308. const m___USFRACT_MAX__ = "0XFFP-8UHR"
  1309. const m___USFRACT_MIN__ = "0.0UHR"
  1310. const m___USQ_FBIT__ = 32
  1311. const m___USQ_IBIT__ = 0
  1312. const m___UTA_FBIT__ = 64
  1313. const m___UTA_IBIT__ = 64
  1314. const m___UTQ_FBIT__ = 128
  1315. const m___UTQ_IBIT__ = 0
  1316. const m___VERSION__ = "12.2.0"
  1317. const m___VFP_FP__ = 1
  1318. const m___WCHAR_MAX__ = 0xffffffff
  1319. const m___WCHAR_MIN__ = 0
  1320. const m___WCHAR_WIDTH__ = 32
  1321. const m___WINT_MAX__ = 0xffffffff
  1322. const m___WINT_MIN__ = 0
  1323. const m___WINT_WIDTH__ = 32
  1324. const m___WORDSIZE = 32
  1325. const m___WORDSIZE32_PTRDIFF_LONG = 0
  1326. const m___WORDSIZE32_SIZE_ULONG = 0
  1327. const m___WORDSIZE_TIME64_COMPAT32 = 1
  1328. const m___arm__ = 1
  1329. const m___glibc_c99_flexarr_available = 1
  1330. const m___gnu_linux__ = 1
  1331. const m___inline = "inline"
  1332. const m___linux = 1
  1333. const m___linux__ = 1
  1334. const m___restrict = "restrict"
  1335. const m___tm_gmtoff = "tm_gmtoff"
  1336. const m___tm_zone = "tm_zone"
  1337. const m___ucontext = "ucontext"
  1338. const m___unix = 1
  1339. const m___unix__ = 1
  1340. const m_alloca = "__builtin_alloca"
  1341. const m_inline = "__inline"
  1342. const m_linux = 1
  1343. const m_loff_t = "off_t"
  1344. const m_prlimit64 = "prlimit"
  1345. const m_unix = 1
  1346. type t__builtin_va_list = uintptr
  1347. type t__predefined_size_t = uint32
  1348. type t__predefined_wchar_t = uint32
  1349. type t__predefined_ptrdiff_t = int32
  1350. type Tsize_t = uint32
  1351. type Tssize_t = int32
  1352. type Tmode_t = uint32
  1353. type Toff_t = int64
  1354. type Tpid_t = int32
  1355. type Tiovec = struct {
  1356. Fiov_base uintptr
  1357. Fiov_len Tsize_t
  1358. }
  1359. type Tflock = struct {
  1360. F__ccgo_align [0]uint32
  1361. Fl_type int16
  1362. Fl_whence int16
  1363. F__ccgo_align2 [4]byte
  1364. Fl_start Toff_t
  1365. Fl_len Toff_t
  1366. Fl_pid Tpid_t
  1367. F__ccgo_pad5 [4]byte
  1368. }
  1369. type Tfile_handle = struct {
  1370. Fhandle_bytes uint32
  1371. Fhandle_type int32
  1372. }
  1373. type Tf_owner_ex = struct {
  1374. Ftype1 int32
  1375. Fpid Tpid_t
  1376. }
  1377. type Ttime_t = int64
  1378. type Tclock_t = int32
  1379. type Ttimespec = struct {
  1380. F__ccgo_align [0]uint32
  1381. Ftv_sec Ttime_t
  1382. Ftv_nsec int32
  1383. F__ccgo12 uint32
  1384. }
  1385. type Tuid_t = uint32
  1386. type Tpthread_t = uintptr
  1387. type Tsigset_t = struct {
  1388. F__bits [32]uint32
  1389. }
  1390. type t__sigset_t = Tsigset_t
  1391. type Tpthread_attr_t = struct {
  1392. F__u struct {
  1393. F__vi [0][9]int32
  1394. F__s [0][9]uint32
  1395. F__i [9]int32
  1396. }
  1397. }
  1398. type Tstack_t = struct {
  1399. Fss_sp uintptr
  1400. Fss_flags int32
  1401. Fss_size Tsize_t
  1402. }
  1403. type Tsigaltstack = Tstack_t
  1404. type Tgreg_t = int32
  1405. type Tgregset_t = [18]int32
  1406. type Tmcontext_t = struct {
  1407. Ftrap_no uint32
  1408. Ferror_code uint32
  1409. Foldmask uint32
  1410. Farm_r0 uint32
  1411. Farm_r1 uint32
  1412. Farm_r2 uint32
  1413. Farm_r3 uint32
  1414. Farm_r4 uint32
  1415. Farm_r5 uint32
  1416. Farm_r6 uint32
  1417. Farm_r7 uint32
  1418. Farm_r8 uint32
  1419. Farm_r9 uint32
  1420. Farm_r10 uint32
  1421. Farm_fp uint32
  1422. Farm_ip uint32
  1423. Farm_sp uint32
  1424. Farm_lr uint32
  1425. Farm_pc uint32
  1426. Farm_cpsr uint32
  1427. Ffault_address uint32
  1428. }
  1429. type Tsigcontext = Tmcontext_t
  1430. type Tucontext_t = struct {
  1431. F__ccgo_align [0]uint32
  1432. Fuc_flags uint32
  1433. Fuc_link uintptr
  1434. Fuc_stack Tstack_t
  1435. Fuc_mcontext Tmcontext_t
  1436. Fuc_sigmask Tsigset_t
  1437. Fuc_regspace [64]uint64
  1438. }
  1439. type Tucontext = Tucontext_t
  1440. type Tsigval = struct {
  1441. Fsival_ptr [0]uintptr
  1442. Fsival_int int32
  1443. }
  1444. type Tsiginfo_t = struct {
  1445. Fsi_signo int32
  1446. Fsi_errno int32
  1447. Fsi_code int32
  1448. F__si_fields struct {
  1449. F__si_common [0]struct {
  1450. F__first struct {
  1451. F__timer [0]struct {
  1452. Fsi_timerid int32
  1453. Fsi_overrun int32
  1454. }
  1455. F__piduid struct {
  1456. Fsi_pid Tpid_t
  1457. Fsi_uid Tuid_t
  1458. }
  1459. }
  1460. F__second struct {
  1461. F__sigchld [0]struct {
  1462. Fsi_status int32
  1463. Fsi_utime Tclock_t
  1464. Fsi_stime Tclock_t
  1465. }
  1466. Fsi_value Tsigval
  1467. F__ccgo_pad2 [8]byte
  1468. }
  1469. }
  1470. F__sigfault [0]struct {
  1471. Fsi_addr uintptr
  1472. Fsi_addr_lsb int16
  1473. F__first struct {
  1474. Fsi_pkey [0]uint32
  1475. F__addr_bnd struct {
  1476. Fsi_lower uintptr
  1477. Fsi_upper uintptr
  1478. }
  1479. }
  1480. }
  1481. F__sigpoll [0]struct {
  1482. Fsi_band int32
  1483. Fsi_fd int32
  1484. }
  1485. F__sigsys [0]struct {
  1486. Fsi_call_addr uintptr
  1487. Fsi_syscall int32
  1488. Fsi_arch uint32
  1489. }
  1490. F__pad [116]uint8
  1491. }
  1492. }
  1493. type Tsigaction = struct {
  1494. F__sa_handler struct {
  1495. Fsa_sigaction [0]uintptr
  1496. Fsa_handler uintptr
  1497. }
  1498. Fsa_mask Tsigset_t
  1499. Fsa_flags int32
  1500. Fsa_restorer uintptr
  1501. }
  1502. type Tsigevent = struct {
  1503. Fsigev_value Tsigval
  1504. Fsigev_signo int32
  1505. Fsigev_notify int32
  1506. F__sev_fields struct {
  1507. Fsigev_notify_thread_id [0]Tpid_t
  1508. F__sev_thread [0]struct {
  1509. Fsigev_notify_function uintptr
  1510. Fsigev_notify_attributes uintptr
  1511. }
  1512. F__pad [52]uint8
  1513. }
  1514. }
  1515. type Tsig_t = uintptr
  1516. type Tsighandler_t = uintptr
  1517. type Tsig_atomic_t = int32
  1518. type Tuintptr_t = uint32
  1519. type Tintptr_t = int32
  1520. type Tint8_t = int8
  1521. type Tint16_t = int16
  1522. type Tint32_t = int32
  1523. type Tint64_t = int64
  1524. type Tintmax_t = int64
  1525. type Tuint8_t = uint8
  1526. type Tuint16_t = uint16
  1527. type Tuint32_t = uint32
  1528. type Tuint64_t = uint64
  1529. type Tuintmax_t = uint64
  1530. type Tint_fast8_t = int8
  1531. type Tint_fast64_t = int64
  1532. type Tint_least8_t = int8
  1533. type Tint_least16_t = int16
  1534. type Tint_least32_t = int32
  1535. type Tint_least64_t = int64
  1536. type Tuint_fast8_t = uint8
  1537. type Tuint_fast64_t = uint64
  1538. type Tuint_least8_t = uint8
  1539. type Tuint_least16_t = uint16
  1540. type Tuint_least32_t = uint32
  1541. type Tuint_least64_t = uint64
  1542. type Tint_fast16_t = int32
  1543. type Tint_fast32_t = int32
  1544. type Tuint_fast16_t = uint32
  1545. type Tuint_fast32_t = uint32
  1546. type Twchar_t = uint32
  1547. type Tdiv_t = struct {
  1548. Fquot int32
  1549. Frem int32
  1550. }
  1551. type Tldiv_t = struct {
  1552. Fquot int32
  1553. Frem int32
  1554. }
  1555. type Tlldiv_t = struct {
  1556. F__ccgo_align [0]uint32
  1557. Fquot int64
  1558. Frem int64
  1559. }
  1560. type Tregister_t = int32
  1561. type Tsuseconds_t = int64
  1562. type Tu_int64_t = uint64
  1563. type Tnlink_t = uint32
  1564. type Tino_t = uint64
  1565. type Tdev_t = uint64
  1566. type Tblksize_t = int32
  1567. type Tblkcnt_t = int64
  1568. type Tfsblkcnt_t = uint64
  1569. type Tfsfilcnt_t = uint64
  1570. type Ttimer_t = uintptr
  1571. type Tclockid_t = int32
  1572. type Tid_t = uint32
  1573. type Tgid_t = uint32
  1574. type Tkey_t = int32
  1575. type Tuseconds_t = uint32
  1576. type Tpthread_once_t = int32
  1577. type Tpthread_key_t = uint32
  1578. type Tpthread_spinlock_t = int32
  1579. type Tpthread_mutexattr_t = struct {
  1580. F__attr uint32
  1581. }
  1582. type Tpthread_condattr_t = struct {
  1583. F__attr uint32
  1584. }
  1585. type Tpthread_barrierattr_t = struct {
  1586. F__attr uint32
  1587. }
  1588. type Tpthread_rwlockattr_t = struct {
  1589. F__attr [2]uint32
  1590. }
  1591. type Tpthread_mutex_t = struct {
  1592. F__u struct {
  1593. F__vi [0][6]int32
  1594. F__p [0][6]uintptr
  1595. F__i [6]int32
  1596. }
  1597. F__ccgo_room int32
  1598. }
  1599. type Tpthread_cond_t = struct {
  1600. F__u struct {
  1601. F__vi [0][12]int32
  1602. F__p [0][12]uintptr
  1603. F__i [12]int32
  1604. }
  1605. }
  1606. type Tpthread_rwlock_t = struct {
  1607. F__u struct {
  1608. F__vi [0][8]int32
  1609. F__p [0][8]uintptr
  1610. F__i [8]int32
  1611. }
  1612. }
  1613. type Tpthread_barrier_t = struct {
  1614. F__u struct {
  1615. F__vi [0][5]int32
  1616. F__p [0][5]uintptr
  1617. F__i [5]int32
  1618. }
  1619. }
  1620. type Tu_int8_t = uint8
  1621. type Tu_int16_t = uint16
  1622. type Tu_int32_t = uint32
  1623. type Tcaddr_t = uintptr
  1624. type Tu_char = uint8
  1625. type Tu_short = uint16
  1626. type Tushort = uint16
  1627. type Tu_int = uint32
  1628. type Tuint = uint32
  1629. type Tu_long = uint32
  1630. type Tulong = uint32
  1631. type Tquad_t = int64
  1632. type Tu_quad_t = uint64
  1633. type Ttimeval = struct {
  1634. F__ccgo_align [0]uint32
  1635. Ftv_sec Ttime_t
  1636. Ftv_usec Tsuseconds_t
  1637. }
  1638. type Tfd_mask = uint32
  1639. type Tfd_set = struct {
  1640. Ffds_bits [32]uint32
  1641. }
  1642. type Tva_list = uintptr
  1643. type t__isoc_va_list = uintptr
  1644. type Tfpos_t = struct {
  1645. F__ccgo_align [0]uint32
  1646. F__lldata [0]int64
  1647. F__align [0]float64
  1648. F__opaque [16]uint8
  1649. }
  1650. type T_G_fpos64_t = Tfpos_t
  1651. type Tcookie_io_functions_t = struct {
  1652. Fread uintptr
  1653. Fwrite uintptr
  1654. Fseek uintptr
  1655. Fclose1 uintptr
  1656. }
  1657. type T_IO_cookie_io_functions_t = Tcookie_io_functions_t
  1658. type Tstat = struct {
  1659. F__ccgo_align [0]uint32
  1660. Fst_dev Tdev_t
  1661. F__st_dev_padding int32
  1662. F__st_ino_truncated int32
  1663. Fst_mode Tmode_t
  1664. Fst_nlink Tnlink_t
  1665. Fst_uid Tuid_t
  1666. Fst_gid Tgid_t
  1667. Fst_rdev Tdev_t
  1668. F__st_rdev_padding int32
  1669. F__ccgo_align9 [4]byte
  1670. Fst_size Toff_t
  1671. Fst_blksize Tblksize_t
  1672. F__ccgo_align11 [4]byte
  1673. Fst_blocks Tblkcnt_t
  1674. F__st_atim32 struct {
  1675. Ftv_sec int32
  1676. Ftv_nsec int32
  1677. }
  1678. F__st_mtim32 struct {
  1679. Ftv_sec int32
  1680. Ftv_nsec int32
  1681. }
  1682. F__st_ctim32 struct {
  1683. Ftv_sec int32
  1684. Ftv_nsec int32
  1685. }
  1686. Fst_ino Tino_t
  1687. Fst_atim Ttimespec
  1688. Fst_mtim Ttimespec
  1689. Fst_ctim Ttimespec
  1690. }
  1691. type Tstatx_timestamp = struct {
  1692. F__ccgo_align [0]uint32
  1693. Ftv_sec Tint64_t
  1694. Ftv_nsec Tuint32_t
  1695. F__pad Tuint32_t
  1696. }
  1697. type Tstatx = struct {
  1698. F__ccgo_align [0]uint32
  1699. Fstx_mask Tuint32_t
  1700. Fstx_blksize Tuint32_t
  1701. Fstx_attributes Tuint64_t
  1702. Fstx_nlink Tuint32_t
  1703. Fstx_uid Tuint32_t
  1704. Fstx_gid Tuint32_t
  1705. Fstx_mode Tuint16_t
  1706. F__pad0 [1]Tuint16_t
  1707. Fstx_ino Tuint64_t
  1708. Fstx_size Tuint64_t
  1709. Fstx_blocks Tuint64_t
  1710. Fstx_attributes_mask Tuint64_t
  1711. Fstx_atime Tstatx_timestamp
  1712. Fstx_btime Tstatx_timestamp
  1713. Fstx_ctime Tstatx_timestamp
  1714. Fstx_mtime Tstatx_timestamp
  1715. Fstx_rdev_major Tuint32_t
  1716. Fstx_rdev_minor Tuint32_t
  1717. Fstx_dev_major Tuint32_t
  1718. Fstx_dev_minor Tuint32_t
  1719. F__pad1 [14]Tuint64_t
  1720. }
  1721. type Tlocale_t = uintptr
  1722. type Titimerval = struct {
  1723. F__ccgo_align [0]uint32
  1724. Fit_interval Ttimeval
  1725. Fit_value Ttimeval
  1726. }
  1727. type Ttimezone = struct {
  1728. Ftz_minuteswest int32
  1729. Ftz_dsttime int32
  1730. }
  1731. type Tu8 = uint8
  1732. type Tu32 = uint32
  1733. type Tchacha_ctx = struct {
  1734. Finput [16]Tu32
  1735. }
  1736. var _sigma = [16]uint8{'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'}
  1737. var _tau = [16]uint8{'e', 'x', 'p', 'a', 'n', 'd', ' ', '1', '6', '-', 'b', 'y', 't', 'e', ' ', 'k'}
  1738. func _chacha_keysetup(tls *libc.TLS, x uintptr, k uintptr, kbits Tu32) {
  1739. var constants uintptr
  1740. _ = constants
  1741. *(*Tu32)(unsafe.Pointer(x + 4*4)) = uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(0)))) | uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(0) + 1)))<<libc.Int32FromInt32(8) | uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(0) + 2)))<<libc.Int32FromInt32(16) | uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(0) + 3)))<<libc.Int32FromInt32(24)
  1742. *(*Tu32)(unsafe.Pointer(x + 5*4)) = uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(4)))) | uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(4) + 1)))<<libc.Int32FromInt32(8) | uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(4) + 2)))<<libc.Int32FromInt32(16) | uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(4) + 3)))<<libc.Int32FromInt32(24)
  1743. *(*Tu32)(unsafe.Pointer(x + 6*4)) = uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(8)))) | uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(8) + 1)))<<libc.Int32FromInt32(8) | uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(8) + 2)))<<libc.Int32FromInt32(16) | uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(8) + 3)))<<libc.Int32FromInt32(24)
  1744. *(*Tu32)(unsafe.Pointer(x + 7*4)) = uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(12)))) | uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(12) + 1)))<<libc.Int32FromInt32(8) | uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(12) + 2)))<<libc.Int32FromInt32(16) | uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(12) + 3)))<<libc.Int32FromInt32(24)
  1745. if kbits == uint32(256) {
  1746. k += uintptr(16)
  1747. constants = uintptr(unsafe.Pointer(&_sigma))
  1748. } else {
  1749. constants = uintptr(unsafe.Pointer(&_tau))
  1750. }
  1751. *(*Tu32)(unsafe.Pointer(x + 8*4)) = uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(0)))) | uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(0) + 1)))<<libc.Int32FromInt32(8) | uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(0) + 2)))<<libc.Int32FromInt32(16) | uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(0) + 3)))<<libc.Int32FromInt32(24)
  1752. *(*Tu32)(unsafe.Pointer(x + 9*4)) = uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(4)))) | uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(4) + 1)))<<libc.Int32FromInt32(8) | uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(4) + 2)))<<libc.Int32FromInt32(16) | uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(4) + 3)))<<libc.Int32FromInt32(24)
  1753. *(*Tu32)(unsafe.Pointer(x + 10*4)) = uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(8)))) | uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(8) + 1)))<<libc.Int32FromInt32(8) | uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(8) + 2)))<<libc.Int32FromInt32(16) | uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(8) + 3)))<<libc.Int32FromInt32(24)
  1754. *(*Tu32)(unsafe.Pointer(x + 11*4)) = uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(12)))) | uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(12) + 1)))<<libc.Int32FromInt32(8) | uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(12) + 2)))<<libc.Int32FromInt32(16) | uint32(*(*Tu8)(unsafe.Pointer(k + libc.UintptrFromInt32(12) + 3)))<<libc.Int32FromInt32(24)
  1755. *(*Tu32)(unsafe.Pointer(x)) = uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(0)))) | uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(0) + 1)))<<libc.Int32FromInt32(8) | uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(0) + 2)))<<libc.Int32FromInt32(16) | uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(0) + 3)))<<libc.Int32FromInt32(24)
  1756. *(*Tu32)(unsafe.Pointer(x + 1*4)) = uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(4)))) | uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(4) + 1)))<<libc.Int32FromInt32(8) | uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(4) + 2)))<<libc.Int32FromInt32(16) | uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(4) + 3)))<<libc.Int32FromInt32(24)
  1757. *(*Tu32)(unsafe.Pointer(x + 2*4)) = uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(8)))) | uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(8) + 1)))<<libc.Int32FromInt32(8) | uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(8) + 2)))<<libc.Int32FromInt32(16) | uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(8) + 3)))<<libc.Int32FromInt32(24)
  1758. *(*Tu32)(unsafe.Pointer(x + 3*4)) = uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(12)))) | uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(12) + 1)))<<libc.Int32FromInt32(8) | uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(12) + 2)))<<libc.Int32FromInt32(16) | uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(12) + 3)))<<libc.Int32FromInt32(24)
  1759. }
  1760. func _chacha_ivsetup(tls *libc.TLS, x uintptr, iv uintptr) {
  1761. *(*Tu32)(unsafe.Pointer(x + 12*4)) = uint32(0)
  1762. *(*Tu32)(unsafe.Pointer(x + 13*4)) = uint32(0)
  1763. *(*Tu32)(unsafe.Pointer(x + 14*4)) = uint32(*(*Tu8)(unsafe.Pointer(iv + libc.UintptrFromInt32(0)))) | uint32(*(*Tu8)(unsafe.Pointer(iv + libc.UintptrFromInt32(0) + 1)))<<libc.Int32FromInt32(8) | uint32(*(*Tu8)(unsafe.Pointer(iv + libc.UintptrFromInt32(0) + 2)))<<libc.Int32FromInt32(16) | uint32(*(*Tu8)(unsafe.Pointer(iv + libc.UintptrFromInt32(0) + 3)))<<libc.Int32FromInt32(24)
  1764. *(*Tu32)(unsafe.Pointer(x + 15*4)) = uint32(*(*Tu8)(unsafe.Pointer(iv + libc.UintptrFromInt32(4)))) | uint32(*(*Tu8)(unsafe.Pointer(iv + libc.UintptrFromInt32(4) + 1)))<<libc.Int32FromInt32(8) | uint32(*(*Tu8)(unsafe.Pointer(iv + libc.UintptrFromInt32(4) + 2)))<<libc.Int32FromInt32(16) | uint32(*(*Tu8)(unsafe.Pointer(iv + libc.UintptrFromInt32(4) + 3)))<<libc.Int32FromInt32(24)
  1765. }
  1766. func _chacha_encrypt_bytes(tls *libc.TLS, x uintptr, m uintptr, c uintptr, bytes Tu32) {
  1767. bp := tls.Alloc(64)
  1768. defer tls.Free(64)
  1769. var ctarget uintptr
  1770. var i uint32
  1771. var j0, j1, j10, j11, j12, j13, j14, j15, j2, j3, j4, j5, j6, j7, j8, j9, x0, x1, x10, x11, x12, x13, x14, x15, x2, x3, x4, x5, x6, x7, x8, x9 Tu32
  1772. var _ /* tmp at bp+0 */ [64]Tu8
  1773. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ctarget, i, j0, j1, j10, j11, j12, j13, j14, j15, j2, j3, j4, j5, j6, j7, j8, j9, x0, x1, x10, x11, x12, x13, x14, x15, x2, x3, x4, x5, x6, x7, x8, x9
  1774. ctarget = libc.UintptrFromInt32(0)
  1775. if !(bytes != 0) {
  1776. return
  1777. }
  1778. j0 = *(*Tu32)(unsafe.Pointer(x))
  1779. j1 = *(*Tu32)(unsafe.Pointer(x + 1*4))
  1780. j2 = *(*Tu32)(unsafe.Pointer(x + 2*4))
  1781. j3 = *(*Tu32)(unsafe.Pointer(x + 3*4))
  1782. j4 = *(*Tu32)(unsafe.Pointer(x + 4*4))
  1783. j5 = *(*Tu32)(unsafe.Pointer(x + 5*4))
  1784. j6 = *(*Tu32)(unsafe.Pointer(x + 6*4))
  1785. j7 = *(*Tu32)(unsafe.Pointer(x + 7*4))
  1786. j8 = *(*Tu32)(unsafe.Pointer(x + 8*4))
  1787. j9 = *(*Tu32)(unsafe.Pointer(x + 9*4))
  1788. j10 = *(*Tu32)(unsafe.Pointer(x + 10*4))
  1789. j11 = *(*Tu32)(unsafe.Pointer(x + 11*4))
  1790. j12 = *(*Tu32)(unsafe.Pointer(x + 12*4))
  1791. j13 = *(*Tu32)(unsafe.Pointer(x + 13*4))
  1792. j14 = *(*Tu32)(unsafe.Pointer(x + 14*4))
  1793. j15 = *(*Tu32)(unsafe.Pointer(x + 15*4))
  1794. for {
  1795. if bytes < uint32(64) {
  1796. i = uint32(0)
  1797. for {
  1798. if !(i < bytes) {
  1799. break
  1800. }
  1801. (*(*[64]Tu8)(unsafe.Pointer(bp)))[i] = *(*Tu8)(unsafe.Pointer(m + uintptr(i)))
  1802. goto _2
  1803. _2:
  1804. ;
  1805. i++
  1806. }
  1807. m = bp
  1808. ctarget = c
  1809. c = bp
  1810. }
  1811. x0 = j0
  1812. x1 = j1
  1813. x2 = j2
  1814. x3 = j3
  1815. x4 = j4
  1816. x5 = j5
  1817. x6 = j6
  1818. x7 = j7
  1819. x8 = j8
  1820. x9 = j9
  1821. x10 = j10
  1822. x11 = j11
  1823. x12 = j12
  1824. x13 = j13
  1825. x14 = j14
  1826. x15 = j15
  1827. i = uint32(20)
  1828. for {
  1829. if !(i > uint32(0)) {
  1830. break
  1831. }
  1832. x0 = (x0 + x4) & libc.Uint32FromUint32(0xFFFFFFFF)
  1833. x12 = (x12^x0)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x12^x0)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  1834. x8 = (x8 + x12) & libc.Uint32FromUint32(0xFFFFFFFF)
  1835. x4 = (x4^x8)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x4^x8)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  1836. x0 = (x0 + x4) & libc.Uint32FromUint32(0xFFFFFFFF)
  1837. x12 = (x12^x0)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x12^x0)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  1838. x8 = (x8 + x12) & libc.Uint32FromUint32(0xFFFFFFFF)
  1839. x4 = (x4^x8)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x4^x8)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  1840. x1 = (x1 + x5) & libc.Uint32FromUint32(0xFFFFFFFF)
  1841. x13 = (x13^x1)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x13^x1)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  1842. x9 = (x9 + x13) & libc.Uint32FromUint32(0xFFFFFFFF)
  1843. x5 = (x5^x9)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x5^x9)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  1844. x1 = (x1 + x5) & libc.Uint32FromUint32(0xFFFFFFFF)
  1845. x13 = (x13^x1)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x13^x1)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  1846. x9 = (x9 + x13) & libc.Uint32FromUint32(0xFFFFFFFF)
  1847. x5 = (x5^x9)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x5^x9)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  1848. x2 = (x2 + x6) & libc.Uint32FromUint32(0xFFFFFFFF)
  1849. x14 = (x14^x2)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x14^x2)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  1850. x10 = (x10 + x14) & libc.Uint32FromUint32(0xFFFFFFFF)
  1851. x6 = (x6^x10)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x6^x10)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  1852. x2 = (x2 + x6) & libc.Uint32FromUint32(0xFFFFFFFF)
  1853. x14 = (x14^x2)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x14^x2)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  1854. x10 = (x10 + x14) & libc.Uint32FromUint32(0xFFFFFFFF)
  1855. x6 = (x6^x10)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x6^x10)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  1856. x3 = (x3 + x7) & libc.Uint32FromUint32(0xFFFFFFFF)
  1857. x15 = (x15^x3)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x15^x3)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  1858. x11 = (x11 + x15) & libc.Uint32FromUint32(0xFFFFFFFF)
  1859. x7 = (x7^x11)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x7^x11)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  1860. x3 = (x3 + x7) & libc.Uint32FromUint32(0xFFFFFFFF)
  1861. x15 = (x15^x3)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x15^x3)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  1862. x11 = (x11 + x15) & libc.Uint32FromUint32(0xFFFFFFFF)
  1863. x7 = (x7^x11)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x7^x11)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  1864. x0 = (x0 + x5) & libc.Uint32FromUint32(0xFFFFFFFF)
  1865. x15 = (x15^x0)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x15^x0)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  1866. x10 = (x10 + x15) & libc.Uint32FromUint32(0xFFFFFFFF)
  1867. x5 = (x5^x10)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x5^x10)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  1868. x0 = (x0 + x5) & libc.Uint32FromUint32(0xFFFFFFFF)
  1869. x15 = (x15^x0)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x15^x0)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  1870. x10 = (x10 + x15) & libc.Uint32FromUint32(0xFFFFFFFF)
  1871. x5 = (x5^x10)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x5^x10)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  1872. x1 = (x1 + x6) & libc.Uint32FromUint32(0xFFFFFFFF)
  1873. x12 = (x12^x1)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x12^x1)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  1874. x11 = (x11 + x12) & libc.Uint32FromUint32(0xFFFFFFFF)
  1875. x6 = (x6^x11)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x6^x11)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  1876. x1 = (x1 + x6) & libc.Uint32FromUint32(0xFFFFFFFF)
  1877. x12 = (x12^x1)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x12^x1)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  1878. x11 = (x11 + x12) & libc.Uint32FromUint32(0xFFFFFFFF)
  1879. x6 = (x6^x11)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x6^x11)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  1880. x2 = (x2 + x7) & libc.Uint32FromUint32(0xFFFFFFFF)
  1881. x13 = (x13^x2)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x13^x2)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  1882. x8 = (x8 + x13) & libc.Uint32FromUint32(0xFFFFFFFF)
  1883. x7 = (x7^x8)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x7^x8)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  1884. x2 = (x2 + x7) & libc.Uint32FromUint32(0xFFFFFFFF)
  1885. x13 = (x13^x2)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x13^x2)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  1886. x8 = (x8 + x13) & libc.Uint32FromUint32(0xFFFFFFFF)
  1887. x7 = (x7^x8)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x7^x8)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  1888. x3 = (x3 + x4) & libc.Uint32FromUint32(0xFFFFFFFF)
  1889. x14 = (x14^x3)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x14^x3)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  1890. x9 = (x9 + x14) & libc.Uint32FromUint32(0xFFFFFFFF)
  1891. x4 = (x4^x9)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x4^x9)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  1892. x3 = (x3 + x4) & libc.Uint32FromUint32(0xFFFFFFFF)
  1893. x14 = (x14^x3)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x14^x3)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  1894. x9 = (x9 + x14) & libc.Uint32FromUint32(0xFFFFFFFF)
  1895. x4 = (x4^x9)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x4^x9)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  1896. goto _3
  1897. _3:
  1898. ;
  1899. i -= uint32(2)
  1900. }
  1901. x0 = (x0 + j0) & libc.Uint32FromUint32(0xFFFFFFFF)
  1902. x1 = (x1 + j1) & libc.Uint32FromUint32(0xFFFFFFFF)
  1903. x2 = (x2 + j2) & libc.Uint32FromUint32(0xFFFFFFFF)
  1904. x3 = (x3 + j3) & libc.Uint32FromUint32(0xFFFFFFFF)
  1905. x4 = (x4 + j4) & libc.Uint32FromUint32(0xFFFFFFFF)
  1906. x5 = (x5 + j5) & libc.Uint32FromUint32(0xFFFFFFFF)
  1907. x6 = (x6 + j6) & libc.Uint32FromUint32(0xFFFFFFFF)
  1908. x7 = (x7 + j7) & libc.Uint32FromUint32(0xFFFFFFFF)
  1909. x8 = (x8 + j8) & libc.Uint32FromUint32(0xFFFFFFFF)
  1910. x9 = (x9 + j9) & libc.Uint32FromUint32(0xFFFFFFFF)
  1911. x10 = (x10 + j10) & libc.Uint32FromUint32(0xFFFFFFFF)
  1912. x11 = (x11 + j11) & libc.Uint32FromUint32(0xFFFFFFFF)
  1913. x12 = (x12 + j12) & libc.Uint32FromUint32(0xFFFFFFFF)
  1914. x13 = (x13 + j13) & libc.Uint32FromUint32(0xFFFFFFFF)
  1915. x14 = (x14 + j14) & libc.Uint32FromUint32(0xFFFFFFFF)
  1916. x15 = (x15 + j15) & libc.Uint32FromUint32(0xFFFFFFFF)
  1917. j12 = (j12 + libc.Uint32FromInt32(libc.Int32FromInt32(1))) & libc.Uint32FromUint32(0xFFFFFFFF)
  1918. if !(j12 != 0) {
  1919. j13 = (j13 + libc.Uint32FromInt32(libc.Int32FromInt32(1))) & libc.Uint32FromUint32(0xFFFFFFFF)
  1920. }
  1921. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(0))) = uint8(uint32(uint8(x0)) & libc.Uint32FromUint32(0xFF))
  1922. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(0) + 1)) = uint8(uint32(uint8(x0>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1923. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(0) + 2)) = uint8(uint32(uint8(x0>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1924. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(0) + 3)) = uint8(uint32(uint8(x0>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1925. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(4))) = uint8(uint32(uint8(x1)) & libc.Uint32FromUint32(0xFF))
  1926. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(4) + 1)) = uint8(uint32(uint8(x1>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1927. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(4) + 2)) = uint8(uint32(uint8(x1>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1928. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(4) + 3)) = uint8(uint32(uint8(x1>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1929. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(8))) = uint8(uint32(uint8(x2)) & libc.Uint32FromUint32(0xFF))
  1930. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(8) + 1)) = uint8(uint32(uint8(x2>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1931. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(8) + 2)) = uint8(uint32(uint8(x2>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1932. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(8) + 3)) = uint8(uint32(uint8(x2>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1933. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(12))) = uint8(uint32(uint8(x3)) & libc.Uint32FromUint32(0xFF))
  1934. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(12) + 1)) = uint8(uint32(uint8(x3>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1935. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(12) + 2)) = uint8(uint32(uint8(x3>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1936. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(12) + 3)) = uint8(uint32(uint8(x3>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1937. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(16))) = uint8(uint32(uint8(x4)) & libc.Uint32FromUint32(0xFF))
  1938. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(16) + 1)) = uint8(uint32(uint8(x4>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1939. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(16) + 2)) = uint8(uint32(uint8(x4>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1940. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(16) + 3)) = uint8(uint32(uint8(x4>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1941. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(20))) = uint8(uint32(uint8(x5)) & libc.Uint32FromUint32(0xFF))
  1942. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(20) + 1)) = uint8(uint32(uint8(x5>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1943. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(20) + 2)) = uint8(uint32(uint8(x5>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1944. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(20) + 3)) = uint8(uint32(uint8(x5>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1945. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(24))) = uint8(uint32(uint8(x6)) & libc.Uint32FromUint32(0xFF))
  1946. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(24) + 1)) = uint8(uint32(uint8(x6>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1947. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(24) + 2)) = uint8(uint32(uint8(x6>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1948. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(24) + 3)) = uint8(uint32(uint8(x6>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1949. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(28))) = uint8(uint32(uint8(x7)) & libc.Uint32FromUint32(0xFF))
  1950. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(28) + 1)) = uint8(uint32(uint8(x7>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1951. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(28) + 2)) = uint8(uint32(uint8(x7>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1952. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(28) + 3)) = uint8(uint32(uint8(x7>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1953. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(32))) = uint8(uint32(uint8(x8)) & libc.Uint32FromUint32(0xFF))
  1954. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(32) + 1)) = uint8(uint32(uint8(x8>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1955. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(32) + 2)) = uint8(uint32(uint8(x8>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1956. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(32) + 3)) = uint8(uint32(uint8(x8>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1957. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(36))) = uint8(uint32(uint8(x9)) & libc.Uint32FromUint32(0xFF))
  1958. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(36) + 1)) = uint8(uint32(uint8(x9>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1959. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(36) + 2)) = uint8(uint32(uint8(x9>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1960. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(36) + 3)) = uint8(uint32(uint8(x9>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1961. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(40))) = uint8(uint32(uint8(x10)) & libc.Uint32FromUint32(0xFF))
  1962. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(40) + 1)) = uint8(uint32(uint8(x10>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1963. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(40) + 2)) = uint8(uint32(uint8(x10>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1964. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(40) + 3)) = uint8(uint32(uint8(x10>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1965. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(44))) = uint8(uint32(uint8(x11)) & libc.Uint32FromUint32(0xFF))
  1966. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(44) + 1)) = uint8(uint32(uint8(x11>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1967. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(44) + 2)) = uint8(uint32(uint8(x11>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1968. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(44) + 3)) = uint8(uint32(uint8(x11>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1969. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(48))) = uint8(uint32(uint8(x12)) & libc.Uint32FromUint32(0xFF))
  1970. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(48) + 1)) = uint8(uint32(uint8(x12>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1971. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(48) + 2)) = uint8(uint32(uint8(x12>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1972. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(48) + 3)) = uint8(uint32(uint8(x12>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1973. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(52))) = uint8(uint32(uint8(x13)) & libc.Uint32FromUint32(0xFF))
  1974. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(52) + 1)) = uint8(uint32(uint8(x13>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1975. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(52) + 2)) = uint8(uint32(uint8(x13>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1976. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(52) + 3)) = uint8(uint32(uint8(x13>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1977. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(56))) = uint8(uint32(uint8(x14)) & libc.Uint32FromUint32(0xFF))
  1978. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(56) + 1)) = uint8(uint32(uint8(x14>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1979. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(56) + 2)) = uint8(uint32(uint8(x14>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1980. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(56) + 3)) = uint8(uint32(uint8(x14>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1981. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(60))) = uint8(uint32(uint8(x15)) & libc.Uint32FromUint32(0xFF))
  1982. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(60) + 1)) = uint8(uint32(uint8(x15>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1983. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(60) + 2)) = uint8(uint32(uint8(x15>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1984. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(60) + 3)) = uint8(uint32(uint8(x15>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1985. if bytes <= uint32(64) {
  1986. if bytes < uint32(64) {
  1987. i = uint32(0)
  1988. for {
  1989. if !(i < bytes) {
  1990. break
  1991. }
  1992. *(*Tu8)(unsafe.Pointer(ctarget + uintptr(i))) = *(*Tu8)(unsafe.Pointer(c + uintptr(i)))
  1993. goto _4
  1994. _4:
  1995. ;
  1996. i++
  1997. }
  1998. }
  1999. *(*Tu32)(unsafe.Pointer(x + 12*4)) = j12
  2000. *(*Tu32)(unsafe.Pointer(x + 13*4)) = j13
  2001. return
  2002. }
  2003. bytes -= uint32(64)
  2004. c += uintptr(64)
  2005. goto _1
  2006. _1:
  2007. }
  2008. }
  2009. // C documentation
  2010. //
  2011. // /* Marked MAP_INHERIT_ZERO, so zero'd out in fork children. */
  2012. type T_rs = struct {
  2013. Frs_have Tsize_t
  2014. Frs_count Tsize_t
  2015. }
  2016. // C documentation
  2017. //
  2018. // /* Marked MAP_INHERIT_ZERO, so zero'd out in fork children. */
  2019. var _rs uintptr
  2020. // C documentation
  2021. //
  2022. // /* Maybe be preserved in fork children, if _rs_allocate() decides. */
  2023. type T_rsx = struct {
  2024. Frs_chacha Tchacha_ctx
  2025. Frs_buf [1024]uint8
  2026. }
  2027. // C documentation
  2028. //
  2029. // /* Maybe be preserved in fork children, if _rs_allocate() decides. */
  2030. var _rsx uintptr
  2031. type Trlim_t = uint64
  2032. type Trlimit = struct {
  2033. F__ccgo_align [0]uint32
  2034. Frlim_cur Trlim_t
  2035. Frlim_max Trlim_t
  2036. }
  2037. type Trusage = struct {
  2038. F__ccgo_align [0]uint32
  2039. Fru_utime Ttimeval
  2040. Fru_stime Ttimeval
  2041. Fru_maxrss int32
  2042. Fru_ixrss int32
  2043. Fru_idrss int32
  2044. Fru_isrss int32
  2045. Fru_minflt int32
  2046. Fru_majflt int32
  2047. Fru_nswap int32
  2048. Fru_inblock int32
  2049. Fru_oublock int32
  2050. Fru_msgsnd int32
  2051. Fru_msgrcv int32
  2052. Fru_nsignals int32
  2053. Fru_nvcsw int32
  2054. Fru_nivcsw int32
  2055. F__reserved [16]int32
  2056. }
  2057. type Tsched_param = struct {
  2058. Fsched_priority int32
  2059. F__reserved1 int32
  2060. F__reserved2 [4]int32
  2061. F__reserved3 int32
  2062. }
  2063. type Tcpu_set_t = struct {
  2064. F__bits [32]uint32
  2065. }
  2066. type Ttm = struct {
  2067. Ftm_sec int32
  2068. Ftm_min int32
  2069. Ftm_hour int32
  2070. Ftm_mday int32
  2071. Ftm_mon int32
  2072. Ftm_year int32
  2073. Ftm_wday int32
  2074. Ftm_yday int32
  2075. Ftm_isdst int32
  2076. Ftm_gmtoff int32
  2077. Ftm_zone uintptr
  2078. }
  2079. type Titimerspec = struct {
  2080. F__ccgo_align [0]uint32
  2081. Fit_interval Ttimespec
  2082. Fit_value Ttimespec
  2083. }
  2084. type t__ptcb = struct {
  2085. F__f uintptr
  2086. F__x uintptr
  2087. F__next uintptr
  2088. }
  2089. type Tcpu_set_t1 = struct {
  2090. F__bits [32]uint32
  2091. }
  2092. var _arc4random_mtx = Tpthread_mutex_t{}
  2093. var __rs_forked Tsig_atomic_t
  2094. func __rs_init(tls *libc.TLS, buf uintptr, n Tsize_t) {
  2095. var v1, v2, v3, v6 uintptr
  2096. var v4 int32
  2097. _, _, _, _, _ = v1, v2, v3, v4, v6
  2098. if n < libc.Uint32FromInt32(libc.Int32FromInt32(m_KEYSZ)+libc.Int32FromInt32(m_IVSZ)) {
  2099. return
  2100. }
  2101. if _rs == libc.UintptrFromInt32(0) {
  2102. v1 = uintptr(unsafe.Pointer(&_rs))
  2103. v2 = uintptr(unsafe.Pointer(&_rsx))
  2104. v3 = libc.Xmmap(tls, libc.UintptrFromInt32(0), uint32(8), libc.Int32FromInt32(m_PROT_READ)|libc.Int32FromInt32(m_PROT_WRITE), libc.Int32FromInt32(m_MAP_ANON)|libc.Int32FromInt32(m_MAP_PRIVATE), -int32(1), 0)
  2105. *(*uintptr)(unsafe.Pointer(v1)) = v3
  2106. if v3 == uintptr(-libc.Int32FromInt32(1)) {
  2107. v4 = -int32(1)
  2108. goto _5
  2109. }
  2110. v6 = libc.Xmmap(tls, libc.UintptrFromInt32(0), uint32(1088), libc.Int32FromInt32(m_PROT_READ)|libc.Int32FromInt32(m_PROT_WRITE), libc.Int32FromInt32(m_MAP_ANON)|libc.Int32FromInt32(m_MAP_PRIVATE), -int32(1), 0)
  2111. *(*uintptr)(unsafe.Pointer(v2)) = v6
  2112. if v6 == uintptr(-libc.Int32FromInt32(1)) {
  2113. libc.Xmunmap(tls, *(*uintptr)(unsafe.Pointer(v1)), uint32(8))
  2114. *(*uintptr)(unsafe.Pointer(v1)) = libc.UintptrFromInt32(0)
  2115. v4 = -int32(1)
  2116. goto _5
  2117. }
  2118. libc.Xpthread_atfork(tls, libc.UintptrFromInt32(0), libc.UintptrFromInt32(0), __ccgo_fp(__rs_forkhandler))
  2119. v4 = 0
  2120. goto _5
  2121. _5:
  2122. if v4 == -int32(1) {
  2123. libc.X_exit(tls, int32(1))
  2124. }
  2125. }
  2126. _chacha_keysetup(tls, _rsx, buf, libc.Uint32FromInt32(libc.Int32FromInt32(m_KEYSZ)*libc.Int32FromInt32(8)))
  2127. _chacha_ivsetup(tls, _rsx, buf+uintptr(m_KEYSZ))
  2128. }
  2129. func __rs_rekey(tls *libc.TLS, dat uintptr, datlen Tsize_t) {
  2130. var i, m Tsize_t
  2131. var v1 uint32
  2132. var p3 uintptr
  2133. _, _, _, _ = i, m, v1, p3
  2134. /* fill rs_buf with the keystream */
  2135. _chacha_encrypt_bytes(tls, _rsx, _rsx+64, _rsx+64, uint32(1024))
  2136. /* mix in optional user provided data */
  2137. if dat != 0 {
  2138. if datlen < libc.Uint32FromInt32(libc.Int32FromInt32(m_KEYSZ)+libc.Int32FromInt32(m_IVSZ)) {
  2139. v1 = datlen
  2140. } else {
  2141. v1 = libc.Uint32FromInt32(libc.Int32FromInt32(m_KEYSZ) + libc.Int32FromInt32(m_IVSZ))
  2142. }
  2143. m = v1
  2144. i = uint32(0)
  2145. for {
  2146. if !(i < m) {
  2147. break
  2148. }
  2149. p3 = _rsx + 64 + uintptr(i)
  2150. *(*uint8)(unsafe.Pointer(p3)) = uint8(int32(*(*uint8)(unsafe.Pointer(p3))) ^ libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(dat + uintptr(i)))))
  2151. goto _2
  2152. _2:
  2153. ;
  2154. i++
  2155. }
  2156. }
  2157. /* immediately reinit for backtracking resistance */
  2158. __rs_init(tls, _rsx+64, libc.Uint32FromInt32(libc.Int32FromInt32(m_KEYSZ)+libc.Int32FromInt32(m_IVSZ)))
  2159. libc.Xmemset(tls, _rsx+64, 0, libc.Uint32FromInt32(libc.Int32FromInt32(m_KEYSZ)+libc.Int32FromInt32(m_IVSZ)))
  2160. (*T_rs)(unsafe.Pointer(_rs)).Frs_have = libc.Uint32FromInt64(1024) - libc.Uint32FromInt32(m_KEYSZ) - libc.Uint32FromInt32(m_IVSZ)
  2161. }
  2162. func __rs_stir(tls *libc.TLS) {
  2163. bp := tls.Alloc(48)
  2164. defer tls.Free(48)
  2165. var _ /* rekey_fuzz at bp+40 */ Tuint32_t
  2166. var _ /* rnd at bp+0 */ [40]uint8
  2167. *(*Tuint32_t)(unsafe.Pointer(bp + 40)) = uint32(0)
  2168. if Xgetentropy(tls, bp, uint32(40)) == -int32(1) {
  2169. libc.Xraise(tls, int32(m_SIGKILL))
  2170. }
  2171. if !(_rs != 0) {
  2172. __rs_init(tls, bp, uint32(40))
  2173. } else {
  2174. __rs_rekey(tls, bp, uint32(40))
  2175. }
  2176. Xexplicit_bzero(tls, bp, uint32(40)) /* discard source seed */
  2177. /* invalidate rs_buf */
  2178. (*T_rs)(unsafe.Pointer(_rs)).Frs_have = uint32(0)
  2179. libc.Xmemset(tls, _rsx+64, 0, uint32(1024))
  2180. /* rekey interval should not be predictable */
  2181. _chacha_encrypt_bytes(tls, _rsx, bp+40, bp+40, uint32(4))
  2182. (*T_rs)(unsafe.Pointer(_rs)).Frs_count = libc.Uint32FromInt32(libc.Int32FromInt32(1024)*libc.Int32FromInt32(1024)) + *(*Tuint32_t)(unsafe.Pointer(bp + 40))%libc.Uint32FromInt32(libc.Int32FromInt32(1024)*libc.Int32FromInt32(1024))
  2183. }
  2184. func __rs_stir_if_needed(tls *libc.TLS, len1 Tsize_t) {
  2185. __rs_forkdetect(tls)
  2186. if !(_rs != 0) || (*T_rs)(unsafe.Pointer(_rs)).Frs_count <= len1 {
  2187. __rs_stir(tls)
  2188. }
  2189. if (*T_rs)(unsafe.Pointer(_rs)).Frs_count <= len1 {
  2190. (*T_rs)(unsafe.Pointer(_rs)).Frs_count = uint32(0)
  2191. } else {
  2192. *(*Tsize_t)(unsafe.Pointer(_rs + 4)) -= len1
  2193. }
  2194. }
  2195. func __rs_random_buf(tls *libc.TLS, _buf uintptr, n Tsize_t) {
  2196. var buf, keystream uintptr
  2197. var m Tsize_t
  2198. var v1 uint32
  2199. _, _, _, _ = buf, keystream, m, v1
  2200. buf = _buf
  2201. __rs_stir_if_needed(tls, n)
  2202. for n > uint32(0) {
  2203. if (*T_rs)(unsafe.Pointer(_rs)).Frs_have > uint32(0) {
  2204. if n < (*T_rs)(unsafe.Pointer(_rs)).Frs_have {
  2205. v1 = n
  2206. } else {
  2207. v1 = (*T_rs)(unsafe.Pointer(_rs)).Frs_have
  2208. }
  2209. m = v1
  2210. keystream = _rsx + 64 + uintptr(1024) - uintptr((*T_rs)(unsafe.Pointer(_rs)).Frs_have)
  2211. libc.Xmemcpy(tls, buf, keystream, m)
  2212. libc.Xmemset(tls, keystream, 0, m)
  2213. buf += uintptr(m)
  2214. n -= m
  2215. *(*Tsize_t)(unsafe.Pointer(_rs)) -= m
  2216. }
  2217. if (*T_rs)(unsafe.Pointer(_rs)).Frs_have == uint32(0) {
  2218. __rs_rekey(tls, libc.UintptrFromInt32(0), uint32(0))
  2219. }
  2220. }
  2221. }
  2222. func __rs_random_u32(tls *libc.TLS, val uintptr) {
  2223. var keystream uintptr
  2224. _ = keystream
  2225. __rs_stir_if_needed(tls, uint32(4))
  2226. if (*T_rs)(unsafe.Pointer(_rs)).Frs_have < uint32(4) {
  2227. __rs_rekey(tls, libc.UintptrFromInt32(0), uint32(0))
  2228. }
  2229. keystream = _rsx + 64 + uintptr(1024) - uintptr((*T_rs)(unsafe.Pointer(_rs)).Frs_have)
  2230. libc.Xmemcpy(tls, val, keystream, uint32(4))
  2231. libc.Xmemset(tls, keystream, 0, uint32(4))
  2232. *(*Tsize_t)(unsafe.Pointer(_rs)) -= uint32(4)
  2233. }
  2234. func Xarc4random_stir(tls *libc.TLS) {
  2235. libc.Xpthread_mutex_lock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2236. __rs_stir(tls)
  2237. libc.Xpthread_mutex_unlock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2238. }
  2239. func Xarc4random_addrandom(tls *libc.TLS, dat uintptr, datlen int32) {
  2240. libc.Xpthread_mutex_lock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2241. __rs_stir_if_needed(tls, libc.Uint32FromInt32(datlen))
  2242. __rs_rekey(tls, dat, libc.Uint32FromInt32(datlen))
  2243. libc.Xpthread_mutex_unlock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2244. }
  2245. func Xarc4random(tls *libc.TLS) (r Tuint32_t) {
  2246. bp := tls.Alloc(16)
  2247. defer tls.Free(16)
  2248. var _ /* val at bp+0 */ Tuint32_t
  2249. libc.Xpthread_mutex_lock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2250. __rs_random_u32(tls, bp)
  2251. libc.Xpthread_mutex_unlock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2252. return *(*Tuint32_t)(unsafe.Pointer(bp))
  2253. }
  2254. func Xarc4random_buf(tls *libc.TLS, buf uintptr, n Tsize_t) {
  2255. libc.Xpthread_mutex_lock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2256. __rs_random_buf(tls, buf, n)
  2257. libc.Xpthread_mutex_unlock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2258. }
  2259. // C documentation
  2260. //
  2261. // /*
  2262. // * Calculate a uniformly distributed random number less than upper_bound
  2263. // * avoiding "modulo bias".
  2264. // *
  2265. // * Uniformity is achieved by generating new random numbers until the one
  2266. // * returned is outside the range [0, 2**32 % upper_bound). This
  2267. // * guarantees the selected random number will be inside
  2268. // * [2**32 % upper_bound, 2**32) which maps back to [0, upper_bound)
  2269. // * after reduction modulo upper_bound.
  2270. // */
  2271. func Xarc4random_uniform(tls *libc.TLS, upper_bound Tuint32_t) (r1 Tuint32_t) {
  2272. var min, r Tuint32_t
  2273. _, _ = min, r
  2274. if upper_bound < uint32(2) {
  2275. return uint32(0)
  2276. }
  2277. /* 2**32 % x == (2**32 - x) % x */
  2278. min = -upper_bound % upper_bound
  2279. /*
  2280. * This could theoretically loop forever but each retry has
  2281. * p > 0.5 (worst case, usually far better) of selecting a
  2282. * number inside the range we need, so it should rarely need
  2283. * to re-roll.
  2284. */
  2285. for {
  2286. r = Xarc4random(tls)
  2287. if r >= min {
  2288. break
  2289. }
  2290. goto _1
  2291. _1:
  2292. }
  2293. return r % upper_bound
  2294. }
  2295. const m_SEEK_CUR = 1
  2296. const m_SEEK_END = 2
  2297. const m_SEEK_SET = 0
  2298. const m_no_argument = 0
  2299. const m_optional_argument = 2
  2300. const m_required_argument = 1
  2301. type Toption = struct {
  2302. Fname uintptr
  2303. Fhas_arg int32
  2304. Fflag uintptr
  2305. Fval int32
  2306. }
  2307. func Xbsd_getopt(tls *libc.TLS, argc int32, argv uintptr, shortopts uintptr) (r int32) {
  2308. if Xoptreset == int32(1) {
  2309. Xoptreset = 0
  2310. libc.Xoptind = 0
  2311. }
  2312. /*
  2313. * Make sure we are using the system getopt() and not a possible
  2314. * overlay macro.
  2315. */
  2316. return libc.Xgetopt(tls, argc, argv, shortopts)
  2317. }
  2318. const m_DT_BLK = 6
  2319. const m_DT_CHR = 2
  2320. const m_DT_DIR = 4
  2321. const m_DT_FIFO = 1
  2322. const m_DT_LNK = 10
  2323. const m_DT_REG = 8
  2324. const m_DT_SOCK = 12
  2325. const m_DT_UNKNOWN = 0
  2326. const m_DT_WHT = 14
  2327. const m_E2BIG = 7
  2328. const m_EACCES = 13
  2329. const m_EADDRINUSE = 98
  2330. const m_EADDRNOTAVAIL = 99
  2331. const m_EADV = 68
  2332. const m_EAFNOSUPPORT = 97
  2333. const m_EAGAIN = 11
  2334. const m_EALREADY = 114
  2335. const m_EBADE = 52
  2336. const m_EBADF = 9
  2337. const m_EBADFD = 77
  2338. const m_EBADMSG = 74
  2339. const m_EBADR = 53
  2340. const m_EBADRQC = 56
  2341. const m_EBADSLT = 57
  2342. const m_EBFONT = 59
  2343. const m_EBUSY = 16
  2344. const m_ECANCELED = 125
  2345. const m_ECHILD = 10
  2346. const m_ECHRNG = 44
  2347. const m_ECOMM = 70
  2348. const m_ECONNABORTED = 103
  2349. const m_ECONNREFUSED = 111
  2350. const m_ECONNRESET = 104
  2351. const m_EDEADLK = 35
  2352. const m_EDEADLOCK = "EDEADLK"
  2353. const m_EDESTADDRREQ = 89
  2354. const m_EDOM = 33
  2355. const m_EDOTDOT = 73
  2356. const m_EDQUOT = 122
  2357. const m_EEXIST = 17
  2358. const m_EFAULT = 14
  2359. const m_EFBIG = 27
  2360. const m_EHOSTDOWN = 112
  2361. const m_EHOSTUNREACH = 113
  2362. const m_EHWPOISON = 133
  2363. const m_EIDRM = 43
  2364. const m_EILSEQ = 84
  2365. const m_EINPROGRESS = 115
  2366. const m_EINTR = 4
  2367. const m_EINVAL = 22
  2368. const m_EIO = 5
  2369. const m_EISCONN = 106
  2370. const m_EISDIR = 21
  2371. const m_EISNAM = 120
  2372. const m_EKEYEXPIRED = 127
  2373. const m_EKEYREJECTED = 129
  2374. const m_EKEYREVOKED = 128
  2375. const m_EL2HLT = 51
  2376. const m_EL2NSYNC = 45
  2377. const m_EL3HLT = 46
  2378. const m_EL3RST = 47
  2379. const m_ELIBACC = 79
  2380. const m_ELIBBAD = 80
  2381. const m_ELIBEXEC = 83
  2382. const m_ELIBMAX = 82
  2383. const m_ELIBSCN = 81
  2384. const m_ELNRNG = 48
  2385. const m_ELOOP = 40
  2386. const m_EMEDIUMTYPE = 124
  2387. const m_EMFILE = 24
  2388. const m_EMLINK = 31
  2389. const m_EMSGSIZE = 90
  2390. const m_EMULTIHOP = 72
  2391. const m_ENAMETOOLONG = 36
  2392. const m_ENAVAIL = 119
  2393. const m_ENETDOWN = 100
  2394. const m_ENETRESET = 102
  2395. const m_ENETUNREACH = 101
  2396. const m_ENFILE = 23
  2397. const m_ENOANO = 55
  2398. const m_ENOBUFS = 105
  2399. const m_ENOCSI = 50
  2400. const m_ENODATA = 61
  2401. const m_ENODEV = 19
  2402. const m_ENOENT = 2
  2403. const m_ENOEXEC = 8
  2404. const m_ENOKEY = 126
  2405. const m_ENOLCK = 37
  2406. const m_ENOLINK = 67
  2407. const m_ENOMEDIUM = 123
  2408. const m_ENOMEM = 12
  2409. const m_ENOMSG = 42
  2410. const m_ENONET = 64
  2411. const m_ENOPKG = 65
  2412. const m_ENOPROTOOPT = 92
  2413. const m_ENOSPC = 28
  2414. const m_ENOSR = 63
  2415. const m_ENOSTR = 60
  2416. const m_ENOSYS = 38
  2417. const m_ENOTBLK = 15
  2418. const m_ENOTCONN = 107
  2419. const m_ENOTDIR = 20
  2420. const m_ENOTEMPTY = 39
  2421. const m_ENOTNAM = 118
  2422. const m_ENOTRECOVERABLE = 131
  2423. const m_ENOTSOCK = 88
  2424. const m_ENOTSUP = "EOPNOTSUPP"
  2425. const m_ENOTTY = 25
  2426. const m_ENOTUNIQ = 76
  2427. const m_ENXIO = 6
  2428. const m_EOPNOTSUPP = 95
  2429. const m_EOVERFLOW = 75
  2430. const m_EOWNERDEAD = 130
  2431. const m_EPERM = 1
  2432. const m_EPFNOSUPPORT = 96
  2433. const m_EPIPE = 32
  2434. const m_EPROTO = 71
  2435. const m_EPROTONOSUPPORT = 93
  2436. const m_EPROTOTYPE = 91
  2437. const m_ERANGE = 34
  2438. const m_EREMCHG = 78
  2439. const m_EREMOTE = 66
  2440. const m_EREMOTEIO = 121
  2441. const m_ERESTART = 85
  2442. const m_ERFKILL = 132
  2443. const m_EROFS = 30
  2444. const m_ESHUTDOWN = 108
  2445. const m_ESOCKTNOSUPPORT = 94
  2446. const m_ESPIPE = 29
  2447. const m_ESRCH = 3
  2448. const m_ESRMNT = 69
  2449. const m_ESTALE = 116
  2450. const m_ESTRPIPE = 86
  2451. const m_ETIME = 62
  2452. const m_ETIMEDOUT = 110
  2453. const m_ETOOMANYREFS = 109
  2454. const m_ETXTBSY = 26
  2455. const m_EUCLEAN = 117
  2456. const m_EUNATCH = 49
  2457. const m_EUSERS = 87
  2458. const m_EWOULDBLOCK = "EAGAIN"
  2459. const m_EXDEV = 18
  2460. const m_EXFULL = 54
  2461. const m_INT_MAX1 = 2147483647
  2462. const m_OPEN_MAX = 256
  2463. const m_SYS__llseek = 140
  2464. const m_SYS__newselect = 142
  2465. const m_SYS__sysctl = 149
  2466. const m_SYS_accept = 285
  2467. const m_SYS_accept4 = 366
  2468. const m_SYS_access = 33
  2469. const m_SYS_acct = 51
  2470. const m_SYS_add_key = 309
  2471. const m_SYS_adjtimex = 124
  2472. const m_SYS_arm_fadvise64_64 = 270
  2473. const m_SYS_arm_sync_file_range = 341
  2474. const m_SYS_bdflush = 134
  2475. const m_SYS_bind = 282
  2476. const m_SYS_bpf = 386
  2477. const m_SYS_brk = 45
  2478. const m_SYS_cachestat = 451
  2479. const m_SYS_capget = 184
  2480. const m_SYS_capset = 185
  2481. const m_SYS_chdir = 12
  2482. const m_SYS_chmod = 15
  2483. const m_SYS_chown = 182
  2484. const m_SYS_chown32 = 212
  2485. const m_SYS_chroot = 61
  2486. const m_SYS_clock_adjtime = 372
  2487. const m_SYS_clock_adjtime64 = 405
  2488. const m_SYS_clock_getres_time32 = 264
  2489. const m_SYS_clock_getres_time64 = 406
  2490. const m_SYS_clock_gettime32 = 263
  2491. const m_SYS_clock_gettime64 = 403
  2492. const m_SYS_clock_nanosleep_time32 = 265
  2493. const m_SYS_clock_nanosleep_time64 = 407
  2494. const m_SYS_clock_settime32 = 262
  2495. const m_SYS_clock_settime64 = 404
  2496. const m_SYS_clone = 120
  2497. const m_SYS_clone3 = 435
  2498. const m_SYS_close = 6
  2499. const m_SYS_close_range = 436
  2500. const m_SYS_connect = 283
  2501. const m_SYS_copy_file_range = 391
  2502. const m_SYS_creat = 8
  2503. const m_SYS_delete_module = 129
  2504. const m_SYS_dup = 41
  2505. const m_SYS_dup2 = 63
  2506. const m_SYS_dup3 = 358
  2507. const m_SYS_epoll_create = 250
  2508. const m_SYS_epoll_create1 = 357
  2509. const m_SYS_epoll_ctl = 251
  2510. const m_SYS_epoll_pwait = 346
  2511. const m_SYS_epoll_pwait2 = 441
  2512. const m_SYS_epoll_wait = 252
  2513. const m_SYS_eventfd = 351
  2514. const m_SYS_eventfd2 = 356
  2515. const m_SYS_execve = 11
  2516. const m_SYS_execveat = 387
  2517. const m_SYS_exit = 1
  2518. const m_SYS_exit_group = 248
  2519. const m_SYS_faccessat = 334
  2520. const m_SYS_faccessat2 = 439
  2521. const m_SYS_fadvise64_64 = 270
  2522. const m_SYS_fallocate = 352
  2523. const m_SYS_fanotify_init = 367
  2524. const m_SYS_fanotify_mark = 368
  2525. const m_SYS_fchdir = 133
  2526. const m_SYS_fchmod = 94
  2527. const m_SYS_fchmodat = 333
  2528. const m_SYS_fchmodat2 = 452
  2529. const m_SYS_fchown = 95
  2530. const m_SYS_fchown32 = 207
  2531. const m_SYS_fchownat = 325
  2532. const m_SYS_fcntl = 55
  2533. const m_SYS_fcntl64 = 221
  2534. const m_SYS_fdatasync = 148
  2535. const m_SYS_fgetxattr = 231
  2536. const m_SYS_finit_module = 379
  2537. const m_SYS_flistxattr = 234
  2538. const m_SYS_flock = 143
  2539. const m_SYS_fork = 2
  2540. const m_SYS_fremovexattr = 237
  2541. const m_SYS_fsconfig = 431
  2542. const m_SYS_fsetxattr = 228
  2543. const m_SYS_fsmount = 432
  2544. const m_SYS_fsopen = 430
  2545. const m_SYS_fspick = 433
  2546. const m_SYS_fstat = 108
  2547. const m_SYS_fstat64 = 197
  2548. const m_SYS_fstatat64 = 327
  2549. const m_SYS_fstatfs = 100
  2550. const m_SYS_fstatfs64 = 267
  2551. const m_SYS_fsync = 118
  2552. const m_SYS_ftruncate = 93
  2553. const m_SYS_ftruncate64 = 194
  2554. const m_SYS_futex = 240
  2555. const m_SYS_futex_time64 = 422
  2556. const m_SYS_futex_waitv = 449
  2557. const m_SYS_futimesat = 326
  2558. const m_SYS_get_mempolicy = 320
  2559. const m_SYS_get_robust_list = 339
  2560. const m_SYS_getcpu = 345
  2561. const m_SYS_getcwd = 183
  2562. const m_SYS_getdents = 141
  2563. const m_SYS_getdents64 = 217
  2564. const m_SYS_getegid = 50
  2565. const m_SYS_getegid32 = 202
  2566. const m_SYS_geteuid = 49
  2567. const m_SYS_geteuid32 = 201
  2568. const m_SYS_getgid = 47
  2569. const m_SYS_getgid32 = 200
  2570. const m_SYS_getgroups = 80
  2571. const m_SYS_getgroups32 = 205
  2572. const m_SYS_getitimer = 105
  2573. const m_SYS_getpeername = 287
  2574. const m_SYS_getpgid = 132
  2575. const m_SYS_getpgrp = 65
  2576. const m_SYS_getpid = 20
  2577. const m_SYS_getppid = 64
  2578. const m_SYS_getpriority = 96
  2579. const m_SYS_getrandom = 384
  2580. const m_SYS_getresgid = 171
  2581. const m_SYS_getresgid32 = 211
  2582. const m_SYS_getresuid = 165
  2583. const m_SYS_getresuid32 = 209
  2584. const m_SYS_getrusage = 77
  2585. const m_SYS_getsid = 147
  2586. const m_SYS_getsockname = 286
  2587. const m_SYS_getsockopt = 295
  2588. const m_SYS_gettid = 224
  2589. const m_SYS_gettimeofday_time32 = 78
  2590. const m_SYS_getuid = 24
  2591. const m_SYS_getuid32 = 199
  2592. const m_SYS_getxattr = 229
  2593. const m_SYS_init_module = 128
  2594. const m_SYS_inotify_add_watch = 317
  2595. const m_SYS_inotify_init = 316
  2596. const m_SYS_inotify_init1 = 360
  2597. const m_SYS_inotify_rm_watch = 318
  2598. const m_SYS_io_cancel = 247
  2599. const m_SYS_io_destroy = 244
  2600. const m_SYS_io_getevents = 245
  2601. const m_SYS_io_pgetevents = 399
  2602. const m_SYS_io_pgetevents_time64 = 416
  2603. const m_SYS_io_setup = 243
  2604. const m_SYS_io_submit = 246
  2605. const m_SYS_io_uring_enter = 426
  2606. const m_SYS_io_uring_register = 427
  2607. const m_SYS_io_uring_setup = 425
  2608. const m_SYS_ioctl = 54
  2609. const m_SYS_ioprio_get = 315
  2610. const m_SYS_ioprio_set = 314
  2611. const m_SYS_kcmp = 378
  2612. const m_SYS_kexec_file_load = 401
  2613. const m_SYS_kexec_load = 347
  2614. const m_SYS_keyctl = 311
  2615. const m_SYS_kill = 37
  2616. const m_SYS_landlock_add_rule = 445
  2617. const m_SYS_landlock_create_ruleset = 444
  2618. const m_SYS_landlock_restrict_self = 446
  2619. const m_SYS_lchown = 16
  2620. const m_SYS_lchown32 = 198
  2621. const m_SYS_lgetxattr = 230
  2622. const m_SYS_link = 9
  2623. const m_SYS_linkat = 330
  2624. const m_SYS_listen = 284
  2625. const m_SYS_listxattr = 232
  2626. const m_SYS_llistxattr = 233
  2627. const m_SYS_lookup_dcookie = 249
  2628. const m_SYS_lremovexattr = 236
  2629. const m_SYS_lseek = 19
  2630. const m_SYS_lsetxattr = 227
  2631. const m_SYS_lstat = 107
  2632. const m_SYS_lstat64 = 196
  2633. const m_SYS_madvise = 220
  2634. const m_SYS_mbind = 319
  2635. const m_SYS_membarrier = 389
  2636. const m_SYS_memfd_create = 385
  2637. const m_SYS_migrate_pages = 400
  2638. const m_SYS_mincore = 219
  2639. const m_SYS_mkdir = 39
  2640. const m_SYS_mkdirat = 323
  2641. const m_SYS_mknod = 14
  2642. const m_SYS_mknodat = 324
  2643. const m_SYS_mlock = 150
  2644. const m_SYS_mlock2 = 390
  2645. const m_SYS_mlockall = 152
  2646. const m_SYS_mmap2 = 192
  2647. const m_SYS_mount = 21
  2648. const m_SYS_mount_setattr = 442
  2649. const m_SYS_move_mount = 429
  2650. const m_SYS_move_pages = 344
  2651. const m_SYS_mprotect = 125
  2652. const m_SYS_mq_getsetattr = 279
  2653. const m_SYS_mq_notify = 278
  2654. const m_SYS_mq_open = 274
  2655. const m_SYS_mq_timedreceive = 277
  2656. const m_SYS_mq_timedreceive_time64 = 419
  2657. const m_SYS_mq_timedsend = 276
  2658. const m_SYS_mq_timedsend_time64 = 418
  2659. const m_SYS_mq_unlink = 275
  2660. const m_SYS_mremap = 163
  2661. const m_SYS_msgctl = 304
  2662. const m_SYS_msgget = 303
  2663. const m_SYS_msgrcv = 302
  2664. const m_SYS_msgsnd = 301
  2665. const m_SYS_msync = 144
  2666. const m_SYS_munlock = 151
  2667. const m_SYS_munlockall = 153
  2668. const m_SYS_munmap = 91
  2669. const m_SYS_name_to_handle_at = 370
  2670. const m_SYS_nanosleep = 162
  2671. const m_SYS_nfsservctl = 169
  2672. const m_SYS_nice = 34
  2673. const m_SYS_open = 5
  2674. const m_SYS_open_by_handle_at = 371
  2675. const m_SYS_open_tree = 428
  2676. const m_SYS_openat = 322
  2677. const m_SYS_openat2 = 437
  2678. const m_SYS_pause = 29
  2679. const m_SYS_pciconfig_iobase = 271
  2680. const m_SYS_pciconfig_read = 272
  2681. const m_SYS_pciconfig_write = 273
  2682. const m_SYS_perf_event_open = 364
  2683. const m_SYS_personality = 136
  2684. const m_SYS_pidfd_getfd = 438
  2685. const m_SYS_pidfd_open = 434
  2686. const m_SYS_pidfd_send_signal = 424
  2687. const m_SYS_pipe = 42
  2688. const m_SYS_pipe2 = 359
  2689. const m_SYS_pivot_root = 218
  2690. const m_SYS_pkey_alloc = 395
  2691. const m_SYS_pkey_free = 396
  2692. const m_SYS_pkey_mprotect = 394
  2693. const m_SYS_poll = 168
  2694. const m_SYS_ppoll = 336
  2695. const m_SYS_ppoll_time64 = 414
  2696. const m_SYS_prctl = 172
  2697. const m_SYS_pread64 = 180
  2698. const m_SYS_preadv = 361
  2699. const m_SYS_preadv2 = 392
  2700. const m_SYS_prlimit64 = 369
  2701. const m_SYS_process_madvise = 440
  2702. const m_SYS_process_mrelease = 448
  2703. const m_SYS_process_vm_readv = 376
  2704. const m_SYS_process_vm_writev = 377
  2705. const m_SYS_pselect6 = 335
  2706. const m_SYS_pselect6_time64 = 413
  2707. const m_SYS_ptrace = 26
  2708. const m_SYS_pwrite64 = 181
  2709. const m_SYS_pwritev = 362
  2710. const m_SYS_pwritev2 = 393
  2711. const m_SYS_quotactl = 131
  2712. const m_SYS_read = 3
  2713. const m_SYS_readahead = 225
  2714. const m_SYS_readlink = 85
  2715. const m_SYS_readlinkat = 332
  2716. const m_SYS_readv = 145
  2717. const m_SYS_reboot = 88
  2718. const m_SYS_recv = 291
  2719. const m_SYS_recvfrom = 292
  2720. const m_SYS_recvmmsg = 365
  2721. const m_SYS_recvmmsg_time64 = 417
  2722. const m_SYS_recvmsg = 297
  2723. const m_SYS_remap_file_pages = 253
  2724. const m_SYS_removexattr = 235
  2725. const m_SYS_rename = 38
  2726. const m_SYS_renameat = 329
  2727. const m_SYS_renameat2 = 382
  2728. const m_SYS_request_key = 310
  2729. const m_SYS_restart_syscall = 0
  2730. const m_SYS_rmdir = 40
  2731. const m_SYS_rseq = 398
  2732. const m_SYS_rt_sigaction = 174
  2733. const m_SYS_rt_sigpending = 176
  2734. const m_SYS_rt_sigprocmask = 175
  2735. const m_SYS_rt_sigqueueinfo = 178
  2736. const m_SYS_rt_sigreturn = 173
  2737. const m_SYS_rt_sigsuspend = 179
  2738. const m_SYS_rt_sigtimedwait = 177
  2739. const m_SYS_rt_sigtimedwait_time64 = 421
  2740. const m_SYS_rt_tgsigqueueinfo = 363
  2741. const m_SYS_sched_get_priority_max = 159
  2742. const m_SYS_sched_get_priority_min = 160
  2743. const m_SYS_sched_getaffinity = 242
  2744. const m_SYS_sched_getattr = 381
  2745. const m_SYS_sched_getparam = 155
  2746. const m_SYS_sched_getscheduler = 157
  2747. const m_SYS_sched_rr_get_interval = 161
  2748. const m_SYS_sched_rr_get_interval_time64 = 423
  2749. const m_SYS_sched_setaffinity = 241
  2750. const m_SYS_sched_setattr = 380
  2751. const m_SYS_sched_setparam = 154
  2752. const m_SYS_sched_setscheduler = 156
  2753. const m_SYS_sched_yield = 158
  2754. const m_SYS_seccomp = 383
  2755. const m_SYS_semctl = 300
  2756. const m_SYS_semget = 299
  2757. const m_SYS_semop = 298
  2758. const m_SYS_semtimedop = 312
  2759. const m_SYS_semtimedop_time64 = 420
  2760. const m_SYS_send = 289
  2761. const m_SYS_sendfile = 187
  2762. const m_SYS_sendfile64 = 239
  2763. const m_SYS_sendmmsg = 374
  2764. const m_SYS_sendmsg = 296
  2765. const m_SYS_sendto = 290
  2766. const m_SYS_set_mempolicy = 321
  2767. const m_SYS_set_mempolicy_home_node = 450
  2768. const m_SYS_set_robust_list = 338
  2769. const m_SYS_set_tid_address = 256
  2770. const m_SYS_setdomainname = 121
  2771. const m_SYS_setfsgid = 139
  2772. const m_SYS_setfsgid32 = 216
  2773. const m_SYS_setfsuid = 138
  2774. const m_SYS_setfsuid32 = 215
  2775. const m_SYS_setgid = 46
  2776. const m_SYS_setgid32 = 214
  2777. const m_SYS_setgroups = 81
  2778. const m_SYS_setgroups32 = 206
  2779. const m_SYS_sethostname = 74
  2780. const m_SYS_setitimer = 104
  2781. const m_SYS_setns = 375
  2782. const m_SYS_setpgid = 57
  2783. const m_SYS_setpriority = 97
  2784. const m_SYS_setregid = 71
  2785. const m_SYS_setregid32 = 204
  2786. const m_SYS_setresgid = 170
  2787. const m_SYS_setresgid32 = 210
  2788. const m_SYS_setresuid = 164
  2789. const m_SYS_setresuid32 = 208
  2790. const m_SYS_setreuid = 70
  2791. const m_SYS_setreuid32 = 203
  2792. const m_SYS_setrlimit = 75
  2793. const m_SYS_setsid = 66
  2794. const m_SYS_setsockopt = 294
  2795. const m_SYS_settimeofday_time32 = 79
  2796. const m_SYS_setuid = 23
  2797. const m_SYS_setuid32 = 213
  2798. const m_SYS_setxattr = 226
  2799. const m_SYS_shmat = 305
  2800. const m_SYS_shmctl = 308
  2801. const m_SYS_shmdt = 306
  2802. const m_SYS_shmget = 307
  2803. const m_SYS_shutdown = 293
  2804. const m_SYS_sigaction = 67
  2805. const m_SYS_sigaltstack = 186
  2806. const m_SYS_signalfd = 349
  2807. const m_SYS_signalfd4 = 355
  2808. const m_SYS_sigpending = 73
  2809. const m_SYS_sigprocmask = 126
  2810. const m_SYS_sigreturn = 119
  2811. const m_SYS_sigsuspend = 72
  2812. const m_SYS_socket = 281
  2813. const m_SYS_socketpair = 288
  2814. const m_SYS_splice = 340
  2815. const m_SYS_stat = 106
  2816. const m_SYS_stat64 = 195
  2817. const m_SYS_statfs = 99
  2818. const m_SYS_statfs64 = 266
  2819. const m_SYS_statx = 397
  2820. const m_SYS_swapoff = 115
  2821. const m_SYS_swapon = 87
  2822. const m_SYS_symlink = 83
  2823. const m_SYS_symlinkat = 331
  2824. const m_SYS_sync = 36
  2825. const m_SYS_sync_file_range2 = 341
  2826. const m_SYS_syncfs = 373
  2827. const m_SYS_sysfs = 135
  2828. const m_SYS_sysinfo = 116
  2829. const m_SYS_syslog = 103
  2830. const m_SYS_tee = 342
  2831. const m_SYS_tgkill = 268
  2832. const m_SYS_timer_create = 257
  2833. const m_SYS_timer_delete = 261
  2834. const m_SYS_timer_getoverrun = 260
  2835. const m_SYS_timer_gettime32 = 259
  2836. const m_SYS_timer_gettime64 = 408
  2837. const m_SYS_timer_settime32 = 258
  2838. const m_SYS_timer_settime64 = 409
  2839. const m_SYS_timerfd_create = 350
  2840. const m_SYS_timerfd_gettime32 = 354
  2841. const m_SYS_timerfd_gettime64 = 410
  2842. const m_SYS_timerfd_settime32 = 353
  2843. const m_SYS_timerfd_settime64 = 411
  2844. const m_SYS_times = 43
  2845. const m_SYS_tkill = 238
  2846. const m_SYS_truncate = 92
  2847. const m_SYS_truncate64 = 193
  2848. const m_SYS_ugetrlimit = 191
  2849. const m_SYS_umask = 60
  2850. const m_SYS_umount2 = 52
  2851. const m_SYS_uname = 122
  2852. const m_SYS_unlink = 10
  2853. const m_SYS_unlinkat = 328
  2854. const m_SYS_unshare = 337
  2855. const m_SYS_uselib = 86
  2856. const m_SYS_userfaultfd = 388
  2857. const m_SYS_ustat = 62
  2858. const m_SYS_utimensat = 348
  2859. const m_SYS_utimensat_time64 = 412
  2860. const m_SYS_utimes = 269
  2861. const m_SYS_vfork = 190
  2862. const m_SYS_vhangup = 111
  2863. const m_SYS_vmsplice = 343
  2864. const m_SYS_vserver = 313
  2865. const m_SYS_wait4 = 114
  2866. const m_SYS_waitid = 280
  2867. const m_SYS_write = 4
  2868. const m_SYS_writev = 146
  2869. const m_UINT_MAX1 = 4294967295
  2870. const m___ARM_NR_breakpoint = 0x0f0001
  2871. const m___ARM_NR_cacheflush = 0x0f0002
  2872. const m___ARM_NR_get_tls = 0x0f0006
  2873. const m___ARM_NR_set_tls = 0x0f0005
  2874. const m___ARM_NR_usr26 = 0x0f0003
  2875. const m___ARM_NR_usr32 = 0x0f0004
  2876. const m___NR__llseek = 140
  2877. const m___NR__newselect = 142
  2878. const m___NR__sysctl = 149
  2879. const m___NR_accept = 285
  2880. const m___NR_accept4 = 366
  2881. const m___NR_access = 33
  2882. const m___NR_acct = 51
  2883. const m___NR_add_key = 309
  2884. const m___NR_adjtimex = 124
  2885. const m___NR_arm_fadvise64_64 = 270
  2886. const m___NR_arm_sync_file_range = 341
  2887. const m___NR_bdflush = 134
  2888. const m___NR_bind = 282
  2889. const m___NR_bpf = 386
  2890. const m___NR_brk = 45
  2891. const m___NR_cachestat = 451
  2892. const m___NR_capget = 184
  2893. const m___NR_capset = 185
  2894. const m___NR_chdir = 12
  2895. const m___NR_chmod = 15
  2896. const m___NR_chown = 182
  2897. const m___NR_chown32 = 212
  2898. const m___NR_chroot = 61
  2899. const m___NR_clock_adjtime = 372
  2900. const m___NR_clock_adjtime64 = 405
  2901. const m___NR_clock_getres_time32 = 264
  2902. const m___NR_clock_getres_time64 = 406
  2903. const m___NR_clock_gettime32 = 263
  2904. const m___NR_clock_gettime64 = 403
  2905. const m___NR_clock_nanosleep_time32 = 265
  2906. const m___NR_clock_nanosleep_time64 = 407
  2907. const m___NR_clock_settime32 = 262
  2908. const m___NR_clock_settime64 = 404
  2909. const m___NR_clone = 120
  2910. const m___NR_clone3 = 435
  2911. const m___NR_close = 6
  2912. const m___NR_close_range = 436
  2913. const m___NR_connect = 283
  2914. const m___NR_copy_file_range = 391
  2915. const m___NR_creat = 8
  2916. const m___NR_delete_module = 129
  2917. const m___NR_dup = 41
  2918. const m___NR_dup2 = 63
  2919. const m___NR_dup3 = 358
  2920. const m___NR_epoll_create = 250
  2921. const m___NR_epoll_create1 = 357
  2922. const m___NR_epoll_ctl = 251
  2923. const m___NR_epoll_pwait = 346
  2924. const m___NR_epoll_pwait2 = 441
  2925. const m___NR_epoll_wait = 252
  2926. const m___NR_eventfd = 351
  2927. const m___NR_eventfd2 = 356
  2928. const m___NR_execve = 11
  2929. const m___NR_execveat = 387
  2930. const m___NR_exit = 1
  2931. const m___NR_exit_group = 248
  2932. const m___NR_faccessat = 334
  2933. const m___NR_faccessat2 = 439
  2934. const m___NR_fadvise64_64 = 270
  2935. const m___NR_fallocate = 352
  2936. const m___NR_fanotify_init = 367
  2937. const m___NR_fanotify_mark = 368
  2938. const m___NR_fchdir = 133
  2939. const m___NR_fchmod = 94
  2940. const m___NR_fchmodat = 333
  2941. const m___NR_fchmodat2 = 452
  2942. const m___NR_fchown = 95
  2943. const m___NR_fchown32 = 207
  2944. const m___NR_fchownat = 325
  2945. const m___NR_fcntl = 55
  2946. const m___NR_fcntl64 = 221
  2947. const m___NR_fdatasync = 148
  2948. const m___NR_fgetxattr = 231
  2949. const m___NR_finit_module = 379
  2950. const m___NR_flistxattr = 234
  2951. const m___NR_flock = 143
  2952. const m___NR_fork = 2
  2953. const m___NR_fremovexattr = 237
  2954. const m___NR_fsconfig = 431
  2955. const m___NR_fsetxattr = 228
  2956. const m___NR_fsmount = 432
  2957. const m___NR_fsopen = 430
  2958. const m___NR_fspick = 433
  2959. const m___NR_fstat = 108
  2960. const m___NR_fstat64 = 197
  2961. const m___NR_fstatat64 = 327
  2962. const m___NR_fstatfs = 100
  2963. const m___NR_fstatfs64 = 267
  2964. const m___NR_fsync = 118
  2965. const m___NR_ftruncate = 93
  2966. const m___NR_ftruncate64 = 194
  2967. const m___NR_futex = 240
  2968. const m___NR_futex_time64 = 422
  2969. const m___NR_futex_waitv = 449
  2970. const m___NR_futimesat = 326
  2971. const m___NR_get_mempolicy = 320
  2972. const m___NR_get_robust_list = 339
  2973. const m___NR_getcpu = 345
  2974. const m___NR_getcwd = 183
  2975. const m___NR_getdents = 141
  2976. const m___NR_getdents64 = 217
  2977. const m___NR_getegid = 50
  2978. const m___NR_getegid32 = 202
  2979. const m___NR_geteuid = 49
  2980. const m___NR_geteuid32 = 201
  2981. const m___NR_getgid = 47
  2982. const m___NR_getgid32 = 200
  2983. const m___NR_getgroups = 80
  2984. const m___NR_getgroups32 = 205
  2985. const m___NR_getitimer = 105
  2986. const m___NR_getpeername = 287
  2987. const m___NR_getpgid = 132
  2988. const m___NR_getpgrp = 65
  2989. const m___NR_getpid = 20
  2990. const m___NR_getppid = 64
  2991. const m___NR_getpriority = 96
  2992. const m___NR_getrandom = 384
  2993. const m___NR_getresgid = 171
  2994. const m___NR_getresgid32 = 211
  2995. const m___NR_getresuid = 165
  2996. const m___NR_getresuid32 = 209
  2997. const m___NR_getrusage = 77
  2998. const m___NR_getsid = 147
  2999. const m___NR_getsockname = 286
  3000. const m___NR_getsockopt = 295
  3001. const m___NR_gettid = 224
  3002. const m___NR_gettimeofday_time32 = 78
  3003. const m___NR_getuid = 24
  3004. const m___NR_getuid32 = 199
  3005. const m___NR_getxattr = 229
  3006. const m___NR_init_module = 128
  3007. const m___NR_inotify_add_watch = 317
  3008. const m___NR_inotify_init = 316
  3009. const m___NR_inotify_init1 = 360
  3010. const m___NR_inotify_rm_watch = 318
  3011. const m___NR_io_cancel = 247
  3012. const m___NR_io_destroy = 244
  3013. const m___NR_io_getevents = 245
  3014. const m___NR_io_pgetevents = 399
  3015. const m___NR_io_pgetevents_time64 = 416
  3016. const m___NR_io_setup = 243
  3017. const m___NR_io_submit = 246
  3018. const m___NR_io_uring_enter = 426
  3019. const m___NR_io_uring_register = 427
  3020. const m___NR_io_uring_setup = 425
  3021. const m___NR_ioctl = 54
  3022. const m___NR_ioprio_get = 315
  3023. const m___NR_ioprio_set = 314
  3024. const m___NR_kcmp = 378
  3025. const m___NR_kexec_file_load = 401
  3026. const m___NR_kexec_load = 347
  3027. const m___NR_keyctl = 311
  3028. const m___NR_kill = 37
  3029. const m___NR_landlock_add_rule = 445
  3030. const m___NR_landlock_create_ruleset = 444
  3031. const m___NR_landlock_restrict_self = 446
  3032. const m___NR_lchown = 16
  3033. const m___NR_lchown32 = 198
  3034. const m___NR_lgetxattr = 230
  3035. const m___NR_link = 9
  3036. const m___NR_linkat = 330
  3037. const m___NR_listen = 284
  3038. const m___NR_listxattr = 232
  3039. const m___NR_llistxattr = 233
  3040. const m___NR_lookup_dcookie = 249
  3041. const m___NR_lremovexattr = 236
  3042. const m___NR_lseek = 19
  3043. const m___NR_lsetxattr = 227
  3044. const m___NR_lstat = 107
  3045. const m___NR_lstat64 = 196
  3046. const m___NR_madvise = 220
  3047. const m___NR_mbind = 319
  3048. const m___NR_membarrier = 389
  3049. const m___NR_memfd_create = 385
  3050. const m___NR_migrate_pages = 400
  3051. const m___NR_mincore = 219
  3052. const m___NR_mkdir = 39
  3053. const m___NR_mkdirat = 323
  3054. const m___NR_mknod = 14
  3055. const m___NR_mknodat = 324
  3056. const m___NR_mlock = 150
  3057. const m___NR_mlock2 = 390
  3058. const m___NR_mlockall = 152
  3059. const m___NR_mmap2 = 192
  3060. const m___NR_mount = 21
  3061. const m___NR_mount_setattr = 442
  3062. const m___NR_move_mount = 429
  3063. const m___NR_move_pages = 344
  3064. const m___NR_mprotect = 125
  3065. const m___NR_mq_getsetattr = 279
  3066. const m___NR_mq_notify = 278
  3067. const m___NR_mq_open = 274
  3068. const m___NR_mq_timedreceive = 277
  3069. const m___NR_mq_timedreceive_time64 = 419
  3070. const m___NR_mq_timedsend = 276
  3071. const m___NR_mq_timedsend_time64 = 418
  3072. const m___NR_mq_unlink = 275
  3073. const m___NR_mremap = 163
  3074. const m___NR_msgctl = 304
  3075. const m___NR_msgget = 303
  3076. const m___NR_msgrcv = 302
  3077. const m___NR_msgsnd = 301
  3078. const m___NR_msync = 144
  3079. const m___NR_munlock = 151
  3080. const m___NR_munlockall = 153
  3081. const m___NR_munmap = 91
  3082. const m___NR_name_to_handle_at = 370
  3083. const m___NR_nanosleep = 162
  3084. const m___NR_nfsservctl = 169
  3085. const m___NR_nice = 34
  3086. const m___NR_open = 5
  3087. const m___NR_open_by_handle_at = 371
  3088. const m___NR_open_tree = 428
  3089. const m___NR_openat = 322
  3090. const m___NR_openat2 = 437
  3091. const m___NR_pause = 29
  3092. const m___NR_pciconfig_iobase = 271
  3093. const m___NR_pciconfig_read = 272
  3094. const m___NR_pciconfig_write = 273
  3095. const m___NR_perf_event_open = 364
  3096. const m___NR_personality = 136
  3097. const m___NR_pidfd_getfd = 438
  3098. const m___NR_pidfd_open = 434
  3099. const m___NR_pidfd_send_signal = 424
  3100. const m___NR_pipe = 42
  3101. const m___NR_pipe2 = 359
  3102. const m___NR_pivot_root = 218
  3103. const m___NR_pkey_alloc = 395
  3104. const m___NR_pkey_free = 396
  3105. const m___NR_pkey_mprotect = 394
  3106. const m___NR_poll = 168
  3107. const m___NR_ppoll = 336
  3108. const m___NR_ppoll_time64 = 414
  3109. const m___NR_prctl = 172
  3110. const m___NR_pread64 = 180
  3111. const m___NR_preadv = 361
  3112. const m___NR_preadv2 = 392
  3113. const m___NR_prlimit64 = 369
  3114. const m___NR_process_madvise = 440
  3115. const m___NR_process_mrelease = 448
  3116. const m___NR_process_vm_readv = 376
  3117. const m___NR_process_vm_writev = 377
  3118. const m___NR_pselect6 = 335
  3119. const m___NR_pselect6_time64 = 413
  3120. const m___NR_ptrace = 26
  3121. const m___NR_pwrite64 = 181
  3122. const m___NR_pwritev = 362
  3123. const m___NR_pwritev2 = 393
  3124. const m___NR_quotactl = 131
  3125. const m___NR_read = 3
  3126. const m___NR_readahead = 225
  3127. const m___NR_readlink = 85
  3128. const m___NR_readlinkat = 332
  3129. const m___NR_readv = 145
  3130. const m___NR_reboot = 88
  3131. const m___NR_recv = 291
  3132. const m___NR_recvfrom = 292
  3133. const m___NR_recvmmsg = 365
  3134. const m___NR_recvmmsg_time64 = 417
  3135. const m___NR_recvmsg = 297
  3136. const m___NR_remap_file_pages = 253
  3137. const m___NR_removexattr = 235
  3138. const m___NR_rename = 38
  3139. const m___NR_renameat = 329
  3140. const m___NR_renameat2 = 382
  3141. const m___NR_request_key = 310
  3142. const m___NR_restart_syscall = 0
  3143. const m___NR_rmdir = 40
  3144. const m___NR_rseq = 398
  3145. const m___NR_rt_sigaction = 174
  3146. const m___NR_rt_sigpending = 176
  3147. const m___NR_rt_sigprocmask = 175
  3148. const m___NR_rt_sigqueueinfo = 178
  3149. const m___NR_rt_sigreturn = 173
  3150. const m___NR_rt_sigsuspend = 179
  3151. const m___NR_rt_sigtimedwait = 177
  3152. const m___NR_rt_sigtimedwait_time64 = 421
  3153. const m___NR_rt_tgsigqueueinfo = 363
  3154. const m___NR_sched_get_priority_max = 159
  3155. const m___NR_sched_get_priority_min = 160
  3156. const m___NR_sched_getaffinity = 242
  3157. const m___NR_sched_getattr = 381
  3158. const m___NR_sched_getparam = 155
  3159. const m___NR_sched_getscheduler = 157
  3160. const m___NR_sched_rr_get_interval = 161
  3161. const m___NR_sched_rr_get_interval_time64 = 423
  3162. const m___NR_sched_setaffinity = 241
  3163. const m___NR_sched_setattr = 380
  3164. const m___NR_sched_setparam = 154
  3165. const m___NR_sched_setscheduler = 156
  3166. const m___NR_sched_yield = 158
  3167. const m___NR_seccomp = 383
  3168. const m___NR_semctl = 300
  3169. const m___NR_semget = 299
  3170. const m___NR_semop = 298
  3171. const m___NR_semtimedop = 312
  3172. const m___NR_semtimedop_time64 = 420
  3173. const m___NR_send = 289
  3174. const m___NR_sendfile = 187
  3175. const m___NR_sendfile64 = 239
  3176. const m___NR_sendmmsg = 374
  3177. const m___NR_sendmsg = 296
  3178. const m___NR_sendto = 290
  3179. const m___NR_set_mempolicy = 321
  3180. const m___NR_set_mempolicy_home_node = 450
  3181. const m___NR_set_robust_list = 338
  3182. const m___NR_set_tid_address = 256
  3183. const m___NR_setdomainname = 121
  3184. const m___NR_setfsgid = 139
  3185. const m___NR_setfsgid32 = 216
  3186. const m___NR_setfsuid = 138
  3187. const m___NR_setfsuid32 = 215
  3188. const m___NR_setgid = 46
  3189. const m___NR_setgid32 = 214
  3190. const m___NR_setgroups = 81
  3191. const m___NR_setgroups32 = 206
  3192. const m___NR_sethostname = 74
  3193. const m___NR_setitimer = 104
  3194. const m___NR_setns = 375
  3195. const m___NR_setpgid = 57
  3196. const m___NR_setpriority = 97
  3197. const m___NR_setregid = 71
  3198. const m___NR_setregid32 = 204
  3199. const m___NR_setresgid = 170
  3200. const m___NR_setresgid32 = 210
  3201. const m___NR_setresuid = 164
  3202. const m___NR_setresuid32 = 208
  3203. const m___NR_setreuid = 70
  3204. const m___NR_setreuid32 = 203
  3205. const m___NR_setrlimit = 75
  3206. const m___NR_setsid = 66
  3207. const m___NR_setsockopt = 294
  3208. const m___NR_settimeofday_time32 = 79
  3209. const m___NR_setuid = 23
  3210. const m___NR_setuid32 = 213
  3211. const m___NR_setxattr = 226
  3212. const m___NR_shmat = 305
  3213. const m___NR_shmctl = 308
  3214. const m___NR_shmdt = 306
  3215. const m___NR_shmget = 307
  3216. const m___NR_shutdown = 293
  3217. const m___NR_sigaction = 67
  3218. const m___NR_sigaltstack = 186
  3219. const m___NR_signalfd = 349
  3220. const m___NR_signalfd4 = 355
  3221. const m___NR_sigpending = 73
  3222. const m___NR_sigprocmask = 126
  3223. const m___NR_sigreturn = 119
  3224. const m___NR_sigsuspend = 72
  3225. const m___NR_socket = 281
  3226. const m___NR_socketpair = 288
  3227. const m___NR_splice = 340
  3228. const m___NR_stat = 106
  3229. const m___NR_stat64 = 195
  3230. const m___NR_statfs = 99
  3231. const m___NR_statfs64 = 266
  3232. const m___NR_statx = 397
  3233. const m___NR_swapoff = 115
  3234. const m___NR_swapon = 87
  3235. const m___NR_symlink = 83
  3236. const m___NR_symlinkat = 331
  3237. const m___NR_sync = 36
  3238. const m___NR_sync_file_range2 = 341
  3239. const m___NR_syncfs = 373
  3240. const m___NR_sysfs = 135
  3241. const m___NR_sysinfo = 116
  3242. const m___NR_syslog = 103
  3243. const m___NR_tee = 342
  3244. const m___NR_tgkill = 268
  3245. const m___NR_timer_create = 257
  3246. const m___NR_timer_delete = 261
  3247. const m___NR_timer_getoverrun = 260
  3248. const m___NR_timer_gettime32 = 259
  3249. const m___NR_timer_gettime64 = 408
  3250. const m___NR_timer_settime32 = 258
  3251. const m___NR_timer_settime64 = 409
  3252. const m___NR_timerfd_create = 350
  3253. const m___NR_timerfd_gettime32 = 354
  3254. const m___NR_timerfd_gettime64 = 410
  3255. const m___NR_timerfd_settime32 = 353
  3256. const m___NR_timerfd_settime64 = 411
  3257. const m___NR_times = 43
  3258. const m___NR_tkill = 238
  3259. const m___NR_truncate = 92
  3260. const m___NR_truncate64 = 193
  3261. const m___NR_ugetrlimit = 191
  3262. const m___NR_umask = 60
  3263. const m___NR_umount2 = 52
  3264. const m___NR_uname = 122
  3265. const m___NR_unlink = 10
  3266. const m___NR_unlinkat = 328
  3267. const m___NR_unshare = 337
  3268. const m___NR_uselib = 86
  3269. const m___NR_userfaultfd = 388
  3270. const m___NR_ustat = 62
  3271. const m___NR_utimensat = 348
  3272. const m___NR_utimensat_time64 = 412
  3273. const m___NR_utimes = 269
  3274. const m___NR_vfork = 190
  3275. const m___NR_vhangup = 111
  3276. const m___NR_vmsplice = 343
  3277. const m___NR_vserver = 313
  3278. const m___NR_wait4 = 114
  3279. const m___NR_waitid = 280
  3280. const m___NR_write = 4
  3281. const m___NR_writev = 146
  3282. const m_d_fileno = "d_ino"
  3283. type Tdirent = struct {
  3284. F__ccgo_align [0]uint32
  3285. Fd_ino Tino_t
  3286. Fd_off Toff_t
  3287. Fd_reclen uint16
  3288. Fd_type uint8
  3289. Fd_name [256]uint8
  3290. F__ccgo_pad5 [5]byte
  3291. }
  3292. func _closefrom_close(tls *libc.TLS, fd int32) {
  3293. libc.Xclose(tls, fd)
  3294. }
  3295. func _sys_close_range(tls *libc.TLS, fd uint32, max_fd uint32, flags uint32) (r int32) {
  3296. bp := tls.Alloc(32)
  3297. defer tls.Free(32)
  3298. return int32(libc.Xsyscall(tls, int32(m_SYS_close_range), libc.VaList(bp+8, fd, max_fd, flags)))
  3299. }
  3300. // C documentation
  3301. //
  3302. // /*
  3303. // * Close all file descriptors greater than or equal to lowfd.
  3304. // * This is the expensive (fallback) method.
  3305. // */
  3306. func _closefrom_fallback(tls *libc.TLS, lowfd int32) {
  3307. var fd, maxfd int32
  3308. _, _ = fd, maxfd
  3309. /*
  3310. * Fall back on sysconf(_SC_OPEN_MAX) or getdtablesize(). This is
  3311. * equivalent to checking the RLIMIT_NOFILE soft limit. It is
  3312. * possible for there to be open file descriptors past this limit
  3313. * but there is not much we can do about that since the hard limit
  3314. * may be RLIM_INFINITY (LLONG_MAX or ULLONG_MAX on modern systems).
  3315. */
  3316. maxfd = libc.Xsysconf(tls, int32(m__SC_OPEN_MAX))
  3317. if maxfd < int32(m_OPEN_MAX) {
  3318. maxfd = int32(m_OPEN_MAX)
  3319. }
  3320. /* Make sure we did not get RLIM_INFINITY as the upper limit. */
  3321. if maxfd > int32(m_INT_MAX1) {
  3322. maxfd = int32(m_INT_MAX1)
  3323. }
  3324. fd = lowfd
  3325. for {
  3326. if !(fd < maxfd) {
  3327. break
  3328. }
  3329. _closefrom_close(tls, fd)
  3330. goto _1
  3331. _1:
  3332. ;
  3333. fd++
  3334. }
  3335. }
  3336. func _closefrom_procfs(tls *libc.TLS, lowfd int32) (r int32) {
  3337. bp := tls.Alloc(16)
  3338. defer tls.Free(16)
  3339. var dent, dirp, fd_array, path, ptr, v1 uintptr
  3340. var fd, fd_array_size, fd_array_used, i, ret, v2 int32
  3341. var _ /* errstr at bp+0 */ uintptr
  3342. _, _, _, _, _, _, _, _, _, _, _, _ = dent, dirp, fd, fd_array, fd_array_size, fd_array_used, i, path, ptr, ret, v1, v2
  3343. fd_array = libc.UintptrFromInt32(0)
  3344. fd_array_used = 0
  3345. fd_array_size = 0
  3346. ret = 0
  3347. /* Use /proc/self/fd (or /dev/fd on macOS) if it exists. */
  3348. path = __ccgo_ts
  3349. dirp = libc.Xopendir(tls, path)
  3350. if dirp == libc.UintptrFromInt32(0) {
  3351. return -int32(1)
  3352. }
  3353. for {
  3354. v1 = libc.Xreaddir(tls, dirp)
  3355. dent = v1
  3356. if !(v1 != libc.UintptrFromInt32(0)) {
  3357. break
  3358. }
  3359. fd = int32(Xstrtonum(tls, dent+19, int64(lowfd), int64(m_INT_MAX1), bp))
  3360. if *(*uintptr)(unsafe.Pointer(bp)) != libc.UintptrFromInt32(0) || fd == libc.Xdirfd(tls, dirp) {
  3361. continue
  3362. }
  3363. if fd_array_used >= fd_array_size {
  3364. if fd_array_size > 0 {
  3365. fd_array_size *= int32(2)
  3366. } else {
  3367. fd_array_size = int32(32)
  3368. }
  3369. ptr = Xreallocarray(tls, fd_array, libc.Uint32FromInt32(fd_array_size), uint32(4))
  3370. if ptr == libc.UintptrFromInt32(0) {
  3371. ret = -int32(1)
  3372. break
  3373. }
  3374. fd_array = ptr
  3375. }
  3376. v2 = fd_array_used
  3377. fd_array_used++
  3378. *(*int32)(unsafe.Pointer(fd_array + uintptr(v2)*4)) = fd
  3379. }
  3380. i = 0
  3381. for {
  3382. if !(i < fd_array_used) {
  3383. break
  3384. }
  3385. _closefrom_close(tls, *(*int32)(unsafe.Pointer(fd_array + uintptr(i)*4)))
  3386. goto _3
  3387. _3:
  3388. ;
  3389. i++
  3390. }
  3391. libc.Xfree(tls, fd_array)
  3392. libc.Xclosedir(tls, dirp)
  3393. return ret
  3394. }
  3395. // C documentation
  3396. //
  3397. // /*
  3398. // * Close all file descriptors greater than or equal to lowfd.
  3399. // * We try the fast way first, falling back on the slow method.
  3400. // */
  3401. func Xclosefrom(tls *libc.TLS, lowfd int32) {
  3402. if lowfd < 0 {
  3403. lowfd = 0
  3404. }
  3405. /* Try the fast methods first, if possible. */
  3406. if _sys_close_range(tls, libc.Uint32FromInt32(lowfd), uint32(0xffffffff), uint32(0)) == 0 {
  3407. return
  3408. }
  3409. if _closefrom_procfs(tls, lowfd) != -int32(1) {
  3410. return
  3411. }
  3412. /* Do things the slow way. */
  3413. _closefrom_fallback(tls, lowfd)
  3414. }
  3415. const m_INT64_MAX1 = 9223372036854775807
  3416. func Xdehumanize_number(tls *libc.TLS, buf uintptr, num uintptr) (r int32) {
  3417. bp := tls.Alloc(16)
  3418. defer tls.Free(16)
  3419. var rc, sign, v1, v2 int32
  3420. var rmax Tuint64_t
  3421. var _ /* rval at bp+0 */ Tuint64_t
  3422. _, _, _, _, _ = rc, rmax, sign, v1, v2
  3423. sign = +libc.Int32FromInt32(1)
  3424. /* The current expand_number() implementation uses bit shifts, so
  3425. * we cannot pass negative numbers, preserve the sign and apply it
  3426. * later. */
  3427. for {
  3428. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(buf)))
  3429. v2 = libc.BoolInt32(v1 == int32(' ') || libc.Uint32FromInt32(v1)-uint32('\t') < uint32(5))
  3430. goto _3
  3431. _3:
  3432. if !(v2 != 0) {
  3433. break
  3434. }
  3435. buf++
  3436. }
  3437. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(buf))) == int32('-') {
  3438. sign = -int32(1)
  3439. buf++
  3440. }
  3441. rc = Xexpand_number(tls, buf, bp)
  3442. if rc < 0 {
  3443. return rc
  3444. }
  3445. /* The sign has been stripped, so rval has the absolute value.
  3446. * Error out, regardless of the sign, if rval is greater than
  3447. * abs(INT64_MIN) (== INT64_MAX + 1), or if the sign is positive
  3448. * and the value has overflown by one (INT64_MAX + 1). */
  3449. rmax = libc.Uint64FromInt64(libc.Int64FromInt64(m_INT64_MAX1)) + libc.Uint64FromUint64(1)
  3450. if *(*Tuint64_t)(unsafe.Pointer(bp)) > rmax || *(*Tuint64_t)(unsafe.Pointer(bp)) == rmax && sign == +libc.Int32FromInt32(1) {
  3451. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ERANGE)
  3452. return -int32(1)
  3453. }
  3454. *(*Tint64_t)(unsafe.Pointer(num)) = libc.Int64FromUint64(*(*Tuint64_t)(unsafe.Pointer(bp)) * libc.Uint64FromInt32(sign))
  3455. return 0
  3456. }
  3457. const m_INT64_MAX2 = 0x7fffffffffffffff
  3458. /*
  3459. * Copyright © 2004-2005, 2009, 2011-2013 Guillem Jover <guillem@hadrons.org>
  3460. *
  3461. * Redistribution and use in source and binary forms, with or without
  3462. * modification, are permitted provided that the following conditions
  3463. * are met:
  3464. * 1. Redistributions of source code must retain the above copyright
  3465. * notice, this list of conditions and the following disclaimer.
  3466. * 2. Redistributions in binary form must reproduce the above copyright
  3467. * notice, this list of conditions and the following disclaimer in the
  3468. * documentation and/or other materials provided with the distribution.
  3469. * 3. The name of the author may not be used to endorse or promote products
  3470. * derived from this software without specific prior written permission.
  3471. *
  3472. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  3473. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  3474. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  3475. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  3476. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  3477. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  3478. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  3479. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  3480. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  3481. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  3482. */
  3483. func Xvwarnc(tls *libc.TLS, code int32, format uintptr, ap Tva_list) {
  3484. bp := tls.Alloc(16)
  3485. defer tls.Free(16)
  3486. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+14, libc.VaList(bp+8, Xgetprogname(tls)))
  3487. if format != 0 {
  3488. libc.Xvfprintf(tls, libc.Xstderr, format, ap)
  3489. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+19, 0)
  3490. }
  3491. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+22, libc.VaList(bp+8, libc.Xstrerror(tls, code)))
  3492. }
  3493. func Xwarnc(tls *libc.TLS, code int32, format uintptr, va uintptr) {
  3494. var ap Tva_list
  3495. _ = ap
  3496. ap = va
  3497. Xvwarnc(tls, code, format, ap)
  3498. _ = ap
  3499. }
  3500. func Xverrc(tls *libc.TLS, status int32, code int32, format uintptr, ap Tva_list) {
  3501. bp := tls.Alloc(16)
  3502. defer tls.Free(16)
  3503. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+14, libc.VaList(bp+8, Xgetprogname(tls)))
  3504. if format != 0 {
  3505. libc.Xvfprintf(tls, libc.Xstderr, format, ap)
  3506. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+19, 0)
  3507. }
  3508. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+22, libc.VaList(bp+8, libc.Xstrerror(tls, code)))
  3509. libc.Xexit(tls, status)
  3510. }
  3511. func Xerrc(tls *libc.TLS, status int32, code int32, format uintptr, va uintptr) {
  3512. var ap Tva_list
  3513. _ = ap
  3514. ap = va
  3515. Xverrc(tls, status, code, format, ap)
  3516. _ = ap
  3517. }
  3518. const m_PRIX16 = "X"
  3519. const m_PRIX32 = "X"
  3520. const m_PRIX8 = "X"
  3521. const m_PRIXFAST16 = "X"
  3522. const m_PRIXFAST32 = "X"
  3523. const m_PRIXFAST8 = "X"
  3524. const m_PRIXLEAST16 = "X"
  3525. const m_PRIXLEAST32 = "X"
  3526. const m_PRIXLEAST8 = "X"
  3527. const m_PRId16 = "d"
  3528. const m_PRId32 = "d"
  3529. const m_PRId8 = "d"
  3530. const m_PRIdFAST16 = "d"
  3531. const m_PRIdFAST32 = "d"
  3532. const m_PRIdFAST8 = "d"
  3533. const m_PRIdLEAST16 = "d"
  3534. const m_PRIdLEAST32 = "d"
  3535. const m_PRIdLEAST8 = "d"
  3536. const m_PRIi16 = "i"
  3537. const m_PRIi32 = "i"
  3538. const m_PRIi8 = "i"
  3539. const m_PRIiFAST16 = "i"
  3540. const m_PRIiFAST32 = "i"
  3541. const m_PRIiFAST8 = "i"
  3542. const m_PRIiLEAST16 = "i"
  3543. const m_PRIiLEAST32 = "i"
  3544. const m_PRIiLEAST8 = "i"
  3545. const m_PRIo16 = "o"
  3546. const m_PRIo32 = "o"
  3547. const m_PRIo8 = "o"
  3548. const m_PRIoFAST16 = "o"
  3549. const m_PRIoFAST32 = "o"
  3550. const m_PRIoFAST8 = "o"
  3551. const m_PRIoLEAST16 = "o"
  3552. const m_PRIoLEAST32 = "o"
  3553. const m_PRIoLEAST8 = "o"
  3554. const m_PRIu16 = "u"
  3555. const m_PRIu32 = "u"
  3556. const m_PRIu8 = "u"
  3557. const m_PRIuFAST16 = "u"
  3558. const m_PRIuFAST32 = "u"
  3559. const m_PRIuFAST8 = "u"
  3560. const m_PRIuLEAST16 = "u"
  3561. const m_PRIuLEAST32 = "u"
  3562. const m_PRIuLEAST8 = "u"
  3563. const m_PRIx16 = "x"
  3564. const m_PRIx32 = "x"
  3565. const m_PRIx8 = "x"
  3566. const m_PRIxFAST16 = "x"
  3567. const m_PRIxFAST32 = "x"
  3568. const m_PRIxFAST8 = "x"
  3569. const m_PRIxLEAST16 = "x"
  3570. const m_PRIxLEAST32 = "x"
  3571. const m_PRIxLEAST8 = "x"
  3572. const m_SCNd16 = "hd"
  3573. const m_SCNd32 = "d"
  3574. const m_SCNd8 = "hhd"
  3575. const m_SCNdFAST16 = "d"
  3576. const m_SCNdFAST32 = "d"
  3577. const m_SCNdFAST8 = "hhd"
  3578. const m_SCNdLEAST16 = "hd"
  3579. const m_SCNdLEAST32 = "d"
  3580. const m_SCNdLEAST8 = "hhd"
  3581. const m_SCNi16 = "hi"
  3582. const m_SCNi32 = "i"
  3583. const m_SCNi8 = "hhi"
  3584. const m_SCNiFAST16 = "i"
  3585. const m_SCNiFAST32 = "i"
  3586. const m_SCNiFAST8 = "hhi"
  3587. const m_SCNiLEAST16 = "hi"
  3588. const m_SCNiLEAST32 = "i"
  3589. const m_SCNiLEAST8 = "hhi"
  3590. const m_SCNo16 = "ho"
  3591. const m_SCNo32 = "o"
  3592. const m_SCNo8 = "hho"
  3593. const m_SCNoFAST16 = "o"
  3594. const m_SCNoFAST32 = "o"
  3595. const m_SCNoFAST8 = "hho"
  3596. const m_SCNoLEAST16 = "ho"
  3597. const m_SCNoLEAST32 = "o"
  3598. const m_SCNoLEAST8 = "hho"
  3599. const m_SCNu16 = "hu"
  3600. const m_SCNu32 = "u"
  3601. const m_SCNu8 = "hhu"
  3602. const m_SCNuFAST16 = "u"
  3603. const m_SCNuFAST32 = "u"
  3604. const m_SCNuFAST8 = "hhu"
  3605. const m_SCNuLEAST16 = "hu"
  3606. const m_SCNuLEAST32 = "u"
  3607. const m_SCNuLEAST8 = "hhu"
  3608. const m_SCNx16 = "hx"
  3609. const m_SCNx32 = "x"
  3610. const m_SCNx8 = "hhx"
  3611. const m_SCNxFAST16 = "x"
  3612. const m_SCNxFAST32 = "x"
  3613. const m_SCNxFAST8 = "hhx"
  3614. const m_SCNxLEAST16 = "hx"
  3615. const m_SCNxLEAST32 = "x"
  3616. const m_SCNxLEAST8 = "hhx"
  3617. const m___PRI64 = "ll"
  3618. const m___PRIPTR = ""
  3619. type Timaxdiv_t = struct {
  3620. F__ccgo_align [0]uint32
  3621. Fquot Tintmax_t
  3622. Frem Tintmax_t
  3623. }
  3624. /* Values for humanize_number(3)'s flags parameter. */
  3625. /* Values for humanize_number(3)'s scale parameter. */
  3626. /*
  3627. * fparseln() specific operation flags.
  3628. */
  3629. // C documentation
  3630. //
  3631. // /*
  3632. // * Convert an expression of the following forms to a uint64_t.
  3633. // * 1) A positive decimal number.
  3634. // * 2) A positive decimal number followed by a 'b' or 'B' (mult by 1).
  3635. // * 3) A positive decimal number followed by a 'k' or 'K' (mult by 1 << 10).
  3636. // * 4) A positive decimal number followed by a 'm' or 'M' (mult by 1 << 20).
  3637. // * 5) A positive decimal number followed by a 'g' or 'G' (mult by 1 << 30).
  3638. // * 6) A positive decimal number followed by a 't' or 'T' (mult by 1 << 40).
  3639. // * 7) A positive decimal number followed by a 'p' or 'P' (mult by 1 << 50).
  3640. // * 8) A positive decimal number followed by a 'e' or 'E' (mult by 1 << 60).
  3641. // */
  3642. func Xexpand_number(tls *libc.TLS, buf uintptr, num uintptr) (r int32) {
  3643. bp := tls.Alloc(16)
  3644. defer tls.Free(16)
  3645. var number Tuint64_t
  3646. var shift uint32
  3647. var _ /* endptr at bp+0 */ uintptr
  3648. _, _ = number, shift
  3649. number = libc.Xstrtoumax(tls, buf, bp, 0)
  3650. if *(*uintptr)(unsafe.Pointer(bp)) == buf {
  3651. /* No valid digits. */
  3652. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  3653. return -int32(1)
  3654. }
  3655. switch libc.Xtolower(tls, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))) {
  3656. case int32('e'):
  3657. shift = uint32(60)
  3658. case int32('p'):
  3659. shift = uint32(50)
  3660. case int32('t'):
  3661. shift = uint32(40)
  3662. case int32('g'):
  3663. shift = uint32(30)
  3664. case int32('m'):
  3665. shift = uint32(20)
  3666. case int32('k'):
  3667. shift = uint32(10)
  3668. case int32('b'):
  3669. fallthrough
  3670. case int32('\000'): /* No unit. */
  3671. *(*Tuint64_t)(unsafe.Pointer(num)) = number
  3672. return 0
  3673. default:
  3674. /* Unrecognized unit. */
  3675. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  3676. return -int32(1)
  3677. }
  3678. if number<<shift>>shift != number {
  3679. /* Overflow */
  3680. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ERANGE)
  3681. return -int32(1)
  3682. }
  3683. *(*Tuint64_t)(unsafe.Pointer(num)) = number << shift
  3684. return 0
  3685. }
  3686. func X__explicit_bzero_hook(tls *libc.TLS, buf uintptr, len1 Tsize_t) {
  3687. }
  3688. func Xexplicit_bzero(tls *libc.TLS, buf uintptr, len1 Tsize_t) {
  3689. libc.Xmemset(tls, buf, 0, len1)
  3690. X__explicit_bzero_hook(tls, buf, len1)
  3691. }
  3692. const m_FILEBUF_POOL_ITEMS = 32
  3693. /*
  3694. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  3695. *
  3696. * Redistribution and use in source and binary forms, with or without
  3697. * modification, are permitted provided that the following conditions
  3698. * are met:
  3699. * 1. Redistributions of source code must retain the above copyright
  3700. * notice, this list of conditions and the following disclaimer.
  3701. * 2. Redistributions in binary form must reproduce the above copyright
  3702. * notice, this list of conditions and the following disclaimer in the
  3703. * documentation and/or other materials provided with the distribution.
  3704. * 3. The name of the author may not be used to endorse or promote products
  3705. * derived from this software without specific prior written permission.
  3706. *
  3707. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  3708. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  3709. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  3710. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  3711. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  3712. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  3713. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  3714. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  3715. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  3716. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  3717. */
  3718. /*
  3719. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  3720. *
  3721. * Redistribution and use in source and binary forms, with or without
  3722. * modification, are permitted provided that the following conditions
  3723. * are met:
  3724. * 1. Redistributions of source code must retain the above copyright
  3725. * notice, this list of conditions and the following disclaimer.
  3726. * 2. Redistributions in binary form must reproduce the above copyright
  3727. * notice, this list of conditions and the following disclaimer in the
  3728. * documentation and/or other materials provided with the distribution.
  3729. * 3. The name of the author may not be used to endorse or promote products
  3730. * derived from this software without specific prior written permission.
  3731. *
  3732. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  3733. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  3734. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  3735. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  3736. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  3737. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  3738. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  3739. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  3740. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  3741. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  3742. */
  3743. /* Clang expands this to 1 if an identifier is *not* reserved. */
  3744. /*
  3745. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  3746. * musl, try to handle this gracefully.
  3747. */
  3748. /* Copyright (C) 1992-2022 Free Software Foundation, Inc.
  3749. Copyright The GNU Toolchain Authors.
  3750. This file is part of the GNU C Library.
  3751. The GNU C Library is free software; you can redistribute it and/or
  3752. modify it under the terms of the GNU Lesser General Public
  3753. License as published by the Free Software Foundation; either
  3754. version 2.1 of the License, or (at your option) any later version.
  3755. The GNU C Library is distributed in the hope that it will be useful,
  3756. but WITHOUT ANY WARRANTY; without even the implied warranty of
  3757. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  3758. Lesser General Public License for more details.
  3759. You should have received a copy of the GNU Lesser General Public
  3760. License along with the GNU C Library; if not, see
  3761. <https://www.gnu.org/licenses/>. */
  3762. type Tfilebuf = struct {
  3763. Ffp uintptr
  3764. Fbuf uintptr
  3765. Flen1 Tsize_t
  3766. }
  3767. var _fb_pool [32]Tfilebuf
  3768. var _fb_pool_cur int32
  3769. func Xfgetln(tls *libc.TLS, stream uintptr, len1 uintptr) (r uintptr) {
  3770. var fb uintptr
  3771. var nread Tssize_t
  3772. _, _ = fb, nread
  3773. libc.Xflockfile(tls, stream)
  3774. /* Try to diminish the possibility of several fgetln() calls being
  3775. * used on different streams, by using a pool of buffers per file. */
  3776. fb = uintptr(unsafe.Pointer(&_fb_pool)) + uintptr(_fb_pool_cur)*12
  3777. if (*Tfilebuf)(unsafe.Pointer(fb)).Ffp != stream && (*Tfilebuf)(unsafe.Pointer(fb)).Ffp != libc.UintptrFromInt32(0) {
  3778. _fb_pool_cur++
  3779. _fb_pool_cur %= int32(m_FILEBUF_POOL_ITEMS)
  3780. fb = uintptr(unsafe.Pointer(&_fb_pool)) + uintptr(_fb_pool_cur)*12
  3781. }
  3782. (*Tfilebuf)(unsafe.Pointer(fb)).Ffp = stream
  3783. nread = libc.Xgetline(tls, fb+4, fb+8, stream)
  3784. libc.Xfunlockfile(tls, stream)
  3785. /* Note: the getdelim/getline API ensures nread != 0. */
  3786. if nread == -int32(1) {
  3787. *(*Tsize_t)(unsafe.Pointer(len1)) = uint32(0)
  3788. return libc.UintptrFromInt32(0)
  3789. } else {
  3790. *(*Tsize_t)(unsafe.Pointer(len1)) = libc.Uint32FromInt32(nread)
  3791. return (*Tfilebuf)(unsafe.Pointer(fb)).Fbuf
  3792. }
  3793. return r
  3794. }
  3795. var _libbsd_emit_link_warning_fgetln = [115]uint8{'T', 'h', 'e', ' ', 'f', 'g', 'e', 't', 'l', 'n', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'c', 'a', 'n', 'n', 'o', 't', ' ', 'b', 'e', ' ', 's', 'a', 'f', 'e', 'l', 'y', ' ', 'p', 'o', 'r', 't', 'e', 'd', ',', ' ', 'u', 's', 'e', ' ', 'g', 'e', 't', 'l', 'i', 'n', 'e', '(', '3', ')', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', ',', ' ', 'a', 's', ' ', 'i', 't', ' ', 'i', 's', ' ', 's', 'u', 'p', 'p', 'o', 'r', 't', 'e', 'd', ' ', 'b', 'y', ' ', 'G', 'N', 'U', ' ', 'a', 'n', 'd', ' ', 'P', 'O', 'S', 'I', 'X', '.', '1', '-', '2', '0', '0', '8', '.'}
  3796. func Xfreezero(tls *libc.TLS, ptr uintptr, sz Tsize_t) {
  3797. /* This is legal. */
  3798. if ptr == libc.UintptrFromInt32(0) {
  3799. return
  3800. }
  3801. Xexplicit_bzero(tls, ptr, sz)
  3802. libc.Xfree(tls, ptr)
  3803. }
  3804. const m_FILEWBUF_INIT_LEN = 128
  3805. const m_FILEWBUF_POOL_ITEMS = 32
  3806. type Twint_t = uint32
  3807. type Twctype_t = uint32
  3808. type Tmbstate_t = struct {
  3809. F__opaque1 uint32
  3810. F__opaque2 uint32
  3811. }
  3812. type t__mbstate_t = Tmbstate_t
  3813. type Tmax_align_t = struct {
  3814. F__ccgo_align [0]uint32
  3815. F__ll int64
  3816. F__ld float64
  3817. }
  3818. type Tptrdiff_t = int32
  3819. /*
  3820. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  3821. *
  3822. * Redistribution and use in source and binary forms, with or without
  3823. * modification, are permitted provided that the following conditions
  3824. * are met:
  3825. * 1. Redistributions of source code must retain the above copyright
  3826. * notice, this list of conditions and the following disclaimer.
  3827. * 2. Redistributions in binary form must reproduce the above copyright
  3828. * notice, this list of conditions and the following disclaimer in the
  3829. * documentation and/or other materials provided with the distribution.
  3830. * 3. The name of the author may not be used to endorse or promote products
  3831. * derived from this software without specific prior written permission.
  3832. *
  3833. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  3834. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  3835. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  3836. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  3837. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  3838. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  3839. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  3840. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  3841. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  3842. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  3843. */
  3844. /*
  3845. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  3846. *
  3847. * Redistribution and use in source and binary forms, with or without
  3848. * modification, are permitted provided that the following conditions
  3849. * are met:
  3850. * 1. Redistributions of source code must retain the above copyright
  3851. * notice, this list of conditions and the following disclaimer.
  3852. * 2. Redistributions in binary form must reproduce the above copyright
  3853. * notice, this list of conditions and the following disclaimer in the
  3854. * documentation and/or other materials provided with the distribution.
  3855. * 3. The name of the author may not be used to endorse or promote products
  3856. * derived from this software without specific prior written permission.
  3857. *
  3858. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  3859. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  3860. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  3861. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  3862. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  3863. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  3864. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  3865. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  3866. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  3867. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  3868. */
  3869. /* Clang expands this to 1 if an identifier is *not* reserved. */
  3870. /*
  3871. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  3872. * musl, try to handle this gracefully.
  3873. */
  3874. /* Copyright (C) 1992-2022 Free Software Foundation, Inc.
  3875. Copyright The GNU Toolchain Authors.
  3876. This file is part of the GNU C Library.
  3877. The GNU C Library is free software; you can redistribute it and/or
  3878. modify it under the terms of the GNU Lesser General Public
  3879. License as published by the Free Software Foundation; either
  3880. version 2.1 of the License, or (at your option) any later version.
  3881. The GNU C Library is distributed in the hope that it will be useful,
  3882. but WITHOUT ANY WARRANTY; without even the implied warranty of
  3883. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  3884. Lesser General Public License for more details.
  3885. You should have received a copy of the GNU Lesser General Public
  3886. License along with the GNU C Library; if not, see
  3887. <https://www.gnu.org/licenses/>. */
  3888. type Tfilewbuf = struct {
  3889. Ffp uintptr
  3890. Fwbuf uintptr
  3891. Flen1 Tsize_t
  3892. }
  3893. var _fb_pool1 [32]Tfilewbuf
  3894. var _fb_pool_cur1 int32
  3895. func Xfgetwln(tls *libc.TLS, stream uintptr, lenp uintptr) (r uintptr) {
  3896. var fb, wp, v3 uintptr
  3897. var wc, v1 Twint_t
  3898. var wused, v2 Tsize_t
  3899. _, _, _, _, _, _, _ = fb, wc, wp, wused, v1, v2, v3
  3900. wused = uint32(0)
  3901. /* Try to diminish the possibility of several fgetwln() calls being
  3902. * used on different streams, by using a pool of buffers per file. */
  3903. fb = uintptr(unsafe.Pointer(&_fb_pool1)) + uintptr(_fb_pool_cur1)*12
  3904. if (*Tfilewbuf)(unsafe.Pointer(fb)).Ffp != stream && (*Tfilewbuf)(unsafe.Pointer(fb)).Ffp != libc.UintptrFromInt32(0) {
  3905. _fb_pool_cur1++
  3906. _fb_pool_cur1 %= int32(m_FILEWBUF_POOL_ITEMS)
  3907. fb = uintptr(unsafe.Pointer(&_fb_pool1)) + uintptr(_fb_pool_cur1)*12
  3908. }
  3909. (*Tfilewbuf)(unsafe.Pointer(fb)).Ffp = stream
  3910. for {
  3911. v1 = libc.Xfgetwc(tls, stream)
  3912. wc = v1
  3913. if !(v1 != uint32(0xffffffff)) {
  3914. break
  3915. }
  3916. if !((*Tfilewbuf)(unsafe.Pointer(fb)).Flen1 != 0) || wused >= (*Tfilewbuf)(unsafe.Pointer(fb)).Flen1 {
  3917. if (*Tfilewbuf)(unsafe.Pointer(fb)).Flen1 != 0 {
  3918. *(*Tsize_t)(unsafe.Pointer(fb + 8)) *= uint32(2)
  3919. } else {
  3920. (*Tfilewbuf)(unsafe.Pointer(fb)).Flen1 = uint32(m_FILEWBUF_INIT_LEN)
  3921. }
  3922. wp = Xreallocarray(tls, (*Tfilewbuf)(unsafe.Pointer(fb)).Fwbuf, (*Tfilewbuf)(unsafe.Pointer(fb)).Flen1, uint32(4))
  3923. if wp == libc.UintptrFromInt32(0) {
  3924. wused = uint32(0)
  3925. break
  3926. }
  3927. (*Tfilewbuf)(unsafe.Pointer(fb)).Fwbuf = wp
  3928. }
  3929. v2 = wused
  3930. wused++
  3931. *(*Twchar_t)(unsafe.Pointer((*Tfilewbuf)(unsafe.Pointer(fb)).Fwbuf + uintptr(v2)*4)) = wc
  3932. if wc == uint32('\n') {
  3933. break
  3934. }
  3935. }
  3936. *(*Tsize_t)(unsafe.Pointer(lenp)) = wused
  3937. if wused != 0 {
  3938. v3 = (*Tfilewbuf)(unsafe.Pointer(fb)).Fwbuf
  3939. } else {
  3940. v3 = libc.UintptrFromInt32(0)
  3941. }
  3942. return v3
  3943. }
  3944. // C documentation
  3945. //
  3946. // /* XXX: Ideally we'd recommend getwline(3), but unfortunately even though it
  3947. // * was part of the ISO/IEC TR 24731-2:2010 draft, it did not make it into C11
  3948. // * and is not widely implemented. */
  3949. var _libbsd_emit_link_warning_fgetwln = [115]uint8{'T', 'h', 'e', ' ', 'f', 'g', 'e', 't', 'w', 'l', 'n', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'c', 'a', 'n', 'n', 'o', 't', ' ', 'b', 'e', ' ', 's', 'a', 'f', 'e', 'l', 'y', ' ', 'p', 'o', 'r', 't', 'e', 'd', ',', ' ', 'u', 's', 'e', ' ', 'f', 'g', 'e', 't', 'w', 'c', '(', '3', ')', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', ',', ' ', 'a', 's', ' ', 'i', 't', ' ', 'i', 's', ' ', 's', 'u', 'p', 'p', 'o', 'r', 't', 'e', 'd', ' ', 'b', 'y', ' ', 'C', '9', '9', ' ', 'a', 'n', 'd', ' ', 'P', 'O', 'S', 'I', 'X', '.', '1', '-', '2', '0', '0', '1', '.'}
  3950. const m_LOCK_EX = 2
  3951. const m_LOCK_NB = 4
  3952. const m_LOCK_SH = 1
  3953. const m_LOCK_UN = 8
  3954. const m_O_CREAT1 = 64
  3955. const m_O_NONBLOCK1 = 2048
  3956. const m_O_TRUNC1 = 512
  3957. /* Values for humanize_number(3)'s flags parameter. */
  3958. /* Values for humanize_number(3)'s scale parameter. */
  3959. /*
  3960. * fparseln() specific operation flags.
  3961. */
  3962. // C documentation
  3963. //
  3964. // /*
  3965. // * Reliably open and lock a file.
  3966. // *
  3967. // * Please do not modify this code without first reading the revision history
  3968. // * and discussing your changes with <des@freebsd.org>. Don't be fooled by the
  3969. // * code's apparent simplicity; there would be no need for this function if it
  3970. // * was easy to get right.
  3971. // */
  3972. func _vflopenat(tls *libc.TLS, dirfd int32, path uintptr, flags int32, ap Tva_list) (r int32) {
  3973. bp := tls.Alloc(320)
  3974. defer tls.Free(320)
  3975. var fd, operation, serrno, trunc, v2 int32
  3976. var mode Tmode_t
  3977. var _ /* fsb at bp+152 */ Tstat
  3978. var _ /* sb at bp+0 */ Tstat
  3979. _, _, _, _, _, _ = fd, mode, operation, serrno, trunc, v2
  3980. mode = uint32(0)
  3981. if flags&int32(m_O_CREAT1) != 0 {
  3982. mode = libc.Uint32FromInt32(libc.VaInt32(&ap)) /* mode_t promoted to int */
  3983. }
  3984. operation = int32(m_LOCK_EX)
  3985. if flags&int32(m_O_NONBLOCK1) != 0 {
  3986. operation |= int32(m_LOCK_NB)
  3987. }
  3988. trunc = flags & int32(m_O_TRUNC1)
  3989. flags &= ^libc.Int32FromInt32(m_O_TRUNC1)
  3990. for {
  3991. v2 = libc.Xopenat(tls, dirfd, path, flags, libc.VaList(bp+312, mode))
  3992. fd = v2
  3993. if v2 == -int32(1) {
  3994. /* non-existent or no access */
  3995. return -int32(1)
  3996. }
  3997. if libc.Xflock(tls, fd, operation) == -int32(1) {
  3998. /* unsupported or interrupted */
  3999. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  4000. libc.Xclose(tls, fd)
  4001. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  4002. return -int32(1)
  4003. }
  4004. if libc.Xfstatat(tls, dirfd, path, bp, 0) == -int32(1) {
  4005. /* disappeared from under our feet */
  4006. libc.Xclose(tls, fd)
  4007. goto _1
  4008. }
  4009. if libc.Xfstat(tls, fd, bp+152) == -int32(1) {
  4010. /* can't happen [tm] */
  4011. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  4012. libc.Xclose(tls, fd)
  4013. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  4014. return -int32(1)
  4015. }
  4016. if (*(*Tstat)(unsafe.Pointer(bp))).Fst_dev != (*(*Tstat)(unsafe.Pointer(bp + 152))).Fst_dev || (*(*Tstat)(unsafe.Pointer(bp))).Fst_ino != (*(*Tstat)(unsafe.Pointer(bp + 152))).Fst_ino {
  4017. /* changed under our feet */
  4018. libc.Xclose(tls, fd)
  4019. goto _1
  4020. }
  4021. if trunc != 0 && libc.Xftruncate(tls, fd, 0) != 0 {
  4022. /* can't happen [tm] */
  4023. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  4024. libc.Xclose(tls, fd)
  4025. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  4026. return -int32(1)
  4027. }
  4028. /*
  4029. * The following change is provided as a specific example to
  4030. * avoid.
  4031. */
  4032. return fd
  4033. goto _1
  4034. _1:
  4035. }
  4036. return r
  4037. }
  4038. func Xflopen(tls *libc.TLS, path uintptr, flags int32, va uintptr) (r int32) {
  4039. var ap Tva_list
  4040. var ret int32
  4041. _, _ = ap, ret
  4042. ap = va
  4043. ret = _vflopenat(tls, -int32(100), path, flags, ap)
  4044. _ = ap
  4045. return ret
  4046. }
  4047. func Xflopenat(tls *libc.TLS, dirfd int32, path uintptr, flags int32, va uintptr) (r int32) {
  4048. var ap Tva_list
  4049. var ret int32
  4050. _, _ = ap, ret
  4051. ap = va
  4052. ret = _vflopenat(tls, dirfd, path, flags, ap)
  4053. _ = ap
  4054. return ret
  4055. }
  4056. type ___e_fmtcheck_types = int32
  4057. const _FMTCHECK_START = 0
  4058. const _FMTCHECK_SHORT = 1
  4059. const _FMTCHECK_INT = 2
  4060. const _FMTCHECK_WINTT = 3
  4061. const _FMTCHECK_LONG = 4
  4062. const _FMTCHECK_QUAD = 5
  4063. const _FMTCHECK_INTMAXT = 6
  4064. const _FMTCHECK_PTRDIFFT = 7
  4065. const _FMTCHECK_SIZET = 8
  4066. const _FMTCHECK_POINTER = 9
  4067. const _FMTCHECK_CHARPOINTER = 10
  4068. const _FMTCHECK_SHORTPOINTER = 11
  4069. const _FMTCHECK_INTPOINTER = 12
  4070. const _FMTCHECK_LONGPOINTER = 13
  4071. const _FMTCHECK_QUADPOINTER = 14
  4072. const _FMTCHECK_INTMAXTPOINTER = 15
  4073. const _FMTCHECK_PTRDIFFTPOINTER = 16
  4074. const _FMTCHECK_SIZETPOINTER = 17
  4075. const _FMTCHECK_DOUBLE = 18
  4076. const _FMTCHECK_LONGDOUBLE = 19
  4077. const _FMTCHECK_STRING = 20
  4078. const _FMTCHECK_WSTRING = 21
  4079. const _FMTCHECK_WIDTH = 22
  4080. const _FMTCHECK_PRECISION = 23
  4081. const _FMTCHECK_DONE = 24
  4082. const _FMTCHECK_UNKNOWN = 25
  4083. type TEFT = int32
  4084. type _e_modifier = int32
  4085. const _MOD_NONE = 0
  4086. const _MOD_CHAR = 1
  4087. const _MOD_SHORT = 2
  4088. const _MOD_LONG = 3
  4089. const _MOD_QUAD = 4
  4090. const _MOD_INTMAXT = 5
  4091. const _MOD_LONGDOUBLE = 6
  4092. const _MOD_PTRDIFFT = 7
  4093. const _MOD_SIZET = 8
  4094. func _get_next_format_from_precision(tls *libc.TLS, pf uintptr) (r TEFT) {
  4095. var f uintptr
  4096. var modifier _e_modifier
  4097. _, _ = f, modifier
  4098. f = *(*uintptr)(unsafe.Pointer(pf))
  4099. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) {
  4100. case int32('h'):
  4101. f++
  4102. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  4103. *(*uintptr)(unsafe.Pointer(pf)) = f
  4104. return int32(_FMTCHECK_UNKNOWN)
  4105. }
  4106. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('h') {
  4107. f++
  4108. modifier = int32(_MOD_CHAR)
  4109. } else {
  4110. modifier = int32(_MOD_SHORT)
  4111. }
  4112. case int32('j'):
  4113. f++
  4114. modifier = int32(_MOD_INTMAXT)
  4115. case int32('l'):
  4116. f++
  4117. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  4118. *(*uintptr)(unsafe.Pointer(pf)) = f
  4119. return int32(_FMTCHECK_UNKNOWN)
  4120. }
  4121. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('l') {
  4122. f++
  4123. modifier = int32(_MOD_QUAD)
  4124. } else {
  4125. modifier = int32(_MOD_LONG)
  4126. }
  4127. case int32('q'):
  4128. f++
  4129. modifier = int32(_MOD_QUAD)
  4130. case int32('t'):
  4131. f++
  4132. modifier = int32(_MOD_PTRDIFFT)
  4133. case int32('z'):
  4134. f++
  4135. modifier = int32(_MOD_SIZET)
  4136. case int32('L'):
  4137. f++
  4138. modifier = int32(_MOD_LONGDOUBLE)
  4139. default:
  4140. modifier = int32(_MOD_NONE)
  4141. break
  4142. }
  4143. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  4144. *(*uintptr)(unsafe.Pointer(pf)) = f
  4145. return int32(_FMTCHECK_UNKNOWN)
  4146. }
  4147. if libc.Xstrchr(tls, __ccgo_ts+26, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f)))) != 0 {
  4148. switch modifier {
  4149. case int32(_MOD_LONG):
  4150. goto _1
  4151. case int32(_MOD_QUAD):
  4152. goto _2
  4153. case int32(_MOD_INTMAXT):
  4154. goto _3
  4155. case int32(_MOD_PTRDIFFT):
  4156. goto _4
  4157. case int32(_MOD_SIZET):
  4158. goto _5
  4159. case int32(_MOD_NONE):
  4160. goto _6
  4161. case int32(_MOD_SHORT):
  4162. goto _7
  4163. case int32(_MOD_CHAR):
  4164. goto _8
  4165. default:
  4166. goto _9
  4167. }
  4168. goto _10
  4169. _1:
  4170. ;
  4171. _13:
  4172. ;
  4173. *(*uintptr)(unsafe.Pointer(pf)) = f
  4174. return int32(_FMTCHECK_LONG)
  4175. goto _12
  4176. _12:
  4177. ;
  4178. if 0 != 0 {
  4179. goto _13
  4180. }
  4181. goto _11
  4182. _11:
  4183. ;
  4184. _2:
  4185. ;
  4186. *(*uintptr)(unsafe.Pointer(pf)) = f
  4187. return int32(_FMTCHECK_QUAD)
  4188. _3:
  4189. ;
  4190. *(*uintptr)(unsafe.Pointer(pf)) = f
  4191. return int32(_FMTCHECK_INTMAXT)
  4192. _4:
  4193. ;
  4194. *(*uintptr)(unsafe.Pointer(pf)) = f
  4195. return int32(_FMTCHECK_PTRDIFFT)
  4196. _5:
  4197. ;
  4198. *(*uintptr)(unsafe.Pointer(pf)) = f
  4199. return int32(_FMTCHECK_SIZET)
  4200. _8:
  4201. ;
  4202. _7:
  4203. ;
  4204. _6:
  4205. ;
  4206. *(*uintptr)(unsafe.Pointer(pf)) = f
  4207. return int32(_FMTCHECK_INT)
  4208. _9:
  4209. ;
  4210. *(*uintptr)(unsafe.Pointer(pf)) = f
  4211. return int32(_FMTCHECK_UNKNOWN)
  4212. _10:
  4213. }
  4214. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('n') {
  4215. switch modifier {
  4216. case int32(_MOD_CHAR):
  4217. goto _14
  4218. case int32(_MOD_SHORT):
  4219. goto _15
  4220. case int32(_MOD_LONG):
  4221. goto _16
  4222. case int32(_MOD_QUAD):
  4223. goto _17
  4224. case int32(_MOD_INTMAXT):
  4225. goto _18
  4226. case int32(_MOD_PTRDIFFT):
  4227. goto _19
  4228. case int32(_MOD_SIZET):
  4229. goto _20
  4230. case int32(_MOD_NONE):
  4231. goto _21
  4232. default:
  4233. goto _22
  4234. }
  4235. goto _23
  4236. _14:
  4237. ;
  4238. _26:
  4239. ;
  4240. *(*uintptr)(unsafe.Pointer(pf)) = f
  4241. return int32(_FMTCHECK_CHARPOINTER)
  4242. goto _25
  4243. _25:
  4244. ;
  4245. if 0 != 0 {
  4246. goto _26
  4247. }
  4248. goto _24
  4249. _24:
  4250. ;
  4251. _15:
  4252. ;
  4253. *(*uintptr)(unsafe.Pointer(pf)) = f
  4254. return int32(_FMTCHECK_SHORTPOINTER)
  4255. _16:
  4256. ;
  4257. *(*uintptr)(unsafe.Pointer(pf)) = f
  4258. return int32(_FMTCHECK_LONGPOINTER)
  4259. _17:
  4260. ;
  4261. *(*uintptr)(unsafe.Pointer(pf)) = f
  4262. return int32(_FMTCHECK_QUADPOINTER)
  4263. _18:
  4264. ;
  4265. *(*uintptr)(unsafe.Pointer(pf)) = f
  4266. return int32(_FMTCHECK_INTMAXTPOINTER)
  4267. _19:
  4268. ;
  4269. *(*uintptr)(unsafe.Pointer(pf)) = f
  4270. return int32(_FMTCHECK_PTRDIFFTPOINTER)
  4271. _20:
  4272. ;
  4273. *(*uintptr)(unsafe.Pointer(pf)) = f
  4274. return int32(_FMTCHECK_SIZETPOINTER)
  4275. _21:
  4276. ;
  4277. *(*uintptr)(unsafe.Pointer(pf)) = f
  4278. return int32(_FMTCHECK_INTPOINTER)
  4279. _22:
  4280. ;
  4281. *(*uintptr)(unsafe.Pointer(pf)) = f
  4282. return int32(_FMTCHECK_UNKNOWN)
  4283. _23:
  4284. }
  4285. if libc.Xstrchr(tls, __ccgo_ts+33, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f)))) != 0 {
  4286. if modifier != int32(_MOD_NONE) {
  4287. *(*uintptr)(unsafe.Pointer(pf)) = f
  4288. return int32(_FMTCHECK_UNKNOWN)
  4289. }
  4290. *(*uintptr)(unsafe.Pointer(pf)) = f
  4291. return int32(_FMTCHECK_LONG)
  4292. }
  4293. if libc.Xstrchr(tls, __ccgo_ts+37, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f)))) != 0 {
  4294. switch modifier {
  4295. case int32(_MOD_LONGDOUBLE):
  4296. goto _27
  4297. case int32(_MOD_NONE):
  4298. goto _28
  4299. case int32(_MOD_LONG):
  4300. goto _29
  4301. default:
  4302. goto _30
  4303. }
  4304. goto _31
  4305. _27:
  4306. ;
  4307. _34:
  4308. ;
  4309. *(*uintptr)(unsafe.Pointer(pf)) = f
  4310. return int32(_FMTCHECK_LONGDOUBLE)
  4311. goto _33
  4312. _33:
  4313. ;
  4314. if 0 != 0 {
  4315. goto _34
  4316. }
  4317. goto _32
  4318. _32:
  4319. ;
  4320. _29:
  4321. ;
  4322. _28:
  4323. ;
  4324. *(*uintptr)(unsafe.Pointer(pf)) = f
  4325. return int32(_FMTCHECK_DOUBLE)
  4326. _30:
  4327. ;
  4328. *(*uintptr)(unsafe.Pointer(pf)) = f
  4329. return int32(_FMTCHECK_UNKNOWN)
  4330. _31:
  4331. }
  4332. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('c') {
  4333. switch modifier {
  4334. case int32(_MOD_LONG):
  4335. goto _35
  4336. case int32(_MOD_NONE):
  4337. goto _36
  4338. default:
  4339. goto _37
  4340. }
  4341. goto _38
  4342. _35:
  4343. ;
  4344. _41:
  4345. ;
  4346. *(*uintptr)(unsafe.Pointer(pf)) = f
  4347. return int32(_FMTCHECK_WINTT)
  4348. goto _40
  4349. _40:
  4350. ;
  4351. if 0 != 0 {
  4352. goto _41
  4353. }
  4354. goto _39
  4355. _39:
  4356. ;
  4357. _36:
  4358. ;
  4359. *(*uintptr)(unsafe.Pointer(pf)) = f
  4360. return int32(_FMTCHECK_INT)
  4361. _37:
  4362. ;
  4363. *(*uintptr)(unsafe.Pointer(pf)) = f
  4364. return int32(_FMTCHECK_UNKNOWN)
  4365. _38:
  4366. }
  4367. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('C') {
  4368. if modifier != int32(_MOD_NONE) {
  4369. *(*uintptr)(unsafe.Pointer(pf)) = f
  4370. return int32(_FMTCHECK_UNKNOWN)
  4371. }
  4372. *(*uintptr)(unsafe.Pointer(pf)) = f
  4373. return int32(_FMTCHECK_WINTT)
  4374. }
  4375. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('s') {
  4376. switch modifier {
  4377. case int32(_MOD_LONG):
  4378. goto _42
  4379. case int32(_MOD_NONE):
  4380. goto _43
  4381. default:
  4382. goto _44
  4383. }
  4384. goto _45
  4385. _42:
  4386. ;
  4387. _48:
  4388. ;
  4389. *(*uintptr)(unsafe.Pointer(pf)) = f
  4390. return int32(_FMTCHECK_WSTRING)
  4391. goto _47
  4392. _47:
  4393. ;
  4394. if 0 != 0 {
  4395. goto _48
  4396. }
  4397. goto _46
  4398. _46:
  4399. ;
  4400. _43:
  4401. ;
  4402. *(*uintptr)(unsafe.Pointer(pf)) = f
  4403. return int32(_FMTCHECK_STRING)
  4404. _44:
  4405. ;
  4406. *(*uintptr)(unsafe.Pointer(pf)) = f
  4407. return int32(_FMTCHECK_UNKNOWN)
  4408. _45:
  4409. }
  4410. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('S') {
  4411. if modifier != int32(_MOD_NONE) {
  4412. *(*uintptr)(unsafe.Pointer(pf)) = f
  4413. return int32(_FMTCHECK_UNKNOWN)
  4414. }
  4415. *(*uintptr)(unsafe.Pointer(pf)) = f
  4416. return int32(_FMTCHECK_WSTRING)
  4417. }
  4418. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('p') {
  4419. if modifier != int32(_MOD_NONE) {
  4420. *(*uintptr)(unsafe.Pointer(pf)) = f
  4421. return int32(_FMTCHECK_UNKNOWN)
  4422. }
  4423. *(*uintptr)(unsafe.Pointer(pf)) = f
  4424. return int32(_FMTCHECK_POINTER)
  4425. }
  4426. *(*uintptr)(unsafe.Pointer(pf)) = f
  4427. return int32(_FMTCHECK_UNKNOWN)
  4428. /*NOTREACHED*/
  4429. return r
  4430. }
  4431. func _get_next_format_from_width(tls *libc.TLS, pf uintptr) (r TEFT) {
  4432. var f uintptr
  4433. _ = f
  4434. f = *(*uintptr)(unsafe.Pointer(pf))
  4435. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('.') {
  4436. f++
  4437. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('*') {
  4438. *(*uintptr)(unsafe.Pointer(pf)) = f
  4439. return int32(_FMTCHECK_PRECISION)
  4440. }
  4441. /* eat any precision (empty is allowed) */
  4442. for libc.BoolInt32(uint32(*(*uint8)(unsafe.Pointer(f)))-uint32('0') < uint32(10)) != 0 {
  4443. f++
  4444. }
  4445. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  4446. *(*uintptr)(unsafe.Pointer(pf)) = f
  4447. return int32(_FMTCHECK_UNKNOWN)
  4448. }
  4449. }
  4450. *(*uintptr)(unsafe.Pointer(pf)) = f
  4451. return _get_next_format_from_precision(tls, pf)
  4452. /*NOTREACHED*/
  4453. return r
  4454. }
  4455. func _get_next_format(tls *libc.TLS, pf uintptr, eft TEFT) (r TEFT) {
  4456. var f uintptr
  4457. var infmt int32
  4458. _, _ = f, infmt
  4459. if eft == int32(_FMTCHECK_WIDTH) {
  4460. *(*uintptr)(unsafe.Pointer(pf))++
  4461. return _get_next_format_from_width(tls, pf)
  4462. } else {
  4463. if eft == int32(_FMTCHECK_PRECISION) {
  4464. *(*uintptr)(unsafe.Pointer(pf))++
  4465. return _get_next_format_from_precision(tls, pf)
  4466. }
  4467. }
  4468. f = *(*uintptr)(unsafe.Pointer(pf))
  4469. infmt = 0
  4470. for !(infmt != 0) {
  4471. f = libc.Xstrchr(tls, f, int32('%'))
  4472. if f == libc.UintptrFromInt32(0) {
  4473. *(*uintptr)(unsafe.Pointer(pf)) = f
  4474. return int32(_FMTCHECK_DONE)
  4475. }
  4476. f++
  4477. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  4478. *(*uintptr)(unsafe.Pointer(pf)) = f
  4479. return int32(_FMTCHECK_UNKNOWN)
  4480. }
  4481. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) != int32('%') {
  4482. infmt = int32(1)
  4483. } else {
  4484. f++
  4485. }
  4486. }
  4487. /* Eat any of the flags */
  4488. for *(*uint8)(unsafe.Pointer(f)) != 0 && libc.Xstrchr(tls, __ccgo_ts+46, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f)))) != 0 {
  4489. f++
  4490. }
  4491. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('*') {
  4492. *(*uintptr)(unsafe.Pointer(pf)) = f
  4493. return int32(_FMTCHECK_WIDTH)
  4494. }
  4495. /* eat any width */
  4496. for libc.BoolInt32(uint32(*(*uint8)(unsafe.Pointer(f)))-uint32('0') < uint32(10)) != 0 {
  4497. f++
  4498. }
  4499. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  4500. *(*uintptr)(unsafe.Pointer(pf)) = f
  4501. return int32(_FMTCHECK_UNKNOWN)
  4502. }
  4503. *(*uintptr)(unsafe.Pointer(pf)) = f
  4504. return _get_next_format_from_width(tls, pf)
  4505. /*NOTREACHED*/
  4506. return r
  4507. }
  4508. func Xfmtcheck(tls *libc.TLS, f1 uintptr, f2 uintptr) (r uintptr) {
  4509. bp := tls.Alloc(16)
  4510. defer tls.Free(16)
  4511. var f1t, f2t, v1 TEFT
  4512. var _ /* f1p at bp+0 */ uintptr
  4513. var _ /* f2p at bp+4 */ uintptr
  4514. _, _, _ = f1t, f2t, v1
  4515. if !(f1 != 0) {
  4516. return f2
  4517. }
  4518. *(*uintptr)(unsafe.Pointer(bp)) = f1
  4519. f1t = int32(_FMTCHECK_START)
  4520. *(*uintptr)(unsafe.Pointer(bp + 4)) = f2
  4521. f2t = int32(_FMTCHECK_START)
  4522. for {
  4523. v1 = _get_next_format(tls, bp, f1t)
  4524. f1t = v1
  4525. if !(v1 != int32(_FMTCHECK_DONE)) {
  4526. break
  4527. }
  4528. if f1t == int32(_FMTCHECK_UNKNOWN) {
  4529. return f2
  4530. }
  4531. f2t = _get_next_format(tls, bp+4, f2t)
  4532. if f1t != f2t {
  4533. return f2
  4534. }
  4535. }
  4536. return f1
  4537. }
  4538. const m_FPARSELN_UNESCALL1 = 15
  4539. const m_FPARSELN_UNESCCOMM1 = 4
  4540. const m_FPARSELN_UNESCCONT1 = 2
  4541. const m_FPARSELN_UNESCESC1 = 1
  4542. const m_FPARSELN_UNESCREST1 = 8
  4543. const m_static_assert = "_Static_assert"
  4544. // C documentation
  4545. //
  4546. // /* isescaped():
  4547. // * Return true if the character in *p that belongs to a string
  4548. // * that starts in *sp, is escaped by the escape character esc.
  4549. // */
  4550. func _isescaped(tls *libc.TLS, sp uintptr, p uintptr, esc int32) (r int32) {
  4551. var cp, v2 uintptr
  4552. var ne Tsize_t
  4553. _, _, _ = cp, ne, v2
  4554. /* No escape character */
  4555. if esc == int32('\000') {
  4556. return 0
  4557. }
  4558. /* Count the number of escape characters that precede ours */
  4559. ne = uint32(0)
  4560. cp = p
  4561. for {
  4562. cp--
  4563. v2 = cp
  4564. if !(v2 >= sp && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) == esc) {
  4565. break
  4566. }
  4567. goto _1
  4568. goto _1
  4569. _1:
  4570. ;
  4571. ne++
  4572. }
  4573. /* Return true if odd number of escape characters */
  4574. return libc.BoolInt32(ne&uint32(1) != uint32(0))
  4575. }
  4576. // C documentation
  4577. //
  4578. // /* fparseln():
  4579. // * Read a line from a file parsing continuations ending in * and eliminating trailing newlines, or comments starting with
  4580. // * the comment char.
  4581. // */
  4582. func Xfparseln(tls *libc.TLS, fp uintptr, size uintptr, lineno uintptr, str uintptr, flags int32) (r uintptr) {
  4583. bp := tls.Alloc(16)
  4584. defer tls.Free(16)
  4585. var buf, cp, v2, v3, v4, v5, v6, v7, v8, v9 uintptr
  4586. var cnt, skipesc int32
  4587. var com, con, esc, nl uint8
  4588. var len1 Tsize_t
  4589. var s Tssize_t
  4590. var _ /* ptr at bp+4 */ uintptr
  4591. var _ /* ptrlen at bp+0 */ Tsize_t
  4592. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = buf, cnt, com, con, cp, esc, len1, nl, s, skipesc, v2, v3, v4, v5, v6, v7, v8, v9
  4593. len1 = uint32(0)
  4594. buf = libc.UintptrFromInt32(0)
  4595. *(*Tsize_t)(unsafe.Pointer(bp)) = uint32(0)
  4596. *(*uintptr)(unsafe.Pointer(bp + 4)) = libc.UintptrFromInt32(0)
  4597. cnt = int32(1)
  4598. if str == libc.UintptrFromInt32(0) {
  4599. str = uintptr(unsafe.Pointer(&_dstr))
  4600. }
  4601. esc = *(*uint8)(unsafe.Pointer(str))
  4602. con = *(*uint8)(unsafe.Pointer(str + 1))
  4603. com = *(*uint8)(unsafe.Pointer(str + 2))
  4604. /*
  4605. * XXX: it would be cool to be able to specify the newline character,
  4606. * getdelim(3) does let us, but supporting it would diverge from BSDs.
  4607. */
  4608. nl = uint8('\n')
  4609. libc.Xflockfile(tls, fp)
  4610. for cnt != 0 {
  4611. cnt = 0
  4612. if lineno != 0 {
  4613. *(*Tsize_t)(unsafe.Pointer(lineno))++
  4614. }
  4615. s = libc.Xgetline(tls, bp+4, bp, fp)
  4616. if s < 0 {
  4617. break
  4618. }
  4619. if s != 0 && com != 0 { /* Check and eliminate comments */
  4620. cp = *(*uintptr)(unsafe.Pointer(bp + 4))
  4621. for {
  4622. if !(cp < *(*uintptr)(unsafe.Pointer(bp + 4))+uintptr(s)) {
  4623. break
  4624. }
  4625. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) == libc.Int32FromUint8(com) && !(_isescaped(tls, *(*uintptr)(unsafe.Pointer(bp + 4)), cp, libc.Int32FromUint8(esc)) != 0) {
  4626. s = int32(cp) - int32(*(*uintptr)(unsafe.Pointer(bp + 4)))
  4627. cnt = libc.BoolInt32(s == 0 && buf == libc.UintptrFromInt32(0))
  4628. break
  4629. }
  4630. goto _1
  4631. _1:
  4632. ;
  4633. cp++
  4634. }
  4635. }
  4636. if s != 0 && nl != 0 { /* Check and eliminate newlines */
  4637. cp = *(*uintptr)(unsafe.Pointer(bp + 4)) + uintptr(s-int32(1))
  4638. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) == libc.Int32FromUint8(nl) {
  4639. s--
  4640. } /* forget newline */
  4641. }
  4642. if s != 0 && con != 0 { /* Check and eliminate continuations */
  4643. cp = *(*uintptr)(unsafe.Pointer(bp + 4)) + uintptr(s-int32(1))
  4644. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) == libc.Int32FromUint8(con) && !(_isescaped(tls, *(*uintptr)(unsafe.Pointer(bp + 4)), cp, libc.Int32FromUint8(esc)) != 0) {
  4645. s-- /* forget continuation char */
  4646. cnt = int32(1)
  4647. }
  4648. }
  4649. if s == 0 {
  4650. /*
  4651. * nothing to add, skip realloc except in case
  4652. * we need a minimal buf to return an empty line
  4653. */
  4654. if cnt != 0 || buf != libc.UintptrFromInt32(0) {
  4655. continue
  4656. }
  4657. }
  4658. v2 = libc.Xrealloc(tls, buf, len1+libc.Uint32FromInt32(s)+uint32(1))
  4659. cp = v2
  4660. if v2 == libc.UintptrFromInt32(0) {
  4661. libc.Xfunlockfile(tls, fp)
  4662. libc.Xfree(tls, buf)
  4663. libc.Xfree(tls, *(*uintptr)(unsafe.Pointer(bp + 4)))
  4664. return libc.UintptrFromInt32(0)
  4665. }
  4666. buf = cp
  4667. libc.Xmemcpy(tls, buf+uintptr(len1), *(*uintptr)(unsafe.Pointer(bp + 4)), libc.Uint32FromInt32(s))
  4668. len1 += libc.Uint32FromInt32(s)
  4669. *(*uint8)(unsafe.Pointer(buf + uintptr(len1))) = uint8('\000')
  4670. }
  4671. libc.Xfunlockfile(tls, fp)
  4672. libc.Xfree(tls, *(*uintptr)(unsafe.Pointer(bp + 4)))
  4673. if flags&int32(m_FPARSELN_UNESCALL1) != 0 && esc != 0 && buf != libc.UintptrFromInt32(0) && libc.Xstrchr(tls, buf, libc.Int32FromUint8(esc)) != libc.UintptrFromInt32(0) {
  4674. v3 = buf
  4675. cp = v3
  4676. *(*uintptr)(unsafe.Pointer(bp + 4)) = v3
  4677. for libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) != int32('\000') {
  4678. for libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) != int32('\000') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) != libc.Int32FromUint8(esc) {
  4679. v4 = *(*uintptr)(unsafe.Pointer(bp + 4))
  4680. *(*uintptr)(unsafe.Pointer(bp + 4))++
  4681. v5 = cp
  4682. cp++
  4683. *(*uint8)(unsafe.Pointer(v4)) = *(*uint8)(unsafe.Pointer(v5))
  4684. }
  4685. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) == int32('\000') || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + 1))) == int32('\000') {
  4686. break
  4687. }
  4688. skipesc = 0
  4689. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + 1))) == libc.Int32FromUint8(com) {
  4690. skipesc += flags & int32(m_FPARSELN_UNESCCOMM1)
  4691. }
  4692. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + 1))) == libc.Int32FromUint8(con) {
  4693. skipesc += flags & int32(m_FPARSELN_UNESCCONT1)
  4694. }
  4695. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + 1))) == libc.Int32FromUint8(esc) {
  4696. skipesc += flags & int32(m_FPARSELN_UNESCESC1)
  4697. }
  4698. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + 1))) != libc.Int32FromUint8(com) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + 1))) != libc.Int32FromUint8(con) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + 1))) != libc.Int32FromUint8(esc) {
  4699. skipesc = flags & int32(m_FPARSELN_UNESCREST1)
  4700. }
  4701. if skipesc != 0 {
  4702. cp++
  4703. } else {
  4704. v6 = *(*uintptr)(unsafe.Pointer(bp + 4))
  4705. *(*uintptr)(unsafe.Pointer(bp + 4))++
  4706. v7 = cp
  4707. cp++
  4708. *(*uint8)(unsafe.Pointer(v6)) = *(*uint8)(unsafe.Pointer(v7))
  4709. }
  4710. v8 = *(*uintptr)(unsafe.Pointer(bp + 4))
  4711. *(*uintptr)(unsafe.Pointer(bp + 4))++
  4712. v9 = cp
  4713. cp++
  4714. *(*uint8)(unsafe.Pointer(v8)) = *(*uint8)(unsafe.Pointer(v9))
  4715. }
  4716. *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4)))) = uint8('\000')
  4717. len1 = libc.Xstrlen(tls, buf)
  4718. }
  4719. if size != 0 {
  4720. *(*Tsize_t)(unsafe.Pointer(size)) = len1
  4721. }
  4722. return buf
  4723. }
  4724. var _dstr = [3]uint8{
  4725. 0: uint8('\\'),
  4726. 1: uint8('\\'),
  4727. 2: uint8('#'),
  4728. }
  4729. const m_FSETLOCKING_BYCALLER = 2
  4730. const m_FSETLOCKING_INTERNAL = 1
  4731. const m_FSETLOCKING_QUERY = 0
  4732. func Xfpurge(tls *libc.TLS, fp uintptr) (r int32) {
  4733. if fp == libc.UintptrFromInt32(0) {
  4734. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EBADF)
  4735. return -int32(1)
  4736. }
  4737. libc.X__fpurge(tls, fp)
  4738. return 0
  4739. }
  4740. const m_FPARSELN_UNESCALL2 = 0x0f
  4741. const m_FPARSELN_UNESCCOMM2 = 0x04
  4742. const m_FPARSELN_UNESCCONT2 = 0x02
  4743. const m_FPARSELN_UNESCESC2 = 0x01
  4744. const m_FPARSELN_UNESCREST2 = 0x08
  4745. const m_KB = 1024
  4746. const m_MAXB = "GB"
  4747. func Xgetbsize(tls *libc.TLS, headerlenp uintptr, blocksizep uintptr) (r uintptr) {
  4748. bp := tls.Alloc(32)
  4749. defer tls.Free(32)
  4750. var blocksize, max, mul, n, v15, v16, v17, v4 int32
  4751. var form, p, v3 uintptr
  4752. var _ /* ep at bp+0 */ uintptr
  4753. _, _, _, _, _, _, _, _, _, _, _ = blocksize, form, max, mul, n, p, v15, v16, v17, v3, v4
  4754. form = __ccgo_ts + 53
  4755. v3 = libc.Xgetenv(tls, __ccgo_ts+54)
  4756. p = v3
  4757. if !(v3 != libc.UintptrFromInt32(0) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) != int32('\000')) {
  4758. goto _1
  4759. }
  4760. v4 = libc.Xstrtol(tls, p, bp, int32(10))
  4761. n = v4
  4762. if v4 < 0 {
  4763. goto underflow
  4764. }
  4765. if n == 0 {
  4766. n = int32(1)
  4767. }
  4768. if *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))) != 0 && *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)) != 0 {
  4769. goto fmterr
  4770. }
  4771. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) {
  4772. case int32('g'):
  4773. goto _5
  4774. case int32('G'):
  4775. goto _6
  4776. case int32('k'):
  4777. goto _7
  4778. case int32('K'):
  4779. goto _8
  4780. case int32('m'):
  4781. goto _9
  4782. case int32('M'):
  4783. goto _10
  4784. case int32('\000'):
  4785. goto _11
  4786. default:
  4787. goto _12
  4788. }
  4789. goto _13
  4790. _6:
  4791. ;
  4792. _5:
  4793. ;
  4794. form = __ccgo_ts + 64
  4795. max = libc.Int32FromInt32(1024) * libc.Int32FromInt32(1024) * libc.Int32FromInt32(1024) / (libc.Int32FromInt32(1024) * libc.Int32FromInt32(1024) * libc.Int32FromInt32(1024))
  4796. mul = libc.Int32FromInt32(1024) * libc.Int32FromInt32(1024) * libc.Int32FromInt32(1024)
  4797. goto _13
  4798. _8:
  4799. ;
  4800. _7:
  4801. ;
  4802. form = __ccgo_ts + 66
  4803. max = libc.Int32FromInt32(1024) * libc.Int32FromInt32(1024) * libc.Int32FromInt32(1024) / libc.Int32FromInt32(1024)
  4804. mul = int32(1024)
  4805. goto _13
  4806. _10:
  4807. ;
  4808. _9:
  4809. ;
  4810. form = __ccgo_ts + 68
  4811. max = libc.Int32FromInt32(1024) * libc.Int32FromInt32(1024) * libc.Int32FromInt32(1024) / (libc.Int32FromInt32(1024) * libc.Int32FromInt32(1024))
  4812. mul = libc.Int32FromInt32(1024) * libc.Int32FromInt32(1024)
  4813. goto _13
  4814. _11:
  4815. ;
  4816. max = libc.Int32FromInt32(1024) * libc.Int32FromInt32(1024) * libc.Int32FromInt32(1024)
  4817. mul = int32(1)
  4818. goto _13
  4819. _12:
  4820. ;
  4821. goto fmterr
  4822. fmterr:
  4823. ;
  4824. libc.Xwarnx(tls, __ccgo_ts+70, libc.VaList(bp+16, p))
  4825. n = int32(512)
  4826. max = libc.Int32FromInt32(1024) * libc.Int32FromInt32(1024) * libc.Int32FromInt32(1024)
  4827. mul = int32(1)
  4828. goto _13
  4829. _13:
  4830. ;
  4831. if n > max {
  4832. libc.Xwarnx(tls, __ccgo_ts+92, libc.VaList(bp+16, libc.Int32FromInt32(1024)*libc.Int32FromInt32(1024)*libc.Int32FromInt32(1024)/(libc.Int32FromInt32(1024)*libc.Int32FromInt32(1024)*libc.Int32FromInt32(1024))))
  4833. n = max
  4834. }
  4835. v15 = n * mul
  4836. blocksize = v15
  4837. if !(v15 < int32(512)) {
  4838. goto _14
  4839. }
  4840. goto underflow
  4841. underflow:
  4842. ;
  4843. libc.Xwarnx(tls, __ccgo_ts+118, 0)
  4844. form = __ccgo_ts + 53
  4845. v16 = libc.Int32FromInt32(512)
  4846. n = v16
  4847. blocksize = v16
  4848. _14:
  4849. ;
  4850. goto _2
  4851. _1:
  4852. ;
  4853. v17 = libc.Int32FromInt32(512)
  4854. n = v17
  4855. blocksize = v17
  4856. _2:
  4857. ;
  4858. libc.X__builtin_snprintf(tls, uintptr(unsafe.Pointer(&_header)), uint32(20), __ccgo_ts+143, libc.VaList(bp+16, n, form))
  4859. *(*int32)(unsafe.Pointer(headerlenp)) = libc.Int32FromUint32(libc.Xstrlen(tls, uintptr(unsafe.Pointer(&_header))))
  4860. *(*int32)(unsafe.Pointer(blocksizep)) = blocksize
  4861. return uintptr(unsafe.Pointer(&_header))
  4862. }
  4863. var _header [20]uint8
  4864. const m_AF_ALG = "PF_ALG"
  4865. const m_AF_APPLETALK = "PF_APPLETALK"
  4866. const m_AF_ASH = "PF_ASH"
  4867. const m_AF_ATMPVC = "PF_ATMPVC"
  4868. const m_AF_ATMSVC = "PF_ATMSVC"
  4869. const m_AF_AX25 = "PF_AX25"
  4870. const m_AF_BLUETOOTH = "PF_BLUETOOTH"
  4871. const m_AF_BRIDGE = "PF_BRIDGE"
  4872. const m_AF_CAIF = "PF_CAIF"
  4873. const m_AF_CAN = "PF_CAN"
  4874. const m_AF_DECnet = "PF_DECnet"
  4875. const m_AF_ECONET = "PF_ECONET"
  4876. const m_AF_FILE = "AF_LOCAL"
  4877. const m_AF_IB = "PF_IB"
  4878. const m_AF_IEEE802154 = "PF_IEEE802154"
  4879. const m_AF_INET = "PF_INET"
  4880. const m_AF_INET6 = "PF_INET6"
  4881. const m_AF_IPX = "PF_IPX"
  4882. const m_AF_IRDA = "PF_IRDA"
  4883. const m_AF_ISDN = "PF_ISDN"
  4884. const m_AF_IUCV = "PF_IUCV"
  4885. const m_AF_KCM = "PF_KCM"
  4886. const m_AF_KEY = "PF_KEY"
  4887. const m_AF_LLC = "PF_LLC"
  4888. const m_AF_LOCAL = "PF_LOCAL"
  4889. const m_AF_MAX = "PF_MAX"
  4890. const m_AF_MPLS = "PF_MPLS"
  4891. const m_AF_NETBEUI = "PF_NETBEUI"
  4892. const m_AF_NETLINK = "PF_NETLINK"
  4893. const m_AF_NETROM = "PF_NETROM"
  4894. const m_AF_NFC = "PF_NFC"
  4895. const m_AF_PACKET = "PF_PACKET"
  4896. const m_AF_PHONET = "PF_PHONET"
  4897. const m_AF_PPPOX = "PF_PPPOX"
  4898. const m_AF_QIPCRTR = "PF_QIPCRTR"
  4899. const m_AF_RDS = "PF_RDS"
  4900. const m_AF_ROSE = "PF_ROSE"
  4901. const m_AF_ROUTE = "PF_ROUTE"
  4902. const m_AF_RXRPC = "PF_RXRPC"
  4903. const m_AF_SECURITY = "PF_SECURITY"
  4904. const m_AF_SMC = "PF_SMC"
  4905. const m_AF_SNA = "PF_SNA"
  4906. const m_AF_TIPC = "PF_TIPC"
  4907. const m_AF_UNIX = "AF_LOCAL"
  4908. const m_AF_UNSPEC = "PF_UNSPEC"
  4909. const m_AF_VSOCK = "PF_VSOCK"
  4910. const m_AF_WANPIPE = "PF_WANPIPE"
  4911. const m_AF_X25 = "PF_X25"
  4912. const m_AF_XDP = "PF_XDP"
  4913. const m_INT_MAX2 = 0x7fffffff
  4914. const m_MSG_BATCH = 0x40000
  4915. const m_MSG_CMSG_CLOEXEC = 0x40000000
  4916. const m_MSG_CONFIRM = 0x0800
  4917. const m_MSG_CTRUNC = 0x0008
  4918. const m_MSG_DONTROUTE = 0x0004
  4919. const m_MSG_DONTWAIT = 0x0040
  4920. const m_MSG_EOR = 0x0080
  4921. const m_MSG_ERRQUEUE = 0x2000
  4922. const m_MSG_FASTOPEN = 0x20000000
  4923. const m_MSG_FIN = 0x0200
  4924. const m_MSG_MORE = 0x8000
  4925. const m_MSG_NOSIGNAL = 0x4000
  4926. const m_MSG_OOB = 0x0001
  4927. const m_MSG_PEEK = 0x0002
  4928. const m_MSG_PROXY = 0x0010
  4929. const m_MSG_RST = 0x1000
  4930. const m_MSG_SYN = 0x0400
  4931. const m_MSG_TRUNC = 0x0020
  4932. const m_MSG_WAITALL = 0x0100
  4933. const m_MSG_WAITFORONE = 0x10000
  4934. const m_MSG_ZEROCOPY = 0x4000000
  4935. const m_PF_ALG = 38
  4936. const m_PF_APPLETALK = 5
  4937. const m_PF_ASH = 18
  4938. const m_PF_ATMPVC = 8
  4939. const m_PF_ATMSVC = 20
  4940. const m_PF_AX25 = 3
  4941. const m_PF_BLUETOOTH = 31
  4942. const m_PF_BRIDGE = 7
  4943. const m_PF_CAIF = 37
  4944. const m_PF_CAN = 29
  4945. const m_PF_DECnet = 12
  4946. const m_PF_ECONET = 19
  4947. const m_PF_FILE = "PF_LOCAL"
  4948. const m_PF_IB = 27
  4949. const m_PF_IEEE802154 = 36
  4950. const m_PF_INET = 2
  4951. const m_PF_INET6 = 10
  4952. const m_PF_IPX = 4
  4953. const m_PF_IRDA = 23
  4954. const m_PF_ISDN = 34
  4955. const m_PF_IUCV = 32
  4956. const m_PF_KCM = 41
  4957. const m_PF_KEY = 15
  4958. const m_PF_LLC = 26
  4959. const m_PF_LOCAL = 1
  4960. const m_PF_MAX = 45
  4961. const m_PF_MPLS = 28
  4962. const m_PF_NETBEUI = 13
  4963. const m_PF_NETLINK = 16
  4964. const m_PF_NETROM = 6
  4965. const m_PF_NFC = 39
  4966. const m_PF_PACKET = 17
  4967. const m_PF_PHONET = 35
  4968. const m_PF_PPPOX = 24
  4969. const m_PF_QIPCRTR = 42
  4970. const m_PF_RDS = 21
  4971. const m_PF_ROSE = 11
  4972. const m_PF_ROUTE = "PF_NETLINK"
  4973. const m_PF_RXRPC = 33
  4974. const m_PF_SECURITY = 14
  4975. const m_PF_SMC = 43
  4976. const m_PF_SNA = 22
  4977. const m_PF_TIPC = 30
  4978. const m_PF_UNIX = "PF_LOCAL"
  4979. const m_PF_UNSPEC = 0
  4980. const m_PF_VSOCK = 40
  4981. const m_PF_WANPIPE = 25
  4982. const m_PF_X25 = 9
  4983. const m_PF_XDP = 44
  4984. const m_SCM_CREDENTIALS = 0x02
  4985. const m_SCM_RIGHTS = 0x01
  4986. const m_SCM_TIMESTAMP = "SO_TIMESTAMP"
  4987. const m_SCM_TIMESTAMPING = "SO_TIMESTAMPING"
  4988. const m_SCM_TIMESTAMPING_OPT_STATS = 54
  4989. const m_SCM_TIMESTAMPING_PKTINFO = 58
  4990. const m_SCM_TIMESTAMPNS = "SO_TIMESTAMPNS"
  4991. const m_SCM_TXTIME = "SO_TXTIME"
  4992. const m_SCM_WIFI_STATUS = "SO_WIFI_STATUS"
  4993. const m_SHUT_RD = 0
  4994. const m_SHUT_RDWR = 2
  4995. const m_SHUT_WR = 1
  4996. const m_SOCK_CLOEXEC = 02000000
  4997. const m_SOCK_DCCP = 6
  4998. const m_SOCK_DGRAM = 2
  4999. const m_SOCK_NONBLOCK = 04000
  5000. const m_SOCK_PACKET = 10
  5001. const m_SOCK_RAW = 3
  5002. const m_SOCK_RDM = 4
  5003. const m_SOCK_SEQPACKET = 5
  5004. const m_SOCK_STREAM = 1
  5005. const m_SOL_AAL = 265
  5006. const m_SOL_ALG = 279
  5007. const m_SOL_ATM = 264
  5008. const m_SOL_BLUETOOTH = 274
  5009. const m_SOL_CAIF = 278
  5010. const m_SOL_DCCP = 269
  5011. const m_SOL_DECNET = 261
  5012. const m_SOL_ICMPV6 = 58
  5013. const m_SOL_IP = 0
  5014. const m_SOL_IPV6 = 41
  5015. const m_SOL_IRDA = 266
  5016. const m_SOL_IUCV = 277
  5017. const m_SOL_KCM = 281
  5018. const m_SOL_LLC = 268
  5019. const m_SOL_NETBEUI = 267
  5020. const m_SOL_NETLINK = 270
  5021. const m_SOL_NFC = 280
  5022. const m_SOL_PACKET = 263
  5023. const m_SOL_PNPIPE = 275
  5024. const m_SOL_PPPOL2TP = 273
  5025. const m_SOL_RAW = 255
  5026. const m_SOL_RDS = 276
  5027. const m_SOL_RXRPC = 272
  5028. const m_SOL_SOCKET = 1
  5029. const m_SOL_TIPC = 271
  5030. const m_SOL_TLS = 282
  5031. const m_SOL_X25 = 262
  5032. const m_SOL_XDP = 283
  5033. const m_SOMAXCONN = 128
  5034. const m_SO_ACCEPTCONN = 30
  5035. const m_SO_ATTACH_BPF = 50
  5036. const m_SO_ATTACH_FILTER = 26
  5037. const m_SO_ATTACH_REUSEPORT_CBPF = 51
  5038. const m_SO_ATTACH_REUSEPORT_EBPF = 52
  5039. const m_SO_BINDTODEVICE = 25
  5040. const m_SO_BINDTOIFINDEX = 62
  5041. const m_SO_BPF_EXTENSIONS = 48
  5042. const m_SO_BROADCAST = 6
  5043. const m_SO_BSDCOMPAT = 14
  5044. const m_SO_BUSY_POLL = 46
  5045. const m_SO_BUSY_POLL_BUDGET = 70
  5046. const m_SO_CNX_ADVICE = 53
  5047. const m_SO_COOKIE = 57
  5048. const m_SO_DEBUG = 1
  5049. const m_SO_DETACH_BPF = "SO_DETACH_FILTER"
  5050. const m_SO_DETACH_FILTER = 27
  5051. const m_SO_DETACH_REUSEPORT_BPF = 68
  5052. const m_SO_DOMAIN = 39
  5053. const m_SO_DONTROUTE = 5
  5054. const m_SO_ERROR = 4
  5055. const m_SO_GET_FILTER = "SO_ATTACH_FILTER"
  5056. const m_SO_INCOMING_CPU = 49
  5057. const m_SO_INCOMING_NAPI_ID = 56
  5058. const m_SO_KEEPALIVE = 9
  5059. const m_SO_LINGER = 13
  5060. const m_SO_LOCK_FILTER = 44
  5061. const m_SO_MARK = 36
  5062. const m_SO_MAX_PACING_RATE = 47
  5063. const m_SO_MEMINFO = 55
  5064. const m_SO_NOFCS = 43
  5065. const m_SO_NO_CHECK = 11
  5066. const m_SO_OOBINLINE = 10
  5067. const m_SO_PASSCRED = 16
  5068. const m_SO_PASSSEC = 34
  5069. const m_SO_PEEK_OFF = 42
  5070. const m_SO_PEERCRED = 17
  5071. const m_SO_PEERGROUPS = 59
  5072. const m_SO_PEERNAME = 28
  5073. const m_SO_PEERSEC = 31
  5074. const m_SO_PREFER_BUSY_POLL = 69
  5075. const m_SO_PRIORITY = 12
  5076. const m_SO_PROTOCOL = 38
  5077. const m_SO_RCVBUF = 8
  5078. const m_SO_RCVBUFFORCE = 33
  5079. const m_SO_RCVLOWAT = 18
  5080. const m_SO_RCVTIMEO = 66
  5081. const m_SO_REUSEADDR = 2
  5082. const m_SO_REUSEPORT = 15
  5083. const m_SO_RXQ_OVFL = 40
  5084. const m_SO_SECURITY_AUTHENTICATION = 22
  5085. const m_SO_SECURITY_ENCRYPTION_NETWORK = 24
  5086. const m_SO_SECURITY_ENCRYPTION_TRANSPORT = 23
  5087. const m_SO_SELECT_ERR_QUEUE = 45
  5088. const m_SO_SNDBUF = 7
  5089. const m_SO_SNDBUFFORCE = 32
  5090. const m_SO_SNDLOWAT = 19
  5091. const m_SO_SNDTIMEO = 67
  5092. const m_SO_TIMESTAMP = 63
  5093. const m_SO_TIMESTAMPING = 65
  5094. const m_SO_TIMESTAMPNS = 64
  5095. const m_SO_TXTIME = 61
  5096. const m_SO_TYPE = 3
  5097. const m_SO_WIFI_STATUS = 41
  5098. const m_SO_ZEROCOPY = 60
  5099. const m_UINT_MAX2 = 0xffffffff
  5100. type Tsocklen_t = uint32
  5101. type Tsa_family_t = uint16
  5102. type Tmsghdr = struct {
  5103. Fmsg_name uintptr
  5104. Fmsg_namelen Tsocklen_t
  5105. Fmsg_iov uintptr
  5106. Fmsg_iovlen int32
  5107. Fmsg_control uintptr
  5108. Fmsg_controllen Tsocklen_t
  5109. Fmsg_flags int32
  5110. }
  5111. type Tcmsghdr = struct {
  5112. Fcmsg_len Tsocklen_t
  5113. Fcmsg_level int32
  5114. Fcmsg_type int32
  5115. }
  5116. type Tucred = struct {
  5117. Fpid Tpid_t
  5118. Fuid Tuid_t
  5119. Fgid Tgid_t
  5120. }
  5121. type Tmmsghdr = struct {
  5122. Fmsg_hdr Tmsghdr
  5123. Fmsg_len uint32
  5124. }
  5125. type Tlinger = struct {
  5126. Fl_onoff int32
  5127. Fl_linger int32
  5128. }
  5129. type Tsockaddr = struct {
  5130. Fsa_family Tsa_family_t
  5131. Fsa_data [14]uint8
  5132. }
  5133. type Tsockaddr_storage = struct {
  5134. Fss_family Tsa_family_t
  5135. F__ss_padding [122]uint8
  5136. F__ss_align uint32
  5137. }
  5138. type Tsockaddr_un = struct {
  5139. Fsun_family Tsa_family_t
  5140. Fsun_path [108]uint8
  5141. }
  5142. // C documentation
  5143. //
  5144. // /* Linux and OpenBSD */
  5145. func Xgetpeereid(tls *libc.TLS, s int32, euid uintptr, egid uintptr) (r int32) {
  5146. bp := tls.Alloc(16)
  5147. defer tls.Free(16)
  5148. var ret int32
  5149. var _ /* cred at bp+0 */ Tucred
  5150. var _ /* credlen at bp+12 */ Tsocklen_t
  5151. _ = ret
  5152. *(*Tsocklen_t)(unsafe.Pointer(bp + 12)) = uint32(12)
  5153. ret = libc.Xgetsockopt(tls, s, int32(m_SOL_SOCKET), int32(m_SO_PEERCRED), bp, bp+12)
  5154. if ret != 0 {
  5155. return ret
  5156. }
  5157. *(*Tuid_t)(unsafe.Pointer(euid)) = (*(*Tucred)(unsafe.Pointer(bp))).Fuid
  5158. *(*Tgid_t)(unsafe.Pointer(egid)) = (*(*Tucred)(unsafe.Pointer(bp))).Fgid
  5159. return 0
  5160. }
  5161. /*
  5162. * Swap two areas of size number of bytes. Although qsort(3) permits random
  5163. * blocks of memory to be sorted, sorting pointers is almost certainly the
  5164. * common case (and, were it not, could easily be made so). Regardless, it
  5165. * isn't worth optimizing; the SWAP's get sped up by the cache, and pointer
  5166. * arithmetic gets lost in the time required for comparison function calls.
  5167. */
  5168. /* Copy one block of size size to another. */
  5169. /*
  5170. * Build the list into a heap, where a heap is defined such that for
  5171. * the records K1 ... KN, Kj/2 >= Kj for 1 <= j/2 <= j <= N.
  5172. *
  5173. * There are two cases. If j == nmemb, select largest of Ki and Kj. If
  5174. * j < nmemb, select largest of Ki, Kj and Kj+1.
  5175. */
  5176. /*
  5177. * Select the top of the heap and 'heapify'. Since by far the most expensive
  5178. * action is the call to the compar function, a considerable optimization
  5179. * in the average case can be achieved due to the fact that k, the displaced
  5180. * element, is usually quite small, so it would be preferable to first
  5181. * heapify, always maintaining the invariant that the larger child is copied
  5182. * over its parent's record.
  5183. *
  5184. * Then, starting from the *bottom* of the heap, finding k's correct place,
  5185. * again maintaining the invariant. As a result of the invariant no element
  5186. * is 'lost' when k is assigned its correct place in the heap.
  5187. *
  5188. * The time savings from this optimization are on the order of 15-20% for the
  5189. * average case. See Knuth, Vol. 3, page 158, problem 18.
  5190. *
  5191. * XXX Don't break the #define SELECT line, below. Reiser cpp gets upset.
  5192. */
  5193. // C documentation
  5194. //
  5195. // /*
  5196. // * Heapsort -- Knuth, Vol. 3, page 145. Runs in O (N lg N), both average
  5197. // * and worst. While heapsort is faster than the worst case of quicksort,
  5198. // * the BSD quicksort does median selection so that the chance of finding
  5199. // * a data set that will trigger the worst case is nonexistent. Heapsort's
  5200. // * only advantage over quicksort is that it requires little additional memory.
  5201. // */
  5202. func Xheapsort(tls *libc.TLS, vbase uintptr, nmemb Tsize_t, size Tsize_t, compar uintptr) (r int32) {
  5203. var base, k, p, t, tmp1, tmp2, v1, v12, v13, v16, v17, v22, v23, v27, v28, v31, v32, v8, v9 uintptr
  5204. var cnt, i, j, l, v10, v14, v19, v20, v25, v29, v3, v5, v6 Tsize_t
  5205. var tmp uint8
  5206. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = base, cnt, i, j, k, l, p, t, tmp, tmp1, tmp2, v1, v10, v12, v13, v14, v16, v17, v19, v20, v22, v23, v25, v27, v28, v29, v3, v31, v32, v5, v6, v8, v9
  5207. if nmemb <= uint32(1) {
  5208. return 0
  5209. }
  5210. if !(size != 0) {
  5211. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  5212. return -int32(1)
  5213. }
  5214. v1 = libc.Xmalloc(tls, size)
  5215. k = v1
  5216. if v1 == libc.UintptrFromInt32(0) {
  5217. return -int32(1)
  5218. }
  5219. /*
  5220. * Items are numbered from 1 to nmemb, so offset from size bytes
  5221. * below the starting address.
  5222. */
  5223. base = vbase - uintptr(size)
  5224. l = nmemb/uint32(2) + uint32(1)
  5225. for {
  5226. l--
  5227. v3 = l
  5228. if !(v3 != 0) {
  5229. break
  5230. }
  5231. i = l
  5232. for {
  5233. v5 = i * libc.Uint32FromInt32(2)
  5234. j = v5
  5235. if !(v5 <= nmemb) {
  5236. break
  5237. }
  5238. p = base + uintptr(j*size)
  5239. if j < nmemb && (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{compar})))(tls, p, p+uintptr(size)) < 0 {
  5240. p += uintptr(size)
  5241. j++
  5242. }
  5243. t = base + uintptr(i*size)
  5244. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{compar})))(tls, p, t) <= 0 {
  5245. break
  5246. }
  5247. cnt = size
  5248. for {
  5249. tmp = *(*uint8)(unsafe.Pointer(t))
  5250. v8 = t
  5251. t++
  5252. *(*uint8)(unsafe.Pointer(v8)) = *(*uint8)(unsafe.Pointer(p))
  5253. v9 = p
  5254. p++
  5255. *(*uint8)(unsafe.Pointer(v9)) = tmp
  5256. goto _7
  5257. _7:
  5258. ;
  5259. cnt--
  5260. v6 = cnt
  5261. if !(v6 != 0) {
  5262. break
  5263. }
  5264. }
  5265. goto _4
  5266. _4:
  5267. ;
  5268. i = j
  5269. }
  5270. goto _2
  5271. _2:
  5272. }
  5273. /*
  5274. * For each element of the heap, save the largest element into its
  5275. * final slot, save the displaced element (k), then recreate the
  5276. * heap.
  5277. */
  5278. for nmemb > uint32(1) {
  5279. cnt = size
  5280. tmp1 = k
  5281. tmp2 = base + uintptr(nmemb*size)
  5282. for {
  5283. v12 = tmp1
  5284. tmp1++
  5285. v13 = tmp2
  5286. tmp2++
  5287. *(*uint8)(unsafe.Pointer(v12)) = *(*uint8)(unsafe.Pointer(v13))
  5288. goto _11
  5289. _11:
  5290. ;
  5291. cnt--
  5292. v10 = cnt
  5293. if !(v10 != 0) {
  5294. break
  5295. }
  5296. }
  5297. cnt = size
  5298. tmp1 = base + uintptr(nmemb*size)
  5299. tmp2 = base + uintptr(size)
  5300. for {
  5301. v16 = tmp1
  5302. tmp1++
  5303. v17 = tmp2
  5304. tmp2++
  5305. *(*uint8)(unsafe.Pointer(v16)) = *(*uint8)(unsafe.Pointer(v17))
  5306. goto _15
  5307. _15:
  5308. ;
  5309. cnt--
  5310. v14 = cnt
  5311. if !(v14 != 0) {
  5312. break
  5313. }
  5314. }
  5315. nmemb--
  5316. i = uint32(1)
  5317. for {
  5318. v19 = i * libc.Uint32FromInt32(2)
  5319. j = v19
  5320. if !(v19 <= nmemb) {
  5321. break
  5322. }
  5323. p = base + uintptr(j*size)
  5324. if j < nmemb && (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{compar})))(tls, p, p+uintptr(size)) < 0 {
  5325. p += uintptr(size)
  5326. j++
  5327. }
  5328. t = base + uintptr(i*size)
  5329. cnt = size
  5330. tmp1 = t
  5331. tmp2 = p
  5332. for {
  5333. v22 = tmp1
  5334. tmp1++
  5335. v23 = tmp2
  5336. tmp2++
  5337. *(*uint8)(unsafe.Pointer(v22)) = *(*uint8)(unsafe.Pointer(v23))
  5338. goto _21
  5339. _21:
  5340. ;
  5341. cnt--
  5342. v20 = cnt
  5343. if !(v20 != 0) {
  5344. break
  5345. }
  5346. }
  5347. goto _18
  5348. _18:
  5349. ;
  5350. i = j
  5351. }
  5352. for {
  5353. j = i
  5354. i = j / uint32(2)
  5355. p = base + uintptr(j*size)
  5356. t = base + uintptr(i*size)
  5357. if j == uint32(1) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{compar})))(tls, k, t) < 0 {
  5358. cnt = size
  5359. tmp1 = p
  5360. tmp2 = k
  5361. for {
  5362. v27 = tmp1
  5363. tmp1++
  5364. v28 = tmp2
  5365. tmp2++
  5366. *(*uint8)(unsafe.Pointer(v27)) = *(*uint8)(unsafe.Pointer(v28))
  5367. goto _26
  5368. _26:
  5369. ;
  5370. cnt--
  5371. v25 = cnt
  5372. if !(v25 != 0) {
  5373. break
  5374. }
  5375. }
  5376. break
  5377. }
  5378. cnt = size
  5379. tmp1 = p
  5380. tmp2 = t
  5381. for {
  5382. v31 = tmp1
  5383. tmp1++
  5384. v32 = tmp2
  5385. tmp2++
  5386. *(*uint8)(unsafe.Pointer(v31)) = *(*uint8)(unsafe.Pointer(v32))
  5387. goto _30
  5388. _30:
  5389. ;
  5390. cnt--
  5391. v29 = cnt
  5392. if !(v29 != 0) {
  5393. break
  5394. }
  5395. }
  5396. goto _24
  5397. _24:
  5398. }
  5399. }
  5400. libc.Xfree(tls, k)
  5401. return 0
  5402. }
  5403. const m_HN_AUTOSCALE1 = 32
  5404. const m_HN_B1 = 4
  5405. const m_HN_DECIMAL1 = 1
  5406. const m_HN_DIVISOR_10001 = 8
  5407. const m_HN_GETSCALE1 = 16
  5408. const m_HN_IEC_PREFIXES1 = 16
  5409. const m_HN_NOSPACE1 = 2
  5410. const m_LC_ALL = 6
  5411. const m_LC_ALL_MASK = 0x7fffffff
  5412. const m_LC_COLLATE = 3
  5413. const m_LC_CTYPE = 0
  5414. const m_LC_MESSAGES = 5
  5415. const m_LC_MONETARY = 4
  5416. const m_LC_NUMERIC = 1
  5417. const m_LC_TIME = 2
  5418. type Tlconv = struct {
  5419. Fdecimal_point uintptr
  5420. Fthousands_sep uintptr
  5421. Fgrouping uintptr
  5422. Fint_curr_symbol uintptr
  5423. Fcurrency_symbol uintptr
  5424. Fmon_decimal_point uintptr
  5425. Fmon_thousands_sep uintptr
  5426. Fmon_grouping uintptr
  5427. Fpositive_sign uintptr
  5428. Fnegative_sign uintptr
  5429. Fint_frac_digits uint8
  5430. Ffrac_digits uint8
  5431. Fp_cs_precedes uint8
  5432. Fp_sep_by_space uint8
  5433. Fn_cs_precedes uint8
  5434. Fn_sep_by_space uint8
  5435. Fp_sign_posn uint8
  5436. Fn_sign_posn uint8
  5437. Fint_p_cs_precedes uint8
  5438. Fint_p_sep_by_space uint8
  5439. Fint_n_cs_precedes uint8
  5440. Fint_n_sep_by_space uint8
  5441. Fint_p_sign_posn uint8
  5442. Fint_n_sign_posn uint8
  5443. }
  5444. /*
  5445. * Copyright (c) 1996 Peter Wemm <peter@FreeBSD.org>.
  5446. * All rights reserved.
  5447. * Copyright (c) 2002 Networks Associates Technology, Inc.
  5448. * All rights reserved.
  5449. *
  5450. * Portions of this software were developed for the FreeBSD Project by
  5451. * ThinkSec AS and NAI Labs, the Security Research Division of Network
  5452. * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
  5453. * ("CBOSS"), as part of the DARPA CHATS research program.
  5454. *
  5455. * Redistribution and use in source and binary forms, with or without
  5456. * modification, is permitted provided that the following conditions
  5457. * are met:
  5458. * 1. Redistributions of source code must retain the above copyright
  5459. * notice, this list of conditions and the following disclaimer.
  5460. * 2. Redistributions in binary form must reproduce the above copyright
  5461. * notice, this list of conditions and the following disclaimer in the
  5462. * documentation and/or other materials provided with the distribution.
  5463. * 3. The name of the author may not be used to endorse or promote
  5464. * products derived from this software without specific prior written
  5465. * permission.
  5466. *
  5467. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  5468. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  5469. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  5470. * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  5471. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  5472. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  5473. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  5474. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  5475. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  5476. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  5477. * SUCH DAMAGE.
  5478. *
  5479. * $FreeBSD: src/lib/libutil/libutil.h,v 1.47 2008/04/23 00:49:12 scf Exp $
  5480. */
  5481. var _maxscale = int32(6)
  5482. func Xhumanize_number(tls *libc.TLS, buf uintptr, len1 Tsize_t, quotient Tint64_t, suffix uintptr, scale int32, flags int32) (r1 int32) {
  5483. bp := tls.Alloc(64)
  5484. defer tls.Free(64)
  5485. var baselen Tsize_t
  5486. var divisor, max Tint64_t
  5487. var divisordeccut, i, r, remainder, s1, s2, sign, v2 int32
  5488. var prefixes, sep uintptr
  5489. _, _, _, _, _, _, _, _, _, _, _, _, _ = baselen, divisor, divisordeccut, i, max, prefixes, r, remainder, s1, s2, sep, sign, v2
  5490. /* Since so many callers don't check -1, NUL terminate the buffer */
  5491. if len1 > uint32(0) {
  5492. *(*uint8)(unsafe.Pointer(buf)) = uint8('\000')
  5493. }
  5494. /* validate args */
  5495. if buf == libc.UintptrFromInt32(0) || suffix == libc.UintptrFromInt32(0) {
  5496. return -int32(1)
  5497. }
  5498. if scale < 0 {
  5499. return -int32(1)
  5500. } else {
  5501. if scale > _maxscale && scale & ^(libc.Int32FromInt32(m_HN_AUTOSCALE1)|libc.Int32FromInt32(m_HN_GETSCALE1)) != 0 {
  5502. return -int32(1)
  5503. }
  5504. }
  5505. if flags&int32(m_HN_DIVISOR_10001) != 0 && flags&int32(m_HN_IEC_PREFIXES1) != 0 {
  5506. return -int32(1)
  5507. }
  5508. /* setup parameters */
  5509. remainder = 0
  5510. if flags&int32(m_HN_IEC_PREFIXES1) != 0 {
  5511. baselen = uint32(2)
  5512. /*
  5513. * Use the prefixes for power of two recommended by
  5514. * the International Electrotechnical Commission
  5515. * (IEC) in IEC 80000-3 (i.e. Ki, Mi, Gi...).
  5516. *
  5517. * HN_IEC_PREFIXES implies a divisor of 1024 here
  5518. * (use of HN_DIVISOR_1000 would have triggered
  5519. * an assertion earlier).
  5520. */
  5521. divisor = int64(1024)
  5522. divisordeccut = int32(973) /* ceil(.95 * 1024) */
  5523. if flags&int32(m_HN_B1) != 0 {
  5524. prefixes = __ccgo_ts + 156
  5525. } else {
  5526. prefixes = __ccgo_ts + 177
  5527. }
  5528. } else {
  5529. baselen = uint32(1)
  5530. if flags&int32(m_HN_DIVISOR_10001) != 0 {
  5531. divisor = int64(1000)
  5532. divisordeccut = int32(950)
  5533. if flags&int32(m_HN_B1) != 0 {
  5534. prefixes = __ccgo_ts + 198
  5535. } else {
  5536. prefixes = __ccgo_ts + 218
  5537. }
  5538. } else {
  5539. divisor = int64(1024)
  5540. divisordeccut = int32(973) /* ceil(.95 * 1024) */
  5541. if flags&int32(m_HN_B1) != 0 {
  5542. prefixes = __ccgo_ts + 238
  5543. } else {
  5544. prefixes = __ccgo_ts + 258
  5545. }
  5546. }
  5547. }
  5548. if quotient < 0 {
  5549. sign = -int32(1)
  5550. quotient = -quotient
  5551. baselen += uint32(2) /* sign, digit */
  5552. } else {
  5553. sign = int32(1)
  5554. baselen += uint32(1) /* digit */
  5555. }
  5556. if flags&int32(m_HN_NOSPACE1) != 0 {
  5557. sep = __ccgo_ts + 53
  5558. } else {
  5559. sep = __ccgo_ts + 278
  5560. baselen++
  5561. }
  5562. baselen += libc.Xstrlen(tls, suffix)
  5563. /* Check if enough room for `x y' + suffix + `\0' */
  5564. if len1 < baselen+uint32(1) {
  5565. return -int32(1)
  5566. }
  5567. if scale&(libc.Int32FromInt32(m_HN_AUTOSCALE1)|libc.Int32FromInt32(m_HN_GETSCALE1)) != 0 {
  5568. /* See if there is additional columns can be used. */
  5569. max = int64(1)
  5570. i = libc.Int32FromUint32(len1 - baselen)
  5571. for {
  5572. v2 = i
  5573. i--
  5574. if !(v2 > 0) {
  5575. break
  5576. }
  5577. max *= int64(10)
  5578. goto _1
  5579. _1:
  5580. }
  5581. /*
  5582. * Divide the number until it fits the given column.
  5583. * If there will be an overflow by the rounding below,
  5584. * divide once more.
  5585. */
  5586. i = 0
  5587. for {
  5588. if !((quotient >= max || quotient == max-int64(1) && (remainder >= divisordeccut || int64(remainder) >= divisor/int64(2))) && i < _maxscale) {
  5589. break
  5590. }
  5591. remainder = int32(quotient % divisor)
  5592. quotient /= divisor
  5593. goto _3
  5594. _3:
  5595. ;
  5596. i++
  5597. }
  5598. if scale&int32(m_HN_GETSCALE1) != 0 {
  5599. return i
  5600. }
  5601. } else {
  5602. i = 0
  5603. for {
  5604. if !(i < scale && i < _maxscale) {
  5605. break
  5606. }
  5607. remainder = int32(quotient % divisor)
  5608. quotient /= divisor
  5609. goto _4
  5610. _4:
  5611. ;
  5612. i++
  5613. }
  5614. }
  5615. /* If a value <= 9.9 after rounding and ... */
  5616. /*
  5617. * XXX - should we make sure there is enough space for the decimal
  5618. * place and if not, don't do HN_DECIMAL?
  5619. */
  5620. if (quotient == int64(9) && remainder < divisordeccut || quotient < int64(9)) && i > 0 && flags&int32(m_HN_DECIMAL1) != 0 {
  5621. s1 = int32(int64(int32(quotient)) + (int64(remainder*int32(10))+divisor/int64(2))/divisor/int64(10))
  5622. s2 = int32((int64(remainder*int32(10)) + divisor/int64(2)) / divisor % int64(10))
  5623. r = libc.X__builtin_snprintf(tls, buf, len1, __ccgo_ts+280, libc.VaList(bp+8, sign*s1, (*Tlconv)(unsafe.Pointer(libc.Xlocaleconv(tls))).Fdecimal_point, s2, sep, prefixes+uintptr(i*int32(3)), suffix))
  5624. } else {
  5625. r = libc.X__builtin_snprintf(tls, buf, len1, __ccgo_ts+293, libc.VaList(bp+8, int64(sign)*(quotient+(int64(remainder)+divisor/int64(2))/divisor), sep, prefixes+uintptr(i*int32(3)), suffix))
  5626. }
  5627. return r
  5628. }
  5629. const m_HN_AUTOSCALE2 = 0x20
  5630. const m_HN_B2 = 0x04
  5631. const m_HN_DECIMAL2 = 0x01
  5632. const m_HN_DIVISOR_10002 = 0x08
  5633. const m_HN_GETSCALE2 = 0x10
  5634. const m_HN_IEC_PREFIXES2 = 0x10
  5635. const m_HN_NOSPACE2 = 0x02
  5636. const m_INET6_ADDRSTRLEN = 46
  5637. const m_INET_ADDRSTRLEN = 16
  5638. const m_IN_CLASSA_MAX = 128
  5639. const m_IN_CLASSA_NET = 0xff000000
  5640. const m_IN_CLASSA_NSHIFT = 24
  5641. const m_IN_CLASSB_MAX = 65536
  5642. const m_IN_CLASSB_NET = 0xffff0000
  5643. const m_IN_CLASSB_NSHIFT = 16
  5644. const m_IN_CLASSC_NET = 0xffffff00
  5645. const m_IN_CLASSC_NSHIFT = 8
  5646. const m_IN_LOOPBACKNET = 127
  5647. const m_IPPORT_RESERVED = 1024
  5648. const m_IPPROTO_AH = 51
  5649. const m_IPPROTO_BEETPH = 94
  5650. const m_IPPROTO_COMP = 108
  5651. const m_IPPROTO_DCCP = 33
  5652. const m_IPPROTO_DSTOPTS = 60
  5653. const m_IPPROTO_EGP = 8
  5654. const m_IPPROTO_ENCAP = 98
  5655. const m_IPPROTO_ESP = 50
  5656. const m_IPPROTO_ETHERNET = 143
  5657. const m_IPPROTO_FRAGMENT = 44
  5658. const m_IPPROTO_GRE = 47
  5659. const m_IPPROTO_HOPOPTS = 0
  5660. const m_IPPROTO_ICMP = 1
  5661. const m_IPPROTO_ICMPV6 = 58
  5662. const m_IPPROTO_IDP = 22
  5663. const m_IPPROTO_IGMP = 2
  5664. const m_IPPROTO_IP = 0
  5665. const m_IPPROTO_IPIP = 4
  5666. const m_IPPROTO_IPV6 = 41
  5667. const m_IPPROTO_MAX = 263
  5668. const m_IPPROTO_MH = 135
  5669. const m_IPPROTO_MPLS = 137
  5670. const m_IPPROTO_MPTCP = 262
  5671. const m_IPPROTO_MTP = 92
  5672. const m_IPPROTO_NONE = 59
  5673. const m_IPPROTO_PIM = 103
  5674. const m_IPPROTO_PUP = 12
  5675. const m_IPPROTO_RAW = 255
  5676. const m_IPPROTO_ROUTING = 43
  5677. const m_IPPROTO_RSVP = 46
  5678. const m_IPPROTO_SCTP = 132
  5679. const m_IPPROTO_TCP = 6
  5680. const m_IPPROTO_TP = 29
  5681. const m_IPPROTO_UDP = 17
  5682. const m_IPPROTO_UDPLITE = 136
  5683. const m_IPV6_2292DSTOPTS = 4
  5684. const m_IPV6_2292HOPLIMIT = 8
  5685. const m_IPV6_2292HOPOPTS = 3
  5686. const m_IPV6_2292PKTINFO = 2
  5687. const m_IPV6_2292PKTOPTIONS = 6
  5688. const m_IPV6_2292RTHDR = 5
  5689. const m_IPV6_ADDRFORM = 1
  5690. const m_IPV6_ADDR_PREFERENCES = 72
  5691. const m_IPV6_ADD_MEMBERSHIP = "IPV6_JOIN_GROUP"
  5692. const m_IPV6_AUTHHDR = 10
  5693. const m_IPV6_AUTOFLOWLABEL = 70
  5694. const m_IPV6_CHECKSUM = 7
  5695. const m_IPV6_DONTFRAG = 62
  5696. const m_IPV6_DROP_MEMBERSHIP = "IPV6_LEAVE_GROUP"
  5697. const m_IPV6_DSTOPTS = 59
  5698. const m_IPV6_FREEBIND = 78
  5699. const m_IPV6_HDRINCL = 36
  5700. const m_IPV6_HOPLIMIT = 52
  5701. const m_IPV6_HOPOPTS = 54
  5702. const m_IPV6_IPSEC_POLICY = 34
  5703. const m_IPV6_JOIN_ANYCAST = 27
  5704. const m_IPV6_JOIN_GROUP = 20
  5705. const m_IPV6_LEAVE_ANYCAST = 28
  5706. const m_IPV6_LEAVE_GROUP = 21
  5707. const m_IPV6_MINHOPCOUNT = 73
  5708. const m_IPV6_MTU = 24
  5709. const m_IPV6_MTU_DISCOVER = 23
  5710. const m_IPV6_MULTICAST_ALL = 29
  5711. const m_IPV6_MULTICAST_HOPS = 18
  5712. const m_IPV6_MULTICAST_IF = 17
  5713. const m_IPV6_MULTICAST_LOOP = 19
  5714. const m_IPV6_NEXTHOP = 9
  5715. const m_IPV6_ORIGDSTADDR = 74
  5716. const m_IPV6_PATHMTU = 61
  5717. const m_IPV6_PKTINFO = 50
  5718. const m_IPV6_PMTUDISC_DO = 2
  5719. const m_IPV6_PMTUDISC_DONT = 0
  5720. const m_IPV6_PMTUDISC_INTERFACE = 4
  5721. const m_IPV6_PMTUDISC_OMIT = 5
  5722. const m_IPV6_PMTUDISC_PROBE = 3
  5723. const m_IPV6_PMTUDISC_WANT = 1
  5724. const m_IPV6_PREFER_SRC_CGA = 0x0008
  5725. const m_IPV6_PREFER_SRC_COA = 0x0004
  5726. const m_IPV6_PREFER_SRC_HOME = 0x0400
  5727. const m_IPV6_PREFER_SRC_NONCGA = 0x0800
  5728. const m_IPV6_PREFER_SRC_PUBLIC = 0x0002
  5729. const m_IPV6_PREFER_SRC_PUBTMP_DEFAULT = 0x0100
  5730. const m_IPV6_PREFER_SRC_TMP = 0x0001
  5731. const m_IPV6_RECVDSTOPTS = 58
  5732. const m_IPV6_RECVERR = 25
  5733. const m_IPV6_RECVFRAGSIZE = 77
  5734. const m_IPV6_RECVHOPLIMIT = 51
  5735. const m_IPV6_RECVHOPOPTS = 53
  5736. const m_IPV6_RECVORIGDSTADDR = "IPV6_ORIGDSTADDR"
  5737. const m_IPV6_RECVPATHMTU = 60
  5738. const m_IPV6_RECVPKTINFO = 49
  5739. const m_IPV6_RECVRTHDR = 56
  5740. const m_IPV6_RECVTCLASS = 66
  5741. const m_IPV6_ROUTER_ALERT = 22
  5742. const m_IPV6_ROUTER_ALERT_ISOLATE = 30
  5743. const m_IPV6_RTHDR = 57
  5744. const m_IPV6_RTHDRDSTOPTS = 55
  5745. const m_IPV6_RTHDR_LOOSE = 0
  5746. const m_IPV6_RTHDR_STRICT = 1
  5747. const m_IPV6_RTHDR_TYPE_0 = 0
  5748. const m_IPV6_RXDSTOPTS = "IPV6_DSTOPTS"
  5749. const m_IPV6_RXHOPOPTS = "IPV6_HOPOPTS"
  5750. const m_IPV6_TCLASS = 67
  5751. const m_IPV6_TRANSPARENT = 75
  5752. const m_IPV6_UNICAST_HOPS = 16
  5753. const m_IPV6_UNICAST_IF = 76
  5754. const m_IPV6_V6ONLY = 26
  5755. const m_IPV6_XFRM_POLICY = 35
  5756. const m_IP_ADD_MEMBERSHIP = 35
  5757. const m_IP_ADD_SOURCE_MEMBERSHIP = 39
  5758. const m_IP_BIND_ADDRESS_NO_PORT = 24
  5759. const m_IP_BLOCK_SOURCE = 38
  5760. const m_IP_CHECKSUM = 23
  5761. const m_IP_DEFAULT_MULTICAST_LOOP = 1
  5762. const m_IP_DEFAULT_MULTICAST_TTL = 1
  5763. const m_IP_DROP_MEMBERSHIP = 36
  5764. const m_IP_DROP_SOURCE_MEMBERSHIP = 40
  5765. const m_IP_FREEBIND = 15
  5766. const m_IP_HDRINCL = 3
  5767. const m_IP_IPSEC_POLICY = 16
  5768. const m_IP_MAX_MEMBERSHIPS = 20
  5769. const m_IP_MINTTL = 21
  5770. const m_IP_MSFILTER = 41
  5771. const m_IP_MTU = 14
  5772. const m_IP_MTU_DISCOVER = 10
  5773. const m_IP_MULTICAST_ALL = 49
  5774. const m_IP_MULTICAST_IF = 32
  5775. const m_IP_MULTICAST_LOOP = 34
  5776. const m_IP_MULTICAST_TTL = 33
  5777. const m_IP_NODEFRAG = 22
  5778. const m_IP_OPTIONS = 4
  5779. const m_IP_ORIGDSTADDR = 20
  5780. const m_IP_PASSSEC = 18
  5781. const m_IP_PKTINFO = 8
  5782. const m_IP_PKTOPTIONS = 9
  5783. const m_IP_PMTUDISC = 10
  5784. const m_IP_PMTUDISC_DO = 2
  5785. const m_IP_PMTUDISC_DONT = 0
  5786. const m_IP_PMTUDISC_INTERFACE = 4
  5787. const m_IP_PMTUDISC_OMIT = 5
  5788. const m_IP_PMTUDISC_PROBE = 3
  5789. const m_IP_PMTUDISC_WANT = 1
  5790. const m_IP_RECVERR = 11
  5791. const m_IP_RECVERR_RFC4884 = 26
  5792. const m_IP_RECVFRAGSIZE = 25
  5793. const m_IP_RECVOPTS = 6
  5794. const m_IP_RECVORIGDSTADDR = "IP_ORIGDSTADDR"
  5795. const m_IP_RECVRETOPTS = "IP_RETOPTS"
  5796. const m_IP_RECVTOS = 13
  5797. const m_IP_RECVTTL = 12
  5798. const m_IP_RETOPTS = 7
  5799. const m_IP_ROUTER_ALERT = 5
  5800. const m_IP_TOS = 1
  5801. const m_IP_TRANSPARENT = 19
  5802. const m_IP_TTL = 2
  5803. const m_IP_UNBLOCK_SOURCE = 37
  5804. const m_IP_UNICAST_IF = 50
  5805. const m_IP_XFRM_POLICY = 17
  5806. const m_MCAST_BLOCK_SOURCE = 43
  5807. const m_MCAST_EXCLUDE = 0
  5808. const m_MCAST_INCLUDE = 1
  5809. const m_MCAST_JOIN_GROUP = 42
  5810. const m_MCAST_JOIN_SOURCE_GROUP = 46
  5811. const m_MCAST_LEAVE_GROUP = 45
  5812. const m_MCAST_LEAVE_SOURCE_GROUP = 47
  5813. const m_MCAST_MSFILTER = 48
  5814. const m_MCAST_UNBLOCK_SOURCE = 44
  5815. const m___UAPI_DEF_IN6_ADDR = 0
  5816. const m___UAPI_DEF_IN6_ADDR_ALT = 0
  5817. const m___UAPI_DEF_IN6_PKTINFO = 0
  5818. const m___UAPI_DEF_IN_ADDR = 0
  5819. const m___UAPI_DEF_IN_CLASS = 0
  5820. const m___UAPI_DEF_IN_IPPROTO = 0
  5821. const m___UAPI_DEF_IN_PKTINFO = 0
  5822. const m___UAPI_DEF_IP6_MTUINFO = 0
  5823. const m___UAPI_DEF_IPPROTO_V6 = 0
  5824. const m___UAPI_DEF_IPV6_MREQ = 0
  5825. const m___UAPI_DEF_IPV6_OPTIONS = 0
  5826. const m___UAPI_DEF_IP_MREQ = 0
  5827. const m___UAPI_DEF_SOCKADDR_IN = 0
  5828. const m___UAPI_DEF_SOCKADDR_IN6 = 0
  5829. type Tin_port_t = uint16
  5830. type Tin_addr_t = uint32
  5831. type Tin_addr = struct {
  5832. Fs_addr Tin_addr_t
  5833. }
  5834. type Tsockaddr_in = struct {
  5835. Fsin_family Tsa_family_t
  5836. Fsin_port Tin_port_t
  5837. Fsin_addr Tin_addr
  5838. Fsin_zero [8]Tuint8_t
  5839. }
  5840. type Tin6_addr = struct {
  5841. F__in6_union struct {
  5842. F__s6_addr16 [0][8]Tuint16_t
  5843. F__s6_addr32 [0][4]Tuint32_t
  5844. F__s6_addr [16]Tuint8_t
  5845. }
  5846. }
  5847. type Tsockaddr_in6 = struct {
  5848. Fsin6_family Tsa_family_t
  5849. Fsin6_port Tin_port_t
  5850. Fsin6_flowinfo Tuint32_t
  5851. Fsin6_addr Tin6_addr
  5852. Fsin6_scope_id Tuint32_t
  5853. }
  5854. type Tipv6_mreq = struct {
  5855. Fipv6mr_multiaddr Tin6_addr
  5856. Fipv6mr_interface uint32
  5857. }
  5858. type Tip_opts = struct {
  5859. Fip_dst Tin_addr
  5860. Fip_opts [40]uint8
  5861. }
  5862. type Tip_mreq = struct {
  5863. Fimr_multiaddr Tin_addr
  5864. Fimr_interface Tin_addr
  5865. }
  5866. type Tip_mreqn = struct {
  5867. Fimr_multiaddr Tin_addr
  5868. Fimr_address Tin_addr
  5869. Fimr_ifindex int32
  5870. }
  5871. type Tip_mreq_source = struct {
  5872. Fimr_multiaddr Tin_addr
  5873. Fimr_interface Tin_addr
  5874. Fimr_sourceaddr Tin_addr
  5875. }
  5876. type Tip_msfilter = struct {
  5877. Fimsf_multiaddr Tin_addr
  5878. Fimsf_interface Tin_addr
  5879. Fimsf_fmode Tuint32_t
  5880. Fimsf_numsrc Tuint32_t
  5881. Fimsf_slist [1]Tin_addr
  5882. }
  5883. type Tgroup_req = struct {
  5884. Fgr_interface Tuint32_t
  5885. Fgr_group Tsockaddr_storage
  5886. }
  5887. type Tgroup_source_req = struct {
  5888. Fgsr_interface Tuint32_t
  5889. Fgsr_group Tsockaddr_storage
  5890. Fgsr_source Tsockaddr_storage
  5891. }
  5892. type Tgroup_filter = struct {
  5893. Fgf_interface Tuint32_t
  5894. Fgf_group Tsockaddr_storage
  5895. Fgf_fmode Tuint32_t
  5896. Fgf_numsrc Tuint32_t
  5897. Fgf_slist [1]Tsockaddr_storage
  5898. }
  5899. type Tin_pktinfo = struct {
  5900. Fipi_ifindex int32
  5901. Fipi_spec_dst Tin_addr
  5902. Fipi_addr Tin_addr
  5903. }
  5904. type Tin6_pktinfo = struct {
  5905. Fipi6_addr Tin6_addr
  5906. Fipi6_ifindex uint32
  5907. }
  5908. type Tip6_mtuinfo = struct {
  5909. Fip6m_addr Tsockaddr_in6
  5910. Fip6m_mtu Tuint32_t
  5911. }
  5912. // C documentation
  5913. //
  5914. // /*
  5915. // * static int
  5916. // * inet_net_pton(af, src, dst, size)
  5917. // * convert network number from presentation to network format.
  5918. // * accepts hex octets, hex strings, decimal octets, and /CIDR.
  5919. // * "size" is in bytes and describes "dst".
  5920. // * return:
  5921. // * number of bits, either imputed classfully or specified with /CIDR,
  5922. // * or -1 if some failure occurred (check errno). ENOENT means it was
  5923. // * not a valid network specification.
  5924. // * author:
  5925. // * Paul Vixie (ISC), June 1996
  5926. // */
  5927. func Xinet_net_pton(tls *libc.TLS, af int32, src uintptr, dst uintptr, size Tsize_t) (r int32) {
  5928. switch af {
  5929. case int32(m_PF_INET):
  5930. return _inet_net_pton_ipv4(tls, src, dst, size)
  5931. default:
  5932. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EAFNOSUPPORT)
  5933. return -int32(1)
  5934. }
  5935. return r
  5936. }
  5937. // C documentation
  5938. //
  5939. // /*
  5940. // * static int
  5941. // * inet_net_pton_ipv4(src, dst, size)
  5942. // * convert IPv4 network number from presentation to network format.
  5943. // * accepts hex octets, hex strings, decimal octets, and /CIDR.
  5944. // * "size" is in bytes and describes "dst".
  5945. // * return:
  5946. // * number of bits, either imputed classfully or specified with /CIDR,
  5947. // * or -1 if some failure occurred (check errno). ENOENT means it was
  5948. // * not an IPv4 network specification.
  5949. // * note:
  5950. // * network byte order assumed. this means 192.5.5.240/28 has
  5951. // * 0x11110000 in its fourth octet.
  5952. // * author:
  5953. // * Paul Vixie (ISC), June 1996
  5954. // */
  5955. func _inet_net_pton_ipv4(tls *libc.TLS, src uintptr, dst uintptr, size Tsize_t) (r int32) {
  5956. var bits, ch, dirty, n, tmp, v10, v17, v2, v5 int32
  5957. var odst, v1, v11, v14, v15, v16, v18, v21, v3, v8, p4, p6 uintptr
  5958. var v13, v20, v7 Tsize_t
  5959. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bits, ch, dirty, n, odst, tmp, v1, v10, v11, v13, v14, v15, v16, v17, v18, v2, v20, v21, v3, v5, v7, v8, p4, p6
  5960. odst = dst
  5961. v1 = src
  5962. src++
  5963. ch = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v1)))
  5964. if ch == int32('0') && (libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(src))) == int32('x') || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(src))) == int32('X')) && libc.BoolInt32(uint32(*(*uint8)(unsafe.Pointer(src + 1))) < uint32(128)) != 0 && libc.Xisxdigit(tls, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(src + 1)))) != 0 {
  5965. /* Hexadecimal: Eat nybble string. */
  5966. if size <= uint32(0) {
  5967. goto emsgsize
  5968. }
  5969. *(*uint8)(unsafe.Pointer(dst)) = uint8(0)
  5970. dirty = libc.Int32FromInt32(0)
  5971. src++ /* skip x or X. */
  5972. for {
  5973. v3 = src
  5974. src++
  5975. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v3)))
  5976. ch = v2
  5977. if !(v2 != int32('\000') && libc.BoolInt32(libc.Uint32FromInt32(ch) < uint32(128)) != 0 && libc.Xisxdigit(tls, ch) != 0) {
  5978. break
  5979. }
  5980. if libc.BoolInt32(libc.Uint32FromInt32(ch)-uint32('A') < uint32(26)) != 0 {
  5981. ch = libc.Xtolower(tls, ch)
  5982. }
  5983. n = int32(libc.Xstrchr(tls, uintptr(unsafe.Pointer(&_xdigits)), ch)) - t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_xdigits)))
  5984. p4 = dst
  5985. *(*uint8)(unsafe.Pointer(p4)) = uint8(int32(*(*uint8)(unsafe.Pointer(p4))) | n)
  5986. v5 = dirty
  5987. dirty++
  5988. if !(v5 != 0) {
  5989. p6 = dst
  5990. *(*uint8)(unsafe.Pointer(p6)) = uint8(int32(*(*uint8)(unsafe.Pointer(p6))) << libc.Int32FromInt32(4))
  5991. } else {
  5992. v7 = size
  5993. size--
  5994. if v7 > uint32(0) {
  5995. dst++
  5996. v8 = dst
  5997. *(*uint8)(unsafe.Pointer(v8)) = uint8(0)
  5998. dirty = libc.Int32FromInt32(0)
  5999. } else {
  6000. goto emsgsize
  6001. }
  6002. }
  6003. }
  6004. if dirty != 0 {
  6005. size--
  6006. }
  6007. } else {
  6008. if libc.BoolInt32(libc.Uint32FromInt32(ch) < uint32(128)) != 0 && libc.BoolInt32(libc.Uint32FromInt32(ch)-uint32('0') < uint32(10)) != 0 {
  6009. /* Decimal: eat dotted digit string. */
  6010. for {
  6011. tmp = 0
  6012. for {
  6013. n = int32(libc.Xstrchr(tls, uintptr(unsafe.Pointer(&_digits)), ch)) - t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_digits)))
  6014. tmp *= int32(10)
  6015. tmp += n
  6016. if tmp > int32(255) {
  6017. goto enoent
  6018. }
  6019. goto _12
  6020. _12:
  6021. ;
  6022. v11 = src
  6023. src++
  6024. v10 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v11)))
  6025. ch = v10
  6026. if !(v10 != int32('\000') && libc.BoolInt32(libc.Uint32FromInt32(ch) < uint32(128)) != 0 && libc.BoolInt32(libc.Uint32FromInt32(ch)-uint32('0') < uint32(10)) != 0) {
  6027. break
  6028. }
  6029. }
  6030. v13 = size
  6031. size--
  6032. if v13 <= uint32(0) {
  6033. goto emsgsize
  6034. }
  6035. v14 = dst
  6036. dst++
  6037. *(*uint8)(unsafe.Pointer(v14)) = libc.Uint8FromInt32(tmp)
  6038. if ch == int32('\000') || ch == int32('/') {
  6039. break
  6040. }
  6041. if ch != int32('.') {
  6042. goto enoent
  6043. }
  6044. v15 = src
  6045. src++
  6046. ch = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v15)))
  6047. if !(libc.BoolInt32(libc.Uint32FromInt32(ch) < libc.Uint32FromInt32(128)) != 0) || !(libc.BoolInt32(libc.Uint32FromInt32(ch)-libc.Uint32FromUint8('0') < libc.Uint32FromInt32(10)) != 0) {
  6048. goto enoent
  6049. }
  6050. goto _9
  6051. _9:
  6052. }
  6053. } else {
  6054. goto enoent
  6055. }
  6056. }
  6057. bits = -int32(1)
  6058. if ch == int32('/') && libc.BoolInt32(uint32(*(*uint8)(unsafe.Pointer(src))) < uint32(128)) != 0 && libc.BoolInt32(uint32(*(*uint8)(unsafe.Pointer(src)))-uint32('0') < uint32(10)) != 0 && dst > odst {
  6059. /* CIDR width specifier. Nothing can follow it. */
  6060. v16 = src
  6061. src++
  6062. ch = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v16))) /* Skip over the /. */
  6063. bits = 0
  6064. for {
  6065. n = int32(libc.Xstrchr(tls, uintptr(unsafe.Pointer(&_digits)), ch)) - t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_digits)))
  6066. bits *= int32(10)
  6067. bits += n
  6068. goto _19
  6069. _19:
  6070. ;
  6071. v18 = src
  6072. src++
  6073. v17 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v18)))
  6074. ch = v17
  6075. if !(v17 != int32('\000') && libc.BoolInt32(libc.Uint32FromInt32(ch) < uint32(128)) != 0 && libc.BoolInt32(libc.Uint32FromInt32(ch)-uint32('0') < uint32(10)) != 0) {
  6076. break
  6077. }
  6078. }
  6079. if ch != int32('\000') {
  6080. goto enoent
  6081. }
  6082. if bits > int32(32) {
  6083. goto emsgsize
  6084. }
  6085. }
  6086. /* Firey death and destruction unless we prefetched EOS. */
  6087. if ch != int32('\000') {
  6088. goto enoent
  6089. }
  6090. /* If nothing was written to the destination, we found no address. */
  6091. if dst == odst {
  6092. goto enoent
  6093. }
  6094. /* If no CIDR spec was given, infer width from net class. */
  6095. if bits == -int32(1) {
  6096. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(odst))) >= int32(240) { /* Class E */
  6097. bits = int32(32)
  6098. } else {
  6099. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(odst))) >= int32(224) { /* Class D */
  6100. bits = int32(4)
  6101. } else {
  6102. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(odst))) >= int32(192) { /* Class C */
  6103. bits = int32(24)
  6104. } else {
  6105. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(odst))) >= int32(128) { /* Class B */
  6106. bits = int32(16)
  6107. } else { /* Class A */
  6108. bits = int32(8)
  6109. }
  6110. }
  6111. }
  6112. }
  6113. /* If imputed mask is narrower than specified octets, widen. */
  6114. if bits < (int32(dst)-int32(odst))*int32(8) {
  6115. bits = (int32(dst) - int32(odst)) * int32(8)
  6116. }
  6117. }
  6118. /* Extend network to cover the actual mask. */
  6119. for bits > (int32(dst)-int32(odst))*int32(8) {
  6120. v20 = size
  6121. size--
  6122. if v20 <= uint32(0) {
  6123. goto emsgsize
  6124. }
  6125. v21 = dst
  6126. dst++
  6127. *(*uint8)(unsafe.Pointer(v21)) = uint8('\000')
  6128. }
  6129. return bits
  6130. goto enoent
  6131. enoent:
  6132. ;
  6133. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOENT)
  6134. return -int32(1)
  6135. goto emsgsize
  6136. emsgsize:
  6137. ;
  6138. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EMSGSIZE)
  6139. return -int32(1)
  6140. }
  6141. var _xdigits = [17]uint8{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}
  6142. var _digits = [11]uint8{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}
  6143. const m_MD5_BLOCK_LENGTH = 64
  6144. const m_MD5_DIGEST_LENGTH = 16
  6145. type TMD5_CTX = struct {
  6146. F__ccgo_align [0]uint32
  6147. Fstate [4]Tuint32_t
  6148. Fcount Tuint64_t
  6149. Fbuffer [64]Tuint8_t
  6150. }
  6151. type TMD5Context = TMD5_CTX
  6152. /* Avoid polluting the namespace. Even though this makes this usage
  6153. * implementation-specific, defining it unconditionally should not be
  6154. * a problem, and better than possibly breaking unexpecting code. */
  6155. /*
  6156. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  6157. *
  6158. * Redistribution and use in source and binary forms, with or without
  6159. * modification, are permitted provided that the following conditions
  6160. * are met:
  6161. * 1. Redistributions of source code must retain the above copyright
  6162. * notice, this list of conditions and the following disclaimer.
  6163. * 2. Redistributions in binary form must reproduce the above copyright
  6164. * notice, this list of conditions and the following disclaimer in the
  6165. * documentation and/or other materials provided with the distribution.
  6166. * 3. The name of the author may not be used to endorse or promote products
  6167. * derived from this software without specific prior written permission.
  6168. *
  6169. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  6170. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  6171. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  6172. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  6173. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  6174. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  6175. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  6176. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  6177. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  6178. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  6179. */
  6180. /*
  6181. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  6182. *
  6183. * Redistribution and use in source and binary forms, with or without
  6184. * modification, are permitted provided that the following conditions
  6185. * are met:
  6186. * 1. Redistributions of source code must retain the above copyright
  6187. * notice, this list of conditions and the following disclaimer.
  6188. * 2. Redistributions in binary form must reproduce the above copyright
  6189. * notice, this list of conditions and the following disclaimer in the
  6190. * documentation and/or other materials provided with the distribution.
  6191. * 3. The name of the author may not be used to endorse or promote products
  6192. * derived from this software without specific prior written permission.
  6193. *
  6194. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  6195. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  6196. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  6197. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  6198. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  6199. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  6200. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  6201. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  6202. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  6203. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  6204. */
  6205. /* Clang expands this to 1 if an identifier is *not* reserved. */
  6206. /*
  6207. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  6208. * musl, try to handle this gracefully.
  6209. */
  6210. /* Copyright (C) 1992-2022 Free Software Foundation, Inc.
  6211. Copyright The GNU Toolchain Authors.
  6212. This file is part of the GNU C Library.
  6213. The GNU C Library is free software; you can redistribute it and/or
  6214. modify it under the terms of the GNU Lesser General Public
  6215. License as published by the Free Software Foundation; either
  6216. version 2.1 of the License, or (at your option) any later version.
  6217. The GNU C Library is distributed in the hope that it will be useful,
  6218. but WITHOUT ANY WARRANTY; without even the implied warranty of
  6219. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  6220. Lesser General Public License for more details.
  6221. You should have received a copy of the GNU Lesser General Public
  6222. License along with the GNU C Library; if not, see
  6223. <https://www.gnu.org/licenses/>. */
  6224. /* We are almost always included from features.h. */
  6225. /* The GNU libc does not support any K&R compilers or the traditional mode
  6226. of ISO C compilers anymore. Check for some of the combinations not
  6227. supported anymore. */
  6228. /* Some user header file might have defined this before. */
  6229. /* Compilers that lack __has_attribute may object to
  6230. #if defined __has_attribute && __has_attribute (...)
  6231. even though they do not need to evaluate the right-hand side of the &&.
  6232. Similarly for __has_builtin, etc. */
  6233. /* All functions, except those with callbacks or those that
  6234. synchronize memory, are leaf functions. */
  6235. /* GCC can always grok prototypes. For C++ programs we add throw()
  6236. to help it optimize the function calls. But this only works with
  6237. gcc 2.8.x and egcs. For gcc 3.4 and up we even mark C functions
  6238. as non-throwing using a function attribute since programs can use
  6239. the -fexceptions options for C code as well. */
  6240. /* These two macros are not used in glibc anymore. They are kept here
  6241. only because some other projects expect the macros to be defined. */
  6242. /* For these things, GCC behaves the ANSI way normally,
  6243. and the non-ANSI way under -traditional. */
  6244. /* This is not a typedef so `const __ptr_t' does the right thing. */
  6245. /* C++ needs to know that types and declarations are C, not C++. */
  6246. /* Fortify support. */
  6247. /* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available. */
  6248. /* Support for flexible arrays.
  6249. Headers that should use flexible arrays only if they're "real"
  6250. (e.g. only if they won't affect sizeof()) should test
  6251. #if __glibc_c99_flexarr_available. */
  6252. /* __asm__ ("xyz") is used throughout the headers to rename functions
  6253. at the assembly language level. This is wrapped by the __REDIRECT
  6254. macro, in order to support compilers that can do this some other
  6255. way. When compilers don't support asm-names at all, we have to do
  6256. preprocessor tricks instead (which don't have exactly the right
  6257. semantics, but it's the best we can do).
  6258. Example:
  6259. int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */
  6260. /*
  6261. #elif __SOME_OTHER_COMPILER__
  6262. # define __REDIRECT(name, proto, alias) name proto; _Pragma("let " #name " = " #alias)
  6263. */
  6264. /* GCC and clang have various useful declarations that can be made with
  6265. the '__attribute__' syntax. All of the ways we use this do fine if
  6266. they are omitted for compilers that don't understand it. */
  6267. /* At some point during the gcc 2.96 development the `malloc' attribute
  6268. for functions was introduced. We don't want to use it unconditionally
  6269. (although this would be possible) since it generates warnings. */
  6270. /* Tell the compiler which arguments to an allocation function
  6271. indicate the size of the allocation. */
  6272. /* Tell the compiler which argument to an allocation function
  6273. indicates the alignment of the allocation. */
  6274. /* At some point during the gcc 2.96 development the `pure' attribute
  6275. for functions was introduced. We don't want to use it unconditionally
  6276. (although this would be possible) since it generates warnings. */
  6277. /* This declaration tells the compiler that the value is constant. */
  6278. /* At some point during the gcc 3.1 development the `used' attribute
  6279. for functions was introduced. We don't want to use it unconditionally
  6280. (although this would be possible) since it generates warnings. */
  6281. /* Since version 3.2, gcc allows marking deprecated functions. */
  6282. /* Since version 4.5, gcc also allows one to specify the message printed
  6283. when a deprecated function is used. clang claims to be gcc 4.2, but
  6284. may also support this feature. */
  6285. /* At some point during the gcc 2.8 development the `format_arg' attribute
  6286. for functions was introduced. We don't want to use it unconditionally
  6287. (although this would be possible) since it generates warnings.
  6288. If several `format_arg' attributes are given for the same function, in
  6289. gcc-3.0 and older, all but the last one are ignored. In newer gccs,
  6290. all designated arguments are considered. */
  6291. /* At some point during the gcc 2.97 development the `strfmon' format
  6292. attribute for functions was introduced. We don't want to use it
  6293. unconditionally (although this would be possible) since it
  6294. generates warnings. */
  6295. /* The nonnull function attribute marks pointer parameters that
  6296. must not be NULL. This has the name __nonnull in glibc,
  6297. and __attribute_nonnull__ in files shared with Gnulib to avoid
  6298. collision with a different __nonnull in DragonFlyBSD 5.9. */
  6299. /* The returns_nonnull function attribute marks the return type of the function
  6300. as always being non-null. */
  6301. /* If fortification mode, we warn about unused results of certain
  6302. function calls which can lead to problems. */
  6303. /* Forces a function to be always inlined. */
  6304. /* Associate error messages with the source location of the call site rather
  6305. than with the source location inside the function. */
  6306. /* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
  6307. inline semantics, unless -fgnu89-inline is used. Using __GNUC_STDC_INLINE__
  6308. or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions
  6309. older than 4.3 may define these macros and still not guarantee GNU inlining
  6310. semantics.
  6311. clang++ identifies itself as gcc-4.2, but has support for GNU inlining
  6312. semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and
  6313. __GNUC_GNU_INLINE__ macro definitions. */
  6314. /* GCC 4.3 and above allow passing all anonymous arguments of an
  6315. __extern_always_inline function to some other vararg function. */
  6316. /* It is possible to compile containing GCC extensions even if GCC is
  6317. run in pedantic mode if the uses are carefully marked using the
  6318. `__extension__' keyword. But this is not generally available before
  6319. version 2.8. */
  6320. /* __restrict is known in EGCS 1.2 and above, and in clang.
  6321. It works also in C++ mode (outside of arrays), but only when spelled
  6322. as '__restrict', not 'restrict'. */
  6323. /* ISO C99 also allows to declare arrays as non-overlapping. The syntax is
  6324. array_name[restrict]
  6325. GCC 3.1 and clang support this.
  6326. This syntax is not usable in C++ mode. */
  6327. /* Undefine (also defined in libc-symbols.h). */
  6328. /* Gnulib avoids including these, as they don't work on non-glibc or
  6329. older glibc platforms. */
  6330. /* Copyright (C) 1999-2024 Free Software Foundation, Inc.
  6331. This file is part of the GNU C Library.
  6332. The GNU C Library is free software; you can redistribute it and/or
  6333. modify it under the terms of the GNU Lesser General Public
  6334. License as published by the Free Software Foundation; either
  6335. version 2.1 of the License, or (at your option) any later version.
  6336. The GNU C Library is distributed in the hope that it will be useful,
  6337. but WITHOUT ANY WARRANTY; without even the implied warranty of
  6338. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  6339. Lesser General Public License for more details.
  6340. You should have received a copy of the GNU Lesser General Public
  6341. License along with the GNU C Library; if not, see
  6342. <https://www.gnu.org/licenses/>. */
  6343. /* Properties of long double type.
  6344. Copyright (C) 2016-2022 Free Software Foundation, Inc.
  6345. This file is part of the GNU C Library.
  6346. The GNU C Library is free software; you can redistribute it and/or
  6347. modify it under the terms of the GNU Lesser General Public
  6348. License published by the Free Software Foundation; either
  6349. version 2.1 of the License, or (at your option) any later version.
  6350. The GNU C Library is distributed in the hope that it will be useful,
  6351. but WITHOUT ANY WARRANTY; without even the implied warranty of
  6352. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  6353. Lesser General Public License for more details.
  6354. You should have received a copy of the GNU Lesser General Public
  6355. License along with the GNU C Library; if not, see
  6356. <https://www.gnu.org/licenses/>. */
  6357. /* This header is included by <sys/cdefs.h>.
  6358. If long double is ABI-compatible with double, it should define
  6359. __NO_LONG_DOUBLE_MATH to 1; otherwise, it should leave
  6360. __NO_LONG_DOUBLE_MATH undefined.
  6361. If this build of the GNU C Library supports both long double
  6362. ABI-compatible with double and some other long double format not
  6363. ABI-compatible with double, it should define
  6364. __LONG_DOUBLE_MATH_OPTIONAL to 1; otherwise, it should leave
  6365. __LONG_DOUBLE_MATH_OPTIONAL undefined.
  6366. If __NO_LONG_DOUBLE_MATH is already defined, this header must not
  6367. define anything; this is needed to work with the definition of
  6368. __NO_LONG_DOUBLE_MATH in nldbl-compat.h. */
  6369. /* In the default version of this header, long double is
  6370. ABI-compatible with double. */
  6371. /* The macro __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI is used to determine the
  6372. choice of the underlying ABI of long double. It will always assume
  6373. a constant value for each translation unit.
  6374. If the value is non-zero, any API which is parameterized by the long
  6375. double type (i.e the scanf/printf family of functions or the explicitly
  6376. parameterized math.h functions) will be redirected to a compatible
  6377. implementation using _Float128 ABI via symbols suffixed with ieee128.
  6378. The mechanism this macro uses to acquire may be a function
  6379. of architecture, or target specific options used to invoke the
  6380. compiler. */
  6381. /* __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is
  6382. intended for use in preprocessor macros.
  6383. Note: MESSAGE must be a _single_ string; concatenation of string
  6384. literals is not supported. */
  6385. /* Generic selection (ISO C11) is a C-only feature, available in GCC
  6386. since version 4.9. Previous versions do not provide generic
  6387. selection, even though they might set __STDC_VERSION__ to 201112L,
  6388. when in -std=c11 mode. Thus, we must check for !defined __GNUC__
  6389. when testing __STDC_VERSION__ for generic selection support.
  6390. On the other hand, Clang also defines __GNUC__, so a clang-specific
  6391. check is required to enable the use of generic selection. */
  6392. /* Specify that a function such as setjmp or vfork may return
  6393. twice. */
  6394. /*
  6395. * On non-glibc based systems, we cannot unconditionally use the
  6396. * __GLIBC_PREREQ macro as it gets expanded before evaluation.
  6397. */
  6398. /*
  6399. * Some kFreeBSD headers expect those macros to be set for sanity checks.
  6400. */
  6401. /* Linux headers define a struct with a member names __unused.
  6402. * Debian bugs: #522773 (linux), #522774 (libc).
  6403. * Disable for now. */
  6404. /*
  6405. * Return the number of elements in a statically-allocated array,
  6406. * __x.
  6407. */
  6408. /*
  6409. * We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h>
  6410. * require it.
  6411. */
  6412. /*
  6413. * Given the pointer x to the member m of the struct s, return
  6414. * a pointer to the containing structure. When using GCC, we first
  6415. * assign pointer x to a local variable, to check that its type is
  6416. * compatible with member m.
  6417. */
  6418. func Xlibbsd_MD5Init(tls *libc.TLS, context uintptr) {
  6419. libmd.XMD5Init(tls, context)
  6420. }
  6421. var _libbsd_emit_link_warning_MD5Init = [77]uint8{'T', 'h', 'e', ' ', 'M', 'D', '5', 'I', 'n', 'i', 't', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i', 'n', ' ', 'l', 'i', 'b', 'b', 's', 'd', ' ', 'i', 's', ' ', 'a', ' ', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', ' ', 'w', 'r', 'a', 'p', 'p', 'e', 'r', ',', ' ', 'u', 's', 'e', ' ', 'l', 'i', 'b', 'm', 'd', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', '.'}
  6422. func Xlibbsd_MD5Update(tls *libc.TLS, context uintptr, data uintptr, len1 Tsize_t) {
  6423. libmd.XMD5Update(tls, context, data, len1)
  6424. }
  6425. var _libbsd_emit_link_warning_MD5Update = [79]uint8{'T', 'h', 'e', ' ', 'M', 'D', '5', 'U', 'p', 'd', 'a', 't', 'e', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i', 'n', ' ', 'l', 'i', 'b', 'b', 's', 'd', ' ', 'i', 's', ' ', 'a', ' ', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', ' ', 'w', 'r', 'a', 'p', 'p', 'e', 'r', ',', ' ', 'u', 's', 'e', ' ', 'l', 'i', 'b', 'm', 'd', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', '.'}
  6426. func Xlibbsd_MD5Pad(tls *libc.TLS, context uintptr) {
  6427. libmd.XMD5Pad(tls, context)
  6428. }
  6429. var _libbsd_emit_link_warning_MD5Pad = [76]uint8{'T', 'h', 'e', ' ', 'M', 'D', '5', 'P', 'a', 'd', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i', 'n', ' ', 'l', 'i', 'b', 'b', 's', 'd', ' ', 'i', 's', ' ', 'a', ' ', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', ' ', 'w', 'r', 'a', 'p', 'p', 'e', 'r', ',', ' ', 'u', 's', 'e', ' ', 'l', 'i', 'b', 'm', 'd', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', '.'}
  6430. func Xlibbsd_MD5Final(tls *libc.TLS, digest uintptr, context uintptr) {
  6431. libmd.XMD5Final(tls, digest, context)
  6432. }
  6433. var _libbsd_emit_link_warning_MD5Final = [78]uint8{'T', 'h', 'e', ' ', 'M', 'D', '5', 'F', 'i', 'n', 'a', 'l', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i', 'n', ' ', 'l', 'i', 'b', 'b', 's', 'd', ' ', 'i', 's', ' ', 'a', ' ', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', ' ', 'w', 'r', 'a', 'p', 'p', 'e', 'r', ',', ' ', 'u', 's', 'e', ' ', 'l', 'i', 'b', 'm', 'd', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', '.'}
  6434. func Xlibbsd_MD5Transform(tls *libc.TLS, state uintptr, block uintptr) {
  6435. libmd.XMD5Transform(tls, state, block)
  6436. }
  6437. var _libbsd_emit_link_warning_MD5Transform = [82]uint8{'T', 'h', 'e', ' ', 'M', 'D', '5', 'T', 'r', 'a', 'n', 's', 'f', 'o', 'r', 'm', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i', 'n', ' ', 'l', 'i', 'b', 'b', 's', 'd', ' ', 'i', 's', ' ', 'a', ' ', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', ' ', 'w', 'r', 'a', 'p', 'p', 'e', 'r', ',', ' ', 'u', 's', 'e', ' ', 'l', 'i', 'b', 'm', 'd', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', '.'}
  6438. func Xlibbsd_MD5End(tls *libc.TLS, context uintptr, buf uintptr) (r uintptr) {
  6439. return libmd.XMD5End(tls, context, buf)
  6440. }
  6441. var _libbsd_emit_link_warning_MD5End = [76]uint8{'T', 'h', 'e', ' ', 'M', 'D', '5', 'E', 'n', 'd', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i', 'n', ' ', 'l', 'i', 'b', 'b', 's', 'd', ' ', 'i', 's', ' ', 'a', ' ', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', ' ', 'w', 'r', 'a', 'p', 'p', 'e', 'r', ',', ' ', 'u', 's', 'e', ' ', 'l', 'i', 'b', 'm', 'd', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', '.'}
  6442. func Xlibbsd_MD5File(tls *libc.TLS, filename uintptr, buf uintptr) (r uintptr) {
  6443. return libmd.XMD5File(tls, filename, buf)
  6444. }
  6445. var _libbsd_emit_link_warning_MD5File = [77]uint8{'T', 'h', 'e', ' ', 'M', 'D', '5', 'F', 'i', 'l', 'e', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i', 'n', ' ', 'l', 'i', 'b', 'b', 's', 'd', ' ', 'i', 's', ' ', 'a', ' ', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', ' ', 'w', 'r', 'a', 'p', 'p', 'e', 'r', ',', ' ', 'u', 's', 'e', ' ', 'l', 'i', 'b', 'm', 'd', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', '.'}
  6446. func Xlibbsd_MD5FileChunk(tls *libc.TLS, filename uintptr, buf uintptr, offset Toff_t, length Toff_t) (r uintptr) {
  6447. return libmd.XMD5FileChunk(tls, filename, buf, offset, length)
  6448. }
  6449. var _libbsd_emit_link_warning_MD5FileChunk = [82]uint8{'T', 'h', 'e', ' ', 'M', 'D', '5', 'F', 'i', 'l', 'e', 'C', 'h', 'u', 'n', 'k', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i', 'n', ' ', 'l', 'i', 'b', 'b', 's', 'd', ' ', 'i', 's', ' ', 'a', ' ', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', ' ', 'w', 'r', 'a', 'p', 'p', 'e', 'r', ',', ' ', 'u', 's', 'e', ' ', 'l', 'i', 'b', 'm', 'd', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', '.'}
  6450. func Xlibbsd_MD5Data(tls *libc.TLS, data uintptr, len1 Tsize_t, buf uintptr) (r uintptr) {
  6451. return libmd.XMD5Data(tls, data, len1, buf)
  6452. }
  6453. var _libbsd_emit_link_warning_MD5Data = [77]uint8{'T', 'h', 'e', ' ', 'M', 'D', '5', 'D', 'a', 't', 'a', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i', 'n', ' ', 'l', 'i', 'b', 'b', 's', 'd', ' ', 'i', 's', ' ', 'a', ' ', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', ' ', 'w', 'r', 'a', 'p', 'p', 'e', 'r', ',', ' ', 'u', 's', 'e', ' ', 'l', 'i', 'b', 'm', 'd', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', '.'}
  6454. const m_THRESHOLD = 16
  6455. /*
  6456. * Find the next possible pointer head. (Trickery for forcing an array
  6457. * to do double duty as a linked list when objects do not align with word
  6458. * boundaries.
  6459. */
  6460. /* Assumption: PSIZE is a power of 2. */
  6461. // C documentation
  6462. //
  6463. // /*
  6464. // * Arguments are as for qsort.
  6465. // */
  6466. func Xmergesort(tls *libc.TLS, base uintptr, nmemb Tsize_t, size Tsize_t, cmp uintptr) (r int32) {
  6467. var b, f1, f2, l1, l2, last, list1, list2, p, p1, p2, q, t, tp2, v1, v10, v11, v12, v13, v15, v16, v18, v19, v21, v22, v24, v25, v26, v27, v28, v29, v4, v5 uintptr
  6468. var big, iflag, sense, v2 int32
  6469. var i, v8 Tsize_t
  6470. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = b, big, f1, f2, i, iflag, l1, l2, last, list1, list2, p, p1, p2, q, sense, t, tp2, v1, v10, v11, v12, v13, v15, v16, v18, v19, v2, v21, v22, v24, v25, v26, v27, v28, v29, v4, v5, v8
  6471. if size < libc.Uint32FromInt64(4)/libc.Uint32FromInt32(2) { /* Pointers must fit into 2 * size. */
  6472. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  6473. return -int32(1)
  6474. }
  6475. if nmemb == uint32(0) {
  6476. return 0
  6477. }
  6478. /*
  6479. * XXX
  6480. * Stupid subtraction for the Cray.
  6481. */
  6482. iflag = 0
  6483. if !(size%libc.Uint32FromInt64(4) != 0) && !(libc.Uint32FromInt32(int32(base)-int32(libc.UintptrFromInt32(0)))%libc.Uint32FromInt64(4) != 0) {
  6484. iflag = int32(1)
  6485. }
  6486. v1 = libc.Xmalloc(tls, nmemb*size+uint32(4))
  6487. list2 = v1
  6488. if v1 == libc.UintptrFromInt32(0) {
  6489. return -int32(1)
  6490. }
  6491. list1 = base
  6492. _setup(tls, list1, list2, nmemb, size, cmp)
  6493. last = list2 + uintptr(nmemb*size)
  6494. v2 = libc.Int32FromInt32(0)
  6495. big = v2
  6496. i = libc.Uint32FromInt32(v2)
  6497. for *(*uintptr)(unsafe.Pointer(libc.UintptrFromInt32(0) + uintptr(libc.Uint32FromInt32(int32(list2+libc.UintptrFromInt64(4)-libc.UintptrFromInt32(1))-int32(libc.UintptrFromInt32(0))) & ^(libc.Uint32FromInt64(4)-libc.Uint32FromInt32(1))))) != last {
  6498. l2 = list1
  6499. p1 = libc.UintptrFromInt32(0) + uintptr(libc.Uint32FromInt32(int32(list1+libc.UintptrFromInt64(4)-libc.UintptrFromInt32(1))-int32(libc.UintptrFromInt32(0))) & ^(libc.Uint32FromInt64(4)-libc.Uint32FromInt32(1)))
  6500. v4 = list2
  6501. p2 = v4
  6502. tp2 = v4
  6503. for {
  6504. if !(p2 != last) {
  6505. break
  6506. }
  6507. p2 = *(*uintptr)(unsafe.Pointer(libc.UintptrFromInt32(0) + uintptr(libc.Uint32FromInt32(int32(p2+libc.UintptrFromInt64(4)-libc.UintptrFromInt32(1))-int32(libc.UintptrFromInt32(0))) & ^(libc.Uint32FromInt64(4)-libc.Uint32FromInt32(1)))))
  6508. f1 = l2
  6509. v5 = list1 + uintptr(int32(p2)-int32(list2))
  6510. l1 = v5
  6511. f2 = v5
  6512. if p2 != last {
  6513. p2 = *(*uintptr)(unsafe.Pointer(libc.UintptrFromInt32(0) + uintptr(libc.Uint32FromInt32(int32(p2+libc.UintptrFromInt64(4)-libc.UintptrFromInt32(1))-int32(libc.UintptrFromInt32(0))) & ^(libc.Uint32FromInt64(4)-libc.Uint32FromInt32(1)))))
  6514. }
  6515. l2 = list1 + uintptr(int32(p2)-int32(list2))
  6516. for f1 < l1 && f2 < l2 {
  6517. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f1, f2) <= 0 {
  6518. q = f2
  6519. b = f1
  6520. t = l1
  6521. sense = -int32(1)
  6522. } else {
  6523. q = f1
  6524. b = f2
  6525. t = l2
  6526. sense = 0
  6527. }
  6528. if !!(big != 0) {
  6529. goto _6
  6530. } /* here i = 0 */
  6531. for {
  6532. b += uintptr(size)
  6533. if !(b < t && (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, b) > sense) {
  6534. break
  6535. }
  6536. i++
  6537. v8 = i
  6538. if v8 == uint32(6) {
  6539. big = int32(1)
  6540. goto EXPONENTIAL
  6541. }
  6542. }
  6543. goto _7
  6544. _6:
  6545. ;
  6546. goto EXPONENTIAL
  6547. EXPONENTIAL:
  6548. ;
  6549. i = size
  6550. for {
  6551. v10 = b + uintptr(i)
  6552. p = v10
  6553. if v10 >= t {
  6554. v11 = t - uintptr(size)
  6555. p = v11
  6556. if v11 > b && (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, p) <= sense {
  6557. t = p
  6558. } else {
  6559. b = p
  6560. }
  6561. break
  6562. } else {
  6563. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, p) <= sense {
  6564. t = p
  6565. if i == size {
  6566. big = 0
  6567. }
  6568. goto FASTCASE
  6569. } else {
  6570. b = p
  6571. }
  6572. }
  6573. goto _9
  6574. _9:
  6575. ;
  6576. i <<= uint32(1)
  6577. }
  6578. for t > b+uintptr(size) {
  6579. i = libc.Uint32FromInt32(int32(t)-int32(b)) / size >> int32(1) * size
  6580. v12 = b + uintptr(i)
  6581. p = v12
  6582. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, v12) <= sense {
  6583. t = p
  6584. } else {
  6585. b = p
  6586. }
  6587. }
  6588. goto COPY
  6589. goto FASTCASE
  6590. FASTCASE:
  6591. ;
  6592. for i > size {
  6593. i >>= uint32(1)
  6594. v13 = b + uintptr(i)
  6595. p = v13
  6596. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, v13) <= sense {
  6597. t = p
  6598. } else {
  6599. b = p
  6600. }
  6601. }
  6602. goto COPY
  6603. COPY:
  6604. ;
  6605. b = t
  6606. _7:
  6607. ;
  6608. i = size
  6609. if q == f1 {
  6610. if iflag != 0 {
  6611. for cond := true; cond; cond = f2 < b {
  6612. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f2))
  6613. f2 += uintptr(4)
  6614. tp2 += uintptr(4)
  6615. }
  6616. for {
  6617. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f1))
  6618. f1 += uintptr(4)
  6619. tp2 += uintptr(4)
  6620. goto _14
  6621. _14:
  6622. ;
  6623. i -= uint32(4)
  6624. if !(i != 0) {
  6625. break
  6626. }
  6627. }
  6628. } else {
  6629. for cond := true; cond; cond = f2 < b {
  6630. v15 = tp2
  6631. tp2++
  6632. v16 = f2
  6633. f2++
  6634. *(*uint8)(unsafe.Pointer(v15)) = *(*uint8)(unsafe.Pointer(v16))
  6635. }
  6636. for {
  6637. v18 = tp2
  6638. tp2++
  6639. v19 = f1
  6640. f1++
  6641. *(*uint8)(unsafe.Pointer(v18)) = *(*uint8)(unsafe.Pointer(v19))
  6642. goto _17
  6643. _17:
  6644. ;
  6645. i -= uint32(1)
  6646. if !(i != 0) {
  6647. break
  6648. }
  6649. }
  6650. }
  6651. } else {
  6652. if iflag != 0 {
  6653. for cond := true; cond; cond = f1 < b {
  6654. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f1))
  6655. f1 += uintptr(4)
  6656. tp2 += uintptr(4)
  6657. }
  6658. for {
  6659. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f2))
  6660. f2 += uintptr(4)
  6661. tp2 += uintptr(4)
  6662. goto _20
  6663. _20:
  6664. ;
  6665. i -= uint32(4)
  6666. if !(i != 0) {
  6667. break
  6668. }
  6669. }
  6670. } else {
  6671. for cond := true; cond; cond = f1 < b {
  6672. v21 = tp2
  6673. tp2++
  6674. v22 = f1
  6675. f1++
  6676. *(*uint8)(unsafe.Pointer(v21)) = *(*uint8)(unsafe.Pointer(v22))
  6677. }
  6678. for {
  6679. v24 = tp2
  6680. tp2++
  6681. v25 = f2
  6682. f2++
  6683. *(*uint8)(unsafe.Pointer(v24)) = *(*uint8)(unsafe.Pointer(v25))
  6684. goto _23
  6685. _23:
  6686. ;
  6687. i -= uint32(1)
  6688. if !(i != 0) {
  6689. break
  6690. }
  6691. }
  6692. }
  6693. }
  6694. }
  6695. if f2 < l2 {
  6696. if iflag != 0 {
  6697. for cond := true; cond; cond = f2 < l2 {
  6698. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f2))
  6699. f2 += uintptr(4)
  6700. tp2 += uintptr(4)
  6701. }
  6702. } else {
  6703. for cond := true; cond; cond = f2 < l2 {
  6704. v26 = tp2
  6705. tp2++
  6706. v27 = f2
  6707. f2++
  6708. *(*uint8)(unsafe.Pointer(v26)) = *(*uint8)(unsafe.Pointer(v27))
  6709. }
  6710. }
  6711. } else {
  6712. if f1 < l1 {
  6713. if iflag != 0 {
  6714. for cond := true; cond; cond = f1 < l1 {
  6715. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f1))
  6716. f1 += uintptr(4)
  6717. tp2 += uintptr(4)
  6718. }
  6719. } else {
  6720. for cond := true; cond; cond = f1 < l1 {
  6721. v28 = tp2
  6722. tp2++
  6723. v29 = f1
  6724. f1++
  6725. *(*uint8)(unsafe.Pointer(v28)) = *(*uint8)(unsafe.Pointer(v29))
  6726. }
  6727. }
  6728. }
  6729. }
  6730. *(*uintptr)(unsafe.Pointer(p1)) = l2
  6731. goto _3
  6732. _3:
  6733. ;
  6734. p1 = libc.UintptrFromInt32(0) + uintptr(libc.Uint32FromInt32(int32(l2+libc.UintptrFromInt64(4)-libc.UintptrFromInt32(1))-int32(libc.UintptrFromInt32(0))) & ^(libc.Uint32FromInt64(4)-libc.Uint32FromInt32(1)))
  6735. }
  6736. tp2 = list1 /* swap list1, list2 */
  6737. list1 = list2
  6738. list2 = tp2
  6739. last = list2 + uintptr(nmemb*size)
  6740. }
  6741. if base == list2 {
  6742. libc.Xmemmove(tls, list2, list1, nmemb*size)
  6743. list2 = list1
  6744. }
  6745. libc.Xfree(tls, list2)
  6746. return 0
  6747. }
  6748. // C documentation
  6749. //
  6750. // /*
  6751. // * Optional hybrid natural/pairwise first pass. Eats up list1 in runs of
  6752. // * increasing order, list2 in a corresponding linked list. Checks for runs
  6753. // * when THRESHOLD/2 pairs compare with same sense. (Only used when NATURAL
  6754. // * is defined. Otherwise simple pairwise merging is used.)
  6755. // */
  6756. func _setup(tls *libc.TLS, list1 uintptr, list2 uintptr, n Tsize_t, size Tsize_t, cmp uintptr) {
  6757. var f1, f2, l2, last, p2, s, v10, v13, v14, v17, v18, v19, v20, v4, v7, v8 uintptr
  6758. var i, length, sense, size2, tmp, v11, v15, v5 int32
  6759. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = f1, f2, i, l2, last, length, p2, s, sense, size2, tmp, v10, v11, v13, v14, v15, v17, v18, v19, v20, v4, v5, v7, v8
  6760. size2 = libc.Int32FromUint32(size * uint32(2))
  6761. if n <= uint32(5) {
  6762. _insertionsort(tls, list1, n, size, cmp)
  6763. *(*uintptr)(unsafe.Pointer(libc.UintptrFromInt32(0) + uintptr(libc.Uint32FromInt32(int32(list2+libc.UintptrFromInt64(4)-libc.UintptrFromInt32(1))-int32(libc.UintptrFromInt32(0))) & ^(libc.Uint32FromInt64(4)-libc.Uint32FromInt32(1))))) = list2 + uintptr(n*size)
  6764. return
  6765. }
  6766. /*
  6767. * Avoid running pointers out of bounds; limit n to evens
  6768. * for simplicity.
  6769. */
  6770. i = libc.Int32FromUint32(uint32(4) + n&uint32(1))
  6771. _insertionsort(tls, list1+uintptr((n-libc.Uint32FromInt32(i))*size), libc.Uint32FromInt32(i), size, cmp)
  6772. last = list1 + uintptr(size*(n-libc.Uint32FromInt32(i)))
  6773. *(*uintptr)(unsafe.Pointer(libc.UintptrFromInt32(0) + uintptr(libc.Uint32FromInt32(int32(list2+uintptr(int32(last)-int32(list1))+libc.UintptrFromInt64(4)-libc.UintptrFromInt32(1))-int32(libc.UintptrFromInt32(0))) & ^(libc.Uint32FromInt64(4)-libc.Uint32FromInt32(1))))) = list2 + uintptr(n*size)
  6774. p2 = list2
  6775. f1 = list1
  6776. sense = libc.BoolInt32((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f1, f1+uintptr(size)) > 0)
  6777. for {
  6778. if !(f1 < last) {
  6779. break
  6780. }
  6781. length = int32(2)
  6782. /* Find pairs with same sense. */
  6783. f2 = f1 + uintptr(size2)
  6784. for {
  6785. if !(f2 < last) {
  6786. break
  6787. }
  6788. if libc.BoolInt32((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f2, f2+uintptr(size)) > 0) != sense {
  6789. break
  6790. }
  6791. length += int32(2)
  6792. goto _2
  6793. _2:
  6794. ;
  6795. f2 += uintptr(size2)
  6796. }
  6797. if length < int32(m_THRESHOLD) { /* Pairwise merge */
  6798. for {
  6799. v4 = uintptr(int32(f1+uintptr(size2))-int32(list1)) + list2
  6800. *(*uintptr)(unsafe.Pointer(libc.UintptrFromInt32(0) + uintptr(libc.Uint32FromInt32(int32(p2+libc.UintptrFromInt64(4)-libc.UintptrFromInt32(1))-int32(libc.UintptrFromInt32(0))) & ^(libc.Uint32FromInt64(4)-libc.Uint32FromInt32(1))))) = v4
  6801. p2 = v4
  6802. if sense > 0 {
  6803. s = f1 + uintptr(size)
  6804. i = libc.Int32FromUint32(size)
  6805. for {
  6806. tmp = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f1)))
  6807. v7 = f1
  6808. f1++
  6809. *(*uint8)(unsafe.Pointer(v7)) = *(*uint8)(unsafe.Pointer(s))
  6810. v8 = s
  6811. s++
  6812. *(*uint8)(unsafe.Pointer(v8)) = libc.Uint8FromInt32(tmp)
  6813. goto _6
  6814. _6:
  6815. ;
  6816. i--
  6817. v5 = i
  6818. if !(v5 != 0) {
  6819. break
  6820. }
  6821. }
  6822. f1 -= uintptr(size)
  6823. }
  6824. goto _3
  6825. _3:
  6826. ;
  6827. f1 += uintptr(size2)
  6828. if !(f1 < f2) {
  6829. break
  6830. }
  6831. }
  6832. } else { /* Natural merge */
  6833. l2 = f2
  6834. f2 = f1 + uintptr(size2)
  6835. for {
  6836. if !(f2 < l2) {
  6837. break
  6838. }
  6839. if libc.BoolInt32((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f2-uintptr(size), f2) > 0) != sense {
  6840. v10 = uintptr(int32(f2)-int32(list1)) + list2
  6841. *(*uintptr)(unsafe.Pointer(libc.UintptrFromInt32(0) + uintptr(libc.Uint32FromInt32(int32(p2+libc.UintptrFromInt64(4)-libc.UintptrFromInt32(1))-int32(libc.UintptrFromInt32(0))) & ^(libc.Uint32FromInt64(4)-libc.Uint32FromInt32(1))))) = v10
  6842. p2 = v10
  6843. if sense > 0 {
  6844. s = f2 - uintptr(size)
  6845. for cond := true; cond; cond = f1 < s {
  6846. i = libc.Int32FromUint32(size)
  6847. for {
  6848. tmp = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f1)))
  6849. v13 = f1
  6850. f1++
  6851. *(*uint8)(unsafe.Pointer(v13)) = *(*uint8)(unsafe.Pointer(s))
  6852. v14 = s
  6853. s++
  6854. *(*uint8)(unsafe.Pointer(v14)) = libc.Uint8FromInt32(tmp)
  6855. goto _12
  6856. _12:
  6857. ;
  6858. i--
  6859. v11 = i
  6860. if !(v11 != 0) {
  6861. break
  6862. }
  6863. }
  6864. s -= uintptr(size2)
  6865. }
  6866. }
  6867. f1 = f2
  6868. }
  6869. goto _9
  6870. _9:
  6871. ;
  6872. f2 += uintptr(size2)
  6873. }
  6874. if sense > 0 {
  6875. s = f2 - uintptr(size)
  6876. for cond := true; cond; cond = f1 < s {
  6877. i = libc.Int32FromUint32(size)
  6878. for {
  6879. tmp = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f1)))
  6880. v17 = f1
  6881. f1++
  6882. *(*uint8)(unsafe.Pointer(v17)) = *(*uint8)(unsafe.Pointer(s))
  6883. v18 = s
  6884. s++
  6885. *(*uint8)(unsafe.Pointer(v18)) = libc.Uint8FromInt32(tmp)
  6886. goto _16
  6887. _16:
  6888. ;
  6889. i--
  6890. v15 = i
  6891. if !(v15 != 0) {
  6892. break
  6893. }
  6894. }
  6895. s -= uintptr(size2)
  6896. }
  6897. }
  6898. f1 = f2
  6899. if f2 < last || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f2-uintptr(size), f2) > 0 {
  6900. v19 = uintptr(int32(f2)-int32(list1)) + list2
  6901. *(*uintptr)(unsafe.Pointer(libc.UintptrFromInt32(0) + uintptr(libc.Uint32FromInt32(int32(p2+libc.UintptrFromInt64(4)-libc.UintptrFromInt32(1))-int32(libc.UintptrFromInt32(0))) & ^(libc.Uint32FromInt64(4)-libc.Uint32FromInt32(1))))) = v19
  6902. p2 = v19
  6903. } else {
  6904. v20 = list2 + uintptr(n*size)
  6905. *(*uintptr)(unsafe.Pointer(libc.UintptrFromInt32(0) + uintptr(libc.Uint32FromInt32(int32(p2+libc.UintptrFromInt64(4)-libc.UintptrFromInt32(1))-int32(libc.UintptrFromInt32(0))) & ^(libc.Uint32FromInt64(4)-libc.Uint32FromInt32(1))))) = v20
  6906. p2 = v20
  6907. }
  6908. }
  6909. goto _1
  6910. _1:
  6911. ;
  6912. sense = libc.BoolInt32(!(sense != 0))
  6913. }
  6914. }
  6915. // C documentation
  6916. //
  6917. // /*
  6918. // * This is to avoid out-of-bounds addresses in sorting the
  6919. // * last 4 elements.
  6920. // */
  6921. func _insertionsort(tls *libc.TLS, a uintptr, n Tsize_t, size Tsize_t, cmp uintptr) {
  6922. var ai, s, t, u, v6, v7 uintptr
  6923. var i, v4 int32
  6924. var tmp uint8
  6925. var v2 Tsize_t
  6926. _, _, _, _, _, _, _, _, _, _ = ai, i, s, t, tmp, u, v2, v4, v6, v7
  6927. ai = a + uintptr(size)
  6928. for {
  6929. n--
  6930. v2 = n
  6931. if !(v2 >= uint32(1)) {
  6932. break
  6933. }
  6934. t = ai
  6935. for {
  6936. if !(t > a) {
  6937. break
  6938. }
  6939. u = t - uintptr(size)
  6940. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, u, t) <= 0 {
  6941. break
  6942. }
  6943. s = t
  6944. i = libc.Int32FromUint32(size)
  6945. for {
  6946. tmp = *(*uint8)(unsafe.Pointer(u))
  6947. v6 = u
  6948. u++
  6949. *(*uint8)(unsafe.Pointer(v6)) = *(*uint8)(unsafe.Pointer(s))
  6950. v7 = s
  6951. s++
  6952. *(*uint8)(unsafe.Pointer(v7)) = tmp
  6953. goto _5
  6954. _5:
  6955. ;
  6956. i--
  6957. v4 = i
  6958. if !(v4 != 0) {
  6959. break
  6960. }
  6961. }
  6962. u -= uintptr(size)
  6963. goto _3
  6964. _3:
  6965. ;
  6966. t -= uintptr(size)
  6967. }
  6968. goto _1
  6969. _1:
  6970. ;
  6971. ai += uintptr(size)
  6972. }
  6973. }
  6974. const m_AT_BASE = 7
  6975. const m_AT_BASE_PLATFORM = 24
  6976. const m_AT_CLKTCK = 17
  6977. const m_AT_DCACHEBSIZE = 19
  6978. const m_AT_EGID = 14
  6979. const m_AT_ENTRY = 9
  6980. const m_AT_EUID = 12
  6981. const m_AT_EXECFD = 2
  6982. const m_AT_EXECFN = 31
  6983. const m_AT_FLAGS = 8
  6984. const m_AT_FPUCW = 18
  6985. const m_AT_GID = 13
  6986. const m_AT_HWCAP = 16
  6987. const m_AT_HWCAP2 = 26
  6988. const m_AT_ICACHEBSIZE = 20
  6989. const m_AT_IGNORE = 1
  6990. const m_AT_IGNOREPPC = 22
  6991. const m_AT_L1D_CACHEGEOMETRY = 43
  6992. const m_AT_L1D_CACHESHAPE = 35
  6993. const m_AT_L1D_CACHESIZE = 42
  6994. const m_AT_L1I_CACHEGEOMETRY = 41
  6995. const m_AT_L1I_CACHESHAPE = 34
  6996. const m_AT_L1I_CACHESIZE = 40
  6997. const m_AT_L2_CACHEGEOMETRY = 45
  6998. const m_AT_L2_CACHESHAPE = 36
  6999. const m_AT_L2_CACHESIZE = 44
  7000. const m_AT_L3_CACHEGEOMETRY = 47
  7001. const m_AT_L3_CACHESHAPE = 37
  7002. const m_AT_L3_CACHESIZE = 46
  7003. const m_AT_MINSIGSTKSZ = 51
  7004. const m_AT_NOTELF = 10
  7005. const m_AT_NULL = 0
  7006. const m_AT_PAGESZ = 6
  7007. const m_AT_PHDR = 3
  7008. const m_AT_PHENT = 4
  7009. const m_AT_PHNUM = 5
  7010. const m_AT_PLATFORM = 15
  7011. const m_AT_RANDOM = 25
  7012. const m_AT_SECURE = 23
  7013. const m_AT_SYSINFO = 32
  7014. const m_AT_SYSINFO_EHDR = 33
  7015. const m_AT_UCACHEBSIZE = 21
  7016. const m_AT_UID = 11
  7017. const m_AUX_FUNC = 2
  7018. const m_AUX_OBJECT = 1
  7019. const m_BIND_WEAK = 2
  7020. const m_DF_1_CONFALT = 0x00002000
  7021. const m_DF_1_DIRECT = 0x00000100
  7022. const m_DF_1_DISPRELDNE = 0x00008000
  7023. const m_DF_1_DISPRELPND = 0x00010000
  7024. const m_DF_1_EDITED = 0x00200000
  7025. const m_DF_1_ENDFILTEE = 0x00004000
  7026. const m_DF_1_GLOBAL = 0x00000002
  7027. const m_DF_1_GLOBAUDIT = 0x01000000
  7028. const m_DF_1_GROUP = 0x00000004
  7029. const m_DF_1_IGNMULDEF = 0x00040000
  7030. const m_DF_1_INITFIRST = 0x00000020
  7031. const m_DF_1_INTERPOSE = 0x00000400
  7032. const m_DF_1_LOADFLTR = 0x00000010
  7033. const m_DF_1_NODEFLIB = 0x00000800
  7034. const m_DF_1_NODELETE = 0x00000008
  7035. const m_DF_1_NODIRECT = 0x00020000
  7036. const m_DF_1_NODUMP = 0x00001000
  7037. const m_DF_1_NOHDR = 0x00100000
  7038. const m_DF_1_NOKSYMS = 0x00080000
  7039. const m_DF_1_NOOPEN = 0x00000040
  7040. const m_DF_1_NORELOC = 0x00400000
  7041. const m_DF_1_NOW = 0x00000001
  7042. const m_DF_1_ORIGIN = 0x00000080
  7043. const m_DF_1_PIE = 0x08000000
  7044. const m_DF_1_SINGLETON = 0x02000000
  7045. const m_DF_1_STUB = 0x04000000
  7046. const m_DF_1_SYMINTPOSE = 0x00800000
  7047. const m_DF_1_TRANS = 0x00000200
  7048. const m_DF_BIND_NOW = 0x00000008
  7049. const m_DF_ORIGIN = 0x00000001
  7050. const m_DF_P1_GROUPPERM = 0x00000002
  7051. const m_DF_P1_LAZYLOAD = 0x00000001
  7052. const m_DF_STATIC_TLS = 0x00000010
  7053. const m_DF_SYMBOLIC = 0x00000002
  7054. const m_DF_TEXTREL = 0x00000004
  7055. const m_DTF_1_CONFEXP = 0x00000002
  7056. const m_DTF_1_PARINIT = 0x00000001
  7057. const m_DT_ADDRNUM = 11
  7058. const m_DT_ADDRRNGHI = 0x6ffffeff
  7059. const m_DT_ADDRRNGLO = 0x6ffffe00
  7060. const m_DT_ALPHA_NUM = 1
  7061. const m_DT_AUDIT = 0x6ffffefc
  7062. const m_DT_AUXILIARY = 0x7ffffffd
  7063. const m_DT_BIND_NOW = 24
  7064. const m_DT_CHECKSUM = 0x6ffffdf8
  7065. const m_DT_CONFIG = 0x6ffffefa
  7066. const m_DT_DEBUG = 21
  7067. const m_DT_DEPAUDIT = 0x6ffffefb
  7068. const m_DT_ENCODING = 32
  7069. const m_DT_EXTRANUM = 3
  7070. const m_DT_FEATURE_1 = 0x6ffffdfc
  7071. const m_DT_FILTER = 0x7fffffff
  7072. const m_DT_FINI = 13
  7073. const m_DT_FINI_ARRAY = 26
  7074. const m_DT_FINI_ARRAYSZ = 28
  7075. const m_DT_FLAGS = 30
  7076. const m_DT_FLAGS_1 = 0x6ffffffb
  7077. const m_DT_GNU_CONFLICT = 0x6ffffef8
  7078. const m_DT_GNU_CONFLICTSZ = 0x6ffffdf6
  7079. const m_DT_GNU_HASH = 0x6ffffef5
  7080. const m_DT_GNU_LIBLIST = 0x6ffffef9
  7081. const m_DT_GNU_LIBLISTSZ = 0x6ffffdf7
  7082. const m_DT_GNU_PRELINKED = 0x6ffffdf5
  7083. const m_DT_HASH = 4
  7084. const m_DT_HIOS = 0x6ffff000
  7085. const m_DT_HIPROC = 0x7fffffff
  7086. const m_DT_IA_64_NUM = 1
  7087. const m_DT_INIT = 12
  7088. const m_DT_INIT_ARRAY = 25
  7089. const m_DT_INIT_ARRAYSZ = 27
  7090. const m_DT_JMPREL = 23
  7091. const m_DT_LOOS = 0x6000000d
  7092. const m_DT_LOPROC = 0x70000000
  7093. const m_DT_MIPS_AUX_DYNAMIC = 0x70000031
  7094. const m_DT_MIPS_BASE_ADDRESS = 0x70000006
  7095. const m_DT_MIPS_COMPACT_SIZE = 0x7000002f
  7096. const m_DT_MIPS_CONFLICT = 0x70000008
  7097. const m_DT_MIPS_CONFLICTNO = 0x7000000b
  7098. const m_DT_MIPS_CXX_FLAGS = 0x70000022
  7099. const m_DT_MIPS_DELTA_CLASS = 0x70000017
  7100. const m_DT_MIPS_DELTA_CLASSSYM = 0x70000020
  7101. const m_DT_MIPS_DELTA_CLASSSYM_NO = 0x70000021
  7102. const m_DT_MIPS_DELTA_CLASS_NO = 0x70000018
  7103. const m_DT_MIPS_DELTA_INSTANCE = 0x70000019
  7104. const m_DT_MIPS_DELTA_INSTANCE_NO = 0x7000001a
  7105. const m_DT_MIPS_DELTA_RELOC = 0x7000001b
  7106. const m_DT_MIPS_DELTA_RELOC_NO = 0x7000001c
  7107. const m_DT_MIPS_DELTA_SYM = 0x7000001d
  7108. const m_DT_MIPS_DELTA_SYM_NO = 0x7000001e
  7109. const m_DT_MIPS_DYNSTR_ALIGN = 0x7000002b
  7110. const m_DT_MIPS_FLAGS = 0x70000005
  7111. const m_DT_MIPS_GOTSYM = 0x70000013
  7112. const m_DT_MIPS_GP_VALUE = 0x70000030
  7113. const m_DT_MIPS_HIDDEN_GOTIDX = 0x70000027
  7114. const m_DT_MIPS_HIPAGENO = 0x70000014
  7115. const m_DT_MIPS_ICHECKSUM = 0x70000003
  7116. const m_DT_MIPS_INTERFACE = 0x7000002a
  7117. const m_DT_MIPS_INTERFACE_SIZE = 0x7000002c
  7118. const m_DT_MIPS_IVERSION = 0x70000004
  7119. const m_DT_MIPS_LIBLIST = 0x70000009
  7120. const m_DT_MIPS_LIBLISTNO = 0x70000010
  7121. const m_DT_MIPS_LOCALPAGE_GOTIDX = 0x70000025
  7122. const m_DT_MIPS_LOCAL_GOTIDX = 0x70000026
  7123. const m_DT_MIPS_LOCAL_GOTNO = 0x7000000a
  7124. const m_DT_MIPS_MSYM = 0x70000007
  7125. const m_DT_MIPS_NUM = 0x36
  7126. const m_DT_MIPS_OPTIONS = 0x70000029
  7127. const m_DT_MIPS_PERF_SUFFIX = 0x7000002e
  7128. const m_DT_MIPS_PIXIE_INIT = 0x70000023
  7129. const m_DT_MIPS_PLTGOT = 0x70000032
  7130. const m_DT_MIPS_PROTECTED_GOTIDX = 0x70000028
  7131. const m_DT_MIPS_RLD_MAP = 0x70000016
  7132. const m_DT_MIPS_RLD_MAP_REL = 0x70000035
  7133. const m_DT_MIPS_RLD_TEXT_RESOLVE_ADDR = 0x7000002d
  7134. const m_DT_MIPS_RLD_VERSION = 0x70000001
  7135. const m_DT_MIPS_RWPLT = 0x70000034
  7136. const m_DT_MIPS_SYMBOL_LIB = 0x70000024
  7137. const m_DT_MIPS_SYMTABNO = 0x70000011
  7138. const m_DT_MIPS_TIME_STAMP = 0x70000002
  7139. const m_DT_MIPS_UNREFEXTNO = 0x70000012
  7140. const m_DT_MOVEENT = 0x6ffffdfa
  7141. const m_DT_MOVESZ = 0x6ffffdfb
  7142. const m_DT_MOVETAB = 0x6ffffefe
  7143. const m_DT_NEEDED = 1
  7144. const m_DT_NIOS2_GP = 0x70000002
  7145. const m_DT_NULL = 0
  7146. const m_DT_NUM = 38
  7147. const m_DT_PLTGOT = 3
  7148. const m_DT_PLTPAD = 0x6ffffefd
  7149. const m_DT_PLTPADSZ = 0x6ffffdf9
  7150. const m_DT_PLTREL = 20
  7151. const m_DT_PLTRELSZ = 2
  7152. const m_DT_POSFLAG_1 = 0x6ffffdfd
  7153. const m_DT_PPC64_NUM = 4
  7154. const m_DT_PPC_NUM = 2
  7155. const m_DT_PREINIT_ARRAY = 32
  7156. const m_DT_PREINIT_ARRAYSZ = 33
  7157. const m_DT_PROCNUM = "DT_MIPS_NUM"
  7158. const m_DT_REL = 17
  7159. const m_DT_RELA = 7
  7160. const m_DT_RELACOUNT = 0x6ffffff9
  7161. const m_DT_RELAENT = 9
  7162. const m_DT_RELASZ = 8
  7163. const m_DT_RELCOUNT = 0x6ffffffa
  7164. const m_DT_RELENT = 19
  7165. const m_DT_RELR = 36
  7166. const m_DT_RELRENT = 37
  7167. const m_DT_RELRSZ = 35
  7168. const m_DT_RELSZ = 18
  7169. const m_DT_RPATH = 15
  7170. const m_DT_RUNPATH = 29
  7171. const m_DT_SONAME = 14
  7172. const m_DT_SPARC_NUM = 2
  7173. const m_DT_SPARC_REGISTER = 0x70000001
  7174. const m_DT_STRSZ = 10
  7175. const m_DT_STRTAB = 5
  7176. const m_DT_SYMBOLIC = 16
  7177. const m_DT_SYMENT = 11
  7178. const m_DT_SYMINENT = 0x6ffffdff
  7179. const m_DT_SYMINFO = 0x6ffffeff
  7180. const m_DT_SYMINSZ = 0x6ffffdfe
  7181. const m_DT_SYMTAB = 6
  7182. const m_DT_SYMTAB_SHNDX = 34
  7183. const m_DT_TEXTREL = 22
  7184. const m_DT_TLSDESC_GOT = 0x6ffffef7
  7185. const m_DT_TLSDESC_PLT = 0x6ffffef6
  7186. const m_DT_VALNUM = 12
  7187. const m_DT_VALRNGHI = 0x6ffffdff
  7188. const m_DT_VALRNGLO = 0x6ffffd00
  7189. const m_DT_VERDEF = 0x6ffffffc
  7190. const m_DT_VERDEFNUM = 0x6ffffffd
  7191. const m_DT_VERNEED = 0x6ffffffe
  7192. const m_DT_VERNEEDNUM = 0x6fffffff
  7193. const m_DT_VERSIONTAGNUM = 16
  7194. const m_DT_VERSYM = 0x6ffffff0
  7195. const m_EFA_PARISC_1_0 = 0x020b
  7196. const m_EFA_PARISC_1_1 = 0x0210
  7197. const m_EFA_PARISC_2_0 = 0x0214
  7198. const m_EF_ALPHA_32BIT = 1
  7199. const m_EF_ALPHA_CANRELAX = 2
  7200. const m_EF_ARM_ABI_FLOAT_HARD = 0x400
  7201. const m_EF_ARM_ABI_FLOAT_SOFT = 0x200
  7202. const m_EF_ARM_ALIGN8 = 0x40
  7203. const m_EF_ARM_APCS_26 = 0x08
  7204. const m_EF_ARM_APCS_FLOAT = 0x10
  7205. const m_EF_ARM_BE8 = 0x00800000
  7206. const m_EF_ARM_DYNSYMSUSESEGIDX = 0x08
  7207. const m_EF_ARM_EABIMASK = 0xFF000000
  7208. const m_EF_ARM_EABI_UNKNOWN = 0x00000000
  7209. const m_EF_ARM_EABI_VER1 = 0x01000000
  7210. const m_EF_ARM_EABI_VER2 = 0x02000000
  7211. const m_EF_ARM_EABI_VER3 = 0x03000000
  7212. const m_EF_ARM_EABI_VER4 = 0x04000000
  7213. const m_EF_ARM_EABI_VER5 = 0x05000000
  7214. const m_EF_ARM_HASENTRY = 0x02
  7215. const m_EF_ARM_INTERWORK = 0x04
  7216. const m_EF_ARM_LE8 = 0x00400000
  7217. const m_EF_ARM_MAPSYMSFIRST = 0x10
  7218. const m_EF_ARM_MAVERICK_FLOAT = 0x800
  7219. const m_EF_ARM_NEW_ABI = 0x80
  7220. const m_EF_ARM_OLD_ABI = 0x100
  7221. const m_EF_ARM_PIC = 0x20
  7222. const m_EF_ARM_RELEXEC = 0x01
  7223. const m_EF_ARM_SOFT_FLOAT = 0x200
  7224. const m_EF_ARM_SYMSARESORTED = 0x04
  7225. const m_EF_ARM_VFP_FLOAT = 0x400
  7226. const m_EF_CPU32 = 0x00810000
  7227. const m_EF_IA_64_ABI64 = 0x00000010
  7228. const m_EF_IA_64_ARCH = 0xff000000
  7229. const m_EF_IA_64_MASKOS = 0x0000000f
  7230. const m_EF_LARCH_ABI_DOUBLE_FLOAT = 0x03
  7231. const m_EF_LARCH_ABI_MODIFIER_MASK = 0x07
  7232. const m_EF_LARCH_ABI_SINGLE_FLOAT = 0x02
  7233. const m_EF_LARCH_ABI_SOFT_FLOAT = 0x01
  7234. const m_EF_LARCH_OBJABI_V1 = 0x40
  7235. const m_EF_MIPS_64BIT_WHIRL = 16
  7236. const m_EF_MIPS_ABI2 = 32
  7237. const m_EF_MIPS_ABI_ON32 = 64
  7238. const m_EF_MIPS_ARCH = 0xf0000000
  7239. const m_EF_MIPS_ARCH_1 = 0x00000000
  7240. const m_EF_MIPS_ARCH_2 = 0x10000000
  7241. const m_EF_MIPS_ARCH_3 = 0x20000000
  7242. const m_EF_MIPS_ARCH_32 = 0x50000000
  7243. const m_EF_MIPS_ARCH_32R2 = 0x70000000
  7244. const m_EF_MIPS_ARCH_4 = 0x30000000
  7245. const m_EF_MIPS_ARCH_5 = 0x40000000
  7246. const m_EF_MIPS_ARCH_64 = 0x60000000
  7247. const m_EF_MIPS_ARCH_64R2 = 0x80000000
  7248. const m_EF_MIPS_CPIC = 4
  7249. const m_EF_MIPS_FP64 = 512
  7250. const m_EF_MIPS_NAN2008 = 1024
  7251. const m_EF_MIPS_NOREORDER = 1
  7252. const m_EF_MIPS_PIC = 2
  7253. const m_EF_MIPS_XGOT = 8
  7254. const m_EF_PARISC_ARCH = 0x0000ffff
  7255. const m_EF_PARISC_EXT = 0x00020000
  7256. const m_EF_PARISC_LAZYSWAP = 0x00400000
  7257. const m_EF_PARISC_LSB = 0x00040000
  7258. const m_EF_PARISC_NO_KABP = 0x00100000
  7259. const m_EF_PARISC_TRAPNIL = 0x00010000
  7260. const m_EF_PARISC_WIDE = 0x00080000
  7261. const m_EF_PPC64_ABI = 3
  7262. const m_EF_PPC_EMB = 0x80000000
  7263. const m_EF_PPC_RELOCATABLE = 0x00010000
  7264. const m_EF_PPC_RELOCATABLE_LIB = 0x00008000
  7265. const m_EF_SH1 = 0x1
  7266. const m_EF_SH2 = 0x2
  7267. const m_EF_SH2A = 0xd
  7268. const m_EF_SH2A_NOFPU = 0x13
  7269. const m_EF_SH2A_SH3E = 0x18
  7270. const m_EF_SH2A_SH3_NOFPU = 0x16
  7271. const m_EF_SH2A_SH4 = 0x17
  7272. const m_EF_SH2A_SH4_NOFPU = 0x15
  7273. const m_EF_SH2E = 0xb
  7274. const m_EF_SH3 = 0x3
  7275. const m_EF_SH3E = 0x8
  7276. const m_EF_SH3_DSP = 0x5
  7277. const m_EF_SH3_NOMMU = 0x14
  7278. const m_EF_SH4 = 0x9
  7279. const m_EF_SH4A = 0xc
  7280. const m_EF_SH4AL_DSP = 0x6
  7281. const m_EF_SH4A_NOFPU = 0x11
  7282. const m_EF_SH4_NOFPU = 0x10
  7283. const m_EF_SH4_NOMMU_NOFPU = 0x12
  7284. const m_EF_SH_DSP = 0x4
  7285. const m_EF_SH_MACH_MASK = 0x1f
  7286. const m_EF_SH_UNKNOWN = 0x0
  7287. const m_EF_SPARCV9_MM = 3
  7288. const m_EF_SPARCV9_PSO = 1
  7289. const m_EF_SPARCV9_RMO = 2
  7290. const m_EF_SPARCV9_TSO = 0
  7291. const m_EF_SPARC_32PLUS = 0x000100
  7292. const m_EF_SPARC_EXT_MASK = 0xFFFF00
  7293. const m_EF_SPARC_HAL_R1 = 0x000400
  7294. const m_EF_SPARC_LEDATA = 0x800000
  7295. const m_EF_SPARC_SUN_US1 = 0x000200
  7296. const m_EF_SPARC_SUN_US3 = 0x000800
  7297. const m_EI_ABIVERSION = 8
  7298. const m_EI_CLASS = 4
  7299. const m_EI_DATA = 5
  7300. const m_EI_MAG0 = 0
  7301. const m_EI_MAG1 = 1
  7302. const m_EI_MAG2 = 2
  7303. const m_EI_MAG3 = 3
  7304. const m_EI_NIDENT = 16
  7305. const m_EI_OSABI = 7
  7306. const m_EI_PAD = 9
  7307. const m_EI_VERSION = 6
  7308. const m_ELFCLASS32 = 1
  7309. const m_ELFCLASS64 = 2
  7310. const m_ELFCLASSNONE = 0
  7311. const m_ELFCLASSNUM = 3
  7312. const m_ELFCOMPRESS_HIOS = 0x6fffffff
  7313. const m_ELFCOMPRESS_HIPROC = 0x7fffffff
  7314. const m_ELFCOMPRESS_LOOS = 0x60000000
  7315. const m_ELFCOMPRESS_LOPROC = 0x70000000
  7316. const m_ELFCOMPRESS_ZLIB = 1
  7317. const m_ELFCOMPRESS_ZSTD = 2
  7318. const m_ELFDATA2LSB = 1
  7319. const m_ELFDATA2MSB = 2
  7320. const m_ELFDATANONE = 0
  7321. const m_ELFDATANUM = 3
  7322. const m_ELFMAG = "\\177ELF"
  7323. const m_ELFMAG0 = 127
  7324. const m_ELFMAG1 = 69
  7325. const m_ELFMAG2 = 76
  7326. const m_ELFMAG3 = 70
  7327. const m_ELFOSABI_AIX = 7
  7328. const m_ELFOSABI_ARM = 97
  7329. const m_ELFOSABI_FREEBSD = 9
  7330. const m_ELFOSABI_GNU = 3
  7331. const m_ELFOSABI_HPUX = 1
  7332. const m_ELFOSABI_IRIX = 8
  7333. const m_ELFOSABI_LINUX = 3
  7334. const m_ELFOSABI_MODESTO = 11
  7335. const m_ELFOSABI_NETBSD = 2
  7336. const m_ELFOSABI_NONE = 0
  7337. const m_ELFOSABI_OPENBSD = 12
  7338. const m_ELFOSABI_SOLARIS = 6
  7339. const m_ELFOSABI_STANDALONE = 255
  7340. const m_ELFOSABI_SYSV = 0
  7341. const m_ELFOSABI_TRU64 = 10
  7342. const m_ELF_NOTE_ABI = "NT_GNU_ABI_TAG"
  7343. const m_ELF_NOTE_GNU = "GNU"
  7344. const m_ELF_NOTE_OS_FREEBSD = 3
  7345. const m_ELF_NOTE_OS_GNU = 1
  7346. const m_ELF_NOTE_OS_LINUX = 0
  7347. const m_ELF_NOTE_OS_SOLARIS2 = 2
  7348. const m_ELF_NOTE_PAGESIZE_HINT = 1
  7349. const m_ELF_NOTE_SOLARIS = "SUNW Solaris"
  7350. const m_ELF_ST_BIND = "ELF32_ST_BIND"
  7351. const m_ELF_ST_TYPE = "ELF32_ST_TYPE"
  7352. const m_ELF_TARG_CLASS = "ELFCLASS32"
  7353. const m_ELF_TARG_DATA = "ELFDATA2LSB"
  7354. const m_ELF_TARG_MACH = "EM_ARM"
  7355. const m_ELF_TARG_VER = "EV_CURRENT"
  7356. const m_EM_386 = 3
  7357. const m_EM_56800EX = 200
  7358. const m_EM_68HC05 = 72
  7359. const m_EM_68HC08 = 71
  7360. const m_EM_68HC11 = 70
  7361. const m_EM_68HC12 = 53
  7362. const m_EM_68HC16 = 69
  7363. const m_EM_68K = 4
  7364. const m_EM_78KOR = 199
  7365. const m_EM_8051 = 165
  7366. const m_EM_860 = 7
  7367. const m_EM_88K = 5
  7368. const m_EM_960 = 19
  7369. const m_EM_AARCH64 = 183
  7370. const m_EM_ALPHA = 0x9026
  7371. const m_EM_ALTERA_NIOS2 = 113
  7372. const m_EM_AMDGPU = 224
  7373. const m_EM_ARC = 45
  7374. const m_EM_ARCA = 109
  7375. const m_EM_ARC_A5 = 93
  7376. const m_EM_ARC_COMPACT = 93
  7377. const m_EM_ARC_COMPACT2 = 195
  7378. const m_EM_ARM = 40
  7379. const m_EM_AVR = 83
  7380. const m_EM_AVR32 = 185
  7381. const m_EM_BA1 = 201
  7382. const m_EM_BA2 = 202
  7383. const m_EM_BLACKFIN = 106
  7384. const m_EM_BPF = 247
  7385. const m_EM_C166 = 116
  7386. const m_EM_CDP = 215
  7387. const m_EM_CE = 119
  7388. const m_EM_CLOUDSHIELD = 192
  7389. const m_EM_COGE = 216
  7390. const m_EM_COLDFIRE = 52
  7391. const m_EM_COOL = 217
  7392. const m_EM_COREA_1ST = 193
  7393. const m_EM_COREA_2ND = 194
  7394. const m_EM_CR = 103
  7395. const m_EM_CR16 = 177
  7396. const m_EM_CRAYNV2 = 172
  7397. const m_EM_CRIS = 76
  7398. const m_EM_CRX = 114
  7399. const m_EM_CSKY = 252
  7400. const m_EM_CSR_KALIMBA = 219
  7401. const m_EM_CUDA = 190
  7402. const m_EM_CYPRESS_M8C = 161
  7403. const m_EM_D10V = 85
  7404. const m_EM_D30V = 86
  7405. const m_EM_DSP24 = 136
  7406. const m_EM_DSPIC30F = 118
  7407. const m_EM_DXP = 112
  7408. const m_EM_ECOG16 = 176
  7409. const m_EM_ECOG1X = 168
  7410. const m_EM_ECOG2 = 134
  7411. const m_EM_EMX16 = 212
  7412. const m_EM_EMX8 = 213
  7413. const m_EM_ETPU = 178
  7414. const m_EM_EXCESS = 111
  7415. const m_EM_F2MC16 = 104
  7416. const m_EM_FAKE_ALPHA = 41
  7417. const m_EM_FIREPATH = 78
  7418. const m_EM_FR20 = 37
  7419. const m_EM_FR30 = 84
  7420. const m_EM_FT32 = 222
  7421. const m_EM_FX66 = 66
  7422. const m_EM_H8S = 48
  7423. const m_EM_H8_300 = 46
  7424. const m_EM_H8_300H = 47
  7425. const m_EM_H8_500 = 49
  7426. const m_EM_HUANY = 81
  7427. const m_EM_IA_64 = 50
  7428. const m_EM_IP2K = 101
  7429. const m_EM_JAVELIN = 77
  7430. const m_EM_K10M = 181
  7431. const m_EM_KM32 = 210
  7432. const m_EM_KMX32 = 211
  7433. const m_EM_KVARC = 214
  7434. const m_EM_L10M = 180
  7435. const m_EM_LATTICEMICO32 = 138
  7436. const m_EM_LOONGARCH = 258
  7437. const m_EM_M16C = 117
  7438. const m_EM_M32 = 1
  7439. const m_EM_M32C = 120
  7440. const m_EM_M32R = 88
  7441. const m_EM_MANIK = 171
  7442. const m_EM_MAX = 102
  7443. const m_EM_MAXQ30 = 169
  7444. const m_EM_MCHP_PIC = 204
  7445. const m_EM_MCST_ELBRUS = 175
  7446. const m_EM_ME16 = 59
  7447. const m_EM_METAG = 174
  7448. const m_EM_MICROBLAZE = 189
  7449. const m_EM_MIPS = 8
  7450. const m_EM_MIPS_RS3_LE = 10
  7451. const m_EM_MIPS_X = 51
  7452. const m_EM_MMA = 54
  7453. const m_EM_MMDSP_PLUS = 160
  7454. const m_EM_MMIX = 80
  7455. const m_EM_MN10200 = 90
  7456. const m_EM_MN10300 = 89
  7457. const m_EM_MOXIE = 223
  7458. const m_EM_MSP430 = 105
  7459. const m_EM_NCPU = 56
  7460. const m_EM_NDR1 = 57
  7461. const m_EM_NDS32 = 167
  7462. const m_EM_NONE = 0
  7463. const m_EM_NORC = 218
  7464. const m_EM_NS32K = 97
  7465. const m_EM_NUM = 259
  7466. const m_EM_OPEN8 = 196
  7467. const m_EM_OPENRISC = 92
  7468. const m_EM_OR1K = 92
  7469. const m_EM_PARISC = 15
  7470. const m_EM_PCP = 55
  7471. const m_EM_PDSP = 63
  7472. const m_EM_PJ = 91
  7473. const m_EM_PPC = 20
  7474. const m_EM_PPC64 = 21
  7475. const m_EM_PRISM = 82
  7476. const m_EM_QDSP6 = 164
  7477. const m_EM_R32C = 162
  7478. const m_EM_RCE = 39
  7479. const m_EM_RH32 = 38
  7480. const m_EM_RISCV = 243
  7481. const m_EM_RL78 = 197
  7482. const m_EM_RS08 = 132
  7483. const m_EM_RX = 173
  7484. const m_EM_S370 = 9
  7485. const m_EM_S390 = 22
  7486. const m_EM_SCORE7 = 135
  7487. const m_EM_SEP = 108
  7488. const m_EM_SE_C17 = 139
  7489. const m_EM_SE_C33 = 107
  7490. const m_EM_SH = 42
  7491. const m_EM_SHARC = 133
  7492. const m_EM_SLE9X = 179
  7493. const m_EM_SNP1K = 99
  7494. const m_EM_SPARC = 2
  7495. const m_EM_SPARC32PLUS = 18
  7496. const m_EM_SPARCV9 = 43
  7497. const m_EM_ST100 = 60
  7498. const m_EM_ST19 = 74
  7499. const m_EM_ST200 = 100
  7500. const m_EM_ST7 = 68
  7501. const m_EM_ST9PLUS = 67
  7502. const m_EM_STARCORE = 58
  7503. const m_EM_STM8 = 186
  7504. const m_EM_STXP7X = 166
  7505. const m_EM_SVX = 73
  7506. const m_EM_TILE64 = 187
  7507. const m_EM_TILEGX = 191
  7508. const m_EM_TILEPRO = 188
  7509. const m_EM_TINYJ = 61
  7510. const m_EM_TI_ARP32 = 143
  7511. const m_EM_TI_C2000 = 141
  7512. const m_EM_TI_C5500 = 142
  7513. const m_EM_TI_C6000 = 140
  7514. const m_EM_TI_PRU = 144
  7515. const m_EM_TMM_GPP = 96
  7516. const m_EM_TPC = 98
  7517. const m_EM_TRICORE = 44
  7518. const m_EM_TRIMEDIA = 163
  7519. const m_EM_TSK3000 = 131
  7520. const m_EM_UNICORE = 110
  7521. const m_EM_V800 = 36
  7522. const m_EM_V850 = 87
  7523. const m_EM_VAX = 75
  7524. const m_EM_VIDEOCORE = 95
  7525. const m_EM_VIDEOCORE3 = 137
  7526. const m_EM_VIDEOCORE5 = 198
  7527. const m_EM_VISIUM = 221
  7528. const m_EM_VPP500 = 17
  7529. const m_EM_X86_64 = 62
  7530. const m_EM_XCORE = 203
  7531. const m_EM_XGATE = 115
  7532. const m_EM_XIMO16 = 170
  7533. const m_EM_XTENSA = 94
  7534. const m_EM_Z80 = 220
  7535. const m_EM_ZSP = 79
  7536. const m_ET_CORE = 4
  7537. const m_ET_DYN = 3
  7538. const m_ET_EXEC = 2
  7539. const m_ET_HIOS = 0xfeff
  7540. const m_ET_HIPROC = 0xffff
  7541. const m_ET_LOOS = 0xfe00
  7542. const m_ET_LOPROC = 0xff00
  7543. const m_ET_NONE = 0
  7544. const m_ET_NUM = 5
  7545. const m_ET_REL = 1
  7546. const m_EV_CURRENT = 1
  7547. const m_EV_NONE = 0
  7548. const m_EV_NUM = 2
  7549. const m_E_MIPS_ARCH_1 = 0x00000000
  7550. const m_E_MIPS_ARCH_2 = 0x10000000
  7551. const m_E_MIPS_ARCH_3 = 0x20000000
  7552. const m_E_MIPS_ARCH_32 = 0x50000000
  7553. const m_E_MIPS_ARCH_4 = 0x30000000
  7554. const m_E_MIPS_ARCH_5 = 0x40000000
  7555. const m_E_MIPS_ARCH_64 = 0x60000000
  7556. const m_Elf_Ehdr = "Elf32_Ehdr"
  7557. const m_Elf_Off = "Elf32_Off"
  7558. const m_Elf_Shdr = "Elf32_Shdr"
  7559. const m_Elf_Sword = "Elf32_Sword"
  7560. const m_Elf_Sym = "Elf32_Sym"
  7561. const m_Elf_Word = "Elf32_Word"
  7562. const m_GRP_COMDAT = 0x1
  7563. const m_LITUSE_ALPHA_ADDR = 0
  7564. const m_LITUSE_ALPHA_BASE = 1
  7565. const m_LITUSE_ALPHA_BYTOFF = 2
  7566. const m_LITUSE_ALPHA_JSR = 3
  7567. const m_LITUSE_ALPHA_TLS_GD = 4
  7568. const m_LITUSE_ALPHA_TLS_LDM = 5
  7569. const m_LL_NONE = 0
  7570. const m_MAP_ANON1 = 0x20
  7571. const m_MAP_PRIVATE1 = 0x02
  7572. const m_MIPS_AFL_ASE_DSP = 0x00000001
  7573. const m_MIPS_AFL_ASE_DSPR2 = 0x00000002
  7574. const m_MIPS_AFL_ASE_EVA = 0x00000004
  7575. const m_MIPS_AFL_ASE_MASK = 0x00001fff
  7576. const m_MIPS_AFL_ASE_MCU = 0x00000008
  7577. const m_MIPS_AFL_ASE_MDMX = 0x00000010
  7578. const m_MIPS_AFL_ASE_MICROMIPS = 0x00000800
  7579. const m_MIPS_AFL_ASE_MIPS16 = 0x00000400
  7580. const m_MIPS_AFL_ASE_MIPS3D = 0x00000020
  7581. const m_MIPS_AFL_ASE_MSA = 0x00000200
  7582. const m_MIPS_AFL_ASE_MT = 0x00000040
  7583. const m_MIPS_AFL_ASE_SMARTMIPS = 0x00000080
  7584. const m_MIPS_AFL_ASE_VIRT = 0x00000100
  7585. const m_MIPS_AFL_ASE_XPA = 0x00001000
  7586. const m_MIPS_AFL_EXT_10000 = 11
  7587. const m_MIPS_AFL_EXT_3900 = 10
  7588. const m_MIPS_AFL_EXT_4010 = 8
  7589. const m_MIPS_AFL_EXT_4100 = 9
  7590. const m_MIPS_AFL_EXT_4111 = 13
  7591. const m_MIPS_AFL_EXT_4120 = 14
  7592. const m_MIPS_AFL_EXT_4650 = 7
  7593. const m_MIPS_AFL_EXT_5400 = 15
  7594. const m_MIPS_AFL_EXT_5500 = 16
  7595. const m_MIPS_AFL_EXT_5900 = 6
  7596. const m_MIPS_AFL_EXT_LOONGSON_2E = 17
  7597. const m_MIPS_AFL_EXT_LOONGSON_2F = 18
  7598. const m_MIPS_AFL_EXT_LOONGSON_3A = 4
  7599. const m_MIPS_AFL_EXT_OCTEON = 5
  7600. const m_MIPS_AFL_EXT_OCTEON2 = 2
  7601. const m_MIPS_AFL_EXT_OCTEONP = 3
  7602. const m_MIPS_AFL_EXT_SB1 = 12
  7603. const m_MIPS_AFL_EXT_XLR = 1
  7604. const m_MIPS_AFL_FLAGS1_ODDSPREG = 1
  7605. const m_MIPS_AFL_REG_128 = 0x03
  7606. const m_MIPS_AFL_REG_32 = 0x01
  7607. const m_MIPS_AFL_REG_64 = 0x02
  7608. const m_MIPS_AFL_REG_NONE = 0x00
  7609. const m_NT_386_IOPERM = 0x201
  7610. const m_NT_386_TLS = 0x200
  7611. const m_NT_ARC_V2 = 0x600
  7612. const m_NT_ARM_HW_BREAK = 0x402
  7613. const m_NT_ARM_HW_WATCH = 0x403
  7614. const m_NT_ARM_PACA_KEYS = 0x407
  7615. const m_NT_ARM_PACG_KEYS = 0x408
  7616. const m_NT_ARM_PAC_ENABLED_KEYS = 0x40a
  7617. const m_NT_ARM_PAC_MASK = 0x406
  7618. const m_NT_ARM_SVE = 0x405
  7619. const m_NT_ARM_SYSTEM_CALL = 0x404
  7620. const m_NT_ARM_TAGGED_ADDR_CTRL = 0x409
  7621. const m_NT_ARM_TLS = 0x401
  7622. const m_NT_ARM_VFP = 0x400
  7623. const m_NT_ASRS = 8
  7624. const m_NT_AUXV = 6
  7625. const m_NT_FILE = 0x46494c45
  7626. const m_NT_FPREGSET = 2
  7627. const m_NT_GNU_ABI_TAG = 1
  7628. const m_NT_GNU_BUILD_ID = 3
  7629. const m_NT_GNU_GOLD_VERSION = 4
  7630. const m_NT_GNU_PROPERTY_TYPE_0 = 5
  7631. const m_NT_GWINDOWS = 7
  7632. const m_NT_LOONGARCH_CPUCFG = 0xa00
  7633. const m_NT_LOONGARCH_CSR = 0xa01
  7634. const m_NT_LOONGARCH_LASX = 0xa03
  7635. const m_NT_LOONGARCH_LBT = 0xa04
  7636. const m_NT_LOONGARCH_LSX = 0xa02
  7637. const m_NT_LWPSINFO = 17
  7638. const m_NT_LWPSTATUS = 16
  7639. const m_NT_METAG_CBUF = 0x500
  7640. const m_NT_METAG_RPIPE = 0x501
  7641. const m_NT_METAG_TLS = 0x502
  7642. const m_NT_MIPS_DSP = 0x800
  7643. const m_NT_MIPS_FP_MODE = 0x801
  7644. const m_NT_MIPS_MSA = 0x802
  7645. const m_NT_PLATFORM = 5
  7646. const m_NT_PPC_DSCR = 0x105
  7647. const m_NT_PPC_EBB = 0x106
  7648. const m_NT_PPC_PMU = 0x107
  7649. const m_NT_PPC_PPR = 0x104
  7650. const m_NT_PPC_SPE = 0x101
  7651. const m_NT_PPC_TAR = 0x103
  7652. const m_NT_PPC_TM_CDSCR = 0x10f
  7653. const m_NT_PPC_TM_CFPR = 0x109
  7654. const m_NT_PPC_TM_CGPR = 0x108
  7655. const m_NT_PPC_TM_CPPR = 0x10e
  7656. const m_NT_PPC_TM_CTAR = 0x10d
  7657. const m_NT_PPC_TM_CVMX = 0x10a
  7658. const m_NT_PPC_TM_CVSX = 0x10b
  7659. const m_NT_PPC_TM_SPR = 0x10c
  7660. const m_NT_PPC_VMX = 0x100
  7661. const m_NT_PPC_VSX = 0x102
  7662. const m_NT_PRCRED = 14
  7663. const m_NT_PRFPREG = 2
  7664. const m_NT_PRFPXREG = 20
  7665. const m_NT_PRPSINFO = 3
  7666. const m_NT_PRSTATUS = 1
  7667. const m_NT_PRXFPREG = 0x46e62b7f
  7668. const m_NT_PRXREG = 4
  7669. const m_NT_PSINFO = 13
  7670. const m_NT_PSTATUS = 10
  7671. const m_NT_RISCV_CSR = 0x900
  7672. const m_NT_RISCV_VECTOR = 0x901
  7673. const m_NT_S390_CTRS = 0x304
  7674. const m_NT_S390_GS_BC = 0x30c
  7675. const m_NT_S390_GS_CB = 0x30b
  7676. const m_NT_S390_HIGH_GPRS = 0x300
  7677. const m_NT_S390_LAST_BREAK = 0x306
  7678. const m_NT_S390_PREFIX = 0x305
  7679. const m_NT_S390_RI_CB = 0x30d
  7680. const m_NT_S390_SYSTEM_CALL = 0x307
  7681. const m_NT_S390_TDB = 0x308
  7682. const m_NT_S390_TIMER = 0x301
  7683. const m_NT_S390_TODCMP = 0x302
  7684. const m_NT_S390_TODPREG = 0x303
  7685. const m_NT_S390_VXRS_HIGH = 0x30a
  7686. const m_NT_S390_VXRS_LOW = 0x309
  7687. const m_NT_SIGINFO = 0x53494749
  7688. const m_NT_TASKSTRUCT = 4
  7689. const m_NT_UTSNAME = 15
  7690. const m_NT_VERSION = 1
  7691. const m_NT_VMCOREDD = 0x700
  7692. const m_NT_X86_XSTATE = 0x202
  7693. const m_N_ABS = 2
  7694. const m_N_BSS = 8
  7695. const m_N_COMM = 0x12
  7696. const m_N_DATA = 6
  7697. const m_N_EXT = 1
  7698. const m_N_FN = 30
  7699. const m_N_FORMAT = "%08x"
  7700. const m_N_INDR = 0x0a
  7701. const m_N_SETA = 0x14
  7702. const m_N_SETB = 0x1a
  7703. const m_N_SETD = 0x18
  7704. const m_N_SETT = 0x16
  7705. const m_N_SETV = 0x1c
  7706. const m_N_SIZE = 0x0c
  7707. const m_N_STAB = 0xe0
  7708. const m_N_TEXT = 4
  7709. const m_N_TYPE = 0x1e
  7710. const m_N_UNDF = 0
  7711. const m_N_WARN = 0x1e
  7712. const m_ODK_EXCEPTIONS = 2
  7713. const m_ODK_FILL = 5
  7714. const m_ODK_HWAND = 7
  7715. const m_ODK_HWOR = 8
  7716. const m_ODK_HWPATCH = 4
  7717. const m_ODK_NULL = 0
  7718. const m_ODK_PAD = 3
  7719. const m_ODK_REGINFO = 1
  7720. const m_ODK_TAGS = 6
  7721. const m_OEX_DISMISS = 0x80000
  7722. const m_OEX_FPDBUG = 0x40000
  7723. const m_OEX_FPU_DIV0 = 0x08
  7724. const m_OEX_FPU_INEX = 0x01
  7725. const m_OEX_FPU_INVAL = 0x10
  7726. const m_OEX_FPU_MAX = 0x1f00
  7727. const m_OEX_FPU_MIN = 0x1f
  7728. const m_OEX_FPU_OFLO = 0x04
  7729. const m_OEX_FPU_UFLO = 0x02
  7730. const m_OEX_PAGE0 = 0x10000
  7731. const m_OEX_PRECISEFP = "OEX_FPDBUG"
  7732. const m_OEX_SMM = 0x20000
  7733. const m_OHWA0_R4KEOP_CHECKED = 0x00000001
  7734. const m_OHWA1_R4KEOP_CLEAN = 0x00000002
  7735. const m_OHW_R4KEOP = 0x1
  7736. const m_OHW_R5KCVTL = 0x8
  7737. const m_OHW_R5KEOP = 0x4
  7738. const m_OHW_R8KPFETCH = 0x2
  7739. const m_OPAD_POSTFIX = 0x2
  7740. const m_OPAD_PREFIX = 0x1
  7741. const m_OPAD_SYMBOL = 0x4
  7742. const m_O_CREAT2 = 0100
  7743. const m_O_NONBLOCK2 = 04000
  7744. const m_O_RDONLY1 = 0
  7745. const m_O_TRUNC2 = 01000
  7746. const m_PF_ARM_ABS = 0x40000000
  7747. const m_PF_ARM_PI = 0x20000000
  7748. const m_PF_ARM_SB = 0x10000000
  7749. const m_PF_HP_CODE = 0x01000000
  7750. const m_PF_HP_FAR_SHARED = 0x00200000
  7751. const m_PF_HP_LAZYSWAP = 0x04000000
  7752. const m_PF_HP_MODIFY = 0x02000000
  7753. const m_PF_HP_NEAR_SHARED = 0x00400000
  7754. const m_PF_HP_PAGE_SIZE = 0x00100000
  7755. const m_PF_HP_SBP = 0x08000000
  7756. const m_PF_IA_64_NORECOV = 0x80000000
  7757. const m_PF_MASKOS = 0x0ff00000
  7758. const m_PF_MASKPROC = 0xf0000000
  7759. const m_PF_MIPS_LOCAL = 0x10000000
  7760. const m_PF_PARISC_SBP = 0x08000000
  7761. const m_PN_XNUM = 0xffff
  7762. const m_PPC64_OPT_LOCALENTRY = 4
  7763. const m_PPC64_OPT_MULTI_TOC = 2
  7764. const m_PPC64_OPT_TLS = 1
  7765. const m_PPC_OPT_TLS = 1
  7766. const m_PT_DYNAMIC = 2
  7767. const m_PT_GNU_EH_FRAME = 0x6474e550
  7768. const m_PT_GNU_PROPERTY = 0x6474e553
  7769. const m_PT_GNU_RELRO = 0x6474e552
  7770. const m_PT_GNU_STACK = 0x6474e551
  7771. const m_PT_HIOS = 0x6fffffff
  7772. const m_PT_HIPROC = 0x7fffffff
  7773. const m_PT_HISUNW = 0x6fffffff
  7774. const m_PT_INTERP = 3
  7775. const m_PT_LOAD = 1
  7776. const m_PT_LOOS = 0x60000000
  7777. const m_PT_LOPROC = 0x70000000
  7778. const m_PT_LOSUNW = 0x6ffffffa
  7779. const m_PT_MIPS_ABIFLAGS = 0x70000003
  7780. const m_PT_MIPS_OPTIONS = 0x70000002
  7781. const m_PT_MIPS_REGINFO = 0x70000000
  7782. const m_PT_MIPS_RTPROC = 0x70000001
  7783. const m_PT_NOTE = 4
  7784. const m_PT_NULL = 0
  7785. const m_PT_NUM = 8
  7786. const m_PT_PARISC_ARCHEXT = 0x70000000
  7787. const m_PT_PARISC_UNWIND = 0x70000001
  7788. const m_PT_PHDR = 6
  7789. const m_PT_SHLIB = 5
  7790. const m_PT_SUNWBSS = 0x6ffffffa
  7791. const m_PT_SUNWSTACK = 0x6ffffffb
  7792. const m_PT_TLS = 7
  7793. const m_RHF_NONE = 0
  7794. const m_R_386_16 = 20
  7795. const m_R_386_32 = 1
  7796. const m_R_386_32PLT = 11
  7797. const m_R_386_8 = 22
  7798. const m_R_386_COPY = 5
  7799. const m_R_386_GLOB_DAT = 6
  7800. const m_R_386_GOT32 = 3
  7801. const m_R_386_GOT32X = 43
  7802. const m_R_386_GOTOFF = 9
  7803. const m_R_386_GOTPC = 10
  7804. const m_R_386_IRELATIVE = 42
  7805. const m_R_386_JMP_SLOT = 7
  7806. const m_R_386_NONE = 0
  7807. const m_R_386_NUM = 44
  7808. const m_R_386_PC16 = 21
  7809. const m_R_386_PC32 = 2
  7810. const m_R_386_PC8 = 23
  7811. const m_R_386_PLT32 = 4
  7812. const m_R_386_RELATIVE = 8
  7813. const m_R_386_SIZE32 = 38
  7814. const m_R_386_TLS_DESC = 41
  7815. const m_R_386_TLS_DESC_CALL = 40
  7816. const m_R_386_TLS_DTPMOD32 = 35
  7817. const m_R_386_TLS_DTPOFF32 = 36
  7818. const m_R_386_TLS_GD = 18
  7819. const m_R_386_TLS_GD_32 = 24
  7820. const m_R_386_TLS_GD_CALL = 26
  7821. const m_R_386_TLS_GD_POP = 27
  7822. const m_R_386_TLS_GD_PUSH = 25
  7823. const m_R_386_TLS_GOTDESC = 39
  7824. const m_R_386_TLS_GOTIE = 16
  7825. const m_R_386_TLS_IE = 15
  7826. const m_R_386_TLS_IE_32 = 33
  7827. const m_R_386_TLS_LDM = 19
  7828. const m_R_386_TLS_LDM_32 = 28
  7829. const m_R_386_TLS_LDM_CALL = 30
  7830. const m_R_386_TLS_LDM_POP = 31
  7831. const m_R_386_TLS_LDM_PUSH = 29
  7832. const m_R_386_TLS_LDO_32 = 32
  7833. const m_R_386_TLS_LE = 17
  7834. const m_R_386_TLS_LE_32 = 34
  7835. const m_R_386_TLS_TPOFF = 14
  7836. const m_R_386_TLS_TPOFF32 = 37
  7837. const m_R_390_12 = 2
  7838. const m_R_390_16 = 3
  7839. const m_R_390_20 = 57
  7840. const m_R_390_32 = 4
  7841. const m_R_390_64 = 22
  7842. const m_R_390_8 = 1
  7843. const m_R_390_COPY = 9
  7844. const m_R_390_GLOB_DAT = 10
  7845. const m_R_390_GOT12 = 6
  7846. const m_R_390_GOT16 = 15
  7847. const m_R_390_GOT20 = 58
  7848. const m_R_390_GOT32 = 7
  7849. const m_R_390_GOT64 = 24
  7850. const m_R_390_GOTENT = 26
  7851. const m_R_390_GOTOFF16 = 27
  7852. const m_R_390_GOTOFF32 = 13
  7853. const m_R_390_GOTOFF64 = 28
  7854. const m_R_390_GOTPC = 14
  7855. const m_R_390_GOTPCDBL = 21
  7856. const m_R_390_GOTPLT12 = 29
  7857. const m_R_390_GOTPLT16 = 30
  7858. const m_R_390_GOTPLT20 = 59
  7859. const m_R_390_GOTPLT32 = 31
  7860. const m_R_390_GOTPLT64 = 32
  7861. const m_R_390_GOTPLTENT = 33
  7862. const m_R_390_JMP_SLOT = 11
  7863. const m_R_390_NONE = 0
  7864. const m_R_390_NUM = 61
  7865. const m_R_390_PC16 = 16
  7866. const m_R_390_PC16DBL = 17
  7867. const m_R_390_PC32 = 5
  7868. const m_R_390_PC32DBL = 19
  7869. const m_R_390_PC64 = 23
  7870. const m_R_390_PLT16DBL = 18
  7871. const m_R_390_PLT32 = 8
  7872. const m_R_390_PLT32DBL = 20
  7873. const m_R_390_PLT64 = 25
  7874. const m_R_390_PLTOFF16 = 34
  7875. const m_R_390_PLTOFF32 = 35
  7876. const m_R_390_PLTOFF64 = 36
  7877. const m_R_390_RELATIVE = 12
  7878. const m_R_390_TLS_DTPMOD = 54
  7879. const m_R_390_TLS_DTPOFF = 55
  7880. const m_R_390_TLS_GD32 = 40
  7881. const m_R_390_TLS_GD64 = 41
  7882. const m_R_390_TLS_GDCALL = 38
  7883. const m_R_390_TLS_GOTIE12 = 42
  7884. const m_R_390_TLS_GOTIE20 = 60
  7885. const m_R_390_TLS_GOTIE32 = 43
  7886. const m_R_390_TLS_GOTIE64 = 44
  7887. const m_R_390_TLS_IE32 = 47
  7888. const m_R_390_TLS_IE64 = 48
  7889. const m_R_390_TLS_IEENT = 49
  7890. const m_R_390_TLS_LDCALL = 39
  7891. const m_R_390_TLS_LDM32 = 45
  7892. const m_R_390_TLS_LDM64 = 46
  7893. const m_R_390_TLS_LDO32 = 52
  7894. const m_R_390_TLS_LDO64 = 53
  7895. const m_R_390_TLS_LE32 = 50
  7896. const m_R_390_TLS_LE64 = 51
  7897. const m_R_390_TLS_LOAD = 37
  7898. const m_R_390_TLS_TPOFF = 56
  7899. const m_R_68K_16 = 2
  7900. const m_R_68K_32 = 1
  7901. const m_R_68K_8 = 3
  7902. const m_R_68K_COPY = 19
  7903. const m_R_68K_GLOB_DAT = 20
  7904. const m_R_68K_GOT16 = 8
  7905. const m_R_68K_GOT16O = 11
  7906. const m_R_68K_GOT32 = 7
  7907. const m_R_68K_GOT32O = 10
  7908. const m_R_68K_GOT8 = 9
  7909. const m_R_68K_GOT8O = 12
  7910. const m_R_68K_JMP_SLOT = 21
  7911. const m_R_68K_NONE = 0
  7912. const m_R_68K_NUM = 43
  7913. const m_R_68K_PC16 = 5
  7914. const m_R_68K_PC32 = 4
  7915. const m_R_68K_PC8 = 6
  7916. const m_R_68K_PLT16 = 14
  7917. const m_R_68K_PLT16O = 17
  7918. const m_R_68K_PLT32 = 13
  7919. const m_R_68K_PLT32O = 16
  7920. const m_R_68K_PLT8 = 15
  7921. const m_R_68K_PLT8O = 18
  7922. const m_R_68K_RELATIVE = 22
  7923. const m_R_68K_TLS_DTPMOD32 = 40
  7924. const m_R_68K_TLS_DTPREL32 = 41
  7925. const m_R_68K_TLS_GD16 = 26
  7926. const m_R_68K_TLS_GD32 = 25
  7927. const m_R_68K_TLS_GD8 = 27
  7928. const m_R_68K_TLS_IE16 = 35
  7929. const m_R_68K_TLS_IE32 = 34
  7930. const m_R_68K_TLS_IE8 = 36
  7931. const m_R_68K_TLS_LDM16 = 29
  7932. const m_R_68K_TLS_LDM32 = 28
  7933. const m_R_68K_TLS_LDM8 = 30
  7934. const m_R_68K_TLS_LDO16 = 32
  7935. const m_R_68K_TLS_LDO32 = 31
  7936. const m_R_68K_TLS_LDO8 = 33
  7937. const m_R_68K_TLS_LE16 = 38
  7938. const m_R_68K_TLS_LE32 = 37
  7939. const m_R_68K_TLS_LE8 = 39
  7940. const m_R_68K_TLS_TPREL32 = 42
  7941. const m_R_AARCH64_ABS16 = 259
  7942. const m_R_AARCH64_ABS32 = 258
  7943. const m_R_AARCH64_ABS64 = 257
  7944. const m_R_AARCH64_ADD_ABS_LO12_NC = 277
  7945. const m_R_AARCH64_ADR_GOT_PAGE = 311
  7946. const m_R_AARCH64_ADR_PREL_LO21 = 274
  7947. const m_R_AARCH64_ADR_PREL_PG_HI21 = 275
  7948. const m_R_AARCH64_ADR_PREL_PG_HI21_NC = 276
  7949. const m_R_AARCH64_CALL26 = 283
  7950. const m_R_AARCH64_CONDBR19 = 280
  7951. const m_R_AARCH64_COPY = 1024
  7952. const m_R_AARCH64_GLOB_DAT = 1025
  7953. const m_R_AARCH64_GOTREL32 = 308
  7954. const m_R_AARCH64_GOTREL64 = 307
  7955. const m_R_AARCH64_GOT_LD_PREL19 = 309
  7956. const m_R_AARCH64_JUMP26 = 282
  7957. const m_R_AARCH64_JUMP_SLOT = 1026
  7958. const m_R_AARCH64_LD64_GOTOFF_LO15 = 310
  7959. const m_R_AARCH64_LD64_GOTPAGE_LO15 = 313
  7960. const m_R_AARCH64_LD64_GOT_LO12_NC = 312
  7961. const m_R_AARCH64_LDST128_ABS_LO12_NC = 299
  7962. const m_R_AARCH64_LDST16_ABS_LO12_NC = 284
  7963. const m_R_AARCH64_LDST32_ABS_LO12_NC = 285
  7964. const m_R_AARCH64_LDST64_ABS_LO12_NC = 286
  7965. const m_R_AARCH64_LDST8_ABS_LO12_NC = 278
  7966. const m_R_AARCH64_LD_PREL_LO19 = 273
  7967. const m_R_AARCH64_MOVW_GOTOFF_G0 = 300
  7968. const m_R_AARCH64_MOVW_GOTOFF_G0_NC = 301
  7969. const m_R_AARCH64_MOVW_GOTOFF_G1 = 302
  7970. const m_R_AARCH64_MOVW_GOTOFF_G1_NC = 303
  7971. const m_R_AARCH64_MOVW_GOTOFF_G2 = 304
  7972. const m_R_AARCH64_MOVW_GOTOFF_G2_NC = 305
  7973. const m_R_AARCH64_MOVW_GOTOFF_G3 = 306
  7974. const m_R_AARCH64_MOVW_PREL_G0 = 287
  7975. const m_R_AARCH64_MOVW_PREL_G0_NC = 288
  7976. const m_R_AARCH64_MOVW_PREL_G1 = 289
  7977. const m_R_AARCH64_MOVW_PREL_G1_NC = 290
  7978. const m_R_AARCH64_MOVW_PREL_G2 = 291
  7979. const m_R_AARCH64_MOVW_PREL_G2_NC = 292
  7980. const m_R_AARCH64_MOVW_PREL_G3 = 293
  7981. const m_R_AARCH64_MOVW_SABS_G0 = 270
  7982. const m_R_AARCH64_MOVW_SABS_G1 = 271
  7983. const m_R_AARCH64_MOVW_SABS_G2 = 272
  7984. const m_R_AARCH64_MOVW_UABS_G0 = 263
  7985. const m_R_AARCH64_MOVW_UABS_G0_NC = 264
  7986. const m_R_AARCH64_MOVW_UABS_G1 = 265
  7987. const m_R_AARCH64_MOVW_UABS_G1_NC = 266
  7988. const m_R_AARCH64_MOVW_UABS_G2 = 267
  7989. const m_R_AARCH64_MOVW_UABS_G2_NC = 268
  7990. const m_R_AARCH64_MOVW_UABS_G3 = 269
  7991. const m_R_AARCH64_NONE = 0
  7992. const m_R_AARCH64_P32_ABS32 = 1
  7993. const m_R_AARCH64_P32_COPY = 180
  7994. const m_R_AARCH64_P32_GLOB_DAT = 181
  7995. const m_R_AARCH64_P32_IRELATIVE = 188
  7996. const m_R_AARCH64_P32_JUMP_SLOT = 182
  7997. const m_R_AARCH64_P32_RELATIVE = 183
  7998. const m_R_AARCH64_P32_TLSDESC = 187
  7999. const m_R_AARCH64_P32_TLS_DTPMOD = 184
  8000. const m_R_AARCH64_P32_TLS_DTPREL = 185
  8001. const m_R_AARCH64_P32_TLS_TPREL = 186
  8002. const m_R_AARCH64_PREL16 = 262
  8003. const m_R_AARCH64_PREL32 = 261
  8004. const m_R_AARCH64_PREL64 = 260
  8005. const m_R_AARCH64_RELATIVE = 1027
  8006. const m_R_AARCH64_TLSDESC = 1031
  8007. const m_R_AARCH64_TLSDESC_ADD = 568
  8008. const m_R_AARCH64_TLSDESC_ADD_LO12 = 564
  8009. const m_R_AARCH64_TLSDESC_ADR_PAGE21 = 562
  8010. const m_R_AARCH64_TLSDESC_ADR_PREL21 = 561
  8011. const m_R_AARCH64_TLSDESC_CALL = 569
  8012. const m_R_AARCH64_TLSDESC_LD64_LO12 = 563
  8013. const m_R_AARCH64_TLSDESC_LDR = 567
  8014. const m_R_AARCH64_TLSDESC_LD_PREL19 = 560
  8015. const m_R_AARCH64_TLSDESC_OFF_G0_NC = 566
  8016. const m_R_AARCH64_TLSDESC_OFF_G1 = 565
  8017. const m_R_AARCH64_TLSGD_ADD_LO12_NC = 514
  8018. const m_R_AARCH64_TLSGD_ADR_PAGE21 = 513
  8019. const m_R_AARCH64_TLSGD_ADR_PREL21 = 512
  8020. const m_R_AARCH64_TLSGD_MOVW_G0_NC = 516
  8021. const m_R_AARCH64_TLSGD_MOVW_G1 = 515
  8022. const m_R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 = 541
  8023. const m_R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC = 542
  8024. const m_R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 = 543
  8025. const m_R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC = 540
  8026. const m_R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 = 539
  8027. const m_R_AARCH64_TLSLD_ADD_DTPREL_HI12 = 528
  8028. const m_R_AARCH64_TLSLD_ADD_DTPREL_LO12 = 529
  8029. const m_R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC = 530
  8030. const m_R_AARCH64_TLSLD_ADD_LO12_NC = 519
  8031. const m_R_AARCH64_TLSLD_ADR_PAGE21 = 518
  8032. const m_R_AARCH64_TLSLD_ADR_PREL21 = 517
  8033. const m_R_AARCH64_TLSLD_LDST128_DTPREL_LO12 = 572
  8034. const m_R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC = 573
  8035. const m_R_AARCH64_TLSLD_LDST16_DTPREL_LO12 = 533
  8036. const m_R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC = 534
  8037. const m_R_AARCH64_TLSLD_LDST32_DTPREL_LO12 = 535
  8038. const m_R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC = 536
  8039. const m_R_AARCH64_TLSLD_LDST64_DTPREL_LO12 = 537
  8040. const m_R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC = 538
  8041. const m_R_AARCH64_TLSLD_LDST8_DTPREL_LO12 = 531
  8042. const m_R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC = 532
  8043. const m_R_AARCH64_TLSLD_LD_PREL19 = 522
  8044. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G0 = 526
  8045. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC = 527
  8046. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G1 = 524
  8047. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC = 525
  8048. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G2 = 523
  8049. const m_R_AARCH64_TLSLD_MOVW_G0_NC = 521
  8050. const m_R_AARCH64_TLSLD_MOVW_G1 = 520
  8051. const m_R_AARCH64_TLSLE_ADD_TPREL_HI12 = 549
  8052. const m_R_AARCH64_TLSLE_ADD_TPREL_LO12 = 550
  8053. const m_R_AARCH64_TLSLE_ADD_TPREL_LO12_NC = 551
  8054. const m_R_AARCH64_TLSLE_LDST128_TPREL_LO12 = 570
  8055. const m_R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC = 571
  8056. const m_R_AARCH64_TLSLE_LDST16_TPREL_LO12 = 554
  8057. const m_R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC = 555
  8058. const m_R_AARCH64_TLSLE_LDST32_TPREL_LO12 = 556
  8059. const m_R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC = 557
  8060. const m_R_AARCH64_TLSLE_LDST64_TPREL_LO12 = 558
  8061. const m_R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC = 559
  8062. const m_R_AARCH64_TLSLE_LDST8_TPREL_LO12 = 552
  8063. const m_R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC = 553
  8064. const m_R_AARCH64_TLSLE_MOVW_TPREL_G0 = 547
  8065. const m_R_AARCH64_TLSLE_MOVW_TPREL_G0_NC = 548
  8066. const m_R_AARCH64_TLSLE_MOVW_TPREL_G1 = 545
  8067. const m_R_AARCH64_TLSLE_MOVW_TPREL_G1_NC = 546
  8068. const m_R_AARCH64_TLSLE_MOVW_TPREL_G2 = 544
  8069. const m_R_AARCH64_TLS_DTPMOD = 1028
  8070. const m_R_AARCH64_TLS_DTPMOD64 = 1028
  8071. const m_R_AARCH64_TLS_DTPREL = 1029
  8072. const m_R_AARCH64_TLS_DTPREL64 = 1029
  8073. const m_R_AARCH64_TLS_TPREL = 1030
  8074. const m_R_AARCH64_TLS_TPREL64 = 1030
  8075. const m_R_AARCH64_TSTBR14 = 279
  8076. const m_R_ALPHA_BRADDR = 7
  8077. const m_R_ALPHA_COPY = 24
  8078. const m_R_ALPHA_DTPMOD64 = 31
  8079. const m_R_ALPHA_DTPREL16 = 36
  8080. const m_R_ALPHA_DTPREL64 = 33
  8081. const m_R_ALPHA_DTPRELHI = 34
  8082. const m_R_ALPHA_DTPRELLO = 35
  8083. const m_R_ALPHA_GLOB_DAT = 25
  8084. const m_R_ALPHA_GOTDTPREL = 32
  8085. const m_R_ALPHA_GOTTPREL = 37
  8086. const m_R_ALPHA_GPDISP = 6
  8087. const m_R_ALPHA_GPREL16 = 19
  8088. const m_R_ALPHA_GPREL32 = 3
  8089. const m_R_ALPHA_GPRELHIGH = 17
  8090. const m_R_ALPHA_GPRELLOW = 18
  8091. const m_R_ALPHA_HINT = 8
  8092. const m_R_ALPHA_JMP_SLOT = 26
  8093. const m_R_ALPHA_LITERAL = 4
  8094. const m_R_ALPHA_LITUSE = 5
  8095. const m_R_ALPHA_NONE = 0
  8096. const m_R_ALPHA_NUM = 46
  8097. const m_R_ALPHA_REFLONG = 1
  8098. const m_R_ALPHA_REFQUAD = 2
  8099. const m_R_ALPHA_RELATIVE = 27
  8100. const m_R_ALPHA_SREL16 = 9
  8101. const m_R_ALPHA_SREL32 = 10
  8102. const m_R_ALPHA_SREL64 = 11
  8103. const m_R_ALPHA_TLSGD = 29
  8104. const m_R_ALPHA_TLS_GD_HI = 28
  8105. const m_R_ALPHA_TLS_LDM = 30
  8106. const m_R_ALPHA_TPREL16 = 41
  8107. const m_R_ALPHA_TPREL64 = 38
  8108. const m_R_ALPHA_TPRELHI = 39
  8109. const m_R_ALPHA_TPRELLO = 40
  8110. const m_R_ARM_ABS12 = 6
  8111. const m_R_ARM_ABS16 = 5
  8112. const m_R_ARM_ABS32 = 2
  8113. const m_R_ARM_ABS32_NOI = 55
  8114. const m_R_ARM_ABS8 = 8
  8115. const m_R_ARM_ALU_PCREL_15_8 = 33
  8116. const m_R_ARM_ALU_PCREL_23_15 = 34
  8117. const m_R_ARM_ALU_PCREL_7_0 = 32
  8118. const m_R_ARM_ALU_PC_G0 = 58
  8119. const m_R_ARM_ALU_PC_G0_NC = 57
  8120. const m_R_ARM_ALU_PC_G1 = 60
  8121. const m_R_ARM_ALU_PC_G1_NC = 59
  8122. const m_R_ARM_ALU_PC_G2 = 61
  8123. const m_R_ARM_ALU_SBREL_19_12 = 36
  8124. const m_R_ARM_ALU_SBREL_27_20 = 37
  8125. const m_R_ARM_ALU_SB_G0 = 71
  8126. const m_R_ARM_ALU_SB_G0_NC = 70
  8127. const m_R_ARM_ALU_SB_G1 = 73
  8128. const m_R_ARM_ALU_SB_G1_NC = 72
  8129. const m_R_ARM_ALU_SB_G2 = 74
  8130. const m_R_ARM_AMP_VCALL9 = 12
  8131. const m_R_ARM_BASE_ABS = 31
  8132. const m_R_ARM_CALL = 28
  8133. const m_R_ARM_COPY = 20
  8134. const m_R_ARM_GLOB_DAT = 21
  8135. const m_R_ARM_GNU_VTENTRY = 100
  8136. const m_R_ARM_GNU_VTINHERIT = 101
  8137. const m_R_ARM_GOT32 = 26
  8138. const m_R_ARM_GOTOFF = 24
  8139. const m_R_ARM_GOTOFF12 = 98
  8140. const m_R_ARM_GOTPC = 25
  8141. const m_R_ARM_GOTRELAX = 99
  8142. const m_R_ARM_GOT_ABS = 95
  8143. const m_R_ARM_GOT_BREL12 = 97
  8144. const m_R_ARM_GOT_PREL = 96
  8145. const m_R_ARM_IRELATIVE = 160
  8146. const m_R_ARM_JUMP24 = 29
  8147. const m_R_ARM_JUMP_SLOT = 22
  8148. const m_R_ARM_LDC_PC_G0 = 67
  8149. const m_R_ARM_LDC_PC_G1 = 68
  8150. const m_R_ARM_LDC_PC_G2 = 69
  8151. const m_R_ARM_LDC_SB_G0 = 81
  8152. const m_R_ARM_LDC_SB_G1 = 82
  8153. const m_R_ARM_LDC_SB_G2 = 83
  8154. const m_R_ARM_LDRS_PC_G0 = 64
  8155. const m_R_ARM_LDRS_PC_G1 = 65
  8156. const m_R_ARM_LDRS_PC_G2 = 66
  8157. const m_R_ARM_LDRS_SB_G0 = 78
  8158. const m_R_ARM_LDRS_SB_G1 = 79
  8159. const m_R_ARM_LDRS_SB_G2 = 80
  8160. const m_R_ARM_LDR_PC_G1 = 62
  8161. const m_R_ARM_LDR_PC_G2 = 63
  8162. const m_R_ARM_LDR_SBREL_11_0 = 35
  8163. const m_R_ARM_LDR_SB_G0 = 75
  8164. const m_R_ARM_LDR_SB_G1 = 76
  8165. const m_R_ARM_LDR_SB_G2 = 77
  8166. const m_R_ARM_ME_TOO = 128
  8167. const m_R_ARM_MOVT_ABS = 44
  8168. const m_R_ARM_MOVT_BREL = 85
  8169. const m_R_ARM_MOVT_PREL = 46
  8170. const m_R_ARM_MOVW_ABS_NC = 43
  8171. const m_R_ARM_MOVW_BREL = 86
  8172. const m_R_ARM_MOVW_BREL_NC = 84
  8173. const m_R_ARM_MOVW_PREL_NC = 45
  8174. const m_R_ARM_NONE = 0
  8175. const m_R_ARM_NUM = 256
  8176. const m_R_ARM_PC13 = 4
  8177. const m_R_ARM_PC24 = 1
  8178. const m_R_ARM_PLT32 = 27
  8179. const m_R_ARM_PLT32_ABS = 94
  8180. const m_R_ARM_PREL31 = 42
  8181. const m_R_ARM_RABS22 = 253
  8182. const m_R_ARM_RBASE = 255
  8183. const m_R_ARM_REL32 = 3
  8184. const m_R_ARM_REL32_NOI = 56
  8185. const m_R_ARM_RELATIVE = 23
  8186. const m_R_ARM_RPC24 = 254
  8187. const m_R_ARM_RREL32 = 252
  8188. const m_R_ARM_RSBREL32 = 250
  8189. const m_R_ARM_RXPC25 = 249
  8190. const m_R_ARM_SBREL31 = 39
  8191. const m_R_ARM_SBREL32 = 9
  8192. const m_R_ARM_TARGET1 = 38
  8193. const m_R_ARM_TARGET2 = 41
  8194. const m_R_ARM_THM_ABS5 = 7
  8195. const m_R_ARM_THM_ALU_PREL_11_0 = 53
  8196. const m_R_ARM_THM_GOT_BREL12 = 131
  8197. const m_R_ARM_THM_JUMP19 = 51
  8198. const m_R_ARM_THM_JUMP24 = 30
  8199. const m_R_ARM_THM_JUMP6 = 52
  8200. const m_R_ARM_THM_MOVT_ABS = 48
  8201. const m_R_ARM_THM_MOVT_BREL = 88
  8202. const m_R_ARM_THM_MOVT_PREL = 50
  8203. const m_R_ARM_THM_MOVW_ABS_NC = 47
  8204. const m_R_ARM_THM_MOVW_BREL = 89
  8205. const m_R_ARM_THM_MOVW_BREL_NC = 87
  8206. const m_R_ARM_THM_MOVW_PREL_NC = 49
  8207. const m_R_ARM_THM_PC11 = 102
  8208. const m_R_ARM_THM_PC12 = 54
  8209. const m_R_ARM_THM_PC22 = 10
  8210. const m_R_ARM_THM_PC8 = 11
  8211. const m_R_ARM_THM_PC9 = 103
  8212. const m_R_ARM_THM_RPC22 = 251
  8213. const m_R_ARM_THM_SWI8 = 14
  8214. const m_R_ARM_THM_TLS_CALL = 93
  8215. const m_R_ARM_THM_TLS_DESCSEQ = 129
  8216. const m_R_ARM_THM_TLS_DESCSEQ16 = 129
  8217. const m_R_ARM_THM_TLS_DESCSEQ32 = 130
  8218. const m_R_ARM_THM_XPC22 = 16
  8219. const m_R_ARM_TLS_CALL = 91
  8220. const m_R_ARM_TLS_DESC = 13
  8221. const m_R_ARM_TLS_DESCSEQ = 92
  8222. const m_R_ARM_TLS_DTPMOD32 = 17
  8223. const m_R_ARM_TLS_DTPOFF32 = 18
  8224. const m_R_ARM_TLS_GD32 = 104
  8225. const m_R_ARM_TLS_GOTDESC = 90
  8226. const m_R_ARM_TLS_IE12GP = 111
  8227. const m_R_ARM_TLS_IE32 = 107
  8228. const m_R_ARM_TLS_LDM32 = 105
  8229. const m_R_ARM_TLS_LDO12 = 109
  8230. const m_R_ARM_TLS_LDO32 = 106
  8231. const m_R_ARM_TLS_LE12 = 110
  8232. const m_R_ARM_TLS_LE32 = 108
  8233. const m_R_ARM_TLS_TPOFF32 = 19
  8234. const m_R_ARM_V4BX = 40
  8235. const m_R_ARM_XPC25 = 15
  8236. const m_R_BPF_MAP_FD = 1
  8237. const m_R_BPF_NONE = 0
  8238. const m_R_CKCORE_ADDR32 = 1
  8239. const m_R_CKCORE_ADDRGOT = 17
  8240. const m_R_CKCORE_ADDRGOT_HI16 = 36
  8241. const m_R_CKCORE_ADDRGOT_LO16 = 37
  8242. const m_R_CKCORE_ADDRPLT = 18
  8243. const m_R_CKCORE_ADDRPLT_HI16 = 38
  8244. const m_R_CKCORE_ADDRPLT_LO16 = 39
  8245. const m_R_CKCORE_ADDR_HI16 = 24
  8246. const m_R_CKCORE_ADDR_LO16 = 25
  8247. const m_R_CKCORE_COPY = 10
  8248. const m_R_CKCORE_DOFFSET_IMM18 = 44
  8249. const m_R_CKCORE_DOFFSET_IMM18BY2 = 45
  8250. const m_R_CKCORE_DOFFSET_IMM18BY4 = 46
  8251. const m_R_CKCORE_DOFFSET_LO16 = 42
  8252. const m_R_CKCORE_GLOB_DAT = 11
  8253. const m_R_CKCORE_GOT12 = 30
  8254. const m_R_CKCORE_GOT32 = 15
  8255. const m_R_CKCORE_GOTOFF = 13
  8256. const m_R_CKCORE_GOTOFF_HI16 = 28
  8257. const m_R_CKCORE_GOTOFF_LO16 = 29
  8258. const m_R_CKCORE_GOTPC = 14
  8259. const m_R_CKCORE_GOTPC_HI16 = 26
  8260. const m_R_CKCORE_GOTPC_LO16 = 27
  8261. const m_R_CKCORE_GOT_HI16 = 31
  8262. const m_R_CKCORE_GOT_IMM18BY4 = 48
  8263. const m_R_CKCORE_GOT_LO16 = 32
  8264. const m_R_CKCORE_JUMP_SLOT = 12
  8265. const m_R_CKCORE_NONE = 0
  8266. const m_R_CKCORE_PCREL32 = 5
  8267. const m_R_CKCORE_PCRELIMM11BY2 = 3
  8268. const m_R_CKCORE_PCRELIMM8BY4 = 2
  8269. const m_R_CKCORE_PCRELJSR_IMM11BY2 = 6
  8270. const m_R_CKCORE_PCREL_IMM10BY2 = 22
  8271. const m_R_CKCORE_PCREL_IMM10BY4 = 23
  8272. const m_R_CKCORE_PCREL_IMM16BY2 = 20
  8273. const m_R_CKCORE_PCREL_IMM16BY4 = 21
  8274. const m_R_CKCORE_PCREL_IMM18BY2 = 43
  8275. const m_R_CKCORE_PCREL_IMM26BY2 = 19
  8276. const m_R_CKCORE_PCREL_IMM7BY4 = 50
  8277. const m_R_CKCORE_PCREL_JSR_IMM26BY2 = 40
  8278. const m_R_CKCORE_PLT12 = 33
  8279. const m_R_CKCORE_PLT32 = 16
  8280. const m_R_CKCORE_PLT_HI16 = 34
  8281. const m_R_CKCORE_PLT_IMM18BY4 = 49
  8282. const m_R_CKCORE_PLT_LO16 = 35
  8283. const m_R_CKCORE_RELATIVE = 9
  8284. const m_R_CKCORE_TLS_DTPMOD32 = 56
  8285. const m_R_CKCORE_TLS_DTPOFF32 = 57
  8286. const m_R_CKCORE_TLS_GD32 = 53
  8287. const m_R_CKCORE_TLS_IE32 = 52
  8288. const m_R_CKCORE_TLS_LDM32 = 54
  8289. const m_R_CKCORE_TLS_LDO32 = 55
  8290. const m_R_CKCORE_TLS_LE32 = 51
  8291. const m_R_CKCORE_TLS_TPOFF32 = 58
  8292. const m_R_CKCORE_TOFFSET_LO16 = 41
  8293. const m_R_CRIS_16 = 2
  8294. const m_R_CRIS_16_GOT = 13
  8295. const m_R_CRIS_16_GOTPLT = 15
  8296. const m_R_CRIS_16_PCREL = 5
  8297. const m_R_CRIS_32 = 3
  8298. const m_R_CRIS_32_GOT = 14
  8299. const m_R_CRIS_32_GOTPLT = 16
  8300. const m_R_CRIS_32_GOTREL = 17
  8301. const m_R_CRIS_32_PCREL = 6
  8302. const m_R_CRIS_32_PLT_GOTREL = 18
  8303. const m_R_CRIS_32_PLT_PCREL = 19
  8304. const m_R_CRIS_8 = 1
  8305. const m_R_CRIS_8_PCREL = 4
  8306. const m_R_CRIS_COPY = 9
  8307. const m_R_CRIS_GLOB_DAT = 10
  8308. const m_R_CRIS_GNU_VTENTRY = 8
  8309. const m_R_CRIS_GNU_VTINHERIT = 7
  8310. const m_R_CRIS_JUMP_SLOT = 11
  8311. const m_R_CRIS_NONE = 0
  8312. const m_R_CRIS_NUM = 20
  8313. const m_R_CRIS_RELATIVE = 12
  8314. const m_R_IA64_COPY = 0x84
  8315. const m_R_IA64_DIR32LSB = 0x25
  8316. const m_R_IA64_DIR32MSB = 0x24
  8317. const m_R_IA64_DIR64LSB = 0x27
  8318. const m_R_IA64_DIR64MSB = 0x26
  8319. const m_R_IA64_DTPMOD64LSB = 0xa7
  8320. const m_R_IA64_DTPMOD64MSB = 0xa6
  8321. const m_R_IA64_DTPREL14 = 0xb1
  8322. const m_R_IA64_DTPREL22 = 0xb2
  8323. const m_R_IA64_DTPREL32LSB = 0xb5
  8324. const m_R_IA64_DTPREL32MSB = 0xb4
  8325. const m_R_IA64_DTPREL64I = 0xb3
  8326. const m_R_IA64_DTPREL64LSB = 0xb7
  8327. const m_R_IA64_DTPREL64MSB = 0xb6
  8328. const m_R_IA64_FPTR32LSB = 0x45
  8329. const m_R_IA64_FPTR32MSB = 0x44
  8330. const m_R_IA64_FPTR64I = 0x43
  8331. const m_R_IA64_FPTR64LSB = 0x47
  8332. const m_R_IA64_FPTR64MSB = 0x46
  8333. const m_R_IA64_GPREL22 = 0x2a
  8334. const m_R_IA64_GPREL32LSB = 0x2d
  8335. const m_R_IA64_GPREL32MSB = 0x2c
  8336. const m_R_IA64_GPREL64I = 0x2b
  8337. const m_R_IA64_GPREL64LSB = 0x2f
  8338. const m_R_IA64_GPREL64MSB = 0x2e
  8339. const m_R_IA64_IMM14 = 0x21
  8340. const m_R_IA64_IMM22 = 0x22
  8341. const m_R_IA64_IMM64 = 0x23
  8342. const m_R_IA64_IPLTLSB = 0x81
  8343. const m_R_IA64_IPLTMSB = 0x80
  8344. const m_R_IA64_LDXMOV = 0x87
  8345. const m_R_IA64_LTOFF22 = 0x32
  8346. const m_R_IA64_LTOFF22X = 0x86
  8347. const m_R_IA64_LTOFF64I = 0x33
  8348. const m_R_IA64_LTOFF_DTPMOD22 = 0xaa
  8349. const m_R_IA64_LTOFF_DTPREL22 = 0xba
  8350. const m_R_IA64_LTOFF_FPTR22 = 0x52
  8351. const m_R_IA64_LTOFF_FPTR32LSB = 0x55
  8352. const m_R_IA64_LTOFF_FPTR32MSB = 0x54
  8353. const m_R_IA64_LTOFF_FPTR64I = 0x53
  8354. const m_R_IA64_LTOFF_FPTR64LSB = 0x57
  8355. const m_R_IA64_LTOFF_FPTR64MSB = 0x56
  8356. const m_R_IA64_LTOFF_TPREL22 = 0x9a
  8357. const m_R_IA64_LTV32LSB = 0x75
  8358. const m_R_IA64_LTV32MSB = 0x74
  8359. const m_R_IA64_LTV64LSB = 0x77
  8360. const m_R_IA64_LTV64MSB = 0x76
  8361. const m_R_IA64_NONE = 0x00
  8362. const m_R_IA64_PCREL21B = 0x49
  8363. const m_R_IA64_PCREL21BI = 0x79
  8364. const m_R_IA64_PCREL21F = 0x4b
  8365. const m_R_IA64_PCREL21M = 0x4a
  8366. const m_R_IA64_PCREL22 = 0x7a
  8367. const m_R_IA64_PCREL32LSB = 0x4d
  8368. const m_R_IA64_PCREL32MSB = 0x4c
  8369. const m_R_IA64_PCREL60B = 0x48
  8370. const m_R_IA64_PCREL64I = 0x7b
  8371. const m_R_IA64_PCREL64LSB = 0x4f
  8372. const m_R_IA64_PCREL64MSB = 0x4e
  8373. const m_R_IA64_PLTOFF22 = 0x3a
  8374. const m_R_IA64_PLTOFF64I = 0x3b
  8375. const m_R_IA64_PLTOFF64LSB = 0x3f
  8376. const m_R_IA64_PLTOFF64MSB = 0x3e
  8377. const m_R_IA64_REL32LSB = 0x6d
  8378. const m_R_IA64_REL32MSB = 0x6c
  8379. const m_R_IA64_REL64LSB = 0x6f
  8380. const m_R_IA64_REL64MSB = 0x6e
  8381. const m_R_IA64_SECREL32LSB = 0x65
  8382. const m_R_IA64_SECREL32MSB = 0x64
  8383. const m_R_IA64_SECREL64LSB = 0x67
  8384. const m_R_IA64_SECREL64MSB = 0x66
  8385. const m_R_IA64_SEGREL32LSB = 0x5d
  8386. const m_R_IA64_SEGREL32MSB = 0x5c
  8387. const m_R_IA64_SEGREL64LSB = 0x5f
  8388. const m_R_IA64_SEGREL64MSB = 0x5e
  8389. const m_R_IA64_SUB = 0x85
  8390. const m_R_IA64_TPREL14 = 0x91
  8391. const m_R_IA64_TPREL22 = 0x92
  8392. const m_R_IA64_TPREL64I = 0x93
  8393. const m_R_IA64_TPREL64LSB = 0x97
  8394. const m_R_IA64_TPREL64MSB = 0x96
  8395. const m_R_LARCH_32 = 1
  8396. const m_R_LARCH_32_PCREL = 99
  8397. const m_R_LARCH_64 = 2
  8398. const m_R_LARCH_ABS64_HI12 = 70
  8399. const m_R_LARCH_ABS64_LO20 = 69
  8400. const m_R_LARCH_ABS_HI20 = 67
  8401. const m_R_LARCH_ABS_LO12 = 68
  8402. const m_R_LARCH_ADD16 = 48
  8403. const m_R_LARCH_ADD24 = 49
  8404. const m_R_LARCH_ADD32 = 50
  8405. const m_R_LARCH_ADD64 = 51
  8406. const m_R_LARCH_ADD8 = 47
  8407. const m_R_LARCH_B16 = 64
  8408. const m_R_LARCH_B21 = 65
  8409. const m_R_LARCH_B26 = 66
  8410. const m_R_LARCH_COPY = 4
  8411. const m_R_LARCH_GNU_VTENTRY = 58
  8412. const m_R_LARCH_GNU_VTINHERIT = 57
  8413. const m_R_LARCH_GOT64_HI12 = 82
  8414. const m_R_LARCH_GOT64_LO20 = 81
  8415. const m_R_LARCH_GOT64_PC_HI12 = 78
  8416. const m_R_LARCH_GOT64_PC_LO20 = 77
  8417. const m_R_LARCH_GOT_HI20 = 79
  8418. const m_R_LARCH_GOT_LO12 = 80
  8419. const m_R_LARCH_GOT_PC_HI20 = 75
  8420. const m_R_LARCH_GOT_PC_LO12 = 76
  8421. const m_R_LARCH_IRELATIVE = 12
  8422. const m_R_LARCH_JUMP_SLOT = 5
  8423. const m_R_LARCH_MARK_LA = 20
  8424. const m_R_LARCH_MARK_PCREL = 21
  8425. const m_R_LARCH_NONE = 0
  8426. const m_R_LARCH_PCALA64_HI12 = 74
  8427. const m_R_LARCH_PCALA64_LO20 = 73
  8428. const m_R_LARCH_PCALA_HI20 = 71
  8429. const m_R_LARCH_PCALA_LO12 = 72
  8430. const m_R_LARCH_RELATIVE = 3
  8431. const m_R_LARCH_RELAX = 100
  8432. const m_R_LARCH_SOP_ADD = 35
  8433. const m_R_LARCH_SOP_AND = 36
  8434. const m_R_LARCH_SOP_ASSERT = 30
  8435. const m_R_LARCH_SOP_IF_ELSE = 37
  8436. const m_R_LARCH_SOP_NOT = 31
  8437. const m_R_LARCH_SOP_POP_32_S_0_10_10_16_S2 = 45
  8438. const m_R_LARCH_SOP_POP_32_S_0_5_10_16_S2 = 44
  8439. const m_R_LARCH_SOP_POP_32_S_10_12 = 40
  8440. const m_R_LARCH_SOP_POP_32_S_10_16 = 41
  8441. const m_R_LARCH_SOP_POP_32_S_10_16_S2 = 42
  8442. const m_R_LARCH_SOP_POP_32_S_10_5 = 38
  8443. const m_R_LARCH_SOP_POP_32_S_5_20 = 43
  8444. const m_R_LARCH_SOP_POP_32_U = 46
  8445. const m_R_LARCH_SOP_POP_32_U_10_12 = 39
  8446. const m_R_LARCH_SOP_PUSH_ABSOLUTE = 23
  8447. const m_R_LARCH_SOP_PUSH_DUP = 24
  8448. const m_R_LARCH_SOP_PUSH_GPREL = 25
  8449. const m_R_LARCH_SOP_PUSH_PCREL = 22
  8450. const m_R_LARCH_SOP_PUSH_PLT_PCREL = 29
  8451. const m_R_LARCH_SOP_PUSH_TLS_GD = 28
  8452. const m_R_LARCH_SOP_PUSH_TLS_GOT = 27
  8453. const m_R_LARCH_SOP_PUSH_TLS_TPREL = 26
  8454. const m_R_LARCH_SOP_SL = 33
  8455. const m_R_LARCH_SOP_SR = 34
  8456. const m_R_LARCH_SOP_SUB = 32
  8457. const m_R_LARCH_SUB16 = 53
  8458. const m_R_LARCH_SUB24 = 54
  8459. const m_R_LARCH_SUB32 = 55
  8460. const m_R_LARCH_SUB64 = 56
  8461. const m_R_LARCH_SUB8 = 52
  8462. const m_R_LARCH_TLS_DTPMOD32 = 6
  8463. const m_R_LARCH_TLS_DTPMOD64 = 7
  8464. const m_R_LARCH_TLS_DTPREL32 = 8
  8465. const m_R_LARCH_TLS_DTPREL64 = 9
  8466. const m_R_LARCH_TLS_GD_HI20 = 98
  8467. const m_R_LARCH_TLS_GD_PC_HI20 = 97
  8468. const m_R_LARCH_TLS_IE64_HI12 = 94
  8469. const m_R_LARCH_TLS_IE64_LO20 = 93
  8470. const m_R_LARCH_TLS_IE64_PC_HI12 = 90
  8471. const m_R_LARCH_TLS_IE64_PC_LO20 = 89
  8472. const m_R_LARCH_TLS_IE_HI20 = 91
  8473. const m_R_LARCH_TLS_IE_LO12 = 92
  8474. const m_R_LARCH_TLS_IE_PC_HI20 = 87
  8475. const m_R_LARCH_TLS_IE_PC_LO12 = 88
  8476. const m_R_LARCH_TLS_LD_HI20 = 96
  8477. const m_R_LARCH_TLS_LD_PC_HI20 = 95
  8478. const m_R_LARCH_TLS_LE64_HI12 = 86
  8479. const m_R_LARCH_TLS_LE64_LO20 = 85
  8480. const m_R_LARCH_TLS_LE_HI20 = 83
  8481. const m_R_LARCH_TLS_LE_LO12 = 84
  8482. const m_R_LARCH_TLS_TPREL32 = 10
  8483. const m_R_LARCH_TLS_TPREL64 = 11
  8484. const m_R_M32R_10_PCREL = 4
  8485. const m_R_M32R_10_PCREL_RELA = 36
  8486. const m_R_M32R_16 = 1
  8487. const m_R_M32R_16_RELA = 33
  8488. const m_R_M32R_18_PCREL = 5
  8489. const m_R_M32R_18_PCREL_RELA = 37
  8490. const m_R_M32R_24 = 3
  8491. const m_R_M32R_24_RELA = 35
  8492. const m_R_M32R_26_PCREL = 6
  8493. const m_R_M32R_26_PCREL_RELA = 38
  8494. const m_R_M32R_26_PLTREL = 49
  8495. const m_R_M32R_32 = 2
  8496. const m_R_M32R_32_RELA = 34
  8497. const m_R_M32R_COPY = 50
  8498. const m_R_M32R_GLOB_DAT = 51
  8499. const m_R_M32R_GNU_VTENTRY = 12
  8500. const m_R_M32R_GNU_VTINHERIT = 11
  8501. const m_R_M32R_GOT16_HI_SLO = 57
  8502. const m_R_M32R_GOT16_HI_ULO = 56
  8503. const m_R_M32R_GOT16_LO = 58
  8504. const m_R_M32R_GOT24 = 48
  8505. const m_R_M32R_GOTOFF = 54
  8506. const m_R_M32R_GOTOFF_HI_SLO = 63
  8507. const m_R_M32R_GOTOFF_HI_ULO = 62
  8508. const m_R_M32R_GOTOFF_LO = 64
  8509. const m_R_M32R_GOTPC24 = 55
  8510. const m_R_M32R_GOTPC_HI_SLO = 60
  8511. const m_R_M32R_GOTPC_HI_ULO = 59
  8512. const m_R_M32R_GOTPC_LO = 61
  8513. const m_R_M32R_HI16_SLO = 8
  8514. const m_R_M32R_HI16_SLO_RELA = 40
  8515. const m_R_M32R_HI16_ULO = 7
  8516. const m_R_M32R_HI16_ULO_RELA = 39
  8517. const m_R_M32R_JMP_SLOT = 52
  8518. const m_R_M32R_LO16 = 9
  8519. const m_R_M32R_LO16_RELA = 41
  8520. const m_R_M32R_NONE = 0
  8521. const m_R_M32R_NUM = 256
  8522. const m_R_M32R_REL32 = 45
  8523. const m_R_M32R_RELATIVE = 53
  8524. const m_R_M32R_RELA_GNU_VTENTRY = 44
  8525. const m_R_M32R_RELA_GNU_VTINHERIT = 43
  8526. const m_R_M32R_SDA16 = 10
  8527. const m_R_M32R_SDA16_RELA = 42
  8528. const m_R_MICROBLAZE_32 = 1
  8529. const m_R_MICROBLAZE_32_LO = 6
  8530. const m_R_MICROBLAZE_32_PCREL = 2
  8531. const m_R_MICROBLAZE_32_PCREL_LO = 4
  8532. const m_R_MICROBLAZE_32_SYM_OP_SYM = 10
  8533. const m_R_MICROBLAZE_64 = 5
  8534. const m_R_MICROBLAZE_64_NONE = 9
  8535. const m_R_MICROBLAZE_64_PCREL = 3
  8536. const m_R_MICROBLAZE_COPY = 21
  8537. const m_R_MICROBLAZE_GLOB_DAT = 18
  8538. const m_R_MICROBLAZE_GNU_VTENTRY = 12
  8539. const m_R_MICROBLAZE_GNU_VTINHERIT = 11
  8540. const m_R_MICROBLAZE_GOTOFF_32 = 20
  8541. const m_R_MICROBLAZE_GOTOFF_64 = 19
  8542. const m_R_MICROBLAZE_GOTPC_64 = 13
  8543. const m_R_MICROBLAZE_GOT_64 = 14
  8544. const m_R_MICROBLAZE_JUMP_SLOT = 17
  8545. const m_R_MICROBLAZE_NONE = 0
  8546. const m_R_MICROBLAZE_PLT_64 = 15
  8547. const m_R_MICROBLAZE_REL = 16
  8548. const m_R_MICROBLAZE_SRO32 = 7
  8549. const m_R_MICROBLAZE_SRW32 = 8
  8550. const m_R_MICROBLAZE_TLS = 22
  8551. const m_R_MICROBLAZE_TLSDTPMOD32 = 25
  8552. const m_R_MICROBLAZE_TLSDTPREL32 = 26
  8553. const m_R_MICROBLAZE_TLSDTPREL64 = 27
  8554. const m_R_MICROBLAZE_TLSGD = 23
  8555. const m_R_MICROBLAZE_TLSGOTTPREL32 = 28
  8556. const m_R_MICROBLAZE_TLSLD = 24
  8557. const m_R_MICROBLAZE_TLSTPREL32 = 29
  8558. const m_R_MIPS_16 = 1
  8559. const m_R_MIPS_26 = 4
  8560. const m_R_MIPS_32 = 2
  8561. const m_R_MIPS_64 = 18
  8562. const m_R_MIPS_ADD_IMMEDIATE = 34
  8563. const m_R_MIPS_CALL16 = 11
  8564. const m_R_MIPS_CALL_HI16 = 30
  8565. const m_R_MIPS_CALL_LO16 = 31
  8566. const m_R_MIPS_COPY = 126
  8567. const m_R_MIPS_DELETE = 27
  8568. const m_R_MIPS_GLOB_DAT = 51
  8569. const m_R_MIPS_GOT16 = 9
  8570. const m_R_MIPS_GOT_DISP = 19
  8571. const m_R_MIPS_GOT_HI16 = 22
  8572. const m_R_MIPS_GOT_LO16 = 23
  8573. const m_R_MIPS_GOT_OFST = 21
  8574. const m_R_MIPS_GOT_PAGE = 20
  8575. const m_R_MIPS_GPREL16 = 7
  8576. const m_R_MIPS_GPREL32 = 12
  8577. const m_R_MIPS_HI16 = 5
  8578. const m_R_MIPS_HIGHER = 28
  8579. const m_R_MIPS_HIGHEST = 29
  8580. const m_R_MIPS_INSERT_A = 25
  8581. const m_R_MIPS_INSERT_B = 26
  8582. const m_R_MIPS_JALR = 37
  8583. const m_R_MIPS_JUMP_SLOT = 127
  8584. const m_R_MIPS_LITERAL = 8
  8585. const m_R_MIPS_LO16 = 6
  8586. const m_R_MIPS_NONE = 0
  8587. const m_R_MIPS_NUM = 128
  8588. const m_R_MIPS_PC16 = 10
  8589. const m_R_MIPS_PJUMP = 35
  8590. const m_R_MIPS_REL16 = 33
  8591. const m_R_MIPS_REL32 = 3
  8592. const m_R_MIPS_RELGOT = 36
  8593. const m_R_MIPS_SCN_DISP = 32
  8594. const m_R_MIPS_SHIFT5 = 16
  8595. const m_R_MIPS_SHIFT6 = 17
  8596. const m_R_MIPS_SUB = 24
  8597. const m_R_MIPS_TLS_DTPMOD32 = 38
  8598. const m_R_MIPS_TLS_DTPMOD64 = 40
  8599. const m_R_MIPS_TLS_DTPREL32 = 39
  8600. const m_R_MIPS_TLS_DTPREL64 = 41
  8601. const m_R_MIPS_TLS_DTPREL_HI16 = 44
  8602. const m_R_MIPS_TLS_DTPREL_LO16 = 45
  8603. const m_R_MIPS_TLS_GD = 42
  8604. const m_R_MIPS_TLS_GOTTPREL = 46
  8605. const m_R_MIPS_TLS_LDM = 43
  8606. const m_R_MIPS_TLS_TPREL32 = 47
  8607. const m_R_MIPS_TLS_TPREL64 = 48
  8608. const m_R_MIPS_TLS_TPREL_HI16 = 49
  8609. const m_R_MIPS_TLS_TPREL_LO16 = 50
  8610. const m_R_MN10300_16 = 2
  8611. const m_R_MN10300_24 = 9
  8612. const m_R_MN10300_32 = 1
  8613. const m_R_MN10300_8 = 3
  8614. const m_R_MN10300_COPY = 20
  8615. const m_R_MN10300_GLOB_DAT = 21
  8616. const m_R_MN10300_GNU_VTENTRY = 8
  8617. const m_R_MN10300_GNU_VTINHERIT = 7
  8618. const m_R_MN10300_GOT16 = 19
  8619. const m_R_MN10300_GOT24 = 18
  8620. const m_R_MN10300_GOT32 = 17
  8621. const m_R_MN10300_GOTOFF16 = 14
  8622. const m_R_MN10300_GOTOFF24 = 13
  8623. const m_R_MN10300_GOTOFF32 = 12
  8624. const m_R_MN10300_GOTPC16 = 11
  8625. const m_R_MN10300_GOTPC32 = 10
  8626. const m_R_MN10300_JMP_SLOT = 22
  8627. const m_R_MN10300_NONE = 0
  8628. const m_R_MN10300_NUM = 24
  8629. const m_R_MN10300_PCREL16 = 5
  8630. const m_R_MN10300_PCREL32 = 4
  8631. const m_R_MN10300_PCREL8 = 6
  8632. const m_R_MN10300_PLT16 = 16
  8633. const m_R_MN10300_PLT32 = 15
  8634. const m_R_MN10300_RELATIVE = 23
  8635. const m_R_NIOS2_ALIGN = 21
  8636. const m_R_NIOS2_BFD_RELOC_16 = 13
  8637. const m_R_NIOS2_BFD_RELOC_32 = 12
  8638. const m_R_NIOS2_BFD_RELOC_8 = 14
  8639. const m_R_NIOS2_CACHE_OPX = 6
  8640. const m_R_NIOS2_CALL16 = 23
  8641. const m_R_NIOS2_CALL26 = 4
  8642. const m_R_NIOS2_CALL26_NOAT = 41
  8643. const m_R_NIOS2_CALLR = 20
  8644. const m_R_NIOS2_CALL_HA = 45
  8645. const m_R_NIOS2_CALL_LO = 44
  8646. const m_R_NIOS2_CJMP = 19
  8647. const m_R_NIOS2_COPY = 36
  8648. const m_R_NIOS2_GLOB_DAT = 37
  8649. const m_R_NIOS2_GNU_VTENTRY = 17
  8650. const m_R_NIOS2_GNU_VTINHERIT = 16
  8651. const m_R_NIOS2_GOT16 = 22
  8652. const m_R_NIOS2_GOTOFF = 40
  8653. const m_R_NIOS2_GOTOFF_HA = 25
  8654. const m_R_NIOS2_GOTOFF_LO = 24
  8655. const m_R_NIOS2_GOT_HA = 43
  8656. const m_R_NIOS2_GOT_LO = 42
  8657. const m_R_NIOS2_GPREL = 15
  8658. const m_R_NIOS2_HI16 = 9
  8659. const m_R_NIOS2_HIADJ16 = 11
  8660. const m_R_NIOS2_IMM5 = 5
  8661. const m_R_NIOS2_IMM6 = 7
  8662. const m_R_NIOS2_IMM8 = 8
  8663. const m_R_NIOS2_JUMP_SLOT = 38
  8664. const m_R_NIOS2_LO16 = 10
  8665. const m_R_NIOS2_NONE = 0
  8666. const m_R_NIOS2_PCREL16 = 3
  8667. const m_R_NIOS2_PCREL_HA = 27
  8668. const m_R_NIOS2_PCREL_LO = 26
  8669. const m_R_NIOS2_RELATIVE = 39
  8670. const m_R_NIOS2_S16 = 1
  8671. const m_R_NIOS2_TLS_DTPMOD = 33
  8672. const m_R_NIOS2_TLS_DTPREL = 34
  8673. const m_R_NIOS2_TLS_GD16 = 28
  8674. const m_R_NIOS2_TLS_IE16 = 31
  8675. const m_R_NIOS2_TLS_LDM16 = 29
  8676. const m_R_NIOS2_TLS_LDO16 = 30
  8677. const m_R_NIOS2_TLS_LE16 = 32
  8678. const m_R_NIOS2_TLS_TPREL = 35
  8679. const m_R_NIOS2_U16 = 2
  8680. const m_R_NIOS2_UJMP = 18
  8681. const m_R_OR1K_16 = 2
  8682. const m_R_OR1K_16_PCREL = 10
  8683. const m_R_OR1K_32 = 1
  8684. const m_R_OR1K_32_PCREL = 9
  8685. const m_R_OR1K_8 = 3
  8686. const m_R_OR1K_8_PCREL = 11
  8687. const m_R_OR1K_COPY = 18
  8688. const m_R_OR1K_GLOB_DAT = 19
  8689. const m_R_OR1K_GNU_VTENTRY = 7
  8690. const m_R_OR1K_GNU_VTINHERIT = 8
  8691. const m_R_OR1K_GOT16 = 14
  8692. const m_R_OR1K_GOTOFF_HI16 = 16
  8693. const m_R_OR1K_GOTOFF_LO16 = 17
  8694. const m_R_OR1K_GOTPC_HI16 = 12
  8695. const m_R_OR1K_GOTPC_LO16 = 13
  8696. const m_R_OR1K_HI_16_IN_INSN = 5
  8697. const m_R_OR1K_INSN_REL_26 = 6
  8698. const m_R_OR1K_JMP_SLOT = 20
  8699. const m_R_OR1K_LO_16_IN_INSN = 4
  8700. const m_R_OR1K_NONE = 0
  8701. const m_R_OR1K_PLT26 = 15
  8702. const m_R_OR1K_RELATIVE = 21
  8703. const m_R_OR1K_TLS_DTPMOD = 34
  8704. const m_R_OR1K_TLS_DTPOFF = 33
  8705. const m_R_OR1K_TLS_GD_HI16 = 22
  8706. const m_R_OR1K_TLS_GD_LO16 = 23
  8707. const m_R_OR1K_TLS_IE_HI16 = 28
  8708. const m_R_OR1K_TLS_IE_LO16 = 29
  8709. const m_R_OR1K_TLS_LDM_HI16 = 24
  8710. const m_R_OR1K_TLS_LDM_LO16 = 25
  8711. const m_R_OR1K_TLS_LDO_HI16 = 26
  8712. const m_R_OR1K_TLS_LDO_LO16 = 27
  8713. const m_R_OR1K_TLS_LE_HI16 = 30
  8714. const m_R_OR1K_TLS_LE_LO16 = 31
  8715. const m_R_OR1K_TLS_TPOFF = 32
  8716. const m_R_PARISC_COPY = 128
  8717. const m_R_PARISC_DIR14DR = 84
  8718. const m_R_PARISC_DIR14R = 6
  8719. const m_R_PARISC_DIR14WR = 83
  8720. const m_R_PARISC_DIR16DF = 87
  8721. const m_R_PARISC_DIR16F = 85
  8722. const m_R_PARISC_DIR16WF = 86
  8723. const m_R_PARISC_DIR17F = 4
  8724. const m_R_PARISC_DIR17R = 3
  8725. const m_R_PARISC_DIR21L = 2
  8726. const m_R_PARISC_DIR32 = 1
  8727. const m_R_PARISC_DIR64 = 80
  8728. const m_R_PARISC_DPREL14R = 22
  8729. const m_R_PARISC_DPREL21L = 18
  8730. const m_R_PARISC_EPLT = 130
  8731. const m_R_PARISC_FPTR64 = 64
  8732. const m_R_PARISC_GNU_VTENTRY = 232
  8733. const m_R_PARISC_GNU_VTINHERIT = 233
  8734. const m_R_PARISC_GPREL14DR = 92
  8735. const m_R_PARISC_GPREL14R = 30
  8736. const m_R_PARISC_GPREL14WR = 91
  8737. const m_R_PARISC_GPREL16DF = 95
  8738. const m_R_PARISC_GPREL16F = 93
  8739. const m_R_PARISC_GPREL16WF = 94
  8740. const m_R_PARISC_GPREL21L = 26
  8741. const m_R_PARISC_GPREL64 = 88
  8742. const m_R_PARISC_HIRESERVE = 255
  8743. const m_R_PARISC_IPLT = 129
  8744. const m_R_PARISC_LORESERVE = 128
  8745. const m_R_PARISC_LTOFF14DR = 100
  8746. const m_R_PARISC_LTOFF14R = 38
  8747. const m_R_PARISC_LTOFF14WR = 99
  8748. const m_R_PARISC_LTOFF16DF = 103
  8749. const m_R_PARISC_LTOFF16F = 101
  8750. const m_R_PARISC_LTOFF16WF = 102
  8751. const m_R_PARISC_LTOFF21L = 34
  8752. const m_R_PARISC_LTOFF64 = 96
  8753. const m_R_PARISC_LTOFF_FPTR14DR = 124
  8754. const m_R_PARISC_LTOFF_FPTR14R = 62
  8755. const m_R_PARISC_LTOFF_FPTR14WR = 123
  8756. const m_R_PARISC_LTOFF_FPTR16DF = 127
  8757. const m_R_PARISC_LTOFF_FPTR16F = 125
  8758. const m_R_PARISC_LTOFF_FPTR16WF = 126
  8759. const m_R_PARISC_LTOFF_FPTR21L = 58
  8760. const m_R_PARISC_LTOFF_FPTR32 = 57
  8761. const m_R_PARISC_LTOFF_FPTR64 = 120
  8762. const m_R_PARISC_LTOFF_TP14DR = 228
  8763. const m_R_PARISC_LTOFF_TP14F = 167
  8764. const m_R_PARISC_LTOFF_TP14R = 166
  8765. const m_R_PARISC_LTOFF_TP14WR = 227
  8766. const m_R_PARISC_LTOFF_TP16DF = 231
  8767. const m_R_PARISC_LTOFF_TP16F = 229
  8768. const m_R_PARISC_LTOFF_TP16WF = 230
  8769. const m_R_PARISC_LTOFF_TP21L = 162
  8770. const m_R_PARISC_LTOFF_TP64 = 224
  8771. const m_R_PARISC_NONE = 0
  8772. const m_R_PARISC_PCREL14DR = 76
  8773. const m_R_PARISC_PCREL14R = 14
  8774. const m_R_PARISC_PCREL14WR = 75
  8775. const m_R_PARISC_PCREL16DF = 79
  8776. const m_R_PARISC_PCREL16F = 77
  8777. const m_R_PARISC_PCREL16WF = 78
  8778. const m_R_PARISC_PCREL17F = 12
  8779. const m_R_PARISC_PCREL17R = 11
  8780. const m_R_PARISC_PCREL21L = 10
  8781. const m_R_PARISC_PCREL22F = 74
  8782. const m_R_PARISC_PCREL32 = 9
  8783. const m_R_PARISC_PCREL64 = 72
  8784. const m_R_PARISC_PLABEL14R = 70
  8785. const m_R_PARISC_PLABEL21L = 66
  8786. const m_R_PARISC_PLABEL32 = 65
  8787. const m_R_PARISC_PLTOFF14DR = 116
  8788. const m_R_PARISC_PLTOFF14R = 54
  8789. const m_R_PARISC_PLTOFF14WR = 115
  8790. const m_R_PARISC_PLTOFF16DF = 119
  8791. const m_R_PARISC_PLTOFF16F = 117
  8792. const m_R_PARISC_PLTOFF16WF = 118
  8793. const m_R_PARISC_PLTOFF21L = 50
  8794. const m_R_PARISC_SECREL32 = 41
  8795. const m_R_PARISC_SECREL64 = 104
  8796. const m_R_PARISC_SEGBASE = 48
  8797. const m_R_PARISC_SEGREL32 = 49
  8798. const m_R_PARISC_SEGREL64 = 112
  8799. const m_R_PARISC_TLS_DTPMOD32 = 242
  8800. const m_R_PARISC_TLS_DTPMOD64 = 243
  8801. const m_R_PARISC_TLS_DTPOFF32 = 244
  8802. const m_R_PARISC_TLS_DTPOFF64 = 245
  8803. const m_R_PARISC_TLS_GD14R = 235
  8804. const m_R_PARISC_TLS_GD21L = 234
  8805. const m_R_PARISC_TLS_GDCALL = 236
  8806. const m_R_PARISC_TLS_IE14R = "R_PARISC_LTOFF_TP14R"
  8807. const m_R_PARISC_TLS_IE21L = "R_PARISC_LTOFF_TP21L"
  8808. const m_R_PARISC_TLS_LDM14R = 238
  8809. const m_R_PARISC_TLS_LDM21L = 237
  8810. const m_R_PARISC_TLS_LDMCALL = 239
  8811. const m_R_PARISC_TLS_LDO14R = 241
  8812. const m_R_PARISC_TLS_LDO21L = 240
  8813. const m_R_PARISC_TLS_LE14R = "R_PARISC_TPREL14R"
  8814. const m_R_PARISC_TLS_LE21L = "R_PARISC_TPREL21L"
  8815. const m_R_PARISC_TLS_TPREL32 = "R_PARISC_TPREL32"
  8816. const m_R_PARISC_TLS_TPREL64 = "R_PARISC_TPREL64"
  8817. const m_R_PARISC_TPREL14DR = 220
  8818. const m_R_PARISC_TPREL14R = 158
  8819. const m_R_PARISC_TPREL14WR = 219
  8820. const m_R_PARISC_TPREL16DF = 223
  8821. const m_R_PARISC_TPREL16F = 221
  8822. const m_R_PARISC_TPREL16WF = 222
  8823. const m_R_PARISC_TPREL21L = 154
  8824. const m_R_PARISC_TPREL32 = 153
  8825. const m_R_PARISC_TPREL64 = 216
  8826. const m_R_PPC64_ADDR14 = "R_PPC_ADDR14"
  8827. const m_R_PPC64_ADDR14_BRNTAKEN = "R_PPC_ADDR14_BRNTAKEN"
  8828. const m_R_PPC64_ADDR14_BRTAKEN = "R_PPC_ADDR14_BRTAKEN"
  8829. const m_R_PPC64_ADDR16 = "R_PPC_ADDR16"
  8830. const m_R_PPC64_ADDR16_DS = 56
  8831. const m_R_PPC64_ADDR16_HA = "R_PPC_ADDR16_HA"
  8832. const m_R_PPC64_ADDR16_HI = "R_PPC_ADDR16_HI"
  8833. const m_R_PPC64_ADDR16_HIGH = 110
  8834. const m_R_PPC64_ADDR16_HIGHA = 111
  8835. const m_R_PPC64_ADDR16_HIGHER = 39
  8836. const m_R_PPC64_ADDR16_HIGHERA = 40
  8837. const m_R_PPC64_ADDR16_HIGHEST = 41
  8838. const m_R_PPC64_ADDR16_HIGHESTA = 42
  8839. const m_R_PPC64_ADDR16_LO = "R_PPC_ADDR16_LO"
  8840. const m_R_PPC64_ADDR16_LO_DS = 57
  8841. const m_R_PPC64_ADDR24 = "R_PPC_ADDR24"
  8842. const m_R_PPC64_ADDR30 = 37
  8843. const m_R_PPC64_ADDR32 = "R_PPC_ADDR32"
  8844. const m_R_PPC64_ADDR64 = 38
  8845. const m_R_PPC64_COPY = "R_PPC_COPY"
  8846. const m_R_PPC64_DTPMOD64 = 68
  8847. const m_R_PPC64_DTPREL16 = 74
  8848. const m_R_PPC64_DTPREL16_DS = 101
  8849. const m_R_PPC64_DTPREL16_HA = 77
  8850. const m_R_PPC64_DTPREL16_HI = 76
  8851. const m_R_PPC64_DTPREL16_HIGH = 114
  8852. const m_R_PPC64_DTPREL16_HIGHA = 115
  8853. const m_R_PPC64_DTPREL16_HIGHER = 103
  8854. const m_R_PPC64_DTPREL16_HIGHERA = 104
  8855. const m_R_PPC64_DTPREL16_HIGHEST = 105
  8856. const m_R_PPC64_DTPREL16_HIGHESTA = 106
  8857. const m_R_PPC64_DTPREL16_LO = 75
  8858. const m_R_PPC64_DTPREL16_LO_DS = 102
  8859. const m_R_PPC64_DTPREL64 = 78
  8860. const m_R_PPC64_GLOB_DAT = "R_PPC_GLOB_DAT"
  8861. const m_R_PPC64_GOT16 = "R_PPC_GOT16"
  8862. const m_R_PPC64_GOT16_DS = 58
  8863. const m_R_PPC64_GOT16_HA = "R_PPC_GOT16_HA"
  8864. const m_R_PPC64_GOT16_HI = "R_PPC_GOT16_HI"
  8865. const m_R_PPC64_GOT16_LO = "R_PPC_GOT16_LO"
  8866. const m_R_PPC64_GOT16_LO_DS = 59
  8867. const m_R_PPC64_GOT_DTPREL16_DS = 91
  8868. const m_R_PPC64_GOT_DTPREL16_HA = 94
  8869. const m_R_PPC64_GOT_DTPREL16_HI = 93
  8870. const m_R_PPC64_GOT_DTPREL16_LO_DS = 92
  8871. const m_R_PPC64_GOT_TLSGD16 = 79
  8872. const m_R_PPC64_GOT_TLSGD16_HA = 82
  8873. const m_R_PPC64_GOT_TLSGD16_HI = 81
  8874. const m_R_PPC64_GOT_TLSGD16_LO = 80
  8875. const m_R_PPC64_GOT_TLSLD16 = 83
  8876. const m_R_PPC64_GOT_TLSLD16_HA = 86
  8877. const m_R_PPC64_GOT_TLSLD16_HI = 85
  8878. const m_R_PPC64_GOT_TLSLD16_LO = 84
  8879. const m_R_PPC64_GOT_TPREL16_DS = 87
  8880. const m_R_PPC64_GOT_TPREL16_HA = 90
  8881. const m_R_PPC64_GOT_TPREL16_HI = 89
  8882. const m_R_PPC64_GOT_TPREL16_LO_DS = 88
  8883. const m_R_PPC64_IRELATIVE = 248
  8884. const m_R_PPC64_JMP_IREL = 247
  8885. const m_R_PPC64_JMP_SLOT = "R_PPC_JMP_SLOT"
  8886. const m_R_PPC64_NONE = "R_PPC_NONE"
  8887. const m_R_PPC64_PLT16_HA = "R_PPC_PLT16_HA"
  8888. const m_R_PPC64_PLT16_HI = "R_PPC_PLT16_HI"
  8889. const m_R_PPC64_PLT16_LO = "R_PPC_PLT16_LO"
  8890. const m_R_PPC64_PLT16_LO_DS = 60
  8891. const m_R_PPC64_PLT32 = "R_PPC_PLT32"
  8892. const m_R_PPC64_PLT64 = 45
  8893. const m_R_PPC64_PLTGOT16 = 52
  8894. const m_R_PPC64_PLTGOT16_DS = 65
  8895. const m_R_PPC64_PLTGOT16_HA = 55
  8896. const m_R_PPC64_PLTGOT16_HI = 54
  8897. const m_R_PPC64_PLTGOT16_LO = 53
  8898. const m_R_PPC64_PLTGOT16_LO_DS = 66
  8899. const m_R_PPC64_PLTREL32 = "R_PPC_PLTREL32"
  8900. const m_R_PPC64_PLTREL64 = 46
  8901. const m_R_PPC64_REL14 = "R_PPC_REL14"
  8902. const m_R_PPC64_REL14_BRNTAKEN = "R_PPC_REL14_BRNTAKEN"
  8903. const m_R_PPC64_REL14_BRTAKEN = "R_PPC_REL14_BRTAKEN"
  8904. const m_R_PPC64_REL16 = 249
  8905. const m_R_PPC64_REL16_HA = 252
  8906. const m_R_PPC64_REL16_HI = 251
  8907. const m_R_PPC64_REL16_LO = 250
  8908. const m_R_PPC64_REL24 = "R_PPC_REL24"
  8909. const m_R_PPC64_REL32 = "R_PPC_REL32"
  8910. const m_R_PPC64_REL64 = 44
  8911. const m_R_PPC64_RELATIVE = "R_PPC_RELATIVE"
  8912. const m_R_PPC64_SECTOFF = "R_PPC_SECTOFF"
  8913. const m_R_PPC64_SECTOFF_DS = 61
  8914. const m_R_PPC64_SECTOFF_HA = "R_PPC_SECTOFF_HA"
  8915. const m_R_PPC64_SECTOFF_HI = "R_PPC_SECTOFF_HI"
  8916. const m_R_PPC64_SECTOFF_LO = "R_PPC_SECTOFF_LO"
  8917. const m_R_PPC64_SECTOFF_LO_DS = 62
  8918. const m_R_PPC64_TLS = 67
  8919. const m_R_PPC64_TLSGD = 107
  8920. const m_R_PPC64_TLSLD = 108
  8921. const m_R_PPC64_TOC = 51
  8922. const m_R_PPC64_TOC16 = 47
  8923. const m_R_PPC64_TOC16_DS = 63
  8924. const m_R_PPC64_TOC16_HA = 50
  8925. const m_R_PPC64_TOC16_HI = 49
  8926. const m_R_PPC64_TOC16_LO = 48
  8927. const m_R_PPC64_TOC16_LO_DS = 64
  8928. const m_R_PPC64_TOCSAVE = 109
  8929. const m_R_PPC64_TPREL16 = 69
  8930. const m_R_PPC64_TPREL16_DS = 95
  8931. const m_R_PPC64_TPREL16_HA = 72
  8932. const m_R_PPC64_TPREL16_HI = 71
  8933. const m_R_PPC64_TPREL16_HIGH = 112
  8934. const m_R_PPC64_TPREL16_HIGHA = 113
  8935. const m_R_PPC64_TPREL16_HIGHER = 97
  8936. const m_R_PPC64_TPREL16_HIGHERA = 98
  8937. const m_R_PPC64_TPREL16_HIGHEST = 99
  8938. const m_R_PPC64_TPREL16_HIGHESTA = 100
  8939. const m_R_PPC64_TPREL16_LO = 70
  8940. const m_R_PPC64_TPREL16_LO_DS = 96
  8941. const m_R_PPC64_TPREL64 = 73
  8942. const m_R_PPC64_UADDR16 = "R_PPC_UADDR16"
  8943. const m_R_PPC64_UADDR32 = "R_PPC_UADDR32"
  8944. const m_R_PPC64_UADDR64 = 43
  8945. const m_R_PPC_ADDR14 = 7
  8946. const m_R_PPC_ADDR14_BRNTAKEN = 9
  8947. const m_R_PPC_ADDR14_BRTAKEN = 8
  8948. const m_R_PPC_ADDR16 = 3
  8949. const m_R_PPC_ADDR16_HA = 6
  8950. const m_R_PPC_ADDR16_HI = 5
  8951. const m_R_PPC_ADDR16_LO = 4
  8952. const m_R_PPC_ADDR24 = 2
  8953. const m_R_PPC_ADDR32 = 1
  8954. const m_R_PPC_COPY = 19
  8955. const m_R_PPC_DIAB_RELSDA_HA = 185
  8956. const m_R_PPC_DIAB_RELSDA_HI = 184
  8957. const m_R_PPC_DIAB_RELSDA_LO = 183
  8958. const m_R_PPC_DIAB_SDA21_HA = 182
  8959. const m_R_PPC_DIAB_SDA21_HI = 181
  8960. const m_R_PPC_DIAB_SDA21_LO = 180
  8961. const m_R_PPC_DTPMOD32 = 68
  8962. const m_R_PPC_DTPREL16 = 74
  8963. const m_R_PPC_DTPREL16_HA = 77
  8964. const m_R_PPC_DTPREL16_HI = 76
  8965. const m_R_PPC_DTPREL16_LO = 75
  8966. const m_R_PPC_DTPREL32 = 78
  8967. const m_R_PPC_EMB_BIT_FLD = 115
  8968. const m_R_PPC_EMB_MRKREF = 110
  8969. const m_R_PPC_EMB_NADDR16 = 102
  8970. const m_R_PPC_EMB_NADDR16_HA = 105
  8971. const m_R_PPC_EMB_NADDR16_HI = 104
  8972. const m_R_PPC_EMB_NADDR16_LO = 103
  8973. const m_R_PPC_EMB_NADDR32 = 101
  8974. const m_R_PPC_EMB_RELSDA = 116
  8975. const m_R_PPC_EMB_RELSEC16 = 111
  8976. const m_R_PPC_EMB_RELST_HA = 114
  8977. const m_R_PPC_EMB_RELST_HI = 113
  8978. const m_R_PPC_EMB_RELST_LO = 112
  8979. const m_R_PPC_EMB_SDA21 = 109
  8980. const m_R_PPC_EMB_SDA2I16 = 107
  8981. const m_R_PPC_EMB_SDA2REL = 108
  8982. const m_R_PPC_EMB_SDAI16 = 106
  8983. const m_R_PPC_GLOB_DAT = 20
  8984. const m_R_PPC_GOT16 = 14
  8985. const m_R_PPC_GOT16_HA = 17
  8986. const m_R_PPC_GOT16_HI = 16
  8987. const m_R_PPC_GOT16_LO = 15
  8988. const m_R_PPC_GOT_DTPREL16 = 91
  8989. const m_R_PPC_GOT_DTPREL16_HA = 94
  8990. const m_R_PPC_GOT_DTPREL16_HI = 93
  8991. const m_R_PPC_GOT_DTPREL16_LO = 92
  8992. const m_R_PPC_GOT_TLSGD16 = 79
  8993. const m_R_PPC_GOT_TLSGD16_HA = 82
  8994. const m_R_PPC_GOT_TLSGD16_HI = 81
  8995. const m_R_PPC_GOT_TLSGD16_LO = 80
  8996. const m_R_PPC_GOT_TLSLD16 = 83
  8997. const m_R_PPC_GOT_TLSLD16_HA = 86
  8998. const m_R_PPC_GOT_TLSLD16_HI = 85
  8999. const m_R_PPC_GOT_TLSLD16_LO = 84
  9000. const m_R_PPC_GOT_TPREL16 = 87
  9001. const m_R_PPC_GOT_TPREL16_HA = 90
  9002. const m_R_PPC_GOT_TPREL16_HI = 89
  9003. const m_R_PPC_GOT_TPREL16_LO = 88
  9004. const m_R_PPC_IRELATIVE = 248
  9005. const m_R_PPC_JMP_SLOT = 21
  9006. const m_R_PPC_LOCAL24PC = 23
  9007. const m_R_PPC_NONE = 0
  9008. const m_R_PPC_PLT16_HA = 31
  9009. const m_R_PPC_PLT16_HI = 30
  9010. const m_R_PPC_PLT16_LO = 29
  9011. const m_R_PPC_PLT32 = 27
  9012. const m_R_PPC_PLTREL24 = 18
  9013. const m_R_PPC_PLTREL32 = 28
  9014. const m_R_PPC_REL14 = 11
  9015. const m_R_PPC_REL14_BRNTAKEN = 13
  9016. const m_R_PPC_REL14_BRTAKEN = 12
  9017. const m_R_PPC_REL16 = 249
  9018. const m_R_PPC_REL16_HA = 252
  9019. const m_R_PPC_REL16_HI = 251
  9020. const m_R_PPC_REL16_LO = 250
  9021. const m_R_PPC_REL24 = 10
  9022. const m_R_PPC_REL32 = 26
  9023. const m_R_PPC_RELATIVE = 22
  9024. const m_R_PPC_SDAREL16 = 32
  9025. const m_R_PPC_SECTOFF = 33
  9026. const m_R_PPC_SECTOFF_HA = 36
  9027. const m_R_PPC_SECTOFF_HI = 35
  9028. const m_R_PPC_SECTOFF_LO = 34
  9029. const m_R_PPC_TLS = 67
  9030. const m_R_PPC_TLSGD = 95
  9031. const m_R_PPC_TLSLD = 96
  9032. const m_R_PPC_TOC16 = 255
  9033. const m_R_PPC_TPREL16 = 69
  9034. const m_R_PPC_TPREL16_HA = 72
  9035. const m_R_PPC_TPREL16_HI = 71
  9036. const m_R_PPC_TPREL16_LO = 70
  9037. const m_R_PPC_TPREL32 = 73
  9038. const m_R_PPC_UADDR16 = 25
  9039. const m_R_PPC_UADDR32 = 24
  9040. const m_R_RISCV_32 = 1
  9041. const m_R_RISCV_32_PCREL = 57
  9042. const m_R_RISCV_64 = 2
  9043. const m_R_RISCV_ADD16 = 34
  9044. const m_R_RISCV_ADD32 = 35
  9045. const m_R_RISCV_ADD64 = 36
  9046. const m_R_RISCV_ADD8 = 33
  9047. const m_R_RISCV_ALIGN = 43
  9048. const m_R_RISCV_BRANCH = 16
  9049. const m_R_RISCV_CALL = 18
  9050. const m_R_RISCV_CALL_PLT = 19
  9051. const m_R_RISCV_COPY = 4
  9052. const m_R_RISCV_GOT32_PCREL = 41
  9053. const m_R_RISCV_GOT_HI20 = 20
  9054. const m_R_RISCV_HI20 = 26
  9055. const m_R_RISCV_IRELATIVE = 58
  9056. const m_R_RISCV_JAL = 17
  9057. const m_R_RISCV_JUMP_SLOT = 5
  9058. const m_R_RISCV_LO12_I = 27
  9059. const m_R_RISCV_LO12_S = 28
  9060. const m_R_RISCV_NONE = 0
  9061. const m_R_RISCV_PCREL_HI20 = 23
  9062. const m_R_RISCV_PCREL_LO12_I = 24
  9063. const m_R_RISCV_PCREL_LO12_S = 25
  9064. const m_R_RISCV_PLT32 = 59
  9065. const m_R_RISCV_RELATIVE = 3
  9066. const m_R_RISCV_RELAX = 51
  9067. const m_R_RISCV_RVC_BRANCH = 44
  9068. const m_R_RISCV_RVC_JUMP = 45
  9069. const m_R_RISCV_RVC_LUI = 46
  9070. const m_R_RISCV_SET16 = 55
  9071. const m_R_RISCV_SET32 = 56
  9072. const m_R_RISCV_SET6 = 53
  9073. const m_R_RISCV_SET8 = 54
  9074. const m_R_RISCV_SET_ULEB128 = 60
  9075. const m_R_RISCV_SUB16 = 38
  9076. const m_R_RISCV_SUB32 = 39
  9077. const m_R_RISCV_SUB6 = 52
  9078. const m_R_RISCV_SUB64 = 40
  9079. const m_R_RISCV_SUB8 = 37
  9080. const m_R_RISCV_SUB_ULEB128 = 61
  9081. const m_R_RISCV_TLSDESC = 12
  9082. const m_R_RISCV_TLSDESC_ADD_LO12 = 64
  9083. const m_R_RISCV_TLSDESC_CALL = 65
  9084. const m_R_RISCV_TLSDESC_HI20 = 62
  9085. const m_R_RISCV_TLSDESC_LOAD_LO12 = 63
  9086. const m_R_RISCV_TLS_DTPMOD32 = 6
  9087. const m_R_RISCV_TLS_DTPMOD64 = 7
  9088. const m_R_RISCV_TLS_DTPREL32 = 8
  9089. const m_R_RISCV_TLS_DTPREL64 = 9
  9090. const m_R_RISCV_TLS_GD_HI20 = 22
  9091. const m_R_RISCV_TLS_GOT_HI20 = 21
  9092. const m_R_RISCV_TLS_TPREL32 = 10
  9093. const m_R_RISCV_TLS_TPREL64 = 11
  9094. const m_R_RISCV_TPREL_ADD = 32
  9095. const m_R_RISCV_TPREL_HI20 = 29
  9096. const m_R_RISCV_TPREL_LO12_I = 30
  9097. const m_R_RISCV_TPREL_LO12_S = 31
  9098. const m_R_SH_ALIGN = 29
  9099. const m_R_SH_CODE = 30
  9100. const m_R_SH_COPY = 162
  9101. const m_R_SH_COUNT = 28
  9102. const m_R_SH_DATA = 31
  9103. const m_R_SH_DIR32 = 1
  9104. const m_R_SH_DIR8BP = 7
  9105. const m_R_SH_DIR8L = 9
  9106. const m_R_SH_DIR8W = 8
  9107. const m_R_SH_DIR8WPL = 5
  9108. const m_R_SH_DIR8WPN = 3
  9109. const m_R_SH_DIR8WPZ = 6
  9110. const m_R_SH_FUNCDESC = 207
  9111. const m_R_SH_FUNCDESC_VALUE = 208
  9112. const m_R_SH_GLOB_DAT = 163
  9113. const m_R_SH_GNU_VTENTRY = 35
  9114. const m_R_SH_GNU_VTINHERIT = 34
  9115. const m_R_SH_GOT20 = 201
  9116. const m_R_SH_GOT32 = 160
  9117. const m_R_SH_GOTFUNCDESC = 203
  9118. const m_R_SH_GOTFUNCDEST20 = 204
  9119. const m_R_SH_GOTOFF = 166
  9120. const m_R_SH_GOTOFF20 = 202
  9121. const m_R_SH_GOTOFFFUNCDESC = 205
  9122. const m_R_SH_GOTOFFFUNCDEST20 = 206
  9123. const m_R_SH_GOTPC = 167
  9124. const m_R_SH_IND12W = 4
  9125. const m_R_SH_JMP_SLOT = 164
  9126. const m_R_SH_LABEL = 32
  9127. const m_R_SH_NONE = 0
  9128. const m_R_SH_NUM = 256
  9129. const m_R_SH_PLT32 = 161
  9130. const m_R_SH_REL32 = 2
  9131. const m_R_SH_RELATIVE = 165
  9132. const m_R_SH_SWITCH16 = 25
  9133. const m_R_SH_SWITCH32 = 26
  9134. const m_R_SH_SWITCH8 = 33
  9135. const m_R_SH_TLS_DTPMOD32 = 149
  9136. const m_R_SH_TLS_DTPOFF32 = 150
  9137. const m_R_SH_TLS_GD_32 = 144
  9138. const m_R_SH_TLS_IE_32 = 147
  9139. const m_R_SH_TLS_LDO_32 = 146
  9140. const m_R_SH_TLS_LD_32 = 145
  9141. const m_R_SH_TLS_LE_32 = 148
  9142. const m_R_SH_TLS_TPOFF32 = 151
  9143. const m_R_SH_USES = 27
  9144. const m_R_SPARC_10 = 30
  9145. const m_R_SPARC_11 = 31
  9146. const m_R_SPARC_13 = 11
  9147. const m_R_SPARC_16 = 2
  9148. const m_R_SPARC_22 = 10
  9149. const m_R_SPARC_32 = 3
  9150. const m_R_SPARC_5 = 44
  9151. const m_R_SPARC_6 = 45
  9152. const m_R_SPARC_64 = 32
  9153. const m_R_SPARC_7 = 43
  9154. const m_R_SPARC_8 = 1
  9155. const m_R_SPARC_COPY = 19
  9156. const m_R_SPARC_DISP16 = 5
  9157. const m_R_SPARC_DISP32 = 6
  9158. const m_R_SPARC_DISP64 = 46
  9159. const m_R_SPARC_DISP8 = 4
  9160. const m_R_SPARC_GLOB_DAT = 20
  9161. const m_R_SPARC_GLOB_JMP = 42
  9162. const m_R_SPARC_GNU_VTENTRY = 251
  9163. const m_R_SPARC_GNU_VTINHERIT = 250
  9164. const m_R_SPARC_GOT10 = 13
  9165. const m_R_SPARC_GOT13 = 14
  9166. const m_R_SPARC_GOT22 = 15
  9167. const m_R_SPARC_GOTDATA_HIX22 = 80
  9168. const m_R_SPARC_GOTDATA_LOX10 = 81
  9169. const m_R_SPARC_GOTDATA_OP = 84
  9170. const m_R_SPARC_GOTDATA_OP_HIX22 = 82
  9171. const m_R_SPARC_GOTDATA_OP_LOX10 = 83
  9172. const m_R_SPARC_H34 = 85
  9173. const m_R_SPARC_H44 = 50
  9174. const m_R_SPARC_HH22 = 34
  9175. const m_R_SPARC_HI22 = 9
  9176. const m_R_SPARC_HIPLT22 = 25
  9177. const m_R_SPARC_HIX22 = 48
  9178. const m_R_SPARC_HM10 = 35
  9179. const m_R_SPARC_JMP_SLOT = 21
  9180. const m_R_SPARC_L44 = 52
  9181. const m_R_SPARC_LM22 = 36
  9182. const m_R_SPARC_LO10 = 12
  9183. const m_R_SPARC_LOPLT10 = 26
  9184. const m_R_SPARC_LOX10 = 49
  9185. const m_R_SPARC_M44 = 51
  9186. const m_R_SPARC_NONE = 0
  9187. const m_R_SPARC_NUM = 253
  9188. const m_R_SPARC_OLO10 = 33
  9189. const m_R_SPARC_PC10 = 16
  9190. const m_R_SPARC_PC22 = 17
  9191. const m_R_SPARC_PCPLT10 = 29
  9192. const m_R_SPARC_PCPLT22 = 28
  9193. const m_R_SPARC_PCPLT32 = 27
  9194. const m_R_SPARC_PC_HH22 = 37
  9195. const m_R_SPARC_PC_HM10 = 38
  9196. const m_R_SPARC_PC_LM22 = 39
  9197. const m_R_SPARC_PLT32 = 24
  9198. const m_R_SPARC_PLT64 = 47
  9199. const m_R_SPARC_REGISTER = 53
  9200. const m_R_SPARC_RELATIVE = 22
  9201. const m_R_SPARC_REV32 = 252
  9202. const m_R_SPARC_SIZE32 = 86
  9203. const m_R_SPARC_SIZE64 = 87
  9204. const m_R_SPARC_TLS_DTPMOD32 = 74
  9205. const m_R_SPARC_TLS_DTPMOD64 = 75
  9206. const m_R_SPARC_TLS_DTPOFF32 = 76
  9207. const m_R_SPARC_TLS_DTPOFF64 = 77
  9208. const m_R_SPARC_TLS_GD_ADD = 58
  9209. const m_R_SPARC_TLS_GD_CALL = 59
  9210. const m_R_SPARC_TLS_GD_HI22 = 56
  9211. const m_R_SPARC_TLS_GD_LO10 = 57
  9212. const m_R_SPARC_TLS_IE_ADD = 71
  9213. const m_R_SPARC_TLS_IE_HI22 = 67
  9214. const m_R_SPARC_TLS_IE_LD = 69
  9215. const m_R_SPARC_TLS_IE_LDX = 70
  9216. const m_R_SPARC_TLS_IE_LO10 = 68
  9217. const m_R_SPARC_TLS_LDM_ADD = 62
  9218. const m_R_SPARC_TLS_LDM_CALL = 63
  9219. const m_R_SPARC_TLS_LDM_HI22 = 60
  9220. const m_R_SPARC_TLS_LDM_LO10 = 61
  9221. const m_R_SPARC_TLS_LDO_ADD = 66
  9222. const m_R_SPARC_TLS_LDO_HIX22 = 64
  9223. const m_R_SPARC_TLS_LDO_LOX10 = 65
  9224. const m_R_SPARC_TLS_LE_HIX22 = 72
  9225. const m_R_SPARC_TLS_LE_LOX10 = 73
  9226. const m_R_SPARC_TLS_TPOFF32 = 78
  9227. const m_R_SPARC_TLS_TPOFF64 = 79
  9228. const m_R_SPARC_UA16 = 55
  9229. const m_R_SPARC_UA32 = 23
  9230. const m_R_SPARC_UA64 = 54
  9231. const m_R_SPARC_WDISP16 = 40
  9232. const m_R_SPARC_WDISP19 = 41
  9233. const m_R_SPARC_WDISP22 = 8
  9234. const m_R_SPARC_WDISP30 = 7
  9235. const m_R_SPARC_WPLT30 = 18
  9236. const m_R_X86_64_16 = 12
  9237. const m_R_X86_64_32 = 10
  9238. const m_R_X86_64_32S = 11
  9239. const m_R_X86_64_64 = 1
  9240. const m_R_X86_64_8 = 14
  9241. const m_R_X86_64_COPY = 5
  9242. const m_R_X86_64_DTPMOD64 = 16
  9243. const m_R_X86_64_DTPOFF32 = 21
  9244. const m_R_X86_64_DTPOFF64 = 17
  9245. const m_R_X86_64_GLOB_DAT = 6
  9246. const m_R_X86_64_GOT32 = 3
  9247. const m_R_X86_64_GOT64 = 27
  9248. const m_R_X86_64_GOTOFF64 = 25
  9249. const m_R_X86_64_GOTPC32 = 26
  9250. const m_R_X86_64_GOTPC32_TLSDESC = 34
  9251. const m_R_X86_64_GOTPC64 = 29
  9252. const m_R_X86_64_GOTPCREL = 9
  9253. const m_R_X86_64_GOTPCREL64 = 28
  9254. const m_R_X86_64_GOTPCRELX = 41
  9255. const m_R_X86_64_GOTPLT64 = 30
  9256. const m_R_X86_64_GOTTPOFF = 22
  9257. const m_R_X86_64_IRELATIVE = 37
  9258. const m_R_X86_64_JUMP_SLOT = 7
  9259. const m_R_X86_64_NONE = 0
  9260. const m_R_X86_64_NUM = 43
  9261. const m_R_X86_64_PC16 = 13
  9262. const m_R_X86_64_PC32 = 2
  9263. const m_R_X86_64_PC64 = 24
  9264. const m_R_X86_64_PC8 = 15
  9265. const m_R_X86_64_PLT32 = 4
  9266. const m_R_X86_64_PLTOFF64 = 31
  9267. const m_R_X86_64_RELATIVE = 8
  9268. const m_R_X86_64_RELATIVE64 = 38
  9269. const m_R_X86_64_REX_GOTPCRELX = 42
  9270. const m_R_X86_64_SIZE32 = 32
  9271. const m_R_X86_64_SIZE64 = 33
  9272. const m_R_X86_64_TLSDESC = 36
  9273. const m_R_X86_64_TLSDESC_CALL = 35
  9274. const m_R_X86_64_TLSGD = 19
  9275. const m_R_X86_64_TLSLD = 20
  9276. const m_R_X86_64_TPOFF32 = 23
  9277. const m_R_X86_64_TPOFF64 = 18
  9278. const m_SELFMAG = 4
  9279. const m_SHF_ALPHA_GPREL = 0x10000000
  9280. const m_SHF_ARM_COMDEF = 0x80000000
  9281. const m_SHF_ARM_ENTRYSECT = 0x10000000
  9282. const m_SHF_IA_64_NORECOV = 0x20000000
  9283. const m_SHF_IA_64_SHORT = 0x10000000
  9284. const m_SHF_MASKOS = 0x0ff00000
  9285. const m_SHF_MASKPROC = 0xf0000000
  9286. const m_SHF_MIPS_ADDR = 0x40000000
  9287. const m_SHF_MIPS_GPREL = 0x10000000
  9288. const m_SHF_MIPS_LOCAL = 0x04000000
  9289. const m_SHF_MIPS_MERGE = 0x20000000
  9290. const m_SHF_MIPS_NAMES = 0x02000000
  9291. const m_SHF_MIPS_NODUPE = 0x01000000
  9292. const m_SHF_MIPS_NOSTRIP = 0x08000000
  9293. const m_SHF_MIPS_STRINGS = 0x80000000
  9294. const m_SHF_PARISC_HUGE = 0x40000000
  9295. const m_SHF_PARISC_SBP = 0x80000000
  9296. const m_SHF_PARISC_SHORT = 0x20000000
  9297. const m_SHN_ABS = 65521
  9298. const m_SHN_AFTER = 0xff01
  9299. const m_SHN_BEFORE = 0xff00
  9300. const m_SHN_COMMON = 65522
  9301. const m_SHN_HIOS = 0xff3f
  9302. const m_SHN_HIPROC = 0xff1f
  9303. const m_SHN_HIRESERVE = 0xffff
  9304. const m_SHN_LOOS = 0xff20
  9305. const m_SHN_LOPROC = 0xff00
  9306. const m_SHN_LORESERVE = 0xff00
  9307. const m_SHN_MIPS_ACOMMON = 0xff00
  9308. const m_SHN_MIPS_DATA = 0xff02
  9309. const m_SHN_MIPS_SCOMMON = 0xff03
  9310. const m_SHN_MIPS_SUNDEFINED = 0xff04
  9311. const m_SHN_MIPS_TEXT = 0xff01
  9312. const m_SHN_PARISC_ANSI_COMMON = 0xff00
  9313. const m_SHN_PARISC_HUGE_COMMON = 0xff01
  9314. const m_SHN_UNDEF = 0
  9315. const m_SHN_XINDEX = 0xffff
  9316. const m_SHT_ALPHA_DEBUG = 0x70000001
  9317. const m_SHT_ALPHA_REGINFO = 0x70000002
  9318. const m_SHT_CHECKSUM = 0x6ffffff8
  9319. const m_SHT_DYNAMIC = 6
  9320. const m_SHT_DYNSYM = 11
  9321. const m_SHT_FINI_ARRAY = 15
  9322. const m_SHT_GNU_ATTRIBUTES = 0x6ffffff5
  9323. const m_SHT_GNU_HASH = 0x6ffffff6
  9324. const m_SHT_GNU_LIBLIST = 0x6ffffff7
  9325. const m_SHT_GNU_verdef = 0x6ffffffd
  9326. const m_SHT_GNU_verneed = 0x6ffffffe
  9327. const m_SHT_GNU_versym = 0x6fffffff
  9328. const m_SHT_GROUP = 17
  9329. const m_SHT_HASH = 5
  9330. const m_SHT_HIOS = 0x6fffffff
  9331. const m_SHT_HIPROC = 0x7fffffff
  9332. const m_SHT_HISUNW = 0x6fffffff
  9333. const m_SHT_HIUSER = 0x8fffffff
  9334. const m_SHT_INIT_ARRAY = 14
  9335. const m_SHT_LOOS = 0x60000000
  9336. const m_SHT_LOPROC = 0x70000000
  9337. const m_SHT_LOSUNW = 0x6ffffffa
  9338. const m_SHT_LOUSER = 0x80000000
  9339. const m_SHT_MIPS_AUXSYM = 0x70000016
  9340. const m_SHT_MIPS_CONFLICT = 0x70000002
  9341. const m_SHT_MIPS_CONTENT = 0x7000000c
  9342. const m_SHT_MIPS_DEBUG = 0x70000005
  9343. const m_SHT_MIPS_DELTACLASS = 0x7000001d
  9344. const m_SHT_MIPS_DELTADECL = 0x7000001f
  9345. const m_SHT_MIPS_DELTAINST = 0x7000001c
  9346. const m_SHT_MIPS_DELTASYM = 0x7000001b
  9347. const m_SHT_MIPS_DENSE = 0x70000013
  9348. const m_SHT_MIPS_DWARF = 0x7000001e
  9349. const m_SHT_MIPS_EH_REGION = 0x70000027
  9350. const m_SHT_MIPS_EVENTS = 0x70000021
  9351. const m_SHT_MIPS_EXTSYM = 0x70000012
  9352. const m_SHT_MIPS_FDESC = 0x70000011
  9353. const m_SHT_MIPS_GPTAB = 0x70000003
  9354. const m_SHT_MIPS_IFACE = 0x7000000b
  9355. const m_SHT_MIPS_LIBLIST = 0x70000000
  9356. const m_SHT_MIPS_LINE = 0x70000019
  9357. const m_SHT_MIPS_LOCSTR = 0x70000018
  9358. const m_SHT_MIPS_LOCSYM = 0x70000015
  9359. const m_SHT_MIPS_MSYM = 0x70000001
  9360. const m_SHT_MIPS_OPTIONS = 0x7000000d
  9361. const m_SHT_MIPS_OPTSYM = 0x70000017
  9362. const m_SHT_MIPS_PACKAGE = 0x70000007
  9363. const m_SHT_MIPS_PACKSYM = 0x70000008
  9364. const m_SHT_MIPS_PDESC = 0x70000014
  9365. const m_SHT_MIPS_PDR_EXCEPTION = 0x70000029
  9366. const m_SHT_MIPS_PIXIE = 0x70000023
  9367. const m_SHT_MIPS_REGINFO = 0x70000006
  9368. const m_SHT_MIPS_RELD = 0x70000009
  9369. const m_SHT_MIPS_RFDESC = 0x7000001a
  9370. const m_SHT_MIPS_SHDR = 0x70000010
  9371. const m_SHT_MIPS_SYMBOL_LIB = 0x70000020
  9372. const m_SHT_MIPS_TRANSLATE = 0x70000022
  9373. const m_SHT_MIPS_UCODE = 0x70000004
  9374. const m_SHT_MIPS_WHIRL = 0x70000026
  9375. const m_SHT_MIPS_XLATE = 0x70000024
  9376. const m_SHT_MIPS_XLATE_DEBUG = 0x70000025
  9377. const m_SHT_MIPS_XLATE_OLD = 0x70000028
  9378. const m_SHT_NOBITS = 8
  9379. const m_SHT_NOTE = 7
  9380. const m_SHT_NULL = 0
  9381. const m_SHT_NUM = 20
  9382. const m_SHT_PARISC_DOC = 0x70000002
  9383. const m_SHT_PARISC_EXT = 0x70000000
  9384. const m_SHT_PARISC_UNWIND = 0x70000001
  9385. const m_SHT_PREINIT_ARRAY = 16
  9386. const m_SHT_PROGBITS = 1
  9387. const m_SHT_REL = 9
  9388. const m_SHT_RELA = 4
  9389. const m_SHT_RELR = 19
  9390. const m_SHT_SHLIB = 10
  9391. const m_SHT_STRTAB = 3
  9392. const m_SHT_SUNW_COMDAT = 0x6ffffffb
  9393. const m_SHT_SUNW_move = 0x6ffffffa
  9394. const m_SHT_SUNW_syminfo = 0x6ffffffc
  9395. const m_SHT_SYMTAB = 2
  9396. const m_SHT_SYMTAB_SHNDX = 18
  9397. const m_STB_GLOBAL = 1
  9398. const m_STB_GNU_UNIQUE = 10
  9399. const m_STB_HIOS = 12
  9400. const m_STB_HIPROC = 15
  9401. const m_STB_LOCAL = 0
  9402. const m_STB_LOOS = 10
  9403. const m_STB_LOPROC = 13
  9404. const m_STB_MIPS_SPLIT_COMMON = 13
  9405. const m_STB_NUM = 3
  9406. const m_STB_WEAK = 2
  9407. const m_STN_UNDEF = 0
  9408. const m_STO_ALPHA_NOPV = 0x80
  9409. const m_STO_ALPHA_STD_GPLOAD = 0x88
  9410. const m_STO_MIPS_DEFAULT = 0x0
  9411. const m_STO_MIPS_HIDDEN = 0x2
  9412. const m_STO_MIPS_INTERNAL = 0x1
  9413. const m_STO_MIPS_PLT = 0x8
  9414. const m_STO_MIPS_PROTECTED = 0x3
  9415. const m_STO_MIPS_SC_ALIGN_UNUSED = 0xff
  9416. const m_STO_PPC64_LOCAL_BIT = 5
  9417. const m_STO_PPC64_LOCAL_MASK = 0xe0
  9418. const m_STT_ARM_16BIT = "STT_HIPROC"
  9419. const m_STT_ARM_TFUNC = "STT_LOPROC"
  9420. const m_STT_COMMON = 5
  9421. const m_STT_FILE = 4
  9422. const m_STT_FUNC = 2
  9423. const m_STT_GNU_IFUNC = 10
  9424. const m_STT_HIOS = 12
  9425. const m_STT_HIPROC = 15
  9426. const m_STT_LOOS = 10
  9427. const m_STT_LOPROC = 13
  9428. const m_STT_NOTYPE = 0
  9429. const m_STT_NUM = 7
  9430. const m_STT_OBJECT = 1
  9431. const m_STT_PARISC_MILLICODE = 13
  9432. const m_STT_SECTION = 3
  9433. const m_STT_SPARC_REGISTER = 13
  9434. const m_STT_TLS = 6
  9435. const m_STV_DEFAULT = 0
  9436. const m_STV_HIDDEN = 2
  9437. const m_STV_INTERNAL = 1
  9438. const m_STV_PROTECTED = 3
  9439. const m_SYMINFO_BT_LOWRESERVE = 0xff00
  9440. const m_SYMINFO_BT_PARENT = 0xfffe
  9441. const m_SYMINFO_BT_SELF = 0xffff
  9442. const m_SYMINFO_CURRENT = 1
  9443. const m_SYMINFO_FLG_COPY = 0x0004
  9444. const m_SYMINFO_FLG_DIRECT = 0x0001
  9445. const m_SYMINFO_FLG_LAZYLOAD = 0x0008
  9446. const m_SYMINFO_FLG_PASSTHRU = 0x0002
  9447. const m_SYMINFO_NONE = 0
  9448. const m_SYMINFO_NUM = 2
  9449. const m_VER_DEF_CURRENT = 1
  9450. const m_VER_DEF_NONE = 0
  9451. const m_VER_DEF_NUM = 2
  9452. const m_VER_FLG_BASE = 0x1
  9453. const m_VER_FLG_WEAK = 0x2
  9454. const m_VER_NDX_ELIMINATE = 0xff01
  9455. const m_VER_NDX_GLOBAL = 1
  9456. const m_VER_NDX_LOCAL = 0
  9457. const m_VER_NDX_LORESERVE = 0xff00
  9458. const m_VER_NEED_CURRENT = 1
  9459. const m_VER_NEED_NONE = 0
  9460. const m_VER_NEED_NUM = 2
  9461. const m_n_hash = "n_desc"
  9462. type Tnlist = struct {
  9463. F__ccgo0_0 struct {
  9464. Fn_un [0]struct {
  9465. Fn_next [0]uintptr
  9466. Fn_strx [0]int32
  9467. Fn_name uintptr
  9468. }
  9469. Fn_name uintptr
  9470. }
  9471. Fn_type uint8
  9472. Fn_other uint8
  9473. Fn_desc int16
  9474. Fn_value uint32
  9475. }
  9476. type TElf32_Half = uint16
  9477. type TElf64_Half = uint16
  9478. type TElf32_Word = uint32
  9479. type TElf32_Sword = int32
  9480. type TElf64_Word = uint32
  9481. type TElf64_Sword = int32
  9482. type TElf32_Xword = uint64
  9483. type TElf32_Sxword = int64
  9484. type TElf64_Xword = uint64
  9485. type TElf64_Sxword = int64
  9486. type TElf32_Addr = uint32
  9487. type TElf64_Addr = uint64
  9488. type TElf32_Off = uint32
  9489. type TElf64_Off = uint64
  9490. type TElf32_Section = uint16
  9491. type TElf64_Section = uint16
  9492. type TElf32_Versym = uint16
  9493. type TElf64_Versym = uint16
  9494. type TElf32_Ehdr = struct {
  9495. Fe_ident [16]uint8
  9496. Fe_type TElf32_Half
  9497. Fe_machine TElf32_Half
  9498. Fe_version TElf32_Word
  9499. Fe_entry TElf32_Addr
  9500. Fe_phoff TElf32_Off
  9501. Fe_shoff TElf32_Off
  9502. Fe_flags TElf32_Word
  9503. Fe_ehsize TElf32_Half
  9504. Fe_phentsize TElf32_Half
  9505. Fe_phnum TElf32_Half
  9506. Fe_shentsize TElf32_Half
  9507. Fe_shnum TElf32_Half
  9508. Fe_shstrndx TElf32_Half
  9509. }
  9510. type TElf64_Ehdr = struct {
  9511. F__ccgo_align [0]uint32
  9512. Fe_ident [16]uint8
  9513. Fe_type TElf64_Half
  9514. Fe_machine TElf64_Half
  9515. Fe_version TElf64_Word
  9516. Fe_entry TElf64_Addr
  9517. Fe_phoff TElf64_Off
  9518. Fe_shoff TElf64_Off
  9519. Fe_flags TElf64_Word
  9520. Fe_ehsize TElf64_Half
  9521. Fe_phentsize TElf64_Half
  9522. Fe_phnum TElf64_Half
  9523. Fe_shentsize TElf64_Half
  9524. Fe_shnum TElf64_Half
  9525. Fe_shstrndx TElf64_Half
  9526. }
  9527. type TElf32_Shdr = struct {
  9528. Fsh_name TElf32_Word
  9529. Fsh_type TElf32_Word
  9530. Fsh_flags TElf32_Word
  9531. Fsh_addr TElf32_Addr
  9532. Fsh_offset TElf32_Off
  9533. Fsh_size TElf32_Word
  9534. Fsh_link TElf32_Word
  9535. Fsh_info TElf32_Word
  9536. Fsh_addralign TElf32_Word
  9537. Fsh_entsize TElf32_Word
  9538. }
  9539. type TElf64_Shdr = struct {
  9540. F__ccgo_align [0]uint32
  9541. Fsh_name TElf64_Word
  9542. Fsh_type TElf64_Word
  9543. Fsh_flags TElf64_Xword
  9544. Fsh_addr TElf64_Addr
  9545. Fsh_offset TElf64_Off
  9546. Fsh_size TElf64_Xword
  9547. Fsh_link TElf64_Word
  9548. Fsh_info TElf64_Word
  9549. Fsh_addralign TElf64_Xword
  9550. Fsh_entsize TElf64_Xword
  9551. }
  9552. type TElf32_Chdr = struct {
  9553. Fch_type TElf32_Word
  9554. Fch_size TElf32_Word
  9555. Fch_addralign TElf32_Word
  9556. }
  9557. type TElf64_Chdr = struct {
  9558. F__ccgo_align [0]uint32
  9559. Fch_type TElf64_Word
  9560. Fch_reserved TElf64_Word
  9561. Fch_size TElf64_Xword
  9562. Fch_addralign TElf64_Xword
  9563. }
  9564. type TElf32_Sym = struct {
  9565. Fst_name TElf32_Word
  9566. Fst_value TElf32_Addr
  9567. Fst_size TElf32_Word
  9568. Fst_info uint8
  9569. Fst_other uint8
  9570. Fst_shndx TElf32_Section
  9571. }
  9572. type TElf64_Sym = struct {
  9573. F__ccgo_align [0]uint32
  9574. Fst_name TElf64_Word
  9575. Fst_info uint8
  9576. Fst_other uint8
  9577. Fst_shndx TElf64_Section
  9578. Fst_value TElf64_Addr
  9579. Fst_size TElf64_Xword
  9580. }
  9581. type TElf32_Syminfo = struct {
  9582. Fsi_boundto TElf32_Half
  9583. Fsi_flags TElf32_Half
  9584. }
  9585. type TElf64_Syminfo = struct {
  9586. Fsi_boundto TElf64_Half
  9587. Fsi_flags TElf64_Half
  9588. }
  9589. type TElf32_Rel = struct {
  9590. Fr_offset TElf32_Addr
  9591. Fr_info TElf32_Word
  9592. }
  9593. type TElf64_Rel = struct {
  9594. F__ccgo_align [0]uint32
  9595. Fr_offset TElf64_Addr
  9596. Fr_info TElf64_Xword
  9597. }
  9598. type TElf32_Rela = struct {
  9599. Fr_offset TElf32_Addr
  9600. Fr_info TElf32_Word
  9601. Fr_addend TElf32_Sword
  9602. }
  9603. type TElf64_Rela = struct {
  9604. F__ccgo_align [0]uint32
  9605. Fr_offset TElf64_Addr
  9606. Fr_info TElf64_Xword
  9607. Fr_addend TElf64_Sxword
  9608. }
  9609. type TElf32_Relr = uint32
  9610. type TElf64_Relr = uint64
  9611. type TElf32_Phdr = struct {
  9612. Fp_type TElf32_Word
  9613. Fp_offset TElf32_Off
  9614. Fp_vaddr TElf32_Addr
  9615. Fp_paddr TElf32_Addr
  9616. Fp_filesz TElf32_Word
  9617. Fp_memsz TElf32_Word
  9618. Fp_flags TElf32_Word
  9619. Fp_align TElf32_Word
  9620. }
  9621. type TElf64_Phdr = struct {
  9622. F__ccgo_align [0]uint32
  9623. Fp_type TElf64_Word
  9624. Fp_flags TElf64_Word
  9625. Fp_offset TElf64_Off
  9626. Fp_vaddr TElf64_Addr
  9627. Fp_paddr TElf64_Addr
  9628. Fp_filesz TElf64_Xword
  9629. Fp_memsz TElf64_Xword
  9630. Fp_align TElf64_Xword
  9631. }
  9632. type TElf32_Dyn = struct {
  9633. Fd_tag TElf32_Sword
  9634. Fd_un struct {
  9635. Fd_ptr [0]TElf32_Addr
  9636. Fd_val TElf32_Word
  9637. }
  9638. }
  9639. type TElf64_Dyn = struct {
  9640. F__ccgo_align [0]uint32
  9641. Fd_tag TElf64_Sxword
  9642. Fd_un struct {
  9643. F__ccgo_align [0]uint32
  9644. Fd_ptr [0]TElf64_Addr
  9645. Fd_val TElf64_Xword
  9646. }
  9647. }
  9648. type TElf32_Verdef = struct {
  9649. Fvd_version TElf32_Half
  9650. Fvd_flags TElf32_Half
  9651. Fvd_ndx TElf32_Half
  9652. Fvd_cnt TElf32_Half
  9653. Fvd_hash TElf32_Word
  9654. Fvd_aux TElf32_Word
  9655. Fvd_next TElf32_Word
  9656. }
  9657. type TElf64_Verdef = struct {
  9658. Fvd_version TElf64_Half
  9659. Fvd_flags TElf64_Half
  9660. Fvd_ndx TElf64_Half
  9661. Fvd_cnt TElf64_Half
  9662. Fvd_hash TElf64_Word
  9663. Fvd_aux TElf64_Word
  9664. Fvd_next TElf64_Word
  9665. }
  9666. type TElf32_Verdaux = struct {
  9667. Fvda_name TElf32_Word
  9668. Fvda_next TElf32_Word
  9669. }
  9670. type TElf64_Verdaux = struct {
  9671. Fvda_name TElf64_Word
  9672. Fvda_next TElf64_Word
  9673. }
  9674. type TElf32_Verneed = struct {
  9675. Fvn_version TElf32_Half
  9676. Fvn_cnt TElf32_Half
  9677. Fvn_file TElf32_Word
  9678. Fvn_aux TElf32_Word
  9679. Fvn_next TElf32_Word
  9680. }
  9681. type TElf64_Verneed = struct {
  9682. Fvn_version TElf64_Half
  9683. Fvn_cnt TElf64_Half
  9684. Fvn_file TElf64_Word
  9685. Fvn_aux TElf64_Word
  9686. Fvn_next TElf64_Word
  9687. }
  9688. type TElf32_Vernaux = struct {
  9689. Fvna_hash TElf32_Word
  9690. Fvna_flags TElf32_Half
  9691. Fvna_other TElf32_Half
  9692. Fvna_name TElf32_Word
  9693. Fvna_next TElf32_Word
  9694. }
  9695. type TElf64_Vernaux = struct {
  9696. Fvna_hash TElf64_Word
  9697. Fvna_flags TElf64_Half
  9698. Fvna_other TElf64_Half
  9699. Fvna_name TElf64_Word
  9700. Fvna_next TElf64_Word
  9701. }
  9702. type TElf32_auxv_t = struct {
  9703. Fa_type Tuint32_t
  9704. Fa_un struct {
  9705. Fa_val Tuint32_t
  9706. }
  9707. }
  9708. type TElf64_auxv_t = struct {
  9709. F__ccgo_align [0]uint32
  9710. Fa_type Tuint64_t
  9711. Fa_un struct {
  9712. F__ccgo_align [0]uint32
  9713. Fa_val Tuint64_t
  9714. }
  9715. }
  9716. type TElf32_Nhdr = struct {
  9717. Fn_namesz TElf32_Word
  9718. Fn_descsz TElf32_Word
  9719. Fn_type TElf32_Word
  9720. }
  9721. type TElf64_Nhdr = struct {
  9722. Fn_namesz TElf64_Word
  9723. Fn_descsz TElf64_Word
  9724. Fn_type TElf64_Word
  9725. }
  9726. type TElf32_Move = struct {
  9727. F__ccgo_align [0]uint32
  9728. Fm_value TElf32_Xword
  9729. Fm_info TElf32_Word
  9730. Fm_poffset TElf32_Word
  9731. Fm_repeat TElf32_Half
  9732. Fm_stride TElf32_Half
  9733. F__ccgo_pad5 [4]byte
  9734. }
  9735. type TElf64_Move = struct {
  9736. F__ccgo_align [0]uint32
  9737. Fm_value TElf64_Xword
  9738. Fm_info TElf64_Xword
  9739. Fm_poffset TElf64_Xword
  9740. Fm_repeat TElf64_Half
  9741. Fm_stride TElf64_Half
  9742. F__ccgo_pad5 [4]byte
  9743. }
  9744. type TElf32_gptab = struct {
  9745. Fgt_entry [0]struct {
  9746. Fgt_g_value TElf32_Word
  9747. Fgt_bytes TElf32_Word
  9748. }
  9749. Fgt_header struct {
  9750. Fgt_current_g_value TElf32_Word
  9751. Fgt_unused TElf32_Word
  9752. }
  9753. }
  9754. type TElf32_RegInfo = struct {
  9755. Fri_gprmask TElf32_Word
  9756. Fri_cprmask [4]TElf32_Word
  9757. Fri_gp_value TElf32_Sword
  9758. }
  9759. type TElf_Options = struct {
  9760. Fkind uint8
  9761. Fsize uint8
  9762. Fsection TElf32_Section
  9763. Finfo TElf32_Word
  9764. }
  9765. type TElf_Options_Hw = struct {
  9766. Fhwp_flags1 TElf32_Word
  9767. Fhwp_flags2 TElf32_Word
  9768. }
  9769. type TElf32_Lib = struct {
  9770. Fl_name TElf32_Word
  9771. Fl_time_stamp TElf32_Word
  9772. Fl_checksum TElf32_Word
  9773. Fl_version TElf32_Word
  9774. Fl_flags TElf32_Word
  9775. }
  9776. type TElf64_Lib = struct {
  9777. Fl_name TElf64_Word
  9778. Fl_time_stamp TElf64_Word
  9779. Fl_checksum TElf64_Word
  9780. Fl_version TElf64_Word
  9781. Fl_flags TElf64_Word
  9782. }
  9783. type TElf32_Conflict = uint32
  9784. type TElf_MIPS_ABIFlags_v0 = struct {
  9785. Fversion TElf32_Half
  9786. Fisa_level uint8
  9787. Fisa_rev uint8
  9788. Fgpr_size uint8
  9789. Fcpr1_size uint8
  9790. Fcpr2_size uint8
  9791. Ffp_abi uint8
  9792. Fisa_ext TElf32_Word
  9793. Fases TElf32_Word
  9794. Fflags1 TElf32_Word
  9795. Fflags2 TElf32_Word
  9796. }
  9797. const _Val_GNU_MIPS_ABI_FP_ANY = 0
  9798. const _Val_GNU_MIPS_ABI_FP_DOUBLE = 1
  9799. const _Val_GNU_MIPS_ABI_FP_SINGLE = 2
  9800. const _Val_GNU_MIPS_ABI_FP_SOFT = 3
  9801. const _Val_GNU_MIPS_ABI_FP_OLD_64 = 4
  9802. const _Val_GNU_MIPS_ABI_FP_XX = 5
  9803. const _Val_GNU_MIPS_ABI_FP_64 = 6
  9804. const _Val_GNU_MIPS_ABI_FP_64A = 7
  9805. const _Val_GNU_MIPS_ABI_FP_MAX = 7
  9806. // C documentation
  9807. //
  9808. // /*
  9809. // * __elf_is_okay__ - Determine if ehdr really
  9810. // * is ELF and valid for the target platform.
  9811. // *
  9812. // * WARNING: This is NOT an ELF ABI function and
  9813. // * as such its use should be restricted.
  9814. // */
  9815. func ___elf_is_okay__(tls *libc.TLS, ehdr uintptr) (r int32) {
  9816. var retval int32
  9817. _ = retval
  9818. retval = 0
  9819. /*
  9820. * We need to check magic, class size, endianess,
  9821. * and version before we look at the rest of the
  9822. * Elf_Ehdr structure. These few elements are
  9823. * represented in a machine independent fashion.
  9824. */
  9825. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ehdr))) == int32(m_ELFMAG0) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ehdr + 1))) == int32('E') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ehdr + 2))) == int32('L') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ehdr + 3))) == int32('F') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ehdr + 4))) == int32(m_ELFCLASS32) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ehdr + 5))) == int32(m_ELFDATA2LSB) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ehdr + 6))) == int32(m_EV_CURRENT) {
  9826. /* Now check the machine dependent header */
  9827. if libc.Int32FromUint16((*TElf32_Ehdr)(unsafe.Pointer(ehdr)).Fe_machine) == int32(m_EM_ARM) && (*TElf32_Ehdr)(unsafe.Pointer(ehdr)).Fe_version == uint32(m_EV_CURRENT) {
  9828. retval = int32(1)
  9829. }
  9830. }
  9831. return retval
  9832. }
  9833. // C documentation
  9834. //
  9835. // /*
  9836. // * Convert an Elf_Sym into an nlist structure. This fills in only the
  9837. // * n_value and n_type members.
  9838. // */
  9839. func _elf_sym_to_nlist(tls *libc.TLS, nl uintptr, s uintptr, shdr uintptr, shnum int32) {
  9840. var sh, p5 uintptr
  9841. var v1, v2, v3, v4 int32
  9842. _, _, _, _, _, _ = sh, v1, v2, v3, v4, p5
  9843. (*Tnlist)(unsafe.Pointer(nl)).Fn_value = (*TElf32_Sym)(unsafe.Pointer(s)).Fst_value
  9844. switch libc.Int32FromUint16((*TElf32_Sym)(unsafe.Pointer(s)).Fst_shndx) {
  9845. case m_SHN_UNDEF:
  9846. fallthrough
  9847. case int32(m_SHN_COMMON):
  9848. (*Tnlist)(unsafe.Pointer(nl)).Fn_type = uint8(m_N_UNDF)
  9849. case int32(m_SHN_ABS):
  9850. if libc.Int32FromUint8((*TElf32_Sym)(unsafe.Pointer(s)).Fst_info)&int32(0xf) == int32(m_STT_FILE) {
  9851. v1 = int32(m_N_FN)
  9852. } else {
  9853. v1 = int32(m_N_ABS)
  9854. }
  9855. (*Tnlist)(unsafe.Pointer(nl)).Fn_type = libc.Uint8FromInt32(v1)
  9856. default:
  9857. if libc.Int32FromUint16((*TElf32_Sym)(unsafe.Pointer(s)).Fst_shndx) >= shnum {
  9858. (*Tnlist)(unsafe.Pointer(nl)).Fn_type = uint8(m_N_UNDF)
  9859. } else {
  9860. sh = shdr + uintptr((*TElf32_Sym)(unsafe.Pointer(s)).Fst_shndx)*40
  9861. if (*TElf32_Shdr)(unsafe.Pointer(sh)).Fsh_type == uint32(m_SHT_PROGBITS) {
  9862. if (*TElf32_Shdr)(unsafe.Pointer(sh)).Fsh_flags&libc.Uint32FromInt32(libc.Int32FromInt32(1)<<libc.Int32FromInt32(0)) != 0 {
  9863. v3 = int32(m_N_DATA)
  9864. } else {
  9865. v3 = int32(m_N_TEXT)
  9866. }
  9867. v2 = v3
  9868. } else {
  9869. if (*TElf32_Shdr)(unsafe.Pointer(sh)).Fsh_type == uint32(m_SHT_NOBITS) {
  9870. v4 = int32(m_N_BSS)
  9871. } else {
  9872. v4 = m_N_UNDF
  9873. }
  9874. v2 = v4
  9875. }
  9876. (*Tnlist)(unsafe.Pointer(nl)).Fn_type = libc.Uint8FromInt32(v2)
  9877. }
  9878. break
  9879. }
  9880. if libc.Int32FromUint8((*TElf32_Sym)(unsafe.Pointer(s)).Fst_info)>>int32(4) == int32(m_STB_GLOBAL) || libc.Int32FromUint8((*TElf32_Sym)(unsafe.Pointer(s)).Fst_info)>>int32(4) == int32(m_STB_WEAK) {
  9881. p5 = nl + 4
  9882. *(*uint8)(unsafe.Pointer(p5)) = uint8(int32(*(*uint8)(unsafe.Pointer(p5))) | libc.Int32FromInt32(m_N_EXT))
  9883. }
  9884. }
  9885. func X__fdnlist(tls *libc.TLS, fd int32, list uintptr) (r int32) {
  9886. bp := tls.Alloc(16592)
  9887. defer tls.Free(16592)
  9888. var cc, i TElf32_Sword
  9889. var errsave, nent, v6 int32
  9890. var name, p, s, shdr, strtab uintptr
  9891. var shdr_size, size, symsize, symstrsize TElf32_Word
  9892. var symoff, symstroff TElf32_Off
  9893. var v3 uint32
  9894. var _ /* ehdr at bp+16384 */ TElf32_Ehdr
  9895. var _ /* sbuf at bp+0 */ [1024]TElf32_Sym
  9896. var _ /* st at bp+16440 */ Tstat
  9897. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = cc, errsave, i, name, nent, p, s, shdr, shdr_size, size, strtab, symoff, symsize, symstroff, symstrsize, v3, v6
  9898. symoff = uint32(0)
  9899. symstroff = uint32(0)
  9900. symsize = uint32(0)
  9901. symstrsize = uint32(0)
  9902. nent = -int32(1)
  9903. strtab = libc.UintptrFromInt32(0)
  9904. shdr = libc.UintptrFromInt32(0)
  9905. /* Make sure obj is OK */
  9906. if libc.Xlseek(tls, fd, libc.Int64FromInt32(0), 0) == int64(-int32(1)) || libc.Uint32FromInt32(libc.Xread(tls, fd, bp+16384, uint32(52))) != uint32(52) || !(___elf_is_okay__(tls, bp+16384) != 0) || libc.Xfstat(tls, fd, bp+16440) < 0 {
  9907. return -int32(1)
  9908. }
  9909. if libc.Int32FromUint16((*(*TElf32_Ehdr)(unsafe.Pointer(bp + 16384))).Fe_shnum) == 0 || uint32((*(*TElf32_Ehdr)(unsafe.Pointer(bp + 16384))).Fe_shentsize) != uint32(40) {
  9910. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ERANGE)
  9911. return -int32(1)
  9912. }
  9913. /* calculate section header table size */
  9914. shdr_size = libc.Uint32FromInt32(libc.Int32FromUint16((*(*TElf32_Ehdr)(unsafe.Pointer(bp + 16384))).Fe_shentsize) * libc.Int32FromUint16((*(*TElf32_Ehdr)(unsafe.Pointer(bp + 16384))).Fe_shnum))
  9915. /* Make sure it's not too big to mmap */
  9916. if libc.Int64FromUint32(shdr_size) > (*(*Tstat)(unsafe.Pointer(bp + 16440))).Fst_size {
  9917. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EFBIG)
  9918. return -int32(1)
  9919. }
  9920. shdr = libc.Xmalloc(tls, shdr_size)
  9921. if shdr == libc.UintptrFromInt32(0) {
  9922. return -int32(1)
  9923. }
  9924. /* Load section header table. */
  9925. if libc.Xpread(tls, fd, shdr, shdr_size, libc.Int64FromUint32((*(*TElf32_Ehdr)(unsafe.Pointer(bp + 16384))).Fe_shoff)) != libc.Int32FromUint32(shdr_size) {
  9926. goto done
  9927. }
  9928. /*
  9929. * Find the symbol table entry and it's corresponding
  9930. * string table entry. Version 1.1 of the ABI states
  9931. * that there is only one symbol table but that this
  9932. * could change in the future.
  9933. */
  9934. i = 0
  9935. for {
  9936. if !(i < libc.Int32FromUint16((*(*TElf32_Ehdr)(unsafe.Pointer(bp + 16384))).Fe_shnum)) {
  9937. break
  9938. }
  9939. if (*(*TElf32_Shdr)(unsafe.Pointer(shdr + uintptr(i)*40))).Fsh_type == uint32(m_SHT_SYMTAB) {
  9940. if (*(*TElf32_Shdr)(unsafe.Pointer(shdr + uintptr(i)*40))).Fsh_link >= uint32((*(*TElf32_Ehdr)(unsafe.Pointer(bp + 16384))).Fe_shnum) {
  9941. goto done
  9942. }
  9943. symoff = (*(*TElf32_Shdr)(unsafe.Pointer(shdr + uintptr(i)*40))).Fsh_offset
  9944. symsize = (*(*TElf32_Shdr)(unsafe.Pointer(shdr + uintptr(i)*40))).Fsh_size
  9945. symstroff = (*(*TElf32_Shdr)(unsafe.Pointer(shdr + uintptr((*(*TElf32_Shdr)(unsafe.Pointer(shdr + uintptr(i)*40))).Fsh_link)*40))).Fsh_offset
  9946. symstrsize = (*(*TElf32_Shdr)(unsafe.Pointer(shdr + uintptr((*(*TElf32_Shdr)(unsafe.Pointer(shdr + uintptr(i)*40))).Fsh_link)*40))).Fsh_size
  9947. break
  9948. }
  9949. goto _1
  9950. _1:
  9951. ;
  9952. i++
  9953. }
  9954. /* Check for files too large to mmap. */
  9955. if libc.Int64FromUint32(symstrsize) > (*(*Tstat)(unsafe.Pointer(bp + 16440))).Fst_size {
  9956. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EFBIG)
  9957. goto done
  9958. }
  9959. /*
  9960. * Load string table into our address space. This gives us
  9961. * an easy way to randomly access all the strings, without
  9962. * making the memory allocation permanent as with malloc/free
  9963. * (i.e., munmap will return it to the system).
  9964. */
  9965. strtab = libc.Xmalloc(tls, symstrsize)
  9966. if strtab == libc.UintptrFromInt32(0) {
  9967. goto done
  9968. }
  9969. if libc.Xpread(tls, fd, strtab, symstrsize, libc.Int64FromUint32(symstroff)) != libc.Int32FromUint32(symstrsize) {
  9970. goto done
  9971. }
  9972. /*
  9973. * clean out any left-over information for all valid entries.
  9974. * Type and value defined to be 0 if not found; historical
  9975. * versions cleared other and desc as well. Also figure out
  9976. * the largest string length so don't read any more of the
  9977. * string table than we have to.
  9978. *
  9979. * XXX clearing anything other than n_type and n_value violates
  9980. * the semantics given in the man page.
  9981. */
  9982. nent = 0
  9983. p = list
  9984. for {
  9985. if !!(*(*uintptr)(unsafe.Pointer(p)) == uintptr(0) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p))))) == 0) {
  9986. break
  9987. }
  9988. (*Tnlist)(unsafe.Pointer(p)).Fn_type = uint8(0)
  9989. (*Tnlist)(unsafe.Pointer(p)).Fn_other = uint8(0)
  9990. (*Tnlist)(unsafe.Pointer(p)).Fn_desc = 0
  9991. (*Tnlist)(unsafe.Pointer(p)).Fn_value = uint32(0)
  9992. nent++
  9993. goto _2
  9994. _2:
  9995. ;
  9996. p += 12
  9997. }
  9998. /* Don't process any further if object is stripped. */
  9999. if symoff == uint32(0) {
  10000. goto done
  10001. }
  10002. if libc.Xlseek(tls, fd, libc.Int64FromUint32(symoff), 0) == int64(-int32(1)) {
  10003. nent = -int32(1)
  10004. goto done
  10005. }
  10006. for symsize > uint32(0) && nent > 0 {
  10007. if symsize < libc.Uint32FromInt64(16384) {
  10008. v3 = symsize
  10009. } else {
  10010. v3 = libc.Uint32FromInt64(16384)
  10011. }
  10012. cc = libc.Int32FromUint32(v3)
  10013. if libc.Xread(tls, fd, bp, libc.Uint32FromInt32(cc)) != cc {
  10014. break
  10015. }
  10016. symsize -= libc.Uint32FromInt32(cc)
  10017. s = bp
  10018. for {
  10019. if !(cc > 0 && nent > 0) {
  10020. break
  10021. }
  10022. name = strtab + uintptr((*TElf32_Sym)(unsafe.Pointer(s)).Fst_name)
  10023. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(name))) == int32('\000') {
  10024. goto _4
  10025. }
  10026. size = symstrsize - (*TElf32_Sym)(unsafe.Pointer(s)).Fst_name
  10027. p = list
  10028. for {
  10029. if !!(*(*uintptr)(unsafe.Pointer(p)) == uintptr(0) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p))))) == 0) {
  10030. break
  10031. }
  10032. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p))))) == int32('_') && libc.Xstrncmp(tls, name, *(*uintptr)(unsafe.Pointer(p))+uintptr(1), size) == 0 || libc.Xstrncmp(tls, name, *(*uintptr)(unsafe.Pointer(p)), size) == 0 {
  10033. _elf_sym_to_nlist(tls, p, s, shdr, libc.Int32FromUint16((*(*TElf32_Ehdr)(unsafe.Pointer(bp + 16384))).Fe_shnum))
  10034. nent--
  10035. v6 = nent
  10036. if v6 <= 0 {
  10037. break
  10038. }
  10039. }
  10040. goto _5
  10041. _5:
  10042. ;
  10043. p += 12
  10044. }
  10045. goto _4
  10046. _4:
  10047. ;
  10048. s += 16
  10049. cc = TElf32_Sword(uint32(cc) - libc.Uint32FromInt64(16))
  10050. }
  10051. }
  10052. goto done
  10053. done:
  10054. ;
  10055. errsave = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10056. libc.Xfree(tls, strtab)
  10057. libc.Xfree(tls, shdr)
  10058. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = errsave
  10059. return nent
  10060. }
  10061. func Xnlist(tls *libc.TLS, name uintptr, list uintptr) (r int32) {
  10062. bp := tls.Alloc(16)
  10063. defer tls.Free(16)
  10064. var fd, n int32
  10065. _, _ = fd, n
  10066. if list == libc.UintptrFromInt32(0) {
  10067. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  10068. return -int32(1)
  10069. }
  10070. fd = libc.Xopen(tls, name, m_O_RDONLY1, libc.VaList(bp+8, 0))
  10071. if fd < 0 {
  10072. return -int32(1)
  10073. }
  10074. n = X__fdnlist(tls, fd, list)
  10075. libc.Xclose(tls, fd)
  10076. return n
  10077. }
  10078. const m_O_CREAT3 = 64
  10079. const m_O_NONBLOCK3 = 2048
  10080. const m_O_TRUNC3 = 512
  10081. const m_O_WRONLY1 = 1
  10082. type Tpidfh = struct {
  10083. F__ccgo_align [0]uint32
  10084. Fpf_fd int32
  10085. Fpf_path uintptr
  10086. Fpf_dev Tdev_t
  10087. Fpf_ino Tino_t
  10088. }
  10089. func _pidfile_verify(tls *libc.TLS, pfh uintptr) (r int32) {
  10090. bp := tls.Alloc(160)
  10091. defer tls.Free(160)
  10092. var _ /* sb at bp+0 */ Tstat
  10093. if pfh == libc.UintptrFromInt32(0) || (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd == -int32(1) {
  10094. return int32(m_EINVAL)
  10095. }
  10096. /*
  10097. * Check remembered descriptor.
  10098. */
  10099. if libc.Xfstat(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd, bp) == -int32(1) {
  10100. return *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10101. }
  10102. if (*(*Tstat)(unsafe.Pointer(bp))).Fst_dev != (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_dev || (*(*Tstat)(unsafe.Pointer(bp))).Fst_ino != (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_ino {
  10103. return int32(m_EINVAL)
  10104. }
  10105. return 0
  10106. }
  10107. func _pidfile_read(tls *libc.TLS, path uintptr, pidptr uintptr) (r int32) {
  10108. bp := tls.Alloc(32)
  10109. defer tls.Free(32)
  10110. var error1, fd, i int32
  10111. var _ /* buf at bp+0 */ [16]uint8
  10112. var _ /* endptr at bp+16 */ uintptr
  10113. _, _, _ = error1, fd, i
  10114. fd = libc.Xopen(tls, path, m_O_RDONLY1, 0)
  10115. if fd == -int32(1) {
  10116. return *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10117. }
  10118. i = libc.Xread(tls, fd, bp, libc.Uint32FromInt64(16)-libc.Uint32FromInt32(1))
  10119. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) /* Remember errno in case close() wants to change it. */
  10120. libc.Xclose(tls, fd)
  10121. if i == -int32(1) {
  10122. return error1
  10123. } else {
  10124. if i == 0 {
  10125. return int32(m_EAGAIN)
  10126. }
  10127. }
  10128. (*(*[16]uint8)(unsafe.Pointer(bp)))[i] = uint8('\000')
  10129. *(*Tpid_t)(unsafe.Pointer(pidptr)) = int32(libc.Xstrtol(tls, bp, bp+16, int32(10)))
  10130. if *(*uintptr)(unsafe.Pointer(bp + 16)) != bp+uintptr(i) {
  10131. return int32(m_EINVAL)
  10132. }
  10133. return 0
  10134. }
  10135. func Xpidfile_open(tls *libc.TLS, path uintptr, mode Tmode_t, pidptr uintptr) (r uintptr) {
  10136. bp := tls.Alloc(192)
  10137. defer tls.Free(192)
  10138. var count, error1, fd, len1, v2 int32
  10139. var pfh uintptr
  10140. var v3 bool
  10141. var _ /* rqtp at bp+152 */ Ttimespec
  10142. var _ /* sb at bp+0 */ Tstat
  10143. _, _, _, _, _, _, _ = count, error1, fd, len1, pfh, v2, v3
  10144. pfh = libc.Xmalloc(tls, uint32(24))
  10145. if pfh == libc.UintptrFromInt32(0) {
  10146. return libc.UintptrFromInt32(0)
  10147. }
  10148. if path == libc.UintptrFromInt32(0) {
  10149. len1 = libc.Xasprintf(tls, pfh+4, __ccgo_ts+304, libc.VaList(bp+176, Xgetprogname(tls)))
  10150. if len1 < 0 {
  10151. libc.Xfree(tls, pfh)
  10152. return libc.UintptrFromInt32(0)
  10153. }
  10154. } else {
  10155. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path = libc.Xstrdup(tls, path)
  10156. }
  10157. /*
  10158. * Open the PID file and obtain exclusive lock.
  10159. * We truncate PID file here only to remove old PID immediately,
  10160. * PID file will be truncated again in pidfile_write(), so
  10161. * pidfile_write() can be called multiple times.
  10162. */
  10163. fd = Xflopen(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path, libc.Int32FromInt32(m_O_WRONLY1)|libc.Int32FromInt32(m_O_CREAT3)|libc.Int32FromInt32(m_O_TRUNC3)|libc.Int32FromInt32(m_O_NONBLOCK3), libc.VaList(bp+176, mode))
  10164. if fd == -int32(1) {
  10165. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EAGAIN) {
  10166. if pidptr == libc.UintptrFromInt32(0) {
  10167. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EEXIST)
  10168. } else {
  10169. count = int32(20)
  10170. (*(*Ttimespec)(unsafe.Pointer(bp + 152))).Ftv_sec = 0
  10171. (*(*Ttimespec)(unsafe.Pointer(bp + 152))).Ftv_nsec = int32(5000000)
  10172. for {
  10173. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = _pidfile_read(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path, pidptr)
  10174. if v3 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) != int32(m_EAGAIN); !v3 {
  10175. count--
  10176. v2 = count
  10177. }
  10178. if v3 || v2 == 0 {
  10179. break
  10180. }
  10181. libc.Xnanosleep(tls, bp+152, uintptr(0))
  10182. goto _1
  10183. _1:
  10184. }
  10185. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EAGAIN) {
  10186. *(*Tpid_t)(unsafe.Pointer(pidptr)) = -int32(1)
  10187. }
  10188. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == 0 || *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EAGAIN) {
  10189. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EEXIST)
  10190. }
  10191. }
  10192. }
  10193. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10194. libc.Xfree(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  10195. libc.Xfree(tls, pfh)
  10196. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  10197. return libc.UintptrFromInt32(0)
  10198. }
  10199. /*
  10200. * Remember file information, so in pidfile_write() we are sure we write
  10201. * to the proper descriptor.
  10202. */
  10203. if libc.Xfstat(tls, fd, bp) == -int32(1) {
  10204. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10205. libc.Xunlink(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  10206. libc.Xfree(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  10207. libc.Xclose(tls, fd)
  10208. libc.Xfree(tls, pfh)
  10209. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  10210. return libc.UintptrFromInt32(0)
  10211. }
  10212. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd = fd
  10213. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_dev = (*(*Tstat)(unsafe.Pointer(bp))).Fst_dev
  10214. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_ino = (*(*Tstat)(unsafe.Pointer(bp))).Fst_ino
  10215. return pfh
  10216. }
  10217. func Xpidfile_write(tls *libc.TLS, pfh uintptr) (r int32) {
  10218. bp := tls.Alloc(32)
  10219. defer tls.Free(32)
  10220. var error1, fd int32
  10221. var _ /* pidstr at bp+0 */ [16]uint8
  10222. _, _ = error1, fd
  10223. /*
  10224. * Check remembered descriptor, so we don't overwrite some other
  10225. * file if pidfile was closed and descriptor reused.
  10226. */
  10227. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = _pidfile_verify(tls, pfh)
  10228. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) != 0 {
  10229. /*
  10230. * Don't close descriptor, because we are not sure if it's ours.
  10231. */
  10232. return -int32(1)
  10233. }
  10234. fd = (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd
  10235. /*
  10236. * Truncate PID file, so multiple calls of pidfile_write() are allowed.
  10237. */
  10238. if libc.Xftruncate(tls, fd, 0) == -int32(1) {
  10239. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10240. __pidfile_remove(tls, pfh, 0)
  10241. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  10242. return -int32(1)
  10243. }
  10244. libc.X__builtin_snprintf(tls, bp, uint32(16), __ccgo_ts+320, libc.VaList(bp+24, libc.Xgetpid(tls)))
  10245. if libc.Xpwrite(tls, fd, bp, libc.Xstrlen(tls, bp), 0) != libc.Int32FromUint32(libc.Xstrlen(tls, bp)) {
  10246. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10247. __pidfile_remove(tls, pfh, 0)
  10248. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  10249. return -int32(1)
  10250. }
  10251. return 0
  10252. }
  10253. func Xpidfile_close(tls *libc.TLS, pfh uintptr) (r int32) {
  10254. var error1 int32
  10255. _ = error1
  10256. error1 = _pidfile_verify(tls, pfh)
  10257. if error1 != 0 {
  10258. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  10259. return -int32(1)
  10260. }
  10261. if libc.Xclose(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd) == -int32(1) {
  10262. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10263. }
  10264. libc.Xfree(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  10265. libc.Xfree(tls, pfh)
  10266. if error1 != 0 {
  10267. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  10268. return -int32(1)
  10269. }
  10270. return 0
  10271. }
  10272. func __pidfile_remove(tls *libc.TLS, pfh uintptr, freeit int32) (r int32) {
  10273. var error1 int32
  10274. _ = error1
  10275. error1 = _pidfile_verify(tls, pfh)
  10276. if error1 != 0 {
  10277. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  10278. return -int32(1)
  10279. }
  10280. if libc.Xunlink(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path) == -int32(1) {
  10281. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10282. }
  10283. if libc.Xclose(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd) == -int32(1) {
  10284. if error1 == 0 {
  10285. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10286. }
  10287. }
  10288. if freeit != 0 {
  10289. libc.Xfree(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  10290. libc.Xfree(tls, pfh)
  10291. } else {
  10292. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd = -int32(1)
  10293. }
  10294. if error1 != 0 {
  10295. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  10296. return -int32(1)
  10297. }
  10298. return 0
  10299. }
  10300. func Xpidfile_remove(tls *libc.TLS, pfh uintptr) (r int32) {
  10301. return __pidfile_remove(tls, pfh, int32(1))
  10302. }
  10303. func Xpidfile_fileno(tls *libc.TLS, pfh uintptr) (r int32) {
  10304. if pfh == libc.UintptrFromInt32(0) || (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd == -int32(1) {
  10305. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  10306. return -int32(1)
  10307. }
  10308. return (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd
  10309. }
  10310. func Xgetprogname(tls *libc.TLS) (r uintptr) {
  10311. if libc.Xprogram_invocation_short_name == libc.UintptrFromInt32(0) {
  10312. libc.Xprogram_invocation_short_name = libc.Xprogram_invocation_short_name
  10313. }
  10314. return libc.Xprogram_invocation_short_name
  10315. }
  10316. func Xsetprogname(tls *libc.TLS, progname uintptr) {
  10317. var i Tsize_t
  10318. _ = i
  10319. i = libc.Xstrlen(tls, progname)
  10320. for {
  10321. if !(i > uint32(0)) {
  10322. break
  10323. }
  10324. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(progname + uintptr(i-uint32(1))))) == int32('/') {
  10325. libc.Xprogram_invocation_short_name = progname + uintptr(i)
  10326. return
  10327. }
  10328. goto _1
  10329. _1:
  10330. ;
  10331. i--
  10332. }
  10333. libc.Xprogram_invocation_short_name = progname
  10334. }
  10335. const m_GID_SZ = 251
  10336. const m_GNMLEN = 32
  10337. const m_GNM_SZ = 251
  10338. const m_INVALID = 2
  10339. const m_UID_SZ = 317
  10340. const m_UNMLEN = 32
  10341. const m_UNM_SZ = 317
  10342. const m_VALID = 1
  10343. const m__PW_BUF_LEN = 1024
  10344. type Tgroup = struct {
  10345. Fgr_name uintptr
  10346. Fgr_passwd uintptr
  10347. Fgr_gid Tgid_t
  10348. Fgr_mem uintptr
  10349. }
  10350. type Tpasswd = struct {
  10351. Fpw_name uintptr
  10352. Fpw_passwd uintptr
  10353. Fpw_uid Tuid_t
  10354. Fpw_gid Tgid_t
  10355. Fpw_gecos uintptr
  10356. Fpw_dir uintptr
  10357. Fpw_shell uintptr
  10358. }
  10359. /*
  10360. * Constants and data structures used to implement group and password file
  10361. * caches. Name lengths have been chosen to be as large as those supported
  10362. * by the passwd and group files as well as the standard archive formats.
  10363. * CACHE SIZES MUST BE PRIME
  10364. */
  10365. /*
  10366. * Node structures used in the user, group, uid, and gid caches.
  10367. */
  10368. type TUIDC = struct {
  10369. Fvalid int32
  10370. Fname [32]uint8
  10371. Fuid Tuid_t
  10372. }
  10373. /*
  10374. * Constants and data structures used to implement group and password file
  10375. * caches. Name lengths have been chosen to be as large as those supported
  10376. * by the passwd and group files as well as the standard archive formats.
  10377. * CACHE SIZES MUST BE PRIME
  10378. */
  10379. /*
  10380. * Node structures used in the user, group, uid, and gid caches.
  10381. */
  10382. type Tuidc = TUIDC
  10383. type TGIDC = struct {
  10384. Fvalid int32
  10385. Fname [32]uint8
  10386. Fgid Tgid_t
  10387. }
  10388. type Tgidc = TGIDC
  10389. /*
  10390. * Routines that control user, group, uid and gid caches.
  10391. * Traditional passwd/group cache routines perform quite poorly with
  10392. * archives. The chances of hitting a valid lookup with an archive is quite a
  10393. * bit worse than with files already resident on the file system. These misses
  10394. * create a MAJOR performance cost. To adress this problem, these routines
  10395. * cache both hits and misses.
  10396. */
  10397. var _uidtb uintptr /* uid to name cache */
  10398. var _gidtb uintptr /* gid to name cache */
  10399. var _usrtb uintptr /* user name to uid cache */
  10400. var _grptb uintptr /* group name to gid cache */
  10401. func _st_hash(tls *libc.TLS, name uintptr, len1 Tsize_t, tabsz int32) (r Tu_int) {
  10402. var key Tu_int
  10403. var v1 Tsize_t
  10404. var v2 uintptr
  10405. _, _, _ = key, v1, v2
  10406. key = uint32(0)
  10407. for {
  10408. v1 = len1
  10409. len1--
  10410. if !(v1 != 0) {
  10411. break
  10412. }
  10413. v2 = name
  10414. name++
  10415. key += uint32(*(*uint8)(unsafe.Pointer(v2)))
  10416. key = key<<libc.Int32FromInt32(8) | key>>libc.Int32FromInt32(24)
  10417. }
  10418. return key % libc.Uint32FromInt32(tabsz)
  10419. }
  10420. // C documentation
  10421. //
  10422. // /*
  10423. // * uidtb_start
  10424. // * creates an an empty uidtb
  10425. // * Return:
  10426. // * 0 if ok, -1 otherwise
  10427. // */
  10428. func _uidtb_start(tls *libc.TLS) (r int32) {
  10429. var v1 uintptr
  10430. _ = v1
  10431. if _uidtb != libc.UintptrFromInt32(0) {
  10432. return 0
  10433. }
  10434. if _fail != 0 {
  10435. return -int32(1)
  10436. }
  10437. v1 = libc.Xcalloc(tls, uint32(m_UID_SZ), uint32(4))
  10438. _uidtb = v1
  10439. if v1 == libc.UintptrFromInt32(0) {
  10440. _fail++
  10441. return -int32(1)
  10442. }
  10443. return 0
  10444. }
  10445. var _fail int32
  10446. // C documentation
  10447. //
  10448. // /*
  10449. // * gidtb_start
  10450. // * creates an an empty gidtb
  10451. // * Return:
  10452. // * 0 if ok, -1 otherwise
  10453. // */
  10454. func _gidtb_start(tls *libc.TLS) (r int32) {
  10455. var v1 uintptr
  10456. _ = v1
  10457. if _gidtb != libc.UintptrFromInt32(0) {
  10458. return 0
  10459. }
  10460. if _fail1 != 0 {
  10461. return -int32(1)
  10462. }
  10463. v1 = libc.Xcalloc(tls, uint32(m_GID_SZ), uint32(4))
  10464. _gidtb = v1
  10465. if v1 == libc.UintptrFromInt32(0) {
  10466. _fail1++
  10467. return -int32(1)
  10468. }
  10469. return 0
  10470. }
  10471. var _fail1 int32
  10472. // C documentation
  10473. //
  10474. // /*
  10475. // * usrtb_start
  10476. // * creates an an empty usrtb
  10477. // * Return:
  10478. // * 0 if ok, -1 otherwise
  10479. // */
  10480. func _usrtb_start(tls *libc.TLS) (r int32) {
  10481. var v1 uintptr
  10482. _ = v1
  10483. if _usrtb != libc.UintptrFromInt32(0) {
  10484. return 0
  10485. }
  10486. if _fail2 != 0 {
  10487. return -int32(1)
  10488. }
  10489. v1 = libc.Xcalloc(tls, uint32(m_UNM_SZ), uint32(4))
  10490. _usrtb = v1
  10491. if v1 == libc.UintptrFromInt32(0) {
  10492. _fail2++
  10493. return -int32(1)
  10494. }
  10495. return 0
  10496. }
  10497. var _fail2 int32
  10498. // C documentation
  10499. //
  10500. // /*
  10501. // * grptb_start
  10502. // * creates an an empty grptb
  10503. // * Return:
  10504. // * 0 if ok, -1 otherwise
  10505. // */
  10506. func _grptb_start(tls *libc.TLS) (r int32) {
  10507. var v1 uintptr
  10508. _ = v1
  10509. if _grptb != libc.UintptrFromInt32(0) {
  10510. return 0
  10511. }
  10512. if _fail3 != 0 {
  10513. return -int32(1)
  10514. }
  10515. v1 = libc.Xcalloc(tls, uint32(m_GNM_SZ), uint32(4))
  10516. _grptb = v1
  10517. if v1 == libc.UintptrFromInt32(0) {
  10518. _fail3++
  10519. return -int32(1)
  10520. }
  10521. return 0
  10522. }
  10523. var _fail3 int32
  10524. // C documentation
  10525. //
  10526. // /*
  10527. // * user_from_uid()
  10528. // * caches the name (if any) for the uid. If noname clear, we always
  10529. // * return the stored name (if valid or invalid match).
  10530. // * We use a simple hash table.
  10531. // * Return:
  10532. // * Pointer to stored name (or a empty string)
  10533. // */
  10534. func Xuser_from_uid(tls *libc.TLS, uid Tuid_t, noname int32) (r uintptr) {
  10535. bp := tls.Alloc(1072)
  10536. defer tls.Free(1072)
  10537. var pptr, ptr, v1 uintptr
  10538. var _ /* pw at bp+28 */ uintptr
  10539. var _ /* pwbuf at bp+32 */ [1024]uint8
  10540. var _ /* pwstore at bp+0 */ Tpasswd
  10541. _, _, _ = pptr, ptr, v1
  10542. *(*uintptr)(unsafe.Pointer(bp + 28)) = libc.UintptrFromInt32(0)
  10543. ptr = libc.UintptrFromInt32(0)
  10544. if _uidtb != libc.UintptrFromInt32(0) || _uidtb_start(tls) == 0 {
  10545. /*
  10546. * see if we have this uid cached
  10547. */
  10548. pptr = _uidtb + uintptr(uid%libc.Uint32FromInt32(m_UID_SZ))*4
  10549. ptr = *(*uintptr)(unsafe.Pointer(pptr))
  10550. if ptr != libc.UintptrFromInt32(0) && (*TUIDC)(unsafe.Pointer(ptr)).Fvalid > 0 && (*TUIDC)(unsafe.Pointer(ptr)).Fuid == uid {
  10551. /*
  10552. * have an entry for this uid
  10553. */
  10554. if !(noname != 0) || (*TUIDC)(unsafe.Pointer(ptr)).Fvalid == int32(m_VALID) {
  10555. return ptr + 4
  10556. }
  10557. return libc.UintptrFromInt32(0)
  10558. }
  10559. if ptr == libc.UintptrFromInt32(0) {
  10560. v1 = libc.Xmalloc(tls, uint32(40))
  10561. ptr = v1
  10562. *(*uintptr)(unsafe.Pointer(pptr)) = v1
  10563. }
  10564. }
  10565. libc.Xgetpwuid_r(tls, uid, bp, bp+32, uint32(1024), bp+28)
  10566. if *(*uintptr)(unsafe.Pointer(bp + 28)) == libc.UintptrFromInt32(0) {
  10567. /*
  10568. * no match for this uid in the local password file
  10569. * a string that is the uid in numeric format
  10570. */
  10571. if ptr == libc.UintptrFromInt32(0) {
  10572. return libc.UintptrFromInt32(0)
  10573. }
  10574. (*TUIDC)(unsafe.Pointer(ptr)).Fuid = uid
  10575. libc.X__builtin_snprintf(tls, ptr+4, uint32(m_UNMLEN), __ccgo_ts+320, libc.VaList(bp+1064, uid))
  10576. (*TUIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_INVALID)
  10577. if noname != 0 {
  10578. return libc.UintptrFromInt32(0)
  10579. }
  10580. } else {
  10581. /*
  10582. * there is an entry for this uid in the password file
  10583. */
  10584. if ptr == libc.UintptrFromInt32(0) {
  10585. return (*Tpasswd)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 28)))).Fpw_name
  10586. }
  10587. (*TUIDC)(unsafe.Pointer(ptr)).Fuid = uid
  10588. Xstrlcpy(tls, ptr+4, (*Tpasswd)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 28)))).Fpw_name, uint32(32))
  10589. (*TUIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_VALID)
  10590. }
  10591. return ptr + 4
  10592. }
  10593. // C documentation
  10594. //
  10595. // /*
  10596. // * group_from_gid()
  10597. // * caches the name (if any) for the gid. If noname clear, we always
  10598. // * return the stored name (if valid or invalid match).
  10599. // * We use a simple hash table.
  10600. // * Return:
  10601. // * Pointer to stored name (or a empty string)
  10602. // */
  10603. func Xgroup_from_gid(tls *libc.TLS, gid Tgid_t, noname int32) (r uintptr) {
  10604. bp := tls.Alloc(1872)
  10605. defer tls.Free(1872)
  10606. var pptr, ptr, v1 uintptr
  10607. var _ /* gr at bp+16 */ uintptr
  10608. var _ /* grbuf at bp+20 */ [1824]uint8
  10609. var _ /* grstore at bp+0 */ Tgroup
  10610. _, _, _ = pptr, ptr, v1
  10611. *(*uintptr)(unsafe.Pointer(bp + 16)) = libc.UintptrFromInt32(0)
  10612. ptr = libc.UintptrFromInt32(0)
  10613. if _gidtb != libc.UintptrFromInt32(0) || _gidtb_start(tls) == 0 {
  10614. /*
  10615. * see if we have this gid cached
  10616. */
  10617. pptr = _gidtb + uintptr(gid%libc.Uint32FromInt32(m_GID_SZ))*4
  10618. ptr = *(*uintptr)(unsafe.Pointer(pptr))
  10619. if ptr != libc.UintptrFromInt32(0) && (*TGIDC)(unsafe.Pointer(ptr)).Fvalid > 0 && (*TGIDC)(unsafe.Pointer(ptr)).Fgid == gid {
  10620. /*
  10621. * have an entry for this gid
  10622. */
  10623. if !(noname != 0) || (*TGIDC)(unsafe.Pointer(ptr)).Fvalid == int32(m_VALID) {
  10624. return ptr + 4
  10625. }
  10626. return libc.UintptrFromInt32(0)
  10627. }
  10628. if ptr == libc.UintptrFromInt32(0) {
  10629. v1 = libc.Xmalloc(tls, uint32(40))
  10630. ptr = v1
  10631. *(*uintptr)(unsafe.Pointer(pptr)) = v1
  10632. }
  10633. }
  10634. libc.Xgetgrgid_r(tls, gid, bp, bp+20, uint32(1824), bp+16)
  10635. if *(*uintptr)(unsafe.Pointer(bp + 16)) == libc.UintptrFromInt32(0) {
  10636. /*
  10637. * no match for this gid in the local group file, put in
  10638. * a string that is the gid in numeric format
  10639. */
  10640. if ptr == libc.UintptrFromInt32(0) {
  10641. return libc.UintptrFromInt32(0)
  10642. }
  10643. (*TGIDC)(unsafe.Pointer(ptr)).Fgid = gid
  10644. libc.X__builtin_snprintf(tls, ptr+4, uint32(m_GNMLEN), __ccgo_ts+320, libc.VaList(bp+1856, gid))
  10645. (*TGIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_INVALID)
  10646. if noname != 0 {
  10647. return libc.UintptrFromInt32(0)
  10648. }
  10649. } else {
  10650. /*
  10651. * there is an entry for this group in the group file
  10652. */
  10653. if ptr == libc.UintptrFromInt32(0) {
  10654. return (*Tgroup)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))).Fgr_name
  10655. }
  10656. (*TGIDC)(unsafe.Pointer(ptr)).Fgid = gid
  10657. Xstrlcpy(tls, ptr+4, (*Tgroup)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))).Fgr_name, uint32(32))
  10658. (*TGIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_VALID)
  10659. }
  10660. return ptr + 4
  10661. }
  10662. // C documentation
  10663. //
  10664. // /*
  10665. // * uid_from_user()
  10666. // * caches the uid for a given user name. We use a simple hash table.
  10667. // * Return:
  10668. // * 0 if the user name is found (filling in uid), -1 otherwise
  10669. // */
  10670. func Xuid_from_user(tls *libc.TLS, name uintptr, uid uintptr) (r int32) {
  10671. bp := tls.Alloc(1056)
  10672. defer tls.Free(1056)
  10673. var namelen, v1 Tsize_t
  10674. var pptr, ptr, v3 uintptr
  10675. var v2 bool
  10676. var v4 Tuid_t
  10677. var _ /* pw at bp+28 */ uintptr
  10678. var _ /* pwbuf at bp+32 */ [1024]uint8
  10679. var _ /* pwstore at bp+0 */ Tpasswd
  10680. _, _, _, _, _, _, _ = namelen, pptr, ptr, v1, v2, v3, v4
  10681. *(*uintptr)(unsafe.Pointer(bp + 28)) = libc.UintptrFromInt32(0)
  10682. ptr = libc.UintptrFromInt32(0)
  10683. /*
  10684. * return -1 for mangled names
  10685. */
  10686. if v2 = name == libc.UintptrFromInt32(0); !v2 {
  10687. v1 = libc.Xstrlen(tls, name)
  10688. namelen = v1
  10689. }
  10690. if v2 || v1 == uint32(0) {
  10691. return -int32(1)
  10692. }
  10693. if _usrtb != libc.UintptrFromInt32(0) || _usrtb_start(tls) == 0 {
  10694. /*
  10695. * look up in hash table, if found and valid return the uid,
  10696. * if found and invalid, return a -1
  10697. */
  10698. pptr = _usrtb + uintptr(_st_hash(tls, name, namelen, int32(m_UNM_SZ)))*4
  10699. ptr = *(*uintptr)(unsafe.Pointer(pptr))
  10700. if ptr != libc.UintptrFromInt32(0) && (*TUIDC)(unsafe.Pointer(ptr)).Fvalid > 0 && libc.Xstrcmp(tls, name, ptr+4) == 0 {
  10701. if (*TUIDC)(unsafe.Pointer(ptr)).Fvalid == int32(m_INVALID) {
  10702. return -int32(1)
  10703. }
  10704. *(*Tuid_t)(unsafe.Pointer(uid)) = (*TUIDC)(unsafe.Pointer(ptr)).Fuid
  10705. return 0
  10706. }
  10707. if ptr == libc.UintptrFromInt32(0) {
  10708. v3 = libc.Xmalloc(tls, uint32(40))
  10709. ptr = v3
  10710. *(*uintptr)(unsafe.Pointer(pptr)) = v3
  10711. }
  10712. }
  10713. /*
  10714. * no match, look it up, if no match store it as an invalid entry,
  10715. * or store the matching uid
  10716. */
  10717. libc.Xgetpwnam_r(tls, name, bp, bp+32, uint32(1024), bp+28)
  10718. if ptr == libc.UintptrFromInt32(0) {
  10719. if *(*uintptr)(unsafe.Pointer(bp + 28)) == libc.UintptrFromInt32(0) {
  10720. return -int32(1)
  10721. }
  10722. *(*Tuid_t)(unsafe.Pointer(uid)) = (*Tpasswd)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 28)))).Fpw_uid
  10723. return 0
  10724. }
  10725. Xstrlcpy(tls, ptr+4, name, uint32(32))
  10726. if *(*uintptr)(unsafe.Pointer(bp + 28)) == libc.UintptrFromInt32(0) {
  10727. (*TUIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_INVALID)
  10728. return -int32(1)
  10729. }
  10730. (*TUIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_VALID)
  10731. v4 = (*Tpasswd)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 28)))).Fpw_uid
  10732. (*TUIDC)(unsafe.Pointer(ptr)).Fuid = v4
  10733. *(*Tuid_t)(unsafe.Pointer(uid)) = v4
  10734. return 0
  10735. }
  10736. // C documentation
  10737. //
  10738. // /*
  10739. // * gid_from_group()
  10740. // * caches the gid for a given group name. We use a simple hash table.
  10741. // * Return:
  10742. // * 0 if the group name is found (filling in gid), -1 otherwise
  10743. // */
  10744. func Xgid_from_group(tls *libc.TLS, name uintptr, gid uintptr) (r int32) {
  10745. bp := tls.Alloc(1856)
  10746. defer tls.Free(1856)
  10747. var namelen, v1 Tsize_t
  10748. var pptr, ptr, v3 uintptr
  10749. var v2 bool
  10750. var v4 Tgid_t
  10751. var _ /* gr at bp+16 */ uintptr
  10752. var _ /* grbuf at bp+20 */ [1824]uint8
  10753. var _ /* grstore at bp+0 */ Tgroup
  10754. _, _, _, _, _, _, _ = namelen, pptr, ptr, v1, v2, v3, v4
  10755. *(*uintptr)(unsafe.Pointer(bp + 16)) = libc.UintptrFromInt32(0)
  10756. ptr = libc.UintptrFromInt32(0)
  10757. /*
  10758. * return -1 for mangled names
  10759. */
  10760. if v2 = name == libc.UintptrFromInt32(0); !v2 {
  10761. v1 = libc.Xstrlen(tls, name)
  10762. namelen = v1
  10763. }
  10764. if v2 || v1 == uint32(0) {
  10765. return -int32(1)
  10766. }
  10767. if _grptb != libc.UintptrFromInt32(0) || _grptb_start(tls) == 0 {
  10768. /*
  10769. * look up in hash table, if found and valid return the uid,
  10770. * if found and invalid, return a -1
  10771. */
  10772. pptr = _grptb + uintptr(_st_hash(tls, name, namelen, int32(m_GID_SZ)))*4
  10773. ptr = *(*uintptr)(unsafe.Pointer(pptr))
  10774. if ptr != libc.UintptrFromInt32(0) && (*TGIDC)(unsafe.Pointer(ptr)).Fvalid > 0 && libc.Xstrcmp(tls, name, ptr+4) == 0 {
  10775. if (*TGIDC)(unsafe.Pointer(ptr)).Fvalid == int32(m_INVALID) {
  10776. return -int32(1)
  10777. }
  10778. *(*Tgid_t)(unsafe.Pointer(gid)) = (*TGIDC)(unsafe.Pointer(ptr)).Fgid
  10779. return 0
  10780. }
  10781. if ptr == libc.UintptrFromInt32(0) {
  10782. v3 = libc.Xmalloc(tls, uint32(40))
  10783. ptr = v3
  10784. *(*uintptr)(unsafe.Pointer(pptr)) = v3
  10785. }
  10786. }
  10787. /*
  10788. * no match, look it up, if no match store it as an invalid entry,
  10789. * or store the matching gid
  10790. */
  10791. libc.Xgetgrnam_r(tls, name, bp, bp+20, uint32(1824), bp+16)
  10792. if ptr == libc.UintptrFromInt32(0) {
  10793. if *(*uintptr)(unsafe.Pointer(bp + 16)) == libc.UintptrFromInt32(0) {
  10794. return -int32(1)
  10795. }
  10796. *(*Tgid_t)(unsafe.Pointer(gid)) = (*Tgroup)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))).Fgr_gid
  10797. return 0
  10798. }
  10799. Xstrlcpy(tls, ptr+4, name, uint32(32))
  10800. if *(*uintptr)(unsafe.Pointer(bp + 16)) == libc.UintptrFromInt32(0) {
  10801. (*TGIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_INVALID)
  10802. return -int32(1)
  10803. }
  10804. (*TGIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_VALID)
  10805. v4 = (*Tgroup)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))).Fgr_gid
  10806. (*TGIDC)(unsafe.Pointer(ptr)).Fgid = v4
  10807. *(*Tgid_t)(unsafe.Pointer(gid)) = v4
  10808. return 0
  10809. }
  10810. const m_SIZE = 512
  10811. const m_THRESHOLD1 = 20
  10812. type Tstack = struct {
  10813. Fsa uintptr
  10814. Fsn int32
  10815. Fsi int32
  10816. }
  10817. func Xradixsort(tls *libc.TLS, a uintptr, n int32, tab uintptr, endch uint32) (r int32) {
  10818. bp := tls.Alloc(256)
  10819. defer tls.Free(256)
  10820. var c uint32
  10821. var tr uintptr
  10822. var _ /* tr0 at bp+0 */ [256]uint8
  10823. _, _ = c, tr
  10824. if tab == libc.UintptrFromInt32(0) {
  10825. tr = bp
  10826. c = uint32(0)
  10827. for {
  10828. if !(c < endch) {
  10829. break
  10830. }
  10831. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(c + uint32(1))
  10832. goto _1
  10833. _1:
  10834. ;
  10835. c++
  10836. }
  10837. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(0)
  10838. c++
  10839. for {
  10840. if !(c < uint32(256)) {
  10841. break
  10842. }
  10843. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(c)
  10844. goto _2
  10845. _2:
  10846. ;
  10847. c++
  10848. }
  10849. endch = uint32(0)
  10850. } else {
  10851. endch = uint32(*(*uint8)(unsafe.Pointer(tab + uintptr(endch))))
  10852. tr = tab
  10853. if endch != uint32(0) && endch != uint32(255) {
  10854. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  10855. return -int32(1)
  10856. }
  10857. }
  10858. _r_sort_a(tls, a, n, 0, tr, endch)
  10859. return 0
  10860. }
  10861. func Xsradixsort(tls *libc.TLS, a uintptr, n int32, tab uintptr, endch uint32) (r int32) {
  10862. bp := tls.Alloc(256)
  10863. defer tls.Free(256)
  10864. var c uint32
  10865. var ta, tr uintptr
  10866. var _ /* tr0 at bp+0 */ [256]uint8
  10867. _, _, _ = c, ta, tr
  10868. if a == libc.UintptrFromInt32(0) {
  10869. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EFAULT)
  10870. return -int32(1)
  10871. }
  10872. if tab == libc.UintptrFromInt32(0) {
  10873. tr = bp
  10874. c = uint32(0)
  10875. for {
  10876. if !(c < endch) {
  10877. break
  10878. }
  10879. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(c + uint32(1))
  10880. goto _1
  10881. _1:
  10882. ;
  10883. c++
  10884. }
  10885. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(0)
  10886. c++
  10887. for {
  10888. if !(c < uint32(256)) {
  10889. break
  10890. }
  10891. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(c)
  10892. goto _2
  10893. _2:
  10894. ;
  10895. c++
  10896. }
  10897. endch = uint32(0)
  10898. } else {
  10899. endch = uint32(*(*uint8)(unsafe.Pointer(tab + uintptr(endch))))
  10900. tr = tab
  10901. if endch != uint32(0) && endch != uint32(255) {
  10902. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  10903. return -int32(1)
  10904. }
  10905. }
  10906. if n < int32(m_THRESHOLD1) {
  10907. _simplesort(tls, a, n, 0, tr, endch)
  10908. } else {
  10909. ta = Xreallocarray(tls, libc.UintptrFromInt32(0), libc.Uint32FromInt32(n), uint32(4))
  10910. if ta == libc.UintptrFromInt32(0) {
  10911. return -int32(1)
  10912. }
  10913. _r_sort_b(tls, a, ta, n, 0, tr, endch)
  10914. libc.Xfree(tls, ta)
  10915. }
  10916. return 0
  10917. }
  10918. // C documentation
  10919. //
  10920. // /* Unstable, in-place sort. */
  10921. func _r_sort_a(tls *libc.TLS, a uintptr, n int32, i int32, tr uintptr, endch uint32) {
  10922. bp := tls.Alloc(7168)
  10923. defer tls.Free(7168)
  10924. var aj, ak, an, cp, r, sp, sp0, sp1, t, v1, v10, v12, v15, v16, v17, v2, v4, v6, v7, v9 uintptr
  10925. var bigc, c, v18, v5, v8 uint32
  10926. var temp Tstack
  10927. var _ /* s at bp+0 */ [512]Tstack
  10928. var _ /* top at bp+6144 */ [256]uintptr
  10929. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aj, ak, an, bigc, c, cp, r, sp, sp0, sp1, t, temp, v1, v10, v12, v15, v16, v17, v18, v2, v4, v5, v6, v7, v8, v9
  10930. /* Set up stack. */
  10931. sp = bp
  10932. (*Tstack)(unsafe.Pointer(sp)).Fsa = a
  10933. (*Tstack)(unsafe.Pointer(sp)).Fsn = n
  10934. v1 = sp
  10935. sp += 12
  10936. (*Tstack)(unsafe.Pointer(v1)).Fsi = i
  10937. for !(bp >= sp) {
  10938. sp -= 12
  10939. v2 = sp
  10940. a = (*Tstack)(unsafe.Pointer(v2)).Fsa
  10941. n = (*Tstack)(unsafe.Pointer(sp)).Fsn
  10942. i = (*Tstack)(unsafe.Pointer(sp)).Fsi
  10943. if n < int32(m_THRESHOLD1) {
  10944. _simplesort(tls, a, n, i, tr, endch)
  10945. continue
  10946. }
  10947. an = a + uintptr(n)*4
  10948. /* Make character histogram. */
  10949. if _nc == uint32(0) {
  10950. _bmin = uint32(255) /* First occupied bin, excluding eos. */
  10951. ak = a
  10952. for {
  10953. if !(ak < an) {
  10954. break
  10955. }
  10956. v4 = ak
  10957. ak += 4
  10958. c = uint32(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(v4)) + uintptr(i)))))))
  10959. v6 = uintptr(unsafe.Pointer(&_count)) + uintptr(c)*4
  10960. *(*uint32)(unsafe.Pointer(v6))++
  10961. v5 = *(*uint32)(unsafe.Pointer(v6))
  10962. if v5 == uint32(1) && c != endch {
  10963. if c < _bmin {
  10964. _bmin = c
  10965. }
  10966. _nc++
  10967. }
  10968. goto _3
  10969. _3:
  10970. }
  10971. if sp+uintptr(_nc)*12 > bp+uintptr(m_SIZE)*12 { /* Get more stack. */
  10972. _r_sort_a(tls, a, n, i, tr, endch)
  10973. continue
  10974. }
  10975. }
  10976. /*
  10977. * Special case: if all strings have the same
  10978. * character at position i, move on to the next
  10979. * character.
  10980. */
  10981. if _nc == uint32(1) && _count[_bmin] == libc.Uint32FromInt32(n) {
  10982. (*Tstack)(unsafe.Pointer(sp)).Fsa = a
  10983. (*Tstack)(unsafe.Pointer(sp)).Fsn = n
  10984. v7 = sp
  10985. sp += 12
  10986. (*Tstack)(unsafe.Pointer(v7)).Fsi = i + libc.Int32FromInt32(1)
  10987. v8 = libc.Uint32FromInt32(0)
  10988. _count[_bmin] = v8
  10989. _nc = v8
  10990. continue
  10991. }
  10992. /*
  10993. * Set top[]; push incompletely sorted bins onto stack.
  10994. * top[] = pointers to last out-of-place element in bins.
  10995. * count[] = counts of elements in bins.
  10996. * Before permuting: top[c-1] + count[c] = top[c];
  10997. * during deal: top[c] counts down to top[c-1].
  10998. */
  10999. v9 = sp
  11000. sp1 = v9
  11001. sp0 = v9 /* Stack position of biggest bin. */
  11002. bigc = uint32(2) /* Size of biggest bin. */
  11003. if endch == uint32(0) { /* Special case: set top[eos]. */
  11004. v10 = a + uintptr(_count[0])*4
  11005. ak = v10
  11006. (*(*[256]uintptr)(unsafe.Pointer(bp + 6144)))[0] = v10
  11007. } else {
  11008. ak = a
  11009. (*(*[256]uintptr)(unsafe.Pointer(bp + 6144)))[int32(255)] = an
  11010. }
  11011. cp = uintptr(unsafe.Pointer(&_count)) + uintptr(_bmin)*4
  11012. for {
  11013. if !(_nc > uint32(0)) {
  11014. break
  11015. }
  11016. for *(*uint32)(unsafe.Pointer(cp)) == uint32(0) { /* Find next non-empty pile. */
  11017. cp += 4
  11018. }
  11019. if *(*uint32)(unsafe.Pointer(cp)) > uint32(1) {
  11020. if *(*uint32)(unsafe.Pointer(cp)) > bigc {
  11021. bigc = *(*uint32)(unsafe.Pointer(cp))
  11022. sp1 = sp
  11023. }
  11024. (*Tstack)(unsafe.Pointer(sp)).Fsa = ak
  11025. (*Tstack)(unsafe.Pointer(sp)).Fsn = libc.Int32FromUint32(*(*uint32)(unsafe.Pointer(cp)))
  11026. v12 = sp
  11027. sp += 12
  11028. (*Tstack)(unsafe.Pointer(v12)).Fsi = i + libc.Int32FromInt32(1)
  11029. }
  11030. ak += uintptr(*(*uint32)(unsafe.Pointer(cp))) * 4
  11031. (*(*[256]uintptr)(unsafe.Pointer(bp + 6144)))[(int32(cp)-t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_count))))/4] = ak
  11032. _nc--
  11033. goto _11
  11034. _11:
  11035. ;
  11036. cp += 4
  11037. }
  11038. temp = *(*Tstack)(unsafe.Pointer(sp0))
  11039. *(*Tstack)(unsafe.Pointer(sp0)) = *(*Tstack)(unsafe.Pointer(sp1))
  11040. *(*Tstack)(unsafe.Pointer(sp1)) = temp /* Play it safe -- biggest bin last. */
  11041. /*
  11042. * Permute misplacements home. Already home: everything
  11043. * before aj, and in bin[c], items from top[c] on.
  11044. * Inner loop:
  11045. * r = next element to put in place;
  11046. * ak = top[r[i]] = location to put the next element.
  11047. * aj = bottom of 1st disordered bin.
  11048. * Outer loop:
  11049. * Once the 1st disordered bin is done, ie. aj >= ak,
  11050. * aj<-aj + count[c] connects the bins in a linked list;
  11051. * reset count[c].
  11052. */
  11053. aj = a
  11054. for {
  11055. if !(aj < an) {
  11056. break
  11057. }
  11058. r = *(*uintptr)(unsafe.Pointer(aj))
  11059. for {
  11060. v18 = uint32(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(r + uintptr(i)))))))
  11061. c = v18
  11062. v17 = bp + 6144 + uintptr(v18)*4
  11063. *(*uintptr)(unsafe.Pointer(v17)) -= 4
  11064. v16 = *(*uintptr)(unsafe.Pointer(v17))
  11065. v15 = v16
  11066. ak = v15
  11067. if !(aj < v15) {
  11068. break
  11069. }
  11070. t = *(*uintptr)(unsafe.Pointer(ak))
  11071. *(*uintptr)(unsafe.Pointer(ak)) = r
  11072. r = t
  11073. goto _14
  11074. _14:
  11075. }
  11076. goto _13
  11077. _13:
  11078. ;
  11079. *(*uintptr)(unsafe.Pointer(aj)) = r
  11080. aj += uintptr(_count[c]) * 4
  11081. _count[c] = libc.Uint32FromInt32(0)
  11082. }
  11083. }
  11084. }
  11085. var _count [256]uint32
  11086. var _nc uint32
  11087. var _bmin uint32
  11088. // C documentation
  11089. //
  11090. // /* Stable sort, requiring additional memory. */
  11091. func _r_sort_b(tls *libc.TLS, a uintptr, ta uintptr, n int32, i int32, tr uintptr, endch uint32) {
  11092. bp := tls.Alloc(7168)
  11093. defer tls.Free(7168)
  11094. var ai, ak, cp, sp, sp0, sp1, v1, v11, v13, v14, v16, v17, v18, v2, v4, v6, v7, v8 uintptr
  11095. var bigc, c, v10, v5 uint32
  11096. var temp Tstack
  11097. var _ /* s at bp+0 */ [512]Tstack
  11098. var _ /* top at bp+6144 */ [256]uintptr
  11099. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ai, ak, bigc, c, cp, sp, sp0, sp1, temp, v1, v10, v11, v13, v14, v16, v17, v18, v2, v4, v5, v6, v7, v8
  11100. sp = bp
  11101. (*Tstack)(unsafe.Pointer(sp)).Fsa = a
  11102. (*Tstack)(unsafe.Pointer(sp)).Fsn = n
  11103. v1 = sp
  11104. sp += 12
  11105. (*Tstack)(unsafe.Pointer(v1)).Fsi = i
  11106. for !(bp >= sp) {
  11107. sp -= 12
  11108. v2 = sp
  11109. a = (*Tstack)(unsafe.Pointer(v2)).Fsa
  11110. n = (*Tstack)(unsafe.Pointer(sp)).Fsn
  11111. i = (*Tstack)(unsafe.Pointer(sp)).Fsi
  11112. if n < int32(m_THRESHOLD1) {
  11113. _simplesort(tls, a, n, i, tr, endch)
  11114. continue
  11115. }
  11116. if _nc1 == uint32(0) {
  11117. _bmin1 = uint32(255)
  11118. ak = a + uintptr(n)*4
  11119. for {
  11120. ak -= 4
  11121. v4 = ak
  11122. if !(v4 >= a) {
  11123. break
  11124. }
  11125. c = uint32(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ak)) + uintptr(i)))))))
  11126. v6 = uintptr(unsafe.Pointer(&_count1)) + uintptr(c)*4
  11127. *(*uint32)(unsafe.Pointer(v6))++
  11128. v5 = *(*uint32)(unsafe.Pointer(v6))
  11129. if v5 == uint32(1) && c != endch {
  11130. if c < _bmin1 {
  11131. _bmin1 = c
  11132. }
  11133. _nc1++
  11134. }
  11135. goto _3
  11136. _3:
  11137. }
  11138. if sp+uintptr(_nc1)*12 > bp+uintptr(m_SIZE)*12 {
  11139. _r_sort_b(tls, a, ta, n, i, tr, endch)
  11140. continue
  11141. }
  11142. }
  11143. v7 = sp
  11144. sp1 = v7
  11145. sp0 = v7
  11146. bigc = uint32(2)
  11147. if endch == uint32(0) {
  11148. v8 = a + uintptr(_count1[0])*4
  11149. ak = v8
  11150. (*(*[256]uintptr)(unsafe.Pointer(bp + 6144)))[0] = v8
  11151. _count1[0] = uint32(0)
  11152. } else {
  11153. ak = a
  11154. (*(*[256]uintptr)(unsafe.Pointer(bp + 6144)))[int32(255)] = a + uintptr(n)*4
  11155. _count1[int32(255)] = uint32(0)
  11156. }
  11157. cp = uintptr(unsafe.Pointer(&_count1)) + uintptr(_bmin1)*4
  11158. for {
  11159. if !(_nc1 > uint32(0)) {
  11160. break
  11161. }
  11162. for *(*uint32)(unsafe.Pointer(cp)) == uint32(0) {
  11163. cp += 4
  11164. }
  11165. v10 = *(*uint32)(unsafe.Pointer(cp))
  11166. c = v10
  11167. if v10 > uint32(1) {
  11168. if c > bigc {
  11169. bigc = c
  11170. sp1 = sp
  11171. }
  11172. (*Tstack)(unsafe.Pointer(sp)).Fsa = ak
  11173. (*Tstack)(unsafe.Pointer(sp)).Fsn = libc.Int32FromUint32(c)
  11174. v11 = sp
  11175. sp += 12
  11176. (*Tstack)(unsafe.Pointer(v11)).Fsi = i + libc.Int32FromInt32(1)
  11177. }
  11178. ak += uintptr(c) * 4
  11179. (*(*[256]uintptr)(unsafe.Pointer(bp + 6144)))[(int32(cp)-t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_count1))))/4] = ak
  11180. *(*uint32)(unsafe.Pointer(cp)) = uint32(0) /* Reset count[]. */
  11181. _nc1--
  11182. goto _9
  11183. _9:
  11184. ;
  11185. cp += 4
  11186. }
  11187. temp = *(*Tstack)(unsafe.Pointer(sp0))
  11188. *(*Tstack)(unsafe.Pointer(sp0)) = *(*Tstack)(unsafe.Pointer(sp1))
  11189. *(*Tstack)(unsafe.Pointer(sp1)) = temp
  11190. ak = ta + uintptr(n)*4
  11191. ai = a + uintptr(n)*4
  11192. for {
  11193. if !(ak > ta) {
  11194. break
  11195. } /* Copy to temp. */
  11196. ak -= 4
  11197. v13 = ak
  11198. ai -= 4
  11199. v14 = ai
  11200. *(*uintptr)(unsafe.Pointer(v13)) = *(*uintptr)(unsafe.Pointer(v14))
  11201. goto _12
  11202. _12:
  11203. }
  11204. ak = ta + uintptr(n)*4
  11205. for {
  11206. ak -= 4
  11207. v16 = ak
  11208. if !(v16 >= ta) {
  11209. break
  11210. } /* Deal to piles. */
  11211. v18 = bp + 6144 + uintptr(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ak)) + uintptr(i)))))))*4
  11212. *(*uintptr)(unsafe.Pointer(v18)) -= 4
  11213. v17 = *(*uintptr)(unsafe.Pointer(v18))
  11214. *(*uintptr)(unsafe.Pointer(v17)) = *(*uintptr)(unsafe.Pointer(ak))
  11215. goto _15
  11216. _15:
  11217. }
  11218. }
  11219. }
  11220. var _count1 [256]uint32
  11221. var _nc1 uint32
  11222. var _bmin1 uint32
  11223. // C documentation
  11224. //
  11225. // /* insertion sort */
  11226. func _simplesort(tls *libc.TLS, a uintptr, n int32, b int32, tr uintptr, endch uint32) {
  11227. var ai, ak, s, t uintptr
  11228. var ch, v5 uint8
  11229. var v2 int32
  11230. _, _, _, _, _, _, _ = ai, ak, ch, s, t, v2, v5
  11231. ak = a + uintptr(1)*4
  11232. for {
  11233. n--
  11234. v2 = n
  11235. if !(v2 >= int32(1)) {
  11236. break
  11237. }
  11238. ai = ak
  11239. for {
  11240. if !(ai > a) {
  11241. break
  11242. }
  11243. s = *(*uintptr)(unsafe.Pointer(ai)) + uintptr(b)
  11244. t = *(*uintptr)(unsafe.Pointer(ai + uintptr(-libc.Int32FromInt32(1))*4)) + uintptr(b)
  11245. for {
  11246. v5 = *(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(s)))))
  11247. ch = v5
  11248. if !(uint32(v5) != endch) {
  11249. break
  11250. }
  11251. if libc.Int32FromUint8(ch) != libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(t)))))) {
  11252. break
  11253. }
  11254. goto _4
  11255. _4:
  11256. ;
  11257. s++
  11258. t++
  11259. }
  11260. if libc.Int32FromUint8(ch) >= libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(t)))))) {
  11261. break
  11262. }
  11263. s = *(*uintptr)(unsafe.Pointer(ai))
  11264. *(*uintptr)(unsafe.Pointer(ai)) = *(*uintptr)(unsafe.Pointer(ai + uintptr(-libc.Int32FromInt32(1))*4))
  11265. *(*uintptr)(unsafe.Pointer(ai + uintptr(-libc.Int32FromInt32(1))*4)) = s
  11266. goto _3
  11267. _3:
  11268. ;
  11269. ai -= 4
  11270. }
  11271. goto _1
  11272. _1:
  11273. ;
  11274. ak += 4
  11275. }
  11276. }
  11277. const m_B0 = 0000000
  11278. const m_B1000000 = 0010010
  11279. const m_B110 = 0000003
  11280. const m_B115200 = 0010002
  11281. const m_B1152000 = 0010011
  11282. const m_B1200 = 0000011
  11283. const m_B134 = 0000004
  11284. const m_B150 = 0000005
  11285. const m_B1500000 = 0010012
  11286. const m_B1800 = 0000012
  11287. const m_B19200 = 0000016
  11288. const m_B200 = 0000006
  11289. const m_B2000000 = 0010013
  11290. const m_B230400 = 0010003
  11291. const m_B2400 = 0000013
  11292. const m_B2500000 = 0010014
  11293. const m_B300 = 0000007
  11294. const m_B3000000 = 0010015
  11295. const m_B3500000 = 0010016
  11296. const m_B38400 = 0000017
  11297. const m_B4000000 = 0010017
  11298. const m_B460800 = 0010004
  11299. const m_B4800 = 0000014
  11300. const m_B50 = 0000001
  11301. const m_B500000 = 0010005
  11302. const m_B57600 = 0010001
  11303. const m_B576000 = 0010006
  11304. const m_B600 = 0000010
  11305. const m_B75 = 0000002
  11306. const m_B921600 = 0010007
  11307. const m_B9600 = 0000015
  11308. const m_BRKINT = 0000002
  11309. const m_BS0 = 0000000
  11310. const m_BS1 = 0020000
  11311. const m_BSDLY = 0020000
  11312. const m_CBAUD = 0010017
  11313. const m_CBAUDEX = 0010000
  11314. const m_CIBAUD = 002003600000
  11315. const m_CLOCAL = 0004000
  11316. const m_CMSPAR = 010000000000
  11317. const m_CR0 = 0000000
  11318. const m_CR1 = 0001000
  11319. const m_CR2 = 0002000
  11320. const m_CR3 = 0003000
  11321. const m_CRDLY = 0003000
  11322. const m_CREAD = 0000200
  11323. const m_CRTSCTS = 020000000000
  11324. const m_CS5 = 0000000
  11325. const m_CS6 = 0000020
  11326. const m_CS7 = 0000040
  11327. const m_CS8 = 0000060
  11328. const m_CSIZE = 0000060
  11329. const m_CSTOPB = 0000100
  11330. const m_ECHO = 8
  11331. const m_ECHOCTL = 0001000
  11332. const m_ECHOE = 0000020
  11333. const m_ECHOK = 0000040
  11334. const m_ECHOKE = 0004000
  11335. const m_ECHONL = 64
  11336. const m_ECHOPRT = 0002000
  11337. const m_EXTA = 0000016
  11338. const m_EXTB = 0000017
  11339. const m_EXTPROC = 0200000
  11340. const m_FF0 = 0000000
  11341. const m_FF1 = 0100000
  11342. const m_FFDLY = 0100000
  11343. const m_FLUSHO = 0010000
  11344. const m_HUPCL = 0002000
  11345. const m_ICANON = 0000002
  11346. const m_ICRNL = 0000400
  11347. const m_IEXTEN = 0100000
  11348. const m_IGNBRK = 0000001
  11349. const m_IGNCR = 0000200
  11350. const m_IGNPAR = 0000004
  11351. const m_IMAXBEL = 0020000
  11352. const m_INLCR = 0000100
  11353. const m_INPCK = 0000020
  11354. const m_ISIG = 0000001
  11355. const m_ISTRIP = 0000040
  11356. const m_IUCLC = 0001000
  11357. const m_IUTF8 = 0040000
  11358. const m_IXANY = 0004000
  11359. const m_IXOFF = 0010000
  11360. const m_IXON = 0002000
  11361. const m_NCCS = 32
  11362. const m_NL0 = 0000000
  11363. const m_NL1 = 0000400
  11364. const m_NLDLY = 0000400
  11365. const m_NOFLSH = 0000200
  11366. const m_OCRNL = 0000010
  11367. const m_OFDEL = 0000200
  11368. const m_OFILL = 0000100
  11369. const m_OLCUC = 0000002
  11370. const m_ONLCR = 0000004
  11371. const m_ONLRET = 0000040
  11372. const m_ONOCR = 0000020
  11373. const m_OPOST = 0000001
  11374. const m_O_CREAT4 = 0100
  11375. const m_O_NONBLOCK4 = 04000
  11376. const m_O_RDONLY2 = 00
  11377. const m_O_RDWR1 = 2
  11378. const m_O_TRUNC4 = 01000
  11379. const m_O_WRONLY2 = 01
  11380. const m_PARENB = 0000400
  11381. const m_PARMRK = 0000010
  11382. const m_PARODD = 0001000
  11383. const m_PENDIN = 0040000
  11384. const m_RPP_ECHO_OFF = 0x00
  11385. const m_RPP_ECHO_ON = 1
  11386. const m_RPP_FORCELOWER = 4
  11387. const m_RPP_FORCEUPPER = 8
  11388. const m_RPP_REQUIRE_TTY = 2
  11389. const m_RPP_SEVENBIT = 16
  11390. const m_RPP_STDIN = 32
  11391. const m_TAB0 = 0000000
  11392. const m_TAB1 = 0004000
  11393. const m_TAB2 = 0010000
  11394. const m_TAB3 = 0014000
  11395. const m_TABDLY = 0014000
  11396. const m_TCIFLUSH = 0
  11397. const m_TCIOFF = 2
  11398. const m_TCIOFLUSH = 2
  11399. const m_TCION = 3
  11400. const m_TCOFLUSH = 1
  11401. const m_TCOOFF = 0
  11402. const m_TCOON = 1
  11403. const m_TCSADRAIN = 1
  11404. const m_TCSAFLUSH = 2
  11405. const m_TCSANOW = 0
  11406. const m_TCSASOFT = 0
  11407. const m_TOSTOP = 0000400
  11408. const m_VDISCARD = 13
  11409. const m_VEOF = 4
  11410. const m_VEOL = 11
  11411. const m_VEOL2 = 16
  11412. const m_VERASE = 2
  11413. const m_VINTR = 0
  11414. const m_VKILL = 3
  11415. const m_VLNEXT = 15
  11416. const m_VMIN = 6
  11417. const m_VQUIT = 1
  11418. const m_VREPRINT = 12
  11419. const m_VSTART = 8
  11420. const m_VSTOP = 9
  11421. const m_VSUSP = 10
  11422. const m_VSWTC = 7
  11423. const m_VT0 = 0000000
  11424. const m_VT1 = 0040000
  11425. const m_VTDLY = 0040000
  11426. const m_VTIME = 5
  11427. const m_VWERASE = 14
  11428. const m_XCASE = 0000004
  11429. const m_XTABS = 0014000
  11430. const m__PATH_BSHELL = "/bin/sh"
  11431. const m__PATH_CONSOLE = "/dev/console"
  11432. const m__PATH_DEFPATH = "/usr/local/bin:/bin:/usr/bin"
  11433. const m__PATH_DEV = "/dev/"
  11434. const m__PATH_DEVNULL = "/dev/null"
  11435. const m__PATH_KLOG = "/proc/kmsg"
  11436. const m__PATH_LASTLOG = "/var/log/lastlog"
  11437. const m__PATH_MAILDIR = "/var/mail"
  11438. const m__PATH_MAN = "/usr/share/man"
  11439. const m__PATH_MNTTAB = "/etc/fstab"
  11440. const m__PATH_MOUNTED = "/etc/mtab"
  11441. const m__PATH_NOLOGIN = "/etc/nologin"
  11442. const m__PATH_SENDMAIL = "/usr/sbin/sendmail"
  11443. const m__PATH_SHADOW = "/etc/shadow"
  11444. const m__PATH_SHELLS = "/etc/shells"
  11445. const m__PATH_STDPATH = "/bin:/usr/bin:/sbin:/usr/sbin"
  11446. const m__PATH_TMP = "/tmp/"
  11447. const m__PATH_TTY = "/dev/tty"
  11448. const m__PATH_UTMP = "/dev/null/utmp"
  11449. const m__PATH_VARDB = "/var/lib/misc/"
  11450. const m__PATH_VARRUN = "/var/run/"
  11451. const m__PATH_VARTMP = "/var/tmp/"
  11452. const m__PATH_VI = "/usr/bin/vi"
  11453. const m__PATH_WTMP = "/dev/null/wtmp"
  11454. type Twinsize = struct {
  11455. Fws_row uint16
  11456. Fws_col uint16
  11457. Fws_xpixel uint16
  11458. Fws_ypixel uint16
  11459. }
  11460. type Tcc_t = uint8
  11461. type Tspeed_t = uint32
  11462. type Ttcflag_t = uint32
  11463. type Ttermios = struct {
  11464. Fc_iflag Ttcflag_t
  11465. Fc_oflag Ttcflag_t
  11466. Fc_cflag Ttcflag_t
  11467. Fc_lflag Ttcflag_t
  11468. Fc_line Tcc_t
  11469. Fc_cc [32]Tcc_t
  11470. F__c_ispeed Tspeed_t
  11471. F__c_ospeed Tspeed_t
  11472. }
  11473. var _signo [65]Tsig_atomic_t
  11474. func Xreadpassphrase(tls *libc.TLS, prompt uintptr, buf uintptr, bufsiz Tsize_t, flags int32) (r uintptr) {
  11475. bp := tls.Alloc(1536)
  11476. defer tls.Free(1536)
  11477. var end, p, v6, v8 uintptr
  11478. var i, input, need_restart, output, save_errno, sigttou, v2, v3 int32
  11479. var nr, v5 Tssize_t
  11480. var v4 bool
  11481. var _ /* ch at bp+0 */ uint8
  11482. var _ /* oterm at bp+64 */ Ttermios
  11483. var _ /* sa at bp+124 */ Tsigaction
  11484. var _ /* savealrm at bp+264 */ Tsigaction
  11485. var _ /* savehup at bp+544 */ Tsigaction
  11486. var _ /* saveint at bp+404 */ Tsigaction
  11487. var _ /* savepipe at bp+1384 */ Tsigaction
  11488. var _ /* savequit at bp+684 */ Tsigaction
  11489. var _ /* saveterm at bp+824 */ Tsigaction
  11490. var _ /* savetstp at bp+964 */ Tsigaction
  11491. var _ /* savettin at bp+1104 */ Tsigaction
  11492. var _ /* savettou at bp+1244 */ Tsigaction
  11493. var _ /* term at bp+4 */ Ttermios
  11494. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = end, i, input, need_restart, nr, output, p, save_errno, sigttou, v2, v3, v4, v5, v6, v8
  11495. /* I suppose we could alloc on demand in this case (XXX). */
  11496. if bufsiz == uint32(0) {
  11497. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11498. return libc.UintptrFromInt32(0)
  11499. }
  11500. goto restart
  11501. restart:
  11502. ;
  11503. i = 0
  11504. for {
  11505. if !(i < int32(m__NSIG)) {
  11506. break
  11507. }
  11508. libc.AtomicStorePInt32(uintptr(unsafe.Pointer(&_signo))+uintptr(i)*4, 0)
  11509. goto _1
  11510. _1:
  11511. ;
  11512. i++
  11513. }
  11514. nr = -int32(1)
  11515. save_errno = 0
  11516. need_restart = 0
  11517. /*
  11518. * Read and write to /dev/tty if available. If not, read from
  11519. * stdin and write to stderr unless a tty is required.
  11520. */
  11521. if v4 = flags&int32(m_RPP_STDIN) != 0; !v4 {
  11522. v3 = libc.Xopen(tls, __ccgo_ts+323, int32(m_O_RDWR1), 0)
  11523. output = v3
  11524. v2 = v3
  11525. input = v2
  11526. }
  11527. if v4 || v2 == -int32(1) {
  11528. if flags&int32(m_RPP_REQUIRE_TTY) != 0 {
  11529. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOTTY)
  11530. return libc.UintptrFromInt32(0)
  11531. }
  11532. input = m_STDIN_FILENO
  11533. output = int32(m_STDERR_FILENO)
  11534. }
  11535. /*
  11536. * Turn off echo if possible.
  11537. * If we are using a tty but are not the foreground pgrp this will
  11538. * generate SIGTTOU, so do it *before* installing the signal handlers.
  11539. */
  11540. if input != m_STDIN_FILENO && libc.Xtcgetattr(tls, input, bp+64) == 0 {
  11541. libc.Xmemcpy(tls, bp+4, bp+64, uint32(60))
  11542. if !(flags&libc.Int32FromInt32(m_RPP_ECHO_ON) != 0) {
  11543. (*(*Ttermios)(unsafe.Pointer(bp + 4))).Fc_lflag &= libc.Uint32FromInt32(^(libc.Int32FromInt32(m_ECHO) | libc.Int32FromInt32(m_ECHONL)))
  11544. }
  11545. libc.Xtcsetattr(tls, input, libc.Int32FromInt32(m_TCSAFLUSH)|libc.Int32FromInt32(m_TCSASOFT), bp+4)
  11546. } else {
  11547. libc.Xmemset(tls, bp+4, 0, uint32(60))
  11548. (*(*Ttermios)(unsafe.Pointer(bp + 4))).Fc_lflag |= uint32(m_ECHO)
  11549. libc.Xmemset(tls, bp+64, 0, uint32(60))
  11550. (*(*Ttermios)(unsafe.Pointer(bp + 64))).Fc_lflag |= uint32(m_ECHO)
  11551. }
  11552. /*
  11553. * Catch signals that would otherwise cause the user to end
  11554. * up with echo turned off in the shell. Don't worry about
  11555. * things like SIGXCPU and SIGVTALRM for now.
  11556. */
  11557. libc.Xsigemptyset(tls, bp+124+4)
  11558. (*(*Tsigaction)(unsafe.Pointer(bp + 124))).Fsa_flags = 0 /* don't restart system calls */
  11559. *(*uintptr)(unsafe.Pointer(bp + 124)) = __ccgo_fp(_handler)
  11560. libc.Xsigaction(tls, int32(m_SIGALRM), bp+124, bp+264)
  11561. libc.Xsigaction(tls, int32(m_SIGHUP), bp+124, bp+544)
  11562. libc.Xsigaction(tls, int32(m_SIGINT), bp+124, bp+404)
  11563. libc.Xsigaction(tls, int32(m_SIGPIPE), bp+124, bp+1384)
  11564. libc.Xsigaction(tls, int32(m_SIGQUIT), bp+124, bp+684)
  11565. libc.Xsigaction(tls, int32(m_SIGTERM), bp+124, bp+824)
  11566. libc.Xsigaction(tls, int32(m_SIGTSTP), bp+124, bp+964)
  11567. libc.Xsigaction(tls, int32(m_SIGTTIN), bp+124, bp+1104)
  11568. libc.Xsigaction(tls, int32(m_SIGTTOU), bp+124, bp+1244)
  11569. if !(flags&libc.Int32FromInt32(m_RPP_STDIN) != 0) {
  11570. libc.Xwrite(tls, output, prompt, libc.Xstrlen(tls, prompt))
  11571. }
  11572. end = buf + uintptr(bufsiz) - uintptr(1)
  11573. p = buf
  11574. for {
  11575. v5 = libc.Xread(tls, input, bp, uint32(1))
  11576. nr = v5
  11577. if !(v5 == int32(1) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp))) != int32('\n') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp))) != int32('\r')) {
  11578. break
  11579. }
  11580. if p < end {
  11581. if flags&int32(m_RPP_SEVENBIT) != 0 {
  11582. *(*uint8)(unsafe.Pointer(bp)) = uint8(int32(*(*uint8)(unsafe.Pointer(bp))) & libc.Int32FromInt32(0x7f))
  11583. }
  11584. if libc.BoolInt32(uint32(*(*uint8)(unsafe.Pointer(bp)))|uint32(32)-uint32('a') < uint32(26)) != 0 {
  11585. if flags&int32(m_RPP_FORCELOWER) != 0 {
  11586. *(*uint8)(unsafe.Pointer(bp)) = libc.Uint8FromInt32(libc.Xtolower(tls, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp)))))
  11587. }
  11588. if flags&int32(m_RPP_FORCEUPPER) != 0 {
  11589. *(*uint8)(unsafe.Pointer(bp)) = libc.Uint8FromInt32(libc.Xtoupper(tls, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp)))))
  11590. }
  11591. }
  11592. v6 = p
  11593. p++
  11594. *(*uint8)(unsafe.Pointer(v6)) = *(*uint8)(unsafe.Pointer(bp))
  11595. }
  11596. }
  11597. *(*uint8)(unsafe.Pointer(p)) = uint8('\000')
  11598. save_errno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  11599. if !((*(*Ttermios)(unsafe.Pointer(bp + 4))).Fc_lflag&libc.Uint32FromInt32(m_ECHO) != 0) {
  11600. libc.Xwrite(tls, output, __ccgo_ts+332, uint32(1))
  11601. }
  11602. /* Restore old terminal settings and signals. */
  11603. if libc.Xmemcmp(tls, bp+4, bp+64, uint32(60)) != 0 {
  11604. sigttou = libc.AtomicLoadPInt32(uintptr(unsafe.Pointer(&_signo)) + libc.UintptrFromInt32(m_SIGTTOU)*4)
  11605. /* Ignore SIGTTOU generated when we are not the fg pgrp. */
  11606. for libc.Xtcsetattr(tls, input, libc.Int32FromInt32(m_TCSAFLUSH)|libc.Int32FromInt32(m_TCSASOFT), bp+64) == -int32(1) && *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EINTR) && !(libc.AtomicLoadPInt32(uintptr(unsafe.Pointer(&_signo))+libc.UintptrFromInt32(m_SIGTTOU)*4) != 0) {
  11607. continue
  11608. }
  11609. libc.AtomicStorePInt32(uintptr(unsafe.Pointer(&_signo))+22*4, sigttou)
  11610. }
  11611. libc.Xsigaction(tls, int32(m_SIGALRM), bp+264, libc.UintptrFromInt32(0))
  11612. libc.Xsigaction(tls, int32(m_SIGHUP), bp+544, libc.UintptrFromInt32(0))
  11613. libc.Xsigaction(tls, int32(m_SIGINT), bp+404, libc.UintptrFromInt32(0))
  11614. libc.Xsigaction(tls, int32(m_SIGQUIT), bp+684, libc.UintptrFromInt32(0))
  11615. libc.Xsigaction(tls, int32(m_SIGPIPE), bp+1384, libc.UintptrFromInt32(0))
  11616. libc.Xsigaction(tls, int32(m_SIGTERM), bp+824, libc.UintptrFromInt32(0))
  11617. libc.Xsigaction(tls, int32(m_SIGTSTP), bp+964, libc.UintptrFromInt32(0))
  11618. libc.Xsigaction(tls, int32(m_SIGTTIN), bp+1104, libc.UintptrFromInt32(0))
  11619. libc.Xsigaction(tls, int32(m_SIGTTOU), bp+1244, libc.UintptrFromInt32(0))
  11620. if input != m_STDIN_FILENO {
  11621. libc.Xclose(tls, input)
  11622. }
  11623. /*
  11624. * If we were interrupted by a signal, resend it to ourselves
  11625. * now that we have restored the signal handlers.
  11626. */
  11627. i = 0
  11628. for {
  11629. if !(i < int32(m__NSIG)) {
  11630. break
  11631. }
  11632. if libc.AtomicLoadPInt32(uintptr(unsafe.Pointer(&_signo))+uintptr(i)*4) != 0 {
  11633. libc.Xkill(tls, libc.Xgetpid(tls), i)
  11634. switch i {
  11635. case int32(m_SIGTSTP):
  11636. fallthrough
  11637. case int32(m_SIGTTIN):
  11638. fallthrough
  11639. case int32(m_SIGTTOU):
  11640. need_restart = int32(1)
  11641. }
  11642. }
  11643. goto _7
  11644. _7:
  11645. ;
  11646. i++
  11647. }
  11648. if need_restart != 0 {
  11649. goto restart
  11650. }
  11651. if save_errno != 0 {
  11652. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = save_errno
  11653. }
  11654. if nr == -int32(1) {
  11655. v8 = libc.UintptrFromInt32(0)
  11656. } else {
  11657. v8 = buf
  11658. }
  11659. return v8
  11660. }
  11661. func _handler(tls *libc.TLS, s int32) {
  11662. libc.AtomicStorePInt32(uintptr(unsafe.Pointer(&_signo))+uintptr(s)*4, int32(1))
  11663. }
  11664. const m_UINT32_MAX1 = 4294967295
  11665. /*
  11666. * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
  11667. * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
  11668. */
  11669. func Xreallocarray(tls *libc.TLS, optr uintptr, nmemb Tsize_t, size Tsize_t) (r uintptr) {
  11670. if (nmemb >= libc.Uint32FromInt32(1)<<(libc.Uint32FromInt64(4)*libc.Uint32FromInt32(4)) || size >= libc.Uint32FromInt32(1)<<(libc.Uint32FromInt64(4)*libc.Uint32FromInt32(4))) && nmemb > uint32(0) && uint32(0xffffffff)/nmemb < size {
  11671. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOMEM)
  11672. return libc.UintptrFromInt32(0)
  11673. }
  11674. return libc.Xrealloc(tls, optr, size*nmemb)
  11675. }
  11676. const m_UINT32_MAX2 = "0xffffffffu"
  11677. func Xreallocf(tls *libc.TLS, ptr uintptr, size Tsize_t) (r uintptr) {
  11678. var nptr uintptr
  11679. _ = nptr
  11680. nptr = libc.Xrealloc(tls, ptr, size)
  11681. /*
  11682. * When the System V compatibility option (malloc "V" flag) is
  11683. * in effect, realloc(ptr, 0) frees the memory and returns NULL.
  11684. * So, to avoid double free, call free() only when size != 0.
  11685. * realloc(ptr, 0) can't fail when ptr != NULL.
  11686. */
  11687. if !(nptr != 0) && ptr != 0 && size != uint32(0) {
  11688. libc.Xfree(tls, ptr)
  11689. }
  11690. return nptr
  11691. }
  11692. const m_UINT32_MAX3 = 4294967295
  11693. /*
  11694. * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
  11695. * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
  11696. */
  11697. func Xrecallocarray(tls *libc.TLS, ptr uintptr, oldnmemb Tsize_t, newnmemb Tsize_t, size Tsize_t) (r uintptr) {
  11698. var d, newsize, oldsize Tsize_t
  11699. var newptr uintptr
  11700. _, _, _, _ = d, newptr, newsize, oldsize
  11701. if ptr == libc.UintptrFromInt32(0) {
  11702. return libc.Xcalloc(tls, newnmemb, size)
  11703. }
  11704. if (newnmemb >= libc.Uint32FromInt32(1)<<(libc.Uint32FromInt64(4)*libc.Uint32FromInt32(4)) || size >= libc.Uint32FromInt32(1)<<(libc.Uint32FromInt64(4)*libc.Uint32FromInt32(4))) && newnmemb > uint32(0) && uint32(0xffffffff)/newnmemb < size {
  11705. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOMEM)
  11706. return libc.UintptrFromInt32(0)
  11707. }
  11708. newsize = newnmemb * size
  11709. if (oldnmemb >= libc.Uint32FromInt32(1)<<(libc.Uint32FromInt64(4)*libc.Uint32FromInt32(4)) || size >= libc.Uint32FromInt32(1)<<(libc.Uint32FromInt64(4)*libc.Uint32FromInt32(4))) && oldnmemb > uint32(0) && uint32(0xffffffff)/oldnmemb < size {
  11710. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11711. return libc.UintptrFromInt32(0)
  11712. }
  11713. oldsize = oldnmemb * size
  11714. /*
  11715. * Don't bother too much if we're shrinking just a bit,
  11716. * we do not shrink for series of small steps, oh well.
  11717. */
  11718. if newsize <= oldsize {
  11719. d = oldsize - newsize
  11720. if d < oldsize/uint32(2) && d < libc.Uint32FromInt32(libc.Xgetpagesize(tls)) {
  11721. libc.Xmemset(tls, ptr+uintptr(newsize), 0, d)
  11722. return ptr
  11723. }
  11724. }
  11725. newptr = libc.Xmalloc(tls, newsize)
  11726. if newptr == libc.UintptrFromInt32(0) {
  11727. return libc.UintptrFromInt32(0)
  11728. }
  11729. if newsize > oldsize {
  11730. libc.Xmemcpy(tls, newptr, ptr, oldsize)
  11731. libc.Xmemset(tls, newptr+uintptr(oldsize), 0, newsize-oldsize)
  11732. } else {
  11733. libc.Xmemcpy(tls, newptr, ptr, newsize)
  11734. }
  11735. Xexplicit_bzero(tls, ptr, oldsize)
  11736. libc.Xfree(tls, ptr)
  11737. return newptr
  11738. }
  11739. const m_CMD2_CLR = 1
  11740. const m_CMD2_GBITS = 4
  11741. const m_CMD2_OBITS = 8
  11742. const m_CMD2_SET = 2
  11743. const m_CMD2_UBITS = 16
  11744. const m_SET_LEN = 6
  11745. const m_SET_LEN_INCR = 4
  11746. const m_S_IFDIR1 = 16384
  11747. const m_S_IRGRP1 = 32
  11748. const m_S_IROTH1 = 4
  11749. const m_S_IRUSR1 = 256
  11750. const m_S_IRWXG1 = 56
  11751. const m_S_IRWXO1 = 7
  11752. const m_S_IRWXU1 = 448
  11753. const m_S_ISGID1 = 1024
  11754. const m_S_ISUID1 = 2048
  11755. const m_S_ISVTX1 = 512
  11756. const m_S_IWGRP1 = 16
  11757. const m_S_IWOTH1 = 2
  11758. const m_S_IWUSR1 = 128
  11759. const m_S_IXGRP1 = 8
  11760. const m_S_IXOTH1 = 1
  11761. const m_S_IXUSR1 = 64
  11762. const m_UINT32_MAX4 = "0xffffffffu"
  11763. const m___LONG_MAX1 = 2147483647
  11764. type TBITCMD = struct {
  11765. Fcmd uint8
  11766. Fcmd2 uint8
  11767. Fbits Tmode_t
  11768. }
  11769. type Tbitcmd = TBITCMD
  11770. // C documentation
  11771. //
  11772. // /*
  11773. // * Given the old mode and an array of bitcmd structures, apply the operations
  11774. // * described in the bitcmd structures to the old mode, and return the new mode.
  11775. // * Note that there is no '=' command; a strict assignment is just a '-' (clear
  11776. // * bits) followed by a '+' (set bits).
  11777. // */
  11778. func Xgetmode(tls *libc.TLS, bbox uintptr, omode Tmode_t) (r Tmode_t) {
  11779. var clrval, newmode, value Tmode_t
  11780. var set uintptr
  11781. var v11 uint32
  11782. _, _, _, _, _ = clrval, newmode, set, value, v11
  11783. set = bbox
  11784. newmode = omode
  11785. value = uint32(0)
  11786. for {
  11787. switch libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd) {
  11788. case int32('u'):
  11789. goto _2
  11790. case int32('g'):
  11791. goto _3
  11792. case int32('o'):
  11793. goto _4
  11794. case int32('+'):
  11795. goto _5
  11796. case int32('-'):
  11797. goto _6
  11798. case int32('X'):
  11799. goto _7
  11800. default:
  11801. goto _8
  11802. case int32('\000'):
  11803. goto _9
  11804. }
  11805. goto _10
  11806. /*
  11807. * When copying the user, group or other bits around, we "know"
  11808. * where the bits are in the mode so that we can do shifts to
  11809. * copy them around. If we don't use shifts, it gets real
  11810. * grundgy with lots of single bit checks and bit sets.
  11811. */
  11812. _2:
  11813. ;
  11814. value = newmode & uint32(m_S_IRWXU1) >> int32(6)
  11815. goto common
  11816. _3:
  11817. ;
  11818. value = newmode & uint32(m_S_IRWXG1) >> int32(3)
  11819. goto common
  11820. _4:
  11821. ;
  11822. value = newmode & uint32(m_S_IRWXO1)
  11823. goto common
  11824. common:
  11825. ;
  11826. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_CLR) != 0 {
  11827. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_SET) != 0 {
  11828. v11 = uint32(m_S_IRWXO1)
  11829. } else {
  11830. v11 = value
  11831. }
  11832. clrval = v11
  11833. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_UBITS) != 0 {
  11834. newmode &= ^(clrval << libc.Int32FromInt32(6) & (*TBITCMD)(unsafe.Pointer(set)).Fbits)
  11835. }
  11836. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_GBITS) != 0 {
  11837. newmode &= ^(clrval << libc.Int32FromInt32(3) & (*TBITCMD)(unsafe.Pointer(set)).Fbits)
  11838. }
  11839. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_OBITS) != 0 {
  11840. newmode &= ^(clrval & (*TBITCMD)(unsafe.Pointer(set)).Fbits)
  11841. }
  11842. }
  11843. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_SET) != 0 {
  11844. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_UBITS) != 0 {
  11845. newmode |= value << libc.Int32FromInt32(6) & (*TBITCMD)(unsafe.Pointer(set)).Fbits
  11846. }
  11847. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_GBITS) != 0 {
  11848. newmode |= value << libc.Int32FromInt32(3) & (*TBITCMD)(unsafe.Pointer(set)).Fbits
  11849. }
  11850. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_OBITS) != 0 {
  11851. newmode |= value & (*TBITCMD)(unsafe.Pointer(set)).Fbits
  11852. }
  11853. }
  11854. goto _10
  11855. _5:
  11856. ;
  11857. newmode |= (*TBITCMD)(unsafe.Pointer(set)).Fbits
  11858. goto _10
  11859. _6:
  11860. ;
  11861. newmode &= ^(*TBITCMD)(unsafe.Pointer(set)).Fbits
  11862. goto _10
  11863. _7:
  11864. ;
  11865. if omode&libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IFDIR1)|libc.Int32FromInt32(m_S_IXUSR1)|libc.Int32FromInt32(m_S_IXGRP1)|libc.Int32FromInt32(m_S_IXOTH1)) != 0 {
  11866. newmode |= (*TBITCMD)(unsafe.Pointer(set)).Fbits
  11867. }
  11868. goto _10
  11869. _9:
  11870. ;
  11871. _8:
  11872. ;
  11873. return newmode
  11874. _10:
  11875. ;
  11876. goto _1
  11877. _1:
  11878. ;
  11879. set += 8
  11880. }
  11881. return r
  11882. }
  11883. func Xsetmode(tls *libc.TLS, p uintptr) (r uintptr) {
  11884. bp := tls.Alloc(272)
  11885. defer tls.Free(272)
  11886. var endset, newset, newset1, newset2, newset3, newset4, newset5, saveset, set, v5 uintptr
  11887. var equalopdone, lval, serrno, setlen int32
  11888. var mask, perm, permXbits, who, v1 Tmode_t
  11889. var op, v4 uint8
  11890. var setdiff, setdiff1, setdiff2, setdiff3, setdiff4, setdiff5 Tptrdiff_t
  11891. var _ /* ep at bp+0 */ uintptr
  11892. var _ /* signset at bp+4 */ Tsigset_t
  11893. var _ /* sigoset at bp+132 */ Tsigset_t
  11894. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = endset, equalopdone, lval, mask, newset, newset1, newset2, newset3, newset4, newset5, op, perm, permXbits, saveset, serrno, set, setdiff, setdiff1, setdiff2, setdiff3, setdiff4, setdiff5, setlen, who, v1, v4, v5
  11895. equalopdone = 0
  11896. if !(*(*uint8)(unsafe.Pointer(p)) != 0) {
  11897. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11898. return libc.UintptrFromInt32(0)
  11899. }
  11900. /*
  11901. * Get a copy of the mask for the permissions that are mask relative.
  11902. * Flip the bits, we want what's not set. Since it's possible that
  11903. * the caller is opening files inside a signal handler, protect them
  11904. * as best we can.
  11905. */
  11906. libc.Xsigfillset(tls, bp+4)
  11907. libc.Xsigprocmask(tls, m_SIG_BLOCK, bp+4, bp+132)
  11908. v1 = libc.Xumask(tls, uint32(0))
  11909. mask = v1
  11910. libc.Xumask(tls, v1)
  11911. mask = ^mask
  11912. libc.Xsigprocmask(tls, int32(m_SIG_SETMASK), bp+132, libc.UintptrFromInt32(0))
  11913. setlen = libc.Int32FromInt32(m_SET_LEN) + libc.Int32FromInt32(2)
  11914. set = Xreallocarray(tls, libc.UintptrFromInt32(0), libc.Uint32FromInt32(setlen), uint32(8))
  11915. if set == libc.UintptrFromInt32(0) {
  11916. return libc.UintptrFromInt32(0)
  11917. }
  11918. saveset = set
  11919. endset = set + uintptr(setlen-libc.Int32FromInt32(2))*8
  11920. /*
  11921. * If an absolute number, get it and return; disallow non-octal digits
  11922. * or illegal bits.
  11923. */
  11924. if libc.BoolInt32(uint32(*(*uint8)(unsafe.Pointer(p)))-uint32('0') < uint32(10)) != 0 {
  11925. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  11926. lval = libc.Xstrtol(tls, p, bp, int32(8))
  11927. if *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))) != 0 {
  11928. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11929. goto out
  11930. }
  11931. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_ERANGE) && (lval == int32(0x7fffffff) || lval == -libc.Int32FromInt32(0x7fffffff)-libc.Int32FromInt32(1)) {
  11932. goto out
  11933. }
  11934. if lval&int32(^(libc.Int32FromInt32(m_S_ISUID1)|libc.Int32FromInt32(m_S_ISGID1)|libc.Int32FromInt32(m_S_IRWXU1)|libc.Int32FromInt32(m_S_IRWXG1)|libc.Int32FromInt32(m_S_IRWXO1)|libc.Int32FromInt32(m_S_ISVTX1))) != 0 {
  11935. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11936. goto out
  11937. }
  11938. perm = libc.Uint32FromInt32(lval)
  11939. if set >= endset {
  11940. setdiff = (int32(set) - int32(saveset)) / 8
  11941. setlen += int32(m_SET_LEN_INCR)
  11942. newset = Xreallocarray(tls, saveset, libc.Uint32FromInt32(setlen), uint32(8))
  11943. if newset == libc.UintptrFromInt32(0) {
  11944. goto out
  11945. }
  11946. set = newset + uintptr(setdiff)*8
  11947. saveset = newset
  11948. endset = newset + uintptr(setlen-libc.Int32FromInt32(2))*8
  11949. }
  11950. set = _addcmd(tls, set, libc.Uint32FromInt32(libc.Int32FromUint8('=')), libc.Uint32FromInt32(libc.Int32FromInt32(m_S_ISUID1)|libc.Int32FromInt32(m_S_ISGID1)|libc.Int32FromInt32(m_S_IRWXU1)|libc.Int32FromInt32(m_S_IRWXG1)|libc.Int32FromInt32(m_S_IRWXO1)|libc.Int32FromInt32(m_S_ISVTX1)), perm, mask)
  11951. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8(0)
  11952. return saveset
  11953. }
  11954. /*
  11955. * Build list of structures to set/clear/copy bits as described by
  11956. * each clause of the symbolic mode.
  11957. */
  11958. for {
  11959. /* First, find out which bits might be modified. */
  11960. who = uint32(0)
  11961. for {
  11962. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) {
  11963. case int32('a'):
  11964. who |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_ISUID1) | libc.Int32FromInt32(m_S_ISGID1) | libc.Int32FromInt32(m_S_IRWXU1) | libc.Int32FromInt32(m_S_IRWXG1) | libc.Int32FromInt32(m_S_IRWXO1))
  11965. case int32('u'):
  11966. who |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_ISUID1) | libc.Int32FromInt32(m_S_IRWXU1))
  11967. case int32('g'):
  11968. who |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_ISGID1) | libc.Int32FromInt32(m_S_IRWXG1))
  11969. case int32('o'):
  11970. who |= uint32(m_S_IRWXO1)
  11971. default:
  11972. goto getop
  11973. }
  11974. goto _3
  11975. _3:
  11976. ;
  11977. p++
  11978. }
  11979. goto getop
  11980. getop:
  11981. ;
  11982. v5 = p
  11983. p++
  11984. v4 = *(*uint8)(unsafe.Pointer(v5))
  11985. op = v4
  11986. if libc.Int32FromUint8(v4) != int32('+') && libc.Int32FromUint8(op) != int32('-') && libc.Int32FromUint8(op) != int32('=') {
  11987. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11988. goto out
  11989. }
  11990. if libc.Int32FromUint8(op) == int32('=') {
  11991. equalopdone = 0
  11992. }
  11993. who &= libc.Uint32FromInt32(^libc.Int32FromInt32(m_S_ISVTX1))
  11994. perm = uint32(0)
  11995. permXbits = libc.Uint32FromInt32(0)
  11996. for {
  11997. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) {
  11998. case int32('r'):
  11999. perm |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IRUSR1) | libc.Int32FromInt32(m_S_IRGRP1) | libc.Int32FromInt32(m_S_IROTH1))
  12000. case int32('s'):
  12001. /*
  12002. * If specific bits where requested and
  12003. * only "other" bits ignore set-id.
  12004. */
  12005. if who == uint32(0) || who&libc.Uint32FromInt32(^libc.Int32FromInt32(m_S_IRWXO1)) != 0 {
  12006. perm |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_ISUID1) | libc.Int32FromInt32(m_S_ISGID1))
  12007. }
  12008. case int32('t'):
  12009. /*
  12010. * If specific bits where requested and
  12011. * only "other" bits ignore set-id.
  12012. */
  12013. if who == uint32(0) || who&libc.Uint32FromInt32(^libc.Int32FromInt32(m_S_IRWXO1)) != 0 {
  12014. who |= uint32(m_S_ISVTX1)
  12015. perm |= uint32(m_S_ISVTX1)
  12016. }
  12017. case int32('w'):
  12018. perm |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IWUSR1) | libc.Int32FromInt32(m_S_IWGRP1) | libc.Int32FromInt32(m_S_IWOTH1))
  12019. case int32('X'):
  12020. permXbits = libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXUSR1) | libc.Int32FromInt32(m_S_IXGRP1) | libc.Int32FromInt32(m_S_IXOTH1))
  12021. case int32('x'):
  12022. perm |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXUSR1) | libc.Int32FromInt32(m_S_IXGRP1) | libc.Int32FromInt32(m_S_IXOTH1))
  12023. case int32('u'):
  12024. fallthrough
  12025. case int32('g'):
  12026. fallthrough
  12027. case int32('o'):
  12028. /*
  12029. * When ever we hit 'u', 'g', or 'o', we have
  12030. * to flush out any partial mode that we have,
  12031. * and then do the copying of the mode bits.
  12032. */
  12033. if perm != 0 {
  12034. if set >= endset {
  12035. setdiff1 = (int32(set) - int32(saveset)) / 8
  12036. setlen += int32(m_SET_LEN_INCR)
  12037. newset1 = Xreallocarray(tls, saveset, libc.Uint32FromInt32(setlen), uint32(8))
  12038. if newset1 == libc.UintptrFromInt32(0) {
  12039. goto out
  12040. }
  12041. set = newset1 + uintptr(setdiff1)*8
  12042. saveset = newset1
  12043. endset = newset1 + uintptr(setlen-libc.Int32FromInt32(2))*8
  12044. }
  12045. set = _addcmd(tls, set, uint32(op), who, perm, mask)
  12046. perm = uint32(0)
  12047. }
  12048. if libc.Int32FromUint8(op) == int32('=') {
  12049. equalopdone = int32(1)
  12050. }
  12051. if libc.Int32FromUint8(op) == int32('+') && permXbits != 0 {
  12052. if set >= endset {
  12053. setdiff2 = (int32(set) - int32(saveset)) / 8
  12054. setlen += int32(m_SET_LEN_INCR)
  12055. newset2 = Xreallocarray(tls, saveset, libc.Uint32FromInt32(setlen), uint32(8))
  12056. if newset2 == libc.UintptrFromInt32(0) {
  12057. goto out
  12058. }
  12059. set = newset2 + uintptr(setdiff2)*8
  12060. saveset = newset2
  12061. endset = newset2 + uintptr(setlen-libc.Int32FromInt32(2))*8
  12062. }
  12063. set = _addcmd(tls, set, libc.Uint32FromInt32(libc.Int32FromUint8('X')), who, permXbits, mask)
  12064. permXbits = uint32(0)
  12065. }
  12066. if set >= endset {
  12067. setdiff3 = (int32(set) - int32(saveset)) / 8
  12068. setlen += int32(m_SET_LEN_INCR)
  12069. newset3 = Xreallocarray(tls, saveset, libc.Uint32FromInt32(setlen), uint32(8))
  12070. if newset3 == libc.UintptrFromInt32(0) {
  12071. goto out
  12072. }
  12073. set = newset3 + uintptr(setdiff3)*8
  12074. saveset = newset3
  12075. endset = newset3 + uintptr(setlen-libc.Int32FromInt32(2))*8
  12076. }
  12077. set = _addcmd(tls, set, uint32(*(*uint8)(unsafe.Pointer(p))), who, uint32(op), mask)
  12078. default:
  12079. /*
  12080. * Add any permissions that we haven't already
  12081. * done.
  12082. */
  12083. if perm != 0 || libc.Int32FromUint8(op) == int32('=') && !(equalopdone != 0) {
  12084. if libc.Int32FromUint8(op) == int32('=') {
  12085. equalopdone = int32(1)
  12086. }
  12087. if set >= endset {
  12088. setdiff4 = (int32(set) - int32(saveset)) / 8
  12089. setlen += int32(m_SET_LEN_INCR)
  12090. newset4 = Xreallocarray(tls, saveset, libc.Uint32FromInt32(setlen), uint32(8))
  12091. if newset4 == libc.UintptrFromInt32(0) {
  12092. goto out
  12093. }
  12094. set = newset4 + uintptr(setdiff4)*8
  12095. saveset = newset4
  12096. endset = newset4 + uintptr(setlen-libc.Int32FromInt32(2))*8
  12097. }
  12098. set = _addcmd(tls, set, uint32(op), who, perm, mask)
  12099. perm = uint32(0)
  12100. }
  12101. if permXbits != 0 {
  12102. if set >= endset {
  12103. setdiff5 = (int32(set) - int32(saveset)) / 8
  12104. setlen += int32(m_SET_LEN_INCR)
  12105. newset5 = Xreallocarray(tls, saveset, libc.Uint32FromInt32(setlen), uint32(8))
  12106. if newset5 == libc.UintptrFromInt32(0) {
  12107. goto out
  12108. }
  12109. set = newset5 + uintptr(setdiff5)*8
  12110. saveset = newset5
  12111. endset = newset5 + uintptr(setlen-libc.Int32FromInt32(2))*8
  12112. }
  12113. set = _addcmd(tls, set, libc.Uint32FromInt32(libc.Int32FromUint8('X')), who, permXbits, mask)
  12114. permXbits = uint32(0)
  12115. }
  12116. goto apply
  12117. }
  12118. goto _6
  12119. _6:
  12120. ;
  12121. p++
  12122. }
  12123. goto apply
  12124. apply:
  12125. ;
  12126. if !(*(*uint8)(unsafe.Pointer(p)) != 0) {
  12127. break
  12128. }
  12129. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) != int32(',') {
  12130. goto getop
  12131. }
  12132. p++
  12133. goto _2
  12134. _2:
  12135. }
  12136. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8(0)
  12137. _compress_mode(tls, saveset)
  12138. return saveset
  12139. goto out
  12140. out:
  12141. ;
  12142. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  12143. libc.Xfree(tls, saveset)
  12144. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  12145. return libc.UintptrFromInt32(0)
  12146. }
  12147. func _addcmd(tls *libc.TLS, set uintptr, op Tmode_t, who Tmode_t, oparg Tmode_t, mask Tmode_t) (r uintptr) {
  12148. var v1, v2 uint32
  12149. var v3, v4, v5 int32
  12150. var p6, p7, p8 uintptr
  12151. _, _, _, _, _, _, _, _ = v1, v2, v3, v4, v5, p6, p7, p8
  12152. switch op {
  12153. case uint32('='):
  12154. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8('-')
  12155. if who != 0 {
  12156. v1 = who
  12157. } else {
  12158. v1 = libc.Uint32FromInt32(libc.Int32FromInt32(m_S_ISUID1) | libc.Int32FromInt32(m_S_ISGID1) | libc.Int32FromInt32(m_S_IRWXU1) | libc.Int32FromInt32(m_S_IRWXG1) | libc.Int32FromInt32(m_S_IRWXO1))
  12159. }
  12160. (*TBITCMD)(unsafe.Pointer(set)).Fbits = v1
  12161. set += 8
  12162. op = uint32('+')
  12163. /* FALLTHROUGH */
  12164. fallthrough
  12165. case uint32('+'):
  12166. fallthrough
  12167. case uint32('-'):
  12168. fallthrough
  12169. case uint32('X'):
  12170. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8(op)
  12171. if who != 0 {
  12172. v2 = who
  12173. } else {
  12174. v2 = mask
  12175. }
  12176. (*TBITCMD)(unsafe.Pointer(set)).Fbits = v2 & oparg
  12177. case uint32('u'):
  12178. fallthrough
  12179. case uint32('g'):
  12180. fallthrough
  12181. case uint32('o'):
  12182. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8(op)
  12183. if who != 0 {
  12184. if who&uint32(m_S_IRUSR1) != 0 {
  12185. v3 = int32(m_CMD2_UBITS)
  12186. } else {
  12187. v3 = 0
  12188. }
  12189. if who&uint32(m_S_IRGRP1) != 0 {
  12190. v4 = int32(m_CMD2_GBITS)
  12191. } else {
  12192. v4 = 0
  12193. }
  12194. if who&uint32(m_S_IROTH1) != 0 {
  12195. v5 = int32(m_CMD2_OBITS)
  12196. } else {
  12197. v5 = 0
  12198. }
  12199. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = libc.Uint8FromInt32(v3 | v4 | v5)
  12200. (*TBITCMD)(unsafe.Pointer(set)).Fbits = libc.Uint32FromInt32(^libc.Int32FromInt32(0))
  12201. } else {
  12202. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = libc.Uint8FromInt32(libc.Int32FromInt32(m_CMD2_UBITS) | libc.Int32FromInt32(m_CMD2_GBITS) | libc.Int32FromInt32(m_CMD2_OBITS))
  12203. (*TBITCMD)(unsafe.Pointer(set)).Fbits = mask
  12204. }
  12205. if oparg == uint32('+') {
  12206. p6 = set + 1
  12207. *(*uint8)(unsafe.Pointer(p6)) = uint8(int32(*(*uint8)(unsafe.Pointer(p6))) | libc.Int32FromInt32(m_CMD2_SET))
  12208. } else {
  12209. if oparg == uint32('-') {
  12210. p7 = set + 1
  12211. *(*uint8)(unsafe.Pointer(p7)) = uint8(int32(*(*uint8)(unsafe.Pointer(p7))) | libc.Int32FromInt32(m_CMD2_CLR))
  12212. } else {
  12213. if oparg == uint32('=') {
  12214. p8 = set + 1
  12215. *(*uint8)(unsafe.Pointer(p8)) = uint8(int32(*(*uint8)(unsafe.Pointer(p8))) | (libc.Int32FromInt32(m_CMD2_SET) | libc.Int32FromInt32(m_CMD2_CLR)))
  12216. }
  12217. }
  12218. }
  12219. break
  12220. }
  12221. return set + libc.UintptrFromInt32(1)*8
  12222. }
  12223. // C documentation
  12224. //
  12225. // /*
  12226. // * Given an array of bitcmd structures, compress by compacting consecutive
  12227. // * '+', '-' and 'X' commands into at most 3 commands, one of each. The 'u',
  12228. // * 'g' and 'o' commands continue to be separate. They could probably be
  12229. // * compacted, but it's not worth the effort.
  12230. // */
  12231. func _compress_mode(tls *libc.TLS, set uintptr) {
  12232. var Xbits, clrbits, op, setbits, v2, v6, v7, v8 int32
  12233. var nset, v3, v4 uintptr
  12234. _, _, _, _, _, _, _, _, _, _, _ = Xbits, clrbits, nset, op, setbits, v2, v3, v4, v6, v7, v8
  12235. nset = set
  12236. for {
  12237. /* Copy over any 'u', 'g' and 'o' commands. */
  12238. for {
  12239. v2 = libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(nset)).Fcmd)
  12240. op = v2
  12241. if !(v2 != int32('+') && op != int32('-') && op != int32('X')) {
  12242. break
  12243. }
  12244. v3 = set
  12245. set += 8
  12246. v4 = nset
  12247. nset += 8
  12248. *(*TBITCMD)(unsafe.Pointer(v3)) = *(*TBITCMD)(unsafe.Pointer(v4))
  12249. if !(op != 0) {
  12250. return
  12251. }
  12252. }
  12253. v7 = libc.Int32FromInt32(0)
  12254. Xbits = v7
  12255. v6 = v7
  12256. clrbits = v6
  12257. setbits = v6
  12258. for {
  12259. v8 = libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(nset)).Fcmd)
  12260. op = v8
  12261. if v8 == int32('-') {
  12262. clrbits = int32(uint32(clrbits) | (*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  12263. setbits = int32(uint32(setbits) & ^(*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  12264. Xbits = int32(uint32(Xbits) & ^(*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  12265. } else {
  12266. if op == int32('+') {
  12267. setbits = int32(uint32(setbits) | (*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  12268. clrbits = int32(uint32(clrbits) & ^(*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  12269. Xbits = int32(uint32(Xbits) & ^(*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  12270. } else {
  12271. if op == int32('X') {
  12272. Xbits = int32(uint32(Xbits) | (*TBITCMD)(unsafe.Pointer(nset)).Fbits&libc.Uint32FromInt32(^setbits))
  12273. } else {
  12274. break
  12275. }
  12276. }
  12277. }
  12278. goto _5
  12279. _5:
  12280. ;
  12281. nset += 8
  12282. }
  12283. if clrbits != 0 {
  12284. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8('-')
  12285. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = uint8(0)
  12286. (*TBITCMD)(unsafe.Pointer(set)).Fbits = libc.Uint32FromInt32(clrbits)
  12287. set += 8
  12288. }
  12289. if setbits != 0 {
  12290. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8('+')
  12291. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = uint8(0)
  12292. (*TBITCMD)(unsafe.Pointer(set)).Fbits = libc.Uint32FromInt32(setbits)
  12293. set += 8
  12294. }
  12295. if Xbits != 0 {
  12296. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8('X')
  12297. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = uint8(0)
  12298. (*TBITCMD)(unsafe.Pointer(set)).Fbits = libc.Uint32FromInt32(Xbits)
  12299. set += 8
  12300. }
  12301. goto _1
  12302. _1:
  12303. }
  12304. }
  12305. const m_SPT_MAXTITLE = 255
  12306. const m_S_IFDIR2 = 0040000
  12307. const m_S_IRGRP2 = 0040
  12308. const m_S_IROTH2 = 0004
  12309. const m_S_IRUSR2 = 0400
  12310. const m_S_IRWXG2 = 0070
  12311. const m_S_IRWXO2 = 0007
  12312. const m_S_IRWXU2 = 0700
  12313. const m_S_ISGID2 = 02000
  12314. const m_S_ISUID2 = 04000
  12315. const m_S_ISVTX2 = 01000
  12316. const m_S_IWGRP2 = 0020
  12317. const m_S_IWOTH2 = 0002
  12318. const m_S_IWUSR2 = 0200
  12319. const m_S_IXGRP2 = 0010
  12320. const m_S_IXOTH2 = 0001
  12321. const m_S_IXUSR2 = 0100
  12322. const m___LONG_MAX2 = 0x7fffffff
  12323. const m___bool_true_false_are_defined = 1
  12324. const m_bool = "_Bool"
  12325. const m_false = 0
  12326. const m_true = 1
  12327. /*
  12328. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  12329. *
  12330. * Redistribution and use in source and binary forms, with or without
  12331. * modification, are permitted provided that the following conditions
  12332. * are met:
  12333. * 1. Redistributions of source code must retain the above copyright
  12334. * notice, this list of conditions and the following disclaimer.
  12335. * 2. Redistributions in binary form must reproduce the above copyright
  12336. * notice, this list of conditions and the following disclaimer in the
  12337. * documentation and/or other materials provided with the distribution.
  12338. * 3. The name of the author may not be used to endorse or promote products
  12339. * derived from this software without specific prior written permission.
  12340. *
  12341. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  12342. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  12343. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  12344. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  12345. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  12346. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  12347. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  12348. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  12349. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  12350. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  12351. */
  12352. /*
  12353. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  12354. *
  12355. * Redistribution and use in source and binary forms, with or without
  12356. * modification, are permitted provided that the following conditions
  12357. * are met:
  12358. * 1. Redistributions of source code must retain the above copyright
  12359. * notice, this list of conditions and the following disclaimer.
  12360. * 2. Redistributions in binary form must reproduce the above copyright
  12361. * notice, this list of conditions and the following disclaimer in the
  12362. * documentation and/or other materials provided with the distribution.
  12363. * 3. The name of the author may not be used to endorse or promote products
  12364. * derived from this software without specific prior written permission.
  12365. *
  12366. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  12367. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  12368. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  12369. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  12370. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  12371. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  12372. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  12373. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  12374. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  12375. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  12376. */
  12377. /* Clang expands this to 1 if an identifier is *not* reserved. */
  12378. /*
  12379. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  12380. * musl, try to handle this gracefully.
  12381. */
  12382. /* Copyright (C) 1992-2022 Free Software Foundation, Inc.
  12383. Copyright The GNU Toolchain Authors.
  12384. This file is part of the GNU C Library.
  12385. The GNU C Library is free software; you can redistribute it and/or
  12386. modify it under the terms of the GNU Lesser General Public
  12387. License as published by the Free Software Foundation; either
  12388. version 2.1 of the License, or (at your option) any later version.
  12389. The GNU C Library is distributed in the hope that it will be useful,
  12390. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12391. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12392. Lesser General Public License for more details.
  12393. You should have received a copy of the GNU Lesser General Public
  12394. License along with the GNU C Library; if not, see
  12395. <https://www.gnu.org/licenses/>. */
  12396. var _SPT struct {
  12397. Farg0 uintptr
  12398. Fbase uintptr
  12399. Fend uintptr
  12400. Fnul uintptr
  12401. Fwarned uint8
  12402. Freset uint8
  12403. Ferror1 int32
  12404. }
  12405. func _spt_min(tls *libc.TLS, a Tsize_t, b Tsize_t) (r Tsize_t) {
  12406. var v1 uint32
  12407. _ = v1
  12408. if a < b {
  12409. v1 = a
  12410. } else {
  12411. v1 = b
  12412. }
  12413. return v1
  12414. }
  12415. // C documentation
  12416. //
  12417. // /*
  12418. // * For discussion on the portability of the various methods, see
  12419. // * https://lists.freebsd.org/pipermail/freebsd-stable/2008-June/043136.html
  12420. // */
  12421. func _spt_clearenv(tls *libc.TLS) (r int32) {
  12422. return libc.Xclearenv(tls)
  12423. }
  12424. func _spt_copyenv(tls *libc.TLS, envc int32, envp uintptr) (r int32) {
  12425. var envcopy, eq uintptr
  12426. var envsize, error1, i int32
  12427. _, _, _, _, _ = envcopy, envsize, eq, error1, i
  12428. if libc.Xenviron != envp {
  12429. return 0
  12430. }
  12431. /* Make a copy of the old environ array of pointers, in case
  12432. * clearenv() or setenv() is implemented to free the internal
  12433. * environ array, because we will need to access the old environ
  12434. * contents to make the new copy. */
  12435. envsize = libc.Int32FromUint32(libc.Uint32FromInt32(envc+libc.Int32FromInt32(1)) * uint32(4))
  12436. envcopy = libc.Xmalloc(tls, libc.Uint32FromInt32(envsize))
  12437. if envcopy == libc.UintptrFromInt32(0) {
  12438. return *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  12439. }
  12440. libc.Xmemcpy(tls, envcopy, envp, libc.Uint32FromInt32(envsize))
  12441. error1 = _spt_clearenv(tls)
  12442. if error1 != 0 {
  12443. libc.Xenviron = envp
  12444. libc.Xfree(tls, envcopy)
  12445. return error1
  12446. }
  12447. i = 0
  12448. for {
  12449. if !(*(*uintptr)(unsafe.Pointer(envcopy + uintptr(i)*4)) != 0) {
  12450. break
  12451. }
  12452. eq = libc.Xstrchr(tls, *(*uintptr)(unsafe.Pointer(envcopy + uintptr(i)*4)), int32('='))
  12453. if eq == libc.UintptrFromInt32(0) {
  12454. goto _1
  12455. }
  12456. *(*uint8)(unsafe.Pointer(eq)) = uint8('\000')
  12457. if libc.Xsetenv(tls, *(*uintptr)(unsafe.Pointer(envcopy + uintptr(i)*4)), eq+uintptr(1), int32(1)) < 0 {
  12458. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  12459. }
  12460. *(*uint8)(unsafe.Pointer(eq)) = uint8('=')
  12461. if error1 != 0 {
  12462. /* Because the old environ might not be available
  12463. * anymore we will make do with the shallow copy. */
  12464. libc.Xenviron = envcopy
  12465. return error1
  12466. }
  12467. goto _1
  12468. _1:
  12469. ;
  12470. i++
  12471. }
  12472. /* Dispose of the shallow copy, now that we've finished transfering
  12473. * the old environment. */
  12474. libc.Xfree(tls, envcopy)
  12475. return 0
  12476. }
  12477. func _spt_copyargs(tls *libc.TLS, argc int32, argv uintptr) (r int32) {
  12478. var i int32
  12479. var tmp uintptr
  12480. _, _ = i, tmp
  12481. i = int32(1)
  12482. for {
  12483. if !(i < argc || i >= argc && *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)) != 0) {
  12484. break
  12485. }
  12486. if *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)) == libc.UintptrFromInt32(0) {
  12487. goto _1
  12488. }
  12489. tmp = libc.Xstrdup(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)))
  12490. if tmp == libc.UintptrFromInt32(0) {
  12491. return *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  12492. }
  12493. *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)) = tmp
  12494. goto _1
  12495. _1:
  12496. ;
  12497. i++
  12498. }
  12499. return 0
  12500. }
  12501. func Xsetproctitle_init(tls *libc.TLS, argc int32, argv uintptr, envp uintptr) {
  12502. var base, end, nul, tmp uintptr
  12503. var envc, error1, i int32
  12504. _, _, _, _, _, _, _ = base, end, envc, error1, i, nul, tmp
  12505. /* Try to make sure we got called with main() arguments. */
  12506. if argc < 0 {
  12507. return
  12508. }
  12509. base = *(*uintptr)(unsafe.Pointer(argv))
  12510. if base == libc.UintptrFromInt32(0) {
  12511. return
  12512. }
  12513. nul = base + uintptr(libc.Xstrlen(tls, base))
  12514. end = nul + uintptr(1)
  12515. i = 0
  12516. for {
  12517. if !(i < argc || i >= argc && *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)) != 0) {
  12518. break
  12519. }
  12520. if *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)) == libc.UintptrFromInt32(0) || *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)) != end {
  12521. goto _1
  12522. }
  12523. end = *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)) + uintptr(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)))) + uintptr(1)
  12524. goto _1
  12525. _1:
  12526. ;
  12527. i++
  12528. }
  12529. i = 0
  12530. for {
  12531. if !(*(*uintptr)(unsafe.Pointer(envp + uintptr(i)*4)) != 0) {
  12532. break
  12533. }
  12534. if *(*uintptr)(unsafe.Pointer(envp + uintptr(i)*4)) != end {
  12535. goto _2
  12536. }
  12537. end = *(*uintptr)(unsafe.Pointer(envp + uintptr(i)*4)) + uintptr(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(envp + uintptr(i)*4)))) + uintptr(1)
  12538. goto _2
  12539. _2:
  12540. ;
  12541. i++
  12542. }
  12543. envc = i
  12544. _SPT.Farg0 = libc.Xstrdup(tls, *(*uintptr)(unsafe.Pointer(argv)))
  12545. if _SPT.Farg0 == libc.UintptrFromInt32(0) {
  12546. _SPT.Ferror1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  12547. return
  12548. }
  12549. tmp = libc.Xstrdup(tls, Xgetprogname(tls))
  12550. if tmp == libc.UintptrFromInt32(0) {
  12551. _SPT.Ferror1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  12552. return
  12553. }
  12554. Xsetprogname(tls, tmp)
  12555. error1 = _spt_copyenv(tls, envc, envp)
  12556. if error1 != 0 {
  12557. _SPT.Ferror1 = error1
  12558. return
  12559. }
  12560. error1 = _spt_copyargs(tls, argc, argv)
  12561. if error1 != 0 {
  12562. _SPT.Ferror1 = error1
  12563. return
  12564. }
  12565. _SPT.Fnul = nul
  12566. _SPT.Fbase = base
  12567. _SPT.Fend = end
  12568. }
  12569. func Xsetproctitle_impl(tls *libc.TLS, fmt uintptr, va uintptr) {
  12570. bp := tls.Alloc(272)
  12571. defer tls.Free(272)
  12572. var ap Tva_list
  12573. var len1 int32
  12574. var nul, v1 uintptr
  12575. var _ /* buf at bp+0 */ [256]uint8
  12576. _, _, _, _ = ap, len1, nul, v1
  12577. if _SPT.Fbase == libc.UintptrFromInt32(0) {
  12578. if !(_SPT.Fwarned != 0) {
  12579. libc.Xwarnx(tls, __ccgo_ts+334, 0)
  12580. _SPT.Fwarned = uint8(m_true)
  12581. }
  12582. return
  12583. }
  12584. if fmt != 0 {
  12585. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(fmt))) == int32('-') {
  12586. /* Skip program name prefix. */
  12587. fmt++
  12588. len1 = 0
  12589. } else {
  12590. /* Print program name heading for grep. */
  12591. libc.X__builtin_snprintf(tls, bp, uint32(256), __ccgo_ts+14, libc.VaList(bp+264, Xgetprogname(tls)))
  12592. len1 = libc.Int32FromUint32(libc.Xstrlen(tls, bp))
  12593. }
  12594. ap = va
  12595. len1 += libc.X__builtin_vsnprintf(tls, bp+uintptr(len1), uint32(256)-libc.Uint32FromInt32(len1), fmt, ap)
  12596. _ = ap
  12597. } else {
  12598. len1 = libc.X__builtin_snprintf(tls, bp, uint32(256), __ccgo_ts+432, libc.VaList(bp+264, _SPT.Farg0))
  12599. }
  12600. if len1 <= 0 {
  12601. _SPT.Ferror1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  12602. return
  12603. }
  12604. if !(_SPT.Freset != 0) {
  12605. libc.Xmemset(tls, _SPT.Fbase, 0, libc.Uint32FromInt32(int32(_SPT.Fend)-int32(_SPT.Fbase)))
  12606. _SPT.Freset = uint8(m_true)
  12607. } else {
  12608. libc.Xmemset(tls, _SPT.Fbase, 0, _spt_min(tls, uint32(256), libc.Uint32FromInt32(int32(_SPT.Fend)-int32(_SPT.Fbase))))
  12609. }
  12610. len1 = libc.Int32FromUint32(_spt_min(tls, libc.Uint32FromInt32(len1), _spt_min(tls, uint32(256), libc.Uint32FromInt32(int32(_SPT.Fend)-int32(_SPT.Fbase)))-uint32(1)))
  12611. libc.Xmemcpy(tls, _SPT.Fbase, bp, libc.Uint32FromInt32(len1))
  12612. nul = _SPT.Fbase + uintptr(len1)
  12613. if nul < _SPT.Fnul {
  12614. *(*uint8)(unsafe.Pointer(_SPT.Fnul)) = uint8('.')
  12615. } else {
  12616. if nul == _SPT.Fnul && nul+1 < _SPT.Fend {
  12617. *(*uint8)(unsafe.Pointer(_SPT.Fnul)) = uint8(' ')
  12618. nul++
  12619. v1 = nul
  12620. *(*uint8)(unsafe.Pointer(v1)) = uint8('\000')
  12621. }
  12622. }
  12623. }
  12624. // C documentation
  12625. //
  12626. // /*
  12627. // * Appends src to string dst of size dsize (unlike strncat, dsize is the
  12628. // * full size of dst, not space left). At most dsize-1 characters
  12629. // * will be copied. Always NUL terminates (unless dsize <= strlen(dst)).
  12630. // * Returns strlen(src) + MIN(dsize, strlen(initial dst)).
  12631. // * If retval >= dsize, truncation occurred.
  12632. // */
  12633. func Xstrlcat(tls *libc.TLS, dst uintptr, src uintptr, dsize Tsize_t) (r Tsize_t) {
  12634. var dlen, n, v1, v2 Tsize_t
  12635. var odst, osrc, v3 uintptr
  12636. _, _, _, _, _, _, _ = dlen, n, odst, osrc, v1, v2, v3
  12637. odst = dst
  12638. osrc = src
  12639. n = dsize
  12640. /* Find the end of dst and adjust bytes left but don't go past end. */
  12641. for {
  12642. v1 = n
  12643. n--
  12644. if !(v1 != uint32(0) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(dst))) != int32('\000')) {
  12645. break
  12646. }
  12647. dst++
  12648. }
  12649. dlen = libc.Uint32FromInt32(int32(dst) - int32(odst))
  12650. n = dsize - dlen
  12651. v2 = n
  12652. n--
  12653. if v2 == uint32(0) {
  12654. return dlen + libc.Xstrlen(tls, src)
  12655. }
  12656. for libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(src))) != int32('\000') {
  12657. if n != uint32(0) {
  12658. v3 = dst
  12659. dst++
  12660. *(*uint8)(unsafe.Pointer(v3)) = *(*uint8)(unsafe.Pointer(src))
  12661. n--
  12662. }
  12663. src++
  12664. }
  12665. *(*uint8)(unsafe.Pointer(dst)) = uint8('\000')
  12666. return dlen + libc.Uint32FromInt32(int32(src)-int32(osrc)) /* count does not include NUL */
  12667. }
  12668. // C documentation
  12669. //
  12670. // /*
  12671. // * Copy string src to buffer dst of size dsize. At most dsize-1
  12672. // * chars will be copied. Always NUL terminates (unless dsize == 0).
  12673. // * Returns strlen(src); if retval >= dsize, truncation occurred.
  12674. // */
  12675. func Xstrlcpy(tls *libc.TLS, dst uintptr, src uintptr, dsize Tsize_t) (r Tsize_t) {
  12676. var nleft, v1 Tsize_t
  12677. var osrc, v3, v4, v5 uintptr
  12678. var v2 uint8
  12679. _, _, _, _, _, _, _ = nleft, osrc, v1, v2, v3, v4, v5
  12680. osrc = src
  12681. nleft = dsize
  12682. /* Copy as many bytes as will fit. */
  12683. if nleft != uint32(0) {
  12684. for {
  12685. nleft--
  12686. v1 = nleft
  12687. if !(v1 != uint32(0)) {
  12688. break
  12689. }
  12690. v3 = src
  12691. src++
  12692. v2 = *(*uint8)(unsafe.Pointer(v3))
  12693. v4 = dst
  12694. dst++
  12695. *(*uint8)(unsafe.Pointer(v4)) = v2
  12696. if libc.Int32FromUint8(v2) == int32('\000') {
  12697. break
  12698. }
  12699. }
  12700. }
  12701. /* Not enough room in dst, add NUL and traverse rest of src. */
  12702. if nleft == uint32(0) {
  12703. if dsize != uint32(0) {
  12704. *(*uint8)(unsafe.Pointer(dst)) = uint8('\000')
  12705. } /* NUL-terminate dst */
  12706. for {
  12707. v5 = src
  12708. src++
  12709. if !(*(*uint8)(unsafe.Pointer(v5)) != 0) {
  12710. break
  12711. }
  12712. }
  12713. }
  12714. return libc.Uint32FromInt32(int32(src) - int32(osrc) - libc.Int32FromInt32(1)) /* count does not include NUL */
  12715. }
  12716. const m__SL_CHUNKSIZE = 20
  12717. type TStringList = struct {
  12718. Fsl_str uintptr
  12719. Fsl_max Tsize_t
  12720. Fsl_cur Tsize_t
  12721. }
  12722. type T_stringlist = TStringList
  12723. // C documentation
  12724. //
  12725. // /*
  12726. // * sl_init(): Initialize a string list
  12727. // */
  12728. func Xsl_init(tls *libc.TLS) (r uintptr) {
  12729. var sl uintptr
  12730. _ = sl
  12731. sl = libc.Xmalloc(tls, uint32(12))
  12732. if sl == libc.UintptrFromInt32(0) {
  12733. return libc.UintptrFromInt32(0)
  12734. }
  12735. (*TStringList)(unsafe.Pointer(sl)).Fsl_cur = uint32(0)
  12736. (*TStringList)(unsafe.Pointer(sl)).Fsl_max = uint32(m__SL_CHUNKSIZE)
  12737. (*TStringList)(unsafe.Pointer(sl)).Fsl_str = Xreallocarray(tls, libc.UintptrFromInt32(0), (*TStringList)(unsafe.Pointer(sl)).Fsl_max, uint32(4))
  12738. if (*TStringList)(unsafe.Pointer(sl)).Fsl_str == libc.UintptrFromInt32(0) {
  12739. libc.Xfree(tls, sl)
  12740. sl = libc.UintptrFromInt32(0)
  12741. }
  12742. return sl
  12743. }
  12744. // C documentation
  12745. //
  12746. // /*
  12747. // * sl_add(): Add an item to the string list
  12748. // */
  12749. func Xsl_add(tls *libc.TLS, sl uintptr, name uintptr) (r int32) {
  12750. var new1, v2 uintptr
  12751. var v1 Tsize_t
  12752. _, _, _ = new1, v1, v2
  12753. if (*TStringList)(unsafe.Pointer(sl)).Fsl_cur == (*TStringList)(unsafe.Pointer(sl)).Fsl_max-uint32(1) {
  12754. new1 = Xreallocarray(tls, (*TStringList)(unsafe.Pointer(sl)).Fsl_str, (*TStringList)(unsafe.Pointer(sl)).Fsl_max+libc.Uint32FromInt32(m__SL_CHUNKSIZE), uint32(4))
  12755. if new1 == libc.UintptrFromInt32(0) {
  12756. return -int32(1)
  12757. }
  12758. *(*Tsize_t)(unsafe.Pointer(sl + 4)) += uint32(m__SL_CHUNKSIZE)
  12759. (*TStringList)(unsafe.Pointer(sl)).Fsl_str = new1
  12760. }
  12761. v2 = sl + 8
  12762. v1 = *(*Tsize_t)(unsafe.Pointer(v2))
  12763. *(*Tsize_t)(unsafe.Pointer(v2))++
  12764. *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(v1)*4)) = name
  12765. return 0
  12766. }
  12767. // C documentation
  12768. //
  12769. // /*
  12770. // * sl_free(): Free a stringlist
  12771. // */
  12772. func Xsl_free(tls *libc.TLS, sl uintptr, all int32) {
  12773. var i Tsize_t
  12774. _ = i
  12775. if sl == libc.UintptrFromInt32(0) {
  12776. return
  12777. }
  12778. if (*TStringList)(unsafe.Pointer(sl)).Fsl_str != 0 {
  12779. if all != 0 {
  12780. i = uint32(0)
  12781. for {
  12782. if !(i < (*TStringList)(unsafe.Pointer(sl)).Fsl_cur) {
  12783. break
  12784. }
  12785. libc.Xfree(tls, *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*4)))
  12786. goto _1
  12787. _1:
  12788. ;
  12789. i++
  12790. }
  12791. }
  12792. libc.Xfree(tls, (*TStringList)(unsafe.Pointer(sl)).Fsl_str)
  12793. }
  12794. libc.Xfree(tls, sl)
  12795. }
  12796. // C documentation
  12797. //
  12798. // /*
  12799. // * sl_find(): Find a name in the string list
  12800. // */
  12801. func Xsl_find(tls *libc.TLS, sl uintptr, name uintptr) (r uintptr) {
  12802. var i Tsize_t
  12803. _ = i
  12804. i = uint32(0)
  12805. for {
  12806. if !(i < (*TStringList)(unsafe.Pointer(sl)).Fsl_cur) {
  12807. break
  12808. }
  12809. if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*4)), name) == 0 {
  12810. return *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*4))
  12811. }
  12812. goto _1
  12813. _1:
  12814. ;
  12815. i++
  12816. }
  12817. return libc.UintptrFromInt32(0)
  12818. }
  12819. func Xsl_delete(tls *libc.TLS, sl uintptr, name uintptr, all int32) (r int32) {
  12820. var i, j, v3 Tsize_t
  12821. var v4 uintptr
  12822. _, _, _, _ = i, j, v3, v4
  12823. i = uint32(0)
  12824. for {
  12825. if !(i < (*TStringList)(unsafe.Pointer(sl)).Fsl_cur) {
  12826. break
  12827. }
  12828. if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*4)), name) == 0 {
  12829. if all != 0 {
  12830. libc.Xfree(tls, *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*4)))
  12831. }
  12832. j = i + uint32(1)
  12833. for {
  12834. if !(j < (*TStringList)(unsafe.Pointer(sl)).Fsl_cur) {
  12835. break
  12836. }
  12837. *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(j-uint32(1))*4)) = *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(j)*4))
  12838. goto _2
  12839. _2:
  12840. ;
  12841. j++
  12842. }
  12843. v4 = sl + 8
  12844. *(*Tsize_t)(unsafe.Pointer(v4))--
  12845. v3 = *(*Tsize_t)(unsafe.Pointer(v4))
  12846. *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(v3)*4)) = libc.UintptrFromInt32(0)
  12847. return 0
  12848. }
  12849. goto _1
  12850. _1:
  12851. ;
  12852. i++
  12853. }
  12854. return -int32(1)
  12855. }
  12856. const m_S_IFBLK1 = 24576
  12857. const m_S_IFCHR1 = 8192
  12858. const m_S_IFDIR3 = 16384
  12859. const m_S_IFIFO1 = 4096
  12860. const m_S_IFLNK1 = 40960
  12861. const m_S_IFMT1 = 61440
  12862. const m_S_IFREG1 = 32768
  12863. const m_S_IFSOCK1 = 49152
  12864. const m_S_IRGRP3 = 32
  12865. const m_S_IROTH3 = 4
  12866. const m_S_IRUSR3 = 256
  12867. const m_S_ISGID3 = 1024
  12868. const m_S_ISUID3 = 2048
  12869. const m_S_ISVTX3 = 512
  12870. const m_S_IWGRP3 = 16
  12871. const m_S_IWOTH3 = 2
  12872. const m_S_IWUSR3 = 128
  12873. const m_S_IXGRP3 = 8
  12874. const m_S_IXOTH3 = 1
  12875. const m_S_IXUSR3 = 64
  12876. func Xstrmode(tls *libc.TLS, mode Tmode_t, p uintptr) {
  12877. var v1, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v3, v30, v31, v32, v33, v4, v5, v6, v7, v8, v9 uintptr
  12878. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = v1, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v3, v30, v31, v32, v33, v4, v5, v6, v7, v8, v9
  12879. /* print type */
  12880. switch mode & libc.Uint32FromInt32(m_S_IFMT1) {
  12881. case uint32(m_S_IFDIR3): /* directory */
  12882. v1 = p
  12883. p++
  12884. *(*uint8)(unsafe.Pointer(v1)) = uint8('d')
  12885. case uint32(m_S_IFCHR1): /* character special */
  12886. v2 = p
  12887. p++
  12888. *(*uint8)(unsafe.Pointer(v2)) = uint8('c')
  12889. case uint32(m_S_IFBLK1): /* block special */
  12890. v3 = p
  12891. p++
  12892. *(*uint8)(unsafe.Pointer(v3)) = uint8('b')
  12893. case uint32(m_S_IFREG1): /* regular */
  12894. v4 = p
  12895. p++
  12896. *(*uint8)(unsafe.Pointer(v4)) = uint8('-')
  12897. case uint32(m_S_IFLNK1): /* symbolic link */
  12898. v5 = p
  12899. p++
  12900. *(*uint8)(unsafe.Pointer(v5)) = uint8('l')
  12901. case uint32(m_S_IFSOCK1): /* socket */
  12902. v6 = p
  12903. p++
  12904. *(*uint8)(unsafe.Pointer(v6)) = uint8('s')
  12905. case uint32(m_S_IFIFO1): /* fifo */
  12906. v7 = p
  12907. p++
  12908. *(*uint8)(unsafe.Pointer(v7)) = uint8('p')
  12909. default: /* unknown */
  12910. v8 = p
  12911. p++
  12912. *(*uint8)(unsafe.Pointer(v8)) = uint8('?')
  12913. break
  12914. }
  12915. /* usr */
  12916. if mode&uint32(m_S_IRUSR3) != 0 {
  12917. v9 = p
  12918. p++
  12919. *(*uint8)(unsafe.Pointer(v9)) = uint8('r')
  12920. } else {
  12921. v10 = p
  12922. p++
  12923. *(*uint8)(unsafe.Pointer(v10)) = uint8('-')
  12924. }
  12925. if mode&uint32(m_S_IWUSR3) != 0 {
  12926. v11 = p
  12927. p++
  12928. *(*uint8)(unsafe.Pointer(v11)) = uint8('w')
  12929. } else {
  12930. v12 = p
  12931. p++
  12932. *(*uint8)(unsafe.Pointer(v12)) = uint8('-')
  12933. }
  12934. switch mode & libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXUSR3)|libc.Int32FromInt32(m_S_ISUID3)) {
  12935. case uint32(0):
  12936. v13 = p
  12937. p++
  12938. *(*uint8)(unsafe.Pointer(v13)) = uint8('-')
  12939. case uint32(m_S_IXUSR3):
  12940. v14 = p
  12941. p++
  12942. *(*uint8)(unsafe.Pointer(v14)) = uint8('x')
  12943. case uint32(m_S_ISUID3):
  12944. v15 = p
  12945. p++
  12946. *(*uint8)(unsafe.Pointer(v15)) = uint8('S')
  12947. case libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXUSR3) | libc.Int32FromInt32(m_S_ISUID3)):
  12948. v16 = p
  12949. p++
  12950. *(*uint8)(unsafe.Pointer(v16)) = uint8('s')
  12951. break
  12952. }
  12953. /* group */
  12954. if mode&uint32(m_S_IRGRP3) != 0 {
  12955. v17 = p
  12956. p++
  12957. *(*uint8)(unsafe.Pointer(v17)) = uint8('r')
  12958. } else {
  12959. v18 = p
  12960. p++
  12961. *(*uint8)(unsafe.Pointer(v18)) = uint8('-')
  12962. }
  12963. if mode&uint32(m_S_IWGRP3) != 0 {
  12964. v19 = p
  12965. p++
  12966. *(*uint8)(unsafe.Pointer(v19)) = uint8('w')
  12967. } else {
  12968. v20 = p
  12969. p++
  12970. *(*uint8)(unsafe.Pointer(v20)) = uint8('-')
  12971. }
  12972. switch mode & libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXGRP3)|libc.Int32FromInt32(m_S_ISGID3)) {
  12973. case uint32(0):
  12974. v21 = p
  12975. p++
  12976. *(*uint8)(unsafe.Pointer(v21)) = uint8('-')
  12977. case uint32(m_S_IXGRP3):
  12978. v22 = p
  12979. p++
  12980. *(*uint8)(unsafe.Pointer(v22)) = uint8('x')
  12981. case uint32(m_S_ISGID3):
  12982. v23 = p
  12983. p++
  12984. *(*uint8)(unsafe.Pointer(v23)) = uint8('S')
  12985. case libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXGRP3) | libc.Int32FromInt32(m_S_ISGID3)):
  12986. v24 = p
  12987. p++
  12988. *(*uint8)(unsafe.Pointer(v24)) = uint8('s')
  12989. break
  12990. }
  12991. /* other */
  12992. if mode&uint32(m_S_IROTH3) != 0 {
  12993. v25 = p
  12994. p++
  12995. *(*uint8)(unsafe.Pointer(v25)) = uint8('r')
  12996. } else {
  12997. v26 = p
  12998. p++
  12999. *(*uint8)(unsafe.Pointer(v26)) = uint8('-')
  13000. }
  13001. if mode&uint32(m_S_IWOTH3) != 0 {
  13002. v27 = p
  13003. p++
  13004. *(*uint8)(unsafe.Pointer(v27)) = uint8('w')
  13005. } else {
  13006. v28 = p
  13007. p++
  13008. *(*uint8)(unsafe.Pointer(v28)) = uint8('-')
  13009. }
  13010. switch mode & libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXOTH3)|libc.Int32FromInt32(m_S_ISVTX3)) {
  13011. case uint32(0):
  13012. v29 = p
  13013. p++
  13014. *(*uint8)(unsafe.Pointer(v29)) = uint8('-')
  13015. case uint32(m_S_IXOTH3):
  13016. v30 = p
  13017. p++
  13018. *(*uint8)(unsafe.Pointer(v30)) = uint8('x')
  13019. case uint32(m_S_ISVTX3):
  13020. v31 = p
  13021. p++
  13022. *(*uint8)(unsafe.Pointer(v31)) = uint8('T')
  13023. case libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXOTH3) | libc.Int32FromInt32(m_S_ISVTX3)):
  13024. v32 = p
  13025. p++
  13026. *(*uint8)(unsafe.Pointer(v32)) = uint8('t')
  13027. break
  13028. }
  13029. v33 = p
  13030. p++
  13031. *(*uint8)(unsafe.Pointer(v33)) = uint8(' ') /* will be a '+' if ACL's implemented */
  13032. *(*uint8)(unsafe.Pointer(p)) = uint8('\000')
  13033. }
  13034. // C documentation
  13035. //
  13036. // /*
  13037. // * Find the first occurrence of find in s, where the search is limited to the
  13038. // * first slen characters of s.
  13039. // */
  13040. func Xstrnstr(tls *libc.TLS, s uintptr, find uintptr, slen Tsize_t) (r uintptr) {
  13041. var c, sc, v1, v4 uint8
  13042. var len1, v3 Tsize_t
  13043. var v2, v5 uintptr
  13044. var v6 bool
  13045. _, _, _, _, _, _, _, _, _ = c, len1, sc, v1, v2, v3, v4, v5, v6
  13046. v2 = find
  13047. find++
  13048. v1 = *(*uint8)(unsafe.Pointer(v2))
  13049. c = v1
  13050. if libc.Int32FromUint8(v1) != int32('\000') {
  13051. len1 = libc.Xstrlen(tls, find)
  13052. for cond := true; cond; cond = libc.Xstrncmp(tls, s, find, len1) != 0 {
  13053. for cond := true; cond; cond = libc.Int32FromUint8(sc) != libc.Int32FromUint8(c) {
  13054. v3 = slen
  13055. slen--
  13056. if v6 = v3 < uint32(1); !v6 {
  13057. v5 = s
  13058. s++
  13059. v4 = *(*uint8)(unsafe.Pointer(v5))
  13060. sc = v4
  13061. }
  13062. if v6 || libc.Int32FromUint8(v4) == int32('\000') {
  13063. return libc.UintptrFromInt32(0)
  13064. }
  13065. }
  13066. if len1 > slen {
  13067. return libc.UintptrFromInt32(0)
  13068. }
  13069. }
  13070. s--
  13071. }
  13072. return s
  13073. }
  13074. func Xstrtoi(tls *libc.TLS, nptr uintptr, endptr uintptr, base int32, lo Tintmax_t, hi Tintmax_t, rstatus uintptr) (r Tintmax_t) {
  13075. bp := tls.Alloc(16)
  13076. defer tls.Free(16)
  13077. var im Tintmax_t
  13078. var serrno int32
  13079. var _ /* ep at bp+0 */ uintptr
  13080. var _ /* rep at bp+4 */ int32
  13081. _, _ = im, serrno
  13082. /* endptr may be NULL */
  13083. if endptr == libc.UintptrFromInt32(0) {
  13084. endptr = bp
  13085. }
  13086. if rstatus == libc.UintptrFromInt32(0) {
  13087. rstatus = bp + 4
  13088. }
  13089. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  13090. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  13091. im = libc.Xstrtoimax(tls, nptr, endptr, base)
  13092. *(*int32)(unsafe.Pointer(rstatus)) = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  13093. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  13094. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  13095. /* No digits were found */
  13096. if nptr == *(*uintptr)(unsafe.Pointer(endptr)) {
  13097. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ECANCELED)
  13098. } else {
  13099. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(endptr))))) != int32('\000') {
  13100. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_EOPNOTSUPP)
  13101. }
  13102. }
  13103. }
  13104. if im < lo {
  13105. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  13106. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ERANGE)
  13107. }
  13108. return lo
  13109. }
  13110. if im > hi {
  13111. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  13112. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ERANGE)
  13113. }
  13114. return hi
  13115. }
  13116. return im
  13117. }
  13118. const m_S_IFBLK2 = 0060000
  13119. const m_S_IFCHR2 = 0020000
  13120. const m_S_IFDIR4 = 0040000
  13121. const m_S_IFIFO2 = 0010000
  13122. const m_S_IFLNK2 = 0120000
  13123. const m_S_IFMT2 = 0170000
  13124. const m_S_IFREG2 = 0100000
  13125. const m_S_IFSOCK2 = 0140000
  13126. const m_S_IRGRP4 = 0040
  13127. const m_S_IROTH4 = 0004
  13128. const m_S_IRUSR4 = 0400
  13129. const m_S_ISGID4 = 02000
  13130. const m_S_ISUID4 = 04000
  13131. const m_S_ISVTX4 = 01000
  13132. const m_S_IWGRP4 = 0020
  13133. const m_S_IWOTH4 = 0002
  13134. const m_S_IWUSR4 = 0200
  13135. const m_S_IXGRP4 = 0010
  13136. const m_S_IXOTH4 = 0001
  13137. const m_S_IXUSR4 = 0100
  13138. func Xstrtonum(tls *libc.TLS, nptr uintptr, minval int64, maxval int64, errstr uintptr) (r int64) {
  13139. bp := tls.Alloc(16)
  13140. defer tls.Free(16)
  13141. var rv int64
  13142. var v1 uintptr
  13143. var _ /* e at bp+0 */ int32
  13144. var _ /* resp at bp+4 */ uintptr
  13145. _, _ = rv, v1
  13146. if errstr == libc.UintptrFromInt32(0) {
  13147. errstr = bp + 4
  13148. }
  13149. rv = Xstrtoi(tls, nptr, libc.UintptrFromInt32(0), int32(10), minval, maxval, bp)
  13150. if *(*int32)(unsafe.Pointer(bp)) == 0 {
  13151. *(*uintptr)(unsafe.Pointer(errstr)) = libc.UintptrFromInt32(0)
  13152. return rv
  13153. }
  13154. if *(*int32)(unsafe.Pointer(bp)) == int32(m_ERANGE) {
  13155. if rv == maxval {
  13156. v1 = __ccgo_ts + 435
  13157. } else {
  13158. v1 = __ccgo_ts + 445
  13159. }
  13160. *(*uintptr)(unsafe.Pointer(errstr)) = v1
  13161. } else {
  13162. *(*uintptr)(unsafe.Pointer(errstr)) = __ccgo_ts + 455
  13163. }
  13164. return 0
  13165. }
  13166. func Xstrtou(tls *libc.TLS, nptr uintptr, endptr uintptr, base int32, lo Tuintmax_t, hi Tuintmax_t, rstatus uintptr) (r Tuintmax_t) {
  13167. bp := tls.Alloc(16)
  13168. defer tls.Free(16)
  13169. var im Tuintmax_t
  13170. var serrno int32
  13171. var _ /* ep at bp+0 */ uintptr
  13172. var _ /* rep at bp+4 */ int32
  13173. _, _ = im, serrno
  13174. /* endptr may be NULL */
  13175. if endptr == libc.UintptrFromInt32(0) {
  13176. endptr = bp
  13177. }
  13178. if rstatus == libc.UintptrFromInt32(0) {
  13179. rstatus = bp + 4
  13180. }
  13181. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  13182. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  13183. im = libc.Xstrtoumax(tls, nptr, endptr, base)
  13184. *(*int32)(unsafe.Pointer(rstatus)) = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  13185. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  13186. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  13187. /* No digits were found */
  13188. if nptr == *(*uintptr)(unsafe.Pointer(endptr)) {
  13189. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ECANCELED)
  13190. } else {
  13191. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(endptr))))) != int32('\000') {
  13192. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_EOPNOTSUPP)
  13193. }
  13194. }
  13195. }
  13196. if im < lo {
  13197. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  13198. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ERANGE)
  13199. }
  13200. return lo
  13201. }
  13202. if im > hi {
  13203. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  13204. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ERANGE)
  13205. }
  13206. return hi
  13207. }
  13208. return im
  13209. }
  13210. // C documentation
  13211. //
  13212. // /*
  13213. // * Convert a 32 bit representation of time_t into time_t. XXX needs to
  13214. // * implement the 50-year rule to handle post-2038 conversions.
  13215. // */
  13216. func X_time32_to_time(tls *libc.TLS, t32 Tint32_t) (r Ttime_t) {
  13217. return int64(t32)
  13218. }
  13219. // C documentation
  13220. //
  13221. // /*
  13222. // * Convert time_t to a 32 bit representation. If time_t is 64 bits we can
  13223. // * simply chop it down. The resulting 32 bit representation can be
  13224. // * converted back to a temporally local 64 bit time_t using time32_to_time.
  13225. // */
  13226. func X_time_to_time32(tls *libc.TLS, t Ttime_t) (r Tint32_t) {
  13227. return int32(t)
  13228. }
  13229. // C documentation
  13230. //
  13231. // /*
  13232. // * Convert a 64 bit representation of time_t into time_t. If time_t is
  13233. // * represented as 32 bits we can simply chop it and not support times
  13234. // * past 2038.
  13235. // */
  13236. func X_time64_to_time(tls *libc.TLS, t64 Tint64_t) (r Ttime_t) {
  13237. return t64
  13238. }
  13239. // C documentation
  13240. //
  13241. // /*
  13242. // * Convert time_t to a 64 bit representation. If time_t is represented
  13243. // * as 32 bits we simply sign-extend and do not support times past 2038.
  13244. // */
  13245. func X_time_to_time64(tls *libc.TLS, t Ttime_t) (r Tint64_t) {
  13246. return t
  13247. }
  13248. // C documentation
  13249. //
  13250. // /*
  13251. // * Convert to/from 'long'. Depending on the sizeof(long) this may or
  13252. // * may not require using the 50-year rule.
  13253. // */
  13254. func X_time_to_long(tls *libc.TLS, t Ttime_t) (r int32) {
  13255. if uint32(4) == uint32(8) {
  13256. return int32(X_time_to_time64(tls, t))
  13257. }
  13258. return int32(t)
  13259. }
  13260. func X_long_to_time(tls *libc.TLS, tlong int32) (r Ttime_t) {
  13261. if uint32(4) == uint32(4) {
  13262. return X_time32_to_time(tls, tlong)
  13263. }
  13264. return int64(tlong)
  13265. }
  13266. // C documentation
  13267. //
  13268. // /*
  13269. // * Convert to/from 'int'. Depending on the sizeof(int) this may or
  13270. // * may not require using the 50-year rule.
  13271. // */
  13272. func X_time_to_int(tls *libc.TLS, t Ttime_t) (r int32) {
  13273. if uint32(4) == uint32(8) {
  13274. return int32(X_time_to_time64(tls, t))
  13275. }
  13276. return int32(t)
  13277. }
  13278. func X_int_to_time(tls *libc.TLS, tint int32) (r Ttime_t) {
  13279. if uint32(4) == uint32(4) {
  13280. return X_time32_to_time(tls, tint)
  13281. }
  13282. return int64(tint)
  13283. }
  13284. const m_S_AMP = 13
  13285. const m_S_CTRL = 4
  13286. const m_S_EATCRNL = 12
  13287. const m_S_GROUND = 0
  13288. const m_S_HEX = 7
  13289. const m_S_HEX1 = 8
  13290. const m_S_HEX2 = 9
  13291. const m_S_META = 2
  13292. const m_S_META1 = 3
  13293. const m_S_MIME1 = 10
  13294. const m_S_MIME2 = 11
  13295. const m_S_NUMBER = 14
  13296. const m_S_OCTAL2 = 5
  13297. const m_S_OCTAL3 = 6
  13298. const m_S_START = 1
  13299. const m_S_STRING = 15
  13300. const m_UNVIS_END = "_VIS_END"
  13301. const m_UNVIS_NOCHAR = 3
  13302. const m_UNVIS_VALID = 1
  13303. const m_UNVIS_VALIDPUSH = 2
  13304. const m_VIS_CSTYLE = 0x0002
  13305. const m_VIS_DQ = 0x8000
  13306. const m_VIS_GLOB = 0x1000
  13307. const m_VIS_HTTP1808 = 128
  13308. const m_VIS_HTTP1866 = 512
  13309. const m_VIS_HTTPSTYLE = 0x0080
  13310. const m_VIS_MIMESTYLE = 256
  13311. const m_VIS_NL = 0x0010
  13312. const m_VIS_NOESCAPE = 1024
  13313. const m_VIS_NOLOCALE = 0x4000
  13314. const m_VIS_NOSLASH = 0x0040
  13315. const m_VIS_OCTAL = 0x0001
  13316. const m_VIS_SAFE = 0x0020
  13317. const m_VIS_SHELL = 0x2000
  13318. const m_VIS_SP = 0x0004
  13319. const m_VIS_TAB = 0x0008
  13320. const m__VIS_END = 2048
  13321. /*
  13322. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  13323. *
  13324. * Redistribution and use in source and binary forms, with or without
  13325. * modification, are permitted provided that the following conditions
  13326. * are met:
  13327. * 1. Redistributions of source code must retain the above copyright
  13328. * notice, this list of conditions and the following disclaimer.
  13329. * 2. Redistributions in binary form must reproduce the above copyright
  13330. * notice, this list of conditions and the following disclaimer in the
  13331. * documentation and/or other materials provided with the distribution.
  13332. * 3. The name of the author may not be used to endorse or promote products
  13333. * derived from this software without specific prior written permission.
  13334. *
  13335. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  13336. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  13337. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  13338. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  13339. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13340. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  13341. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  13342. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  13343. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  13344. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  13345. */
  13346. /*
  13347. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  13348. *
  13349. * Redistribution and use in source and binary forms, with or without
  13350. * modification, are permitted provided that the following conditions
  13351. * are met:
  13352. * 1. Redistributions of source code must retain the above copyright
  13353. * notice, this list of conditions and the following disclaimer.
  13354. * 2. Redistributions in binary form must reproduce the above copyright
  13355. * notice, this list of conditions and the following disclaimer in the
  13356. * documentation and/or other materials provided with the distribution.
  13357. * 3. The name of the author may not be used to endorse or promote products
  13358. * derived from this software without specific prior written permission.
  13359. *
  13360. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  13361. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  13362. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  13363. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  13364. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13365. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  13366. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  13367. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  13368. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  13369. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  13370. */
  13371. /* Clang expands this to 1 if an identifier is *not* reserved. */
  13372. /*
  13373. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  13374. * musl, try to handle this gracefully.
  13375. */
  13376. /* Copyright (C) 1992-2022 Free Software Foundation, Inc.
  13377. Copyright The GNU Toolchain Authors.
  13378. This file is part of the GNU C Library.
  13379. The GNU C Library is free software; you can redistribute it and/or
  13380. modify it under the terms of the GNU Lesser General Public
  13381. License as published by the Free Software Foundation; either
  13382. version 2.1 of the License, or (at your option) any later version.
  13383. The GNU C Library is distributed in the hope that it will be useful,
  13384. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13385. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13386. Lesser General Public License for more details.
  13387. You should have received a copy of the GNU Lesser General Public
  13388. License along with the GNU C Library; if not, see
  13389. <https://www.gnu.org/licenses/>. */
  13390. /*
  13391. * decode driven by state machine
  13392. */
  13393. // C documentation
  13394. //
  13395. // /*
  13396. // * RFC 1866
  13397. // */
  13398. type Tnv = struct {
  13399. Fname [7]uint8
  13400. Fvalue Tuint8_t
  13401. }
  13402. /*
  13403. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  13404. *
  13405. * Redistribution and use in source and binary forms, with or without
  13406. * modification, are permitted provided that the following conditions
  13407. * are met:
  13408. * 1. Redistributions of source code must retain the above copyright
  13409. * notice, this list of conditions and the following disclaimer.
  13410. * 2. Redistributions in binary form must reproduce the above copyright
  13411. * notice, this list of conditions and the following disclaimer in the
  13412. * documentation and/or other materials provided with the distribution.
  13413. * 3. The name of the author may not be used to endorse or promote products
  13414. * derived from this software without specific prior written permission.
  13415. *
  13416. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  13417. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  13418. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  13419. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  13420. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13421. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  13422. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  13423. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  13424. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  13425. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  13426. */
  13427. /*
  13428. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  13429. *
  13430. * Redistribution and use in source and binary forms, with or without
  13431. * modification, are permitted provided that the following conditions
  13432. * are met:
  13433. * 1. Redistributions of source code must retain the above copyright
  13434. * notice, this list of conditions and the following disclaimer.
  13435. * 2. Redistributions in binary form must reproduce the above copyright
  13436. * notice, this list of conditions and the following disclaimer in the
  13437. * documentation and/or other materials provided with the distribution.
  13438. * 3. The name of the author may not be used to endorse or promote products
  13439. * derived from this software without specific prior written permission.
  13440. *
  13441. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  13442. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  13443. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  13444. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  13445. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13446. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  13447. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  13448. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  13449. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  13450. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  13451. */
  13452. /* Clang expands this to 1 if an identifier is *not* reserved. */
  13453. /*
  13454. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  13455. * musl, try to handle this gracefully.
  13456. */
  13457. /* Copyright (C) 1992-2022 Free Software Foundation, Inc.
  13458. Copyright The GNU Toolchain Authors.
  13459. This file is part of the GNU C Library.
  13460. The GNU C Library is free software; you can redistribute it and/or
  13461. modify it under the terms of the GNU Lesser General Public
  13462. License as published by the Free Software Foundation; either
  13463. version 2.1 of the License, or (at your option) any later version.
  13464. The GNU C Library is distributed in the hope that it will be useful,
  13465. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13466. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13467. Lesser General Public License for more details.
  13468. You should have received a copy of the GNU Lesser General Public
  13469. License along with the GNU C Library; if not, see
  13470. <https://www.gnu.org/licenses/>. */
  13471. /*
  13472. * decode driven by state machine
  13473. */
  13474. // C documentation
  13475. //
  13476. // /*
  13477. // * RFC 1866
  13478. // */
  13479. var _nv = [100]Tnv{
  13480. 0: {
  13481. Fname: [7]uint8{'A', 'E', 'l', 'i', 'g'},
  13482. Fvalue: uint8(198),
  13483. },
  13484. 1: {
  13485. Fname: [7]uint8{'A', 'a', 'c', 'u', 't', 'e'},
  13486. Fvalue: uint8(193),
  13487. },
  13488. 2: {
  13489. Fname: [7]uint8{'A', 'c', 'i', 'r', 'c'},
  13490. Fvalue: uint8(194),
  13491. },
  13492. 3: {
  13493. Fname: [7]uint8{'A', 'g', 'r', 'a', 'v', 'e'},
  13494. Fvalue: uint8(192),
  13495. },
  13496. 4: {
  13497. Fname: [7]uint8{'A', 'r', 'i', 'n', 'g'},
  13498. Fvalue: uint8(197),
  13499. },
  13500. 5: {
  13501. Fname: [7]uint8{'A', 't', 'i', 'l', 'd', 'e'},
  13502. Fvalue: uint8(195),
  13503. },
  13504. 6: {
  13505. Fname: [7]uint8{'A', 'u', 'm', 'l'},
  13506. Fvalue: uint8(196),
  13507. },
  13508. 7: {
  13509. Fname: [7]uint8{'C', 'c', 'e', 'd', 'i', 'l'},
  13510. Fvalue: uint8(199),
  13511. },
  13512. 8: {
  13513. Fname: [7]uint8{'E', 'T', 'H'},
  13514. Fvalue: uint8(208),
  13515. },
  13516. 9: {
  13517. Fname: [7]uint8{'E', 'a', 'c', 'u', 't', 'e'},
  13518. Fvalue: uint8(201),
  13519. },
  13520. 10: {
  13521. Fname: [7]uint8{'E', 'c', 'i', 'r', 'c'},
  13522. Fvalue: uint8(202),
  13523. },
  13524. 11: {
  13525. Fname: [7]uint8{'E', 'g', 'r', 'a', 'v', 'e'},
  13526. Fvalue: uint8(200),
  13527. },
  13528. 12: {
  13529. Fname: [7]uint8{'E', 'u', 'm', 'l'},
  13530. Fvalue: uint8(203),
  13531. },
  13532. 13: {
  13533. Fname: [7]uint8{'I', 'a', 'c', 'u', 't', 'e'},
  13534. Fvalue: uint8(205),
  13535. },
  13536. 14: {
  13537. Fname: [7]uint8{'I', 'c', 'i', 'r', 'c'},
  13538. Fvalue: uint8(206),
  13539. },
  13540. 15: {
  13541. Fname: [7]uint8{'I', 'g', 'r', 'a', 'v', 'e'},
  13542. Fvalue: uint8(204),
  13543. },
  13544. 16: {
  13545. Fname: [7]uint8{'I', 'u', 'm', 'l'},
  13546. Fvalue: uint8(207),
  13547. },
  13548. 17: {
  13549. Fname: [7]uint8{'N', 't', 'i', 'l', 'd', 'e'},
  13550. Fvalue: uint8(209),
  13551. },
  13552. 18: {
  13553. Fname: [7]uint8{'O', 'a', 'c', 'u', 't', 'e'},
  13554. Fvalue: uint8(211),
  13555. },
  13556. 19: {
  13557. Fname: [7]uint8{'O', 'c', 'i', 'r', 'c'},
  13558. Fvalue: uint8(212),
  13559. },
  13560. 20: {
  13561. Fname: [7]uint8{'O', 'g', 'r', 'a', 'v', 'e'},
  13562. Fvalue: uint8(210),
  13563. },
  13564. 21: {
  13565. Fname: [7]uint8{'O', 's', 'l', 'a', 's', 'h'},
  13566. Fvalue: uint8(216),
  13567. },
  13568. 22: {
  13569. Fname: [7]uint8{'O', 't', 'i', 'l', 'd', 'e'},
  13570. Fvalue: uint8(213),
  13571. },
  13572. 23: {
  13573. Fname: [7]uint8{'O', 'u', 'm', 'l'},
  13574. Fvalue: uint8(214),
  13575. },
  13576. 24: {
  13577. Fname: [7]uint8{'T', 'H', 'O', 'R', 'N'},
  13578. Fvalue: uint8(222),
  13579. },
  13580. 25: {
  13581. Fname: [7]uint8{'U', 'a', 'c', 'u', 't', 'e'},
  13582. Fvalue: uint8(218),
  13583. },
  13584. 26: {
  13585. Fname: [7]uint8{'U', 'c', 'i', 'r', 'c'},
  13586. Fvalue: uint8(219),
  13587. },
  13588. 27: {
  13589. Fname: [7]uint8{'U', 'g', 'r', 'a', 'v', 'e'},
  13590. Fvalue: uint8(217),
  13591. },
  13592. 28: {
  13593. Fname: [7]uint8{'U', 'u', 'm', 'l'},
  13594. Fvalue: uint8(220),
  13595. },
  13596. 29: {
  13597. Fname: [7]uint8{'Y', 'a', 'c', 'u', 't', 'e'},
  13598. Fvalue: uint8(221),
  13599. },
  13600. 30: {
  13601. Fname: [7]uint8{'a', 'a', 'c', 'u', 't', 'e'},
  13602. Fvalue: uint8(225),
  13603. },
  13604. 31: {
  13605. Fname: [7]uint8{'a', 'c', 'i', 'r', 'c'},
  13606. Fvalue: uint8(226),
  13607. },
  13608. 32: {
  13609. Fname: [7]uint8{'a', 'c', 'u', 't', 'e'},
  13610. Fvalue: uint8(180),
  13611. },
  13612. 33: {
  13613. Fname: [7]uint8{'a', 'e', 'l', 'i', 'g'},
  13614. Fvalue: uint8(230),
  13615. },
  13616. 34: {
  13617. Fname: [7]uint8{'a', 'g', 'r', 'a', 'v', 'e'},
  13618. Fvalue: uint8(224),
  13619. },
  13620. 35: {
  13621. Fname: [7]uint8{'a', 'm', 'p'},
  13622. Fvalue: uint8(38),
  13623. },
  13624. 36: {
  13625. Fname: [7]uint8{'a', 'r', 'i', 'n', 'g'},
  13626. Fvalue: uint8(229),
  13627. },
  13628. 37: {
  13629. Fname: [7]uint8{'a', 't', 'i', 'l', 'd', 'e'},
  13630. Fvalue: uint8(227),
  13631. },
  13632. 38: {
  13633. Fname: [7]uint8{'a', 'u', 'm', 'l'},
  13634. Fvalue: uint8(228),
  13635. },
  13636. 39: {
  13637. Fname: [7]uint8{'b', 'r', 'v', 'b', 'a', 'r'},
  13638. Fvalue: uint8(166),
  13639. },
  13640. 40: {
  13641. Fname: [7]uint8{'c', 'c', 'e', 'd', 'i', 'l'},
  13642. Fvalue: uint8(231),
  13643. },
  13644. 41: {
  13645. Fname: [7]uint8{'c', 'e', 'd', 'i', 'l'},
  13646. Fvalue: uint8(184),
  13647. },
  13648. 42: {
  13649. Fname: [7]uint8{'c', 'e', 'n', 't'},
  13650. Fvalue: uint8(162),
  13651. },
  13652. 43: {
  13653. Fname: [7]uint8{'c', 'o', 'p', 'y'},
  13654. Fvalue: uint8(169),
  13655. },
  13656. 44: {
  13657. Fname: [7]uint8{'c', 'u', 'r', 'r', 'e', 'n'},
  13658. Fvalue: uint8(164),
  13659. },
  13660. 45: {
  13661. Fname: [7]uint8{'d', 'e', 'g'},
  13662. Fvalue: uint8(176),
  13663. },
  13664. 46: {
  13665. Fname: [7]uint8{'d', 'i', 'v', 'i', 'd', 'e'},
  13666. Fvalue: uint8(247),
  13667. },
  13668. 47: {
  13669. Fname: [7]uint8{'e', 'a', 'c', 'u', 't', 'e'},
  13670. Fvalue: uint8(233),
  13671. },
  13672. 48: {
  13673. Fname: [7]uint8{'e', 'c', 'i', 'r', 'c'},
  13674. Fvalue: uint8(234),
  13675. },
  13676. 49: {
  13677. Fname: [7]uint8{'e', 'g', 'r', 'a', 'v', 'e'},
  13678. Fvalue: uint8(232),
  13679. },
  13680. 50: {
  13681. Fname: [7]uint8{'e', 't', 'h'},
  13682. Fvalue: uint8(240),
  13683. },
  13684. 51: {
  13685. Fname: [7]uint8{'e', 'u', 'm', 'l'},
  13686. Fvalue: uint8(235),
  13687. },
  13688. 52: {
  13689. Fname: [7]uint8{'f', 'r', 'a', 'c', '1', '2'},
  13690. Fvalue: uint8(189),
  13691. },
  13692. 53: {
  13693. Fname: [7]uint8{'f', 'r', 'a', 'c', '1', '4'},
  13694. Fvalue: uint8(188),
  13695. },
  13696. 54: {
  13697. Fname: [7]uint8{'f', 'r', 'a', 'c', '3', '4'},
  13698. Fvalue: uint8(190),
  13699. },
  13700. 55: {
  13701. Fname: [7]uint8{'g', 't'},
  13702. Fvalue: uint8(62),
  13703. },
  13704. 56: {
  13705. Fname: [7]uint8{'i', 'a', 'c', 'u', 't', 'e'},
  13706. Fvalue: uint8(237),
  13707. },
  13708. 57: {
  13709. Fname: [7]uint8{'i', 'c', 'i', 'r', 'c'},
  13710. Fvalue: uint8(238),
  13711. },
  13712. 58: {
  13713. Fname: [7]uint8{'i', 'e', 'x', 'c', 'l'},
  13714. Fvalue: uint8(161),
  13715. },
  13716. 59: {
  13717. Fname: [7]uint8{'i', 'g', 'r', 'a', 'v', 'e'},
  13718. Fvalue: uint8(236),
  13719. },
  13720. 60: {
  13721. Fname: [7]uint8{'i', 'q', 'u', 'e', 's', 't'},
  13722. Fvalue: uint8(191),
  13723. },
  13724. 61: {
  13725. Fname: [7]uint8{'i', 'u', 'm', 'l'},
  13726. Fvalue: uint8(239),
  13727. },
  13728. 62: {
  13729. Fname: [7]uint8{'l', 'a', 'q', 'u', 'o'},
  13730. Fvalue: uint8(171),
  13731. },
  13732. 63: {
  13733. Fname: [7]uint8{'l', 't'},
  13734. Fvalue: uint8(60),
  13735. },
  13736. 64: {
  13737. Fname: [7]uint8{'m', 'a', 'c', 'r'},
  13738. Fvalue: uint8(175),
  13739. },
  13740. 65: {
  13741. Fname: [7]uint8{'m', 'i', 'c', 'r', 'o'},
  13742. Fvalue: uint8(181),
  13743. },
  13744. 66: {
  13745. Fname: [7]uint8{'m', 'i', 'd', 'd', 'o', 't'},
  13746. Fvalue: uint8(183),
  13747. },
  13748. 67: {
  13749. Fname: [7]uint8{'n', 'b', 's', 'p'},
  13750. Fvalue: uint8(160),
  13751. },
  13752. 68: {
  13753. Fname: [7]uint8{'n', 'o', 't'},
  13754. Fvalue: uint8(172),
  13755. },
  13756. 69: {
  13757. Fname: [7]uint8{'n', 't', 'i', 'l', 'd', 'e'},
  13758. Fvalue: uint8(241),
  13759. },
  13760. 70: {
  13761. Fname: [7]uint8{'o', 'a', 'c', 'u', 't', 'e'},
  13762. Fvalue: uint8(243),
  13763. },
  13764. 71: {
  13765. Fname: [7]uint8{'o', 'c', 'i', 'r', 'c'},
  13766. Fvalue: uint8(244),
  13767. },
  13768. 72: {
  13769. Fname: [7]uint8{'o', 'g', 'r', 'a', 'v', 'e'},
  13770. Fvalue: uint8(242),
  13771. },
  13772. 73: {
  13773. Fname: [7]uint8{'o', 'r', 'd', 'f'},
  13774. Fvalue: uint8(170),
  13775. },
  13776. 74: {
  13777. Fname: [7]uint8{'o', 'r', 'd', 'm'},
  13778. Fvalue: uint8(186),
  13779. },
  13780. 75: {
  13781. Fname: [7]uint8{'o', 's', 'l', 'a', 's', 'h'},
  13782. Fvalue: uint8(248),
  13783. },
  13784. 76: {
  13785. Fname: [7]uint8{'o', 't', 'i', 'l', 'd', 'e'},
  13786. Fvalue: uint8(245),
  13787. },
  13788. 77: {
  13789. Fname: [7]uint8{'o', 'u', 'm', 'l'},
  13790. Fvalue: uint8(246),
  13791. },
  13792. 78: {
  13793. Fname: [7]uint8{'p', 'a', 'r', 'a'},
  13794. Fvalue: uint8(182),
  13795. },
  13796. 79: {
  13797. Fname: [7]uint8{'p', 'l', 'u', 's', 'm', 'n'},
  13798. Fvalue: uint8(177),
  13799. },
  13800. 80: {
  13801. Fname: [7]uint8{'p', 'o', 'u', 'n', 'd'},
  13802. Fvalue: uint8(163),
  13803. },
  13804. 81: {
  13805. Fname: [7]uint8{'q', 'u', 'o', 't'},
  13806. Fvalue: uint8(34),
  13807. },
  13808. 82: {
  13809. Fname: [7]uint8{'r', 'a', 'q', 'u', 'o'},
  13810. Fvalue: uint8(187),
  13811. },
  13812. 83: {
  13813. Fname: [7]uint8{'r', 'e', 'g'},
  13814. Fvalue: uint8(174),
  13815. },
  13816. 84: {
  13817. Fname: [7]uint8{'s', 'e', 'c', 't'},
  13818. Fvalue: uint8(167),
  13819. },
  13820. 85: {
  13821. Fname: [7]uint8{'s', 'h', 'y'},
  13822. Fvalue: uint8(173),
  13823. },
  13824. 86: {
  13825. Fname: [7]uint8{'s', 'u', 'p', '1'},
  13826. Fvalue: uint8(185),
  13827. },
  13828. 87: {
  13829. Fname: [7]uint8{'s', 'u', 'p', '2'},
  13830. Fvalue: uint8(178),
  13831. },
  13832. 88: {
  13833. Fname: [7]uint8{'s', 'u', 'p', '3'},
  13834. Fvalue: uint8(179),
  13835. },
  13836. 89: {
  13837. Fname: [7]uint8{'s', 'z', 'l', 'i', 'g'},
  13838. Fvalue: uint8(223),
  13839. },
  13840. 90: {
  13841. Fname: [7]uint8{'t', 'h', 'o', 'r', 'n'},
  13842. Fvalue: uint8(254),
  13843. },
  13844. 91: {
  13845. Fname: [7]uint8{'t', 'i', 'm', 'e', 's'},
  13846. Fvalue: uint8(215),
  13847. },
  13848. 92: {
  13849. Fname: [7]uint8{'u', 'a', 'c', 'u', 't', 'e'},
  13850. Fvalue: uint8(250),
  13851. },
  13852. 93: {
  13853. Fname: [7]uint8{'u', 'c', 'i', 'r', 'c'},
  13854. Fvalue: uint8(251),
  13855. },
  13856. 94: {
  13857. Fname: [7]uint8{'u', 'g', 'r', 'a', 'v', 'e'},
  13858. Fvalue: uint8(249),
  13859. },
  13860. 95: {
  13861. Fname: [7]uint8{'u', 'm', 'l'},
  13862. Fvalue: uint8(168),
  13863. },
  13864. 96: {
  13865. Fname: [7]uint8{'u', 'u', 'm', 'l'},
  13866. Fvalue: uint8(252),
  13867. },
  13868. 97: {
  13869. Fname: [7]uint8{'y', 'a', 'c', 'u', 't', 'e'},
  13870. Fvalue: uint8(253),
  13871. },
  13872. 98: {
  13873. Fname: [7]uint8{'y', 'e', 'n'},
  13874. Fvalue: uint8(165),
  13875. },
  13876. 99: {
  13877. Fname: [7]uint8{'y', 'u', 'm', 'l'},
  13878. Fvalue: uint8(255),
  13879. },
  13880. }
  13881. // C documentation
  13882. //
  13883. // /*
  13884. // * unvis - decode characters previously encoded by vis
  13885. // */
  13886. func Xunvis(tls *libc.TLS, cp uintptr, c int32, astate uintptr, flag int32) (r int32) {
  13887. var ia, is, lc, st, uc uint8
  13888. var v22, v23, v24, v25, v26 int32
  13889. var p19, p20, p21, p28 uintptr
  13890. _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ia, is, lc, st, uc, v22, v23, v24, v25, v26, p19, p20, p21, p28
  13891. uc = libc.Uint8FromInt32(c)
  13892. /*
  13893. * Bottom 8 bits of astate hold the state machine state.
  13894. * Top 8 bits hold the current character in the http 1866 nv string decoding
  13895. */
  13896. st = libc.Uint8FromInt32(*(*int32)(unsafe.Pointer(astate)) & libc.Int32FromInt32(0xff))
  13897. if flag&int32(m__VIS_END) != 0 {
  13898. switch libc.Int32FromUint8(st) {
  13899. case int32(m_S_OCTAL2):
  13900. fallthrough
  13901. case int32(m_S_OCTAL3):
  13902. fallthrough
  13903. case int32(m_S_HEX2):
  13904. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13905. return int32(m_UNVIS_VALID)
  13906. case m_S_GROUND:
  13907. return int32(m_UNVIS_NOCHAR)
  13908. default:
  13909. return -int32(1)
  13910. }
  13911. }
  13912. switch libc.Int32FromUint8(st) {
  13913. case m_S_GROUND:
  13914. goto _1
  13915. case int32(m_S_START):
  13916. goto _2
  13917. case int32(m_S_META):
  13918. goto _3
  13919. case int32(m_S_META1):
  13920. goto _4
  13921. case int32(m_S_CTRL):
  13922. goto _5
  13923. case int32(m_S_OCTAL2):
  13924. goto _6
  13925. case int32(m_S_OCTAL3):
  13926. goto _7
  13927. case int32(m_S_HEX):
  13928. goto _8
  13929. case int32(m_S_HEX1):
  13930. goto _9
  13931. case int32(m_S_HEX2):
  13932. goto _10
  13933. case int32(m_S_MIME1):
  13934. goto _11
  13935. case int32(m_S_MIME2):
  13936. goto _12
  13937. case int32(m_S_EATCRNL):
  13938. goto _13
  13939. case int32(m_S_AMP):
  13940. goto _14
  13941. case int32(m_S_STRING):
  13942. goto _15
  13943. case int32(m_S_NUMBER):
  13944. goto _16
  13945. default:
  13946. goto _17
  13947. }
  13948. goto _18
  13949. _1:
  13950. ;
  13951. *(*uint8)(unsafe.Pointer(cp)) = uint8(0)
  13952. if flag&int32(m_VIS_NOESCAPE) == 0 && c == int32('\\') {
  13953. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_START)))
  13954. return int32(m_UNVIS_NOCHAR)
  13955. }
  13956. if flag&int32(m_VIS_HTTP1808) != 0 && c == int32('%') {
  13957. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_HEX1)))
  13958. return int32(m_UNVIS_NOCHAR)
  13959. }
  13960. if flag&int32(m_VIS_HTTP1866) != 0 && c == int32('&') {
  13961. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_AMP)))
  13962. return int32(m_UNVIS_NOCHAR)
  13963. }
  13964. if flag&int32(m_VIS_MIMESTYLE) != 0 && c == int32('=') {
  13965. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_MIME1)))
  13966. return int32(m_UNVIS_NOCHAR)
  13967. }
  13968. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(c)
  13969. return int32(m_UNVIS_VALID)
  13970. _2:
  13971. ;
  13972. switch c {
  13973. case int32('\\'):
  13974. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(c)
  13975. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13976. return int32(m_UNVIS_VALID)
  13977. case int32('0'):
  13978. fallthrough
  13979. case int32('1'):
  13980. fallthrough
  13981. case int32('2'):
  13982. fallthrough
  13983. case int32('3'):
  13984. fallthrough
  13985. case int32('4'):
  13986. fallthrough
  13987. case int32('5'):
  13988. fallthrough
  13989. case int32('6'):
  13990. fallthrough
  13991. case int32('7'):
  13992. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(c - libc.Int32FromUint8('0'))
  13993. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_OCTAL2)))
  13994. return int32(m_UNVIS_NOCHAR)
  13995. case int32('M'):
  13996. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(0200)
  13997. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_META)))
  13998. return int32(m_UNVIS_NOCHAR)
  13999. case int32('^'):
  14000. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_CTRL)))
  14001. return int32(m_UNVIS_NOCHAR)
  14002. case int32('n'):
  14003. *(*uint8)(unsafe.Pointer(cp)) = uint8('\n')
  14004. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14005. return int32(m_UNVIS_VALID)
  14006. case int32('r'):
  14007. *(*uint8)(unsafe.Pointer(cp)) = uint8('\r')
  14008. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14009. return int32(m_UNVIS_VALID)
  14010. case int32('b'):
  14011. *(*uint8)(unsafe.Pointer(cp)) = uint8('\b')
  14012. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14013. return int32(m_UNVIS_VALID)
  14014. case int32('a'):
  14015. *(*uint8)(unsafe.Pointer(cp)) = uint8('\007')
  14016. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14017. return int32(m_UNVIS_VALID)
  14018. case int32('v'):
  14019. *(*uint8)(unsafe.Pointer(cp)) = uint8('\v')
  14020. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14021. return int32(m_UNVIS_VALID)
  14022. case int32('t'):
  14023. *(*uint8)(unsafe.Pointer(cp)) = uint8('\t')
  14024. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14025. return int32(m_UNVIS_VALID)
  14026. case int32('f'):
  14027. *(*uint8)(unsafe.Pointer(cp)) = uint8('\f')
  14028. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14029. return int32(m_UNVIS_VALID)
  14030. case int32('s'):
  14031. *(*uint8)(unsafe.Pointer(cp)) = uint8(' ')
  14032. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14033. return int32(m_UNVIS_VALID)
  14034. case int32('E'):
  14035. *(*uint8)(unsafe.Pointer(cp)) = uint8('\033')
  14036. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14037. return int32(m_UNVIS_VALID)
  14038. case int32('x'):
  14039. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_HEX)))
  14040. return int32(m_UNVIS_NOCHAR)
  14041. case int32('\n'):
  14042. /*
  14043. * hidden newline
  14044. */
  14045. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14046. return int32(m_UNVIS_NOCHAR)
  14047. case int32('$'):
  14048. /*
  14049. * hidden marker
  14050. */
  14051. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14052. return int32(m_UNVIS_NOCHAR)
  14053. default:
  14054. if libc.BoolInt32(libc.Uint32FromInt32(c)-uint32(0x21) < uint32(0x5e)) != 0 {
  14055. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(c)
  14056. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14057. return int32(m_UNVIS_VALID)
  14058. }
  14059. }
  14060. goto bad
  14061. _3:
  14062. ;
  14063. if c == int32('-') {
  14064. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_META1)))
  14065. } else {
  14066. if c == int32('^') {
  14067. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_CTRL)))
  14068. } else {
  14069. goto bad
  14070. }
  14071. }
  14072. return int32(m_UNVIS_NOCHAR)
  14073. _4:
  14074. ;
  14075. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14076. p19 = cp
  14077. *(*uint8)(unsafe.Pointer(p19)) = uint8(int32(*(*uint8)(unsafe.Pointer(p19))) | c)
  14078. return int32(m_UNVIS_VALID)
  14079. _5:
  14080. ;
  14081. if c == int32('?') {
  14082. p20 = cp
  14083. *(*uint8)(unsafe.Pointer(p20)) = uint8(int32(*(*uint8)(unsafe.Pointer(p20))) | libc.Int32FromInt32(0177))
  14084. } else {
  14085. p21 = cp
  14086. *(*uint8)(unsafe.Pointer(p21)) = uint8(int32(*(*uint8)(unsafe.Pointer(p21))) | c&libc.Int32FromInt32(037))
  14087. }
  14088. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14089. return int32(m_UNVIS_VALID)
  14090. _6:
  14091. ; /* second possible octal digit */
  14092. if libc.Int32FromUint8(uc) >= int32('0') && libc.Int32FromUint8(uc) <= int32('7') {
  14093. /*
  14094. * yes - and maybe a third
  14095. */
  14096. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))<<int32(3) + (c - int32('0')))
  14097. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_OCTAL3)))
  14098. return int32(m_UNVIS_NOCHAR)
  14099. }
  14100. /*
  14101. * no - done with current sequence, push back passed char
  14102. */
  14103. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14104. return int32(m_UNVIS_VALIDPUSH)
  14105. _7:
  14106. ; /* third possible octal digit */
  14107. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14108. if libc.Int32FromUint8(uc) >= int32('0') && libc.Int32FromUint8(uc) <= int32('7') {
  14109. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))<<int32(3) + (c - int32('0')))
  14110. return int32(m_UNVIS_VALID)
  14111. }
  14112. /*
  14113. * we were done, push back passed char
  14114. */
  14115. return int32(m_UNVIS_VALIDPUSH)
  14116. _8:
  14117. ;
  14118. if !(libc.Xisxdigit(tls, libc.Int32FromUint8(uc)) != 0) {
  14119. goto bad
  14120. }
  14121. /*FALLTHROUGH*/
  14122. _9:
  14123. ;
  14124. if libc.Xisxdigit(tls, libc.Int32FromUint8(uc)) != 0 {
  14125. if libc.BoolInt32(uint32(uc)-uint32('0') < uint32(10)) != 0 {
  14126. v22 = libc.Int32FromUint8(uc) - int32('0')
  14127. } else {
  14128. v22 = libc.Xtolower(tls, libc.Int32FromUint8(uc)) - int32('a') + int32(10)
  14129. }
  14130. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(v22)
  14131. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_HEX2)))
  14132. return int32(m_UNVIS_NOCHAR)
  14133. }
  14134. /*
  14135. * no - done with current sequence, push back passed char
  14136. */
  14137. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14138. return int32(m_UNVIS_VALIDPUSH)
  14139. _10:
  14140. ;
  14141. *(*int32)(unsafe.Pointer(astate)) = m_S_GROUND
  14142. if libc.Xisxdigit(tls, libc.Int32FromUint8(uc)) != 0 {
  14143. if libc.BoolInt32(uint32(uc)-uint32('0') < uint32(10)) != 0 {
  14144. v23 = libc.Int32FromUint8(uc) - int32('0')
  14145. } else {
  14146. v23 = libc.Xtolower(tls, libc.Int32FromUint8(uc)) - int32('a') + int32(10)
  14147. }
  14148. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(v23 | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))<<int32(4))
  14149. return int32(m_UNVIS_VALID)
  14150. }
  14151. return int32(m_UNVIS_VALIDPUSH)
  14152. _11:
  14153. ;
  14154. if libc.Int32FromUint8(uc) == int32('\n') || libc.Int32FromUint8(uc) == int32('\r') {
  14155. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_EATCRNL)))
  14156. return int32(m_UNVIS_NOCHAR)
  14157. }
  14158. if libc.Xisxdigit(tls, libc.Int32FromUint8(uc)) != 0 && (libc.BoolInt32(uint32(uc)-uint32('0') < uint32(10)) != 0 || libc.BoolInt32(uint32(uc)-uint32('A') < uint32(26)) != 0) {
  14159. if libc.BoolInt32(uint32(uc)-uint32('0') < uint32(10)) != 0 {
  14160. v24 = libc.Int32FromUint8(uc) - int32('0')
  14161. } else {
  14162. v24 = libc.Int32FromUint8(uc) - int32('A') + int32(10)
  14163. }
  14164. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(v24)
  14165. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_MIME2)))
  14166. return int32(m_UNVIS_NOCHAR)
  14167. }
  14168. goto bad
  14169. _12:
  14170. ;
  14171. if libc.Xisxdigit(tls, libc.Int32FromUint8(uc)) != 0 && (libc.BoolInt32(uint32(uc)-uint32('0') < uint32(10)) != 0 || libc.BoolInt32(uint32(uc)-uint32('A') < uint32(26)) != 0) {
  14172. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14173. if libc.BoolInt32(uint32(uc)-uint32('0') < uint32(10)) != 0 {
  14174. v25 = libc.Int32FromUint8(uc) - int32('0')
  14175. } else {
  14176. v25 = libc.Int32FromUint8(uc) - int32('A') + int32(10)
  14177. }
  14178. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(v25 | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))<<int32(4))
  14179. return int32(m_UNVIS_VALID)
  14180. }
  14181. goto bad
  14182. _13:
  14183. ;
  14184. switch libc.Int32FromUint8(uc) {
  14185. case int32('\r'):
  14186. fallthrough
  14187. case int32('\n'):
  14188. return int32(m_UNVIS_NOCHAR)
  14189. case int32('='):
  14190. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_MIME1)))
  14191. return int32(m_UNVIS_NOCHAR)
  14192. default:
  14193. *(*uint8)(unsafe.Pointer(cp)) = uc
  14194. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14195. return int32(m_UNVIS_VALID)
  14196. }
  14197. _14:
  14198. ;
  14199. *(*uint8)(unsafe.Pointer(cp)) = uint8(0)
  14200. if libc.Int32FromUint8(uc) == int32('#') {
  14201. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_NUMBER)))
  14202. return int32(m_UNVIS_NOCHAR)
  14203. }
  14204. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_STRING)))
  14205. /*FALLTHROUGH*/
  14206. _15:
  14207. ;
  14208. ia = *(*uint8)(unsafe.Pointer(cp)) /* index in the array */
  14209. is = uint8(libc.Uint32FromInt32(*(*int32)(unsafe.Pointer(astate))) >> libc.Int32FromInt32(24)) /* index in the string */
  14210. if libc.Int32FromUint8(is) == 0 {
  14211. v26 = 0
  14212. } else {
  14213. v26 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_nv)) + uintptr(ia)*8 + uintptr(libc.Int32FromUint8(is)-int32(1)))))
  14214. }
  14215. lc = libc.Uint8FromInt32(v26) /* last character */
  14216. if libc.Int32FromUint8(uc) == int32(';') {
  14217. uc = uint8('\000')
  14218. }
  14219. for {
  14220. if !(uint32(ia) < libc.Uint32FromInt64(800)/libc.Uint32FromInt64(8)) {
  14221. break
  14222. }
  14223. if libc.Int32FromUint8(is) != 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_nv)) + uintptr(ia)*8 + uintptr(libc.Int32FromUint8(is)-int32(1))))) != libc.Int32FromUint8(lc) {
  14224. goto bad
  14225. }
  14226. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_nv)) + uintptr(ia)*8 + uintptr(is)))) == libc.Int32FromUint8(uc) {
  14227. break
  14228. }
  14229. goto _27
  14230. _27:
  14231. ;
  14232. ia++
  14233. }
  14234. if uint32(ia) == libc.Uint32FromInt64(800)/libc.Uint32FromInt64(8) {
  14235. goto bad
  14236. }
  14237. if libc.Int32FromUint8(uc) != 0 {
  14238. *(*uint8)(unsafe.Pointer(cp)) = ia
  14239. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromUint8(is)+libc.Int32FromInt32(1))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_STRING)))
  14240. return int32(m_UNVIS_NOCHAR)
  14241. }
  14242. *(*uint8)(unsafe.Pointer(cp)) = _nv[ia].Fvalue
  14243. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14244. return int32(m_UNVIS_VALID)
  14245. _16:
  14246. ;
  14247. if libc.Int32FromUint8(uc) == int32(';') {
  14248. return int32(m_UNVIS_VALID)
  14249. }
  14250. if !(libc.BoolInt32(uint32(uc)-libc.Uint32FromUint8('0') < libc.Uint32FromInt32(10)) != 0) {
  14251. goto bad
  14252. }
  14253. p28 = cp
  14254. *(*uint8)(unsafe.Pointer(p28)) = uint8(int32(*(*uint8)(unsafe.Pointer(p28))) + (libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))*libc.Int32FromInt32(10) + libc.Int32FromUint8(uc) - libc.Int32FromUint8('0')))
  14255. return int32(m_UNVIS_NOCHAR)
  14256. _17:
  14257. ;
  14258. goto bad
  14259. bad:
  14260. ;
  14261. /*
  14262. * decoder in unknown state - (probably uninitialized)
  14263. */
  14264. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14265. return -int32(1)
  14266. _18:
  14267. ;
  14268. return r
  14269. }
  14270. /*
  14271. * strnunvisx - decode src into dst
  14272. *
  14273. * Number of chars decoded into dst is returned, -1 on error.
  14274. * Dst is null terminated.
  14275. */
  14276. func Xstrnunvisx(tls *libc.TLS, dst uintptr, dlen Tsize_t, src uintptr, flag int32) (r int32) {
  14277. bp := tls.Alloc(16)
  14278. defer tls.Free(16)
  14279. var c, v1 uint8
  14280. var start, v14, v16, v18, v2 uintptr
  14281. var v13, v15, v17, v19 Tsize_t
  14282. var _ /* state at bp+4 */ int32
  14283. var _ /* t at bp+0 */ uint8
  14284. _, _, _, _, _, _, _, _, _, _, _ = c, start, v1, v13, v14, v15, v16, v17, v18, v19, v2
  14285. *(*uint8)(unsafe.Pointer(bp)) = uint8('\000')
  14286. start = dst
  14287. *(*int32)(unsafe.Pointer(bp + 4)) = 0
  14288. for {
  14289. v2 = src
  14290. src++
  14291. v1 = *(*uint8)(unsafe.Pointer(v2))
  14292. c = v1
  14293. if !(libc.Int32FromUint8(v1) != int32('\000')) {
  14294. break
  14295. }
  14296. goto again
  14297. again:
  14298. ;
  14299. switch Xunvis(tls, bp, libc.Int32FromUint8(c), bp+4, flag) {
  14300. case int32(m_UNVIS_VALID):
  14301. goto _3
  14302. case int32(m_UNVIS_VALIDPUSH):
  14303. goto _4
  14304. case int32(m_UNVIS_NOCHAR):
  14305. goto _5
  14306. case 0:
  14307. goto _6
  14308. case -int32(1):
  14309. goto _7
  14310. default:
  14311. goto _8
  14312. }
  14313. goto _9
  14314. _3:
  14315. ;
  14316. _12:
  14317. ;
  14318. v13 = dlen
  14319. dlen--
  14320. if v13 == uint32(0) {
  14321. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14322. return -int32(1)
  14323. }
  14324. goto _11
  14325. _11:
  14326. ;
  14327. if 0 != 0 {
  14328. goto _12
  14329. }
  14330. goto _10
  14331. _10:
  14332. ;
  14333. v14 = dst
  14334. dst++
  14335. *(*uint8)(unsafe.Pointer(v14)) = *(*uint8)(unsafe.Pointer(bp))
  14336. goto _9
  14337. _4:
  14338. ;
  14339. v15 = dlen
  14340. dlen--
  14341. if v15 == uint32(0) {
  14342. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14343. return -int32(1)
  14344. }
  14345. v16 = dst
  14346. dst++
  14347. *(*uint8)(unsafe.Pointer(v16)) = *(*uint8)(unsafe.Pointer(bp))
  14348. goto again
  14349. _6:
  14350. ;
  14351. _5:
  14352. ;
  14353. goto _9
  14354. _7:
  14355. ;
  14356. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  14357. return -int32(1)
  14358. _8:
  14359. ;
  14360. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  14361. return -int32(1)
  14362. _9:
  14363. }
  14364. if Xunvis(tls, bp, libc.Int32FromUint8(c), bp+4, int32(m__VIS_END)) == int32(m_UNVIS_VALID) {
  14365. v17 = dlen
  14366. dlen--
  14367. if v17 == uint32(0) {
  14368. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14369. return -int32(1)
  14370. }
  14371. v18 = dst
  14372. dst++
  14373. *(*uint8)(unsafe.Pointer(v18)) = *(*uint8)(unsafe.Pointer(bp))
  14374. }
  14375. v19 = dlen
  14376. dlen--
  14377. if v19 == uint32(0) {
  14378. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14379. return -int32(1)
  14380. }
  14381. *(*uint8)(unsafe.Pointer(dst)) = uint8('\000')
  14382. return int32(dst) - int32(start)
  14383. }
  14384. func Xstrunvisx(tls *libc.TLS, dst uintptr, src uintptr, flag int32) (r int32) {
  14385. return Xstrnunvisx(tls, dst, libc.Uint32FromInt32(^libc.Int32FromInt32(0)), src, flag)
  14386. }
  14387. func Xstrunvis(tls *libc.TLS, dst uintptr, src uintptr) (r int32) {
  14388. return Xstrnunvisx(tls, dst, libc.Uint32FromInt32(^libc.Int32FromInt32(0)), src, 0)
  14389. }
  14390. func Xstrnunvis_openbsd(tls *libc.TLS, dst uintptr, src uintptr, dlen Tsize_t) (r Tssize_t) {
  14391. return Xstrnunvisx(tls, dst, dlen, src, 0)
  14392. }
  14393. func Xstrnunvis_netbsd(tls *libc.TLS, dst uintptr, dlen Tsize_t, src uintptr) (r int32) {
  14394. return Xstrnunvisx(tls, dst, dlen, src, 0)
  14395. }
  14396. const m_MAXEXTRAS = 30
  14397. const m_VIS_CSTYLE1 = 2
  14398. const m_VIS_DQ1 = 32768
  14399. const m_VIS_GLOB1 = 4096
  14400. const m_VIS_HTTP18081 = 0x0080
  14401. const m_VIS_HTTP18661 = 0x0200
  14402. const m_VIS_HTTPSTYLE1 = 128
  14403. const m_VIS_NL1 = 16
  14404. const m_VIS_NOESCAPE1 = 0x0400
  14405. const m_VIS_NOLOCALE1 = 16384
  14406. const m_VIS_NOSLASH1 = 64
  14407. const m_VIS_OCTAL1 = 1
  14408. const m_VIS_SAFE1 = 32
  14409. const m_VIS_SHELL1 = 8192
  14410. const m_VIS_SP1 = 4
  14411. const m_VIS_TAB1 = 8
  14412. const m__VIS_END1 = 0x0800
  14413. type Twctrans_t = uintptr
  14414. /* Keep it simple for now, no locale stuff */
  14415. var _char_shell = [19]Twchar_t{'\'', '`', '"', ';', '&', '<', '>', '(', ')', '|', '{', '}', ']', '\\', '$', '!', '^', '~'}
  14416. var _char_glob = [5]Twchar_t{'*', '?', '[', '#'}
  14417. /*
  14418. * On NetBSD and glibc MB_LEN_MAX is currently > 8 which does not fit on any
  14419. * integer integral type and it is probably wrong, since currently the maximum
  14420. * number of bytes and character needs is 6. Until this is fixed, the
  14421. * loops below are using sizeof(uint64_t) - 1 instead of MB_LEN_MAX, and
  14422. * the assertion is commented out.
  14423. */
  14424. // C documentation
  14425. //
  14426. // /*
  14427. // * This is do_hvis, for HTTP style (RFC 1808)
  14428. // */
  14429. func _do_hvis(tls *libc.TLS, dst uintptr, c Twint_t, flags int32, nextc Twint_t, extra uintptr) (r uintptr) {
  14430. var v1, v2, v3 uintptr
  14431. _, _, _ = v1, v2, v3
  14432. if libc.Xiswalnum(tls, c) != 0 || c == uint32('$') || c == uint32('-') || c == uint32('_') || c == uint32('.') || c == uint32('+') || c == uint32('!') || c == uint32('*') || c == uint32('\'') || c == uint32('(') || c == uint32(')') || c == uint32(',') {
  14433. dst = _do_svis(tls, dst, c, flags, nextc, extra)
  14434. } else {
  14435. v1 = dst
  14436. dst += 4
  14437. *(*Twchar_t)(unsafe.Pointer(v1)) = uint32('%')
  14438. v2 = dst
  14439. dst += 4
  14440. *(*Twchar_t)(unsafe.Pointer(v2)) = *(*t__predefined_wchar_t)(unsafe.Pointer(__ccgo_ts + 463 + uintptr(c>>int32(4)&uint32(0xf))*4))
  14441. v3 = dst
  14442. dst += 4
  14443. *(*Twchar_t)(unsafe.Pointer(v3)) = *(*t__predefined_wchar_t)(unsafe.Pointer(__ccgo_ts + 463 + uintptr(c&uint32(0xf))*4))
  14444. }
  14445. return dst
  14446. }
  14447. // C documentation
  14448. //
  14449. // /*
  14450. // * This is do_mvis, for Quoted-Printable MIME (RFC 2045)
  14451. // * NB: No handling of long lines or CRLF.
  14452. // */
  14453. func _do_mvis(tls *libc.TLS, dst uintptr, c Twint_t, flags int32, nextc Twint_t, extra uintptr) (r uintptr) {
  14454. var v1, v2, v3 uintptr
  14455. _, _, _ = v1, v2, v3
  14456. if c != uint32('\n') && (libc.Xiswspace(tls, c) != 0 && (nextc == uint32('\r') || nextc == uint32('\n')) || !(libc.Xiswspace(tls, c) != 0) && (c < uint32(33) || c > uint32(60) && c < uint32(62) || c > uint32(126)) || libc.Xwcschr(tls, __ccgo_ts+531, c) != libc.UintptrFromInt32(0)) {
  14457. v1 = dst
  14458. dst += 4
  14459. *(*Twchar_t)(unsafe.Pointer(v1)) = uint32('=')
  14460. v2 = dst
  14461. dst += 4
  14462. *(*Twchar_t)(unsafe.Pointer(v2)) = *(*t__predefined_wchar_t)(unsafe.Pointer(__ccgo_ts + 583 + uintptr(c>>int32(4)&uint32(0xf))*4))
  14463. v3 = dst
  14464. dst += 4
  14465. *(*Twchar_t)(unsafe.Pointer(v3)) = *(*t__predefined_wchar_t)(unsafe.Pointer(__ccgo_ts + 583 + uintptr(c&uint32(0xf))*4))
  14466. } else {
  14467. dst = _do_svis(tls, dst, c, flags, nextc, extra)
  14468. }
  14469. return dst
  14470. }
  14471. // C documentation
  14472. //
  14473. // /*
  14474. // * Output single byte of multibyte character.
  14475. // */
  14476. func _do_mbyte(tls *libc.TLS, dst uintptr, c Twint_t, flags int32, nextc Twint_t, iswextra int32) (r uintptr) {
  14477. var v1, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v22, v23, v24, v25, v26, v27, v28, v29, v3, v30, v31, v32, v33, v34, v4, v5, v6, v7, v8, v9 uintptr
  14478. var v21 int32
  14479. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = v1, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v3, v30, v31, v32, v33, v34, v4, v5, v6, v7, v8, v9
  14480. if flags&int32(m_VIS_CSTYLE1) != 0 {
  14481. switch c {
  14482. case uint32('\n'):
  14483. v1 = dst
  14484. dst += 4
  14485. *(*Twchar_t)(unsafe.Pointer(v1)) = uint32('\\')
  14486. v2 = dst
  14487. dst += 4
  14488. *(*Twchar_t)(unsafe.Pointer(v2)) = uint32('n')
  14489. return dst
  14490. case uint32('\r'):
  14491. v3 = dst
  14492. dst += 4
  14493. *(*Twchar_t)(unsafe.Pointer(v3)) = uint32('\\')
  14494. v4 = dst
  14495. dst += 4
  14496. *(*Twchar_t)(unsafe.Pointer(v4)) = uint32('r')
  14497. return dst
  14498. case uint32('\b'):
  14499. v5 = dst
  14500. dst += 4
  14501. *(*Twchar_t)(unsafe.Pointer(v5)) = uint32('\\')
  14502. v6 = dst
  14503. dst += 4
  14504. *(*Twchar_t)(unsafe.Pointer(v6)) = uint32('b')
  14505. return dst
  14506. case uint32('\a'):
  14507. v7 = dst
  14508. dst += 4
  14509. *(*Twchar_t)(unsafe.Pointer(v7)) = uint32('\\')
  14510. v8 = dst
  14511. dst += 4
  14512. *(*Twchar_t)(unsafe.Pointer(v8)) = uint32('a')
  14513. return dst
  14514. case uint32('\v'):
  14515. v9 = dst
  14516. dst += 4
  14517. *(*Twchar_t)(unsafe.Pointer(v9)) = uint32('\\')
  14518. v10 = dst
  14519. dst += 4
  14520. *(*Twchar_t)(unsafe.Pointer(v10)) = uint32('v')
  14521. return dst
  14522. case uint32('\t'):
  14523. v11 = dst
  14524. dst += 4
  14525. *(*Twchar_t)(unsafe.Pointer(v11)) = uint32('\\')
  14526. v12 = dst
  14527. dst += 4
  14528. *(*Twchar_t)(unsafe.Pointer(v12)) = uint32('t')
  14529. return dst
  14530. case uint32('\f'):
  14531. v13 = dst
  14532. dst += 4
  14533. *(*Twchar_t)(unsafe.Pointer(v13)) = uint32('\\')
  14534. v14 = dst
  14535. dst += 4
  14536. *(*Twchar_t)(unsafe.Pointer(v14)) = uint32('f')
  14537. return dst
  14538. case uint32(' '):
  14539. v15 = dst
  14540. dst += 4
  14541. *(*Twchar_t)(unsafe.Pointer(v15)) = uint32('\\')
  14542. v16 = dst
  14543. dst += 4
  14544. *(*Twchar_t)(unsafe.Pointer(v16)) = uint32('s')
  14545. return dst
  14546. case uint32('\000'):
  14547. v17 = dst
  14548. dst += 4
  14549. *(*Twchar_t)(unsafe.Pointer(v17)) = uint32('\\')
  14550. v18 = dst
  14551. dst += 4
  14552. *(*Twchar_t)(unsafe.Pointer(v18)) = uint32('0')
  14553. if uint32(uint8(nextc)) >= uint32('0') && uint32(uint8(nextc)) <= uint32('7') {
  14554. v19 = dst
  14555. dst += 4
  14556. *(*Twchar_t)(unsafe.Pointer(v19)) = uint32('0')
  14557. v20 = dst
  14558. dst += 4
  14559. *(*Twchar_t)(unsafe.Pointer(v20)) = uint32('0')
  14560. }
  14561. return dst
  14562. /* We cannot encode these characters in VIS_CSTYLE
  14563. * because they special meaning */
  14564. fallthrough
  14565. case uint32('n'):
  14566. fallthrough
  14567. case uint32('r'):
  14568. fallthrough
  14569. case uint32('b'):
  14570. fallthrough
  14571. case uint32('a'):
  14572. fallthrough
  14573. case uint32('v'):
  14574. fallthrough
  14575. case uint32('t'):
  14576. fallthrough
  14577. case uint32('f'):
  14578. fallthrough
  14579. case uint32('s'):
  14580. fallthrough
  14581. case uint32('0'):
  14582. fallthrough
  14583. case uint32('M'):
  14584. fallthrough
  14585. case uint32('^'):
  14586. fallthrough
  14587. case uint32('$'): /* vis(1) -l */
  14588. default:
  14589. if flags&int32(m_VIS_NOLOCALE1) != 0 {
  14590. v21 = libc.BoolInt32(c-uint32(0x21) < uint32(0x5e))
  14591. } else {
  14592. v21 = libc.Xiswgraph(tls, c)
  14593. }
  14594. if v21 != 0 && !(uint32(uint8(c)) >= uint32('0') && uint32(uint8(c)) <= uint32('7')) {
  14595. v22 = dst
  14596. dst += 4
  14597. *(*Twchar_t)(unsafe.Pointer(v22)) = uint32('\\')
  14598. v23 = dst
  14599. dst += 4
  14600. *(*Twchar_t)(unsafe.Pointer(v23)) = c
  14601. return dst
  14602. }
  14603. }
  14604. }
  14605. if iswextra != 0 || c&uint32(0177) == uint32(' ') || flags&int32(m_VIS_OCTAL1) != 0 {
  14606. v24 = dst
  14607. dst += 4
  14608. *(*Twchar_t)(unsafe.Pointer(v24)) = uint32('\\')
  14609. v25 = dst
  14610. dst += 4
  14611. *(*Twchar_t)(unsafe.Pointer(v25)) = uint32(uint8(uint32(uint8(c))>>libc.Int32FromInt32(6)&libc.Uint32FromInt32(03))) + uint32('0')
  14612. v26 = dst
  14613. dst += 4
  14614. *(*Twchar_t)(unsafe.Pointer(v26)) = uint32(uint8(uint32(uint8(c))>>libc.Int32FromInt32(3)&libc.Uint32FromInt32(07))) + uint32('0')
  14615. v27 = dst
  14616. dst += 4
  14617. *(*Twchar_t)(unsafe.Pointer(v27)) = c&uint32(07) + uint32('0')
  14618. } else {
  14619. if flags&int32(m_VIS_NOSLASH1) == 0 {
  14620. v28 = dst
  14621. dst += 4
  14622. *(*Twchar_t)(unsafe.Pointer(v28)) = uint32('\\')
  14623. }
  14624. if c&uint32(0200) != 0 {
  14625. c &= uint32(0177)
  14626. v29 = dst
  14627. dst += 4
  14628. *(*Twchar_t)(unsafe.Pointer(v29)) = uint32('M')
  14629. }
  14630. if libc.Xiswcntrl(tls, c) != 0 {
  14631. v30 = dst
  14632. dst += 4
  14633. *(*Twchar_t)(unsafe.Pointer(v30)) = uint32('^')
  14634. if c == uint32(0177) {
  14635. v31 = dst
  14636. dst += 4
  14637. *(*Twchar_t)(unsafe.Pointer(v31)) = uint32('?')
  14638. } else {
  14639. v32 = dst
  14640. dst += 4
  14641. *(*Twchar_t)(unsafe.Pointer(v32)) = c + uint32('@')
  14642. }
  14643. } else {
  14644. v33 = dst
  14645. dst += 4
  14646. *(*Twchar_t)(unsafe.Pointer(v33)) = uint32('-')
  14647. v34 = dst
  14648. dst += 4
  14649. *(*Twchar_t)(unsafe.Pointer(v34)) = c
  14650. }
  14651. }
  14652. return dst
  14653. }
  14654. // C documentation
  14655. //
  14656. // /*
  14657. // * This is do_vis, the central code of vis.
  14658. // * dst: Pointer to the destination buffer
  14659. // * c: Character to encode
  14660. // * flags: Flags word
  14661. // * nextc: The character following 'c'
  14662. // * extra: Pointer to the list of extra characters to be
  14663. // * backslash-protected.
  14664. // */
  14665. func _do_svis(tls *libc.TLS, dst uintptr, c Twint_t, flags int32, nextc Twint_t, extra uintptr) (r uintptr) {
  14666. var bmsk, wmsk Tuint64_t
  14667. var i, iswextra, shft, v1 int32
  14668. var v2 bool
  14669. var v3 uintptr
  14670. _, _, _, _, _, _, _, _ = bmsk, i, iswextra, shft, wmsk, v1, v2, v3
  14671. iswextra = libc.BoolInt32(libc.Xwcschr(tls, extra, c) != libc.UintptrFromInt32(0))
  14672. if v2 = !(iswextra != 0); v2 {
  14673. if flags&int32(m_VIS_NOLOCALE1) != 0 {
  14674. v1 = libc.BoolInt32(c-uint32(0x21) < uint32(0x5e))
  14675. } else {
  14676. v1 = libc.Xiswgraph(tls, c)
  14677. }
  14678. }
  14679. if v2 && (v1 != 0 || (c == uint32(' ') || c == uint32('\t') || c == uint32('\n')) || flags&int32(m_VIS_SAFE1) != 0 && (c == uint32('\b') || c == uint32('\a') || c == uint32('\r'))) {
  14680. v3 = dst
  14681. dst += 4
  14682. *(*Twchar_t)(unsafe.Pointer(v3)) = c
  14683. return dst
  14684. }
  14685. /* See comment in istrsenvisx() output loop, below. */
  14686. wmsk = uint64(0)
  14687. i = libc.Int32FromUint32(libc.Uint32FromInt64(8) - libc.Uint32FromInt32(1))
  14688. for {
  14689. if !(i >= 0) {
  14690. break
  14691. }
  14692. shft = i * int32(m_CHAR_BIT)
  14693. bmsk = libc.Uint64FromInt64(0xff) << shft
  14694. wmsk |= bmsk
  14695. if uint64(c)&wmsk != 0 || i == 0 {
  14696. dst = _do_mbyte(tls, dst, uint32(uint64(c)&bmsk>>shft), flags, nextc, iswextra)
  14697. }
  14698. goto _4
  14699. _4:
  14700. ;
  14701. i--
  14702. }
  14703. return dst
  14704. }
  14705. type Tvisfun_t = uintptr
  14706. // C documentation
  14707. //
  14708. // /*
  14709. // * Return the appropriate encoding function depending on the flags given.
  14710. // */
  14711. func _getvisfun(tls *libc.TLS, flags int32) (r Tvisfun_t) {
  14712. if flags&int32(m_VIS_HTTPSTYLE1) != 0 {
  14713. return __ccgo_fp(_do_hvis)
  14714. }
  14715. if flags&int32(m_VIS_MIMESTYLE) != 0 {
  14716. return __ccgo_fp(_do_mvis)
  14717. }
  14718. return __ccgo_fp(_do_svis)
  14719. }
  14720. // C documentation
  14721. //
  14722. // /*
  14723. // * Expand list of extra characters to not visually encode.
  14724. // */
  14725. func _makeextralist(tls *libc.TLS, flags int32, src uintptr) (r uintptr) {
  14726. var d, dst, s, v1, v10, v11, v12, v13, v4, v5, v7, v8, v9 uintptr
  14727. var i, len1 Tsize_t
  14728. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = d, dst, i, len1, s, v1, v10, v11, v12, v13, v4, v5, v7, v8, v9
  14729. len1 = libc.Xstrlen(tls, src)
  14730. v1 = libc.Xcalloc(tls, len1+uint32(m_MAXEXTRAS), uint32(4))
  14731. dst = v1
  14732. if v1 == libc.UintptrFromInt32(0) {
  14733. return libc.UintptrFromInt32(0)
  14734. }
  14735. if flags&int32(m_VIS_NOLOCALE1) != 0 || libc.Xmbstowcs(tls, dst, src, len1) == libc.Uint32FromInt32(-libc.Int32FromInt32(1)) {
  14736. i = uint32(0)
  14737. for {
  14738. if !(i < len1) {
  14739. break
  14740. }
  14741. *(*Twchar_t)(unsafe.Pointer(dst + uintptr(i)*4)) = uint32(*(*uint8)(unsafe.Pointer(src + uintptr(i))))
  14742. goto _2
  14743. _2:
  14744. ;
  14745. i++
  14746. }
  14747. d = dst + uintptr(len1)*4
  14748. } else {
  14749. d = dst + uintptr(libc.Xwcslen(tls, dst))*4
  14750. }
  14751. if flags&int32(m_VIS_GLOB1) != 0 {
  14752. s = uintptr(unsafe.Pointer(&_char_glob))
  14753. for {
  14754. if !(*(*Twchar_t)(unsafe.Pointer(s)) != 0) {
  14755. break
  14756. }
  14757. goto _3
  14758. goto _3
  14759. _3:
  14760. ;
  14761. v4 = d
  14762. d += 4
  14763. v5 = s
  14764. s += 4
  14765. *(*Twchar_t)(unsafe.Pointer(v4)) = *(*Twchar_t)(unsafe.Pointer(v5))
  14766. }
  14767. }
  14768. if flags&int32(m_VIS_SHELL1) != 0 {
  14769. s = uintptr(unsafe.Pointer(&_char_shell))
  14770. for {
  14771. if !(*(*Twchar_t)(unsafe.Pointer(s)) != 0) {
  14772. break
  14773. }
  14774. goto _6
  14775. goto _6
  14776. _6:
  14777. ;
  14778. v7 = d
  14779. d += 4
  14780. v8 = s
  14781. s += 4
  14782. *(*Twchar_t)(unsafe.Pointer(v7)) = *(*Twchar_t)(unsafe.Pointer(v8))
  14783. }
  14784. }
  14785. if flags&int32(m_VIS_SP1) != 0 {
  14786. v9 = d
  14787. d += 4
  14788. *(*Twchar_t)(unsafe.Pointer(v9)) = uint32(' ')
  14789. }
  14790. if flags&int32(m_VIS_TAB1) != 0 {
  14791. v10 = d
  14792. d += 4
  14793. *(*Twchar_t)(unsafe.Pointer(v10)) = uint32('\t')
  14794. }
  14795. if flags&int32(m_VIS_NL1) != 0 {
  14796. v11 = d
  14797. d += 4
  14798. *(*Twchar_t)(unsafe.Pointer(v11)) = uint32('\n')
  14799. }
  14800. if flags&int32(m_VIS_DQ1) != 0 {
  14801. v12 = d
  14802. d += 4
  14803. *(*Twchar_t)(unsafe.Pointer(v12)) = uint32('"')
  14804. }
  14805. if flags&int32(m_VIS_NOSLASH1) == 0 {
  14806. v13 = d
  14807. d += 4
  14808. *(*Twchar_t)(unsafe.Pointer(v13)) = uint32('\\')
  14809. }
  14810. *(*Twchar_t)(unsafe.Pointer(d)) = uint32('\000')
  14811. return dst
  14812. }
  14813. // C documentation
  14814. //
  14815. // /*
  14816. // * istrsenvisx()
  14817. // * The main internal function.
  14818. // * All user-visible functions call this one.
  14819. // */
  14820. func _istrsenvisx(tls *libc.TLS, mbdstp uintptr, dlen uintptr, mbsrc uintptr, mblength Tsize_t, flags int32, mbextra uintptr, cerr_ptr uintptr) (r int32) {
  14821. var bmsk, wmsk Tuint64_t
  14822. var c Twint_t
  14823. var cerr, clen, error1, i, shft, v12, v6 int32
  14824. var dst, extra, mbdst, mdst, pdst, psrc, src, start, v1, v2, v3, v4, v5, v8 uintptr
  14825. var f Tvisfun_t
  14826. var len1, olen Tsize_t
  14827. var maxolen, mbslength Tssize_t
  14828. var v9 uint32
  14829. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bmsk, c, cerr, clen, dst, error1, extra, f, i, len1, maxolen, mbdst, mbslength, mdst, olen, pdst, psrc, shft, src, start, wmsk, v1, v12, v2, v3, v4, v5, v6, v8, v9
  14830. clen = 0
  14831. error1 = -int32(1)
  14832. mbslength = libc.Int32FromUint32(mblength)
  14833. /*
  14834. * When inputing a single character, must also read in the
  14835. * next character for nextc, the look-ahead character.
  14836. */
  14837. if mbslength == int32(1) {
  14838. mbslength++
  14839. }
  14840. /*
  14841. * Input (mbsrc) is a char string considered to be multibyte
  14842. * characters. The input loop will read this string pulling
  14843. * one character, possibly multiple bytes, from mbsrc and
  14844. * converting each to wchar_t in src.
  14845. *
  14846. * The vis conversion will be done using the wide char
  14847. * wchar_t string.
  14848. *
  14849. * This will then be converted back to a multibyte string to
  14850. * return to the caller.
  14851. */
  14852. /* Allocate space for the wide char strings */
  14853. v2 = libc.UintptrFromInt32(0)
  14854. extra = v2
  14855. v1 = v2
  14856. pdst = v1
  14857. psrc = v1
  14858. mdst = libc.UintptrFromInt32(0)
  14859. v3 = libc.Xcalloc(tls, libc.Uint32FromInt32(mbslength+int32(1)), uint32(4))
  14860. psrc = v3
  14861. if v3 == libc.UintptrFromInt32(0) {
  14862. return -int32(1)
  14863. }
  14864. v4 = libc.Xcalloc(tls, libc.Uint32FromInt32(int32(16)*mbslength+int32(1)), uint32(4))
  14865. pdst = v4
  14866. if v4 == libc.UintptrFromInt32(0) {
  14867. goto out
  14868. }
  14869. if *(*uintptr)(unsafe.Pointer(mbdstp)) == libc.UintptrFromInt32(0) {
  14870. v5 = libc.Xcalloc(tls, libc.Uint32FromInt32(int32(16)*mbslength+int32(1)), uint32(1))
  14871. mdst = v5
  14872. if v5 == libc.UintptrFromInt32(0) {
  14873. goto out
  14874. }
  14875. *(*uintptr)(unsafe.Pointer(mbdstp)) = mdst
  14876. }
  14877. mbdst = *(*uintptr)(unsafe.Pointer(mbdstp))
  14878. dst = pdst
  14879. src = psrc
  14880. if flags&int32(m_VIS_NOLOCALE1) != 0 {
  14881. /* Do one byte at a time conversion */
  14882. cerr = int32(1)
  14883. } else {
  14884. /* Use caller's multibyte conversion error flag. */
  14885. if cerr_ptr != 0 {
  14886. v6 = *(*int32)(unsafe.Pointer(cerr_ptr))
  14887. } else {
  14888. v6 = 0
  14889. }
  14890. cerr = v6
  14891. }
  14892. /*
  14893. * Input loop.
  14894. * Handle up to mblength characters (not bytes). We do not
  14895. * stop at NULs because we may be processing a block of data
  14896. * that includes NULs.
  14897. */
  14898. for mbslength > 0 {
  14899. /* Convert one multibyte character to wchar_t. */
  14900. if !(cerr != 0) {
  14901. clen = libc.Xmbtowc(tls, src, mbsrc, uint32(m_MB_LEN_MAX))
  14902. }
  14903. if cerr != 0 || clen < 0 {
  14904. /* Conversion error, process as a byte instead. */
  14905. *(*Twchar_t)(unsafe.Pointer(src)) = uint32(*(*uint8)(unsafe.Pointer(mbsrc)))
  14906. clen = int32(1)
  14907. cerr = int32(1)
  14908. }
  14909. if clen == 0 {
  14910. /*
  14911. * NUL in input gives 0 return value. process
  14912. * as single NUL byte and keep going.
  14913. */
  14914. clen = int32(1)
  14915. }
  14916. /* Advance buffer character pointer. */
  14917. src += 4
  14918. /* Advance input pointer by number of bytes read. */
  14919. mbsrc += uintptr(clen)
  14920. /* Decrement input byte count. */
  14921. mbslength -= clen
  14922. }
  14923. len1 = libc.Uint32FromInt32((int32(src) - int32(psrc)) / 4)
  14924. src = psrc
  14925. /*
  14926. * In the single character input case, we will have actually
  14927. * processed two characters, c and nextc. Reset len back to
  14928. * just a single character.
  14929. */
  14930. if mblength < len1 {
  14931. len1 = mblength
  14932. }
  14933. /* Convert extra argument to list of characters for this mode. */
  14934. extra = _makeextralist(tls, flags, mbextra)
  14935. if !(extra != 0) {
  14936. if dlen != 0 && *(*Tsize_t)(unsafe.Pointer(dlen)) == uint32(0) {
  14937. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14938. goto out
  14939. }
  14940. *(*uint8)(unsafe.Pointer(mbdst)) = uint8('\000') /* can't create extra, return "" */
  14941. error1 = 0
  14942. goto out
  14943. }
  14944. /* Look up which processing function to call. */
  14945. f = _getvisfun(tls, flags)
  14946. /*
  14947. * Main processing loop.
  14948. * Call do_Xvis processing function one character at a time
  14949. * with next character available for look-ahead.
  14950. */
  14951. start = dst
  14952. for {
  14953. if !(len1 > uint32(0)) {
  14954. break
  14955. }
  14956. v8 = src
  14957. src += 4
  14958. c = *(*Twchar_t)(unsafe.Pointer(v8))
  14959. dst = (*(*func(*libc.TLS, uintptr, Twint_t, int32, Twint_t, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{f})))(tls, dst, c, flags, *(*Twchar_t)(unsafe.Pointer(src)), extra)
  14960. if dst == libc.UintptrFromInt32(0) {
  14961. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14962. goto out
  14963. }
  14964. goto _7
  14965. _7:
  14966. ;
  14967. len1--
  14968. }
  14969. /* Terminate the string in the buffer. */
  14970. *(*Twchar_t)(unsafe.Pointer(dst)) = uint32('\000')
  14971. /*
  14972. * Output loop.
  14973. * Convert wchar_t string back to multibyte output string.
  14974. * If we have hit a multi-byte conversion error on input,
  14975. * output byte-by-byte here. Else use wctomb().
  14976. */
  14977. len1 = libc.Xwcslen(tls, start)
  14978. if dlen != 0 {
  14979. v9 = *(*Tsize_t)(unsafe.Pointer(dlen))
  14980. } else {
  14981. v9 = libc.Xwcslen(tls, start)*uint32(m_MB_LEN_MAX) + uint32(1)
  14982. }
  14983. maxolen = libc.Int32FromUint32(v9)
  14984. olen = uint32(0)
  14985. dst = start
  14986. for {
  14987. if !(len1 > uint32(0)) {
  14988. break
  14989. }
  14990. if !(cerr != 0) {
  14991. clen = libc.Xwctomb(tls, mbdst, *(*Twchar_t)(unsafe.Pointer(dst)))
  14992. }
  14993. if cerr != 0 || clen < 0 {
  14994. /*
  14995. * Conversion error, process as a byte(s) instead.
  14996. * Examine each byte and higher-order bytes for
  14997. * data. E.g.,
  14998. * 0x000000000000a264 -> a2 64
  14999. * 0x000000001f00a264 -> 1f 00 a2 64
  15000. */
  15001. clen = 0
  15002. wmsk = uint64(0)
  15003. i = libc.Int32FromUint32(libc.Uint32FromInt64(8) - libc.Uint32FromInt32(1))
  15004. for {
  15005. if !(i >= 0) {
  15006. break
  15007. }
  15008. shft = i * int32(m_CHAR_BIT)
  15009. bmsk = libc.Uint64FromInt64(0xff) << shft
  15010. wmsk |= bmsk
  15011. if uint64(*(*Twchar_t)(unsafe.Pointer(dst)))&wmsk != 0 || i == 0 {
  15012. v12 = clen
  15013. clen++
  15014. *(*uint8)(unsafe.Pointer(mbdst + uintptr(v12))) = uint8(uint64(*(*Twchar_t)(unsafe.Pointer(dst))) & bmsk >> shft)
  15015. }
  15016. goto _11
  15017. _11:
  15018. ;
  15019. i--
  15020. }
  15021. cerr = int32(1)
  15022. }
  15023. /* If this character would exceed our output limit, stop. */
  15024. if olen+libc.Uint32FromInt32(clen) > libc.Uint32FromInt32(maxolen) {
  15025. break
  15026. }
  15027. /* Advance output pointer by number of bytes written. */
  15028. mbdst += uintptr(clen)
  15029. /* Advance buffer character pointer. */
  15030. dst += 4
  15031. /* Incrment output character count. */
  15032. olen += libc.Uint32FromInt32(clen)
  15033. goto _10
  15034. _10:
  15035. ;
  15036. len1--
  15037. }
  15038. /* Terminate the output string. */
  15039. *(*uint8)(unsafe.Pointer(mbdst)) = uint8('\000')
  15040. if flags&int32(m_VIS_NOLOCALE1) != 0 {
  15041. /* Pass conversion error flag out. */
  15042. if cerr_ptr != 0 {
  15043. *(*int32)(unsafe.Pointer(cerr_ptr)) = cerr
  15044. }
  15045. }
  15046. libc.Xfree(tls, extra)
  15047. libc.Xfree(tls, pdst)
  15048. libc.Xfree(tls, psrc)
  15049. return libc.Int32FromUint32(olen)
  15050. goto out
  15051. out:
  15052. ;
  15053. libc.Xfree(tls, extra)
  15054. libc.Xfree(tls, pdst)
  15055. libc.Xfree(tls, psrc)
  15056. libc.Xfree(tls, mdst)
  15057. return error1
  15058. }
  15059. func _istrsenvisxna(tls *libc.TLS, _mbdst uintptr, dlen uintptr, mbsrc uintptr, mblength Tsize_t, flags int32, mbextra uintptr, cerr_ptr uintptr) (r int32) {
  15060. bp := tls.Alloc(16)
  15061. defer tls.Free(16)
  15062. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  15063. return _istrsenvisx(tls, bp, dlen, mbsrc, mblength, flags, mbextra, cerr_ptr)
  15064. }
  15065. func _istrsenvisxl(tls *libc.TLS, mbdst uintptr, dlen uintptr, mbsrc uintptr, flags int32, mbextra uintptr, cerr_ptr uintptr) (r int32) {
  15066. var v1 uint32
  15067. _ = v1
  15068. if mbsrc != libc.UintptrFromInt32(0) {
  15069. v1 = libc.Xstrlen(tls, mbsrc)
  15070. } else {
  15071. v1 = uint32(0)
  15072. }
  15073. return _istrsenvisxna(tls, mbdst, dlen, mbsrc, v1, flags, mbextra, cerr_ptr)
  15074. }
  15075. /*
  15076. * The "svis" variants all take an "extra" arg that is a pointer
  15077. * to a NUL-terminated list of characters to be encoded, too.
  15078. * These functions are useful e. g. to encode strings in such a
  15079. * way so that they are not interpreted by a shell.
  15080. */
  15081. func Xsvis(tls *libc.TLS, _mbdst uintptr, c int32, flags int32, nextc int32, mbextra uintptr) (r uintptr) {
  15082. bp := tls.Alloc(16)
  15083. defer tls.Free(16)
  15084. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  15085. var ret int32
  15086. var _ /* cc at bp+4 */ [2]uint8
  15087. _ = ret
  15088. (*(*[2]uint8)(unsafe.Pointer(bp + 4)))[0] = libc.Uint8FromInt32(c)
  15089. (*(*[2]uint8)(unsafe.Pointer(bp + 4)))[int32(1)] = libc.Uint8FromInt32(nextc)
  15090. ret = _istrsenvisx(tls, bp, libc.UintptrFromInt32(0), bp+4, uint32(1), flags, mbextra, libc.UintptrFromInt32(0))
  15091. if ret < 0 {
  15092. return libc.UintptrFromInt32(0)
  15093. }
  15094. return *(*uintptr)(unsafe.Pointer(bp)) + uintptr(ret)
  15095. }
  15096. func Xsnvis(tls *libc.TLS, _mbdst uintptr, _dlen Tsize_t, c int32, flags int32, nextc int32, mbextra uintptr) (r uintptr) {
  15097. bp := tls.Alloc(16)
  15098. defer tls.Free(16)
  15099. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  15100. *(*Tsize_t)(unsafe.Pointer(bp + 4)) = _dlen
  15101. var ret int32
  15102. var _ /* cc at bp+8 */ [2]uint8
  15103. _ = ret
  15104. (*(*[2]uint8)(unsafe.Pointer(bp + 8)))[0] = libc.Uint8FromInt32(c)
  15105. (*(*[2]uint8)(unsafe.Pointer(bp + 8)))[int32(1)] = libc.Uint8FromInt32(nextc)
  15106. ret = _istrsenvisx(tls, bp, bp+4, bp+8, uint32(1), flags, mbextra, libc.UintptrFromInt32(0))
  15107. if ret < 0 {
  15108. return libc.UintptrFromInt32(0)
  15109. }
  15110. return *(*uintptr)(unsafe.Pointer(bp)) + uintptr(ret)
  15111. }
  15112. func Xstrsvis(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, flags int32, mbextra uintptr) (r int32) {
  15113. return _istrsenvisxl(tls, mbdst, libc.UintptrFromInt32(0), mbsrc, flags, mbextra, libc.UintptrFromInt32(0))
  15114. }
  15115. func Xstrsnvis(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, flags int32, mbextra uintptr) (r int32) {
  15116. bp := tls.Alloc(16)
  15117. defer tls.Free(16)
  15118. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15119. return _istrsenvisxl(tls, mbdst, bp, mbsrc, flags, mbextra, libc.UintptrFromInt32(0))
  15120. }
  15121. func Xstrsvisx(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, len1 Tsize_t, flags int32, mbextra uintptr) (r int32) {
  15122. return _istrsenvisxna(tls, mbdst, libc.UintptrFromInt32(0), mbsrc, len1, flags, mbextra, libc.UintptrFromInt32(0))
  15123. }
  15124. func Xstrsnvisx(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, len1 Tsize_t, flags int32, mbextra uintptr) (r int32) {
  15125. bp := tls.Alloc(16)
  15126. defer tls.Free(16)
  15127. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15128. return _istrsenvisxna(tls, mbdst, bp, mbsrc, len1, flags, mbextra, libc.UintptrFromInt32(0))
  15129. }
  15130. func Xstrsenvisx(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, len1 Tsize_t, flags int32, mbextra uintptr, cerr_ptr uintptr) (r int32) {
  15131. bp := tls.Alloc(16)
  15132. defer tls.Free(16)
  15133. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15134. return _istrsenvisxna(tls, mbdst, bp, mbsrc, len1, flags, mbextra, cerr_ptr)
  15135. }
  15136. // C documentation
  15137. //
  15138. // /*
  15139. // * vis - visually encode characters
  15140. // */
  15141. func Xvis(tls *libc.TLS, _mbdst uintptr, c int32, flags int32, nextc int32) (r uintptr) {
  15142. bp := tls.Alloc(16)
  15143. defer tls.Free(16)
  15144. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  15145. var ret int32
  15146. var _ /* cc at bp+4 */ [2]uint8
  15147. _ = ret
  15148. (*(*[2]uint8)(unsafe.Pointer(bp + 4)))[0] = libc.Uint8FromInt32(c)
  15149. (*(*[2]uint8)(unsafe.Pointer(bp + 4)))[int32(1)] = libc.Uint8FromInt32(nextc)
  15150. ret = _istrsenvisx(tls, bp, libc.UintptrFromInt32(0), bp+4, uint32(1), flags, __ccgo_ts+53, libc.UintptrFromInt32(0))
  15151. if ret < 0 {
  15152. return libc.UintptrFromInt32(0)
  15153. }
  15154. return *(*uintptr)(unsafe.Pointer(bp)) + uintptr(ret)
  15155. }
  15156. func Xnvis(tls *libc.TLS, _mbdst uintptr, _dlen Tsize_t, c int32, flags int32, nextc int32) (r uintptr) {
  15157. bp := tls.Alloc(16)
  15158. defer tls.Free(16)
  15159. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  15160. *(*Tsize_t)(unsafe.Pointer(bp + 4)) = _dlen
  15161. var ret int32
  15162. var _ /* cc at bp+8 */ [2]uint8
  15163. _ = ret
  15164. (*(*[2]uint8)(unsafe.Pointer(bp + 8)))[0] = libc.Uint8FromInt32(c)
  15165. (*(*[2]uint8)(unsafe.Pointer(bp + 8)))[int32(1)] = libc.Uint8FromInt32(nextc)
  15166. ret = _istrsenvisx(tls, bp, bp+4, bp+8, uint32(1), flags, __ccgo_ts+53, libc.UintptrFromInt32(0))
  15167. if ret < 0 {
  15168. return libc.UintptrFromInt32(0)
  15169. }
  15170. return *(*uintptr)(unsafe.Pointer(bp)) + uintptr(ret)
  15171. }
  15172. /*
  15173. * strvis - visually encode characters from src into dst
  15174. *
  15175. * Dst must be 4 times the size of src to account for possible
  15176. * expansion. The length of dst, not including the trailing NULL,
  15177. * is returned.
  15178. */
  15179. func Xstrvis(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, flags int32) (r int32) {
  15180. return _istrsenvisxl(tls, mbdst, libc.UintptrFromInt32(0), mbsrc, flags, __ccgo_ts+53, libc.UintptrFromInt32(0))
  15181. }
  15182. func Xstrnvis_openbsd(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, _dlen Tsize_t, flags int32) (r int32) {
  15183. bp := tls.Alloc(16)
  15184. defer tls.Free(16)
  15185. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15186. return _istrsenvisxl(tls, mbdst, bp, mbsrc, flags, __ccgo_ts+53, libc.UintptrFromInt32(0))
  15187. }
  15188. func Xstrnvis_netbsd(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, flags int32) (r int32) {
  15189. bp := tls.Alloc(16)
  15190. defer tls.Free(16)
  15191. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15192. return _istrsenvisxl(tls, mbdst, bp, mbsrc, flags, __ccgo_ts+53, libc.UintptrFromInt32(0))
  15193. }
  15194. func Xstravis(tls *libc.TLS, mbdstp uintptr, mbsrc uintptr, flags int32) (r int32) {
  15195. var v1 uint32
  15196. _ = v1
  15197. *(*uintptr)(unsafe.Pointer(mbdstp)) = libc.UintptrFromInt32(0)
  15198. if mbsrc != libc.UintptrFromInt32(0) {
  15199. v1 = libc.Xstrlen(tls, mbsrc)
  15200. } else {
  15201. v1 = uint32(0)
  15202. }
  15203. return _istrsenvisx(tls, mbdstp, libc.UintptrFromInt32(0), mbsrc, v1, flags, __ccgo_ts+53, libc.UintptrFromInt32(0))
  15204. }
  15205. /*
  15206. * strvisx - visually encode characters from src into dst
  15207. *
  15208. * Dst must be 4 times the size of src to account for possible
  15209. * expansion. The length of dst, not including the trailing NULL,
  15210. * is returned.
  15211. *
  15212. * Strvisx encodes exactly len characters from src into dst.
  15213. * This is useful for encoding a block of data.
  15214. */
  15215. func Xstrvisx(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, len1 Tsize_t, flags int32) (r int32) {
  15216. return _istrsenvisxna(tls, mbdst, libc.UintptrFromInt32(0), mbsrc, len1, flags, __ccgo_ts+53, libc.UintptrFromInt32(0))
  15217. }
  15218. func Xstrnvisx(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, len1 Tsize_t, flags int32) (r int32) {
  15219. bp := tls.Alloc(16)
  15220. defer tls.Free(16)
  15221. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15222. return _istrsenvisxna(tls, mbdst, bp, mbsrc, len1, flags, __ccgo_ts+53, libc.UintptrFromInt32(0))
  15223. }
  15224. func Xstrenvisx(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, len1 Tsize_t, flags int32, cerr_ptr uintptr) (r int32) {
  15225. bp := tls.Alloc(16)
  15226. defer tls.Free(16)
  15227. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15228. return _istrsenvisxna(tls, mbdst, bp, mbsrc, len1, flags, __ccgo_ts+53, cerr_ptr)
  15229. }
  15230. // C documentation
  15231. //
  15232. // /*
  15233. // * Appends src to string dst of size siz (unlike wcsncat, siz is the
  15234. // * full size of dst, not space left). At most siz-1 characters
  15235. // * will be copied. Always NUL terminates (unless siz == 0).
  15236. // * Returns wcslen(initial dst) + wcslen(src); if retval >= siz,
  15237. // * truncation occurred.
  15238. // */
  15239. func Xwcslcat(tls *libc.TLS, dst uintptr, src uintptr, siz Tsize_t) (r Tsize_t) {
  15240. var d, s, v3 uintptr
  15241. var dlen, n, v1 Tsize_t
  15242. var v2 bool
  15243. _, _, _, _, _, _, _ = d, dlen, n, s, v1, v2, v3
  15244. d = dst
  15245. s = src
  15246. n = siz
  15247. /* Find the end of dst and adjust bytes left but don't go past end */
  15248. for {
  15249. if v2 = *(*Twchar_t)(unsafe.Pointer(d)) != uint32('\000'); v2 {
  15250. v1 = n
  15251. n--
  15252. }
  15253. if !(v2 && v1 != uint32(0)) {
  15254. break
  15255. }
  15256. d += 4
  15257. }
  15258. dlen = libc.Uint32FromInt32((int32(d) - int32(dst)) / 4)
  15259. n = siz - dlen
  15260. if n == uint32(0) {
  15261. return dlen + libc.Xwcslen(tls, s)
  15262. }
  15263. for *(*Twchar_t)(unsafe.Pointer(s)) != uint32('\000') {
  15264. if n != uint32(1) {
  15265. v3 = d
  15266. d += 4
  15267. *(*Twchar_t)(unsafe.Pointer(v3)) = *(*Twchar_t)(unsafe.Pointer(s))
  15268. n--
  15269. }
  15270. s += 4
  15271. }
  15272. *(*Twchar_t)(unsafe.Pointer(d)) = uint32('\000')
  15273. return dlen + libc.Uint32FromInt32((int32(s)-int32(src))/4) /* count does not include NUL */
  15274. }
  15275. // C documentation
  15276. //
  15277. // /*
  15278. // * Copy src to string dst of size siz. At most siz-1 characters
  15279. // * will be copied. Always NUL terminates (unless siz == 0).
  15280. // * Returns wcslen(src); if retval >= siz, truncation occurred.
  15281. // */
  15282. func Xwcslcpy(tls *libc.TLS, dst uintptr, src uintptr, siz Tsize_t) (r Tsize_t) {
  15283. var d, s, v6, v7, v8 uintptr
  15284. var n, v1, v3 Tsize_t
  15285. var v2 bool
  15286. var v5 Twchar_t
  15287. _, _, _, _, _, _, _, _, _, _ = d, n, s, v1, v2, v3, v5, v6, v7, v8
  15288. d = dst
  15289. s = src
  15290. n = siz
  15291. /* Copy as many bytes as will fit */
  15292. if v2 = n != uint32(0); v2 {
  15293. n--
  15294. v1 = n
  15295. }
  15296. if v2 && v1 != uint32(0) {
  15297. for {
  15298. v6 = s
  15299. s += 4
  15300. v5 = *(*Twchar_t)(unsafe.Pointer(v6))
  15301. v7 = d
  15302. d += 4
  15303. *(*Twchar_t)(unsafe.Pointer(v7)) = v5
  15304. if v5 == uint32(0) {
  15305. break
  15306. }
  15307. goto _4
  15308. _4:
  15309. ;
  15310. n--
  15311. v3 = n
  15312. if !(v3 != uint32(0)) {
  15313. break
  15314. }
  15315. }
  15316. }
  15317. /* Not enough room in dst, add NUL and traverse rest of src */
  15318. if n == uint32(0) {
  15319. if siz != uint32(0) {
  15320. *(*Twchar_t)(unsafe.Pointer(d)) = uint32('\000')
  15321. } /* NUL-terminate dst */
  15322. for {
  15323. v8 = s
  15324. s += 4
  15325. if !(*(*Twchar_t)(unsafe.Pointer(v8)) != 0) {
  15326. break
  15327. }
  15328. }
  15329. }
  15330. return libc.Uint32FromInt32((int32(s)-int32(src))/4 - libc.Int32FromInt32(1)) /* count does not include NUL */
  15331. }
  15332. const m_CTL_MAXNAME = 10
  15333. const m_ECHO1 = 0000010
  15334. const m_ECHONL1 = 0000100
  15335. const m_ELFMAG01 = 0x7f
  15336. const m_ELFMAG11 = 'E'
  15337. const m_ELFMAG21 = 'L'
  15338. const m_ELFMAG31 = 'F'
  15339. const m_FIOASYNC = 0x5452
  15340. const m_FIOCLEX = 0x5451
  15341. const m_FIOGETOWN = 0x8903
  15342. const m_FIONBIO = 0x5421
  15343. const m_FIONCLEX = 0x5450
  15344. const m_FIONREAD = 0x541B
  15345. const m_FIOSETOWN = 0x8901
  15346. const m_GRND_INSECURE = 0x0004
  15347. const m_GRND_NONBLOCK = 1
  15348. const m_GRND_RANDOM = 0x0002
  15349. const m_IOCSIZE_SHIFT = "_IOC_SIZESHIFT"
  15350. const m_MAP_ANON2 = 32
  15351. const m_MAP_PRIVATE2 = 2
  15352. const m_MNT_DETACH = 2
  15353. const m_MNT_EXPIRE = 4
  15354. const m_MNT_FORCE = 1
  15355. const m_MS_BIND = 4096
  15356. const m_MS_DIRSYNC = 128
  15357. const m_MS_MANDLOCK = 64
  15358. const m_MS_MGC_MSK = 0xffff0000
  15359. const m_MS_MGC_VAL = 0xc0ed0000
  15360. const m_MS_MOVE = 8192
  15361. const m_MS_NOATIME = 1024
  15362. const m_MS_NODEV = 4
  15363. const m_MS_NODIRATIME = 2048
  15364. const m_MS_NOEXEC = 8
  15365. const m_MS_NOSUID = 2
  15366. const m_MS_NOSYMFOLLOW = 256
  15367. const m_MS_RDONLY = 1
  15368. const m_MS_REC = 16384
  15369. const m_MS_REMOUNT = 32
  15370. const m_MS_SILENT = 32768
  15371. const m_MS_SYNCHRONOUS = 16
  15372. const m_N_6PACK = 7
  15373. const m_N_AX25 = 5
  15374. const m_N_CAIF = 20
  15375. const m_N_GIGASET_M101 = 16
  15376. const m_N_GSM0710 = 21
  15377. const m_N_HCI = 15
  15378. const m_N_HDLC = 13
  15379. const m_N_IRDA = 11
  15380. const m_N_MASC = 8
  15381. const m_N_MOUSE = 2
  15382. const m_N_NCI = 25
  15383. const m_N_NULL = 27
  15384. const m_N_PPP = 3
  15385. const m_N_PPS = 18
  15386. const m_N_PROFIBUS_FDL = 10
  15387. const m_N_R3964 = 9
  15388. const m_N_SLCAN = 17
  15389. const m_N_SLIP = 1
  15390. const m_N_SMSBLOCK = 12
  15391. const m_N_SPEAKUP = 26
  15392. const m_N_STRIP = 4
  15393. const m_N_SYNC_PPP = 14
  15394. const m_N_TI_WL = 22
  15395. const m_N_TRACEROUTER = 24
  15396. const m_N_TRACESINK = 23
  15397. const m_N_TTY = 0
  15398. const m_N_V253 = 19
  15399. const m_N_X25 = 6
  15400. const m_O_CLOEXEC1 = 524288
  15401. const m_O_NOFOLLOW1 = 32768
  15402. const m_O_RDONLY3 = 0
  15403. const m_O_RDWR2 = 02
  15404. const m_REPEAT = 5
  15405. const m_SHA256_BLOCK_LENGTH = 64
  15406. const m_SHA256_DIGEST_LENGTH = 32
  15407. const m_SHA384_BLOCK_LENGTH = 128
  15408. const m_SHA384_DIGEST_LENGTH = 48
  15409. const m_SHA384_Data = "SHA384Data"
  15410. const m_SHA384_End = "SHA384End"
  15411. const m_SHA384_File = "SHA384File"
  15412. const m_SHA384_FileChunk = "SHA384FileChunk"
  15413. const m_SHA384_Final = "SHA384Final"
  15414. const m_SHA384_Init = "SHA384Init"
  15415. const m_SHA384_Update = "SHA384Update"
  15416. const m_SHA512_BLOCK_LENGTH = 128
  15417. const m_SHA512_DIGEST_LENGTH = 64
  15418. const m_SHA512_Data = "SHA512Data"
  15419. const m_SHA512_End = "SHA512End"
  15420. const m_SHA512_File = "SHA512File"
  15421. const m_SHA512_FileChunk = "SHA512FileChunk"
  15422. const m_SHA512_Final = "SHA512Final"
  15423. const m_SHA512_Init = "SHA512Init"
  15424. const m_SHA512_Update = "SHA512Update"
  15425. const m_SHN_ABS1 = 0xfff1
  15426. const m_SHN_COMMON1 = 0xfff2
  15427. const m_SIOCADDDLCI = 0x8980
  15428. const m_SIOCADDMULTI = 0x8931
  15429. const m_SIOCADDRT = 0x890B
  15430. const m_SIOCATMARK = 0x8905
  15431. const m_SIOCDARP = 0x8953
  15432. const m_SIOCDELDLCI = 0x8981
  15433. const m_SIOCDELMULTI = 0x8932
  15434. const m_SIOCDELRT = 0x890C
  15435. const m_SIOCDEVPRIVATE = 0x89F0
  15436. const m_SIOCDIFADDR = 0x8936
  15437. const m_SIOCDRARP = 0x8960
  15438. const m_SIOCGARP = 0x8954
  15439. const m_SIOCGIFADDR = 0x8915
  15440. const m_SIOCGIFBR = 0x8940
  15441. const m_SIOCGIFBRDADDR = 0x8919
  15442. const m_SIOCGIFCONF = 0x8912
  15443. const m_SIOCGIFCOUNT = 0x8938
  15444. const m_SIOCGIFDSTADDR = 0x8917
  15445. const m_SIOCGIFENCAP = 0x8925
  15446. const m_SIOCGIFFLAGS = 0x8913
  15447. const m_SIOCGIFHWADDR = 0x8927
  15448. const m_SIOCGIFINDEX = 0x8933
  15449. const m_SIOCGIFMAP = 0x8970
  15450. const m_SIOCGIFMEM = 0x891f
  15451. const m_SIOCGIFMETRIC = 0x891d
  15452. const m_SIOCGIFMTU = 0x8921
  15453. const m_SIOCGIFNAME = 0x8910
  15454. const m_SIOCGIFNETMASK = 0x891b
  15455. const m_SIOCGIFPFLAGS = 0x8935
  15456. const m_SIOCGIFSLAVE = 0x8929
  15457. const m_SIOCGIFTXQLEN = 0x8942
  15458. const m_SIOCGPGRP = 0x8904
  15459. const m_SIOCGRARP = 0x8961
  15460. const m_SIOCPROTOPRIVATE = 0x89E0
  15461. const m_SIOCRTMSG = 0x890D
  15462. const m_SIOCSARP = 0x8955
  15463. const m_SIOCSIFADDR = 0x8916
  15464. const m_SIOCSIFBR = 0x8941
  15465. const m_SIOCSIFBRDADDR = 0x891a
  15466. const m_SIOCSIFDSTADDR = 0x8918
  15467. const m_SIOCSIFENCAP = 0x8926
  15468. const m_SIOCSIFFLAGS = 0x8914
  15469. const m_SIOCSIFHWADDR = 0x8924
  15470. const m_SIOCSIFHWBROADCAST = 0x8937
  15471. const m_SIOCSIFLINK = 0x8911
  15472. const m_SIOCSIFMAP = 0x8971
  15473. const m_SIOCSIFMEM = 0x8920
  15474. const m_SIOCSIFMETRIC = 0x891e
  15475. const m_SIOCSIFMTU = 0x8922
  15476. const m_SIOCSIFNAME = 0x8923
  15477. const m_SIOCSIFNETMASK = 0x891c
  15478. const m_SIOCSIFPFLAGS = 0x8934
  15479. const m_SIOCSIFSLAVE = 0x8930
  15480. const m_SIOCSIFTXQLEN = 0x8943
  15481. const m_SIOCSPGRP = 0x8902
  15482. const m_SIOCSRARP = 0x8962
  15483. const m_SIOGIFINDEX = "SIOCGIFINDEX"
  15484. const m_ST_APPEND = 256
  15485. const m_ST_IMMUTABLE = 512
  15486. const m_ST_MANDLOCK = 64
  15487. const m_ST_NOATIME = 1024
  15488. const m_ST_NODEV = 4
  15489. const m_ST_NODIRATIME = 2048
  15490. const m_ST_NOEXEC = 8
  15491. const m_ST_NOSUID = 2
  15492. const m_ST_RDONLY = 1
  15493. const m_ST_RELATIME = 4096
  15494. const m_ST_SYNCHRONOUS = 16
  15495. const m_ST_WRITE = 128
  15496. const m_S_IFCHR3 = 8192
  15497. const m_S_IFIFO3 = 4096
  15498. const m_S_IFMT3 = 61440
  15499. const m_S_IFREG3 = 32768
  15500. const m_S_IFSOCK3 = 49152
  15501. const m_TCFLSH = 0x540B
  15502. const m_TCGETA = 0x5405
  15503. const m_TCGETS = 0x5401
  15504. const m_TCGETX = 0x5432
  15505. const m_TCSBRK = 0x5409
  15506. const m_TCSBRKP = 0x5425
  15507. const m_TCSETA = 0x5406
  15508. const m_TCSETAF = 0x5408
  15509. const m_TCSETAW = 0x5407
  15510. const m_TCSETS = 0x5402
  15511. const m_TCSETSF = 0x5404
  15512. const m_TCSETSW = 0x5403
  15513. const m_TCSETX = 0x5433
  15514. const m_TCSETXF = 0x5434
  15515. const m_TCSETXW = 0x5435
  15516. const m_TCXONC = 0x540A
  15517. const m_TIOCCBRK = 0x5428
  15518. const m_TIOCCONS = 0x541D
  15519. const m_TIOCEXCL = 0x540C
  15520. const m_TIOCGDEV = 0x80045432
  15521. const m_TIOCGETD = 0x5424
  15522. const m_TIOCGEXCL = 0x80045440
  15523. const m_TIOCGICOUNT = 0x545D
  15524. const m_TIOCGISO7816 = 0x80285442
  15525. const m_TIOCGLCKTRMIOS = 0x5456
  15526. const m_TIOCGPGRP = 0x540F
  15527. const m_TIOCGPKT = 0x80045438
  15528. const m_TIOCGPTLCK = 0x80045439
  15529. const m_TIOCGPTN = 0x80045430
  15530. const m_TIOCGPTPEER = 0x5441
  15531. const m_TIOCGRS485 = 0x542E
  15532. const m_TIOCGSERIAL = 0x541E
  15533. const m_TIOCGSID = 0x5429
  15534. const m_TIOCGSOFTCAR = 0x5419
  15535. const m_TIOCGWINSZ = 0x5413
  15536. const m_TIOCINQ = "FIONREAD"
  15537. const m_TIOCLINUX = 0x541C
  15538. const m_TIOCMBIC = 0x5417
  15539. const m_TIOCMBIS = 0x5416
  15540. const m_TIOCMGET = 0x5415
  15541. const m_TIOCMIWAIT = 0x545C
  15542. const m_TIOCMSET = 0x5418
  15543. const m_TIOCM_CAR = 0x040
  15544. const m_TIOCM_CD = "TIOCM_CAR"
  15545. const m_TIOCM_CTS = 0x020
  15546. const m_TIOCM_DSR = 0x100
  15547. const m_TIOCM_DTR = 0x002
  15548. const m_TIOCM_LE = 0x001
  15549. const m_TIOCM_LOOP = 0x8000
  15550. const m_TIOCM_OUT1 = 0x2000
  15551. const m_TIOCM_OUT2 = 0x4000
  15552. const m_TIOCM_RI = "TIOCM_RNG"
  15553. const m_TIOCM_RNG = 0x080
  15554. const m_TIOCM_RTS = 0x004
  15555. const m_TIOCM_SR = 0x010
  15556. const m_TIOCM_ST = 0x008
  15557. const m_TIOCNOTTY = 0x5422
  15558. const m_TIOCNXCL = 0x540D
  15559. const m_TIOCOUTQ = 0x5411
  15560. const m_TIOCPKT = 0x5420
  15561. const m_TIOCPKT_DATA = 0
  15562. const m_TIOCPKT_DOSTOP = 32
  15563. const m_TIOCPKT_FLUSHREAD = 1
  15564. const m_TIOCPKT_FLUSHWRITE = 2
  15565. const m_TIOCPKT_IOCTL = 64
  15566. const m_TIOCPKT_NOSTOP = 16
  15567. const m_TIOCPKT_START = 8
  15568. const m_TIOCPKT_STOP = 4
  15569. const m_TIOCSBRK = 0x5427
  15570. const m_TIOCSCTTY = 0x540E
  15571. const m_TIOCSERCONFIG = 0x5453
  15572. const m_TIOCSERGETLSR = 0x5459
  15573. const m_TIOCSERGETMULTI = 0x545A
  15574. const m_TIOCSERGSTRUCT = 0x5458
  15575. const m_TIOCSERGWILD = 0x5454
  15576. const m_TIOCSERSETMULTI = 0x545B
  15577. const m_TIOCSERSWILD = 0x5455
  15578. const m_TIOCSER_TEMT = 1
  15579. const m_TIOCSETD = 0x5423
  15580. const m_TIOCSIG = 0x40045436
  15581. const m_TIOCSISO7816 = 0xc0285443
  15582. const m_TIOCSLCKTRMIOS = 0x5457
  15583. const m_TIOCSPGRP = 0x5410
  15584. const m_TIOCSPTLCK = 0x40045431
  15585. const m_TIOCSRS485 = 0x542F
  15586. const m_TIOCSSERIAL = 0x541F
  15587. const m_TIOCSSOFTCAR = 0x541A
  15588. const m_TIOCSTI = 0x5412
  15589. const m_TIOCSWINSZ = 0x5414
  15590. const m_TIOCVHANGUP = 0x5437
  15591. const m_UMOUNT_NOFOLLOW = 8
  15592. const m__IOC_DIRBITS = 2
  15593. const m__IOC_NONE = 0
  15594. const m__IOC_NRBITS = 8
  15595. const m__IOC_NRSHIFT = 0
  15596. const m__IOC_READ = 2
  15597. const m__IOC_SIZEBITS = 14
  15598. const m__IOC_TYPEBITS = 8
  15599. const m__IOC_WRITE = 1
  15600. const m__POSIX_C_SOURCE = 199309
  15601. const m___BITS_PER_LONG_LONG = 64
  15602. const m___bitwise__ = "__bitwise"
  15603. type t__s8 = int8
  15604. type t__u8 = uint8
  15605. type t__s16 = int16
  15606. type t__u16 = uint16
  15607. type t__s32 = int32
  15608. type t__u32 = uint32
  15609. type t__s64 = int64
  15610. type t__u64 = uint64
  15611. type t__kernel_fd_set = struct {
  15612. Ffds_bits [32]uint32
  15613. }
  15614. type t__kernel_sighandler_t = uintptr
  15615. type t__kernel_key_t = int32
  15616. type t__kernel_mqd_t = int32
  15617. type t__kernel_mode_t = uint16
  15618. type t__kernel_ipc_pid_t = uint16
  15619. type t__kernel_uid_t = uint16
  15620. type t__kernel_gid_t = uint16
  15621. type t__kernel_old_dev_t = uint16
  15622. type t__kernel_long_t = int32
  15623. type t__kernel_ulong_t = uint32
  15624. type t__kernel_ino_t = uint32
  15625. type t__kernel_pid_t = int32
  15626. type t__kernel_suseconds_t = int32
  15627. type t__kernel_daddr_t = int32
  15628. type t__kernel_uid32_t = uint32
  15629. type t__kernel_gid32_t = uint32
  15630. type t__kernel_old_uid_t = uint16
  15631. type t__kernel_old_gid_t = uint16
  15632. type t__kernel_size_t = uint32
  15633. type t__kernel_ssize_t = int32
  15634. type t__kernel_ptrdiff_t = int32
  15635. type t__kernel_fsid_t = struct {
  15636. Fval [2]int32
  15637. }
  15638. type t__kernel_off_t = int32
  15639. type t__kernel_loff_t = int64
  15640. type t__kernel_old_time_t = int32
  15641. type t__kernel_time_t = int32
  15642. type t__kernel_time64_t = int64
  15643. type t__kernel_clock_t = int32
  15644. type t__kernel_timer_t = int32
  15645. type t__kernel_clockid_t = int32
  15646. type t__kernel_caddr_t = uintptr
  15647. type t__kernel_uid16_t = uint16
  15648. type t__kernel_gid16_t = uint16
  15649. type t__le16 = uint16
  15650. type t__be16 = uint16
  15651. type t__le32 = uint32
  15652. type t__be32 = uint32
  15653. type t__le64 = uint64
  15654. type t__be64 = uint64
  15655. type t__sum16 = uint16
  15656. type t__wsum = uint32
  15657. type t__poll_t = uint32
  15658. type t__sysctl_args = struct {
  15659. Fname uintptr
  15660. Fnlen int32
  15661. Foldval uintptr
  15662. Foldlenp uintptr
  15663. Fnewval uintptr
  15664. Fnewlen Tsize_t
  15665. F__unused [4]uint32
  15666. }
  15667. const _CTL_KERN = 1
  15668. const _CTL_VM = 2
  15669. const _CTL_NET = 3
  15670. const _CTL_PROC = 4
  15671. const _CTL_FS = 5
  15672. const _CTL_DEBUG = 6
  15673. const _CTL_DEV = 7
  15674. const _CTL_BUS = 8
  15675. const _CTL_ABI = 9
  15676. const _CTL_CPU = 10
  15677. const _CTL_ARLAN = 254
  15678. const _CTL_S390DBF = 5677
  15679. const _CTL_SUNRPC = 7249
  15680. const _CTL_PM = 9899
  15681. const _CTL_FRV = 9898
  15682. const _CTL_BUS_ISA = 1
  15683. const _INOTIFY_MAX_USER_INSTANCES = 1
  15684. const _INOTIFY_MAX_USER_WATCHES = 2
  15685. const _INOTIFY_MAX_QUEUED_EVENTS = 3
  15686. const _KERN_OSTYPE = 1
  15687. const _KERN_OSRELEASE = 2
  15688. const _KERN_OSREV = 3
  15689. const _KERN_VERSION = 4
  15690. const _KERN_SECUREMASK = 5
  15691. const _KERN_PROF = 6
  15692. const _KERN_NODENAME = 7
  15693. const _KERN_DOMAINNAME = 8
  15694. const _KERN_PANIC = 15
  15695. const _KERN_REALROOTDEV = 16
  15696. const _KERN_SPARC_REBOOT = 21
  15697. const _KERN_CTLALTDEL = 22
  15698. const _KERN_PRINTK = 23
  15699. const _KERN_NAMETRANS = 24
  15700. const _KERN_PPC_HTABRECLAIM = 25
  15701. const _KERN_PPC_ZEROPAGED = 26
  15702. const _KERN_PPC_POWERSAVE_NAP = 27
  15703. const _KERN_MODPROBE = 28
  15704. const _KERN_SG_BIG_BUFF = 29
  15705. const _KERN_ACCT = 30
  15706. const _KERN_PPC_L2CR = 31
  15707. const _KERN_RTSIGNR = 32
  15708. const _KERN_RTSIGMAX = 33
  15709. const _KERN_SHMMAX = 34
  15710. const _KERN_MSGMAX = 35
  15711. const _KERN_MSGMNB = 36
  15712. const _KERN_MSGPOOL = 37
  15713. const _KERN_SYSRQ = 38
  15714. const _KERN_MAX_THREADS = 39
  15715. const _KERN_RANDOM = 40
  15716. const _KERN_SHMALL = 41
  15717. const _KERN_MSGMNI = 42
  15718. const _KERN_SEM = 43
  15719. const _KERN_SPARC_STOP_A = 44
  15720. const _KERN_SHMMNI = 45
  15721. const _KERN_OVERFLOWUID = 46
  15722. const _KERN_OVERFLOWGID = 47
  15723. const _KERN_SHMPATH = 48
  15724. const _KERN_HOTPLUG = 49
  15725. const _KERN_IEEE_EMULATION_WARNINGS = 50
  15726. const _KERN_S390_USER_DEBUG_LOGGING = 51
  15727. const _KERN_CORE_USES_PID = 52
  15728. const _KERN_TAINTED = 53
  15729. const _KERN_CADPID = 54
  15730. const _KERN_PIDMAX = 55
  15731. const _KERN_CORE_PATTERN = 56
  15732. const _KERN_PANIC_ON_OOPS = 57
  15733. const _KERN_HPPA_PWRSW = 58
  15734. const _KERN_HPPA_UNALIGNED = 59
  15735. const _KERN_PRINTK_RATELIMIT = 60
  15736. const _KERN_PRINTK_RATELIMIT_BURST = 61
  15737. const _KERN_PTY = 62
  15738. const _KERN_NGROUPS_MAX = 63
  15739. const _KERN_SPARC_SCONS_PWROFF = 64
  15740. const _KERN_HZ_TIMER = 65
  15741. const _KERN_UNKNOWN_NMI_PANIC = 66
  15742. const _KERN_BOOTLOADER_TYPE = 67
  15743. const _KERN_RANDOMIZE = 68
  15744. const _KERN_SETUID_DUMPABLE = 69
  15745. const _KERN_SPIN_RETRY = 70
  15746. const _KERN_ACPI_VIDEO_FLAGS = 71
  15747. const _KERN_IA64_UNALIGNED = 72
  15748. const _KERN_COMPAT_LOG = 73
  15749. const _KERN_MAX_LOCK_DEPTH = 74
  15750. const _KERN_NMI_WATCHDOG = 75
  15751. const _KERN_PANIC_ON_NMI = 76
  15752. const _KERN_PANIC_ON_WARN = 77
  15753. const _KERN_PANIC_PRINT = 78
  15754. const _VM_UNUSED1 = 1
  15755. const _VM_UNUSED2 = 2
  15756. const _VM_UNUSED3 = 3
  15757. const _VM_UNUSED4 = 4
  15758. const _VM_OVERCOMMIT_MEMORY = 5
  15759. const _VM_UNUSED5 = 6
  15760. const _VM_UNUSED7 = 7
  15761. const _VM_UNUSED8 = 8
  15762. const _VM_UNUSED9 = 9
  15763. const _VM_PAGE_CLUSTER = 10
  15764. const _VM_DIRTY_BACKGROUND = 11
  15765. const _VM_DIRTY_RATIO = 12
  15766. const _VM_DIRTY_WB_CS = 13
  15767. const _VM_DIRTY_EXPIRE_CS = 14
  15768. const _VM_NR_PDFLUSH_THREADS = 15
  15769. const _VM_OVERCOMMIT_RATIO = 16
  15770. const _VM_PAGEBUF = 17
  15771. const _VM_HUGETLB_PAGES = 18
  15772. const _VM_SWAPPINESS = 19
  15773. const _VM_LOWMEM_RESERVE_RATIO = 20
  15774. const _VM_MIN_FREE_KBYTES = 21
  15775. const _VM_MAX_MAP_COUNT = 22
  15776. const _VM_LAPTOP_MODE = 23
  15777. const _VM_BLOCK_DUMP = 24
  15778. const _VM_HUGETLB_GROUP = 25
  15779. const _VM_VFS_CACHE_PRESSURE = 26
  15780. const _VM_LEGACY_VA_LAYOUT = 27
  15781. const _VM_SWAP_TOKEN_TIMEOUT = 28
  15782. const _VM_DROP_PAGECACHE = 29
  15783. const _VM_PERCPU_PAGELIST_FRACTION = 30
  15784. const _VM_ZONE_RECLAIM_MODE = 31
  15785. const _VM_MIN_UNMAPPED = 32
  15786. const _VM_PANIC_ON_OOM = 33
  15787. const _VM_VDSO_ENABLED = 34
  15788. const _VM_MIN_SLAB = 35
  15789. const _NET_CORE = 1
  15790. const _NET_ETHER = 2
  15791. const _NET_802 = 3
  15792. const _NET_UNIX = 4
  15793. const _NET_IPV4 = 5
  15794. const _NET_IPX = 6
  15795. const _NET_ATALK = 7
  15796. const _NET_NETROM = 8
  15797. const _NET_AX25 = 9
  15798. const _NET_BRIDGE = 10
  15799. const _NET_ROSE = 11
  15800. const _NET_IPV6 = 12
  15801. const _NET_X25 = 13
  15802. const _NET_TR = 14
  15803. const _NET_DECNET = 15
  15804. const _NET_ECONET = 16
  15805. const _NET_SCTP = 17
  15806. const _NET_LLC = 18
  15807. const _NET_NETFILTER = 19
  15808. const _NET_DCCP = 20
  15809. const _NET_IRDA = 412
  15810. const _RANDOM_POOLSIZE = 1
  15811. const _RANDOM_ENTROPY_COUNT = 2
  15812. const _RANDOM_READ_THRESH = 3
  15813. const _RANDOM_WRITE_THRESH = 4
  15814. const _RANDOM_BOOT_ID = 5
  15815. const _RANDOM_UUID = 6
  15816. const _PTY_MAX = 1
  15817. const _PTY_NR = 2
  15818. const _BUS_ISA_MEM_BASE = 1
  15819. const _BUS_ISA_PORT_BASE = 2
  15820. const _BUS_ISA_PORT_SHIFT = 3
  15821. const _NET_CORE_WMEM_MAX = 1
  15822. const _NET_CORE_RMEM_MAX = 2
  15823. const _NET_CORE_WMEM_DEFAULT = 3
  15824. const _NET_CORE_RMEM_DEFAULT = 4
  15825. const _NET_CORE_MAX_BACKLOG = 6
  15826. const _NET_CORE_FASTROUTE = 7
  15827. const _NET_CORE_MSG_COST = 8
  15828. const _NET_CORE_MSG_BURST = 9
  15829. const _NET_CORE_OPTMEM_MAX = 10
  15830. const _NET_CORE_HOT_LIST_LENGTH = 11
  15831. const _NET_CORE_DIVERT_VERSION = 12
  15832. const _NET_CORE_NO_CONG_THRESH = 13
  15833. const _NET_CORE_NO_CONG = 14
  15834. const _NET_CORE_LO_CONG = 15
  15835. const _NET_CORE_MOD_CONG = 16
  15836. const _NET_CORE_DEV_WEIGHT = 17
  15837. const _NET_CORE_SOMAXCONN = 18
  15838. const _NET_CORE_BUDGET = 19
  15839. const _NET_CORE_AEVENT_ETIME = 20
  15840. const _NET_CORE_AEVENT_RSEQTH = 21
  15841. const _NET_CORE_WARNINGS = 22
  15842. const _NET_UNIX_DESTROY_DELAY = 1
  15843. const _NET_UNIX_DELETE_DELAY = 2
  15844. const _NET_UNIX_MAX_DGRAM_QLEN = 3
  15845. const _NET_NF_CONNTRACK_MAX = 1
  15846. const _NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT = 2
  15847. const _NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV = 3
  15848. const _NET_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED = 4
  15849. const _NET_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT = 5
  15850. const _NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT = 6
  15851. const _NET_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK = 7
  15852. const _NET_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT = 8
  15853. const _NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE = 9
  15854. const _NET_NF_CONNTRACK_UDP_TIMEOUT = 10
  15855. const _NET_NF_CONNTRACK_UDP_TIMEOUT_STREAM = 11
  15856. const _NET_NF_CONNTRACK_ICMP_TIMEOUT = 12
  15857. const _NET_NF_CONNTRACK_GENERIC_TIMEOUT = 13
  15858. const _NET_NF_CONNTRACK_BUCKETS = 14
  15859. const _NET_NF_CONNTRACK_LOG_INVALID = 15
  15860. const _NET_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS = 16
  15861. const _NET_NF_CONNTRACK_TCP_LOOSE = 17
  15862. const _NET_NF_CONNTRACK_TCP_BE_LIBERAL = 18
  15863. const _NET_NF_CONNTRACK_TCP_MAX_RETRANS = 19
  15864. const _NET_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED = 20
  15865. const _NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT = 21
  15866. const _NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED = 22
  15867. const _NET_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED = 23
  15868. const _NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT = 24
  15869. const _NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD = 25
  15870. const _NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT = 26
  15871. const _NET_NF_CONNTRACK_COUNT = 27
  15872. const _NET_NF_CONNTRACK_ICMPV6_TIMEOUT = 28
  15873. const _NET_NF_CONNTRACK_FRAG6_TIMEOUT = 29
  15874. const _NET_NF_CONNTRACK_FRAG6_LOW_THRESH = 30
  15875. const _NET_NF_CONNTRACK_FRAG6_HIGH_THRESH = 31
  15876. const _NET_NF_CONNTRACK_CHECKSUM = 32
  15877. const _NET_IPV4_FORWARD = 8
  15878. const _NET_IPV4_DYNADDR = 9
  15879. const _NET_IPV4_CONF = 16
  15880. const _NET_IPV4_NEIGH = 17
  15881. const _NET_IPV4_ROUTE = 18
  15882. const _NET_IPV4_FIB_HASH = 19
  15883. const _NET_IPV4_NETFILTER = 20
  15884. const _NET_IPV4_TCP_TIMESTAMPS = 33
  15885. const _NET_IPV4_TCP_WINDOW_SCALING = 34
  15886. const _NET_IPV4_TCP_SACK = 35
  15887. const _NET_IPV4_TCP_RETRANS_COLLAPSE = 36
  15888. const _NET_IPV4_DEFAULT_TTL = 37
  15889. const _NET_IPV4_AUTOCONFIG = 38
  15890. const _NET_IPV4_NO_PMTU_DISC = 39
  15891. const _NET_IPV4_TCP_SYN_RETRIES = 40
  15892. const _NET_IPV4_IPFRAG_HIGH_THRESH = 41
  15893. const _NET_IPV4_IPFRAG_LOW_THRESH = 42
  15894. const _NET_IPV4_IPFRAG_TIME = 43
  15895. const _NET_IPV4_TCP_MAX_KA_PROBES = 44
  15896. const _NET_IPV4_TCP_KEEPALIVE_TIME = 45
  15897. const _NET_IPV4_TCP_KEEPALIVE_PROBES = 46
  15898. const _NET_IPV4_TCP_RETRIES1 = 47
  15899. const _NET_IPV4_TCP_RETRIES2 = 48
  15900. const _NET_IPV4_TCP_FIN_TIMEOUT = 49
  15901. const _NET_IPV4_IP_MASQ_DEBUG = 50
  15902. const _NET_TCP_SYNCOOKIES = 51
  15903. const _NET_TCP_STDURG = 52
  15904. const _NET_TCP_RFC1337 = 53
  15905. const _NET_TCP_SYN_TAILDROP = 54
  15906. const _NET_TCP_MAX_SYN_BACKLOG = 55
  15907. const _NET_IPV4_LOCAL_PORT_RANGE = 56
  15908. const _NET_IPV4_ICMP_ECHO_IGNORE_ALL = 57
  15909. const _NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS = 58
  15910. const _NET_IPV4_ICMP_SOURCEQUENCH_RATE = 59
  15911. const _NET_IPV4_ICMP_DESTUNREACH_RATE = 60
  15912. const _NET_IPV4_ICMP_TIMEEXCEED_RATE = 61
  15913. const _NET_IPV4_ICMP_PARAMPROB_RATE = 62
  15914. const _NET_IPV4_ICMP_ECHOREPLY_RATE = 63
  15915. const _NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES = 64
  15916. const _NET_IPV4_IGMP_MAX_MEMBERSHIPS = 65
  15917. const _NET_TCP_TW_RECYCLE = 66
  15918. const _NET_IPV4_ALWAYS_DEFRAG = 67
  15919. const _NET_IPV4_TCP_KEEPALIVE_INTVL = 68
  15920. const _NET_IPV4_INET_PEER_THRESHOLD = 69
  15921. const _NET_IPV4_INET_PEER_MINTTL = 70
  15922. const _NET_IPV4_INET_PEER_MAXTTL = 71
  15923. const _NET_IPV4_INET_PEER_GC_MINTIME = 72
  15924. const _NET_IPV4_INET_PEER_GC_MAXTIME = 73
  15925. const _NET_TCP_ORPHAN_RETRIES = 74
  15926. const _NET_TCP_ABORT_ON_OVERFLOW = 75
  15927. const _NET_TCP_SYNACK_RETRIES = 76
  15928. const _NET_TCP_MAX_ORPHANS = 77
  15929. const _NET_TCP_MAX_TW_BUCKETS = 78
  15930. const _NET_TCP_FACK = 79
  15931. const _NET_TCP_REORDERING = 80
  15932. const _NET_TCP_ECN = 81
  15933. const _NET_TCP_DSACK = 82
  15934. const _NET_TCP_MEM = 83
  15935. const _NET_TCP_WMEM = 84
  15936. const _NET_TCP_RMEM = 85
  15937. const _NET_TCP_APP_WIN = 86
  15938. const _NET_TCP_ADV_WIN_SCALE = 87
  15939. const _NET_IPV4_NONLOCAL_BIND = 88
  15940. const _NET_IPV4_ICMP_RATELIMIT = 89
  15941. const _NET_IPV4_ICMP_RATEMASK = 90
  15942. const _NET_TCP_TW_REUSE = 91
  15943. const _NET_TCP_FRTO = 92
  15944. const _NET_TCP_LOW_LATENCY = 93
  15945. const _NET_IPV4_IPFRAG_SECRET_INTERVAL = 94
  15946. const _NET_IPV4_IGMP_MAX_MSF = 96
  15947. const _NET_TCP_NO_METRICS_SAVE = 97
  15948. const _NET_TCP_DEFAULT_WIN_SCALE = 105
  15949. const _NET_TCP_MODERATE_RCVBUF = 106
  15950. const _NET_TCP_TSO_WIN_DIVISOR = 107
  15951. const _NET_TCP_BIC_BETA = 108
  15952. const _NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR = 109
  15953. const _NET_TCP_CONG_CONTROL = 110
  15954. const _NET_TCP_ABC = 111
  15955. const _NET_IPV4_IPFRAG_MAX_DIST = 112
  15956. const _NET_TCP_MTU_PROBING = 113
  15957. const _NET_TCP_BASE_MSS = 114
  15958. const _NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS = 115
  15959. const _NET_TCP_DMA_COPYBREAK = 116
  15960. const _NET_TCP_SLOW_START_AFTER_IDLE = 117
  15961. const _NET_CIPSOV4_CACHE_ENABLE = 118
  15962. const _NET_CIPSOV4_CACHE_BUCKET_SIZE = 119
  15963. const _NET_CIPSOV4_RBM_OPTFMT = 120
  15964. const _NET_CIPSOV4_RBM_STRICTVALID = 121
  15965. const _NET_TCP_AVAIL_CONG_CONTROL = 122
  15966. const _NET_TCP_ALLOWED_CONG_CONTROL = 123
  15967. const _NET_TCP_MAX_SSTHRESH = 124
  15968. const _NET_TCP_FRTO_RESPONSE = 125
  15969. const _NET_IPV4_ROUTE_FLUSH = 1
  15970. const _NET_IPV4_ROUTE_MIN_DELAY = 2
  15971. const _NET_IPV4_ROUTE_MAX_DELAY = 3
  15972. const _NET_IPV4_ROUTE_GC_THRESH = 4
  15973. const _NET_IPV4_ROUTE_MAX_SIZE = 5
  15974. const _NET_IPV4_ROUTE_GC_MIN_INTERVAL = 6
  15975. const _NET_IPV4_ROUTE_GC_TIMEOUT = 7
  15976. const _NET_IPV4_ROUTE_GC_INTERVAL = 8
  15977. const _NET_IPV4_ROUTE_REDIRECT_LOAD = 9
  15978. const _NET_IPV4_ROUTE_REDIRECT_NUMBER = 10
  15979. const _NET_IPV4_ROUTE_REDIRECT_SILENCE = 11
  15980. const _NET_IPV4_ROUTE_ERROR_COST = 12
  15981. const _NET_IPV4_ROUTE_ERROR_BURST = 13
  15982. const _NET_IPV4_ROUTE_GC_ELASTICITY = 14
  15983. const _NET_IPV4_ROUTE_MTU_EXPIRES = 15
  15984. const _NET_IPV4_ROUTE_MIN_PMTU = 16
  15985. const _NET_IPV4_ROUTE_MIN_ADVMSS = 17
  15986. const _NET_IPV4_ROUTE_SECRET_INTERVAL = 18
  15987. const _NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS = 19
  15988. const _NET_PROTO_CONF_ALL = -2
  15989. const _NET_PROTO_CONF_DEFAULT = -3
  15990. const _NET_IPV4_CONF_FORWARDING = 1
  15991. const _NET_IPV4_CONF_MC_FORWARDING = 2
  15992. const _NET_IPV4_CONF_PROXY_ARP = 3
  15993. const _NET_IPV4_CONF_ACCEPT_REDIRECTS = 4
  15994. const _NET_IPV4_CONF_SECURE_REDIRECTS = 5
  15995. const _NET_IPV4_CONF_SEND_REDIRECTS = 6
  15996. const _NET_IPV4_CONF_SHARED_MEDIA = 7
  15997. const _NET_IPV4_CONF_RP_FILTER = 8
  15998. const _NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE = 9
  15999. const _NET_IPV4_CONF_BOOTP_RELAY = 10
  16000. const _NET_IPV4_CONF_LOG_MARTIANS = 11
  16001. const _NET_IPV4_CONF_TAG = 12
  16002. const _NET_IPV4_CONF_ARPFILTER = 13
  16003. const _NET_IPV4_CONF_MEDIUM_ID = 14
  16004. const _NET_IPV4_CONF_NOXFRM = 15
  16005. const _NET_IPV4_CONF_NOPOLICY = 16
  16006. const _NET_IPV4_CONF_FORCE_IGMP_VERSION = 17
  16007. const _NET_IPV4_CONF_ARP_ANNOUNCE = 18
  16008. const _NET_IPV4_CONF_ARP_IGNORE = 19
  16009. const _NET_IPV4_CONF_PROMOTE_SECONDARIES = 20
  16010. const _NET_IPV4_CONF_ARP_ACCEPT = 21
  16011. const _NET_IPV4_CONF_ARP_NOTIFY = 22
  16012. const _NET_IPV4_CONF_ARP_EVICT_NOCARRIER = 23
  16013. const _NET_IPV4_NF_CONNTRACK_MAX = 1
  16014. const _NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT = 2
  16015. const _NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV = 3
  16016. const _NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED = 4
  16017. const _NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT = 5
  16018. const _NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT = 6
  16019. const _NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK = 7
  16020. const _NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT = 8
  16021. const _NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE = 9
  16022. const _NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT = 10
  16023. const _NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT_STREAM = 11
  16024. const _NET_IPV4_NF_CONNTRACK_ICMP_TIMEOUT = 12
  16025. const _NET_IPV4_NF_CONNTRACK_GENERIC_TIMEOUT = 13
  16026. const _NET_IPV4_NF_CONNTRACK_BUCKETS = 14
  16027. const _NET_IPV4_NF_CONNTRACK_LOG_INVALID = 15
  16028. const _NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS = 16
  16029. const _NET_IPV4_NF_CONNTRACK_TCP_LOOSE = 17
  16030. const _NET_IPV4_NF_CONNTRACK_TCP_BE_LIBERAL = 18
  16031. const _NET_IPV4_NF_CONNTRACK_TCP_MAX_RETRANS = 19
  16032. const _NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED = 20
  16033. const _NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT = 21
  16034. const _NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED = 22
  16035. const _NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED = 23
  16036. const _NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT = 24
  16037. const _NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD = 25
  16038. const _NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT = 26
  16039. const _NET_IPV4_NF_CONNTRACK_COUNT = 27
  16040. const _NET_IPV4_NF_CONNTRACK_CHECKSUM = 28
  16041. const _NET_IPV6_CONF = 16
  16042. const _NET_IPV6_NEIGH = 17
  16043. const _NET_IPV6_ROUTE = 18
  16044. const _NET_IPV6_ICMP = 19
  16045. const _NET_IPV6_BINDV6ONLY = 20
  16046. const _NET_IPV6_IP6FRAG_HIGH_THRESH = 21
  16047. const _NET_IPV6_IP6FRAG_LOW_THRESH = 22
  16048. const _NET_IPV6_IP6FRAG_TIME = 23
  16049. const _NET_IPV6_IP6FRAG_SECRET_INTERVAL = 24
  16050. const _NET_IPV6_MLD_MAX_MSF = 25
  16051. const _NET_IPV6_ROUTE_FLUSH = 1
  16052. const _NET_IPV6_ROUTE_GC_THRESH = 2
  16053. const _NET_IPV6_ROUTE_MAX_SIZE = 3
  16054. const _NET_IPV6_ROUTE_GC_MIN_INTERVAL = 4
  16055. const _NET_IPV6_ROUTE_GC_TIMEOUT = 5
  16056. const _NET_IPV6_ROUTE_GC_INTERVAL = 6
  16057. const _NET_IPV6_ROUTE_GC_ELASTICITY = 7
  16058. const _NET_IPV6_ROUTE_MTU_EXPIRES = 8
  16059. const _NET_IPV6_ROUTE_MIN_ADVMSS = 9
  16060. const _NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS = 10
  16061. const _NET_IPV6_FORWARDING = 1
  16062. const _NET_IPV6_HOP_LIMIT = 2
  16063. const _NET_IPV6_MTU = 3
  16064. const _NET_IPV6_ACCEPT_RA = 4
  16065. const _NET_IPV6_ACCEPT_REDIRECTS = 5
  16066. const _NET_IPV6_AUTOCONF = 6
  16067. const _NET_IPV6_DAD_TRANSMITS = 7
  16068. const _NET_IPV6_RTR_SOLICITS = 8
  16069. const _NET_IPV6_RTR_SOLICIT_INTERVAL = 9
  16070. const _NET_IPV6_RTR_SOLICIT_DELAY = 10
  16071. const _NET_IPV6_USE_TEMPADDR = 11
  16072. const _NET_IPV6_TEMP_VALID_LFT = 12
  16073. const _NET_IPV6_TEMP_PREFERED_LFT = 13
  16074. const _NET_IPV6_REGEN_MAX_RETRY = 14
  16075. const _NET_IPV6_MAX_DESYNC_FACTOR = 15
  16076. const _NET_IPV6_MAX_ADDRESSES = 16
  16077. const _NET_IPV6_FORCE_MLD_VERSION = 17
  16078. const _NET_IPV6_ACCEPT_RA_DEFRTR = 18
  16079. const _NET_IPV6_ACCEPT_RA_PINFO = 19
  16080. const _NET_IPV6_ACCEPT_RA_RTR_PREF = 20
  16081. const _NET_IPV6_RTR_PROBE_INTERVAL = 21
  16082. const _NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN = 22
  16083. const _NET_IPV6_PROXY_NDP = 23
  16084. const _NET_IPV6_ACCEPT_SOURCE_ROUTE = 25
  16085. const _NET_IPV6_ACCEPT_RA_FROM_LOCAL = 26
  16086. const _NET_IPV6_ACCEPT_RA_RT_INFO_MIN_PLEN = 27
  16087. const _NET_IPV6_RA_DEFRTR_METRIC = 28
  16088. const ___NET_IPV6_MAX = 29
  16089. const _NET_IPV6_ICMP_RATELIMIT = 1
  16090. const _NET_IPV6_ICMP_ECHO_IGNORE_ALL = 2
  16091. const _NET_NEIGH_MCAST_SOLICIT = 1
  16092. const _NET_NEIGH_UCAST_SOLICIT = 2
  16093. const _NET_NEIGH_APP_SOLICIT = 3
  16094. const _NET_NEIGH_RETRANS_TIME = 4
  16095. const _NET_NEIGH_REACHABLE_TIME = 5
  16096. const _NET_NEIGH_DELAY_PROBE_TIME = 6
  16097. const _NET_NEIGH_GC_STALE_TIME = 7
  16098. const _NET_NEIGH_UNRES_QLEN = 8
  16099. const _NET_NEIGH_PROXY_QLEN = 9
  16100. const _NET_NEIGH_ANYCAST_DELAY = 10
  16101. const _NET_NEIGH_PROXY_DELAY = 11
  16102. const _NET_NEIGH_LOCKTIME = 12
  16103. const _NET_NEIGH_GC_INTERVAL = 13
  16104. const _NET_NEIGH_GC_THRESH1 = 14
  16105. const _NET_NEIGH_GC_THRESH2 = 15
  16106. const _NET_NEIGH_GC_THRESH3 = 16
  16107. const _NET_NEIGH_RETRANS_TIME_MS = 17
  16108. const _NET_NEIGH_REACHABLE_TIME_MS = 18
  16109. const _NET_NEIGH_INTERVAL_PROBE_TIME_MS = 19
  16110. const _NET_DCCP_DEFAULT = 1
  16111. const _NET_IPX_PPROP_BROADCASTING = 1
  16112. const _NET_IPX_FORWARDING = 2
  16113. const _NET_LLC2 = 1
  16114. const _NET_LLC_STATION = 2
  16115. const _NET_LLC2_TIMEOUT = 1
  16116. const _NET_LLC_STATION_ACK_TIMEOUT = 1
  16117. const _NET_LLC2_ACK_TIMEOUT = 1
  16118. const _NET_LLC2_P_TIMEOUT = 2
  16119. const _NET_LLC2_REJ_TIMEOUT = 3
  16120. const _NET_LLC2_BUSY_TIMEOUT = 4
  16121. const _NET_ATALK_AARP_EXPIRY_TIME = 1
  16122. const _NET_ATALK_AARP_TICK_TIME = 2
  16123. const _NET_ATALK_AARP_RETRANSMIT_LIMIT = 3
  16124. const _NET_ATALK_AARP_RESOLVE_TIME = 4
  16125. const _NET_NETROM_DEFAULT_PATH_QUALITY = 1
  16126. const _NET_NETROM_OBSOLESCENCE_COUNT_INITIALISER = 2
  16127. const _NET_NETROM_NETWORK_TTL_INITIALISER = 3
  16128. const _NET_NETROM_TRANSPORT_TIMEOUT = 4
  16129. const _NET_NETROM_TRANSPORT_MAXIMUM_TRIES = 5
  16130. const _NET_NETROM_TRANSPORT_ACKNOWLEDGE_DELAY = 6
  16131. const _NET_NETROM_TRANSPORT_BUSY_DELAY = 7
  16132. const _NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE = 8
  16133. const _NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT = 9
  16134. const _NET_NETROM_ROUTING_CONTROL = 10
  16135. const _NET_NETROM_LINK_FAILS_COUNT = 11
  16136. const _NET_NETROM_RESET = 12
  16137. const _NET_AX25_IP_DEFAULT_MODE = 1
  16138. const _NET_AX25_DEFAULT_MODE = 2
  16139. const _NET_AX25_BACKOFF_TYPE = 3
  16140. const _NET_AX25_CONNECT_MODE = 4
  16141. const _NET_AX25_STANDARD_WINDOW = 5
  16142. const _NET_AX25_EXTENDED_WINDOW = 6
  16143. const _NET_AX25_T1_TIMEOUT = 7
  16144. const _NET_AX25_T2_TIMEOUT = 8
  16145. const _NET_AX25_T3_TIMEOUT = 9
  16146. const _NET_AX25_IDLE_TIMEOUT = 10
  16147. const _NET_AX25_N2 = 11
  16148. const _NET_AX25_PACLEN = 12
  16149. const _NET_AX25_PROTOCOL = 13
  16150. const _NET_AX25_DAMA_SLAVE_TIMEOUT = 14
  16151. const _NET_ROSE_RESTART_REQUEST_TIMEOUT = 1
  16152. const _NET_ROSE_CALL_REQUEST_TIMEOUT = 2
  16153. const _NET_ROSE_RESET_REQUEST_TIMEOUT = 3
  16154. const _NET_ROSE_CLEAR_REQUEST_TIMEOUT = 4
  16155. const _NET_ROSE_ACK_HOLD_BACK_TIMEOUT = 5
  16156. const _NET_ROSE_ROUTING_CONTROL = 6
  16157. const _NET_ROSE_LINK_FAIL_TIMEOUT = 7
  16158. const _NET_ROSE_MAX_VCS = 8
  16159. const _NET_ROSE_WINDOW_SIZE = 9
  16160. const _NET_ROSE_NO_ACTIVITY_TIMEOUT = 10
  16161. const _NET_X25_RESTART_REQUEST_TIMEOUT = 1
  16162. const _NET_X25_CALL_REQUEST_TIMEOUT = 2
  16163. const _NET_X25_RESET_REQUEST_TIMEOUT = 3
  16164. const _NET_X25_CLEAR_REQUEST_TIMEOUT = 4
  16165. const _NET_X25_ACK_HOLD_BACK_TIMEOUT = 5
  16166. const _NET_X25_FORWARD = 6
  16167. const _NET_TR_RIF_TIMEOUT = 1
  16168. const _NET_DECNET_NODE_TYPE = 1
  16169. const _NET_DECNET_NODE_ADDRESS = 2
  16170. const _NET_DECNET_NODE_NAME = 3
  16171. const _NET_DECNET_DEFAULT_DEVICE = 4
  16172. const _NET_DECNET_TIME_WAIT = 5
  16173. const _NET_DECNET_DN_COUNT = 6
  16174. const _NET_DECNET_DI_COUNT = 7
  16175. const _NET_DECNET_DR_COUNT = 8
  16176. const _NET_DECNET_DST_GC_INTERVAL = 9
  16177. const _NET_DECNET_CONF = 10
  16178. const _NET_DECNET_NO_FC_MAX_CWND = 11
  16179. const _NET_DECNET_MEM = 12
  16180. const _NET_DECNET_RMEM = 13
  16181. const _NET_DECNET_WMEM = 14
  16182. const _NET_DECNET_DEBUG_LEVEL = 255
  16183. const _NET_DECNET_CONF_LOOPBACK = -2
  16184. const _NET_DECNET_CONF_DDCMP = -3
  16185. const _NET_DECNET_CONF_PPP = -4
  16186. const _NET_DECNET_CONF_X25 = -5
  16187. const _NET_DECNET_CONF_GRE = -6
  16188. const _NET_DECNET_CONF_ETHER = -7
  16189. const _NET_DECNET_CONF_DEV_PRIORITY = 1
  16190. const _NET_DECNET_CONF_DEV_T1 = 2
  16191. const _NET_DECNET_CONF_DEV_T2 = 3
  16192. const _NET_DECNET_CONF_DEV_T3 = 4
  16193. const _NET_DECNET_CONF_DEV_FORWARDING = 5
  16194. const _NET_DECNET_CONF_DEV_BLKSIZE = 6
  16195. const _NET_DECNET_CONF_DEV_STATE = 7
  16196. const _NET_SCTP_RTO_INITIAL = 1
  16197. const _NET_SCTP_RTO_MIN = 2
  16198. const _NET_SCTP_RTO_MAX = 3
  16199. const _NET_SCTP_RTO_ALPHA = 4
  16200. const _NET_SCTP_RTO_BETA = 5
  16201. const _NET_SCTP_VALID_COOKIE_LIFE = 6
  16202. const _NET_SCTP_ASSOCIATION_MAX_RETRANS = 7
  16203. const _NET_SCTP_PATH_MAX_RETRANS = 8
  16204. const _NET_SCTP_MAX_INIT_RETRANSMITS = 9
  16205. const _NET_SCTP_HB_INTERVAL = 10
  16206. const _NET_SCTP_PRESERVE_ENABLE = 11
  16207. const _NET_SCTP_MAX_BURST = 12
  16208. const _NET_SCTP_ADDIP_ENABLE = 13
  16209. const _NET_SCTP_PRSCTP_ENABLE = 14
  16210. const _NET_SCTP_SNDBUF_POLICY = 15
  16211. const _NET_SCTP_SACK_TIMEOUT = 16
  16212. const _NET_SCTP_RCVBUF_POLICY = 17
  16213. const _NET_BRIDGE_NF_CALL_ARPTABLES = 1
  16214. const _NET_BRIDGE_NF_CALL_IPTABLES = 2
  16215. const _NET_BRIDGE_NF_CALL_IP6TABLES = 3
  16216. const _NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4
  16217. const _NET_BRIDGE_NF_FILTER_PPPOE_TAGGED = 5
  16218. const _FS_NRINODE = 1
  16219. const _FS_STATINODE = 2
  16220. const _FS_MAXINODE = 3
  16221. const _FS_NRDQUOT = 4
  16222. const _FS_MAXDQUOT = 5
  16223. const _FS_NRFILE = 6
  16224. const _FS_MAXFILE = 7
  16225. const _FS_DENTRY = 8
  16226. const _FS_NRSUPER = 9
  16227. const _FS_MAXSUPER = 10
  16228. const _FS_OVERFLOWUID = 11
  16229. const _FS_OVERFLOWGID = 12
  16230. const _FS_LEASES = 13
  16231. const _FS_DIR_NOTIFY = 14
  16232. const _FS_LEASE_TIME = 15
  16233. const _FS_DQSTATS = 16
  16234. const _FS_XFS = 17
  16235. const _FS_AIO_NR = 18
  16236. const _FS_AIO_MAX_NR = 19
  16237. const _FS_INOTIFY = 20
  16238. const _FS_OCFS2 = 988
  16239. const _FS_DQ_LOOKUPS = 1
  16240. const _FS_DQ_DROPS = 2
  16241. const _FS_DQ_READS = 3
  16242. const _FS_DQ_WRITES = 4
  16243. const _FS_DQ_CACHE_HITS = 5
  16244. const _FS_DQ_ALLOCATED = 6
  16245. const _FS_DQ_FREE = 7
  16246. const _FS_DQ_SYNCS = 8
  16247. const _FS_DQ_WARNINGS = 9
  16248. const _DEV_CDROM = 1
  16249. const _DEV_HWMON = 2
  16250. const _DEV_PARPORT = 3
  16251. const _DEV_RAID = 4
  16252. const _DEV_MAC_HID = 5
  16253. const _DEV_SCSI = 6
  16254. const _DEV_IPMI = 7
  16255. const _DEV_CDROM_INFO = 1
  16256. const _DEV_CDROM_AUTOCLOSE = 2
  16257. const _DEV_CDROM_AUTOEJECT = 3
  16258. const _DEV_CDROM_DEBUG = 4
  16259. const _DEV_CDROM_LOCK = 5
  16260. const _DEV_CDROM_CHECK_MEDIA = 6
  16261. const _DEV_PARPORT_DEFAULT = -3
  16262. const _DEV_RAID_SPEED_LIMIT_MIN = 1
  16263. const _DEV_RAID_SPEED_LIMIT_MAX = 2
  16264. const _DEV_PARPORT_DEFAULT_TIMESLICE = 1
  16265. const _DEV_PARPORT_DEFAULT_SPINTIME = 2
  16266. const _DEV_PARPORT_SPINTIME = 1
  16267. const _DEV_PARPORT_BASE_ADDR = 2
  16268. const _DEV_PARPORT_IRQ = 3
  16269. const _DEV_PARPORT_DMA = 4
  16270. const _DEV_PARPORT_MODES = 5
  16271. const _DEV_PARPORT_DEVICES = 6
  16272. const _DEV_PARPORT_AUTOPROBE = 16
  16273. const _DEV_PARPORT_DEVICES_ACTIVE = -3
  16274. const _DEV_PARPORT_DEVICE_TIMESLICE = 1
  16275. const _DEV_MAC_HID_KEYBOARD_SENDS_LINUX_KEYCODES = 1
  16276. const _DEV_MAC_HID_KEYBOARD_LOCK_KEYCODES = 2
  16277. const _DEV_MAC_HID_MOUSE_BUTTON_EMULATION = 3
  16278. const _DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE = 4
  16279. const _DEV_MAC_HID_MOUSE_BUTTON3_KEYCODE = 5
  16280. const _DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES = 6
  16281. const _DEV_SCSI_LOGGING_LEVEL = 1
  16282. const _DEV_IPMI_POWEROFF_POWERCYCLE = 1
  16283. const _ABI_DEFHANDLER_COFF = 1
  16284. const _ABI_DEFHANDLER_ELF = 2
  16285. const _ABI_DEFHANDLER_LCALL7 = 3
  16286. const _ABI_DEFHANDLER_LIBCSO = 4
  16287. const _ABI_TRACE = 5
  16288. const _ABI_FAKE_UTSNAME = 6
  16289. type Tstatvfs = struct {
  16290. F__ccgo_align [0]uint32
  16291. Ff_bsize uint32
  16292. Ff_frsize uint32
  16293. Ff_blocks Tfsblkcnt_t
  16294. Ff_bfree Tfsblkcnt_t
  16295. Ff_bavail Tfsblkcnt_t
  16296. Ff_files Tfsfilcnt_t
  16297. Ff_ffree Tfsfilcnt_t
  16298. Ff_favail Tfsfilcnt_t
  16299. Ff_fsid uint32
  16300. F__ccgo60 uint32
  16301. Ff_flag uint32
  16302. Ff_namemax uint32
  16303. Ff_type uint32
  16304. F__reserved [5]int32
  16305. }
  16306. type TElf_Symndx = uint32
  16307. type Tdl_phdr_info = struct {
  16308. F__ccgo_align [0]uint32
  16309. Fdlpi_addr TElf32_Addr
  16310. Fdlpi_name uintptr
  16311. Fdlpi_phdr uintptr
  16312. Fdlpi_phnum TElf32_Half
  16313. F__ccgo_align4 [2]byte
  16314. Fdlpi_adds uint64
  16315. Fdlpi_subs uint64
  16316. Fdlpi_tls_modid Tsize_t
  16317. Fdlpi_tls_data uintptr
  16318. }
  16319. type Tlink_map = struct {
  16320. Fl_addr TElf32_Addr
  16321. Fl_name uintptr
  16322. Fl_ld uintptr
  16323. Fl_next uintptr
  16324. Fl_prev uintptr
  16325. }
  16326. type Tr_debug = struct {
  16327. Fr_version int32
  16328. Fr_map uintptr
  16329. Fr_brk TElf32_Addr
  16330. Fr_state int32
  16331. Fr_ldbase TElf32_Addr
  16332. }
  16333. const _RT_CONSISTENT = 0
  16334. const _RT_ADD = 1
  16335. const _RT_DELETE = 2
  16336. type TSHA2_CTX = struct {
  16337. F__ccgo_align [0]uint32
  16338. Fstate struct {
  16339. F__ccgo_align [0]uint32
  16340. Fst64 [0][8]Tuint64_t
  16341. Fst32 [8]Tuint32_t
  16342. F__ccgo_pad2 [32]byte
  16343. }
  16344. Fbitcount [2]Tuint64_t
  16345. Fbuffer [128]Tuint8_t
  16346. }
  16347. type T_SHA2_CTX = TSHA2_CTX
  16348. type TSHA512_CTX = struct {
  16349. F__ccgo_align [0]uint32
  16350. Fstate struct {
  16351. F__ccgo_align [0]uint32
  16352. Fst64 [0][8]Tuint64_t
  16353. Fst32 [8]Tuint32_t
  16354. F__ccgo_pad2 [32]byte
  16355. }
  16356. Fbitcount [2]Tuint64_t
  16357. Fbuffer [128]Tuint8_t
  16358. }
  16359. type TSHA384_CTX = struct {
  16360. F__ccgo_align [0]uint32
  16361. Fstate struct {
  16362. F__ccgo_align [0]uint32
  16363. Fst64 [0][8]Tuint64_t
  16364. Fst32 [8]Tuint32_t
  16365. F__ccgo_pad2 [32]byte
  16366. }
  16367. Fbitcount [2]Tuint64_t
  16368. Fbuffer [128]Tuint8_t
  16369. }
  16370. type Trand_pool_info = struct {
  16371. Fentropy_count int32
  16372. Fbuf_size int32
  16373. }
  16374. type Tvgetrandom_opaque_params = struct {
  16375. Fsize_of_opaque_state t__u32
  16376. Fmmap_prot t__u32
  16377. Fmmap_flags t__u32
  16378. Freserved [13]t__u32
  16379. }
  16380. type Tfsid_t = struct {
  16381. F__val [2]int32
  16382. }
  16383. type t__fsid_t = Tfsid_t
  16384. type Tstatfs = struct {
  16385. F__ccgo_align [0]uint32
  16386. Ff_type uint32
  16387. Ff_bsize uint32
  16388. Ff_blocks Tfsblkcnt_t
  16389. Ff_bfree Tfsblkcnt_t
  16390. Ff_bavail Tfsblkcnt_t
  16391. Ff_files Tfsfilcnt_t
  16392. Ff_ffree Tfsfilcnt_t
  16393. Ff_fsid Tfsid_t
  16394. Ff_namelen uint32
  16395. Ff_frsize uint32
  16396. Ff_flags uint32
  16397. Ff_spare [4]uint32
  16398. F__ccgo_pad12 [4]byte
  16399. }
  16400. func Xgetentropy(tls *libc.TLS, buf uintptr, len1 Tsize_t) (r int32) {
  16401. var ret int32
  16402. _ = ret
  16403. ret = -int32(1)
  16404. if len1 > uint32(256) {
  16405. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EIO)
  16406. return -int32(1)
  16407. }
  16408. /*
  16409. * Try descriptor-less getrandom(), in non-blocking mode.
  16410. *
  16411. * The design of Linux getrandom is broken. It has an
  16412. * uninitialized phase coupled with blocking behaviour, which
  16413. * is unacceptable from within a library at boot time without
  16414. * possible recovery. See http://bugs.python.org/issue26839#msg267745
  16415. */
  16416. ret = _getentropy_getrandom(tls, buf, len1)
  16417. if ret != -int32(1) {
  16418. return ret
  16419. }
  16420. /*
  16421. * Try to get entropy with /dev/urandom
  16422. *
  16423. * This can fail if the process is inside a chroot or if file
  16424. * descriptors are exhausted.
  16425. */
  16426. ret = _getentropy_urandom(tls, buf, len1)
  16427. if ret != -int32(1) {
  16428. return ret
  16429. }
  16430. /*
  16431. * Try to use sysctl CTL_KERN, KERN_RANDOM, RANDOM_UUID.
  16432. * sysctl is a failsafe API, so it guarantees a result. This
  16433. * should work inside a chroot, or when file descriptors are
  16434. * exhausted.
  16435. *
  16436. * However this can fail if the Linux kernel removes support
  16437. * for sysctl. Starting in 2007, there have been efforts to
  16438. * deprecate the sysctl API/ABI, and push callers towards use
  16439. * of the chroot-unavailable fd-using /proc mechanism --
  16440. * essentially the same problems as /dev/urandom.
  16441. *
  16442. * Numerous setbacks have been encountered in their deprecation
  16443. * schedule, so as of June 2014 the kernel ABI still exists on
  16444. * most Linux architectures. The sysctl() stub in libc is missing
  16445. * on some systems. There are also reports that some kernels
  16446. * spew messages to the console.
  16447. */
  16448. ret = _getentropy_sysctl(tls, buf, len1)
  16449. if ret != -int32(1) {
  16450. return ret
  16451. }
  16452. /*
  16453. * Entropy collection via /dev/urandom and sysctl have failed.
  16454. *
  16455. * No other API exists for collecting entropy. See the large
  16456. * comment block above.
  16457. *
  16458. * We have very few options:
  16459. * - Even syslog_r is unsafe to call at this low level, so
  16460. * there is no way to alert the user or program.
  16461. * - Cannot call abort() because some systems have unsafe
  16462. * corefiles.
  16463. * - Could raise(SIGKILL) resulting in silent program termination.
  16464. * - Return EIO, to hint that arc4random's stir function
  16465. * should raise(SIGKILL)
  16466. * - Do the best under the circumstances....
  16467. *
  16468. * This code path exists to bring light to the issue that Linux
  16469. * still does not provide a failsafe API for entropy collection.
  16470. *
  16471. * We hope this demonstrates that Linux should either retain their
  16472. * sysctl ABI, or consider providing a new failsafe API which
  16473. * works in a chroot or when file descriptors are exhausted.
  16474. */
  16475. ret = _getentropy_fallback(tls, buf, len1)
  16476. if ret != -int32(1) {
  16477. return ret
  16478. }
  16479. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EIO)
  16480. return ret
  16481. }
  16482. // C documentation
  16483. //
  16484. // /*
  16485. // * Basic sanity checking; wish we could do better.
  16486. // */
  16487. func _gotdata(tls *libc.TLS, buf uintptr, len1 Tsize_t) (r int32) {
  16488. var any_set uint8
  16489. var i Tsize_t
  16490. _, _ = any_set, i
  16491. any_set = uint8(0)
  16492. i = uint32(0)
  16493. for {
  16494. if !(i < len1) {
  16495. break
  16496. }
  16497. any_set = uint8(int32(any_set) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(buf + uintptr(i)))))
  16498. goto _1
  16499. _1:
  16500. ;
  16501. i++
  16502. }
  16503. if libc.Int32FromUint8(any_set) == 0 {
  16504. return -int32(1)
  16505. }
  16506. return 0
  16507. }
  16508. func _getentropy_getrandom(tls *libc.TLS, buf uintptr, len1 Tsize_t) (r int32) {
  16509. bp := tls.Alloc(32)
  16510. defer tls.Free(32)
  16511. var pre_errno, ret int32
  16512. _, _ = pre_errno, ret
  16513. pre_errno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  16514. if len1 > uint32(256) {
  16515. return -int32(1)
  16516. }
  16517. for cond := true; cond; cond = ret == -int32(1) && *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EINTR) {
  16518. ret = int32(libc.Xsyscall(tls, int32(m_SYS_getrandom), libc.VaList(bp+8, buf, len1, int32(m_GRND_NONBLOCK))))
  16519. }
  16520. if ret != libc.Int32FromUint32(len1) {
  16521. return -int32(1)
  16522. }
  16523. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = pre_errno
  16524. return 0
  16525. }
  16526. func _getentropy_urandom(tls *libc.TLS, buf uintptr, len1 Tsize_t) (r int32) {
  16527. bp := tls.Alloc(176)
  16528. defer tls.Free(176)
  16529. var fd, flags, save_errno int32
  16530. var i, wanted Tsize_t
  16531. var ret Tssize_t
  16532. var _ /* cnt at bp+152 */ int32
  16533. var _ /* st at bp+0 */ Tstat
  16534. _, _, _, _, _, _ = fd, flags, i, ret, save_errno, wanted
  16535. save_errno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  16536. goto start
  16537. start:
  16538. ;
  16539. flags = m_O_RDONLY3
  16540. flags |= int32(m_O_NOFOLLOW1)
  16541. flags |= int32(m_O_CLOEXEC1)
  16542. fd = libc.Xopen(tls, __ccgo_ts+651, flags, libc.VaList(bp+168, 0))
  16543. if fd == -int32(1) {
  16544. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EINTR) {
  16545. goto start
  16546. }
  16547. goto nodevrandom
  16548. }
  16549. /* Lightly verify that the device node looks sane */
  16550. if libc.Xfstat(tls, fd, bp) == -int32(1) || !((*(*Tstat)(unsafe.Pointer(bp))).Fst_mode&libc.Uint32FromInt32(m_S_IFMT3) == libc.Uint32FromInt32(m_S_IFCHR3)) {
  16551. libc.Xclose(tls, fd)
  16552. goto nodevrandom
  16553. }
  16554. if libc.Xioctl(tls, fd, libc.Int32FromUint32(libc.Uint32FromUint32(2)<<(libc.Int32FromInt32(m__IOC_NRSHIFT)+libc.Int32FromInt32(m__IOC_NRBITS)+libc.Int32FromInt32(m__IOC_TYPEBITS)+libc.Int32FromInt32(m__IOC_SIZEBITS))|libc.Uint32FromInt32(libc.Int32FromUint8('R')<<(libc.Int32FromInt32(m__IOC_NRSHIFT)+libc.Int32FromInt32(m__IOC_NRBITS)))|libc.Uint32FromInt32(libc.Int32FromInt32(0x00)<<libc.Int32FromInt32(m__IOC_NRSHIFT))|libc.Uint32FromInt64(4)<<(libc.Int32FromInt32(m__IOC_NRSHIFT)+libc.Int32FromInt32(m__IOC_NRBITS)+libc.Int32FromInt32(m__IOC_TYPEBITS))), libc.VaList(bp+168, bp+152)) == -int32(1) {
  16555. libc.Xclose(tls, fd)
  16556. goto nodevrandom
  16557. }
  16558. i = uint32(0)
  16559. for {
  16560. if !(i < len1) {
  16561. break
  16562. }
  16563. wanted = len1 - i
  16564. ret = libc.Xread(tls, fd, buf+uintptr(i), wanted)
  16565. if ret == -int32(1) {
  16566. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EAGAIN) || *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EINTR) {
  16567. goto _1
  16568. }
  16569. libc.Xclose(tls, fd)
  16570. goto nodevrandom
  16571. }
  16572. i += libc.Uint32FromInt32(ret)
  16573. goto _1
  16574. _1:
  16575. }
  16576. libc.Xclose(tls, fd)
  16577. if _gotdata(tls, buf, len1) == 0 {
  16578. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = save_errno
  16579. return 0 /* satisfied */
  16580. }
  16581. goto nodevrandom
  16582. nodevrandom:
  16583. ;
  16584. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EIO)
  16585. return -int32(1)
  16586. }
  16587. func _getentropy_sysctl(tls *libc.TLS, buf uintptr, len1 Tsize_t) (r int32) {
  16588. bp := tls.Alloc(64)
  16589. defer tls.Free(64)
  16590. var i Tsize_t
  16591. var save_errno int32
  16592. var v2 uint32
  16593. var _ /* args at bp+4 */ t__sysctl_args
  16594. var _ /* chunk at bp+0 */ Tsize_t
  16595. _, _, _ = i, save_errno, v2
  16596. save_errno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  16597. i = uint32(0)
  16598. for {
  16599. if !(i < len1) {
  16600. break
  16601. }
  16602. if len1-i < libc.Uint32FromInt32(libc.Int32FromInt32(16)) {
  16603. v2 = len1 - i
  16604. } else {
  16605. v2 = libc.Uint32FromInt32(libc.Int32FromInt32(16))
  16606. }
  16607. *(*Tsize_t)(unsafe.Pointer(bp)) = v2
  16608. /* SYS__sysctl because some systems already removed sysctl() */
  16609. *(*t__sysctl_args)(unsafe.Pointer(bp + 4)) = t__sysctl_args{
  16610. Fname: uintptr(unsafe.Pointer(&_mib)),
  16611. Fnlen: int32(3),
  16612. Foldval: buf + uintptr(i),
  16613. Foldlenp: bp,
  16614. }
  16615. if libc.Xsyscall(tls, int32(m_SYS__sysctl), libc.VaList(bp+56, bp+4)) != 0 {
  16616. goto sysctlfailed
  16617. }
  16618. i += *(*Tsize_t)(unsafe.Pointer(bp))
  16619. goto _1
  16620. _1:
  16621. }
  16622. if _gotdata(tls, buf, len1) == 0 {
  16623. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = save_errno
  16624. return 0 /* satisfied */
  16625. }
  16626. goto sysctlfailed
  16627. sysctlfailed:
  16628. ;
  16629. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EIO)
  16630. return -int32(1)
  16631. }
  16632. var _mib = [3]int32{
  16633. 0: int32(_CTL_KERN),
  16634. 1: int32(_KERN_RANDOM),
  16635. 2: int32(_RANDOM_UUID),
  16636. }
  16637. var _cl = [6]int32{
  16638. 1: int32(m_CLOCK_MONOTONIC),
  16639. 2: int32(m_CLOCK_MONOTONIC_RAW),
  16640. 3: int32(m_CLOCK_TAI),
  16641. 4: int32(m_CLOCK_PROCESS_CPUTIME_ID),
  16642. 5: int32(m_CLOCK_THREAD_CPUTIME_ID),
  16643. }
  16644. func _getentropy_phdr(tls *libc.TLS, info uintptr, size Tsize_t, data uintptr) (r int32) {
  16645. var ctx uintptr
  16646. _ = ctx
  16647. ctx = data
  16648. libmd.XSHA512Update(tls, ctx, info, uint32(4))
  16649. return 0
  16650. }
  16651. func _getentropy_fallback(tls *libc.TLS, buf uintptr, len1 Tsize_t) (r int32) {
  16652. bp := tls.Alloc(1248)
  16653. defer tls.Free(1248)
  16654. var faster, j, pgs, repeat, save_errno, v13, v14, v16, v18, v19, v3, v9 int32
  16655. var i, ii, m, mo Tsize_t
  16656. var v11 uintptr
  16657. var v17 Toff_t
  16658. var v20, v21 uint32
  16659. var v5, v6, v7, v8 Tpid_t
  16660. var _ /* ctx at bp+536 */ TSHA512_CTX
  16661. var _ /* e at bp+64 */ int32
  16662. var _ /* mm at bp+1144 */ [12]struct {
  16663. Fnpg Tsize_t
  16664. Fp uintptr
  16665. }
  16666. var _ /* off at bp+1136 */ Toff_t
  16667. var _ /* p at bp+748 */ uintptr
  16668. var _ /* pid at bp+744 */ Tpid_t
  16669. var _ /* results at bp+0 */ [64]Tuint8_t
  16670. var _ /* ru at bp+104 */ Trusage
  16671. var _ /* sigset at bp+256 */ Tsigset_t
  16672. var _ /* ss at bp+752 */ Tsockaddr_storage
  16673. var _ /* ssl at bp+1128 */ Tsocklen_t
  16674. var _ /* st at bp+384 */ Tstat
  16675. var _ /* stfs at bp+1040 */ Tstatfs
  16676. var _ /* stvfs at bp+880 */ Tstatvfs
  16677. var _ /* tios at bp+976 */ Ttermios
  16678. var _ /* ts at bp+72 */ Ttimespec
  16679. var _ /* tv at bp+88 */ Ttimeval
  16680. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = faster, i, ii, j, m, mo, pgs, repeat, save_errno, v11, v13, v14, v16, v17, v18, v19, v20, v21, v3, v5, v6, v7, v8, v9
  16681. save_errno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  16682. pgs = libc.Xgetpagesize(tls)
  16683. faster = 0
  16684. *(*Tpid_t)(unsafe.Pointer(bp + 744)) = libc.Xgetpid(tls)
  16685. if _lastpid == *(*Tpid_t)(unsafe.Pointer(bp + 744)) {
  16686. faster = int32(1)
  16687. repeat = int32(2)
  16688. } else {
  16689. faster = 0
  16690. _lastpid = *(*Tpid_t)(unsafe.Pointer(bp + 744))
  16691. repeat = int32(m_REPEAT)
  16692. }
  16693. i = uint32(0)
  16694. for {
  16695. if !(i < len1) {
  16696. break
  16697. }
  16698. libmd.XSHA512Init(tls, bp+536)
  16699. j = 0
  16700. for {
  16701. if !(j < repeat) {
  16702. break
  16703. }
  16704. v3 = libc.Xgettimeofday(tls, bp+88, libc.UintptrFromInt32(0))
  16705. *(*int32)(unsafe.Pointer(bp + 64)) = v3
  16706. if v3 == -int32(1) {
  16707. libmd.XSHA512Update(tls, bp+536, libc.X__errno_location(tls), uint32(4))
  16708. } else {
  16709. libmd.XSHA512Update(tls, bp+536, bp+88, uint32(16))
  16710. }
  16711. if *(*int32)(unsafe.Pointer(bp + 64)) != -int32(1) {
  16712. _cnt += int32((*(*Ttimeval)(unsafe.Pointer(bp + 88))).Ftv_sec)
  16713. _cnt += int32((*(*Ttimeval)(unsafe.Pointer(bp + 88))).Ftv_usec)
  16714. }
  16715. _dl_iterate_phdr(tls, __ccgo_fp(_getentropy_phdr), bp+536)
  16716. ii = uint32(0)
  16717. for {
  16718. if !(ii < libc.Uint32FromInt64(24)/libc.Uint32FromInt64(4)) {
  16719. break
  16720. }
  16721. if libc.Xclock_gettime(tls, _cl[ii], bp+72) == -int32(1) {
  16722. libmd.XSHA512Update(tls, bp+536, libc.X__errno_location(tls), uint32(4))
  16723. } else {
  16724. libmd.XSHA512Update(tls, bp+536, bp+72, uint32(16))
  16725. }
  16726. goto _4
  16727. _4:
  16728. ;
  16729. ii++
  16730. }
  16731. v5 = libc.Xgetpid(tls)
  16732. *(*Tpid_t)(unsafe.Pointer(bp + 744)) = v5
  16733. if v5 == -int32(1) {
  16734. libmd.XSHA512Update(tls, bp+536, libc.X__errno_location(tls), uint32(4))
  16735. } else {
  16736. libmd.XSHA512Update(tls, bp+536, bp+744, uint32(4))
  16737. }
  16738. v6 = libc.Xgetsid(tls, *(*Tpid_t)(unsafe.Pointer(bp + 744)))
  16739. *(*Tpid_t)(unsafe.Pointer(bp + 744)) = v6
  16740. if v6 == -int32(1) {
  16741. libmd.XSHA512Update(tls, bp+536, libc.X__errno_location(tls), uint32(4))
  16742. } else {
  16743. libmd.XSHA512Update(tls, bp+536, bp+744, uint32(4))
  16744. }
  16745. v7 = libc.Xgetppid(tls)
  16746. *(*Tpid_t)(unsafe.Pointer(bp + 744)) = v7
  16747. if v7 == -int32(1) {
  16748. libmd.XSHA512Update(tls, bp+536, libc.X__errno_location(tls), uint32(4))
  16749. } else {
  16750. libmd.XSHA512Update(tls, bp+536, bp+744, uint32(4))
  16751. }
  16752. v8 = libc.Xgetpgid(tls, 0)
  16753. *(*Tpid_t)(unsafe.Pointer(bp + 744)) = v8
  16754. if v8 == -int32(1) {
  16755. libmd.XSHA512Update(tls, bp+536, libc.X__errno_location(tls), uint32(4))
  16756. } else {
  16757. libmd.XSHA512Update(tls, bp+536, bp+744, uint32(4))
  16758. }
  16759. v9 = libc.Xgetpriority(tls, 0, uint32(0))
  16760. *(*int32)(unsafe.Pointer(bp + 64)) = v9
  16761. if v9 == -int32(1) {
  16762. libmd.XSHA512Update(tls, bp+536, libc.X__errno_location(tls), uint32(4))
  16763. } else {
  16764. libmd.XSHA512Update(tls, bp+536, bp+64, uint32(4))
  16765. }
  16766. if !(faster != 0) {
  16767. (*(*Ttimespec)(unsafe.Pointer(bp + 72))).Ftv_sec = 0
  16768. (*(*Ttimespec)(unsafe.Pointer(bp + 72))).Ftv_nsec = int32(1)
  16769. libc.Xnanosleep(tls, bp+72, libc.UintptrFromInt32(0))
  16770. }
  16771. if libc.Xsigpending(tls, bp+256) == -int32(1) {
  16772. libmd.XSHA512Update(tls, bp+536, libc.X__errno_location(tls), uint32(4))
  16773. } else {
  16774. libmd.XSHA512Update(tls, bp+536, bp+256, uint32(128))
  16775. }
  16776. if libc.Xsigprocmask(tls, m_SIG_BLOCK, libc.UintptrFromInt32(0), bp+256) == -int32(1) {
  16777. libmd.XSHA512Update(tls, bp+536, libc.X__errno_location(tls), uint32(4))
  16778. } else {
  16779. libmd.XSHA512Update(tls, bp+536, bp+256, uint32(128))
  16780. }
  16781. libmd.XSHA512Update(tls, bp+536, __ccgo_fp(Xgetentropy), uint32(4)) /* an addr in this library */
  16782. libmd.XSHA512Update(tls, bp+536, __ccgo_fp(libc.Xprintf), uint32(4)) /* an addr in libc */
  16783. *(*uintptr)(unsafe.Pointer(bp + 748)) = bp + 748
  16784. libmd.XSHA512Update(tls, bp+536, bp+748, uint32(4)) /* an addr on stack */
  16785. *(*uintptr)(unsafe.Pointer(bp + 748)) = libc.X__errno_location(tls)
  16786. libmd.XSHA512Update(tls, bp+536, bp+748, uint32(4)) /* the addr of errno */
  16787. if i == uint32(0) {
  16788. /*
  16789. * Prime-sized mappings encourage fragmentation;
  16790. * thus exposing some address entropy.
  16791. */
  16792. *(*[12]struct {
  16793. Fnpg Tsize_t
  16794. Fp uintptr
  16795. })(unsafe.Pointer(bp + 1144)) = [12]struct {
  16796. Fnpg Tsize_t
  16797. Fp uintptr
  16798. }{
  16799. 0: {
  16800. Fnpg: uint32(17),
  16801. Fp: uintptr(-libc.Int32FromInt32(1)),
  16802. },
  16803. 1: {
  16804. Fnpg: uint32(3),
  16805. Fp: uintptr(-libc.Int32FromInt32(1)),
  16806. },
  16807. 2: {
  16808. Fnpg: uint32(11),
  16809. Fp: uintptr(-libc.Int32FromInt32(1)),
  16810. },
  16811. 3: {
  16812. Fnpg: uint32(2),
  16813. Fp: uintptr(-libc.Int32FromInt32(1)),
  16814. },
  16815. 4: {
  16816. Fnpg: uint32(5),
  16817. Fp: uintptr(-libc.Int32FromInt32(1)),
  16818. },
  16819. 5: {
  16820. Fnpg: uint32(3),
  16821. Fp: uintptr(-libc.Int32FromInt32(1)),
  16822. },
  16823. 6: {
  16824. Fnpg: uint32(7),
  16825. Fp: uintptr(-libc.Int32FromInt32(1)),
  16826. },
  16827. 7: {
  16828. Fnpg: uint32(1),
  16829. Fp: uintptr(-libc.Int32FromInt32(1)),
  16830. },
  16831. 8: {
  16832. Fnpg: uint32(57),
  16833. Fp: uintptr(-libc.Int32FromInt32(1)),
  16834. },
  16835. 9: {
  16836. Fnpg: uint32(3),
  16837. Fp: uintptr(-libc.Int32FromInt32(1)),
  16838. },
  16839. 10: {
  16840. Fnpg: uint32(131),
  16841. Fp: uintptr(-libc.Int32FromInt32(1)),
  16842. },
  16843. 11: {
  16844. Fnpg: uint32(1),
  16845. Fp: uintptr(-libc.Int32FromInt32(1)),
  16846. },
  16847. }
  16848. m = uint32(0)
  16849. for {
  16850. if !(m < libc.Uint32FromInt64(96)/libc.Uint32FromInt64(8)) {
  16851. break
  16852. }
  16853. v11 = libc.Xmmap(tls, libc.UintptrFromInt32(0), (*(*[12]struct {
  16854. Fnpg Tsize_t
  16855. Fp uintptr
  16856. })(unsafe.Pointer(bp + 1144)))[m].Fnpg*libc.Uint32FromInt32(pgs), libc.Int32FromInt32(m_PROT_READ)|libc.Int32FromInt32(m_PROT_WRITE), libc.Int32FromInt32(m_MAP_PRIVATE2)|libc.Int32FromInt32(m_MAP_ANON2), -int32(1), libc.Int64FromInt32(0))
  16857. (*(*[12]struct {
  16858. Fnpg Tsize_t
  16859. Fp uintptr
  16860. })(unsafe.Pointer(bp + 1144)))[m].Fp = v11
  16861. if v11 != 0 {
  16862. libmd.XSHA512Update(tls, bp+536, libc.X__errno_location(tls), uint32(4))
  16863. } else {
  16864. libmd.XSHA512Update(tls, bp+536, bp+1144+uintptr(m)*8+4, uint32(4))
  16865. }
  16866. if (*(*[12]struct {
  16867. Fnpg Tsize_t
  16868. Fp uintptr
  16869. })(unsafe.Pointer(bp + 1144)))[m].Fp != uintptr(-libc.Int32FromInt32(1)) {
  16870. /* Touch some memory... */
  16871. *(*uintptr)(unsafe.Pointer(bp + 748)) = (*(*[12]struct {
  16872. Fnpg Tsize_t
  16873. Fp uintptr
  16874. })(unsafe.Pointer(bp + 1144)))[m].Fp
  16875. mo = libc.Uint32FromInt32(_cnt) % ((*(*[12]struct {
  16876. Fnpg Tsize_t
  16877. Fp uintptr
  16878. })(unsafe.Pointer(bp + 1144)))[m].Fnpg*libc.Uint32FromInt32(pgs) - uint32(1))
  16879. *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 748)) + uintptr(mo))) = uint8(1)
  16880. _cnt += int32((*(*[12]struct {
  16881. Fnpg Tsize_t
  16882. Fp uintptr
  16883. })(unsafe.Pointer(bp + 1144)))[m].Fp) / pgs
  16884. }
  16885. /* Check cnts and times... */
  16886. ii = uint32(0)
  16887. for {
  16888. if !(ii < libc.Uint32FromInt64(24)/libc.Uint32FromInt64(4)) {
  16889. break
  16890. }
  16891. v13 = libc.Xclock_gettime(tls, _cl[ii], bp+72)
  16892. *(*int32)(unsafe.Pointer(bp + 64)) = v13
  16893. if v13 == -int32(1) {
  16894. libmd.XSHA512Update(tls, bp+536, libc.X__errno_location(tls), uint32(4))
  16895. } else {
  16896. libmd.XSHA512Update(tls, bp+536, bp+72, uint32(16))
  16897. }
  16898. if *(*int32)(unsafe.Pointer(bp + 64)) != -int32(1) {
  16899. _cnt += (*(*Ttimespec)(unsafe.Pointer(bp + 72))).Ftv_nsec
  16900. }
  16901. goto _12
  16902. _12:
  16903. ;
  16904. ii++
  16905. }
  16906. v14 = libc.Xgetrusage(tls, m_RUSAGE_SELF, bp+104)
  16907. *(*int32)(unsafe.Pointer(bp + 64)) = v14
  16908. if v14 == -int32(1) {
  16909. libmd.XSHA512Update(tls, bp+536, libc.X__errno_location(tls), uint32(4))
  16910. } else {
  16911. libmd.XSHA512Update(tls, bp+536, bp+104, uint32(152))
  16912. }
  16913. if *(*int32)(unsafe.Pointer(bp + 64)) != -int32(1) {
  16914. _cnt += int32((*(*Trusage)(unsafe.Pointer(bp + 104))).Fru_utime.Ftv_sec)
  16915. _cnt += int32((*(*Trusage)(unsafe.Pointer(bp + 104))).Fru_utime.Ftv_usec)
  16916. }
  16917. goto _10
  16918. _10:
  16919. ;
  16920. m++
  16921. }
  16922. m = uint32(0)
  16923. for {
  16924. if !(m < libc.Uint32FromInt64(96)/libc.Uint32FromInt64(8)) {
  16925. break
  16926. }
  16927. if (*(*[12]struct {
  16928. Fnpg Tsize_t
  16929. Fp uintptr
  16930. })(unsafe.Pointer(bp + 1144)))[m].Fp != uintptr(-libc.Int32FromInt32(1)) {
  16931. libc.Xmunmap(tls, (*(*[12]struct {
  16932. Fnpg Tsize_t
  16933. Fp uintptr
  16934. })(unsafe.Pointer(bp + 1144)))[m].Fp, (*(*[12]struct {
  16935. Fnpg Tsize_t
  16936. Fp uintptr
  16937. })(unsafe.Pointer(bp + 1144)))[m].Fnpg*libc.Uint32FromInt32(pgs))
  16938. }
  16939. (*(*[12]struct {
  16940. Fnpg Tsize_t
  16941. Fp uintptr
  16942. })(unsafe.Pointer(bp + 1144)))[m].Fp = uintptr(-libc.Int32FromInt32(1))
  16943. goto _15
  16944. _15:
  16945. ;
  16946. m++
  16947. }
  16948. if libc.Xstat(tls, __ccgo_ts+664, bp+384) == -int32(1) {
  16949. libmd.XSHA512Update(tls, bp+536, libc.X__errno_location(tls), uint32(4))
  16950. } else {
  16951. libmd.XSHA512Update(tls, bp+536, bp+384, uint32(152))
  16952. }
  16953. if libc.Xstatvfs(tls, __ccgo_ts+664, bp+880) == -int32(1) {
  16954. libmd.XSHA512Update(tls, bp+536, libc.X__errno_location(tls), uint32(4))
  16955. } else {
  16956. libmd.XSHA512Update(tls, bp+536, bp+880, uint32(96))
  16957. }
  16958. if _statfs(tls, __ccgo_ts+664, bp+1040) == -int32(1) {
  16959. libmd.XSHA512Update(tls, bp+536, libc.X__errno_location(tls), uint32(4))
  16960. } else {
  16961. libmd.XSHA512Update(tls, bp+536, bp+1040, uint32(88))
  16962. }
  16963. if libc.Xstat(tls, __ccgo_ts+666, bp+384) == -int32(1) {
  16964. libmd.XSHA512Update(tls, bp+536, libc.X__errno_location(tls), uint32(4))
  16965. } else {
  16966. libmd.XSHA512Update(tls, bp+536, bp+384, uint32(152))
  16967. }
  16968. if libc.Xstatvfs(tls, __ccgo_ts+666, bp+880) == -int32(1) {
  16969. libmd.XSHA512Update(tls, bp+536, libc.X__errno_location(tls), uint32(4))
  16970. } else {
  16971. libmd.XSHA512Update(tls, bp+536, bp+880, uint32(96))
  16972. }
  16973. if _statfs(tls, __ccgo_ts+666, bp+1040) == -int32(1) {
  16974. libmd.XSHA512Update(tls, bp+536, libc.X__errno_location(tls), uint32(4))
  16975. } else {
  16976. libmd.XSHA512Update(tls, bp+536, bp+1040, uint32(88))
  16977. }
  16978. v16 = libc.Xfstat(tls, 0, bp+384)
  16979. *(*int32)(unsafe.Pointer(bp + 64)) = v16
  16980. if v16 == -int32(1) {
  16981. libmd.XSHA512Update(tls, bp+536, libc.X__errno_location(tls), uint32(4))
  16982. } else {
  16983. libmd.XSHA512Update(tls, bp+536, bp+384, uint32(152))
  16984. }
  16985. if *(*int32)(unsafe.Pointer(bp + 64)) == -int32(1) {
  16986. if (*(*Tstat)(unsafe.Pointer(bp + 384))).Fst_mode&uint32(m_S_IFMT3) == uint32(m_S_IFREG3) || (*(*Tstat)(unsafe.Pointer(bp + 384))).Fst_mode&uint32(m_S_IFMT3) == uint32(m_S_IFIFO3) || (*(*Tstat)(unsafe.Pointer(bp + 384))).Fst_mode&uint32(m_S_IFMT3) == uint32(m_S_IFSOCK3) {
  16987. if libc.Xfstatvfs(tls, 0, bp+880) == -int32(1) {
  16988. libmd.XSHA512Update(tls, bp+536, libc.X__errno_location(tls), uint32(4))
  16989. } else {
  16990. libmd.XSHA512Update(tls, bp+536, bp+880, uint32(96))
  16991. }
  16992. if libc.Xfstatfs(tls, 0, bp+1040) == -int32(1) {
  16993. libmd.XSHA512Update(tls, bp+536, libc.X__errno_location(tls), uint32(4))
  16994. } else {
  16995. libmd.XSHA512Update(tls, bp+536, bp+1040, uint32(88))
  16996. }
  16997. v17 = libc.Xlseek(tls, 0, libc.Int64FromInt32(0), int32(1))
  16998. *(*Toff_t)(unsafe.Pointer(bp + 1136)) = v17
  16999. if v17 < 0 {
  17000. libmd.XSHA512Update(tls, bp+536, libc.X__errno_location(tls), uint32(4))
  17001. } else {
  17002. libmd.XSHA512Update(tls, bp+536, bp+1136, uint32(8))
  17003. }
  17004. }
  17005. if (*(*Tstat)(unsafe.Pointer(bp + 384))).Fst_mode&uint32(m_S_IFMT3) == uint32(m_S_IFCHR3) {
  17006. if libc.Xtcgetattr(tls, 0, bp+976) == -int32(1) {
  17007. libmd.XSHA512Update(tls, bp+536, libc.X__errno_location(tls), uint32(4))
  17008. } else {
  17009. libmd.XSHA512Update(tls, bp+536, bp+976, uint32(60))
  17010. }
  17011. } else {
  17012. if (*(*Tstat)(unsafe.Pointer(bp + 384))).Fst_mode&uint32(m_S_IFMT3) == uint32(m_S_IFSOCK3) {
  17013. libc.Xmemset(tls, bp+752, 0, uint32(128))
  17014. *(*Tsocklen_t)(unsafe.Pointer(bp + 1128)) = uint32(128)
  17015. if libc.Xgetpeername(tls, 0, bp+752, bp+1128) == -int32(1) {
  17016. libmd.XSHA512Update(tls, bp+536, libc.X__errno_location(tls), uint32(4))
  17017. } else {
  17018. libmd.XSHA512Update(tls, bp+536, bp+752, uint32(128))
  17019. }
  17020. }
  17021. }
  17022. }
  17023. v18 = libc.Xgetrusage(tls, -int32(1), bp+104)
  17024. *(*int32)(unsafe.Pointer(bp + 64)) = v18
  17025. if v18 == -int32(1) {
  17026. libmd.XSHA512Update(tls, bp+536, libc.X__errno_location(tls), uint32(4))
  17027. } else {
  17028. libmd.XSHA512Update(tls, bp+536, bp+104, uint32(152))
  17029. }
  17030. if *(*int32)(unsafe.Pointer(bp + 64)) != -int32(1) {
  17031. _cnt += int32((*(*Trusage)(unsafe.Pointer(bp + 104))).Fru_utime.Ftv_sec)
  17032. _cnt += int32((*(*Trusage)(unsafe.Pointer(bp + 104))).Fru_utime.Ftv_usec)
  17033. }
  17034. } else {
  17035. /* Subsequent hashes absorb previous result */
  17036. libmd.XSHA512Update(tls, bp+536, bp, uint32(64))
  17037. }
  17038. v19 = libc.Xgettimeofday(tls, bp+88, libc.UintptrFromInt32(0))
  17039. *(*int32)(unsafe.Pointer(bp + 64)) = v19
  17040. if v19 == -int32(1) {
  17041. libmd.XSHA512Update(tls, bp+536, libc.X__errno_location(tls), uint32(4))
  17042. } else {
  17043. libmd.XSHA512Update(tls, bp+536, bp+88, uint32(16))
  17044. }
  17045. if *(*int32)(unsafe.Pointer(bp + 64)) != -int32(1) {
  17046. _cnt += int32((*(*Ttimeval)(unsafe.Pointer(bp + 88))).Ftv_sec)
  17047. _cnt += int32((*(*Ttimeval)(unsafe.Pointer(bp + 88))).Ftv_usec)
  17048. }
  17049. libmd.XSHA512Update(tls, bp+536, uintptr(unsafe.Pointer(&_cnt)), uint32(4))
  17050. goto _2
  17051. _2:
  17052. ;
  17053. j++
  17054. }
  17055. /* Not as random as you think but we take what we are given */
  17056. *(*uintptr)(unsafe.Pointer(bp + 748)) = uintptr(libc.Int32FromUint32(libc.Xgetauxval(tls, uint32(m_AT_RANDOM))))
  17057. if *(*uintptr)(unsafe.Pointer(bp + 748)) != 0 {
  17058. libmd.XSHA512Update(tls, bp+536, *(*uintptr)(unsafe.Pointer(bp + 748)), libc.Uint32FromInt32(libc.Int32FromInt32(16)))
  17059. }
  17060. *(*uintptr)(unsafe.Pointer(bp + 748)) = uintptr(libc.Int32FromUint32(libc.Xgetauxval(tls, uint32(m_AT_SYSINFO_EHDR))))
  17061. if *(*uintptr)(unsafe.Pointer(bp + 748)) != 0 {
  17062. libmd.XSHA512Update(tls, bp+536, *(*uintptr)(unsafe.Pointer(bp + 748)), libc.Uint32FromInt32(pgs))
  17063. }
  17064. *(*uintptr)(unsafe.Pointer(bp + 748)) = uintptr(libc.Int32FromUint32(libc.Xgetauxval(tls, uint32(m_AT_BASE))))
  17065. if *(*uintptr)(unsafe.Pointer(bp + 748)) != 0 {
  17066. libmd.XSHA512Update(tls, bp+536, bp+748, uint32(4))
  17067. }
  17068. libmd.XSHA512Final(tls, bp, bp+536)
  17069. if libc.Uint32FromInt64(64) < len1-i {
  17070. v20 = libc.Uint32FromInt64(64)
  17071. } else {
  17072. v20 = len1 - i
  17073. }
  17074. libc.Xmemcpy(tls, buf+uintptr(i), bp, v20)
  17075. if libc.Uint32FromInt64(64) < len1-i {
  17076. v21 = libc.Uint32FromInt64(64)
  17077. } else {
  17078. v21 = len1 - i
  17079. }
  17080. i += v21
  17081. goto _1
  17082. _1:
  17083. }
  17084. Xexplicit_bzero(tls, bp+536, uint32(208))
  17085. Xexplicit_bzero(tls, bp, uint32(64))
  17086. if _gotdata(tls, buf, len1) == 0 {
  17087. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = save_errno
  17088. return 0 /* satisfied */
  17089. }
  17090. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EIO)
  17091. return -int32(1)
  17092. }
  17093. var _cnt int32
  17094. var _lastpid Tpid_t
  17095. func __ccgo_fp(f interface{}) uintptr {
  17096. type iface [2]uintptr
  17097. return (*iface)(unsafe.Pointer(&f))[1]
  17098. }
  17099. var Xoptreset int32
  17100. var __ccgo_ts = (*reflect.StringHeader)(unsafe.Pointer(&__ccgo_ts1)).Data
  17101. var __ccgo_ts1 = "/proc/self/fd\x00%s: \x00: \x00%s\n\x00diouxX\x00DOU\x00aAeEfFgG\x00#'0- +\x00\x00BLOCKSIZE\x00G\x00K\x00M\x00%s: unknown blocksize\x00maximum blocksize is %ldG\x00minimum blocksize is 512\x00%ld%s-blocks\x00B\x00\x00Ki\x00Mi\x00Gi\x00Ti\x00Pi\x00Ei\x00\x00\x00\x00Ki\x00Mi\x00Gi\x00Ti\x00Pi\x00Ei\x00B\x00\x00k\x00\x00M\x00\x00G\x00\x00T\x00\x00P\x00\x00E\x00\x00\x00\x00k\x00\x00M\x00\x00G\x00\x00T\x00\x00P\x00\x00E\x00B\x00\x00K\x00\x00M\x00\x00G\x00\x00T\x00\x00P\x00\x00E\x00\x00\x00\x00K\x00\x00M\x00\x00G\x00\x00T\x00\x00P\x00\x00E\x00 \x00%d%s%d%s%s%s\x00%lld%s%s%s\x00/var/run/%s.pid\x00%u\x00/dev/tty\x00\n\x00setproctitle not initialized, please either call setproctitle_init() or link against libbsd-ctor.\x00%s\x00too large\x00too small\x00invalid\x000\x00\x00\x001\x00\x00\x002\x00\x00\x003\x00\x00\x004\x00\x00\x005\x00\x00\x006\x00\x00\x007\x00\x00\x008\x00\x00\x009\x00\x00\x00a\x00\x00\x00b\x00\x00\x00c\x00\x00\x00d\x00\x00\x00e\x00\x00\x00f\x00\x00\x00\x00\x00\x00\x00#\x00\x00\x00$\x00\x00\x00@\x00\x00\x00[\x00\x00\x00\\\x00\x00\x00]\x00\x00\x00^\x00\x00\x00`\x00\x00\x00{\x00\x00\x00|\x00\x00\x00}\x00\x00\x00~\x00\x00\x00\x00\x00\x00\x000\x00\x00\x001\x00\x00\x002\x00\x00\x003\x00\x00\x004\x00\x00\x005\x00\x00\x006\x00\x00\x007\x00\x00\x008\x00\x00\x009\x00\x00\x00A\x00\x00\x00B\x00\x00\x00C\x00\x00\x00D\x00\x00\x00E\x00\x00\x00F\x00\x00\x00\x00\x00\x00\x00/dev/urandom\x00.\x00/\x00"