ccgo_linux_arm64.go 506 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804
  1. // Code generated for linux/arm64 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/arm64 -I /home/jnml/src/modernc.org/builder/.exclude/modernc.org/limd/include/linux/arm64 -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 && arm64
  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_ESR_MAGIC = 0x45535201
  99. const m_EXIT_FAILURE = 1
  100. const m_EXIT_SUCCESS = 0
  101. const m_EXPR_NEST_MAX = 32
  102. const m_EXTRA_MAGIC = 0x45585401
  103. const m_FALLOC_FL_KEEP_SIZE = 1
  104. const m_FALLOC_FL_PUNCH_HOLE = 2
  105. const m_FAPPEND = "O_APPEND"
  106. const m_FASYNC = "O_ASYNC"
  107. const m_FD_CLOEXEC = 1
  108. const m_FD_SETSIZE = 1024
  109. const m_FFSYNC = "O_SYNC"
  110. const m_FILENAME_MAX = 4096
  111. const m_FILESIZEBITS = 64
  112. const m_FNDELAY = "O_NDELAY"
  113. const m_FNONBLOCK = "O_NONBLOCK"
  114. const m_FOPEN_MAX = 1000
  115. const m_FPARSELN_UNESCALL = 0x0f
  116. const m_FPARSELN_UNESCCOMM = 0x04
  117. const m_FPARSELN_UNESCCONT = 0x02
  118. const m_FPARSELN_UNESCESC = 0x01
  119. const m_FPARSELN_UNESCREST = 0x08
  120. const m_FPE_FLTDIV = 3
  121. const m_FPE_FLTINV = 7
  122. const m_FPE_FLTOVF = 4
  123. const m_FPE_FLTRES = 6
  124. const m_FPE_FLTSUB = 8
  125. const m_FPE_FLTUND = 5
  126. const m_FPE_INTDIV = 1
  127. const m_FPE_INTOVF = 2
  128. const m_FPSIMD_MAGIC = 0x46508001
  129. const m_F_ADD_SEALS = 1033
  130. const m_F_CANCELLK = 1029
  131. const m_F_DUPFD = 0
  132. const m_F_DUPFD_CLOEXEC = 1030
  133. const m_F_GETFD = 1
  134. const m_F_GETFL = 3
  135. const m_F_GETLEASE = 1025
  136. const m_F_GETLK = 5
  137. const m_F_GETOWN = 9
  138. const m_F_GETOWNER_UIDS = 17
  139. const m_F_GETOWN_EX = 16
  140. const m_F_GETPIPE_SZ = 1032
  141. const m_F_GETSIG = 11
  142. const m_F_GET_FILE_RW_HINT = 1037
  143. const m_F_GET_RW_HINT = 1035
  144. const m_F_GET_SEALS = 1034
  145. const m_F_LOCK = 1
  146. const m_F_NOTIFY = 1026
  147. const m_F_OFD_GETLK = 36
  148. const m_F_OFD_SETLK = 37
  149. const m_F_OFD_SETLKW = 38
  150. const m_F_OK = 0
  151. const m_F_OWNER_GID = 2
  152. const m_F_OWNER_PGRP = 2
  153. const m_F_OWNER_PID = 1
  154. const m_F_OWNER_TID = 0
  155. const m_F_RDLCK = 0
  156. const m_F_SEAL_FUTURE_WRITE = 0x0010
  157. const m_F_SEAL_GROW = 0x0004
  158. const m_F_SEAL_SEAL = 0x0001
  159. const m_F_SEAL_SHRINK = 0x0002
  160. const m_F_SEAL_WRITE = 0x0008
  161. const m_F_SETFD = 2
  162. const m_F_SETFL = 4
  163. const m_F_SETLEASE = 1024
  164. const m_F_SETLK = 6
  165. const m_F_SETLKW = 7
  166. const m_F_SETOWN = 8
  167. const m_F_SETOWN_EX = 15
  168. const m_F_SETPIPE_SZ = 1031
  169. const m_F_SETSIG = 10
  170. const m_F_SET_FILE_RW_HINT = 1038
  171. const m_F_SET_RW_HINT = 1036
  172. const m_F_TEST = 3
  173. const m_F_TLOCK = 2
  174. const m_F_ULOCK = 0
  175. const m_F_UNLCK = 2
  176. const m_F_WRLCK = 1
  177. const m_HAVE_CLEARENV = 1
  178. const m_HAVE_CONFIG_H = 1
  179. const m_HAVE_DIRENT_H = 1
  180. const m_HAVE_DIRFD = 1
  181. const m_HAVE_DLFCN_H = 1
  182. const m_HAVE_FOPENCOOKIE = 1
  183. const m_HAVE_GETAUXVAL = 1
  184. const m_HAVE_GETENTROPY = 1
  185. const m_HAVE_GETLINE = 1
  186. const m_HAVE_GRP_H = 1
  187. const m_HAVE_INTTYPES_H = 1
  188. const m_HAVE_PROGRAM_INVOCATION_SHORT_NAME = 1
  189. const m_HAVE_PWD_H = 1
  190. const m_HAVE_STDINT_H = 1
  191. const m_HAVE_STDIO_H = 1
  192. const m_HAVE_STDLIB_H = 1
  193. const m_HAVE_STRINGS_H = 1
  194. const m_HAVE_STRING_H = 1
  195. const m_HAVE_SYSCONF = 1
  196. const m_HAVE_SYS_DIR_H = 1
  197. const m_HAVE_SYS_STAT_H = 1
  198. const m_HAVE_SYS_TYPES_H = 1
  199. const m_HAVE_TYPEOF = 1
  200. const m_HAVE_UNISTD_H = 1
  201. const m_HAVE_WCHAR_H = 1
  202. const m_HAVE___FPURGE = 1
  203. const m_HAVE___PROGNAME = 1
  204. const m_HN_AUTOSCALE = 0x20
  205. const m_HN_B = 0x04
  206. const m_HN_DECIMAL = 0x01
  207. const m_HN_DIVISOR_1000 = 0x08
  208. const m_HN_GETSCALE = 0x10
  209. const m_HN_IEC_PREFIXES = 0x10
  210. const m_HN_NOSPACE = 0x02
  211. const m_HOST_NAME_MAX = 255
  212. const m_ILL_BADSTK = 8
  213. const m_ILL_COPROC = 7
  214. const m_ILL_ILLADR = 3
  215. const m_ILL_ILLOPC = 1
  216. const m_ILL_ILLOPN = 2
  217. const m_ILL_ILLTRP = 4
  218. const m_ILL_PRVOPC = 5
  219. const m_ILL_PRVREG = 6
  220. const m_INT16_MAX = 0x7fff
  221. const m_INT32_MAX = 0x7fffffff
  222. const m_INT64_MAX = 0x7fffffffffffffff
  223. const m_INT8_MAX = 0x7f
  224. const m_INTMAX_MAX = "INT64_MAX"
  225. const m_INTMAX_MIN = "INT64_MIN"
  226. const m_INTPTR_MAX = "INT64_MAX"
  227. const m_INTPTR_MIN = "INT64_MIN"
  228. const m_INT_FAST16_MAX = "INT32_MAX"
  229. const m_INT_FAST16_MIN = "INT32_MIN"
  230. const m_INT_FAST32_MAX = "INT32_MAX"
  231. const m_INT_FAST32_MIN = "INT32_MIN"
  232. const m_INT_FAST64_MAX = "INT64_MAX"
  233. const m_INT_FAST64_MIN = "INT64_MIN"
  234. const m_INT_FAST8_MAX = "INT8_MAX"
  235. const m_INT_FAST8_MIN = "INT8_MIN"
  236. const m_INT_LEAST16_MAX = "INT16_MAX"
  237. const m_INT_LEAST16_MIN = "INT16_MIN"
  238. const m_INT_LEAST32_MAX = "INT32_MAX"
  239. const m_INT_LEAST32_MIN = "INT32_MIN"
  240. const m_INT_LEAST64_MAX = "INT64_MAX"
  241. const m_INT_LEAST64_MIN = "INT64_MIN"
  242. const m_INT_LEAST8_MAX = "INT8_MAX"
  243. const m_INT_LEAST8_MIN = "INT8_MIN"
  244. const m_INT_MAX = 0x7fffffff
  245. const m_IOV_MAX = 1024
  246. const m_ITIMER_PROF = 2
  247. const m_ITIMER_REAL = 0
  248. const m_ITIMER_VIRTUAL = 1
  249. const m_IVSZ = 8
  250. const m_KEYSZ = 32
  251. const m_LIBBSD_DISABLE_DEPRECATED = 1
  252. const m_LIBBSD_OVERLAY = 1
  253. const m_LINE_MAX = 4096
  254. const m_LITTLE_ENDIAN = "__LITTLE_ENDIAN"
  255. const m_LLONG_MAX = 0x7fffffffffffffff
  256. const m_LOGIN_NAME_MAX = 256
  257. const m_LONG_BIT = 64
  258. const m_LONG_MAX = "__LONG_MAX"
  259. const m_LT_OBJDIR = ".libs/"
  260. const m_L_INCR = 1
  261. const m_L_SET = 0
  262. const m_L_XTND = 2
  263. const m_L_ctermid = 20
  264. const m_L_cuserid = 20
  265. const m_L_tmpnam = 20
  266. const m_MADV_COLD = 20
  267. const m_MADV_DODUMP = 17
  268. const m_MADV_DOFORK = 11
  269. const m_MADV_DONTDUMP = 16
  270. const m_MADV_DONTFORK = 10
  271. const m_MADV_DONTNEED = 4
  272. const m_MADV_FREE = 8
  273. const m_MADV_HUGEPAGE = 14
  274. const m_MADV_HWPOISON = 100
  275. const m_MADV_KEEPONFORK = 19
  276. const m_MADV_MERGEABLE = 12
  277. const m_MADV_NOHUGEPAGE = 15
  278. const m_MADV_NORMAL = 0
  279. const m_MADV_PAGEOUT = 21
  280. const m_MADV_RANDOM = 1
  281. const m_MADV_REMOVE = 9
  282. const m_MADV_SEQUENTIAL = 2
  283. const m_MADV_SOFT_OFFLINE = 101
  284. const m_MADV_UNMERGEABLE = 13
  285. const m_MADV_WILLNEED = 3
  286. const m_MADV_WIPEONFORK = 18
  287. const m_MAP_ANON = 32
  288. const m_MAP_ANONYMOUS = "MAP_ANON"
  289. const m_MAP_DENYWRITE = 0x0800
  290. const m_MAP_EXECUTABLE = 0x1000
  291. const m_MAP_FILE = 0
  292. const m_MAP_FIXED = 0x10
  293. const m_MAP_FIXED_NOREPLACE = 0x100000
  294. const m_MAP_GROWSDOWN = 0x0100
  295. const m_MAP_HUGETLB = 0x40000
  296. const m_MAP_HUGE_MASK = 0x3f
  297. const m_MAP_HUGE_SHIFT = 26
  298. const m_MAP_LOCKED = 0x2000
  299. const m_MAP_NONBLOCK = 0x10000
  300. const m_MAP_NORESERVE = 0x4000
  301. const m_MAP_POPULATE = 0x8000
  302. const m_MAP_PRIVATE = 2
  303. const m_MAP_SHARED = 0x01
  304. const m_MAP_SHARED_VALIDATE = 0x03
  305. const m_MAP_STACK = 0x20000
  306. const m_MAP_SYNC = 0x80000
  307. const m_MAP_TYPE = 0x0f
  308. const m_MAXHOSTNAMELEN = 64
  309. const m_MAXNAMLEN = 255
  310. const m_MAXPATHLEN = 4096
  311. const m_MAXSYMLINKS = 20
  312. const m_MAX_HANDLE_SZ = 128
  313. const m_MB_LEN_MAX = 4
  314. const m_MCL_CURRENT = 1
  315. const m_MCL_FUTURE = 2
  316. const m_MCL_ONFAULT = 4
  317. const m_MFD_ALLOW_SEALING = 0x0002
  318. const m_MFD_CLOEXEC = 0x0001
  319. const m_MFD_HUGETLB = 0x0004
  320. const m_MINSIGSTKSZ = 6144
  321. const m_MLOCK_ONFAULT = 0x01
  322. const m_MQ_PRIO_MAX = 32768
  323. const m_MREMAP_DONTUNMAP = 4
  324. const m_MREMAP_FIXED = 2
  325. const m_MREMAP_MAYMOVE = 1
  326. const m_MS_ASYNC = 1
  327. const m_MS_INVALIDATE = 2
  328. const m_MS_SYNC = 4
  329. const m_NAME_MAX = 255
  330. const m_NBBY = 8
  331. const m_NCARGS = 131072
  332. const m_NDEBUG = 1
  333. const m_NGROUPS = 32
  334. const m_NGROUPS_MAX = 32
  335. const m_NL_ARGMAX = 9
  336. const m_NL_LANGMAX = 32
  337. const m_NL_MSGMAX = 32767
  338. const m_NL_NMAX = 16
  339. const m_NL_SETMAX = 255
  340. const m_NL_TEXTMAX = 2048
  341. const m_NOFILE = 256
  342. const m_NSIG = "_NSIG"
  343. const m_NZERO = 20
  344. const m_O_APPEND = 02000
  345. const m_O_ASYNC = 020000
  346. const m_O_CLOEXEC = 02000000
  347. const m_O_CREAT = 0100
  348. const m_O_DIRECT = 0200000
  349. const m_O_DIRECTORY = 040000
  350. const m_O_DSYNC = 010000
  351. const m_O_EXCL = 0200
  352. const m_O_EXEC = "O_PATH"
  353. const m_O_LARGEFILE = 0400000
  354. const m_O_NDELAY = "O_NONBLOCK"
  355. const m_O_NOATIME = 01000000
  356. const m_O_NOCTTY = 0400
  357. const m_O_NOFOLLOW = 0100000
  358. const m_O_NONBLOCK = 04000
  359. const m_O_PATH = 010000000
  360. const m_O_RDONLY = 00
  361. const m_O_RDWR = 02
  362. const m_O_RSYNC = 04010000
  363. const m_O_SEARCH = "O_PATH"
  364. const m_O_SYNC = 04010000
  365. const m_O_TMPFILE = 020040000
  366. const m_O_TRUNC = 01000
  367. const m_O_TTY_INIT = 0
  368. const m_O_WRONLY = 01
  369. const m_PACKAGE = "libbsd"
  370. const m_PACKAGE_BUGREPORT = "libbsd@lists.freedesktop.org"
  371. const m_PACKAGE_NAME = "libbsd"
  372. const m_PACKAGE_STRING = "libbsd 0.11.7"
  373. const m_PACKAGE_TARNAME = "libbsd"
  374. const m_PACKAGE_URL = ""
  375. const m_PACKAGE_VERSION = "0.11.7"
  376. const m_PATH_MAX = 4096
  377. const m_PDP_ENDIAN = "__PDP_ENDIAN"
  378. const m_PIC = 1
  379. const m_PIPE_BUF = 4096
  380. const m_POLL_ERR = 4
  381. const m_POLL_HUP = 6
  382. const m_POLL_IN = 1
  383. const m_POLL_MSG = 3
  384. const m_POLL_OUT = 2
  385. const m_POLL_PRI = 5
  386. const m_POSIX_CLOSE_RESTART = 0
  387. const m_POSIX_FADV_DONTNEED = 4
  388. const m_POSIX_FADV_NOREUSE = 5
  389. const m_POSIX_FADV_NORMAL = 0
  390. const m_POSIX_FADV_RANDOM = 1
  391. const m_POSIX_FADV_SEQUENTIAL = 2
  392. const m_POSIX_FADV_WILLNEED = 3
  393. const m_POSIX_MADV_DONTNEED = 4
  394. const m_POSIX_MADV_NORMAL = 0
  395. const m_POSIX_MADV_RANDOM = 1
  396. const m_POSIX_MADV_SEQUENTIAL = 2
  397. const m_POSIX_MADV_WILLNEED = 3
  398. const m_PRIO_MAX = 20
  399. const m_PRIO_PGRP = 1
  400. const m_PRIO_PROCESS = 0
  401. const m_PRIO_USER = 2
  402. const m_PROT_BTI = 0x10
  403. const m_PROT_EXEC = 4
  404. const m_PROT_GROWSDOWN = 0x01000000
  405. const m_PROT_GROWSUP = 0x02000000
  406. const m_PROT_MTE = 0x20
  407. const m_PROT_NONE = 0
  408. const m_PROT_READ = 1
  409. const m_PROT_WRITE = 2
  410. const m_PTHREAD_CANCEL_ASYNCHRONOUS = 1
  411. const m_PTHREAD_CANCEL_DEFERRED = 0
  412. const m_PTHREAD_CANCEL_DISABLE = 1
  413. const m_PTHREAD_CANCEL_ENABLE = 0
  414. const m_PTHREAD_CANCEL_MASKED = 2
  415. const m_PTHREAD_CREATE_DETACHED = 1
  416. const m_PTHREAD_CREATE_JOINABLE = 0
  417. const m_PTHREAD_DESTRUCTOR_ITERATIONS = 4
  418. const m_PTHREAD_EXPLICIT_SCHED = 1
  419. const m_PTHREAD_INHERIT_SCHED = 0
  420. const m_PTHREAD_KEYS_MAX = 128
  421. const m_PTHREAD_MUTEX_DEFAULT = 0
  422. const m_PTHREAD_MUTEX_ERRORCHECK = 2
  423. const m_PTHREAD_MUTEX_NORMAL = 0
  424. const m_PTHREAD_MUTEX_RECURSIVE = 1
  425. const m_PTHREAD_MUTEX_ROBUST = 1
  426. const m_PTHREAD_MUTEX_STALLED = 0
  427. const m_PTHREAD_ONCE_INIT = 0
  428. const m_PTHREAD_PRIO_INHERIT = 1
  429. const m_PTHREAD_PRIO_NONE = 0
  430. const m_PTHREAD_PRIO_PROTECT = 2
  431. const m_PTHREAD_PROCESS_PRIVATE = 0
  432. const m_PTHREAD_PROCESS_SHARED = 1
  433. const m_PTHREAD_SCOPE_PROCESS = 1
  434. const m_PTHREAD_SCOPE_SYSTEM = 0
  435. const m_PTHREAD_STACK_MIN = 2048
  436. const m_PTRDIFF_MAX = "INT64_MAX"
  437. const m_PTRDIFF_MIN = "INT64_MIN"
  438. const m_P_tmpdir = "/tmp"
  439. const m_RAND_MAX = 0x7fffffff
  440. const m_RE_DUP_MAX = 255
  441. const m_RLIMIT_AS = 9
  442. const m_RLIMIT_CORE = 4
  443. const m_RLIMIT_CPU = 0
  444. const m_RLIMIT_DATA = 2
  445. const m_RLIMIT_FSIZE = 1
  446. const m_RLIMIT_LOCKS = 10
  447. const m_RLIMIT_MEMLOCK = 8
  448. const m_RLIMIT_MSGQUEUE = 12
  449. const m_RLIMIT_NICE = 13
  450. const m_RLIMIT_NLIMITS = 16
  451. const m_RLIMIT_NOFILE = 7
  452. const m_RLIMIT_NPROC = 6
  453. const m_RLIMIT_RSS = 5
  454. const m_RLIMIT_RTPRIO = 14
  455. const m_RLIMIT_RTTIME = 15
  456. const m_RLIMIT_SIGPENDING = 11
  457. const m_RLIMIT_STACK = 3
  458. const m_RLIM_NLIMITS = "RLIMIT_NLIMITS"
  459. const m_RLIM_SAVED_CUR = "RLIM_INFINITY"
  460. const m_RLIM_SAVED_MAX = "RLIM_INFINITY"
  461. const m_RUSAGE_SELF = 0
  462. const m_RUSAGE_THREAD = 1
  463. const m_RWF_WRITE_LIFE_NOT_SET = 0
  464. const m_RWH_WRITE_LIFE_EXTREME = 5
  465. const m_RWH_WRITE_LIFE_LONG = 4
  466. const m_RWH_WRITE_LIFE_MEDIUM = 3
  467. const m_RWH_WRITE_LIFE_NONE = 1
  468. const m_RWH_WRITE_LIFE_SHORT = 2
  469. const m_R_OK = 4
  470. const m_SA_EXPOSE_TAGBITS = 0x00000800
  471. const m_SA_NOCLDSTOP = 1
  472. const m_SA_NOCLDWAIT = 2
  473. const m_SA_NODEFER = 0x40000000
  474. const m_SA_NOMASK = "SA_NODEFER"
  475. const m_SA_ONESHOT = "SA_RESETHAND"
  476. const m_SA_ONSTACK = 0x08000000
  477. const m_SA_RESETHAND = 0x80000000
  478. const m_SA_RESTART = 0x10000000
  479. const m_SA_RESTORER = 0x04000000
  480. const m_SA_SIGINFO = 4
  481. const m_SA_UNSUPPORTED = 0x00000400
  482. const m_SCHAR_MAX = 127
  483. const m_SCHED_BATCH = 3
  484. const m_SCHED_DEADLINE = 6
  485. const m_SCHED_FIFO = 1
  486. const m_SCHED_IDLE = 5
  487. const m_SCHED_OTHER = 0
  488. const m_SCHED_RESET_ON_FORK = 0x40000000
  489. const m_SCHED_RR = 2
  490. const m_SEEK_DATA = 3
  491. const m_SEEK_HOLE = 4
  492. const m_SEGV_ACCERR = 2
  493. const m_SEGV_BNDERR = 3
  494. const m_SEGV_MAPERR = 1
  495. const m_SEGV_MTEAERR = 8
  496. const m_SEGV_MTESERR = 9
  497. const m_SEGV_PKUERR = 4
  498. const m_SEM_NSEMS_MAX = 256
  499. const m_SEM_VALUE_MAX = 0x7fffffff
  500. const m_SHRT_MAX = 0x7fff
  501. const m_SIGABRT = 6
  502. const m_SIGALRM = 14
  503. const m_SIGBUS = 7
  504. const m_SIGCHLD = 17
  505. const m_SIGCONT = 18
  506. const m_SIGEV_NONE = 1
  507. const m_SIGEV_SIGNAL = 0
  508. const m_SIGEV_THREAD = 2
  509. const m_SIGEV_THREAD_ID = 4
  510. const m_SIGFPE = 8
  511. const m_SIGHUP = 1
  512. const m_SIGILL = 4
  513. const m_SIGINT = 2
  514. const m_SIGIO = 29
  515. const m_SIGIOT = "SIGABRT"
  516. const m_SIGKILL = 9
  517. const m_SIGPIPE = 13
  518. const m_SIGPOLL = 29
  519. const m_SIGPROF = 27
  520. const m_SIGPWR = 30
  521. const m_SIGQUIT = 3
  522. const m_SIGSEGV = 11
  523. const m_SIGSTKFLT = 16
  524. const m_SIGSTKSZ = 12288
  525. const m_SIGSTOP = 19
  526. const m_SIGSYS = 31
  527. const m_SIGTERM = 15
  528. const m_SIGTRAP = 5
  529. const m_SIGTSTP = 20
  530. const m_SIGTTIN = 21
  531. const m_SIGTTOU = 22
  532. const m_SIGUNUSED = "SIGSYS"
  533. const m_SIGURG = 23
  534. const m_SIGUSR1 = 10
  535. const m_SIGUSR2 = 12
  536. const m_SIGVTALRM = 26
  537. const m_SIGWINCH = 28
  538. const m_SIGXCPU = 24
  539. const m_SIGXFSZ = 25
  540. const m_SIG_ATOMIC_MAX = "INT32_MAX"
  541. const m_SIG_ATOMIC_MIN = "INT32_MIN"
  542. const m_SIG_BLOCK = 0
  543. const m_SIG_SETMASK = 2
  544. const m_SIG_UNBLOCK = 1
  545. const m_SIZE_MAX = "UINT64_MAX"
  546. const m_SI_KERNEL = 128
  547. const m_SI_USER = 0
  548. const m_SPLICE_F_GIFT = 8
  549. const m_SPLICE_F_MORE = 4
  550. const m_SPLICE_F_MOVE = 1
  551. const m_SPLICE_F_NONBLOCK = 2
  552. const m_SSIZE_MAX = "LONG_MAX"
  553. const m_SS_DISABLE = 2
  554. const m_SS_FLAG_BITS = "SS_AUTODISARM"
  555. const m_SS_ONSTACK = 1
  556. const m_STATX_ALL = 0xfff
  557. const m_STATX_ATIME = 0x20
  558. const m_STATX_BASIC_STATS = 0x7ff
  559. const m_STATX_BLOCKS = 0x400
  560. const m_STATX_BTIME = 0x800
  561. const m_STATX_CTIME = 0x80
  562. const m_STATX_GID = 0x10
  563. const m_STATX_INO = 0x100
  564. const m_STATX_MODE = 2
  565. const m_STATX_MTIME = 0x40
  566. const m_STATX_NLINK = 4
  567. const m_STATX_SIZE = 0x200
  568. const m_STATX_TYPE = 1
  569. const m_STATX_UID = 8
  570. const m_STDC_HEADERS = 1
  571. const m_STDERR_FILENO = 2
  572. const m_STDIN_FILENO = 0
  573. const m_STDOUT_FILENO = 1
  574. const m_SVE_MAGIC = 0x53564501
  575. const m_SVE_NUM_PREGS = 16
  576. const m_SVE_NUM_ZREGS = 32
  577. const m_SVE_SIG_ZREGS_OFFSET = "SVE_SIG_REGS_OFFSET"
  578. const m_SVE_VQ_BYTES = 16
  579. const m_SVE_VQ_MAX = 512
  580. const m_SVE_VQ_MIN = 1
  581. const m_SYMLOOP_MAX = 40
  582. const m_SYNC_FILE_RANGE_WAIT_AFTER = 4
  583. const m_SYNC_FILE_RANGE_WAIT_BEFORE = 1
  584. const m_SYNC_FILE_RANGE_WRITE = 2
  585. const m_SYS_SECCOMP = 1
  586. const m_SYS_USER_DISPATCH = 2
  587. const m_S_IEXEC = "S_IXUSR"
  588. const m_S_IFBLK = 0060000
  589. const m_S_IFCHR = 0020000
  590. const m_S_IFDIR = 0040000
  591. const m_S_IFIFO = 0010000
  592. const m_S_IFLNK = 0120000
  593. const m_S_IFMT = 0170000
  594. const m_S_IFREG = 0100000
  595. const m_S_IFSOCK = 0140000
  596. const m_S_IREAD = "S_IRUSR"
  597. const m_S_IRGRP = 0040
  598. const m_S_IROTH = 0004
  599. const m_S_IRUSR = 0400
  600. const m_S_IRWXG = 0070
  601. const m_S_IRWXO = 0007
  602. const m_S_IRWXU = 0700
  603. const m_S_ISGID = 02000
  604. const m_S_ISTXT = "S_ISVTX"
  605. const m_S_ISUID = 04000
  606. const m_S_ISVTX = 01000
  607. const m_S_IWGRP = 0020
  608. const m_S_IWOTH = 0002
  609. const m_S_IWRITE = "S_IWUSR"
  610. const m_S_IWUSR = 0200
  611. const m_S_IXGRP = 0010
  612. const m_S_IXOTH = 0001
  613. const m_S_IXUSR = 0100
  614. const m_TIMER_ABSTIME = 1
  615. const m_TIME_UTC = 1
  616. const m_TMP_MAX = 10000
  617. const m_TRAP_BRANCH = 3
  618. const m_TRAP_BRKPT = 1
  619. const m_TRAP_HWBKPT = 4
  620. const m_TRAP_TRACE = 2
  621. const m_TRAP_UNK = 5
  622. const m_TTY_NAME_MAX = 32
  623. const m_TZNAME_MAX = 6
  624. const m_UCHAR_MAX = 255
  625. const m_UINT16_MAX = 0xffff
  626. const m_UINT32_MAX = "0xffffffffu"
  627. const m_UINT64_MAX = "0xffffffffffffffffu"
  628. const m_UINT8_MAX = 0xff
  629. const m_UINTMAX_MAX = "UINT64_MAX"
  630. const m_UINTPTR_MAX = "UINT64_MAX"
  631. const m_UINT_FAST16_MAX = "UINT32_MAX"
  632. const m_UINT_FAST32_MAX = "UINT32_MAX"
  633. const m_UINT_FAST64_MAX = "UINT64_MAX"
  634. const m_UINT_FAST8_MAX = "UINT8_MAX"
  635. const m_UINT_LEAST16_MAX = "UINT16_MAX"
  636. const m_UINT_LEAST32_MAX = "UINT32_MAX"
  637. const m_UINT_LEAST64_MAX = "UINT64_MAX"
  638. const m_UINT_LEAST8_MAX = "UINT8_MAX"
  639. const m_UINT_MAX = 0xffffffff
  640. const m_USHRT_MAX = 0xffff
  641. const m_UTIME_NOW = 0x3fffffff
  642. const m_UTIME_OMIT = 0x3ffffffe
  643. const m_VERSION = "0.11.7"
  644. const m_WINT_MAX = "UINT32_MAX"
  645. const m_WINT_MIN = 0
  646. const m_WNOHANG = 1
  647. const m_WORD_BIT = 32
  648. const m_WUNTRACED = 2
  649. const m_W_OK = 2
  650. const m_X_OK = 1
  651. const m__ALL_SOURCE = 1
  652. const m__CS_GNU_LIBC_VERSION = 2
  653. const m__CS_GNU_LIBPTHREAD_VERSION = 3
  654. const m__CS_PATH = 0
  655. const m__CS_POSIX_V5_WIDTH_RESTRICTED_ENVS = 4
  656. const m__CS_POSIX_V6_ILP32_OFF32_CFLAGS = 1116
  657. const m__CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 1117
  658. const m__CS_POSIX_V6_ILP32_OFF32_LIBS = 1118
  659. const m__CS_POSIX_V6_ILP32_OFF32_LINTFLAGS = 1119
  660. const m__CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 1120
  661. const m__CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 1121
  662. const m__CS_POSIX_V6_ILP32_OFFBIG_LIBS = 1122
  663. const m__CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS = 1123
  664. const m__CS_POSIX_V6_LP64_OFF64_CFLAGS = 1124
  665. const m__CS_POSIX_V6_LP64_OFF64_LDFLAGS = 1125
  666. const m__CS_POSIX_V6_LP64_OFF64_LIBS = 1126
  667. const m__CS_POSIX_V6_LP64_OFF64_LINTFLAGS = 1127
  668. const m__CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 1128
  669. const m__CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 1129
  670. const m__CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 1130
  671. const m__CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS = 1131
  672. const m__CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 1
  673. const m__CS_POSIX_V7_ILP32_OFF32_CFLAGS = 1132
  674. const m__CS_POSIX_V7_ILP32_OFF32_LDFLAGS = 1133
  675. const m__CS_POSIX_V7_ILP32_OFF32_LIBS = 1134
  676. const m__CS_POSIX_V7_ILP32_OFF32_LINTFLAGS = 1135
  677. const m__CS_POSIX_V7_ILP32_OFFBIG_CFLAGS = 1136
  678. const m__CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS = 1137
  679. const m__CS_POSIX_V7_ILP32_OFFBIG_LIBS = 1138
  680. const m__CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS = 1139
  681. const m__CS_POSIX_V7_LP64_OFF64_CFLAGS = 1140
  682. const m__CS_POSIX_V7_LP64_OFF64_LDFLAGS = 1141
  683. const m__CS_POSIX_V7_LP64_OFF64_LIBS = 1142
  684. const m__CS_POSIX_V7_LP64_OFF64_LINTFLAGS = 1143
  685. const m__CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS = 1144
  686. const m__CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS = 1145
  687. const m__CS_POSIX_V7_LPBIG_OFFBIG_LIBS = 1146
  688. const m__CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS = 1147
  689. const m__CS_POSIX_V7_THREADS_CFLAGS = 1150
  690. const m__CS_POSIX_V7_THREADS_LDFLAGS = 1151
  691. const m__CS_POSIX_V7_WIDTH_RESTRICTED_ENVS = 5
  692. const m__CS_V6_ENV = 1148
  693. const m__CS_V7_ENV = 1149
  694. const m__DARWIN_C_SOURCE = 1
  695. const m__GNU_SOURCE = 1
  696. const m__HPUX_ALT_XOPEN_SOCKET_API = 1
  697. const m__IOFBF = 0
  698. const m__IOLBF = 1
  699. const m__IONBF = 2
  700. const m__LP64 = 1
  701. const m__NETBSD_SOURCE = 1
  702. const m__NSIG = 65
  703. const m__OPENBSD_SOURCE = 1
  704. const m__PC_2_SYMLINKS = 20
  705. const m__PC_ALLOC_SIZE_MIN = 18
  706. const m__PC_ASYNC_IO = 10
  707. const m__PC_CHOWN_RESTRICTED = 6
  708. const m__PC_FILESIZEBITS = 13
  709. const m__PC_LINK_MAX = 0
  710. const m__PC_MAX_CANON = 1
  711. const m__PC_MAX_INPUT = 2
  712. const m__PC_NAME_MAX = 3
  713. const m__PC_NO_TRUNC = 7
  714. const m__PC_PATH_MAX = 4
  715. const m__PC_PIPE_BUF = 5
  716. const m__PC_PRIO_IO = 11
  717. const m__PC_REC_INCR_XFER_SIZE = 14
  718. const m__PC_REC_MAX_XFER_SIZE = 15
  719. const m__PC_REC_MIN_XFER_SIZE = 16
  720. const m__PC_REC_XFER_ALIGN = 17
  721. const m__PC_SOCK_MAXBUF = 12
  722. const m__PC_SYMLINK_MAX = 19
  723. const m__PC_SYNC_IO = 9
  724. const m__PC_VDISABLE = 8
  725. const m__POSIX2_BC_BASE_MAX = 99
  726. const m__POSIX2_BC_DIM_MAX = 2048
  727. const m__POSIX2_BC_SCALE_MAX = 99
  728. const m__POSIX2_BC_STRING_MAX = 1000
  729. const m__POSIX2_CHARCLASS_NAME_MAX = 14
  730. const m__POSIX2_COLL_WEIGHTS_MAX = 2
  731. const m__POSIX2_C_BIND = "_POSIX_VERSION"
  732. const m__POSIX2_EXPR_NEST_MAX = 32
  733. const m__POSIX2_LINE_MAX = 2048
  734. const m__POSIX2_RE_DUP_MAX = 255
  735. const m__POSIX2_VERSION = "_POSIX_VERSION"
  736. const m__POSIX_ADVISORY_INFO = "_POSIX_VERSION"
  737. const m__POSIX_AIO_LISTIO_MAX = 2
  738. const m__POSIX_AIO_MAX = 1
  739. const m__POSIX_ARG_MAX = 4096
  740. const m__POSIX_ASYNCHRONOUS_IO = "_POSIX_VERSION"
  741. const m__POSIX_BARRIERS = "_POSIX_VERSION"
  742. const m__POSIX_CHILD_MAX = 25
  743. const m__POSIX_CHOWN_RESTRICTED = 1
  744. const m__POSIX_CLOCKRES_MIN = 20000000
  745. const m__POSIX_CLOCK_SELECTION = "_POSIX_VERSION"
  746. const m__POSIX_CPUTIME = "_POSIX_VERSION"
  747. const m__POSIX_DELAYTIMER_MAX = 32
  748. const m__POSIX_FSYNC = "_POSIX_VERSION"
  749. const m__POSIX_HOST_NAME_MAX = 255
  750. const m__POSIX_IPV6 = "_POSIX_VERSION"
  751. const m__POSIX_JOB_CONTROL = 1
  752. const m__POSIX_LINK_MAX = 8
  753. const m__POSIX_LOGIN_NAME_MAX = 9
  754. const m__POSIX_MAPPED_FILES = "_POSIX_VERSION"
  755. const m__POSIX_MAX_CANON = 255
  756. const m__POSIX_MAX_INPUT = 255
  757. const m__POSIX_MEMLOCK = "_POSIX_VERSION"
  758. const m__POSIX_MEMLOCK_RANGE = "_POSIX_VERSION"
  759. const m__POSIX_MEMORY_PROTECTION = "_POSIX_VERSION"
  760. const m__POSIX_MESSAGE_PASSING = "_POSIX_VERSION"
  761. const m__POSIX_MONOTONIC_CLOCK = "_POSIX_VERSION"
  762. const m__POSIX_MQ_OPEN_MAX = 8
  763. const m__POSIX_MQ_PRIO_MAX = 32
  764. const m__POSIX_NAME_MAX = 14
  765. const m__POSIX_NGROUPS_MAX = 8
  766. const m__POSIX_NO_TRUNC = 1
  767. const m__POSIX_OPEN_MAX = 20
  768. const m__POSIX_PATH_MAX = 256
  769. const m__POSIX_PIPE_BUF = 512
  770. const m__POSIX_PTHREAD_SEMANTICS = 1
  771. const m__POSIX_RAW_SOCKETS = "_POSIX_VERSION"
  772. const m__POSIX_READER_WRITER_LOCKS = "_POSIX_VERSION"
  773. const m__POSIX_REALTIME_SIGNALS = "_POSIX_VERSION"
  774. const m__POSIX_REGEXP = 1
  775. const m__POSIX_RE_DUP_MAX = 255
  776. const m__POSIX_RTSIG_MAX = 8
  777. const m__POSIX_SAVED_IDS = 1
  778. const m__POSIX_SEMAPHORES = "_POSIX_VERSION"
  779. const m__POSIX_SEM_NSEMS_MAX = 256
  780. const m__POSIX_SEM_VALUE_MAX = 32767
  781. const m__POSIX_SHARED_MEMORY_OBJECTS = "_POSIX_VERSION"
  782. const m__POSIX_SHELL = 1
  783. const m__POSIX_SIGQUEUE_MAX = 32
  784. const m__POSIX_SPAWN = "_POSIX_VERSION"
  785. const m__POSIX_SPIN_LOCKS = "_POSIX_VERSION"
  786. const m__POSIX_SSIZE_MAX = 32767
  787. const m__POSIX_SS_REPL_MAX = 4
  788. const m__POSIX_STREAM_MAX = 8
  789. const m__POSIX_SYMLINK_MAX = 255
  790. const m__POSIX_SYMLOOP_MAX = 8
  791. const m__POSIX_THREADS = "_POSIX_VERSION"
  792. const m__POSIX_THREAD_ATTR_STACKADDR = "_POSIX_VERSION"
  793. const m__POSIX_THREAD_ATTR_STACKSIZE = "_POSIX_VERSION"
  794. const m__POSIX_THREAD_CPUTIME = "_POSIX_VERSION"
  795. const m__POSIX_THREAD_DESTRUCTOR_ITERATIONS = 4
  796. const m__POSIX_THREAD_KEYS_MAX = 128
  797. const m__POSIX_THREAD_PRIORITY_SCHEDULING = "_POSIX_VERSION"
  798. const m__POSIX_THREAD_PROCESS_SHARED = "_POSIX_VERSION"
  799. const m__POSIX_THREAD_SAFE_FUNCTIONS = "_POSIX_VERSION"
  800. const m__POSIX_THREAD_THREADS_MAX = 64
  801. const m__POSIX_TIMEOUTS = "_POSIX_VERSION"
  802. const m__POSIX_TIMERS = "_POSIX_VERSION"
  803. const m__POSIX_TIMER_MAX = 32
  804. const m__POSIX_TRACE_EVENT_NAME_MAX = 30
  805. const m__POSIX_TRACE_NAME_MAX = 8
  806. const m__POSIX_TRACE_SYS_MAX = 8
  807. const m__POSIX_TRACE_USER_EVENT_MAX = 32
  808. const m__POSIX_TTY_NAME_MAX = 9
  809. const m__POSIX_TZNAME_MAX = 6
  810. const m__POSIX_V6_LP64_OFF64 = 1
  811. const m__POSIX_V7_LP64_OFF64 = 1
  812. const m__POSIX_VDISABLE = 0
  813. const m__POSIX_VERSION = 200809
  814. const m__SC_2_CHAR_TERM = 95
  815. const m__SC_2_C_BIND = 47
  816. const m__SC_2_C_DEV = 48
  817. const m__SC_2_FORT_DEV = 49
  818. const m__SC_2_FORT_RUN = 50
  819. const m__SC_2_LOCALEDEF = 52
  820. const m__SC_2_PBS = 168
  821. const m__SC_2_PBS_ACCOUNTING = 169
  822. const m__SC_2_PBS_CHECKPOINT = 175
  823. const m__SC_2_PBS_LOCATE = 170
  824. const m__SC_2_PBS_MESSAGE = 171
  825. const m__SC_2_PBS_TRACK = 172
  826. const m__SC_2_SW_DEV = 51
  827. const m__SC_2_UPE = 97
  828. const m__SC_2_VERSION = 46
  829. const m__SC_ADVISORY_INFO = 132
  830. const m__SC_AIO_LISTIO_MAX = 23
  831. const m__SC_AIO_MAX = 24
  832. const m__SC_AIO_PRIO_DELTA_MAX = 25
  833. const m__SC_ARG_MAX = 0
  834. const m__SC_ASYNCHRONOUS_IO = 12
  835. const m__SC_ATEXIT_MAX = 87
  836. const m__SC_AVPHYS_PAGES = 86
  837. const m__SC_BARRIERS = 133
  838. const m__SC_BC_BASE_MAX = 36
  839. const m__SC_BC_DIM_MAX = 37
  840. const m__SC_BC_SCALE_MAX = 38
  841. const m__SC_BC_STRING_MAX = 39
  842. const m__SC_CHILD_MAX = 1
  843. const m__SC_CLK_TCK = 2
  844. const m__SC_CLOCK_SELECTION = 137
  845. const m__SC_COLL_WEIGHTS_MAX = 40
  846. const m__SC_CPUTIME = 138
  847. const m__SC_DELAYTIMER_MAX = 26
  848. const m__SC_EXPR_NEST_MAX = 42
  849. const m__SC_FSYNC = 15
  850. const m__SC_GETGR_R_SIZE_MAX = 69
  851. const m__SC_GETPW_R_SIZE_MAX = 70
  852. const m__SC_HOST_NAME_MAX = 180
  853. const m__SC_IOV_MAX = 60
  854. const m__SC_IPV6 = 235
  855. const m__SC_JOB_CONTROL = 7
  856. const m__SC_LINE_MAX = 43
  857. const m__SC_LOGIN_NAME_MAX = 71
  858. const m__SC_MAPPED_FILES = 16
  859. const m__SC_MEMLOCK = 17
  860. const m__SC_MEMLOCK_RANGE = 18
  861. const m__SC_MEMORY_PROTECTION = 19
  862. const m__SC_MESSAGE_PASSING = 20
  863. const m__SC_MINSIGSTKSZ = 249
  864. const m__SC_MONOTONIC_CLOCK = 149
  865. const m__SC_MQ_OPEN_MAX = 27
  866. const m__SC_MQ_PRIO_MAX = 28
  867. const m__SC_NGROUPS_MAX = 3
  868. const m__SC_NPROCESSORS_CONF = 83
  869. const m__SC_NPROCESSORS_ONLN = 84
  870. const m__SC_NZERO = 109
  871. const m__SC_OPEN_MAX = 4
  872. const m__SC_PAGESIZE = 30
  873. const m__SC_PAGE_SIZE = 30
  874. const m__SC_PASS_MAX = 88
  875. const m__SC_PHYS_PAGES = 85
  876. const m__SC_PRIORITIZED_IO = 13
  877. const m__SC_PRIORITY_SCHEDULING = 10
  878. const m__SC_RAW_SOCKETS = 236
  879. const m__SC_READER_WRITER_LOCKS = 153
  880. const m__SC_REALTIME_SIGNALS = 9
  881. const m__SC_REGEXP = 155
  882. const m__SC_RE_DUP_MAX = 44
  883. const m__SC_RTSIG_MAX = 31
  884. const m__SC_SAVED_IDS = 8
  885. const m__SC_SEMAPHORES = 21
  886. const m__SC_SEM_NSEMS_MAX = 32
  887. const m__SC_SEM_VALUE_MAX = 33
  888. const m__SC_SHARED_MEMORY_OBJECTS = 22
  889. const m__SC_SHELL = 157
  890. const m__SC_SIGQUEUE_MAX = 34
  891. const m__SC_SIGSTKSZ = 250
  892. const m__SC_SPAWN = 159
  893. const m__SC_SPIN_LOCKS = 154
  894. const m__SC_SPORADIC_SERVER = 160
  895. const m__SC_SS_REPL_MAX = 241
  896. const m__SC_STREAMS = 174
  897. const m__SC_STREAM_MAX = 5
  898. const m__SC_SYMLOOP_MAX = 173
  899. const m__SC_SYNCHRONIZED_IO = 14
  900. const m__SC_THREADS = 67
  901. const m__SC_THREAD_ATTR_STACKADDR = 77
  902. const m__SC_THREAD_ATTR_STACKSIZE = 78
  903. const m__SC_THREAD_CPUTIME = 139
  904. const m__SC_THREAD_DESTRUCTOR_ITERATIONS = 73
  905. const m__SC_THREAD_KEYS_MAX = 74
  906. const m__SC_THREAD_PRIORITY_SCHEDULING = 79
  907. const m__SC_THREAD_PRIO_INHERIT = 80
  908. const m__SC_THREAD_PRIO_PROTECT = 81
  909. const m__SC_THREAD_PROCESS_SHARED = 82
  910. const m__SC_THREAD_ROBUST_PRIO_INHERIT = 247
  911. const m__SC_THREAD_ROBUST_PRIO_PROTECT = 248
  912. const m__SC_THREAD_SAFE_FUNCTIONS = 68
  913. const m__SC_THREAD_SPORADIC_SERVER = 161
  914. const m__SC_THREAD_STACK_MIN = 75
  915. const m__SC_THREAD_THREADS_MAX = 76
  916. const m__SC_TIMEOUTS = 164
  917. const m__SC_TIMERS = 11
  918. const m__SC_TIMER_MAX = 35
  919. const m__SC_TRACE = 181
  920. const m__SC_TRACE_EVENT_FILTER = 182
  921. const m__SC_TRACE_EVENT_NAME_MAX = 242
  922. const m__SC_TRACE_INHERIT = 183
  923. const m__SC_TRACE_LOG = 184
  924. const m__SC_TRACE_NAME_MAX = 243
  925. const m__SC_TRACE_SYS_MAX = 244
  926. const m__SC_TRACE_USER_EVENT_MAX = 245
  927. const m__SC_TTY_NAME_MAX = 72
  928. const m__SC_TYPED_MEMORY_OBJECTS = 165
  929. const m__SC_TZNAME_MAX = 6
  930. const m__SC_UIO_MAXIOV = 60
  931. const m__SC_V6_ILP32_OFF32 = 176
  932. const m__SC_V6_ILP32_OFFBIG = 177
  933. const m__SC_V6_LP64_OFF64 = 178
  934. const m__SC_V6_LPBIG_OFFBIG = 179
  935. const m__SC_V7_ILP32_OFF32 = 237
  936. const m__SC_V7_ILP32_OFFBIG = 238
  937. const m__SC_V7_LP64_OFF64 = 239
  938. const m__SC_V7_LPBIG_OFFBIG = 240
  939. const m__SC_VERSION = 29
  940. const m__SC_XBS5_ILP32_OFF32 = 125
  941. const m__SC_XBS5_ILP32_OFFBIG = 126
  942. const m__SC_XBS5_LP64_OFF64 = 127
  943. const m__SC_XBS5_LPBIG_OFFBIG = 128
  944. const m__SC_XOPEN_CRYPT = 92
  945. const m__SC_XOPEN_ENH_I18N = 93
  946. const m__SC_XOPEN_LEGACY = 129
  947. const m__SC_XOPEN_REALTIME = 130
  948. const m__SC_XOPEN_REALTIME_THREADS = 131
  949. const m__SC_XOPEN_SHM = 94
  950. const m__SC_XOPEN_STREAMS = 246
  951. const m__SC_XOPEN_UNIX = 91
  952. const m__SC_XOPEN_VERSION = 89
  953. const m__SC_XOPEN_XCU_VERSION = 90
  954. const m__SC_XOPEN_XPG2 = 98
  955. const m__SC_XOPEN_XPG3 = 99
  956. const m__SC_XOPEN_XPG4 = 100
  957. const m__STDC_PREDEF_H = 1
  958. const m__SYS_CDEFS_H = 1
  959. const m__TANDEM_SOURCE = 1
  960. const m__XOPEN_ENH_I18N = 1
  961. const m__XOPEN_IOV_MAX = 16
  962. const m__XOPEN_NAME_MAX = 255
  963. const m__XOPEN_PATH_MAX = 1024
  964. const m__XOPEN_UNIX = 1
  965. const m__XOPEN_VERSION = 700
  966. const m___AARCH64EL__ = 1
  967. const m___AARCH64_CMODEL_SMALL__ = 1
  968. const m___ARM_64BIT_STATE = 1
  969. const m___ARM_ALIGN_MAX_PWR = 28
  970. const m___ARM_ALIGN_MAX_STACK_PWR = 16
  971. const m___ARM_ARCH = 8
  972. const m___ARM_ARCH_8A = 1
  973. const m___ARM_ARCH_ISA_A64 = 1
  974. const m___ARM_ARCH_PROFILE = 65
  975. const m___ARM_FEATURE_CLZ = 1
  976. const m___ARM_FEATURE_FMA = 1
  977. const m___ARM_FEATURE_IDIV = 1
  978. const m___ARM_FEATURE_NUMERIC_MAXMIN = 1
  979. const m___ARM_FEATURE_UNALIGNED = 1
  980. const m___ARM_FP = 14
  981. const m___ARM_FP16_ARGS = 1
  982. const m___ARM_FP16_FORMAT_IEEE = 1
  983. const m___ARM_NEON = 1
  984. const m___ARM_PCS_AAPCS64 = 1
  985. const m___ARM_SIZEOF_MINIMAL_ENUM = 4
  986. const m___ARM_SIZEOF_WCHAR_T = 4
  987. const m___ATOMIC_ACQUIRE = 2
  988. const m___ATOMIC_ACQ_REL = 4
  989. const m___ATOMIC_CONSUME = 1
  990. const m___ATOMIC_RELAXED = 0
  991. const m___ATOMIC_RELEASE = 3
  992. const m___ATOMIC_SEQ_CST = 5
  993. const m___BIGGEST_ALIGNMENT__ = 16
  994. const m___BIG_ENDIAN = 4321
  995. const m___BYTE_ORDER = 1234
  996. const m___BYTE_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  997. const m___CCGO__ = 1
  998. const m___CHAR_BIT__ = 8
  999. const m___CHAR_UNSIGNED__ = 1
  1000. const m___DBL_DECIMAL_DIG__ = 17
  1001. const m___DBL_DIG__ = 15
  1002. const m___DBL_HAS_DENORM__ = 1
  1003. const m___DBL_HAS_INFINITY__ = 1
  1004. const m___DBL_HAS_QUIET_NAN__ = 1
  1005. const m___DBL_IS_IEC_60559__ = 2
  1006. const m___DBL_MANT_DIG__ = 53
  1007. const m___DBL_MAX_10_EXP__ = 308
  1008. const m___DBL_MAX_EXP__ = 1024
  1009. const m___DECIMAL_DIG__ = 36
  1010. const m___DEC_EVAL_METHOD__ = 2
  1011. const m___ELF__ = 1
  1012. const m___EXTENSIONS__ = 1
  1013. const m___FINITE_MATH_ONLY__ = 0
  1014. const m___FLOAT_WORD_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  1015. const m___FLT128_DECIMAL_DIG__ = 36
  1016. const m___FLT128_DENORM_MIN__ = 6.47517511943802511092443895822764655e-4966
  1017. const m___FLT128_DIG__ = 33
  1018. const m___FLT128_EPSILON__ = 1.92592994438723585305597794258492732e-34
  1019. const m___FLT128_HAS_DENORM__ = 1
  1020. const m___FLT128_HAS_INFINITY__ = 1
  1021. const m___FLT128_HAS_QUIET_NAN__ = 1
  1022. const m___FLT128_IS_IEC_60559__ = 2
  1023. const m___FLT128_MANT_DIG__ = 113
  1024. const m___FLT128_MAX_10_EXP__ = 4932
  1025. const m___FLT128_MAX_EXP__ = 16384
  1026. const m___FLT128_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1027. const m___FLT128_MIN__ = 3.36210314311209350626267781732175260e-4932
  1028. const m___FLT128_NORM_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1029. const m___FLT16_DECIMAL_DIG__ = 5
  1030. const m___FLT16_DENORM_MIN__ = 5.96046447753906250000000000000000000e-8
  1031. const m___FLT16_DIG__ = 3
  1032. const m___FLT16_EPSILON__ = 9.76562500000000000000000000000000000e-4
  1033. const m___FLT16_HAS_DENORM__ = 1
  1034. const m___FLT16_HAS_INFINITY__ = 1
  1035. const m___FLT16_HAS_QUIET_NAN__ = 1
  1036. const m___FLT16_IS_IEC_60559__ = 2
  1037. const m___FLT16_MANT_DIG__ = 11
  1038. const m___FLT16_MAX_10_EXP__ = 4
  1039. const m___FLT16_MAX_EXP__ = 16
  1040. const m___FLT16_MAX__ = 6.55040000000000000000000000000000000e+4
  1041. const m___FLT16_MIN__ = 6.10351562500000000000000000000000000e-5
  1042. const m___FLT16_NORM_MAX__ = 6.55040000000000000000000000000000000e+4
  1043. const m___FLT32X_DECIMAL_DIG__ = 17
  1044. const m___FLT32X_DENORM_MIN__ = 4.94065645841246544176568792868221372e-324
  1045. const m___FLT32X_DIG__ = 15
  1046. const m___FLT32X_EPSILON__ = 2.22044604925031308084726333618164062e-16
  1047. const m___FLT32X_HAS_DENORM__ = 1
  1048. const m___FLT32X_HAS_INFINITY__ = 1
  1049. const m___FLT32X_HAS_QUIET_NAN__ = 1
  1050. const m___FLT32X_IS_IEC_60559__ = 2
  1051. const m___FLT32X_MANT_DIG__ = 53
  1052. const m___FLT32X_MAX_10_EXP__ = 308
  1053. const m___FLT32X_MAX_EXP__ = 1024
  1054. const m___FLT32X_MAX__ = 1.79769313486231570814527423731704357e+308
  1055. const m___FLT32X_MIN__ = 2.22507385850720138309023271733240406e-308
  1056. const m___FLT32X_NORM_MAX__ = 1.79769313486231570814527423731704357e+308
  1057. const m___FLT32_DECIMAL_DIG__ = 9
  1058. const m___FLT32_DENORM_MIN__ = 1.40129846432481707092372958328991613e-45
  1059. const m___FLT32_DIG__ = 6
  1060. const m___FLT32_EPSILON__ = 1.19209289550781250000000000000000000e-7
  1061. const m___FLT32_HAS_DENORM__ = 1
  1062. const m___FLT32_HAS_INFINITY__ = 1
  1063. const m___FLT32_HAS_QUIET_NAN__ = 1
  1064. const m___FLT32_IS_IEC_60559__ = 2
  1065. const m___FLT32_MANT_DIG__ = 24
  1066. const m___FLT32_MAX_10_EXP__ = 38
  1067. const m___FLT32_MAX_EXP__ = 128
  1068. const m___FLT32_MAX__ = 3.40282346638528859811704183484516925e+38
  1069. const m___FLT32_MIN__ = 1.17549435082228750796873653722224568e-38
  1070. const m___FLT32_NORM_MAX__ = 3.40282346638528859811704183484516925e+38
  1071. const m___FLT64X_DECIMAL_DIG__ = 36
  1072. const m___FLT64X_DENORM_MIN__ = 6.47517511943802511092443895822764655e-4966
  1073. const m___FLT64X_DIG__ = 33
  1074. const m___FLT64X_EPSILON__ = 1.92592994438723585305597794258492732e-34
  1075. const m___FLT64X_HAS_DENORM__ = 1
  1076. const m___FLT64X_HAS_INFINITY__ = 1
  1077. const m___FLT64X_HAS_QUIET_NAN__ = 1
  1078. const m___FLT64X_IS_IEC_60559__ = 2
  1079. const m___FLT64X_MANT_DIG__ = 113
  1080. const m___FLT64X_MAX_10_EXP__ = 4932
  1081. const m___FLT64X_MAX_EXP__ = 16384
  1082. const m___FLT64X_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1083. const m___FLT64X_MIN__ = 3.36210314311209350626267781732175260e-4932
  1084. const m___FLT64X_NORM_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1085. const m___FLT64_DECIMAL_DIG__ = 17
  1086. const m___FLT64_DENORM_MIN__ = 4.94065645841246544176568792868221372e-324
  1087. const m___FLT64_DIG__ = 15
  1088. const m___FLT64_EPSILON__ = 2.22044604925031308084726333618164062e-16
  1089. const m___FLT64_HAS_DENORM__ = 1
  1090. const m___FLT64_HAS_INFINITY__ = 1
  1091. const m___FLT64_HAS_QUIET_NAN__ = 1
  1092. const m___FLT64_IS_IEC_60559__ = 2
  1093. const m___FLT64_MANT_DIG__ = 53
  1094. const m___FLT64_MAX_10_EXP__ = 308
  1095. const m___FLT64_MAX_EXP__ = 1024
  1096. const m___FLT64_MAX__ = 1.79769313486231570814527423731704357e+308
  1097. const m___FLT64_MIN__ = 2.22507385850720138309023271733240406e-308
  1098. const m___FLT64_NORM_MAX__ = 1.79769313486231570814527423731704357e+308
  1099. const m___FLT_DECIMAL_DIG__ = 9
  1100. const m___FLT_DENORM_MIN__ = 1.40129846432481707092372958328991613e-45
  1101. const m___FLT_DIG__ = 6
  1102. const m___FLT_EPSILON__ = 1.19209289550781250000000000000000000e-7
  1103. const m___FLT_EVAL_METHOD_C99__ = 0
  1104. const m___FLT_EVAL_METHOD_TS_18661_3__ = 0
  1105. const m___FLT_EVAL_METHOD__ = 0
  1106. const m___FLT_HAS_DENORM__ = 1
  1107. const m___FLT_HAS_INFINITY__ = 1
  1108. const m___FLT_HAS_QUIET_NAN__ = 1
  1109. const m___FLT_IS_IEC_60559__ = 2
  1110. const m___FLT_MANT_DIG__ = 24
  1111. const m___FLT_MAX_10_EXP__ = 38
  1112. const m___FLT_MAX_EXP__ = 128
  1113. const m___FLT_MAX__ = 3.40282346638528859811704183484516925e+38
  1114. const m___FLT_MIN__ = 1.17549435082228750796873653722224568e-38
  1115. const m___FLT_NORM_MAX__ = 3.40282346638528859811704183484516925e+38
  1116. const m___FLT_RADIX__ = 2
  1117. const m___FP_FAST_FMA = 1
  1118. const m___FP_FAST_FMAF = 1
  1119. const m___FP_FAST_FMAF32 = 1
  1120. const m___FP_FAST_FMAF32x = 1
  1121. const m___FP_FAST_FMAF64 = 1
  1122. const m___FUNCTION__ = "__func__"
  1123. const m___GCC_ASM_FLAG_OUTPUTS__ = 1
  1124. const m___GCC_ATOMIC_BOOL_LOCK_FREE = 2
  1125. const m___GCC_ATOMIC_CHAR16_T_LOCK_FREE = 2
  1126. const m___GCC_ATOMIC_CHAR32_T_LOCK_FREE = 2
  1127. const m___GCC_ATOMIC_CHAR_LOCK_FREE = 2
  1128. const m___GCC_ATOMIC_INT_LOCK_FREE = 2
  1129. const m___GCC_ATOMIC_LLONG_LOCK_FREE = 2
  1130. const m___GCC_ATOMIC_LONG_LOCK_FREE = 2
  1131. const m___GCC_ATOMIC_POINTER_LOCK_FREE = 2
  1132. const m___GCC_ATOMIC_SHORT_LOCK_FREE = 2
  1133. const m___GCC_ATOMIC_TEST_AND_SET_TRUEVAL = 1
  1134. const m___GCC_ATOMIC_WCHAR_T_LOCK_FREE = 2
  1135. const m___GCC_CONSTRUCTIVE_SIZE = 64
  1136. const m___GCC_DESTRUCTIVE_SIZE = 256
  1137. const m___GCC_HAVE_DWARF2_CFI_ASM = 1
  1138. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 = 1
  1139. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 = 1
  1140. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 = 1
  1141. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 = 1
  1142. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 = 1
  1143. const m___GCC_IEC_559 = 2
  1144. const m___GCC_IEC_559_COMPLEX = 2
  1145. const m___GNUC_EXECUTION_CHARSET_NAME = "UTF-8"
  1146. const m___GNUC_MINOR__ = 2
  1147. const m___GNUC_PATCHLEVEL__ = 0
  1148. const m___GNUC_STDC_INLINE__ = 1
  1149. const m___GNUC_WIDE_EXECUTION_CHARSET_NAME = "UTF-32LE"
  1150. const m___GNUC__ = 12
  1151. const m___GXX_ABI_VERSION = 1017
  1152. const m___HAVE_GENERIC_SELECTION = 0
  1153. const m___HAVE_SPECULATION_SAFE_VALUE = 1
  1154. const m___INT16_MAX__ = 0x7fff
  1155. const m___INT32_MAX__ = 0x7fffffff
  1156. const m___INT32_TYPE__ = "int"
  1157. const m___INT64_MAX__ = 0x7fffffffffffffff
  1158. const m___INT8_MAX__ = 0x7f
  1159. const m___INTMAX_MAX__ = 0x7fffffffffffffff
  1160. const m___INTMAX_WIDTH__ = 64
  1161. const m___INTPTR_MAX__ = 0x7fffffffffffffff
  1162. const m___INTPTR_WIDTH__ = 64
  1163. const m___INT_FAST16_MAX__ = 0x7fffffffffffffff
  1164. const m___INT_FAST16_WIDTH__ = 64
  1165. const m___INT_FAST32_MAX__ = 0x7fffffffffffffff
  1166. const m___INT_FAST32_WIDTH__ = 64
  1167. const m___INT_FAST64_MAX__ = 0x7fffffffffffffff
  1168. const m___INT_FAST64_WIDTH__ = 64
  1169. const m___INT_FAST8_MAX__ = 0x7f
  1170. const m___INT_FAST8_WIDTH__ = 8
  1171. const m___INT_LEAST16_MAX__ = 0x7fff
  1172. const m___INT_LEAST16_WIDTH__ = 16
  1173. const m___INT_LEAST32_MAX__ = 0x7fffffff
  1174. const m___INT_LEAST32_TYPE__ = "int"
  1175. const m___INT_LEAST32_WIDTH__ = 32
  1176. const m___INT_LEAST64_MAX__ = 0x7fffffffffffffff
  1177. const m___INT_LEAST64_WIDTH__ = 64
  1178. const m___INT_LEAST8_MAX__ = 0x7f
  1179. const m___INT_LEAST8_WIDTH__ = 8
  1180. const m___INT_MAX__ = 0x7fffffff
  1181. const m___INT_WIDTH__ = 32
  1182. const m___LDBL_DECIMAL_DIG__ = 36
  1183. const m___LDBL_DENORM_MIN__ = 6.47517511943802511092443895822764655e-4966
  1184. const m___LDBL_DIG__ = 33
  1185. const m___LDBL_EPSILON__ = 1.92592994438723585305597794258492732e-34
  1186. const m___LDBL_HAS_DENORM__ = 1
  1187. const m___LDBL_HAS_INFINITY__ = 1
  1188. const m___LDBL_HAS_QUIET_NAN__ = 1
  1189. const m___LDBL_IS_IEC_60559__ = 2
  1190. const m___LDBL_MANT_DIG__ = 113
  1191. const m___LDBL_MAX_10_EXP__ = 4932
  1192. const m___LDBL_MAX_EXP__ = 16384
  1193. const m___LDBL_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1194. const m___LDBL_MIN__ = 3.36210314311209350626267781732175260e-4932
  1195. const m___LDBL_NORM_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1196. const m___LDOUBLE_REDIRECTS_TO_FLOAT128_ABI = 0
  1197. const m___LITTLE_ENDIAN = 1234
  1198. const m___LONG_LONG_MAX__ = 0x7fffffffffffffff
  1199. const m___LONG_LONG_WIDTH__ = 64
  1200. const m___LONG_MAX = 0x7fffffffffffffff
  1201. const m___LONG_MAX__ = 0x7fffffffffffffff
  1202. const m___LONG_WIDTH__ = 64
  1203. const m___LP64__ = 1
  1204. const m___NO_INLINE__ = 1
  1205. const m___ORDER_BIG_ENDIAN__ = 4321
  1206. const m___ORDER_LITTLE_ENDIAN__ = 1234
  1207. const m___ORDER_PDP_ENDIAN__ = 3412
  1208. const m___PDP_ENDIAN = 3412
  1209. const m___PIC__ = 2
  1210. const m___PIE__ = 2
  1211. const m___PRAGMA_REDEFINE_EXTNAME = 1
  1212. const m___PRETTY_FUNCTION__ = "__func__"
  1213. const m___PTRDIFF_MAX__ = 0x7fffffffffffffff
  1214. const m___PTRDIFF_WIDTH__ = 64
  1215. const m___REENTRANT = 1
  1216. const m___SCHAR_MAX__ = 0x7f
  1217. const m___SCHAR_WIDTH__ = 8
  1218. const m___SHRT_MAX__ = 0x7fff
  1219. const m___SHRT_WIDTH__ = 16
  1220. const m___SIG_ATOMIC_MAX__ = 0x7fffffff
  1221. const m___SIG_ATOMIC_TYPE__ = "int"
  1222. const m___SIG_ATOMIC_WIDTH__ = 32
  1223. const m___SIZEOF_DOUBLE__ = 8
  1224. const m___SIZEOF_FLOAT__ = 4
  1225. const m___SIZEOF_INT128__ = 16
  1226. const m___SIZEOF_INT__ = 4
  1227. const m___SIZEOF_LONG_DOUBLE__ = 8
  1228. const m___SIZEOF_LONG_LONG__ = 8
  1229. const m___SIZEOF_LONG__ = 8
  1230. const m___SIZEOF_POINTER__ = 8
  1231. const m___SIZEOF_PTRDIFF_T__ = 8
  1232. const m___SIZEOF_SHORT__ = 2
  1233. const m___SIZEOF_SIZE_T__ = 8
  1234. const m___SIZEOF_WCHAR_T__ = 4
  1235. const m___SIZEOF_WINT_T__ = 4
  1236. const m___SIZE_MAX__ = 0xffffffffffffffff
  1237. const m___SIZE_WIDTH__ = 64
  1238. const m___STDC_HOSTED__ = 1
  1239. const m___STDC_IEC_559_COMPLEX__ = 1
  1240. const m___STDC_IEC_559__ = 1
  1241. const m___STDC_IEC_60559_BFP__ = 201404
  1242. const m___STDC_IEC_60559_COMPLEX__ = 201404
  1243. const m___STDC_ISO_10646__ = 201706
  1244. const m___STDC_UTF_16__ = 1
  1245. const m___STDC_UTF_32__ = 1
  1246. const m___STDC_VERSION__ = 201710
  1247. const m___STDC_WANT_IEC_60559_ATTRIBS_EXT__ = 1
  1248. const m___STDC_WANT_IEC_60559_BFP_EXT__ = 1
  1249. const m___STDC_WANT_IEC_60559_DFP_EXT__ = 1
  1250. const m___STDC_WANT_IEC_60559_FUNCS_EXT__ = 1
  1251. const m___STDC_WANT_IEC_60559_TYPES_EXT__ = 1
  1252. const m___STDC_WANT_LIB_EXT2__ = 1
  1253. const m___STDC_WANT_MATH_SPEC_FUNCS__ = 1
  1254. const m___STDC__ = 1
  1255. const m___UINT16_MAX__ = 0xffff
  1256. const m___UINT32_MAX__ = 0xffffffff
  1257. const m___UINT64_MAX__ = 0xffffffffffffffff
  1258. const m___UINT8_MAX__ = 0xff
  1259. const m___UINTMAX_MAX__ = 0xffffffffffffffff
  1260. const m___UINTPTR_MAX__ = 0xffffffffffffffff
  1261. const m___UINT_FAST16_MAX__ = 0xffffffffffffffff
  1262. const m___UINT_FAST32_MAX__ = 0xffffffffffffffff
  1263. const m___UINT_FAST64_MAX__ = 0xffffffffffffffff
  1264. const m___UINT_FAST8_MAX__ = 0xff
  1265. const m___UINT_LEAST16_MAX__ = 0xffff
  1266. const m___UINT_LEAST32_MAX__ = 0xffffffff
  1267. const m___UINT_LEAST64_MAX__ = 0xffffffffffffffff
  1268. const m___UINT_LEAST8_MAX__ = 0xff
  1269. const m___USE_TIME_BITS64 = 1
  1270. const m___VERSION__ = "12.2.0"
  1271. const m___WCHAR_MAX__ = 0xffffffff
  1272. const m___WCHAR_MIN__ = 0
  1273. const m___WCHAR_WIDTH__ = 32
  1274. const m___WINT_MAX__ = 0xffffffff
  1275. const m___WINT_MIN__ = 0
  1276. const m___WINT_WIDTH__ = 32
  1277. const m___WORDSIZE = 64
  1278. const m___WORDSIZE_TIME64_COMPAT32 = 0
  1279. const m___aarch64__ = 1
  1280. const m___glibc_c99_flexarr_available = 1
  1281. const m___gnu_linux__ = 1
  1282. const m___inline = "inline"
  1283. const m___linux = 1
  1284. const m___linux__ = 1
  1285. const m___pic__ = 2
  1286. const m___pie__ = 2
  1287. const m___restrict = "restrict"
  1288. const m___tm_gmtoff = "tm_gmtoff"
  1289. const m___tm_zone = "tm_zone"
  1290. const m___ucontext = "ucontext"
  1291. const m___unix = 1
  1292. const m___unix__ = 1
  1293. const m_alloca = "__builtin_alloca"
  1294. const m_inline = "__inline"
  1295. const m_linux = 1
  1296. const m_loff_t = "off_t"
  1297. const m_prlimit64 = "prlimit"
  1298. const m_unix = 1
  1299. type t__builtin_va_list = uintptr
  1300. type t__predefined_size_t = uint64
  1301. type t__predefined_wchar_t = uint32
  1302. type t__predefined_ptrdiff_t = int64
  1303. type Tsize_t = uint64
  1304. type Tssize_t = int64
  1305. type Tmode_t = uint32
  1306. type Toff_t = int64
  1307. type Tpid_t = int32
  1308. type Tiovec = struct {
  1309. Fiov_base uintptr
  1310. Fiov_len Tsize_t
  1311. }
  1312. type Tflock = struct {
  1313. Fl_type int16
  1314. Fl_whence int16
  1315. Fl_start Toff_t
  1316. Fl_len Toff_t
  1317. Fl_pid Tpid_t
  1318. }
  1319. type Tfile_handle = struct {
  1320. Fhandle_bytes uint32
  1321. Fhandle_type int32
  1322. }
  1323. type Tf_owner_ex = struct {
  1324. Ftype1 int32
  1325. Fpid Tpid_t
  1326. }
  1327. type Ttime_t = int64
  1328. type Tclock_t = int64
  1329. type Ttimespec = struct {
  1330. Ftv_sec Ttime_t
  1331. Ftv_nsec int64
  1332. }
  1333. type Tuid_t = uint32
  1334. type Tpthread_t = uintptr
  1335. type Tsigset_t = struct {
  1336. F__bits [16]uint64
  1337. }
  1338. type t__sigset_t = Tsigset_t
  1339. type Tpthread_attr_t = struct {
  1340. F__u struct {
  1341. F__vi [0][14]int32
  1342. F__s [0][7]uint64
  1343. F__i [14]int32
  1344. }
  1345. }
  1346. type Tstack_t = struct {
  1347. Fss_sp uintptr
  1348. Fss_flags int32
  1349. Fss_size Tsize_t
  1350. }
  1351. type Tsigaltstack = Tstack_t
  1352. type Tgreg_t = uint64
  1353. type Tgregset_t = [34]uint64
  1354. type Tfpregset_t = struct {
  1355. F__ccgo_align [0]uint64
  1356. Fvregs [32][2]uint64
  1357. Ffpsr uint32
  1358. Ffpcr uint32
  1359. F__ccgo_pad3 [8]byte
  1360. }
  1361. type Tmcontext_t = struct {
  1362. Ffault_address uint64
  1363. Fregs [31]uint64
  1364. Fsp uint64
  1365. Fpc uint64
  1366. Fpstate uint64
  1367. F__reserved [256]float64
  1368. }
  1369. type Tsigcontext = Tmcontext_t
  1370. type T_aarch64_ctx = struct {
  1371. Fmagic uint32
  1372. Fsize uint32
  1373. }
  1374. type Tfpsimd_context = struct {
  1375. F__ccgo_align [0]uint64
  1376. Fhead T_aarch64_ctx
  1377. Ffpsr uint32
  1378. Ffpcr uint32
  1379. Fvregs [32][2]uint64
  1380. }
  1381. type Tesr_context = struct {
  1382. Fhead T_aarch64_ctx
  1383. Fesr uint64
  1384. }
  1385. type Textra_context = struct {
  1386. Fhead T_aarch64_ctx
  1387. Fdatap uint64
  1388. Fsize uint32
  1389. F__reserved [3]uint32
  1390. }
  1391. type Tsve_context = struct {
  1392. Fhead T_aarch64_ctx
  1393. Fvl uint16
  1394. F__reserved [3]uint16
  1395. }
  1396. type Tucontext_t = struct {
  1397. Fuc_flags uint64
  1398. Fuc_link uintptr
  1399. Fuc_stack Tstack_t
  1400. Fuc_sigmask Tsigset_t
  1401. Fuc_mcontext Tmcontext_t
  1402. }
  1403. type Tucontext = Tucontext_t
  1404. type Tsigval = struct {
  1405. Fsival_ptr [0]uintptr
  1406. Fsival_int int32
  1407. F__ccgo_pad2 [4]byte
  1408. }
  1409. type Tsiginfo_t = struct {
  1410. Fsi_signo int32
  1411. Fsi_errno int32
  1412. Fsi_code int32
  1413. F__si_fields struct {
  1414. F__si_common [0]struct {
  1415. F__first struct {
  1416. F__timer [0]struct {
  1417. Fsi_timerid int32
  1418. Fsi_overrun int32
  1419. }
  1420. F__piduid struct {
  1421. Fsi_pid Tpid_t
  1422. Fsi_uid Tuid_t
  1423. }
  1424. }
  1425. F__second struct {
  1426. F__sigchld [0]struct {
  1427. Fsi_status int32
  1428. Fsi_utime Tclock_t
  1429. Fsi_stime Tclock_t
  1430. }
  1431. Fsi_value Tsigval
  1432. F__ccgo_pad2 [16]byte
  1433. }
  1434. }
  1435. F__sigfault [0]struct {
  1436. Fsi_addr uintptr
  1437. Fsi_addr_lsb int16
  1438. F__first struct {
  1439. Fsi_pkey [0]uint32
  1440. F__addr_bnd struct {
  1441. Fsi_lower uintptr
  1442. Fsi_upper uintptr
  1443. }
  1444. }
  1445. }
  1446. F__sigpoll [0]struct {
  1447. Fsi_band int64
  1448. Fsi_fd int32
  1449. }
  1450. F__sigsys [0]struct {
  1451. Fsi_call_addr uintptr
  1452. Fsi_syscall int32
  1453. Fsi_arch uint32
  1454. }
  1455. F__pad [112]uint8
  1456. }
  1457. }
  1458. type Tsigaction = struct {
  1459. F__sa_handler struct {
  1460. Fsa_sigaction [0]uintptr
  1461. Fsa_handler uintptr
  1462. }
  1463. Fsa_mask Tsigset_t
  1464. Fsa_flags int32
  1465. Fsa_restorer uintptr
  1466. }
  1467. type Tsigevent = struct {
  1468. Fsigev_value Tsigval
  1469. Fsigev_signo int32
  1470. Fsigev_notify int32
  1471. F__sev_fields struct {
  1472. Fsigev_notify_thread_id [0]Tpid_t
  1473. F__sev_thread [0]struct {
  1474. Fsigev_notify_function uintptr
  1475. Fsigev_notify_attributes uintptr
  1476. }
  1477. F__pad [48]uint8
  1478. }
  1479. }
  1480. type Tsig_t = uintptr
  1481. type Tsighandler_t = uintptr
  1482. type Tsig_atomic_t = int32
  1483. type Tuintptr_t = uint64
  1484. type Tintptr_t = int64
  1485. type Tint8_t = int8
  1486. type Tint16_t = int16
  1487. type Tint32_t = int32
  1488. type Tint64_t = int64
  1489. type Tintmax_t = int64
  1490. type Tuint8_t = uint8
  1491. type Tuint16_t = uint16
  1492. type Tuint32_t = uint32
  1493. type Tuint64_t = uint64
  1494. type Tuintmax_t = uint64
  1495. type Tint_fast8_t = int8
  1496. type Tint_fast64_t = int64
  1497. type Tint_least8_t = int8
  1498. type Tint_least16_t = int16
  1499. type Tint_least32_t = int32
  1500. type Tint_least64_t = int64
  1501. type Tuint_fast8_t = uint8
  1502. type Tuint_fast64_t = uint64
  1503. type Tuint_least8_t = uint8
  1504. type Tuint_least16_t = uint16
  1505. type Tuint_least32_t = uint32
  1506. type Tuint_least64_t = uint64
  1507. type Tint_fast16_t = int32
  1508. type Tint_fast32_t = int32
  1509. type Tuint_fast16_t = uint32
  1510. type Tuint_fast32_t = uint32
  1511. type Twchar_t = uint32
  1512. type Tdiv_t = struct {
  1513. Fquot int32
  1514. Frem int32
  1515. }
  1516. type Tldiv_t = struct {
  1517. Fquot int64
  1518. Frem int64
  1519. }
  1520. type Tlldiv_t = struct {
  1521. Fquot int64
  1522. Frem int64
  1523. }
  1524. type Tblksize_t = int32
  1525. type Tnlink_t = uint32
  1526. type Tregister_t = int64
  1527. type Tsuseconds_t = int64
  1528. type Tu_int64_t = uint64
  1529. type Tino_t = uint64
  1530. type Tdev_t = uint64
  1531. type Tblkcnt_t = int64
  1532. type Tfsblkcnt_t = uint64
  1533. type Tfsfilcnt_t = uint64
  1534. type Ttimer_t = uintptr
  1535. type Tclockid_t = int32
  1536. type Tid_t = uint32
  1537. type Tgid_t = uint32
  1538. type Tkey_t = int32
  1539. type Tuseconds_t = uint32
  1540. type Tpthread_once_t = int32
  1541. type Tpthread_key_t = uint32
  1542. type Tpthread_spinlock_t = int32
  1543. type Tpthread_mutexattr_t = struct {
  1544. F__attr uint32
  1545. }
  1546. type Tpthread_condattr_t = struct {
  1547. F__attr uint32
  1548. }
  1549. type Tpthread_barrierattr_t = struct {
  1550. F__attr uint32
  1551. }
  1552. type Tpthread_rwlockattr_t = struct {
  1553. F__attr [2]uint32
  1554. }
  1555. type Tpthread_mutex_t = struct {
  1556. F__u struct {
  1557. F__vi [0][10]int32
  1558. F__p [0][5]uintptr
  1559. F__i [10]int32
  1560. }
  1561. }
  1562. type Tpthread_cond_t = struct {
  1563. F__u struct {
  1564. F__vi [0][12]int32
  1565. F__p [0][6]uintptr
  1566. F__i [12]int32
  1567. }
  1568. }
  1569. type Tpthread_rwlock_t = struct {
  1570. F__u struct {
  1571. F__vi [0][14]int32
  1572. F__p [0][7]uintptr
  1573. F__i [14]int32
  1574. }
  1575. }
  1576. type Tpthread_barrier_t = struct {
  1577. F__u struct {
  1578. F__vi [0][8]int32
  1579. F__p [0][4]uintptr
  1580. F__i [8]int32
  1581. }
  1582. }
  1583. type Tu_int8_t = uint8
  1584. type Tu_int16_t = uint16
  1585. type Tu_int32_t = uint32
  1586. type Tcaddr_t = uintptr
  1587. type Tu_char = uint8
  1588. type Tu_short = uint16
  1589. type Tushort = uint16
  1590. type Tu_int = uint32
  1591. type Tuint = uint32
  1592. type Tu_long = uint64
  1593. type Tulong = uint64
  1594. type Tquad_t = int64
  1595. type Tu_quad_t = uint64
  1596. type Ttimeval = struct {
  1597. Ftv_sec Ttime_t
  1598. Ftv_usec Tsuseconds_t
  1599. }
  1600. type Tfd_mask = uint64
  1601. type Tfd_set = struct {
  1602. Ffds_bits [16]uint64
  1603. }
  1604. type Tva_list = uintptr
  1605. type t__isoc_va_list = uintptr
  1606. type Tfpos_t = struct {
  1607. F__lldata [0]int64
  1608. F__align [0]float64
  1609. F__opaque [16]uint8
  1610. }
  1611. type T_G_fpos64_t = Tfpos_t
  1612. type Tcookie_io_functions_t = struct {
  1613. Fread uintptr
  1614. Fwrite uintptr
  1615. Fseek uintptr
  1616. Fclose1 uintptr
  1617. }
  1618. type T_IO_cookie_io_functions_t = Tcookie_io_functions_t
  1619. type Tstat = struct {
  1620. Fst_dev Tdev_t
  1621. Fst_ino Tino_t
  1622. Fst_mode Tmode_t
  1623. Fst_nlink Tnlink_t
  1624. Fst_uid Tuid_t
  1625. Fst_gid Tgid_t
  1626. Fst_rdev Tdev_t
  1627. F__pad uint64
  1628. Fst_size Toff_t
  1629. Fst_blksize Tblksize_t
  1630. F__pad2 int32
  1631. Fst_blocks Tblkcnt_t
  1632. Fst_atim Ttimespec
  1633. Fst_mtim Ttimespec
  1634. Fst_ctim Ttimespec
  1635. F__unused [2]uint32
  1636. }
  1637. type Tstatx_timestamp = struct {
  1638. Ftv_sec Tint64_t
  1639. Ftv_nsec Tuint32_t
  1640. F__pad Tuint32_t
  1641. }
  1642. type Tstatx = struct {
  1643. Fstx_mask Tuint32_t
  1644. Fstx_blksize Tuint32_t
  1645. Fstx_attributes Tuint64_t
  1646. Fstx_nlink Tuint32_t
  1647. Fstx_uid Tuint32_t
  1648. Fstx_gid Tuint32_t
  1649. Fstx_mode Tuint16_t
  1650. F__pad0 [1]Tuint16_t
  1651. Fstx_ino Tuint64_t
  1652. Fstx_size Tuint64_t
  1653. Fstx_blocks Tuint64_t
  1654. Fstx_attributes_mask Tuint64_t
  1655. Fstx_atime Tstatx_timestamp
  1656. Fstx_btime Tstatx_timestamp
  1657. Fstx_ctime Tstatx_timestamp
  1658. Fstx_mtime Tstatx_timestamp
  1659. Fstx_rdev_major Tuint32_t
  1660. Fstx_rdev_minor Tuint32_t
  1661. Fstx_dev_major Tuint32_t
  1662. Fstx_dev_minor Tuint32_t
  1663. F__pad1 [14]Tuint64_t
  1664. }
  1665. type Tlocale_t = uintptr
  1666. type Titimerval = struct {
  1667. Fit_interval Ttimeval
  1668. Fit_value Ttimeval
  1669. }
  1670. type Ttimezone = struct {
  1671. Ftz_minuteswest int32
  1672. Ftz_dsttime int32
  1673. }
  1674. type Tu8 = uint8
  1675. type Tu32 = uint32
  1676. type Tchacha_ctx = struct {
  1677. Finput [16]Tu32
  1678. }
  1679. var _sigma = [16]uint8{'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'}
  1680. var _tau = [16]uint8{'e', 'x', 'p', 'a', 'n', 'd', ' ', '1', '6', '-', 'b', 'y', 't', 'e', ' ', 'k'}
  1681. func _chacha_keysetup(tls *libc.TLS, x uintptr, k uintptr, kbits Tu32) {
  1682. var constants uintptr
  1683. _ = constants
  1684. *(*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)
  1685. *(*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)
  1686. *(*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)
  1687. *(*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)
  1688. if kbits == uint32(256) {
  1689. k += uintptr(16)
  1690. constants = uintptr(unsafe.Pointer(&_sigma))
  1691. } else {
  1692. constants = uintptr(unsafe.Pointer(&_tau))
  1693. }
  1694. *(*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)
  1695. *(*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)
  1696. *(*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)
  1697. *(*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)
  1698. *(*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)
  1699. *(*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)
  1700. *(*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)
  1701. *(*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)
  1702. }
  1703. func _chacha_ivsetup(tls *libc.TLS, x uintptr, iv uintptr) {
  1704. *(*Tu32)(unsafe.Pointer(x + 12*4)) = uint32(0)
  1705. *(*Tu32)(unsafe.Pointer(x + 13*4)) = uint32(0)
  1706. *(*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)
  1707. *(*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)
  1708. }
  1709. func _chacha_encrypt_bytes(tls *libc.TLS, x uintptr, m uintptr, c uintptr, bytes Tu32) {
  1710. bp := tls.Alloc(64)
  1711. defer tls.Free(64)
  1712. var ctarget uintptr
  1713. var i uint32
  1714. 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
  1715. var _ /* tmp at bp+0 */ [64]Tu8
  1716. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  1717. ctarget = libc.UintptrFromInt32(0)
  1718. if !(bytes != 0) {
  1719. return
  1720. }
  1721. j0 = *(*Tu32)(unsafe.Pointer(x))
  1722. j1 = *(*Tu32)(unsafe.Pointer(x + 1*4))
  1723. j2 = *(*Tu32)(unsafe.Pointer(x + 2*4))
  1724. j3 = *(*Tu32)(unsafe.Pointer(x + 3*4))
  1725. j4 = *(*Tu32)(unsafe.Pointer(x + 4*4))
  1726. j5 = *(*Tu32)(unsafe.Pointer(x + 5*4))
  1727. j6 = *(*Tu32)(unsafe.Pointer(x + 6*4))
  1728. j7 = *(*Tu32)(unsafe.Pointer(x + 7*4))
  1729. j8 = *(*Tu32)(unsafe.Pointer(x + 8*4))
  1730. j9 = *(*Tu32)(unsafe.Pointer(x + 9*4))
  1731. j10 = *(*Tu32)(unsafe.Pointer(x + 10*4))
  1732. j11 = *(*Tu32)(unsafe.Pointer(x + 11*4))
  1733. j12 = *(*Tu32)(unsafe.Pointer(x + 12*4))
  1734. j13 = *(*Tu32)(unsafe.Pointer(x + 13*4))
  1735. j14 = *(*Tu32)(unsafe.Pointer(x + 14*4))
  1736. j15 = *(*Tu32)(unsafe.Pointer(x + 15*4))
  1737. for {
  1738. if bytes < uint32(64) {
  1739. i = uint32(0)
  1740. for {
  1741. if !(i < bytes) {
  1742. break
  1743. }
  1744. (*(*[64]Tu8)(unsafe.Pointer(bp)))[i] = *(*Tu8)(unsafe.Pointer(m + uintptr(i)))
  1745. goto _2
  1746. _2:
  1747. ;
  1748. i++
  1749. }
  1750. m = bp
  1751. ctarget = c
  1752. c = bp
  1753. }
  1754. x0 = j0
  1755. x1 = j1
  1756. x2 = j2
  1757. x3 = j3
  1758. x4 = j4
  1759. x5 = j5
  1760. x6 = j6
  1761. x7 = j7
  1762. x8 = j8
  1763. x9 = j9
  1764. x10 = j10
  1765. x11 = j11
  1766. x12 = j12
  1767. x13 = j13
  1768. x14 = j14
  1769. x15 = j15
  1770. i = uint32(20)
  1771. for {
  1772. if !(i > uint32(0)) {
  1773. break
  1774. }
  1775. x0 = (x0 + x4) & libc.Uint32FromUint32(0xFFFFFFFF)
  1776. x12 = (x12^x0)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x12^x0)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  1777. x8 = (x8 + x12) & libc.Uint32FromUint32(0xFFFFFFFF)
  1778. x4 = (x4^x8)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x4^x8)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  1779. x0 = (x0 + x4) & libc.Uint32FromUint32(0xFFFFFFFF)
  1780. x12 = (x12^x0)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x12^x0)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  1781. x8 = (x8 + x12) & libc.Uint32FromUint32(0xFFFFFFFF)
  1782. x4 = (x4^x8)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x4^x8)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  1783. x1 = (x1 + x5) & libc.Uint32FromUint32(0xFFFFFFFF)
  1784. x13 = (x13^x1)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x13^x1)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  1785. x9 = (x9 + x13) & libc.Uint32FromUint32(0xFFFFFFFF)
  1786. x5 = (x5^x9)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x5^x9)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  1787. x1 = (x1 + x5) & libc.Uint32FromUint32(0xFFFFFFFF)
  1788. x13 = (x13^x1)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x13^x1)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  1789. x9 = (x9 + x13) & libc.Uint32FromUint32(0xFFFFFFFF)
  1790. x5 = (x5^x9)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x5^x9)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  1791. x2 = (x2 + x6) & libc.Uint32FromUint32(0xFFFFFFFF)
  1792. x14 = (x14^x2)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x14^x2)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  1793. x10 = (x10 + x14) & libc.Uint32FromUint32(0xFFFFFFFF)
  1794. x6 = (x6^x10)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x6^x10)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  1795. x2 = (x2 + x6) & libc.Uint32FromUint32(0xFFFFFFFF)
  1796. x14 = (x14^x2)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x14^x2)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  1797. x10 = (x10 + x14) & libc.Uint32FromUint32(0xFFFFFFFF)
  1798. x6 = (x6^x10)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x6^x10)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  1799. x3 = (x3 + x7) & libc.Uint32FromUint32(0xFFFFFFFF)
  1800. x15 = (x15^x3)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x15^x3)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  1801. x11 = (x11 + x15) & libc.Uint32FromUint32(0xFFFFFFFF)
  1802. x7 = (x7^x11)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x7^x11)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  1803. x3 = (x3 + x7) & libc.Uint32FromUint32(0xFFFFFFFF)
  1804. x15 = (x15^x3)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x15^x3)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  1805. x11 = (x11 + x15) & libc.Uint32FromUint32(0xFFFFFFFF)
  1806. x7 = (x7^x11)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x7^x11)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  1807. x0 = (x0 + x5) & libc.Uint32FromUint32(0xFFFFFFFF)
  1808. x15 = (x15^x0)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x15^x0)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  1809. x10 = (x10 + x15) & libc.Uint32FromUint32(0xFFFFFFFF)
  1810. x5 = (x5^x10)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x5^x10)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  1811. x0 = (x0 + x5) & libc.Uint32FromUint32(0xFFFFFFFF)
  1812. x15 = (x15^x0)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x15^x0)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  1813. x10 = (x10 + x15) & libc.Uint32FromUint32(0xFFFFFFFF)
  1814. x5 = (x5^x10)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x5^x10)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  1815. x1 = (x1 + x6) & libc.Uint32FromUint32(0xFFFFFFFF)
  1816. x12 = (x12^x1)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x12^x1)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  1817. x11 = (x11 + x12) & libc.Uint32FromUint32(0xFFFFFFFF)
  1818. x6 = (x6^x11)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x6^x11)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  1819. x1 = (x1 + x6) & libc.Uint32FromUint32(0xFFFFFFFF)
  1820. x12 = (x12^x1)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x12^x1)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  1821. x11 = (x11 + x12) & libc.Uint32FromUint32(0xFFFFFFFF)
  1822. x6 = (x6^x11)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x6^x11)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  1823. x2 = (x2 + x7) & libc.Uint32FromUint32(0xFFFFFFFF)
  1824. x13 = (x13^x2)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x13^x2)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  1825. x8 = (x8 + x13) & libc.Uint32FromUint32(0xFFFFFFFF)
  1826. x7 = (x7^x8)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x7^x8)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  1827. x2 = (x2 + x7) & libc.Uint32FromUint32(0xFFFFFFFF)
  1828. x13 = (x13^x2)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x13^x2)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  1829. x8 = (x8 + x13) & libc.Uint32FromUint32(0xFFFFFFFF)
  1830. x7 = (x7^x8)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x7^x8)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  1831. x3 = (x3 + x4) & libc.Uint32FromUint32(0xFFFFFFFF)
  1832. x14 = (x14^x3)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x14^x3)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  1833. x9 = (x9 + x14) & libc.Uint32FromUint32(0xFFFFFFFF)
  1834. x4 = (x4^x9)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x4^x9)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  1835. x3 = (x3 + x4) & libc.Uint32FromUint32(0xFFFFFFFF)
  1836. x14 = (x14^x3)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x14^x3)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  1837. x9 = (x9 + x14) & libc.Uint32FromUint32(0xFFFFFFFF)
  1838. x4 = (x4^x9)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x4^x9)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  1839. goto _3
  1840. _3:
  1841. ;
  1842. i -= uint32(2)
  1843. }
  1844. x0 = (x0 + j0) & libc.Uint32FromUint32(0xFFFFFFFF)
  1845. x1 = (x1 + j1) & libc.Uint32FromUint32(0xFFFFFFFF)
  1846. x2 = (x2 + j2) & libc.Uint32FromUint32(0xFFFFFFFF)
  1847. x3 = (x3 + j3) & libc.Uint32FromUint32(0xFFFFFFFF)
  1848. x4 = (x4 + j4) & libc.Uint32FromUint32(0xFFFFFFFF)
  1849. x5 = (x5 + j5) & libc.Uint32FromUint32(0xFFFFFFFF)
  1850. x6 = (x6 + j6) & libc.Uint32FromUint32(0xFFFFFFFF)
  1851. x7 = (x7 + j7) & libc.Uint32FromUint32(0xFFFFFFFF)
  1852. x8 = (x8 + j8) & libc.Uint32FromUint32(0xFFFFFFFF)
  1853. x9 = (x9 + j9) & libc.Uint32FromUint32(0xFFFFFFFF)
  1854. x10 = (x10 + j10) & libc.Uint32FromUint32(0xFFFFFFFF)
  1855. x11 = (x11 + j11) & libc.Uint32FromUint32(0xFFFFFFFF)
  1856. x12 = (x12 + j12) & libc.Uint32FromUint32(0xFFFFFFFF)
  1857. x13 = (x13 + j13) & libc.Uint32FromUint32(0xFFFFFFFF)
  1858. x14 = (x14 + j14) & libc.Uint32FromUint32(0xFFFFFFFF)
  1859. x15 = (x15 + j15) & libc.Uint32FromUint32(0xFFFFFFFF)
  1860. j12 = (j12 + libc.Uint32FromInt32(libc.Int32FromInt32(1))) & libc.Uint32FromUint32(0xFFFFFFFF)
  1861. if !(j12 != 0) {
  1862. j13 = (j13 + libc.Uint32FromInt32(libc.Int32FromInt32(1))) & libc.Uint32FromUint32(0xFFFFFFFF)
  1863. }
  1864. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(0))) = uint8(uint32(uint8(x0)) & libc.Uint32FromUint32(0xFF))
  1865. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(0) + 1)) = uint8(uint32(uint8(x0>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1866. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(0) + 2)) = uint8(uint32(uint8(x0>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1867. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(0) + 3)) = uint8(uint32(uint8(x0>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1868. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(4))) = uint8(uint32(uint8(x1)) & libc.Uint32FromUint32(0xFF))
  1869. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(4) + 1)) = uint8(uint32(uint8(x1>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1870. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(4) + 2)) = uint8(uint32(uint8(x1>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1871. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(4) + 3)) = uint8(uint32(uint8(x1>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1872. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(8))) = uint8(uint32(uint8(x2)) & libc.Uint32FromUint32(0xFF))
  1873. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(8) + 1)) = uint8(uint32(uint8(x2>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1874. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(8) + 2)) = uint8(uint32(uint8(x2>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1875. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(8) + 3)) = uint8(uint32(uint8(x2>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1876. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(12))) = uint8(uint32(uint8(x3)) & libc.Uint32FromUint32(0xFF))
  1877. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(12) + 1)) = uint8(uint32(uint8(x3>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1878. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(12) + 2)) = uint8(uint32(uint8(x3>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1879. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(12) + 3)) = uint8(uint32(uint8(x3>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1880. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(16))) = uint8(uint32(uint8(x4)) & libc.Uint32FromUint32(0xFF))
  1881. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(16) + 1)) = uint8(uint32(uint8(x4>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1882. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(16) + 2)) = uint8(uint32(uint8(x4>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1883. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(16) + 3)) = uint8(uint32(uint8(x4>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1884. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(20))) = uint8(uint32(uint8(x5)) & libc.Uint32FromUint32(0xFF))
  1885. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(20) + 1)) = uint8(uint32(uint8(x5>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1886. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(20) + 2)) = uint8(uint32(uint8(x5>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1887. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(20) + 3)) = uint8(uint32(uint8(x5>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1888. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(24))) = uint8(uint32(uint8(x6)) & libc.Uint32FromUint32(0xFF))
  1889. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(24) + 1)) = uint8(uint32(uint8(x6>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1890. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(24) + 2)) = uint8(uint32(uint8(x6>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1891. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(24) + 3)) = uint8(uint32(uint8(x6>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1892. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(28))) = uint8(uint32(uint8(x7)) & libc.Uint32FromUint32(0xFF))
  1893. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(28) + 1)) = uint8(uint32(uint8(x7>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1894. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(28) + 2)) = uint8(uint32(uint8(x7>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1895. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(28) + 3)) = uint8(uint32(uint8(x7>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1896. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(32))) = uint8(uint32(uint8(x8)) & libc.Uint32FromUint32(0xFF))
  1897. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(32) + 1)) = uint8(uint32(uint8(x8>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1898. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(32) + 2)) = uint8(uint32(uint8(x8>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1899. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(32) + 3)) = uint8(uint32(uint8(x8>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1900. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(36))) = uint8(uint32(uint8(x9)) & libc.Uint32FromUint32(0xFF))
  1901. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(36) + 1)) = uint8(uint32(uint8(x9>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1902. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(36) + 2)) = uint8(uint32(uint8(x9>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1903. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(36) + 3)) = uint8(uint32(uint8(x9>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1904. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(40))) = uint8(uint32(uint8(x10)) & libc.Uint32FromUint32(0xFF))
  1905. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(40) + 1)) = uint8(uint32(uint8(x10>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1906. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(40) + 2)) = uint8(uint32(uint8(x10>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1907. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(40) + 3)) = uint8(uint32(uint8(x10>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1908. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(44))) = uint8(uint32(uint8(x11)) & libc.Uint32FromUint32(0xFF))
  1909. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(44) + 1)) = uint8(uint32(uint8(x11>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1910. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(44) + 2)) = uint8(uint32(uint8(x11>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1911. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(44) + 3)) = uint8(uint32(uint8(x11>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1912. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(48))) = uint8(uint32(uint8(x12)) & libc.Uint32FromUint32(0xFF))
  1913. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(48) + 1)) = uint8(uint32(uint8(x12>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1914. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(48) + 2)) = uint8(uint32(uint8(x12>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1915. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(48) + 3)) = uint8(uint32(uint8(x12>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1916. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(52))) = uint8(uint32(uint8(x13)) & libc.Uint32FromUint32(0xFF))
  1917. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(52) + 1)) = uint8(uint32(uint8(x13>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1918. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(52) + 2)) = uint8(uint32(uint8(x13>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1919. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(52) + 3)) = uint8(uint32(uint8(x13>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1920. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(56))) = uint8(uint32(uint8(x14)) & libc.Uint32FromUint32(0xFF))
  1921. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(56) + 1)) = uint8(uint32(uint8(x14>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1922. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(56) + 2)) = uint8(uint32(uint8(x14>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1923. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(56) + 3)) = uint8(uint32(uint8(x14>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1924. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(60))) = uint8(uint32(uint8(x15)) & libc.Uint32FromUint32(0xFF))
  1925. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(60) + 1)) = uint8(uint32(uint8(x15>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1926. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(60) + 2)) = uint8(uint32(uint8(x15>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1927. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(60) + 3)) = uint8(uint32(uint8(x15>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1928. if bytes <= uint32(64) {
  1929. if bytes < uint32(64) {
  1930. i = uint32(0)
  1931. for {
  1932. if !(i < bytes) {
  1933. break
  1934. }
  1935. *(*Tu8)(unsafe.Pointer(ctarget + uintptr(i))) = *(*Tu8)(unsafe.Pointer(c + uintptr(i)))
  1936. goto _4
  1937. _4:
  1938. ;
  1939. i++
  1940. }
  1941. }
  1942. *(*Tu32)(unsafe.Pointer(x + 12*4)) = j12
  1943. *(*Tu32)(unsafe.Pointer(x + 13*4)) = j13
  1944. return
  1945. }
  1946. bytes -= uint32(64)
  1947. c += uintptr(64)
  1948. goto _1
  1949. _1:
  1950. }
  1951. }
  1952. // C documentation
  1953. //
  1954. // /* Marked MAP_INHERIT_ZERO, so zero'd out in fork children. */
  1955. type T_rs = struct {
  1956. Frs_have Tsize_t
  1957. Frs_count Tsize_t
  1958. }
  1959. // C documentation
  1960. //
  1961. // /* Marked MAP_INHERIT_ZERO, so zero'd out in fork children. */
  1962. var _rs uintptr
  1963. // C documentation
  1964. //
  1965. // /* Maybe be preserved in fork children, if _rs_allocate() decides. */
  1966. type T_rsx = struct {
  1967. Frs_chacha Tchacha_ctx
  1968. Frs_buf [1024]uint8
  1969. }
  1970. // C documentation
  1971. //
  1972. // /* Maybe be preserved in fork children, if _rs_allocate() decides. */
  1973. var _rsx uintptr
  1974. type Trlim_t = uint64
  1975. type Trlimit = struct {
  1976. Frlim_cur Trlim_t
  1977. Frlim_max Trlim_t
  1978. }
  1979. type Trusage = struct {
  1980. Fru_utime Ttimeval
  1981. Fru_stime Ttimeval
  1982. Fru_maxrss int64
  1983. Fru_ixrss int64
  1984. Fru_idrss int64
  1985. Fru_isrss int64
  1986. Fru_minflt int64
  1987. Fru_majflt int64
  1988. Fru_nswap int64
  1989. Fru_inblock int64
  1990. Fru_oublock int64
  1991. Fru_msgsnd int64
  1992. Fru_msgrcv int64
  1993. Fru_nsignals int64
  1994. Fru_nvcsw int64
  1995. Fru_nivcsw int64
  1996. F__reserved [16]int64
  1997. }
  1998. type Tsched_param = struct {
  1999. Fsched_priority int32
  2000. F__reserved1 int32
  2001. F__reserved2 [2]struct {
  2002. F__reserved1 Ttime_t
  2003. F__reserved2 int64
  2004. }
  2005. F__reserved3 int32
  2006. }
  2007. type Tcpu_set_t = struct {
  2008. F__bits [16]uint64
  2009. }
  2010. type Ttm = struct {
  2011. Ftm_sec int32
  2012. Ftm_min int32
  2013. Ftm_hour int32
  2014. Ftm_mday int32
  2015. Ftm_mon int32
  2016. Ftm_year int32
  2017. Ftm_wday int32
  2018. Ftm_yday int32
  2019. Ftm_isdst int32
  2020. Ftm_gmtoff int64
  2021. Ftm_zone uintptr
  2022. }
  2023. type Titimerspec = struct {
  2024. Fit_interval Ttimespec
  2025. Fit_value Ttimespec
  2026. }
  2027. type t__ptcb = struct {
  2028. F__f uintptr
  2029. F__x uintptr
  2030. F__next uintptr
  2031. }
  2032. type Tcpu_set_t1 = struct {
  2033. F__bits [16]uint64
  2034. }
  2035. var _arc4random_mtx = Tpthread_mutex_t{}
  2036. var __rs_forked Tsig_atomic_t
  2037. func __rs_init(tls *libc.TLS, buf uintptr, n Tsize_t) {
  2038. var v1, v2, v3, v6 uintptr
  2039. var v4 int32
  2040. _, _, _, _, _ = v1, v2, v3, v4, v6
  2041. if n < libc.Uint64FromInt32(libc.Int32FromInt32(m_KEYSZ)+libc.Int32FromInt32(m_IVSZ)) {
  2042. return
  2043. }
  2044. if _rs == libc.UintptrFromInt32(0) {
  2045. v1 = uintptr(unsafe.Pointer(&_rs))
  2046. v2 = uintptr(unsafe.Pointer(&_rsx))
  2047. v3 = libc.Xmmap(tls, libc.UintptrFromInt32(0), uint64(16), libc.Int32FromInt32(m_PROT_READ)|libc.Int32FromInt32(m_PROT_WRITE), libc.Int32FromInt32(m_MAP_ANON)|libc.Int32FromInt32(m_MAP_PRIVATE), -int32(1), 0)
  2048. *(*uintptr)(unsafe.Pointer(v1)) = v3
  2049. if v3 == uintptr(-libc.Int32FromInt32(1)) {
  2050. v4 = -int32(1)
  2051. goto _5
  2052. }
  2053. v6 = libc.Xmmap(tls, libc.UintptrFromInt32(0), uint64(1088), libc.Int32FromInt32(m_PROT_READ)|libc.Int32FromInt32(m_PROT_WRITE), libc.Int32FromInt32(m_MAP_ANON)|libc.Int32FromInt32(m_MAP_PRIVATE), -int32(1), 0)
  2054. *(*uintptr)(unsafe.Pointer(v2)) = v6
  2055. if v6 == uintptr(-libc.Int32FromInt32(1)) {
  2056. libc.Xmunmap(tls, *(*uintptr)(unsafe.Pointer(v1)), uint64(16))
  2057. *(*uintptr)(unsafe.Pointer(v1)) = libc.UintptrFromInt32(0)
  2058. v4 = -int32(1)
  2059. goto _5
  2060. }
  2061. libc.Xpthread_atfork(tls, libc.UintptrFromInt32(0), libc.UintptrFromInt32(0), __ccgo_fp(__rs_forkhandler))
  2062. v4 = 0
  2063. goto _5
  2064. _5:
  2065. if v4 == -int32(1) {
  2066. libc.X_exit(tls, int32(1))
  2067. }
  2068. }
  2069. _chacha_keysetup(tls, _rsx, buf, libc.Uint32FromInt32(libc.Int32FromInt32(m_KEYSZ)*libc.Int32FromInt32(8)))
  2070. _chacha_ivsetup(tls, _rsx, buf+uintptr(m_KEYSZ))
  2071. }
  2072. func __rs_rekey(tls *libc.TLS, dat uintptr, datlen Tsize_t) {
  2073. var i, m Tsize_t
  2074. var v1 uint64
  2075. var p3 uintptr
  2076. _, _, _, _ = i, m, v1, p3
  2077. /* fill rs_buf with the keystream */
  2078. _chacha_encrypt_bytes(tls, _rsx, _rsx+64, _rsx+64, uint32(1024))
  2079. /* mix in optional user provided data */
  2080. if dat != 0 {
  2081. if datlen < libc.Uint64FromInt32(libc.Int32FromInt32(m_KEYSZ)+libc.Int32FromInt32(m_IVSZ)) {
  2082. v1 = datlen
  2083. } else {
  2084. v1 = libc.Uint64FromInt32(libc.Int32FromInt32(m_KEYSZ) + libc.Int32FromInt32(m_IVSZ))
  2085. }
  2086. m = v1
  2087. i = uint64(0)
  2088. for {
  2089. if !(i < m) {
  2090. break
  2091. }
  2092. p3 = _rsx + 64 + uintptr(i)
  2093. *(*uint8)(unsafe.Pointer(p3)) = uint8(int32(*(*uint8)(unsafe.Pointer(p3))) ^ libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(dat + uintptr(i)))))
  2094. goto _2
  2095. _2:
  2096. ;
  2097. i++
  2098. }
  2099. }
  2100. /* immediately reinit for backtracking resistance */
  2101. __rs_init(tls, _rsx+64, libc.Uint64FromInt32(libc.Int32FromInt32(m_KEYSZ)+libc.Int32FromInt32(m_IVSZ)))
  2102. libc.Xmemset(tls, _rsx+64, 0, libc.Uint64FromInt32(libc.Int32FromInt32(m_KEYSZ)+libc.Int32FromInt32(m_IVSZ)))
  2103. (*T_rs)(unsafe.Pointer(_rs)).Frs_have = libc.Uint64FromInt64(1024) - libc.Uint64FromInt32(m_KEYSZ) - libc.Uint64FromInt32(m_IVSZ)
  2104. }
  2105. func __rs_stir(tls *libc.TLS) {
  2106. bp := tls.Alloc(48)
  2107. defer tls.Free(48)
  2108. var _ /* rekey_fuzz at bp+40 */ Tuint32_t
  2109. var _ /* rnd at bp+0 */ [40]uint8
  2110. *(*Tuint32_t)(unsafe.Pointer(bp + 40)) = uint32(0)
  2111. if Xgetentropy(tls, bp, uint64(40)) == -int32(1) {
  2112. libc.Xraise(tls, int32(m_SIGKILL))
  2113. }
  2114. if !(_rs != 0) {
  2115. __rs_init(tls, bp, uint64(40))
  2116. } else {
  2117. __rs_rekey(tls, bp, uint64(40))
  2118. }
  2119. Xexplicit_bzero(tls, bp, uint64(40)) /* discard source seed */
  2120. /* invalidate rs_buf */
  2121. (*T_rs)(unsafe.Pointer(_rs)).Frs_have = uint64(0)
  2122. libc.Xmemset(tls, _rsx+64, 0, uint64(1024))
  2123. /* rekey interval should not be predictable */
  2124. _chacha_encrypt_bytes(tls, _rsx, bp+40, bp+40, uint32(4))
  2125. (*T_rs)(unsafe.Pointer(_rs)).Frs_count = uint64(libc.Uint32FromInt32(libc.Int32FromInt32(1024)*libc.Int32FromInt32(1024)) + *(*Tuint32_t)(unsafe.Pointer(bp + 40))%libc.Uint32FromInt32(libc.Int32FromInt32(1024)*libc.Int32FromInt32(1024)))
  2126. }
  2127. func __rs_stir_if_needed(tls *libc.TLS, len1 Tsize_t) {
  2128. __rs_forkdetect(tls)
  2129. if !(_rs != 0) || (*T_rs)(unsafe.Pointer(_rs)).Frs_count <= len1 {
  2130. __rs_stir(tls)
  2131. }
  2132. if (*T_rs)(unsafe.Pointer(_rs)).Frs_count <= len1 {
  2133. (*T_rs)(unsafe.Pointer(_rs)).Frs_count = uint64(0)
  2134. } else {
  2135. *(*Tsize_t)(unsafe.Pointer(_rs + 8)) -= len1
  2136. }
  2137. }
  2138. func __rs_random_buf(tls *libc.TLS, _buf uintptr, n Tsize_t) {
  2139. var buf, keystream uintptr
  2140. var m Tsize_t
  2141. var v1 uint64
  2142. _, _, _, _ = buf, keystream, m, v1
  2143. buf = _buf
  2144. __rs_stir_if_needed(tls, n)
  2145. for n > uint64(0) {
  2146. if (*T_rs)(unsafe.Pointer(_rs)).Frs_have > uint64(0) {
  2147. if n < (*T_rs)(unsafe.Pointer(_rs)).Frs_have {
  2148. v1 = n
  2149. } else {
  2150. v1 = (*T_rs)(unsafe.Pointer(_rs)).Frs_have
  2151. }
  2152. m = v1
  2153. keystream = _rsx + 64 + uintptr(1024) - uintptr((*T_rs)(unsafe.Pointer(_rs)).Frs_have)
  2154. libc.Xmemcpy(tls, buf, keystream, m)
  2155. libc.Xmemset(tls, keystream, 0, m)
  2156. buf += uintptr(m)
  2157. n -= m
  2158. *(*Tsize_t)(unsafe.Pointer(_rs)) -= m
  2159. }
  2160. if (*T_rs)(unsafe.Pointer(_rs)).Frs_have == uint64(0) {
  2161. __rs_rekey(tls, libc.UintptrFromInt32(0), uint64(0))
  2162. }
  2163. }
  2164. }
  2165. func __rs_random_u32(tls *libc.TLS, val uintptr) {
  2166. var keystream uintptr
  2167. _ = keystream
  2168. __rs_stir_if_needed(tls, uint64(4))
  2169. if (*T_rs)(unsafe.Pointer(_rs)).Frs_have < uint64(4) {
  2170. __rs_rekey(tls, libc.UintptrFromInt32(0), uint64(0))
  2171. }
  2172. keystream = _rsx + 64 + uintptr(1024) - uintptr((*T_rs)(unsafe.Pointer(_rs)).Frs_have)
  2173. libc.Xmemcpy(tls, val, keystream, uint64(4))
  2174. libc.Xmemset(tls, keystream, 0, uint64(4))
  2175. *(*Tsize_t)(unsafe.Pointer(_rs)) -= uint64(4)
  2176. }
  2177. func Xarc4random_stir(tls *libc.TLS) {
  2178. libc.Xpthread_mutex_lock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2179. __rs_stir(tls)
  2180. libc.Xpthread_mutex_unlock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2181. }
  2182. func Xarc4random_addrandom(tls *libc.TLS, dat uintptr, datlen int32) {
  2183. libc.Xpthread_mutex_lock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2184. __rs_stir_if_needed(tls, libc.Uint64FromInt32(datlen))
  2185. __rs_rekey(tls, dat, libc.Uint64FromInt32(datlen))
  2186. libc.Xpthread_mutex_unlock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2187. }
  2188. func Xarc4random(tls *libc.TLS) (r Tuint32_t) {
  2189. bp := tls.Alloc(16)
  2190. defer tls.Free(16)
  2191. var _ /* val at bp+0 */ Tuint32_t
  2192. libc.Xpthread_mutex_lock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2193. __rs_random_u32(tls, bp)
  2194. libc.Xpthread_mutex_unlock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2195. return *(*Tuint32_t)(unsafe.Pointer(bp))
  2196. }
  2197. func Xarc4random_buf(tls *libc.TLS, buf uintptr, n Tsize_t) {
  2198. libc.Xpthread_mutex_lock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2199. __rs_random_buf(tls, buf, n)
  2200. libc.Xpthread_mutex_unlock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2201. }
  2202. // C documentation
  2203. //
  2204. // /*
  2205. // * Calculate a uniformly distributed random number less than upper_bound
  2206. // * avoiding "modulo bias".
  2207. // *
  2208. // * Uniformity is achieved by generating new random numbers until the one
  2209. // * returned is outside the range [0, 2**32 % upper_bound). This
  2210. // * guarantees the selected random number will be inside
  2211. // * [2**32 % upper_bound, 2**32) which maps back to [0, upper_bound)
  2212. // * after reduction modulo upper_bound.
  2213. // */
  2214. func Xarc4random_uniform(tls *libc.TLS, upper_bound Tuint32_t) (r1 Tuint32_t) {
  2215. var min, r Tuint32_t
  2216. _, _ = min, r
  2217. if upper_bound < uint32(2) {
  2218. return uint32(0)
  2219. }
  2220. /* 2**32 % x == (2**32 - x) % x */
  2221. min = -upper_bound % upper_bound
  2222. /*
  2223. * This could theoretically loop forever but each retry has
  2224. * p > 0.5 (worst case, usually far better) of selecting a
  2225. * number inside the range we need, so it should rarely need
  2226. * to re-roll.
  2227. */
  2228. for {
  2229. r = Xarc4random(tls)
  2230. if r >= min {
  2231. break
  2232. }
  2233. goto _1
  2234. _1:
  2235. }
  2236. return r % upper_bound
  2237. }
  2238. const m_SEEK_CUR = 1
  2239. const m_SEEK_END = 2
  2240. const m_SEEK_SET = 0
  2241. const m_no_argument = 0
  2242. const m_optional_argument = 2
  2243. const m_required_argument = 1
  2244. type Toption = struct {
  2245. Fname uintptr
  2246. Fhas_arg int32
  2247. Fflag uintptr
  2248. Fval int32
  2249. }
  2250. func Xbsd_getopt(tls *libc.TLS, argc int32, argv uintptr, shortopts uintptr) (r int32) {
  2251. if Xoptreset == int32(1) {
  2252. Xoptreset = 0
  2253. libc.Xoptind = 0
  2254. }
  2255. /*
  2256. * Make sure we are using the system getopt() and not a possible
  2257. * overlay macro.
  2258. */
  2259. return libc.Xgetopt(tls, argc, argv, shortopts)
  2260. }
  2261. const m_DT_BLK = 6
  2262. const m_DT_CHR = 2
  2263. const m_DT_DIR = 4
  2264. const m_DT_FIFO = 1
  2265. const m_DT_LNK = 10
  2266. const m_DT_REG = 8
  2267. const m_DT_SOCK = 12
  2268. const m_DT_UNKNOWN = 0
  2269. const m_DT_WHT = 14
  2270. const m_E2BIG = 7
  2271. const m_EACCES = 13
  2272. const m_EADDRINUSE = 98
  2273. const m_EADDRNOTAVAIL = 99
  2274. const m_EADV = 68
  2275. const m_EAFNOSUPPORT = 97
  2276. const m_EAGAIN = 11
  2277. const m_EALREADY = 114
  2278. const m_EBADE = 52
  2279. const m_EBADF = 9
  2280. const m_EBADFD = 77
  2281. const m_EBADMSG = 74
  2282. const m_EBADR = 53
  2283. const m_EBADRQC = 56
  2284. const m_EBADSLT = 57
  2285. const m_EBFONT = 59
  2286. const m_EBUSY = 16
  2287. const m_ECANCELED = 125
  2288. const m_ECHILD = 10
  2289. const m_ECHRNG = 44
  2290. const m_ECOMM = 70
  2291. const m_ECONNABORTED = 103
  2292. const m_ECONNREFUSED = 111
  2293. const m_ECONNRESET = 104
  2294. const m_EDEADLK = 35
  2295. const m_EDEADLOCK = "EDEADLK"
  2296. const m_EDESTADDRREQ = 89
  2297. const m_EDOM = 33
  2298. const m_EDOTDOT = 73
  2299. const m_EDQUOT = 122
  2300. const m_EEXIST = 17
  2301. const m_EFAULT = 14
  2302. const m_EFBIG = 27
  2303. const m_EHOSTDOWN = 112
  2304. const m_EHOSTUNREACH = 113
  2305. const m_EHWPOISON = 133
  2306. const m_EIDRM = 43
  2307. const m_EILSEQ = 84
  2308. const m_EINPROGRESS = 115
  2309. const m_EINTR = 4
  2310. const m_EINVAL = 22
  2311. const m_EIO = 5
  2312. const m_EISCONN = 106
  2313. const m_EISDIR = 21
  2314. const m_EISNAM = 120
  2315. const m_EKEYEXPIRED = 127
  2316. const m_EKEYREJECTED = 129
  2317. const m_EKEYREVOKED = 128
  2318. const m_EL2HLT = 51
  2319. const m_EL2NSYNC = 45
  2320. const m_EL3HLT = 46
  2321. const m_EL3RST = 47
  2322. const m_ELIBACC = 79
  2323. const m_ELIBBAD = 80
  2324. const m_ELIBEXEC = 83
  2325. const m_ELIBMAX = 82
  2326. const m_ELIBSCN = 81
  2327. const m_ELNRNG = 48
  2328. const m_ELOOP = 40
  2329. const m_EMEDIUMTYPE = 124
  2330. const m_EMFILE = 24
  2331. const m_EMLINK = 31
  2332. const m_EMSGSIZE = 90
  2333. const m_EMULTIHOP = 72
  2334. const m_ENAMETOOLONG = 36
  2335. const m_ENAVAIL = 119
  2336. const m_ENETDOWN = 100
  2337. const m_ENETRESET = 102
  2338. const m_ENETUNREACH = 101
  2339. const m_ENFILE = 23
  2340. const m_ENOANO = 55
  2341. const m_ENOBUFS = 105
  2342. const m_ENOCSI = 50
  2343. const m_ENODATA = 61
  2344. const m_ENODEV = 19
  2345. const m_ENOENT = 2
  2346. const m_ENOEXEC = 8
  2347. const m_ENOKEY = 126
  2348. const m_ENOLCK = 37
  2349. const m_ENOLINK = 67
  2350. const m_ENOMEDIUM = 123
  2351. const m_ENOMEM = 12
  2352. const m_ENOMSG = 42
  2353. const m_ENONET = 64
  2354. const m_ENOPKG = 65
  2355. const m_ENOPROTOOPT = 92
  2356. const m_ENOSPC = 28
  2357. const m_ENOSR = 63
  2358. const m_ENOSTR = 60
  2359. const m_ENOSYS = 38
  2360. const m_ENOTBLK = 15
  2361. const m_ENOTCONN = 107
  2362. const m_ENOTDIR = 20
  2363. const m_ENOTEMPTY = 39
  2364. const m_ENOTNAM = 118
  2365. const m_ENOTRECOVERABLE = 131
  2366. const m_ENOTSOCK = 88
  2367. const m_ENOTSUP = "EOPNOTSUPP"
  2368. const m_ENOTTY = 25
  2369. const m_ENOTUNIQ = 76
  2370. const m_ENXIO = 6
  2371. const m_EOPNOTSUPP = 95
  2372. const m_EOVERFLOW = 75
  2373. const m_EOWNERDEAD = 130
  2374. const m_EPERM = 1
  2375. const m_EPFNOSUPPORT = 96
  2376. const m_EPIPE = 32
  2377. const m_EPROTO = 71
  2378. const m_EPROTONOSUPPORT = 93
  2379. const m_EPROTOTYPE = 91
  2380. const m_ERANGE = 34
  2381. const m_EREMCHG = 78
  2382. const m_EREMOTE = 66
  2383. const m_EREMOTEIO = 121
  2384. const m_ERESTART = 85
  2385. const m_ERFKILL = 132
  2386. const m_EROFS = 30
  2387. const m_ESHUTDOWN = 108
  2388. const m_ESOCKTNOSUPPORT = 94
  2389. const m_ESPIPE = 29
  2390. const m_ESRCH = 3
  2391. const m_ESRMNT = 69
  2392. const m_ESTALE = 116
  2393. const m_ESTRPIPE = 86
  2394. const m_ETIME = 62
  2395. const m_ETIMEDOUT = 110
  2396. const m_ETOOMANYREFS = 109
  2397. const m_ETXTBSY = 26
  2398. const m_EUCLEAN = 117
  2399. const m_EUNATCH = 49
  2400. const m_EUSERS = 87
  2401. const m_EWOULDBLOCK = "EAGAIN"
  2402. const m_EXDEV = 18
  2403. const m_EXFULL = 54
  2404. const m_INT_MAX1 = 2147483647
  2405. const m_OPEN_MAX = 256
  2406. const m_SYS_accept = 202
  2407. const m_SYS_accept4 = 242
  2408. const m_SYS_acct = 89
  2409. const m_SYS_add_key = 217
  2410. const m_SYS_adjtimex = 171
  2411. const m_SYS_bind = 200
  2412. const m_SYS_bpf = 280
  2413. const m_SYS_brk = 214
  2414. const m_SYS_cachestat = 451
  2415. const m_SYS_capget = 90
  2416. const m_SYS_capset = 91
  2417. const m_SYS_chdir = 49
  2418. const m_SYS_chroot = 51
  2419. const m_SYS_clock_adjtime = 266
  2420. const m_SYS_clock_getres = 114
  2421. const m_SYS_clock_gettime = 113
  2422. const m_SYS_clock_nanosleep = 115
  2423. const m_SYS_clock_settime = 112
  2424. const m_SYS_clone = 220
  2425. const m_SYS_clone3 = 435
  2426. const m_SYS_close = 57
  2427. const m_SYS_close_range = 436
  2428. const m_SYS_connect = 203
  2429. const m_SYS_copy_file_range = 285
  2430. const m_SYS_delete_module = 106
  2431. const m_SYS_dup = 23
  2432. const m_SYS_dup3 = 24
  2433. const m_SYS_epoll_create1 = 20
  2434. const m_SYS_epoll_ctl = 21
  2435. const m_SYS_epoll_pwait = 22
  2436. const m_SYS_epoll_pwait2 = 441
  2437. const m_SYS_eventfd2 = 19
  2438. const m_SYS_execve = 221
  2439. const m_SYS_execveat = 281
  2440. const m_SYS_exit = 93
  2441. const m_SYS_exit_group = 94
  2442. const m_SYS_faccessat = 48
  2443. const m_SYS_faccessat2 = 439
  2444. const m_SYS_fadvise64 = 223
  2445. const m_SYS_fallocate = 47
  2446. const m_SYS_fanotify_init = 262
  2447. const m_SYS_fanotify_mark = 263
  2448. const m_SYS_fchdir = 50
  2449. const m_SYS_fchmod = 52
  2450. const m_SYS_fchmodat = 53
  2451. const m_SYS_fchmodat2 = 452
  2452. const m_SYS_fchown = 55
  2453. const m_SYS_fchownat = 54
  2454. const m_SYS_fcntl = 25
  2455. const m_SYS_fdatasync = 83
  2456. const m_SYS_fgetxattr = 10
  2457. const m_SYS_finit_module = 273
  2458. const m_SYS_flistxattr = 13
  2459. const m_SYS_flock = 32
  2460. const m_SYS_fremovexattr = 16
  2461. const m_SYS_fsconfig = 431
  2462. const m_SYS_fsetxattr = 7
  2463. const m_SYS_fsmount = 432
  2464. const m_SYS_fsopen = 430
  2465. const m_SYS_fspick = 433
  2466. const m_SYS_fstat = 80
  2467. const m_SYS_fstatfs = 44
  2468. const m_SYS_fsync = 82
  2469. const m_SYS_ftruncate = 46
  2470. const m_SYS_futex = 98
  2471. const m_SYS_futex_waitv = 449
  2472. const m_SYS_get_mempolicy = 236
  2473. const m_SYS_get_robust_list = 100
  2474. const m_SYS_getcpu = 168
  2475. const m_SYS_getcwd = 17
  2476. const m_SYS_getdents64 = 61
  2477. const m_SYS_getegid = 177
  2478. const m_SYS_geteuid = 175
  2479. const m_SYS_getgid = 176
  2480. const m_SYS_getgroups = 158
  2481. const m_SYS_getitimer = 102
  2482. const m_SYS_getpeername = 205
  2483. const m_SYS_getpgid = 155
  2484. const m_SYS_getpid = 172
  2485. const m_SYS_getppid = 173
  2486. const m_SYS_getpriority = 141
  2487. const m_SYS_getrandom = 278
  2488. const m_SYS_getresgid = 150
  2489. const m_SYS_getresuid = 148
  2490. const m_SYS_getrlimit = 163
  2491. const m_SYS_getrusage = 165
  2492. const m_SYS_getsid = 156
  2493. const m_SYS_getsockname = 204
  2494. const m_SYS_getsockopt = 209
  2495. const m_SYS_gettid = 178
  2496. const m_SYS_gettimeofday = 169
  2497. const m_SYS_getuid = 174
  2498. const m_SYS_getxattr = 8
  2499. const m_SYS_init_module = 105
  2500. const m_SYS_inotify_add_watch = 27
  2501. const m_SYS_inotify_init1 = 26
  2502. const m_SYS_inotify_rm_watch = 28
  2503. const m_SYS_io_cancel = 3
  2504. const m_SYS_io_destroy = 1
  2505. const m_SYS_io_getevents = 4
  2506. const m_SYS_io_pgetevents = 292
  2507. const m_SYS_io_setup = 0
  2508. const m_SYS_io_submit = 2
  2509. const m_SYS_io_uring_enter = 426
  2510. const m_SYS_io_uring_register = 427
  2511. const m_SYS_io_uring_setup = 425
  2512. const m_SYS_ioctl = 29
  2513. const m_SYS_ioprio_get = 31
  2514. const m_SYS_ioprio_set = 30
  2515. const m_SYS_kcmp = 272
  2516. const m_SYS_kexec_file_load = 294
  2517. const m_SYS_kexec_load = 104
  2518. const m_SYS_keyctl = 219
  2519. const m_SYS_kill = 129
  2520. const m_SYS_landlock_add_rule = 445
  2521. const m_SYS_landlock_create_ruleset = 444
  2522. const m_SYS_landlock_restrict_self = 446
  2523. const m_SYS_lgetxattr = 9
  2524. const m_SYS_linkat = 37
  2525. const m_SYS_listen = 201
  2526. const m_SYS_listxattr = 11
  2527. const m_SYS_llistxattr = 12
  2528. const m_SYS_lookup_dcookie = 18
  2529. const m_SYS_lremovexattr = 15
  2530. const m_SYS_lseek = 62
  2531. const m_SYS_lsetxattr = 6
  2532. const m_SYS_madvise = 233
  2533. const m_SYS_mbind = 235
  2534. const m_SYS_membarrier = 283
  2535. const m_SYS_memfd_create = 279
  2536. const m_SYS_migrate_pages = 238
  2537. const m_SYS_mincore = 232
  2538. const m_SYS_mkdirat = 34
  2539. const m_SYS_mknodat = 33
  2540. const m_SYS_mlock = 228
  2541. const m_SYS_mlock2 = 284
  2542. const m_SYS_mlockall = 230
  2543. const m_SYS_mmap = 222
  2544. const m_SYS_mount = 40
  2545. const m_SYS_mount_setattr = 442
  2546. const m_SYS_move_mount = 429
  2547. const m_SYS_move_pages = 239
  2548. const m_SYS_mprotect = 226
  2549. const m_SYS_mq_getsetattr = 185
  2550. const m_SYS_mq_notify = 184
  2551. const m_SYS_mq_open = 180
  2552. const m_SYS_mq_timedreceive = 183
  2553. const m_SYS_mq_timedsend = 182
  2554. const m_SYS_mq_unlink = 181
  2555. const m_SYS_mremap = 216
  2556. const m_SYS_msgctl = 187
  2557. const m_SYS_msgget = 186
  2558. const m_SYS_msgrcv = 188
  2559. const m_SYS_msgsnd = 189
  2560. const m_SYS_msync = 227
  2561. const m_SYS_munlock = 229
  2562. const m_SYS_munlockall = 231
  2563. const m_SYS_munmap = 215
  2564. const m_SYS_name_to_handle_at = 264
  2565. const m_SYS_nanosleep = 101
  2566. const m_SYS_newfstatat = 79
  2567. const m_SYS_nfsservctl = 42
  2568. const m_SYS_open_by_handle_at = 265
  2569. const m_SYS_open_tree = 428
  2570. const m_SYS_openat = 56
  2571. const m_SYS_openat2 = 437
  2572. const m_SYS_perf_event_open = 241
  2573. const m_SYS_personality = 92
  2574. const m_SYS_pidfd_getfd = 438
  2575. const m_SYS_pidfd_open = 434
  2576. const m_SYS_pidfd_send_signal = 424
  2577. const m_SYS_pipe2 = 59
  2578. const m_SYS_pivot_root = 41
  2579. const m_SYS_pkey_alloc = 289
  2580. const m_SYS_pkey_free = 290
  2581. const m_SYS_pkey_mprotect = 288
  2582. const m_SYS_ppoll = 73
  2583. const m_SYS_prctl = 167
  2584. const m_SYS_pread64 = 67
  2585. const m_SYS_preadv = 69
  2586. const m_SYS_preadv2 = 286
  2587. const m_SYS_prlimit64 = 261
  2588. const m_SYS_process_madvise = 440
  2589. const m_SYS_process_mrelease = 448
  2590. const m_SYS_process_vm_readv = 270
  2591. const m_SYS_process_vm_writev = 271
  2592. const m_SYS_pselect6 = 72
  2593. const m_SYS_ptrace = 117
  2594. const m_SYS_pwrite64 = 68
  2595. const m_SYS_pwritev = 70
  2596. const m_SYS_pwritev2 = 287
  2597. const m_SYS_quotactl = 60
  2598. const m_SYS_read = 63
  2599. const m_SYS_readahead = 213
  2600. const m_SYS_readlinkat = 78
  2601. const m_SYS_readv = 65
  2602. const m_SYS_reboot = 142
  2603. const m_SYS_recvfrom = 207
  2604. const m_SYS_recvmmsg = 243
  2605. const m_SYS_recvmsg = 212
  2606. const m_SYS_remap_file_pages = 234
  2607. const m_SYS_removexattr = 14
  2608. const m_SYS_renameat = 38
  2609. const m_SYS_renameat2 = 276
  2610. const m_SYS_request_key = 218
  2611. const m_SYS_restart_syscall = 128
  2612. const m_SYS_rseq = 293
  2613. const m_SYS_rt_sigaction = 134
  2614. const m_SYS_rt_sigpending = 136
  2615. const m_SYS_rt_sigprocmask = 135
  2616. const m_SYS_rt_sigqueueinfo = 138
  2617. const m_SYS_rt_sigreturn = 139
  2618. const m_SYS_rt_sigsuspend = 133
  2619. const m_SYS_rt_sigtimedwait = 137
  2620. const m_SYS_rt_tgsigqueueinfo = 240
  2621. const m_SYS_sched_get_priority_max = 125
  2622. const m_SYS_sched_get_priority_min = 126
  2623. const m_SYS_sched_getaffinity = 123
  2624. const m_SYS_sched_getattr = 275
  2625. const m_SYS_sched_getparam = 121
  2626. const m_SYS_sched_getscheduler = 120
  2627. const m_SYS_sched_rr_get_interval = 127
  2628. const m_SYS_sched_setaffinity = 122
  2629. const m_SYS_sched_setattr = 274
  2630. const m_SYS_sched_setparam = 118
  2631. const m_SYS_sched_setscheduler = 119
  2632. const m_SYS_sched_yield = 124
  2633. const m_SYS_seccomp = 277
  2634. const m_SYS_semctl = 191
  2635. const m_SYS_semget = 190
  2636. const m_SYS_semop = 193
  2637. const m_SYS_semtimedop = 192
  2638. const m_SYS_sendfile = 71
  2639. const m_SYS_sendmmsg = 269
  2640. const m_SYS_sendmsg = 211
  2641. const m_SYS_sendto = 206
  2642. const m_SYS_set_mempolicy = 237
  2643. const m_SYS_set_mempolicy_home_node = 450
  2644. const m_SYS_set_robust_list = 99
  2645. const m_SYS_set_tid_address = 96
  2646. const m_SYS_setdomainname = 162
  2647. const m_SYS_setfsgid = 152
  2648. const m_SYS_setfsuid = 151
  2649. const m_SYS_setgid = 144
  2650. const m_SYS_setgroups = 159
  2651. const m_SYS_sethostname = 161
  2652. const m_SYS_setitimer = 103
  2653. const m_SYS_setns = 268
  2654. const m_SYS_setpgid = 154
  2655. const m_SYS_setpriority = 140
  2656. const m_SYS_setregid = 143
  2657. const m_SYS_setresgid = 149
  2658. const m_SYS_setresuid = 147
  2659. const m_SYS_setreuid = 145
  2660. const m_SYS_setrlimit = 164
  2661. const m_SYS_setsid = 157
  2662. const m_SYS_setsockopt = 208
  2663. const m_SYS_settimeofday = 170
  2664. const m_SYS_setuid = 146
  2665. const m_SYS_setxattr = 5
  2666. const m_SYS_shmat = 196
  2667. const m_SYS_shmctl = 195
  2668. const m_SYS_shmdt = 197
  2669. const m_SYS_shmget = 194
  2670. const m_SYS_shutdown = 210
  2671. const m_SYS_sigaltstack = 132
  2672. const m_SYS_signalfd4 = 74
  2673. const m_SYS_socket = 198
  2674. const m_SYS_socketpair = 199
  2675. const m_SYS_splice = 76
  2676. const m_SYS_statfs = 43
  2677. const m_SYS_statx = 291
  2678. const m_SYS_swapoff = 225
  2679. const m_SYS_swapon = 224
  2680. const m_SYS_symlinkat = 36
  2681. const m_SYS_sync = 81
  2682. const m_SYS_sync_file_range = 84
  2683. const m_SYS_syncfs = 267
  2684. const m_SYS_sysinfo = 179
  2685. const m_SYS_syslog = 116
  2686. const m_SYS_tee = 77
  2687. const m_SYS_tgkill = 131
  2688. const m_SYS_timer_create = 107
  2689. const m_SYS_timer_delete = 111
  2690. const m_SYS_timer_getoverrun = 109
  2691. const m_SYS_timer_gettime = 108
  2692. const m_SYS_timer_settime = 110
  2693. const m_SYS_timerfd_create = 85
  2694. const m_SYS_timerfd_gettime = 87
  2695. const m_SYS_timerfd_settime = 86
  2696. const m_SYS_times = 153
  2697. const m_SYS_tkill = 130
  2698. const m_SYS_truncate = 45
  2699. const m_SYS_umask = 166
  2700. const m_SYS_umount2 = 39
  2701. const m_SYS_uname = 160
  2702. const m_SYS_unlinkat = 35
  2703. const m_SYS_unshare = 97
  2704. const m_SYS_userfaultfd = 282
  2705. const m_SYS_utimensat = 88
  2706. const m_SYS_vhangup = 58
  2707. const m_SYS_vmsplice = 75
  2708. const m_SYS_wait4 = 260
  2709. const m_SYS_waitid = 95
  2710. const m_SYS_write = 64
  2711. const m_SYS_writev = 66
  2712. const m_UINT_MAX1 = 4294967295
  2713. const m___NR_accept = 202
  2714. const m___NR_accept4 = 242
  2715. const m___NR_acct = 89
  2716. const m___NR_add_key = 217
  2717. const m___NR_adjtimex = 171
  2718. const m___NR_bind = 200
  2719. const m___NR_bpf = 280
  2720. const m___NR_brk = 214
  2721. const m___NR_cachestat = 451
  2722. const m___NR_capget = 90
  2723. const m___NR_capset = 91
  2724. const m___NR_chdir = 49
  2725. const m___NR_chroot = 51
  2726. const m___NR_clock_adjtime = 266
  2727. const m___NR_clock_getres = 114
  2728. const m___NR_clock_gettime = 113
  2729. const m___NR_clock_nanosleep = 115
  2730. const m___NR_clock_settime = 112
  2731. const m___NR_clone = 220
  2732. const m___NR_clone3 = 435
  2733. const m___NR_close = 57
  2734. const m___NR_close_range = 436
  2735. const m___NR_connect = 203
  2736. const m___NR_copy_file_range = 285
  2737. const m___NR_delete_module = 106
  2738. const m___NR_dup = 23
  2739. const m___NR_dup3 = 24
  2740. const m___NR_epoll_create1 = 20
  2741. const m___NR_epoll_ctl = 21
  2742. const m___NR_epoll_pwait = 22
  2743. const m___NR_epoll_pwait2 = 441
  2744. const m___NR_eventfd2 = 19
  2745. const m___NR_execve = 221
  2746. const m___NR_execveat = 281
  2747. const m___NR_exit = 93
  2748. const m___NR_exit_group = 94
  2749. const m___NR_faccessat = 48
  2750. const m___NR_faccessat2 = 439
  2751. const m___NR_fadvise64 = 223
  2752. const m___NR_fallocate = 47
  2753. const m___NR_fanotify_init = 262
  2754. const m___NR_fanotify_mark = 263
  2755. const m___NR_fchdir = 50
  2756. const m___NR_fchmod = 52
  2757. const m___NR_fchmodat = 53
  2758. const m___NR_fchmodat2 = 452
  2759. const m___NR_fchown = 55
  2760. const m___NR_fchownat = 54
  2761. const m___NR_fcntl = 25
  2762. const m___NR_fdatasync = 83
  2763. const m___NR_fgetxattr = 10
  2764. const m___NR_finit_module = 273
  2765. const m___NR_flistxattr = 13
  2766. const m___NR_flock = 32
  2767. const m___NR_fremovexattr = 16
  2768. const m___NR_fsconfig = 431
  2769. const m___NR_fsetxattr = 7
  2770. const m___NR_fsmount = 432
  2771. const m___NR_fsopen = 430
  2772. const m___NR_fspick = 433
  2773. const m___NR_fstat = 80
  2774. const m___NR_fstatfs = 44
  2775. const m___NR_fsync = 82
  2776. const m___NR_ftruncate = 46
  2777. const m___NR_futex = 98
  2778. const m___NR_futex_waitv = 449
  2779. const m___NR_get_mempolicy = 236
  2780. const m___NR_get_robust_list = 100
  2781. const m___NR_getcpu = 168
  2782. const m___NR_getcwd = 17
  2783. const m___NR_getdents64 = 61
  2784. const m___NR_getegid = 177
  2785. const m___NR_geteuid = 175
  2786. const m___NR_getgid = 176
  2787. const m___NR_getgroups = 158
  2788. const m___NR_getitimer = 102
  2789. const m___NR_getpeername = 205
  2790. const m___NR_getpgid = 155
  2791. const m___NR_getpid = 172
  2792. const m___NR_getppid = 173
  2793. const m___NR_getpriority = 141
  2794. const m___NR_getrandom = 278
  2795. const m___NR_getresgid = 150
  2796. const m___NR_getresuid = 148
  2797. const m___NR_getrlimit = 163
  2798. const m___NR_getrusage = 165
  2799. const m___NR_getsid = 156
  2800. const m___NR_getsockname = 204
  2801. const m___NR_getsockopt = 209
  2802. const m___NR_gettid = 178
  2803. const m___NR_gettimeofday = 169
  2804. const m___NR_getuid = 174
  2805. const m___NR_getxattr = 8
  2806. const m___NR_init_module = 105
  2807. const m___NR_inotify_add_watch = 27
  2808. const m___NR_inotify_init1 = 26
  2809. const m___NR_inotify_rm_watch = 28
  2810. const m___NR_io_cancel = 3
  2811. const m___NR_io_destroy = 1
  2812. const m___NR_io_getevents = 4
  2813. const m___NR_io_pgetevents = 292
  2814. const m___NR_io_setup = 0
  2815. const m___NR_io_submit = 2
  2816. const m___NR_io_uring_enter = 426
  2817. const m___NR_io_uring_register = 427
  2818. const m___NR_io_uring_setup = 425
  2819. const m___NR_ioctl = 29
  2820. const m___NR_ioprio_get = 31
  2821. const m___NR_ioprio_set = 30
  2822. const m___NR_kcmp = 272
  2823. const m___NR_kexec_file_load = 294
  2824. const m___NR_kexec_load = 104
  2825. const m___NR_keyctl = 219
  2826. const m___NR_kill = 129
  2827. const m___NR_landlock_add_rule = 445
  2828. const m___NR_landlock_create_ruleset = 444
  2829. const m___NR_landlock_restrict_self = 446
  2830. const m___NR_lgetxattr = 9
  2831. const m___NR_linkat = 37
  2832. const m___NR_listen = 201
  2833. const m___NR_listxattr = 11
  2834. const m___NR_llistxattr = 12
  2835. const m___NR_lookup_dcookie = 18
  2836. const m___NR_lremovexattr = 15
  2837. const m___NR_lseek = 62
  2838. const m___NR_lsetxattr = 6
  2839. const m___NR_madvise = 233
  2840. const m___NR_mbind = 235
  2841. const m___NR_membarrier = 283
  2842. const m___NR_memfd_create = 279
  2843. const m___NR_migrate_pages = 238
  2844. const m___NR_mincore = 232
  2845. const m___NR_mkdirat = 34
  2846. const m___NR_mknodat = 33
  2847. const m___NR_mlock = 228
  2848. const m___NR_mlock2 = 284
  2849. const m___NR_mlockall = 230
  2850. const m___NR_mmap = 222
  2851. const m___NR_mount = 40
  2852. const m___NR_mount_setattr = 442
  2853. const m___NR_move_mount = 429
  2854. const m___NR_move_pages = 239
  2855. const m___NR_mprotect = 226
  2856. const m___NR_mq_getsetattr = 185
  2857. const m___NR_mq_notify = 184
  2858. const m___NR_mq_open = 180
  2859. const m___NR_mq_timedreceive = 183
  2860. const m___NR_mq_timedsend = 182
  2861. const m___NR_mq_unlink = 181
  2862. const m___NR_mremap = 216
  2863. const m___NR_msgctl = 187
  2864. const m___NR_msgget = 186
  2865. const m___NR_msgrcv = 188
  2866. const m___NR_msgsnd = 189
  2867. const m___NR_msync = 227
  2868. const m___NR_munlock = 229
  2869. const m___NR_munlockall = 231
  2870. const m___NR_munmap = 215
  2871. const m___NR_name_to_handle_at = 264
  2872. const m___NR_nanosleep = 101
  2873. const m___NR_newfstatat = 79
  2874. const m___NR_nfsservctl = 42
  2875. const m___NR_open_by_handle_at = 265
  2876. const m___NR_open_tree = 428
  2877. const m___NR_openat = 56
  2878. const m___NR_openat2 = 437
  2879. const m___NR_perf_event_open = 241
  2880. const m___NR_personality = 92
  2881. const m___NR_pidfd_getfd = 438
  2882. const m___NR_pidfd_open = 434
  2883. const m___NR_pidfd_send_signal = 424
  2884. const m___NR_pipe2 = 59
  2885. const m___NR_pivot_root = 41
  2886. const m___NR_pkey_alloc = 289
  2887. const m___NR_pkey_free = 290
  2888. const m___NR_pkey_mprotect = 288
  2889. const m___NR_ppoll = 73
  2890. const m___NR_prctl = 167
  2891. const m___NR_pread64 = 67
  2892. const m___NR_preadv = 69
  2893. const m___NR_preadv2 = 286
  2894. const m___NR_prlimit64 = 261
  2895. const m___NR_process_madvise = 440
  2896. const m___NR_process_mrelease = 448
  2897. const m___NR_process_vm_readv = 270
  2898. const m___NR_process_vm_writev = 271
  2899. const m___NR_pselect6 = 72
  2900. const m___NR_ptrace = 117
  2901. const m___NR_pwrite64 = 68
  2902. const m___NR_pwritev = 70
  2903. const m___NR_pwritev2 = 287
  2904. const m___NR_quotactl = 60
  2905. const m___NR_read = 63
  2906. const m___NR_readahead = 213
  2907. const m___NR_readlinkat = 78
  2908. const m___NR_readv = 65
  2909. const m___NR_reboot = 142
  2910. const m___NR_recvfrom = 207
  2911. const m___NR_recvmmsg = 243
  2912. const m___NR_recvmsg = 212
  2913. const m___NR_remap_file_pages = 234
  2914. const m___NR_removexattr = 14
  2915. const m___NR_renameat = 38
  2916. const m___NR_renameat2 = 276
  2917. const m___NR_request_key = 218
  2918. const m___NR_restart_syscall = 128
  2919. const m___NR_rseq = 293
  2920. const m___NR_rt_sigaction = 134
  2921. const m___NR_rt_sigpending = 136
  2922. const m___NR_rt_sigprocmask = 135
  2923. const m___NR_rt_sigqueueinfo = 138
  2924. const m___NR_rt_sigreturn = 139
  2925. const m___NR_rt_sigsuspend = 133
  2926. const m___NR_rt_sigtimedwait = 137
  2927. const m___NR_rt_tgsigqueueinfo = 240
  2928. const m___NR_sched_get_priority_max = 125
  2929. const m___NR_sched_get_priority_min = 126
  2930. const m___NR_sched_getaffinity = 123
  2931. const m___NR_sched_getattr = 275
  2932. const m___NR_sched_getparam = 121
  2933. const m___NR_sched_getscheduler = 120
  2934. const m___NR_sched_rr_get_interval = 127
  2935. const m___NR_sched_setaffinity = 122
  2936. const m___NR_sched_setattr = 274
  2937. const m___NR_sched_setparam = 118
  2938. const m___NR_sched_setscheduler = 119
  2939. const m___NR_sched_yield = 124
  2940. const m___NR_seccomp = 277
  2941. const m___NR_semctl = 191
  2942. const m___NR_semget = 190
  2943. const m___NR_semop = 193
  2944. const m___NR_semtimedop = 192
  2945. const m___NR_sendfile = 71
  2946. const m___NR_sendmmsg = 269
  2947. const m___NR_sendmsg = 211
  2948. const m___NR_sendto = 206
  2949. const m___NR_set_mempolicy = 237
  2950. const m___NR_set_mempolicy_home_node = 450
  2951. const m___NR_set_robust_list = 99
  2952. const m___NR_set_tid_address = 96
  2953. const m___NR_setdomainname = 162
  2954. const m___NR_setfsgid = 152
  2955. const m___NR_setfsuid = 151
  2956. const m___NR_setgid = 144
  2957. const m___NR_setgroups = 159
  2958. const m___NR_sethostname = 161
  2959. const m___NR_setitimer = 103
  2960. const m___NR_setns = 268
  2961. const m___NR_setpgid = 154
  2962. const m___NR_setpriority = 140
  2963. const m___NR_setregid = 143
  2964. const m___NR_setresgid = 149
  2965. const m___NR_setresuid = 147
  2966. const m___NR_setreuid = 145
  2967. const m___NR_setrlimit = 164
  2968. const m___NR_setsid = 157
  2969. const m___NR_setsockopt = 208
  2970. const m___NR_settimeofday = 170
  2971. const m___NR_setuid = 146
  2972. const m___NR_setxattr = 5
  2973. const m___NR_shmat = 196
  2974. const m___NR_shmctl = 195
  2975. const m___NR_shmdt = 197
  2976. const m___NR_shmget = 194
  2977. const m___NR_shutdown = 210
  2978. const m___NR_sigaltstack = 132
  2979. const m___NR_signalfd4 = 74
  2980. const m___NR_socket = 198
  2981. const m___NR_socketpair = 199
  2982. const m___NR_splice = 76
  2983. const m___NR_statfs = 43
  2984. const m___NR_statx = 291
  2985. const m___NR_swapoff = 225
  2986. const m___NR_swapon = 224
  2987. const m___NR_symlinkat = 36
  2988. const m___NR_sync = 81
  2989. const m___NR_sync_file_range = 84
  2990. const m___NR_syncfs = 267
  2991. const m___NR_sysinfo = 179
  2992. const m___NR_syslog = 116
  2993. const m___NR_tee = 77
  2994. const m___NR_tgkill = 131
  2995. const m___NR_timer_create = 107
  2996. const m___NR_timer_delete = 111
  2997. const m___NR_timer_getoverrun = 109
  2998. const m___NR_timer_gettime = 108
  2999. const m___NR_timer_settime = 110
  3000. const m___NR_timerfd_create = 85
  3001. const m___NR_timerfd_gettime = 87
  3002. const m___NR_timerfd_settime = 86
  3003. const m___NR_times = 153
  3004. const m___NR_tkill = 130
  3005. const m___NR_truncate = 45
  3006. const m___NR_umask = 166
  3007. const m___NR_umount2 = 39
  3008. const m___NR_uname = 160
  3009. const m___NR_unlinkat = 35
  3010. const m___NR_unshare = 97
  3011. const m___NR_userfaultfd = 282
  3012. const m___NR_utimensat = 88
  3013. const m___NR_vhangup = 58
  3014. const m___NR_vmsplice = 75
  3015. const m___NR_wait4 = 260
  3016. const m___NR_waitid = 95
  3017. const m___NR_write = 64
  3018. const m___NR_writev = 66
  3019. const m_d_fileno = "d_ino"
  3020. type Tdirent = struct {
  3021. Fd_ino Tino_t
  3022. Fd_off Toff_t
  3023. Fd_reclen uint16
  3024. Fd_type uint8
  3025. Fd_name [256]uint8
  3026. }
  3027. func _closefrom_close(tls *libc.TLS, fd int32) {
  3028. libc.Xclose(tls, fd)
  3029. }
  3030. func _sys_close_range(tls *libc.TLS, fd uint32, max_fd uint32, flags uint32) (r int32) {
  3031. bp := tls.Alloc(32)
  3032. defer tls.Free(32)
  3033. return int32(libc.Xsyscall(tls, int64(m_SYS_close_range), libc.VaList(bp+8, fd, max_fd, flags)))
  3034. }
  3035. // C documentation
  3036. //
  3037. // /*
  3038. // * Close all file descriptors greater than or equal to lowfd.
  3039. // * This is the expensive (fallback) method.
  3040. // */
  3041. func _closefrom_fallback(tls *libc.TLS, lowfd int32) {
  3042. var fd, maxfd int64
  3043. _, _ = fd, maxfd
  3044. /*
  3045. * Fall back on sysconf(_SC_OPEN_MAX) or getdtablesize(). This is
  3046. * equivalent to checking the RLIMIT_NOFILE soft limit. It is
  3047. * possible for there to be open file descriptors past this limit
  3048. * but there is not much we can do about that since the hard limit
  3049. * may be RLIM_INFINITY (LLONG_MAX or ULLONG_MAX on modern systems).
  3050. */
  3051. maxfd = libc.Xsysconf(tls, int32(m__SC_OPEN_MAX))
  3052. if maxfd < int64(m_OPEN_MAX) {
  3053. maxfd = int64(m_OPEN_MAX)
  3054. }
  3055. /* Make sure we did not get RLIM_INFINITY as the upper limit. */
  3056. if maxfd > int64(m_INT_MAX1) {
  3057. maxfd = int64(m_INT_MAX1)
  3058. }
  3059. fd = int64(lowfd)
  3060. for {
  3061. if !(fd < maxfd) {
  3062. break
  3063. }
  3064. _closefrom_close(tls, int32(fd))
  3065. goto _1
  3066. _1:
  3067. ;
  3068. fd++
  3069. }
  3070. }
  3071. func _closefrom_procfs(tls *libc.TLS, lowfd int32) (r int32) {
  3072. bp := tls.Alloc(16)
  3073. defer tls.Free(16)
  3074. var dent, dirp, fd_array, path, ptr, v1 uintptr
  3075. var fd, fd_array_size, fd_array_used, i, ret, v2 int32
  3076. var _ /* errstr at bp+0 */ uintptr
  3077. _, _, _, _, _, _, _, _, _, _, _, _ = dent, dirp, fd, fd_array, fd_array_size, fd_array_used, i, path, ptr, ret, v1, v2
  3078. fd_array = libc.UintptrFromInt32(0)
  3079. fd_array_used = 0
  3080. fd_array_size = 0
  3081. ret = 0
  3082. /* Use /proc/self/fd (or /dev/fd on macOS) if it exists. */
  3083. path = __ccgo_ts
  3084. dirp = libc.Xopendir(tls, path)
  3085. if dirp == libc.UintptrFromInt32(0) {
  3086. return -int32(1)
  3087. }
  3088. for {
  3089. v1 = libc.Xreaddir(tls, dirp)
  3090. dent = v1
  3091. if !(v1 != libc.UintptrFromInt32(0)) {
  3092. break
  3093. }
  3094. fd = int32(Xstrtonum(tls, dent+19, int64(lowfd), int64(m_INT_MAX1), bp))
  3095. if *(*uintptr)(unsafe.Pointer(bp)) != libc.UintptrFromInt32(0) || fd == libc.Xdirfd(tls, dirp) {
  3096. continue
  3097. }
  3098. if fd_array_used >= fd_array_size {
  3099. if fd_array_size > 0 {
  3100. fd_array_size *= int32(2)
  3101. } else {
  3102. fd_array_size = int32(32)
  3103. }
  3104. ptr = Xreallocarray(tls, fd_array, libc.Uint64FromInt32(fd_array_size), uint64(4))
  3105. if ptr == libc.UintptrFromInt32(0) {
  3106. ret = -int32(1)
  3107. break
  3108. }
  3109. fd_array = ptr
  3110. }
  3111. v2 = fd_array_used
  3112. fd_array_used++
  3113. *(*int32)(unsafe.Pointer(fd_array + uintptr(v2)*4)) = fd
  3114. }
  3115. i = 0
  3116. for {
  3117. if !(i < fd_array_used) {
  3118. break
  3119. }
  3120. _closefrom_close(tls, *(*int32)(unsafe.Pointer(fd_array + uintptr(i)*4)))
  3121. goto _3
  3122. _3:
  3123. ;
  3124. i++
  3125. }
  3126. libc.Xfree(tls, fd_array)
  3127. libc.Xclosedir(tls, dirp)
  3128. return ret
  3129. }
  3130. // C documentation
  3131. //
  3132. // /*
  3133. // * Close all file descriptors greater than or equal to lowfd.
  3134. // * We try the fast way first, falling back on the slow method.
  3135. // */
  3136. func Xclosefrom(tls *libc.TLS, lowfd int32) {
  3137. if lowfd < 0 {
  3138. lowfd = 0
  3139. }
  3140. /* Try the fast methods first, if possible. */
  3141. if _sys_close_range(tls, libc.Uint32FromInt32(lowfd), uint32(0xffffffff), uint32(0)) == 0 {
  3142. return
  3143. }
  3144. if _closefrom_procfs(tls, lowfd) != -int32(1) {
  3145. return
  3146. }
  3147. /* Do things the slow way. */
  3148. _closefrom_fallback(tls, lowfd)
  3149. }
  3150. const m_INT64_MAX1 = 9223372036854775807
  3151. func Xdehumanize_number(tls *libc.TLS, buf uintptr, num uintptr) (r int32) {
  3152. bp := tls.Alloc(16)
  3153. defer tls.Free(16)
  3154. var rc, sign, v1, v2 int32
  3155. var rmax Tuint64_t
  3156. var _ /* rval at bp+0 */ Tuint64_t
  3157. _, _, _, _, _ = rc, rmax, sign, v1, v2
  3158. sign = +libc.Int32FromInt32(1)
  3159. /* The current expand_number() implementation uses bit shifts, so
  3160. * we cannot pass negative numbers, preserve the sign and apply it
  3161. * later. */
  3162. for {
  3163. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(buf)))
  3164. v2 = libc.BoolInt32(v1 == int32(' ') || libc.Uint32FromInt32(v1)-uint32('\t') < uint32(5))
  3165. goto _3
  3166. _3:
  3167. if !(v2 != 0) {
  3168. break
  3169. }
  3170. buf++
  3171. }
  3172. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(buf))) == int32('-') {
  3173. sign = -int32(1)
  3174. buf++
  3175. }
  3176. rc = Xexpand_number(tls, buf, bp)
  3177. if rc < 0 {
  3178. return rc
  3179. }
  3180. /* The sign has been stripped, so rval has the absolute value.
  3181. * Error out, regardless of the sign, if rval is greater than
  3182. * abs(INT64_MIN) (== INT64_MAX + 1), or if the sign is positive
  3183. * and the value has overflown by one (INT64_MAX + 1). */
  3184. rmax = uint64(libc.Uint64FromInt64(libc.Int64FromInt64(m_INT64_MAX1)) + libc.Uint64FromUint64(1))
  3185. if *(*Tuint64_t)(unsafe.Pointer(bp)) > rmax || *(*Tuint64_t)(unsafe.Pointer(bp)) == rmax && sign == +libc.Int32FromInt32(1) {
  3186. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ERANGE)
  3187. return -int32(1)
  3188. }
  3189. *(*Tint64_t)(unsafe.Pointer(num)) = libc.Int64FromUint64(*(*Tuint64_t)(unsafe.Pointer(bp)) * libc.Uint64FromInt32(sign))
  3190. return 0
  3191. }
  3192. const m_INT64_MAX2 = 0x7fffffffffffffff
  3193. /*
  3194. * Copyright © 2004-2005, 2009, 2011-2013 Guillem Jover <guillem@hadrons.org>
  3195. *
  3196. * Redistribution and use in source and binary forms, with or without
  3197. * modification, are permitted provided that the following conditions
  3198. * are met:
  3199. * 1. Redistributions of source code must retain the above copyright
  3200. * notice, this list of conditions and the following disclaimer.
  3201. * 2. Redistributions in binary form must reproduce the above copyright
  3202. * notice, this list of conditions and the following disclaimer in the
  3203. * documentation and/or other materials provided with the distribution.
  3204. * 3. The name of the author may not be used to endorse or promote products
  3205. * derived from this software without specific prior written permission.
  3206. *
  3207. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  3208. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  3209. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  3210. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  3211. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  3212. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  3213. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  3214. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  3215. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  3216. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  3217. */
  3218. func Xvwarnc(tls *libc.TLS, code int32, format uintptr, ap Tva_list) {
  3219. bp := tls.Alloc(16)
  3220. defer tls.Free(16)
  3221. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+14, libc.VaList(bp+8, Xgetprogname(tls)))
  3222. if format != 0 {
  3223. libc.Xvfprintf(tls, libc.Xstderr, format, ap)
  3224. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+19, 0)
  3225. }
  3226. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+22, libc.VaList(bp+8, libc.Xstrerror(tls, code)))
  3227. }
  3228. func Xwarnc(tls *libc.TLS, code int32, format uintptr, va uintptr) {
  3229. var ap Tva_list
  3230. _ = ap
  3231. ap = va
  3232. Xvwarnc(tls, code, format, ap)
  3233. _ = ap
  3234. }
  3235. func Xverrc(tls *libc.TLS, status int32, code int32, format uintptr, ap Tva_list) {
  3236. bp := tls.Alloc(16)
  3237. defer tls.Free(16)
  3238. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+14, libc.VaList(bp+8, Xgetprogname(tls)))
  3239. if format != 0 {
  3240. libc.Xvfprintf(tls, libc.Xstderr, format, ap)
  3241. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+19, 0)
  3242. }
  3243. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+22, libc.VaList(bp+8, libc.Xstrerror(tls, code)))
  3244. libc.Xexit(tls, status)
  3245. }
  3246. func Xerrc(tls *libc.TLS, status int32, code int32, format uintptr, va uintptr) {
  3247. var ap Tva_list
  3248. _ = ap
  3249. ap = va
  3250. Xverrc(tls, status, code, format, ap)
  3251. _ = ap
  3252. }
  3253. const m_PRIX16 = "X"
  3254. const m_PRIX32 = "X"
  3255. const m_PRIX8 = "X"
  3256. const m_PRIXFAST16 = "X"
  3257. const m_PRIXFAST32 = "X"
  3258. const m_PRIXFAST8 = "X"
  3259. const m_PRIXLEAST16 = "X"
  3260. const m_PRIXLEAST32 = "X"
  3261. const m_PRIXLEAST8 = "X"
  3262. const m_PRId16 = "d"
  3263. const m_PRId32 = "d"
  3264. const m_PRId8 = "d"
  3265. const m_PRIdFAST16 = "d"
  3266. const m_PRIdFAST32 = "d"
  3267. const m_PRIdFAST8 = "d"
  3268. const m_PRIdLEAST16 = "d"
  3269. const m_PRIdLEAST32 = "d"
  3270. const m_PRIdLEAST8 = "d"
  3271. const m_PRIi16 = "i"
  3272. const m_PRIi32 = "i"
  3273. const m_PRIi8 = "i"
  3274. const m_PRIiFAST16 = "i"
  3275. const m_PRIiFAST32 = "i"
  3276. const m_PRIiFAST8 = "i"
  3277. const m_PRIiLEAST16 = "i"
  3278. const m_PRIiLEAST32 = "i"
  3279. const m_PRIiLEAST8 = "i"
  3280. const m_PRIo16 = "o"
  3281. const m_PRIo32 = "o"
  3282. const m_PRIo8 = "o"
  3283. const m_PRIoFAST16 = "o"
  3284. const m_PRIoFAST32 = "o"
  3285. const m_PRIoFAST8 = "o"
  3286. const m_PRIoLEAST16 = "o"
  3287. const m_PRIoLEAST32 = "o"
  3288. const m_PRIoLEAST8 = "o"
  3289. const m_PRIu16 = "u"
  3290. const m_PRIu32 = "u"
  3291. const m_PRIu8 = "u"
  3292. const m_PRIuFAST16 = "u"
  3293. const m_PRIuFAST32 = "u"
  3294. const m_PRIuFAST8 = "u"
  3295. const m_PRIuLEAST16 = "u"
  3296. const m_PRIuLEAST32 = "u"
  3297. const m_PRIuLEAST8 = "u"
  3298. const m_PRIx16 = "x"
  3299. const m_PRIx32 = "x"
  3300. const m_PRIx8 = "x"
  3301. const m_PRIxFAST16 = "x"
  3302. const m_PRIxFAST32 = "x"
  3303. const m_PRIxFAST8 = "x"
  3304. const m_PRIxLEAST16 = "x"
  3305. const m_PRIxLEAST32 = "x"
  3306. const m_PRIxLEAST8 = "x"
  3307. const m_SCNd16 = "hd"
  3308. const m_SCNd32 = "d"
  3309. const m_SCNd8 = "hhd"
  3310. const m_SCNdFAST16 = "d"
  3311. const m_SCNdFAST32 = "d"
  3312. const m_SCNdFAST8 = "hhd"
  3313. const m_SCNdLEAST16 = "hd"
  3314. const m_SCNdLEAST32 = "d"
  3315. const m_SCNdLEAST8 = "hhd"
  3316. const m_SCNi16 = "hi"
  3317. const m_SCNi32 = "i"
  3318. const m_SCNi8 = "hhi"
  3319. const m_SCNiFAST16 = "i"
  3320. const m_SCNiFAST32 = "i"
  3321. const m_SCNiFAST8 = "hhi"
  3322. const m_SCNiLEAST16 = "hi"
  3323. const m_SCNiLEAST32 = "i"
  3324. const m_SCNiLEAST8 = "hhi"
  3325. const m_SCNo16 = "ho"
  3326. const m_SCNo32 = "o"
  3327. const m_SCNo8 = "hho"
  3328. const m_SCNoFAST16 = "o"
  3329. const m_SCNoFAST32 = "o"
  3330. const m_SCNoFAST8 = "hho"
  3331. const m_SCNoLEAST16 = "ho"
  3332. const m_SCNoLEAST32 = "o"
  3333. const m_SCNoLEAST8 = "hho"
  3334. const m_SCNu16 = "hu"
  3335. const m_SCNu32 = "u"
  3336. const m_SCNu8 = "hhu"
  3337. const m_SCNuFAST16 = "u"
  3338. const m_SCNuFAST32 = "u"
  3339. const m_SCNuFAST8 = "hhu"
  3340. const m_SCNuLEAST16 = "hu"
  3341. const m_SCNuLEAST32 = "u"
  3342. const m_SCNuLEAST8 = "hhu"
  3343. const m_SCNx16 = "hx"
  3344. const m_SCNx32 = "x"
  3345. const m_SCNx8 = "hhx"
  3346. const m_SCNxFAST16 = "x"
  3347. const m_SCNxFAST32 = "x"
  3348. const m_SCNxFAST8 = "hhx"
  3349. const m_SCNxLEAST16 = "hx"
  3350. const m_SCNxLEAST32 = "x"
  3351. const m_SCNxLEAST8 = "hhx"
  3352. const m___PRI64 = "l"
  3353. const m___PRIPTR = "l"
  3354. type Timaxdiv_t = struct {
  3355. Fquot Tintmax_t
  3356. Frem Tintmax_t
  3357. }
  3358. /* Values for humanize_number(3)'s flags parameter. */
  3359. /* Values for humanize_number(3)'s scale parameter. */
  3360. /*
  3361. * fparseln() specific operation flags.
  3362. */
  3363. // C documentation
  3364. //
  3365. // /*
  3366. // * Convert an expression of the following forms to a uint64_t.
  3367. // * 1) A positive decimal number.
  3368. // * 2) A positive decimal number followed by a 'b' or 'B' (mult by 1).
  3369. // * 3) A positive decimal number followed by a 'k' or 'K' (mult by 1 << 10).
  3370. // * 4) A positive decimal number followed by a 'm' or 'M' (mult by 1 << 20).
  3371. // * 5) A positive decimal number followed by a 'g' or 'G' (mult by 1 << 30).
  3372. // * 6) A positive decimal number followed by a 't' or 'T' (mult by 1 << 40).
  3373. // * 7) A positive decimal number followed by a 'p' or 'P' (mult by 1 << 50).
  3374. // * 8) A positive decimal number followed by a 'e' or 'E' (mult by 1 << 60).
  3375. // */
  3376. func Xexpand_number(tls *libc.TLS, buf uintptr, num uintptr) (r int32) {
  3377. bp := tls.Alloc(16)
  3378. defer tls.Free(16)
  3379. var number Tuint64_t
  3380. var shift uint32
  3381. var _ /* endptr at bp+0 */ uintptr
  3382. _, _ = number, shift
  3383. number = libc.Xstrtoumax(tls, buf, bp, 0)
  3384. if *(*uintptr)(unsafe.Pointer(bp)) == buf {
  3385. /* No valid digits. */
  3386. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  3387. return -int32(1)
  3388. }
  3389. switch libc.Xtolower(tls, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))) {
  3390. case int32('e'):
  3391. shift = uint32(60)
  3392. case int32('p'):
  3393. shift = uint32(50)
  3394. case int32('t'):
  3395. shift = uint32(40)
  3396. case int32('g'):
  3397. shift = uint32(30)
  3398. case int32('m'):
  3399. shift = uint32(20)
  3400. case int32('k'):
  3401. shift = uint32(10)
  3402. case int32('b'):
  3403. fallthrough
  3404. case int32('\000'): /* No unit. */
  3405. *(*Tuint64_t)(unsafe.Pointer(num)) = number
  3406. return 0
  3407. default:
  3408. /* Unrecognized unit. */
  3409. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  3410. return -int32(1)
  3411. }
  3412. if number<<shift>>shift != number {
  3413. /* Overflow */
  3414. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ERANGE)
  3415. return -int32(1)
  3416. }
  3417. *(*Tuint64_t)(unsafe.Pointer(num)) = number << shift
  3418. return 0
  3419. }
  3420. func X__explicit_bzero_hook(tls *libc.TLS, buf uintptr, len1 Tsize_t) {
  3421. }
  3422. func Xexplicit_bzero(tls *libc.TLS, buf uintptr, len1 Tsize_t) {
  3423. libc.Xmemset(tls, buf, 0, len1)
  3424. X__explicit_bzero_hook(tls, buf, len1)
  3425. }
  3426. const m_FILEBUF_POOL_ITEMS = 32
  3427. /*
  3428. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  3429. *
  3430. * Redistribution and use in source and binary forms, with or without
  3431. * modification, are permitted provided that the following conditions
  3432. * are met:
  3433. * 1. Redistributions of source code must retain the above copyright
  3434. * notice, this list of conditions and the following disclaimer.
  3435. * 2. Redistributions in binary form must reproduce the above copyright
  3436. * notice, this list of conditions and the following disclaimer in the
  3437. * documentation and/or other materials provided with the distribution.
  3438. * 3. The name of the author may not be used to endorse or promote products
  3439. * derived from this software without specific prior written permission.
  3440. *
  3441. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  3442. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  3443. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  3444. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  3445. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  3446. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  3447. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  3448. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  3449. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  3450. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  3451. */
  3452. /*
  3453. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  3454. *
  3455. * Redistribution and use in source and binary forms, with or without
  3456. * modification, are permitted provided that the following conditions
  3457. * are met:
  3458. * 1. Redistributions of source code must retain the above copyright
  3459. * notice, this list of conditions and the following disclaimer.
  3460. * 2. Redistributions in binary form must reproduce the above copyright
  3461. * notice, this list of conditions and the following disclaimer in the
  3462. * documentation and/or other materials provided with the distribution.
  3463. * 3. The name of the author may not be used to endorse or promote products
  3464. * derived from this software without specific prior written permission.
  3465. *
  3466. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  3467. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  3468. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  3469. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  3470. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  3471. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  3472. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  3473. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  3474. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  3475. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  3476. */
  3477. /* Clang expands this to 1 if an identifier is *not* reserved. */
  3478. /*
  3479. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  3480. * musl, try to handle this gracefully.
  3481. */
  3482. /* Copyright (C) 1992-2022 Free Software Foundation, Inc.
  3483. Copyright The GNU Toolchain Authors.
  3484. This file is part of the GNU C Library.
  3485. The GNU C Library is free software; you can redistribute it and/or
  3486. modify it under the terms of the GNU Lesser General Public
  3487. License as published by the Free Software Foundation; either
  3488. version 2.1 of the License, or (at your option) any later version.
  3489. The GNU C Library is distributed in the hope that it will be useful,
  3490. but WITHOUT ANY WARRANTY; without even the implied warranty of
  3491. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  3492. Lesser General Public License for more details.
  3493. You should have received a copy of the GNU Lesser General Public
  3494. License along with the GNU C Library; if not, see
  3495. <https://www.gnu.org/licenses/>. */
  3496. type Tfilebuf = struct {
  3497. Ffp uintptr
  3498. Fbuf uintptr
  3499. Flen1 Tsize_t
  3500. }
  3501. var _fb_pool [32]Tfilebuf
  3502. var _fb_pool_cur int32
  3503. func Xfgetln(tls *libc.TLS, stream uintptr, len1 uintptr) (r uintptr) {
  3504. var fb uintptr
  3505. var nread Tssize_t
  3506. _, _ = fb, nread
  3507. libc.Xflockfile(tls, stream)
  3508. /* Try to diminish the possibility of several fgetln() calls being
  3509. * used on different streams, by using a pool of buffers per file. */
  3510. fb = uintptr(unsafe.Pointer(&_fb_pool)) + uintptr(_fb_pool_cur)*24
  3511. if (*Tfilebuf)(unsafe.Pointer(fb)).Ffp != stream && (*Tfilebuf)(unsafe.Pointer(fb)).Ffp != libc.UintptrFromInt32(0) {
  3512. _fb_pool_cur++
  3513. _fb_pool_cur %= int32(m_FILEBUF_POOL_ITEMS)
  3514. fb = uintptr(unsafe.Pointer(&_fb_pool)) + uintptr(_fb_pool_cur)*24
  3515. }
  3516. (*Tfilebuf)(unsafe.Pointer(fb)).Ffp = stream
  3517. nread = libc.Xgetline(tls, fb+8, fb+16, stream)
  3518. libc.Xfunlockfile(tls, stream)
  3519. /* Note: the getdelim/getline API ensures nread != 0. */
  3520. if nread == int64(-int32(1)) {
  3521. *(*Tsize_t)(unsafe.Pointer(len1)) = uint64(0)
  3522. return libc.UintptrFromInt32(0)
  3523. } else {
  3524. *(*Tsize_t)(unsafe.Pointer(len1)) = libc.Uint64FromInt64(nread)
  3525. return (*Tfilebuf)(unsafe.Pointer(fb)).Fbuf
  3526. }
  3527. return r
  3528. }
  3529. 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', '.'}
  3530. func Xfreezero(tls *libc.TLS, ptr uintptr, sz Tsize_t) {
  3531. /* This is legal. */
  3532. if ptr == libc.UintptrFromInt32(0) {
  3533. return
  3534. }
  3535. Xexplicit_bzero(tls, ptr, sz)
  3536. libc.Xfree(tls, ptr)
  3537. }
  3538. const m_FILEWBUF_INIT_LEN = 128
  3539. const m_FILEWBUF_POOL_ITEMS = 32
  3540. type Twint_t = uint32
  3541. type Twctype_t = uint64
  3542. type Tmbstate_t = struct {
  3543. F__opaque1 uint32
  3544. F__opaque2 uint32
  3545. }
  3546. type t__mbstate_t = Tmbstate_t
  3547. type Tmax_align_t = struct {
  3548. F__ll int64
  3549. F__ld float64
  3550. }
  3551. type Tptrdiff_t = int64
  3552. /*
  3553. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  3554. *
  3555. * Redistribution and use in source and binary forms, with or without
  3556. * modification, are permitted provided that the following conditions
  3557. * are met:
  3558. * 1. Redistributions of source code must retain the above copyright
  3559. * notice, this list of conditions and the following disclaimer.
  3560. * 2. Redistributions in binary form must reproduce the above copyright
  3561. * notice, this list of conditions and the following disclaimer in the
  3562. * documentation and/or other materials provided with the distribution.
  3563. * 3. The name of the author may not be used to endorse or promote products
  3564. * derived from this software without specific prior written permission.
  3565. *
  3566. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  3567. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  3568. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  3569. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  3570. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  3571. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  3572. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  3573. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  3574. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  3575. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  3576. */
  3577. /*
  3578. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  3579. *
  3580. * Redistribution and use in source and binary forms, with or without
  3581. * modification, are permitted provided that the following conditions
  3582. * are met:
  3583. * 1. Redistributions of source code must retain the above copyright
  3584. * notice, this list of conditions and the following disclaimer.
  3585. * 2. Redistributions in binary form must reproduce the above copyright
  3586. * notice, this list of conditions and the following disclaimer in the
  3587. * documentation and/or other materials provided with the distribution.
  3588. * 3. The name of the author may not be used to endorse or promote products
  3589. * derived from this software without specific prior written permission.
  3590. *
  3591. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  3592. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  3593. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  3594. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  3595. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  3596. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  3597. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  3598. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  3599. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  3600. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  3601. */
  3602. /* Clang expands this to 1 if an identifier is *not* reserved. */
  3603. /*
  3604. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  3605. * musl, try to handle this gracefully.
  3606. */
  3607. /* Copyright (C) 1992-2022 Free Software Foundation, Inc.
  3608. Copyright The GNU Toolchain Authors.
  3609. This file is part of the GNU C Library.
  3610. The GNU C Library is free software; you can redistribute it and/or
  3611. modify it under the terms of the GNU Lesser General Public
  3612. License as published by the Free Software Foundation; either
  3613. version 2.1 of the License, or (at your option) any later version.
  3614. The GNU C Library is distributed in the hope that it will be useful,
  3615. but WITHOUT ANY WARRANTY; without even the implied warranty of
  3616. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  3617. Lesser General Public License for more details.
  3618. You should have received a copy of the GNU Lesser General Public
  3619. License along with the GNU C Library; if not, see
  3620. <https://www.gnu.org/licenses/>. */
  3621. type Tfilewbuf = struct {
  3622. Ffp uintptr
  3623. Fwbuf uintptr
  3624. Flen1 Tsize_t
  3625. }
  3626. var _fb_pool1 [32]Tfilewbuf
  3627. var _fb_pool_cur1 int32
  3628. func Xfgetwln(tls *libc.TLS, stream uintptr, lenp uintptr) (r uintptr) {
  3629. var fb, wp, v3 uintptr
  3630. var wc, v1 Twint_t
  3631. var wused, v2 Tsize_t
  3632. _, _, _, _, _, _, _ = fb, wc, wp, wused, v1, v2, v3
  3633. wused = uint64(0)
  3634. /* Try to diminish the possibility of several fgetwln() calls being
  3635. * used on different streams, by using a pool of buffers per file. */
  3636. fb = uintptr(unsafe.Pointer(&_fb_pool1)) + uintptr(_fb_pool_cur1)*24
  3637. if (*Tfilewbuf)(unsafe.Pointer(fb)).Ffp != stream && (*Tfilewbuf)(unsafe.Pointer(fb)).Ffp != libc.UintptrFromInt32(0) {
  3638. _fb_pool_cur1++
  3639. _fb_pool_cur1 %= int32(m_FILEWBUF_POOL_ITEMS)
  3640. fb = uintptr(unsafe.Pointer(&_fb_pool1)) + uintptr(_fb_pool_cur1)*24
  3641. }
  3642. (*Tfilewbuf)(unsafe.Pointer(fb)).Ffp = stream
  3643. for {
  3644. v1 = libc.Xfgetwc(tls, stream)
  3645. wc = v1
  3646. if !(v1 != uint32(0xffffffff)) {
  3647. break
  3648. }
  3649. if !((*Tfilewbuf)(unsafe.Pointer(fb)).Flen1 != 0) || wused >= (*Tfilewbuf)(unsafe.Pointer(fb)).Flen1 {
  3650. if (*Tfilewbuf)(unsafe.Pointer(fb)).Flen1 != 0 {
  3651. *(*Tsize_t)(unsafe.Pointer(fb + 16)) *= uint64(2)
  3652. } else {
  3653. (*Tfilewbuf)(unsafe.Pointer(fb)).Flen1 = uint64(m_FILEWBUF_INIT_LEN)
  3654. }
  3655. wp = Xreallocarray(tls, (*Tfilewbuf)(unsafe.Pointer(fb)).Fwbuf, (*Tfilewbuf)(unsafe.Pointer(fb)).Flen1, uint64(4))
  3656. if wp == libc.UintptrFromInt32(0) {
  3657. wused = uint64(0)
  3658. break
  3659. }
  3660. (*Tfilewbuf)(unsafe.Pointer(fb)).Fwbuf = wp
  3661. }
  3662. v2 = wused
  3663. wused++
  3664. *(*Twchar_t)(unsafe.Pointer((*Tfilewbuf)(unsafe.Pointer(fb)).Fwbuf + uintptr(v2)*4)) = wc
  3665. if wc == uint32('\n') {
  3666. break
  3667. }
  3668. }
  3669. *(*Tsize_t)(unsafe.Pointer(lenp)) = wused
  3670. if wused != 0 {
  3671. v3 = (*Tfilewbuf)(unsafe.Pointer(fb)).Fwbuf
  3672. } else {
  3673. v3 = libc.UintptrFromInt32(0)
  3674. }
  3675. return v3
  3676. }
  3677. // C documentation
  3678. //
  3679. // /* XXX: Ideally we'd recommend getwline(3), but unfortunately even though it
  3680. // * was part of the ISO/IEC TR 24731-2:2010 draft, it did not make it into C11
  3681. // * and is not widely implemented. */
  3682. 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', '.'}
  3683. const m_LOCK_EX = 2
  3684. const m_LOCK_NB = 4
  3685. const m_LOCK_SH = 1
  3686. const m_LOCK_UN = 8
  3687. const m_O_CREAT1 = 64
  3688. const m_O_NONBLOCK1 = 2048
  3689. const m_O_TRUNC1 = 512
  3690. /* Values for humanize_number(3)'s flags parameter. */
  3691. /* Values for humanize_number(3)'s scale parameter. */
  3692. /*
  3693. * fparseln() specific operation flags.
  3694. */
  3695. // C documentation
  3696. //
  3697. // /*
  3698. // * Reliably open and lock a file.
  3699. // *
  3700. // * Please do not modify this code without first reading the revision history
  3701. // * and discussing your changes with <des@freebsd.org>. Don't be fooled by the
  3702. // * code's apparent simplicity; there would be no need for this function if it
  3703. // * was easy to get right.
  3704. // */
  3705. func _vflopenat(tls *libc.TLS, dirfd int32, path uintptr, flags int32, ap Tva_list) (r int32) {
  3706. bp := tls.Alloc(272)
  3707. defer tls.Free(272)
  3708. var fd, operation, serrno, trunc, v2 int32
  3709. var mode Tmode_t
  3710. var _ /* fsb at bp+128 */ Tstat
  3711. var _ /* sb at bp+0 */ Tstat
  3712. _, _, _, _, _, _ = fd, mode, operation, serrno, trunc, v2
  3713. mode = uint32(0)
  3714. if flags&int32(m_O_CREAT1) != 0 {
  3715. mode = libc.Uint32FromInt32(libc.VaInt32(&ap)) /* mode_t promoted to int */
  3716. }
  3717. operation = int32(m_LOCK_EX)
  3718. if flags&int32(m_O_NONBLOCK1) != 0 {
  3719. operation |= int32(m_LOCK_NB)
  3720. }
  3721. trunc = flags & int32(m_O_TRUNC1)
  3722. flags &= ^libc.Int32FromInt32(m_O_TRUNC1)
  3723. for {
  3724. v2 = libc.Xopenat(tls, dirfd, path, flags, libc.VaList(bp+264, mode))
  3725. fd = v2
  3726. if v2 == -int32(1) {
  3727. /* non-existent or no access */
  3728. return -int32(1)
  3729. }
  3730. if libc.Xflock(tls, fd, operation) == -int32(1) {
  3731. /* unsupported or interrupted */
  3732. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  3733. libc.Xclose(tls, fd)
  3734. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  3735. return -int32(1)
  3736. }
  3737. if libc.Xfstatat(tls, dirfd, path, bp, 0) == -int32(1) {
  3738. /* disappeared from under our feet */
  3739. libc.Xclose(tls, fd)
  3740. goto _1
  3741. }
  3742. if libc.Xfstat(tls, fd, bp+128) == -int32(1) {
  3743. /* can't happen [tm] */
  3744. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  3745. libc.Xclose(tls, fd)
  3746. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  3747. return -int32(1)
  3748. }
  3749. if (*(*Tstat)(unsafe.Pointer(bp))).Fst_dev != (*(*Tstat)(unsafe.Pointer(bp + 128))).Fst_dev || (*(*Tstat)(unsafe.Pointer(bp))).Fst_ino != (*(*Tstat)(unsafe.Pointer(bp + 128))).Fst_ino {
  3750. /* changed under our feet */
  3751. libc.Xclose(tls, fd)
  3752. goto _1
  3753. }
  3754. if trunc != 0 && libc.Xftruncate(tls, fd, 0) != 0 {
  3755. /* can't happen [tm] */
  3756. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  3757. libc.Xclose(tls, fd)
  3758. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  3759. return -int32(1)
  3760. }
  3761. /*
  3762. * The following change is provided as a specific example to
  3763. * avoid.
  3764. */
  3765. return fd
  3766. goto _1
  3767. _1:
  3768. }
  3769. return r
  3770. }
  3771. func Xflopen(tls *libc.TLS, path uintptr, flags int32, va uintptr) (r int32) {
  3772. var ap Tva_list
  3773. var ret int32
  3774. _, _ = ap, ret
  3775. ap = va
  3776. ret = _vflopenat(tls, -int32(100), path, flags, ap)
  3777. _ = ap
  3778. return ret
  3779. }
  3780. func Xflopenat(tls *libc.TLS, dirfd int32, path uintptr, flags int32, va uintptr) (r int32) {
  3781. var ap Tva_list
  3782. var ret int32
  3783. _, _ = ap, ret
  3784. ap = va
  3785. ret = _vflopenat(tls, dirfd, path, flags, ap)
  3786. _ = ap
  3787. return ret
  3788. }
  3789. type ___e_fmtcheck_types = int32
  3790. const _FMTCHECK_START = 0
  3791. const _FMTCHECK_SHORT = 1
  3792. const _FMTCHECK_INT = 2
  3793. const _FMTCHECK_WINTT = 3
  3794. const _FMTCHECK_LONG = 4
  3795. const _FMTCHECK_QUAD = 5
  3796. const _FMTCHECK_INTMAXT = 6
  3797. const _FMTCHECK_PTRDIFFT = 7
  3798. const _FMTCHECK_SIZET = 8
  3799. const _FMTCHECK_POINTER = 9
  3800. const _FMTCHECK_CHARPOINTER = 10
  3801. const _FMTCHECK_SHORTPOINTER = 11
  3802. const _FMTCHECK_INTPOINTER = 12
  3803. const _FMTCHECK_LONGPOINTER = 13
  3804. const _FMTCHECK_QUADPOINTER = 14
  3805. const _FMTCHECK_INTMAXTPOINTER = 15
  3806. const _FMTCHECK_PTRDIFFTPOINTER = 16
  3807. const _FMTCHECK_SIZETPOINTER = 17
  3808. const _FMTCHECK_DOUBLE = 18
  3809. const _FMTCHECK_LONGDOUBLE = 19
  3810. const _FMTCHECK_STRING = 20
  3811. const _FMTCHECK_WSTRING = 21
  3812. const _FMTCHECK_WIDTH = 22
  3813. const _FMTCHECK_PRECISION = 23
  3814. const _FMTCHECK_DONE = 24
  3815. const _FMTCHECK_UNKNOWN = 25
  3816. type TEFT = int32
  3817. type _e_modifier = int32
  3818. const _MOD_NONE = 0
  3819. const _MOD_CHAR = 1
  3820. const _MOD_SHORT = 2
  3821. const _MOD_LONG = 3
  3822. const _MOD_QUAD = 4
  3823. const _MOD_INTMAXT = 5
  3824. const _MOD_LONGDOUBLE = 6
  3825. const _MOD_PTRDIFFT = 7
  3826. const _MOD_SIZET = 8
  3827. func _get_next_format_from_precision(tls *libc.TLS, pf uintptr) (r TEFT) {
  3828. var f uintptr
  3829. var modifier _e_modifier
  3830. _, _ = f, modifier
  3831. f = *(*uintptr)(unsafe.Pointer(pf))
  3832. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) {
  3833. case int32('h'):
  3834. f++
  3835. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  3836. *(*uintptr)(unsafe.Pointer(pf)) = f
  3837. return int32(_FMTCHECK_UNKNOWN)
  3838. }
  3839. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('h') {
  3840. f++
  3841. modifier = int32(_MOD_CHAR)
  3842. } else {
  3843. modifier = int32(_MOD_SHORT)
  3844. }
  3845. case int32('j'):
  3846. f++
  3847. modifier = int32(_MOD_INTMAXT)
  3848. case int32('l'):
  3849. f++
  3850. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  3851. *(*uintptr)(unsafe.Pointer(pf)) = f
  3852. return int32(_FMTCHECK_UNKNOWN)
  3853. }
  3854. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('l') {
  3855. f++
  3856. modifier = int32(_MOD_QUAD)
  3857. } else {
  3858. modifier = int32(_MOD_LONG)
  3859. }
  3860. case int32('q'):
  3861. f++
  3862. modifier = int32(_MOD_QUAD)
  3863. case int32('t'):
  3864. f++
  3865. modifier = int32(_MOD_PTRDIFFT)
  3866. case int32('z'):
  3867. f++
  3868. modifier = int32(_MOD_SIZET)
  3869. case int32('L'):
  3870. f++
  3871. modifier = int32(_MOD_LONGDOUBLE)
  3872. default:
  3873. modifier = int32(_MOD_NONE)
  3874. break
  3875. }
  3876. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  3877. *(*uintptr)(unsafe.Pointer(pf)) = f
  3878. return int32(_FMTCHECK_UNKNOWN)
  3879. }
  3880. if libc.Xstrchr(tls, __ccgo_ts+26, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f)))) != 0 {
  3881. switch modifier {
  3882. case int32(_MOD_LONG):
  3883. goto _1
  3884. case int32(_MOD_QUAD):
  3885. goto _2
  3886. case int32(_MOD_INTMAXT):
  3887. goto _3
  3888. case int32(_MOD_PTRDIFFT):
  3889. goto _4
  3890. case int32(_MOD_SIZET):
  3891. goto _5
  3892. case int32(_MOD_NONE):
  3893. goto _6
  3894. case int32(_MOD_SHORT):
  3895. goto _7
  3896. case int32(_MOD_CHAR):
  3897. goto _8
  3898. default:
  3899. goto _9
  3900. }
  3901. goto _10
  3902. _1:
  3903. ;
  3904. _13:
  3905. ;
  3906. *(*uintptr)(unsafe.Pointer(pf)) = f
  3907. return int32(_FMTCHECK_LONG)
  3908. goto _12
  3909. _12:
  3910. ;
  3911. if 0 != 0 {
  3912. goto _13
  3913. }
  3914. goto _11
  3915. _11:
  3916. ;
  3917. _2:
  3918. ;
  3919. *(*uintptr)(unsafe.Pointer(pf)) = f
  3920. return int32(_FMTCHECK_QUAD)
  3921. _3:
  3922. ;
  3923. *(*uintptr)(unsafe.Pointer(pf)) = f
  3924. return int32(_FMTCHECK_INTMAXT)
  3925. _4:
  3926. ;
  3927. *(*uintptr)(unsafe.Pointer(pf)) = f
  3928. return int32(_FMTCHECK_PTRDIFFT)
  3929. _5:
  3930. ;
  3931. *(*uintptr)(unsafe.Pointer(pf)) = f
  3932. return int32(_FMTCHECK_SIZET)
  3933. _8:
  3934. ;
  3935. _7:
  3936. ;
  3937. _6:
  3938. ;
  3939. *(*uintptr)(unsafe.Pointer(pf)) = f
  3940. return int32(_FMTCHECK_INT)
  3941. _9:
  3942. ;
  3943. *(*uintptr)(unsafe.Pointer(pf)) = f
  3944. return int32(_FMTCHECK_UNKNOWN)
  3945. _10:
  3946. }
  3947. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('n') {
  3948. switch modifier {
  3949. case int32(_MOD_CHAR):
  3950. goto _14
  3951. case int32(_MOD_SHORT):
  3952. goto _15
  3953. case int32(_MOD_LONG):
  3954. goto _16
  3955. case int32(_MOD_QUAD):
  3956. goto _17
  3957. case int32(_MOD_INTMAXT):
  3958. goto _18
  3959. case int32(_MOD_PTRDIFFT):
  3960. goto _19
  3961. case int32(_MOD_SIZET):
  3962. goto _20
  3963. case int32(_MOD_NONE):
  3964. goto _21
  3965. default:
  3966. goto _22
  3967. }
  3968. goto _23
  3969. _14:
  3970. ;
  3971. _26:
  3972. ;
  3973. *(*uintptr)(unsafe.Pointer(pf)) = f
  3974. return int32(_FMTCHECK_CHARPOINTER)
  3975. goto _25
  3976. _25:
  3977. ;
  3978. if 0 != 0 {
  3979. goto _26
  3980. }
  3981. goto _24
  3982. _24:
  3983. ;
  3984. _15:
  3985. ;
  3986. *(*uintptr)(unsafe.Pointer(pf)) = f
  3987. return int32(_FMTCHECK_SHORTPOINTER)
  3988. _16:
  3989. ;
  3990. *(*uintptr)(unsafe.Pointer(pf)) = f
  3991. return int32(_FMTCHECK_LONGPOINTER)
  3992. _17:
  3993. ;
  3994. *(*uintptr)(unsafe.Pointer(pf)) = f
  3995. return int32(_FMTCHECK_QUADPOINTER)
  3996. _18:
  3997. ;
  3998. *(*uintptr)(unsafe.Pointer(pf)) = f
  3999. return int32(_FMTCHECK_INTMAXTPOINTER)
  4000. _19:
  4001. ;
  4002. *(*uintptr)(unsafe.Pointer(pf)) = f
  4003. return int32(_FMTCHECK_PTRDIFFTPOINTER)
  4004. _20:
  4005. ;
  4006. *(*uintptr)(unsafe.Pointer(pf)) = f
  4007. return int32(_FMTCHECK_SIZETPOINTER)
  4008. _21:
  4009. ;
  4010. *(*uintptr)(unsafe.Pointer(pf)) = f
  4011. return int32(_FMTCHECK_INTPOINTER)
  4012. _22:
  4013. ;
  4014. *(*uintptr)(unsafe.Pointer(pf)) = f
  4015. return int32(_FMTCHECK_UNKNOWN)
  4016. _23:
  4017. }
  4018. if libc.Xstrchr(tls, __ccgo_ts+33, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f)))) != 0 {
  4019. if modifier != int32(_MOD_NONE) {
  4020. *(*uintptr)(unsafe.Pointer(pf)) = f
  4021. return int32(_FMTCHECK_UNKNOWN)
  4022. }
  4023. *(*uintptr)(unsafe.Pointer(pf)) = f
  4024. return int32(_FMTCHECK_LONG)
  4025. }
  4026. if libc.Xstrchr(tls, __ccgo_ts+37, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f)))) != 0 {
  4027. switch modifier {
  4028. case int32(_MOD_LONGDOUBLE):
  4029. goto _27
  4030. case int32(_MOD_NONE):
  4031. goto _28
  4032. case int32(_MOD_LONG):
  4033. goto _29
  4034. default:
  4035. goto _30
  4036. }
  4037. goto _31
  4038. _27:
  4039. ;
  4040. _34:
  4041. ;
  4042. *(*uintptr)(unsafe.Pointer(pf)) = f
  4043. return int32(_FMTCHECK_LONGDOUBLE)
  4044. goto _33
  4045. _33:
  4046. ;
  4047. if 0 != 0 {
  4048. goto _34
  4049. }
  4050. goto _32
  4051. _32:
  4052. ;
  4053. _29:
  4054. ;
  4055. _28:
  4056. ;
  4057. *(*uintptr)(unsafe.Pointer(pf)) = f
  4058. return int32(_FMTCHECK_DOUBLE)
  4059. _30:
  4060. ;
  4061. *(*uintptr)(unsafe.Pointer(pf)) = f
  4062. return int32(_FMTCHECK_UNKNOWN)
  4063. _31:
  4064. }
  4065. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('c') {
  4066. switch modifier {
  4067. case int32(_MOD_LONG):
  4068. goto _35
  4069. case int32(_MOD_NONE):
  4070. goto _36
  4071. default:
  4072. goto _37
  4073. }
  4074. goto _38
  4075. _35:
  4076. ;
  4077. _41:
  4078. ;
  4079. *(*uintptr)(unsafe.Pointer(pf)) = f
  4080. return int32(_FMTCHECK_WINTT)
  4081. goto _40
  4082. _40:
  4083. ;
  4084. if 0 != 0 {
  4085. goto _41
  4086. }
  4087. goto _39
  4088. _39:
  4089. ;
  4090. _36:
  4091. ;
  4092. *(*uintptr)(unsafe.Pointer(pf)) = f
  4093. return int32(_FMTCHECK_INT)
  4094. _37:
  4095. ;
  4096. *(*uintptr)(unsafe.Pointer(pf)) = f
  4097. return int32(_FMTCHECK_UNKNOWN)
  4098. _38:
  4099. }
  4100. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('C') {
  4101. if modifier != int32(_MOD_NONE) {
  4102. *(*uintptr)(unsafe.Pointer(pf)) = f
  4103. return int32(_FMTCHECK_UNKNOWN)
  4104. }
  4105. *(*uintptr)(unsafe.Pointer(pf)) = f
  4106. return int32(_FMTCHECK_WINTT)
  4107. }
  4108. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('s') {
  4109. switch modifier {
  4110. case int32(_MOD_LONG):
  4111. goto _42
  4112. case int32(_MOD_NONE):
  4113. goto _43
  4114. default:
  4115. goto _44
  4116. }
  4117. goto _45
  4118. _42:
  4119. ;
  4120. _48:
  4121. ;
  4122. *(*uintptr)(unsafe.Pointer(pf)) = f
  4123. return int32(_FMTCHECK_WSTRING)
  4124. goto _47
  4125. _47:
  4126. ;
  4127. if 0 != 0 {
  4128. goto _48
  4129. }
  4130. goto _46
  4131. _46:
  4132. ;
  4133. _43:
  4134. ;
  4135. *(*uintptr)(unsafe.Pointer(pf)) = f
  4136. return int32(_FMTCHECK_STRING)
  4137. _44:
  4138. ;
  4139. *(*uintptr)(unsafe.Pointer(pf)) = f
  4140. return int32(_FMTCHECK_UNKNOWN)
  4141. _45:
  4142. }
  4143. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('S') {
  4144. if modifier != int32(_MOD_NONE) {
  4145. *(*uintptr)(unsafe.Pointer(pf)) = f
  4146. return int32(_FMTCHECK_UNKNOWN)
  4147. }
  4148. *(*uintptr)(unsafe.Pointer(pf)) = f
  4149. return int32(_FMTCHECK_WSTRING)
  4150. }
  4151. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('p') {
  4152. if modifier != int32(_MOD_NONE) {
  4153. *(*uintptr)(unsafe.Pointer(pf)) = f
  4154. return int32(_FMTCHECK_UNKNOWN)
  4155. }
  4156. *(*uintptr)(unsafe.Pointer(pf)) = f
  4157. return int32(_FMTCHECK_POINTER)
  4158. }
  4159. *(*uintptr)(unsafe.Pointer(pf)) = f
  4160. return int32(_FMTCHECK_UNKNOWN)
  4161. /*NOTREACHED*/
  4162. return r
  4163. }
  4164. func _get_next_format_from_width(tls *libc.TLS, pf uintptr) (r TEFT) {
  4165. var f uintptr
  4166. _ = f
  4167. f = *(*uintptr)(unsafe.Pointer(pf))
  4168. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('.') {
  4169. f++
  4170. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('*') {
  4171. *(*uintptr)(unsafe.Pointer(pf)) = f
  4172. return int32(_FMTCHECK_PRECISION)
  4173. }
  4174. /* eat any precision (empty is allowed) */
  4175. for libc.BoolInt32(uint32(*(*uint8)(unsafe.Pointer(f)))-uint32('0') < uint32(10)) != 0 {
  4176. f++
  4177. }
  4178. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  4179. *(*uintptr)(unsafe.Pointer(pf)) = f
  4180. return int32(_FMTCHECK_UNKNOWN)
  4181. }
  4182. }
  4183. *(*uintptr)(unsafe.Pointer(pf)) = f
  4184. return _get_next_format_from_precision(tls, pf)
  4185. /*NOTREACHED*/
  4186. return r
  4187. }
  4188. func _get_next_format(tls *libc.TLS, pf uintptr, eft TEFT) (r TEFT) {
  4189. var f uintptr
  4190. var infmt int32
  4191. _, _ = f, infmt
  4192. if eft == int32(_FMTCHECK_WIDTH) {
  4193. *(*uintptr)(unsafe.Pointer(pf))++
  4194. return _get_next_format_from_width(tls, pf)
  4195. } else {
  4196. if eft == int32(_FMTCHECK_PRECISION) {
  4197. *(*uintptr)(unsafe.Pointer(pf))++
  4198. return _get_next_format_from_precision(tls, pf)
  4199. }
  4200. }
  4201. f = *(*uintptr)(unsafe.Pointer(pf))
  4202. infmt = 0
  4203. for !(infmt != 0) {
  4204. f = libc.Xstrchr(tls, f, int32('%'))
  4205. if f == libc.UintptrFromInt32(0) {
  4206. *(*uintptr)(unsafe.Pointer(pf)) = f
  4207. return int32(_FMTCHECK_DONE)
  4208. }
  4209. f++
  4210. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  4211. *(*uintptr)(unsafe.Pointer(pf)) = f
  4212. return int32(_FMTCHECK_UNKNOWN)
  4213. }
  4214. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) != int32('%') {
  4215. infmt = int32(1)
  4216. } else {
  4217. f++
  4218. }
  4219. }
  4220. /* Eat any of the flags */
  4221. for *(*uint8)(unsafe.Pointer(f)) != 0 && libc.Xstrchr(tls, __ccgo_ts+46, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f)))) != 0 {
  4222. f++
  4223. }
  4224. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('*') {
  4225. *(*uintptr)(unsafe.Pointer(pf)) = f
  4226. return int32(_FMTCHECK_WIDTH)
  4227. }
  4228. /* eat any width */
  4229. for libc.BoolInt32(uint32(*(*uint8)(unsafe.Pointer(f)))-uint32('0') < uint32(10)) != 0 {
  4230. f++
  4231. }
  4232. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  4233. *(*uintptr)(unsafe.Pointer(pf)) = f
  4234. return int32(_FMTCHECK_UNKNOWN)
  4235. }
  4236. *(*uintptr)(unsafe.Pointer(pf)) = f
  4237. return _get_next_format_from_width(tls, pf)
  4238. /*NOTREACHED*/
  4239. return r
  4240. }
  4241. func Xfmtcheck(tls *libc.TLS, f1 uintptr, f2 uintptr) (r uintptr) {
  4242. bp := tls.Alloc(16)
  4243. defer tls.Free(16)
  4244. var f1t, f2t, v1 TEFT
  4245. var _ /* f1p at bp+0 */ uintptr
  4246. var _ /* f2p at bp+8 */ uintptr
  4247. _, _, _ = f1t, f2t, v1
  4248. if !(f1 != 0) {
  4249. return f2
  4250. }
  4251. *(*uintptr)(unsafe.Pointer(bp)) = f1
  4252. f1t = int32(_FMTCHECK_START)
  4253. *(*uintptr)(unsafe.Pointer(bp + 8)) = f2
  4254. f2t = int32(_FMTCHECK_START)
  4255. for {
  4256. v1 = _get_next_format(tls, bp, f1t)
  4257. f1t = v1
  4258. if !(v1 != int32(_FMTCHECK_DONE)) {
  4259. break
  4260. }
  4261. if f1t == int32(_FMTCHECK_UNKNOWN) {
  4262. return f2
  4263. }
  4264. f2t = _get_next_format(tls, bp+8, f2t)
  4265. if f1t != f2t {
  4266. return f2
  4267. }
  4268. }
  4269. return f1
  4270. }
  4271. const m_FPARSELN_UNESCALL1 = 15
  4272. const m_FPARSELN_UNESCCOMM1 = 4
  4273. const m_FPARSELN_UNESCCONT1 = 2
  4274. const m_FPARSELN_UNESCESC1 = 1
  4275. const m_FPARSELN_UNESCREST1 = 8
  4276. const m_static_assert = "_Static_assert"
  4277. // C documentation
  4278. //
  4279. // /* isescaped():
  4280. // * Return true if the character in *p that belongs to a string
  4281. // * that starts in *sp, is escaped by the escape character esc.
  4282. // */
  4283. func _isescaped(tls *libc.TLS, sp uintptr, p uintptr, esc int32) (r int32) {
  4284. var cp, v2 uintptr
  4285. var ne Tsize_t
  4286. _, _, _ = cp, ne, v2
  4287. /* No escape character */
  4288. if esc == int32('\000') {
  4289. return 0
  4290. }
  4291. /* Count the number of escape characters that precede ours */
  4292. ne = uint64(0)
  4293. cp = p
  4294. for {
  4295. cp--
  4296. v2 = cp
  4297. if !(v2 >= sp && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) == esc) {
  4298. break
  4299. }
  4300. goto _1
  4301. goto _1
  4302. _1:
  4303. ;
  4304. ne++
  4305. }
  4306. /* Return true if odd number of escape characters */
  4307. return libc.BoolInt32(ne&uint64(1) != uint64(0))
  4308. }
  4309. // C documentation
  4310. //
  4311. // /* fparseln():
  4312. // * Read a line from a file parsing continuations ending in * and eliminating trailing newlines, or comments starting with
  4313. // * the comment char.
  4314. // */
  4315. func Xfparseln(tls *libc.TLS, fp uintptr, size uintptr, lineno uintptr, str uintptr, flags int32) (r uintptr) {
  4316. bp := tls.Alloc(16)
  4317. defer tls.Free(16)
  4318. var buf, cp, v2, v3, v4, v5, v6, v7, v8, v9 uintptr
  4319. var cnt, skipesc int32
  4320. var com, con, esc, nl uint8
  4321. var len1 Tsize_t
  4322. var s Tssize_t
  4323. var _ /* ptr at bp+8 */ uintptr
  4324. var _ /* ptrlen at bp+0 */ Tsize_t
  4325. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = buf, cnt, com, con, cp, esc, len1, nl, s, skipesc, v2, v3, v4, v5, v6, v7, v8, v9
  4326. len1 = uint64(0)
  4327. buf = libc.UintptrFromInt32(0)
  4328. *(*Tsize_t)(unsafe.Pointer(bp)) = uint64(0)
  4329. *(*uintptr)(unsafe.Pointer(bp + 8)) = libc.UintptrFromInt32(0)
  4330. cnt = int32(1)
  4331. if str == libc.UintptrFromInt32(0) {
  4332. str = uintptr(unsafe.Pointer(&_dstr))
  4333. }
  4334. esc = *(*uint8)(unsafe.Pointer(str))
  4335. con = *(*uint8)(unsafe.Pointer(str + 1))
  4336. com = *(*uint8)(unsafe.Pointer(str + 2))
  4337. /*
  4338. * XXX: it would be cool to be able to specify the newline character,
  4339. * getdelim(3) does let us, but supporting it would diverge from BSDs.
  4340. */
  4341. nl = uint8('\n')
  4342. libc.Xflockfile(tls, fp)
  4343. for cnt != 0 {
  4344. cnt = 0
  4345. if lineno != 0 {
  4346. *(*Tsize_t)(unsafe.Pointer(lineno))++
  4347. }
  4348. s = libc.Xgetline(tls, bp+8, bp, fp)
  4349. if s < 0 {
  4350. break
  4351. }
  4352. if s != 0 && com != 0 { /* Check and eliminate comments */
  4353. cp = *(*uintptr)(unsafe.Pointer(bp + 8))
  4354. for {
  4355. if !(cp < *(*uintptr)(unsafe.Pointer(bp + 8))+uintptr(s)) {
  4356. break
  4357. }
  4358. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) == libc.Int32FromUint8(com) && !(_isescaped(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), cp, libc.Int32FromUint8(esc)) != 0) {
  4359. s = int64(cp) - int64(*(*uintptr)(unsafe.Pointer(bp + 8)))
  4360. cnt = libc.BoolInt32(s == 0 && buf == libc.UintptrFromInt32(0))
  4361. break
  4362. }
  4363. goto _1
  4364. _1:
  4365. ;
  4366. cp++
  4367. }
  4368. }
  4369. if s != 0 && nl != 0 { /* Check and eliminate newlines */
  4370. cp = *(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(s-int64(1))
  4371. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) == libc.Int32FromUint8(nl) {
  4372. s--
  4373. } /* forget newline */
  4374. }
  4375. if s != 0 && con != 0 { /* Check and eliminate continuations */
  4376. cp = *(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(s-int64(1))
  4377. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) == libc.Int32FromUint8(con) && !(_isescaped(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), cp, libc.Int32FromUint8(esc)) != 0) {
  4378. s-- /* forget continuation char */
  4379. cnt = int32(1)
  4380. }
  4381. }
  4382. if s == 0 {
  4383. /*
  4384. * nothing to add, skip realloc except in case
  4385. * we need a minimal buf to return an empty line
  4386. */
  4387. if cnt != 0 || buf != libc.UintptrFromInt32(0) {
  4388. continue
  4389. }
  4390. }
  4391. v2 = libc.Xrealloc(tls, buf, len1+libc.Uint64FromInt64(s)+uint64(1))
  4392. cp = v2
  4393. if v2 == libc.UintptrFromInt32(0) {
  4394. libc.Xfunlockfile(tls, fp)
  4395. libc.Xfree(tls, buf)
  4396. libc.Xfree(tls, *(*uintptr)(unsafe.Pointer(bp + 8)))
  4397. return libc.UintptrFromInt32(0)
  4398. }
  4399. buf = cp
  4400. libc.Xmemcpy(tls, buf+uintptr(len1), *(*uintptr)(unsafe.Pointer(bp + 8)), libc.Uint64FromInt64(s))
  4401. len1 += libc.Uint64FromInt64(s)
  4402. *(*uint8)(unsafe.Pointer(buf + uintptr(len1))) = uint8('\000')
  4403. }
  4404. libc.Xfunlockfile(tls, fp)
  4405. libc.Xfree(tls, *(*uintptr)(unsafe.Pointer(bp + 8)))
  4406. if flags&int32(m_FPARSELN_UNESCALL1) != 0 && esc != 0 && buf != libc.UintptrFromInt32(0) && libc.Xstrchr(tls, buf, libc.Int32FromUint8(esc)) != libc.UintptrFromInt32(0) {
  4407. v3 = buf
  4408. cp = v3
  4409. *(*uintptr)(unsafe.Pointer(bp + 8)) = v3
  4410. for libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) != int32('\000') {
  4411. for libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) != int32('\000') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) != libc.Int32FromUint8(esc) {
  4412. v4 = *(*uintptr)(unsafe.Pointer(bp + 8))
  4413. *(*uintptr)(unsafe.Pointer(bp + 8))++
  4414. v5 = cp
  4415. cp++
  4416. *(*uint8)(unsafe.Pointer(v4)) = *(*uint8)(unsafe.Pointer(v5))
  4417. }
  4418. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) == int32('\000') || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + 1))) == int32('\000') {
  4419. break
  4420. }
  4421. skipesc = 0
  4422. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + 1))) == libc.Int32FromUint8(com) {
  4423. skipesc += flags & int32(m_FPARSELN_UNESCCOMM1)
  4424. }
  4425. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + 1))) == libc.Int32FromUint8(con) {
  4426. skipesc += flags & int32(m_FPARSELN_UNESCCONT1)
  4427. }
  4428. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + 1))) == libc.Int32FromUint8(esc) {
  4429. skipesc += flags & int32(m_FPARSELN_UNESCESC1)
  4430. }
  4431. 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) {
  4432. skipesc = flags & int32(m_FPARSELN_UNESCREST1)
  4433. }
  4434. if skipesc != 0 {
  4435. cp++
  4436. } else {
  4437. v6 = *(*uintptr)(unsafe.Pointer(bp + 8))
  4438. *(*uintptr)(unsafe.Pointer(bp + 8))++
  4439. v7 = cp
  4440. cp++
  4441. *(*uint8)(unsafe.Pointer(v6)) = *(*uint8)(unsafe.Pointer(v7))
  4442. }
  4443. v8 = *(*uintptr)(unsafe.Pointer(bp + 8))
  4444. *(*uintptr)(unsafe.Pointer(bp + 8))++
  4445. v9 = cp
  4446. cp++
  4447. *(*uint8)(unsafe.Pointer(v8)) = *(*uint8)(unsafe.Pointer(v9))
  4448. }
  4449. *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))) = uint8('\000')
  4450. len1 = libc.Xstrlen(tls, buf)
  4451. }
  4452. if size != 0 {
  4453. *(*Tsize_t)(unsafe.Pointer(size)) = len1
  4454. }
  4455. return buf
  4456. }
  4457. var _dstr = [3]uint8{
  4458. 0: uint8('\\'),
  4459. 1: uint8('\\'),
  4460. 2: uint8('#'),
  4461. }
  4462. const m_FSETLOCKING_BYCALLER = 2
  4463. const m_FSETLOCKING_INTERNAL = 1
  4464. const m_FSETLOCKING_QUERY = 0
  4465. func Xfpurge(tls *libc.TLS, fp uintptr) (r int32) {
  4466. if fp == libc.UintptrFromInt32(0) {
  4467. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EBADF)
  4468. return -int32(1)
  4469. }
  4470. libc.X__fpurge(tls, fp)
  4471. return 0
  4472. }
  4473. const m_FPARSELN_UNESCALL2 = 0x0f
  4474. const m_FPARSELN_UNESCCOMM2 = 0x04
  4475. const m_FPARSELN_UNESCCONT2 = 0x02
  4476. const m_FPARSELN_UNESCESC2 = 0x01
  4477. const m_FPARSELN_UNESCREST2 = 0x08
  4478. const m_KB = 1024
  4479. const m_MAXB = "GB"
  4480. func Xgetbsize(tls *libc.TLS, headerlenp uintptr, blocksizep uintptr) (r uintptr) {
  4481. bp := tls.Alloc(32)
  4482. defer tls.Free(32)
  4483. var blocksize, max, mul, n, v15, v16, v17, v4 int64
  4484. var form, p, v3 uintptr
  4485. var _ /* ep at bp+0 */ uintptr
  4486. _, _, _, _, _, _, _, _, _, _, _ = blocksize, form, max, mul, n, p, v15, v16, v17, v3, v4
  4487. form = __ccgo_ts + 53
  4488. v3 = libc.Xgetenv(tls, __ccgo_ts+54)
  4489. p = v3
  4490. if !(v3 != libc.UintptrFromInt32(0) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) != int32('\000')) {
  4491. goto _1
  4492. }
  4493. v4 = libc.Xstrtol(tls, p, bp, int32(10))
  4494. n = v4
  4495. if v4 < 0 {
  4496. goto underflow
  4497. }
  4498. if n == 0 {
  4499. n = int64(1)
  4500. }
  4501. if *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))) != 0 && *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)) != 0 {
  4502. goto fmterr
  4503. }
  4504. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) {
  4505. case int32('g'):
  4506. goto _5
  4507. case int32('G'):
  4508. goto _6
  4509. case int32('k'):
  4510. goto _7
  4511. case int32('K'):
  4512. goto _8
  4513. case int32('m'):
  4514. goto _9
  4515. case int32('M'):
  4516. goto _10
  4517. case int32('\000'):
  4518. goto _11
  4519. default:
  4520. goto _12
  4521. }
  4522. goto _13
  4523. _6:
  4524. ;
  4525. _5:
  4526. ;
  4527. form = __ccgo_ts + 64
  4528. max = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) / (libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024))
  4529. mul = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024)
  4530. goto _13
  4531. _8:
  4532. ;
  4533. _7:
  4534. ;
  4535. form = __ccgo_ts + 66
  4536. max = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) / libc.Int64FromInt64(1024)
  4537. mul = int64(1024)
  4538. goto _13
  4539. _10:
  4540. ;
  4541. _9:
  4542. ;
  4543. form = __ccgo_ts + 68
  4544. max = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) / (libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024))
  4545. mul = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024)
  4546. goto _13
  4547. _11:
  4548. ;
  4549. max = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024)
  4550. mul = int64(1)
  4551. goto _13
  4552. _12:
  4553. ;
  4554. goto fmterr
  4555. fmterr:
  4556. ;
  4557. libc.Xwarnx(tls, __ccgo_ts+70, libc.VaList(bp+16, p))
  4558. n = int64(512)
  4559. max = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024)
  4560. mul = int64(1)
  4561. goto _13
  4562. _13:
  4563. ;
  4564. if n > max {
  4565. libc.Xwarnx(tls, __ccgo_ts+92, libc.VaList(bp+16, libc.Int64FromInt64(1024)*libc.Int64FromInt64(1024)*libc.Int64FromInt64(1024)/(libc.Int64FromInt64(1024)*libc.Int64FromInt64(1024)*libc.Int64FromInt64(1024))))
  4566. n = max
  4567. }
  4568. v15 = n * mul
  4569. blocksize = v15
  4570. if !(v15 < int64(512)) {
  4571. goto _14
  4572. }
  4573. goto underflow
  4574. underflow:
  4575. ;
  4576. libc.Xwarnx(tls, __ccgo_ts+118, 0)
  4577. form = __ccgo_ts + 53
  4578. v16 = libc.Int64FromInt32(512)
  4579. n = v16
  4580. blocksize = v16
  4581. _14:
  4582. ;
  4583. goto _2
  4584. _1:
  4585. ;
  4586. v17 = libc.Int64FromInt32(512)
  4587. n = v17
  4588. blocksize = v17
  4589. _2:
  4590. ;
  4591. libc.X__builtin_snprintf(tls, uintptr(unsafe.Pointer(&_header)), uint64(20), __ccgo_ts+143, libc.VaList(bp+16, n, form))
  4592. *(*int32)(unsafe.Pointer(headerlenp)) = libc.Int32FromUint64(libc.Xstrlen(tls, uintptr(unsafe.Pointer(&_header))))
  4593. *(*int64)(unsafe.Pointer(blocksizep)) = blocksize
  4594. return uintptr(unsafe.Pointer(&_header))
  4595. }
  4596. var _header [20]uint8
  4597. const m_AF_ALG = "PF_ALG"
  4598. const m_AF_APPLETALK = "PF_APPLETALK"
  4599. const m_AF_ASH = "PF_ASH"
  4600. const m_AF_ATMPVC = "PF_ATMPVC"
  4601. const m_AF_ATMSVC = "PF_ATMSVC"
  4602. const m_AF_AX25 = "PF_AX25"
  4603. const m_AF_BLUETOOTH = "PF_BLUETOOTH"
  4604. const m_AF_BRIDGE = "PF_BRIDGE"
  4605. const m_AF_CAIF = "PF_CAIF"
  4606. const m_AF_CAN = "PF_CAN"
  4607. const m_AF_DECnet = "PF_DECnet"
  4608. const m_AF_ECONET = "PF_ECONET"
  4609. const m_AF_FILE = "AF_LOCAL"
  4610. const m_AF_IB = "PF_IB"
  4611. const m_AF_IEEE802154 = "PF_IEEE802154"
  4612. const m_AF_INET = "PF_INET"
  4613. const m_AF_INET6 = "PF_INET6"
  4614. const m_AF_IPX = "PF_IPX"
  4615. const m_AF_IRDA = "PF_IRDA"
  4616. const m_AF_ISDN = "PF_ISDN"
  4617. const m_AF_IUCV = "PF_IUCV"
  4618. const m_AF_KCM = "PF_KCM"
  4619. const m_AF_KEY = "PF_KEY"
  4620. const m_AF_LLC = "PF_LLC"
  4621. const m_AF_LOCAL = "PF_LOCAL"
  4622. const m_AF_MAX = "PF_MAX"
  4623. const m_AF_MPLS = "PF_MPLS"
  4624. const m_AF_NETBEUI = "PF_NETBEUI"
  4625. const m_AF_NETLINK = "PF_NETLINK"
  4626. const m_AF_NETROM = "PF_NETROM"
  4627. const m_AF_NFC = "PF_NFC"
  4628. const m_AF_PACKET = "PF_PACKET"
  4629. const m_AF_PHONET = "PF_PHONET"
  4630. const m_AF_PPPOX = "PF_PPPOX"
  4631. const m_AF_QIPCRTR = "PF_QIPCRTR"
  4632. const m_AF_RDS = "PF_RDS"
  4633. const m_AF_ROSE = "PF_ROSE"
  4634. const m_AF_ROUTE = "PF_ROUTE"
  4635. const m_AF_RXRPC = "PF_RXRPC"
  4636. const m_AF_SECURITY = "PF_SECURITY"
  4637. const m_AF_SMC = "PF_SMC"
  4638. const m_AF_SNA = "PF_SNA"
  4639. const m_AF_TIPC = "PF_TIPC"
  4640. const m_AF_UNIX = "AF_LOCAL"
  4641. const m_AF_UNSPEC = "PF_UNSPEC"
  4642. const m_AF_VSOCK = "PF_VSOCK"
  4643. const m_AF_WANPIPE = "PF_WANPIPE"
  4644. const m_AF_X25 = "PF_X25"
  4645. const m_AF_XDP = "PF_XDP"
  4646. const m_INT_MAX2 = 0x7fffffff
  4647. const m_MSG_BATCH = 0x40000
  4648. const m_MSG_CMSG_CLOEXEC = 0x40000000
  4649. const m_MSG_CONFIRM = 0x0800
  4650. const m_MSG_CTRUNC = 0x0008
  4651. const m_MSG_DONTROUTE = 0x0004
  4652. const m_MSG_DONTWAIT = 0x0040
  4653. const m_MSG_EOR = 0x0080
  4654. const m_MSG_ERRQUEUE = 0x2000
  4655. const m_MSG_FASTOPEN = 0x20000000
  4656. const m_MSG_FIN = 0x0200
  4657. const m_MSG_MORE = 0x8000
  4658. const m_MSG_NOSIGNAL = 0x4000
  4659. const m_MSG_OOB = 0x0001
  4660. const m_MSG_PEEK = 0x0002
  4661. const m_MSG_PROXY = 0x0010
  4662. const m_MSG_RST = 0x1000
  4663. const m_MSG_SYN = 0x0400
  4664. const m_MSG_TRUNC = 0x0020
  4665. const m_MSG_WAITALL = 0x0100
  4666. const m_MSG_WAITFORONE = 0x10000
  4667. const m_MSG_ZEROCOPY = 0x4000000
  4668. const m_PF_ALG = 38
  4669. const m_PF_APPLETALK = 5
  4670. const m_PF_ASH = 18
  4671. const m_PF_ATMPVC = 8
  4672. const m_PF_ATMSVC = 20
  4673. const m_PF_AX25 = 3
  4674. const m_PF_BLUETOOTH = 31
  4675. const m_PF_BRIDGE = 7
  4676. const m_PF_CAIF = 37
  4677. const m_PF_CAN = 29
  4678. const m_PF_DECnet = 12
  4679. const m_PF_ECONET = 19
  4680. const m_PF_FILE = "PF_LOCAL"
  4681. const m_PF_IB = 27
  4682. const m_PF_IEEE802154 = 36
  4683. const m_PF_INET = 2
  4684. const m_PF_INET6 = 10
  4685. const m_PF_IPX = 4
  4686. const m_PF_IRDA = 23
  4687. const m_PF_ISDN = 34
  4688. const m_PF_IUCV = 32
  4689. const m_PF_KCM = 41
  4690. const m_PF_KEY = 15
  4691. const m_PF_LLC = 26
  4692. const m_PF_LOCAL = 1
  4693. const m_PF_MAX = 45
  4694. const m_PF_MPLS = 28
  4695. const m_PF_NETBEUI = 13
  4696. const m_PF_NETLINK = 16
  4697. const m_PF_NETROM = 6
  4698. const m_PF_NFC = 39
  4699. const m_PF_PACKET = 17
  4700. const m_PF_PHONET = 35
  4701. const m_PF_PPPOX = 24
  4702. const m_PF_QIPCRTR = 42
  4703. const m_PF_RDS = 21
  4704. const m_PF_ROSE = 11
  4705. const m_PF_ROUTE = "PF_NETLINK"
  4706. const m_PF_RXRPC = 33
  4707. const m_PF_SECURITY = 14
  4708. const m_PF_SMC = 43
  4709. const m_PF_SNA = 22
  4710. const m_PF_TIPC = 30
  4711. const m_PF_UNIX = "PF_LOCAL"
  4712. const m_PF_UNSPEC = 0
  4713. const m_PF_VSOCK = 40
  4714. const m_PF_WANPIPE = 25
  4715. const m_PF_X25 = 9
  4716. const m_PF_XDP = 44
  4717. const m_SCM_CREDENTIALS = 0x02
  4718. const m_SCM_RIGHTS = 0x01
  4719. const m_SCM_TIMESTAMP = "SO_TIMESTAMP"
  4720. const m_SCM_TIMESTAMPING = "SO_TIMESTAMPING"
  4721. const m_SCM_TIMESTAMPING_OPT_STATS = 54
  4722. const m_SCM_TIMESTAMPING_PKTINFO = 58
  4723. const m_SCM_TIMESTAMPNS = "SO_TIMESTAMPNS"
  4724. const m_SCM_TXTIME = "SO_TXTIME"
  4725. const m_SCM_WIFI_STATUS = "SO_WIFI_STATUS"
  4726. const m_SHUT_RD = 0
  4727. const m_SHUT_RDWR = 2
  4728. const m_SHUT_WR = 1
  4729. const m_SOCK_CLOEXEC = 02000000
  4730. const m_SOCK_DCCP = 6
  4731. const m_SOCK_DGRAM = 2
  4732. const m_SOCK_NONBLOCK = 04000
  4733. const m_SOCK_PACKET = 10
  4734. const m_SOCK_RAW = 3
  4735. const m_SOCK_RDM = 4
  4736. const m_SOCK_SEQPACKET = 5
  4737. const m_SOCK_STREAM = 1
  4738. const m_SOL_AAL = 265
  4739. const m_SOL_ALG = 279
  4740. const m_SOL_ATM = 264
  4741. const m_SOL_BLUETOOTH = 274
  4742. const m_SOL_CAIF = 278
  4743. const m_SOL_DCCP = 269
  4744. const m_SOL_DECNET = 261
  4745. const m_SOL_ICMPV6 = 58
  4746. const m_SOL_IP = 0
  4747. const m_SOL_IPV6 = 41
  4748. const m_SOL_IRDA = 266
  4749. const m_SOL_IUCV = 277
  4750. const m_SOL_KCM = 281
  4751. const m_SOL_LLC = 268
  4752. const m_SOL_NETBEUI = 267
  4753. const m_SOL_NETLINK = 270
  4754. const m_SOL_NFC = 280
  4755. const m_SOL_PACKET = 263
  4756. const m_SOL_PNPIPE = 275
  4757. const m_SOL_PPPOL2TP = 273
  4758. const m_SOL_RAW = 255
  4759. const m_SOL_RDS = 276
  4760. const m_SOL_RXRPC = 272
  4761. const m_SOL_SOCKET = 1
  4762. const m_SOL_TIPC = 271
  4763. const m_SOL_TLS = 282
  4764. const m_SOL_X25 = 262
  4765. const m_SOL_XDP = 283
  4766. const m_SOMAXCONN = 128
  4767. const m_SO_ACCEPTCONN = 30
  4768. const m_SO_ATTACH_BPF = 50
  4769. const m_SO_ATTACH_FILTER = 26
  4770. const m_SO_ATTACH_REUSEPORT_CBPF = 51
  4771. const m_SO_ATTACH_REUSEPORT_EBPF = 52
  4772. const m_SO_BINDTODEVICE = 25
  4773. const m_SO_BINDTOIFINDEX = 62
  4774. const m_SO_BPF_EXTENSIONS = 48
  4775. const m_SO_BROADCAST = 6
  4776. const m_SO_BSDCOMPAT = 14
  4777. const m_SO_BUSY_POLL = 46
  4778. const m_SO_BUSY_POLL_BUDGET = 70
  4779. const m_SO_CNX_ADVICE = 53
  4780. const m_SO_COOKIE = 57
  4781. const m_SO_DEBUG = 1
  4782. const m_SO_DETACH_BPF = "SO_DETACH_FILTER"
  4783. const m_SO_DETACH_FILTER = 27
  4784. const m_SO_DETACH_REUSEPORT_BPF = 68
  4785. const m_SO_DOMAIN = 39
  4786. const m_SO_DONTROUTE = 5
  4787. const m_SO_ERROR = 4
  4788. const m_SO_GET_FILTER = "SO_ATTACH_FILTER"
  4789. const m_SO_INCOMING_CPU = 49
  4790. const m_SO_INCOMING_NAPI_ID = 56
  4791. const m_SO_KEEPALIVE = 9
  4792. const m_SO_LINGER = 13
  4793. const m_SO_LOCK_FILTER = 44
  4794. const m_SO_MARK = 36
  4795. const m_SO_MAX_PACING_RATE = 47
  4796. const m_SO_MEMINFO = 55
  4797. const m_SO_NOFCS = 43
  4798. const m_SO_NO_CHECK = 11
  4799. const m_SO_OOBINLINE = 10
  4800. const m_SO_PASSCRED = 16
  4801. const m_SO_PASSSEC = 34
  4802. const m_SO_PEEK_OFF = 42
  4803. const m_SO_PEERCRED = 17
  4804. const m_SO_PEERGROUPS = 59
  4805. const m_SO_PEERNAME = 28
  4806. const m_SO_PEERSEC = 31
  4807. const m_SO_PREFER_BUSY_POLL = 69
  4808. const m_SO_PRIORITY = 12
  4809. const m_SO_PROTOCOL = 38
  4810. const m_SO_RCVBUF = 8
  4811. const m_SO_RCVBUFFORCE = 33
  4812. const m_SO_RCVLOWAT = 18
  4813. const m_SO_RCVTIMEO = 20
  4814. const m_SO_REUSEADDR = 2
  4815. const m_SO_REUSEPORT = 15
  4816. const m_SO_RXQ_OVFL = 40
  4817. const m_SO_SECURITY_AUTHENTICATION = 22
  4818. const m_SO_SECURITY_ENCRYPTION_NETWORK = 24
  4819. const m_SO_SECURITY_ENCRYPTION_TRANSPORT = 23
  4820. const m_SO_SELECT_ERR_QUEUE = 45
  4821. const m_SO_SNDBUF = 7
  4822. const m_SO_SNDBUFFORCE = 32
  4823. const m_SO_SNDLOWAT = 19
  4824. const m_SO_SNDTIMEO = 21
  4825. const m_SO_TIMESTAMP = 29
  4826. const m_SO_TIMESTAMPING = 37
  4827. const m_SO_TIMESTAMPNS = 35
  4828. const m_SO_TXTIME = 61
  4829. const m_SO_TYPE = 3
  4830. const m_SO_WIFI_STATUS = 41
  4831. const m_SO_ZEROCOPY = 60
  4832. const m_UINT_MAX2 = 0xffffffff
  4833. type Tsocklen_t = uint32
  4834. type Tsa_family_t = uint16
  4835. type Tmsghdr = struct {
  4836. Fmsg_name uintptr
  4837. Fmsg_namelen Tsocklen_t
  4838. Fmsg_iov uintptr
  4839. Fmsg_iovlen int32
  4840. F__pad1 int32
  4841. Fmsg_control uintptr
  4842. Fmsg_controllen Tsocklen_t
  4843. F__pad2 int32
  4844. Fmsg_flags int32
  4845. }
  4846. type Tcmsghdr = struct {
  4847. Fcmsg_len Tsocklen_t
  4848. F__pad1 int32
  4849. Fcmsg_level int32
  4850. Fcmsg_type int32
  4851. }
  4852. type Tucred = struct {
  4853. Fpid Tpid_t
  4854. Fuid Tuid_t
  4855. Fgid Tgid_t
  4856. }
  4857. type Tmmsghdr = struct {
  4858. Fmsg_hdr Tmsghdr
  4859. Fmsg_len uint32
  4860. }
  4861. type Tlinger = struct {
  4862. Fl_onoff int32
  4863. Fl_linger int32
  4864. }
  4865. type Tsockaddr = struct {
  4866. Fsa_family Tsa_family_t
  4867. Fsa_data [14]uint8
  4868. }
  4869. type Tsockaddr_storage = struct {
  4870. Fss_family Tsa_family_t
  4871. F__ss_padding [118]uint8
  4872. F__ss_align uint64
  4873. }
  4874. type Tsockaddr_un = struct {
  4875. Fsun_family Tsa_family_t
  4876. Fsun_path [108]uint8
  4877. }
  4878. // C documentation
  4879. //
  4880. // /* Linux and OpenBSD */
  4881. func Xgetpeereid(tls *libc.TLS, s int32, euid uintptr, egid uintptr) (r int32) {
  4882. bp := tls.Alloc(16)
  4883. defer tls.Free(16)
  4884. var ret int32
  4885. var _ /* cred at bp+0 */ Tucred
  4886. var _ /* credlen at bp+12 */ Tsocklen_t
  4887. _ = ret
  4888. *(*Tsocklen_t)(unsafe.Pointer(bp + 12)) = uint32(12)
  4889. ret = libc.Xgetsockopt(tls, s, int32(m_SOL_SOCKET), int32(m_SO_PEERCRED), bp, bp+12)
  4890. if ret != 0 {
  4891. return ret
  4892. }
  4893. *(*Tuid_t)(unsafe.Pointer(euid)) = (*(*Tucred)(unsafe.Pointer(bp))).Fuid
  4894. *(*Tgid_t)(unsafe.Pointer(egid)) = (*(*Tucred)(unsafe.Pointer(bp))).Fgid
  4895. return 0
  4896. }
  4897. /*
  4898. * Swap two areas of size number of bytes. Although qsort(3) permits random
  4899. * blocks of memory to be sorted, sorting pointers is almost certainly the
  4900. * common case (and, were it not, could easily be made so). Regardless, it
  4901. * isn't worth optimizing; the SWAP's get sped up by the cache, and pointer
  4902. * arithmetic gets lost in the time required for comparison function calls.
  4903. */
  4904. /* Copy one block of size size to another. */
  4905. /*
  4906. * Build the list into a heap, where a heap is defined such that for
  4907. * the records K1 ... KN, Kj/2 >= Kj for 1 <= j/2 <= j <= N.
  4908. *
  4909. * There are two cases. If j == nmemb, select largest of Ki and Kj. If
  4910. * j < nmemb, select largest of Ki, Kj and Kj+1.
  4911. */
  4912. /*
  4913. * Select the top of the heap and 'heapify'. Since by far the most expensive
  4914. * action is the call to the compar function, a considerable optimization
  4915. * in the average case can be achieved due to the fact that k, the displaced
  4916. * element, is usually quite small, so it would be preferable to first
  4917. * heapify, always maintaining the invariant that the larger child is copied
  4918. * over its parent's record.
  4919. *
  4920. * Then, starting from the *bottom* of the heap, finding k's correct place,
  4921. * again maintaining the invariant. As a result of the invariant no element
  4922. * is 'lost' when k is assigned its correct place in the heap.
  4923. *
  4924. * The time savings from this optimization are on the order of 15-20% for the
  4925. * average case. See Knuth, Vol. 3, page 158, problem 18.
  4926. *
  4927. * XXX Don't break the #define SELECT line, below. Reiser cpp gets upset.
  4928. */
  4929. // C documentation
  4930. //
  4931. // /*
  4932. // * Heapsort -- Knuth, Vol. 3, page 145. Runs in O (N lg N), both average
  4933. // * and worst. While heapsort is faster than the worst case of quicksort,
  4934. // * the BSD quicksort does median selection so that the chance of finding
  4935. // * a data set that will trigger the worst case is nonexistent. Heapsort's
  4936. // * only advantage over quicksort is that it requires little additional memory.
  4937. // */
  4938. func Xheapsort(tls *libc.TLS, vbase uintptr, nmemb Tsize_t, size Tsize_t, compar uintptr) (r int32) {
  4939. var base, k, p, t, tmp1, tmp2, v1, v12, v13, v16, v17, v22, v23, v27, v28, v31, v32, v8, v9 uintptr
  4940. var cnt, i, j, l, v10, v14, v19, v20, v25, v29, v3, v5, v6 Tsize_t
  4941. var tmp uint8
  4942. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  4943. if nmemb <= uint64(1) {
  4944. return 0
  4945. }
  4946. if !(size != 0) {
  4947. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  4948. return -int32(1)
  4949. }
  4950. v1 = libc.Xmalloc(tls, size)
  4951. k = v1
  4952. if v1 == libc.UintptrFromInt32(0) {
  4953. return -int32(1)
  4954. }
  4955. /*
  4956. * Items are numbered from 1 to nmemb, so offset from size bytes
  4957. * below the starting address.
  4958. */
  4959. base = vbase - uintptr(size)
  4960. l = nmemb/uint64(2) + uint64(1)
  4961. for {
  4962. l--
  4963. v3 = l
  4964. if !(v3 != 0) {
  4965. break
  4966. }
  4967. i = l
  4968. for {
  4969. v5 = i * libc.Uint64FromInt32(2)
  4970. j = v5
  4971. if !(v5 <= nmemb) {
  4972. break
  4973. }
  4974. p = base + uintptr(j*size)
  4975. if j < nmemb && (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{compar})))(tls, p, p+uintptr(size)) < 0 {
  4976. p += uintptr(size)
  4977. j++
  4978. }
  4979. t = base + uintptr(i*size)
  4980. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{compar})))(tls, p, t) <= 0 {
  4981. break
  4982. }
  4983. cnt = size
  4984. for {
  4985. tmp = *(*uint8)(unsafe.Pointer(t))
  4986. v8 = t
  4987. t++
  4988. *(*uint8)(unsafe.Pointer(v8)) = *(*uint8)(unsafe.Pointer(p))
  4989. v9 = p
  4990. p++
  4991. *(*uint8)(unsafe.Pointer(v9)) = tmp
  4992. goto _7
  4993. _7:
  4994. ;
  4995. cnt--
  4996. v6 = cnt
  4997. if !(v6 != 0) {
  4998. break
  4999. }
  5000. }
  5001. goto _4
  5002. _4:
  5003. ;
  5004. i = j
  5005. }
  5006. goto _2
  5007. _2:
  5008. }
  5009. /*
  5010. * For each element of the heap, save the largest element into its
  5011. * final slot, save the displaced element (k), then recreate the
  5012. * heap.
  5013. */
  5014. for nmemb > uint64(1) {
  5015. cnt = size
  5016. tmp1 = k
  5017. tmp2 = base + uintptr(nmemb*size)
  5018. for {
  5019. v12 = tmp1
  5020. tmp1++
  5021. v13 = tmp2
  5022. tmp2++
  5023. *(*uint8)(unsafe.Pointer(v12)) = *(*uint8)(unsafe.Pointer(v13))
  5024. goto _11
  5025. _11:
  5026. ;
  5027. cnt--
  5028. v10 = cnt
  5029. if !(v10 != 0) {
  5030. break
  5031. }
  5032. }
  5033. cnt = size
  5034. tmp1 = base + uintptr(nmemb*size)
  5035. tmp2 = base + uintptr(size)
  5036. for {
  5037. v16 = tmp1
  5038. tmp1++
  5039. v17 = tmp2
  5040. tmp2++
  5041. *(*uint8)(unsafe.Pointer(v16)) = *(*uint8)(unsafe.Pointer(v17))
  5042. goto _15
  5043. _15:
  5044. ;
  5045. cnt--
  5046. v14 = cnt
  5047. if !(v14 != 0) {
  5048. break
  5049. }
  5050. }
  5051. nmemb--
  5052. i = uint64(1)
  5053. for {
  5054. v19 = i * libc.Uint64FromInt32(2)
  5055. j = v19
  5056. if !(v19 <= nmemb) {
  5057. break
  5058. }
  5059. p = base + uintptr(j*size)
  5060. if j < nmemb && (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{compar})))(tls, p, p+uintptr(size)) < 0 {
  5061. p += uintptr(size)
  5062. j++
  5063. }
  5064. t = base + uintptr(i*size)
  5065. cnt = size
  5066. tmp1 = t
  5067. tmp2 = p
  5068. for {
  5069. v22 = tmp1
  5070. tmp1++
  5071. v23 = tmp2
  5072. tmp2++
  5073. *(*uint8)(unsafe.Pointer(v22)) = *(*uint8)(unsafe.Pointer(v23))
  5074. goto _21
  5075. _21:
  5076. ;
  5077. cnt--
  5078. v20 = cnt
  5079. if !(v20 != 0) {
  5080. break
  5081. }
  5082. }
  5083. goto _18
  5084. _18:
  5085. ;
  5086. i = j
  5087. }
  5088. for {
  5089. j = i
  5090. i = j / uint64(2)
  5091. p = base + uintptr(j*size)
  5092. t = base + uintptr(i*size)
  5093. if j == uint64(1) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{compar})))(tls, k, t) < 0 {
  5094. cnt = size
  5095. tmp1 = p
  5096. tmp2 = k
  5097. for {
  5098. v27 = tmp1
  5099. tmp1++
  5100. v28 = tmp2
  5101. tmp2++
  5102. *(*uint8)(unsafe.Pointer(v27)) = *(*uint8)(unsafe.Pointer(v28))
  5103. goto _26
  5104. _26:
  5105. ;
  5106. cnt--
  5107. v25 = cnt
  5108. if !(v25 != 0) {
  5109. break
  5110. }
  5111. }
  5112. break
  5113. }
  5114. cnt = size
  5115. tmp1 = p
  5116. tmp2 = t
  5117. for {
  5118. v31 = tmp1
  5119. tmp1++
  5120. v32 = tmp2
  5121. tmp2++
  5122. *(*uint8)(unsafe.Pointer(v31)) = *(*uint8)(unsafe.Pointer(v32))
  5123. goto _30
  5124. _30:
  5125. ;
  5126. cnt--
  5127. v29 = cnt
  5128. if !(v29 != 0) {
  5129. break
  5130. }
  5131. }
  5132. goto _24
  5133. _24:
  5134. }
  5135. }
  5136. libc.Xfree(tls, k)
  5137. return 0
  5138. }
  5139. const m_HN_AUTOSCALE1 = 32
  5140. const m_HN_B1 = 4
  5141. const m_HN_DECIMAL1 = 1
  5142. const m_HN_DIVISOR_10001 = 8
  5143. const m_HN_GETSCALE1 = 16
  5144. const m_HN_IEC_PREFIXES1 = 16
  5145. const m_HN_NOSPACE1 = 2
  5146. const m_LC_ALL = 6
  5147. const m_LC_ALL_MASK = 0x7fffffff
  5148. const m_LC_COLLATE = 3
  5149. const m_LC_CTYPE = 0
  5150. const m_LC_MESSAGES = 5
  5151. const m_LC_MONETARY = 4
  5152. const m_LC_NUMERIC = 1
  5153. const m_LC_TIME = 2
  5154. type Tlconv = struct {
  5155. Fdecimal_point uintptr
  5156. Fthousands_sep uintptr
  5157. Fgrouping uintptr
  5158. Fint_curr_symbol uintptr
  5159. Fcurrency_symbol uintptr
  5160. Fmon_decimal_point uintptr
  5161. Fmon_thousands_sep uintptr
  5162. Fmon_grouping uintptr
  5163. Fpositive_sign uintptr
  5164. Fnegative_sign uintptr
  5165. Fint_frac_digits uint8
  5166. Ffrac_digits uint8
  5167. Fp_cs_precedes uint8
  5168. Fp_sep_by_space uint8
  5169. Fn_cs_precedes uint8
  5170. Fn_sep_by_space uint8
  5171. Fp_sign_posn uint8
  5172. Fn_sign_posn uint8
  5173. Fint_p_cs_precedes uint8
  5174. Fint_p_sep_by_space uint8
  5175. Fint_n_cs_precedes uint8
  5176. Fint_n_sep_by_space uint8
  5177. Fint_p_sign_posn uint8
  5178. Fint_n_sign_posn uint8
  5179. }
  5180. /*
  5181. * Copyright (c) 1996 Peter Wemm <peter@FreeBSD.org>.
  5182. * All rights reserved.
  5183. * Copyright (c) 2002 Networks Associates Technology, Inc.
  5184. * All rights reserved.
  5185. *
  5186. * Portions of this software were developed for the FreeBSD Project by
  5187. * ThinkSec AS and NAI Labs, the Security Research Division of Network
  5188. * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
  5189. * ("CBOSS"), as part of the DARPA CHATS research program.
  5190. *
  5191. * Redistribution and use in source and binary forms, with or without
  5192. * modification, is permitted provided that the following conditions
  5193. * are met:
  5194. * 1. Redistributions of source code must retain the above copyright
  5195. * notice, this list of conditions and the following disclaimer.
  5196. * 2. Redistributions in binary form must reproduce the above copyright
  5197. * notice, this list of conditions and the following disclaimer in the
  5198. * documentation and/or other materials provided with the distribution.
  5199. * 3. The name of the author may not be used to endorse or promote
  5200. * products derived from this software without specific prior written
  5201. * permission.
  5202. *
  5203. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  5204. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  5205. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  5206. * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  5207. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  5208. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  5209. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  5210. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  5211. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  5212. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  5213. * SUCH DAMAGE.
  5214. *
  5215. * $FreeBSD: src/lib/libutil/libutil.h,v 1.47 2008/04/23 00:49:12 scf Exp $
  5216. */
  5217. var _maxscale = int32(6)
  5218. func Xhumanize_number(tls *libc.TLS, buf uintptr, len1 Tsize_t, quotient Tint64_t, suffix uintptr, scale int32, flags int32) (r1 int32) {
  5219. bp := tls.Alloc(64)
  5220. defer tls.Free(64)
  5221. var baselen Tsize_t
  5222. var divisor, max Tint64_t
  5223. var divisordeccut, i, r, remainder, s1, s2, sign, v2 int32
  5224. var prefixes, sep uintptr
  5225. _, _, _, _, _, _, _, _, _, _, _, _, _ = baselen, divisor, divisordeccut, i, max, prefixes, r, remainder, s1, s2, sep, sign, v2
  5226. /* Since so many callers don't check -1, NUL terminate the buffer */
  5227. if len1 > uint64(0) {
  5228. *(*uint8)(unsafe.Pointer(buf)) = uint8('\000')
  5229. }
  5230. /* validate args */
  5231. if buf == libc.UintptrFromInt32(0) || suffix == libc.UintptrFromInt32(0) {
  5232. return -int32(1)
  5233. }
  5234. if scale < 0 {
  5235. return -int32(1)
  5236. } else {
  5237. if scale > _maxscale && scale & ^(libc.Int32FromInt32(m_HN_AUTOSCALE1)|libc.Int32FromInt32(m_HN_GETSCALE1)) != 0 {
  5238. return -int32(1)
  5239. }
  5240. }
  5241. if flags&int32(m_HN_DIVISOR_10001) != 0 && flags&int32(m_HN_IEC_PREFIXES1) != 0 {
  5242. return -int32(1)
  5243. }
  5244. /* setup parameters */
  5245. remainder = 0
  5246. if flags&int32(m_HN_IEC_PREFIXES1) != 0 {
  5247. baselen = uint64(2)
  5248. /*
  5249. * Use the prefixes for power of two recommended by
  5250. * the International Electrotechnical Commission
  5251. * (IEC) in IEC 80000-3 (i.e. Ki, Mi, Gi...).
  5252. *
  5253. * HN_IEC_PREFIXES implies a divisor of 1024 here
  5254. * (use of HN_DIVISOR_1000 would have triggered
  5255. * an assertion earlier).
  5256. */
  5257. divisor = int64(1024)
  5258. divisordeccut = int32(973) /* ceil(.95 * 1024) */
  5259. if flags&int32(m_HN_B1) != 0 {
  5260. prefixes = __ccgo_ts + 156
  5261. } else {
  5262. prefixes = __ccgo_ts + 177
  5263. }
  5264. } else {
  5265. baselen = uint64(1)
  5266. if flags&int32(m_HN_DIVISOR_10001) != 0 {
  5267. divisor = int64(1000)
  5268. divisordeccut = int32(950)
  5269. if flags&int32(m_HN_B1) != 0 {
  5270. prefixes = __ccgo_ts + 198
  5271. } else {
  5272. prefixes = __ccgo_ts + 218
  5273. }
  5274. } else {
  5275. divisor = int64(1024)
  5276. divisordeccut = int32(973) /* ceil(.95 * 1024) */
  5277. if flags&int32(m_HN_B1) != 0 {
  5278. prefixes = __ccgo_ts + 238
  5279. } else {
  5280. prefixes = __ccgo_ts + 258
  5281. }
  5282. }
  5283. }
  5284. if quotient < 0 {
  5285. sign = -int32(1)
  5286. quotient = -quotient
  5287. baselen += uint64(2) /* sign, digit */
  5288. } else {
  5289. sign = int32(1)
  5290. baselen += uint64(1) /* digit */
  5291. }
  5292. if flags&int32(m_HN_NOSPACE1) != 0 {
  5293. sep = __ccgo_ts + 53
  5294. } else {
  5295. sep = __ccgo_ts + 278
  5296. baselen++
  5297. }
  5298. baselen += libc.Xstrlen(tls, suffix)
  5299. /* Check if enough room for `x y' + suffix + `\0' */
  5300. if len1 < baselen+uint64(1) {
  5301. return -int32(1)
  5302. }
  5303. if scale&(libc.Int32FromInt32(m_HN_AUTOSCALE1)|libc.Int32FromInt32(m_HN_GETSCALE1)) != 0 {
  5304. /* See if there is additional columns can be used. */
  5305. max = int64(1)
  5306. i = libc.Int32FromUint64(len1 - baselen)
  5307. for {
  5308. v2 = i
  5309. i--
  5310. if !(v2 > 0) {
  5311. break
  5312. }
  5313. max *= int64(10)
  5314. goto _1
  5315. _1:
  5316. }
  5317. /*
  5318. * Divide the number until it fits the given column.
  5319. * If there will be an overflow by the rounding below,
  5320. * divide once more.
  5321. */
  5322. i = 0
  5323. for {
  5324. if !((quotient >= max || quotient == max-int64(1) && (remainder >= divisordeccut || int64(remainder) >= divisor/int64(2))) && i < _maxscale) {
  5325. break
  5326. }
  5327. remainder = int32(quotient % divisor)
  5328. quotient /= divisor
  5329. goto _3
  5330. _3:
  5331. ;
  5332. i++
  5333. }
  5334. if scale&int32(m_HN_GETSCALE1) != 0 {
  5335. return i
  5336. }
  5337. } else {
  5338. i = 0
  5339. for {
  5340. if !(i < scale && i < _maxscale) {
  5341. break
  5342. }
  5343. remainder = int32(quotient % divisor)
  5344. quotient /= divisor
  5345. goto _4
  5346. _4:
  5347. ;
  5348. i++
  5349. }
  5350. }
  5351. /* If a value <= 9.9 after rounding and ... */
  5352. /*
  5353. * XXX - should we make sure there is enough space for the decimal
  5354. * place and if not, don't do HN_DECIMAL?
  5355. */
  5356. if (quotient == int64(9) && remainder < divisordeccut || quotient < int64(9)) && i > 0 && flags&int32(m_HN_DECIMAL1) != 0 {
  5357. s1 = int32(int64(int32(quotient)) + (int64(remainder*int32(10))+divisor/int64(2))/divisor/int64(10))
  5358. s2 = int32((int64(remainder*int32(10)) + divisor/int64(2)) / divisor % int64(10))
  5359. 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))
  5360. } else {
  5361. 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))
  5362. }
  5363. return r
  5364. }
  5365. const m_HN_AUTOSCALE2 = 0x20
  5366. const m_HN_B2 = 0x04
  5367. const m_HN_DECIMAL2 = 0x01
  5368. const m_HN_DIVISOR_10002 = 0x08
  5369. const m_HN_GETSCALE2 = 0x10
  5370. const m_HN_IEC_PREFIXES2 = 0x10
  5371. const m_HN_NOSPACE2 = 0x02
  5372. const m_INET6_ADDRSTRLEN = 46
  5373. const m_INET_ADDRSTRLEN = 16
  5374. const m_IN_CLASSA_MAX = 128
  5375. const m_IN_CLASSA_NET = 0xff000000
  5376. const m_IN_CLASSA_NSHIFT = 24
  5377. const m_IN_CLASSB_MAX = 65536
  5378. const m_IN_CLASSB_NET = 0xffff0000
  5379. const m_IN_CLASSB_NSHIFT = 16
  5380. const m_IN_CLASSC_NET = 0xffffff00
  5381. const m_IN_CLASSC_NSHIFT = 8
  5382. const m_IN_LOOPBACKNET = 127
  5383. const m_IPPORT_RESERVED = 1024
  5384. const m_IPPROTO_AH = 51
  5385. const m_IPPROTO_BEETPH = 94
  5386. const m_IPPROTO_COMP = 108
  5387. const m_IPPROTO_DCCP = 33
  5388. const m_IPPROTO_DSTOPTS = 60
  5389. const m_IPPROTO_EGP = 8
  5390. const m_IPPROTO_ENCAP = 98
  5391. const m_IPPROTO_ESP = 50
  5392. const m_IPPROTO_ETHERNET = 143
  5393. const m_IPPROTO_FRAGMENT = 44
  5394. const m_IPPROTO_GRE = 47
  5395. const m_IPPROTO_HOPOPTS = 0
  5396. const m_IPPROTO_ICMP = 1
  5397. const m_IPPROTO_ICMPV6 = 58
  5398. const m_IPPROTO_IDP = 22
  5399. const m_IPPROTO_IGMP = 2
  5400. const m_IPPROTO_IP = 0
  5401. const m_IPPROTO_IPIP = 4
  5402. const m_IPPROTO_IPV6 = 41
  5403. const m_IPPROTO_MAX = 263
  5404. const m_IPPROTO_MH = 135
  5405. const m_IPPROTO_MPLS = 137
  5406. const m_IPPROTO_MPTCP = 262
  5407. const m_IPPROTO_MTP = 92
  5408. const m_IPPROTO_NONE = 59
  5409. const m_IPPROTO_PIM = 103
  5410. const m_IPPROTO_PUP = 12
  5411. const m_IPPROTO_RAW = 255
  5412. const m_IPPROTO_ROUTING = 43
  5413. const m_IPPROTO_RSVP = 46
  5414. const m_IPPROTO_SCTP = 132
  5415. const m_IPPROTO_TCP = 6
  5416. const m_IPPROTO_TP = 29
  5417. const m_IPPROTO_UDP = 17
  5418. const m_IPPROTO_UDPLITE = 136
  5419. const m_IPV6_2292DSTOPTS = 4
  5420. const m_IPV6_2292HOPLIMIT = 8
  5421. const m_IPV6_2292HOPOPTS = 3
  5422. const m_IPV6_2292PKTINFO = 2
  5423. const m_IPV6_2292PKTOPTIONS = 6
  5424. const m_IPV6_2292RTHDR = 5
  5425. const m_IPV6_ADDRFORM = 1
  5426. const m_IPV6_ADDR_PREFERENCES = 72
  5427. const m_IPV6_ADD_MEMBERSHIP = "IPV6_JOIN_GROUP"
  5428. const m_IPV6_AUTHHDR = 10
  5429. const m_IPV6_AUTOFLOWLABEL = 70
  5430. const m_IPV6_CHECKSUM = 7
  5431. const m_IPV6_DONTFRAG = 62
  5432. const m_IPV6_DROP_MEMBERSHIP = "IPV6_LEAVE_GROUP"
  5433. const m_IPV6_DSTOPTS = 59
  5434. const m_IPV6_FREEBIND = 78
  5435. const m_IPV6_HDRINCL = 36
  5436. const m_IPV6_HOPLIMIT = 52
  5437. const m_IPV6_HOPOPTS = 54
  5438. const m_IPV6_IPSEC_POLICY = 34
  5439. const m_IPV6_JOIN_ANYCAST = 27
  5440. const m_IPV6_JOIN_GROUP = 20
  5441. const m_IPV6_LEAVE_ANYCAST = 28
  5442. const m_IPV6_LEAVE_GROUP = 21
  5443. const m_IPV6_MINHOPCOUNT = 73
  5444. const m_IPV6_MTU = 24
  5445. const m_IPV6_MTU_DISCOVER = 23
  5446. const m_IPV6_MULTICAST_ALL = 29
  5447. const m_IPV6_MULTICAST_HOPS = 18
  5448. const m_IPV6_MULTICAST_IF = 17
  5449. const m_IPV6_MULTICAST_LOOP = 19
  5450. const m_IPV6_NEXTHOP = 9
  5451. const m_IPV6_ORIGDSTADDR = 74
  5452. const m_IPV6_PATHMTU = 61
  5453. const m_IPV6_PKTINFO = 50
  5454. const m_IPV6_PMTUDISC_DO = 2
  5455. const m_IPV6_PMTUDISC_DONT = 0
  5456. const m_IPV6_PMTUDISC_INTERFACE = 4
  5457. const m_IPV6_PMTUDISC_OMIT = 5
  5458. const m_IPV6_PMTUDISC_PROBE = 3
  5459. const m_IPV6_PMTUDISC_WANT = 1
  5460. const m_IPV6_PREFER_SRC_CGA = 0x0008
  5461. const m_IPV6_PREFER_SRC_COA = 0x0004
  5462. const m_IPV6_PREFER_SRC_HOME = 0x0400
  5463. const m_IPV6_PREFER_SRC_NONCGA = 0x0800
  5464. const m_IPV6_PREFER_SRC_PUBLIC = 0x0002
  5465. const m_IPV6_PREFER_SRC_PUBTMP_DEFAULT = 0x0100
  5466. const m_IPV6_PREFER_SRC_TMP = 0x0001
  5467. const m_IPV6_RECVDSTOPTS = 58
  5468. const m_IPV6_RECVERR = 25
  5469. const m_IPV6_RECVFRAGSIZE = 77
  5470. const m_IPV6_RECVHOPLIMIT = 51
  5471. const m_IPV6_RECVHOPOPTS = 53
  5472. const m_IPV6_RECVORIGDSTADDR = "IPV6_ORIGDSTADDR"
  5473. const m_IPV6_RECVPATHMTU = 60
  5474. const m_IPV6_RECVPKTINFO = 49
  5475. const m_IPV6_RECVRTHDR = 56
  5476. const m_IPV6_RECVTCLASS = 66
  5477. const m_IPV6_ROUTER_ALERT = 22
  5478. const m_IPV6_ROUTER_ALERT_ISOLATE = 30
  5479. const m_IPV6_RTHDR = 57
  5480. const m_IPV6_RTHDRDSTOPTS = 55
  5481. const m_IPV6_RTHDR_LOOSE = 0
  5482. const m_IPV6_RTHDR_STRICT = 1
  5483. const m_IPV6_RTHDR_TYPE_0 = 0
  5484. const m_IPV6_RXDSTOPTS = "IPV6_DSTOPTS"
  5485. const m_IPV6_RXHOPOPTS = "IPV6_HOPOPTS"
  5486. const m_IPV6_TCLASS = 67
  5487. const m_IPV6_TRANSPARENT = 75
  5488. const m_IPV6_UNICAST_HOPS = 16
  5489. const m_IPV6_UNICAST_IF = 76
  5490. const m_IPV6_V6ONLY = 26
  5491. const m_IPV6_XFRM_POLICY = 35
  5492. const m_IP_ADD_MEMBERSHIP = 35
  5493. const m_IP_ADD_SOURCE_MEMBERSHIP = 39
  5494. const m_IP_BIND_ADDRESS_NO_PORT = 24
  5495. const m_IP_BLOCK_SOURCE = 38
  5496. const m_IP_CHECKSUM = 23
  5497. const m_IP_DEFAULT_MULTICAST_LOOP = 1
  5498. const m_IP_DEFAULT_MULTICAST_TTL = 1
  5499. const m_IP_DROP_MEMBERSHIP = 36
  5500. const m_IP_DROP_SOURCE_MEMBERSHIP = 40
  5501. const m_IP_FREEBIND = 15
  5502. const m_IP_HDRINCL = 3
  5503. const m_IP_IPSEC_POLICY = 16
  5504. const m_IP_MAX_MEMBERSHIPS = 20
  5505. const m_IP_MINTTL = 21
  5506. const m_IP_MSFILTER = 41
  5507. const m_IP_MTU = 14
  5508. const m_IP_MTU_DISCOVER = 10
  5509. const m_IP_MULTICAST_ALL = 49
  5510. const m_IP_MULTICAST_IF = 32
  5511. const m_IP_MULTICAST_LOOP = 34
  5512. const m_IP_MULTICAST_TTL = 33
  5513. const m_IP_NODEFRAG = 22
  5514. const m_IP_OPTIONS = 4
  5515. const m_IP_ORIGDSTADDR = 20
  5516. const m_IP_PASSSEC = 18
  5517. const m_IP_PKTINFO = 8
  5518. const m_IP_PKTOPTIONS = 9
  5519. const m_IP_PMTUDISC = 10
  5520. const m_IP_PMTUDISC_DO = 2
  5521. const m_IP_PMTUDISC_DONT = 0
  5522. const m_IP_PMTUDISC_INTERFACE = 4
  5523. const m_IP_PMTUDISC_OMIT = 5
  5524. const m_IP_PMTUDISC_PROBE = 3
  5525. const m_IP_PMTUDISC_WANT = 1
  5526. const m_IP_RECVERR = 11
  5527. const m_IP_RECVERR_RFC4884 = 26
  5528. const m_IP_RECVFRAGSIZE = 25
  5529. const m_IP_RECVOPTS = 6
  5530. const m_IP_RECVORIGDSTADDR = "IP_ORIGDSTADDR"
  5531. const m_IP_RECVRETOPTS = "IP_RETOPTS"
  5532. const m_IP_RECVTOS = 13
  5533. const m_IP_RECVTTL = 12
  5534. const m_IP_RETOPTS = 7
  5535. const m_IP_ROUTER_ALERT = 5
  5536. const m_IP_TOS = 1
  5537. const m_IP_TRANSPARENT = 19
  5538. const m_IP_TTL = 2
  5539. const m_IP_UNBLOCK_SOURCE = 37
  5540. const m_IP_UNICAST_IF = 50
  5541. const m_IP_XFRM_POLICY = 17
  5542. const m_MCAST_BLOCK_SOURCE = 43
  5543. const m_MCAST_EXCLUDE = 0
  5544. const m_MCAST_INCLUDE = 1
  5545. const m_MCAST_JOIN_GROUP = 42
  5546. const m_MCAST_JOIN_SOURCE_GROUP = 46
  5547. const m_MCAST_LEAVE_GROUP = 45
  5548. const m_MCAST_LEAVE_SOURCE_GROUP = 47
  5549. const m_MCAST_MSFILTER = 48
  5550. const m_MCAST_UNBLOCK_SOURCE = 44
  5551. const m___UAPI_DEF_IN6_ADDR = 0
  5552. const m___UAPI_DEF_IN6_ADDR_ALT = 0
  5553. const m___UAPI_DEF_IN6_PKTINFO = 0
  5554. const m___UAPI_DEF_IN_ADDR = 0
  5555. const m___UAPI_DEF_IN_CLASS = 0
  5556. const m___UAPI_DEF_IN_IPPROTO = 0
  5557. const m___UAPI_DEF_IN_PKTINFO = 0
  5558. const m___UAPI_DEF_IP6_MTUINFO = 0
  5559. const m___UAPI_DEF_IPPROTO_V6 = 0
  5560. const m___UAPI_DEF_IPV6_MREQ = 0
  5561. const m___UAPI_DEF_IPV6_OPTIONS = 0
  5562. const m___UAPI_DEF_IP_MREQ = 0
  5563. const m___UAPI_DEF_SOCKADDR_IN = 0
  5564. const m___UAPI_DEF_SOCKADDR_IN6 = 0
  5565. type Tin_port_t = uint16
  5566. type Tin_addr_t = uint32
  5567. type Tin_addr = struct {
  5568. Fs_addr Tin_addr_t
  5569. }
  5570. type Tsockaddr_in = struct {
  5571. Fsin_family Tsa_family_t
  5572. Fsin_port Tin_port_t
  5573. Fsin_addr Tin_addr
  5574. Fsin_zero [8]Tuint8_t
  5575. }
  5576. type Tin6_addr = struct {
  5577. F__in6_union struct {
  5578. F__s6_addr16 [0][8]Tuint16_t
  5579. F__s6_addr32 [0][4]Tuint32_t
  5580. F__s6_addr [16]Tuint8_t
  5581. }
  5582. }
  5583. type Tsockaddr_in6 = struct {
  5584. Fsin6_family Tsa_family_t
  5585. Fsin6_port Tin_port_t
  5586. Fsin6_flowinfo Tuint32_t
  5587. Fsin6_addr Tin6_addr
  5588. Fsin6_scope_id Tuint32_t
  5589. }
  5590. type Tipv6_mreq = struct {
  5591. Fipv6mr_multiaddr Tin6_addr
  5592. Fipv6mr_interface uint32
  5593. }
  5594. type Tip_opts = struct {
  5595. Fip_dst Tin_addr
  5596. Fip_opts [40]uint8
  5597. }
  5598. type Tip_mreq = struct {
  5599. Fimr_multiaddr Tin_addr
  5600. Fimr_interface Tin_addr
  5601. }
  5602. type Tip_mreqn = struct {
  5603. Fimr_multiaddr Tin_addr
  5604. Fimr_address Tin_addr
  5605. Fimr_ifindex int32
  5606. }
  5607. type Tip_mreq_source = struct {
  5608. Fimr_multiaddr Tin_addr
  5609. Fimr_interface Tin_addr
  5610. Fimr_sourceaddr Tin_addr
  5611. }
  5612. type Tip_msfilter = struct {
  5613. Fimsf_multiaddr Tin_addr
  5614. Fimsf_interface Tin_addr
  5615. Fimsf_fmode Tuint32_t
  5616. Fimsf_numsrc Tuint32_t
  5617. Fimsf_slist [1]Tin_addr
  5618. }
  5619. type Tgroup_req = struct {
  5620. Fgr_interface Tuint32_t
  5621. Fgr_group Tsockaddr_storage
  5622. }
  5623. type Tgroup_source_req = struct {
  5624. Fgsr_interface Tuint32_t
  5625. Fgsr_group Tsockaddr_storage
  5626. Fgsr_source Tsockaddr_storage
  5627. }
  5628. type Tgroup_filter = struct {
  5629. Fgf_interface Tuint32_t
  5630. Fgf_group Tsockaddr_storage
  5631. Fgf_fmode Tuint32_t
  5632. Fgf_numsrc Tuint32_t
  5633. Fgf_slist [1]Tsockaddr_storage
  5634. }
  5635. type Tin_pktinfo = struct {
  5636. Fipi_ifindex int32
  5637. Fipi_spec_dst Tin_addr
  5638. Fipi_addr Tin_addr
  5639. }
  5640. type Tin6_pktinfo = struct {
  5641. Fipi6_addr Tin6_addr
  5642. Fipi6_ifindex uint32
  5643. }
  5644. type Tip6_mtuinfo = struct {
  5645. Fip6m_addr Tsockaddr_in6
  5646. Fip6m_mtu Tuint32_t
  5647. }
  5648. // C documentation
  5649. //
  5650. // /*
  5651. // * static int
  5652. // * inet_net_pton(af, src, dst, size)
  5653. // * convert network number from presentation to network format.
  5654. // * accepts hex octets, hex strings, decimal octets, and /CIDR.
  5655. // * "size" is in bytes and describes "dst".
  5656. // * return:
  5657. // * number of bits, either imputed classfully or specified with /CIDR,
  5658. // * or -1 if some failure occurred (check errno). ENOENT means it was
  5659. // * not a valid network specification.
  5660. // * author:
  5661. // * Paul Vixie (ISC), June 1996
  5662. // */
  5663. func Xinet_net_pton(tls *libc.TLS, af int32, src uintptr, dst uintptr, size Tsize_t) (r int32) {
  5664. switch af {
  5665. case int32(m_PF_INET):
  5666. return _inet_net_pton_ipv4(tls, src, dst, size)
  5667. default:
  5668. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EAFNOSUPPORT)
  5669. return -int32(1)
  5670. }
  5671. return r
  5672. }
  5673. // C documentation
  5674. //
  5675. // /*
  5676. // * static int
  5677. // * inet_net_pton_ipv4(src, dst, size)
  5678. // * convert IPv4 network number from presentation to network format.
  5679. // * accepts hex octets, hex strings, decimal octets, and /CIDR.
  5680. // * "size" is in bytes and describes "dst".
  5681. // * return:
  5682. // * number of bits, either imputed classfully or specified with /CIDR,
  5683. // * or -1 if some failure occurred (check errno). ENOENT means it was
  5684. // * not an IPv4 network specification.
  5685. // * note:
  5686. // * network byte order assumed. this means 192.5.5.240/28 has
  5687. // * 0x11110000 in its fourth octet.
  5688. // * author:
  5689. // * Paul Vixie (ISC), June 1996
  5690. // */
  5691. func _inet_net_pton_ipv4(tls *libc.TLS, src uintptr, dst uintptr, size Tsize_t) (r int32) {
  5692. var bits, ch, dirty, n, tmp, v10, v17, v2, v5 int32
  5693. var odst, v1, v11, v14, v15, v16, v18, v21, v3, v8, p4, p6 uintptr
  5694. var v13, v20, v7 Tsize_t
  5695. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bits, ch, dirty, n, odst, tmp, v1, v10, v11, v13, v14, v15, v16, v17, v18, v2, v20, v21, v3, v5, v7, v8, p4, p6
  5696. odst = dst
  5697. v1 = src
  5698. src++
  5699. ch = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v1)))
  5700. 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 {
  5701. /* Hexadecimal: Eat nybble string. */
  5702. if size <= uint64(0) {
  5703. goto emsgsize
  5704. }
  5705. *(*uint8)(unsafe.Pointer(dst)) = uint8(0)
  5706. dirty = libc.Int32FromInt32(0)
  5707. src++ /* skip x or X. */
  5708. for {
  5709. v3 = src
  5710. src++
  5711. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v3)))
  5712. ch = v2
  5713. if !(v2 != int32('\000') && libc.BoolInt32(libc.Uint32FromInt32(ch) < uint32(128)) != 0 && libc.Xisxdigit(tls, ch) != 0) {
  5714. break
  5715. }
  5716. if libc.BoolInt32(libc.Uint32FromInt32(ch)-uint32('A') < uint32(26)) != 0 {
  5717. ch = libc.Xtolower(tls, ch)
  5718. }
  5719. n = int32(int64(libc.Xstrchr(tls, uintptr(unsafe.Pointer(&_xdigits)), ch)) - t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_xdigits))))
  5720. p4 = dst
  5721. *(*uint8)(unsafe.Pointer(p4)) = uint8(int32(*(*uint8)(unsafe.Pointer(p4))) | n)
  5722. v5 = dirty
  5723. dirty++
  5724. if !(v5 != 0) {
  5725. p6 = dst
  5726. *(*uint8)(unsafe.Pointer(p6)) = uint8(int32(*(*uint8)(unsafe.Pointer(p6))) << libc.Int32FromInt32(4))
  5727. } else {
  5728. v7 = size
  5729. size--
  5730. if v7 > uint64(0) {
  5731. dst++
  5732. v8 = dst
  5733. *(*uint8)(unsafe.Pointer(v8)) = uint8(0)
  5734. dirty = libc.Int32FromInt32(0)
  5735. } else {
  5736. goto emsgsize
  5737. }
  5738. }
  5739. }
  5740. if dirty != 0 {
  5741. size--
  5742. }
  5743. } else {
  5744. if libc.BoolInt32(libc.Uint32FromInt32(ch) < uint32(128)) != 0 && libc.BoolInt32(libc.Uint32FromInt32(ch)-uint32('0') < uint32(10)) != 0 {
  5745. /* Decimal: eat dotted digit string. */
  5746. for {
  5747. tmp = 0
  5748. for {
  5749. n = int32(int64(libc.Xstrchr(tls, uintptr(unsafe.Pointer(&_digits)), ch)) - t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_digits))))
  5750. tmp *= int32(10)
  5751. tmp += n
  5752. if tmp > int32(255) {
  5753. goto enoent
  5754. }
  5755. goto _12
  5756. _12:
  5757. ;
  5758. v11 = src
  5759. src++
  5760. v10 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v11)))
  5761. ch = v10
  5762. if !(v10 != int32('\000') && libc.BoolInt32(libc.Uint32FromInt32(ch) < uint32(128)) != 0 && libc.BoolInt32(libc.Uint32FromInt32(ch)-uint32('0') < uint32(10)) != 0) {
  5763. break
  5764. }
  5765. }
  5766. v13 = size
  5767. size--
  5768. if v13 <= uint64(0) {
  5769. goto emsgsize
  5770. }
  5771. v14 = dst
  5772. dst++
  5773. *(*uint8)(unsafe.Pointer(v14)) = libc.Uint8FromInt32(tmp)
  5774. if ch == int32('\000') || ch == int32('/') {
  5775. break
  5776. }
  5777. if ch != int32('.') {
  5778. goto enoent
  5779. }
  5780. v15 = src
  5781. src++
  5782. ch = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v15)))
  5783. if !(libc.BoolInt32(libc.Uint32FromInt32(ch) < libc.Uint32FromInt32(128)) != 0) || !(libc.BoolInt32(libc.Uint32FromInt32(ch)-libc.Uint32FromUint8('0') < libc.Uint32FromInt32(10)) != 0) {
  5784. goto enoent
  5785. }
  5786. goto _9
  5787. _9:
  5788. }
  5789. } else {
  5790. goto enoent
  5791. }
  5792. }
  5793. bits = -int32(1)
  5794. 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 {
  5795. /* CIDR width specifier. Nothing can follow it. */
  5796. v16 = src
  5797. src++
  5798. ch = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v16))) /* Skip over the /. */
  5799. bits = 0
  5800. for {
  5801. n = int32(int64(libc.Xstrchr(tls, uintptr(unsafe.Pointer(&_digits)), ch)) - t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_digits))))
  5802. bits *= int32(10)
  5803. bits += n
  5804. goto _19
  5805. _19:
  5806. ;
  5807. v18 = src
  5808. src++
  5809. v17 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v18)))
  5810. ch = v17
  5811. if !(v17 != int32('\000') && libc.BoolInt32(libc.Uint32FromInt32(ch) < uint32(128)) != 0 && libc.BoolInt32(libc.Uint32FromInt32(ch)-uint32('0') < uint32(10)) != 0) {
  5812. break
  5813. }
  5814. }
  5815. if ch != int32('\000') {
  5816. goto enoent
  5817. }
  5818. if bits > int32(32) {
  5819. goto emsgsize
  5820. }
  5821. }
  5822. /* Firey death and destruction unless we prefetched EOS. */
  5823. if ch != int32('\000') {
  5824. goto enoent
  5825. }
  5826. /* If nothing was written to the destination, we found no address. */
  5827. if dst == odst {
  5828. goto enoent
  5829. }
  5830. /* If no CIDR spec was given, infer width from net class. */
  5831. if bits == -int32(1) {
  5832. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(odst))) >= int32(240) { /* Class E */
  5833. bits = int32(32)
  5834. } else {
  5835. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(odst))) >= int32(224) { /* Class D */
  5836. bits = int32(4)
  5837. } else {
  5838. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(odst))) >= int32(192) { /* Class C */
  5839. bits = int32(24)
  5840. } else {
  5841. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(odst))) >= int32(128) { /* Class B */
  5842. bits = int32(16)
  5843. } else { /* Class A */
  5844. bits = int32(8)
  5845. }
  5846. }
  5847. }
  5848. }
  5849. /* If imputed mask is narrower than specified octets, widen. */
  5850. if int64(bits) < (int64(dst)-int64(odst))*int64(8) {
  5851. bits = int32((int64(dst) - int64(odst)) * int64(8))
  5852. }
  5853. }
  5854. /* Extend network to cover the actual mask. */
  5855. for int64(bits) > (int64(dst)-int64(odst))*int64(8) {
  5856. v20 = size
  5857. size--
  5858. if v20 <= uint64(0) {
  5859. goto emsgsize
  5860. }
  5861. v21 = dst
  5862. dst++
  5863. *(*uint8)(unsafe.Pointer(v21)) = uint8('\000')
  5864. }
  5865. return bits
  5866. goto enoent
  5867. enoent:
  5868. ;
  5869. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOENT)
  5870. return -int32(1)
  5871. goto emsgsize
  5872. emsgsize:
  5873. ;
  5874. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EMSGSIZE)
  5875. return -int32(1)
  5876. }
  5877. var _xdigits = [17]uint8{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}
  5878. var _digits = [11]uint8{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}
  5879. const m_MD5_BLOCK_LENGTH = 64
  5880. const m_MD5_DIGEST_LENGTH = 16
  5881. type TMD5_CTX = struct {
  5882. Fstate [4]Tuint32_t
  5883. Fcount Tuint64_t
  5884. Fbuffer [64]Tuint8_t
  5885. }
  5886. type TMD5Context = TMD5_CTX
  5887. /* Avoid polluting the namespace. Even though this makes this usage
  5888. * implementation-specific, defining it unconditionally should not be
  5889. * a problem, and better than possibly breaking unexpecting code. */
  5890. /*
  5891. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  5892. *
  5893. * Redistribution and use in source and binary forms, with or without
  5894. * modification, are permitted provided that the following conditions
  5895. * are met:
  5896. * 1. Redistributions of source code must retain the above copyright
  5897. * notice, this list of conditions and the following disclaimer.
  5898. * 2. Redistributions in binary form must reproduce the above copyright
  5899. * notice, this list of conditions and the following disclaimer in the
  5900. * documentation and/or other materials provided with the distribution.
  5901. * 3. The name of the author may not be used to endorse or promote products
  5902. * derived from this software without specific prior written permission.
  5903. *
  5904. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  5905. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  5906. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  5907. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  5908. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  5909. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  5910. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  5911. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  5912. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  5913. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  5914. */
  5915. /*
  5916. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  5917. *
  5918. * Redistribution and use in source and binary forms, with or without
  5919. * modification, are permitted provided that the following conditions
  5920. * are met:
  5921. * 1. Redistributions of source code must retain the above copyright
  5922. * notice, this list of conditions and the following disclaimer.
  5923. * 2. Redistributions in binary form must reproduce the above copyright
  5924. * notice, this list of conditions and the following disclaimer in the
  5925. * documentation and/or other materials provided with the distribution.
  5926. * 3. The name of the author may not be used to endorse or promote products
  5927. * derived from this software without specific prior written permission.
  5928. *
  5929. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  5930. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  5931. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  5932. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  5933. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  5934. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  5935. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  5936. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  5937. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  5938. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  5939. */
  5940. /* Clang expands this to 1 if an identifier is *not* reserved. */
  5941. /*
  5942. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  5943. * musl, try to handle this gracefully.
  5944. */
  5945. /* Copyright (C) 1992-2022 Free Software Foundation, Inc.
  5946. Copyright The GNU Toolchain Authors.
  5947. This file is part of the GNU C Library.
  5948. The GNU C Library is free software; you can redistribute it and/or
  5949. modify it under the terms of the GNU Lesser General Public
  5950. License as published by the Free Software Foundation; either
  5951. version 2.1 of the License, or (at your option) any later version.
  5952. The GNU C Library is distributed in the hope that it will be useful,
  5953. but WITHOUT ANY WARRANTY; without even the implied warranty of
  5954. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  5955. Lesser General Public License for more details.
  5956. You should have received a copy of the GNU Lesser General Public
  5957. License along with the GNU C Library; if not, see
  5958. <https://www.gnu.org/licenses/>. */
  5959. /* We are almost always included from features.h. */
  5960. /* The GNU libc does not support any K&R compilers or the traditional mode
  5961. of ISO C compilers anymore. Check for some of the combinations not
  5962. supported anymore. */
  5963. /* Some user header file might have defined this before. */
  5964. /* Compilers that lack __has_attribute may object to
  5965. #if defined __has_attribute && __has_attribute (...)
  5966. even though they do not need to evaluate the right-hand side of the &&.
  5967. Similarly for __has_builtin, etc. */
  5968. /* All functions, except those with callbacks or those that
  5969. synchronize memory, are leaf functions. */
  5970. /* GCC can always grok prototypes. For C++ programs we add throw()
  5971. to help it optimize the function calls. But this only works with
  5972. gcc 2.8.x and egcs. For gcc 3.4 and up we even mark C functions
  5973. as non-throwing using a function attribute since programs can use
  5974. the -fexceptions options for C code as well. */
  5975. /* These two macros are not used in glibc anymore. They are kept here
  5976. only because some other projects expect the macros to be defined. */
  5977. /* For these things, GCC behaves the ANSI way normally,
  5978. and the non-ANSI way under -traditional. */
  5979. /* This is not a typedef so `const __ptr_t' does the right thing. */
  5980. /* C++ needs to know that types and declarations are C, not C++. */
  5981. /* Fortify support. */
  5982. /* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available. */
  5983. /* Support for flexible arrays.
  5984. Headers that should use flexible arrays only if they're "real"
  5985. (e.g. only if they won't affect sizeof()) should test
  5986. #if __glibc_c99_flexarr_available. */
  5987. /* __asm__ ("xyz") is used throughout the headers to rename functions
  5988. at the assembly language level. This is wrapped by the __REDIRECT
  5989. macro, in order to support compilers that can do this some other
  5990. way. When compilers don't support asm-names at all, we have to do
  5991. preprocessor tricks instead (which don't have exactly the right
  5992. semantics, but it's the best we can do).
  5993. Example:
  5994. int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */
  5995. /*
  5996. #elif __SOME_OTHER_COMPILER__
  5997. # define __REDIRECT(name, proto, alias) name proto; _Pragma("let " #name " = " #alias)
  5998. */
  5999. /* GCC and clang have various useful declarations that can be made with
  6000. the '__attribute__' syntax. All of the ways we use this do fine if
  6001. they are omitted for compilers that don't understand it. */
  6002. /* At some point during the gcc 2.96 development the `malloc' attribute
  6003. for functions was introduced. We don't want to use it unconditionally
  6004. (although this would be possible) since it generates warnings. */
  6005. /* Tell the compiler which arguments to an allocation function
  6006. indicate the size of the allocation. */
  6007. /* Tell the compiler which argument to an allocation function
  6008. indicates the alignment of the allocation. */
  6009. /* At some point during the gcc 2.96 development the `pure' attribute
  6010. for functions was introduced. We don't want to use it unconditionally
  6011. (although this would be possible) since it generates warnings. */
  6012. /* This declaration tells the compiler that the value is constant. */
  6013. /* At some point during the gcc 3.1 development the `used' attribute
  6014. for functions was introduced. We don't want to use it unconditionally
  6015. (although this would be possible) since it generates warnings. */
  6016. /* Since version 3.2, gcc allows marking deprecated functions. */
  6017. /* Since version 4.5, gcc also allows one to specify the message printed
  6018. when a deprecated function is used. clang claims to be gcc 4.2, but
  6019. may also support this feature. */
  6020. /* At some point during the gcc 2.8 development the `format_arg' attribute
  6021. for functions was introduced. We don't want to use it unconditionally
  6022. (although this would be possible) since it generates warnings.
  6023. If several `format_arg' attributes are given for the same function, in
  6024. gcc-3.0 and older, all but the last one are ignored. In newer gccs,
  6025. all designated arguments are considered. */
  6026. /* At some point during the gcc 2.97 development the `strfmon' format
  6027. attribute for functions was introduced. We don't want to use it
  6028. unconditionally (although this would be possible) since it
  6029. generates warnings. */
  6030. /* The nonnull function attribute marks pointer parameters that
  6031. must not be NULL. This has the name __nonnull in glibc,
  6032. and __attribute_nonnull__ in files shared with Gnulib to avoid
  6033. collision with a different __nonnull in DragonFlyBSD 5.9. */
  6034. /* The returns_nonnull function attribute marks the return type of the function
  6035. as always being non-null. */
  6036. /* If fortification mode, we warn about unused results of certain
  6037. function calls which can lead to problems. */
  6038. /* Forces a function to be always inlined. */
  6039. /* Associate error messages with the source location of the call site rather
  6040. than with the source location inside the function. */
  6041. /* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
  6042. inline semantics, unless -fgnu89-inline is used. Using __GNUC_STDC_INLINE__
  6043. or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions
  6044. older than 4.3 may define these macros and still not guarantee GNU inlining
  6045. semantics.
  6046. clang++ identifies itself as gcc-4.2, but has support for GNU inlining
  6047. semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and
  6048. __GNUC_GNU_INLINE__ macro definitions. */
  6049. /* GCC 4.3 and above allow passing all anonymous arguments of an
  6050. __extern_always_inline function to some other vararg function. */
  6051. /* It is possible to compile containing GCC extensions even if GCC is
  6052. run in pedantic mode if the uses are carefully marked using the
  6053. `__extension__' keyword. But this is not generally available before
  6054. version 2.8. */
  6055. /* __restrict is known in EGCS 1.2 and above, and in clang.
  6056. It works also in C++ mode (outside of arrays), but only when spelled
  6057. as '__restrict', not 'restrict'. */
  6058. /* ISO C99 also allows to declare arrays as non-overlapping. The syntax is
  6059. array_name[restrict]
  6060. GCC 3.1 and clang support this.
  6061. This syntax is not usable in C++ mode. */
  6062. /* Undefine (also defined in libc-symbols.h). */
  6063. /* Gnulib avoids including these, as they don't work on non-glibc or
  6064. older glibc platforms. */
  6065. /* Determine the wordsize from the preprocessor defines.
  6066. Copyright (C) 2016-2022 Free Software Foundation, Inc.
  6067. This file is part of the GNU C Library.
  6068. The GNU C Library is free software; you can redistribute it and/or
  6069. modify it under the terms of the GNU Lesser General Public
  6070. License as published by the Free Software Foundation; either
  6071. version 2.1 of the License, or (at your option) any later version.
  6072. The GNU C Library is distributed in the hope that it will be useful,
  6073. but WITHOUT ANY WARRANTY; without even the implied warranty of
  6074. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  6075. Lesser General Public License for more details.
  6076. You should have received a copy of the GNU Lesser General Public
  6077. License along with the GNU C Library; if not, see
  6078. <https://www.gnu.org/licenses/>. */
  6079. /* Properties of long double type. ldbl-128 version.
  6080. Copyright (C) 2016-2022 Free Software Foundation, Inc.
  6081. This file is part of the GNU C Library.
  6082. The GNU C Library is free software; you can redistribute it and/or
  6083. modify it under the terms of the GNU Lesser General Public
  6084. License published by the Free Software Foundation; either
  6085. version 2.1 of the License, or (at your option) any later version.
  6086. The GNU C Library is distributed in the hope that it will be useful,
  6087. but WITHOUT ANY WARRANTY; without even the implied warranty of
  6088. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  6089. Lesser General Public License for more details.
  6090. You should have received a copy of the GNU Lesser General Public
  6091. License along with the GNU C Library; if not, see
  6092. <https://www.gnu.org/licenses/>. */
  6093. /* long double is distinct from double, so there is nothing to
  6094. define here. */
  6095. /* __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is
  6096. intended for use in preprocessor macros.
  6097. Note: MESSAGE must be a _single_ string; concatenation of string
  6098. literals is not supported. */
  6099. /* Generic selection (ISO C11) is a C-only feature, available in GCC
  6100. since version 4.9. Previous versions do not provide generic
  6101. selection, even though they might set __STDC_VERSION__ to 201112L,
  6102. when in -std=c11 mode. Thus, we must check for !defined __GNUC__
  6103. when testing __STDC_VERSION__ for generic selection support.
  6104. On the other hand, Clang also defines __GNUC__, so a clang-specific
  6105. check is required to enable the use of generic selection. */
  6106. /* Specify that a function such as setjmp or vfork may return
  6107. twice. */
  6108. /*
  6109. * On non-glibc based systems, we cannot unconditionally use the
  6110. * __GLIBC_PREREQ macro as it gets expanded before evaluation.
  6111. */
  6112. /*
  6113. * Some kFreeBSD headers expect those macros to be set for sanity checks.
  6114. */
  6115. /* Linux headers define a struct with a member names __unused.
  6116. * Debian bugs: #522773 (linux), #522774 (libc).
  6117. * Disable for now. */
  6118. /*
  6119. * Return the number of elements in a statically-allocated array,
  6120. * __x.
  6121. */
  6122. /*
  6123. * We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h>
  6124. * require it.
  6125. */
  6126. /*
  6127. * Given the pointer x to the member m of the struct s, return
  6128. * a pointer to the containing structure. When using GCC, we first
  6129. * assign pointer x to a local variable, to check that its type is
  6130. * compatible with member m.
  6131. */
  6132. func Xlibbsd_MD5Init(tls *libc.TLS, context uintptr) {
  6133. libmd.XMD5Init(tls, context)
  6134. }
  6135. 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', '.'}
  6136. func Xlibbsd_MD5Update(tls *libc.TLS, context uintptr, data uintptr, len1 Tsize_t) {
  6137. libmd.XMD5Update(tls, context, data, len1)
  6138. }
  6139. 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', '.'}
  6140. func Xlibbsd_MD5Pad(tls *libc.TLS, context uintptr) {
  6141. libmd.XMD5Pad(tls, context)
  6142. }
  6143. 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', '.'}
  6144. func Xlibbsd_MD5Final(tls *libc.TLS, digest uintptr, context uintptr) {
  6145. libmd.XMD5Final(tls, digest, context)
  6146. }
  6147. 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', '.'}
  6148. func Xlibbsd_MD5Transform(tls *libc.TLS, state uintptr, block uintptr) {
  6149. libmd.XMD5Transform(tls, state, block)
  6150. }
  6151. 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', '.'}
  6152. func Xlibbsd_MD5End(tls *libc.TLS, context uintptr, buf uintptr) (r uintptr) {
  6153. return libmd.XMD5End(tls, context, buf)
  6154. }
  6155. 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', '.'}
  6156. func Xlibbsd_MD5File(tls *libc.TLS, filename uintptr, buf uintptr) (r uintptr) {
  6157. return libmd.XMD5File(tls, filename, buf)
  6158. }
  6159. 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', '.'}
  6160. func Xlibbsd_MD5FileChunk(tls *libc.TLS, filename uintptr, buf uintptr, offset Toff_t, length Toff_t) (r uintptr) {
  6161. return libmd.XMD5FileChunk(tls, filename, buf, offset, length)
  6162. }
  6163. 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', '.'}
  6164. func Xlibbsd_MD5Data(tls *libc.TLS, data uintptr, len1 Tsize_t, buf uintptr) (r uintptr) {
  6165. return libmd.XMD5Data(tls, data, len1, buf)
  6166. }
  6167. 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', '.'}
  6168. const m_THRESHOLD = 16
  6169. /*
  6170. * Find the next possible pointer head. (Trickery for forcing an array
  6171. * to do double duty as a linked list when objects do not align with word
  6172. * boundaries.
  6173. */
  6174. /* Assumption: PSIZE is a power of 2. */
  6175. // C documentation
  6176. //
  6177. // /*
  6178. // * Arguments are as for qsort.
  6179. // */
  6180. func Xmergesort(tls *libc.TLS, base uintptr, nmemb Tsize_t, size Tsize_t, cmp uintptr) (r int32) {
  6181. 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
  6182. var big, iflag, sense, v2 int32
  6183. var i, v8 Tsize_t
  6184. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  6185. if size < libc.Uint64FromInt64(8)/libc.Uint64FromInt32(2) { /* Pointers must fit into 2 * size. */
  6186. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  6187. return -int32(1)
  6188. }
  6189. if nmemb == uint64(0) {
  6190. return 0
  6191. }
  6192. /*
  6193. * XXX
  6194. * Stupid subtraction for the Cray.
  6195. */
  6196. iflag = 0
  6197. if !(size%libc.Uint64FromInt64(4) != 0) && !(libc.Uint64FromInt64(int64(base)-int64(libc.UintptrFromInt32(0)))%libc.Uint64FromInt64(4) != 0) {
  6198. iflag = int32(1)
  6199. }
  6200. v1 = libc.Xmalloc(tls, nmemb*size+uint64(8))
  6201. list2 = v1
  6202. if v1 == libc.UintptrFromInt32(0) {
  6203. return -int32(1)
  6204. }
  6205. list1 = base
  6206. _setup(tls, list1, list2, nmemb, size, cmp)
  6207. last = list2 + uintptr(nmemb*size)
  6208. v2 = libc.Int32FromInt32(0)
  6209. big = v2
  6210. i = libc.Uint64FromInt32(v2)
  6211. for *(*uintptr)(unsafe.Pointer(libc.UintptrFromInt32(0) + uintptr(libc.Uint64FromInt64(int64(list2+libc.UintptrFromInt64(8)-libc.UintptrFromInt32(1))-int64(libc.UintptrFromInt32(0))) & ^(libc.Uint64FromInt64(8)-libc.Uint64FromInt32(1))))) != last {
  6212. l2 = list1
  6213. p1 = libc.UintptrFromInt32(0) + uintptr(libc.Uint64FromInt64(int64(list1+libc.UintptrFromInt64(8)-libc.UintptrFromInt32(1))-int64(libc.UintptrFromInt32(0))) & ^(libc.Uint64FromInt64(8)-libc.Uint64FromInt32(1)))
  6214. v4 = list2
  6215. p2 = v4
  6216. tp2 = v4
  6217. for {
  6218. if !(p2 != last) {
  6219. break
  6220. }
  6221. p2 = *(*uintptr)(unsafe.Pointer(libc.UintptrFromInt32(0) + uintptr(libc.Uint64FromInt64(int64(p2+libc.UintptrFromInt64(8)-libc.UintptrFromInt32(1))-int64(libc.UintptrFromInt32(0))) & ^(libc.Uint64FromInt64(8)-libc.Uint64FromInt32(1)))))
  6222. f1 = l2
  6223. v5 = list1 + uintptr(int64(p2)-int64(list2))
  6224. l1 = v5
  6225. f2 = v5
  6226. if p2 != last {
  6227. p2 = *(*uintptr)(unsafe.Pointer(libc.UintptrFromInt32(0) + uintptr(libc.Uint64FromInt64(int64(p2+libc.UintptrFromInt64(8)-libc.UintptrFromInt32(1))-int64(libc.UintptrFromInt32(0))) & ^(libc.Uint64FromInt64(8)-libc.Uint64FromInt32(1)))))
  6228. }
  6229. l2 = list1 + uintptr(int64(p2)-int64(list2))
  6230. for f1 < l1 && f2 < l2 {
  6231. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f1, f2) <= 0 {
  6232. q = f2
  6233. b = f1
  6234. t = l1
  6235. sense = -int32(1)
  6236. } else {
  6237. q = f1
  6238. b = f2
  6239. t = l2
  6240. sense = 0
  6241. }
  6242. if !!(big != 0) {
  6243. goto _6
  6244. } /* here i = 0 */
  6245. for {
  6246. b += uintptr(size)
  6247. if !(b < t && (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, b) > sense) {
  6248. break
  6249. }
  6250. i++
  6251. v8 = i
  6252. if v8 == uint64(6) {
  6253. big = int32(1)
  6254. goto EXPONENTIAL
  6255. }
  6256. }
  6257. goto _7
  6258. _6:
  6259. ;
  6260. goto EXPONENTIAL
  6261. EXPONENTIAL:
  6262. ;
  6263. i = size
  6264. for {
  6265. v10 = b + uintptr(i)
  6266. p = v10
  6267. if v10 >= t {
  6268. v11 = t - uintptr(size)
  6269. p = v11
  6270. if v11 > b && (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, p) <= sense {
  6271. t = p
  6272. } else {
  6273. b = p
  6274. }
  6275. break
  6276. } else {
  6277. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, p) <= sense {
  6278. t = p
  6279. if i == size {
  6280. big = 0
  6281. }
  6282. goto FASTCASE
  6283. } else {
  6284. b = p
  6285. }
  6286. }
  6287. goto _9
  6288. _9:
  6289. ;
  6290. i <<= uint64(1)
  6291. }
  6292. for t > b+uintptr(size) {
  6293. i = libc.Uint64FromInt64(int64(t)-int64(b)) / size >> int32(1) * size
  6294. v12 = b + uintptr(i)
  6295. p = v12
  6296. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, v12) <= sense {
  6297. t = p
  6298. } else {
  6299. b = p
  6300. }
  6301. }
  6302. goto COPY
  6303. goto FASTCASE
  6304. FASTCASE:
  6305. ;
  6306. for i > size {
  6307. i >>= uint64(1)
  6308. v13 = b + uintptr(i)
  6309. p = v13
  6310. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, v13) <= sense {
  6311. t = p
  6312. } else {
  6313. b = p
  6314. }
  6315. }
  6316. goto COPY
  6317. COPY:
  6318. ;
  6319. b = t
  6320. _7:
  6321. ;
  6322. i = size
  6323. if q == f1 {
  6324. if iflag != 0 {
  6325. for cond := true; cond; cond = f2 < b {
  6326. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f2))
  6327. f2 += uintptr(4)
  6328. tp2 += uintptr(4)
  6329. }
  6330. for {
  6331. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f1))
  6332. f1 += uintptr(4)
  6333. tp2 += uintptr(4)
  6334. goto _14
  6335. _14:
  6336. ;
  6337. i -= uint64(4)
  6338. if !(i != 0) {
  6339. break
  6340. }
  6341. }
  6342. } else {
  6343. for cond := true; cond; cond = f2 < b {
  6344. v15 = tp2
  6345. tp2++
  6346. v16 = f2
  6347. f2++
  6348. *(*uint8)(unsafe.Pointer(v15)) = *(*uint8)(unsafe.Pointer(v16))
  6349. }
  6350. for {
  6351. v18 = tp2
  6352. tp2++
  6353. v19 = f1
  6354. f1++
  6355. *(*uint8)(unsafe.Pointer(v18)) = *(*uint8)(unsafe.Pointer(v19))
  6356. goto _17
  6357. _17:
  6358. ;
  6359. i -= uint64(1)
  6360. if !(i != 0) {
  6361. break
  6362. }
  6363. }
  6364. }
  6365. } else {
  6366. if iflag != 0 {
  6367. for cond := true; cond; cond = f1 < b {
  6368. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f1))
  6369. f1 += uintptr(4)
  6370. tp2 += uintptr(4)
  6371. }
  6372. for {
  6373. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f2))
  6374. f2 += uintptr(4)
  6375. tp2 += uintptr(4)
  6376. goto _20
  6377. _20:
  6378. ;
  6379. i -= uint64(4)
  6380. if !(i != 0) {
  6381. break
  6382. }
  6383. }
  6384. } else {
  6385. for cond := true; cond; cond = f1 < b {
  6386. v21 = tp2
  6387. tp2++
  6388. v22 = f1
  6389. f1++
  6390. *(*uint8)(unsafe.Pointer(v21)) = *(*uint8)(unsafe.Pointer(v22))
  6391. }
  6392. for {
  6393. v24 = tp2
  6394. tp2++
  6395. v25 = f2
  6396. f2++
  6397. *(*uint8)(unsafe.Pointer(v24)) = *(*uint8)(unsafe.Pointer(v25))
  6398. goto _23
  6399. _23:
  6400. ;
  6401. i -= uint64(1)
  6402. if !(i != 0) {
  6403. break
  6404. }
  6405. }
  6406. }
  6407. }
  6408. }
  6409. if f2 < l2 {
  6410. if iflag != 0 {
  6411. for cond := true; cond; cond = f2 < l2 {
  6412. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f2))
  6413. f2 += uintptr(4)
  6414. tp2 += uintptr(4)
  6415. }
  6416. } else {
  6417. for cond := true; cond; cond = f2 < l2 {
  6418. v26 = tp2
  6419. tp2++
  6420. v27 = f2
  6421. f2++
  6422. *(*uint8)(unsafe.Pointer(v26)) = *(*uint8)(unsafe.Pointer(v27))
  6423. }
  6424. }
  6425. } else {
  6426. if f1 < l1 {
  6427. if iflag != 0 {
  6428. for cond := true; cond; cond = f1 < l1 {
  6429. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f1))
  6430. f1 += uintptr(4)
  6431. tp2 += uintptr(4)
  6432. }
  6433. } else {
  6434. for cond := true; cond; cond = f1 < l1 {
  6435. v28 = tp2
  6436. tp2++
  6437. v29 = f1
  6438. f1++
  6439. *(*uint8)(unsafe.Pointer(v28)) = *(*uint8)(unsafe.Pointer(v29))
  6440. }
  6441. }
  6442. }
  6443. }
  6444. *(*uintptr)(unsafe.Pointer(p1)) = l2
  6445. goto _3
  6446. _3:
  6447. ;
  6448. p1 = libc.UintptrFromInt32(0) + uintptr(libc.Uint64FromInt64(int64(l2+libc.UintptrFromInt64(8)-libc.UintptrFromInt32(1))-int64(libc.UintptrFromInt32(0))) & ^(libc.Uint64FromInt64(8)-libc.Uint64FromInt32(1)))
  6449. }
  6450. tp2 = list1 /* swap list1, list2 */
  6451. list1 = list2
  6452. list2 = tp2
  6453. last = list2 + uintptr(nmemb*size)
  6454. }
  6455. if base == list2 {
  6456. libc.Xmemmove(tls, list2, list1, nmemb*size)
  6457. list2 = list1
  6458. }
  6459. libc.Xfree(tls, list2)
  6460. return 0
  6461. }
  6462. // C documentation
  6463. //
  6464. // /*
  6465. // * Optional hybrid natural/pairwise first pass. Eats up list1 in runs of
  6466. // * increasing order, list2 in a corresponding linked list. Checks for runs
  6467. // * when THRESHOLD/2 pairs compare with same sense. (Only used when NATURAL
  6468. // * is defined. Otherwise simple pairwise merging is used.)
  6469. // */
  6470. func _setup(tls *libc.TLS, list1 uintptr, list2 uintptr, n Tsize_t, size Tsize_t, cmp uintptr) {
  6471. var f1, f2, l2, last, p2, s, v10, v13, v14, v17, v18, v19, v20, v4, v7, v8 uintptr
  6472. var i, length, sense, size2, tmp, v11, v15, v5 int32
  6473. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = f1, f2, i, l2, last, length, p2, s, sense, size2, tmp, v10, v11, v13, v14, v15, v17, v18, v19, v20, v4, v5, v7, v8
  6474. size2 = libc.Int32FromUint64(size * uint64(2))
  6475. if n <= uint64(5) {
  6476. _insertionsort(tls, list1, n, size, cmp)
  6477. *(*uintptr)(unsafe.Pointer(libc.UintptrFromInt32(0) + uintptr(libc.Uint64FromInt64(int64(list2+libc.UintptrFromInt64(8)-libc.UintptrFromInt32(1))-int64(libc.UintptrFromInt32(0))) & ^(libc.Uint64FromInt64(8)-libc.Uint64FromInt32(1))))) = list2 + uintptr(n*size)
  6478. return
  6479. }
  6480. /*
  6481. * Avoid running pointers out of bounds; limit n to evens
  6482. * for simplicity.
  6483. */
  6484. i = libc.Int32FromUint64(uint64(4) + n&uint64(1))
  6485. _insertionsort(tls, list1+uintptr((n-libc.Uint64FromInt32(i))*size), libc.Uint64FromInt32(i), size, cmp)
  6486. last = list1 + uintptr(size*(n-libc.Uint64FromInt32(i)))
  6487. *(*uintptr)(unsafe.Pointer(libc.UintptrFromInt32(0) + uintptr(libc.Uint64FromInt64(int64(list2+uintptr(int64(last)-int64(list1))+libc.UintptrFromInt64(8)-libc.UintptrFromInt32(1))-int64(libc.UintptrFromInt32(0))) & ^(libc.Uint64FromInt64(8)-libc.Uint64FromInt32(1))))) = list2 + uintptr(n*size)
  6488. p2 = list2
  6489. f1 = list1
  6490. sense = libc.BoolInt32((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f1, f1+uintptr(size)) > 0)
  6491. for {
  6492. if !(f1 < last) {
  6493. break
  6494. }
  6495. length = int32(2)
  6496. /* Find pairs with same sense. */
  6497. f2 = f1 + uintptr(size2)
  6498. for {
  6499. if !(f2 < last) {
  6500. break
  6501. }
  6502. if libc.BoolInt32((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f2, f2+uintptr(size)) > 0) != sense {
  6503. break
  6504. }
  6505. length += int32(2)
  6506. goto _2
  6507. _2:
  6508. ;
  6509. f2 += uintptr(size2)
  6510. }
  6511. if length < int32(m_THRESHOLD) { /* Pairwise merge */
  6512. for {
  6513. v4 = uintptr(int64(f1+uintptr(size2))-int64(list1)) + list2
  6514. *(*uintptr)(unsafe.Pointer(libc.UintptrFromInt32(0) + uintptr(libc.Uint64FromInt64(int64(p2+libc.UintptrFromInt64(8)-libc.UintptrFromInt32(1))-int64(libc.UintptrFromInt32(0))) & ^(libc.Uint64FromInt64(8)-libc.Uint64FromInt32(1))))) = v4
  6515. p2 = v4
  6516. if sense > 0 {
  6517. s = f1 + uintptr(size)
  6518. i = libc.Int32FromUint64(size)
  6519. for {
  6520. tmp = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f1)))
  6521. v7 = f1
  6522. f1++
  6523. *(*uint8)(unsafe.Pointer(v7)) = *(*uint8)(unsafe.Pointer(s))
  6524. v8 = s
  6525. s++
  6526. *(*uint8)(unsafe.Pointer(v8)) = libc.Uint8FromInt32(tmp)
  6527. goto _6
  6528. _6:
  6529. ;
  6530. i--
  6531. v5 = i
  6532. if !(v5 != 0) {
  6533. break
  6534. }
  6535. }
  6536. f1 -= uintptr(size)
  6537. }
  6538. goto _3
  6539. _3:
  6540. ;
  6541. f1 += uintptr(size2)
  6542. if !(f1 < f2) {
  6543. break
  6544. }
  6545. }
  6546. } else { /* Natural merge */
  6547. l2 = f2
  6548. f2 = f1 + uintptr(size2)
  6549. for {
  6550. if !(f2 < l2) {
  6551. break
  6552. }
  6553. if libc.BoolInt32((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f2-uintptr(size), f2) > 0) != sense {
  6554. v10 = uintptr(int64(f2)-int64(list1)) + list2
  6555. *(*uintptr)(unsafe.Pointer(libc.UintptrFromInt32(0) + uintptr(libc.Uint64FromInt64(int64(p2+libc.UintptrFromInt64(8)-libc.UintptrFromInt32(1))-int64(libc.UintptrFromInt32(0))) & ^(libc.Uint64FromInt64(8)-libc.Uint64FromInt32(1))))) = v10
  6556. p2 = v10
  6557. if sense > 0 {
  6558. s = f2 - uintptr(size)
  6559. for cond := true; cond; cond = f1 < s {
  6560. i = libc.Int32FromUint64(size)
  6561. for {
  6562. tmp = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f1)))
  6563. v13 = f1
  6564. f1++
  6565. *(*uint8)(unsafe.Pointer(v13)) = *(*uint8)(unsafe.Pointer(s))
  6566. v14 = s
  6567. s++
  6568. *(*uint8)(unsafe.Pointer(v14)) = libc.Uint8FromInt32(tmp)
  6569. goto _12
  6570. _12:
  6571. ;
  6572. i--
  6573. v11 = i
  6574. if !(v11 != 0) {
  6575. break
  6576. }
  6577. }
  6578. s -= uintptr(size2)
  6579. }
  6580. }
  6581. f1 = f2
  6582. }
  6583. goto _9
  6584. _9:
  6585. ;
  6586. f2 += uintptr(size2)
  6587. }
  6588. if sense > 0 {
  6589. s = f2 - uintptr(size)
  6590. for cond := true; cond; cond = f1 < s {
  6591. i = libc.Int32FromUint64(size)
  6592. for {
  6593. tmp = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f1)))
  6594. v17 = f1
  6595. f1++
  6596. *(*uint8)(unsafe.Pointer(v17)) = *(*uint8)(unsafe.Pointer(s))
  6597. v18 = s
  6598. s++
  6599. *(*uint8)(unsafe.Pointer(v18)) = libc.Uint8FromInt32(tmp)
  6600. goto _16
  6601. _16:
  6602. ;
  6603. i--
  6604. v15 = i
  6605. if !(v15 != 0) {
  6606. break
  6607. }
  6608. }
  6609. s -= uintptr(size2)
  6610. }
  6611. }
  6612. f1 = f2
  6613. if f2 < last || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f2-uintptr(size), f2) > 0 {
  6614. v19 = uintptr(int64(f2)-int64(list1)) + list2
  6615. *(*uintptr)(unsafe.Pointer(libc.UintptrFromInt32(0) + uintptr(libc.Uint64FromInt64(int64(p2+libc.UintptrFromInt64(8)-libc.UintptrFromInt32(1))-int64(libc.UintptrFromInt32(0))) & ^(libc.Uint64FromInt64(8)-libc.Uint64FromInt32(1))))) = v19
  6616. p2 = v19
  6617. } else {
  6618. v20 = list2 + uintptr(n*size)
  6619. *(*uintptr)(unsafe.Pointer(libc.UintptrFromInt32(0) + uintptr(libc.Uint64FromInt64(int64(p2+libc.UintptrFromInt64(8)-libc.UintptrFromInt32(1))-int64(libc.UintptrFromInt32(0))) & ^(libc.Uint64FromInt64(8)-libc.Uint64FromInt32(1))))) = v20
  6620. p2 = v20
  6621. }
  6622. }
  6623. goto _1
  6624. _1:
  6625. ;
  6626. sense = libc.BoolInt32(!(sense != 0))
  6627. }
  6628. }
  6629. // C documentation
  6630. //
  6631. // /*
  6632. // * This is to avoid out-of-bounds addresses in sorting the
  6633. // * last 4 elements.
  6634. // */
  6635. func _insertionsort(tls *libc.TLS, a uintptr, n Tsize_t, size Tsize_t, cmp uintptr) {
  6636. var ai, s, t, u, v6, v7 uintptr
  6637. var i, v4 int32
  6638. var tmp uint8
  6639. var v2 Tsize_t
  6640. _, _, _, _, _, _, _, _, _, _ = ai, i, s, t, tmp, u, v2, v4, v6, v7
  6641. ai = a + uintptr(size)
  6642. for {
  6643. n--
  6644. v2 = n
  6645. if !(v2 >= uint64(1)) {
  6646. break
  6647. }
  6648. t = ai
  6649. for {
  6650. if !(t > a) {
  6651. break
  6652. }
  6653. u = t - uintptr(size)
  6654. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, u, t) <= 0 {
  6655. break
  6656. }
  6657. s = t
  6658. i = libc.Int32FromUint64(size)
  6659. for {
  6660. tmp = *(*uint8)(unsafe.Pointer(u))
  6661. v6 = u
  6662. u++
  6663. *(*uint8)(unsafe.Pointer(v6)) = *(*uint8)(unsafe.Pointer(s))
  6664. v7 = s
  6665. s++
  6666. *(*uint8)(unsafe.Pointer(v7)) = tmp
  6667. goto _5
  6668. _5:
  6669. ;
  6670. i--
  6671. v4 = i
  6672. if !(v4 != 0) {
  6673. break
  6674. }
  6675. }
  6676. u -= uintptr(size)
  6677. goto _3
  6678. _3:
  6679. ;
  6680. t -= uintptr(size)
  6681. }
  6682. goto _1
  6683. _1:
  6684. ;
  6685. ai += uintptr(size)
  6686. }
  6687. }
  6688. const m_AT_BASE = 7
  6689. const m_AT_BASE_PLATFORM = 24
  6690. const m_AT_CLKTCK = 17
  6691. const m_AT_DCACHEBSIZE = 19
  6692. const m_AT_EGID = 14
  6693. const m_AT_ENTRY = 9
  6694. const m_AT_EUID = 12
  6695. const m_AT_EXECFD = 2
  6696. const m_AT_EXECFN = 31
  6697. const m_AT_FLAGS = 8
  6698. const m_AT_FPUCW = 18
  6699. const m_AT_GID = 13
  6700. const m_AT_HWCAP = 16
  6701. const m_AT_HWCAP2 = 26
  6702. const m_AT_ICACHEBSIZE = 20
  6703. const m_AT_IGNORE = 1
  6704. const m_AT_IGNOREPPC = 22
  6705. const m_AT_L1D_CACHEGEOMETRY = 43
  6706. const m_AT_L1D_CACHESHAPE = 35
  6707. const m_AT_L1D_CACHESIZE = 42
  6708. const m_AT_L1I_CACHEGEOMETRY = 41
  6709. const m_AT_L1I_CACHESHAPE = 34
  6710. const m_AT_L1I_CACHESIZE = 40
  6711. const m_AT_L2_CACHEGEOMETRY = 45
  6712. const m_AT_L2_CACHESHAPE = 36
  6713. const m_AT_L2_CACHESIZE = 44
  6714. const m_AT_L3_CACHEGEOMETRY = 47
  6715. const m_AT_L3_CACHESHAPE = 37
  6716. const m_AT_L3_CACHESIZE = 46
  6717. const m_AT_MINSIGSTKSZ = 51
  6718. const m_AT_NOTELF = 10
  6719. const m_AT_NULL = 0
  6720. const m_AT_PAGESZ = 6
  6721. const m_AT_PHDR = 3
  6722. const m_AT_PHENT = 4
  6723. const m_AT_PHNUM = 5
  6724. const m_AT_PLATFORM = 15
  6725. const m_AT_RANDOM = 25
  6726. const m_AT_SECURE = 23
  6727. const m_AT_SYSINFO = 32
  6728. const m_AT_SYSINFO_EHDR = 33
  6729. const m_AT_UCACHEBSIZE = 21
  6730. const m_AT_UID = 11
  6731. const m_AUX_FUNC = 2
  6732. const m_AUX_OBJECT = 1
  6733. const m_BIND_WEAK = 2
  6734. const m_DF_1_CONFALT = 0x00002000
  6735. const m_DF_1_DIRECT = 0x00000100
  6736. const m_DF_1_DISPRELDNE = 0x00008000
  6737. const m_DF_1_DISPRELPND = 0x00010000
  6738. const m_DF_1_EDITED = 0x00200000
  6739. const m_DF_1_ENDFILTEE = 0x00004000
  6740. const m_DF_1_GLOBAL = 0x00000002
  6741. const m_DF_1_GLOBAUDIT = 0x01000000
  6742. const m_DF_1_GROUP = 0x00000004
  6743. const m_DF_1_IGNMULDEF = 0x00040000
  6744. const m_DF_1_INITFIRST = 0x00000020
  6745. const m_DF_1_INTERPOSE = 0x00000400
  6746. const m_DF_1_LOADFLTR = 0x00000010
  6747. const m_DF_1_NODEFLIB = 0x00000800
  6748. const m_DF_1_NODELETE = 0x00000008
  6749. const m_DF_1_NODIRECT = 0x00020000
  6750. const m_DF_1_NODUMP = 0x00001000
  6751. const m_DF_1_NOHDR = 0x00100000
  6752. const m_DF_1_NOKSYMS = 0x00080000
  6753. const m_DF_1_NOOPEN = 0x00000040
  6754. const m_DF_1_NORELOC = 0x00400000
  6755. const m_DF_1_NOW = 0x00000001
  6756. const m_DF_1_ORIGIN = 0x00000080
  6757. const m_DF_1_PIE = 0x08000000
  6758. const m_DF_1_SINGLETON = 0x02000000
  6759. const m_DF_1_STUB = 0x04000000
  6760. const m_DF_1_SYMINTPOSE = 0x00800000
  6761. const m_DF_1_TRANS = 0x00000200
  6762. const m_DF_BIND_NOW = 0x00000008
  6763. const m_DF_ORIGIN = 0x00000001
  6764. const m_DF_P1_GROUPPERM = 0x00000002
  6765. const m_DF_P1_LAZYLOAD = 0x00000001
  6766. const m_DF_STATIC_TLS = 0x00000010
  6767. const m_DF_SYMBOLIC = 0x00000002
  6768. const m_DF_TEXTREL = 0x00000004
  6769. const m_DTF_1_CONFEXP = 0x00000002
  6770. const m_DTF_1_PARINIT = 0x00000001
  6771. const m_DT_ADDRNUM = 11
  6772. const m_DT_ADDRRNGHI = 0x6ffffeff
  6773. const m_DT_ADDRRNGLO = 0x6ffffe00
  6774. const m_DT_ALPHA_NUM = 1
  6775. const m_DT_AUDIT = 0x6ffffefc
  6776. const m_DT_AUXILIARY = 0x7ffffffd
  6777. const m_DT_BIND_NOW = 24
  6778. const m_DT_CHECKSUM = 0x6ffffdf8
  6779. const m_DT_CONFIG = 0x6ffffefa
  6780. const m_DT_DEBUG = 21
  6781. const m_DT_DEPAUDIT = 0x6ffffefb
  6782. const m_DT_ENCODING = 32
  6783. const m_DT_EXTRANUM = 3
  6784. const m_DT_FEATURE_1 = 0x6ffffdfc
  6785. const m_DT_FILTER = 0x7fffffff
  6786. const m_DT_FINI = 13
  6787. const m_DT_FINI_ARRAY = 26
  6788. const m_DT_FINI_ARRAYSZ = 28
  6789. const m_DT_FLAGS = 30
  6790. const m_DT_FLAGS_1 = 0x6ffffffb
  6791. const m_DT_GNU_CONFLICT = 0x6ffffef8
  6792. const m_DT_GNU_CONFLICTSZ = 0x6ffffdf6
  6793. const m_DT_GNU_HASH = 0x6ffffef5
  6794. const m_DT_GNU_LIBLIST = 0x6ffffef9
  6795. const m_DT_GNU_LIBLISTSZ = 0x6ffffdf7
  6796. const m_DT_GNU_PRELINKED = 0x6ffffdf5
  6797. const m_DT_HASH = 4
  6798. const m_DT_HIOS = 0x6ffff000
  6799. const m_DT_HIPROC = 0x7fffffff
  6800. const m_DT_IA_64_NUM = 1
  6801. const m_DT_INIT = 12
  6802. const m_DT_INIT_ARRAY = 25
  6803. const m_DT_INIT_ARRAYSZ = 27
  6804. const m_DT_JMPREL = 23
  6805. const m_DT_LOOS = 0x6000000d
  6806. const m_DT_LOPROC = 0x70000000
  6807. const m_DT_MIPS_AUX_DYNAMIC = 0x70000031
  6808. const m_DT_MIPS_BASE_ADDRESS = 0x70000006
  6809. const m_DT_MIPS_COMPACT_SIZE = 0x7000002f
  6810. const m_DT_MIPS_CONFLICT = 0x70000008
  6811. const m_DT_MIPS_CONFLICTNO = 0x7000000b
  6812. const m_DT_MIPS_CXX_FLAGS = 0x70000022
  6813. const m_DT_MIPS_DELTA_CLASS = 0x70000017
  6814. const m_DT_MIPS_DELTA_CLASSSYM = 0x70000020
  6815. const m_DT_MIPS_DELTA_CLASSSYM_NO = 0x70000021
  6816. const m_DT_MIPS_DELTA_CLASS_NO = 0x70000018
  6817. const m_DT_MIPS_DELTA_INSTANCE = 0x70000019
  6818. const m_DT_MIPS_DELTA_INSTANCE_NO = 0x7000001a
  6819. const m_DT_MIPS_DELTA_RELOC = 0x7000001b
  6820. const m_DT_MIPS_DELTA_RELOC_NO = 0x7000001c
  6821. const m_DT_MIPS_DELTA_SYM = 0x7000001d
  6822. const m_DT_MIPS_DELTA_SYM_NO = 0x7000001e
  6823. const m_DT_MIPS_DYNSTR_ALIGN = 0x7000002b
  6824. const m_DT_MIPS_FLAGS = 0x70000005
  6825. const m_DT_MIPS_GOTSYM = 0x70000013
  6826. const m_DT_MIPS_GP_VALUE = 0x70000030
  6827. const m_DT_MIPS_HIDDEN_GOTIDX = 0x70000027
  6828. const m_DT_MIPS_HIPAGENO = 0x70000014
  6829. const m_DT_MIPS_ICHECKSUM = 0x70000003
  6830. const m_DT_MIPS_INTERFACE = 0x7000002a
  6831. const m_DT_MIPS_INTERFACE_SIZE = 0x7000002c
  6832. const m_DT_MIPS_IVERSION = 0x70000004
  6833. const m_DT_MIPS_LIBLIST = 0x70000009
  6834. const m_DT_MIPS_LIBLISTNO = 0x70000010
  6835. const m_DT_MIPS_LOCALPAGE_GOTIDX = 0x70000025
  6836. const m_DT_MIPS_LOCAL_GOTIDX = 0x70000026
  6837. const m_DT_MIPS_LOCAL_GOTNO = 0x7000000a
  6838. const m_DT_MIPS_MSYM = 0x70000007
  6839. const m_DT_MIPS_NUM = 0x36
  6840. const m_DT_MIPS_OPTIONS = 0x70000029
  6841. const m_DT_MIPS_PERF_SUFFIX = 0x7000002e
  6842. const m_DT_MIPS_PIXIE_INIT = 0x70000023
  6843. const m_DT_MIPS_PLTGOT = 0x70000032
  6844. const m_DT_MIPS_PROTECTED_GOTIDX = 0x70000028
  6845. const m_DT_MIPS_RLD_MAP = 0x70000016
  6846. const m_DT_MIPS_RLD_MAP_REL = 0x70000035
  6847. const m_DT_MIPS_RLD_TEXT_RESOLVE_ADDR = 0x7000002d
  6848. const m_DT_MIPS_RLD_VERSION = 0x70000001
  6849. const m_DT_MIPS_RWPLT = 0x70000034
  6850. const m_DT_MIPS_SYMBOL_LIB = 0x70000024
  6851. const m_DT_MIPS_SYMTABNO = 0x70000011
  6852. const m_DT_MIPS_TIME_STAMP = 0x70000002
  6853. const m_DT_MIPS_UNREFEXTNO = 0x70000012
  6854. const m_DT_MOVEENT = 0x6ffffdfa
  6855. const m_DT_MOVESZ = 0x6ffffdfb
  6856. const m_DT_MOVETAB = 0x6ffffefe
  6857. const m_DT_NEEDED = 1
  6858. const m_DT_NIOS2_GP = 0x70000002
  6859. const m_DT_NULL = 0
  6860. const m_DT_NUM = 38
  6861. const m_DT_PLTGOT = 3
  6862. const m_DT_PLTPAD = 0x6ffffefd
  6863. const m_DT_PLTPADSZ = 0x6ffffdf9
  6864. const m_DT_PLTREL = 20
  6865. const m_DT_PLTRELSZ = 2
  6866. const m_DT_POSFLAG_1 = 0x6ffffdfd
  6867. const m_DT_PPC64_NUM = 4
  6868. const m_DT_PPC_NUM = 2
  6869. const m_DT_PREINIT_ARRAY = 32
  6870. const m_DT_PREINIT_ARRAYSZ = 33
  6871. const m_DT_PROCNUM = "DT_MIPS_NUM"
  6872. const m_DT_REL = 17
  6873. const m_DT_RELA = 7
  6874. const m_DT_RELACOUNT = 0x6ffffff9
  6875. const m_DT_RELAENT = 9
  6876. const m_DT_RELASZ = 8
  6877. const m_DT_RELCOUNT = 0x6ffffffa
  6878. const m_DT_RELENT = 19
  6879. const m_DT_RELR = 36
  6880. const m_DT_RELRENT = 37
  6881. const m_DT_RELRSZ = 35
  6882. const m_DT_RELSZ = 18
  6883. const m_DT_RPATH = 15
  6884. const m_DT_RUNPATH = 29
  6885. const m_DT_SONAME = 14
  6886. const m_DT_SPARC_NUM = 2
  6887. const m_DT_SPARC_REGISTER = 0x70000001
  6888. const m_DT_STRSZ = 10
  6889. const m_DT_STRTAB = 5
  6890. const m_DT_SYMBOLIC = 16
  6891. const m_DT_SYMENT = 11
  6892. const m_DT_SYMINENT = 0x6ffffdff
  6893. const m_DT_SYMINFO = 0x6ffffeff
  6894. const m_DT_SYMINSZ = 0x6ffffdfe
  6895. const m_DT_SYMTAB = 6
  6896. const m_DT_SYMTAB_SHNDX = 34
  6897. const m_DT_TEXTREL = 22
  6898. const m_DT_TLSDESC_GOT = 0x6ffffef7
  6899. const m_DT_TLSDESC_PLT = 0x6ffffef6
  6900. const m_DT_VALNUM = 12
  6901. const m_DT_VALRNGHI = 0x6ffffdff
  6902. const m_DT_VALRNGLO = 0x6ffffd00
  6903. const m_DT_VERDEF = 0x6ffffffc
  6904. const m_DT_VERDEFNUM = 0x6ffffffd
  6905. const m_DT_VERNEED = 0x6ffffffe
  6906. const m_DT_VERNEEDNUM = 0x6fffffff
  6907. const m_DT_VERSIONTAGNUM = 16
  6908. const m_DT_VERSYM = 0x6ffffff0
  6909. const m_EFA_PARISC_1_0 = 0x020b
  6910. const m_EFA_PARISC_1_1 = 0x0210
  6911. const m_EFA_PARISC_2_0 = 0x0214
  6912. const m_EF_ALPHA_32BIT = 1
  6913. const m_EF_ALPHA_CANRELAX = 2
  6914. const m_EF_ARM_ABI_FLOAT_HARD = 0x400
  6915. const m_EF_ARM_ABI_FLOAT_SOFT = 0x200
  6916. const m_EF_ARM_ALIGN8 = 0x40
  6917. const m_EF_ARM_APCS_26 = 0x08
  6918. const m_EF_ARM_APCS_FLOAT = 0x10
  6919. const m_EF_ARM_BE8 = 0x00800000
  6920. const m_EF_ARM_DYNSYMSUSESEGIDX = 0x08
  6921. const m_EF_ARM_EABIMASK = 0xFF000000
  6922. const m_EF_ARM_EABI_UNKNOWN = 0x00000000
  6923. const m_EF_ARM_EABI_VER1 = 0x01000000
  6924. const m_EF_ARM_EABI_VER2 = 0x02000000
  6925. const m_EF_ARM_EABI_VER3 = 0x03000000
  6926. const m_EF_ARM_EABI_VER4 = 0x04000000
  6927. const m_EF_ARM_EABI_VER5 = 0x05000000
  6928. const m_EF_ARM_HASENTRY = 0x02
  6929. const m_EF_ARM_INTERWORK = 0x04
  6930. const m_EF_ARM_LE8 = 0x00400000
  6931. const m_EF_ARM_MAPSYMSFIRST = 0x10
  6932. const m_EF_ARM_MAVERICK_FLOAT = 0x800
  6933. const m_EF_ARM_NEW_ABI = 0x80
  6934. const m_EF_ARM_OLD_ABI = 0x100
  6935. const m_EF_ARM_PIC = 0x20
  6936. const m_EF_ARM_RELEXEC = 0x01
  6937. const m_EF_ARM_SOFT_FLOAT = 0x200
  6938. const m_EF_ARM_SYMSARESORTED = 0x04
  6939. const m_EF_ARM_VFP_FLOAT = 0x400
  6940. const m_EF_CPU32 = 0x00810000
  6941. const m_EF_IA_64_ABI64 = 0x00000010
  6942. const m_EF_IA_64_ARCH = 0xff000000
  6943. const m_EF_IA_64_MASKOS = 0x0000000f
  6944. const m_EF_LARCH_ABI_DOUBLE_FLOAT = 0x03
  6945. const m_EF_LARCH_ABI_MODIFIER_MASK = 0x07
  6946. const m_EF_LARCH_ABI_SINGLE_FLOAT = 0x02
  6947. const m_EF_LARCH_ABI_SOFT_FLOAT = 0x01
  6948. const m_EF_LARCH_OBJABI_V1 = 0x40
  6949. const m_EF_MIPS_64BIT_WHIRL = 16
  6950. const m_EF_MIPS_ABI2 = 32
  6951. const m_EF_MIPS_ABI_ON32 = 64
  6952. const m_EF_MIPS_ARCH = 0xf0000000
  6953. const m_EF_MIPS_ARCH_1 = 0x00000000
  6954. const m_EF_MIPS_ARCH_2 = 0x10000000
  6955. const m_EF_MIPS_ARCH_3 = 0x20000000
  6956. const m_EF_MIPS_ARCH_32 = 0x50000000
  6957. const m_EF_MIPS_ARCH_32R2 = 0x70000000
  6958. const m_EF_MIPS_ARCH_4 = 0x30000000
  6959. const m_EF_MIPS_ARCH_5 = 0x40000000
  6960. const m_EF_MIPS_ARCH_64 = 0x60000000
  6961. const m_EF_MIPS_ARCH_64R2 = 0x80000000
  6962. const m_EF_MIPS_CPIC = 4
  6963. const m_EF_MIPS_FP64 = 512
  6964. const m_EF_MIPS_NAN2008 = 1024
  6965. const m_EF_MIPS_NOREORDER = 1
  6966. const m_EF_MIPS_PIC = 2
  6967. const m_EF_MIPS_XGOT = 8
  6968. const m_EF_PARISC_ARCH = 0x0000ffff
  6969. const m_EF_PARISC_EXT = 0x00020000
  6970. const m_EF_PARISC_LAZYSWAP = 0x00400000
  6971. const m_EF_PARISC_LSB = 0x00040000
  6972. const m_EF_PARISC_NO_KABP = 0x00100000
  6973. const m_EF_PARISC_TRAPNIL = 0x00010000
  6974. const m_EF_PARISC_WIDE = 0x00080000
  6975. const m_EF_PPC64_ABI = 3
  6976. const m_EF_PPC_EMB = 0x80000000
  6977. const m_EF_PPC_RELOCATABLE = 0x00010000
  6978. const m_EF_PPC_RELOCATABLE_LIB = 0x00008000
  6979. const m_EF_SH1 = 0x1
  6980. const m_EF_SH2 = 0x2
  6981. const m_EF_SH2A = 0xd
  6982. const m_EF_SH2A_NOFPU = 0x13
  6983. const m_EF_SH2A_SH3E = 0x18
  6984. const m_EF_SH2A_SH3_NOFPU = 0x16
  6985. const m_EF_SH2A_SH4 = 0x17
  6986. const m_EF_SH2A_SH4_NOFPU = 0x15
  6987. const m_EF_SH2E = 0xb
  6988. const m_EF_SH3 = 0x3
  6989. const m_EF_SH3E = 0x8
  6990. const m_EF_SH3_DSP = 0x5
  6991. const m_EF_SH3_NOMMU = 0x14
  6992. const m_EF_SH4 = 0x9
  6993. const m_EF_SH4A = 0xc
  6994. const m_EF_SH4AL_DSP = 0x6
  6995. const m_EF_SH4A_NOFPU = 0x11
  6996. const m_EF_SH4_NOFPU = 0x10
  6997. const m_EF_SH4_NOMMU_NOFPU = 0x12
  6998. const m_EF_SH_DSP = 0x4
  6999. const m_EF_SH_MACH_MASK = 0x1f
  7000. const m_EF_SH_UNKNOWN = 0x0
  7001. const m_EF_SPARCV9_MM = 3
  7002. const m_EF_SPARCV9_PSO = 1
  7003. const m_EF_SPARCV9_RMO = 2
  7004. const m_EF_SPARCV9_TSO = 0
  7005. const m_EF_SPARC_32PLUS = 0x000100
  7006. const m_EF_SPARC_EXT_MASK = 0xFFFF00
  7007. const m_EF_SPARC_HAL_R1 = 0x000400
  7008. const m_EF_SPARC_LEDATA = 0x800000
  7009. const m_EF_SPARC_SUN_US1 = 0x000200
  7010. const m_EF_SPARC_SUN_US3 = 0x000800
  7011. const m_EI_ABIVERSION = 8
  7012. const m_EI_CLASS = 4
  7013. const m_EI_DATA = 5
  7014. const m_EI_MAG0 = 0
  7015. const m_EI_MAG1 = 1
  7016. const m_EI_MAG2 = 2
  7017. const m_EI_MAG3 = 3
  7018. const m_EI_NIDENT = 16
  7019. const m_EI_OSABI = 7
  7020. const m_EI_PAD = 9
  7021. const m_EI_VERSION = 6
  7022. const m_ELFCLASS32 = 1
  7023. const m_ELFCLASS64 = 2
  7024. const m_ELFCLASSNONE = 0
  7025. const m_ELFCLASSNUM = 3
  7026. const m_ELFCOMPRESS_HIOS = 0x6fffffff
  7027. const m_ELFCOMPRESS_HIPROC = 0x7fffffff
  7028. const m_ELFCOMPRESS_LOOS = 0x60000000
  7029. const m_ELFCOMPRESS_LOPROC = 0x70000000
  7030. const m_ELFCOMPRESS_ZLIB = 1
  7031. const m_ELFCOMPRESS_ZSTD = 2
  7032. const m_ELFDATA2LSB = 1
  7033. const m_ELFDATA2MSB = 2
  7034. const m_ELFDATANONE = 0
  7035. const m_ELFDATANUM = 3
  7036. const m_ELFMAG = "\\177ELF"
  7037. const m_ELFMAG0 = 127
  7038. const m_ELFMAG1 = 69
  7039. const m_ELFMAG2 = 76
  7040. const m_ELFMAG3 = 70
  7041. const m_ELFOSABI_AIX = 7
  7042. const m_ELFOSABI_ARM = 97
  7043. const m_ELFOSABI_FREEBSD = 9
  7044. const m_ELFOSABI_GNU = 3
  7045. const m_ELFOSABI_HPUX = 1
  7046. const m_ELFOSABI_IRIX = 8
  7047. const m_ELFOSABI_LINUX = 3
  7048. const m_ELFOSABI_MODESTO = 11
  7049. const m_ELFOSABI_NETBSD = 2
  7050. const m_ELFOSABI_NONE = 0
  7051. const m_ELFOSABI_OPENBSD = 12
  7052. const m_ELFOSABI_SOLARIS = 6
  7053. const m_ELFOSABI_STANDALONE = 255
  7054. const m_ELFOSABI_SYSV = 0
  7055. const m_ELFOSABI_TRU64 = 10
  7056. const m_ELF_NOTE_ABI = "NT_GNU_ABI_TAG"
  7057. const m_ELF_NOTE_GNU = "GNU"
  7058. const m_ELF_NOTE_OS_FREEBSD = 3
  7059. const m_ELF_NOTE_OS_GNU = 1
  7060. const m_ELF_NOTE_OS_LINUX = 0
  7061. const m_ELF_NOTE_OS_SOLARIS2 = 2
  7062. const m_ELF_NOTE_PAGESIZE_HINT = 1
  7063. const m_ELF_NOTE_SOLARIS = "SUNW Solaris"
  7064. const m_ELF_ST_BIND = "ELF64_ST_BIND"
  7065. const m_ELF_ST_TYPE = "ELF64_ST_TYPE"
  7066. const m_ELF_TARG_CLASS = "ELFCLASS64"
  7067. const m_ELF_TARG_DATA = "ELFDATA2LSB"
  7068. const m_ELF_TARG_MACH = "EM_AARCH64"
  7069. const m_ELF_TARG_VER = "EV_CURRENT"
  7070. const m_EM_386 = 3
  7071. const m_EM_56800EX = 200
  7072. const m_EM_68HC05 = 72
  7073. const m_EM_68HC08 = 71
  7074. const m_EM_68HC11 = 70
  7075. const m_EM_68HC12 = 53
  7076. const m_EM_68HC16 = 69
  7077. const m_EM_68K = 4
  7078. const m_EM_78KOR = 199
  7079. const m_EM_8051 = 165
  7080. const m_EM_860 = 7
  7081. const m_EM_88K = 5
  7082. const m_EM_960 = 19
  7083. const m_EM_AARCH64 = 183
  7084. const m_EM_ALPHA = 0x9026
  7085. const m_EM_ALTERA_NIOS2 = 113
  7086. const m_EM_AMDGPU = 224
  7087. const m_EM_ARC = 45
  7088. const m_EM_ARCA = 109
  7089. const m_EM_ARC_A5 = 93
  7090. const m_EM_ARC_COMPACT = 93
  7091. const m_EM_ARC_COMPACT2 = 195
  7092. const m_EM_ARM = 40
  7093. const m_EM_AVR = 83
  7094. const m_EM_AVR32 = 185
  7095. const m_EM_BA1 = 201
  7096. const m_EM_BA2 = 202
  7097. const m_EM_BLACKFIN = 106
  7098. const m_EM_BPF = 247
  7099. const m_EM_C166 = 116
  7100. const m_EM_CDP = 215
  7101. const m_EM_CE = 119
  7102. const m_EM_CLOUDSHIELD = 192
  7103. const m_EM_COGE = 216
  7104. const m_EM_COLDFIRE = 52
  7105. const m_EM_COOL = 217
  7106. const m_EM_COREA_1ST = 193
  7107. const m_EM_COREA_2ND = 194
  7108. const m_EM_CR = 103
  7109. const m_EM_CR16 = 177
  7110. const m_EM_CRAYNV2 = 172
  7111. const m_EM_CRIS = 76
  7112. const m_EM_CRX = 114
  7113. const m_EM_CSKY = 252
  7114. const m_EM_CSR_KALIMBA = 219
  7115. const m_EM_CUDA = 190
  7116. const m_EM_CYPRESS_M8C = 161
  7117. const m_EM_D10V = 85
  7118. const m_EM_D30V = 86
  7119. const m_EM_DSP24 = 136
  7120. const m_EM_DSPIC30F = 118
  7121. const m_EM_DXP = 112
  7122. const m_EM_ECOG16 = 176
  7123. const m_EM_ECOG1X = 168
  7124. const m_EM_ECOG2 = 134
  7125. const m_EM_EMX16 = 212
  7126. const m_EM_EMX8 = 213
  7127. const m_EM_ETPU = 178
  7128. const m_EM_EXCESS = 111
  7129. const m_EM_F2MC16 = 104
  7130. const m_EM_FAKE_ALPHA = 41
  7131. const m_EM_FIREPATH = 78
  7132. const m_EM_FR20 = 37
  7133. const m_EM_FR30 = 84
  7134. const m_EM_FT32 = 222
  7135. const m_EM_FX66 = 66
  7136. const m_EM_H8S = 48
  7137. const m_EM_H8_300 = 46
  7138. const m_EM_H8_300H = 47
  7139. const m_EM_H8_500 = 49
  7140. const m_EM_HUANY = 81
  7141. const m_EM_IA_64 = 50
  7142. const m_EM_IP2K = 101
  7143. const m_EM_JAVELIN = 77
  7144. const m_EM_K10M = 181
  7145. const m_EM_KM32 = 210
  7146. const m_EM_KMX32 = 211
  7147. const m_EM_KVARC = 214
  7148. const m_EM_L10M = 180
  7149. const m_EM_LATTICEMICO32 = 138
  7150. const m_EM_LOONGARCH = 258
  7151. const m_EM_M16C = 117
  7152. const m_EM_M32 = 1
  7153. const m_EM_M32C = 120
  7154. const m_EM_M32R = 88
  7155. const m_EM_MANIK = 171
  7156. const m_EM_MAX = 102
  7157. const m_EM_MAXQ30 = 169
  7158. const m_EM_MCHP_PIC = 204
  7159. const m_EM_MCST_ELBRUS = 175
  7160. const m_EM_ME16 = 59
  7161. const m_EM_METAG = 174
  7162. const m_EM_MICROBLAZE = 189
  7163. const m_EM_MIPS = 8
  7164. const m_EM_MIPS_RS3_LE = 10
  7165. const m_EM_MIPS_X = 51
  7166. const m_EM_MMA = 54
  7167. const m_EM_MMDSP_PLUS = 160
  7168. const m_EM_MMIX = 80
  7169. const m_EM_MN10200 = 90
  7170. const m_EM_MN10300 = 89
  7171. const m_EM_MOXIE = 223
  7172. const m_EM_MSP430 = 105
  7173. const m_EM_NCPU = 56
  7174. const m_EM_NDR1 = 57
  7175. const m_EM_NDS32 = 167
  7176. const m_EM_NONE = 0
  7177. const m_EM_NORC = 218
  7178. const m_EM_NS32K = 97
  7179. const m_EM_NUM = 259
  7180. const m_EM_OPEN8 = 196
  7181. const m_EM_OPENRISC = 92
  7182. const m_EM_OR1K = 92
  7183. const m_EM_PARISC = 15
  7184. const m_EM_PCP = 55
  7185. const m_EM_PDSP = 63
  7186. const m_EM_PJ = 91
  7187. const m_EM_PPC = 20
  7188. const m_EM_PPC64 = 21
  7189. const m_EM_PRISM = 82
  7190. const m_EM_QDSP6 = 164
  7191. const m_EM_R32C = 162
  7192. const m_EM_RCE = 39
  7193. const m_EM_RH32 = 38
  7194. const m_EM_RISCV = 243
  7195. const m_EM_RL78 = 197
  7196. const m_EM_RS08 = 132
  7197. const m_EM_RX = 173
  7198. const m_EM_S370 = 9
  7199. const m_EM_S390 = 22
  7200. const m_EM_SCORE7 = 135
  7201. const m_EM_SEP = 108
  7202. const m_EM_SE_C17 = 139
  7203. const m_EM_SE_C33 = 107
  7204. const m_EM_SH = 42
  7205. const m_EM_SHARC = 133
  7206. const m_EM_SLE9X = 179
  7207. const m_EM_SNP1K = 99
  7208. const m_EM_SPARC = 2
  7209. const m_EM_SPARC32PLUS = 18
  7210. const m_EM_SPARCV9 = 43
  7211. const m_EM_ST100 = 60
  7212. const m_EM_ST19 = 74
  7213. const m_EM_ST200 = 100
  7214. const m_EM_ST7 = 68
  7215. const m_EM_ST9PLUS = 67
  7216. const m_EM_STARCORE = 58
  7217. const m_EM_STM8 = 186
  7218. const m_EM_STXP7X = 166
  7219. const m_EM_SVX = 73
  7220. const m_EM_TILE64 = 187
  7221. const m_EM_TILEGX = 191
  7222. const m_EM_TILEPRO = 188
  7223. const m_EM_TINYJ = 61
  7224. const m_EM_TI_ARP32 = 143
  7225. const m_EM_TI_C2000 = 141
  7226. const m_EM_TI_C5500 = 142
  7227. const m_EM_TI_C6000 = 140
  7228. const m_EM_TI_PRU = 144
  7229. const m_EM_TMM_GPP = 96
  7230. const m_EM_TPC = 98
  7231. const m_EM_TRICORE = 44
  7232. const m_EM_TRIMEDIA = 163
  7233. const m_EM_TSK3000 = 131
  7234. const m_EM_UNICORE = 110
  7235. const m_EM_V800 = 36
  7236. const m_EM_V850 = 87
  7237. const m_EM_VAX = 75
  7238. const m_EM_VIDEOCORE = 95
  7239. const m_EM_VIDEOCORE3 = 137
  7240. const m_EM_VIDEOCORE5 = 198
  7241. const m_EM_VISIUM = 221
  7242. const m_EM_VPP500 = 17
  7243. const m_EM_X86_64 = 62
  7244. const m_EM_XCORE = 203
  7245. const m_EM_XGATE = 115
  7246. const m_EM_XIMO16 = 170
  7247. const m_EM_XTENSA = 94
  7248. const m_EM_Z80 = 220
  7249. const m_EM_ZSP = 79
  7250. const m_ET_CORE = 4
  7251. const m_ET_DYN = 3
  7252. const m_ET_EXEC = 2
  7253. const m_ET_HIOS = 0xfeff
  7254. const m_ET_HIPROC = 0xffff
  7255. const m_ET_LOOS = 0xfe00
  7256. const m_ET_LOPROC = 0xff00
  7257. const m_ET_NONE = 0
  7258. const m_ET_NUM = 5
  7259. const m_ET_REL = 1
  7260. const m_EV_CURRENT = 1
  7261. const m_EV_NONE = 0
  7262. const m_EV_NUM = 2
  7263. const m_E_MIPS_ARCH_1 = 0x00000000
  7264. const m_E_MIPS_ARCH_2 = 0x10000000
  7265. const m_E_MIPS_ARCH_3 = 0x20000000
  7266. const m_E_MIPS_ARCH_32 = 0x50000000
  7267. const m_E_MIPS_ARCH_4 = 0x30000000
  7268. const m_E_MIPS_ARCH_5 = 0x40000000
  7269. const m_E_MIPS_ARCH_64 = 0x60000000
  7270. const m_Elf_Ehdr = "Elf64_Ehdr"
  7271. const m_Elf_Off = "Elf64_Off"
  7272. const m_Elf_Shdr = "Elf64_Shdr"
  7273. const m_Elf_Sword = "Elf64_Sword"
  7274. const m_Elf_Sym = "Elf64_Sym"
  7275. const m_Elf_Word = "Elf64_Word"
  7276. const m_GRP_COMDAT = 0x1
  7277. const m_LITUSE_ALPHA_ADDR = 0
  7278. const m_LITUSE_ALPHA_BASE = 1
  7279. const m_LITUSE_ALPHA_BYTOFF = 2
  7280. const m_LITUSE_ALPHA_JSR = 3
  7281. const m_LITUSE_ALPHA_TLS_GD = 4
  7282. const m_LITUSE_ALPHA_TLS_LDM = 5
  7283. const m_LL_NONE = 0
  7284. const m_MAP_ANON1 = 0x20
  7285. const m_MAP_PRIVATE1 = 0x02
  7286. const m_MIPS_AFL_ASE_DSP = 0x00000001
  7287. const m_MIPS_AFL_ASE_DSPR2 = 0x00000002
  7288. const m_MIPS_AFL_ASE_EVA = 0x00000004
  7289. const m_MIPS_AFL_ASE_MASK = 0x00001fff
  7290. const m_MIPS_AFL_ASE_MCU = 0x00000008
  7291. const m_MIPS_AFL_ASE_MDMX = 0x00000010
  7292. const m_MIPS_AFL_ASE_MICROMIPS = 0x00000800
  7293. const m_MIPS_AFL_ASE_MIPS16 = 0x00000400
  7294. const m_MIPS_AFL_ASE_MIPS3D = 0x00000020
  7295. const m_MIPS_AFL_ASE_MSA = 0x00000200
  7296. const m_MIPS_AFL_ASE_MT = 0x00000040
  7297. const m_MIPS_AFL_ASE_SMARTMIPS = 0x00000080
  7298. const m_MIPS_AFL_ASE_VIRT = 0x00000100
  7299. const m_MIPS_AFL_ASE_XPA = 0x00001000
  7300. const m_MIPS_AFL_EXT_10000 = 11
  7301. const m_MIPS_AFL_EXT_3900 = 10
  7302. const m_MIPS_AFL_EXT_4010 = 8
  7303. const m_MIPS_AFL_EXT_4100 = 9
  7304. const m_MIPS_AFL_EXT_4111 = 13
  7305. const m_MIPS_AFL_EXT_4120 = 14
  7306. const m_MIPS_AFL_EXT_4650 = 7
  7307. const m_MIPS_AFL_EXT_5400 = 15
  7308. const m_MIPS_AFL_EXT_5500 = 16
  7309. const m_MIPS_AFL_EXT_5900 = 6
  7310. const m_MIPS_AFL_EXT_LOONGSON_2E = 17
  7311. const m_MIPS_AFL_EXT_LOONGSON_2F = 18
  7312. const m_MIPS_AFL_EXT_LOONGSON_3A = 4
  7313. const m_MIPS_AFL_EXT_OCTEON = 5
  7314. const m_MIPS_AFL_EXT_OCTEON2 = 2
  7315. const m_MIPS_AFL_EXT_OCTEONP = 3
  7316. const m_MIPS_AFL_EXT_SB1 = 12
  7317. const m_MIPS_AFL_EXT_XLR = 1
  7318. const m_MIPS_AFL_FLAGS1_ODDSPREG = 1
  7319. const m_MIPS_AFL_REG_128 = 0x03
  7320. const m_MIPS_AFL_REG_32 = 0x01
  7321. const m_MIPS_AFL_REG_64 = 0x02
  7322. const m_MIPS_AFL_REG_NONE = 0x00
  7323. const m_NT_386_IOPERM = 0x201
  7324. const m_NT_386_TLS = 0x200
  7325. const m_NT_ARC_V2 = 0x600
  7326. const m_NT_ARM_HW_BREAK = 0x402
  7327. const m_NT_ARM_HW_WATCH = 0x403
  7328. const m_NT_ARM_PACA_KEYS = 0x407
  7329. const m_NT_ARM_PACG_KEYS = 0x408
  7330. const m_NT_ARM_PAC_ENABLED_KEYS = 0x40a
  7331. const m_NT_ARM_PAC_MASK = 0x406
  7332. const m_NT_ARM_SVE = 0x405
  7333. const m_NT_ARM_SYSTEM_CALL = 0x404
  7334. const m_NT_ARM_TAGGED_ADDR_CTRL = 0x409
  7335. const m_NT_ARM_TLS = 0x401
  7336. const m_NT_ARM_VFP = 0x400
  7337. const m_NT_ASRS = 8
  7338. const m_NT_AUXV = 6
  7339. const m_NT_FILE = 0x46494c45
  7340. const m_NT_FPREGSET = 2
  7341. const m_NT_GNU_ABI_TAG = 1
  7342. const m_NT_GNU_BUILD_ID = 3
  7343. const m_NT_GNU_GOLD_VERSION = 4
  7344. const m_NT_GNU_PROPERTY_TYPE_0 = 5
  7345. const m_NT_GWINDOWS = 7
  7346. const m_NT_LOONGARCH_CPUCFG = 0xa00
  7347. const m_NT_LOONGARCH_CSR = 0xa01
  7348. const m_NT_LOONGARCH_LASX = 0xa03
  7349. const m_NT_LOONGARCH_LBT = 0xa04
  7350. const m_NT_LOONGARCH_LSX = 0xa02
  7351. const m_NT_LWPSINFO = 17
  7352. const m_NT_LWPSTATUS = 16
  7353. const m_NT_METAG_CBUF = 0x500
  7354. const m_NT_METAG_RPIPE = 0x501
  7355. const m_NT_METAG_TLS = 0x502
  7356. const m_NT_MIPS_DSP = 0x800
  7357. const m_NT_MIPS_FP_MODE = 0x801
  7358. const m_NT_MIPS_MSA = 0x802
  7359. const m_NT_PLATFORM = 5
  7360. const m_NT_PPC_DSCR = 0x105
  7361. const m_NT_PPC_EBB = 0x106
  7362. const m_NT_PPC_PMU = 0x107
  7363. const m_NT_PPC_PPR = 0x104
  7364. const m_NT_PPC_SPE = 0x101
  7365. const m_NT_PPC_TAR = 0x103
  7366. const m_NT_PPC_TM_CDSCR = 0x10f
  7367. const m_NT_PPC_TM_CFPR = 0x109
  7368. const m_NT_PPC_TM_CGPR = 0x108
  7369. const m_NT_PPC_TM_CPPR = 0x10e
  7370. const m_NT_PPC_TM_CTAR = 0x10d
  7371. const m_NT_PPC_TM_CVMX = 0x10a
  7372. const m_NT_PPC_TM_CVSX = 0x10b
  7373. const m_NT_PPC_TM_SPR = 0x10c
  7374. const m_NT_PPC_VMX = 0x100
  7375. const m_NT_PPC_VSX = 0x102
  7376. const m_NT_PRCRED = 14
  7377. const m_NT_PRFPREG = 2
  7378. const m_NT_PRFPXREG = 20
  7379. const m_NT_PRPSINFO = 3
  7380. const m_NT_PRSTATUS = 1
  7381. const m_NT_PRXFPREG = 0x46e62b7f
  7382. const m_NT_PRXREG = 4
  7383. const m_NT_PSINFO = 13
  7384. const m_NT_PSTATUS = 10
  7385. const m_NT_RISCV_CSR = 0x900
  7386. const m_NT_RISCV_VECTOR = 0x901
  7387. const m_NT_S390_CTRS = 0x304
  7388. const m_NT_S390_GS_BC = 0x30c
  7389. const m_NT_S390_GS_CB = 0x30b
  7390. const m_NT_S390_HIGH_GPRS = 0x300
  7391. const m_NT_S390_LAST_BREAK = 0x306
  7392. const m_NT_S390_PREFIX = 0x305
  7393. const m_NT_S390_RI_CB = 0x30d
  7394. const m_NT_S390_SYSTEM_CALL = 0x307
  7395. const m_NT_S390_TDB = 0x308
  7396. const m_NT_S390_TIMER = 0x301
  7397. const m_NT_S390_TODCMP = 0x302
  7398. const m_NT_S390_TODPREG = 0x303
  7399. const m_NT_S390_VXRS_HIGH = 0x30a
  7400. const m_NT_S390_VXRS_LOW = 0x309
  7401. const m_NT_SIGINFO = 0x53494749
  7402. const m_NT_TASKSTRUCT = 4
  7403. const m_NT_UTSNAME = 15
  7404. const m_NT_VERSION = 1
  7405. const m_NT_VMCOREDD = 0x700
  7406. const m_NT_X86_XSTATE = 0x202
  7407. const m_N_ABS = 2
  7408. const m_N_BSS = 8
  7409. const m_N_COMM = 0x12
  7410. const m_N_DATA = 6
  7411. const m_N_EXT = 1
  7412. const m_N_FN = 30
  7413. const m_N_FORMAT = "%08x"
  7414. const m_N_INDR = 0x0a
  7415. const m_N_SETA = 0x14
  7416. const m_N_SETB = 0x1a
  7417. const m_N_SETD = 0x18
  7418. const m_N_SETT = 0x16
  7419. const m_N_SETV = 0x1c
  7420. const m_N_SIZE = 0x0c
  7421. const m_N_STAB = 0xe0
  7422. const m_N_TEXT = 4
  7423. const m_N_TYPE = 0x1e
  7424. const m_N_UNDF = 0
  7425. const m_N_WARN = 0x1e
  7426. const m_ODK_EXCEPTIONS = 2
  7427. const m_ODK_FILL = 5
  7428. const m_ODK_HWAND = 7
  7429. const m_ODK_HWOR = 8
  7430. const m_ODK_HWPATCH = 4
  7431. const m_ODK_NULL = 0
  7432. const m_ODK_PAD = 3
  7433. const m_ODK_REGINFO = 1
  7434. const m_ODK_TAGS = 6
  7435. const m_OEX_DISMISS = 0x80000
  7436. const m_OEX_FPDBUG = 0x40000
  7437. const m_OEX_FPU_DIV0 = 0x08
  7438. const m_OEX_FPU_INEX = 0x01
  7439. const m_OEX_FPU_INVAL = 0x10
  7440. const m_OEX_FPU_MAX = 0x1f00
  7441. const m_OEX_FPU_MIN = 0x1f
  7442. const m_OEX_FPU_OFLO = 0x04
  7443. const m_OEX_FPU_UFLO = 0x02
  7444. const m_OEX_PAGE0 = 0x10000
  7445. const m_OEX_PRECISEFP = "OEX_FPDBUG"
  7446. const m_OEX_SMM = 0x20000
  7447. const m_OHWA0_R4KEOP_CHECKED = 0x00000001
  7448. const m_OHWA1_R4KEOP_CLEAN = 0x00000002
  7449. const m_OHW_R4KEOP = 0x1
  7450. const m_OHW_R5KCVTL = 0x8
  7451. const m_OHW_R5KEOP = 0x4
  7452. const m_OHW_R8KPFETCH = 0x2
  7453. const m_OPAD_POSTFIX = 0x2
  7454. const m_OPAD_PREFIX = 0x1
  7455. const m_OPAD_SYMBOL = 0x4
  7456. const m_O_CREAT2 = 0100
  7457. const m_O_NONBLOCK2 = 04000
  7458. const m_O_RDONLY1 = 0
  7459. const m_O_TRUNC2 = 01000
  7460. const m_PF_ARM_ABS = 0x40000000
  7461. const m_PF_ARM_PI = 0x20000000
  7462. const m_PF_ARM_SB = 0x10000000
  7463. const m_PF_HP_CODE = 0x01000000
  7464. const m_PF_HP_FAR_SHARED = 0x00200000
  7465. const m_PF_HP_LAZYSWAP = 0x04000000
  7466. const m_PF_HP_MODIFY = 0x02000000
  7467. const m_PF_HP_NEAR_SHARED = 0x00400000
  7468. const m_PF_HP_PAGE_SIZE = 0x00100000
  7469. const m_PF_HP_SBP = 0x08000000
  7470. const m_PF_IA_64_NORECOV = 0x80000000
  7471. const m_PF_MASKOS = 0x0ff00000
  7472. const m_PF_MASKPROC = 0xf0000000
  7473. const m_PF_MIPS_LOCAL = 0x10000000
  7474. const m_PF_PARISC_SBP = 0x08000000
  7475. const m_PN_XNUM = 0xffff
  7476. const m_PPC64_OPT_LOCALENTRY = 4
  7477. const m_PPC64_OPT_MULTI_TOC = 2
  7478. const m_PPC64_OPT_TLS = 1
  7479. const m_PPC_OPT_TLS = 1
  7480. const m_PT_DYNAMIC = 2
  7481. const m_PT_GNU_EH_FRAME = 0x6474e550
  7482. const m_PT_GNU_PROPERTY = 0x6474e553
  7483. const m_PT_GNU_RELRO = 0x6474e552
  7484. const m_PT_GNU_STACK = 0x6474e551
  7485. const m_PT_HIOS = 0x6fffffff
  7486. const m_PT_HIPROC = 0x7fffffff
  7487. const m_PT_HISUNW = 0x6fffffff
  7488. const m_PT_INTERP = 3
  7489. const m_PT_LOAD = 1
  7490. const m_PT_LOOS = 0x60000000
  7491. const m_PT_LOPROC = 0x70000000
  7492. const m_PT_LOSUNW = 0x6ffffffa
  7493. const m_PT_MIPS_ABIFLAGS = 0x70000003
  7494. const m_PT_MIPS_OPTIONS = 0x70000002
  7495. const m_PT_MIPS_REGINFO = 0x70000000
  7496. const m_PT_MIPS_RTPROC = 0x70000001
  7497. const m_PT_NOTE = 4
  7498. const m_PT_NULL = 0
  7499. const m_PT_NUM = 8
  7500. const m_PT_PARISC_ARCHEXT = 0x70000000
  7501. const m_PT_PARISC_UNWIND = 0x70000001
  7502. const m_PT_PHDR = 6
  7503. const m_PT_SHLIB = 5
  7504. const m_PT_SUNWBSS = 0x6ffffffa
  7505. const m_PT_SUNWSTACK = 0x6ffffffb
  7506. const m_PT_TLS = 7
  7507. const m_RHF_NONE = 0
  7508. const m_R_386_16 = 20
  7509. const m_R_386_32 = 1
  7510. const m_R_386_32PLT = 11
  7511. const m_R_386_8 = 22
  7512. const m_R_386_COPY = 5
  7513. const m_R_386_GLOB_DAT = 6
  7514. const m_R_386_GOT32 = 3
  7515. const m_R_386_GOT32X = 43
  7516. const m_R_386_GOTOFF = 9
  7517. const m_R_386_GOTPC = 10
  7518. const m_R_386_IRELATIVE = 42
  7519. const m_R_386_JMP_SLOT = 7
  7520. const m_R_386_NONE = 0
  7521. const m_R_386_NUM = 44
  7522. const m_R_386_PC16 = 21
  7523. const m_R_386_PC32 = 2
  7524. const m_R_386_PC8 = 23
  7525. const m_R_386_PLT32 = 4
  7526. const m_R_386_RELATIVE = 8
  7527. const m_R_386_SIZE32 = 38
  7528. const m_R_386_TLS_DESC = 41
  7529. const m_R_386_TLS_DESC_CALL = 40
  7530. const m_R_386_TLS_DTPMOD32 = 35
  7531. const m_R_386_TLS_DTPOFF32 = 36
  7532. const m_R_386_TLS_GD = 18
  7533. const m_R_386_TLS_GD_32 = 24
  7534. const m_R_386_TLS_GD_CALL = 26
  7535. const m_R_386_TLS_GD_POP = 27
  7536. const m_R_386_TLS_GD_PUSH = 25
  7537. const m_R_386_TLS_GOTDESC = 39
  7538. const m_R_386_TLS_GOTIE = 16
  7539. const m_R_386_TLS_IE = 15
  7540. const m_R_386_TLS_IE_32 = 33
  7541. const m_R_386_TLS_LDM = 19
  7542. const m_R_386_TLS_LDM_32 = 28
  7543. const m_R_386_TLS_LDM_CALL = 30
  7544. const m_R_386_TLS_LDM_POP = 31
  7545. const m_R_386_TLS_LDM_PUSH = 29
  7546. const m_R_386_TLS_LDO_32 = 32
  7547. const m_R_386_TLS_LE = 17
  7548. const m_R_386_TLS_LE_32 = 34
  7549. const m_R_386_TLS_TPOFF = 14
  7550. const m_R_386_TLS_TPOFF32 = 37
  7551. const m_R_390_12 = 2
  7552. const m_R_390_16 = 3
  7553. const m_R_390_20 = 57
  7554. const m_R_390_32 = 4
  7555. const m_R_390_64 = 22
  7556. const m_R_390_8 = 1
  7557. const m_R_390_COPY = 9
  7558. const m_R_390_GLOB_DAT = 10
  7559. const m_R_390_GOT12 = 6
  7560. const m_R_390_GOT16 = 15
  7561. const m_R_390_GOT20 = 58
  7562. const m_R_390_GOT32 = 7
  7563. const m_R_390_GOT64 = 24
  7564. const m_R_390_GOTENT = 26
  7565. const m_R_390_GOTOFF16 = 27
  7566. const m_R_390_GOTOFF32 = 13
  7567. const m_R_390_GOTOFF64 = 28
  7568. const m_R_390_GOTPC = 14
  7569. const m_R_390_GOTPCDBL = 21
  7570. const m_R_390_GOTPLT12 = 29
  7571. const m_R_390_GOTPLT16 = 30
  7572. const m_R_390_GOTPLT20 = 59
  7573. const m_R_390_GOTPLT32 = 31
  7574. const m_R_390_GOTPLT64 = 32
  7575. const m_R_390_GOTPLTENT = 33
  7576. const m_R_390_JMP_SLOT = 11
  7577. const m_R_390_NONE = 0
  7578. const m_R_390_NUM = 61
  7579. const m_R_390_PC16 = 16
  7580. const m_R_390_PC16DBL = 17
  7581. const m_R_390_PC32 = 5
  7582. const m_R_390_PC32DBL = 19
  7583. const m_R_390_PC64 = 23
  7584. const m_R_390_PLT16DBL = 18
  7585. const m_R_390_PLT32 = 8
  7586. const m_R_390_PLT32DBL = 20
  7587. const m_R_390_PLT64 = 25
  7588. const m_R_390_PLTOFF16 = 34
  7589. const m_R_390_PLTOFF32 = 35
  7590. const m_R_390_PLTOFF64 = 36
  7591. const m_R_390_RELATIVE = 12
  7592. const m_R_390_TLS_DTPMOD = 54
  7593. const m_R_390_TLS_DTPOFF = 55
  7594. const m_R_390_TLS_GD32 = 40
  7595. const m_R_390_TLS_GD64 = 41
  7596. const m_R_390_TLS_GDCALL = 38
  7597. const m_R_390_TLS_GOTIE12 = 42
  7598. const m_R_390_TLS_GOTIE20 = 60
  7599. const m_R_390_TLS_GOTIE32 = 43
  7600. const m_R_390_TLS_GOTIE64 = 44
  7601. const m_R_390_TLS_IE32 = 47
  7602. const m_R_390_TLS_IE64 = 48
  7603. const m_R_390_TLS_IEENT = 49
  7604. const m_R_390_TLS_LDCALL = 39
  7605. const m_R_390_TLS_LDM32 = 45
  7606. const m_R_390_TLS_LDM64 = 46
  7607. const m_R_390_TLS_LDO32 = 52
  7608. const m_R_390_TLS_LDO64 = 53
  7609. const m_R_390_TLS_LE32 = 50
  7610. const m_R_390_TLS_LE64 = 51
  7611. const m_R_390_TLS_LOAD = 37
  7612. const m_R_390_TLS_TPOFF = 56
  7613. const m_R_68K_16 = 2
  7614. const m_R_68K_32 = 1
  7615. const m_R_68K_8 = 3
  7616. const m_R_68K_COPY = 19
  7617. const m_R_68K_GLOB_DAT = 20
  7618. const m_R_68K_GOT16 = 8
  7619. const m_R_68K_GOT16O = 11
  7620. const m_R_68K_GOT32 = 7
  7621. const m_R_68K_GOT32O = 10
  7622. const m_R_68K_GOT8 = 9
  7623. const m_R_68K_GOT8O = 12
  7624. const m_R_68K_JMP_SLOT = 21
  7625. const m_R_68K_NONE = 0
  7626. const m_R_68K_NUM = 43
  7627. const m_R_68K_PC16 = 5
  7628. const m_R_68K_PC32 = 4
  7629. const m_R_68K_PC8 = 6
  7630. const m_R_68K_PLT16 = 14
  7631. const m_R_68K_PLT16O = 17
  7632. const m_R_68K_PLT32 = 13
  7633. const m_R_68K_PLT32O = 16
  7634. const m_R_68K_PLT8 = 15
  7635. const m_R_68K_PLT8O = 18
  7636. const m_R_68K_RELATIVE = 22
  7637. const m_R_68K_TLS_DTPMOD32 = 40
  7638. const m_R_68K_TLS_DTPREL32 = 41
  7639. const m_R_68K_TLS_GD16 = 26
  7640. const m_R_68K_TLS_GD32 = 25
  7641. const m_R_68K_TLS_GD8 = 27
  7642. const m_R_68K_TLS_IE16 = 35
  7643. const m_R_68K_TLS_IE32 = 34
  7644. const m_R_68K_TLS_IE8 = 36
  7645. const m_R_68K_TLS_LDM16 = 29
  7646. const m_R_68K_TLS_LDM32 = 28
  7647. const m_R_68K_TLS_LDM8 = 30
  7648. const m_R_68K_TLS_LDO16 = 32
  7649. const m_R_68K_TLS_LDO32 = 31
  7650. const m_R_68K_TLS_LDO8 = 33
  7651. const m_R_68K_TLS_LE16 = 38
  7652. const m_R_68K_TLS_LE32 = 37
  7653. const m_R_68K_TLS_LE8 = 39
  7654. const m_R_68K_TLS_TPREL32 = 42
  7655. const m_R_AARCH64_ABS16 = 259
  7656. const m_R_AARCH64_ABS32 = 258
  7657. const m_R_AARCH64_ABS64 = 257
  7658. const m_R_AARCH64_ADD_ABS_LO12_NC = 277
  7659. const m_R_AARCH64_ADR_GOT_PAGE = 311
  7660. const m_R_AARCH64_ADR_PREL_LO21 = 274
  7661. const m_R_AARCH64_ADR_PREL_PG_HI21 = 275
  7662. const m_R_AARCH64_ADR_PREL_PG_HI21_NC = 276
  7663. const m_R_AARCH64_CALL26 = 283
  7664. const m_R_AARCH64_CONDBR19 = 280
  7665. const m_R_AARCH64_COPY = 1024
  7666. const m_R_AARCH64_GLOB_DAT = 1025
  7667. const m_R_AARCH64_GOTREL32 = 308
  7668. const m_R_AARCH64_GOTREL64 = 307
  7669. const m_R_AARCH64_GOT_LD_PREL19 = 309
  7670. const m_R_AARCH64_JUMP26 = 282
  7671. const m_R_AARCH64_JUMP_SLOT = 1026
  7672. const m_R_AARCH64_LD64_GOTOFF_LO15 = 310
  7673. const m_R_AARCH64_LD64_GOTPAGE_LO15 = 313
  7674. const m_R_AARCH64_LD64_GOT_LO12_NC = 312
  7675. const m_R_AARCH64_LDST128_ABS_LO12_NC = 299
  7676. const m_R_AARCH64_LDST16_ABS_LO12_NC = 284
  7677. const m_R_AARCH64_LDST32_ABS_LO12_NC = 285
  7678. const m_R_AARCH64_LDST64_ABS_LO12_NC = 286
  7679. const m_R_AARCH64_LDST8_ABS_LO12_NC = 278
  7680. const m_R_AARCH64_LD_PREL_LO19 = 273
  7681. const m_R_AARCH64_MOVW_GOTOFF_G0 = 300
  7682. const m_R_AARCH64_MOVW_GOTOFF_G0_NC = 301
  7683. const m_R_AARCH64_MOVW_GOTOFF_G1 = 302
  7684. const m_R_AARCH64_MOVW_GOTOFF_G1_NC = 303
  7685. const m_R_AARCH64_MOVW_GOTOFF_G2 = 304
  7686. const m_R_AARCH64_MOVW_GOTOFF_G2_NC = 305
  7687. const m_R_AARCH64_MOVW_GOTOFF_G3 = 306
  7688. const m_R_AARCH64_MOVW_PREL_G0 = 287
  7689. const m_R_AARCH64_MOVW_PREL_G0_NC = 288
  7690. const m_R_AARCH64_MOVW_PREL_G1 = 289
  7691. const m_R_AARCH64_MOVW_PREL_G1_NC = 290
  7692. const m_R_AARCH64_MOVW_PREL_G2 = 291
  7693. const m_R_AARCH64_MOVW_PREL_G2_NC = 292
  7694. const m_R_AARCH64_MOVW_PREL_G3 = 293
  7695. const m_R_AARCH64_MOVW_SABS_G0 = 270
  7696. const m_R_AARCH64_MOVW_SABS_G1 = 271
  7697. const m_R_AARCH64_MOVW_SABS_G2 = 272
  7698. const m_R_AARCH64_MOVW_UABS_G0 = 263
  7699. const m_R_AARCH64_MOVW_UABS_G0_NC = 264
  7700. const m_R_AARCH64_MOVW_UABS_G1 = 265
  7701. const m_R_AARCH64_MOVW_UABS_G1_NC = 266
  7702. const m_R_AARCH64_MOVW_UABS_G2 = 267
  7703. const m_R_AARCH64_MOVW_UABS_G2_NC = 268
  7704. const m_R_AARCH64_MOVW_UABS_G3 = 269
  7705. const m_R_AARCH64_NONE = 0
  7706. const m_R_AARCH64_P32_ABS32 = 1
  7707. const m_R_AARCH64_P32_COPY = 180
  7708. const m_R_AARCH64_P32_GLOB_DAT = 181
  7709. const m_R_AARCH64_P32_IRELATIVE = 188
  7710. const m_R_AARCH64_P32_JUMP_SLOT = 182
  7711. const m_R_AARCH64_P32_RELATIVE = 183
  7712. const m_R_AARCH64_P32_TLSDESC = 187
  7713. const m_R_AARCH64_P32_TLS_DTPMOD = 184
  7714. const m_R_AARCH64_P32_TLS_DTPREL = 185
  7715. const m_R_AARCH64_P32_TLS_TPREL = 186
  7716. const m_R_AARCH64_PREL16 = 262
  7717. const m_R_AARCH64_PREL32 = 261
  7718. const m_R_AARCH64_PREL64 = 260
  7719. const m_R_AARCH64_RELATIVE = 1027
  7720. const m_R_AARCH64_TLSDESC = 1031
  7721. const m_R_AARCH64_TLSDESC_ADD = 568
  7722. const m_R_AARCH64_TLSDESC_ADD_LO12 = 564
  7723. const m_R_AARCH64_TLSDESC_ADR_PAGE21 = 562
  7724. const m_R_AARCH64_TLSDESC_ADR_PREL21 = 561
  7725. const m_R_AARCH64_TLSDESC_CALL = 569
  7726. const m_R_AARCH64_TLSDESC_LD64_LO12 = 563
  7727. const m_R_AARCH64_TLSDESC_LDR = 567
  7728. const m_R_AARCH64_TLSDESC_LD_PREL19 = 560
  7729. const m_R_AARCH64_TLSDESC_OFF_G0_NC = 566
  7730. const m_R_AARCH64_TLSDESC_OFF_G1 = 565
  7731. const m_R_AARCH64_TLSGD_ADD_LO12_NC = 514
  7732. const m_R_AARCH64_TLSGD_ADR_PAGE21 = 513
  7733. const m_R_AARCH64_TLSGD_ADR_PREL21 = 512
  7734. const m_R_AARCH64_TLSGD_MOVW_G0_NC = 516
  7735. const m_R_AARCH64_TLSGD_MOVW_G1 = 515
  7736. const m_R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 = 541
  7737. const m_R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC = 542
  7738. const m_R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 = 543
  7739. const m_R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC = 540
  7740. const m_R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 = 539
  7741. const m_R_AARCH64_TLSLD_ADD_DTPREL_HI12 = 528
  7742. const m_R_AARCH64_TLSLD_ADD_DTPREL_LO12 = 529
  7743. const m_R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC = 530
  7744. const m_R_AARCH64_TLSLD_ADD_LO12_NC = 519
  7745. const m_R_AARCH64_TLSLD_ADR_PAGE21 = 518
  7746. const m_R_AARCH64_TLSLD_ADR_PREL21 = 517
  7747. const m_R_AARCH64_TLSLD_LDST128_DTPREL_LO12 = 572
  7748. const m_R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC = 573
  7749. const m_R_AARCH64_TLSLD_LDST16_DTPREL_LO12 = 533
  7750. const m_R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC = 534
  7751. const m_R_AARCH64_TLSLD_LDST32_DTPREL_LO12 = 535
  7752. const m_R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC = 536
  7753. const m_R_AARCH64_TLSLD_LDST64_DTPREL_LO12 = 537
  7754. const m_R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC = 538
  7755. const m_R_AARCH64_TLSLD_LDST8_DTPREL_LO12 = 531
  7756. const m_R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC = 532
  7757. const m_R_AARCH64_TLSLD_LD_PREL19 = 522
  7758. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G0 = 526
  7759. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC = 527
  7760. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G1 = 524
  7761. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC = 525
  7762. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G2 = 523
  7763. const m_R_AARCH64_TLSLD_MOVW_G0_NC = 521
  7764. const m_R_AARCH64_TLSLD_MOVW_G1 = 520
  7765. const m_R_AARCH64_TLSLE_ADD_TPREL_HI12 = 549
  7766. const m_R_AARCH64_TLSLE_ADD_TPREL_LO12 = 550
  7767. const m_R_AARCH64_TLSLE_ADD_TPREL_LO12_NC = 551
  7768. const m_R_AARCH64_TLSLE_LDST128_TPREL_LO12 = 570
  7769. const m_R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC = 571
  7770. const m_R_AARCH64_TLSLE_LDST16_TPREL_LO12 = 554
  7771. const m_R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC = 555
  7772. const m_R_AARCH64_TLSLE_LDST32_TPREL_LO12 = 556
  7773. const m_R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC = 557
  7774. const m_R_AARCH64_TLSLE_LDST64_TPREL_LO12 = 558
  7775. const m_R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC = 559
  7776. const m_R_AARCH64_TLSLE_LDST8_TPREL_LO12 = 552
  7777. const m_R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC = 553
  7778. const m_R_AARCH64_TLSLE_MOVW_TPREL_G0 = 547
  7779. const m_R_AARCH64_TLSLE_MOVW_TPREL_G0_NC = 548
  7780. const m_R_AARCH64_TLSLE_MOVW_TPREL_G1 = 545
  7781. const m_R_AARCH64_TLSLE_MOVW_TPREL_G1_NC = 546
  7782. const m_R_AARCH64_TLSLE_MOVW_TPREL_G2 = 544
  7783. const m_R_AARCH64_TLS_DTPMOD = 1028
  7784. const m_R_AARCH64_TLS_DTPMOD64 = 1028
  7785. const m_R_AARCH64_TLS_DTPREL = 1029
  7786. const m_R_AARCH64_TLS_DTPREL64 = 1029
  7787. const m_R_AARCH64_TLS_TPREL = 1030
  7788. const m_R_AARCH64_TLS_TPREL64 = 1030
  7789. const m_R_AARCH64_TSTBR14 = 279
  7790. const m_R_ALPHA_BRADDR = 7
  7791. const m_R_ALPHA_COPY = 24
  7792. const m_R_ALPHA_DTPMOD64 = 31
  7793. const m_R_ALPHA_DTPREL16 = 36
  7794. const m_R_ALPHA_DTPREL64 = 33
  7795. const m_R_ALPHA_DTPRELHI = 34
  7796. const m_R_ALPHA_DTPRELLO = 35
  7797. const m_R_ALPHA_GLOB_DAT = 25
  7798. const m_R_ALPHA_GOTDTPREL = 32
  7799. const m_R_ALPHA_GOTTPREL = 37
  7800. const m_R_ALPHA_GPDISP = 6
  7801. const m_R_ALPHA_GPREL16 = 19
  7802. const m_R_ALPHA_GPREL32 = 3
  7803. const m_R_ALPHA_GPRELHIGH = 17
  7804. const m_R_ALPHA_GPRELLOW = 18
  7805. const m_R_ALPHA_HINT = 8
  7806. const m_R_ALPHA_JMP_SLOT = 26
  7807. const m_R_ALPHA_LITERAL = 4
  7808. const m_R_ALPHA_LITUSE = 5
  7809. const m_R_ALPHA_NONE = 0
  7810. const m_R_ALPHA_NUM = 46
  7811. const m_R_ALPHA_REFLONG = 1
  7812. const m_R_ALPHA_REFQUAD = 2
  7813. const m_R_ALPHA_RELATIVE = 27
  7814. const m_R_ALPHA_SREL16 = 9
  7815. const m_R_ALPHA_SREL32 = 10
  7816. const m_R_ALPHA_SREL64 = 11
  7817. const m_R_ALPHA_TLSGD = 29
  7818. const m_R_ALPHA_TLS_GD_HI = 28
  7819. const m_R_ALPHA_TLS_LDM = 30
  7820. const m_R_ALPHA_TPREL16 = 41
  7821. const m_R_ALPHA_TPREL64 = 38
  7822. const m_R_ALPHA_TPRELHI = 39
  7823. const m_R_ALPHA_TPRELLO = 40
  7824. const m_R_ARM_ABS12 = 6
  7825. const m_R_ARM_ABS16 = 5
  7826. const m_R_ARM_ABS32 = 2
  7827. const m_R_ARM_ABS32_NOI = 55
  7828. const m_R_ARM_ABS8 = 8
  7829. const m_R_ARM_ALU_PCREL_15_8 = 33
  7830. const m_R_ARM_ALU_PCREL_23_15 = 34
  7831. const m_R_ARM_ALU_PCREL_7_0 = 32
  7832. const m_R_ARM_ALU_PC_G0 = 58
  7833. const m_R_ARM_ALU_PC_G0_NC = 57
  7834. const m_R_ARM_ALU_PC_G1 = 60
  7835. const m_R_ARM_ALU_PC_G1_NC = 59
  7836. const m_R_ARM_ALU_PC_G2 = 61
  7837. const m_R_ARM_ALU_SBREL_19_12 = 36
  7838. const m_R_ARM_ALU_SBREL_27_20 = 37
  7839. const m_R_ARM_ALU_SB_G0 = 71
  7840. const m_R_ARM_ALU_SB_G0_NC = 70
  7841. const m_R_ARM_ALU_SB_G1 = 73
  7842. const m_R_ARM_ALU_SB_G1_NC = 72
  7843. const m_R_ARM_ALU_SB_G2 = 74
  7844. const m_R_ARM_AMP_VCALL9 = 12
  7845. const m_R_ARM_BASE_ABS = 31
  7846. const m_R_ARM_CALL = 28
  7847. const m_R_ARM_COPY = 20
  7848. const m_R_ARM_GLOB_DAT = 21
  7849. const m_R_ARM_GNU_VTENTRY = 100
  7850. const m_R_ARM_GNU_VTINHERIT = 101
  7851. const m_R_ARM_GOT32 = 26
  7852. const m_R_ARM_GOTOFF = 24
  7853. const m_R_ARM_GOTOFF12 = 98
  7854. const m_R_ARM_GOTPC = 25
  7855. const m_R_ARM_GOTRELAX = 99
  7856. const m_R_ARM_GOT_ABS = 95
  7857. const m_R_ARM_GOT_BREL12 = 97
  7858. const m_R_ARM_GOT_PREL = 96
  7859. const m_R_ARM_IRELATIVE = 160
  7860. const m_R_ARM_JUMP24 = 29
  7861. const m_R_ARM_JUMP_SLOT = 22
  7862. const m_R_ARM_LDC_PC_G0 = 67
  7863. const m_R_ARM_LDC_PC_G1 = 68
  7864. const m_R_ARM_LDC_PC_G2 = 69
  7865. const m_R_ARM_LDC_SB_G0 = 81
  7866. const m_R_ARM_LDC_SB_G1 = 82
  7867. const m_R_ARM_LDC_SB_G2 = 83
  7868. const m_R_ARM_LDRS_PC_G0 = 64
  7869. const m_R_ARM_LDRS_PC_G1 = 65
  7870. const m_R_ARM_LDRS_PC_G2 = 66
  7871. const m_R_ARM_LDRS_SB_G0 = 78
  7872. const m_R_ARM_LDRS_SB_G1 = 79
  7873. const m_R_ARM_LDRS_SB_G2 = 80
  7874. const m_R_ARM_LDR_PC_G1 = 62
  7875. const m_R_ARM_LDR_PC_G2 = 63
  7876. const m_R_ARM_LDR_SBREL_11_0 = 35
  7877. const m_R_ARM_LDR_SB_G0 = 75
  7878. const m_R_ARM_LDR_SB_G1 = 76
  7879. const m_R_ARM_LDR_SB_G2 = 77
  7880. const m_R_ARM_ME_TOO = 128
  7881. const m_R_ARM_MOVT_ABS = 44
  7882. const m_R_ARM_MOVT_BREL = 85
  7883. const m_R_ARM_MOVT_PREL = 46
  7884. const m_R_ARM_MOVW_ABS_NC = 43
  7885. const m_R_ARM_MOVW_BREL = 86
  7886. const m_R_ARM_MOVW_BREL_NC = 84
  7887. const m_R_ARM_MOVW_PREL_NC = 45
  7888. const m_R_ARM_NONE = 0
  7889. const m_R_ARM_NUM = 256
  7890. const m_R_ARM_PC13 = 4
  7891. const m_R_ARM_PC24 = 1
  7892. const m_R_ARM_PLT32 = 27
  7893. const m_R_ARM_PLT32_ABS = 94
  7894. const m_R_ARM_PREL31 = 42
  7895. const m_R_ARM_RABS22 = 253
  7896. const m_R_ARM_RBASE = 255
  7897. const m_R_ARM_REL32 = 3
  7898. const m_R_ARM_REL32_NOI = 56
  7899. const m_R_ARM_RELATIVE = 23
  7900. const m_R_ARM_RPC24 = 254
  7901. const m_R_ARM_RREL32 = 252
  7902. const m_R_ARM_RSBREL32 = 250
  7903. const m_R_ARM_RXPC25 = 249
  7904. const m_R_ARM_SBREL31 = 39
  7905. const m_R_ARM_SBREL32 = 9
  7906. const m_R_ARM_TARGET1 = 38
  7907. const m_R_ARM_TARGET2 = 41
  7908. const m_R_ARM_THM_ABS5 = 7
  7909. const m_R_ARM_THM_ALU_PREL_11_0 = 53
  7910. const m_R_ARM_THM_GOT_BREL12 = 131
  7911. const m_R_ARM_THM_JUMP19 = 51
  7912. const m_R_ARM_THM_JUMP24 = 30
  7913. const m_R_ARM_THM_JUMP6 = 52
  7914. const m_R_ARM_THM_MOVT_ABS = 48
  7915. const m_R_ARM_THM_MOVT_BREL = 88
  7916. const m_R_ARM_THM_MOVT_PREL = 50
  7917. const m_R_ARM_THM_MOVW_ABS_NC = 47
  7918. const m_R_ARM_THM_MOVW_BREL = 89
  7919. const m_R_ARM_THM_MOVW_BREL_NC = 87
  7920. const m_R_ARM_THM_MOVW_PREL_NC = 49
  7921. const m_R_ARM_THM_PC11 = 102
  7922. const m_R_ARM_THM_PC12 = 54
  7923. const m_R_ARM_THM_PC22 = 10
  7924. const m_R_ARM_THM_PC8 = 11
  7925. const m_R_ARM_THM_PC9 = 103
  7926. const m_R_ARM_THM_RPC22 = 251
  7927. const m_R_ARM_THM_SWI8 = 14
  7928. const m_R_ARM_THM_TLS_CALL = 93
  7929. const m_R_ARM_THM_TLS_DESCSEQ = 129
  7930. const m_R_ARM_THM_TLS_DESCSEQ16 = 129
  7931. const m_R_ARM_THM_TLS_DESCSEQ32 = 130
  7932. const m_R_ARM_THM_XPC22 = 16
  7933. const m_R_ARM_TLS_CALL = 91
  7934. const m_R_ARM_TLS_DESC = 13
  7935. const m_R_ARM_TLS_DESCSEQ = 92
  7936. const m_R_ARM_TLS_DTPMOD32 = 17
  7937. const m_R_ARM_TLS_DTPOFF32 = 18
  7938. const m_R_ARM_TLS_GD32 = 104
  7939. const m_R_ARM_TLS_GOTDESC = 90
  7940. const m_R_ARM_TLS_IE12GP = 111
  7941. const m_R_ARM_TLS_IE32 = 107
  7942. const m_R_ARM_TLS_LDM32 = 105
  7943. const m_R_ARM_TLS_LDO12 = 109
  7944. const m_R_ARM_TLS_LDO32 = 106
  7945. const m_R_ARM_TLS_LE12 = 110
  7946. const m_R_ARM_TLS_LE32 = 108
  7947. const m_R_ARM_TLS_TPOFF32 = 19
  7948. const m_R_ARM_V4BX = 40
  7949. const m_R_ARM_XPC25 = 15
  7950. const m_R_BPF_MAP_FD = 1
  7951. const m_R_BPF_NONE = 0
  7952. const m_R_CKCORE_ADDR32 = 1
  7953. const m_R_CKCORE_ADDRGOT = 17
  7954. const m_R_CKCORE_ADDRGOT_HI16 = 36
  7955. const m_R_CKCORE_ADDRGOT_LO16 = 37
  7956. const m_R_CKCORE_ADDRPLT = 18
  7957. const m_R_CKCORE_ADDRPLT_HI16 = 38
  7958. const m_R_CKCORE_ADDRPLT_LO16 = 39
  7959. const m_R_CKCORE_ADDR_HI16 = 24
  7960. const m_R_CKCORE_ADDR_LO16 = 25
  7961. const m_R_CKCORE_COPY = 10
  7962. const m_R_CKCORE_DOFFSET_IMM18 = 44
  7963. const m_R_CKCORE_DOFFSET_IMM18BY2 = 45
  7964. const m_R_CKCORE_DOFFSET_IMM18BY4 = 46
  7965. const m_R_CKCORE_DOFFSET_LO16 = 42
  7966. const m_R_CKCORE_GLOB_DAT = 11
  7967. const m_R_CKCORE_GOT12 = 30
  7968. const m_R_CKCORE_GOT32 = 15
  7969. const m_R_CKCORE_GOTOFF = 13
  7970. const m_R_CKCORE_GOTOFF_HI16 = 28
  7971. const m_R_CKCORE_GOTOFF_LO16 = 29
  7972. const m_R_CKCORE_GOTPC = 14
  7973. const m_R_CKCORE_GOTPC_HI16 = 26
  7974. const m_R_CKCORE_GOTPC_LO16 = 27
  7975. const m_R_CKCORE_GOT_HI16 = 31
  7976. const m_R_CKCORE_GOT_IMM18BY4 = 48
  7977. const m_R_CKCORE_GOT_LO16 = 32
  7978. const m_R_CKCORE_JUMP_SLOT = 12
  7979. const m_R_CKCORE_NONE = 0
  7980. const m_R_CKCORE_PCREL32 = 5
  7981. const m_R_CKCORE_PCRELIMM11BY2 = 3
  7982. const m_R_CKCORE_PCRELIMM8BY4 = 2
  7983. const m_R_CKCORE_PCRELJSR_IMM11BY2 = 6
  7984. const m_R_CKCORE_PCREL_IMM10BY2 = 22
  7985. const m_R_CKCORE_PCREL_IMM10BY4 = 23
  7986. const m_R_CKCORE_PCREL_IMM16BY2 = 20
  7987. const m_R_CKCORE_PCREL_IMM16BY4 = 21
  7988. const m_R_CKCORE_PCREL_IMM18BY2 = 43
  7989. const m_R_CKCORE_PCREL_IMM26BY2 = 19
  7990. const m_R_CKCORE_PCREL_IMM7BY4 = 50
  7991. const m_R_CKCORE_PCREL_JSR_IMM26BY2 = 40
  7992. const m_R_CKCORE_PLT12 = 33
  7993. const m_R_CKCORE_PLT32 = 16
  7994. const m_R_CKCORE_PLT_HI16 = 34
  7995. const m_R_CKCORE_PLT_IMM18BY4 = 49
  7996. const m_R_CKCORE_PLT_LO16 = 35
  7997. const m_R_CKCORE_RELATIVE = 9
  7998. const m_R_CKCORE_TLS_DTPMOD32 = 56
  7999. const m_R_CKCORE_TLS_DTPOFF32 = 57
  8000. const m_R_CKCORE_TLS_GD32 = 53
  8001. const m_R_CKCORE_TLS_IE32 = 52
  8002. const m_R_CKCORE_TLS_LDM32 = 54
  8003. const m_R_CKCORE_TLS_LDO32 = 55
  8004. const m_R_CKCORE_TLS_LE32 = 51
  8005. const m_R_CKCORE_TLS_TPOFF32 = 58
  8006. const m_R_CKCORE_TOFFSET_LO16 = 41
  8007. const m_R_CRIS_16 = 2
  8008. const m_R_CRIS_16_GOT = 13
  8009. const m_R_CRIS_16_GOTPLT = 15
  8010. const m_R_CRIS_16_PCREL = 5
  8011. const m_R_CRIS_32 = 3
  8012. const m_R_CRIS_32_GOT = 14
  8013. const m_R_CRIS_32_GOTPLT = 16
  8014. const m_R_CRIS_32_GOTREL = 17
  8015. const m_R_CRIS_32_PCREL = 6
  8016. const m_R_CRIS_32_PLT_GOTREL = 18
  8017. const m_R_CRIS_32_PLT_PCREL = 19
  8018. const m_R_CRIS_8 = 1
  8019. const m_R_CRIS_8_PCREL = 4
  8020. const m_R_CRIS_COPY = 9
  8021. const m_R_CRIS_GLOB_DAT = 10
  8022. const m_R_CRIS_GNU_VTENTRY = 8
  8023. const m_R_CRIS_GNU_VTINHERIT = 7
  8024. const m_R_CRIS_JUMP_SLOT = 11
  8025. const m_R_CRIS_NONE = 0
  8026. const m_R_CRIS_NUM = 20
  8027. const m_R_CRIS_RELATIVE = 12
  8028. const m_R_IA64_COPY = 0x84
  8029. const m_R_IA64_DIR32LSB = 0x25
  8030. const m_R_IA64_DIR32MSB = 0x24
  8031. const m_R_IA64_DIR64LSB = 0x27
  8032. const m_R_IA64_DIR64MSB = 0x26
  8033. const m_R_IA64_DTPMOD64LSB = 0xa7
  8034. const m_R_IA64_DTPMOD64MSB = 0xa6
  8035. const m_R_IA64_DTPREL14 = 0xb1
  8036. const m_R_IA64_DTPREL22 = 0xb2
  8037. const m_R_IA64_DTPREL32LSB = 0xb5
  8038. const m_R_IA64_DTPREL32MSB = 0xb4
  8039. const m_R_IA64_DTPREL64I = 0xb3
  8040. const m_R_IA64_DTPREL64LSB = 0xb7
  8041. const m_R_IA64_DTPREL64MSB = 0xb6
  8042. const m_R_IA64_FPTR32LSB = 0x45
  8043. const m_R_IA64_FPTR32MSB = 0x44
  8044. const m_R_IA64_FPTR64I = 0x43
  8045. const m_R_IA64_FPTR64LSB = 0x47
  8046. const m_R_IA64_FPTR64MSB = 0x46
  8047. const m_R_IA64_GPREL22 = 0x2a
  8048. const m_R_IA64_GPREL32LSB = 0x2d
  8049. const m_R_IA64_GPREL32MSB = 0x2c
  8050. const m_R_IA64_GPREL64I = 0x2b
  8051. const m_R_IA64_GPREL64LSB = 0x2f
  8052. const m_R_IA64_GPREL64MSB = 0x2e
  8053. const m_R_IA64_IMM14 = 0x21
  8054. const m_R_IA64_IMM22 = 0x22
  8055. const m_R_IA64_IMM64 = 0x23
  8056. const m_R_IA64_IPLTLSB = 0x81
  8057. const m_R_IA64_IPLTMSB = 0x80
  8058. const m_R_IA64_LDXMOV = 0x87
  8059. const m_R_IA64_LTOFF22 = 0x32
  8060. const m_R_IA64_LTOFF22X = 0x86
  8061. const m_R_IA64_LTOFF64I = 0x33
  8062. const m_R_IA64_LTOFF_DTPMOD22 = 0xaa
  8063. const m_R_IA64_LTOFF_DTPREL22 = 0xba
  8064. const m_R_IA64_LTOFF_FPTR22 = 0x52
  8065. const m_R_IA64_LTOFF_FPTR32LSB = 0x55
  8066. const m_R_IA64_LTOFF_FPTR32MSB = 0x54
  8067. const m_R_IA64_LTOFF_FPTR64I = 0x53
  8068. const m_R_IA64_LTOFF_FPTR64LSB = 0x57
  8069. const m_R_IA64_LTOFF_FPTR64MSB = 0x56
  8070. const m_R_IA64_LTOFF_TPREL22 = 0x9a
  8071. const m_R_IA64_LTV32LSB = 0x75
  8072. const m_R_IA64_LTV32MSB = 0x74
  8073. const m_R_IA64_LTV64LSB = 0x77
  8074. const m_R_IA64_LTV64MSB = 0x76
  8075. const m_R_IA64_NONE = 0x00
  8076. const m_R_IA64_PCREL21B = 0x49
  8077. const m_R_IA64_PCREL21BI = 0x79
  8078. const m_R_IA64_PCREL21F = 0x4b
  8079. const m_R_IA64_PCREL21M = 0x4a
  8080. const m_R_IA64_PCREL22 = 0x7a
  8081. const m_R_IA64_PCREL32LSB = 0x4d
  8082. const m_R_IA64_PCREL32MSB = 0x4c
  8083. const m_R_IA64_PCREL60B = 0x48
  8084. const m_R_IA64_PCREL64I = 0x7b
  8085. const m_R_IA64_PCREL64LSB = 0x4f
  8086. const m_R_IA64_PCREL64MSB = 0x4e
  8087. const m_R_IA64_PLTOFF22 = 0x3a
  8088. const m_R_IA64_PLTOFF64I = 0x3b
  8089. const m_R_IA64_PLTOFF64LSB = 0x3f
  8090. const m_R_IA64_PLTOFF64MSB = 0x3e
  8091. const m_R_IA64_REL32LSB = 0x6d
  8092. const m_R_IA64_REL32MSB = 0x6c
  8093. const m_R_IA64_REL64LSB = 0x6f
  8094. const m_R_IA64_REL64MSB = 0x6e
  8095. const m_R_IA64_SECREL32LSB = 0x65
  8096. const m_R_IA64_SECREL32MSB = 0x64
  8097. const m_R_IA64_SECREL64LSB = 0x67
  8098. const m_R_IA64_SECREL64MSB = 0x66
  8099. const m_R_IA64_SEGREL32LSB = 0x5d
  8100. const m_R_IA64_SEGREL32MSB = 0x5c
  8101. const m_R_IA64_SEGREL64LSB = 0x5f
  8102. const m_R_IA64_SEGREL64MSB = 0x5e
  8103. const m_R_IA64_SUB = 0x85
  8104. const m_R_IA64_TPREL14 = 0x91
  8105. const m_R_IA64_TPREL22 = 0x92
  8106. const m_R_IA64_TPREL64I = 0x93
  8107. const m_R_IA64_TPREL64LSB = 0x97
  8108. const m_R_IA64_TPREL64MSB = 0x96
  8109. const m_R_LARCH_32 = 1
  8110. const m_R_LARCH_32_PCREL = 99
  8111. const m_R_LARCH_64 = 2
  8112. const m_R_LARCH_ABS64_HI12 = 70
  8113. const m_R_LARCH_ABS64_LO20 = 69
  8114. const m_R_LARCH_ABS_HI20 = 67
  8115. const m_R_LARCH_ABS_LO12 = 68
  8116. const m_R_LARCH_ADD16 = 48
  8117. const m_R_LARCH_ADD24 = 49
  8118. const m_R_LARCH_ADD32 = 50
  8119. const m_R_LARCH_ADD64 = 51
  8120. const m_R_LARCH_ADD8 = 47
  8121. const m_R_LARCH_B16 = 64
  8122. const m_R_LARCH_B21 = 65
  8123. const m_R_LARCH_B26 = 66
  8124. const m_R_LARCH_COPY = 4
  8125. const m_R_LARCH_GNU_VTENTRY = 58
  8126. const m_R_LARCH_GNU_VTINHERIT = 57
  8127. const m_R_LARCH_GOT64_HI12 = 82
  8128. const m_R_LARCH_GOT64_LO20 = 81
  8129. const m_R_LARCH_GOT64_PC_HI12 = 78
  8130. const m_R_LARCH_GOT64_PC_LO20 = 77
  8131. const m_R_LARCH_GOT_HI20 = 79
  8132. const m_R_LARCH_GOT_LO12 = 80
  8133. const m_R_LARCH_GOT_PC_HI20 = 75
  8134. const m_R_LARCH_GOT_PC_LO12 = 76
  8135. const m_R_LARCH_IRELATIVE = 12
  8136. const m_R_LARCH_JUMP_SLOT = 5
  8137. const m_R_LARCH_MARK_LA = 20
  8138. const m_R_LARCH_MARK_PCREL = 21
  8139. const m_R_LARCH_NONE = 0
  8140. const m_R_LARCH_PCALA64_HI12 = 74
  8141. const m_R_LARCH_PCALA64_LO20 = 73
  8142. const m_R_LARCH_PCALA_HI20 = 71
  8143. const m_R_LARCH_PCALA_LO12 = 72
  8144. const m_R_LARCH_RELATIVE = 3
  8145. const m_R_LARCH_RELAX = 100
  8146. const m_R_LARCH_SOP_ADD = 35
  8147. const m_R_LARCH_SOP_AND = 36
  8148. const m_R_LARCH_SOP_ASSERT = 30
  8149. const m_R_LARCH_SOP_IF_ELSE = 37
  8150. const m_R_LARCH_SOP_NOT = 31
  8151. const m_R_LARCH_SOP_POP_32_S_0_10_10_16_S2 = 45
  8152. const m_R_LARCH_SOP_POP_32_S_0_5_10_16_S2 = 44
  8153. const m_R_LARCH_SOP_POP_32_S_10_12 = 40
  8154. const m_R_LARCH_SOP_POP_32_S_10_16 = 41
  8155. const m_R_LARCH_SOP_POP_32_S_10_16_S2 = 42
  8156. const m_R_LARCH_SOP_POP_32_S_10_5 = 38
  8157. const m_R_LARCH_SOP_POP_32_S_5_20 = 43
  8158. const m_R_LARCH_SOP_POP_32_U = 46
  8159. const m_R_LARCH_SOP_POP_32_U_10_12 = 39
  8160. const m_R_LARCH_SOP_PUSH_ABSOLUTE = 23
  8161. const m_R_LARCH_SOP_PUSH_DUP = 24
  8162. const m_R_LARCH_SOP_PUSH_GPREL = 25
  8163. const m_R_LARCH_SOP_PUSH_PCREL = 22
  8164. const m_R_LARCH_SOP_PUSH_PLT_PCREL = 29
  8165. const m_R_LARCH_SOP_PUSH_TLS_GD = 28
  8166. const m_R_LARCH_SOP_PUSH_TLS_GOT = 27
  8167. const m_R_LARCH_SOP_PUSH_TLS_TPREL = 26
  8168. const m_R_LARCH_SOP_SL = 33
  8169. const m_R_LARCH_SOP_SR = 34
  8170. const m_R_LARCH_SOP_SUB = 32
  8171. const m_R_LARCH_SUB16 = 53
  8172. const m_R_LARCH_SUB24 = 54
  8173. const m_R_LARCH_SUB32 = 55
  8174. const m_R_LARCH_SUB64 = 56
  8175. const m_R_LARCH_SUB8 = 52
  8176. const m_R_LARCH_TLS_DTPMOD32 = 6
  8177. const m_R_LARCH_TLS_DTPMOD64 = 7
  8178. const m_R_LARCH_TLS_DTPREL32 = 8
  8179. const m_R_LARCH_TLS_DTPREL64 = 9
  8180. const m_R_LARCH_TLS_GD_HI20 = 98
  8181. const m_R_LARCH_TLS_GD_PC_HI20 = 97
  8182. const m_R_LARCH_TLS_IE64_HI12 = 94
  8183. const m_R_LARCH_TLS_IE64_LO20 = 93
  8184. const m_R_LARCH_TLS_IE64_PC_HI12 = 90
  8185. const m_R_LARCH_TLS_IE64_PC_LO20 = 89
  8186. const m_R_LARCH_TLS_IE_HI20 = 91
  8187. const m_R_LARCH_TLS_IE_LO12 = 92
  8188. const m_R_LARCH_TLS_IE_PC_HI20 = 87
  8189. const m_R_LARCH_TLS_IE_PC_LO12 = 88
  8190. const m_R_LARCH_TLS_LD_HI20 = 96
  8191. const m_R_LARCH_TLS_LD_PC_HI20 = 95
  8192. const m_R_LARCH_TLS_LE64_HI12 = 86
  8193. const m_R_LARCH_TLS_LE64_LO20 = 85
  8194. const m_R_LARCH_TLS_LE_HI20 = 83
  8195. const m_R_LARCH_TLS_LE_LO12 = 84
  8196. const m_R_LARCH_TLS_TPREL32 = 10
  8197. const m_R_LARCH_TLS_TPREL64 = 11
  8198. const m_R_M32R_10_PCREL = 4
  8199. const m_R_M32R_10_PCREL_RELA = 36
  8200. const m_R_M32R_16 = 1
  8201. const m_R_M32R_16_RELA = 33
  8202. const m_R_M32R_18_PCREL = 5
  8203. const m_R_M32R_18_PCREL_RELA = 37
  8204. const m_R_M32R_24 = 3
  8205. const m_R_M32R_24_RELA = 35
  8206. const m_R_M32R_26_PCREL = 6
  8207. const m_R_M32R_26_PCREL_RELA = 38
  8208. const m_R_M32R_26_PLTREL = 49
  8209. const m_R_M32R_32 = 2
  8210. const m_R_M32R_32_RELA = 34
  8211. const m_R_M32R_COPY = 50
  8212. const m_R_M32R_GLOB_DAT = 51
  8213. const m_R_M32R_GNU_VTENTRY = 12
  8214. const m_R_M32R_GNU_VTINHERIT = 11
  8215. const m_R_M32R_GOT16_HI_SLO = 57
  8216. const m_R_M32R_GOT16_HI_ULO = 56
  8217. const m_R_M32R_GOT16_LO = 58
  8218. const m_R_M32R_GOT24 = 48
  8219. const m_R_M32R_GOTOFF = 54
  8220. const m_R_M32R_GOTOFF_HI_SLO = 63
  8221. const m_R_M32R_GOTOFF_HI_ULO = 62
  8222. const m_R_M32R_GOTOFF_LO = 64
  8223. const m_R_M32R_GOTPC24 = 55
  8224. const m_R_M32R_GOTPC_HI_SLO = 60
  8225. const m_R_M32R_GOTPC_HI_ULO = 59
  8226. const m_R_M32R_GOTPC_LO = 61
  8227. const m_R_M32R_HI16_SLO = 8
  8228. const m_R_M32R_HI16_SLO_RELA = 40
  8229. const m_R_M32R_HI16_ULO = 7
  8230. const m_R_M32R_HI16_ULO_RELA = 39
  8231. const m_R_M32R_JMP_SLOT = 52
  8232. const m_R_M32R_LO16 = 9
  8233. const m_R_M32R_LO16_RELA = 41
  8234. const m_R_M32R_NONE = 0
  8235. const m_R_M32R_NUM = 256
  8236. const m_R_M32R_REL32 = 45
  8237. const m_R_M32R_RELATIVE = 53
  8238. const m_R_M32R_RELA_GNU_VTENTRY = 44
  8239. const m_R_M32R_RELA_GNU_VTINHERIT = 43
  8240. const m_R_M32R_SDA16 = 10
  8241. const m_R_M32R_SDA16_RELA = 42
  8242. const m_R_MICROBLAZE_32 = 1
  8243. const m_R_MICROBLAZE_32_LO = 6
  8244. const m_R_MICROBLAZE_32_PCREL = 2
  8245. const m_R_MICROBLAZE_32_PCREL_LO = 4
  8246. const m_R_MICROBLAZE_32_SYM_OP_SYM = 10
  8247. const m_R_MICROBLAZE_64 = 5
  8248. const m_R_MICROBLAZE_64_NONE = 9
  8249. const m_R_MICROBLAZE_64_PCREL = 3
  8250. const m_R_MICROBLAZE_COPY = 21
  8251. const m_R_MICROBLAZE_GLOB_DAT = 18
  8252. const m_R_MICROBLAZE_GNU_VTENTRY = 12
  8253. const m_R_MICROBLAZE_GNU_VTINHERIT = 11
  8254. const m_R_MICROBLAZE_GOTOFF_32 = 20
  8255. const m_R_MICROBLAZE_GOTOFF_64 = 19
  8256. const m_R_MICROBLAZE_GOTPC_64 = 13
  8257. const m_R_MICROBLAZE_GOT_64 = 14
  8258. const m_R_MICROBLAZE_JUMP_SLOT = 17
  8259. const m_R_MICROBLAZE_NONE = 0
  8260. const m_R_MICROBLAZE_PLT_64 = 15
  8261. const m_R_MICROBLAZE_REL = 16
  8262. const m_R_MICROBLAZE_SRO32 = 7
  8263. const m_R_MICROBLAZE_SRW32 = 8
  8264. const m_R_MICROBLAZE_TLS = 22
  8265. const m_R_MICROBLAZE_TLSDTPMOD32 = 25
  8266. const m_R_MICROBLAZE_TLSDTPREL32 = 26
  8267. const m_R_MICROBLAZE_TLSDTPREL64 = 27
  8268. const m_R_MICROBLAZE_TLSGD = 23
  8269. const m_R_MICROBLAZE_TLSGOTTPREL32 = 28
  8270. const m_R_MICROBLAZE_TLSLD = 24
  8271. const m_R_MICROBLAZE_TLSTPREL32 = 29
  8272. const m_R_MIPS_16 = 1
  8273. const m_R_MIPS_26 = 4
  8274. const m_R_MIPS_32 = 2
  8275. const m_R_MIPS_64 = 18
  8276. const m_R_MIPS_ADD_IMMEDIATE = 34
  8277. const m_R_MIPS_CALL16 = 11
  8278. const m_R_MIPS_CALL_HI16 = 30
  8279. const m_R_MIPS_CALL_LO16 = 31
  8280. const m_R_MIPS_COPY = 126
  8281. const m_R_MIPS_DELETE = 27
  8282. const m_R_MIPS_GLOB_DAT = 51
  8283. const m_R_MIPS_GOT16 = 9
  8284. const m_R_MIPS_GOT_DISP = 19
  8285. const m_R_MIPS_GOT_HI16 = 22
  8286. const m_R_MIPS_GOT_LO16 = 23
  8287. const m_R_MIPS_GOT_OFST = 21
  8288. const m_R_MIPS_GOT_PAGE = 20
  8289. const m_R_MIPS_GPREL16 = 7
  8290. const m_R_MIPS_GPREL32 = 12
  8291. const m_R_MIPS_HI16 = 5
  8292. const m_R_MIPS_HIGHER = 28
  8293. const m_R_MIPS_HIGHEST = 29
  8294. const m_R_MIPS_INSERT_A = 25
  8295. const m_R_MIPS_INSERT_B = 26
  8296. const m_R_MIPS_JALR = 37
  8297. const m_R_MIPS_JUMP_SLOT = 127
  8298. const m_R_MIPS_LITERAL = 8
  8299. const m_R_MIPS_LO16 = 6
  8300. const m_R_MIPS_NONE = 0
  8301. const m_R_MIPS_NUM = 128
  8302. const m_R_MIPS_PC16 = 10
  8303. const m_R_MIPS_PJUMP = 35
  8304. const m_R_MIPS_REL16 = 33
  8305. const m_R_MIPS_REL32 = 3
  8306. const m_R_MIPS_RELGOT = 36
  8307. const m_R_MIPS_SCN_DISP = 32
  8308. const m_R_MIPS_SHIFT5 = 16
  8309. const m_R_MIPS_SHIFT6 = 17
  8310. const m_R_MIPS_SUB = 24
  8311. const m_R_MIPS_TLS_DTPMOD32 = 38
  8312. const m_R_MIPS_TLS_DTPMOD64 = 40
  8313. const m_R_MIPS_TLS_DTPREL32 = 39
  8314. const m_R_MIPS_TLS_DTPREL64 = 41
  8315. const m_R_MIPS_TLS_DTPREL_HI16 = 44
  8316. const m_R_MIPS_TLS_DTPREL_LO16 = 45
  8317. const m_R_MIPS_TLS_GD = 42
  8318. const m_R_MIPS_TLS_GOTTPREL = 46
  8319. const m_R_MIPS_TLS_LDM = 43
  8320. const m_R_MIPS_TLS_TPREL32 = 47
  8321. const m_R_MIPS_TLS_TPREL64 = 48
  8322. const m_R_MIPS_TLS_TPREL_HI16 = 49
  8323. const m_R_MIPS_TLS_TPREL_LO16 = 50
  8324. const m_R_MN10300_16 = 2
  8325. const m_R_MN10300_24 = 9
  8326. const m_R_MN10300_32 = 1
  8327. const m_R_MN10300_8 = 3
  8328. const m_R_MN10300_COPY = 20
  8329. const m_R_MN10300_GLOB_DAT = 21
  8330. const m_R_MN10300_GNU_VTENTRY = 8
  8331. const m_R_MN10300_GNU_VTINHERIT = 7
  8332. const m_R_MN10300_GOT16 = 19
  8333. const m_R_MN10300_GOT24 = 18
  8334. const m_R_MN10300_GOT32 = 17
  8335. const m_R_MN10300_GOTOFF16 = 14
  8336. const m_R_MN10300_GOTOFF24 = 13
  8337. const m_R_MN10300_GOTOFF32 = 12
  8338. const m_R_MN10300_GOTPC16 = 11
  8339. const m_R_MN10300_GOTPC32 = 10
  8340. const m_R_MN10300_JMP_SLOT = 22
  8341. const m_R_MN10300_NONE = 0
  8342. const m_R_MN10300_NUM = 24
  8343. const m_R_MN10300_PCREL16 = 5
  8344. const m_R_MN10300_PCREL32 = 4
  8345. const m_R_MN10300_PCREL8 = 6
  8346. const m_R_MN10300_PLT16 = 16
  8347. const m_R_MN10300_PLT32 = 15
  8348. const m_R_MN10300_RELATIVE = 23
  8349. const m_R_NIOS2_ALIGN = 21
  8350. const m_R_NIOS2_BFD_RELOC_16 = 13
  8351. const m_R_NIOS2_BFD_RELOC_32 = 12
  8352. const m_R_NIOS2_BFD_RELOC_8 = 14
  8353. const m_R_NIOS2_CACHE_OPX = 6
  8354. const m_R_NIOS2_CALL16 = 23
  8355. const m_R_NIOS2_CALL26 = 4
  8356. const m_R_NIOS2_CALL26_NOAT = 41
  8357. const m_R_NIOS2_CALLR = 20
  8358. const m_R_NIOS2_CALL_HA = 45
  8359. const m_R_NIOS2_CALL_LO = 44
  8360. const m_R_NIOS2_CJMP = 19
  8361. const m_R_NIOS2_COPY = 36
  8362. const m_R_NIOS2_GLOB_DAT = 37
  8363. const m_R_NIOS2_GNU_VTENTRY = 17
  8364. const m_R_NIOS2_GNU_VTINHERIT = 16
  8365. const m_R_NIOS2_GOT16 = 22
  8366. const m_R_NIOS2_GOTOFF = 40
  8367. const m_R_NIOS2_GOTOFF_HA = 25
  8368. const m_R_NIOS2_GOTOFF_LO = 24
  8369. const m_R_NIOS2_GOT_HA = 43
  8370. const m_R_NIOS2_GOT_LO = 42
  8371. const m_R_NIOS2_GPREL = 15
  8372. const m_R_NIOS2_HI16 = 9
  8373. const m_R_NIOS2_HIADJ16 = 11
  8374. const m_R_NIOS2_IMM5 = 5
  8375. const m_R_NIOS2_IMM6 = 7
  8376. const m_R_NIOS2_IMM8 = 8
  8377. const m_R_NIOS2_JUMP_SLOT = 38
  8378. const m_R_NIOS2_LO16 = 10
  8379. const m_R_NIOS2_NONE = 0
  8380. const m_R_NIOS2_PCREL16 = 3
  8381. const m_R_NIOS2_PCREL_HA = 27
  8382. const m_R_NIOS2_PCREL_LO = 26
  8383. const m_R_NIOS2_RELATIVE = 39
  8384. const m_R_NIOS2_S16 = 1
  8385. const m_R_NIOS2_TLS_DTPMOD = 33
  8386. const m_R_NIOS2_TLS_DTPREL = 34
  8387. const m_R_NIOS2_TLS_GD16 = 28
  8388. const m_R_NIOS2_TLS_IE16 = 31
  8389. const m_R_NIOS2_TLS_LDM16 = 29
  8390. const m_R_NIOS2_TLS_LDO16 = 30
  8391. const m_R_NIOS2_TLS_LE16 = 32
  8392. const m_R_NIOS2_TLS_TPREL = 35
  8393. const m_R_NIOS2_U16 = 2
  8394. const m_R_NIOS2_UJMP = 18
  8395. const m_R_OR1K_16 = 2
  8396. const m_R_OR1K_16_PCREL = 10
  8397. const m_R_OR1K_32 = 1
  8398. const m_R_OR1K_32_PCREL = 9
  8399. const m_R_OR1K_8 = 3
  8400. const m_R_OR1K_8_PCREL = 11
  8401. const m_R_OR1K_COPY = 18
  8402. const m_R_OR1K_GLOB_DAT = 19
  8403. const m_R_OR1K_GNU_VTENTRY = 7
  8404. const m_R_OR1K_GNU_VTINHERIT = 8
  8405. const m_R_OR1K_GOT16 = 14
  8406. const m_R_OR1K_GOTOFF_HI16 = 16
  8407. const m_R_OR1K_GOTOFF_LO16 = 17
  8408. const m_R_OR1K_GOTPC_HI16 = 12
  8409. const m_R_OR1K_GOTPC_LO16 = 13
  8410. const m_R_OR1K_HI_16_IN_INSN = 5
  8411. const m_R_OR1K_INSN_REL_26 = 6
  8412. const m_R_OR1K_JMP_SLOT = 20
  8413. const m_R_OR1K_LO_16_IN_INSN = 4
  8414. const m_R_OR1K_NONE = 0
  8415. const m_R_OR1K_PLT26 = 15
  8416. const m_R_OR1K_RELATIVE = 21
  8417. const m_R_OR1K_TLS_DTPMOD = 34
  8418. const m_R_OR1K_TLS_DTPOFF = 33
  8419. const m_R_OR1K_TLS_GD_HI16 = 22
  8420. const m_R_OR1K_TLS_GD_LO16 = 23
  8421. const m_R_OR1K_TLS_IE_HI16 = 28
  8422. const m_R_OR1K_TLS_IE_LO16 = 29
  8423. const m_R_OR1K_TLS_LDM_HI16 = 24
  8424. const m_R_OR1K_TLS_LDM_LO16 = 25
  8425. const m_R_OR1K_TLS_LDO_HI16 = 26
  8426. const m_R_OR1K_TLS_LDO_LO16 = 27
  8427. const m_R_OR1K_TLS_LE_HI16 = 30
  8428. const m_R_OR1K_TLS_LE_LO16 = 31
  8429. const m_R_OR1K_TLS_TPOFF = 32
  8430. const m_R_PARISC_COPY = 128
  8431. const m_R_PARISC_DIR14DR = 84
  8432. const m_R_PARISC_DIR14R = 6
  8433. const m_R_PARISC_DIR14WR = 83
  8434. const m_R_PARISC_DIR16DF = 87
  8435. const m_R_PARISC_DIR16F = 85
  8436. const m_R_PARISC_DIR16WF = 86
  8437. const m_R_PARISC_DIR17F = 4
  8438. const m_R_PARISC_DIR17R = 3
  8439. const m_R_PARISC_DIR21L = 2
  8440. const m_R_PARISC_DIR32 = 1
  8441. const m_R_PARISC_DIR64 = 80
  8442. const m_R_PARISC_DPREL14R = 22
  8443. const m_R_PARISC_DPREL21L = 18
  8444. const m_R_PARISC_EPLT = 130
  8445. const m_R_PARISC_FPTR64 = 64
  8446. const m_R_PARISC_GNU_VTENTRY = 232
  8447. const m_R_PARISC_GNU_VTINHERIT = 233
  8448. const m_R_PARISC_GPREL14DR = 92
  8449. const m_R_PARISC_GPREL14R = 30
  8450. const m_R_PARISC_GPREL14WR = 91
  8451. const m_R_PARISC_GPREL16DF = 95
  8452. const m_R_PARISC_GPREL16F = 93
  8453. const m_R_PARISC_GPREL16WF = 94
  8454. const m_R_PARISC_GPREL21L = 26
  8455. const m_R_PARISC_GPREL64 = 88
  8456. const m_R_PARISC_HIRESERVE = 255
  8457. const m_R_PARISC_IPLT = 129
  8458. const m_R_PARISC_LORESERVE = 128
  8459. const m_R_PARISC_LTOFF14DR = 100
  8460. const m_R_PARISC_LTOFF14R = 38
  8461. const m_R_PARISC_LTOFF14WR = 99
  8462. const m_R_PARISC_LTOFF16DF = 103
  8463. const m_R_PARISC_LTOFF16F = 101
  8464. const m_R_PARISC_LTOFF16WF = 102
  8465. const m_R_PARISC_LTOFF21L = 34
  8466. const m_R_PARISC_LTOFF64 = 96
  8467. const m_R_PARISC_LTOFF_FPTR14DR = 124
  8468. const m_R_PARISC_LTOFF_FPTR14R = 62
  8469. const m_R_PARISC_LTOFF_FPTR14WR = 123
  8470. const m_R_PARISC_LTOFF_FPTR16DF = 127
  8471. const m_R_PARISC_LTOFF_FPTR16F = 125
  8472. const m_R_PARISC_LTOFF_FPTR16WF = 126
  8473. const m_R_PARISC_LTOFF_FPTR21L = 58
  8474. const m_R_PARISC_LTOFF_FPTR32 = 57
  8475. const m_R_PARISC_LTOFF_FPTR64 = 120
  8476. const m_R_PARISC_LTOFF_TP14DR = 228
  8477. const m_R_PARISC_LTOFF_TP14F = 167
  8478. const m_R_PARISC_LTOFF_TP14R = 166
  8479. const m_R_PARISC_LTOFF_TP14WR = 227
  8480. const m_R_PARISC_LTOFF_TP16DF = 231
  8481. const m_R_PARISC_LTOFF_TP16F = 229
  8482. const m_R_PARISC_LTOFF_TP16WF = 230
  8483. const m_R_PARISC_LTOFF_TP21L = 162
  8484. const m_R_PARISC_LTOFF_TP64 = 224
  8485. const m_R_PARISC_NONE = 0
  8486. const m_R_PARISC_PCREL14DR = 76
  8487. const m_R_PARISC_PCREL14R = 14
  8488. const m_R_PARISC_PCREL14WR = 75
  8489. const m_R_PARISC_PCREL16DF = 79
  8490. const m_R_PARISC_PCREL16F = 77
  8491. const m_R_PARISC_PCREL16WF = 78
  8492. const m_R_PARISC_PCREL17F = 12
  8493. const m_R_PARISC_PCREL17R = 11
  8494. const m_R_PARISC_PCREL21L = 10
  8495. const m_R_PARISC_PCREL22F = 74
  8496. const m_R_PARISC_PCREL32 = 9
  8497. const m_R_PARISC_PCREL64 = 72
  8498. const m_R_PARISC_PLABEL14R = 70
  8499. const m_R_PARISC_PLABEL21L = 66
  8500. const m_R_PARISC_PLABEL32 = 65
  8501. const m_R_PARISC_PLTOFF14DR = 116
  8502. const m_R_PARISC_PLTOFF14R = 54
  8503. const m_R_PARISC_PLTOFF14WR = 115
  8504. const m_R_PARISC_PLTOFF16DF = 119
  8505. const m_R_PARISC_PLTOFF16F = 117
  8506. const m_R_PARISC_PLTOFF16WF = 118
  8507. const m_R_PARISC_PLTOFF21L = 50
  8508. const m_R_PARISC_SECREL32 = 41
  8509. const m_R_PARISC_SECREL64 = 104
  8510. const m_R_PARISC_SEGBASE = 48
  8511. const m_R_PARISC_SEGREL32 = 49
  8512. const m_R_PARISC_SEGREL64 = 112
  8513. const m_R_PARISC_TLS_DTPMOD32 = 242
  8514. const m_R_PARISC_TLS_DTPMOD64 = 243
  8515. const m_R_PARISC_TLS_DTPOFF32 = 244
  8516. const m_R_PARISC_TLS_DTPOFF64 = 245
  8517. const m_R_PARISC_TLS_GD14R = 235
  8518. const m_R_PARISC_TLS_GD21L = 234
  8519. const m_R_PARISC_TLS_GDCALL = 236
  8520. const m_R_PARISC_TLS_IE14R = "R_PARISC_LTOFF_TP14R"
  8521. const m_R_PARISC_TLS_IE21L = "R_PARISC_LTOFF_TP21L"
  8522. const m_R_PARISC_TLS_LDM14R = 238
  8523. const m_R_PARISC_TLS_LDM21L = 237
  8524. const m_R_PARISC_TLS_LDMCALL = 239
  8525. const m_R_PARISC_TLS_LDO14R = 241
  8526. const m_R_PARISC_TLS_LDO21L = 240
  8527. const m_R_PARISC_TLS_LE14R = "R_PARISC_TPREL14R"
  8528. const m_R_PARISC_TLS_LE21L = "R_PARISC_TPREL21L"
  8529. const m_R_PARISC_TLS_TPREL32 = "R_PARISC_TPREL32"
  8530. const m_R_PARISC_TLS_TPREL64 = "R_PARISC_TPREL64"
  8531. const m_R_PARISC_TPREL14DR = 220
  8532. const m_R_PARISC_TPREL14R = 158
  8533. const m_R_PARISC_TPREL14WR = 219
  8534. const m_R_PARISC_TPREL16DF = 223
  8535. const m_R_PARISC_TPREL16F = 221
  8536. const m_R_PARISC_TPREL16WF = 222
  8537. const m_R_PARISC_TPREL21L = 154
  8538. const m_R_PARISC_TPREL32 = 153
  8539. const m_R_PARISC_TPREL64 = 216
  8540. const m_R_PPC64_ADDR14 = "R_PPC_ADDR14"
  8541. const m_R_PPC64_ADDR14_BRNTAKEN = "R_PPC_ADDR14_BRNTAKEN"
  8542. const m_R_PPC64_ADDR14_BRTAKEN = "R_PPC_ADDR14_BRTAKEN"
  8543. const m_R_PPC64_ADDR16 = "R_PPC_ADDR16"
  8544. const m_R_PPC64_ADDR16_DS = 56
  8545. const m_R_PPC64_ADDR16_HA = "R_PPC_ADDR16_HA"
  8546. const m_R_PPC64_ADDR16_HI = "R_PPC_ADDR16_HI"
  8547. const m_R_PPC64_ADDR16_HIGH = 110
  8548. const m_R_PPC64_ADDR16_HIGHA = 111
  8549. const m_R_PPC64_ADDR16_HIGHER = 39
  8550. const m_R_PPC64_ADDR16_HIGHERA = 40
  8551. const m_R_PPC64_ADDR16_HIGHEST = 41
  8552. const m_R_PPC64_ADDR16_HIGHESTA = 42
  8553. const m_R_PPC64_ADDR16_LO = "R_PPC_ADDR16_LO"
  8554. const m_R_PPC64_ADDR16_LO_DS = 57
  8555. const m_R_PPC64_ADDR24 = "R_PPC_ADDR24"
  8556. const m_R_PPC64_ADDR30 = 37
  8557. const m_R_PPC64_ADDR32 = "R_PPC_ADDR32"
  8558. const m_R_PPC64_ADDR64 = 38
  8559. const m_R_PPC64_COPY = "R_PPC_COPY"
  8560. const m_R_PPC64_DTPMOD64 = 68
  8561. const m_R_PPC64_DTPREL16 = 74
  8562. const m_R_PPC64_DTPREL16_DS = 101
  8563. const m_R_PPC64_DTPREL16_HA = 77
  8564. const m_R_PPC64_DTPREL16_HI = 76
  8565. const m_R_PPC64_DTPREL16_HIGH = 114
  8566. const m_R_PPC64_DTPREL16_HIGHA = 115
  8567. const m_R_PPC64_DTPREL16_HIGHER = 103
  8568. const m_R_PPC64_DTPREL16_HIGHERA = 104
  8569. const m_R_PPC64_DTPREL16_HIGHEST = 105
  8570. const m_R_PPC64_DTPREL16_HIGHESTA = 106
  8571. const m_R_PPC64_DTPREL16_LO = 75
  8572. const m_R_PPC64_DTPREL16_LO_DS = 102
  8573. const m_R_PPC64_DTPREL64 = 78
  8574. const m_R_PPC64_GLOB_DAT = "R_PPC_GLOB_DAT"
  8575. const m_R_PPC64_GOT16 = "R_PPC_GOT16"
  8576. const m_R_PPC64_GOT16_DS = 58
  8577. const m_R_PPC64_GOT16_HA = "R_PPC_GOT16_HA"
  8578. const m_R_PPC64_GOT16_HI = "R_PPC_GOT16_HI"
  8579. const m_R_PPC64_GOT16_LO = "R_PPC_GOT16_LO"
  8580. const m_R_PPC64_GOT16_LO_DS = 59
  8581. const m_R_PPC64_GOT_DTPREL16_DS = 91
  8582. const m_R_PPC64_GOT_DTPREL16_HA = 94
  8583. const m_R_PPC64_GOT_DTPREL16_HI = 93
  8584. const m_R_PPC64_GOT_DTPREL16_LO_DS = 92
  8585. const m_R_PPC64_GOT_TLSGD16 = 79
  8586. const m_R_PPC64_GOT_TLSGD16_HA = 82
  8587. const m_R_PPC64_GOT_TLSGD16_HI = 81
  8588. const m_R_PPC64_GOT_TLSGD16_LO = 80
  8589. const m_R_PPC64_GOT_TLSLD16 = 83
  8590. const m_R_PPC64_GOT_TLSLD16_HA = 86
  8591. const m_R_PPC64_GOT_TLSLD16_HI = 85
  8592. const m_R_PPC64_GOT_TLSLD16_LO = 84
  8593. const m_R_PPC64_GOT_TPREL16_DS = 87
  8594. const m_R_PPC64_GOT_TPREL16_HA = 90
  8595. const m_R_PPC64_GOT_TPREL16_HI = 89
  8596. const m_R_PPC64_GOT_TPREL16_LO_DS = 88
  8597. const m_R_PPC64_IRELATIVE = 248
  8598. const m_R_PPC64_JMP_IREL = 247
  8599. const m_R_PPC64_JMP_SLOT = "R_PPC_JMP_SLOT"
  8600. const m_R_PPC64_NONE = "R_PPC_NONE"
  8601. const m_R_PPC64_PLT16_HA = "R_PPC_PLT16_HA"
  8602. const m_R_PPC64_PLT16_HI = "R_PPC_PLT16_HI"
  8603. const m_R_PPC64_PLT16_LO = "R_PPC_PLT16_LO"
  8604. const m_R_PPC64_PLT16_LO_DS = 60
  8605. const m_R_PPC64_PLT32 = "R_PPC_PLT32"
  8606. const m_R_PPC64_PLT64 = 45
  8607. const m_R_PPC64_PLTGOT16 = 52
  8608. const m_R_PPC64_PLTGOT16_DS = 65
  8609. const m_R_PPC64_PLTGOT16_HA = 55
  8610. const m_R_PPC64_PLTGOT16_HI = 54
  8611. const m_R_PPC64_PLTGOT16_LO = 53
  8612. const m_R_PPC64_PLTGOT16_LO_DS = 66
  8613. const m_R_PPC64_PLTREL32 = "R_PPC_PLTREL32"
  8614. const m_R_PPC64_PLTREL64 = 46
  8615. const m_R_PPC64_REL14 = "R_PPC_REL14"
  8616. const m_R_PPC64_REL14_BRNTAKEN = "R_PPC_REL14_BRNTAKEN"
  8617. const m_R_PPC64_REL14_BRTAKEN = "R_PPC_REL14_BRTAKEN"
  8618. const m_R_PPC64_REL16 = 249
  8619. const m_R_PPC64_REL16_HA = 252
  8620. const m_R_PPC64_REL16_HI = 251
  8621. const m_R_PPC64_REL16_LO = 250
  8622. const m_R_PPC64_REL24 = "R_PPC_REL24"
  8623. const m_R_PPC64_REL32 = "R_PPC_REL32"
  8624. const m_R_PPC64_REL64 = 44
  8625. const m_R_PPC64_RELATIVE = "R_PPC_RELATIVE"
  8626. const m_R_PPC64_SECTOFF = "R_PPC_SECTOFF"
  8627. const m_R_PPC64_SECTOFF_DS = 61
  8628. const m_R_PPC64_SECTOFF_HA = "R_PPC_SECTOFF_HA"
  8629. const m_R_PPC64_SECTOFF_HI = "R_PPC_SECTOFF_HI"
  8630. const m_R_PPC64_SECTOFF_LO = "R_PPC_SECTOFF_LO"
  8631. const m_R_PPC64_SECTOFF_LO_DS = 62
  8632. const m_R_PPC64_TLS = 67
  8633. const m_R_PPC64_TLSGD = 107
  8634. const m_R_PPC64_TLSLD = 108
  8635. const m_R_PPC64_TOC = 51
  8636. const m_R_PPC64_TOC16 = 47
  8637. const m_R_PPC64_TOC16_DS = 63
  8638. const m_R_PPC64_TOC16_HA = 50
  8639. const m_R_PPC64_TOC16_HI = 49
  8640. const m_R_PPC64_TOC16_LO = 48
  8641. const m_R_PPC64_TOC16_LO_DS = 64
  8642. const m_R_PPC64_TOCSAVE = 109
  8643. const m_R_PPC64_TPREL16 = 69
  8644. const m_R_PPC64_TPREL16_DS = 95
  8645. const m_R_PPC64_TPREL16_HA = 72
  8646. const m_R_PPC64_TPREL16_HI = 71
  8647. const m_R_PPC64_TPREL16_HIGH = 112
  8648. const m_R_PPC64_TPREL16_HIGHA = 113
  8649. const m_R_PPC64_TPREL16_HIGHER = 97
  8650. const m_R_PPC64_TPREL16_HIGHERA = 98
  8651. const m_R_PPC64_TPREL16_HIGHEST = 99
  8652. const m_R_PPC64_TPREL16_HIGHESTA = 100
  8653. const m_R_PPC64_TPREL16_LO = 70
  8654. const m_R_PPC64_TPREL16_LO_DS = 96
  8655. const m_R_PPC64_TPREL64 = 73
  8656. const m_R_PPC64_UADDR16 = "R_PPC_UADDR16"
  8657. const m_R_PPC64_UADDR32 = "R_PPC_UADDR32"
  8658. const m_R_PPC64_UADDR64 = 43
  8659. const m_R_PPC_ADDR14 = 7
  8660. const m_R_PPC_ADDR14_BRNTAKEN = 9
  8661. const m_R_PPC_ADDR14_BRTAKEN = 8
  8662. const m_R_PPC_ADDR16 = 3
  8663. const m_R_PPC_ADDR16_HA = 6
  8664. const m_R_PPC_ADDR16_HI = 5
  8665. const m_R_PPC_ADDR16_LO = 4
  8666. const m_R_PPC_ADDR24 = 2
  8667. const m_R_PPC_ADDR32 = 1
  8668. const m_R_PPC_COPY = 19
  8669. const m_R_PPC_DIAB_RELSDA_HA = 185
  8670. const m_R_PPC_DIAB_RELSDA_HI = 184
  8671. const m_R_PPC_DIAB_RELSDA_LO = 183
  8672. const m_R_PPC_DIAB_SDA21_HA = 182
  8673. const m_R_PPC_DIAB_SDA21_HI = 181
  8674. const m_R_PPC_DIAB_SDA21_LO = 180
  8675. const m_R_PPC_DTPMOD32 = 68
  8676. const m_R_PPC_DTPREL16 = 74
  8677. const m_R_PPC_DTPREL16_HA = 77
  8678. const m_R_PPC_DTPREL16_HI = 76
  8679. const m_R_PPC_DTPREL16_LO = 75
  8680. const m_R_PPC_DTPREL32 = 78
  8681. const m_R_PPC_EMB_BIT_FLD = 115
  8682. const m_R_PPC_EMB_MRKREF = 110
  8683. const m_R_PPC_EMB_NADDR16 = 102
  8684. const m_R_PPC_EMB_NADDR16_HA = 105
  8685. const m_R_PPC_EMB_NADDR16_HI = 104
  8686. const m_R_PPC_EMB_NADDR16_LO = 103
  8687. const m_R_PPC_EMB_NADDR32 = 101
  8688. const m_R_PPC_EMB_RELSDA = 116
  8689. const m_R_PPC_EMB_RELSEC16 = 111
  8690. const m_R_PPC_EMB_RELST_HA = 114
  8691. const m_R_PPC_EMB_RELST_HI = 113
  8692. const m_R_PPC_EMB_RELST_LO = 112
  8693. const m_R_PPC_EMB_SDA21 = 109
  8694. const m_R_PPC_EMB_SDA2I16 = 107
  8695. const m_R_PPC_EMB_SDA2REL = 108
  8696. const m_R_PPC_EMB_SDAI16 = 106
  8697. const m_R_PPC_GLOB_DAT = 20
  8698. const m_R_PPC_GOT16 = 14
  8699. const m_R_PPC_GOT16_HA = 17
  8700. const m_R_PPC_GOT16_HI = 16
  8701. const m_R_PPC_GOT16_LO = 15
  8702. const m_R_PPC_GOT_DTPREL16 = 91
  8703. const m_R_PPC_GOT_DTPREL16_HA = 94
  8704. const m_R_PPC_GOT_DTPREL16_HI = 93
  8705. const m_R_PPC_GOT_DTPREL16_LO = 92
  8706. const m_R_PPC_GOT_TLSGD16 = 79
  8707. const m_R_PPC_GOT_TLSGD16_HA = 82
  8708. const m_R_PPC_GOT_TLSGD16_HI = 81
  8709. const m_R_PPC_GOT_TLSGD16_LO = 80
  8710. const m_R_PPC_GOT_TLSLD16 = 83
  8711. const m_R_PPC_GOT_TLSLD16_HA = 86
  8712. const m_R_PPC_GOT_TLSLD16_HI = 85
  8713. const m_R_PPC_GOT_TLSLD16_LO = 84
  8714. const m_R_PPC_GOT_TPREL16 = 87
  8715. const m_R_PPC_GOT_TPREL16_HA = 90
  8716. const m_R_PPC_GOT_TPREL16_HI = 89
  8717. const m_R_PPC_GOT_TPREL16_LO = 88
  8718. const m_R_PPC_IRELATIVE = 248
  8719. const m_R_PPC_JMP_SLOT = 21
  8720. const m_R_PPC_LOCAL24PC = 23
  8721. const m_R_PPC_NONE = 0
  8722. const m_R_PPC_PLT16_HA = 31
  8723. const m_R_PPC_PLT16_HI = 30
  8724. const m_R_PPC_PLT16_LO = 29
  8725. const m_R_PPC_PLT32 = 27
  8726. const m_R_PPC_PLTREL24 = 18
  8727. const m_R_PPC_PLTREL32 = 28
  8728. const m_R_PPC_REL14 = 11
  8729. const m_R_PPC_REL14_BRNTAKEN = 13
  8730. const m_R_PPC_REL14_BRTAKEN = 12
  8731. const m_R_PPC_REL16 = 249
  8732. const m_R_PPC_REL16_HA = 252
  8733. const m_R_PPC_REL16_HI = 251
  8734. const m_R_PPC_REL16_LO = 250
  8735. const m_R_PPC_REL24 = 10
  8736. const m_R_PPC_REL32 = 26
  8737. const m_R_PPC_RELATIVE = 22
  8738. const m_R_PPC_SDAREL16 = 32
  8739. const m_R_PPC_SECTOFF = 33
  8740. const m_R_PPC_SECTOFF_HA = 36
  8741. const m_R_PPC_SECTOFF_HI = 35
  8742. const m_R_PPC_SECTOFF_LO = 34
  8743. const m_R_PPC_TLS = 67
  8744. const m_R_PPC_TLSGD = 95
  8745. const m_R_PPC_TLSLD = 96
  8746. const m_R_PPC_TOC16 = 255
  8747. const m_R_PPC_TPREL16 = 69
  8748. const m_R_PPC_TPREL16_HA = 72
  8749. const m_R_PPC_TPREL16_HI = 71
  8750. const m_R_PPC_TPREL16_LO = 70
  8751. const m_R_PPC_TPREL32 = 73
  8752. const m_R_PPC_UADDR16 = 25
  8753. const m_R_PPC_UADDR32 = 24
  8754. const m_R_RISCV_32 = 1
  8755. const m_R_RISCV_32_PCREL = 57
  8756. const m_R_RISCV_64 = 2
  8757. const m_R_RISCV_ADD16 = 34
  8758. const m_R_RISCV_ADD32 = 35
  8759. const m_R_RISCV_ADD64 = 36
  8760. const m_R_RISCV_ADD8 = 33
  8761. const m_R_RISCV_ALIGN = 43
  8762. const m_R_RISCV_BRANCH = 16
  8763. const m_R_RISCV_CALL = 18
  8764. const m_R_RISCV_CALL_PLT = 19
  8765. const m_R_RISCV_COPY = 4
  8766. const m_R_RISCV_GOT32_PCREL = 41
  8767. const m_R_RISCV_GOT_HI20 = 20
  8768. const m_R_RISCV_HI20 = 26
  8769. const m_R_RISCV_IRELATIVE = 58
  8770. const m_R_RISCV_JAL = 17
  8771. const m_R_RISCV_JUMP_SLOT = 5
  8772. const m_R_RISCV_LO12_I = 27
  8773. const m_R_RISCV_LO12_S = 28
  8774. const m_R_RISCV_NONE = 0
  8775. const m_R_RISCV_PCREL_HI20 = 23
  8776. const m_R_RISCV_PCREL_LO12_I = 24
  8777. const m_R_RISCV_PCREL_LO12_S = 25
  8778. const m_R_RISCV_PLT32 = 59
  8779. const m_R_RISCV_RELATIVE = 3
  8780. const m_R_RISCV_RELAX = 51
  8781. const m_R_RISCV_RVC_BRANCH = 44
  8782. const m_R_RISCV_RVC_JUMP = 45
  8783. const m_R_RISCV_RVC_LUI = 46
  8784. const m_R_RISCV_SET16 = 55
  8785. const m_R_RISCV_SET32 = 56
  8786. const m_R_RISCV_SET6 = 53
  8787. const m_R_RISCV_SET8 = 54
  8788. const m_R_RISCV_SET_ULEB128 = 60
  8789. const m_R_RISCV_SUB16 = 38
  8790. const m_R_RISCV_SUB32 = 39
  8791. const m_R_RISCV_SUB6 = 52
  8792. const m_R_RISCV_SUB64 = 40
  8793. const m_R_RISCV_SUB8 = 37
  8794. const m_R_RISCV_SUB_ULEB128 = 61
  8795. const m_R_RISCV_TLSDESC = 12
  8796. const m_R_RISCV_TLSDESC_ADD_LO12 = 64
  8797. const m_R_RISCV_TLSDESC_CALL = 65
  8798. const m_R_RISCV_TLSDESC_HI20 = 62
  8799. const m_R_RISCV_TLSDESC_LOAD_LO12 = 63
  8800. const m_R_RISCV_TLS_DTPMOD32 = 6
  8801. const m_R_RISCV_TLS_DTPMOD64 = 7
  8802. const m_R_RISCV_TLS_DTPREL32 = 8
  8803. const m_R_RISCV_TLS_DTPREL64 = 9
  8804. const m_R_RISCV_TLS_GD_HI20 = 22
  8805. const m_R_RISCV_TLS_GOT_HI20 = 21
  8806. const m_R_RISCV_TLS_TPREL32 = 10
  8807. const m_R_RISCV_TLS_TPREL64 = 11
  8808. const m_R_RISCV_TPREL_ADD = 32
  8809. const m_R_RISCV_TPREL_HI20 = 29
  8810. const m_R_RISCV_TPREL_LO12_I = 30
  8811. const m_R_RISCV_TPREL_LO12_S = 31
  8812. const m_R_SH_ALIGN = 29
  8813. const m_R_SH_CODE = 30
  8814. const m_R_SH_COPY = 162
  8815. const m_R_SH_COUNT = 28
  8816. const m_R_SH_DATA = 31
  8817. const m_R_SH_DIR32 = 1
  8818. const m_R_SH_DIR8BP = 7
  8819. const m_R_SH_DIR8L = 9
  8820. const m_R_SH_DIR8W = 8
  8821. const m_R_SH_DIR8WPL = 5
  8822. const m_R_SH_DIR8WPN = 3
  8823. const m_R_SH_DIR8WPZ = 6
  8824. const m_R_SH_FUNCDESC = 207
  8825. const m_R_SH_FUNCDESC_VALUE = 208
  8826. const m_R_SH_GLOB_DAT = 163
  8827. const m_R_SH_GNU_VTENTRY = 35
  8828. const m_R_SH_GNU_VTINHERIT = 34
  8829. const m_R_SH_GOT20 = 201
  8830. const m_R_SH_GOT32 = 160
  8831. const m_R_SH_GOTFUNCDESC = 203
  8832. const m_R_SH_GOTFUNCDEST20 = 204
  8833. const m_R_SH_GOTOFF = 166
  8834. const m_R_SH_GOTOFF20 = 202
  8835. const m_R_SH_GOTOFFFUNCDESC = 205
  8836. const m_R_SH_GOTOFFFUNCDEST20 = 206
  8837. const m_R_SH_GOTPC = 167
  8838. const m_R_SH_IND12W = 4
  8839. const m_R_SH_JMP_SLOT = 164
  8840. const m_R_SH_LABEL = 32
  8841. const m_R_SH_NONE = 0
  8842. const m_R_SH_NUM = 256
  8843. const m_R_SH_PLT32 = 161
  8844. const m_R_SH_REL32 = 2
  8845. const m_R_SH_RELATIVE = 165
  8846. const m_R_SH_SWITCH16 = 25
  8847. const m_R_SH_SWITCH32 = 26
  8848. const m_R_SH_SWITCH8 = 33
  8849. const m_R_SH_TLS_DTPMOD32 = 149
  8850. const m_R_SH_TLS_DTPOFF32 = 150
  8851. const m_R_SH_TLS_GD_32 = 144
  8852. const m_R_SH_TLS_IE_32 = 147
  8853. const m_R_SH_TLS_LDO_32 = 146
  8854. const m_R_SH_TLS_LD_32 = 145
  8855. const m_R_SH_TLS_LE_32 = 148
  8856. const m_R_SH_TLS_TPOFF32 = 151
  8857. const m_R_SH_USES = 27
  8858. const m_R_SPARC_10 = 30
  8859. const m_R_SPARC_11 = 31
  8860. const m_R_SPARC_13 = 11
  8861. const m_R_SPARC_16 = 2
  8862. const m_R_SPARC_22 = 10
  8863. const m_R_SPARC_32 = 3
  8864. const m_R_SPARC_5 = 44
  8865. const m_R_SPARC_6 = 45
  8866. const m_R_SPARC_64 = 32
  8867. const m_R_SPARC_7 = 43
  8868. const m_R_SPARC_8 = 1
  8869. const m_R_SPARC_COPY = 19
  8870. const m_R_SPARC_DISP16 = 5
  8871. const m_R_SPARC_DISP32 = 6
  8872. const m_R_SPARC_DISP64 = 46
  8873. const m_R_SPARC_DISP8 = 4
  8874. const m_R_SPARC_GLOB_DAT = 20
  8875. const m_R_SPARC_GLOB_JMP = 42
  8876. const m_R_SPARC_GNU_VTENTRY = 251
  8877. const m_R_SPARC_GNU_VTINHERIT = 250
  8878. const m_R_SPARC_GOT10 = 13
  8879. const m_R_SPARC_GOT13 = 14
  8880. const m_R_SPARC_GOT22 = 15
  8881. const m_R_SPARC_GOTDATA_HIX22 = 80
  8882. const m_R_SPARC_GOTDATA_LOX10 = 81
  8883. const m_R_SPARC_GOTDATA_OP = 84
  8884. const m_R_SPARC_GOTDATA_OP_HIX22 = 82
  8885. const m_R_SPARC_GOTDATA_OP_LOX10 = 83
  8886. const m_R_SPARC_H34 = 85
  8887. const m_R_SPARC_H44 = 50
  8888. const m_R_SPARC_HH22 = 34
  8889. const m_R_SPARC_HI22 = 9
  8890. const m_R_SPARC_HIPLT22 = 25
  8891. const m_R_SPARC_HIX22 = 48
  8892. const m_R_SPARC_HM10 = 35
  8893. const m_R_SPARC_JMP_SLOT = 21
  8894. const m_R_SPARC_L44 = 52
  8895. const m_R_SPARC_LM22 = 36
  8896. const m_R_SPARC_LO10 = 12
  8897. const m_R_SPARC_LOPLT10 = 26
  8898. const m_R_SPARC_LOX10 = 49
  8899. const m_R_SPARC_M44 = 51
  8900. const m_R_SPARC_NONE = 0
  8901. const m_R_SPARC_NUM = 253
  8902. const m_R_SPARC_OLO10 = 33
  8903. const m_R_SPARC_PC10 = 16
  8904. const m_R_SPARC_PC22 = 17
  8905. const m_R_SPARC_PCPLT10 = 29
  8906. const m_R_SPARC_PCPLT22 = 28
  8907. const m_R_SPARC_PCPLT32 = 27
  8908. const m_R_SPARC_PC_HH22 = 37
  8909. const m_R_SPARC_PC_HM10 = 38
  8910. const m_R_SPARC_PC_LM22 = 39
  8911. const m_R_SPARC_PLT32 = 24
  8912. const m_R_SPARC_PLT64 = 47
  8913. const m_R_SPARC_REGISTER = 53
  8914. const m_R_SPARC_RELATIVE = 22
  8915. const m_R_SPARC_REV32 = 252
  8916. const m_R_SPARC_SIZE32 = 86
  8917. const m_R_SPARC_SIZE64 = 87
  8918. const m_R_SPARC_TLS_DTPMOD32 = 74
  8919. const m_R_SPARC_TLS_DTPMOD64 = 75
  8920. const m_R_SPARC_TLS_DTPOFF32 = 76
  8921. const m_R_SPARC_TLS_DTPOFF64 = 77
  8922. const m_R_SPARC_TLS_GD_ADD = 58
  8923. const m_R_SPARC_TLS_GD_CALL = 59
  8924. const m_R_SPARC_TLS_GD_HI22 = 56
  8925. const m_R_SPARC_TLS_GD_LO10 = 57
  8926. const m_R_SPARC_TLS_IE_ADD = 71
  8927. const m_R_SPARC_TLS_IE_HI22 = 67
  8928. const m_R_SPARC_TLS_IE_LD = 69
  8929. const m_R_SPARC_TLS_IE_LDX = 70
  8930. const m_R_SPARC_TLS_IE_LO10 = 68
  8931. const m_R_SPARC_TLS_LDM_ADD = 62
  8932. const m_R_SPARC_TLS_LDM_CALL = 63
  8933. const m_R_SPARC_TLS_LDM_HI22 = 60
  8934. const m_R_SPARC_TLS_LDM_LO10 = 61
  8935. const m_R_SPARC_TLS_LDO_ADD = 66
  8936. const m_R_SPARC_TLS_LDO_HIX22 = 64
  8937. const m_R_SPARC_TLS_LDO_LOX10 = 65
  8938. const m_R_SPARC_TLS_LE_HIX22 = 72
  8939. const m_R_SPARC_TLS_LE_LOX10 = 73
  8940. const m_R_SPARC_TLS_TPOFF32 = 78
  8941. const m_R_SPARC_TLS_TPOFF64 = 79
  8942. const m_R_SPARC_UA16 = 55
  8943. const m_R_SPARC_UA32 = 23
  8944. const m_R_SPARC_UA64 = 54
  8945. const m_R_SPARC_WDISP16 = 40
  8946. const m_R_SPARC_WDISP19 = 41
  8947. const m_R_SPARC_WDISP22 = 8
  8948. const m_R_SPARC_WDISP30 = 7
  8949. const m_R_SPARC_WPLT30 = 18
  8950. const m_R_X86_64_16 = 12
  8951. const m_R_X86_64_32 = 10
  8952. const m_R_X86_64_32S = 11
  8953. const m_R_X86_64_64 = 1
  8954. const m_R_X86_64_8 = 14
  8955. const m_R_X86_64_COPY = 5
  8956. const m_R_X86_64_DTPMOD64 = 16
  8957. const m_R_X86_64_DTPOFF32 = 21
  8958. const m_R_X86_64_DTPOFF64 = 17
  8959. const m_R_X86_64_GLOB_DAT = 6
  8960. const m_R_X86_64_GOT32 = 3
  8961. const m_R_X86_64_GOT64 = 27
  8962. const m_R_X86_64_GOTOFF64 = 25
  8963. const m_R_X86_64_GOTPC32 = 26
  8964. const m_R_X86_64_GOTPC32_TLSDESC = 34
  8965. const m_R_X86_64_GOTPC64 = 29
  8966. const m_R_X86_64_GOTPCREL = 9
  8967. const m_R_X86_64_GOTPCREL64 = 28
  8968. const m_R_X86_64_GOTPCRELX = 41
  8969. const m_R_X86_64_GOTPLT64 = 30
  8970. const m_R_X86_64_GOTTPOFF = 22
  8971. const m_R_X86_64_IRELATIVE = 37
  8972. const m_R_X86_64_JUMP_SLOT = 7
  8973. const m_R_X86_64_NONE = 0
  8974. const m_R_X86_64_NUM = 43
  8975. const m_R_X86_64_PC16 = 13
  8976. const m_R_X86_64_PC32 = 2
  8977. const m_R_X86_64_PC64 = 24
  8978. const m_R_X86_64_PC8 = 15
  8979. const m_R_X86_64_PLT32 = 4
  8980. const m_R_X86_64_PLTOFF64 = 31
  8981. const m_R_X86_64_RELATIVE = 8
  8982. const m_R_X86_64_RELATIVE64 = 38
  8983. const m_R_X86_64_REX_GOTPCRELX = 42
  8984. const m_R_X86_64_SIZE32 = 32
  8985. const m_R_X86_64_SIZE64 = 33
  8986. const m_R_X86_64_TLSDESC = 36
  8987. const m_R_X86_64_TLSDESC_CALL = 35
  8988. const m_R_X86_64_TLSGD = 19
  8989. const m_R_X86_64_TLSLD = 20
  8990. const m_R_X86_64_TPOFF32 = 23
  8991. const m_R_X86_64_TPOFF64 = 18
  8992. const m_SELFMAG = 4
  8993. const m_SHF_ALPHA_GPREL = 0x10000000
  8994. const m_SHF_ARM_COMDEF = 0x80000000
  8995. const m_SHF_ARM_ENTRYSECT = 0x10000000
  8996. const m_SHF_IA_64_NORECOV = 0x20000000
  8997. const m_SHF_IA_64_SHORT = 0x10000000
  8998. const m_SHF_MASKOS = 0x0ff00000
  8999. const m_SHF_MASKPROC = 0xf0000000
  9000. const m_SHF_MIPS_ADDR = 0x40000000
  9001. const m_SHF_MIPS_GPREL = 0x10000000
  9002. const m_SHF_MIPS_LOCAL = 0x04000000
  9003. const m_SHF_MIPS_MERGE = 0x20000000
  9004. const m_SHF_MIPS_NAMES = 0x02000000
  9005. const m_SHF_MIPS_NODUPE = 0x01000000
  9006. const m_SHF_MIPS_NOSTRIP = 0x08000000
  9007. const m_SHF_MIPS_STRINGS = 0x80000000
  9008. const m_SHF_PARISC_HUGE = 0x40000000
  9009. const m_SHF_PARISC_SBP = 0x80000000
  9010. const m_SHF_PARISC_SHORT = 0x20000000
  9011. const m_SHN_ABS = 65521
  9012. const m_SHN_AFTER = 0xff01
  9013. const m_SHN_BEFORE = 0xff00
  9014. const m_SHN_COMMON = 65522
  9015. const m_SHN_HIOS = 0xff3f
  9016. const m_SHN_HIPROC = 0xff1f
  9017. const m_SHN_HIRESERVE = 0xffff
  9018. const m_SHN_LOOS = 0xff20
  9019. const m_SHN_LOPROC = 0xff00
  9020. const m_SHN_LORESERVE = 0xff00
  9021. const m_SHN_MIPS_ACOMMON = 0xff00
  9022. const m_SHN_MIPS_DATA = 0xff02
  9023. const m_SHN_MIPS_SCOMMON = 0xff03
  9024. const m_SHN_MIPS_SUNDEFINED = 0xff04
  9025. const m_SHN_MIPS_TEXT = 0xff01
  9026. const m_SHN_PARISC_ANSI_COMMON = 0xff00
  9027. const m_SHN_PARISC_HUGE_COMMON = 0xff01
  9028. const m_SHN_UNDEF = 0
  9029. const m_SHN_XINDEX = 0xffff
  9030. const m_SHT_ALPHA_DEBUG = 0x70000001
  9031. const m_SHT_ALPHA_REGINFO = 0x70000002
  9032. const m_SHT_CHECKSUM = 0x6ffffff8
  9033. const m_SHT_DYNAMIC = 6
  9034. const m_SHT_DYNSYM = 11
  9035. const m_SHT_FINI_ARRAY = 15
  9036. const m_SHT_GNU_ATTRIBUTES = 0x6ffffff5
  9037. const m_SHT_GNU_HASH = 0x6ffffff6
  9038. const m_SHT_GNU_LIBLIST = 0x6ffffff7
  9039. const m_SHT_GNU_verdef = 0x6ffffffd
  9040. const m_SHT_GNU_verneed = 0x6ffffffe
  9041. const m_SHT_GNU_versym = 0x6fffffff
  9042. const m_SHT_GROUP = 17
  9043. const m_SHT_HASH = 5
  9044. const m_SHT_HIOS = 0x6fffffff
  9045. const m_SHT_HIPROC = 0x7fffffff
  9046. const m_SHT_HISUNW = 0x6fffffff
  9047. const m_SHT_HIUSER = 0x8fffffff
  9048. const m_SHT_INIT_ARRAY = 14
  9049. const m_SHT_LOOS = 0x60000000
  9050. const m_SHT_LOPROC = 0x70000000
  9051. const m_SHT_LOSUNW = 0x6ffffffa
  9052. const m_SHT_LOUSER = 0x80000000
  9053. const m_SHT_MIPS_AUXSYM = 0x70000016
  9054. const m_SHT_MIPS_CONFLICT = 0x70000002
  9055. const m_SHT_MIPS_CONTENT = 0x7000000c
  9056. const m_SHT_MIPS_DEBUG = 0x70000005
  9057. const m_SHT_MIPS_DELTACLASS = 0x7000001d
  9058. const m_SHT_MIPS_DELTADECL = 0x7000001f
  9059. const m_SHT_MIPS_DELTAINST = 0x7000001c
  9060. const m_SHT_MIPS_DELTASYM = 0x7000001b
  9061. const m_SHT_MIPS_DENSE = 0x70000013
  9062. const m_SHT_MIPS_DWARF = 0x7000001e
  9063. const m_SHT_MIPS_EH_REGION = 0x70000027
  9064. const m_SHT_MIPS_EVENTS = 0x70000021
  9065. const m_SHT_MIPS_EXTSYM = 0x70000012
  9066. const m_SHT_MIPS_FDESC = 0x70000011
  9067. const m_SHT_MIPS_GPTAB = 0x70000003
  9068. const m_SHT_MIPS_IFACE = 0x7000000b
  9069. const m_SHT_MIPS_LIBLIST = 0x70000000
  9070. const m_SHT_MIPS_LINE = 0x70000019
  9071. const m_SHT_MIPS_LOCSTR = 0x70000018
  9072. const m_SHT_MIPS_LOCSYM = 0x70000015
  9073. const m_SHT_MIPS_MSYM = 0x70000001
  9074. const m_SHT_MIPS_OPTIONS = 0x7000000d
  9075. const m_SHT_MIPS_OPTSYM = 0x70000017
  9076. const m_SHT_MIPS_PACKAGE = 0x70000007
  9077. const m_SHT_MIPS_PACKSYM = 0x70000008
  9078. const m_SHT_MIPS_PDESC = 0x70000014
  9079. const m_SHT_MIPS_PDR_EXCEPTION = 0x70000029
  9080. const m_SHT_MIPS_PIXIE = 0x70000023
  9081. const m_SHT_MIPS_REGINFO = 0x70000006
  9082. const m_SHT_MIPS_RELD = 0x70000009
  9083. const m_SHT_MIPS_RFDESC = 0x7000001a
  9084. const m_SHT_MIPS_SHDR = 0x70000010
  9085. const m_SHT_MIPS_SYMBOL_LIB = 0x70000020
  9086. const m_SHT_MIPS_TRANSLATE = 0x70000022
  9087. const m_SHT_MIPS_UCODE = 0x70000004
  9088. const m_SHT_MIPS_WHIRL = 0x70000026
  9089. const m_SHT_MIPS_XLATE = 0x70000024
  9090. const m_SHT_MIPS_XLATE_DEBUG = 0x70000025
  9091. const m_SHT_MIPS_XLATE_OLD = 0x70000028
  9092. const m_SHT_NOBITS = 8
  9093. const m_SHT_NOTE = 7
  9094. const m_SHT_NULL = 0
  9095. const m_SHT_NUM = 20
  9096. const m_SHT_PARISC_DOC = 0x70000002
  9097. const m_SHT_PARISC_EXT = 0x70000000
  9098. const m_SHT_PARISC_UNWIND = 0x70000001
  9099. const m_SHT_PREINIT_ARRAY = 16
  9100. const m_SHT_PROGBITS = 1
  9101. const m_SHT_REL = 9
  9102. const m_SHT_RELA = 4
  9103. const m_SHT_RELR = 19
  9104. const m_SHT_SHLIB = 10
  9105. const m_SHT_STRTAB = 3
  9106. const m_SHT_SUNW_COMDAT = 0x6ffffffb
  9107. const m_SHT_SUNW_move = 0x6ffffffa
  9108. const m_SHT_SUNW_syminfo = 0x6ffffffc
  9109. const m_SHT_SYMTAB = 2
  9110. const m_SHT_SYMTAB_SHNDX = 18
  9111. const m_STB_GLOBAL = 1
  9112. const m_STB_GNU_UNIQUE = 10
  9113. const m_STB_HIOS = 12
  9114. const m_STB_HIPROC = 15
  9115. const m_STB_LOCAL = 0
  9116. const m_STB_LOOS = 10
  9117. const m_STB_LOPROC = 13
  9118. const m_STB_MIPS_SPLIT_COMMON = 13
  9119. const m_STB_NUM = 3
  9120. const m_STB_WEAK = 2
  9121. const m_STN_UNDEF = 0
  9122. const m_STO_ALPHA_NOPV = 0x80
  9123. const m_STO_ALPHA_STD_GPLOAD = 0x88
  9124. const m_STO_MIPS_DEFAULT = 0x0
  9125. const m_STO_MIPS_HIDDEN = 0x2
  9126. const m_STO_MIPS_INTERNAL = 0x1
  9127. const m_STO_MIPS_PLT = 0x8
  9128. const m_STO_MIPS_PROTECTED = 0x3
  9129. const m_STO_MIPS_SC_ALIGN_UNUSED = 0xff
  9130. const m_STO_PPC64_LOCAL_BIT = 5
  9131. const m_STO_PPC64_LOCAL_MASK = 0xe0
  9132. const m_STT_ARM_16BIT = "STT_HIPROC"
  9133. const m_STT_ARM_TFUNC = "STT_LOPROC"
  9134. const m_STT_COMMON = 5
  9135. const m_STT_FILE = 4
  9136. const m_STT_FUNC = 2
  9137. const m_STT_GNU_IFUNC = 10
  9138. const m_STT_HIOS = 12
  9139. const m_STT_HIPROC = 15
  9140. const m_STT_LOOS = 10
  9141. const m_STT_LOPROC = 13
  9142. const m_STT_NOTYPE = 0
  9143. const m_STT_NUM = 7
  9144. const m_STT_OBJECT = 1
  9145. const m_STT_PARISC_MILLICODE = 13
  9146. const m_STT_SECTION = 3
  9147. const m_STT_SPARC_REGISTER = 13
  9148. const m_STT_TLS = 6
  9149. const m_STV_DEFAULT = 0
  9150. const m_STV_HIDDEN = 2
  9151. const m_STV_INTERNAL = 1
  9152. const m_STV_PROTECTED = 3
  9153. const m_SYMINFO_BT_LOWRESERVE = 0xff00
  9154. const m_SYMINFO_BT_PARENT = 0xfffe
  9155. const m_SYMINFO_BT_SELF = 0xffff
  9156. const m_SYMINFO_CURRENT = 1
  9157. const m_SYMINFO_FLG_COPY = 0x0004
  9158. const m_SYMINFO_FLG_DIRECT = 0x0001
  9159. const m_SYMINFO_FLG_LAZYLOAD = 0x0008
  9160. const m_SYMINFO_FLG_PASSTHRU = 0x0002
  9161. const m_SYMINFO_NONE = 0
  9162. const m_SYMINFO_NUM = 2
  9163. const m_VER_DEF_CURRENT = 1
  9164. const m_VER_DEF_NONE = 0
  9165. const m_VER_DEF_NUM = 2
  9166. const m_VER_FLG_BASE = 0x1
  9167. const m_VER_FLG_WEAK = 0x2
  9168. const m_VER_NDX_ELIMINATE = 0xff01
  9169. const m_VER_NDX_GLOBAL = 1
  9170. const m_VER_NDX_LOCAL = 0
  9171. const m_VER_NDX_LORESERVE = 0xff00
  9172. const m_VER_NEED_CURRENT = 1
  9173. const m_VER_NEED_NONE = 0
  9174. const m_VER_NEED_NUM = 2
  9175. const m_n_hash = "n_desc"
  9176. type Tnlist = struct {
  9177. F__ccgo0_0 struct {
  9178. Fn_un [0]struct {
  9179. Fn_next [0]uintptr
  9180. Fn_strx [0]int64
  9181. Fn_name uintptr
  9182. }
  9183. Fn_name uintptr
  9184. }
  9185. Fn_type uint8
  9186. Fn_other uint8
  9187. Fn_desc int16
  9188. Fn_value uint64
  9189. }
  9190. type TElf32_Half = uint16
  9191. type TElf64_Half = uint16
  9192. type TElf32_Word = uint32
  9193. type TElf32_Sword = int32
  9194. type TElf64_Word = uint32
  9195. type TElf64_Sword = int32
  9196. type TElf32_Xword = uint64
  9197. type TElf32_Sxword = int64
  9198. type TElf64_Xword = uint64
  9199. type TElf64_Sxword = int64
  9200. type TElf32_Addr = uint32
  9201. type TElf64_Addr = uint64
  9202. type TElf32_Off = uint32
  9203. type TElf64_Off = uint64
  9204. type TElf32_Section = uint16
  9205. type TElf64_Section = uint16
  9206. type TElf32_Versym = uint16
  9207. type TElf64_Versym = uint16
  9208. type TElf32_Ehdr = struct {
  9209. Fe_ident [16]uint8
  9210. Fe_type TElf32_Half
  9211. Fe_machine TElf32_Half
  9212. Fe_version TElf32_Word
  9213. Fe_entry TElf32_Addr
  9214. Fe_phoff TElf32_Off
  9215. Fe_shoff TElf32_Off
  9216. Fe_flags TElf32_Word
  9217. Fe_ehsize TElf32_Half
  9218. Fe_phentsize TElf32_Half
  9219. Fe_phnum TElf32_Half
  9220. Fe_shentsize TElf32_Half
  9221. Fe_shnum TElf32_Half
  9222. Fe_shstrndx TElf32_Half
  9223. }
  9224. type TElf64_Ehdr = struct {
  9225. Fe_ident [16]uint8
  9226. Fe_type TElf64_Half
  9227. Fe_machine TElf64_Half
  9228. Fe_version TElf64_Word
  9229. Fe_entry TElf64_Addr
  9230. Fe_phoff TElf64_Off
  9231. Fe_shoff TElf64_Off
  9232. Fe_flags TElf64_Word
  9233. Fe_ehsize TElf64_Half
  9234. Fe_phentsize TElf64_Half
  9235. Fe_phnum TElf64_Half
  9236. Fe_shentsize TElf64_Half
  9237. Fe_shnum TElf64_Half
  9238. Fe_shstrndx TElf64_Half
  9239. }
  9240. type TElf32_Shdr = struct {
  9241. Fsh_name TElf32_Word
  9242. Fsh_type TElf32_Word
  9243. Fsh_flags TElf32_Word
  9244. Fsh_addr TElf32_Addr
  9245. Fsh_offset TElf32_Off
  9246. Fsh_size TElf32_Word
  9247. Fsh_link TElf32_Word
  9248. Fsh_info TElf32_Word
  9249. Fsh_addralign TElf32_Word
  9250. Fsh_entsize TElf32_Word
  9251. }
  9252. type TElf64_Shdr = struct {
  9253. Fsh_name TElf64_Word
  9254. Fsh_type TElf64_Word
  9255. Fsh_flags TElf64_Xword
  9256. Fsh_addr TElf64_Addr
  9257. Fsh_offset TElf64_Off
  9258. Fsh_size TElf64_Xword
  9259. Fsh_link TElf64_Word
  9260. Fsh_info TElf64_Word
  9261. Fsh_addralign TElf64_Xword
  9262. Fsh_entsize TElf64_Xword
  9263. }
  9264. type TElf32_Chdr = struct {
  9265. Fch_type TElf32_Word
  9266. Fch_size TElf32_Word
  9267. Fch_addralign TElf32_Word
  9268. }
  9269. type TElf64_Chdr = struct {
  9270. Fch_type TElf64_Word
  9271. Fch_reserved TElf64_Word
  9272. Fch_size TElf64_Xword
  9273. Fch_addralign TElf64_Xword
  9274. }
  9275. type TElf32_Sym = struct {
  9276. Fst_name TElf32_Word
  9277. Fst_value TElf32_Addr
  9278. Fst_size TElf32_Word
  9279. Fst_info uint8
  9280. Fst_other uint8
  9281. Fst_shndx TElf32_Section
  9282. }
  9283. type TElf64_Sym = struct {
  9284. Fst_name TElf64_Word
  9285. Fst_info uint8
  9286. Fst_other uint8
  9287. Fst_shndx TElf64_Section
  9288. Fst_value TElf64_Addr
  9289. Fst_size TElf64_Xword
  9290. }
  9291. type TElf32_Syminfo = struct {
  9292. Fsi_boundto TElf32_Half
  9293. Fsi_flags TElf32_Half
  9294. }
  9295. type TElf64_Syminfo = struct {
  9296. Fsi_boundto TElf64_Half
  9297. Fsi_flags TElf64_Half
  9298. }
  9299. type TElf32_Rel = struct {
  9300. Fr_offset TElf32_Addr
  9301. Fr_info TElf32_Word
  9302. }
  9303. type TElf64_Rel = struct {
  9304. Fr_offset TElf64_Addr
  9305. Fr_info TElf64_Xword
  9306. }
  9307. type TElf32_Rela = struct {
  9308. Fr_offset TElf32_Addr
  9309. Fr_info TElf32_Word
  9310. Fr_addend TElf32_Sword
  9311. }
  9312. type TElf64_Rela = struct {
  9313. Fr_offset TElf64_Addr
  9314. Fr_info TElf64_Xword
  9315. Fr_addend TElf64_Sxword
  9316. }
  9317. type TElf32_Relr = uint32
  9318. type TElf64_Relr = uint64
  9319. type TElf32_Phdr = struct {
  9320. Fp_type TElf32_Word
  9321. Fp_offset TElf32_Off
  9322. Fp_vaddr TElf32_Addr
  9323. Fp_paddr TElf32_Addr
  9324. Fp_filesz TElf32_Word
  9325. Fp_memsz TElf32_Word
  9326. Fp_flags TElf32_Word
  9327. Fp_align TElf32_Word
  9328. }
  9329. type TElf64_Phdr = struct {
  9330. Fp_type TElf64_Word
  9331. Fp_flags TElf64_Word
  9332. Fp_offset TElf64_Off
  9333. Fp_vaddr TElf64_Addr
  9334. Fp_paddr TElf64_Addr
  9335. Fp_filesz TElf64_Xword
  9336. Fp_memsz TElf64_Xword
  9337. Fp_align TElf64_Xword
  9338. }
  9339. type TElf32_Dyn = struct {
  9340. Fd_tag TElf32_Sword
  9341. Fd_un struct {
  9342. Fd_ptr [0]TElf32_Addr
  9343. Fd_val TElf32_Word
  9344. }
  9345. }
  9346. type TElf64_Dyn = struct {
  9347. Fd_tag TElf64_Sxword
  9348. Fd_un struct {
  9349. Fd_ptr [0]TElf64_Addr
  9350. Fd_val TElf64_Xword
  9351. }
  9352. }
  9353. type TElf32_Verdef = struct {
  9354. Fvd_version TElf32_Half
  9355. Fvd_flags TElf32_Half
  9356. Fvd_ndx TElf32_Half
  9357. Fvd_cnt TElf32_Half
  9358. Fvd_hash TElf32_Word
  9359. Fvd_aux TElf32_Word
  9360. Fvd_next TElf32_Word
  9361. }
  9362. type TElf64_Verdef = struct {
  9363. Fvd_version TElf64_Half
  9364. Fvd_flags TElf64_Half
  9365. Fvd_ndx TElf64_Half
  9366. Fvd_cnt TElf64_Half
  9367. Fvd_hash TElf64_Word
  9368. Fvd_aux TElf64_Word
  9369. Fvd_next TElf64_Word
  9370. }
  9371. type TElf32_Verdaux = struct {
  9372. Fvda_name TElf32_Word
  9373. Fvda_next TElf32_Word
  9374. }
  9375. type TElf64_Verdaux = struct {
  9376. Fvda_name TElf64_Word
  9377. Fvda_next TElf64_Word
  9378. }
  9379. type TElf32_Verneed = struct {
  9380. Fvn_version TElf32_Half
  9381. Fvn_cnt TElf32_Half
  9382. Fvn_file TElf32_Word
  9383. Fvn_aux TElf32_Word
  9384. Fvn_next TElf32_Word
  9385. }
  9386. type TElf64_Verneed = struct {
  9387. Fvn_version TElf64_Half
  9388. Fvn_cnt TElf64_Half
  9389. Fvn_file TElf64_Word
  9390. Fvn_aux TElf64_Word
  9391. Fvn_next TElf64_Word
  9392. }
  9393. type TElf32_Vernaux = struct {
  9394. Fvna_hash TElf32_Word
  9395. Fvna_flags TElf32_Half
  9396. Fvna_other TElf32_Half
  9397. Fvna_name TElf32_Word
  9398. Fvna_next TElf32_Word
  9399. }
  9400. type TElf64_Vernaux = struct {
  9401. Fvna_hash TElf64_Word
  9402. Fvna_flags TElf64_Half
  9403. Fvna_other TElf64_Half
  9404. Fvna_name TElf64_Word
  9405. Fvna_next TElf64_Word
  9406. }
  9407. type TElf32_auxv_t = struct {
  9408. Fa_type Tuint32_t
  9409. Fa_un struct {
  9410. Fa_val Tuint32_t
  9411. }
  9412. }
  9413. type TElf64_auxv_t = struct {
  9414. Fa_type Tuint64_t
  9415. Fa_un struct {
  9416. Fa_val Tuint64_t
  9417. }
  9418. }
  9419. type TElf32_Nhdr = struct {
  9420. Fn_namesz TElf32_Word
  9421. Fn_descsz TElf32_Word
  9422. Fn_type TElf32_Word
  9423. }
  9424. type TElf64_Nhdr = struct {
  9425. Fn_namesz TElf64_Word
  9426. Fn_descsz TElf64_Word
  9427. Fn_type TElf64_Word
  9428. }
  9429. type TElf32_Move = struct {
  9430. Fm_value TElf32_Xword
  9431. Fm_info TElf32_Word
  9432. Fm_poffset TElf32_Word
  9433. Fm_repeat TElf32_Half
  9434. Fm_stride TElf32_Half
  9435. }
  9436. type TElf64_Move = struct {
  9437. Fm_value TElf64_Xword
  9438. Fm_info TElf64_Xword
  9439. Fm_poffset TElf64_Xword
  9440. Fm_repeat TElf64_Half
  9441. Fm_stride TElf64_Half
  9442. }
  9443. type TElf32_gptab = struct {
  9444. Fgt_entry [0]struct {
  9445. Fgt_g_value TElf32_Word
  9446. Fgt_bytes TElf32_Word
  9447. }
  9448. Fgt_header struct {
  9449. Fgt_current_g_value TElf32_Word
  9450. Fgt_unused TElf32_Word
  9451. }
  9452. }
  9453. type TElf32_RegInfo = struct {
  9454. Fri_gprmask TElf32_Word
  9455. Fri_cprmask [4]TElf32_Word
  9456. Fri_gp_value TElf32_Sword
  9457. }
  9458. type TElf_Options = struct {
  9459. Fkind uint8
  9460. Fsize uint8
  9461. Fsection TElf32_Section
  9462. Finfo TElf32_Word
  9463. }
  9464. type TElf_Options_Hw = struct {
  9465. Fhwp_flags1 TElf32_Word
  9466. Fhwp_flags2 TElf32_Word
  9467. }
  9468. type TElf32_Lib = struct {
  9469. Fl_name TElf32_Word
  9470. Fl_time_stamp TElf32_Word
  9471. Fl_checksum TElf32_Word
  9472. Fl_version TElf32_Word
  9473. Fl_flags TElf32_Word
  9474. }
  9475. type TElf64_Lib = struct {
  9476. Fl_name TElf64_Word
  9477. Fl_time_stamp TElf64_Word
  9478. Fl_checksum TElf64_Word
  9479. Fl_version TElf64_Word
  9480. Fl_flags TElf64_Word
  9481. }
  9482. type TElf32_Conflict = uint32
  9483. type TElf_MIPS_ABIFlags_v0 = struct {
  9484. Fversion TElf32_Half
  9485. Fisa_level uint8
  9486. Fisa_rev uint8
  9487. Fgpr_size uint8
  9488. Fcpr1_size uint8
  9489. Fcpr2_size uint8
  9490. Ffp_abi uint8
  9491. Fisa_ext TElf32_Word
  9492. Fases TElf32_Word
  9493. Fflags1 TElf32_Word
  9494. Fflags2 TElf32_Word
  9495. }
  9496. const _Val_GNU_MIPS_ABI_FP_ANY = 0
  9497. const _Val_GNU_MIPS_ABI_FP_DOUBLE = 1
  9498. const _Val_GNU_MIPS_ABI_FP_SINGLE = 2
  9499. const _Val_GNU_MIPS_ABI_FP_SOFT = 3
  9500. const _Val_GNU_MIPS_ABI_FP_OLD_64 = 4
  9501. const _Val_GNU_MIPS_ABI_FP_XX = 5
  9502. const _Val_GNU_MIPS_ABI_FP_64 = 6
  9503. const _Val_GNU_MIPS_ABI_FP_64A = 7
  9504. const _Val_GNU_MIPS_ABI_FP_MAX = 7
  9505. // C documentation
  9506. //
  9507. // /*
  9508. // * __elf_is_okay__ - Determine if ehdr really
  9509. // * is ELF and valid for the target platform.
  9510. // *
  9511. // * WARNING: This is NOT an ELF ABI function and
  9512. // * as such its use should be restricted.
  9513. // */
  9514. func ___elf_is_okay__(tls *libc.TLS, ehdr uintptr) (r int32) {
  9515. var retval int32
  9516. _ = retval
  9517. retval = 0
  9518. /*
  9519. * We need to check magic, class size, endianess,
  9520. * and version before we look at the rest of the
  9521. * Elf_Ehdr structure. These few elements are
  9522. * represented in a machine independent fashion.
  9523. */
  9524. 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_ELFCLASS64) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ehdr + 5))) == int32(m_ELFDATA2LSB) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ehdr + 6))) == int32(m_EV_CURRENT) {
  9525. /* Now check the machine dependent header */
  9526. if libc.Int32FromUint16((*TElf64_Ehdr)(unsafe.Pointer(ehdr)).Fe_machine) == int32(m_EM_AARCH64) && (*TElf64_Ehdr)(unsafe.Pointer(ehdr)).Fe_version == uint32(m_EV_CURRENT) {
  9527. retval = int32(1)
  9528. }
  9529. }
  9530. return retval
  9531. }
  9532. // C documentation
  9533. //
  9534. // /*
  9535. // * Convert an Elf_Sym into an nlist structure. This fills in only the
  9536. // * n_value and n_type members.
  9537. // */
  9538. func _elf_sym_to_nlist(tls *libc.TLS, nl uintptr, s uintptr, shdr uintptr, shnum int32) {
  9539. var sh, p5 uintptr
  9540. var v1, v2, v3, v4 int32
  9541. _, _, _, _, _, _ = sh, v1, v2, v3, v4, p5
  9542. (*Tnlist)(unsafe.Pointer(nl)).Fn_value = (*TElf64_Sym)(unsafe.Pointer(s)).Fst_value
  9543. switch libc.Int32FromUint16((*TElf64_Sym)(unsafe.Pointer(s)).Fst_shndx) {
  9544. case m_SHN_UNDEF:
  9545. fallthrough
  9546. case int32(m_SHN_COMMON):
  9547. (*Tnlist)(unsafe.Pointer(nl)).Fn_type = uint8(m_N_UNDF)
  9548. case int32(m_SHN_ABS):
  9549. if libc.Int32FromUint8((*TElf64_Sym)(unsafe.Pointer(s)).Fst_info)&int32(0xf) == int32(m_STT_FILE) {
  9550. v1 = int32(m_N_FN)
  9551. } else {
  9552. v1 = int32(m_N_ABS)
  9553. }
  9554. (*Tnlist)(unsafe.Pointer(nl)).Fn_type = libc.Uint8FromInt32(v1)
  9555. default:
  9556. if libc.Int32FromUint16((*TElf64_Sym)(unsafe.Pointer(s)).Fst_shndx) >= shnum {
  9557. (*Tnlist)(unsafe.Pointer(nl)).Fn_type = uint8(m_N_UNDF)
  9558. } else {
  9559. sh = shdr + uintptr((*TElf64_Sym)(unsafe.Pointer(s)).Fst_shndx)*64
  9560. if (*TElf64_Shdr)(unsafe.Pointer(sh)).Fsh_type == uint32(m_SHT_PROGBITS) {
  9561. if (*TElf64_Shdr)(unsafe.Pointer(sh)).Fsh_flags&libc.Uint64FromInt32(libc.Int32FromInt32(1)<<libc.Int32FromInt32(0)) != 0 {
  9562. v3 = int32(m_N_DATA)
  9563. } else {
  9564. v3 = int32(m_N_TEXT)
  9565. }
  9566. v2 = v3
  9567. } else {
  9568. if (*TElf64_Shdr)(unsafe.Pointer(sh)).Fsh_type == uint32(m_SHT_NOBITS) {
  9569. v4 = int32(m_N_BSS)
  9570. } else {
  9571. v4 = m_N_UNDF
  9572. }
  9573. v2 = v4
  9574. }
  9575. (*Tnlist)(unsafe.Pointer(nl)).Fn_type = libc.Uint8FromInt32(v2)
  9576. }
  9577. break
  9578. }
  9579. if libc.Int32FromUint8((*TElf64_Sym)(unsafe.Pointer(s)).Fst_info)>>int32(4) == int32(m_STB_GLOBAL) || libc.Int32FromUint8((*TElf64_Sym)(unsafe.Pointer(s)).Fst_info)>>int32(4) == int32(m_STB_WEAK) {
  9580. p5 = nl + 8
  9581. *(*uint8)(unsafe.Pointer(p5)) = uint8(int32(*(*uint8)(unsafe.Pointer(p5))) | libc.Int32FromInt32(m_N_EXT))
  9582. }
  9583. }
  9584. func X__fdnlist(tls *libc.TLS, fd int32, list uintptr) (r int32) {
  9585. bp := tls.Alloc(24768)
  9586. defer tls.Free(24768)
  9587. var cc, i TElf64_Sword
  9588. var errsave, nent, v6 int32
  9589. var name, p, s, shdr, strtab uintptr
  9590. var shdr_size, size, symsize, symstrsize TElf64_Word
  9591. var symoff, symstroff TElf64_Off
  9592. var v3 uint64
  9593. var _ /* ehdr at bp+24576 */ TElf64_Ehdr
  9594. var _ /* sbuf at bp+0 */ [1024]TElf64_Sym
  9595. var _ /* st at bp+24640 */ Tstat
  9596. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = cc, errsave, i, name, nent, p, s, shdr, shdr_size, size, strtab, symoff, symsize, symstroff, symstrsize, v3, v6
  9597. symoff = uint64(0)
  9598. symstroff = uint64(0)
  9599. symsize = uint32(0)
  9600. symstrsize = uint32(0)
  9601. nent = -int32(1)
  9602. strtab = libc.UintptrFromInt32(0)
  9603. shdr = libc.UintptrFromInt32(0)
  9604. /* Make sure obj is OK */
  9605. if libc.Xlseek(tls, fd, libc.Int64FromInt32(0), 0) == int64(-int32(1)) || libc.Uint64FromInt64(libc.Xread(tls, fd, bp+24576, uint64(64))) != uint64(64) || !(___elf_is_okay__(tls, bp+24576) != 0) || libc.Xfstat(tls, fd, bp+24640) < 0 {
  9606. return -int32(1)
  9607. }
  9608. if libc.Int32FromUint16((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shnum) == 0 || uint64((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shentsize) != uint64(64) {
  9609. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ERANGE)
  9610. return -int32(1)
  9611. }
  9612. /* calculate section header table size */
  9613. shdr_size = libc.Uint32FromInt32(libc.Int32FromUint16((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shentsize) * libc.Int32FromUint16((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shnum))
  9614. /* Make sure it's not too big to mmap */
  9615. if libc.Int64FromUint32(shdr_size) > (*(*Tstat)(unsafe.Pointer(bp + 24640))).Fst_size {
  9616. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EFBIG)
  9617. return -int32(1)
  9618. }
  9619. shdr = libc.Xmalloc(tls, uint64(shdr_size))
  9620. if shdr == libc.UintptrFromInt32(0) {
  9621. return -int32(1)
  9622. }
  9623. /* Load section header table. */
  9624. if libc.Xpread(tls, fd, shdr, uint64(shdr_size), libc.Int64FromUint64((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shoff)) != libc.Int64FromUint32(shdr_size) {
  9625. goto done
  9626. }
  9627. /*
  9628. * Find the symbol table entry and it's corresponding
  9629. * string table entry. Version 1.1 of the ABI states
  9630. * that there is only one symbol table but that this
  9631. * could change in the future.
  9632. */
  9633. i = 0
  9634. for {
  9635. if !(i < libc.Int32FromUint16((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shnum)) {
  9636. break
  9637. }
  9638. if (*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_type == uint32(m_SHT_SYMTAB) {
  9639. if (*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_link >= uint32((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shnum) {
  9640. goto done
  9641. }
  9642. symoff = (*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_offset
  9643. symsize = uint32((*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_size)
  9644. symstroff = (*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr((*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_link)*64))).Fsh_offset
  9645. symstrsize = uint32((*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr((*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_link)*64))).Fsh_size)
  9646. break
  9647. }
  9648. goto _1
  9649. _1:
  9650. ;
  9651. i++
  9652. }
  9653. /* Check for files too large to mmap. */
  9654. if libc.Int64FromUint32(symstrsize) > (*(*Tstat)(unsafe.Pointer(bp + 24640))).Fst_size {
  9655. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EFBIG)
  9656. goto done
  9657. }
  9658. /*
  9659. * Load string table into our address space. This gives us
  9660. * an easy way to randomly access all the strings, without
  9661. * making the memory allocation permanent as with malloc/free
  9662. * (i.e., munmap will return it to the system).
  9663. */
  9664. strtab = libc.Xmalloc(tls, uint64(symstrsize))
  9665. if strtab == libc.UintptrFromInt32(0) {
  9666. goto done
  9667. }
  9668. if libc.Xpread(tls, fd, strtab, uint64(symstrsize), libc.Int64FromUint64(symstroff)) != libc.Int64FromUint32(symstrsize) {
  9669. goto done
  9670. }
  9671. /*
  9672. * clean out any left-over information for all valid entries.
  9673. * Type and value defined to be 0 if not found; historical
  9674. * versions cleared other and desc as well. Also figure out
  9675. * the largest string length so don't read any more of the
  9676. * string table than we have to.
  9677. *
  9678. * XXX clearing anything other than n_type and n_value violates
  9679. * the semantics given in the man page.
  9680. */
  9681. nent = 0
  9682. p = list
  9683. for {
  9684. if !!(*(*uintptr)(unsafe.Pointer(p)) == uintptr(0) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p))))) == 0) {
  9685. break
  9686. }
  9687. (*Tnlist)(unsafe.Pointer(p)).Fn_type = uint8(0)
  9688. (*Tnlist)(unsafe.Pointer(p)).Fn_other = uint8(0)
  9689. (*Tnlist)(unsafe.Pointer(p)).Fn_desc = 0
  9690. (*Tnlist)(unsafe.Pointer(p)).Fn_value = uint64(0)
  9691. nent++
  9692. goto _2
  9693. _2:
  9694. ;
  9695. p += 24
  9696. }
  9697. /* Don't process any further if object is stripped. */
  9698. if symoff == uint64(0) {
  9699. goto done
  9700. }
  9701. if libc.Xlseek(tls, fd, libc.Int64FromUint64(symoff), 0) == int64(-int32(1)) {
  9702. nent = -int32(1)
  9703. goto done
  9704. }
  9705. for symsize > uint32(0) && nent > 0 {
  9706. if uint64(symsize) < libc.Uint64FromInt64(24576) {
  9707. v3 = uint64(symsize)
  9708. } else {
  9709. v3 = libc.Uint64FromInt64(24576)
  9710. }
  9711. cc = libc.Int32FromUint64(v3)
  9712. if libc.Xread(tls, fd, bp, libc.Uint64FromInt32(cc)) != int64(cc) {
  9713. break
  9714. }
  9715. symsize -= libc.Uint32FromInt32(cc)
  9716. s = bp
  9717. for {
  9718. if !(cc > 0 && nent > 0) {
  9719. break
  9720. }
  9721. name = strtab + uintptr((*TElf64_Sym)(unsafe.Pointer(s)).Fst_name)
  9722. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(name))) == int32('\000') {
  9723. goto _4
  9724. }
  9725. size = symstrsize - (*TElf64_Sym)(unsafe.Pointer(s)).Fst_name
  9726. p = list
  9727. for {
  9728. if !!(*(*uintptr)(unsafe.Pointer(p)) == uintptr(0) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p))))) == 0) {
  9729. break
  9730. }
  9731. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p))))) == int32('_') && libc.Xstrncmp(tls, name, *(*uintptr)(unsafe.Pointer(p))+uintptr(1), uint64(size)) == 0 || libc.Xstrncmp(tls, name, *(*uintptr)(unsafe.Pointer(p)), uint64(size)) == 0 {
  9732. _elf_sym_to_nlist(tls, p, s, shdr, libc.Int32FromUint16((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shnum))
  9733. nent--
  9734. v6 = nent
  9735. if v6 <= 0 {
  9736. break
  9737. }
  9738. }
  9739. goto _5
  9740. _5:
  9741. ;
  9742. p += 24
  9743. }
  9744. goto _4
  9745. _4:
  9746. ;
  9747. s += 24
  9748. cc = TElf64_Sword(uint64(cc) - libc.Uint64FromInt64(24))
  9749. }
  9750. }
  9751. goto done
  9752. done:
  9753. ;
  9754. errsave = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9755. libc.Xfree(tls, strtab)
  9756. libc.Xfree(tls, shdr)
  9757. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = errsave
  9758. return nent
  9759. }
  9760. func Xnlist(tls *libc.TLS, name uintptr, list uintptr) (r int32) {
  9761. bp := tls.Alloc(16)
  9762. defer tls.Free(16)
  9763. var fd, n int32
  9764. _, _ = fd, n
  9765. if list == libc.UintptrFromInt32(0) {
  9766. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  9767. return -int32(1)
  9768. }
  9769. fd = libc.Xopen(tls, name, m_O_RDONLY1, libc.VaList(bp+8, 0))
  9770. if fd < 0 {
  9771. return -int32(1)
  9772. }
  9773. n = X__fdnlist(tls, fd, list)
  9774. libc.Xclose(tls, fd)
  9775. return n
  9776. }
  9777. const m_O_CREAT3 = 64
  9778. const m_O_NONBLOCK3 = 2048
  9779. const m_O_TRUNC3 = 512
  9780. const m_O_WRONLY1 = 1
  9781. type Tpidfh = struct {
  9782. Fpf_fd int32
  9783. Fpf_path uintptr
  9784. Fpf_dev Tdev_t
  9785. Fpf_ino Tino_t
  9786. }
  9787. func _pidfile_verify(tls *libc.TLS, pfh uintptr) (r int32) {
  9788. bp := tls.Alloc(128)
  9789. defer tls.Free(128)
  9790. var _ /* sb at bp+0 */ Tstat
  9791. if pfh == libc.UintptrFromInt32(0) || (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd == -int32(1) {
  9792. return int32(m_EINVAL)
  9793. }
  9794. /*
  9795. * Check remembered descriptor.
  9796. */
  9797. if libc.Xfstat(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd, bp) == -int32(1) {
  9798. return *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9799. }
  9800. 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 {
  9801. return int32(m_EINVAL)
  9802. }
  9803. return 0
  9804. }
  9805. func _pidfile_read(tls *libc.TLS, path uintptr, pidptr uintptr) (r int32) {
  9806. bp := tls.Alloc(32)
  9807. defer tls.Free(32)
  9808. var error1, fd, i int32
  9809. var _ /* buf at bp+0 */ [16]uint8
  9810. var _ /* endptr at bp+16 */ uintptr
  9811. _, _, _ = error1, fd, i
  9812. fd = libc.Xopen(tls, path, m_O_RDONLY1, 0)
  9813. if fd == -int32(1) {
  9814. return *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9815. }
  9816. i = int32(libc.Xread(tls, fd, bp, libc.Uint64FromInt64(16)-libc.Uint64FromInt32(1)))
  9817. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) /* Remember errno in case close() wants to change it. */
  9818. libc.Xclose(tls, fd)
  9819. if i == -int32(1) {
  9820. return error1
  9821. } else {
  9822. if i == 0 {
  9823. return int32(m_EAGAIN)
  9824. }
  9825. }
  9826. (*(*[16]uint8)(unsafe.Pointer(bp)))[i] = uint8('\000')
  9827. *(*Tpid_t)(unsafe.Pointer(pidptr)) = int32(libc.Xstrtol(tls, bp, bp+16, int32(10)))
  9828. if *(*uintptr)(unsafe.Pointer(bp + 16)) != bp+uintptr(i) {
  9829. return int32(m_EINVAL)
  9830. }
  9831. return 0
  9832. }
  9833. func Xpidfile_open(tls *libc.TLS, path uintptr, mode Tmode_t, pidptr uintptr) (r uintptr) {
  9834. bp := tls.Alloc(160)
  9835. defer tls.Free(160)
  9836. var count, error1, fd, len1, v2 int32
  9837. var pfh uintptr
  9838. var v3 bool
  9839. var _ /* rqtp at bp+128 */ Ttimespec
  9840. var _ /* sb at bp+0 */ Tstat
  9841. _, _, _, _, _, _, _ = count, error1, fd, len1, pfh, v2, v3
  9842. pfh = libc.Xmalloc(tls, uint64(32))
  9843. if pfh == libc.UintptrFromInt32(0) {
  9844. return libc.UintptrFromInt32(0)
  9845. }
  9846. if path == libc.UintptrFromInt32(0) {
  9847. len1 = libc.Xasprintf(tls, pfh+8, __ccgo_ts+303, libc.VaList(bp+152, Xgetprogname(tls)))
  9848. if len1 < 0 {
  9849. libc.Xfree(tls, pfh)
  9850. return libc.UintptrFromInt32(0)
  9851. }
  9852. } else {
  9853. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path = libc.Xstrdup(tls, path)
  9854. }
  9855. /*
  9856. * Open the PID file and obtain exclusive lock.
  9857. * We truncate PID file here only to remove old PID immediately,
  9858. * PID file will be truncated again in pidfile_write(), so
  9859. * pidfile_write() can be called multiple times.
  9860. */
  9861. 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+152, mode))
  9862. if fd == -int32(1) {
  9863. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EAGAIN) {
  9864. if pidptr == libc.UintptrFromInt32(0) {
  9865. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EEXIST)
  9866. } else {
  9867. count = int32(20)
  9868. (*(*Ttimespec)(unsafe.Pointer(bp + 128))).Ftv_sec = 0
  9869. (*(*Ttimespec)(unsafe.Pointer(bp + 128))).Ftv_nsec = int64(5000000)
  9870. for {
  9871. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = _pidfile_read(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path, pidptr)
  9872. if v3 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) != int32(m_EAGAIN); !v3 {
  9873. count--
  9874. v2 = count
  9875. }
  9876. if v3 || v2 == 0 {
  9877. break
  9878. }
  9879. libc.Xnanosleep(tls, bp+128, uintptr(0))
  9880. goto _1
  9881. _1:
  9882. }
  9883. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EAGAIN) {
  9884. *(*Tpid_t)(unsafe.Pointer(pidptr)) = -int32(1)
  9885. }
  9886. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == 0 || *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EAGAIN) {
  9887. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EEXIST)
  9888. }
  9889. }
  9890. }
  9891. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9892. libc.Xfree(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  9893. libc.Xfree(tls, pfh)
  9894. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9895. return libc.UintptrFromInt32(0)
  9896. }
  9897. /*
  9898. * Remember file information, so in pidfile_write() we are sure we write
  9899. * to the proper descriptor.
  9900. */
  9901. if libc.Xfstat(tls, fd, bp) == -int32(1) {
  9902. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9903. libc.Xunlink(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  9904. libc.Xfree(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  9905. libc.Xclose(tls, fd)
  9906. libc.Xfree(tls, pfh)
  9907. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9908. return libc.UintptrFromInt32(0)
  9909. }
  9910. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd = fd
  9911. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_dev = (*(*Tstat)(unsafe.Pointer(bp))).Fst_dev
  9912. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_ino = (*(*Tstat)(unsafe.Pointer(bp))).Fst_ino
  9913. return pfh
  9914. }
  9915. func Xpidfile_write(tls *libc.TLS, pfh uintptr) (r int32) {
  9916. bp := tls.Alloc(32)
  9917. defer tls.Free(32)
  9918. var error1, fd int32
  9919. var _ /* pidstr at bp+0 */ [16]uint8
  9920. _, _ = error1, fd
  9921. /*
  9922. * Check remembered descriptor, so we don't overwrite some other
  9923. * file if pidfile was closed and descriptor reused.
  9924. */
  9925. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = _pidfile_verify(tls, pfh)
  9926. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) != 0 {
  9927. /*
  9928. * Don't close descriptor, because we are not sure if it's ours.
  9929. */
  9930. return -int32(1)
  9931. }
  9932. fd = (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd
  9933. /*
  9934. * Truncate PID file, so multiple calls of pidfile_write() are allowed.
  9935. */
  9936. if libc.Xftruncate(tls, fd, 0) == -int32(1) {
  9937. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9938. __pidfile_remove(tls, pfh, 0)
  9939. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9940. return -int32(1)
  9941. }
  9942. libc.X__builtin_snprintf(tls, bp, uint64(16), __ccgo_ts+319, libc.VaList(bp+24, libc.Xgetpid(tls)))
  9943. if libc.Xpwrite(tls, fd, bp, libc.Xstrlen(tls, bp), 0) != libc.Int64FromUint64(libc.Xstrlen(tls, bp)) {
  9944. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9945. __pidfile_remove(tls, pfh, 0)
  9946. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9947. return -int32(1)
  9948. }
  9949. return 0
  9950. }
  9951. func Xpidfile_close(tls *libc.TLS, pfh uintptr) (r int32) {
  9952. var error1 int32
  9953. _ = error1
  9954. error1 = _pidfile_verify(tls, pfh)
  9955. if error1 != 0 {
  9956. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9957. return -int32(1)
  9958. }
  9959. if libc.Xclose(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd) == -int32(1) {
  9960. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9961. }
  9962. libc.Xfree(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  9963. libc.Xfree(tls, pfh)
  9964. if error1 != 0 {
  9965. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9966. return -int32(1)
  9967. }
  9968. return 0
  9969. }
  9970. func __pidfile_remove(tls *libc.TLS, pfh uintptr, freeit int32) (r int32) {
  9971. var error1 int32
  9972. _ = error1
  9973. error1 = _pidfile_verify(tls, pfh)
  9974. if error1 != 0 {
  9975. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9976. return -int32(1)
  9977. }
  9978. if libc.Xunlink(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path) == -int32(1) {
  9979. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9980. }
  9981. if libc.Xclose(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd) == -int32(1) {
  9982. if error1 == 0 {
  9983. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9984. }
  9985. }
  9986. if freeit != 0 {
  9987. libc.Xfree(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  9988. libc.Xfree(tls, pfh)
  9989. } else {
  9990. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd = -int32(1)
  9991. }
  9992. if error1 != 0 {
  9993. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9994. return -int32(1)
  9995. }
  9996. return 0
  9997. }
  9998. func Xpidfile_remove(tls *libc.TLS, pfh uintptr) (r int32) {
  9999. return __pidfile_remove(tls, pfh, int32(1))
  10000. }
  10001. func Xpidfile_fileno(tls *libc.TLS, pfh uintptr) (r int32) {
  10002. if pfh == libc.UintptrFromInt32(0) || (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd == -int32(1) {
  10003. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  10004. return -int32(1)
  10005. }
  10006. return (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd
  10007. }
  10008. func Xgetprogname(tls *libc.TLS) (r uintptr) {
  10009. if libc.Xprogram_invocation_short_name == libc.UintptrFromInt32(0) {
  10010. libc.Xprogram_invocation_short_name = libc.Xprogram_invocation_short_name
  10011. }
  10012. return libc.Xprogram_invocation_short_name
  10013. }
  10014. func Xsetprogname(tls *libc.TLS, progname uintptr) {
  10015. var i Tsize_t
  10016. _ = i
  10017. i = libc.Xstrlen(tls, progname)
  10018. for {
  10019. if !(i > uint64(0)) {
  10020. break
  10021. }
  10022. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(progname + uintptr(i-uint64(1))))) == int32('/') {
  10023. libc.Xprogram_invocation_short_name = progname + uintptr(i)
  10024. return
  10025. }
  10026. goto _1
  10027. _1:
  10028. ;
  10029. i--
  10030. }
  10031. libc.Xprogram_invocation_short_name = progname
  10032. }
  10033. const m_GID_SZ = 251
  10034. const m_GNMLEN = 32
  10035. const m_GNM_SZ = 251
  10036. const m_INVALID = 2
  10037. const m_UID_SZ = 317
  10038. const m_UNMLEN = 32
  10039. const m_UNM_SZ = 317
  10040. const m_VALID = 1
  10041. const m__PW_BUF_LEN = 1024
  10042. type Tgroup = struct {
  10043. Fgr_name uintptr
  10044. Fgr_passwd uintptr
  10045. Fgr_gid Tgid_t
  10046. Fgr_mem uintptr
  10047. }
  10048. type Tpasswd = struct {
  10049. Fpw_name uintptr
  10050. Fpw_passwd uintptr
  10051. Fpw_uid Tuid_t
  10052. Fpw_gid Tgid_t
  10053. Fpw_gecos uintptr
  10054. Fpw_dir uintptr
  10055. Fpw_shell uintptr
  10056. }
  10057. /*
  10058. * Constants and data structures used to implement group and password file
  10059. * caches. Name lengths have been chosen to be as large as those supported
  10060. * by the passwd and group files as well as the standard archive formats.
  10061. * CACHE SIZES MUST BE PRIME
  10062. */
  10063. /*
  10064. * Node structures used in the user, group, uid, and gid caches.
  10065. */
  10066. type TUIDC = struct {
  10067. Fvalid int32
  10068. Fname [32]uint8
  10069. Fuid Tuid_t
  10070. }
  10071. /*
  10072. * Constants and data structures used to implement group and password file
  10073. * caches. Name lengths have been chosen to be as large as those supported
  10074. * by the passwd and group files as well as the standard archive formats.
  10075. * CACHE SIZES MUST BE PRIME
  10076. */
  10077. /*
  10078. * Node structures used in the user, group, uid, and gid caches.
  10079. */
  10080. type Tuidc = TUIDC
  10081. type TGIDC = struct {
  10082. Fvalid int32
  10083. Fname [32]uint8
  10084. Fgid Tgid_t
  10085. }
  10086. type Tgidc = TGIDC
  10087. /*
  10088. * Routines that control user, group, uid and gid caches.
  10089. * Traditional passwd/group cache routines perform quite poorly with
  10090. * archives. The chances of hitting a valid lookup with an archive is quite a
  10091. * bit worse than with files already resident on the file system. These misses
  10092. * create a MAJOR performance cost. To adress this problem, these routines
  10093. * cache both hits and misses.
  10094. */
  10095. var _uidtb uintptr /* uid to name cache */
  10096. var _gidtb uintptr /* gid to name cache */
  10097. var _usrtb uintptr /* user name to uid cache */
  10098. var _grptb uintptr /* group name to gid cache */
  10099. func _st_hash(tls *libc.TLS, name uintptr, len1 Tsize_t, tabsz int32) (r Tu_int) {
  10100. var key Tu_int
  10101. var v1 Tsize_t
  10102. var v2 uintptr
  10103. _, _, _ = key, v1, v2
  10104. key = uint32(0)
  10105. for {
  10106. v1 = len1
  10107. len1--
  10108. if !(v1 != 0) {
  10109. break
  10110. }
  10111. v2 = name
  10112. name++
  10113. key += uint32(*(*uint8)(unsafe.Pointer(v2)))
  10114. key = key<<libc.Int32FromInt32(8) | key>>libc.Int32FromInt32(24)
  10115. }
  10116. return key % libc.Uint32FromInt32(tabsz)
  10117. }
  10118. // C documentation
  10119. //
  10120. // /*
  10121. // * uidtb_start
  10122. // * creates an an empty uidtb
  10123. // * Return:
  10124. // * 0 if ok, -1 otherwise
  10125. // */
  10126. func _uidtb_start(tls *libc.TLS) (r int32) {
  10127. var v1 uintptr
  10128. _ = v1
  10129. if _uidtb != libc.UintptrFromInt32(0) {
  10130. return 0
  10131. }
  10132. if _fail != 0 {
  10133. return -int32(1)
  10134. }
  10135. v1 = libc.Xcalloc(tls, uint64(m_UID_SZ), uint64(8))
  10136. _uidtb = v1
  10137. if v1 == libc.UintptrFromInt32(0) {
  10138. _fail++
  10139. return -int32(1)
  10140. }
  10141. return 0
  10142. }
  10143. var _fail int32
  10144. // C documentation
  10145. //
  10146. // /*
  10147. // * gidtb_start
  10148. // * creates an an empty gidtb
  10149. // * Return:
  10150. // * 0 if ok, -1 otherwise
  10151. // */
  10152. func _gidtb_start(tls *libc.TLS) (r int32) {
  10153. var v1 uintptr
  10154. _ = v1
  10155. if _gidtb != libc.UintptrFromInt32(0) {
  10156. return 0
  10157. }
  10158. if _fail1 != 0 {
  10159. return -int32(1)
  10160. }
  10161. v1 = libc.Xcalloc(tls, uint64(m_GID_SZ), uint64(8))
  10162. _gidtb = v1
  10163. if v1 == libc.UintptrFromInt32(0) {
  10164. _fail1++
  10165. return -int32(1)
  10166. }
  10167. return 0
  10168. }
  10169. var _fail1 int32
  10170. // C documentation
  10171. //
  10172. // /*
  10173. // * usrtb_start
  10174. // * creates an an empty usrtb
  10175. // * Return:
  10176. // * 0 if ok, -1 otherwise
  10177. // */
  10178. func _usrtb_start(tls *libc.TLS) (r int32) {
  10179. var v1 uintptr
  10180. _ = v1
  10181. if _usrtb != libc.UintptrFromInt32(0) {
  10182. return 0
  10183. }
  10184. if _fail2 != 0 {
  10185. return -int32(1)
  10186. }
  10187. v1 = libc.Xcalloc(tls, uint64(m_UNM_SZ), uint64(8))
  10188. _usrtb = v1
  10189. if v1 == libc.UintptrFromInt32(0) {
  10190. _fail2++
  10191. return -int32(1)
  10192. }
  10193. return 0
  10194. }
  10195. var _fail2 int32
  10196. // C documentation
  10197. //
  10198. // /*
  10199. // * grptb_start
  10200. // * creates an an empty grptb
  10201. // * Return:
  10202. // * 0 if ok, -1 otherwise
  10203. // */
  10204. func _grptb_start(tls *libc.TLS) (r int32) {
  10205. var v1 uintptr
  10206. _ = v1
  10207. if _grptb != libc.UintptrFromInt32(0) {
  10208. return 0
  10209. }
  10210. if _fail3 != 0 {
  10211. return -int32(1)
  10212. }
  10213. v1 = libc.Xcalloc(tls, uint64(m_GNM_SZ), uint64(8))
  10214. _grptb = v1
  10215. if v1 == libc.UintptrFromInt32(0) {
  10216. _fail3++
  10217. return -int32(1)
  10218. }
  10219. return 0
  10220. }
  10221. var _fail3 int32
  10222. // C documentation
  10223. //
  10224. // /*
  10225. // * user_from_uid()
  10226. // * caches the name (if any) for the uid. If noname clear, we always
  10227. // * return the stored name (if valid or invalid match).
  10228. // * We use a simple hash table.
  10229. // * Return:
  10230. // * Pointer to stored name (or a empty string)
  10231. // */
  10232. func Xuser_from_uid(tls *libc.TLS, uid Tuid_t, noname int32) (r uintptr) {
  10233. bp := tls.Alloc(1104)
  10234. defer tls.Free(1104)
  10235. var pptr, ptr, v1 uintptr
  10236. var _ /* pw at bp+48 */ uintptr
  10237. var _ /* pwbuf at bp+56 */ [1024]uint8
  10238. var _ /* pwstore at bp+0 */ Tpasswd
  10239. _, _, _ = pptr, ptr, v1
  10240. *(*uintptr)(unsafe.Pointer(bp + 48)) = libc.UintptrFromInt32(0)
  10241. ptr = libc.UintptrFromInt32(0)
  10242. if _uidtb != libc.UintptrFromInt32(0) || _uidtb_start(tls) == 0 {
  10243. /*
  10244. * see if we have this uid cached
  10245. */
  10246. pptr = _uidtb + uintptr(uid%libc.Uint32FromInt32(m_UID_SZ))*8
  10247. ptr = *(*uintptr)(unsafe.Pointer(pptr))
  10248. if ptr != libc.UintptrFromInt32(0) && (*TUIDC)(unsafe.Pointer(ptr)).Fvalid > 0 && (*TUIDC)(unsafe.Pointer(ptr)).Fuid == uid {
  10249. /*
  10250. * have an entry for this uid
  10251. */
  10252. if !(noname != 0) || (*TUIDC)(unsafe.Pointer(ptr)).Fvalid == int32(m_VALID) {
  10253. return ptr + 4
  10254. }
  10255. return libc.UintptrFromInt32(0)
  10256. }
  10257. if ptr == libc.UintptrFromInt32(0) {
  10258. v1 = libc.Xmalloc(tls, uint64(40))
  10259. ptr = v1
  10260. *(*uintptr)(unsafe.Pointer(pptr)) = v1
  10261. }
  10262. }
  10263. libc.Xgetpwuid_r(tls, uid, bp, bp+56, uint64(1024), bp+48)
  10264. if *(*uintptr)(unsafe.Pointer(bp + 48)) == libc.UintptrFromInt32(0) {
  10265. /*
  10266. * no match for this uid in the local password file
  10267. * a string that is the uid in numeric format
  10268. */
  10269. if ptr == libc.UintptrFromInt32(0) {
  10270. return libc.UintptrFromInt32(0)
  10271. }
  10272. (*TUIDC)(unsafe.Pointer(ptr)).Fuid = uid
  10273. libc.X__builtin_snprintf(tls, ptr+4, uint64(m_UNMLEN), __ccgo_ts+319, libc.VaList(bp+1088, uid))
  10274. (*TUIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_INVALID)
  10275. if noname != 0 {
  10276. return libc.UintptrFromInt32(0)
  10277. }
  10278. } else {
  10279. /*
  10280. * there is an entry for this uid in the password file
  10281. */
  10282. if ptr == libc.UintptrFromInt32(0) {
  10283. return (*Tpasswd)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48)))).Fpw_name
  10284. }
  10285. (*TUIDC)(unsafe.Pointer(ptr)).Fuid = uid
  10286. Xstrlcpy(tls, ptr+4, (*Tpasswd)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48)))).Fpw_name, uint64(32))
  10287. (*TUIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_VALID)
  10288. }
  10289. return ptr + 4
  10290. }
  10291. // C documentation
  10292. //
  10293. // /*
  10294. // * group_from_gid()
  10295. // * caches the name (if any) for the gid. If noname clear, we always
  10296. // * return the stored name (if valid or invalid match).
  10297. // * We use a simple hash table.
  10298. // * Return:
  10299. // * Pointer to stored name (or a empty string)
  10300. // */
  10301. func Xgroup_from_gid(tls *libc.TLS, gid Tgid_t, noname int32) (r uintptr) {
  10302. bp := tls.Alloc(2688)
  10303. defer tls.Free(2688)
  10304. var pptr, ptr, v1 uintptr
  10305. var _ /* gr at bp+32 */ uintptr
  10306. var _ /* grbuf at bp+40 */ [2624]uint8
  10307. var _ /* grstore at bp+0 */ Tgroup
  10308. _, _, _ = pptr, ptr, v1
  10309. *(*uintptr)(unsafe.Pointer(bp + 32)) = libc.UintptrFromInt32(0)
  10310. ptr = libc.UintptrFromInt32(0)
  10311. if _gidtb != libc.UintptrFromInt32(0) || _gidtb_start(tls) == 0 {
  10312. /*
  10313. * see if we have this gid cached
  10314. */
  10315. pptr = _gidtb + uintptr(gid%libc.Uint32FromInt32(m_GID_SZ))*8
  10316. ptr = *(*uintptr)(unsafe.Pointer(pptr))
  10317. if ptr != libc.UintptrFromInt32(0) && (*TGIDC)(unsafe.Pointer(ptr)).Fvalid > 0 && (*TGIDC)(unsafe.Pointer(ptr)).Fgid == gid {
  10318. /*
  10319. * have an entry for this gid
  10320. */
  10321. if !(noname != 0) || (*TGIDC)(unsafe.Pointer(ptr)).Fvalid == int32(m_VALID) {
  10322. return ptr + 4
  10323. }
  10324. return libc.UintptrFromInt32(0)
  10325. }
  10326. if ptr == libc.UintptrFromInt32(0) {
  10327. v1 = libc.Xmalloc(tls, uint64(40))
  10328. ptr = v1
  10329. *(*uintptr)(unsafe.Pointer(pptr)) = v1
  10330. }
  10331. }
  10332. libc.Xgetgrgid_r(tls, gid, bp, bp+40, uint64(2624), bp+32)
  10333. if *(*uintptr)(unsafe.Pointer(bp + 32)) == libc.UintptrFromInt32(0) {
  10334. /*
  10335. * no match for this gid in the local group file, put in
  10336. * a string that is the gid in numeric format
  10337. */
  10338. if ptr == libc.UintptrFromInt32(0) {
  10339. return libc.UintptrFromInt32(0)
  10340. }
  10341. (*TGIDC)(unsafe.Pointer(ptr)).Fgid = gid
  10342. libc.X__builtin_snprintf(tls, ptr+4, uint64(m_GNMLEN), __ccgo_ts+319, libc.VaList(bp+2672, gid))
  10343. (*TGIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_INVALID)
  10344. if noname != 0 {
  10345. return libc.UintptrFromInt32(0)
  10346. }
  10347. } else {
  10348. /*
  10349. * there is an entry for this group in the group file
  10350. */
  10351. if ptr == libc.UintptrFromInt32(0) {
  10352. return (*Tgroup)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32)))).Fgr_name
  10353. }
  10354. (*TGIDC)(unsafe.Pointer(ptr)).Fgid = gid
  10355. Xstrlcpy(tls, ptr+4, (*Tgroup)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32)))).Fgr_name, uint64(32))
  10356. (*TGIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_VALID)
  10357. }
  10358. return ptr + 4
  10359. }
  10360. // C documentation
  10361. //
  10362. // /*
  10363. // * uid_from_user()
  10364. // * caches the uid for a given user name. We use a simple hash table.
  10365. // * Return:
  10366. // * 0 if the user name is found (filling in uid), -1 otherwise
  10367. // */
  10368. func Xuid_from_user(tls *libc.TLS, name uintptr, uid uintptr) (r int32) {
  10369. bp := tls.Alloc(1088)
  10370. defer tls.Free(1088)
  10371. var namelen, v1 Tsize_t
  10372. var pptr, ptr, v3 uintptr
  10373. var v2 bool
  10374. var v4 Tuid_t
  10375. var _ /* pw at bp+48 */ uintptr
  10376. var _ /* pwbuf at bp+56 */ [1024]uint8
  10377. var _ /* pwstore at bp+0 */ Tpasswd
  10378. _, _, _, _, _, _, _ = namelen, pptr, ptr, v1, v2, v3, v4
  10379. *(*uintptr)(unsafe.Pointer(bp + 48)) = libc.UintptrFromInt32(0)
  10380. ptr = libc.UintptrFromInt32(0)
  10381. /*
  10382. * return -1 for mangled names
  10383. */
  10384. if v2 = name == libc.UintptrFromInt32(0); !v2 {
  10385. v1 = libc.Xstrlen(tls, name)
  10386. namelen = v1
  10387. }
  10388. if v2 || v1 == uint64(0) {
  10389. return -int32(1)
  10390. }
  10391. if _usrtb != libc.UintptrFromInt32(0) || _usrtb_start(tls) == 0 {
  10392. /*
  10393. * look up in hash table, if found and valid return the uid,
  10394. * if found and invalid, return a -1
  10395. */
  10396. pptr = _usrtb + uintptr(_st_hash(tls, name, namelen, int32(m_UNM_SZ)))*8
  10397. ptr = *(*uintptr)(unsafe.Pointer(pptr))
  10398. if ptr != libc.UintptrFromInt32(0) && (*TUIDC)(unsafe.Pointer(ptr)).Fvalid > 0 && libc.Xstrcmp(tls, name, ptr+4) == 0 {
  10399. if (*TUIDC)(unsafe.Pointer(ptr)).Fvalid == int32(m_INVALID) {
  10400. return -int32(1)
  10401. }
  10402. *(*Tuid_t)(unsafe.Pointer(uid)) = (*TUIDC)(unsafe.Pointer(ptr)).Fuid
  10403. return 0
  10404. }
  10405. if ptr == libc.UintptrFromInt32(0) {
  10406. v3 = libc.Xmalloc(tls, uint64(40))
  10407. ptr = v3
  10408. *(*uintptr)(unsafe.Pointer(pptr)) = v3
  10409. }
  10410. }
  10411. /*
  10412. * no match, look it up, if no match store it as an invalid entry,
  10413. * or store the matching uid
  10414. */
  10415. libc.Xgetpwnam_r(tls, name, bp, bp+56, uint64(1024), bp+48)
  10416. if ptr == libc.UintptrFromInt32(0) {
  10417. if *(*uintptr)(unsafe.Pointer(bp + 48)) == libc.UintptrFromInt32(0) {
  10418. return -int32(1)
  10419. }
  10420. *(*Tuid_t)(unsafe.Pointer(uid)) = (*Tpasswd)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48)))).Fpw_uid
  10421. return 0
  10422. }
  10423. Xstrlcpy(tls, ptr+4, name, uint64(32))
  10424. if *(*uintptr)(unsafe.Pointer(bp + 48)) == libc.UintptrFromInt32(0) {
  10425. (*TUIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_INVALID)
  10426. return -int32(1)
  10427. }
  10428. (*TUIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_VALID)
  10429. v4 = (*Tpasswd)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48)))).Fpw_uid
  10430. (*TUIDC)(unsafe.Pointer(ptr)).Fuid = v4
  10431. *(*Tuid_t)(unsafe.Pointer(uid)) = v4
  10432. return 0
  10433. }
  10434. // C documentation
  10435. //
  10436. // /*
  10437. // * gid_from_group()
  10438. // * caches the gid for a given group name. We use a simple hash table.
  10439. // * Return:
  10440. // * 0 if the group name is found (filling in gid), -1 otherwise
  10441. // */
  10442. func Xgid_from_group(tls *libc.TLS, name uintptr, gid uintptr) (r int32) {
  10443. bp := tls.Alloc(2672)
  10444. defer tls.Free(2672)
  10445. var namelen, v1 Tsize_t
  10446. var pptr, ptr, v3 uintptr
  10447. var v2 bool
  10448. var v4 Tgid_t
  10449. var _ /* gr at bp+32 */ uintptr
  10450. var _ /* grbuf at bp+40 */ [2624]uint8
  10451. var _ /* grstore at bp+0 */ Tgroup
  10452. _, _, _, _, _, _, _ = namelen, pptr, ptr, v1, v2, v3, v4
  10453. *(*uintptr)(unsafe.Pointer(bp + 32)) = libc.UintptrFromInt32(0)
  10454. ptr = libc.UintptrFromInt32(0)
  10455. /*
  10456. * return -1 for mangled names
  10457. */
  10458. if v2 = name == libc.UintptrFromInt32(0); !v2 {
  10459. v1 = libc.Xstrlen(tls, name)
  10460. namelen = v1
  10461. }
  10462. if v2 || v1 == uint64(0) {
  10463. return -int32(1)
  10464. }
  10465. if _grptb != libc.UintptrFromInt32(0) || _grptb_start(tls) == 0 {
  10466. /*
  10467. * look up in hash table, if found and valid return the uid,
  10468. * if found and invalid, return a -1
  10469. */
  10470. pptr = _grptb + uintptr(_st_hash(tls, name, namelen, int32(m_GID_SZ)))*8
  10471. ptr = *(*uintptr)(unsafe.Pointer(pptr))
  10472. if ptr != libc.UintptrFromInt32(0) && (*TGIDC)(unsafe.Pointer(ptr)).Fvalid > 0 && libc.Xstrcmp(tls, name, ptr+4) == 0 {
  10473. if (*TGIDC)(unsafe.Pointer(ptr)).Fvalid == int32(m_INVALID) {
  10474. return -int32(1)
  10475. }
  10476. *(*Tgid_t)(unsafe.Pointer(gid)) = (*TGIDC)(unsafe.Pointer(ptr)).Fgid
  10477. return 0
  10478. }
  10479. if ptr == libc.UintptrFromInt32(0) {
  10480. v3 = libc.Xmalloc(tls, uint64(40))
  10481. ptr = v3
  10482. *(*uintptr)(unsafe.Pointer(pptr)) = v3
  10483. }
  10484. }
  10485. /*
  10486. * no match, look it up, if no match store it as an invalid entry,
  10487. * or store the matching gid
  10488. */
  10489. libc.Xgetgrnam_r(tls, name, bp, bp+40, uint64(2624), bp+32)
  10490. if ptr == libc.UintptrFromInt32(0) {
  10491. if *(*uintptr)(unsafe.Pointer(bp + 32)) == libc.UintptrFromInt32(0) {
  10492. return -int32(1)
  10493. }
  10494. *(*Tgid_t)(unsafe.Pointer(gid)) = (*Tgroup)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32)))).Fgr_gid
  10495. return 0
  10496. }
  10497. Xstrlcpy(tls, ptr+4, name, uint64(32))
  10498. if *(*uintptr)(unsafe.Pointer(bp + 32)) == libc.UintptrFromInt32(0) {
  10499. (*TGIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_INVALID)
  10500. return -int32(1)
  10501. }
  10502. (*TGIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_VALID)
  10503. v4 = (*Tgroup)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32)))).Fgr_gid
  10504. (*TGIDC)(unsafe.Pointer(ptr)).Fgid = v4
  10505. *(*Tgid_t)(unsafe.Pointer(gid)) = v4
  10506. return 0
  10507. }
  10508. const m_SIZE = 512
  10509. const m_THRESHOLD1 = 20
  10510. type Tstack = struct {
  10511. Fsa uintptr
  10512. Fsn int32
  10513. Fsi int32
  10514. }
  10515. func Xradixsort(tls *libc.TLS, a uintptr, n int32, tab uintptr, endch uint32) (r int32) {
  10516. bp := tls.Alloc(256)
  10517. defer tls.Free(256)
  10518. var c uint32
  10519. var tr uintptr
  10520. var _ /* tr0 at bp+0 */ [256]uint8
  10521. _, _ = c, tr
  10522. if tab == libc.UintptrFromInt32(0) {
  10523. tr = bp
  10524. c = uint32(0)
  10525. for {
  10526. if !(c < endch) {
  10527. break
  10528. }
  10529. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(c + uint32(1))
  10530. goto _1
  10531. _1:
  10532. ;
  10533. c++
  10534. }
  10535. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(0)
  10536. c++
  10537. for {
  10538. if !(c < uint32(256)) {
  10539. break
  10540. }
  10541. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(c)
  10542. goto _2
  10543. _2:
  10544. ;
  10545. c++
  10546. }
  10547. endch = uint32(0)
  10548. } else {
  10549. endch = uint32(*(*uint8)(unsafe.Pointer(tab + uintptr(endch))))
  10550. tr = tab
  10551. if endch != uint32(0) && endch != uint32(255) {
  10552. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  10553. return -int32(1)
  10554. }
  10555. }
  10556. _r_sort_a(tls, a, n, 0, tr, endch)
  10557. return 0
  10558. }
  10559. func Xsradixsort(tls *libc.TLS, a uintptr, n int32, tab uintptr, endch uint32) (r int32) {
  10560. bp := tls.Alloc(256)
  10561. defer tls.Free(256)
  10562. var c uint32
  10563. var ta, tr uintptr
  10564. var _ /* tr0 at bp+0 */ [256]uint8
  10565. _, _, _ = c, ta, tr
  10566. if a == libc.UintptrFromInt32(0) {
  10567. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EFAULT)
  10568. return -int32(1)
  10569. }
  10570. if tab == libc.UintptrFromInt32(0) {
  10571. tr = bp
  10572. c = uint32(0)
  10573. for {
  10574. if !(c < endch) {
  10575. break
  10576. }
  10577. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(c + uint32(1))
  10578. goto _1
  10579. _1:
  10580. ;
  10581. c++
  10582. }
  10583. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(0)
  10584. c++
  10585. for {
  10586. if !(c < uint32(256)) {
  10587. break
  10588. }
  10589. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(c)
  10590. goto _2
  10591. _2:
  10592. ;
  10593. c++
  10594. }
  10595. endch = uint32(0)
  10596. } else {
  10597. endch = uint32(*(*uint8)(unsafe.Pointer(tab + uintptr(endch))))
  10598. tr = tab
  10599. if endch != uint32(0) && endch != uint32(255) {
  10600. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  10601. return -int32(1)
  10602. }
  10603. }
  10604. if n < int32(m_THRESHOLD1) {
  10605. _simplesort(tls, a, n, 0, tr, endch)
  10606. } else {
  10607. ta = Xreallocarray(tls, libc.UintptrFromInt32(0), libc.Uint64FromInt32(n), uint64(8))
  10608. if ta == libc.UintptrFromInt32(0) {
  10609. return -int32(1)
  10610. }
  10611. _r_sort_b(tls, a, ta, n, 0, tr, endch)
  10612. libc.Xfree(tls, ta)
  10613. }
  10614. return 0
  10615. }
  10616. // C documentation
  10617. //
  10618. // /* Unstable, in-place sort. */
  10619. func _r_sort_a(tls *libc.TLS, a uintptr, n int32, i int32, tr uintptr, endch uint32) {
  10620. bp := tls.Alloc(10240)
  10621. defer tls.Free(10240)
  10622. var aj, ak, an, cp, r, sp, sp0, sp1, t, v1, v10, v12, v15, v16, v17, v2, v4, v6, v7, v9 uintptr
  10623. var bigc, c, v18, v5, v8 uint32
  10624. var temp Tstack
  10625. var _ /* s at bp+0 */ [512]Tstack
  10626. var _ /* top at bp+8192 */ [256]uintptr
  10627. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  10628. /* Set up stack. */
  10629. sp = bp
  10630. (*Tstack)(unsafe.Pointer(sp)).Fsa = a
  10631. (*Tstack)(unsafe.Pointer(sp)).Fsn = n
  10632. v1 = sp
  10633. sp += 16
  10634. (*Tstack)(unsafe.Pointer(v1)).Fsi = i
  10635. for !(bp >= sp) {
  10636. sp -= 16
  10637. v2 = sp
  10638. a = (*Tstack)(unsafe.Pointer(v2)).Fsa
  10639. n = (*Tstack)(unsafe.Pointer(sp)).Fsn
  10640. i = (*Tstack)(unsafe.Pointer(sp)).Fsi
  10641. if n < int32(m_THRESHOLD1) {
  10642. _simplesort(tls, a, n, i, tr, endch)
  10643. continue
  10644. }
  10645. an = a + uintptr(n)*8
  10646. /* Make character histogram. */
  10647. if _nc == uint32(0) {
  10648. _bmin = uint32(255) /* First occupied bin, excluding eos. */
  10649. ak = a
  10650. for {
  10651. if !(ak < an) {
  10652. break
  10653. }
  10654. v4 = ak
  10655. ak += 8
  10656. c = uint32(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(v4)) + uintptr(i)))))))
  10657. v6 = uintptr(unsafe.Pointer(&_count)) + uintptr(c)*4
  10658. *(*uint32)(unsafe.Pointer(v6))++
  10659. v5 = *(*uint32)(unsafe.Pointer(v6))
  10660. if v5 == uint32(1) && c != endch {
  10661. if c < _bmin {
  10662. _bmin = c
  10663. }
  10664. _nc++
  10665. }
  10666. goto _3
  10667. _3:
  10668. }
  10669. if sp+uintptr(_nc)*16 > bp+uintptr(m_SIZE)*16 { /* Get more stack. */
  10670. _r_sort_a(tls, a, n, i, tr, endch)
  10671. continue
  10672. }
  10673. }
  10674. /*
  10675. * Special case: if all strings have the same
  10676. * character at position i, move on to the next
  10677. * character.
  10678. */
  10679. if _nc == uint32(1) && _count[_bmin] == libc.Uint32FromInt32(n) {
  10680. (*Tstack)(unsafe.Pointer(sp)).Fsa = a
  10681. (*Tstack)(unsafe.Pointer(sp)).Fsn = n
  10682. v7 = sp
  10683. sp += 16
  10684. (*Tstack)(unsafe.Pointer(v7)).Fsi = i + libc.Int32FromInt32(1)
  10685. v8 = libc.Uint32FromInt32(0)
  10686. _count[_bmin] = v8
  10687. _nc = v8
  10688. continue
  10689. }
  10690. /*
  10691. * Set top[]; push incompletely sorted bins onto stack.
  10692. * top[] = pointers to last out-of-place element in bins.
  10693. * count[] = counts of elements in bins.
  10694. * Before permuting: top[c-1] + count[c] = top[c];
  10695. * during deal: top[c] counts down to top[c-1].
  10696. */
  10697. v9 = sp
  10698. sp1 = v9
  10699. sp0 = v9 /* Stack position of biggest bin. */
  10700. bigc = uint32(2) /* Size of biggest bin. */
  10701. if endch == uint32(0) { /* Special case: set top[eos]. */
  10702. v10 = a + uintptr(_count[0])*8
  10703. ak = v10
  10704. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[0] = v10
  10705. } else {
  10706. ak = a
  10707. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[int32(255)] = an
  10708. }
  10709. cp = uintptr(unsafe.Pointer(&_count)) + uintptr(_bmin)*4
  10710. for {
  10711. if !(_nc > uint32(0)) {
  10712. break
  10713. }
  10714. for *(*uint32)(unsafe.Pointer(cp)) == uint32(0) { /* Find next non-empty pile. */
  10715. cp += 4
  10716. }
  10717. if *(*uint32)(unsafe.Pointer(cp)) > uint32(1) {
  10718. if *(*uint32)(unsafe.Pointer(cp)) > bigc {
  10719. bigc = *(*uint32)(unsafe.Pointer(cp))
  10720. sp1 = sp
  10721. }
  10722. (*Tstack)(unsafe.Pointer(sp)).Fsa = ak
  10723. (*Tstack)(unsafe.Pointer(sp)).Fsn = libc.Int32FromUint32(*(*uint32)(unsafe.Pointer(cp)))
  10724. v12 = sp
  10725. sp += 16
  10726. (*Tstack)(unsafe.Pointer(v12)).Fsi = i + libc.Int32FromInt32(1)
  10727. }
  10728. ak += uintptr(*(*uint32)(unsafe.Pointer(cp))) * 8
  10729. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[(int64(cp)-t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_count))))/4] = ak
  10730. _nc--
  10731. goto _11
  10732. _11:
  10733. ;
  10734. cp += 4
  10735. }
  10736. temp = *(*Tstack)(unsafe.Pointer(sp0))
  10737. *(*Tstack)(unsafe.Pointer(sp0)) = *(*Tstack)(unsafe.Pointer(sp1))
  10738. *(*Tstack)(unsafe.Pointer(sp1)) = temp /* Play it safe -- biggest bin last. */
  10739. /*
  10740. * Permute misplacements home. Already home: everything
  10741. * before aj, and in bin[c], items from top[c] on.
  10742. * Inner loop:
  10743. * r = next element to put in place;
  10744. * ak = top[r[i]] = location to put the next element.
  10745. * aj = bottom of 1st disordered bin.
  10746. * Outer loop:
  10747. * Once the 1st disordered bin is done, ie. aj >= ak,
  10748. * aj<-aj + count[c] connects the bins in a linked list;
  10749. * reset count[c].
  10750. */
  10751. aj = a
  10752. for {
  10753. if !(aj < an) {
  10754. break
  10755. }
  10756. r = *(*uintptr)(unsafe.Pointer(aj))
  10757. for {
  10758. v18 = uint32(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(r + uintptr(i)))))))
  10759. c = v18
  10760. v17 = bp + 8192 + uintptr(v18)*8
  10761. *(*uintptr)(unsafe.Pointer(v17)) -= 8
  10762. v16 = *(*uintptr)(unsafe.Pointer(v17))
  10763. v15 = v16
  10764. ak = v15
  10765. if !(aj < v15) {
  10766. break
  10767. }
  10768. t = *(*uintptr)(unsafe.Pointer(ak))
  10769. *(*uintptr)(unsafe.Pointer(ak)) = r
  10770. r = t
  10771. goto _14
  10772. _14:
  10773. }
  10774. goto _13
  10775. _13:
  10776. ;
  10777. *(*uintptr)(unsafe.Pointer(aj)) = r
  10778. aj += uintptr(_count[c]) * 8
  10779. _count[c] = libc.Uint32FromInt32(0)
  10780. }
  10781. }
  10782. }
  10783. var _count [256]uint32
  10784. var _nc uint32
  10785. var _bmin uint32
  10786. // C documentation
  10787. //
  10788. // /* Stable sort, requiring additional memory. */
  10789. func _r_sort_b(tls *libc.TLS, a uintptr, ta uintptr, n int32, i int32, tr uintptr, endch uint32) {
  10790. bp := tls.Alloc(10240)
  10791. defer tls.Free(10240)
  10792. var ai, ak, cp, sp, sp0, sp1, v1, v11, v13, v14, v16, v17, v18, v2, v4, v6, v7, v8 uintptr
  10793. var bigc, c, v10, v5 uint32
  10794. var temp Tstack
  10795. var _ /* s at bp+0 */ [512]Tstack
  10796. var _ /* top at bp+8192 */ [256]uintptr
  10797. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ai, ak, bigc, c, cp, sp, sp0, sp1, temp, v1, v10, v11, v13, v14, v16, v17, v18, v2, v4, v5, v6, v7, v8
  10798. sp = bp
  10799. (*Tstack)(unsafe.Pointer(sp)).Fsa = a
  10800. (*Tstack)(unsafe.Pointer(sp)).Fsn = n
  10801. v1 = sp
  10802. sp += 16
  10803. (*Tstack)(unsafe.Pointer(v1)).Fsi = i
  10804. for !(bp >= sp) {
  10805. sp -= 16
  10806. v2 = sp
  10807. a = (*Tstack)(unsafe.Pointer(v2)).Fsa
  10808. n = (*Tstack)(unsafe.Pointer(sp)).Fsn
  10809. i = (*Tstack)(unsafe.Pointer(sp)).Fsi
  10810. if n < int32(m_THRESHOLD1) {
  10811. _simplesort(tls, a, n, i, tr, endch)
  10812. continue
  10813. }
  10814. if _nc1 == uint32(0) {
  10815. _bmin1 = uint32(255)
  10816. ak = a + uintptr(n)*8
  10817. for {
  10818. ak -= 8
  10819. v4 = ak
  10820. if !(v4 >= a) {
  10821. break
  10822. }
  10823. c = uint32(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ak)) + uintptr(i)))))))
  10824. v6 = uintptr(unsafe.Pointer(&_count1)) + uintptr(c)*4
  10825. *(*uint32)(unsafe.Pointer(v6))++
  10826. v5 = *(*uint32)(unsafe.Pointer(v6))
  10827. if v5 == uint32(1) && c != endch {
  10828. if c < _bmin1 {
  10829. _bmin1 = c
  10830. }
  10831. _nc1++
  10832. }
  10833. goto _3
  10834. _3:
  10835. }
  10836. if sp+uintptr(_nc1)*16 > bp+uintptr(m_SIZE)*16 {
  10837. _r_sort_b(tls, a, ta, n, i, tr, endch)
  10838. continue
  10839. }
  10840. }
  10841. v7 = sp
  10842. sp1 = v7
  10843. sp0 = v7
  10844. bigc = uint32(2)
  10845. if endch == uint32(0) {
  10846. v8 = a + uintptr(_count1[0])*8
  10847. ak = v8
  10848. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[0] = v8
  10849. _count1[0] = uint32(0)
  10850. } else {
  10851. ak = a
  10852. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[int32(255)] = a + uintptr(n)*8
  10853. _count1[int32(255)] = uint32(0)
  10854. }
  10855. cp = uintptr(unsafe.Pointer(&_count1)) + uintptr(_bmin1)*4
  10856. for {
  10857. if !(_nc1 > uint32(0)) {
  10858. break
  10859. }
  10860. for *(*uint32)(unsafe.Pointer(cp)) == uint32(0) {
  10861. cp += 4
  10862. }
  10863. v10 = *(*uint32)(unsafe.Pointer(cp))
  10864. c = v10
  10865. if v10 > uint32(1) {
  10866. if c > bigc {
  10867. bigc = c
  10868. sp1 = sp
  10869. }
  10870. (*Tstack)(unsafe.Pointer(sp)).Fsa = ak
  10871. (*Tstack)(unsafe.Pointer(sp)).Fsn = libc.Int32FromUint32(c)
  10872. v11 = sp
  10873. sp += 16
  10874. (*Tstack)(unsafe.Pointer(v11)).Fsi = i + libc.Int32FromInt32(1)
  10875. }
  10876. ak += uintptr(c) * 8
  10877. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[(int64(cp)-t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_count1))))/4] = ak
  10878. *(*uint32)(unsafe.Pointer(cp)) = uint32(0) /* Reset count[]. */
  10879. _nc1--
  10880. goto _9
  10881. _9:
  10882. ;
  10883. cp += 4
  10884. }
  10885. temp = *(*Tstack)(unsafe.Pointer(sp0))
  10886. *(*Tstack)(unsafe.Pointer(sp0)) = *(*Tstack)(unsafe.Pointer(sp1))
  10887. *(*Tstack)(unsafe.Pointer(sp1)) = temp
  10888. ak = ta + uintptr(n)*8
  10889. ai = a + uintptr(n)*8
  10890. for {
  10891. if !(ak > ta) {
  10892. break
  10893. } /* Copy to temp. */
  10894. ak -= 8
  10895. v13 = ak
  10896. ai -= 8
  10897. v14 = ai
  10898. *(*uintptr)(unsafe.Pointer(v13)) = *(*uintptr)(unsafe.Pointer(v14))
  10899. goto _12
  10900. _12:
  10901. }
  10902. ak = ta + uintptr(n)*8
  10903. for {
  10904. ak -= 8
  10905. v16 = ak
  10906. if !(v16 >= ta) {
  10907. break
  10908. } /* Deal to piles. */
  10909. v18 = bp + 8192 + uintptr(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ak)) + uintptr(i)))))))*8
  10910. *(*uintptr)(unsafe.Pointer(v18)) -= 8
  10911. v17 = *(*uintptr)(unsafe.Pointer(v18))
  10912. *(*uintptr)(unsafe.Pointer(v17)) = *(*uintptr)(unsafe.Pointer(ak))
  10913. goto _15
  10914. _15:
  10915. }
  10916. }
  10917. }
  10918. var _count1 [256]uint32
  10919. var _nc1 uint32
  10920. var _bmin1 uint32
  10921. // C documentation
  10922. //
  10923. // /* insertion sort */
  10924. func _simplesort(tls *libc.TLS, a uintptr, n int32, b int32, tr uintptr, endch uint32) {
  10925. var ai, ak, s, t uintptr
  10926. var ch, v5 uint8
  10927. var v2 int32
  10928. _, _, _, _, _, _, _ = ai, ak, ch, s, t, v2, v5
  10929. ak = a + uintptr(1)*8
  10930. for {
  10931. n--
  10932. v2 = n
  10933. if !(v2 >= int32(1)) {
  10934. break
  10935. }
  10936. ai = ak
  10937. for {
  10938. if !(ai > a) {
  10939. break
  10940. }
  10941. s = *(*uintptr)(unsafe.Pointer(ai)) + uintptr(b)
  10942. t = *(*uintptr)(unsafe.Pointer(ai + uintptr(-libc.Int32FromInt32(1))*8)) + uintptr(b)
  10943. for {
  10944. v5 = *(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(s)))))
  10945. ch = v5
  10946. if !(uint32(v5) != endch) {
  10947. break
  10948. }
  10949. if libc.Int32FromUint8(ch) != libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(t)))))) {
  10950. break
  10951. }
  10952. goto _4
  10953. _4:
  10954. ;
  10955. s++
  10956. t++
  10957. }
  10958. if libc.Int32FromUint8(ch) >= libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(t)))))) {
  10959. break
  10960. }
  10961. s = *(*uintptr)(unsafe.Pointer(ai))
  10962. *(*uintptr)(unsafe.Pointer(ai)) = *(*uintptr)(unsafe.Pointer(ai + uintptr(-libc.Int32FromInt32(1))*8))
  10963. *(*uintptr)(unsafe.Pointer(ai + uintptr(-libc.Int32FromInt32(1))*8)) = s
  10964. goto _3
  10965. _3:
  10966. ;
  10967. ai -= 8
  10968. }
  10969. goto _1
  10970. _1:
  10971. ;
  10972. ak += 8
  10973. }
  10974. }
  10975. const m_B0 = 0000000
  10976. const m_B1000000 = 0010010
  10977. const m_B110 = 0000003
  10978. const m_B115200 = 0010002
  10979. const m_B1152000 = 0010011
  10980. const m_B1200 = 0000011
  10981. const m_B134 = 0000004
  10982. const m_B150 = 0000005
  10983. const m_B1500000 = 0010012
  10984. const m_B1800 = 0000012
  10985. const m_B19200 = 0000016
  10986. const m_B200 = 0000006
  10987. const m_B2000000 = 0010013
  10988. const m_B230400 = 0010003
  10989. const m_B2400 = 0000013
  10990. const m_B2500000 = 0010014
  10991. const m_B300 = 0000007
  10992. const m_B3000000 = 0010015
  10993. const m_B3500000 = 0010016
  10994. const m_B38400 = 0000017
  10995. const m_B4000000 = 0010017
  10996. const m_B460800 = 0010004
  10997. const m_B4800 = 0000014
  10998. const m_B50 = 0000001
  10999. const m_B500000 = 0010005
  11000. const m_B57600 = 0010001
  11001. const m_B576000 = 0010006
  11002. const m_B600 = 0000010
  11003. const m_B75 = 0000002
  11004. const m_B921600 = 0010007
  11005. const m_B9600 = 0000015
  11006. const m_BRKINT = 0000002
  11007. const m_BS0 = 0000000
  11008. const m_BS1 = 0020000
  11009. const m_BSDLY = 0020000
  11010. const m_CBAUD = 0010017
  11011. const m_CBAUDEX = 0010000
  11012. const m_CIBAUD = 002003600000
  11013. const m_CLOCAL = 0004000
  11014. const m_CMSPAR = 010000000000
  11015. const m_CR0 = 0000000
  11016. const m_CR1 = 0001000
  11017. const m_CR2 = 0002000
  11018. const m_CR3 = 0003000
  11019. const m_CRDLY = 0003000
  11020. const m_CREAD = 0000200
  11021. const m_CRTSCTS = 020000000000
  11022. const m_CS5 = 0000000
  11023. const m_CS6 = 0000020
  11024. const m_CS7 = 0000040
  11025. const m_CS8 = 0000060
  11026. const m_CSIZE = 0000060
  11027. const m_CSTOPB = 0000100
  11028. const m_ECHO = 8
  11029. const m_ECHOCTL = 0001000
  11030. const m_ECHOE = 0000020
  11031. const m_ECHOK = 0000040
  11032. const m_ECHOKE = 0004000
  11033. const m_ECHONL = 64
  11034. const m_ECHOPRT = 0002000
  11035. const m_EXTA = 0000016
  11036. const m_EXTB = 0000017
  11037. const m_EXTPROC = 0200000
  11038. const m_FF0 = 0000000
  11039. const m_FF1 = 0100000
  11040. const m_FFDLY = 0100000
  11041. const m_FLUSHO = 0010000
  11042. const m_HUPCL = 0002000
  11043. const m_ICANON = 0000002
  11044. const m_ICRNL = 0000400
  11045. const m_IEXTEN = 0100000
  11046. const m_IGNBRK = 0000001
  11047. const m_IGNCR = 0000200
  11048. const m_IGNPAR = 0000004
  11049. const m_IMAXBEL = 0020000
  11050. const m_INLCR = 0000100
  11051. const m_INPCK = 0000020
  11052. const m_ISIG = 0000001
  11053. const m_ISTRIP = 0000040
  11054. const m_IUCLC = 0001000
  11055. const m_IUTF8 = 0040000
  11056. const m_IXANY = 0004000
  11057. const m_IXOFF = 0010000
  11058. const m_IXON = 0002000
  11059. const m_NCCS = 32
  11060. const m_NL0 = 0000000
  11061. const m_NL1 = 0000400
  11062. const m_NLDLY = 0000400
  11063. const m_NOFLSH = 0000200
  11064. const m_OCRNL = 0000010
  11065. const m_OFDEL = 0000200
  11066. const m_OFILL = 0000100
  11067. const m_OLCUC = 0000002
  11068. const m_ONLCR = 0000004
  11069. const m_ONLRET = 0000040
  11070. const m_ONOCR = 0000020
  11071. const m_OPOST = 0000001
  11072. const m_O_CREAT4 = 0100
  11073. const m_O_NONBLOCK4 = 04000
  11074. const m_O_RDONLY2 = 00
  11075. const m_O_RDWR1 = 2
  11076. const m_O_TRUNC4 = 01000
  11077. const m_O_WRONLY2 = 01
  11078. const m_PARENB = 0000400
  11079. const m_PARMRK = 0000010
  11080. const m_PARODD = 0001000
  11081. const m_PENDIN = 0040000
  11082. const m_RPP_ECHO_OFF = 0x00
  11083. const m_RPP_ECHO_ON = 1
  11084. const m_RPP_FORCELOWER = 4
  11085. const m_RPP_FORCEUPPER = 8
  11086. const m_RPP_REQUIRE_TTY = 2
  11087. const m_RPP_SEVENBIT = 16
  11088. const m_RPP_STDIN = 32
  11089. const m_TAB0 = 0000000
  11090. const m_TAB1 = 0004000
  11091. const m_TAB2 = 0010000
  11092. const m_TAB3 = 0014000
  11093. const m_TABDLY = 0014000
  11094. const m_TCIFLUSH = 0
  11095. const m_TCIOFF = 2
  11096. const m_TCIOFLUSH = 2
  11097. const m_TCION = 3
  11098. const m_TCOFLUSH = 1
  11099. const m_TCOOFF = 0
  11100. const m_TCOON = 1
  11101. const m_TCSADRAIN = 1
  11102. const m_TCSAFLUSH = 2
  11103. const m_TCSANOW = 0
  11104. const m_TCSASOFT = 0
  11105. const m_TOSTOP = 0000400
  11106. const m_VDISCARD = 13
  11107. const m_VEOF = 4
  11108. const m_VEOL = 11
  11109. const m_VEOL2 = 16
  11110. const m_VERASE = 2
  11111. const m_VINTR = 0
  11112. const m_VKILL = 3
  11113. const m_VLNEXT = 15
  11114. const m_VMIN = 6
  11115. const m_VQUIT = 1
  11116. const m_VREPRINT = 12
  11117. const m_VSTART = 8
  11118. const m_VSTOP = 9
  11119. const m_VSUSP = 10
  11120. const m_VSWTC = 7
  11121. const m_VT0 = 0000000
  11122. const m_VT1 = 0040000
  11123. const m_VTDLY = 0040000
  11124. const m_VTIME = 5
  11125. const m_VWERASE = 14
  11126. const m_XCASE = 0000004
  11127. const m_XTABS = 0014000
  11128. const m__PATH_BSHELL = "/bin/sh"
  11129. const m__PATH_CONSOLE = "/dev/console"
  11130. const m__PATH_DEFPATH = "/usr/local/bin:/bin:/usr/bin"
  11131. const m__PATH_DEV = "/dev/"
  11132. const m__PATH_DEVNULL = "/dev/null"
  11133. const m__PATH_KLOG = "/proc/kmsg"
  11134. const m__PATH_LASTLOG = "/var/log/lastlog"
  11135. const m__PATH_MAILDIR = "/var/mail"
  11136. const m__PATH_MAN = "/usr/share/man"
  11137. const m__PATH_MNTTAB = "/etc/fstab"
  11138. const m__PATH_MOUNTED = "/etc/mtab"
  11139. const m__PATH_NOLOGIN = "/etc/nologin"
  11140. const m__PATH_SENDMAIL = "/usr/sbin/sendmail"
  11141. const m__PATH_SHADOW = "/etc/shadow"
  11142. const m__PATH_SHELLS = "/etc/shells"
  11143. const m__PATH_STDPATH = "/bin:/usr/bin:/sbin:/usr/sbin"
  11144. const m__PATH_TMP = "/tmp/"
  11145. const m__PATH_TTY = "/dev/tty"
  11146. const m__PATH_UTMP = "/dev/null/utmp"
  11147. const m__PATH_VARDB = "/var/lib/misc/"
  11148. const m__PATH_VARRUN = "/var/run/"
  11149. const m__PATH_VARTMP = "/var/tmp/"
  11150. const m__PATH_VI = "/usr/bin/vi"
  11151. const m__PATH_WTMP = "/dev/null/wtmp"
  11152. type Twinsize = struct {
  11153. Fws_row uint16
  11154. Fws_col uint16
  11155. Fws_xpixel uint16
  11156. Fws_ypixel uint16
  11157. }
  11158. type Tcc_t = uint8
  11159. type Tspeed_t = uint32
  11160. type Ttcflag_t = uint32
  11161. type Ttermios = struct {
  11162. Fc_iflag Ttcflag_t
  11163. Fc_oflag Ttcflag_t
  11164. Fc_cflag Ttcflag_t
  11165. Fc_lflag Ttcflag_t
  11166. Fc_line Tcc_t
  11167. Fc_cc [32]Tcc_t
  11168. F__c_ispeed Tspeed_t
  11169. F__c_ospeed Tspeed_t
  11170. }
  11171. var _signo [65]Tsig_atomic_t
  11172. func Xreadpassphrase(tls *libc.TLS, prompt uintptr, buf uintptr, bufsiz Tsize_t, flags int32) (r uintptr) {
  11173. bp := tls.Alloc(1648)
  11174. defer tls.Free(1648)
  11175. var end, p, v6, v8 uintptr
  11176. var i, input, need_restart, output, save_errno, sigttou, v2, v3 int32
  11177. var nr, v5 Tssize_t
  11178. var v4 bool
  11179. var _ /* ch at bp+0 */ uint8
  11180. var _ /* oterm at bp+64 */ Ttermios
  11181. var _ /* sa at bp+128 */ Tsigaction
  11182. var _ /* savealrm at bp+280 */ Tsigaction
  11183. var _ /* savehup at bp+584 */ Tsigaction
  11184. var _ /* saveint at bp+432 */ Tsigaction
  11185. var _ /* savepipe at bp+1496 */ Tsigaction
  11186. var _ /* savequit at bp+736 */ Tsigaction
  11187. var _ /* saveterm at bp+888 */ Tsigaction
  11188. var _ /* savetstp at bp+1040 */ Tsigaction
  11189. var _ /* savettin at bp+1192 */ Tsigaction
  11190. var _ /* savettou at bp+1344 */ Tsigaction
  11191. var _ /* term at bp+4 */ Ttermios
  11192. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = end, i, input, need_restart, nr, output, p, save_errno, sigttou, v2, v3, v4, v5, v6, v8
  11193. /* I suppose we could alloc on demand in this case (XXX). */
  11194. if bufsiz == uint64(0) {
  11195. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11196. return libc.UintptrFromInt32(0)
  11197. }
  11198. goto restart
  11199. restart:
  11200. ;
  11201. i = 0
  11202. for {
  11203. if !(i < int32(m__NSIG)) {
  11204. break
  11205. }
  11206. libc.AtomicStorePInt32(uintptr(unsafe.Pointer(&_signo))+uintptr(i)*4, 0)
  11207. goto _1
  11208. _1:
  11209. ;
  11210. i++
  11211. }
  11212. nr = int64(-int32(1))
  11213. save_errno = 0
  11214. need_restart = 0
  11215. /*
  11216. * Read and write to /dev/tty if available. If not, read from
  11217. * stdin and write to stderr unless a tty is required.
  11218. */
  11219. if v4 = flags&int32(m_RPP_STDIN) != 0; !v4 {
  11220. v3 = libc.Xopen(tls, __ccgo_ts+322, int32(m_O_RDWR1), 0)
  11221. output = v3
  11222. v2 = v3
  11223. input = v2
  11224. }
  11225. if v4 || v2 == -int32(1) {
  11226. if flags&int32(m_RPP_REQUIRE_TTY) != 0 {
  11227. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOTTY)
  11228. return libc.UintptrFromInt32(0)
  11229. }
  11230. input = m_STDIN_FILENO
  11231. output = int32(m_STDERR_FILENO)
  11232. }
  11233. /*
  11234. * Turn off echo if possible.
  11235. * If we are using a tty but are not the foreground pgrp this will
  11236. * generate SIGTTOU, so do it *before* installing the signal handlers.
  11237. */
  11238. if input != m_STDIN_FILENO && libc.Xtcgetattr(tls, input, bp+64) == 0 {
  11239. libc.Xmemcpy(tls, bp+4, bp+64, uint64(60))
  11240. if !(flags&libc.Int32FromInt32(m_RPP_ECHO_ON) != 0) {
  11241. (*(*Ttermios)(unsafe.Pointer(bp + 4))).Fc_lflag &= libc.Uint32FromInt32(^(libc.Int32FromInt32(m_ECHO) | libc.Int32FromInt32(m_ECHONL)))
  11242. }
  11243. libc.Xtcsetattr(tls, input, libc.Int32FromInt32(m_TCSAFLUSH)|libc.Int32FromInt32(m_TCSASOFT), bp+4)
  11244. } else {
  11245. libc.Xmemset(tls, bp+4, 0, uint64(60))
  11246. (*(*Ttermios)(unsafe.Pointer(bp + 4))).Fc_lflag |= uint32(m_ECHO)
  11247. libc.Xmemset(tls, bp+64, 0, uint64(60))
  11248. (*(*Ttermios)(unsafe.Pointer(bp + 64))).Fc_lflag |= uint32(m_ECHO)
  11249. }
  11250. /*
  11251. * Catch signals that would otherwise cause the user to end
  11252. * up with echo turned off in the shell. Don't worry about
  11253. * things like SIGXCPU and SIGVTALRM for now.
  11254. */
  11255. libc.Xsigemptyset(tls, bp+128+8)
  11256. (*(*Tsigaction)(unsafe.Pointer(bp + 128))).Fsa_flags = 0 /* don't restart system calls */
  11257. *(*uintptr)(unsafe.Pointer(bp + 128)) = __ccgo_fp(_handler)
  11258. libc.Xsigaction(tls, int32(m_SIGALRM), bp+128, bp+280)
  11259. libc.Xsigaction(tls, int32(m_SIGHUP), bp+128, bp+584)
  11260. libc.Xsigaction(tls, int32(m_SIGINT), bp+128, bp+432)
  11261. libc.Xsigaction(tls, int32(m_SIGPIPE), bp+128, bp+1496)
  11262. libc.Xsigaction(tls, int32(m_SIGQUIT), bp+128, bp+736)
  11263. libc.Xsigaction(tls, int32(m_SIGTERM), bp+128, bp+888)
  11264. libc.Xsigaction(tls, int32(m_SIGTSTP), bp+128, bp+1040)
  11265. libc.Xsigaction(tls, int32(m_SIGTTIN), bp+128, bp+1192)
  11266. libc.Xsigaction(tls, int32(m_SIGTTOU), bp+128, bp+1344)
  11267. if !(flags&libc.Int32FromInt32(m_RPP_STDIN) != 0) {
  11268. libc.Xwrite(tls, output, prompt, libc.Xstrlen(tls, prompt))
  11269. }
  11270. end = buf + uintptr(bufsiz) - uintptr(1)
  11271. p = buf
  11272. for {
  11273. v5 = libc.Xread(tls, input, bp, uint64(1))
  11274. nr = v5
  11275. if !(v5 == int64(1) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp))) != int32('\n') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp))) != int32('\r')) {
  11276. break
  11277. }
  11278. if p < end {
  11279. if flags&int32(m_RPP_SEVENBIT) != 0 {
  11280. *(*uint8)(unsafe.Pointer(bp)) = uint8(int32(*(*uint8)(unsafe.Pointer(bp))) & libc.Int32FromInt32(0x7f))
  11281. }
  11282. if libc.BoolInt32(uint32(*(*uint8)(unsafe.Pointer(bp)))|uint32(32)-uint32('a') < uint32(26)) != 0 {
  11283. if flags&int32(m_RPP_FORCELOWER) != 0 {
  11284. *(*uint8)(unsafe.Pointer(bp)) = libc.Uint8FromInt32(libc.Xtolower(tls, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp)))))
  11285. }
  11286. if flags&int32(m_RPP_FORCEUPPER) != 0 {
  11287. *(*uint8)(unsafe.Pointer(bp)) = libc.Uint8FromInt32(libc.Xtoupper(tls, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp)))))
  11288. }
  11289. }
  11290. v6 = p
  11291. p++
  11292. *(*uint8)(unsafe.Pointer(v6)) = *(*uint8)(unsafe.Pointer(bp))
  11293. }
  11294. }
  11295. *(*uint8)(unsafe.Pointer(p)) = uint8('\000')
  11296. save_errno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  11297. if !((*(*Ttermios)(unsafe.Pointer(bp + 4))).Fc_lflag&libc.Uint32FromInt32(m_ECHO) != 0) {
  11298. libc.Xwrite(tls, output, __ccgo_ts+331, uint64(1))
  11299. }
  11300. /* Restore old terminal settings and signals. */
  11301. if libc.Xmemcmp(tls, bp+4, bp+64, uint64(60)) != 0 {
  11302. sigttou = libc.AtomicLoadPInt32(uintptr(unsafe.Pointer(&_signo)) + libc.UintptrFromInt32(m_SIGTTOU)*4)
  11303. /* Ignore SIGTTOU generated when we are not the fg pgrp. */
  11304. 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) {
  11305. continue
  11306. }
  11307. libc.AtomicStorePInt32(uintptr(unsafe.Pointer(&_signo))+22*4, sigttou)
  11308. }
  11309. libc.Xsigaction(tls, int32(m_SIGALRM), bp+280, libc.UintptrFromInt32(0))
  11310. libc.Xsigaction(tls, int32(m_SIGHUP), bp+584, libc.UintptrFromInt32(0))
  11311. libc.Xsigaction(tls, int32(m_SIGINT), bp+432, libc.UintptrFromInt32(0))
  11312. libc.Xsigaction(tls, int32(m_SIGQUIT), bp+736, libc.UintptrFromInt32(0))
  11313. libc.Xsigaction(tls, int32(m_SIGPIPE), bp+1496, libc.UintptrFromInt32(0))
  11314. libc.Xsigaction(tls, int32(m_SIGTERM), bp+888, libc.UintptrFromInt32(0))
  11315. libc.Xsigaction(tls, int32(m_SIGTSTP), bp+1040, libc.UintptrFromInt32(0))
  11316. libc.Xsigaction(tls, int32(m_SIGTTIN), bp+1192, libc.UintptrFromInt32(0))
  11317. libc.Xsigaction(tls, int32(m_SIGTTOU), bp+1344, libc.UintptrFromInt32(0))
  11318. if input != m_STDIN_FILENO {
  11319. libc.Xclose(tls, input)
  11320. }
  11321. /*
  11322. * If we were interrupted by a signal, resend it to ourselves
  11323. * now that we have restored the signal handlers.
  11324. */
  11325. i = 0
  11326. for {
  11327. if !(i < int32(m__NSIG)) {
  11328. break
  11329. }
  11330. if libc.AtomicLoadPInt32(uintptr(unsafe.Pointer(&_signo))+uintptr(i)*4) != 0 {
  11331. libc.Xkill(tls, libc.Xgetpid(tls), i)
  11332. switch i {
  11333. case int32(m_SIGTSTP):
  11334. fallthrough
  11335. case int32(m_SIGTTIN):
  11336. fallthrough
  11337. case int32(m_SIGTTOU):
  11338. need_restart = int32(1)
  11339. }
  11340. }
  11341. goto _7
  11342. _7:
  11343. ;
  11344. i++
  11345. }
  11346. if need_restart != 0 {
  11347. goto restart
  11348. }
  11349. if save_errno != 0 {
  11350. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = save_errno
  11351. }
  11352. if nr == int64(-int32(1)) {
  11353. v8 = libc.UintptrFromInt32(0)
  11354. } else {
  11355. v8 = buf
  11356. }
  11357. return v8
  11358. }
  11359. func _handler(tls *libc.TLS, s int32) {
  11360. libc.AtomicStorePInt32(uintptr(unsafe.Pointer(&_signo))+uintptr(s)*4, int32(1))
  11361. }
  11362. const m_UINT64_MAX1 = 18446744073709551615
  11363. /*
  11364. * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
  11365. * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
  11366. */
  11367. func Xreallocarray(tls *libc.TLS, optr uintptr, nmemb Tsize_t, size Tsize_t) (r uintptr) {
  11368. if (nmemb >= libc.Uint64FromInt32(1)<<(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(4)) || size >= libc.Uint64FromInt32(1)<<(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(4))) && nmemb > uint64(0) && uint64(0xffffffffffffffff)/nmemb < size {
  11369. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOMEM)
  11370. return libc.UintptrFromInt32(0)
  11371. }
  11372. return libc.Xrealloc(tls, optr, size*nmemb)
  11373. }
  11374. const m_UINT64_MAX2 = "0xffffffffffffffffu"
  11375. func Xreallocf(tls *libc.TLS, ptr uintptr, size Tsize_t) (r uintptr) {
  11376. var nptr uintptr
  11377. _ = nptr
  11378. nptr = libc.Xrealloc(tls, ptr, size)
  11379. /*
  11380. * When the System V compatibility option (malloc "V" flag) is
  11381. * in effect, realloc(ptr, 0) frees the memory and returns NULL.
  11382. * So, to avoid double free, call free() only when size != 0.
  11383. * realloc(ptr, 0) can't fail when ptr != NULL.
  11384. */
  11385. if !(nptr != 0) && ptr != 0 && size != uint64(0) {
  11386. libc.Xfree(tls, ptr)
  11387. }
  11388. return nptr
  11389. }
  11390. const m_UINT64_MAX3 = 18446744073709551615
  11391. /*
  11392. * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
  11393. * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
  11394. */
  11395. func Xrecallocarray(tls *libc.TLS, ptr uintptr, oldnmemb Tsize_t, newnmemb Tsize_t, size Tsize_t) (r uintptr) {
  11396. var d, newsize, oldsize Tsize_t
  11397. var newptr uintptr
  11398. _, _, _, _ = d, newptr, newsize, oldsize
  11399. if ptr == libc.UintptrFromInt32(0) {
  11400. return libc.Xcalloc(tls, newnmemb, size)
  11401. }
  11402. if (newnmemb >= libc.Uint64FromInt32(1)<<(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(4)) || size >= libc.Uint64FromInt32(1)<<(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(4))) && newnmemb > uint64(0) && uint64(0xffffffffffffffff)/newnmemb < size {
  11403. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOMEM)
  11404. return libc.UintptrFromInt32(0)
  11405. }
  11406. newsize = newnmemb * size
  11407. if (oldnmemb >= libc.Uint64FromInt32(1)<<(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(4)) || size >= libc.Uint64FromInt32(1)<<(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(4))) && oldnmemb > uint64(0) && uint64(0xffffffffffffffff)/oldnmemb < size {
  11408. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11409. return libc.UintptrFromInt32(0)
  11410. }
  11411. oldsize = oldnmemb * size
  11412. /*
  11413. * Don't bother too much if we're shrinking just a bit,
  11414. * we do not shrink for series of small steps, oh well.
  11415. */
  11416. if newsize <= oldsize {
  11417. d = oldsize - newsize
  11418. if d < oldsize/uint64(2) && d < libc.Uint64FromInt32(libc.Xgetpagesize(tls)) {
  11419. libc.Xmemset(tls, ptr+uintptr(newsize), 0, d)
  11420. return ptr
  11421. }
  11422. }
  11423. newptr = libc.Xmalloc(tls, newsize)
  11424. if newptr == libc.UintptrFromInt32(0) {
  11425. return libc.UintptrFromInt32(0)
  11426. }
  11427. if newsize > oldsize {
  11428. libc.Xmemcpy(tls, newptr, ptr, oldsize)
  11429. libc.Xmemset(tls, newptr+uintptr(oldsize), 0, newsize-oldsize)
  11430. } else {
  11431. libc.Xmemcpy(tls, newptr, ptr, newsize)
  11432. }
  11433. Xexplicit_bzero(tls, ptr, oldsize)
  11434. libc.Xfree(tls, ptr)
  11435. return newptr
  11436. }
  11437. const m_CMD2_CLR = 1
  11438. const m_CMD2_GBITS = 4
  11439. const m_CMD2_OBITS = 8
  11440. const m_CMD2_SET = 2
  11441. const m_CMD2_UBITS = 16
  11442. const m_SET_LEN = 6
  11443. const m_SET_LEN_INCR = 4
  11444. const m_S_IFDIR1 = 16384
  11445. const m_S_IRGRP1 = 32
  11446. const m_S_IROTH1 = 4
  11447. const m_S_IRUSR1 = 256
  11448. const m_S_IRWXG1 = 56
  11449. const m_S_IRWXO1 = 7
  11450. const m_S_IRWXU1 = 448
  11451. const m_S_ISGID1 = 1024
  11452. const m_S_ISUID1 = 2048
  11453. const m_S_ISVTX1 = 512
  11454. const m_S_IWGRP1 = 16
  11455. const m_S_IWOTH1 = 2
  11456. const m_S_IWUSR1 = 128
  11457. const m_S_IXGRP1 = 8
  11458. const m_S_IXOTH1 = 1
  11459. const m_S_IXUSR1 = 64
  11460. const m_UINT64_MAX4 = "0xffffffffffffffffu"
  11461. const m___LONG_MAX1 = 9223372036854775807
  11462. type TBITCMD = struct {
  11463. Fcmd uint8
  11464. Fcmd2 uint8
  11465. Fbits Tmode_t
  11466. }
  11467. type Tbitcmd = TBITCMD
  11468. // C documentation
  11469. //
  11470. // /*
  11471. // * Given the old mode and an array of bitcmd structures, apply the operations
  11472. // * described in the bitcmd structures to the old mode, and return the new mode.
  11473. // * Note that there is no '=' command; a strict assignment is just a '-' (clear
  11474. // * bits) followed by a '+' (set bits).
  11475. // */
  11476. func Xgetmode(tls *libc.TLS, bbox uintptr, omode Tmode_t) (r Tmode_t) {
  11477. var clrval, newmode, value Tmode_t
  11478. var set uintptr
  11479. var v11 uint32
  11480. _, _, _, _, _ = clrval, newmode, set, value, v11
  11481. set = bbox
  11482. newmode = omode
  11483. value = uint32(0)
  11484. for {
  11485. switch libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd) {
  11486. case int32('u'):
  11487. goto _2
  11488. case int32('g'):
  11489. goto _3
  11490. case int32('o'):
  11491. goto _4
  11492. case int32('+'):
  11493. goto _5
  11494. case int32('-'):
  11495. goto _6
  11496. case int32('X'):
  11497. goto _7
  11498. default:
  11499. goto _8
  11500. case int32('\000'):
  11501. goto _9
  11502. }
  11503. goto _10
  11504. /*
  11505. * When copying the user, group or other bits around, we "know"
  11506. * where the bits are in the mode so that we can do shifts to
  11507. * copy them around. If we don't use shifts, it gets real
  11508. * grundgy with lots of single bit checks and bit sets.
  11509. */
  11510. _2:
  11511. ;
  11512. value = newmode & uint32(m_S_IRWXU1) >> int32(6)
  11513. goto common
  11514. _3:
  11515. ;
  11516. value = newmode & uint32(m_S_IRWXG1) >> int32(3)
  11517. goto common
  11518. _4:
  11519. ;
  11520. value = newmode & uint32(m_S_IRWXO1)
  11521. goto common
  11522. common:
  11523. ;
  11524. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_CLR) != 0 {
  11525. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_SET) != 0 {
  11526. v11 = uint32(m_S_IRWXO1)
  11527. } else {
  11528. v11 = value
  11529. }
  11530. clrval = v11
  11531. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_UBITS) != 0 {
  11532. newmode &= ^(clrval << libc.Int32FromInt32(6) & (*TBITCMD)(unsafe.Pointer(set)).Fbits)
  11533. }
  11534. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_GBITS) != 0 {
  11535. newmode &= ^(clrval << libc.Int32FromInt32(3) & (*TBITCMD)(unsafe.Pointer(set)).Fbits)
  11536. }
  11537. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_OBITS) != 0 {
  11538. newmode &= ^(clrval & (*TBITCMD)(unsafe.Pointer(set)).Fbits)
  11539. }
  11540. }
  11541. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_SET) != 0 {
  11542. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_UBITS) != 0 {
  11543. newmode |= value << libc.Int32FromInt32(6) & (*TBITCMD)(unsafe.Pointer(set)).Fbits
  11544. }
  11545. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_GBITS) != 0 {
  11546. newmode |= value << libc.Int32FromInt32(3) & (*TBITCMD)(unsafe.Pointer(set)).Fbits
  11547. }
  11548. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_OBITS) != 0 {
  11549. newmode |= value & (*TBITCMD)(unsafe.Pointer(set)).Fbits
  11550. }
  11551. }
  11552. goto _10
  11553. _5:
  11554. ;
  11555. newmode |= (*TBITCMD)(unsafe.Pointer(set)).Fbits
  11556. goto _10
  11557. _6:
  11558. ;
  11559. newmode &= ^(*TBITCMD)(unsafe.Pointer(set)).Fbits
  11560. goto _10
  11561. _7:
  11562. ;
  11563. 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 {
  11564. newmode |= (*TBITCMD)(unsafe.Pointer(set)).Fbits
  11565. }
  11566. goto _10
  11567. _9:
  11568. ;
  11569. _8:
  11570. ;
  11571. return newmode
  11572. _10:
  11573. ;
  11574. goto _1
  11575. _1:
  11576. ;
  11577. set += 8
  11578. }
  11579. return r
  11580. }
  11581. func Xsetmode(tls *libc.TLS, p uintptr) (r uintptr) {
  11582. bp := tls.Alloc(272)
  11583. defer tls.Free(272)
  11584. var endset, newset, newset1, newset2, newset3, newset4, newset5, saveset, set, v5 uintptr
  11585. var equalopdone, serrno, setlen int32
  11586. var lval int64
  11587. var mask, perm, permXbits, who, v1 Tmode_t
  11588. var op, v4 uint8
  11589. var setdiff, setdiff1, setdiff2, setdiff3, setdiff4, setdiff5 Tptrdiff_t
  11590. var _ /* ep at bp+0 */ uintptr
  11591. var _ /* signset at bp+8 */ Tsigset_t
  11592. var _ /* sigoset at bp+136 */ Tsigset_t
  11593. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  11594. equalopdone = 0
  11595. if !(*(*uint8)(unsafe.Pointer(p)) != 0) {
  11596. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11597. return libc.UintptrFromInt32(0)
  11598. }
  11599. /*
  11600. * Get a copy of the mask for the permissions that are mask relative.
  11601. * Flip the bits, we want what's not set. Since it's possible that
  11602. * the caller is opening files inside a signal handler, protect them
  11603. * as best we can.
  11604. */
  11605. libc.Xsigfillset(tls, bp+8)
  11606. libc.Xsigprocmask(tls, m_SIG_BLOCK, bp+8, bp+136)
  11607. v1 = libc.Xumask(tls, uint32(0))
  11608. mask = v1
  11609. libc.Xumask(tls, v1)
  11610. mask = ^mask
  11611. libc.Xsigprocmask(tls, int32(m_SIG_SETMASK), bp+136, libc.UintptrFromInt32(0))
  11612. setlen = libc.Int32FromInt32(m_SET_LEN) + libc.Int32FromInt32(2)
  11613. set = Xreallocarray(tls, libc.UintptrFromInt32(0), libc.Uint64FromInt32(setlen), uint64(8))
  11614. if set == libc.UintptrFromInt32(0) {
  11615. return libc.UintptrFromInt32(0)
  11616. }
  11617. saveset = set
  11618. endset = set + uintptr(setlen-libc.Int32FromInt32(2))*8
  11619. /*
  11620. * If an absolute number, get it and return; disallow non-octal digits
  11621. * or illegal bits.
  11622. */
  11623. if libc.BoolInt32(uint32(*(*uint8)(unsafe.Pointer(p)))-uint32('0') < uint32(10)) != 0 {
  11624. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  11625. lval = libc.Xstrtol(tls, p, bp, int32(8))
  11626. if *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))) != 0 {
  11627. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11628. goto out
  11629. }
  11630. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_ERANGE) && (lval == int64(0x7fffffffffffffff) || lval == -libc.Int64FromInt64(0x7fffffffffffffff)-libc.Int64FromInt32(1)) {
  11631. goto out
  11632. }
  11633. if lval&int64(^(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 {
  11634. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11635. goto out
  11636. }
  11637. perm = libc.Uint32FromInt64(lval)
  11638. if set >= endset {
  11639. setdiff = (int64(set) - int64(saveset)) / 8
  11640. setlen += int32(m_SET_LEN_INCR)
  11641. newset = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  11642. if newset == libc.UintptrFromInt32(0) {
  11643. goto out
  11644. }
  11645. set = newset + uintptr(setdiff)*8
  11646. saveset = newset
  11647. endset = newset + uintptr(setlen-libc.Int32FromInt32(2))*8
  11648. }
  11649. 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)
  11650. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8(0)
  11651. return saveset
  11652. }
  11653. /*
  11654. * Build list of structures to set/clear/copy bits as described by
  11655. * each clause of the symbolic mode.
  11656. */
  11657. for {
  11658. /* First, find out which bits might be modified. */
  11659. who = uint32(0)
  11660. for {
  11661. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) {
  11662. case int32('a'):
  11663. 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))
  11664. case int32('u'):
  11665. who |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_ISUID1) | libc.Int32FromInt32(m_S_IRWXU1))
  11666. case int32('g'):
  11667. who |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_ISGID1) | libc.Int32FromInt32(m_S_IRWXG1))
  11668. case int32('o'):
  11669. who |= uint32(m_S_IRWXO1)
  11670. default:
  11671. goto getop
  11672. }
  11673. goto _3
  11674. _3:
  11675. ;
  11676. p++
  11677. }
  11678. goto getop
  11679. getop:
  11680. ;
  11681. v5 = p
  11682. p++
  11683. v4 = *(*uint8)(unsafe.Pointer(v5))
  11684. op = v4
  11685. if libc.Int32FromUint8(v4) != int32('+') && libc.Int32FromUint8(op) != int32('-') && libc.Int32FromUint8(op) != int32('=') {
  11686. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11687. goto out
  11688. }
  11689. if libc.Int32FromUint8(op) == int32('=') {
  11690. equalopdone = 0
  11691. }
  11692. who &= libc.Uint32FromInt32(^libc.Int32FromInt32(m_S_ISVTX1))
  11693. perm = uint32(0)
  11694. permXbits = libc.Uint32FromInt32(0)
  11695. for {
  11696. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) {
  11697. case int32('r'):
  11698. perm |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IRUSR1) | libc.Int32FromInt32(m_S_IRGRP1) | libc.Int32FromInt32(m_S_IROTH1))
  11699. case int32('s'):
  11700. /*
  11701. * If specific bits where requested and
  11702. * only "other" bits ignore set-id.
  11703. */
  11704. if who == uint32(0) || who&libc.Uint32FromInt32(^libc.Int32FromInt32(m_S_IRWXO1)) != 0 {
  11705. perm |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_ISUID1) | libc.Int32FromInt32(m_S_ISGID1))
  11706. }
  11707. case int32('t'):
  11708. /*
  11709. * If specific bits where requested and
  11710. * only "other" bits ignore set-id.
  11711. */
  11712. if who == uint32(0) || who&libc.Uint32FromInt32(^libc.Int32FromInt32(m_S_IRWXO1)) != 0 {
  11713. who |= uint32(m_S_ISVTX1)
  11714. perm |= uint32(m_S_ISVTX1)
  11715. }
  11716. case int32('w'):
  11717. perm |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IWUSR1) | libc.Int32FromInt32(m_S_IWGRP1) | libc.Int32FromInt32(m_S_IWOTH1))
  11718. case int32('X'):
  11719. permXbits = libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXUSR1) | libc.Int32FromInt32(m_S_IXGRP1) | libc.Int32FromInt32(m_S_IXOTH1))
  11720. case int32('x'):
  11721. perm |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXUSR1) | libc.Int32FromInt32(m_S_IXGRP1) | libc.Int32FromInt32(m_S_IXOTH1))
  11722. case int32('u'):
  11723. fallthrough
  11724. case int32('g'):
  11725. fallthrough
  11726. case int32('o'):
  11727. /*
  11728. * When ever we hit 'u', 'g', or 'o', we have
  11729. * to flush out any partial mode that we have,
  11730. * and then do the copying of the mode bits.
  11731. */
  11732. if perm != 0 {
  11733. if set >= endset {
  11734. setdiff1 = (int64(set) - int64(saveset)) / 8
  11735. setlen += int32(m_SET_LEN_INCR)
  11736. newset1 = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  11737. if newset1 == libc.UintptrFromInt32(0) {
  11738. goto out
  11739. }
  11740. set = newset1 + uintptr(setdiff1)*8
  11741. saveset = newset1
  11742. endset = newset1 + uintptr(setlen-libc.Int32FromInt32(2))*8
  11743. }
  11744. set = _addcmd(tls, set, uint32(op), who, perm, mask)
  11745. perm = uint32(0)
  11746. }
  11747. if libc.Int32FromUint8(op) == int32('=') {
  11748. equalopdone = int32(1)
  11749. }
  11750. if libc.Int32FromUint8(op) == int32('+') && permXbits != 0 {
  11751. if set >= endset {
  11752. setdiff2 = (int64(set) - int64(saveset)) / 8
  11753. setlen += int32(m_SET_LEN_INCR)
  11754. newset2 = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  11755. if newset2 == libc.UintptrFromInt32(0) {
  11756. goto out
  11757. }
  11758. set = newset2 + uintptr(setdiff2)*8
  11759. saveset = newset2
  11760. endset = newset2 + uintptr(setlen-libc.Int32FromInt32(2))*8
  11761. }
  11762. set = _addcmd(tls, set, libc.Uint32FromInt32(libc.Int32FromUint8('X')), who, permXbits, mask)
  11763. permXbits = uint32(0)
  11764. }
  11765. if set >= endset {
  11766. setdiff3 = (int64(set) - int64(saveset)) / 8
  11767. setlen += int32(m_SET_LEN_INCR)
  11768. newset3 = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  11769. if newset3 == libc.UintptrFromInt32(0) {
  11770. goto out
  11771. }
  11772. set = newset3 + uintptr(setdiff3)*8
  11773. saveset = newset3
  11774. endset = newset3 + uintptr(setlen-libc.Int32FromInt32(2))*8
  11775. }
  11776. set = _addcmd(tls, set, uint32(*(*uint8)(unsafe.Pointer(p))), who, uint32(op), mask)
  11777. default:
  11778. /*
  11779. * Add any permissions that we haven't already
  11780. * done.
  11781. */
  11782. if perm != 0 || libc.Int32FromUint8(op) == int32('=') && !(equalopdone != 0) {
  11783. if libc.Int32FromUint8(op) == int32('=') {
  11784. equalopdone = int32(1)
  11785. }
  11786. if set >= endset {
  11787. setdiff4 = (int64(set) - int64(saveset)) / 8
  11788. setlen += int32(m_SET_LEN_INCR)
  11789. newset4 = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  11790. if newset4 == libc.UintptrFromInt32(0) {
  11791. goto out
  11792. }
  11793. set = newset4 + uintptr(setdiff4)*8
  11794. saveset = newset4
  11795. endset = newset4 + uintptr(setlen-libc.Int32FromInt32(2))*8
  11796. }
  11797. set = _addcmd(tls, set, uint32(op), who, perm, mask)
  11798. perm = uint32(0)
  11799. }
  11800. if permXbits != 0 {
  11801. if set >= endset {
  11802. setdiff5 = (int64(set) - int64(saveset)) / 8
  11803. setlen += int32(m_SET_LEN_INCR)
  11804. newset5 = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  11805. if newset5 == libc.UintptrFromInt32(0) {
  11806. goto out
  11807. }
  11808. set = newset5 + uintptr(setdiff5)*8
  11809. saveset = newset5
  11810. endset = newset5 + uintptr(setlen-libc.Int32FromInt32(2))*8
  11811. }
  11812. set = _addcmd(tls, set, libc.Uint32FromInt32(libc.Int32FromUint8('X')), who, permXbits, mask)
  11813. permXbits = uint32(0)
  11814. }
  11815. goto apply
  11816. }
  11817. goto _6
  11818. _6:
  11819. ;
  11820. p++
  11821. }
  11822. goto apply
  11823. apply:
  11824. ;
  11825. if !(*(*uint8)(unsafe.Pointer(p)) != 0) {
  11826. break
  11827. }
  11828. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) != int32(',') {
  11829. goto getop
  11830. }
  11831. p++
  11832. goto _2
  11833. _2:
  11834. }
  11835. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8(0)
  11836. _compress_mode(tls, saveset)
  11837. return saveset
  11838. goto out
  11839. out:
  11840. ;
  11841. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  11842. libc.Xfree(tls, saveset)
  11843. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  11844. return libc.UintptrFromInt32(0)
  11845. }
  11846. func _addcmd(tls *libc.TLS, set uintptr, op Tmode_t, who Tmode_t, oparg Tmode_t, mask Tmode_t) (r uintptr) {
  11847. var v1, v2 uint32
  11848. var v3, v4, v5 int32
  11849. var p6, p7, p8 uintptr
  11850. _, _, _, _, _, _, _, _ = v1, v2, v3, v4, v5, p6, p7, p8
  11851. switch op {
  11852. case uint32('='):
  11853. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8('-')
  11854. if who != 0 {
  11855. v1 = who
  11856. } else {
  11857. 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))
  11858. }
  11859. (*TBITCMD)(unsafe.Pointer(set)).Fbits = v1
  11860. set += 8
  11861. op = uint32('+')
  11862. /* FALLTHROUGH */
  11863. fallthrough
  11864. case uint32('+'):
  11865. fallthrough
  11866. case uint32('-'):
  11867. fallthrough
  11868. case uint32('X'):
  11869. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8(op)
  11870. if who != 0 {
  11871. v2 = who
  11872. } else {
  11873. v2 = mask
  11874. }
  11875. (*TBITCMD)(unsafe.Pointer(set)).Fbits = v2 & oparg
  11876. case uint32('u'):
  11877. fallthrough
  11878. case uint32('g'):
  11879. fallthrough
  11880. case uint32('o'):
  11881. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8(op)
  11882. if who != 0 {
  11883. if who&uint32(m_S_IRUSR1) != 0 {
  11884. v3 = int32(m_CMD2_UBITS)
  11885. } else {
  11886. v3 = 0
  11887. }
  11888. if who&uint32(m_S_IRGRP1) != 0 {
  11889. v4 = int32(m_CMD2_GBITS)
  11890. } else {
  11891. v4 = 0
  11892. }
  11893. if who&uint32(m_S_IROTH1) != 0 {
  11894. v5 = int32(m_CMD2_OBITS)
  11895. } else {
  11896. v5 = 0
  11897. }
  11898. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = libc.Uint8FromInt32(v3 | v4 | v5)
  11899. (*TBITCMD)(unsafe.Pointer(set)).Fbits = libc.Uint32FromInt32(^libc.Int32FromInt32(0))
  11900. } else {
  11901. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = libc.Uint8FromInt32(libc.Int32FromInt32(m_CMD2_UBITS) | libc.Int32FromInt32(m_CMD2_GBITS) | libc.Int32FromInt32(m_CMD2_OBITS))
  11902. (*TBITCMD)(unsafe.Pointer(set)).Fbits = mask
  11903. }
  11904. if oparg == uint32('+') {
  11905. p6 = set + 1
  11906. *(*uint8)(unsafe.Pointer(p6)) = uint8(int32(*(*uint8)(unsafe.Pointer(p6))) | libc.Int32FromInt32(m_CMD2_SET))
  11907. } else {
  11908. if oparg == uint32('-') {
  11909. p7 = set + 1
  11910. *(*uint8)(unsafe.Pointer(p7)) = uint8(int32(*(*uint8)(unsafe.Pointer(p7))) | libc.Int32FromInt32(m_CMD2_CLR))
  11911. } else {
  11912. if oparg == uint32('=') {
  11913. p8 = set + 1
  11914. *(*uint8)(unsafe.Pointer(p8)) = uint8(int32(*(*uint8)(unsafe.Pointer(p8))) | (libc.Int32FromInt32(m_CMD2_SET) | libc.Int32FromInt32(m_CMD2_CLR)))
  11915. }
  11916. }
  11917. }
  11918. break
  11919. }
  11920. return set + libc.UintptrFromInt32(1)*8
  11921. }
  11922. // C documentation
  11923. //
  11924. // /*
  11925. // * Given an array of bitcmd structures, compress by compacting consecutive
  11926. // * '+', '-' and 'X' commands into at most 3 commands, one of each. The 'u',
  11927. // * 'g' and 'o' commands continue to be separate. They could probably be
  11928. // * compacted, but it's not worth the effort.
  11929. // */
  11930. func _compress_mode(tls *libc.TLS, set uintptr) {
  11931. var Xbits, clrbits, op, setbits, v2, v6, v7, v8 int32
  11932. var nset, v3, v4 uintptr
  11933. _, _, _, _, _, _, _, _, _, _, _ = Xbits, clrbits, nset, op, setbits, v2, v3, v4, v6, v7, v8
  11934. nset = set
  11935. for {
  11936. /* Copy over any 'u', 'g' and 'o' commands. */
  11937. for {
  11938. v2 = libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(nset)).Fcmd)
  11939. op = v2
  11940. if !(v2 != int32('+') && op != int32('-') && op != int32('X')) {
  11941. break
  11942. }
  11943. v3 = set
  11944. set += 8
  11945. v4 = nset
  11946. nset += 8
  11947. *(*TBITCMD)(unsafe.Pointer(v3)) = *(*TBITCMD)(unsafe.Pointer(v4))
  11948. if !(op != 0) {
  11949. return
  11950. }
  11951. }
  11952. v7 = libc.Int32FromInt32(0)
  11953. Xbits = v7
  11954. v6 = v7
  11955. clrbits = v6
  11956. setbits = v6
  11957. for {
  11958. v8 = libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(nset)).Fcmd)
  11959. op = v8
  11960. if v8 == int32('-') {
  11961. clrbits = int32(uint32(clrbits) | (*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  11962. setbits = int32(uint32(setbits) & ^(*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  11963. Xbits = int32(uint32(Xbits) & ^(*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  11964. } else {
  11965. if op == int32('+') {
  11966. setbits = int32(uint32(setbits) | (*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  11967. clrbits = int32(uint32(clrbits) & ^(*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  11968. Xbits = int32(uint32(Xbits) & ^(*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  11969. } else {
  11970. if op == int32('X') {
  11971. Xbits = int32(uint32(Xbits) | (*TBITCMD)(unsafe.Pointer(nset)).Fbits&libc.Uint32FromInt32(^setbits))
  11972. } else {
  11973. break
  11974. }
  11975. }
  11976. }
  11977. goto _5
  11978. _5:
  11979. ;
  11980. nset += 8
  11981. }
  11982. if clrbits != 0 {
  11983. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8('-')
  11984. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = uint8(0)
  11985. (*TBITCMD)(unsafe.Pointer(set)).Fbits = libc.Uint32FromInt32(clrbits)
  11986. set += 8
  11987. }
  11988. if setbits != 0 {
  11989. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8('+')
  11990. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = uint8(0)
  11991. (*TBITCMD)(unsafe.Pointer(set)).Fbits = libc.Uint32FromInt32(setbits)
  11992. set += 8
  11993. }
  11994. if Xbits != 0 {
  11995. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8('X')
  11996. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = uint8(0)
  11997. (*TBITCMD)(unsafe.Pointer(set)).Fbits = libc.Uint32FromInt32(Xbits)
  11998. set += 8
  11999. }
  12000. goto _1
  12001. _1:
  12002. }
  12003. }
  12004. const m_SPT_MAXTITLE = 255
  12005. const m_S_IFDIR2 = 0040000
  12006. const m_S_IRGRP2 = 0040
  12007. const m_S_IROTH2 = 0004
  12008. const m_S_IRUSR2 = 0400
  12009. const m_S_IRWXG2 = 0070
  12010. const m_S_IRWXO2 = 0007
  12011. const m_S_IRWXU2 = 0700
  12012. const m_S_ISGID2 = 02000
  12013. const m_S_ISUID2 = 04000
  12014. const m_S_ISVTX2 = 01000
  12015. const m_S_IWGRP2 = 0020
  12016. const m_S_IWOTH2 = 0002
  12017. const m_S_IWUSR2 = 0200
  12018. const m_S_IXGRP2 = 0010
  12019. const m_S_IXOTH2 = 0001
  12020. const m_S_IXUSR2 = 0100
  12021. const m___LONG_MAX2 = 0x7fffffffffffffff
  12022. const m___bool_true_false_are_defined = 1
  12023. const m_bool = "_Bool"
  12024. const m_false = 0
  12025. const m_true = 1
  12026. /*
  12027. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  12028. *
  12029. * Redistribution and use in source and binary forms, with or without
  12030. * modification, are permitted provided that the following conditions
  12031. * are met:
  12032. * 1. Redistributions of source code must retain the above copyright
  12033. * notice, this list of conditions and the following disclaimer.
  12034. * 2. Redistributions in binary form must reproduce the above copyright
  12035. * notice, this list of conditions and the following disclaimer in the
  12036. * documentation and/or other materials provided with the distribution.
  12037. * 3. The name of the author may not be used to endorse or promote products
  12038. * derived from this software without specific prior written permission.
  12039. *
  12040. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  12041. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  12042. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  12043. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  12044. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  12045. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  12046. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  12047. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  12048. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  12049. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  12050. */
  12051. /*
  12052. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  12053. *
  12054. * Redistribution and use in source and binary forms, with or without
  12055. * modification, are permitted provided that the following conditions
  12056. * are met:
  12057. * 1. Redistributions of source code must retain the above copyright
  12058. * notice, this list of conditions and the following disclaimer.
  12059. * 2. Redistributions in binary form must reproduce the above copyright
  12060. * notice, this list of conditions and the following disclaimer in the
  12061. * documentation and/or other materials provided with the distribution.
  12062. * 3. The name of the author may not be used to endorse or promote products
  12063. * derived from this software without specific prior written permission.
  12064. *
  12065. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  12066. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  12067. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  12068. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  12069. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  12070. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  12071. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  12072. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  12073. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  12074. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  12075. */
  12076. /* Clang expands this to 1 if an identifier is *not* reserved. */
  12077. /*
  12078. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  12079. * musl, try to handle this gracefully.
  12080. */
  12081. /* Copyright (C) 1992-2022 Free Software Foundation, Inc.
  12082. Copyright The GNU Toolchain Authors.
  12083. This file is part of the GNU C Library.
  12084. The GNU C Library is free software; you can redistribute it and/or
  12085. modify it under the terms of the GNU Lesser General Public
  12086. License as published by the Free Software Foundation; either
  12087. version 2.1 of the License, or (at your option) any later version.
  12088. The GNU C Library is distributed in the hope that it will be useful,
  12089. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12090. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12091. Lesser General Public License for more details.
  12092. You should have received a copy of the GNU Lesser General Public
  12093. License along with the GNU C Library; if not, see
  12094. <https://www.gnu.org/licenses/>. */
  12095. var _SPT struct {
  12096. Farg0 uintptr
  12097. Fbase uintptr
  12098. Fend uintptr
  12099. Fnul uintptr
  12100. Fwarned uint8
  12101. Freset uint8
  12102. Ferror1 int32
  12103. }
  12104. func _spt_min(tls *libc.TLS, a Tsize_t, b Tsize_t) (r Tsize_t) {
  12105. var v1 uint64
  12106. _ = v1
  12107. if a < b {
  12108. v1 = a
  12109. } else {
  12110. v1 = b
  12111. }
  12112. return v1
  12113. }
  12114. // C documentation
  12115. //
  12116. // /*
  12117. // * For discussion on the portability of the various methods, see
  12118. // * https://lists.freebsd.org/pipermail/freebsd-stable/2008-June/043136.html
  12119. // */
  12120. func _spt_clearenv(tls *libc.TLS) (r int32) {
  12121. return libc.Xclearenv(tls)
  12122. }
  12123. func _spt_copyenv(tls *libc.TLS, envc int32, envp uintptr) (r int32) {
  12124. var envcopy, eq uintptr
  12125. var envsize, error1, i int32
  12126. _, _, _, _, _ = envcopy, envsize, eq, error1, i
  12127. if libc.Xenviron != envp {
  12128. return 0
  12129. }
  12130. /* Make a copy of the old environ array of pointers, in case
  12131. * clearenv() or setenv() is implemented to free the internal
  12132. * environ array, because we will need to access the old environ
  12133. * contents to make the new copy. */
  12134. envsize = libc.Int32FromUint64(libc.Uint64FromInt32(envc+libc.Int32FromInt32(1)) * uint64(8))
  12135. envcopy = libc.Xmalloc(tls, libc.Uint64FromInt32(envsize))
  12136. if envcopy == libc.UintptrFromInt32(0) {
  12137. return *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  12138. }
  12139. libc.Xmemcpy(tls, envcopy, envp, libc.Uint64FromInt32(envsize))
  12140. error1 = _spt_clearenv(tls)
  12141. if error1 != 0 {
  12142. libc.Xenviron = envp
  12143. libc.Xfree(tls, envcopy)
  12144. return error1
  12145. }
  12146. i = 0
  12147. for {
  12148. if !(*(*uintptr)(unsafe.Pointer(envcopy + uintptr(i)*8)) != 0) {
  12149. break
  12150. }
  12151. eq = libc.Xstrchr(tls, *(*uintptr)(unsafe.Pointer(envcopy + uintptr(i)*8)), int32('='))
  12152. if eq == libc.UintptrFromInt32(0) {
  12153. goto _1
  12154. }
  12155. *(*uint8)(unsafe.Pointer(eq)) = uint8('\000')
  12156. if libc.Xsetenv(tls, *(*uintptr)(unsafe.Pointer(envcopy + uintptr(i)*8)), eq+uintptr(1), int32(1)) < 0 {
  12157. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  12158. }
  12159. *(*uint8)(unsafe.Pointer(eq)) = uint8('=')
  12160. if error1 != 0 {
  12161. /* Because the old environ might not be available
  12162. * anymore we will make do with the shallow copy. */
  12163. libc.Xenviron = envcopy
  12164. return error1
  12165. }
  12166. goto _1
  12167. _1:
  12168. ;
  12169. i++
  12170. }
  12171. /* Dispose of the shallow copy, now that we've finished transfering
  12172. * the old environment. */
  12173. libc.Xfree(tls, envcopy)
  12174. return 0
  12175. }
  12176. func _spt_copyargs(tls *libc.TLS, argc int32, argv uintptr) (r int32) {
  12177. var i int32
  12178. var tmp uintptr
  12179. _, _ = i, tmp
  12180. i = int32(1)
  12181. for {
  12182. if !(i < argc || i >= argc && *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) != 0) {
  12183. break
  12184. }
  12185. if *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) == libc.UintptrFromInt32(0) {
  12186. goto _1
  12187. }
  12188. tmp = libc.Xstrdup(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))
  12189. if tmp == libc.UintptrFromInt32(0) {
  12190. return *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  12191. }
  12192. *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) = tmp
  12193. goto _1
  12194. _1:
  12195. ;
  12196. i++
  12197. }
  12198. return 0
  12199. }
  12200. func Xsetproctitle_init(tls *libc.TLS, argc int32, argv uintptr, envp uintptr) {
  12201. var base, end, nul, tmp uintptr
  12202. var envc, error1, i int32
  12203. _, _, _, _, _, _, _ = base, end, envc, error1, i, nul, tmp
  12204. /* Try to make sure we got called with main() arguments. */
  12205. if argc < 0 {
  12206. return
  12207. }
  12208. base = *(*uintptr)(unsafe.Pointer(argv))
  12209. if base == libc.UintptrFromInt32(0) {
  12210. return
  12211. }
  12212. nul = base + uintptr(libc.Xstrlen(tls, base))
  12213. end = nul + uintptr(1)
  12214. i = 0
  12215. for {
  12216. if !(i < argc || i >= argc && *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) != 0) {
  12217. break
  12218. }
  12219. if *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) == libc.UintptrFromInt32(0) || *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) != end {
  12220. goto _1
  12221. }
  12222. end = *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) + uintptr(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))) + uintptr(1)
  12223. goto _1
  12224. _1:
  12225. ;
  12226. i++
  12227. }
  12228. i = 0
  12229. for {
  12230. if !(*(*uintptr)(unsafe.Pointer(envp + uintptr(i)*8)) != 0) {
  12231. break
  12232. }
  12233. if *(*uintptr)(unsafe.Pointer(envp + uintptr(i)*8)) != end {
  12234. goto _2
  12235. }
  12236. end = *(*uintptr)(unsafe.Pointer(envp + uintptr(i)*8)) + uintptr(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(envp + uintptr(i)*8)))) + uintptr(1)
  12237. goto _2
  12238. _2:
  12239. ;
  12240. i++
  12241. }
  12242. envc = i
  12243. _SPT.Farg0 = libc.Xstrdup(tls, *(*uintptr)(unsafe.Pointer(argv)))
  12244. if _SPT.Farg0 == libc.UintptrFromInt32(0) {
  12245. _SPT.Ferror1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  12246. return
  12247. }
  12248. tmp = libc.Xstrdup(tls, Xgetprogname(tls))
  12249. if tmp == libc.UintptrFromInt32(0) {
  12250. _SPT.Ferror1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  12251. return
  12252. }
  12253. Xsetprogname(tls, tmp)
  12254. error1 = _spt_copyenv(tls, envc, envp)
  12255. if error1 != 0 {
  12256. _SPT.Ferror1 = error1
  12257. return
  12258. }
  12259. error1 = _spt_copyargs(tls, argc, argv)
  12260. if error1 != 0 {
  12261. _SPT.Ferror1 = error1
  12262. return
  12263. }
  12264. _SPT.Fnul = nul
  12265. _SPT.Fbase = base
  12266. _SPT.Fend = end
  12267. }
  12268. func Xsetproctitle_impl(tls *libc.TLS, fmt uintptr, va uintptr) {
  12269. bp := tls.Alloc(272)
  12270. defer tls.Free(272)
  12271. var ap Tva_list
  12272. var len1 int32
  12273. var nul, v1 uintptr
  12274. var _ /* buf at bp+0 */ [256]uint8
  12275. _, _, _, _ = ap, len1, nul, v1
  12276. if _SPT.Fbase == libc.UintptrFromInt32(0) {
  12277. if !(_SPT.Fwarned != 0) {
  12278. libc.Xwarnx(tls, __ccgo_ts+333, 0)
  12279. _SPT.Fwarned = uint8(m_true)
  12280. }
  12281. return
  12282. }
  12283. if fmt != 0 {
  12284. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(fmt))) == int32('-') {
  12285. /* Skip program name prefix. */
  12286. fmt++
  12287. len1 = 0
  12288. } else {
  12289. /* Print program name heading for grep. */
  12290. libc.X__builtin_snprintf(tls, bp, uint64(256), __ccgo_ts+14, libc.VaList(bp+264, Xgetprogname(tls)))
  12291. len1 = libc.Int32FromUint64(libc.Xstrlen(tls, bp))
  12292. }
  12293. ap = va
  12294. len1 += libc.X__builtin_vsnprintf(tls, bp+uintptr(len1), uint64(256)-libc.Uint64FromInt32(len1), fmt, ap)
  12295. _ = ap
  12296. } else {
  12297. len1 = libc.X__builtin_snprintf(tls, bp, uint64(256), __ccgo_ts+431, libc.VaList(bp+264, _SPT.Farg0))
  12298. }
  12299. if len1 <= 0 {
  12300. _SPT.Ferror1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  12301. return
  12302. }
  12303. if !(_SPT.Freset != 0) {
  12304. libc.Xmemset(tls, _SPT.Fbase, 0, libc.Uint64FromInt64(int64(_SPT.Fend)-int64(_SPT.Fbase)))
  12305. _SPT.Freset = uint8(m_true)
  12306. } else {
  12307. libc.Xmemset(tls, _SPT.Fbase, 0, _spt_min(tls, uint64(256), libc.Uint64FromInt64(int64(_SPT.Fend)-int64(_SPT.Fbase))))
  12308. }
  12309. len1 = libc.Int32FromUint64(_spt_min(tls, libc.Uint64FromInt32(len1), _spt_min(tls, uint64(256), libc.Uint64FromInt64(int64(_SPT.Fend)-int64(_SPT.Fbase)))-uint64(1)))
  12310. libc.Xmemcpy(tls, _SPT.Fbase, bp, libc.Uint64FromInt32(len1))
  12311. nul = _SPT.Fbase + uintptr(len1)
  12312. if nul < _SPT.Fnul {
  12313. *(*uint8)(unsafe.Pointer(_SPT.Fnul)) = uint8('.')
  12314. } else {
  12315. if nul == _SPT.Fnul && nul+1 < _SPT.Fend {
  12316. *(*uint8)(unsafe.Pointer(_SPT.Fnul)) = uint8(' ')
  12317. nul++
  12318. v1 = nul
  12319. *(*uint8)(unsafe.Pointer(v1)) = uint8('\000')
  12320. }
  12321. }
  12322. }
  12323. // C documentation
  12324. //
  12325. // /*
  12326. // * Appends src to string dst of size dsize (unlike strncat, dsize is the
  12327. // * full size of dst, not space left). At most dsize-1 characters
  12328. // * will be copied. Always NUL terminates (unless dsize <= strlen(dst)).
  12329. // * Returns strlen(src) + MIN(dsize, strlen(initial dst)).
  12330. // * If retval >= dsize, truncation occurred.
  12331. // */
  12332. func Xstrlcat(tls *libc.TLS, dst uintptr, src uintptr, dsize Tsize_t) (r Tsize_t) {
  12333. var dlen, n, v1, v2 Tsize_t
  12334. var odst, osrc, v3 uintptr
  12335. _, _, _, _, _, _, _ = dlen, n, odst, osrc, v1, v2, v3
  12336. odst = dst
  12337. osrc = src
  12338. n = dsize
  12339. /* Find the end of dst and adjust bytes left but don't go past end. */
  12340. for {
  12341. v1 = n
  12342. n--
  12343. if !(v1 != uint64(0) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(dst))) != int32('\000')) {
  12344. break
  12345. }
  12346. dst++
  12347. }
  12348. dlen = libc.Uint64FromInt64(int64(dst) - int64(odst))
  12349. n = dsize - dlen
  12350. v2 = n
  12351. n--
  12352. if v2 == uint64(0) {
  12353. return dlen + libc.Xstrlen(tls, src)
  12354. }
  12355. for libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(src))) != int32('\000') {
  12356. if n != uint64(0) {
  12357. v3 = dst
  12358. dst++
  12359. *(*uint8)(unsafe.Pointer(v3)) = *(*uint8)(unsafe.Pointer(src))
  12360. n--
  12361. }
  12362. src++
  12363. }
  12364. *(*uint8)(unsafe.Pointer(dst)) = uint8('\000')
  12365. return dlen + libc.Uint64FromInt64(int64(src)-int64(osrc)) /* count does not include NUL */
  12366. }
  12367. // C documentation
  12368. //
  12369. // /*
  12370. // * Copy string src to buffer dst of size dsize. At most dsize-1
  12371. // * chars will be copied. Always NUL terminates (unless dsize == 0).
  12372. // * Returns strlen(src); if retval >= dsize, truncation occurred.
  12373. // */
  12374. func Xstrlcpy(tls *libc.TLS, dst uintptr, src uintptr, dsize Tsize_t) (r Tsize_t) {
  12375. var nleft, v1 Tsize_t
  12376. var osrc, v3, v4, v5 uintptr
  12377. var v2 uint8
  12378. _, _, _, _, _, _, _ = nleft, osrc, v1, v2, v3, v4, v5
  12379. osrc = src
  12380. nleft = dsize
  12381. /* Copy as many bytes as will fit. */
  12382. if nleft != uint64(0) {
  12383. for {
  12384. nleft--
  12385. v1 = nleft
  12386. if !(v1 != uint64(0)) {
  12387. break
  12388. }
  12389. v3 = src
  12390. src++
  12391. v2 = *(*uint8)(unsafe.Pointer(v3))
  12392. v4 = dst
  12393. dst++
  12394. *(*uint8)(unsafe.Pointer(v4)) = v2
  12395. if libc.Int32FromUint8(v2) == int32('\000') {
  12396. break
  12397. }
  12398. }
  12399. }
  12400. /* Not enough room in dst, add NUL and traverse rest of src. */
  12401. if nleft == uint64(0) {
  12402. if dsize != uint64(0) {
  12403. *(*uint8)(unsafe.Pointer(dst)) = uint8('\000')
  12404. } /* NUL-terminate dst */
  12405. for {
  12406. v5 = src
  12407. src++
  12408. if !(*(*uint8)(unsafe.Pointer(v5)) != 0) {
  12409. break
  12410. }
  12411. }
  12412. }
  12413. return libc.Uint64FromInt64(int64(src) - int64(osrc) - libc.Int64FromInt32(1)) /* count does not include NUL */
  12414. }
  12415. const m__SL_CHUNKSIZE = 20
  12416. type TStringList = struct {
  12417. Fsl_str uintptr
  12418. Fsl_max Tsize_t
  12419. Fsl_cur Tsize_t
  12420. }
  12421. type T_stringlist = TStringList
  12422. // C documentation
  12423. //
  12424. // /*
  12425. // * sl_init(): Initialize a string list
  12426. // */
  12427. func Xsl_init(tls *libc.TLS) (r uintptr) {
  12428. var sl uintptr
  12429. _ = sl
  12430. sl = libc.Xmalloc(tls, uint64(24))
  12431. if sl == libc.UintptrFromInt32(0) {
  12432. return libc.UintptrFromInt32(0)
  12433. }
  12434. (*TStringList)(unsafe.Pointer(sl)).Fsl_cur = uint64(0)
  12435. (*TStringList)(unsafe.Pointer(sl)).Fsl_max = uint64(m__SL_CHUNKSIZE)
  12436. (*TStringList)(unsafe.Pointer(sl)).Fsl_str = Xreallocarray(tls, libc.UintptrFromInt32(0), (*TStringList)(unsafe.Pointer(sl)).Fsl_max, uint64(8))
  12437. if (*TStringList)(unsafe.Pointer(sl)).Fsl_str == libc.UintptrFromInt32(0) {
  12438. libc.Xfree(tls, sl)
  12439. sl = libc.UintptrFromInt32(0)
  12440. }
  12441. return sl
  12442. }
  12443. // C documentation
  12444. //
  12445. // /*
  12446. // * sl_add(): Add an item to the string list
  12447. // */
  12448. func Xsl_add(tls *libc.TLS, sl uintptr, name uintptr) (r int32) {
  12449. var new1, v2 uintptr
  12450. var v1 Tsize_t
  12451. _, _, _ = new1, v1, v2
  12452. if (*TStringList)(unsafe.Pointer(sl)).Fsl_cur == (*TStringList)(unsafe.Pointer(sl)).Fsl_max-uint64(1) {
  12453. new1 = Xreallocarray(tls, (*TStringList)(unsafe.Pointer(sl)).Fsl_str, (*TStringList)(unsafe.Pointer(sl)).Fsl_max+libc.Uint64FromInt32(m__SL_CHUNKSIZE), uint64(8))
  12454. if new1 == libc.UintptrFromInt32(0) {
  12455. return -int32(1)
  12456. }
  12457. *(*Tsize_t)(unsafe.Pointer(sl + 8)) += uint64(m__SL_CHUNKSIZE)
  12458. (*TStringList)(unsafe.Pointer(sl)).Fsl_str = new1
  12459. }
  12460. v2 = sl + 16
  12461. v1 = *(*Tsize_t)(unsafe.Pointer(v2))
  12462. *(*Tsize_t)(unsafe.Pointer(v2))++
  12463. *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(v1)*8)) = name
  12464. return 0
  12465. }
  12466. // C documentation
  12467. //
  12468. // /*
  12469. // * sl_free(): Free a stringlist
  12470. // */
  12471. func Xsl_free(tls *libc.TLS, sl uintptr, all int32) {
  12472. var i Tsize_t
  12473. _ = i
  12474. if sl == libc.UintptrFromInt32(0) {
  12475. return
  12476. }
  12477. if (*TStringList)(unsafe.Pointer(sl)).Fsl_str != 0 {
  12478. if all != 0 {
  12479. i = uint64(0)
  12480. for {
  12481. if !(i < (*TStringList)(unsafe.Pointer(sl)).Fsl_cur) {
  12482. break
  12483. }
  12484. libc.Xfree(tls, *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*8)))
  12485. goto _1
  12486. _1:
  12487. ;
  12488. i++
  12489. }
  12490. }
  12491. libc.Xfree(tls, (*TStringList)(unsafe.Pointer(sl)).Fsl_str)
  12492. }
  12493. libc.Xfree(tls, sl)
  12494. }
  12495. // C documentation
  12496. //
  12497. // /*
  12498. // * sl_find(): Find a name in the string list
  12499. // */
  12500. func Xsl_find(tls *libc.TLS, sl uintptr, name uintptr) (r uintptr) {
  12501. var i Tsize_t
  12502. _ = i
  12503. i = uint64(0)
  12504. for {
  12505. if !(i < (*TStringList)(unsafe.Pointer(sl)).Fsl_cur) {
  12506. break
  12507. }
  12508. if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*8)), name) == 0 {
  12509. return *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*8))
  12510. }
  12511. goto _1
  12512. _1:
  12513. ;
  12514. i++
  12515. }
  12516. return libc.UintptrFromInt32(0)
  12517. }
  12518. func Xsl_delete(tls *libc.TLS, sl uintptr, name uintptr, all int32) (r int32) {
  12519. var i, j, v3 Tsize_t
  12520. var v4 uintptr
  12521. _, _, _, _ = i, j, v3, v4
  12522. i = uint64(0)
  12523. for {
  12524. if !(i < (*TStringList)(unsafe.Pointer(sl)).Fsl_cur) {
  12525. break
  12526. }
  12527. if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*8)), name) == 0 {
  12528. if all != 0 {
  12529. libc.Xfree(tls, *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*8)))
  12530. }
  12531. j = i + uint64(1)
  12532. for {
  12533. if !(j < (*TStringList)(unsafe.Pointer(sl)).Fsl_cur) {
  12534. break
  12535. }
  12536. *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(j-uint64(1))*8)) = *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(j)*8))
  12537. goto _2
  12538. _2:
  12539. ;
  12540. j++
  12541. }
  12542. v4 = sl + 16
  12543. *(*Tsize_t)(unsafe.Pointer(v4))--
  12544. v3 = *(*Tsize_t)(unsafe.Pointer(v4))
  12545. *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(v3)*8)) = libc.UintptrFromInt32(0)
  12546. return 0
  12547. }
  12548. goto _1
  12549. _1:
  12550. ;
  12551. i++
  12552. }
  12553. return -int32(1)
  12554. }
  12555. const m_S_IFBLK1 = 24576
  12556. const m_S_IFCHR1 = 8192
  12557. const m_S_IFDIR3 = 16384
  12558. const m_S_IFIFO1 = 4096
  12559. const m_S_IFLNK1 = 40960
  12560. const m_S_IFMT1 = 61440
  12561. const m_S_IFREG1 = 32768
  12562. const m_S_IFSOCK1 = 49152
  12563. const m_S_IRGRP3 = 32
  12564. const m_S_IROTH3 = 4
  12565. const m_S_IRUSR3 = 256
  12566. const m_S_ISGID3 = 1024
  12567. const m_S_ISUID3 = 2048
  12568. const m_S_ISVTX3 = 512
  12569. const m_S_IWGRP3 = 16
  12570. const m_S_IWOTH3 = 2
  12571. const m_S_IWUSR3 = 128
  12572. const m_S_IXGRP3 = 8
  12573. const m_S_IXOTH3 = 1
  12574. const m_S_IXUSR3 = 64
  12575. func Xstrmode(tls *libc.TLS, mode Tmode_t, p uintptr) {
  12576. 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
  12577. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  12578. /* print type */
  12579. switch mode & libc.Uint32FromInt32(m_S_IFMT1) {
  12580. case uint32(m_S_IFDIR3): /* directory */
  12581. v1 = p
  12582. p++
  12583. *(*uint8)(unsafe.Pointer(v1)) = uint8('d')
  12584. case uint32(m_S_IFCHR1): /* character special */
  12585. v2 = p
  12586. p++
  12587. *(*uint8)(unsafe.Pointer(v2)) = uint8('c')
  12588. case uint32(m_S_IFBLK1): /* block special */
  12589. v3 = p
  12590. p++
  12591. *(*uint8)(unsafe.Pointer(v3)) = uint8('b')
  12592. case uint32(m_S_IFREG1): /* regular */
  12593. v4 = p
  12594. p++
  12595. *(*uint8)(unsafe.Pointer(v4)) = uint8('-')
  12596. case uint32(m_S_IFLNK1): /* symbolic link */
  12597. v5 = p
  12598. p++
  12599. *(*uint8)(unsafe.Pointer(v5)) = uint8('l')
  12600. case uint32(m_S_IFSOCK1): /* socket */
  12601. v6 = p
  12602. p++
  12603. *(*uint8)(unsafe.Pointer(v6)) = uint8('s')
  12604. case uint32(m_S_IFIFO1): /* fifo */
  12605. v7 = p
  12606. p++
  12607. *(*uint8)(unsafe.Pointer(v7)) = uint8('p')
  12608. default: /* unknown */
  12609. v8 = p
  12610. p++
  12611. *(*uint8)(unsafe.Pointer(v8)) = uint8('?')
  12612. break
  12613. }
  12614. /* usr */
  12615. if mode&uint32(m_S_IRUSR3) != 0 {
  12616. v9 = p
  12617. p++
  12618. *(*uint8)(unsafe.Pointer(v9)) = uint8('r')
  12619. } else {
  12620. v10 = p
  12621. p++
  12622. *(*uint8)(unsafe.Pointer(v10)) = uint8('-')
  12623. }
  12624. if mode&uint32(m_S_IWUSR3) != 0 {
  12625. v11 = p
  12626. p++
  12627. *(*uint8)(unsafe.Pointer(v11)) = uint8('w')
  12628. } else {
  12629. v12 = p
  12630. p++
  12631. *(*uint8)(unsafe.Pointer(v12)) = uint8('-')
  12632. }
  12633. switch mode & libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXUSR3)|libc.Int32FromInt32(m_S_ISUID3)) {
  12634. case uint32(0):
  12635. v13 = p
  12636. p++
  12637. *(*uint8)(unsafe.Pointer(v13)) = uint8('-')
  12638. case uint32(m_S_IXUSR3):
  12639. v14 = p
  12640. p++
  12641. *(*uint8)(unsafe.Pointer(v14)) = uint8('x')
  12642. case uint32(m_S_ISUID3):
  12643. v15 = p
  12644. p++
  12645. *(*uint8)(unsafe.Pointer(v15)) = uint8('S')
  12646. case libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXUSR3) | libc.Int32FromInt32(m_S_ISUID3)):
  12647. v16 = p
  12648. p++
  12649. *(*uint8)(unsafe.Pointer(v16)) = uint8('s')
  12650. break
  12651. }
  12652. /* group */
  12653. if mode&uint32(m_S_IRGRP3) != 0 {
  12654. v17 = p
  12655. p++
  12656. *(*uint8)(unsafe.Pointer(v17)) = uint8('r')
  12657. } else {
  12658. v18 = p
  12659. p++
  12660. *(*uint8)(unsafe.Pointer(v18)) = uint8('-')
  12661. }
  12662. if mode&uint32(m_S_IWGRP3) != 0 {
  12663. v19 = p
  12664. p++
  12665. *(*uint8)(unsafe.Pointer(v19)) = uint8('w')
  12666. } else {
  12667. v20 = p
  12668. p++
  12669. *(*uint8)(unsafe.Pointer(v20)) = uint8('-')
  12670. }
  12671. switch mode & libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXGRP3)|libc.Int32FromInt32(m_S_ISGID3)) {
  12672. case uint32(0):
  12673. v21 = p
  12674. p++
  12675. *(*uint8)(unsafe.Pointer(v21)) = uint8('-')
  12676. case uint32(m_S_IXGRP3):
  12677. v22 = p
  12678. p++
  12679. *(*uint8)(unsafe.Pointer(v22)) = uint8('x')
  12680. case uint32(m_S_ISGID3):
  12681. v23 = p
  12682. p++
  12683. *(*uint8)(unsafe.Pointer(v23)) = uint8('S')
  12684. case libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXGRP3) | libc.Int32FromInt32(m_S_ISGID3)):
  12685. v24 = p
  12686. p++
  12687. *(*uint8)(unsafe.Pointer(v24)) = uint8('s')
  12688. break
  12689. }
  12690. /* other */
  12691. if mode&uint32(m_S_IROTH3) != 0 {
  12692. v25 = p
  12693. p++
  12694. *(*uint8)(unsafe.Pointer(v25)) = uint8('r')
  12695. } else {
  12696. v26 = p
  12697. p++
  12698. *(*uint8)(unsafe.Pointer(v26)) = uint8('-')
  12699. }
  12700. if mode&uint32(m_S_IWOTH3) != 0 {
  12701. v27 = p
  12702. p++
  12703. *(*uint8)(unsafe.Pointer(v27)) = uint8('w')
  12704. } else {
  12705. v28 = p
  12706. p++
  12707. *(*uint8)(unsafe.Pointer(v28)) = uint8('-')
  12708. }
  12709. switch mode & libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXOTH3)|libc.Int32FromInt32(m_S_ISVTX3)) {
  12710. case uint32(0):
  12711. v29 = p
  12712. p++
  12713. *(*uint8)(unsafe.Pointer(v29)) = uint8('-')
  12714. case uint32(m_S_IXOTH3):
  12715. v30 = p
  12716. p++
  12717. *(*uint8)(unsafe.Pointer(v30)) = uint8('x')
  12718. case uint32(m_S_ISVTX3):
  12719. v31 = p
  12720. p++
  12721. *(*uint8)(unsafe.Pointer(v31)) = uint8('T')
  12722. case libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXOTH3) | libc.Int32FromInt32(m_S_ISVTX3)):
  12723. v32 = p
  12724. p++
  12725. *(*uint8)(unsafe.Pointer(v32)) = uint8('t')
  12726. break
  12727. }
  12728. v33 = p
  12729. p++
  12730. *(*uint8)(unsafe.Pointer(v33)) = uint8(' ') /* will be a '+' if ACL's implemented */
  12731. *(*uint8)(unsafe.Pointer(p)) = uint8('\000')
  12732. }
  12733. // C documentation
  12734. //
  12735. // /*
  12736. // * Find the first occurrence of find in s, where the search is limited to the
  12737. // * first slen characters of s.
  12738. // */
  12739. func Xstrnstr(tls *libc.TLS, s uintptr, find uintptr, slen Tsize_t) (r uintptr) {
  12740. var c, sc, v1, v4 uint8
  12741. var len1, v3 Tsize_t
  12742. var v2, v5 uintptr
  12743. var v6 bool
  12744. _, _, _, _, _, _, _, _, _ = c, len1, sc, v1, v2, v3, v4, v5, v6
  12745. v2 = find
  12746. find++
  12747. v1 = *(*uint8)(unsafe.Pointer(v2))
  12748. c = v1
  12749. if libc.Int32FromUint8(v1) != int32('\000') {
  12750. len1 = libc.Xstrlen(tls, find)
  12751. for cond := true; cond; cond = libc.Xstrncmp(tls, s, find, len1) != 0 {
  12752. for cond := true; cond; cond = libc.Int32FromUint8(sc) != libc.Int32FromUint8(c) {
  12753. v3 = slen
  12754. slen--
  12755. if v6 = v3 < uint64(1); !v6 {
  12756. v5 = s
  12757. s++
  12758. v4 = *(*uint8)(unsafe.Pointer(v5))
  12759. sc = v4
  12760. }
  12761. if v6 || libc.Int32FromUint8(v4) == int32('\000') {
  12762. return libc.UintptrFromInt32(0)
  12763. }
  12764. }
  12765. if len1 > slen {
  12766. return libc.UintptrFromInt32(0)
  12767. }
  12768. }
  12769. s--
  12770. }
  12771. return s
  12772. }
  12773. func Xstrtoi(tls *libc.TLS, nptr uintptr, endptr uintptr, base int32, lo Tintmax_t, hi Tintmax_t, rstatus uintptr) (r Tintmax_t) {
  12774. bp := tls.Alloc(16)
  12775. defer tls.Free(16)
  12776. var im Tintmax_t
  12777. var serrno int32
  12778. var _ /* ep at bp+0 */ uintptr
  12779. var _ /* rep at bp+8 */ int32
  12780. _, _ = im, serrno
  12781. /* endptr may be NULL */
  12782. if endptr == libc.UintptrFromInt32(0) {
  12783. endptr = bp
  12784. }
  12785. if rstatus == libc.UintptrFromInt32(0) {
  12786. rstatus = bp + 8
  12787. }
  12788. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  12789. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  12790. im = libc.Xstrtoimax(tls, nptr, endptr, base)
  12791. *(*int32)(unsafe.Pointer(rstatus)) = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  12792. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  12793. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  12794. /* No digits were found */
  12795. if nptr == *(*uintptr)(unsafe.Pointer(endptr)) {
  12796. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ECANCELED)
  12797. } else {
  12798. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(endptr))))) != int32('\000') {
  12799. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_EOPNOTSUPP)
  12800. }
  12801. }
  12802. }
  12803. if im < lo {
  12804. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  12805. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ERANGE)
  12806. }
  12807. return lo
  12808. }
  12809. if im > hi {
  12810. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  12811. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ERANGE)
  12812. }
  12813. return hi
  12814. }
  12815. return im
  12816. }
  12817. const m_S_IFBLK2 = 0060000
  12818. const m_S_IFCHR2 = 0020000
  12819. const m_S_IFDIR4 = 0040000
  12820. const m_S_IFIFO2 = 0010000
  12821. const m_S_IFLNK2 = 0120000
  12822. const m_S_IFMT2 = 0170000
  12823. const m_S_IFREG2 = 0100000
  12824. const m_S_IFSOCK2 = 0140000
  12825. const m_S_IRGRP4 = 0040
  12826. const m_S_IROTH4 = 0004
  12827. const m_S_IRUSR4 = 0400
  12828. const m_S_ISGID4 = 02000
  12829. const m_S_ISUID4 = 04000
  12830. const m_S_ISVTX4 = 01000
  12831. const m_S_IWGRP4 = 0020
  12832. const m_S_IWOTH4 = 0002
  12833. const m_S_IWUSR4 = 0200
  12834. const m_S_IXGRP4 = 0010
  12835. const m_S_IXOTH4 = 0001
  12836. const m_S_IXUSR4 = 0100
  12837. func Xstrtonum(tls *libc.TLS, nptr uintptr, minval int64, maxval int64, errstr uintptr) (r int64) {
  12838. bp := tls.Alloc(16)
  12839. defer tls.Free(16)
  12840. var rv int64
  12841. var v1 uintptr
  12842. var _ /* e at bp+0 */ int32
  12843. var _ /* resp at bp+8 */ uintptr
  12844. _, _ = rv, v1
  12845. if errstr == libc.UintptrFromInt32(0) {
  12846. errstr = bp + 8
  12847. }
  12848. rv = Xstrtoi(tls, nptr, libc.UintptrFromInt32(0), int32(10), minval, maxval, bp)
  12849. if *(*int32)(unsafe.Pointer(bp)) == 0 {
  12850. *(*uintptr)(unsafe.Pointer(errstr)) = libc.UintptrFromInt32(0)
  12851. return rv
  12852. }
  12853. if *(*int32)(unsafe.Pointer(bp)) == int32(m_ERANGE) {
  12854. if rv == maxval {
  12855. v1 = __ccgo_ts + 434
  12856. } else {
  12857. v1 = __ccgo_ts + 444
  12858. }
  12859. *(*uintptr)(unsafe.Pointer(errstr)) = v1
  12860. } else {
  12861. *(*uintptr)(unsafe.Pointer(errstr)) = __ccgo_ts + 454
  12862. }
  12863. return 0
  12864. }
  12865. func Xstrtou(tls *libc.TLS, nptr uintptr, endptr uintptr, base int32, lo Tuintmax_t, hi Tuintmax_t, rstatus uintptr) (r Tuintmax_t) {
  12866. bp := tls.Alloc(16)
  12867. defer tls.Free(16)
  12868. var im Tuintmax_t
  12869. var serrno int32
  12870. var _ /* ep at bp+0 */ uintptr
  12871. var _ /* rep at bp+8 */ int32
  12872. _, _ = im, serrno
  12873. /* endptr may be NULL */
  12874. if endptr == libc.UintptrFromInt32(0) {
  12875. endptr = bp
  12876. }
  12877. if rstatus == libc.UintptrFromInt32(0) {
  12878. rstatus = bp + 8
  12879. }
  12880. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  12881. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  12882. im = libc.Xstrtoumax(tls, nptr, endptr, base)
  12883. *(*int32)(unsafe.Pointer(rstatus)) = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  12884. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  12885. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  12886. /* No digits were found */
  12887. if nptr == *(*uintptr)(unsafe.Pointer(endptr)) {
  12888. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ECANCELED)
  12889. } else {
  12890. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(endptr))))) != int32('\000') {
  12891. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_EOPNOTSUPP)
  12892. }
  12893. }
  12894. }
  12895. if im < lo {
  12896. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  12897. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ERANGE)
  12898. }
  12899. return lo
  12900. }
  12901. if im > hi {
  12902. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  12903. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ERANGE)
  12904. }
  12905. return hi
  12906. }
  12907. return im
  12908. }
  12909. // C documentation
  12910. //
  12911. // /*
  12912. // * Convert a 32 bit representation of time_t into time_t. XXX needs to
  12913. // * implement the 50-year rule to handle post-2038 conversions.
  12914. // */
  12915. func X_time32_to_time(tls *libc.TLS, t32 Tint32_t) (r Ttime_t) {
  12916. return int64(t32)
  12917. }
  12918. // C documentation
  12919. //
  12920. // /*
  12921. // * Convert time_t to a 32 bit representation. If time_t is 64 bits we can
  12922. // * simply chop it down. The resulting 32 bit representation can be
  12923. // * converted back to a temporally local 64 bit time_t using time32_to_time.
  12924. // */
  12925. func X_time_to_time32(tls *libc.TLS, t Ttime_t) (r Tint32_t) {
  12926. return int32(t)
  12927. }
  12928. // C documentation
  12929. //
  12930. // /*
  12931. // * Convert a 64 bit representation of time_t into time_t. If time_t is
  12932. // * represented as 32 bits we can simply chop it and not support times
  12933. // * past 2038.
  12934. // */
  12935. func X_time64_to_time(tls *libc.TLS, t64 Tint64_t) (r Ttime_t) {
  12936. return t64
  12937. }
  12938. // C documentation
  12939. //
  12940. // /*
  12941. // * Convert time_t to a 64 bit representation. If time_t is represented
  12942. // * as 32 bits we simply sign-extend and do not support times past 2038.
  12943. // */
  12944. func X_time_to_time64(tls *libc.TLS, t Ttime_t) (r Tint64_t) {
  12945. return t
  12946. }
  12947. // C documentation
  12948. //
  12949. // /*
  12950. // * Convert to/from 'long'. Depending on the sizeof(long) this may or
  12951. // * may not require using the 50-year rule.
  12952. // */
  12953. func X_time_to_long(tls *libc.TLS, t Ttime_t) (r int64) {
  12954. if uint64(8) == uint64(8) {
  12955. return X_time_to_time64(tls, t)
  12956. }
  12957. return t
  12958. }
  12959. func X_long_to_time(tls *libc.TLS, tlong int64) (r Ttime_t) {
  12960. if uint64(8) == uint64(4) {
  12961. return X_time32_to_time(tls, int32(tlong))
  12962. }
  12963. return tlong
  12964. }
  12965. // C documentation
  12966. //
  12967. // /*
  12968. // * Convert to/from 'int'. Depending on the sizeof(int) this may or
  12969. // * may not require using the 50-year rule.
  12970. // */
  12971. func X_time_to_int(tls *libc.TLS, t Ttime_t) (r int32) {
  12972. if uint64(4) == uint64(8) {
  12973. return int32(X_time_to_time64(tls, t))
  12974. }
  12975. return int32(t)
  12976. }
  12977. func X_int_to_time(tls *libc.TLS, tint int32) (r Ttime_t) {
  12978. if uint64(4) == uint64(4) {
  12979. return X_time32_to_time(tls, tint)
  12980. }
  12981. return int64(tint)
  12982. }
  12983. const m_S_AMP = 13
  12984. const m_S_CTRL = 4
  12985. const m_S_EATCRNL = 12
  12986. const m_S_GROUND = 0
  12987. const m_S_HEX = 7
  12988. const m_S_HEX1 = 8
  12989. const m_S_HEX2 = 9
  12990. const m_S_META = 2
  12991. const m_S_META1 = 3
  12992. const m_S_MIME1 = 10
  12993. const m_S_MIME2 = 11
  12994. const m_S_NUMBER = 14
  12995. const m_S_OCTAL2 = 5
  12996. const m_S_OCTAL3 = 6
  12997. const m_S_START = 1
  12998. const m_S_STRING = 15
  12999. const m_UNVIS_END = "_VIS_END"
  13000. const m_UNVIS_NOCHAR = 3
  13001. const m_UNVIS_VALID = 1
  13002. const m_UNVIS_VALIDPUSH = 2
  13003. const m_VIS_CSTYLE = 0x0002
  13004. const m_VIS_DQ = 0x8000
  13005. const m_VIS_GLOB = 0x1000
  13006. const m_VIS_HTTP1808 = 128
  13007. const m_VIS_HTTP1866 = 512
  13008. const m_VIS_HTTPSTYLE = 0x0080
  13009. const m_VIS_MIMESTYLE = 256
  13010. const m_VIS_NL = 0x0010
  13011. const m_VIS_NOESCAPE = 1024
  13012. const m_VIS_NOLOCALE = 0x4000
  13013. const m_VIS_NOSLASH = 0x0040
  13014. const m_VIS_OCTAL = 0x0001
  13015. const m_VIS_SAFE = 0x0020
  13016. const m_VIS_SHELL = 0x2000
  13017. const m_VIS_SP = 0x0004
  13018. const m_VIS_TAB = 0x0008
  13019. const m__VIS_END = 2048
  13020. /*
  13021. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  13022. *
  13023. * Redistribution and use in source and binary forms, with or without
  13024. * modification, are permitted provided that the following conditions
  13025. * are met:
  13026. * 1. Redistributions of source code must retain the above copyright
  13027. * notice, this list of conditions and the following disclaimer.
  13028. * 2. Redistributions in binary form must reproduce the above copyright
  13029. * notice, this list of conditions and the following disclaimer in the
  13030. * documentation and/or other materials provided with the distribution.
  13031. * 3. The name of the author may not be used to endorse or promote products
  13032. * derived from this software without specific prior written permission.
  13033. *
  13034. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  13035. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  13036. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  13037. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  13038. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13039. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  13040. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  13041. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  13042. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  13043. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  13044. */
  13045. /*
  13046. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  13047. *
  13048. * Redistribution and use in source and binary forms, with or without
  13049. * modification, are permitted provided that the following conditions
  13050. * are met:
  13051. * 1. Redistributions of source code must retain the above copyright
  13052. * notice, this list of conditions and the following disclaimer.
  13053. * 2. Redistributions in binary form must reproduce the above copyright
  13054. * notice, this list of conditions and the following disclaimer in the
  13055. * documentation and/or other materials provided with the distribution.
  13056. * 3. The name of the author may not be used to endorse or promote products
  13057. * derived from this software without specific prior written permission.
  13058. *
  13059. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  13060. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  13061. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  13062. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  13063. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13064. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  13065. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  13066. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  13067. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  13068. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  13069. */
  13070. /* Clang expands this to 1 if an identifier is *not* reserved. */
  13071. /*
  13072. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  13073. * musl, try to handle this gracefully.
  13074. */
  13075. /* Copyright (C) 1992-2022 Free Software Foundation, Inc.
  13076. Copyright The GNU Toolchain Authors.
  13077. This file is part of the GNU C Library.
  13078. The GNU C Library is free software; you can redistribute it and/or
  13079. modify it under the terms of the GNU Lesser General Public
  13080. License as published by the Free Software Foundation; either
  13081. version 2.1 of the License, or (at your option) any later version.
  13082. The GNU C Library is distributed in the hope that it will be useful,
  13083. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13084. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13085. Lesser General Public License for more details.
  13086. You should have received a copy of the GNU Lesser General Public
  13087. License along with the GNU C Library; if not, see
  13088. <https://www.gnu.org/licenses/>. */
  13089. /*
  13090. * decode driven by state machine
  13091. */
  13092. // C documentation
  13093. //
  13094. // /*
  13095. // * RFC 1866
  13096. // */
  13097. type Tnv = struct {
  13098. Fname [7]uint8
  13099. Fvalue Tuint8_t
  13100. }
  13101. /*
  13102. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  13103. *
  13104. * Redistribution and use in source and binary forms, with or without
  13105. * modification, are permitted provided that the following conditions
  13106. * are met:
  13107. * 1. Redistributions of source code must retain the above copyright
  13108. * notice, this list of conditions and the following disclaimer.
  13109. * 2. Redistributions in binary form must reproduce the above copyright
  13110. * notice, this list of conditions and the following disclaimer in the
  13111. * documentation and/or other materials provided with the distribution.
  13112. * 3. The name of the author may not be used to endorse or promote products
  13113. * derived from this software without specific prior written permission.
  13114. *
  13115. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  13116. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  13117. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  13118. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  13119. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13120. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  13121. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  13122. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  13123. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  13124. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  13125. */
  13126. /*
  13127. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  13128. *
  13129. * Redistribution and use in source and binary forms, with or without
  13130. * modification, are permitted provided that the following conditions
  13131. * are met:
  13132. * 1. Redistributions of source code must retain the above copyright
  13133. * notice, this list of conditions and the following disclaimer.
  13134. * 2. Redistributions in binary form must reproduce the above copyright
  13135. * notice, this list of conditions and the following disclaimer in the
  13136. * documentation and/or other materials provided with the distribution.
  13137. * 3. The name of the author may not be used to endorse or promote products
  13138. * derived from this software without specific prior written permission.
  13139. *
  13140. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  13141. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  13142. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  13143. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  13144. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13145. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  13146. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  13147. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  13148. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  13149. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  13150. */
  13151. /* Clang expands this to 1 if an identifier is *not* reserved. */
  13152. /*
  13153. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  13154. * musl, try to handle this gracefully.
  13155. */
  13156. /* Copyright (C) 1992-2022 Free Software Foundation, Inc.
  13157. Copyright The GNU Toolchain Authors.
  13158. This file is part of the GNU C Library.
  13159. The GNU C Library is free software; you can redistribute it and/or
  13160. modify it under the terms of the GNU Lesser General Public
  13161. License as published by the Free Software Foundation; either
  13162. version 2.1 of the License, or (at your option) any later version.
  13163. The GNU C Library is distributed in the hope that it will be useful,
  13164. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13165. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13166. Lesser General Public License for more details.
  13167. You should have received a copy of the GNU Lesser General Public
  13168. License along with the GNU C Library; if not, see
  13169. <https://www.gnu.org/licenses/>. */
  13170. /*
  13171. * decode driven by state machine
  13172. */
  13173. // C documentation
  13174. //
  13175. // /*
  13176. // * RFC 1866
  13177. // */
  13178. var _nv = [100]Tnv{
  13179. 0: {
  13180. Fname: [7]uint8{'A', 'E', 'l', 'i', 'g'},
  13181. Fvalue: uint8(198),
  13182. },
  13183. 1: {
  13184. Fname: [7]uint8{'A', 'a', 'c', 'u', 't', 'e'},
  13185. Fvalue: uint8(193),
  13186. },
  13187. 2: {
  13188. Fname: [7]uint8{'A', 'c', 'i', 'r', 'c'},
  13189. Fvalue: uint8(194),
  13190. },
  13191. 3: {
  13192. Fname: [7]uint8{'A', 'g', 'r', 'a', 'v', 'e'},
  13193. Fvalue: uint8(192),
  13194. },
  13195. 4: {
  13196. Fname: [7]uint8{'A', 'r', 'i', 'n', 'g'},
  13197. Fvalue: uint8(197),
  13198. },
  13199. 5: {
  13200. Fname: [7]uint8{'A', 't', 'i', 'l', 'd', 'e'},
  13201. Fvalue: uint8(195),
  13202. },
  13203. 6: {
  13204. Fname: [7]uint8{'A', 'u', 'm', 'l'},
  13205. Fvalue: uint8(196),
  13206. },
  13207. 7: {
  13208. Fname: [7]uint8{'C', 'c', 'e', 'd', 'i', 'l'},
  13209. Fvalue: uint8(199),
  13210. },
  13211. 8: {
  13212. Fname: [7]uint8{'E', 'T', 'H'},
  13213. Fvalue: uint8(208),
  13214. },
  13215. 9: {
  13216. Fname: [7]uint8{'E', 'a', 'c', 'u', 't', 'e'},
  13217. Fvalue: uint8(201),
  13218. },
  13219. 10: {
  13220. Fname: [7]uint8{'E', 'c', 'i', 'r', 'c'},
  13221. Fvalue: uint8(202),
  13222. },
  13223. 11: {
  13224. Fname: [7]uint8{'E', 'g', 'r', 'a', 'v', 'e'},
  13225. Fvalue: uint8(200),
  13226. },
  13227. 12: {
  13228. Fname: [7]uint8{'E', 'u', 'm', 'l'},
  13229. Fvalue: uint8(203),
  13230. },
  13231. 13: {
  13232. Fname: [7]uint8{'I', 'a', 'c', 'u', 't', 'e'},
  13233. Fvalue: uint8(205),
  13234. },
  13235. 14: {
  13236. Fname: [7]uint8{'I', 'c', 'i', 'r', 'c'},
  13237. Fvalue: uint8(206),
  13238. },
  13239. 15: {
  13240. Fname: [7]uint8{'I', 'g', 'r', 'a', 'v', 'e'},
  13241. Fvalue: uint8(204),
  13242. },
  13243. 16: {
  13244. Fname: [7]uint8{'I', 'u', 'm', 'l'},
  13245. Fvalue: uint8(207),
  13246. },
  13247. 17: {
  13248. Fname: [7]uint8{'N', 't', 'i', 'l', 'd', 'e'},
  13249. Fvalue: uint8(209),
  13250. },
  13251. 18: {
  13252. Fname: [7]uint8{'O', 'a', 'c', 'u', 't', 'e'},
  13253. Fvalue: uint8(211),
  13254. },
  13255. 19: {
  13256. Fname: [7]uint8{'O', 'c', 'i', 'r', 'c'},
  13257. Fvalue: uint8(212),
  13258. },
  13259. 20: {
  13260. Fname: [7]uint8{'O', 'g', 'r', 'a', 'v', 'e'},
  13261. Fvalue: uint8(210),
  13262. },
  13263. 21: {
  13264. Fname: [7]uint8{'O', 's', 'l', 'a', 's', 'h'},
  13265. Fvalue: uint8(216),
  13266. },
  13267. 22: {
  13268. Fname: [7]uint8{'O', 't', 'i', 'l', 'd', 'e'},
  13269. Fvalue: uint8(213),
  13270. },
  13271. 23: {
  13272. Fname: [7]uint8{'O', 'u', 'm', 'l'},
  13273. Fvalue: uint8(214),
  13274. },
  13275. 24: {
  13276. Fname: [7]uint8{'T', 'H', 'O', 'R', 'N'},
  13277. Fvalue: uint8(222),
  13278. },
  13279. 25: {
  13280. Fname: [7]uint8{'U', 'a', 'c', 'u', 't', 'e'},
  13281. Fvalue: uint8(218),
  13282. },
  13283. 26: {
  13284. Fname: [7]uint8{'U', 'c', 'i', 'r', 'c'},
  13285. Fvalue: uint8(219),
  13286. },
  13287. 27: {
  13288. Fname: [7]uint8{'U', 'g', 'r', 'a', 'v', 'e'},
  13289. Fvalue: uint8(217),
  13290. },
  13291. 28: {
  13292. Fname: [7]uint8{'U', 'u', 'm', 'l'},
  13293. Fvalue: uint8(220),
  13294. },
  13295. 29: {
  13296. Fname: [7]uint8{'Y', 'a', 'c', 'u', 't', 'e'},
  13297. Fvalue: uint8(221),
  13298. },
  13299. 30: {
  13300. Fname: [7]uint8{'a', 'a', 'c', 'u', 't', 'e'},
  13301. Fvalue: uint8(225),
  13302. },
  13303. 31: {
  13304. Fname: [7]uint8{'a', 'c', 'i', 'r', 'c'},
  13305. Fvalue: uint8(226),
  13306. },
  13307. 32: {
  13308. Fname: [7]uint8{'a', 'c', 'u', 't', 'e'},
  13309. Fvalue: uint8(180),
  13310. },
  13311. 33: {
  13312. Fname: [7]uint8{'a', 'e', 'l', 'i', 'g'},
  13313. Fvalue: uint8(230),
  13314. },
  13315. 34: {
  13316. Fname: [7]uint8{'a', 'g', 'r', 'a', 'v', 'e'},
  13317. Fvalue: uint8(224),
  13318. },
  13319. 35: {
  13320. Fname: [7]uint8{'a', 'm', 'p'},
  13321. Fvalue: uint8(38),
  13322. },
  13323. 36: {
  13324. Fname: [7]uint8{'a', 'r', 'i', 'n', 'g'},
  13325. Fvalue: uint8(229),
  13326. },
  13327. 37: {
  13328. Fname: [7]uint8{'a', 't', 'i', 'l', 'd', 'e'},
  13329. Fvalue: uint8(227),
  13330. },
  13331. 38: {
  13332. Fname: [7]uint8{'a', 'u', 'm', 'l'},
  13333. Fvalue: uint8(228),
  13334. },
  13335. 39: {
  13336. Fname: [7]uint8{'b', 'r', 'v', 'b', 'a', 'r'},
  13337. Fvalue: uint8(166),
  13338. },
  13339. 40: {
  13340. Fname: [7]uint8{'c', 'c', 'e', 'd', 'i', 'l'},
  13341. Fvalue: uint8(231),
  13342. },
  13343. 41: {
  13344. Fname: [7]uint8{'c', 'e', 'd', 'i', 'l'},
  13345. Fvalue: uint8(184),
  13346. },
  13347. 42: {
  13348. Fname: [7]uint8{'c', 'e', 'n', 't'},
  13349. Fvalue: uint8(162),
  13350. },
  13351. 43: {
  13352. Fname: [7]uint8{'c', 'o', 'p', 'y'},
  13353. Fvalue: uint8(169),
  13354. },
  13355. 44: {
  13356. Fname: [7]uint8{'c', 'u', 'r', 'r', 'e', 'n'},
  13357. Fvalue: uint8(164),
  13358. },
  13359. 45: {
  13360. Fname: [7]uint8{'d', 'e', 'g'},
  13361. Fvalue: uint8(176),
  13362. },
  13363. 46: {
  13364. Fname: [7]uint8{'d', 'i', 'v', 'i', 'd', 'e'},
  13365. Fvalue: uint8(247),
  13366. },
  13367. 47: {
  13368. Fname: [7]uint8{'e', 'a', 'c', 'u', 't', 'e'},
  13369. Fvalue: uint8(233),
  13370. },
  13371. 48: {
  13372. Fname: [7]uint8{'e', 'c', 'i', 'r', 'c'},
  13373. Fvalue: uint8(234),
  13374. },
  13375. 49: {
  13376. Fname: [7]uint8{'e', 'g', 'r', 'a', 'v', 'e'},
  13377. Fvalue: uint8(232),
  13378. },
  13379. 50: {
  13380. Fname: [7]uint8{'e', 't', 'h'},
  13381. Fvalue: uint8(240),
  13382. },
  13383. 51: {
  13384. Fname: [7]uint8{'e', 'u', 'm', 'l'},
  13385. Fvalue: uint8(235),
  13386. },
  13387. 52: {
  13388. Fname: [7]uint8{'f', 'r', 'a', 'c', '1', '2'},
  13389. Fvalue: uint8(189),
  13390. },
  13391. 53: {
  13392. Fname: [7]uint8{'f', 'r', 'a', 'c', '1', '4'},
  13393. Fvalue: uint8(188),
  13394. },
  13395. 54: {
  13396. Fname: [7]uint8{'f', 'r', 'a', 'c', '3', '4'},
  13397. Fvalue: uint8(190),
  13398. },
  13399. 55: {
  13400. Fname: [7]uint8{'g', 't'},
  13401. Fvalue: uint8(62),
  13402. },
  13403. 56: {
  13404. Fname: [7]uint8{'i', 'a', 'c', 'u', 't', 'e'},
  13405. Fvalue: uint8(237),
  13406. },
  13407. 57: {
  13408. Fname: [7]uint8{'i', 'c', 'i', 'r', 'c'},
  13409. Fvalue: uint8(238),
  13410. },
  13411. 58: {
  13412. Fname: [7]uint8{'i', 'e', 'x', 'c', 'l'},
  13413. Fvalue: uint8(161),
  13414. },
  13415. 59: {
  13416. Fname: [7]uint8{'i', 'g', 'r', 'a', 'v', 'e'},
  13417. Fvalue: uint8(236),
  13418. },
  13419. 60: {
  13420. Fname: [7]uint8{'i', 'q', 'u', 'e', 's', 't'},
  13421. Fvalue: uint8(191),
  13422. },
  13423. 61: {
  13424. Fname: [7]uint8{'i', 'u', 'm', 'l'},
  13425. Fvalue: uint8(239),
  13426. },
  13427. 62: {
  13428. Fname: [7]uint8{'l', 'a', 'q', 'u', 'o'},
  13429. Fvalue: uint8(171),
  13430. },
  13431. 63: {
  13432. Fname: [7]uint8{'l', 't'},
  13433. Fvalue: uint8(60),
  13434. },
  13435. 64: {
  13436. Fname: [7]uint8{'m', 'a', 'c', 'r'},
  13437. Fvalue: uint8(175),
  13438. },
  13439. 65: {
  13440. Fname: [7]uint8{'m', 'i', 'c', 'r', 'o'},
  13441. Fvalue: uint8(181),
  13442. },
  13443. 66: {
  13444. Fname: [7]uint8{'m', 'i', 'd', 'd', 'o', 't'},
  13445. Fvalue: uint8(183),
  13446. },
  13447. 67: {
  13448. Fname: [7]uint8{'n', 'b', 's', 'p'},
  13449. Fvalue: uint8(160),
  13450. },
  13451. 68: {
  13452. Fname: [7]uint8{'n', 'o', 't'},
  13453. Fvalue: uint8(172),
  13454. },
  13455. 69: {
  13456. Fname: [7]uint8{'n', 't', 'i', 'l', 'd', 'e'},
  13457. Fvalue: uint8(241),
  13458. },
  13459. 70: {
  13460. Fname: [7]uint8{'o', 'a', 'c', 'u', 't', 'e'},
  13461. Fvalue: uint8(243),
  13462. },
  13463. 71: {
  13464. Fname: [7]uint8{'o', 'c', 'i', 'r', 'c'},
  13465. Fvalue: uint8(244),
  13466. },
  13467. 72: {
  13468. Fname: [7]uint8{'o', 'g', 'r', 'a', 'v', 'e'},
  13469. Fvalue: uint8(242),
  13470. },
  13471. 73: {
  13472. Fname: [7]uint8{'o', 'r', 'd', 'f'},
  13473. Fvalue: uint8(170),
  13474. },
  13475. 74: {
  13476. Fname: [7]uint8{'o', 'r', 'd', 'm'},
  13477. Fvalue: uint8(186),
  13478. },
  13479. 75: {
  13480. Fname: [7]uint8{'o', 's', 'l', 'a', 's', 'h'},
  13481. Fvalue: uint8(248),
  13482. },
  13483. 76: {
  13484. Fname: [7]uint8{'o', 't', 'i', 'l', 'd', 'e'},
  13485. Fvalue: uint8(245),
  13486. },
  13487. 77: {
  13488. Fname: [7]uint8{'o', 'u', 'm', 'l'},
  13489. Fvalue: uint8(246),
  13490. },
  13491. 78: {
  13492. Fname: [7]uint8{'p', 'a', 'r', 'a'},
  13493. Fvalue: uint8(182),
  13494. },
  13495. 79: {
  13496. Fname: [7]uint8{'p', 'l', 'u', 's', 'm', 'n'},
  13497. Fvalue: uint8(177),
  13498. },
  13499. 80: {
  13500. Fname: [7]uint8{'p', 'o', 'u', 'n', 'd'},
  13501. Fvalue: uint8(163),
  13502. },
  13503. 81: {
  13504. Fname: [7]uint8{'q', 'u', 'o', 't'},
  13505. Fvalue: uint8(34),
  13506. },
  13507. 82: {
  13508. Fname: [7]uint8{'r', 'a', 'q', 'u', 'o'},
  13509. Fvalue: uint8(187),
  13510. },
  13511. 83: {
  13512. Fname: [7]uint8{'r', 'e', 'g'},
  13513. Fvalue: uint8(174),
  13514. },
  13515. 84: {
  13516. Fname: [7]uint8{'s', 'e', 'c', 't'},
  13517. Fvalue: uint8(167),
  13518. },
  13519. 85: {
  13520. Fname: [7]uint8{'s', 'h', 'y'},
  13521. Fvalue: uint8(173),
  13522. },
  13523. 86: {
  13524. Fname: [7]uint8{'s', 'u', 'p', '1'},
  13525. Fvalue: uint8(185),
  13526. },
  13527. 87: {
  13528. Fname: [7]uint8{'s', 'u', 'p', '2'},
  13529. Fvalue: uint8(178),
  13530. },
  13531. 88: {
  13532. Fname: [7]uint8{'s', 'u', 'p', '3'},
  13533. Fvalue: uint8(179),
  13534. },
  13535. 89: {
  13536. Fname: [7]uint8{'s', 'z', 'l', 'i', 'g'},
  13537. Fvalue: uint8(223),
  13538. },
  13539. 90: {
  13540. Fname: [7]uint8{'t', 'h', 'o', 'r', 'n'},
  13541. Fvalue: uint8(254),
  13542. },
  13543. 91: {
  13544. Fname: [7]uint8{'t', 'i', 'm', 'e', 's'},
  13545. Fvalue: uint8(215),
  13546. },
  13547. 92: {
  13548. Fname: [7]uint8{'u', 'a', 'c', 'u', 't', 'e'},
  13549. Fvalue: uint8(250),
  13550. },
  13551. 93: {
  13552. Fname: [7]uint8{'u', 'c', 'i', 'r', 'c'},
  13553. Fvalue: uint8(251),
  13554. },
  13555. 94: {
  13556. Fname: [7]uint8{'u', 'g', 'r', 'a', 'v', 'e'},
  13557. Fvalue: uint8(249),
  13558. },
  13559. 95: {
  13560. Fname: [7]uint8{'u', 'm', 'l'},
  13561. Fvalue: uint8(168),
  13562. },
  13563. 96: {
  13564. Fname: [7]uint8{'u', 'u', 'm', 'l'},
  13565. Fvalue: uint8(252),
  13566. },
  13567. 97: {
  13568. Fname: [7]uint8{'y', 'a', 'c', 'u', 't', 'e'},
  13569. Fvalue: uint8(253),
  13570. },
  13571. 98: {
  13572. Fname: [7]uint8{'y', 'e', 'n'},
  13573. Fvalue: uint8(165),
  13574. },
  13575. 99: {
  13576. Fname: [7]uint8{'y', 'u', 'm', 'l'},
  13577. Fvalue: uint8(255),
  13578. },
  13579. }
  13580. // C documentation
  13581. //
  13582. // /*
  13583. // * unvis - decode characters previously encoded by vis
  13584. // */
  13585. func Xunvis(tls *libc.TLS, cp uintptr, c int32, astate uintptr, flag int32) (r int32) {
  13586. var ia, is, lc, st, uc uint8
  13587. var v22, v23, v24, v25, v26 int32
  13588. var p19, p20, p21, p28 uintptr
  13589. _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ia, is, lc, st, uc, v22, v23, v24, v25, v26, p19, p20, p21, p28
  13590. uc = libc.Uint8FromInt32(c)
  13591. /*
  13592. * Bottom 8 bits of astate hold the state machine state.
  13593. * Top 8 bits hold the current character in the http 1866 nv string decoding
  13594. */
  13595. st = libc.Uint8FromInt32(*(*int32)(unsafe.Pointer(astate)) & libc.Int32FromInt32(0xff))
  13596. if flag&int32(m__VIS_END) != 0 {
  13597. switch libc.Int32FromUint8(st) {
  13598. case int32(m_S_OCTAL2):
  13599. fallthrough
  13600. case int32(m_S_OCTAL3):
  13601. fallthrough
  13602. case int32(m_S_HEX2):
  13603. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13604. return int32(m_UNVIS_VALID)
  13605. case m_S_GROUND:
  13606. return int32(m_UNVIS_NOCHAR)
  13607. default:
  13608. return -int32(1)
  13609. }
  13610. }
  13611. switch libc.Int32FromUint8(st) {
  13612. case m_S_GROUND:
  13613. goto _1
  13614. case int32(m_S_START):
  13615. goto _2
  13616. case int32(m_S_META):
  13617. goto _3
  13618. case int32(m_S_META1):
  13619. goto _4
  13620. case int32(m_S_CTRL):
  13621. goto _5
  13622. case int32(m_S_OCTAL2):
  13623. goto _6
  13624. case int32(m_S_OCTAL3):
  13625. goto _7
  13626. case int32(m_S_HEX):
  13627. goto _8
  13628. case int32(m_S_HEX1):
  13629. goto _9
  13630. case int32(m_S_HEX2):
  13631. goto _10
  13632. case int32(m_S_MIME1):
  13633. goto _11
  13634. case int32(m_S_MIME2):
  13635. goto _12
  13636. case int32(m_S_EATCRNL):
  13637. goto _13
  13638. case int32(m_S_AMP):
  13639. goto _14
  13640. case int32(m_S_STRING):
  13641. goto _15
  13642. case int32(m_S_NUMBER):
  13643. goto _16
  13644. default:
  13645. goto _17
  13646. }
  13647. goto _18
  13648. _1:
  13649. ;
  13650. *(*uint8)(unsafe.Pointer(cp)) = uint8(0)
  13651. if flag&int32(m_VIS_NOESCAPE) == 0 && c == int32('\\') {
  13652. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_START)))
  13653. return int32(m_UNVIS_NOCHAR)
  13654. }
  13655. if flag&int32(m_VIS_HTTP1808) != 0 && c == int32('%') {
  13656. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_HEX1)))
  13657. return int32(m_UNVIS_NOCHAR)
  13658. }
  13659. if flag&int32(m_VIS_HTTP1866) != 0 && c == int32('&') {
  13660. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_AMP)))
  13661. return int32(m_UNVIS_NOCHAR)
  13662. }
  13663. if flag&int32(m_VIS_MIMESTYLE) != 0 && c == int32('=') {
  13664. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_MIME1)))
  13665. return int32(m_UNVIS_NOCHAR)
  13666. }
  13667. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(c)
  13668. return int32(m_UNVIS_VALID)
  13669. _2:
  13670. ;
  13671. switch c {
  13672. case int32('\\'):
  13673. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(c)
  13674. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13675. return int32(m_UNVIS_VALID)
  13676. case int32('0'):
  13677. fallthrough
  13678. case int32('1'):
  13679. fallthrough
  13680. case int32('2'):
  13681. fallthrough
  13682. case int32('3'):
  13683. fallthrough
  13684. case int32('4'):
  13685. fallthrough
  13686. case int32('5'):
  13687. fallthrough
  13688. case int32('6'):
  13689. fallthrough
  13690. case int32('7'):
  13691. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(c - libc.Int32FromUint8('0'))
  13692. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_OCTAL2)))
  13693. return int32(m_UNVIS_NOCHAR)
  13694. case int32('M'):
  13695. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(0200)
  13696. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_META)))
  13697. return int32(m_UNVIS_NOCHAR)
  13698. case int32('^'):
  13699. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_CTRL)))
  13700. return int32(m_UNVIS_NOCHAR)
  13701. case int32('n'):
  13702. *(*uint8)(unsafe.Pointer(cp)) = uint8('\n')
  13703. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13704. return int32(m_UNVIS_VALID)
  13705. case int32('r'):
  13706. *(*uint8)(unsafe.Pointer(cp)) = uint8('\r')
  13707. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13708. return int32(m_UNVIS_VALID)
  13709. case int32('b'):
  13710. *(*uint8)(unsafe.Pointer(cp)) = uint8('\b')
  13711. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13712. return int32(m_UNVIS_VALID)
  13713. case int32('a'):
  13714. *(*uint8)(unsafe.Pointer(cp)) = uint8('\007')
  13715. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13716. return int32(m_UNVIS_VALID)
  13717. case int32('v'):
  13718. *(*uint8)(unsafe.Pointer(cp)) = uint8('\v')
  13719. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13720. return int32(m_UNVIS_VALID)
  13721. case int32('t'):
  13722. *(*uint8)(unsafe.Pointer(cp)) = uint8('\t')
  13723. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13724. return int32(m_UNVIS_VALID)
  13725. case int32('f'):
  13726. *(*uint8)(unsafe.Pointer(cp)) = uint8('\f')
  13727. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13728. return int32(m_UNVIS_VALID)
  13729. case int32('s'):
  13730. *(*uint8)(unsafe.Pointer(cp)) = uint8(' ')
  13731. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13732. return int32(m_UNVIS_VALID)
  13733. case int32('E'):
  13734. *(*uint8)(unsafe.Pointer(cp)) = uint8('\033')
  13735. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13736. return int32(m_UNVIS_VALID)
  13737. case int32('x'):
  13738. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_HEX)))
  13739. return int32(m_UNVIS_NOCHAR)
  13740. case int32('\n'):
  13741. /*
  13742. * hidden newline
  13743. */
  13744. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13745. return int32(m_UNVIS_NOCHAR)
  13746. case int32('$'):
  13747. /*
  13748. * hidden marker
  13749. */
  13750. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13751. return int32(m_UNVIS_NOCHAR)
  13752. default:
  13753. if libc.BoolInt32(libc.Uint32FromInt32(c)-uint32(0x21) < uint32(0x5e)) != 0 {
  13754. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(c)
  13755. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13756. return int32(m_UNVIS_VALID)
  13757. }
  13758. }
  13759. goto bad
  13760. _3:
  13761. ;
  13762. if c == int32('-') {
  13763. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_META1)))
  13764. } else {
  13765. if c == int32('^') {
  13766. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_CTRL)))
  13767. } else {
  13768. goto bad
  13769. }
  13770. }
  13771. return int32(m_UNVIS_NOCHAR)
  13772. _4:
  13773. ;
  13774. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13775. p19 = cp
  13776. *(*uint8)(unsafe.Pointer(p19)) = uint8(int32(*(*uint8)(unsafe.Pointer(p19))) | c)
  13777. return int32(m_UNVIS_VALID)
  13778. _5:
  13779. ;
  13780. if c == int32('?') {
  13781. p20 = cp
  13782. *(*uint8)(unsafe.Pointer(p20)) = uint8(int32(*(*uint8)(unsafe.Pointer(p20))) | libc.Int32FromInt32(0177))
  13783. } else {
  13784. p21 = cp
  13785. *(*uint8)(unsafe.Pointer(p21)) = uint8(int32(*(*uint8)(unsafe.Pointer(p21))) | c&libc.Int32FromInt32(037))
  13786. }
  13787. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13788. return int32(m_UNVIS_VALID)
  13789. _6:
  13790. ; /* second possible octal digit */
  13791. if libc.Int32FromUint8(uc) >= int32('0') && libc.Int32FromUint8(uc) <= int32('7') {
  13792. /*
  13793. * yes - and maybe a third
  13794. */
  13795. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))<<int32(3) + (c - int32('0')))
  13796. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_OCTAL3)))
  13797. return int32(m_UNVIS_NOCHAR)
  13798. }
  13799. /*
  13800. * no - done with current sequence, push back passed char
  13801. */
  13802. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13803. return int32(m_UNVIS_VALIDPUSH)
  13804. _7:
  13805. ; /* third possible octal digit */
  13806. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13807. if libc.Int32FromUint8(uc) >= int32('0') && libc.Int32FromUint8(uc) <= int32('7') {
  13808. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))<<int32(3) + (c - int32('0')))
  13809. return int32(m_UNVIS_VALID)
  13810. }
  13811. /*
  13812. * we were done, push back passed char
  13813. */
  13814. return int32(m_UNVIS_VALIDPUSH)
  13815. _8:
  13816. ;
  13817. if !(libc.Xisxdigit(tls, libc.Int32FromUint8(uc)) != 0) {
  13818. goto bad
  13819. }
  13820. /*FALLTHROUGH*/
  13821. _9:
  13822. ;
  13823. if libc.Xisxdigit(tls, libc.Int32FromUint8(uc)) != 0 {
  13824. if libc.BoolInt32(uint32(uc)-uint32('0') < uint32(10)) != 0 {
  13825. v22 = libc.Int32FromUint8(uc) - int32('0')
  13826. } else {
  13827. v22 = libc.Xtolower(tls, libc.Int32FromUint8(uc)) - int32('a') + int32(10)
  13828. }
  13829. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(v22)
  13830. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_HEX2)))
  13831. return int32(m_UNVIS_NOCHAR)
  13832. }
  13833. /*
  13834. * no - done with current sequence, push back passed char
  13835. */
  13836. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13837. return int32(m_UNVIS_VALIDPUSH)
  13838. _10:
  13839. ;
  13840. *(*int32)(unsafe.Pointer(astate)) = m_S_GROUND
  13841. if libc.Xisxdigit(tls, libc.Int32FromUint8(uc)) != 0 {
  13842. if libc.BoolInt32(uint32(uc)-uint32('0') < uint32(10)) != 0 {
  13843. v23 = libc.Int32FromUint8(uc) - int32('0')
  13844. } else {
  13845. v23 = libc.Xtolower(tls, libc.Int32FromUint8(uc)) - int32('a') + int32(10)
  13846. }
  13847. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(v23 | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))<<int32(4))
  13848. return int32(m_UNVIS_VALID)
  13849. }
  13850. return int32(m_UNVIS_VALIDPUSH)
  13851. _11:
  13852. ;
  13853. if libc.Int32FromUint8(uc) == int32('\n') || libc.Int32FromUint8(uc) == int32('\r') {
  13854. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_EATCRNL)))
  13855. return int32(m_UNVIS_NOCHAR)
  13856. }
  13857. 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) {
  13858. if libc.BoolInt32(uint32(uc)-uint32('0') < uint32(10)) != 0 {
  13859. v24 = libc.Int32FromUint8(uc) - int32('0')
  13860. } else {
  13861. v24 = libc.Int32FromUint8(uc) - int32('A') + int32(10)
  13862. }
  13863. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(v24)
  13864. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_MIME2)))
  13865. return int32(m_UNVIS_NOCHAR)
  13866. }
  13867. goto bad
  13868. _12:
  13869. ;
  13870. 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) {
  13871. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13872. if libc.BoolInt32(uint32(uc)-uint32('0') < uint32(10)) != 0 {
  13873. v25 = libc.Int32FromUint8(uc) - int32('0')
  13874. } else {
  13875. v25 = libc.Int32FromUint8(uc) - int32('A') + int32(10)
  13876. }
  13877. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(v25 | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))<<int32(4))
  13878. return int32(m_UNVIS_VALID)
  13879. }
  13880. goto bad
  13881. _13:
  13882. ;
  13883. switch libc.Int32FromUint8(uc) {
  13884. case int32('\r'):
  13885. fallthrough
  13886. case int32('\n'):
  13887. return int32(m_UNVIS_NOCHAR)
  13888. case int32('='):
  13889. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_MIME1)))
  13890. return int32(m_UNVIS_NOCHAR)
  13891. default:
  13892. *(*uint8)(unsafe.Pointer(cp)) = uc
  13893. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13894. return int32(m_UNVIS_VALID)
  13895. }
  13896. _14:
  13897. ;
  13898. *(*uint8)(unsafe.Pointer(cp)) = uint8(0)
  13899. if libc.Int32FromUint8(uc) == int32('#') {
  13900. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_NUMBER)))
  13901. return int32(m_UNVIS_NOCHAR)
  13902. }
  13903. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_STRING)))
  13904. /*FALLTHROUGH*/
  13905. _15:
  13906. ;
  13907. ia = *(*uint8)(unsafe.Pointer(cp)) /* index in the array */
  13908. is = uint8(libc.Uint32FromInt32(*(*int32)(unsafe.Pointer(astate))) >> libc.Int32FromInt32(24)) /* index in the string */
  13909. if libc.Int32FromUint8(is) == 0 {
  13910. v26 = 0
  13911. } else {
  13912. v26 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_nv)) + uintptr(ia)*8 + uintptr(libc.Int32FromUint8(is)-int32(1)))))
  13913. }
  13914. lc = libc.Uint8FromInt32(v26) /* last character */
  13915. if libc.Int32FromUint8(uc) == int32(';') {
  13916. uc = uint8('\000')
  13917. }
  13918. for {
  13919. if !(uint64(ia) < libc.Uint64FromInt64(800)/libc.Uint64FromInt64(8)) {
  13920. break
  13921. }
  13922. 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) {
  13923. goto bad
  13924. }
  13925. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_nv)) + uintptr(ia)*8 + uintptr(is)))) == libc.Int32FromUint8(uc) {
  13926. break
  13927. }
  13928. goto _27
  13929. _27:
  13930. ;
  13931. ia++
  13932. }
  13933. if uint64(ia) == libc.Uint64FromInt64(800)/libc.Uint64FromInt64(8) {
  13934. goto bad
  13935. }
  13936. if libc.Int32FromUint8(uc) != 0 {
  13937. *(*uint8)(unsafe.Pointer(cp)) = ia
  13938. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromUint8(is)+libc.Int32FromInt32(1))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_STRING)))
  13939. return int32(m_UNVIS_NOCHAR)
  13940. }
  13941. *(*uint8)(unsafe.Pointer(cp)) = _nv[ia].Fvalue
  13942. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13943. return int32(m_UNVIS_VALID)
  13944. _16:
  13945. ;
  13946. if libc.Int32FromUint8(uc) == int32(';') {
  13947. return int32(m_UNVIS_VALID)
  13948. }
  13949. if !(libc.BoolInt32(uint32(uc)-libc.Uint32FromUint8('0') < libc.Uint32FromInt32(10)) != 0) {
  13950. goto bad
  13951. }
  13952. p28 = cp
  13953. *(*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')))
  13954. return int32(m_UNVIS_NOCHAR)
  13955. _17:
  13956. ;
  13957. goto bad
  13958. bad:
  13959. ;
  13960. /*
  13961. * decoder in unknown state - (probably uninitialized)
  13962. */
  13963. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13964. return -int32(1)
  13965. _18:
  13966. ;
  13967. return r
  13968. }
  13969. /*
  13970. * strnunvisx - decode src into dst
  13971. *
  13972. * Number of chars decoded into dst is returned, -1 on error.
  13973. * Dst is null terminated.
  13974. */
  13975. func Xstrnunvisx(tls *libc.TLS, dst uintptr, dlen Tsize_t, src uintptr, flag int32) (r int32) {
  13976. bp := tls.Alloc(16)
  13977. defer tls.Free(16)
  13978. var c, v1 uint8
  13979. var start, v14, v16, v18, v2 uintptr
  13980. var v13, v15, v17, v19 Tsize_t
  13981. var _ /* state at bp+4 */ int32
  13982. var _ /* t at bp+0 */ uint8
  13983. _, _, _, _, _, _, _, _, _, _, _ = c, start, v1, v13, v14, v15, v16, v17, v18, v19, v2
  13984. *(*uint8)(unsafe.Pointer(bp)) = uint8('\000')
  13985. start = dst
  13986. *(*int32)(unsafe.Pointer(bp + 4)) = 0
  13987. for {
  13988. v2 = src
  13989. src++
  13990. v1 = *(*uint8)(unsafe.Pointer(v2))
  13991. c = v1
  13992. if !(libc.Int32FromUint8(v1) != int32('\000')) {
  13993. break
  13994. }
  13995. goto again
  13996. again:
  13997. ;
  13998. switch Xunvis(tls, bp, libc.Int32FromUint8(c), bp+4, flag) {
  13999. case int32(m_UNVIS_VALID):
  14000. goto _3
  14001. case int32(m_UNVIS_VALIDPUSH):
  14002. goto _4
  14003. case int32(m_UNVIS_NOCHAR):
  14004. goto _5
  14005. case 0:
  14006. goto _6
  14007. case -int32(1):
  14008. goto _7
  14009. default:
  14010. goto _8
  14011. }
  14012. goto _9
  14013. _3:
  14014. ;
  14015. _12:
  14016. ;
  14017. v13 = dlen
  14018. dlen--
  14019. if v13 == uint64(0) {
  14020. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14021. return -int32(1)
  14022. }
  14023. goto _11
  14024. _11:
  14025. ;
  14026. if 0 != 0 {
  14027. goto _12
  14028. }
  14029. goto _10
  14030. _10:
  14031. ;
  14032. v14 = dst
  14033. dst++
  14034. *(*uint8)(unsafe.Pointer(v14)) = *(*uint8)(unsafe.Pointer(bp))
  14035. goto _9
  14036. _4:
  14037. ;
  14038. v15 = dlen
  14039. dlen--
  14040. if v15 == uint64(0) {
  14041. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14042. return -int32(1)
  14043. }
  14044. v16 = dst
  14045. dst++
  14046. *(*uint8)(unsafe.Pointer(v16)) = *(*uint8)(unsafe.Pointer(bp))
  14047. goto again
  14048. _6:
  14049. ;
  14050. _5:
  14051. ;
  14052. goto _9
  14053. _7:
  14054. ;
  14055. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  14056. return -int32(1)
  14057. _8:
  14058. ;
  14059. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  14060. return -int32(1)
  14061. _9:
  14062. }
  14063. if Xunvis(tls, bp, libc.Int32FromUint8(c), bp+4, int32(m__VIS_END)) == int32(m_UNVIS_VALID) {
  14064. v17 = dlen
  14065. dlen--
  14066. if v17 == uint64(0) {
  14067. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14068. return -int32(1)
  14069. }
  14070. v18 = dst
  14071. dst++
  14072. *(*uint8)(unsafe.Pointer(v18)) = *(*uint8)(unsafe.Pointer(bp))
  14073. }
  14074. v19 = dlen
  14075. dlen--
  14076. if v19 == uint64(0) {
  14077. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14078. return -int32(1)
  14079. }
  14080. *(*uint8)(unsafe.Pointer(dst)) = uint8('\000')
  14081. return int32(int64(dst) - int64(start))
  14082. }
  14083. func Xstrunvisx(tls *libc.TLS, dst uintptr, src uintptr, flag int32) (r int32) {
  14084. return Xstrnunvisx(tls, dst, libc.Uint64FromInt32(^libc.Int32FromInt32(0)), src, flag)
  14085. }
  14086. func Xstrunvis(tls *libc.TLS, dst uintptr, src uintptr) (r int32) {
  14087. return Xstrnunvisx(tls, dst, libc.Uint64FromInt32(^libc.Int32FromInt32(0)), src, 0)
  14088. }
  14089. func Xstrnunvis_openbsd(tls *libc.TLS, dst uintptr, src uintptr, dlen Tsize_t) (r Tssize_t) {
  14090. return int64(Xstrnunvisx(tls, dst, dlen, src, 0))
  14091. }
  14092. func Xstrnunvis_netbsd(tls *libc.TLS, dst uintptr, dlen Tsize_t, src uintptr) (r int32) {
  14093. return Xstrnunvisx(tls, dst, dlen, src, 0)
  14094. }
  14095. const m_MAXEXTRAS = 30
  14096. const m_VIS_CSTYLE1 = 2
  14097. const m_VIS_DQ1 = 32768
  14098. const m_VIS_GLOB1 = 4096
  14099. const m_VIS_HTTP18081 = 0x0080
  14100. const m_VIS_HTTP18661 = 0x0200
  14101. const m_VIS_HTTPSTYLE1 = 128
  14102. const m_VIS_NL1 = 16
  14103. const m_VIS_NOESCAPE1 = 0x0400
  14104. const m_VIS_NOLOCALE1 = 16384
  14105. const m_VIS_NOSLASH1 = 64
  14106. const m_VIS_OCTAL1 = 1
  14107. const m_VIS_SAFE1 = 32
  14108. const m_VIS_SHELL1 = 8192
  14109. const m_VIS_SP1 = 4
  14110. const m_VIS_TAB1 = 8
  14111. const m__VIS_END1 = 0x0800
  14112. type Twctrans_t = uintptr
  14113. /* Keep it simple for now, no locale stuff */
  14114. var _char_shell = [19]Twchar_t{'\'', '`', '"', ';', '&', '<', '>', '(', ')', '|', '{', '}', ']', '\\', '$', '!', '^', '~'}
  14115. var _char_glob = [5]Twchar_t{'*', '?', '[', '#'}
  14116. /*
  14117. * On NetBSD and glibc MB_LEN_MAX is currently > 8 which does not fit on any
  14118. * integer integral type and it is probably wrong, since currently the maximum
  14119. * number of bytes and character needs is 6. Until this is fixed, the
  14120. * loops below are using sizeof(uint64_t) - 1 instead of MB_LEN_MAX, and
  14121. * the assertion is commented out.
  14122. */
  14123. // C documentation
  14124. //
  14125. // /*
  14126. // * This is do_hvis, for HTTP style (RFC 1808)
  14127. // */
  14128. func _do_hvis(tls *libc.TLS, dst uintptr, c Twint_t, flags int32, nextc Twint_t, extra uintptr) (r uintptr) {
  14129. var v1, v2, v3 uintptr
  14130. _, _, _ = v1, v2, v3
  14131. 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(',') {
  14132. dst = _do_svis(tls, dst, c, flags, nextc, extra)
  14133. } else {
  14134. v1 = dst
  14135. dst += 4
  14136. *(*Twchar_t)(unsafe.Pointer(v1)) = uint32('%')
  14137. v2 = dst
  14138. dst += 4
  14139. *(*Twchar_t)(unsafe.Pointer(v2)) = *(*t__predefined_wchar_t)(unsafe.Pointer(__ccgo_ts + 462 + uintptr(c>>int32(4)&uint32(0xf))*4))
  14140. v3 = dst
  14141. dst += 4
  14142. *(*Twchar_t)(unsafe.Pointer(v3)) = *(*t__predefined_wchar_t)(unsafe.Pointer(__ccgo_ts + 462 + uintptr(c&uint32(0xf))*4))
  14143. }
  14144. return dst
  14145. }
  14146. // C documentation
  14147. //
  14148. // /*
  14149. // * This is do_mvis, for Quoted-Printable MIME (RFC 2045)
  14150. // * NB: No handling of long lines or CRLF.
  14151. // */
  14152. func _do_mvis(tls *libc.TLS, dst uintptr, c Twint_t, flags int32, nextc Twint_t, extra uintptr) (r uintptr) {
  14153. var v1, v2, v3 uintptr
  14154. _, _, _ = v1, v2, v3
  14155. 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+530, c) != libc.UintptrFromInt32(0)) {
  14156. v1 = dst
  14157. dst += 4
  14158. *(*Twchar_t)(unsafe.Pointer(v1)) = uint32('=')
  14159. v2 = dst
  14160. dst += 4
  14161. *(*Twchar_t)(unsafe.Pointer(v2)) = *(*t__predefined_wchar_t)(unsafe.Pointer(__ccgo_ts + 582 + uintptr(c>>int32(4)&uint32(0xf))*4))
  14162. v3 = dst
  14163. dst += 4
  14164. *(*Twchar_t)(unsafe.Pointer(v3)) = *(*t__predefined_wchar_t)(unsafe.Pointer(__ccgo_ts + 582 + uintptr(c&uint32(0xf))*4))
  14165. } else {
  14166. dst = _do_svis(tls, dst, c, flags, nextc, extra)
  14167. }
  14168. return dst
  14169. }
  14170. // C documentation
  14171. //
  14172. // /*
  14173. // * Output single byte of multibyte character.
  14174. // */
  14175. func _do_mbyte(tls *libc.TLS, dst uintptr, c Twint_t, flags int32, nextc Twint_t, iswextra int32) (r uintptr) {
  14176. 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
  14177. var v21 int32
  14178. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  14179. if flags&int32(m_VIS_CSTYLE1) != 0 {
  14180. switch c {
  14181. case uint32('\n'):
  14182. v1 = dst
  14183. dst += 4
  14184. *(*Twchar_t)(unsafe.Pointer(v1)) = uint32('\\')
  14185. v2 = dst
  14186. dst += 4
  14187. *(*Twchar_t)(unsafe.Pointer(v2)) = uint32('n')
  14188. return dst
  14189. case uint32('\r'):
  14190. v3 = dst
  14191. dst += 4
  14192. *(*Twchar_t)(unsafe.Pointer(v3)) = uint32('\\')
  14193. v4 = dst
  14194. dst += 4
  14195. *(*Twchar_t)(unsafe.Pointer(v4)) = uint32('r')
  14196. return dst
  14197. case uint32('\b'):
  14198. v5 = dst
  14199. dst += 4
  14200. *(*Twchar_t)(unsafe.Pointer(v5)) = uint32('\\')
  14201. v6 = dst
  14202. dst += 4
  14203. *(*Twchar_t)(unsafe.Pointer(v6)) = uint32('b')
  14204. return dst
  14205. case uint32('\a'):
  14206. v7 = dst
  14207. dst += 4
  14208. *(*Twchar_t)(unsafe.Pointer(v7)) = uint32('\\')
  14209. v8 = dst
  14210. dst += 4
  14211. *(*Twchar_t)(unsafe.Pointer(v8)) = uint32('a')
  14212. return dst
  14213. case uint32('\v'):
  14214. v9 = dst
  14215. dst += 4
  14216. *(*Twchar_t)(unsafe.Pointer(v9)) = uint32('\\')
  14217. v10 = dst
  14218. dst += 4
  14219. *(*Twchar_t)(unsafe.Pointer(v10)) = uint32('v')
  14220. return dst
  14221. case uint32('\t'):
  14222. v11 = dst
  14223. dst += 4
  14224. *(*Twchar_t)(unsafe.Pointer(v11)) = uint32('\\')
  14225. v12 = dst
  14226. dst += 4
  14227. *(*Twchar_t)(unsafe.Pointer(v12)) = uint32('t')
  14228. return dst
  14229. case uint32('\f'):
  14230. v13 = dst
  14231. dst += 4
  14232. *(*Twchar_t)(unsafe.Pointer(v13)) = uint32('\\')
  14233. v14 = dst
  14234. dst += 4
  14235. *(*Twchar_t)(unsafe.Pointer(v14)) = uint32('f')
  14236. return dst
  14237. case uint32(' '):
  14238. v15 = dst
  14239. dst += 4
  14240. *(*Twchar_t)(unsafe.Pointer(v15)) = uint32('\\')
  14241. v16 = dst
  14242. dst += 4
  14243. *(*Twchar_t)(unsafe.Pointer(v16)) = uint32('s')
  14244. return dst
  14245. case uint32('\000'):
  14246. v17 = dst
  14247. dst += 4
  14248. *(*Twchar_t)(unsafe.Pointer(v17)) = uint32('\\')
  14249. v18 = dst
  14250. dst += 4
  14251. *(*Twchar_t)(unsafe.Pointer(v18)) = uint32('0')
  14252. if uint32(uint8(nextc)) >= uint32('0') && uint32(uint8(nextc)) <= uint32('7') {
  14253. v19 = dst
  14254. dst += 4
  14255. *(*Twchar_t)(unsafe.Pointer(v19)) = uint32('0')
  14256. v20 = dst
  14257. dst += 4
  14258. *(*Twchar_t)(unsafe.Pointer(v20)) = uint32('0')
  14259. }
  14260. return dst
  14261. /* We cannot encode these characters in VIS_CSTYLE
  14262. * because they special meaning */
  14263. fallthrough
  14264. case uint32('n'):
  14265. fallthrough
  14266. case uint32('r'):
  14267. fallthrough
  14268. case uint32('b'):
  14269. fallthrough
  14270. case uint32('a'):
  14271. fallthrough
  14272. case uint32('v'):
  14273. fallthrough
  14274. case uint32('t'):
  14275. fallthrough
  14276. case uint32('f'):
  14277. fallthrough
  14278. case uint32('s'):
  14279. fallthrough
  14280. case uint32('0'):
  14281. fallthrough
  14282. case uint32('M'):
  14283. fallthrough
  14284. case uint32('^'):
  14285. fallthrough
  14286. case uint32('$'): /* vis(1) -l */
  14287. default:
  14288. if flags&int32(m_VIS_NOLOCALE1) != 0 {
  14289. v21 = libc.BoolInt32(c-uint32(0x21) < uint32(0x5e))
  14290. } else {
  14291. v21 = libc.Xiswgraph(tls, c)
  14292. }
  14293. if v21 != 0 && !(uint32(uint8(c)) >= uint32('0') && uint32(uint8(c)) <= uint32('7')) {
  14294. v22 = dst
  14295. dst += 4
  14296. *(*Twchar_t)(unsafe.Pointer(v22)) = uint32('\\')
  14297. v23 = dst
  14298. dst += 4
  14299. *(*Twchar_t)(unsafe.Pointer(v23)) = c
  14300. return dst
  14301. }
  14302. }
  14303. }
  14304. if iswextra != 0 || c&uint32(0177) == uint32(' ') || flags&int32(m_VIS_OCTAL1) != 0 {
  14305. v24 = dst
  14306. dst += 4
  14307. *(*Twchar_t)(unsafe.Pointer(v24)) = uint32('\\')
  14308. v25 = dst
  14309. dst += 4
  14310. *(*Twchar_t)(unsafe.Pointer(v25)) = uint32(uint8(uint32(uint8(c))>>libc.Int32FromInt32(6)&libc.Uint32FromInt32(03))) + uint32('0')
  14311. v26 = dst
  14312. dst += 4
  14313. *(*Twchar_t)(unsafe.Pointer(v26)) = uint32(uint8(uint32(uint8(c))>>libc.Int32FromInt32(3)&libc.Uint32FromInt32(07))) + uint32('0')
  14314. v27 = dst
  14315. dst += 4
  14316. *(*Twchar_t)(unsafe.Pointer(v27)) = c&uint32(07) + uint32('0')
  14317. } else {
  14318. if flags&int32(m_VIS_NOSLASH1) == 0 {
  14319. v28 = dst
  14320. dst += 4
  14321. *(*Twchar_t)(unsafe.Pointer(v28)) = uint32('\\')
  14322. }
  14323. if c&uint32(0200) != 0 {
  14324. c &= uint32(0177)
  14325. v29 = dst
  14326. dst += 4
  14327. *(*Twchar_t)(unsafe.Pointer(v29)) = uint32('M')
  14328. }
  14329. if libc.Xiswcntrl(tls, c) != 0 {
  14330. v30 = dst
  14331. dst += 4
  14332. *(*Twchar_t)(unsafe.Pointer(v30)) = uint32('^')
  14333. if c == uint32(0177) {
  14334. v31 = dst
  14335. dst += 4
  14336. *(*Twchar_t)(unsafe.Pointer(v31)) = uint32('?')
  14337. } else {
  14338. v32 = dst
  14339. dst += 4
  14340. *(*Twchar_t)(unsafe.Pointer(v32)) = c + uint32('@')
  14341. }
  14342. } else {
  14343. v33 = dst
  14344. dst += 4
  14345. *(*Twchar_t)(unsafe.Pointer(v33)) = uint32('-')
  14346. v34 = dst
  14347. dst += 4
  14348. *(*Twchar_t)(unsafe.Pointer(v34)) = c
  14349. }
  14350. }
  14351. return dst
  14352. }
  14353. // C documentation
  14354. //
  14355. // /*
  14356. // * This is do_vis, the central code of vis.
  14357. // * dst: Pointer to the destination buffer
  14358. // * c: Character to encode
  14359. // * flags: Flags word
  14360. // * nextc: The character following 'c'
  14361. // * extra: Pointer to the list of extra characters to be
  14362. // * backslash-protected.
  14363. // */
  14364. func _do_svis(tls *libc.TLS, dst uintptr, c Twint_t, flags int32, nextc Twint_t, extra uintptr) (r uintptr) {
  14365. var bmsk, wmsk Tuint64_t
  14366. var i, iswextra, shft, v1 int32
  14367. var v2 bool
  14368. var v3 uintptr
  14369. _, _, _, _, _, _, _, _ = bmsk, i, iswextra, shft, wmsk, v1, v2, v3
  14370. iswextra = libc.BoolInt32(libc.Xwcschr(tls, extra, c) != libc.UintptrFromInt32(0))
  14371. if v2 = !(iswextra != 0); v2 {
  14372. if flags&int32(m_VIS_NOLOCALE1) != 0 {
  14373. v1 = libc.BoolInt32(c-uint32(0x21) < uint32(0x5e))
  14374. } else {
  14375. v1 = libc.Xiswgraph(tls, c)
  14376. }
  14377. }
  14378. 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'))) {
  14379. v3 = dst
  14380. dst += 4
  14381. *(*Twchar_t)(unsafe.Pointer(v3)) = c
  14382. return dst
  14383. }
  14384. /* See comment in istrsenvisx() output loop, below. */
  14385. wmsk = uint64(0)
  14386. i = libc.Int32FromUint64(libc.Uint64FromInt64(8) - libc.Uint64FromInt32(1))
  14387. for {
  14388. if !(i >= 0) {
  14389. break
  14390. }
  14391. shft = i * int32(m_CHAR_BIT)
  14392. bmsk = libc.Uint64FromInt64(0xff) << shft
  14393. wmsk |= bmsk
  14394. if uint64(c)&wmsk != 0 || i == 0 {
  14395. dst = _do_mbyte(tls, dst, uint32(uint64(c)&bmsk>>shft), flags, nextc, iswextra)
  14396. }
  14397. goto _4
  14398. _4:
  14399. ;
  14400. i--
  14401. }
  14402. return dst
  14403. }
  14404. type Tvisfun_t = uintptr
  14405. // C documentation
  14406. //
  14407. // /*
  14408. // * Return the appropriate encoding function depending on the flags given.
  14409. // */
  14410. func _getvisfun(tls *libc.TLS, flags int32) (r Tvisfun_t) {
  14411. if flags&int32(m_VIS_HTTPSTYLE1) != 0 {
  14412. return __ccgo_fp(_do_hvis)
  14413. }
  14414. if flags&int32(m_VIS_MIMESTYLE) != 0 {
  14415. return __ccgo_fp(_do_mvis)
  14416. }
  14417. return __ccgo_fp(_do_svis)
  14418. }
  14419. // C documentation
  14420. //
  14421. // /*
  14422. // * Expand list of extra characters to not visually encode.
  14423. // */
  14424. func _makeextralist(tls *libc.TLS, flags int32, src uintptr) (r uintptr) {
  14425. var d, dst, s, v1, v10, v11, v12, v13, v4, v5, v7, v8, v9 uintptr
  14426. var i, len1 Tsize_t
  14427. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = d, dst, i, len1, s, v1, v10, v11, v12, v13, v4, v5, v7, v8, v9
  14428. len1 = libc.Xstrlen(tls, src)
  14429. v1 = libc.Xcalloc(tls, len1+uint64(m_MAXEXTRAS), uint64(4))
  14430. dst = v1
  14431. if v1 == libc.UintptrFromInt32(0) {
  14432. return libc.UintptrFromInt32(0)
  14433. }
  14434. if flags&int32(m_VIS_NOLOCALE1) != 0 || libc.Xmbstowcs(tls, dst, src, len1) == libc.Uint64FromInt32(-libc.Int32FromInt32(1)) {
  14435. i = uint64(0)
  14436. for {
  14437. if !(i < len1) {
  14438. break
  14439. }
  14440. *(*Twchar_t)(unsafe.Pointer(dst + uintptr(i)*4)) = uint32(*(*uint8)(unsafe.Pointer(src + uintptr(i))))
  14441. goto _2
  14442. _2:
  14443. ;
  14444. i++
  14445. }
  14446. d = dst + uintptr(len1)*4
  14447. } else {
  14448. d = dst + uintptr(libc.Xwcslen(tls, dst))*4
  14449. }
  14450. if flags&int32(m_VIS_GLOB1) != 0 {
  14451. s = uintptr(unsafe.Pointer(&_char_glob))
  14452. for {
  14453. if !(*(*Twchar_t)(unsafe.Pointer(s)) != 0) {
  14454. break
  14455. }
  14456. goto _3
  14457. goto _3
  14458. _3:
  14459. ;
  14460. v4 = d
  14461. d += 4
  14462. v5 = s
  14463. s += 4
  14464. *(*Twchar_t)(unsafe.Pointer(v4)) = *(*Twchar_t)(unsafe.Pointer(v5))
  14465. }
  14466. }
  14467. if flags&int32(m_VIS_SHELL1) != 0 {
  14468. s = uintptr(unsafe.Pointer(&_char_shell))
  14469. for {
  14470. if !(*(*Twchar_t)(unsafe.Pointer(s)) != 0) {
  14471. break
  14472. }
  14473. goto _6
  14474. goto _6
  14475. _6:
  14476. ;
  14477. v7 = d
  14478. d += 4
  14479. v8 = s
  14480. s += 4
  14481. *(*Twchar_t)(unsafe.Pointer(v7)) = *(*Twchar_t)(unsafe.Pointer(v8))
  14482. }
  14483. }
  14484. if flags&int32(m_VIS_SP1) != 0 {
  14485. v9 = d
  14486. d += 4
  14487. *(*Twchar_t)(unsafe.Pointer(v9)) = uint32(' ')
  14488. }
  14489. if flags&int32(m_VIS_TAB1) != 0 {
  14490. v10 = d
  14491. d += 4
  14492. *(*Twchar_t)(unsafe.Pointer(v10)) = uint32('\t')
  14493. }
  14494. if flags&int32(m_VIS_NL1) != 0 {
  14495. v11 = d
  14496. d += 4
  14497. *(*Twchar_t)(unsafe.Pointer(v11)) = uint32('\n')
  14498. }
  14499. if flags&int32(m_VIS_DQ1) != 0 {
  14500. v12 = d
  14501. d += 4
  14502. *(*Twchar_t)(unsafe.Pointer(v12)) = uint32('"')
  14503. }
  14504. if flags&int32(m_VIS_NOSLASH1) == 0 {
  14505. v13 = d
  14506. d += 4
  14507. *(*Twchar_t)(unsafe.Pointer(v13)) = uint32('\\')
  14508. }
  14509. *(*Twchar_t)(unsafe.Pointer(d)) = uint32('\000')
  14510. return dst
  14511. }
  14512. // C documentation
  14513. //
  14514. // /*
  14515. // * istrsenvisx()
  14516. // * The main internal function.
  14517. // * All user-visible functions call this one.
  14518. // */
  14519. func _istrsenvisx(tls *libc.TLS, mbdstp uintptr, dlen uintptr, mbsrc uintptr, mblength Tsize_t, flags int32, mbextra uintptr, cerr_ptr uintptr) (r int32) {
  14520. var bmsk, wmsk Tuint64_t
  14521. var c Twint_t
  14522. var cerr, clen, error1, i, shft, v12, v6 int32
  14523. var dst, extra, mbdst, mdst, pdst, psrc, src, start, v1, v2, v3, v4, v5, v8 uintptr
  14524. var f Tvisfun_t
  14525. var len1, olen Tsize_t
  14526. var maxolen, mbslength Tssize_t
  14527. var v9 uint64
  14528. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  14529. clen = 0
  14530. error1 = -int32(1)
  14531. mbslength = libc.Int64FromUint64(mblength)
  14532. /*
  14533. * When inputing a single character, must also read in the
  14534. * next character for nextc, the look-ahead character.
  14535. */
  14536. if mbslength == int64(1) {
  14537. mbslength++
  14538. }
  14539. /*
  14540. * Input (mbsrc) is a char string considered to be multibyte
  14541. * characters. The input loop will read this string pulling
  14542. * one character, possibly multiple bytes, from mbsrc and
  14543. * converting each to wchar_t in src.
  14544. *
  14545. * The vis conversion will be done using the wide char
  14546. * wchar_t string.
  14547. *
  14548. * This will then be converted back to a multibyte string to
  14549. * return to the caller.
  14550. */
  14551. /* Allocate space for the wide char strings */
  14552. v2 = libc.UintptrFromInt32(0)
  14553. extra = v2
  14554. v1 = v2
  14555. pdst = v1
  14556. psrc = v1
  14557. mdst = libc.UintptrFromInt32(0)
  14558. v3 = libc.Xcalloc(tls, libc.Uint64FromInt64(mbslength+int64(1)), uint64(4))
  14559. psrc = v3
  14560. if v3 == libc.UintptrFromInt32(0) {
  14561. return -int32(1)
  14562. }
  14563. v4 = libc.Xcalloc(tls, libc.Uint64FromInt64(int64(16)*mbslength+int64(1)), uint64(4))
  14564. pdst = v4
  14565. if v4 == libc.UintptrFromInt32(0) {
  14566. goto out
  14567. }
  14568. if *(*uintptr)(unsafe.Pointer(mbdstp)) == libc.UintptrFromInt32(0) {
  14569. v5 = libc.Xcalloc(tls, libc.Uint64FromInt64(int64(16)*mbslength+int64(1)), uint64(1))
  14570. mdst = v5
  14571. if v5 == libc.UintptrFromInt32(0) {
  14572. goto out
  14573. }
  14574. *(*uintptr)(unsafe.Pointer(mbdstp)) = mdst
  14575. }
  14576. mbdst = *(*uintptr)(unsafe.Pointer(mbdstp))
  14577. dst = pdst
  14578. src = psrc
  14579. if flags&int32(m_VIS_NOLOCALE1) != 0 {
  14580. /* Do one byte at a time conversion */
  14581. cerr = int32(1)
  14582. } else {
  14583. /* Use caller's multibyte conversion error flag. */
  14584. if cerr_ptr != 0 {
  14585. v6 = *(*int32)(unsafe.Pointer(cerr_ptr))
  14586. } else {
  14587. v6 = 0
  14588. }
  14589. cerr = v6
  14590. }
  14591. /*
  14592. * Input loop.
  14593. * Handle up to mblength characters (not bytes). We do not
  14594. * stop at NULs because we may be processing a block of data
  14595. * that includes NULs.
  14596. */
  14597. for mbslength > 0 {
  14598. /* Convert one multibyte character to wchar_t. */
  14599. if !(cerr != 0) {
  14600. clen = libc.Xmbtowc(tls, src, mbsrc, uint64(m_MB_LEN_MAX))
  14601. }
  14602. if cerr != 0 || clen < 0 {
  14603. /* Conversion error, process as a byte instead. */
  14604. *(*Twchar_t)(unsafe.Pointer(src)) = uint32(*(*uint8)(unsafe.Pointer(mbsrc)))
  14605. clen = int32(1)
  14606. cerr = int32(1)
  14607. }
  14608. if clen == 0 {
  14609. /*
  14610. * NUL in input gives 0 return value. process
  14611. * as single NUL byte and keep going.
  14612. */
  14613. clen = int32(1)
  14614. }
  14615. /* Advance buffer character pointer. */
  14616. src += 4
  14617. /* Advance input pointer by number of bytes read. */
  14618. mbsrc += uintptr(clen)
  14619. /* Decrement input byte count. */
  14620. mbslength -= int64(clen)
  14621. }
  14622. len1 = libc.Uint64FromInt64((int64(src) - int64(psrc)) / 4)
  14623. src = psrc
  14624. /*
  14625. * In the single character input case, we will have actually
  14626. * processed two characters, c and nextc. Reset len back to
  14627. * just a single character.
  14628. */
  14629. if mblength < len1 {
  14630. len1 = mblength
  14631. }
  14632. /* Convert extra argument to list of characters for this mode. */
  14633. extra = _makeextralist(tls, flags, mbextra)
  14634. if !(extra != 0) {
  14635. if dlen != 0 && *(*Tsize_t)(unsafe.Pointer(dlen)) == uint64(0) {
  14636. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14637. goto out
  14638. }
  14639. *(*uint8)(unsafe.Pointer(mbdst)) = uint8('\000') /* can't create extra, return "" */
  14640. error1 = 0
  14641. goto out
  14642. }
  14643. /* Look up which processing function to call. */
  14644. f = _getvisfun(tls, flags)
  14645. /*
  14646. * Main processing loop.
  14647. * Call do_Xvis processing function one character at a time
  14648. * with next character available for look-ahead.
  14649. */
  14650. start = dst
  14651. for {
  14652. if !(len1 > uint64(0)) {
  14653. break
  14654. }
  14655. v8 = src
  14656. src += 4
  14657. c = *(*Twchar_t)(unsafe.Pointer(v8))
  14658. 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)
  14659. if dst == libc.UintptrFromInt32(0) {
  14660. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14661. goto out
  14662. }
  14663. goto _7
  14664. _7:
  14665. ;
  14666. len1--
  14667. }
  14668. /* Terminate the string in the buffer. */
  14669. *(*Twchar_t)(unsafe.Pointer(dst)) = uint32('\000')
  14670. /*
  14671. * Output loop.
  14672. * Convert wchar_t string back to multibyte output string.
  14673. * If we have hit a multi-byte conversion error on input,
  14674. * output byte-by-byte here. Else use wctomb().
  14675. */
  14676. len1 = libc.Xwcslen(tls, start)
  14677. if dlen != 0 {
  14678. v9 = *(*Tsize_t)(unsafe.Pointer(dlen))
  14679. } else {
  14680. v9 = libc.Xwcslen(tls, start)*uint64(m_MB_LEN_MAX) + uint64(1)
  14681. }
  14682. maxolen = libc.Int64FromUint64(v9)
  14683. olen = uint64(0)
  14684. dst = start
  14685. for {
  14686. if !(len1 > uint64(0)) {
  14687. break
  14688. }
  14689. if !(cerr != 0) {
  14690. clen = libc.Xwctomb(tls, mbdst, *(*Twchar_t)(unsafe.Pointer(dst)))
  14691. }
  14692. if cerr != 0 || clen < 0 {
  14693. /*
  14694. * Conversion error, process as a byte(s) instead.
  14695. * Examine each byte and higher-order bytes for
  14696. * data. E.g.,
  14697. * 0x000000000000a264 -> a2 64
  14698. * 0x000000001f00a264 -> 1f 00 a2 64
  14699. */
  14700. clen = 0
  14701. wmsk = uint64(0)
  14702. i = libc.Int32FromUint64(libc.Uint64FromInt64(8) - libc.Uint64FromInt32(1))
  14703. for {
  14704. if !(i >= 0) {
  14705. break
  14706. }
  14707. shft = i * int32(m_CHAR_BIT)
  14708. bmsk = libc.Uint64FromInt64(0xff) << shft
  14709. wmsk |= bmsk
  14710. if uint64(*(*Twchar_t)(unsafe.Pointer(dst)))&wmsk != 0 || i == 0 {
  14711. v12 = clen
  14712. clen++
  14713. *(*uint8)(unsafe.Pointer(mbdst + uintptr(v12))) = uint8(uint64(*(*Twchar_t)(unsafe.Pointer(dst))) & bmsk >> shft)
  14714. }
  14715. goto _11
  14716. _11:
  14717. ;
  14718. i--
  14719. }
  14720. cerr = int32(1)
  14721. }
  14722. /* If this character would exceed our output limit, stop. */
  14723. if olen+libc.Uint64FromInt32(clen) > libc.Uint64FromInt64(maxolen) {
  14724. break
  14725. }
  14726. /* Advance output pointer by number of bytes written. */
  14727. mbdst += uintptr(clen)
  14728. /* Advance buffer character pointer. */
  14729. dst += 4
  14730. /* Incrment output character count. */
  14731. olen += libc.Uint64FromInt32(clen)
  14732. goto _10
  14733. _10:
  14734. ;
  14735. len1--
  14736. }
  14737. /* Terminate the output string. */
  14738. *(*uint8)(unsafe.Pointer(mbdst)) = uint8('\000')
  14739. if flags&int32(m_VIS_NOLOCALE1) != 0 {
  14740. /* Pass conversion error flag out. */
  14741. if cerr_ptr != 0 {
  14742. *(*int32)(unsafe.Pointer(cerr_ptr)) = cerr
  14743. }
  14744. }
  14745. libc.Xfree(tls, extra)
  14746. libc.Xfree(tls, pdst)
  14747. libc.Xfree(tls, psrc)
  14748. return libc.Int32FromUint64(olen)
  14749. goto out
  14750. out:
  14751. ;
  14752. libc.Xfree(tls, extra)
  14753. libc.Xfree(tls, pdst)
  14754. libc.Xfree(tls, psrc)
  14755. libc.Xfree(tls, mdst)
  14756. return error1
  14757. }
  14758. func _istrsenvisxna(tls *libc.TLS, _mbdst uintptr, dlen uintptr, mbsrc uintptr, mblength Tsize_t, flags int32, mbextra uintptr, cerr_ptr uintptr) (r int32) {
  14759. bp := tls.Alloc(16)
  14760. defer tls.Free(16)
  14761. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  14762. return _istrsenvisx(tls, bp, dlen, mbsrc, mblength, flags, mbextra, cerr_ptr)
  14763. }
  14764. func _istrsenvisxl(tls *libc.TLS, mbdst uintptr, dlen uintptr, mbsrc uintptr, flags int32, mbextra uintptr, cerr_ptr uintptr) (r int32) {
  14765. var v1 uint64
  14766. _ = v1
  14767. if mbsrc != libc.UintptrFromInt32(0) {
  14768. v1 = libc.Xstrlen(tls, mbsrc)
  14769. } else {
  14770. v1 = uint64(0)
  14771. }
  14772. return _istrsenvisxna(tls, mbdst, dlen, mbsrc, v1, flags, mbextra, cerr_ptr)
  14773. }
  14774. /*
  14775. * The "svis" variants all take an "extra" arg that is a pointer
  14776. * to a NUL-terminated list of characters to be encoded, too.
  14777. * These functions are useful e. g. to encode strings in such a
  14778. * way so that they are not interpreted by a shell.
  14779. */
  14780. func Xsvis(tls *libc.TLS, _mbdst uintptr, c int32, flags int32, nextc int32, mbextra uintptr) (r uintptr) {
  14781. bp := tls.Alloc(16)
  14782. defer tls.Free(16)
  14783. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  14784. var ret int32
  14785. var _ /* cc at bp+8 */ [2]uint8
  14786. _ = ret
  14787. (*(*[2]uint8)(unsafe.Pointer(bp + 8)))[0] = libc.Uint8FromInt32(c)
  14788. (*(*[2]uint8)(unsafe.Pointer(bp + 8)))[int32(1)] = libc.Uint8FromInt32(nextc)
  14789. ret = _istrsenvisx(tls, bp, libc.UintptrFromInt32(0), bp+8, uint64(1), flags, mbextra, libc.UintptrFromInt32(0))
  14790. if ret < 0 {
  14791. return libc.UintptrFromInt32(0)
  14792. }
  14793. return *(*uintptr)(unsafe.Pointer(bp)) + uintptr(ret)
  14794. }
  14795. func Xsnvis(tls *libc.TLS, _mbdst uintptr, _dlen Tsize_t, c int32, flags int32, nextc int32, mbextra uintptr) (r uintptr) {
  14796. bp := tls.Alloc(32)
  14797. defer tls.Free(32)
  14798. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  14799. *(*Tsize_t)(unsafe.Pointer(bp + 8)) = _dlen
  14800. var ret int32
  14801. var _ /* cc at bp+16 */ [2]uint8
  14802. _ = ret
  14803. (*(*[2]uint8)(unsafe.Pointer(bp + 16)))[0] = libc.Uint8FromInt32(c)
  14804. (*(*[2]uint8)(unsafe.Pointer(bp + 16)))[int32(1)] = libc.Uint8FromInt32(nextc)
  14805. ret = _istrsenvisx(tls, bp, bp+8, bp+16, uint64(1), flags, mbextra, libc.UintptrFromInt32(0))
  14806. if ret < 0 {
  14807. return libc.UintptrFromInt32(0)
  14808. }
  14809. return *(*uintptr)(unsafe.Pointer(bp)) + uintptr(ret)
  14810. }
  14811. func Xstrsvis(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, flags int32, mbextra uintptr) (r int32) {
  14812. return _istrsenvisxl(tls, mbdst, libc.UintptrFromInt32(0), mbsrc, flags, mbextra, libc.UintptrFromInt32(0))
  14813. }
  14814. func Xstrsnvis(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, flags int32, mbextra uintptr) (r int32) {
  14815. bp := tls.Alloc(16)
  14816. defer tls.Free(16)
  14817. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  14818. return _istrsenvisxl(tls, mbdst, bp, mbsrc, flags, mbextra, libc.UintptrFromInt32(0))
  14819. }
  14820. func Xstrsvisx(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, len1 Tsize_t, flags int32, mbextra uintptr) (r int32) {
  14821. return _istrsenvisxna(tls, mbdst, libc.UintptrFromInt32(0), mbsrc, len1, flags, mbextra, libc.UintptrFromInt32(0))
  14822. }
  14823. func Xstrsnvisx(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, len1 Tsize_t, flags int32, mbextra uintptr) (r int32) {
  14824. bp := tls.Alloc(16)
  14825. defer tls.Free(16)
  14826. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  14827. return _istrsenvisxna(tls, mbdst, bp, mbsrc, len1, flags, mbextra, libc.UintptrFromInt32(0))
  14828. }
  14829. func Xstrsenvisx(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, len1 Tsize_t, flags int32, mbextra uintptr, cerr_ptr uintptr) (r int32) {
  14830. bp := tls.Alloc(16)
  14831. defer tls.Free(16)
  14832. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  14833. return _istrsenvisxna(tls, mbdst, bp, mbsrc, len1, flags, mbextra, cerr_ptr)
  14834. }
  14835. // C documentation
  14836. //
  14837. // /*
  14838. // * vis - visually encode characters
  14839. // */
  14840. func Xvis(tls *libc.TLS, _mbdst uintptr, c int32, flags int32, nextc int32) (r uintptr) {
  14841. bp := tls.Alloc(16)
  14842. defer tls.Free(16)
  14843. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  14844. var ret int32
  14845. var _ /* cc at bp+8 */ [2]uint8
  14846. _ = ret
  14847. (*(*[2]uint8)(unsafe.Pointer(bp + 8)))[0] = libc.Uint8FromInt32(c)
  14848. (*(*[2]uint8)(unsafe.Pointer(bp + 8)))[int32(1)] = libc.Uint8FromInt32(nextc)
  14849. ret = _istrsenvisx(tls, bp, libc.UintptrFromInt32(0), bp+8, uint64(1), flags, __ccgo_ts+53, libc.UintptrFromInt32(0))
  14850. if ret < 0 {
  14851. return libc.UintptrFromInt32(0)
  14852. }
  14853. return *(*uintptr)(unsafe.Pointer(bp)) + uintptr(ret)
  14854. }
  14855. func Xnvis(tls *libc.TLS, _mbdst uintptr, _dlen Tsize_t, c int32, flags int32, nextc int32) (r uintptr) {
  14856. bp := tls.Alloc(32)
  14857. defer tls.Free(32)
  14858. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  14859. *(*Tsize_t)(unsafe.Pointer(bp + 8)) = _dlen
  14860. var ret int32
  14861. var _ /* cc at bp+16 */ [2]uint8
  14862. _ = ret
  14863. (*(*[2]uint8)(unsafe.Pointer(bp + 16)))[0] = libc.Uint8FromInt32(c)
  14864. (*(*[2]uint8)(unsafe.Pointer(bp + 16)))[int32(1)] = libc.Uint8FromInt32(nextc)
  14865. ret = _istrsenvisx(tls, bp, bp+8, bp+16, uint64(1), flags, __ccgo_ts+53, libc.UintptrFromInt32(0))
  14866. if ret < 0 {
  14867. return libc.UintptrFromInt32(0)
  14868. }
  14869. return *(*uintptr)(unsafe.Pointer(bp)) + uintptr(ret)
  14870. }
  14871. /*
  14872. * strvis - visually encode characters from src into dst
  14873. *
  14874. * Dst must be 4 times the size of src to account for possible
  14875. * expansion. The length of dst, not including the trailing NULL,
  14876. * is returned.
  14877. */
  14878. func Xstrvis(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, flags int32) (r int32) {
  14879. return _istrsenvisxl(tls, mbdst, libc.UintptrFromInt32(0), mbsrc, flags, __ccgo_ts+53, libc.UintptrFromInt32(0))
  14880. }
  14881. func Xstrnvis_openbsd(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, _dlen Tsize_t, flags int32) (r int32) {
  14882. bp := tls.Alloc(16)
  14883. defer tls.Free(16)
  14884. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  14885. return _istrsenvisxl(tls, mbdst, bp, mbsrc, flags, __ccgo_ts+53, libc.UintptrFromInt32(0))
  14886. }
  14887. func Xstrnvis_netbsd(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, flags int32) (r int32) {
  14888. bp := tls.Alloc(16)
  14889. defer tls.Free(16)
  14890. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  14891. return _istrsenvisxl(tls, mbdst, bp, mbsrc, flags, __ccgo_ts+53, libc.UintptrFromInt32(0))
  14892. }
  14893. func Xstravis(tls *libc.TLS, mbdstp uintptr, mbsrc uintptr, flags int32) (r int32) {
  14894. var v1 uint64
  14895. _ = v1
  14896. *(*uintptr)(unsafe.Pointer(mbdstp)) = libc.UintptrFromInt32(0)
  14897. if mbsrc != libc.UintptrFromInt32(0) {
  14898. v1 = libc.Xstrlen(tls, mbsrc)
  14899. } else {
  14900. v1 = uint64(0)
  14901. }
  14902. return _istrsenvisx(tls, mbdstp, libc.UintptrFromInt32(0), mbsrc, v1, flags, __ccgo_ts+53, libc.UintptrFromInt32(0))
  14903. }
  14904. /*
  14905. * strvisx - visually encode characters from src into dst
  14906. *
  14907. * Dst must be 4 times the size of src to account for possible
  14908. * expansion. The length of dst, not including the trailing NULL,
  14909. * is returned.
  14910. *
  14911. * Strvisx encodes exactly len characters from src into dst.
  14912. * This is useful for encoding a block of data.
  14913. */
  14914. func Xstrvisx(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, len1 Tsize_t, flags int32) (r int32) {
  14915. return _istrsenvisxna(tls, mbdst, libc.UintptrFromInt32(0), mbsrc, len1, flags, __ccgo_ts+53, libc.UintptrFromInt32(0))
  14916. }
  14917. func Xstrnvisx(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, len1 Tsize_t, flags int32) (r int32) {
  14918. bp := tls.Alloc(16)
  14919. defer tls.Free(16)
  14920. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  14921. return _istrsenvisxna(tls, mbdst, bp, mbsrc, len1, flags, __ccgo_ts+53, libc.UintptrFromInt32(0))
  14922. }
  14923. func Xstrenvisx(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, len1 Tsize_t, flags int32, cerr_ptr uintptr) (r int32) {
  14924. bp := tls.Alloc(16)
  14925. defer tls.Free(16)
  14926. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  14927. return _istrsenvisxna(tls, mbdst, bp, mbsrc, len1, flags, __ccgo_ts+53, cerr_ptr)
  14928. }
  14929. // C documentation
  14930. //
  14931. // /*
  14932. // * Appends src to string dst of size siz (unlike wcsncat, siz is the
  14933. // * full size of dst, not space left). At most siz-1 characters
  14934. // * will be copied. Always NUL terminates (unless siz == 0).
  14935. // * Returns wcslen(initial dst) + wcslen(src); if retval >= siz,
  14936. // * truncation occurred.
  14937. // */
  14938. func Xwcslcat(tls *libc.TLS, dst uintptr, src uintptr, siz Tsize_t) (r Tsize_t) {
  14939. var d, s, v3 uintptr
  14940. var dlen, n, v1 Tsize_t
  14941. var v2 bool
  14942. _, _, _, _, _, _, _ = d, dlen, n, s, v1, v2, v3
  14943. d = dst
  14944. s = src
  14945. n = siz
  14946. /* Find the end of dst and adjust bytes left but don't go past end */
  14947. for {
  14948. if v2 = *(*Twchar_t)(unsafe.Pointer(d)) != uint32('\000'); v2 {
  14949. v1 = n
  14950. n--
  14951. }
  14952. if !(v2 && v1 != uint64(0)) {
  14953. break
  14954. }
  14955. d += 4
  14956. }
  14957. dlen = libc.Uint64FromInt64((int64(d) - int64(dst)) / 4)
  14958. n = siz - dlen
  14959. if n == uint64(0) {
  14960. return dlen + libc.Xwcslen(tls, s)
  14961. }
  14962. for *(*Twchar_t)(unsafe.Pointer(s)) != uint32('\000') {
  14963. if n != uint64(1) {
  14964. v3 = d
  14965. d += 4
  14966. *(*Twchar_t)(unsafe.Pointer(v3)) = *(*Twchar_t)(unsafe.Pointer(s))
  14967. n--
  14968. }
  14969. s += 4
  14970. }
  14971. *(*Twchar_t)(unsafe.Pointer(d)) = uint32('\000')
  14972. return dlen + libc.Uint64FromInt64((int64(s)-int64(src))/4) /* count does not include NUL */
  14973. }
  14974. // C documentation
  14975. //
  14976. // /*
  14977. // * Copy src to string dst of size siz. At most siz-1 characters
  14978. // * will be copied. Always NUL terminates (unless siz == 0).
  14979. // * Returns wcslen(src); if retval >= siz, truncation occurred.
  14980. // */
  14981. func Xwcslcpy(tls *libc.TLS, dst uintptr, src uintptr, siz Tsize_t) (r Tsize_t) {
  14982. var d, s, v6, v7, v8 uintptr
  14983. var n, v1, v3 Tsize_t
  14984. var v2 bool
  14985. var v5 Twchar_t
  14986. _, _, _, _, _, _, _, _, _, _ = d, n, s, v1, v2, v3, v5, v6, v7, v8
  14987. d = dst
  14988. s = src
  14989. n = siz
  14990. /* Copy as many bytes as will fit */
  14991. if v2 = n != uint64(0); v2 {
  14992. n--
  14993. v1 = n
  14994. }
  14995. if v2 && v1 != uint64(0) {
  14996. for {
  14997. v6 = s
  14998. s += 4
  14999. v5 = *(*Twchar_t)(unsafe.Pointer(v6))
  15000. v7 = d
  15001. d += 4
  15002. *(*Twchar_t)(unsafe.Pointer(v7)) = v5
  15003. if v5 == uint32(0) {
  15004. break
  15005. }
  15006. goto _4
  15007. _4:
  15008. ;
  15009. n--
  15010. v3 = n
  15011. if !(v3 != uint64(0)) {
  15012. break
  15013. }
  15014. }
  15015. }
  15016. /* Not enough room in dst, add NUL and traverse rest of src */
  15017. if n == uint64(0) {
  15018. if siz != uint64(0) {
  15019. *(*Twchar_t)(unsafe.Pointer(d)) = uint32('\000')
  15020. } /* NUL-terminate dst */
  15021. for {
  15022. v8 = s
  15023. s += 4
  15024. if !(*(*Twchar_t)(unsafe.Pointer(v8)) != 0) {
  15025. break
  15026. }
  15027. }
  15028. }
  15029. return libc.Uint64FromInt64((int64(s)-int64(src))/4 - libc.Int64FromInt32(1)) /* count does not include NUL */
  15030. }
  15031. const m_ECHO1 = 0000010
  15032. const m_ECHONL1 = 0000100
  15033. const m_ELFMAG01 = 0x7f
  15034. const m_ELFMAG11 = 'E'
  15035. const m_ELFMAG21 = 'L'
  15036. const m_ELFMAG31 = 'F'
  15037. const m_FIOASYNC = 0x5452
  15038. const m_FIOCLEX = 0x5451
  15039. const m_FIOGETOWN = 0x8903
  15040. const m_FIONBIO = 0x5421
  15041. const m_FIONCLEX = 0x5450
  15042. const m_FIONREAD = 0x541B
  15043. const m_FIOQSIZE = 0x5460
  15044. const m_FIOSETOWN = 0x8901
  15045. const m_GRND_INSECURE = 0x0004
  15046. const m_GRND_NONBLOCK = 1
  15047. const m_GRND_RANDOM = 0x0002
  15048. const m_IOCSIZE_SHIFT = "_IOC_SIZESHIFT"
  15049. const m_MAP_ANON2 = 32
  15050. const m_MAP_PRIVATE2 = 2
  15051. const m_MNT_DETACH = 2
  15052. const m_MNT_EXPIRE = 4
  15053. const m_MNT_FORCE = 1
  15054. const m_MS_BIND = 4096
  15055. const m_MS_DIRSYNC = 128
  15056. const m_MS_MANDLOCK = 64
  15057. const m_MS_MGC_MSK = 0xffff0000
  15058. const m_MS_MGC_VAL = 0xc0ed0000
  15059. const m_MS_MOVE = 8192
  15060. const m_MS_NOATIME = 1024
  15061. const m_MS_NODEV = 4
  15062. const m_MS_NODIRATIME = 2048
  15063. const m_MS_NOEXEC = 8
  15064. const m_MS_NOSUID = 2
  15065. const m_MS_NOSYMFOLLOW = 256
  15066. const m_MS_RDONLY = 1
  15067. const m_MS_REC = 16384
  15068. const m_MS_REMOUNT = 32
  15069. const m_MS_SILENT = 32768
  15070. const m_MS_SYNCHRONOUS = 16
  15071. const m_N_6PACK = 7
  15072. const m_N_AX25 = 5
  15073. const m_N_CAIF = 20
  15074. const m_N_GIGASET_M101 = 16
  15075. const m_N_GSM0710 = 21
  15076. const m_N_HCI = 15
  15077. const m_N_HDLC = 13
  15078. const m_N_IRDA = 11
  15079. const m_N_MASC = 8
  15080. const m_N_MOUSE = 2
  15081. const m_N_NCI = 25
  15082. const m_N_NULL = 27
  15083. const m_N_PPP = 3
  15084. const m_N_PPS = 18
  15085. const m_N_PROFIBUS_FDL = 10
  15086. const m_N_R3964 = 9
  15087. const m_N_SLCAN = 17
  15088. const m_N_SLIP = 1
  15089. const m_N_SMSBLOCK = 12
  15090. const m_N_SPEAKUP = 26
  15091. const m_N_STRIP = 4
  15092. const m_N_SYNC_PPP = 14
  15093. const m_N_TI_WL = 22
  15094. const m_N_TRACEROUTER = 24
  15095. const m_N_TRACESINK = 23
  15096. const m_N_TTY = 0
  15097. const m_N_V253 = 19
  15098. const m_N_X25 = 6
  15099. const m_O_CLOEXEC1 = 524288
  15100. const m_O_NOFOLLOW1 = 32768
  15101. const m_O_RDONLY3 = 0
  15102. const m_O_RDWR2 = 02
  15103. const m_REPEAT = 5
  15104. const m_SHA256_BLOCK_LENGTH = 64
  15105. const m_SHA256_DIGEST_LENGTH = 32
  15106. const m_SHA384_BLOCK_LENGTH = 128
  15107. const m_SHA384_DIGEST_LENGTH = 48
  15108. const m_SHA384_Data = "SHA384Data"
  15109. const m_SHA384_End = "SHA384End"
  15110. const m_SHA384_File = "SHA384File"
  15111. const m_SHA384_FileChunk = "SHA384FileChunk"
  15112. const m_SHA384_Final = "SHA384Final"
  15113. const m_SHA384_Init = "SHA384Init"
  15114. const m_SHA384_Update = "SHA384Update"
  15115. const m_SHA512_BLOCK_LENGTH = 128
  15116. const m_SHA512_DIGEST_LENGTH = 64
  15117. const m_SHA512_Data = "SHA512Data"
  15118. const m_SHA512_End = "SHA512End"
  15119. const m_SHA512_File = "SHA512File"
  15120. const m_SHA512_FileChunk = "SHA512FileChunk"
  15121. const m_SHA512_Final = "SHA512Final"
  15122. const m_SHA512_Init = "SHA512Init"
  15123. const m_SHA512_Update = "SHA512Update"
  15124. const m_SHN_ABS1 = 0xfff1
  15125. const m_SHN_COMMON1 = 0xfff2
  15126. const m_SIOCADDDLCI = 0x8980
  15127. const m_SIOCADDMULTI = 0x8931
  15128. const m_SIOCADDRT = 0x890B
  15129. const m_SIOCATMARK = 0x8905
  15130. const m_SIOCDARP = 0x8953
  15131. const m_SIOCDELDLCI = 0x8981
  15132. const m_SIOCDELMULTI = 0x8932
  15133. const m_SIOCDELRT = 0x890C
  15134. const m_SIOCDEVPRIVATE = 0x89F0
  15135. const m_SIOCDIFADDR = 0x8936
  15136. const m_SIOCDRARP = 0x8960
  15137. const m_SIOCGARP = 0x8954
  15138. const m_SIOCGIFADDR = 0x8915
  15139. const m_SIOCGIFBR = 0x8940
  15140. const m_SIOCGIFBRDADDR = 0x8919
  15141. const m_SIOCGIFCONF = 0x8912
  15142. const m_SIOCGIFCOUNT = 0x8938
  15143. const m_SIOCGIFDSTADDR = 0x8917
  15144. const m_SIOCGIFENCAP = 0x8925
  15145. const m_SIOCGIFFLAGS = 0x8913
  15146. const m_SIOCGIFHWADDR = 0x8927
  15147. const m_SIOCGIFINDEX = 0x8933
  15148. const m_SIOCGIFMAP = 0x8970
  15149. const m_SIOCGIFMEM = 0x891f
  15150. const m_SIOCGIFMETRIC = 0x891d
  15151. const m_SIOCGIFMTU = 0x8921
  15152. const m_SIOCGIFNAME = 0x8910
  15153. const m_SIOCGIFNETMASK = 0x891b
  15154. const m_SIOCGIFPFLAGS = 0x8935
  15155. const m_SIOCGIFSLAVE = 0x8929
  15156. const m_SIOCGIFTXQLEN = 0x8942
  15157. const m_SIOCGPGRP = 0x8904
  15158. const m_SIOCGRARP = 0x8961
  15159. const m_SIOCGSTAMP = 0x8906
  15160. const m_SIOCGSTAMPNS = 0x8907
  15161. const m_SIOCPROTOPRIVATE = 0x89E0
  15162. const m_SIOCRTMSG = 0x890D
  15163. const m_SIOCSARP = 0x8955
  15164. const m_SIOCSIFADDR = 0x8916
  15165. const m_SIOCSIFBR = 0x8941
  15166. const m_SIOCSIFBRDADDR = 0x891a
  15167. const m_SIOCSIFDSTADDR = 0x8918
  15168. const m_SIOCSIFENCAP = 0x8926
  15169. const m_SIOCSIFFLAGS = 0x8914
  15170. const m_SIOCSIFHWADDR = 0x8924
  15171. const m_SIOCSIFHWBROADCAST = 0x8937
  15172. const m_SIOCSIFLINK = 0x8911
  15173. const m_SIOCSIFMAP = 0x8971
  15174. const m_SIOCSIFMEM = 0x8920
  15175. const m_SIOCSIFMETRIC = 0x891e
  15176. const m_SIOCSIFMTU = 0x8922
  15177. const m_SIOCSIFNAME = 0x8923
  15178. const m_SIOCSIFNETMASK = 0x891c
  15179. const m_SIOCSIFPFLAGS = 0x8934
  15180. const m_SIOCSIFSLAVE = 0x8930
  15181. const m_SIOCSIFTXQLEN = 0x8943
  15182. const m_SIOCSPGRP = 0x8902
  15183. const m_SIOCSRARP = 0x8962
  15184. const m_SIOGIFINDEX = "SIOCGIFINDEX"
  15185. const m_ST_APPEND = 256
  15186. const m_ST_IMMUTABLE = 512
  15187. const m_ST_MANDLOCK = 64
  15188. const m_ST_NOATIME = 1024
  15189. const m_ST_NODEV = 4
  15190. const m_ST_NODIRATIME = 2048
  15191. const m_ST_NOEXEC = 8
  15192. const m_ST_NOSUID = 2
  15193. const m_ST_RDONLY = 1
  15194. const m_ST_RELATIME = 4096
  15195. const m_ST_SYNCHRONOUS = 16
  15196. const m_ST_WRITE = 128
  15197. const m_S_IFCHR3 = 8192
  15198. const m_S_IFIFO3 = 4096
  15199. const m_S_IFMT3 = 61440
  15200. const m_S_IFREG3 = 32768
  15201. const m_S_IFSOCK3 = 49152
  15202. const m_TCFLSH = 0x540B
  15203. const m_TCGETA = 0x5405
  15204. const m_TCGETS = 0x5401
  15205. const m_TCGETX = 0x5432
  15206. const m_TCSBRK = 0x5409
  15207. const m_TCSBRKP = 0x5425
  15208. const m_TCSETA = 0x5406
  15209. const m_TCSETAF = 0x5408
  15210. const m_TCSETAW = 0x5407
  15211. const m_TCSETS = 0x5402
  15212. const m_TCSETSF = 0x5404
  15213. const m_TCSETSW = 0x5403
  15214. const m_TCSETX = 0x5433
  15215. const m_TCSETXF = 0x5434
  15216. const m_TCSETXW = 0x5435
  15217. const m_TCXONC = 0x540A
  15218. const m_TIOCCBRK = 0x5428
  15219. const m_TIOCCONS = 0x541D
  15220. const m_TIOCEXCL = 0x540C
  15221. const m_TIOCGDEV = 0x80045432
  15222. const m_TIOCGETD = 0x5424
  15223. const m_TIOCGEXCL = 0x80045440
  15224. const m_TIOCGICOUNT = 0x545D
  15225. const m_TIOCGISO7816 = 0x80285442
  15226. const m_TIOCGLCKTRMIOS = 0x5456
  15227. const m_TIOCGPGRP = 0x540F
  15228. const m_TIOCGPKT = 0x80045438
  15229. const m_TIOCGPTLCK = 0x80045439
  15230. const m_TIOCGPTN = 0x80045430
  15231. const m_TIOCGPTPEER = 0x5441
  15232. const m_TIOCGRS485 = 0x542E
  15233. const m_TIOCGSERIAL = 0x541E
  15234. const m_TIOCGSID = 0x5429
  15235. const m_TIOCGSOFTCAR = 0x5419
  15236. const m_TIOCGWINSZ = 0x5413
  15237. const m_TIOCINQ = "FIONREAD"
  15238. const m_TIOCLINUX = 0x541C
  15239. const m_TIOCMBIC = 0x5417
  15240. const m_TIOCMBIS = 0x5416
  15241. const m_TIOCMGET = 0x5415
  15242. const m_TIOCMIWAIT = 0x545C
  15243. const m_TIOCMSET = 0x5418
  15244. const m_TIOCM_CAR = 0x040
  15245. const m_TIOCM_CD = "TIOCM_CAR"
  15246. const m_TIOCM_CTS = 0x020
  15247. const m_TIOCM_DSR = 0x100
  15248. const m_TIOCM_DTR = 0x002
  15249. const m_TIOCM_LE = 0x001
  15250. const m_TIOCM_LOOP = 0x8000
  15251. const m_TIOCM_OUT1 = 0x2000
  15252. const m_TIOCM_OUT2 = 0x4000
  15253. const m_TIOCM_RI = "TIOCM_RNG"
  15254. const m_TIOCM_RNG = 0x080
  15255. const m_TIOCM_RTS = 0x004
  15256. const m_TIOCM_SR = 0x010
  15257. const m_TIOCM_ST = 0x008
  15258. const m_TIOCNOTTY = 0x5422
  15259. const m_TIOCNXCL = 0x540D
  15260. const m_TIOCOUTQ = 0x5411
  15261. const m_TIOCPKT = 0x5420
  15262. const m_TIOCPKT_DATA = 0
  15263. const m_TIOCPKT_DOSTOP = 32
  15264. const m_TIOCPKT_FLUSHREAD = 1
  15265. const m_TIOCPKT_FLUSHWRITE = 2
  15266. const m_TIOCPKT_IOCTL = 64
  15267. const m_TIOCPKT_NOSTOP = 16
  15268. const m_TIOCPKT_START = 8
  15269. const m_TIOCPKT_STOP = 4
  15270. const m_TIOCSBRK = 0x5427
  15271. const m_TIOCSCTTY = 0x540E
  15272. const m_TIOCSERCONFIG = 0x5453
  15273. const m_TIOCSERGETLSR = 0x5459
  15274. const m_TIOCSERGETMULTI = 0x545A
  15275. const m_TIOCSERGSTRUCT = 0x5458
  15276. const m_TIOCSERGWILD = 0x5454
  15277. const m_TIOCSERSETMULTI = 0x545B
  15278. const m_TIOCSERSWILD = 0x5455
  15279. const m_TIOCSER_TEMT = 1
  15280. const m_TIOCSETD = 0x5423
  15281. const m_TIOCSIG = 0x40045436
  15282. const m_TIOCSISO7816 = 0xc0285443
  15283. const m_TIOCSLCKTRMIOS = 0x5457
  15284. const m_TIOCSPGRP = 0x5410
  15285. const m_TIOCSPTLCK = 0x40045431
  15286. const m_TIOCSRS485 = 0x542F
  15287. const m_TIOCSSERIAL = 0x541F
  15288. const m_TIOCSSOFTCAR = 0x541A
  15289. const m_TIOCSTI = 0x5412
  15290. const m_TIOCSWINSZ = 0x5414
  15291. const m_TIOCVHANGUP = 0x5437
  15292. const m_UMOUNT_NOFOLLOW = 8
  15293. const m__IOC_DIRBITS = 2
  15294. const m__IOC_NONE = 0
  15295. const m__IOC_NRBITS = 8
  15296. const m__IOC_NRSHIFT = 0
  15297. const m__IOC_READ = 2
  15298. const m__IOC_SIZEBITS = 14
  15299. const m__IOC_TYPEBITS = 8
  15300. const m__IOC_WRITE = 1
  15301. const m__POSIX_C_SOURCE = 199309
  15302. const m___BITS_PER_LONG = 64
  15303. const m___BITS_PER_LONG_LONG = 64
  15304. const m___bitwise__ = "__bitwise"
  15305. type Tstatvfs = struct {
  15306. Ff_bsize uint64
  15307. Ff_frsize uint64
  15308. Ff_blocks Tfsblkcnt_t
  15309. Ff_bfree Tfsblkcnt_t
  15310. Ff_bavail Tfsblkcnt_t
  15311. Ff_files Tfsfilcnt_t
  15312. Ff_ffree Tfsfilcnt_t
  15313. Ff_favail Tfsfilcnt_t
  15314. Ff_fsid uint64
  15315. Ff_flag uint64
  15316. Ff_namemax uint64
  15317. Ff_type uint32
  15318. F__reserved [5]int32
  15319. }
  15320. type TElf_Symndx = uint32
  15321. type Tdl_phdr_info = struct {
  15322. Fdlpi_addr TElf64_Addr
  15323. Fdlpi_name uintptr
  15324. Fdlpi_phdr uintptr
  15325. Fdlpi_phnum TElf64_Half
  15326. Fdlpi_adds uint64
  15327. Fdlpi_subs uint64
  15328. Fdlpi_tls_modid Tsize_t
  15329. Fdlpi_tls_data uintptr
  15330. }
  15331. type Tlink_map = struct {
  15332. Fl_addr TElf64_Addr
  15333. Fl_name uintptr
  15334. Fl_ld uintptr
  15335. Fl_next uintptr
  15336. Fl_prev uintptr
  15337. }
  15338. type Tr_debug = struct {
  15339. Fr_version int32
  15340. Fr_map uintptr
  15341. Fr_brk TElf64_Addr
  15342. Fr_state int32
  15343. Fr_ldbase TElf64_Addr
  15344. }
  15345. const _RT_CONSISTENT = 0
  15346. const _RT_ADD = 1
  15347. const _RT_DELETE = 2
  15348. type TSHA2_CTX = struct {
  15349. Fstate struct {
  15350. Fst64 [0][8]Tuint64_t
  15351. Fst32 [8]Tuint32_t
  15352. F__ccgo_pad2 [32]byte
  15353. }
  15354. Fbitcount [2]Tuint64_t
  15355. Fbuffer [128]Tuint8_t
  15356. }
  15357. type T_SHA2_CTX = TSHA2_CTX
  15358. type TSHA512_CTX = struct {
  15359. Fstate struct {
  15360. Fst64 [0][8]Tuint64_t
  15361. Fst32 [8]Tuint32_t
  15362. F__ccgo_pad2 [32]byte
  15363. }
  15364. Fbitcount [2]Tuint64_t
  15365. Fbuffer [128]Tuint8_t
  15366. }
  15367. type TSHA384_CTX = struct {
  15368. Fstate struct {
  15369. Fst64 [0][8]Tuint64_t
  15370. Fst32 [8]Tuint32_t
  15371. F__ccgo_pad2 [32]byte
  15372. }
  15373. Fbitcount [2]Tuint64_t
  15374. Fbuffer [128]Tuint8_t
  15375. }
  15376. type t__s8 = int8
  15377. type t__u8 = uint8
  15378. type t__s16 = int16
  15379. type t__u16 = uint16
  15380. type t__s32 = int32
  15381. type t__u32 = uint32
  15382. type t__s64 = int64
  15383. type t__u64 = uint64
  15384. type t__kernel_fd_set = struct {
  15385. Ffds_bits [16]uint64
  15386. }
  15387. type t__kernel_sighandler_t = uintptr
  15388. type t__kernel_key_t = int32
  15389. type t__kernel_mqd_t = int32
  15390. type t__kernel_old_uid_t = uint16
  15391. type t__kernel_old_gid_t = uint16
  15392. type t__kernel_long_t = int64
  15393. type t__kernel_ulong_t = uint64
  15394. type t__kernel_ino_t = uint64
  15395. type t__kernel_mode_t = uint32
  15396. type t__kernel_pid_t = int32
  15397. type t__kernel_ipc_pid_t = int32
  15398. type t__kernel_uid_t = uint32
  15399. type t__kernel_gid_t = uint32
  15400. type t__kernel_suseconds_t = int64
  15401. type t__kernel_daddr_t = int32
  15402. type t__kernel_uid32_t = uint32
  15403. type t__kernel_gid32_t = uint32
  15404. type t__kernel_old_dev_t = uint32
  15405. type t__kernel_size_t = uint64
  15406. type t__kernel_ssize_t = int64
  15407. type t__kernel_ptrdiff_t = int64
  15408. type t__kernel_fsid_t = struct {
  15409. Fval [2]int32
  15410. }
  15411. type t__kernel_off_t = int64
  15412. type t__kernel_loff_t = int64
  15413. type t__kernel_old_time_t = int64
  15414. type t__kernel_time_t = int64
  15415. type t__kernel_time64_t = int64
  15416. type t__kernel_clock_t = int64
  15417. type t__kernel_timer_t = int32
  15418. type t__kernel_clockid_t = int32
  15419. type t__kernel_caddr_t = uintptr
  15420. type t__kernel_uid16_t = uint16
  15421. type t__kernel_gid16_t = uint16
  15422. type t__s128 = [2]uint64
  15423. type t__u128 = [2]uint64
  15424. type t__le16 = uint16
  15425. type t__be16 = uint16
  15426. type t__le32 = uint32
  15427. type t__be32 = uint32
  15428. type t__le64 = uint64
  15429. type t__be64 = uint64
  15430. type t__sum16 = uint16
  15431. type t__wsum = uint32
  15432. type t__poll_t = uint32
  15433. type Trand_pool_info = struct {
  15434. Fentropy_count int32
  15435. Fbuf_size int32
  15436. }
  15437. type Tvgetrandom_opaque_params = struct {
  15438. Fsize_of_opaque_state t__u32
  15439. Fmmap_prot t__u32
  15440. Fmmap_flags t__u32
  15441. Freserved [13]t__u32
  15442. }
  15443. type Tfsid_t = struct {
  15444. F__val [2]int32
  15445. }
  15446. type t__fsid_t = Tfsid_t
  15447. type Tstatfs = struct {
  15448. Ff_type uint64
  15449. Ff_bsize uint64
  15450. Ff_blocks Tfsblkcnt_t
  15451. Ff_bfree Tfsblkcnt_t
  15452. Ff_bavail Tfsblkcnt_t
  15453. Ff_files Tfsfilcnt_t
  15454. Ff_ffree Tfsfilcnt_t
  15455. Ff_fsid Tfsid_t
  15456. Ff_namelen uint64
  15457. Ff_frsize uint64
  15458. Ff_flags uint64
  15459. Ff_spare [4]uint64
  15460. }
  15461. func Xgetentropy(tls *libc.TLS, buf uintptr, len1 Tsize_t) (r int32) {
  15462. var ret int32
  15463. _ = ret
  15464. ret = -int32(1)
  15465. if len1 > uint64(256) {
  15466. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EIO)
  15467. return -int32(1)
  15468. }
  15469. /*
  15470. * Try descriptor-less getrandom(), in non-blocking mode.
  15471. *
  15472. * The design of Linux getrandom is broken. It has an
  15473. * uninitialized phase coupled with blocking behaviour, which
  15474. * is unacceptable from within a library at boot time without
  15475. * possible recovery. See http://bugs.python.org/issue26839#msg267745
  15476. */
  15477. ret = _getentropy_getrandom(tls, buf, len1)
  15478. if ret != -int32(1) {
  15479. return ret
  15480. }
  15481. /*
  15482. * Try to get entropy with /dev/urandom
  15483. *
  15484. * This can fail if the process is inside a chroot or if file
  15485. * descriptors are exhausted.
  15486. */
  15487. ret = _getentropy_urandom(tls, buf, len1)
  15488. if ret != -int32(1) {
  15489. return ret
  15490. }
  15491. /*
  15492. * Entropy collection via /dev/urandom and sysctl have failed.
  15493. *
  15494. * No other API exists for collecting entropy. See the large
  15495. * comment block above.
  15496. *
  15497. * We have very few options:
  15498. * - Even syslog_r is unsafe to call at this low level, so
  15499. * there is no way to alert the user or program.
  15500. * - Cannot call abort() because some systems have unsafe
  15501. * corefiles.
  15502. * - Could raise(SIGKILL) resulting in silent program termination.
  15503. * - Return EIO, to hint that arc4random's stir function
  15504. * should raise(SIGKILL)
  15505. * - Do the best under the circumstances....
  15506. *
  15507. * This code path exists to bring light to the issue that Linux
  15508. * still does not provide a failsafe API for entropy collection.
  15509. *
  15510. * We hope this demonstrates that Linux should either retain their
  15511. * sysctl ABI, or consider providing a new failsafe API which
  15512. * works in a chroot or when file descriptors are exhausted.
  15513. */
  15514. ret = _getentropy_fallback(tls, buf, len1)
  15515. if ret != -int32(1) {
  15516. return ret
  15517. }
  15518. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EIO)
  15519. return ret
  15520. }
  15521. // C documentation
  15522. //
  15523. // /*
  15524. // * Basic sanity checking; wish we could do better.
  15525. // */
  15526. func _gotdata(tls *libc.TLS, buf uintptr, len1 Tsize_t) (r int32) {
  15527. var any_set uint8
  15528. var i Tsize_t
  15529. _, _ = any_set, i
  15530. any_set = uint8(0)
  15531. i = uint64(0)
  15532. for {
  15533. if !(i < len1) {
  15534. break
  15535. }
  15536. any_set = uint8(int32(any_set) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(buf + uintptr(i)))))
  15537. goto _1
  15538. _1:
  15539. ;
  15540. i++
  15541. }
  15542. if libc.Int32FromUint8(any_set) == 0 {
  15543. return -int32(1)
  15544. }
  15545. return 0
  15546. }
  15547. func _getentropy_getrandom(tls *libc.TLS, buf uintptr, len1 Tsize_t) (r int32) {
  15548. bp := tls.Alloc(32)
  15549. defer tls.Free(32)
  15550. var pre_errno, ret int32
  15551. _, _ = pre_errno, ret
  15552. pre_errno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  15553. if len1 > uint64(256) {
  15554. return -int32(1)
  15555. }
  15556. for cond := true; cond; cond = ret == -int32(1) && *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EINTR) {
  15557. ret = int32(libc.Xsyscall(tls, int64(m_SYS_getrandom), libc.VaList(bp+8, buf, len1, int32(m_GRND_NONBLOCK))))
  15558. }
  15559. if ret != libc.Int32FromUint64(len1) {
  15560. return -int32(1)
  15561. }
  15562. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = pre_errno
  15563. return 0
  15564. }
  15565. func _getentropy_urandom(tls *libc.TLS, buf uintptr, len1 Tsize_t) (r int32) {
  15566. bp := tls.Alloc(160)
  15567. defer tls.Free(160)
  15568. var fd, flags, save_errno int32
  15569. var i, wanted Tsize_t
  15570. var ret Tssize_t
  15571. var _ /* cnt at bp+128 */ int32
  15572. var _ /* st at bp+0 */ Tstat
  15573. _, _, _, _, _, _ = fd, flags, i, ret, save_errno, wanted
  15574. save_errno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  15575. goto start
  15576. start:
  15577. ;
  15578. flags = m_O_RDONLY3
  15579. flags |= int32(m_O_NOFOLLOW1)
  15580. flags |= int32(m_O_CLOEXEC1)
  15581. fd = libc.Xopen(tls, __ccgo_ts+650, flags, libc.VaList(bp+144, 0))
  15582. if fd == -int32(1) {
  15583. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EINTR) {
  15584. goto start
  15585. }
  15586. goto nodevrandom
  15587. }
  15588. /* Lightly verify that the device node looks sane */
  15589. if libc.Xfstat(tls, fd, bp) == -int32(1) || !((*(*Tstat)(unsafe.Pointer(bp))).Fst_mode&libc.Uint32FromInt32(m_S_IFMT3) == libc.Uint32FromInt32(m_S_IFCHR3)) {
  15590. libc.Xclose(tls, fd)
  15591. goto nodevrandom
  15592. }
  15593. if libc.Xioctl(tls, fd, libc.Int32FromUint64(uint64(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.Uint64FromInt64(4)<<(libc.Int32FromInt32(m__IOC_NRSHIFT)+libc.Int32FromInt32(m__IOC_NRBITS)+libc.Int32FromInt32(m__IOC_TYPEBITS))), libc.VaList(bp+144, bp+128)) == -int32(1) {
  15594. libc.Xclose(tls, fd)
  15595. goto nodevrandom
  15596. }
  15597. i = uint64(0)
  15598. for {
  15599. if !(i < len1) {
  15600. break
  15601. }
  15602. wanted = len1 - i
  15603. ret = libc.Xread(tls, fd, buf+uintptr(i), wanted)
  15604. if ret == int64(-int32(1)) {
  15605. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EAGAIN) || *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EINTR) {
  15606. goto _1
  15607. }
  15608. libc.Xclose(tls, fd)
  15609. goto nodevrandom
  15610. }
  15611. i += libc.Uint64FromInt64(ret)
  15612. goto _1
  15613. _1:
  15614. }
  15615. libc.Xclose(tls, fd)
  15616. if _gotdata(tls, buf, len1) == 0 {
  15617. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = save_errno
  15618. return 0 /* satisfied */
  15619. }
  15620. goto nodevrandom
  15621. nodevrandom:
  15622. ;
  15623. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EIO)
  15624. return -int32(1)
  15625. }
  15626. var _cl = [6]int32{
  15627. 1: int32(m_CLOCK_MONOTONIC),
  15628. 2: int32(m_CLOCK_MONOTONIC_RAW),
  15629. 3: int32(m_CLOCK_TAI),
  15630. 4: int32(m_CLOCK_PROCESS_CPUTIME_ID),
  15631. 5: int32(m_CLOCK_THREAD_CPUTIME_ID),
  15632. }
  15633. func _getentropy_phdr(tls *libc.TLS, info uintptr, size Tsize_t, data uintptr) (r int32) {
  15634. var ctx uintptr
  15635. _ = ctx
  15636. ctx = data
  15637. libmd.XSHA512Update(tls, ctx, info, uint64(8))
  15638. return 0
  15639. }
  15640. func _getentropy_fallback(tls *libc.TLS, buf uintptr, len1 Tsize_t) (r int32) {
  15641. bp := tls.Alloc(1488)
  15642. defer tls.Free(1488)
  15643. var faster, j, pgs, repeat, save_errno, v13, v14, v16, v18, v19, v3, v9 int32
  15644. var i, ii, m, mo Tsize_t
  15645. var v11 uintptr
  15646. var v17 Toff_t
  15647. var v20, v21 uint64
  15648. var v5, v6, v7, v8 Tpid_t
  15649. var _ /* ctx at bp+632 */ TSHA512_CTX
  15650. var _ /* e at bp+64 */ int32
  15651. var _ /* mm at bp+1296 */ [12]struct {
  15652. Fnpg Tsize_t
  15653. Fp uintptr
  15654. }
  15655. var _ /* off at bp+1288 */ Toff_t
  15656. var _ /* p at bp+848 */ uintptr
  15657. var _ /* pid at bp+840 */ Tpid_t
  15658. var _ /* results at bp+0 */ [64]Tuint8_t
  15659. var _ /* ru at bp+104 */ Trusage
  15660. var _ /* sigset at bp+376 */ Tsigset_t
  15661. var _ /* ss at bp+856 */ Tsockaddr_storage
  15662. var _ /* ssl at bp+1280 */ Tsocklen_t
  15663. var _ /* st at bp+504 */ Tstat
  15664. var _ /* stfs at bp+1160 */ Tstatfs
  15665. var _ /* stvfs at bp+984 */ Tstatvfs
  15666. var _ /* tios at bp+1096 */ Ttermios
  15667. var _ /* ts at bp+72 */ Ttimespec
  15668. var _ /* tv at bp+88 */ Ttimeval
  15669. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  15670. save_errno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  15671. pgs = libc.Xgetpagesize(tls)
  15672. faster = 0
  15673. *(*Tpid_t)(unsafe.Pointer(bp + 840)) = libc.Xgetpid(tls)
  15674. if _lastpid == *(*Tpid_t)(unsafe.Pointer(bp + 840)) {
  15675. faster = int32(1)
  15676. repeat = int32(2)
  15677. } else {
  15678. faster = 0
  15679. _lastpid = *(*Tpid_t)(unsafe.Pointer(bp + 840))
  15680. repeat = int32(m_REPEAT)
  15681. }
  15682. i = uint64(0)
  15683. for {
  15684. if !(i < len1) {
  15685. break
  15686. }
  15687. libmd.XSHA512Init(tls, bp+632)
  15688. j = 0
  15689. for {
  15690. if !(j < repeat) {
  15691. break
  15692. }
  15693. v3 = libc.Xgettimeofday(tls, bp+88, libc.UintptrFromInt32(0))
  15694. *(*int32)(unsafe.Pointer(bp + 64)) = v3
  15695. if v3 == -int32(1) {
  15696. libmd.XSHA512Update(tls, bp+632, libc.X__errno_location(tls), uint64(4))
  15697. } else {
  15698. libmd.XSHA512Update(tls, bp+632, bp+88, uint64(16))
  15699. }
  15700. if *(*int32)(unsafe.Pointer(bp + 64)) != -int32(1) {
  15701. _cnt += int32((*(*Ttimeval)(unsafe.Pointer(bp + 88))).Ftv_sec)
  15702. _cnt += int32((*(*Ttimeval)(unsafe.Pointer(bp + 88))).Ftv_usec)
  15703. }
  15704. _dl_iterate_phdr(tls, __ccgo_fp(_getentropy_phdr), bp+632)
  15705. ii = uint64(0)
  15706. for {
  15707. if !(ii < libc.Uint64FromInt64(24)/libc.Uint64FromInt64(4)) {
  15708. break
  15709. }
  15710. if libc.Xclock_gettime(tls, _cl[ii], bp+72) == -int32(1) {
  15711. libmd.XSHA512Update(tls, bp+632, libc.X__errno_location(tls), uint64(4))
  15712. } else {
  15713. libmd.XSHA512Update(tls, bp+632, bp+72, uint64(16))
  15714. }
  15715. goto _4
  15716. _4:
  15717. ;
  15718. ii++
  15719. }
  15720. v5 = libc.Xgetpid(tls)
  15721. *(*Tpid_t)(unsafe.Pointer(bp + 840)) = v5
  15722. if v5 == -int32(1) {
  15723. libmd.XSHA512Update(tls, bp+632, libc.X__errno_location(tls), uint64(4))
  15724. } else {
  15725. libmd.XSHA512Update(tls, bp+632, bp+840, uint64(4))
  15726. }
  15727. v6 = libc.Xgetsid(tls, *(*Tpid_t)(unsafe.Pointer(bp + 840)))
  15728. *(*Tpid_t)(unsafe.Pointer(bp + 840)) = v6
  15729. if v6 == -int32(1) {
  15730. libmd.XSHA512Update(tls, bp+632, libc.X__errno_location(tls), uint64(4))
  15731. } else {
  15732. libmd.XSHA512Update(tls, bp+632, bp+840, uint64(4))
  15733. }
  15734. v7 = libc.Xgetppid(tls)
  15735. *(*Tpid_t)(unsafe.Pointer(bp + 840)) = v7
  15736. if v7 == -int32(1) {
  15737. libmd.XSHA512Update(tls, bp+632, libc.X__errno_location(tls), uint64(4))
  15738. } else {
  15739. libmd.XSHA512Update(tls, bp+632, bp+840, uint64(4))
  15740. }
  15741. v8 = libc.Xgetpgid(tls, 0)
  15742. *(*Tpid_t)(unsafe.Pointer(bp + 840)) = v8
  15743. if v8 == -int32(1) {
  15744. libmd.XSHA512Update(tls, bp+632, libc.X__errno_location(tls), uint64(4))
  15745. } else {
  15746. libmd.XSHA512Update(tls, bp+632, bp+840, uint64(4))
  15747. }
  15748. v9 = libc.Xgetpriority(tls, 0, uint32(0))
  15749. *(*int32)(unsafe.Pointer(bp + 64)) = v9
  15750. if v9 == -int32(1) {
  15751. libmd.XSHA512Update(tls, bp+632, libc.X__errno_location(tls), uint64(4))
  15752. } else {
  15753. libmd.XSHA512Update(tls, bp+632, bp+64, uint64(4))
  15754. }
  15755. if !(faster != 0) {
  15756. (*(*Ttimespec)(unsafe.Pointer(bp + 72))).Ftv_sec = 0
  15757. (*(*Ttimespec)(unsafe.Pointer(bp + 72))).Ftv_nsec = int64(1)
  15758. libc.Xnanosleep(tls, bp+72, libc.UintptrFromInt32(0))
  15759. }
  15760. if libc.Xsigpending(tls, bp+376) == -int32(1) {
  15761. libmd.XSHA512Update(tls, bp+632, libc.X__errno_location(tls), uint64(4))
  15762. } else {
  15763. libmd.XSHA512Update(tls, bp+632, bp+376, uint64(128))
  15764. }
  15765. if libc.Xsigprocmask(tls, m_SIG_BLOCK, libc.UintptrFromInt32(0), bp+376) == -int32(1) {
  15766. libmd.XSHA512Update(tls, bp+632, libc.X__errno_location(tls), uint64(4))
  15767. } else {
  15768. libmd.XSHA512Update(tls, bp+632, bp+376, uint64(128))
  15769. }
  15770. libmd.XSHA512Update(tls, bp+632, __ccgo_fp(Xgetentropy), uint64(8)) /* an addr in this library */
  15771. libmd.XSHA512Update(tls, bp+632, __ccgo_fp(libc.Xprintf), uint64(8)) /* an addr in libc */
  15772. *(*uintptr)(unsafe.Pointer(bp + 848)) = bp + 848
  15773. libmd.XSHA512Update(tls, bp+632, bp+848, uint64(8)) /* an addr on stack */
  15774. *(*uintptr)(unsafe.Pointer(bp + 848)) = libc.X__errno_location(tls)
  15775. libmd.XSHA512Update(tls, bp+632, bp+848, uint64(8)) /* the addr of errno */
  15776. if i == uint64(0) {
  15777. /*
  15778. * Prime-sized mappings encourage fragmentation;
  15779. * thus exposing some address entropy.
  15780. */
  15781. *(*[12]struct {
  15782. Fnpg Tsize_t
  15783. Fp uintptr
  15784. })(unsafe.Pointer(bp + 1296)) = [12]struct {
  15785. Fnpg Tsize_t
  15786. Fp uintptr
  15787. }{
  15788. 0: {
  15789. Fnpg: uint64(17),
  15790. Fp: uintptr(-libc.Int32FromInt32(1)),
  15791. },
  15792. 1: {
  15793. Fnpg: uint64(3),
  15794. Fp: uintptr(-libc.Int32FromInt32(1)),
  15795. },
  15796. 2: {
  15797. Fnpg: uint64(11),
  15798. Fp: uintptr(-libc.Int32FromInt32(1)),
  15799. },
  15800. 3: {
  15801. Fnpg: uint64(2),
  15802. Fp: uintptr(-libc.Int32FromInt32(1)),
  15803. },
  15804. 4: {
  15805. Fnpg: uint64(5),
  15806. Fp: uintptr(-libc.Int32FromInt32(1)),
  15807. },
  15808. 5: {
  15809. Fnpg: uint64(3),
  15810. Fp: uintptr(-libc.Int32FromInt32(1)),
  15811. },
  15812. 6: {
  15813. Fnpg: uint64(7),
  15814. Fp: uintptr(-libc.Int32FromInt32(1)),
  15815. },
  15816. 7: {
  15817. Fnpg: uint64(1),
  15818. Fp: uintptr(-libc.Int32FromInt32(1)),
  15819. },
  15820. 8: {
  15821. Fnpg: uint64(57),
  15822. Fp: uintptr(-libc.Int32FromInt32(1)),
  15823. },
  15824. 9: {
  15825. Fnpg: uint64(3),
  15826. Fp: uintptr(-libc.Int32FromInt32(1)),
  15827. },
  15828. 10: {
  15829. Fnpg: uint64(131),
  15830. Fp: uintptr(-libc.Int32FromInt32(1)),
  15831. },
  15832. 11: {
  15833. Fnpg: uint64(1),
  15834. Fp: uintptr(-libc.Int32FromInt32(1)),
  15835. },
  15836. }
  15837. m = uint64(0)
  15838. for {
  15839. if !(m < libc.Uint64FromInt64(192)/libc.Uint64FromInt64(16)) {
  15840. break
  15841. }
  15842. v11 = libc.Xmmap(tls, libc.UintptrFromInt32(0), (*(*[12]struct {
  15843. Fnpg Tsize_t
  15844. Fp uintptr
  15845. })(unsafe.Pointer(bp + 1296)))[m].Fnpg*libc.Uint64FromInt32(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))
  15846. (*(*[12]struct {
  15847. Fnpg Tsize_t
  15848. Fp uintptr
  15849. })(unsafe.Pointer(bp + 1296)))[m].Fp = v11
  15850. if v11 != 0 {
  15851. libmd.XSHA512Update(tls, bp+632, libc.X__errno_location(tls), uint64(4))
  15852. } else {
  15853. libmd.XSHA512Update(tls, bp+632, bp+1296+uintptr(m)*16+8, uint64(8))
  15854. }
  15855. if (*(*[12]struct {
  15856. Fnpg Tsize_t
  15857. Fp uintptr
  15858. })(unsafe.Pointer(bp + 1296)))[m].Fp != uintptr(-libc.Int32FromInt32(1)) {
  15859. /* Touch some memory... */
  15860. *(*uintptr)(unsafe.Pointer(bp + 848)) = (*(*[12]struct {
  15861. Fnpg Tsize_t
  15862. Fp uintptr
  15863. })(unsafe.Pointer(bp + 1296)))[m].Fp
  15864. mo = libc.Uint64FromInt32(_cnt) % ((*(*[12]struct {
  15865. Fnpg Tsize_t
  15866. Fp uintptr
  15867. })(unsafe.Pointer(bp + 1296)))[m].Fnpg*libc.Uint64FromInt32(pgs) - uint64(1))
  15868. *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 848)) + uintptr(mo))) = uint8(1)
  15869. _cnt += int32(int64((*(*[12]struct {
  15870. Fnpg Tsize_t
  15871. Fp uintptr
  15872. })(unsafe.Pointer(bp + 1296)))[m].Fp) / int64(pgs))
  15873. }
  15874. /* Check cnts and times... */
  15875. ii = uint64(0)
  15876. for {
  15877. if !(ii < libc.Uint64FromInt64(24)/libc.Uint64FromInt64(4)) {
  15878. break
  15879. }
  15880. v13 = libc.Xclock_gettime(tls, _cl[ii], bp+72)
  15881. *(*int32)(unsafe.Pointer(bp + 64)) = v13
  15882. if v13 == -int32(1) {
  15883. libmd.XSHA512Update(tls, bp+632, libc.X__errno_location(tls), uint64(4))
  15884. } else {
  15885. libmd.XSHA512Update(tls, bp+632, bp+72, uint64(16))
  15886. }
  15887. if *(*int32)(unsafe.Pointer(bp + 64)) != -int32(1) {
  15888. _cnt += int32((*(*Ttimespec)(unsafe.Pointer(bp + 72))).Ftv_nsec)
  15889. }
  15890. goto _12
  15891. _12:
  15892. ;
  15893. ii++
  15894. }
  15895. v14 = libc.Xgetrusage(tls, m_RUSAGE_SELF, bp+104)
  15896. *(*int32)(unsafe.Pointer(bp + 64)) = v14
  15897. if v14 == -int32(1) {
  15898. libmd.XSHA512Update(tls, bp+632, libc.X__errno_location(tls), uint64(4))
  15899. } else {
  15900. libmd.XSHA512Update(tls, bp+632, bp+104, uint64(272))
  15901. }
  15902. if *(*int32)(unsafe.Pointer(bp + 64)) != -int32(1) {
  15903. _cnt += int32((*(*Trusage)(unsafe.Pointer(bp + 104))).Fru_utime.Ftv_sec)
  15904. _cnt += int32((*(*Trusage)(unsafe.Pointer(bp + 104))).Fru_utime.Ftv_usec)
  15905. }
  15906. goto _10
  15907. _10:
  15908. ;
  15909. m++
  15910. }
  15911. m = uint64(0)
  15912. for {
  15913. if !(m < libc.Uint64FromInt64(192)/libc.Uint64FromInt64(16)) {
  15914. break
  15915. }
  15916. if (*(*[12]struct {
  15917. Fnpg Tsize_t
  15918. Fp uintptr
  15919. })(unsafe.Pointer(bp + 1296)))[m].Fp != uintptr(-libc.Int32FromInt32(1)) {
  15920. libc.Xmunmap(tls, (*(*[12]struct {
  15921. Fnpg Tsize_t
  15922. Fp uintptr
  15923. })(unsafe.Pointer(bp + 1296)))[m].Fp, (*(*[12]struct {
  15924. Fnpg Tsize_t
  15925. Fp uintptr
  15926. })(unsafe.Pointer(bp + 1296)))[m].Fnpg*libc.Uint64FromInt32(pgs))
  15927. }
  15928. (*(*[12]struct {
  15929. Fnpg Tsize_t
  15930. Fp uintptr
  15931. })(unsafe.Pointer(bp + 1296)))[m].Fp = uintptr(-libc.Int32FromInt32(1))
  15932. goto _15
  15933. _15:
  15934. ;
  15935. m++
  15936. }
  15937. if libc.Xstat(tls, __ccgo_ts+663, bp+504) == -int32(1) {
  15938. libmd.XSHA512Update(tls, bp+632, libc.X__errno_location(tls), uint64(4))
  15939. } else {
  15940. libmd.XSHA512Update(tls, bp+632, bp+504, uint64(128))
  15941. }
  15942. if libc.Xstatvfs(tls, __ccgo_ts+663, bp+984) == -int32(1) {
  15943. libmd.XSHA512Update(tls, bp+632, libc.X__errno_location(tls), uint64(4))
  15944. } else {
  15945. libmd.XSHA512Update(tls, bp+632, bp+984, uint64(112))
  15946. }
  15947. if _statfs(tls, __ccgo_ts+663, bp+1160) == -int32(1) {
  15948. libmd.XSHA512Update(tls, bp+632, libc.X__errno_location(tls), uint64(4))
  15949. } else {
  15950. libmd.XSHA512Update(tls, bp+632, bp+1160, uint64(120))
  15951. }
  15952. if libc.Xstat(tls, __ccgo_ts+665, bp+504) == -int32(1) {
  15953. libmd.XSHA512Update(tls, bp+632, libc.X__errno_location(tls), uint64(4))
  15954. } else {
  15955. libmd.XSHA512Update(tls, bp+632, bp+504, uint64(128))
  15956. }
  15957. if libc.Xstatvfs(tls, __ccgo_ts+665, bp+984) == -int32(1) {
  15958. libmd.XSHA512Update(tls, bp+632, libc.X__errno_location(tls), uint64(4))
  15959. } else {
  15960. libmd.XSHA512Update(tls, bp+632, bp+984, uint64(112))
  15961. }
  15962. if _statfs(tls, __ccgo_ts+665, bp+1160) == -int32(1) {
  15963. libmd.XSHA512Update(tls, bp+632, libc.X__errno_location(tls), uint64(4))
  15964. } else {
  15965. libmd.XSHA512Update(tls, bp+632, bp+1160, uint64(120))
  15966. }
  15967. v16 = libc.Xfstat(tls, 0, bp+504)
  15968. *(*int32)(unsafe.Pointer(bp + 64)) = v16
  15969. if v16 == -int32(1) {
  15970. libmd.XSHA512Update(tls, bp+632, libc.X__errno_location(tls), uint64(4))
  15971. } else {
  15972. libmd.XSHA512Update(tls, bp+632, bp+504, uint64(128))
  15973. }
  15974. if *(*int32)(unsafe.Pointer(bp + 64)) == -int32(1) {
  15975. if (*(*Tstat)(unsafe.Pointer(bp + 504))).Fst_mode&uint32(m_S_IFMT3) == uint32(m_S_IFREG3) || (*(*Tstat)(unsafe.Pointer(bp + 504))).Fst_mode&uint32(m_S_IFMT3) == uint32(m_S_IFIFO3) || (*(*Tstat)(unsafe.Pointer(bp + 504))).Fst_mode&uint32(m_S_IFMT3) == uint32(m_S_IFSOCK3) {
  15976. if libc.Xfstatvfs(tls, 0, bp+984) == -int32(1) {
  15977. libmd.XSHA512Update(tls, bp+632, libc.X__errno_location(tls), uint64(4))
  15978. } else {
  15979. libmd.XSHA512Update(tls, bp+632, bp+984, uint64(112))
  15980. }
  15981. if libc.Xfstatfs(tls, 0, bp+1160) == -int32(1) {
  15982. libmd.XSHA512Update(tls, bp+632, libc.X__errno_location(tls), uint64(4))
  15983. } else {
  15984. libmd.XSHA512Update(tls, bp+632, bp+1160, uint64(120))
  15985. }
  15986. v17 = libc.Xlseek(tls, 0, libc.Int64FromInt32(0), int32(1))
  15987. *(*Toff_t)(unsafe.Pointer(bp + 1288)) = v17
  15988. if v17 < 0 {
  15989. libmd.XSHA512Update(tls, bp+632, libc.X__errno_location(tls), uint64(4))
  15990. } else {
  15991. libmd.XSHA512Update(tls, bp+632, bp+1288, uint64(8))
  15992. }
  15993. }
  15994. if (*(*Tstat)(unsafe.Pointer(bp + 504))).Fst_mode&uint32(m_S_IFMT3) == uint32(m_S_IFCHR3) {
  15995. if libc.Xtcgetattr(tls, 0, bp+1096) == -int32(1) {
  15996. libmd.XSHA512Update(tls, bp+632, libc.X__errno_location(tls), uint64(4))
  15997. } else {
  15998. libmd.XSHA512Update(tls, bp+632, bp+1096, uint64(60))
  15999. }
  16000. } else {
  16001. if (*(*Tstat)(unsafe.Pointer(bp + 504))).Fst_mode&uint32(m_S_IFMT3) == uint32(m_S_IFSOCK3) {
  16002. libc.Xmemset(tls, bp+856, 0, uint64(128))
  16003. *(*Tsocklen_t)(unsafe.Pointer(bp + 1280)) = uint32(128)
  16004. if libc.Xgetpeername(tls, 0, bp+856, bp+1280) == -int32(1) {
  16005. libmd.XSHA512Update(tls, bp+632, libc.X__errno_location(tls), uint64(4))
  16006. } else {
  16007. libmd.XSHA512Update(tls, bp+632, bp+856, uint64(128))
  16008. }
  16009. }
  16010. }
  16011. }
  16012. v18 = libc.Xgetrusage(tls, -int32(1), bp+104)
  16013. *(*int32)(unsafe.Pointer(bp + 64)) = v18
  16014. if v18 == -int32(1) {
  16015. libmd.XSHA512Update(tls, bp+632, libc.X__errno_location(tls), uint64(4))
  16016. } else {
  16017. libmd.XSHA512Update(tls, bp+632, bp+104, uint64(272))
  16018. }
  16019. if *(*int32)(unsafe.Pointer(bp + 64)) != -int32(1) {
  16020. _cnt += int32((*(*Trusage)(unsafe.Pointer(bp + 104))).Fru_utime.Ftv_sec)
  16021. _cnt += int32((*(*Trusage)(unsafe.Pointer(bp + 104))).Fru_utime.Ftv_usec)
  16022. }
  16023. } else {
  16024. /* Subsequent hashes absorb previous result */
  16025. libmd.XSHA512Update(tls, bp+632, bp, uint64(64))
  16026. }
  16027. v19 = libc.Xgettimeofday(tls, bp+88, libc.UintptrFromInt32(0))
  16028. *(*int32)(unsafe.Pointer(bp + 64)) = v19
  16029. if v19 == -int32(1) {
  16030. libmd.XSHA512Update(tls, bp+632, libc.X__errno_location(tls), uint64(4))
  16031. } else {
  16032. libmd.XSHA512Update(tls, bp+632, bp+88, uint64(16))
  16033. }
  16034. if *(*int32)(unsafe.Pointer(bp + 64)) != -int32(1) {
  16035. _cnt += int32((*(*Ttimeval)(unsafe.Pointer(bp + 88))).Ftv_sec)
  16036. _cnt += int32((*(*Ttimeval)(unsafe.Pointer(bp + 88))).Ftv_usec)
  16037. }
  16038. libmd.XSHA512Update(tls, bp+632, uintptr(unsafe.Pointer(&_cnt)), uint64(4))
  16039. goto _2
  16040. _2:
  16041. ;
  16042. j++
  16043. }
  16044. /* Not as random as you think but we take what we are given */
  16045. *(*uintptr)(unsafe.Pointer(bp + 848)) = uintptr(libc.Int64FromUint64(libc.Xgetauxval(tls, uint64(m_AT_RANDOM))))
  16046. if *(*uintptr)(unsafe.Pointer(bp + 848)) != 0 {
  16047. libmd.XSHA512Update(tls, bp+632, *(*uintptr)(unsafe.Pointer(bp + 848)), libc.Uint64FromInt32(libc.Int32FromInt32(16)))
  16048. }
  16049. *(*uintptr)(unsafe.Pointer(bp + 848)) = uintptr(libc.Int64FromUint64(libc.Xgetauxval(tls, uint64(m_AT_SYSINFO_EHDR))))
  16050. if *(*uintptr)(unsafe.Pointer(bp + 848)) != 0 {
  16051. libmd.XSHA512Update(tls, bp+632, *(*uintptr)(unsafe.Pointer(bp + 848)), libc.Uint64FromInt32(pgs))
  16052. }
  16053. *(*uintptr)(unsafe.Pointer(bp + 848)) = uintptr(libc.Int64FromUint64(libc.Xgetauxval(tls, uint64(m_AT_BASE))))
  16054. if *(*uintptr)(unsafe.Pointer(bp + 848)) != 0 {
  16055. libmd.XSHA512Update(tls, bp+632, bp+848, uint64(8))
  16056. }
  16057. libmd.XSHA512Final(tls, bp, bp+632)
  16058. if libc.Uint64FromInt64(64) < len1-i {
  16059. v20 = libc.Uint64FromInt64(64)
  16060. } else {
  16061. v20 = len1 - i
  16062. }
  16063. libc.Xmemcpy(tls, buf+uintptr(i), bp, v20)
  16064. if libc.Uint64FromInt64(64) < len1-i {
  16065. v21 = libc.Uint64FromInt64(64)
  16066. } else {
  16067. v21 = len1 - i
  16068. }
  16069. i += v21
  16070. goto _1
  16071. _1:
  16072. }
  16073. Xexplicit_bzero(tls, bp+632, uint64(208))
  16074. Xexplicit_bzero(tls, bp, uint64(64))
  16075. if _gotdata(tls, buf, len1) == 0 {
  16076. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = save_errno
  16077. return 0 /* satisfied */
  16078. }
  16079. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EIO)
  16080. return -int32(1)
  16081. }
  16082. var _cnt int32
  16083. var _lastpid Tpid_t
  16084. func __ccgo_fp(f interface{}) uintptr {
  16085. type iface [2]uintptr
  16086. return (*iface)(unsafe.Pointer(&f))[1]
  16087. }
  16088. var Xoptreset int32
  16089. var __ccgo_ts = (*reflect.StringHeader)(unsafe.Pointer(&__ccgo_ts1)).Data
  16090. 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%ld%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"