ccgo_linux_s390x.go 503 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055
  1. // Code generated for linux/s390x 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/s390x -I /home/jnml/src/modernc.org/builder/.exclude/modernc.org/limd/include/linux/s390x -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 -ldl -lmd -mlong-double-64 -o .libs/libbsd.so.0.11.3.go', DO NOT EDIT.
  2. //go:build linux && s390x
  3. package libbsd
  4. import (
  5. "reflect"
  6. "unsafe"
  7. "modernc.org/libc"
  8. "modernc.org/libmd"
  9. )
  10. var _ reflect.Type
  11. var _ unsafe.Pointer
  12. const m_ARG_MAX = 131072
  13. const m_AT_EACCESS = 0x200
  14. const m_AT_EMPTY_PATH = 0x1000
  15. const m_AT_NO_AUTOMOUNT = 0x800
  16. const m_AT_RECURSIVE = 0x8000
  17. const m_AT_REMOVEDIR = 0x200
  18. const m_AT_STATX_DONT_SYNC = 0x4000
  19. const m_AT_STATX_FORCE_SYNC = 0x2000
  20. const m_AT_STATX_SYNC_AS_STAT = 0x0000
  21. const m_AT_STATX_SYNC_TYPE = 0x6000
  22. const m_AT_SYMLINK_FOLLOW = 0x400
  23. const m_AT_SYMLINK_NOFOLLOW = 0x100
  24. const m_BC_BASE_MAX = 99
  25. const m_BC_DIM_MAX = 2048
  26. const m_BC_SCALE_MAX = 99
  27. const m_BC_STRING_MAX = 1000
  28. const m_BIG_ENDIAN = "__BIG_ENDIAN"
  29. const m_BLOCKSZ = 64
  30. const m_BUFSIZ = 1024
  31. const m_BUS_ADRALN = 1
  32. const m_BUS_ADRERR = 2
  33. const m_BUS_MCEERR_AO = 5
  34. const m_BUS_MCEERR_AR = 4
  35. const m_BUS_OBJERR = 3
  36. const m_BYTE_ORDER = "__BYTE_ORDER"
  37. const m_CANBSIZ = 255
  38. const m_CHARCLASS_NAME_MAX = 14
  39. const m_CHAR_BIT = 8
  40. const m_CHAR_MAX = 255
  41. const m_CHAR_MIN = 0
  42. const m_CLD_CONTINUED = 6
  43. const m_CLD_DUMPED = 3
  44. const m_CLD_EXITED = 1
  45. const m_CLD_KILLED = 2
  46. const m_CLD_STOPPED = 5
  47. const m_CLD_TRAPPED = 4
  48. const m_CLOCKS_PER_SEC = 1000000
  49. const m_CLOCK_BOOTTIME = 7
  50. const m_CLOCK_BOOTTIME_ALARM = 9
  51. const m_CLOCK_MONOTONIC = 1
  52. const m_CLOCK_MONOTONIC_COARSE = 6
  53. const m_CLOCK_MONOTONIC_RAW = 4
  54. const m_CLOCK_PROCESS_CPUTIME_ID = 2
  55. const m_CLOCK_REALTIME = 0
  56. const m_CLOCK_REALTIME_ALARM = 8
  57. const m_CLOCK_REALTIME_COARSE = 5
  58. const m_CLOCK_SGI_CYCLE = 10
  59. const m_CLOCK_TAI = 11
  60. const m_CLOCK_THREAD_CPUTIME_ID = 3
  61. const m_CLONE_CHILD_CLEARTID = 0x00200000
  62. const m_CLONE_CHILD_SETTID = 0x01000000
  63. const m_CLONE_DETACHED = 0x00400000
  64. const m_CLONE_FILES = 0x00000400
  65. const m_CLONE_FS = 0x00000200
  66. const m_CLONE_IO = 0x80000000
  67. const m_CLONE_NEWCGROUP = 0x02000000
  68. const m_CLONE_NEWIPC = 0x08000000
  69. const m_CLONE_NEWNET = 0x40000000
  70. const m_CLONE_NEWNS = 0x00020000
  71. const m_CLONE_NEWPID = 0x20000000
  72. const m_CLONE_NEWTIME = 0x00000080
  73. const m_CLONE_NEWUSER = 0x10000000
  74. const m_CLONE_NEWUTS = 0x04000000
  75. const m_CLONE_PARENT = 0x00008000
  76. const m_CLONE_PARENT_SETTID = 0x00100000
  77. const m_CLONE_PIDFD = 0x00001000
  78. const m_CLONE_PTRACE = 0x00002000
  79. const m_CLONE_SETTLS = 0x00080000
  80. const m_CLONE_SIGHAND = 0x00000800
  81. const m_CLONE_SYSVSEM = 0x00040000
  82. const m_CLONE_THREAD = 0x00010000
  83. const m_CLONE_UNTRACED = 0x00800000
  84. const m_CLONE_VFORK = 0x00004000
  85. const m_CLONE_VM = 0x00000100
  86. const m_COLL_WEIGHTS_MAX = 2
  87. const m_CPU_SETSIZE = 1024
  88. const m_CSIGNAL = 0x000000ff
  89. const m_DELAYTIMER_MAX = 0x7fffffff
  90. const m_DEV_BSIZE = 512
  91. const m_DN_ACCESS = 0x00000001
  92. const m_DN_ATTRIB = 0x00000020
  93. const m_DN_CREATE = 0x00000004
  94. const m_DN_DELETE = 0x00000008
  95. const m_DN_MODIFY = 0x00000002
  96. const m_DN_MULTISHOT = 0x80000000
  97. const m_DN_RENAME = 0x00000010
  98. const m_EXIT_FAILURE = 1
  99. const m_EXIT_SUCCESS = 0
  100. const m_EXPR_NEST_MAX = 32
  101. const m_FALLOC_FL_KEEP_SIZE = 1
  102. const m_FALLOC_FL_PUNCH_HOLE = 2
  103. const m_FAPPEND = "O_APPEND"
  104. const m_FASYNC = "O_ASYNC"
  105. const m_FD_CLOEXEC = 1
  106. const m_FD_SETSIZE = 1024
  107. const m_FFSYNC = "O_SYNC"
  108. const m_FILENAME_MAX = 4096
  109. const m_FILESIZEBITS = 64
  110. const m_FNDELAY = "O_NDELAY"
  111. const m_FNONBLOCK = "O_NONBLOCK"
  112. const m_FOPEN_MAX = 1000
  113. const m_FPARSELN_UNESCALL = 0x0f
  114. const m_FPARSELN_UNESCCOMM = 0x04
  115. const m_FPARSELN_UNESCCONT = 0x02
  116. const m_FPARSELN_UNESCESC = 0x01
  117. const m_FPARSELN_UNESCREST = 0x08
  118. const m_FPE_FLTDIV = 3
  119. const m_FPE_FLTINV = 7
  120. const m_FPE_FLTOVF = 4
  121. const m_FPE_FLTRES = 6
  122. const m_FPE_FLTSUB = 8
  123. const m_FPE_FLTUND = 5
  124. const m_FPE_INTDIV = 1
  125. const m_FPE_INTOVF = 2
  126. const m_F_ADD_SEALS = 1033
  127. const m_F_CANCELLK = 1029
  128. const m_F_DUPFD = 0
  129. const m_F_DUPFD_CLOEXEC = 1030
  130. const m_F_GETFD = 1
  131. const m_F_GETFL = 3
  132. const m_F_GETLEASE = 1025
  133. const m_F_GETLK = 5
  134. const m_F_GETOWN = 9
  135. const m_F_GETOWNER_UIDS = 17
  136. const m_F_GETOWN_EX = 16
  137. const m_F_GETPIPE_SZ = 1032
  138. const m_F_GETSIG = 11
  139. const m_F_GET_FILE_RW_HINT = 1037
  140. const m_F_GET_RW_HINT = 1035
  141. const m_F_GET_SEALS = 1034
  142. const m_F_LOCK = 1
  143. const m_F_NOTIFY = 1026
  144. const m_F_OFD_GETLK = 36
  145. const m_F_OFD_SETLK = 37
  146. const m_F_OFD_SETLKW = 38
  147. const m_F_OK = 0
  148. const m_F_OWNER_GID = 2
  149. const m_F_OWNER_PGRP = 2
  150. const m_F_OWNER_PID = 1
  151. const m_F_OWNER_TID = 0
  152. const m_F_RDLCK = 0
  153. const m_F_SEAL_FUTURE_WRITE = 0x0010
  154. const m_F_SEAL_GROW = 0x0004
  155. const m_F_SEAL_SEAL = 0x0001
  156. const m_F_SEAL_SHRINK = 0x0002
  157. const m_F_SEAL_WRITE = 0x0008
  158. const m_F_SETFD = 2
  159. const m_F_SETFL = 4
  160. const m_F_SETLEASE = 1024
  161. const m_F_SETLK = 6
  162. const m_F_SETLKW = 7
  163. const m_F_SETOWN = 8
  164. const m_F_SETOWN_EX = 15
  165. const m_F_SETPIPE_SZ = 1031
  166. const m_F_SETSIG = 10
  167. const m_F_SET_FILE_RW_HINT = 1038
  168. const m_F_SET_RW_HINT = 1036
  169. const m_F_TEST = 3
  170. const m_F_TLOCK = 2
  171. const m_F_ULOCK = 0
  172. const m_F_UNLCK = 2
  173. const m_F_WRLCK = 1
  174. const m_HAVE_CLEARENV = 1
  175. const m_HAVE_CONFIG_H = 1
  176. const m_HAVE_DIRENT_H = 1
  177. const m_HAVE_DIRFD = 1
  178. const m_HAVE_DLFCN_H = 1
  179. const m_HAVE_FOPENCOOKIE = 1
  180. const m_HAVE_GETAUXVAL = 1
  181. const m_HAVE_GETENTROPY = 1
  182. const m_HAVE_GETLINE = 1
  183. const m_HAVE_GRP_H = 1
  184. const m_HAVE_INTTYPES_H = 1
  185. const m_HAVE_MEMORY_H = 1
  186. const m_HAVE_PROGRAM_INVOCATION_SHORT_NAME = 1
  187. const m_HAVE_PWD_H = 1
  188. const m_HAVE_STDINT_H = 1
  189. const m_HAVE_STDLIB_H = 1
  190. const m_HAVE_STRINGS_H = 1
  191. const m_HAVE_STRING_H = 1
  192. const m_HAVE_SYSCONF = 1
  193. const m_HAVE_SYS_DIR_H = 1
  194. const m_HAVE_SYS_STAT_H = 1
  195. const m_HAVE_SYS_TYPES_H = 1
  196. const m_HAVE_TYPEOF = 1
  197. const m_HAVE_UNISTD_H = 1
  198. const m_HAVE___FPURGE = 1
  199. const m_HAVE___PROGNAME = 1
  200. const m_HN_AUTOSCALE = 0x20
  201. const m_HN_B = 0x04
  202. const m_HN_DECIMAL = 0x01
  203. const m_HN_DIVISOR_1000 = 0x08
  204. const m_HN_GETSCALE = 0x10
  205. const m_HN_IEC_PREFIXES = 0x10
  206. const m_HN_NOSPACE = 0x02
  207. const m_HOST_NAME_MAX = 255
  208. const m_ILL_BADSTK = 8
  209. const m_ILL_COPROC = 7
  210. const m_ILL_ILLADR = 3
  211. const m_ILL_ILLOPC = 1
  212. const m_ILL_ILLOPN = 2
  213. const m_ILL_ILLTRP = 4
  214. const m_ILL_PRVOPC = 5
  215. const m_ILL_PRVREG = 6
  216. const m_INT16_MAX = 0x7fff
  217. const m_INT32_MAX = 0x7fffffff
  218. const m_INT64_MAX = 0x7fffffffffffffff
  219. const m_INT8_MAX = 0x7f
  220. const m_INTMAX_MAX = "INT64_MAX"
  221. const m_INTMAX_MIN = "INT64_MIN"
  222. const m_INTPTR_MAX = "INT64_MAX"
  223. const m_INTPTR_MIN = "INT64_MIN"
  224. const m_INT_FAST16_MAX = "INT32_MAX"
  225. const m_INT_FAST16_MIN = "INT32_MIN"
  226. const m_INT_FAST32_MAX = "INT32_MAX"
  227. const m_INT_FAST32_MIN = "INT32_MIN"
  228. const m_INT_FAST64_MAX = "INT64_MAX"
  229. const m_INT_FAST64_MIN = "INT64_MIN"
  230. const m_INT_FAST8_MAX = "INT8_MAX"
  231. const m_INT_FAST8_MIN = "INT8_MIN"
  232. const m_INT_LEAST16_MAX = "INT16_MAX"
  233. const m_INT_LEAST16_MIN = "INT16_MIN"
  234. const m_INT_LEAST32_MAX = "INT32_MAX"
  235. const m_INT_LEAST32_MIN = "INT32_MIN"
  236. const m_INT_LEAST64_MAX = "INT64_MAX"
  237. const m_INT_LEAST64_MIN = "INT64_MIN"
  238. const m_INT_LEAST8_MAX = "INT8_MAX"
  239. const m_INT_LEAST8_MIN = "INT8_MIN"
  240. const m_INT_MAX = 0x7fffffff
  241. const m_IOV_MAX = 1024
  242. const m_ITIMER_PROF = 2
  243. const m_ITIMER_REAL = 0
  244. const m_ITIMER_VIRTUAL = 1
  245. const m_IVSZ = 8
  246. const m_KEYSZ = 32
  247. const m_LIBBSD_DISABLE_DEPRECATED = 1
  248. const m_LIBBSD_OVERLAY = 1
  249. const m_LINE_MAX = 4096
  250. const m_LITTLE_ENDIAN = "__LITTLE_ENDIAN"
  251. const m_LLONG_MAX = 0x7fffffffffffffff
  252. const m_LOGIN_NAME_MAX = 256
  253. const m_LONG_BIT = 64
  254. const m_LONG_MAX = "__LONG_MAX"
  255. const m_LT_OBJDIR = ".libs/"
  256. const m_L_INCR = 1
  257. const m_L_SET = 0
  258. const m_L_XTND = 2
  259. const m_L_ctermid = 20
  260. const m_L_cuserid = 20
  261. const m_L_tmpnam = 20
  262. const m_MADV_COLD = 20
  263. const m_MADV_DODUMP = 17
  264. const m_MADV_DOFORK = 11
  265. const m_MADV_DONTDUMP = 16
  266. const m_MADV_DONTFORK = 10
  267. const m_MADV_DONTNEED = 4
  268. const m_MADV_FREE = 8
  269. const m_MADV_HUGEPAGE = 14
  270. const m_MADV_HWPOISON = 100
  271. const m_MADV_KEEPONFORK = 19
  272. const m_MADV_MERGEABLE = 12
  273. const m_MADV_NOHUGEPAGE = 15
  274. const m_MADV_NORMAL = 0
  275. const m_MADV_PAGEOUT = 21
  276. const m_MADV_RANDOM = 1
  277. const m_MADV_REMOVE = 9
  278. const m_MADV_SEQUENTIAL = 2
  279. const m_MADV_SOFT_OFFLINE = 101
  280. const m_MADV_UNMERGEABLE = 13
  281. const m_MADV_WILLNEED = 3
  282. const m_MADV_WIPEONFORK = 18
  283. const m_MAP_ANON = 32
  284. const m_MAP_ANONYMOUS = "MAP_ANON"
  285. const m_MAP_DENYWRITE = 0x0800
  286. const m_MAP_EXECUTABLE = 0x1000
  287. const m_MAP_FILE = 0
  288. const m_MAP_FIXED = 0x10
  289. const m_MAP_FIXED_NOREPLACE = 0x100000
  290. const m_MAP_GROWSDOWN = 0x0100
  291. const m_MAP_HUGETLB = 0x40000
  292. const m_MAP_HUGE_MASK = 0x3f
  293. const m_MAP_HUGE_SHIFT = 26
  294. const m_MAP_LOCKED = 0x2000
  295. const m_MAP_NONBLOCK = 0x10000
  296. const m_MAP_NORESERVE = 0x4000
  297. const m_MAP_POPULATE = 0x8000
  298. const m_MAP_PRIVATE = 2
  299. const m_MAP_SHARED = 0x01
  300. const m_MAP_SHARED_VALIDATE = 0x03
  301. const m_MAP_STACK = 0x20000
  302. const m_MAP_SYNC = 0x80000
  303. const m_MAP_TYPE = 0x0f
  304. const m_MAXHOSTNAMELEN = 64
  305. const m_MAXNAMLEN = 255
  306. const m_MAXPATHLEN = 4096
  307. const m_MAXSYMLINKS = 20
  308. const m_MAX_HANDLE_SZ = 128
  309. const m_MB_LEN_MAX = 4
  310. const m_MCL_CURRENT = 1
  311. const m_MCL_FUTURE = 2
  312. const m_MCL_ONFAULT = 4
  313. const m_MFD_ALLOW_SEALING = 0x0002
  314. const m_MFD_CLOEXEC = 0x0001
  315. const m_MFD_HUGETLB = 0x0004
  316. const m_MINSIGSTKSZ = 4096
  317. const m_MLOCK_ONFAULT = 0x01
  318. const m_MQ_PRIO_MAX = 32768
  319. const m_MREMAP_DONTUNMAP = 4
  320. const m_MREMAP_FIXED = 2
  321. const m_MREMAP_MAYMOVE = 1
  322. const m_MS_ASYNC = 1
  323. const m_MS_INVALIDATE = 2
  324. const m_MS_SYNC = 4
  325. const m_NAME_MAX = 255
  326. const m_NBBY = 8
  327. const m_NCARGS = 131072
  328. const m_NDEBUG = 1
  329. const m_NGROUPS = 32
  330. const m_NGROUPS_MAX = 32
  331. const m_NL_ARGMAX = 9
  332. const m_NL_LANGMAX = 32
  333. const m_NL_MSGMAX = 32767
  334. const m_NL_NMAX = 16
  335. const m_NL_SETMAX = 255
  336. const m_NL_TEXTMAX = 2048
  337. const m_NOFILE = 256
  338. const m_NSIG = "_NSIG"
  339. const m_NZERO = 20
  340. const m_O_APPEND = 02000
  341. const m_O_ASYNC = 020000
  342. const m_O_CLOEXEC = 02000000
  343. const m_O_CREAT = 0100
  344. const m_O_DIRECT = 040000
  345. const m_O_DIRECTORY = 0200000
  346. const m_O_DSYNC = 010000
  347. const m_O_EXCL = 0200
  348. const m_O_EXEC = "O_PATH"
  349. const m_O_LARGEFILE = 0100000
  350. const m_O_NDELAY = "O_NONBLOCK"
  351. const m_O_NOATIME = 01000000
  352. const m_O_NOCTTY = 0400
  353. const m_O_NOFOLLOW = 0400000
  354. const m_O_NONBLOCK = 04000
  355. const m_O_PATH = 010000000
  356. const m_O_RDONLY = 00
  357. const m_O_RDWR = 02
  358. const m_O_RSYNC = 04010000
  359. const m_O_SEARCH = "O_PATH"
  360. const m_O_SYNC = 04010000
  361. const m_O_TMPFILE = 020200000
  362. const m_O_TRUNC = 01000
  363. const m_O_TTY_INIT = 0
  364. const m_O_WRONLY = 01
  365. const m_PACKAGE = "libbsd"
  366. const m_PACKAGE_BUGREPORT = "libbsd@lists.freedesktop.org"
  367. const m_PACKAGE_NAME = "libbsd"
  368. const m_PACKAGE_STRING = "libbsd 0.11.3"
  369. const m_PACKAGE_TARNAME = "libbsd"
  370. const m_PACKAGE_URL = ""
  371. const m_PACKAGE_VERSION = "0.11.3"
  372. const m_PAGESIZE = 4096
  373. const m_PAGE_SIZE = "PAGESIZE"
  374. const m_PATH_MAX = 4096
  375. const m_PDP_ENDIAN = "__PDP_ENDIAN"
  376. const m_PIC = 1
  377. const m_PIPE_BUF = 4096
  378. const m_POLL_ERR = 4
  379. const m_POLL_HUP = 6
  380. const m_POLL_IN = 1
  381. const m_POLL_MSG = 3
  382. const m_POLL_OUT = 2
  383. const m_POLL_PRI = 5
  384. const m_POSIX_CLOSE_RESTART = 0
  385. const m_POSIX_FADV_DONTNEED = 6
  386. const m_POSIX_FADV_NOREUSE = 7
  387. const m_POSIX_FADV_NORMAL = 0
  388. const m_POSIX_FADV_RANDOM = 1
  389. const m_POSIX_FADV_SEQUENTIAL = 2
  390. const m_POSIX_FADV_WILLNEED = 3
  391. const m_POSIX_MADV_DONTNEED = 4
  392. const m_POSIX_MADV_NORMAL = 0
  393. const m_POSIX_MADV_RANDOM = 1
  394. const m_POSIX_MADV_SEQUENTIAL = 2
  395. const m_POSIX_MADV_WILLNEED = 3
  396. const m_PRIO_MAX = 20
  397. const m_PRIO_PGRP = 1
  398. const m_PRIO_PROCESS = 0
  399. const m_PRIO_USER = 2
  400. const m_PROT_EXEC = 4
  401. const m_PROT_GROWSDOWN = 0x01000000
  402. const m_PROT_GROWSUP = 0x02000000
  403. const m_PROT_NONE = 0
  404. const m_PROT_READ = 1
  405. const m_PROT_WRITE = 2
  406. const m_PTHREAD_CANCEL_ASYNCHRONOUS = 1
  407. const m_PTHREAD_CANCEL_DEFERRED = 0
  408. const m_PTHREAD_CANCEL_DISABLE = 1
  409. const m_PTHREAD_CANCEL_ENABLE = 0
  410. const m_PTHREAD_CANCEL_MASKED = 2
  411. const m_PTHREAD_CREATE_DETACHED = 1
  412. const m_PTHREAD_CREATE_JOINABLE = 0
  413. const m_PTHREAD_DESTRUCTOR_ITERATIONS = 4
  414. const m_PTHREAD_EXPLICIT_SCHED = 1
  415. const m_PTHREAD_INHERIT_SCHED = 0
  416. const m_PTHREAD_KEYS_MAX = 128
  417. const m_PTHREAD_MUTEX_DEFAULT = 0
  418. const m_PTHREAD_MUTEX_ERRORCHECK = 2
  419. const m_PTHREAD_MUTEX_NORMAL = 0
  420. const m_PTHREAD_MUTEX_RECURSIVE = 1
  421. const m_PTHREAD_MUTEX_ROBUST = 1
  422. const m_PTHREAD_MUTEX_STALLED = 0
  423. const m_PTHREAD_ONCE_INIT = 0
  424. const m_PTHREAD_PRIO_INHERIT = 1
  425. const m_PTHREAD_PRIO_NONE = 0
  426. const m_PTHREAD_PRIO_PROTECT = 2
  427. const m_PTHREAD_PROCESS_PRIVATE = 0
  428. const m_PTHREAD_PROCESS_SHARED = 1
  429. const m_PTHREAD_SCOPE_PROCESS = 1
  430. const m_PTHREAD_SCOPE_SYSTEM = 0
  431. const m_PTHREAD_STACK_MIN = 2048
  432. const m_PTRDIFF_MAX = "INT64_MAX"
  433. const m_PTRDIFF_MIN = "INT64_MIN"
  434. const m_P_tmpdir = "/tmp"
  435. const m_RAND_MAX = 0x7fffffff
  436. const m_RE_DUP_MAX = 255
  437. const m_RLIMIT_AS = 9
  438. const m_RLIMIT_CORE = 4
  439. const m_RLIMIT_CPU = 0
  440. const m_RLIMIT_DATA = 2
  441. const m_RLIMIT_FSIZE = 1
  442. const m_RLIMIT_LOCKS = 10
  443. const m_RLIMIT_MEMLOCK = 8
  444. const m_RLIMIT_MSGQUEUE = 12
  445. const m_RLIMIT_NICE = 13
  446. const m_RLIMIT_NLIMITS = 16
  447. const m_RLIMIT_NOFILE = 7
  448. const m_RLIMIT_NPROC = 6
  449. const m_RLIMIT_RSS = 5
  450. const m_RLIMIT_RTPRIO = 14
  451. const m_RLIMIT_RTTIME = 15
  452. const m_RLIMIT_SIGPENDING = 11
  453. const m_RLIMIT_STACK = 3
  454. const m_RLIM_NLIMITS = "RLIMIT_NLIMITS"
  455. const m_RLIM_SAVED_CUR = "RLIM_INFINITY"
  456. const m_RLIM_SAVED_MAX = "RLIM_INFINITY"
  457. const m_RUSAGE_SELF = 0
  458. const m_RUSAGE_THREAD = 1
  459. const m_RWF_WRITE_LIFE_NOT_SET = 0
  460. const m_RWH_WRITE_LIFE_EXTREME = 5
  461. const m_RWH_WRITE_LIFE_LONG = 4
  462. const m_RWH_WRITE_LIFE_MEDIUM = 3
  463. const m_RWH_WRITE_LIFE_NONE = 1
  464. const m_RWH_WRITE_LIFE_SHORT = 2
  465. const m_R_OK = 4
  466. const m_SA_EXPOSE_TAGBITS = 0x00000800
  467. const m_SA_NOCLDSTOP = 1
  468. const m_SA_NOCLDWAIT = 2
  469. const m_SA_NODEFER = 0x40000000
  470. const m_SA_NOMASK = "SA_NODEFER"
  471. const m_SA_ONESHOT = "SA_RESETHAND"
  472. const m_SA_ONSTACK = 0x08000000
  473. const m_SA_RESETHAND = 0x80000000
  474. const m_SA_RESTART = 0x10000000
  475. const m_SA_RESTORER = 0x04000000
  476. const m_SA_SIGINFO = 4
  477. const m_SA_UNSUPPORTED = 0x00000400
  478. const m_SCHAR_MAX = 127
  479. const m_SCHED_BATCH = 3
  480. const m_SCHED_DEADLINE = 6
  481. const m_SCHED_FIFO = 1
  482. const m_SCHED_IDLE = 5
  483. const m_SCHED_OTHER = 0
  484. const m_SCHED_RESET_ON_FORK = 0x40000000
  485. const m_SCHED_RR = 2
  486. const m_SEEK_DATA = 3
  487. const m_SEEK_HOLE = 4
  488. const m_SEGV_ACCERR = 2
  489. const m_SEGV_BNDERR = 3
  490. const m_SEGV_MAPERR = 1
  491. const m_SEGV_MTEAERR = 8
  492. const m_SEGV_MTESERR = 9
  493. const m_SEGV_PKUERR = 4
  494. const m_SEM_NSEMS_MAX = 256
  495. const m_SEM_VALUE_MAX = 0x7fffffff
  496. const m_SHRT_MAX = 0x7fff
  497. const m_SIGABRT = 6
  498. const m_SIGALRM = 14
  499. const m_SIGBUS = 7
  500. const m_SIGCHLD = 17
  501. const m_SIGCONT = 18
  502. const m_SIGEV_NONE = 1
  503. const m_SIGEV_SIGNAL = 0
  504. const m_SIGEV_THREAD = 2
  505. const m_SIGEV_THREAD_ID = 4
  506. const m_SIGFPE = 8
  507. const m_SIGHUP = 1
  508. const m_SIGILL = 4
  509. const m_SIGINT = 2
  510. const m_SIGIO = 29
  511. const m_SIGIOT = "SIGABRT"
  512. const m_SIGKILL = 9
  513. const m_SIGPIPE = 13
  514. const m_SIGPOLL = "SIGIO"
  515. const m_SIGPROF = 27
  516. const m_SIGPWR = 30
  517. const m_SIGQUIT = 3
  518. const m_SIGSEGV = 11
  519. const m_SIGSTKFLT = 16
  520. const m_SIGSTKSZ = 10240
  521. const m_SIGSTOP = 19
  522. const m_SIGSYS = 31
  523. const m_SIGTERM = 15
  524. const m_SIGTRAP = 5
  525. const m_SIGTSTP = 20
  526. const m_SIGTTIN = 21
  527. const m_SIGTTOU = 22
  528. const m_SIGUNUSED = "SIGSYS"
  529. const m_SIGURG = 23
  530. const m_SIGUSR1 = 10
  531. const m_SIGUSR2 = 12
  532. const m_SIGVTALRM = 26
  533. const m_SIGWINCH = 28
  534. const m_SIGXCPU = 24
  535. const m_SIGXFSZ = 25
  536. const m_SIG_ATOMIC_MAX = "INT32_MAX"
  537. const m_SIG_ATOMIC_MIN = "INT32_MIN"
  538. const m_SIG_BLOCK = 0
  539. const m_SIG_SETMASK = 2
  540. const m_SIG_UNBLOCK = 1
  541. const m_SIZE_MAX = "UINT64_MAX"
  542. const m_SI_KERNEL = 128
  543. const m_SI_USER = 0
  544. const m_SPLICE_F_GIFT = 8
  545. const m_SPLICE_F_MORE = 4
  546. const m_SPLICE_F_MOVE = 1
  547. const m_SPLICE_F_NONBLOCK = 2
  548. const m_SSIZE_MAX = "LONG_MAX"
  549. const m_SS_DISABLE = 2
  550. const m_SS_FLAG_BITS = "SS_AUTODISARM"
  551. const m_SS_ONSTACK = 1
  552. const m_STATX_ALL = 0xfff
  553. const m_STATX_ATIME = 0x20
  554. const m_STATX_BASIC_STATS = 0x7ff
  555. const m_STATX_BLOCKS = 0x400
  556. const m_STATX_BTIME = 0x800
  557. const m_STATX_CTIME = 0x80
  558. const m_STATX_GID = 0x10
  559. const m_STATX_INO = 0x100
  560. const m_STATX_MODE = 2
  561. const m_STATX_MTIME = 0x40
  562. const m_STATX_NLINK = 4
  563. const m_STATX_SIZE = 0x200
  564. const m_STATX_TYPE = 1
  565. const m_STATX_UID = 8
  566. const m_STDC_HEADERS = 1
  567. const m_STDERR_FILENO = 2
  568. const m_STDIN_FILENO = 0
  569. const m_STDOUT_FILENO = 1
  570. const m_SYMLOOP_MAX = 40
  571. const m_SYNC_FILE_RANGE_WAIT_AFTER = 4
  572. const m_SYNC_FILE_RANGE_WAIT_BEFORE = 1
  573. const m_SYNC_FILE_RANGE_WRITE = 2
  574. const m_SYS_SECCOMP = 1
  575. const m_SYS_USER_DISPATCH = 2
  576. const m_S_IEXEC = "S_IXUSR"
  577. const m_S_IFBLK = 0060000
  578. const m_S_IFCHR = 0020000
  579. const m_S_IFDIR = 0040000
  580. const m_S_IFIFO = 0010000
  581. const m_S_IFLNK = 0120000
  582. const m_S_IFMT = 0170000
  583. const m_S_IFREG = 0100000
  584. const m_S_IFSOCK = 0140000
  585. const m_S_IREAD = "S_IRUSR"
  586. const m_S_IRGRP = 0040
  587. const m_S_IROTH = 0004
  588. const m_S_IRUSR = 0400
  589. const m_S_IRWXG = 0070
  590. const m_S_IRWXO = 0007
  591. const m_S_IRWXU = 0700
  592. const m_S_ISGID = 02000
  593. const m_S_ISTXT = "S_ISVTX"
  594. const m_S_ISUID = 04000
  595. const m_S_ISVTX = 01000
  596. const m_S_IWGRP = 0020
  597. const m_S_IWOTH = 0002
  598. const m_S_IWRITE = "S_IWUSR"
  599. const m_S_IWUSR = 0200
  600. const m_S_IXGRP = 0010
  601. const m_S_IXOTH = 0001
  602. const m_S_IXUSR = 0100
  603. const m_TIMER_ABSTIME = 1
  604. const m_TIME_UTC = 1
  605. const m_TMP_MAX = 10000
  606. const m_TRAP_BRANCH = 3
  607. const m_TRAP_BRKPT = 1
  608. const m_TRAP_HWBKPT = 4
  609. const m_TRAP_TRACE = 2
  610. const m_TRAP_UNK = 5
  611. const m_TTY_NAME_MAX = 32
  612. const m_TZNAME_MAX = 6
  613. const m_UCHAR_MAX = 255
  614. const m_UINT16_MAX = 0xffff
  615. const m_UINT32_MAX = "0xffffffffu"
  616. const m_UINT64_MAX = "0xffffffffffffffffu"
  617. const m_UINT8_MAX = 0xff
  618. const m_UINTMAX_MAX = "UINT64_MAX"
  619. const m_UINTPTR_MAX = "UINT64_MAX"
  620. const m_UINT_FAST16_MAX = "UINT32_MAX"
  621. const m_UINT_FAST32_MAX = "UINT32_MAX"
  622. const m_UINT_FAST64_MAX = "UINT64_MAX"
  623. const m_UINT_FAST8_MAX = "UINT8_MAX"
  624. const m_UINT_LEAST16_MAX = "UINT16_MAX"
  625. const m_UINT_LEAST32_MAX = "UINT32_MAX"
  626. const m_UINT_LEAST64_MAX = "UINT64_MAX"
  627. const m_UINT_LEAST8_MAX = "UINT8_MAX"
  628. const m_UINT_MAX = 0xffffffff
  629. const m_USHRT_MAX = 0xffff
  630. const m_UTIME_NOW = 0x3fffffff
  631. const m_UTIME_OMIT = 0x3ffffffe
  632. const m_VERSION = "0.11.3"
  633. const m_WINT_MAX = "UINT32_MAX"
  634. const m_WINT_MIN = 0
  635. const m_WNOHANG = 1
  636. const m_WORD_BIT = 32
  637. const m_WUNTRACED = 2
  638. const m_W_OK = 2
  639. const m_X_OK = 1
  640. const m__ALL_SOURCE = 1
  641. const m__CS_GNU_LIBC_VERSION = 2
  642. const m__CS_GNU_LIBPTHREAD_VERSION = 3
  643. const m__CS_PATH = 0
  644. const m__CS_POSIX_V5_WIDTH_RESTRICTED_ENVS = 4
  645. const m__CS_POSIX_V6_ILP32_OFF32_CFLAGS = 1116
  646. const m__CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 1117
  647. const m__CS_POSIX_V6_ILP32_OFF32_LIBS = 1118
  648. const m__CS_POSIX_V6_ILP32_OFF32_LINTFLAGS = 1119
  649. const m__CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 1120
  650. const m__CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 1121
  651. const m__CS_POSIX_V6_ILP32_OFFBIG_LIBS = 1122
  652. const m__CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS = 1123
  653. const m__CS_POSIX_V6_LP64_OFF64_CFLAGS = 1124
  654. const m__CS_POSIX_V6_LP64_OFF64_LDFLAGS = 1125
  655. const m__CS_POSIX_V6_LP64_OFF64_LIBS = 1126
  656. const m__CS_POSIX_V6_LP64_OFF64_LINTFLAGS = 1127
  657. const m__CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 1128
  658. const m__CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 1129
  659. const m__CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 1130
  660. const m__CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS = 1131
  661. const m__CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 1
  662. const m__CS_POSIX_V7_ILP32_OFF32_CFLAGS = 1132
  663. const m__CS_POSIX_V7_ILP32_OFF32_LDFLAGS = 1133
  664. const m__CS_POSIX_V7_ILP32_OFF32_LIBS = 1134
  665. const m__CS_POSIX_V7_ILP32_OFF32_LINTFLAGS = 1135
  666. const m__CS_POSIX_V7_ILP32_OFFBIG_CFLAGS = 1136
  667. const m__CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS = 1137
  668. const m__CS_POSIX_V7_ILP32_OFFBIG_LIBS = 1138
  669. const m__CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS = 1139
  670. const m__CS_POSIX_V7_LP64_OFF64_CFLAGS = 1140
  671. const m__CS_POSIX_V7_LP64_OFF64_LDFLAGS = 1141
  672. const m__CS_POSIX_V7_LP64_OFF64_LIBS = 1142
  673. const m__CS_POSIX_V7_LP64_OFF64_LINTFLAGS = 1143
  674. const m__CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS = 1144
  675. const m__CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS = 1145
  676. const m__CS_POSIX_V7_LPBIG_OFFBIG_LIBS = 1146
  677. const m__CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS = 1147
  678. const m__CS_POSIX_V7_THREADS_CFLAGS = 1150
  679. const m__CS_POSIX_V7_THREADS_LDFLAGS = 1151
  680. const m__CS_POSIX_V7_WIDTH_RESTRICTED_ENVS = 5
  681. const m__CS_V6_ENV = 1148
  682. const m__CS_V7_ENV = 1149
  683. const m__DARWIN_USE_64_BIT_INODE = 1
  684. const m__GNU_SOURCE = 1
  685. const m__IOFBF = 0
  686. const m__IOLBF = 1
  687. const m__IONBF = 2
  688. const m__LP64 = 1
  689. const m__NSIG = 65
  690. const m__PC_2_SYMLINKS = 20
  691. const m__PC_ALLOC_SIZE_MIN = 18
  692. const m__PC_ASYNC_IO = 10
  693. const m__PC_CHOWN_RESTRICTED = 6
  694. const m__PC_FILESIZEBITS = 13
  695. const m__PC_LINK_MAX = 0
  696. const m__PC_MAX_CANON = 1
  697. const m__PC_MAX_INPUT = 2
  698. const m__PC_NAME_MAX = 3
  699. const m__PC_NO_TRUNC = 7
  700. const m__PC_PATH_MAX = 4
  701. const m__PC_PIPE_BUF = 5
  702. const m__PC_PRIO_IO = 11
  703. const m__PC_REC_INCR_XFER_SIZE = 14
  704. const m__PC_REC_MAX_XFER_SIZE = 15
  705. const m__PC_REC_MIN_XFER_SIZE = 16
  706. const m__PC_REC_XFER_ALIGN = 17
  707. const m__PC_SOCK_MAXBUF = 12
  708. const m__PC_SYMLINK_MAX = 19
  709. const m__PC_SYNC_IO = 9
  710. const m__PC_VDISABLE = 8
  711. const m__POSIX2_BC_BASE_MAX = 99
  712. const m__POSIX2_BC_DIM_MAX = 2048
  713. const m__POSIX2_BC_SCALE_MAX = 99
  714. const m__POSIX2_BC_STRING_MAX = 1000
  715. const m__POSIX2_CHARCLASS_NAME_MAX = 14
  716. const m__POSIX2_COLL_WEIGHTS_MAX = 2
  717. const m__POSIX2_C_BIND = "_POSIX_VERSION"
  718. const m__POSIX2_EXPR_NEST_MAX = 32
  719. const m__POSIX2_LINE_MAX = 2048
  720. const m__POSIX2_RE_DUP_MAX = 255
  721. const m__POSIX2_VERSION = "_POSIX_VERSION"
  722. const m__POSIX_ADVISORY_INFO = "_POSIX_VERSION"
  723. const m__POSIX_AIO_LISTIO_MAX = 2
  724. const m__POSIX_AIO_MAX = 1
  725. const m__POSIX_ARG_MAX = 4096
  726. const m__POSIX_ASYNCHRONOUS_IO = "_POSIX_VERSION"
  727. const m__POSIX_BARRIERS = "_POSIX_VERSION"
  728. const m__POSIX_CHILD_MAX = 25
  729. const m__POSIX_CHOWN_RESTRICTED = 1
  730. const m__POSIX_CLOCKRES_MIN = 20000000
  731. const m__POSIX_CLOCK_SELECTION = "_POSIX_VERSION"
  732. const m__POSIX_CPUTIME = "_POSIX_VERSION"
  733. const m__POSIX_DELAYTIMER_MAX = 32
  734. const m__POSIX_FSYNC = "_POSIX_VERSION"
  735. const m__POSIX_HOST_NAME_MAX = 255
  736. const m__POSIX_IPV6 = "_POSIX_VERSION"
  737. const m__POSIX_JOB_CONTROL = 1
  738. const m__POSIX_LINK_MAX = 8
  739. const m__POSIX_LOGIN_NAME_MAX = 9
  740. const m__POSIX_MAPPED_FILES = "_POSIX_VERSION"
  741. const m__POSIX_MAX_CANON = 255
  742. const m__POSIX_MAX_INPUT = 255
  743. const m__POSIX_MEMLOCK = "_POSIX_VERSION"
  744. const m__POSIX_MEMLOCK_RANGE = "_POSIX_VERSION"
  745. const m__POSIX_MEMORY_PROTECTION = "_POSIX_VERSION"
  746. const m__POSIX_MESSAGE_PASSING = "_POSIX_VERSION"
  747. const m__POSIX_MONOTONIC_CLOCK = "_POSIX_VERSION"
  748. const m__POSIX_MQ_OPEN_MAX = 8
  749. const m__POSIX_MQ_PRIO_MAX = 32
  750. const m__POSIX_NAME_MAX = 14
  751. const m__POSIX_NGROUPS_MAX = 8
  752. const m__POSIX_NO_TRUNC = 1
  753. const m__POSIX_OPEN_MAX = 20
  754. const m__POSIX_PATH_MAX = 256
  755. const m__POSIX_PIPE_BUF = 512
  756. const m__POSIX_PTHREAD_SEMANTICS = 1
  757. const m__POSIX_RAW_SOCKETS = "_POSIX_VERSION"
  758. const m__POSIX_READER_WRITER_LOCKS = "_POSIX_VERSION"
  759. const m__POSIX_REALTIME_SIGNALS = "_POSIX_VERSION"
  760. const m__POSIX_REGEXP = 1
  761. const m__POSIX_RE_DUP_MAX = 255
  762. const m__POSIX_RTSIG_MAX = 8
  763. const m__POSIX_SAVED_IDS = 1
  764. const m__POSIX_SEMAPHORES = "_POSIX_VERSION"
  765. const m__POSIX_SEM_NSEMS_MAX = 256
  766. const m__POSIX_SEM_VALUE_MAX = 32767
  767. const m__POSIX_SHARED_MEMORY_OBJECTS = "_POSIX_VERSION"
  768. const m__POSIX_SHELL = 1
  769. const m__POSIX_SIGQUEUE_MAX = 32
  770. const m__POSIX_SPAWN = "_POSIX_VERSION"
  771. const m__POSIX_SPIN_LOCKS = "_POSIX_VERSION"
  772. const m__POSIX_SSIZE_MAX = 32767
  773. const m__POSIX_SS_REPL_MAX = 4
  774. const m__POSIX_STREAM_MAX = 8
  775. const m__POSIX_SYMLINK_MAX = 255
  776. const m__POSIX_SYMLOOP_MAX = 8
  777. const m__POSIX_THREADS = "_POSIX_VERSION"
  778. const m__POSIX_THREAD_ATTR_STACKADDR = "_POSIX_VERSION"
  779. const m__POSIX_THREAD_ATTR_STACKSIZE = "_POSIX_VERSION"
  780. const m__POSIX_THREAD_CPUTIME = "_POSIX_VERSION"
  781. const m__POSIX_THREAD_DESTRUCTOR_ITERATIONS = 4
  782. const m__POSIX_THREAD_KEYS_MAX = 128
  783. const m__POSIX_THREAD_PRIORITY_SCHEDULING = "_POSIX_VERSION"
  784. const m__POSIX_THREAD_PROCESS_SHARED = "_POSIX_VERSION"
  785. const m__POSIX_THREAD_SAFE_FUNCTIONS = "_POSIX_VERSION"
  786. const m__POSIX_THREAD_THREADS_MAX = 64
  787. const m__POSIX_TIMEOUTS = "_POSIX_VERSION"
  788. const m__POSIX_TIMERS = "_POSIX_VERSION"
  789. const m__POSIX_TIMER_MAX = 32
  790. const m__POSIX_TRACE_EVENT_NAME_MAX = 30
  791. const m__POSIX_TRACE_NAME_MAX = 8
  792. const m__POSIX_TRACE_SYS_MAX = 8
  793. const m__POSIX_TRACE_USER_EVENT_MAX = 32
  794. const m__POSIX_TTY_NAME_MAX = 9
  795. const m__POSIX_TZNAME_MAX = 6
  796. const m__POSIX_V6_LP64_OFF64 = 1
  797. const m__POSIX_V7_LP64_OFF64 = 1
  798. const m__POSIX_VDISABLE = 0
  799. const m__POSIX_VERSION = 200809
  800. const m__SC_2_CHAR_TERM = 95
  801. const m__SC_2_C_BIND = 47
  802. const m__SC_2_C_DEV = 48
  803. const m__SC_2_FORT_DEV = 49
  804. const m__SC_2_FORT_RUN = 50
  805. const m__SC_2_LOCALEDEF = 52
  806. const m__SC_2_PBS = 168
  807. const m__SC_2_PBS_ACCOUNTING = 169
  808. const m__SC_2_PBS_CHECKPOINT = 175
  809. const m__SC_2_PBS_LOCATE = 170
  810. const m__SC_2_PBS_MESSAGE = 171
  811. const m__SC_2_PBS_TRACK = 172
  812. const m__SC_2_SW_DEV = 51
  813. const m__SC_2_UPE = 97
  814. const m__SC_2_VERSION = 46
  815. const m__SC_ADVISORY_INFO = 132
  816. const m__SC_AIO_LISTIO_MAX = 23
  817. const m__SC_AIO_MAX = 24
  818. const m__SC_AIO_PRIO_DELTA_MAX = 25
  819. const m__SC_ARG_MAX = 0
  820. const m__SC_ASYNCHRONOUS_IO = 12
  821. const m__SC_ATEXIT_MAX = 87
  822. const m__SC_AVPHYS_PAGES = 86
  823. const m__SC_BARRIERS = 133
  824. const m__SC_BC_BASE_MAX = 36
  825. const m__SC_BC_DIM_MAX = 37
  826. const m__SC_BC_SCALE_MAX = 38
  827. const m__SC_BC_STRING_MAX = 39
  828. const m__SC_CHILD_MAX = 1
  829. const m__SC_CLK_TCK = 2
  830. const m__SC_CLOCK_SELECTION = 137
  831. const m__SC_COLL_WEIGHTS_MAX = 40
  832. const m__SC_CPUTIME = 138
  833. const m__SC_DELAYTIMER_MAX = 26
  834. const m__SC_EXPR_NEST_MAX = 42
  835. const m__SC_FSYNC = 15
  836. const m__SC_GETGR_R_SIZE_MAX = 69
  837. const m__SC_GETPW_R_SIZE_MAX = 70
  838. const m__SC_HOST_NAME_MAX = 180
  839. const m__SC_IOV_MAX = 60
  840. const m__SC_IPV6 = 235
  841. const m__SC_JOB_CONTROL = 7
  842. const m__SC_LINE_MAX = 43
  843. const m__SC_LOGIN_NAME_MAX = 71
  844. const m__SC_MAPPED_FILES = 16
  845. const m__SC_MEMLOCK = 17
  846. const m__SC_MEMLOCK_RANGE = 18
  847. const m__SC_MEMORY_PROTECTION = 19
  848. const m__SC_MESSAGE_PASSING = 20
  849. const m__SC_MINSIGSTKSZ = 249
  850. const m__SC_MONOTONIC_CLOCK = 149
  851. const m__SC_MQ_OPEN_MAX = 27
  852. const m__SC_MQ_PRIO_MAX = 28
  853. const m__SC_NGROUPS_MAX = 3
  854. const m__SC_NPROCESSORS_CONF = 83
  855. const m__SC_NPROCESSORS_ONLN = 84
  856. const m__SC_NZERO = 109
  857. const m__SC_OPEN_MAX = 4
  858. const m__SC_PAGESIZE = 30
  859. const m__SC_PAGE_SIZE = 30
  860. const m__SC_PASS_MAX = 88
  861. const m__SC_PHYS_PAGES = 85
  862. const m__SC_PRIORITIZED_IO = 13
  863. const m__SC_PRIORITY_SCHEDULING = 10
  864. const m__SC_RAW_SOCKETS = 236
  865. const m__SC_READER_WRITER_LOCKS = 153
  866. const m__SC_REALTIME_SIGNALS = 9
  867. const m__SC_REGEXP = 155
  868. const m__SC_RE_DUP_MAX = 44
  869. const m__SC_RTSIG_MAX = 31
  870. const m__SC_SAVED_IDS = 8
  871. const m__SC_SEMAPHORES = 21
  872. const m__SC_SEM_NSEMS_MAX = 32
  873. const m__SC_SEM_VALUE_MAX = 33
  874. const m__SC_SHARED_MEMORY_OBJECTS = 22
  875. const m__SC_SHELL = 157
  876. const m__SC_SIGQUEUE_MAX = 34
  877. const m__SC_SIGSTKSZ = 250
  878. const m__SC_SPAWN = 159
  879. const m__SC_SPIN_LOCKS = 154
  880. const m__SC_SPORADIC_SERVER = 160
  881. const m__SC_SS_REPL_MAX = 241
  882. const m__SC_STREAMS = 174
  883. const m__SC_STREAM_MAX = 5
  884. const m__SC_SYMLOOP_MAX = 173
  885. const m__SC_SYNCHRONIZED_IO = 14
  886. const m__SC_THREADS = 67
  887. const m__SC_THREAD_ATTR_STACKADDR = 77
  888. const m__SC_THREAD_ATTR_STACKSIZE = 78
  889. const m__SC_THREAD_CPUTIME = 139
  890. const m__SC_THREAD_DESTRUCTOR_ITERATIONS = 73
  891. const m__SC_THREAD_KEYS_MAX = 74
  892. const m__SC_THREAD_PRIORITY_SCHEDULING = 79
  893. const m__SC_THREAD_PRIO_INHERIT = 80
  894. const m__SC_THREAD_PRIO_PROTECT = 81
  895. const m__SC_THREAD_PROCESS_SHARED = 82
  896. const m__SC_THREAD_ROBUST_PRIO_INHERIT = 247
  897. const m__SC_THREAD_ROBUST_PRIO_PROTECT = 248
  898. const m__SC_THREAD_SAFE_FUNCTIONS = 68
  899. const m__SC_THREAD_SPORADIC_SERVER = 161
  900. const m__SC_THREAD_STACK_MIN = 75
  901. const m__SC_THREAD_THREADS_MAX = 76
  902. const m__SC_TIMEOUTS = 164
  903. const m__SC_TIMERS = 11
  904. const m__SC_TIMER_MAX = 35
  905. const m__SC_TRACE = 181
  906. const m__SC_TRACE_EVENT_FILTER = 182
  907. const m__SC_TRACE_EVENT_NAME_MAX = 242
  908. const m__SC_TRACE_INHERIT = 183
  909. const m__SC_TRACE_LOG = 184
  910. const m__SC_TRACE_NAME_MAX = 243
  911. const m__SC_TRACE_SYS_MAX = 244
  912. const m__SC_TRACE_USER_EVENT_MAX = 245
  913. const m__SC_TTY_NAME_MAX = 72
  914. const m__SC_TYPED_MEMORY_OBJECTS = 165
  915. const m__SC_TZNAME_MAX = 6
  916. const m__SC_UIO_MAXIOV = 60
  917. const m__SC_V6_ILP32_OFF32 = 176
  918. const m__SC_V6_ILP32_OFFBIG = 177
  919. const m__SC_V6_LP64_OFF64 = 178
  920. const m__SC_V6_LPBIG_OFFBIG = 179
  921. const m__SC_V7_ILP32_OFF32 = 237
  922. const m__SC_V7_ILP32_OFFBIG = 238
  923. const m__SC_V7_LP64_OFF64 = 239
  924. const m__SC_V7_LPBIG_OFFBIG = 240
  925. const m__SC_VERSION = 29
  926. const m__SC_XBS5_ILP32_OFF32 = 125
  927. const m__SC_XBS5_ILP32_OFFBIG = 126
  928. const m__SC_XBS5_LP64_OFF64 = 127
  929. const m__SC_XBS5_LPBIG_OFFBIG = 128
  930. const m__SC_XOPEN_CRYPT = 92
  931. const m__SC_XOPEN_ENH_I18N = 93
  932. const m__SC_XOPEN_LEGACY = 129
  933. const m__SC_XOPEN_REALTIME = 130
  934. const m__SC_XOPEN_REALTIME_THREADS = 131
  935. const m__SC_XOPEN_SHM = 94
  936. const m__SC_XOPEN_STREAMS = 246
  937. const m__SC_XOPEN_UNIX = 91
  938. const m__SC_XOPEN_VERSION = 89
  939. const m__SC_XOPEN_XCU_VERSION = 90
  940. const m__SC_XOPEN_XPG2 = 98
  941. const m__SC_XOPEN_XPG3 = 99
  942. const m__SC_XOPEN_XPG4 = 100
  943. const m__STDC_PREDEF_H = 1
  944. const m__SYS_CDEFS_H = 1
  945. const m__TANDEM_SOURCE = 1
  946. const m__XOPEN_ENH_I18N = 1
  947. const m__XOPEN_IOV_MAX = 16
  948. const m__XOPEN_NAME_MAX = 255
  949. const m__XOPEN_PATH_MAX = 1024
  950. const m__XOPEN_UNIX = 1
  951. const m__XOPEN_VERSION = 700
  952. const m___ARCH__ = 9
  953. const m___ATOMIC_ACQUIRE = 2
  954. const m___ATOMIC_ACQ_REL = 4
  955. const m___ATOMIC_CONSUME = 1
  956. const m___ATOMIC_RELAXED = 0
  957. const m___ATOMIC_RELEASE = 3
  958. const m___ATOMIC_SEQ_CST = 5
  959. const m___BIGGEST_ALIGNMENT__ = 8
  960. const m___BIG_ENDIAN = 4321
  961. const m___BYTE_ORDER = 4321
  962. const m___BYTE_ORDER__ = "__ORDER_BIG_ENDIAN__"
  963. const m___CCGO__ = 1
  964. const m___CHAR_BIT__ = 8
  965. const m___CHAR_UNSIGNED__ = 1
  966. const m___DBL_DECIMAL_DIG__ = 17
  967. const m___DBL_DIG__ = 15
  968. const m___DBL_HAS_DENORM__ = 1
  969. const m___DBL_HAS_INFINITY__ = 1
  970. const m___DBL_HAS_QUIET_NAN__ = 1
  971. const m___DBL_MANT_DIG__ = 53
  972. const m___DBL_MAX_10_EXP__ = 308
  973. const m___DBL_MAX_EXP__ = 1024
  974. const m___DEC128_EPSILON__ = 1e-33
  975. const m___DEC128_MANT_DIG__ = 34
  976. const m___DEC128_MAX_EXP__ = 6145
  977. const m___DEC128_MAX__ = "9.999999999999999999999999999999999E6144"
  978. const m___DEC128_MIN__ = 1e-6143
  979. const m___DEC128_SUBNORMAL_MIN__ = 0.000000000000000000000000000000001e-6143
  980. const m___DEC32_EPSILON__ = 1e-6
  981. const m___DEC32_MANT_DIG__ = 7
  982. const m___DEC32_MAX_EXP__ = 97
  983. const m___DEC32_MAX__ = 9.999999e96
  984. const m___DEC32_MIN__ = 1e-95
  985. const m___DEC32_SUBNORMAL_MIN__ = 0.000001e-95
  986. const m___DEC64_EPSILON__ = 1e-15
  987. const m___DEC64_MANT_DIG__ = 16
  988. const m___DEC64_MAX_EXP__ = 385
  989. const m___DEC64_MAX__ = "9.999999999999999E384"
  990. const m___DEC64_MIN__ = 1e-383
  991. const m___DEC64_SUBNORMAL_MIN__ = 0.000000000000001e-383
  992. const m___DECIMAL_DIG__ = 17
  993. const m___DEC_EVAL_METHOD__ = 2
  994. const m___ELF__ = 1
  995. const m___EXTENSIONS__ = 1
  996. const m___FINITE_MATH_ONLY__ = 0
  997. const m___FLOAT_WORD_ORDER__ = "__ORDER_BIG_ENDIAN__"
  998. const m___FLT32X_DECIMAL_DIG__ = 17
  999. const m___FLT32X_DENORM_MIN__ = 4.9406564584124654e-324
  1000. const m___FLT32X_DIG__ = 15
  1001. const m___FLT32X_EPSILON__ = 2.2204460492503131e-16
  1002. const m___FLT32X_HAS_DENORM__ = 1
  1003. const m___FLT32X_HAS_INFINITY__ = 1
  1004. const m___FLT32X_HAS_QUIET_NAN__ = 1
  1005. const m___FLT32X_MANT_DIG__ = 53
  1006. const m___FLT32X_MAX_10_EXP__ = 308
  1007. const m___FLT32X_MAX_EXP__ = 1024
  1008. const m___FLT32X_MAX__ = 1.7976931348623157e+308
  1009. const m___FLT32X_MIN__ = 2.2250738585072014e-308
  1010. const m___FLT32X_NORM_MAX__ = 1.7976931348623157e+308
  1011. const m___FLT32_DECIMAL_DIG__ = 9
  1012. const m___FLT32_DENORM_MIN__ = 1.4012984643248171e-45
  1013. const m___FLT32_DIG__ = 6
  1014. const m___FLT32_EPSILON__ = 1.1920928955078125e-7
  1015. const m___FLT32_HAS_DENORM__ = 1
  1016. const m___FLT32_HAS_INFINITY__ = 1
  1017. const m___FLT32_HAS_QUIET_NAN__ = 1
  1018. const m___FLT32_MANT_DIG__ = 24
  1019. const m___FLT32_MAX_10_EXP__ = 38
  1020. const m___FLT32_MAX_EXP__ = 128
  1021. const m___FLT32_MAX__ = 3.4028234663852886e+38
  1022. const m___FLT32_MIN__ = 1.1754943508222875e-38
  1023. const m___FLT32_NORM_MAX__ = 3.4028234663852886e+38
  1024. const m___FLT64_DECIMAL_DIG__ = 17
  1025. const m___FLT64_DENORM_MIN__ = 4.9406564584124654e-324
  1026. const m___FLT64_DIG__ = 15
  1027. const m___FLT64_EPSILON__ = 2.2204460492503131e-16
  1028. const m___FLT64_HAS_DENORM__ = 1
  1029. const m___FLT64_HAS_INFINITY__ = 1
  1030. const m___FLT64_HAS_QUIET_NAN__ = 1
  1031. const m___FLT64_MANT_DIG__ = 53
  1032. const m___FLT64_MAX_10_EXP__ = 308
  1033. const m___FLT64_MAX_EXP__ = 1024
  1034. const m___FLT64_MAX__ = 1.7976931348623157e+308
  1035. const m___FLT64_MIN__ = 2.2250738585072014e-308
  1036. const m___FLT64_NORM_MAX__ = 1.7976931348623157e+308
  1037. const m___FLT_DECIMAL_DIG__ = 9
  1038. const m___FLT_DENORM_MIN__ = 1.4012984643248171e-45
  1039. const m___FLT_DIG__ = 6
  1040. const m___FLT_EPSILON__ = 1.1920928955078125e-7
  1041. const m___FLT_EVAL_METHOD_TS_18661_3__ = 0
  1042. const m___FLT_EVAL_METHOD__ = 0
  1043. const m___FLT_HAS_DENORM__ = 1
  1044. const m___FLT_HAS_INFINITY__ = 1
  1045. const m___FLT_HAS_QUIET_NAN__ = 1
  1046. const m___FLT_MANT_DIG__ = 24
  1047. const m___FLT_MAX_10_EXP__ = 38
  1048. const m___FLT_MAX_EXP__ = 128
  1049. const m___FLT_MAX__ = 3.4028234663852886e+38
  1050. const m___FLT_MIN__ = 1.1754943508222875e-38
  1051. const m___FLT_NORM_MAX__ = 3.4028234663852886e+38
  1052. const m___FLT_RADIX__ = 2
  1053. const m___FP_FAST_FMA = 1
  1054. const m___FP_FAST_FMAF = 1
  1055. const m___FP_FAST_FMAF32 = 1
  1056. const m___FP_FAST_FMAF32x = 1
  1057. const m___FP_FAST_FMAF64 = 1
  1058. const m___FP_FAST_FMAL = 1
  1059. const m___FUNCTION__ = "__func__"
  1060. const m___GCC_ATOMIC_BOOL_LOCK_FREE = 2
  1061. const m___GCC_ATOMIC_CHAR16_T_LOCK_FREE = 2
  1062. const m___GCC_ATOMIC_CHAR32_T_LOCK_FREE = 2
  1063. const m___GCC_ATOMIC_CHAR_LOCK_FREE = 2
  1064. const m___GCC_ATOMIC_INT_LOCK_FREE = 2
  1065. const m___GCC_ATOMIC_LLONG_LOCK_FREE = 2
  1066. const m___GCC_ATOMIC_LONG_LOCK_FREE = 2
  1067. const m___GCC_ATOMIC_POINTER_LOCK_FREE = 2
  1068. const m___GCC_ATOMIC_SHORT_LOCK_FREE = 2
  1069. const m___GCC_ATOMIC_TEST_AND_SET_TRUEVAL = 1
  1070. const m___GCC_ATOMIC_WCHAR_T_LOCK_FREE = 2
  1071. const m___GCC_HAVE_DWARF2_CFI_ASM = 1
  1072. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 = 1
  1073. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 = 1
  1074. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 = 1
  1075. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 = 1
  1076. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 = 1
  1077. const m___GCC_IEC_559 = 2
  1078. const m___GCC_IEC_559_COMPLEX = 2
  1079. const m___GNUC_MINOR__ = 2
  1080. const m___GNUC_PATCHLEVEL__ = 1
  1081. const m___GNUC_STDC_INLINE__ = 1
  1082. const m___GNUC__ = 10
  1083. const m___GXX_ABI_VERSION = 1014
  1084. const m___HAVE_GENERIC_SELECTION = 0
  1085. const m___HAVE_SPECULATION_SAFE_VALUE = 1
  1086. const m___INT16_MAX__ = 0x7fff
  1087. const m___INT32_MAX__ = 0x7fffffff
  1088. const m___INT32_TYPE__ = "int"
  1089. const m___INT64_MAX__ = 0x7fffffffffffffff
  1090. const m___INT8_MAX__ = 0x7f
  1091. const m___INTMAX_MAX__ = 0x7fffffffffffffff
  1092. const m___INTMAX_WIDTH__ = 64
  1093. const m___INTPTR_MAX__ = 0x7fffffffffffffff
  1094. const m___INTPTR_WIDTH__ = 64
  1095. const m___INT_FAST16_MAX__ = 0x7fffffffffffffff
  1096. const m___INT_FAST16_WIDTH__ = 64
  1097. const m___INT_FAST32_MAX__ = 0x7fffffffffffffff
  1098. const m___INT_FAST32_WIDTH__ = 64
  1099. const m___INT_FAST64_MAX__ = 0x7fffffffffffffff
  1100. const m___INT_FAST64_WIDTH__ = 64
  1101. const m___INT_FAST8_MAX__ = 0x7f
  1102. const m___INT_FAST8_WIDTH__ = 8
  1103. const m___INT_LEAST16_MAX__ = 0x7fff
  1104. const m___INT_LEAST16_WIDTH__ = 16
  1105. const m___INT_LEAST32_MAX__ = 0x7fffffff
  1106. const m___INT_LEAST32_TYPE__ = "int"
  1107. const m___INT_LEAST32_WIDTH__ = 32
  1108. const m___INT_LEAST64_MAX__ = 0x7fffffffffffffff
  1109. const m___INT_LEAST64_WIDTH__ = 64
  1110. const m___INT_LEAST8_MAX__ = 0x7f
  1111. const m___INT_LEAST8_WIDTH__ = 8
  1112. const m___INT_MAX__ = 0x7fffffff
  1113. const m___INT_WIDTH__ = 32
  1114. const m___LDBL_COMPAT = 1
  1115. const m___LDBL_DECIMAL_DIG__ = 17
  1116. const m___LDBL_DENORM_MIN__ = 4.9406564584124654e-324
  1117. const m___LDBL_DIG__ = 15
  1118. const m___LDBL_EPSILON__ = 2.2204460492503131e-16
  1119. const m___LDBL_HAS_DENORM__ = 1
  1120. const m___LDBL_HAS_INFINITY__ = 1
  1121. const m___LDBL_HAS_QUIET_NAN__ = 1
  1122. const m___LDBL_MANT_DIG__ = 53
  1123. const m___LDBL_MAX_10_EXP__ = 308
  1124. const m___LDBL_MAX_EXP__ = 1024
  1125. const m___LDBL_MAX__ = 1.7976931348623157e+308
  1126. const m___LDBL_MIN__ = 2.2250738585072014e-308
  1127. const m___LDBL_NORM_MAX__ = 1.7976931348623157e+308
  1128. const m___LITTLE_ENDIAN = 1234
  1129. const m___LONG_DOUBLE_MATH_OPTIONAL = 1
  1130. const m___LONG_DOUBLE_USES_FLOAT128 = 0
  1131. const m___LONG_LONG_MAX__ = 0x7fffffffffffffff
  1132. const m___LONG_LONG_WIDTH__ = 64
  1133. const m___LONG_MAX = 0x7fffffffffffffff
  1134. const m___LONG_MAX__ = 0x7fffffffffffffff
  1135. const m___LONG_WIDTH__ = 64
  1136. const m___LP64__ = 1
  1137. const m___NO_INLINE__ = 1
  1138. const m___NO_LONG_DOUBLE_MATH = 1
  1139. const m___ORDER_BIG_ENDIAN__ = 4321
  1140. const m___ORDER_LITTLE_ENDIAN__ = 1234
  1141. const m___ORDER_PDP_ENDIAN__ = 3412
  1142. const m___PDP_ENDIAN = 3412
  1143. const m___PIC__ = 2
  1144. const m___PIE__ = 2
  1145. const m___PRAGMA_REDEFINE_EXTNAME = 1
  1146. const m___PRETTY_FUNCTION__ = "__func__"
  1147. const m___PTRDIFF_MAX__ = 0x7fffffffffffffff
  1148. const m___PTRDIFF_WIDTH__ = 64
  1149. const m___REENTRANT = 1
  1150. const m___SCHAR_MAX__ = 0x7f
  1151. const m___SCHAR_WIDTH__ = 8
  1152. const m___SHRT_MAX__ = 0x7fff
  1153. const m___SHRT_WIDTH__ = 16
  1154. const m___SIG_ATOMIC_MAX__ = 0x7fffffff
  1155. const m___SIG_ATOMIC_TYPE__ = "int"
  1156. const m___SIG_ATOMIC_WIDTH__ = 32
  1157. const m___SIZEOF_DOUBLE__ = 8
  1158. const m___SIZEOF_FLOAT__ = 4
  1159. const m___SIZEOF_INT128__ = 16
  1160. const m___SIZEOF_INT__ = 4
  1161. const m___SIZEOF_LONG_DOUBLE__ = 8
  1162. const m___SIZEOF_LONG_LONG__ = 8
  1163. const m___SIZEOF_LONG__ = 8
  1164. const m___SIZEOF_POINTER__ = 8
  1165. const m___SIZEOF_PTRDIFF_T__ = 8
  1166. const m___SIZEOF_SHORT__ = 2
  1167. const m___SIZEOF_SIZE_T__ = 8
  1168. const m___SIZEOF_WCHAR_T__ = 4
  1169. const m___SIZEOF_WINT_T__ = 4
  1170. const m___SIZE_MAX__ = 0xffffffffffffffff
  1171. const m___SIZE_WIDTH__ = 64
  1172. const m___STDC_HOSTED__ = 1
  1173. const m___STDC_IEC_559_COMPLEX__ = 1
  1174. const m___STDC_IEC_559__ = 1
  1175. const m___STDC_ISO_10646__ = 201706
  1176. const m___STDC_UTF_16__ = 1
  1177. const m___STDC_UTF_32__ = 1
  1178. const m___STDC_VERSION__ = 201710
  1179. const m___STDC__ = 1
  1180. const m___UINT16_MAX__ = 0xffff
  1181. const m___UINT32_MAX__ = 0xffffffff
  1182. const m___UINT64_MAX__ = 0xffffffffffffffff
  1183. const m___UINT8_MAX__ = 0xff
  1184. const m___UINTMAX_MAX__ = 0xffffffffffffffff
  1185. const m___UINTPTR_MAX__ = 0xffffffffffffffff
  1186. const m___UINT_FAST16_MAX__ = 0xffffffffffffffff
  1187. const m___UINT_FAST32_MAX__ = 0xffffffffffffffff
  1188. const m___UINT_FAST64_MAX__ = 0xffffffffffffffff
  1189. const m___UINT_FAST8_MAX__ = 0xff
  1190. const m___UINT_LEAST16_MAX__ = 0xffff
  1191. const m___UINT_LEAST32_MAX__ = 0xffffffff
  1192. const m___UINT_LEAST64_MAX__ = 0xffffffffffffffff
  1193. const m___UINT_LEAST8_MAX__ = 0xff
  1194. const m___USE_TIME_BITS64 = 1
  1195. const m___VERSION__ = "10.2.1 20210110"
  1196. const m___WCHAR_MAX__ = 0x7fffffff
  1197. const m___WCHAR_TYPE__ = "int"
  1198. const m___WCHAR_WIDTH__ = 32
  1199. const m___WINT_MAX__ = 0xffffffff
  1200. const m___WINT_MIN__ = 0
  1201. const m___WINT_WIDTH__ = 32
  1202. const m___WORDSIZE = 64
  1203. const m___WORDSIZE_TIME64_COMPAT32 = 0
  1204. const m___glibc_c99_flexarr_available = 1
  1205. const m___gnu_linux__ = 1
  1206. const m___inline = "inline"
  1207. const m___linux = 1
  1208. const m___linux__ = 1
  1209. const m___pic__ = 2
  1210. const m___pie__ = 2
  1211. const m___restrict = "restrict"
  1212. const m___s390__ = 1
  1213. const m___s390x__ = 1
  1214. const m___tm_gmtoff = "tm_gmtoff"
  1215. const m___tm_zone = "tm_zone"
  1216. const m___ucontext = "ucontext"
  1217. const m___unix = 1
  1218. const m___unix__ = 1
  1219. const m___zarch__ = 1
  1220. const m_alloca = "__builtin_alloca"
  1221. const m_inline = "__inline"
  1222. const m_linux = 1
  1223. const m_loff_t = "off_t"
  1224. const m_prlimit64 = "prlimit"
  1225. const m_unix = 1
  1226. type t__builtin_va_list = uintptr
  1227. type t__predefined_size_t = uint64
  1228. type t__predefined_wchar_t = int32
  1229. type t__predefined_ptrdiff_t = int64
  1230. type Tsize_t = uint64
  1231. type Tssize_t = int64
  1232. type Tmode_t = uint32
  1233. type Toff_t = int64
  1234. type Tpid_t = int32
  1235. type Tiovec = struct {
  1236. Fiov_base uintptr
  1237. Fiov_len Tsize_t
  1238. }
  1239. type Tflock = struct {
  1240. Fl_type int16
  1241. Fl_whence int16
  1242. Fl_start Toff_t
  1243. Fl_len Toff_t
  1244. Fl_pid Tpid_t
  1245. }
  1246. type Tfile_handle = struct {
  1247. Fhandle_bytes uint32
  1248. Fhandle_type int32
  1249. }
  1250. type Tf_owner_ex = struct {
  1251. Ftype1 int32
  1252. Fpid Tpid_t
  1253. }
  1254. type Ttime_t = int64
  1255. type Tclock_t = int64
  1256. type Ttimespec = struct {
  1257. Ftv_sec Ttime_t
  1258. Ftv_nsec int64
  1259. }
  1260. type Tuid_t = uint32
  1261. type Tpthread_t = uintptr
  1262. type Tsigset_t = struct {
  1263. F__bits [16]uint64
  1264. }
  1265. type t__sigset_t = Tsigset_t
  1266. type Tpthread_attr_t = struct {
  1267. F__u struct {
  1268. F__vi [0][14]int32
  1269. F__s [0][7]uint64
  1270. F__i [14]int32
  1271. }
  1272. }
  1273. type Tstack_t = struct {
  1274. Fss_sp uintptr
  1275. Fss_flags int32
  1276. Fss_size Tsize_t
  1277. }
  1278. type Tsigaltstack = Tstack_t
  1279. type Tgreg_t = uint64
  1280. type Tgregset_t = [27]uint64
  1281. type t__psw_t = struct {
  1282. Fmask uint64
  1283. Faddr uint64
  1284. }
  1285. type Tfpreg_t = struct {
  1286. Ff [0]float32
  1287. Fd float64
  1288. }
  1289. type Tfpregset_t = struct {
  1290. Ffpc uint32
  1291. Ffprs [16]Tfpreg_t
  1292. }
  1293. type Tmcontext_t = struct {
  1294. Fpsw t__psw_t
  1295. Fgregs [16]uint64
  1296. Faregs [16]uint32
  1297. Ffpregs Tfpregset_t
  1298. }
  1299. type Tsigcontext = struct {
  1300. Foldmask [1]uint64
  1301. Fsregs uintptr
  1302. }
  1303. type Tucontext_t = struct {
  1304. Fuc_flags uint64
  1305. Fuc_link uintptr
  1306. Fuc_stack Tstack_t
  1307. Fuc_mcontext Tmcontext_t
  1308. Fuc_sigmask Tsigset_t
  1309. }
  1310. type Tucontext = Tucontext_t
  1311. type Tsigval = struct {
  1312. Fsival_ptr [0]uintptr
  1313. Fsival_int int32
  1314. F__ccgo_pad2 [4]byte
  1315. }
  1316. type Tsiginfo_t = struct {
  1317. Fsi_signo int32
  1318. Fsi_errno int32
  1319. Fsi_code int32
  1320. F__si_fields struct {
  1321. F__si_common [0]struct {
  1322. F__first struct {
  1323. F__timer [0]struct {
  1324. Fsi_timerid int32
  1325. Fsi_overrun int32
  1326. }
  1327. F__piduid struct {
  1328. Fsi_pid Tpid_t
  1329. Fsi_uid Tuid_t
  1330. }
  1331. }
  1332. F__second struct {
  1333. F__sigchld [0]struct {
  1334. Fsi_status int32
  1335. Fsi_utime Tclock_t
  1336. Fsi_stime Tclock_t
  1337. }
  1338. Fsi_value Tsigval
  1339. F__ccgo_pad2 [16]byte
  1340. }
  1341. }
  1342. F__sigfault [0]struct {
  1343. Fsi_addr uintptr
  1344. Fsi_addr_lsb int16
  1345. F__first struct {
  1346. Fsi_pkey [0]uint32
  1347. F__addr_bnd struct {
  1348. Fsi_lower uintptr
  1349. Fsi_upper uintptr
  1350. }
  1351. }
  1352. }
  1353. F__sigpoll [0]struct {
  1354. Fsi_band int64
  1355. Fsi_fd int32
  1356. }
  1357. F__sigsys [0]struct {
  1358. Fsi_call_addr uintptr
  1359. Fsi_syscall int32
  1360. Fsi_arch uint32
  1361. }
  1362. F__pad [112]uint8
  1363. }
  1364. }
  1365. type Tsigaction = struct {
  1366. F__sa_handler struct {
  1367. Fsa_sigaction [0]uintptr
  1368. Fsa_handler uintptr
  1369. }
  1370. Fsa_mask Tsigset_t
  1371. Fsa_flags int32
  1372. Fsa_restorer uintptr
  1373. }
  1374. type Tsigevent = struct {
  1375. Fsigev_value Tsigval
  1376. Fsigev_signo int32
  1377. Fsigev_notify int32
  1378. F__sev_fields struct {
  1379. Fsigev_notify_thread_id [0]Tpid_t
  1380. F__sev_thread [0]struct {
  1381. Fsigev_notify_function uintptr
  1382. Fsigev_notify_attributes uintptr
  1383. }
  1384. F__pad [48]uint8
  1385. }
  1386. }
  1387. type Tsig_t = uintptr
  1388. type Tsighandler_t = uintptr
  1389. type Tsig_atomic_t = int32
  1390. type Tuintptr_t = uint64
  1391. type Tintptr_t = int64
  1392. type Tint8_t = int8
  1393. type Tint16_t = int16
  1394. type Tint32_t = int32
  1395. type Tint64_t = int64
  1396. type Tintmax_t = int64
  1397. type Tuint8_t = uint8
  1398. type Tuint16_t = uint16
  1399. type Tuint32_t = uint32
  1400. type Tuint64_t = uint64
  1401. type Tuintmax_t = uint64
  1402. type Tint_fast8_t = int8
  1403. type Tint_fast64_t = int64
  1404. type Tint_least8_t = int8
  1405. type Tint_least16_t = int16
  1406. type Tint_least32_t = int32
  1407. type Tint_least64_t = int64
  1408. type Tuint_fast8_t = uint8
  1409. type Tuint_fast64_t = uint64
  1410. type Tuint_least8_t = uint8
  1411. type Tuint_least16_t = uint16
  1412. type Tuint_least32_t = uint32
  1413. type Tuint_least64_t = uint64
  1414. type Tint_fast16_t = int32
  1415. type Tint_fast32_t = int32
  1416. type Tuint_fast16_t = uint32
  1417. type Tuint_fast32_t = uint32
  1418. type Twchar_t = int32
  1419. type Tdiv_t = struct {
  1420. Fquot int32
  1421. Frem int32
  1422. }
  1423. type Tldiv_t = struct {
  1424. Fquot int64
  1425. Frem int64
  1426. }
  1427. type Tlldiv_t = struct {
  1428. Fquot int64
  1429. Frem int64
  1430. }
  1431. type Tregister_t = int64
  1432. type Tsuseconds_t = int64
  1433. type Tu_int64_t = uint64
  1434. type Tnlink_t = uint64
  1435. type Tino_t = uint64
  1436. type Tdev_t = uint64
  1437. type Tblksize_t = int64
  1438. type Tblkcnt_t = int64
  1439. type Tfsblkcnt_t = uint64
  1440. type Tfsfilcnt_t = uint64
  1441. type Ttimer_t = uintptr
  1442. type Tclockid_t = int32
  1443. type Tid_t = uint32
  1444. type Tgid_t = uint32
  1445. type Tkey_t = int32
  1446. type Tuseconds_t = uint32
  1447. type Tpthread_once_t = int32
  1448. type Tpthread_key_t = uint32
  1449. type Tpthread_spinlock_t = int32
  1450. type Tpthread_mutexattr_t = struct {
  1451. F__attr uint32
  1452. }
  1453. type Tpthread_condattr_t = struct {
  1454. F__attr uint32
  1455. }
  1456. type Tpthread_barrierattr_t = struct {
  1457. F__attr uint32
  1458. }
  1459. type Tpthread_rwlockattr_t = struct {
  1460. F__attr [2]uint32
  1461. }
  1462. type Tpthread_mutex_t = struct {
  1463. F__u struct {
  1464. F__vi [0][10]int32
  1465. F__p [0][5]uintptr
  1466. F__i [10]int32
  1467. }
  1468. }
  1469. type Tpthread_cond_t = struct {
  1470. F__u struct {
  1471. F__vi [0][12]int32
  1472. F__p [0][6]uintptr
  1473. F__i [12]int32
  1474. }
  1475. }
  1476. type Tpthread_rwlock_t = struct {
  1477. F__u struct {
  1478. F__vi [0][14]int32
  1479. F__p [0][7]uintptr
  1480. F__i [14]int32
  1481. }
  1482. }
  1483. type Tpthread_barrier_t = struct {
  1484. F__u struct {
  1485. F__vi [0][8]int32
  1486. F__p [0][4]uintptr
  1487. F__i [8]int32
  1488. }
  1489. }
  1490. type Tu_int8_t = uint8
  1491. type Tu_int16_t = uint16
  1492. type Tu_int32_t = uint32
  1493. type Tcaddr_t = uintptr
  1494. type Tu_char = uint8
  1495. type Tu_short = uint16
  1496. type Tushort = uint16
  1497. type Tu_int = uint32
  1498. type Tuint = uint32
  1499. type Tu_long = uint64
  1500. type Tulong = uint64
  1501. type Tquad_t = int64
  1502. type Tu_quad_t = uint64
  1503. type Ttimeval = struct {
  1504. Ftv_sec Ttime_t
  1505. Ftv_usec Tsuseconds_t
  1506. }
  1507. type Tfd_mask = uint64
  1508. type Tfd_set = struct {
  1509. Ffds_bits [16]uint64
  1510. }
  1511. type Tva_list = uintptr
  1512. type t__isoc_va_list = uintptr
  1513. type Tfpos_t = struct {
  1514. F__lldata [0]int64
  1515. F__align [0]float64
  1516. F__opaque [16]uint8
  1517. }
  1518. type T_G_fpos64_t = Tfpos_t
  1519. type Tcookie_io_functions_t = struct {
  1520. Fread uintptr
  1521. Fwrite uintptr
  1522. Fseek uintptr
  1523. Fclose1 uintptr
  1524. }
  1525. type T_IO_cookie_io_functions_t = Tcookie_io_functions_t
  1526. type Tstat = struct {
  1527. Fst_dev Tdev_t
  1528. Fst_ino Tino_t
  1529. Fst_nlink Tnlink_t
  1530. Fst_mode Tmode_t
  1531. Fst_uid Tuid_t
  1532. Fst_gid Tgid_t
  1533. Fst_rdev Tdev_t
  1534. Fst_size Toff_t
  1535. Fst_atim Ttimespec
  1536. Fst_mtim Ttimespec
  1537. Fst_ctim Ttimespec
  1538. Fst_blksize Tblksize_t
  1539. Fst_blocks Tblkcnt_t
  1540. F__unused [3]uint64
  1541. }
  1542. type Tstatx_timestamp = struct {
  1543. Ftv_sec Tint64_t
  1544. Ftv_nsec Tuint32_t
  1545. F__pad Tuint32_t
  1546. }
  1547. type Tstatx = struct {
  1548. Fstx_mask Tuint32_t
  1549. Fstx_blksize Tuint32_t
  1550. Fstx_attributes Tuint64_t
  1551. Fstx_nlink Tuint32_t
  1552. Fstx_uid Tuint32_t
  1553. Fstx_gid Tuint32_t
  1554. Fstx_mode Tuint16_t
  1555. F__pad0 [1]Tuint16_t
  1556. Fstx_ino Tuint64_t
  1557. Fstx_size Tuint64_t
  1558. Fstx_blocks Tuint64_t
  1559. Fstx_attributes_mask Tuint64_t
  1560. Fstx_atime Tstatx_timestamp
  1561. Fstx_btime Tstatx_timestamp
  1562. Fstx_ctime Tstatx_timestamp
  1563. Fstx_mtime Tstatx_timestamp
  1564. Fstx_rdev_major Tuint32_t
  1565. Fstx_rdev_minor Tuint32_t
  1566. Fstx_dev_major Tuint32_t
  1567. Fstx_dev_minor Tuint32_t
  1568. F__pad1 [14]Tuint64_t
  1569. }
  1570. type Tlocale_t = uintptr
  1571. type Titimerval = struct {
  1572. Fit_interval Ttimeval
  1573. Fit_value Ttimeval
  1574. }
  1575. type Ttimezone = struct {
  1576. Ftz_minuteswest int32
  1577. Ftz_dsttime int32
  1578. }
  1579. type Tu8 = uint8
  1580. type Tu32 = uint32
  1581. type Tchacha_ctx = struct {
  1582. Finput [16]Tu32
  1583. }
  1584. var _sigma = [16]uint8{'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'}
  1585. var _tau = [16]uint8{'e', 'x', 'p', 'a', 'n', 'd', ' ', '1', '6', '-', 'b', 'y', 't', 'e', ' ', 'k'}
  1586. func _chacha_keysetup(tls *libc.TLS, x uintptr, k uintptr, kbits Tu32, ivbits Tu32) {
  1587. var constants uintptr
  1588. _ = constants
  1589. *(*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)
  1590. *(*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)
  1591. *(*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)
  1592. *(*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)
  1593. if kbits == uint32(256) {
  1594. k += uintptr(16)
  1595. constants = uintptr(unsafe.Pointer(&_sigma))
  1596. } else {
  1597. constants = uintptr(unsafe.Pointer(&_tau))
  1598. }
  1599. *(*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)
  1600. *(*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)
  1601. *(*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)
  1602. *(*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)
  1603. *(*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)
  1604. *(*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)
  1605. *(*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)
  1606. *(*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)
  1607. }
  1608. func _chacha_ivsetup(tls *libc.TLS, x uintptr, iv uintptr) {
  1609. *(*Tu32)(unsafe.Pointer(x + 12*4)) = uint32(0)
  1610. *(*Tu32)(unsafe.Pointer(x + 13*4)) = uint32(0)
  1611. *(*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)
  1612. *(*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)
  1613. }
  1614. func _chacha_encrypt_bytes(tls *libc.TLS, x uintptr, m uintptr, c uintptr, bytes Tu32) {
  1615. bp := tls.Alloc(64)
  1616. defer tls.Free(64)
  1617. var ctarget uintptr
  1618. var i uint32
  1619. 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
  1620. var _ /* tmp at bp+0 */ [64]Tu8
  1621. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  1622. ctarget = libc.UintptrFromInt32(0)
  1623. if !(bytes != 0) {
  1624. return
  1625. }
  1626. j0 = *(*Tu32)(unsafe.Pointer(x))
  1627. j1 = *(*Tu32)(unsafe.Pointer(x + 1*4))
  1628. j2 = *(*Tu32)(unsafe.Pointer(x + 2*4))
  1629. j3 = *(*Tu32)(unsafe.Pointer(x + 3*4))
  1630. j4 = *(*Tu32)(unsafe.Pointer(x + 4*4))
  1631. j5 = *(*Tu32)(unsafe.Pointer(x + 5*4))
  1632. j6 = *(*Tu32)(unsafe.Pointer(x + 6*4))
  1633. j7 = *(*Tu32)(unsafe.Pointer(x + 7*4))
  1634. j8 = *(*Tu32)(unsafe.Pointer(x + 8*4))
  1635. j9 = *(*Tu32)(unsafe.Pointer(x + 9*4))
  1636. j10 = *(*Tu32)(unsafe.Pointer(x + 10*4))
  1637. j11 = *(*Tu32)(unsafe.Pointer(x + 11*4))
  1638. j12 = *(*Tu32)(unsafe.Pointer(x + 12*4))
  1639. j13 = *(*Tu32)(unsafe.Pointer(x + 13*4))
  1640. j14 = *(*Tu32)(unsafe.Pointer(x + 14*4))
  1641. j15 = *(*Tu32)(unsafe.Pointer(x + 15*4))
  1642. for {
  1643. if bytes < uint32(64) {
  1644. i = uint32(0)
  1645. for {
  1646. if !(i < bytes) {
  1647. break
  1648. }
  1649. (*(*[64]Tu8)(unsafe.Pointer(bp)))[i] = *(*Tu8)(unsafe.Pointer(m + uintptr(i)))
  1650. goto _2
  1651. _2:
  1652. ;
  1653. i++
  1654. }
  1655. m = bp
  1656. ctarget = c
  1657. c = bp
  1658. }
  1659. x0 = j0
  1660. x1 = j1
  1661. x2 = j2
  1662. x3 = j3
  1663. x4 = j4
  1664. x5 = j5
  1665. x6 = j6
  1666. x7 = j7
  1667. x8 = j8
  1668. x9 = j9
  1669. x10 = j10
  1670. x11 = j11
  1671. x12 = j12
  1672. x13 = j13
  1673. x14 = j14
  1674. x15 = j15
  1675. i = uint32(20)
  1676. for {
  1677. if !(i > uint32(0)) {
  1678. break
  1679. }
  1680. x0 = (x0 + x4) & libc.Uint32FromUint32(0xFFFFFFFF)
  1681. x12 = (x12^x0)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x12^x0)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  1682. x8 = (x8 + x12) & libc.Uint32FromUint32(0xFFFFFFFF)
  1683. x4 = (x4^x8)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x4^x8)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  1684. x0 = (x0 + x4) & libc.Uint32FromUint32(0xFFFFFFFF)
  1685. x12 = (x12^x0)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x12^x0)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  1686. x8 = (x8 + x12) & libc.Uint32FromUint32(0xFFFFFFFF)
  1687. x4 = (x4^x8)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x4^x8)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  1688. x1 = (x1 + x5) & libc.Uint32FromUint32(0xFFFFFFFF)
  1689. x13 = (x13^x1)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x13^x1)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  1690. x9 = (x9 + x13) & libc.Uint32FromUint32(0xFFFFFFFF)
  1691. x5 = (x5^x9)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x5^x9)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  1692. x1 = (x1 + x5) & libc.Uint32FromUint32(0xFFFFFFFF)
  1693. x13 = (x13^x1)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x13^x1)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  1694. x9 = (x9 + x13) & libc.Uint32FromUint32(0xFFFFFFFF)
  1695. x5 = (x5^x9)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x5^x9)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  1696. x2 = (x2 + x6) & libc.Uint32FromUint32(0xFFFFFFFF)
  1697. x14 = (x14^x2)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x14^x2)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  1698. x10 = (x10 + x14) & libc.Uint32FromUint32(0xFFFFFFFF)
  1699. x6 = (x6^x10)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x6^x10)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  1700. x2 = (x2 + x6) & libc.Uint32FromUint32(0xFFFFFFFF)
  1701. x14 = (x14^x2)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x14^x2)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  1702. x10 = (x10 + x14) & libc.Uint32FromUint32(0xFFFFFFFF)
  1703. x6 = (x6^x10)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x6^x10)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  1704. x3 = (x3 + x7) & libc.Uint32FromUint32(0xFFFFFFFF)
  1705. x15 = (x15^x3)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x15^x3)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  1706. x11 = (x11 + x15) & libc.Uint32FromUint32(0xFFFFFFFF)
  1707. x7 = (x7^x11)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x7^x11)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  1708. x3 = (x3 + x7) & libc.Uint32FromUint32(0xFFFFFFFF)
  1709. x15 = (x15^x3)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x15^x3)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  1710. x11 = (x11 + x15) & libc.Uint32FromUint32(0xFFFFFFFF)
  1711. x7 = (x7^x11)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x7^x11)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  1712. x0 = (x0 + x5) & libc.Uint32FromUint32(0xFFFFFFFF)
  1713. x15 = (x15^x0)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x15^x0)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  1714. x10 = (x10 + x15) & libc.Uint32FromUint32(0xFFFFFFFF)
  1715. x5 = (x5^x10)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x5^x10)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  1716. x0 = (x0 + x5) & libc.Uint32FromUint32(0xFFFFFFFF)
  1717. x15 = (x15^x0)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x15^x0)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  1718. x10 = (x10 + x15) & libc.Uint32FromUint32(0xFFFFFFFF)
  1719. x5 = (x5^x10)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x5^x10)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  1720. x1 = (x1 + x6) & libc.Uint32FromUint32(0xFFFFFFFF)
  1721. x12 = (x12^x1)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x12^x1)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  1722. x11 = (x11 + x12) & libc.Uint32FromUint32(0xFFFFFFFF)
  1723. x6 = (x6^x11)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x6^x11)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  1724. x1 = (x1 + x6) & libc.Uint32FromUint32(0xFFFFFFFF)
  1725. x12 = (x12^x1)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x12^x1)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  1726. x11 = (x11 + x12) & libc.Uint32FromUint32(0xFFFFFFFF)
  1727. x6 = (x6^x11)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x6^x11)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  1728. x2 = (x2 + x7) & libc.Uint32FromUint32(0xFFFFFFFF)
  1729. x13 = (x13^x2)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x13^x2)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  1730. x8 = (x8 + x13) & libc.Uint32FromUint32(0xFFFFFFFF)
  1731. x7 = (x7^x8)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x7^x8)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  1732. x2 = (x2 + x7) & libc.Uint32FromUint32(0xFFFFFFFF)
  1733. x13 = (x13^x2)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x13^x2)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  1734. x8 = (x8 + x13) & libc.Uint32FromUint32(0xFFFFFFFF)
  1735. x7 = (x7^x8)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x7^x8)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  1736. x3 = (x3 + x4) & libc.Uint32FromUint32(0xFFFFFFFF)
  1737. x14 = (x14^x3)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x14^x3)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  1738. x9 = (x9 + x14) & libc.Uint32FromUint32(0xFFFFFFFF)
  1739. x4 = (x4^x9)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x4^x9)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  1740. x3 = (x3 + x4) & libc.Uint32FromUint32(0xFFFFFFFF)
  1741. x14 = (x14^x3)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x14^x3)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  1742. x9 = (x9 + x14) & libc.Uint32FromUint32(0xFFFFFFFF)
  1743. x4 = (x4^x9)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x4^x9)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  1744. goto _3
  1745. _3:
  1746. ;
  1747. i -= uint32(2)
  1748. }
  1749. x0 = (x0 + j0) & libc.Uint32FromUint32(0xFFFFFFFF)
  1750. x1 = (x1 + j1) & libc.Uint32FromUint32(0xFFFFFFFF)
  1751. x2 = (x2 + j2) & libc.Uint32FromUint32(0xFFFFFFFF)
  1752. x3 = (x3 + j3) & libc.Uint32FromUint32(0xFFFFFFFF)
  1753. x4 = (x4 + j4) & libc.Uint32FromUint32(0xFFFFFFFF)
  1754. x5 = (x5 + j5) & libc.Uint32FromUint32(0xFFFFFFFF)
  1755. x6 = (x6 + j6) & libc.Uint32FromUint32(0xFFFFFFFF)
  1756. x7 = (x7 + j7) & libc.Uint32FromUint32(0xFFFFFFFF)
  1757. x8 = (x8 + j8) & libc.Uint32FromUint32(0xFFFFFFFF)
  1758. x9 = (x9 + j9) & libc.Uint32FromUint32(0xFFFFFFFF)
  1759. x10 = (x10 + j10) & libc.Uint32FromUint32(0xFFFFFFFF)
  1760. x11 = (x11 + j11) & libc.Uint32FromUint32(0xFFFFFFFF)
  1761. x12 = (x12 + j12) & libc.Uint32FromUint32(0xFFFFFFFF)
  1762. x13 = (x13 + j13) & libc.Uint32FromUint32(0xFFFFFFFF)
  1763. x14 = (x14 + j14) & libc.Uint32FromUint32(0xFFFFFFFF)
  1764. x15 = (x15 + j15) & libc.Uint32FromUint32(0xFFFFFFFF)
  1765. j12 = (j12 + libc.Uint32FromInt32(libc.Int32FromInt32(1))) & libc.Uint32FromUint32(0xFFFFFFFF)
  1766. if !(j12 != 0) {
  1767. j13 = (j13 + libc.Uint32FromInt32(libc.Int32FromInt32(1))) & libc.Uint32FromUint32(0xFFFFFFFF)
  1768. }
  1769. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(0))) = uint8(uint32(uint8(x0)) & libc.Uint32FromUint32(0xFF))
  1770. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(0) + 1)) = uint8(uint32(uint8(x0>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1771. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(0) + 2)) = uint8(uint32(uint8(x0>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1772. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(0) + 3)) = uint8(uint32(uint8(x0>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1773. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(4))) = uint8(uint32(uint8(x1)) & libc.Uint32FromUint32(0xFF))
  1774. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(4) + 1)) = uint8(uint32(uint8(x1>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1775. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(4) + 2)) = uint8(uint32(uint8(x1>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1776. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(4) + 3)) = uint8(uint32(uint8(x1>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1777. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(8))) = uint8(uint32(uint8(x2)) & libc.Uint32FromUint32(0xFF))
  1778. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(8) + 1)) = uint8(uint32(uint8(x2>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1779. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(8) + 2)) = uint8(uint32(uint8(x2>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1780. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(8) + 3)) = uint8(uint32(uint8(x2>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1781. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(12))) = uint8(uint32(uint8(x3)) & libc.Uint32FromUint32(0xFF))
  1782. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(12) + 1)) = uint8(uint32(uint8(x3>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1783. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(12) + 2)) = uint8(uint32(uint8(x3>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1784. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(12) + 3)) = uint8(uint32(uint8(x3>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1785. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(16))) = uint8(uint32(uint8(x4)) & libc.Uint32FromUint32(0xFF))
  1786. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(16) + 1)) = uint8(uint32(uint8(x4>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1787. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(16) + 2)) = uint8(uint32(uint8(x4>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1788. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(16) + 3)) = uint8(uint32(uint8(x4>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1789. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(20))) = uint8(uint32(uint8(x5)) & libc.Uint32FromUint32(0xFF))
  1790. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(20) + 1)) = uint8(uint32(uint8(x5>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1791. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(20) + 2)) = uint8(uint32(uint8(x5>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1792. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(20) + 3)) = uint8(uint32(uint8(x5>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1793. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(24))) = uint8(uint32(uint8(x6)) & libc.Uint32FromUint32(0xFF))
  1794. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(24) + 1)) = uint8(uint32(uint8(x6>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1795. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(24) + 2)) = uint8(uint32(uint8(x6>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1796. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(24) + 3)) = uint8(uint32(uint8(x6>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1797. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(28))) = uint8(uint32(uint8(x7)) & libc.Uint32FromUint32(0xFF))
  1798. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(28) + 1)) = uint8(uint32(uint8(x7>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1799. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(28) + 2)) = uint8(uint32(uint8(x7>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1800. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(28) + 3)) = uint8(uint32(uint8(x7>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1801. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(32))) = uint8(uint32(uint8(x8)) & libc.Uint32FromUint32(0xFF))
  1802. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(32) + 1)) = uint8(uint32(uint8(x8>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1803. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(32) + 2)) = uint8(uint32(uint8(x8>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1804. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(32) + 3)) = uint8(uint32(uint8(x8>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1805. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(36))) = uint8(uint32(uint8(x9)) & libc.Uint32FromUint32(0xFF))
  1806. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(36) + 1)) = uint8(uint32(uint8(x9>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1807. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(36) + 2)) = uint8(uint32(uint8(x9>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1808. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(36) + 3)) = uint8(uint32(uint8(x9>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1809. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(40))) = uint8(uint32(uint8(x10)) & libc.Uint32FromUint32(0xFF))
  1810. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(40) + 1)) = uint8(uint32(uint8(x10>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1811. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(40) + 2)) = uint8(uint32(uint8(x10>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1812. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(40) + 3)) = uint8(uint32(uint8(x10>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1813. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(44))) = uint8(uint32(uint8(x11)) & libc.Uint32FromUint32(0xFF))
  1814. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(44) + 1)) = uint8(uint32(uint8(x11>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1815. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(44) + 2)) = uint8(uint32(uint8(x11>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1816. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(44) + 3)) = uint8(uint32(uint8(x11>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1817. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(48))) = uint8(uint32(uint8(x12)) & libc.Uint32FromUint32(0xFF))
  1818. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(48) + 1)) = uint8(uint32(uint8(x12>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1819. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(48) + 2)) = uint8(uint32(uint8(x12>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1820. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(48) + 3)) = uint8(uint32(uint8(x12>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1821. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(52))) = uint8(uint32(uint8(x13)) & libc.Uint32FromUint32(0xFF))
  1822. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(52) + 1)) = uint8(uint32(uint8(x13>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1823. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(52) + 2)) = uint8(uint32(uint8(x13>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1824. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(52) + 3)) = uint8(uint32(uint8(x13>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1825. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(56))) = uint8(uint32(uint8(x14)) & libc.Uint32FromUint32(0xFF))
  1826. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(56) + 1)) = uint8(uint32(uint8(x14>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1827. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(56) + 2)) = uint8(uint32(uint8(x14>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1828. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(56) + 3)) = uint8(uint32(uint8(x14>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1829. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(60))) = uint8(uint32(uint8(x15)) & libc.Uint32FromUint32(0xFF))
  1830. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(60) + 1)) = uint8(uint32(uint8(x15>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  1831. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(60) + 2)) = uint8(uint32(uint8(x15>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  1832. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(60) + 3)) = uint8(uint32(uint8(x15>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  1833. if bytes <= uint32(64) {
  1834. if bytes < uint32(64) {
  1835. i = uint32(0)
  1836. for {
  1837. if !(i < bytes) {
  1838. break
  1839. }
  1840. *(*Tu8)(unsafe.Pointer(ctarget + uintptr(i))) = *(*Tu8)(unsafe.Pointer(c + uintptr(i)))
  1841. goto _4
  1842. _4:
  1843. ;
  1844. i++
  1845. }
  1846. }
  1847. *(*Tu32)(unsafe.Pointer(x + 12*4)) = j12
  1848. *(*Tu32)(unsafe.Pointer(x + 13*4)) = j13
  1849. return
  1850. }
  1851. bytes -= uint32(64)
  1852. c += uintptr(64)
  1853. goto _1
  1854. _1:
  1855. }
  1856. }
  1857. // C documentation
  1858. //
  1859. // /* Marked MAP_INHERIT_ZERO, so zero'd out in fork children. */
  1860. type T_rs = struct {
  1861. Frs_have Tsize_t
  1862. Frs_count Tsize_t
  1863. }
  1864. // C documentation
  1865. //
  1866. // /* Marked MAP_INHERIT_ZERO, so zero'd out in fork children. */
  1867. var _rs uintptr
  1868. // C documentation
  1869. //
  1870. // /* Maybe be preserved in fork children, if _rs_allocate() decides. */
  1871. type T_rsx = struct {
  1872. Frs_chacha Tchacha_ctx
  1873. Frs_buf [1024]uint8
  1874. }
  1875. // C documentation
  1876. //
  1877. // /* Maybe be preserved in fork children, if _rs_allocate() decides. */
  1878. var _rsx uintptr
  1879. type Trlim_t = uint64
  1880. type Trlimit = struct {
  1881. Frlim_cur Trlim_t
  1882. Frlim_max Trlim_t
  1883. }
  1884. type Trusage = struct {
  1885. Fru_utime Ttimeval
  1886. Fru_stime Ttimeval
  1887. Fru_maxrss int64
  1888. Fru_ixrss int64
  1889. Fru_idrss int64
  1890. Fru_isrss int64
  1891. Fru_minflt int64
  1892. Fru_majflt int64
  1893. Fru_nswap int64
  1894. Fru_inblock int64
  1895. Fru_oublock int64
  1896. Fru_msgsnd int64
  1897. Fru_msgrcv int64
  1898. Fru_nsignals int64
  1899. Fru_nvcsw int64
  1900. Fru_nivcsw int64
  1901. F__reserved [16]int64
  1902. }
  1903. type Tsched_param = struct {
  1904. Fsched_priority int32
  1905. F__reserved1 int32
  1906. F__reserved2 [2]struct {
  1907. F__reserved1 Ttime_t
  1908. F__reserved2 int64
  1909. }
  1910. F__reserved3 int32
  1911. }
  1912. type Tcpu_set_t = struct {
  1913. F__bits [16]uint64
  1914. }
  1915. type Ttm = struct {
  1916. Ftm_sec int32
  1917. Ftm_min int32
  1918. Ftm_hour int32
  1919. Ftm_mday int32
  1920. Ftm_mon int32
  1921. Ftm_year int32
  1922. Ftm_wday int32
  1923. Ftm_yday int32
  1924. Ftm_isdst int32
  1925. Ftm_gmtoff int64
  1926. Ftm_zone uintptr
  1927. }
  1928. type Titimerspec = struct {
  1929. Fit_interval Ttimespec
  1930. Fit_value Ttimespec
  1931. }
  1932. type t__ptcb = struct {
  1933. F__f uintptr
  1934. F__x uintptr
  1935. F__next uintptr
  1936. }
  1937. type Tcpu_set_t1 = struct {
  1938. F__bits [16]uint64
  1939. }
  1940. var _arc4random_mtx = Tpthread_mutex_t{}
  1941. var __rs_forked Tsig_atomic_t
  1942. func __rs_init(tls *libc.TLS, buf uintptr, n Tsize_t) {
  1943. var v1, v2, v3, v6 uintptr
  1944. var v4 int32
  1945. _, _, _, _, _ = v1, v2, v3, v4, v6
  1946. if n < libc.Uint64FromInt32(libc.Int32FromInt32(m_KEYSZ)+libc.Int32FromInt32(m_IVSZ)) {
  1947. return
  1948. }
  1949. if _rs == libc.UintptrFromInt32(0) {
  1950. v1 = uintptr(unsafe.Pointer(&_rs))
  1951. v2 = uintptr(unsafe.Pointer(&_rsx))
  1952. 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)
  1953. *(*uintptr)(unsafe.Pointer(v1)) = v3
  1954. if v3 == uintptr(-libc.Int32FromInt32(1)) {
  1955. v4 = -int32(1)
  1956. goto _5
  1957. }
  1958. 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)
  1959. *(*uintptr)(unsafe.Pointer(v2)) = v6
  1960. if v6 == uintptr(-libc.Int32FromInt32(1)) {
  1961. libc.Xmunmap(tls, *(*uintptr)(unsafe.Pointer(v1)), uint64(16))
  1962. *(*uintptr)(unsafe.Pointer(v1)) = libc.UintptrFromInt32(0)
  1963. v4 = -int32(1)
  1964. goto _5
  1965. }
  1966. libc.Xpthread_atfork(tls, libc.UintptrFromInt32(0), libc.UintptrFromInt32(0), __ccgo_fp(__rs_forkhandler))
  1967. v4 = 0
  1968. goto _5
  1969. _5:
  1970. if v4 == -int32(1) {
  1971. libc.Xabort(tls)
  1972. }
  1973. }
  1974. _chacha_keysetup(tls, _rsx, buf, libc.Uint32FromInt32(libc.Int32FromInt32(m_KEYSZ)*libc.Int32FromInt32(8)), uint32(0))
  1975. _chacha_ivsetup(tls, _rsx, buf+uintptr(m_KEYSZ))
  1976. }
  1977. func __rs_rekey(tls *libc.TLS, dat uintptr, datlen Tsize_t) {
  1978. var i, m Tsize_t
  1979. var v1 uint64
  1980. var p3 uintptr
  1981. _, _, _, _ = i, m, v1, p3
  1982. /* fill rs_buf with the keystream */
  1983. _chacha_encrypt_bytes(tls, _rsx, _rsx+64, _rsx+64, uint32(1024))
  1984. /* mix in optional user provided data */
  1985. if dat != 0 {
  1986. if datlen < libc.Uint64FromInt32(libc.Int32FromInt32(m_KEYSZ)+libc.Int32FromInt32(m_IVSZ)) {
  1987. v1 = datlen
  1988. } else {
  1989. v1 = libc.Uint64FromInt32(libc.Int32FromInt32(m_KEYSZ) + libc.Int32FromInt32(m_IVSZ))
  1990. }
  1991. m = v1
  1992. i = uint64(0)
  1993. for {
  1994. if !(i < m) {
  1995. break
  1996. }
  1997. p3 = _rsx + 64 + uintptr(i)
  1998. *(*uint8)(unsafe.Pointer(p3)) = uint8(int32(*(*uint8)(unsafe.Pointer(p3))) ^ libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(dat + uintptr(i)))))
  1999. goto _2
  2000. _2:
  2001. ;
  2002. i++
  2003. }
  2004. }
  2005. /* immediately reinit for backtracking resistance */
  2006. __rs_init(tls, _rsx+64, libc.Uint64FromInt32(libc.Int32FromInt32(m_KEYSZ)+libc.Int32FromInt32(m_IVSZ)))
  2007. libc.Xmemset(tls, _rsx+64, 0, libc.Uint64FromInt32(libc.Int32FromInt32(m_KEYSZ)+libc.Int32FromInt32(m_IVSZ)))
  2008. (*T_rs)(unsafe.Pointer(_rs)).Frs_have = libc.Uint64FromInt64(1024) - libc.Uint64FromInt32(m_KEYSZ) - libc.Uint64FromInt32(m_IVSZ)
  2009. }
  2010. func __rs_stir(tls *libc.TLS) {
  2011. bp := tls.Alloc(48)
  2012. defer tls.Free(48)
  2013. var _ /* rnd at bp+0 */ [40]uint8
  2014. if Xgetentropy(tls, bp, uint64(40)) == -int32(1) {
  2015. libc.Xraise(tls, int32(m_SIGKILL))
  2016. }
  2017. if !(_rs != 0) {
  2018. __rs_init(tls, bp, uint64(40))
  2019. } else {
  2020. __rs_rekey(tls, bp, uint64(40))
  2021. }
  2022. Xexplicit_bzero(tls, bp, uint64(40)) /* discard source seed */
  2023. /* invalidate rs_buf */
  2024. (*T_rs)(unsafe.Pointer(_rs)).Frs_have = uint64(0)
  2025. libc.Xmemset(tls, _rsx+64, 0, uint64(1024))
  2026. (*T_rs)(unsafe.Pointer(_rs)).Frs_count = uint64(1600000)
  2027. }
  2028. func __rs_stir_if_needed(tls *libc.TLS, len1 Tsize_t) {
  2029. __rs_forkdetect(tls)
  2030. if !(_rs != 0) || (*T_rs)(unsafe.Pointer(_rs)).Frs_count <= len1 {
  2031. __rs_stir(tls)
  2032. }
  2033. if (*T_rs)(unsafe.Pointer(_rs)).Frs_count <= len1 {
  2034. (*T_rs)(unsafe.Pointer(_rs)).Frs_count = uint64(0)
  2035. } else {
  2036. *(*Tsize_t)(unsafe.Pointer(_rs + 8)) -= len1
  2037. }
  2038. }
  2039. func __rs_random_buf(tls *libc.TLS, _buf uintptr, n Tsize_t) {
  2040. var buf, keystream uintptr
  2041. var m Tsize_t
  2042. var v1 uint64
  2043. _, _, _, _ = buf, keystream, m, v1
  2044. buf = _buf
  2045. __rs_stir_if_needed(tls, n)
  2046. for n > uint64(0) {
  2047. if (*T_rs)(unsafe.Pointer(_rs)).Frs_have > uint64(0) {
  2048. if n < (*T_rs)(unsafe.Pointer(_rs)).Frs_have {
  2049. v1 = n
  2050. } else {
  2051. v1 = (*T_rs)(unsafe.Pointer(_rs)).Frs_have
  2052. }
  2053. m = v1
  2054. keystream = _rsx + 64 + uintptr(1024) - uintptr((*T_rs)(unsafe.Pointer(_rs)).Frs_have)
  2055. libc.Xmemcpy(tls, buf, keystream, m)
  2056. libc.Xmemset(tls, keystream, 0, m)
  2057. buf += uintptr(m)
  2058. n -= m
  2059. *(*Tsize_t)(unsafe.Pointer(_rs)) -= m
  2060. }
  2061. if (*T_rs)(unsafe.Pointer(_rs)).Frs_have == uint64(0) {
  2062. __rs_rekey(tls, libc.UintptrFromInt32(0), uint64(0))
  2063. }
  2064. }
  2065. }
  2066. func __rs_random_u32(tls *libc.TLS, val uintptr) {
  2067. var keystream uintptr
  2068. _ = keystream
  2069. __rs_stir_if_needed(tls, uint64(4))
  2070. if (*T_rs)(unsafe.Pointer(_rs)).Frs_have < uint64(4) {
  2071. __rs_rekey(tls, libc.UintptrFromInt32(0), uint64(0))
  2072. }
  2073. keystream = _rsx + 64 + uintptr(1024) - uintptr((*T_rs)(unsafe.Pointer(_rs)).Frs_have)
  2074. libc.Xmemcpy(tls, val, keystream, uint64(4))
  2075. libc.Xmemset(tls, keystream, 0, uint64(4))
  2076. *(*Tsize_t)(unsafe.Pointer(_rs)) -= uint64(4)
  2077. }
  2078. func Xarc4random_stir(tls *libc.TLS) {
  2079. libc.Xpthread_mutex_lock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2080. __rs_stir(tls)
  2081. libc.Xpthread_mutex_unlock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2082. }
  2083. func Xarc4random_addrandom(tls *libc.TLS, dat uintptr, datlen int32) {
  2084. libc.Xpthread_mutex_lock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2085. __rs_stir_if_needed(tls, libc.Uint64FromInt32(datlen))
  2086. __rs_rekey(tls, dat, libc.Uint64FromInt32(datlen))
  2087. libc.Xpthread_mutex_unlock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2088. }
  2089. func Xarc4random(tls *libc.TLS) (r Tuint32_t) {
  2090. bp := tls.Alloc(16)
  2091. defer tls.Free(16)
  2092. var _ /* val at bp+0 */ Tuint32_t
  2093. libc.Xpthread_mutex_lock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2094. __rs_random_u32(tls, bp)
  2095. libc.Xpthread_mutex_unlock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2096. return *(*Tuint32_t)(unsafe.Pointer(bp))
  2097. }
  2098. func Xarc4random_buf(tls *libc.TLS, buf uintptr, n Tsize_t) {
  2099. libc.Xpthread_mutex_lock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2100. __rs_random_buf(tls, buf, n)
  2101. libc.Xpthread_mutex_unlock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2102. }
  2103. // C documentation
  2104. //
  2105. // /*
  2106. // * Calculate a uniformly distributed random number less than upper_bound
  2107. // * avoiding "modulo bias".
  2108. // *
  2109. // * Uniformity is achieved by generating new random numbers until the one
  2110. // * returned is outside the range [0, 2**32 % upper_bound). This
  2111. // * guarantees the selected random number will be inside
  2112. // * [2**32 % upper_bound, 2**32) which maps back to [0, upper_bound)
  2113. // * after reduction modulo upper_bound.
  2114. // */
  2115. func Xarc4random_uniform(tls *libc.TLS, upper_bound Tuint32_t) (r1 Tuint32_t) {
  2116. var min, r Tuint32_t
  2117. _, _ = min, r
  2118. if upper_bound < uint32(2) {
  2119. return uint32(0)
  2120. }
  2121. /* 2**32 % x == (2**32 - x) % x */
  2122. min = -upper_bound % upper_bound
  2123. /*
  2124. * This could theoretically loop forever but each retry has
  2125. * p > 0.5 (worst case, usually far better) of selecting a
  2126. * number inside the range we need, so it should rarely need
  2127. * to re-roll.
  2128. */
  2129. for {
  2130. r = Xarc4random(tls)
  2131. if r >= min {
  2132. break
  2133. }
  2134. goto _1
  2135. _1:
  2136. }
  2137. return r % upper_bound
  2138. }
  2139. const m_SEEK_CUR = 1
  2140. const m_SEEK_END = 2
  2141. const m_SEEK_SET = 0
  2142. const m_no_argument = 0
  2143. const m_optional_argument = 2
  2144. const m_required_argument = 1
  2145. type Toption = struct {
  2146. Fname uintptr
  2147. Fhas_arg int32
  2148. Fflag uintptr
  2149. Fval int32
  2150. }
  2151. func Xbsd_getopt(tls *libc.TLS, argc int32, argv uintptr, shortopts uintptr) (r int32) {
  2152. if Xoptreset == int32(1) {
  2153. Xoptreset = 0
  2154. libc.Xoptind = 0
  2155. }
  2156. /*
  2157. * Make sure we are using the system getopt() and not a possible
  2158. * overlay macro.
  2159. */
  2160. return libc.Xgetopt(tls, argc, argv, shortopts)
  2161. }
  2162. const m_DT_BLK = 6
  2163. const m_DT_CHR = 2
  2164. const m_DT_DIR = 4
  2165. const m_DT_FIFO = 1
  2166. const m_DT_LNK = 10
  2167. const m_DT_REG = 8
  2168. const m_DT_SOCK = 12
  2169. const m_DT_UNKNOWN = 0
  2170. const m_DT_WHT = 14
  2171. const m_E2BIG = 7
  2172. const m_EACCES = 13
  2173. const m_EADDRINUSE = 98
  2174. const m_EADDRNOTAVAIL = 99
  2175. const m_EADV = 68
  2176. const m_EAFNOSUPPORT = 97
  2177. const m_EAGAIN = 11
  2178. const m_EALREADY = 114
  2179. const m_EBADE = 52
  2180. const m_EBADF = 9
  2181. const m_EBADFD = 77
  2182. const m_EBADMSG = 74
  2183. const m_EBADR = 53
  2184. const m_EBADRQC = 56
  2185. const m_EBADSLT = 57
  2186. const m_EBFONT = 59
  2187. const m_EBUSY = 16
  2188. const m_ECANCELED = 125
  2189. const m_ECHILD = 10
  2190. const m_ECHRNG = 44
  2191. const m_ECOMM = 70
  2192. const m_ECONNABORTED = 103
  2193. const m_ECONNREFUSED = 111
  2194. const m_ECONNRESET = 104
  2195. const m_EDEADLK = 35
  2196. const m_EDEADLOCK = "EDEADLK"
  2197. const m_EDESTADDRREQ = 89
  2198. const m_EDOM = 33
  2199. const m_EDOTDOT = 73
  2200. const m_EDQUOT = 122
  2201. const m_EEXIST = 17
  2202. const m_EFAULT = 14
  2203. const m_EFBIG = 27
  2204. const m_EHOSTDOWN = 112
  2205. const m_EHOSTUNREACH = 113
  2206. const m_EHWPOISON = 133
  2207. const m_EIDRM = 43
  2208. const m_EILSEQ = 84
  2209. const m_EINPROGRESS = 115
  2210. const m_EINTR = 4
  2211. const m_EINVAL = 22
  2212. const m_EIO = 5
  2213. const m_EISCONN = 106
  2214. const m_EISDIR = 21
  2215. const m_EISNAM = 120
  2216. const m_EKEYEXPIRED = 127
  2217. const m_EKEYREJECTED = 129
  2218. const m_EKEYREVOKED = 128
  2219. const m_EL2HLT = 51
  2220. const m_EL2NSYNC = 45
  2221. const m_EL3HLT = 46
  2222. const m_EL3RST = 47
  2223. const m_ELIBACC = 79
  2224. const m_ELIBBAD = 80
  2225. const m_ELIBEXEC = 83
  2226. const m_ELIBMAX = 82
  2227. const m_ELIBSCN = 81
  2228. const m_ELNRNG = 48
  2229. const m_ELOOP = 40
  2230. const m_EMEDIUMTYPE = 124
  2231. const m_EMFILE = 24
  2232. const m_EMLINK = 31
  2233. const m_EMSGSIZE = 90
  2234. const m_EMULTIHOP = 72
  2235. const m_ENAMETOOLONG = 36
  2236. const m_ENAVAIL = 119
  2237. const m_ENETDOWN = 100
  2238. const m_ENETRESET = 102
  2239. const m_ENETUNREACH = 101
  2240. const m_ENFILE = 23
  2241. const m_ENOANO = 55
  2242. const m_ENOBUFS = 105
  2243. const m_ENOCSI = 50
  2244. const m_ENODATA = 61
  2245. const m_ENODEV = 19
  2246. const m_ENOENT = 2
  2247. const m_ENOEXEC = 8
  2248. const m_ENOKEY = 126
  2249. const m_ENOLCK = 37
  2250. const m_ENOLINK = 67
  2251. const m_ENOMEDIUM = 123
  2252. const m_ENOMEM = 12
  2253. const m_ENOMSG = 42
  2254. const m_ENONET = 64
  2255. const m_ENOPKG = 65
  2256. const m_ENOPROTOOPT = 92
  2257. const m_ENOSPC = 28
  2258. const m_ENOSR = 63
  2259. const m_ENOSTR = 60
  2260. const m_ENOSYS = 38
  2261. const m_ENOTBLK = 15
  2262. const m_ENOTCONN = 107
  2263. const m_ENOTDIR = 20
  2264. const m_ENOTEMPTY = 39
  2265. const m_ENOTNAM = 118
  2266. const m_ENOTRECOVERABLE = 131
  2267. const m_ENOTSOCK = 88
  2268. const m_ENOTSUP = "EOPNOTSUPP"
  2269. const m_ENOTTY = 25
  2270. const m_ENOTUNIQ = 76
  2271. const m_ENXIO = 6
  2272. const m_EOPNOTSUPP = 95
  2273. const m_EOVERFLOW = 75
  2274. const m_EOWNERDEAD = 130
  2275. const m_EPERM = 1
  2276. const m_EPFNOSUPPORT = 96
  2277. const m_EPIPE = 32
  2278. const m_EPROTO = 71
  2279. const m_EPROTONOSUPPORT = 93
  2280. const m_EPROTOTYPE = 91
  2281. const m_ERANGE = 34
  2282. const m_EREMCHG = 78
  2283. const m_EREMOTE = 66
  2284. const m_EREMOTEIO = 121
  2285. const m_ERESTART = 85
  2286. const m_ERFKILL = 132
  2287. const m_EROFS = 30
  2288. const m_ESHUTDOWN = 108
  2289. const m_ESOCKTNOSUPPORT = 94
  2290. const m_ESPIPE = 29
  2291. const m_ESRCH = 3
  2292. const m_ESRMNT = 69
  2293. const m_ESTALE = 116
  2294. const m_ESTRPIPE = 86
  2295. const m_ETIME = 62
  2296. const m_ETIMEDOUT = 110
  2297. const m_ETOOMANYREFS = 109
  2298. const m_ETXTBSY = 26
  2299. const m_EUCLEAN = 117
  2300. const m_EUNATCH = 49
  2301. const m_EUSERS = 87
  2302. const m_EWOULDBLOCK = "EAGAIN"
  2303. const m_EXDEV = 18
  2304. const m_EXFULL = 54
  2305. const m_INT_MAX1 = 2147483647
  2306. const m_OPEN_MAX = 256
  2307. const m_SYS__sysctl = 149
  2308. const m_SYS_accept4 = 364
  2309. const m_SYS_access = 33
  2310. const m_SYS_acct = 51
  2311. const m_SYS_add_key = 278
  2312. const m_SYS_adjtimex = 124
  2313. const m_SYS_afs_syscall = 137
  2314. const m_SYS_alarm = 27
  2315. const m_SYS_bdflush = 134
  2316. const m_SYS_bind = 361
  2317. const m_SYS_bpf = 351
  2318. const m_SYS_brk = 45
  2319. const m_SYS_cachestat = 451
  2320. const m_SYS_capget = 184
  2321. const m_SYS_capset = 185
  2322. const m_SYS_chdir = 12
  2323. const m_SYS_chmod = 15
  2324. const m_SYS_chown = 212
  2325. const m_SYS_chroot = 61
  2326. const m_SYS_clock_adjtime = 337
  2327. const m_SYS_clock_getres = 261
  2328. const m_SYS_clock_gettime = 260
  2329. const m_SYS_clock_nanosleep = 262
  2330. const m_SYS_clock_settime = 259
  2331. const m_SYS_clone = 120
  2332. const m_SYS_clone3 = 435
  2333. const m_SYS_close = 6
  2334. const m_SYS_close_range = 436
  2335. const m_SYS_connect = 362
  2336. const m_SYS_copy_file_range = 375
  2337. const m_SYS_creat = 8
  2338. const m_SYS_create_module = 127
  2339. const m_SYS_delete_module = 129
  2340. const m_SYS_dup = 41
  2341. const m_SYS_dup2 = 63
  2342. const m_SYS_dup3 = 326
  2343. const m_SYS_epoll_create = 249
  2344. const m_SYS_epoll_create1 = 327
  2345. const m_SYS_epoll_ctl = 250
  2346. const m_SYS_epoll_pwait = 312
  2347. const m_SYS_epoll_pwait2 = 441
  2348. const m_SYS_epoll_wait = 251
  2349. const m_SYS_eventfd = 318
  2350. const m_SYS_eventfd2 = 323
  2351. const m_SYS_execve = 11
  2352. const m_SYS_execveat = 354
  2353. const m_SYS_exit = 1
  2354. const m_SYS_exit_group = 248
  2355. const m_SYS_faccessat = 300
  2356. const m_SYS_faccessat2 = 439
  2357. const m_SYS_fadvise64 = 253
  2358. const m_SYS_fallocate = 314
  2359. const m_SYS_fanotify_init = 332
  2360. const m_SYS_fanotify_mark = 333
  2361. const m_SYS_fchdir = 133
  2362. const m_SYS_fchmod = 94
  2363. const m_SYS_fchmodat = 299
  2364. const m_SYS_fchmodat2 = 452
  2365. const m_SYS_fchown = 207
  2366. const m_SYS_fchownat = 291
  2367. const m_SYS_fcntl = 55
  2368. const m_SYS_fdatasync = 148
  2369. const m_SYS_fgetxattr = 229
  2370. const m_SYS_finit_module = 344
  2371. const m_SYS_flistxattr = 232
  2372. const m_SYS_flock = 143
  2373. const m_SYS_fork = 2
  2374. const m_SYS_fremovexattr = 235
  2375. const m_SYS_fsconfig = 431
  2376. const m_SYS_fsetxattr = 226
  2377. const m_SYS_fsmount = 432
  2378. const m_SYS_fsopen = 430
  2379. const m_SYS_fspick = 433
  2380. const m_SYS_fstat = 108
  2381. const m_SYS_fstatfs = 100
  2382. const m_SYS_fstatfs64 = 266
  2383. const m_SYS_fsync = 118
  2384. const m_SYS_ftruncate = 93
  2385. const m_SYS_futex = 238
  2386. const m_SYS_futex_waitv = 449
  2387. const m_SYS_futimesat = 292
  2388. const m_SYS_get_kernel_syms = 130
  2389. const m_SYS_get_mempolicy = 269
  2390. const m_SYS_get_robust_list = 305
  2391. const m_SYS_getcpu = 311
  2392. const m_SYS_getcwd = 183
  2393. const m_SYS_getdents = 141
  2394. const m_SYS_getdents64 = 220
  2395. const m_SYS_getegid = 202
  2396. const m_SYS_geteuid = 201
  2397. const m_SYS_getgid = 200
  2398. const m_SYS_getgroups = 205
  2399. const m_SYS_getitimer = 105
  2400. const m_SYS_getpeername = 368
  2401. const m_SYS_getpgid = 132
  2402. const m_SYS_getpgrp = 65
  2403. const m_SYS_getpid = 20
  2404. const m_SYS_getpmsg = 188
  2405. const m_SYS_getppid = 64
  2406. const m_SYS_getpriority = 96
  2407. const m_SYS_getrandom = 349
  2408. const m_SYS_getresgid = 211
  2409. const m_SYS_getresuid = 209
  2410. const m_SYS_getrlimit = 191
  2411. const m_SYS_getrusage = 77
  2412. const m_SYS_getsid = 147
  2413. const m_SYS_getsockname = 367
  2414. const m_SYS_getsockopt = 365
  2415. const m_SYS_gettid = 236
  2416. const m_SYS_gettimeofday = 78
  2417. const m_SYS_getuid = 199
  2418. const m_SYS_getxattr = 227
  2419. const m_SYS_idle = 112
  2420. const m_SYS_init_module = 128
  2421. const m_SYS_inotify_add_watch = 285
  2422. const m_SYS_inotify_init = 284
  2423. const m_SYS_inotify_init1 = 324
  2424. const m_SYS_inotify_rm_watch = 286
  2425. const m_SYS_io_cancel = 247
  2426. const m_SYS_io_destroy = 244
  2427. const m_SYS_io_getevents = 245
  2428. const m_SYS_io_pgetevents = 382
  2429. const m_SYS_io_setup = 243
  2430. const m_SYS_io_submit = 246
  2431. const m_SYS_io_uring_enter = 426
  2432. const m_SYS_io_uring_register = 427
  2433. const m_SYS_io_uring_setup = 425
  2434. const m_SYS_ioctl = 54
  2435. const m_SYS_ioprio_get = 283
  2436. const m_SYS_ioprio_set = 282
  2437. const m_SYS_ipc = 117
  2438. const m_SYS_kcmp = 343
  2439. const m_SYS_kexec_file_load = 381
  2440. const m_SYS_kexec_load = 277
  2441. const m_SYS_keyctl = 280
  2442. const m_SYS_kill = 37
  2443. const m_SYS_landlock_add_rule = 445
  2444. const m_SYS_landlock_create_ruleset = 444
  2445. const m_SYS_landlock_restrict_self = 446
  2446. const m_SYS_lchown = 198
  2447. const m_SYS_lgetxattr = 228
  2448. const m_SYS_link = 9
  2449. const m_SYS_linkat = 296
  2450. const m_SYS_listen = 363
  2451. const m_SYS_listxattr = 230
  2452. const m_SYS_llistxattr = 231
  2453. const m_SYS_lookup_dcookie = 110
  2454. const m_SYS_lremovexattr = 234
  2455. const m_SYS_lseek = 19
  2456. const m_SYS_lsetxattr = 225
  2457. const m_SYS_lstat = 107
  2458. const m_SYS_madvise = 219
  2459. const m_SYS_mbind = 268
  2460. const m_SYS_membarrier = 356
  2461. const m_SYS_memfd_create = 350
  2462. const m_SYS_memfd_secret = 447
  2463. const m_SYS_migrate_pages = 287
  2464. const m_SYS_mincore = 218
  2465. const m_SYS_mkdir = 39
  2466. const m_SYS_mkdirat = 289
  2467. const m_SYS_mknod = 14
  2468. const m_SYS_mknodat = 290
  2469. const m_SYS_mlock = 150
  2470. const m_SYS_mlock2 = 374
  2471. const m_SYS_mlockall = 152
  2472. const m_SYS_mmap = 90
  2473. const m_SYS_mount = 21
  2474. const m_SYS_mount_setattr = 442
  2475. const m_SYS_move_mount = 429
  2476. const m_SYS_move_pages = 310
  2477. const m_SYS_mprotect = 125
  2478. const m_SYS_mq_getsetattr = 276
  2479. const m_SYS_mq_notify = 275
  2480. const m_SYS_mq_open = 271
  2481. const m_SYS_mq_timedreceive = 274
  2482. const m_SYS_mq_timedsend = 273
  2483. const m_SYS_mq_unlink = 272
  2484. const m_SYS_mremap = 163
  2485. const m_SYS_msgctl = 402
  2486. const m_SYS_msgget = 399
  2487. const m_SYS_msgrcv = 401
  2488. const m_SYS_msgsnd = 400
  2489. const m_SYS_msync = 144
  2490. const m_SYS_munlock = 151
  2491. const m_SYS_munlockall = 153
  2492. const m_SYS_munmap = 91
  2493. const m_SYS_name_to_handle_at = 335
  2494. const m_SYS_nanosleep = 162
  2495. const m_SYS_newfstatat = 293
  2496. const m_SYS_nfsservctl = 169
  2497. const m_SYS_nice = 34
  2498. const m_SYS_open = 5
  2499. const m_SYS_open_by_handle_at = 336
  2500. const m_SYS_open_tree = 428
  2501. const m_SYS_openat = 288
  2502. const m_SYS_openat2 = 437
  2503. const m_SYS_pause = 29
  2504. const m_SYS_perf_event_open = 331
  2505. const m_SYS_personality = 136
  2506. const m_SYS_pidfd_getfd = 438
  2507. const m_SYS_pidfd_open = 434
  2508. const m_SYS_pidfd_send_signal = 424
  2509. const m_SYS_pipe = 42
  2510. const m_SYS_pipe2 = 325
  2511. const m_SYS_pivot_root = 217
  2512. const m_SYS_pkey_alloc = 385
  2513. const m_SYS_pkey_free = 386
  2514. const m_SYS_pkey_mprotect = 384
  2515. const m_SYS_poll = 168
  2516. const m_SYS_ppoll = 302
  2517. const m_SYS_prctl = 172
  2518. const m_SYS_pread64 = 180
  2519. const m_SYS_preadv = 328
  2520. const m_SYS_preadv2 = 376
  2521. const m_SYS_prlimit64 = 334
  2522. const m_SYS_process_madvise = 440
  2523. const m_SYS_process_mrelease = 448
  2524. const m_SYS_process_vm_readv = 340
  2525. const m_SYS_process_vm_writev = 341
  2526. const m_SYS_pselect6 = 301
  2527. const m_SYS_ptrace = 26
  2528. const m_SYS_putpmsg = 189
  2529. const m_SYS_pwrite64 = 181
  2530. const m_SYS_pwritev = 329
  2531. const m_SYS_pwritev2 = 377
  2532. const m_SYS_query_module = 167
  2533. const m_SYS_quotactl = 131
  2534. const m_SYS_read = 3
  2535. const m_SYS_readahead = 222
  2536. const m_SYS_readdir = 89
  2537. const m_SYS_readlink = 85
  2538. const m_SYS_readlinkat = 298
  2539. const m_SYS_readv = 145
  2540. const m_SYS_reboot = 88
  2541. const m_SYS_recvfrom = 371
  2542. const m_SYS_recvmmsg = 357
  2543. const m_SYS_recvmsg = 372
  2544. const m_SYS_remap_file_pages = 267
  2545. const m_SYS_removexattr = 233
  2546. const m_SYS_rename = 38
  2547. const m_SYS_renameat = 295
  2548. const m_SYS_renameat2 = 347
  2549. const m_SYS_request_key = 279
  2550. const m_SYS_restart_syscall = 7
  2551. const m_SYS_rmdir = 40
  2552. const m_SYS_rseq = 383
  2553. const m_SYS_rt_sigaction = 174
  2554. const m_SYS_rt_sigpending = 176
  2555. const m_SYS_rt_sigprocmask = 175
  2556. const m_SYS_rt_sigqueueinfo = 178
  2557. const m_SYS_rt_sigreturn = 173
  2558. const m_SYS_rt_sigsuspend = 179
  2559. const m_SYS_rt_sigtimedwait = 177
  2560. const m_SYS_rt_tgsigqueueinfo = 330
  2561. const m_SYS_s390_guarded_storage = 378
  2562. const m_SYS_s390_pci_mmio_read = 353
  2563. const m_SYS_s390_pci_mmio_write = 352
  2564. const m_SYS_s390_runtime_instr = 342
  2565. const m_SYS_s390_sthyi = 380
  2566. const m_SYS_sched_get_priority_max = 159
  2567. const m_SYS_sched_get_priority_min = 160
  2568. const m_SYS_sched_getaffinity = 240
  2569. const m_SYS_sched_getattr = 346
  2570. const m_SYS_sched_getparam = 155
  2571. const m_SYS_sched_getscheduler = 157
  2572. const m_SYS_sched_rr_get_interval = 161
  2573. const m_SYS_sched_setaffinity = 239
  2574. const m_SYS_sched_setattr = 345
  2575. const m_SYS_sched_setparam = 154
  2576. const m_SYS_sched_setscheduler = 156
  2577. const m_SYS_sched_yield = 158
  2578. const m_SYS_seccomp = 348
  2579. const m_SYS_select = 142
  2580. const m_SYS_semctl = 394
  2581. const m_SYS_semget = 393
  2582. const m_SYS_semtimedop = 392
  2583. const m_SYS_sendfile = 187
  2584. const m_SYS_sendmmsg = 358
  2585. const m_SYS_sendmsg = 370
  2586. const m_SYS_sendto = 369
  2587. const m_SYS_set_mempolicy = 270
  2588. const m_SYS_set_mempolicy_home_node = 450
  2589. const m_SYS_set_robust_list = 304
  2590. const m_SYS_set_tid_address = 252
  2591. const m_SYS_setdomainname = 121
  2592. const m_SYS_setfsgid = 216
  2593. const m_SYS_setfsuid = 215
  2594. const m_SYS_setgid = 214
  2595. const m_SYS_setgroups = 206
  2596. const m_SYS_sethostname = 74
  2597. const m_SYS_setitimer = 104
  2598. const m_SYS_setns = 339
  2599. const m_SYS_setpgid = 57
  2600. const m_SYS_setpriority = 97
  2601. const m_SYS_setregid = 204
  2602. const m_SYS_setresgid = 210
  2603. const m_SYS_setresuid = 208
  2604. const m_SYS_setreuid = 203
  2605. const m_SYS_setrlimit = 75
  2606. const m_SYS_setsid = 66
  2607. const m_SYS_setsockopt = 366
  2608. const m_SYS_settimeofday = 79
  2609. const m_SYS_setuid = 213
  2610. const m_SYS_setxattr = 224
  2611. const m_SYS_shmat = 397
  2612. const m_SYS_shmctl = 396
  2613. const m_SYS_shmdt = 398
  2614. const m_SYS_shmget = 395
  2615. const m_SYS_shutdown = 373
  2616. const m_SYS_sigaction = 67
  2617. const m_SYS_sigaltstack = 186
  2618. const m_SYS_signal = 48
  2619. const m_SYS_signalfd = 316
  2620. const m_SYS_signalfd4 = 322
  2621. const m_SYS_sigpending = 73
  2622. const m_SYS_sigprocmask = 126
  2623. const m_SYS_sigreturn = 119
  2624. const m_SYS_sigsuspend = 72
  2625. const m_SYS_socket = 359
  2626. const m_SYS_socketcall = 102
  2627. const m_SYS_socketpair = 360
  2628. const m_SYS_splice = 306
  2629. const m_SYS_stat = 106
  2630. const m_SYS_statfs = 99
  2631. const m_SYS_statfs64 = 265
  2632. const m_SYS_statx = 379
  2633. const m_SYS_swapoff = 115
  2634. const m_SYS_swapon = 87
  2635. const m_SYS_symlink = 83
  2636. const m_SYS_symlinkat = 297
  2637. const m_SYS_sync = 36
  2638. const m_SYS_sync_file_range = 307
  2639. const m_SYS_syncfs = 338
  2640. const m_SYS_sysfs = 135
  2641. const m_SYS_sysinfo = 116
  2642. const m_SYS_syslog = 103
  2643. const m_SYS_tee = 308
  2644. const m_SYS_tgkill = 241
  2645. const m_SYS_timer_create = 254
  2646. const m_SYS_timer_delete = 258
  2647. const m_SYS_timer_getoverrun = 257
  2648. const m_SYS_timer_gettime = 256
  2649. const m_SYS_timer_settime = 255
  2650. const m_SYS_timerfd = 317
  2651. const m_SYS_timerfd_create = 319
  2652. const m_SYS_timerfd_gettime = 321
  2653. const m_SYS_timerfd_settime = 320
  2654. const m_SYS_times = 43
  2655. const m_SYS_tkill = 237
  2656. const m_SYS_truncate = 92
  2657. const m_SYS_umask = 60
  2658. const m_SYS_umount = 22
  2659. const m_SYS_umount2 = 52
  2660. const m_SYS_uname = 122
  2661. const m_SYS_unlink = 10
  2662. const m_SYS_unlinkat = 294
  2663. const m_SYS_unshare = 303
  2664. const m_SYS_uselib = 86
  2665. const m_SYS_userfaultfd = 355
  2666. const m_SYS_ustat = 62
  2667. const m_SYS_utime = 30
  2668. const m_SYS_utimensat = 315
  2669. const m_SYS_utimes = 313
  2670. const m_SYS_vfork = 190
  2671. const m_SYS_vhangup = 111
  2672. const m_SYS_vmsplice = 309
  2673. const m_SYS_wait4 = 114
  2674. const m_SYS_waitid = 281
  2675. const m_SYS_write = 4
  2676. const m_SYS_writev = 146
  2677. const m_UINT_MAX1 = 4294967295
  2678. const m___NR__sysctl = 149
  2679. const m___NR_accept4 = 364
  2680. const m___NR_access = 33
  2681. const m___NR_acct = 51
  2682. const m___NR_add_key = 278
  2683. const m___NR_adjtimex = 124
  2684. const m___NR_afs_syscall = 137
  2685. const m___NR_alarm = 27
  2686. const m___NR_bdflush = 134
  2687. const m___NR_bind = 361
  2688. const m___NR_bpf = 351
  2689. const m___NR_brk = 45
  2690. const m___NR_cachestat = 451
  2691. const m___NR_capget = 184
  2692. const m___NR_capset = 185
  2693. const m___NR_chdir = 12
  2694. const m___NR_chmod = 15
  2695. const m___NR_chown = 212
  2696. const m___NR_chroot = 61
  2697. const m___NR_clock_adjtime = 337
  2698. const m___NR_clock_getres = 261
  2699. const m___NR_clock_gettime = 260
  2700. const m___NR_clock_nanosleep = 262
  2701. const m___NR_clock_settime = 259
  2702. const m___NR_clone = 120
  2703. const m___NR_clone3 = 435
  2704. const m___NR_close = 6
  2705. const m___NR_close_range = 436
  2706. const m___NR_connect = 362
  2707. const m___NR_copy_file_range = 375
  2708. const m___NR_creat = 8
  2709. const m___NR_create_module = 127
  2710. const m___NR_delete_module = 129
  2711. const m___NR_dup = 41
  2712. const m___NR_dup2 = 63
  2713. const m___NR_dup3 = 326
  2714. const m___NR_epoll_create = 249
  2715. const m___NR_epoll_create1 = 327
  2716. const m___NR_epoll_ctl = 250
  2717. const m___NR_epoll_pwait = 312
  2718. const m___NR_epoll_pwait2 = 441
  2719. const m___NR_epoll_wait = 251
  2720. const m___NR_eventfd = 318
  2721. const m___NR_eventfd2 = 323
  2722. const m___NR_execve = 11
  2723. const m___NR_execveat = 354
  2724. const m___NR_exit = 1
  2725. const m___NR_exit_group = 248
  2726. const m___NR_faccessat = 300
  2727. const m___NR_faccessat2 = 439
  2728. const m___NR_fadvise64 = 253
  2729. const m___NR_fallocate = 314
  2730. const m___NR_fanotify_init = 332
  2731. const m___NR_fanotify_mark = 333
  2732. const m___NR_fchdir = 133
  2733. const m___NR_fchmod = 94
  2734. const m___NR_fchmodat = 299
  2735. const m___NR_fchmodat2 = 452
  2736. const m___NR_fchown = 207
  2737. const m___NR_fchownat = 291
  2738. const m___NR_fcntl = 55
  2739. const m___NR_fdatasync = 148
  2740. const m___NR_fgetxattr = 229
  2741. const m___NR_finit_module = 344
  2742. const m___NR_flistxattr = 232
  2743. const m___NR_flock = 143
  2744. const m___NR_fork = 2
  2745. const m___NR_fremovexattr = 235
  2746. const m___NR_fsconfig = 431
  2747. const m___NR_fsetxattr = 226
  2748. const m___NR_fsmount = 432
  2749. const m___NR_fsopen = 430
  2750. const m___NR_fspick = 433
  2751. const m___NR_fstat = 108
  2752. const m___NR_fstatfs = 100
  2753. const m___NR_fstatfs64 = 266
  2754. const m___NR_fsync = 118
  2755. const m___NR_ftruncate = 93
  2756. const m___NR_futex = 238
  2757. const m___NR_futex_waitv = 449
  2758. const m___NR_futimesat = 292
  2759. const m___NR_get_kernel_syms = 130
  2760. const m___NR_get_mempolicy = 269
  2761. const m___NR_get_robust_list = 305
  2762. const m___NR_getcpu = 311
  2763. const m___NR_getcwd = 183
  2764. const m___NR_getdents = 141
  2765. const m___NR_getdents64 = 220
  2766. const m___NR_getegid = 202
  2767. const m___NR_geteuid = 201
  2768. const m___NR_getgid = 200
  2769. const m___NR_getgroups = 205
  2770. const m___NR_getitimer = 105
  2771. const m___NR_getpeername = 368
  2772. const m___NR_getpgid = 132
  2773. const m___NR_getpgrp = 65
  2774. const m___NR_getpid = 20
  2775. const m___NR_getpmsg = 188
  2776. const m___NR_getppid = 64
  2777. const m___NR_getpriority = 96
  2778. const m___NR_getrandom = 349
  2779. const m___NR_getresgid = 211
  2780. const m___NR_getresuid = 209
  2781. const m___NR_getrlimit = 191
  2782. const m___NR_getrusage = 77
  2783. const m___NR_getsid = 147
  2784. const m___NR_getsockname = 367
  2785. const m___NR_getsockopt = 365
  2786. const m___NR_gettid = 236
  2787. const m___NR_gettimeofday = 78
  2788. const m___NR_getuid = 199
  2789. const m___NR_getxattr = 227
  2790. const m___NR_idle = 112
  2791. const m___NR_init_module = 128
  2792. const m___NR_inotify_add_watch = 285
  2793. const m___NR_inotify_init = 284
  2794. const m___NR_inotify_init1 = 324
  2795. const m___NR_inotify_rm_watch = 286
  2796. const m___NR_io_cancel = 247
  2797. const m___NR_io_destroy = 244
  2798. const m___NR_io_getevents = 245
  2799. const m___NR_io_pgetevents = 382
  2800. const m___NR_io_setup = 243
  2801. const m___NR_io_submit = 246
  2802. const m___NR_io_uring_enter = 426
  2803. const m___NR_io_uring_register = 427
  2804. const m___NR_io_uring_setup = 425
  2805. const m___NR_ioctl = 54
  2806. const m___NR_ioprio_get = 283
  2807. const m___NR_ioprio_set = 282
  2808. const m___NR_ipc = 117
  2809. const m___NR_kcmp = 343
  2810. const m___NR_kexec_file_load = 381
  2811. const m___NR_kexec_load = 277
  2812. const m___NR_keyctl = 280
  2813. const m___NR_kill = 37
  2814. const m___NR_landlock_add_rule = 445
  2815. const m___NR_landlock_create_ruleset = 444
  2816. const m___NR_landlock_restrict_self = 446
  2817. const m___NR_lchown = 198
  2818. const m___NR_lgetxattr = 228
  2819. const m___NR_link = 9
  2820. const m___NR_linkat = 296
  2821. const m___NR_listen = 363
  2822. const m___NR_listxattr = 230
  2823. const m___NR_llistxattr = 231
  2824. const m___NR_lookup_dcookie = 110
  2825. const m___NR_lremovexattr = 234
  2826. const m___NR_lseek = 19
  2827. const m___NR_lsetxattr = 225
  2828. const m___NR_lstat = 107
  2829. const m___NR_madvise = 219
  2830. const m___NR_mbind = 268
  2831. const m___NR_membarrier = 356
  2832. const m___NR_memfd_create = 350
  2833. const m___NR_memfd_secret = 447
  2834. const m___NR_migrate_pages = 287
  2835. const m___NR_mincore = 218
  2836. const m___NR_mkdir = 39
  2837. const m___NR_mkdirat = 289
  2838. const m___NR_mknod = 14
  2839. const m___NR_mknodat = 290
  2840. const m___NR_mlock = 150
  2841. const m___NR_mlock2 = 374
  2842. const m___NR_mlockall = 152
  2843. const m___NR_mmap = 90
  2844. const m___NR_mount = 21
  2845. const m___NR_mount_setattr = 442
  2846. const m___NR_move_mount = 429
  2847. const m___NR_move_pages = 310
  2848. const m___NR_mprotect = 125
  2849. const m___NR_mq_getsetattr = 276
  2850. const m___NR_mq_notify = 275
  2851. const m___NR_mq_open = 271
  2852. const m___NR_mq_timedreceive = 274
  2853. const m___NR_mq_timedsend = 273
  2854. const m___NR_mq_unlink = 272
  2855. const m___NR_mremap = 163
  2856. const m___NR_msgctl = 402
  2857. const m___NR_msgget = 399
  2858. const m___NR_msgrcv = 401
  2859. const m___NR_msgsnd = 400
  2860. const m___NR_msync = 144
  2861. const m___NR_munlock = 151
  2862. const m___NR_munlockall = 153
  2863. const m___NR_munmap = 91
  2864. const m___NR_name_to_handle_at = 335
  2865. const m___NR_nanosleep = 162
  2866. const m___NR_newfstatat = 293
  2867. const m___NR_nfsservctl = 169
  2868. const m___NR_nice = 34
  2869. const m___NR_open = 5
  2870. const m___NR_open_by_handle_at = 336
  2871. const m___NR_open_tree = 428
  2872. const m___NR_openat = 288
  2873. const m___NR_openat2 = 437
  2874. const m___NR_pause = 29
  2875. const m___NR_perf_event_open = 331
  2876. const m___NR_personality = 136
  2877. const m___NR_pidfd_getfd = 438
  2878. const m___NR_pidfd_open = 434
  2879. const m___NR_pidfd_send_signal = 424
  2880. const m___NR_pipe = 42
  2881. const m___NR_pipe2 = 325
  2882. const m___NR_pivot_root = 217
  2883. const m___NR_pkey_alloc = 385
  2884. const m___NR_pkey_free = 386
  2885. const m___NR_pkey_mprotect = 384
  2886. const m___NR_poll = 168
  2887. const m___NR_ppoll = 302
  2888. const m___NR_prctl = 172
  2889. const m___NR_pread64 = 180
  2890. const m___NR_preadv = 328
  2891. const m___NR_preadv2 = 376
  2892. const m___NR_prlimit64 = 334
  2893. const m___NR_process_madvise = 440
  2894. const m___NR_process_mrelease = 448
  2895. const m___NR_process_vm_readv = 340
  2896. const m___NR_process_vm_writev = 341
  2897. const m___NR_pselect6 = 301
  2898. const m___NR_ptrace = 26
  2899. const m___NR_putpmsg = 189
  2900. const m___NR_pwrite64 = 181
  2901. const m___NR_pwritev = 329
  2902. const m___NR_pwritev2 = 377
  2903. const m___NR_query_module = 167
  2904. const m___NR_quotactl = 131
  2905. const m___NR_read = 3
  2906. const m___NR_readahead = 222
  2907. const m___NR_readdir = 89
  2908. const m___NR_readlink = 85
  2909. const m___NR_readlinkat = 298
  2910. const m___NR_readv = 145
  2911. const m___NR_reboot = 88
  2912. const m___NR_recvfrom = 371
  2913. const m___NR_recvmmsg = 357
  2914. const m___NR_recvmsg = 372
  2915. const m___NR_remap_file_pages = 267
  2916. const m___NR_removexattr = 233
  2917. const m___NR_rename = 38
  2918. const m___NR_renameat = 295
  2919. const m___NR_renameat2 = 347
  2920. const m___NR_request_key = 279
  2921. const m___NR_restart_syscall = 7
  2922. const m___NR_rmdir = 40
  2923. const m___NR_rseq = 383
  2924. const m___NR_rt_sigaction = 174
  2925. const m___NR_rt_sigpending = 176
  2926. const m___NR_rt_sigprocmask = 175
  2927. const m___NR_rt_sigqueueinfo = 178
  2928. const m___NR_rt_sigreturn = 173
  2929. const m___NR_rt_sigsuspend = 179
  2930. const m___NR_rt_sigtimedwait = 177
  2931. const m___NR_rt_tgsigqueueinfo = 330
  2932. const m___NR_s390_guarded_storage = 378
  2933. const m___NR_s390_pci_mmio_read = 353
  2934. const m___NR_s390_pci_mmio_write = 352
  2935. const m___NR_s390_runtime_instr = 342
  2936. const m___NR_s390_sthyi = 380
  2937. const m___NR_sched_get_priority_max = 159
  2938. const m___NR_sched_get_priority_min = 160
  2939. const m___NR_sched_getaffinity = 240
  2940. const m___NR_sched_getattr = 346
  2941. const m___NR_sched_getparam = 155
  2942. const m___NR_sched_getscheduler = 157
  2943. const m___NR_sched_rr_get_interval = 161
  2944. const m___NR_sched_setaffinity = 239
  2945. const m___NR_sched_setattr = 345
  2946. const m___NR_sched_setparam = 154
  2947. const m___NR_sched_setscheduler = 156
  2948. const m___NR_sched_yield = 158
  2949. const m___NR_seccomp = 348
  2950. const m___NR_select = 142
  2951. const m___NR_semctl = 394
  2952. const m___NR_semget = 393
  2953. const m___NR_semtimedop = 392
  2954. const m___NR_sendfile = 187
  2955. const m___NR_sendmmsg = 358
  2956. const m___NR_sendmsg = 370
  2957. const m___NR_sendto = 369
  2958. const m___NR_set_mempolicy = 270
  2959. const m___NR_set_mempolicy_home_node = 450
  2960. const m___NR_set_robust_list = 304
  2961. const m___NR_set_tid_address = 252
  2962. const m___NR_setdomainname = 121
  2963. const m___NR_setfsgid = 216
  2964. const m___NR_setfsuid = 215
  2965. const m___NR_setgid = 214
  2966. const m___NR_setgroups = 206
  2967. const m___NR_sethostname = 74
  2968. const m___NR_setitimer = 104
  2969. const m___NR_setns = 339
  2970. const m___NR_setpgid = 57
  2971. const m___NR_setpriority = 97
  2972. const m___NR_setregid = 204
  2973. const m___NR_setresgid = 210
  2974. const m___NR_setresuid = 208
  2975. const m___NR_setreuid = 203
  2976. const m___NR_setrlimit = 75
  2977. const m___NR_setsid = 66
  2978. const m___NR_setsockopt = 366
  2979. const m___NR_settimeofday = 79
  2980. const m___NR_setuid = 213
  2981. const m___NR_setxattr = 224
  2982. const m___NR_shmat = 397
  2983. const m___NR_shmctl = 396
  2984. const m___NR_shmdt = 398
  2985. const m___NR_shmget = 395
  2986. const m___NR_shutdown = 373
  2987. const m___NR_sigaction = 67
  2988. const m___NR_sigaltstack = 186
  2989. const m___NR_signal = 48
  2990. const m___NR_signalfd = 316
  2991. const m___NR_signalfd4 = 322
  2992. const m___NR_sigpending = 73
  2993. const m___NR_sigprocmask = 126
  2994. const m___NR_sigreturn = 119
  2995. const m___NR_sigsuspend = 72
  2996. const m___NR_socket = 359
  2997. const m___NR_socketcall = 102
  2998. const m___NR_socketpair = 360
  2999. const m___NR_splice = 306
  3000. const m___NR_stat = 106
  3001. const m___NR_statfs = 99
  3002. const m___NR_statfs64 = 265
  3003. const m___NR_statx = 379
  3004. const m___NR_swapoff = 115
  3005. const m___NR_swapon = 87
  3006. const m___NR_symlink = 83
  3007. const m___NR_symlinkat = 297
  3008. const m___NR_sync = 36
  3009. const m___NR_sync_file_range = 307
  3010. const m___NR_syncfs = 338
  3011. const m___NR_sysfs = 135
  3012. const m___NR_sysinfo = 116
  3013. const m___NR_syslog = 103
  3014. const m___NR_tee = 308
  3015. const m___NR_tgkill = 241
  3016. const m___NR_timer_create = 254
  3017. const m___NR_timer_delete = 258
  3018. const m___NR_timer_getoverrun = 257
  3019. const m___NR_timer_gettime = 256
  3020. const m___NR_timer_settime = 255
  3021. const m___NR_timerfd = 317
  3022. const m___NR_timerfd_create = 319
  3023. const m___NR_timerfd_gettime = 321
  3024. const m___NR_timerfd_settime = 320
  3025. const m___NR_times = 43
  3026. const m___NR_tkill = 237
  3027. const m___NR_truncate = 92
  3028. const m___NR_umask = 60
  3029. const m___NR_umount = 22
  3030. const m___NR_umount2 = 52
  3031. const m___NR_uname = 122
  3032. const m___NR_unlink = 10
  3033. const m___NR_unlinkat = 294
  3034. const m___NR_unshare = 303
  3035. const m___NR_uselib = 86
  3036. const m___NR_userfaultfd = 355
  3037. const m___NR_ustat = 62
  3038. const m___NR_utime = 30
  3039. const m___NR_utimensat = 315
  3040. const m___NR_utimes = 313
  3041. const m___NR_vfork = 190
  3042. const m___NR_vhangup = 111
  3043. const m___NR_vmsplice = 309
  3044. const m___NR_wait4 = 114
  3045. const m___NR_waitid = 281
  3046. const m___NR_write = 4
  3047. const m___NR_writev = 146
  3048. const m_d_fileno = "d_ino"
  3049. type Tdirent = struct {
  3050. Fd_ino Tino_t
  3051. Fd_off Toff_t
  3052. Fd_reclen uint16
  3053. Fd_type uint8
  3054. Fd_name [256]uint8
  3055. }
  3056. func _closefrom_close(tls *libc.TLS, fd int32) {
  3057. libc.Xclose(tls, fd)
  3058. }
  3059. func _sys_close_range(tls *libc.TLS, fd uint32, max_fd uint32, flags uint32) (r int32) {
  3060. bp := tls.Alloc(32)
  3061. defer tls.Free(32)
  3062. return int32(libc.Xsyscall(tls, int64(m_SYS_close_range), libc.VaList(bp+8, fd, max_fd, flags)))
  3063. }
  3064. // C documentation
  3065. //
  3066. // /*
  3067. // * Close all file descriptors greater than or equal to lowfd.
  3068. // * This is the expensive (fallback) method.
  3069. // */
  3070. func Xclosefrom_fallback(tls *libc.TLS, lowfd int32) {
  3071. var fd, maxfd int64
  3072. _, _ = fd, maxfd
  3073. /*
  3074. * Fall back on sysconf(_SC_OPEN_MAX) or getdtablesize(). This is
  3075. * equivalent to checking the RLIMIT_NOFILE soft limit. It is
  3076. * possible for there to be open file descriptors past this limit
  3077. * but there is not much we can do about that since the hard limit
  3078. * may be RLIM_INFINITY (LLONG_MAX or ULLONG_MAX on modern systems).
  3079. */
  3080. maxfd = libc.Xsysconf(tls, int32(m__SC_OPEN_MAX))
  3081. if maxfd < int64(m_OPEN_MAX) {
  3082. maxfd = int64(m_OPEN_MAX)
  3083. }
  3084. /* Make sure we did not get RLIM_INFINITY as the upper limit. */
  3085. if maxfd > int64(m_INT_MAX1) {
  3086. maxfd = int64(m_INT_MAX1)
  3087. }
  3088. fd = int64(lowfd)
  3089. for {
  3090. if !(fd < maxfd) {
  3091. break
  3092. }
  3093. _closefrom_close(tls, int32(fd))
  3094. goto _1
  3095. _1:
  3096. ;
  3097. fd++
  3098. }
  3099. }
  3100. func _closefrom_procfs(tls *libc.TLS, lowfd int32) (r int32) {
  3101. bp := tls.Alloc(16)
  3102. defer tls.Free(16)
  3103. var dent, dirp, fd_array, path, ptr, v1 uintptr
  3104. var fd, fd_array_size, fd_array_used, i, ret, v2 int32
  3105. var _ /* errstr at bp+0 */ uintptr
  3106. _, _, _, _, _, _, _, _, _, _, _, _ = dent, dirp, fd, fd_array, fd_array_size, fd_array_used, i, path, ptr, ret, v1, v2
  3107. fd_array = libc.UintptrFromInt32(0)
  3108. fd_array_used = 0
  3109. fd_array_size = 0
  3110. ret = 0
  3111. /* Use /proc/self/fd (or /dev/fd on macOS) if it exists. */
  3112. path = __ccgo_ts
  3113. dirp = libc.Xopendir(tls, path)
  3114. if dirp == libc.UintptrFromInt32(0) {
  3115. return -int32(1)
  3116. }
  3117. for {
  3118. v1 = libc.Xreaddir(tls, dirp)
  3119. dent = v1
  3120. if !(v1 != libc.UintptrFromInt32(0)) {
  3121. break
  3122. }
  3123. fd = int32(Xstrtonum(tls, dent+19, int64(lowfd), int64(m_INT_MAX1), bp))
  3124. if *(*uintptr)(unsafe.Pointer(bp)) != libc.UintptrFromInt32(0) || fd == libc.Xdirfd(tls, dirp) {
  3125. continue
  3126. }
  3127. if fd_array_used >= fd_array_size {
  3128. if fd_array_size > 0 {
  3129. fd_array_size *= int32(2)
  3130. } else {
  3131. fd_array_size = int32(32)
  3132. }
  3133. ptr = Xreallocarray(tls, fd_array, libc.Uint64FromInt32(fd_array_size), uint64(4))
  3134. if ptr == libc.UintptrFromInt32(0) {
  3135. ret = -int32(1)
  3136. break
  3137. }
  3138. fd_array = ptr
  3139. }
  3140. v2 = fd_array_used
  3141. fd_array_used++
  3142. *(*int32)(unsafe.Pointer(fd_array + uintptr(v2)*4)) = fd
  3143. }
  3144. i = 0
  3145. for {
  3146. if !(i < fd_array_used) {
  3147. break
  3148. }
  3149. _closefrom_close(tls, *(*int32)(unsafe.Pointer(fd_array + uintptr(i)*4)))
  3150. goto _3
  3151. _3:
  3152. ;
  3153. i++
  3154. }
  3155. libc.Xfree(tls, fd_array)
  3156. libc.Xclosedir(tls, dirp)
  3157. return ret
  3158. }
  3159. // C documentation
  3160. //
  3161. // /*
  3162. // * Close all file descriptors greater than or equal to lowfd.
  3163. // * We try the fast way first, falling back on the slow method.
  3164. // */
  3165. func Xclosefrom(tls *libc.TLS, lowfd int32) {
  3166. if lowfd < 0 {
  3167. lowfd = 0
  3168. }
  3169. /* Try the fast methods first, if possible. */
  3170. if _sys_close_range(tls, libc.Uint32FromInt32(lowfd), uint32(0xffffffff), uint32(0)) == 0 {
  3171. return
  3172. }
  3173. if _closefrom_procfs(tls, lowfd) != -int32(1) {
  3174. return
  3175. }
  3176. /* Do things the slow way. */
  3177. Xclosefrom_fallback(tls, lowfd)
  3178. }
  3179. const m_INT64_MAX1 = 9223372036854775807
  3180. func Xdehumanize_number(tls *libc.TLS, buf uintptr, num uintptr) (r int32) {
  3181. bp := tls.Alloc(16)
  3182. defer tls.Free(16)
  3183. var rc, sign, v1, v2 int32
  3184. var rmax Tuint64_t
  3185. var _ /* rval at bp+0 */ Tuint64_t
  3186. _, _, _, _, _ = rc, rmax, sign, v1, v2
  3187. sign = +libc.Int32FromInt32(1)
  3188. /* The current expand_number() implementation uses bit shifts, so
  3189. * we cannot pass negative numbers, preserve the sign and apply it
  3190. * later. */
  3191. for {
  3192. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(buf)))
  3193. v2 = libc.BoolInt32(v1 == int32(' ') || libc.Uint32FromInt32(v1)-uint32('\t') < uint32(5))
  3194. goto _3
  3195. _3:
  3196. if !(v2 != 0) {
  3197. break
  3198. }
  3199. buf++
  3200. }
  3201. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(buf))) == int32('-') {
  3202. sign = -int32(1)
  3203. buf++
  3204. }
  3205. rc = Xexpand_number(tls, buf, bp)
  3206. if rc < 0 {
  3207. return rc
  3208. }
  3209. /* The sign has been stripped, so rval has the absolute value.
  3210. * Error out, regardless of the sign, if rval is greater than
  3211. * abs(INT64_MIN) (== INT64_MAX + 1), or if the sign is positive
  3212. * and the value has overflown by one (INT64_MAX + 1). */
  3213. rmax = uint64(libc.Uint64FromInt64(libc.Int64FromInt64(m_INT64_MAX1)) + libc.Uint64FromUint64(1))
  3214. if *(*Tuint64_t)(unsafe.Pointer(bp)) > rmax || *(*Tuint64_t)(unsafe.Pointer(bp)) == rmax && sign == +libc.Int32FromInt32(1) {
  3215. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ERANGE)
  3216. return -int32(1)
  3217. }
  3218. *(*Tint64_t)(unsafe.Pointer(num)) = libc.Int64FromUint64(*(*Tuint64_t)(unsafe.Pointer(bp)) * libc.Uint64FromInt32(sign))
  3219. return 0
  3220. }
  3221. const m_INT64_MAX2 = 0x7fffffffffffffff
  3222. /*
  3223. * Copyright © 2004-2005, 2009, 2011-2013 Guillem Jover <guillem@hadrons.org>
  3224. *
  3225. * Redistribution and use in source and binary forms, with or without
  3226. * modification, are permitted provided that the following conditions
  3227. * are met:
  3228. * 1. Redistributions of source code must retain the above copyright
  3229. * notice, this list of conditions and the following disclaimer.
  3230. * 2. Redistributions in binary form must reproduce the above copyright
  3231. * notice, this list of conditions and the following disclaimer in the
  3232. * documentation and/or other materials provided with the distribution.
  3233. * 3. The name of the author may not be used to endorse or promote products
  3234. * derived from this software without specific prior written permission.
  3235. *
  3236. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  3237. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  3238. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  3239. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  3240. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  3241. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  3242. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  3243. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  3244. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  3245. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  3246. */
  3247. func Xvwarnc(tls *libc.TLS, code int32, format uintptr, ap Tva_list) {
  3248. bp := tls.Alloc(16)
  3249. defer tls.Free(16)
  3250. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+14, libc.VaList(bp+8, Xgetprogname(tls)))
  3251. if format != 0 {
  3252. libc.Xvfprintf(tls, libc.Xstderr, format, ap)
  3253. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+19, 0)
  3254. }
  3255. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+22, libc.VaList(bp+8, libc.Xstrerror(tls, code)))
  3256. }
  3257. func Xwarnc(tls *libc.TLS, code int32, format uintptr, va uintptr) {
  3258. var ap Tva_list
  3259. _ = ap
  3260. ap = va
  3261. Xvwarnc(tls, code, format, ap)
  3262. _ = ap
  3263. }
  3264. func Xverrc(tls *libc.TLS, status int32, code int32, format uintptr, ap Tva_list) {
  3265. bp := tls.Alloc(16)
  3266. defer tls.Free(16)
  3267. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+14, libc.VaList(bp+8, Xgetprogname(tls)))
  3268. if format != 0 {
  3269. libc.Xvfprintf(tls, libc.Xstderr, format, ap)
  3270. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+19, 0)
  3271. }
  3272. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+22, libc.VaList(bp+8, libc.Xstrerror(tls, code)))
  3273. libc.Xexit(tls, status)
  3274. }
  3275. func Xerrc(tls *libc.TLS, status int32, code int32, format uintptr, va uintptr) {
  3276. var ap Tva_list
  3277. _ = ap
  3278. ap = va
  3279. Xverrc(tls, status, code, format, ap)
  3280. _ = ap
  3281. }
  3282. const m_PRIX16 = "X"
  3283. const m_PRIX32 = "X"
  3284. const m_PRIX8 = "X"
  3285. const m_PRIXFAST16 = "X"
  3286. const m_PRIXFAST32 = "X"
  3287. const m_PRIXFAST8 = "X"
  3288. const m_PRIXLEAST16 = "X"
  3289. const m_PRIXLEAST32 = "X"
  3290. const m_PRIXLEAST8 = "X"
  3291. const m_PRId16 = "d"
  3292. const m_PRId32 = "d"
  3293. const m_PRId8 = "d"
  3294. const m_PRIdFAST16 = "d"
  3295. const m_PRIdFAST32 = "d"
  3296. const m_PRIdFAST8 = "d"
  3297. const m_PRIdLEAST16 = "d"
  3298. const m_PRIdLEAST32 = "d"
  3299. const m_PRIdLEAST8 = "d"
  3300. const m_PRIi16 = "i"
  3301. const m_PRIi32 = "i"
  3302. const m_PRIi8 = "i"
  3303. const m_PRIiFAST16 = "i"
  3304. const m_PRIiFAST32 = "i"
  3305. const m_PRIiFAST8 = "i"
  3306. const m_PRIiLEAST16 = "i"
  3307. const m_PRIiLEAST32 = "i"
  3308. const m_PRIiLEAST8 = "i"
  3309. const m_PRIo16 = "o"
  3310. const m_PRIo32 = "o"
  3311. const m_PRIo8 = "o"
  3312. const m_PRIoFAST16 = "o"
  3313. const m_PRIoFAST32 = "o"
  3314. const m_PRIoFAST8 = "o"
  3315. const m_PRIoLEAST16 = "o"
  3316. const m_PRIoLEAST32 = "o"
  3317. const m_PRIoLEAST8 = "o"
  3318. const m_PRIu16 = "u"
  3319. const m_PRIu32 = "u"
  3320. const m_PRIu8 = "u"
  3321. const m_PRIuFAST16 = "u"
  3322. const m_PRIuFAST32 = "u"
  3323. const m_PRIuFAST8 = "u"
  3324. const m_PRIuLEAST16 = "u"
  3325. const m_PRIuLEAST32 = "u"
  3326. const m_PRIuLEAST8 = "u"
  3327. const m_PRIx16 = "x"
  3328. const m_PRIx32 = "x"
  3329. const m_PRIx8 = "x"
  3330. const m_PRIxFAST16 = "x"
  3331. const m_PRIxFAST32 = "x"
  3332. const m_PRIxFAST8 = "x"
  3333. const m_PRIxLEAST16 = "x"
  3334. const m_PRIxLEAST32 = "x"
  3335. const m_PRIxLEAST8 = "x"
  3336. const m_SCNd16 = "hd"
  3337. const m_SCNd32 = "d"
  3338. const m_SCNd8 = "hhd"
  3339. const m_SCNdFAST16 = "d"
  3340. const m_SCNdFAST32 = "d"
  3341. const m_SCNdFAST8 = "hhd"
  3342. const m_SCNdLEAST16 = "hd"
  3343. const m_SCNdLEAST32 = "d"
  3344. const m_SCNdLEAST8 = "hhd"
  3345. const m_SCNi16 = "hi"
  3346. const m_SCNi32 = "i"
  3347. const m_SCNi8 = "hhi"
  3348. const m_SCNiFAST16 = "i"
  3349. const m_SCNiFAST32 = "i"
  3350. const m_SCNiFAST8 = "hhi"
  3351. const m_SCNiLEAST16 = "hi"
  3352. const m_SCNiLEAST32 = "i"
  3353. const m_SCNiLEAST8 = "hhi"
  3354. const m_SCNo16 = "ho"
  3355. const m_SCNo32 = "o"
  3356. const m_SCNo8 = "hho"
  3357. const m_SCNoFAST16 = "o"
  3358. const m_SCNoFAST32 = "o"
  3359. const m_SCNoFAST8 = "hho"
  3360. const m_SCNoLEAST16 = "ho"
  3361. const m_SCNoLEAST32 = "o"
  3362. const m_SCNoLEAST8 = "hho"
  3363. const m_SCNu16 = "hu"
  3364. const m_SCNu32 = "u"
  3365. const m_SCNu8 = "hhu"
  3366. const m_SCNuFAST16 = "u"
  3367. const m_SCNuFAST32 = "u"
  3368. const m_SCNuFAST8 = "hhu"
  3369. const m_SCNuLEAST16 = "hu"
  3370. const m_SCNuLEAST32 = "u"
  3371. const m_SCNuLEAST8 = "hhu"
  3372. const m_SCNx16 = "hx"
  3373. const m_SCNx32 = "x"
  3374. const m_SCNx8 = "hhx"
  3375. const m_SCNxFAST16 = "x"
  3376. const m_SCNxFAST32 = "x"
  3377. const m_SCNxFAST8 = "hhx"
  3378. const m_SCNxLEAST16 = "hx"
  3379. const m_SCNxLEAST32 = "x"
  3380. const m_SCNxLEAST8 = "hhx"
  3381. const m___PRI64 = "l"
  3382. const m___PRIPTR = "l"
  3383. type Timaxdiv_t = struct {
  3384. Fquot Tintmax_t
  3385. Frem Tintmax_t
  3386. }
  3387. /* Values for humanize_number(3)'s flags parameter. */
  3388. /* Values for humanize_number(3)'s scale parameter. */
  3389. /*
  3390. * fparseln() specific operation flags.
  3391. */
  3392. // C documentation
  3393. //
  3394. // /*
  3395. // * Convert an expression of the following forms to a uint64_t.
  3396. // * 1) A positive decimal number.
  3397. // * 2) A positive decimal number followed by a 'b' or 'B' (mult by 1).
  3398. // * 3) A positive decimal number followed by a 'k' or 'K' (mult by 1 << 10).
  3399. // * 4) A positive decimal number followed by a 'm' or 'M' (mult by 1 << 20).
  3400. // * 5) A positive decimal number followed by a 'g' or 'G' (mult by 1 << 30).
  3401. // * 6) A positive decimal number followed by a 't' or 'T' (mult by 1 << 40).
  3402. // * 7) A positive decimal number followed by a 'p' or 'P' (mult by 1 << 50).
  3403. // * 8) A positive decimal number followed by a 'e' or 'E' (mult by 1 << 60).
  3404. // */
  3405. func Xexpand_number(tls *libc.TLS, buf uintptr, num uintptr) (r int32) {
  3406. bp := tls.Alloc(16)
  3407. defer tls.Free(16)
  3408. var number Tuint64_t
  3409. var shift uint32
  3410. var _ /* endptr at bp+0 */ uintptr
  3411. _, _ = number, shift
  3412. number = libc.Xstrtoumax(tls, buf, bp, 0)
  3413. if *(*uintptr)(unsafe.Pointer(bp)) == buf {
  3414. /* No valid digits. */
  3415. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  3416. return -int32(1)
  3417. }
  3418. switch libc.Xtolower(tls, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))) {
  3419. case int32('e'):
  3420. shift = uint32(60)
  3421. case int32('p'):
  3422. shift = uint32(50)
  3423. case int32('t'):
  3424. shift = uint32(40)
  3425. case int32('g'):
  3426. shift = uint32(30)
  3427. case int32('m'):
  3428. shift = uint32(20)
  3429. case int32('k'):
  3430. shift = uint32(10)
  3431. case int32('b'):
  3432. fallthrough
  3433. case int32('\000'): /* No unit. */
  3434. *(*Tuint64_t)(unsafe.Pointer(num)) = number
  3435. return 0
  3436. default:
  3437. /* Unrecognized unit. */
  3438. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  3439. return -int32(1)
  3440. }
  3441. if number<<shift>>shift != number {
  3442. /* Overflow */
  3443. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ERANGE)
  3444. return -int32(1)
  3445. }
  3446. *(*Tuint64_t)(unsafe.Pointer(num)) = number << shift
  3447. return 0
  3448. }
  3449. func X__explicit_bzero_hook(tls *libc.TLS, buf uintptr, len1 Tsize_t) {
  3450. }
  3451. func Xexplicit_bzero(tls *libc.TLS, buf uintptr, len1 Tsize_t) {
  3452. libc.Xmemset(tls, buf, 0, len1)
  3453. X__explicit_bzero_hook(tls, buf, len1)
  3454. }
  3455. const m_FILEBUF_POOL_ITEMS = 32
  3456. /*
  3457. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  3458. *
  3459. * Redistribution and use in source and binary forms, with or without
  3460. * modification, are permitted provided that the following conditions
  3461. * are met:
  3462. * 1. Redistributions of source code must retain the above copyright
  3463. * notice, this list of conditions and the following disclaimer.
  3464. * 2. Redistributions in binary form must reproduce the above copyright
  3465. * notice, this list of conditions and the following disclaimer in the
  3466. * documentation and/or other materials provided with the distribution.
  3467. * 3. The name of the author may not be used to endorse or promote products
  3468. * derived from this software without specific prior written permission.
  3469. *
  3470. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  3471. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  3472. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  3473. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  3474. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  3475. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  3476. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  3477. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  3478. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  3479. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  3480. */
  3481. type Tfilebuf = struct {
  3482. Ffp uintptr
  3483. Fbuf uintptr
  3484. Flen1 Tsize_t
  3485. }
  3486. var _fb_pool [32]Tfilebuf
  3487. var _fb_pool_cur int32
  3488. func Xfgetln(tls *libc.TLS, stream uintptr, len1 uintptr) (r uintptr) {
  3489. var fb uintptr
  3490. var nread Tssize_t
  3491. _, _ = fb, nread
  3492. libc.Xflockfile(tls, stream)
  3493. /* Try to diminish the possibility of several fgetln() calls being
  3494. * used on different streams, by using a pool of buffers per file. */
  3495. fb = uintptr(unsafe.Pointer(&_fb_pool)) + uintptr(_fb_pool_cur)*24
  3496. if (*Tfilebuf)(unsafe.Pointer(fb)).Ffp != stream && (*Tfilebuf)(unsafe.Pointer(fb)).Ffp != libc.UintptrFromInt32(0) {
  3497. _fb_pool_cur++
  3498. _fb_pool_cur %= int32(m_FILEBUF_POOL_ITEMS)
  3499. fb = uintptr(unsafe.Pointer(&_fb_pool)) + uintptr(_fb_pool_cur)*24
  3500. }
  3501. (*Tfilebuf)(unsafe.Pointer(fb)).Ffp = stream
  3502. nread = libc.Xgetline(tls, fb+8, fb+16, stream)
  3503. libc.Xfunlockfile(tls, stream)
  3504. /* Note: the getdelim/getline API ensures nread != 0. */
  3505. if nread == int64(-int32(1)) {
  3506. *(*Tsize_t)(unsafe.Pointer(len1)) = uint64(0)
  3507. return libc.UintptrFromInt32(0)
  3508. } else {
  3509. *(*Tsize_t)(unsafe.Pointer(len1)) = libc.Uint64FromInt64(nread)
  3510. return (*Tfilebuf)(unsafe.Pointer(fb)).Fbuf
  3511. }
  3512. return r
  3513. }
  3514. var _libbsd_emit_link_warning_fgetln = [107]uint8{'T', 'h', 'i', 's', ' ', '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', '.'}
  3515. func Xfreezero(tls *libc.TLS, ptr uintptr, sz Tsize_t) {
  3516. /* This is legal. */
  3517. if ptr == libc.UintptrFromInt32(0) {
  3518. return
  3519. }
  3520. Xexplicit_bzero(tls, ptr, sz)
  3521. libc.Xfree(tls, ptr)
  3522. }
  3523. const m_FILEWBUF_INIT_LEN = 128
  3524. const m_FILEWBUF_POOL_ITEMS = 32
  3525. type Twint_t = uint32
  3526. type Twctype_t = uint64
  3527. type Tmbstate_t = struct {
  3528. F__opaque1 uint32
  3529. F__opaque2 uint32
  3530. }
  3531. type t__mbstate_t = Tmbstate_t
  3532. type Tmax_align_t = struct {
  3533. F__ll int64
  3534. F__ld float64
  3535. }
  3536. type Tptrdiff_t = int64
  3537. /*
  3538. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  3539. *
  3540. * Redistribution and use in source and binary forms, with or without
  3541. * modification, are permitted provided that the following conditions
  3542. * are met:
  3543. * 1. Redistributions of source code must retain the above copyright
  3544. * notice, this list of conditions and the following disclaimer.
  3545. * 2. Redistributions in binary form must reproduce the above copyright
  3546. * notice, this list of conditions and the following disclaimer in the
  3547. * documentation and/or other materials provided with the distribution.
  3548. * 3. The name of the author may not be used to endorse or promote products
  3549. * derived from this software without specific prior written permission.
  3550. *
  3551. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  3552. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  3553. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  3554. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  3555. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  3556. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  3557. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  3558. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  3559. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  3560. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  3561. */
  3562. type Tfilewbuf = struct {
  3563. Ffp uintptr
  3564. Fwbuf uintptr
  3565. Flen1 Tsize_t
  3566. }
  3567. var _fb_pool1 [32]Tfilewbuf
  3568. var _fb_pool_cur1 int32
  3569. func Xfgetwln(tls *libc.TLS, stream uintptr, lenp uintptr) (r uintptr) {
  3570. var fb, wp, v3 uintptr
  3571. var wc, v1 Twint_t
  3572. var wused, v2 Tsize_t
  3573. _, _, _, _, _, _, _ = fb, wc, wp, wused, v1, v2, v3
  3574. wused = uint64(0)
  3575. /* Try to diminish the possibility of several fgetwln() calls being
  3576. * used on different streams, by using a pool of buffers per file. */
  3577. fb = uintptr(unsafe.Pointer(&_fb_pool1)) + uintptr(_fb_pool_cur1)*24
  3578. if (*Tfilewbuf)(unsafe.Pointer(fb)).Ffp != stream && (*Tfilewbuf)(unsafe.Pointer(fb)).Ffp != libc.UintptrFromInt32(0) {
  3579. _fb_pool_cur1++
  3580. _fb_pool_cur1 %= int32(m_FILEWBUF_POOL_ITEMS)
  3581. fb = uintptr(unsafe.Pointer(&_fb_pool1)) + uintptr(_fb_pool_cur1)*24
  3582. }
  3583. (*Tfilewbuf)(unsafe.Pointer(fb)).Ffp = stream
  3584. for {
  3585. v1 = libc.Xfgetwc(tls, stream)
  3586. wc = v1
  3587. if !(v1 != uint32(0xffffffff)) {
  3588. break
  3589. }
  3590. if !((*Tfilewbuf)(unsafe.Pointer(fb)).Flen1 != 0) || wused >= (*Tfilewbuf)(unsafe.Pointer(fb)).Flen1 {
  3591. if (*Tfilewbuf)(unsafe.Pointer(fb)).Flen1 != 0 {
  3592. *(*Tsize_t)(unsafe.Pointer(fb + 16)) *= uint64(2)
  3593. } else {
  3594. (*Tfilewbuf)(unsafe.Pointer(fb)).Flen1 = uint64(m_FILEWBUF_INIT_LEN)
  3595. }
  3596. wp = Xreallocarray(tls, (*Tfilewbuf)(unsafe.Pointer(fb)).Fwbuf, (*Tfilewbuf)(unsafe.Pointer(fb)).Flen1, uint64(4))
  3597. if wp == libc.UintptrFromInt32(0) {
  3598. wused = uint64(0)
  3599. break
  3600. }
  3601. (*Tfilewbuf)(unsafe.Pointer(fb)).Fwbuf = wp
  3602. }
  3603. v2 = wused
  3604. wused++
  3605. *(*Twchar_t)(unsafe.Pointer((*Tfilewbuf)(unsafe.Pointer(fb)).Fwbuf + uintptr(v2)*4)) = libc.Int32FromUint32(wc)
  3606. if wc == uint32('\n') {
  3607. break
  3608. }
  3609. }
  3610. *(*Tsize_t)(unsafe.Pointer(lenp)) = wused
  3611. if wused != 0 {
  3612. v3 = (*Tfilewbuf)(unsafe.Pointer(fb)).Fwbuf
  3613. } else {
  3614. v3 = libc.UintptrFromInt32(0)
  3615. }
  3616. return v3
  3617. }
  3618. var _libbsd_emit_link_warning_fgetwln = [106]uint8{'T', 'h', 'i', 's', ' ', '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', '.'}
  3619. const m_LOCK_EX = 2
  3620. const m_LOCK_NB = 4
  3621. const m_LOCK_SH = 1
  3622. const m_LOCK_UN = 8
  3623. const m_O_CREAT1 = 64
  3624. const m_O_NONBLOCK1 = 2048
  3625. const m_O_TRUNC1 = 512
  3626. /* Values for humanize_number(3)'s flags parameter. */
  3627. /* Values for humanize_number(3)'s scale parameter. */
  3628. /*
  3629. * fparseln() specific operation flags.
  3630. */
  3631. // C documentation
  3632. //
  3633. // /*
  3634. // * Reliably open and lock a file.
  3635. // *
  3636. // * Please do not modify this code without first reading the revision history
  3637. // * and discussing your changes with <des@freebsd.org>. Don't be fooled by the
  3638. // * code's apparent simplicity; there would be no need for this function if it
  3639. // * was easy to get right.
  3640. // */
  3641. func _vflopenat(tls *libc.TLS, dirfd int32, path uintptr, flags int32, ap Tva_list) (r int32) {
  3642. bp := tls.Alloc(304)
  3643. defer tls.Free(304)
  3644. var fd, operation, serrno, trunc, v2 int32
  3645. var mode Tmode_t
  3646. var _ /* fsb at bp+144 */ Tstat
  3647. var _ /* sb at bp+0 */ Tstat
  3648. _, _, _, _, _, _ = fd, mode, operation, serrno, trunc, v2
  3649. mode = uint32(0)
  3650. if flags&int32(m_O_CREAT1) != 0 {
  3651. mode = libc.Uint32FromInt32(libc.VaInt32(&ap)) /* mode_t promoted to int */
  3652. }
  3653. operation = int32(m_LOCK_EX)
  3654. if flags&int32(m_O_NONBLOCK1) != 0 {
  3655. operation |= int32(m_LOCK_NB)
  3656. }
  3657. trunc = flags & int32(m_O_TRUNC1)
  3658. flags &= ^libc.Int32FromInt32(m_O_TRUNC1)
  3659. for {
  3660. v2 = libc.Xopenat(tls, dirfd, path, flags, libc.VaList(bp+296, mode))
  3661. fd = v2
  3662. if v2 == -int32(1) {
  3663. /* non-existent or no access */
  3664. return -int32(1)
  3665. }
  3666. if libc.Xflock(tls, fd, operation) == -int32(1) {
  3667. /* unsupported or interrupted */
  3668. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  3669. libc.Xclose(tls, fd)
  3670. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  3671. return -int32(1)
  3672. }
  3673. if libc.Xfstatat(tls, dirfd, path, bp, 0) == -int32(1) {
  3674. /* disappeared from under our feet */
  3675. libc.Xclose(tls, fd)
  3676. goto _1
  3677. }
  3678. if libc.Xfstat(tls, fd, bp+144) == -int32(1) {
  3679. /* can't happen [tm] */
  3680. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  3681. libc.Xclose(tls, fd)
  3682. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  3683. return -int32(1)
  3684. }
  3685. if (*(*Tstat)(unsafe.Pointer(bp))).Fst_dev != (*(*Tstat)(unsafe.Pointer(bp + 144))).Fst_dev || (*(*Tstat)(unsafe.Pointer(bp))).Fst_ino != (*(*Tstat)(unsafe.Pointer(bp + 144))).Fst_ino {
  3686. /* changed under our feet */
  3687. libc.Xclose(tls, fd)
  3688. goto _1
  3689. }
  3690. if trunc != 0 && libc.Xftruncate(tls, fd, 0) != 0 {
  3691. /* can't happen [tm] */
  3692. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  3693. libc.Xclose(tls, fd)
  3694. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  3695. return -int32(1)
  3696. }
  3697. /*
  3698. * The following change is provided as a specific example to
  3699. * avoid.
  3700. */
  3701. return fd
  3702. goto _1
  3703. _1:
  3704. }
  3705. return r
  3706. }
  3707. func Xflopen(tls *libc.TLS, path uintptr, flags int32, va uintptr) (r int32) {
  3708. var ap Tva_list
  3709. var ret int32
  3710. _, _ = ap, ret
  3711. ap = va
  3712. ret = _vflopenat(tls, -int32(100), path, flags, ap)
  3713. _ = ap
  3714. return ret
  3715. }
  3716. func Xflopenat(tls *libc.TLS, dirfd int32, path uintptr, flags int32, va uintptr) (r int32) {
  3717. var ap Tva_list
  3718. var ret int32
  3719. _, _ = ap, ret
  3720. ap = va
  3721. ret = _vflopenat(tls, dirfd, path, flags, ap)
  3722. _ = ap
  3723. return ret
  3724. }
  3725. type ___e_fmtcheck_types = int32
  3726. const _FMTCHECK_START = 0
  3727. const _FMTCHECK_SHORT = 1
  3728. const _FMTCHECK_INT = 2
  3729. const _FMTCHECK_WINTT = 3
  3730. const _FMTCHECK_LONG = 4
  3731. const _FMTCHECK_QUAD = 5
  3732. const _FMTCHECK_INTMAXT = 6
  3733. const _FMTCHECK_PTRDIFFT = 7
  3734. const _FMTCHECK_SIZET = 8
  3735. const _FMTCHECK_POINTER = 9
  3736. const _FMTCHECK_CHARPOINTER = 10
  3737. const _FMTCHECK_SHORTPOINTER = 11
  3738. const _FMTCHECK_INTPOINTER = 12
  3739. const _FMTCHECK_LONGPOINTER = 13
  3740. const _FMTCHECK_QUADPOINTER = 14
  3741. const _FMTCHECK_INTMAXTPOINTER = 15
  3742. const _FMTCHECK_PTRDIFFTPOINTER = 16
  3743. const _FMTCHECK_SIZETPOINTER = 17
  3744. const _FMTCHECK_DOUBLE = 18
  3745. const _FMTCHECK_LONGDOUBLE = 19
  3746. const _FMTCHECK_STRING = 20
  3747. const _FMTCHECK_WSTRING = 21
  3748. const _FMTCHECK_WIDTH = 22
  3749. const _FMTCHECK_PRECISION = 23
  3750. const _FMTCHECK_DONE = 24
  3751. const _FMTCHECK_UNKNOWN = 25
  3752. type TEFT = int32
  3753. type _e_modifier = int32
  3754. const _MOD_NONE = 0
  3755. const _MOD_CHAR = 1
  3756. const _MOD_SHORT = 2
  3757. const _MOD_LONG = 3
  3758. const _MOD_QUAD = 4
  3759. const _MOD_INTMAXT = 5
  3760. const _MOD_LONGDOUBLE = 6
  3761. const _MOD_PTRDIFFT = 7
  3762. const _MOD_SIZET = 8
  3763. func _get_next_format_from_precision(tls *libc.TLS, pf uintptr) (r TEFT) {
  3764. var f uintptr
  3765. var modifier _e_modifier
  3766. _, _ = f, modifier
  3767. f = *(*uintptr)(unsafe.Pointer(pf))
  3768. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) {
  3769. case int32('h'):
  3770. f++
  3771. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  3772. *(*uintptr)(unsafe.Pointer(pf)) = f
  3773. return int32(_FMTCHECK_UNKNOWN)
  3774. }
  3775. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('h') {
  3776. f++
  3777. modifier = int32(_MOD_CHAR)
  3778. } else {
  3779. modifier = int32(_MOD_SHORT)
  3780. }
  3781. case int32('j'):
  3782. f++
  3783. modifier = int32(_MOD_INTMAXT)
  3784. case int32('l'):
  3785. f++
  3786. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  3787. *(*uintptr)(unsafe.Pointer(pf)) = f
  3788. return int32(_FMTCHECK_UNKNOWN)
  3789. }
  3790. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('l') {
  3791. f++
  3792. modifier = int32(_MOD_QUAD)
  3793. } else {
  3794. modifier = int32(_MOD_LONG)
  3795. }
  3796. case int32('q'):
  3797. f++
  3798. modifier = int32(_MOD_QUAD)
  3799. case int32('t'):
  3800. f++
  3801. modifier = int32(_MOD_PTRDIFFT)
  3802. case int32('z'):
  3803. f++
  3804. modifier = int32(_MOD_SIZET)
  3805. case int32('L'):
  3806. f++
  3807. modifier = int32(_MOD_LONGDOUBLE)
  3808. default:
  3809. modifier = int32(_MOD_NONE)
  3810. break
  3811. }
  3812. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  3813. *(*uintptr)(unsafe.Pointer(pf)) = f
  3814. return int32(_FMTCHECK_UNKNOWN)
  3815. }
  3816. if libc.Xstrchr(tls, __ccgo_ts+26, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f)))) != 0 {
  3817. switch modifier {
  3818. case int32(_MOD_LONG):
  3819. goto _1
  3820. case int32(_MOD_QUAD):
  3821. goto _2
  3822. case int32(_MOD_INTMAXT):
  3823. goto _3
  3824. case int32(_MOD_PTRDIFFT):
  3825. goto _4
  3826. case int32(_MOD_SIZET):
  3827. goto _5
  3828. case int32(_MOD_NONE):
  3829. goto _6
  3830. case int32(_MOD_SHORT):
  3831. goto _7
  3832. case int32(_MOD_CHAR):
  3833. goto _8
  3834. default:
  3835. goto _9
  3836. }
  3837. goto _10
  3838. _1:
  3839. ;
  3840. _13:
  3841. ;
  3842. *(*uintptr)(unsafe.Pointer(pf)) = f
  3843. return int32(_FMTCHECK_LONG)
  3844. goto _12
  3845. _12:
  3846. ;
  3847. if 0 != 0 {
  3848. goto _13
  3849. }
  3850. goto _11
  3851. _11:
  3852. ;
  3853. _2:
  3854. ;
  3855. *(*uintptr)(unsafe.Pointer(pf)) = f
  3856. return int32(_FMTCHECK_QUAD)
  3857. _3:
  3858. ;
  3859. *(*uintptr)(unsafe.Pointer(pf)) = f
  3860. return int32(_FMTCHECK_INTMAXT)
  3861. _4:
  3862. ;
  3863. *(*uintptr)(unsafe.Pointer(pf)) = f
  3864. return int32(_FMTCHECK_PTRDIFFT)
  3865. _5:
  3866. ;
  3867. *(*uintptr)(unsafe.Pointer(pf)) = f
  3868. return int32(_FMTCHECK_SIZET)
  3869. _8:
  3870. ;
  3871. _7:
  3872. ;
  3873. _6:
  3874. ;
  3875. *(*uintptr)(unsafe.Pointer(pf)) = f
  3876. return int32(_FMTCHECK_INT)
  3877. _9:
  3878. ;
  3879. *(*uintptr)(unsafe.Pointer(pf)) = f
  3880. return int32(_FMTCHECK_UNKNOWN)
  3881. _10:
  3882. }
  3883. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('n') {
  3884. switch modifier {
  3885. case int32(_MOD_CHAR):
  3886. goto _14
  3887. case int32(_MOD_SHORT):
  3888. goto _15
  3889. case int32(_MOD_LONG):
  3890. goto _16
  3891. case int32(_MOD_QUAD):
  3892. goto _17
  3893. case int32(_MOD_INTMAXT):
  3894. goto _18
  3895. case int32(_MOD_PTRDIFFT):
  3896. goto _19
  3897. case int32(_MOD_SIZET):
  3898. goto _20
  3899. case int32(_MOD_NONE):
  3900. goto _21
  3901. default:
  3902. goto _22
  3903. }
  3904. goto _23
  3905. _14:
  3906. ;
  3907. _26:
  3908. ;
  3909. *(*uintptr)(unsafe.Pointer(pf)) = f
  3910. return int32(_FMTCHECK_CHARPOINTER)
  3911. goto _25
  3912. _25:
  3913. ;
  3914. if 0 != 0 {
  3915. goto _26
  3916. }
  3917. goto _24
  3918. _24:
  3919. ;
  3920. _15:
  3921. ;
  3922. *(*uintptr)(unsafe.Pointer(pf)) = f
  3923. return int32(_FMTCHECK_SHORTPOINTER)
  3924. _16:
  3925. ;
  3926. *(*uintptr)(unsafe.Pointer(pf)) = f
  3927. return int32(_FMTCHECK_LONGPOINTER)
  3928. _17:
  3929. ;
  3930. *(*uintptr)(unsafe.Pointer(pf)) = f
  3931. return int32(_FMTCHECK_QUADPOINTER)
  3932. _18:
  3933. ;
  3934. *(*uintptr)(unsafe.Pointer(pf)) = f
  3935. return int32(_FMTCHECK_INTMAXTPOINTER)
  3936. _19:
  3937. ;
  3938. *(*uintptr)(unsafe.Pointer(pf)) = f
  3939. return int32(_FMTCHECK_PTRDIFFTPOINTER)
  3940. _20:
  3941. ;
  3942. *(*uintptr)(unsafe.Pointer(pf)) = f
  3943. return int32(_FMTCHECK_SIZETPOINTER)
  3944. _21:
  3945. ;
  3946. *(*uintptr)(unsafe.Pointer(pf)) = f
  3947. return int32(_FMTCHECK_INTPOINTER)
  3948. _22:
  3949. ;
  3950. *(*uintptr)(unsafe.Pointer(pf)) = f
  3951. return int32(_FMTCHECK_UNKNOWN)
  3952. _23:
  3953. }
  3954. if libc.Xstrchr(tls, __ccgo_ts+33, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f)))) != 0 {
  3955. if modifier != int32(_MOD_NONE) {
  3956. *(*uintptr)(unsafe.Pointer(pf)) = f
  3957. return int32(_FMTCHECK_UNKNOWN)
  3958. }
  3959. *(*uintptr)(unsafe.Pointer(pf)) = f
  3960. return int32(_FMTCHECK_LONG)
  3961. }
  3962. if libc.Xstrchr(tls, __ccgo_ts+37, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f)))) != 0 {
  3963. switch modifier {
  3964. case int32(_MOD_LONGDOUBLE):
  3965. goto _27
  3966. case int32(_MOD_NONE):
  3967. goto _28
  3968. case int32(_MOD_LONG):
  3969. goto _29
  3970. default:
  3971. goto _30
  3972. }
  3973. goto _31
  3974. _27:
  3975. ;
  3976. _34:
  3977. ;
  3978. *(*uintptr)(unsafe.Pointer(pf)) = f
  3979. return int32(_FMTCHECK_LONGDOUBLE)
  3980. goto _33
  3981. _33:
  3982. ;
  3983. if 0 != 0 {
  3984. goto _34
  3985. }
  3986. goto _32
  3987. _32:
  3988. ;
  3989. _29:
  3990. ;
  3991. _28:
  3992. ;
  3993. *(*uintptr)(unsafe.Pointer(pf)) = f
  3994. return int32(_FMTCHECK_DOUBLE)
  3995. _30:
  3996. ;
  3997. *(*uintptr)(unsafe.Pointer(pf)) = f
  3998. return int32(_FMTCHECK_UNKNOWN)
  3999. _31:
  4000. }
  4001. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('c') {
  4002. switch modifier {
  4003. case int32(_MOD_LONG):
  4004. goto _35
  4005. case int32(_MOD_NONE):
  4006. goto _36
  4007. default:
  4008. goto _37
  4009. }
  4010. goto _38
  4011. _35:
  4012. ;
  4013. _41:
  4014. ;
  4015. *(*uintptr)(unsafe.Pointer(pf)) = f
  4016. return int32(_FMTCHECK_WINTT)
  4017. goto _40
  4018. _40:
  4019. ;
  4020. if 0 != 0 {
  4021. goto _41
  4022. }
  4023. goto _39
  4024. _39:
  4025. ;
  4026. _36:
  4027. ;
  4028. *(*uintptr)(unsafe.Pointer(pf)) = f
  4029. return int32(_FMTCHECK_INT)
  4030. _37:
  4031. ;
  4032. *(*uintptr)(unsafe.Pointer(pf)) = f
  4033. return int32(_FMTCHECK_UNKNOWN)
  4034. _38:
  4035. }
  4036. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('C') {
  4037. if modifier != int32(_MOD_NONE) {
  4038. *(*uintptr)(unsafe.Pointer(pf)) = f
  4039. return int32(_FMTCHECK_UNKNOWN)
  4040. }
  4041. *(*uintptr)(unsafe.Pointer(pf)) = f
  4042. return int32(_FMTCHECK_WINTT)
  4043. }
  4044. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('s') {
  4045. switch modifier {
  4046. case int32(_MOD_LONG):
  4047. goto _42
  4048. case int32(_MOD_NONE):
  4049. goto _43
  4050. default:
  4051. goto _44
  4052. }
  4053. goto _45
  4054. _42:
  4055. ;
  4056. _48:
  4057. ;
  4058. *(*uintptr)(unsafe.Pointer(pf)) = f
  4059. return int32(_FMTCHECK_WSTRING)
  4060. goto _47
  4061. _47:
  4062. ;
  4063. if 0 != 0 {
  4064. goto _48
  4065. }
  4066. goto _46
  4067. _46:
  4068. ;
  4069. _43:
  4070. ;
  4071. *(*uintptr)(unsafe.Pointer(pf)) = f
  4072. return int32(_FMTCHECK_STRING)
  4073. _44:
  4074. ;
  4075. *(*uintptr)(unsafe.Pointer(pf)) = f
  4076. return int32(_FMTCHECK_UNKNOWN)
  4077. _45:
  4078. }
  4079. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('S') {
  4080. if modifier != int32(_MOD_NONE) {
  4081. *(*uintptr)(unsafe.Pointer(pf)) = f
  4082. return int32(_FMTCHECK_UNKNOWN)
  4083. }
  4084. *(*uintptr)(unsafe.Pointer(pf)) = f
  4085. return int32(_FMTCHECK_WSTRING)
  4086. }
  4087. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('p') {
  4088. if modifier != int32(_MOD_NONE) {
  4089. *(*uintptr)(unsafe.Pointer(pf)) = f
  4090. return int32(_FMTCHECK_UNKNOWN)
  4091. }
  4092. *(*uintptr)(unsafe.Pointer(pf)) = f
  4093. return int32(_FMTCHECK_POINTER)
  4094. }
  4095. *(*uintptr)(unsafe.Pointer(pf)) = f
  4096. return int32(_FMTCHECK_UNKNOWN)
  4097. /*NOTREACHED*/
  4098. return r
  4099. }
  4100. func _get_next_format_from_width(tls *libc.TLS, pf uintptr) (r TEFT) {
  4101. var f uintptr
  4102. _ = f
  4103. f = *(*uintptr)(unsafe.Pointer(pf))
  4104. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('.') {
  4105. f++
  4106. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('*') {
  4107. *(*uintptr)(unsafe.Pointer(pf)) = f
  4108. return int32(_FMTCHECK_PRECISION)
  4109. }
  4110. /* eat any precision (empty is allowed) */
  4111. for libc.BoolInt32(uint32(*(*uint8)(unsafe.Pointer(f)))-uint32('0') < uint32(10)) != 0 {
  4112. f++
  4113. }
  4114. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  4115. *(*uintptr)(unsafe.Pointer(pf)) = f
  4116. return int32(_FMTCHECK_UNKNOWN)
  4117. }
  4118. }
  4119. *(*uintptr)(unsafe.Pointer(pf)) = f
  4120. return _get_next_format_from_precision(tls, pf)
  4121. /*NOTREACHED*/
  4122. return r
  4123. }
  4124. func _get_next_format(tls *libc.TLS, pf uintptr, eft TEFT) (r TEFT) {
  4125. var f uintptr
  4126. var infmt int32
  4127. _, _ = f, infmt
  4128. if eft == int32(_FMTCHECK_WIDTH) {
  4129. *(*uintptr)(unsafe.Pointer(pf))++
  4130. return _get_next_format_from_width(tls, pf)
  4131. } else {
  4132. if eft == int32(_FMTCHECK_PRECISION) {
  4133. *(*uintptr)(unsafe.Pointer(pf))++
  4134. return _get_next_format_from_precision(tls, pf)
  4135. }
  4136. }
  4137. f = *(*uintptr)(unsafe.Pointer(pf))
  4138. infmt = 0
  4139. for !(infmt != 0) {
  4140. f = libc.Xstrchr(tls, f, int32('%'))
  4141. if f == libc.UintptrFromInt32(0) {
  4142. *(*uintptr)(unsafe.Pointer(pf)) = f
  4143. return int32(_FMTCHECK_DONE)
  4144. }
  4145. f++
  4146. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  4147. *(*uintptr)(unsafe.Pointer(pf)) = f
  4148. return int32(_FMTCHECK_UNKNOWN)
  4149. }
  4150. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) != int32('%') {
  4151. infmt = int32(1)
  4152. } else {
  4153. f++
  4154. }
  4155. }
  4156. /* Eat any of the flags */
  4157. for *(*uint8)(unsafe.Pointer(f)) != 0 && libc.Xstrchr(tls, __ccgo_ts+46, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f)))) != 0 {
  4158. f++
  4159. }
  4160. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('*') {
  4161. *(*uintptr)(unsafe.Pointer(pf)) = f
  4162. return int32(_FMTCHECK_WIDTH)
  4163. }
  4164. /* eat any width */
  4165. for libc.BoolInt32(uint32(*(*uint8)(unsafe.Pointer(f)))-uint32('0') < uint32(10)) != 0 {
  4166. f++
  4167. }
  4168. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  4169. *(*uintptr)(unsafe.Pointer(pf)) = f
  4170. return int32(_FMTCHECK_UNKNOWN)
  4171. }
  4172. *(*uintptr)(unsafe.Pointer(pf)) = f
  4173. return _get_next_format_from_width(tls, pf)
  4174. /*NOTREACHED*/
  4175. return r
  4176. }
  4177. func Xfmtcheck(tls *libc.TLS, f1 uintptr, f2 uintptr) (r uintptr) {
  4178. bp := tls.Alloc(16)
  4179. defer tls.Free(16)
  4180. var f1t, f2t, v1 TEFT
  4181. var _ /* f1p at bp+0 */ uintptr
  4182. var _ /* f2p at bp+8 */ uintptr
  4183. _, _, _ = f1t, f2t, v1
  4184. if !(f1 != 0) {
  4185. return f2
  4186. }
  4187. *(*uintptr)(unsafe.Pointer(bp)) = f1
  4188. f1t = int32(_FMTCHECK_START)
  4189. *(*uintptr)(unsafe.Pointer(bp + 8)) = f2
  4190. f2t = int32(_FMTCHECK_START)
  4191. for {
  4192. v1 = _get_next_format(tls, bp, f1t)
  4193. f1t = v1
  4194. if !(v1 != int32(_FMTCHECK_DONE)) {
  4195. break
  4196. }
  4197. if f1t == int32(_FMTCHECK_UNKNOWN) {
  4198. return f2
  4199. }
  4200. f2t = _get_next_format(tls, bp+8, f2t)
  4201. if f1t != f2t {
  4202. return f2
  4203. }
  4204. }
  4205. return f1
  4206. }
  4207. const m_FPARSELN_UNESCALL1 = 15
  4208. const m_FPARSELN_UNESCCOMM1 = 4
  4209. const m_FPARSELN_UNESCCONT1 = 2
  4210. const m_FPARSELN_UNESCESC1 = 1
  4211. const m_FPARSELN_UNESCREST1 = 8
  4212. const m_static_assert = "_Static_assert"
  4213. // C documentation
  4214. //
  4215. // /* isescaped():
  4216. // * Return true if the character in *p that belongs to a string
  4217. // * that starts in *sp, is escaped by the escape character esc.
  4218. // */
  4219. func _isescaped(tls *libc.TLS, sp uintptr, p uintptr, esc int32) (r int32) {
  4220. var cp, v2 uintptr
  4221. var ne Tsize_t
  4222. _, _, _ = cp, ne, v2
  4223. /* No escape character */
  4224. if esc == int32('\000') {
  4225. return 0
  4226. }
  4227. /* Count the number of escape characters that precede ours */
  4228. ne = uint64(0)
  4229. cp = p
  4230. for {
  4231. cp--
  4232. v2 = cp
  4233. if !(v2 >= sp && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) == esc) {
  4234. break
  4235. }
  4236. goto _1
  4237. goto _1
  4238. _1:
  4239. ;
  4240. ne++
  4241. }
  4242. /* Return true if odd number of escape characters */
  4243. return libc.BoolInt32(ne&uint64(1) != uint64(0))
  4244. }
  4245. // C documentation
  4246. //
  4247. // /* fparseln():
  4248. // * Read a line from a file parsing continuations ending in * and eliminating trailing newlines, or comments starting with
  4249. // * the comment char.
  4250. // */
  4251. func Xfparseln(tls *libc.TLS, fp uintptr, size uintptr, lineno uintptr, str uintptr, flags int32) (r uintptr) {
  4252. bp := tls.Alloc(16)
  4253. defer tls.Free(16)
  4254. var buf, cp, v2, v3, v4, v5, v6, v7, v8, v9 uintptr
  4255. var cnt, skipesc int32
  4256. var com, con, esc, nl uint8
  4257. var len1 Tsize_t
  4258. var s Tssize_t
  4259. var _ /* ptr at bp+8 */ uintptr
  4260. var _ /* ptrlen at bp+0 */ Tsize_t
  4261. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = buf, cnt, com, con, cp, esc, len1, nl, s, skipesc, v2, v3, v4, v5, v6, v7, v8, v9
  4262. len1 = uint64(0)
  4263. buf = libc.UintptrFromInt32(0)
  4264. *(*Tsize_t)(unsafe.Pointer(bp)) = uint64(0)
  4265. *(*uintptr)(unsafe.Pointer(bp + 8)) = libc.UintptrFromInt32(0)
  4266. cnt = int32(1)
  4267. if str == libc.UintptrFromInt32(0) {
  4268. str = uintptr(unsafe.Pointer(&_dstr))
  4269. }
  4270. esc = *(*uint8)(unsafe.Pointer(str))
  4271. con = *(*uint8)(unsafe.Pointer(str + 1))
  4272. com = *(*uint8)(unsafe.Pointer(str + 2))
  4273. /*
  4274. * XXX: it would be cool to be able to specify the newline character,
  4275. * getdelim(3) does let us, but supporting it would diverge from BSDs.
  4276. */
  4277. nl = uint8('\n')
  4278. libc.Xflockfile(tls, fp)
  4279. for cnt != 0 {
  4280. cnt = 0
  4281. if lineno != 0 {
  4282. *(*Tsize_t)(unsafe.Pointer(lineno))++
  4283. }
  4284. s = libc.Xgetline(tls, bp+8, bp, fp)
  4285. if s < 0 {
  4286. break
  4287. }
  4288. if s != 0 && com != 0 { /* Check and eliminate comments */
  4289. cp = *(*uintptr)(unsafe.Pointer(bp + 8))
  4290. for {
  4291. if !(cp < *(*uintptr)(unsafe.Pointer(bp + 8))+uintptr(s)) {
  4292. break
  4293. }
  4294. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) == libc.Int32FromUint8(com) && !(_isescaped(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), cp, libc.Int32FromUint8(esc)) != 0) {
  4295. s = int64(cp) - int64(*(*uintptr)(unsafe.Pointer(bp + 8)))
  4296. cnt = libc.BoolInt32(s == 0 && buf == libc.UintptrFromInt32(0))
  4297. break
  4298. }
  4299. goto _1
  4300. _1:
  4301. ;
  4302. cp++
  4303. }
  4304. }
  4305. if s != 0 && nl != 0 { /* Check and eliminate newlines */
  4306. cp = *(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(s-int64(1))
  4307. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) == libc.Int32FromUint8(nl) {
  4308. s--
  4309. } /* forget newline */
  4310. }
  4311. if s != 0 && con != 0 { /* Check and eliminate continuations */
  4312. cp = *(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(s-int64(1))
  4313. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) == libc.Int32FromUint8(con) && !(_isescaped(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), cp, libc.Int32FromUint8(esc)) != 0) {
  4314. s-- /* forget continuation char */
  4315. cnt = int32(1)
  4316. }
  4317. }
  4318. if s == 0 {
  4319. /*
  4320. * nothing to add, skip realloc except in case
  4321. * we need a minimal buf to return an empty line
  4322. */
  4323. if cnt != 0 || buf != libc.UintptrFromInt32(0) {
  4324. continue
  4325. }
  4326. }
  4327. v2 = libc.Xrealloc(tls, buf, len1+libc.Uint64FromInt64(s)+uint64(1))
  4328. cp = v2
  4329. if v2 == libc.UintptrFromInt32(0) {
  4330. libc.Xfunlockfile(tls, fp)
  4331. libc.Xfree(tls, buf)
  4332. libc.Xfree(tls, *(*uintptr)(unsafe.Pointer(bp + 8)))
  4333. return libc.UintptrFromInt32(0)
  4334. }
  4335. buf = cp
  4336. libc.Xmemcpy(tls, buf+uintptr(len1), *(*uintptr)(unsafe.Pointer(bp + 8)), libc.Uint64FromInt64(s))
  4337. len1 += libc.Uint64FromInt64(s)
  4338. *(*uint8)(unsafe.Pointer(buf + uintptr(len1))) = uint8('\000')
  4339. }
  4340. libc.Xfunlockfile(tls, fp)
  4341. libc.Xfree(tls, *(*uintptr)(unsafe.Pointer(bp + 8)))
  4342. if flags&int32(m_FPARSELN_UNESCALL1) != 0 && esc != 0 && buf != libc.UintptrFromInt32(0) && libc.Xstrchr(tls, buf, libc.Int32FromUint8(esc)) != libc.UintptrFromInt32(0) {
  4343. v3 = buf
  4344. cp = v3
  4345. *(*uintptr)(unsafe.Pointer(bp + 8)) = v3
  4346. for libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) != int32('\000') {
  4347. for libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) != int32('\000') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) != libc.Int32FromUint8(esc) {
  4348. v4 = *(*uintptr)(unsafe.Pointer(bp + 8))
  4349. *(*uintptr)(unsafe.Pointer(bp + 8))++
  4350. v5 = cp
  4351. cp++
  4352. *(*uint8)(unsafe.Pointer(v4)) = *(*uint8)(unsafe.Pointer(v5))
  4353. }
  4354. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) == int32('\000') || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + 1))) == int32('\000') {
  4355. break
  4356. }
  4357. skipesc = 0
  4358. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + 1))) == libc.Int32FromUint8(com) {
  4359. skipesc += flags & int32(m_FPARSELN_UNESCCOMM1)
  4360. }
  4361. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + 1))) == libc.Int32FromUint8(con) {
  4362. skipesc += flags & int32(m_FPARSELN_UNESCCONT1)
  4363. }
  4364. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + 1))) == libc.Int32FromUint8(esc) {
  4365. skipesc += flags & int32(m_FPARSELN_UNESCESC1)
  4366. }
  4367. 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) {
  4368. skipesc = flags & int32(m_FPARSELN_UNESCREST1)
  4369. }
  4370. if skipesc != 0 {
  4371. cp++
  4372. } else {
  4373. v6 = *(*uintptr)(unsafe.Pointer(bp + 8))
  4374. *(*uintptr)(unsafe.Pointer(bp + 8))++
  4375. v7 = cp
  4376. cp++
  4377. *(*uint8)(unsafe.Pointer(v6)) = *(*uint8)(unsafe.Pointer(v7))
  4378. }
  4379. v8 = *(*uintptr)(unsafe.Pointer(bp + 8))
  4380. *(*uintptr)(unsafe.Pointer(bp + 8))++
  4381. v9 = cp
  4382. cp++
  4383. *(*uint8)(unsafe.Pointer(v8)) = *(*uint8)(unsafe.Pointer(v9))
  4384. }
  4385. *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))) = uint8('\000')
  4386. len1 = libc.Xstrlen(tls, buf)
  4387. }
  4388. if size != 0 {
  4389. *(*Tsize_t)(unsafe.Pointer(size)) = len1
  4390. }
  4391. return buf
  4392. }
  4393. var _dstr = [3]uint8{
  4394. 0: uint8('\\'),
  4395. 1: uint8('\\'),
  4396. 2: uint8('#'),
  4397. }
  4398. const m_FSETLOCKING_BYCALLER = 2
  4399. const m_FSETLOCKING_INTERNAL = 1
  4400. const m_FSETLOCKING_QUERY = 0
  4401. func Xfpurge(tls *libc.TLS, fp uintptr) (r int32) {
  4402. if fp == libc.UintptrFromInt32(0) || libc.Xfileno(tls, fp) < 0 {
  4403. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EBADF)
  4404. return -int32(1)
  4405. }
  4406. libc.X__fpurge(tls, fp)
  4407. return 0
  4408. }
  4409. const m_FPARSELN_UNESCALL2 = 0x0f
  4410. const m_FPARSELN_UNESCCOMM2 = 0x04
  4411. const m_FPARSELN_UNESCCONT2 = 0x02
  4412. const m_FPARSELN_UNESCESC2 = 0x01
  4413. const m_FPARSELN_UNESCREST2 = 0x08
  4414. const m_KB = 1024
  4415. const m_MAXB = "GB"
  4416. func Xgetbsize(tls *libc.TLS, headerlenp uintptr, blocksizep uintptr) (r uintptr) {
  4417. bp := tls.Alloc(32)
  4418. defer tls.Free(32)
  4419. var blocksize, max, mul, n, v15, v16, v17, v4 int64
  4420. var form, p, v3 uintptr
  4421. var _ /* ep at bp+0 */ uintptr
  4422. _, _, _, _, _, _, _, _, _, _, _ = blocksize, form, max, mul, n, p, v15, v16, v17, v3, v4
  4423. form = __ccgo_ts + 53
  4424. v3 = libc.Xgetenv(tls, __ccgo_ts+54)
  4425. p = v3
  4426. if !(v3 != libc.UintptrFromInt32(0) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) != int32('\000')) {
  4427. goto _1
  4428. }
  4429. v4 = libc.Xstrtol(tls, p, bp, int32(10))
  4430. n = v4
  4431. if v4 < 0 {
  4432. goto underflow
  4433. }
  4434. if n == 0 {
  4435. n = int64(1)
  4436. }
  4437. if *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))) != 0 && *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)) != 0 {
  4438. goto fmterr
  4439. }
  4440. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) {
  4441. case int32('g'):
  4442. goto _5
  4443. case int32('G'):
  4444. goto _6
  4445. case int32('k'):
  4446. goto _7
  4447. case int32('K'):
  4448. goto _8
  4449. case int32('m'):
  4450. goto _9
  4451. case int32('M'):
  4452. goto _10
  4453. case int32('\000'):
  4454. goto _11
  4455. default:
  4456. goto _12
  4457. }
  4458. goto _13
  4459. _6:
  4460. ;
  4461. _5:
  4462. ;
  4463. form = __ccgo_ts + 64
  4464. max = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) / (libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024))
  4465. mul = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024)
  4466. goto _13
  4467. _8:
  4468. ;
  4469. _7:
  4470. ;
  4471. form = __ccgo_ts + 66
  4472. max = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) / libc.Int64FromInt64(1024)
  4473. mul = int64(1024)
  4474. goto _13
  4475. _10:
  4476. ;
  4477. _9:
  4478. ;
  4479. form = __ccgo_ts + 68
  4480. max = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) / (libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024))
  4481. mul = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024)
  4482. goto _13
  4483. _11:
  4484. ;
  4485. max = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024)
  4486. mul = int64(1)
  4487. goto _13
  4488. _12:
  4489. ;
  4490. goto fmterr
  4491. fmterr:
  4492. ;
  4493. libc.Xwarnx(tls, __ccgo_ts+70, libc.VaList(bp+16, p))
  4494. n = int64(512)
  4495. max = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024)
  4496. mul = int64(1)
  4497. goto _13
  4498. _13:
  4499. ;
  4500. if n > max {
  4501. 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))))
  4502. n = max
  4503. }
  4504. v15 = n * mul
  4505. blocksize = v15
  4506. if !(v15 < int64(512)) {
  4507. goto _14
  4508. }
  4509. goto underflow
  4510. underflow:
  4511. ;
  4512. libc.Xwarnx(tls, __ccgo_ts+118, 0)
  4513. form = __ccgo_ts + 53
  4514. v16 = libc.Int64FromInt32(512)
  4515. n = v16
  4516. blocksize = v16
  4517. _14:
  4518. ;
  4519. goto _2
  4520. _1:
  4521. ;
  4522. v17 = libc.Int64FromInt32(512)
  4523. n = v17
  4524. blocksize = v17
  4525. _2:
  4526. ;
  4527. libc.X__builtin_snprintf(tls, uintptr(unsafe.Pointer(&_header)), uint64(20), __ccgo_ts+143, libc.VaList(bp+16, n, form))
  4528. *(*int32)(unsafe.Pointer(headerlenp)) = libc.Int32FromUint64(libc.Xstrlen(tls, uintptr(unsafe.Pointer(&_header))))
  4529. *(*int64)(unsafe.Pointer(blocksizep)) = blocksize
  4530. return uintptr(unsafe.Pointer(&_header))
  4531. }
  4532. var _header [20]uint8
  4533. const m_AF_ALG = "PF_ALG"
  4534. const m_AF_APPLETALK = "PF_APPLETALK"
  4535. const m_AF_ASH = "PF_ASH"
  4536. const m_AF_ATMPVC = "PF_ATMPVC"
  4537. const m_AF_ATMSVC = "PF_ATMSVC"
  4538. const m_AF_AX25 = "PF_AX25"
  4539. const m_AF_BLUETOOTH = "PF_BLUETOOTH"
  4540. const m_AF_BRIDGE = "PF_BRIDGE"
  4541. const m_AF_CAIF = "PF_CAIF"
  4542. const m_AF_CAN = "PF_CAN"
  4543. const m_AF_DECnet = "PF_DECnet"
  4544. const m_AF_ECONET = "PF_ECONET"
  4545. const m_AF_FILE = "AF_LOCAL"
  4546. const m_AF_IB = "PF_IB"
  4547. const m_AF_IEEE802154 = "PF_IEEE802154"
  4548. const m_AF_INET = "PF_INET"
  4549. const m_AF_INET6 = "PF_INET6"
  4550. const m_AF_IPX = "PF_IPX"
  4551. const m_AF_IRDA = "PF_IRDA"
  4552. const m_AF_ISDN = "PF_ISDN"
  4553. const m_AF_IUCV = "PF_IUCV"
  4554. const m_AF_KCM = "PF_KCM"
  4555. const m_AF_KEY = "PF_KEY"
  4556. const m_AF_LLC = "PF_LLC"
  4557. const m_AF_LOCAL = "PF_LOCAL"
  4558. const m_AF_MAX = "PF_MAX"
  4559. const m_AF_MPLS = "PF_MPLS"
  4560. const m_AF_NETBEUI = "PF_NETBEUI"
  4561. const m_AF_NETLINK = "PF_NETLINK"
  4562. const m_AF_NETROM = "PF_NETROM"
  4563. const m_AF_NFC = "PF_NFC"
  4564. const m_AF_PACKET = "PF_PACKET"
  4565. const m_AF_PHONET = "PF_PHONET"
  4566. const m_AF_PPPOX = "PF_PPPOX"
  4567. const m_AF_QIPCRTR = "PF_QIPCRTR"
  4568. const m_AF_RDS = "PF_RDS"
  4569. const m_AF_ROSE = "PF_ROSE"
  4570. const m_AF_ROUTE = "PF_ROUTE"
  4571. const m_AF_RXRPC = "PF_RXRPC"
  4572. const m_AF_SECURITY = "PF_SECURITY"
  4573. const m_AF_SMC = "PF_SMC"
  4574. const m_AF_SNA = "PF_SNA"
  4575. const m_AF_TIPC = "PF_TIPC"
  4576. const m_AF_UNIX = "AF_LOCAL"
  4577. const m_AF_UNSPEC = "PF_UNSPEC"
  4578. const m_AF_VSOCK = "PF_VSOCK"
  4579. const m_AF_WANPIPE = "PF_WANPIPE"
  4580. const m_AF_X25 = "PF_X25"
  4581. const m_AF_XDP = "PF_XDP"
  4582. const m_INT_MAX2 = 0x7fffffff
  4583. const m_MSG_BATCH = 0x40000
  4584. const m_MSG_CMSG_CLOEXEC = 0x40000000
  4585. const m_MSG_CONFIRM = 0x0800
  4586. const m_MSG_CTRUNC = 0x0008
  4587. const m_MSG_DONTROUTE = 0x0004
  4588. const m_MSG_DONTWAIT = 0x0040
  4589. const m_MSG_EOR = 0x0080
  4590. const m_MSG_ERRQUEUE = 0x2000
  4591. const m_MSG_FASTOPEN = 0x20000000
  4592. const m_MSG_FIN = 0x0200
  4593. const m_MSG_MORE = 0x8000
  4594. const m_MSG_NOSIGNAL = 0x4000
  4595. const m_MSG_OOB = 0x0001
  4596. const m_MSG_PEEK = 0x0002
  4597. const m_MSG_PROXY = 0x0010
  4598. const m_MSG_RST = 0x1000
  4599. const m_MSG_SYN = 0x0400
  4600. const m_MSG_TRUNC = 0x0020
  4601. const m_MSG_WAITALL = 0x0100
  4602. const m_MSG_WAITFORONE = 0x10000
  4603. const m_MSG_ZEROCOPY = 0x4000000
  4604. const m_PF_ALG = 38
  4605. const m_PF_APPLETALK = 5
  4606. const m_PF_ASH = 18
  4607. const m_PF_ATMPVC = 8
  4608. const m_PF_ATMSVC = 20
  4609. const m_PF_AX25 = 3
  4610. const m_PF_BLUETOOTH = 31
  4611. const m_PF_BRIDGE = 7
  4612. const m_PF_CAIF = 37
  4613. const m_PF_CAN = 29
  4614. const m_PF_DECnet = 12
  4615. const m_PF_ECONET = 19
  4616. const m_PF_FILE = "PF_LOCAL"
  4617. const m_PF_IB = 27
  4618. const m_PF_IEEE802154 = 36
  4619. const m_PF_INET = 2
  4620. const m_PF_INET6 = 10
  4621. const m_PF_IPX = 4
  4622. const m_PF_IRDA = 23
  4623. const m_PF_ISDN = 34
  4624. const m_PF_IUCV = 32
  4625. const m_PF_KCM = 41
  4626. const m_PF_KEY = 15
  4627. const m_PF_LLC = 26
  4628. const m_PF_LOCAL = 1
  4629. const m_PF_MAX = 45
  4630. const m_PF_MPLS = 28
  4631. const m_PF_NETBEUI = 13
  4632. const m_PF_NETLINK = 16
  4633. const m_PF_NETROM = 6
  4634. const m_PF_NFC = 39
  4635. const m_PF_PACKET = 17
  4636. const m_PF_PHONET = 35
  4637. const m_PF_PPPOX = 24
  4638. const m_PF_QIPCRTR = 42
  4639. const m_PF_RDS = 21
  4640. const m_PF_ROSE = 11
  4641. const m_PF_ROUTE = "PF_NETLINK"
  4642. const m_PF_RXRPC = 33
  4643. const m_PF_SECURITY = 14
  4644. const m_PF_SMC = 43
  4645. const m_PF_SNA = 22
  4646. const m_PF_TIPC = 30
  4647. const m_PF_UNIX = "PF_LOCAL"
  4648. const m_PF_UNSPEC = 0
  4649. const m_PF_VSOCK = 40
  4650. const m_PF_WANPIPE = 25
  4651. const m_PF_X25 = 9
  4652. const m_PF_XDP = 44
  4653. const m_SCM_CREDENTIALS = 0x02
  4654. const m_SCM_RIGHTS = 0x01
  4655. const m_SCM_TIMESTAMP = "SO_TIMESTAMP"
  4656. const m_SCM_TIMESTAMPING = "SO_TIMESTAMPING"
  4657. const m_SCM_TIMESTAMPING_OPT_STATS = 54
  4658. const m_SCM_TIMESTAMPING_PKTINFO = 58
  4659. const m_SCM_TIMESTAMPNS = "SO_TIMESTAMPNS"
  4660. const m_SCM_TXTIME = "SO_TXTIME"
  4661. const m_SCM_WIFI_STATUS = "SO_WIFI_STATUS"
  4662. const m_SHUT_RD = 0
  4663. const m_SHUT_RDWR = 2
  4664. const m_SHUT_WR = 1
  4665. const m_SOCK_CLOEXEC = 02000000
  4666. const m_SOCK_DCCP = 6
  4667. const m_SOCK_DGRAM = 2
  4668. const m_SOCK_NONBLOCK = 04000
  4669. const m_SOCK_PACKET = 10
  4670. const m_SOCK_RAW = 3
  4671. const m_SOCK_RDM = 4
  4672. const m_SOCK_SEQPACKET = 5
  4673. const m_SOCK_STREAM = 1
  4674. const m_SOL_AAL = 265
  4675. const m_SOL_ALG = 279
  4676. const m_SOL_ATM = 264
  4677. const m_SOL_BLUETOOTH = 274
  4678. const m_SOL_CAIF = 278
  4679. const m_SOL_DCCP = 269
  4680. const m_SOL_DECNET = 261
  4681. const m_SOL_ICMPV6 = 58
  4682. const m_SOL_IP = 0
  4683. const m_SOL_IPV6 = 41
  4684. const m_SOL_IRDA = 266
  4685. const m_SOL_IUCV = 277
  4686. const m_SOL_KCM = 281
  4687. const m_SOL_LLC = 268
  4688. const m_SOL_NETBEUI = 267
  4689. const m_SOL_NETLINK = 270
  4690. const m_SOL_NFC = 280
  4691. const m_SOL_PACKET = 263
  4692. const m_SOL_PNPIPE = 275
  4693. const m_SOL_PPPOL2TP = 273
  4694. const m_SOL_RAW = 255
  4695. const m_SOL_RDS = 276
  4696. const m_SOL_RXRPC = 272
  4697. const m_SOL_SOCKET = 1
  4698. const m_SOL_TIPC = 271
  4699. const m_SOL_TLS = 282
  4700. const m_SOL_X25 = 262
  4701. const m_SOL_XDP = 283
  4702. const m_SOMAXCONN = 128
  4703. const m_SO_ACCEPTCONN = 30
  4704. const m_SO_ATTACH_BPF = 50
  4705. const m_SO_ATTACH_FILTER = 26
  4706. const m_SO_ATTACH_REUSEPORT_CBPF = 51
  4707. const m_SO_ATTACH_REUSEPORT_EBPF = 52
  4708. const m_SO_BINDTODEVICE = 25
  4709. const m_SO_BINDTOIFINDEX = 62
  4710. const m_SO_BPF_EXTENSIONS = 48
  4711. const m_SO_BROADCAST = 6
  4712. const m_SO_BSDCOMPAT = 14
  4713. const m_SO_BUSY_POLL = 46
  4714. const m_SO_BUSY_POLL_BUDGET = 70
  4715. const m_SO_CNX_ADVICE = 53
  4716. const m_SO_COOKIE = 57
  4717. const m_SO_DEBUG = 1
  4718. const m_SO_DETACH_BPF = "SO_DETACH_FILTER"
  4719. const m_SO_DETACH_FILTER = 27
  4720. const m_SO_DETACH_REUSEPORT_BPF = 68
  4721. const m_SO_DOMAIN = 39
  4722. const m_SO_DONTROUTE = 5
  4723. const m_SO_ERROR = 4
  4724. const m_SO_GET_FILTER = "SO_ATTACH_FILTER"
  4725. const m_SO_INCOMING_CPU = 49
  4726. const m_SO_INCOMING_NAPI_ID = 56
  4727. const m_SO_KEEPALIVE = 9
  4728. const m_SO_LINGER = 13
  4729. const m_SO_LOCK_FILTER = 44
  4730. const m_SO_MARK = 36
  4731. const m_SO_MAX_PACING_RATE = 47
  4732. const m_SO_MEMINFO = 55
  4733. const m_SO_NOFCS = 43
  4734. const m_SO_NO_CHECK = 11
  4735. const m_SO_OOBINLINE = 10
  4736. const m_SO_PASSCRED = 16
  4737. const m_SO_PASSSEC = 34
  4738. const m_SO_PEEK_OFF = 42
  4739. const m_SO_PEERCRED = 17
  4740. const m_SO_PEERGROUPS = 59
  4741. const m_SO_PEERNAME = 28
  4742. const m_SO_PEERSEC = 31
  4743. const m_SO_PREFER_BUSY_POLL = 69
  4744. const m_SO_PRIORITY = 12
  4745. const m_SO_PROTOCOL = 38
  4746. const m_SO_RCVBUF = 8
  4747. const m_SO_RCVBUFFORCE = 33
  4748. const m_SO_RCVLOWAT = 18
  4749. const m_SO_RCVTIMEO = 20
  4750. const m_SO_REUSEADDR = 2
  4751. const m_SO_REUSEPORT = 15
  4752. const m_SO_RXQ_OVFL = 40
  4753. const m_SO_SECURITY_AUTHENTICATION = 22
  4754. const m_SO_SECURITY_ENCRYPTION_NETWORK = 24
  4755. const m_SO_SECURITY_ENCRYPTION_TRANSPORT = 23
  4756. const m_SO_SELECT_ERR_QUEUE = 45
  4757. const m_SO_SNDBUF = 7
  4758. const m_SO_SNDBUFFORCE = 32
  4759. const m_SO_SNDLOWAT = 19
  4760. const m_SO_SNDTIMEO = 21
  4761. const m_SO_TIMESTAMP = 29
  4762. const m_SO_TIMESTAMPING = 37
  4763. const m_SO_TIMESTAMPNS = 35
  4764. const m_SO_TXTIME = 61
  4765. const m_SO_TYPE = 3
  4766. const m_SO_WIFI_STATUS = 41
  4767. const m_SO_ZEROCOPY = 60
  4768. const m_UINT_MAX2 = 0xffffffff
  4769. type Tsocklen_t = uint32
  4770. type Tsa_family_t = uint16
  4771. type Tmsghdr = struct {
  4772. Fmsg_name uintptr
  4773. Fmsg_namelen Tsocklen_t
  4774. Fmsg_iov uintptr
  4775. F__pad1 int32
  4776. Fmsg_iovlen int32
  4777. Fmsg_control uintptr
  4778. F__pad2 int32
  4779. Fmsg_controllen Tsocklen_t
  4780. Fmsg_flags int32
  4781. }
  4782. type Tcmsghdr = struct {
  4783. F__pad1 int32
  4784. Fcmsg_len Tsocklen_t
  4785. Fcmsg_level int32
  4786. Fcmsg_type int32
  4787. }
  4788. type Tucred = struct {
  4789. Fpid Tpid_t
  4790. Fuid Tuid_t
  4791. Fgid Tgid_t
  4792. }
  4793. type Tmmsghdr = struct {
  4794. Fmsg_hdr Tmsghdr
  4795. Fmsg_len uint32
  4796. }
  4797. type Tlinger = struct {
  4798. Fl_onoff int32
  4799. Fl_linger int32
  4800. }
  4801. type Tsockaddr = struct {
  4802. Fsa_family Tsa_family_t
  4803. Fsa_data [14]uint8
  4804. }
  4805. type Tsockaddr_storage = struct {
  4806. Fss_family Tsa_family_t
  4807. F__ss_padding [118]uint8
  4808. F__ss_align uint64
  4809. }
  4810. type Tsockaddr_un = struct {
  4811. Fsun_family Tsa_family_t
  4812. Fsun_path [108]uint8
  4813. }
  4814. // C documentation
  4815. //
  4816. // /* Linux and OpenBSD */
  4817. func Xgetpeereid(tls *libc.TLS, s int32, euid uintptr, egid uintptr) (r int32) {
  4818. bp := tls.Alloc(16)
  4819. defer tls.Free(16)
  4820. var ret int32
  4821. var _ /* cred at bp+0 */ Tucred
  4822. var _ /* credlen at bp+12 */ Tsocklen_t
  4823. _ = ret
  4824. *(*Tsocklen_t)(unsafe.Pointer(bp + 12)) = uint32(12)
  4825. ret = libc.Xgetsockopt(tls, s, int32(m_SOL_SOCKET), int32(m_SO_PEERCRED), bp, bp+12)
  4826. if ret != 0 {
  4827. return ret
  4828. }
  4829. *(*Tuid_t)(unsafe.Pointer(euid)) = (*(*Tucred)(unsafe.Pointer(bp))).Fuid
  4830. *(*Tgid_t)(unsafe.Pointer(egid)) = (*(*Tucred)(unsafe.Pointer(bp))).Fgid
  4831. return 0
  4832. }
  4833. /*
  4834. * Swap two areas of size number of bytes. Although qsort(3) permits random
  4835. * blocks of memory to be sorted, sorting pointers is almost certainly the
  4836. * common case (and, were it not, could easily be made so). Regardless, it
  4837. * isn't worth optimizing; the SWAP's get sped up by the cache, and pointer
  4838. * arithmetic gets lost in the time required for comparison function calls.
  4839. */
  4840. /* Copy one block of size size to another. */
  4841. /*
  4842. * Build the list into a heap, where a heap is defined such that for
  4843. * the records K1 ... KN, Kj/2 >= Kj for 1 <= j/2 <= j <= N.
  4844. *
  4845. * There are two cases. If j == nmemb, select largest of Ki and Kj. If
  4846. * j < nmemb, select largest of Ki, Kj and Kj+1.
  4847. */
  4848. /*
  4849. * Select the top of the heap and 'heapify'. Since by far the most expensive
  4850. * action is the call to the compar function, a considerable optimization
  4851. * in the average case can be achieved due to the fact that k, the displaced
  4852. * element, is usually quite small, so it would be preferable to first
  4853. * heapify, always maintaining the invariant that the larger child is copied
  4854. * over its parent's record.
  4855. *
  4856. * Then, starting from the *bottom* of the heap, finding k's correct place,
  4857. * again maintaining the invariant. As a result of the invariant no element
  4858. * is 'lost' when k is assigned its correct place in the heap.
  4859. *
  4860. * The time savings from this optimization are on the order of 15-20% for the
  4861. * average case. See Knuth, Vol. 3, page 158, problem 18.
  4862. *
  4863. * XXX Don't break the #define SELECT line, below. Reiser cpp gets upset.
  4864. */
  4865. // C documentation
  4866. //
  4867. // /*
  4868. // * Heapsort -- Knuth, Vol. 3, page 145. Runs in O (N lg N), both average
  4869. // * and worst. While heapsort is faster than the worst case of quicksort,
  4870. // * the BSD quicksort does median selection so that the chance of finding
  4871. // * a data set that will trigger the worst case is nonexistent. Heapsort's
  4872. // * only advantage over quicksort is that it requires little additional memory.
  4873. // */
  4874. func Xheapsort(tls *libc.TLS, vbase uintptr, nmemb Tsize_t, size Tsize_t, compar uintptr) (r int32) {
  4875. var base, k, p, t, tmp1, tmp2, v1, v12, v13, v16, v17, v22, v23, v27, v28, v31, v32, v8, v9 uintptr
  4876. var cnt, i, j, l, v10, v14, v19, v20, v25, v29, v3, v5, v6 Tsize_t
  4877. var tmp uint8
  4878. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  4879. if nmemb <= uint64(1) {
  4880. return 0
  4881. }
  4882. if !(size != 0) {
  4883. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  4884. return -int32(1)
  4885. }
  4886. v1 = libc.Xmalloc(tls, size)
  4887. k = v1
  4888. if v1 == libc.UintptrFromInt32(0) {
  4889. return -int32(1)
  4890. }
  4891. /*
  4892. * Items are numbered from 1 to nmemb, so offset from size bytes
  4893. * below the starting address.
  4894. */
  4895. base = vbase - uintptr(size)
  4896. l = nmemb/uint64(2) + uint64(1)
  4897. for {
  4898. l--
  4899. v3 = l
  4900. if !(v3 != 0) {
  4901. break
  4902. }
  4903. i = l
  4904. for {
  4905. v5 = i * libc.Uint64FromInt32(2)
  4906. j = v5
  4907. if !(v5 <= nmemb) {
  4908. break
  4909. }
  4910. p = base + uintptr(j*size)
  4911. if j < nmemb && (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{compar})))(tls, p, p+uintptr(size)) < 0 {
  4912. p += uintptr(size)
  4913. j++
  4914. }
  4915. t = base + uintptr(i*size)
  4916. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{compar})))(tls, p, t) <= 0 {
  4917. break
  4918. }
  4919. cnt = size
  4920. for {
  4921. tmp = *(*uint8)(unsafe.Pointer(t))
  4922. v8 = t
  4923. t++
  4924. *(*uint8)(unsafe.Pointer(v8)) = *(*uint8)(unsafe.Pointer(p))
  4925. v9 = p
  4926. p++
  4927. *(*uint8)(unsafe.Pointer(v9)) = tmp
  4928. goto _7
  4929. _7:
  4930. ;
  4931. cnt--
  4932. v6 = cnt
  4933. if !(v6 != 0) {
  4934. break
  4935. }
  4936. }
  4937. goto _4
  4938. _4:
  4939. ;
  4940. i = j
  4941. }
  4942. goto _2
  4943. _2:
  4944. }
  4945. /*
  4946. * For each element of the heap, save the largest element into its
  4947. * final slot, save the displaced element (k), then recreate the
  4948. * heap.
  4949. */
  4950. for nmemb > uint64(1) {
  4951. cnt = size
  4952. tmp1 = k
  4953. tmp2 = base + uintptr(nmemb*size)
  4954. for {
  4955. v12 = tmp1
  4956. tmp1++
  4957. v13 = tmp2
  4958. tmp2++
  4959. *(*uint8)(unsafe.Pointer(v12)) = *(*uint8)(unsafe.Pointer(v13))
  4960. goto _11
  4961. _11:
  4962. ;
  4963. cnt--
  4964. v10 = cnt
  4965. if !(v10 != 0) {
  4966. break
  4967. }
  4968. }
  4969. cnt = size
  4970. tmp1 = base + uintptr(nmemb*size)
  4971. tmp2 = base + uintptr(size)
  4972. for {
  4973. v16 = tmp1
  4974. tmp1++
  4975. v17 = tmp2
  4976. tmp2++
  4977. *(*uint8)(unsafe.Pointer(v16)) = *(*uint8)(unsafe.Pointer(v17))
  4978. goto _15
  4979. _15:
  4980. ;
  4981. cnt--
  4982. v14 = cnt
  4983. if !(v14 != 0) {
  4984. break
  4985. }
  4986. }
  4987. nmemb--
  4988. i = uint64(1)
  4989. for {
  4990. v19 = i * libc.Uint64FromInt32(2)
  4991. j = v19
  4992. if !(v19 <= nmemb) {
  4993. break
  4994. }
  4995. p = base + uintptr(j*size)
  4996. if j < nmemb && (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{compar})))(tls, p, p+uintptr(size)) < 0 {
  4997. p += uintptr(size)
  4998. j++
  4999. }
  5000. t = base + uintptr(i*size)
  5001. cnt = size
  5002. tmp1 = t
  5003. tmp2 = p
  5004. for {
  5005. v22 = tmp1
  5006. tmp1++
  5007. v23 = tmp2
  5008. tmp2++
  5009. *(*uint8)(unsafe.Pointer(v22)) = *(*uint8)(unsafe.Pointer(v23))
  5010. goto _21
  5011. _21:
  5012. ;
  5013. cnt--
  5014. v20 = cnt
  5015. if !(v20 != 0) {
  5016. break
  5017. }
  5018. }
  5019. goto _18
  5020. _18:
  5021. ;
  5022. i = j
  5023. }
  5024. for {
  5025. j = i
  5026. i = j / uint64(2)
  5027. p = base + uintptr(j*size)
  5028. t = base + uintptr(i*size)
  5029. if j == uint64(1) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{compar})))(tls, k, t) < 0 {
  5030. cnt = size
  5031. tmp1 = p
  5032. tmp2 = k
  5033. for {
  5034. v27 = tmp1
  5035. tmp1++
  5036. v28 = tmp2
  5037. tmp2++
  5038. *(*uint8)(unsafe.Pointer(v27)) = *(*uint8)(unsafe.Pointer(v28))
  5039. goto _26
  5040. _26:
  5041. ;
  5042. cnt--
  5043. v25 = cnt
  5044. if !(v25 != 0) {
  5045. break
  5046. }
  5047. }
  5048. break
  5049. }
  5050. cnt = size
  5051. tmp1 = p
  5052. tmp2 = t
  5053. for {
  5054. v31 = tmp1
  5055. tmp1++
  5056. v32 = tmp2
  5057. tmp2++
  5058. *(*uint8)(unsafe.Pointer(v31)) = *(*uint8)(unsafe.Pointer(v32))
  5059. goto _30
  5060. _30:
  5061. ;
  5062. cnt--
  5063. v29 = cnt
  5064. if !(v29 != 0) {
  5065. break
  5066. }
  5067. }
  5068. goto _24
  5069. _24:
  5070. }
  5071. }
  5072. libc.Xfree(tls, k)
  5073. return 0
  5074. }
  5075. const m_HN_AUTOSCALE1 = 32
  5076. const m_HN_B1 = 4
  5077. const m_HN_DECIMAL1 = 1
  5078. const m_HN_DIVISOR_10001 = 8
  5079. const m_HN_GETSCALE1 = 16
  5080. const m_HN_IEC_PREFIXES1 = 16
  5081. const m_HN_NOSPACE1 = 2
  5082. const m_LC_ALL = 6
  5083. const m_LC_ALL_MASK = 0x7fffffff
  5084. const m_LC_COLLATE = 3
  5085. const m_LC_CTYPE = 0
  5086. const m_LC_MESSAGES = 5
  5087. const m_LC_MONETARY = 4
  5088. const m_LC_NUMERIC = 1
  5089. const m_LC_TIME = 2
  5090. type Tlconv = struct {
  5091. Fdecimal_point uintptr
  5092. Fthousands_sep uintptr
  5093. Fgrouping uintptr
  5094. Fint_curr_symbol uintptr
  5095. Fcurrency_symbol uintptr
  5096. Fmon_decimal_point uintptr
  5097. Fmon_thousands_sep uintptr
  5098. Fmon_grouping uintptr
  5099. Fpositive_sign uintptr
  5100. Fnegative_sign uintptr
  5101. Fint_frac_digits uint8
  5102. Ffrac_digits uint8
  5103. Fp_cs_precedes uint8
  5104. Fp_sep_by_space uint8
  5105. Fn_cs_precedes uint8
  5106. Fn_sep_by_space uint8
  5107. Fp_sign_posn uint8
  5108. Fn_sign_posn uint8
  5109. Fint_p_cs_precedes uint8
  5110. Fint_p_sep_by_space uint8
  5111. Fint_n_cs_precedes uint8
  5112. Fint_n_sep_by_space uint8
  5113. Fint_p_sign_posn uint8
  5114. Fint_n_sign_posn uint8
  5115. }
  5116. /*
  5117. * Copyright (c) 1996 Peter Wemm <peter@FreeBSD.org>.
  5118. * All rights reserved.
  5119. * Copyright (c) 2002 Networks Associates Technology, Inc.
  5120. * All rights reserved.
  5121. *
  5122. * Portions of this software were developed for the FreeBSD Project by
  5123. * ThinkSec AS and NAI Labs, the Security Research Division of Network
  5124. * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
  5125. * ("CBOSS"), as part of the DARPA CHATS research program.
  5126. *
  5127. * Redistribution and use in source and binary forms, with or without
  5128. * modification, is permitted provided that the following conditions
  5129. * are met:
  5130. * 1. Redistributions of source code must retain the above copyright
  5131. * notice, this list of conditions and the following disclaimer.
  5132. * 2. Redistributions in binary form must reproduce the above copyright
  5133. * notice, this list of conditions and the following disclaimer in the
  5134. * documentation and/or other materials provided with the distribution.
  5135. * 3. The name of the author may not be used to endorse or promote
  5136. * products derived from this software without specific prior written
  5137. * permission.
  5138. *
  5139. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  5140. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  5141. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  5142. * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  5143. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  5144. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  5145. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  5146. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  5147. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  5148. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  5149. * SUCH DAMAGE.
  5150. *
  5151. * $FreeBSD: src/lib/libutil/libutil.h,v 1.47 2008/04/23 00:49:12 scf Exp $
  5152. */
  5153. var _maxscale = int32(6)
  5154. func Xhumanize_number(tls *libc.TLS, buf uintptr, len1 Tsize_t, quotient Tint64_t, suffix uintptr, scale int32, flags int32) (r1 int32) {
  5155. bp := tls.Alloc(64)
  5156. defer tls.Free(64)
  5157. var baselen Tsize_t
  5158. var divisor, max Tint64_t
  5159. var divisordeccut, i, r, remainder, s1, s2, sign, v2 int32
  5160. var prefixes, sep uintptr
  5161. _, _, _, _, _, _, _, _, _, _, _, _, _ = baselen, divisor, divisordeccut, i, max, prefixes, r, remainder, s1, s2, sep, sign, v2
  5162. /* Since so many callers don't check -1, NUL terminate the buffer */
  5163. if len1 > uint64(0) {
  5164. *(*uint8)(unsafe.Pointer(buf)) = uint8('\000')
  5165. }
  5166. /* validate args */
  5167. if buf == libc.UintptrFromInt32(0) || suffix == libc.UintptrFromInt32(0) {
  5168. return -int32(1)
  5169. }
  5170. if scale < 0 {
  5171. return -int32(1)
  5172. } else {
  5173. if scale > _maxscale && scale & ^(libc.Int32FromInt32(m_HN_AUTOSCALE1)|libc.Int32FromInt32(m_HN_GETSCALE1)) != 0 {
  5174. return -int32(1)
  5175. }
  5176. }
  5177. if flags&int32(m_HN_DIVISOR_10001) != 0 && flags&int32(m_HN_IEC_PREFIXES1) != 0 {
  5178. return -int32(1)
  5179. }
  5180. /* setup parameters */
  5181. remainder = 0
  5182. if flags&int32(m_HN_IEC_PREFIXES1) != 0 {
  5183. baselen = uint64(2)
  5184. /*
  5185. * Use the prefixes for power of two recommended by
  5186. * the International Electrotechnical Commission
  5187. * (IEC) in IEC 80000-3 (i.e. Ki, Mi, Gi...).
  5188. *
  5189. * HN_IEC_PREFIXES implies a divisor of 1024 here
  5190. * (use of HN_DIVISOR_1000 would have triggered
  5191. * an assertion earlier).
  5192. */
  5193. divisor = int64(1024)
  5194. divisordeccut = int32(973) /* ceil(.95 * 1024) */
  5195. if flags&int32(m_HN_B1) != 0 {
  5196. prefixes = __ccgo_ts + 156
  5197. } else {
  5198. prefixes = __ccgo_ts + 177
  5199. }
  5200. } else {
  5201. baselen = uint64(1)
  5202. if flags&int32(m_HN_DIVISOR_10001) != 0 {
  5203. divisor = int64(1000)
  5204. divisordeccut = int32(950)
  5205. if flags&int32(m_HN_B1) != 0 {
  5206. prefixes = __ccgo_ts + 198
  5207. } else {
  5208. prefixes = __ccgo_ts + 218
  5209. }
  5210. } else {
  5211. divisor = int64(1024)
  5212. divisordeccut = int32(973) /* ceil(.95 * 1024) */
  5213. if flags&int32(m_HN_B1) != 0 {
  5214. prefixes = __ccgo_ts + 238
  5215. } else {
  5216. prefixes = __ccgo_ts + 258
  5217. }
  5218. }
  5219. }
  5220. if quotient < 0 {
  5221. sign = -int32(1)
  5222. quotient = -quotient
  5223. baselen += uint64(2) /* sign, digit */
  5224. } else {
  5225. sign = int32(1)
  5226. baselen += uint64(1) /* digit */
  5227. }
  5228. if flags&int32(m_HN_NOSPACE1) != 0 {
  5229. sep = __ccgo_ts + 53
  5230. } else {
  5231. sep = __ccgo_ts + 278
  5232. baselen++
  5233. }
  5234. baselen += libc.Xstrlen(tls, suffix)
  5235. /* Check if enough room for `x y' + suffix + `\0' */
  5236. if len1 < baselen+uint64(1) {
  5237. return -int32(1)
  5238. }
  5239. if scale&(libc.Int32FromInt32(m_HN_AUTOSCALE1)|libc.Int32FromInt32(m_HN_GETSCALE1)) != 0 {
  5240. /* See if there is additional columns can be used. */
  5241. max = int64(1)
  5242. i = libc.Int32FromUint64(len1 - baselen)
  5243. for {
  5244. v2 = i
  5245. i--
  5246. if !(v2 > 0) {
  5247. break
  5248. }
  5249. max *= int64(10)
  5250. goto _1
  5251. _1:
  5252. }
  5253. /*
  5254. * Divide the number until it fits the given column.
  5255. * If there will be an overflow by the rounding below,
  5256. * divide once more.
  5257. */
  5258. i = 0
  5259. for {
  5260. if !((quotient >= max || quotient == max-int64(1) && (remainder >= divisordeccut || int64(remainder) >= divisor/int64(2))) && i < _maxscale) {
  5261. break
  5262. }
  5263. remainder = int32(quotient % divisor)
  5264. quotient /= divisor
  5265. goto _3
  5266. _3:
  5267. ;
  5268. i++
  5269. }
  5270. if scale&int32(m_HN_GETSCALE1) != 0 {
  5271. return i
  5272. }
  5273. } else {
  5274. i = 0
  5275. for {
  5276. if !(i < scale && i < _maxscale) {
  5277. break
  5278. }
  5279. remainder = int32(quotient % divisor)
  5280. quotient /= divisor
  5281. goto _4
  5282. _4:
  5283. ;
  5284. i++
  5285. }
  5286. }
  5287. /* If a value <= 9.9 after rounding and ... */
  5288. /*
  5289. * XXX - should we make sure there is enough space for the decimal
  5290. * place and if not, don't do HN_DECIMAL?
  5291. */
  5292. if (quotient == int64(9) && remainder < divisordeccut || quotient < int64(9)) && i > 0 && flags&int32(m_HN_DECIMAL1) != 0 {
  5293. s1 = int32(int64(int32(quotient)) + (int64(remainder*int32(10))+divisor/int64(2))/divisor/int64(10))
  5294. s2 = int32((int64(remainder*int32(10)) + divisor/int64(2)) / divisor % int64(10))
  5295. 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))
  5296. } else {
  5297. 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))
  5298. }
  5299. return r
  5300. }
  5301. const m_HN_AUTOSCALE2 = 0x20
  5302. const m_HN_B2 = 0x04
  5303. const m_HN_DECIMAL2 = 0x01
  5304. const m_HN_DIVISOR_10002 = 0x08
  5305. const m_HN_GETSCALE2 = 0x10
  5306. const m_HN_IEC_PREFIXES2 = 0x10
  5307. const m_HN_NOSPACE2 = 0x02
  5308. const m_INET6_ADDRSTRLEN = 46
  5309. const m_INET_ADDRSTRLEN = 16
  5310. const m_IN_CLASSA_MAX = 128
  5311. const m_IN_CLASSA_NET = 0xff000000
  5312. const m_IN_CLASSA_NSHIFT = 24
  5313. const m_IN_CLASSB_MAX = 65536
  5314. const m_IN_CLASSB_NET = 0xffff0000
  5315. const m_IN_CLASSB_NSHIFT = 16
  5316. const m_IN_CLASSC_NET = 0xffffff00
  5317. const m_IN_CLASSC_NSHIFT = 8
  5318. const m_IN_LOOPBACKNET = 127
  5319. const m_IPPORT_RESERVED = 1024
  5320. const m_IPPROTO_AH = 51
  5321. const m_IPPROTO_BEETPH = 94
  5322. const m_IPPROTO_COMP = 108
  5323. const m_IPPROTO_DCCP = 33
  5324. const m_IPPROTO_DSTOPTS = 60
  5325. const m_IPPROTO_EGP = 8
  5326. const m_IPPROTO_ENCAP = 98
  5327. const m_IPPROTO_ESP = 50
  5328. const m_IPPROTO_ETHERNET = 143
  5329. const m_IPPROTO_FRAGMENT = 44
  5330. const m_IPPROTO_GRE = 47
  5331. const m_IPPROTO_HOPOPTS = 0
  5332. const m_IPPROTO_ICMP = 1
  5333. const m_IPPROTO_ICMPV6 = 58
  5334. const m_IPPROTO_IDP = 22
  5335. const m_IPPROTO_IGMP = 2
  5336. const m_IPPROTO_IP = 0
  5337. const m_IPPROTO_IPIP = 4
  5338. const m_IPPROTO_IPV6 = 41
  5339. const m_IPPROTO_MAX = 263
  5340. const m_IPPROTO_MH = 135
  5341. const m_IPPROTO_MPLS = 137
  5342. const m_IPPROTO_MPTCP = 262
  5343. const m_IPPROTO_MTP = 92
  5344. const m_IPPROTO_NONE = 59
  5345. const m_IPPROTO_PIM = 103
  5346. const m_IPPROTO_PUP = 12
  5347. const m_IPPROTO_RAW = 255
  5348. const m_IPPROTO_ROUTING = 43
  5349. const m_IPPROTO_RSVP = 46
  5350. const m_IPPROTO_SCTP = 132
  5351. const m_IPPROTO_TCP = 6
  5352. const m_IPPROTO_TP = 29
  5353. const m_IPPROTO_UDP = 17
  5354. const m_IPPROTO_UDPLITE = 136
  5355. const m_IPV6_2292DSTOPTS = 4
  5356. const m_IPV6_2292HOPLIMIT = 8
  5357. const m_IPV6_2292HOPOPTS = 3
  5358. const m_IPV6_2292PKTINFO = 2
  5359. const m_IPV6_2292PKTOPTIONS = 6
  5360. const m_IPV6_2292RTHDR = 5
  5361. const m_IPV6_ADDRFORM = 1
  5362. const m_IPV6_ADDR_PREFERENCES = 72
  5363. const m_IPV6_ADD_MEMBERSHIP = "IPV6_JOIN_GROUP"
  5364. const m_IPV6_AUTHHDR = 10
  5365. const m_IPV6_AUTOFLOWLABEL = 70
  5366. const m_IPV6_CHECKSUM = 7
  5367. const m_IPV6_DONTFRAG = 62
  5368. const m_IPV6_DROP_MEMBERSHIP = "IPV6_LEAVE_GROUP"
  5369. const m_IPV6_DSTOPTS = 59
  5370. const m_IPV6_FREEBIND = 78
  5371. const m_IPV6_HDRINCL = 36
  5372. const m_IPV6_HOPLIMIT = 52
  5373. const m_IPV6_HOPOPTS = 54
  5374. const m_IPV6_IPSEC_POLICY = 34
  5375. const m_IPV6_JOIN_ANYCAST = 27
  5376. const m_IPV6_JOIN_GROUP = 20
  5377. const m_IPV6_LEAVE_ANYCAST = 28
  5378. const m_IPV6_LEAVE_GROUP = 21
  5379. const m_IPV6_MINHOPCOUNT = 73
  5380. const m_IPV6_MTU = 24
  5381. const m_IPV6_MTU_DISCOVER = 23
  5382. const m_IPV6_MULTICAST_ALL = 29
  5383. const m_IPV6_MULTICAST_HOPS = 18
  5384. const m_IPV6_MULTICAST_IF = 17
  5385. const m_IPV6_MULTICAST_LOOP = 19
  5386. const m_IPV6_NEXTHOP = 9
  5387. const m_IPV6_ORIGDSTADDR = 74
  5388. const m_IPV6_PATHMTU = 61
  5389. const m_IPV6_PKTINFO = 50
  5390. const m_IPV6_PMTUDISC_DO = 2
  5391. const m_IPV6_PMTUDISC_DONT = 0
  5392. const m_IPV6_PMTUDISC_INTERFACE = 4
  5393. const m_IPV6_PMTUDISC_OMIT = 5
  5394. const m_IPV6_PMTUDISC_PROBE = 3
  5395. const m_IPV6_PMTUDISC_WANT = 1
  5396. const m_IPV6_PREFER_SRC_CGA = 0x0008
  5397. const m_IPV6_PREFER_SRC_COA = 0x0004
  5398. const m_IPV6_PREFER_SRC_HOME = 0x0400
  5399. const m_IPV6_PREFER_SRC_NONCGA = 0x0800
  5400. const m_IPV6_PREFER_SRC_PUBLIC = 0x0002
  5401. const m_IPV6_PREFER_SRC_PUBTMP_DEFAULT = 0x0100
  5402. const m_IPV6_PREFER_SRC_TMP = 0x0001
  5403. const m_IPV6_RECVDSTOPTS = 58
  5404. const m_IPV6_RECVERR = 25
  5405. const m_IPV6_RECVFRAGSIZE = 77
  5406. const m_IPV6_RECVHOPLIMIT = 51
  5407. const m_IPV6_RECVHOPOPTS = 53
  5408. const m_IPV6_RECVORIGDSTADDR = "IPV6_ORIGDSTADDR"
  5409. const m_IPV6_RECVPATHMTU = 60
  5410. const m_IPV6_RECVPKTINFO = 49
  5411. const m_IPV6_RECVRTHDR = 56
  5412. const m_IPV6_RECVTCLASS = 66
  5413. const m_IPV6_ROUTER_ALERT = 22
  5414. const m_IPV6_ROUTER_ALERT_ISOLATE = 30
  5415. const m_IPV6_RTHDR = 57
  5416. const m_IPV6_RTHDRDSTOPTS = 55
  5417. const m_IPV6_RTHDR_LOOSE = 0
  5418. const m_IPV6_RTHDR_STRICT = 1
  5419. const m_IPV6_RTHDR_TYPE_0 = 0
  5420. const m_IPV6_RXDSTOPTS = "IPV6_DSTOPTS"
  5421. const m_IPV6_RXHOPOPTS = "IPV6_HOPOPTS"
  5422. const m_IPV6_TCLASS = 67
  5423. const m_IPV6_TRANSPARENT = 75
  5424. const m_IPV6_UNICAST_HOPS = 16
  5425. const m_IPV6_UNICAST_IF = 76
  5426. const m_IPV6_V6ONLY = 26
  5427. const m_IPV6_XFRM_POLICY = 35
  5428. const m_IP_ADD_MEMBERSHIP = 35
  5429. const m_IP_ADD_SOURCE_MEMBERSHIP = 39
  5430. const m_IP_BIND_ADDRESS_NO_PORT = 24
  5431. const m_IP_BLOCK_SOURCE = 38
  5432. const m_IP_CHECKSUM = 23
  5433. const m_IP_DEFAULT_MULTICAST_LOOP = 1
  5434. const m_IP_DEFAULT_MULTICAST_TTL = 1
  5435. const m_IP_DROP_MEMBERSHIP = 36
  5436. const m_IP_DROP_SOURCE_MEMBERSHIP = 40
  5437. const m_IP_FREEBIND = 15
  5438. const m_IP_HDRINCL = 3
  5439. const m_IP_IPSEC_POLICY = 16
  5440. const m_IP_MAX_MEMBERSHIPS = 20
  5441. const m_IP_MINTTL = 21
  5442. const m_IP_MSFILTER = 41
  5443. const m_IP_MTU = 14
  5444. const m_IP_MTU_DISCOVER = 10
  5445. const m_IP_MULTICAST_ALL = 49
  5446. const m_IP_MULTICAST_IF = 32
  5447. const m_IP_MULTICAST_LOOP = 34
  5448. const m_IP_MULTICAST_TTL = 33
  5449. const m_IP_NODEFRAG = 22
  5450. const m_IP_OPTIONS = 4
  5451. const m_IP_ORIGDSTADDR = 20
  5452. const m_IP_PASSSEC = 18
  5453. const m_IP_PKTINFO = 8
  5454. const m_IP_PKTOPTIONS = 9
  5455. const m_IP_PMTUDISC = 10
  5456. const m_IP_PMTUDISC_DO = 2
  5457. const m_IP_PMTUDISC_DONT = 0
  5458. const m_IP_PMTUDISC_INTERFACE = 4
  5459. const m_IP_PMTUDISC_OMIT = 5
  5460. const m_IP_PMTUDISC_PROBE = 3
  5461. const m_IP_PMTUDISC_WANT = 1
  5462. const m_IP_RECVERR = 11
  5463. const m_IP_RECVERR_RFC4884 = 26
  5464. const m_IP_RECVFRAGSIZE = 25
  5465. const m_IP_RECVOPTS = 6
  5466. const m_IP_RECVORIGDSTADDR = "IP_ORIGDSTADDR"
  5467. const m_IP_RECVRETOPTS = "IP_RETOPTS"
  5468. const m_IP_RECVTOS = 13
  5469. const m_IP_RECVTTL = 12
  5470. const m_IP_RETOPTS = 7
  5471. const m_IP_ROUTER_ALERT = 5
  5472. const m_IP_TOS = 1
  5473. const m_IP_TRANSPARENT = 19
  5474. const m_IP_TTL = 2
  5475. const m_IP_UNBLOCK_SOURCE = 37
  5476. const m_IP_UNICAST_IF = 50
  5477. const m_IP_XFRM_POLICY = 17
  5478. const m_MCAST_BLOCK_SOURCE = 43
  5479. const m_MCAST_EXCLUDE = 0
  5480. const m_MCAST_INCLUDE = 1
  5481. const m_MCAST_JOIN_GROUP = 42
  5482. const m_MCAST_JOIN_SOURCE_GROUP = 46
  5483. const m_MCAST_LEAVE_GROUP = 45
  5484. const m_MCAST_LEAVE_SOURCE_GROUP = 47
  5485. const m_MCAST_MSFILTER = 48
  5486. const m_MCAST_UNBLOCK_SOURCE = 44
  5487. const m___UAPI_DEF_IN6_ADDR = 0
  5488. const m___UAPI_DEF_IN6_ADDR_ALT = 0
  5489. const m___UAPI_DEF_IN6_PKTINFO = 0
  5490. const m___UAPI_DEF_IN_ADDR = 0
  5491. const m___UAPI_DEF_IN_CLASS = 0
  5492. const m___UAPI_DEF_IN_IPPROTO = 0
  5493. const m___UAPI_DEF_IN_PKTINFO = 0
  5494. const m___UAPI_DEF_IP6_MTUINFO = 0
  5495. const m___UAPI_DEF_IPPROTO_V6 = 0
  5496. const m___UAPI_DEF_IPV6_MREQ = 0
  5497. const m___UAPI_DEF_IPV6_OPTIONS = 0
  5498. const m___UAPI_DEF_IP_MREQ = 0
  5499. const m___UAPI_DEF_SOCKADDR_IN = 0
  5500. const m___UAPI_DEF_SOCKADDR_IN6 = 0
  5501. type Tin_port_t = uint16
  5502. type Tin_addr_t = uint32
  5503. type Tin_addr = struct {
  5504. Fs_addr Tin_addr_t
  5505. }
  5506. type Tsockaddr_in = struct {
  5507. Fsin_family Tsa_family_t
  5508. Fsin_port Tin_port_t
  5509. Fsin_addr Tin_addr
  5510. Fsin_zero [8]Tuint8_t
  5511. }
  5512. type Tin6_addr = struct {
  5513. F__in6_union struct {
  5514. F__s6_addr16 [0][8]Tuint16_t
  5515. F__s6_addr32 [0][4]Tuint32_t
  5516. F__s6_addr [16]Tuint8_t
  5517. }
  5518. }
  5519. type Tsockaddr_in6 = struct {
  5520. Fsin6_family Tsa_family_t
  5521. Fsin6_port Tin_port_t
  5522. Fsin6_flowinfo Tuint32_t
  5523. Fsin6_addr Tin6_addr
  5524. Fsin6_scope_id Tuint32_t
  5525. }
  5526. type Tipv6_mreq = struct {
  5527. Fipv6mr_multiaddr Tin6_addr
  5528. Fipv6mr_interface uint32
  5529. }
  5530. type Tip_opts = struct {
  5531. Fip_dst Tin_addr
  5532. Fip_opts [40]uint8
  5533. }
  5534. type Tip_mreq = struct {
  5535. Fimr_multiaddr Tin_addr
  5536. Fimr_interface Tin_addr
  5537. }
  5538. type Tip_mreqn = struct {
  5539. Fimr_multiaddr Tin_addr
  5540. Fimr_address Tin_addr
  5541. Fimr_ifindex int32
  5542. }
  5543. type Tip_mreq_source = struct {
  5544. Fimr_multiaddr Tin_addr
  5545. Fimr_interface Tin_addr
  5546. Fimr_sourceaddr Tin_addr
  5547. }
  5548. type Tip_msfilter = struct {
  5549. Fimsf_multiaddr Tin_addr
  5550. Fimsf_interface Tin_addr
  5551. Fimsf_fmode Tuint32_t
  5552. Fimsf_numsrc Tuint32_t
  5553. Fimsf_slist [1]Tin_addr
  5554. }
  5555. type Tgroup_req = struct {
  5556. Fgr_interface Tuint32_t
  5557. Fgr_group Tsockaddr_storage
  5558. }
  5559. type Tgroup_source_req = struct {
  5560. Fgsr_interface Tuint32_t
  5561. Fgsr_group Tsockaddr_storage
  5562. Fgsr_source Tsockaddr_storage
  5563. }
  5564. type Tgroup_filter = struct {
  5565. Fgf_interface Tuint32_t
  5566. Fgf_group Tsockaddr_storage
  5567. Fgf_fmode Tuint32_t
  5568. Fgf_numsrc Tuint32_t
  5569. Fgf_slist [1]Tsockaddr_storage
  5570. }
  5571. type Tin_pktinfo = struct {
  5572. Fipi_ifindex int32
  5573. Fipi_spec_dst Tin_addr
  5574. Fipi_addr Tin_addr
  5575. }
  5576. type Tin6_pktinfo = struct {
  5577. Fipi6_addr Tin6_addr
  5578. Fipi6_ifindex uint32
  5579. }
  5580. type Tip6_mtuinfo = struct {
  5581. Fip6m_addr Tsockaddr_in6
  5582. Fip6m_mtu Tuint32_t
  5583. }
  5584. // C documentation
  5585. //
  5586. // /*
  5587. // * static int
  5588. // * inet_net_pton(af, src, dst, size)
  5589. // * convert network number from presentation to network format.
  5590. // * accepts hex octets, hex strings, decimal octets, and /CIDR.
  5591. // * "size" is in bytes and describes "dst".
  5592. // * return:
  5593. // * number of bits, either imputed classfully or specified with /CIDR,
  5594. // * or -1 if some failure occurred (check errno). ENOENT means it was
  5595. // * not a valid network specification.
  5596. // * author:
  5597. // * Paul Vixie (ISC), June 1996
  5598. // */
  5599. func Xinet_net_pton(tls *libc.TLS, af int32, src uintptr, dst uintptr, size Tsize_t) (r int32) {
  5600. switch af {
  5601. case int32(m_PF_INET):
  5602. return _inet_net_pton_ipv4(tls, src, dst, size)
  5603. default:
  5604. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EAFNOSUPPORT)
  5605. return -int32(1)
  5606. }
  5607. return r
  5608. }
  5609. // C documentation
  5610. //
  5611. // /*
  5612. // * static int
  5613. // * inet_net_pton_ipv4(src, dst, size)
  5614. // * convert IPv4 network number from presentation to network format.
  5615. // * accepts hex octets, hex strings, decimal octets, and /CIDR.
  5616. // * "size" is in bytes and describes "dst".
  5617. // * return:
  5618. // * number of bits, either imputed classfully or specified with /CIDR,
  5619. // * or -1 if some failure occurred (check errno). ENOENT means it was
  5620. // * not an IPv4 network specification.
  5621. // * note:
  5622. // * network byte order assumed. this means 192.5.5.240/28 has
  5623. // * 0x11110000 in its fourth octet.
  5624. // * author:
  5625. // * Paul Vixie (ISC), June 1996
  5626. // */
  5627. func _inet_net_pton_ipv4(tls *libc.TLS, src uintptr, dst uintptr, size Tsize_t) (r int32) {
  5628. var bits, ch, dirty, n, tmp, v10, v17, v2, v5 int32
  5629. var odst, v1, v11, v14, v15, v16, v18, v21, v3, v8, p4, p6 uintptr
  5630. var v13, v20, v7 Tsize_t
  5631. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bits, ch, dirty, n, odst, tmp, v1, v10, v11, v13, v14, v15, v16, v17, v18, v2, v20, v21, v3, v5, v7, v8, p4, p6
  5632. odst = dst
  5633. v1 = src
  5634. src++
  5635. ch = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v1)))
  5636. 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 {
  5637. /* Hexadecimal: Eat nybble string. */
  5638. if size <= uint64(0) {
  5639. goto emsgsize
  5640. }
  5641. *(*uint8)(unsafe.Pointer(dst)) = uint8(0)
  5642. dirty = libc.Int32FromInt32(0)
  5643. src++ /* skip x or X. */
  5644. for {
  5645. v3 = src
  5646. src++
  5647. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v3)))
  5648. ch = v2
  5649. if !(v2 != int32('\000') && libc.BoolInt32(libc.Uint32FromInt32(ch) < uint32(128)) != 0 && libc.Xisxdigit(tls, ch) != 0) {
  5650. break
  5651. }
  5652. if libc.BoolInt32(libc.Uint32FromInt32(ch)-uint32('A') < uint32(26)) != 0 {
  5653. ch = libc.Xtolower(tls, ch)
  5654. }
  5655. n = int32(int64(libc.Xstrchr(tls, uintptr(unsafe.Pointer(&_xdigits)), ch)) - t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_xdigits))))
  5656. p4 = dst
  5657. *(*uint8)(unsafe.Pointer(p4)) = uint8(int32(*(*uint8)(unsafe.Pointer(p4))) | n)
  5658. v5 = dirty
  5659. dirty++
  5660. if !(v5 != 0) {
  5661. p6 = dst
  5662. *(*uint8)(unsafe.Pointer(p6)) = uint8(int32(*(*uint8)(unsafe.Pointer(p6))) << libc.Int32FromInt32(4))
  5663. } else {
  5664. v7 = size
  5665. size--
  5666. if v7 > uint64(0) {
  5667. dst++
  5668. v8 = dst
  5669. *(*uint8)(unsafe.Pointer(v8)) = uint8(0)
  5670. dirty = libc.Int32FromInt32(0)
  5671. } else {
  5672. goto emsgsize
  5673. }
  5674. }
  5675. }
  5676. if dirty != 0 {
  5677. size--
  5678. }
  5679. } else {
  5680. if libc.BoolInt32(libc.Uint32FromInt32(ch) < uint32(128)) != 0 && libc.BoolInt32(libc.Uint32FromInt32(ch)-uint32('0') < uint32(10)) != 0 {
  5681. /* Decimal: eat dotted digit string. */
  5682. for {
  5683. tmp = 0
  5684. for {
  5685. n = int32(int64(libc.Xstrchr(tls, uintptr(unsafe.Pointer(&_digits)), ch)) - t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_digits))))
  5686. tmp *= int32(10)
  5687. tmp += n
  5688. if tmp > int32(255) {
  5689. goto enoent
  5690. }
  5691. goto _12
  5692. _12:
  5693. ;
  5694. v11 = src
  5695. src++
  5696. v10 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v11)))
  5697. ch = v10
  5698. if !(v10 != int32('\000') && libc.BoolInt32(libc.Uint32FromInt32(ch) < uint32(128)) != 0 && libc.BoolInt32(libc.Uint32FromInt32(ch)-uint32('0') < uint32(10)) != 0) {
  5699. break
  5700. }
  5701. }
  5702. v13 = size
  5703. size--
  5704. if v13 <= uint64(0) {
  5705. goto emsgsize
  5706. }
  5707. v14 = dst
  5708. dst++
  5709. *(*uint8)(unsafe.Pointer(v14)) = libc.Uint8FromInt32(tmp)
  5710. if ch == int32('\000') || ch == int32('/') {
  5711. break
  5712. }
  5713. if ch != int32('.') {
  5714. goto enoent
  5715. }
  5716. v15 = src
  5717. src++
  5718. ch = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v15)))
  5719. if !(libc.BoolInt32(libc.Uint32FromInt32(ch) < libc.Uint32FromInt32(128)) != 0) || !(libc.BoolInt32(libc.Uint32FromInt32(ch)-libc.Uint32FromUint8('0') < libc.Uint32FromInt32(10)) != 0) {
  5720. goto enoent
  5721. }
  5722. goto _9
  5723. _9:
  5724. }
  5725. } else {
  5726. goto enoent
  5727. }
  5728. }
  5729. bits = -int32(1)
  5730. 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 {
  5731. /* CIDR width specifier. Nothing can follow it. */
  5732. v16 = src
  5733. src++
  5734. ch = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v16))) /* Skip over the /. */
  5735. bits = 0
  5736. for {
  5737. n = int32(int64(libc.Xstrchr(tls, uintptr(unsafe.Pointer(&_digits)), ch)) - t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_digits))))
  5738. bits *= int32(10)
  5739. bits += n
  5740. goto _19
  5741. _19:
  5742. ;
  5743. v18 = src
  5744. src++
  5745. v17 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v18)))
  5746. ch = v17
  5747. if !(v17 != int32('\000') && libc.BoolInt32(libc.Uint32FromInt32(ch) < uint32(128)) != 0 && libc.BoolInt32(libc.Uint32FromInt32(ch)-uint32('0') < uint32(10)) != 0) {
  5748. break
  5749. }
  5750. }
  5751. if ch != int32('\000') {
  5752. goto enoent
  5753. }
  5754. if bits > int32(32) {
  5755. goto emsgsize
  5756. }
  5757. }
  5758. /* Firey death and destruction unless we prefetched EOS. */
  5759. if ch != int32('\000') {
  5760. goto enoent
  5761. }
  5762. /* If nothing was written to the destination, we found no address. */
  5763. if dst == odst {
  5764. goto enoent
  5765. }
  5766. /* If no CIDR spec was given, infer width from net class. */
  5767. if bits == -int32(1) {
  5768. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(odst))) >= int32(240) { /* Class E */
  5769. bits = int32(32)
  5770. } else {
  5771. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(odst))) >= int32(224) { /* Class D */
  5772. bits = int32(4)
  5773. } else {
  5774. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(odst))) >= int32(192) { /* Class C */
  5775. bits = int32(24)
  5776. } else {
  5777. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(odst))) >= int32(128) { /* Class B */
  5778. bits = int32(16)
  5779. } else { /* Class A */
  5780. bits = int32(8)
  5781. }
  5782. }
  5783. }
  5784. }
  5785. /* If imputed mask is narrower than specified octets, widen. */
  5786. if int64(bits) < (int64(dst)-int64(odst))*int64(8) {
  5787. bits = int32((int64(dst) - int64(odst)) * int64(8))
  5788. }
  5789. }
  5790. /* Extend network to cover the actual mask. */
  5791. for int64(bits) > (int64(dst)-int64(odst))*int64(8) {
  5792. v20 = size
  5793. size--
  5794. if v20 <= uint64(0) {
  5795. goto emsgsize
  5796. }
  5797. v21 = dst
  5798. dst++
  5799. *(*uint8)(unsafe.Pointer(v21)) = uint8('\000')
  5800. }
  5801. return bits
  5802. goto enoent
  5803. enoent:
  5804. ;
  5805. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOENT)
  5806. return -int32(1)
  5807. goto emsgsize
  5808. emsgsize:
  5809. ;
  5810. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EMSGSIZE)
  5811. return -int32(1)
  5812. }
  5813. var _xdigits = [17]uint8{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}
  5814. var _digits = [11]uint8{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}
  5815. const m_MD5_BLOCK_LENGTH = 64
  5816. const m_MD5_DIGEST_LENGTH = 16
  5817. const m_RTLD_DI_LINKMAP = 2
  5818. const m_RTLD_GLOBAL = 256
  5819. const m_RTLD_LAZY = 1
  5820. const m_RTLD_LOCAL = 0
  5821. const m_RTLD_NODELETE = 4096
  5822. const m_RTLD_NOLOAD = 4
  5823. const m_RTLD_NOW = 2
  5824. type TDl_info = struct {
  5825. Fdli_fname uintptr
  5826. Fdli_fbase uintptr
  5827. Fdli_sname uintptr
  5828. Fdli_saddr uintptr
  5829. }
  5830. type TMD5_CTX = struct {
  5831. Fstate [4]Tuint32_t
  5832. Fcount Tuint64_t
  5833. Fbuffer [64]Tuint8_t
  5834. }
  5835. type TMD5Context = TMD5_CTX
  5836. /* Avoid polluting the namespace. Even though this makes this usage
  5837. * implementation-specific, defining it unconditionally should not be
  5838. * a problem, and better than possibly breaking unexpecting code. */
  5839. var _libmd_MD5Init uintptr
  5840. var _libmd_MD5Update uintptr
  5841. var _libmd_MD5Pad uintptr
  5842. var _libmd_MD5Final uintptr
  5843. var _libmd_MD5Transform uintptr
  5844. var _libmd_MD5End uintptr
  5845. var _libmd_MD5File uintptr
  5846. var _libmd_MD5FileChunk uintptr
  5847. var _libmd_MD5Data uintptr
  5848. func _libmd_loader(tls *libc.TLS, symbol uintptr) (r uintptr) {
  5849. bp := tls.Alloc(16)
  5850. defer tls.Free(16)
  5851. var func1 uintptr
  5852. _ = func1
  5853. func1 = libc.Xdlsym(tls, uintptr(-libc.Int32FromInt32(1)), symbol)
  5854. if func1 == libc.UintptrFromInt32(0) {
  5855. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+303, libc.VaList(bp+8, symbol))
  5856. libc.Xabort(tls)
  5857. }
  5858. return func1
  5859. }
  5860. func XMD5Init(tls *libc.TLS, context uintptr) {
  5861. if _libmd_MD5Init == libc.UintptrFromInt32(0) {
  5862. _libmd_MD5Init = _libmd_loader(tls, __ccgo_ts+359)
  5863. }
  5864. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{_libmd_MD5Init})))(tls, context)
  5865. }
  5866. func XMD5Update(tls *libc.TLS, context uintptr, data uintptr, len1 Tsize_t) {
  5867. if _libmd_MD5Update == libc.UintptrFromInt32(0) {
  5868. _libmd_MD5Update = _libmd_loader(tls, __ccgo_ts+367)
  5869. }
  5870. (*(*func(*libc.TLS, uintptr, uintptr, Tsize_t))(unsafe.Pointer(&struct{ uintptr }{_libmd_MD5Update})))(tls, context, data, len1)
  5871. }
  5872. func XMD5Pad(tls *libc.TLS, context uintptr) {
  5873. if _libmd_MD5Pad == libc.UintptrFromInt32(0) {
  5874. _libmd_MD5Pad = _libmd_loader(tls, __ccgo_ts+377)
  5875. }
  5876. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{_libmd_MD5Pad})))(tls, context)
  5877. }
  5878. func XMD5Final(tls *libc.TLS, digest uintptr, context uintptr) {
  5879. if _libmd_MD5Final == libc.UintptrFromInt32(0) {
  5880. _libmd_MD5Final = _libmd_loader(tls, __ccgo_ts+384)
  5881. }
  5882. (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{_libmd_MD5Final})))(tls, digest, context)
  5883. }
  5884. func XMD5Transform(tls *libc.TLS, state uintptr, block uintptr) {
  5885. if _libmd_MD5Transform == libc.UintptrFromInt32(0) {
  5886. _libmd_MD5Transform = _libmd_loader(tls, __ccgo_ts+393)
  5887. }
  5888. (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{_libmd_MD5Transform})))(tls, state, block)
  5889. }
  5890. func XMD5End(tls *libc.TLS, context uintptr, buf uintptr) (r uintptr) {
  5891. if _libmd_MD5End == libc.UintptrFromInt32(0) {
  5892. _libmd_MD5End = _libmd_loader(tls, __ccgo_ts+406)
  5893. }
  5894. return (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{_libmd_MD5End})))(tls, context, buf)
  5895. }
  5896. func XMD5File(tls *libc.TLS, filename uintptr, buf uintptr) (r uintptr) {
  5897. if _libmd_MD5File == libc.UintptrFromInt32(0) {
  5898. _libmd_MD5File = _libmd_loader(tls, __ccgo_ts+413)
  5899. }
  5900. return XMD5File(tls, filename, buf)
  5901. }
  5902. func XMD5FileChunk(tls *libc.TLS, filename uintptr, buf uintptr, offset Toff_t, length Toff_t) (r uintptr) {
  5903. if _libmd_MD5FileChunk == libc.UintptrFromInt32(0) {
  5904. _libmd_MD5FileChunk = _libmd_loader(tls, __ccgo_ts+421)
  5905. }
  5906. return (*(*func(*libc.TLS, uintptr, uintptr, Toff_t, Toff_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{_libmd_MD5FileChunk})))(tls, filename, buf, offset, length)
  5907. }
  5908. func XMD5Data(tls *libc.TLS, data uintptr, len1 Tsize_t, buf uintptr) (r uintptr) {
  5909. if _libmd_MD5Data == libc.UintptrFromInt32(0) {
  5910. _libmd_MD5Data = _libmd_loader(tls, __ccgo_ts+434)
  5911. }
  5912. return (*(*func(*libc.TLS, uintptr, Tsize_t, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{_libmd_MD5Data})))(tls, data, len1, buf)
  5913. }
  5914. const m_THRESHOLD = 16
  5915. /*
  5916. * Find the next possible pointer head. (Trickery for forcing an array
  5917. * to do double duty as a linked list when objects do not align with word
  5918. * boundaries.
  5919. */
  5920. /* Assumption: PSIZE is a power of 2. */
  5921. // C documentation
  5922. //
  5923. // /*
  5924. // * Arguments are as for qsort.
  5925. // */
  5926. func Xmergesort(tls *libc.TLS, base uintptr, nmemb Tsize_t, size Tsize_t, cmp uintptr) (r int32) {
  5927. 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
  5928. var big, iflag, sense, v2 int32
  5929. var i, v8 Tsize_t
  5930. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  5931. if size < libc.Uint64FromInt64(8)/libc.Uint64FromInt32(2) { /* Pointers must fit into 2 * size. */
  5932. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  5933. return -int32(1)
  5934. }
  5935. if nmemb == uint64(0) {
  5936. return 0
  5937. }
  5938. /*
  5939. * XXX
  5940. * Stupid subtraction for the Cray.
  5941. */
  5942. iflag = 0
  5943. if !(size%libc.Uint64FromInt64(4) != 0) && !(libc.Uint64FromInt64(int64(base)-int64(libc.UintptrFromInt32(0)))%libc.Uint64FromInt64(4) != 0) {
  5944. iflag = int32(1)
  5945. }
  5946. v1 = libc.Xmalloc(tls, nmemb*size+uint64(8))
  5947. list2 = v1
  5948. if v1 == libc.UintptrFromInt32(0) {
  5949. return -int32(1)
  5950. }
  5951. list1 = base
  5952. _setup(tls, list1, list2, nmemb, size, cmp)
  5953. last = list2 + uintptr(nmemb*size)
  5954. v2 = libc.Int32FromInt32(0)
  5955. big = v2
  5956. i = libc.Uint64FromInt32(v2)
  5957. 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 {
  5958. l2 = list1
  5959. 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)))
  5960. v4 = list2
  5961. p2 = v4
  5962. tp2 = v4
  5963. for {
  5964. if !(p2 != last) {
  5965. break
  5966. }
  5967. 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)))))
  5968. f1 = l2
  5969. v5 = list1 + uintptr(int64(p2)-int64(list2))
  5970. l1 = v5
  5971. f2 = v5
  5972. if p2 != last {
  5973. 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)))))
  5974. }
  5975. l2 = list1 + uintptr(int64(p2)-int64(list2))
  5976. for f1 < l1 && f2 < l2 {
  5977. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f1, f2) <= 0 {
  5978. q = f2
  5979. b = f1
  5980. t = l1
  5981. sense = -int32(1)
  5982. } else {
  5983. q = f1
  5984. b = f2
  5985. t = l2
  5986. sense = 0
  5987. }
  5988. if !!(big != 0) {
  5989. goto _6
  5990. } /* here i = 0 */
  5991. for {
  5992. b += uintptr(size)
  5993. if !(b < t && (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, b) > sense) {
  5994. break
  5995. }
  5996. i++
  5997. v8 = i
  5998. if v8 == uint64(6) {
  5999. big = int32(1)
  6000. goto EXPONENTIAL
  6001. }
  6002. }
  6003. goto _7
  6004. _6:
  6005. ;
  6006. goto EXPONENTIAL
  6007. EXPONENTIAL:
  6008. ;
  6009. i = size
  6010. for {
  6011. v10 = b + uintptr(i)
  6012. p = v10
  6013. if v10 >= t {
  6014. v11 = t - uintptr(size)
  6015. p = v11
  6016. if v11 > b && (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, p) <= sense {
  6017. t = p
  6018. } else {
  6019. b = p
  6020. }
  6021. break
  6022. } else {
  6023. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, p) <= sense {
  6024. t = p
  6025. if i == size {
  6026. big = 0
  6027. }
  6028. goto FASTCASE
  6029. } else {
  6030. b = p
  6031. }
  6032. }
  6033. goto _9
  6034. _9:
  6035. ;
  6036. i <<= uint64(1)
  6037. }
  6038. for t > b+uintptr(size) {
  6039. i = libc.Uint64FromInt64(int64(t)-int64(b)) / size >> int32(1) * size
  6040. v12 = b + uintptr(i)
  6041. p = v12
  6042. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, v12) <= sense {
  6043. t = p
  6044. } else {
  6045. b = p
  6046. }
  6047. }
  6048. goto COPY
  6049. goto FASTCASE
  6050. FASTCASE:
  6051. ;
  6052. for i > size {
  6053. i >>= uint64(1)
  6054. v13 = b + uintptr(i)
  6055. p = v13
  6056. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, v13) <= sense {
  6057. t = p
  6058. } else {
  6059. b = p
  6060. }
  6061. }
  6062. goto COPY
  6063. COPY:
  6064. ;
  6065. b = t
  6066. _7:
  6067. ;
  6068. i = size
  6069. if q == f1 {
  6070. if iflag != 0 {
  6071. for cond := true; cond; cond = f2 < b {
  6072. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f2))
  6073. f2 += uintptr(4)
  6074. tp2 += uintptr(4)
  6075. }
  6076. for {
  6077. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f1))
  6078. f1 += uintptr(4)
  6079. tp2 += uintptr(4)
  6080. goto _14
  6081. _14:
  6082. ;
  6083. i -= uint64(4)
  6084. if !(i != 0) {
  6085. break
  6086. }
  6087. }
  6088. } else {
  6089. for cond := true; cond; cond = f2 < b {
  6090. v15 = tp2
  6091. tp2++
  6092. v16 = f2
  6093. f2++
  6094. *(*uint8)(unsafe.Pointer(v15)) = *(*uint8)(unsafe.Pointer(v16))
  6095. }
  6096. for {
  6097. v18 = tp2
  6098. tp2++
  6099. v19 = f1
  6100. f1++
  6101. *(*uint8)(unsafe.Pointer(v18)) = *(*uint8)(unsafe.Pointer(v19))
  6102. goto _17
  6103. _17:
  6104. ;
  6105. i -= uint64(1)
  6106. if !(i != 0) {
  6107. break
  6108. }
  6109. }
  6110. }
  6111. } else {
  6112. if iflag != 0 {
  6113. for cond := true; cond; cond = f1 < b {
  6114. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f1))
  6115. f1 += uintptr(4)
  6116. tp2 += uintptr(4)
  6117. }
  6118. for {
  6119. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f2))
  6120. f2 += uintptr(4)
  6121. tp2 += uintptr(4)
  6122. goto _20
  6123. _20:
  6124. ;
  6125. i -= uint64(4)
  6126. if !(i != 0) {
  6127. break
  6128. }
  6129. }
  6130. } else {
  6131. for cond := true; cond; cond = f1 < b {
  6132. v21 = tp2
  6133. tp2++
  6134. v22 = f1
  6135. f1++
  6136. *(*uint8)(unsafe.Pointer(v21)) = *(*uint8)(unsafe.Pointer(v22))
  6137. }
  6138. for {
  6139. v24 = tp2
  6140. tp2++
  6141. v25 = f2
  6142. f2++
  6143. *(*uint8)(unsafe.Pointer(v24)) = *(*uint8)(unsafe.Pointer(v25))
  6144. goto _23
  6145. _23:
  6146. ;
  6147. i -= uint64(1)
  6148. if !(i != 0) {
  6149. break
  6150. }
  6151. }
  6152. }
  6153. }
  6154. }
  6155. if f2 < l2 {
  6156. if iflag != 0 {
  6157. for cond := true; cond; cond = f2 < l2 {
  6158. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f2))
  6159. f2 += uintptr(4)
  6160. tp2 += uintptr(4)
  6161. }
  6162. } else {
  6163. for cond := true; cond; cond = f2 < l2 {
  6164. v26 = tp2
  6165. tp2++
  6166. v27 = f2
  6167. f2++
  6168. *(*uint8)(unsafe.Pointer(v26)) = *(*uint8)(unsafe.Pointer(v27))
  6169. }
  6170. }
  6171. } else {
  6172. if f1 < l1 {
  6173. if iflag != 0 {
  6174. for cond := true; cond; cond = f1 < l1 {
  6175. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f1))
  6176. f1 += uintptr(4)
  6177. tp2 += uintptr(4)
  6178. }
  6179. } else {
  6180. for cond := true; cond; cond = f1 < l1 {
  6181. v28 = tp2
  6182. tp2++
  6183. v29 = f1
  6184. f1++
  6185. *(*uint8)(unsafe.Pointer(v28)) = *(*uint8)(unsafe.Pointer(v29))
  6186. }
  6187. }
  6188. }
  6189. }
  6190. *(*uintptr)(unsafe.Pointer(p1)) = l2
  6191. goto _3
  6192. _3:
  6193. ;
  6194. 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)))
  6195. }
  6196. tp2 = list1 /* swap list1, list2 */
  6197. list1 = list2
  6198. list2 = tp2
  6199. last = list2 + uintptr(nmemb*size)
  6200. }
  6201. if base == list2 {
  6202. libc.Xmemmove(tls, list2, list1, nmemb*size)
  6203. list2 = list1
  6204. }
  6205. libc.Xfree(tls, list2)
  6206. return 0
  6207. }
  6208. // C documentation
  6209. //
  6210. // /*
  6211. // * Optional hybrid natural/pairwise first pass. Eats up list1 in runs of
  6212. // * increasing order, list2 in a corresponding linked list. Checks for runs
  6213. // * when THRESHOLD/2 pairs compare with same sense. (Only used when NATURAL
  6214. // * is defined. Otherwise simple pairwise merging is used.)
  6215. // */
  6216. func _setup(tls *libc.TLS, list1 uintptr, list2 uintptr, n Tsize_t, size Tsize_t, cmp uintptr) {
  6217. var f1, f2, l2, last, p2, s, v10, v13, v14, v17, v18, v19, v20, v4, v7, v8 uintptr
  6218. var i, length, sense, size2, tmp, v11, v15, v5 int32
  6219. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = f1, f2, i, l2, last, length, p2, s, sense, size2, tmp, v10, v11, v13, v14, v15, v17, v18, v19, v20, v4, v5, v7, v8
  6220. size2 = libc.Int32FromUint64(size * uint64(2))
  6221. if n <= uint64(5) {
  6222. _insertionsort(tls, list1, n, size, cmp)
  6223. *(*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)
  6224. return
  6225. }
  6226. /*
  6227. * Avoid running pointers out of bounds; limit n to evens
  6228. * for simplicity.
  6229. */
  6230. i = libc.Int32FromUint64(uint64(4) + n&uint64(1))
  6231. _insertionsort(tls, list1+uintptr((n-libc.Uint64FromInt32(i))*size), libc.Uint64FromInt32(i), size, cmp)
  6232. last = list1 + uintptr(size*(n-libc.Uint64FromInt32(i)))
  6233. *(*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)
  6234. p2 = list2
  6235. f1 = list1
  6236. sense = libc.BoolInt32((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f1, f1+uintptr(size)) > 0)
  6237. for {
  6238. if !(f1 < last) {
  6239. break
  6240. }
  6241. length = int32(2)
  6242. /* Find pairs with same sense. */
  6243. f2 = f1 + uintptr(size2)
  6244. for {
  6245. if !(f2 < last) {
  6246. break
  6247. }
  6248. if libc.BoolInt32((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f2, f2+uintptr(size)) > 0) != sense {
  6249. break
  6250. }
  6251. length += int32(2)
  6252. goto _2
  6253. _2:
  6254. ;
  6255. f2 += uintptr(size2)
  6256. }
  6257. if length < int32(m_THRESHOLD) { /* Pairwise merge */
  6258. for {
  6259. v4 = uintptr(int64(f1+uintptr(size2))-int64(list1)) + list2
  6260. *(*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
  6261. p2 = v4
  6262. if sense > 0 {
  6263. s = f1 + uintptr(size)
  6264. i = libc.Int32FromUint64(size)
  6265. for {
  6266. tmp = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f1)))
  6267. v7 = f1
  6268. f1++
  6269. *(*uint8)(unsafe.Pointer(v7)) = *(*uint8)(unsafe.Pointer(s))
  6270. v8 = s
  6271. s++
  6272. *(*uint8)(unsafe.Pointer(v8)) = libc.Uint8FromInt32(tmp)
  6273. goto _6
  6274. _6:
  6275. ;
  6276. i--
  6277. v5 = i
  6278. if !(v5 != 0) {
  6279. break
  6280. }
  6281. }
  6282. f1 -= uintptr(size)
  6283. }
  6284. goto _3
  6285. _3:
  6286. ;
  6287. f1 += uintptr(size2)
  6288. if !(f1 < f2) {
  6289. break
  6290. }
  6291. }
  6292. } else { /* Natural merge */
  6293. l2 = f2
  6294. f2 = f1 + uintptr(size2)
  6295. for {
  6296. if !(f2 < l2) {
  6297. break
  6298. }
  6299. if libc.BoolInt32((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f2-uintptr(size), f2) > 0) != sense {
  6300. v10 = uintptr(int64(f2)-int64(list1)) + list2
  6301. *(*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
  6302. p2 = v10
  6303. if sense > 0 {
  6304. s = f2 - uintptr(size)
  6305. for cond := true; cond; cond = f1 < s {
  6306. i = libc.Int32FromUint64(size)
  6307. for {
  6308. tmp = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f1)))
  6309. v13 = f1
  6310. f1++
  6311. *(*uint8)(unsafe.Pointer(v13)) = *(*uint8)(unsafe.Pointer(s))
  6312. v14 = s
  6313. s++
  6314. *(*uint8)(unsafe.Pointer(v14)) = libc.Uint8FromInt32(tmp)
  6315. goto _12
  6316. _12:
  6317. ;
  6318. i--
  6319. v11 = i
  6320. if !(v11 != 0) {
  6321. break
  6322. }
  6323. }
  6324. s -= uintptr(size2)
  6325. }
  6326. }
  6327. f1 = f2
  6328. }
  6329. goto _9
  6330. _9:
  6331. ;
  6332. f2 += uintptr(size2)
  6333. }
  6334. if sense > 0 {
  6335. s = f2 - uintptr(size)
  6336. for cond := true; cond; cond = f1 < s {
  6337. i = libc.Int32FromUint64(size)
  6338. for {
  6339. tmp = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f1)))
  6340. v17 = f1
  6341. f1++
  6342. *(*uint8)(unsafe.Pointer(v17)) = *(*uint8)(unsafe.Pointer(s))
  6343. v18 = s
  6344. s++
  6345. *(*uint8)(unsafe.Pointer(v18)) = libc.Uint8FromInt32(tmp)
  6346. goto _16
  6347. _16:
  6348. ;
  6349. i--
  6350. v15 = i
  6351. if !(v15 != 0) {
  6352. break
  6353. }
  6354. }
  6355. s -= uintptr(size2)
  6356. }
  6357. }
  6358. f1 = f2
  6359. if f2 < last || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f2-uintptr(size), f2) > 0 {
  6360. v19 = uintptr(int64(f2)-int64(list1)) + list2
  6361. *(*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
  6362. p2 = v19
  6363. } else {
  6364. v20 = list2 + uintptr(n*size)
  6365. *(*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
  6366. p2 = v20
  6367. }
  6368. }
  6369. goto _1
  6370. _1:
  6371. ;
  6372. sense = libc.BoolInt32(!(sense != 0))
  6373. }
  6374. }
  6375. // C documentation
  6376. //
  6377. // /*
  6378. // * This is to avoid out-of-bounds addresses in sorting the
  6379. // * last 4 elements.
  6380. // */
  6381. func _insertionsort(tls *libc.TLS, a uintptr, n Tsize_t, size Tsize_t, cmp uintptr) {
  6382. var ai, s, t, u, v6, v7 uintptr
  6383. var i, v4 int32
  6384. var tmp uint8
  6385. var v2 Tsize_t
  6386. _, _, _, _, _, _, _, _, _, _ = ai, i, s, t, tmp, u, v2, v4, v6, v7
  6387. ai = a + uintptr(size)
  6388. for {
  6389. n--
  6390. v2 = n
  6391. if !(v2 >= uint64(1)) {
  6392. break
  6393. }
  6394. t = ai
  6395. for {
  6396. if !(t > a) {
  6397. break
  6398. }
  6399. u = t - uintptr(size)
  6400. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, u, t) <= 0 {
  6401. break
  6402. }
  6403. s = t
  6404. i = libc.Int32FromUint64(size)
  6405. for {
  6406. tmp = *(*uint8)(unsafe.Pointer(u))
  6407. v6 = u
  6408. u++
  6409. *(*uint8)(unsafe.Pointer(v6)) = *(*uint8)(unsafe.Pointer(s))
  6410. v7 = s
  6411. s++
  6412. *(*uint8)(unsafe.Pointer(v7)) = tmp
  6413. goto _5
  6414. _5:
  6415. ;
  6416. i--
  6417. v4 = i
  6418. if !(v4 != 0) {
  6419. break
  6420. }
  6421. }
  6422. u -= uintptr(size)
  6423. goto _3
  6424. _3:
  6425. ;
  6426. t -= uintptr(size)
  6427. }
  6428. goto _1
  6429. _1:
  6430. ;
  6431. ai += uintptr(size)
  6432. }
  6433. }
  6434. const m_AT_BASE = 7
  6435. const m_AT_BASE_PLATFORM = 24
  6436. const m_AT_CLKTCK = 17
  6437. const m_AT_DCACHEBSIZE = 19
  6438. const m_AT_EGID = 14
  6439. const m_AT_ENTRY = 9
  6440. const m_AT_EUID = 12
  6441. const m_AT_EXECFD = 2
  6442. const m_AT_EXECFN = 31
  6443. const m_AT_FLAGS = 8
  6444. const m_AT_FPUCW = 18
  6445. const m_AT_GID = 13
  6446. const m_AT_HWCAP = 16
  6447. const m_AT_HWCAP2 = 26
  6448. const m_AT_ICACHEBSIZE = 20
  6449. const m_AT_IGNORE = 1
  6450. const m_AT_IGNOREPPC = 22
  6451. const m_AT_L1D_CACHEGEOMETRY = 43
  6452. const m_AT_L1D_CACHESHAPE = 35
  6453. const m_AT_L1D_CACHESIZE = 42
  6454. const m_AT_L1I_CACHEGEOMETRY = 41
  6455. const m_AT_L1I_CACHESHAPE = 34
  6456. const m_AT_L1I_CACHESIZE = 40
  6457. const m_AT_L2_CACHEGEOMETRY = 45
  6458. const m_AT_L2_CACHESHAPE = 36
  6459. const m_AT_L2_CACHESIZE = 44
  6460. const m_AT_L3_CACHEGEOMETRY = 47
  6461. const m_AT_L3_CACHESHAPE = 37
  6462. const m_AT_L3_CACHESIZE = 46
  6463. const m_AT_MINSIGSTKSZ = 51
  6464. const m_AT_NOTELF = 10
  6465. const m_AT_NULL = 0
  6466. const m_AT_PAGESZ = 6
  6467. const m_AT_PHDR = 3
  6468. const m_AT_PHENT = 4
  6469. const m_AT_PHNUM = 5
  6470. const m_AT_PLATFORM = 15
  6471. const m_AT_RANDOM = 25
  6472. const m_AT_SECURE = 23
  6473. const m_AT_SYSINFO = 32
  6474. const m_AT_SYSINFO_EHDR = 33
  6475. const m_AT_UCACHEBSIZE = 21
  6476. const m_AT_UID = 11
  6477. const m_AUX_FUNC = 2
  6478. const m_AUX_OBJECT = 1
  6479. const m_BIND_WEAK = 2
  6480. const m_DF_1_CONFALT = 0x00002000
  6481. const m_DF_1_DIRECT = 0x00000100
  6482. const m_DF_1_DISPRELDNE = 0x00008000
  6483. const m_DF_1_DISPRELPND = 0x00010000
  6484. const m_DF_1_EDITED = 0x00200000
  6485. const m_DF_1_ENDFILTEE = 0x00004000
  6486. const m_DF_1_GLOBAL = 0x00000002
  6487. const m_DF_1_GLOBAUDIT = 0x01000000
  6488. const m_DF_1_GROUP = 0x00000004
  6489. const m_DF_1_IGNMULDEF = 0x00040000
  6490. const m_DF_1_INITFIRST = 0x00000020
  6491. const m_DF_1_INTERPOSE = 0x00000400
  6492. const m_DF_1_LOADFLTR = 0x00000010
  6493. const m_DF_1_NODEFLIB = 0x00000800
  6494. const m_DF_1_NODELETE = 0x00000008
  6495. const m_DF_1_NODIRECT = 0x00020000
  6496. const m_DF_1_NODUMP = 0x00001000
  6497. const m_DF_1_NOHDR = 0x00100000
  6498. const m_DF_1_NOKSYMS = 0x00080000
  6499. const m_DF_1_NOOPEN = 0x00000040
  6500. const m_DF_1_NORELOC = 0x00400000
  6501. const m_DF_1_NOW = 0x00000001
  6502. const m_DF_1_ORIGIN = 0x00000080
  6503. const m_DF_1_PIE = 0x08000000
  6504. const m_DF_1_SINGLETON = 0x02000000
  6505. const m_DF_1_STUB = 0x04000000
  6506. const m_DF_1_SYMINTPOSE = 0x00800000
  6507. const m_DF_1_TRANS = 0x00000200
  6508. const m_DF_BIND_NOW = 0x00000008
  6509. const m_DF_ORIGIN = 0x00000001
  6510. const m_DF_P1_GROUPPERM = 0x00000002
  6511. const m_DF_P1_LAZYLOAD = 0x00000001
  6512. const m_DF_STATIC_TLS = 0x00000010
  6513. const m_DF_SYMBOLIC = 0x00000002
  6514. const m_DF_TEXTREL = 0x00000004
  6515. const m_DTF_1_CONFEXP = 0x00000002
  6516. const m_DTF_1_PARINIT = 0x00000001
  6517. const m_DT_ADDRNUM = 11
  6518. const m_DT_ADDRRNGHI = 0x6ffffeff
  6519. const m_DT_ADDRRNGLO = 0x6ffffe00
  6520. const m_DT_ALPHA_NUM = 1
  6521. const m_DT_AUDIT = 0x6ffffefc
  6522. const m_DT_AUXILIARY = 0x7ffffffd
  6523. const m_DT_BIND_NOW = 24
  6524. const m_DT_CHECKSUM = 0x6ffffdf8
  6525. const m_DT_CONFIG = 0x6ffffefa
  6526. const m_DT_DEBUG = 21
  6527. const m_DT_DEPAUDIT = 0x6ffffefb
  6528. const m_DT_ENCODING = 32
  6529. const m_DT_EXTRANUM = 3
  6530. const m_DT_FEATURE_1 = 0x6ffffdfc
  6531. const m_DT_FILTER = 0x7fffffff
  6532. const m_DT_FINI = 13
  6533. const m_DT_FINI_ARRAY = 26
  6534. const m_DT_FINI_ARRAYSZ = 28
  6535. const m_DT_FLAGS = 30
  6536. const m_DT_FLAGS_1 = 0x6ffffffb
  6537. const m_DT_GNU_CONFLICT = 0x6ffffef8
  6538. const m_DT_GNU_CONFLICTSZ = 0x6ffffdf6
  6539. const m_DT_GNU_HASH = 0x6ffffef5
  6540. const m_DT_GNU_LIBLIST = 0x6ffffef9
  6541. const m_DT_GNU_LIBLISTSZ = 0x6ffffdf7
  6542. const m_DT_GNU_PRELINKED = 0x6ffffdf5
  6543. const m_DT_HASH = 4
  6544. const m_DT_HIOS = 0x6ffff000
  6545. const m_DT_HIPROC = 0x7fffffff
  6546. const m_DT_IA_64_NUM = 1
  6547. const m_DT_INIT = 12
  6548. const m_DT_INIT_ARRAY = 25
  6549. const m_DT_INIT_ARRAYSZ = 27
  6550. const m_DT_JMPREL = 23
  6551. const m_DT_LOOS = 0x6000000d
  6552. const m_DT_LOPROC = 0x70000000
  6553. const m_DT_MIPS_AUX_DYNAMIC = 0x70000031
  6554. const m_DT_MIPS_BASE_ADDRESS = 0x70000006
  6555. const m_DT_MIPS_COMPACT_SIZE = 0x7000002f
  6556. const m_DT_MIPS_CONFLICT = 0x70000008
  6557. const m_DT_MIPS_CONFLICTNO = 0x7000000b
  6558. const m_DT_MIPS_CXX_FLAGS = 0x70000022
  6559. const m_DT_MIPS_DELTA_CLASS = 0x70000017
  6560. const m_DT_MIPS_DELTA_CLASSSYM = 0x70000020
  6561. const m_DT_MIPS_DELTA_CLASSSYM_NO = 0x70000021
  6562. const m_DT_MIPS_DELTA_CLASS_NO = 0x70000018
  6563. const m_DT_MIPS_DELTA_INSTANCE = 0x70000019
  6564. const m_DT_MIPS_DELTA_INSTANCE_NO = 0x7000001a
  6565. const m_DT_MIPS_DELTA_RELOC = 0x7000001b
  6566. const m_DT_MIPS_DELTA_RELOC_NO = 0x7000001c
  6567. const m_DT_MIPS_DELTA_SYM = 0x7000001d
  6568. const m_DT_MIPS_DELTA_SYM_NO = 0x7000001e
  6569. const m_DT_MIPS_DYNSTR_ALIGN = 0x7000002b
  6570. const m_DT_MIPS_FLAGS = 0x70000005
  6571. const m_DT_MIPS_GOTSYM = 0x70000013
  6572. const m_DT_MIPS_GP_VALUE = 0x70000030
  6573. const m_DT_MIPS_HIDDEN_GOTIDX = 0x70000027
  6574. const m_DT_MIPS_HIPAGENO = 0x70000014
  6575. const m_DT_MIPS_ICHECKSUM = 0x70000003
  6576. const m_DT_MIPS_INTERFACE = 0x7000002a
  6577. const m_DT_MIPS_INTERFACE_SIZE = 0x7000002c
  6578. const m_DT_MIPS_IVERSION = 0x70000004
  6579. const m_DT_MIPS_LIBLIST = 0x70000009
  6580. const m_DT_MIPS_LIBLISTNO = 0x70000010
  6581. const m_DT_MIPS_LOCALPAGE_GOTIDX = 0x70000025
  6582. const m_DT_MIPS_LOCAL_GOTIDX = 0x70000026
  6583. const m_DT_MIPS_LOCAL_GOTNO = 0x7000000a
  6584. const m_DT_MIPS_MSYM = 0x70000007
  6585. const m_DT_MIPS_NUM = 0x36
  6586. const m_DT_MIPS_OPTIONS = 0x70000029
  6587. const m_DT_MIPS_PERF_SUFFIX = 0x7000002e
  6588. const m_DT_MIPS_PIXIE_INIT = 0x70000023
  6589. const m_DT_MIPS_PLTGOT = 0x70000032
  6590. const m_DT_MIPS_PROTECTED_GOTIDX = 0x70000028
  6591. const m_DT_MIPS_RLD_MAP = 0x70000016
  6592. const m_DT_MIPS_RLD_MAP_REL = 0x70000035
  6593. const m_DT_MIPS_RLD_TEXT_RESOLVE_ADDR = 0x7000002d
  6594. const m_DT_MIPS_RLD_VERSION = 0x70000001
  6595. const m_DT_MIPS_RWPLT = 0x70000034
  6596. const m_DT_MIPS_SYMBOL_LIB = 0x70000024
  6597. const m_DT_MIPS_SYMTABNO = 0x70000011
  6598. const m_DT_MIPS_TIME_STAMP = 0x70000002
  6599. const m_DT_MIPS_UNREFEXTNO = 0x70000012
  6600. const m_DT_MOVEENT = 0x6ffffdfa
  6601. const m_DT_MOVESZ = 0x6ffffdfb
  6602. const m_DT_MOVETAB = 0x6ffffefe
  6603. const m_DT_NEEDED = 1
  6604. const m_DT_NIOS2_GP = 0x70000002
  6605. const m_DT_NULL = 0
  6606. const m_DT_NUM = 38
  6607. const m_DT_PLTGOT = 3
  6608. const m_DT_PLTPAD = 0x6ffffefd
  6609. const m_DT_PLTPADSZ = 0x6ffffdf9
  6610. const m_DT_PLTREL = 20
  6611. const m_DT_PLTRELSZ = 2
  6612. const m_DT_POSFLAG_1 = 0x6ffffdfd
  6613. const m_DT_PPC64_NUM = 4
  6614. const m_DT_PPC_NUM = 2
  6615. const m_DT_PREINIT_ARRAY = 32
  6616. const m_DT_PREINIT_ARRAYSZ = 33
  6617. const m_DT_PROCNUM = "DT_MIPS_NUM"
  6618. const m_DT_REL = 17
  6619. const m_DT_RELA = 7
  6620. const m_DT_RELACOUNT = 0x6ffffff9
  6621. const m_DT_RELAENT = 9
  6622. const m_DT_RELASZ = 8
  6623. const m_DT_RELCOUNT = 0x6ffffffa
  6624. const m_DT_RELENT = 19
  6625. const m_DT_RELR = 36
  6626. const m_DT_RELRENT = 37
  6627. const m_DT_RELRSZ = 35
  6628. const m_DT_RELSZ = 18
  6629. const m_DT_RPATH = 15
  6630. const m_DT_RUNPATH = 29
  6631. const m_DT_SONAME = 14
  6632. const m_DT_SPARC_NUM = 2
  6633. const m_DT_SPARC_REGISTER = 0x70000001
  6634. const m_DT_STRSZ = 10
  6635. const m_DT_STRTAB = 5
  6636. const m_DT_SYMBOLIC = 16
  6637. const m_DT_SYMENT = 11
  6638. const m_DT_SYMINENT = 0x6ffffdff
  6639. const m_DT_SYMINFO = 0x6ffffeff
  6640. const m_DT_SYMINSZ = 0x6ffffdfe
  6641. const m_DT_SYMTAB = 6
  6642. const m_DT_SYMTAB_SHNDX = 34
  6643. const m_DT_TEXTREL = 22
  6644. const m_DT_TLSDESC_GOT = 0x6ffffef7
  6645. const m_DT_TLSDESC_PLT = 0x6ffffef6
  6646. const m_DT_VALNUM = 12
  6647. const m_DT_VALRNGHI = 0x6ffffdff
  6648. const m_DT_VALRNGLO = 0x6ffffd00
  6649. const m_DT_VERDEF = 0x6ffffffc
  6650. const m_DT_VERDEFNUM = 0x6ffffffd
  6651. const m_DT_VERNEED = 0x6ffffffe
  6652. const m_DT_VERNEEDNUM = 0x6fffffff
  6653. const m_DT_VERSIONTAGNUM = 16
  6654. const m_DT_VERSYM = 0x6ffffff0
  6655. const m_EFA_PARISC_1_0 = 0x020b
  6656. const m_EFA_PARISC_1_1 = 0x0210
  6657. const m_EFA_PARISC_2_0 = 0x0214
  6658. const m_EF_ALPHA_32BIT = 1
  6659. const m_EF_ALPHA_CANRELAX = 2
  6660. const m_EF_ARM_ABI_FLOAT_HARD = 0x400
  6661. const m_EF_ARM_ABI_FLOAT_SOFT = 0x200
  6662. const m_EF_ARM_ALIGN8 = 0x40
  6663. const m_EF_ARM_APCS_26 = 0x08
  6664. const m_EF_ARM_APCS_FLOAT = 0x10
  6665. const m_EF_ARM_BE8 = 0x00800000
  6666. const m_EF_ARM_DYNSYMSUSESEGIDX = 0x08
  6667. const m_EF_ARM_EABIMASK = 0xFF000000
  6668. const m_EF_ARM_EABI_UNKNOWN = 0x00000000
  6669. const m_EF_ARM_EABI_VER1 = 0x01000000
  6670. const m_EF_ARM_EABI_VER2 = 0x02000000
  6671. const m_EF_ARM_EABI_VER3 = 0x03000000
  6672. const m_EF_ARM_EABI_VER4 = 0x04000000
  6673. const m_EF_ARM_EABI_VER5 = 0x05000000
  6674. const m_EF_ARM_HASENTRY = 0x02
  6675. const m_EF_ARM_INTERWORK = 0x04
  6676. const m_EF_ARM_LE8 = 0x00400000
  6677. const m_EF_ARM_MAPSYMSFIRST = 0x10
  6678. const m_EF_ARM_MAVERICK_FLOAT = 0x800
  6679. const m_EF_ARM_NEW_ABI = 0x80
  6680. const m_EF_ARM_OLD_ABI = 0x100
  6681. const m_EF_ARM_PIC = 0x20
  6682. const m_EF_ARM_RELEXEC = 0x01
  6683. const m_EF_ARM_SOFT_FLOAT = 0x200
  6684. const m_EF_ARM_SYMSARESORTED = 0x04
  6685. const m_EF_ARM_VFP_FLOAT = 0x400
  6686. const m_EF_CPU32 = 0x00810000
  6687. const m_EF_IA_64_ABI64 = 0x00000010
  6688. const m_EF_IA_64_ARCH = 0xff000000
  6689. const m_EF_IA_64_MASKOS = 0x0000000f
  6690. const m_EF_LARCH_ABI_DOUBLE_FLOAT = 0x03
  6691. const m_EF_LARCH_ABI_MODIFIER_MASK = 0x07
  6692. const m_EF_LARCH_ABI_SINGLE_FLOAT = 0x02
  6693. const m_EF_LARCH_ABI_SOFT_FLOAT = 0x01
  6694. const m_EF_LARCH_OBJABI_V1 = 0x40
  6695. const m_EF_MIPS_64BIT_WHIRL = 16
  6696. const m_EF_MIPS_ABI2 = 32
  6697. const m_EF_MIPS_ABI_ON32 = 64
  6698. const m_EF_MIPS_ARCH = 0xf0000000
  6699. const m_EF_MIPS_ARCH_1 = 0x00000000
  6700. const m_EF_MIPS_ARCH_2 = 0x10000000
  6701. const m_EF_MIPS_ARCH_3 = 0x20000000
  6702. const m_EF_MIPS_ARCH_32 = 0x50000000
  6703. const m_EF_MIPS_ARCH_32R2 = 0x70000000
  6704. const m_EF_MIPS_ARCH_4 = 0x30000000
  6705. const m_EF_MIPS_ARCH_5 = 0x40000000
  6706. const m_EF_MIPS_ARCH_64 = 0x60000000
  6707. const m_EF_MIPS_ARCH_64R2 = 0x80000000
  6708. const m_EF_MIPS_CPIC = 4
  6709. const m_EF_MIPS_FP64 = 512
  6710. const m_EF_MIPS_NAN2008 = 1024
  6711. const m_EF_MIPS_NOREORDER = 1
  6712. const m_EF_MIPS_PIC = 2
  6713. const m_EF_MIPS_XGOT = 8
  6714. const m_EF_PARISC_ARCH = 0x0000ffff
  6715. const m_EF_PARISC_EXT = 0x00020000
  6716. const m_EF_PARISC_LAZYSWAP = 0x00400000
  6717. const m_EF_PARISC_LSB = 0x00040000
  6718. const m_EF_PARISC_NO_KABP = 0x00100000
  6719. const m_EF_PARISC_TRAPNIL = 0x00010000
  6720. const m_EF_PARISC_WIDE = 0x00080000
  6721. const m_EF_PPC64_ABI = 3
  6722. const m_EF_PPC_EMB = 0x80000000
  6723. const m_EF_PPC_RELOCATABLE = 0x00010000
  6724. const m_EF_PPC_RELOCATABLE_LIB = 0x00008000
  6725. const m_EF_SH1 = 0x1
  6726. const m_EF_SH2 = 0x2
  6727. const m_EF_SH2A = 0xd
  6728. const m_EF_SH2A_NOFPU = 0x13
  6729. const m_EF_SH2A_SH3E = 0x18
  6730. const m_EF_SH2A_SH3_NOFPU = 0x16
  6731. const m_EF_SH2A_SH4 = 0x17
  6732. const m_EF_SH2A_SH4_NOFPU = 0x15
  6733. const m_EF_SH2E = 0xb
  6734. const m_EF_SH3 = 0x3
  6735. const m_EF_SH3E = 0x8
  6736. const m_EF_SH3_DSP = 0x5
  6737. const m_EF_SH3_NOMMU = 0x14
  6738. const m_EF_SH4 = 0x9
  6739. const m_EF_SH4A = 0xc
  6740. const m_EF_SH4AL_DSP = 0x6
  6741. const m_EF_SH4A_NOFPU = 0x11
  6742. const m_EF_SH4_NOFPU = 0x10
  6743. const m_EF_SH4_NOMMU_NOFPU = 0x12
  6744. const m_EF_SH_DSP = 0x4
  6745. const m_EF_SH_MACH_MASK = 0x1f
  6746. const m_EF_SH_UNKNOWN = 0x0
  6747. const m_EF_SPARCV9_MM = 3
  6748. const m_EF_SPARCV9_PSO = 1
  6749. const m_EF_SPARCV9_RMO = 2
  6750. const m_EF_SPARCV9_TSO = 0
  6751. const m_EF_SPARC_32PLUS = 0x000100
  6752. const m_EF_SPARC_EXT_MASK = 0xFFFF00
  6753. const m_EF_SPARC_HAL_R1 = 0x000400
  6754. const m_EF_SPARC_LEDATA = 0x800000
  6755. const m_EF_SPARC_SUN_US1 = 0x000200
  6756. const m_EF_SPARC_SUN_US3 = 0x000800
  6757. const m_EI_ABIVERSION = 8
  6758. const m_EI_CLASS = 4
  6759. const m_EI_DATA = 5
  6760. const m_EI_MAG0 = 0
  6761. const m_EI_MAG1 = 1
  6762. const m_EI_MAG2 = 2
  6763. const m_EI_MAG3 = 3
  6764. const m_EI_NIDENT = 16
  6765. const m_EI_OSABI = 7
  6766. const m_EI_PAD = 9
  6767. const m_EI_VERSION = 6
  6768. const m_ELFCLASS32 = 1
  6769. const m_ELFCLASS64 = 2
  6770. const m_ELFCLASSNONE = 0
  6771. const m_ELFCLASSNUM = 3
  6772. const m_ELFCOMPRESS_HIOS = 0x6fffffff
  6773. const m_ELFCOMPRESS_HIPROC = 0x7fffffff
  6774. const m_ELFCOMPRESS_LOOS = 0x60000000
  6775. const m_ELFCOMPRESS_LOPROC = 0x70000000
  6776. const m_ELFCOMPRESS_ZLIB = 1
  6777. const m_ELFCOMPRESS_ZSTD = 2
  6778. const m_ELFDATA2LSB = 1
  6779. const m_ELFDATA2MSB = 2
  6780. const m_ELFDATANONE = 0
  6781. const m_ELFDATANUM = 3
  6782. const m_ELFMAG = "\\177ELF"
  6783. const m_ELFMAG0 = 127
  6784. const m_ELFMAG1 = 69
  6785. const m_ELFMAG2 = 76
  6786. const m_ELFMAG3 = 70
  6787. const m_ELFOSABI_AIX = 7
  6788. const m_ELFOSABI_ARM = 97
  6789. const m_ELFOSABI_FREEBSD = 9
  6790. const m_ELFOSABI_GNU = 3
  6791. const m_ELFOSABI_HPUX = 1
  6792. const m_ELFOSABI_IRIX = 8
  6793. const m_ELFOSABI_LINUX = 3
  6794. const m_ELFOSABI_MODESTO = 11
  6795. const m_ELFOSABI_NETBSD = 2
  6796. const m_ELFOSABI_NONE = 0
  6797. const m_ELFOSABI_OPENBSD = 12
  6798. const m_ELFOSABI_SOLARIS = 6
  6799. const m_ELFOSABI_STANDALONE = 255
  6800. const m_ELFOSABI_SYSV = 0
  6801. const m_ELFOSABI_TRU64 = 10
  6802. const m_ELF_NOTE_ABI = "NT_GNU_ABI_TAG"
  6803. const m_ELF_NOTE_GNU = "GNU"
  6804. const m_ELF_NOTE_OS_FREEBSD = 3
  6805. const m_ELF_NOTE_OS_GNU = 1
  6806. const m_ELF_NOTE_OS_LINUX = 0
  6807. const m_ELF_NOTE_OS_SOLARIS2 = 2
  6808. const m_ELF_NOTE_PAGESIZE_HINT = 1
  6809. const m_ELF_NOTE_SOLARIS = "SUNW Solaris"
  6810. const m_ELF_ST_BIND = "ELF64_ST_BIND"
  6811. const m_ELF_ST_TYPE = "ELF64_ST_TYPE"
  6812. const m_ELF_TARG_CLASS = "ELFCLASS64"
  6813. const m_ELF_TARG_DATA = "ELFDATA2MSB"
  6814. const m_ELF_TARG_MACH = "EM_S390"
  6815. const m_ELF_TARG_VER = "EV_CURRENT"
  6816. const m_EM_386 = 3
  6817. const m_EM_56800EX = 200
  6818. const m_EM_68HC05 = 72
  6819. const m_EM_68HC08 = 71
  6820. const m_EM_68HC11 = 70
  6821. const m_EM_68HC12 = 53
  6822. const m_EM_68HC16 = 69
  6823. const m_EM_68K = 4
  6824. const m_EM_78KOR = 199
  6825. const m_EM_8051 = 165
  6826. const m_EM_860 = 7
  6827. const m_EM_88K = 5
  6828. const m_EM_960 = 19
  6829. const m_EM_AARCH64 = 183
  6830. const m_EM_ALPHA = 0x9026
  6831. const m_EM_ALTERA_NIOS2 = 113
  6832. const m_EM_AMDGPU = 224
  6833. const m_EM_ARC = 45
  6834. const m_EM_ARCA = 109
  6835. const m_EM_ARC_A5 = 93
  6836. const m_EM_ARC_COMPACT = 93
  6837. const m_EM_ARC_COMPACT2 = 195
  6838. const m_EM_ARM = 40
  6839. const m_EM_AVR = 83
  6840. const m_EM_AVR32 = 185
  6841. const m_EM_BA1 = 201
  6842. const m_EM_BA2 = 202
  6843. const m_EM_BLACKFIN = 106
  6844. const m_EM_BPF = 247
  6845. const m_EM_C166 = 116
  6846. const m_EM_CDP = 215
  6847. const m_EM_CE = 119
  6848. const m_EM_CLOUDSHIELD = 192
  6849. const m_EM_COGE = 216
  6850. const m_EM_COLDFIRE = 52
  6851. const m_EM_COOL = 217
  6852. const m_EM_COREA_1ST = 193
  6853. const m_EM_COREA_2ND = 194
  6854. const m_EM_CR = 103
  6855. const m_EM_CR16 = 177
  6856. const m_EM_CRAYNV2 = 172
  6857. const m_EM_CRIS = 76
  6858. const m_EM_CRX = 114
  6859. const m_EM_CSKY = 252
  6860. const m_EM_CSR_KALIMBA = 219
  6861. const m_EM_CUDA = 190
  6862. const m_EM_CYPRESS_M8C = 161
  6863. const m_EM_D10V = 85
  6864. const m_EM_D30V = 86
  6865. const m_EM_DSP24 = 136
  6866. const m_EM_DSPIC30F = 118
  6867. const m_EM_DXP = 112
  6868. const m_EM_ECOG16 = 176
  6869. const m_EM_ECOG1X = 168
  6870. const m_EM_ECOG2 = 134
  6871. const m_EM_EMX16 = 212
  6872. const m_EM_EMX8 = 213
  6873. const m_EM_ETPU = 178
  6874. const m_EM_EXCESS = 111
  6875. const m_EM_F2MC16 = 104
  6876. const m_EM_FAKE_ALPHA = 41
  6877. const m_EM_FIREPATH = 78
  6878. const m_EM_FR20 = 37
  6879. const m_EM_FR30 = 84
  6880. const m_EM_FT32 = 222
  6881. const m_EM_FX66 = 66
  6882. const m_EM_H8S = 48
  6883. const m_EM_H8_300 = 46
  6884. const m_EM_H8_300H = 47
  6885. const m_EM_H8_500 = 49
  6886. const m_EM_HUANY = 81
  6887. const m_EM_IA_64 = 50
  6888. const m_EM_IP2K = 101
  6889. const m_EM_JAVELIN = 77
  6890. const m_EM_K10M = 181
  6891. const m_EM_KM32 = 210
  6892. const m_EM_KMX32 = 211
  6893. const m_EM_KVARC = 214
  6894. const m_EM_L10M = 180
  6895. const m_EM_LATTICEMICO32 = 138
  6896. const m_EM_LOONGARCH = 258
  6897. const m_EM_M16C = 117
  6898. const m_EM_M32 = 1
  6899. const m_EM_M32C = 120
  6900. const m_EM_M32R = 88
  6901. const m_EM_MANIK = 171
  6902. const m_EM_MAX = 102
  6903. const m_EM_MAXQ30 = 169
  6904. const m_EM_MCHP_PIC = 204
  6905. const m_EM_MCST_ELBRUS = 175
  6906. const m_EM_ME16 = 59
  6907. const m_EM_METAG = 174
  6908. const m_EM_MICROBLAZE = 189
  6909. const m_EM_MIPS = 8
  6910. const m_EM_MIPS_RS3_LE = 10
  6911. const m_EM_MIPS_X = 51
  6912. const m_EM_MMA = 54
  6913. const m_EM_MMDSP_PLUS = 160
  6914. const m_EM_MMIX = 80
  6915. const m_EM_MN10200 = 90
  6916. const m_EM_MN10300 = 89
  6917. const m_EM_MOXIE = 223
  6918. const m_EM_MSP430 = 105
  6919. const m_EM_NCPU = 56
  6920. const m_EM_NDR1 = 57
  6921. const m_EM_NDS32 = 167
  6922. const m_EM_NONE = 0
  6923. const m_EM_NORC = 218
  6924. const m_EM_NS32K = 97
  6925. const m_EM_NUM = 259
  6926. const m_EM_OPEN8 = 196
  6927. const m_EM_OPENRISC = 92
  6928. const m_EM_OR1K = 92
  6929. const m_EM_PARISC = 15
  6930. const m_EM_PCP = 55
  6931. const m_EM_PDSP = 63
  6932. const m_EM_PJ = 91
  6933. const m_EM_PPC = 20
  6934. const m_EM_PPC64 = 21
  6935. const m_EM_PRISM = 82
  6936. const m_EM_QDSP6 = 164
  6937. const m_EM_R32C = 162
  6938. const m_EM_RCE = 39
  6939. const m_EM_RH32 = 38
  6940. const m_EM_RISCV = 243
  6941. const m_EM_RL78 = 197
  6942. const m_EM_RS08 = 132
  6943. const m_EM_RX = 173
  6944. const m_EM_S370 = 9
  6945. const m_EM_S390 = 22
  6946. const m_EM_SCORE7 = 135
  6947. const m_EM_SEP = 108
  6948. const m_EM_SE_C17 = 139
  6949. const m_EM_SE_C33 = 107
  6950. const m_EM_SH = 42
  6951. const m_EM_SHARC = 133
  6952. const m_EM_SLE9X = 179
  6953. const m_EM_SNP1K = 99
  6954. const m_EM_SPARC = 2
  6955. const m_EM_SPARC32PLUS = 18
  6956. const m_EM_SPARCV9 = 43
  6957. const m_EM_ST100 = 60
  6958. const m_EM_ST19 = 74
  6959. const m_EM_ST200 = 100
  6960. const m_EM_ST7 = 68
  6961. const m_EM_ST9PLUS = 67
  6962. const m_EM_STARCORE = 58
  6963. const m_EM_STM8 = 186
  6964. const m_EM_STXP7X = 166
  6965. const m_EM_SVX = 73
  6966. const m_EM_TILE64 = 187
  6967. const m_EM_TILEGX = 191
  6968. const m_EM_TILEPRO = 188
  6969. const m_EM_TINYJ = 61
  6970. const m_EM_TI_ARP32 = 143
  6971. const m_EM_TI_C2000 = 141
  6972. const m_EM_TI_C5500 = 142
  6973. const m_EM_TI_C6000 = 140
  6974. const m_EM_TI_PRU = 144
  6975. const m_EM_TMM_GPP = 96
  6976. const m_EM_TPC = 98
  6977. const m_EM_TRICORE = 44
  6978. const m_EM_TRIMEDIA = 163
  6979. const m_EM_TSK3000 = 131
  6980. const m_EM_UNICORE = 110
  6981. const m_EM_V800 = 36
  6982. const m_EM_V850 = 87
  6983. const m_EM_VAX = 75
  6984. const m_EM_VIDEOCORE = 95
  6985. const m_EM_VIDEOCORE3 = 137
  6986. const m_EM_VIDEOCORE5 = 198
  6987. const m_EM_VISIUM = 221
  6988. const m_EM_VPP500 = 17
  6989. const m_EM_X86_64 = 62
  6990. const m_EM_XCORE = 203
  6991. const m_EM_XGATE = 115
  6992. const m_EM_XIMO16 = 170
  6993. const m_EM_XTENSA = 94
  6994. const m_EM_Z80 = 220
  6995. const m_EM_ZSP = 79
  6996. const m_ET_CORE = 4
  6997. const m_ET_DYN = 3
  6998. const m_ET_EXEC = 2
  6999. const m_ET_HIOS = 0xfeff
  7000. const m_ET_HIPROC = 0xffff
  7001. const m_ET_LOOS = 0xfe00
  7002. const m_ET_LOPROC = 0xff00
  7003. const m_ET_NONE = 0
  7004. const m_ET_NUM = 5
  7005. const m_ET_REL = 1
  7006. const m_EV_CURRENT = 1
  7007. const m_EV_NONE = 0
  7008. const m_EV_NUM = 2
  7009. const m_E_MIPS_ARCH_1 = 0x00000000
  7010. const m_E_MIPS_ARCH_2 = 0x10000000
  7011. const m_E_MIPS_ARCH_3 = 0x20000000
  7012. const m_E_MIPS_ARCH_32 = 0x50000000
  7013. const m_E_MIPS_ARCH_4 = 0x30000000
  7014. const m_E_MIPS_ARCH_5 = 0x40000000
  7015. const m_E_MIPS_ARCH_64 = 0x60000000
  7016. const m_Elf_Ehdr = "Elf64_Ehdr"
  7017. const m_Elf_Off = "Elf64_Off"
  7018. const m_Elf_Shdr = "Elf64_Shdr"
  7019. const m_Elf_Sword = "Elf64_Sword"
  7020. const m_Elf_Sym = "Elf64_Sym"
  7021. const m_Elf_Word = "Elf64_Word"
  7022. const m_GRP_COMDAT = 0x1
  7023. const m_LITUSE_ALPHA_ADDR = 0
  7024. const m_LITUSE_ALPHA_BASE = 1
  7025. const m_LITUSE_ALPHA_BYTOFF = 2
  7026. const m_LITUSE_ALPHA_JSR = 3
  7027. const m_LITUSE_ALPHA_TLS_GD = 4
  7028. const m_LITUSE_ALPHA_TLS_LDM = 5
  7029. const m_LL_NONE = 0
  7030. const m_MAP_ANON1 = 0x20
  7031. const m_MAP_PRIVATE1 = 0x02
  7032. const m_MIPS_AFL_ASE_DSP = 0x00000001
  7033. const m_MIPS_AFL_ASE_DSPR2 = 0x00000002
  7034. const m_MIPS_AFL_ASE_EVA = 0x00000004
  7035. const m_MIPS_AFL_ASE_MASK = 0x00001fff
  7036. const m_MIPS_AFL_ASE_MCU = 0x00000008
  7037. const m_MIPS_AFL_ASE_MDMX = 0x00000010
  7038. const m_MIPS_AFL_ASE_MICROMIPS = 0x00000800
  7039. const m_MIPS_AFL_ASE_MIPS16 = 0x00000400
  7040. const m_MIPS_AFL_ASE_MIPS3D = 0x00000020
  7041. const m_MIPS_AFL_ASE_MSA = 0x00000200
  7042. const m_MIPS_AFL_ASE_MT = 0x00000040
  7043. const m_MIPS_AFL_ASE_SMARTMIPS = 0x00000080
  7044. const m_MIPS_AFL_ASE_VIRT = 0x00000100
  7045. const m_MIPS_AFL_ASE_XPA = 0x00001000
  7046. const m_MIPS_AFL_EXT_10000 = 11
  7047. const m_MIPS_AFL_EXT_3900 = 10
  7048. const m_MIPS_AFL_EXT_4010 = 8
  7049. const m_MIPS_AFL_EXT_4100 = 9
  7050. const m_MIPS_AFL_EXT_4111 = 13
  7051. const m_MIPS_AFL_EXT_4120 = 14
  7052. const m_MIPS_AFL_EXT_4650 = 7
  7053. const m_MIPS_AFL_EXT_5400 = 15
  7054. const m_MIPS_AFL_EXT_5500 = 16
  7055. const m_MIPS_AFL_EXT_5900 = 6
  7056. const m_MIPS_AFL_EXT_LOONGSON_2E = 17
  7057. const m_MIPS_AFL_EXT_LOONGSON_2F = 18
  7058. const m_MIPS_AFL_EXT_LOONGSON_3A = 4
  7059. const m_MIPS_AFL_EXT_OCTEON = 5
  7060. const m_MIPS_AFL_EXT_OCTEON2 = 2
  7061. const m_MIPS_AFL_EXT_OCTEONP = 3
  7062. const m_MIPS_AFL_EXT_SB1 = 12
  7063. const m_MIPS_AFL_EXT_XLR = 1
  7064. const m_MIPS_AFL_FLAGS1_ODDSPREG = 1
  7065. const m_MIPS_AFL_REG_128 = 0x03
  7066. const m_MIPS_AFL_REG_32 = 0x01
  7067. const m_MIPS_AFL_REG_64 = 0x02
  7068. const m_MIPS_AFL_REG_NONE = 0x00
  7069. const m_NT_386_IOPERM = 0x201
  7070. const m_NT_386_TLS = 0x200
  7071. const m_NT_ARC_V2 = 0x600
  7072. const m_NT_ARM_HW_BREAK = 0x402
  7073. const m_NT_ARM_HW_WATCH = 0x403
  7074. const m_NT_ARM_PACA_KEYS = 0x407
  7075. const m_NT_ARM_PACG_KEYS = 0x408
  7076. const m_NT_ARM_PAC_ENABLED_KEYS = 0x40a
  7077. const m_NT_ARM_PAC_MASK = 0x406
  7078. const m_NT_ARM_SVE = 0x405
  7079. const m_NT_ARM_SYSTEM_CALL = 0x404
  7080. const m_NT_ARM_TAGGED_ADDR_CTRL = 0x409
  7081. const m_NT_ARM_TLS = 0x401
  7082. const m_NT_ARM_VFP = 0x400
  7083. const m_NT_ASRS = 8
  7084. const m_NT_AUXV = 6
  7085. const m_NT_FILE = 0x46494c45
  7086. const m_NT_FPREGSET = 2
  7087. const m_NT_GNU_ABI_TAG = 1
  7088. const m_NT_GNU_BUILD_ID = 3
  7089. const m_NT_GNU_GOLD_VERSION = 4
  7090. const m_NT_GNU_PROPERTY_TYPE_0 = 5
  7091. const m_NT_GWINDOWS = 7
  7092. const m_NT_LOONGARCH_CPUCFG = 0xa00
  7093. const m_NT_LOONGARCH_CSR = 0xa01
  7094. const m_NT_LOONGARCH_LASX = 0xa03
  7095. const m_NT_LOONGARCH_LBT = 0xa04
  7096. const m_NT_LOONGARCH_LSX = 0xa02
  7097. const m_NT_LWPSINFO = 17
  7098. const m_NT_LWPSTATUS = 16
  7099. const m_NT_METAG_CBUF = 0x500
  7100. const m_NT_METAG_RPIPE = 0x501
  7101. const m_NT_METAG_TLS = 0x502
  7102. const m_NT_MIPS_DSP = 0x800
  7103. const m_NT_MIPS_FP_MODE = 0x801
  7104. const m_NT_MIPS_MSA = 0x802
  7105. const m_NT_PLATFORM = 5
  7106. const m_NT_PPC_DSCR = 0x105
  7107. const m_NT_PPC_EBB = 0x106
  7108. const m_NT_PPC_PMU = 0x107
  7109. const m_NT_PPC_PPR = 0x104
  7110. const m_NT_PPC_SPE = 0x101
  7111. const m_NT_PPC_TAR = 0x103
  7112. const m_NT_PPC_TM_CDSCR = 0x10f
  7113. const m_NT_PPC_TM_CFPR = 0x109
  7114. const m_NT_PPC_TM_CGPR = 0x108
  7115. const m_NT_PPC_TM_CPPR = 0x10e
  7116. const m_NT_PPC_TM_CTAR = 0x10d
  7117. const m_NT_PPC_TM_CVMX = 0x10a
  7118. const m_NT_PPC_TM_CVSX = 0x10b
  7119. const m_NT_PPC_TM_SPR = 0x10c
  7120. const m_NT_PPC_VMX = 0x100
  7121. const m_NT_PPC_VSX = 0x102
  7122. const m_NT_PRCRED = 14
  7123. const m_NT_PRFPREG = 2
  7124. const m_NT_PRFPXREG = 20
  7125. const m_NT_PRPSINFO = 3
  7126. const m_NT_PRSTATUS = 1
  7127. const m_NT_PRXFPREG = 0x46e62b7f
  7128. const m_NT_PRXREG = 4
  7129. const m_NT_PSINFO = 13
  7130. const m_NT_PSTATUS = 10
  7131. const m_NT_RISCV_CSR = 0x900
  7132. const m_NT_RISCV_VECTOR = 0x901
  7133. const m_NT_S390_CTRS = 0x304
  7134. const m_NT_S390_GS_BC = 0x30c
  7135. const m_NT_S390_GS_CB = 0x30b
  7136. const m_NT_S390_HIGH_GPRS = 0x300
  7137. const m_NT_S390_LAST_BREAK = 0x306
  7138. const m_NT_S390_PREFIX = 0x305
  7139. const m_NT_S390_RI_CB = 0x30d
  7140. const m_NT_S390_SYSTEM_CALL = 0x307
  7141. const m_NT_S390_TDB = 0x308
  7142. const m_NT_S390_TIMER = 0x301
  7143. const m_NT_S390_TODCMP = 0x302
  7144. const m_NT_S390_TODPREG = 0x303
  7145. const m_NT_S390_VXRS_HIGH = 0x30a
  7146. const m_NT_S390_VXRS_LOW = 0x309
  7147. const m_NT_SIGINFO = 0x53494749
  7148. const m_NT_TASKSTRUCT = 4
  7149. const m_NT_UTSNAME = 15
  7150. const m_NT_VERSION = 1
  7151. const m_NT_VMCOREDD = 0x700
  7152. const m_NT_X86_XSTATE = 0x202
  7153. const m_N_ABS = 2
  7154. const m_N_BSS = 8
  7155. const m_N_COMM = 0x12
  7156. const m_N_DATA = 6
  7157. const m_N_EXT = 1
  7158. const m_N_FN = 30
  7159. const m_N_FORMAT = "%08x"
  7160. const m_N_INDR = 0x0a
  7161. const m_N_SETA = 0x14
  7162. const m_N_SETB = 0x1a
  7163. const m_N_SETD = 0x18
  7164. const m_N_SETT = 0x16
  7165. const m_N_SETV = 0x1c
  7166. const m_N_SIZE = 0x0c
  7167. const m_N_STAB = 0xe0
  7168. const m_N_TEXT = 4
  7169. const m_N_TYPE = 0x1e
  7170. const m_N_UNDF = 0
  7171. const m_N_WARN = 0x1e
  7172. const m_ODK_EXCEPTIONS = 2
  7173. const m_ODK_FILL = 5
  7174. const m_ODK_HWAND = 7
  7175. const m_ODK_HWOR = 8
  7176. const m_ODK_HWPATCH = 4
  7177. const m_ODK_NULL = 0
  7178. const m_ODK_PAD = 3
  7179. const m_ODK_REGINFO = 1
  7180. const m_ODK_TAGS = 6
  7181. const m_OEX_DISMISS = 0x80000
  7182. const m_OEX_FPDBUG = 0x40000
  7183. const m_OEX_FPU_DIV0 = 0x08
  7184. const m_OEX_FPU_INEX = 0x01
  7185. const m_OEX_FPU_INVAL = 0x10
  7186. const m_OEX_FPU_MAX = 0x1f00
  7187. const m_OEX_FPU_MIN = 0x1f
  7188. const m_OEX_FPU_OFLO = 0x04
  7189. const m_OEX_FPU_UFLO = 0x02
  7190. const m_OEX_PAGE0 = 0x10000
  7191. const m_OEX_PRECISEFP = "OEX_FPDBUG"
  7192. const m_OEX_SMM = 0x20000
  7193. const m_OHWA0_R4KEOP_CHECKED = 0x00000001
  7194. const m_OHWA1_R4KEOP_CLEAN = 0x00000002
  7195. const m_OHW_R4KEOP = 0x1
  7196. const m_OHW_R5KCVTL = 0x8
  7197. const m_OHW_R5KEOP = 0x4
  7198. const m_OHW_R8KPFETCH = 0x2
  7199. const m_OPAD_POSTFIX = 0x2
  7200. const m_OPAD_PREFIX = 0x1
  7201. const m_OPAD_SYMBOL = 0x4
  7202. const m_O_CREAT2 = 0100
  7203. const m_O_NONBLOCK2 = 04000
  7204. const m_O_RDONLY1 = 0
  7205. const m_O_TRUNC2 = 01000
  7206. const m_PF_ARM_ABS = 0x40000000
  7207. const m_PF_ARM_PI = 0x20000000
  7208. const m_PF_ARM_SB = 0x10000000
  7209. const m_PF_HP_CODE = 0x01000000
  7210. const m_PF_HP_FAR_SHARED = 0x00200000
  7211. const m_PF_HP_LAZYSWAP = 0x04000000
  7212. const m_PF_HP_MODIFY = 0x02000000
  7213. const m_PF_HP_NEAR_SHARED = 0x00400000
  7214. const m_PF_HP_PAGE_SIZE = 0x00100000
  7215. const m_PF_HP_SBP = 0x08000000
  7216. const m_PF_IA_64_NORECOV = 0x80000000
  7217. const m_PF_MASKOS = 0x0ff00000
  7218. const m_PF_MASKPROC = 0xf0000000
  7219. const m_PF_MIPS_LOCAL = 0x10000000
  7220. const m_PF_PARISC_SBP = 0x08000000
  7221. const m_PN_XNUM = 0xffff
  7222. const m_PPC64_OPT_LOCALENTRY = 4
  7223. const m_PPC64_OPT_MULTI_TOC = 2
  7224. const m_PPC64_OPT_TLS = 1
  7225. const m_PPC_OPT_TLS = 1
  7226. const m_PT_DYNAMIC = 2
  7227. const m_PT_GNU_EH_FRAME = 0x6474e550
  7228. const m_PT_GNU_PROPERTY = 0x6474e553
  7229. const m_PT_GNU_RELRO = 0x6474e552
  7230. const m_PT_GNU_STACK = 0x6474e551
  7231. const m_PT_HIOS = 0x6fffffff
  7232. const m_PT_HIPROC = 0x7fffffff
  7233. const m_PT_HISUNW = 0x6fffffff
  7234. const m_PT_INTERP = 3
  7235. const m_PT_LOAD = 1
  7236. const m_PT_LOOS = 0x60000000
  7237. const m_PT_LOPROC = 0x70000000
  7238. const m_PT_LOSUNW = 0x6ffffffa
  7239. const m_PT_MIPS_ABIFLAGS = 0x70000003
  7240. const m_PT_MIPS_OPTIONS = 0x70000002
  7241. const m_PT_MIPS_REGINFO = 0x70000000
  7242. const m_PT_MIPS_RTPROC = 0x70000001
  7243. const m_PT_NOTE = 4
  7244. const m_PT_NULL = 0
  7245. const m_PT_NUM = 8
  7246. const m_PT_PARISC_ARCHEXT = 0x70000000
  7247. const m_PT_PARISC_UNWIND = 0x70000001
  7248. const m_PT_PHDR = 6
  7249. const m_PT_SHLIB = 5
  7250. const m_PT_SUNWBSS = 0x6ffffffa
  7251. const m_PT_SUNWSTACK = 0x6ffffffb
  7252. const m_PT_TLS = 7
  7253. const m_RHF_NONE = 0
  7254. const m_R_386_16 = 20
  7255. const m_R_386_32 = 1
  7256. const m_R_386_32PLT = 11
  7257. const m_R_386_8 = 22
  7258. const m_R_386_COPY = 5
  7259. const m_R_386_GLOB_DAT = 6
  7260. const m_R_386_GOT32 = 3
  7261. const m_R_386_GOT32X = 43
  7262. const m_R_386_GOTOFF = 9
  7263. const m_R_386_GOTPC = 10
  7264. const m_R_386_IRELATIVE = 42
  7265. const m_R_386_JMP_SLOT = 7
  7266. const m_R_386_NONE = 0
  7267. const m_R_386_NUM = 44
  7268. const m_R_386_PC16 = 21
  7269. const m_R_386_PC32 = 2
  7270. const m_R_386_PC8 = 23
  7271. const m_R_386_PLT32 = 4
  7272. const m_R_386_RELATIVE = 8
  7273. const m_R_386_SIZE32 = 38
  7274. const m_R_386_TLS_DESC = 41
  7275. const m_R_386_TLS_DESC_CALL = 40
  7276. const m_R_386_TLS_DTPMOD32 = 35
  7277. const m_R_386_TLS_DTPOFF32 = 36
  7278. const m_R_386_TLS_GD = 18
  7279. const m_R_386_TLS_GD_32 = 24
  7280. const m_R_386_TLS_GD_CALL = 26
  7281. const m_R_386_TLS_GD_POP = 27
  7282. const m_R_386_TLS_GD_PUSH = 25
  7283. const m_R_386_TLS_GOTDESC = 39
  7284. const m_R_386_TLS_GOTIE = 16
  7285. const m_R_386_TLS_IE = 15
  7286. const m_R_386_TLS_IE_32 = 33
  7287. const m_R_386_TLS_LDM = 19
  7288. const m_R_386_TLS_LDM_32 = 28
  7289. const m_R_386_TLS_LDM_CALL = 30
  7290. const m_R_386_TLS_LDM_POP = 31
  7291. const m_R_386_TLS_LDM_PUSH = 29
  7292. const m_R_386_TLS_LDO_32 = 32
  7293. const m_R_386_TLS_LE = 17
  7294. const m_R_386_TLS_LE_32 = 34
  7295. const m_R_386_TLS_TPOFF = 14
  7296. const m_R_386_TLS_TPOFF32 = 37
  7297. const m_R_390_12 = 2
  7298. const m_R_390_16 = 3
  7299. const m_R_390_20 = 57
  7300. const m_R_390_32 = 4
  7301. const m_R_390_64 = 22
  7302. const m_R_390_8 = 1
  7303. const m_R_390_COPY = 9
  7304. const m_R_390_GLOB_DAT = 10
  7305. const m_R_390_GOT12 = 6
  7306. const m_R_390_GOT16 = 15
  7307. const m_R_390_GOT20 = 58
  7308. const m_R_390_GOT32 = 7
  7309. const m_R_390_GOT64 = 24
  7310. const m_R_390_GOTENT = 26
  7311. const m_R_390_GOTOFF16 = 27
  7312. const m_R_390_GOTOFF32 = 13
  7313. const m_R_390_GOTOFF64 = 28
  7314. const m_R_390_GOTPC = 14
  7315. const m_R_390_GOTPCDBL = 21
  7316. const m_R_390_GOTPLT12 = 29
  7317. const m_R_390_GOTPLT16 = 30
  7318. const m_R_390_GOTPLT20 = 59
  7319. const m_R_390_GOTPLT32 = 31
  7320. const m_R_390_GOTPLT64 = 32
  7321. const m_R_390_GOTPLTENT = 33
  7322. const m_R_390_JMP_SLOT = 11
  7323. const m_R_390_NONE = 0
  7324. const m_R_390_NUM = 61
  7325. const m_R_390_PC16 = 16
  7326. const m_R_390_PC16DBL = 17
  7327. const m_R_390_PC32 = 5
  7328. const m_R_390_PC32DBL = 19
  7329. const m_R_390_PC64 = 23
  7330. const m_R_390_PLT16DBL = 18
  7331. const m_R_390_PLT32 = 8
  7332. const m_R_390_PLT32DBL = 20
  7333. const m_R_390_PLT64 = 25
  7334. const m_R_390_PLTOFF16 = 34
  7335. const m_R_390_PLTOFF32 = 35
  7336. const m_R_390_PLTOFF64 = 36
  7337. const m_R_390_RELATIVE = 12
  7338. const m_R_390_TLS_DTPMOD = 54
  7339. const m_R_390_TLS_DTPOFF = 55
  7340. const m_R_390_TLS_GD32 = 40
  7341. const m_R_390_TLS_GD64 = 41
  7342. const m_R_390_TLS_GDCALL = 38
  7343. const m_R_390_TLS_GOTIE12 = 42
  7344. const m_R_390_TLS_GOTIE20 = 60
  7345. const m_R_390_TLS_GOTIE32 = 43
  7346. const m_R_390_TLS_GOTIE64 = 44
  7347. const m_R_390_TLS_IE32 = 47
  7348. const m_R_390_TLS_IE64 = 48
  7349. const m_R_390_TLS_IEENT = 49
  7350. const m_R_390_TLS_LDCALL = 39
  7351. const m_R_390_TLS_LDM32 = 45
  7352. const m_R_390_TLS_LDM64 = 46
  7353. const m_R_390_TLS_LDO32 = 52
  7354. const m_R_390_TLS_LDO64 = 53
  7355. const m_R_390_TLS_LE32 = 50
  7356. const m_R_390_TLS_LE64 = 51
  7357. const m_R_390_TLS_LOAD = 37
  7358. const m_R_390_TLS_TPOFF = 56
  7359. const m_R_68K_16 = 2
  7360. const m_R_68K_32 = 1
  7361. const m_R_68K_8 = 3
  7362. const m_R_68K_COPY = 19
  7363. const m_R_68K_GLOB_DAT = 20
  7364. const m_R_68K_GOT16 = 8
  7365. const m_R_68K_GOT16O = 11
  7366. const m_R_68K_GOT32 = 7
  7367. const m_R_68K_GOT32O = 10
  7368. const m_R_68K_GOT8 = 9
  7369. const m_R_68K_GOT8O = 12
  7370. const m_R_68K_JMP_SLOT = 21
  7371. const m_R_68K_NONE = 0
  7372. const m_R_68K_NUM = 43
  7373. const m_R_68K_PC16 = 5
  7374. const m_R_68K_PC32 = 4
  7375. const m_R_68K_PC8 = 6
  7376. const m_R_68K_PLT16 = 14
  7377. const m_R_68K_PLT16O = 17
  7378. const m_R_68K_PLT32 = 13
  7379. const m_R_68K_PLT32O = 16
  7380. const m_R_68K_PLT8 = 15
  7381. const m_R_68K_PLT8O = 18
  7382. const m_R_68K_RELATIVE = 22
  7383. const m_R_68K_TLS_DTPMOD32 = 40
  7384. const m_R_68K_TLS_DTPREL32 = 41
  7385. const m_R_68K_TLS_GD16 = 26
  7386. const m_R_68K_TLS_GD32 = 25
  7387. const m_R_68K_TLS_GD8 = 27
  7388. const m_R_68K_TLS_IE16 = 35
  7389. const m_R_68K_TLS_IE32 = 34
  7390. const m_R_68K_TLS_IE8 = 36
  7391. const m_R_68K_TLS_LDM16 = 29
  7392. const m_R_68K_TLS_LDM32 = 28
  7393. const m_R_68K_TLS_LDM8 = 30
  7394. const m_R_68K_TLS_LDO16 = 32
  7395. const m_R_68K_TLS_LDO32 = 31
  7396. const m_R_68K_TLS_LDO8 = 33
  7397. const m_R_68K_TLS_LE16 = 38
  7398. const m_R_68K_TLS_LE32 = 37
  7399. const m_R_68K_TLS_LE8 = 39
  7400. const m_R_68K_TLS_TPREL32 = 42
  7401. const m_R_AARCH64_ABS16 = 259
  7402. const m_R_AARCH64_ABS32 = 258
  7403. const m_R_AARCH64_ABS64 = 257
  7404. const m_R_AARCH64_ADD_ABS_LO12_NC = 277
  7405. const m_R_AARCH64_ADR_GOT_PAGE = 311
  7406. const m_R_AARCH64_ADR_PREL_LO21 = 274
  7407. const m_R_AARCH64_ADR_PREL_PG_HI21 = 275
  7408. const m_R_AARCH64_ADR_PREL_PG_HI21_NC = 276
  7409. const m_R_AARCH64_CALL26 = 283
  7410. const m_R_AARCH64_CONDBR19 = 280
  7411. const m_R_AARCH64_COPY = 1024
  7412. const m_R_AARCH64_GLOB_DAT = 1025
  7413. const m_R_AARCH64_GOTREL32 = 308
  7414. const m_R_AARCH64_GOTREL64 = 307
  7415. const m_R_AARCH64_GOT_LD_PREL19 = 309
  7416. const m_R_AARCH64_JUMP26 = 282
  7417. const m_R_AARCH64_JUMP_SLOT = 1026
  7418. const m_R_AARCH64_LD64_GOTOFF_LO15 = 310
  7419. const m_R_AARCH64_LD64_GOTPAGE_LO15 = 313
  7420. const m_R_AARCH64_LD64_GOT_LO12_NC = 312
  7421. const m_R_AARCH64_LDST128_ABS_LO12_NC = 299
  7422. const m_R_AARCH64_LDST16_ABS_LO12_NC = 284
  7423. const m_R_AARCH64_LDST32_ABS_LO12_NC = 285
  7424. const m_R_AARCH64_LDST64_ABS_LO12_NC = 286
  7425. const m_R_AARCH64_LDST8_ABS_LO12_NC = 278
  7426. const m_R_AARCH64_LD_PREL_LO19 = 273
  7427. const m_R_AARCH64_MOVW_GOTOFF_G0 = 300
  7428. const m_R_AARCH64_MOVW_GOTOFF_G0_NC = 301
  7429. const m_R_AARCH64_MOVW_GOTOFF_G1 = 302
  7430. const m_R_AARCH64_MOVW_GOTOFF_G1_NC = 303
  7431. const m_R_AARCH64_MOVW_GOTOFF_G2 = 304
  7432. const m_R_AARCH64_MOVW_GOTOFF_G2_NC = 305
  7433. const m_R_AARCH64_MOVW_GOTOFF_G3 = 306
  7434. const m_R_AARCH64_MOVW_PREL_G0 = 287
  7435. const m_R_AARCH64_MOVW_PREL_G0_NC = 288
  7436. const m_R_AARCH64_MOVW_PREL_G1 = 289
  7437. const m_R_AARCH64_MOVW_PREL_G1_NC = 290
  7438. const m_R_AARCH64_MOVW_PREL_G2 = 291
  7439. const m_R_AARCH64_MOVW_PREL_G2_NC = 292
  7440. const m_R_AARCH64_MOVW_PREL_G3 = 293
  7441. const m_R_AARCH64_MOVW_SABS_G0 = 270
  7442. const m_R_AARCH64_MOVW_SABS_G1 = 271
  7443. const m_R_AARCH64_MOVW_SABS_G2 = 272
  7444. const m_R_AARCH64_MOVW_UABS_G0 = 263
  7445. const m_R_AARCH64_MOVW_UABS_G0_NC = 264
  7446. const m_R_AARCH64_MOVW_UABS_G1 = 265
  7447. const m_R_AARCH64_MOVW_UABS_G1_NC = 266
  7448. const m_R_AARCH64_MOVW_UABS_G2 = 267
  7449. const m_R_AARCH64_MOVW_UABS_G2_NC = 268
  7450. const m_R_AARCH64_MOVW_UABS_G3 = 269
  7451. const m_R_AARCH64_NONE = 0
  7452. const m_R_AARCH64_P32_ABS32 = 1
  7453. const m_R_AARCH64_P32_COPY = 180
  7454. const m_R_AARCH64_P32_GLOB_DAT = 181
  7455. const m_R_AARCH64_P32_IRELATIVE = 188
  7456. const m_R_AARCH64_P32_JUMP_SLOT = 182
  7457. const m_R_AARCH64_P32_RELATIVE = 183
  7458. const m_R_AARCH64_P32_TLSDESC = 187
  7459. const m_R_AARCH64_P32_TLS_DTPMOD = 184
  7460. const m_R_AARCH64_P32_TLS_DTPREL = 185
  7461. const m_R_AARCH64_P32_TLS_TPREL = 186
  7462. const m_R_AARCH64_PREL16 = 262
  7463. const m_R_AARCH64_PREL32 = 261
  7464. const m_R_AARCH64_PREL64 = 260
  7465. const m_R_AARCH64_RELATIVE = 1027
  7466. const m_R_AARCH64_TLSDESC = 1031
  7467. const m_R_AARCH64_TLSDESC_ADD = 568
  7468. const m_R_AARCH64_TLSDESC_ADD_LO12 = 564
  7469. const m_R_AARCH64_TLSDESC_ADR_PAGE21 = 562
  7470. const m_R_AARCH64_TLSDESC_ADR_PREL21 = 561
  7471. const m_R_AARCH64_TLSDESC_CALL = 569
  7472. const m_R_AARCH64_TLSDESC_LD64_LO12 = 563
  7473. const m_R_AARCH64_TLSDESC_LDR = 567
  7474. const m_R_AARCH64_TLSDESC_LD_PREL19 = 560
  7475. const m_R_AARCH64_TLSDESC_OFF_G0_NC = 566
  7476. const m_R_AARCH64_TLSDESC_OFF_G1 = 565
  7477. const m_R_AARCH64_TLSGD_ADD_LO12_NC = 514
  7478. const m_R_AARCH64_TLSGD_ADR_PAGE21 = 513
  7479. const m_R_AARCH64_TLSGD_ADR_PREL21 = 512
  7480. const m_R_AARCH64_TLSGD_MOVW_G0_NC = 516
  7481. const m_R_AARCH64_TLSGD_MOVW_G1 = 515
  7482. const m_R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 = 541
  7483. const m_R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC = 542
  7484. const m_R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 = 543
  7485. const m_R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC = 540
  7486. const m_R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 = 539
  7487. const m_R_AARCH64_TLSLD_ADD_DTPREL_HI12 = 528
  7488. const m_R_AARCH64_TLSLD_ADD_DTPREL_LO12 = 529
  7489. const m_R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC = 530
  7490. const m_R_AARCH64_TLSLD_ADD_LO12_NC = 519
  7491. const m_R_AARCH64_TLSLD_ADR_PAGE21 = 518
  7492. const m_R_AARCH64_TLSLD_ADR_PREL21 = 517
  7493. const m_R_AARCH64_TLSLD_LDST128_DTPREL_LO12 = 572
  7494. const m_R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC = 573
  7495. const m_R_AARCH64_TLSLD_LDST16_DTPREL_LO12 = 533
  7496. const m_R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC = 534
  7497. const m_R_AARCH64_TLSLD_LDST32_DTPREL_LO12 = 535
  7498. const m_R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC = 536
  7499. const m_R_AARCH64_TLSLD_LDST64_DTPREL_LO12 = 537
  7500. const m_R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC = 538
  7501. const m_R_AARCH64_TLSLD_LDST8_DTPREL_LO12 = 531
  7502. const m_R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC = 532
  7503. const m_R_AARCH64_TLSLD_LD_PREL19 = 522
  7504. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G0 = 526
  7505. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC = 527
  7506. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G1 = 524
  7507. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC = 525
  7508. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G2 = 523
  7509. const m_R_AARCH64_TLSLD_MOVW_G0_NC = 521
  7510. const m_R_AARCH64_TLSLD_MOVW_G1 = 520
  7511. const m_R_AARCH64_TLSLE_ADD_TPREL_HI12 = 549
  7512. const m_R_AARCH64_TLSLE_ADD_TPREL_LO12 = 550
  7513. const m_R_AARCH64_TLSLE_ADD_TPREL_LO12_NC = 551
  7514. const m_R_AARCH64_TLSLE_LDST128_TPREL_LO12 = 570
  7515. const m_R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC = 571
  7516. const m_R_AARCH64_TLSLE_LDST16_TPREL_LO12 = 554
  7517. const m_R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC = 555
  7518. const m_R_AARCH64_TLSLE_LDST32_TPREL_LO12 = 556
  7519. const m_R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC = 557
  7520. const m_R_AARCH64_TLSLE_LDST64_TPREL_LO12 = 558
  7521. const m_R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC = 559
  7522. const m_R_AARCH64_TLSLE_LDST8_TPREL_LO12 = 552
  7523. const m_R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC = 553
  7524. const m_R_AARCH64_TLSLE_MOVW_TPREL_G0 = 547
  7525. const m_R_AARCH64_TLSLE_MOVW_TPREL_G0_NC = 548
  7526. const m_R_AARCH64_TLSLE_MOVW_TPREL_G1 = 545
  7527. const m_R_AARCH64_TLSLE_MOVW_TPREL_G1_NC = 546
  7528. const m_R_AARCH64_TLSLE_MOVW_TPREL_G2 = 544
  7529. const m_R_AARCH64_TLS_DTPMOD = 1028
  7530. const m_R_AARCH64_TLS_DTPMOD64 = 1028
  7531. const m_R_AARCH64_TLS_DTPREL = 1029
  7532. const m_R_AARCH64_TLS_DTPREL64 = 1029
  7533. const m_R_AARCH64_TLS_TPREL = 1030
  7534. const m_R_AARCH64_TLS_TPREL64 = 1030
  7535. const m_R_AARCH64_TSTBR14 = 279
  7536. const m_R_ALPHA_BRADDR = 7
  7537. const m_R_ALPHA_COPY = 24
  7538. const m_R_ALPHA_DTPMOD64 = 31
  7539. const m_R_ALPHA_DTPREL16 = 36
  7540. const m_R_ALPHA_DTPREL64 = 33
  7541. const m_R_ALPHA_DTPRELHI = 34
  7542. const m_R_ALPHA_DTPRELLO = 35
  7543. const m_R_ALPHA_GLOB_DAT = 25
  7544. const m_R_ALPHA_GOTDTPREL = 32
  7545. const m_R_ALPHA_GOTTPREL = 37
  7546. const m_R_ALPHA_GPDISP = 6
  7547. const m_R_ALPHA_GPREL16 = 19
  7548. const m_R_ALPHA_GPREL32 = 3
  7549. const m_R_ALPHA_GPRELHIGH = 17
  7550. const m_R_ALPHA_GPRELLOW = 18
  7551. const m_R_ALPHA_HINT = 8
  7552. const m_R_ALPHA_JMP_SLOT = 26
  7553. const m_R_ALPHA_LITERAL = 4
  7554. const m_R_ALPHA_LITUSE = 5
  7555. const m_R_ALPHA_NONE = 0
  7556. const m_R_ALPHA_NUM = 46
  7557. const m_R_ALPHA_REFLONG = 1
  7558. const m_R_ALPHA_REFQUAD = 2
  7559. const m_R_ALPHA_RELATIVE = 27
  7560. const m_R_ALPHA_SREL16 = 9
  7561. const m_R_ALPHA_SREL32 = 10
  7562. const m_R_ALPHA_SREL64 = 11
  7563. const m_R_ALPHA_TLSGD = 29
  7564. const m_R_ALPHA_TLS_GD_HI = 28
  7565. const m_R_ALPHA_TLS_LDM = 30
  7566. const m_R_ALPHA_TPREL16 = 41
  7567. const m_R_ALPHA_TPREL64 = 38
  7568. const m_R_ALPHA_TPRELHI = 39
  7569. const m_R_ALPHA_TPRELLO = 40
  7570. const m_R_ARM_ABS12 = 6
  7571. const m_R_ARM_ABS16 = 5
  7572. const m_R_ARM_ABS32 = 2
  7573. const m_R_ARM_ABS32_NOI = 55
  7574. const m_R_ARM_ABS8 = 8
  7575. const m_R_ARM_ALU_PCREL_15_8 = 33
  7576. const m_R_ARM_ALU_PCREL_23_15 = 34
  7577. const m_R_ARM_ALU_PCREL_7_0 = 32
  7578. const m_R_ARM_ALU_PC_G0 = 58
  7579. const m_R_ARM_ALU_PC_G0_NC = 57
  7580. const m_R_ARM_ALU_PC_G1 = 60
  7581. const m_R_ARM_ALU_PC_G1_NC = 59
  7582. const m_R_ARM_ALU_PC_G2 = 61
  7583. const m_R_ARM_ALU_SBREL_19_12 = 36
  7584. const m_R_ARM_ALU_SBREL_27_20 = 37
  7585. const m_R_ARM_ALU_SB_G0 = 71
  7586. const m_R_ARM_ALU_SB_G0_NC = 70
  7587. const m_R_ARM_ALU_SB_G1 = 73
  7588. const m_R_ARM_ALU_SB_G1_NC = 72
  7589. const m_R_ARM_ALU_SB_G2 = 74
  7590. const m_R_ARM_AMP_VCALL9 = 12
  7591. const m_R_ARM_BASE_ABS = 31
  7592. const m_R_ARM_CALL = 28
  7593. const m_R_ARM_COPY = 20
  7594. const m_R_ARM_GLOB_DAT = 21
  7595. const m_R_ARM_GNU_VTENTRY = 100
  7596. const m_R_ARM_GNU_VTINHERIT = 101
  7597. const m_R_ARM_GOT32 = 26
  7598. const m_R_ARM_GOTOFF = 24
  7599. const m_R_ARM_GOTOFF12 = 98
  7600. const m_R_ARM_GOTPC = 25
  7601. const m_R_ARM_GOTRELAX = 99
  7602. const m_R_ARM_GOT_ABS = 95
  7603. const m_R_ARM_GOT_BREL12 = 97
  7604. const m_R_ARM_GOT_PREL = 96
  7605. const m_R_ARM_IRELATIVE = 160
  7606. const m_R_ARM_JUMP24 = 29
  7607. const m_R_ARM_JUMP_SLOT = 22
  7608. const m_R_ARM_LDC_PC_G0 = 67
  7609. const m_R_ARM_LDC_PC_G1 = 68
  7610. const m_R_ARM_LDC_PC_G2 = 69
  7611. const m_R_ARM_LDC_SB_G0 = 81
  7612. const m_R_ARM_LDC_SB_G1 = 82
  7613. const m_R_ARM_LDC_SB_G2 = 83
  7614. const m_R_ARM_LDRS_PC_G0 = 64
  7615. const m_R_ARM_LDRS_PC_G1 = 65
  7616. const m_R_ARM_LDRS_PC_G2 = 66
  7617. const m_R_ARM_LDRS_SB_G0 = 78
  7618. const m_R_ARM_LDRS_SB_G1 = 79
  7619. const m_R_ARM_LDRS_SB_G2 = 80
  7620. const m_R_ARM_LDR_PC_G1 = 62
  7621. const m_R_ARM_LDR_PC_G2 = 63
  7622. const m_R_ARM_LDR_SBREL_11_0 = 35
  7623. const m_R_ARM_LDR_SB_G0 = 75
  7624. const m_R_ARM_LDR_SB_G1 = 76
  7625. const m_R_ARM_LDR_SB_G2 = 77
  7626. const m_R_ARM_ME_TOO = 128
  7627. const m_R_ARM_MOVT_ABS = 44
  7628. const m_R_ARM_MOVT_BREL = 85
  7629. const m_R_ARM_MOVT_PREL = 46
  7630. const m_R_ARM_MOVW_ABS_NC = 43
  7631. const m_R_ARM_MOVW_BREL = 86
  7632. const m_R_ARM_MOVW_BREL_NC = 84
  7633. const m_R_ARM_MOVW_PREL_NC = 45
  7634. const m_R_ARM_NONE = 0
  7635. const m_R_ARM_NUM = 256
  7636. const m_R_ARM_PC13 = 4
  7637. const m_R_ARM_PC24 = 1
  7638. const m_R_ARM_PLT32 = 27
  7639. const m_R_ARM_PLT32_ABS = 94
  7640. const m_R_ARM_PREL31 = 42
  7641. const m_R_ARM_RABS22 = 253
  7642. const m_R_ARM_RBASE = 255
  7643. const m_R_ARM_REL32 = 3
  7644. const m_R_ARM_REL32_NOI = 56
  7645. const m_R_ARM_RELATIVE = 23
  7646. const m_R_ARM_RPC24 = 254
  7647. const m_R_ARM_RREL32 = 252
  7648. const m_R_ARM_RSBREL32 = 250
  7649. const m_R_ARM_RXPC25 = 249
  7650. const m_R_ARM_SBREL31 = 39
  7651. const m_R_ARM_SBREL32 = 9
  7652. const m_R_ARM_TARGET1 = 38
  7653. const m_R_ARM_TARGET2 = 41
  7654. const m_R_ARM_THM_ABS5 = 7
  7655. const m_R_ARM_THM_ALU_PREL_11_0 = 53
  7656. const m_R_ARM_THM_GOT_BREL12 = 131
  7657. const m_R_ARM_THM_JUMP19 = 51
  7658. const m_R_ARM_THM_JUMP24 = 30
  7659. const m_R_ARM_THM_JUMP6 = 52
  7660. const m_R_ARM_THM_MOVT_ABS = 48
  7661. const m_R_ARM_THM_MOVT_BREL = 88
  7662. const m_R_ARM_THM_MOVT_PREL = 50
  7663. const m_R_ARM_THM_MOVW_ABS_NC = 47
  7664. const m_R_ARM_THM_MOVW_BREL = 89
  7665. const m_R_ARM_THM_MOVW_BREL_NC = 87
  7666. const m_R_ARM_THM_MOVW_PREL_NC = 49
  7667. const m_R_ARM_THM_PC11 = 102
  7668. const m_R_ARM_THM_PC12 = 54
  7669. const m_R_ARM_THM_PC22 = 10
  7670. const m_R_ARM_THM_PC8 = 11
  7671. const m_R_ARM_THM_PC9 = 103
  7672. const m_R_ARM_THM_RPC22 = 251
  7673. const m_R_ARM_THM_SWI8 = 14
  7674. const m_R_ARM_THM_TLS_CALL = 93
  7675. const m_R_ARM_THM_TLS_DESCSEQ = 129
  7676. const m_R_ARM_THM_TLS_DESCSEQ16 = 129
  7677. const m_R_ARM_THM_TLS_DESCSEQ32 = 130
  7678. const m_R_ARM_THM_XPC22 = 16
  7679. const m_R_ARM_TLS_CALL = 91
  7680. const m_R_ARM_TLS_DESC = 13
  7681. const m_R_ARM_TLS_DESCSEQ = 92
  7682. const m_R_ARM_TLS_DTPMOD32 = 17
  7683. const m_R_ARM_TLS_DTPOFF32 = 18
  7684. const m_R_ARM_TLS_GD32 = 104
  7685. const m_R_ARM_TLS_GOTDESC = 90
  7686. const m_R_ARM_TLS_IE12GP = 111
  7687. const m_R_ARM_TLS_IE32 = 107
  7688. const m_R_ARM_TLS_LDM32 = 105
  7689. const m_R_ARM_TLS_LDO12 = 109
  7690. const m_R_ARM_TLS_LDO32 = 106
  7691. const m_R_ARM_TLS_LE12 = 110
  7692. const m_R_ARM_TLS_LE32 = 108
  7693. const m_R_ARM_TLS_TPOFF32 = 19
  7694. const m_R_ARM_V4BX = 40
  7695. const m_R_ARM_XPC25 = 15
  7696. const m_R_BPF_MAP_FD = 1
  7697. const m_R_BPF_NONE = 0
  7698. const m_R_CKCORE_ADDR32 = 1
  7699. const m_R_CKCORE_ADDRGOT = 17
  7700. const m_R_CKCORE_ADDRGOT_HI16 = 36
  7701. const m_R_CKCORE_ADDRGOT_LO16 = 37
  7702. const m_R_CKCORE_ADDRPLT = 18
  7703. const m_R_CKCORE_ADDRPLT_HI16 = 38
  7704. const m_R_CKCORE_ADDRPLT_LO16 = 39
  7705. const m_R_CKCORE_ADDR_HI16 = 24
  7706. const m_R_CKCORE_ADDR_LO16 = 25
  7707. const m_R_CKCORE_COPY = 10
  7708. const m_R_CKCORE_DOFFSET_IMM18 = 44
  7709. const m_R_CKCORE_DOFFSET_IMM18BY2 = 45
  7710. const m_R_CKCORE_DOFFSET_IMM18BY4 = 46
  7711. const m_R_CKCORE_DOFFSET_LO16 = 42
  7712. const m_R_CKCORE_GLOB_DAT = 11
  7713. const m_R_CKCORE_GOT12 = 30
  7714. const m_R_CKCORE_GOT32 = 15
  7715. const m_R_CKCORE_GOTOFF = 13
  7716. const m_R_CKCORE_GOTOFF_HI16 = 28
  7717. const m_R_CKCORE_GOTOFF_LO16 = 29
  7718. const m_R_CKCORE_GOTPC = 14
  7719. const m_R_CKCORE_GOTPC_HI16 = 26
  7720. const m_R_CKCORE_GOTPC_LO16 = 27
  7721. const m_R_CKCORE_GOT_HI16 = 31
  7722. const m_R_CKCORE_GOT_IMM18BY4 = 48
  7723. const m_R_CKCORE_GOT_LO16 = 32
  7724. const m_R_CKCORE_JUMP_SLOT = 12
  7725. const m_R_CKCORE_NONE = 0
  7726. const m_R_CKCORE_PCREL32 = 5
  7727. const m_R_CKCORE_PCRELIMM11BY2 = 3
  7728. const m_R_CKCORE_PCRELIMM8BY4 = 2
  7729. const m_R_CKCORE_PCRELJSR_IMM11BY2 = 6
  7730. const m_R_CKCORE_PCREL_IMM10BY2 = 22
  7731. const m_R_CKCORE_PCREL_IMM10BY4 = 23
  7732. const m_R_CKCORE_PCREL_IMM16BY2 = 20
  7733. const m_R_CKCORE_PCREL_IMM16BY4 = 21
  7734. const m_R_CKCORE_PCREL_IMM18BY2 = 43
  7735. const m_R_CKCORE_PCREL_IMM26BY2 = 19
  7736. const m_R_CKCORE_PCREL_IMM7BY4 = 50
  7737. const m_R_CKCORE_PCREL_JSR_IMM26BY2 = 40
  7738. const m_R_CKCORE_PLT12 = 33
  7739. const m_R_CKCORE_PLT32 = 16
  7740. const m_R_CKCORE_PLT_HI16 = 34
  7741. const m_R_CKCORE_PLT_IMM18BY4 = 49
  7742. const m_R_CKCORE_PLT_LO16 = 35
  7743. const m_R_CKCORE_RELATIVE = 9
  7744. const m_R_CKCORE_TLS_DTPMOD32 = 56
  7745. const m_R_CKCORE_TLS_DTPOFF32 = 57
  7746. const m_R_CKCORE_TLS_GD32 = 53
  7747. const m_R_CKCORE_TLS_IE32 = 52
  7748. const m_R_CKCORE_TLS_LDM32 = 54
  7749. const m_R_CKCORE_TLS_LDO32 = 55
  7750. const m_R_CKCORE_TLS_LE32 = 51
  7751. const m_R_CKCORE_TLS_TPOFF32 = 58
  7752. const m_R_CKCORE_TOFFSET_LO16 = 41
  7753. const m_R_CRIS_16 = 2
  7754. const m_R_CRIS_16_GOT = 13
  7755. const m_R_CRIS_16_GOTPLT = 15
  7756. const m_R_CRIS_16_PCREL = 5
  7757. const m_R_CRIS_32 = 3
  7758. const m_R_CRIS_32_GOT = 14
  7759. const m_R_CRIS_32_GOTPLT = 16
  7760. const m_R_CRIS_32_GOTREL = 17
  7761. const m_R_CRIS_32_PCREL = 6
  7762. const m_R_CRIS_32_PLT_GOTREL = 18
  7763. const m_R_CRIS_32_PLT_PCREL = 19
  7764. const m_R_CRIS_8 = 1
  7765. const m_R_CRIS_8_PCREL = 4
  7766. const m_R_CRIS_COPY = 9
  7767. const m_R_CRIS_GLOB_DAT = 10
  7768. const m_R_CRIS_GNU_VTENTRY = 8
  7769. const m_R_CRIS_GNU_VTINHERIT = 7
  7770. const m_R_CRIS_JUMP_SLOT = 11
  7771. const m_R_CRIS_NONE = 0
  7772. const m_R_CRIS_NUM = 20
  7773. const m_R_CRIS_RELATIVE = 12
  7774. const m_R_IA64_COPY = 0x84
  7775. const m_R_IA64_DIR32LSB = 0x25
  7776. const m_R_IA64_DIR32MSB = 0x24
  7777. const m_R_IA64_DIR64LSB = 0x27
  7778. const m_R_IA64_DIR64MSB = 0x26
  7779. const m_R_IA64_DTPMOD64LSB = 0xa7
  7780. const m_R_IA64_DTPMOD64MSB = 0xa6
  7781. const m_R_IA64_DTPREL14 = 0xb1
  7782. const m_R_IA64_DTPREL22 = 0xb2
  7783. const m_R_IA64_DTPREL32LSB = 0xb5
  7784. const m_R_IA64_DTPREL32MSB = 0xb4
  7785. const m_R_IA64_DTPREL64I = 0xb3
  7786. const m_R_IA64_DTPREL64LSB = 0xb7
  7787. const m_R_IA64_DTPREL64MSB = 0xb6
  7788. const m_R_IA64_FPTR32LSB = 0x45
  7789. const m_R_IA64_FPTR32MSB = 0x44
  7790. const m_R_IA64_FPTR64I = 0x43
  7791. const m_R_IA64_FPTR64LSB = 0x47
  7792. const m_R_IA64_FPTR64MSB = 0x46
  7793. const m_R_IA64_GPREL22 = 0x2a
  7794. const m_R_IA64_GPREL32LSB = 0x2d
  7795. const m_R_IA64_GPREL32MSB = 0x2c
  7796. const m_R_IA64_GPREL64I = 0x2b
  7797. const m_R_IA64_GPREL64LSB = 0x2f
  7798. const m_R_IA64_GPREL64MSB = 0x2e
  7799. const m_R_IA64_IMM14 = 0x21
  7800. const m_R_IA64_IMM22 = 0x22
  7801. const m_R_IA64_IMM64 = 0x23
  7802. const m_R_IA64_IPLTLSB = 0x81
  7803. const m_R_IA64_IPLTMSB = 0x80
  7804. const m_R_IA64_LDXMOV = 0x87
  7805. const m_R_IA64_LTOFF22 = 0x32
  7806. const m_R_IA64_LTOFF22X = 0x86
  7807. const m_R_IA64_LTOFF64I = 0x33
  7808. const m_R_IA64_LTOFF_DTPMOD22 = 0xaa
  7809. const m_R_IA64_LTOFF_DTPREL22 = 0xba
  7810. const m_R_IA64_LTOFF_FPTR22 = 0x52
  7811. const m_R_IA64_LTOFF_FPTR32LSB = 0x55
  7812. const m_R_IA64_LTOFF_FPTR32MSB = 0x54
  7813. const m_R_IA64_LTOFF_FPTR64I = 0x53
  7814. const m_R_IA64_LTOFF_FPTR64LSB = 0x57
  7815. const m_R_IA64_LTOFF_FPTR64MSB = 0x56
  7816. const m_R_IA64_LTOFF_TPREL22 = 0x9a
  7817. const m_R_IA64_LTV32LSB = 0x75
  7818. const m_R_IA64_LTV32MSB = 0x74
  7819. const m_R_IA64_LTV64LSB = 0x77
  7820. const m_R_IA64_LTV64MSB = 0x76
  7821. const m_R_IA64_NONE = 0x00
  7822. const m_R_IA64_PCREL21B = 0x49
  7823. const m_R_IA64_PCREL21BI = 0x79
  7824. const m_R_IA64_PCREL21F = 0x4b
  7825. const m_R_IA64_PCREL21M = 0x4a
  7826. const m_R_IA64_PCREL22 = 0x7a
  7827. const m_R_IA64_PCREL32LSB = 0x4d
  7828. const m_R_IA64_PCREL32MSB = 0x4c
  7829. const m_R_IA64_PCREL60B = 0x48
  7830. const m_R_IA64_PCREL64I = 0x7b
  7831. const m_R_IA64_PCREL64LSB = 0x4f
  7832. const m_R_IA64_PCREL64MSB = 0x4e
  7833. const m_R_IA64_PLTOFF22 = 0x3a
  7834. const m_R_IA64_PLTOFF64I = 0x3b
  7835. const m_R_IA64_PLTOFF64LSB = 0x3f
  7836. const m_R_IA64_PLTOFF64MSB = 0x3e
  7837. const m_R_IA64_REL32LSB = 0x6d
  7838. const m_R_IA64_REL32MSB = 0x6c
  7839. const m_R_IA64_REL64LSB = 0x6f
  7840. const m_R_IA64_REL64MSB = 0x6e
  7841. const m_R_IA64_SECREL32LSB = 0x65
  7842. const m_R_IA64_SECREL32MSB = 0x64
  7843. const m_R_IA64_SECREL64LSB = 0x67
  7844. const m_R_IA64_SECREL64MSB = 0x66
  7845. const m_R_IA64_SEGREL32LSB = 0x5d
  7846. const m_R_IA64_SEGREL32MSB = 0x5c
  7847. const m_R_IA64_SEGREL64LSB = 0x5f
  7848. const m_R_IA64_SEGREL64MSB = 0x5e
  7849. const m_R_IA64_SUB = 0x85
  7850. const m_R_IA64_TPREL14 = 0x91
  7851. const m_R_IA64_TPREL22 = 0x92
  7852. const m_R_IA64_TPREL64I = 0x93
  7853. const m_R_IA64_TPREL64LSB = 0x97
  7854. const m_R_IA64_TPREL64MSB = 0x96
  7855. const m_R_LARCH_32 = 1
  7856. const m_R_LARCH_32_PCREL = 99
  7857. const m_R_LARCH_64 = 2
  7858. const m_R_LARCH_ABS64_HI12 = 70
  7859. const m_R_LARCH_ABS64_LO20 = 69
  7860. const m_R_LARCH_ABS_HI20 = 67
  7861. const m_R_LARCH_ABS_LO12 = 68
  7862. const m_R_LARCH_ADD16 = 48
  7863. const m_R_LARCH_ADD24 = 49
  7864. const m_R_LARCH_ADD32 = 50
  7865. const m_R_LARCH_ADD64 = 51
  7866. const m_R_LARCH_ADD8 = 47
  7867. const m_R_LARCH_B16 = 64
  7868. const m_R_LARCH_B21 = 65
  7869. const m_R_LARCH_B26 = 66
  7870. const m_R_LARCH_COPY = 4
  7871. const m_R_LARCH_GNU_VTENTRY = 58
  7872. const m_R_LARCH_GNU_VTINHERIT = 57
  7873. const m_R_LARCH_GOT64_HI12 = 82
  7874. const m_R_LARCH_GOT64_LO20 = 81
  7875. const m_R_LARCH_GOT64_PC_HI12 = 78
  7876. const m_R_LARCH_GOT64_PC_LO20 = 77
  7877. const m_R_LARCH_GOT_HI20 = 79
  7878. const m_R_LARCH_GOT_LO12 = 80
  7879. const m_R_LARCH_GOT_PC_HI20 = 75
  7880. const m_R_LARCH_GOT_PC_LO12 = 76
  7881. const m_R_LARCH_IRELATIVE = 12
  7882. const m_R_LARCH_JUMP_SLOT = 5
  7883. const m_R_LARCH_MARK_LA = 20
  7884. const m_R_LARCH_MARK_PCREL = 21
  7885. const m_R_LARCH_NONE = 0
  7886. const m_R_LARCH_PCALA64_HI12 = 74
  7887. const m_R_LARCH_PCALA64_LO20 = 73
  7888. const m_R_LARCH_PCALA_HI20 = 71
  7889. const m_R_LARCH_PCALA_LO12 = 72
  7890. const m_R_LARCH_RELATIVE = 3
  7891. const m_R_LARCH_RELAX = 100
  7892. const m_R_LARCH_SOP_ADD = 35
  7893. const m_R_LARCH_SOP_AND = 36
  7894. const m_R_LARCH_SOP_ASSERT = 30
  7895. const m_R_LARCH_SOP_IF_ELSE = 37
  7896. const m_R_LARCH_SOP_NOT = 31
  7897. const m_R_LARCH_SOP_POP_32_S_0_10_10_16_S2 = 45
  7898. const m_R_LARCH_SOP_POP_32_S_0_5_10_16_S2 = 44
  7899. const m_R_LARCH_SOP_POP_32_S_10_12 = 40
  7900. const m_R_LARCH_SOP_POP_32_S_10_16 = 41
  7901. const m_R_LARCH_SOP_POP_32_S_10_16_S2 = 42
  7902. const m_R_LARCH_SOP_POP_32_S_10_5 = 38
  7903. const m_R_LARCH_SOP_POP_32_S_5_20 = 43
  7904. const m_R_LARCH_SOP_POP_32_U = 46
  7905. const m_R_LARCH_SOP_POP_32_U_10_12 = 39
  7906. const m_R_LARCH_SOP_PUSH_ABSOLUTE = 23
  7907. const m_R_LARCH_SOP_PUSH_DUP = 24
  7908. const m_R_LARCH_SOP_PUSH_GPREL = 25
  7909. const m_R_LARCH_SOP_PUSH_PCREL = 22
  7910. const m_R_LARCH_SOP_PUSH_PLT_PCREL = 29
  7911. const m_R_LARCH_SOP_PUSH_TLS_GD = 28
  7912. const m_R_LARCH_SOP_PUSH_TLS_GOT = 27
  7913. const m_R_LARCH_SOP_PUSH_TLS_TPREL = 26
  7914. const m_R_LARCH_SOP_SL = 33
  7915. const m_R_LARCH_SOP_SR = 34
  7916. const m_R_LARCH_SOP_SUB = 32
  7917. const m_R_LARCH_SUB16 = 53
  7918. const m_R_LARCH_SUB24 = 54
  7919. const m_R_LARCH_SUB32 = 55
  7920. const m_R_LARCH_SUB64 = 56
  7921. const m_R_LARCH_SUB8 = 52
  7922. const m_R_LARCH_TLS_DTPMOD32 = 6
  7923. const m_R_LARCH_TLS_DTPMOD64 = 7
  7924. const m_R_LARCH_TLS_DTPREL32 = 8
  7925. const m_R_LARCH_TLS_DTPREL64 = 9
  7926. const m_R_LARCH_TLS_GD_HI20 = 98
  7927. const m_R_LARCH_TLS_GD_PC_HI20 = 97
  7928. const m_R_LARCH_TLS_IE64_HI12 = 94
  7929. const m_R_LARCH_TLS_IE64_LO20 = 93
  7930. const m_R_LARCH_TLS_IE64_PC_HI12 = 90
  7931. const m_R_LARCH_TLS_IE64_PC_LO20 = 89
  7932. const m_R_LARCH_TLS_IE_HI20 = 91
  7933. const m_R_LARCH_TLS_IE_LO12 = 92
  7934. const m_R_LARCH_TLS_IE_PC_HI20 = 87
  7935. const m_R_LARCH_TLS_IE_PC_LO12 = 88
  7936. const m_R_LARCH_TLS_LD_HI20 = 96
  7937. const m_R_LARCH_TLS_LD_PC_HI20 = 95
  7938. const m_R_LARCH_TLS_LE64_HI12 = 86
  7939. const m_R_LARCH_TLS_LE64_LO20 = 85
  7940. const m_R_LARCH_TLS_LE_HI20 = 83
  7941. const m_R_LARCH_TLS_LE_LO12 = 84
  7942. const m_R_LARCH_TLS_TPREL32 = 10
  7943. const m_R_LARCH_TLS_TPREL64 = 11
  7944. const m_R_M32R_10_PCREL = 4
  7945. const m_R_M32R_10_PCREL_RELA = 36
  7946. const m_R_M32R_16 = 1
  7947. const m_R_M32R_16_RELA = 33
  7948. const m_R_M32R_18_PCREL = 5
  7949. const m_R_M32R_18_PCREL_RELA = 37
  7950. const m_R_M32R_24 = 3
  7951. const m_R_M32R_24_RELA = 35
  7952. const m_R_M32R_26_PCREL = 6
  7953. const m_R_M32R_26_PCREL_RELA = 38
  7954. const m_R_M32R_26_PLTREL = 49
  7955. const m_R_M32R_32 = 2
  7956. const m_R_M32R_32_RELA = 34
  7957. const m_R_M32R_COPY = 50
  7958. const m_R_M32R_GLOB_DAT = 51
  7959. const m_R_M32R_GNU_VTENTRY = 12
  7960. const m_R_M32R_GNU_VTINHERIT = 11
  7961. const m_R_M32R_GOT16_HI_SLO = 57
  7962. const m_R_M32R_GOT16_HI_ULO = 56
  7963. const m_R_M32R_GOT16_LO = 58
  7964. const m_R_M32R_GOT24 = 48
  7965. const m_R_M32R_GOTOFF = 54
  7966. const m_R_M32R_GOTOFF_HI_SLO = 63
  7967. const m_R_M32R_GOTOFF_HI_ULO = 62
  7968. const m_R_M32R_GOTOFF_LO = 64
  7969. const m_R_M32R_GOTPC24 = 55
  7970. const m_R_M32R_GOTPC_HI_SLO = 60
  7971. const m_R_M32R_GOTPC_HI_ULO = 59
  7972. const m_R_M32R_GOTPC_LO = 61
  7973. const m_R_M32R_HI16_SLO = 8
  7974. const m_R_M32R_HI16_SLO_RELA = 40
  7975. const m_R_M32R_HI16_ULO = 7
  7976. const m_R_M32R_HI16_ULO_RELA = 39
  7977. const m_R_M32R_JMP_SLOT = 52
  7978. const m_R_M32R_LO16 = 9
  7979. const m_R_M32R_LO16_RELA = 41
  7980. const m_R_M32R_NONE = 0
  7981. const m_R_M32R_NUM = 256
  7982. const m_R_M32R_REL32 = 45
  7983. const m_R_M32R_RELATIVE = 53
  7984. const m_R_M32R_RELA_GNU_VTENTRY = 44
  7985. const m_R_M32R_RELA_GNU_VTINHERIT = 43
  7986. const m_R_M32R_SDA16 = 10
  7987. const m_R_M32R_SDA16_RELA = 42
  7988. const m_R_MICROBLAZE_32 = 1
  7989. const m_R_MICROBLAZE_32_LO = 6
  7990. const m_R_MICROBLAZE_32_PCREL = 2
  7991. const m_R_MICROBLAZE_32_PCREL_LO = 4
  7992. const m_R_MICROBLAZE_32_SYM_OP_SYM = 10
  7993. const m_R_MICROBLAZE_64 = 5
  7994. const m_R_MICROBLAZE_64_NONE = 9
  7995. const m_R_MICROBLAZE_64_PCREL = 3
  7996. const m_R_MICROBLAZE_COPY = 21
  7997. const m_R_MICROBLAZE_GLOB_DAT = 18
  7998. const m_R_MICROBLAZE_GNU_VTENTRY = 12
  7999. const m_R_MICROBLAZE_GNU_VTINHERIT = 11
  8000. const m_R_MICROBLAZE_GOTOFF_32 = 20
  8001. const m_R_MICROBLAZE_GOTOFF_64 = 19
  8002. const m_R_MICROBLAZE_GOTPC_64 = 13
  8003. const m_R_MICROBLAZE_GOT_64 = 14
  8004. const m_R_MICROBLAZE_JUMP_SLOT = 17
  8005. const m_R_MICROBLAZE_NONE = 0
  8006. const m_R_MICROBLAZE_PLT_64 = 15
  8007. const m_R_MICROBLAZE_REL = 16
  8008. const m_R_MICROBLAZE_SRO32 = 7
  8009. const m_R_MICROBLAZE_SRW32 = 8
  8010. const m_R_MICROBLAZE_TLS = 22
  8011. const m_R_MICROBLAZE_TLSDTPMOD32 = 25
  8012. const m_R_MICROBLAZE_TLSDTPREL32 = 26
  8013. const m_R_MICROBLAZE_TLSDTPREL64 = 27
  8014. const m_R_MICROBLAZE_TLSGD = 23
  8015. const m_R_MICROBLAZE_TLSGOTTPREL32 = 28
  8016. const m_R_MICROBLAZE_TLSLD = 24
  8017. const m_R_MICROBLAZE_TLSTPREL32 = 29
  8018. const m_R_MIPS_16 = 1
  8019. const m_R_MIPS_26 = 4
  8020. const m_R_MIPS_32 = 2
  8021. const m_R_MIPS_64 = 18
  8022. const m_R_MIPS_ADD_IMMEDIATE = 34
  8023. const m_R_MIPS_CALL16 = 11
  8024. const m_R_MIPS_CALL_HI16 = 30
  8025. const m_R_MIPS_CALL_LO16 = 31
  8026. const m_R_MIPS_COPY = 126
  8027. const m_R_MIPS_DELETE = 27
  8028. const m_R_MIPS_GLOB_DAT = 51
  8029. const m_R_MIPS_GOT16 = 9
  8030. const m_R_MIPS_GOT_DISP = 19
  8031. const m_R_MIPS_GOT_HI16 = 22
  8032. const m_R_MIPS_GOT_LO16 = 23
  8033. const m_R_MIPS_GOT_OFST = 21
  8034. const m_R_MIPS_GOT_PAGE = 20
  8035. const m_R_MIPS_GPREL16 = 7
  8036. const m_R_MIPS_GPREL32 = 12
  8037. const m_R_MIPS_HI16 = 5
  8038. const m_R_MIPS_HIGHER = 28
  8039. const m_R_MIPS_HIGHEST = 29
  8040. const m_R_MIPS_INSERT_A = 25
  8041. const m_R_MIPS_INSERT_B = 26
  8042. const m_R_MIPS_JALR = 37
  8043. const m_R_MIPS_JUMP_SLOT = 127
  8044. const m_R_MIPS_LITERAL = 8
  8045. const m_R_MIPS_LO16 = 6
  8046. const m_R_MIPS_NONE = 0
  8047. const m_R_MIPS_NUM = 128
  8048. const m_R_MIPS_PC16 = 10
  8049. const m_R_MIPS_PJUMP = 35
  8050. const m_R_MIPS_REL16 = 33
  8051. const m_R_MIPS_REL32 = 3
  8052. const m_R_MIPS_RELGOT = 36
  8053. const m_R_MIPS_SCN_DISP = 32
  8054. const m_R_MIPS_SHIFT5 = 16
  8055. const m_R_MIPS_SHIFT6 = 17
  8056. const m_R_MIPS_SUB = 24
  8057. const m_R_MIPS_TLS_DTPMOD32 = 38
  8058. const m_R_MIPS_TLS_DTPMOD64 = 40
  8059. const m_R_MIPS_TLS_DTPREL32 = 39
  8060. const m_R_MIPS_TLS_DTPREL64 = 41
  8061. const m_R_MIPS_TLS_DTPREL_HI16 = 44
  8062. const m_R_MIPS_TLS_DTPREL_LO16 = 45
  8063. const m_R_MIPS_TLS_GD = 42
  8064. const m_R_MIPS_TLS_GOTTPREL = 46
  8065. const m_R_MIPS_TLS_LDM = 43
  8066. const m_R_MIPS_TLS_TPREL32 = 47
  8067. const m_R_MIPS_TLS_TPREL64 = 48
  8068. const m_R_MIPS_TLS_TPREL_HI16 = 49
  8069. const m_R_MIPS_TLS_TPREL_LO16 = 50
  8070. const m_R_MN10300_16 = 2
  8071. const m_R_MN10300_24 = 9
  8072. const m_R_MN10300_32 = 1
  8073. const m_R_MN10300_8 = 3
  8074. const m_R_MN10300_COPY = 20
  8075. const m_R_MN10300_GLOB_DAT = 21
  8076. const m_R_MN10300_GNU_VTENTRY = 8
  8077. const m_R_MN10300_GNU_VTINHERIT = 7
  8078. const m_R_MN10300_GOT16 = 19
  8079. const m_R_MN10300_GOT24 = 18
  8080. const m_R_MN10300_GOT32 = 17
  8081. const m_R_MN10300_GOTOFF16 = 14
  8082. const m_R_MN10300_GOTOFF24 = 13
  8083. const m_R_MN10300_GOTOFF32 = 12
  8084. const m_R_MN10300_GOTPC16 = 11
  8085. const m_R_MN10300_GOTPC32 = 10
  8086. const m_R_MN10300_JMP_SLOT = 22
  8087. const m_R_MN10300_NONE = 0
  8088. const m_R_MN10300_NUM = 24
  8089. const m_R_MN10300_PCREL16 = 5
  8090. const m_R_MN10300_PCREL32 = 4
  8091. const m_R_MN10300_PCREL8 = 6
  8092. const m_R_MN10300_PLT16 = 16
  8093. const m_R_MN10300_PLT32 = 15
  8094. const m_R_MN10300_RELATIVE = 23
  8095. const m_R_NIOS2_ALIGN = 21
  8096. const m_R_NIOS2_BFD_RELOC_16 = 13
  8097. const m_R_NIOS2_BFD_RELOC_32 = 12
  8098. const m_R_NIOS2_BFD_RELOC_8 = 14
  8099. const m_R_NIOS2_CACHE_OPX = 6
  8100. const m_R_NIOS2_CALL16 = 23
  8101. const m_R_NIOS2_CALL26 = 4
  8102. const m_R_NIOS2_CALL26_NOAT = 41
  8103. const m_R_NIOS2_CALLR = 20
  8104. const m_R_NIOS2_CALL_HA = 45
  8105. const m_R_NIOS2_CALL_LO = 44
  8106. const m_R_NIOS2_CJMP = 19
  8107. const m_R_NIOS2_COPY = 36
  8108. const m_R_NIOS2_GLOB_DAT = 37
  8109. const m_R_NIOS2_GNU_VTENTRY = 17
  8110. const m_R_NIOS2_GNU_VTINHERIT = 16
  8111. const m_R_NIOS2_GOT16 = 22
  8112. const m_R_NIOS2_GOTOFF = 40
  8113. const m_R_NIOS2_GOTOFF_HA = 25
  8114. const m_R_NIOS2_GOTOFF_LO = 24
  8115. const m_R_NIOS2_GOT_HA = 43
  8116. const m_R_NIOS2_GOT_LO = 42
  8117. const m_R_NIOS2_GPREL = 15
  8118. const m_R_NIOS2_HI16 = 9
  8119. const m_R_NIOS2_HIADJ16 = 11
  8120. const m_R_NIOS2_IMM5 = 5
  8121. const m_R_NIOS2_IMM6 = 7
  8122. const m_R_NIOS2_IMM8 = 8
  8123. const m_R_NIOS2_JUMP_SLOT = 38
  8124. const m_R_NIOS2_LO16 = 10
  8125. const m_R_NIOS2_NONE = 0
  8126. const m_R_NIOS2_PCREL16 = 3
  8127. const m_R_NIOS2_PCREL_HA = 27
  8128. const m_R_NIOS2_PCREL_LO = 26
  8129. const m_R_NIOS2_RELATIVE = 39
  8130. const m_R_NIOS2_S16 = 1
  8131. const m_R_NIOS2_TLS_DTPMOD = 33
  8132. const m_R_NIOS2_TLS_DTPREL = 34
  8133. const m_R_NIOS2_TLS_GD16 = 28
  8134. const m_R_NIOS2_TLS_IE16 = 31
  8135. const m_R_NIOS2_TLS_LDM16 = 29
  8136. const m_R_NIOS2_TLS_LDO16 = 30
  8137. const m_R_NIOS2_TLS_LE16 = 32
  8138. const m_R_NIOS2_TLS_TPREL = 35
  8139. const m_R_NIOS2_U16 = 2
  8140. const m_R_NIOS2_UJMP = 18
  8141. const m_R_OR1K_16 = 2
  8142. const m_R_OR1K_16_PCREL = 10
  8143. const m_R_OR1K_32 = 1
  8144. const m_R_OR1K_32_PCREL = 9
  8145. const m_R_OR1K_8 = 3
  8146. const m_R_OR1K_8_PCREL = 11
  8147. const m_R_OR1K_COPY = 18
  8148. const m_R_OR1K_GLOB_DAT = 19
  8149. const m_R_OR1K_GNU_VTENTRY = 7
  8150. const m_R_OR1K_GNU_VTINHERIT = 8
  8151. const m_R_OR1K_GOT16 = 14
  8152. const m_R_OR1K_GOTOFF_HI16 = 16
  8153. const m_R_OR1K_GOTOFF_LO16 = 17
  8154. const m_R_OR1K_GOTPC_HI16 = 12
  8155. const m_R_OR1K_GOTPC_LO16 = 13
  8156. const m_R_OR1K_HI_16_IN_INSN = 5
  8157. const m_R_OR1K_INSN_REL_26 = 6
  8158. const m_R_OR1K_JMP_SLOT = 20
  8159. const m_R_OR1K_LO_16_IN_INSN = 4
  8160. const m_R_OR1K_NONE = 0
  8161. const m_R_OR1K_PLT26 = 15
  8162. const m_R_OR1K_RELATIVE = 21
  8163. const m_R_OR1K_TLS_DTPMOD = 34
  8164. const m_R_OR1K_TLS_DTPOFF = 33
  8165. const m_R_OR1K_TLS_GD_HI16 = 22
  8166. const m_R_OR1K_TLS_GD_LO16 = 23
  8167. const m_R_OR1K_TLS_IE_HI16 = 28
  8168. const m_R_OR1K_TLS_IE_LO16 = 29
  8169. const m_R_OR1K_TLS_LDM_HI16 = 24
  8170. const m_R_OR1K_TLS_LDM_LO16 = 25
  8171. const m_R_OR1K_TLS_LDO_HI16 = 26
  8172. const m_R_OR1K_TLS_LDO_LO16 = 27
  8173. const m_R_OR1K_TLS_LE_HI16 = 30
  8174. const m_R_OR1K_TLS_LE_LO16 = 31
  8175. const m_R_OR1K_TLS_TPOFF = 32
  8176. const m_R_PARISC_COPY = 128
  8177. const m_R_PARISC_DIR14DR = 84
  8178. const m_R_PARISC_DIR14R = 6
  8179. const m_R_PARISC_DIR14WR = 83
  8180. const m_R_PARISC_DIR16DF = 87
  8181. const m_R_PARISC_DIR16F = 85
  8182. const m_R_PARISC_DIR16WF = 86
  8183. const m_R_PARISC_DIR17F = 4
  8184. const m_R_PARISC_DIR17R = 3
  8185. const m_R_PARISC_DIR21L = 2
  8186. const m_R_PARISC_DIR32 = 1
  8187. const m_R_PARISC_DIR64 = 80
  8188. const m_R_PARISC_DPREL14R = 22
  8189. const m_R_PARISC_DPREL21L = 18
  8190. const m_R_PARISC_EPLT = 130
  8191. const m_R_PARISC_FPTR64 = 64
  8192. const m_R_PARISC_GNU_VTENTRY = 232
  8193. const m_R_PARISC_GNU_VTINHERIT = 233
  8194. const m_R_PARISC_GPREL14DR = 92
  8195. const m_R_PARISC_GPREL14R = 30
  8196. const m_R_PARISC_GPREL14WR = 91
  8197. const m_R_PARISC_GPREL16DF = 95
  8198. const m_R_PARISC_GPREL16F = 93
  8199. const m_R_PARISC_GPREL16WF = 94
  8200. const m_R_PARISC_GPREL21L = 26
  8201. const m_R_PARISC_GPREL64 = 88
  8202. const m_R_PARISC_HIRESERVE = 255
  8203. const m_R_PARISC_IPLT = 129
  8204. const m_R_PARISC_LORESERVE = 128
  8205. const m_R_PARISC_LTOFF14DR = 100
  8206. const m_R_PARISC_LTOFF14R = 38
  8207. const m_R_PARISC_LTOFF14WR = 99
  8208. const m_R_PARISC_LTOFF16DF = 103
  8209. const m_R_PARISC_LTOFF16F = 101
  8210. const m_R_PARISC_LTOFF16WF = 102
  8211. const m_R_PARISC_LTOFF21L = 34
  8212. const m_R_PARISC_LTOFF64 = 96
  8213. const m_R_PARISC_LTOFF_FPTR14DR = 124
  8214. const m_R_PARISC_LTOFF_FPTR14R = 62
  8215. const m_R_PARISC_LTOFF_FPTR14WR = 123
  8216. const m_R_PARISC_LTOFF_FPTR16DF = 127
  8217. const m_R_PARISC_LTOFF_FPTR16F = 125
  8218. const m_R_PARISC_LTOFF_FPTR16WF = 126
  8219. const m_R_PARISC_LTOFF_FPTR21L = 58
  8220. const m_R_PARISC_LTOFF_FPTR32 = 57
  8221. const m_R_PARISC_LTOFF_FPTR64 = 120
  8222. const m_R_PARISC_LTOFF_TP14DR = 228
  8223. const m_R_PARISC_LTOFF_TP14F = 167
  8224. const m_R_PARISC_LTOFF_TP14R = 166
  8225. const m_R_PARISC_LTOFF_TP14WR = 227
  8226. const m_R_PARISC_LTOFF_TP16DF = 231
  8227. const m_R_PARISC_LTOFF_TP16F = 229
  8228. const m_R_PARISC_LTOFF_TP16WF = 230
  8229. const m_R_PARISC_LTOFF_TP21L = 162
  8230. const m_R_PARISC_LTOFF_TP64 = 224
  8231. const m_R_PARISC_NONE = 0
  8232. const m_R_PARISC_PCREL14DR = 76
  8233. const m_R_PARISC_PCREL14R = 14
  8234. const m_R_PARISC_PCREL14WR = 75
  8235. const m_R_PARISC_PCREL16DF = 79
  8236. const m_R_PARISC_PCREL16F = 77
  8237. const m_R_PARISC_PCREL16WF = 78
  8238. const m_R_PARISC_PCREL17F = 12
  8239. const m_R_PARISC_PCREL17R = 11
  8240. const m_R_PARISC_PCREL21L = 10
  8241. const m_R_PARISC_PCREL22F = 74
  8242. const m_R_PARISC_PCREL32 = 9
  8243. const m_R_PARISC_PCREL64 = 72
  8244. const m_R_PARISC_PLABEL14R = 70
  8245. const m_R_PARISC_PLABEL21L = 66
  8246. const m_R_PARISC_PLABEL32 = 65
  8247. const m_R_PARISC_PLTOFF14DR = 116
  8248. const m_R_PARISC_PLTOFF14R = 54
  8249. const m_R_PARISC_PLTOFF14WR = 115
  8250. const m_R_PARISC_PLTOFF16DF = 119
  8251. const m_R_PARISC_PLTOFF16F = 117
  8252. const m_R_PARISC_PLTOFF16WF = 118
  8253. const m_R_PARISC_PLTOFF21L = 50
  8254. const m_R_PARISC_SECREL32 = 41
  8255. const m_R_PARISC_SECREL64 = 104
  8256. const m_R_PARISC_SEGBASE = 48
  8257. const m_R_PARISC_SEGREL32 = 49
  8258. const m_R_PARISC_SEGREL64 = 112
  8259. const m_R_PARISC_TLS_DTPMOD32 = 242
  8260. const m_R_PARISC_TLS_DTPMOD64 = 243
  8261. const m_R_PARISC_TLS_DTPOFF32 = 244
  8262. const m_R_PARISC_TLS_DTPOFF64 = 245
  8263. const m_R_PARISC_TLS_GD14R = 235
  8264. const m_R_PARISC_TLS_GD21L = 234
  8265. const m_R_PARISC_TLS_GDCALL = 236
  8266. const m_R_PARISC_TLS_IE14R = "R_PARISC_LTOFF_TP14R"
  8267. const m_R_PARISC_TLS_IE21L = "R_PARISC_LTOFF_TP21L"
  8268. const m_R_PARISC_TLS_LDM14R = 238
  8269. const m_R_PARISC_TLS_LDM21L = 237
  8270. const m_R_PARISC_TLS_LDMCALL = 239
  8271. const m_R_PARISC_TLS_LDO14R = 241
  8272. const m_R_PARISC_TLS_LDO21L = 240
  8273. const m_R_PARISC_TLS_LE14R = "R_PARISC_TPREL14R"
  8274. const m_R_PARISC_TLS_LE21L = "R_PARISC_TPREL21L"
  8275. const m_R_PARISC_TLS_TPREL32 = "R_PARISC_TPREL32"
  8276. const m_R_PARISC_TLS_TPREL64 = "R_PARISC_TPREL64"
  8277. const m_R_PARISC_TPREL14DR = 220
  8278. const m_R_PARISC_TPREL14R = 158
  8279. const m_R_PARISC_TPREL14WR = 219
  8280. const m_R_PARISC_TPREL16DF = 223
  8281. const m_R_PARISC_TPREL16F = 221
  8282. const m_R_PARISC_TPREL16WF = 222
  8283. const m_R_PARISC_TPREL21L = 154
  8284. const m_R_PARISC_TPREL32 = 153
  8285. const m_R_PARISC_TPREL64 = 216
  8286. const m_R_PPC64_ADDR14 = "R_PPC_ADDR14"
  8287. const m_R_PPC64_ADDR14_BRNTAKEN = "R_PPC_ADDR14_BRNTAKEN"
  8288. const m_R_PPC64_ADDR14_BRTAKEN = "R_PPC_ADDR14_BRTAKEN"
  8289. const m_R_PPC64_ADDR16 = "R_PPC_ADDR16"
  8290. const m_R_PPC64_ADDR16_DS = 56
  8291. const m_R_PPC64_ADDR16_HA = "R_PPC_ADDR16_HA"
  8292. const m_R_PPC64_ADDR16_HI = "R_PPC_ADDR16_HI"
  8293. const m_R_PPC64_ADDR16_HIGH = 110
  8294. const m_R_PPC64_ADDR16_HIGHA = 111
  8295. const m_R_PPC64_ADDR16_HIGHER = 39
  8296. const m_R_PPC64_ADDR16_HIGHERA = 40
  8297. const m_R_PPC64_ADDR16_HIGHEST = 41
  8298. const m_R_PPC64_ADDR16_HIGHESTA = 42
  8299. const m_R_PPC64_ADDR16_LO = "R_PPC_ADDR16_LO"
  8300. const m_R_PPC64_ADDR16_LO_DS = 57
  8301. const m_R_PPC64_ADDR24 = "R_PPC_ADDR24"
  8302. const m_R_PPC64_ADDR30 = 37
  8303. const m_R_PPC64_ADDR32 = "R_PPC_ADDR32"
  8304. const m_R_PPC64_ADDR64 = 38
  8305. const m_R_PPC64_COPY = "R_PPC_COPY"
  8306. const m_R_PPC64_DTPMOD64 = 68
  8307. const m_R_PPC64_DTPREL16 = 74
  8308. const m_R_PPC64_DTPREL16_DS = 101
  8309. const m_R_PPC64_DTPREL16_HA = 77
  8310. const m_R_PPC64_DTPREL16_HI = 76
  8311. const m_R_PPC64_DTPREL16_HIGH = 114
  8312. const m_R_PPC64_DTPREL16_HIGHA = 115
  8313. const m_R_PPC64_DTPREL16_HIGHER = 103
  8314. const m_R_PPC64_DTPREL16_HIGHERA = 104
  8315. const m_R_PPC64_DTPREL16_HIGHEST = 105
  8316. const m_R_PPC64_DTPREL16_HIGHESTA = 106
  8317. const m_R_PPC64_DTPREL16_LO = 75
  8318. const m_R_PPC64_DTPREL16_LO_DS = 102
  8319. const m_R_PPC64_DTPREL64 = 78
  8320. const m_R_PPC64_GLOB_DAT = "R_PPC_GLOB_DAT"
  8321. const m_R_PPC64_GOT16 = "R_PPC_GOT16"
  8322. const m_R_PPC64_GOT16_DS = 58
  8323. const m_R_PPC64_GOT16_HA = "R_PPC_GOT16_HA"
  8324. const m_R_PPC64_GOT16_HI = "R_PPC_GOT16_HI"
  8325. const m_R_PPC64_GOT16_LO = "R_PPC_GOT16_LO"
  8326. const m_R_PPC64_GOT16_LO_DS = 59
  8327. const m_R_PPC64_GOT_DTPREL16_DS = 91
  8328. const m_R_PPC64_GOT_DTPREL16_HA = 94
  8329. const m_R_PPC64_GOT_DTPREL16_HI = 93
  8330. const m_R_PPC64_GOT_DTPREL16_LO_DS = 92
  8331. const m_R_PPC64_GOT_TLSGD16 = 79
  8332. const m_R_PPC64_GOT_TLSGD16_HA = 82
  8333. const m_R_PPC64_GOT_TLSGD16_HI = 81
  8334. const m_R_PPC64_GOT_TLSGD16_LO = 80
  8335. const m_R_PPC64_GOT_TLSLD16 = 83
  8336. const m_R_PPC64_GOT_TLSLD16_HA = 86
  8337. const m_R_PPC64_GOT_TLSLD16_HI = 85
  8338. const m_R_PPC64_GOT_TLSLD16_LO = 84
  8339. const m_R_PPC64_GOT_TPREL16_DS = 87
  8340. const m_R_PPC64_GOT_TPREL16_HA = 90
  8341. const m_R_PPC64_GOT_TPREL16_HI = 89
  8342. const m_R_PPC64_GOT_TPREL16_LO_DS = 88
  8343. const m_R_PPC64_IRELATIVE = 248
  8344. const m_R_PPC64_JMP_IREL = 247
  8345. const m_R_PPC64_JMP_SLOT = "R_PPC_JMP_SLOT"
  8346. const m_R_PPC64_NONE = "R_PPC_NONE"
  8347. const m_R_PPC64_PLT16_HA = "R_PPC_PLT16_HA"
  8348. const m_R_PPC64_PLT16_HI = "R_PPC_PLT16_HI"
  8349. const m_R_PPC64_PLT16_LO = "R_PPC_PLT16_LO"
  8350. const m_R_PPC64_PLT16_LO_DS = 60
  8351. const m_R_PPC64_PLT32 = "R_PPC_PLT32"
  8352. const m_R_PPC64_PLT64 = 45
  8353. const m_R_PPC64_PLTGOT16 = 52
  8354. const m_R_PPC64_PLTGOT16_DS = 65
  8355. const m_R_PPC64_PLTGOT16_HA = 55
  8356. const m_R_PPC64_PLTGOT16_HI = 54
  8357. const m_R_PPC64_PLTGOT16_LO = 53
  8358. const m_R_PPC64_PLTGOT16_LO_DS = 66
  8359. const m_R_PPC64_PLTREL32 = "R_PPC_PLTREL32"
  8360. const m_R_PPC64_PLTREL64 = 46
  8361. const m_R_PPC64_REL14 = "R_PPC_REL14"
  8362. const m_R_PPC64_REL14_BRNTAKEN = "R_PPC_REL14_BRNTAKEN"
  8363. const m_R_PPC64_REL14_BRTAKEN = "R_PPC_REL14_BRTAKEN"
  8364. const m_R_PPC64_REL16 = 249
  8365. const m_R_PPC64_REL16_HA = 252
  8366. const m_R_PPC64_REL16_HI = 251
  8367. const m_R_PPC64_REL16_LO = 250
  8368. const m_R_PPC64_REL24 = "R_PPC_REL24"
  8369. const m_R_PPC64_REL32 = "R_PPC_REL32"
  8370. const m_R_PPC64_REL64 = 44
  8371. const m_R_PPC64_RELATIVE = "R_PPC_RELATIVE"
  8372. const m_R_PPC64_SECTOFF = "R_PPC_SECTOFF"
  8373. const m_R_PPC64_SECTOFF_DS = 61
  8374. const m_R_PPC64_SECTOFF_HA = "R_PPC_SECTOFF_HA"
  8375. const m_R_PPC64_SECTOFF_HI = "R_PPC_SECTOFF_HI"
  8376. const m_R_PPC64_SECTOFF_LO = "R_PPC_SECTOFF_LO"
  8377. const m_R_PPC64_SECTOFF_LO_DS = 62
  8378. const m_R_PPC64_TLS = 67
  8379. const m_R_PPC64_TLSGD = 107
  8380. const m_R_PPC64_TLSLD = 108
  8381. const m_R_PPC64_TOC = 51
  8382. const m_R_PPC64_TOC16 = 47
  8383. const m_R_PPC64_TOC16_DS = 63
  8384. const m_R_PPC64_TOC16_HA = 50
  8385. const m_R_PPC64_TOC16_HI = 49
  8386. const m_R_PPC64_TOC16_LO = 48
  8387. const m_R_PPC64_TOC16_LO_DS = 64
  8388. const m_R_PPC64_TOCSAVE = 109
  8389. const m_R_PPC64_TPREL16 = 69
  8390. const m_R_PPC64_TPREL16_DS = 95
  8391. const m_R_PPC64_TPREL16_HA = 72
  8392. const m_R_PPC64_TPREL16_HI = 71
  8393. const m_R_PPC64_TPREL16_HIGH = 112
  8394. const m_R_PPC64_TPREL16_HIGHA = 113
  8395. const m_R_PPC64_TPREL16_HIGHER = 97
  8396. const m_R_PPC64_TPREL16_HIGHERA = 98
  8397. const m_R_PPC64_TPREL16_HIGHEST = 99
  8398. const m_R_PPC64_TPREL16_HIGHESTA = 100
  8399. const m_R_PPC64_TPREL16_LO = 70
  8400. const m_R_PPC64_TPREL16_LO_DS = 96
  8401. const m_R_PPC64_TPREL64 = 73
  8402. const m_R_PPC64_UADDR16 = "R_PPC_UADDR16"
  8403. const m_R_PPC64_UADDR32 = "R_PPC_UADDR32"
  8404. const m_R_PPC64_UADDR64 = 43
  8405. const m_R_PPC_ADDR14 = 7
  8406. const m_R_PPC_ADDR14_BRNTAKEN = 9
  8407. const m_R_PPC_ADDR14_BRTAKEN = 8
  8408. const m_R_PPC_ADDR16 = 3
  8409. const m_R_PPC_ADDR16_HA = 6
  8410. const m_R_PPC_ADDR16_HI = 5
  8411. const m_R_PPC_ADDR16_LO = 4
  8412. const m_R_PPC_ADDR24 = 2
  8413. const m_R_PPC_ADDR32 = 1
  8414. const m_R_PPC_COPY = 19
  8415. const m_R_PPC_DIAB_RELSDA_HA = 185
  8416. const m_R_PPC_DIAB_RELSDA_HI = 184
  8417. const m_R_PPC_DIAB_RELSDA_LO = 183
  8418. const m_R_PPC_DIAB_SDA21_HA = 182
  8419. const m_R_PPC_DIAB_SDA21_HI = 181
  8420. const m_R_PPC_DIAB_SDA21_LO = 180
  8421. const m_R_PPC_DTPMOD32 = 68
  8422. const m_R_PPC_DTPREL16 = 74
  8423. const m_R_PPC_DTPREL16_HA = 77
  8424. const m_R_PPC_DTPREL16_HI = 76
  8425. const m_R_PPC_DTPREL16_LO = 75
  8426. const m_R_PPC_DTPREL32 = 78
  8427. const m_R_PPC_EMB_BIT_FLD = 115
  8428. const m_R_PPC_EMB_MRKREF = 110
  8429. const m_R_PPC_EMB_NADDR16 = 102
  8430. const m_R_PPC_EMB_NADDR16_HA = 105
  8431. const m_R_PPC_EMB_NADDR16_HI = 104
  8432. const m_R_PPC_EMB_NADDR16_LO = 103
  8433. const m_R_PPC_EMB_NADDR32 = 101
  8434. const m_R_PPC_EMB_RELSDA = 116
  8435. const m_R_PPC_EMB_RELSEC16 = 111
  8436. const m_R_PPC_EMB_RELST_HA = 114
  8437. const m_R_PPC_EMB_RELST_HI = 113
  8438. const m_R_PPC_EMB_RELST_LO = 112
  8439. const m_R_PPC_EMB_SDA21 = 109
  8440. const m_R_PPC_EMB_SDA2I16 = 107
  8441. const m_R_PPC_EMB_SDA2REL = 108
  8442. const m_R_PPC_EMB_SDAI16 = 106
  8443. const m_R_PPC_GLOB_DAT = 20
  8444. const m_R_PPC_GOT16 = 14
  8445. const m_R_PPC_GOT16_HA = 17
  8446. const m_R_PPC_GOT16_HI = 16
  8447. const m_R_PPC_GOT16_LO = 15
  8448. const m_R_PPC_GOT_DTPREL16 = 91
  8449. const m_R_PPC_GOT_DTPREL16_HA = 94
  8450. const m_R_PPC_GOT_DTPREL16_HI = 93
  8451. const m_R_PPC_GOT_DTPREL16_LO = 92
  8452. const m_R_PPC_GOT_TLSGD16 = 79
  8453. const m_R_PPC_GOT_TLSGD16_HA = 82
  8454. const m_R_PPC_GOT_TLSGD16_HI = 81
  8455. const m_R_PPC_GOT_TLSGD16_LO = 80
  8456. const m_R_PPC_GOT_TLSLD16 = 83
  8457. const m_R_PPC_GOT_TLSLD16_HA = 86
  8458. const m_R_PPC_GOT_TLSLD16_HI = 85
  8459. const m_R_PPC_GOT_TLSLD16_LO = 84
  8460. const m_R_PPC_GOT_TPREL16 = 87
  8461. const m_R_PPC_GOT_TPREL16_HA = 90
  8462. const m_R_PPC_GOT_TPREL16_HI = 89
  8463. const m_R_PPC_GOT_TPREL16_LO = 88
  8464. const m_R_PPC_IRELATIVE = 248
  8465. const m_R_PPC_JMP_SLOT = 21
  8466. const m_R_PPC_LOCAL24PC = 23
  8467. const m_R_PPC_NONE = 0
  8468. const m_R_PPC_PLT16_HA = 31
  8469. const m_R_PPC_PLT16_HI = 30
  8470. const m_R_PPC_PLT16_LO = 29
  8471. const m_R_PPC_PLT32 = 27
  8472. const m_R_PPC_PLTREL24 = 18
  8473. const m_R_PPC_PLTREL32 = 28
  8474. const m_R_PPC_REL14 = 11
  8475. const m_R_PPC_REL14_BRNTAKEN = 13
  8476. const m_R_PPC_REL14_BRTAKEN = 12
  8477. const m_R_PPC_REL16 = 249
  8478. const m_R_PPC_REL16_HA = 252
  8479. const m_R_PPC_REL16_HI = 251
  8480. const m_R_PPC_REL16_LO = 250
  8481. const m_R_PPC_REL24 = 10
  8482. const m_R_PPC_REL32 = 26
  8483. const m_R_PPC_RELATIVE = 22
  8484. const m_R_PPC_SDAREL16 = 32
  8485. const m_R_PPC_SECTOFF = 33
  8486. const m_R_PPC_SECTOFF_HA = 36
  8487. const m_R_PPC_SECTOFF_HI = 35
  8488. const m_R_PPC_SECTOFF_LO = 34
  8489. const m_R_PPC_TLS = 67
  8490. const m_R_PPC_TLSGD = 95
  8491. const m_R_PPC_TLSLD = 96
  8492. const m_R_PPC_TOC16 = 255
  8493. const m_R_PPC_TPREL16 = 69
  8494. const m_R_PPC_TPREL16_HA = 72
  8495. const m_R_PPC_TPREL16_HI = 71
  8496. const m_R_PPC_TPREL16_LO = 70
  8497. const m_R_PPC_TPREL32 = 73
  8498. const m_R_PPC_UADDR16 = 25
  8499. const m_R_PPC_UADDR32 = 24
  8500. const m_R_RISCV_32 = 1
  8501. const m_R_RISCV_32_PCREL = 57
  8502. const m_R_RISCV_64 = 2
  8503. const m_R_RISCV_ADD16 = 34
  8504. const m_R_RISCV_ADD32 = 35
  8505. const m_R_RISCV_ADD64 = 36
  8506. const m_R_RISCV_ADD8 = 33
  8507. const m_R_RISCV_ALIGN = 43
  8508. const m_R_RISCV_BRANCH = 16
  8509. const m_R_RISCV_CALL = 18
  8510. const m_R_RISCV_CALL_PLT = 19
  8511. const m_R_RISCV_COPY = 4
  8512. const m_R_RISCV_GOT32_PCREL = 41
  8513. const m_R_RISCV_GOT_HI20 = 20
  8514. const m_R_RISCV_HI20 = 26
  8515. const m_R_RISCV_IRELATIVE = 58
  8516. const m_R_RISCV_JAL = 17
  8517. const m_R_RISCV_JUMP_SLOT = 5
  8518. const m_R_RISCV_LO12_I = 27
  8519. const m_R_RISCV_LO12_S = 28
  8520. const m_R_RISCV_NONE = 0
  8521. const m_R_RISCV_PCREL_HI20 = 23
  8522. const m_R_RISCV_PCREL_LO12_I = 24
  8523. const m_R_RISCV_PCREL_LO12_S = 25
  8524. const m_R_RISCV_PLT32 = 59
  8525. const m_R_RISCV_RELATIVE = 3
  8526. const m_R_RISCV_RELAX = 51
  8527. const m_R_RISCV_RVC_BRANCH = 44
  8528. const m_R_RISCV_RVC_JUMP = 45
  8529. const m_R_RISCV_RVC_LUI = 46
  8530. const m_R_RISCV_SET16 = 55
  8531. const m_R_RISCV_SET32 = 56
  8532. const m_R_RISCV_SET6 = 53
  8533. const m_R_RISCV_SET8 = 54
  8534. const m_R_RISCV_SET_ULEB128 = 60
  8535. const m_R_RISCV_SUB16 = 38
  8536. const m_R_RISCV_SUB32 = 39
  8537. const m_R_RISCV_SUB6 = 52
  8538. const m_R_RISCV_SUB64 = 40
  8539. const m_R_RISCV_SUB8 = 37
  8540. const m_R_RISCV_SUB_ULEB128 = 61
  8541. const m_R_RISCV_TLSDESC = 12
  8542. const m_R_RISCV_TLSDESC_ADD_LO12 = 64
  8543. const m_R_RISCV_TLSDESC_CALL = 65
  8544. const m_R_RISCV_TLSDESC_HI20 = 62
  8545. const m_R_RISCV_TLSDESC_LOAD_LO12 = 63
  8546. const m_R_RISCV_TLS_DTPMOD32 = 6
  8547. const m_R_RISCV_TLS_DTPMOD64 = 7
  8548. const m_R_RISCV_TLS_DTPREL32 = 8
  8549. const m_R_RISCV_TLS_DTPREL64 = 9
  8550. const m_R_RISCV_TLS_GD_HI20 = 22
  8551. const m_R_RISCV_TLS_GOT_HI20 = 21
  8552. const m_R_RISCV_TLS_TPREL32 = 10
  8553. const m_R_RISCV_TLS_TPREL64 = 11
  8554. const m_R_RISCV_TPREL_ADD = 32
  8555. const m_R_RISCV_TPREL_HI20 = 29
  8556. const m_R_RISCV_TPREL_LO12_I = 30
  8557. const m_R_RISCV_TPREL_LO12_S = 31
  8558. const m_R_SH_ALIGN = 29
  8559. const m_R_SH_CODE = 30
  8560. const m_R_SH_COPY = 162
  8561. const m_R_SH_COUNT = 28
  8562. const m_R_SH_DATA = 31
  8563. const m_R_SH_DIR32 = 1
  8564. const m_R_SH_DIR8BP = 7
  8565. const m_R_SH_DIR8L = 9
  8566. const m_R_SH_DIR8W = 8
  8567. const m_R_SH_DIR8WPL = 5
  8568. const m_R_SH_DIR8WPN = 3
  8569. const m_R_SH_DIR8WPZ = 6
  8570. const m_R_SH_FUNCDESC = 207
  8571. const m_R_SH_FUNCDESC_VALUE = 208
  8572. const m_R_SH_GLOB_DAT = 163
  8573. const m_R_SH_GNU_VTENTRY = 35
  8574. const m_R_SH_GNU_VTINHERIT = 34
  8575. const m_R_SH_GOT20 = 201
  8576. const m_R_SH_GOT32 = 160
  8577. const m_R_SH_GOTFUNCDESC = 203
  8578. const m_R_SH_GOTFUNCDEST20 = 204
  8579. const m_R_SH_GOTOFF = 166
  8580. const m_R_SH_GOTOFF20 = 202
  8581. const m_R_SH_GOTOFFFUNCDESC = 205
  8582. const m_R_SH_GOTOFFFUNCDEST20 = 206
  8583. const m_R_SH_GOTPC = 167
  8584. const m_R_SH_IND12W = 4
  8585. const m_R_SH_JMP_SLOT = 164
  8586. const m_R_SH_LABEL = 32
  8587. const m_R_SH_NONE = 0
  8588. const m_R_SH_NUM = 256
  8589. const m_R_SH_PLT32 = 161
  8590. const m_R_SH_REL32 = 2
  8591. const m_R_SH_RELATIVE = 165
  8592. const m_R_SH_SWITCH16 = 25
  8593. const m_R_SH_SWITCH32 = 26
  8594. const m_R_SH_SWITCH8 = 33
  8595. const m_R_SH_TLS_DTPMOD32 = 149
  8596. const m_R_SH_TLS_DTPOFF32 = 150
  8597. const m_R_SH_TLS_GD_32 = 144
  8598. const m_R_SH_TLS_IE_32 = 147
  8599. const m_R_SH_TLS_LDO_32 = 146
  8600. const m_R_SH_TLS_LD_32 = 145
  8601. const m_R_SH_TLS_LE_32 = 148
  8602. const m_R_SH_TLS_TPOFF32 = 151
  8603. const m_R_SH_USES = 27
  8604. const m_R_SPARC_10 = 30
  8605. const m_R_SPARC_11 = 31
  8606. const m_R_SPARC_13 = 11
  8607. const m_R_SPARC_16 = 2
  8608. const m_R_SPARC_22 = 10
  8609. const m_R_SPARC_32 = 3
  8610. const m_R_SPARC_5 = 44
  8611. const m_R_SPARC_6 = 45
  8612. const m_R_SPARC_64 = 32
  8613. const m_R_SPARC_7 = 43
  8614. const m_R_SPARC_8 = 1
  8615. const m_R_SPARC_COPY = 19
  8616. const m_R_SPARC_DISP16 = 5
  8617. const m_R_SPARC_DISP32 = 6
  8618. const m_R_SPARC_DISP64 = 46
  8619. const m_R_SPARC_DISP8 = 4
  8620. const m_R_SPARC_GLOB_DAT = 20
  8621. const m_R_SPARC_GLOB_JMP = 42
  8622. const m_R_SPARC_GNU_VTENTRY = 251
  8623. const m_R_SPARC_GNU_VTINHERIT = 250
  8624. const m_R_SPARC_GOT10 = 13
  8625. const m_R_SPARC_GOT13 = 14
  8626. const m_R_SPARC_GOT22 = 15
  8627. const m_R_SPARC_GOTDATA_HIX22 = 80
  8628. const m_R_SPARC_GOTDATA_LOX10 = 81
  8629. const m_R_SPARC_GOTDATA_OP = 84
  8630. const m_R_SPARC_GOTDATA_OP_HIX22 = 82
  8631. const m_R_SPARC_GOTDATA_OP_LOX10 = 83
  8632. const m_R_SPARC_H34 = 85
  8633. const m_R_SPARC_H44 = 50
  8634. const m_R_SPARC_HH22 = 34
  8635. const m_R_SPARC_HI22 = 9
  8636. const m_R_SPARC_HIPLT22 = 25
  8637. const m_R_SPARC_HIX22 = 48
  8638. const m_R_SPARC_HM10 = 35
  8639. const m_R_SPARC_JMP_SLOT = 21
  8640. const m_R_SPARC_L44 = 52
  8641. const m_R_SPARC_LM22 = 36
  8642. const m_R_SPARC_LO10 = 12
  8643. const m_R_SPARC_LOPLT10 = 26
  8644. const m_R_SPARC_LOX10 = 49
  8645. const m_R_SPARC_M44 = 51
  8646. const m_R_SPARC_NONE = 0
  8647. const m_R_SPARC_NUM = 253
  8648. const m_R_SPARC_OLO10 = 33
  8649. const m_R_SPARC_PC10 = 16
  8650. const m_R_SPARC_PC22 = 17
  8651. const m_R_SPARC_PCPLT10 = 29
  8652. const m_R_SPARC_PCPLT22 = 28
  8653. const m_R_SPARC_PCPLT32 = 27
  8654. const m_R_SPARC_PC_HH22 = 37
  8655. const m_R_SPARC_PC_HM10 = 38
  8656. const m_R_SPARC_PC_LM22 = 39
  8657. const m_R_SPARC_PLT32 = 24
  8658. const m_R_SPARC_PLT64 = 47
  8659. const m_R_SPARC_REGISTER = 53
  8660. const m_R_SPARC_RELATIVE = 22
  8661. const m_R_SPARC_REV32 = 252
  8662. const m_R_SPARC_SIZE32 = 86
  8663. const m_R_SPARC_SIZE64 = 87
  8664. const m_R_SPARC_TLS_DTPMOD32 = 74
  8665. const m_R_SPARC_TLS_DTPMOD64 = 75
  8666. const m_R_SPARC_TLS_DTPOFF32 = 76
  8667. const m_R_SPARC_TLS_DTPOFF64 = 77
  8668. const m_R_SPARC_TLS_GD_ADD = 58
  8669. const m_R_SPARC_TLS_GD_CALL = 59
  8670. const m_R_SPARC_TLS_GD_HI22 = 56
  8671. const m_R_SPARC_TLS_GD_LO10 = 57
  8672. const m_R_SPARC_TLS_IE_ADD = 71
  8673. const m_R_SPARC_TLS_IE_HI22 = 67
  8674. const m_R_SPARC_TLS_IE_LD = 69
  8675. const m_R_SPARC_TLS_IE_LDX = 70
  8676. const m_R_SPARC_TLS_IE_LO10 = 68
  8677. const m_R_SPARC_TLS_LDM_ADD = 62
  8678. const m_R_SPARC_TLS_LDM_CALL = 63
  8679. const m_R_SPARC_TLS_LDM_HI22 = 60
  8680. const m_R_SPARC_TLS_LDM_LO10 = 61
  8681. const m_R_SPARC_TLS_LDO_ADD = 66
  8682. const m_R_SPARC_TLS_LDO_HIX22 = 64
  8683. const m_R_SPARC_TLS_LDO_LOX10 = 65
  8684. const m_R_SPARC_TLS_LE_HIX22 = 72
  8685. const m_R_SPARC_TLS_LE_LOX10 = 73
  8686. const m_R_SPARC_TLS_TPOFF32 = 78
  8687. const m_R_SPARC_TLS_TPOFF64 = 79
  8688. const m_R_SPARC_UA16 = 55
  8689. const m_R_SPARC_UA32 = 23
  8690. const m_R_SPARC_UA64 = 54
  8691. const m_R_SPARC_WDISP16 = 40
  8692. const m_R_SPARC_WDISP19 = 41
  8693. const m_R_SPARC_WDISP22 = 8
  8694. const m_R_SPARC_WDISP30 = 7
  8695. const m_R_SPARC_WPLT30 = 18
  8696. const m_R_X86_64_16 = 12
  8697. const m_R_X86_64_32 = 10
  8698. const m_R_X86_64_32S = 11
  8699. const m_R_X86_64_64 = 1
  8700. const m_R_X86_64_8 = 14
  8701. const m_R_X86_64_COPY = 5
  8702. const m_R_X86_64_DTPMOD64 = 16
  8703. const m_R_X86_64_DTPOFF32 = 21
  8704. const m_R_X86_64_DTPOFF64 = 17
  8705. const m_R_X86_64_GLOB_DAT = 6
  8706. const m_R_X86_64_GOT32 = 3
  8707. const m_R_X86_64_GOT64 = 27
  8708. const m_R_X86_64_GOTOFF64 = 25
  8709. const m_R_X86_64_GOTPC32 = 26
  8710. const m_R_X86_64_GOTPC32_TLSDESC = 34
  8711. const m_R_X86_64_GOTPC64 = 29
  8712. const m_R_X86_64_GOTPCREL = 9
  8713. const m_R_X86_64_GOTPCREL64 = 28
  8714. const m_R_X86_64_GOTPCRELX = 41
  8715. const m_R_X86_64_GOTPLT64 = 30
  8716. const m_R_X86_64_GOTTPOFF = 22
  8717. const m_R_X86_64_IRELATIVE = 37
  8718. const m_R_X86_64_JUMP_SLOT = 7
  8719. const m_R_X86_64_NONE = 0
  8720. const m_R_X86_64_NUM = 43
  8721. const m_R_X86_64_PC16 = 13
  8722. const m_R_X86_64_PC32 = 2
  8723. const m_R_X86_64_PC64 = 24
  8724. const m_R_X86_64_PC8 = 15
  8725. const m_R_X86_64_PLT32 = 4
  8726. const m_R_X86_64_PLTOFF64 = 31
  8727. const m_R_X86_64_RELATIVE = 8
  8728. const m_R_X86_64_RELATIVE64 = 38
  8729. const m_R_X86_64_REX_GOTPCRELX = 42
  8730. const m_R_X86_64_SIZE32 = 32
  8731. const m_R_X86_64_SIZE64 = 33
  8732. const m_R_X86_64_TLSDESC = 36
  8733. const m_R_X86_64_TLSDESC_CALL = 35
  8734. const m_R_X86_64_TLSGD = 19
  8735. const m_R_X86_64_TLSLD = 20
  8736. const m_R_X86_64_TPOFF32 = 23
  8737. const m_R_X86_64_TPOFF64 = 18
  8738. const m_SELFMAG = 4
  8739. const m_SHF_ALPHA_GPREL = 0x10000000
  8740. const m_SHF_ARM_COMDEF = 0x80000000
  8741. const m_SHF_ARM_ENTRYSECT = 0x10000000
  8742. const m_SHF_IA_64_NORECOV = 0x20000000
  8743. const m_SHF_IA_64_SHORT = 0x10000000
  8744. const m_SHF_MASKOS = 0x0ff00000
  8745. const m_SHF_MASKPROC = 0xf0000000
  8746. const m_SHF_MIPS_ADDR = 0x40000000
  8747. const m_SHF_MIPS_GPREL = 0x10000000
  8748. const m_SHF_MIPS_LOCAL = 0x04000000
  8749. const m_SHF_MIPS_MERGE = 0x20000000
  8750. const m_SHF_MIPS_NAMES = 0x02000000
  8751. const m_SHF_MIPS_NODUPE = 0x01000000
  8752. const m_SHF_MIPS_NOSTRIP = 0x08000000
  8753. const m_SHF_MIPS_STRINGS = 0x80000000
  8754. const m_SHF_PARISC_HUGE = 0x40000000
  8755. const m_SHF_PARISC_SBP = 0x80000000
  8756. const m_SHF_PARISC_SHORT = 0x20000000
  8757. const m_SHN_ABS = 65521
  8758. const m_SHN_AFTER = 0xff01
  8759. const m_SHN_BEFORE = 0xff00
  8760. const m_SHN_COMMON = 65522
  8761. const m_SHN_HIOS = 0xff3f
  8762. const m_SHN_HIPROC = 0xff1f
  8763. const m_SHN_HIRESERVE = 0xffff
  8764. const m_SHN_LOOS = 0xff20
  8765. const m_SHN_LOPROC = 0xff00
  8766. const m_SHN_LORESERVE = 0xff00
  8767. const m_SHN_MIPS_ACOMMON = 0xff00
  8768. const m_SHN_MIPS_DATA = 0xff02
  8769. const m_SHN_MIPS_SCOMMON = 0xff03
  8770. const m_SHN_MIPS_SUNDEFINED = 0xff04
  8771. const m_SHN_MIPS_TEXT = 0xff01
  8772. const m_SHN_PARISC_ANSI_COMMON = 0xff00
  8773. const m_SHN_PARISC_HUGE_COMMON = 0xff01
  8774. const m_SHN_UNDEF = 0
  8775. const m_SHN_XINDEX = 0xffff
  8776. const m_SHT_ALPHA_DEBUG = 0x70000001
  8777. const m_SHT_ALPHA_REGINFO = 0x70000002
  8778. const m_SHT_CHECKSUM = 0x6ffffff8
  8779. const m_SHT_DYNAMIC = 6
  8780. const m_SHT_DYNSYM = 11
  8781. const m_SHT_FINI_ARRAY = 15
  8782. const m_SHT_GNU_ATTRIBUTES = 0x6ffffff5
  8783. const m_SHT_GNU_HASH = 0x6ffffff6
  8784. const m_SHT_GNU_LIBLIST = 0x6ffffff7
  8785. const m_SHT_GNU_verdef = 0x6ffffffd
  8786. const m_SHT_GNU_verneed = 0x6ffffffe
  8787. const m_SHT_GNU_versym = 0x6fffffff
  8788. const m_SHT_GROUP = 17
  8789. const m_SHT_HASH = 5
  8790. const m_SHT_HIOS = 0x6fffffff
  8791. const m_SHT_HIPROC = 0x7fffffff
  8792. const m_SHT_HISUNW = 0x6fffffff
  8793. const m_SHT_HIUSER = 0x8fffffff
  8794. const m_SHT_INIT_ARRAY = 14
  8795. const m_SHT_LOOS = 0x60000000
  8796. const m_SHT_LOPROC = 0x70000000
  8797. const m_SHT_LOSUNW = 0x6ffffffa
  8798. const m_SHT_LOUSER = 0x80000000
  8799. const m_SHT_MIPS_AUXSYM = 0x70000016
  8800. const m_SHT_MIPS_CONFLICT = 0x70000002
  8801. const m_SHT_MIPS_CONTENT = 0x7000000c
  8802. const m_SHT_MIPS_DEBUG = 0x70000005
  8803. const m_SHT_MIPS_DELTACLASS = 0x7000001d
  8804. const m_SHT_MIPS_DELTADECL = 0x7000001f
  8805. const m_SHT_MIPS_DELTAINST = 0x7000001c
  8806. const m_SHT_MIPS_DELTASYM = 0x7000001b
  8807. const m_SHT_MIPS_DENSE = 0x70000013
  8808. const m_SHT_MIPS_DWARF = 0x7000001e
  8809. const m_SHT_MIPS_EH_REGION = 0x70000027
  8810. const m_SHT_MIPS_EVENTS = 0x70000021
  8811. const m_SHT_MIPS_EXTSYM = 0x70000012
  8812. const m_SHT_MIPS_FDESC = 0x70000011
  8813. const m_SHT_MIPS_GPTAB = 0x70000003
  8814. const m_SHT_MIPS_IFACE = 0x7000000b
  8815. const m_SHT_MIPS_LIBLIST = 0x70000000
  8816. const m_SHT_MIPS_LINE = 0x70000019
  8817. const m_SHT_MIPS_LOCSTR = 0x70000018
  8818. const m_SHT_MIPS_LOCSYM = 0x70000015
  8819. const m_SHT_MIPS_MSYM = 0x70000001
  8820. const m_SHT_MIPS_OPTIONS = 0x7000000d
  8821. const m_SHT_MIPS_OPTSYM = 0x70000017
  8822. const m_SHT_MIPS_PACKAGE = 0x70000007
  8823. const m_SHT_MIPS_PACKSYM = 0x70000008
  8824. const m_SHT_MIPS_PDESC = 0x70000014
  8825. const m_SHT_MIPS_PDR_EXCEPTION = 0x70000029
  8826. const m_SHT_MIPS_PIXIE = 0x70000023
  8827. const m_SHT_MIPS_REGINFO = 0x70000006
  8828. const m_SHT_MIPS_RELD = 0x70000009
  8829. const m_SHT_MIPS_RFDESC = 0x7000001a
  8830. const m_SHT_MIPS_SHDR = 0x70000010
  8831. const m_SHT_MIPS_SYMBOL_LIB = 0x70000020
  8832. const m_SHT_MIPS_TRANSLATE = 0x70000022
  8833. const m_SHT_MIPS_UCODE = 0x70000004
  8834. const m_SHT_MIPS_WHIRL = 0x70000026
  8835. const m_SHT_MIPS_XLATE = 0x70000024
  8836. const m_SHT_MIPS_XLATE_DEBUG = 0x70000025
  8837. const m_SHT_MIPS_XLATE_OLD = 0x70000028
  8838. const m_SHT_NOBITS = 8
  8839. const m_SHT_NOTE = 7
  8840. const m_SHT_NULL = 0
  8841. const m_SHT_NUM = 20
  8842. const m_SHT_PARISC_DOC = 0x70000002
  8843. const m_SHT_PARISC_EXT = 0x70000000
  8844. const m_SHT_PARISC_UNWIND = 0x70000001
  8845. const m_SHT_PREINIT_ARRAY = 16
  8846. const m_SHT_PROGBITS = 1
  8847. const m_SHT_REL = 9
  8848. const m_SHT_RELA = 4
  8849. const m_SHT_RELR = 19
  8850. const m_SHT_SHLIB = 10
  8851. const m_SHT_STRTAB = 3
  8852. const m_SHT_SUNW_COMDAT = 0x6ffffffb
  8853. const m_SHT_SUNW_move = 0x6ffffffa
  8854. const m_SHT_SUNW_syminfo = 0x6ffffffc
  8855. const m_SHT_SYMTAB = 2
  8856. const m_SHT_SYMTAB_SHNDX = 18
  8857. const m_SIZE_T_MAX = 4294967295
  8858. const m_STB_GLOBAL = 1
  8859. const m_STB_GNU_UNIQUE = 10
  8860. const m_STB_HIOS = 12
  8861. const m_STB_HIPROC = 15
  8862. const m_STB_LOCAL = 0
  8863. const m_STB_LOOS = 10
  8864. const m_STB_LOPROC = 13
  8865. const m_STB_MIPS_SPLIT_COMMON = 13
  8866. const m_STB_NUM = 3
  8867. const m_STB_WEAK = 2
  8868. const m_STN_UNDEF = 0
  8869. const m_STO_ALPHA_NOPV = 0x80
  8870. const m_STO_ALPHA_STD_GPLOAD = 0x88
  8871. const m_STO_MIPS_DEFAULT = 0x0
  8872. const m_STO_MIPS_HIDDEN = 0x2
  8873. const m_STO_MIPS_INTERNAL = 0x1
  8874. const m_STO_MIPS_PLT = 0x8
  8875. const m_STO_MIPS_PROTECTED = 0x3
  8876. const m_STO_MIPS_SC_ALIGN_UNUSED = 0xff
  8877. const m_STO_PPC64_LOCAL_BIT = 5
  8878. const m_STO_PPC64_LOCAL_MASK = 0xe0
  8879. const m_STT_ARM_16BIT = "STT_HIPROC"
  8880. const m_STT_ARM_TFUNC = "STT_LOPROC"
  8881. const m_STT_COMMON = 5
  8882. const m_STT_FILE = 4
  8883. const m_STT_FUNC = 2
  8884. const m_STT_GNU_IFUNC = 10
  8885. const m_STT_HIOS = 12
  8886. const m_STT_HIPROC = 15
  8887. const m_STT_LOOS = 10
  8888. const m_STT_LOPROC = 13
  8889. const m_STT_NOTYPE = 0
  8890. const m_STT_NUM = 7
  8891. const m_STT_OBJECT = 1
  8892. const m_STT_PARISC_MILLICODE = 13
  8893. const m_STT_SECTION = 3
  8894. const m_STT_SPARC_REGISTER = 13
  8895. const m_STT_TLS = 6
  8896. const m_STV_DEFAULT = 0
  8897. const m_STV_HIDDEN = 2
  8898. const m_STV_INTERNAL = 1
  8899. const m_STV_PROTECTED = 3
  8900. const m_SYMINFO_BT_LOWRESERVE = 0xff00
  8901. const m_SYMINFO_BT_PARENT = 0xfffe
  8902. const m_SYMINFO_BT_SELF = 0xffff
  8903. const m_SYMINFO_CURRENT = 1
  8904. const m_SYMINFO_FLG_COPY = 0x0004
  8905. const m_SYMINFO_FLG_DIRECT = 0x0001
  8906. const m_SYMINFO_FLG_LAZYLOAD = 0x0008
  8907. const m_SYMINFO_FLG_PASSTHRU = 0x0002
  8908. const m_SYMINFO_NONE = 0
  8909. const m_SYMINFO_NUM = 2
  8910. const m_VER_DEF_CURRENT = 1
  8911. const m_VER_DEF_NONE = 0
  8912. const m_VER_DEF_NUM = 2
  8913. const m_VER_FLG_BASE = 0x1
  8914. const m_VER_FLG_WEAK = 0x2
  8915. const m_VER_NDX_ELIMINATE = 0xff01
  8916. const m_VER_NDX_GLOBAL = 1
  8917. const m_VER_NDX_LOCAL = 0
  8918. const m_VER_NDX_LORESERVE = 0xff00
  8919. const m_VER_NEED_CURRENT = 1
  8920. const m_VER_NEED_NONE = 0
  8921. const m_VER_NEED_NUM = 2
  8922. const m_n_hash = "n_desc"
  8923. type Tnlist = struct {
  8924. F__ccgo0_0 struct {
  8925. Fn_un [0]struct {
  8926. Fn_next [0]uintptr
  8927. Fn_strx [0]int64
  8928. Fn_name uintptr
  8929. }
  8930. Fn_name uintptr
  8931. }
  8932. Fn_type uint8
  8933. Fn_other uint8
  8934. Fn_desc int16
  8935. Fn_value uint64
  8936. }
  8937. type TElf32_Half = uint16
  8938. type TElf64_Half = uint16
  8939. type TElf32_Word = uint32
  8940. type TElf32_Sword = int32
  8941. type TElf64_Word = uint32
  8942. type TElf64_Sword = int32
  8943. type TElf32_Xword = uint64
  8944. type TElf32_Sxword = int64
  8945. type TElf64_Xword = uint64
  8946. type TElf64_Sxword = int64
  8947. type TElf32_Addr = uint32
  8948. type TElf64_Addr = uint64
  8949. type TElf32_Off = uint32
  8950. type TElf64_Off = uint64
  8951. type TElf32_Section = uint16
  8952. type TElf64_Section = uint16
  8953. type TElf32_Versym = uint16
  8954. type TElf64_Versym = uint16
  8955. type TElf32_Ehdr = struct {
  8956. Fe_ident [16]uint8
  8957. Fe_type TElf32_Half
  8958. Fe_machine TElf32_Half
  8959. Fe_version TElf32_Word
  8960. Fe_entry TElf32_Addr
  8961. Fe_phoff TElf32_Off
  8962. Fe_shoff TElf32_Off
  8963. Fe_flags TElf32_Word
  8964. Fe_ehsize TElf32_Half
  8965. Fe_phentsize TElf32_Half
  8966. Fe_phnum TElf32_Half
  8967. Fe_shentsize TElf32_Half
  8968. Fe_shnum TElf32_Half
  8969. Fe_shstrndx TElf32_Half
  8970. }
  8971. type TElf64_Ehdr = struct {
  8972. Fe_ident [16]uint8
  8973. Fe_type TElf64_Half
  8974. Fe_machine TElf64_Half
  8975. Fe_version TElf64_Word
  8976. Fe_entry TElf64_Addr
  8977. Fe_phoff TElf64_Off
  8978. Fe_shoff TElf64_Off
  8979. Fe_flags TElf64_Word
  8980. Fe_ehsize TElf64_Half
  8981. Fe_phentsize TElf64_Half
  8982. Fe_phnum TElf64_Half
  8983. Fe_shentsize TElf64_Half
  8984. Fe_shnum TElf64_Half
  8985. Fe_shstrndx TElf64_Half
  8986. }
  8987. type TElf32_Shdr = struct {
  8988. Fsh_name TElf32_Word
  8989. Fsh_type TElf32_Word
  8990. Fsh_flags TElf32_Word
  8991. Fsh_addr TElf32_Addr
  8992. Fsh_offset TElf32_Off
  8993. Fsh_size TElf32_Word
  8994. Fsh_link TElf32_Word
  8995. Fsh_info TElf32_Word
  8996. Fsh_addralign TElf32_Word
  8997. Fsh_entsize TElf32_Word
  8998. }
  8999. type TElf64_Shdr = struct {
  9000. Fsh_name TElf64_Word
  9001. Fsh_type TElf64_Word
  9002. Fsh_flags TElf64_Xword
  9003. Fsh_addr TElf64_Addr
  9004. Fsh_offset TElf64_Off
  9005. Fsh_size TElf64_Xword
  9006. Fsh_link TElf64_Word
  9007. Fsh_info TElf64_Word
  9008. Fsh_addralign TElf64_Xword
  9009. Fsh_entsize TElf64_Xword
  9010. }
  9011. type TElf32_Chdr = struct {
  9012. Fch_type TElf32_Word
  9013. Fch_size TElf32_Word
  9014. Fch_addralign TElf32_Word
  9015. }
  9016. type TElf64_Chdr = struct {
  9017. Fch_type TElf64_Word
  9018. Fch_reserved TElf64_Word
  9019. Fch_size TElf64_Xword
  9020. Fch_addralign TElf64_Xword
  9021. }
  9022. type TElf32_Sym = struct {
  9023. Fst_name TElf32_Word
  9024. Fst_value TElf32_Addr
  9025. Fst_size TElf32_Word
  9026. Fst_info uint8
  9027. Fst_other uint8
  9028. Fst_shndx TElf32_Section
  9029. }
  9030. type TElf64_Sym = struct {
  9031. Fst_name TElf64_Word
  9032. Fst_info uint8
  9033. Fst_other uint8
  9034. Fst_shndx TElf64_Section
  9035. Fst_value TElf64_Addr
  9036. Fst_size TElf64_Xword
  9037. }
  9038. type TElf32_Syminfo = struct {
  9039. Fsi_boundto TElf32_Half
  9040. Fsi_flags TElf32_Half
  9041. }
  9042. type TElf64_Syminfo = struct {
  9043. Fsi_boundto TElf64_Half
  9044. Fsi_flags TElf64_Half
  9045. }
  9046. type TElf32_Rel = struct {
  9047. Fr_offset TElf32_Addr
  9048. Fr_info TElf32_Word
  9049. }
  9050. type TElf64_Rel = struct {
  9051. Fr_offset TElf64_Addr
  9052. Fr_info TElf64_Xword
  9053. }
  9054. type TElf32_Rela = struct {
  9055. Fr_offset TElf32_Addr
  9056. Fr_info TElf32_Word
  9057. Fr_addend TElf32_Sword
  9058. }
  9059. type TElf64_Rela = struct {
  9060. Fr_offset TElf64_Addr
  9061. Fr_info TElf64_Xword
  9062. Fr_addend TElf64_Sxword
  9063. }
  9064. type TElf32_Relr = uint32
  9065. type TElf64_Relr = uint64
  9066. type TElf32_Phdr = struct {
  9067. Fp_type TElf32_Word
  9068. Fp_offset TElf32_Off
  9069. Fp_vaddr TElf32_Addr
  9070. Fp_paddr TElf32_Addr
  9071. Fp_filesz TElf32_Word
  9072. Fp_memsz TElf32_Word
  9073. Fp_flags TElf32_Word
  9074. Fp_align TElf32_Word
  9075. }
  9076. type TElf64_Phdr = struct {
  9077. Fp_type TElf64_Word
  9078. Fp_flags TElf64_Word
  9079. Fp_offset TElf64_Off
  9080. Fp_vaddr TElf64_Addr
  9081. Fp_paddr TElf64_Addr
  9082. Fp_filesz TElf64_Xword
  9083. Fp_memsz TElf64_Xword
  9084. Fp_align TElf64_Xword
  9085. }
  9086. type TElf32_Dyn = struct {
  9087. Fd_tag TElf32_Sword
  9088. Fd_un struct {
  9089. Fd_ptr [0]TElf32_Addr
  9090. Fd_val TElf32_Word
  9091. }
  9092. }
  9093. type TElf64_Dyn = struct {
  9094. Fd_tag TElf64_Sxword
  9095. Fd_un struct {
  9096. Fd_ptr [0]TElf64_Addr
  9097. Fd_val TElf64_Xword
  9098. }
  9099. }
  9100. type TElf32_Verdef = struct {
  9101. Fvd_version TElf32_Half
  9102. Fvd_flags TElf32_Half
  9103. Fvd_ndx TElf32_Half
  9104. Fvd_cnt TElf32_Half
  9105. Fvd_hash TElf32_Word
  9106. Fvd_aux TElf32_Word
  9107. Fvd_next TElf32_Word
  9108. }
  9109. type TElf64_Verdef = struct {
  9110. Fvd_version TElf64_Half
  9111. Fvd_flags TElf64_Half
  9112. Fvd_ndx TElf64_Half
  9113. Fvd_cnt TElf64_Half
  9114. Fvd_hash TElf64_Word
  9115. Fvd_aux TElf64_Word
  9116. Fvd_next TElf64_Word
  9117. }
  9118. type TElf32_Verdaux = struct {
  9119. Fvda_name TElf32_Word
  9120. Fvda_next TElf32_Word
  9121. }
  9122. type TElf64_Verdaux = struct {
  9123. Fvda_name TElf64_Word
  9124. Fvda_next TElf64_Word
  9125. }
  9126. type TElf32_Verneed = struct {
  9127. Fvn_version TElf32_Half
  9128. Fvn_cnt TElf32_Half
  9129. Fvn_file TElf32_Word
  9130. Fvn_aux TElf32_Word
  9131. Fvn_next TElf32_Word
  9132. }
  9133. type TElf64_Verneed = struct {
  9134. Fvn_version TElf64_Half
  9135. Fvn_cnt TElf64_Half
  9136. Fvn_file TElf64_Word
  9137. Fvn_aux TElf64_Word
  9138. Fvn_next TElf64_Word
  9139. }
  9140. type TElf32_Vernaux = struct {
  9141. Fvna_hash TElf32_Word
  9142. Fvna_flags TElf32_Half
  9143. Fvna_other TElf32_Half
  9144. Fvna_name TElf32_Word
  9145. Fvna_next TElf32_Word
  9146. }
  9147. type TElf64_Vernaux = struct {
  9148. Fvna_hash TElf64_Word
  9149. Fvna_flags TElf64_Half
  9150. Fvna_other TElf64_Half
  9151. Fvna_name TElf64_Word
  9152. Fvna_next TElf64_Word
  9153. }
  9154. type TElf32_auxv_t = struct {
  9155. Fa_type Tuint32_t
  9156. Fa_un struct {
  9157. Fa_val Tuint32_t
  9158. }
  9159. }
  9160. type TElf64_auxv_t = struct {
  9161. Fa_type Tuint64_t
  9162. Fa_un struct {
  9163. Fa_val Tuint64_t
  9164. }
  9165. }
  9166. type TElf32_Nhdr = struct {
  9167. Fn_namesz TElf32_Word
  9168. Fn_descsz TElf32_Word
  9169. Fn_type TElf32_Word
  9170. }
  9171. type TElf64_Nhdr = struct {
  9172. Fn_namesz TElf64_Word
  9173. Fn_descsz TElf64_Word
  9174. Fn_type TElf64_Word
  9175. }
  9176. type TElf32_Move = struct {
  9177. Fm_value TElf32_Xword
  9178. Fm_info TElf32_Word
  9179. Fm_poffset TElf32_Word
  9180. Fm_repeat TElf32_Half
  9181. Fm_stride TElf32_Half
  9182. }
  9183. type TElf64_Move = struct {
  9184. Fm_value TElf64_Xword
  9185. Fm_info TElf64_Xword
  9186. Fm_poffset TElf64_Xword
  9187. Fm_repeat TElf64_Half
  9188. Fm_stride TElf64_Half
  9189. }
  9190. type TElf32_gptab = struct {
  9191. Fgt_entry [0]struct {
  9192. Fgt_g_value TElf32_Word
  9193. Fgt_bytes TElf32_Word
  9194. }
  9195. Fgt_header struct {
  9196. Fgt_current_g_value TElf32_Word
  9197. Fgt_unused TElf32_Word
  9198. }
  9199. }
  9200. type TElf32_RegInfo = struct {
  9201. Fri_gprmask TElf32_Word
  9202. Fri_cprmask [4]TElf32_Word
  9203. Fri_gp_value TElf32_Sword
  9204. }
  9205. type TElf_Options = struct {
  9206. Fkind uint8
  9207. Fsize uint8
  9208. Fsection TElf32_Section
  9209. Finfo TElf32_Word
  9210. }
  9211. type TElf_Options_Hw = struct {
  9212. Fhwp_flags1 TElf32_Word
  9213. Fhwp_flags2 TElf32_Word
  9214. }
  9215. type TElf32_Lib = struct {
  9216. Fl_name TElf32_Word
  9217. Fl_time_stamp TElf32_Word
  9218. Fl_checksum TElf32_Word
  9219. Fl_version TElf32_Word
  9220. Fl_flags TElf32_Word
  9221. }
  9222. type TElf64_Lib = struct {
  9223. Fl_name TElf64_Word
  9224. Fl_time_stamp TElf64_Word
  9225. Fl_checksum TElf64_Word
  9226. Fl_version TElf64_Word
  9227. Fl_flags TElf64_Word
  9228. }
  9229. type TElf32_Conflict = uint32
  9230. type TElf_MIPS_ABIFlags_v0 = struct {
  9231. Fversion TElf32_Half
  9232. Fisa_level uint8
  9233. Fisa_rev uint8
  9234. Fgpr_size uint8
  9235. Fcpr1_size uint8
  9236. Fcpr2_size uint8
  9237. Ffp_abi uint8
  9238. Fisa_ext TElf32_Word
  9239. Fases TElf32_Word
  9240. Fflags1 TElf32_Word
  9241. Fflags2 TElf32_Word
  9242. }
  9243. const _Val_GNU_MIPS_ABI_FP_ANY = 0
  9244. const _Val_GNU_MIPS_ABI_FP_DOUBLE = 1
  9245. const _Val_GNU_MIPS_ABI_FP_SINGLE = 2
  9246. const _Val_GNU_MIPS_ABI_FP_SOFT = 3
  9247. const _Val_GNU_MIPS_ABI_FP_OLD_64 = 4
  9248. const _Val_GNU_MIPS_ABI_FP_XX = 5
  9249. const _Val_GNU_MIPS_ABI_FP_64 = 6
  9250. const _Val_GNU_MIPS_ABI_FP_64A = 7
  9251. const _Val_GNU_MIPS_ABI_FP_MAX = 7
  9252. // C documentation
  9253. //
  9254. // /*
  9255. // * __elf_is_okay__ - Determine if ehdr really
  9256. // * is ELF and valid for the target platform.
  9257. // *
  9258. // * WARNING: This is NOT an ELF ABI function and
  9259. // * as such its use should be restricted.
  9260. // */
  9261. func ___elf_is_okay__(tls *libc.TLS, ehdr uintptr) (r int32) {
  9262. var retval int32
  9263. _ = retval
  9264. retval = 0
  9265. /*
  9266. * We need to check magic, class size, endianess,
  9267. * and version before we look at the rest of the
  9268. * Elf_Ehdr structure. These few elements are
  9269. * represented in a machine independent fashion.
  9270. */
  9271. 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_ELFDATA2MSB) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ehdr + 6))) == int32(m_EV_CURRENT) {
  9272. /* Now check the machine dependent header */
  9273. if libc.Int32FromUint16((*TElf64_Ehdr)(unsafe.Pointer(ehdr)).Fe_machine) == int32(m_EM_S390) && (*TElf64_Ehdr)(unsafe.Pointer(ehdr)).Fe_version == uint32(m_EV_CURRENT) {
  9274. retval = int32(1)
  9275. }
  9276. }
  9277. return retval
  9278. }
  9279. // C documentation
  9280. //
  9281. // /*
  9282. // * Convert an Elf_Sym into an nlist structure. This fills in only the
  9283. // * n_value and n_type members.
  9284. // */
  9285. func _elf_sym_to_nlist(tls *libc.TLS, nl uintptr, s uintptr, shdr uintptr, shnum int32) {
  9286. var sh, p5 uintptr
  9287. var v1, v2, v3, v4 int32
  9288. _, _, _, _, _, _ = sh, v1, v2, v3, v4, p5
  9289. (*Tnlist)(unsafe.Pointer(nl)).Fn_value = (*TElf64_Sym)(unsafe.Pointer(s)).Fst_value
  9290. switch libc.Int32FromUint16((*TElf64_Sym)(unsafe.Pointer(s)).Fst_shndx) {
  9291. case m_SHN_UNDEF:
  9292. fallthrough
  9293. case int32(m_SHN_COMMON):
  9294. (*Tnlist)(unsafe.Pointer(nl)).Fn_type = uint8(m_N_UNDF)
  9295. case int32(m_SHN_ABS):
  9296. if libc.Int32FromUint8((*TElf64_Sym)(unsafe.Pointer(s)).Fst_info)&int32(0xf) == int32(m_STT_FILE) {
  9297. v1 = int32(m_N_FN)
  9298. } else {
  9299. v1 = int32(m_N_ABS)
  9300. }
  9301. (*Tnlist)(unsafe.Pointer(nl)).Fn_type = libc.Uint8FromInt32(v1)
  9302. default:
  9303. if libc.Int32FromUint16((*TElf64_Sym)(unsafe.Pointer(s)).Fst_shndx) >= shnum {
  9304. (*Tnlist)(unsafe.Pointer(nl)).Fn_type = uint8(m_N_UNDF)
  9305. } else {
  9306. sh = shdr + uintptr((*TElf64_Sym)(unsafe.Pointer(s)).Fst_shndx)*64
  9307. if (*TElf64_Shdr)(unsafe.Pointer(sh)).Fsh_type == uint32(m_SHT_PROGBITS) {
  9308. if (*TElf64_Shdr)(unsafe.Pointer(sh)).Fsh_flags&libc.Uint64FromInt32(libc.Int32FromInt32(1)<<libc.Int32FromInt32(0)) != 0 {
  9309. v3 = int32(m_N_DATA)
  9310. } else {
  9311. v3 = int32(m_N_TEXT)
  9312. }
  9313. v2 = v3
  9314. } else {
  9315. if (*TElf64_Shdr)(unsafe.Pointer(sh)).Fsh_type == uint32(m_SHT_NOBITS) {
  9316. v4 = int32(m_N_BSS)
  9317. } else {
  9318. v4 = m_N_UNDF
  9319. }
  9320. v2 = v4
  9321. }
  9322. (*Tnlist)(unsafe.Pointer(nl)).Fn_type = libc.Uint8FromInt32(v2)
  9323. }
  9324. break
  9325. }
  9326. 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) {
  9327. p5 = nl + 8
  9328. *(*uint8)(unsafe.Pointer(p5)) = uint8(int32(*(*uint8)(unsafe.Pointer(p5))) | libc.Int32FromInt32(m_N_EXT))
  9329. }
  9330. }
  9331. func X__fdnlist(tls *libc.TLS, fd int32, list uintptr) (r int32) {
  9332. bp := tls.Alloc(24784)
  9333. defer tls.Free(24784)
  9334. var cc, i TElf64_Sword
  9335. var errsave, nent, v6 int32
  9336. var name, p, p1, s, shdr, strtab uintptr
  9337. var shdr_size, size, symsize, symstrsize TElf64_Word
  9338. var symoff, symstroff TElf64_Off
  9339. var v3 uint64
  9340. var _ /* ehdr at bp+24576 */ TElf64_Ehdr
  9341. var _ /* sbuf at bp+0 */ [1024]TElf64_Sym
  9342. var _ /* st at bp+24640 */ Tstat
  9343. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = cc, errsave, i, name, nent, p, p1, s, shdr, shdr_size, size, strtab, symoff, symsize, symstroff, symstrsize, v3, v6
  9344. symoff = uint64(0)
  9345. symstroff = uint64(0)
  9346. symsize = uint32(0)
  9347. symstrsize = uint32(0)
  9348. nent = -int32(1)
  9349. strtab = libc.UintptrFromInt32(0)
  9350. shdr = libc.UintptrFromInt32(0)
  9351. /* Make sure obj is OK */
  9352. 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 {
  9353. return -int32(1)
  9354. }
  9355. if libc.Int32FromUint16((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shnum) == 0 || uint64((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shentsize) != uint64(64) {
  9356. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ERANGE)
  9357. return -int32(1)
  9358. }
  9359. /* calculate section header table size */
  9360. shdr_size = libc.Uint32FromInt32(libc.Int32FromUint16((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shentsize) * libc.Int32FromUint16((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shnum))
  9361. /* Make sure it's not too big to mmap */
  9362. if shdr_size > uint32(0xffffffff) || libc.Int64FromUint32(shdr_size) > (*(*Tstat)(unsafe.Pointer(bp + 24640))).Fst_size {
  9363. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EFBIG)
  9364. return -int32(1)
  9365. }
  9366. shdr = libc.Xmalloc(tls, uint64(shdr_size))
  9367. if shdr == libc.UintptrFromInt32(0) {
  9368. return -int32(1)
  9369. }
  9370. /* Load section header table. */
  9371. if libc.Xpread(tls, fd, shdr, uint64(shdr_size), libc.Int64FromUint64((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shoff)) != libc.Int64FromUint32(shdr_size) {
  9372. goto done
  9373. }
  9374. /*
  9375. * Find the symbol table entry and it's corresponding
  9376. * string table entry. Version 1.1 of the ABI states
  9377. * that there is only one symbol table but that this
  9378. * could change in the future.
  9379. */
  9380. i = 0
  9381. for {
  9382. if !(i < libc.Int32FromUint16((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shnum)) {
  9383. break
  9384. }
  9385. if (*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_type == uint32(m_SHT_SYMTAB) {
  9386. if (*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_link >= uint32((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shnum) {
  9387. goto done
  9388. }
  9389. symoff = (*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_offset
  9390. symsize = uint32((*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_size)
  9391. symstroff = (*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr((*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_link)*64))).Fsh_offset
  9392. symstrsize = uint32((*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr((*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_link)*64))).Fsh_size)
  9393. break
  9394. }
  9395. goto _1
  9396. _1:
  9397. ;
  9398. i++
  9399. }
  9400. /* Check for files too large to mmap. */
  9401. if symstrsize > uint32(0xffffffff) || libc.Int64FromUint32(symstrsize) > (*(*Tstat)(unsafe.Pointer(bp + 24640))).Fst_size {
  9402. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EFBIG)
  9403. goto done
  9404. }
  9405. /*
  9406. * Load string table into our address space. This gives us
  9407. * an easy way to randomly access all the strings, without
  9408. * making the memory allocation permanent as with malloc/free
  9409. * (i.e., munmap will return it to the system).
  9410. */
  9411. strtab = libc.Xmalloc(tls, uint64(symstrsize))
  9412. if strtab == libc.UintptrFromInt32(0) {
  9413. goto done
  9414. }
  9415. if libc.Xpread(tls, fd, strtab, uint64(symstrsize), libc.Int64FromUint64(symstroff)) != libc.Int64FromUint32(symstrsize) {
  9416. goto done
  9417. }
  9418. /*
  9419. * clean out any left-over information for all valid entries.
  9420. * Type and value defined to be 0 if not found; historical
  9421. * versions cleared other and desc as well. Also figure out
  9422. * the largest string length so don't read any more of the
  9423. * string table than we have to.
  9424. *
  9425. * XXX clearing anything other than n_type and n_value violates
  9426. * the semantics given in the man page.
  9427. */
  9428. nent = 0
  9429. p = list
  9430. for {
  9431. if !!(*(*uintptr)(unsafe.Pointer(p)) == uintptr(0) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p))))) == 0) {
  9432. break
  9433. }
  9434. (*Tnlist)(unsafe.Pointer(p)).Fn_type = uint8(0)
  9435. (*Tnlist)(unsafe.Pointer(p)).Fn_other = uint8(0)
  9436. (*Tnlist)(unsafe.Pointer(p)).Fn_desc = 0
  9437. (*Tnlist)(unsafe.Pointer(p)).Fn_value = uint64(0)
  9438. nent++
  9439. goto _2
  9440. _2:
  9441. ;
  9442. p += 24
  9443. }
  9444. /* Don't process any further if object is stripped. */
  9445. if symoff == uint64(0) {
  9446. goto done
  9447. }
  9448. if libc.Xlseek(tls, fd, libc.Int64FromUint64(symoff), 0) == int64(-int32(1)) {
  9449. nent = -int32(1)
  9450. goto done
  9451. }
  9452. for symsize > uint32(0) && nent > 0 {
  9453. if uint64(symsize) < libc.Uint64FromInt64(24576) {
  9454. v3 = uint64(symsize)
  9455. } else {
  9456. v3 = libc.Uint64FromInt64(24576)
  9457. }
  9458. cc = libc.Int32FromUint64(v3)
  9459. if libc.Xread(tls, fd, bp, libc.Uint64FromInt32(cc)) != int64(cc) {
  9460. break
  9461. }
  9462. symsize -= libc.Uint32FromInt32(cc)
  9463. s = bp
  9464. for {
  9465. if !(cc > 0 && nent > 0) {
  9466. break
  9467. }
  9468. name = strtab + uintptr((*TElf64_Sym)(unsafe.Pointer(s)).Fst_name)
  9469. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(name))) == int32('\000') {
  9470. goto _4
  9471. }
  9472. size = symstrsize - (*TElf64_Sym)(unsafe.Pointer(s)).Fst_name
  9473. p1 = list
  9474. for {
  9475. if !!(*(*uintptr)(unsafe.Pointer(p1)) == uintptr(0) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p1))))) == 0) {
  9476. break
  9477. }
  9478. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p1))))) == int32('_') && libc.Xstrncmp(tls, name, *(*uintptr)(unsafe.Pointer(p1))+uintptr(1), uint64(size)) == 0 || libc.Xstrncmp(tls, name, *(*uintptr)(unsafe.Pointer(p1)), uint64(size)) == 0 {
  9479. _elf_sym_to_nlist(tls, p1, s, shdr, libc.Int32FromUint16((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shnum))
  9480. nent--
  9481. v6 = nent
  9482. if v6 <= 0 {
  9483. break
  9484. }
  9485. }
  9486. goto _5
  9487. _5:
  9488. ;
  9489. p1 += 24
  9490. }
  9491. goto _4
  9492. _4:
  9493. ;
  9494. s += 24
  9495. cc = TElf64_Sword(uint64(cc) - libc.Uint64FromInt64(24))
  9496. }
  9497. }
  9498. goto done
  9499. done:
  9500. ;
  9501. errsave = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9502. libc.Xfree(tls, strtab)
  9503. libc.Xfree(tls, shdr)
  9504. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = errsave
  9505. return nent
  9506. }
  9507. func Xnlist(tls *libc.TLS, name uintptr, list uintptr) (r int32) {
  9508. bp := tls.Alloc(16)
  9509. defer tls.Free(16)
  9510. var fd, n int32
  9511. _, _ = fd, n
  9512. if list == libc.UintptrFromInt32(0) {
  9513. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  9514. return -int32(1)
  9515. }
  9516. fd = libc.Xopen(tls, name, m_O_RDONLY1, libc.VaList(bp+8, 0))
  9517. if fd < 0 {
  9518. return -int32(1)
  9519. }
  9520. n = X__fdnlist(tls, fd, list)
  9521. libc.Xclose(tls, fd)
  9522. return n
  9523. }
  9524. const m_O_CREAT3 = 64
  9525. const m_O_NONBLOCK3 = 2048
  9526. const m_O_TRUNC3 = 512
  9527. const m_O_WRONLY1 = 1
  9528. type Tpidfh = struct {
  9529. Fpf_fd int32
  9530. Fpf_path uintptr
  9531. Fpf_dev Tdev_t
  9532. Fpf_ino Tino_t
  9533. }
  9534. func _pidfile_verify(tls *libc.TLS, pfh uintptr) (r int32) {
  9535. bp := tls.Alloc(144)
  9536. defer tls.Free(144)
  9537. var _ /* sb at bp+0 */ Tstat
  9538. if pfh == libc.UintptrFromInt32(0) || (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd == -int32(1) {
  9539. return int32(m_EINVAL)
  9540. }
  9541. /*
  9542. * Check remembered descriptor.
  9543. */
  9544. if libc.Xfstat(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd, bp) == -int32(1) {
  9545. return *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9546. }
  9547. 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 {
  9548. return int32(m_EINVAL)
  9549. }
  9550. return 0
  9551. }
  9552. func _pidfile_read(tls *libc.TLS, path uintptr, pidptr uintptr) (r int32) {
  9553. bp := tls.Alloc(32)
  9554. defer tls.Free(32)
  9555. var error1, fd, i int32
  9556. var _ /* buf at bp+0 */ [16]uint8
  9557. var _ /* endptr at bp+16 */ uintptr
  9558. _, _, _ = error1, fd, i
  9559. fd = libc.Xopen(tls, path, m_O_RDONLY1, 0)
  9560. if fd == -int32(1) {
  9561. return *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9562. }
  9563. i = int32(libc.Xread(tls, fd, bp, libc.Uint64FromInt64(16)-libc.Uint64FromInt32(1)))
  9564. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) /* Remember errno in case close() wants to change it. */
  9565. libc.Xclose(tls, fd)
  9566. if i == -int32(1) {
  9567. return error1
  9568. } else {
  9569. if i == 0 {
  9570. return int32(m_EAGAIN)
  9571. }
  9572. }
  9573. (*(*[16]uint8)(unsafe.Pointer(bp)))[i] = uint8('\000')
  9574. *(*Tpid_t)(unsafe.Pointer(pidptr)) = int32(libc.Xstrtol(tls, bp, bp+16, int32(10)))
  9575. if *(*uintptr)(unsafe.Pointer(bp + 16)) != bp+uintptr(i) {
  9576. return int32(m_EINVAL)
  9577. }
  9578. return 0
  9579. }
  9580. func Xpidfile_open(tls *libc.TLS, path uintptr, mode Tmode_t, pidptr uintptr) (r uintptr) {
  9581. bp := tls.Alloc(176)
  9582. defer tls.Free(176)
  9583. var count, error1, fd, len1, v2 int32
  9584. var pfh uintptr
  9585. var v3 bool
  9586. var _ /* rqtp at bp+144 */ Ttimespec
  9587. var _ /* sb at bp+0 */ Tstat
  9588. _, _, _, _, _, _, _ = count, error1, fd, len1, pfh, v2, v3
  9589. pfh = libc.Xmalloc(tls, uint64(32))
  9590. if pfh == libc.UintptrFromInt32(0) {
  9591. return libc.UintptrFromInt32(0)
  9592. }
  9593. if path == libc.UintptrFromInt32(0) {
  9594. len1 = libc.Xasprintf(tls, pfh+8, __ccgo_ts+442, libc.VaList(bp+168, Xgetprogname(tls)))
  9595. if len1 < 0 {
  9596. libc.Xfree(tls, pfh)
  9597. return libc.UintptrFromInt32(0)
  9598. }
  9599. } else {
  9600. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path = libc.Xstrdup(tls, path)
  9601. }
  9602. /*
  9603. * Open the PID file and obtain exclusive lock.
  9604. * We truncate PID file here only to remove old PID immediately,
  9605. * PID file will be truncated again in pidfile_write(), so
  9606. * pidfile_write() can be called multiple times.
  9607. */
  9608. 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+168, mode))
  9609. if fd == -int32(1) {
  9610. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EAGAIN) {
  9611. if pidptr == libc.UintptrFromInt32(0) {
  9612. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EEXIST)
  9613. } else {
  9614. count = int32(20)
  9615. (*(*Ttimespec)(unsafe.Pointer(bp + 144))).Ftv_sec = 0
  9616. (*(*Ttimespec)(unsafe.Pointer(bp + 144))).Ftv_nsec = int64(5000000)
  9617. for {
  9618. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = _pidfile_read(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path, pidptr)
  9619. if v3 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) != int32(m_EAGAIN); !v3 {
  9620. count--
  9621. v2 = count
  9622. }
  9623. if v3 || v2 == 0 {
  9624. break
  9625. }
  9626. libc.Xnanosleep(tls, bp+144, uintptr(0))
  9627. goto _1
  9628. _1:
  9629. }
  9630. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EAGAIN) {
  9631. *(*Tpid_t)(unsafe.Pointer(pidptr)) = -int32(1)
  9632. }
  9633. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == 0 || *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EAGAIN) {
  9634. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EEXIST)
  9635. }
  9636. }
  9637. }
  9638. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9639. libc.Xfree(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  9640. libc.Xfree(tls, pfh)
  9641. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9642. return libc.UintptrFromInt32(0)
  9643. }
  9644. /*
  9645. * Remember file information, so in pidfile_write() we are sure we write
  9646. * to the proper descriptor.
  9647. */
  9648. if libc.Xfstat(tls, fd, bp) == -int32(1) {
  9649. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9650. libc.Xunlink(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  9651. libc.Xfree(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  9652. libc.Xclose(tls, fd)
  9653. libc.Xfree(tls, pfh)
  9654. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9655. return libc.UintptrFromInt32(0)
  9656. }
  9657. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd = fd
  9658. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_dev = (*(*Tstat)(unsafe.Pointer(bp))).Fst_dev
  9659. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_ino = (*(*Tstat)(unsafe.Pointer(bp))).Fst_ino
  9660. return pfh
  9661. }
  9662. func Xpidfile_write(tls *libc.TLS, pfh uintptr) (r int32) {
  9663. bp := tls.Alloc(32)
  9664. defer tls.Free(32)
  9665. var error1, fd int32
  9666. var _ /* pidstr at bp+0 */ [16]uint8
  9667. _, _ = error1, fd
  9668. /*
  9669. * Check remembered descriptor, so we don't overwrite some other
  9670. * file if pidfile was closed and descriptor reused.
  9671. */
  9672. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = _pidfile_verify(tls, pfh)
  9673. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) != 0 {
  9674. /*
  9675. * Don't close descriptor, because we are not sure if it's ours.
  9676. */
  9677. return -int32(1)
  9678. }
  9679. fd = (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd
  9680. /*
  9681. * Truncate PID file, so multiple calls of pidfile_write() are allowed.
  9682. */
  9683. if libc.Xftruncate(tls, fd, 0) == -int32(1) {
  9684. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9685. __pidfile_remove(tls, pfh, 0)
  9686. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9687. return -int32(1)
  9688. }
  9689. libc.X__builtin_snprintf(tls, bp, uint64(16), __ccgo_ts+458, libc.VaList(bp+24, libc.Xgetpid(tls)))
  9690. if libc.Xpwrite(tls, fd, bp, libc.Xstrlen(tls, bp), 0) != libc.Int64FromUint64(libc.Xstrlen(tls, bp)) {
  9691. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9692. __pidfile_remove(tls, pfh, 0)
  9693. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9694. return -int32(1)
  9695. }
  9696. return 0
  9697. }
  9698. func Xpidfile_close(tls *libc.TLS, pfh uintptr) (r int32) {
  9699. var error1 int32
  9700. _ = error1
  9701. error1 = _pidfile_verify(tls, pfh)
  9702. if error1 != 0 {
  9703. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9704. return -int32(1)
  9705. }
  9706. if libc.Xclose(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd) == -int32(1) {
  9707. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9708. }
  9709. libc.Xfree(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  9710. libc.Xfree(tls, pfh)
  9711. if error1 != 0 {
  9712. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9713. return -int32(1)
  9714. }
  9715. return 0
  9716. }
  9717. func __pidfile_remove(tls *libc.TLS, pfh uintptr, freeit int32) (r int32) {
  9718. var error1 int32
  9719. _ = error1
  9720. error1 = _pidfile_verify(tls, pfh)
  9721. if error1 != 0 {
  9722. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9723. return -int32(1)
  9724. }
  9725. if libc.Xunlink(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path) == -int32(1) {
  9726. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9727. }
  9728. if libc.Xclose(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd) == -int32(1) {
  9729. if error1 == 0 {
  9730. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9731. }
  9732. }
  9733. if freeit != 0 {
  9734. libc.Xfree(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  9735. libc.Xfree(tls, pfh)
  9736. } else {
  9737. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd = -int32(1)
  9738. }
  9739. if error1 != 0 {
  9740. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9741. return -int32(1)
  9742. }
  9743. return 0
  9744. }
  9745. func Xpidfile_remove(tls *libc.TLS, pfh uintptr) (r int32) {
  9746. return __pidfile_remove(tls, pfh, int32(1))
  9747. }
  9748. func Xpidfile_fileno(tls *libc.TLS, pfh uintptr) (r int32) {
  9749. if pfh == libc.UintptrFromInt32(0) || (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd == -int32(1) {
  9750. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  9751. return -int32(1)
  9752. }
  9753. return (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd
  9754. }
  9755. func Xgetprogname(tls *libc.TLS) (r uintptr) {
  9756. if libc.Xprogram_invocation_short_name == libc.UintptrFromInt32(0) {
  9757. libc.Xprogram_invocation_short_name = libc.Xprogram_invocation_short_name
  9758. }
  9759. return libc.Xprogram_invocation_short_name
  9760. }
  9761. func Xsetprogname(tls *libc.TLS, progname uintptr) {
  9762. var i Tsize_t
  9763. _ = i
  9764. i = libc.Xstrlen(tls, progname)
  9765. for {
  9766. if !(i > uint64(0)) {
  9767. break
  9768. }
  9769. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(progname + uintptr(i-uint64(1))))) == int32('/') {
  9770. libc.Xprogram_invocation_short_name = progname + uintptr(i)
  9771. return
  9772. }
  9773. goto _1
  9774. _1:
  9775. ;
  9776. i--
  9777. }
  9778. libc.Xprogram_invocation_short_name = progname
  9779. }
  9780. const m_GID_SZ = 251
  9781. const m_GNMLEN = 32
  9782. const m_GNM_SZ = 251
  9783. const m_INVALID = 2
  9784. const m_UID_SZ = 317
  9785. const m_UNMLEN = 32
  9786. const m_UNM_SZ = 317
  9787. const m_VALID = 1
  9788. const m__PW_BUF_LEN = 1024
  9789. type Tgroup = struct {
  9790. Fgr_name uintptr
  9791. Fgr_passwd uintptr
  9792. Fgr_gid Tgid_t
  9793. Fgr_mem uintptr
  9794. }
  9795. type Tpasswd = struct {
  9796. Fpw_name uintptr
  9797. Fpw_passwd uintptr
  9798. Fpw_uid Tuid_t
  9799. Fpw_gid Tgid_t
  9800. Fpw_gecos uintptr
  9801. Fpw_dir uintptr
  9802. Fpw_shell uintptr
  9803. }
  9804. /*
  9805. * Constants and data structures used to implement group and password file
  9806. * caches. Name lengths have been chosen to be as large as those supported
  9807. * by the passwd and group files as well as the standard archive formats.
  9808. * CACHE SIZES MUST BE PRIME
  9809. */
  9810. /*
  9811. * Node structures used in the user, group, uid, and gid caches.
  9812. */
  9813. type TUIDC = struct {
  9814. Fvalid int32
  9815. Fname [32]uint8
  9816. Fuid Tuid_t
  9817. }
  9818. /*
  9819. * Constants and data structures used to implement group and password file
  9820. * caches. Name lengths have been chosen to be as large as those supported
  9821. * by the passwd and group files as well as the standard archive formats.
  9822. * CACHE SIZES MUST BE PRIME
  9823. */
  9824. /*
  9825. * Node structures used in the user, group, uid, and gid caches.
  9826. */
  9827. type Tuidc = TUIDC
  9828. type TGIDC = struct {
  9829. Fvalid int32
  9830. Fname [32]uint8
  9831. Fgid Tgid_t
  9832. }
  9833. type Tgidc = TGIDC
  9834. /*
  9835. * Routines that control user, group, uid and gid caches.
  9836. * Traditional passwd/group cache routines perform quite poorly with
  9837. * archives. The chances of hitting a valid lookup with an archive is quite a
  9838. * bit worse than with files already resident on the file system. These misses
  9839. * create a MAJOR performance cost. To adress this problem, these routines
  9840. * cache both hits and misses.
  9841. */
  9842. var _uidtb uintptr /* uid to name cache */
  9843. var _gidtb uintptr /* gid to name cache */
  9844. var _usrtb uintptr /* user name to uid cache */
  9845. var _grptb uintptr /* group name to gid cache */
  9846. func _st_hash(tls *libc.TLS, name uintptr, len1 Tsize_t, tabsz int32) (r Tu_int) {
  9847. var key Tu_int
  9848. var v1 Tsize_t
  9849. var v2 uintptr
  9850. _, _, _ = key, v1, v2
  9851. key = uint32(0)
  9852. for {
  9853. v1 = len1
  9854. len1--
  9855. if !(v1 != 0) {
  9856. break
  9857. }
  9858. v2 = name
  9859. name++
  9860. key += uint32(*(*uint8)(unsafe.Pointer(v2)))
  9861. key = key<<libc.Int32FromInt32(8) | key>>libc.Int32FromInt32(24)
  9862. }
  9863. return key % libc.Uint32FromInt32(tabsz)
  9864. }
  9865. // C documentation
  9866. //
  9867. // /*
  9868. // * uidtb_start
  9869. // * creates an an empty uidtb
  9870. // * Return:
  9871. // * 0 if ok, -1 otherwise
  9872. // */
  9873. func _uidtb_start(tls *libc.TLS) (r int32) {
  9874. var v1 uintptr
  9875. _ = v1
  9876. if _uidtb != libc.UintptrFromInt32(0) {
  9877. return 0
  9878. }
  9879. if _fail != 0 {
  9880. return -int32(1)
  9881. }
  9882. v1 = libc.Xcalloc(tls, uint64(m_UID_SZ), uint64(8))
  9883. _uidtb = v1
  9884. if v1 == libc.UintptrFromInt32(0) {
  9885. _fail++
  9886. return -int32(1)
  9887. }
  9888. return 0
  9889. }
  9890. var _fail int32
  9891. // C documentation
  9892. //
  9893. // /*
  9894. // * gidtb_start
  9895. // * creates an an empty gidtb
  9896. // * Return:
  9897. // * 0 if ok, -1 otherwise
  9898. // */
  9899. func _gidtb_start(tls *libc.TLS) (r int32) {
  9900. var v1 uintptr
  9901. _ = v1
  9902. if _gidtb != libc.UintptrFromInt32(0) {
  9903. return 0
  9904. }
  9905. if _fail1 != 0 {
  9906. return -int32(1)
  9907. }
  9908. v1 = libc.Xcalloc(tls, uint64(m_GID_SZ), uint64(8))
  9909. _gidtb = v1
  9910. if v1 == libc.UintptrFromInt32(0) {
  9911. _fail1++
  9912. return -int32(1)
  9913. }
  9914. return 0
  9915. }
  9916. var _fail1 int32
  9917. // C documentation
  9918. //
  9919. // /*
  9920. // * usrtb_start
  9921. // * creates an an empty usrtb
  9922. // * Return:
  9923. // * 0 if ok, -1 otherwise
  9924. // */
  9925. func _usrtb_start(tls *libc.TLS) (r int32) {
  9926. var v1 uintptr
  9927. _ = v1
  9928. if _usrtb != libc.UintptrFromInt32(0) {
  9929. return 0
  9930. }
  9931. if _fail2 != 0 {
  9932. return -int32(1)
  9933. }
  9934. v1 = libc.Xcalloc(tls, uint64(m_UNM_SZ), uint64(8))
  9935. _usrtb = v1
  9936. if v1 == libc.UintptrFromInt32(0) {
  9937. _fail2++
  9938. return -int32(1)
  9939. }
  9940. return 0
  9941. }
  9942. var _fail2 int32
  9943. // C documentation
  9944. //
  9945. // /*
  9946. // * grptb_start
  9947. // * creates an an empty grptb
  9948. // * Return:
  9949. // * 0 if ok, -1 otherwise
  9950. // */
  9951. func _grptb_start(tls *libc.TLS) (r int32) {
  9952. var v1 uintptr
  9953. _ = v1
  9954. if _grptb != libc.UintptrFromInt32(0) {
  9955. return 0
  9956. }
  9957. if _fail3 != 0 {
  9958. return -int32(1)
  9959. }
  9960. v1 = libc.Xcalloc(tls, uint64(m_GNM_SZ), uint64(8))
  9961. _grptb = v1
  9962. if v1 == libc.UintptrFromInt32(0) {
  9963. _fail3++
  9964. return -int32(1)
  9965. }
  9966. return 0
  9967. }
  9968. var _fail3 int32
  9969. // C documentation
  9970. //
  9971. // /*
  9972. // * user_from_uid()
  9973. // * caches the name (if any) for the uid. If noname clear, we always
  9974. // * return the stored name (if valid or invalid match).
  9975. // * We use a simple hash table.
  9976. // * Return:
  9977. // * Pointer to stored name (or a empty string)
  9978. // */
  9979. func Xuser_from_uid(tls *libc.TLS, uid Tuid_t, noname int32) (r uintptr) {
  9980. bp := tls.Alloc(1104)
  9981. defer tls.Free(1104)
  9982. var pptr, ptr, v1 uintptr
  9983. var _ /* pw at bp+48 */ uintptr
  9984. var _ /* pwbuf at bp+56 */ [1024]uint8
  9985. var _ /* pwstore at bp+0 */ Tpasswd
  9986. _, _, _ = pptr, ptr, v1
  9987. *(*uintptr)(unsafe.Pointer(bp + 48)) = libc.UintptrFromInt32(0)
  9988. ptr = libc.UintptrFromInt32(0)
  9989. if _uidtb != libc.UintptrFromInt32(0) || _uidtb_start(tls) == 0 {
  9990. /*
  9991. * see if we have this uid cached
  9992. */
  9993. pptr = _uidtb + uintptr(uid%libc.Uint32FromInt32(m_UID_SZ))*8
  9994. ptr = *(*uintptr)(unsafe.Pointer(pptr))
  9995. if ptr != libc.UintptrFromInt32(0) && (*TUIDC)(unsafe.Pointer(ptr)).Fvalid > 0 && (*TUIDC)(unsafe.Pointer(ptr)).Fuid == uid {
  9996. /*
  9997. * have an entry for this uid
  9998. */
  9999. if !(noname != 0) || (*TUIDC)(unsafe.Pointer(ptr)).Fvalid == int32(m_VALID) {
  10000. return ptr + 4
  10001. }
  10002. return libc.UintptrFromInt32(0)
  10003. }
  10004. if ptr == libc.UintptrFromInt32(0) {
  10005. v1 = libc.Xmalloc(tls, uint64(40))
  10006. ptr = v1
  10007. *(*uintptr)(unsafe.Pointer(pptr)) = v1
  10008. }
  10009. }
  10010. libc.Xgetpwuid_r(tls, uid, bp, bp+56, uint64(1024), bp+48)
  10011. if *(*uintptr)(unsafe.Pointer(bp + 48)) == libc.UintptrFromInt32(0) {
  10012. /*
  10013. * no match for this uid in the local password file
  10014. * a string that is the uid in numeric format
  10015. */
  10016. if ptr == libc.UintptrFromInt32(0) {
  10017. return libc.UintptrFromInt32(0)
  10018. }
  10019. (*TUIDC)(unsafe.Pointer(ptr)).Fuid = uid
  10020. libc.X__builtin_snprintf(tls, ptr+4, uint64(m_UNMLEN), __ccgo_ts+458, libc.VaList(bp+1088, uid))
  10021. (*TUIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_INVALID)
  10022. if noname != 0 {
  10023. return libc.UintptrFromInt32(0)
  10024. }
  10025. } else {
  10026. /*
  10027. * there is an entry for this uid in the password file
  10028. */
  10029. if ptr == libc.UintptrFromInt32(0) {
  10030. return (*Tpasswd)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48)))).Fpw_name
  10031. }
  10032. (*TUIDC)(unsafe.Pointer(ptr)).Fuid = uid
  10033. Xstrlcpy(tls, ptr+4, (*Tpasswd)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48)))).Fpw_name, uint64(32))
  10034. (*TUIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_VALID)
  10035. }
  10036. return ptr + 4
  10037. }
  10038. // C documentation
  10039. //
  10040. // /*
  10041. // * group_from_gid()
  10042. // * caches the name (if any) for the gid. If noname clear, we always
  10043. // * return the stored name (if valid or invalid match).
  10044. // * We use a simple hash table.
  10045. // * Return:
  10046. // * Pointer to stored name (or a empty string)
  10047. // */
  10048. func Xgroup_from_gid(tls *libc.TLS, gid Tgid_t, noname int32) (r uintptr) {
  10049. bp := tls.Alloc(2688)
  10050. defer tls.Free(2688)
  10051. var pptr, ptr, v1 uintptr
  10052. var _ /* gr at bp+32 */ uintptr
  10053. var _ /* grbuf at bp+40 */ [2624]uint8
  10054. var _ /* grstore at bp+0 */ Tgroup
  10055. _, _, _ = pptr, ptr, v1
  10056. *(*uintptr)(unsafe.Pointer(bp + 32)) = libc.UintptrFromInt32(0)
  10057. ptr = libc.UintptrFromInt32(0)
  10058. if _gidtb != libc.UintptrFromInt32(0) || _gidtb_start(tls) == 0 {
  10059. /*
  10060. * see if we have this gid cached
  10061. */
  10062. pptr = _gidtb + uintptr(gid%libc.Uint32FromInt32(m_GID_SZ))*8
  10063. ptr = *(*uintptr)(unsafe.Pointer(pptr))
  10064. if ptr != libc.UintptrFromInt32(0) && (*TGIDC)(unsafe.Pointer(ptr)).Fvalid > 0 && (*TGIDC)(unsafe.Pointer(ptr)).Fgid == gid {
  10065. /*
  10066. * have an entry for this gid
  10067. */
  10068. if !(noname != 0) || (*TGIDC)(unsafe.Pointer(ptr)).Fvalid == int32(m_VALID) {
  10069. return ptr + 4
  10070. }
  10071. return libc.UintptrFromInt32(0)
  10072. }
  10073. if ptr == libc.UintptrFromInt32(0) {
  10074. v1 = libc.Xmalloc(tls, uint64(40))
  10075. ptr = v1
  10076. *(*uintptr)(unsafe.Pointer(pptr)) = v1
  10077. }
  10078. }
  10079. libc.Xgetgrgid_r(tls, gid, bp, bp+40, uint64(2624), bp+32)
  10080. if *(*uintptr)(unsafe.Pointer(bp + 32)) == libc.UintptrFromInt32(0) {
  10081. /*
  10082. * no match for this gid in the local group file, put in
  10083. * a string that is the gid in numeric format
  10084. */
  10085. if ptr == libc.UintptrFromInt32(0) {
  10086. return libc.UintptrFromInt32(0)
  10087. }
  10088. (*TGIDC)(unsafe.Pointer(ptr)).Fgid = gid
  10089. libc.X__builtin_snprintf(tls, ptr+4, uint64(m_GNMLEN), __ccgo_ts+458, libc.VaList(bp+2672, gid))
  10090. (*TGIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_INVALID)
  10091. if noname != 0 {
  10092. return libc.UintptrFromInt32(0)
  10093. }
  10094. } else {
  10095. /*
  10096. * there is an entry for this group in the group file
  10097. */
  10098. if ptr == libc.UintptrFromInt32(0) {
  10099. return (*Tgroup)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32)))).Fgr_name
  10100. }
  10101. (*TGIDC)(unsafe.Pointer(ptr)).Fgid = gid
  10102. Xstrlcpy(tls, ptr+4, (*Tgroup)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32)))).Fgr_name, uint64(32))
  10103. (*TGIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_VALID)
  10104. }
  10105. return ptr + 4
  10106. }
  10107. // C documentation
  10108. //
  10109. // /*
  10110. // * uid_from_user()
  10111. // * caches the uid for a given user name. We use a simple hash table.
  10112. // * Return:
  10113. // * 0 if the user name is found (filling in uid), -1 otherwise
  10114. // */
  10115. func Xuid_from_user(tls *libc.TLS, name uintptr, uid uintptr) (r int32) {
  10116. bp := tls.Alloc(1088)
  10117. defer tls.Free(1088)
  10118. var namelen, v1 Tsize_t
  10119. var pptr, ptr, v3 uintptr
  10120. var v2 bool
  10121. var v4 Tuid_t
  10122. var _ /* pw at bp+48 */ uintptr
  10123. var _ /* pwbuf at bp+56 */ [1024]uint8
  10124. var _ /* pwstore at bp+0 */ Tpasswd
  10125. _, _, _, _, _, _, _ = namelen, pptr, ptr, v1, v2, v3, v4
  10126. *(*uintptr)(unsafe.Pointer(bp + 48)) = libc.UintptrFromInt32(0)
  10127. ptr = libc.UintptrFromInt32(0)
  10128. /*
  10129. * return -1 for mangled names
  10130. */
  10131. if v2 = name == libc.UintptrFromInt32(0); !v2 {
  10132. v1 = libc.Xstrlen(tls, name)
  10133. namelen = v1
  10134. }
  10135. if v2 || v1 == uint64(0) {
  10136. return -int32(1)
  10137. }
  10138. if _usrtb != libc.UintptrFromInt32(0) || _usrtb_start(tls) == 0 {
  10139. /*
  10140. * look up in hash table, if found and valid return the uid,
  10141. * if found and invalid, return a -1
  10142. */
  10143. pptr = _usrtb + uintptr(_st_hash(tls, name, namelen, int32(m_UNM_SZ)))*8
  10144. ptr = *(*uintptr)(unsafe.Pointer(pptr))
  10145. if ptr != libc.UintptrFromInt32(0) && (*TUIDC)(unsafe.Pointer(ptr)).Fvalid > 0 && libc.Xstrcmp(tls, name, ptr+4) == 0 {
  10146. if (*TUIDC)(unsafe.Pointer(ptr)).Fvalid == int32(m_INVALID) {
  10147. return -int32(1)
  10148. }
  10149. *(*Tuid_t)(unsafe.Pointer(uid)) = (*TUIDC)(unsafe.Pointer(ptr)).Fuid
  10150. return 0
  10151. }
  10152. if ptr == libc.UintptrFromInt32(0) {
  10153. v3 = libc.Xmalloc(tls, uint64(40))
  10154. ptr = v3
  10155. *(*uintptr)(unsafe.Pointer(pptr)) = v3
  10156. }
  10157. }
  10158. /*
  10159. * no match, look it up, if no match store it as an invalid entry,
  10160. * or store the matching uid
  10161. */
  10162. libc.Xgetpwnam_r(tls, name, bp, bp+56, uint64(1024), bp+48)
  10163. if ptr == libc.UintptrFromInt32(0) {
  10164. if *(*uintptr)(unsafe.Pointer(bp + 48)) == libc.UintptrFromInt32(0) {
  10165. return -int32(1)
  10166. }
  10167. *(*Tuid_t)(unsafe.Pointer(uid)) = (*Tpasswd)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48)))).Fpw_uid
  10168. return 0
  10169. }
  10170. Xstrlcpy(tls, ptr+4, name, uint64(32))
  10171. if *(*uintptr)(unsafe.Pointer(bp + 48)) == libc.UintptrFromInt32(0) {
  10172. (*TUIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_INVALID)
  10173. return -int32(1)
  10174. }
  10175. (*TUIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_VALID)
  10176. v4 = (*Tpasswd)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48)))).Fpw_uid
  10177. (*TUIDC)(unsafe.Pointer(ptr)).Fuid = v4
  10178. *(*Tuid_t)(unsafe.Pointer(uid)) = v4
  10179. return 0
  10180. }
  10181. // C documentation
  10182. //
  10183. // /*
  10184. // * gid_from_group()
  10185. // * caches the gid for a given group name. We use a simple hash table.
  10186. // * Return:
  10187. // * 0 if the group name is found (filling in gid), -1 otherwise
  10188. // */
  10189. func Xgid_from_group(tls *libc.TLS, name uintptr, gid uintptr) (r int32) {
  10190. bp := tls.Alloc(2672)
  10191. defer tls.Free(2672)
  10192. var namelen, v1 Tsize_t
  10193. var pptr, ptr, v3 uintptr
  10194. var v2 bool
  10195. var v4 Tgid_t
  10196. var _ /* gr at bp+32 */ uintptr
  10197. var _ /* grbuf at bp+40 */ [2624]uint8
  10198. var _ /* grstore at bp+0 */ Tgroup
  10199. _, _, _, _, _, _, _ = namelen, pptr, ptr, v1, v2, v3, v4
  10200. *(*uintptr)(unsafe.Pointer(bp + 32)) = libc.UintptrFromInt32(0)
  10201. ptr = libc.UintptrFromInt32(0)
  10202. /*
  10203. * return -1 for mangled names
  10204. */
  10205. if v2 = name == libc.UintptrFromInt32(0); !v2 {
  10206. v1 = libc.Xstrlen(tls, name)
  10207. namelen = v1
  10208. }
  10209. if v2 || v1 == uint64(0) {
  10210. return -int32(1)
  10211. }
  10212. if _grptb != libc.UintptrFromInt32(0) || _grptb_start(tls) == 0 {
  10213. /*
  10214. * look up in hash table, if found and valid return the uid,
  10215. * if found and invalid, return a -1
  10216. */
  10217. pptr = _grptb + uintptr(_st_hash(tls, name, namelen, int32(m_GID_SZ)))*8
  10218. ptr = *(*uintptr)(unsafe.Pointer(pptr))
  10219. if ptr != libc.UintptrFromInt32(0) && (*TGIDC)(unsafe.Pointer(ptr)).Fvalid > 0 && libc.Xstrcmp(tls, name, ptr+4) == 0 {
  10220. if (*TGIDC)(unsafe.Pointer(ptr)).Fvalid == int32(m_INVALID) {
  10221. return -int32(1)
  10222. }
  10223. *(*Tgid_t)(unsafe.Pointer(gid)) = (*TGIDC)(unsafe.Pointer(ptr)).Fgid
  10224. return 0
  10225. }
  10226. if ptr == libc.UintptrFromInt32(0) {
  10227. v3 = libc.Xmalloc(tls, uint64(40))
  10228. ptr = v3
  10229. *(*uintptr)(unsafe.Pointer(pptr)) = v3
  10230. }
  10231. }
  10232. /*
  10233. * no match, look it up, if no match store it as an invalid entry,
  10234. * or store the matching gid
  10235. */
  10236. libc.Xgetgrnam_r(tls, name, bp, bp+40, uint64(2624), bp+32)
  10237. if ptr == libc.UintptrFromInt32(0) {
  10238. if *(*uintptr)(unsafe.Pointer(bp + 32)) == libc.UintptrFromInt32(0) {
  10239. return -int32(1)
  10240. }
  10241. *(*Tgid_t)(unsafe.Pointer(gid)) = (*Tgroup)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32)))).Fgr_gid
  10242. return 0
  10243. }
  10244. Xstrlcpy(tls, ptr+4, name, uint64(32))
  10245. if *(*uintptr)(unsafe.Pointer(bp + 32)) == libc.UintptrFromInt32(0) {
  10246. (*TGIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_INVALID)
  10247. return -int32(1)
  10248. }
  10249. (*TGIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_VALID)
  10250. v4 = (*Tgroup)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32)))).Fgr_gid
  10251. (*TGIDC)(unsafe.Pointer(ptr)).Fgid = v4
  10252. *(*Tgid_t)(unsafe.Pointer(gid)) = v4
  10253. return 0
  10254. }
  10255. const m_SIZE = 512
  10256. const m_THRESHOLD1 = 20
  10257. type Tstack = struct {
  10258. Fsa uintptr
  10259. Fsn int32
  10260. Fsi int32
  10261. }
  10262. func Xradixsort(tls *libc.TLS, a uintptr, n int32, tab uintptr, endch uint32) (r int32) {
  10263. bp := tls.Alloc(256)
  10264. defer tls.Free(256)
  10265. var c uint32
  10266. var tr uintptr
  10267. var _ /* tr0 at bp+0 */ [256]uint8
  10268. _, _ = c, tr
  10269. if tab == libc.UintptrFromInt32(0) {
  10270. tr = bp
  10271. c = uint32(0)
  10272. for {
  10273. if !(c < endch) {
  10274. break
  10275. }
  10276. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(c + uint32(1))
  10277. goto _1
  10278. _1:
  10279. ;
  10280. c++
  10281. }
  10282. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(0)
  10283. c++
  10284. for {
  10285. if !(c < uint32(256)) {
  10286. break
  10287. }
  10288. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(c)
  10289. goto _2
  10290. _2:
  10291. ;
  10292. c++
  10293. }
  10294. endch = uint32(0)
  10295. } else {
  10296. endch = uint32(*(*uint8)(unsafe.Pointer(tab + uintptr(endch))))
  10297. tr = tab
  10298. if endch != uint32(0) && endch != uint32(255) {
  10299. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  10300. return -int32(1)
  10301. }
  10302. }
  10303. _r_sort_a(tls, a, n, 0, tr, endch)
  10304. return 0
  10305. }
  10306. func Xsradixsort(tls *libc.TLS, a uintptr, n int32, tab uintptr, endch uint32) (r int32) {
  10307. bp := tls.Alloc(256)
  10308. defer tls.Free(256)
  10309. var c uint32
  10310. var ta, tr uintptr
  10311. var _ /* tr0 at bp+0 */ [256]uint8
  10312. _, _, _ = c, ta, tr
  10313. if a == libc.UintptrFromInt32(0) {
  10314. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EFAULT)
  10315. return -int32(1)
  10316. }
  10317. if tab == libc.UintptrFromInt32(0) {
  10318. tr = bp
  10319. c = uint32(0)
  10320. for {
  10321. if !(c < endch) {
  10322. break
  10323. }
  10324. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(c + uint32(1))
  10325. goto _1
  10326. _1:
  10327. ;
  10328. c++
  10329. }
  10330. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(0)
  10331. c++
  10332. for {
  10333. if !(c < uint32(256)) {
  10334. break
  10335. }
  10336. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(c)
  10337. goto _2
  10338. _2:
  10339. ;
  10340. c++
  10341. }
  10342. endch = uint32(0)
  10343. } else {
  10344. endch = uint32(*(*uint8)(unsafe.Pointer(tab + uintptr(endch))))
  10345. tr = tab
  10346. if endch != uint32(0) && endch != uint32(255) {
  10347. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  10348. return -int32(1)
  10349. }
  10350. }
  10351. if n < int32(m_THRESHOLD1) {
  10352. _simplesort(tls, a, n, 0, tr, endch)
  10353. } else {
  10354. ta = Xreallocarray(tls, libc.UintptrFromInt32(0), libc.Uint64FromInt32(n), uint64(8))
  10355. if ta == libc.UintptrFromInt32(0) {
  10356. return -int32(1)
  10357. }
  10358. _r_sort_b(tls, a, ta, n, 0, tr, endch)
  10359. libc.Xfree(tls, ta)
  10360. }
  10361. return 0
  10362. }
  10363. // C documentation
  10364. //
  10365. // /* Unstable, in-place sort. */
  10366. func _r_sort_a(tls *libc.TLS, a uintptr, n int32, i int32, tr uintptr, endch uint32) {
  10367. bp := tls.Alloc(10240)
  10368. defer tls.Free(10240)
  10369. var aj, ak, an, cp, r, sp, sp0, sp1, t, v1, v10, v12, v15, v16, v17, v2, v4, v6, v7, v9 uintptr
  10370. var bigc, c, v18, v5, v8 uint32
  10371. var temp Tstack
  10372. var _ /* s at bp+0 */ [512]Tstack
  10373. var _ /* top at bp+8192 */ [256]uintptr
  10374. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  10375. /* Set up stack. */
  10376. sp = bp
  10377. (*Tstack)(unsafe.Pointer(sp)).Fsa = a
  10378. (*Tstack)(unsafe.Pointer(sp)).Fsn = n
  10379. v1 = sp
  10380. sp += 16
  10381. (*Tstack)(unsafe.Pointer(v1)).Fsi = i
  10382. for !(bp >= sp) {
  10383. sp -= 16
  10384. v2 = sp
  10385. a = (*Tstack)(unsafe.Pointer(v2)).Fsa
  10386. n = (*Tstack)(unsafe.Pointer(sp)).Fsn
  10387. i = (*Tstack)(unsafe.Pointer(sp)).Fsi
  10388. if n < int32(m_THRESHOLD1) {
  10389. _simplesort(tls, a, n, i, tr, endch)
  10390. continue
  10391. }
  10392. an = a + uintptr(n)*8
  10393. /* Make character histogram. */
  10394. if _nc == uint32(0) {
  10395. _bmin = uint32(255) /* First occupied bin, excluding eos. */
  10396. ak = a
  10397. for {
  10398. if !(ak < an) {
  10399. break
  10400. }
  10401. v4 = ak
  10402. ak += 8
  10403. c = uint32(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(v4)) + uintptr(i)))))))
  10404. v6 = uintptr(unsafe.Pointer(&_count)) + uintptr(c)*4
  10405. *(*uint32)(unsafe.Pointer(v6))++
  10406. v5 = *(*uint32)(unsafe.Pointer(v6))
  10407. if v5 == uint32(1) && c != endch {
  10408. if c < _bmin {
  10409. _bmin = c
  10410. }
  10411. _nc++
  10412. }
  10413. goto _3
  10414. _3:
  10415. }
  10416. if sp+uintptr(_nc)*16 > bp+uintptr(m_SIZE)*16 { /* Get more stack. */
  10417. _r_sort_a(tls, a, n, i, tr, endch)
  10418. continue
  10419. }
  10420. }
  10421. /*
  10422. * Special case: if all strings have the same
  10423. * character at position i, move on to the next
  10424. * character.
  10425. */
  10426. if _nc == uint32(1) && _count[_bmin] == libc.Uint32FromInt32(n) {
  10427. (*Tstack)(unsafe.Pointer(sp)).Fsa = a
  10428. (*Tstack)(unsafe.Pointer(sp)).Fsn = n
  10429. v7 = sp
  10430. sp += 16
  10431. (*Tstack)(unsafe.Pointer(v7)).Fsi = i + libc.Int32FromInt32(1)
  10432. v8 = libc.Uint32FromInt32(0)
  10433. _count[_bmin] = v8
  10434. _nc = v8
  10435. continue
  10436. }
  10437. /*
  10438. * Set top[]; push incompletely sorted bins onto stack.
  10439. * top[] = pointers to last out-of-place element in bins.
  10440. * count[] = counts of elements in bins.
  10441. * Before permuting: top[c-1] + count[c] = top[c];
  10442. * during deal: top[c] counts down to top[c-1].
  10443. */
  10444. v9 = sp
  10445. sp1 = v9
  10446. sp0 = v9 /* Stack position of biggest bin. */
  10447. bigc = uint32(2) /* Size of biggest bin. */
  10448. if endch == uint32(0) { /* Special case: set top[eos]. */
  10449. v10 = a + uintptr(_count[0])*8
  10450. ak = v10
  10451. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[0] = v10
  10452. } else {
  10453. ak = a
  10454. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[int32(255)] = an
  10455. }
  10456. cp = uintptr(unsafe.Pointer(&_count)) + uintptr(_bmin)*4
  10457. for {
  10458. if !(_nc > uint32(0)) {
  10459. break
  10460. }
  10461. for *(*uint32)(unsafe.Pointer(cp)) == uint32(0) { /* Find next non-empty pile. */
  10462. cp += 4
  10463. }
  10464. if *(*uint32)(unsafe.Pointer(cp)) > uint32(1) {
  10465. if *(*uint32)(unsafe.Pointer(cp)) > bigc {
  10466. bigc = *(*uint32)(unsafe.Pointer(cp))
  10467. sp1 = sp
  10468. }
  10469. (*Tstack)(unsafe.Pointer(sp)).Fsa = ak
  10470. (*Tstack)(unsafe.Pointer(sp)).Fsn = libc.Int32FromUint32(*(*uint32)(unsafe.Pointer(cp)))
  10471. v12 = sp
  10472. sp += 16
  10473. (*Tstack)(unsafe.Pointer(v12)).Fsi = i + libc.Int32FromInt32(1)
  10474. }
  10475. ak += uintptr(*(*uint32)(unsafe.Pointer(cp))) * 8
  10476. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[(int64(cp)-t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_count))))/4] = ak
  10477. _nc--
  10478. goto _11
  10479. _11:
  10480. ;
  10481. cp += 4
  10482. }
  10483. temp = *(*Tstack)(unsafe.Pointer(sp0))
  10484. *(*Tstack)(unsafe.Pointer(sp0)) = *(*Tstack)(unsafe.Pointer(sp1))
  10485. *(*Tstack)(unsafe.Pointer(sp1)) = temp /* Play it safe -- biggest bin last. */
  10486. /*
  10487. * Permute misplacements home. Already home: everything
  10488. * before aj, and in bin[c], items from top[c] on.
  10489. * Inner loop:
  10490. * r = next element to put in place;
  10491. * ak = top[r[i]] = location to put the next element.
  10492. * aj = bottom of 1st disordered bin.
  10493. * Outer loop:
  10494. * Once the 1st disordered bin is done, ie. aj >= ak,
  10495. * aj<-aj + count[c] connects the bins in a linked list;
  10496. * reset count[c].
  10497. */
  10498. aj = a
  10499. for {
  10500. if !(aj < an) {
  10501. break
  10502. }
  10503. r = *(*uintptr)(unsafe.Pointer(aj))
  10504. for {
  10505. v18 = uint32(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(r + uintptr(i)))))))
  10506. c = v18
  10507. v17 = bp + 8192 + uintptr(v18)*8
  10508. *(*uintptr)(unsafe.Pointer(v17)) -= 8
  10509. v16 = *(*uintptr)(unsafe.Pointer(v17))
  10510. v15 = v16
  10511. ak = v15
  10512. if !(aj < v15) {
  10513. break
  10514. }
  10515. t = *(*uintptr)(unsafe.Pointer(ak))
  10516. *(*uintptr)(unsafe.Pointer(ak)) = r
  10517. r = t
  10518. goto _14
  10519. _14:
  10520. }
  10521. goto _13
  10522. _13:
  10523. ;
  10524. *(*uintptr)(unsafe.Pointer(aj)) = r
  10525. aj += uintptr(_count[c]) * 8
  10526. _count[c] = libc.Uint32FromInt32(0)
  10527. }
  10528. }
  10529. }
  10530. var _count [256]uint32
  10531. var _nc uint32
  10532. var _bmin uint32
  10533. // C documentation
  10534. //
  10535. // /* Stable sort, requiring additional memory. */
  10536. func _r_sort_b(tls *libc.TLS, a uintptr, ta uintptr, n int32, i int32, tr uintptr, endch uint32) {
  10537. bp := tls.Alloc(10240)
  10538. defer tls.Free(10240)
  10539. var ai, ak, cp, sp, sp0, sp1, v1, v11, v13, v14, v16, v17, v18, v2, v4, v6, v7, v8 uintptr
  10540. var bigc, c, v10, v5 uint32
  10541. var temp Tstack
  10542. var _ /* s at bp+0 */ [512]Tstack
  10543. var _ /* top at bp+8192 */ [256]uintptr
  10544. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ai, ak, bigc, c, cp, sp, sp0, sp1, temp, v1, v10, v11, v13, v14, v16, v17, v18, v2, v4, v5, v6, v7, v8
  10545. sp = bp
  10546. (*Tstack)(unsafe.Pointer(sp)).Fsa = a
  10547. (*Tstack)(unsafe.Pointer(sp)).Fsn = n
  10548. v1 = sp
  10549. sp += 16
  10550. (*Tstack)(unsafe.Pointer(v1)).Fsi = i
  10551. for !(bp >= sp) {
  10552. sp -= 16
  10553. v2 = sp
  10554. a = (*Tstack)(unsafe.Pointer(v2)).Fsa
  10555. n = (*Tstack)(unsafe.Pointer(sp)).Fsn
  10556. i = (*Tstack)(unsafe.Pointer(sp)).Fsi
  10557. if n < int32(m_THRESHOLD1) {
  10558. _simplesort(tls, a, n, i, tr, endch)
  10559. continue
  10560. }
  10561. if _nc1 == uint32(0) {
  10562. _bmin1 = uint32(255)
  10563. ak = a + uintptr(n)*8
  10564. for {
  10565. ak -= 8
  10566. v4 = ak
  10567. if !(v4 >= a) {
  10568. break
  10569. }
  10570. c = uint32(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ak)) + uintptr(i)))))))
  10571. v6 = uintptr(unsafe.Pointer(&_count1)) + uintptr(c)*4
  10572. *(*uint32)(unsafe.Pointer(v6))++
  10573. v5 = *(*uint32)(unsafe.Pointer(v6))
  10574. if v5 == uint32(1) && c != endch {
  10575. if c < _bmin1 {
  10576. _bmin1 = c
  10577. }
  10578. _nc1++
  10579. }
  10580. goto _3
  10581. _3:
  10582. }
  10583. if sp+uintptr(_nc1)*16 > bp+uintptr(m_SIZE)*16 {
  10584. _r_sort_b(tls, a, ta, n, i, tr, endch)
  10585. continue
  10586. }
  10587. }
  10588. v7 = sp
  10589. sp1 = v7
  10590. sp0 = v7
  10591. bigc = uint32(2)
  10592. if endch == uint32(0) {
  10593. v8 = a + uintptr(_count1[0])*8
  10594. ak = v8
  10595. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[0] = v8
  10596. _count1[0] = uint32(0)
  10597. } else {
  10598. ak = a
  10599. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[int32(255)] = a + uintptr(n)*8
  10600. _count1[int32(255)] = uint32(0)
  10601. }
  10602. cp = uintptr(unsafe.Pointer(&_count1)) + uintptr(_bmin1)*4
  10603. for {
  10604. if !(_nc1 > uint32(0)) {
  10605. break
  10606. }
  10607. for *(*uint32)(unsafe.Pointer(cp)) == uint32(0) {
  10608. cp += 4
  10609. }
  10610. v10 = *(*uint32)(unsafe.Pointer(cp))
  10611. c = v10
  10612. if v10 > uint32(1) {
  10613. if c > bigc {
  10614. bigc = c
  10615. sp1 = sp
  10616. }
  10617. (*Tstack)(unsafe.Pointer(sp)).Fsa = ak
  10618. (*Tstack)(unsafe.Pointer(sp)).Fsn = libc.Int32FromUint32(c)
  10619. v11 = sp
  10620. sp += 16
  10621. (*Tstack)(unsafe.Pointer(v11)).Fsi = i + libc.Int32FromInt32(1)
  10622. }
  10623. ak += uintptr(c) * 8
  10624. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[(int64(cp)-t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_count1))))/4] = ak
  10625. *(*uint32)(unsafe.Pointer(cp)) = uint32(0) /* Reset count[]. */
  10626. _nc1--
  10627. goto _9
  10628. _9:
  10629. ;
  10630. cp += 4
  10631. }
  10632. temp = *(*Tstack)(unsafe.Pointer(sp0))
  10633. *(*Tstack)(unsafe.Pointer(sp0)) = *(*Tstack)(unsafe.Pointer(sp1))
  10634. *(*Tstack)(unsafe.Pointer(sp1)) = temp
  10635. ak = ta + uintptr(n)*8
  10636. ai = a + uintptr(n)*8
  10637. for {
  10638. if !(ak > ta) {
  10639. break
  10640. } /* Copy to temp. */
  10641. ak -= 8
  10642. v13 = ak
  10643. ai -= 8
  10644. v14 = ai
  10645. *(*uintptr)(unsafe.Pointer(v13)) = *(*uintptr)(unsafe.Pointer(v14))
  10646. goto _12
  10647. _12:
  10648. }
  10649. ak = ta + uintptr(n)*8
  10650. for {
  10651. ak -= 8
  10652. v16 = ak
  10653. if !(v16 >= ta) {
  10654. break
  10655. } /* Deal to piles. */
  10656. v18 = bp + 8192 + uintptr(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ak)) + uintptr(i)))))))*8
  10657. *(*uintptr)(unsafe.Pointer(v18)) -= 8
  10658. v17 = *(*uintptr)(unsafe.Pointer(v18))
  10659. *(*uintptr)(unsafe.Pointer(v17)) = *(*uintptr)(unsafe.Pointer(ak))
  10660. goto _15
  10661. _15:
  10662. }
  10663. }
  10664. }
  10665. var _count1 [256]uint32
  10666. var _nc1 uint32
  10667. var _bmin1 uint32
  10668. // C documentation
  10669. //
  10670. // /* insertion sort */
  10671. func _simplesort(tls *libc.TLS, a uintptr, n int32, b int32, tr uintptr, endch uint32) {
  10672. var ai, ak, s, t uintptr
  10673. var ch, v5 uint8
  10674. var v2 int32
  10675. _, _, _, _, _, _, _ = ai, ak, ch, s, t, v2, v5
  10676. ak = a + uintptr(1)*8
  10677. for {
  10678. n--
  10679. v2 = n
  10680. if !(v2 >= int32(1)) {
  10681. break
  10682. }
  10683. ai = ak
  10684. for {
  10685. if !(ai > a) {
  10686. break
  10687. }
  10688. s = *(*uintptr)(unsafe.Pointer(ai)) + uintptr(b)
  10689. t = *(*uintptr)(unsafe.Pointer(ai + uintptr(-libc.Int32FromInt32(1))*8)) + uintptr(b)
  10690. for {
  10691. v5 = *(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(s)))))
  10692. ch = v5
  10693. if !(uint32(v5) != endch) {
  10694. break
  10695. }
  10696. if libc.Int32FromUint8(ch) != libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(t)))))) {
  10697. break
  10698. }
  10699. goto _4
  10700. _4:
  10701. ;
  10702. s++
  10703. t++
  10704. }
  10705. if libc.Int32FromUint8(ch) >= libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(t)))))) {
  10706. break
  10707. }
  10708. s = *(*uintptr)(unsafe.Pointer(ai))
  10709. *(*uintptr)(unsafe.Pointer(ai)) = *(*uintptr)(unsafe.Pointer(ai + uintptr(-libc.Int32FromInt32(1))*8))
  10710. *(*uintptr)(unsafe.Pointer(ai + uintptr(-libc.Int32FromInt32(1))*8)) = s
  10711. goto _3
  10712. _3:
  10713. ;
  10714. ai -= 8
  10715. }
  10716. goto _1
  10717. _1:
  10718. ;
  10719. ak += 8
  10720. }
  10721. }
  10722. const m_B0 = 0000000
  10723. const m_B1000000 = 0010010
  10724. const m_B110 = 0000003
  10725. const m_B115200 = 0010002
  10726. const m_B1152000 = 0010011
  10727. const m_B1200 = 0000011
  10728. const m_B134 = 0000004
  10729. const m_B150 = 0000005
  10730. const m_B1500000 = 0010012
  10731. const m_B1800 = 0000012
  10732. const m_B19200 = 0000016
  10733. const m_B200 = 0000006
  10734. const m_B2000000 = 0010013
  10735. const m_B230400 = 0010003
  10736. const m_B2400 = 0000013
  10737. const m_B2500000 = 0010014
  10738. const m_B300 = 0000007
  10739. const m_B3000000 = 0010015
  10740. const m_B3500000 = 0010016
  10741. const m_B38400 = 0000017
  10742. const m_B4000000 = 0010017
  10743. const m_B460800 = 0010004
  10744. const m_B4800 = 0000014
  10745. const m_B50 = 0000001
  10746. const m_B500000 = 0010005
  10747. const m_B57600 = 0010001
  10748. const m_B576000 = 0010006
  10749. const m_B600 = 0000010
  10750. const m_B75 = 0000002
  10751. const m_B921600 = 0010007
  10752. const m_B9600 = 0000015
  10753. const m_BRKINT = 0000002
  10754. const m_BS0 = 0000000
  10755. const m_BS1 = 0020000
  10756. const m_BSDLY = 0020000
  10757. const m_CBAUD = 0010017
  10758. const m_CBAUDEX = 0010000
  10759. const m_CIBAUD = 002003600000
  10760. const m_CLOCAL = 0004000
  10761. const m_CMSPAR = 010000000000
  10762. const m_CR0 = 0000000
  10763. const m_CR1 = 0001000
  10764. const m_CR2 = 0002000
  10765. const m_CR3 = 0003000
  10766. const m_CRDLY = 0003000
  10767. const m_CREAD = 0000200
  10768. const m_CRTSCTS = 020000000000
  10769. const m_CS5 = 0000000
  10770. const m_CS6 = 0000020
  10771. const m_CS7 = 0000040
  10772. const m_CS8 = 0000060
  10773. const m_CSIZE = 0000060
  10774. const m_CSTOPB = 0000100
  10775. const m_ECHO = 8
  10776. const m_ECHOCTL = 0001000
  10777. const m_ECHOE = 0000020
  10778. const m_ECHOK = 0000040
  10779. const m_ECHOKE = 0004000
  10780. const m_ECHONL = 64
  10781. const m_ECHOPRT = 0002000
  10782. const m_EXTA = 0000016
  10783. const m_EXTB = 0000017
  10784. const m_EXTPROC = 0200000
  10785. const m_FF0 = 0000000
  10786. const m_FF1 = 0100000
  10787. const m_FFDLY = 0100000
  10788. const m_FLUSHO = 0010000
  10789. const m_HUPCL = 0002000
  10790. const m_ICANON = 0000002
  10791. const m_ICRNL = 0000400
  10792. const m_IEXTEN = 0100000
  10793. const m_IGNBRK = 0000001
  10794. const m_IGNCR = 0000200
  10795. const m_IGNPAR = 0000004
  10796. const m_IMAXBEL = 0020000
  10797. const m_INLCR = 0000100
  10798. const m_INPCK = 0000020
  10799. const m_ISIG = 0000001
  10800. const m_ISTRIP = 0000040
  10801. const m_IUCLC = 0001000
  10802. const m_IUTF8 = 0040000
  10803. const m_IXANY = 0004000
  10804. const m_IXOFF = 0010000
  10805. const m_IXON = 0002000
  10806. const m_NCCS = 32
  10807. const m_NL0 = 0000000
  10808. const m_NL1 = 0000400
  10809. const m_NLDLY = 0000400
  10810. const m_NOFLSH = 0000200
  10811. const m_OCRNL = 0000010
  10812. const m_OFDEL = 0000200
  10813. const m_OFILL = 0000100
  10814. const m_OLCUC = 0000002
  10815. const m_ONLCR = 0000004
  10816. const m_ONLRET = 0000040
  10817. const m_ONOCR = 0000020
  10818. const m_OPOST = 0000001
  10819. const m_O_CREAT4 = 0100
  10820. const m_O_NONBLOCK4 = 04000
  10821. const m_O_RDONLY2 = 00
  10822. const m_O_RDWR1 = 2
  10823. const m_O_TRUNC4 = 01000
  10824. const m_O_WRONLY2 = 01
  10825. const m_PARENB = 0000400
  10826. const m_PARMRK = 0000010
  10827. const m_PARODD = 0001000
  10828. const m_PENDIN = 0040000
  10829. const m_RPP_ECHO_OFF = 0x00
  10830. const m_RPP_ECHO_ON = 1
  10831. const m_RPP_FORCELOWER = 4
  10832. const m_RPP_FORCEUPPER = 8
  10833. const m_RPP_REQUIRE_TTY = 2
  10834. const m_RPP_SEVENBIT = 16
  10835. const m_RPP_STDIN = 32
  10836. const m_TAB0 = 0000000
  10837. const m_TAB1 = 0004000
  10838. const m_TAB2 = 0010000
  10839. const m_TAB3 = 0014000
  10840. const m_TABDLY = 0014000
  10841. const m_TCIFLUSH = 0
  10842. const m_TCIOFF = 2
  10843. const m_TCIOFLUSH = 2
  10844. const m_TCION = 3
  10845. const m_TCOFLUSH = 1
  10846. const m_TCOOFF = 0
  10847. const m_TCOON = 1
  10848. const m_TCSADRAIN = 1
  10849. const m_TCSAFLUSH = 2
  10850. const m_TCSANOW = 0
  10851. const m_TCSASOFT = 0
  10852. const m_TOSTOP = 0000400
  10853. const m_VDISCARD = 13
  10854. const m_VEOF = 4
  10855. const m_VEOL = 11
  10856. const m_VEOL2 = 16
  10857. const m_VERASE = 2
  10858. const m_VINTR = 0
  10859. const m_VKILL = 3
  10860. const m_VLNEXT = 15
  10861. const m_VMIN = 6
  10862. const m_VQUIT = 1
  10863. const m_VREPRINT = 12
  10864. const m_VSTART = 8
  10865. const m_VSTOP = 9
  10866. const m_VSUSP = 10
  10867. const m_VSWTC = 7
  10868. const m_VT0 = 0000000
  10869. const m_VT1 = 0040000
  10870. const m_VTDLY = 0040000
  10871. const m_VTIME = 5
  10872. const m_VWERASE = 14
  10873. const m_XCASE = 0000004
  10874. const m_XTABS = 0014000
  10875. const m__PATH_BSHELL = "/bin/sh"
  10876. const m__PATH_CONSOLE = "/dev/console"
  10877. const m__PATH_DEFPATH = "/usr/local/bin:/bin:/usr/bin"
  10878. const m__PATH_DEV = "/dev/"
  10879. const m__PATH_DEVNULL = "/dev/null"
  10880. const m__PATH_KLOG = "/proc/kmsg"
  10881. const m__PATH_LASTLOG = "/var/log/lastlog"
  10882. const m__PATH_MAILDIR = "/var/mail"
  10883. const m__PATH_MAN = "/usr/share/man"
  10884. const m__PATH_MNTTAB = "/etc/fstab"
  10885. const m__PATH_MOUNTED = "/etc/mtab"
  10886. const m__PATH_NOLOGIN = "/etc/nologin"
  10887. const m__PATH_SENDMAIL = "/usr/sbin/sendmail"
  10888. const m__PATH_SHADOW = "/etc/shadow"
  10889. const m__PATH_SHELLS = "/etc/shells"
  10890. const m__PATH_STDPATH = "/bin:/usr/bin:/sbin:/usr/sbin"
  10891. const m__PATH_TMP = "/tmp/"
  10892. const m__PATH_TTY = "/dev/tty"
  10893. const m__PATH_UTMP = "/dev/null/utmp"
  10894. const m__PATH_VARDB = "/var/lib/misc/"
  10895. const m__PATH_VARRUN = "/var/run/"
  10896. const m__PATH_VARTMP = "/var/tmp/"
  10897. const m__PATH_VI = "/usr/bin/vi"
  10898. const m__PATH_WTMP = "/dev/null/wtmp"
  10899. type Twinsize = struct {
  10900. Fws_row uint16
  10901. Fws_col uint16
  10902. Fws_xpixel uint16
  10903. Fws_ypixel uint16
  10904. }
  10905. type Tcc_t = uint8
  10906. type Tspeed_t = uint32
  10907. type Ttcflag_t = uint32
  10908. type Ttermios = struct {
  10909. Fc_iflag Ttcflag_t
  10910. Fc_oflag Ttcflag_t
  10911. Fc_cflag Ttcflag_t
  10912. Fc_lflag Ttcflag_t
  10913. Fc_line Tcc_t
  10914. Fc_cc [32]Tcc_t
  10915. F__c_ispeed Tspeed_t
  10916. F__c_ospeed Tspeed_t
  10917. }
  10918. var _signo [65]Tsig_atomic_t
  10919. func Xreadpassphrase(tls *libc.TLS, prompt uintptr, buf uintptr, bufsiz Tsize_t, flags int32) (r uintptr) {
  10920. bp := tls.Alloc(1648)
  10921. defer tls.Free(1648)
  10922. var end, p, v6, v8 uintptr
  10923. var i, input, need_restart, output, save_errno, sigttou, v2, v3 int32
  10924. var nr, v5 Tssize_t
  10925. var v4 bool
  10926. var _ /* ch at bp+0 */ uint8
  10927. var _ /* oterm at bp+64 */ Ttermios
  10928. var _ /* sa at bp+128 */ Tsigaction
  10929. var _ /* savealrm at bp+280 */ Tsigaction
  10930. var _ /* savehup at bp+584 */ Tsigaction
  10931. var _ /* saveint at bp+432 */ Tsigaction
  10932. var _ /* savepipe at bp+1496 */ Tsigaction
  10933. var _ /* savequit at bp+736 */ Tsigaction
  10934. var _ /* saveterm at bp+888 */ Tsigaction
  10935. var _ /* savetstp at bp+1040 */ Tsigaction
  10936. var _ /* savettin at bp+1192 */ Tsigaction
  10937. var _ /* savettou at bp+1344 */ Tsigaction
  10938. var _ /* term at bp+4 */ Ttermios
  10939. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = end, i, input, need_restart, nr, output, p, save_errno, sigttou, v2, v3, v4, v5, v6, v8
  10940. /* I suppose we could alloc on demand in this case (XXX). */
  10941. if bufsiz == uint64(0) {
  10942. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  10943. return libc.UintptrFromInt32(0)
  10944. }
  10945. goto restart
  10946. restart:
  10947. ;
  10948. i = 0
  10949. for {
  10950. if !(i < int32(m__NSIG)) {
  10951. break
  10952. }
  10953. libc.AtomicStorePInt32(uintptr(unsafe.Pointer(&_signo))+uintptr(i)*4, 0)
  10954. goto _1
  10955. _1:
  10956. ;
  10957. i++
  10958. }
  10959. nr = int64(-int32(1))
  10960. save_errno = 0
  10961. need_restart = 0
  10962. /*
  10963. * Read and write to /dev/tty if available. If not, read from
  10964. * stdin and write to stderr unless a tty is required.
  10965. */
  10966. if v4 = flags&int32(m_RPP_STDIN) != 0; !v4 {
  10967. v3 = libc.Xopen(tls, __ccgo_ts+461, int32(m_O_RDWR1), 0)
  10968. output = v3
  10969. v2 = v3
  10970. input = v2
  10971. }
  10972. if v4 || v2 == -int32(1) {
  10973. if flags&int32(m_RPP_REQUIRE_TTY) != 0 {
  10974. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOTTY)
  10975. return libc.UintptrFromInt32(0)
  10976. }
  10977. input = m_STDIN_FILENO
  10978. output = int32(m_STDERR_FILENO)
  10979. }
  10980. /*
  10981. * Turn off echo if possible.
  10982. * If we are using a tty but are not the foreground pgrp this will
  10983. * generate SIGTTOU, so do it *before* installing the signal handlers.
  10984. */
  10985. if input != m_STDIN_FILENO && libc.Xtcgetattr(tls, input, bp+64) == 0 {
  10986. libc.Xmemcpy(tls, bp+4, bp+64, uint64(60))
  10987. if !(flags&libc.Int32FromInt32(m_RPP_ECHO_ON) != 0) {
  10988. (*(*Ttermios)(unsafe.Pointer(bp + 4))).Fc_lflag &= libc.Uint32FromInt32(^(libc.Int32FromInt32(m_ECHO) | libc.Int32FromInt32(m_ECHONL)))
  10989. }
  10990. libc.Xtcsetattr(tls, input, libc.Int32FromInt32(m_TCSAFLUSH)|libc.Int32FromInt32(m_TCSASOFT), bp+4)
  10991. } else {
  10992. libc.Xmemset(tls, bp+4, 0, uint64(60))
  10993. (*(*Ttermios)(unsafe.Pointer(bp + 4))).Fc_lflag |= uint32(m_ECHO)
  10994. libc.Xmemset(tls, bp+64, 0, uint64(60))
  10995. (*(*Ttermios)(unsafe.Pointer(bp + 64))).Fc_lflag |= uint32(m_ECHO)
  10996. }
  10997. /*
  10998. * Catch signals that would otherwise cause the user to end
  10999. * up with echo turned off in the shell. Don't worry about
  11000. * things like SIGXCPU and SIGVTALRM for now.
  11001. */
  11002. libc.Xsigemptyset(tls, bp+128+8)
  11003. (*(*Tsigaction)(unsafe.Pointer(bp + 128))).Fsa_flags = 0 /* don't restart system calls */
  11004. *(*uintptr)(unsafe.Pointer(bp + 128)) = __ccgo_fp(_handler)
  11005. libc.Xsigaction(tls, int32(m_SIGALRM), bp+128, bp+280)
  11006. libc.Xsigaction(tls, int32(m_SIGHUP), bp+128, bp+584)
  11007. libc.Xsigaction(tls, int32(m_SIGINT), bp+128, bp+432)
  11008. libc.Xsigaction(tls, int32(m_SIGPIPE), bp+128, bp+1496)
  11009. libc.Xsigaction(tls, int32(m_SIGQUIT), bp+128, bp+736)
  11010. libc.Xsigaction(tls, int32(m_SIGTERM), bp+128, bp+888)
  11011. libc.Xsigaction(tls, int32(m_SIGTSTP), bp+128, bp+1040)
  11012. libc.Xsigaction(tls, int32(m_SIGTTIN), bp+128, bp+1192)
  11013. libc.Xsigaction(tls, int32(m_SIGTTOU), bp+128, bp+1344)
  11014. if !(flags&libc.Int32FromInt32(m_RPP_STDIN) != 0) {
  11015. libc.Xwrite(tls, output, prompt, libc.Xstrlen(tls, prompt))
  11016. }
  11017. end = buf + uintptr(bufsiz) - uintptr(1)
  11018. p = buf
  11019. for {
  11020. v5 = libc.Xread(tls, input, bp, uint64(1))
  11021. nr = v5
  11022. if !(v5 == int64(1) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp))) != int32('\n') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp))) != int32('\r')) {
  11023. break
  11024. }
  11025. if p < end {
  11026. if flags&int32(m_RPP_SEVENBIT) != 0 {
  11027. *(*uint8)(unsafe.Pointer(bp)) = uint8(int32(*(*uint8)(unsafe.Pointer(bp))) & libc.Int32FromInt32(0x7f))
  11028. }
  11029. if libc.BoolInt32(uint32(*(*uint8)(unsafe.Pointer(bp)))|uint32(32)-uint32('a') < uint32(26)) != 0 {
  11030. if flags&int32(m_RPP_FORCELOWER) != 0 {
  11031. *(*uint8)(unsafe.Pointer(bp)) = libc.Uint8FromInt32(libc.Xtolower(tls, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp)))))
  11032. }
  11033. if flags&int32(m_RPP_FORCEUPPER) != 0 {
  11034. *(*uint8)(unsafe.Pointer(bp)) = libc.Uint8FromInt32(libc.Xtoupper(tls, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp)))))
  11035. }
  11036. }
  11037. v6 = p
  11038. p++
  11039. *(*uint8)(unsafe.Pointer(v6)) = *(*uint8)(unsafe.Pointer(bp))
  11040. }
  11041. }
  11042. *(*uint8)(unsafe.Pointer(p)) = uint8('\000')
  11043. save_errno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  11044. if !((*(*Ttermios)(unsafe.Pointer(bp + 4))).Fc_lflag&libc.Uint32FromInt32(m_ECHO) != 0) {
  11045. libc.Xwrite(tls, output, __ccgo_ts+470, uint64(1))
  11046. }
  11047. /* Restore old terminal settings and signals. */
  11048. if libc.Xmemcmp(tls, bp+4, bp+64, uint64(60)) != 0 {
  11049. sigttou = libc.AtomicLoadPInt32(uintptr(unsafe.Pointer(&_signo)) + libc.UintptrFromInt32(m_SIGTTOU)*4)
  11050. /* Ignore SIGTTOU generated when we are not the fg pgrp. */
  11051. 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) {
  11052. continue
  11053. }
  11054. libc.AtomicStorePInt32(uintptr(unsafe.Pointer(&_signo))+22*4, sigttou)
  11055. }
  11056. libc.Xsigaction(tls, int32(m_SIGALRM), bp+280, libc.UintptrFromInt32(0))
  11057. libc.Xsigaction(tls, int32(m_SIGHUP), bp+584, libc.UintptrFromInt32(0))
  11058. libc.Xsigaction(tls, int32(m_SIGINT), bp+432, libc.UintptrFromInt32(0))
  11059. libc.Xsigaction(tls, int32(m_SIGQUIT), bp+736, libc.UintptrFromInt32(0))
  11060. libc.Xsigaction(tls, int32(m_SIGPIPE), bp+1496, libc.UintptrFromInt32(0))
  11061. libc.Xsigaction(tls, int32(m_SIGTERM), bp+888, libc.UintptrFromInt32(0))
  11062. libc.Xsigaction(tls, int32(m_SIGTSTP), bp+1040, libc.UintptrFromInt32(0))
  11063. libc.Xsigaction(tls, int32(m_SIGTTIN), bp+1192, libc.UintptrFromInt32(0))
  11064. libc.Xsigaction(tls, int32(m_SIGTTOU), bp+1344, libc.UintptrFromInt32(0))
  11065. if input != m_STDIN_FILENO {
  11066. libc.Xclose(tls, input)
  11067. }
  11068. /*
  11069. * If we were interrupted by a signal, resend it to ourselves
  11070. * now that we have restored the signal handlers.
  11071. */
  11072. i = 0
  11073. for {
  11074. if !(i < int32(m__NSIG)) {
  11075. break
  11076. }
  11077. if libc.AtomicLoadPInt32(uintptr(unsafe.Pointer(&_signo))+uintptr(i)*4) != 0 {
  11078. libc.Xkill(tls, libc.Xgetpid(tls), i)
  11079. switch i {
  11080. case int32(m_SIGTSTP):
  11081. fallthrough
  11082. case int32(m_SIGTTIN):
  11083. fallthrough
  11084. case int32(m_SIGTTOU):
  11085. need_restart = int32(1)
  11086. }
  11087. }
  11088. goto _7
  11089. _7:
  11090. ;
  11091. i++
  11092. }
  11093. if need_restart != 0 {
  11094. goto restart
  11095. }
  11096. if save_errno != 0 {
  11097. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = save_errno
  11098. }
  11099. if nr == int64(-int32(1)) {
  11100. v8 = libc.UintptrFromInt32(0)
  11101. } else {
  11102. v8 = buf
  11103. }
  11104. return v8
  11105. }
  11106. func _handler(tls *libc.TLS, s int32) {
  11107. libc.AtomicStorePInt32(uintptr(unsafe.Pointer(&_signo))+uintptr(s)*4, int32(1))
  11108. }
  11109. const m_UINT64_MAX1 = 18446744073709551615
  11110. /*
  11111. * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
  11112. * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
  11113. */
  11114. func Xreallocarray(tls *libc.TLS, optr uintptr, nmemb Tsize_t, size Tsize_t) (r uintptr) {
  11115. 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 {
  11116. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOMEM)
  11117. return libc.UintptrFromInt32(0)
  11118. }
  11119. return libc.Xrealloc(tls, optr, size*nmemb)
  11120. }
  11121. const m_UINT64_MAX2 = "0xffffffffffffffffu"
  11122. func Xreallocf(tls *libc.TLS, ptr uintptr, size Tsize_t) (r uintptr) {
  11123. var nptr uintptr
  11124. _ = nptr
  11125. nptr = libc.Xrealloc(tls, ptr, size)
  11126. /*
  11127. * When the System V compatibility option (malloc "V" flag) is
  11128. * in effect, realloc(ptr, 0) frees the memory and returns NULL.
  11129. * So, to avoid double free, call free() only when size != 0.
  11130. * realloc(ptr, 0) can't fail when ptr != NULL.
  11131. */
  11132. if !(nptr != 0) && ptr != 0 && size != uint64(0) {
  11133. libc.Xfree(tls, ptr)
  11134. }
  11135. return nptr
  11136. }
  11137. const m_UINT64_MAX3 = 18446744073709551615
  11138. /*
  11139. * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
  11140. * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
  11141. */
  11142. func Xrecallocarray(tls *libc.TLS, ptr uintptr, oldnmemb Tsize_t, newnmemb Tsize_t, size Tsize_t) (r uintptr) {
  11143. var d, newsize, oldsize Tsize_t
  11144. var newptr uintptr
  11145. _, _, _, _ = d, newptr, newsize, oldsize
  11146. if ptr == libc.UintptrFromInt32(0) {
  11147. return libc.Xcalloc(tls, newnmemb, size)
  11148. }
  11149. 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 {
  11150. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOMEM)
  11151. return libc.UintptrFromInt32(0)
  11152. }
  11153. newsize = newnmemb * size
  11154. 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 {
  11155. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11156. return libc.UintptrFromInt32(0)
  11157. }
  11158. oldsize = oldnmemb * size
  11159. /*
  11160. * Don't bother too much if we're shrinking just a bit,
  11161. * we do not shrink for series of small steps, oh well.
  11162. */
  11163. if newsize <= oldsize {
  11164. d = oldsize - newsize
  11165. if d < oldsize/uint64(2) && d < libc.Uint64FromInt32(libc.Xgetpagesize(tls)) {
  11166. libc.Xmemset(tls, ptr+uintptr(newsize), 0, d)
  11167. return ptr
  11168. }
  11169. }
  11170. newptr = libc.Xmalloc(tls, newsize)
  11171. if newptr == libc.UintptrFromInt32(0) {
  11172. return libc.UintptrFromInt32(0)
  11173. }
  11174. if newsize > oldsize {
  11175. libc.Xmemcpy(tls, newptr, ptr, oldsize)
  11176. libc.Xmemset(tls, newptr+uintptr(oldsize), 0, newsize-oldsize)
  11177. } else {
  11178. libc.Xmemcpy(tls, newptr, ptr, newsize)
  11179. }
  11180. Xexplicit_bzero(tls, ptr, oldsize)
  11181. libc.Xfree(tls, ptr)
  11182. return newptr
  11183. }
  11184. const m_CMD2_CLR = 1
  11185. const m_CMD2_GBITS = 4
  11186. const m_CMD2_OBITS = 8
  11187. const m_CMD2_SET = 2
  11188. const m_CMD2_UBITS = 16
  11189. const m_SET_LEN = 6
  11190. const m_SET_LEN_INCR = 4
  11191. const m_S_IFDIR1 = 16384
  11192. const m_S_IRGRP1 = 32
  11193. const m_S_IROTH1 = 4
  11194. const m_S_IRUSR1 = 256
  11195. const m_S_IRWXG1 = 56
  11196. const m_S_IRWXO1 = 7
  11197. const m_S_IRWXU1 = 448
  11198. const m_S_ISGID1 = 1024
  11199. const m_S_ISUID1 = 2048
  11200. const m_S_ISVTX1 = 512
  11201. const m_S_IWGRP1 = 16
  11202. const m_S_IWOTH1 = 2
  11203. const m_S_IWUSR1 = 128
  11204. const m_S_IXGRP1 = 8
  11205. const m_S_IXOTH1 = 1
  11206. const m_S_IXUSR1 = 64
  11207. const m_UINT64_MAX4 = "0xffffffffffffffffu"
  11208. const m___LONG_MAX1 = 9223372036854775807
  11209. type TBITCMD = struct {
  11210. Fcmd uint8
  11211. Fcmd2 uint8
  11212. Fbits Tmode_t
  11213. }
  11214. type Tbitcmd = TBITCMD
  11215. // C documentation
  11216. //
  11217. // /*
  11218. // * Given the old mode and an array of bitcmd structures, apply the operations
  11219. // * described in the bitcmd structures to the old mode, and return the new mode.
  11220. // * Note that there is no '=' command; a strict assignment is just a '-' (clear
  11221. // * bits) followed by a '+' (set bits).
  11222. // */
  11223. func Xgetmode(tls *libc.TLS, bbox uintptr, omode Tmode_t) (r Tmode_t) {
  11224. var clrval, newmode, value Tmode_t
  11225. var set uintptr
  11226. var v11 uint32
  11227. _, _, _, _, _ = clrval, newmode, set, value, v11
  11228. set = bbox
  11229. newmode = omode
  11230. value = uint32(0)
  11231. for {
  11232. switch libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd) {
  11233. case int32('u'):
  11234. goto _2
  11235. case int32('g'):
  11236. goto _3
  11237. case int32('o'):
  11238. goto _4
  11239. case int32('+'):
  11240. goto _5
  11241. case int32('-'):
  11242. goto _6
  11243. case int32('X'):
  11244. goto _7
  11245. default:
  11246. goto _8
  11247. case int32('\000'):
  11248. goto _9
  11249. }
  11250. goto _10
  11251. /*
  11252. * When copying the user, group or other bits around, we "know"
  11253. * where the bits are in the mode so that we can do shifts to
  11254. * copy them around. If we don't use shifts, it gets real
  11255. * grundgy with lots of single bit checks and bit sets.
  11256. */
  11257. _2:
  11258. ;
  11259. value = newmode & uint32(m_S_IRWXU1) >> int32(6)
  11260. goto common
  11261. _3:
  11262. ;
  11263. value = newmode & uint32(m_S_IRWXG1) >> int32(3)
  11264. goto common
  11265. _4:
  11266. ;
  11267. value = newmode & uint32(m_S_IRWXO1)
  11268. goto common
  11269. common:
  11270. ;
  11271. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_CLR) != 0 {
  11272. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_SET) != 0 {
  11273. v11 = uint32(m_S_IRWXO1)
  11274. } else {
  11275. v11 = value
  11276. }
  11277. clrval = v11
  11278. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_UBITS) != 0 {
  11279. newmode &= ^(clrval << libc.Int32FromInt32(6) & (*TBITCMD)(unsafe.Pointer(set)).Fbits)
  11280. }
  11281. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_GBITS) != 0 {
  11282. newmode &= ^(clrval << libc.Int32FromInt32(3) & (*TBITCMD)(unsafe.Pointer(set)).Fbits)
  11283. }
  11284. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_OBITS) != 0 {
  11285. newmode &= ^(clrval & (*TBITCMD)(unsafe.Pointer(set)).Fbits)
  11286. }
  11287. }
  11288. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_SET) != 0 {
  11289. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_UBITS) != 0 {
  11290. newmode |= value << libc.Int32FromInt32(6) & (*TBITCMD)(unsafe.Pointer(set)).Fbits
  11291. }
  11292. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_GBITS) != 0 {
  11293. newmode |= value << libc.Int32FromInt32(3) & (*TBITCMD)(unsafe.Pointer(set)).Fbits
  11294. }
  11295. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_OBITS) != 0 {
  11296. newmode |= value & (*TBITCMD)(unsafe.Pointer(set)).Fbits
  11297. }
  11298. }
  11299. goto _10
  11300. _5:
  11301. ;
  11302. newmode |= (*TBITCMD)(unsafe.Pointer(set)).Fbits
  11303. goto _10
  11304. _6:
  11305. ;
  11306. newmode &= ^(*TBITCMD)(unsafe.Pointer(set)).Fbits
  11307. goto _10
  11308. _7:
  11309. ;
  11310. 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 {
  11311. newmode |= (*TBITCMD)(unsafe.Pointer(set)).Fbits
  11312. }
  11313. goto _10
  11314. _9:
  11315. ;
  11316. _8:
  11317. ;
  11318. return newmode
  11319. _10:
  11320. ;
  11321. goto _1
  11322. _1:
  11323. ;
  11324. set += 8
  11325. }
  11326. return r
  11327. }
  11328. func Xsetmode(tls *libc.TLS, p uintptr) (r uintptr) {
  11329. bp := tls.Alloc(272)
  11330. defer tls.Free(272)
  11331. var endset, newset, newset1, newset2, newset3, newset4, newset5, saveset, set, v5 uintptr
  11332. var equalopdone, serrno, setlen int32
  11333. var lval int64
  11334. var mask, perm, permXbits, who, v1 Tmode_t
  11335. var op, v4 uint8
  11336. var _ /* ep at bp+0 */ uintptr
  11337. var _ /* signset at bp+8 */ Tsigset_t
  11338. var _ /* sigoset at bp+136 */ Tsigset_t
  11339. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = endset, equalopdone, lval, mask, newset, newset1, newset2, newset3, newset4, newset5, op, perm, permXbits, saveset, serrno, set, setlen, who, v1, v4, v5
  11340. equalopdone = 0
  11341. if !(*(*uint8)(unsafe.Pointer(p)) != 0) {
  11342. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11343. return libc.UintptrFromInt32(0)
  11344. }
  11345. /*
  11346. * Get a copy of the mask for the permissions that are mask relative.
  11347. * Flip the bits, we want what's not set. Since it's possible that
  11348. * the caller is opening files inside a signal handler, protect them
  11349. * as best we can.
  11350. */
  11351. libc.Xsigfillset(tls, bp+8)
  11352. libc.Xsigprocmask(tls, m_SIG_BLOCK, bp+8, bp+136)
  11353. v1 = libc.Xumask(tls, uint32(0))
  11354. mask = v1
  11355. libc.Xumask(tls, v1)
  11356. mask = ^mask
  11357. libc.Xsigprocmask(tls, int32(m_SIG_SETMASK), bp+136, libc.UintptrFromInt32(0))
  11358. setlen = libc.Int32FromInt32(m_SET_LEN) + libc.Int32FromInt32(2)
  11359. set = Xreallocarray(tls, libc.UintptrFromInt32(0), libc.Uint64FromInt32(setlen), uint64(8))
  11360. if set == libc.UintptrFromInt32(0) {
  11361. return libc.UintptrFromInt32(0)
  11362. }
  11363. saveset = set
  11364. endset = set + uintptr(setlen-libc.Int32FromInt32(2))*8
  11365. /*
  11366. * If an absolute number, get it and return; disallow non-octal digits
  11367. * or illegal bits.
  11368. */
  11369. if libc.BoolInt32(uint32(*(*uint8)(unsafe.Pointer(p)))-uint32('0') < uint32(10)) != 0 {
  11370. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  11371. lval = libc.Xstrtol(tls, p, bp, int32(8))
  11372. if *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))) != 0 {
  11373. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11374. goto out
  11375. }
  11376. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_ERANGE) && (lval == int64(0x7fffffffffffffff) || lval == -libc.Int64FromInt64(0x7fffffffffffffff)-libc.Int64FromInt32(1)) {
  11377. goto out
  11378. }
  11379. 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 {
  11380. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11381. goto out
  11382. }
  11383. perm = libc.Uint32FromInt64(lval)
  11384. if set >= endset {
  11385. setlen += int32(m_SET_LEN_INCR)
  11386. newset = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  11387. if newset == libc.UintptrFromInt32(0) {
  11388. goto out
  11389. }
  11390. set = newset + uintptr((int64(set)-int64(saveset))/8)*8
  11391. saveset = newset
  11392. endset = newset + uintptr(setlen-libc.Int32FromInt32(2))*8
  11393. }
  11394. 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)
  11395. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8(0)
  11396. return saveset
  11397. }
  11398. /*
  11399. * Build list of structures to set/clear/copy bits as described by
  11400. * each clause of the symbolic mode.
  11401. */
  11402. for {
  11403. /* First, find out which bits might be modified. */
  11404. who = uint32(0)
  11405. for {
  11406. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) {
  11407. case int32('a'):
  11408. 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))
  11409. case int32('u'):
  11410. who |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_ISUID1) | libc.Int32FromInt32(m_S_IRWXU1))
  11411. case int32('g'):
  11412. who |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_ISGID1) | libc.Int32FromInt32(m_S_IRWXG1))
  11413. case int32('o'):
  11414. who |= uint32(m_S_IRWXO1)
  11415. default:
  11416. goto getop
  11417. }
  11418. goto _3
  11419. _3:
  11420. ;
  11421. p++
  11422. }
  11423. goto getop
  11424. getop:
  11425. ;
  11426. v5 = p
  11427. p++
  11428. v4 = *(*uint8)(unsafe.Pointer(v5))
  11429. op = v4
  11430. if libc.Int32FromUint8(v4) != int32('+') && libc.Int32FromUint8(op) != int32('-') && libc.Int32FromUint8(op) != int32('=') {
  11431. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11432. goto out
  11433. }
  11434. if libc.Int32FromUint8(op) == int32('=') {
  11435. equalopdone = 0
  11436. }
  11437. who &= libc.Uint32FromInt32(^libc.Int32FromInt32(m_S_ISVTX1))
  11438. perm = uint32(0)
  11439. permXbits = libc.Uint32FromInt32(0)
  11440. for {
  11441. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) {
  11442. case int32('r'):
  11443. perm |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IRUSR1) | libc.Int32FromInt32(m_S_IRGRP1) | libc.Int32FromInt32(m_S_IROTH1))
  11444. case int32('s'):
  11445. /*
  11446. * If specific bits where requested and
  11447. * only "other" bits ignore set-id.
  11448. */
  11449. if who == uint32(0) || who&libc.Uint32FromInt32(^libc.Int32FromInt32(m_S_IRWXO1)) != 0 {
  11450. perm |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_ISUID1) | libc.Int32FromInt32(m_S_ISGID1))
  11451. }
  11452. case int32('t'):
  11453. /*
  11454. * If specific bits where requested and
  11455. * only "other" bits ignore set-id.
  11456. */
  11457. if who == uint32(0) || who&libc.Uint32FromInt32(^libc.Int32FromInt32(m_S_IRWXO1)) != 0 {
  11458. who |= uint32(m_S_ISVTX1)
  11459. perm |= uint32(m_S_ISVTX1)
  11460. }
  11461. case int32('w'):
  11462. perm |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IWUSR1) | libc.Int32FromInt32(m_S_IWGRP1) | libc.Int32FromInt32(m_S_IWOTH1))
  11463. case int32('X'):
  11464. permXbits = libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXUSR1) | libc.Int32FromInt32(m_S_IXGRP1) | libc.Int32FromInt32(m_S_IXOTH1))
  11465. case int32('x'):
  11466. perm |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXUSR1) | libc.Int32FromInt32(m_S_IXGRP1) | libc.Int32FromInt32(m_S_IXOTH1))
  11467. case int32('u'):
  11468. fallthrough
  11469. case int32('g'):
  11470. fallthrough
  11471. case int32('o'):
  11472. /*
  11473. * When ever we hit 'u', 'g', or 'o', we have
  11474. * to flush out any partial mode that we have,
  11475. * and then do the copying of the mode bits.
  11476. */
  11477. if perm != 0 {
  11478. if set >= endset {
  11479. setlen += int32(m_SET_LEN_INCR)
  11480. newset1 = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  11481. if newset1 == libc.UintptrFromInt32(0) {
  11482. goto out
  11483. }
  11484. set = newset1 + uintptr((int64(set)-int64(saveset))/8)*8
  11485. saveset = newset1
  11486. endset = newset1 + uintptr(setlen-libc.Int32FromInt32(2))*8
  11487. }
  11488. set = _addcmd(tls, set, uint32(op), who, perm, mask)
  11489. perm = uint32(0)
  11490. }
  11491. if libc.Int32FromUint8(op) == int32('=') {
  11492. equalopdone = int32(1)
  11493. }
  11494. if libc.Int32FromUint8(op) == int32('+') && permXbits != 0 {
  11495. if set >= endset {
  11496. setlen += int32(m_SET_LEN_INCR)
  11497. newset2 = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  11498. if newset2 == libc.UintptrFromInt32(0) {
  11499. goto out
  11500. }
  11501. set = newset2 + uintptr((int64(set)-int64(saveset))/8)*8
  11502. saveset = newset2
  11503. endset = newset2 + uintptr(setlen-libc.Int32FromInt32(2))*8
  11504. }
  11505. set = _addcmd(tls, set, libc.Uint32FromInt32(libc.Int32FromUint8('X')), who, permXbits, mask)
  11506. permXbits = uint32(0)
  11507. }
  11508. if set >= endset {
  11509. setlen += int32(m_SET_LEN_INCR)
  11510. newset3 = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  11511. if newset3 == libc.UintptrFromInt32(0) {
  11512. goto out
  11513. }
  11514. set = newset3 + uintptr((int64(set)-int64(saveset))/8)*8
  11515. saveset = newset3
  11516. endset = newset3 + uintptr(setlen-libc.Int32FromInt32(2))*8
  11517. }
  11518. set = _addcmd(tls, set, uint32(*(*uint8)(unsafe.Pointer(p))), who, uint32(op), mask)
  11519. default:
  11520. /*
  11521. * Add any permissions that we haven't already
  11522. * done.
  11523. */
  11524. if perm != 0 || libc.Int32FromUint8(op) == int32('=') && !(equalopdone != 0) {
  11525. if libc.Int32FromUint8(op) == int32('=') {
  11526. equalopdone = int32(1)
  11527. }
  11528. if set >= endset {
  11529. setlen += int32(m_SET_LEN_INCR)
  11530. newset4 = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  11531. if newset4 == libc.UintptrFromInt32(0) {
  11532. goto out
  11533. }
  11534. set = newset4 + uintptr((int64(set)-int64(saveset))/8)*8
  11535. saveset = newset4
  11536. endset = newset4 + uintptr(setlen-libc.Int32FromInt32(2))*8
  11537. }
  11538. set = _addcmd(tls, set, uint32(op), who, perm, mask)
  11539. perm = uint32(0)
  11540. }
  11541. if permXbits != 0 {
  11542. if set >= endset {
  11543. setlen += int32(m_SET_LEN_INCR)
  11544. newset5 = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  11545. if newset5 == libc.UintptrFromInt32(0) {
  11546. goto out
  11547. }
  11548. set = newset5 + uintptr((int64(set)-int64(saveset))/8)*8
  11549. saveset = newset5
  11550. endset = newset5 + uintptr(setlen-libc.Int32FromInt32(2))*8
  11551. }
  11552. set = _addcmd(tls, set, libc.Uint32FromInt32(libc.Int32FromUint8('X')), who, permXbits, mask)
  11553. permXbits = uint32(0)
  11554. }
  11555. goto apply
  11556. }
  11557. goto _6
  11558. _6:
  11559. ;
  11560. p++
  11561. }
  11562. goto apply
  11563. apply:
  11564. ;
  11565. if !(*(*uint8)(unsafe.Pointer(p)) != 0) {
  11566. break
  11567. }
  11568. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) != int32(',') {
  11569. goto getop
  11570. }
  11571. p++
  11572. goto _2
  11573. _2:
  11574. }
  11575. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8(0)
  11576. _compress_mode(tls, saveset)
  11577. return saveset
  11578. goto out
  11579. out:
  11580. ;
  11581. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  11582. libc.Xfree(tls, saveset)
  11583. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  11584. return libc.UintptrFromInt32(0)
  11585. }
  11586. func _addcmd(tls *libc.TLS, set uintptr, op Tmode_t, who Tmode_t, oparg Tmode_t, mask Tmode_t) (r uintptr) {
  11587. var v1, v2 uint32
  11588. var v3, v4, v5 int32
  11589. var p6, p7, p8 uintptr
  11590. _, _, _, _, _, _, _, _ = v1, v2, v3, v4, v5, p6, p7, p8
  11591. switch op {
  11592. case uint32('='):
  11593. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8('-')
  11594. if who != 0 {
  11595. v1 = who
  11596. } else {
  11597. 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))
  11598. }
  11599. (*TBITCMD)(unsafe.Pointer(set)).Fbits = v1
  11600. set += 8
  11601. op = uint32('+')
  11602. /* FALLTHROUGH */
  11603. fallthrough
  11604. case uint32('+'):
  11605. fallthrough
  11606. case uint32('-'):
  11607. fallthrough
  11608. case uint32('X'):
  11609. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8(op)
  11610. if who != 0 {
  11611. v2 = who
  11612. } else {
  11613. v2 = mask
  11614. }
  11615. (*TBITCMD)(unsafe.Pointer(set)).Fbits = v2 & oparg
  11616. case uint32('u'):
  11617. fallthrough
  11618. case uint32('g'):
  11619. fallthrough
  11620. case uint32('o'):
  11621. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8(op)
  11622. if who != 0 {
  11623. if who&uint32(m_S_IRUSR1) != 0 {
  11624. v3 = int32(m_CMD2_UBITS)
  11625. } else {
  11626. v3 = 0
  11627. }
  11628. if who&uint32(m_S_IRGRP1) != 0 {
  11629. v4 = int32(m_CMD2_GBITS)
  11630. } else {
  11631. v4 = 0
  11632. }
  11633. if who&uint32(m_S_IROTH1) != 0 {
  11634. v5 = int32(m_CMD2_OBITS)
  11635. } else {
  11636. v5 = 0
  11637. }
  11638. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = libc.Uint8FromInt32(v3 | v4 | v5)
  11639. (*TBITCMD)(unsafe.Pointer(set)).Fbits = libc.Uint32FromInt32(^libc.Int32FromInt32(0))
  11640. } else {
  11641. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = libc.Uint8FromInt32(libc.Int32FromInt32(m_CMD2_UBITS) | libc.Int32FromInt32(m_CMD2_GBITS) | libc.Int32FromInt32(m_CMD2_OBITS))
  11642. (*TBITCMD)(unsafe.Pointer(set)).Fbits = mask
  11643. }
  11644. if oparg == uint32('+') {
  11645. p6 = set + 1
  11646. *(*uint8)(unsafe.Pointer(p6)) = uint8(int32(*(*uint8)(unsafe.Pointer(p6))) | libc.Int32FromInt32(m_CMD2_SET))
  11647. } else {
  11648. if oparg == uint32('-') {
  11649. p7 = set + 1
  11650. *(*uint8)(unsafe.Pointer(p7)) = uint8(int32(*(*uint8)(unsafe.Pointer(p7))) | libc.Int32FromInt32(m_CMD2_CLR))
  11651. } else {
  11652. if oparg == uint32('=') {
  11653. p8 = set + 1
  11654. *(*uint8)(unsafe.Pointer(p8)) = uint8(int32(*(*uint8)(unsafe.Pointer(p8))) | (libc.Int32FromInt32(m_CMD2_SET) | libc.Int32FromInt32(m_CMD2_CLR)))
  11655. }
  11656. }
  11657. }
  11658. break
  11659. }
  11660. return set + libc.UintptrFromInt32(1)*8
  11661. }
  11662. // C documentation
  11663. //
  11664. // /*
  11665. // * Given an array of bitcmd structures, compress by compacting consecutive
  11666. // * '+', '-' and 'X' commands into at most 3 commands, one of each. The 'u',
  11667. // * 'g' and 'o' commands continue to be separate. They could probably be
  11668. // * compacted, but it's not worth the effort.
  11669. // */
  11670. func _compress_mode(tls *libc.TLS, set uintptr) {
  11671. var Xbits, clrbits, op, setbits, v2, v6, v7, v8 int32
  11672. var nset, v3, v4 uintptr
  11673. _, _, _, _, _, _, _, _, _, _, _ = Xbits, clrbits, nset, op, setbits, v2, v3, v4, v6, v7, v8
  11674. nset = set
  11675. for {
  11676. /* Copy over any 'u', 'g' and 'o' commands. */
  11677. for {
  11678. v2 = libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(nset)).Fcmd)
  11679. op = v2
  11680. if !(v2 != int32('+') && op != int32('-') && op != int32('X')) {
  11681. break
  11682. }
  11683. v3 = set
  11684. set += 8
  11685. v4 = nset
  11686. nset += 8
  11687. *(*TBITCMD)(unsafe.Pointer(v3)) = *(*TBITCMD)(unsafe.Pointer(v4))
  11688. if !(op != 0) {
  11689. return
  11690. }
  11691. }
  11692. v7 = libc.Int32FromInt32(0)
  11693. Xbits = v7
  11694. v6 = v7
  11695. clrbits = v6
  11696. setbits = v6
  11697. for {
  11698. v8 = libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(nset)).Fcmd)
  11699. op = v8
  11700. if v8 == int32('-') {
  11701. clrbits = int32(uint32(clrbits) | (*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  11702. setbits = int32(uint32(setbits) & ^(*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  11703. Xbits = int32(uint32(Xbits) & ^(*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  11704. } else {
  11705. if op == int32('+') {
  11706. setbits = int32(uint32(setbits) | (*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  11707. clrbits = int32(uint32(clrbits) & ^(*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  11708. Xbits = int32(uint32(Xbits) & ^(*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  11709. } else {
  11710. if op == int32('X') {
  11711. Xbits = int32(uint32(Xbits) | (*TBITCMD)(unsafe.Pointer(nset)).Fbits&libc.Uint32FromInt32(^setbits))
  11712. } else {
  11713. break
  11714. }
  11715. }
  11716. }
  11717. goto _5
  11718. _5:
  11719. ;
  11720. nset += 8
  11721. }
  11722. if clrbits != 0 {
  11723. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8('-')
  11724. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = uint8(0)
  11725. (*TBITCMD)(unsafe.Pointer(set)).Fbits = libc.Uint32FromInt32(clrbits)
  11726. set += 8
  11727. }
  11728. if setbits != 0 {
  11729. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8('+')
  11730. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = uint8(0)
  11731. (*TBITCMD)(unsafe.Pointer(set)).Fbits = libc.Uint32FromInt32(setbits)
  11732. set += 8
  11733. }
  11734. if Xbits != 0 {
  11735. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8('X')
  11736. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = uint8(0)
  11737. (*TBITCMD)(unsafe.Pointer(set)).Fbits = libc.Uint32FromInt32(Xbits)
  11738. set += 8
  11739. }
  11740. goto _1
  11741. _1:
  11742. }
  11743. }
  11744. const m_SPT_MAXTITLE = 255
  11745. const m_S_IFDIR2 = 0040000
  11746. const m_S_IRGRP2 = 0040
  11747. const m_S_IROTH2 = 0004
  11748. const m_S_IRUSR2 = 0400
  11749. const m_S_IRWXG2 = 0070
  11750. const m_S_IRWXO2 = 0007
  11751. const m_S_IRWXU2 = 0700
  11752. const m_S_ISGID2 = 02000
  11753. const m_S_ISUID2 = 04000
  11754. const m_S_ISVTX2 = 01000
  11755. const m_S_IWGRP2 = 0020
  11756. const m_S_IWOTH2 = 0002
  11757. const m_S_IWUSR2 = 0200
  11758. const m_S_IXGRP2 = 0010
  11759. const m_S_IXOTH2 = 0001
  11760. const m_S_IXUSR2 = 0100
  11761. const m___LONG_MAX2 = 0x7fffffffffffffff
  11762. const m___bool_true_false_are_defined = 1
  11763. const m_bool = "_Bool"
  11764. const m_false = 0
  11765. const m_true = 1
  11766. /*
  11767. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  11768. *
  11769. * Redistribution and use in source and binary forms, with or without
  11770. * modification, are permitted provided that the following conditions
  11771. * are met:
  11772. * 1. Redistributions of source code must retain the above copyright
  11773. * notice, this list of conditions and the following disclaimer.
  11774. * 2. Redistributions in binary form must reproduce the above copyright
  11775. * notice, this list of conditions and the following disclaimer in the
  11776. * documentation and/or other materials provided with the distribution.
  11777. * 3. The name of the author may not be used to endorse or promote products
  11778. * derived from this software without specific prior written permission.
  11779. *
  11780. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  11781. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  11782. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  11783. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  11784. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  11785. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  11786. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  11787. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  11788. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  11789. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  11790. */
  11791. var _SPT struct {
  11792. Farg0 uintptr
  11793. Fbase uintptr
  11794. Fend uintptr
  11795. Fnul uintptr
  11796. Fwarned uint8
  11797. Freset uint8
  11798. Ferror1 int32
  11799. }
  11800. func _spt_min(tls *libc.TLS, a Tsize_t, b Tsize_t) (r Tsize_t) {
  11801. var v1 uint64
  11802. _ = v1
  11803. if a < b {
  11804. v1 = a
  11805. } else {
  11806. v1 = b
  11807. }
  11808. return v1
  11809. }
  11810. // C documentation
  11811. //
  11812. // /*
  11813. // * For discussion on the portability of the various methods, see
  11814. // * https://lists.freebsd.org/pipermail/freebsd-stable/2008-June/043136.html
  11815. // */
  11816. func _spt_clearenv(tls *libc.TLS) (r int32) {
  11817. return libc.Xclearenv(tls)
  11818. }
  11819. func _spt_copyenv(tls *libc.TLS, envc int32, envp uintptr) (r int32) {
  11820. var envcopy, eq uintptr
  11821. var envsize, error1, i int32
  11822. _, _, _, _, _ = envcopy, envsize, eq, error1, i
  11823. if libc.Xenviron != envp {
  11824. return 0
  11825. }
  11826. /* Make a copy of the old environ array of pointers, in case
  11827. * clearenv() or setenv() is implemented to free the internal
  11828. * environ array, because we will need to access the old environ
  11829. * contents to make the new copy. */
  11830. envsize = libc.Int32FromUint64(libc.Uint64FromInt32(envc+libc.Int32FromInt32(1)) * uint64(8))
  11831. envcopy = libc.Xmalloc(tls, libc.Uint64FromInt32(envsize))
  11832. if envcopy == libc.UintptrFromInt32(0) {
  11833. return *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  11834. }
  11835. libc.Xmemcpy(tls, envcopy, envp, libc.Uint64FromInt32(envsize))
  11836. error1 = _spt_clearenv(tls)
  11837. if error1 != 0 {
  11838. libc.Xenviron = envp
  11839. libc.Xfree(tls, envcopy)
  11840. return error1
  11841. }
  11842. i = 0
  11843. for {
  11844. if !(*(*uintptr)(unsafe.Pointer(envcopy + uintptr(i)*8)) != 0) {
  11845. break
  11846. }
  11847. eq = libc.Xstrchr(tls, *(*uintptr)(unsafe.Pointer(envcopy + uintptr(i)*8)), int32('='))
  11848. if eq == libc.UintptrFromInt32(0) {
  11849. goto _1
  11850. }
  11851. *(*uint8)(unsafe.Pointer(eq)) = uint8('\000')
  11852. if libc.Xsetenv(tls, *(*uintptr)(unsafe.Pointer(envcopy + uintptr(i)*8)), eq+uintptr(1), int32(1)) < 0 {
  11853. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  11854. }
  11855. *(*uint8)(unsafe.Pointer(eq)) = uint8('=')
  11856. if error1 != 0 {
  11857. /* Because the old environ might not be available
  11858. * anymore we will make do with the shallow copy. */
  11859. libc.Xenviron = envcopy
  11860. return error1
  11861. }
  11862. goto _1
  11863. _1:
  11864. ;
  11865. i++
  11866. }
  11867. /* Dispose of the shallow copy, now that we've finished transfering
  11868. * the old environment. */
  11869. libc.Xfree(tls, envcopy)
  11870. return 0
  11871. }
  11872. func _spt_copyargs(tls *libc.TLS, argc int32, argv uintptr) (r int32) {
  11873. var i int32
  11874. var tmp uintptr
  11875. _, _ = i, tmp
  11876. i = int32(1)
  11877. for {
  11878. if !(i < argc || i >= argc && *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) != 0) {
  11879. break
  11880. }
  11881. if *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) == libc.UintptrFromInt32(0) {
  11882. goto _1
  11883. }
  11884. tmp = libc.Xstrdup(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))
  11885. if tmp == libc.UintptrFromInt32(0) {
  11886. return *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  11887. }
  11888. *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) = tmp
  11889. goto _1
  11890. _1:
  11891. ;
  11892. i++
  11893. }
  11894. return 0
  11895. }
  11896. func Xsetproctitle_init(tls *libc.TLS, argc int32, argv uintptr, envp uintptr) {
  11897. var base, end, nul, tmp uintptr
  11898. var envc, error1, i int32
  11899. _, _, _, _, _, _, _ = base, end, envc, error1, i, nul, tmp
  11900. /* Try to make sure we got called with main() arguments. */
  11901. if argc < 0 {
  11902. return
  11903. }
  11904. base = *(*uintptr)(unsafe.Pointer(argv))
  11905. if base == libc.UintptrFromInt32(0) {
  11906. return
  11907. }
  11908. nul = base + uintptr(libc.Xstrlen(tls, base))
  11909. end = nul + uintptr(1)
  11910. i = 0
  11911. for {
  11912. if !(i < argc || i >= argc && *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) != 0) {
  11913. break
  11914. }
  11915. if *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) == libc.UintptrFromInt32(0) || *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) != end {
  11916. goto _1
  11917. }
  11918. end = *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) + uintptr(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))) + uintptr(1)
  11919. goto _1
  11920. _1:
  11921. ;
  11922. i++
  11923. }
  11924. i = 0
  11925. for {
  11926. if !(*(*uintptr)(unsafe.Pointer(envp + uintptr(i)*8)) != 0) {
  11927. break
  11928. }
  11929. if *(*uintptr)(unsafe.Pointer(envp + uintptr(i)*8)) != end {
  11930. goto _2
  11931. }
  11932. end = *(*uintptr)(unsafe.Pointer(envp + uintptr(i)*8)) + uintptr(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(envp + uintptr(i)*8)))) + uintptr(1)
  11933. goto _2
  11934. _2:
  11935. ;
  11936. i++
  11937. }
  11938. envc = i
  11939. _SPT.Farg0 = libc.Xstrdup(tls, *(*uintptr)(unsafe.Pointer(argv)))
  11940. if _SPT.Farg0 == libc.UintptrFromInt32(0) {
  11941. _SPT.Ferror1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  11942. return
  11943. }
  11944. tmp = libc.Xstrdup(tls, Xgetprogname(tls))
  11945. if tmp == libc.UintptrFromInt32(0) {
  11946. _SPT.Ferror1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  11947. return
  11948. }
  11949. Xsetprogname(tls, tmp)
  11950. error1 = _spt_copyenv(tls, envc, envp)
  11951. if error1 != 0 {
  11952. _SPT.Ferror1 = error1
  11953. return
  11954. }
  11955. error1 = _spt_copyargs(tls, argc, argv)
  11956. if error1 != 0 {
  11957. _SPT.Ferror1 = error1
  11958. return
  11959. }
  11960. _SPT.Fnul = nul
  11961. _SPT.Fbase = base
  11962. _SPT.Fend = end
  11963. }
  11964. func Xsetproctitle_impl(tls *libc.TLS, fmt uintptr, va uintptr) {
  11965. bp := tls.Alloc(272)
  11966. defer tls.Free(272)
  11967. var ap Tva_list
  11968. var len1 int32
  11969. var nul, v1 uintptr
  11970. var _ /* buf at bp+0 */ [256]uint8
  11971. _, _, _, _ = ap, len1, nul, v1
  11972. if _SPT.Fbase == libc.UintptrFromInt32(0) {
  11973. if !(_SPT.Fwarned != 0) {
  11974. libc.Xwarnx(tls, __ccgo_ts+472, 0)
  11975. _SPT.Fwarned = uint8(m_true)
  11976. }
  11977. return
  11978. }
  11979. if fmt != 0 {
  11980. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(fmt))) == int32('-') {
  11981. /* Skip program name prefix. */
  11982. fmt++
  11983. len1 = 0
  11984. } else {
  11985. /* Print program name heading for grep. */
  11986. libc.X__builtin_snprintf(tls, bp, uint64(256), __ccgo_ts+14, libc.VaList(bp+264, Xgetprogname(tls)))
  11987. len1 = libc.Int32FromUint64(libc.Xstrlen(tls, bp))
  11988. }
  11989. ap = va
  11990. len1 += libc.X__builtin_vsnprintf(tls, bp+uintptr(len1), uint64(256)-libc.Uint64FromInt32(len1), fmt, ap)
  11991. _ = ap
  11992. } else {
  11993. len1 = libc.X__builtin_snprintf(tls, bp, uint64(256), __ccgo_ts+570, libc.VaList(bp+264, _SPT.Farg0))
  11994. }
  11995. if len1 <= 0 {
  11996. _SPT.Ferror1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  11997. return
  11998. }
  11999. if !(_SPT.Freset != 0) {
  12000. libc.Xmemset(tls, _SPT.Fbase, 0, libc.Uint64FromInt64(int64(_SPT.Fend)-int64(_SPT.Fbase)))
  12001. _SPT.Freset = uint8(m_true)
  12002. } else {
  12003. libc.Xmemset(tls, _SPT.Fbase, 0, _spt_min(tls, uint64(256), libc.Uint64FromInt64(int64(_SPT.Fend)-int64(_SPT.Fbase))))
  12004. }
  12005. len1 = libc.Int32FromUint64(_spt_min(tls, libc.Uint64FromInt32(len1), _spt_min(tls, uint64(256), libc.Uint64FromInt64(int64(_SPT.Fend)-int64(_SPT.Fbase)))-uint64(1)))
  12006. libc.Xmemcpy(tls, _SPT.Fbase, bp, libc.Uint64FromInt32(len1))
  12007. nul = _SPT.Fbase + uintptr(len1)
  12008. if nul < _SPT.Fnul {
  12009. *(*uint8)(unsafe.Pointer(_SPT.Fnul)) = uint8('.')
  12010. } else {
  12011. if nul == _SPT.Fnul && nul+1 < _SPT.Fend {
  12012. *(*uint8)(unsafe.Pointer(_SPT.Fnul)) = uint8(' ')
  12013. nul++
  12014. v1 = nul
  12015. *(*uint8)(unsafe.Pointer(v1)) = uint8('\000')
  12016. }
  12017. }
  12018. }
  12019. // C documentation
  12020. //
  12021. // /*
  12022. // * Appends src to string dst of size dsize (unlike strncat, dsize is the
  12023. // * full size of dst, not space left). At most dsize-1 characters
  12024. // * will be copied. Always NUL terminates (unless dsize <= strlen(dst)).
  12025. // * Returns strlen(src) + MIN(dsize, strlen(initial dst)).
  12026. // * If retval >= dsize, truncation occurred.
  12027. // */
  12028. func Xstrlcat(tls *libc.TLS, dst uintptr, src uintptr, dsize Tsize_t) (r Tsize_t) {
  12029. var dlen, n, v1, v2 Tsize_t
  12030. var odst, osrc, v3 uintptr
  12031. _, _, _, _, _, _, _ = dlen, n, odst, osrc, v1, v2, v3
  12032. odst = dst
  12033. osrc = src
  12034. n = dsize
  12035. /* Find the end of dst and adjust bytes left but don't go past end. */
  12036. for {
  12037. v1 = n
  12038. n--
  12039. if !(v1 != uint64(0) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(dst))) != int32('\000')) {
  12040. break
  12041. }
  12042. dst++
  12043. }
  12044. dlen = libc.Uint64FromInt64(int64(dst) - int64(odst))
  12045. n = dsize - dlen
  12046. v2 = n
  12047. n--
  12048. if v2 == uint64(0) {
  12049. return dlen + libc.Xstrlen(tls, src)
  12050. }
  12051. for libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(src))) != int32('\000') {
  12052. if n != uint64(0) {
  12053. v3 = dst
  12054. dst++
  12055. *(*uint8)(unsafe.Pointer(v3)) = *(*uint8)(unsafe.Pointer(src))
  12056. n--
  12057. }
  12058. src++
  12059. }
  12060. *(*uint8)(unsafe.Pointer(dst)) = uint8('\000')
  12061. return dlen + libc.Uint64FromInt64(int64(src)-int64(osrc)) /* count does not include NUL */
  12062. }
  12063. // C documentation
  12064. //
  12065. // /*
  12066. // * Copy string src to buffer dst of size dsize. At most dsize-1
  12067. // * chars will be copied. Always NUL terminates (unless dsize == 0).
  12068. // * Returns strlen(src); if retval >= dsize, truncation occurred.
  12069. // */
  12070. func Xstrlcpy(tls *libc.TLS, dst uintptr, src uintptr, dsize Tsize_t) (r Tsize_t) {
  12071. var nleft, v1 Tsize_t
  12072. var osrc, v3, v4, v5 uintptr
  12073. var v2 uint8
  12074. _, _, _, _, _, _, _ = nleft, osrc, v1, v2, v3, v4, v5
  12075. osrc = src
  12076. nleft = dsize
  12077. /* Copy as many bytes as will fit. */
  12078. if nleft != uint64(0) {
  12079. for {
  12080. nleft--
  12081. v1 = nleft
  12082. if !(v1 != uint64(0)) {
  12083. break
  12084. }
  12085. v3 = src
  12086. src++
  12087. v2 = *(*uint8)(unsafe.Pointer(v3))
  12088. v4 = dst
  12089. dst++
  12090. *(*uint8)(unsafe.Pointer(v4)) = v2
  12091. if libc.Int32FromUint8(v2) == int32('\000') {
  12092. break
  12093. }
  12094. }
  12095. }
  12096. /* Not enough room in dst, add NUL and traverse rest of src. */
  12097. if nleft == uint64(0) {
  12098. if dsize != uint64(0) {
  12099. *(*uint8)(unsafe.Pointer(dst)) = uint8('\000')
  12100. } /* NUL-terminate dst */
  12101. for {
  12102. v5 = src
  12103. src++
  12104. if !(*(*uint8)(unsafe.Pointer(v5)) != 0) {
  12105. break
  12106. }
  12107. }
  12108. }
  12109. return libc.Uint64FromInt64(int64(src) - int64(osrc) - libc.Int64FromInt32(1)) /* count does not include NUL */
  12110. }
  12111. const m__SL_CHUNKSIZE = 20
  12112. type TStringList = struct {
  12113. Fsl_str uintptr
  12114. Fsl_max Tsize_t
  12115. Fsl_cur Tsize_t
  12116. }
  12117. type T_stringlist = TStringList
  12118. // C documentation
  12119. //
  12120. // /*
  12121. // * sl_init(): Initialize a string list
  12122. // */
  12123. func Xsl_init(tls *libc.TLS) (r uintptr) {
  12124. var sl uintptr
  12125. _ = sl
  12126. sl = libc.Xmalloc(tls, uint64(24))
  12127. if sl == libc.UintptrFromInt32(0) {
  12128. return libc.UintptrFromInt32(0)
  12129. }
  12130. (*TStringList)(unsafe.Pointer(sl)).Fsl_cur = uint64(0)
  12131. (*TStringList)(unsafe.Pointer(sl)).Fsl_max = uint64(m__SL_CHUNKSIZE)
  12132. (*TStringList)(unsafe.Pointer(sl)).Fsl_str = Xreallocarray(tls, libc.UintptrFromInt32(0), (*TStringList)(unsafe.Pointer(sl)).Fsl_max, uint64(8))
  12133. if (*TStringList)(unsafe.Pointer(sl)).Fsl_str == libc.UintptrFromInt32(0) {
  12134. libc.Xfree(tls, sl)
  12135. sl = libc.UintptrFromInt32(0)
  12136. }
  12137. return sl
  12138. }
  12139. // C documentation
  12140. //
  12141. // /*
  12142. // * sl_add(): Add an item to the string list
  12143. // */
  12144. func Xsl_add(tls *libc.TLS, sl uintptr, name uintptr) (r int32) {
  12145. var new1, v2 uintptr
  12146. var v1 Tsize_t
  12147. _, _, _ = new1, v1, v2
  12148. if (*TStringList)(unsafe.Pointer(sl)).Fsl_cur == (*TStringList)(unsafe.Pointer(sl)).Fsl_max-uint64(1) {
  12149. new1 = Xreallocarray(tls, (*TStringList)(unsafe.Pointer(sl)).Fsl_str, (*TStringList)(unsafe.Pointer(sl)).Fsl_max+libc.Uint64FromInt32(m__SL_CHUNKSIZE), uint64(8))
  12150. if new1 == libc.UintptrFromInt32(0) {
  12151. return -int32(1)
  12152. }
  12153. *(*Tsize_t)(unsafe.Pointer(sl + 8)) += uint64(m__SL_CHUNKSIZE)
  12154. (*TStringList)(unsafe.Pointer(sl)).Fsl_str = new1
  12155. }
  12156. v2 = sl + 16
  12157. v1 = *(*Tsize_t)(unsafe.Pointer(v2))
  12158. *(*Tsize_t)(unsafe.Pointer(v2))++
  12159. *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(v1)*8)) = name
  12160. return 0
  12161. }
  12162. // C documentation
  12163. //
  12164. // /*
  12165. // * sl_free(): Free a stringlist
  12166. // */
  12167. func Xsl_free(tls *libc.TLS, sl uintptr, all int32) {
  12168. var i Tsize_t
  12169. _ = i
  12170. if sl == libc.UintptrFromInt32(0) {
  12171. return
  12172. }
  12173. if (*TStringList)(unsafe.Pointer(sl)).Fsl_str != 0 {
  12174. if all != 0 {
  12175. i = uint64(0)
  12176. for {
  12177. if !(i < (*TStringList)(unsafe.Pointer(sl)).Fsl_cur) {
  12178. break
  12179. }
  12180. libc.Xfree(tls, *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*8)))
  12181. goto _1
  12182. _1:
  12183. ;
  12184. i++
  12185. }
  12186. }
  12187. libc.Xfree(tls, (*TStringList)(unsafe.Pointer(sl)).Fsl_str)
  12188. }
  12189. libc.Xfree(tls, sl)
  12190. }
  12191. // C documentation
  12192. //
  12193. // /*
  12194. // * sl_find(): Find a name in the string list
  12195. // */
  12196. func Xsl_find(tls *libc.TLS, sl uintptr, name uintptr) (r uintptr) {
  12197. var i Tsize_t
  12198. _ = i
  12199. i = uint64(0)
  12200. for {
  12201. if !(i < (*TStringList)(unsafe.Pointer(sl)).Fsl_cur) {
  12202. break
  12203. }
  12204. if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*8)), name) == 0 {
  12205. return *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*8))
  12206. }
  12207. goto _1
  12208. _1:
  12209. ;
  12210. i++
  12211. }
  12212. return libc.UintptrFromInt32(0)
  12213. }
  12214. func Xsl_delete(tls *libc.TLS, sl uintptr, name uintptr, all int32) (r int32) {
  12215. var i, j, v3 Tsize_t
  12216. var v4 uintptr
  12217. _, _, _, _ = i, j, v3, v4
  12218. i = uint64(0)
  12219. for {
  12220. if !(i < (*TStringList)(unsafe.Pointer(sl)).Fsl_cur) {
  12221. break
  12222. }
  12223. if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*8)), name) == 0 {
  12224. if all != 0 {
  12225. libc.Xfree(tls, *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*8)))
  12226. }
  12227. j = i + uint64(1)
  12228. for {
  12229. if !(j < (*TStringList)(unsafe.Pointer(sl)).Fsl_cur) {
  12230. break
  12231. }
  12232. *(*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))
  12233. goto _2
  12234. _2:
  12235. ;
  12236. j++
  12237. }
  12238. v4 = sl + 16
  12239. *(*Tsize_t)(unsafe.Pointer(v4))--
  12240. v3 = *(*Tsize_t)(unsafe.Pointer(v4))
  12241. *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(v3)*8)) = libc.UintptrFromInt32(0)
  12242. return 0
  12243. }
  12244. goto _1
  12245. _1:
  12246. ;
  12247. i++
  12248. }
  12249. return -int32(1)
  12250. }
  12251. const m_S_IFBLK1 = 24576
  12252. const m_S_IFCHR1 = 8192
  12253. const m_S_IFDIR3 = 16384
  12254. const m_S_IFIFO1 = 4096
  12255. const m_S_IFLNK1 = 40960
  12256. const m_S_IFMT1 = 61440
  12257. const m_S_IFREG1 = 32768
  12258. const m_S_IFSOCK1 = 49152
  12259. const m_S_IRGRP3 = 32
  12260. const m_S_IROTH3 = 4
  12261. const m_S_IRUSR3 = 256
  12262. const m_S_ISGID3 = 1024
  12263. const m_S_ISUID3 = 2048
  12264. const m_S_ISVTX3 = 512
  12265. const m_S_IWGRP3 = 16
  12266. const m_S_IWOTH3 = 2
  12267. const m_S_IWUSR3 = 128
  12268. const m_S_IXGRP3 = 8
  12269. const m_S_IXOTH3 = 1
  12270. const m_S_IXUSR3 = 64
  12271. func Xstrmode(tls *libc.TLS, mode Tmode_t, p uintptr) {
  12272. 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
  12273. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  12274. /* print type */
  12275. switch mode & libc.Uint32FromInt32(m_S_IFMT1) {
  12276. case uint32(m_S_IFDIR3): /* directory */
  12277. v1 = p
  12278. p++
  12279. *(*uint8)(unsafe.Pointer(v1)) = uint8('d')
  12280. case uint32(m_S_IFCHR1): /* character special */
  12281. v2 = p
  12282. p++
  12283. *(*uint8)(unsafe.Pointer(v2)) = uint8('c')
  12284. case uint32(m_S_IFBLK1): /* block special */
  12285. v3 = p
  12286. p++
  12287. *(*uint8)(unsafe.Pointer(v3)) = uint8('b')
  12288. case uint32(m_S_IFREG1): /* regular */
  12289. v4 = p
  12290. p++
  12291. *(*uint8)(unsafe.Pointer(v4)) = uint8('-')
  12292. case uint32(m_S_IFLNK1): /* symbolic link */
  12293. v5 = p
  12294. p++
  12295. *(*uint8)(unsafe.Pointer(v5)) = uint8('l')
  12296. case uint32(m_S_IFSOCK1): /* socket */
  12297. v6 = p
  12298. p++
  12299. *(*uint8)(unsafe.Pointer(v6)) = uint8('s')
  12300. case uint32(m_S_IFIFO1): /* fifo */
  12301. v7 = p
  12302. p++
  12303. *(*uint8)(unsafe.Pointer(v7)) = uint8('p')
  12304. default: /* unknown */
  12305. v8 = p
  12306. p++
  12307. *(*uint8)(unsafe.Pointer(v8)) = uint8('?')
  12308. break
  12309. }
  12310. /* usr */
  12311. if mode&uint32(m_S_IRUSR3) != 0 {
  12312. v9 = p
  12313. p++
  12314. *(*uint8)(unsafe.Pointer(v9)) = uint8('r')
  12315. } else {
  12316. v10 = p
  12317. p++
  12318. *(*uint8)(unsafe.Pointer(v10)) = uint8('-')
  12319. }
  12320. if mode&uint32(m_S_IWUSR3) != 0 {
  12321. v11 = p
  12322. p++
  12323. *(*uint8)(unsafe.Pointer(v11)) = uint8('w')
  12324. } else {
  12325. v12 = p
  12326. p++
  12327. *(*uint8)(unsafe.Pointer(v12)) = uint8('-')
  12328. }
  12329. switch mode & libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXUSR3)|libc.Int32FromInt32(m_S_ISUID3)) {
  12330. case uint32(0):
  12331. v13 = p
  12332. p++
  12333. *(*uint8)(unsafe.Pointer(v13)) = uint8('-')
  12334. case uint32(m_S_IXUSR3):
  12335. v14 = p
  12336. p++
  12337. *(*uint8)(unsafe.Pointer(v14)) = uint8('x')
  12338. case uint32(m_S_ISUID3):
  12339. v15 = p
  12340. p++
  12341. *(*uint8)(unsafe.Pointer(v15)) = uint8('S')
  12342. case libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXUSR3) | libc.Int32FromInt32(m_S_ISUID3)):
  12343. v16 = p
  12344. p++
  12345. *(*uint8)(unsafe.Pointer(v16)) = uint8('s')
  12346. break
  12347. }
  12348. /* group */
  12349. if mode&uint32(m_S_IRGRP3) != 0 {
  12350. v17 = p
  12351. p++
  12352. *(*uint8)(unsafe.Pointer(v17)) = uint8('r')
  12353. } else {
  12354. v18 = p
  12355. p++
  12356. *(*uint8)(unsafe.Pointer(v18)) = uint8('-')
  12357. }
  12358. if mode&uint32(m_S_IWGRP3) != 0 {
  12359. v19 = p
  12360. p++
  12361. *(*uint8)(unsafe.Pointer(v19)) = uint8('w')
  12362. } else {
  12363. v20 = p
  12364. p++
  12365. *(*uint8)(unsafe.Pointer(v20)) = uint8('-')
  12366. }
  12367. switch mode & libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXGRP3)|libc.Int32FromInt32(m_S_ISGID3)) {
  12368. case uint32(0):
  12369. v21 = p
  12370. p++
  12371. *(*uint8)(unsafe.Pointer(v21)) = uint8('-')
  12372. case uint32(m_S_IXGRP3):
  12373. v22 = p
  12374. p++
  12375. *(*uint8)(unsafe.Pointer(v22)) = uint8('x')
  12376. case uint32(m_S_ISGID3):
  12377. v23 = p
  12378. p++
  12379. *(*uint8)(unsafe.Pointer(v23)) = uint8('S')
  12380. case libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXGRP3) | libc.Int32FromInt32(m_S_ISGID3)):
  12381. v24 = p
  12382. p++
  12383. *(*uint8)(unsafe.Pointer(v24)) = uint8('s')
  12384. break
  12385. }
  12386. /* other */
  12387. if mode&uint32(m_S_IROTH3) != 0 {
  12388. v25 = p
  12389. p++
  12390. *(*uint8)(unsafe.Pointer(v25)) = uint8('r')
  12391. } else {
  12392. v26 = p
  12393. p++
  12394. *(*uint8)(unsafe.Pointer(v26)) = uint8('-')
  12395. }
  12396. if mode&uint32(m_S_IWOTH3) != 0 {
  12397. v27 = p
  12398. p++
  12399. *(*uint8)(unsafe.Pointer(v27)) = uint8('w')
  12400. } else {
  12401. v28 = p
  12402. p++
  12403. *(*uint8)(unsafe.Pointer(v28)) = uint8('-')
  12404. }
  12405. switch mode & libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXOTH3)|libc.Int32FromInt32(m_S_ISVTX3)) {
  12406. case uint32(0):
  12407. v29 = p
  12408. p++
  12409. *(*uint8)(unsafe.Pointer(v29)) = uint8('-')
  12410. case uint32(m_S_IXOTH3):
  12411. v30 = p
  12412. p++
  12413. *(*uint8)(unsafe.Pointer(v30)) = uint8('x')
  12414. case uint32(m_S_ISVTX3):
  12415. v31 = p
  12416. p++
  12417. *(*uint8)(unsafe.Pointer(v31)) = uint8('T')
  12418. case libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXOTH3) | libc.Int32FromInt32(m_S_ISVTX3)):
  12419. v32 = p
  12420. p++
  12421. *(*uint8)(unsafe.Pointer(v32)) = uint8('t')
  12422. break
  12423. }
  12424. v33 = p
  12425. p++
  12426. *(*uint8)(unsafe.Pointer(v33)) = uint8(' ') /* will be a '+' if ACL's implemented */
  12427. *(*uint8)(unsafe.Pointer(p)) = uint8('\000')
  12428. }
  12429. // C documentation
  12430. //
  12431. // /*
  12432. // * Find the first occurrence of find in s, where the search is limited to the
  12433. // * first slen characters of s.
  12434. // */
  12435. func Xstrnstr(tls *libc.TLS, s uintptr, find uintptr, slen Tsize_t) (r uintptr) {
  12436. var c, sc, v1, v4 uint8
  12437. var len1, v3 Tsize_t
  12438. var v2, v5 uintptr
  12439. var v6 bool
  12440. _, _, _, _, _, _, _, _, _ = c, len1, sc, v1, v2, v3, v4, v5, v6
  12441. v2 = find
  12442. find++
  12443. v1 = *(*uint8)(unsafe.Pointer(v2))
  12444. c = v1
  12445. if libc.Int32FromUint8(v1) != int32('\000') {
  12446. len1 = libc.Xstrlen(tls, find)
  12447. for cond := true; cond; cond = libc.Xstrncmp(tls, s, find, len1) != 0 {
  12448. for cond := true; cond; cond = libc.Int32FromUint8(sc) != libc.Int32FromUint8(c) {
  12449. v3 = slen
  12450. slen--
  12451. if v6 = v3 < uint64(1); !v6 {
  12452. v5 = s
  12453. s++
  12454. v4 = *(*uint8)(unsafe.Pointer(v5))
  12455. sc = v4
  12456. }
  12457. if v6 || libc.Int32FromUint8(v4) == int32('\000') {
  12458. return libc.UintptrFromInt32(0)
  12459. }
  12460. }
  12461. if len1 > slen {
  12462. return libc.UintptrFromInt32(0)
  12463. }
  12464. }
  12465. s--
  12466. }
  12467. return s
  12468. }
  12469. func Xstrtoi(tls *libc.TLS, nptr uintptr, endptr uintptr, base int32, lo Tintmax_t, hi Tintmax_t, rstatus uintptr) (r Tintmax_t) {
  12470. bp := tls.Alloc(16)
  12471. defer tls.Free(16)
  12472. var im Tintmax_t
  12473. var serrno int32
  12474. var _ /* ep at bp+0 */ uintptr
  12475. var _ /* rep at bp+8 */ int32
  12476. _, _ = im, serrno
  12477. /* endptr may be NULL */
  12478. if endptr == libc.UintptrFromInt32(0) {
  12479. endptr = bp
  12480. }
  12481. if rstatus == libc.UintptrFromInt32(0) {
  12482. rstatus = bp + 8
  12483. }
  12484. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  12485. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  12486. im = libc.Xstrtoimax(tls, nptr, endptr, base)
  12487. *(*int32)(unsafe.Pointer(rstatus)) = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  12488. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  12489. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  12490. /* No digits were found */
  12491. if nptr == *(*uintptr)(unsafe.Pointer(endptr)) {
  12492. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ECANCELED)
  12493. } else {
  12494. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(endptr))))) != int32('\000') {
  12495. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_EOPNOTSUPP)
  12496. }
  12497. }
  12498. }
  12499. if im < lo {
  12500. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  12501. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ERANGE)
  12502. }
  12503. return lo
  12504. }
  12505. if im > hi {
  12506. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  12507. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ERANGE)
  12508. }
  12509. return hi
  12510. }
  12511. return im
  12512. }
  12513. const m_S_IFBLK2 = 0060000
  12514. const m_S_IFCHR2 = 0020000
  12515. const m_S_IFDIR4 = 0040000
  12516. const m_S_IFIFO2 = 0010000
  12517. const m_S_IFLNK2 = 0120000
  12518. const m_S_IFMT2 = 0170000
  12519. const m_S_IFREG2 = 0100000
  12520. const m_S_IFSOCK2 = 0140000
  12521. const m_S_IRGRP4 = 0040
  12522. const m_S_IROTH4 = 0004
  12523. const m_S_IRUSR4 = 0400
  12524. const m_S_ISGID4 = 02000
  12525. const m_S_ISUID4 = 04000
  12526. const m_S_ISVTX4 = 01000
  12527. const m_S_IWGRP4 = 0020
  12528. const m_S_IWOTH4 = 0002
  12529. const m_S_IWUSR4 = 0200
  12530. const m_S_IXGRP4 = 0010
  12531. const m_S_IXOTH4 = 0001
  12532. const m_S_IXUSR4 = 0100
  12533. func Xstrtonum(tls *libc.TLS, nptr uintptr, minval int64, maxval int64, errstr uintptr) (r int64) {
  12534. bp := tls.Alloc(16)
  12535. defer tls.Free(16)
  12536. var rv int64
  12537. var v1 uintptr
  12538. var _ /* e at bp+0 */ int32
  12539. var _ /* resp at bp+8 */ uintptr
  12540. _, _ = rv, v1
  12541. if errstr == libc.UintptrFromInt32(0) {
  12542. errstr = bp + 8
  12543. }
  12544. rv = Xstrtoi(tls, nptr, libc.UintptrFromInt32(0), int32(10), minval, maxval, bp)
  12545. if *(*int32)(unsafe.Pointer(bp)) == 0 {
  12546. *(*uintptr)(unsafe.Pointer(errstr)) = libc.UintptrFromInt32(0)
  12547. return rv
  12548. }
  12549. if *(*int32)(unsafe.Pointer(bp)) == int32(m_ERANGE) {
  12550. if rv == maxval {
  12551. v1 = __ccgo_ts + 573
  12552. } else {
  12553. v1 = __ccgo_ts + 583
  12554. }
  12555. *(*uintptr)(unsafe.Pointer(errstr)) = v1
  12556. } else {
  12557. *(*uintptr)(unsafe.Pointer(errstr)) = __ccgo_ts + 593
  12558. }
  12559. return 0
  12560. }
  12561. func Xstrtou(tls *libc.TLS, nptr uintptr, endptr uintptr, base int32, lo Tuintmax_t, hi Tuintmax_t, rstatus uintptr) (r Tuintmax_t) {
  12562. bp := tls.Alloc(16)
  12563. defer tls.Free(16)
  12564. var im Tuintmax_t
  12565. var serrno int32
  12566. var _ /* ep at bp+0 */ uintptr
  12567. var _ /* rep at bp+8 */ int32
  12568. _, _ = im, serrno
  12569. /* endptr may be NULL */
  12570. if endptr == libc.UintptrFromInt32(0) {
  12571. endptr = bp
  12572. }
  12573. if rstatus == libc.UintptrFromInt32(0) {
  12574. rstatus = bp + 8
  12575. }
  12576. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  12577. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  12578. im = libc.Xstrtoumax(tls, nptr, endptr, base)
  12579. *(*int32)(unsafe.Pointer(rstatus)) = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  12580. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  12581. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  12582. /* No digits were found */
  12583. if nptr == *(*uintptr)(unsafe.Pointer(endptr)) {
  12584. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ECANCELED)
  12585. } else {
  12586. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(endptr))))) != int32('\000') {
  12587. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_EOPNOTSUPP)
  12588. }
  12589. }
  12590. }
  12591. if im < lo {
  12592. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  12593. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ERANGE)
  12594. }
  12595. return lo
  12596. }
  12597. if im > hi {
  12598. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  12599. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ERANGE)
  12600. }
  12601. return hi
  12602. }
  12603. return im
  12604. }
  12605. // C documentation
  12606. //
  12607. // /*
  12608. // * Convert a 32 bit representation of time_t into time_t. XXX needs to
  12609. // * implement the 50-year rule to handle post-2038 conversions.
  12610. // */
  12611. func X_time32_to_time(tls *libc.TLS, t32 Tint32_t) (r Ttime_t) {
  12612. return int64(t32)
  12613. }
  12614. // C documentation
  12615. //
  12616. // /*
  12617. // * Convert time_t to a 32 bit representation. If time_t is 64 bits we can
  12618. // * simply chop it down. The resulting 32 bit representation can be
  12619. // * converted back to a temporally local 64 bit time_t using time32_to_time.
  12620. // */
  12621. func X_time_to_time32(tls *libc.TLS, t Ttime_t) (r Tint32_t) {
  12622. return int32(t)
  12623. }
  12624. // C documentation
  12625. //
  12626. // /*
  12627. // * Convert a 64 bit representation of time_t into time_t. If time_t is
  12628. // * represented as 32 bits we can simply chop it and not support times
  12629. // * past 2038.
  12630. // */
  12631. func X_time64_to_time(tls *libc.TLS, t64 Tint64_t) (r Ttime_t) {
  12632. return t64
  12633. }
  12634. // C documentation
  12635. //
  12636. // /*
  12637. // * Convert time_t to a 64 bit representation. If time_t is represented
  12638. // * as 32 bits we simply sign-extend and do not support times past 2038.
  12639. // */
  12640. func X_time_to_time64(tls *libc.TLS, t Ttime_t) (r Tint64_t) {
  12641. return t
  12642. }
  12643. // C documentation
  12644. //
  12645. // /*
  12646. // * Convert to/from 'long'. Depending on the sizeof(long) this may or
  12647. // * may not require using the 50-year rule.
  12648. // */
  12649. func X_time_to_long(tls *libc.TLS, t Ttime_t) (r int64) {
  12650. if uint64(8) == uint64(8) {
  12651. return X_time_to_time64(tls, t)
  12652. }
  12653. return t
  12654. }
  12655. func X_long_to_time(tls *libc.TLS, tlong int64) (r Ttime_t) {
  12656. if uint64(8) == uint64(4) {
  12657. return X_time32_to_time(tls, int32(tlong))
  12658. }
  12659. return tlong
  12660. }
  12661. // C documentation
  12662. //
  12663. // /*
  12664. // * Convert to/from 'int'. Depending on the sizeof(int) this may or
  12665. // * may not require using the 50-year rule.
  12666. // */
  12667. func X_time_to_int(tls *libc.TLS, t Ttime_t) (r int32) {
  12668. if uint64(4) == uint64(8) {
  12669. return int32(X_time_to_time64(tls, t))
  12670. }
  12671. return int32(t)
  12672. }
  12673. func X_int_to_time(tls *libc.TLS, tint int32) (r Ttime_t) {
  12674. if uint64(4) == uint64(4) {
  12675. return X_time32_to_time(tls, tint)
  12676. }
  12677. return int64(tint)
  12678. }
  12679. const m_S_AMP = 13
  12680. const m_S_CTRL = 4
  12681. const m_S_EATCRNL = 12
  12682. const m_S_GROUND = 0
  12683. const m_S_HEX = 7
  12684. const m_S_HEX1 = 8
  12685. const m_S_HEX2 = 9
  12686. const m_S_META = 2
  12687. const m_S_META1 = 3
  12688. const m_S_MIME1 = 10
  12689. const m_S_MIME2 = 11
  12690. const m_S_NUMBER = 14
  12691. const m_S_OCTAL2 = 5
  12692. const m_S_OCTAL3 = 6
  12693. const m_S_START = 1
  12694. const m_S_STRING = 15
  12695. const m_UNVIS_END = "_VIS_END"
  12696. const m_UNVIS_NOCHAR = 3
  12697. const m_UNVIS_VALID = 1
  12698. const m_UNVIS_VALIDPUSH = 2
  12699. const m_VIS_CSTYLE = 0x0002
  12700. const m_VIS_DQ = 0x8000
  12701. const m_VIS_GLOB = 0x1000
  12702. const m_VIS_HTTP1808 = 128
  12703. const m_VIS_HTTP1866 = 512
  12704. const m_VIS_HTTPSTYLE = 0x0080
  12705. const m_VIS_MIMESTYLE = 256
  12706. const m_VIS_NL = 0x0010
  12707. const m_VIS_NOESCAPE = 1024
  12708. const m_VIS_NOLOCALE = 0x4000
  12709. const m_VIS_NOSLASH = 0x0040
  12710. const m_VIS_OCTAL = 0x0001
  12711. const m_VIS_SAFE = 0x0020
  12712. const m_VIS_SHELL = 0x2000
  12713. const m_VIS_SP = 0x0004
  12714. const m_VIS_TAB = 0x0008
  12715. const m__VIS_END = 2048
  12716. /*
  12717. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  12718. *
  12719. * Redistribution and use in source and binary forms, with or without
  12720. * modification, are permitted provided that the following conditions
  12721. * are met:
  12722. * 1. Redistributions of source code must retain the above copyright
  12723. * notice, this list of conditions and the following disclaimer.
  12724. * 2. Redistributions in binary form must reproduce the above copyright
  12725. * notice, this list of conditions and the following disclaimer in the
  12726. * documentation and/or other materials provided with the distribution.
  12727. * 3. The name of the author may not be used to endorse or promote products
  12728. * derived from this software without specific prior written permission.
  12729. *
  12730. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  12731. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  12732. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  12733. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  12734. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  12735. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  12736. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  12737. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  12738. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  12739. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  12740. */
  12741. /*
  12742. * decode driven by state machine
  12743. */
  12744. // C documentation
  12745. //
  12746. // /*
  12747. // * RFC 1866
  12748. // */
  12749. type Tnv = struct {
  12750. Fname [7]uint8
  12751. Fvalue Tuint8_t
  12752. }
  12753. /*
  12754. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  12755. *
  12756. * Redistribution and use in source and binary forms, with or without
  12757. * modification, are permitted provided that the following conditions
  12758. * are met:
  12759. * 1. Redistributions of source code must retain the above copyright
  12760. * notice, this list of conditions and the following disclaimer.
  12761. * 2. Redistributions in binary form must reproduce the above copyright
  12762. * notice, this list of conditions and the following disclaimer in the
  12763. * documentation and/or other materials provided with the distribution.
  12764. * 3. The name of the author may not be used to endorse or promote products
  12765. * derived from this software without specific prior written permission.
  12766. *
  12767. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  12768. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  12769. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  12770. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  12771. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  12772. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  12773. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  12774. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  12775. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  12776. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  12777. */
  12778. /*
  12779. * decode driven by state machine
  12780. */
  12781. // C documentation
  12782. //
  12783. // /*
  12784. // * RFC 1866
  12785. // */
  12786. var _nv = [100]Tnv{
  12787. 0: {
  12788. Fname: [7]uint8{'A', 'E', 'l', 'i', 'g'},
  12789. Fvalue: uint8(198),
  12790. },
  12791. 1: {
  12792. Fname: [7]uint8{'A', 'a', 'c', 'u', 't', 'e'},
  12793. Fvalue: uint8(193),
  12794. },
  12795. 2: {
  12796. Fname: [7]uint8{'A', 'c', 'i', 'r', 'c'},
  12797. Fvalue: uint8(194),
  12798. },
  12799. 3: {
  12800. Fname: [7]uint8{'A', 'g', 'r', 'a', 'v', 'e'},
  12801. Fvalue: uint8(192),
  12802. },
  12803. 4: {
  12804. Fname: [7]uint8{'A', 'r', 'i', 'n', 'g'},
  12805. Fvalue: uint8(197),
  12806. },
  12807. 5: {
  12808. Fname: [7]uint8{'A', 't', 'i', 'l', 'd', 'e'},
  12809. Fvalue: uint8(195),
  12810. },
  12811. 6: {
  12812. Fname: [7]uint8{'A', 'u', 'm', 'l'},
  12813. Fvalue: uint8(196),
  12814. },
  12815. 7: {
  12816. Fname: [7]uint8{'C', 'c', 'e', 'd', 'i', 'l'},
  12817. Fvalue: uint8(199),
  12818. },
  12819. 8: {
  12820. Fname: [7]uint8{'E', 'T', 'H'},
  12821. Fvalue: uint8(208),
  12822. },
  12823. 9: {
  12824. Fname: [7]uint8{'E', 'a', 'c', 'u', 't', 'e'},
  12825. Fvalue: uint8(201),
  12826. },
  12827. 10: {
  12828. Fname: [7]uint8{'E', 'c', 'i', 'r', 'c'},
  12829. Fvalue: uint8(202),
  12830. },
  12831. 11: {
  12832. Fname: [7]uint8{'E', 'g', 'r', 'a', 'v', 'e'},
  12833. Fvalue: uint8(200),
  12834. },
  12835. 12: {
  12836. Fname: [7]uint8{'E', 'u', 'm', 'l'},
  12837. Fvalue: uint8(203),
  12838. },
  12839. 13: {
  12840. Fname: [7]uint8{'I', 'a', 'c', 'u', 't', 'e'},
  12841. Fvalue: uint8(205),
  12842. },
  12843. 14: {
  12844. Fname: [7]uint8{'I', 'c', 'i', 'r', 'c'},
  12845. Fvalue: uint8(206),
  12846. },
  12847. 15: {
  12848. Fname: [7]uint8{'I', 'g', 'r', 'a', 'v', 'e'},
  12849. Fvalue: uint8(204),
  12850. },
  12851. 16: {
  12852. Fname: [7]uint8{'I', 'u', 'm', 'l'},
  12853. Fvalue: uint8(207),
  12854. },
  12855. 17: {
  12856. Fname: [7]uint8{'N', 't', 'i', 'l', 'd', 'e'},
  12857. Fvalue: uint8(209),
  12858. },
  12859. 18: {
  12860. Fname: [7]uint8{'O', 'a', 'c', 'u', 't', 'e'},
  12861. Fvalue: uint8(211),
  12862. },
  12863. 19: {
  12864. Fname: [7]uint8{'O', 'c', 'i', 'r', 'c'},
  12865. Fvalue: uint8(212),
  12866. },
  12867. 20: {
  12868. Fname: [7]uint8{'O', 'g', 'r', 'a', 'v', 'e'},
  12869. Fvalue: uint8(210),
  12870. },
  12871. 21: {
  12872. Fname: [7]uint8{'O', 's', 'l', 'a', 's', 'h'},
  12873. Fvalue: uint8(216),
  12874. },
  12875. 22: {
  12876. Fname: [7]uint8{'O', 't', 'i', 'l', 'd', 'e'},
  12877. Fvalue: uint8(213),
  12878. },
  12879. 23: {
  12880. Fname: [7]uint8{'O', 'u', 'm', 'l'},
  12881. Fvalue: uint8(214),
  12882. },
  12883. 24: {
  12884. Fname: [7]uint8{'T', 'H', 'O', 'R', 'N'},
  12885. Fvalue: uint8(222),
  12886. },
  12887. 25: {
  12888. Fname: [7]uint8{'U', 'a', 'c', 'u', 't', 'e'},
  12889. Fvalue: uint8(218),
  12890. },
  12891. 26: {
  12892. Fname: [7]uint8{'U', 'c', 'i', 'r', 'c'},
  12893. Fvalue: uint8(219),
  12894. },
  12895. 27: {
  12896. Fname: [7]uint8{'U', 'g', 'r', 'a', 'v', 'e'},
  12897. Fvalue: uint8(217),
  12898. },
  12899. 28: {
  12900. Fname: [7]uint8{'U', 'u', 'm', 'l'},
  12901. Fvalue: uint8(220),
  12902. },
  12903. 29: {
  12904. Fname: [7]uint8{'Y', 'a', 'c', 'u', 't', 'e'},
  12905. Fvalue: uint8(221),
  12906. },
  12907. 30: {
  12908. Fname: [7]uint8{'a', 'a', 'c', 'u', 't', 'e'},
  12909. Fvalue: uint8(225),
  12910. },
  12911. 31: {
  12912. Fname: [7]uint8{'a', 'c', 'i', 'r', 'c'},
  12913. Fvalue: uint8(226),
  12914. },
  12915. 32: {
  12916. Fname: [7]uint8{'a', 'c', 'u', 't', 'e'},
  12917. Fvalue: uint8(180),
  12918. },
  12919. 33: {
  12920. Fname: [7]uint8{'a', 'e', 'l', 'i', 'g'},
  12921. Fvalue: uint8(230),
  12922. },
  12923. 34: {
  12924. Fname: [7]uint8{'a', 'g', 'r', 'a', 'v', 'e'},
  12925. Fvalue: uint8(224),
  12926. },
  12927. 35: {
  12928. Fname: [7]uint8{'a', 'm', 'p'},
  12929. Fvalue: uint8(38),
  12930. },
  12931. 36: {
  12932. Fname: [7]uint8{'a', 'r', 'i', 'n', 'g'},
  12933. Fvalue: uint8(229),
  12934. },
  12935. 37: {
  12936. Fname: [7]uint8{'a', 't', 'i', 'l', 'd', 'e'},
  12937. Fvalue: uint8(227),
  12938. },
  12939. 38: {
  12940. Fname: [7]uint8{'a', 'u', 'm', 'l'},
  12941. Fvalue: uint8(228),
  12942. },
  12943. 39: {
  12944. Fname: [7]uint8{'b', 'r', 'v', 'b', 'a', 'r'},
  12945. Fvalue: uint8(166),
  12946. },
  12947. 40: {
  12948. Fname: [7]uint8{'c', 'c', 'e', 'd', 'i', 'l'},
  12949. Fvalue: uint8(231),
  12950. },
  12951. 41: {
  12952. Fname: [7]uint8{'c', 'e', 'd', 'i', 'l'},
  12953. Fvalue: uint8(184),
  12954. },
  12955. 42: {
  12956. Fname: [7]uint8{'c', 'e', 'n', 't'},
  12957. Fvalue: uint8(162),
  12958. },
  12959. 43: {
  12960. Fname: [7]uint8{'c', 'o', 'p', 'y'},
  12961. Fvalue: uint8(169),
  12962. },
  12963. 44: {
  12964. Fname: [7]uint8{'c', 'u', 'r', 'r', 'e', 'n'},
  12965. Fvalue: uint8(164),
  12966. },
  12967. 45: {
  12968. Fname: [7]uint8{'d', 'e', 'g'},
  12969. Fvalue: uint8(176),
  12970. },
  12971. 46: {
  12972. Fname: [7]uint8{'d', 'i', 'v', 'i', 'd', 'e'},
  12973. Fvalue: uint8(247),
  12974. },
  12975. 47: {
  12976. Fname: [7]uint8{'e', 'a', 'c', 'u', 't', 'e'},
  12977. Fvalue: uint8(233),
  12978. },
  12979. 48: {
  12980. Fname: [7]uint8{'e', 'c', 'i', 'r', 'c'},
  12981. Fvalue: uint8(234),
  12982. },
  12983. 49: {
  12984. Fname: [7]uint8{'e', 'g', 'r', 'a', 'v', 'e'},
  12985. Fvalue: uint8(232),
  12986. },
  12987. 50: {
  12988. Fname: [7]uint8{'e', 't', 'h'},
  12989. Fvalue: uint8(240),
  12990. },
  12991. 51: {
  12992. Fname: [7]uint8{'e', 'u', 'm', 'l'},
  12993. Fvalue: uint8(235),
  12994. },
  12995. 52: {
  12996. Fname: [7]uint8{'f', 'r', 'a', 'c', '1', '2'},
  12997. Fvalue: uint8(189),
  12998. },
  12999. 53: {
  13000. Fname: [7]uint8{'f', 'r', 'a', 'c', '1', '4'},
  13001. Fvalue: uint8(188),
  13002. },
  13003. 54: {
  13004. Fname: [7]uint8{'f', 'r', 'a', 'c', '3', '4'},
  13005. Fvalue: uint8(190),
  13006. },
  13007. 55: {
  13008. Fname: [7]uint8{'g', 't'},
  13009. Fvalue: uint8(62),
  13010. },
  13011. 56: {
  13012. Fname: [7]uint8{'i', 'a', 'c', 'u', 't', 'e'},
  13013. Fvalue: uint8(237),
  13014. },
  13015. 57: {
  13016. Fname: [7]uint8{'i', 'c', 'i', 'r', 'c'},
  13017. Fvalue: uint8(238),
  13018. },
  13019. 58: {
  13020. Fname: [7]uint8{'i', 'e', 'x', 'c', 'l'},
  13021. Fvalue: uint8(161),
  13022. },
  13023. 59: {
  13024. Fname: [7]uint8{'i', 'g', 'r', 'a', 'v', 'e'},
  13025. Fvalue: uint8(236),
  13026. },
  13027. 60: {
  13028. Fname: [7]uint8{'i', 'q', 'u', 'e', 's', 't'},
  13029. Fvalue: uint8(191),
  13030. },
  13031. 61: {
  13032. Fname: [7]uint8{'i', 'u', 'm', 'l'},
  13033. Fvalue: uint8(239),
  13034. },
  13035. 62: {
  13036. Fname: [7]uint8{'l', 'a', 'q', 'u', 'o'},
  13037. Fvalue: uint8(171),
  13038. },
  13039. 63: {
  13040. Fname: [7]uint8{'l', 't'},
  13041. Fvalue: uint8(60),
  13042. },
  13043. 64: {
  13044. Fname: [7]uint8{'m', 'a', 'c', 'r'},
  13045. Fvalue: uint8(175),
  13046. },
  13047. 65: {
  13048. Fname: [7]uint8{'m', 'i', 'c', 'r', 'o'},
  13049. Fvalue: uint8(181),
  13050. },
  13051. 66: {
  13052. Fname: [7]uint8{'m', 'i', 'd', 'd', 'o', 't'},
  13053. Fvalue: uint8(183),
  13054. },
  13055. 67: {
  13056. Fname: [7]uint8{'n', 'b', 's', 'p'},
  13057. Fvalue: uint8(160),
  13058. },
  13059. 68: {
  13060. Fname: [7]uint8{'n', 'o', 't'},
  13061. Fvalue: uint8(172),
  13062. },
  13063. 69: {
  13064. Fname: [7]uint8{'n', 't', 'i', 'l', 'd', 'e'},
  13065. Fvalue: uint8(241),
  13066. },
  13067. 70: {
  13068. Fname: [7]uint8{'o', 'a', 'c', 'u', 't', 'e'},
  13069. Fvalue: uint8(243),
  13070. },
  13071. 71: {
  13072. Fname: [7]uint8{'o', 'c', 'i', 'r', 'c'},
  13073. Fvalue: uint8(244),
  13074. },
  13075. 72: {
  13076. Fname: [7]uint8{'o', 'g', 'r', 'a', 'v', 'e'},
  13077. Fvalue: uint8(242),
  13078. },
  13079. 73: {
  13080. Fname: [7]uint8{'o', 'r', 'd', 'f'},
  13081. Fvalue: uint8(170),
  13082. },
  13083. 74: {
  13084. Fname: [7]uint8{'o', 'r', 'd', 'm'},
  13085. Fvalue: uint8(186),
  13086. },
  13087. 75: {
  13088. Fname: [7]uint8{'o', 's', 'l', 'a', 's', 'h'},
  13089. Fvalue: uint8(248),
  13090. },
  13091. 76: {
  13092. Fname: [7]uint8{'o', 't', 'i', 'l', 'd', 'e'},
  13093. Fvalue: uint8(245),
  13094. },
  13095. 77: {
  13096. Fname: [7]uint8{'o', 'u', 'm', 'l'},
  13097. Fvalue: uint8(246),
  13098. },
  13099. 78: {
  13100. Fname: [7]uint8{'p', 'a', 'r', 'a'},
  13101. Fvalue: uint8(182),
  13102. },
  13103. 79: {
  13104. Fname: [7]uint8{'p', 'l', 'u', 's', 'm', 'n'},
  13105. Fvalue: uint8(177),
  13106. },
  13107. 80: {
  13108. Fname: [7]uint8{'p', 'o', 'u', 'n', 'd'},
  13109. Fvalue: uint8(163),
  13110. },
  13111. 81: {
  13112. Fname: [7]uint8{'q', 'u', 'o', 't'},
  13113. Fvalue: uint8(34),
  13114. },
  13115. 82: {
  13116. Fname: [7]uint8{'r', 'a', 'q', 'u', 'o'},
  13117. Fvalue: uint8(187),
  13118. },
  13119. 83: {
  13120. Fname: [7]uint8{'r', 'e', 'g'},
  13121. Fvalue: uint8(174),
  13122. },
  13123. 84: {
  13124. Fname: [7]uint8{'s', 'e', 'c', 't'},
  13125. Fvalue: uint8(167),
  13126. },
  13127. 85: {
  13128. Fname: [7]uint8{'s', 'h', 'y'},
  13129. Fvalue: uint8(173),
  13130. },
  13131. 86: {
  13132. Fname: [7]uint8{'s', 'u', 'p', '1'},
  13133. Fvalue: uint8(185),
  13134. },
  13135. 87: {
  13136. Fname: [7]uint8{'s', 'u', 'p', '2'},
  13137. Fvalue: uint8(178),
  13138. },
  13139. 88: {
  13140. Fname: [7]uint8{'s', 'u', 'p', '3'},
  13141. Fvalue: uint8(179),
  13142. },
  13143. 89: {
  13144. Fname: [7]uint8{'s', 'z', 'l', 'i', 'g'},
  13145. Fvalue: uint8(223),
  13146. },
  13147. 90: {
  13148. Fname: [7]uint8{'t', 'h', 'o', 'r', 'n'},
  13149. Fvalue: uint8(254),
  13150. },
  13151. 91: {
  13152. Fname: [7]uint8{'t', 'i', 'm', 'e', 's'},
  13153. Fvalue: uint8(215),
  13154. },
  13155. 92: {
  13156. Fname: [7]uint8{'u', 'a', 'c', 'u', 't', 'e'},
  13157. Fvalue: uint8(250),
  13158. },
  13159. 93: {
  13160. Fname: [7]uint8{'u', 'c', 'i', 'r', 'c'},
  13161. Fvalue: uint8(251),
  13162. },
  13163. 94: {
  13164. Fname: [7]uint8{'u', 'g', 'r', 'a', 'v', 'e'},
  13165. Fvalue: uint8(249),
  13166. },
  13167. 95: {
  13168. Fname: [7]uint8{'u', 'm', 'l'},
  13169. Fvalue: uint8(168),
  13170. },
  13171. 96: {
  13172. Fname: [7]uint8{'u', 'u', 'm', 'l'},
  13173. Fvalue: uint8(252),
  13174. },
  13175. 97: {
  13176. Fname: [7]uint8{'y', 'a', 'c', 'u', 't', 'e'},
  13177. Fvalue: uint8(253),
  13178. },
  13179. 98: {
  13180. Fname: [7]uint8{'y', 'e', 'n'},
  13181. Fvalue: uint8(165),
  13182. },
  13183. 99: {
  13184. Fname: [7]uint8{'y', 'u', 'm', 'l'},
  13185. Fvalue: uint8(255),
  13186. },
  13187. }
  13188. // C documentation
  13189. //
  13190. // /*
  13191. // * unvis - decode characters previously encoded by vis
  13192. // */
  13193. func Xunvis(tls *libc.TLS, cp uintptr, c int32, astate uintptr, flag int32) (r int32) {
  13194. var ia, is, lc, st, uc uint8
  13195. var v22, v23, v24, v25, v26 int32
  13196. var p19, p20, p21, p28 uintptr
  13197. _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ia, is, lc, st, uc, v22, v23, v24, v25, v26, p19, p20, p21, p28
  13198. uc = libc.Uint8FromInt32(c)
  13199. /*
  13200. * Bottom 8 bits of astate hold the state machine state.
  13201. * Top 8 bits hold the current character in the http 1866 nv string decoding
  13202. */
  13203. st = libc.Uint8FromInt32(*(*int32)(unsafe.Pointer(astate)) & libc.Int32FromInt32(0xff))
  13204. if flag&int32(m__VIS_END) != 0 {
  13205. switch libc.Int32FromUint8(st) {
  13206. case int32(m_S_OCTAL2):
  13207. fallthrough
  13208. case int32(m_S_OCTAL3):
  13209. fallthrough
  13210. case int32(m_S_HEX2):
  13211. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13212. return int32(m_UNVIS_VALID)
  13213. case m_S_GROUND:
  13214. return int32(m_UNVIS_NOCHAR)
  13215. default:
  13216. return -int32(1)
  13217. }
  13218. }
  13219. switch libc.Int32FromUint8(st) {
  13220. case m_S_GROUND:
  13221. goto _1
  13222. case int32(m_S_START):
  13223. goto _2
  13224. case int32(m_S_META):
  13225. goto _3
  13226. case int32(m_S_META1):
  13227. goto _4
  13228. case int32(m_S_CTRL):
  13229. goto _5
  13230. case int32(m_S_OCTAL2):
  13231. goto _6
  13232. case int32(m_S_OCTAL3):
  13233. goto _7
  13234. case int32(m_S_HEX):
  13235. goto _8
  13236. case int32(m_S_HEX1):
  13237. goto _9
  13238. case int32(m_S_HEX2):
  13239. goto _10
  13240. case int32(m_S_MIME1):
  13241. goto _11
  13242. case int32(m_S_MIME2):
  13243. goto _12
  13244. case int32(m_S_EATCRNL):
  13245. goto _13
  13246. case int32(m_S_AMP):
  13247. goto _14
  13248. case int32(m_S_STRING):
  13249. goto _15
  13250. case int32(m_S_NUMBER):
  13251. goto _16
  13252. default:
  13253. goto _17
  13254. }
  13255. goto _18
  13256. _1:
  13257. ;
  13258. *(*uint8)(unsafe.Pointer(cp)) = uint8(0)
  13259. if flag&int32(m_VIS_NOESCAPE) == 0 && c == int32('\\') {
  13260. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_START)))
  13261. return int32(m_UNVIS_NOCHAR)
  13262. }
  13263. if flag&int32(m_VIS_HTTP1808) != 0 && c == int32('%') {
  13264. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_HEX1)))
  13265. return int32(m_UNVIS_NOCHAR)
  13266. }
  13267. if flag&int32(m_VIS_HTTP1866) != 0 && c == int32('&') {
  13268. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_AMP)))
  13269. return int32(m_UNVIS_NOCHAR)
  13270. }
  13271. if flag&int32(m_VIS_MIMESTYLE) != 0 && c == int32('=') {
  13272. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_MIME1)))
  13273. return int32(m_UNVIS_NOCHAR)
  13274. }
  13275. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(c)
  13276. return int32(m_UNVIS_VALID)
  13277. _2:
  13278. ;
  13279. switch c {
  13280. case int32('\\'):
  13281. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(c)
  13282. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13283. return int32(m_UNVIS_VALID)
  13284. case int32('0'):
  13285. fallthrough
  13286. case int32('1'):
  13287. fallthrough
  13288. case int32('2'):
  13289. fallthrough
  13290. case int32('3'):
  13291. fallthrough
  13292. case int32('4'):
  13293. fallthrough
  13294. case int32('5'):
  13295. fallthrough
  13296. case int32('6'):
  13297. fallthrough
  13298. case int32('7'):
  13299. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(c - libc.Int32FromUint8('0'))
  13300. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_OCTAL2)))
  13301. return int32(m_UNVIS_NOCHAR)
  13302. case int32('M'):
  13303. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(0200)
  13304. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_META)))
  13305. return int32(m_UNVIS_NOCHAR)
  13306. case int32('^'):
  13307. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_CTRL)))
  13308. return int32(m_UNVIS_NOCHAR)
  13309. case int32('n'):
  13310. *(*uint8)(unsafe.Pointer(cp)) = uint8('\n')
  13311. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13312. return int32(m_UNVIS_VALID)
  13313. case int32('r'):
  13314. *(*uint8)(unsafe.Pointer(cp)) = uint8('\r')
  13315. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13316. return int32(m_UNVIS_VALID)
  13317. case int32('b'):
  13318. *(*uint8)(unsafe.Pointer(cp)) = uint8('\b')
  13319. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13320. return int32(m_UNVIS_VALID)
  13321. case int32('a'):
  13322. *(*uint8)(unsafe.Pointer(cp)) = uint8('\007')
  13323. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13324. return int32(m_UNVIS_VALID)
  13325. case int32('v'):
  13326. *(*uint8)(unsafe.Pointer(cp)) = uint8('\v')
  13327. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13328. return int32(m_UNVIS_VALID)
  13329. case int32('t'):
  13330. *(*uint8)(unsafe.Pointer(cp)) = uint8('\t')
  13331. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13332. return int32(m_UNVIS_VALID)
  13333. case int32('f'):
  13334. *(*uint8)(unsafe.Pointer(cp)) = uint8('\f')
  13335. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13336. return int32(m_UNVIS_VALID)
  13337. case int32('s'):
  13338. *(*uint8)(unsafe.Pointer(cp)) = uint8(' ')
  13339. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13340. return int32(m_UNVIS_VALID)
  13341. case int32('E'):
  13342. *(*uint8)(unsafe.Pointer(cp)) = uint8('\033')
  13343. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13344. return int32(m_UNVIS_VALID)
  13345. case int32('x'):
  13346. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_HEX)))
  13347. return int32(m_UNVIS_NOCHAR)
  13348. case int32('\n'):
  13349. /*
  13350. * hidden newline
  13351. */
  13352. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13353. return int32(m_UNVIS_NOCHAR)
  13354. case int32('$'):
  13355. /*
  13356. * hidden marker
  13357. */
  13358. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13359. return int32(m_UNVIS_NOCHAR)
  13360. default:
  13361. if libc.BoolInt32(libc.Uint32FromInt32(c)-uint32(0x21) < uint32(0x5e)) != 0 {
  13362. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(c)
  13363. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13364. return int32(m_UNVIS_VALID)
  13365. }
  13366. }
  13367. goto bad
  13368. _3:
  13369. ;
  13370. if c == int32('-') {
  13371. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_META1)))
  13372. } else {
  13373. if c == int32('^') {
  13374. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_CTRL)))
  13375. } else {
  13376. goto bad
  13377. }
  13378. }
  13379. return int32(m_UNVIS_NOCHAR)
  13380. _4:
  13381. ;
  13382. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13383. p19 = cp
  13384. *(*uint8)(unsafe.Pointer(p19)) = uint8(int32(*(*uint8)(unsafe.Pointer(p19))) | c)
  13385. return int32(m_UNVIS_VALID)
  13386. _5:
  13387. ;
  13388. if c == int32('?') {
  13389. p20 = cp
  13390. *(*uint8)(unsafe.Pointer(p20)) = uint8(int32(*(*uint8)(unsafe.Pointer(p20))) | libc.Int32FromInt32(0177))
  13391. } else {
  13392. p21 = cp
  13393. *(*uint8)(unsafe.Pointer(p21)) = uint8(int32(*(*uint8)(unsafe.Pointer(p21))) | c&libc.Int32FromInt32(037))
  13394. }
  13395. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13396. return int32(m_UNVIS_VALID)
  13397. _6:
  13398. ; /* second possible octal digit */
  13399. if libc.Int32FromUint8(uc) >= int32('0') && libc.Int32FromUint8(uc) <= int32('7') {
  13400. /*
  13401. * yes - and maybe a third
  13402. */
  13403. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))<<int32(3) + (c - int32('0')))
  13404. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_OCTAL3)))
  13405. return int32(m_UNVIS_NOCHAR)
  13406. }
  13407. /*
  13408. * no - done with current sequence, push back passed char
  13409. */
  13410. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13411. return int32(m_UNVIS_VALIDPUSH)
  13412. _7:
  13413. ; /* third possible octal digit */
  13414. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13415. if libc.Int32FromUint8(uc) >= int32('0') && libc.Int32FromUint8(uc) <= int32('7') {
  13416. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))<<int32(3) + (c - int32('0')))
  13417. return int32(m_UNVIS_VALID)
  13418. }
  13419. /*
  13420. * we were done, push back passed char
  13421. */
  13422. return int32(m_UNVIS_VALIDPUSH)
  13423. _8:
  13424. ;
  13425. if !(libc.Xisxdigit(tls, libc.Int32FromUint8(uc)) != 0) {
  13426. goto bad
  13427. }
  13428. /*FALLTHROUGH*/
  13429. _9:
  13430. ;
  13431. if libc.Xisxdigit(tls, libc.Int32FromUint8(uc)) != 0 {
  13432. if libc.BoolInt32(uint32(uc)-uint32('0') < uint32(10)) != 0 {
  13433. v22 = libc.Int32FromUint8(uc) - int32('0')
  13434. } else {
  13435. v22 = libc.Xtolower(tls, libc.Int32FromUint8(uc)) - int32('a') + int32(10)
  13436. }
  13437. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(v22)
  13438. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_HEX2)))
  13439. return int32(m_UNVIS_NOCHAR)
  13440. }
  13441. /*
  13442. * no - done with current sequence, push back passed char
  13443. */
  13444. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13445. return int32(m_UNVIS_VALIDPUSH)
  13446. _10:
  13447. ;
  13448. *(*int32)(unsafe.Pointer(astate)) = m_S_GROUND
  13449. if libc.Xisxdigit(tls, libc.Int32FromUint8(uc)) != 0 {
  13450. if libc.BoolInt32(uint32(uc)-uint32('0') < uint32(10)) != 0 {
  13451. v23 = libc.Int32FromUint8(uc) - int32('0')
  13452. } else {
  13453. v23 = libc.Xtolower(tls, libc.Int32FromUint8(uc)) - int32('a') + int32(10)
  13454. }
  13455. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(v23 | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))<<int32(4))
  13456. return int32(m_UNVIS_VALID)
  13457. }
  13458. return int32(m_UNVIS_VALIDPUSH)
  13459. _11:
  13460. ;
  13461. if libc.Int32FromUint8(uc) == int32('\n') || libc.Int32FromUint8(uc) == int32('\r') {
  13462. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_EATCRNL)))
  13463. return int32(m_UNVIS_NOCHAR)
  13464. }
  13465. 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) {
  13466. if libc.BoolInt32(uint32(uc)-uint32('0') < uint32(10)) != 0 {
  13467. v24 = libc.Int32FromUint8(uc) - int32('0')
  13468. } else {
  13469. v24 = libc.Int32FromUint8(uc) - int32('A') + int32(10)
  13470. }
  13471. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(v24)
  13472. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_MIME2)))
  13473. return int32(m_UNVIS_NOCHAR)
  13474. }
  13475. goto bad
  13476. _12:
  13477. ;
  13478. 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) {
  13479. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13480. if libc.BoolInt32(uint32(uc)-uint32('0') < uint32(10)) != 0 {
  13481. v25 = libc.Int32FromUint8(uc) - int32('0')
  13482. } else {
  13483. v25 = libc.Int32FromUint8(uc) - int32('A') + int32(10)
  13484. }
  13485. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(v25 | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))<<int32(4))
  13486. return int32(m_UNVIS_VALID)
  13487. }
  13488. goto bad
  13489. _13:
  13490. ;
  13491. switch libc.Int32FromUint8(uc) {
  13492. case int32('\r'):
  13493. fallthrough
  13494. case int32('\n'):
  13495. return int32(m_UNVIS_NOCHAR)
  13496. case int32('='):
  13497. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_MIME1)))
  13498. return int32(m_UNVIS_NOCHAR)
  13499. default:
  13500. *(*uint8)(unsafe.Pointer(cp)) = uc
  13501. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13502. return int32(m_UNVIS_VALID)
  13503. }
  13504. _14:
  13505. ;
  13506. *(*uint8)(unsafe.Pointer(cp)) = uint8(0)
  13507. if libc.Int32FromUint8(uc) == int32('#') {
  13508. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_NUMBER)))
  13509. return int32(m_UNVIS_NOCHAR)
  13510. }
  13511. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_STRING)))
  13512. /*FALLTHROUGH*/
  13513. _15:
  13514. ;
  13515. ia = *(*uint8)(unsafe.Pointer(cp)) /* index in the array */
  13516. is = uint8(libc.Uint32FromInt32(*(*int32)(unsafe.Pointer(astate))) >> libc.Int32FromInt32(24)) /* index in the string */
  13517. if libc.Int32FromUint8(is) == 0 {
  13518. v26 = 0
  13519. } else {
  13520. v26 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_nv)) + uintptr(ia)*8 + uintptr(libc.Int32FromUint8(is)-int32(1)))))
  13521. }
  13522. lc = libc.Uint8FromInt32(v26) /* last character */
  13523. if libc.Int32FromUint8(uc) == int32(';') {
  13524. uc = uint8('\000')
  13525. }
  13526. for {
  13527. if !(uint64(ia) < libc.Uint64FromInt64(800)/libc.Uint64FromInt64(8)) {
  13528. break
  13529. }
  13530. 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) {
  13531. goto bad
  13532. }
  13533. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_nv)) + uintptr(ia)*8 + uintptr(is)))) == libc.Int32FromUint8(uc) {
  13534. break
  13535. }
  13536. goto _27
  13537. _27:
  13538. ;
  13539. ia++
  13540. }
  13541. if uint64(ia) == libc.Uint64FromInt64(800)/libc.Uint64FromInt64(8) {
  13542. goto bad
  13543. }
  13544. if libc.Int32FromUint8(uc) != 0 {
  13545. *(*uint8)(unsafe.Pointer(cp)) = ia
  13546. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromUint8(is)+libc.Int32FromInt32(1))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_STRING)))
  13547. return int32(m_UNVIS_NOCHAR)
  13548. }
  13549. *(*uint8)(unsafe.Pointer(cp)) = _nv[ia].Fvalue
  13550. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13551. return int32(m_UNVIS_VALID)
  13552. _16:
  13553. ;
  13554. if libc.Int32FromUint8(uc) == int32(';') {
  13555. return int32(m_UNVIS_VALID)
  13556. }
  13557. if !(libc.BoolInt32(uint32(uc)-libc.Uint32FromUint8('0') < libc.Uint32FromInt32(10)) != 0) {
  13558. goto bad
  13559. }
  13560. p28 = cp
  13561. *(*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')))
  13562. return int32(m_UNVIS_NOCHAR)
  13563. _17:
  13564. ;
  13565. goto bad
  13566. bad:
  13567. ;
  13568. /*
  13569. * decoder in unknown state - (probably uninitialized)
  13570. */
  13571. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13572. return -int32(1)
  13573. _18:
  13574. ;
  13575. return r
  13576. }
  13577. /*
  13578. * strnunvisx - decode src into dst
  13579. *
  13580. * Number of chars decoded into dst is returned, -1 on error.
  13581. * Dst is null terminated.
  13582. */
  13583. func Xstrnunvisx(tls *libc.TLS, dst uintptr, dlen Tsize_t, src uintptr, flag int32) (r int32) {
  13584. bp := tls.Alloc(16)
  13585. defer tls.Free(16)
  13586. var c, v1 uint8
  13587. var start, v14, v16, v18, v2 uintptr
  13588. var v13, v15, v17, v19 Tsize_t
  13589. var _ /* state at bp+4 */ int32
  13590. var _ /* t at bp+0 */ uint8
  13591. _, _, _, _, _, _, _, _, _, _, _ = c, start, v1, v13, v14, v15, v16, v17, v18, v19, v2
  13592. *(*uint8)(unsafe.Pointer(bp)) = uint8('\000')
  13593. start = dst
  13594. *(*int32)(unsafe.Pointer(bp + 4)) = 0
  13595. for {
  13596. v2 = src
  13597. src++
  13598. v1 = *(*uint8)(unsafe.Pointer(v2))
  13599. c = v1
  13600. if !(libc.Int32FromUint8(v1) != int32('\000')) {
  13601. break
  13602. }
  13603. goto again
  13604. again:
  13605. ;
  13606. switch Xunvis(tls, bp, libc.Int32FromUint8(c), bp+4, flag) {
  13607. case int32(m_UNVIS_VALID):
  13608. goto _3
  13609. case int32(m_UNVIS_VALIDPUSH):
  13610. goto _4
  13611. case int32(m_UNVIS_NOCHAR):
  13612. goto _5
  13613. case 0:
  13614. goto _6
  13615. case -int32(1):
  13616. goto _7
  13617. default:
  13618. goto _8
  13619. }
  13620. goto _9
  13621. _3:
  13622. ;
  13623. _12:
  13624. ;
  13625. v13 = dlen
  13626. dlen--
  13627. if v13 == uint64(0) {
  13628. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  13629. return -int32(1)
  13630. }
  13631. goto _11
  13632. _11:
  13633. ;
  13634. if 0 != 0 {
  13635. goto _12
  13636. }
  13637. goto _10
  13638. _10:
  13639. ;
  13640. v14 = dst
  13641. dst++
  13642. *(*uint8)(unsafe.Pointer(v14)) = *(*uint8)(unsafe.Pointer(bp))
  13643. goto _9
  13644. _4:
  13645. ;
  13646. v15 = dlen
  13647. dlen--
  13648. if v15 == uint64(0) {
  13649. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  13650. return -int32(1)
  13651. }
  13652. v16 = dst
  13653. dst++
  13654. *(*uint8)(unsafe.Pointer(v16)) = *(*uint8)(unsafe.Pointer(bp))
  13655. goto again
  13656. _6:
  13657. ;
  13658. _5:
  13659. ;
  13660. goto _9
  13661. _7:
  13662. ;
  13663. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  13664. return -int32(1)
  13665. _8:
  13666. ;
  13667. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  13668. return -int32(1)
  13669. _9:
  13670. }
  13671. if Xunvis(tls, bp, libc.Int32FromUint8(c), bp+4, int32(m__VIS_END)) == int32(m_UNVIS_VALID) {
  13672. v17 = dlen
  13673. dlen--
  13674. if v17 == uint64(0) {
  13675. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  13676. return -int32(1)
  13677. }
  13678. v18 = dst
  13679. dst++
  13680. *(*uint8)(unsafe.Pointer(v18)) = *(*uint8)(unsafe.Pointer(bp))
  13681. }
  13682. v19 = dlen
  13683. dlen--
  13684. if v19 == uint64(0) {
  13685. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  13686. return -int32(1)
  13687. }
  13688. *(*uint8)(unsafe.Pointer(dst)) = uint8('\000')
  13689. return int32(int64(dst) - int64(start))
  13690. }
  13691. func Xstrunvisx(tls *libc.TLS, dst uintptr, src uintptr, flag int32) (r int32) {
  13692. return Xstrnunvisx(tls, dst, libc.Uint64FromInt32(^libc.Int32FromInt32(0)), src, flag)
  13693. }
  13694. func Xstrunvis(tls *libc.TLS, dst uintptr, src uintptr) (r int32) {
  13695. return Xstrnunvisx(tls, dst, libc.Uint64FromInt32(^libc.Int32FromInt32(0)), src, 0)
  13696. }
  13697. // C documentation
  13698. //
  13699. // /*
  13700. // * NetBSD added an strnvis and unfortunately made it incompatible with the
  13701. // * existing one in OpenBSD and Freedesktop's libbsd (the former having existed
  13702. // * for over ten years). Despite this incompatibility being reported during
  13703. // * development (see http://gnats.netbsd.org/44977) they still shipped it.
  13704. // * Even more unfortunately FreeBSD and later MacOS picked up this incompatible
  13705. // * implementation.
  13706. // *
  13707. // * Provide both implementations and default for now on the historical one to
  13708. // * avoid breakage, we will switch to the NetBSD one in libbsd 0.10.0 or so.
  13709. // *
  13710. // * OpenBSD, 2001: strnunvis(char *dst, const char *src, size_t dlen);
  13711. // * NetBSD: 2012, strnunvis(char *dst, size_t dlen, const char *src);
  13712. // */
  13713. func Xstrnunvis_openbsd(tls *libc.TLS, dst uintptr, src uintptr, dlen Tsize_t) (r Tssize_t) {
  13714. return int64(Xstrnunvisx(tls, dst, dlen, src, 0))
  13715. }
  13716. func Xstrnunvis_netbsd(tls *libc.TLS, dst uintptr, dlen Tsize_t, src uintptr) (r int32) {
  13717. return Xstrnunvisx(tls, dst, dlen, src, 0)
  13718. }
  13719. const m_MAXEXTRAS = 30
  13720. const m_VIS_CSTYLE1 = 2
  13721. const m_VIS_DQ1 = 32768
  13722. const m_VIS_GLOB1 = 4096
  13723. const m_VIS_HTTP18081 = 0x0080
  13724. const m_VIS_HTTP18661 = 0x0200
  13725. const m_VIS_HTTPSTYLE1 = 128
  13726. const m_VIS_NL1 = 16
  13727. const m_VIS_NOESCAPE1 = 0x0400
  13728. const m_VIS_NOLOCALE1 = 16384
  13729. const m_VIS_NOSLASH1 = 64
  13730. const m_VIS_OCTAL1 = 1
  13731. const m_VIS_SAFE1 = 32
  13732. const m_VIS_SHELL1 = 8192
  13733. const m_VIS_SP1 = 4
  13734. const m_VIS_TAB1 = 8
  13735. const m__VIS_END1 = 0x0800
  13736. type Twctrans_t = uintptr
  13737. /* Keep it simple for now, no locale stuff */
  13738. var _char_shell = [19]Twchar_t{'\'', '`', '"', ';', '&', '<', '>', '(', ')', '|', '{', '}', ']', '\\', '$', '!', '^', '~'}
  13739. var _char_glob = [5]Twchar_t{'*', '?', '[', '#'}
  13740. /*
  13741. * On NetBSD and glibc MB_LEN_MAX is currently > 8 which does not fit on any
  13742. * integer integral type and it is probably wrong, since currently the maximum
  13743. * number of bytes and character needs is 6. Until this is fixed, the
  13744. * loops below are using sizeof(uint64_t) - 1 instead of MB_LEN_MAX, and
  13745. * the assertion is commented out.
  13746. */
  13747. // C documentation
  13748. //
  13749. // /*
  13750. // * This is do_hvis, for HTTP style (RFC 1808)
  13751. // */
  13752. func _do_hvis(tls *libc.TLS, dst uintptr, c Twint_t, flags int32, nextc Twint_t, extra uintptr) (r uintptr) {
  13753. var v1, v2, v3 uintptr
  13754. _, _, _ = v1, v2, v3
  13755. 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(',') {
  13756. dst = _do_svis(tls, dst, c, flags, nextc, extra)
  13757. } else {
  13758. v1 = dst
  13759. dst += 4
  13760. *(*Twchar_t)(unsafe.Pointer(v1)) = int32('%')
  13761. v2 = dst
  13762. dst += 4
  13763. *(*Twchar_t)(unsafe.Pointer(v2)) = *(*t__predefined_wchar_t)(unsafe.Pointer(__ccgo_ts + 601 + uintptr(c>>int32(4)&uint32(0xf))*4))
  13764. v3 = dst
  13765. dst += 4
  13766. *(*Twchar_t)(unsafe.Pointer(v3)) = *(*t__predefined_wchar_t)(unsafe.Pointer(__ccgo_ts + 601 + uintptr(c&uint32(0xf))*4))
  13767. }
  13768. return dst
  13769. }
  13770. // C documentation
  13771. //
  13772. // /*
  13773. // * This is do_mvis, for Quoted-Printable MIME (RFC 2045)
  13774. // * NB: No handling of long lines or CRLF.
  13775. // */
  13776. func _do_mvis(tls *libc.TLS, dst uintptr, c Twint_t, flags int32, nextc Twint_t, extra uintptr) (r uintptr) {
  13777. var v1, v2, v3 uintptr
  13778. _, _, _ = v1, v2, v3
  13779. 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+669, libc.Int32FromUint32(c)) != libc.UintptrFromInt32(0)) {
  13780. v1 = dst
  13781. dst += 4
  13782. *(*Twchar_t)(unsafe.Pointer(v1)) = int32('=')
  13783. v2 = dst
  13784. dst += 4
  13785. *(*Twchar_t)(unsafe.Pointer(v2)) = *(*t__predefined_wchar_t)(unsafe.Pointer(__ccgo_ts + 721 + uintptr(c>>int32(4)&uint32(0xf))*4))
  13786. v3 = dst
  13787. dst += 4
  13788. *(*Twchar_t)(unsafe.Pointer(v3)) = *(*t__predefined_wchar_t)(unsafe.Pointer(__ccgo_ts + 721 + uintptr(c&uint32(0xf))*4))
  13789. } else {
  13790. dst = _do_svis(tls, dst, c, flags, nextc, extra)
  13791. }
  13792. return dst
  13793. }
  13794. // C documentation
  13795. //
  13796. // /*
  13797. // * Output single byte of multibyte character.
  13798. // */
  13799. func _do_mbyte(tls *libc.TLS, dst uintptr, c Twint_t, flags int32, nextc Twint_t, iswextra int32) (r uintptr) {
  13800. 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
  13801. var v21 int32
  13802. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  13803. if flags&int32(m_VIS_CSTYLE1) != 0 {
  13804. switch c {
  13805. case uint32('\n'):
  13806. v1 = dst
  13807. dst += 4
  13808. *(*Twchar_t)(unsafe.Pointer(v1)) = int32('\\')
  13809. v2 = dst
  13810. dst += 4
  13811. *(*Twchar_t)(unsafe.Pointer(v2)) = int32('n')
  13812. return dst
  13813. case uint32('\r'):
  13814. v3 = dst
  13815. dst += 4
  13816. *(*Twchar_t)(unsafe.Pointer(v3)) = int32('\\')
  13817. v4 = dst
  13818. dst += 4
  13819. *(*Twchar_t)(unsafe.Pointer(v4)) = int32('r')
  13820. return dst
  13821. case uint32('\b'):
  13822. v5 = dst
  13823. dst += 4
  13824. *(*Twchar_t)(unsafe.Pointer(v5)) = int32('\\')
  13825. v6 = dst
  13826. dst += 4
  13827. *(*Twchar_t)(unsafe.Pointer(v6)) = int32('b')
  13828. return dst
  13829. case uint32('\a'):
  13830. v7 = dst
  13831. dst += 4
  13832. *(*Twchar_t)(unsafe.Pointer(v7)) = int32('\\')
  13833. v8 = dst
  13834. dst += 4
  13835. *(*Twchar_t)(unsafe.Pointer(v8)) = int32('a')
  13836. return dst
  13837. case uint32('\v'):
  13838. v9 = dst
  13839. dst += 4
  13840. *(*Twchar_t)(unsafe.Pointer(v9)) = int32('\\')
  13841. v10 = dst
  13842. dst += 4
  13843. *(*Twchar_t)(unsafe.Pointer(v10)) = int32('v')
  13844. return dst
  13845. case uint32('\t'):
  13846. v11 = dst
  13847. dst += 4
  13848. *(*Twchar_t)(unsafe.Pointer(v11)) = int32('\\')
  13849. v12 = dst
  13850. dst += 4
  13851. *(*Twchar_t)(unsafe.Pointer(v12)) = int32('t')
  13852. return dst
  13853. case uint32('\f'):
  13854. v13 = dst
  13855. dst += 4
  13856. *(*Twchar_t)(unsafe.Pointer(v13)) = int32('\\')
  13857. v14 = dst
  13858. dst += 4
  13859. *(*Twchar_t)(unsafe.Pointer(v14)) = int32('f')
  13860. return dst
  13861. case uint32(' '):
  13862. v15 = dst
  13863. dst += 4
  13864. *(*Twchar_t)(unsafe.Pointer(v15)) = int32('\\')
  13865. v16 = dst
  13866. dst += 4
  13867. *(*Twchar_t)(unsafe.Pointer(v16)) = int32('s')
  13868. return dst
  13869. case uint32('\000'):
  13870. v17 = dst
  13871. dst += 4
  13872. *(*Twchar_t)(unsafe.Pointer(v17)) = int32('\\')
  13873. v18 = dst
  13874. dst += 4
  13875. *(*Twchar_t)(unsafe.Pointer(v18)) = int32('0')
  13876. if libc.Int32FromUint8(uint8(nextc)) >= int32('0') && libc.Int32FromUint8(uint8(nextc)) <= int32('7') {
  13877. v19 = dst
  13878. dst += 4
  13879. *(*Twchar_t)(unsafe.Pointer(v19)) = int32('0')
  13880. v20 = dst
  13881. dst += 4
  13882. *(*Twchar_t)(unsafe.Pointer(v20)) = int32('0')
  13883. }
  13884. return dst
  13885. /* We cannot encode these characters in VIS_CSTYLE
  13886. * because they special meaning */
  13887. fallthrough
  13888. case uint32('n'):
  13889. fallthrough
  13890. case uint32('r'):
  13891. fallthrough
  13892. case uint32('b'):
  13893. fallthrough
  13894. case uint32('a'):
  13895. fallthrough
  13896. case uint32('v'):
  13897. fallthrough
  13898. case uint32('t'):
  13899. fallthrough
  13900. case uint32('f'):
  13901. fallthrough
  13902. case uint32('s'):
  13903. fallthrough
  13904. case uint32('0'):
  13905. fallthrough
  13906. case uint32('M'):
  13907. fallthrough
  13908. case uint32('^'):
  13909. fallthrough
  13910. case uint32('$'): /* vis(1) -l */
  13911. default:
  13912. if flags&int32(m_VIS_NOLOCALE1) != 0 {
  13913. v21 = libc.BoolInt32(c-uint32(0x21) < uint32(0x5e))
  13914. } else {
  13915. v21 = libc.Xiswgraph(tls, c)
  13916. }
  13917. if v21 != 0 && !(libc.Int32FromUint8(uint8(c)) >= int32('0') && libc.Int32FromUint8(uint8(c)) <= int32('7')) {
  13918. v22 = dst
  13919. dst += 4
  13920. *(*Twchar_t)(unsafe.Pointer(v22)) = int32('\\')
  13921. v23 = dst
  13922. dst += 4
  13923. *(*Twchar_t)(unsafe.Pointer(v23)) = libc.Int32FromUint32(c)
  13924. return dst
  13925. }
  13926. }
  13927. }
  13928. if iswextra != 0 || c&uint32(0177) == uint32(' ') || flags&int32(m_VIS_OCTAL1) != 0 {
  13929. v24 = dst
  13930. dst += 4
  13931. *(*Twchar_t)(unsafe.Pointer(v24)) = int32('\\')
  13932. v25 = dst
  13933. dst += 4
  13934. *(*Twchar_t)(unsafe.Pointer(v25)) = libc.Int32FromUint8(uint8(uint32(uint8(c))>>libc.Int32FromInt32(6)&libc.Uint32FromInt32(03))) + int32('0')
  13935. v26 = dst
  13936. dst += 4
  13937. *(*Twchar_t)(unsafe.Pointer(v26)) = libc.Int32FromUint8(uint8(uint32(uint8(c))>>libc.Int32FromInt32(3)&libc.Uint32FromInt32(07))) + int32('0')
  13938. v27 = dst
  13939. dst += 4
  13940. *(*Twchar_t)(unsafe.Pointer(v27)) = libc.Int32FromUint32(c&uint32(07) + uint32('0'))
  13941. } else {
  13942. if flags&int32(m_VIS_NOSLASH1) == 0 {
  13943. v28 = dst
  13944. dst += 4
  13945. *(*Twchar_t)(unsafe.Pointer(v28)) = int32('\\')
  13946. }
  13947. if c&uint32(0200) != 0 {
  13948. c &= uint32(0177)
  13949. v29 = dst
  13950. dst += 4
  13951. *(*Twchar_t)(unsafe.Pointer(v29)) = int32('M')
  13952. }
  13953. if libc.Xiswcntrl(tls, c) != 0 {
  13954. v30 = dst
  13955. dst += 4
  13956. *(*Twchar_t)(unsafe.Pointer(v30)) = int32('^')
  13957. if c == uint32(0177) {
  13958. v31 = dst
  13959. dst += 4
  13960. *(*Twchar_t)(unsafe.Pointer(v31)) = int32('?')
  13961. } else {
  13962. v32 = dst
  13963. dst += 4
  13964. *(*Twchar_t)(unsafe.Pointer(v32)) = libc.Int32FromUint32(c + uint32('@'))
  13965. }
  13966. } else {
  13967. v33 = dst
  13968. dst += 4
  13969. *(*Twchar_t)(unsafe.Pointer(v33)) = int32('-')
  13970. v34 = dst
  13971. dst += 4
  13972. *(*Twchar_t)(unsafe.Pointer(v34)) = libc.Int32FromUint32(c)
  13973. }
  13974. }
  13975. return dst
  13976. }
  13977. // C documentation
  13978. //
  13979. // /*
  13980. // * This is do_vis, the central code of vis.
  13981. // * dst: Pointer to the destination buffer
  13982. // * c: Character to encode
  13983. // * flags: Flags word
  13984. // * nextc: The character following 'c'
  13985. // * extra: Pointer to the list of extra characters to be
  13986. // * backslash-protected.
  13987. // */
  13988. func _do_svis(tls *libc.TLS, dst uintptr, c Twint_t, flags int32, nextc Twint_t, extra uintptr) (r uintptr) {
  13989. var bmsk, wmsk Tuint64_t
  13990. var i, iswextra, shft, v1 int32
  13991. var v2 bool
  13992. var v3 uintptr
  13993. _, _, _, _, _, _, _, _ = bmsk, i, iswextra, shft, wmsk, v1, v2, v3
  13994. iswextra = libc.BoolInt32(libc.Xwcschr(tls, extra, libc.Int32FromUint32(c)) != libc.UintptrFromInt32(0))
  13995. if v2 = !(iswextra != 0); v2 {
  13996. if flags&int32(m_VIS_NOLOCALE1) != 0 {
  13997. v1 = libc.BoolInt32(c-uint32(0x21) < uint32(0x5e))
  13998. } else {
  13999. v1 = libc.Xiswgraph(tls, c)
  14000. }
  14001. }
  14002. 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'))) {
  14003. v3 = dst
  14004. dst += 4
  14005. *(*Twchar_t)(unsafe.Pointer(v3)) = libc.Int32FromUint32(c)
  14006. return dst
  14007. }
  14008. /* See comment in istrsenvisx() output loop, below. */
  14009. wmsk = uint64(0)
  14010. i = libc.Int32FromUint64(libc.Uint64FromInt64(8) - libc.Uint64FromInt32(1))
  14011. for {
  14012. if !(i >= 0) {
  14013. break
  14014. }
  14015. shft = i * int32(m_CHAR_BIT)
  14016. bmsk = libc.Uint64FromInt64(0xff) << shft
  14017. wmsk |= bmsk
  14018. if uint64(c)&wmsk != 0 || i == 0 {
  14019. dst = _do_mbyte(tls, dst, uint32(uint64(c)&bmsk>>shft), flags, nextc, iswextra)
  14020. }
  14021. goto _4
  14022. _4:
  14023. ;
  14024. i--
  14025. }
  14026. return dst
  14027. }
  14028. type Tvisfun_t = uintptr
  14029. // C documentation
  14030. //
  14031. // /*
  14032. // * Return the appropriate encoding function depending on the flags given.
  14033. // */
  14034. func _getvisfun(tls *libc.TLS, flags int32) (r Tvisfun_t) {
  14035. if flags&int32(m_VIS_HTTPSTYLE1) != 0 {
  14036. return __ccgo_fp(_do_hvis)
  14037. }
  14038. if flags&int32(m_VIS_MIMESTYLE) != 0 {
  14039. return __ccgo_fp(_do_mvis)
  14040. }
  14041. return __ccgo_fp(_do_svis)
  14042. }
  14043. // C documentation
  14044. //
  14045. // /*
  14046. // * Expand list of extra characters to not visually encode.
  14047. // */
  14048. func _makeextralist(tls *libc.TLS, flags int32, src uintptr) (r uintptr) {
  14049. var d, dst, s, v1, v10, v11, v12, v13, v4, v5, v7, v8, v9 uintptr
  14050. var i, len1 Tsize_t
  14051. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = d, dst, i, len1, s, v1, v10, v11, v12, v13, v4, v5, v7, v8, v9
  14052. len1 = libc.Xstrlen(tls, src)
  14053. v1 = libc.Xcalloc(tls, len1+uint64(m_MAXEXTRAS), uint64(4))
  14054. dst = v1
  14055. if v1 == libc.UintptrFromInt32(0) {
  14056. return libc.UintptrFromInt32(0)
  14057. }
  14058. if flags&int32(m_VIS_NOLOCALE1) != 0 || libc.Xmbstowcs(tls, dst, src, len1) == libc.Uint64FromInt32(-libc.Int32FromInt32(1)) {
  14059. i = uint64(0)
  14060. for {
  14061. if !(i < len1) {
  14062. break
  14063. }
  14064. *(*Twchar_t)(unsafe.Pointer(dst + uintptr(i)*4)) = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(src + uintptr(i))))
  14065. goto _2
  14066. _2:
  14067. ;
  14068. i++
  14069. }
  14070. d = dst + uintptr(len1)*4
  14071. } else {
  14072. d = dst + uintptr(libc.Xwcslen(tls, dst))*4
  14073. }
  14074. if flags&int32(m_VIS_GLOB1) != 0 {
  14075. s = uintptr(unsafe.Pointer(&_char_glob))
  14076. for {
  14077. if !(*(*Twchar_t)(unsafe.Pointer(s)) != 0) {
  14078. break
  14079. }
  14080. goto _3
  14081. goto _3
  14082. _3:
  14083. ;
  14084. v4 = d
  14085. d += 4
  14086. v5 = s
  14087. s += 4
  14088. *(*Twchar_t)(unsafe.Pointer(v4)) = *(*Twchar_t)(unsafe.Pointer(v5))
  14089. }
  14090. }
  14091. if flags&int32(m_VIS_SHELL1) != 0 {
  14092. s = uintptr(unsafe.Pointer(&_char_shell))
  14093. for {
  14094. if !(*(*Twchar_t)(unsafe.Pointer(s)) != 0) {
  14095. break
  14096. }
  14097. goto _6
  14098. goto _6
  14099. _6:
  14100. ;
  14101. v7 = d
  14102. d += 4
  14103. v8 = s
  14104. s += 4
  14105. *(*Twchar_t)(unsafe.Pointer(v7)) = *(*Twchar_t)(unsafe.Pointer(v8))
  14106. }
  14107. }
  14108. if flags&int32(m_VIS_SP1) != 0 {
  14109. v9 = d
  14110. d += 4
  14111. *(*Twchar_t)(unsafe.Pointer(v9)) = int32(' ')
  14112. }
  14113. if flags&int32(m_VIS_TAB1) != 0 {
  14114. v10 = d
  14115. d += 4
  14116. *(*Twchar_t)(unsafe.Pointer(v10)) = int32('\t')
  14117. }
  14118. if flags&int32(m_VIS_NL1) != 0 {
  14119. v11 = d
  14120. d += 4
  14121. *(*Twchar_t)(unsafe.Pointer(v11)) = int32('\n')
  14122. }
  14123. if flags&int32(m_VIS_DQ1) != 0 {
  14124. v12 = d
  14125. d += 4
  14126. *(*Twchar_t)(unsafe.Pointer(v12)) = int32('"')
  14127. }
  14128. if flags&int32(m_VIS_NOSLASH1) == 0 {
  14129. v13 = d
  14130. d += 4
  14131. *(*Twchar_t)(unsafe.Pointer(v13)) = int32('\\')
  14132. }
  14133. *(*Twchar_t)(unsafe.Pointer(d)) = int32('\000')
  14134. return dst
  14135. }
  14136. // C documentation
  14137. //
  14138. // /*
  14139. // * istrsenvisx()
  14140. // * The main internal function.
  14141. // * All user-visible functions call this one.
  14142. // */
  14143. func _istrsenvisx(tls *libc.TLS, mbdstp uintptr, dlen uintptr, mbsrc uintptr, mblength Tsize_t, flags int32, mbextra uintptr, cerr_ptr uintptr) (r int32) {
  14144. var bmsk, wmsk Tuint64_t
  14145. var c Twint_t
  14146. var cerr, clen, error1, i, shft, v12, v6 int32
  14147. var dst, extra, mbdst, mdst, pdst, psrc, src, start, v1, v2, v3, v4, v5, v8 uintptr
  14148. var f Tvisfun_t
  14149. var len1, olen Tsize_t
  14150. var maxolen, mbslength Tssize_t
  14151. var v9 uint64
  14152. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  14153. clen = 0
  14154. error1 = -int32(1)
  14155. mbslength = libc.Int64FromUint64(mblength)
  14156. /*
  14157. * When inputing a single character, must also read in the
  14158. * next character for nextc, the look-ahead character.
  14159. */
  14160. if mbslength == int64(1) {
  14161. mbslength++
  14162. }
  14163. /*
  14164. * Input (mbsrc) is a char string considered to be multibyte
  14165. * characters. The input loop will read this string pulling
  14166. * one character, possibly multiple bytes, from mbsrc and
  14167. * converting each to wchar_t in src.
  14168. *
  14169. * The vis conversion will be done using the wide char
  14170. * wchar_t string.
  14171. *
  14172. * This will then be converted back to a multibyte string to
  14173. * return to the caller.
  14174. */
  14175. /* Allocate space for the wide char strings */
  14176. v2 = libc.UintptrFromInt32(0)
  14177. extra = v2
  14178. v1 = v2
  14179. pdst = v1
  14180. psrc = v1
  14181. mdst = libc.UintptrFromInt32(0)
  14182. v3 = libc.Xcalloc(tls, libc.Uint64FromInt64(mbslength+int64(1)), uint64(4))
  14183. psrc = v3
  14184. if v3 == libc.UintptrFromInt32(0) {
  14185. return -int32(1)
  14186. }
  14187. v4 = libc.Xcalloc(tls, libc.Uint64FromInt64(int64(16)*mbslength+int64(1)), uint64(4))
  14188. pdst = v4
  14189. if v4 == libc.UintptrFromInt32(0) {
  14190. goto out
  14191. }
  14192. if *(*uintptr)(unsafe.Pointer(mbdstp)) == libc.UintptrFromInt32(0) {
  14193. v5 = libc.Xcalloc(tls, libc.Uint64FromInt64(int64(16)*mbslength+int64(1)), uint64(1))
  14194. mdst = v5
  14195. if v5 == libc.UintptrFromInt32(0) {
  14196. goto out
  14197. }
  14198. *(*uintptr)(unsafe.Pointer(mbdstp)) = mdst
  14199. }
  14200. mbdst = *(*uintptr)(unsafe.Pointer(mbdstp))
  14201. dst = pdst
  14202. src = psrc
  14203. if flags&int32(m_VIS_NOLOCALE1) != 0 {
  14204. /* Do one byte at a time conversion */
  14205. cerr = int32(1)
  14206. } else {
  14207. /* Use caller's multibyte conversion error flag. */
  14208. if cerr_ptr != 0 {
  14209. v6 = *(*int32)(unsafe.Pointer(cerr_ptr))
  14210. } else {
  14211. v6 = 0
  14212. }
  14213. cerr = v6
  14214. }
  14215. /*
  14216. * Input loop.
  14217. * Handle up to mblength characters (not bytes). We do not
  14218. * stop at NULs because we may be processing a block of data
  14219. * that includes NULs.
  14220. */
  14221. for mbslength > 0 {
  14222. /* Convert one multibyte character to wchar_t. */
  14223. if !(cerr != 0) {
  14224. clen = libc.Xmbtowc(tls, src, mbsrc, uint64(m_MB_LEN_MAX))
  14225. }
  14226. if cerr != 0 || clen < 0 {
  14227. /* Conversion error, process as a byte instead. */
  14228. *(*Twchar_t)(unsafe.Pointer(src)) = libc.Int32FromUint32(uint32(*(*uint8)(unsafe.Pointer(mbsrc))))
  14229. clen = int32(1)
  14230. cerr = int32(1)
  14231. }
  14232. if clen == 0 {
  14233. /*
  14234. * NUL in input gives 0 return value. process
  14235. * as single NUL byte and keep going.
  14236. */
  14237. clen = int32(1)
  14238. }
  14239. /* Advance buffer character pointer. */
  14240. src += 4
  14241. /* Advance input pointer by number of bytes read. */
  14242. mbsrc += uintptr(clen)
  14243. /* Decrement input byte count. */
  14244. mbslength -= int64(clen)
  14245. }
  14246. len1 = libc.Uint64FromInt64((int64(src) - int64(psrc)) / 4)
  14247. src = psrc
  14248. /*
  14249. * In the single character input case, we will have actually
  14250. * processed two characters, c and nextc. Reset len back to
  14251. * just a single character.
  14252. */
  14253. if mblength < len1 {
  14254. len1 = mblength
  14255. }
  14256. /* Convert extra argument to list of characters for this mode. */
  14257. extra = _makeextralist(tls, flags, mbextra)
  14258. if !(extra != 0) {
  14259. if dlen != 0 && *(*Tsize_t)(unsafe.Pointer(dlen)) == uint64(0) {
  14260. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14261. goto out
  14262. }
  14263. *(*uint8)(unsafe.Pointer(mbdst)) = uint8('\000') /* can't create extra, return "" */
  14264. error1 = 0
  14265. goto out
  14266. }
  14267. /* Look up which processing function to call. */
  14268. f = _getvisfun(tls, flags)
  14269. /*
  14270. * Main processing loop.
  14271. * Call do_Xvis processing function one character at a time
  14272. * with next character available for look-ahead.
  14273. */
  14274. start = dst
  14275. for {
  14276. if !(len1 > uint64(0)) {
  14277. break
  14278. }
  14279. v8 = src
  14280. src += 4
  14281. c = libc.Uint32FromInt32(*(*Twchar_t)(unsafe.Pointer(v8)))
  14282. dst = (*(*func(*libc.TLS, uintptr, Twint_t, int32, Twint_t, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{f})))(tls, dst, c, flags, libc.Uint32FromInt32(*(*Twchar_t)(unsafe.Pointer(src))), extra)
  14283. if dst == libc.UintptrFromInt32(0) {
  14284. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14285. goto out
  14286. }
  14287. goto _7
  14288. _7:
  14289. ;
  14290. len1--
  14291. }
  14292. /* Terminate the string in the buffer. */
  14293. *(*Twchar_t)(unsafe.Pointer(dst)) = int32('\000')
  14294. /*
  14295. * Output loop.
  14296. * Convert wchar_t string back to multibyte output string.
  14297. * If we have hit a multi-byte conversion error on input,
  14298. * output byte-by-byte here. Else use wctomb().
  14299. */
  14300. len1 = libc.Xwcslen(tls, start)
  14301. if dlen != 0 {
  14302. v9 = *(*Tsize_t)(unsafe.Pointer(dlen))
  14303. } else {
  14304. v9 = libc.Xwcslen(tls, start)*uint64(m_MB_LEN_MAX) + uint64(1)
  14305. }
  14306. maxolen = libc.Int64FromUint64(v9)
  14307. olen = uint64(0)
  14308. dst = start
  14309. for {
  14310. if !(len1 > uint64(0)) {
  14311. break
  14312. }
  14313. if !(cerr != 0) {
  14314. clen = libc.Xwctomb(tls, mbdst, *(*Twchar_t)(unsafe.Pointer(dst)))
  14315. }
  14316. if cerr != 0 || clen < 0 {
  14317. /*
  14318. * Conversion error, process as a byte(s) instead.
  14319. * Examine each byte and higher-order bytes for
  14320. * data. E.g.,
  14321. * 0x000000000000a264 -> a2 64
  14322. * 0x000000001f00a264 -> 1f 00 a2 64
  14323. */
  14324. clen = 0
  14325. wmsk = uint64(0)
  14326. i = libc.Int32FromUint64(libc.Uint64FromInt64(8) - libc.Uint64FromInt32(1))
  14327. for {
  14328. if !(i >= 0) {
  14329. break
  14330. }
  14331. shft = i * int32(m_CHAR_BIT)
  14332. bmsk = libc.Uint64FromInt64(0xff) << shft
  14333. wmsk |= bmsk
  14334. if libc.Uint64FromInt32(*(*Twchar_t)(unsafe.Pointer(dst)))&wmsk != 0 || i == 0 {
  14335. v12 = clen
  14336. clen++
  14337. *(*uint8)(unsafe.Pointer(mbdst + uintptr(v12))) = uint8(libc.Uint64FromInt32(*(*Twchar_t)(unsafe.Pointer(dst))) & bmsk >> shft)
  14338. }
  14339. goto _11
  14340. _11:
  14341. ;
  14342. i--
  14343. }
  14344. cerr = int32(1)
  14345. }
  14346. /* If this character would exceed our output limit, stop. */
  14347. if olen+libc.Uint64FromInt32(clen) > libc.Uint64FromInt64(maxolen) {
  14348. break
  14349. }
  14350. /* Advance output pointer by number of bytes written. */
  14351. mbdst += uintptr(clen)
  14352. /* Advance buffer character pointer. */
  14353. dst += 4
  14354. /* Incrment output character count. */
  14355. olen += libc.Uint64FromInt32(clen)
  14356. goto _10
  14357. _10:
  14358. ;
  14359. len1--
  14360. }
  14361. /* Terminate the output string. */
  14362. *(*uint8)(unsafe.Pointer(mbdst)) = uint8('\000')
  14363. if flags&int32(m_VIS_NOLOCALE1) != 0 {
  14364. /* Pass conversion error flag out. */
  14365. if cerr_ptr != 0 {
  14366. *(*int32)(unsafe.Pointer(cerr_ptr)) = cerr
  14367. }
  14368. }
  14369. libc.Xfree(tls, extra)
  14370. libc.Xfree(tls, pdst)
  14371. libc.Xfree(tls, psrc)
  14372. return libc.Int32FromUint64(olen)
  14373. goto out
  14374. out:
  14375. ;
  14376. libc.Xfree(tls, extra)
  14377. libc.Xfree(tls, pdst)
  14378. libc.Xfree(tls, psrc)
  14379. libc.Xfree(tls, mdst)
  14380. return error1
  14381. }
  14382. func _istrsenvisxna(tls *libc.TLS, _mbdst uintptr, dlen uintptr, mbsrc uintptr, mblength Tsize_t, flags int32, mbextra uintptr, cerr_ptr uintptr) (r int32) {
  14383. bp := tls.Alloc(16)
  14384. defer tls.Free(16)
  14385. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  14386. return _istrsenvisx(tls, bp, dlen, mbsrc, mblength, flags, mbextra, cerr_ptr)
  14387. }
  14388. func _istrsenvisxl(tls *libc.TLS, mbdst uintptr, dlen uintptr, mbsrc uintptr, flags int32, mbextra uintptr, cerr_ptr uintptr) (r int32) {
  14389. var v1 uint64
  14390. _ = v1
  14391. if mbsrc != libc.UintptrFromInt32(0) {
  14392. v1 = libc.Xstrlen(tls, mbsrc)
  14393. } else {
  14394. v1 = uint64(0)
  14395. }
  14396. return _istrsenvisxna(tls, mbdst, dlen, mbsrc, v1, flags, mbextra, cerr_ptr)
  14397. }
  14398. /*
  14399. * The "svis" variants all take an "extra" arg that is a pointer
  14400. * to a NUL-terminated list of characters to be encoded, too.
  14401. * These functions are useful e. g. to encode strings in such a
  14402. * way so that they are not interpreted by a shell.
  14403. */
  14404. func Xsvis(tls *libc.TLS, _mbdst uintptr, c int32, flags int32, nextc int32, mbextra uintptr) (r uintptr) {
  14405. bp := tls.Alloc(16)
  14406. defer tls.Free(16)
  14407. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  14408. var ret int32
  14409. var _ /* cc at bp+8 */ [2]uint8
  14410. _ = ret
  14411. (*(*[2]uint8)(unsafe.Pointer(bp + 8)))[0] = libc.Uint8FromInt32(c)
  14412. (*(*[2]uint8)(unsafe.Pointer(bp + 8)))[int32(1)] = libc.Uint8FromInt32(nextc)
  14413. ret = _istrsenvisx(tls, bp, libc.UintptrFromInt32(0), bp+8, uint64(1), flags, mbextra, libc.UintptrFromInt32(0))
  14414. if ret < 0 {
  14415. return libc.UintptrFromInt32(0)
  14416. }
  14417. return *(*uintptr)(unsafe.Pointer(bp)) + uintptr(ret)
  14418. }
  14419. func Xsnvis(tls *libc.TLS, _mbdst uintptr, _dlen Tsize_t, c int32, flags int32, nextc int32, mbextra uintptr) (r uintptr) {
  14420. bp := tls.Alloc(32)
  14421. defer tls.Free(32)
  14422. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  14423. *(*Tsize_t)(unsafe.Pointer(bp + 8)) = _dlen
  14424. var ret int32
  14425. var _ /* cc at bp+16 */ [2]uint8
  14426. _ = ret
  14427. (*(*[2]uint8)(unsafe.Pointer(bp + 16)))[0] = libc.Uint8FromInt32(c)
  14428. (*(*[2]uint8)(unsafe.Pointer(bp + 16)))[int32(1)] = libc.Uint8FromInt32(nextc)
  14429. ret = _istrsenvisx(tls, bp, bp+8, bp+16, uint64(1), flags, mbextra, libc.UintptrFromInt32(0))
  14430. if ret < 0 {
  14431. return libc.UintptrFromInt32(0)
  14432. }
  14433. return *(*uintptr)(unsafe.Pointer(bp)) + uintptr(ret)
  14434. }
  14435. func Xstrsvis(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, flags int32, mbextra uintptr) (r int32) {
  14436. return _istrsenvisxl(tls, mbdst, libc.UintptrFromInt32(0), mbsrc, flags, mbextra, libc.UintptrFromInt32(0))
  14437. }
  14438. func Xstrsnvis(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, flags int32, mbextra uintptr) (r int32) {
  14439. bp := tls.Alloc(16)
  14440. defer tls.Free(16)
  14441. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  14442. return _istrsenvisxl(tls, mbdst, bp, mbsrc, flags, mbextra, libc.UintptrFromInt32(0))
  14443. }
  14444. func Xstrsvisx(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, len1 Tsize_t, flags int32, mbextra uintptr) (r int32) {
  14445. return _istrsenvisxna(tls, mbdst, libc.UintptrFromInt32(0), mbsrc, len1, flags, mbextra, libc.UintptrFromInt32(0))
  14446. }
  14447. func Xstrsnvisx(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, len1 Tsize_t, flags int32, mbextra uintptr) (r int32) {
  14448. bp := tls.Alloc(16)
  14449. defer tls.Free(16)
  14450. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  14451. return _istrsenvisxna(tls, mbdst, bp, mbsrc, len1, flags, mbextra, libc.UintptrFromInt32(0))
  14452. }
  14453. func Xstrsenvisx(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, len1 Tsize_t, flags int32, mbextra uintptr, cerr_ptr uintptr) (r int32) {
  14454. bp := tls.Alloc(16)
  14455. defer tls.Free(16)
  14456. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  14457. return _istrsenvisxna(tls, mbdst, bp, mbsrc, len1, flags, mbextra, cerr_ptr)
  14458. }
  14459. // C documentation
  14460. //
  14461. // /*
  14462. // * vis - visually encode characters
  14463. // */
  14464. func Xvis(tls *libc.TLS, _mbdst uintptr, c int32, flags int32, nextc int32) (r uintptr) {
  14465. bp := tls.Alloc(16)
  14466. defer tls.Free(16)
  14467. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  14468. var ret int32
  14469. var _ /* cc at bp+8 */ [2]uint8
  14470. _ = ret
  14471. (*(*[2]uint8)(unsafe.Pointer(bp + 8)))[0] = libc.Uint8FromInt32(c)
  14472. (*(*[2]uint8)(unsafe.Pointer(bp + 8)))[int32(1)] = libc.Uint8FromInt32(nextc)
  14473. ret = _istrsenvisx(tls, bp, libc.UintptrFromInt32(0), bp+8, uint64(1), flags, __ccgo_ts+53, libc.UintptrFromInt32(0))
  14474. if ret < 0 {
  14475. return libc.UintptrFromInt32(0)
  14476. }
  14477. return *(*uintptr)(unsafe.Pointer(bp)) + uintptr(ret)
  14478. }
  14479. func Xnvis(tls *libc.TLS, _mbdst uintptr, _dlen Tsize_t, c int32, flags int32, nextc int32) (r uintptr) {
  14480. bp := tls.Alloc(32)
  14481. defer tls.Free(32)
  14482. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  14483. *(*Tsize_t)(unsafe.Pointer(bp + 8)) = _dlen
  14484. var ret int32
  14485. var _ /* cc at bp+16 */ [2]uint8
  14486. _ = ret
  14487. (*(*[2]uint8)(unsafe.Pointer(bp + 16)))[0] = libc.Uint8FromInt32(c)
  14488. (*(*[2]uint8)(unsafe.Pointer(bp + 16)))[int32(1)] = libc.Uint8FromInt32(nextc)
  14489. ret = _istrsenvisx(tls, bp, bp+8, bp+16, uint64(1), flags, __ccgo_ts+53, libc.UintptrFromInt32(0))
  14490. if ret < 0 {
  14491. return libc.UintptrFromInt32(0)
  14492. }
  14493. return *(*uintptr)(unsafe.Pointer(bp)) + uintptr(ret)
  14494. }
  14495. /*
  14496. * strvis - visually encode characters from src into dst
  14497. *
  14498. * Dst must be 4 times the size of src to account for possible
  14499. * expansion. The length of dst, not including the trailing NULL,
  14500. * is returned.
  14501. */
  14502. func Xstrvis(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, flags int32) (r int32) {
  14503. return _istrsenvisxl(tls, mbdst, libc.UintptrFromInt32(0), mbsrc, flags, __ccgo_ts+53, libc.UintptrFromInt32(0))
  14504. }
  14505. // C documentation
  14506. //
  14507. // /*
  14508. // * NetBSD added an strnvis and unfortunately made it incompatible with the
  14509. // * existing one in OpenBSD and Freedesktop's libbsd (the former having existed
  14510. // * for over ten years). Despite this incompatibility being reported during
  14511. // * development (see http://gnats.netbsd.org/44977) they still shipped it.
  14512. // * Even more unfortunately FreeBSD and later MacOS picked up this incompatible
  14513. // * implementation.
  14514. // *
  14515. // * Provide both implementations and default for now on the historical one to
  14516. // * avoid breakage, we will switch to the NetBSD one in libbsd 0.10.0 or so.
  14517. // *
  14518. // * OpenBSD, 2001: strnvis(char *dst, const char *src, size_t dlen, int flag);
  14519. // * NetBSD: 2012, strnvis(char *dst, size_t dlen, const char *src, int flag);
  14520. // */
  14521. func Xstrnvis_openbsd(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, _dlen Tsize_t, flags int32) (r int32) {
  14522. bp := tls.Alloc(16)
  14523. defer tls.Free(16)
  14524. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  14525. return _istrsenvisxl(tls, mbdst, bp, mbsrc, flags, __ccgo_ts+53, libc.UintptrFromInt32(0))
  14526. }
  14527. func Xstrnvis_netbsd(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, flags int32) (r int32) {
  14528. bp := tls.Alloc(16)
  14529. defer tls.Free(16)
  14530. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  14531. return _istrsenvisxl(tls, mbdst, bp, mbsrc, flags, __ccgo_ts+53, libc.UintptrFromInt32(0))
  14532. }
  14533. func Xstravis(tls *libc.TLS, mbdstp uintptr, mbsrc uintptr, flags int32) (r int32) {
  14534. var v1 uint64
  14535. _ = v1
  14536. *(*uintptr)(unsafe.Pointer(mbdstp)) = libc.UintptrFromInt32(0)
  14537. if mbsrc != libc.UintptrFromInt32(0) {
  14538. v1 = libc.Xstrlen(tls, mbsrc)
  14539. } else {
  14540. v1 = uint64(0)
  14541. }
  14542. return _istrsenvisx(tls, mbdstp, libc.UintptrFromInt32(0), mbsrc, v1, flags, __ccgo_ts+53, libc.UintptrFromInt32(0))
  14543. }
  14544. /*
  14545. * strvisx - visually encode characters from src into dst
  14546. *
  14547. * Dst must be 4 times the size of src to account for possible
  14548. * expansion. The length of dst, not including the trailing NULL,
  14549. * is returned.
  14550. *
  14551. * Strvisx encodes exactly len characters from src into dst.
  14552. * This is useful for encoding a block of data.
  14553. */
  14554. func Xstrvisx(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, len1 Tsize_t, flags int32) (r int32) {
  14555. return _istrsenvisxna(tls, mbdst, libc.UintptrFromInt32(0), mbsrc, len1, flags, __ccgo_ts+53, libc.UintptrFromInt32(0))
  14556. }
  14557. func Xstrnvisx(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, len1 Tsize_t, flags int32) (r int32) {
  14558. bp := tls.Alloc(16)
  14559. defer tls.Free(16)
  14560. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  14561. return _istrsenvisxna(tls, mbdst, bp, mbsrc, len1, flags, __ccgo_ts+53, libc.UintptrFromInt32(0))
  14562. }
  14563. func Xstrenvisx(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, len1 Tsize_t, flags int32, cerr_ptr uintptr) (r int32) {
  14564. bp := tls.Alloc(16)
  14565. defer tls.Free(16)
  14566. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  14567. return _istrsenvisxna(tls, mbdst, bp, mbsrc, len1, flags, __ccgo_ts+53, cerr_ptr)
  14568. }
  14569. // C documentation
  14570. //
  14571. // /*
  14572. // * Appends src to string dst of size siz (unlike wcsncat, siz is the
  14573. // * full size of dst, not space left). At most siz-1 characters
  14574. // * will be copied. Always NUL terminates (unless siz == 0).
  14575. // * Returns wcslen(initial dst) + wcslen(src); if retval >= siz,
  14576. // * truncation occurred.
  14577. // */
  14578. func Xwcslcat(tls *libc.TLS, dst uintptr, src uintptr, siz Tsize_t) (r Tsize_t) {
  14579. var d, s, v3 uintptr
  14580. var dlen, n, v1 Tsize_t
  14581. var v2 bool
  14582. _, _, _, _, _, _, _ = d, dlen, n, s, v1, v2, v3
  14583. d = dst
  14584. s = src
  14585. n = siz
  14586. /* Find the end of dst and adjust bytes left but don't go past end */
  14587. for {
  14588. if v2 = *(*Twchar_t)(unsafe.Pointer(d)) != int32('\000'); v2 {
  14589. v1 = n
  14590. n--
  14591. }
  14592. if !(v2 && v1 != uint64(0)) {
  14593. break
  14594. }
  14595. d += 4
  14596. }
  14597. dlen = libc.Uint64FromInt64((int64(d) - int64(dst)) / 4)
  14598. n = siz - dlen
  14599. if n == uint64(0) {
  14600. return dlen + libc.Xwcslen(tls, s)
  14601. }
  14602. for *(*Twchar_t)(unsafe.Pointer(s)) != int32('\000') {
  14603. if n != uint64(1) {
  14604. v3 = d
  14605. d += 4
  14606. *(*Twchar_t)(unsafe.Pointer(v3)) = *(*Twchar_t)(unsafe.Pointer(s))
  14607. n--
  14608. }
  14609. s += 4
  14610. }
  14611. *(*Twchar_t)(unsafe.Pointer(d)) = int32('\000')
  14612. return dlen + libc.Uint64FromInt64((int64(s)-int64(src))/4) /* count does not include NUL */
  14613. }
  14614. // C documentation
  14615. //
  14616. // /*
  14617. // * Copy src to string dst of size siz. At most siz-1 characters
  14618. // * will be copied. Always NUL terminates (unless siz == 0).
  14619. // * Returns wcslen(src); if retval >= siz, truncation occurred.
  14620. // */
  14621. func Xwcslcpy(tls *libc.TLS, dst uintptr, src uintptr, siz Tsize_t) (r Tsize_t) {
  14622. var d, s, v6, v7, v8 uintptr
  14623. var n, v1, v3 Tsize_t
  14624. var v2 bool
  14625. var v5 Twchar_t
  14626. _, _, _, _, _, _, _, _, _, _ = d, n, s, v1, v2, v3, v5, v6, v7, v8
  14627. d = dst
  14628. s = src
  14629. n = siz
  14630. /* Copy as many bytes as will fit */
  14631. if v2 = n != uint64(0); v2 {
  14632. n--
  14633. v1 = n
  14634. }
  14635. if v2 && v1 != uint64(0) {
  14636. for {
  14637. v6 = s
  14638. s += 4
  14639. v5 = *(*Twchar_t)(unsafe.Pointer(v6))
  14640. v7 = d
  14641. d += 4
  14642. *(*Twchar_t)(unsafe.Pointer(v7)) = v5
  14643. if v5 == 0 {
  14644. break
  14645. }
  14646. goto _4
  14647. _4:
  14648. ;
  14649. n--
  14650. v3 = n
  14651. if !(v3 != uint64(0)) {
  14652. break
  14653. }
  14654. }
  14655. }
  14656. /* Not enough room in dst, add NUL and traverse rest of src */
  14657. if n == uint64(0) {
  14658. if siz != uint64(0) {
  14659. *(*Twchar_t)(unsafe.Pointer(d)) = int32('\000')
  14660. } /* NUL-terminate dst */
  14661. for {
  14662. v8 = s
  14663. s += 4
  14664. if !(*(*Twchar_t)(unsafe.Pointer(v8)) != 0) {
  14665. break
  14666. }
  14667. }
  14668. }
  14669. return libc.Uint64FromInt64((int64(s)-int64(src))/4 - libc.Int64FromInt32(1)) /* count does not include NUL */
  14670. }
  14671. const m_CTL_MAXNAME = 10
  14672. const m_ECHO1 = 0000010
  14673. const m_ECHONL1 = 0000100
  14674. const m_ELFMAG01 = 0x7f
  14675. const m_ELFMAG11 = 'E'
  14676. const m_ELFMAG21 = 'L'
  14677. const m_ELFMAG31 = 'F'
  14678. const m_FIOASYNC = 0x5452
  14679. const m_FIOCLEX = 0x5451
  14680. const m_FIOGETOWN = 0x8903
  14681. const m_FIONBIO = 0x5421
  14682. const m_FIONCLEX = 0x5450
  14683. const m_FIONREAD = 0x541B
  14684. const m_FIOSETOWN = 0x8901
  14685. const m_GRND_INSECURE = 0x0004
  14686. const m_GRND_NONBLOCK = 1
  14687. const m_GRND_RANDOM = 0x0002
  14688. const m_HWCAP_S390_DFP = 64
  14689. const m_HWCAP_S390_EIMM = 32
  14690. const m_HWCAP_S390_ESAN3 = 1
  14691. const m_HWCAP_S390_ETF3EH = 256
  14692. const m_HWCAP_S390_GS = 16384
  14693. const m_HWCAP_S390_HIGH_GPRS = 512
  14694. const m_HWCAP_S390_HPAGE = 128
  14695. const m_HWCAP_S390_LDISP = 16
  14696. const m_HWCAP_S390_MSA = 8
  14697. const m_HWCAP_S390_STFLE = 4
  14698. const m_HWCAP_S390_TE = 1024
  14699. const m_HWCAP_S390_VXRS = 2048
  14700. const m_HWCAP_S390_VXRS_BCD = 4096
  14701. const m_HWCAP_S390_VXRS_EXT = 8192
  14702. const m_HWCAP_S390_ZARCH = 2
  14703. const m_IOCSIZE_SHIFT = "_IOC_SIZESHIFT"
  14704. const m_MAP_ANON2 = 32
  14705. const m_MAP_PRIVATE2 = 2
  14706. const m_MNT_DETACH = 2
  14707. const m_MNT_EXPIRE = 4
  14708. const m_MNT_FORCE = 1
  14709. const m_MS_BIND = 4096
  14710. const m_MS_DIRSYNC = 128
  14711. const m_MS_MANDLOCK = 64
  14712. const m_MS_MGC_MSK = 0xffff0000
  14713. const m_MS_MGC_VAL = 0xc0ed0000
  14714. const m_MS_MOVE = 8192
  14715. const m_MS_NOATIME = 1024
  14716. const m_MS_NODEV = 4
  14717. const m_MS_NODIRATIME = 2048
  14718. const m_MS_NOEXEC = 8
  14719. const m_MS_NOSUID = 2
  14720. const m_MS_NOSYMFOLLOW = 256
  14721. const m_MS_RDONLY = 1
  14722. const m_MS_REC = 16384
  14723. const m_MS_REMOUNT = 32
  14724. const m_MS_SILENT = 32768
  14725. const m_MS_SYNCHRONOUS = 16
  14726. const m_N_6PACK = 7
  14727. const m_N_AX25 = 5
  14728. const m_N_CAIF = 20
  14729. const m_N_GIGASET_M101 = 16
  14730. const m_N_GSM0710 = 21
  14731. const m_N_HCI = 15
  14732. const m_N_HDLC = 13
  14733. const m_N_IRDA = 11
  14734. const m_N_MASC = 8
  14735. const m_N_MOUSE = 2
  14736. const m_N_NCI = 25
  14737. const m_N_NULL = 27
  14738. const m_N_PPP = 3
  14739. const m_N_PPS = 18
  14740. const m_N_PROFIBUS_FDL = 10
  14741. const m_N_R3964 = 9
  14742. const m_N_SLCAN = 17
  14743. const m_N_SLIP = 1
  14744. const m_N_SMSBLOCK = 12
  14745. const m_N_SPEAKUP = 26
  14746. const m_N_STRIP = 4
  14747. const m_N_SYNC_PPP = 14
  14748. const m_N_TI_WL = 22
  14749. const m_N_TRACEROUTER = 24
  14750. const m_N_TRACESINK = 23
  14751. const m_N_TTY = 0
  14752. const m_N_V253 = 19
  14753. const m_N_X25 = 6
  14754. const m_O_CLOEXEC1 = 524288
  14755. const m_O_NOFOLLOW1 = 131072
  14756. const m_O_RDONLY3 = 0
  14757. const m_O_RDWR2 = 02
  14758. const m_REPEAT = 5
  14759. const m_SHA256_BLOCK_LENGTH = 64
  14760. const m_SHA256_DIGEST_LENGTH = 32
  14761. const m_SHA384_BLOCK_LENGTH = 128
  14762. const m_SHA384_DIGEST_LENGTH = 48
  14763. const m_SHA384_Data = "SHA384Data"
  14764. const m_SHA384_End = "SHA384End"
  14765. const m_SHA384_File = "SHA384File"
  14766. const m_SHA384_FileChunk = "SHA384FileChunk"
  14767. const m_SHA384_Final = "SHA384Final"
  14768. const m_SHA384_Init = "SHA384Init"
  14769. const m_SHA384_Update = "SHA384Update"
  14770. const m_SHA512_BLOCK_LENGTH = 128
  14771. const m_SHA512_DIGEST_LENGTH = 64
  14772. const m_SHA512_Data = "SHA512Data"
  14773. const m_SHA512_End = "SHA512End"
  14774. const m_SHA512_File = "SHA512File"
  14775. const m_SHA512_FileChunk = "SHA512FileChunk"
  14776. const m_SHA512_Final = "SHA512Final"
  14777. const m_SHA512_Init = "SHA512Init"
  14778. const m_SHA512_Update = "SHA512Update"
  14779. const m_SHN_ABS1 = 0xfff1
  14780. const m_SHN_COMMON1 = 0xfff2
  14781. const m_SIOCADDDLCI = 0x8980
  14782. const m_SIOCADDMULTI = 0x8931
  14783. const m_SIOCADDRT = 0x890B
  14784. const m_SIOCATMARK = 0x8905
  14785. const m_SIOCDARP = 0x8953
  14786. const m_SIOCDELDLCI = 0x8981
  14787. const m_SIOCDELMULTI = 0x8932
  14788. const m_SIOCDELRT = 0x890C
  14789. const m_SIOCDEVPRIVATE = 0x89F0
  14790. const m_SIOCDIFADDR = 0x8936
  14791. const m_SIOCDRARP = 0x8960
  14792. const m_SIOCGARP = 0x8954
  14793. const m_SIOCGIFADDR = 0x8915
  14794. const m_SIOCGIFBR = 0x8940
  14795. const m_SIOCGIFBRDADDR = 0x8919
  14796. const m_SIOCGIFCONF = 0x8912
  14797. const m_SIOCGIFCOUNT = 0x8938
  14798. const m_SIOCGIFDSTADDR = 0x8917
  14799. const m_SIOCGIFENCAP = 0x8925
  14800. const m_SIOCGIFFLAGS = 0x8913
  14801. const m_SIOCGIFHWADDR = 0x8927
  14802. const m_SIOCGIFINDEX = 0x8933
  14803. const m_SIOCGIFMAP = 0x8970
  14804. const m_SIOCGIFMEM = 0x891f
  14805. const m_SIOCGIFMETRIC = 0x891d
  14806. const m_SIOCGIFMTU = 0x8921
  14807. const m_SIOCGIFNAME = 0x8910
  14808. const m_SIOCGIFNETMASK = 0x891b
  14809. const m_SIOCGIFPFLAGS = 0x8935
  14810. const m_SIOCGIFSLAVE = 0x8929
  14811. const m_SIOCGIFTXQLEN = 0x8942
  14812. const m_SIOCGPGRP = 0x8904
  14813. const m_SIOCGRARP = 0x8961
  14814. const m_SIOCGSTAMP = 0x8906
  14815. const m_SIOCGSTAMPNS = 0x8907
  14816. const m_SIOCPROTOPRIVATE = 0x89E0
  14817. const m_SIOCRTMSG = 0x890D
  14818. const m_SIOCSARP = 0x8955
  14819. const m_SIOCSIFADDR = 0x8916
  14820. const m_SIOCSIFBR = 0x8941
  14821. const m_SIOCSIFBRDADDR = 0x891a
  14822. const m_SIOCSIFDSTADDR = 0x8918
  14823. const m_SIOCSIFENCAP = 0x8926
  14824. const m_SIOCSIFFLAGS = 0x8914
  14825. const m_SIOCSIFHWADDR = 0x8924
  14826. const m_SIOCSIFHWBROADCAST = 0x8937
  14827. const m_SIOCSIFLINK = 0x8911
  14828. const m_SIOCSIFMAP = 0x8971
  14829. const m_SIOCSIFMEM = 0x8920
  14830. const m_SIOCSIFMETRIC = 0x891e
  14831. const m_SIOCSIFMTU = 0x8922
  14832. const m_SIOCSIFNAME = 0x8923
  14833. const m_SIOCSIFNETMASK = 0x891c
  14834. const m_SIOCSIFPFLAGS = 0x8934
  14835. const m_SIOCSIFSLAVE = 0x8930
  14836. const m_SIOCSIFTXQLEN = 0x8943
  14837. const m_SIOCSPGRP = 0x8902
  14838. const m_SIOCSRARP = 0x8962
  14839. const m_SIOGIFINDEX = "SIOCGIFINDEX"
  14840. const m_ST_APPEND = 256
  14841. const m_ST_IMMUTABLE = 512
  14842. const m_ST_MANDLOCK = 64
  14843. const m_ST_NOATIME = 1024
  14844. const m_ST_NODEV = 4
  14845. const m_ST_NODIRATIME = 2048
  14846. const m_ST_NOEXEC = 8
  14847. const m_ST_NOSUID = 2
  14848. const m_ST_RDONLY = 1
  14849. const m_ST_RELATIME = 4096
  14850. const m_ST_SYNCHRONOUS = 16
  14851. const m_ST_WRITE = 128
  14852. const m_S_IFCHR3 = 8192
  14853. const m_S_IFIFO3 = 4096
  14854. const m_S_IFMT3 = 61440
  14855. const m_S_IFREG3 = 32768
  14856. const m_S_IFSOCK3 = 49152
  14857. const m_TCFLSH = 0x540B
  14858. const m_TCGETA = 0x5405
  14859. const m_TCGETS = 0x5401
  14860. const m_TCGETX = 0x5432
  14861. const m_TCSBRK = 0x5409
  14862. const m_TCSBRKP = 0x5425
  14863. const m_TCSETA = 0x5406
  14864. const m_TCSETAF = 0x5408
  14865. const m_TCSETAW = 0x5407
  14866. const m_TCSETS = 0x5402
  14867. const m_TCSETSF = 0x5404
  14868. const m_TCSETSW = 0x5403
  14869. const m_TCSETX = 0x5433
  14870. const m_TCSETXF = 0x5434
  14871. const m_TCSETXW = 0x5435
  14872. const m_TCXONC = 0x540A
  14873. const m_TIOCCBRK = 0x5428
  14874. const m_TIOCCONS = 0x541D
  14875. const m_TIOCEXCL = 0x540C
  14876. const m_TIOCGDEV = 0x80045432
  14877. const m_TIOCGETD = 0x5424
  14878. const m_TIOCGEXCL = 0x80045440
  14879. const m_TIOCGICOUNT = 0x545D
  14880. const m_TIOCGISO7816 = 0x80285442
  14881. const m_TIOCGLCKTRMIOS = 0x5456
  14882. const m_TIOCGPGRP = 0x540F
  14883. const m_TIOCGPKT = 0x80045438
  14884. const m_TIOCGPTLCK = 0x80045439
  14885. const m_TIOCGPTN = 0x80045430
  14886. const m_TIOCGPTPEER = 0x5441
  14887. const m_TIOCGRS485 = 0x542E
  14888. const m_TIOCGSERIAL = 0x541E
  14889. const m_TIOCGSID = 0x5429
  14890. const m_TIOCGSOFTCAR = 0x5419
  14891. const m_TIOCGWINSZ = 0x5413
  14892. const m_TIOCINQ = "FIONREAD"
  14893. const m_TIOCLINUX = 0x541C
  14894. const m_TIOCMBIC = 0x5417
  14895. const m_TIOCMBIS = 0x5416
  14896. const m_TIOCMGET = 0x5415
  14897. const m_TIOCMIWAIT = 0x545C
  14898. const m_TIOCMSET = 0x5418
  14899. const m_TIOCM_CAR = 0x040
  14900. const m_TIOCM_CD = "TIOCM_CAR"
  14901. const m_TIOCM_CTS = 0x020
  14902. const m_TIOCM_DSR = 0x100
  14903. const m_TIOCM_DTR = 0x002
  14904. const m_TIOCM_LE = 0x001
  14905. const m_TIOCM_LOOP = 0x8000
  14906. const m_TIOCM_OUT1 = 0x2000
  14907. const m_TIOCM_OUT2 = 0x4000
  14908. const m_TIOCM_RI = "TIOCM_RNG"
  14909. const m_TIOCM_RNG = 0x080
  14910. const m_TIOCM_RTS = 0x004
  14911. const m_TIOCM_SR = 0x010
  14912. const m_TIOCM_ST = 0x008
  14913. const m_TIOCNOTTY = 0x5422
  14914. const m_TIOCNXCL = 0x540D
  14915. const m_TIOCOUTQ = 0x5411
  14916. const m_TIOCPKT = 0x5420
  14917. const m_TIOCPKT_DATA = 0
  14918. const m_TIOCPKT_DOSTOP = 32
  14919. const m_TIOCPKT_FLUSHREAD = 1
  14920. const m_TIOCPKT_FLUSHWRITE = 2
  14921. const m_TIOCPKT_IOCTL = 64
  14922. const m_TIOCPKT_NOSTOP = 16
  14923. const m_TIOCPKT_START = 8
  14924. const m_TIOCPKT_STOP = 4
  14925. const m_TIOCSBRK = 0x5427
  14926. const m_TIOCSCTTY = 0x540E
  14927. const m_TIOCSERCONFIG = 0x5453
  14928. const m_TIOCSERGETLSR = 0x5459
  14929. const m_TIOCSERGETMULTI = 0x545A
  14930. const m_TIOCSERGSTRUCT = 0x5458
  14931. const m_TIOCSERGWILD = 0x5454
  14932. const m_TIOCSERSETMULTI = 0x545B
  14933. const m_TIOCSERSWILD = 0x5455
  14934. const m_TIOCSER_TEMT = 1
  14935. const m_TIOCSETD = 0x5423
  14936. const m_TIOCSIG = 0x40045436
  14937. const m_TIOCSISO7816 = 0xc0285443
  14938. const m_TIOCSLCKTRMIOS = 0x5457
  14939. const m_TIOCSPGRP = 0x5410
  14940. const m_TIOCSPTLCK = 0x40045431
  14941. const m_TIOCSRS485 = 0x542F
  14942. const m_TIOCSSERIAL = 0x541F
  14943. const m_TIOCSSOFTCAR = 0x541A
  14944. const m_TIOCSTI = 0x5412
  14945. const m_TIOCSWINSZ = 0x5414
  14946. const m_TIOCVHANGUP = 0x5437
  14947. const m_UMOUNT_NOFOLLOW = 8
  14948. const m__IOC_DIRBITS = 2
  14949. const m__IOC_NONE = 0
  14950. const m__IOC_NRBITS = 8
  14951. const m__IOC_NRSHIFT = 0
  14952. const m__IOC_READ = 2
  14953. const m__IOC_SIZEBITS = 14
  14954. const m__IOC_TYPEBITS = 8
  14955. const m__IOC_WRITE = 1
  14956. const m__POSIX_C_SOURCE = 199309
  14957. const m___BITS_PER_LONG = 64
  14958. const m___bitwise = "__bitwise__"
  14959. type t__s8 = int8
  14960. type t__u8 = uint8
  14961. type t__s16 = int16
  14962. type t__u16 = uint16
  14963. type t__s32 = int32
  14964. type t__u32 = uint32
  14965. type t__s64 = int64
  14966. type t__u64 = uint64
  14967. type Taddr_t = uint64
  14968. type Tsaddr_t = int64
  14969. type t__vector128 = struct {
  14970. Fu [4]t__u32
  14971. }
  14972. type t__kernel_fd_set = struct {
  14973. Ffds_bits [16]uint64
  14974. }
  14975. type t__kernel_sighandler_t = uintptr
  14976. type t__kernel_key_t = int32
  14977. type t__kernel_mqd_t = int32
  14978. type t__kernel_size_t = uint64
  14979. type t__kernel_ssize_t = int64
  14980. type t__kernel_old_dev_t = uint16
  14981. type t__kernel_ino_t = uint32
  14982. type t__kernel_mode_t = uint32
  14983. type t__kernel_ipc_pid_t = int32
  14984. type t__kernel_uid_t = uint32
  14985. type t__kernel_gid_t = uint32
  14986. type t__kernel_ptrdiff_t = int64
  14987. type t__kernel_sigset_t = uint64
  14988. type t__kernel_long_t = int64
  14989. type t__kernel_ulong_t = uint64
  14990. type t__kernel_pid_t = int32
  14991. type t__kernel_suseconds_t = int64
  14992. type t__kernel_daddr_t = int32
  14993. type t__kernel_uid32_t = uint32
  14994. type t__kernel_gid32_t = uint32
  14995. type t__kernel_old_uid_t = uint32
  14996. type t__kernel_old_gid_t = uint32
  14997. type t__kernel_fsid_t = struct {
  14998. Fval [2]int32
  14999. }
  15000. type t__kernel_off_t = int64
  15001. type t__kernel_loff_t = int64
  15002. type t__kernel_old_time_t = int64
  15003. type t__kernel_time_t = int64
  15004. type t__kernel_time64_t = int64
  15005. type t__kernel_clock_t = int64
  15006. type t__kernel_timer_t = int32
  15007. type t__kernel_clockid_t = int32
  15008. type t__kernel_caddr_t = uintptr
  15009. type t__kernel_uid16_t = uint16
  15010. type t__kernel_gid16_t = uint16
  15011. type t__le16 = uint16
  15012. type t__be16 = uint16
  15013. type t__le32 = uint32
  15014. type t__be32 = uint32
  15015. type t__le64 = uint64
  15016. type t__be64 = uint64
  15017. type t__sum16 = uint16
  15018. type t__wsum = uint32
  15019. type t__poll_t = uint32
  15020. type t__sysctl_args = struct {
  15021. Fname uintptr
  15022. Fnlen int32
  15023. Foldval uintptr
  15024. Foldlenp uintptr
  15025. Fnewval uintptr
  15026. Fnewlen Tsize_t
  15027. F__unused [4]uint64
  15028. }
  15029. const _CTL_KERN = 1
  15030. const _CTL_VM = 2
  15031. const _CTL_NET = 3
  15032. const _CTL_PROC = 4
  15033. const _CTL_FS = 5
  15034. const _CTL_DEBUG = 6
  15035. const _CTL_DEV = 7
  15036. const _CTL_BUS = 8
  15037. const _CTL_ABI = 9
  15038. const _CTL_CPU = 10
  15039. const _CTL_ARLAN = 254
  15040. const _CTL_S390DBF = 5677
  15041. const _CTL_SUNRPC = 7249
  15042. const _CTL_PM = 9899
  15043. const _CTL_FRV = 9898
  15044. const _CTL_BUS_ISA = 1
  15045. const _INOTIFY_MAX_USER_INSTANCES = 1
  15046. const _INOTIFY_MAX_USER_WATCHES = 2
  15047. const _INOTIFY_MAX_QUEUED_EVENTS = 3
  15048. const _KERN_OSTYPE = 1
  15049. const _KERN_OSRELEASE = 2
  15050. const _KERN_OSREV = 3
  15051. const _KERN_VERSION = 4
  15052. const _KERN_SECUREMASK = 5
  15053. const _KERN_PROF = 6
  15054. const _KERN_NODENAME = 7
  15055. const _KERN_DOMAINNAME = 8
  15056. const _KERN_PANIC = 15
  15057. const _KERN_REALROOTDEV = 16
  15058. const _KERN_SPARC_REBOOT = 21
  15059. const _KERN_CTLALTDEL = 22
  15060. const _KERN_PRINTK = 23
  15061. const _KERN_NAMETRANS = 24
  15062. const _KERN_PPC_HTABRECLAIM = 25
  15063. const _KERN_PPC_ZEROPAGED = 26
  15064. const _KERN_PPC_POWERSAVE_NAP = 27
  15065. const _KERN_MODPROBE = 28
  15066. const _KERN_SG_BIG_BUFF = 29
  15067. const _KERN_ACCT = 30
  15068. const _KERN_PPC_L2CR = 31
  15069. const _KERN_RTSIGNR = 32
  15070. const _KERN_RTSIGMAX = 33
  15071. const _KERN_SHMMAX = 34
  15072. const _KERN_MSGMAX = 35
  15073. const _KERN_MSGMNB = 36
  15074. const _KERN_MSGPOOL = 37
  15075. const _KERN_SYSRQ = 38
  15076. const _KERN_MAX_THREADS = 39
  15077. const _KERN_RANDOM = 40
  15078. const _KERN_SHMALL = 41
  15079. const _KERN_MSGMNI = 42
  15080. const _KERN_SEM = 43
  15081. const _KERN_SPARC_STOP_A = 44
  15082. const _KERN_SHMMNI = 45
  15083. const _KERN_OVERFLOWUID = 46
  15084. const _KERN_OVERFLOWGID = 47
  15085. const _KERN_SHMPATH = 48
  15086. const _KERN_HOTPLUG = 49
  15087. const _KERN_IEEE_EMULATION_WARNINGS = 50
  15088. const _KERN_S390_USER_DEBUG_LOGGING = 51
  15089. const _KERN_CORE_USES_PID = 52
  15090. const _KERN_TAINTED = 53
  15091. const _KERN_CADPID = 54
  15092. const _KERN_PIDMAX = 55
  15093. const _KERN_CORE_PATTERN = 56
  15094. const _KERN_PANIC_ON_OOPS = 57
  15095. const _KERN_HPPA_PWRSW = 58
  15096. const _KERN_HPPA_UNALIGNED = 59
  15097. const _KERN_PRINTK_RATELIMIT = 60
  15098. const _KERN_PRINTK_RATELIMIT_BURST = 61
  15099. const _KERN_PTY = 62
  15100. const _KERN_NGROUPS_MAX = 63
  15101. const _KERN_SPARC_SCONS_PWROFF = 64
  15102. const _KERN_HZ_TIMER = 65
  15103. const _KERN_UNKNOWN_NMI_PANIC = 66
  15104. const _KERN_BOOTLOADER_TYPE = 67
  15105. const _KERN_RANDOMIZE = 68
  15106. const _KERN_SETUID_DUMPABLE = 69
  15107. const _KERN_SPIN_RETRY = 70
  15108. const _KERN_ACPI_VIDEO_FLAGS = 71
  15109. const _KERN_IA64_UNALIGNED = 72
  15110. const _KERN_COMPAT_LOG = 73
  15111. const _KERN_MAX_LOCK_DEPTH = 74
  15112. const _KERN_NMI_WATCHDOG = 75
  15113. const _KERN_PANIC_ON_NMI = 76
  15114. const _KERN_PANIC_ON_WARN = 77
  15115. const _KERN_PANIC_PRINT = 78
  15116. const _VM_UNUSED1 = 1
  15117. const _VM_UNUSED2 = 2
  15118. const _VM_UNUSED3 = 3
  15119. const _VM_UNUSED4 = 4
  15120. const _VM_OVERCOMMIT_MEMORY = 5
  15121. const _VM_UNUSED5 = 6
  15122. const _VM_UNUSED7 = 7
  15123. const _VM_UNUSED8 = 8
  15124. const _VM_UNUSED9 = 9
  15125. const _VM_PAGE_CLUSTER = 10
  15126. const _VM_DIRTY_BACKGROUND = 11
  15127. const _VM_DIRTY_RATIO = 12
  15128. const _VM_DIRTY_WB_CS = 13
  15129. const _VM_DIRTY_EXPIRE_CS = 14
  15130. const _VM_NR_PDFLUSH_THREADS = 15
  15131. const _VM_OVERCOMMIT_RATIO = 16
  15132. const _VM_PAGEBUF = 17
  15133. const _VM_HUGETLB_PAGES = 18
  15134. const _VM_SWAPPINESS = 19
  15135. const _VM_LOWMEM_RESERVE_RATIO = 20
  15136. const _VM_MIN_FREE_KBYTES = 21
  15137. const _VM_MAX_MAP_COUNT = 22
  15138. const _VM_LAPTOP_MODE = 23
  15139. const _VM_BLOCK_DUMP = 24
  15140. const _VM_HUGETLB_GROUP = 25
  15141. const _VM_VFS_CACHE_PRESSURE = 26
  15142. const _VM_LEGACY_VA_LAYOUT = 27
  15143. const _VM_SWAP_TOKEN_TIMEOUT = 28
  15144. const _VM_DROP_PAGECACHE = 29
  15145. const _VM_PERCPU_PAGELIST_FRACTION = 30
  15146. const _VM_ZONE_RECLAIM_MODE = 31
  15147. const _VM_MIN_UNMAPPED = 32
  15148. const _VM_PANIC_ON_OOM = 33
  15149. const _VM_VDSO_ENABLED = 34
  15150. const _VM_MIN_SLAB = 35
  15151. const _NET_CORE = 1
  15152. const _NET_ETHER = 2
  15153. const _NET_802 = 3
  15154. const _NET_UNIX = 4
  15155. const _NET_IPV4 = 5
  15156. const _NET_IPX = 6
  15157. const _NET_ATALK = 7
  15158. const _NET_NETROM = 8
  15159. const _NET_AX25 = 9
  15160. const _NET_BRIDGE = 10
  15161. const _NET_ROSE = 11
  15162. const _NET_IPV6 = 12
  15163. const _NET_X25 = 13
  15164. const _NET_TR = 14
  15165. const _NET_DECNET = 15
  15166. const _NET_ECONET = 16
  15167. const _NET_SCTP = 17
  15168. const _NET_LLC = 18
  15169. const _NET_NETFILTER = 19
  15170. const _NET_DCCP = 20
  15171. const _NET_IRDA = 412
  15172. const _RANDOM_POOLSIZE = 1
  15173. const _RANDOM_ENTROPY_COUNT = 2
  15174. const _RANDOM_READ_THRESH = 3
  15175. const _RANDOM_WRITE_THRESH = 4
  15176. const _RANDOM_BOOT_ID = 5
  15177. const _RANDOM_UUID = 6
  15178. const _PTY_MAX = 1
  15179. const _PTY_NR = 2
  15180. const _BUS_ISA_MEM_BASE = 1
  15181. const _BUS_ISA_PORT_BASE = 2
  15182. const _BUS_ISA_PORT_SHIFT = 3
  15183. const _NET_CORE_WMEM_MAX = 1
  15184. const _NET_CORE_RMEM_MAX = 2
  15185. const _NET_CORE_WMEM_DEFAULT = 3
  15186. const _NET_CORE_RMEM_DEFAULT = 4
  15187. const _NET_CORE_MAX_BACKLOG = 6
  15188. const _NET_CORE_FASTROUTE = 7
  15189. const _NET_CORE_MSG_COST = 8
  15190. const _NET_CORE_MSG_BURST = 9
  15191. const _NET_CORE_OPTMEM_MAX = 10
  15192. const _NET_CORE_HOT_LIST_LENGTH = 11
  15193. const _NET_CORE_DIVERT_VERSION = 12
  15194. const _NET_CORE_NO_CONG_THRESH = 13
  15195. const _NET_CORE_NO_CONG = 14
  15196. const _NET_CORE_LO_CONG = 15
  15197. const _NET_CORE_MOD_CONG = 16
  15198. const _NET_CORE_DEV_WEIGHT = 17
  15199. const _NET_CORE_SOMAXCONN = 18
  15200. const _NET_CORE_BUDGET = 19
  15201. const _NET_CORE_AEVENT_ETIME = 20
  15202. const _NET_CORE_AEVENT_RSEQTH = 21
  15203. const _NET_CORE_WARNINGS = 22
  15204. const _NET_UNIX_DESTROY_DELAY = 1
  15205. const _NET_UNIX_DELETE_DELAY = 2
  15206. const _NET_UNIX_MAX_DGRAM_QLEN = 3
  15207. const _NET_NF_CONNTRACK_MAX = 1
  15208. const _NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT = 2
  15209. const _NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV = 3
  15210. const _NET_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED = 4
  15211. const _NET_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT = 5
  15212. const _NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT = 6
  15213. const _NET_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK = 7
  15214. const _NET_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT = 8
  15215. const _NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE = 9
  15216. const _NET_NF_CONNTRACK_UDP_TIMEOUT = 10
  15217. const _NET_NF_CONNTRACK_UDP_TIMEOUT_STREAM = 11
  15218. const _NET_NF_CONNTRACK_ICMP_TIMEOUT = 12
  15219. const _NET_NF_CONNTRACK_GENERIC_TIMEOUT = 13
  15220. const _NET_NF_CONNTRACK_BUCKETS = 14
  15221. const _NET_NF_CONNTRACK_LOG_INVALID = 15
  15222. const _NET_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS = 16
  15223. const _NET_NF_CONNTRACK_TCP_LOOSE = 17
  15224. const _NET_NF_CONNTRACK_TCP_BE_LIBERAL = 18
  15225. const _NET_NF_CONNTRACK_TCP_MAX_RETRANS = 19
  15226. const _NET_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED = 20
  15227. const _NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT = 21
  15228. const _NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED = 22
  15229. const _NET_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED = 23
  15230. const _NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT = 24
  15231. const _NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD = 25
  15232. const _NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT = 26
  15233. const _NET_NF_CONNTRACK_COUNT = 27
  15234. const _NET_NF_CONNTRACK_ICMPV6_TIMEOUT = 28
  15235. const _NET_NF_CONNTRACK_FRAG6_TIMEOUT = 29
  15236. const _NET_NF_CONNTRACK_FRAG6_LOW_THRESH = 30
  15237. const _NET_NF_CONNTRACK_FRAG6_HIGH_THRESH = 31
  15238. const _NET_NF_CONNTRACK_CHECKSUM = 32
  15239. const _NET_IPV4_FORWARD = 8
  15240. const _NET_IPV4_DYNADDR = 9
  15241. const _NET_IPV4_CONF = 16
  15242. const _NET_IPV4_NEIGH = 17
  15243. const _NET_IPV4_ROUTE = 18
  15244. const _NET_IPV4_FIB_HASH = 19
  15245. const _NET_IPV4_NETFILTER = 20
  15246. const _NET_IPV4_TCP_TIMESTAMPS = 33
  15247. const _NET_IPV4_TCP_WINDOW_SCALING = 34
  15248. const _NET_IPV4_TCP_SACK = 35
  15249. const _NET_IPV4_TCP_RETRANS_COLLAPSE = 36
  15250. const _NET_IPV4_DEFAULT_TTL = 37
  15251. const _NET_IPV4_AUTOCONFIG = 38
  15252. const _NET_IPV4_NO_PMTU_DISC = 39
  15253. const _NET_IPV4_TCP_SYN_RETRIES = 40
  15254. const _NET_IPV4_IPFRAG_HIGH_THRESH = 41
  15255. const _NET_IPV4_IPFRAG_LOW_THRESH = 42
  15256. const _NET_IPV4_IPFRAG_TIME = 43
  15257. const _NET_IPV4_TCP_MAX_KA_PROBES = 44
  15258. const _NET_IPV4_TCP_KEEPALIVE_TIME = 45
  15259. const _NET_IPV4_TCP_KEEPALIVE_PROBES = 46
  15260. const _NET_IPV4_TCP_RETRIES1 = 47
  15261. const _NET_IPV4_TCP_RETRIES2 = 48
  15262. const _NET_IPV4_TCP_FIN_TIMEOUT = 49
  15263. const _NET_IPV4_IP_MASQ_DEBUG = 50
  15264. const _NET_TCP_SYNCOOKIES = 51
  15265. const _NET_TCP_STDURG = 52
  15266. const _NET_TCP_RFC1337 = 53
  15267. const _NET_TCP_SYN_TAILDROP = 54
  15268. const _NET_TCP_MAX_SYN_BACKLOG = 55
  15269. const _NET_IPV4_LOCAL_PORT_RANGE = 56
  15270. const _NET_IPV4_ICMP_ECHO_IGNORE_ALL = 57
  15271. const _NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS = 58
  15272. const _NET_IPV4_ICMP_SOURCEQUENCH_RATE = 59
  15273. const _NET_IPV4_ICMP_DESTUNREACH_RATE = 60
  15274. const _NET_IPV4_ICMP_TIMEEXCEED_RATE = 61
  15275. const _NET_IPV4_ICMP_PARAMPROB_RATE = 62
  15276. const _NET_IPV4_ICMP_ECHOREPLY_RATE = 63
  15277. const _NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES = 64
  15278. const _NET_IPV4_IGMP_MAX_MEMBERSHIPS = 65
  15279. const _NET_TCP_TW_RECYCLE = 66
  15280. const _NET_IPV4_ALWAYS_DEFRAG = 67
  15281. const _NET_IPV4_TCP_KEEPALIVE_INTVL = 68
  15282. const _NET_IPV4_INET_PEER_THRESHOLD = 69
  15283. const _NET_IPV4_INET_PEER_MINTTL = 70
  15284. const _NET_IPV4_INET_PEER_MAXTTL = 71
  15285. const _NET_IPV4_INET_PEER_GC_MINTIME = 72
  15286. const _NET_IPV4_INET_PEER_GC_MAXTIME = 73
  15287. const _NET_TCP_ORPHAN_RETRIES = 74
  15288. const _NET_TCP_ABORT_ON_OVERFLOW = 75
  15289. const _NET_TCP_SYNACK_RETRIES = 76
  15290. const _NET_TCP_MAX_ORPHANS = 77
  15291. const _NET_TCP_MAX_TW_BUCKETS = 78
  15292. const _NET_TCP_FACK = 79
  15293. const _NET_TCP_REORDERING = 80
  15294. const _NET_TCP_ECN = 81
  15295. const _NET_TCP_DSACK = 82
  15296. const _NET_TCP_MEM = 83
  15297. const _NET_TCP_WMEM = 84
  15298. const _NET_TCP_RMEM = 85
  15299. const _NET_TCP_APP_WIN = 86
  15300. const _NET_TCP_ADV_WIN_SCALE = 87
  15301. const _NET_IPV4_NONLOCAL_BIND = 88
  15302. const _NET_IPV4_ICMP_RATELIMIT = 89
  15303. const _NET_IPV4_ICMP_RATEMASK = 90
  15304. const _NET_TCP_TW_REUSE = 91
  15305. const _NET_TCP_FRTO = 92
  15306. const _NET_TCP_LOW_LATENCY = 93
  15307. const _NET_IPV4_IPFRAG_SECRET_INTERVAL = 94
  15308. const _NET_IPV4_IGMP_MAX_MSF = 96
  15309. const _NET_TCP_NO_METRICS_SAVE = 97
  15310. const _NET_TCP_DEFAULT_WIN_SCALE = 105
  15311. const _NET_TCP_MODERATE_RCVBUF = 106
  15312. const _NET_TCP_TSO_WIN_DIVISOR = 107
  15313. const _NET_TCP_BIC_BETA = 108
  15314. const _NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR = 109
  15315. const _NET_TCP_CONG_CONTROL = 110
  15316. const _NET_TCP_ABC = 111
  15317. const _NET_IPV4_IPFRAG_MAX_DIST = 112
  15318. const _NET_TCP_MTU_PROBING = 113
  15319. const _NET_TCP_BASE_MSS = 114
  15320. const _NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS = 115
  15321. const _NET_TCP_DMA_COPYBREAK = 116
  15322. const _NET_TCP_SLOW_START_AFTER_IDLE = 117
  15323. const _NET_CIPSOV4_CACHE_ENABLE = 118
  15324. const _NET_CIPSOV4_CACHE_BUCKET_SIZE = 119
  15325. const _NET_CIPSOV4_RBM_OPTFMT = 120
  15326. const _NET_CIPSOV4_RBM_STRICTVALID = 121
  15327. const _NET_TCP_AVAIL_CONG_CONTROL = 122
  15328. const _NET_TCP_ALLOWED_CONG_CONTROL = 123
  15329. const _NET_TCP_MAX_SSTHRESH = 124
  15330. const _NET_TCP_FRTO_RESPONSE = 125
  15331. const _NET_IPV4_ROUTE_FLUSH = 1
  15332. const _NET_IPV4_ROUTE_MIN_DELAY = 2
  15333. const _NET_IPV4_ROUTE_MAX_DELAY = 3
  15334. const _NET_IPV4_ROUTE_GC_THRESH = 4
  15335. const _NET_IPV4_ROUTE_MAX_SIZE = 5
  15336. const _NET_IPV4_ROUTE_GC_MIN_INTERVAL = 6
  15337. const _NET_IPV4_ROUTE_GC_TIMEOUT = 7
  15338. const _NET_IPV4_ROUTE_GC_INTERVAL = 8
  15339. const _NET_IPV4_ROUTE_REDIRECT_LOAD = 9
  15340. const _NET_IPV4_ROUTE_REDIRECT_NUMBER = 10
  15341. const _NET_IPV4_ROUTE_REDIRECT_SILENCE = 11
  15342. const _NET_IPV4_ROUTE_ERROR_COST = 12
  15343. const _NET_IPV4_ROUTE_ERROR_BURST = 13
  15344. const _NET_IPV4_ROUTE_GC_ELASTICITY = 14
  15345. const _NET_IPV4_ROUTE_MTU_EXPIRES = 15
  15346. const _NET_IPV4_ROUTE_MIN_PMTU = 16
  15347. const _NET_IPV4_ROUTE_MIN_ADVMSS = 17
  15348. const _NET_IPV4_ROUTE_SECRET_INTERVAL = 18
  15349. const _NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS = 19
  15350. const _NET_PROTO_CONF_ALL = -2
  15351. const _NET_PROTO_CONF_DEFAULT = -3
  15352. const _NET_IPV4_CONF_FORWARDING = 1
  15353. const _NET_IPV4_CONF_MC_FORWARDING = 2
  15354. const _NET_IPV4_CONF_PROXY_ARP = 3
  15355. const _NET_IPV4_CONF_ACCEPT_REDIRECTS = 4
  15356. const _NET_IPV4_CONF_SECURE_REDIRECTS = 5
  15357. const _NET_IPV4_CONF_SEND_REDIRECTS = 6
  15358. const _NET_IPV4_CONF_SHARED_MEDIA = 7
  15359. const _NET_IPV4_CONF_RP_FILTER = 8
  15360. const _NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE = 9
  15361. const _NET_IPV4_CONF_BOOTP_RELAY = 10
  15362. const _NET_IPV4_CONF_LOG_MARTIANS = 11
  15363. const _NET_IPV4_CONF_TAG = 12
  15364. const _NET_IPV4_CONF_ARPFILTER = 13
  15365. const _NET_IPV4_CONF_MEDIUM_ID = 14
  15366. const _NET_IPV4_CONF_NOXFRM = 15
  15367. const _NET_IPV4_CONF_NOPOLICY = 16
  15368. const _NET_IPV4_CONF_FORCE_IGMP_VERSION = 17
  15369. const _NET_IPV4_CONF_ARP_ANNOUNCE = 18
  15370. const _NET_IPV4_CONF_ARP_IGNORE = 19
  15371. const _NET_IPV4_CONF_PROMOTE_SECONDARIES = 20
  15372. const _NET_IPV4_CONF_ARP_ACCEPT = 21
  15373. const _NET_IPV4_CONF_ARP_NOTIFY = 22
  15374. const _NET_IPV4_NF_CONNTRACK_MAX = 1
  15375. const _NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT = 2
  15376. const _NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV = 3
  15377. const _NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED = 4
  15378. const _NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT = 5
  15379. const _NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT = 6
  15380. const _NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK = 7
  15381. const _NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT = 8
  15382. const _NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE = 9
  15383. const _NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT = 10
  15384. const _NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT_STREAM = 11
  15385. const _NET_IPV4_NF_CONNTRACK_ICMP_TIMEOUT = 12
  15386. const _NET_IPV4_NF_CONNTRACK_GENERIC_TIMEOUT = 13
  15387. const _NET_IPV4_NF_CONNTRACK_BUCKETS = 14
  15388. const _NET_IPV4_NF_CONNTRACK_LOG_INVALID = 15
  15389. const _NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS = 16
  15390. const _NET_IPV4_NF_CONNTRACK_TCP_LOOSE = 17
  15391. const _NET_IPV4_NF_CONNTRACK_TCP_BE_LIBERAL = 18
  15392. const _NET_IPV4_NF_CONNTRACK_TCP_MAX_RETRANS = 19
  15393. const _NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED = 20
  15394. const _NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT = 21
  15395. const _NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED = 22
  15396. const _NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED = 23
  15397. const _NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT = 24
  15398. const _NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD = 25
  15399. const _NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT = 26
  15400. const _NET_IPV4_NF_CONNTRACK_COUNT = 27
  15401. const _NET_IPV4_NF_CONNTRACK_CHECKSUM = 28
  15402. const _NET_IPV6_CONF = 16
  15403. const _NET_IPV6_NEIGH = 17
  15404. const _NET_IPV6_ROUTE = 18
  15405. const _NET_IPV6_ICMP = 19
  15406. const _NET_IPV6_BINDV6ONLY = 20
  15407. const _NET_IPV6_IP6FRAG_HIGH_THRESH = 21
  15408. const _NET_IPV6_IP6FRAG_LOW_THRESH = 22
  15409. const _NET_IPV6_IP6FRAG_TIME = 23
  15410. const _NET_IPV6_IP6FRAG_SECRET_INTERVAL = 24
  15411. const _NET_IPV6_MLD_MAX_MSF = 25
  15412. const _NET_IPV6_ROUTE_FLUSH = 1
  15413. const _NET_IPV6_ROUTE_GC_THRESH = 2
  15414. const _NET_IPV6_ROUTE_MAX_SIZE = 3
  15415. const _NET_IPV6_ROUTE_GC_MIN_INTERVAL = 4
  15416. const _NET_IPV6_ROUTE_GC_TIMEOUT = 5
  15417. const _NET_IPV6_ROUTE_GC_INTERVAL = 6
  15418. const _NET_IPV6_ROUTE_GC_ELASTICITY = 7
  15419. const _NET_IPV6_ROUTE_MTU_EXPIRES = 8
  15420. const _NET_IPV6_ROUTE_MIN_ADVMSS = 9
  15421. const _NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS = 10
  15422. const _NET_IPV6_FORWARDING = 1
  15423. const _NET_IPV6_HOP_LIMIT = 2
  15424. const _NET_IPV6_MTU = 3
  15425. const _NET_IPV6_ACCEPT_RA = 4
  15426. const _NET_IPV6_ACCEPT_REDIRECTS = 5
  15427. const _NET_IPV6_AUTOCONF = 6
  15428. const _NET_IPV6_DAD_TRANSMITS = 7
  15429. const _NET_IPV6_RTR_SOLICITS = 8
  15430. const _NET_IPV6_RTR_SOLICIT_INTERVAL = 9
  15431. const _NET_IPV6_RTR_SOLICIT_DELAY = 10
  15432. const _NET_IPV6_USE_TEMPADDR = 11
  15433. const _NET_IPV6_TEMP_VALID_LFT = 12
  15434. const _NET_IPV6_TEMP_PREFERED_LFT = 13
  15435. const _NET_IPV6_REGEN_MAX_RETRY = 14
  15436. const _NET_IPV6_MAX_DESYNC_FACTOR = 15
  15437. const _NET_IPV6_MAX_ADDRESSES = 16
  15438. const _NET_IPV6_FORCE_MLD_VERSION = 17
  15439. const _NET_IPV6_ACCEPT_RA_DEFRTR = 18
  15440. const _NET_IPV6_ACCEPT_RA_PINFO = 19
  15441. const _NET_IPV6_ACCEPT_RA_RTR_PREF = 20
  15442. const _NET_IPV6_RTR_PROBE_INTERVAL = 21
  15443. const _NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN = 22
  15444. const _NET_IPV6_PROXY_NDP = 23
  15445. const _NET_IPV6_ACCEPT_SOURCE_ROUTE = 25
  15446. const _NET_IPV6_ACCEPT_RA_FROM_LOCAL = 26
  15447. const _NET_IPV6_ACCEPT_RA_RT_INFO_MIN_PLEN = 27
  15448. const ___NET_IPV6_MAX = 28
  15449. const _NET_IPV6_ICMP_RATELIMIT = 1
  15450. const _NET_IPV6_ICMP_ECHO_IGNORE_ALL = 2
  15451. const _NET_NEIGH_MCAST_SOLICIT = 1
  15452. const _NET_NEIGH_UCAST_SOLICIT = 2
  15453. const _NET_NEIGH_APP_SOLICIT = 3
  15454. const _NET_NEIGH_RETRANS_TIME = 4
  15455. const _NET_NEIGH_REACHABLE_TIME = 5
  15456. const _NET_NEIGH_DELAY_PROBE_TIME = 6
  15457. const _NET_NEIGH_GC_STALE_TIME = 7
  15458. const _NET_NEIGH_UNRES_QLEN = 8
  15459. const _NET_NEIGH_PROXY_QLEN = 9
  15460. const _NET_NEIGH_ANYCAST_DELAY = 10
  15461. const _NET_NEIGH_PROXY_DELAY = 11
  15462. const _NET_NEIGH_LOCKTIME = 12
  15463. const _NET_NEIGH_GC_INTERVAL = 13
  15464. const _NET_NEIGH_GC_THRESH1 = 14
  15465. const _NET_NEIGH_GC_THRESH2 = 15
  15466. const _NET_NEIGH_GC_THRESH3 = 16
  15467. const _NET_NEIGH_RETRANS_TIME_MS = 17
  15468. const _NET_NEIGH_REACHABLE_TIME_MS = 18
  15469. const _NET_DCCP_DEFAULT = 1
  15470. const _NET_IPX_PPROP_BROADCASTING = 1
  15471. const _NET_IPX_FORWARDING = 2
  15472. const _NET_LLC2 = 1
  15473. const _NET_LLC_STATION = 2
  15474. const _NET_LLC2_TIMEOUT = 1
  15475. const _NET_LLC_STATION_ACK_TIMEOUT = 1
  15476. const _NET_LLC2_ACK_TIMEOUT = 1
  15477. const _NET_LLC2_P_TIMEOUT = 2
  15478. const _NET_LLC2_REJ_TIMEOUT = 3
  15479. const _NET_LLC2_BUSY_TIMEOUT = 4
  15480. const _NET_ATALK_AARP_EXPIRY_TIME = 1
  15481. const _NET_ATALK_AARP_TICK_TIME = 2
  15482. const _NET_ATALK_AARP_RETRANSMIT_LIMIT = 3
  15483. const _NET_ATALK_AARP_RESOLVE_TIME = 4
  15484. const _NET_NETROM_DEFAULT_PATH_QUALITY = 1
  15485. const _NET_NETROM_OBSOLESCENCE_COUNT_INITIALISER = 2
  15486. const _NET_NETROM_NETWORK_TTL_INITIALISER = 3
  15487. const _NET_NETROM_TRANSPORT_TIMEOUT = 4
  15488. const _NET_NETROM_TRANSPORT_MAXIMUM_TRIES = 5
  15489. const _NET_NETROM_TRANSPORT_ACKNOWLEDGE_DELAY = 6
  15490. const _NET_NETROM_TRANSPORT_BUSY_DELAY = 7
  15491. const _NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE = 8
  15492. const _NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT = 9
  15493. const _NET_NETROM_ROUTING_CONTROL = 10
  15494. const _NET_NETROM_LINK_FAILS_COUNT = 11
  15495. const _NET_NETROM_RESET = 12
  15496. const _NET_AX25_IP_DEFAULT_MODE = 1
  15497. const _NET_AX25_DEFAULT_MODE = 2
  15498. const _NET_AX25_BACKOFF_TYPE = 3
  15499. const _NET_AX25_CONNECT_MODE = 4
  15500. const _NET_AX25_STANDARD_WINDOW = 5
  15501. const _NET_AX25_EXTENDED_WINDOW = 6
  15502. const _NET_AX25_T1_TIMEOUT = 7
  15503. const _NET_AX25_T2_TIMEOUT = 8
  15504. const _NET_AX25_T3_TIMEOUT = 9
  15505. const _NET_AX25_IDLE_TIMEOUT = 10
  15506. const _NET_AX25_N2 = 11
  15507. const _NET_AX25_PACLEN = 12
  15508. const _NET_AX25_PROTOCOL = 13
  15509. const _NET_AX25_DAMA_SLAVE_TIMEOUT = 14
  15510. const _NET_ROSE_RESTART_REQUEST_TIMEOUT = 1
  15511. const _NET_ROSE_CALL_REQUEST_TIMEOUT = 2
  15512. const _NET_ROSE_RESET_REQUEST_TIMEOUT = 3
  15513. const _NET_ROSE_CLEAR_REQUEST_TIMEOUT = 4
  15514. const _NET_ROSE_ACK_HOLD_BACK_TIMEOUT = 5
  15515. const _NET_ROSE_ROUTING_CONTROL = 6
  15516. const _NET_ROSE_LINK_FAIL_TIMEOUT = 7
  15517. const _NET_ROSE_MAX_VCS = 8
  15518. const _NET_ROSE_WINDOW_SIZE = 9
  15519. const _NET_ROSE_NO_ACTIVITY_TIMEOUT = 10
  15520. const _NET_X25_RESTART_REQUEST_TIMEOUT = 1
  15521. const _NET_X25_CALL_REQUEST_TIMEOUT = 2
  15522. const _NET_X25_RESET_REQUEST_TIMEOUT = 3
  15523. const _NET_X25_CLEAR_REQUEST_TIMEOUT = 4
  15524. const _NET_X25_ACK_HOLD_BACK_TIMEOUT = 5
  15525. const _NET_X25_FORWARD = 6
  15526. const _NET_TR_RIF_TIMEOUT = 1
  15527. const _NET_DECNET_NODE_TYPE = 1
  15528. const _NET_DECNET_NODE_ADDRESS = 2
  15529. const _NET_DECNET_NODE_NAME = 3
  15530. const _NET_DECNET_DEFAULT_DEVICE = 4
  15531. const _NET_DECNET_TIME_WAIT = 5
  15532. const _NET_DECNET_DN_COUNT = 6
  15533. const _NET_DECNET_DI_COUNT = 7
  15534. const _NET_DECNET_DR_COUNT = 8
  15535. const _NET_DECNET_DST_GC_INTERVAL = 9
  15536. const _NET_DECNET_CONF = 10
  15537. const _NET_DECNET_NO_FC_MAX_CWND = 11
  15538. const _NET_DECNET_MEM = 12
  15539. const _NET_DECNET_RMEM = 13
  15540. const _NET_DECNET_WMEM = 14
  15541. const _NET_DECNET_DEBUG_LEVEL = 255
  15542. const _NET_DECNET_CONF_LOOPBACK = -2
  15543. const _NET_DECNET_CONF_DDCMP = -3
  15544. const _NET_DECNET_CONF_PPP = -4
  15545. const _NET_DECNET_CONF_X25 = -5
  15546. const _NET_DECNET_CONF_GRE = -6
  15547. const _NET_DECNET_CONF_ETHER = -7
  15548. const _NET_DECNET_CONF_DEV_PRIORITY = 1
  15549. const _NET_DECNET_CONF_DEV_T1 = 2
  15550. const _NET_DECNET_CONF_DEV_T2 = 3
  15551. const _NET_DECNET_CONF_DEV_T3 = 4
  15552. const _NET_DECNET_CONF_DEV_FORWARDING = 5
  15553. const _NET_DECNET_CONF_DEV_BLKSIZE = 6
  15554. const _NET_DECNET_CONF_DEV_STATE = 7
  15555. const _NET_SCTP_RTO_INITIAL = 1
  15556. const _NET_SCTP_RTO_MIN = 2
  15557. const _NET_SCTP_RTO_MAX = 3
  15558. const _NET_SCTP_RTO_ALPHA = 4
  15559. const _NET_SCTP_RTO_BETA = 5
  15560. const _NET_SCTP_VALID_COOKIE_LIFE = 6
  15561. const _NET_SCTP_ASSOCIATION_MAX_RETRANS = 7
  15562. const _NET_SCTP_PATH_MAX_RETRANS = 8
  15563. const _NET_SCTP_MAX_INIT_RETRANSMITS = 9
  15564. const _NET_SCTP_HB_INTERVAL = 10
  15565. const _NET_SCTP_PRESERVE_ENABLE = 11
  15566. const _NET_SCTP_MAX_BURST = 12
  15567. const _NET_SCTP_ADDIP_ENABLE = 13
  15568. const _NET_SCTP_PRSCTP_ENABLE = 14
  15569. const _NET_SCTP_SNDBUF_POLICY = 15
  15570. const _NET_SCTP_SACK_TIMEOUT = 16
  15571. const _NET_SCTP_RCVBUF_POLICY = 17
  15572. const _NET_BRIDGE_NF_CALL_ARPTABLES = 1
  15573. const _NET_BRIDGE_NF_CALL_IPTABLES = 2
  15574. const _NET_BRIDGE_NF_CALL_IP6TABLES = 3
  15575. const _NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4
  15576. const _NET_BRIDGE_NF_FILTER_PPPOE_TAGGED = 5
  15577. const _FS_NRINODE = 1
  15578. const _FS_STATINODE = 2
  15579. const _FS_MAXINODE = 3
  15580. const _FS_NRDQUOT = 4
  15581. const _FS_MAXDQUOT = 5
  15582. const _FS_NRFILE = 6
  15583. const _FS_MAXFILE = 7
  15584. const _FS_DENTRY = 8
  15585. const _FS_NRSUPER = 9
  15586. const _FS_MAXSUPER = 10
  15587. const _FS_OVERFLOWUID = 11
  15588. const _FS_OVERFLOWGID = 12
  15589. const _FS_LEASES = 13
  15590. const _FS_DIR_NOTIFY = 14
  15591. const _FS_LEASE_TIME = 15
  15592. const _FS_DQSTATS = 16
  15593. const _FS_XFS = 17
  15594. const _FS_AIO_NR = 18
  15595. const _FS_AIO_MAX_NR = 19
  15596. const _FS_INOTIFY = 20
  15597. const _FS_OCFS2 = 988
  15598. const _FS_DQ_LOOKUPS = 1
  15599. const _FS_DQ_DROPS = 2
  15600. const _FS_DQ_READS = 3
  15601. const _FS_DQ_WRITES = 4
  15602. const _FS_DQ_CACHE_HITS = 5
  15603. const _FS_DQ_ALLOCATED = 6
  15604. const _FS_DQ_FREE = 7
  15605. const _FS_DQ_SYNCS = 8
  15606. const _FS_DQ_WARNINGS = 9
  15607. const _DEV_CDROM = 1
  15608. const _DEV_HWMON = 2
  15609. const _DEV_PARPORT = 3
  15610. const _DEV_RAID = 4
  15611. const _DEV_MAC_HID = 5
  15612. const _DEV_SCSI = 6
  15613. const _DEV_IPMI = 7
  15614. const _DEV_CDROM_INFO = 1
  15615. const _DEV_CDROM_AUTOCLOSE = 2
  15616. const _DEV_CDROM_AUTOEJECT = 3
  15617. const _DEV_CDROM_DEBUG = 4
  15618. const _DEV_CDROM_LOCK = 5
  15619. const _DEV_CDROM_CHECK_MEDIA = 6
  15620. const _DEV_PARPORT_DEFAULT = -3
  15621. const _DEV_RAID_SPEED_LIMIT_MIN = 1
  15622. const _DEV_RAID_SPEED_LIMIT_MAX = 2
  15623. const _DEV_PARPORT_DEFAULT_TIMESLICE = 1
  15624. const _DEV_PARPORT_DEFAULT_SPINTIME = 2
  15625. const _DEV_PARPORT_SPINTIME = 1
  15626. const _DEV_PARPORT_BASE_ADDR = 2
  15627. const _DEV_PARPORT_IRQ = 3
  15628. const _DEV_PARPORT_DMA = 4
  15629. const _DEV_PARPORT_MODES = 5
  15630. const _DEV_PARPORT_DEVICES = 6
  15631. const _DEV_PARPORT_AUTOPROBE = 16
  15632. const _DEV_PARPORT_DEVICES_ACTIVE = -3
  15633. const _DEV_PARPORT_DEVICE_TIMESLICE = 1
  15634. const _DEV_MAC_HID_KEYBOARD_SENDS_LINUX_KEYCODES = 1
  15635. const _DEV_MAC_HID_KEYBOARD_LOCK_KEYCODES = 2
  15636. const _DEV_MAC_HID_MOUSE_BUTTON_EMULATION = 3
  15637. const _DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE = 4
  15638. const _DEV_MAC_HID_MOUSE_BUTTON3_KEYCODE = 5
  15639. const _DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES = 6
  15640. const _DEV_SCSI_LOGGING_LEVEL = 1
  15641. const _DEV_IPMI_POWEROFF_POWERCYCLE = 1
  15642. const _ABI_DEFHANDLER_COFF = 1
  15643. const _ABI_DEFHANDLER_ELF = 2
  15644. const _ABI_DEFHANDLER_LCALL7 = 3
  15645. const _ABI_DEFHANDLER_LIBCSO = 4
  15646. const _ABI_TRACE = 5
  15647. const _ABI_FAKE_UTSNAME = 6
  15648. type Tstatvfs = struct {
  15649. Ff_bsize uint64
  15650. Ff_frsize uint64
  15651. Ff_blocks Tfsblkcnt_t
  15652. Ff_bfree Tfsblkcnt_t
  15653. Ff_bavail Tfsblkcnt_t
  15654. Ff_files Tfsfilcnt_t
  15655. Ff_ffree Tfsfilcnt_t
  15656. Ff_favail Tfsfilcnt_t
  15657. Ff_fsid uint64
  15658. Ff_flag uint64
  15659. Ff_namemax uint64
  15660. Ff_type uint32
  15661. F__reserved [5]int32
  15662. }
  15663. type TElf_Symndx = uint64
  15664. type Tdl_phdr_info = struct {
  15665. Fdlpi_addr TElf64_Addr
  15666. Fdlpi_name uintptr
  15667. Fdlpi_phdr uintptr
  15668. Fdlpi_phnum TElf64_Half
  15669. Fdlpi_adds uint64
  15670. Fdlpi_subs uint64
  15671. Fdlpi_tls_modid Tsize_t
  15672. Fdlpi_tls_data uintptr
  15673. }
  15674. type Tlink_map = struct {
  15675. Fl_addr TElf64_Addr
  15676. Fl_name uintptr
  15677. Fl_ld uintptr
  15678. Fl_next uintptr
  15679. Fl_prev uintptr
  15680. }
  15681. type Tr_debug = struct {
  15682. Fr_version int32
  15683. Fr_map uintptr
  15684. Fr_brk TElf64_Addr
  15685. Fr_state int32
  15686. Fr_ldbase TElf64_Addr
  15687. }
  15688. const _RT_CONSISTENT = 0
  15689. const _RT_ADD = 1
  15690. const _RT_DELETE = 2
  15691. type TSHA2_CTX = struct {
  15692. Fstate struct {
  15693. Fst64 [0][8]Tuint64_t
  15694. Fst32 [8]Tuint32_t
  15695. F__ccgo_pad2 [32]byte
  15696. }
  15697. Fbitcount [2]Tuint64_t
  15698. Fbuffer [128]Tuint8_t
  15699. }
  15700. type T_SHA2_CTX = TSHA2_CTX
  15701. type TSHA512_CTX = struct {
  15702. Fstate struct {
  15703. Fst64 [0][8]Tuint64_t
  15704. Fst32 [8]Tuint32_t
  15705. F__ccgo_pad2 [32]byte
  15706. }
  15707. Fbitcount [2]Tuint64_t
  15708. Fbuffer [128]Tuint8_t
  15709. }
  15710. type TSHA384_CTX = struct {
  15711. Fstate struct {
  15712. Fst64 [0][8]Tuint64_t
  15713. Fst32 [8]Tuint32_t
  15714. F__ccgo_pad2 [32]byte
  15715. }
  15716. Fbitcount [2]Tuint64_t
  15717. Fbuffer [128]Tuint8_t
  15718. }
  15719. type Trand_pool_info = struct {
  15720. Fentropy_count int32
  15721. Fbuf_size int32
  15722. }
  15723. type Tfsid_t = struct {
  15724. F__val [2]int32
  15725. }
  15726. type t__fsid_t = Tfsid_t
  15727. type Tstatfs = struct {
  15728. Ff_type uint32
  15729. Ff_bsize uint32
  15730. Ff_blocks Tfsblkcnt_t
  15731. Ff_bfree Tfsblkcnt_t
  15732. Ff_bavail Tfsblkcnt_t
  15733. Ff_files Tfsfilcnt_t
  15734. Ff_ffree Tfsfilcnt_t
  15735. Ff_fsid Tfsid_t
  15736. Ff_namelen uint32
  15737. Ff_frsize uint32
  15738. Ff_flags uint32
  15739. Ff_spare [4]uint32
  15740. }
  15741. func Xgetentropy(tls *libc.TLS, buf uintptr, len1 Tsize_t) (r int32) {
  15742. var ret int32
  15743. _ = ret
  15744. ret = -int32(1)
  15745. if len1 > uint64(256) {
  15746. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EIO)
  15747. return -int32(1)
  15748. }
  15749. /*
  15750. * Try descriptor-less getrandom(), in non-blocking mode.
  15751. *
  15752. * The design of Linux getrandom is broken. It has an
  15753. * uninitialized phase coupled with blocking behaviour, which
  15754. * is unacceptable from within a library at boot time without
  15755. * possible recovery. See http://bugs.python.org/issue26839#msg267745
  15756. */
  15757. ret = _getentropy_getrandom(tls, buf, len1)
  15758. if ret != -int32(1) {
  15759. return ret
  15760. }
  15761. /*
  15762. * Try to get entropy with /dev/urandom
  15763. *
  15764. * This can fail if the process is inside a chroot or if file
  15765. * descriptors are exhausted.
  15766. */
  15767. ret = _getentropy_urandom(tls, buf, len1)
  15768. if ret != -int32(1) {
  15769. return ret
  15770. }
  15771. /*
  15772. * Try to use sysctl CTL_KERN, KERN_RANDOM, RANDOM_UUID.
  15773. * sysctl is a failsafe API, so it guarantees a result. This
  15774. * should work inside a chroot, or when file descriptors are
  15775. * exhausted.
  15776. *
  15777. * However this can fail if the Linux kernel removes support
  15778. * for sysctl. Starting in 2007, there have been efforts to
  15779. * deprecate the sysctl API/ABI, and push callers towards use
  15780. * of the chroot-unavailable fd-using /proc mechanism --
  15781. * essentially the same problems as /dev/urandom.
  15782. *
  15783. * Numerous setbacks have been encountered in their deprecation
  15784. * schedule, so as of June 2014 the kernel ABI still exists on
  15785. * most Linux architectures. The sysctl() stub in libc is missing
  15786. * on some systems. There are also reports that some kernels
  15787. * spew messages to the console.
  15788. */
  15789. ret = _getentropy_sysctl(tls, buf, len1)
  15790. if ret != -int32(1) {
  15791. return ret
  15792. }
  15793. /*
  15794. * Entropy collection via /dev/urandom and sysctl have failed.
  15795. *
  15796. * No other API exists for collecting entropy. See the large
  15797. * comment block above.
  15798. *
  15799. * We have very few options:
  15800. * - Even syslog_r is unsafe to call at this low level, so
  15801. * there is no way to alert the user or program.
  15802. * - Cannot call abort() because some systems have unsafe
  15803. * corefiles.
  15804. * - Could raise(SIGKILL) resulting in silent program termination.
  15805. * - Return EIO, to hint that arc4random's stir function
  15806. * should raise(SIGKILL)
  15807. * - Do the best under the circumstances....
  15808. *
  15809. * This code path exists to bring light to the issue that Linux
  15810. * still does not provide a failsafe API for entropy collection.
  15811. *
  15812. * We hope this demonstrates that Linux should either retain their
  15813. * sysctl ABI, or consider providing a new failsafe API which
  15814. * works in a chroot or when file descriptors are exhausted.
  15815. */
  15816. ret = _getentropy_fallback(tls, buf, len1)
  15817. if ret != -int32(1) {
  15818. return ret
  15819. }
  15820. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EIO)
  15821. return ret
  15822. }
  15823. // C documentation
  15824. //
  15825. // /*
  15826. // * Basic sanity checking; wish we could do better.
  15827. // */
  15828. func _gotdata(tls *libc.TLS, buf uintptr, len1 Tsize_t) (r int32) {
  15829. var any_set uint8
  15830. var i Tsize_t
  15831. _, _ = any_set, i
  15832. any_set = uint8(0)
  15833. i = uint64(0)
  15834. for {
  15835. if !(i < len1) {
  15836. break
  15837. }
  15838. any_set = uint8(int32(any_set) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(buf + uintptr(i)))))
  15839. goto _1
  15840. _1:
  15841. ;
  15842. i++
  15843. }
  15844. if libc.Int32FromUint8(any_set) == 0 {
  15845. return -int32(1)
  15846. }
  15847. return 0
  15848. }
  15849. func _getentropy_getrandom(tls *libc.TLS, buf uintptr, len1 Tsize_t) (r int32) {
  15850. bp := tls.Alloc(32)
  15851. defer tls.Free(32)
  15852. var pre_errno, ret int32
  15853. _, _ = pre_errno, ret
  15854. pre_errno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  15855. if len1 > uint64(256) {
  15856. return -int32(1)
  15857. }
  15858. for cond := true; cond; cond = ret == -int32(1) && *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EINTR) {
  15859. ret = int32(libc.Xsyscall(tls, int64(m_SYS_getrandom), libc.VaList(bp+8, buf, len1, int32(m_GRND_NONBLOCK))))
  15860. }
  15861. if ret != libc.Int32FromUint64(len1) {
  15862. return -int32(1)
  15863. }
  15864. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = pre_errno
  15865. return 0
  15866. }
  15867. func _getentropy_urandom(tls *libc.TLS, buf uintptr, len1 Tsize_t) (r int32) {
  15868. bp := tls.Alloc(176)
  15869. defer tls.Free(176)
  15870. var fd, flags, save_errno int32
  15871. var i, wanted Tsize_t
  15872. var ret Tssize_t
  15873. var _ /* cnt at bp+144 */ int32
  15874. var _ /* st at bp+0 */ Tstat
  15875. _, _, _, _, _, _ = fd, flags, i, ret, save_errno, wanted
  15876. save_errno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  15877. goto start
  15878. start:
  15879. ;
  15880. flags = m_O_RDONLY3
  15881. flags |= int32(m_O_NOFOLLOW1)
  15882. flags |= int32(m_O_CLOEXEC1)
  15883. fd = libc.Xopen(tls, __ccgo_ts+789, flags, libc.VaList(bp+160, 0))
  15884. if fd == -int32(1) {
  15885. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EINTR) {
  15886. goto start
  15887. }
  15888. goto nodevrandom
  15889. }
  15890. /* Lightly verify that the device node looks sane */
  15891. if libc.Xfstat(tls, fd, bp) == -int32(1) || !((*(*Tstat)(unsafe.Pointer(bp))).Fst_mode&libc.Uint32FromInt32(m_S_IFMT3) == libc.Uint32FromInt32(m_S_IFCHR3)) {
  15892. libc.Xclose(tls, fd)
  15893. goto nodevrandom
  15894. }
  15895. 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+160, bp+144)) == -int32(1) {
  15896. libc.Xclose(tls, fd)
  15897. goto nodevrandom
  15898. }
  15899. i = uint64(0)
  15900. for {
  15901. if !(i < len1) {
  15902. break
  15903. }
  15904. wanted = len1 - i
  15905. ret = libc.Xread(tls, fd, buf+uintptr(i), wanted)
  15906. if ret == int64(-int32(1)) {
  15907. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EAGAIN) || *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EINTR) {
  15908. goto _1
  15909. }
  15910. libc.Xclose(tls, fd)
  15911. goto nodevrandom
  15912. }
  15913. i += libc.Uint64FromInt64(ret)
  15914. goto _1
  15915. _1:
  15916. }
  15917. libc.Xclose(tls, fd)
  15918. if _gotdata(tls, buf, len1) == 0 {
  15919. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = save_errno
  15920. return 0 /* satisfied */
  15921. }
  15922. goto nodevrandom
  15923. nodevrandom:
  15924. ;
  15925. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EIO)
  15926. return -int32(1)
  15927. }
  15928. func _getentropy_sysctl(tls *libc.TLS, buf uintptr, len1 Tsize_t) (r int32) {
  15929. bp := tls.Alloc(112)
  15930. defer tls.Free(112)
  15931. var i Tsize_t
  15932. var save_errno int32
  15933. var v2 uint64
  15934. var _ /* args at bp+8 */ t__sysctl_args
  15935. var _ /* chunk at bp+0 */ Tsize_t
  15936. _, _, _ = i, save_errno, v2
  15937. save_errno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  15938. i = uint64(0)
  15939. for {
  15940. if !(i < len1) {
  15941. break
  15942. }
  15943. if len1-i < libc.Uint64FromInt32(libc.Int32FromInt32(16)) {
  15944. v2 = len1 - i
  15945. } else {
  15946. v2 = libc.Uint64FromInt32(libc.Int32FromInt32(16))
  15947. }
  15948. *(*Tsize_t)(unsafe.Pointer(bp)) = v2
  15949. /* SYS__sysctl because some systems already removed sysctl() */
  15950. *(*t__sysctl_args)(unsafe.Pointer(bp + 8)) = t__sysctl_args{
  15951. Fname: uintptr(unsafe.Pointer(&_mib)),
  15952. Fnlen: int32(3),
  15953. Foldval: buf + uintptr(i),
  15954. Foldlenp: bp,
  15955. }
  15956. if libc.Xsyscall(tls, int64(m_SYS__sysctl), libc.VaList(bp+96, bp+8)) != 0 {
  15957. goto sysctlfailed
  15958. }
  15959. i += *(*Tsize_t)(unsafe.Pointer(bp))
  15960. goto _1
  15961. _1:
  15962. }
  15963. if _gotdata(tls, buf, len1) == 0 {
  15964. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = save_errno
  15965. return 0 /* satisfied */
  15966. }
  15967. goto sysctlfailed
  15968. sysctlfailed:
  15969. ;
  15970. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EIO)
  15971. return -int32(1)
  15972. }
  15973. var _mib = [3]int32{
  15974. 0: int32(_CTL_KERN),
  15975. 1: int32(_KERN_RANDOM),
  15976. 2: int32(_RANDOM_UUID),
  15977. }
  15978. var _cl = [6]int32{
  15979. 1: int32(m_CLOCK_MONOTONIC),
  15980. 2: int32(m_CLOCK_MONOTONIC_RAW),
  15981. 3: int32(m_CLOCK_TAI),
  15982. 4: int32(m_CLOCK_PROCESS_CPUTIME_ID),
  15983. 5: int32(m_CLOCK_THREAD_CPUTIME_ID),
  15984. }
  15985. func _getentropy_phdr(tls *libc.TLS, info uintptr, size Tsize_t, data uintptr) (r int32) {
  15986. var ctx uintptr
  15987. _ = ctx
  15988. ctx = data
  15989. libmd.XSHA512Update(tls, ctx, info, uint64(8))
  15990. return 0
  15991. }
  15992. func _getentropy_fallback(tls *libc.TLS, buf uintptr, len1 Tsize_t) (r int32) {
  15993. bp := tls.Alloc(1472)
  15994. defer tls.Free(1472)
  15995. var faster, j, pgs, repeat, save_errno, v13, v14, v16, v18, v19, v3, v9 int32
  15996. var i, ii, m, mo Tsize_t
  15997. var v11 uintptr
  15998. var v17 Toff_t
  15999. var v20, v21 uint64
  16000. var v5, v6, v7, v8 Tpid_t
  16001. var _ /* ctx at bp+648 */ TSHA512_CTX
  16002. var _ /* e at bp+64 */ int32
  16003. var _ /* mm at bp+1280 */ [12]struct {
  16004. Fnpg Tsize_t
  16005. Fp uintptr
  16006. }
  16007. var _ /* off at bp+1272 */ Toff_t
  16008. var _ /* p at bp+864 */ uintptr
  16009. var _ /* pid at bp+856 */ Tpid_t
  16010. var _ /* results at bp+0 */ [64]Tuint8_t
  16011. var _ /* ru at bp+104 */ Trusage
  16012. var _ /* sigset at bp+376 */ Tsigset_t
  16013. var _ /* ss at bp+872 */ Tsockaddr_storage
  16014. var _ /* ssl at bp+1264 */ Tsocklen_t
  16015. var _ /* st at bp+504 */ Tstat
  16016. var _ /* stfs at bp+1176 */ Tstatfs
  16017. var _ /* stvfs at bp+1000 */ Tstatvfs
  16018. var _ /* tios at bp+1112 */ Ttermios
  16019. var _ /* ts at bp+72 */ Ttimespec
  16020. var _ /* tv at bp+88 */ Ttimeval
  16021. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  16022. save_errno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  16023. pgs = libc.Xgetpagesize(tls)
  16024. faster = 0
  16025. *(*Tpid_t)(unsafe.Pointer(bp + 856)) = libc.Xgetpid(tls)
  16026. if _lastpid == *(*Tpid_t)(unsafe.Pointer(bp + 856)) {
  16027. faster = int32(1)
  16028. repeat = int32(2)
  16029. } else {
  16030. faster = 0
  16031. _lastpid = *(*Tpid_t)(unsafe.Pointer(bp + 856))
  16032. repeat = int32(m_REPEAT)
  16033. }
  16034. i = uint64(0)
  16035. for {
  16036. if !(i < len1) {
  16037. break
  16038. }
  16039. libmd.XSHA512Init(tls, bp+648)
  16040. j = 0
  16041. for {
  16042. if !(j < repeat) {
  16043. break
  16044. }
  16045. v3 = libc.Xgettimeofday(tls, bp+88, libc.UintptrFromInt32(0))
  16046. *(*int32)(unsafe.Pointer(bp + 64)) = v3
  16047. if v3 == -int32(1) {
  16048. libmd.XSHA512Update(tls, bp+648, libc.X__errno_location(tls), uint64(4))
  16049. } else {
  16050. libmd.XSHA512Update(tls, bp+648, bp+88, uint64(16))
  16051. }
  16052. if *(*int32)(unsafe.Pointer(bp + 64)) != -int32(1) {
  16053. _cnt += int32((*(*Ttimeval)(unsafe.Pointer(bp + 88))).Ftv_sec)
  16054. _cnt += int32((*(*Ttimeval)(unsafe.Pointer(bp + 88))).Ftv_usec)
  16055. }
  16056. _dl_iterate_phdr(tls, __ccgo_fp(_getentropy_phdr), bp+648)
  16057. ii = uint64(0)
  16058. for {
  16059. if !(ii < libc.Uint64FromInt64(24)/libc.Uint64FromInt64(4)) {
  16060. break
  16061. }
  16062. if libc.Xclock_gettime(tls, _cl[ii], bp+72) == -int32(1) {
  16063. libmd.XSHA512Update(tls, bp+648, libc.X__errno_location(tls), uint64(4))
  16064. } else {
  16065. libmd.XSHA512Update(tls, bp+648, bp+72, uint64(16))
  16066. }
  16067. goto _4
  16068. _4:
  16069. ;
  16070. ii++
  16071. }
  16072. v5 = libc.Xgetpid(tls)
  16073. *(*Tpid_t)(unsafe.Pointer(bp + 856)) = v5
  16074. if v5 == -int32(1) {
  16075. libmd.XSHA512Update(tls, bp+648, libc.X__errno_location(tls), uint64(4))
  16076. } else {
  16077. libmd.XSHA512Update(tls, bp+648, bp+856, uint64(4))
  16078. }
  16079. v6 = libc.Xgetsid(tls, *(*Tpid_t)(unsafe.Pointer(bp + 856)))
  16080. *(*Tpid_t)(unsafe.Pointer(bp + 856)) = v6
  16081. if v6 == -int32(1) {
  16082. libmd.XSHA512Update(tls, bp+648, libc.X__errno_location(tls), uint64(4))
  16083. } else {
  16084. libmd.XSHA512Update(tls, bp+648, bp+856, uint64(4))
  16085. }
  16086. v7 = libc.Xgetppid(tls)
  16087. *(*Tpid_t)(unsafe.Pointer(bp + 856)) = v7
  16088. if v7 == -int32(1) {
  16089. libmd.XSHA512Update(tls, bp+648, libc.X__errno_location(tls), uint64(4))
  16090. } else {
  16091. libmd.XSHA512Update(tls, bp+648, bp+856, uint64(4))
  16092. }
  16093. v8 = libc.Xgetpgid(tls, 0)
  16094. *(*Tpid_t)(unsafe.Pointer(bp + 856)) = v8
  16095. if v8 == -int32(1) {
  16096. libmd.XSHA512Update(tls, bp+648, libc.X__errno_location(tls), uint64(4))
  16097. } else {
  16098. libmd.XSHA512Update(tls, bp+648, bp+856, uint64(4))
  16099. }
  16100. v9 = libc.Xgetpriority(tls, 0, uint32(0))
  16101. *(*int32)(unsafe.Pointer(bp + 64)) = v9
  16102. if v9 == -int32(1) {
  16103. libmd.XSHA512Update(tls, bp+648, libc.X__errno_location(tls), uint64(4))
  16104. } else {
  16105. libmd.XSHA512Update(tls, bp+648, bp+64, uint64(4))
  16106. }
  16107. if !(faster != 0) {
  16108. (*(*Ttimespec)(unsafe.Pointer(bp + 72))).Ftv_sec = 0
  16109. (*(*Ttimespec)(unsafe.Pointer(bp + 72))).Ftv_nsec = int64(1)
  16110. libc.Xnanosleep(tls, bp+72, libc.UintptrFromInt32(0))
  16111. }
  16112. if libc.Xsigpending(tls, bp+376) == -int32(1) {
  16113. libmd.XSHA512Update(tls, bp+648, libc.X__errno_location(tls), uint64(4))
  16114. } else {
  16115. libmd.XSHA512Update(tls, bp+648, bp+376, uint64(128))
  16116. }
  16117. if libc.Xsigprocmask(tls, m_SIG_BLOCK, libc.UintptrFromInt32(0), bp+376) == -int32(1) {
  16118. libmd.XSHA512Update(tls, bp+648, libc.X__errno_location(tls), uint64(4))
  16119. } else {
  16120. libmd.XSHA512Update(tls, bp+648, bp+376, uint64(128))
  16121. }
  16122. libmd.XSHA512Update(tls, bp+648, __ccgo_fp(Xgetentropy), uint64(8)) /* an addr in this library */
  16123. libmd.XSHA512Update(tls, bp+648, __ccgo_fp(libc.Xprintf), uint64(8)) /* an addr in libc */
  16124. *(*uintptr)(unsafe.Pointer(bp + 864)) = bp + 864
  16125. libmd.XSHA512Update(tls, bp+648, bp+864, uint64(8)) /* an addr on stack */
  16126. *(*uintptr)(unsafe.Pointer(bp + 864)) = libc.X__errno_location(tls)
  16127. libmd.XSHA512Update(tls, bp+648, bp+864, uint64(8)) /* the addr of errno */
  16128. if i == uint64(0) {
  16129. /*
  16130. * Prime-sized mappings encourage fragmentation;
  16131. * thus exposing some address entropy.
  16132. */
  16133. *(*[12]struct {
  16134. Fnpg Tsize_t
  16135. Fp uintptr
  16136. })(unsafe.Pointer(bp + 1280)) = [12]struct {
  16137. Fnpg Tsize_t
  16138. Fp uintptr
  16139. }{
  16140. 0: {
  16141. Fnpg: uint64(17),
  16142. Fp: uintptr(-libc.Int32FromInt32(1)),
  16143. },
  16144. 1: {
  16145. Fnpg: uint64(3),
  16146. Fp: uintptr(-libc.Int32FromInt32(1)),
  16147. },
  16148. 2: {
  16149. Fnpg: uint64(11),
  16150. Fp: uintptr(-libc.Int32FromInt32(1)),
  16151. },
  16152. 3: {
  16153. Fnpg: uint64(2),
  16154. Fp: uintptr(-libc.Int32FromInt32(1)),
  16155. },
  16156. 4: {
  16157. Fnpg: uint64(5),
  16158. Fp: uintptr(-libc.Int32FromInt32(1)),
  16159. },
  16160. 5: {
  16161. Fnpg: uint64(3),
  16162. Fp: uintptr(-libc.Int32FromInt32(1)),
  16163. },
  16164. 6: {
  16165. Fnpg: uint64(7),
  16166. Fp: uintptr(-libc.Int32FromInt32(1)),
  16167. },
  16168. 7: {
  16169. Fnpg: uint64(1),
  16170. Fp: uintptr(-libc.Int32FromInt32(1)),
  16171. },
  16172. 8: {
  16173. Fnpg: uint64(57),
  16174. Fp: uintptr(-libc.Int32FromInt32(1)),
  16175. },
  16176. 9: {
  16177. Fnpg: uint64(3),
  16178. Fp: uintptr(-libc.Int32FromInt32(1)),
  16179. },
  16180. 10: {
  16181. Fnpg: uint64(131),
  16182. Fp: uintptr(-libc.Int32FromInt32(1)),
  16183. },
  16184. 11: {
  16185. Fnpg: uint64(1),
  16186. Fp: uintptr(-libc.Int32FromInt32(1)),
  16187. },
  16188. }
  16189. m = uint64(0)
  16190. for {
  16191. if !(m < libc.Uint64FromInt64(192)/libc.Uint64FromInt64(16)) {
  16192. break
  16193. }
  16194. v11 = libc.Xmmap(tls, libc.UintptrFromInt32(0), (*(*[12]struct {
  16195. Fnpg Tsize_t
  16196. Fp uintptr
  16197. })(unsafe.Pointer(bp + 1280)))[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))
  16198. (*(*[12]struct {
  16199. Fnpg Tsize_t
  16200. Fp uintptr
  16201. })(unsafe.Pointer(bp + 1280)))[m].Fp = v11
  16202. if v11 != 0 {
  16203. libmd.XSHA512Update(tls, bp+648, libc.X__errno_location(tls), uint64(4))
  16204. } else {
  16205. libmd.XSHA512Update(tls, bp+648, bp+1280+uintptr(m)*16+8, uint64(8))
  16206. }
  16207. if (*(*[12]struct {
  16208. Fnpg Tsize_t
  16209. Fp uintptr
  16210. })(unsafe.Pointer(bp + 1280)))[m].Fp != uintptr(-libc.Int32FromInt32(1)) {
  16211. /* Touch some memory... */
  16212. *(*uintptr)(unsafe.Pointer(bp + 864)) = (*(*[12]struct {
  16213. Fnpg Tsize_t
  16214. Fp uintptr
  16215. })(unsafe.Pointer(bp + 1280)))[m].Fp
  16216. mo = libc.Uint64FromInt32(_cnt) % ((*(*[12]struct {
  16217. Fnpg Tsize_t
  16218. Fp uintptr
  16219. })(unsafe.Pointer(bp + 1280)))[m].Fnpg*libc.Uint64FromInt32(pgs) - uint64(1))
  16220. *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 864)) + uintptr(mo))) = uint8(1)
  16221. _cnt += int32(int64((*(*[12]struct {
  16222. Fnpg Tsize_t
  16223. Fp uintptr
  16224. })(unsafe.Pointer(bp + 1280)))[m].Fp) / int64(pgs))
  16225. }
  16226. /* Check cnts and times... */
  16227. ii = uint64(0)
  16228. for {
  16229. if !(ii < libc.Uint64FromInt64(24)/libc.Uint64FromInt64(4)) {
  16230. break
  16231. }
  16232. v13 = libc.Xclock_gettime(tls, _cl[ii], bp+72)
  16233. *(*int32)(unsafe.Pointer(bp + 64)) = v13
  16234. if v13 == -int32(1) {
  16235. libmd.XSHA512Update(tls, bp+648, libc.X__errno_location(tls), uint64(4))
  16236. } else {
  16237. libmd.XSHA512Update(tls, bp+648, bp+72, uint64(16))
  16238. }
  16239. if *(*int32)(unsafe.Pointer(bp + 64)) != -int32(1) {
  16240. _cnt += int32((*(*Ttimespec)(unsafe.Pointer(bp + 72))).Ftv_nsec)
  16241. }
  16242. goto _12
  16243. _12:
  16244. ;
  16245. ii++
  16246. }
  16247. v14 = libc.Xgetrusage(tls, m_RUSAGE_SELF, bp+104)
  16248. *(*int32)(unsafe.Pointer(bp + 64)) = v14
  16249. if v14 == -int32(1) {
  16250. libmd.XSHA512Update(tls, bp+648, libc.X__errno_location(tls), uint64(4))
  16251. } else {
  16252. libmd.XSHA512Update(tls, bp+648, bp+104, uint64(272))
  16253. }
  16254. if *(*int32)(unsafe.Pointer(bp + 64)) != -int32(1) {
  16255. _cnt += int32((*(*Trusage)(unsafe.Pointer(bp + 104))).Fru_utime.Ftv_sec)
  16256. _cnt += int32((*(*Trusage)(unsafe.Pointer(bp + 104))).Fru_utime.Ftv_usec)
  16257. }
  16258. goto _10
  16259. _10:
  16260. ;
  16261. m++
  16262. }
  16263. m = uint64(0)
  16264. for {
  16265. if !(m < libc.Uint64FromInt64(192)/libc.Uint64FromInt64(16)) {
  16266. break
  16267. }
  16268. if (*(*[12]struct {
  16269. Fnpg Tsize_t
  16270. Fp uintptr
  16271. })(unsafe.Pointer(bp + 1280)))[m].Fp != uintptr(-libc.Int32FromInt32(1)) {
  16272. libc.Xmunmap(tls, (*(*[12]struct {
  16273. Fnpg Tsize_t
  16274. Fp uintptr
  16275. })(unsafe.Pointer(bp + 1280)))[m].Fp, (*(*[12]struct {
  16276. Fnpg Tsize_t
  16277. Fp uintptr
  16278. })(unsafe.Pointer(bp + 1280)))[m].Fnpg*libc.Uint64FromInt32(pgs))
  16279. }
  16280. (*(*[12]struct {
  16281. Fnpg Tsize_t
  16282. Fp uintptr
  16283. })(unsafe.Pointer(bp + 1280)))[m].Fp = uintptr(-libc.Int32FromInt32(1))
  16284. goto _15
  16285. _15:
  16286. ;
  16287. m++
  16288. }
  16289. if libc.Xstat(tls, __ccgo_ts+802, bp+504) == -int32(1) {
  16290. libmd.XSHA512Update(tls, bp+648, libc.X__errno_location(tls), uint64(4))
  16291. } else {
  16292. libmd.XSHA512Update(tls, bp+648, bp+504, uint64(144))
  16293. }
  16294. if libc.Xstatvfs(tls, __ccgo_ts+802, bp+1000) == -int32(1) {
  16295. libmd.XSHA512Update(tls, bp+648, libc.X__errno_location(tls), uint64(4))
  16296. } else {
  16297. libmd.XSHA512Update(tls, bp+648, bp+1000, uint64(112))
  16298. }
  16299. if _statfs(tls, __ccgo_ts+802, bp+1176) == -int32(1) {
  16300. libmd.XSHA512Update(tls, bp+648, libc.X__errno_location(tls), uint64(4))
  16301. } else {
  16302. libmd.XSHA512Update(tls, bp+648, bp+1176, uint64(88))
  16303. }
  16304. if libc.Xstat(tls, __ccgo_ts+804, bp+504) == -int32(1) {
  16305. libmd.XSHA512Update(tls, bp+648, libc.X__errno_location(tls), uint64(4))
  16306. } else {
  16307. libmd.XSHA512Update(tls, bp+648, bp+504, uint64(144))
  16308. }
  16309. if libc.Xstatvfs(tls, __ccgo_ts+804, bp+1000) == -int32(1) {
  16310. libmd.XSHA512Update(tls, bp+648, libc.X__errno_location(tls), uint64(4))
  16311. } else {
  16312. libmd.XSHA512Update(tls, bp+648, bp+1000, uint64(112))
  16313. }
  16314. if _statfs(tls, __ccgo_ts+804, bp+1176) == -int32(1) {
  16315. libmd.XSHA512Update(tls, bp+648, libc.X__errno_location(tls), uint64(4))
  16316. } else {
  16317. libmd.XSHA512Update(tls, bp+648, bp+1176, uint64(88))
  16318. }
  16319. v16 = libc.Xfstat(tls, 0, bp+504)
  16320. *(*int32)(unsafe.Pointer(bp + 64)) = v16
  16321. if v16 == -int32(1) {
  16322. libmd.XSHA512Update(tls, bp+648, libc.X__errno_location(tls), uint64(4))
  16323. } else {
  16324. libmd.XSHA512Update(tls, bp+648, bp+504, uint64(144))
  16325. }
  16326. if *(*int32)(unsafe.Pointer(bp + 64)) == -int32(1) {
  16327. 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) {
  16328. if libc.Xfstatvfs(tls, 0, bp+1000) == -int32(1) {
  16329. libmd.XSHA512Update(tls, bp+648, libc.X__errno_location(tls), uint64(4))
  16330. } else {
  16331. libmd.XSHA512Update(tls, bp+648, bp+1000, uint64(112))
  16332. }
  16333. if libc.Xfstatfs(tls, 0, bp+1176) == -int32(1) {
  16334. libmd.XSHA512Update(tls, bp+648, libc.X__errno_location(tls), uint64(4))
  16335. } else {
  16336. libmd.XSHA512Update(tls, bp+648, bp+1176, uint64(88))
  16337. }
  16338. v17 = libc.Xlseek(tls, 0, libc.Int64FromInt32(0), int32(1))
  16339. *(*Toff_t)(unsafe.Pointer(bp + 1272)) = v17
  16340. if v17 < 0 {
  16341. libmd.XSHA512Update(tls, bp+648, libc.X__errno_location(tls), uint64(4))
  16342. } else {
  16343. libmd.XSHA512Update(tls, bp+648, bp+1272, uint64(8))
  16344. }
  16345. }
  16346. if (*(*Tstat)(unsafe.Pointer(bp + 504))).Fst_mode&uint32(m_S_IFMT3) == uint32(m_S_IFCHR3) {
  16347. if libc.Xtcgetattr(tls, 0, bp+1112) == -int32(1) {
  16348. libmd.XSHA512Update(tls, bp+648, libc.X__errno_location(tls), uint64(4))
  16349. } else {
  16350. libmd.XSHA512Update(tls, bp+648, bp+1112, uint64(60))
  16351. }
  16352. } else {
  16353. if (*(*Tstat)(unsafe.Pointer(bp + 504))).Fst_mode&uint32(m_S_IFMT3) == uint32(m_S_IFSOCK3) {
  16354. libc.Xmemset(tls, bp+872, 0, uint64(128))
  16355. *(*Tsocklen_t)(unsafe.Pointer(bp + 1264)) = uint32(128)
  16356. if libc.Xgetpeername(tls, 0, bp+872, bp+1264) == -int32(1) {
  16357. libmd.XSHA512Update(tls, bp+648, libc.X__errno_location(tls), uint64(4))
  16358. } else {
  16359. libmd.XSHA512Update(tls, bp+648, bp+872, uint64(128))
  16360. }
  16361. }
  16362. }
  16363. }
  16364. v18 = libc.Xgetrusage(tls, -int32(1), bp+104)
  16365. *(*int32)(unsafe.Pointer(bp + 64)) = v18
  16366. if v18 == -int32(1) {
  16367. libmd.XSHA512Update(tls, bp+648, libc.X__errno_location(tls), uint64(4))
  16368. } else {
  16369. libmd.XSHA512Update(tls, bp+648, bp+104, uint64(272))
  16370. }
  16371. if *(*int32)(unsafe.Pointer(bp + 64)) != -int32(1) {
  16372. _cnt += int32((*(*Trusage)(unsafe.Pointer(bp + 104))).Fru_utime.Ftv_sec)
  16373. _cnt += int32((*(*Trusage)(unsafe.Pointer(bp + 104))).Fru_utime.Ftv_usec)
  16374. }
  16375. } else {
  16376. /* Subsequent hashes absorb previous result */
  16377. libmd.XSHA512Update(tls, bp+648, bp, uint64(64))
  16378. }
  16379. v19 = libc.Xgettimeofday(tls, bp+88, libc.UintptrFromInt32(0))
  16380. *(*int32)(unsafe.Pointer(bp + 64)) = v19
  16381. if v19 == -int32(1) {
  16382. libmd.XSHA512Update(tls, bp+648, libc.X__errno_location(tls), uint64(4))
  16383. } else {
  16384. libmd.XSHA512Update(tls, bp+648, bp+88, uint64(16))
  16385. }
  16386. if *(*int32)(unsafe.Pointer(bp + 64)) != -int32(1) {
  16387. _cnt += int32((*(*Ttimeval)(unsafe.Pointer(bp + 88))).Ftv_sec)
  16388. _cnt += int32((*(*Ttimeval)(unsafe.Pointer(bp + 88))).Ftv_usec)
  16389. }
  16390. libmd.XSHA512Update(tls, bp+648, uintptr(unsafe.Pointer(&_cnt)), uint64(4))
  16391. goto _2
  16392. _2:
  16393. ;
  16394. j++
  16395. }
  16396. /* Not as random as you think but we take what we are given */
  16397. *(*uintptr)(unsafe.Pointer(bp + 864)) = uintptr(libc.Xgetauxval(tls, uint64(m_AT_RANDOM)))
  16398. if *(*uintptr)(unsafe.Pointer(bp + 864)) != 0 {
  16399. libmd.XSHA512Update(tls, bp+648, *(*uintptr)(unsafe.Pointer(bp + 864)), libc.Uint64FromInt32(libc.Int32FromInt32(16)))
  16400. }
  16401. *(*uintptr)(unsafe.Pointer(bp + 864)) = uintptr(libc.Xgetauxval(tls, uint64(m_AT_SYSINFO_EHDR)))
  16402. if *(*uintptr)(unsafe.Pointer(bp + 864)) != 0 {
  16403. libmd.XSHA512Update(tls, bp+648, *(*uintptr)(unsafe.Pointer(bp + 864)), libc.Uint64FromInt32(pgs))
  16404. }
  16405. *(*uintptr)(unsafe.Pointer(bp + 864)) = uintptr(libc.Xgetauxval(tls, uint64(m_AT_BASE)))
  16406. if *(*uintptr)(unsafe.Pointer(bp + 864)) != 0 {
  16407. libmd.XSHA512Update(tls, bp+648, bp+864, uint64(8))
  16408. }
  16409. libmd.XSHA512Final(tls, bp, bp+648)
  16410. if libc.Uint64FromInt64(64) < len1-i {
  16411. v20 = libc.Uint64FromInt64(64)
  16412. } else {
  16413. v20 = len1 - i
  16414. }
  16415. libc.Xmemcpy(tls, buf+uintptr(i), bp, v20)
  16416. if libc.Uint64FromInt64(64) < len1-i {
  16417. v21 = libc.Uint64FromInt64(64)
  16418. } else {
  16419. v21 = len1 - i
  16420. }
  16421. i += v21
  16422. goto _1
  16423. _1:
  16424. }
  16425. Xexplicit_bzero(tls, bp+648, uint64(208))
  16426. Xexplicit_bzero(tls, bp, uint64(64))
  16427. if _gotdata(tls, buf, len1) == 0 {
  16428. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = save_errno
  16429. return 0 /* satisfied */
  16430. }
  16431. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EIO)
  16432. return -int32(1)
  16433. }
  16434. var _cnt int32
  16435. var _lastpid Tpid_t
  16436. func __ccgo_fp(f interface{}) uintptr {
  16437. type iface [2]uintptr
  16438. return (*iface)(unsafe.Pointer(&f))[1]
  16439. }
  16440. var Xoptreset int32
  16441. var __ccgo_ts = (*reflect.StringHeader)(unsafe.Pointer(&__ccgo_ts1)).Data
  16442. 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\x00libbsd: cannot find wrapped symbol %s in libc or libmd\n\x00MD5Init\x00MD5Update\x00MD5Pad\x00MD5Final\x00MD5Transform\x00MD5End\x00MD5File\x00MD5FileChunk\x00MD5Data\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\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#\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/dev/urandom\x00.\x00/\x00"