ccgo_linux_loong64.go 485 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960
  1. // Code generated for linux/loong64 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/cznic/src/modernc.org/builder/.exclude/modernc.org/libc/include/linux/loong64 -I /home/cznic/src/modernc.org/builder/.exclude/modernc.org/limd/include/linux/loong64 -shared -DPIC .libs/setmode.o.go .libs/arc4random.o.go .libs/arc4random_uniform.o.go .libs/bsd_getopt.o.go .libs/closefrom.o.go .libs/errc.o.go .libs/expand_number.o.go .libs/explicit_bzero.o.go .libs/fgetln.o.go .libs/fgetwln.o.go .libs/fparseln.o.go .libs/flopen.o.go .libs/fmtcheck.o.go .libs/fpurge.o.go .libs/freezero.o.go .libs/funopen.o.go .libs/getbsize.o.go .libs/getpeereid.o.go .libs/dehumanize_number.o.go .libs/humanize_number.o.go .libs/inet_net_pton.o.go .libs/md5.o.go .libs/nlist.o.go .libs/pidfile.o.go .libs/setproctitle.o.go .libs/progname.o.go .libs/pwcache.o.go .libs/readpassphrase.o.go .libs/reallocarray.o.go .libs/reallocf.o.go .libs/recallocarray.o.go .libs/heapsort.o.go .libs/merge.o.go .libs/radixsort.o.go .libs/stringlist.o.go .libs/strlcat.o.go .libs/strlcpy.o.go .libs/strmode.o.go .libs/strnstr.o.go .libs/strtonum.o.go .libs/strtoi.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 -lmd -o .libs/libbsd.so.0.12.0.go', DO NOT EDIT.
  2. //go:build linux && loong64
  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_BC_BASE_MAX = 99
  14. const m_BC_DIM_MAX = 2048
  15. const m_BC_SCALE_MAX = 99
  16. const m_BC_STRING_MAX = 1000
  17. const m_BIG_ENDIAN = "__BIG_ENDIAN"
  18. const m_BUFSIZ = 1024
  19. const m_BUS_ADRALN = 1
  20. const m_BUS_ADRERR = 2
  21. const m_BUS_MCEERR_AO = 5
  22. const m_BUS_MCEERR_AR = 4
  23. const m_BUS_OBJERR = 3
  24. const m_BYTE_ORDER = "__BYTE_ORDER"
  25. const m_CHARCLASS_NAME_MAX = 14
  26. const m_CHAR_BIT = 8
  27. const m_CHAR_MAX = 255
  28. const m_CHAR_MIN = 0
  29. const m_CLD_CONTINUED = 6
  30. const m_CLD_DUMPED = 3
  31. const m_CLD_EXITED = 1
  32. const m_CLD_KILLED = 2
  33. const m_CLD_STOPPED = 5
  34. const m_CLD_TRAPPED = 4
  35. const m_CMD2_CLR = 1
  36. const m_CMD2_GBITS = 4
  37. const m_CMD2_OBITS = 8
  38. const m_CMD2_SET = 2
  39. const m_CMD2_UBITS = 16
  40. const m_COLL_WEIGHTS_MAX = 2
  41. const m_DELAYTIMER_MAX = 0x7fffffff
  42. const m_E2BIG = 7
  43. const m_EACCES = 13
  44. const m_EADDRINUSE = 98
  45. const m_EADDRNOTAVAIL = 99
  46. const m_EADV = 68
  47. const m_EAFNOSUPPORT = 97
  48. const m_EAGAIN = 11
  49. const m_EALREADY = 114
  50. const m_EBADE = 52
  51. const m_EBADF = 9
  52. const m_EBADFD = 77
  53. const m_EBADMSG = 74
  54. const m_EBADR = 53
  55. const m_EBADRQC = 56
  56. const m_EBADSLT = 57
  57. const m_EBFONT = 59
  58. const m_EBUSY = 16
  59. const m_ECANCELED = 125
  60. const m_ECHILD = 10
  61. const m_ECHRNG = 44
  62. const m_ECOMM = 70
  63. const m_ECONNABORTED = 103
  64. const m_ECONNREFUSED = 111
  65. const m_ECONNRESET = 104
  66. const m_EDEADLK = 35
  67. const m_EDEADLOCK = "EDEADLK"
  68. const m_EDESTADDRREQ = 89
  69. const m_EDOM = 33
  70. const m_EDOTDOT = 73
  71. const m_EDQUOT = 122
  72. const m_EEXIST = 17
  73. const m_EFAULT = 14
  74. const m_EFBIG = 27
  75. const m_EHOSTDOWN = 112
  76. const m_EHOSTUNREACH = 113
  77. const m_EHWPOISON = 133
  78. const m_EIDRM = 43
  79. const m_EILSEQ = 84
  80. const m_EINPROGRESS = 115
  81. const m_EINTR = 4
  82. const m_EINVAL = 22
  83. const m_EIO = 5
  84. const m_EISCONN = 106
  85. const m_EISDIR = 21
  86. const m_EISNAM = 120
  87. const m_EKEYEXPIRED = 127
  88. const m_EKEYREJECTED = 129
  89. const m_EKEYREVOKED = 128
  90. const m_EL2HLT = 51
  91. const m_EL2NSYNC = 45
  92. const m_EL3HLT = 46
  93. const m_EL3RST = 47
  94. const m_ELIBACC = 79
  95. const m_ELIBBAD = 80
  96. const m_ELIBEXEC = 83
  97. const m_ELIBMAX = 82
  98. const m_ELIBSCN = 81
  99. const m_ELNRNG = 48
  100. const m_ELOOP = 40
  101. const m_EMEDIUMTYPE = 124
  102. const m_EMFILE = 24
  103. const m_EMLINK = 31
  104. const m_EMSGSIZE = 90
  105. const m_EMULTIHOP = 72
  106. const m_ENAMETOOLONG = 36
  107. const m_ENAVAIL = 119
  108. const m_ENETDOWN = 100
  109. const m_ENETRESET = 102
  110. const m_ENETUNREACH = 101
  111. const m_ENFILE = 23
  112. const m_ENOANO = 55
  113. const m_ENOBUFS = 105
  114. const m_ENOCSI = 50
  115. const m_ENODATA = 61
  116. const m_ENODEV = 19
  117. const m_ENOENT = 2
  118. const m_ENOEXEC = 8
  119. const m_ENOKEY = 126
  120. const m_ENOLCK = 37
  121. const m_ENOLINK = 67
  122. const m_ENOMEDIUM = 123
  123. const m_ENOMEM = 12
  124. const m_ENOMSG = 42
  125. const m_ENONET = 64
  126. const m_ENOPKG = 65
  127. const m_ENOPROTOOPT = 92
  128. const m_ENOSPC = 28
  129. const m_ENOSR = 63
  130. const m_ENOSTR = 60
  131. const m_ENOSYS = 38
  132. const m_ENOTBLK = 15
  133. const m_ENOTCONN = 107
  134. const m_ENOTDIR = 20
  135. const m_ENOTEMPTY = 39
  136. const m_ENOTNAM = 118
  137. const m_ENOTRECOVERABLE = 131
  138. const m_ENOTSOCK = 88
  139. const m_ENOTSUP = "EOPNOTSUPP"
  140. const m_ENOTTY = 25
  141. const m_ENOTUNIQ = 76
  142. const m_ENXIO = 6
  143. const m_EOPNOTSUPP = 95
  144. const m_EOVERFLOW = 75
  145. const m_EOWNERDEAD = 130
  146. const m_EPERM = 1
  147. const m_EPFNOSUPPORT = 96
  148. const m_EPIPE = 32
  149. const m_EPROTO = 71
  150. const m_EPROTONOSUPPORT = 93
  151. const m_EPROTOTYPE = 91
  152. const m_ERANGE = 34
  153. const m_EREMCHG = 78
  154. const m_EREMOTE = 66
  155. const m_EREMOTEIO = 121
  156. const m_ERESTART = 85
  157. const m_ERFKILL = 132
  158. const m_EROFS = 30
  159. const m_ESHUTDOWN = 108
  160. const m_ESOCKTNOSUPPORT = 94
  161. const m_ESPIPE = 29
  162. const m_ESRCH = 3
  163. const m_ESRMNT = 69
  164. const m_ESTALE = 116
  165. const m_ESTRPIPE = 86
  166. const m_ETIME = 62
  167. const m_ETIMEDOUT = 110
  168. const m_ETOOMANYREFS = 109
  169. const m_ETXTBSY = 26
  170. const m_EUCLEAN = 117
  171. const m_EUNATCH = 49
  172. const m_EUSERS = 87
  173. const m_EWOULDBLOCK = "EAGAIN"
  174. const m_EXDEV = 18
  175. const m_EXFULL = 54
  176. const m_EXIT_FAILURE = 1
  177. const m_EXIT_SUCCESS = 0
  178. const m_EXPR_NEST_MAX = 32
  179. const m_FD_SETSIZE = 1024
  180. const m_FILENAME_MAX = 4096
  181. const m_FILESIZEBITS = 64
  182. const m_FOPEN_MAX = 1000
  183. const m_FPARSELN_UNESCALL = 0x0f
  184. const m_FPARSELN_UNESCCOMM = 0x04
  185. const m_FPARSELN_UNESCCONT = 0x02
  186. const m_FPARSELN_UNESCESC = 0x01
  187. const m_FPARSELN_UNESCREST = 0x08
  188. const m_FPE_FLTDIV = 3
  189. const m_FPE_FLTINV = 7
  190. const m_FPE_FLTOVF = 4
  191. const m_FPE_FLTRES = 6
  192. const m_FPE_FLTSUB = 8
  193. const m_FPE_FLTUND = 5
  194. const m_FPE_INTDIV = 1
  195. const m_FPE_INTOVF = 2
  196. const m_F_LOCK = 1
  197. const m_F_OK = 0
  198. const m_F_TEST = 3
  199. const m_F_TLOCK = 2
  200. const m_F_ULOCK = 0
  201. const m_HAVE_ASPRINTF = 1
  202. const m_HAVE_CLEARENV = 1
  203. const m_HAVE_CONFIG_H = 1
  204. const m_HAVE_DECL_ENVIRON = 1
  205. const m_HAVE_DIRENT_H = 1
  206. const m_HAVE_DIRFD = 1
  207. const m_HAVE_DLFCN_H = 1
  208. const m_HAVE_FLOCK = 1
  209. const m_HAVE_FOPENCOOKIE = 1
  210. const m_HAVE_GETAUXVAL = 1
  211. const m_HAVE_GETENTROPY = 1
  212. const m_HAVE_GETLINE = 1
  213. const m_HAVE_GRP_H = 1
  214. const m_HAVE_INTTYPES_H = 1
  215. const m_HAVE_OPEN_MEMSTREAM = 1
  216. const m_HAVE_PROGRAM_INVOCATION_SHORT_NAME = 1
  217. const m_HAVE_PWD_H = 1
  218. const m_HAVE_STDINT_H = 1
  219. const m_HAVE_STDIO_EXT_H = 1
  220. const m_HAVE_STDIO_H = 1
  221. const m_HAVE_STDLIB_H = 1
  222. const m_HAVE_STRINGS_H = 1
  223. const m_HAVE_STRING_H = 1
  224. const m_HAVE_SYSCONF = 1
  225. const m_HAVE_SYS_DIR_H = 1
  226. const m_HAVE_SYS_STAT_H = 1
  227. const m_HAVE_SYS_TYPES_H = 1
  228. const m_HAVE_TYPEOF = 1
  229. const m_HAVE_UNISTD_H = 1
  230. const m_HAVE_VASPRINTF = 1
  231. const m_HAVE_WCHAR_H = 1
  232. const m_HAVE___FPURGE = 1
  233. const m_HAVE___PROGNAME = 1
  234. const m_HN_AUTOSCALE = 0x20
  235. const m_HN_B = 0x04
  236. const m_HN_DECIMAL = 0x01
  237. const m_HN_DIVISOR_1000 = 0x08
  238. const m_HN_GETSCALE = 0x10
  239. const m_HN_IEC_PREFIXES = 0x10
  240. const m_HN_NOSPACE = 0x02
  241. const m_HOST_NAME_MAX = 255
  242. const m_ILL_BADSTK = 8
  243. const m_ILL_COPROC = 7
  244. const m_ILL_ILLADR = 3
  245. const m_ILL_ILLOPC = 1
  246. const m_ILL_ILLOPN = 2
  247. const m_ILL_ILLTRP = 4
  248. const m_ILL_PRVOPC = 5
  249. const m_ILL_PRVREG = 6
  250. const m_INT16_MAX = 0x7fff
  251. const m_INT32_MAX = 0x7fffffff
  252. const m_INT64_MAX = 0x7fffffffffffffff
  253. const m_INT8_MAX = 0x7f
  254. const m_INTMAX_MAX = "INT64_MAX"
  255. const m_INTMAX_MIN = "INT64_MIN"
  256. const m_INTPTR_MAX = "INT64_MAX"
  257. const m_INTPTR_MIN = "INT64_MIN"
  258. const m_INT_FAST16_MAX = "INT32_MAX"
  259. const m_INT_FAST16_MIN = "INT32_MIN"
  260. const m_INT_FAST32_MAX = "INT32_MAX"
  261. const m_INT_FAST32_MIN = "INT32_MIN"
  262. const m_INT_FAST64_MAX = "INT64_MAX"
  263. const m_INT_FAST64_MIN = "INT64_MIN"
  264. const m_INT_FAST8_MAX = "INT8_MAX"
  265. const m_INT_FAST8_MIN = "INT8_MIN"
  266. const m_INT_LEAST16_MAX = "INT16_MAX"
  267. const m_INT_LEAST16_MIN = "INT16_MIN"
  268. const m_INT_LEAST32_MAX = "INT32_MAX"
  269. const m_INT_LEAST32_MIN = "INT32_MIN"
  270. const m_INT_LEAST64_MAX = "INT64_MAX"
  271. const m_INT_LEAST64_MIN = "INT64_MIN"
  272. const m_INT_LEAST8_MAX = "INT8_MAX"
  273. const m_INT_LEAST8_MIN = "INT8_MIN"
  274. const m_INT_MAX = 0x7fffffff
  275. const m_IOV_MAX = 1024
  276. const m_LARCH_NGREG = 32
  277. const m_LARCH_REG_A0 = 4
  278. const m_LARCH_REG_NARGS = 8
  279. const m_LARCH_REG_RA = 1
  280. const m_LARCH_REG_S0 = 23
  281. const m_LARCH_REG_S1 = 24
  282. const m_LARCH_REG_S2 = 25
  283. const m_LARCH_REG_SP = 3
  284. const m_LIBBSD_ABI_ACCMODE = 1
  285. const m_LIBBSD_ABI_ARC4RANDOM = 1
  286. const m_LIBBSD_ABI_ARC4RANDOM_STIR = 1
  287. const m_LIBBSD_ABI_ASPRINTF = 0
  288. const m_LIBBSD_ABI_BSD_GETOPT = 1
  289. const m_LIBBSD_ABI_CLOSEFROM = 1
  290. const m_LIBBSD_ABI_ERR = 0
  291. const m_LIBBSD_ABI_ERRC = 1
  292. const m_LIBBSD_ABI_EXPAND_NUMBER = 1
  293. const m_LIBBSD_ABI_EXPLICIT_BZERO = 1
  294. const m_LIBBSD_ABI_FGETLN = 1
  295. const m_LIBBSD_ABI_FLOPEN = 1
  296. const m_LIBBSD_ABI_FMTCHECK = 1
  297. const m_LIBBSD_ABI_FPURGE = 1
  298. const m_LIBBSD_ABI_FREEZERO = 1
  299. const m_LIBBSD_ABI_FUNOPEN = 1
  300. const m_LIBBSD_ABI_GETBSIZE = 1
  301. const m_LIBBSD_ABI_GETPEEREID = 1
  302. const m_LIBBSD_ABI_HUMANIZE_NUMBER = 1
  303. const m_LIBBSD_ABI_ID_FROM_NAME = 1
  304. const m_LIBBSD_ABI_INET_NET_PTON = 1
  305. const m_LIBBSD_ABI_MD5 = 1
  306. const m_LIBBSD_ABI_NAME_FROM_ID = 1
  307. const m_LIBBSD_ABI_NLIST = 1
  308. const m_LIBBSD_ABI_PIDFILE = 1
  309. const m_LIBBSD_ABI_PROCTITLE = 1
  310. const m_LIBBSD_ABI_PROGNAME = 1
  311. const m_LIBBSD_ABI_PWCACHE = 1
  312. const m_LIBBSD_ABI_READPASSPHRASE = 1
  313. const m_LIBBSD_ABI_REALLOCARRAY = 1
  314. const m_LIBBSD_ABI_REALLOCF = 1
  315. const m_LIBBSD_ABI_RECALLOCARRAY = 1
  316. const m_LIBBSD_ABI_SORT = 1
  317. const m_LIBBSD_ABI_STRINGLIST = 1
  318. const m_LIBBSD_ABI_STRL = 1
  319. const m_LIBBSD_ABI_STRMODE = 1
  320. const m_LIBBSD_ABI_STRNSTR = 1
  321. const m_LIBBSD_ABI_STRTONUM = 1
  322. const m_LIBBSD_ABI_STRTOX = 1
  323. const m_LIBBSD_ABI_TIME64 = 0
  324. const m_LIBBSD_ABI_TIMECONV = 1
  325. const m_LIBBSD_ABI_TRANSPARENT_LIBMD = 1
  326. const m_LIBBSD_ABI_VIS = 1
  327. const m_LIBBSD_ABI_WCSL = 1
  328. const m_LIBBSD_DISABLE_DEPRECATED = 1
  329. const m_LIBBSD_OVERLAY = 1
  330. const m_LIBBSD_SYS_HAS_TIME64 = 1
  331. const m_LIBBSD_SYS_TIME_BITS = 64
  332. const m_LINE_MAX = 4096
  333. const m_LITTLE_ENDIAN = "__LITTLE_ENDIAN"
  334. const m_LLONG_MAX = 0x7fffffffffffffff
  335. const m_LOGIN_NAME_MAX = 256
  336. const m_LONG_BIT = 64
  337. const m_LONG_MAX = "__LONG_MAX"
  338. const m_LT_OBJDIR = ".libs/"
  339. const m_L_INCR = 1
  340. const m_L_SET = 0
  341. const m_L_XTND = 2
  342. const m_L_ctermid = 20
  343. const m_L_cuserid = 20
  344. const m_L_tmpnam = 20
  345. const m_MB_LEN_MAX = 4
  346. const m_MINSIGSTKSZ = 4096
  347. const m_MQ_PRIO_MAX = 32768
  348. const m_NAME_MAX = 255
  349. const m_NDEBUG = 1
  350. const m_NGROUPS_MAX = 32
  351. const m_NL_ARGMAX = 9
  352. const m_NL_LANGMAX = 32
  353. const m_NL_MSGMAX = 32767
  354. const m_NL_NMAX = 16
  355. const m_NL_SETMAX = 255
  356. const m_NL_TEXTMAX = 2048
  357. const m_NSIG = "_NSIG"
  358. const m_NZERO = 20
  359. const m_PACKAGE = "libbsd"
  360. const m_PACKAGE_BUGREPORT = "libbsd@lists.freedesktop.org"
  361. const m_PACKAGE_NAME = "libbsd"
  362. const m_PACKAGE_STRING = "libbsd 0.12.0"
  363. const m_PACKAGE_TARNAME = "libbsd"
  364. const m_PACKAGE_URL = ""
  365. const m_PACKAGE_VERSION = "0.12.0"
  366. const m_PATH_MAX = 4096
  367. const m_PDP_ENDIAN = "__PDP_ENDIAN"
  368. const m_PIC = 1
  369. const m_PIPE_BUF = 4096
  370. const m_POLL_ERR = 4
  371. const m_POLL_HUP = 6
  372. const m_POLL_IN = 1
  373. const m_POLL_MSG = 3
  374. const m_POLL_OUT = 2
  375. const m_POLL_PRI = 5
  376. const m_POSIX_CLOSE_RESTART = 0
  377. const m_PTHREAD_DESTRUCTOR_ITERATIONS = 4
  378. const m_PTHREAD_KEYS_MAX = 128
  379. const m_PTHREAD_STACK_MIN = 2048
  380. const m_PTRDIFF_MAX = "INT64_MAX"
  381. const m_PTRDIFF_MIN = "INT64_MIN"
  382. const m_P_tmpdir = "/tmp"
  383. const m_RAND_MAX = 0x7fffffff
  384. const m_RE_DUP_MAX = 255
  385. const m_R_OK = 4
  386. const m_SA_EXPOSE_TAGBITS = 0x00000800
  387. const m_SA_NOCLDSTOP = 1
  388. const m_SA_NOCLDWAIT = 2
  389. const m_SA_NODEFER = 0x40000000
  390. const m_SA_NOMASK = "SA_NODEFER"
  391. const m_SA_ONESHOT = "SA_RESETHAND"
  392. const m_SA_ONSTACK = 0x08000000
  393. const m_SA_RESETHAND = 0x80000000
  394. const m_SA_RESTART = 0x10000000
  395. const m_SA_SIGINFO = 4
  396. const m_SA_UNSUPPORTED = 0x00000400
  397. const m_SCHAR_MAX = 127
  398. const m_SEEK_DATA = 3
  399. const m_SEEK_HOLE = 4
  400. const m_SEGV_ACCERR = 2
  401. const m_SEGV_BNDERR = 3
  402. const m_SEGV_MAPERR = 1
  403. const m_SEGV_MTEAERR = 8
  404. const m_SEGV_MTESERR = 9
  405. const m_SEGV_PKUERR = 4
  406. const m_SEM_NSEMS_MAX = 256
  407. const m_SEM_VALUE_MAX = 0x7fffffff
  408. const m_SET_LEN = 6
  409. const m_SET_LEN_INCR = 4
  410. const m_SHRT_MAX = 0x7fff
  411. const m_SIGABRT = 6
  412. const m_SIGALRM = 14
  413. const m_SIGBUS = 7
  414. const m_SIGCHLD = 17
  415. const m_SIGCONT = 18
  416. const m_SIGEV_NONE = 1
  417. const m_SIGEV_SIGNAL = 0
  418. const m_SIGEV_THREAD = 2
  419. const m_SIGEV_THREAD_ID = 4
  420. const m_SIGFPE = 8
  421. const m_SIGHUP = 1
  422. const m_SIGILL = 4
  423. const m_SIGINT = 2
  424. const m_SIGIO = 29
  425. const m_SIGIOT = "SIGABRT"
  426. const m_SIGKILL = 9
  427. const m_SIGPIPE = 13
  428. const m_SIGPOLL = "SIGIO"
  429. const m_SIGPROF = 27
  430. const m_SIGPWR = 30
  431. const m_SIGQUIT = 3
  432. const m_SIGSEGV = 11
  433. const m_SIGSTKFLT = 16
  434. const m_SIGSTKSZ = 16384
  435. const m_SIGSTOP = 19
  436. const m_SIGSYS = 31
  437. const m_SIGTERM = 15
  438. const m_SIGTRAP = 5
  439. const m_SIGTSTP = 20
  440. const m_SIGTTIN = 21
  441. const m_SIGTTOU = 22
  442. const m_SIGUNUSED = "SIGSYS"
  443. const m_SIGURG = 23
  444. const m_SIGUSR1 = 10
  445. const m_SIGUSR2 = 12
  446. const m_SIGVTALRM = 26
  447. const m_SIGWINCH = 28
  448. const m_SIGXCPU = 24
  449. const m_SIGXFSZ = 25
  450. const m_SIG_ATOMIC_MAX = "INT32_MAX"
  451. const m_SIG_ATOMIC_MIN = "INT32_MIN"
  452. const m_SIG_BLOCK = 0
  453. const m_SIG_SETMASK = 2
  454. const m_SIG_UNBLOCK = 1
  455. const m_SIZEOF_TIME_T = 8
  456. const m_SIZE_MAX = "UINT64_MAX"
  457. const m_SI_KERNEL = 128
  458. const m_SI_USER = 0
  459. const m_SSIZE_MAX = "LONG_MAX"
  460. const m_SS_DISABLE = 2
  461. const m_SS_FLAG_BITS = "SS_AUTODISARM"
  462. const m_SS_ONSTACK = 1
  463. const m_STATX_ALL = 0xfff
  464. const m_STATX_ATIME = 0x20
  465. const m_STATX_BASIC_STATS = 0x7ff
  466. const m_STATX_BLOCKS = 0x400
  467. const m_STATX_BTIME = 0x800
  468. const m_STATX_CTIME = 0x80
  469. const m_STATX_GID = 0x10
  470. const m_STATX_INO = 0x100
  471. const m_STATX_MODE = 2
  472. const m_STATX_MTIME = 0x40
  473. const m_STATX_NLINK = 4
  474. const m_STATX_SIZE = 0x200
  475. const m_STATX_TYPE = 1
  476. const m_STATX_UID = 8
  477. const m_STDC_HEADERS = 1
  478. const m_STDERR_FILENO = 2
  479. const m_STDIN_FILENO = 0
  480. const m_STDOUT_FILENO = 1
  481. const m_SYMLOOP_MAX = 40
  482. const m_SYS_SECCOMP = 1
  483. const m_SYS_USER_DISPATCH = 2
  484. const m_S_IEXEC = "S_IXUSR"
  485. const m_S_IFBLK = 0060000
  486. const m_S_IFCHR = 0020000
  487. const m_S_IFDIR = 16384
  488. const m_S_IFIFO = 0010000
  489. const m_S_IFLNK = 0120000
  490. const m_S_IFMT = 0170000
  491. const m_S_IFREG = 0100000
  492. const m_S_IFSOCK = 0140000
  493. const m_S_IREAD = "S_IRUSR"
  494. const m_S_IRGRP = 32
  495. const m_S_IROTH = 4
  496. const m_S_IRUSR = 256
  497. const m_S_IRWXG = 56
  498. const m_S_IRWXO = 7
  499. const m_S_IRWXU = 448
  500. const m_S_ISGID = 1024
  501. const m_S_ISTXT = "S_ISVTX"
  502. const m_S_ISUID = 2048
  503. const m_S_ISVTX = 512
  504. const m_S_IWGRP = 16
  505. const m_S_IWOTH = 2
  506. const m_S_IWRITE = "S_IWUSR"
  507. const m_S_IWUSR = 128
  508. const m_S_IXGRP = 8
  509. const m_S_IXOTH = 1
  510. const m_S_IXUSR = 64
  511. const m_TMP_MAX = 10000
  512. const m_TRAP_BRANCH = 3
  513. const m_TRAP_BRKPT = 1
  514. const m_TRAP_HWBKPT = 4
  515. const m_TRAP_TRACE = 2
  516. const m_TRAP_UNK = 5
  517. const m_TTY_NAME_MAX = 32
  518. const m_TZNAME_MAX = 6
  519. const m_UCHAR_MAX = 255
  520. const m_UINT16_MAX = 0xffff
  521. const m_UINT32_MAX = "0xffffffffu"
  522. const m_UINT64_MAX = "0xffffffffffffffffu"
  523. const m_UINT8_MAX = 0xff
  524. const m_UINTMAX_MAX = "UINT64_MAX"
  525. const m_UINTPTR_MAX = "UINT64_MAX"
  526. const m_UINT_FAST16_MAX = "UINT32_MAX"
  527. const m_UINT_FAST32_MAX = "UINT32_MAX"
  528. const m_UINT_FAST64_MAX = "UINT64_MAX"
  529. const m_UINT_FAST8_MAX = "UINT8_MAX"
  530. const m_UINT_LEAST16_MAX = "UINT16_MAX"
  531. const m_UINT_LEAST32_MAX = "UINT32_MAX"
  532. const m_UINT_LEAST64_MAX = "UINT64_MAX"
  533. const m_UINT_LEAST8_MAX = "UINT8_MAX"
  534. const m_UINT_MAX = 0xffffffff
  535. const m_USHRT_MAX = 0xffff
  536. const m_UTIME_NOW = 0x3fffffff
  537. const m_UTIME_OMIT = 0x3ffffffe
  538. const m_VERSION = "0.12.0"
  539. const m_WINT_MAX = "UINT32_MAX"
  540. const m_WINT_MIN = 0
  541. const m_WNOHANG = 1
  542. const m_WORD_BIT = 32
  543. const m_WUNTRACED = 2
  544. const m_W_OK = 2
  545. const m_X_OK = 1
  546. const m__ABILP64 = 3
  547. const m__ALL_SOURCE = 1
  548. const m__CS_GNU_LIBC_VERSION = 2
  549. const m__CS_GNU_LIBPTHREAD_VERSION = 3
  550. const m__CS_PATH = 0
  551. const m__CS_POSIX_V5_WIDTH_RESTRICTED_ENVS = 4
  552. const m__CS_POSIX_V6_ILP32_OFF32_CFLAGS = 1116
  553. const m__CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 1117
  554. const m__CS_POSIX_V6_ILP32_OFF32_LIBS = 1118
  555. const m__CS_POSIX_V6_ILP32_OFF32_LINTFLAGS = 1119
  556. const m__CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 1120
  557. const m__CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 1121
  558. const m__CS_POSIX_V6_ILP32_OFFBIG_LIBS = 1122
  559. const m__CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS = 1123
  560. const m__CS_POSIX_V6_LP64_OFF64_CFLAGS = 1124
  561. const m__CS_POSIX_V6_LP64_OFF64_LDFLAGS = 1125
  562. const m__CS_POSIX_V6_LP64_OFF64_LIBS = 1126
  563. const m__CS_POSIX_V6_LP64_OFF64_LINTFLAGS = 1127
  564. const m__CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 1128
  565. const m__CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 1129
  566. const m__CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 1130
  567. const m__CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS = 1131
  568. const m__CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 1
  569. const m__CS_POSIX_V7_ILP32_OFF32_CFLAGS = 1132
  570. const m__CS_POSIX_V7_ILP32_OFF32_LDFLAGS = 1133
  571. const m__CS_POSIX_V7_ILP32_OFF32_LIBS = 1134
  572. const m__CS_POSIX_V7_ILP32_OFF32_LINTFLAGS = 1135
  573. const m__CS_POSIX_V7_ILP32_OFFBIG_CFLAGS = 1136
  574. const m__CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS = 1137
  575. const m__CS_POSIX_V7_ILP32_OFFBIG_LIBS = 1138
  576. const m__CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS = 1139
  577. const m__CS_POSIX_V7_LP64_OFF64_CFLAGS = 1140
  578. const m__CS_POSIX_V7_LP64_OFF64_LDFLAGS = 1141
  579. const m__CS_POSIX_V7_LP64_OFF64_LIBS = 1142
  580. const m__CS_POSIX_V7_LP64_OFF64_LINTFLAGS = 1143
  581. const m__CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS = 1144
  582. const m__CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS = 1145
  583. const m__CS_POSIX_V7_LPBIG_OFFBIG_LIBS = 1146
  584. const m__CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS = 1147
  585. const m__CS_POSIX_V7_THREADS_CFLAGS = 1150
  586. const m__CS_POSIX_V7_THREADS_LDFLAGS = 1151
  587. const m__CS_POSIX_V7_WIDTH_RESTRICTED_ENVS = 5
  588. const m__CS_V6_ENV = 1148
  589. const m__CS_V7_ENV = 1149
  590. const m__DARWIN_C_SOURCE = 1
  591. const m__GNU_SOURCE = 1
  592. const m__HPUX_ALT_XOPEN_SOCKET_API = 1
  593. const m__IOFBF = 0
  594. const m__IOLBF = 1
  595. const m__IONBF = 2
  596. const m__LOONGARCH_ARCH = "la64v1.0"
  597. const m__LOONGARCH_FPSET = 32
  598. const m__LOONGARCH_SIM = "_ABILP64"
  599. const m__LOONGARCH_SPFPSET = 32
  600. const m__LOONGARCH_SZINT = 32
  601. const m__LOONGARCH_SZLONG = 64
  602. const m__LOONGARCH_SZPTR = 64
  603. const m__LOONGARCH_TUNE = "generic"
  604. const m__LP64 = 1
  605. const m__NETBSD_SOURCE = 1
  606. const m__NSIG = 65
  607. const m__OPENBSD_SOURCE = 1
  608. const m__PC_2_SYMLINKS = 20
  609. const m__PC_ALLOC_SIZE_MIN = 18
  610. const m__PC_ASYNC_IO = 10
  611. const m__PC_CHOWN_RESTRICTED = 6
  612. const m__PC_FILESIZEBITS = 13
  613. const m__PC_LINK_MAX = 0
  614. const m__PC_MAX_CANON = 1
  615. const m__PC_MAX_INPUT = 2
  616. const m__PC_NAME_MAX = 3
  617. const m__PC_NO_TRUNC = 7
  618. const m__PC_PATH_MAX = 4
  619. const m__PC_PIPE_BUF = 5
  620. const m__PC_PRIO_IO = 11
  621. const m__PC_REC_INCR_XFER_SIZE = 14
  622. const m__PC_REC_MAX_XFER_SIZE = 15
  623. const m__PC_REC_MIN_XFER_SIZE = 16
  624. const m__PC_REC_XFER_ALIGN = 17
  625. const m__PC_SOCK_MAXBUF = 12
  626. const m__PC_SYMLINK_MAX = 19
  627. const m__PC_SYNC_IO = 9
  628. const m__PC_VDISABLE = 8
  629. const m__POSIX2_BC_BASE_MAX = 99
  630. const m__POSIX2_BC_DIM_MAX = 2048
  631. const m__POSIX2_BC_SCALE_MAX = 99
  632. const m__POSIX2_BC_STRING_MAX = 1000
  633. const m__POSIX2_CHARCLASS_NAME_MAX = 14
  634. const m__POSIX2_COLL_WEIGHTS_MAX = 2
  635. const m__POSIX2_C_BIND = "_POSIX_VERSION"
  636. const m__POSIX2_EXPR_NEST_MAX = 32
  637. const m__POSIX2_LINE_MAX = 2048
  638. const m__POSIX2_RE_DUP_MAX = 255
  639. const m__POSIX2_VERSION = "_POSIX_VERSION"
  640. const m__POSIX_ADVISORY_INFO = "_POSIX_VERSION"
  641. const m__POSIX_AIO_LISTIO_MAX = 2
  642. const m__POSIX_AIO_MAX = 1
  643. const m__POSIX_ARG_MAX = 4096
  644. const m__POSIX_ASYNCHRONOUS_IO = "_POSIX_VERSION"
  645. const m__POSIX_BARRIERS = "_POSIX_VERSION"
  646. const m__POSIX_CHILD_MAX = 25
  647. const m__POSIX_CHOWN_RESTRICTED = 1
  648. const m__POSIX_CLOCKRES_MIN = 20000000
  649. const m__POSIX_CLOCK_SELECTION = "_POSIX_VERSION"
  650. const m__POSIX_CPUTIME = "_POSIX_VERSION"
  651. const m__POSIX_DELAYTIMER_MAX = 32
  652. const m__POSIX_FSYNC = "_POSIX_VERSION"
  653. const m__POSIX_HOST_NAME_MAX = 255
  654. const m__POSIX_IPV6 = "_POSIX_VERSION"
  655. const m__POSIX_JOB_CONTROL = 1
  656. const m__POSIX_LINK_MAX = 8
  657. const m__POSIX_LOGIN_NAME_MAX = 9
  658. const m__POSIX_MAPPED_FILES = "_POSIX_VERSION"
  659. const m__POSIX_MAX_CANON = 255
  660. const m__POSIX_MAX_INPUT = 255
  661. const m__POSIX_MEMLOCK = "_POSIX_VERSION"
  662. const m__POSIX_MEMLOCK_RANGE = "_POSIX_VERSION"
  663. const m__POSIX_MEMORY_PROTECTION = "_POSIX_VERSION"
  664. const m__POSIX_MESSAGE_PASSING = "_POSIX_VERSION"
  665. const m__POSIX_MONOTONIC_CLOCK = "_POSIX_VERSION"
  666. const m__POSIX_MQ_OPEN_MAX = 8
  667. const m__POSIX_MQ_PRIO_MAX = 32
  668. const m__POSIX_NAME_MAX = 14
  669. const m__POSIX_NGROUPS_MAX = 8
  670. const m__POSIX_NO_TRUNC = 1
  671. const m__POSIX_OPEN_MAX = 20
  672. const m__POSIX_PATH_MAX = 256
  673. const m__POSIX_PIPE_BUF = 512
  674. const m__POSIX_PTHREAD_SEMANTICS = 1
  675. const m__POSIX_RAW_SOCKETS = "_POSIX_VERSION"
  676. const m__POSIX_READER_WRITER_LOCKS = "_POSIX_VERSION"
  677. const m__POSIX_REALTIME_SIGNALS = "_POSIX_VERSION"
  678. const m__POSIX_REGEXP = 1
  679. const m__POSIX_RE_DUP_MAX = 255
  680. const m__POSIX_RTSIG_MAX = 8
  681. const m__POSIX_SAVED_IDS = 1
  682. const m__POSIX_SEMAPHORES = "_POSIX_VERSION"
  683. const m__POSIX_SEM_NSEMS_MAX = 256
  684. const m__POSIX_SEM_VALUE_MAX = 32767
  685. const m__POSIX_SHARED_MEMORY_OBJECTS = "_POSIX_VERSION"
  686. const m__POSIX_SHELL = 1
  687. const m__POSIX_SIGQUEUE_MAX = 32
  688. const m__POSIX_SPAWN = "_POSIX_VERSION"
  689. const m__POSIX_SPIN_LOCKS = "_POSIX_VERSION"
  690. const m__POSIX_SSIZE_MAX = 32767
  691. const m__POSIX_SS_REPL_MAX = 4
  692. const m__POSIX_STREAM_MAX = 8
  693. const m__POSIX_SYMLINK_MAX = 255
  694. const m__POSIX_SYMLOOP_MAX = 8
  695. const m__POSIX_THREADS = "_POSIX_VERSION"
  696. const m__POSIX_THREAD_ATTR_STACKADDR = "_POSIX_VERSION"
  697. const m__POSIX_THREAD_ATTR_STACKSIZE = "_POSIX_VERSION"
  698. const m__POSIX_THREAD_CPUTIME = "_POSIX_VERSION"
  699. const m__POSIX_THREAD_DESTRUCTOR_ITERATIONS = 4
  700. const m__POSIX_THREAD_KEYS_MAX = 128
  701. const m__POSIX_THREAD_PRIORITY_SCHEDULING = "_POSIX_VERSION"
  702. const m__POSIX_THREAD_PROCESS_SHARED = "_POSIX_VERSION"
  703. const m__POSIX_THREAD_SAFE_FUNCTIONS = "_POSIX_VERSION"
  704. const m__POSIX_THREAD_THREADS_MAX = 64
  705. const m__POSIX_TIMEOUTS = "_POSIX_VERSION"
  706. const m__POSIX_TIMERS = "_POSIX_VERSION"
  707. const m__POSIX_TIMER_MAX = 32
  708. const m__POSIX_TRACE_EVENT_NAME_MAX = 30
  709. const m__POSIX_TRACE_NAME_MAX = 8
  710. const m__POSIX_TRACE_SYS_MAX = 8
  711. const m__POSIX_TRACE_USER_EVENT_MAX = 32
  712. const m__POSIX_TTY_NAME_MAX = 9
  713. const m__POSIX_TZNAME_MAX = 6
  714. const m__POSIX_V6_LP64_OFF64 = 1
  715. const m__POSIX_V7_LP64_OFF64 = 1
  716. const m__POSIX_VDISABLE = 0
  717. const m__POSIX_VERSION = 200809
  718. const m__SC_2_CHAR_TERM = 95
  719. const m__SC_2_C_BIND = 47
  720. const m__SC_2_C_DEV = 48
  721. const m__SC_2_FORT_DEV = 49
  722. const m__SC_2_FORT_RUN = 50
  723. const m__SC_2_LOCALEDEF = 52
  724. const m__SC_2_PBS = 168
  725. const m__SC_2_PBS_ACCOUNTING = 169
  726. const m__SC_2_PBS_CHECKPOINT = 175
  727. const m__SC_2_PBS_LOCATE = 170
  728. const m__SC_2_PBS_MESSAGE = 171
  729. const m__SC_2_PBS_TRACK = 172
  730. const m__SC_2_SW_DEV = 51
  731. const m__SC_2_UPE = 97
  732. const m__SC_2_VERSION = 46
  733. const m__SC_ADVISORY_INFO = 132
  734. const m__SC_AIO_LISTIO_MAX = 23
  735. const m__SC_AIO_MAX = 24
  736. const m__SC_AIO_PRIO_DELTA_MAX = 25
  737. const m__SC_ARG_MAX = 0
  738. const m__SC_ASYNCHRONOUS_IO = 12
  739. const m__SC_ATEXIT_MAX = 87
  740. const m__SC_AVPHYS_PAGES = 86
  741. const m__SC_BARRIERS = 133
  742. const m__SC_BC_BASE_MAX = 36
  743. const m__SC_BC_DIM_MAX = 37
  744. const m__SC_BC_SCALE_MAX = 38
  745. const m__SC_BC_STRING_MAX = 39
  746. const m__SC_CHILD_MAX = 1
  747. const m__SC_CLK_TCK = 2
  748. const m__SC_CLOCK_SELECTION = 137
  749. const m__SC_COLL_WEIGHTS_MAX = 40
  750. const m__SC_CPUTIME = 138
  751. const m__SC_DELAYTIMER_MAX = 26
  752. const m__SC_EXPR_NEST_MAX = 42
  753. const m__SC_FSYNC = 15
  754. const m__SC_GETGR_R_SIZE_MAX = 69
  755. const m__SC_GETPW_R_SIZE_MAX = 70
  756. const m__SC_HOST_NAME_MAX = 180
  757. const m__SC_IOV_MAX = 60
  758. const m__SC_IPV6 = 235
  759. const m__SC_JOB_CONTROL = 7
  760. const m__SC_LINE_MAX = 43
  761. const m__SC_LOGIN_NAME_MAX = 71
  762. const m__SC_MAPPED_FILES = 16
  763. const m__SC_MEMLOCK = 17
  764. const m__SC_MEMLOCK_RANGE = 18
  765. const m__SC_MEMORY_PROTECTION = 19
  766. const m__SC_MESSAGE_PASSING = 20
  767. const m__SC_MINSIGSTKSZ = 249
  768. const m__SC_MONOTONIC_CLOCK = 149
  769. const m__SC_MQ_OPEN_MAX = 27
  770. const m__SC_MQ_PRIO_MAX = 28
  771. const m__SC_NGROUPS_MAX = 3
  772. const m__SC_NPROCESSORS_CONF = 83
  773. const m__SC_NPROCESSORS_ONLN = 84
  774. const m__SC_NZERO = 109
  775. const m__SC_OPEN_MAX = 4
  776. const m__SC_PAGESIZE = 30
  777. const m__SC_PAGE_SIZE = 30
  778. const m__SC_PASS_MAX = 88
  779. const m__SC_PHYS_PAGES = 85
  780. const m__SC_PRIORITIZED_IO = 13
  781. const m__SC_PRIORITY_SCHEDULING = 10
  782. const m__SC_RAW_SOCKETS = 236
  783. const m__SC_READER_WRITER_LOCKS = 153
  784. const m__SC_REALTIME_SIGNALS = 9
  785. const m__SC_REGEXP = 155
  786. const m__SC_RE_DUP_MAX = 44
  787. const m__SC_RTSIG_MAX = 31
  788. const m__SC_SAVED_IDS = 8
  789. const m__SC_SEMAPHORES = 21
  790. const m__SC_SEM_NSEMS_MAX = 32
  791. const m__SC_SEM_VALUE_MAX = 33
  792. const m__SC_SHARED_MEMORY_OBJECTS = 22
  793. const m__SC_SHELL = 157
  794. const m__SC_SIGQUEUE_MAX = 34
  795. const m__SC_SIGSTKSZ = 250
  796. const m__SC_SPAWN = 159
  797. const m__SC_SPIN_LOCKS = 154
  798. const m__SC_SPORADIC_SERVER = 160
  799. const m__SC_SS_REPL_MAX = 241
  800. const m__SC_STREAMS = 174
  801. const m__SC_STREAM_MAX = 5
  802. const m__SC_SYMLOOP_MAX = 173
  803. const m__SC_SYNCHRONIZED_IO = 14
  804. const m__SC_THREADS = 67
  805. const m__SC_THREAD_ATTR_STACKADDR = 77
  806. const m__SC_THREAD_ATTR_STACKSIZE = 78
  807. const m__SC_THREAD_CPUTIME = 139
  808. const m__SC_THREAD_DESTRUCTOR_ITERATIONS = 73
  809. const m__SC_THREAD_KEYS_MAX = 74
  810. const m__SC_THREAD_PRIORITY_SCHEDULING = 79
  811. const m__SC_THREAD_PRIO_INHERIT = 80
  812. const m__SC_THREAD_PRIO_PROTECT = 81
  813. const m__SC_THREAD_PROCESS_SHARED = 82
  814. const m__SC_THREAD_ROBUST_PRIO_INHERIT = 247
  815. const m__SC_THREAD_ROBUST_PRIO_PROTECT = 248
  816. const m__SC_THREAD_SAFE_FUNCTIONS = 68
  817. const m__SC_THREAD_SPORADIC_SERVER = 161
  818. const m__SC_THREAD_STACK_MIN = 75
  819. const m__SC_THREAD_THREADS_MAX = 76
  820. const m__SC_TIMEOUTS = 164
  821. const m__SC_TIMERS = 11
  822. const m__SC_TIMER_MAX = 35
  823. const m__SC_TRACE = 181
  824. const m__SC_TRACE_EVENT_FILTER = 182
  825. const m__SC_TRACE_EVENT_NAME_MAX = 242
  826. const m__SC_TRACE_INHERIT = 183
  827. const m__SC_TRACE_LOG = 184
  828. const m__SC_TRACE_NAME_MAX = 243
  829. const m__SC_TRACE_SYS_MAX = 244
  830. const m__SC_TRACE_USER_EVENT_MAX = 245
  831. const m__SC_TTY_NAME_MAX = 72
  832. const m__SC_TYPED_MEMORY_OBJECTS = 165
  833. const m__SC_TZNAME_MAX = 6
  834. const m__SC_UIO_MAXIOV = 60
  835. const m__SC_V6_ILP32_OFF32 = 176
  836. const m__SC_V6_ILP32_OFFBIG = 177
  837. const m__SC_V6_LP64_OFF64 = 178
  838. const m__SC_V6_LPBIG_OFFBIG = 179
  839. const m__SC_V7_ILP32_OFF32 = 237
  840. const m__SC_V7_ILP32_OFFBIG = 238
  841. const m__SC_V7_LP64_OFF64 = 239
  842. const m__SC_V7_LPBIG_OFFBIG = 240
  843. const m__SC_VERSION = 29
  844. const m__SC_XBS5_ILP32_OFF32 = 125
  845. const m__SC_XBS5_ILP32_OFFBIG = 126
  846. const m__SC_XBS5_LP64_OFF64 = 127
  847. const m__SC_XBS5_LPBIG_OFFBIG = 128
  848. const m__SC_XOPEN_CRYPT = 92
  849. const m__SC_XOPEN_ENH_I18N = 93
  850. const m__SC_XOPEN_LEGACY = 129
  851. const m__SC_XOPEN_REALTIME = 130
  852. const m__SC_XOPEN_REALTIME_THREADS = 131
  853. const m__SC_XOPEN_SHM = 94
  854. const m__SC_XOPEN_STREAMS = 246
  855. const m__SC_XOPEN_UNIX = 91
  856. const m__SC_XOPEN_VERSION = 89
  857. const m__SC_XOPEN_XCU_VERSION = 90
  858. const m__SC_XOPEN_XPG2 = 98
  859. const m__SC_XOPEN_XPG3 = 99
  860. const m__SC_XOPEN_XPG4 = 100
  861. const m__STDC_PREDEF_H = 1
  862. const m__SYS_CDEFS_H = 1
  863. const m__TANDEM_SOURCE = 1
  864. const m__XOPEN_ENH_I18N = 1
  865. const m__XOPEN_IOV_MAX = 16
  866. const m__XOPEN_NAME_MAX = 255
  867. const m__XOPEN_PATH_MAX = 1024
  868. const m__XOPEN_UNIX = 1
  869. const m__XOPEN_VERSION = 700
  870. const m___ACCUM_EPSILON__ = "0x1P-15K"
  871. const m___ACCUM_FBIT__ = 15
  872. const m___ACCUM_IBIT__ = 16
  873. const m___ACCUM_MAX__ = "0X7FFFFFFFP-15K"
  874. const m___ATOMIC_ACQUIRE = 2
  875. const m___ATOMIC_ACQ_REL = 4
  876. const m___ATOMIC_CONSUME = 1
  877. const m___ATOMIC_RELAXED = 0
  878. const m___ATOMIC_RELEASE = 3
  879. const m___ATOMIC_SEQ_CST = 5
  880. const m___BIGGEST_ALIGNMENT__ = 16
  881. const m___BIG_ENDIAN = 4321
  882. const m___BYTE_ORDER = 1234
  883. const m___BYTE_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  884. const m___CCGO__ = 1
  885. const m___CHAR_BIT__ = 8
  886. const m___DA_FBIT__ = 31
  887. const m___DA_IBIT__ = 32
  888. const m___DBL_DECIMAL_DIG__ = 17
  889. const m___DBL_DIG__ = 15
  890. const m___DBL_HAS_DENORM__ = 1
  891. const m___DBL_HAS_INFINITY__ = 1
  892. const m___DBL_HAS_QUIET_NAN__ = 1
  893. const m___DBL_IS_IEC_60559__ = 1
  894. const m___DBL_MANT_DIG__ = 53
  895. const m___DBL_MAX_10_EXP__ = 308
  896. const m___DBL_MAX_EXP__ = 1024
  897. const m___DECIMAL_DIG__ = 36
  898. const m___DEC_EVAL_METHOD__ = 2
  899. const m___DQ_FBIT__ = 63
  900. const m___DQ_IBIT__ = 0
  901. const m___ELF__ = 1
  902. const m___EXTENSIONS__ = 1
  903. const m___FINITE_MATH_ONLY__ = 0
  904. const m___FLOAT128_TYPE__ = 1
  905. const m___FLOAT_WORD_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  906. const m___FLT128_DECIMAL_DIG__ = 36
  907. const m___FLT128_DENORM_MIN__ = 6.47517511943802511092443895822764655e-4966
  908. const m___FLT128_DIG__ = 33
  909. const m___FLT128_EPSILON__ = 1.92592994438723585305597794258492732e-34
  910. const m___FLT128_HAS_DENORM__ = 1
  911. const m___FLT128_HAS_INFINITY__ = 1
  912. const m___FLT128_HAS_QUIET_NAN__ = 1
  913. const m___FLT128_IS_IEC_60559__ = 1
  914. const m___FLT128_MANT_DIG__ = 113
  915. const m___FLT128_MAX_10_EXP__ = 4932
  916. const m___FLT128_MAX_EXP__ = 16384
  917. const m___FLT128_MAX__ = "1.18973149535723176508575932662800702e+4932"
  918. const m___FLT128_MIN__ = 3.36210314311209350626267781732175260e-4932
  919. const m___FLT128_NORM_MAX__ = "1.18973149535723176508575932662800702e+4932"
  920. const m___FLT32X_DECIMAL_DIG__ = 17
  921. const m___FLT32X_DENORM_MIN__ = 4.94065645841246544176568792868221372e-324
  922. const m___FLT32X_DIG__ = 15
  923. const m___FLT32X_EPSILON__ = 2.22044604925031308084726333618164062e-16
  924. const m___FLT32X_HAS_DENORM__ = 1
  925. const m___FLT32X_HAS_INFINITY__ = 1
  926. const m___FLT32X_HAS_QUIET_NAN__ = 1
  927. const m___FLT32X_IS_IEC_60559__ = 1
  928. const m___FLT32X_MANT_DIG__ = 53
  929. const m___FLT32X_MAX_10_EXP__ = 308
  930. const m___FLT32X_MAX_EXP__ = 1024
  931. const m___FLT32X_MAX__ = 1.79769313486231570814527423731704357e+308
  932. const m___FLT32X_MIN__ = 2.22507385850720138309023271733240406e-308
  933. const m___FLT32X_NORM_MAX__ = 1.79769313486231570814527423731704357e+308
  934. const m___FLT32_DECIMAL_DIG__ = 9
  935. const m___FLT32_DENORM_MIN__ = 1.40129846432481707092372958328991613e-45
  936. const m___FLT32_DIG__ = 6
  937. const m___FLT32_EPSILON__ = 1.19209289550781250000000000000000000e-7
  938. const m___FLT32_HAS_DENORM__ = 1
  939. const m___FLT32_HAS_INFINITY__ = 1
  940. const m___FLT32_HAS_QUIET_NAN__ = 1
  941. const m___FLT32_IS_IEC_60559__ = 1
  942. const m___FLT32_MANT_DIG__ = 24
  943. const m___FLT32_MAX_10_EXP__ = 38
  944. const m___FLT32_MAX_EXP__ = 128
  945. const m___FLT32_MAX__ = 3.40282346638528859811704183484516925e+38
  946. const m___FLT32_MIN__ = 1.17549435082228750796873653722224568e-38
  947. const m___FLT32_NORM_MAX__ = 3.40282346638528859811704183484516925e+38
  948. const m___FLT64X_DECIMAL_DIG__ = 36
  949. const m___FLT64X_DENORM_MIN__ = 6.47517511943802511092443895822764655e-4966
  950. const m___FLT64X_DIG__ = 33
  951. const m___FLT64X_EPSILON__ = 1.92592994438723585305597794258492732e-34
  952. const m___FLT64X_HAS_DENORM__ = 1
  953. const m___FLT64X_HAS_INFINITY__ = 1
  954. const m___FLT64X_HAS_QUIET_NAN__ = 1
  955. const m___FLT64X_IS_IEC_60559__ = 1
  956. const m___FLT64X_MANT_DIG__ = 113
  957. const m___FLT64X_MAX_10_EXP__ = 4932
  958. const m___FLT64X_MAX_EXP__ = 16384
  959. const m___FLT64X_MAX__ = "1.18973149535723176508575932662800702e+4932"
  960. const m___FLT64X_MIN__ = 3.36210314311209350626267781732175260e-4932
  961. const m___FLT64X_NORM_MAX__ = "1.18973149535723176508575932662800702e+4932"
  962. const m___FLT64_DECIMAL_DIG__ = 17
  963. const m___FLT64_DENORM_MIN__ = 4.94065645841246544176568792868221372e-324
  964. const m___FLT64_DIG__ = 15
  965. const m___FLT64_EPSILON__ = 2.22044604925031308084726333618164062e-16
  966. const m___FLT64_HAS_DENORM__ = 1
  967. const m___FLT64_HAS_INFINITY__ = 1
  968. const m___FLT64_HAS_QUIET_NAN__ = 1
  969. const m___FLT64_IS_IEC_60559__ = 1
  970. const m___FLT64_MANT_DIG__ = 53
  971. const m___FLT64_MAX_10_EXP__ = 308
  972. const m___FLT64_MAX_EXP__ = 1024
  973. const m___FLT64_MAX__ = 1.79769313486231570814527423731704357e+308
  974. const m___FLT64_MIN__ = 2.22507385850720138309023271733240406e-308
  975. const m___FLT64_NORM_MAX__ = 1.79769313486231570814527423731704357e+308
  976. const m___FLT_DECIMAL_DIG__ = 9
  977. const m___FLT_DENORM_MIN__ = 1.40129846432481707092372958328991613e-45
  978. const m___FLT_DIG__ = 6
  979. const m___FLT_EPSILON__ = 1.19209289550781250000000000000000000e-7
  980. const m___FLT_EVAL_METHOD_TS_18661_3__ = 0
  981. const m___FLT_EVAL_METHOD__ = 0
  982. const m___FLT_HAS_DENORM__ = 1
  983. const m___FLT_HAS_INFINITY__ = 1
  984. const m___FLT_HAS_QUIET_NAN__ = 1
  985. const m___FLT_IS_IEC_60559__ = 1
  986. const m___FLT_MANT_DIG__ = 24
  987. const m___FLT_MAX_10_EXP__ = 38
  988. const m___FLT_MAX_EXP__ = 128
  989. const m___FLT_MAX__ = 3.40282346638528859811704183484516925e+38
  990. const m___FLT_MIN__ = 1.17549435082228750796873653722224568e-38
  991. const m___FLT_NORM_MAX__ = 3.40282346638528859811704183484516925e+38
  992. const m___FLT_RADIX__ = 2
  993. const m___FP_FAST_FMA = 1
  994. const m___FP_FAST_FMAF = 1
  995. const m___FP_FAST_FMAF32 = 1
  996. const m___FP_FAST_FMAF32x = 1
  997. const m___FP_FAST_FMAF64 = 1
  998. const m___FRACT_EPSILON__ = "0x1P-15R"
  999. const m___FRACT_FBIT__ = 15
  1000. const m___FRACT_IBIT__ = 0
  1001. const m___FRACT_MAX__ = "0X7FFFP-15R"
  1002. const m___FUNCTION__ = "__func__"
  1003. const m___GCC_ATOMIC_BOOL_LOCK_FREE = 2
  1004. const m___GCC_ATOMIC_CHAR16_T_LOCK_FREE = 2
  1005. const m___GCC_ATOMIC_CHAR32_T_LOCK_FREE = 2
  1006. const m___GCC_ATOMIC_CHAR_LOCK_FREE = 2
  1007. const m___GCC_ATOMIC_INT_LOCK_FREE = 2
  1008. const m___GCC_ATOMIC_LLONG_LOCK_FREE = 2
  1009. const m___GCC_ATOMIC_LONG_LOCK_FREE = 2
  1010. const m___GCC_ATOMIC_POINTER_LOCK_FREE = 2
  1011. const m___GCC_ATOMIC_SHORT_LOCK_FREE = 2
  1012. const m___GCC_ATOMIC_TEST_AND_SET_TRUEVAL = 1
  1013. const m___GCC_ATOMIC_WCHAR_T_LOCK_FREE = 2
  1014. const m___GCC_HAVE_DWARF2_CFI_ASM = 1
  1015. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 = 1
  1016. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 = 1
  1017. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 = 1
  1018. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 = 1
  1019. const m___GCC_IEC_559 = 2
  1020. const m___GCC_IEC_559_COMPLEX = 2
  1021. const m___GNUC_EXECUTION_CHARSET_NAME = "UTF-8"
  1022. const m___GNUC_MINOR__ = 2
  1023. const m___GNUC_PATCHLEVEL__ = 1
  1024. const m___GNUC_RH_RELEASE__ = 6
  1025. const m___GNUC_STDC_INLINE__ = 1
  1026. const m___GNUC_WIDE_EXECUTION_CHARSET_NAME = "UTF-32LE"
  1027. const m___GNUC__ = 14
  1028. const m___GXX_ABI_VERSION = 1019
  1029. const m___HAVE_GENERIC_SELECTION = 0
  1030. const m___HAVE_SPECULATION_SAFE_VALUE = 1
  1031. const m___HA_FBIT__ = 7
  1032. const m___HA_IBIT__ = 8
  1033. const m___HQ_FBIT__ = 15
  1034. const m___HQ_IBIT__ = 0
  1035. const m___INT16_MAX__ = 0x7fff
  1036. const m___INT32_MAX__ = 0x7fffffff
  1037. const m___INT32_TYPE__ = "int"
  1038. const m___INT64_MAX__ = 0x7fffffffffffffff
  1039. const m___INT8_MAX__ = 0x7f
  1040. const m___INTMAX_MAX__ = 0x7fffffffffffffff
  1041. const m___INTMAX_WIDTH__ = 64
  1042. const m___INTPTR_MAX__ = 0x7fffffffffffffff
  1043. const m___INTPTR_WIDTH__ = 64
  1044. const m___INT_FAST16_MAX__ = 0x7fffffffffffffff
  1045. const m___INT_FAST16_WIDTH__ = 64
  1046. const m___INT_FAST32_MAX__ = 0x7fffffffffffffff
  1047. const m___INT_FAST32_WIDTH__ = 64
  1048. const m___INT_FAST64_MAX__ = 0x7fffffffffffffff
  1049. const m___INT_FAST64_WIDTH__ = 64
  1050. const m___INT_FAST8_MAX__ = 0x7f
  1051. const m___INT_FAST8_WIDTH__ = 8
  1052. const m___INT_LEAST16_MAX__ = 0x7fff
  1053. const m___INT_LEAST16_WIDTH__ = 16
  1054. const m___INT_LEAST32_MAX__ = 0x7fffffff
  1055. const m___INT_LEAST32_TYPE__ = "int"
  1056. const m___INT_LEAST32_WIDTH__ = 32
  1057. const m___INT_LEAST64_MAX__ = 0x7fffffffffffffff
  1058. const m___INT_LEAST64_WIDTH__ = 64
  1059. const m___INT_LEAST8_MAX__ = 0x7f
  1060. const m___INT_LEAST8_WIDTH__ = 8
  1061. const m___INT_MAX__ = 0x7fffffff
  1062. const m___INT_WIDTH__ = 32
  1063. const m___LACCUM_EPSILON__ = "0x1P-31LK"
  1064. const m___LACCUM_FBIT__ = 31
  1065. const m___LACCUM_IBIT__ = 32
  1066. const m___LACCUM_MAX__ = "0X7FFFFFFFFFFFFFFFP-31LK"
  1067. const m___LDBL_DECIMAL_DIG__ = 36
  1068. const m___LDBL_DENORM_MIN__ = 6.47517511943802511092443895822764655e-4966
  1069. const m___LDBL_DIG__ = 33
  1070. const m___LDBL_EPSILON__ = 1.92592994438723585305597794258492732e-34
  1071. const m___LDBL_HAS_DENORM__ = 1
  1072. const m___LDBL_HAS_INFINITY__ = 1
  1073. const m___LDBL_HAS_QUIET_NAN__ = 1
  1074. const m___LDBL_IS_IEC_60559__ = 1
  1075. const m___LDBL_MANT_DIG__ = 113
  1076. const m___LDBL_MAX_10_EXP__ = 4932
  1077. const m___LDBL_MAX_EXP__ = 16384
  1078. const m___LDBL_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1079. const m___LDBL_MIN__ = 3.36210314311209350626267781732175260e-4932
  1080. const m___LDBL_NORM_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1081. const m___LDOUBLE_REDIRECTS_TO_FLOAT128_ABI = 0
  1082. const m___LFRACT_EPSILON__ = "0x1P-31LR"
  1083. const m___LFRACT_FBIT__ = 31
  1084. const m___LFRACT_IBIT__ = 0
  1085. const m___LFRACT_MAX__ = "0X7FFFFFFFP-31LR"
  1086. const m___LITTLE_ENDIAN = 1234
  1087. const m___LLACCUM_EPSILON__ = "0x1P-63LLK"
  1088. const m___LLACCUM_FBIT__ = 63
  1089. const m___LLACCUM_IBIT__ = 64
  1090. const m___LLACCUM_MAX__ = "0X7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFP-63LLK"
  1091. const m___LLFRACT_EPSILON__ = "0x1P-63LLR"
  1092. const m___LLFRACT_FBIT__ = 63
  1093. const m___LLFRACT_IBIT__ = 0
  1094. const m___LLFRACT_MAX__ = "0X7FFFFFFFFFFFFFFFP-63LLR"
  1095. const m___LONG_LONG_MAX__ = 0x7fffffffffffffff
  1096. const m___LONG_LONG_WIDTH__ = 64
  1097. const m___LONG_MAX = 9223372036854775807
  1098. const m___LONG_MAX__ = 0x7fffffffffffffff
  1099. const m___LONG_WIDTH__ = 64
  1100. const m___LP64__ = 1
  1101. const m___NO_INLINE__ = 1
  1102. const m___ORDER_BIG_ENDIAN__ = 4321
  1103. const m___ORDER_LITTLE_ENDIAN__ = 1234
  1104. const m___ORDER_PDP_ENDIAN__ = 3412
  1105. const m___PDP_ENDIAN = 3412
  1106. const m___PRAGMA_REDEFINE_EXTNAME = 1
  1107. const m___PRETTY_FUNCTION__ = "__func__"
  1108. const m___PTRDIFF_MAX__ = 0x7fffffffffffffff
  1109. const m___PTRDIFF_WIDTH__ = 64
  1110. const m___QQ_FBIT__ = 7
  1111. const m___QQ_IBIT__ = 0
  1112. const m___REDIRECT_FORTIFY = "__REDIRECT"
  1113. const m___REDIRECT_FORTIFY_NTH = "__REDIRECT_NTH"
  1114. const m___REENTRANT = 1
  1115. const m___REGISTER_PREFIX__ = "$"
  1116. const m___SACCUM_EPSILON__ = "0x1P-7HK"
  1117. const m___SACCUM_FBIT__ = 7
  1118. const m___SACCUM_IBIT__ = 8
  1119. const m___SACCUM_MAX__ = "0X7FFFP-7HK"
  1120. const m___SA_FBIT__ = 15
  1121. const m___SA_IBIT__ = 16
  1122. const m___SCHAR_MAX__ = 0x7f
  1123. const m___SCHAR_WIDTH__ = 8
  1124. const m___SFRACT_EPSILON__ = "0x1P-7HR"
  1125. const m___SFRACT_FBIT__ = 7
  1126. const m___SFRACT_IBIT__ = 0
  1127. const m___SFRACT_MAX__ = "0X7FP-7HR"
  1128. const m___SHRT_MAX__ = 0x7fff
  1129. const m___SHRT_WIDTH__ = 16
  1130. const m___SIG_ATOMIC_MAX__ = 0x7fffffff
  1131. const m___SIG_ATOMIC_TYPE__ = "int"
  1132. const m___SIG_ATOMIC_WIDTH__ = 32
  1133. const m___SIZEOF_DOUBLE__ = 8
  1134. const m___SIZEOF_FLOAT__ = 4
  1135. const m___SIZEOF_INT128__ = 16
  1136. const m___SIZEOF_INT__ = 4
  1137. const m___SIZEOF_LONG_DOUBLE__ = 8
  1138. const m___SIZEOF_LONG_LONG__ = 8
  1139. const m___SIZEOF_LONG__ = 8
  1140. const m___SIZEOF_POINTER__ = 8
  1141. const m___SIZEOF_PTRDIFF_T__ = 8
  1142. const m___SIZEOF_SHORT__ = 2
  1143. const m___SIZEOF_SIZE_T__ = 8
  1144. const m___SIZEOF_WCHAR_T__ = 4
  1145. const m___SIZEOF_WINT_T__ = 4
  1146. const m___SIZE_MAX__ = 0xffffffffffffffff
  1147. const m___SIZE_WIDTH__ = 64
  1148. const m___SQ_FBIT__ = 31
  1149. const m___SQ_IBIT__ = 0
  1150. const m___STDC_HOSTED__ = 1
  1151. const m___STDC_IEC_559_COMPLEX__ = 1
  1152. const m___STDC_IEC_559__ = 1
  1153. const m___STDC_IEC_60559_BFP__ = 201404
  1154. const m___STDC_IEC_60559_COMPLEX__ = 201404
  1155. const m___STDC_ISO_10646__ = 201706
  1156. const m___STDC_UTF_16__ = 1
  1157. const m___STDC_UTF_32__ = 1
  1158. const m___STDC_VERSION__ = 201710
  1159. const m___STDC_WANT_IEC_60559_ATTRIBS_EXT__ = 1
  1160. const m___STDC_WANT_IEC_60559_BFP_EXT__ = 1
  1161. const m___STDC_WANT_IEC_60559_DFP_EXT__ = 1
  1162. const m___STDC_WANT_IEC_60559_FUNCS_EXT__ = 1
  1163. const m___STDC_WANT_IEC_60559_TYPES_EXT__ = 1
  1164. const m___STDC_WANT_LIB_EXT2__ = 1
  1165. const m___STDC_WANT_MATH_SPEC_FUNCS__ = 1
  1166. const m___STDC__ = 1
  1167. const m___TA_FBIT__ = 63
  1168. const m___TA_IBIT__ = 64
  1169. const m___TQ_FBIT__ = 127
  1170. const m___TQ_IBIT__ = 0
  1171. const m___UACCUM_EPSILON__ = "0x1P-16UK"
  1172. const m___UACCUM_FBIT__ = 16
  1173. const m___UACCUM_IBIT__ = 16
  1174. const m___UACCUM_MAX__ = "0XFFFFFFFFP-16UK"
  1175. const m___UACCUM_MIN__ = "0.0UK"
  1176. const m___UDA_FBIT__ = 32
  1177. const m___UDA_IBIT__ = 32
  1178. const m___UDQ_FBIT__ = 64
  1179. const m___UDQ_IBIT__ = 0
  1180. const m___UFRACT_EPSILON__ = "0x1P-16UR"
  1181. const m___UFRACT_FBIT__ = 16
  1182. const m___UFRACT_IBIT__ = 0
  1183. const m___UFRACT_MAX__ = "0XFFFFP-16UR"
  1184. const m___UFRACT_MIN__ = "0.0UR"
  1185. const m___UHA_FBIT__ = 8
  1186. const m___UHA_IBIT__ = 8
  1187. const m___UHQ_FBIT__ = 16
  1188. const m___UHQ_IBIT__ = 0
  1189. const m___UINT16_MAX__ = 0xffff
  1190. const m___UINT32_MAX__ = 0xffffffff
  1191. const m___UINT64_MAX__ = 0xffffffffffffffff
  1192. const m___UINT8_MAX__ = 0xff
  1193. const m___UINTMAX_MAX__ = 0xffffffffffffffff
  1194. const m___UINTPTR_MAX__ = 0xffffffffffffffff
  1195. const m___UINT_FAST16_MAX__ = 0xffffffffffffffff
  1196. const m___UINT_FAST32_MAX__ = 0xffffffffffffffff
  1197. const m___UINT_FAST64_MAX__ = 0xffffffffffffffff
  1198. const m___UINT_FAST8_MAX__ = 0xff
  1199. const m___UINT_LEAST16_MAX__ = 0xffff
  1200. const m___UINT_LEAST32_MAX__ = 0xffffffff
  1201. const m___UINT_LEAST64_MAX__ = 0xffffffffffffffff
  1202. const m___UINT_LEAST8_MAX__ = 0xff
  1203. const m___ULACCUM_EPSILON__ = "0x1P-32ULK"
  1204. const m___ULACCUM_FBIT__ = 32
  1205. const m___ULACCUM_IBIT__ = 32
  1206. const m___ULACCUM_MAX__ = "0XFFFFFFFFFFFFFFFFP-32ULK"
  1207. const m___ULACCUM_MIN__ = "0.0ULK"
  1208. const m___ULFRACT_EPSILON__ = "0x1P-32ULR"
  1209. const m___ULFRACT_FBIT__ = 32
  1210. const m___ULFRACT_IBIT__ = 0
  1211. const m___ULFRACT_MAX__ = "0XFFFFFFFFP-32ULR"
  1212. const m___ULFRACT_MIN__ = "0.0ULR"
  1213. const m___ULLACCUM_EPSILON__ = "0x1P-64ULLK"
  1214. const m___ULLACCUM_FBIT__ = 64
  1215. const m___ULLACCUM_IBIT__ = 64
  1216. const m___ULLACCUM_MAX__ = "0XFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFP-64ULLK"
  1217. const m___ULLACCUM_MIN__ = "0.0ULLK"
  1218. const m___ULLFRACT_EPSILON__ = "0x1P-64ULLR"
  1219. const m___ULLFRACT_FBIT__ = 64
  1220. const m___ULLFRACT_IBIT__ = 0
  1221. const m___ULLFRACT_MAX__ = "0XFFFFFFFFFFFFFFFFP-64ULLR"
  1222. const m___ULLFRACT_MIN__ = "0.0ULLR"
  1223. const m___UQQ_FBIT__ = 8
  1224. const m___UQQ_IBIT__ = 0
  1225. const m___USACCUM_EPSILON__ = "0x1P-8UHK"
  1226. const m___USACCUM_FBIT__ = 8
  1227. const m___USACCUM_IBIT__ = 8
  1228. const m___USACCUM_MAX__ = "0XFFFFP-8UHK"
  1229. const m___USACCUM_MIN__ = "0.0UHK"
  1230. const m___USA_FBIT__ = 16
  1231. const m___USA_IBIT__ = 16
  1232. const m___USE_TIME_BITS64 = 1
  1233. const m___USFRACT_EPSILON__ = "0x1P-8UHR"
  1234. const m___USFRACT_FBIT__ = 8
  1235. const m___USFRACT_IBIT__ = 0
  1236. const m___USFRACT_MAX__ = "0XFFP-8UHR"
  1237. const m___USFRACT_MIN__ = "0.0UHR"
  1238. const m___USQ_FBIT__ = 32
  1239. const m___USQ_IBIT__ = 0
  1240. const m___UTA_FBIT__ = 64
  1241. const m___UTA_IBIT__ = 64
  1242. const m___UTQ_FBIT__ = 128
  1243. const m___UTQ_IBIT__ = 0
  1244. const m___VERSION__ = "14.2.1 20241104 (Red Hat 14.2.1-6)"
  1245. const m___WCHAR_MAX__ = 0x7fffffff
  1246. const m___WCHAR_TYPE__ = "int"
  1247. const m___WCHAR_WIDTH__ = 32
  1248. const m___WINT_MAX__ = 0xffffffff
  1249. const m___WINT_MIN__ = 0
  1250. const m___WINT_WIDTH__ = 32
  1251. const m___WORDSIZE = 64
  1252. const m___WORDSIZE_TIME64_COMPAT32 = 0
  1253. const m___builtin_copysignq = "__builtin_copysignf128"
  1254. const m___builtin_fabsq = "__builtin_fabsf128"
  1255. const m___builtin_huge_valq = "__builtin_huge_valf128"
  1256. const m___builtin_infq = "__builtin_inff128"
  1257. const m___builtin_nanq = "__builtin_nanf128"
  1258. const m___builtin_nansq = "__builtin_nansf128"
  1259. const m___glibc_c99_flexarr_available = 1
  1260. const m___gnu_linux__ = 1
  1261. const m___inline = "inline"
  1262. const m___linux = 1
  1263. const m___linux__ = 1
  1264. const m___loongarch64 = 1
  1265. const m___loongarch__ = 1
  1266. const m___loongarch_arch = "la64v1.0"
  1267. const m___loongarch_double_float = 1
  1268. const m___loongarch_frlen = 64
  1269. const m___loongarch_grlen = 64
  1270. const m___loongarch_hard_float = 1
  1271. const m___loongarch_lp64 = 1
  1272. const m___loongarch_simd = 1
  1273. const m___loongarch_simd_width = 128
  1274. const m___loongarch_sx = 1
  1275. const m___loongarch_tune = "generic"
  1276. const m___loongarch_version_major = 1
  1277. const m___loongarch_version_minor = 0
  1278. const m___restrict = "restrict"
  1279. const m___uc_flags = "uc_flags"
  1280. const m___ucontext = "ucontext"
  1281. const m___unix = 1
  1282. const m___unix__ = 1
  1283. const m_alloca = "__builtin_alloca"
  1284. const m_linux = 1
  1285. const m_unix = 1
  1286. type t__builtin_va_list = uintptr
  1287. type t__predefined_size_t = uint64
  1288. type t__predefined_wchar_t = int32
  1289. type t__predefined_ptrdiff_t = int64
  1290. type Tnlink_t = uint32
  1291. type Tblksize_t = int32
  1292. type Tsize_t = uint64
  1293. type Tssize_t = int64
  1294. type Tregister_t = int64
  1295. type Ttime_t = int64
  1296. type Tsuseconds_t = int64
  1297. type Tint8_t = int8
  1298. type Tint16_t = int16
  1299. type Tint32_t = int32
  1300. type Tint64_t = int64
  1301. type Tu_int64_t = uint64
  1302. type Tmode_t = uint32
  1303. type Toff_t = int64
  1304. type Tino_t = uint64
  1305. type Tdev_t = uint64
  1306. type Tblkcnt_t = int64
  1307. type Tfsblkcnt_t = uint64
  1308. type Tfsfilcnt_t = uint64
  1309. type Ttimer_t = uintptr
  1310. type Tclockid_t = int32
  1311. type Tclock_t = int64
  1312. type Tpid_t = int32
  1313. type Tid_t = uint32
  1314. type Tuid_t = uint32
  1315. type Tgid_t = uint32
  1316. type Tkey_t = int32
  1317. type Tuseconds_t = uint32
  1318. type Tpthread_t = uintptr
  1319. type Tpthread_once_t = int32
  1320. type Tpthread_key_t = uint32
  1321. type Tpthread_spinlock_t = int32
  1322. type Tpthread_mutexattr_t = struct {
  1323. F__attr uint32
  1324. }
  1325. type Tpthread_condattr_t = struct {
  1326. F__attr uint32
  1327. }
  1328. type Tpthread_barrierattr_t = struct {
  1329. F__attr uint32
  1330. }
  1331. type Tpthread_rwlockattr_t = struct {
  1332. F__attr [2]uint32
  1333. }
  1334. type Tpthread_attr_t = struct {
  1335. F__u struct {
  1336. F__vi [0][14]int32
  1337. F__s [0][7]uint64
  1338. F__i [14]int32
  1339. }
  1340. }
  1341. type Tpthread_mutex_t = struct {
  1342. F__u struct {
  1343. F__vi [0][10]int32
  1344. F__p [0][5]uintptr
  1345. F__i [10]int32
  1346. }
  1347. }
  1348. type Tpthread_cond_t = struct {
  1349. F__u struct {
  1350. F__vi [0][12]int32
  1351. F__p [0][6]uintptr
  1352. F__i [12]int32
  1353. }
  1354. }
  1355. type Tpthread_rwlock_t = struct {
  1356. F__u struct {
  1357. F__vi [0][14]int32
  1358. F__p [0][7]uintptr
  1359. F__i [14]int32
  1360. }
  1361. }
  1362. type Tpthread_barrier_t = struct {
  1363. F__u struct {
  1364. F__vi [0][8]int32
  1365. F__p [0][4]uintptr
  1366. F__i [8]int32
  1367. }
  1368. }
  1369. type Tu_int8_t = uint8
  1370. type Tu_int16_t = uint16
  1371. type Tu_int32_t = uint32
  1372. type Tcaddr_t = uintptr
  1373. type Tu_char = uint8
  1374. type Tu_short = uint16
  1375. type Tushort = uint16
  1376. type Tu_int = uint32
  1377. type Tuint = uint32
  1378. type Tu_long = uint64
  1379. type Tulong = uint64
  1380. type Tquad_t = int64
  1381. type Tu_quad_t = uint64
  1382. type Tuint16_t = uint16
  1383. type Tuint32_t = uint32
  1384. type Tuint64_t = uint64
  1385. type Ttimeval = struct {
  1386. Ftv_sec Ttime_t
  1387. Ftv_usec Tsuseconds_t
  1388. }
  1389. type Ttimespec = struct {
  1390. Ftv_sec Ttime_t
  1391. Ftv_nsec int64
  1392. }
  1393. type Tsigset_t = struct {
  1394. F__bits [16]uint64
  1395. }
  1396. type t__sigset_t = Tsigset_t
  1397. type Tfd_mask = uint64
  1398. type Tfd_set = struct {
  1399. Ffds_bits [16]uint64
  1400. }
  1401. type Tstat = struct {
  1402. Fst_dev Tdev_t
  1403. Fst_ino Tino_t
  1404. Fst_mode Tmode_t
  1405. Fst_nlink Tnlink_t
  1406. Fst_uid Tuid_t
  1407. Fst_gid Tgid_t
  1408. Fst_rdev Tdev_t
  1409. F__pad uint64
  1410. Fst_size Toff_t
  1411. Fst_blksize Tblksize_t
  1412. F__pad2 int32
  1413. Fst_blocks Tblkcnt_t
  1414. Fst_atim Ttimespec
  1415. Fst_mtim Ttimespec
  1416. Fst_ctim Ttimespec
  1417. F__unused [2]uint32
  1418. }
  1419. type Tstatx_timestamp = struct {
  1420. Ftv_sec Tint64_t
  1421. Ftv_nsec Tuint32_t
  1422. F__pad Tuint32_t
  1423. }
  1424. type Tstatx = struct {
  1425. Fstx_mask Tuint32_t
  1426. Fstx_blksize Tuint32_t
  1427. Fstx_attributes Tuint64_t
  1428. Fstx_nlink Tuint32_t
  1429. Fstx_uid Tuint32_t
  1430. Fstx_gid Tuint32_t
  1431. Fstx_mode Tuint16_t
  1432. F__pad0 [1]Tuint16_t
  1433. Fstx_ino Tuint64_t
  1434. Fstx_size Tuint64_t
  1435. Fstx_blocks Tuint64_t
  1436. Fstx_attributes_mask Tuint64_t
  1437. Fstx_atime Tstatx_timestamp
  1438. Fstx_btime Tstatx_timestamp
  1439. Fstx_ctime Tstatx_timestamp
  1440. Fstx_mtime Tstatx_timestamp
  1441. Fstx_rdev_major Tuint32_t
  1442. Fstx_rdev_minor Tuint32_t
  1443. Fstx_dev_major Tuint32_t
  1444. Fstx_dev_minor Tuint32_t
  1445. F__pad1 [14]Tuint64_t
  1446. }
  1447. type Twchar_t = int32
  1448. type Tmax_align_t = struct {
  1449. F__ll int64
  1450. F__ld float64
  1451. }
  1452. type Tptrdiff_t = int64
  1453. type Tlocale_t = uintptr
  1454. type Tstack_t = struct {
  1455. Fss_sp uintptr
  1456. Fss_flags int32
  1457. Fss_size Tsize_t
  1458. }
  1459. type Tsigaltstack = Tstack_t
  1460. type Tgreg_t = uint64
  1461. type Tgregset_t = [32]uint64
  1462. type Tsigcontext = struct {
  1463. Fsc_pc uint64
  1464. Fsc_regs [32]uint64
  1465. Fsc_flags uint32
  1466. }
  1467. type Tmcontext_t = struct {
  1468. F__pc uint64
  1469. F__gregs [32]uint64
  1470. F__flags uint32
  1471. }
  1472. type Tucontext_t = struct {
  1473. Fuc_flags uint64
  1474. Fuc_link uintptr
  1475. Fuc_stack Tstack_t
  1476. Fuc_sigmask Tsigset_t
  1477. F__uc_pad int64
  1478. Fuc_mcontext Tmcontext_t
  1479. }
  1480. type Tucontext = Tucontext_t
  1481. type Tsigval = struct {
  1482. Fsival_ptr [0]uintptr
  1483. Fsival_int int32
  1484. F__ccgo_pad2 [4]byte
  1485. }
  1486. type Tsiginfo_t = struct {
  1487. Fsi_signo int32
  1488. Fsi_errno int32
  1489. Fsi_code int32
  1490. F__si_fields struct {
  1491. F__si_common [0]struct {
  1492. F__first struct {
  1493. F__timer [0]struct {
  1494. Fsi_timerid int32
  1495. Fsi_overrun int32
  1496. }
  1497. F__piduid struct {
  1498. Fsi_pid Tpid_t
  1499. Fsi_uid Tuid_t
  1500. }
  1501. }
  1502. F__second struct {
  1503. F__sigchld [0]struct {
  1504. Fsi_status int32
  1505. Fsi_utime Tclock_t
  1506. Fsi_stime Tclock_t
  1507. }
  1508. Fsi_value Tsigval
  1509. F__ccgo_pad2 [16]byte
  1510. }
  1511. }
  1512. F__sigfault [0]struct {
  1513. Fsi_addr uintptr
  1514. Fsi_addr_lsb int16
  1515. F__first struct {
  1516. Fsi_pkey [0]uint32
  1517. F__addr_bnd struct {
  1518. Fsi_lower uintptr
  1519. Fsi_upper uintptr
  1520. }
  1521. }
  1522. }
  1523. F__sigpoll [0]struct {
  1524. Fsi_band int64
  1525. Fsi_fd int32
  1526. }
  1527. F__sigsys [0]struct {
  1528. Fsi_call_addr uintptr
  1529. Fsi_syscall int32
  1530. Fsi_arch uint32
  1531. }
  1532. F__pad [112]int8
  1533. }
  1534. }
  1535. type Tsigaction = struct {
  1536. F__sa_handler struct {
  1537. Fsa_sigaction [0]uintptr
  1538. Fsa_handler uintptr
  1539. }
  1540. Fsa_mask Tsigset_t
  1541. Fsa_flags int32
  1542. Fsa_restorer uintptr
  1543. }
  1544. type Tsigevent = struct {
  1545. Fsigev_value Tsigval
  1546. Fsigev_signo int32
  1547. Fsigev_notify int32
  1548. F__sev_fields struct {
  1549. Fsigev_notify_thread_id [0]Tpid_t
  1550. F__sev_thread [0]struct {
  1551. Fsigev_notify_function uintptr
  1552. Fsigev_notify_attributes uintptr
  1553. }
  1554. F__pad [48]int8
  1555. }
  1556. }
  1557. type Tsig_t = uintptr
  1558. type Tsighandler_t = uintptr
  1559. type Tsig_atomic_t = int32
  1560. type Tdiv_t = struct {
  1561. Fquot int32
  1562. Frem int32
  1563. }
  1564. type Tldiv_t = struct {
  1565. Fquot int64
  1566. Frem int64
  1567. }
  1568. type Tlldiv_t = struct {
  1569. Fquot int64
  1570. Frem int64
  1571. }
  1572. type Tuintptr_t = uint64
  1573. type Tintptr_t = int64
  1574. type Tintmax_t = int64
  1575. type Tuint8_t = uint8
  1576. type Tuintmax_t = uint64
  1577. type Tint_fast8_t = int8
  1578. type Tint_fast64_t = int64
  1579. type Tint_least8_t = int8
  1580. type Tint_least16_t = int16
  1581. type Tint_least32_t = int32
  1582. type Tint_least64_t = int64
  1583. type Tuint_fast8_t = uint8
  1584. type Tuint_fast64_t = uint64
  1585. type Tuint_least8_t = uint8
  1586. type Tuint_least16_t = uint16
  1587. type Tuint_least32_t = uint32
  1588. type Tuint_least64_t = uint64
  1589. type Tint_fast16_t = int32
  1590. type Tint_fast32_t = int32
  1591. type Tuint_fast16_t = uint32
  1592. type Tuint_fast32_t = uint32
  1593. type Tva_list = uintptr
  1594. type t__isoc_va_list = uintptr
  1595. type Tfpos_t = struct {
  1596. F__lldata [0]int64
  1597. F__align [0]float64
  1598. F__opaque [16]int8
  1599. }
  1600. type T_G_fpos64_t = Tfpos_t
  1601. type Tcookie_io_functions_t = struct {
  1602. Fread uintptr
  1603. Fwrite uintptr
  1604. Fseek uintptr
  1605. Fclose1 uintptr
  1606. }
  1607. type T_IO_cookie_io_functions_t = Tcookie_io_functions_t
  1608. type TBITCMD = struct {
  1609. Fcmd int8
  1610. Fcmd2 int8
  1611. Fbits Tmode_t
  1612. }
  1613. type Tbitcmd = TBITCMD
  1614. // C documentation
  1615. //
  1616. // /*
  1617. // * Given the old mode and an array of bitcmd structures, apply the operations
  1618. // * described in the bitcmd structures to the old mode, and return the new mode.
  1619. // * Note that there is no '=' command; a strict assignment is just a '-' (clear
  1620. // * bits) followed by a '+' (set bits).
  1621. // */
  1622. func Xgetmode(tls *libc.TLS, bbox uintptr, omode Tmode_t) (r Tmode_t) {
  1623. var clrval, newmode, value Tmode_t
  1624. var set uintptr
  1625. var v11 uint32
  1626. _, _, _, _, _ = clrval, newmode, set, value, v11
  1627. set = bbox
  1628. newmode = omode
  1629. value = uint32(0)
  1630. for {
  1631. switch int32((*TBITCMD)(unsafe.Pointer(set)).Fcmd) {
  1632. case int32('u'):
  1633. goto _2
  1634. case int32('g'):
  1635. goto _3
  1636. case int32('o'):
  1637. goto _4
  1638. case int32('+'):
  1639. goto _5
  1640. case int32('-'):
  1641. goto _6
  1642. case int32('X'):
  1643. goto _7
  1644. default:
  1645. goto _8
  1646. case int32('\000'):
  1647. goto _9
  1648. }
  1649. goto _10
  1650. /*
  1651. * When copying the user, group or other bits around, we "know"
  1652. * where the bits are in the mode so that we can do shifts to
  1653. * copy them around. If we don't use shifts, it gets real
  1654. * grundgy with lots of single bit checks and bit sets.
  1655. */
  1656. _2:
  1657. ;
  1658. value = newmode & uint32(m_S_IRWXU) >> int32(6)
  1659. goto common
  1660. _3:
  1661. ;
  1662. value = newmode & uint32(m_S_IRWXG) >> int32(3)
  1663. goto common
  1664. _4:
  1665. ;
  1666. value = newmode & uint32(m_S_IRWXO)
  1667. goto common
  1668. common:
  1669. ;
  1670. if int32((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_CLR) != 0 {
  1671. if int32((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_SET) != 0 {
  1672. v11 = uint32(m_S_IRWXO)
  1673. } else {
  1674. v11 = value
  1675. }
  1676. clrval = v11
  1677. if int32((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_UBITS) != 0 {
  1678. newmode &= ^(clrval << libc.Int32FromInt32(6) & (*TBITCMD)(unsafe.Pointer(set)).Fbits)
  1679. }
  1680. if int32((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_GBITS) != 0 {
  1681. newmode &= ^(clrval << libc.Int32FromInt32(3) & (*TBITCMD)(unsafe.Pointer(set)).Fbits)
  1682. }
  1683. if int32((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_OBITS) != 0 {
  1684. newmode &= ^(clrval & (*TBITCMD)(unsafe.Pointer(set)).Fbits)
  1685. }
  1686. }
  1687. if int32((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_SET) != 0 {
  1688. if int32((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_UBITS) != 0 {
  1689. newmode |= value << libc.Int32FromInt32(6) & (*TBITCMD)(unsafe.Pointer(set)).Fbits
  1690. }
  1691. if int32((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_GBITS) != 0 {
  1692. newmode |= value << libc.Int32FromInt32(3) & (*TBITCMD)(unsafe.Pointer(set)).Fbits
  1693. }
  1694. if int32((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_OBITS) != 0 {
  1695. newmode |= value & (*TBITCMD)(unsafe.Pointer(set)).Fbits
  1696. }
  1697. }
  1698. goto _10
  1699. _5:
  1700. ;
  1701. newmode |= (*TBITCMD)(unsafe.Pointer(set)).Fbits
  1702. goto _10
  1703. _6:
  1704. ;
  1705. newmode &= ^(*TBITCMD)(unsafe.Pointer(set)).Fbits
  1706. goto _10
  1707. _7:
  1708. ;
  1709. if omode&libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IFDIR)|libc.Int32FromInt32(m_S_IXUSR)|libc.Int32FromInt32(m_S_IXGRP)|libc.Int32FromInt32(m_S_IXOTH)) != 0 {
  1710. newmode |= (*TBITCMD)(unsafe.Pointer(set)).Fbits
  1711. }
  1712. goto _10
  1713. _9:
  1714. ;
  1715. _8:
  1716. ;
  1717. return newmode
  1718. _10:
  1719. ;
  1720. goto _1
  1721. _1:
  1722. ;
  1723. set += 8
  1724. }
  1725. return r
  1726. }
  1727. func Xsetmode(tls *libc.TLS, p uintptr) (r uintptr) {
  1728. bp := tls.Alloc(272)
  1729. defer tls.Free(272)
  1730. var endset, newset, newset1, newset2, newset3, newset4, newset5, saveset, set, v5 uintptr
  1731. var equalopdone, serrno, setlen int32
  1732. var lval int64
  1733. var mask, perm, permXbits, who, v1 Tmode_t
  1734. var op, v4 int8
  1735. var setdiff, setdiff1, setdiff2, setdiff3, setdiff4, setdiff5 Tptrdiff_t
  1736. var _ /* ep at bp+0 */ uintptr
  1737. var _ /* signset at bp+8 */ Tsigset_t
  1738. var _ /* sigoset at bp+136 */ Tsigset_t
  1739. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = endset, equalopdone, lval, mask, newset, newset1, newset2, newset3, newset4, newset5, op, perm, permXbits, saveset, serrno, set, setdiff, setdiff1, setdiff2, setdiff3, setdiff4, setdiff5, setlen, who, v1, v4, v5
  1740. equalopdone = 0
  1741. if !(*(*int8)(unsafe.Pointer(p)) != 0) {
  1742. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  1743. return libc.UintptrFromInt32(0)
  1744. }
  1745. /*
  1746. * Get a copy of the mask for the permissions that are mask relative.
  1747. * Flip the bits, we want what's not set. Since it's possible that
  1748. * the caller is opening files inside a signal handler, protect them
  1749. * as best we can.
  1750. */
  1751. libc.Xsigfillset(tls, bp+8)
  1752. libc.Xsigprocmask(tls, m_SIG_BLOCK, bp+8, bp+136)
  1753. v1 = libc.Xumask(tls, uint32(0))
  1754. mask = v1
  1755. libc.Xumask(tls, v1)
  1756. mask = ^mask
  1757. libc.Xsigprocmask(tls, int32(m_SIG_SETMASK), bp+136, libc.UintptrFromInt32(0))
  1758. setlen = libc.Int32FromInt32(m_SET_LEN) + libc.Int32FromInt32(2)
  1759. set = Xreallocarray(tls, libc.UintptrFromInt32(0), libc.Uint64FromInt32(setlen), uint64(8))
  1760. if set == libc.UintptrFromInt32(0) {
  1761. return libc.UintptrFromInt32(0)
  1762. }
  1763. saveset = set
  1764. endset = set + uintptr(setlen-libc.Int32FromInt32(2))*8
  1765. /*
  1766. * If an absolute number, get it and return; disallow non-octal digits
  1767. * or illegal bits.
  1768. */
  1769. if libc.BoolInt32(uint32(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(p))))-uint32('0') < uint32(10)) != 0 {
  1770. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  1771. lval = libc.Xstrtol(tls, p, bp, int32(8))
  1772. if *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))) != 0 {
  1773. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  1774. goto out
  1775. }
  1776. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_ERANGE) && (lval == int64(0x7fffffffffffffff) || lval == -libc.Int64FromInt64(0x7fffffffffffffff)-libc.Int64FromInt32(1)) {
  1777. goto out
  1778. }
  1779. if lval&int64(^(libc.Int32FromInt32(m_S_ISUID)|libc.Int32FromInt32(m_S_ISGID)|libc.Int32FromInt32(m_S_IRWXU)|libc.Int32FromInt32(m_S_IRWXG)|libc.Int32FromInt32(m_S_IRWXO)|libc.Int32FromInt32(m_S_ISVTX))) != 0 {
  1780. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  1781. goto out
  1782. }
  1783. perm = libc.Uint32FromInt64(lval)
  1784. if set >= endset {
  1785. setdiff = (int64(set) - int64(saveset)) / 8
  1786. setlen += int32(m_SET_LEN_INCR)
  1787. newset = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  1788. if newset == libc.UintptrFromInt32(0) {
  1789. goto out
  1790. }
  1791. set = newset + uintptr(setdiff)*8
  1792. saveset = newset
  1793. endset = newset + uintptr(setlen-libc.Int32FromInt32(2))*8
  1794. }
  1795. set = _addcmd(tls, set, libc.Uint32FromInt32(libc.Int32FromUint8('=')), libc.Uint32FromInt32(libc.Int32FromInt32(m_S_ISUID)|libc.Int32FromInt32(m_S_ISGID)|libc.Int32FromInt32(m_S_IRWXU)|libc.Int32FromInt32(m_S_IRWXG)|libc.Int32FromInt32(m_S_IRWXO)|libc.Int32FromInt32(m_S_ISVTX)), perm, mask)
  1796. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = 0
  1797. return saveset
  1798. }
  1799. /*
  1800. * Build list of structures to set/clear/copy bits as described by
  1801. * each clause of the symbolic mode.
  1802. */
  1803. for {
  1804. /* First, find out which bits might be modified. */
  1805. who = uint32(0)
  1806. for {
  1807. switch int32(*(*int8)(unsafe.Pointer(p))) {
  1808. case int32('a'):
  1809. who |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_ISUID) | libc.Int32FromInt32(m_S_ISGID) | libc.Int32FromInt32(m_S_IRWXU) | libc.Int32FromInt32(m_S_IRWXG) | libc.Int32FromInt32(m_S_IRWXO))
  1810. case int32('u'):
  1811. who |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_ISUID) | libc.Int32FromInt32(m_S_IRWXU))
  1812. case int32('g'):
  1813. who |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_ISGID) | libc.Int32FromInt32(m_S_IRWXG))
  1814. case int32('o'):
  1815. who |= uint32(m_S_IRWXO)
  1816. default:
  1817. goto getop
  1818. }
  1819. goto _3
  1820. _3:
  1821. ;
  1822. p++
  1823. }
  1824. goto getop
  1825. getop:
  1826. ;
  1827. v5 = p
  1828. p++
  1829. v4 = *(*int8)(unsafe.Pointer(v5))
  1830. op = v4
  1831. if int32(v4) != int32('+') && int32(op) != int32('-') && int32(op) != int32('=') {
  1832. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  1833. goto out
  1834. }
  1835. if int32(op) == int32('=') {
  1836. equalopdone = 0
  1837. }
  1838. who &= libc.Uint32FromInt32(^libc.Int32FromInt32(m_S_ISVTX))
  1839. perm = uint32(0)
  1840. permXbits = libc.Uint32FromInt32(0)
  1841. for {
  1842. switch int32(*(*int8)(unsafe.Pointer(p))) {
  1843. case int32('r'):
  1844. perm |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IRUSR) | libc.Int32FromInt32(m_S_IRGRP) | libc.Int32FromInt32(m_S_IROTH))
  1845. case int32('s'):
  1846. /*
  1847. * If specific bits where requested and
  1848. * only "other" bits ignore set-id.
  1849. */
  1850. if who == uint32(0) || who&libc.Uint32FromInt32(^libc.Int32FromInt32(m_S_IRWXO)) != 0 {
  1851. perm |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_ISUID) | libc.Int32FromInt32(m_S_ISGID))
  1852. }
  1853. case int32('t'):
  1854. /*
  1855. * If specific bits where requested and
  1856. * only "other" bits ignore set-id.
  1857. */
  1858. if who == uint32(0) || who&libc.Uint32FromInt32(^libc.Int32FromInt32(m_S_IRWXO)) != 0 {
  1859. who |= uint32(m_S_ISVTX)
  1860. perm |= uint32(m_S_ISVTX)
  1861. }
  1862. case int32('w'):
  1863. perm |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IWUSR) | libc.Int32FromInt32(m_S_IWGRP) | libc.Int32FromInt32(m_S_IWOTH))
  1864. case int32('X'):
  1865. permXbits = libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXUSR) | libc.Int32FromInt32(m_S_IXGRP) | libc.Int32FromInt32(m_S_IXOTH))
  1866. case int32('x'):
  1867. perm |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXUSR) | libc.Int32FromInt32(m_S_IXGRP) | libc.Int32FromInt32(m_S_IXOTH))
  1868. case int32('u'):
  1869. fallthrough
  1870. case int32('g'):
  1871. fallthrough
  1872. case int32('o'):
  1873. /*
  1874. * When ever we hit 'u', 'g', or 'o', we have
  1875. * to flush out any partial mode that we have,
  1876. * and then do the copying of the mode bits.
  1877. */
  1878. if perm != 0 {
  1879. if set >= endset {
  1880. setdiff1 = (int64(set) - int64(saveset)) / 8
  1881. setlen += int32(m_SET_LEN_INCR)
  1882. newset1 = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  1883. if newset1 == libc.UintptrFromInt32(0) {
  1884. goto out
  1885. }
  1886. set = newset1 + uintptr(setdiff1)*8
  1887. saveset = newset1
  1888. endset = newset1 + uintptr(setlen-libc.Int32FromInt32(2))*8
  1889. }
  1890. set = _addcmd(tls, set, libc.Uint32FromInt8(op), who, perm, mask)
  1891. perm = uint32(0)
  1892. }
  1893. if int32(op) == int32('=') {
  1894. equalopdone = int32(1)
  1895. }
  1896. if int32(op) == int32('+') && permXbits != 0 {
  1897. if set >= endset {
  1898. setdiff2 = (int64(set) - int64(saveset)) / 8
  1899. setlen += int32(m_SET_LEN_INCR)
  1900. newset2 = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  1901. if newset2 == libc.UintptrFromInt32(0) {
  1902. goto out
  1903. }
  1904. set = newset2 + uintptr(setdiff2)*8
  1905. saveset = newset2
  1906. endset = newset2 + uintptr(setlen-libc.Int32FromInt32(2))*8
  1907. }
  1908. set = _addcmd(tls, set, libc.Uint32FromInt32(libc.Int32FromUint8('X')), who, permXbits, mask)
  1909. permXbits = uint32(0)
  1910. }
  1911. if set >= endset {
  1912. setdiff3 = (int64(set) - int64(saveset)) / 8
  1913. setlen += int32(m_SET_LEN_INCR)
  1914. newset3 = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  1915. if newset3 == libc.UintptrFromInt32(0) {
  1916. goto out
  1917. }
  1918. set = newset3 + uintptr(setdiff3)*8
  1919. saveset = newset3
  1920. endset = newset3 + uintptr(setlen-libc.Int32FromInt32(2))*8
  1921. }
  1922. set = _addcmd(tls, set, libc.Uint32FromInt8(*(*int8)(unsafe.Pointer(p))), who, libc.Uint32FromInt8(op), mask)
  1923. default:
  1924. /*
  1925. * Add any permissions that we haven't already
  1926. * done.
  1927. */
  1928. if perm != 0 || int32(op) == int32('=') && !(equalopdone != 0) {
  1929. if int32(op) == int32('=') {
  1930. equalopdone = int32(1)
  1931. }
  1932. if set >= endset {
  1933. setdiff4 = (int64(set) - int64(saveset)) / 8
  1934. setlen += int32(m_SET_LEN_INCR)
  1935. newset4 = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  1936. if newset4 == libc.UintptrFromInt32(0) {
  1937. goto out
  1938. }
  1939. set = newset4 + uintptr(setdiff4)*8
  1940. saveset = newset4
  1941. endset = newset4 + uintptr(setlen-libc.Int32FromInt32(2))*8
  1942. }
  1943. set = _addcmd(tls, set, libc.Uint32FromInt8(op), who, perm, mask)
  1944. perm = uint32(0)
  1945. }
  1946. if permXbits != 0 {
  1947. if set >= endset {
  1948. setdiff5 = (int64(set) - int64(saveset)) / 8
  1949. setlen += int32(m_SET_LEN_INCR)
  1950. newset5 = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  1951. if newset5 == libc.UintptrFromInt32(0) {
  1952. goto out
  1953. }
  1954. set = newset5 + uintptr(setdiff5)*8
  1955. saveset = newset5
  1956. endset = newset5 + uintptr(setlen-libc.Int32FromInt32(2))*8
  1957. }
  1958. set = _addcmd(tls, set, libc.Uint32FromInt32(libc.Int32FromUint8('X')), who, permXbits, mask)
  1959. permXbits = uint32(0)
  1960. }
  1961. goto apply
  1962. }
  1963. goto _6
  1964. _6:
  1965. ;
  1966. p++
  1967. }
  1968. goto apply
  1969. apply:
  1970. ;
  1971. if !(*(*int8)(unsafe.Pointer(p)) != 0) {
  1972. break
  1973. }
  1974. if int32(*(*int8)(unsafe.Pointer(p))) != int32(',') {
  1975. goto getop
  1976. }
  1977. p++
  1978. goto _2
  1979. _2:
  1980. }
  1981. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = 0
  1982. _compress_mode(tls, saveset)
  1983. return saveset
  1984. goto out
  1985. out:
  1986. ;
  1987. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  1988. libc.Xfree(tls, saveset)
  1989. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  1990. return libc.UintptrFromInt32(0)
  1991. }
  1992. func _addcmd(tls *libc.TLS, set uintptr, op Tmode_t, who Tmode_t, oparg Tmode_t, mask Tmode_t) (r uintptr) {
  1993. var v1, v2 uint32
  1994. var v3, v4, v5 int32
  1995. var p6, p7, p8 uintptr
  1996. _, _, _, _, _, _, _, _ = v1, v2, v3, v4, v5, p6, p7, p8
  1997. switch op {
  1998. case uint32('='):
  1999. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = int8('-')
  2000. if who != 0 {
  2001. v1 = who
  2002. } else {
  2003. v1 = libc.Uint32FromInt32(libc.Int32FromInt32(m_S_ISUID) | libc.Int32FromInt32(m_S_ISGID) | libc.Int32FromInt32(m_S_IRWXU) | libc.Int32FromInt32(m_S_IRWXG) | libc.Int32FromInt32(m_S_IRWXO))
  2004. }
  2005. (*TBITCMD)(unsafe.Pointer(set)).Fbits = v1
  2006. set += 8
  2007. op = uint32('+')
  2008. /* FALLTHROUGH */
  2009. fallthrough
  2010. case uint32('+'):
  2011. fallthrough
  2012. case uint32('-'):
  2013. fallthrough
  2014. case uint32('X'):
  2015. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = libc.Int8FromUint32(op)
  2016. if who != 0 {
  2017. v2 = who
  2018. } else {
  2019. v2 = mask
  2020. }
  2021. (*TBITCMD)(unsafe.Pointer(set)).Fbits = v2 & oparg
  2022. case uint32('u'):
  2023. fallthrough
  2024. case uint32('g'):
  2025. fallthrough
  2026. case uint32('o'):
  2027. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = libc.Int8FromUint32(op)
  2028. if who != 0 {
  2029. if who&uint32(m_S_IRUSR) != 0 {
  2030. v3 = int32(m_CMD2_UBITS)
  2031. } else {
  2032. v3 = 0
  2033. }
  2034. if who&uint32(m_S_IRGRP) != 0 {
  2035. v4 = int32(m_CMD2_GBITS)
  2036. } else {
  2037. v4 = 0
  2038. }
  2039. if who&uint32(m_S_IROTH) != 0 {
  2040. v5 = int32(m_CMD2_OBITS)
  2041. } else {
  2042. v5 = 0
  2043. }
  2044. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = int8(v3 | v4 | v5)
  2045. (*TBITCMD)(unsafe.Pointer(set)).Fbits = libc.Uint32FromInt32(^libc.Int32FromInt32(0))
  2046. } else {
  2047. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = int8(libc.Int32FromInt32(m_CMD2_UBITS) | libc.Int32FromInt32(m_CMD2_GBITS) | libc.Int32FromInt32(m_CMD2_OBITS))
  2048. (*TBITCMD)(unsafe.Pointer(set)).Fbits = mask
  2049. }
  2050. if oparg == uint32('+') {
  2051. p6 = set + 1
  2052. *(*int8)(unsafe.Pointer(p6)) = int8(int32(*(*int8)(unsafe.Pointer(p6))) | libc.Int32FromInt32(m_CMD2_SET))
  2053. } else {
  2054. if oparg == uint32('-') {
  2055. p7 = set + 1
  2056. *(*int8)(unsafe.Pointer(p7)) = int8(int32(*(*int8)(unsafe.Pointer(p7))) | libc.Int32FromInt32(m_CMD2_CLR))
  2057. } else {
  2058. if oparg == uint32('=') {
  2059. p8 = set + 1
  2060. *(*int8)(unsafe.Pointer(p8)) = int8(int32(*(*int8)(unsafe.Pointer(p8))) | (libc.Int32FromInt32(m_CMD2_SET) | libc.Int32FromInt32(m_CMD2_CLR)))
  2061. }
  2062. }
  2063. }
  2064. break
  2065. }
  2066. return set + libc.UintptrFromInt32(1)*8
  2067. }
  2068. // C documentation
  2069. //
  2070. // /*
  2071. // * Given an array of bitcmd structures, compress by compacting consecutive
  2072. // * '+', '-' and 'X' commands into at most 3 commands, one of each. The 'u',
  2073. // * 'g' and 'o' commands continue to be separate. They could probably be
  2074. // * compacted, but it's not worth the effort.
  2075. // */
  2076. func _compress_mode(tls *libc.TLS, set uintptr) {
  2077. var Xbits, clrbits, op, setbits, v2, v6, v7, v8 int32
  2078. var nset, v3, v4 uintptr
  2079. _, _, _, _, _, _, _, _, _, _, _ = Xbits, clrbits, nset, op, setbits, v2, v3, v4, v6, v7, v8
  2080. nset = set
  2081. for {
  2082. /* Copy over any 'u', 'g' and 'o' commands. */
  2083. for {
  2084. v2 = int32((*TBITCMD)(unsafe.Pointer(nset)).Fcmd)
  2085. op = v2
  2086. if !(v2 != int32('+') && op != int32('-') && op != int32('X')) {
  2087. break
  2088. }
  2089. v3 = set
  2090. set += 8
  2091. v4 = nset
  2092. nset += 8
  2093. *(*TBITCMD)(unsafe.Pointer(v3)) = *(*TBITCMD)(unsafe.Pointer(v4))
  2094. if !(op != 0) {
  2095. return
  2096. }
  2097. }
  2098. v7 = libc.Int32FromInt32(0)
  2099. Xbits = v7
  2100. v6 = v7
  2101. clrbits = v6
  2102. setbits = v6
  2103. for {
  2104. v8 = int32((*TBITCMD)(unsafe.Pointer(nset)).Fcmd)
  2105. op = v8
  2106. if v8 == int32('-') {
  2107. clrbits = int32(uint32(clrbits) | (*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  2108. setbits = int32(uint32(setbits) & ^(*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  2109. Xbits = int32(uint32(Xbits) & ^(*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  2110. } else {
  2111. if op == int32('+') {
  2112. setbits = int32(uint32(setbits) | (*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  2113. clrbits = int32(uint32(clrbits) & ^(*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  2114. Xbits = int32(uint32(Xbits) & ^(*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  2115. } else {
  2116. if op == int32('X') {
  2117. Xbits = int32(uint32(Xbits) | (*TBITCMD)(unsafe.Pointer(nset)).Fbits&libc.Uint32FromInt32(^setbits))
  2118. } else {
  2119. break
  2120. }
  2121. }
  2122. }
  2123. goto _5
  2124. _5:
  2125. ;
  2126. nset += 8
  2127. }
  2128. if clrbits != 0 {
  2129. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = int8('-')
  2130. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = 0
  2131. (*TBITCMD)(unsafe.Pointer(set)).Fbits = libc.Uint32FromInt32(clrbits)
  2132. set += 8
  2133. }
  2134. if setbits != 0 {
  2135. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = int8('+')
  2136. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = 0
  2137. (*TBITCMD)(unsafe.Pointer(set)).Fbits = libc.Uint32FromInt32(setbits)
  2138. set += 8
  2139. }
  2140. if Xbits != 0 {
  2141. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = int8('X')
  2142. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = 0
  2143. (*TBITCMD)(unsafe.Pointer(set)).Fbits = libc.Uint32FromInt32(Xbits)
  2144. set += 8
  2145. }
  2146. goto _1
  2147. _1:
  2148. }
  2149. }
  2150. const m_AT_EACCESS = 0x200
  2151. const m_AT_EMPTY_PATH = 0x1000
  2152. const m_AT_NO_AUTOMOUNT = 0x800
  2153. const m_AT_RECURSIVE = 0x8000
  2154. const m_AT_REMOVEDIR = 0x200
  2155. const m_AT_STATX_DONT_SYNC = 0x4000
  2156. const m_AT_STATX_FORCE_SYNC = 0x2000
  2157. const m_AT_STATX_SYNC_AS_STAT = 0x0000
  2158. const m_AT_STATX_SYNC_TYPE = 0x6000
  2159. const m_AT_SYMLINK_FOLLOW = 0x400
  2160. const m_AT_SYMLINK_NOFOLLOW = 0x100
  2161. const m_BLOCKSZ = 64
  2162. const m_CANBSIZ = 255
  2163. const m_CLOCKS_PER_SEC = 1000000
  2164. const m_CLOCK_BOOTTIME = 7
  2165. const m_CLOCK_BOOTTIME_ALARM = 9
  2166. const m_CLOCK_MONOTONIC = 1
  2167. const m_CLOCK_MONOTONIC_COARSE = 6
  2168. const m_CLOCK_MONOTONIC_RAW = 4
  2169. const m_CLOCK_PROCESS_CPUTIME_ID = 2
  2170. const m_CLOCK_REALTIME = 0
  2171. const m_CLOCK_REALTIME_ALARM = 8
  2172. const m_CLOCK_REALTIME_COARSE = 5
  2173. const m_CLOCK_SGI_CYCLE = 10
  2174. const m_CLOCK_TAI = 11
  2175. const m_CLOCK_THREAD_CPUTIME_ID = 3
  2176. const m_CLONE_CHILD_CLEARTID = 0x00200000
  2177. const m_CLONE_CHILD_SETTID = 0x01000000
  2178. const m_CLONE_DETACHED = 0x00400000
  2179. const m_CLONE_FILES = 0x00000400
  2180. const m_CLONE_FS = 0x00000200
  2181. const m_CLONE_IO = 0x80000000
  2182. const m_CLONE_NEWCGROUP = 0x02000000
  2183. const m_CLONE_NEWIPC = 0x08000000
  2184. const m_CLONE_NEWNET = 0x40000000
  2185. const m_CLONE_NEWNS = 0x00020000
  2186. const m_CLONE_NEWPID = 0x20000000
  2187. const m_CLONE_NEWTIME = 0x00000080
  2188. const m_CLONE_NEWUSER = 0x10000000
  2189. const m_CLONE_NEWUTS = 0x04000000
  2190. const m_CLONE_PARENT = 0x00008000
  2191. const m_CLONE_PARENT_SETTID = 0x00100000
  2192. const m_CLONE_PIDFD = 0x00001000
  2193. const m_CLONE_PTRACE = 0x00002000
  2194. const m_CLONE_SETTLS = 0x00080000
  2195. const m_CLONE_SIGHAND = 0x00000800
  2196. const m_CLONE_SYSVSEM = 0x00040000
  2197. const m_CLONE_THREAD = 0x00010000
  2198. const m_CLONE_UNTRACED = 0x00800000
  2199. const m_CLONE_VFORK = 0x00004000
  2200. const m_CLONE_VM = 0x00000100
  2201. const m_CPU_SETSIZE = 1024
  2202. const m_CSIGNAL = 0x000000ff
  2203. const m_DEV_BSIZE = 512
  2204. const m_DN_ACCESS = 0x00000001
  2205. const m_DN_ATTRIB = 0x00000020
  2206. const m_DN_CREATE = 0x00000004
  2207. const m_DN_DELETE = 0x00000008
  2208. const m_DN_MODIFY = 0x00000002
  2209. const m_DN_MULTISHOT = 0x80000000
  2210. const m_DN_RENAME = 0x00000010
  2211. const m_FALLOC_FL_KEEP_SIZE = 1
  2212. const m_FALLOC_FL_PUNCH_HOLE = 2
  2213. const m_FAPPEND = "O_APPEND"
  2214. const m_FASYNC = "O_ASYNC"
  2215. const m_FD_CLOEXEC = 1
  2216. const m_FFSYNC = "O_SYNC"
  2217. const m_FNDELAY = "O_NDELAY"
  2218. const m_FNONBLOCK = "O_NONBLOCK"
  2219. const m_F_ADD_SEALS = 1033
  2220. const m_F_CANCELLK = 1029
  2221. const m_F_DUPFD = 0
  2222. const m_F_DUPFD_CLOEXEC = 1030
  2223. const m_F_GETFD = 1
  2224. const m_F_GETFL = 3
  2225. const m_F_GETLEASE = 1025
  2226. const m_F_GETLK = 5
  2227. const m_F_GETOWN = 9
  2228. const m_F_GETOWNER_UIDS = 17
  2229. const m_F_GETOWN_EX = 16
  2230. const m_F_GETPIPE_SZ = 1032
  2231. const m_F_GETSIG = 11
  2232. const m_F_GET_FILE_RW_HINT = 1037
  2233. const m_F_GET_RW_HINT = 1035
  2234. const m_F_GET_SEALS = 1034
  2235. const m_F_NOTIFY = 1026
  2236. const m_F_OFD_GETLK = 36
  2237. const m_F_OFD_SETLK = 37
  2238. const m_F_OFD_SETLKW = 38
  2239. const m_F_OWNER_GID = 2
  2240. const m_F_OWNER_PGRP = 2
  2241. const m_F_OWNER_PID = 1
  2242. const m_F_OWNER_TID = 0
  2243. const m_F_RDLCK = 0
  2244. const m_F_SEAL_FUTURE_WRITE = 0x0010
  2245. const m_F_SEAL_GROW = 0x0004
  2246. const m_F_SEAL_SEAL = 0x0001
  2247. const m_F_SEAL_SHRINK = 0x0002
  2248. const m_F_SEAL_WRITE = 0x0008
  2249. const m_F_SETFD = 2
  2250. const m_F_SETFL = 4
  2251. const m_F_SETLEASE = 1024
  2252. const m_F_SETLK = 6
  2253. const m_F_SETLKW = 7
  2254. const m_F_SETOWN = 8
  2255. const m_F_SETOWN_EX = 15
  2256. const m_F_SETPIPE_SZ = 1031
  2257. const m_F_SETSIG = 10
  2258. const m_F_SET_FILE_RW_HINT = 1038
  2259. const m_F_SET_RW_HINT = 1036
  2260. const m_F_UNLCK = 2
  2261. const m_F_WRLCK = 1
  2262. const m_ITIMER_PROF = 2
  2263. const m_ITIMER_REAL = 0
  2264. const m_ITIMER_VIRTUAL = 1
  2265. const m_IVSZ = 8
  2266. const m_KEYSZ = 32
  2267. const m_MADV_COLD = 20
  2268. const m_MADV_DODUMP = 17
  2269. const m_MADV_DOFORK = 11
  2270. const m_MADV_DONTDUMP = 16
  2271. const m_MADV_DONTFORK = 10
  2272. const m_MADV_DONTNEED = 4
  2273. const m_MADV_FREE = 8
  2274. const m_MADV_HUGEPAGE = 14
  2275. const m_MADV_HWPOISON = 100
  2276. const m_MADV_KEEPONFORK = 19
  2277. const m_MADV_MERGEABLE = 12
  2278. const m_MADV_NOHUGEPAGE = 15
  2279. const m_MADV_NORMAL = 0
  2280. const m_MADV_PAGEOUT = 21
  2281. const m_MADV_RANDOM = 1
  2282. const m_MADV_REMOVE = 9
  2283. const m_MADV_SEQUENTIAL = 2
  2284. const m_MADV_SOFT_OFFLINE = 101
  2285. const m_MADV_UNMERGEABLE = 13
  2286. const m_MADV_WILLNEED = 3
  2287. const m_MADV_WIPEONFORK = 18
  2288. const m_MAP_ANON = 32
  2289. const m_MAP_ANONYMOUS = "MAP_ANON"
  2290. const m_MAP_DENYWRITE = 0x0800
  2291. const m_MAP_EXECUTABLE = 0x1000
  2292. const m_MAP_FILE = 0
  2293. const m_MAP_FIXED = 0x10
  2294. const m_MAP_FIXED_NOREPLACE = 0x100000
  2295. const m_MAP_GROWSDOWN = 0x0100
  2296. const m_MAP_HUGETLB = 0x40000
  2297. const m_MAP_HUGE_MASK = 0x3f
  2298. const m_MAP_HUGE_SHIFT = 26
  2299. const m_MAP_LOCKED = 0x2000
  2300. const m_MAP_NONBLOCK = 0x10000
  2301. const m_MAP_NORESERVE = 0x4000
  2302. const m_MAP_POPULATE = 0x8000
  2303. const m_MAP_PRIVATE = 2
  2304. const m_MAP_SHARED = 0x01
  2305. const m_MAP_SHARED_VALIDATE = 0x03
  2306. const m_MAP_STACK = 0x20000
  2307. const m_MAP_SYNC = 0x80000
  2308. const m_MAP_TYPE = 0x0f
  2309. const m_MAXHOSTNAMELEN = 64
  2310. const m_MAXNAMLEN = 255
  2311. const m_MAXPATHLEN = 4096
  2312. const m_MAXSYMLINKS = 20
  2313. const m_MAX_HANDLE_SZ = 128
  2314. const m_MCL_CURRENT = 1
  2315. const m_MCL_FUTURE = 2
  2316. const m_MCL_ONFAULT = 4
  2317. const m_MFD_ALLOW_SEALING = 0x0002
  2318. const m_MFD_CLOEXEC = 0x0001
  2319. const m_MFD_HUGETLB = 0x0004
  2320. const m_MLOCK_ONFAULT = 0x01
  2321. const m_MREMAP_DONTUNMAP = 4
  2322. const m_MREMAP_FIXED = 2
  2323. const m_MREMAP_MAYMOVE = 1
  2324. const m_MS_ASYNC = 1
  2325. const m_MS_INVALIDATE = 2
  2326. const m_MS_SYNC = 4
  2327. const m_NBBY = 8
  2328. const m_NCARGS = 131072
  2329. const m_NGROUPS = 32
  2330. const m_NOFILE = 256
  2331. const m_O_APPEND = 02000
  2332. const m_O_ASYNC = 020000
  2333. const m_O_CLOEXEC = 02000000
  2334. const m_O_CREAT = 0100
  2335. const m_O_DIRECT = 040000
  2336. const m_O_DIRECTORY = 0200000
  2337. const m_O_DSYNC = 010000
  2338. const m_O_EXCL = 0200
  2339. const m_O_EXEC = "O_PATH"
  2340. const m_O_LARGEFILE = 0100000
  2341. const m_O_NDELAY = "O_NONBLOCK"
  2342. const m_O_NOATIME = 01000000
  2343. const m_O_NOCTTY = 0400
  2344. const m_O_NOFOLLOW = 0400000
  2345. const m_O_NONBLOCK = 04000
  2346. const m_O_PATH = 010000000
  2347. const m_O_RDONLY = 00
  2348. const m_O_RDWR = 02
  2349. const m_O_RSYNC = 04010000
  2350. const m_O_SEARCH = "O_PATH"
  2351. const m_O_SYNC = 04010000
  2352. const m_O_TMPFILE = 020200000
  2353. const m_O_TRUNC = 01000
  2354. const m_O_TTY_INIT = 0
  2355. const m_O_WRONLY = 01
  2356. const m_POSIX_FADV_DONTNEED = 4
  2357. const m_POSIX_FADV_NOREUSE = 5
  2358. const m_POSIX_FADV_NORMAL = 0
  2359. const m_POSIX_FADV_RANDOM = 1
  2360. const m_POSIX_FADV_SEQUENTIAL = 2
  2361. const m_POSIX_FADV_WILLNEED = 3
  2362. const m_POSIX_MADV_DONTNEED = 4
  2363. const m_POSIX_MADV_NORMAL = 0
  2364. const m_POSIX_MADV_RANDOM = 1
  2365. const m_POSIX_MADV_SEQUENTIAL = 2
  2366. const m_POSIX_MADV_WILLNEED = 3
  2367. const m_PRIO_MAX = 20
  2368. const m_PRIO_PGRP = 1
  2369. const m_PRIO_PROCESS = 0
  2370. const m_PRIO_USER = 2
  2371. const m_PROT_EXEC = 4
  2372. const m_PROT_GROWSDOWN = 0x01000000
  2373. const m_PROT_GROWSUP = 0x02000000
  2374. const m_PROT_NONE = 0
  2375. const m_PROT_READ = 1
  2376. const m_PROT_WRITE = 2
  2377. const m_PTHREAD_CANCEL_ASYNCHRONOUS = 1
  2378. const m_PTHREAD_CANCEL_DEFERRED = 0
  2379. const m_PTHREAD_CANCEL_DISABLE = 1
  2380. const m_PTHREAD_CANCEL_ENABLE = 0
  2381. const m_PTHREAD_CANCEL_MASKED = 2
  2382. const m_PTHREAD_CREATE_DETACHED = 1
  2383. const m_PTHREAD_CREATE_JOINABLE = 0
  2384. const m_PTHREAD_EXPLICIT_SCHED = 1
  2385. const m_PTHREAD_INHERIT_SCHED = 0
  2386. const m_PTHREAD_MUTEX_DEFAULT = 0
  2387. const m_PTHREAD_MUTEX_ERRORCHECK = 2
  2388. const m_PTHREAD_MUTEX_NORMAL = 0
  2389. const m_PTHREAD_MUTEX_RECURSIVE = 1
  2390. const m_PTHREAD_MUTEX_ROBUST = 1
  2391. const m_PTHREAD_MUTEX_STALLED = 0
  2392. const m_PTHREAD_ONCE_INIT = 0
  2393. const m_PTHREAD_PRIO_INHERIT = 1
  2394. const m_PTHREAD_PRIO_NONE = 0
  2395. const m_PTHREAD_PRIO_PROTECT = 2
  2396. const m_PTHREAD_PROCESS_PRIVATE = 0
  2397. const m_PTHREAD_PROCESS_SHARED = 1
  2398. const m_PTHREAD_SCOPE_PROCESS = 1
  2399. const m_PTHREAD_SCOPE_SYSTEM = 0
  2400. const m_RLIMIT_AS = 9
  2401. const m_RLIMIT_CORE = 4
  2402. const m_RLIMIT_CPU = 0
  2403. const m_RLIMIT_DATA = 2
  2404. const m_RLIMIT_FSIZE = 1
  2405. const m_RLIMIT_LOCKS = 10
  2406. const m_RLIMIT_MEMLOCK = 8
  2407. const m_RLIMIT_MSGQUEUE = 12
  2408. const m_RLIMIT_NICE = 13
  2409. const m_RLIMIT_NLIMITS = 16
  2410. const m_RLIMIT_NOFILE = 7
  2411. const m_RLIMIT_NPROC = 6
  2412. const m_RLIMIT_RSS = 5
  2413. const m_RLIMIT_RTPRIO = 14
  2414. const m_RLIMIT_RTTIME = 15
  2415. const m_RLIMIT_SIGPENDING = 11
  2416. const m_RLIMIT_STACK = 3
  2417. const m_RLIM_NLIMITS = "RLIMIT_NLIMITS"
  2418. const m_RLIM_SAVED_CUR = "RLIM_INFINITY"
  2419. const m_RLIM_SAVED_MAX = "RLIM_INFINITY"
  2420. const m_RUSAGE_SELF = 0
  2421. const m_RUSAGE_THREAD = 1
  2422. const m_RWF_WRITE_LIFE_NOT_SET = 0
  2423. const m_RWH_WRITE_LIFE_EXTREME = 5
  2424. const m_RWH_WRITE_LIFE_LONG = 4
  2425. const m_RWH_WRITE_LIFE_MEDIUM = 3
  2426. const m_RWH_WRITE_LIFE_NONE = 1
  2427. const m_RWH_WRITE_LIFE_SHORT = 2
  2428. const m_SCHED_BATCH = 3
  2429. const m_SCHED_DEADLINE = 6
  2430. const m_SCHED_FIFO = 1
  2431. const m_SCHED_IDLE = 5
  2432. const m_SCHED_OTHER = 0
  2433. const m_SCHED_RESET_ON_FORK = 0x40000000
  2434. const m_SCHED_RR = 2
  2435. const m_SPLICE_F_GIFT = 8
  2436. const m_SPLICE_F_MORE = 4
  2437. const m_SPLICE_F_MOVE = 1
  2438. const m_SPLICE_F_NONBLOCK = 2
  2439. const m_SYNC_FILE_RANGE_WAIT_AFTER = 4
  2440. const m_SYNC_FILE_RANGE_WAIT_BEFORE = 1
  2441. const m_SYNC_FILE_RANGE_WRITE = 2
  2442. const m_S_IFDIR1 = 0040000
  2443. const m_S_IRGRP1 = 0040
  2444. const m_S_IROTH1 = 0004
  2445. const m_S_IRUSR1 = 0400
  2446. const m_S_IRWXG1 = 0070
  2447. const m_S_IRWXO1 = 0007
  2448. const m_S_IRWXU1 = 0700
  2449. const m_S_ISGID1 = 02000
  2450. const m_S_ISUID1 = 04000
  2451. const m_S_ISVTX1 = 01000
  2452. const m_S_IWGRP1 = 0020
  2453. const m_S_IWOTH1 = 0002
  2454. const m_S_IWUSR1 = 0200
  2455. const m_S_IXGRP1 = 0010
  2456. const m_S_IXOTH1 = 0001
  2457. const m_S_IXUSR1 = 0100
  2458. const m_TIMER_ABSTIME = 1
  2459. const m_TIME_UTC = 1
  2460. const m___LONG_MAX1 = 0x7fffffffffffffff
  2461. const m___tm_gmtoff = "tm_gmtoff"
  2462. const m___tm_zone = "tm_zone"
  2463. const m_inline = "__inline"
  2464. const m_loff_t = "off_t"
  2465. const m_prlimit64 = "prlimit"
  2466. type Tiovec = struct {
  2467. Fiov_base uintptr
  2468. Fiov_len Tsize_t
  2469. }
  2470. type Tflock = struct {
  2471. Fl_type int16
  2472. Fl_whence int16
  2473. Fl_start Toff_t
  2474. Fl_len Toff_t
  2475. Fl_pid Tpid_t
  2476. }
  2477. type Tfile_handle = struct {
  2478. Fhandle_bytes uint32
  2479. Fhandle_type int32
  2480. }
  2481. type Tf_owner_ex = struct {
  2482. Ftype1 int32
  2483. Fpid Tpid_t
  2484. }
  2485. type Titimerval = struct {
  2486. Fit_interval Ttimeval
  2487. Fit_value Ttimeval
  2488. }
  2489. type Ttimezone = struct {
  2490. Ftz_minuteswest int32
  2491. Ftz_dsttime int32
  2492. }
  2493. type Tu8 = uint8
  2494. type Tu32 = uint32
  2495. type Tchacha_ctx = struct {
  2496. Finput [16]Tu32
  2497. }
  2498. var _sigma = [16]int8{'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'}
  2499. var _tau = [16]int8{'e', 'x', 'p', 'a', 'n', 'd', ' ', '1', '6', '-', 'b', 'y', 't', 'e', ' ', 'k'}
  2500. func _chacha_keysetup(tls *libc.TLS, x uintptr, k uintptr, kbits Tu32) {
  2501. var constants uintptr
  2502. _ = constants
  2503. *(*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)
  2504. *(*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)
  2505. *(*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)
  2506. *(*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)
  2507. if kbits == uint32(256) {
  2508. k += uintptr(16)
  2509. constants = uintptr(unsafe.Pointer(&_sigma))
  2510. } else {
  2511. constants = uintptr(unsafe.Pointer(&_tau))
  2512. }
  2513. *(*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)
  2514. *(*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)
  2515. *(*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)
  2516. *(*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)
  2517. *(*Tu32)(unsafe.Pointer(x)) = libc.Uint32FromInt8(*(*int8)(unsafe.Pointer(constants + libc.UintptrFromInt32(0)))) | libc.Uint32FromInt8(*(*int8)(unsafe.Pointer(constants + libc.UintptrFromInt32(0) + 1)))<<libc.Int32FromInt32(8) | libc.Uint32FromInt8(*(*int8)(unsafe.Pointer(constants + libc.UintptrFromInt32(0) + 2)))<<libc.Int32FromInt32(16) | libc.Uint32FromInt8(*(*int8)(unsafe.Pointer(constants + libc.UintptrFromInt32(0) + 3)))<<libc.Int32FromInt32(24)
  2518. *(*Tu32)(unsafe.Pointer(x + 1*4)) = libc.Uint32FromInt8(*(*int8)(unsafe.Pointer(constants + libc.UintptrFromInt32(4)))) | libc.Uint32FromInt8(*(*int8)(unsafe.Pointer(constants + libc.UintptrFromInt32(4) + 1)))<<libc.Int32FromInt32(8) | libc.Uint32FromInt8(*(*int8)(unsafe.Pointer(constants + libc.UintptrFromInt32(4) + 2)))<<libc.Int32FromInt32(16) | libc.Uint32FromInt8(*(*int8)(unsafe.Pointer(constants + libc.UintptrFromInt32(4) + 3)))<<libc.Int32FromInt32(24)
  2519. *(*Tu32)(unsafe.Pointer(x + 2*4)) = libc.Uint32FromInt8(*(*int8)(unsafe.Pointer(constants + libc.UintptrFromInt32(8)))) | libc.Uint32FromInt8(*(*int8)(unsafe.Pointer(constants + libc.UintptrFromInt32(8) + 1)))<<libc.Int32FromInt32(8) | libc.Uint32FromInt8(*(*int8)(unsafe.Pointer(constants + libc.UintptrFromInt32(8) + 2)))<<libc.Int32FromInt32(16) | libc.Uint32FromInt8(*(*int8)(unsafe.Pointer(constants + libc.UintptrFromInt32(8) + 3)))<<libc.Int32FromInt32(24)
  2520. *(*Tu32)(unsafe.Pointer(x + 3*4)) = libc.Uint32FromInt8(*(*int8)(unsafe.Pointer(constants + libc.UintptrFromInt32(12)))) | libc.Uint32FromInt8(*(*int8)(unsafe.Pointer(constants + libc.UintptrFromInt32(12) + 1)))<<libc.Int32FromInt32(8) | libc.Uint32FromInt8(*(*int8)(unsafe.Pointer(constants + libc.UintptrFromInt32(12) + 2)))<<libc.Int32FromInt32(16) | libc.Uint32FromInt8(*(*int8)(unsafe.Pointer(constants + libc.UintptrFromInt32(12) + 3)))<<libc.Int32FromInt32(24)
  2521. }
  2522. func _chacha_ivsetup(tls *libc.TLS, x uintptr, iv uintptr) {
  2523. *(*Tu32)(unsafe.Pointer(x + 12*4)) = uint32(0)
  2524. *(*Tu32)(unsafe.Pointer(x + 13*4)) = uint32(0)
  2525. *(*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)
  2526. *(*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)
  2527. }
  2528. func _chacha_encrypt_bytes(tls *libc.TLS, x uintptr, m uintptr, c uintptr, bytes Tu32) {
  2529. bp := tls.Alloc(64)
  2530. defer tls.Free(64)
  2531. var ctarget uintptr
  2532. var i uint32
  2533. 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
  2534. var _ /* tmp at bp+0 */ [64]Tu8
  2535. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  2536. ctarget = libc.UintptrFromInt32(0)
  2537. if !(bytes != 0) {
  2538. return
  2539. }
  2540. j0 = *(*Tu32)(unsafe.Pointer(x))
  2541. j1 = *(*Tu32)(unsafe.Pointer(x + 1*4))
  2542. j2 = *(*Tu32)(unsafe.Pointer(x + 2*4))
  2543. j3 = *(*Tu32)(unsafe.Pointer(x + 3*4))
  2544. j4 = *(*Tu32)(unsafe.Pointer(x + 4*4))
  2545. j5 = *(*Tu32)(unsafe.Pointer(x + 5*4))
  2546. j6 = *(*Tu32)(unsafe.Pointer(x + 6*4))
  2547. j7 = *(*Tu32)(unsafe.Pointer(x + 7*4))
  2548. j8 = *(*Tu32)(unsafe.Pointer(x + 8*4))
  2549. j9 = *(*Tu32)(unsafe.Pointer(x + 9*4))
  2550. j10 = *(*Tu32)(unsafe.Pointer(x + 10*4))
  2551. j11 = *(*Tu32)(unsafe.Pointer(x + 11*4))
  2552. j12 = *(*Tu32)(unsafe.Pointer(x + 12*4))
  2553. j13 = *(*Tu32)(unsafe.Pointer(x + 13*4))
  2554. j14 = *(*Tu32)(unsafe.Pointer(x + 14*4))
  2555. j15 = *(*Tu32)(unsafe.Pointer(x + 15*4))
  2556. for {
  2557. if bytes < uint32(64) {
  2558. i = uint32(0)
  2559. for {
  2560. if !(i < bytes) {
  2561. break
  2562. }
  2563. (*(*[64]Tu8)(unsafe.Pointer(bp)))[i] = *(*Tu8)(unsafe.Pointer(m + uintptr(i)))
  2564. goto _2
  2565. _2:
  2566. ;
  2567. i++
  2568. }
  2569. m = bp
  2570. ctarget = c
  2571. c = bp
  2572. }
  2573. x0 = j0
  2574. x1 = j1
  2575. x2 = j2
  2576. x3 = j3
  2577. x4 = j4
  2578. x5 = j5
  2579. x6 = j6
  2580. x7 = j7
  2581. x8 = j8
  2582. x9 = j9
  2583. x10 = j10
  2584. x11 = j11
  2585. x12 = j12
  2586. x13 = j13
  2587. x14 = j14
  2588. x15 = j15
  2589. i = uint32(20)
  2590. for {
  2591. if !(i > uint32(0)) {
  2592. break
  2593. }
  2594. x0 = (x0 + x4) & libc.Uint32FromUint32(0xFFFFFFFF)
  2595. x12 = (x12^x0)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x12^x0)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  2596. x8 = (x8 + x12) & libc.Uint32FromUint32(0xFFFFFFFF)
  2597. x4 = (x4^x8)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x4^x8)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  2598. x0 = (x0 + x4) & libc.Uint32FromUint32(0xFFFFFFFF)
  2599. x12 = (x12^x0)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x12^x0)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  2600. x8 = (x8 + x12) & libc.Uint32FromUint32(0xFFFFFFFF)
  2601. x4 = (x4^x8)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x4^x8)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  2602. x1 = (x1 + x5) & libc.Uint32FromUint32(0xFFFFFFFF)
  2603. x13 = (x13^x1)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x13^x1)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  2604. x9 = (x9 + x13) & libc.Uint32FromUint32(0xFFFFFFFF)
  2605. x5 = (x5^x9)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x5^x9)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  2606. x1 = (x1 + x5) & libc.Uint32FromUint32(0xFFFFFFFF)
  2607. x13 = (x13^x1)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x13^x1)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  2608. x9 = (x9 + x13) & libc.Uint32FromUint32(0xFFFFFFFF)
  2609. x5 = (x5^x9)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x5^x9)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  2610. x2 = (x2 + x6) & libc.Uint32FromUint32(0xFFFFFFFF)
  2611. x14 = (x14^x2)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x14^x2)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  2612. x10 = (x10 + x14) & libc.Uint32FromUint32(0xFFFFFFFF)
  2613. x6 = (x6^x10)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x6^x10)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  2614. x2 = (x2 + x6) & libc.Uint32FromUint32(0xFFFFFFFF)
  2615. x14 = (x14^x2)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x14^x2)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  2616. x10 = (x10 + x14) & libc.Uint32FromUint32(0xFFFFFFFF)
  2617. x6 = (x6^x10)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x6^x10)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  2618. x3 = (x3 + x7) & libc.Uint32FromUint32(0xFFFFFFFF)
  2619. x15 = (x15^x3)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x15^x3)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  2620. x11 = (x11 + x15) & libc.Uint32FromUint32(0xFFFFFFFF)
  2621. x7 = (x7^x11)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x7^x11)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  2622. x3 = (x3 + x7) & libc.Uint32FromUint32(0xFFFFFFFF)
  2623. x15 = (x15^x3)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x15^x3)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  2624. x11 = (x11 + x15) & libc.Uint32FromUint32(0xFFFFFFFF)
  2625. x7 = (x7^x11)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x7^x11)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  2626. x0 = (x0 + x5) & libc.Uint32FromUint32(0xFFFFFFFF)
  2627. x15 = (x15^x0)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x15^x0)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  2628. x10 = (x10 + x15) & libc.Uint32FromUint32(0xFFFFFFFF)
  2629. x5 = (x5^x10)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x5^x10)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  2630. x0 = (x0 + x5) & libc.Uint32FromUint32(0xFFFFFFFF)
  2631. x15 = (x15^x0)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x15^x0)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  2632. x10 = (x10 + x15) & libc.Uint32FromUint32(0xFFFFFFFF)
  2633. x5 = (x5^x10)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x5^x10)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  2634. x1 = (x1 + x6) & libc.Uint32FromUint32(0xFFFFFFFF)
  2635. x12 = (x12^x1)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x12^x1)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  2636. x11 = (x11 + x12) & libc.Uint32FromUint32(0xFFFFFFFF)
  2637. x6 = (x6^x11)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x6^x11)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  2638. x1 = (x1 + x6) & libc.Uint32FromUint32(0xFFFFFFFF)
  2639. x12 = (x12^x1)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x12^x1)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  2640. x11 = (x11 + x12) & libc.Uint32FromUint32(0xFFFFFFFF)
  2641. x6 = (x6^x11)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x6^x11)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  2642. x2 = (x2 + x7) & libc.Uint32FromUint32(0xFFFFFFFF)
  2643. x13 = (x13^x2)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x13^x2)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  2644. x8 = (x8 + x13) & libc.Uint32FromUint32(0xFFFFFFFF)
  2645. x7 = (x7^x8)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x7^x8)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  2646. x2 = (x2 + x7) & libc.Uint32FromUint32(0xFFFFFFFF)
  2647. x13 = (x13^x2)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x13^x2)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  2648. x8 = (x8 + x13) & libc.Uint32FromUint32(0xFFFFFFFF)
  2649. x7 = (x7^x8)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x7^x8)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  2650. x3 = (x3 + x4) & libc.Uint32FromUint32(0xFFFFFFFF)
  2651. x14 = (x14^x3)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x14^x3)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  2652. x9 = (x9 + x14) & libc.Uint32FromUint32(0xFFFFFFFF)
  2653. x4 = (x4^x9)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x4^x9)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  2654. x3 = (x3 + x4) & libc.Uint32FromUint32(0xFFFFFFFF)
  2655. x14 = (x14^x3)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x14^x3)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  2656. x9 = (x9 + x14) & libc.Uint32FromUint32(0xFFFFFFFF)
  2657. x4 = (x4^x9)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x4^x9)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  2658. goto _3
  2659. _3:
  2660. ;
  2661. i -= uint32(2)
  2662. }
  2663. x0 = (x0 + j0) & libc.Uint32FromUint32(0xFFFFFFFF)
  2664. x1 = (x1 + j1) & libc.Uint32FromUint32(0xFFFFFFFF)
  2665. x2 = (x2 + j2) & libc.Uint32FromUint32(0xFFFFFFFF)
  2666. x3 = (x3 + j3) & libc.Uint32FromUint32(0xFFFFFFFF)
  2667. x4 = (x4 + j4) & libc.Uint32FromUint32(0xFFFFFFFF)
  2668. x5 = (x5 + j5) & libc.Uint32FromUint32(0xFFFFFFFF)
  2669. x6 = (x6 + j6) & libc.Uint32FromUint32(0xFFFFFFFF)
  2670. x7 = (x7 + j7) & libc.Uint32FromUint32(0xFFFFFFFF)
  2671. x8 = (x8 + j8) & libc.Uint32FromUint32(0xFFFFFFFF)
  2672. x9 = (x9 + j9) & libc.Uint32FromUint32(0xFFFFFFFF)
  2673. x10 = (x10 + j10) & libc.Uint32FromUint32(0xFFFFFFFF)
  2674. x11 = (x11 + j11) & libc.Uint32FromUint32(0xFFFFFFFF)
  2675. x12 = (x12 + j12) & libc.Uint32FromUint32(0xFFFFFFFF)
  2676. x13 = (x13 + j13) & libc.Uint32FromUint32(0xFFFFFFFF)
  2677. x14 = (x14 + j14) & libc.Uint32FromUint32(0xFFFFFFFF)
  2678. x15 = (x15 + j15) & libc.Uint32FromUint32(0xFFFFFFFF)
  2679. j12 = (j12 + libc.Uint32FromInt32(libc.Int32FromInt32(1))) & libc.Uint32FromUint32(0xFFFFFFFF)
  2680. if !(j12 != 0) {
  2681. j13 = (j13 + libc.Uint32FromInt32(libc.Int32FromInt32(1))) & libc.Uint32FromUint32(0xFFFFFFFF)
  2682. }
  2683. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(0))) = uint8(uint32(uint8(x0)) & libc.Uint32FromUint32(0xFF))
  2684. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(0) + 1)) = uint8(uint32(uint8(x0>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2685. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(0) + 2)) = uint8(uint32(uint8(x0>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2686. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(0) + 3)) = uint8(uint32(uint8(x0>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2687. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(4))) = uint8(uint32(uint8(x1)) & libc.Uint32FromUint32(0xFF))
  2688. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(4) + 1)) = uint8(uint32(uint8(x1>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2689. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(4) + 2)) = uint8(uint32(uint8(x1>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2690. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(4) + 3)) = uint8(uint32(uint8(x1>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2691. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(8))) = uint8(uint32(uint8(x2)) & libc.Uint32FromUint32(0xFF))
  2692. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(8) + 1)) = uint8(uint32(uint8(x2>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2693. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(8) + 2)) = uint8(uint32(uint8(x2>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2694. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(8) + 3)) = uint8(uint32(uint8(x2>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2695. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(12))) = uint8(uint32(uint8(x3)) & libc.Uint32FromUint32(0xFF))
  2696. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(12) + 1)) = uint8(uint32(uint8(x3>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2697. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(12) + 2)) = uint8(uint32(uint8(x3>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2698. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(12) + 3)) = uint8(uint32(uint8(x3>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2699. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(16))) = uint8(uint32(uint8(x4)) & libc.Uint32FromUint32(0xFF))
  2700. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(16) + 1)) = uint8(uint32(uint8(x4>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2701. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(16) + 2)) = uint8(uint32(uint8(x4>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2702. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(16) + 3)) = uint8(uint32(uint8(x4>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2703. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(20))) = uint8(uint32(uint8(x5)) & libc.Uint32FromUint32(0xFF))
  2704. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(20) + 1)) = uint8(uint32(uint8(x5>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2705. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(20) + 2)) = uint8(uint32(uint8(x5>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2706. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(20) + 3)) = uint8(uint32(uint8(x5>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2707. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(24))) = uint8(uint32(uint8(x6)) & libc.Uint32FromUint32(0xFF))
  2708. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(24) + 1)) = uint8(uint32(uint8(x6>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2709. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(24) + 2)) = uint8(uint32(uint8(x6>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2710. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(24) + 3)) = uint8(uint32(uint8(x6>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2711. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(28))) = uint8(uint32(uint8(x7)) & libc.Uint32FromUint32(0xFF))
  2712. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(28) + 1)) = uint8(uint32(uint8(x7>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2713. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(28) + 2)) = uint8(uint32(uint8(x7>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2714. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(28) + 3)) = uint8(uint32(uint8(x7>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2715. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(32))) = uint8(uint32(uint8(x8)) & libc.Uint32FromUint32(0xFF))
  2716. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(32) + 1)) = uint8(uint32(uint8(x8>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2717. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(32) + 2)) = uint8(uint32(uint8(x8>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2718. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(32) + 3)) = uint8(uint32(uint8(x8>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2719. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(36))) = uint8(uint32(uint8(x9)) & libc.Uint32FromUint32(0xFF))
  2720. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(36) + 1)) = uint8(uint32(uint8(x9>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2721. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(36) + 2)) = uint8(uint32(uint8(x9>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2722. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(36) + 3)) = uint8(uint32(uint8(x9>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2723. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(40))) = uint8(uint32(uint8(x10)) & libc.Uint32FromUint32(0xFF))
  2724. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(40) + 1)) = uint8(uint32(uint8(x10>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2725. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(40) + 2)) = uint8(uint32(uint8(x10>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2726. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(40) + 3)) = uint8(uint32(uint8(x10>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2727. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(44))) = uint8(uint32(uint8(x11)) & libc.Uint32FromUint32(0xFF))
  2728. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(44) + 1)) = uint8(uint32(uint8(x11>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2729. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(44) + 2)) = uint8(uint32(uint8(x11>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2730. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(44) + 3)) = uint8(uint32(uint8(x11>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2731. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(48))) = uint8(uint32(uint8(x12)) & libc.Uint32FromUint32(0xFF))
  2732. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(48) + 1)) = uint8(uint32(uint8(x12>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2733. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(48) + 2)) = uint8(uint32(uint8(x12>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2734. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(48) + 3)) = uint8(uint32(uint8(x12>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2735. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(52))) = uint8(uint32(uint8(x13)) & libc.Uint32FromUint32(0xFF))
  2736. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(52) + 1)) = uint8(uint32(uint8(x13>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2737. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(52) + 2)) = uint8(uint32(uint8(x13>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2738. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(52) + 3)) = uint8(uint32(uint8(x13>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2739. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(56))) = uint8(uint32(uint8(x14)) & libc.Uint32FromUint32(0xFF))
  2740. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(56) + 1)) = uint8(uint32(uint8(x14>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2741. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(56) + 2)) = uint8(uint32(uint8(x14>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2742. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(56) + 3)) = uint8(uint32(uint8(x14>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2743. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(60))) = uint8(uint32(uint8(x15)) & libc.Uint32FromUint32(0xFF))
  2744. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(60) + 1)) = uint8(uint32(uint8(x15>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2745. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(60) + 2)) = uint8(uint32(uint8(x15>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2746. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(60) + 3)) = uint8(uint32(uint8(x15>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2747. if bytes <= uint32(64) {
  2748. if bytes < uint32(64) {
  2749. i = uint32(0)
  2750. for {
  2751. if !(i < bytes) {
  2752. break
  2753. }
  2754. *(*Tu8)(unsafe.Pointer(ctarget + uintptr(i))) = *(*Tu8)(unsafe.Pointer(c + uintptr(i)))
  2755. goto _4
  2756. _4:
  2757. ;
  2758. i++
  2759. }
  2760. }
  2761. *(*Tu32)(unsafe.Pointer(x + 12*4)) = j12
  2762. *(*Tu32)(unsafe.Pointer(x + 13*4)) = j13
  2763. return
  2764. }
  2765. bytes -= uint32(64)
  2766. c += uintptr(64)
  2767. goto _1
  2768. _1:
  2769. }
  2770. }
  2771. // C documentation
  2772. //
  2773. // /* Marked MAP_INHERIT_ZERO, so zero'd out in fork children. */
  2774. type T_rs = struct {
  2775. Frs_have Tsize_t
  2776. Frs_count Tsize_t
  2777. }
  2778. // C documentation
  2779. //
  2780. // /* Marked MAP_INHERIT_ZERO, so zero'd out in fork children. */
  2781. var _rs uintptr
  2782. // C documentation
  2783. //
  2784. // /* Maybe be preserved in fork children, if _rs_allocate() decides. */
  2785. type T_rsx = struct {
  2786. Frs_chacha Tchacha_ctx
  2787. Frs_buf [1024]uint8
  2788. }
  2789. // C documentation
  2790. //
  2791. // /* Maybe be preserved in fork children, if _rs_allocate() decides. */
  2792. var _rsx uintptr
  2793. type Trlim_t = uint64
  2794. type Trlimit = struct {
  2795. Frlim_cur Trlim_t
  2796. Frlim_max Trlim_t
  2797. }
  2798. type Trusage = struct {
  2799. Fru_utime Ttimeval
  2800. Fru_stime Ttimeval
  2801. Fru_maxrss int64
  2802. Fru_ixrss int64
  2803. Fru_idrss int64
  2804. Fru_isrss int64
  2805. Fru_minflt int64
  2806. Fru_majflt int64
  2807. Fru_nswap int64
  2808. Fru_inblock int64
  2809. Fru_oublock int64
  2810. Fru_msgsnd int64
  2811. Fru_msgrcv int64
  2812. Fru_nsignals int64
  2813. Fru_nvcsw int64
  2814. Fru_nivcsw int64
  2815. F__reserved [16]int64
  2816. }
  2817. type Tsched_param = struct {
  2818. Fsched_priority int32
  2819. F__reserved1 int32
  2820. F__reserved2 [2]struct {
  2821. F__reserved1 Ttime_t
  2822. F__reserved2 int64
  2823. }
  2824. F__reserved3 int32
  2825. }
  2826. type Tcpu_set_t = struct {
  2827. F__bits [16]uint64
  2828. }
  2829. type Ttm = struct {
  2830. Ftm_sec int32
  2831. Ftm_min int32
  2832. Ftm_hour int32
  2833. Ftm_mday int32
  2834. Ftm_mon int32
  2835. Ftm_year int32
  2836. Ftm_wday int32
  2837. Ftm_yday int32
  2838. Ftm_isdst int32
  2839. Ftm_gmtoff int64
  2840. Ftm_zone uintptr
  2841. }
  2842. type Titimerspec = struct {
  2843. Fit_interval Ttimespec
  2844. Fit_value Ttimespec
  2845. }
  2846. type t__ptcb = struct {
  2847. F__f uintptr
  2848. F__x uintptr
  2849. F__next uintptr
  2850. }
  2851. type Tcpu_set_t1 = struct {
  2852. F__bits [16]uint64
  2853. }
  2854. var _arc4random_mtx = Tpthread_mutex_t{}
  2855. var __rs_forked Tsig_atomic_t
  2856. func __rs_init(tls *libc.TLS, buf uintptr, n Tsize_t) {
  2857. var v1, v2, v3, v6 uintptr
  2858. var v4 int32
  2859. _, _, _, _, _ = v1, v2, v3, v4, v6
  2860. if n < libc.Uint64FromInt32(libc.Int32FromInt32(m_KEYSZ)+libc.Int32FromInt32(m_IVSZ)) {
  2861. return
  2862. }
  2863. if _rs == libc.UintptrFromInt32(0) {
  2864. v1 = uintptr(unsafe.Pointer(&_rs))
  2865. v2 = uintptr(unsafe.Pointer(&_rsx))
  2866. 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)
  2867. *(*uintptr)(unsafe.Pointer(v1)) = v3
  2868. if v3 == uintptr(-libc.Int32FromInt32(1)) {
  2869. v4 = -int32(1)
  2870. goto _5
  2871. }
  2872. 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)
  2873. *(*uintptr)(unsafe.Pointer(v2)) = v6
  2874. if v6 == uintptr(-libc.Int32FromInt32(1)) {
  2875. libc.Xmunmap(tls, *(*uintptr)(unsafe.Pointer(v1)), uint64(16))
  2876. *(*uintptr)(unsafe.Pointer(v1)) = libc.UintptrFromInt32(0)
  2877. v4 = -int32(1)
  2878. goto _5
  2879. }
  2880. libc.Xpthread_atfork(tls, libc.UintptrFromInt32(0), libc.UintptrFromInt32(0), __ccgo_fp(__rs_forkhandler))
  2881. v4 = 0
  2882. goto _5
  2883. _5:
  2884. if v4 == -int32(1) {
  2885. libc.X_exit(tls, int32(1))
  2886. }
  2887. }
  2888. _chacha_keysetup(tls, _rsx, buf, libc.Uint32FromInt32(libc.Int32FromInt32(m_KEYSZ)*libc.Int32FromInt32(8)))
  2889. _chacha_ivsetup(tls, _rsx, buf+uintptr(m_KEYSZ))
  2890. }
  2891. func __rs_rekey(tls *libc.TLS, dat uintptr, datlen Tsize_t) {
  2892. var i, m Tsize_t
  2893. var v1 uint64
  2894. var p3 uintptr
  2895. _, _, _, _ = i, m, v1, p3
  2896. /* fill rs_buf with the keystream */
  2897. _chacha_encrypt_bytes(tls, _rsx, _rsx+64, _rsx+64, uint32(1024))
  2898. /* mix in optional user provided data */
  2899. if dat != 0 {
  2900. if datlen < libc.Uint64FromInt32(libc.Int32FromInt32(m_KEYSZ)+libc.Int32FromInt32(m_IVSZ)) {
  2901. v1 = datlen
  2902. } else {
  2903. v1 = libc.Uint64FromInt32(libc.Int32FromInt32(m_KEYSZ) + libc.Int32FromInt32(m_IVSZ))
  2904. }
  2905. m = v1
  2906. i = uint64(0)
  2907. for {
  2908. if !(i < m) {
  2909. break
  2910. }
  2911. p3 = _rsx + 64 + uintptr(i)
  2912. *(*uint8)(unsafe.Pointer(p3)) = uint8(int32(*(*uint8)(unsafe.Pointer(p3))) ^ libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(dat + uintptr(i)))))
  2913. goto _2
  2914. _2:
  2915. ;
  2916. i++
  2917. }
  2918. }
  2919. /* immediately reinit for backtracking resistance */
  2920. __rs_init(tls, _rsx+64, libc.Uint64FromInt32(libc.Int32FromInt32(m_KEYSZ)+libc.Int32FromInt32(m_IVSZ)))
  2921. libc.Xmemset(tls, _rsx+64, 0, libc.Uint64FromInt32(libc.Int32FromInt32(m_KEYSZ)+libc.Int32FromInt32(m_IVSZ)))
  2922. (*T_rs)(unsafe.Pointer(_rs)).Frs_have = libc.Uint64FromInt64(1024) - libc.Uint64FromInt32(m_KEYSZ) - libc.Uint64FromInt32(m_IVSZ)
  2923. }
  2924. func __rs_stir(tls *libc.TLS) {
  2925. bp := tls.Alloc(48)
  2926. defer tls.Free(48)
  2927. var _ /* rekey_fuzz at bp+40 */ Tuint32_t
  2928. var _ /* rnd at bp+0 */ [40]uint8
  2929. *(*Tuint32_t)(unsafe.Pointer(bp + 40)) = uint32(0)
  2930. if libc.Xgetentropy(tls, bp, uint64(40)) == -int32(1) {
  2931. libc.Xraise(tls, int32(m_SIGKILL))
  2932. }
  2933. if !(_rs != 0) {
  2934. __rs_init(tls, bp, uint64(40))
  2935. } else {
  2936. __rs_rekey(tls, bp, uint64(40))
  2937. }
  2938. Xexplicit_bzero(tls, bp, uint64(40)) /* discard source seed */
  2939. /* invalidate rs_buf */
  2940. (*T_rs)(unsafe.Pointer(_rs)).Frs_have = uint64(0)
  2941. libc.Xmemset(tls, _rsx+64, 0, uint64(1024))
  2942. /* rekey interval should not be predictable */
  2943. _chacha_encrypt_bytes(tls, _rsx, bp+40, bp+40, uint32(4))
  2944. (*T_rs)(unsafe.Pointer(_rs)).Frs_count = uint64(libc.Uint32FromInt32(libc.Int32FromInt32(1024)*libc.Int32FromInt32(1024)) + *(*Tuint32_t)(unsafe.Pointer(bp + 40))%libc.Uint32FromInt32(libc.Int32FromInt32(1024)*libc.Int32FromInt32(1024)))
  2945. }
  2946. func __rs_stir_if_needed(tls *libc.TLS, len1 Tsize_t) {
  2947. __rs_forkdetect(tls)
  2948. if !(_rs != 0) || (*T_rs)(unsafe.Pointer(_rs)).Frs_count <= len1 {
  2949. __rs_stir(tls)
  2950. }
  2951. if (*T_rs)(unsafe.Pointer(_rs)).Frs_count <= len1 {
  2952. (*T_rs)(unsafe.Pointer(_rs)).Frs_count = uint64(0)
  2953. } else {
  2954. *(*Tsize_t)(unsafe.Pointer(_rs + 8)) -= len1
  2955. }
  2956. }
  2957. func __rs_random_buf(tls *libc.TLS, _buf uintptr, n Tsize_t) {
  2958. var buf, keystream uintptr
  2959. var m Tsize_t
  2960. var v1 uint64
  2961. _, _, _, _ = buf, keystream, m, v1
  2962. buf = _buf
  2963. __rs_stir_if_needed(tls, n)
  2964. for n > uint64(0) {
  2965. if (*T_rs)(unsafe.Pointer(_rs)).Frs_have > uint64(0) {
  2966. if n < (*T_rs)(unsafe.Pointer(_rs)).Frs_have {
  2967. v1 = n
  2968. } else {
  2969. v1 = (*T_rs)(unsafe.Pointer(_rs)).Frs_have
  2970. }
  2971. m = v1
  2972. keystream = _rsx + 64 + uintptr(1024) - uintptr((*T_rs)(unsafe.Pointer(_rs)).Frs_have)
  2973. libc.Xmemcpy(tls, buf, keystream, m)
  2974. libc.Xmemset(tls, keystream, 0, m)
  2975. buf += uintptr(m)
  2976. n -= m
  2977. *(*Tsize_t)(unsafe.Pointer(_rs)) -= m
  2978. }
  2979. if (*T_rs)(unsafe.Pointer(_rs)).Frs_have == uint64(0) {
  2980. __rs_rekey(tls, libc.UintptrFromInt32(0), uint64(0))
  2981. }
  2982. }
  2983. }
  2984. func __rs_random_u32(tls *libc.TLS, val uintptr) {
  2985. var keystream uintptr
  2986. _ = keystream
  2987. __rs_stir_if_needed(tls, uint64(4))
  2988. if (*T_rs)(unsafe.Pointer(_rs)).Frs_have < uint64(4) {
  2989. __rs_rekey(tls, libc.UintptrFromInt32(0), uint64(0))
  2990. }
  2991. keystream = _rsx + 64 + uintptr(1024) - uintptr((*T_rs)(unsafe.Pointer(_rs)).Frs_have)
  2992. libc.Xmemcpy(tls, val, keystream, uint64(4))
  2993. libc.Xmemset(tls, keystream, 0, uint64(4))
  2994. *(*Tsize_t)(unsafe.Pointer(_rs)) -= uint64(4)
  2995. }
  2996. func Xarc4random_stir(tls *libc.TLS) {
  2997. libc.Xpthread_mutex_lock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2998. __rs_stir(tls)
  2999. libc.Xpthread_mutex_unlock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  3000. }
  3001. func Xarc4random_addrandom(tls *libc.TLS, dat uintptr, datlen int32) {
  3002. libc.Xpthread_mutex_lock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  3003. __rs_stir_if_needed(tls, libc.Uint64FromInt32(datlen))
  3004. __rs_rekey(tls, dat, libc.Uint64FromInt32(datlen))
  3005. libc.Xpthread_mutex_unlock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  3006. }
  3007. func Xarc4random(tls *libc.TLS) (r Tuint32_t) {
  3008. bp := tls.Alloc(16)
  3009. defer tls.Free(16)
  3010. var _ /* val at bp+0 */ Tuint32_t
  3011. libc.Xpthread_mutex_lock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  3012. __rs_random_u32(tls, bp)
  3013. libc.Xpthread_mutex_unlock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  3014. return *(*Tuint32_t)(unsafe.Pointer(bp))
  3015. }
  3016. func Xarc4random_buf(tls *libc.TLS, buf uintptr, n Tsize_t) {
  3017. libc.Xpthread_mutex_lock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  3018. __rs_random_buf(tls, buf, n)
  3019. libc.Xpthread_mutex_unlock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  3020. }
  3021. // C documentation
  3022. //
  3023. // /*
  3024. // * Calculate a uniformly distributed random number less than upper_bound
  3025. // * avoiding "modulo bias".
  3026. // *
  3027. // * Uniformity is achieved by generating new random numbers until the one
  3028. // * returned is outside the range [0, 2**32 % upper_bound). This
  3029. // * guarantees the selected random number will be inside
  3030. // * [2**32 % upper_bound, 2**32) which maps back to [0, upper_bound)
  3031. // * after reduction modulo upper_bound.
  3032. // */
  3033. func Xarc4random_uniform(tls *libc.TLS, upper_bound Tuint32_t) (r1 Tuint32_t) {
  3034. var min, r Tuint32_t
  3035. _, _ = min, r
  3036. if upper_bound < uint32(2) {
  3037. return uint32(0)
  3038. }
  3039. /* 2**32 % x == (2**32 - x) % x */
  3040. min = -upper_bound % upper_bound
  3041. /*
  3042. * This could theoretically loop forever but each retry has
  3043. * p > 0.5 (worst case, usually far better) of selecting a
  3044. * number inside the range we need, so it should rarely need
  3045. * to re-roll.
  3046. */
  3047. for {
  3048. r = Xarc4random(tls)
  3049. if r >= min {
  3050. break
  3051. }
  3052. goto _1
  3053. _1:
  3054. }
  3055. return r % upper_bound
  3056. }
  3057. const m_SEEK_CUR = 1
  3058. const m_SEEK_END = 2
  3059. const m_SEEK_SET = 0
  3060. const m_no_argument = 0
  3061. const m_optional_argument = 2
  3062. const m_required_argument = 1
  3063. type Toption = struct {
  3064. Fname uintptr
  3065. Fhas_arg int32
  3066. Fflag uintptr
  3067. Fval int32
  3068. }
  3069. func Xbsd_getopt(tls *libc.TLS, argc int32, argv uintptr, shortopts uintptr) (r int32) {
  3070. if Xoptreset == int32(1) {
  3071. Xoptreset = 0
  3072. libc.Xoptind = 0
  3073. }
  3074. /*
  3075. * Make sure we are using the system getopt() and not a possible
  3076. * overlay macro.
  3077. */
  3078. return libc.Xgetopt(tls, argc, argv, shortopts)
  3079. }
  3080. const m_DT_BLK = 6
  3081. const m_DT_CHR = 2
  3082. const m_DT_DIR = 4
  3083. const m_DT_FIFO = 1
  3084. const m_DT_LNK = 10
  3085. const m_DT_REG = 8
  3086. const m_DT_SOCK = 12
  3087. const m_DT_UNKNOWN = 0
  3088. const m_DT_WHT = 14
  3089. const m_INT_MAX1 = 2147483647
  3090. const m_OPEN_MAX = 256
  3091. const m_SYS_accept = 202
  3092. const m_SYS_accept4 = 242
  3093. const m_SYS_acct = 89
  3094. const m_SYS_add_key = 217
  3095. const m_SYS_adjtimex = 171
  3096. const m_SYS_arch_specific_syscall = 244
  3097. const m_SYS_bind = 200
  3098. const m_SYS_bpf = 280
  3099. const m_SYS_brk = 214
  3100. const m_SYS_cachestat = 451
  3101. const m_SYS_capget = 90
  3102. const m_SYS_capset = 91
  3103. const m_SYS_chdir = 49
  3104. const m_SYS_chroot = 51
  3105. const m_SYS_clock_adjtime = 266
  3106. const m_SYS_clock_getres = 114
  3107. const m_SYS_clock_gettime = 113
  3108. const m_SYS_clock_nanosleep = 115
  3109. const m_SYS_clock_settime = 112
  3110. const m_SYS_clone = 220
  3111. const m_SYS_clone3 = 435
  3112. const m_SYS_close = 57
  3113. const m_SYS_close_range = 436
  3114. const m_SYS_connect = 203
  3115. const m_SYS_copy_file_range = 285
  3116. const m_SYS_delete_module = 106
  3117. const m_SYS_dup = 23
  3118. const m_SYS_dup3 = 24
  3119. const m_SYS_epoll_create1 = 20
  3120. const m_SYS_epoll_ctl = 21
  3121. const m_SYS_epoll_pwait = 22
  3122. const m_SYS_epoll_pwait2 = 441
  3123. const m_SYS_eventfd2 = 19
  3124. const m_SYS_execve = 221
  3125. const m_SYS_execveat = 281
  3126. const m_SYS_exit = 93
  3127. const m_SYS_exit_group = 94
  3128. const m_SYS_faccessat = 48
  3129. const m_SYS_faccessat2 = 439
  3130. const m_SYS_fadvise64 = "__NR3264_fadvise64"
  3131. const m_SYS_fallocate = 47
  3132. const m_SYS_fanotify_init = 262
  3133. const m_SYS_fanotify_mark = 263
  3134. const m_SYS_fchdir = 50
  3135. const m_SYS_fchmod = 52
  3136. const m_SYS_fchmodat = 53
  3137. const m_SYS_fchmodat2 = 452
  3138. const m_SYS_fchown = 55
  3139. const m_SYS_fchownat = 54
  3140. const m_SYS_fcntl = "__NR3264_fcntl"
  3141. const m_SYS_fdatasync = 83
  3142. const m_SYS_fgetxattr = 10
  3143. const m_SYS_finit_module = 273
  3144. const m_SYS_flistxattr = 13
  3145. const m_SYS_flock = 32
  3146. const m_SYS_fremovexattr = 16
  3147. const m_SYS_fsconfig = 431
  3148. const m_SYS_fsetxattr = 7
  3149. const m_SYS_fsmount = 432
  3150. const m_SYS_fsopen = 430
  3151. const m_SYS_fspick = 433
  3152. const m_SYS_fstatfs = "__NR3264_fstatfs"
  3153. const m_SYS_fsync = 82
  3154. const m_SYS_ftruncate = "__NR3264_ftruncate"
  3155. const m_SYS_futex = 98
  3156. const m_SYS_futex_requeue = 456
  3157. const m_SYS_futex_wait = 455
  3158. const m_SYS_futex_waitv = 449
  3159. const m_SYS_futex_wake = 454
  3160. const m_SYS_get_mempolicy = 236
  3161. const m_SYS_get_robust_list = 100
  3162. const m_SYS_getcpu = 168
  3163. const m_SYS_getcwd = 17
  3164. const m_SYS_getdents64 = 61
  3165. const m_SYS_getegid = 177
  3166. const m_SYS_geteuid = 175
  3167. const m_SYS_getgid = 176
  3168. const m_SYS_getgroups = 158
  3169. const m_SYS_getitimer = 102
  3170. const m_SYS_getpeername = 205
  3171. const m_SYS_getpgid = 155
  3172. const m_SYS_getpid = 172
  3173. const m_SYS_getppid = 173
  3174. const m_SYS_getpriority = 141
  3175. const m_SYS_getrandom = 278
  3176. const m_SYS_getresgid = 150
  3177. const m_SYS_getresuid = 148
  3178. const m_SYS_getrusage = 165
  3179. const m_SYS_getsid = 156
  3180. const m_SYS_getsockname = 204
  3181. const m_SYS_getsockopt = 209
  3182. const m_SYS_gettid = 178
  3183. const m_SYS_gettimeofday = 169
  3184. const m_SYS_getuid = 174
  3185. const m_SYS_getxattr = 8
  3186. const m_SYS_init_module = 105
  3187. const m_SYS_inotify_add_watch = 27
  3188. const m_SYS_inotify_init1 = 26
  3189. const m_SYS_inotify_rm_watch = 28
  3190. const m_SYS_io_cancel = 3
  3191. const m_SYS_io_destroy = 1
  3192. const m_SYS_io_getevents = 4
  3193. const m_SYS_io_pgetevents = 292
  3194. const m_SYS_io_setup = 0
  3195. const m_SYS_io_submit = 2
  3196. const m_SYS_io_uring_enter = 426
  3197. const m_SYS_io_uring_register = 427
  3198. const m_SYS_io_uring_setup = 425
  3199. const m_SYS_ioctl = 29
  3200. const m_SYS_ioprio_get = 31
  3201. const m_SYS_ioprio_set = 30
  3202. const m_SYS_kcmp = 272
  3203. const m_SYS_kexec_file_load = 294
  3204. const m_SYS_kexec_load = 104
  3205. const m_SYS_keyctl = 219
  3206. const m_SYS_kill = 129
  3207. const m_SYS_landlock_add_rule = 445
  3208. const m_SYS_landlock_create_ruleset = 444
  3209. const m_SYS_landlock_restrict_self = 446
  3210. const m_SYS_lgetxattr = 9
  3211. const m_SYS_linkat = 37
  3212. const m_SYS_listen = 201
  3213. const m_SYS_listxattr = 11
  3214. const m_SYS_llistxattr = 12
  3215. const m_SYS_lookup_dcookie = 18
  3216. const m_SYS_lremovexattr = 15
  3217. const m_SYS_lseek = "__NR3264_lseek"
  3218. const m_SYS_lsetxattr = 6
  3219. const m_SYS_madvise = 233
  3220. const m_SYS_map_shadow_stack = 453
  3221. const m_SYS_mbind = 235
  3222. const m_SYS_membarrier = 283
  3223. const m_SYS_memfd_create = 279
  3224. const m_SYS_migrate_pages = 238
  3225. const m_SYS_mincore = 232
  3226. const m_SYS_mkdirat = 34
  3227. const m_SYS_mknodat = 33
  3228. const m_SYS_mlock = 228
  3229. const m_SYS_mlock2 = 284
  3230. const m_SYS_mlockall = 230
  3231. const m_SYS_mmap = "__NR3264_mmap"
  3232. const m_SYS_mount = 40
  3233. const m_SYS_mount_setattr = 442
  3234. const m_SYS_move_mount = 429
  3235. const m_SYS_move_pages = 239
  3236. const m_SYS_mprotect = 226
  3237. const m_SYS_mq_getsetattr = 185
  3238. const m_SYS_mq_notify = 184
  3239. const m_SYS_mq_open = 180
  3240. const m_SYS_mq_timedreceive = 183
  3241. const m_SYS_mq_timedsend = 182
  3242. const m_SYS_mq_unlink = 181
  3243. const m_SYS_mremap = 216
  3244. const m_SYS_msgctl = 187
  3245. const m_SYS_msgget = 186
  3246. const m_SYS_msgrcv = 188
  3247. const m_SYS_msgsnd = 189
  3248. const m_SYS_msync = 227
  3249. const m_SYS_munlock = 229
  3250. const m_SYS_munlockall = 231
  3251. const m_SYS_munmap = 215
  3252. const m_SYS_name_to_handle_at = 264
  3253. const m_SYS_nanosleep = 101
  3254. const m_SYS_nfsservctl = 42
  3255. const m_SYS_open_by_handle_at = 265
  3256. const m_SYS_open_tree = 428
  3257. const m_SYS_openat = 56
  3258. const m_SYS_openat2 = 437
  3259. const m_SYS_perf_event_open = 241
  3260. const m_SYS_personality = 92
  3261. const m_SYS_pidfd_getfd = 438
  3262. const m_SYS_pidfd_open = 434
  3263. const m_SYS_pidfd_send_signal = 424
  3264. const m_SYS_pipe2 = 59
  3265. const m_SYS_pivot_root = 41
  3266. const m_SYS_pkey_alloc = 289
  3267. const m_SYS_pkey_free = 290
  3268. const m_SYS_pkey_mprotect = 288
  3269. const m_SYS_ppoll = 73
  3270. const m_SYS_prctl = 167
  3271. const m_SYS_pread64 = 67
  3272. const m_SYS_preadv = 69
  3273. const m_SYS_preadv2 = 286
  3274. const m_SYS_prlimit64 = 261
  3275. const m_SYS_process_madvise = 440
  3276. const m_SYS_process_mrelease = 448
  3277. const m_SYS_process_vm_readv = 270
  3278. const m_SYS_process_vm_writev = 271
  3279. const m_SYS_pselect6 = 72
  3280. const m_SYS_ptrace = 117
  3281. const m_SYS_pwrite64 = 68
  3282. const m_SYS_pwritev = 70
  3283. const m_SYS_pwritev2 = 287
  3284. const m_SYS_quotactl = 60
  3285. const m_SYS_quotactl_fd = 443
  3286. const m_SYS_read = 63
  3287. const m_SYS_readahead = 213
  3288. const m_SYS_readlinkat = 78
  3289. const m_SYS_readv = 65
  3290. const m_SYS_reboot = 142
  3291. const m_SYS_recvfrom = 207
  3292. const m_SYS_recvmmsg = 243
  3293. const m_SYS_recvmsg = 212
  3294. const m_SYS_remap_file_pages = 234
  3295. const m_SYS_removexattr = 14
  3296. const m_SYS_renameat2 = 276
  3297. const m_SYS_request_key = 218
  3298. const m_SYS_restart_syscall = 128
  3299. const m_SYS_rseq = 293
  3300. const m_SYS_rt_sigaction = 134
  3301. const m_SYS_rt_sigpending = 136
  3302. const m_SYS_rt_sigprocmask = 135
  3303. const m_SYS_rt_sigqueueinfo = 138
  3304. const m_SYS_rt_sigreturn = 139
  3305. const m_SYS_rt_sigsuspend = 133
  3306. const m_SYS_rt_sigtimedwait = 137
  3307. const m_SYS_rt_tgsigqueueinfo = 240
  3308. const m_SYS_sched_get_priority_max = 125
  3309. const m_SYS_sched_get_priority_min = 126
  3310. const m_SYS_sched_getaffinity = 123
  3311. const m_SYS_sched_getattr = 275
  3312. const m_SYS_sched_getparam = 121
  3313. const m_SYS_sched_getscheduler = 120
  3314. const m_SYS_sched_rr_get_interval = 127
  3315. const m_SYS_sched_setaffinity = 122
  3316. const m_SYS_sched_setattr = 274
  3317. const m_SYS_sched_setparam = 118
  3318. const m_SYS_sched_setscheduler = 119
  3319. const m_SYS_sched_yield = 124
  3320. const m_SYS_seccomp = 277
  3321. const m_SYS_semctl = 191
  3322. const m_SYS_semget = 190
  3323. const m_SYS_semop = 193
  3324. const m_SYS_semtimedop = 192
  3325. const m_SYS_sendfile = "__NR3264_sendfile"
  3326. const m_SYS_sendmmsg = 269
  3327. const m_SYS_sendmsg = 211
  3328. const m_SYS_sendto = 206
  3329. const m_SYS_set_mempolicy = 237
  3330. const m_SYS_set_mempolicy_home_node = 450
  3331. const m_SYS_set_robust_list = 99
  3332. const m_SYS_set_tid_address = 96
  3333. const m_SYS_setdomainname = 162
  3334. const m_SYS_setfsgid = 152
  3335. const m_SYS_setfsuid = 151
  3336. const m_SYS_setgid = 144
  3337. const m_SYS_setgroups = 159
  3338. const m_SYS_sethostname = 161
  3339. const m_SYS_setitimer = 103
  3340. const m_SYS_setns = 268
  3341. const m_SYS_setpgid = 154
  3342. const m_SYS_setpriority = 140
  3343. const m_SYS_setregid = 143
  3344. const m_SYS_setresgid = 149
  3345. const m_SYS_setresuid = 147
  3346. const m_SYS_setreuid = 145
  3347. const m_SYS_setsid = 157
  3348. const m_SYS_setsockopt = 208
  3349. const m_SYS_settimeofday = 170
  3350. const m_SYS_setuid = 146
  3351. const m_SYS_setxattr = 5
  3352. const m_SYS_shmat = 196
  3353. const m_SYS_shmctl = 195
  3354. const m_SYS_shmdt = 197
  3355. const m_SYS_shmget = 194
  3356. const m_SYS_shutdown = 210
  3357. const m_SYS_sigaltstack = 132
  3358. const m_SYS_signalfd4 = 74
  3359. const m_SYS_socket = 198
  3360. const m_SYS_socketpair = 199
  3361. const m_SYS_splice = 76
  3362. const m_SYS_statfs = "__NR3264_statfs"
  3363. const m_SYS_statx = 291
  3364. const m_SYS_swapoff = 225
  3365. const m_SYS_swapon = 224
  3366. const m_SYS_symlinkat = 36
  3367. const m_SYS_sync = 81
  3368. const m_SYS_sync_file_range = 84
  3369. const m_SYS_syncfs = 267
  3370. const m_SYS_sysinfo = 179
  3371. const m_SYS_syslog = 116
  3372. const m_SYS_tee = 77
  3373. const m_SYS_tgkill = 131
  3374. const m_SYS_timer_create = 107
  3375. const m_SYS_timer_delete = 111
  3376. const m_SYS_timer_getoverrun = 109
  3377. const m_SYS_timer_gettime = 108
  3378. const m_SYS_timer_settime = 110
  3379. const m_SYS_timerfd_create = 85
  3380. const m_SYS_timerfd_gettime = 87
  3381. const m_SYS_timerfd_settime = 86
  3382. const m_SYS_times = 153
  3383. const m_SYS_tkill = 130
  3384. const m_SYS_truncate = "__NR3264_truncate"
  3385. const m_SYS_umask = 166
  3386. const m_SYS_umount2 = 39
  3387. const m_SYS_uname = 160
  3388. const m_SYS_unlinkat = 35
  3389. const m_SYS_unshare = 97
  3390. const m_SYS_userfaultfd = 282
  3391. const m_SYS_utimensat = 88
  3392. const m_SYS_vhangup = 58
  3393. const m_SYS_vmsplice = 75
  3394. const m_SYS_wait4 = 260
  3395. const m_SYS_waitid = 95
  3396. const m_SYS_write = 64
  3397. const m_SYS_writev = 66
  3398. const m_UINT_MAX1 = 4294967295
  3399. const m___NR3264_fadvise64 = 223
  3400. const m___NR3264_fcntl = 25
  3401. const m___NR3264_fstatfs = 44
  3402. const m___NR3264_ftruncate = 46
  3403. const m___NR3264_lseek = 62
  3404. const m___NR3264_mmap = 222
  3405. const m___NR3264_sendfile = 71
  3406. const m___NR3264_statfs = 43
  3407. const m___NR3264_truncate = 45
  3408. const m___NR_accept = 202
  3409. const m___NR_accept4 = 242
  3410. const m___NR_acct = 89
  3411. const m___NR_add_key = 217
  3412. const m___NR_adjtimex = 171
  3413. const m___NR_arch_specific_syscall = 244
  3414. const m___NR_bind = 200
  3415. const m___NR_bpf = 280
  3416. const m___NR_brk = 214
  3417. const m___NR_cachestat = 451
  3418. const m___NR_capget = 90
  3419. const m___NR_capset = 91
  3420. const m___NR_chdir = 49
  3421. const m___NR_chroot = 51
  3422. const m___NR_clock_adjtime = 266
  3423. const m___NR_clock_getres = 114
  3424. const m___NR_clock_gettime = 113
  3425. const m___NR_clock_nanosleep = 115
  3426. const m___NR_clock_settime = 112
  3427. const m___NR_clone = 220
  3428. const m___NR_clone3 = 435
  3429. const m___NR_close = 57
  3430. const m___NR_close_range = 436
  3431. const m___NR_connect = 203
  3432. const m___NR_copy_file_range = 285
  3433. const m___NR_delete_module = 106
  3434. const m___NR_dup = 23
  3435. const m___NR_dup3 = 24
  3436. const m___NR_epoll_create1 = 20
  3437. const m___NR_epoll_ctl = 21
  3438. const m___NR_epoll_pwait = 22
  3439. const m___NR_epoll_pwait2 = 441
  3440. const m___NR_eventfd2 = 19
  3441. const m___NR_execve = 221
  3442. const m___NR_execveat = 281
  3443. const m___NR_exit = 93
  3444. const m___NR_exit_group = 94
  3445. const m___NR_faccessat = 48
  3446. const m___NR_faccessat2 = 439
  3447. const m___NR_fadvise64 = "__NR3264_fadvise64"
  3448. const m___NR_fallocate = 47
  3449. const m___NR_fanotify_init = 262
  3450. const m___NR_fanotify_mark = 263
  3451. const m___NR_fchdir = 50
  3452. const m___NR_fchmod = 52
  3453. const m___NR_fchmodat = 53
  3454. const m___NR_fchmodat2 = 452
  3455. const m___NR_fchown = 55
  3456. const m___NR_fchownat = 54
  3457. const m___NR_fcntl = "__NR3264_fcntl"
  3458. const m___NR_fdatasync = 83
  3459. const m___NR_fgetxattr = 10
  3460. const m___NR_finit_module = 273
  3461. const m___NR_flistxattr = 13
  3462. const m___NR_flock = 32
  3463. const m___NR_fremovexattr = 16
  3464. const m___NR_fsconfig = 431
  3465. const m___NR_fsetxattr = 7
  3466. const m___NR_fsmount = 432
  3467. const m___NR_fsopen = 430
  3468. const m___NR_fspick = 433
  3469. const m___NR_fstatfs = "__NR3264_fstatfs"
  3470. const m___NR_fsync = 82
  3471. const m___NR_ftruncate = "__NR3264_ftruncate"
  3472. const m___NR_futex = 98
  3473. const m___NR_futex_requeue = 456
  3474. const m___NR_futex_wait = 455
  3475. const m___NR_futex_waitv = 449
  3476. const m___NR_futex_wake = 454
  3477. const m___NR_get_mempolicy = 236
  3478. const m___NR_get_robust_list = 100
  3479. const m___NR_getcpu = 168
  3480. const m___NR_getcwd = 17
  3481. const m___NR_getdents64 = 61
  3482. const m___NR_getegid = 177
  3483. const m___NR_geteuid = 175
  3484. const m___NR_getgid = 176
  3485. const m___NR_getgroups = 158
  3486. const m___NR_getitimer = 102
  3487. const m___NR_getpeername = 205
  3488. const m___NR_getpgid = 155
  3489. const m___NR_getpid = 172
  3490. const m___NR_getppid = 173
  3491. const m___NR_getpriority = 141
  3492. const m___NR_getrandom = 278
  3493. const m___NR_getresgid = 150
  3494. const m___NR_getresuid = 148
  3495. const m___NR_getrusage = 165
  3496. const m___NR_getsid = 156
  3497. const m___NR_getsockname = 204
  3498. const m___NR_getsockopt = 209
  3499. const m___NR_gettid = 178
  3500. const m___NR_gettimeofday = 169
  3501. const m___NR_getuid = 174
  3502. const m___NR_getxattr = 8
  3503. const m___NR_init_module = 105
  3504. const m___NR_inotify_add_watch = 27
  3505. const m___NR_inotify_init1 = 26
  3506. const m___NR_inotify_rm_watch = 28
  3507. const m___NR_io_cancel = 3
  3508. const m___NR_io_destroy = 1
  3509. const m___NR_io_getevents = 4
  3510. const m___NR_io_pgetevents = 292
  3511. const m___NR_io_setup = 0
  3512. const m___NR_io_submit = 2
  3513. const m___NR_io_uring_enter = 426
  3514. const m___NR_io_uring_register = 427
  3515. const m___NR_io_uring_setup = 425
  3516. const m___NR_ioctl = 29
  3517. const m___NR_ioprio_get = 31
  3518. const m___NR_ioprio_set = 30
  3519. const m___NR_kcmp = 272
  3520. const m___NR_kexec_file_load = 294
  3521. const m___NR_kexec_load = 104
  3522. const m___NR_keyctl = 219
  3523. const m___NR_kill = 129
  3524. const m___NR_landlock_add_rule = 445
  3525. const m___NR_landlock_create_ruleset = 444
  3526. const m___NR_landlock_restrict_self = 446
  3527. const m___NR_lgetxattr = 9
  3528. const m___NR_linkat = 37
  3529. const m___NR_listen = 201
  3530. const m___NR_listxattr = 11
  3531. const m___NR_llistxattr = 12
  3532. const m___NR_lookup_dcookie = 18
  3533. const m___NR_lremovexattr = 15
  3534. const m___NR_lseek = "__NR3264_lseek"
  3535. const m___NR_lsetxattr = 6
  3536. const m___NR_madvise = 233
  3537. const m___NR_map_shadow_stack = 453
  3538. const m___NR_mbind = 235
  3539. const m___NR_membarrier = 283
  3540. const m___NR_memfd_create = 279
  3541. const m___NR_migrate_pages = 238
  3542. const m___NR_mincore = 232
  3543. const m___NR_mkdirat = 34
  3544. const m___NR_mknodat = 33
  3545. const m___NR_mlock = 228
  3546. const m___NR_mlock2 = 284
  3547. const m___NR_mlockall = 230
  3548. const m___NR_mmap = "__NR3264_mmap"
  3549. const m___NR_mount = 40
  3550. const m___NR_mount_setattr = 442
  3551. const m___NR_move_mount = 429
  3552. const m___NR_move_pages = 239
  3553. const m___NR_mprotect = 226
  3554. const m___NR_mq_getsetattr = 185
  3555. const m___NR_mq_notify = 184
  3556. const m___NR_mq_open = 180
  3557. const m___NR_mq_timedreceive = 183
  3558. const m___NR_mq_timedsend = 182
  3559. const m___NR_mq_unlink = 181
  3560. const m___NR_mremap = 216
  3561. const m___NR_msgctl = 187
  3562. const m___NR_msgget = 186
  3563. const m___NR_msgrcv = 188
  3564. const m___NR_msgsnd = 189
  3565. const m___NR_msync = 227
  3566. const m___NR_munlock = 229
  3567. const m___NR_munlockall = 231
  3568. const m___NR_munmap = 215
  3569. const m___NR_name_to_handle_at = 264
  3570. const m___NR_nanosleep = 101
  3571. const m___NR_nfsservctl = 42
  3572. const m___NR_open_by_handle_at = 265
  3573. const m___NR_open_tree = 428
  3574. const m___NR_openat = 56
  3575. const m___NR_openat2 = 437
  3576. const m___NR_perf_event_open = 241
  3577. const m___NR_personality = 92
  3578. const m___NR_pidfd_getfd = 438
  3579. const m___NR_pidfd_open = 434
  3580. const m___NR_pidfd_send_signal = 424
  3581. const m___NR_pipe2 = 59
  3582. const m___NR_pivot_root = 41
  3583. const m___NR_pkey_alloc = 289
  3584. const m___NR_pkey_free = 290
  3585. const m___NR_pkey_mprotect = 288
  3586. const m___NR_ppoll = 73
  3587. const m___NR_prctl = 167
  3588. const m___NR_pread64 = 67
  3589. const m___NR_preadv = 69
  3590. const m___NR_preadv2 = 286
  3591. const m___NR_prlimit64 = 261
  3592. const m___NR_process_madvise = 440
  3593. const m___NR_process_mrelease = 448
  3594. const m___NR_process_vm_readv = 270
  3595. const m___NR_process_vm_writev = 271
  3596. const m___NR_pselect6 = 72
  3597. const m___NR_ptrace = 117
  3598. const m___NR_pwrite64 = 68
  3599. const m___NR_pwritev = 70
  3600. const m___NR_pwritev2 = 287
  3601. const m___NR_quotactl = 60
  3602. const m___NR_quotactl_fd = 443
  3603. const m___NR_read = 63
  3604. const m___NR_readahead = 213
  3605. const m___NR_readlinkat = 78
  3606. const m___NR_readv = 65
  3607. const m___NR_reboot = 142
  3608. const m___NR_recvfrom = 207
  3609. const m___NR_recvmmsg = 243
  3610. const m___NR_recvmsg = 212
  3611. const m___NR_remap_file_pages = 234
  3612. const m___NR_removexattr = 14
  3613. const m___NR_renameat2 = 276
  3614. const m___NR_request_key = 218
  3615. const m___NR_restart_syscall = 128
  3616. const m___NR_rseq = 293
  3617. const m___NR_rt_sigaction = 134
  3618. const m___NR_rt_sigpending = 136
  3619. const m___NR_rt_sigprocmask = 135
  3620. const m___NR_rt_sigqueueinfo = 138
  3621. const m___NR_rt_sigreturn = 139
  3622. const m___NR_rt_sigsuspend = 133
  3623. const m___NR_rt_sigtimedwait = 137
  3624. const m___NR_rt_tgsigqueueinfo = 240
  3625. const m___NR_sched_get_priority_max = 125
  3626. const m___NR_sched_get_priority_min = 126
  3627. const m___NR_sched_getaffinity = 123
  3628. const m___NR_sched_getattr = 275
  3629. const m___NR_sched_getparam = 121
  3630. const m___NR_sched_getscheduler = 120
  3631. const m___NR_sched_rr_get_interval = 127
  3632. const m___NR_sched_setaffinity = 122
  3633. const m___NR_sched_setattr = 274
  3634. const m___NR_sched_setparam = 118
  3635. const m___NR_sched_setscheduler = 119
  3636. const m___NR_sched_yield = 124
  3637. const m___NR_seccomp = 277
  3638. const m___NR_semctl = 191
  3639. const m___NR_semget = 190
  3640. const m___NR_semop = 193
  3641. const m___NR_semtimedop = 192
  3642. const m___NR_sendfile = "__NR3264_sendfile"
  3643. const m___NR_sendmmsg = 269
  3644. const m___NR_sendmsg = 211
  3645. const m___NR_sendto = 206
  3646. const m___NR_set_mempolicy = 237
  3647. const m___NR_set_mempolicy_home_node = 450
  3648. const m___NR_set_robust_list = 99
  3649. const m___NR_set_tid_address = 96
  3650. const m___NR_setdomainname = 162
  3651. const m___NR_setfsgid = 152
  3652. const m___NR_setfsuid = 151
  3653. const m___NR_setgid = 144
  3654. const m___NR_setgroups = 159
  3655. const m___NR_sethostname = 161
  3656. const m___NR_setitimer = 103
  3657. const m___NR_setns = 268
  3658. const m___NR_setpgid = 154
  3659. const m___NR_setpriority = 140
  3660. const m___NR_setregid = 143
  3661. const m___NR_setresgid = 149
  3662. const m___NR_setresuid = 147
  3663. const m___NR_setreuid = 145
  3664. const m___NR_setsid = 157
  3665. const m___NR_setsockopt = 208
  3666. const m___NR_settimeofday = 170
  3667. const m___NR_setuid = 146
  3668. const m___NR_setxattr = 5
  3669. const m___NR_shmat = 196
  3670. const m___NR_shmctl = 195
  3671. const m___NR_shmdt = 197
  3672. const m___NR_shmget = 194
  3673. const m___NR_shutdown = 210
  3674. const m___NR_sigaltstack = 132
  3675. const m___NR_signalfd4 = 74
  3676. const m___NR_socket = 198
  3677. const m___NR_socketpair = 199
  3678. const m___NR_splice = 76
  3679. const m___NR_statfs = "__NR3264_statfs"
  3680. const m___NR_statx = 291
  3681. const m___NR_swapoff = 225
  3682. const m___NR_swapon = 224
  3683. const m___NR_symlinkat = 36
  3684. const m___NR_sync = 81
  3685. const m___NR_sync_file_range = 84
  3686. const m___NR_syncfs = 267
  3687. const m___NR_sysinfo = 179
  3688. const m___NR_syslog = 116
  3689. const m___NR_tee = 77
  3690. const m___NR_tgkill = 131
  3691. const m___NR_timer_create = 107
  3692. const m___NR_timer_delete = 111
  3693. const m___NR_timer_getoverrun = 109
  3694. const m___NR_timer_gettime = 108
  3695. const m___NR_timer_settime = 110
  3696. const m___NR_timerfd_create = 85
  3697. const m___NR_timerfd_gettime = 87
  3698. const m___NR_timerfd_settime = 86
  3699. const m___NR_times = 153
  3700. const m___NR_tkill = 130
  3701. const m___NR_truncate = "__NR3264_truncate"
  3702. const m___NR_umask = 166
  3703. const m___NR_umount2 = 39
  3704. const m___NR_uname = 160
  3705. const m___NR_unlinkat = 35
  3706. const m___NR_unshare = 97
  3707. const m___NR_userfaultfd = 282
  3708. const m___NR_utimensat = 88
  3709. const m___NR_vhangup = 58
  3710. const m___NR_vmsplice = 75
  3711. const m___NR_wait4 = 260
  3712. const m___NR_waitid = 95
  3713. const m___NR_write = 64
  3714. const m___NR_writev = 66
  3715. const m_d_fileno = "d_ino"
  3716. type Tdirent = struct {
  3717. Fd_ino Tino_t
  3718. Fd_off Toff_t
  3719. Fd_reclen uint16
  3720. Fd_type uint8
  3721. Fd_name [256]int8
  3722. }
  3723. func _closefrom_close(tls *libc.TLS, fd int32) {
  3724. libc.Xclose(tls, fd)
  3725. }
  3726. func _sys_close_range(tls *libc.TLS, fd uint32, max_fd uint32, flags uint32) (r int32) {
  3727. bp := tls.Alloc(32)
  3728. defer tls.Free(32)
  3729. return int32(libc.Xsyscall(tls, int64(m_SYS_close_range), libc.VaList(bp+8, fd, max_fd, flags)))
  3730. }
  3731. // C documentation
  3732. //
  3733. // /*
  3734. // * Close all file descriptors greater than or equal to lowfd.
  3735. // * This is the expensive (fallback) method.
  3736. // */
  3737. func _closefrom_fallback(tls *libc.TLS, lowfd int32) {
  3738. var fd, maxfd int64
  3739. _, _ = fd, maxfd
  3740. /*
  3741. * Fall back on sysconf(_SC_OPEN_MAX) or getdtablesize(). This is
  3742. * equivalent to checking the RLIMIT_NOFILE soft limit. It is
  3743. * possible for there to be open file descriptors past this limit
  3744. * but there is not much we can do about that since the hard limit
  3745. * may be RLIM_INFINITY (LLONG_MAX or ULLONG_MAX on modern systems).
  3746. */
  3747. maxfd = libc.Xsysconf(tls, int32(m__SC_OPEN_MAX))
  3748. if maxfd < int64(m_OPEN_MAX) {
  3749. maxfd = int64(m_OPEN_MAX)
  3750. }
  3751. /* Make sure we did not get RLIM_INFINITY as the upper limit. */
  3752. if maxfd > int64(m_INT_MAX1) {
  3753. maxfd = int64(m_INT_MAX1)
  3754. }
  3755. fd = int64(lowfd)
  3756. for {
  3757. if !(fd < maxfd) {
  3758. break
  3759. }
  3760. _closefrom_close(tls, int32(fd))
  3761. goto _1
  3762. _1:
  3763. ;
  3764. fd++
  3765. }
  3766. }
  3767. func _closefrom_procfs(tls *libc.TLS, lowfd int32) (r int32) {
  3768. bp := tls.Alloc(16)
  3769. defer tls.Free(16)
  3770. var dent, dirp, fd_array, path, ptr, v1 uintptr
  3771. var fd, fd_array_size, fd_array_used, i, ret, v2 int32
  3772. var _ /* errstr at bp+0 */ uintptr
  3773. _, _, _, _, _, _, _, _, _, _, _, _ = dent, dirp, fd, fd_array, fd_array_size, fd_array_used, i, path, ptr, ret, v1, v2
  3774. fd_array = libc.UintptrFromInt32(0)
  3775. fd_array_used = 0
  3776. fd_array_size = 0
  3777. ret = 0
  3778. /* Use /proc/self/fd (or /dev/fd on macOS) if it exists. */
  3779. path = __ccgo_ts
  3780. dirp = libc.Xopendir(tls, path)
  3781. if dirp == libc.UintptrFromInt32(0) {
  3782. return -int32(1)
  3783. }
  3784. for {
  3785. v1 = libc.Xreaddir(tls, dirp)
  3786. dent = v1
  3787. if !(v1 != libc.UintptrFromInt32(0)) {
  3788. break
  3789. }
  3790. fd = int32(Xstrtonum(tls, dent+19, int64(lowfd), int64(m_INT_MAX1), bp))
  3791. if *(*uintptr)(unsafe.Pointer(bp)) != libc.UintptrFromInt32(0) || fd == libc.Xdirfd(tls, dirp) {
  3792. continue
  3793. }
  3794. if fd_array_used >= fd_array_size {
  3795. if fd_array_size > 0 {
  3796. fd_array_size *= int32(2)
  3797. } else {
  3798. fd_array_size = int32(32)
  3799. }
  3800. ptr = Xreallocarray(tls, fd_array, libc.Uint64FromInt32(fd_array_size), uint64(4))
  3801. if ptr == libc.UintptrFromInt32(0) {
  3802. ret = -int32(1)
  3803. break
  3804. }
  3805. fd_array = ptr
  3806. }
  3807. v2 = fd_array_used
  3808. fd_array_used++
  3809. *(*int32)(unsafe.Pointer(fd_array + uintptr(v2)*4)) = fd
  3810. }
  3811. i = 0
  3812. for {
  3813. if !(i < fd_array_used) {
  3814. break
  3815. }
  3816. _closefrom_close(tls, *(*int32)(unsafe.Pointer(fd_array + uintptr(i)*4)))
  3817. goto _3
  3818. _3:
  3819. ;
  3820. i++
  3821. }
  3822. libc.Xfree(tls, fd_array)
  3823. libc.Xclosedir(tls, dirp)
  3824. return ret
  3825. }
  3826. // C documentation
  3827. //
  3828. // /*
  3829. // * Close all file descriptors greater than or equal to lowfd.
  3830. // * We try the fast way first, falling back on the slow method.
  3831. // */
  3832. func Xclosefrom(tls *libc.TLS, lowfd int32) {
  3833. if lowfd < 0 {
  3834. lowfd = 0
  3835. }
  3836. /* Try the fast methods first, if possible. */
  3837. if _sys_close_range(tls, libc.Uint32FromInt32(lowfd), uint32(0xffffffff), uint32(0)) == 0 {
  3838. return
  3839. }
  3840. if _closefrom_procfs(tls, lowfd) != -int32(1) {
  3841. return
  3842. }
  3843. /* Do things the slow way. */
  3844. _closefrom_fallback(tls, lowfd)
  3845. }
  3846. /*
  3847. * Copyright © 2004-2024 Guillem Jover <guillem@hadrons.org>
  3848. *
  3849. * Redistribution and use in source and binary forms, with or without
  3850. * modification, are permitted provided that the following conditions
  3851. * are met:
  3852. * 1. Redistributions of source code must retain the above copyright
  3853. * notice, this list of conditions and the following disclaimer.
  3854. * 2. Redistributions in binary form must reproduce the above copyright
  3855. * notice, this list of conditions and the following disclaimer in the
  3856. * documentation and/or other materials provided with the distribution.
  3857. * 3. The name of the author may not be used to endorse or promote products
  3858. * derived from this software without specific prior written permission.
  3859. *
  3860. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  3861. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  3862. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  3863. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  3864. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  3865. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  3866. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  3867. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  3868. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  3869. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  3870. */
  3871. func Xvwarnc(tls *libc.TLS, code int32, format uintptr, ap Tva_list) {
  3872. bp := tls.Alloc(16)
  3873. defer tls.Free(16)
  3874. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+14, libc.VaList(bp+8, Xgetprogname(tls)))
  3875. if format != 0 {
  3876. libc.Xvfprintf(tls, libc.Xstderr, format, ap)
  3877. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+19, 0)
  3878. }
  3879. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+22, libc.VaList(bp+8, libc.Xstrerror(tls, code)))
  3880. }
  3881. func Xwarnc(tls *libc.TLS, code int32, format uintptr, va uintptr) {
  3882. var ap Tva_list
  3883. _ = ap
  3884. ap = va
  3885. Xvwarnc(tls, code, format, ap)
  3886. _ = ap
  3887. }
  3888. func Xverrc(tls *libc.TLS, status int32, code int32, format uintptr, ap Tva_list) {
  3889. bp := tls.Alloc(16)
  3890. defer tls.Free(16)
  3891. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+14, libc.VaList(bp+8, Xgetprogname(tls)))
  3892. if format != 0 {
  3893. libc.Xvfprintf(tls, libc.Xstderr, format, ap)
  3894. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+19, 0)
  3895. }
  3896. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+22, libc.VaList(bp+8, libc.Xstrerror(tls, code)))
  3897. libc.Xexit(tls, status)
  3898. }
  3899. func Xerrc(tls *libc.TLS, status int32, code int32, format uintptr, va uintptr) {
  3900. var ap Tva_list
  3901. _ = ap
  3902. ap = va
  3903. Xverrc(tls, status, code, format, ap)
  3904. _ = ap
  3905. }
  3906. const m_PRIX16 = "X"
  3907. const m_PRIX32 = "X"
  3908. const m_PRIX8 = "X"
  3909. const m_PRIXFAST16 = "X"
  3910. const m_PRIXFAST32 = "X"
  3911. const m_PRIXFAST8 = "X"
  3912. const m_PRIXLEAST16 = "X"
  3913. const m_PRIXLEAST32 = "X"
  3914. const m_PRIXLEAST8 = "X"
  3915. const m_PRId16 = "d"
  3916. const m_PRId32 = "d"
  3917. const m_PRId8 = "d"
  3918. const m_PRIdFAST16 = "d"
  3919. const m_PRIdFAST32 = "d"
  3920. const m_PRIdFAST8 = "d"
  3921. const m_PRIdLEAST16 = "d"
  3922. const m_PRIdLEAST32 = "d"
  3923. const m_PRIdLEAST8 = "d"
  3924. const m_PRIi16 = "i"
  3925. const m_PRIi32 = "i"
  3926. const m_PRIi8 = "i"
  3927. const m_PRIiFAST16 = "i"
  3928. const m_PRIiFAST32 = "i"
  3929. const m_PRIiFAST8 = "i"
  3930. const m_PRIiLEAST16 = "i"
  3931. const m_PRIiLEAST32 = "i"
  3932. const m_PRIiLEAST8 = "i"
  3933. const m_PRIo16 = "o"
  3934. const m_PRIo32 = "o"
  3935. const m_PRIo8 = "o"
  3936. const m_PRIoFAST16 = "o"
  3937. const m_PRIoFAST32 = "o"
  3938. const m_PRIoFAST8 = "o"
  3939. const m_PRIoLEAST16 = "o"
  3940. const m_PRIoLEAST32 = "o"
  3941. const m_PRIoLEAST8 = "o"
  3942. const m_PRIu16 = "u"
  3943. const m_PRIu32 = "u"
  3944. const m_PRIu8 = "u"
  3945. const m_PRIuFAST16 = "u"
  3946. const m_PRIuFAST32 = "u"
  3947. const m_PRIuFAST8 = "u"
  3948. const m_PRIuLEAST16 = "u"
  3949. const m_PRIuLEAST32 = "u"
  3950. const m_PRIuLEAST8 = "u"
  3951. const m_PRIx16 = "x"
  3952. const m_PRIx32 = "x"
  3953. const m_PRIx8 = "x"
  3954. const m_PRIxFAST16 = "x"
  3955. const m_PRIxFAST32 = "x"
  3956. const m_PRIxFAST8 = "x"
  3957. const m_PRIxLEAST16 = "x"
  3958. const m_PRIxLEAST32 = "x"
  3959. const m_PRIxLEAST8 = "x"
  3960. const m_SCNd16 = "hd"
  3961. const m_SCNd32 = "d"
  3962. const m_SCNd8 = "hhd"
  3963. const m_SCNdFAST16 = "d"
  3964. const m_SCNdFAST32 = "d"
  3965. const m_SCNdFAST8 = "hhd"
  3966. const m_SCNdLEAST16 = "hd"
  3967. const m_SCNdLEAST32 = "d"
  3968. const m_SCNdLEAST8 = "hhd"
  3969. const m_SCNi16 = "hi"
  3970. const m_SCNi32 = "i"
  3971. const m_SCNi8 = "hhi"
  3972. const m_SCNiFAST16 = "i"
  3973. const m_SCNiFAST32 = "i"
  3974. const m_SCNiFAST8 = "hhi"
  3975. const m_SCNiLEAST16 = "hi"
  3976. const m_SCNiLEAST32 = "i"
  3977. const m_SCNiLEAST8 = "hhi"
  3978. const m_SCNo16 = "ho"
  3979. const m_SCNo32 = "o"
  3980. const m_SCNo8 = "hho"
  3981. const m_SCNoFAST16 = "o"
  3982. const m_SCNoFAST32 = "o"
  3983. const m_SCNoFAST8 = "hho"
  3984. const m_SCNoLEAST16 = "ho"
  3985. const m_SCNoLEAST32 = "o"
  3986. const m_SCNoLEAST8 = "hho"
  3987. const m_SCNu16 = "hu"
  3988. const m_SCNu32 = "u"
  3989. const m_SCNu8 = "hhu"
  3990. const m_SCNuFAST16 = "u"
  3991. const m_SCNuFAST32 = "u"
  3992. const m_SCNuFAST8 = "hhu"
  3993. const m_SCNuLEAST16 = "hu"
  3994. const m_SCNuLEAST32 = "u"
  3995. const m_SCNuLEAST8 = "hhu"
  3996. const m_SCNx16 = "hx"
  3997. const m_SCNx32 = "x"
  3998. const m_SCNx8 = "hhx"
  3999. const m_SCNxFAST16 = "x"
  4000. const m_SCNxFAST32 = "x"
  4001. const m_SCNxFAST8 = "hhx"
  4002. const m_SCNxLEAST16 = "hx"
  4003. const m_SCNxLEAST32 = "x"
  4004. const m_SCNxLEAST8 = "hhx"
  4005. const m___PRI64 = "l"
  4006. const m___PRIPTR = "l"
  4007. type Timaxdiv_t = struct {
  4008. Fquot Tintmax_t
  4009. Frem Tintmax_t
  4010. }
  4011. /* Values for humanize_number(3)'s flags parameter. */
  4012. /* Values for humanize_number(3)'s scale parameter. */
  4013. /*
  4014. * fparseln() specific operation flags.
  4015. */
  4016. // C documentation
  4017. //
  4018. // /*
  4019. // * Convert an expression of the following forms to a uint64_t.
  4020. // * 1) A positive decimal number.
  4021. // * 2) A positive decimal number followed by a 'b' or 'B' (mult by 1).
  4022. // * 3) A positive decimal number followed by a 'k' or 'K' (mult by 1 << 10).
  4023. // * 4) A positive decimal number followed by a 'm' or 'M' (mult by 1 << 20).
  4024. // * 5) A positive decimal number followed by a 'g' or 'G' (mult by 1 << 30).
  4025. // * 6) A positive decimal number followed by a 't' or 'T' (mult by 1 << 40).
  4026. // * 7) A positive decimal number followed by a 'p' or 'P' (mult by 1 << 50).
  4027. // * 8) A positive decimal number followed by a 'e' or 'E' (mult by 1 << 60).
  4028. // */
  4029. func Xexpand_number(tls *libc.TLS, buf uintptr, num uintptr) (r int32) {
  4030. bp := tls.Alloc(16)
  4031. defer tls.Free(16)
  4032. var number Tuint64_t
  4033. var shift uint32
  4034. var _ /* endptr at bp+0 */ uintptr
  4035. _, _ = number, shift
  4036. number = libc.Xstrtoumax(tls, buf, bp, 0)
  4037. if *(*uintptr)(unsafe.Pointer(bp)) == buf {
  4038. /* No valid digits. */
  4039. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  4040. return -int32(1)
  4041. }
  4042. switch libc.Xtolower(tls, libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))) {
  4043. case int32('e'):
  4044. shift = uint32(60)
  4045. case int32('p'):
  4046. shift = uint32(50)
  4047. case int32('t'):
  4048. shift = uint32(40)
  4049. case int32('g'):
  4050. shift = uint32(30)
  4051. case int32('m'):
  4052. shift = uint32(20)
  4053. case int32('k'):
  4054. shift = uint32(10)
  4055. case int32('b'):
  4056. fallthrough
  4057. case int32('\000'): /* No unit. */
  4058. *(*Tuint64_t)(unsafe.Pointer(num)) = number
  4059. return 0
  4060. default:
  4061. /* Unrecognized unit. */
  4062. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  4063. return -int32(1)
  4064. }
  4065. if number<<shift>>shift != number {
  4066. /* Overflow */
  4067. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ERANGE)
  4068. return -int32(1)
  4069. }
  4070. *(*Tuint64_t)(unsafe.Pointer(num)) = number << shift
  4071. return 0
  4072. }
  4073. func X__explicit_bzero_hook(tls *libc.TLS, buf uintptr, len1 Tsize_t) {
  4074. }
  4075. func Xexplicit_bzero(tls *libc.TLS, buf uintptr, len1 Tsize_t) {
  4076. libc.Xmemset(tls, buf, 0, len1)
  4077. X__explicit_bzero_hook(tls, buf, len1)
  4078. }
  4079. const m_FILEBUF_POOL_ITEMS = 32
  4080. /*
  4081. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  4082. *
  4083. * Redistribution and use in source and binary forms, with or without
  4084. * modification, are permitted provided that the following conditions
  4085. * are met:
  4086. * 1. Redistributions of source code must retain the above copyright
  4087. * notice, this list of conditions and the following disclaimer.
  4088. * 2. Redistributions in binary form must reproduce the above copyright
  4089. * notice, this list of conditions and the following disclaimer in the
  4090. * documentation and/or other materials provided with the distribution.
  4091. * 3. The name of the author may not be used to endorse or promote products
  4092. * derived from this software without specific prior written permission.
  4093. *
  4094. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  4095. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  4096. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  4097. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  4098. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  4099. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  4100. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  4101. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  4102. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  4103. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  4104. */
  4105. /*
  4106. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  4107. *
  4108. * Redistribution and use in source and binary forms, with or without
  4109. * modification, are permitted provided that the following conditions
  4110. * are met:
  4111. * 1. Redistributions of source code must retain the above copyright
  4112. * notice, this list of conditions and the following disclaimer.
  4113. * 2. Redistributions in binary form must reproduce the above copyright
  4114. * notice, this list of conditions and the following disclaimer in the
  4115. * documentation and/or other materials provided with the distribution.
  4116. * 3. The name of the author may not be used to endorse or promote products
  4117. * derived from this software without specific prior written permission.
  4118. *
  4119. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  4120. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  4121. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  4122. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  4123. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  4124. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  4125. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  4126. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  4127. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  4128. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  4129. */
  4130. /* Clang expands this to 1 if an identifier is *not* reserved. */
  4131. /*
  4132. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  4133. * musl, try to handle this gracefully.
  4134. */
  4135. /* Copyright (C) 1992-2023 Free Software Foundation, Inc.
  4136. Copyright The GNU Toolchain Authors.
  4137. This file is part of the GNU C Library.
  4138. The GNU C Library is free software; you can redistribute it and/or
  4139. modify it under the terms of the GNU Lesser General Public
  4140. License as published by the Free Software Foundation; either
  4141. version 2.1 of the License, or (at your option) any later version.
  4142. The GNU C Library is distributed in the hope that it will be useful,
  4143. but WITHOUT ANY WARRANTY; without even the implied warranty of
  4144. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  4145. Lesser General Public License for more details.
  4146. You should have received a copy of the GNU Lesser General Public
  4147. License along with the GNU C Library; if not, see
  4148. <https://www.gnu.org/licenses/>. */
  4149. type Tfilebuf = struct {
  4150. Ffp uintptr
  4151. Fbuf uintptr
  4152. Flen1 Tsize_t
  4153. }
  4154. var _fb_pool [32]Tfilebuf
  4155. var _fb_pool_cur int32
  4156. func Xfgetln(tls *libc.TLS, stream uintptr, len1 uintptr) (r uintptr) {
  4157. var fb uintptr
  4158. var nread Tssize_t
  4159. _, _ = fb, nread
  4160. libc.Xflockfile(tls, stream)
  4161. /* Try to diminish the possibility of several fgetln() calls being
  4162. * used on different streams, by using a pool of buffers per file. */
  4163. fb = uintptr(unsafe.Pointer(&_fb_pool)) + uintptr(_fb_pool_cur)*24
  4164. if (*Tfilebuf)(unsafe.Pointer(fb)).Ffp != stream && (*Tfilebuf)(unsafe.Pointer(fb)).Ffp != libc.UintptrFromInt32(0) {
  4165. _fb_pool_cur++
  4166. _fb_pool_cur %= int32(m_FILEBUF_POOL_ITEMS)
  4167. fb = uintptr(unsafe.Pointer(&_fb_pool)) + uintptr(_fb_pool_cur)*24
  4168. }
  4169. (*Tfilebuf)(unsafe.Pointer(fb)).Ffp = stream
  4170. nread = libc.Xgetline(tls, fb+8, fb+16, stream)
  4171. libc.Xfunlockfile(tls, stream)
  4172. /* Note: the getdelim/getline API ensures nread != 0. */
  4173. if nread == int64(-int32(1)) {
  4174. *(*Tsize_t)(unsafe.Pointer(len1)) = uint64(0)
  4175. return libc.UintptrFromInt32(0)
  4176. } else {
  4177. *(*Tsize_t)(unsafe.Pointer(len1)) = libc.Uint64FromInt64(nread)
  4178. return (*Tfilebuf)(unsafe.Pointer(fb)).Fbuf
  4179. }
  4180. return r
  4181. }
  4182. var _libbsd_emit_link_warning_fgetln = [115]int8{'T', 'h', 'e', ' ', 'f', 'g', 'e', 't', 'l', 'n', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'c', 'a', 'n', 'n', 'o', 't', ' ', 'b', 'e', ' ', 's', 'a', 'f', 'e', 'l', 'y', ' ', 'p', 'o', 'r', 't', 'e', 'd', ',', ' ', 'u', 's', 'e', ' ', 'g', 'e', 't', 'l', 'i', 'n', 'e', '(', '3', ')', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', ',', ' ', 'a', 's', ' ', 'i', 't', ' ', 'i', 's', ' ', 's', 'u', 'p', 'p', 'o', 'r', 't', 'e', 'd', ' ', 'b', 'y', ' ', 'G', 'N', 'U', ' ', 'a', 'n', 'd', ' ', 'P', 'O', 'S', 'I', 'X', '.', '1', '-', '2', '0', '0', '8', '.'}
  4183. const m_FILEWBUF_INIT_LEN = 128
  4184. const m_FILEWBUF_POOL_ITEMS = 32
  4185. type Twint_t = uint32
  4186. type Twctype_t = uint64
  4187. type Tmbstate_t = struct {
  4188. F__opaque1 uint32
  4189. F__opaque2 uint32
  4190. }
  4191. type t__mbstate_t = Tmbstate_t
  4192. /*
  4193. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  4194. *
  4195. * Redistribution and use in source and binary forms, with or without
  4196. * modification, are permitted provided that the following conditions
  4197. * are met:
  4198. * 1. Redistributions of source code must retain the above copyright
  4199. * notice, this list of conditions and the following disclaimer.
  4200. * 2. Redistributions in binary form must reproduce the above copyright
  4201. * notice, this list of conditions and the following disclaimer in the
  4202. * documentation and/or other materials provided with the distribution.
  4203. * 3. The name of the author may not be used to endorse or promote products
  4204. * derived from this software without specific prior written permission.
  4205. *
  4206. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  4207. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  4208. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  4209. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  4210. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  4211. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  4212. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  4213. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  4214. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  4215. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  4216. */
  4217. /*
  4218. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  4219. *
  4220. * Redistribution and use in source and binary forms, with or without
  4221. * modification, are permitted provided that the following conditions
  4222. * are met:
  4223. * 1. Redistributions of source code must retain the above copyright
  4224. * notice, this list of conditions and the following disclaimer.
  4225. * 2. Redistributions in binary form must reproduce the above copyright
  4226. * notice, this list of conditions and the following disclaimer in the
  4227. * documentation and/or other materials provided with the distribution.
  4228. * 3. The name of the author may not be used to endorse or promote products
  4229. * derived from this software without specific prior written permission.
  4230. *
  4231. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  4232. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  4233. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  4234. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  4235. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  4236. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  4237. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  4238. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  4239. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  4240. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  4241. */
  4242. /* Clang expands this to 1 if an identifier is *not* reserved. */
  4243. /*
  4244. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  4245. * musl, try to handle this gracefully.
  4246. */
  4247. /* Copyright (C) 1992-2023 Free Software Foundation, Inc.
  4248. Copyright The GNU Toolchain Authors.
  4249. This file is part of the GNU C Library.
  4250. The GNU C Library is free software; you can redistribute it and/or
  4251. modify it under the terms of the GNU Lesser General Public
  4252. License as published by the Free Software Foundation; either
  4253. version 2.1 of the License, or (at your option) any later version.
  4254. The GNU C Library is distributed in the hope that it will be useful,
  4255. but WITHOUT ANY WARRANTY; without even the implied warranty of
  4256. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  4257. Lesser General Public License for more details.
  4258. You should have received a copy of the GNU Lesser General Public
  4259. License along with the GNU C Library; if not, see
  4260. <https://www.gnu.org/licenses/>. */
  4261. type Tfilewbuf = struct {
  4262. Ffp uintptr
  4263. Fwbuf uintptr
  4264. Flen1 Tsize_t
  4265. }
  4266. var _fb_pool1 [32]Tfilewbuf
  4267. var _fb_pool_cur1 int32
  4268. func Xfgetwln(tls *libc.TLS, stream uintptr, lenp uintptr) (r uintptr) {
  4269. var fb, wp, v3 uintptr
  4270. var wc, v1 Twint_t
  4271. var wused, v2 Tsize_t
  4272. _, _, _, _, _, _, _ = fb, wc, wp, wused, v1, v2, v3
  4273. wused = uint64(0)
  4274. /* Try to diminish the possibility of several fgetwln() calls being
  4275. * used on different streams, by using a pool of buffers per file. */
  4276. fb = uintptr(unsafe.Pointer(&_fb_pool1)) + uintptr(_fb_pool_cur1)*24
  4277. if (*Tfilewbuf)(unsafe.Pointer(fb)).Ffp != stream && (*Tfilewbuf)(unsafe.Pointer(fb)).Ffp != libc.UintptrFromInt32(0) {
  4278. _fb_pool_cur1++
  4279. _fb_pool_cur1 %= int32(m_FILEWBUF_POOL_ITEMS)
  4280. fb = uintptr(unsafe.Pointer(&_fb_pool1)) + uintptr(_fb_pool_cur1)*24
  4281. }
  4282. (*Tfilewbuf)(unsafe.Pointer(fb)).Ffp = stream
  4283. for {
  4284. v1 = libc.Xfgetwc(tls, stream)
  4285. wc = v1
  4286. if !(v1 != uint32(0xffffffff)) {
  4287. break
  4288. }
  4289. if !((*Tfilewbuf)(unsafe.Pointer(fb)).Flen1 != 0) || wused >= (*Tfilewbuf)(unsafe.Pointer(fb)).Flen1 {
  4290. if (*Tfilewbuf)(unsafe.Pointer(fb)).Flen1 != 0 {
  4291. *(*Tsize_t)(unsafe.Pointer(fb + 16)) *= uint64(2)
  4292. } else {
  4293. (*Tfilewbuf)(unsafe.Pointer(fb)).Flen1 = uint64(m_FILEWBUF_INIT_LEN)
  4294. }
  4295. wp = Xreallocarray(tls, (*Tfilewbuf)(unsafe.Pointer(fb)).Fwbuf, (*Tfilewbuf)(unsafe.Pointer(fb)).Flen1, uint64(4))
  4296. if wp == libc.UintptrFromInt32(0) {
  4297. wused = uint64(0)
  4298. break
  4299. }
  4300. (*Tfilewbuf)(unsafe.Pointer(fb)).Fwbuf = wp
  4301. }
  4302. v2 = wused
  4303. wused++
  4304. *(*Twchar_t)(unsafe.Pointer((*Tfilewbuf)(unsafe.Pointer(fb)).Fwbuf + uintptr(v2)*4)) = libc.Int32FromUint32(wc)
  4305. if wc == uint32('\n') {
  4306. break
  4307. }
  4308. }
  4309. *(*Tsize_t)(unsafe.Pointer(lenp)) = wused
  4310. if wused != 0 {
  4311. v3 = (*Tfilewbuf)(unsafe.Pointer(fb)).Fwbuf
  4312. } else {
  4313. v3 = libc.UintptrFromInt32(0)
  4314. }
  4315. return v3
  4316. }
  4317. // C documentation
  4318. //
  4319. // /* XXX: Ideally we'd recommend getwline(3), but unfortunately even though it
  4320. // * was part of the ISO/IEC TR 24731-2:2010 draft, it did not make it into C11
  4321. // * and is not widely implemented. */
  4322. var _libbsd_emit_link_warning_fgetwln = [115]int8{'T', 'h', 'e', ' ', 'f', 'g', 'e', 't', 'w', 'l', 'n', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'c', 'a', 'n', 'n', 'o', 't', ' ', 'b', 'e', ' ', 's', 'a', 'f', 'e', 'l', 'y', ' ', 'p', 'o', 'r', 't', 'e', 'd', ',', ' ', 'u', 's', 'e', ' ', 'f', 'g', 'e', 't', 'w', 'c', '(', '3', ')', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', ',', ' ', 'a', 's', ' ', 'i', 't', ' ', 'i', 's', ' ', 's', 'u', 'p', 'p', 'o', 'r', 't', 'e', 'd', ' ', 'b', 'y', ' ', 'C', '9', '9', ' ', 'a', 'n', 'd', ' ', 'P', 'O', 'S', 'I', 'X', '.', '1', '-', '2', '0', '0', '1', '.'}
  4323. const m_FPARSELN_UNESCALL1 = 15
  4324. const m_FPARSELN_UNESCCOMM1 = 4
  4325. const m_FPARSELN_UNESCCONT1 = 2
  4326. const m_FPARSELN_UNESCESC1 = 1
  4327. const m_FPARSELN_UNESCREST1 = 8
  4328. const m_static_assert = "_Static_assert"
  4329. // C documentation
  4330. //
  4331. // /* isescaped():
  4332. // * Return true if the character in *p that belongs to a string
  4333. // * that starts in *sp, is escaped by the escape character esc.
  4334. // */
  4335. func _isescaped(tls *libc.TLS, sp uintptr, p uintptr, esc int32) (r int32) {
  4336. var cp, v2 uintptr
  4337. var ne Tsize_t
  4338. _, _, _ = cp, ne, v2
  4339. /* No escape character */
  4340. if esc == int32('\000') {
  4341. return 0
  4342. }
  4343. /* Count the number of escape characters that precede ours */
  4344. ne = uint64(0)
  4345. cp = p
  4346. for {
  4347. cp--
  4348. v2 = cp
  4349. if !(v2 >= sp && int32(*(*int8)(unsafe.Pointer(cp))) == esc) {
  4350. break
  4351. }
  4352. goto _1
  4353. goto _1
  4354. _1:
  4355. ;
  4356. ne++
  4357. }
  4358. /* Return true if odd number of escape characters */
  4359. return libc.BoolInt32(ne&uint64(1) != uint64(0))
  4360. }
  4361. // C documentation
  4362. //
  4363. // /* fparseln():
  4364. // * Read a line from a file parsing continuations ending in * and eliminating trailing newlines, or comments starting with
  4365. // * the comment char.
  4366. // */
  4367. func Xfparseln(tls *libc.TLS, fp uintptr, size uintptr, lineno uintptr, str uintptr, flags int32) (r uintptr) {
  4368. bp := tls.Alloc(16)
  4369. defer tls.Free(16)
  4370. var buf, cp, v2, v3, v4, v5, v6, v7, v8, v9 uintptr
  4371. var cnt, skipesc int32
  4372. var com, con, esc, nl int8
  4373. var len1 Tsize_t
  4374. var s Tssize_t
  4375. var _ /* ptr at bp+8 */ uintptr
  4376. var _ /* ptrlen at bp+0 */ Tsize_t
  4377. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = buf, cnt, com, con, cp, esc, len1, nl, s, skipesc, v2, v3, v4, v5, v6, v7, v8, v9
  4378. len1 = uint64(0)
  4379. buf = libc.UintptrFromInt32(0)
  4380. *(*Tsize_t)(unsafe.Pointer(bp)) = uint64(0)
  4381. *(*uintptr)(unsafe.Pointer(bp + 8)) = libc.UintptrFromInt32(0)
  4382. cnt = int32(1)
  4383. if str == libc.UintptrFromInt32(0) {
  4384. str = uintptr(unsafe.Pointer(&_dstr))
  4385. }
  4386. esc = *(*int8)(unsafe.Pointer(str))
  4387. con = *(*int8)(unsafe.Pointer(str + 1))
  4388. com = *(*int8)(unsafe.Pointer(str + 2))
  4389. /*
  4390. * XXX: it would be cool to be able to specify the newline character,
  4391. * getdelim(3) does let us, but supporting it would diverge from BSDs.
  4392. */
  4393. nl = int8('\n')
  4394. libc.Xflockfile(tls, fp)
  4395. for cnt != 0 {
  4396. cnt = 0
  4397. if lineno != 0 {
  4398. *(*Tsize_t)(unsafe.Pointer(lineno))++
  4399. }
  4400. s = libc.Xgetline(tls, bp+8, bp, fp)
  4401. if s < 0 {
  4402. break
  4403. }
  4404. if s != 0 && com != 0 { /* Check and eliminate comments */
  4405. cp = *(*uintptr)(unsafe.Pointer(bp + 8))
  4406. for {
  4407. if !(cp < *(*uintptr)(unsafe.Pointer(bp + 8))+uintptr(s)) {
  4408. break
  4409. }
  4410. if int32(*(*int8)(unsafe.Pointer(cp))) == int32(com) && !(_isescaped(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), cp, int32(esc)) != 0) {
  4411. s = int64(cp) - int64(*(*uintptr)(unsafe.Pointer(bp + 8)))
  4412. cnt = libc.BoolInt32(s == 0 && buf == libc.UintptrFromInt32(0))
  4413. break
  4414. }
  4415. goto _1
  4416. _1:
  4417. ;
  4418. cp++
  4419. }
  4420. }
  4421. if s != 0 && nl != 0 { /* Check and eliminate newlines */
  4422. cp = *(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(s-int64(1))
  4423. if int32(*(*int8)(unsafe.Pointer(cp))) == int32(nl) {
  4424. s--
  4425. } /* forget newline */
  4426. }
  4427. if s != 0 && con != 0 { /* Check and eliminate continuations */
  4428. cp = *(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(s-int64(1))
  4429. if int32(*(*int8)(unsafe.Pointer(cp))) == int32(con) && !(_isescaped(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), cp, int32(esc)) != 0) {
  4430. s-- /* forget continuation char */
  4431. cnt = int32(1)
  4432. }
  4433. }
  4434. if s == 0 {
  4435. /*
  4436. * nothing to add, skip realloc except in case
  4437. * we need a minimal buf to return an empty line
  4438. */
  4439. if cnt != 0 || buf != libc.UintptrFromInt32(0) {
  4440. continue
  4441. }
  4442. }
  4443. v2 = libc.Xrealloc(tls, buf, len1+libc.Uint64FromInt64(s)+uint64(1))
  4444. cp = v2
  4445. if v2 == libc.UintptrFromInt32(0) {
  4446. libc.Xfunlockfile(tls, fp)
  4447. libc.Xfree(tls, buf)
  4448. libc.Xfree(tls, *(*uintptr)(unsafe.Pointer(bp + 8)))
  4449. return libc.UintptrFromInt32(0)
  4450. }
  4451. buf = cp
  4452. libc.Xmemcpy(tls, buf+uintptr(len1), *(*uintptr)(unsafe.Pointer(bp + 8)), libc.Uint64FromInt64(s))
  4453. len1 += libc.Uint64FromInt64(s)
  4454. *(*int8)(unsafe.Pointer(buf + uintptr(len1))) = int8('\000')
  4455. }
  4456. libc.Xfunlockfile(tls, fp)
  4457. libc.Xfree(tls, *(*uintptr)(unsafe.Pointer(bp + 8)))
  4458. if flags&int32(m_FPARSELN_UNESCALL1) != 0 && esc != 0 && buf != libc.UintptrFromInt32(0) && libc.Xstrchr(tls, buf, int32(esc)) != libc.UintptrFromInt32(0) {
  4459. v3 = buf
  4460. cp = v3
  4461. *(*uintptr)(unsafe.Pointer(bp + 8)) = v3
  4462. for int32(*(*int8)(unsafe.Pointer(cp))) != int32('\000') {
  4463. for int32(*(*int8)(unsafe.Pointer(cp))) != int32('\000') && int32(*(*int8)(unsafe.Pointer(cp))) != int32(esc) {
  4464. v4 = *(*uintptr)(unsafe.Pointer(bp + 8))
  4465. *(*uintptr)(unsafe.Pointer(bp + 8))++
  4466. v5 = cp
  4467. cp++
  4468. *(*int8)(unsafe.Pointer(v4)) = *(*int8)(unsafe.Pointer(v5))
  4469. }
  4470. if int32(*(*int8)(unsafe.Pointer(cp))) == int32('\000') || int32(*(*int8)(unsafe.Pointer(cp + 1))) == int32('\000') {
  4471. break
  4472. }
  4473. skipesc = 0
  4474. if int32(*(*int8)(unsafe.Pointer(cp + 1))) == int32(com) {
  4475. skipesc += flags & int32(m_FPARSELN_UNESCCOMM1)
  4476. }
  4477. if int32(*(*int8)(unsafe.Pointer(cp + 1))) == int32(con) {
  4478. skipesc += flags & int32(m_FPARSELN_UNESCCONT1)
  4479. }
  4480. if int32(*(*int8)(unsafe.Pointer(cp + 1))) == int32(esc) {
  4481. skipesc += flags & int32(m_FPARSELN_UNESCESC1)
  4482. }
  4483. if int32(*(*int8)(unsafe.Pointer(cp + 1))) != int32(com) && int32(*(*int8)(unsafe.Pointer(cp + 1))) != int32(con) && int32(*(*int8)(unsafe.Pointer(cp + 1))) != int32(esc) {
  4484. skipesc = flags & int32(m_FPARSELN_UNESCREST1)
  4485. }
  4486. if skipesc != 0 {
  4487. cp++
  4488. } else {
  4489. v6 = *(*uintptr)(unsafe.Pointer(bp + 8))
  4490. *(*uintptr)(unsafe.Pointer(bp + 8))++
  4491. v7 = cp
  4492. cp++
  4493. *(*int8)(unsafe.Pointer(v6)) = *(*int8)(unsafe.Pointer(v7))
  4494. }
  4495. v8 = *(*uintptr)(unsafe.Pointer(bp + 8))
  4496. *(*uintptr)(unsafe.Pointer(bp + 8))++
  4497. v9 = cp
  4498. cp++
  4499. *(*int8)(unsafe.Pointer(v8)) = *(*int8)(unsafe.Pointer(v9))
  4500. }
  4501. *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))) = int8('\000')
  4502. len1 = libc.Xstrlen(tls, buf)
  4503. }
  4504. if size != 0 {
  4505. *(*Tsize_t)(unsafe.Pointer(size)) = len1
  4506. }
  4507. return buf
  4508. }
  4509. var _dstr = [3]int8{
  4510. 0: int8('\\'),
  4511. 1: int8('\\'),
  4512. 2: int8('#'),
  4513. }
  4514. const m_FPARSELN_UNESCALL2 = 0x0f
  4515. const m_FPARSELN_UNESCCOMM2 = 0x04
  4516. const m_FPARSELN_UNESCCONT2 = 0x02
  4517. const m_FPARSELN_UNESCESC2 = 0x01
  4518. const m_FPARSELN_UNESCREST2 = 0x08
  4519. const m_LOCK_EX = 2
  4520. const m_LOCK_NB = 4
  4521. const m_LOCK_SH = 1
  4522. const m_LOCK_UN = 8
  4523. const m_O_CREAT1 = 64
  4524. const m_O_NONBLOCK1 = 2048
  4525. const m_O_TRUNC1 = 512
  4526. /* Values for humanize_number(3)'s flags parameter. */
  4527. /* Values for humanize_number(3)'s scale parameter. */
  4528. /*
  4529. * fparseln() specific operation flags.
  4530. */
  4531. func _lock_file(tls *libc.TLS, fd int32, flags int32) (r int32) {
  4532. var operation int32
  4533. _ = operation
  4534. operation = int32(m_LOCK_EX)
  4535. if flags&int32(m_O_NONBLOCK1) != 0 {
  4536. operation |= int32(m_LOCK_NB)
  4537. }
  4538. return libc.Xflock(tls, fd, operation)
  4539. }
  4540. // C documentation
  4541. //
  4542. // /*
  4543. // * Reliably open and lock a file.
  4544. // *
  4545. // * Please do not modify this code without first reading the revision history
  4546. // * and discussing your changes with <des@freebsd.org>. Don't be fooled by the
  4547. // * code's apparent simplicity; there would be no need for this function if it
  4548. // * was easy to get right.
  4549. // */
  4550. func _vflopenat(tls *libc.TLS, dirfd int32, path uintptr, flags int32, ap Tva_list) (r int32) {
  4551. bp := tls.Alloc(272)
  4552. defer tls.Free(272)
  4553. var fd, serrno, trunc, v2 int32
  4554. var mode Tmode_t
  4555. var _ /* fsb at bp+128 */ Tstat
  4556. var _ /* sb at bp+0 */ Tstat
  4557. _, _, _, _, _ = fd, mode, serrno, trunc, v2
  4558. mode = uint32(0)
  4559. if flags&int32(m_O_CREAT1) != 0 {
  4560. mode = libc.Uint32FromInt32(libc.VaInt32(&ap)) /* mode_t promoted to int */
  4561. }
  4562. trunc = flags & int32(m_O_TRUNC1)
  4563. flags &= ^libc.Int32FromInt32(m_O_TRUNC1)
  4564. for {
  4565. v2 = libc.Xopenat(tls, dirfd, path, flags, libc.VaList(bp+264, mode))
  4566. fd = v2
  4567. if v2 == -int32(1) {
  4568. /* non-existent or no access */
  4569. return -int32(1)
  4570. }
  4571. if _lock_file(tls, fd, flags) == -int32(1) {
  4572. /* unsupported or interrupted */
  4573. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  4574. libc.Xclose(tls, fd)
  4575. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  4576. return -int32(1)
  4577. }
  4578. if libc.Xfstatat(tls, dirfd, path, bp, 0) == -int32(1) {
  4579. /* disappeared from under our feet */
  4580. libc.Xclose(tls, fd)
  4581. goto _1
  4582. }
  4583. if libc.Xfstat(tls, fd, bp+128) == -int32(1) {
  4584. /* can't happen [tm] */
  4585. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  4586. libc.Xclose(tls, fd)
  4587. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  4588. return -int32(1)
  4589. }
  4590. if (*(*Tstat)(unsafe.Pointer(bp))).Fst_dev != (*(*Tstat)(unsafe.Pointer(bp + 128))).Fst_dev || (*(*Tstat)(unsafe.Pointer(bp))).Fst_ino != (*(*Tstat)(unsafe.Pointer(bp + 128))).Fst_ino {
  4591. /* changed under our feet */
  4592. libc.Xclose(tls, fd)
  4593. goto _1
  4594. }
  4595. if trunc != 0 && libc.Xftruncate(tls, fd, 0) != 0 {
  4596. /* can't happen [tm] */
  4597. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  4598. libc.Xclose(tls, fd)
  4599. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  4600. return -int32(1)
  4601. }
  4602. /*
  4603. * The following change is provided as a specific example to
  4604. * avoid.
  4605. */
  4606. return fd
  4607. goto _1
  4608. _1:
  4609. }
  4610. return r
  4611. }
  4612. func Xflopen(tls *libc.TLS, path uintptr, flags int32, va uintptr) (r int32) {
  4613. var ap Tva_list
  4614. var ret int32
  4615. _, _ = ap, ret
  4616. ap = va
  4617. ret = _vflopenat(tls, -int32(100), path, flags, ap)
  4618. _ = ap
  4619. return ret
  4620. }
  4621. func Xflopenat(tls *libc.TLS, dirfd int32, path uintptr, flags int32, va uintptr) (r int32) {
  4622. var ap Tva_list
  4623. var ret int32
  4624. _, _ = ap, ret
  4625. ap = va
  4626. ret = _vflopenat(tls, dirfd, path, flags, ap)
  4627. _ = ap
  4628. return ret
  4629. }
  4630. type ___e_fmtcheck_types = int32
  4631. const _FMTCHECK_START = 0
  4632. const _FMTCHECK_SHORT = 1
  4633. const _FMTCHECK_INT = 2
  4634. const _FMTCHECK_WINTT = 3
  4635. const _FMTCHECK_LONG = 4
  4636. const _FMTCHECK_QUAD = 5
  4637. const _FMTCHECK_INTMAXT = 6
  4638. const _FMTCHECK_PTRDIFFT = 7
  4639. const _FMTCHECK_SIZET = 8
  4640. const _FMTCHECK_POINTER = 9
  4641. const _FMTCHECK_CHARPOINTER = 10
  4642. const _FMTCHECK_SHORTPOINTER = 11
  4643. const _FMTCHECK_INTPOINTER = 12
  4644. const _FMTCHECK_LONGPOINTER = 13
  4645. const _FMTCHECK_QUADPOINTER = 14
  4646. const _FMTCHECK_INTMAXTPOINTER = 15
  4647. const _FMTCHECK_PTRDIFFTPOINTER = 16
  4648. const _FMTCHECK_SIZETPOINTER = 17
  4649. const _FMTCHECK_DOUBLE = 18
  4650. const _FMTCHECK_LONGDOUBLE = 19
  4651. const _FMTCHECK_STRING = 20
  4652. const _FMTCHECK_WSTRING = 21
  4653. const _FMTCHECK_WIDTH = 22
  4654. const _FMTCHECK_PRECISION = 23
  4655. const _FMTCHECK_DONE = 24
  4656. const _FMTCHECK_UNKNOWN = 25
  4657. type TEFT = int32
  4658. type _e_modifier = int32
  4659. const _MOD_NONE = 0
  4660. const _MOD_CHAR = 1
  4661. const _MOD_SHORT = 2
  4662. const _MOD_LONG = 3
  4663. const _MOD_QUAD = 4
  4664. const _MOD_INTMAXT = 5
  4665. const _MOD_LONGDOUBLE = 6
  4666. const _MOD_PTRDIFFT = 7
  4667. const _MOD_SIZET = 8
  4668. func _get_next_format_from_precision(tls *libc.TLS, pf uintptr) (r TEFT) {
  4669. var f uintptr
  4670. var modifier _e_modifier
  4671. _, _ = f, modifier
  4672. f = *(*uintptr)(unsafe.Pointer(pf))
  4673. switch int32(*(*int8)(unsafe.Pointer(f))) {
  4674. case int32('h'):
  4675. f++
  4676. if !(*(*int8)(unsafe.Pointer(f)) != 0) {
  4677. *(*uintptr)(unsafe.Pointer(pf)) = f
  4678. return int32(_FMTCHECK_UNKNOWN)
  4679. }
  4680. if int32(*(*int8)(unsafe.Pointer(f))) == int32('h') {
  4681. f++
  4682. modifier = int32(_MOD_CHAR)
  4683. } else {
  4684. modifier = int32(_MOD_SHORT)
  4685. }
  4686. case int32('j'):
  4687. f++
  4688. modifier = int32(_MOD_INTMAXT)
  4689. case int32('l'):
  4690. f++
  4691. if !(*(*int8)(unsafe.Pointer(f)) != 0) {
  4692. *(*uintptr)(unsafe.Pointer(pf)) = f
  4693. return int32(_FMTCHECK_UNKNOWN)
  4694. }
  4695. if int32(*(*int8)(unsafe.Pointer(f))) == int32('l') {
  4696. f++
  4697. modifier = int32(_MOD_QUAD)
  4698. } else {
  4699. modifier = int32(_MOD_LONG)
  4700. }
  4701. case int32('q'):
  4702. f++
  4703. modifier = int32(_MOD_QUAD)
  4704. case int32('t'):
  4705. f++
  4706. modifier = int32(_MOD_PTRDIFFT)
  4707. case int32('z'):
  4708. f++
  4709. modifier = int32(_MOD_SIZET)
  4710. case int32('L'):
  4711. f++
  4712. modifier = int32(_MOD_LONGDOUBLE)
  4713. default:
  4714. modifier = int32(_MOD_NONE)
  4715. break
  4716. }
  4717. if !(*(*int8)(unsafe.Pointer(f)) != 0) {
  4718. *(*uintptr)(unsafe.Pointer(pf)) = f
  4719. return int32(_FMTCHECK_UNKNOWN)
  4720. }
  4721. if libc.Xstrchr(tls, __ccgo_ts+26, int32(*(*int8)(unsafe.Pointer(f)))) != 0 {
  4722. switch modifier {
  4723. case int32(_MOD_LONG):
  4724. goto _1
  4725. case int32(_MOD_QUAD):
  4726. goto _2
  4727. case int32(_MOD_INTMAXT):
  4728. goto _3
  4729. case int32(_MOD_PTRDIFFT):
  4730. goto _4
  4731. case int32(_MOD_SIZET):
  4732. goto _5
  4733. case int32(_MOD_NONE):
  4734. goto _6
  4735. case int32(_MOD_SHORT):
  4736. goto _7
  4737. case int32(_MOD_CHAR):
  4738. goto _8
  4739. default:
  4740. goto _9
  4741. }
  4742. goto _10
  4743. _1:
  4744. ;
  4745. _13:
  4746. ;
  4747. *(*uintptr)(unsafe.Pointer(pf)) = f
  4748. return int32(_FMTCHECK_LONG)
  4749. goto _12
  4750. _12:
  4751. ;
  4752. if 0 != 0 {
  4753. goto _13
  4754. }
  4755. goto _11
  4756. _11:
  4757. ;
  4758. _2:
  4759. ;
  4760. *(*uintptr)(unsafe.Pointer(pf)) = f
  4761. return int32(_FMTCHECK_QUAD)
  4762. _3:
  4763. ;
  4764. *(*uintptr)(unsafe.Pointer(pf)) = f
  4765. return int32(_FMTCHECK_INTMAXT)
  4766. _4:
  4767. ;
  4768. *(*uintptr)(unsafe.Pointer(pf)) = f
  4769. return int32(_FMTCHECK_PTRDIFFT)
  4770. _5:
  4771. ;
  4772. *(*uintptr)(unsafe.Pointer(pf)) = f
  4773. return int32(_FMTCHECK_SIZET)
  4774. _8:
  4775. ;
  4776. _7:
  4777. ;
  4778. _6:
  4779. ;
  4780. *(*uintptr)(unsafe.Pointer(pf)) = f
  4781. return int32(_FMTCHECK_INT)
  4782. _9:
  4783. ;
  4784. *(*uintptr)(unsafe.Pointer(pf)) = f
  4785. return int32(_FMTCHECK_UNKNOWN)
  4786. _10:
  4787. }
  4788. if int32(*(*int8)(unsafe.Pointer(f))) == int32('n') {
  4789. switch modifier {
  4790. case int32(_MOD_CHAR):
  4791. goto _14
  4792. case int32(_MOD_SHORT):
  4793. goto _15
  4794. case int32(_MOD_LONG):
  4795. goto _16
  4796. case int32(_MOD_QUAD):
  4797. goto _17
  4798. case int32(_MOD_INTMAXT):
  4799. goto _18
  4800. case int32(_MOD_PTRDIFFT):
  4801. goto _19
  4802. case int32(_MOD_SIZET):
  4803. goto _20
  4804. case int32(_MOD_NONE):
  4805. goto _21
  4806. default:
  4807. goto _22
  4808. }
  4809. goto _23
  4810. _14:
  4811. ;
  4812. _26:
  4813. ;
  4814. *(*uintptr)(unsafe.Pointer(pf)) = f
  4815. return int32(_FMTCHECK_CHARPOINTER)
  4816. goto _25
  4817. _25:
  4818. ;
  4819. if 0 != 0 {
  4820. goto _26
  4821. }
  4822. goto _24
  4823. _24:
  4824. ;
  4825. _15:
  4826. ;
  4827. *(*uintptr)(unsafe.Pointer(pf)) = f
  4828. return int32(_FMTCHECK_SHORTPOINTER)
  4829. _16:
  4830. ;
  4831. *(*uintptr)(unsafe.Pointer(pf)) = f
  4832. return int32(_FMTCHECK_LONGPOINTER)
  4833. _17:
  4834. ;
  4835. *(*uintptr)(unsafe.Pointer(pf)) = f
  4836. return int32(_FMTCHECK_QUADPOINTER)
  4837. _18:
  4838. ;
  4839. *(*uintptr)(unsafe.Pointer(pf)) = f
  4840. return int32(_FMTCHECK_INTMAXTPOINTER)
  4841. _19:
  4842. ;
  4843. *(*uintptr)(unsafe.Pointer(pf)) = f
  4844. return int32(_FMTCHECK_PTRDIFFTPOINTER)
  4845. _20:
  4846. ;
  4847. *(*uintptr)(unsafe.Pointer(pf)) = f
  4848. return int32(_FMTCHECK_SIZETPOINTER)
  4849. _21:
  4850. ;
  4851. *(*uintptr)(unsafe.Pointer(pf)) = f
  4852. return int32(_FMTCHECK_INTPOINTER)
  4853. _22:
  4854. ;
  4855. *(*uintptr)(unsafe.Pointer(pf)) = f
  4856. return int32(_FMTCHECK_UNKNOWN)
  4857. _23:
  4858. }
  4859. if libc.Xstrchr(tls, __ccgo_ts+33, int32(*(*int8)(unsafe.Pointer(f)))) != 0 {
  4860. if modifier != int32(_MOD_NONE) {
  4861. *(*uintptr)(unsafe.Pointer(pf)) = f
  4862. return int32(_FMTCHECK_UNKNOWN)
  4863. }
  4864. *(*uintptr)(unsafe.Pointer(pf)) = f
  4865. return int32(_FMTCHECK_LONG)
  4866. }
  4867. if libc.Xstrchr(tls, __ccgo_ts+37, int32(*(*int8)(unsafe.Pointer(f)))) != 0 {
  4868. switch modifier {
  4869. case int32(_MOD_LONGDOUBLE):
  4870. goto _27
  4871. case int32(_MOD_NONE):
  4872. goto _28
  4873. case int32(_MOD_LONG):
  4874. goto _29
  4875. default:
  4876. goto _30
  4877. }
  4878. goto _31
  4879. _27:
  4880. ;
  4881. _34:
  4882. ;
  4883. *(*uintptr)(unsafe.Pointer(pf)) = f
  4884. return int32(_FMTCHECK_LONGDOUBLE)
  4885. goto _33
  4886. _33:
  4887. ;
  4888. if 0 != 0 {
  4889. goto _34
  4890. }
  4891. goto _32
  4892. _32:
  4893. ;
  4894. _29:
  4895. ;
  4896. _28:
  4897. ;
  4898. *(*uintptr)(unsafe.Pointer(pf)) = f
  4899. return int32(_FMTCHECK_DOUBLE)
  4900. _30:
  4901. ;
  4902. *(*uintptr)(unsafe.Pointer(pf)) = f
  4903. return int32(_FMTCHECK_UNKNOWN)
  4904. _31:
  4905. }
  4906. if int32(*(*int8)(unsafe.Pointer(f))) == int32('c') {
  4907. switch modifier {
  4908. case int32(_MOD_LONG):
  4909. goto _35
  4910. case int32(_MOD_NONE):
  4911. goto _36
  4912. default:
  4913. goto _37
  4914. }
  4915. goto _38
  4916. _35:
  4917. ;
  4918. _41:
  4919. ;
  4920. *(*uintptr)(unsafe.Pointer(pf)) = f
  4921. return int32(_FMTCHECK_WINTT)
  4922. goto _40
  4923. _40:
  4924. ;
  4925. if 0 != 0 {
  4926. goto _41
  4927. }
  4928. goto _39
  4929. _39:
  4930. ;
  4931. _36:
  4932. ;
  4933. *(*uintptr)(unsafe.Pointer(pf)) = f
  4934. return int32(_FMTCHECK_INT)
  4935. _37:
  4936. ;
  4937. *(*uintptr)(unsafe.Pointer(pf)) = f
  4938. return int32(_FMTCHECK_UNKNOWN)
  4939. _38:
  4940. }
  4941. if int32(*(*int8)(unsafe.Pointer(f))) == int32('C') {
  4942. if modifier != int32(_MOD_NONE) {
  4943. *(*uintptr)(unsafe.Pointer(pf)) = f
  4944. return int32(_FMTCHECK_UNKNOWN)
  4945. }
  4946. *(*uintptr)(unsafe.Pointer(pf)) = f
  4947. return int32(_FMTCHECK_WINTT)
  4948. }
  4949. if int32(*(*int8)(unsafe.Pointer(f))) == int32('s') {
  4950. switch modifier {
  4951. case int32(_MOD_LONG):
  4952. goto _42
  4953. case int32(_MOD_NONE):
  4954. goto _43
  4955. default:
  4956. goto _44
  4957. }
  4958. goto _45
  4959. _42:
  4960. ;
  4961. _48:
  4962. ;
  4963. *(*uintptr)(unsafe.Pointer(pf)) = f
  4964. return int32(_FMTCHECK_WSTRING)
  4965. goto _47
  4966. _47:
  4967. ;
  4968. if 0 != 0 {
  4969. goto _48
  4970. }
  4971. goto _46
  4972. _46:
  4973. ;
  4974. _43:
  4975. ;
  4976. *(*uintptr)(unsafe.Pointer(pf)) = f
  4977. return int32(_FMTCHECK_STRING)
  4978. _44:
  4979. ;
  4980. *(*uintptr)(unsafe.Pointer(pf)) = f
  4981. return int32(_FMTCHECK_UNKNOWN)
  4982. _45:
  4983. }
  4984. if int32(*(*int8)(unsafe.Pointer(f))) == int32('S') {
  4985. if modifier != int32(_MOD_NONE) {
  4986. *(*uintptr)(unsafe.Pointer(pf)) = f
  4987. return int32(_FMTCHECK_UNKNOWN)
  4988. }
  4989. *(*uintptr)(unsafe.Pointer(pf)) = f
  4990. return int32(_FMTCHECK_WSTRING)
  4991. }
  4992. if int32(*(*int8)(unsafe.Pointer(f))) == int32('p') {
  4993. if modifier != int32(_MOD_NONE) {
  4994. *(*uintptr)(unsafe.Pointer(pf)) = f
  4995. return int32(_FMTCHECK_UNKNOWN)
  4996. }
  4997. *(*uintptr)(unsafe.Pointer(pf)) = f
  4998. return int32(_FMTCHECK_POINTER)
  4999. }
  5000. *(*uintptr)(unsafe.Pointer(pf)) = f
  5001. return int32(_FMTCHECK_UNKNOWN)
  5002. /*NOTREACHED*/
  5003. return r
  5004. }
  5005. func _get_next_format_from_width(tls *libc.TLS, pf uintptr) (r TEFT) {
  5006. var f uintptr
  5007. _ = f
  5008. f = *(*uintptr)(unsafe.Pointer(pf))
  5009. if int32(*(*int8)(unsafe.Pointer(f))) == int32('.') {
  5010. f++
  5011. if int32(*(*int8)(unsafe.Pointer(f))) == int32('*') {
  5012. *(*uintptr)(unsafe.Pointer(pf)) = f
  5013. return int32(_FMTCHECK_PRECISION)
  5014. }
  5015. /* eat any precision (empty is allowed) */
  5016. for libc.BoolInt32(uint32(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(f))))-uint32('0') < uint32(10)) != 0 {
  5017. f++
  5018. }
  5019. if !(*(*int8)(unsafe.Pointer(f)) != 0) {
  5020. *(*uintptr)(unsafe.Pointer(pf)) = f
  5021. return int32(_FMTCHECK_UNKNOWN)
  5022. }
  5023. }
  5024. *(*uintptr)(unsafe.Pointer(pf)) = f
  5025. return _get_next_format_from_precision(tls, pf)
  5026. /*NOTREACHED*/
  5027. return r
  5028. }
  5029. func _get_next_format(tls *libc.TLS, pf uintptr, eft TEFT) (r TEFT) {
  5030. var f uintptr
  5031. var infmt int32
  5032. _, _ = f, infmt
  5033. if eft == int32(_FMTCHECK_WIDTH) {
  5034. *(*uintptr)(unsafe.Pointer(pf))++
  5035. return _get_next_format_from_width(tls, pf)
  5036. } else {
  5037. if eft == int32(_FMTCHECK_PRECISION) {
  5038. *(*uintptr)(unsafe.Pointer(pf))++
  5039. return _get_next_format_from_precision(tls, pf)
  5040. }
  5041. }
  5042. f = *(*uintptr)(unsafe.Pointer(pf))
  5043. infmt = 0
  5044. for !(infmt != 0) {
  5045. f = libc.Xstrchr(tls, f, int32('%'))
  5046. if f == libc.UintptrFromInt32(0) {
  5047. *(*uintptr)(unsafe.Pointer(pf)) = f
  5048. return int32(_FMTCHECK_DONE)
  5049. }
  5050. f++
  5051. if !(*(*int8)(unsafe.Pointer(f)) != 0) {
  5052. *(*uintptr)(unsafe.Pointer(pf)) = f
  5053. return int32(_FMTCHECK_UNKNOWN)
  5054. }
  5055. if int32(*(*int8)(unsafe.Pointer(f))) != int32('%') {
  5056. infmt = int32(1)
  5057. } else {
  5058. f++
  5059. }
  5060. }
  5061. /* Eat any of the flags */
  5062. for *(*int8)(unsafe.Pointer(f)) != 0 && libc.Xstrchr(tls, __ccgo_ts+46, int32(*(*int8)(unsafe.Pointer(f)))) != 0 {
  5063. f++
  5064. }
  5065. if int32(*(*int8)(unsafe.Pointer(f))) == int32('*') {
  5066. *(*uintptr)(unsafe.Pointer(pf)) = f
  5067. return int32(_FMTCHECK_WIDTH)
  5068. }
  5069. /* eat any width */
  5070. for libc.BoolInt32(uint32(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(f))))-uint32('0') < uint32(10)) != 0 {
  5071. f++
  5072. }
  5073. if !(*(*int8)(unsafe.Pointer(f)) != 0) {
  5074. *(*uintptr)(unsafe.Pointer(pf)) = f
  5075. return int32(_FMTCHECK_UNKNOWN)
  5076. }
  5077. *(*uintptr)(unsafe.Pointer(pf)) = f
  5078. return _get_next_format_from_width(tls, pf)
  5079. /*NOTREACHED*/
  5080. return r
  5081. }
  5082. func Xfmtcheck(tls *libc.TLS, f1 uintptr, f2 uintptr) (r uintptr) {
  5083. bp := tls.Alloc(16)
  5084. defer tls.Free(16)
  5085. var f1t, f2t, v1 TEFT
  5086. var _ /* f1p at bp+0 */ uintptr
  5087. var _ /* f2p at bp+8 */ uintptr
  5088. _, _, _ = f1t, f2t, v1
  5089. if !(f1 != 0) {
  5090. return f2
  5091. }
  5092. *(*uintptr)(unsafe.Pointer(bp)) = f1
  5093. f1t = int32(_FMTCHECK_START)
  5094. *(*uintptr)(unsafe.Pointer(bp + 8)) = f2
  5095. f2t = int32(_FMTCHECK_START)
  5096. for {
  5097. v1 = _get_next_format(tls, bp, f1t)
  5098. f1t = v1
  5099. if !(v1 != int32(_FMTCHECK_DONE)) {
  5100. break
  5101. }
  5102. if f1t == int32(_FMTCHECK_UNKNOWN) {
  5103. return f2
  5104. }
  5105. f2t = _get_next_format(tls, bp+8, f2t)
  5106. if f1t != f2t {
  5107. return f2
  5108. }
  5109. }
  5110. return f1
  5111. }
  5112. const m_FSETLOCKING_BYCALLER = 2
  5113. const m_FSETLOCKING_INTERNAL = 1
  5114. const m_FSETLOCKING_QUERY = 0
  5115. func Xfpurge(tls *libc.TLS, fp uintptr) (r int32) {
  5116. if fp == libc.UintptrFromInt32(0) {
  5117. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EBADF)
  5118. return -int32(1)
  5119. }
  5120. libc.X__fpurge(tls, fp)
  5121. return 0
  5122. }
  5123. func Xfreezero(tls *libc.TLS, ptr uintptr, sz Tsize_t) {
  5124. /* This is legal. */
  5125. if ptr == libc.UintptrFromInt32(0) {
  5126. return
  5127. }
  5128. Xexplicit_bzero(tls, ptr, sz)
  5129. libc.Xfree(tls, ptr)
  5130. }
  5131. /*
  5132. * Copyright © 2004-2024 Guillem Jover <guillem@hadrons.org>
  5133. *
  5134. * Redistribution and use in source and binary forms, with or without
  5135. * modification, are permitted provided that the following conditions
  5136. * are met:
  5137. * 1. Redistributions of source code must retain the above copyright
  5138. * notice, this list of conditions and the following disclaimer.
  5139. * 2. Redistributions in binary form must reproduce the above copyright
  5140. * notice, this list of conditions and the following disclaimer in the
  5141. * documentation and/or other materials provided with the distribution.
  5142. * 3. The name of the author may not be used to endorse or promote products
  5143. * derived from this software without specific prior written permission.
  5144. *
  5145. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  5146. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  5147. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  5148. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  5149. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  5150. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  5151. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  5152. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  5153. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  5154. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  5155. */
  5156. type Tfunopen_cookie = struct {
  5157. Forig_cookie uintptr
  5158. Freadfn uintptr
  5159. Fwritefn uintptr
  5160. Fseekfn uintptr
  5161. Fclosefn uintptr
  5162. }
  5163. func _funopen_read(tls *libc.TLS, cookie uintptr, buf uintptr, size Tsize_t) (r Tssize_t) {
  5164. var cookiewrap uintptr
  5165. _ = cookiewrap
  5166. cookiewrap = cookie
  5167. if (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Freadfn == libc.UintptrFromInt32(0) {
  5168. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EBADF)
  5169. return int64(-int32(1))
  5170. }
  5171. return int64((*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Freadfn})))(tls, (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Forig_cookie, buf, libc.Int32FromUint64(size)))
  5172. }
  5173. func _funopen_write(tls *libc.TLS, cookie uintptr, buf uintptr, size Tsize_t) (r Tssize_t) {
  5174. var cookiewrap uintptr
  5175. _ = cookiewrap
  5176. cookiewrap = cookie
  5177. if (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Fwritefn == libc.UintptrFromInt32(0) {
  5178. return int64(-libc.Int32FromInt32(1))
  5179. }
  5180. return int64((*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Fwritefn})))(tls, (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Forig_cookie, buf, libc.Int32FromUint64(size)))
  5181. }
  5182. func _funopen_seek(tls *libc.TLS, cookie uintptr, offset uintptr, whence int32) (r int32) {
  5183. var cookiewrap uintptr
  5184. var soff Toff_t
  5185. _, _ = cookiewrap, soff
  5186. cookiewrap = cookie
  5187. soff = *(*Toff_t)(unsafe.Pointer(offset))
  5188. if (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Fseekfn == libc.UintptrFromInt32(0) {
  5189. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ESPIPE)
  5190. return -int32(1)
  5191. }
  5192. soff = (*(*func(*libc.TLS, uintptr, Toff_t, int32) Toff_t)(unsafe.Pointer(&struct{ uintptr }{(*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Fseekfn})))(tls, (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Forig_cookie, soff, whence)
  5193. *(*Toff_t)(unsafe.Pointer(offset)) = soff
  5194. return int32(*(*Toff_t)(unsafe.Pointer(offset)))
  5195. }
  5196. func _funopen_close(tls *libc.TLS, cookie uintptr) (r int32) {
  5197. var cookiewrap uintptr
  5198. var rc int32
  5199. _, _ = cookiewrap, rc
  5200. cookiewrap = cookie
  5201. if (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Fclosefn != 0 {
  5202. rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Fclosefn})))(tls, (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Forig_cookie)
  5203. } else {
  5204. rc = 0
  5205. }
  5206. libc.Xfree(tls, cookiewrap)
  5207. return rc
  5208. }
  5209. func Xfunopen(tls *libc.TLS, cookie uintptr, readfn uintptr, writefn uintptr, seekfn uintptr, closefn uintptr) (r uintptr) {
  5210. var cookiewrap, mode uintptr
  5211. var funcswrap Tcookie_io_functions_t
  5212. _, _, _ = cookiewrap, funcswrap, mode
  5213. funcswrap = Tcookie_io_functions_t{
  5214. Fread: __ccgo_fp(_funopen_read),
  5215. Fwrite: __ccgo_fp(_funopen_write),
  5216. Fseek: __ccgo_fp(_funopen_seek),
  5217. Fclose1: __ccgo_fp(_funopen_close),
  5218. }
  5219. if readfn != 0 {
  5220. if writefn == libc.UintptrFromInt32(0) {
  5221. mode = __ccgo_ts + 53
  5222. } else {
  5223. mode = __ccgo_ts + 55
  5224. }
  5225. } else {
  5226. if writefn != 0 {
  5227. mode = __ccgo_ts + 58
  5228. } else {
  5229. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  5230. return libc.UintptrFromInt32(0)
  5231. }
  5232. }
  5233. cookiewrap = libc.Xmalloc(tls, uint64(40))
  5234. if cookiewrap == libc.UintptrFromInt32(0) {
  5235. return libc.UintptrFromInt32(0)
  5236. }
  5237. (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Forig_cookie = cookie
  5238. (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Freadfn = readfn
  5239. (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Fwritefn = writefn
  5240. (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Fseekfn = seekfn
  5241. (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Fclosefn = closefn
  5242. return libc.Xfopencookie(tls, cookiewrap, mode, funcswrap)
  5243. }
  5244. const m_KB = 1024
  5245. const m_MAXB = "GB"
  5246. func Xgetbsize(tls *libc.TLS, headerlenp uintptr, blocksizep uintptr) (r uintptr) {
  5247. bp := tls.Alloc(32)
  5248. defer tls.Free(32)
  5249. var blocksize, max, mul, n, v15, v16, v17, v4 int64
  5250. var form, p, v3 uintptr
  5251. var _ /* ep at bp+0 */ uintptr
  5252. _, _, _, _, _, _, _, _, _, _, _ = blocksize, form, max, mul, n, p, v15, v16, v17, v3, v4
  5253. form = __ccgo_ts + 60
  5254. v3 = libc.Xgetenv(tls, __ccgo_ts+61)
  5255. p = v3
  5256. if !(v3 != libc.UintptrFromInt32(0) && int32(*(*int8)(unsafe.Pointer(p))) != int32('\000')) {
  5257. goto _1
  5258. }
  5259. v4 = libc.Xstrtol(tls, p, bp, int32(10))
  5260. n = v4
  5261. if v4 < 0 {
  5262. goto underflow
  5263. }
  5264. if n == 0 {
  5265. n = int64(1)
  5266. }
  5267. if *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))) != 0 && *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)) != 0 {
  5268. goto fmterr
  5269. }
  5270. switch int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) {
  5271. case int32('g'):
  5272. goto _5
  5273. case int32('G'):
  5274. goto _6
  5275. case int32('k'):
  5276. goto _7
  5277. case int32('K'):
  5278. goto _8
  5279. case int32('m'):
  5280. goto _9
  5281. case int32('M'):
  5282. goto _10
  5283. case int32('\000'):
  5284. goto _11
  5285. default:
  5286. goto _12
  5287. }
  5288. goto _13
  5289. _6:
  5290. ;
  5291. _5:
  5292. ;
  5293. form = __ccgo_ts + 71
  5294. max = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) / (libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024))
  5295. mul = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024)
  5296. goto _13
  5297. _8:
  5298. ;
  5299. _7:
  5300. ;
  5301. form = __ccgo_ts + 73
  5302. max = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) / libc.Int64FromInt64(1024)
  5303. mul = int64(1024)
  5304. goto _13
  5305. _10:
  5306. ;
  5307. _9:
  5308. ;
  5309. form = __ccgo_ts + 75
  5310. max = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) / (libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024))
  5311. mul = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024)
  5312. goto _13
  5313. _11:
  5314. ;
  5315. max = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024)
  5316. mul = int64(1)
  5317. goto _13
  5318. _12:
  5319. ;
  5320. goto fmterr
  5321. fmterr:
  5322. ;
  5323. libc.Xwarnx(tls, __ccgo_ts+77, libc.VaList(bp+16, p))
  5324. n = int64(512)
  5325. max = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024)
  5326. mul = int64(1)
  5327. goto _13
  5328. _13:
  5329. ;
  5330. if n > max {
  5331. libc.Xwarnx(tls, __ccgo_ts+99, libc.VaList(bp+16, libc.Int64FromInt64(1024)*libc.Int64FromInt64(1024)*libc.Int64FromInt64(1024)/(libc.Int64FromInt64(1024)*libc.Int64FromInt64(1024)*libc.Int64FromInt64(1024))))
  5332. n = max
  5333. }
  5334. v15 = n * mul
  5335. blocksize = v15
  5336. if !(v15 < int64(512)) {
  5337. goto _14
  5338. }
  5339. goto underflow
  5340. underflow:
  5341. ;
  5342. libc.Xwarnx(tls, __ccgo_ts+125, 0)
  5343. form = __ccgo_ts + 60
  5344. v16 = libc.Int64FromInt32(512)
  5345. n = v16
  5346. blocksize = v16
  5347. _14:
  5348. ;
  5349. goto _2
  5350. _1:
  5351. ;
  5352. v17 = libc.Int64FromInt32(512)
  5353. n = v17
  5354. blocksize = v17
  5355. _2:
  5356. ;
  5357. libc.X__builtin_snprintf(tls, uintptr(unsafe.Pointer(&_header)), uint64(20), __ccgo_ts+150, libc.VaList(bp+16, n, form))
  5358. *(*int32)(unsafe.Pointer(headerlenp)) = libc.Int32FromUint64(libc.Xstrlen(tls, uintptr(unsafe.Pointer(&_header))))
  5359. *(*int64)(unsafe.Pointer(blocksizep)) = blocksize
  5360. return uintptr(unsafe.Pointer(&_header))
  5361. }
  5362. var _header [20]int8
  5363. const m_AF_ALG = "PF_ALG"
  5364. const m_AF_APPLETALK = "PF_APPLETALK"
  5365. const m_AF_ASH = "PF_ASH"
  5366. const m_AF_ATMPVC = "PF_ATMPVC"
  5367. const m_AF_ATMSVC = "PF_ATMSVC"
  5368. const m_AF_AX25 = "PF_AX25"
  5369. const m_AF_BLUETOOTH = "PF_BLUETOOTH"
  5370. const m_AF_BRIDGE = "PF_BRIDGE"
  5371. const m_AF_CAIF = "PF_CAIF"
  5372. const m_AF_CAN = "PF_CAN"
  5373. const m_AF_DECnet = "PF_DECnet"
  5374. const m_AF_ECONET = "PF_ECONET"
  5375. const m_AF_FILE = "AF_LOCAL"
  5376. const m_AF_IB = "PF_IB"
  5377. const m_AF_IEEE802154 = "PF_IEEE802154"
  5378. const m_AF_INET = "PF_INET"
  5379. const m_AF_INET6 = "PF_INET6"
  5380. const m_AF_IPX = "PF_IPX"
  5381. const m_AF_IRDA = "PF_IRDA"
  5382. const m_AF_ISDN = "PF_ISDN"
  5383. const m_AF_IUCV = "PF_IUCV"
  5384. const m_AF_KCM = "PF_KCM"
  5385. const m_AF_KEY = "PF_KEY"
  5386. const m_AF_LLC = "PF_LLC"
  5387. const m_AF_LOCAL = "PF_LOCAL"
  5388. const m_AF_MAX = "PF_MAX"
  5389. const m_AF_MPLS = "PF_MPLS"
  5390. const m_AF_NETBEUI = "PF_NETBEUI"
  5391. const m_AF_NETLINK = "PF_NETLINK"
  5392. const m_AF_NETROM = "PF_NETROM"
  5393. const m_AF_NFC = "PF_NFC"
  5394. const m_AF_PACKET = "PF_PACKET"
  5395. const m_AF_PHONET = "PF_PHONET"
  5396. const m_AF_PPPOX = "PF_PPPOX"
  5397. const m_AF_QIPCRTR = "PF_QIPCRTR"
  5398. const m_AF_RDS = "PF_RDS"
  5399. const m_AF_ROSE = "PF_ROSE"
  5400. const m_AF_ROUTE = "PF_ROUTE"
  5401. const m_AF_RXRPC = "PF_RXRPC"
  5402. const m_AF_SECURITY = "PF_SECURITY"
  5403. const m_AF_SMC = "PF_SMC"
  5404. const m_AF_SNA = "PF_SNA"
  5405. const m_AF_TIPC = "PF_TIPC"
  5406. const m_AF_UNIX = "AF_LOCAL"
  5407. const m_AF_UNSPEC = "PF_UNSPEC"
  5408. const m_AF_VSOCK = "PF_VSOCK"
  5409. const m_AF_WANPIPE = "PF_WANPIPE"
  5410. const m_AF_X25 = "PF_X25"
  5411. const m_AF_XDP = "PF_XDP"
  5412. const m_INT_MAX2 = 0x7fffffff
  5413. const m_MSG_BATCH = 0x40000
  5414. const m_MSG_CMSG_CLOEXEC = 0x40000000
  5415. const m_MSG_CONFIRM = 0x0800
  5416. const m_MSG_CTRUNC = 0x0008
  5417. const m_MSG_DONTROUTE = 0x0004
  5418. const m_MSG_DONTWAIT = 0x0040
  5419. const m_MSG_EOR = 0x0080
  5420. const m_MSG_ERRQUEUE = 0x2000
  5421. const m_MSG_FASTOPEN = 0x20000000
  5422. const m_MSG_FIN = 0x0200
  5423. const m_MSG_MORE = 0x8000
  5424. const m_MSG_NOSIGNAL = 0x4000
  5425. const m_MSG_OOB = 0x0001
  5426. const m_MSG_PEEK = 0x0002
  5427. const m_MSG_PROXY = 0x0010
  5428. const m_MSG_RST = 0x1000
  5429. const m_MSG_SYN = 0x0400
  5430. const m_MSG_TRUNC = 0x0020
  5431. const m_MSG_WAITALL = 0x0100
  5432. const m_MSG_WAITFORONE = 0x10000
  5433. const m_MSG_ZEROCOPY = 0x4000000
  5434. const m_PF_ALG = 38
  5435. const m_PF_APPLETALK = 5
  5436. const m_PF_ASH = 18
  5437. const m_PF_ATMPVC = 8
  5438. const m_PF_ATMSVC = 20
  5439. const m_PF_AX25 = 3
  5440. const m_PF_BLUETOOTH = 31
  5441. const m_PF_BRIDGE = 7
  5442. const m_PF_CAIF = 37
  5443. const m_PF_CAN = 29
  5444. const m_PF_DECnet = 12
  5445. const m_PF_ECONET = 19
  5446. const m_PF_FILE = "PF_LOCAL"
  5447. const m_PF_IB = 27
  5448. const m_PF_IEEE802154 = 36
  5449. const m_PF_INET = 2
  5450. const m_PF_INET6 = 10
  5451. const m_PF_IPX = 4
  5452. const m_PF_IRDA = 23
  5453. const m_PF_ISDN = 34
  5454. const m_PF_IUCV = 32
  5455. const m_PF_KCM = 41
  5456. const m_PF_KEY = 15
  5457. const m_PF_LLC = 26
  5458. const m_PF_LOCAL = 1
  5459. const m_PF_MAX = 45
  5460. const m_PF_MPLS = 28
  5461. const m_PF_NETBEUI = 13
  5462. const m_PF_NETLINK = 16
  5463. const m_PF_NETROM = 6
  5464. const m_PF_NFC = 39
  5465. const m_PF_PACKET = 17
  5466. const m_PF_PHONET = 35
  5467. const m_PF_PPPOX = 24
  5468. const m_PF_QIPCRTR = 42
  5469. const m_PF_RDS = 21
  5470. const m_PF_ROSE = 11
  5471. const m_PF_ROUTE = "PF_NETLINK"
  5472. const m_PF_RXRPC = 33
  5473. const m_PF_SECURITY = 14
  5474. const m_PF_SMC = 43
  5475. const m_PF_SNA = 22
  5476. const m_PF_TIPC = 30
  5477. const m_PF_UNIX = "PF_LOCAL"
  5478. const m_PF_UNSPEC = 0
  5479. const m_PF_VSOCK = 40
  5480. const m_PF_WANPIPE = 25
  5481. const m_PF_X25 = 9
  5482. const m_PF_XDP = 44
  5483. const m_SCM_CREDENTIALS = 0x02
  5484. const m_SCM_RIGHTS = 0x01
  5485. const m_SCM_TIMESTAMP = "SO_TIMESTAMP"
  5486. const m_SCM_TIMESTAMPING = "SO_TIMESTAMPING"
  5487. const m_SCM_TIMESTAMPING_OPT_STATS = 54
  5488. const m_SCM_TIMESTAMPING_PKTINFO = 58
  5489. const m_SCM_TIMESTAMPNS = "SO_TIMESTAMPNS"
  5490. const m_SCM_TXTIME = "SO_TXTIME"
  5491. const m_SCM_WIFI_STATUS = "SO_WIFI_STATUS"
  5492. const m_SHUT_RD = 0
  5493. const m_SHUT_RDWR = 2
  5494. const m_SHUT_WR = 1
  5495. const m_SOCK_CLOEXEC = 02000000
  5496. const m_SOCK_DCCP = 6
  5497. const m_SOCK_DGRAM = 2
  5498. const m_SOCK_NONBLOCK = 04000
  5499. const m_SOCK_PACKET = 10
  5500. const m_SOCK_RAW = 3
  5501. const m_SOCK_RDM = 4
  5502. const m_SOCK_SEQPACKET = 5
  5503. const m_SOCK_STREAM = 1
  5504. const m_SOL_AAL = 265
  5505. const m_SOL_ALG = 279
  5506. const m_SOL_ATM = 264
  5507. const m_SOL_BLUETOOTH = 274
  5508. const m_SOL_CAIF = 278
  5509. const m_SOL_DCCP = 269
  5510. const m_SOL_DECNET = 261
  5511. const m_SOL_ICMPV6 = 58
  5512. const m_SOL_IP = 0
  5513. const m_SOL_IPV6 = 41
  5514. const m_SOL_IRDA = 266
  5515. const m_SOL_IUCV = 277
  5516. const m_SOL_KCM = 281
  5517. const m_SOL_LLC = 268
  5518. const m_SOL_NETBEUI = 267
  5519. const m_SOL_NETLINK = 270
  5520. const m_SOL_NFC = 280
  5521. const m_SOL_PACKET = 263
  5522. const m_SOL_PNPIPE = 275
  5523. const m_SOL_PPPOL2TP = 273
  5524. const m_SOL_RAW = 255
  5525. const m_SOL_RDS = 276
  5526. const m_SOL_RXRPC = 272
  5527. const m_SOL_SOCKET = 1
  5528. const m_SOL_TIPC = 271
  5529. const m_SOL_TLS = 282
  5530. const m_SOL_X25 = 262
  5531. const m_SOL_XDP = 283
  5532. const m_SOMAXCONN = 128
  5533. const m_SO_ACCEPTCONN = 30
  5534. const m_SO_ATTACH_BPF = 50
  5535. const m_SO_ATTACH_FILTER = 26
  5536. const m_SO_ATTACH_REUSEPORT_CBPF = 51
  5537. const m_SO_ATTACH_REUSEPORT_EBPF = 52
  5538. const m_SO_BINDTODEVICE = 25
  5539. const m_SO_BINDTOIFINDEX = 62
  5540. const m_SO_BPF_EXTENSIONS = 48
  5541. const m_SO_BROADCAST = 6
  5542. const m_SO_BSDCOMPAT = 14
  5543. const m_SO_BUSY_POLL = 46
  5544. const m_SO_BUSY_POLL_BUDGET = 70
  5545. const m_SO_CNX_ADVICE = 53
  5546. const m_SO_COOKIE = 57
  5547. const m_SO_DEBUG = 1
  5548. const m_SO_DETACH_BPF = "SO_DETACH_FILTER"
  5549. const m_SO_DETACH_FILTER = 27
  5550. const m_SO_DETACH_REUSEPORT_BPF = 68
  5551. const m_SO_DOMAIN = 39
  5552. const m_SO_DONTROUTE = 5
  5553. const m_SO_ERROR = 4
  5554. const m_SO_GET_FILTER = "SO_ATTACH_FILTER"
  5555. const m_SO_INCOMING_CPU = 49
  5556. const m_SO_INCOMING_NAPI_ID = 56
  5557. const m_SO_KEEPALIVE = 9
  5558. const m_SO_LINGER = 13
  5559. const m_SO_LOCK_FILTER = 44
  5560. const m_SO_MARK = 36
  5561. const m_SO_MAX_PACING_RATE = 47
  5562. const m_SO_MEMINFO = 55
  5563. const m_SO_NOFCS = 43
  5564. const m_SO_NO_CHECK = 11
  5565. const m_SO_OOBINLINE = 10
  5566. const m_SO_PASSCRED = 16
  5567. const m_SO_PASSSEC = 34
  5568. const m_SO_PEEK_OFF = 42
  5569. const m_SO_PEERCRED = 17
  5570. const m_SO_PEERGROUPS = 59
  5571. const m_SO_PEERNAME = 28
  5572. const m_SO_PEERSEC = 31
  5573. const m_SO_PREFER_BUSY_POLL = 69
  5574. const m_SO_PRIORITY = 12
  5575. const m_SO_PROTOCOL = 38
  5576. const m_SO_RCVBUF = 8
  5577. const m_SO_RCVBUFFORCE = 33
  5578. const m_SO_RCVLOWAT = 18
  5579. const m_SO_RCVTIMEO = 20
  5580. const m_SO_REUSEADDR = 2
  5581. const m_SO_REUSEPORT = 15
  5582. const m_SO_RXQ_OVFL = 40
  5583. const m_SO_SECURITY_AUTHENTICATION = 22
  5584. const m_SO_SECURITY_ENCRYPTION_NETWORK = 24
  5585. const m_SO_SECURITY_ENCRYPTION_TRANSPORT = 23
  5586. const m_SO_SELECT_ERR_QUEUE = 45
  5587. const m_SO_SNDBUF = 7
  5588. const m_SO_SNDBUFFORCE = 32
  5589. const m_SO_SNDLOWAT = 19
  5590. const m_SO_SNDTIMEO = 21
  5591. const m_SO_TIMESTAMP = 29
  5592. const m_SO_TIMESTAMPING = 37
  5593. const m_SO_TIMESTAMPNS = 35
  5594. const m_SO_TXTIME = 61
  5595. const m_SO_TYPE = 3
  5596. const m_SO_WIFI_STATUS = 41
  5597. const m_SO_ZEROCOPY = 60
  5598. const m_UINT_MAX2 = 0xffffffff
  5599. type Tsocklen_t = uint32
  5600. type Tsa_family_t = uint16
  5601. type Tmsghdr = struct {
  5602. Fmsg_name uintptr
  5603. Fmsg_namelen Tsocklen_t
  5604. Fmsg_iov uintptr
  5605. Fmsg_iovlen int32
  5606. F__pad1 int32
  5607. Fmsg_control uintptr
  5608. Fmsg_controllen Tsocklen_t
  5609. F__pad2 int32
  5610. Fmsg_flags int32
  5611. }
  5612. type Tcmsghdr = struct {
  5613. Fcmsg_len Tsocklen_t
  5614. F__pad1 int32
  5615. Fcmsg_level int32
  5616. Fcmsg_type int32
  5617. }
  5618. type Tucred = struct {
  5619. Fpid Tpid_t
  5620. Fuid Tuid_t
  5621. Fgid Tgid_t
  5622. }
  5623. type Tmmsghdr = struct {
  5624. Fmsg_hdr Tmsghdr
  5625. Fmsg_len uint32
  5626. }
  5627. type Tlinger = struct {
  5628. Fl_onoff int32
  5629. Fl_linger int32
  5630. }
  5631. type Tsockaddr = struct {
  5632. Fsa_family Tsa_family_t
  5633. Fsa_data [14]int8
  5634. }
  5635. type Tsockaddr_storage = struct {
  5636. Fss_family Tsa_family_t
  5637. F__ss_padding [118]int8
  5638. F__ss_align uint64
  5639. }
  5640. type Tsockaddr_un = struct {
  5641. Fsun_family Tsa_family_t
  5642. Fsun_path [108]int8
  5643. }
  5644. // C documentation
  5645. //
  5646. // /* Linux and OpenBSD */
  5647. func Xgetpeereid(tls *libc.TLS, s int32, euid uintptr, egid uintptr) (r int32) {
  5648. bp := tls.Alloc(16)
  5649. defer tls.Free(16)
  5650. var ret int32
  5651. var _ /* cred at bp+0 */ Tucred
  5652. var _ /* credlen at bp+12 */ Tsocklen_t
  5653. _ = ret
  5654. *(*Tsocklen_t)(unsafe.Pointer(bp + 12)) = uint32(12)
  5655. ret = libc.Xgetsockopt(tls, s, int32(m_SOL_SOCKET), int32(m_SO_PEERCRED), bp, bp+12)
  5656. if ret != 0 {
  5657. return ret
  5658. }
  5659. *(*Tuid_t)(unsafe.Pointer(euid)) = (*(*Tucred)(unsafe.Pointer(bp))).Fuid
  5660. *(*Tgid_t)(unsafe.Pointer(egid)) = (*(*Tucred)(unsafe.Pointer(bp))).Fgid
  5661. return 0
  5662. }
  5663. const m_INT64_MAX1 = 9223372036854775807
  5664. func Xdehumanize_number(tls *libc.TLS, buf uintptr, num uintptr) (r int32) {
  5665. bp := tls.Alloc(16)
  5666. defer tls.Free(16)
  5667. var rc, sign, v1, v2 int32
  5668. var rmax Tuint64_t
  5669. var _ /* rval at bp+0 */ Tuint64_t
  5670. _, _, _, _, _ = rc, rmax, sign, v1, v2
  5671. sign = +libc.Int32FromInt32(1)
  5672. /* The current expand_number() implementation uses bit shifts, so
  5673. * we cannot pass negative numbers, preserve the sign and apply it
  5674. * later. */
  5675. for {
  5676. v1 = int32(*(*int8)(unsafe.Pointer(buf)))
  5677. v2 = libc.BoolInt32(v1 == int32(' ') || libc.Uint32FromInt32(v1)-uint32('\t') < uint32(5))
  5678. goto _3
  5679. _3:
  5680. if !(v2 != 0) {
  5681. break
  5682. }
  5683. buf++
  5684. }
  5685. if int32(*(*int8)(unsafe.Pointer(buf))) == int32('-') {
  5686. sign = -int32(1)
  5687. buf++
  5688. }
  5689. rc = Xexpand_number(tls, buf, bp)
  5690. if rc < 0 {
  5691. return rc
  5692. }
  5693. /* The sign has been stripped, so rval has the absolute value.
  5694. * Error out, regardless of the sign, if rval is greater than
  5695. * abs(INT64_MIN) (== INT64_MAX + 1), or if the sign is positive
  5696. * and the value has overflown by one (INT64_MAX + 1). */
  5697. rmax = uint64(libc.Uint64FromInt64(libc.Int64FromInt64(m_INT64_MAX1)) + libc.Uint64FromUint64(1))
  5698. if *(*Tuint64_t)(unsafe.Pointer(bp)) > rmax || *(*Tuint64_t)(unsafe.Pointer(bp)) == rmax && sign == +libc.Int32FromInt32(1) {
  5699. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ERANGE)
  5700. return -int32(1)
  5701. }
  5702. *(*Tint64_t)(unsafe.Pointer(num)) = libc.Int64FromUint64(*(*Tuint64_t)(unsafe.Pointer(bp)) * libc.Uint64FromInt32(sign))
  5703. return 0
  5704. }
  5705. const m_HN_AUTOSCALE1 = 32
  5706. const m_HN_B1 = 4
  5707. const m_HN_DECIMAL1 = 1
  5708. const m_HN_DIVISOR_10001 = 8
  5709. const m_HN_GETSCALE1 = 16
  5710. const m_HN_IEC_PREFIXES1 = 16
  5711. const m_HN_NOSPACE1 = 2
  5712. const m_INT64_MAX2 = 0x7fffffffffffffff
  5713. const m_LC_ALL = 6
  5714. const m_LC_ALL_MASK = 0x7fffffff
  5715. const m_LC_COLLATE = 3
  5716. const m_LC_CTYPE = 0
  5717. const m_LC_MESSAGES = 5
  5718. const m_LC_MONETARY = 4
  5719. const m_LC_NUMERIC = 1
  5720. const m_LC_TIME = 2
  5721. type Tlconv = struct {
  5722. Fdecimal_point uintptr
  5723. Fthousands_sep uintptr
  5724. Fgrouping uintptr
  5725. Fint_curr_symbol uintptr
  5726. Fcurrency_symbol uintptr
  5727. Fmon_decimal_point uintptr
  5728. Fmon_thousands_sep uintptr
  5729. Fmon_grouping uintptr
  5730. Fpositive_sign uintptr
  5731. Fnegative_sign uintptr
  5732. Fint_frac_digits int8
  5733. Ffrac_digits int8
  5734. Fp_cs_precedes int8
  5735. Fp_sep_by_space int8
  5736. Fn_cs_precedes int8
  5737. Fn_sep_by_space int8
  5738. Fp_sign_posn int8
  5739. Fn_sign_posn int8
  5740. Fint_p_cs_precedes int8
  5741. Fint_p_sep_by_space int8
  5742. Fint_n_cs_precedes int8
  5743. Fint_n_sep_by_space int8
  5744. Fint_p_sign_posn int8
  5745. Fint_n_sign_posn int8
  5746. }
  5747. /*
  5748. * Copyright (c) 1996 Peter Wemm <peter@FreeBSD.org>.
  5749. * All rights reserved.
  5750. * Copyright (c) 2002 Networks Associates Technology, Inc.
  5751. * All rights reserved.
  5752. *
  5753. * Portions of this software were developed for the FreeBSD Project by
  5754. * ThinkSec AS and NAI Labs, the Security Research Division of Network
  5755. * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
  5756. * ("CBOSS"), as part of the DARPA CHATS research program.
  5757. *
  5758. * Redistribution and use in source and binary forms, with or without
  5759. * modification, is permitted provided that the following conditions
  5760. * are met:
  5761. * 1. Redistributions of source code must retain the above copyright
  5762. * notice, this list of conditions and the following disclaimer.
  5763. * 2. Redistributions in binary form must reproduce the above copyright
  5764. * notice, this list of conditions and the following disclaimer in the
  5765. * documentation and/or other materials provided with the distribution.
  5766. * 3. The name of the author may not be used to endorse or promote
  5767. * products derived from this software without specific prior written
  5768. * permission.
  5769. *
  5770. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  5771. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  5772. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  5773. * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  5774. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  5775. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  5776. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  5777. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  5778. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  5779. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  5780. * SUCH DAMAGE.
  5781. *
  5782. * $FreeBSD: src/lib/libutil/libutil.h,v 1.47 2008/04/23 00:49:12 scf Exp $
  5783. */
  5784. var _maxscale = int32(6)
  5785. func Xhumanize_number(tls *libc.TLS, buf uintptr, len1 Tsize_t, quotient Tint64_t, suffix uintptr, scale int32, flags int32) (r1 int32) {
  5786. bp := tls.Alloc(64)
  5787. defer tls.Free(64)
  5788. var baselen Tsize_t
  5789. var divisor, max Tint64_t
  5790. var divisordeccut, i, r, remainder, s1, s2, sign, v2 int32
  5791. var prefixes, sep uintptr
  5792. _, _, _, _, _, _, _, _, _, _, _, _, _ = baselen, divisor, divisordeccut, i, max, prefixes, r, remainder, s1, s2, sep, sign, v2
  5793. /* Since so many callers don't check -1, NUL terminate the buffer */
  5794. if len1 > uint64(0) {
  5795. *(*int8)(unsafe.Pointer(buf)) = int8('\000')
  5796. }
  5797. /* validate args */
  5798. if buf == libc.UintptrFromInt32(0) || suffix == libc.UintptrFromInt32(0) {
  5799. return -int32(1)
  5800. }
  5801. if scale < 0 {
  5802. return -int32(1)
  5803. } else {
  5804. if scale > _maxscale && scale & ^(libc.Int32FromInt32(m_HN_AUTOSCALE1)|libc.Int32FromInt32(m_HN_GETSCALE1)) != 0 {
  5805. return -int32(1)
  5806. }
  5807. }
  5808. if flags&int32(m_HN_DIVISOR_10001) != 0 && flags&int32(m_HN_IEC_PREFIXES1) != 0 {
  5809. return -int32(1)
  5810. }
  5811. /* setup parameters */
  5812. remainder = 0
  5813. if flags&int32(m_HN_IEC_PREFIXES1) != 0 {
  5814. baselen = uint64(2)
  5815. /*
  5816. * Use the prefixes for power of two recommended by
  5817. * the International Electrotechnical Commission
  5818. * (IEC) in IEC 80000-3 (i.e. Ki, Mi, Gi...).
  5819. *
  5820. * HN_IEC_PREFIXES implies a divisor of 1024 here
  5821. * (use of HN_DIVISOR_1000 would have triggered
  5822. * an assertion earlier).
  5823. */
  5824. divisor = int64(1024)
  5825. divisordeccut = int32(973) /* ceil(.95 * 1024) */
  5826. if flags&int32(m_HN_B1) != 0 {
  5827. prefixes = __ccgo_ts + 163
  5828. } else {
  5829. prefixes = __ccgo_ts + 184
  5830. }
  5831. } else {
  5832. baselen = uint64(1)
  5833. if flags&int32(m_HN_DIVISOR_10001) != 0 {
  5834. divisor = int64(1000)
  5835. divisordeccut = int32(950)
  5836. if flags&int32(m_HN_B1) != 0 {
  5837. prefixes = __ccgo_ts + 205
  5838. } else {
  5839. prefixes = __ccgo_ts + 225
  5840. }
  5841. } else {
  5842. divisor = int64(1024)
  5843. divisordeccut = int32(973) /* ceil(.95 * 1024) */
  5844. if flags&int32(m_HN_B1) != 0 {
  5845. prefixes = __ccgo_ts + 245
  5846. } else {
  5847. prefixes = __ccgo_ts + 265
  5848. }
  5849. }
  5850. }
  5851. if quotient < 0 {
  5852. sign = -int32(1)
  5853. quotient = -quotient
  5854. baselen += uint64(2) /* sign, digit */
  5855. } else {
  5856. sign = int32(1)
  5857. baselen += uint64(1) /* digit */
  5858. }
  5859. if flags&int32(m_HN_NOSPACE1) != 0 {
  5860. sep = __ccgo_ts + 60
  5861. } else {
  5862. sep = __ccgo_ts + 285
  5863. baselen++
  5864. }
  5865. baselen += libc.Xstrlen(tls, suffix)
  5866. /* Check if enough room for `x y' + suffix + `\0' */
  5867. if len1 < baselen+uint64(1) {
  5868. return -int32(1)
  5869. }
  5870. if scale&(libc.Int32FromInt32(m_HN_AUTOSCALE1)|libc.Int32FromInt32(m_HN_GETSCALE1)) != 0 {
  5871. /* See if there is additional columns can be used. */
  5872. max = int64(1)
  5873. i = libc.Int32FromUint64(len1 - baselen)
  5874. for {
  5875. v2 = i
  5876. i--
  5877. if !(v2 > 0) {
  5878. break
  5879. }
  5880. max *= int64(10)
  5881. goto _1
  5882. _1:
  5883. }
  5884. /*
  5885. * Divide the number until it fits the given column.
  5886. * If there will be an overflow by the rounding below,
  5887. * divide once more.
  5888. */
  5889. i = 0
  5890. for {
  5891. if !((quotient >= max || quotient == max-int64(1) && (remainder >= divisordeccut || int64(remainder) >= divisor/int64(2))) && i < _maxscale) {
  5892. break
  5893. }
  5894. remainder = int32(quotient % divisor)
  5895. quotient /= divisor
  5896. goto _3
  5897. _3:
  5898. ;
  5899. i++
  5900. }
  5901. if scale&int32(m_HN_GETSCALE1) != 0 {
  5902. return i
  5903. }
  5904. } else {
  5905. i = 0
  5906. for {
  5907. if !(i < scale && i < _maxscale) {
  5908. break
  5909. }
  5910. remainder = int32(quotient % divisor)
  5911. quotient /= divisor
  5912. goto _4
  5913. _4:
  5914. ;
  5915. i++
  5916. }
  5917. }
  5918. /* If a value <= 9.9 after rounding and ... */
  5919. /*
  5920. * XXX - should we make sure there is enough space for the decimal
  5921. * place and if not, don't do HN_DECIMAL?
  5922. */
  5923. if (quotient == int64(9) && remainder < divisordeccut || quotient < int64(9)) && i > 0 && flags&int32(m_HN_DECIMAL1) != 0 {
  5924. s1 = int32(int64(int32(quotient)) + (int64(remainder*int32(10))+divisor/int64(2))/divisor/int64(10))
  5925. s2 = int32((int64(remainder*int32(10)) + divisor/int64(2)) / divisor % int64(10))
  5926. r = libc.X__builtin_snprintf(tls, buf, len1, __ccgo_ts+287, libc.VaList(bp+8, sign*s1, (*Tlconv)(unsafe.Pointer(libc.Xlocaleconv(tls))).Fdecimal_point, s2, sep, prefixes+uintptr(i*int32(3)), suffix))
  5927. } else {
  5928. r = libc.X__builtin_snprintf(tls, buf, len1, __ccgo_ts+300, libc.VaList(bp+8, int64(sign)*(quotient+(int64(remainder)+divisor/int64(2))/divisor), sep, prefixes+uintptr(i*int32(3)), suffix))
  5929. }
  5930. return r
  5931. }
  5932. const m_HN_AUTOSCALE2 = 0x20
  5933. const m_HN_B2 = 0x04
  5934. const m_HN_DECIMAL2 = 0x01
  5935. const m_HN_DIVISOR_10002 = 0x08
  5936. const m_HN_GETSCALE2 = 0x10
  5937. const m_HN_IEC_PREFIXES2 = 0x10
  5938. const m_HN_NOSPACE2 = 0x02
  5939. const m_INET6_ADDRSTRLEN = 46
  5940. const m_INET_ADDRSTRLEN = 16
  5941. const m_IN_CLASSA_MAX = 128
  5942. const m_IN_CLASSA_NET = 0xff000000
  5943. const m_IN_CLASSA_NSHIFT = 24
  5944. const m_IN_CLASSB_MAX = 65536
  5945. const m_IN_CLASSB_NET = 0xffff0000
  5946. const m_IN_CLASSB_NSHIFT = 16
  5947. const m_IN_CLASSC_NET = 0xffffff00
  5948. const m_IN_CLASSC_NSHIFT = 8
  5949. const m_IN_LOOPBACKNET = 127
  5950. const m_IPPORT_RESERVED = 1024
  5951. const m_IPPROTO_AH = 51
  5952. const m_IPPROTO_BEETPH = 94
  5953. const m_IPPROTO_COMP = 108
  5954. const m_IPPROTO_DCCP = 33
  5955. const m_IPPROTO_DSTOPTS = 60
  5956. const m_IPPROTO_EGP = 8
  5957. const m_IPPROTO_ENCAP = 98
  5958. const m_IPPROTO_ESP = 50
  5959. const m_IPPROTO_ETHERNET = 143
  5960. const m_IPPROTO_FRAGMENT = 44
  5961. const m_IPPROTO_GRE = 47
  5962. const m_IPPROTO_HOPOPTS = 0
  5963. const m_IPPROTO_ICMP = 1
  5964. const m_IPPROTO_ICMPV6 = 58
  5965. const m_IPPROTO_IDP = 22
  5966. const m_IPPROTO_IGMP = 2
  5967. const m_IPPROTO_IP = 0
  5968. const m_IPPROTO_IPIP = 4
  5969. const m_IPPROTO_IPV6 = 41
  5970. const m_IPPROTO_MAX = 263
  5971. const m_IPPROTO_MH = 135
  5972. const m_IPPROTO_MPLS = 137
  5973. const m_IPPROTO_MPTCP = 262
  5974. const m_IPPROTO_MTP = 92
  5975. const m_IPPROTO_NONE = 59
  5976. const m_IPPROTO_PIM = 103
  5977. const m_IPPROTO_PUP = 12
  5978. const m_IPPROTO_RAW = 255
  5979. const m_IPPROTO_ROUTING = 43
  5980. const m_IPPROTO_RSVP = 46
  5981. const m_IPPROTO_SCTP = 132
  5982. const m_IPPROTO_TCP = 6
  5983. const m_IPPROTO_TP = 29
  5984. const m_IPPROTO_UDP = 17
  5985. const m_IPPROTO_UDPLITE = 136
  5986. const m_IPV6_2292DSTOPTS = 4
  5987. const m_IPV6_2292HOPLIMIT = 8
  5988. const m_IPV6_2292HOPOPTS = 3
  5989. const m_IPV6_2292PKTINFO = 2
  5990. const m_IPV6_2292PKTOPTIONS = 6
  5991. const m_IPV6_2292RTHDR = 5
  5992. const m_IPV6_ADDRFORM = 1
  5993. const m_IPV6_ADDR_PREFERENCES = 72
  5994. const m_IPV6_ADD_MEMBERSHIP = "IPV6_JOIN_GROUP"
  5995. const m_IPV6_AUTHHDR = 10
  5996. const m_IPV6_AUTOFLOWLABEL = 70
  5997. const m_IPV6_CHECKSUM = 7
  5998. const m_IPV6_DONTFRAG = 62
  5999. const m_IPV6_DROP_MEMBERSHIP = "IPV6_LEAVE_GROUP"
  6000. const m_IPV6_DSTOPTS = 59
  6001. const m_IPV6_FREEBIND = 78
  6002. const m_IPV6_HDRINCL = 36
  6003. const m_IPV6_HOPLIMIT = 52
  6004. const m_IPV6_HOPOPTS = 54
  6005. const m_IPV6_IPSEC_POLICY = 34
  6006. const m_IPV6_JOIN_ANYCAST = 27
  6007. const m_IPV6_JOIN_GROUP = 20
  6008. const m_IPV6_LEAVE_ANYCAST = 28
  6009. const m_IPV6_LEAVE_GROUP = 21
  6010. const m_IPV6_MINHOPCOUNT = 73
  6011. const m_IPV6_MTU = 24
  6012. const m_IPV6_MTU_DISCOVER = 23
  6013. const m_IPV6_MULTICAST_ALL = 29
  6014. const m_IPV6_MULTICAST_HOPS = 18
  6015. const m_IPV6_MULTICAST_IF = 17
  6016. const m_IPV6_MULTICAST_LOOP = 19
  6017. const m_IPV6_NEXTHOP = 9
  6018. const m_IPV6_ORIGDSTADDR = 74
  6019. const m_IPV6_PATHMTU = 61
  6020. const m_IPV6_PKTINFO = 50
  6021. const m_IPV6_PMTUDISC_DO = 2
  6022. const m_IPV6_PMTUDISC_DONT = 0
  6023. const m_IPV6_PMTUDISC_INTERFACE = 4
  6024. const m_IPV6_PMTUDISC_OMIT = 5
  6025. const m_IPV6_PMTUDISC_PROBE = 3
  6026. const m_IPV6_PMTUDISC_WANT = 1
  6027. const m_IPV6_PREFER_SRC_CGA = 0x0008
  6028. const m_IPV6_PREFER_SRC_COA = 0x0004
  6029. const m_IPV6_PREFER_SRC_HOME = 0x0400
  6030. const m_IPV6_PREFER_SRC_NONCGA = 0x0800
  6031. const m_IPV6_PREFER_SRC_PUBLIC = 0x0002
  6032. const m_IPV6_PREFER_SRC_PUBTMP_DEFAULT = 0x0100
  6033. const m_IPV6_PREFER_SRC_TMP = 0x0001
  6034. const m_IPV6_RECVDSTOPTS = 58
  6035. const m_IPV6_RECVERR = 25
  6036. const m_IPV6_RECVFRAGSIZE = 77
  6037. const m_IPV6_RECVHOPLIMIT = 51
  6038. const m_IPV6_RECVHOPOPTS = 53
  6039. const m_IPV6_RECVORIGDSTADDR = "IPV6_ORIGDSTADDR"
  6040. const m_IPV6_RECVPATHMTU = 60
  6041. const m_IPV6_RECVPKTINFO = 49
  6042. const m_IPV6_RECVRTHDR = 56
  6043. const m_IPV6_RECVTCLASS = 66
  6044. const m_IPV6_ROUTER_ALERT = 22
  6045. const m_IPV6_ROUTER_ALERT_ISOLATE = 30
  6046. const m_IPV6_RTHDR = 57
  6047. const m_IPV6_RTHDRDSTOPTS = 55
  6048. const m_IPV6_RTHDR_LOOSE = 0
  6049. const m_IPV6_RTHDR_STRICT = 1
  6050. const m_IPV6_RTHDR_TYPE_0 = 0
  6051. const m_IPV6_RXDSTOPTS = "IPV6_DSTOPTS"
  6052. const m_IPV6_RXHOPOPTS = "IPV6_HOPOPTS"
  6053. const m_IPV6_TCLASS = 67
  6054. const m_IPV6_TRANSPARENT = 75
  6055. const m_IPV6_UNICAST_HOPS = 16
  6056. const m_IPV6_UNICAST_IF = 76
  6057. const m_IPV6_V6ONLY = 26
  6058. const m_IPV6_XFRM_POLICY = 35
  6059. const m_IP_ADD_MEMBERSHIP = 35
  6060. const m_IP_ADD_SOURCE_MEMBERSHIP = 39
  6061. const m_IP_BIND_ADDRESS_NO_PORT = 24
  6062. const m_IP_BLOCK_SOURCE = 38
  6063. const m_IP_CHECKSUM = 23
  6064. const m_IP_DEFAULT_MULTICAST_LOOP = 1
  6065. const m_IP_DEFAULT_MULTICAST_TTL = 1
  6066. const m_IP_DROP_MEMBERSHIP = 36
  6067. const m_IP_DROP_SOURCE_MEMBERSHIP = 40
  6068. const m_IP_FREEBIND = 15
  6069. const m_IP_HDRINCL = 3
  6070. const m_IP_IPSEC_POLICY = 16
  6071. const m_IP_MAX_MEMBERSHIPS = 20
  6072. const m_IP_MINTTL = 21
  6073. const m_IP_MSFILTER = 41
  6074. const m_IP_MTU = 14
  6075. const m_IP_MTU_DISCOVER = 10
  6076. const m_IP_MULTICAST_ALL = 49
  6077. const m_IP_MULTICAST_IF = 32
  6078. const m_IP_MULTICAST_LOOP = 34
  6079. const m_IP_MULTICAST_TTL = 33
  6080. const m_IP_NODEFRAG = 22
  6081. const m_IP_OPTIONS = 4
  6082. const m_IP_ORIGDSTADDR = 20
  6083. const m_IP_PASSSEC = 18
  6084. const m_IP_PKTINFO = 8
  6085. const m_IP_PKTOPTIONS = 9
  6086. const m_IP_PMTUDISC = 10
  6087. const m_IP_PMTUDISC_DO = 2
  6088. const m_IP_PMTUDISC_DONT = 0
  6089. const m_IP_PMTUDISC_INTERFACE = 4
  6090. const m_IP_PMTUDISC_OMIT = 5
  6091. const m_IP_PMTUDISC_PROBE = 3
  6092. const m_IP_PMTUDISC_WANT = 1
  6093. const m_IP_RECVERR = 11
  6094. const m_IP_RECVERR_RFC4884 = 26
  6095. const m_IP_RECVFRAGSIZE = 25
  6096. const m_IP_RECVOPTS = 6
  6097. const m_IP_RECVORIGDSTADDR = "IP_ORIGDSTADDR"
  6098. const m_IP_RECVRETOPTS = "IP_RETOPTS"
  6099. const m_IP_RECVTOS = 13
  6100. const m_IP_RECVTTL = 12
  6101. const m_IP_RETOPTS = 7
  6102. const m_IP_ROUTER_ALERT = 5
  6103. const m_IP_TOS = 1
  6104. const m_IP_TRANSPARENT = 19
  6105. const m_IP_TTL = 2
  6106. const m_IP_UNBLOCK_SOURCE = 37
  6107. const m_IP_UNICAST_IF = 50
  6108. const m_IP_XFRM_POLICY = 17
  6109. const m_MCAST_BLOCK_SOURCE = 43
  6110. const m_MCAST_EXCLUDE = 0
  6111. const m_MCAST_INCLUDE = 1
  6112. const m_MCAST_JOIN_GROUP = 42
  6113. const m_MCAST_JOIN_SOURCE_GROUP = 46
  6114. const m_MCAST_LEAVE_GROUP = 45
  6115. const m_MCAST_LEAVE_SOURCE_GROUP = 47
  6116. const m_MCAST_MSFILTER = 48
  6117. const m_MCAST_UNBLOCK_SOURCE = 44
  6118. const m___UAPI_DEF_IN6_ADDR = 0
  6119. const m___UAPI_DEF_IN6_ADDR_ALT = 0
  6120. const m___UAPI_DEF_IN6_PKTINFO = 0
  6121. const m___UAPI_DEF_IN_ADDR = 0
  6122. const m___UAPI_DEF_IN_CLASS = 0
  6123. const m___UAPI_DEF_IN_IPPROTO = 0
  6124. const m___UAPI_DEF_IN_PKTINFO = 0
  6125. const m___UAPI_DEF_IP6_MTUINFO = 0
  6126. const m___UAPI_DEF_IPPROTO_V6 = 0
  6127. const m___UAPI_DEF_IPV6_MREQ = 0
  6128. const m___UAPI_DEF_IPV6_OPTIONS = 0
  6129. const m___UAPI_DEF_IP_MREQ = 0
  6130. const m___UAPI_DEF_SOCKADDR_IN = 0
  6131. const m___UAPI_DEF_SOCKADDR_IN6 = 0
  6132. type Tin_port_t = uint16
  6133. type Tin_addr_t = uint32
  6134. type Tin_addr = struct {
  6135. Fs_addr Tin_addr_t
  6136. }
  6137. type Tsockaddr_in = struct {
  6138. Fsin_family Tsa_family_t
  6139. Fsin_port Tin_port_t
  6140. Fsin_addr Tin_addr
  6141. Fsin_zero [8]Tuint8_t
  6142. }
  6143. type Tin6_addr = struct {
  6144. F__in6_union struct {
  6145. F__s6_addr16 [0][8]Tuint16_t
  6146. F__s6_addr32 [0][4]Tuint32_t
  6147. F__s6_addr [16]Tuint8_t
  6148. }
  6149. }
  6150. type Tsockaddr_in6 = struct {
  6151. Fsin6_family Tsa_family_t
  6152. Fsin6_port Tin_port_t
  6153. Fsin6_flowinfo Tuint32_t
  6154. Fsin6_addr Tin6_addr
  6155. Fsin6_scope_id Tuint32_t
  6156. }
  6157. type Tipv6_mreq = struct {
  6158. Fipv6mr_multiaddr Tin6_addr
  6159. Fipv6mr_interface uint32
  6160. }
  6161. type Tip_opts = struct {
  6162. Fip_dst Tin_addr
  6163. Fip_opts [40]int8
  6164. }
  6165. type Tip_mreq = struct {
  6166. Fimr_multiaddr Tin_addr
  6167. Fimr_interface Tin_addr
  6168. }
  6169. type Tip_mreqn = struct {
  6170. Fimr_multiaddr Tin_addr
  6171. Fimr_address Tin_addr
  6172. Fimr_ifindex int32
  6173. }
  6174. type Tip_mreq_source = struct {
  6175. Fimr_multiaddr Tin_addr
  6176. Fimr_interface Tin_addr
  6177. Fimr_sourceaddr Tin_addr
  6178. }
  6179. type Tip_msfilter = struct {
  6180. Fimsf_multiaddr Tin_addr
  6181. Fimsf_interface Tin_addr
  6182. Fimsf_fmode Tuint32_t
  6183. Fimsf_numsrc Tuint32_t
  6184. Fimsf_slist [1]Tin_addr
  6185. }
  6186. type Tgroup_req = struct {
  6187. Fgr_interface Tuint32_t
  6188. Fgr_group Tsockaddr_storage
  6189. }
  6190. type Tgroup_source_req = struct {
  6191. Fgsr_interface Tuint32_t
  6192. Fgsr_group Tsockaddr_storage
  6193. Fgsr_source Tsockaddr_storage
  6194. }
  6195. type Tgroup_filter = struct {
  6196. Fgf_interface Tuint32_t
  6197. Fgf_group Tsockaddr_storage
  6198. Fgf_fmode Tuint32_t
  6199. Fgf_numsrc Tuint32_t
  6200. Fgf_slist [1]Tsockaddr_storage
  6201. }
  6202. type Tin_pktinfo = struct {
  6203. Fipi_ifindex int32
  6204. Fipi_spec_dst Tin_addr
  6205. Fipi_addr Tin_addr
  6206. }
  6207. type Tin6_pktinfo = struct {
  6208. Fipi6_addr Tin6_addr
  6209. Fipi6_ifindex uint32
  6210. }
  6211. type Tip6_mtuinfo = struct {
  6212. Fip6m_addr Tsockaddr_in6
  6213. Fip6m_mtu Tuint32_t
  6214. }
  6215. // C documentation
  6216. //
  6217. // /*
  6218. // * static int
  6219. // * inet_net_pton(af, src, dst, size)
  6220. // * convert network number from presentation to network format.
  6221. // * accepts hex octets, hex strings, decimal octets, and /CIDR.
  6222. // * "size" is in bytes and describes "dst".
  6223. // * return:
  6224. // * number of bits, either imputed classfully or specified with /CIDR,
  6225. // * or -1 if some failure occurred (check errno). ENOENT means it was
  6226. // * not a valid network specification.
  6227. // * author:
  6228. // * Paul Vixie (ISC), June 1996
  6229. // */
  6230. func Xinet_net_pton(tls *libc.TLS, af int32, src uintptr, dst uintptr, size Tsize_t) (r int32) {
  6231. switch af {
  6232. case int32(m_PF_INET):
  6233. return _inet_net_pton_ipv4(tls, src, dst, size)
  6234. default:
  6235. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EAFNOSUPPORT)
  6236. return -int32(1)
  6237. }
  6238. return r
  6239. }
  6240. // C documentation
  6241. //
  6242. // /*
  6243. // * static int
  6244. // * inet_net_pton_ipv4(src, dst, size)
  6245. // * convert IPv4 network number from presentation to network format.
  6246. // * accepts hex octets, hex strings, decimal octets, and /CIDR.
  6247. // * "size" is in bytes and describes "dst".
  6248. // * return:
  6249. // * number of bits, either imputed classfully or specified with /CIDR,
  6250. // * or -1 if some failure occurred (check errno). ENOENT means it was
  6251. // * not an IPv4 network specification.
  6252. // * note:
  6253. // * network byte order assumed. this means 192.5.5.240/28 has
  6254. // * 0x11110000 in its fourth octet.
  6255. // * author:
  6256. // * Paul Vixie (ISC), June 1996
  6257. // */
  6258. func _inet_net_pton_ipv4(tls *libc.TLS, src uintptr, dst uintptr, size Tsize_t) (r int32) {
  6259. var bits, ch, dirty, n, tmp, v10, v17, v2, v5 int32
  6260. var odst, v1, v11, v14, v15, v16, v18, v21, v3, v8, p4, p6 uintptr
  6261. var v13, v20, v7 Tsize_t
  6262. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bits, ch, dirty, n, odst, tmp, v1, v10, v11, v13, v14, v15, v16, v17, v18, v2, v20, v21, v3, v5, v7, v8, p4, p6
  6263. odst = dst
  6264. v1 = src
  6265. src++
  6266. ch = int32(*(*int8)(unsafe.Pointer(v1)))
  6267. if ch == int32('0') && (int32(*(*int8)(unsafe.Pointer(src))) == int32('x') || int32(*(*int8)(unsafe.Pointer(src))) == int32('X')) && libc.BoolInt32(libc.Uint32FromInt8(*(*int8)(unsafe.Pointer(src + 1))) < uint32(128)) != 0 && libc.Xisxdigit(tls, int32(*(*int8)(unsafe.Pointer(src + 1)))) != 0 {
  6268. /* Hexadecimal: Eat nybble string. */
  6269. if size <= uint64(0) {
  6270. goto emsgsize
  6271. }
  6272. *(*uint8)(unsafe.Pointer(dst)) = uint8(0)
  6273. dirty = libc.Int32FromInt32(0)
  6274. src++ /* skip x or X. */
  6275. for {
  6276. v3 = src
  6277. src++
  6278. v2 = int32(*(*int8)(unsafe.Pointer(v3)))
  6279. ch = v2
  6280. if !(v2 != int32('\000') && libc.BoolInt32(libc.Uint32FromInt32(ch) < uint32(128)) != 0 && libc.Xisxdigit(tls, ch) != 0) {
  6281. break
  6282. }
  6283. if libc.BoolInt32(libc.Uint32FromInt32(ch)-uint32('A') < uint32(26)) != 0 {
  6284. ch = libc.Xtolower(tls, ch)
  6285. }
  6286. n = int32(int64(libc.Xstrchr(tls, uintptr(unsafe.Pointer(&_xdigits)), ch)) - t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_xdigits))))
  6287. p4 = dst
  6288. *(*uint8)(unsafe.Pointer(p4)) = uint8(int32(*(*uint8)(unsafe.Pointer(p4))) | n)
  6289. v5 = dirty
  6290. dirty++
  6291. if !(v5 != 0) {
  6292. p6 = dst
  6293. *(*uint8)(unsafe.Pointer(p6)) = uint8(int32(*(*uint8)(unsafe.Pointer(p6))) << libc.Int32FromInt32(4))
  6294. } else {
  6295. v7 = size
  6296. size--
  6297. if v7 > uint64(0) {
  6298. dst++
  6299. v8 = dst
  6300. *(*uint8)(unsafe.Pointer(v8)) = uint8(0)
  6301. dirty = libc.Int32FromInt32(0)
  6302. } else {
  6303. goto emsgsize
  6304. }
  6305. }
  6306. }
  6307. if dirty != 0 {
  6308. size--
  6309. }
  6310. } else {
  6311. if libc.BoolInt32(libc.Uint32FromInt32(ch) < uint32(128)) != 0 && libc.BoolInt32(libc.Uint32FromInt32(ch)-uint32('0') < uint32(10)) != 0 {
  6312. /* Decimal: eat dotted digit string. */
  6313. for {
  6314. tmp = 0
  6315. for {
  6316. n = int32(int64(libc.Xstrchr(tls, uintptr(unsafe.Pointer(&_digits)), ch)) - t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_digits))))
  6317. tmp *= int32(10)
  6318. tmp += n
  6319. if tmp > int32(255) {
  6320. goto enoent
  6321. }
  6322. goto _12
  6323. _12:
  6324. ;
  6325. v11 = src
  6326. src++
  6327. v10 = int32(*(*int8)(unsafe.Pointer(v11)))
  6328. ch = v10
  6329. if !(v10 != int32('\000') && libc.BoolInt32(libc.Uint32FromInt32(ch) < uint32(128)) != 0 && libc.BoolInt32(libc.Uint32FromInt32(ch)-uint32('0') < uint32(10)) != 0) {
  6330. break
  6331. }
  6332. }
  6333. v13 = size
  6334. size--
  6335. if v13 <= uint64(0) {
  6336. goto emsgsize
  6337. }
  6338. v14 = dst
  6339. dst++
  6340. *(*uint8)(unsafe.Pointer(v14)) = libc.Uint8FromInt32(tmp)
  6341. if ch == int32('\000') || ch == int32('/') {
  6342. break
  6343. }
  6344. if ch != int32('.') {
  6345. goto enoent
  6346. }
  6347. v15 = src
  6348. src++
  6349. ch = int32(*(*int8)(unsafe.Pointer(v15)))
  6350. if !(libc.BoolInt32(libc.Uint32FromInt32(ch) < libc.Uint32FromInt32(128)) != 0) || !(libc.BoolInt32(libc.Uint32FromInt32(ch)-libc.Uint32FromUint8('0') < libc.Uint32FromInt32(10)) != 0) {
  6351. goto enoent
  6352. }
  6353. goto _9
  6354. _9:
  6355. }
  6356. } else {
  6357. goto enoent
  6358. }
  6359. }
  6360. bits = -int32(1)
  6361. if ch == int32('/') && libc.BoolInt32(libc.Uint32FromInt8(*(*int8)(unsafe.Pointer(src))) < uint32(128)) != 0 && libc.BoolInt32(libc.Uint32FromInt8(*(*int8)(unsafe.Pointer(src)))-uint32('0') < uint32(10)) != 0 && dst > odst {
  6362. /* CIDR width specifier. Nothing can follow it. */
  6363. v16 = src
  6364. src++
  6365. ch = int32(*(*int8)(unsafe.Pointer(v16))) /* Skip over the /. */
  6366. bits = 0
  6367. for {
  6368. n = int32(int64(libc.Xstrchr(tls, uintptr(unsafe.Pointer(&_digits)), ch)) - t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_digits))))
  6369. bits *= int32(10)
  6370. bits += n
  6371. goto _19
  6372. _19:
  6373. ;
  6374. v18 = src
  6375. src++
  6376. v17 = int32(*(*int8)(unsafe.Pointer(v18)))
  6377. ch = v17
  6378. if !(v17 != int32('\000') && libc.BoolInt32(libc.Uint32FromInt32(ch) < uint32(128)) != 0 && libc.BoolInt32(libc.Uint32FromInt32(ch)-uint32('0') < uint32(10)) != 0) {
  6379. break
  6380. }
  6381. }
  6382. if ch != int32('\000') {
  6383. goto enoent
  6384. }
  6385. if bits > int32(32) {
  6386. goto emsgsize
  6387. }
  6388. }
  6389. /* Firey death and destruction unless we prefetched EOS. */
  6390. if ch != int32('\000') {
  6391. goto enoent
  6392. }
  6393. /* If nothing was written to the destination, we found no address. */
  6394. if dst == odst {
  6395. goto enoent
  6396. }
  6397. /* If no CIDR spec was given, infer width from net class. */
  6398. if bits == -int32(1) {
  6399. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(odst))) >= int32(240) { /* Class E */
  6400. bits = int32(32)
  6401. } else {
  6402. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(odst))) >= int32(224) { /* Class D */
  6403. bits = int32(4)
  6404. } else {
  6405. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(odst))) >= int32(192) { /* Class C */
  6406. bits = int32(24)
  6407. } else {
  6408. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(odst))) >= int32(128) { /* Class B */
  6409. bits = int32(16)
  6410. } else { /* Class A */
  6411. bits = int32(8)
  6412. }
  6413. }
  6414. }
  6415. }
  6416. /* If imputed mask is narrower than specified octets, widen. */
  6417. if int64(bits) < (int64(dst)-int64(odst))*int64(8) {
  6418. bits = int32((int64(dst) - int64(odst)) * int64(8))
  6419. }
  6420. }
  6421. /* Extend network to cover the actual mask. */
  6422. for int64(bits) > (int64(dst)-int64(odst))*int64(8) {
  6423. v20 = size
  6424. size--
  6425. if v20 <= uint64(0) {
  6426. goto emsgsize
  6427. }
  6428. v21 = dst
  6429. dst++
  6430. *(*uint8)(unsafe.Pointer(v21)) = uint8('\000')
  6431. }
  6432. return bits
  6433. goto enoent
  6434. enoent:
  6435. ;
  6436. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOENT)
  6437. return -int32(1)
  6438. goto emsgsize
  6439. emsgsize:
  6440. ;
  6441. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EMSGSIZE)
  6442. return -int32(1)
  6443. }
  6444. var _xdigits = [17]int8{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}
  6445. var _digits = [11]int8{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}
  6446. const m_MD5_BLOCK_LENGTH = 64
  6447. const m_MD5_DIGEST_LENGTH = 16
  6448. type TMD5_CTX = struct {
  6449. Fstate [4]Tuint32_t
  6450. Fcount Tuint64_t
  6451. Fbuffer [64]Tuint8_t
  6452. }
  6453. type TMD5Context = TMD5_CTX
  6454. /* Avoid polluting the namespace. Even though this makes this usage
  6455. * implementation-specific, defining it unconditionally should not be
  6456. * a problem, and better than possibly breaking unexpecting code. */
  6457. /*
  6458. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  6459. *
  6460. * Redistribution and use in source and binary forms, with or without
  6461. * modification, are permitted provided that the following conditions
  6462. * are met:
  6463. * 1. Redistributions of source code must retain the above copyright
  6464. * notice, this list of conditions and the following disclaimer.
  6465. * 2. Redistributions in binary form must reproduce the above copyright
  6466. * notice, this list of conditions and the following disclaimer in the
  6467. * documentation and/or other materials provided with the distribution.
  6468. * 3. The name of the author may not be used to endorse or promote products
  6469. * derived from this software without specific prior written permission.
  6470. *
  6471. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  6472. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  6473. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  6474. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  6475. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  6476. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  6477. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  6478. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  6479. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  6480. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  6481. */
  6482. /*
  6483. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  6484. *
  6485. * Redistribution and use in source and binary forms, with or without
  6486. * modification, are permitted provided that the following conditions
  6487. * are met:
  6488. * 1. Redistributions of source code must retain the above copyright
  6489. * notice, this list of conditions and the following disclaimer.
  6490. * 2. Redistributions in binary form must reproduce the above copyright
  6491. * notice, this list of conditions and the following disclaimer in the
  6492. * documentation and/or other materials provided with the distribution.
  6493. * 3. The name of the author may not be used to endorse or promote products
  6494. * derived from this software without specific prior written permission.
  6495. *
  6496. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  6497. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  6498. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  6499. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  6500. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  6501. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  6502. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  6503. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  6504. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  6505. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  6506. */
  6507. /* Clang expands this to 1 if an identifier is *not* reserved. */
  6508. /*
  6509. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  6510. * musl, try to handle this gracefully.
  6511. */
  6512. /* Copyright (C) 1992-2023 Free Software Foundation, Inc.
  6513. Copyright The GNU Toolchain Authors.
  6514. This file is part of the GNU C Library.
  6515. The GNU C Library is free software; you can redistribute it and/or
  6516. modify it under the terms of the GNU Lesser General Public
  6517. License as published by the Free Software Foundation; either
  6518. version 2.1 of the License, or (at your option) any later version.
  6519. The GNU C Library is distributed in the hope that it will be useful,
  6520. but WITHOUT ANY WARRANTY; without even the implied warranty of
  6521. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  6522. Lesser General Public License for more details.
  6523. You should have received a copy of the GNU Lesser General Public
  6524. License along with the GNU C Library; if not, see
  6525. <https://www.gnu.org/licenses/>. */
  6526. /* We are almost always included from features.h. */
  6527. /* The GNU libc does not support any K&R compilers or the traditional mode
  6528. of ISO C compilers anymore. Check for some of the combinations not
  6529. supported anymore. */
  6530. /* Some user header file might have defined this before. */
  6531. /* Compilers that lack __has_attribute may object to
  6532. #if defined __has_attribute && __has_attribute (...)
  6533. even though they do not need to evaluate the right-hand side of the &&.
  6534. Similarly for __has_builtin, etc. */
  6535. /* All functions, except those with callbacks or those that
  6536. synchronize memory, are leaf functions. */
  6537. /* GCC can always grok prototypes. For C++ programs we add throw()
  6538. to help it optimize the function calls. But this only works with
  6539. gcc 2.8.x and egcs. For gcc 3.4 and up we even mark C functions
  6540. as non-throwing using a function attribute since programs can use
  6541. the -fexceptions options for C code as well. */
  6542. /* These two macros are not used in glibc anymore. They are kept here
  6543. only because some other projects expect the macros to be defined. */
  6544. /* For these things, GCC behaves the ANSI way normally,
  6545. and the non-ANSI way under -traditional. */
  6546. /* This is not a typedef so `const __ptr_t' does the right thing. */
  6547. /* C++ needs to know that types and declarations are C, not C++. */
  6548. /* Fortify support. */
  6549. /* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available. */
  6550. /* Support for flexible arrays.
  6551. Headers that should use flexible arrays only if they're "real"
  6552. (e.g. only if they won't affect sizeof()) should test
  6553. #if __glibc_c99_flexarr_available. */
  6554. /* __asm__ ("xyz") is used throughout the headers to rename functions
  6555. at the assembly language level. This is wrapped by the __REDIRECT
  6556. macro, in order to support compilers that can do this some other
  6557. way. When compilers don't support asm-names at all, we have to do
  6558. preprocessor tricks instead (which don't have exactly the right
  6559. semantics, but it's the best we can do).
  6560. Example:
  6561. int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */
  6562. /*
  6563. #elif __SOME_OTHER_COMPILER__
  6564. # define __REDIRECT(name, proto, alias) name proto; _Pragma("let " #name " = " #alias)
  6565. */
  6566. /* GCC and clang have various useful declarations that can be made with
  6567. the '__attribute__' syntax. All of the ways we use this do fine if
  6568. they are omitted for compilers that don't understand it. */
  6569. /* At some point during the gcc 2.96 development the `malloc' attribute
  6570. for functions was introduced. We don't want to use it unconditionally
  6571. (although this would be possible) since it generates warnings. */
  6572. /* Tell the compiler which arguments to an allocation function
  6573. indicate the size of the allocation. */
  6574. /* Tell the compiler which argument to an allocation function
  6575. indicates the alignment of the allocation. */
  6576. /* At some point during the gcc 2.96 development the `pure' attribute
  6577. for functions was introduced. We don't want to use it unconditionally
  6578. (although this would be possible) since it generates warnings. */
  6579. /* This declaration tells the compiler that the value is constant. */
  6580. /* At some point during the gcc 3.1 development the `used' attribute
  6581. for functions was introduced. We don't want to use it unconditionally
  6582. (although this would be possible) since it generates warnings. */
  6583. /* Since version 3.2, gcc allows marking deprecated functions. */
  6584. /* Since version 4.5, gcc also allows one to specify the message printed
  6585. when a deprecated function is used. clang claims to be gcc 4.2, but
  6586. may also support this feature. */
  6587. /* At some point during the gcc 2.8 development the `format_arg' attribute
  6588. for functions was introduced. We don't want to use it unconditionally
  6589. (although this would be possible) since it generates warnings.
  6590. If several `format_arg' attributes are given for the same function, in
  6591. gcc-3.0 and older, all but the last one are ignored. In newer gccs,
  6592. all designated arguments are considered. */
  6593. /* At some point during the gcc 2.97 development the `strfmon' format
  6594. attribute for functions was introduced. We don't want to use it
  6595. unconditionally (although this would be possible) since it
  6596. generates warnings. */
  6597. /* The nonnull function attribute marks pointer parameters that
  6598. must not be NULL. This has the name __nonnull in glibc,
  6599. and __attribute_nonnull__ in files shared with Gnulib to avoid
  6600. collision with a different __nonnull in DragonFlyBSD 5.9. */
  6601. /* The returns_nonnull function attribute marks the return type of the function
  6602. as always being non-null. */
  6603. /* If fortification mode, we warn about unused results of certain
  6604. function calls which can lead to problems. */
  6605. /* Forces a function to be always inlined. */
  6606. /* Associate error messages with the source location of the call site rather
  6607. than with the source location inside the function. */
  6608. /* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
  6609. inline semantics, unless -fgnu89-inline is used. Using __GNUC_STDC_INLINE__
  6610. or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions
  6611. older than 4.3 may define these macros and still not guarantee GNU inlining
  6612. semantics.
  6613. clang++ identifies itself as gcc-4.2, but has support for GNU inlining
  6614. semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and
  6615. __GNUC_GNU_INLINE__ macro definitions. */
  6616. /* GCC 4.3 and above allow passing all anonymous arguments of an
  6617. __extern_always_inline function to some other vararg function. */
  6618. /* It is possible to compile containing GCC extensions even if GCC is
  6619. run in pedantic mode if the uses are carefully marked using the
  6620. `__extension__' keyword. But this is not generally available before
  6621. version 2.8. */
  6622. /* __restrict is known in EGCS 1.2 and above, and in clang.
  6623. It works also in C++ mode (outside of arrays), but only when spelled
  6624. as '__restrict', not 'restrict'. */
  6625. /* ISO C99 also allows to declare arrays as non-overlapping. The syntax is
  6626. array_name[restrict]
  6627. GCC 3.1 and clang support this.
  6628. This syntax is not usable in C++ mode. */
  6629. /* Undefine (also defined in libc-symbols.h). */
  6630. /* Gnulib avoids including these, as they don't work on non-glibc or
  6631. older glibc platforms. */
  6632. /* Copyright (C) 1999-2023 Free Software Foundation, Inc.
  6633. This file is part of the GNU C Library.
  6634. The GNU C Library is free software; you can redistribute it and/or
  6635. modify it under the terms of the GNU Lesser General Public
  6636. License as published by the Free Software Foundation; either
  6637. version 2.1 of the License, or (at your option) any later version.
  6638. The GNU C Library is distributed in the hope that it will be useful,
  6639. but WITHOUT ANY WARRANTY; without even the implied warranty of
  6640. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  6641. Lesser General Public License for more details.
  6642. You should have received a copy of the GNU Lesser General Public
  6643. License along with the GNU C Library; if not, see
  6644. <https://www.gnu.org/licenses/>. */
  6645. /* Properties of long double type. ldbl-128 version.
  6646. Copyright (C) 2016-2023 Free Software Foundation, Inc.
  6647. This file is part of the GNU C Library.
  6648. The GNU C Library is free software; you can redistribute it and/or
  6649. modify it under the terms of the GNU Lesser General Public
  6650. License published by the Free Software Foundation; either
  6651. version 2.1 of the License, or (at your option) any later version.
  6652. The GNU C Library is distributed in the hope that it will be useful,
  6653. but WITHOUT ANY WARRANTY; without even the implied warranty of
  6654. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  6655. Lesser General Public License for more details.
  6656. You should have received a copy of the GNU Lesser General Public
  6657. License along with the GNU C Library; if not, see
  6658. <https://www.gnu.org/licenses/>. */
  6659. /* long double is distinct from double, so there is nothing to
  6660. define here. */
  6661. /* __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is
  6662. intended for use in preprocessor macros.
  6663. Note: MESSAGE must be a _single_ string; concatenation of string
  6664. literals is not supported. */
  6665. /* Generic selection (ISO C11) is a C-only feature, available in GCC
  6666. since version 4.9. Previous versions do not provide generic
  6667. selection, even though they might set __STDC_VERSION__ to 201112L,
  6668. when in -std=c11 mode. Thus, we must check for !defined __GNUC__
  6669. when testing __STDC_VERSION__ for generic selection support.
  6670. On the other hand, Clang also defines __GNUC__, so a clang-specific
  6671. check is required to enable the use of generic selection. */
  6672. /* Specify that a function such as setjmp or vfork may return
  6673. twice. */
  6674. /*
  6675. * On non-glibc based systems, we cannot unconditionally use the
  6676. * __GLIBC_PREREQ macro as it gets expanded before evaluation.
  6677. */
  6678. /*
  6679. * Some kFreeBSD headers expect those macros to be set for sanity checks.
  6680. */
  6681. /* Define the ABI for the current system. */
  6682. //#define LIBBSD_SYS_TIME_BITS 0
  6683. //#define LIBBSD_SYS_HAS_TIME64 0
  6684. /* Linux headers define a struct with a member names __unused.
  6685. * Debian bugs: #522773 (linux), #522774 (libc).
  6686. * Disable for now. */
  6687. /*
  6688. * Return the number of elements in a statically-allocated array,
  6689. * __x.
  6690. */
  6691. /*
  6692. * We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h>
  6693. * require it.
  6694. */
  6695. /*
  6696. * Given the pointer x to the member m of the struct s, return
  6697. * a pointer to the containing structure. When using GCC, we first
  6698. * assign pointer x to a local variable, to check that its type is
  6699. * compatible with member m.
  6700. */
  6701. func Xlibbsd_MD5Init(tls *libc.TLS, context uintptr) {
  6702. libmd.XMD5Init(tls, context)
  6703. }
  6704. var _libbsd_emit_link_warning_MD5Init = [77]int8{'T', 'h', 'e', ' ', 'M', 'D', '5', 'I', 'n', 'i', 't', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i', 'n', ' ', 'l', 'i', 'b', 'b', 's', 'd', ' ', 'i', 's', ' ', 'a', ' ', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', ' ', 'w', 'r', 'a', 'p', 'p', 'e', 'r', ',', ' ', 'u', 's', 'e', ' ', 'l', 'i', 'b', 'm', 'd', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', '.'}
  6705. func Xlibbsd_MD5Update(tls *libc.TLS, context uintptr, data uintptr, len1 Tsize_t) {
  6706. libmd.XMD5Update(tls, context, data, len1)
  6707. }
  6708. var _libbsd_emit_link_warning_MD5Update = [79]int8{'T', 'h', 'e', ' ', 'M', 'D', '5', 'U', 'p', 'd', 'a', 't', 'e', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i', 'n', ' ', 'l', 'i', 'b', 'b', 's', 'd', ' ', 'i', 's', ' ', 'a', ' ', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', ' ', 'w', 'r', 'a', 'p', 'p', 'e', 'r', ',', ' ', 'u', 's', 'e', ' ', 'l', 'i', 'b', 'm', 'd', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', '.'}
  6709. func Xlibbsd_MD5Pad(tls *libc.TLS, context uintptr) {
  6710. libmd.XMD5Pad(tls, context)
  6711. }
  6712. var _libbsd_emit_link_warning_MD5Pad = [76]int8{'T', 'h', 'e', ' ', 'M', 'D', '5', 'P', 'a', 'd', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i', 'n', ' ', 'l', 'i', 'b', 'b', 's', 'd', ' ', 'i', 's', ' ', 'a', ' ', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', ' ', 'w', 'r', 'a', 'p', 'p', 'e', 'r', ',', ' ', 'u', 's', 'e', ' ', 'l', 'i', 'b', 'm', 'd', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', '.'}
  6713. func Xlibbsd_MD5Final(tls *libc.TLS, digest uintptr, context uintptr) {
  6714. libmd.XMD5Final(tls, digest, context)
  6715. }
  6716. var _libbsd_emit_link_warning_MD5Final = [78]int8{'T', 'h', 'e', ' ', 'M', 'D', '5', 'F', 'i', 'n', 'a', 'l', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i', 'n', ' ', 'l', 'i', 'b', 'b', 's', 'd', ' ', 'i', 's', ' ', 'a', ' ', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', ' ', 'w', 'r', 'a', 'p', 'p', 'e', 'r', ',', ' ', 'u', 's', 'e', ' ', 'l', 'i', 'b', 'm', 'd', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', '.'}
  6717. func Xlibbsd_MD5Transform(tls *libc.TLS, state uintptr, block uintptr) {
  6718. libmd.XMD5Transform(tls, state, block)
  6719. }
  6720. var _libbsd_emit_link_warning_MD5Transform = [82]int8{'T', 'h', 'e', ' ', 'M', 'D', '5', 'T', 'r', 'a', 'n', 's', 'f', 'o', 'r', 'm', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i', 'n', ' ', 'l', 'i', 'b', 'b', 's', 'd', ' ', 'i', 's', ' ', 'a', ' ', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', ' ', 'w', 'r', 'a', 'p', 'p', 'e', 'r', ',', ' ', 'u', 's', 'e', ' ', 'l', 'i', 'b', 'm', 'd', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', '.'}
  6721. func Xlibbsd_MD5End(tls *libc.TLS, context uintptr, buf uintptr) (r uintptr) {
  6722. return libmd.XMD5End(tls, context, buf)
  6723. }
  6724. var _libbsd_emit_link_warning_MD5End = [76]int8{'T', 'h', 'e', ' ', 'M', 'D', '5', 'E', 'n', 'd', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i', 'n', ' ', 'l', 'i', 'b', 'b', 's', 'd', ' ', 'i', 's', ' ', 'a', ' ', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', ' ', 'w', 'r', 'a', 'p', 'p', 'e', 'r', ',', ' ', 'u', 's', 'e', ' ', 'l', 'i', 'b', 'm', 'd', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', '.'}
  6725. func Xlibbsd_MD5File(tls *libc.TLS, filename uintptr, buf uintptr) (r uintptr) {
  6726. return libmd.XMD5File(tls, filename, buf)
  6727. }
  6728. var _libbsd_emit_link_warning_MD5File = [77]int8{'T', 'h', 'e', ' ', 'M', 'D', '5', 'F', 'i', 'l', 'e', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i', 'n', ' ', 'l', 'i', 'b', 'b', 's', 'd', ' ', 'i', 's', ' ', 'a', ' ', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', ' ', 'w', 'r', 'a', 'p', 'p', 'e', 'r', ',', ' ', 'u', 's', 'e', ' ', 'l', 'i', 'b', 'm', 'd', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', '.'}
  6729. func Xlibbsd_MD5FileChunk(tls *libc.TLS, filename uintptr, buf uintptr, offset Toff_t, length Toff_t) (r uintptr) {
  6730. return libmd.XMD5FileChunk(tls, filename, buf, offset, length)
  6731. }
  6732. var _libbsd_emit_link_warning_MD5FileChunk = [82]int8{'T', 'h', 'e', ' ', 'M', 'D', '5', 'F', 'i', 'l', 'e', 'C', 'h', 'u', 'n', 'k', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i', 'n', ' ', 'l', 'i', 'b', 'b', 's', 'd', ' ', 'i', 's', ' ', 'a', ' ', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', ' ', 'w', 'r', 'a', 'p', 'p', 'e', 'r', ',', ' ', 'u', 's', 'e', ' ', 'l', 'i', 'b', 'm', 'd', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', '.'}
  6733. func Xlibbsd_MD5Data(tls *libc.TLS, data uintptr, len1 Tsize_t, buf uintptr) (r uintptr) {
  6734. return libmd.XMD5Data(tls, data, len1, buf)
  6735. }
  6736. var _libbsd_emit_link_warning_MD5Data = [77]int8{'T', 'h', 'e', ' ', 'M', 'D', '5', 'D', 'a', 't', 'a', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i', 'n', ' ', 'l', 'i', 'b', 'b', 's', 'd', ' ', 'i', 's', ' ', 'a', ' ', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', ' ', 'w', 'r', 'a', 'p', 'p', 'e', 'r', ',', ' ', 'u', 's', 'e', ' ', 'l', 'i', 'b', 'm', 'd', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', '.'}
  6737. const m_AT_BASE = 7
  6738. const m_AT_BASE_PLATFORM = 24
  6739. const m_AT_CLKTCK = 17
  6740. const m_AT_DCACHEBSIZE = 19
  6741. const m_AT_EGID = 14
  6742. const m_AT_ENTRY = 9
  6743. const m_AT_EUID = 12
  6744. const m_AT_EXECFD = 2
  6745. const m_AT_EXECFN = 31
  6746. const m_AT_FLAGS = 8
  6747. const m_AT_FPUCW = 18
  6748. const m_AT_GID = 13
  6749. const m_AT_HWCAP = 16
  6750. const m_AT_HWCAP2 = 26
  6751. const m_AT_ICACHEBSIZE = 20
  6752. const m_AT_IGNORE = 1
  6753. const m_AT_IGNOREPPC = 22
  6754. const m_AT_L1D_CACHEGEOMETRY = 43
  6755. const m_AT_L1D_CACHESHAPE = 35
  6756. const m_AT_L1D_CACHESIZE = 42
  6757. const m_AT_L1I_CACHEGEOMETRY = 41
  6758. const m_AT_L1I_CACHESHAPE = 34
  6759. const m_AT_L1I_CACHESIZE = 40
  6760. const m_AT_L2_CACHEGEOMETRY = 45
  6761. const m_AT_L2_CACHESHAPE = 36
  6762. const m_AT_L2_CACHESIZE = 44
  6763. const m_AT_L3_CACHEGEOMETRY = 47
  6764. const m_AT_L3_CACHESHAPE = 37
  6765. const m_AT_L3_CACHESIZE = 46
  6766. const m_AT_MINSIGSTKSZ = 51
  6767. const m_AT_NOTELF = 10
  6768. const m_AT_NULL = 0
  6769. const m_AT_PAGESZ = 6
  6770. const m_AT_PHDR = 3
  6771. const m_AT_PHENT = 4
  6772. const m_AT_PHNUM = 5
  6773. const m_AT_PLATFORM = 15
  6774. const m_AT_RANDOM = 25
  6775. const m_AT_SECURE = 23
  6776. const m_AT_SYSINFO = 32
  6777. const m_AT_SYSINFO_EHDR = 33
  6778. const m_AT_UCACHEBSIZE = 21
  6779. const m_AT_UID = 11
  6780. const m_AUX_FUNC = 2
  6781. const m_AUX_OBJECT = 1
  6782. const m_BIND_WEAK = 2
  6783. const m_DF_1_CONFALT = 0x00002000
  6784. const m_DF_1_DIRECT = 0x00000100
  6785. const m_DF_1_DISPRELDNE = 0x00008000
  6786. const m_DF_1_DISPRELPND = 0x00010000
  6787. const m_DF_1_EDITED = 0x00200000
  6788. const m_DF_1_ENDFILTEE = 0x00004000
  6789. const m_DF_1_GLOBAL = 0x00000002
  6790. const m_DF_1_GLOBAUDIT = 0x01000000
  6791. const m_DF_1_GROUP = 0x00000004
  6792. const m_DF_1_IGNMULDEF = 0x00040000
  6793. const m_DF_1_INITFIRST = 0x00000020
  6794. const m_DF_1_INTERPOSE = 0x00000400
  6795. const m_DF_1_LOADFLTR = 0x00000010
  6796. const m_DF_1_NODEFLIB = 0x00000800
  6797. const m_DF_1_NODELETE = 0x00000008
  6798. const m_DF_1_NODIRECT = 0x00020000
  6799. const m_DF_1_NODUMP = 0x00001000
  6800. const m_DF_1_NOHDR = 0x00100000
  6801. const m_DF_1_NOKSYMS = 0x00080000
  6802. const m_DF_1_NOOPEN = 0x00000040
  6803. const m_DF_1_NORELOC = 0x00400000
  6804. const m_DF_1_NOW = 0x00000001
  6805. const m_DF_1_ORIGIN = 0x00000080
  6806. const m_DF_1_PIE = 0x08000000
  6807. const m_DF_1_SINGLETON = 0x02000000
  6808. const m_DF_1_STUB = 0x04000000
  6809. const m_DF_1_SYMINTPOSE = 0x00800000
  6810. const m_DF_1_TRANS = 0x00000200
  6811. const m_DF_BIND_NOW = 0x00000008
  6812. const m_DF_ORIGIN = 0x00000001
  6813. const m_DF_P1_GROUPPERM = 0x00000002
  6814. const m_DF_P1_LAZYLOAD = 0x00000001
  6815. const m_DF_STATIC_TLS = 0x00000010
  6816. const m_DF_SYMBOLIC = 0x00000002
  6817. const m_DF_TEXTREL = 0x00000004
  6818. const m_DTF_1_CONFEXP = 0x00000002
  6819. const m_DTF_1_PARINIT = 0x00000001
  6820. const m_DT_ADDRNUM = 11
  6821. const m_DT_ADDRRNGHI = 0x6ffffeff
  6822. const m_DT_ADDRRNGLO = 0x6ffffe00
  6823. const m_DT_ALPHA_NUM = 1
  6824. const m_DT_AUDIT = 0x6ffffefc
  6825. const m_DT_AUXILIARY = 0x7ffffffd
  6826. const m_DT_BIND_NOW = 24
  6827. const m_DT_CHECKSUM = 0x6ffffdf8
  6828. const m_DT_CONFIG = 0x6ffffefa
  6829. const m_DT_DEBUG = 21
  6830. const m_DT_DEPAUDIT = 0x6ffffefb
  6831. const m_DT_ENCODING = 32
  6832. const m_DT_EXTRANUM = 3
  6833. const m_DT_FEATURE_1 = 0x6ffffdfc
  6834. const m_DT_FILTER = 0x7fffffff
  6835. const m_DT_FINI = 13
  6836. const m_DT_FINI_ARRAY = 26
  6837. const m_DT_FINI_ARRAYSZ = 28
  6838. const m_DT_FLAGS = 30
  6839. const m_DT_FLAGS_1 = 0x6ffffffb
  6840. const m_DT_GNU_CONFLICT = 0x6ffffef8
  6841. const m_DT_GNU_CONFLICTSZ = 0x6ffffdf6
  6842. const m_DT_GNU_HASH = 0x6ffffef5
  6843. const m_DT_GNU_LIBLIST = 0x6ffffef9
  6844. const m_DT_GNU_LIBLISTSZ = 0x6ffffdf7
  6845. const m_DT_GNU_PRELINKED = 0x6ffffdf5
  6846. const m_DT_HASH = 4
  6847. const m_DT_HIOS = 0x6ffff000
  6848. const m_DT_HIPROC = 0x7fffffff
  6849. const m_DT_IA_64_NUM = 1
  6850. const m_DT_INIT = 12
  6851. const m_DT_INIT_ARRAY = 25
  6852. const m_DT_INIT_ARRAYSZ = 27
  6853. const m_DT_JMPREL = 23
  6854. const m_DT_LOOS = 0x6000000d
  6855. const m_DT_LOPROC = 0x70000000
  6856. const m_DT_MIPS_AUX_DYNAMIC = 0x70000031
  6857. const m_DT_MIPS_BASE_ADDRESS = 0x70000006
  6858. const m_DT_MIPS_COMPACT_SIZE = 0x7000002f
  6859. const m_DT_MIPS_CONFLICT = 0x70000008
  6860. const m_DT_MIPS_CONFLICTNO = 0x7000000b
  6861. const m_DT_MIPS_CXX_FLAGS = 0x70000022
  6862. const m_DT_MIPS_DELTA_CLASS = 0x70000017
  6863. const m_DT_MIPS_DELTA_CLASSSYM = 0x70000020
  6864. const m_DT_MIPS_DELTA_CLASSSYM_NO = 0x70000021
  6865. const m_DT_MIPS_DELTA_CLASS_NO = 0x70000018
  6866. const m_DT_MIPS_DELTA_INSTANCE = 0x70000019
  6867. const m_DT_MIPS_DELTA_INSTANCE_NO = 0x7000001a
  6868. const m_DT_MIPS_DELTA_RELOC = 0x7000001b
  6869. const m_DT_MIPS_DELTA_RELOC_NO = 0x7000001c
  6870. const m_DT_MIPS_DELTA_SYM = 0x7000001d
  6871. const m_DT_MIPS_DELTA_SYM_NO = 0x7000001e
  6872. const m_DT_MIPS_DYNSTR_ALIGN = 0x7000002b
  6873. const m_DT_MIPS_FLAGS = 0x70000005
  6874. const m_DT_MIPS_GOTSYM = 0x70000013
  6875. const m_DT_MIPS_GP_VALUE = 0x70000030
  6876. const m_DT_MIPS_HIDDEN_GOTIDX = 0x70000027
  6877. const m_DT_MIPS_HIPAGENO = 0x70000014
  6878. const m_DT_MIPS_ICHECKSUM = 0x70000003
  6879. const m_DT_MIPS_INTERFACE = 0x7000002a
  6880. const m_DT_MIPS_INTERFACE_SIZE = 0x7000002c
  6881. const m_DT_MIPS_IVERSION = 0x70000004
  6882. const m_DT_MIPS_LIBLIST = 0x70000009
  6883. const m_DT_MIPS_LIBLISTNO = 0x70000010
  6884. const m_DT_MIPS_LOCALPAGE_GOTIDX = 0x70000025
  6885. const m_DT_MIPS_LOCAL_GOTIDX = 0x70000026
  6886. const m_DT_MIPS_LOCAL_GOTNO = 0x7000000a
  6887. const m_DT_MIPS_MSYM = 0x70000007
  6888. const m_DT_MIPS_NUM = 0x36
  6889. const m_DT_MIPS_OPTIONS = 0x70000029
  6890. const m_DT_MIPS_PERF_SUFFIX = 0x7000002e
  6891. const m_DT_MIPS_PIXIE_INIT = 0x70000023
  6892. const m_DT_MIPS_PLTGOT = 0x70000032
  6893. const m_DT_MIPS_PROTECTED_GOTIDX = 0x70000028
  6894. const m_DT_MIPS_RLD_MAP = 0x70000016
  6895. const m_DT_MIPS_RLD_MAP_REL = 0x70000035
  6896. const m_DT_MIPS_RLD_TEXT_RESOLVE_ADDR = 0x7000002d
  6897. const m_DT_MIPS_RLD_VERSION = 0x70000001
  6898. const m_DT_MIPS_RWPLT = 0x70000034
  6899. const m_DT_MIPS_SYMBOL_LIB = 0x70000024
  6900. const m_DT_MIPS_SYMTABNO = 0x70000011
  6901. const m_DT_MIPS_TIME_STAMP = 0x70000002
  6902. const m_DT_MIPS_UNREFEXTNO = 0x70000012
  6903. const m_DT_MOVEENT = 0x6ffffdfa
  6904. const m_DT_MOVESZ = 0x6ffffdfb
  6905. const m_DT_MOVETAB = 0x6ffffefe
  6906. const m_DT_NEEDED = 1
  6907. const m_DT_NIOS2_GP = 0x70000002
  6908. const m_DT_NULL = 0
  6909. const m_DT_NUM = 38
  6910. const m_DT_PLTGOT = 3
  6911. const m_DT_PLTPAD = 0x6ffffefd
  6912. const m_DT_PLTPADSZ = 0x6ffffdf9
  6913. const m_DT_PLTREL = 20
  6914. const m_DT_PLTRELSZ = 2
  6915. const m_DT_POSFLAG_1 = 0x6ffffdfd
  6916. const m_DT_PPC64_NUM = 4
  6917. const m_DT_PPC_NUM = 2
  6918. const m_DT_PREINIT_ARRAY = 32
  6919. const m_DT_PREINIT_ARRAYSZ = 33
  6920. const m_DT_PROCNUM = "DT_MIPS_NUM"
  6921. const m_DT_REL = 17
  6922. const m_DT_RELA = 7
  6923. const m_DT_RELACOUNT = 0x6ffffff9
  6924. const m_DT_RELAENT = 9
  6925. const m_DT_RELASZ = 8
  6926. const m_DT_RELCOUNT = 0x6ffffffa
  6927. const m_DT_RELENT = 19
  6928. const m_DT_RELR = 36
  6929. const m_DT_RELRENT = 37
  6930. const m_DT_RELRSZ = 35
  6931. const m_DT_RELSZ = 18
  6932. const m_DT_RPATH = 15
  6933. const m_DT_RUNPATH = 29
  6934. const m_DT_SONAME = 14
  6935. const m_DT_SPARC_NUM = 2
  6936. const m_DT_SPARC_REGISTER = 0x70000001
  6937. const m_DT_STRSZ = 10
  6938. const m_DT_STRTAB = 5
  6939. const m_DT_SYMBOLIC = 16
  6940. const m_DT_SYMENT = 11
  6941. const m_DT_SYMINENT = 0x6ffffdff
  6942. const m_DT_SYMINFO = 0x6ffffeff
  6943. const m_DT_SYMINSZ = 0x6ffffdfe
  6944. const m_DT_SYMTAB = 6
  6945. const m_DT_SYMTAB_SHNDX = 34
  6946. const m_DT_TEXTREL = 22
  6947. const m_DT_TLSDESC_GOT = 0x6ffffef7
  6948. const m_DT_TLSDESC_PLT = 0x6ffffef6
  6949. const m_DT_VALNUM = 12
  6950. const m_DT_VALRNGHI = 0x6ffffdff
  6951. const m_DT_VALRNGLO = 0x6ffffd00
  6952. const m_DT_VERDEF = 0x6ffffffc
  6953. const m_DT_VERDEFNUM = 0x6ffffffd
  6954. const m_DT_VERNEED = 0x6ffffffe
  6955. const m_DT_VERNEEDNUM = 0x6fffffff
  6956. const m_DT_VERSIONTAGNUM = 16
  6957. const m_DT_VERSYM = 0x6ffffff0
  6958. const m_EFA_PARISC_1_0 = 0x020b
  6959. const m_EFA_PARISC_1_1 = 0x0210
  6960. const m_EFA_PARISC_2_0 = 0x0214
  6961. const m_EF_ALPHA_32BIT = 1
  6962. const m_EF_ALPHA_CANRELAX = 2
  6963. const m_EF_ARM_ABI_FLOAT_HARD = 0x400
  6964. const m_EF_ARM_ABI_FLOAT_SOFT = 0x200
  6965. const m_EF_ARM_ALIGN8 = 0x40
  6966. const m_EF_ARM_APCS_26 = 0x08
  6967. const m_EF_ARM_APCS_FLOAT = 0x10
  6968. const m_EF_ARM_BE8 = 0x00800000
  6969. const m_EF_ARM_DYNSYMSUSESEGIDX = 0x08
  6970. const m_EF_ARM_EABIMASK = 0xFF000000
  6971. const m_EF_ARM_EABI_UNKNOWN = 0x00000000
  6972. const m_EF_ARM_EABI_VER1 = 0x01000000
  6973. const m_EF_ARM_EABI_VER2 = 0x02000000
  6974. const m_EF_ARM_EABI_VER3 = 0x03000000
  6975. const m_EF_ARM_EABI_VER4 = 0x04000000
  6976. const m_EF_ARM_EABI_VER5 = 0x05000000
  6977. const m_EF_ARM_HASENTRY = 0x02
  6978. const m_EF_ARM_INTERWORK = 0x04
  6979. const m_EF_ARM_LE8 = 0x00400000
  6980. const m_EF_ARM_MAPSYMSFIRST = 0x10
  6981. const m_EF_ARM_MAVERICK_FLOAT = 0x800
  6982. const m_EF_ARM_NEW_ABI = 0x80
  6983. const m_EF_ARM_OLD_ABI = 0x100
  6984. const m_EF_ARM_PIC = 0x20
  6985. const m_EF_ARM_RELEXEC = 0x01
  6986. const m_EF_ARM_SOFT_FLOAT = 0x200
  6987. const m_EF_ARM_SYMSARESORTED = 0x04
  6988. const m_EF_ARM_VFP_FLOAT = 0x400
  6989. const m_EF_CPU32 = 0x00810000
  6990. const m_EF_IA_64_ABI64 = 0x00000010
  6991. const m_EF_IA_64_ARCH = 0xff000000
  6992. const m_EF_IA_64_MASKOS = 0x0000000f
  6993. const m_EF_LARCH_ABI_DOUBLE_FLOAT = 0x03
  6994. const m_EF_LARCH_ABI_MODIFIER_MASK = 0x07
  6995. const m_EF_LARCH_ABI_SINGLE_FLOAT = 0x02
  6996. const m_EF_LARCH_ABI_SOFT_FLOAT = 0x01
  6997. const m_EF_LARCH_OBJABI_V1 = 0x40
  6998. const m_EF_MIPS_64BIT_WHIRL = 16
  6999. const m_EF_MIPS_ABI2 = 32
  7000. const m_EF_MIPS_ABI_ON32 = 64
  7001. const m_EF_MIPS_ARCH = 0xf0000000
  7002. const m_EF_MIPS_ARCH_1 = 0x00000000
  7003. const m_EF_MIPS_ARCH_2 = 0x10000000
  7004. const m_EF_MIPS_ARCH_3 = 0x20000000
  7005. const m_EF_MIPS_ARCH_32 = 0x50000000
  7006. const m_EF_MIPS_ARCH_32R2 = 0x70000000
  7007. const m_EF_MIPS_ARCH_4 = 0x30000000
  7008. const m_EF_MIPS_ARCH_5 = 0x40000000
  7009. const m_EF_MIPS_ARCH_64 = 0x60000000
  7010. const m_EF_MIPS_ARCH_64R2 = 0x80000000
  7011. const m_EF_MIPS_CPIC = 4
  7012. const m_EF_MIPS_FP64 = 512
  7013. const m_EF_MIPS_NAN2008 = 1024
  7014. const m_EF_MIPS_NOREORDER = 1
  7015. const m_EF_MIPS_PIC = 2
  7016. const m_EF_MIPS_XGOT = 8
  7017. const m_EF_PARISC_ARCH = 0x0000ffff
  7018. const m_EF_PARISC_EXT = 0x00020000
  7019. const m_EF_PARISC_LAZYSWAP = 0x00400000
  7020. const m_EF_PARISC_LSB = 0x00040000
  7021. const m_EF_PARISC_NO_KABP = 0x00100000
  7022. const m_EF_PARISC_TRAPNIL = 0x00010000
  7023. const m_EF_PARISC_WIDE = 0x00080000
  7024. const m_EF_PPC64_ABI = 3
  7025. const m_EF_PPC_EMB = 0x80000000
  7026. const m_EF_PPC_RELOCATABLE = 0x00010000
  7027. const m_EF_PPC_RELOCATABLE_LIB = 0x00008000
  7028. const m_EF_SH1 = 0x1
  7029. const m_EF_SH2 = 0x2
  7030. const m_EF_SH2A = 0xd
  7031. const m_EF_SH2A_NOFPU = 0x13
  7032. const m_EF_SH2A_SH3E = 0x18
  7033. const m_EF_SH2A_SH3_NOFPU = 0x16
  7034. const m_EF_SH2A_SH4 = 0x17
  7035. const m_EF_SH2A_SH4_NOFPU = 0x15
  7036. const m_EF_SH2E = 0xb
  7037. const m_EF_SH3 = 0x3
  7038. const m_EF_SH3E = 0x8
  7039. const m_EF_SH3_DSP = 0x5
  7040. const m_EF_SH3_NOMMU = 0x14
  7041. const m_EF_SH4 = 0x9
  7042. const m_EF_SH4A = 0xc
  7043. const m_EF_SH4AL_DSP = 0x6
  7044. const m_EF_SH4A_NOFPU = 0x11
  7045. const m_EF_SH4_NOFPU = 0x10
  7046. const m_EF_SH4_NOMMU_NOFPU = 0x12
  7047. const m_EF_SH_DSP = 0x4
  7048. const m_EF_SH_MACH_MASK = 0x1f
  7049. const m_EF_SH_UNKNOWN = 0x0
  7050. const m_EF_SPARCV9_MM = 3
  7051. const m_EF_SPARCV9_PSO = 1
  7052. const m_EF_SPARCV9_RMO = 2
  7053. const m_EF_SPARCV9_TSO = 0
  7054. const m_EF_SPARC_32PLUS = 0x000100
  7055. const m_EF_SPARC_EXT_MASK = 0xFFFF00
  7056. const m_EF_SPARC_HAL_R1 = 0x000400
  7057. const m_EF_SPARC_LEDATA = 0x800000
  7058. const m_EF_SPARC_SUN_US1 = 0x000200
  7059. const m_EF_SPARC_SUN_US3 = 0x000800
  7060. const m_EI_ABIVERSION = 8
  7061. const m_EI_CLASS = 4
  7062. const m_EI_DATA = 5
  7063. const m_EI_MAG0 = 0
  7064. const m_EI_MAG1 = 1
  7065. const m_EI_MAG2 = 2
  7066. const m_EI_MAG3 = 3
  7067. const m_EI_NIDENT = 16
  7068. const m_EI_OSABI = 7
  7069. const m_EI_PAD = 9
  7070. const m_EI_VERSION = 6
  7071. const m_ELFCLASS32 = 1
  7072. const m_ELFCLASS64 = 2
  7073. const m_ELFCLASSNONE = 0
  7074. const m_ELFCLASSNUM = 3
  7075. const m_ELFCOMPRESS_HIOS = 0x6fffffff
  7076. const m_ELFCOMPRESS_HIPROC = 0x7fffffff
  7077. const m_ELFCOMPRESS_LOOS = 0x60000000
  7078. const m_ELFCOMPRESS_LOPROC = 0x70000000
  7079. const m_ELFCOMPRESS_ZLIB = 1
  7080. const m_ELFCOMPRESS_ZSTD = 2
  7081. const m_ELFDATA2LSB = 1
  7082. const m_ELFDATA2MSB = 2
  7083. const m_ELFDATANONE = 0
  7084. const m_ELFDATANUM = 3
  7085. const m_ELFMAG = "\\177ELF"
  7086. const m_ELFMAG0 = 127
  7087. const m_ELFMAG1 = 69
  7088. const m_ELFMAG2 = 76
  7089. const m_ELFMAG3 = 70
  7090. const m_ELFOSABI_AIX = 7
  7091. const m_ELFOSABI_ARM = 97
  7092. const m_ELFOSABI_FREEBSD = 9
  7093. const m_ELFOSABI_GNU = 3
  7094. const m_ELFOSABI_HPUX = 1
  7095. const m_ELFOSABI_IRIX = 8
  7096. const m_ELFOSABI_LINUX = 3
  7097. const m_ELFOSABI_MODESTO = 11
  7098. const m_ELFOSABI_NETBSD = 2
  7099. const m_ELFOSABI_NONE = 0
  7100. const m_ELFOSABI_OPENBSD = 12
  7101. const m_ELFOSABI_SOLARIS = 6
  7102. const m_ELFOSABI_STANDALONE = 255
  7103. const m_ELFOSABI_SYSV = 0
  7104. const m_ELFOSABI_TRU64 = 10
  7105. const m_ELF_NOTE_ABI = "NT_GNU_ABI_TAG"
  7106. const m_ELF_NOTE_GNU = "GNU"
  7107. const m_ELF_NOTE_OS_FREEBSD = 3
  7108. const m_ELF_NOTE_OS_GNU = 1
  7109. const m_ELF_NOTE_OS_LINUX = 0
  7110. const m_ELF_NOTE_OS_SOLARIS2 = 2
  7111. const m_ELF_NOTE_PAGESIZE_HINT = 1
  7112. const m_ELF_NOTE_SOLARIS = "SUNW Solaris"
  7113. const m_ELF_ST_BIND = "ELF64_ST_BIND"
  7114. const m_ELF_ST_TYPE = "ELF64_ST_TYPE"
  7115. const m_ELF_TARG_CLASS = "ELFCLASS64"
  7116. const m_ELF_TARG_DATA = "ELFDATA2LSB"
  7117. const m_ELF_TARG_MACH = "EM_LOONGARCH"
  7118. const m_ELF_TARG_VER = "EV_CURRENT"
  7119. const m_EM_386 = 3
  7120. const m_EM_56800EX = 200
  7121. const m_EM_68HC05 = 72
  7122. const m_EM_68HC08 = 71
  7123. const m_EM_68HC11 = 70
  7124. const m_EM_68HC12 = 53
  7125. const m_EM_68HC16 = 69
  7126. const m_EM_68K = 4
  7127. const m_EM_78KOR = 199
  7128. const m_EM_8051 = 165
  7129. const m_EM_860 = 7
  7130. const m_EM_88K = 5
  7131. const m_EM_960 = 19
  7132. const m_EM_AARCH64 = 183
  7133. const m_EM_ALPHA = 0x9026
  7134. const m_EM_ALTERA_NIOS2 = 113
  7135. const m_EM_AMDGPU = 224
  7136. const m_EM_ARC = 45
  7137. const m_EM_ARCA = 109
  7138. const m_EM_ARC_A5 = 93
  7139. const m_EM_ARC_COMPACT = 93
  7140. const m_EM_ARC_COMPACT2 = 195
  7141. const m_EM_ARM = 40
  7142. const m_EM_AVR = 83
  7143. const m_EM_AVR32 = 185
  7144. const m_EM_BA1 = 201
  7145. const m_EM_BA2 = 202
  7146. const m_EM_BLACKFIN = 106
  7147. const m_EM_BPF = 247
  7148. const m_EM_C166 = 116
  7149. const m_EM_CDP = 215
  7150. const m_EM_CE = 119
  7151. const m_EM_CLOUDSHIELD = 192
  7152. const m_EM_COGE = 216
  7153. const m_EM_COLDFIRE = 52
  7154. const m_EM_COOL = 217
  7155. const m_EM_COREA_1ST = 193
  7156. const m_EM_COREA_2ND = 194
  7157. const m_EM_CR = 103
  7158. const m_EM_CR16 = 177
  7159. const m_EM_CRAYNV2 = 172
  7160. const m_EM_CRIS = 76
  7161. const m_EM_CRX = 114
  7162. const m_EM_CSKY = 252
  7163. const m_EM_CSR_KALIMBA = 219
  7164. const m_EM_CUDA = 190
  7165. const m_EM_CYPRESS_M8C = 161
  7166. const m_EM_D10V = 85
  7167. const m_EM_D30V = 86
  7168. const m_EM_DSP24 = 136
  7169. const m_EM_DSPIC30F = 118
  7170. const m_EM_DXP = 112
  7171. const m_EM_ECOG16 = 176
  7172. const m_EM_ECOG1X = 168
  7173. const m_EM_ECOG2 = 134
  7174. const m_EM_EMX16 = 212
  7175. const m_EM_EMX8 = 213
  7176. const m_EM_ETPU = 178
  7177. const m_EM_EXCESS = 111
  7178. const m_EM_F2MC16 = 104
  7179. const m_EM_FAKE_ALPHA = 41
  7180. const m_EM_FIREPATH = 78
  7181. const m_EM_FR20 = 37
  7182. const m_EM_FR30 = 84
  7183. const m_EM_FT32 = 222
  7184. const m_EM_FX66 = 66
  7185. const m_EM_H8S = 48
  7186. const m_EM_H8_300 = 46
  7187. const m_EM_H8_300H = 47
  7188. const m_EM_H8_500 = 49
  7189. const m_EM_HUANY = 81
  7190. const m_EM_IA_64 = 50
  7191. const m_EM_IP2K = 101
  7192. const m_EM_JAVELIN = 77
  7193. const m_EM_K10M = 181
  7194. const m_EM_KM32 = 210
  7195. const m_EM_KMX32 = 211
  7196. const m_EM_KVARC = 214
  7197. const m_EM_L10M = 180
  7198. const m_EM_LATTICEMICO32 = 138
  7199. const m_EM_LOONGARCH = 258
  7200. const m_EM_M16C = 117
  7201. const m_EM_M32 = 1
  7202. const m_EM_M32C = 120
  7203. const m_EM_M32R = 88
  7204. const m_EM_MANIK = 171
  7205. const m_EM_MAX = 102
  7206. const m_EM_MAXQ30 = 169
  7207. const m_EM_MCHP_PIC = 204
  7208. const m_EM_MCST_ELBRUS = 175
  7209. const m_EM_ME16 = 59
  7210. const m_EM_METAG = 174
  7211. const m_EM_MICROBLAZE = 189
  7212. const m_EM_MIPS = 8
  7213. const m_EM_MIPS_RS3_LE = 10
  7214. const m_EM_MIPS_X = 51
  7215. const m_EM_MMA = 54
  7216. const m_EM_MMDSP_PLUS = 160
  7217. const m_EM_MMIX = 80
  7218. const m_EM_MN10200 = 90
  7219. const m_EM_MN10300 = 89
  7220. const m_EM_MOXIE = 223
  7221. const m_EM_MSP430 = 105
  7222. const m_EM_NCPU = 56
  7223. const m_EM_NDR1 = 57
  7224. const m_EM_NDS32 = 167
  7225. const m_EM_NONE = 0
  7226. const m_EM_NORC = 218
  7227. const m_EM_NS32K = 97
  7228. const m_EM_NUM = 259
  7229. const m_EM_OPEN8 = 196
  7230. const m_EM_OPENRISC = 92
  7231. const m_EM_OR1K = 92
  7232. const m_EM_PARISC = 15
  7233. const m_EM_PCP = 55
  7234. const m_EM_PDSP = 63
  7235. const m_EM_PJ = 91
  7236. const m_EM_PPC = 20
  7237. const m_EM_PPC64 = 21
  7238. const m_EM_PRISM = 82
  7239. const m_EM_QDSP6 = 164
  7240. const m_EM_R32C = 162
  7241. const m_EM_RCE = 39
  7242. const m_EM_RH32 = 38
  7243. const m_EM_RISCV = 243
  7244. const m_EM_RL78 = 197
  7245. const m_EM_RS08 = 132
  7246. const m_EM_RX = 173
  7247. const m_EM_S370 = 9
  7248. const m_EM_S390 = 22
  7249. const m_EM_SCORE7 = 135
  7250. const m_EM_SEP = 108
  7251. const m_EM_SE_C17 = 139
  7252. const m_EM_SE_C33 = 107
  7253. const m_EM_SH = 42
  7254. const m_EM_SHARC = 133
  7255. const m_EM_SLE9X = 179
  7256. const m_EM_SNP1K = 99
  7257. const m_EM_SPARC = 2
  7258. const m_EM_SPARC32PLUS = 18
  7259. const m_EM_SPARCV9 = 43
  7260. const m_EM_ST100 = 60
  7261. const m_EM_ST19 = 74
  7262. const m_EM_ST200 = 100
  7263. const m_EM_ST7 = 68
  7264. const m_EM_ST9PLUS = 67
  7265. const m_EM_STARCORE = 58
  7266. const m_EM_STM8 = 186
  7267. const m_EM_STXP7X = 166
  7268. const m_EM_SVX = 73
  7269. const m_EM_TILE64 = 187
  7270. const m_EM_TILEGX = 191
  7271. const m_EM_TILEPRO = 188
  7272. const m_EM_TINYJ = 61
  7273. const m_EM_TI_ARP32 = 143
  7274. const m_EM_TI_C2000 = 141
  7275. const m_EM_TI_C5500 = 142
  7276. const m_EM_TI_C6000 = 140
  7277. const m_EM_TI_PRU = 144
  7278. const m_EM_TMM_GPP = 96
  7279. const m_EM_TPC = 98
  7280. const m_EM_TRICORE = 44
  7281. const m_EM_TRIMEDIA = 163
  7282. const m_EM_TSK3000 = 131
  7283. const m_EM_UNICORE = 110
  7284. const m_EM_V800 = 36
  7285. const m_EM_V850 = 87
  7286. const m_EM_VAX = 75
  7287. const m_EM_VIDEOCORE = 95
  7288. const m_EM_VIDEOCORE3 = 137
  7289. const m_EM_VIDEOCORE5 = 198
  7290. const m_EM_VISIUM = 221
  7291. const m_EM_VPP500 = 17
  7292. const m_EM_X86_64 = 62
  7293. const m_EM_XCORE = 203
  7294. const m_EM_XGATE = 115
  7295. const m_EM_XIMO16 = 170
  7296. const m_EM_XTENSA = 94
  7297. const m_EM_Z80 = 220
  7298. const m_EM_ZSP = 79
  7299. const m_ET_CORE = 4
  7300. const m_ET_DYN = 3
  7301. const m_ET_EXEC = 2
  7302. const m_ET_HIOS = 0xfeff
  7303. const m_ET_HIPROC = 0xffff
  7304. const m_ET_LOOS = 0xfe00
  7305. const m_ET_LOPROC = 0xff00
  7306. const m_ET_NONE = 0
  7307. const m_ET_NUM = 5
  7308. const m_ET_REL = 1
  7309. const m_EV_CURRENT = 1
  7310. const m_EV_NONE = 0
  7311. const m_EV_NUM = 2
  7312. const m_E_MIPS_ARCH_1 = 0x00000000
  7313. const m_E_MIPS_ARCH_2 = 0x10000000
  7314. const m_E_MIPS_ARCH_3 = 0x20000000
  7315. const m_E_MIPS_ARCH_32 = 0x50000000
  7316. const m_E_MIPS_ARCH_4 = 0x30000000
  7317. const m_E_MIPS_ARCH_5 = 0x40000000
  7318. const m_E_MIPS_ARCH_64 = 0x60000000
  7319. const m_Elf_Ehdr = "Elf64_Ehdr"
  7320. const m_Elf_Off = "Elf64_Off"
  7321. const m_Elf_Shdr = "Elf64_Shdr"
  7322. const m_Elf_Sword = "Elf64_Sword"
  7323. const m_Elf_Sym = "Elf64_Sym"
  7324. const m_Elf_Word = "Elf64_Word"
  7325. const m_GRP_COMDAT = 0x1
  7326. const m_LITUSE_ALPHA_ADDR = 0
  7327. const m_LITUSE_ALPHA_BASE = 1
  7328. const m_LITUSE_ALPHA_BYTOFF = 2
  7329. const m_LITUSE_ALPHA_JSR = 3
  7330. const m_LITUSE_ALPHA_TLS_GD = 4
  7331. const m_LITUSE_ALPHA_TLS_LDM = 5
  7332. const m_LL_NONE = 0
  7333. const m_MAP_ANON1 = 0x20
  7334. const m_MAP_PRIVATE1 = 0x02
  7335. const m_MIPS_AFL_ASE_DSP = 0x00000001
  7336. const m_MIPS_AFL_ASE_DSPR2 = 0x00000002
  7337. const m_MIPS_AFL_ASE_EVA = 0x00000004
  7338. const m_MIPS_AFL_ASE_MASK = 0x00001fff
  7339. const m_MIPS_AFL_ASE_MCU = 0x00000008
  7340. const m_MIPS_AFL_ASE_MDMX = 0x00000010
  7341. const m_MIPS_AFL_ASE_MICROMIPS = 0x00000800
  7342. const m_MIPS_AFL_ASE_MIPS16 = 0x00000400
  7343. const m_MIPS_AFL_ASE_MIPS3D = 0x00000020
  7344. const m_MIPS_AFL_ASE_MSA = 0x00000200
  7345. const m_MIPS_AFL_ASE_MT = 0x00000040
  7346. const m_MIPS_AFL_ASE_SMARTMIPS = 0x00000080
  7347. const m_MIPS_AFL_ASE_VIRT = 0x00000100
  7348. const m_MIPS_AFL_ASE_XPA = 0x00001000
  7349. const m_MIPS_AFL_EXT_10000 = 11
  7350. const m_MIPS_AFL_EXT_3900 = 10
  7351. const m_MIPS_AFL_EXT_4010 = 8
  7352. const m_MIPS_AFL_EXT_4100 = 9
  7353. const m_MIPS_AFL_EXT_4111 = 13
  7354. const m_MIPS_AFL_EXT_4120 = 14
  7355. const m_MIPS_AFL_EXT_4650 = 7
  7356. const m_MIPS_AFL_EXT_5400 = 15
  7357. const m_MIPS_AFL_EXT_5500 = 16
  7358. const m_MIPS_AFL_EXT_5900 = 6
  7359. const m_MIPS_AFL_EXT_LOONGSON_2E = 17
  7360. const m_MIPS_AFL_EXT_LOONGSON_2F = 18
  7361. const m_MIPS_AFL_EXT_LOONGSON_3A = 4
  7362. const m_MIPS_AFL_EXT_OCTEON = 5
  7363. const m_MIPS_AFL_EXT_OCTEON2 = 2
  7364. const m_MIPS_AFL_EXT_OCTEONP = 3
  7365. const m_MIPS_AFL_EXT_SB1 = 12
  7366. const m_MIPS_AFL_EXT_XLR = 1
  7367. const m_MIPS_AFL_FLAGS1_ODDSPREG = 1
  7368. const m_MIPS_AFL_REG_128 = 0x03
  7369. const m_MIPS_AFL_REG_32 = 0x01
  7370. const m_MIPS_AFL_REG_64 = 0x02
  7371. const m_MIPS_AFL_REG_NONE = 0x00
  7372. const m_NT_386_IOPERM = 0x201
  7373. const m_NT_386_TLS = 0x200
  7374. const m_NT_ARC_V2 = 0x600
  7375. const m_NT_ARM_HW_BREAK = 0x402
  7376. const m_NT_ARM_HW_WATCH = 0x403
  7377. const m_NT_ARM_PACA_KEYS = 0x407
  7378. const m_NT_ARM_PACG_KEYS = 0x408
  7379. const m_NT_ARM_PAC_ENABLED_KEYS = 0x40a
  7380. const m_NT_ARM_PAC_MASK = 0x406
  7381. const m_NT_ARM_SVE = 0x405
  7382. const m_NT_ARM_SYSTEM_CALL = 0x404
  7383. const m_NT_ARM_TAGGED_ADDR_CTRL = 0x409
  7384. const m_NT_ARM_TLS = 0x401
  7385. const m_NT_ARM_VFP = 0x400
  7386. const m_NT_ASRS = 8
  7387. const m_NT_AUXV = 6
  7388. const m_NT_FILE = 0x46494c45
  7389. const m_NT_FPREGSET = 2
  7390. const m_NT_GNU_ABI_TAG = 1
  7391. const m_NT_GNU_BUILD_ID = 3
  7392. const m_NT_GNU_GOLD_VERSION = 4
  7393. const m_NT_GNU_PROPERTY_TYPE_0 = 5
  7394. const m_NT_GWINDOWS = 7
  7395. const m_NT_LOONGARCH_CPUCFG = 0xa00
  7396. const m_NT_LOONGARCH_CSR = 0xa01
  7397. const m_NT_LOONGARCH_LASX = 0xa03
  7398. const m_NT_LOONGARCH_LBT = 0xa04
  7399. const m_NT_LOONGARCH_LSX = 0xa02
  7400. const m_NT_LWPSINFO = 17
  7401. const m_NT_LWPSTATUS = 16
  7402. const m_NT_METAG_CBUF = 0x500
  7403. const m_NT_METAG_RPIPE = 0x501
  7404. const m_NT_METAG_TLS = 0x502
  7405. const m_NT_MIPS_DSP = 0x800
  7406. const m_NT_MIPS_FP_MODE = 0x801
  7407. const m_NT_MIPS_MSA = 0x802
  7408. const m_NT_PLATFORM = 5
  7409. const m_NT_PPC_DSCR = 0x105
  7410. const m_NT_PPC_EBB = 0x106
  7411. const m_NT_PPC_PMU = 0x107
  7412. const m_NT_PPC_PPR = 0x104
  7413. const m_NT_PPC_SPE = 0x101
  7414. const m_NT_PPC_TAR = 0x103
  7415. const m_NT_PPC_TM_CDSCR = 0x10f
  7416. const m_NT_PPC_TM_CFPR = 0x109
  7417. const m_NT_PPC_TM_CGPR = 0x108
  7418. const m_NT_PPC_TM_CPPR = 0x10e
  7419. const m_NT_PPC_TM_CTAR = 0x10d
  7420. const m_NT_PPC_TM_CVMX = 0x10a
  7421. const m_NT_PPC_TM_CVSX = 0x10b
  7422. const m_NT_PPC_TM_SPR = 0x10c
  7423. const m_NT_PPC_VMX = 0x100
  7424. const m_NT_PPC_VSX = 0x102
  7425. const m_NT_PRCRED = 14
  7426. const m_NT_PRFPREG = 2
  7427. const m_NT_PRFPXREG = 20
  7428. const m_NT_PRPSINFO = 3
  7429. const m_NT_PRSTATUS = 1
  7430. const m_NT_PRXFPREG = 0x46e62b7f
  7431. const m_NT_PRXREG = 4
  7432. const m_NT_PSINFO = 13
  7433. const m_NT_PSTATUS = 10
  7434. const m_NT_RISCV_CSR = 0x900
  7435. const m_NT_RISCV_VECTOR = 0x901
  7436. const m_NT_S390_CTRS = 0x304
  7437. const m_NT_S390_GS_BC = 0x30c
  7438. const m_NT_S390_GS_CB = 0x30b
  7439. const m_NT_S390_HIGH_GPRS = 0x300
  7440. const m_NT_S390_LAST_BREAK = 0x306
  7441. const m_NT_S390_PREFIX = 0x305
  7442. const m_NT_S390_RI_CB = 0x30d
  7443. const m_NT_S390_SYSTEM_CALL = 0x307
  7444. const m_NT_S390_TDB = 0x308
  7445. const m_NT_S390_TIMER = 0x301
  7446. const m_NT_S390_TODCMP = 0x302
  7447. const m_NT_S390_TODPREG = 0x303
  7448. const m_NT_S390_VXRS_HIGH = 0x30a
  7449. const m_NT_S390_VXRS_LOW = 0x309
  7450. const m_NT_SIGINFO = 0x53494749
  7451. const m_NT_TASKSTRUCT = 4
  7452. const m_NT_UTSNAME = 15
  7453. const m_NT_VERSION = 1
  7454. const m_NT_VMCOREDD = 0x700
  7455. const m_NT_X86_XSTATE = 0x202
  7456. const m_N_ABS = 2
  7457. const m_N_BSS = 8
  7458. const m_N_COMM = 0x12
  7459. const m_N_DATA = 6
  7460. const m_N_EXT = 1
  7461. const m_N_FN = 30
  7462. const m_N_FORMAT = "%08x"
  7463. const m_N_INDR = 0x0a
  7464. const m_N_SETA = 0x14
  7465. const m_N_SETB = 0x1a
  7466. const m_N_SETD = 0x18
  7467. const m_N_SETT = 0x16
  7468. const m_N_SETV = 0x1c
  7469. const m_N_SIZE = 0x0c
  7470. const m_N_STAB = 0xe0
  7471. const m_N_TEXT = 4
  7472. const m_N_TYPE = 0x1e
  7473. const m_N_UNDF = 0
  7474. const m_N_WARN = 0x1e
  7475. const m_ODK_EXCEPTIONS = 2
  7476. const m_ODK_FILL = 5
  7477. const m_ODK_HWAND = 7
  7478. const m_ODK_HWOR = 8
  7479. const m_ODK_HWPATCH = 4
  7480. const m_ODK_NULL = 0
  7481. const m_ODK_PAD = 3
  7482. const m_ODK_REGINFO = 1
  7483. const m_ODK_TAGS = 6
  7484. const m_OEX_DISMISS = 0x80000
  7485. const m_OEX_FPDBUG = 0x40000
  7486. const m_OEX_FPU_DIV0 = 0x08
  7487. const m_OEX_FPU_INEX = 0x01
  7488. const m_OEX_FPU_INVAL = 0x10
  7489. const m_OEX_FPU_MAX = 0x1f00
  7490. const m_OEX_FPU_MIN = 0x1f
  7491. const m_OEX_FPU_OFLO = 0x04
  7492. const m_OEX_FPU_UFLO = 0x02
  7493. const m_OEX_PAGE0 = 0x10000
  7494. const m_OEX_PRECISEFP = "OEX_FPDBUG"
  7495. const m_OEX_SMM = 0x20000
  7496. const m_OHWA0_R4KEOP_CHECKED = 0x00000001
  7497. const m_OHWA1_R4KEOP_CLEAN = 0x00000002
  7498. const m_OHW_R4KEOP = 0x1
  7499. const m_OHW_R5KCVTL = 0x8
  7500. const m_OHW_R5KEOP = 0x4
  7501. const m_OHW_R8KPFETCH = 0x2
  7502. const m_OPAD_POSTFIX = 0x2
  7503. const m_OPAD_PREFIX = 0x1
  7504. const m_OPAD_SYMBOL = 0x4
  7505. const m_O_CREAT2 = 0100
  7506. const m_O_NONBLOCK2 = 04000
  7507. const m_O_RDONLY1 = 0
  7508. const m_O_TRUNC2 = 01000
  7509. const m_PF_ARM_ABS = 0x40000000
  7510. const m_PF_ARM_PI = 0x20000000
  7511. const m_PF_ARM_SB = 0x10000000
  7512. const m_PF_HP_CODE = 0x01000000
  7513. const m_PF_HP_FAR_SHARED = 0x00200000
  7514. const m_PF_HP_LAZYSWAP = 0x04000000
  7515. const m_PF_HP_MODIFY = 0x02000000
  7516. const m_PF_HP_NEAR_SHARED = 0x00400000
  7517. const m_PF_HP_PAGE_SIZE = 0x00100000
  7518. const m_PF_HP_SBP = 0x08000000
  7519. const m_PF_IA_64_NORECOV = 0x80000000
  7520. const m_PF_MASKOS = 0x0ff00000
  7521. const m_PF_MASKPROC = 0xf0000000
  7522. const m_PF_MIPS_LOCAL = 0x10000000
  7523. const m_PF_PARISC_SBP = 0x08000000
  7524. const m_PN_XNUM = 0xffff
  7525. const m_PPC64_OPT_LOCALENTRY = 4
  7526. const m_PPC64_OPT_MULTI_TOC = 2
  7527. const m_PPC64_OPT_TLS = 1
  7528. const m_PPC_OPT_TLS = 1
  7529. const m_PT_DYNAMIC = 2
  7530. const m_PT_GNU_EH_FRAME = 0x6474e550
  7531. const m_PT_GNU_PROPERTY = 0x6474e553
  7532. const m_PT_GNU_RELRO = 0x6474e552
  7533. const m_PT_GNU_STACK = 0x6474e551
  7534. const m_PT_HIOS = 0x6fffffff
  7535. const m_PT_HIPROC = 0x7fffffff
  7536. const m_PT_HISUNW = 0x6fffffff
  7537. const m_PT_INTERP = 3
  7538. const m_PT_LOAD = 1
  7539. const m_PT_LOOS = 0x60000000
  7540. const m_PT_LOPROC = 0x70000000
  7541. const m_PT_LOSUNW = 0x6ffffffa
  7542. const m_PT_MIPS_ABIFLAGS = 0x70000003
  7543. const m_PT_MIPS_OPTIONS = 0x70000002
  7544. const m_PT_MIPS_REGINFO = 0x70000000
  7545. const m_PT_MIPS_RTPROC = 0x70000001
  7546. const m_PT_NOTE = 4
  7547. const m_PT_NULL = 0
  7548. const m_PT_NUM = 8
  7549. const m_PT_PARISC_ARCHEXT = 0x70000000
  7550. const m_PT_PARISC_UNWIND = 0x70000001
  7551. const m_PT_PHDR = 6
  7552. const m_PT_SHLIB = 5
  7553. const m_PT_SUNWBSS = 0x6ffffffa
  7554. const m_PT_SUNWSTACK = 0x6ffffffb
  7555. const m_PT_TLS = 7
  7556. const m_RHF_NONE = 0
  7557. const m_R_386_16 = 20
  7558. const m_R_386_32 = 1
  7559. const m_R_386_32PLT = 11
  7560. const m_R_386_8 = 22
  7561. const m_R_386_COPY = 5
  7562. const m_R_386_GLOB_DAT = 6
  7563. const m_R_386_GOT32 = 3
  7564. const m_R_386_GOT32X = 43
  7565. const m_R_386_GOTOFF = 9
  7566. const m_R_386_GOTPC = 10
  7567. const m_R_386_IRELATIVE = 42
  7568. const m_R_386_JMP_SLOT = 7
  7569. const m_R_386_NONE = 0
  7570. const m_R_386_NUM = 44
  7571. const m_R_386_PC16 = 21
  7572. const m_R_386_PC32 = 2
  7573. const m_R_386_PC8 = 23
  7574. const m_R_386_PLT32 = 4
  7575. const m_R_386_RELATIVE = 8
  7576. const m_R_386_SIZE32 = 38
  7577. const m_R_386_TLS_DESC = 41
  7578. const m_R_386_TLS_DESC_CALL = 40
  7579. const m_R_386_TLS_DTPMOD32 = 35
  7580. const m_R_386_TLS_DTPOFF32 = 36
  7581. const m_R_386_TLS_GD = 18
  7582. const m_R_386_TLS_GD_32 = 24
  7583. const m_R_386_TLS_GD_CALL = 26
  7584. const m_R_386_TLS_GD_POP = 27
  7585. const m_R_386_TLS_GD_PUSH = 25
  7586. const m_R_386_TLS_GOTDESC = 39
  7587. const m_R_386_TLS_GOTIE = 16
  7588. const m_R_386_TLS_IE = 15
  7589. const m_R_386_TLS_IE_32 = 33
  7590. const m_R_386_TLS_LDM = 19
  7591. const m_R_386_TLS_LDM_32 = 28
  7592. const m_R_386_TLS_LDM_CALL = 30
  7593. const m_R_386_TLS_LDM_POP = 31
  7594. const m_R_386_TLS_LDM_PUSH = 29
  7595. const m_R_386_TLS_LDO_32 = 32
  7596. const m_R_386_TLS_LE = 17
  7597. const m_R_386_TLS_LE_32 = 34
  7598. const m_R_386_TLS_TPOFF = 14
  7599. const m_R_386_TLS_TPOFF32 = 37
  7600. const m_R_390_12 = 2
  7601. const m_R_390_16 = 3
  7602. const m_R_390_20 = 57
  7603. const m_R_390_32 = 4
  7604. const m_R_390_64 = 22
  7605. const m_R_390_8 = 1
  7606. const m_R_390_COPY = 9
  7607. const m_R_390_GLOB_DAT = 10
  7608. const m_R_390_GOT12 = 6
  7609. const m_R_390_GOT16 = 15
  7610. const m_R_390_GOT20 = 58
  7611. const m_R_390_GOT32 = 7
  7612. const m_R_390_GOT64 = 24
  7613. const m_R_390_GOTENT = 26
  7614. const m_R_390_GOTOFF16 = 27
  7615. const m_R_390_GOTOFF32 = 13
  7616. const m_R_390_GOTOFF64 = 28
  7617. const m_R_390_GOTPC = 14
  7618. const m_R_390_GOTPCDBL = 21
  7619. const m_R_390_GOTPLT12 = 29
  7620. const m_R_390_GOTPLT16 = 30
  7621. const m_R_390_GOTPLT20 = 59
  7622. const m_R_390_GOTPLT32 = 31
  7623. const m_R_390_GOTPLT64 = 32
  7624. const m_R_390_GOTPLTENT = 33
  7625. const m_R_390_JMP_SLOT = 11
  7626. const m_R_390_NONE = 0
  7627. const m_R_390_NUM = 61
  7628. const m_R_390_PC16 = 16
  7629. const m_R_390_PC16DBL = 17
  7630. const m_R_390_PC32 = 5
  7631. const m_R_390_PC32DBL = 19
  7632. const m_R_390_PC64 = 23
  7633. const m_R_390_PLT16DBL = 18
  7634. const m_R_390_PLT32 = 8
  7635. const m_R_390_PLT32DBL = 20
  7636. const m_R_390_PLT64 = 25
  7637. const m_R_390_PLTOFF16 = 34
  7638. const m_R_390_PLTOFF32 = 35
  7639. const m_R_390_PLTOFF64 = 36
  7640. const m_R_390_RELATIVE = 12
  7641. const m_R_390_TLS_DTPMOD = 54
  7642. const m_R_390_TLS_DTPOFF = 55
  7643. const m_R_390_TLS_GD32 = 40
  7644. const m_R_390_TLS_GD64 = 41
  7645. const m_R_390_TLS_GDCALL = 38
  7646. const m_R_390_TLS_GOTIE12 = 42
  7647. const m_R_390_TLS_GOTIE20 = 60
  7648. const m_R_390_TLS_GOTIE32 = 43
  7649. const m_R_390_TLS_GOTIE64 = 44
  7650. const m_R_390_TLS_IE32 = 47
  7651. const m_R_390_TLS_IE64 = 48
  7652. const m_R_390_TLS_IEENT = 49
  7653. const m_R_390_TLS_LDCALL = 39
  7654. const m_R_390_TLS_LDM32 = 45
  7655. const m_R_390_TLS_LDM64 = 46
  7656. const m_R_390_TLS_LDO32 = 52
  7657. const m_R_390_TLS_LDO64 = 53
  7658. const m_R_390_TLS_LE32 = 50
  7659. const m_R_390_TLS_LE64 = 51
  7660. const m_R_390_TLS_LOAD = 37
  7661. const m_R_390_TLS_TPOFF = 56
  7662. const m_R_68K_16 = 2
  7663. const m_R_68K_32 = 1
  7664. const m_R_68K_8 = 3
  7665. const m_R_68K_COPY = 19
  7666. const m_R_68K_GLOB_DAT = 20
  7667. const m_R_68K_GOT16 = 8
  7668. const m_R_68K_GOT16O = 11
  7669. const m_R_68K_GOT32 = 7
  7670. const m_R_68K_GOT32O = 10
  7671. const m_R_68K_GOT8 = 9
  7672. const m_R_68K_GOT8O = 12
  7673. const m_R_68K_JMP_SLOT = 21
  7674. const m_R_68K_NONE = 0
  7675. const m_R_68K_NUM = 43
  7676. const m_R_68K_PC16 = 5
  7677. const m_R_68K_PC32 = 4
  7678. const m_R_68K_PC8 = 6
  7679. const m_R_68K_PLT16 = 14
  7680. const m_R_68K_PLT16O = 17
  7681. const m_R_68K_PLT32 = 13
  7682. const m_R_68K_PLT32O = 16
  7683. const m_R_68K_PLT8 = 15
  7684. const m_R_68K_PLT8O = 18
  7685. const m_R_68K_RELATIVE = 22
  7686. const m_R_68K_TLS_DTPMOD32 = 40
  7687. const m_R_68K_TLS_DTPREL32 = 41
  7688. const m_R_68K_TLS_GD16 = 26
  7689. const m_R_68K_TLS_GD32 = 25
  7690. const m_R_68K_TLS_GD8 = 27
  7691. const m_R_68K_TLS_IE16 = 35
  7692. const m_R_68K_TLS_IE32 = 34
  7693. const m_R_68K_TLS_IE8 = 36
  7694. const m_R_68K_TLS_LDM16 = 29
  7695. const m_R_68K_TLS_LDM32 = 28
  7696. const m_R_68K_TLS_LDM8 = 30
  7697. const m_R_68K_TLS_LDO16 = 32
  7698. const m_R_68K_TLS_LDO32 = 31
  7699. const m_R_68K_TLS_LDO8 = 33
  7700. const m_R_68K_TLS_LE16 = 38
  7701. const m_R_68K_TLS_LE32 = 37
  7702. const m_R_68K_TLS_LE8 = 39
  7703. const m_R_68K_TLS_TPREL32 = 42
  7704. const m_R_AARCH64_ABS16 = 259
  7705. const m_R_AARCH64_ABS32 = 258
  7706. const m_R_AARCH64_ABS64 = 257
  7707. const m_R_AARCH64_ADD_ABS_LO12_NC = 277
  7708. const m_R_AARCH64_ADR_GOT_PAGE = 311
  7709. const m_R_AARCH64_ADR_PREL_LO21 = 274
  7710. const m_R_AARCH64_ADR_PREL_PG_HI21 = 275
  7711. const m_R_AARCH64_ADR_PREL_PG_HI21_NC = 276
  7712. const m_R_AARCH64_CALL26 = 283
  7713. const m_R_AARCH64_CONDBR19 = 280
  7714. const m_R_AARCH64_COPY = 1024
  7715. const m_R_AARCH64_GLOB_DAT = 1025
  7716. const m_R_AARCH64_GOTREL32 = 308
  7717. const m_R_AARCH64_GOTREL64 = 307
  7718. const m_R_AARCH64_GOT_LD_PREL19 = 309
  7719. const m_R_AARCH64_JUMP26 = 282
  7720. const m_R_AARCH64_JUMP_SLOT = 1026
  7721. const m_R_AARCH64_LD64_GOTOFF_LO15 = 310
  7722. const m_R_AARCH64_LD64_GOTPAGE_LO15 = 313
  7723. const m_R_AARCH64_LD64_GOT_LO12_NC = 312
  7724. const m_R_AARCH64_LDST128_ABS_LO12_NC = 299
  7725. const m_R_AARCH64_LDST16_ABS_LO12_NC = 284
  7726. const m_R_AARCH64_LDST32_ABS_LO12_NC = 285
  7727. const m_R_AARCH64_LDST64_ABS_LO12_NC = 286
  7728. const m_R_AARCH64_LDST8_ABS_LO12_NC = 278
  7729. const m_R_AARCH64_LD_PREL_LO19 = 273
  7730. const m_R_AARCH64_MOVW_GOTOFF_G0 = 300
  7731. const m_R_AARCH64_MOVW_GOTOFF_G0_NC = 301
  7732. const m_R_AARCH64_MOVW_GOTOFF_G1 = 302
  7733. const m_R_AARCH64_MOVW_GOTOFF_G1_NC = 303
  7734. const m_R_AARCH64_MOVW_GOTOFF_G2 = 304
  7735. const m_R_AARCH64_MOVW_GOTOFF_G2_NC = 305
  7736. const m_R_AARCH64_MOVW_GOTOFF_G3 = 306
  7737. const m_R_AARCH64_MOVW_PREL_G0 = 287
  7738. const m_R_AARCH64_MOVW_PREL_G0_NC = 288
  7739. const m_R_AARCH64_MOVW_PREL_G1 = 289
  7740. const m_R_AARCH64_MOVW_PREL_G1_NC = 290
  7741. const m_R_AARCH64_MOVW_PREL_G2 = 291
  7742. const m_R_AARCH64_MOVW_PREL_G2_NC = 292
  7743. const m_R_AARCH64_MOVW_PREL_G3 = 293
  7744. const m_R_AARCH64_MOVW_SABS_G0 = 270
  7745. const m_R_AARCH64_MOVW_SABS_G1 = 271
  7746. const m_R_AARCH64_MOVW_SABS_G2 = 272
  7747. const m_R_AARCH64_MOVW_UABS_G0 = 263
  7748. const m_R_AARCH64_MOVW_UABS_G0_NC = 264
  7749. const m_R_AARCH64_MOVW_UABS_G1 = 265
  7750. const m_R_AARCH64_MOVW_UABS_G1_NC = 266
  7751. const m_R_AARCH64_MOVW_UABS_G2 = 267
  7752. const m_R_AARCH64_MOVW_UABS_G2_NC = 268
  7753. const m_R_AARCH64_MOVW_UABS_G3 = 269
  7754. const m_R_AARCH64_NONE = 0
  7755. const m_R_AARCH64_P32_ABS32 = 1
  7756. const m_R_AARCH64_P32_COPY = 180
  7757. const m_R_AARCH64_P32_GLOB_DAT = 181
  7758. const m_R_AARCH64_P32_IRELATIVE = 188
  7759. const m_R_AARCH64_P32_JUMP_SLOT = 182
  7760. const m_R_AARCH64_P32_RELATIVE = 183
  7761. const m_R_AARCH64_P32_TLSDESC = 187
  7762. const m_R_AARCH64_P32_TLS_DTPMOD = 184
  7763. const m_R_AARCH64_P32_TLS_DTPREL = 185
  7764. const m_R_AARCH64_P32_TLS_TPREL = 186
  7765. const m_R_AARCH64_PREL16 = 262
  7766. const m_R_AARCH64_PREL32 = 261
  7767. const m_R_AARCH64_PREL64 = 260
  7768. const m_R_AARCH64_RELATIVE = 1027
  7769. const m_R_AARCH64_TLSDESC = 1031
  7770. const m_R_AARCH64_TLSDESC_ADD = 568
  7771. const m_R_AARCH64_TLSDESC_ADD_LO12 = 564
  7772. const m_R_AARCH64_TLSDESC_ADR_PAGE21 = 562
  7773. const m_R_AARCH64_TLSDESC_ADR_PREL21 = 561
  7774. const m_R_AARCH64_TLSDESC_CALL = 569
  7775. const m_R_AARCH64_TLSDESC_LD64_LO12 = 563
  7776. const m_R_AARCH64_TLSDESC_LDR = 567
  7777. const m_R_AARCH64_TLSDESC_LD_PREL19 = 560
  7778. const m_R_AARCH64_TLSDESC_OFF_G0_NC = 566
  7779. const m_R_AARCH64_TLSDESC_OFF_G1 = 565
  7780. const m_R_AARCH64_TLSGD_ADD_LO12_NC = 514
  7781. const m_R_AARCH64_TLSGD_ADR_PAGE21 = 513
  7782. const m_R_AARCH64_TLSGD_ADR_PREL21 = 512
  7783. const m_R_AARCH64_TLSGD_MOVW_G0_NC = 516
  7784. const m_R_AARCH64_TLSGD_MOVW_G1 = 515
  7785. const m_R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 = 541
  7786. const m_R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC = 542
  7787. const m_R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 = 543
  7788. const m_R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC = 540
  7789. const m_R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 = 539
  7790. const m_R_AARCH64_TLSLD_ADD_DTPREL_HI12 = 528
  7791. const m_R_AARCH64_TLSLD_ADD_DTPREL_LO12 = 529
  7792. const m_R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC = 530
  7793. const m_R_AARCH64_TLSLD_ADD_LO12_NC = 519
  7794. const m_R_AARCH64_TLSLD_ADR_PAGE21 = 518
  7795. const m_R_AARCH64_TLSLD_ADR_PREL21 = 517
  7796. const m_R_AARCH64_TLSLD_LDST128_DTPREL_LO12 = 572
  7797. const m_R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC = 573
  7798. const m_R_AARCH64_TLSLD_LDST16_DTPREL_LO12 = 533
  7799. const m_R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC = 534
  7800. const m_R_AARCH64_TLSLD_LDST32_DTPREL_LO12 = 535
  7801. const m_R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC = 536
  7802. const m_R_AARCH64_TLSLD_LDST64_DTPREL_LO12 = 537
  7803. const m_R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC = 538
  7804. const m_R_AARCH64_TLSLD_LDST8_DTPREL_LO12 = 531
  7805. const m_R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC = 532
  7806. const m_R_AARCH64_TLSLD_LD_PREL19 = 522
  7807. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G0 = 526
  7808. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC = 527
  7809. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G1 = 524
  7810. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC = 525
  7811. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G2 = 523
  7812. const m_R_AARCH64_TLSLD_MOVW_G0_NC = 521
  7813. const m_R_AARCH64_TLSLD_MOVW_G1 = 520
  7814. const m_R_AARCH64_TLSLE_ADD_TPREL_HI12 = 549
  7815. const m_R_AARCH64_TLSLE_ADD_TPREL_LO12 = 550
  7816. const m_R_AARCH64_TLSLE_ADD_TPREL_LO12_NC = 551
  7817. const m_R_AARCH64_TLSLE_LDST128_TPREL_LO12 = 570
  7818. const m_R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC = 571
  7819. const m_R_AARCH64_TLSLE_LDST16_TPREL_LO12 = 554
  7820. const m_R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC = 555
  7821. const m_R_AARCH64_TLSLE_LDST32_TPREL_LO12 = 556
  7822. const m_R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC = 557
  7823. const m_R_AARCH64_TLSLE_LDST64_TPREL_LO12 = 558
  7824. const m_R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC = 559
  7825. const m_R_AARCH64_TLSLE_LDST8_TPREL_LO12 = 552
  7826. const m_R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC = 553
  7827. const m_R_AARCH64_TLSLE_MOVW_TPREL_G0 = 547
  7828. const m_R_AARCH64_TLSLE_MOVW_TPREL_G0_NC = 548
  7829. const m_R_AARCH64_TLSLE_MOVW_TPREL_G1 = 545
  7830. const m_R_AARCH64_TLSLE_MOVW_TPREL_G1_NC = 546
  7831. const m_R_AARCH64_TLSLE_MOVW_TPREL_G2 = 544
  7832. const m_R_AARCH64_TLS_DTPMOD = 1028
  7833. const m_R_AARCH64_TLS_DTPMOD64 = 1028
  7834. const m_R_AARCH64_TLS_DTPREL = 1029
  7835. const m_R_AARCH64_TLS_DTPREL64 = 1029
  7836. const m_R_AARCH64_TLS_TPREL = 1030
  7837. const m_R_AARCH64_TLS_TPREL64 = 1030
  7838. const m_R_AARCH64_TSTBR14 = 279
  7839. const m_R_ALPHA_BRADDR = 7
  7840. const m_R_ALPHA_COPY = 24
  7841. const m_R_ALPHA_DTPMOD64 = 31
  7842. const m_R_ALPHA_DTPREL16 = 36
  7843. const m_R_ALPHA_DTPREL64 = 33
  7844. const m_R_ALPHA_DTPRELHI = 34
  7845. const m_R_ALPHA_DTPRELLO = 35
  7846. const m_R_ALPHA_GLOB_DAT = 25
  7847. const m_R_ALPHA_GOTDTPREL = 32
  7848. const m_R_ALPHA_GOTTPREL = 37
  7849. const m_R_ALPHA_GPDISP = 6
  7850. const m_R_ALPHA_GPREL16 = 19
  7851. const m_R_ALPHA_GPREL32 = 3
  7852. const m_R_ALPHA_GPRELHIGH = 17
  7853. const m_R_ALPHA_GPRELLOW = 18
  7854. const m_R_ALPHA_HINT = 8
  7855. const m_R_ALPHA_JMP_SLOT = 26
  7856. const m_R_ALPHA_LITERAL = 4
  7857. const m_R_ALPHA_LITUSE = 5
  7858. const m_R_ALPHA_NONE = 0
  7859. const m_R_ALPHA_NUM = 46
  7860. const m_R_ALPHA_REFLONG = 1
  7861. const m_R_ALPHA_REFQUAD = 2
  7862. const m_R_ALPHA_RELATIVE = 27
  7863. const m_R_ALPHA_SREL16 = 9
  7864. const m_R_ALPHA_SREL32 = 10
  7865. const m_R_ALPHA_SREL64 = 11
  7866. const m_R_ALPHA_TLSGD = 29
  7867. const m_R_ALPHA_TLS_GD_HI = 28
  7868. const m_R_ALPHA_TLS_LDM = 30
  7869. const m_R_ALPHA_TPREL16 = 41
  7870. const m_R_ALPHA_TPREL64 = 38
  7871. const m_R_ALPHA_TPRELHI = 39
  7872. const m_R_ALPHA_TPRELLO = 40
  7873. const m_R_ARM_ABS12 = 6
  7874. const m_R_ARM_ABS16 = 5
  7875. const m_R_ARM_ABS32 = 2
  7876. const m_R_ARM_ABS32_NOI = 55
  7877. const m_R_ARM_ABS8 = 8
  7878. const m_R_ARM_ALU_PCREL_15_8 = 33
  7879. const m_R_ARM_ALU_PCREL_23_15 = 34
  7880. const m_R_ARM_ALU_PCREL_7_0 = 32
  7881. const m_R_ARM_ALU_PC_G0 = 58
  7882. const m_R_ARM_ALU_PC_G0_NC = 57
  7883. const m_R_ARM_ALU_PC_G1 = 60
  7884. const m_R_ARM_ALU_PC_G1_NC = 59
  7885. const m_R_ARM_ALU_PC_G2 = 61
  7886. const m_R_ARM_ALU_SBREL_19_12 = 36
  7887. const m_R_ARM_ALU_SBREL_27_20 = 37
  7888. const m_R_ARM_ALU_SB_G0 = 71
  7889. const m_R_ARM_ALU_SB_G0_NC = 70
  7890. const m_R_ARM_ALU_SB_G1 = 73
  7891. const m_R_ARM_ALU_SB_G1_NC = 72
  7892. const m_R_ARM_ALU_SB_G2 = 74
  7893. const m_R_ARM_AMP_VCALL9 = 12
  7894. const m_R_ARM_BASE_ABS = 31
  7895. const m_R_ARM_CALL = 28
  7896. const m_R_ARM_COPY = 20
  7897. const m_R_ARM_GLOB_DAT = 21
  7898. const m_R_ARM_GNU_VTENTRY = 100
  7899. const m_R_ARM_GNU_VTINHERIT = 101
  7900. const m_R_ARM_GOT32 = 26
  7901. const m_R_ARM_GOTOFF = 24
  7902. const m_R_ARM_GOTOFF12 = 98
  7903. const m_R_ARM_GOTPC = 25
  7904. const m_R_ARM_GOTRELAX = 99
  7905. const m_R_ARM_GOT_ABS = 95
  7906. const m_R_ARM_GOT_BREL12 = 97
  7907. const m_R_ARM_GOT_PREL = 96
  7908. const m_R_ARM_IRELATIVE = 160
  7909. const m_R_ARM_JUMP24 = 29
  7910. const m_R_ARM_JUMP_SLOT = 22
  7911. const m_R_ARM_LDC_PC_G0 = 67
  7912. const m_R_ARM_LDC_PC_G1 = 68
  7913. const m_R_ARM_LDC_PC_G2 = 69
  7914. const m_R_ARM_LDC_SB_G0 = 81
  7915. const m_R_ARM_LDC_SB_G1 = 82
  7916. const m_R_ARM_LDC_SB_G2 = 83
  7917. const m_R_ARM_LDRS_PC_G0 = 64
  7918. const m_R_ARM_LDRS_PC_G1 = 65
  7919. const m_R_ARM_LDRS_PC_G2 = 66
  7920. const m_R_ARM_LDRS_SB_G0 = 78
  7921. const m_R_ARM_LDRS_SB_G1 = 79
  7922. const m_R_ARM_LDRS_SB_G2 = 80
  7923. const m_R_ARM_LDR_PC_G1 = 62
  7924. const m_R_ARM_LDR_PC_G2 = 63
  7925. const m_R_ARM_LDR_SBREL_11_0 = 35
  7926. const m_R_ARM_LDR_SB_G0 = 75
  7927. const m_R_ARM_LDR_SB_G1 = 76
  7928. const m_R_ARM_LDR_SB_G2 = 77
  7929. const m_R_ARM_ME_TOO = 128
  7930. const m_R_ARM_MOVT_ABS = 44
  7931. const m_R_ARM_MOVT_BREL = 85
  7932. const m_R_ARM_MOVT_PREL = 46
  7933. const m_R_ARM_MOVW_ABS_NC = 43
  7934. const m_R_ARM_MOVW_BREL = 86
  7935. const m_R_ARM_MOVW_BREL_NC = 84
  7936. const m_R_ARM_MOVW_PREL_NC = 45
  7937. const m_R_ARM_NONE = 0
  7938. const m_R_ARM_NUM = 256
  7939. const m_R_ARM_PC13 = 4
  7940. const m_R_ARM_PC24 = 1
  7941. const m_R_ARM_PLT32 = 27
  7942. const m_R_ARM_PLT32_ABS = 94
  7943. const m_R_ARM_PREL31 = 42
  7944. const m_R_ARM_RABS22 = 253
  7945. const m_R_ARM_RBASE = 255
  7946. const m_R_ARM_REL32 = 3
  7947. const m_R_ARM_REL32_NOI = 56
  7948. const m_R_ARM_RELATIVE = 23
  7949. const m_R_ARM_RPC24 = 254
  7950. const m_R_ARM_RREL32 = 252
  7951. const m_R_ARM_RSBREL32 = 250
  7952. const m_R_ARM_RXPC25 = 249
  7953. const m_R_ARM_SBREL31 = 39
  7954. const m_R_ARM_SBREL32 = 9
  7955. const m_R_ARM_TARGET1 = 38
  7956. const m_R_ARM_TARGET2 = 41
  7957. const m_R_ARM_THM_ABS5 = 7
  7958. const m_R_ARM_THM_ALU_PREL_11_0 = 53
  7959. const m_R_ARM_THM_GOT_BREL12 = 131
  7960. const m_R_ARM_THM_JUMP19 = 51
  7961. const m_R_ARM_THM_JUMP24 = 30
  7962. const m_R_ARM_THM_JUMP6 = 52
  7963. const m_R_ARM_THM_MOVT_ABS = 48
  7964. const m_R_ARM_THM_MOVT_BREL = 88
  7965. const m_R_ARM_THM_MOVT_PREL = 50
  7966. const m_R_ARM_THM_MOVW_ABS_NC = 47
  7967. const m_R_ARM_THM_MOVW_BREL = 89
  7968. const m_R_ARM_THM_MOVW_BREL_NC = 87
  7969. const m_R_ARM_THM_MOVW_PREL_NC = 49
  7970. const m_R_ARM_THM_PC11 = 102
  7971. const m_R_ARM_THM_PC12 = 54
  7972. const m_R_ARM_THM_PC22 = 10
  7973. const m_R_ARM_THM_PC8 = 11
  7974. const m_R_ARM_THM_PC9 = 103
  7975. const m_R_ARM_THM_RPC22 = 251
  7976. const m_R_ARM_THM_SWI8 = 14
  7977. const m_R_ARM_THM_TLS_CALL = 93
  7978. const m_R_ARM_THM_TLS_DESCSEQ = 129
  7979. const m_R_ARM_THM_TLS_DESCSEQ16 = 129
  7980. const m_R_ARM_THM_TLS_DESCSEQ32 = 130
  7981. const m_R_ARM_THM_XPC22 = 16
  7982. const m_R_ARM_TLS_CALL = 91
  7983. const m_R_ARM_TLS_DESC = 13
  7984. const m_R_ARM_TLS_DESCSEQ = 92
  7985. const m_R_ARM_TLS_DTPMOD32 = 17
  7986. const m_R_ARM_TLS_DTPOFF32 = 18
  7987. const m_R_ARM_TLS_GD32 = 104
  7988. const m_R_ARM_TLS_GOTDESC = 90
  7989. const m_R_ARM_TLS_IE12GP = 111
  7990. const m_R_ARM_TLS_IE32 = 107
  7991. const m_R_ARM_TLS_LDM32 = 105
  7992. const m_R_ARM_TLS_LDO12 = 109
  7993. const m_R_ARM_TLS_LDO32 = 106
  7994. const m_R_ARM_TLS_LE12 = 110
  7995. const m_R_ARM_TLS_LE32 = 108
  7996. const m_R_ARM_TLS_TPOFF32 = 19
  7997. const m_R_ARM_V4BX = 40
  7998. const m_R_ARM_XPC25 = 15
  7999. const m_R_BPF_MAP_FD = 1
  8000. const m_R_BPF_NONE = 0
  8001. const m_R_CKCORE_ADDR32 = 1
  8002. const m_R_CKCORE_ADDRGOT = 17
  8003. const m_R_CKCORE_ADDRGOT_HI16 = 36
  8004. const m_R_CKCORE_ADDRGOT_LO16 = 37
  8005. const m_R_CKCORE_ADDRPLT = 18
  8006. const m_R_CKCORE_ADDRPLT_HI16 = 38
  8007. const m_R_CKCORE_ADDRPLT_LO16 = 39
  8008. const m_R_CKCORE_ADDR_HI16 = 24
  8009. const m_R_CKCORE_ADDR_LO16 = 25
  8010. const m_R_CKCORE_COPY = 10
  8011. const m_R_CKCORE_DOFFSET_IMM18 = 44
  8012. const m_R_CKCORE_DOFFSET_IMM18BY2 = 45
  8013. const m_R_CKCORE_DOFFSET_IMM18BY4 = 46
  8014. const m_R_CKCORE_DOFFSET_LO16 = 42
  8015. const m_R_CKCORE_GLOB_DAT = 11
  8016. const m_R_CKCORE_GOT12 = 30
  8017. const m_R_CKCORE_GOT32 = 15
  8018. const m_R_CKCORE_GOTOFF = 13
  8019. const m_R_CKCORE_GOTOFF_HI16 = 28
  8020. const m_R_CKCORE_GOTOFF_LO16 = 29
  8021. const m_R_CKCORE_GOTPC = 14
  8022. const m_R_CKCORE_GOTPC_HI16 = 26
  8023. const m_R_CKCORE_GOTPC_LO16 = 27
  8024. const m_R_CKCORE_GOT_HI16 = 31
  8025. const m_R_CKCORE_GOT_IMM18BY4 = 48
  8026. const m_R_CKCORE_GOT_LO16 = 32
  8027. const m_R_CKCORE_JUMP_SLOT = 12
  8028. const m_R_CKCORE_NONE = 0
  8029. const m_R_CKCORE_PCREL32 = 5
  8030. const m_R_CKCORE_PCRELIMM11BY2 = 3
  8031. const m_R_CKCORE_PCRELIMM8BY4 = 2
  8032. const m_R_CKCORE_PCRELJSR_IMM11BY2 = 6
  8033. const m_R_CKCORE_PCREL_IMM10BY2 = 22
  8034. const m_R_CKCORE_PCREL_IMM10BY4 = 23
  8035. const m_R_CKCORE_PCREL_IMM16BY2 = 20
  8036. const m_R_CKCORE_PCREL_IMM16BY4 = 21
  8037. const m_R_CKCORE_PCREL_IMM18BY2 = 43
  8038. const m_R_CKCORE_PCREL_IMM26BY2 = 19
  8039. const m_R_CKCORE_PCREL_IMM7BY4 = 50
  8040. const m_R_CKCORE_PCREL_JSR_IMM26BY2 = 40
  8041. const m_R_CKCORE_PLT12 = 33
  8042. const m_R_CKCORE_PLT32 = 16
  8043. const m_R_CKCORE_PLT_HI16 = 34
  8044. const m_R_CKCORE_PLT_IMM18BY4 = 49
  8045. const m_R_CKCORE_PLT_LO16 = 35
  8046. const m_R_CKCORE_RELATIVE = 9
  8047. const m_R_CKCORE_TLS_DTPMOD32 = 56
  8048. const m_R_CKCORE_TLS_DTPOFF32 = 57
  8049. const m_R_CKCORE_TLS_GD32 = 53
  8050. const m_R_CKCORE_TLS_IE32 = 52
  8051. const m_R_CKCORE_TLS_LDM32 = 54
  8052. const m_R_CKCORE_TLS_LDO32 = 55
  8053. const m_R_CKCORE_TLS_LE32 = 51
  8054. const m_R_CKCORE_TLS_TPOFF32 = 58
  8055. const m_R_CKCORE_TOFFSET_LO16 = 41
  8056. const m_R_CRIS_16 = 2
  8057. const m_R_CRIS_16_GOT = 13
  8058. const m_R_CRIS_16_GOTPLT = 15
  8059. const m_R_CRIS_16_PCREL = 5
  8060. const m_R_CRIS_32 = 3
  8061. const m_R_CRIS_32_GOT = 14
  8062. const m_R_CRIS_32_GOTPLT = 16
  8063. const m_R_CRIS_32_GOTREL = 17
  8064. const m_R_CRIS_32_PCREL = 6
  8065. const m_R_CRIS_32_PLT_GOTREL = 18
  8066. const m_R_CRIS_32_PLT_PCREL = 19
  8067. const m_R_CRIS_8 = 1
  8068. const m_R_CRIS_8_PCREL = 4
  8069. const m_R_CRIS_COPY = 9
  8070. const m_R_CRIS_GLOB_DAT = 10
  8071. const m_R_CRIS_GNU_VTENTRY = 8
  8072. const m_R_CRIS_GNU_VTINHERIT = 7
  8073. const m_R_CRIS_JUMP_SLOT = 11
  8074. const m_R_CRIS_NONE = 0
  8075. const m_R_CRIS_NUM = 20
  8076. const m_R_CRIS_RELATIVE = 12
  8077. const m_R_IA64_COPY = 0x84
  8078. const m_R_IA64_DIR32LSB = 0x25
  8079. const m_R_IA64_DIR32MSB = 0x24
  8080. const m_R_IA64_DIR64LSB = 0x27
  8081. const m_R_IA64_DIR64MSB = 0x26
  8082. const m_R_IA64_DTPMOD64LSB = 0xa7
  8083. const m_R_IA64_DTPMOD64MSB = 0xa6
  8084. const m_R_IA64_DTPREL14 = 0xb1
  8085. const m_R_IA64_DTPREL22 = 0xb2
  8086. const m_R_IA64_DTPREL32LSB = 0xb5
  8087. const m_R_IA64_DTPREL32MSB = 0xb4
  8088. const m_R_IA64_DTPREL64I = 0xb3
  8089. const m_R_IA64_DTPREL64LSB = 0xb7
  8090. const m_R_IA64_DTPREL64MSB = 0xb6
  8091. const m_R_IA64_FPTR32LSB = 0x45
  8092. const m_R_IA64_FPTR32MSB = 0x44
  8093. const m_R_IA64_FPTR64I = 0x43
  8094. const m_R_IA64_FPTR64LSB = 0x47
  8095. const m_R_IA64_FPTR64MSB = 0x46
  8096. const m_R_IA64_GPREL22 = 0x2a
  8097. const m_R_IA64_GPREL32LSB = 0x2d
  8098. const m_R_IA64_GPREL32MSB = 0x2c
  8099. const m_R_IA64_GPREL64I = 0x2b
  8100. const m_R_IA64_GPREL64LSB = 0x2f
  8101. const m_R_IA64_GPREL64MSB = 0x2e
  8102. const m_R_IA64_IMM14 = 0x21
  8103. const m_R_IA64_IMM22 = 0x22
  8104. const m_R_IA64_IMM64 = 0x23
  8105. const m_R_IA64_IPLTLSB = 0x81
  8106. const m_R_IA64_IPLTMSB = 0x80
  8107. const m_R_IA64_LDXMOV = 0x87
  8108. const m_R_IA64_LTOFF22 = 0x32
  8109. const m_R_IA64_LTOFF22X = 0x86
  8110. const m_R_IA64_LTOFF64I = 0x33
  8111. const m_R_IA64_LTOFF_DTPMOD22 = 0xaa
  8112. const m_R_IA64_LTOFF_DTPREL22 = 0xba
  8113. const m_R_IA64_LTOFF_FPTR22 = 0x52
  8114. const m_R_IA64_LTOFF_FPTR32LSB = 0x55
  8115. const m_R_IA64_LTOFF_FPTR32MSB = 0x54
  8116. const m_R_IA64_LTOFF_FPTR64I = 0x53
  8117. const m_R_IA64_LTOFF_FPTR64LSB = 0x57
  8118. const m_R_IA64_LTOFF_FPTR64MSB = 0x56
  8119. const m_R_IA64_LTOFF_TPREL22 = 0x9a
  8120. const m_R_IA64_LTV32LSB = 0x75
  8121. const m_R_IA64_LTV32MSB = 0x74
  8122. const m_R_IA64_LTV64LSB = 0x77
  8123. const m_R_IA64_LTV64MSB = 0x76
  8124. const m_R_IA64_NONE = 0x00
  8125. const m_R_IA64_PCREL21B = 0x49
  8126. const m_R_IA64_PCREL21BI = 0x79
  8127. const m_R_IA64_PCREL21F = 0x4b
  8128. const m_R_IA64_PCREL21M = 0x4a
  8129. const m_R_IA64_PCREL22 = 0x7a
  8130. const m_R_IA64_PCREL32LSB = 0x4d
  8131. const m_R_IA64_PCREL32MSB = 0x4c
  8132. const m_R_IA64_PCREL60B = 0x48
  8133. const m_R_IA64_PCREL64I = 0x7b
  8134. const m_R_IA64_PCREL64LSB = 0x4f
  8135. const m_R_IA64_PCREL64MSB = 0x4e
  8136. const m_R_IA64_PLTOFF22 = 0x3a
  8137. const m_R_IA64_PLTOFF64I = 0x3b
  8138. const m_R_IA64_PLTOFF64LSB = 0x3f
  8139. const m_R_IA64_PLTOFF64MSB = 0x3e
  8140. const m_R_IA64_REL32LSB = 0x6d
  8141. const m_R_IA64_REL32MSB = 0x6c
  8142. const m_R_IA64_REL64LSB = 0x6f
  8143. const m_R_IA64_REL64MSB = 0x6e
  8144. const m_R_IA64_SECREL32LSB = 0x65
  8145. const m_R_IA64_SECREL32MSB = 0x64
  8146. const m_R_IA64_SECREL64LSB = 0x67
  8147. const m_R_IA64_SECREL64MSB = 0x66
  8148. const m_R_IA64_SEGREL32LSB = 0x5d
  8149. const m_R_IA64_SEGREL32MSB = 0x5c
  8150. const m_R_IA64_SEGREL64LSB = 0x5f
  8151. const m_R_IA64_SEGREL64MSB = 0x5e
  8152. const m_R_IA64_SUB = 0x85
  8153. const m_R_IA64_TPREL14 = 0x91
  8154. const m_R_IA64_TPREL22 = 0x92
  8155. const m_R_IA64_TPREL64I = 0x93
  8156. const m_R_IA64_TPREL64LSB = 0x97
  8157. const m_R_IA64_TPREL64MSB = 0x96
  8158. const m_R_LARCH_32 = 1
  8159. const m_R_LARCH_32_PCREL = 99
  8160. const m_R_LARCH_64 = 2
  8161. const m_R_LARCH_ABS64_HI12 = 70
  8162. const m_R_LARCH_ABS64_LO20 = 69
  8163. const m_R_LARCH_ABS_HI20 = 67
  8164. const m_R_LARCH_ABS_LO12 = 68
  8165. const m_R_LARCH_ADD16 = 48
  8166. const m_R_LARCH_ADD24 = 49
  8167. const m_R_LARCH_ADD32 = 50
  8168. const m_R_LARCH_ADD64 = 51
  8169. const m_R_LARCH_ADD8 = 47
  8170. const m_R_LARCH_B16 = 64
  8171. const m_R_LARCH_B21 = 65
  8172. const m_R_LARCH_B26 = 66
  8173. const m_R_LARCH_COPY = 4
  8174. const m_R_LARCH_GNU_VTENTRY = 58
  8175. const m_R_LARCH_GNU_VTINHERIT = 57
  8176. const m_R_LARCH_GOT64_HI12 = 82
  8177. const m_R_LARCH_GOT64_LO20 = 81
  8178. const m_R_LARCH_GOT64_PC_HI12 = 78
  8179. const m_R_LARCH_GOT64_PC_LO20 = 77
  8180. const m_R_LARCH_GOT_HI20 = 79
  8181. const m_R_LARCH_GOT_LO12 = 80
  8182. const m_R_LARCH_GOT_PC_HI20 = 75
  8183. const m_R_LARCH_GOT_PC_LO12 = 76
  8184. const m_R_LARCH_IRELATIVE = 12
  8185. const m_R_LARCH_JUMP_SLOT = 5
  8186. const m_R_LARCH_MARK_LA = 20
  8187. const m_R_LARCH_MARK_PCREL = 21
  8188. const m_R_LARCH_NONE = 0
  8189. const m_R_LARCH_PCALA64_HI12 = 74
  8190. const m_R_LARCH_PCALA64_LO20 = 73
  8191. const m_R_LARCH_PCALA_HI20 = 71
  8192. const m_R_LARCH_PCALA_LO12 = 72
  8193. const m_R_LARCH_RELATIVE = 3
  8194. const m_R_LARCH_RELAX = 100
  8195. const m_R_LARCH_SOP_ADD = 35
  8196. const m_R_LARCH_SOP_AND = 36
  8197. const m_R_LARCH_SOP_ASSERT = 30
  8198. const m_R_LARCH_SOP_IF_ELSE = 37
  8199. const m_R_LARCH_SOP_NOT = 31
  8200. const m_R_LARCH_SOP_POP_32_S_0_10_10_16_S2 = 45
  8201. const m_R_LARCH_SOP_POP_32_S_0_5_10_16_S2 = 44
  8202. const m_R_LARCH_SOP_POP_32_S_10_12 = 40
  8203. const m_R_LARCH_SOP_POP_32_S_10_16 = 41
  8204. const m_R_LARCH_SOP_POP_32_S_10_16_S2 = 42
  8205. const m_R_LARCH_SOP_POP_32_S_10_5 = 38
  8206. const m_R_LARCH_SOP_POP_32_S_5_20 = 43
  8207. const m_R_LARCH_SOP_POP_32_U = 46
  8208. const m_R_LARCH_SOP_POP_32_U_10_12 = 39
  8209. const m_R_LARCH_SOP_PUSH_ABSOLUTE = 23
  8210. const m_R_LARCH_SOP_PUSH_DUP = 24
  8211. const m_R_LARCH_SOP_PUSH_GPREL = 25
  8212. const m_R_LARCH_SOP_PUSH_PCREL = 22
  8213. const m_R_LARCH_SOP_PUSH_PLT_PCREL = 29
  8214. const m_R_LARCH_SOP_PUSH_TLS_GD = 28
  8215. const m_R_LARCH_SOP_PUSH_TLS_GOT = 27
  8216. const m_R_LARCH_SOP_PUSH_TLS_TPREL = 26
  8217. const m_R_LARCH_SOP_SL = 33
  8218. const m_R_LARCH_SOP_SR = 34
  8219. const m_R_LARCH_SOP_SUB = 32
  8220. const m_R_LARCH_SUB16 = 53
  8221. const m_R_LARCH_SUB24 = 54
  8222. const m_R_LARCH_SUB32 = 55
  8223. const m_R_LARCH_SUB64 = 56
  8224. const m_R_LARCH_SUB8 = 52
  8225. const m_R_LARCH_TLS_DTPMOD32 = 6
  8226. const m_R_LARCH_TLS_DTPMOD64 = 7
  8227. const m_R_LARCH_TLS_DTPREL32 = 8
  8228. const m_R_LARCH_TLS_DTPREL64 = 9
  8229. const m_R_LARCH_TLS_GD_HI20 = 98
  8230. const m_R_LARCH_TLS_GD_PC_HI20 = 97
  8231. const m_R_LARCH_TLS_IE64_HI12 = 94
  8232. const m_R_LARCH_TLS_IE64_LO20 = 93
  8233. const m_R_LARCH_TLS_IE64_PC_HI12 = 90
  8234. const m_R_LARCH_TLS_IE64_PC_LO20 = 89
  8235. const m_R_LARCH_TLS_IE_HI20 = 91
  8236. const m_R_LARCH_TLS_IE_LO12 = 92
  8237. const m_R_LARCH_TLS_IE_PC_HI20 = 87
  8238. const m_R_LARCH_TLS_IE_PC_LO12 = 88
  8239. const m_R_LARCH_TLS_LD_HI20 = 96
  8240. const m_R_LARCH_TLS_LD_PC_HI20 = 95
  8241. const m_R_LARCH_TLS_LE64_HI12 = 86
  8242. const m_R_LARCH_TLS_LE64_LO20 = 85
  8243. const m_R_LARCH_TLS_LE_HI20 = 83
  8244. const m_R_LARCH_TLS_LE_LO12 = 84
  8245. const m_R_LARCH_TLS_TPREL32 = 10
  8246. const m_R_LARCH_TLS_TPREL64 = 11
  8247. const m_R_M32R_10_PCREL = 4
  8248. const m_R_M32R_10_PCREL_RELA = 36
  8249. const m_R_M32R_16 = 1
  8250. const m_R_M32R_16_RELA = 33
  8251. const m_R_M32R_18_PCREL = 5
  8252. const m_R_M32R_18_PCREL_RELA = 37
  8253. const m_R_M32R_24 = 3
  8254. const m_R_M32R_24_RELA = 35
  8255. const m_R_M32R_26_PCREL = 6
  8256. const m_R_M32R_26_PCREL_RELA = 38
  8257. const m_R_M32R_26_PLTREL = 49
  8258. const m_R_M32R_32 = 2
  8259. const m_R_M32R_32_RELA = 34
  8260. const m_R_M32R_COPY = 50
  8261. const m_R_M32R_GLOB_DAT = 51
  8262. const m_R_M32R_GNU_VTENTRY = 12
  8263. const m_R_M32R_GNU_VTINHERIT = 11
  8264. const m_R_M32R_GOT16_HI_SLO = 57
  8265. const m_R_M32R_GOT16_HI_ULO = 56
  8266. const m_R_M32R_GOT16_LO = 58
  8267. const m_R_M32R_GOT24 = 48
  8268. const m_R_M32R_GOTOFF = 54
  8269. const m_R_M32R_GOTOFF_HI_SLO = 63
  8270. const m_R_M32R_GOTOFF_HI_ULO = 62
  8271. const m_R_M32R_GOTOFF_LO = 64
  8272. const m_R_M32R_GOTPC24 = 55
  8273. const m_R_M32R_GOTPC_HI_SLO = 60
  8274. const m_R_M32R_GOTPC_HI_ULO = 59
  8275. const m_R_M32R_GOTPC_LO = 61
  8276. const m_R_M32R_HI16_SLO = 8
  8277. const m_R_M32R_HI16_SLO_RELA = 40
  8278. const m_R_M32R_HI16_ULO = 7
  8279. const m_R_M32R_HI16_ULO_RELA = 39
  8280. const m_R_M32R_JMP_SLOT = 52
  8281. const m_R_M32R_LO16 = 9
  8282. const m_R_M32R_LO16_RELA = 41
  8283. const m_R_M32R_NONE = 0
  8284. const m_R_M32R_NUM = 256
  8285. const m_R_M32R_REL32 = 45
  8286. const m_R_M32R_RELATIVE = 53
  8287. const m_R_M32R_RELA_GNU_VTENTRY = 44
  8288. const m_R_M32R_RELA_GNU_VTINHERIT = 43
  8289. const m_R_M32R_SDA16 = 10
  8290. const m_R_M32R_SDA16_RELA = 42
  8291. const m_R_MICROBLAZE_32 = 1
  8292. const m_R_MICROBLAZE_32_LO = 6
  8293. const m_R_MICROBLAZE_32_PCREL = 2
  8294. const m_R_MICROBLAZE_32_PCREL_LO = 4
  8295. const m_R_MICROBLAZE_32_SYM_OP_SYM = 10
  8296. const m_R_MICROBLAZE_64 = 5
  8297. const m_R_MICROBLAZE_64_NONE = 9
  8298. const m_R_MICROBLAZE_64_PCREL = 3
  8299. const m_R_MICROBLAZE_COPY = 21
  8300. const m_R_MICROBLAZE_GLOB_DAT = 18
  8301. const m_R_MICROBLAZE_GNU_VTENTRY = 12
  8302. const m_R_MICROBLAZE_GNU_VTINHERIT = 11
  8303. const m_R_MICROBLAZE_GOTOFF_32 = 20
  8304. const m_R_MICROBLAZE_GOTOFF_64 = 19
  8305. const m_R_MICROBLAZE_GOTPC_64 = 13
  8306. const m_R_MICROBLAZE_GOT_64 = 14
  8307. const m_R_MICROBLAZE_JUMP_SLOT = 17
  8308. const m_R_MICROBLAZE_NONE = 0
  8309. const m_R_MICROBLAZE_PLT_64 = 15
  8310. const m_R_MICROBLAZE_REL = 16
  8311. const m_R_MICROBLAZE_SRO32 = 7
  8312. const m_R_MICROBLAZE_SRW32 = 8
  8313. const m_R_MICROBLAZE_TLS = 22
  8314. const m_R_MICROBLAZE_TLSDTPMOD32 = 25
  8315. const m_R_MICROBLAZE_TLSDTPREL32 = 26
  8316. const m_R_MICROBLAZE_TLSDTPREL64 = 27
  8317. const m_R_MICROBLAZE_TLSGD = 23
  8318. const m_R_MICROBLAZE_TLSGOTTPREL32 = 28
  8319. const m_R_MICROBLAZE_TLSLD = 24
  8320. const m_R_MICROBLAZE_TLSTPREL32 = 29
  8321. const m_R_MIPS_16 = 1
  8322. const m_R_MIPS_26 = 4
  8323. const m_R_MIPS_32 = 2
  8324. const m_R_MIPS_64 = 18
  8325. const m_R_MIPS_ADD_IMMEDIATE = 34
  8326. const m_R_MIPS_CALL16 = 11
  8327. const m_R_MIPS_CALL_HI16 = 30
  8328. const m_R_MIPS_CALL_LO16 = 31
  8329. const m_R_MIPS_COPY = 126
  8330. const m_R_MIPS_DELETE = 27
  8331. const m_R_MIPS_GLOB_DAT = 51
  8332. const m_R_MIPS_GOT16 = 9
  8333. const m_R_MIPS_GOT_DISP = 19
  8334. const m_R_MIPS_GOT_HI16 = 22
  8335. const m_R_MIPS_GOT_LO16 = 23
  8336. const m_R_MIPS_GOT_OFST = 21
  8337. const m_R_MIPS_GOT_PAGE = 20
  8338. const m_R_MIPS_GPREL16 = 7
  8339. const m_R_MIPS_GPREL32 = 12
  8340. const m_R_MIPS_HI16 = 5
  8341. const m_R_MIPS_HIGHER = 28
  8342. const m_R_MIPS_HIGHEST = 29
  8343. const m_R_MIPS_INSERT_A = 25
  8344. const m_R_MIPS_INSERT_B = 26
  8345. const m_R_MIPS_JALR = 37
  8346. const m_R_MIPS_JUMP_SLOT = 127
  8347. const m_R_MIPS_LITERAL = 8
  8348. const m_R_MIPS_LO16 = 6
  8349. const m_R_MIPS_NONE = 0
  8350. const m_R_MIPS_NUM = 128
  8351. const m_R_MIPS_PC16 = 10
  8352. const m_R_MIPS_PJUMP = 35
  8353. const m_R_MIPS_REL16 = 33
  8354. const m_R_MIPS_REL32 = 3
  8355. const m_R_MIPS_RELGOT = 36
  8356. const m_R_MIPS_SCN_DISP = 32
  8357. const m_R_MIPS_SHIFT5 = 16
  8358. const m_R_MIPS_SHIFT6 = 17
  8359. const m_R_MIPS_SUB = 24
  8360. const m_R_MIPS_TLS_DTPMOD32 = 38
  8361. const m_R_MIPS_TLS_DTPMOD64 = 40
  8362. const m_R_MIPS_TLS_DTPREL32 = 39
  8363. const m_R_MIPS_TLS_DTPREL64 = 41
  8364. const m_R_MIPS_TLS_DTPREL_HI16 = 44
  8365. const m_R_MIPS_TLS_DTPREL_LO16 = 45
  8366. const m_R_MIPS_TLS_GD = 42
  8367. const m_R_MIPS_TLS_GOTTPREL = 46
  8368. const m_R_MIPS_TLS_LDM = 43
  8369. const m_R_MIPS_TLS_TPREL32 = 47
  8370. const m_R_MIPS_TLS_TPREL64 = 48
  8371. const m_R_MIPS_TLS_TPREL_HI16 = 49
  8372. const m_R_MIPS_TLS_TPREL_LO16 = 50
  8373. const m_R_MN10300_16 = 2
  8374. const m_R_MN10300_24 = 9
  8375. const m_R_MN10300_32 = 1
  8376. const m_R_MN10300_8 = 3
  8377. const m_R_MN10300_COPY = 20
  8378. const m_R_MN10300_GLOB_DAT = 21
  8379. const m_R_MN10300_GNU_VTENTRY = 8
  8380. const m_R_MN10300_GNU_VTINHERIT = 7
  8381. const m_R_MN10300_GOT16 = 19
  8382. const m_R_MN10300_GOT24 = 18
  8383. const m_R_MN10300_GOT32 = 17
  8384. const m_R_MN10300_GOTOFF16 = 14
  8385. const m_R_MN10300_GOTOFF24 = 13
  8386. const m_R_MN10300_GOTOFF32 = 12
  8387. const m_R_MN10300_GOTPC16 = 11
  8388. const m_R_MN10300_GOTPC32 = 10
  8389. const m_R_MN10300_JMP_SLOT = 22
  8390. const m_R_MN10300_NONE = 0
  8391. const m_R_MN10300_NUM = 24
  8392. const m_R_MN10300_PCREL16 = 5
  8393. const m_R_MN10300_PCREL32 = 4
  8394. const m_R_MN10300_PCREL8 = 6
  8395. const m_R_MN10300_PLT16 = 16
  8396. const m_R_MN10300_PLT32 = 15
  8397. const m_R_MN10300_RELATIVE = 23
  8398. const m_R_NIOS2_ALIGN = 21
  8399. const m_R_NIOS2_BFD_RELOC_16 = 13
  8400. const m_R_NIOS2_BFD_RELOC_32 = 12
  8401. const m_R_NIOS2_BFD_RELOC_8 = 14
  8402. const m_R_NIOS2_CACHE_OPX = 6
  8403. const m_R_NIOS2_CALL16 = 23
  8404. const m_R_NIOS2_CALL26 = 4
  8405. const m_R_NIOS2_CALL26_NOAT = 41
  8406. const m_R_NIOS2_CALLR = 20
  8407. const m_R_NIOS2_CALL_HA = 45
  8408. const m_R_NIOS2_CALL_LO = 44
  8409. const m_R_NIOS2_CJMP = 19
  8410. const m_R_NIOS2_COPY = 36
  8411. const m_R_NIOS2_GLOB_DAT = 37
  8412. const m_R_NIOS2_GNU_VTENTRY = 17
  8413. const m_R_NIOS2_GNU_VTINHERIT = 16
  8414. const m_R_NIOS2_GOT16 = 22
  8415. const m_R_NIOS2_GOTOFF = 40
  8416. const m_R_NIOS2_GOTOFF_HA = 25
  8417. const m_R_NIOS2_GOTOFF_LO = 24
  8418. const m_R_NIOS2_GOT_HA = 43
  8419. const m_R_NIOS2_GOT_LO = 42
  8420. const m_R_NIOS2_GPREL = 15
  8421. const m_R_NIOS2_HI16 = 9
  8422. const m_R_NIOS2_HIADJ16 = 11
  8423. const m_R_NIOS2_IMM5 = 5
  8424. const m_R_NIOS2_IMM6 = 7
  8425. const m_R_NIOS2_IMM8 = 8
  8426. const m_R_NIOS2_JUMP_SLOT = 38
  8427. const m_R_NIOS2_LO16 = 10
  8428. const m_R_NIOS2_NONE = 0
  8429. const m_R_NIOS2_PCREL16 = 3
  8430. const m_R_NIOS2_PCREL_HA = 27
  8431. const m_R_NIOS2_PCREL_LO = 26
  8432. const m_R_NIOS2_RELATIVE = 39
  8433. const m_R_NIOS2_S16 = 1
  8434. const m_R_NIOS2_TLS_DTPMOD = 33
  8435. const m_R_NIOS2_TLS_DTPREL = 34
  8436. const m_R_NIOS2_TLS_GD16 = 28
  8437. const m_R_NIOS2_TLS_IE16 = 31
  8438. const m_R_NIOS2_TLS_LDM16 = 29
  8439. const m_R_NIOS2_TLS_LDO16 = 30
  8440. const m_R_NIOS2_TLS_LE16 = 32
  8441. const m_R_NIOS2_TLS_TPREL = 35
  8442. const m_R_NIOS2_U16 = 2
  8443. const m_R_NIOS2_UJMP = 18
  8444. const m_R_OR1K_16 = 2
  8445. const m_R_OR1K_16_PCREL = 10
  8446. const m_R_OR1K_32 = 1
  8447. const m_R_OR1K_32_PCREL = 9
  8448. const m_R_OR1K_8 = 3
  8449. const m_R_OR1K_8_PCREL = 11
  8450. const m_R_OR1K_COPY = 18
  8451. const m_R_OR1K_GLOB_DAT = 19
  8452. const m_R_OR1K_GNU_VTENTRY = 7
  8453. const m_R_OR1K_GNU_VTINHERIT = 8
  8454. const m_R_OR1K_GOT16 = 14
  8455. const m_R_OR1K_GOTOFF_HI16 = 16
  8456. const m_R_OR1K_GOTOFF_LO16 = 17
  8457. const m_R_OR1K_GOTPC_HI16 = 12
  8458. const m_R_OR1K_GOTPC_LO16 = 13
  8459. const m_R_OR1K_HI_16_IN_INSN = 5
  8460. const m_R_OR1K_INSN_REL_26 = 6
  8461. const m_R_OR1K_JMP_SLOT = 20
  8462. const m_R_OR1K_LO_16_IN_INSN = 4
  8463. const m_R_OR1K_NONE = 0
  8464. const m_R_OR1K_PLT26 = 15
  8465. const m_R_OR1K_RELATIVE = 21
  8466. const m_R_OR1K_TLS_DTPMOD = 34
  8467. const m_R_OR1K_TLS_DTPOFF = 33
  8468. const m_R_OR1K_TLS_GD_HI16 = 22
  8469. const m_R_OR1K_TLS_GD_LO16 = 23
  8470. const m_R_OR1K_TLS_IE_HI16 = 28
  8471. const m_R_OR1K_TLS_IE_LO16 = 29
  8472. const m_R_OR1K_TLS_LDM_HI16 = 24
  8473. const m_R_OR1K_TLS_LDM_LO16 = 25
  8474. const m_R_OR1K_TLS_LDO_HI16 = 26
  8475. const m_R_OR1K_TLS_LDO_LO16 = 27
  8476. const m_R_OR1K_TLS_LE_HI16 = 30
  8477. const m_R_OR1K_TLS_LE_LO16 = 31
  8478. const m_R_OR1K_TLS_TPOFF = 32
  8479. const m_R_PARISC_COPY = 128
  8480. const m_R_PARISC_DIR14DR = 84
  8481. const m_R_PARISC_DIR14R = 6
  8482. const m_R_PARISC_DIR14WR = 83
  8483. const m_R_PARISC_DIR16DF = 87
  8484. const m_R_PARISC_DIR16F = 85
  8485. const m_R_PARISC_DIR16WF = 86
  8486. const m_R_PARISC_DIR17F = 4
  8487. const m_R_PARISC_DIR17R = 3
  8488. const m_R_PARISC_DIR21L = 2
  8489. const m_R_PARISC_DIR32 = 1
  8490. const m_R_PARISC_DIR64 = 80
  8491. const m_R_PARISC_DPREL14R = 22
  8492. const m_R_PARISC_DPREL21L = 18
  8493. const m_R_PARISC_EPLT = 130
  8494. const m_R_PARISC_FPTR64 = 64
  8495. const m_R_PARISC_GNU_VTENTRY = 232
  8496. const m_R_PARISC_GNU_VTINHERIT = 233
  8497. const m_R_PARISC_GPREL14DR = 92
  8498. const m_R_PARISC_GPREL14R = 30
  8499. const m_R_PARISC_GPREL14WR = 91
  8500. const m_R_PARISC_GPREL16DF = 95
  8501. const m_R_PARISC_GPREL16F = 93
  8502. const m_R_PARISC_GPREL16WF = 94
  8503. const m_R_PARISC_GPREL21L = 26
  8504. const m_R_PARISC_GPREL64 = 88
  8505. const m_R_PARISC_HIRESERVE = 255
  8506. const m_R_PARISC_IPLT = 129
  8507. const m_R_PARISC_LORESERVE = 128
  8508. const m_R_PARISC_LTOFF14DR = 100
  8509. const m_R_PARISC_LTOFF14R = 38
  8510. const m_R_PARISC_LTOFF14WR = 99
  8511. const m_R_PARISC_LTOFF16DF = 103
  8512. const m_R_PARISC_LTOFF16F = 101
  8513. const m_R_PARISC_LTOFF16WF = 102
  8514. const m_R_PARISC_LTOFF21L = 34
  8515. const m_R_PARISC_LTOFF64 = 96
  8516. const m_R_PARISC_LTOFF_FPTR14DR = 124
  8517. const m_R_PARISC_LTOFF_FPTR14R = 62
  8518. const m_R_PARISC_LTOFF_FPTR14WR = 123
  8519. const m_R_PARISC_LTOFF_FPTR16DF = 127
  8520. const m_R_PARISC_LTOFF_FPTR16F = 125
  8521. const m_R_PARISC_LTOFF_FPTR16WF = 126
  8522. const m_R_PARISC_LTOFF_FPTR21L = 58
  8523. const m_R_PARISC_LTOFF_FPTR32 = 57
  8524. const m_R_PARISC_LTOFF_FPTR64 = 120
  8525. const m_R_PARISC_LTOFF_TP14DR = 228
  8526. const m_R_PARISC_LTOFF_TP14F = 167
  8527. const m_R_PARISC_LTOFF_TP14R = 166
  8528. const m_R_PARISC_LTOFF_TP14WR = 227
  8529. const m_R_PARISC_LTOFF_TP16DF = 231
  8530. const m_R_PARISC_LTOFF_TP16F = 229
  8531. const m_R_PARISC_LTOFF_TP16WF = 230
  8532. const m_R_PARISC_LTOFF_TP21L = 162
  8533. const m_R_PARISC_LTOFF_TP64 = 224
  8534. const m_R_PARISC_NONE = 0
  8535. const m_R_PARISC_PCREL14DR = 76
  8536. const m_R_PARISC_PCREL14R = 14
  8537. const m_R_PARISC_PCREL14WR = 75
  8538. const m_R_PARISC_PCREL16DF = 79
  8539. const m_R_PARISC_PCREL16F = 77
  8540. const m_R_PARISC_PCREL16WF = 78
  8541. const m_R_PARISC_PCREL17F = 12
  8542. const m_R_PARISC_PCREL17R = 11
  8543. const m_R_PARISC_PCREL21L = 10
  8544. const m_R_PARISC_PCREL22F = 74
  8545. const m_R_PARISC_PCREL32 = 9
  8546. const m_R_PARISC_PCREL64 = 72
  8547. const m_R_PARISC_PLABEL14R = 70
  8548. const m_R_PARISC_PLABEL21L = 66
  8549. const m_R_PARISC_PLABEL32 = 65
  8550. const m_R_PARISC_PLTOFF14DR = 116
  8551. const m_R_PARISC_PLTOFF14R = 54
  8552. const m_R_PARISC_PLTOFF14WR = 115
  8553. const m_R_PARISC_PLTOFF16DF = 119
  8554. const m_R_PARISC_PLTOFF16F = 117
  8555. const m_R_PARISC_PLTOFF16WF = 118
  8556. const m_R_PARISC_PLTOFF21L = 50
  8557. const m_R_PARISC_SECREL32 = 41
  8558. const m_R_PARISC_SECREL64 = 104
  8559. const m_R_PARISC_SEGBASE = 48
  8560. const m_R_PARISC_SEGREL32 = 49
  8561. const m_R_PARISC_SEGREL64 = 112
  8562. const m_R_PARISC_TLS_DTPMOD32 = 242
  8563. const m_R_PARISC_TLS_DTPMOD64 = 243
  8564. const m_R_PARISC_TLS_DTPOFF32 = 244
  8565. const m_R_PARISC_TLS_DTPOFF64 = 245
  8566. const m_R_PARISC_TLS_GD14R = 235
  8567. const m_R_PARISC_TLS_GD21L = 234
  8568. const m_R_PARISC_TLS_GDCALL = 236
  8569. const m_R_PARISC_TLS_IE14R = "R_PARISC_LTOFF_TP14R"
  8570. const m_R_PARISC_TLS_IE21L = "R_PARISC_LTOFF_TP21L"
  8571. const m_R_PARISC_TLS_LDM14R = 238
  8572. const m_R_PARISC_TLS_LDM21L = 237
  8573. const m_R_PARISC_TLS_LDMCALL = 239
  8574. const m_R_PARISC_TLS_LDO14R = 241
  8575. const m_R_PARISC_TLS_LDO21L = 240
  8576. const m_R_PARISC_TLS_LE14R = "R_PARISC_TPREL14R"
  8577. const m_R_PARISC_TLS_LE21L = "R_PARISC_TPREL21L"
  8578. const m_R_PARISC_TLS_TPREL32 = "R_PARISC_TPREL32"
  8579. const m_R_PARISC_TLS_TPREL64 = "R_PARISC_TPREL64"
  8580. const m_R_PARISC_TPREL14DR = 220
  8581. const m_R_PARISC_TPREL14R = 158
  8582. const m_R_PARISC_TPREL14WR = 219
  8583. const m_R_PARISC_TPREL16DF = 223
  8584. const m_R_PARISC_TPREL16F = 221
  8585. const m_R_PARISC_TPREL16WF = 222
  8586. const m_R_PARISC_TPREL21L = 154
  8587. const m_R_PARISC_TPREL32 = 153
  8588. const m_R_PARISC_TPREL64 = 216
  8589. const m_R_PPC64_ADDR14 = "R_PPC_ADDR14"
  8590. const m_R_PPC64_ADDR14_BRNTAKEN = "R_PPC_ADDR14_BRNTAKEN"
  8591. const m_R_PPC64_ADDR14_BRTAKEN = "R_PPC_ADDR14_BRTAKEN"
  8592. const m_R_PPC64_ADDR16 = "R_PPC_ADDR16"
  8593. const m_R_PPC64_ADDR16_DS = 56
  8594. const m_R_PPC64_ADDR16_HA = "R_PPC_ADDR16_HA"
  8595. const m_R_PPC64_ADDR16_HI = "R_PPC_ADDR16_HI"
  8596. const m_R_PPC64_ADDR16_HIGH = 110
  8597. const m_R_PPC64_ADDR16_HIGHA = 111
  8598. const m_R_PPC64_ADDR16_HIGHER = 39
  8599. const m_R_PPC64_ADDR16_HIGHERA = 40
  8600. const m_R_PPC64_ADDR16_HIGHEST = 41
  8601. const m_R_PPC64_ADDR16_HIGHESTA = 42
  8602. const m_R_PPC64_ADDR16_LO = "R_PPC_ADDR16_LO"
  8603. const m_R_PPC64_ADDR16_LO_DS = 57
  8604. const m_R_PPC64_ADDR24 = "R_PPC_ADDR24"
  8605. const m_R_PPC64_ADDR30 = 37
  8606. const m_R_PPC64_ADDR32 = "R_PPC_ADDR32"
  8607. const m_R_PPC64_ADDR64 = 38
  8608. const m_R_PPC64_COPY = "R_PPC_COPY"
  8609. const m_R_PPC64_DTPMOD64 = 68
  8610. const m_R_PPC64_DTPREL16 = 74
  8611. const m_R_PPC64_DTPREL16_DS = 101
  8612. const m_R_PPC64_DTPREL16_HA = 77
  8613. const m_R_PPC64_DTPREL16_HI = 76
  8614. const m_R_PPC64_DTPREL16_HIGH = 114
  8615. const m_R_PPC64_DTPREL16_HIGHA = 115
  8616. const m_R_PPC64_DTPREL16_HIGHER = 103
  8617. const m_R_PPC64_DTPREL16_HIGHERA = 104
  8618. const m_R_PPC64_DTPREL16_HIGHEST = 105
  8619. const m_R_PPC64_DTPREL16_HIGHESTA = 106
  8620. const m_R_PPC64_DTPREL16_LO = 75
  8621. const m_R_PPC64_DTPREL16_LO_DS = 102
  8622. const m_R_PPC64_DTPREL64 = 78
  8623. const m_R_PPC64_GLOB_DAT = "R_PPC_GLOB_DAT"
  8624. const m_R_PPC64_GOT16 = "R_PPC_GOT16"
  8625. const m_R_PPC64_GOT16_DS = 58
  8626. const m_R_PPC64_GOT16_HA = "R_PPC_GOT16_HA"
  8627. const m_R_PPC64_GOT16_HI = "R_PPC_GOT16_HI"
  8628. const m_R_PPC64_GOT16_LO = "R_PPC_GOT16_LO"
  8629. const m_R_PPC64_GOT16_LO_DS = 59
  8630. const m_R_PPC64_GOT_DTPREL16_DS = 91
  8631. const m_R_PPC64_GOT_DTPREL16_HA = 94
  8632. const m_R_PPC64_GOT_DTPREL16_HI = 93
  8633. const m_R_PPC64_GOT_DTPREL16_LO_DS = 92
  8634. const m_R_PPC64_GOT_TLSGD16 = 79
  8635. const m_R_PPC64_GOT_TLSGD16_HA = 82
  8636. const m_R_PPC64_GOT_TLSGD16_HI = 81
  8637. const m_R_PPC64_GOT_TLSGD16_LO = 80
  8638. const m_R_PPC64_GOT_TLSLD16 = 83
  8639. const m_R_PPC64_GOT_TLSLD16_HA = 86
  8640. const m_R_PPC64_GOT_TLSLD16_HI = 85
  8641. const m_R_PPC64_GOT_TLSLD16_LO = 84
  8642. const m_R_PPC64_GOT_TPREL16_DS = 87
  8643. const m_R_PPC64_GOT_TPREL16_HA = 90
  8644. const m_R_PPC64_GOT_TPREL16_HI = 89
  8645. const m_R_PPC64_GOT_TPREL16_LO_DS = 88
  8646. const m_R_PPC64_IRELATIVE = 248
  8647. const m_R_PPC64_JMP_IREL = 247
  8648. const m_R_PPC64_JMP_SLOT = "R_PPC_JMP_SLOT"
  8649. const m_R_PPC64_NONE = "R_PPC_NONE"
  8650. const m_R_PPC64_PLT16_HA = "R_PPC_PLT16_HA"
  8651. const m_R_PPC64_PLT16_HI = "R_PPC_PLT16_HI"
  8652. const m_R_PPC64_PLT16_LO = "R_PPC_PLT16_LO"
  8653. const m_R_PPC64_PLT16_LO_DS = 60
  8654. const m_R_PPC64_PLT32 = "R_PPC_PLT32"
  8655. const m_R_PPC64_PLT64 = 45
  8656. const m_R_PPC64_PLTGOT16 = 52
  8657. const m_R_PPC64_PLTGOT16_DS = 65
  8658. const m_R_PPC64_PLTGOT16_HA = 55
  8659. const m_R_PPC64_PLTGOT16_HI = 54
  8660. const m_R_PPC64_PLTGOT16_LO = 53
  8661. const m_R_PPC64_PLTGOT16_LO_DS = 66
  8662. const m_R_PPC64_PLTREL32 = "R_PPC_PLTREL32"
  8663. const m_R_PPC64_PLTREL64 = 46
  8664. const m_R_PPC64_REL14 = "R_PPC_REL14"
  8665. const m_R_PPC64_REL14_BRNTAKEN = "R_PPC_REL14_BRNTAKEN"
  8666. const m_R_PPC64_REL14_BRTAKEN = "R_PPC_REL14_BRTAKEN"
  8667. const m_R_PPC64_REL16 = 249
  8668. const m_R_PPC64_REL16_HA = 252
  8669. const m_R_PPC64_REL16_HI = 251
  8670. const m_R_PPC64_REL16_LO = 250
  8671. const m_R_PPC64_REL24 = "R_PPC_REL24"
  8672. const m_R_PPC64_REL32 = "R_PPC_REL32"
  8673. const m_R_PPC64_REL64 = 44
  8674. const m_R_PPC64_RELATIVE = "R_PPC_RELATIVE"
  8675. const m_R_PPC64_SECTOFF = "R_PPC_SECTOFF"
  8676. const m_R_PPC64_SECTOFF_DS = 61
  8677. const m_R_PPC64_SECTOFF_HA = "R_PPC_SECTOFF_HA"
  8678. const m_R_PPC64_SECTOFF_HI = "R_PPC_SECTOFF_HI"
  8679. const m_R_PPC64_SECTOFF_LO = "R_PPC_SECTOFF_LO"
  8680. const m_R_PPC64_SECTOFF_LO_DS = 62
  8681. const m_R_PPC64_TLS = 67
  8682. const m_R_PPC64_TLSGD = 107
  8683. const m_R_PPC64_TLSLD = 108
  8684. const m_R_PPC64_TOC = 51
  8685. const m_R_PPC64_TOC16 = 47
  8686. const m_R_PPC64_TOC16_DS = 63
  8687. const m_R_PPC64_TOC16_HA = 50
  8688. const m_R_PPC64_TOC16_HI = 49
  8689. const m_R_PPC64_TOC16_LO = 48
  8690. const m_R_PPC64_TOC16_LO_DS = 64
  8691. const m_R_PPC64_TOCSAVE = 109
  8692. const m_R_PPC64_TPREL16 = 69
  8693. const m_R_PPC64_TPREL16_DS = 95
  8694. const m_R_PPC64_TPREL16_HA = 72
  8695. const m_R_PPC64_TPREL16_HI = 71
  8696. const m_R_PPC64_TPREL16_HIGH = 112
  8697. const m_R_PPC64_TPREL16_HIGHA = 113
  8698. const m_R_PPC64_TPREL16_HIGHER = 97
  8699. const m_R_PPC64_TPREL16_HIGHERA = 98
  8700. const m_R_PPC64_TPREL16_HIGHEST = 99
  8701. const m_R_PPC64_TPREL16_HIGHESTA = 100
  8702. const m_R_PPC64_TPREL16_LO = 70
  8703. const m_R_PPC64_TPREL16_LO_DS = 96
  8704. const m_R_PPC64_TPREL64 = 73
  8705. const m_R_PPC64_UADDR16 = "R_PPC_UADDR16"
  8706. const m_R_PPC64_UADDR32 = "R_PPC_UADDR32"
  8707. const m_R_PPC64_UADDR64 = 43
  8708. const m_R_PPC_ADDR14 = 7
  8709. const m_R_PPC_ADDR14_BRNTAKEN = 9
  8710. const m_R_PPC_ADDR14_BRTAKEN = 8
  8711. const m_R_PPC_ADDR16 = 3
  8712. const m_R_PPC_ADDR16_HA = 6
  8713. const m_R_PPC_ADDR16_HI = 5
  8714. const m_R_PPC_ADDR16_LO = 4
  8715. const m_R_PPC_ADDR24 = 2
  8716. const m_R_PPC_ADDR32 = 1
  8717. const m_R_PPC_COPY = 19
  8718. const m_R_PPC_DIAB_RELSDA_HA = 185
  8719. const m_R_PPC_DIAB_RELSDA_HI = 184
  8720. const m_R_PPC_DIAB_RELSDA_LO = 183
  8721. const m_R_PPC_DIAB_SDA21_HA = 182
  8722. const m_R_PPC_DIAB_SDA21_HI = 181
  8723. const m_R_PPC_DIAB_SDA21_LO = 180
  8724. const m_R_PPC_DTPMOD32 = 68
  8725. const m_R_PPC_DTPREL16 = 74
  8726. const m_R_PPC_DTPREL16_HA = 77
  8727. const m_R_PPC_DTPREL16_HI = 76
  8728. const m_R_PPC_DTPREL16_LO = 75
  8729. const m_R_PPC_DTPREL32 = 78
  8730. const m_R_PPC_EMB_BIT_FLD = 115
  8731. const m_R_PPC_EMB_MRKREF = 110
  8732. const m_R_PPC_EMB_NADDR16 = 102
  8733. const m_R_PPC_EMB_NADDR16_HA = 105
  8734. const m_R_PPC_EMB_NADDR16_HI = 104
  8735. const m_R_PPC_EMB_NADDR16_LO = 103
  8736. const m_R_PPC_EMB_NADDR32 = 101
  8737. const m_R_PPC_EMB_RELSDA = 116
  8738. const m_R_PPC_EMB_RELSEC16 = 111
  8739. const m_R_PPC_EMB_RELST_HA = 114
  8740. const m_R_PPC_EMB_RELST_HI = 113
  8741. const m_R_PPC_EMB_RELST_LO = 112
  8742. const m_R_PPC_EMB_SDA21 = 109
  8743. const m_R_PPC_EMB_SDA2I16 = 107
  8744. const m_R_PPC_EMB_SDA2REL = 108
  8745. const m_R_PPC_EMB_SDAI16 = 106
  8746. const m_R_PPC_GLOB_DAT = 20
  8747. const m_R_PPC_GOT16 = 14
  8748. const m_R_PPC_GOT16_HA = 17
  8749. const m_R_PPC_GOT16_HI = 16
  8750. const m_R_PPC_GOT16_LO = 15
  8751. const m_R_PPC_GOT_DTPREL16 = 91
  8752. const m_R_PPC_GOT_DTPREL16_HA = 94
  8753. const m_R_PPC_GOT_DTPREL16_HI = 93
  8754. const m_R_PPC_GOT_DTPREL16_LO = 92
  8755. const m_R_PPC_GOT_TLSGD16 = 79
  8756. const m_R_PPC_GOT_TLSGD16_HA = 82
  8757. const m_R_PPC_GOT_TLSGD16_HI = 81
  8758. const m_R_PPC_GOT_TLSGD16_LO = 80
  8759. const m_R_PPC_GOT_TLSLD16 = 83
  8760. const m_R_PPC_GOT_TLSLD16_HA = 86
  8761. const m_R_PPC_GOT_TLSLD16_HI = 85
  8762. const m_R_PPC_GOT_TLSLD16_LO = 84
  8763. const m_R_PPC_GOT_TPREL16 = 87
  8764. const m_R_PPC_GOT_TPREL16_HA = 90
  8765. const m_R_PPC_GOT_TPREL16_HI = 89
  8766. const m_R_PPC_GOT_TPREL16_LO = 88
  8767. const m_R_PPC_IRELATIVE = 248
  8768. const m_R_PPC_JMP_SLOT = 21
  8769. const m_R_PPC_LOCAL24PC = 23
  8770. const m_R_PPC_NONE = 0
  8771. const m_R_PPC_PLT16_HA = 31
  8772. const m_R_PPC_PLT16_HI = 30
  8773. const m_R_PPC_PLT16_LO = 29
  8774. const m_R_PPC_PLT32 = 27
  8775. const m_R_PPC_PLTREL24 = 18
  8776. const m_R_PPC_PLTREL32 = 28
  8777. const m_R_PPC_REL14 = 11
  8778. const m_R_PPC_REL14_BRNTAKEN = 13
  8779. const m_R_PPC_REL14_BRTAKEN = 12
  8780. const m_R_PPC_REL16 = 249
  8781. const m_R_PPC_REL16_HA = 252
  8782. const m_R_PPC_REL16_HI = 251
  8783. const m_R_PPC_REL16_LO = 250
  8784. const m_R_PPC_REL24 = 10
  8785. const m_R_PPC_REL32 = 26
  8786. const m_R_PPC_RELATIVE = 22
  8787. const m_R_PPC_SDAREL16 = 32
  8788. const m_R_PPC_SECTOFF = 33
  8789. const m_R_PPC_SECTOFF_HA = 36
  8790. const m_R_PPC_SECTOFF_HI = 35
  8791. const m_R_PPC_SECTOFF_LO = 34
  8792. const m_R_PPC_TLS = 67
  8793. const m_R_PPC_TLSGD = 95
  8794. const m_R_PPC_TLSLD = 96
  8795. const m_R_PPC_TOC16 = 255
  8796. const m_R_PPC_TPREL16 = 69
  8797. const m_R_PPC_TPREL16_HA = 72
  8798. const m_R_PPC_TPREL16_HI = 71
  8799. const m_R_PPC_TPREL16_LO = 70
  8800. const m_R_PPC_TPREL32 = 73
  8801. const m_R_PPC_UADDR16 = 25
  8802. const m_R_PPC_UADDR32 = 24
  8803. const m_R_RISCV_32 = 1
  8804. const m_R_RISCV_32_PCREL = 57
  8805. const m_R_RISCV_64 = 2
  8806. const m_R_RISCV_ADD16 = 34
  8807. const m_R_RISCV_ADD32 = 35
  8808. const m_R_RISCV_ADD64 = 36
  8809. const m_R_RISCV_ADD8 = 33
  8810. const m_R_RISCV_ALIGN = 43
  8811. const m_R_RISCV_BRANCH = 16
  8812. const m_R_RISCV_CALL = 18
  8813. const m_R_RISCV_CALL_PLT = 19
  8814. const m_R_RISCV_COPY = 4
  8815. const m_R_RISCV_GOT32_PCREL = 41
  8816. const m_R_RISCV_GOT_HI20 = 20
  8817. const m_R_RISCV_HI20 = 26
  8818. const m_R_RISCV_IRELATIVE = 58
  8819. const m_R_RISCV_JAL = 17
  8820. const m_R_RISCV_JUMP_SLOT = 5
  8821. const m_R_RISCV_LO12_I = 27
  8822. const m_R_RISCV_LO12_S = 28
  8823. const m_R_RISCV_NONE = 0
  8824. const m_R_RISCV_PCREL_HI20 = 23
  8825. const m_R_RISCV_PCREL_LO12_I = 24
  8826. const m_R_RISCV_PCREL_LO12_S = 25
  8827. const m_R_RISCV_PLT32 = 59
  8828. const m_R_RISCV_RELATIVE = 3
  8829. const m_R_RISCV_RELAX = 51
  8830. const m_R_RISCV_RVC_BRANCH = 44
  8831. const m_R_RISCV_RVC_JUMP = 45
  8832. const m_R_RISCV_RVC_LUI = 46
  8833. const m_R_RISCV_SET16 = 55
  8834. const m_R_RISCV_SET32 = 56
  8835. const m_R_RISCV_SET6 = 53
  8836. const m_R_RISCV_SET8 = 54
  8837. const m_R_RISCV_SET_ULEB128 = 60
  8838. const m_R_RISCV_SUB16 = 38
  8839. const m_R_RISCV_SUB32 = 39
  8840. const m_R_RISCV_SUB6 = 52
  8841. const m_R_RISCV_SUB64 = 40
  8842. const m_R_RISCV_SUB8 = 37
  8843. const m_R_RISCV_SUB_ULEB128 = 61
  8844. const m_R_RISCV_TLSDESC = 12
  8845. const m_R_RISCV_TLSDESC_ADD_LO12 = 64
  8846. const m_R_RISCV_TLSDESC_CALL = 65
  8847. const m_R_RISCV_TLSDESC_HI20 = 62
  8848. const m_R_RISCV_TLSDESC_LOAD_LO12 = 63
  8849. const m_R_RISCV_TLS_DTPMOD32 = 6
  8850. const m_R_RISCV_TLS_DTPMOD64 = 7
  8851. const m_R_RISCV_TLS_DTPREL32 = 8
  8852. const m_R_RISCV_TLS_DTPREL64 = 9
  8853. const m_R_RISCV_TLS_GD_HI20 = 22
  8854. const m_R_RISCV_TLS_GOT_HI20 = 21
  8855. const m_R_RISCV_TLS_TPREL32 = 10
  8856. const m_R_RISCV_TLS_TPREL64 = 11
  8857. const m_R_RISCV_TPREL_ADD = 32
  8858. const m_R_RISCV_TPREL_HI20 = 29
  8859. const m_R_RISCV_TPREL_LO12_I = 30
  8860. const m_R_RISCV_TPREL_LO12_S = 31
  8861. const m_R_SH_ALIGN = 29
  8862. const m_R_SH_CODE = 30
  8863. const m_R_SH_COPY = 162
  8864. const m_R_SH_COUNT = 28
  8865. const m_R_SH_DATA = 31
  8866. const m_R_SH_DIR32 = 1
  8867. const m_R_SH_DIR8BP = 7
  8868. const m_R_SH_DIR8L = 9
  8869. const m_R_SH_DIR8W = 8
  8870. const m_R_SH_DIR8WPL = 5
  8871. const m_R_SH_DIR8WPN = 3
  8872. const m_R_SH_DIR8WPZ = 6
  8873. const m_R_SH_FUNCDESC = 207
  8874. const m_R_SH_FUNCDESC_VALUE = 208
  8875. const m_R_SH_GLOB_DAT = 163
  8876. const m_R_SH_GNU_VTENTRY = 35
  8877. const m_R_SH_GNU_VTINHERIT = 34
  8878. const m_R_SH_GOT20 = 201
  8879. const m_R_SH_GOT32 = 160
  8880. const m_R_SH_GOTFUNCDESC = 203
  8881. const m_R_SH_GOTFUNCDEST20 = 204
  8882. const m_R_SH_GOTOFF = 166
  8883. const m_R_SH_GOTOFF20 = 202
  8884. const m_R_SH_GOTOFFFUNCDESC = 205
  8885. const m_R_SH_GOTOFFFUNCDEST20 = 206
  8886. const m_R_SH_GOTPC = 167
  8887. const m_R_SH_IND12W = 4
  8888. const m_R_SH_JMP_SLOT = 164
  8889. const m_R_SH_LABEL = 32
  8890. const m_R_SH_NONE = 0
  8891. const m_R_SH_NUM = 256
  8892. const m_R_SH_PLT32 = 161
  8893. const m_R_SH_REL32 = 2
  8894. const m_R_SH_RELATIVE = 165
  8895. const m_R_SH_SWITCH16 = 25
  8896. const m_R_SH_SWITCH32 = 26
  8897. const m_R_SH_SWITCH8 = 33
  8898. const m_R_SH_TLS_DTPMOD32 = 149
  8899. const m_R_SH_TLS_DTPOFF32 = 150
  8900. const m_R_SH_TLS_GD_32 = 144
  8901. const m_R_SH_TLS_IE_32 = 147
  8902. const m_R_SH_TLS_LDO_32 = 146
  8903. const m_R_SH_TLS_LD_32 = 145
  8904. const m_R_SH_TLS_LE_32 = 148
  8905. const m_R_SH_TLS_TPOFF32 = 151
  8906. const m_R_SH_USES = 27
  8907. const m_R_SPARC_10 = 30
  8908. const m_R_SPARC_11 = 31
  8909. const m_R_SPARC_13 = 11
  8910. const m_R_SPARC_16 = 2
  8911. const m_R_SPARC_22 = 10
  8912. const m_R_SPARC_32 = 3
  8913. const m_R_SPARC_5 = 44
  8914. const m_R_SPARC_6 = 45
  8915. const m_R_SPARC_64 = 32
  8916. const m_R_SPARC_7 = 43
  8917. const m_R_SPARC_8 = 1
  8918. const m_R_SPARC_COPY = 19
  8919. const m_R_SPARC_DISP16 = 5
  8920. const m_R_SPARC_DISP32 = 6
  8921. const m_R_SPARC_DISP64 = 46
  8922. const m_R_SPARC_DISP8 = 4
  8923. const m_R_SPARC_GLOB_DAT = 20
  8924. const m_R_SPARC_GLOB_JMP = 42
  8925. const m_R_SPARC_GNU_VTENTRY = 251
  8926. const m_R_SPARC_GNU_VTINHERIT = 250
  8927. const m_R_SPARC_GOT10 = 13
  8928. const m_R_SPARC_GOT13 = 14
  8929. const m_R_SPARC_GOT22 = 15
  8930. const m_R_SPARC_GOTDATA_HIX22 = 80
  8931. const m_R_SPARC_GOTDATA_LOX10 = 81
  8932. const m_R_SPARC_GOTDATA_OP = 84
  8933. const m_R_SPARC_GOTDATA_OP_HIX22 = 82
  8934. const m_R_SPARC_GOTDATA_OP_LOX10 = 83
  8935. const m_R_SPARC_H34 = 85
  8936. const m_R_SPARC_H44 = 50
  8937. const m_R_SPARC_HH22 = 34
  8938. const m_R_SPARC_HI22 = 9
  8939. const m_R_SPARC_HIPLT22 = 25
  8940. const m_R_SPARC_HIX22 = 48
  8941. const m_R_SPARC_HM10 = 35
  8942. const m_R_SPARC_JMP_SLOT = 21
  8943. const m_R_SPARC_L44 = 52
  8944. const m_R_SPARC_LM22 = 36
  8945. const m_R_SPARC_LO10 = 12
  8946. const m_R_SPARC_LOPLT10 = 26
  8947. const m_R_SPARC_LOX10 = 49
  8948. const m_R_SPARC_M44 = 51
  8949. const m_R_SPARC_NONE = 0
  8950. const m_R_SPARC_NUM = 253
  8951. const m_R_SPARC_OLO10 = 33
  8952. const m_R_SPARC_PC10 = 16
  8953. const m_R_SPARC_PC22 = 17
  8954. const m_R_SPARC_PCPLT10 = 29
  8955. const m_R_SPARC_PCPLT22 = 28
  8956. const m_R_SPARC_PCPLT32 = 27
  8957. const m_R_SPARC_PC_HH22 = 37
  8958. const m_R_SPARC_PC_HM10 = 38
  8959. const m_R_SPARC_PC_LM22 = 39
  8960. const m_R_SPARC_PLT32 = 24
  8961. const m_R_SPARC_PLT64 = 47
  8962. const m_R_SPARC_REGISTER = 53
  8963. const m_R_SPARC_RELATIVE = 22
  8964. const m_R_SPARC_REV32 = 252
  8965. const m_R_SPARC_SIZE32 = 86
  8966. const m_R_SPARC_SIZE64 = 87
  8967. const m_R_SPARC_TLS_DTPMOD32 = 74
  8968. const m_R_SPARC_TLS_DTPMOD64 = 75
  8969. const m_R_SPARC_TLS_DTPOFF32 = 76
  8970. const m_R_SPARC_TLS_DTPOFF64 = 77
  8971. const m_R_SPARC_TLS_GD_ADD = 58
  8972. const m_R_SPARC_TLS_GD_CALL = 59
  8973. const m_R_SPARC_TLS_GD_HI22 = 56
  8974. const m_R_SPARC_TLS_GD_LO10 = 57
  8975. const m_R_SPARC_TLS_IE_ADD = 71
  8976. const m_R_SPARC_TLS_IE_HI22 = 67
  8977. const m_R_SPARC_TLS_IE_LD = 69
  8978. const m_R_SPARC_TLS_IE_LDX = 70
  8979. const m_R_SPARC_TLS_IE_LO10 = 68
  8980. const m_R_SPARC_TLS_LDM_ADD = 62
  8981. const m_R_SPARC_TLS_LDM_CALL = 63
  8982. const m_R_SPARC_TLS_LDM_HI22 = 60
  8983. const m_R_SPARC_TLS_LDM_LO10 = 61
  8984. const m_R_SPARC_TLS_LDO_ADD = 66
  8985. const m_R_SPARC_TLS_LDO_HIX22 = 64
  8986. const m_R_SPARC_TLS_LDO_LOX10 = 65
  8987. const m_R_SPARC_TLS_LE_HIX22 = 72
  8988. const m_R_SPARC_TLS_LE_LOX10 = 73
  8989. const m_R_SPARC_TLS_TPOFF32 = 78
  8990. const m_R_SPARC_TLS_TPOFF64 = 79
  8991. const m_R_SPARC_UA16 = 55
  8992. const m_R_SPARC_UA32 = 23
  8993. const m_R_SPARC_UA64 = 54
  8994. const m_R_SPARC_WDISP16 = 40
  8995. const m_R_SPARC_WDISP19 = 41
  8996. const m_R_SPARC_WDISP22 = 8
  8997. const m_R_SPARC_WDISP30 = 7
  8998. const m_R_SPARC_WPLT30 = 18
  8999. const m_R_X86_64_16 = 12
  9000. const m_R_X86_64_32 = 10
  9001. const m_R_X86_64_32S = 11
  9002. const m_R_X86_64_64 = 1
  9003. const m_R_X86_64_8 = 14
  9004. const m_R_X86_64_COPY = 5
  9005. const m_R_X86_64_DTPMOD64 = 16
  9006. const m_R_X86_64_DTPOFF32 = 21
  9007. const m_R_X86_64_DTPOFF64 = 17
  9008. const m_R_X86_64_GLOB_DAT = 6
  9009. const m_R_X86_64_GOT32 = 3
  9010. const m_R_X86_64_GOT64 = 27
  9011. const m_R_X86_64_GOTOFF64 = 25
  9012. const m_R_X86_64_GOTPC32 = 26
  9013. const m_R_X86_64_GOTPC32_TLSDESC = 34
  9014. const m_R_X86_64_GOTPC64 = 29
  9015. const m_R_X86_64_GOTPCREL = 9
  9016. const m_R_X86_64_GOTPCREL64 = 28
  9017. const m_R_X86_64_GOTPCRELX = 41
  9018. const m_R_X86_64_GOTPLT64 = 30
  9019. const m_R_X86_64_GOTTPOFF = 22
  9020. const m_R_X86_64_IRELATIVE = 37
  9021. const m_R_X86_64_JUMP_SLOT = 7
  9022. const m_R_X86_64_NONE = 0
  9023. const m_R_X86_64_NUM = 43
  9024. const m_R_X86_64_PC16 = 13
  9025. const m_R_X86_64_PC32 = 2
  9026. const m_R_X86_64_PC64 = 24
  9027. const m_R_X86_64_PC8 = 15
  9028. const m_R_X86_64_PLT32 = 4
  9029. const m_R_X86_64_PLTOFF64 = 31
  9030. const m_R_X86_64_RELATIVE = 8
  9031. const m_R_X86_64_RELATIVE64 = 38
  9032. const m_R_X86_64_REX_GOTPCRELX = 42
  9033. const m_R_X86_64_SIZE32 = 32
  9034. const m_R_X86_64_SIZE64 = 33
  9035. const m_R_X86_64_TLSDESC = 36
  9036. const m_R_X86_64_TLSDESC_CALL = 35
  9037. const m_R_X86_64_TLSGD = 19
  9038. const m_R_X86_64_TLSLD = 20
  9039. const m_R_X86_64_TPOFF32 = 23
  9040. const m_R_X86_64_TPOFF64 = 18
  9041. const m_SELFMAG = 4
  9042. const m_SHF_ALPHA_GPREL = 0x10000000
  9043. const m_SHF_ARM_COMDEF = 0x80000000
  9044. const m_SHF_ARM_ENTRYSECT = 0x10000000
  9045. const m_SHF_IA_64_NORECOV = 0x20000000
  9046. const m_SHF_IA_64_SHORT = 0x10000000
  9047. const m_SHF_MASKOS = 0x0ff00000
  9048. const m_SHF_MASKPROC = 0xf0000000
  9049. const m_SHF_MIPS_ADDR = 0x40000000
  9050. const m_SHF_MIPS_GPREL = 0x10000000
  9051. const m_SHF_MIPS_LOCAL = 0x04000000
  9052. const m_SHF_MIPS_MERGE = 0x20000000
  9053. const m_SHF_MIPS_NAMES = 0x02000000
  9054. const m_SHF_MIPS_NODUPE = 0x01000000
  9055. const m_SHF_MIPS_NOSTRIP = 0x08000000
  9056. const m_SHF_MIPS_STRINGS = 0x80000000
  9057. const m_SHF_PARISC_HUGE = 0x40000000
  9058. const m_SHF_PARISC_SBP = 0x80000000
  9059. const m_SHF_PARISC_SHORT = 0x20000000
  9060. const m_SHN_ABS = 65521
  9061. const m_SHN_AFTER = 0xff01
  9062. const m_SHN_BEFORE = 0xff00
  9063. const m_SHN_COMMON = 65522
  9064. const m_SHN_HIOS = 0xff3f
  9065. const m_SHN_HIPROC = 0xff1f
  9066. const m_SHN_HIRESERVE = 0xffff
  9067. const m_SHN_LOOS = 0xff20
  9068. const m_SHN_LOPROC = 0xff00
  9069. const m_SHN_LORESERVE = 0xff00
  9070. const m_SHN_MIPS_ACOMMON = 0xff00
  9071. const m_SHN_MIPS_DATA = 0xff02
  9072. const m_SHN_MIPS_SCOMMON = 0xff03
  9073. const m_SHN_MIPS_SUNDEFINED = 0xff04
  9074. const m_SHN_MIPS_TEXT = 0xff01
  9075. const m_SHN_PARISC_ANSI_COMMON = 0xff00
  9076. const m_SHN_PARISC_HUGE_COMMON = 0xff01
  9077. const m_SHN_UNDEF = 0
  9078. const m_SHN_XINDEX = 0xffff
  9079. const m_SHT_ALPHA_DEBUG = 0x70000001
  9080. const m_SHT_ALPHA_REGINFO = 0x70000002
  9081. const m_SHT_CHECKSUM = 0x6ffffff8
  9082. const m_SHT_DYNAMIC = 6
  9083. const m_SHT_DYNSYM = 11
  9084. const m_SHT_FINI_ARRAY = 15
  9085. const m_SHT_GNU_ATTRIBUTES = 0x6ffffff5
  9086. const m_SHT_GNU_HASH = 0x6ffffff6
  9087. const m_SHT_GNU_LIBLIST = 0x6ffffff7
  9088. const m_SHT_GNU_verdef = 0x6ffffffd
  9089. const m_SHT_GNU_verneed = 0x6ffffffe
  9090. const m_SHT_GNU_versym = 0x6fffffff
  9091. const m_SHT_GROUP = 17
  9092. const m_SHT_HASH = 5
  9093. const m_SHT_HIOS = 0x6fffffff
  9094. const m_SHT_HIPROC = 0x7fffffff
  9095. const m_SHT_HISUNW = 0x6fffffff
  9096. const m_SHT_HIUSER = 0x8fffffff
  9097. const m_SHT_INIT_ARRAY = 14
  9098. const m_SHT_LOOS = 0x60000000
  9099. const m_SHT_LOPROC = 0x70000000
  9100. const m_SHT_LOSUNW = 0x6ffffffa
  9101. const m_SHT_LOUSER = 0x80000000
  9102. const m_SHT_MIPS_AUXSYM = 0x70000016
  9103. const m_SHT_MIPS_CONFLICT = 0x70000002
  9104. const m_SHT_MIPS_CONTENT = 0x7000000c
  9105. const m_SHT_MIPS_DEBUG = 0x70000005
  9106. const m_SHT_MIPS_DELTACLASS = 0x7000001d
  9107. const m_SHT_MIPS_DELTADECL = 0x7000001f
  9108. const m_SHT_MIPS_DELTAINST = 0x7000001c
  9109. const m_SHT_MIPS_DELTASYM = 0x7000001b
  9110. const m_SHT_MIPS_DENSE = 0x70000013
  9111. const m_SHT_MIPS_DWARF = 0x7000001e
  9112. const m_SHT_MIPS_EH_REGION = 0x70000027
  9113. const m_SHT_MIPS_EVENTS = 0x70000021
  9114. const m_SHT_MIPS_EXTSYM = 0x70000012
  9115. const m_SHT_MIPS_FDESC = 0x70000011
  9116. const m_SHT_MIPS_GPTAB = 0x70000003
  9117. const m_SHT_MIPS_IFACE = 0x7000000b
  9118. const m_SHT_MIPS_LIBLIST = 0x70000000
  9119. const m_SHT_MIPS_LINE = 0x70000019
  9120. const m_SHT_MIPS_LOCSTR = 0x70000018
  9121. const m_SHT_MIPS_LOCSYM = 0x70000015
  9122. const m_SHT_MIPS_MSYM = 0x70000001
  9123. const m_SHT_MIPS_OPTIONS = 0x7000000d
  9124. const m_SHT_MIPS_OPTSYM = 0x70000017
  9125. const m_SHT_MIPS_PACKAGE = 0x70000007
  9126. const m_SHT_MIPS_PACKSYM = 0x70000008
  9127. const m_SHT_MIPS_PDESC = 0x70000014
  9128. const m_SHT_MIPS_PDR_EXCEPTION = 0x70000029
  9129. const m_SHT_MIPS_PIXIE = 0x70000023
  9130. const m_SHT_MIPS_REGINFO = 0x70000006
  9131. const m_SHT_MIPS_RELD = 0x70000009
  9132. const m_SHT_MIPS_RFDESC = 0x7000001a
  9133. const m_SHT_MIPS_SHDR = 0x70000010
  9134. const m_SHT_MIPS_SYMBOL_LIB = 0x70000020
  9135. const m_SHT_MIPS_TRANSLATE = 0x70000022
  9136. const m_SHT_MIPS_UCODE = 0x70000004
  9137. const m_SHT_MIPS_WHIRL = 0x70000026
  9138. const m_SHT_MIPS_XLATE = 0x70000024
  9139. const m_SHT_MIPS_XLATE_DEBUG = 0x70000025
  9140. const m_SHT_MIPS_XLATE_OLD = 0x70000028
  9141. const m_SHT_NOBITS = 8
  9142. const m_SHT_NOTE = 7
  9143. const m_SHT_NULL = 0
  9144. const m_SHT_NUM = 20
  9145. const m_SHT_PARISC_DOC = 0x70000002
  9146. const m_SHT_PARISC_EXT = 0x70000000
  9147. const m_SHT_PARISC_UNWIND = 0x70000001
  9148. const m_SHT_PREINIT_ARRAY = 16
  9149. const m_SHT_PROGBITS = 1
  9150. const m_SHT_REL = 9
  9151. const m_SHT_RELA = 4
  9152. const m_SHT_RELR = 19
  9153. const m_SHT_SHLIB = 10
  9154. const m_SHT_STRTAB = 3
  9155. const m_SHT_SUNW_COMDAT = 0x6ffffffb
  9156. const m_SHT_SUNW_move = 0x6ffffffa
  9157. const m_SHT_SUNW_syminfo = 0x6ffffffc
  9158. const m_SHT_SYMTAB = 2
  9159. const m_SHT_SYMTAB_SHNDX = 18
  9160. const m_STB_GLOBAL = 1
  9161. const m_STB_GNU_UNIQUE = 10
  9162. const m_STB_HIOS = 12
  9163. const m_STB_HIPROC = 15
  9164. const m_STB_LOCAL = 0
  9165. const m_STB_LOOS = 10
  9166. const m_STB_LOPROC = 13
  9167. const m_STB_MIPS_SPLIT_COMMON = 13
  9168. const m_STB_NUM = 3
  9169. const m_STB_WEAK = 2
  9170. const m_STN_UNDEF = 0
  9171. const m_STO_ALPHA_NOPV = 0x80
  9172. const m_STO_ALPHA_STD_GPLOAD = 0x88
  9173. const m_STO_MIPS_DEFAULT = 0x0
  9174. const m_STO_MIPS_HIDDEN = 0x2
  9175. const m_STO_MIPS_INTERNAL = 0x1
  9176. const m_STO_MIPS_PLT = 0x8
  9177. const m_STO_MIPS_PROTECTED = 0x3
  9178. const m_STO_MIPS_SC_ALIGN_UNUSED = 0xff
  9179. const m_STO_PPC64_LOCAL_BIT = 5
  9180. const m_STO_PPC64_LOCAL_MASK = 0xe0
  9181. const m_STT_ARM_16BIT = "STT_HIPROC"
  9182. const m_STT_ARM_TFUNC = "STT_LOPROC"
  9183. const m_STT_COMMON = 5
  9184. const m_STT_FILE = 4
  9185. const m_STT_FUNC = 2
  9186. const m_STT_GNU_IFUNC = 10
  9187. const m_STT_HIOS = 12
  9188. const m_STT_HIPROC = 15
  9189. const m_STT_LOOS = 10
  9190. const m_STT_LOPROC = 13
  9191. const m_STT_NOTYPE = 0
  9192. const m_STT_NUM = 7
  9193. const m_STT_OBJECT = 1
  9194. const m_STT_PARISC_MILLICODE = 13
  9195. const m_STT_SECTION = 3
  9196. const m_STT_SPARC_REGISTER = 13
  9197. const m_STT_TLS = 6
  9198. const m_STV_DEFAULT = 0
  9199. const m_STV_HIDDEN = 2
  9200. const m_STV_INTERNAL = 1
  9201. const m_STV_PROTECTED = 3
  9202. const m_SYMINFO_BT_LOWRESERVE = 0xff00
  9203. const m_SYMINFO_BT_PARENT = 0xfffe
  9204. const m_SYMINFO_BT_SELF = 0xffff
  9205. const m_SYMINFO_CURRENT = 1
  9206. const m_SYMINFO_FLG_COPY = 0x0004
  9207. const m_SYMINFO_FLG_DIRECT = 0x0001
  9208. const m_SYMINFO_FLG_LAZYLOAD = 0x0008
  9209. const m_SYMINFO_FLG_PASSTHRU = 0x0002
  9210. const m_SYMINFO_NONE = 0
  9211. const m_SYMINFO_NUM = 2
  9212. const m_VER_DEF_CURRENT = 1
  9213. const m_VER_DEF_NONE = 0
  9214. const m_VER_DEF_NUM = 2
  9215. const m_VER_FLG_BASE = 0x1
  9216. const m_VER_FLG_WEAK = 0x2
  9217. const m_VER_NDX_ELIMINATE = 0xff01
  9218. const m_VER_NDX_GLOBAL = 1
  9219. const m_VER_NDX_LOCAL = 0
  9220. const m_VER_NDX_LORESERVE = 0xff00
  9221. const m_VER_NEED_CURRENT = 1
  9222. const m_VER_NEED_NONE = 0
  9223. const m_VER_NEED_NUM = 2
  9224. const m_n_hash = "n_desc"
  9225. type Tnlist = struct {
  9226. F__ccgo0_0 struct {
  9227. Fn_un [0]struct {
  9228. Fn_next [0]uintptr
  9229. Fn_strx [0]int64
  9230. Fn_name uintptr
  9231. }
  9232. Fn_name uintptr
  9233. }
  9234. Fn_type uint8
  9235. Fn_other int8
  9236. Fn_desc int16
  9237. Fn_value uint64
  9238. }
  9239. type TElf32_Half = uint16
  9240. type TElf64_Half = uint16
  9241. type TElf32_Word = uint32
  9242. type TElf32_Sword = int32
  9243. type TElf64_Word = uint32
  9244. type TElf64_Sword = int32
  9245. type TElf32_Xword = uint64
  9246. type TElf32_Sxword = int64
  9247. type TElf64_Xword = uint64
  9248. type TElf64_Sxword = int64
  9249. type TElf32_Addr = uint32
  9250. type TElf64_Addr = uint64
  9251. type TElf32_Off = uint32
  9252. type TElf64_Off = uint64
  9253. type TElf32_Section = uint16
  9254. type TElf64_Section = uint16
  9255. type TElf32_Versym = uint16
  9256. type TElf64_Versym = uint16
  9257. type TElf32_Ehdr = struct {
  9258. Fe_ident [16]uint8
  9259. Fe_type TElf32_Half
  9260. Fe_machine TElf32_Half
  9261. Fe_version TElf32_Word
  9262. Fe_entry TElf32_Addr
  9263. Fe_phoff TElf32_Off
  9264. Fe_shoff TElf32_Off
  9265. Fe_flags TElf32_Word
  9266. Fe_ehsize TElf32_Half
  9267. Fe_phentsize TElf32_Half
  9268. Fe_phnum TElf32_Half
  9269. Fe_shentsize TElf32_Half
  9270. Fe_shnum TElf32_Half
  9271. Fe_shstrndx TElf32_Half
  9272. }
  9273. type TElf64_Ehdr = struct {
  9274. Fe_ident [16]uint8
  9275. Fe_type TElf64_Half
  9276. Fe_machine TElf64_Half
  9277. Fe_version TElf64_Word
  9278. Fe_entry TElf64_Addr
  9279. Fe_phoff TElf64_Off
  9280. Fe_shoff TElf64_Off
  9281. Fe_flags TElf64_Word
  9282. Fe_ehsize TElf64_Half
  9283. Fe_phentsize TElf64_Half
  9284. Fe_phnum TElf64_Half
  9285. Fe_shentsize TElf64_Half
  9286. Fe_shnum TElf64_Half
  9287. Fe_shstrndx TElf64_Half
  9288. }
  9289. type TElf32_Shdr = struct {
  9290. Fsh_name TElf32_Word
  9291. Fsh_type TElf32_Word
  9292. Fsh_flags TElf32_Word
  9293. Fsh_addr TElf32_Addr
  9294. Fsh_offset TElf32_Off
  9295. Fsh_size TElf32_Word
  9296. Fsh_link TElf32_Word
  9297. Fsh_info TElf32_Word
  9298. Fsh_addralign TElf32_Word
  9299. Fsh_entsize TElf32_Word
  9300. }
  9301. type TElf64_Shdr = struct {
  9302. Fsh_name TElf64_Word
  9303. Fsh_type TElf64_Word
  9304. Fsh_flags TElf64_Xword
  9305. Fsh_addr TElf64_Addr
  9306. Fsh_offset TElf64_Off
  9307. Fsh_size TElf64_Xword
  9308. Fsh_link TElf64_Word
  9309. Fsh_info TElf64_Word
  9310. Fsh_addralign TElf64_Xword
  9311. Fsh_entsize TElf64_Xword
  9312. }
  9313. type TElf32_Chdr = struct {
  9314. Fch_type TElf32_Word
  9315. Fch_size TElf32_Word
  9316. Fch_addralign TElf32_Word
  9317. }
  9318. type TElf64_Chdr = struct {
  9319. Fch_type TElf64_Word
  9320. Fch_reserved TElf64_Word
  9321. Fch_size TElf64_Xword
  9322. Fch_addralign TElf64_Xword
  9323. }
  9324. type TElf32_Sym = struct {
  9325. Fst_name TElf32_Word
  9326. Fst_value TElf32_Addr
  9327. Fst_size TElf32_Word
  9328. Fst_info uint8
  9329. Fst_other uint8
  9330. Fst_shndx TElf32_Section
  9331. }
  9332. type TElf64_Sym = struct {
  9333. Fst_name TElf64_Word
  9334. Fst_info uint8
  9335. Fst_other uint8
  9336. Fst_shndx TElf64_Section
  9337. Fst_value TElf64_Addr
  9338. Fst_size TElf64_Xword
  9339. }
  9340. type TElf32_Syminfo = struct {
  9341. Fsi_boundto TElf32_Half
  9342. Fsi_flags TElf32_Half
  9343. }
  9344. type TElf64_Syminfo = struct {
  9345. Fsi_boundto TElf64_Half
  9346. Fsi_flags TElf64_Half
  9347. }
  9348. type TElf32_Rel = struct {
  9349. Fr_offset TElf32_Addr
  9350. Fr_info TElf32_Word
  9351. }
  9352. type TElf64_Rel = struct {
  9353. Fr_offset TElf64_Addr
  9354. Fr_info TElf64_Xword
  9355. }
  9356. type TElf32_Rela = struct {
  9357. Fr_offset TElf32_Addr
  9358. Fr_info TElf32_Word
  9359. Fr_addend TElf32_Sword
  9360. }
  9361. type TElf64_Rela = struct {
  9362. Fr_offset TElf64_Addr
  9363. Fr_info TElf64_Xword
  9364. Fr_addend TElf64_Sxword
  9365. }
  9366. type TElf32_Relr = uint32
  9367. type TElf64_Relr = uint64
  9368. type TElf32_Phdr = struct {
  9369. Fp_type TElf32_Word
  9370. Fp_offset TElf32_Off
  9371. Fp_vaddr TElf32_Addr
  9372. Fp_paddr TElf32_Addr
  9373. Fp_filesz TElf32_Word
  9374. Fp_memsz TElf32_Word
  9375. Fp_flags TElf32_Word
  9376. Fp_align TElf32_Word
  9377. }
  9378. type TElf64_Phdr = struct {
  9379. Fp_type TElf64_Word
  9380. Fp_flags TElf64_Word
  9381. Fp_offset TElf64_Off
  9382. Fp_vaddr TElf64_Addr
  9383. Fp_paddr TElf64_Addr
  9384. Fp_filesz TElf64_Xword
  9385. Fp_memsz TElf64_Xword
  9386. Fp_align TElf64_Xword
  9387. }
  9388. type TElf32_Dyn = struct {
  9389. Fd_tag TElf32_Sword
  9390. Fd_un struct {
  9391. Fd_ptr [0]TElf32_Addr
  9392. Fd_val TElf32_Word
  9393. }
  9394. }
  9395. type TElf64_Dyn = struct {
  9396. Fd_tag TElf64_Sxword
  9397. Fd_un struct {
  9398. Fd_ptr [0]TElf64_Addr
  9399. Fd_val TElf64_Xword
  9400. }
  9401. }
  9402. type TElf32_Verdef = struct {
  9403. Fvd_version TElf32_Half
  9404. Fvd_flags TElf32_Half
  9405. Fvd_ndx TElf32_Half
  9406. Fvd_cnt TElf32_Half
  9407. Fvd_hash TElf32_Word
  9408. Fvd_aux TElf32_Word
  9409. Fvd_next TElf32_Word
  9410. }
  9411. type TElf64_Verdef = struct {
  9412. Fvd_version TElf64_Half
  9413. Fvd_flags TElf64_Half
  9414. Fvd_ndx TElf64_Half
  9415. Fvd_cnt TElf64_Half
  9416. Fvd_hash TElf64_Word
  9417. Fvd_aux TElf64_Word
  9418. Fvd_next TElf64_Word
  9419. }
  9420. type TElf32_Verdaux = struct {
  9421. Fvda_name TElf32_Word
  9422. Fvda_next TElf32_Word
  9423. }
  9424. type TElf64_Verdaux = struct {
  9425. Fvda_name TElf64_Word
  9426. Fvda_next TElf64_Word
  9427. }
  9428. type TElf32_Verneed = struct {
  9429. Fvn_version TElf32_Half
  9430. Fvn_cnt TElf32_Half
  9431. Fvn_file TElf32_Word
  9432. Fvn_aux TElf32_Word
  9433. Fvn_next TElf32_Word
  9434. }
  9435. type TElf64_Verneed = struct {
  9436. Fvn_version TElf64_Half
  9437. Fvn_cnt TElf64_Half
  9438. Fvn_file TElf64_Word
  9439. Fvn_aux TElf64_Word
  9440. Fvn_next TElf64_Word
  9441. }
  9442. type TElf32_Vernaux = struct {
  9443. Fvna_hash TElf32_Word
  9444. Fvna_flags TElf32_Half
  9445. Fvna_other TElf32_Half
  9446. Fvna_name TElf32_Word
  9447. Fvna_next TElf32_Word
  9448. }
  9449. type TElf64_Vernaux = struct {
  9450. Fvna_hash TElf64_Word
  9451. Fvna_flags TElf64_Half
  9452. Fvna_other TElf64_Half
  9453. Fvna_name TElf64_Word
  9454. Fvna_next TElf64_Word
  9455. }
  9456. type TElf32_auxv_t = struct {
  9457. Fa_type Tuint32_t
  9458. Fa_un struct {
  9459. Fa_val Tuint32_t
  9460. }
  9461. }
  9462. type TElf64_auxv_t = struct {
  9463. Fa_type Tuint64_t
  9464. Fa_un struct {
  9465. Fa_val Tuint64_t
  9466. }
  9467. }
  9468. type TElf32_Nhdr = struct {
  9469. Fn_namesz TElf32_Word
  9470. Fn_descsz TElf32_Word
  9471. Fn_type TElf32_Word
  9472. }
  9473. type TElf64_Nhdr = struct {
  9474. Fn_namesz TElf64_Word
  9475. Fn_descsz TElf64_Word
  9476. Fn_type TElf64_Word
  9477. }
  9478. type TElf32_Move = struct {
  9479. Fm_value TElf32_Xword
  9480. Fm_info TElf32_Word
  9481. Fm_poffset TElf32_Word
  9482. Fm_repeat TElf32_Half
  9483. Fm_stride TElf32_Half
  9484. }
  9485. type TElf64_Move = struct {
  9486. Fm_value TElf64_Xword
  9487. Fm_info TElf64_Xword
  9488. Fm_poffset TElf64_Xword
  9489. Fm_repeat TElf64_Half
  9490. Fm_stride TElf64_Half
  9491. }
  9492. type TElf32_gptab = struct {
  9493. Fgt_entry [0]struct {
  9494. Fgt_g_value TElf32_Word
  9495. Fgt_bytes TElf32_Word
  9496. }
  9497. Fgt_header struct {
  9498. Fgt_current_g_value TElf32_Word
  9499. Fgt_unused TElf32_Word
  9500. }
  9501. }
  9502. type TElf32_RegInfo = struct {
  9503. Fri_gprmask TElf32_Word
  9504. Fri_cprmask [4]TElf32_Word
  9505. Fri_gp_value TElf32_Sword
  9506. }
  9507. type TElf_Options = struct {
  9508. Fkind uint8
  9509. Fsize uint8
  9510. Fsection TElf32_Section
  9511. Finfo TElf32_Word
  9512. }
  9513. type TElf_Options_Hw = struct {
  9514. Fhwp_flags1 TElf32_Word
  9515. Fhwp_flags2 TElf32_Word
  9516. }
  9517. type TElf32_Lib = struct {
  9518. Fl_name TElf32_Word
  9519. Fl_time_stamp TElf32_Word
  9520. Fl_checksum TElf32_Word
  9521. Fl_version TElf32_Word
  9522. Fl_flags TElf32_Word
  9523. }
  9524. type TElf64_Lib = struct {
  9525. Fl_name TElf64_Word
  9526. Fl_time_stamp TElf64_Word
  9527. Fl_checksum TElf64_Word
  9528. Fl_version TElf64_Word
  9529. Fl_flags TElf64_Word
  9530. }
  9531. type TElf32_Conflict = uint32
  9532. type TElf_MIPS_ABIFlags_v0 = struct {
  9533. Fversion TElf32_Half
  9534. Fisa_level uint8
  9535. Fisa_rev uint8
  9536. Fgpr_size uint8
  9537. Fcpr1_size uint8
  9538. Fcpr2_size uint8
  9539. Ffp_abi uint8
  9540. Fisa_ext TElf32_Word
  9541. Fases TElf32_Word
  9542. Fflags1 TElf32_Word
  9543. Fflags2 TElf32_Word
  9544. }
  9545. const _Val_GNU_MIPS_ABI_FP_ANY = 0
  9546. const _Val_GNU_MIPS_ABI_FP_DOUBLE = 1
  9547. const _Val_GNU_MIPS_ABI_FP_SINGLE = 2
  9548. const _Val_GNU_MIPS_ABI_FP_SOFT = 3
  9549. const _Val_GNU_MIPS_ABI_FP_OLD_64 = 4
  9550. const _Val_GNU_MIPS_ABI_FP_XX = 5
  9551. const _Val_GNU_MIPS_ABI_FP_64 = 6
  9552. const _Val_GNU_MIPS_ABI_FP_64A = 7
  9553. const _Val_GNU_MIPS_ABI_FP_MAX = 7
  9554. // C documentation
  9555. //
  9556. // /*
  9557. // * __elf_is_okay__ - Determine if ehdr really
  9558. // * is ELF and valid for the target platform.
  9559. // *
  9560. // * WARNING: This is NOT an ELF ABI function and
  9561. // * as such its use should be restricted.
  9562. // */
  9563. func ___elf_is_okay__(tls *libc.TLS, ehdr uintptr) (r int32) {
  9564. var retval int32
  9565. _ = retval
  9566. retval = 0
  9567. /*
  9568. * We need to check magic, class size, endianess,
  9569. * and version before we look at the rest of the
  9570. * Elf_Ehdr structure. These few elements are
  9571. * represented in a machine independent fashion.
  9572. */
  9573. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ehdr))) == int32(m_ELFMAG0) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ehdr + 1))) == int32('E') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ehdr + 2))) == int32('L') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ehdr + 3))) == int32('F') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ehdr + 4))) == int32(m_ELFCLASS64) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ehdr + 5))) == int32(m_ELFDATA2LSB) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ehdr + 6))) == int32(m_EV_CURRENT) {
  9574. /* Now check the machine dependent header */
  9575. if libc.Int32FromUint16((*TElf64_Ehdr)(unsafe.Pointer(ehdr)).Fe_machine) == int32(m_EM_LOONGARCH) && (*TElf64_Ehdr)(unsafe.Pointer(ehdr)).Fe_version == uint32(m_EV_CURRENT) {
  9576. retval = int32(1)
  9577. }
  9578. }
  9579. return retval
  9580. }
  9581. // C documentation
  9582. //
  9583. // /*
  9584. // * Convert an Elf_Sym into an nlist structure. This fills in only the
  9585. // * n_value and n_type members.
  9586. // */
  9587. func _elf_sym_to_nlist(tls *libc.TLS, nl uintptr, s uintptr, shdr uintptr, shnum int32) {
  9588. var sh, p5 uintptr
  9589. var v1, v2, v3, v4 int32
  9590. _, _, _, _, _, _ = sh, v1, v2, v3, v4, p5
  9591. (*Tnlist)(unsafe.Pointer(nl)).Fn_value = (*TElf64_Sym)(unsafe.Pointer(s)).Fst_value
  9592. switch libc.Int32FromUint16((*TElf64_Sym)(unsafe.Pointer(s)).Fst_shndx) {
  9593. case m_SHN_UNDEF:
  9594. fallthrough
  9595. case int32(m_SHN_COMMON):
  9596. (*Tnlist)(unsafe.Pointer(nl)).Fn_type = uint8(m_N_UNDF)
  9597. case int32(m_SHN_ABS):
  9598. if libc.Int32FromUint8((*TElf64_Sym)(unsafe.Pointer(s)).Fst_info)&int32(0xf) == int32(m_STT_FILE) {
  9599. v1 = int32(m_N_FN)
  9600. } else {
  9601. v1 = int32(m_N_ABS)
  9602. }
  9603. (*Tnlist)(unsafe.Pointer(nl)).Fn_type = libc.Uint8FromInt32(v1)
  9604. default:
  9605. if libc.Int32FromUint16((*TElf64_Sym)(unsafe.Pointer(s)).Fst_shndx) >= shnum {
  9606. (*Tnlist)(unsafe.Pointer(nl)).Fn_type = uint8(m_N_UNDF)
  9607. } else {
  9608. sh = shdr + uintptr((*TElf64_Sym)(unsafe.Pointer(s)).Fst_shndx)*64
  9609. if (*TElf64_Shdr)(unsafe.Pointer(sh)).Fsh_type == uint32(m_SHT_PROGBITS) {
  9610. if (*TElf64_Shdr)(unsafe.Pointer(sh)).Fsh_flags&libc.Uint64FromInt32(libc.Int32FromInt32(1)<<libc.Int32FromInt32(0)) != 0 {
  9611. v3 = int32(m_N_DATA)
  9612. } else {
  9613. v3 = int32(m_N_TEXT)
  9614. }
  9615. v2 = v3
  9616. } else {
  9617. if (*TElf64_Shdr)(unsafe.Pointer(sh)).Fsh_type == uint32(m_SHT_NOBITS) {
  9618. v4 = int32(m_N_BSS)
  9619. } else {
  9620. v4 = m_N_UNDF
  9621. }
  9622. v2 = v4
  9623. }
  9624. (*Tnlist)(unsafe.Pointer(nl)).Fn_type = libc.Uint8FromInt32(v2)
  9625. }
  9626. break
  9627. }
  9628. 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) {
  9629. p5 = nl + 8
  9630. *(*uint8)(unsafe.Pointer(p5)) = uint8(int32(*(*uint8)(unsafe.Pointer(p5))) | libc.Int32FromInt32(m_N_EXT))
  9631. }
  9632. }
  9633. func X__fdnlist(tls *libc.TLS, fd int32, list uintptr) (r int32) {
  9634. bp := tls.Alloc(24768)
  9635. defer tls.Free(24768)
  9636. var cc, i TElf64_Sword
  9637. var errsave, nent, v6 int32
  9638. var name, p, s, shdr, strtab uintptr
  9639. var shdr_size, size, symsize, symstrsize TElf64_Word
  9640. var symoff, symstroff TElf64_Off
  9641. var v3 uint64
  9642. var _ /* ehdr at bp+24576 */ TElf64_Ehdr
  9643. var _ /* sbuf at bp+0 */ [1024]TElf64_Sym
  9644. var _ /* st at bp+24640 */ Tstat
  9645. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = cc, errsave, i, name, nent, p, s, shdr, shdr_size, size, strtab, symoff, symsize, symstroff, symstrsize, v3, v6
  9646. symoff = uint64(0)
  9647. symstroff = uint64(0)
  9648. symsize = uint32(0)
  9649. symstrsize = uint32(0)
  9650. nent = -int32(1)
  9651. strtab = libc.UintptrFromInt32(0)
  9652. shdr = libc.UintptrFromInt32(0)
  9653. /* Make sure obj is OK */
  9654. 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 {
  9655. return -int32(1)
  9656. }
  9657. if libc.Int32FromUint16((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shnum) == 0 || uint64((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shentsize) != uint64(64) {
  9658. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ERANGE)
  9659. return -int32(1)
  9660. }
  9661. /* calculate section header table size */
  9662. shdr_size = libc.Uint32FromInt32(libc.Int32FromUint16((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shentsize) * libc.Int32FromUint16((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shnum))
  9663. /* Make sure it's not too big to mmap */
  9664. if libc.Int64FromUint32(shdr_size) > (*(*Tstat)(unsafe.Pointer(bp + 24640))).Fst_size {
  9665. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EFBIG)
  9666. return -int32(1)
  9667. }
  9668. shdr = libc.Xmalloc(tls, uint64(shdr_size))
  9669. if shdr == libc.UintptrFromInt32(0) {
  9670. return -int32(1)
  9671. }
  9672. /* Load section header table. */
  9673. if libc.Xpread(tls, fd, shdr, uint64(shdr_size), libc.Int64FromUint64((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shoff)) != libc.Int64FromUint32(shdr_size) {
  9674. goto done
  9675. }
  9676. /*
  9677. * Find the symbol table entry and it's corresponding
  9678. * string table entry. Version 1.1 of the ABI states
  9679. * that there is only one symbol table but that this
  9680. * could change in the future.
  9681. */
  9682. i = 0
  9683. for {
  9684. if !(i < libc.Int32FromUint16((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shnum)) {
  9685. break
  9686. }
  9687. if (*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_type == uint32(m_SHT_SYMTAB) {
  9688. if (*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_link >= uint32((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shnum) {
  9689. goto done
  9690. }
  9691. symoff = (*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_offset
  9692. symsize = uint32((*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_size)
  9693. symstroff = (*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr((*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_link)*64))).Fsh_offset
  9694. symstrsize = uint32((*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr((*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_link)*64))).Fsh_size)
  9695. break
  9696. }
  9697. goto _1
  9698. _1:
  9699. ;
  9700. i++
  9701. }
  9702. /* Check for files too large to mmap. */
  9703. if libc.Int64FromUint32(symstrsize) > (*(*Tstat)(unsafe.Pointer(bp + 24640))).Fst_size {
  9704. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EFBIG)
  9705. goto done
  9706. }
  9707. /*
  9708. * Load string table into our address space. This gives us
  9709. * an easy way to randomly access all the strings, without
  9710. * making the memory allocation permanent as with malloc/free
  9711. * (i.e., munmap will return it to the system).
  9712. */
  9713. strtab = libc.Xmalloc(tls, uint64(symstrsize))
  9714. if strtab == libc.UintptrFromInt32(0) {
  9715. goto done
  9716. }
  9717. if libc.Xpread(tls, fd, strtab, uint64(symstrsize), libc.Int64FromUint64(symstroff)) != libc.Int64FromUint32(symstrsize) {
  9718. goto done
  9719. }
  9720. /*
  9721. * clean out any left-over information for all valid entries.
  9722. * Type and value defined to be 0 if not found; historical
  9723. * versions cleared other and desc as well. Also figure out
  9724. * the largest string length so don't read any more of the
  9725. * string table than we have to.
  9726. *
  9727. * XXX clearing anything other than n_type and n_value violates
  9728. * the semantics given in the man page.
  9729. */
  9730. nent = 0
  9731. p = list
  9732. for {
  9733. if !!(*(*uintptr)(unsafe.Pointer(p)) == uintptr(0) || int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p))))) == 0) {
  9734. break
  9735. }
  9736. (*Tnlist)(unsafe.Pointer(p)).Fn_type = uint8(0)
  9737. (*Tnlist)(unsafe.Pointer(p)).Fn_other = 0
  9738. (*Tnlist)(unsafe.Pointer(p)).Fn_desc = 0
  9739. (*Tnlist)(unsafe.Pointer(p)).Fn_value = uint64(0)
  9740. nent++
  9741. goto _2
  9742. _2:
  9743. ;
  9744. p += 24
  9745. }
  9746. /* Don't process any further if object is stripped. */
  9747. if symoff == uint64(0) {
  9748. goto done
  9749. }
  9750. if libc.Xlseek(tls, fd, libc.Int64FromUint64(symoff), 0) == int64(-int32(1)) {
  9751. nent = -int32(1)
  9752. goto done
  9753. }
  9754. for symsize > uint32(0) && nent > 0 {
  9755. if uint64(symsize) < libc.Uint64FromInt64(24576) {
  9756. v3 = uint64(symsize)
  9757. } else {
  9758. v3 = libc.Uint64FromInt64(24576)
  9759. }
  9760. cc = libc.Int32FromUint64(v3)
  9761. if libc.Xread(tls, fd, bp, libc.Uint64FromInt32(cc)) != int64(cc) {
  9762. break
  9763. }
  9764. symsize -= libc.Uint32FromInt32(cc)
  9765. s = bp
  9766. for {
  9767. if !(cc > 0 && nent > 0) {
  9768. break
  9769. }
  9770. name = strtab + uintptr((*TElf64_Sym)(unsafe.Pointer(s)).Fst_name)
  9771. if int32(*(*int8)(unsafe.Pointer(name))) == int32('\000') {
  9772. goto _4
  9773. }
  9774. size = symstrsize - (*TElf64_Sym)(unsafe.Pointer(s)).Fst_name
  9775. p = list
  9776. for {
  9777. if !!(*(*uintptr)(unsafe.Pointer(p)) == uintptr(0) || int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p))))) == 0) {
  9778. break
  9779. }
  9780. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p))))) == int32('_') && libc.Xstrncmp(tls, name, *(*uintptr)(unsafe.Pointer(p))+uintptr(1), uint64(size)) == 0 || libc.Xstrncmp(tls, name, *(*uintptr)(unsafe.Pointer(p)), uint64(size)) == 0 {
  9781. _elf_sym_to_nlist(tls, p, s, shdr, libc.Int32FromUint16((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shnum))
  9782. nent--
  9783. v6 = nent
  9784. if v6 <= 0 {
  9785. break
  9786. }
  9787. }
  9788. goto _5
  9789. _5:
  9790. ;
  9791. p += 24
  9792. }
  9793. goto _4
  9794. _4:
  9795. ;
  9796. s += 24
  9797. cc = TElf64_Sword(uint64(cc) - libc.Uint64FromInt64(24))
  9798. }
  9799. }
  9800. goto done
  9801. done:
  9802. ;
  9803. errsave = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9804. libc.Xfree(tls, strtab)
  9805. libc.Xfree(tls, shdr)
  9806. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = errsave
  9807. return nent
  9808. }
  9809. func Xnlist(tls *libc.TLS, name uintptr, list uintptr) (r int32) {
  9810. bp := tls.Alloc(16)
  9811. defer tls.Free(16)
  9812. var fd, n int32
  9813. _, _ = fd, n
  9814. if list == libc.UintptrFromInt32(0) {
  9815. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  9816. return -int32(1)
  9817. }
  9818. fd = libc.Xopen(tls, name, m_O_RDONLY1, libc.VaList(bp+8, 0))
  9819. if fd < 0 {
  9820. return -int32(1)
  9821. }
  9822. n = X__fdnlist(tls, fd, list)
  9823. libc.Xclose(tls, fd)
  9824. return n
  9825. }
  9826. const m_O_CREAT3 = 64
  9827. const m_O_NONBLOCK3 = 2048
  9828. const m_O_TRUNC3 = 512
  9829. const m_O_WRONLY1 = 1
  9830. type Tpidfh = struct {
  9831. Fpf_fd int32
  9832. Fpf_path uintptr
  9833. Fpf_dev Tdev_t
  9834. Fpf_ino Tino_t
  9835. }
  9836. func _pidfile_verify(tls *libc.TLS, pfh uintptr) (r int32) {
  9837. bp := tls.Alloc(128)
  9838. defer tls.Free(128)
  9839. var _ /* sb at bp+0 */ Tstat
  9840. if pfh == libc.UintptrFromInt32(0) || (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd == -int32(1) {
  9841. return int32(m_EINVAL)
  9842. }
  9843. /*
  9844. * Check remembered descriptor.
  9845. */
  9846. if libc.Xfstat(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd, bp) == -int32(1) {
  9847. return *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9848. }
  9849. 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 {
  9850. return int32(m_EINVAL)
  9851. }
  9852. return 0
  9853. }
  9854. func _pidfile_read(tls *libc.TLS, path uintptr, pidptr uintptr) (r int32) {
  9855. bp := tls.Alloc(32)
  9856. defer tls.Free(32)
  9857. var error1, fd, i int32
  9858. var _ /* buf at bp+0 */ [16]int8
  9859. var _ /* endptr at bp+16 */ uintptr
  9860. _, _, _ = error1, fd, i
  9861. fd = libc.Xopen(tls, path, m_O_RDONLY1, 0)
  9862. if fd == -int32(1) {
  9863. return *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9864. }
  9865. i = int32(libc.Xread(tls, fd, bp, libc.Uint64FromInt64(16)-libc.Uint64FromInt32(1)))
  9866. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) /* Remember errno in case close() wants to change it. */
  9867. libc.Xclose(tls, fd)
  9868. if i == -int32(1) {
  9869. return error1
  9870. } else {
  9871. if i == 0 {
  9872. return int32(m_EAGAIN)
  9873. }
  9874. }
  9875. (*(*[16]int8)(unsafe.Pointer(bp)))[i] = int8('\000')
  9876. *(*Tpid_t)(unsafe.Pointer(pidptr)) = int32(libc.Xstrtol(tls, bp, bp+16, int32(10)))
  9877. if *(*uintptr)(unsafe.Pointer(bp + 16)) != bp+uintptr(i) {
  9878. return int32(m_EINVAL)
  9879. }
  9880. return 0
  9881. }
  9882. func Xpidfile_open(tls *libc.TLS, path uintptr, mode Tmode_t, pidptr uintptr) (r uintptr) {
  9883. bp := tls.Alloc(160)
  9884. defer tls.Free(160)
  9885. var count, error1, fd, len1, v2 int32
  9886. var pfh uintptr
  9887. var v3 bool
  9888. var _ /* rqtp at bp+128 */ Ttimespec
  9889. var _ /* sb at bp+0 */ Tstat
  9890. _, _, _, _, _, _, _ = count, error1, fd, len1, pfh, v2, v3
  9891. pfh = libc.Xmalloc(tls, uint64(32))
  9892. if pfh == libc.UintptrFromInt32(0) {
  9893. return libc.UintptrFromInt32(0)
  9894. }
  9895. if path == libc.UintptrFromInt32(0) {
  9896. len1 = libc.Xasprintf(tls, pfh+8, __ccgo_ts+310, libc.VaList(bp+152, Xgetprogname(tls)))
  9897. if len1 < 0 {
  9898. libc.Xfree(tls, pfh)
  9899. return libc.UintptrFromInt32(0)
  9900. }
  9901. } else {
  9902. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path = libc.Xstrdup(tls, path)
  9903. }
  9904. /*
  9905. * Open the PID file and obtain exclusive lock.
  9906. * We truncate PID file here only to remove old PID immediately,
  9907. * PID file will be truncated again in pidfile_write(), so
  9908. * pidfile_write() can be called multiple times.
  9909. */
  9910. fd = Xflopen(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path, libc.Int32FromInt32(m_O_WRONLY1)|libc.Int32FromInt32(m_O_CREAT3)|libc.Int32FromInt32(m_O_TRUNC3)|libc.Int32FromInt32(m_O_NONBLOCK3), libc.VaList(bp+152, mode))
  9911. if fd == -int32(1) {
  9912. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EAGAIN) {
  9913. if pidptr == libc.UintptrFromInt32(0) {
  9914. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EEXIST)
  9915. } else {
  9916. count = int32(20)
  9917. (*(*Ttimespec)(unsafe.Pointer(bp + 128))).Ftv_sec = 0
  9918. (*(*Ttimespec)(unsafe.Pointer(bp + 128))).Ftv_nsec = int64(5000000)
  9919. for {
  9920. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = _pidfile_read(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path, pidptr)
  9921. if v3 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) != int32(m_EAGAIN); !v3 {
  9922. count--
  9923. v2 = count
  9924. }
  9925. if v3 || v2 == 0 {
  9926. break
  9927. }
  9928. libc.Xnanosleep(tls, bp+128, uintptr(0))
  9929. goto _1
  9930. _1:
  9931. }
  9932. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EAGAIN) {
  9933. *(*Tpid_t)(unsafe.Pointer(pidptr)) = -int32(1)
  9934. }
  9935. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == 0 || *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EAGAIN) {
  9936. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EEXIST)
  9937. }
  9938. }
  9939. }
  9940. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9941. libc.Xfree(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  9942. libc.Xfree(tls, pfh)
  9943. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9944. return libc.UintptrFromInt32(0)
  9945. }
  9946. /*
  9947. * Remember file information, so in pidfile_write() we are sure we write
  9948. * to the proper descriptor.
  9949. */
  9950. if libc.Xfstat(tls, fd, bp) == -int32(1) {
  9951. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9952. libc.Xunlink(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  9953. libc.Xfree(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  9954. libc.Xclose(tls, fd)
  9955. libc.Xfree(tls, pfh)
  9956. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9957. return libc.UintptrFromInt32(0)
  9958. }
  9959. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd = fd
  9960. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_dev = (*(*Tstat)(unsafe.Pointer(bp))).Fst_dev
  9961. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_ino = (*(*Tstat)(unsafe.Pointer(bp))).Fst_ino
  9962. return pfh
  9963. }
  9964. func Xpidfile_write(tls *libc.TLS, pfh uintptr) (r int32) {
  9965. bp := tls.Alloc(32)
  9966. defer tls.Free(32)
  9967. var error1, fd int32
  9968. var _ /* pidstr at bp+0 */ [16]int8
  9969. _, _ = error1, fd
  9970. /*
  9971. * Check remembered descriptor, so we don't overwrite some other
  9972. * file if pidfile was closed and descriptor reused.
  9973. */
  9974. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = _pidfile_verify(tls, pfh)
  9975. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) != 0 {
  9976. /*
  9977. * Don't close descriptor, because we are not sure if it's ours.
  9978. */
  9979. return -int32(1)
  9980. }
  9981. fd = (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd
  9982. /*
  9983. * Truncate PID file, so multiple calls of pidfile_write() are allowed.
  9984. */
  9985. if libc.Xftruncate(tls, fd, 0) == -int32(1) {
  9986. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9987. __pidfile_remove(tls, pfh, 0)
  9988. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9989. return -int32(1)
  9990. }
  9991. libc.X__builtin_snprintf(tls, bp, uint64(16), __ccgo_ts+326, libc.VaList(bp+24, libc.Xgetpid(tls)))
  9992. if libc.Xpwrite(tls, fd, bp, libc.Xstrlen(tls, bp), 0) != libc.Int64FromUint64(libc.Xstrlen(tls, bp)) {
  9993. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9994. __pidfile_remove(tls, pfh, 0)
  9995. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9996. return -int32(1)
  9997. }
  9998. return 0
  9999. }
  10000. func Xpidfile_close(tls *libc.TLS, pfh uintptr) (r int32) {
  10001. var error1 int32
  10002. _ = error1
  10003. error1 = _pidfile_verify(tls, pfh)
  10004. if error1 != 0 {
  10005. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  10006. return -int32(1)
  10007. }
  10008. if libc.Xclose(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd) == -int32(1) {
  10009. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10010. }
  10011. libc.Xfree(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  10012. libc.Xfree(tls, pfh)
  10013. if error1 != 0 {
  10014. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  10015. return -int32(1)
  10016. }
  10017. return 0
  10018. }
  10019. func __pidfile_remove(tls *libc.TLS, pfh uintptr, freeit int32) (r int32) {
  10020. var error1 int32
  10021. _ = error1
  10022. error1 = _pidfile_verify(tls, pfh)
  10023. if error1 != 0 {
  10024. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  10025. return -int32(1)
  10026. }
  10027. if libc.Xunlink(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path) == -int32(1) {
  10028. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10029. }
  10030. if libc.Xclose(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd) == -int32(1) {
  10031. if error1 == 0 {
  10032. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10033. }
  10034. }
  10035. if freeit != 0 {
  10036. libc.Xfree(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  10037. libc.Xfree(tls, pfh)
  10038. } else {
  10039. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd = -int32(1)
  10040. }
  10041. if error1 != 0 {
  10042. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  10043. return -int32(1)
  10044. }
  10045. return 0
  10046. }
  10047. func Xpidfile_remove(tls *libc.TLS, pfh uintptr) (r int32) {
  10048. return __pidfile_remove(tls, pfh, int32(1))
  10049. }
  10050. func Xpidfile_fileno(tls *libc.TLS, pfh uintptr) (r int32) {
  10051. if pfh == libc.UintptrFromInt32(0) || (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd == -int32(1) {
  10052. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  10053. return -int32(1)
  10054. }
  10055. return (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd
  10056. }
  10057. const m_SPT_MAXTITLE = 255
  10058. const m___bool_true_false_are_defined = 1
  10059. const m_bool = "_Bool"
  10060. const m_false = 0
  10061. const m_true = 1
  10062. /*
  10063. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  10064. *
  10065. * Redistribution and use in source and binary forms, with or without
  10066. * modification, are permitted provided that the following conditions
  10067. * are met:
  10068. * 1. Redistributions of source code must retain the above copyright
  10069. * notice, this list of conditions and the following disclaimer.
  10070. * 2. Redistributions in binary form must reproduce the above copyright
  10071. * notice, this list of conditions and the following disclaimer in the
  10072. * documentation and/or other materials provided with the distribution.
  10073. * 3. The name of the author may not be used to endorse or promote products
  10074. * derived from this software without specific prior written permission.
  10075. *
  10076. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  10077. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  10078. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  10079. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  10080. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  10081. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  10082. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  10083. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  10084. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  10085. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  10086. */
  10087. /*
  10088. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  10089. *
  10090. * Redistribution and use in source and binary forms, with or without
  10091. * modification, are permitted provided that the following conditions
  10092. * are met:
  10093. * 1. Redistributions of source code must retain the above copyright
  10094. * notice, this list of conditions and the following disclaimer.
  10095. * 2. Redistributions in binary form must reproduce the above copyright
  10096. * notice, this list of conditions and the following disclaimer in the
  10097. * documentation and/or other materials provided with the distribution.
  10098. * 3. The name of the author may not be used to endorse or promote products
  10099. * derived from this software without specific prior written permission.
  10100. *
  10101. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  10102. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  10103. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  10104. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  10105. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  10106. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  10107. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  10108. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  10109. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  10110. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  10111. */
  10112. /* Clang expands this to 1 if an identifier is *not* reserved. */
  10113. /*
  10114. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  10115. * musl, try to handle this gracefully.
  10116. */
  10117. /* Copyright (C) 1992-2023 Free Software Foundation, Inc.
  10118. Copyright The GNU Toolchain Authors.
  10119. This file is part of the GNU C Library.
  10120. The GNU C Library is free software; you can redistribute it and/or
  10121. modify it under the terms of the GNU Lesser General Public
  10122. License as published by the Free Software Foundation; either
  10123. version 2.1 of the License, or (at your option) any later version.
  10124. The GNU C Library is distributed in the hope that it will be useful,
  10125. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10126. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10127. Lesser General Public License for more details.
  10128. You should have received a copy of the GNU Lesser General Public
  10129. License along with the GNU C Library; if not, see
  10130. <https://www.gnu.org/licenses/>. */
  10131. var _SPT struct {
  10132. Farg0 uintptr
  10133. Fbase uintptr
  10134. Fend uintptr
  10135. Fnul uintptr
  10136. Fwarned uint8
  10137. Freset uint8
  10138. Ferror1 int32
  10139. }
  10140. func _spt_min(tls *libc.TLS, a Tsize_t, b Tsize_t) (r Tsize_t) {
  10141. var v1 uint64
  10142. _ = v1
  10143. if a < b {
  10144. v1 = a
  10145. } else {
  10146. v1 = b
  10147. }
  10148. return v1
  10149. }
  10150. // C documentation
  10151. //
  10152. // /*
  10153. // * For discussion on the portability of the various methods, see
  10154. // * https://lists.freebsd.org/pipermail/freebsd-stable/2008-June/043136.html
  10155. // */
  10156. func _spt_clearenv(tls *libc.TLS) (r int32) {
  10157. return libc.Xclearenv(tls)
  10158. }
  10159. func _spt_copyenv(tls *libc.TLS, envc int32, envp uintptr) (r int32) {
  10160. var envcopy, eq uintptr
  10161. var envsize, error1, i int32
  10162. _, _, _, _, _ = envcopy, envsize, eq, error1, i
  10163. if libc.Xenviron != envp {
  10164. return 0
  10165. }
  10166. /* Make a copy of the old environ array of pointers, in case
  10167. * clearenv() or setenv() is implemented to free the internal
  10168. * environ array, because we will need to access the old environ
  10169. * contents to make the new copy. */
  10170. envsize = libc.Int32FromUint64(libc.Uint64FromInt32(envc+libc.Int32FromInt32(1)) * uint64(8))
  10171. envcopy = libc.Xmalloc(tls, libc.Uint64FromInt32(envsize))
  10172. if envcopy == libc.UintptrFromInt32(0) {
  10173. return *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10174. }
  10175. libc.Xmemcpy(tls, envcopy, envp, libc.Uint64FromInt32(envsize))
  10176. error1 = _spt_clearenv(tls)
  10177. if error1 != 0 {
  10178. libc.Xenviron = envp
  10179. libc.Xfree(tls, envcopy)
  10180. return error1
  10181. }
  10182. i = 0
  10183. for {
  10184. if !(*(*uintptr)(unsafe.Pointer(envcopy + uintptr(i)*8)) != 0) {
  10185. break
  10186. }
  10187. eq = libc.Xstrchr(tls, *(*uintptr)(unsafe.Pointer(envcopy + uintptr(i)*8)), int32('='))
  10188. if eq == libc.UintptrFromInt32(0) {
  10189. goto _1
  10190. }
  10191. *(*int8)(unsafe.Pointer(eq)) = int8('\000')
  10192. if libc.Xsetenv(tls, *(*uintptr)(unsafe.Pointer(envcopy + uintptr(i)*8)), eq+uintptr(1), int32(1)) < 0 {
  10193. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10194. }
  10195. *(*int8)(unsafe.Pointer(eq)) = int8('=')
  10196. if error1 != 0 {
  10197. /* Because the old environ might not be available
  10198. * anymore we will make do with the shallow copy. */
  10199. libc.Xenviron = envcopy
  10200. return error1
  10201. }
  10202. goto _1
  10203. _1:
  10204. ;
  10205. i++
  10206. }
  10207. /* Dispose of the shallow copy, now that we've finished transfering
  10208. * the old environment. */
  10209. libc.Xfree(tls, envcopy)
  10210. return 0
  10211. }
  10212. func _spt_copyargs(tls *libc.TLS, argc int32, argv uintptr) (r int32) {
  10213. var i int32
  10214. var tmp uintptr
  10215. _, _ = i, tmp
  10216. i = int32(1)
  10217. for {
  10218. if !(i < argc || i >= argc && *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) != 0) {
  10219. break
  10220. }
  10221. if *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) == libc.UintptrFromInt32(0) {
  10222. goto _1
  10223. }
  10224. tmp = libc.Xstrdup(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))
  10225. if tmp == libc.UintptrFromInt32(0) {
  10226. return *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10227. }
  10228. *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) = tmp
  10229. goto _1
  10230. _1:
  10231. ;
  10232. i++
  10233. }
  10234. return 0
  10235. }
  10236. func Xsetproctitle_init(tls *libc.TLS, argc int32, argv uintptr, envp uintptr) {
  10237. var base, end, nul, tmp uintptr
  10238. var envc, error1, i int32
  10239. _, _, _, _, _, _, _ = base, end, envc, error1, i, nul, tmp
  10240. /* Try to make sure we got called with main() arguments. */
  10241. if argc < 0 {
  10242. return
  10243. }
  10244. base = *(*uintptr)(unsafe.Pointer(argv))
  10245. if base == libc.UintptrFromInt32(0) {
  10246. return
  10247. }
  10248. nul = base + uintptr(libc.Xstrlen(tls, base))
  10249. end = nul + uintptr(1)
  10250. i = 0
  10251. for {
  10252. if !(i < argc || i >= argc && *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) != 0) {
  10253. break
  10254. }
  10255. if *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) == libc.UintptrFromInt32(0) || *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) != end {
  10256. goto _1
  10257. }
  10258. end = *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) + uintptr(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))) + uintptr(1)
  10259. goto _1
  10260. _1:
  10261. ;
  10262. i++
  10263. }
  10264. i = 0
  10265. for {
  10266. if !(*(*uintptr)(unsafe.Pointer(envp + uintptr(i)*8)) != 0) {
  10267. break
  10268. }
  10269. if *(*uintptr)(unsafe.Pointer(envp + uintptr(i)*8)) != end {
  10270. goto _2
  10271. }
  10272. end = *(*uintptr)(unsafe.Pointer(envp + uintptr(i)*8)) + uintptr(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(envp + uintptr(i)*8)))) + uintptr(1)
  10273. goto _2
  10274. _2:
  10275. ;
  10276. i++
  10277. }
  10278. envc = i
  10279. _SPT.Farg0 = libc.Xstrdup(tls, *(*uintptr)(unsafe.Pointer(argv)))
  10280. if _SPT.Farg0 == libc.UintptrFromInt32(0) {
  10281. _SPT.Ferror1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10282. return
  10283. }
  10284. tmp = libc.Xstrdup(tls, Xgetprogname(tls))
  10285. if tmp == libc.UintptrFromInt32(0) {
  10286. _SPT.Ferror1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10287. return
  10288. }
  10289. Xsetprogname(tls, tmp)
  10290. error1 = _spt_copyenv(tls, envc, envp)
  10291. if error1 != 0 {
  10292. _SPT.Ferror1 = error1
  10293. return
  10294. }
  10295. error1 = _spt_copyargs(tls, argc, argv)
  10296. if error1 != 0 {
  10297. _SPT.Ferror1 = error1
  10298. return
  10299. }
  10300. _SPT.Fnul = nul
  10301. _SPT.Fbase = base
  10302. _SPT.Fend = end
  10303. }
  10304. func Xsetproctitle_impl(tls *libc.TLS, fmt uintptr, va uintptr) {
  10305. bp := tls.Alloc(272)
  10306. defer tls.Free(272)
  10307. var ap Tva_list
  10308. var len1 int32
  10309. var nul, v1 uintptr
  10310. var _ /* buf at bp+0 */ [256]int8
  10311. _, _, _, _ = ap, len1, nul, v1
  10312. if _SPT.Fbase == libc.UintptrFromInt32(0) {
  10313. if !(_SPT.Fwarned != 0) {
  10314. libc.Xwarnx(tls, __ccgo_ts+329, 0)
  10315. _SPT.Fwarned = uint8(m_true)
  10316. }
  10317. return
  10318. }
  10319. if fmt != 0 {
  10320. if int32(*(*int8)(unsafe.Pointer(fmt))) == int32('-') {
  10321. /* Skip program name prefix. */
  10322. fmt++
  10323. len1 = 0
  10324. } else {
  10325. /* Print program name heading for grep. */
  10326. libc.X__builtin_snprintf(tls, bp, uint64(256), __ccgo_ts+14, libc.VaList(bp+264, Xgetprogname(tls)))
  10327. len1 = libc.Int32FromUint64(libc.Xstrlen(tls, bp))
  10328. }
  10329. ap = va
  10330. len1 += libc.X__builtin_vsnprintf(tls, bp+uintptr(len1), uint64(256)-libc.Uint64FromInt32(len1), fmt, ap)
  10331. _ = ap
  10332. } else {
  10333. len1 = libc.X__builtin_snprintf(tls, bp, uint64(256), __ccgo_ts+427, libc.VaList(bp+264, _SPT.Farg0))
  10334. }
  10335. if len1 <= 0 {
  10336. _SPT.Ferror1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10337. return
  10338. }
  10339. if !(_SPT.Freset != 0) {
  10340. libc.Xmemset(tls, _SPT.Fbase, 0, libc.Uint64FromInt64(int64(_SPT.Fend)-int64(_SPT.Fbase)))
  10341. _SPT.Freset = uint8(m_true)
  10342. } else {
  10343. libc.Xmemset(tls, _SPT.Fbase, 0, _spt_min(tls, uint64(256), libc.Uint64FromInt64(int64(_SPT.Fend)-int64(_SPT.Fbase))))
  10344. }
  10345. len1 = libc.Int32FromUint64(_spt_min(tls, libc.Uint64FromInt32(len1), _spt_min(tls, uint64(256), libc.Uint64FromInt64(int64(_SPT.Fend)-int64(_SPT.Fbase)))-uint64(1)))
  10346. libc.Xmemcpy(tls, _SPT.Fbase, bp, libc.Uint64FromInt32(len1))
  10347. nul = _SPT.Fbase + uintptr(len1)
  10348. if nul < _SPT.Fnul {
  10349. *(*int8)(unsafe.Pointer(_SPT.Fnul)) = int8('.')
  10350. } else {
  10351. if nul == _SPT.Fnul && nul+uintptr(1) < _SPT.Fend {
  10352. *(*int8)(unsafe.Pointer(_SPT.Fnul)) = int8(' ')
  10353. nul++
  10354. v1 = nul
  10355. *(*int8)(unsafe.Pointer(v1)) = int8('\000')
  10356. }
  10357. }
  10358. }
  10359. func Xgetprogname(tls *libc.TLS) (r uintptr) {
  10360. if libc.Xprogram_invocation_short_name == libc.UintptrFromInt32(0) {
  10361. libc.Xprogram_invocation_short_name = libc.Xprogram_invocation_short_name
  10362. }
  10363. return libc.Xprogram_invocation_short_name
  10364. }
  10365. func Xsetprogname(tls *libc.TLS, progname uintptr) {
  10366. var i Tsize_t
  10367. _ = i
  10368. i = libc.Xstrlen(tls, progname)
  10369. for {
  10370. if !(i > uint64(0)) {
  10371. break
  10372. }
  10373. if int32(*(*int8)(unsafe.Pointer(progname + uintptr(i-uint64(1))))) == int32('/') {
  10374. libc.Xprogram_invocation_short_name = progname + uintptr(i)
  10375. return
  10376. }
  10377. goto _1
  10378. _1:
  10379. ;
  10380. i--
  10381. }
  10382. libc.Xprogram_invocation_short_name = progname
  10383. }
  10384. const m_GID_SZ = 251
  10385. const m_GNMLEN = 32
  10386. const m_GNM_SZ = 251
  10387. const m_INVALID = 2
  10388. const m_UID_SZ = 317
  10389. const m_UNMLEN = 32
  10390. const m_UNM_SZ = 317
  10391. const m_VALID = 1
  10392. const m__PW_BUF_LEN = 1024
  10393. type Tgroup = struct {
  10394. Fgr_name uintptr
  10395. Fgr_passwd uintptr
  10396. Fgr_gid Tgid_t
  10397. Fgr_mem uintptr
  10398. }
  10399. type Tpasswd = struct {
  10400. Fpw_name uintptr
  10401. Fpw_passwd uintptr
  10402. Fpw_uid Tuid_t
  10403. Fpw_gid Tgid_t
  10404. Fpw_gecos uintptr
  10405. Fpw_dir uintptr
  10406. Fpw_shell uintptr
  10407. }
  10408. /*
  10409. * Constants and data structures used to implement group and password file
  10410. * caches. Name lengths have been chosen to be as large as those supported
  10411. * by the passwd and group files as well as the standard archive formats.
  10412. * CACHE SIZES MUST BE PRIME
  10413. */
  10414. /*
  10415. * Node structures used in the user, group, uid, and gid caches.
  10416. */
  10417. type TUIDC = struct {
  10418. Fvalid int32
  10419. Fname [32]int8
  10420. Fuid Tuid_t
  10421. }
  10422. /*
  10423. * Constants and data structures used to implement group and password file
  10424. * caches. Name lengths have been chosen to be as large as those supported
  10425. * by the passwd and group files as well as the standard archive formats.
  10426. * CACHE SIZES MUST BE PRIME
  10427. */
  10428. /*
  10429. * Node structures used in the user, group, uid, and gid caches.
  10430. */
  10431. type Tuidc = TUIDC
  10432. type TGIDC = struct {
  10433. Fvalid int32
  10434. Fname [32]int8
  10435. Fgid Tgid_t
  10436. }
  10437. type Tgidc = TGIDC
  10438. /*
  10439. * Routines that control user, group, uid and gid caches.
  10440. * Traditional passwd/group cache routines perform quite poorly with
  10441. * archives. The chances of hitting a valid lookup with an archive is quite a
  10442. * bit worse than with files already resident on the file system. These misses
  10443. * create a MAJOR performance cost. To adress this problem, these routines
  10444. * cache both hits and misses.
  10445. */
  10446. var _uidtb uintptr /* uid to name cache */
  10447. var _gidtb uintptr /* gid to name cache */
  10448. var _usrtb uintptr /* user name to uid cache */
  10449. var _grptb uintptr /* group name to gid cache */
  10450. func _st_hash(tls *libc.TLS, name uintptr, len1 Tsize_t, tabsz int32) (r Tu_int) {
  10451. var key Tu_int
  10452. var v1 Tsize_t
  10453. var v2 uintptr
  10454. _, _, _ = key, v1, v2
  10455. key = uint32(0)
  10456. for {
  10457. v1 = len1
  10458. len1--
  10459. if !(v1 != 0) {
  10460. break
  10461. }
  10462. v2 = name
  10463. name++
  10464. key += libc.Uint32FromInt8(*(*int8)(unsafe.Pointer(v2)))
  10465. key = key<<libc.Int32FromInt32(8) | key>>libc.Int32FromInt32(24)
  10466. }
  10467. return key % libc.Uint32FromInt32(tabsz)
  10468. }
  10469. // C documentation
  10470. //
  10471. // /*
  10472. // * uidtb_start
  10473. // * creates an an empty uidtb
  10474. // * Return:
  10475. // * 0 if ok, -1 otherwise
  10476. // */
  10477. func _uidtb_start(tls *libc.TLS) (r int32) {
  10478. var v1 uintptr
  10479. _ = v1
  10480. if _uidtb != libc.UintptrFromInt32(0) {
  10481. return 0
  10482. }
  10483. if _fail != 0 {
  10484. return -int32(1)
  10485. }
  10486. v1 = libc.Xcalloc(tls, uint64(m_UID_SZ), uint64(8))
  10487. _uidtb = v1
  10488. if v1 == libc.UintptrFromInt32(0) {
  10489. _fail++
  10490. return -int32(1)
  10491. }
  10492. return 0
  10493. }
  10494. var _fail int32
  10495. // C documentation
  10496. //
  10497. // /*
  10498. // * gidtb_start
  10499. // * creates an an empty gidtb
  10500. // * Return:
  10501. // * 0 if ok, -1 otherwise
  10502. // */
  10503. func _gidtb_start(tls *libc.TLS) (r int32) {
  10504. var v1 uintptr
  10505. _ = v1
  10506. if _gidtb != libc.UintptrFromInt32(0) {
  10507. return 0
  10508. }
  10509. if _fail1 != 0 {
  10510. return -int32(1)
  10511. }
  10512. v1 = libc.Xcalloc(tls, uint64(m_GID_SZ), uint64(8))
  10513. _gidtb = v1
  10514. if v1 == libc.UintptrFromInt32(0) {
  10515. _fail1++
  10516. return -int32(1)
  10517. }
  10518. return 0
  10519. }
  10520. var _fail1 int32
  10521. // C documentation
  10522. //
  10523. // /*
  10524. // * usrtb_start
  10525. // * creates an an empty usrtb
  10526. // * Return:
  10527. // * 0 if ok, -1 otherwise
  10528. // */
  10529. func _usrtb_start(tls *libc.TLS) (r int32) {
  10530. var v1 uintptr
  10531. _ = v1
  10532. if _usrtb != libc.UintptrFromInt32(0) {
  10533. return 0
  10534. }
  10535. if _fail2 != 0 {
  10536. return -int32(1)
  10537. }
  10538. v1 = libc.Xcalloc(tls, uint64(m_UNM_SZ), uint64(8))
  10539. _usrtb = v1
  10540. if v1 == libc.UintptrFromInt32(0) {
  10541. _fail2++
  10542. return -int32(1)
  10543. }
  10544. return 0
  10545. }
  10546. var _fail2 int32
  10547. // C documentation
  10548. //
  10549. // /*
  10550. // * grptb_start
  10551. // * creates an an empty grptb
  10552. // * Return:
  10553. // * 0 if ok, -1 otherwise
  10554. // */
  10555. func _grptb_start(tls *libc.TLS) (r int32) {
  10556. var v1 uintptr
  10557. _ = v1
  10558. if _grptb != libc.UintptrFromInt32(0) {
  10559. return 0
  10560. }
  10561. if _fail3 != 0 {
  10562. return -int32(1)
  10563. }
  10564. v1 = libc.Xcalloc(tls, uint64(m_GNM_SZ), uint64(8))
  10565. _grptb = v1
  10566. if v1 == libc.UintptrFromInt32(0) {
  10567. _fail3++
  10568. return -int32(1)
  10569. }
  10570. return 0
  10571. }
  10572. var _fail3 int32
  10573. // C documentation
  10574. //
  10575. // /*
  10576. // * user_from_uid()
  10577. // * caches the name (if any) for the uid. If noname clear, we always
  10578. // * return the stored name (if valid or invalid match).
  10579. // * We use a simple hash table.
  10580. // * Return:
  10581. // * Pointer to stored name (or a empty string)
  10582. // */
  10583. func Xuser_from_uid(tls *libc.TLS, uid Tuid_t, noname int32) (r uintptr) {
  10584. bp := tls.Alloc(1104)
  10585. defer tls.Free(1104)
  10586. var pptr, ptr, v1 uintptr
  10587. var _ /* pw at bp+48 */ uintptr
  10588. var _ /* pwbuf at bp+56 */ [1024]int8
  10589. var _ /* pwstore at bp+0 */ Tpasswd
  10590. _, _, _ = pptr, ptr, v1
  10591. *(*uintptr)(unsafe.Pointer(bp + 48)) = libc.UintptrFromInt32(0)
  10592. ptr = libc.UintptrFromInt32(0)
  10593. if _uidtb != libc.UintptrFromInt32(0) || _uidtb_start(tls) == 0 {
  10594. /*
  10595. * see if we have this uid cached
  10596. */
  10597. pptr = _uidtb + uintptr(uid%libc.Uint32FromInt32(m_UID_SZ))*8
  10598. ptr = *(*uintptr)(unsafe.Pointer(pptr))
  10599. if ptr != libc.UintptrFromInt32(0) && (*TUIDC)(unsafe.Pointer(ptr)).Fvalid > 0 && (*TUIDC)(unsafe.Pointer(ptr)).Fuid == uid {
  10600. /*
  10601. * have an entry for this uid
  10602. */
  10603. if !(noname != 0) || (*TUIDC)(unsafe.Pointer(ptr)).Fvalid == int32(m_VALID) {
  10604. return ptr + 4
  10605. }
  10606. return libc.UintptrFromInt32(0)
  10607. }
  10608. if ptr == libc.UintptrFromInt32(0) {
  10609. v1 = libc.Xmalloc(tls, uint64(40))
  10610. ptr = v1
  10611. *(*uintptr)(unsafe.Pointer(pptr)) = v1
  10612. }
  10613. }
  10614. libc.Xgetpwuid_r(tls, uid, bp, bp+56, uint64(1024), bp+48)
  10615. if *(*uintptr)(unsafe.Pointer(bp + 48)) == libc.UintptrFromInt32(0) {
  10616. /*
  10617. * no match for this uid in the local password file
  10618. * a string that is the uid in numeric format
  10619. */
  10620. if ptr == libc.UintptrFromInt32(0) {
  10621. return libc.UintptrFromInt32(0)
  10622. }
  10623. (*TUIDC)(unsafe.Pointer(ptr)).Fuid = uid
  10624. libc.X__builtin_snprintf(tls, ptr+4, uint64(m_UNMLEN), __ccgo_ts+326, libc.VaList(bp+1088, uid))
  10625. (*TUIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_INVALID)
  10626. if noname != 0 {
  10627. return libc.UintptrFromInt32(0)
  10628. }
  10629. } else {
  10630. /*
  10631. * there is an entry for this uid in the password file
  10632. */
  10633. if ptr == libc.UintptrFromInt32(0) {
  10634. return (*Tpasswd)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48)))).Fpw_name
  10635. }
  10636. (*TUIDC)(unsafe.Pointer(ptr)).Fuid = uid
  10637. Xstrlcpy(tls, ptr+4, (*Tpasswd)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48)))).Fpw_name, uint64(32))
  10638. (*TUIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_VALID)
  10639. }
  10640. return ptr + 4
  10641. }
  10642. // C documentation
  10643. //
  10644. // /*
  10645. // * group_from_gid()
  10646. // * caches the name (if any) for the gid. If noname clear, we always
  10647. // * return the stored name (if valid or invalid match).
  10648. // * We use a simple hash table.
  10649. // * Return:
  10650. // * Pointer to stored name (or a empty string)
  10651. // */
  10652. func Xgroup_from_gid(tls *libc.TLS, gid Tgid_t, noname int32) (r uintptr) {
  10653. bp := tls.Alloc(2688)
  10654. defer tls.Free(2688)
  10655. var pptr, ptr, v1 uintptr
  10656. var _ /* gr at bp+32 */ uintptr
  10657. var _ /* grbuf at bp+40 */ [2624]int8
  10658. var _ /* grstore at bp+0 */ Tgroup
  10659. _, _, _ = pptr, ptr, v1
  10660. *(*uintptr)(unsafe.Pointer(bp + 32)) = libc.UintptrFromInt32(0)
  10661. ptr = libc.UintptrFromInt32(0)
  10662. if _gidtb != libc.UintptrFromInt32(0) || _gidtb_start(tls) == 0 {
  10663. /*
  10664. * see if we have this gid cached
  10665. */
  10666. pptr = _gidtb + uintptr(gid%libc.Uint32FromInt32(m_GID_SZ))*8
  10667. ptr = *(*uintptr)(unsafe.Pointer(pptr))
  10668. if ptr != libc.UintptrFromInt32(0) && (*TGIDC)(unsafe.Pointer(ptr)).Fvalid > 0 && (*TGIDC)(unsafe.Pointer(ptr)).Fgid == gid {
  10669. /*
  10670. * have an entry for this gid
  10671. */
  10672. if !(noname != 0) || (*TGIDC)(unsafe.Pointer(ptr)).Fvalid == int32(m_VALID) {
  10673. return ptr + 4
  10674. }
  10675. return libc.UintptrFromInt32(0)
  10676. }
  10677. if ptr == libc.UintptrFromInt32(0) {
  10678. v1 = libc.Xmalloc(tls, uint64(40))
  10679. ptr = v1
  10680. *(*uintptr)(unsafe.Pointer(pptr)) = v1
  10681. }
  10682. }
  10683. libc.Xgetgrgid_r(tls, gid, bp, bp+40, uint64(2624), bp+32)
  10684. if *(*uintptr)(unsafe.Pointer(bp + 32)) == libc.UintptrFromInt32(0) {
  10685. /*
  10686. * no match for this gid in the local group file, put in
  10687. * a string that is the gid in numeric format
  10688. */
  10689. if ptr == libc.UintptrFromInt32(0) {
  10690. return libc.UintptrFromInt32(0)
  10691. }
  10692. (*TGIDC)(unsafe.Pointer(ptr)).Fgid = gid
  10693. libc.X__builtin_snprintf(tls, ptr+4, uint64(m_GNMLEN), __ccgo_ts+326, libc.VaList(bp+2672, gid))
  10694. (*TGIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_INVALID)
  10695. if noname != 0 {
  10696. return libc.UintptrFromInt32(0)
  10697. }
  10698. } else {
  10699. /*
  10700. * there is an entry for this group in the group file
  10701. */
  10702. if ptr == libc.UintptrFromInt32(0) {
  10703. return (*Tgroup)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32)))).Fgr_name
  10704. }
  10705. (*TGIDC)(unsafe.Pointer(ptr)).Fgid = gid
  10706. Xstrlcpy(tls, ptr+4, (*Tgroup)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32)))).Fgr_name, uint64(32))
  10707. (*TGIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_VALID)
  10708. }
  10709. return ptr + 4
  10710. }
  10711. // C documentation
  10712. //
  10713. // /*
  10714. // * uid_from_user()
  10715. // * caches the uid for a given user name. We use a simple hash table.
  10716. // * Return:
  10717. // * 0 if the user name is found (filling in uid), -1 otherwise
  10718. // */
  10719. func Xuid_from_user(tls *libc.TLS, name uintptr, uid uintptr) (r int32) {
  10720. bp := tls.Alloc(1088)
  10721. defer tls.Free(1088)
  10722. var namelen, v1 Tsize_t
  10723. var pptr, ptr, v3 uintptr
  10724. var v2 bool
  10725. var v4 Tuid_t
  10726. var _ /* pw at bp+48 */ uintptr
  10727. var _ /* pwbuf at bp+56 */ [1024]int8
  10728. var _ /* pwstore at bp+0 */ Tpasswd
  10729. _, _, _, _, _, _, _ = namelen, pptr, ptr, v1, v2, v3, v4
  10730. *(*uintptr)(unsafe.Pointer(bp + 48)) = libc.UintptrFromInt32(0)
  10731. ptr = libc.UintptrFromInt32(0)
  10732. /*
  10733. * return -1 for mangled names
  10734. */
  10735. if v2 = name == libc.UintptrFromInt32(0); !v2 {
  10736. v1 = libc.Xstrlen(tls, name)
  10737. namelen = v1
  10738. }
  10739. if v2 || v1 == uint64(0) {
  10740. return -int32(1)
  10741. }
  10742. if _usrtb != libc.UintptrFromInt32(0) || _usrtb_start(tls) == 0 {
  10743. /*
  10744. * look up in hash table, if found and valid return the uid,
  10745. * if found and invalid, return a -1
  10746. */
  10747. pptr = _usrtb + uintptr(_st_hash(tls, name, namelen, int32(m_UNM_SZ)))*8
  10748. ptr = *(*uintptr)(unsafe.Pointer(pptr))
  10749. if ptr != libc.UintptrFromInt32(0) && (*TUIDC)(unsafe.Pointer(ptr)).Fvalid > 0 && libc.Xstrcmp(tls, name, ptr+4) == 0 {
  10750. if (*TUIDC)(unsafe.Pointer(ptr)).Fvalid == int32(m_INVALID) {
  10751. return -int32(1)
  10752. }
  10753. *(*Tuid_t)(unsafe.Pointer(uid)) = (*TUIDC)(unsafe.Pointer(ptr)).Fuid
  10754. return 0
  10755. }
  10756. if ptr == libc.UintptrFromInt32(0) {
  10757. v3 = libc.Xmalloc(tls, uint64(40))
  10758. ptr = v3
  10759. *(*uintptr)(unsafe.Pointer(pptr)) = v3
  10760. }
  10761. }
  10762. /*
  10763. * no match, look it up, if no match store it as an invalid entry,
  10764. * or store the matching uid
  10765. */
  10766. libc.Xgetpwnam_r(tls, name, bp, bp+56, uint64(1024), bp+48)
  10767. if ptr == libc.UintptrFromInt32(0) {
  10768. if *(*uintptr)(unsafe.Pointer(bp + 48)) == libc.UintptrFromInt32(0) {
  10769. return -int32(1)
  10770. }
  10771. *(*Tuid_t)(unsafe.Pointer(uid)) = (*Tpasswd)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48)))).Fpw_uid
  10772. return 0
  10773. }
  10774. Xstrlcpy(tls, ptr+4, name, uint64(32))
  10775. if *(*uintptr)(unsafe.Pointer(bp + 48)) == libc.UintptrFromInt32(0) {
  10776. (*TUIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_INVALID)
  10777. return -int32(1)
  10778. }
  10779. (*TUIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_VALID)
  10780. v4 = (*Tpasswd)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48)))).Fpw_uid
  10781. (*TUIDC)(unsafe.Pointer(ptr)).Fuid = v4
  10782. *(*Tuid_t)(unsafe.Pointer(uid)) = v4
  10783. return 0
  10784. }
  10785. // C documentation
  10786. //
  10787. // /*
  10788. // * gid_from_group()
  10789. // * caches the gid for a given group name. We use a simple hash table.
  10790. // * Return:
  10791. // * 0 if the group name is found (filling in gid), -1 otherwise
  10792. // */
  10793. func Xgid_from_group(tls *libc.TLS, name uintptr, gid uintptr) (r int32) {
  10794. bp := tls.Alloc(2672)
  10795. defer tls.Free(2672)
  10796. var namelen, v1 Tsize_t
  10797. var pptr, ptr, v3 uintptr
  10798. var v2 bool
  10799. var v4 Tgid_t
  10800. var _ /* gr at bp+32 */ uintptr
  10801. var _ /* grbuf at bp+40 */ [2624]int8
  10802. var _ /* grstore at bp+0 */ Tgroup
  10803. _, _, _, _, _, _, _ = namelen, pptr, ptr, v1, v2, v3, v4
  10804. *(*uintptr)(unsafe.Pointer(bp + 32)) = libc.UintptrFromInt32(0)
  10805. ptr = libc.UintptrFromInt32(0)
  10806. /*
  10807. * return -1 for mangled names
  10808. */
  10809. if v2 = name == libc.UintptrFromInt32(0); !v2 {
  10810. v1 = libc.Xstrlen(tls, name)
  10811. namelen = v1
  10812. }
  10813. if v2 || v1 == uint64(0) {
  10814. return -int32(1)
  10815. }
  10816. if _grptb != libc.UintptrFromInt32(0) || _grptb_start(tls) == 0 {
  10817. /*
  10818. * look up in hash table, if found and valid return the uid,
  10819. * if found and invalid, return a -1
  10820. */
  10821. pptr = _grptb + uintptr(_st_hash(tls, name, namelen, int32(m_GID_SZ)))*8
  10822. ptr = *(*uintptr)(unsafe.Pointer(pptr))
  10823. if ptr != libc.UintptrFromInt32(0) && (*TGIDC)(unsafe.Pointer(ptr)).Fvalid > 0 && libc.Xstrcmp(tls, name, ptr+4) == 0 {
  10824. if (*TGIDC)(unsafe.Pointer(ptr)).Fvalid == int32(m_INVALID) {
  10825. return -int32(1)
  10826. }
  10827. *(*Tgid_t)(unsafe.Pointer(gid)) = (*TGIDC)(unsafe.Pointer(ptr)).Fgid
  10828. return 0
  10829. }
  10830. if ptr == libc.UintptrFromInt32(0) {
  10831. v3 = libc.Xmalloc(tls, uint64(40))
  10832. ptr = v3
  10833. *(*uintptr)(unsafe.Pointer(pptr)) = v3
  10834. }
  10835. }
  10836. /*
  10837. * no match, look it up, if no match store it as an invalid entry,
  10838. * or store the matching gid
  10839. */
  10840. libc.Xgetgrnam_r(tls, name, bp, bp+40, uint64(2624), bp+32)
  10841. if ptr == libc.UintptrFromInt32(0) {
  10842. if *(*uintptr)(unsafe.Pointer(bp + 32)) == libc.UintptrFromInt32(0) {
  10843. return -int32(1)
  10844. }
  10845. *(*Tgid_t)(unsafe.Pointer(gid)) = (*Tgroup)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32)))).Fgr_gid
  10846. return 0
  10847. }
  10848. Xstrlcpy(tls, ptr+4, name, uint64(32))
  10849. if *(*uintptr)(unsafe.Pointer(bp + 32)) == libc.UintptrFromInt32(0) {
  10850. (*TGIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_INVALID)
  10851. return -int32(1)
  10852. }
  10853. (*TGIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_VALID)
  10854. v4 = (*Tgroup)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32)))).Fgr_gid
  10855. (*TGIDC)(unsafe.Pointer(ptr)).Fgid = v4
  10856. *(*Tgid_t)(unsafe.Pointer(gid)) = v4
  10857. return 0
  10858. }
  10859. const m_B0 = 0000000
  10860. const m_B1000000 = 0010010
  10861. const m_B110 = 0000003
  10862. const m_B115200 = 0010002
  10863. const m_B1152000 = 0010011
  10864. const m_B1200 = 0000011
  10865. const m_B134 = 0000004
  10866. const m_B150 = 0000005
  10867. const m_B1500000 = 0010012
  10868. const m_B1800 = 0000012
  10869. const m_B19200 = 0000016
  10870. const m_B200 = 0000006
  10871. const m_B2000000 = 0010013
  10872. const m_B230400 = 0010003
  10873. const m_B2400 = 0000013
  10874. const m_B2500000 = 0010014
  10875. const m_B300 = 0000007
  10876. const m_B3000000 = 0010015
  10877. const m_B3500000 = 0010016
  10878. const m_B38400 = 0000017
  10879. const m_B4000000 = 0010017
  10880. const m_B460800 = 0010004
  10881. const m_B4800 = 0000014
  10882. const m_B50 = 0000001
  10883. const m_B500000 = 0010005
  10884. const m_B57600 = 0010001
  10885. const m_B576000 = 0010006
  10886. const m_B600 = 0000010
  10887. const m_B75 = 0000002
  10888. const m_B921600 = 0010007
  10889. const m_B9600 = 0000015
  10890. const m_BRKINT = 0000002
  10891. const m_BS0 = 0000000
  10892. const m_BS1 = 0020000
  10893. const m_BSDLY = 0020000
  10894. const m_CBAUD = 0010017
  10895. const m_CBAUDEX = 0010000
  10896. const m_CIBAUD = 002003600000
  10897. const m_CLOCAL = 0004000
  10898. const m_CMSPAR = 010000000000
  10899. const m_CR0 = 0000000
  10900. const m_CR1 = 0001000
  10901. const m_CR2 = 0002000
  10902. const m_CR3 = 0003000
  10903. const m_CRDLY = 0003000
  10904. const m_CREAD = 0000200
  10905. const m_CRTSCTS = 020000000000
  10906. const m_CS5 = 0000000
  10907. const m_CS6 = 0000020
  10908. const m_CS7 = 0000040
  10909. const m_CS8 = 0000060
  10910. const m_CSIZE = 0000060
  10911. const m_CSTOPB = 0000100
  10912. const m_ECHO = 8
  10913. const m_ECHOCTL = 0001000
  10914. const m_ECHOE = 0000020
  10915. const m_ECHOK = 0000040
  10916. const m_ECHOKE = 0004000
  10917. const m_ECHONL = 64
  10918. const m_ECHOPRT = 0002000
  10919. const m_EXTA = 0000016
  10920. const m_EXTB = 0000017
  10921. const m_EXTPROC = 0200000
  10922. const m_FF0 = 0000000
  10923. const m_FF1 = 0100000
  10924. const m_FFDLY = 0100000
  10925. const m_FLUSHO = 0010000
  10926. const m_HUPCL = 0002000
  10927. const m_ICANON = 0000002
  10928. const m_ICRNL = 0000400
  10929. const m_IEXTEN = 0100000
  10930. const m_IGNBRK = 0000001
  10931. const m_IGNCR = 0000200
  10932. const m_IGNPAR = 0000004
  10933. const m_IMAXBEL = 0020000
  10934. const m_INLCR = 0000100
  10935. const m_INPCK = 0000020
  10936. const m_ISIG = 0000001
  10937. const m_ISTRIP = 0000040
  10938. const m_IUCLC = 0001000
  10939. const m_IUTF8 = 0040000
  10940. const m_IXANY = 0004000
  10941. const m_IXOFF = 0010000
  10942. const m_IXON = 0002000
  10943. const m_NCCS = 32
  10944. const m_NL0 = 0000000
  10945. const m_NL1 = 0000400
  10946. const m_NLDLY = 0000400
  10947. const m_NOFLSH = 0000200
  10948. const m_OCRNL = 0000010
  10949. const m_OFDEL = 0000200
  10950. const m_OFILL = 0000100
  10951. const m_OLCUC = 0000002
  10952. const m_ONLCR = 0000004
  10953. const m_ONLRET = 0000040
  10954. const m_ONOCR = 0000020
  10955. const m_OPOST = 0000001
  10956. const m_O_CREAT4 = 0100
  10957. const m_O_NONBLOCK4 = 04000
  10958. const m_O_RDONLY2 = 00
  10959. const m_O_RDWR1 = 2
  10960. const m_O_TRUNC4 = 01000
  10961. const m_O_WRONLY2 = 01
  10962. const m_PARENB = 0000400
  10963. const m_PARMRK = 0000010
  10964. const m_PARODD = 0001000
  10965. const m_PENDIN = 0040000
  10966. const m_RPP_ECHO_OFF = 0x00
  10967. const m_RPP_ECHO_ON = 1
  10968. const m_RPP_FORCELOWER = 4
  10969. const m_RPP_FORCEUPPER = 8
  10970. const m_RPP_REQUIRE_TTY = 2
  10971. const m_RPP_SEVENBIT = 16
  10972. const m_RPP_STDIN = 32
  10973. const m_TAB0 = 0000000
  10974. const m_TAB1 = 0004000
  10975. const m_TAB2 = 0010000
  10976. const m_TAB3 = 0014000
  10977. const m_TABDLY = 0014000
  10978. const m_TCIFLUSH = 0
  10979. const m_TCIOFF = 2
  10980. const m_TCIOFLUSH = 2
  10981. const m_TCION = 3
  10982. const m_TCOFLUSH = 1
  10983. const m_TCOOFF = 0
  10984. const m_TCOON = 1
  10985. const m_TCSADRAIN = 1
  10986. const m_TCSAFLUSH = 2
  10987. const m_TCSANOW = 0
  10988. const m_TCSASOFT = 0
  10989. const m_TOSTOP = 0000400
  10990. const m_VDISCARD = 13
  10991. const m_VEOF = 4
  10992. const m_VEOL = 11
  10993. const m_VEOL2 = 16
  10994. const m_VERASE = 2
  10995. const m_VINTR = 0
  10996. const m_VKILL = 3
  10997. const m_VLNEXT = 15
  10998. const m_VMIN = 6
  10999. const m_VQUIT = 1
  11000. const m_VREPRINT = 12
  11001. const m_VSTART = 8
  11002. const m_VSTOP = 9
  11003. const m_VSUSP = 10
  11004. const m_VSWTC = 7
  11005. const m_VT0 = 0000000
  11006. const m_VT1 = 0040000
  11007. const m_VTDLY = 0040000
  11008. const m_VTIME = 5
  11009. const m_VWERASE = 14
  11010. const m_XCASE = 0000004
  11011. const m_XTABS = 0014000
  11012. const m__PATH_BSHELL = "/bin/sh"
  11013. const m__PATH_CONSOLE = "/dev/console"
  11014. const m__PATH_DEFPATH = "/usr/local/bin:/bin:/usr/bin"
  11015. const m__PATH_DEV = "/dev/"
  11016. const m__PATH_DEVNULL = "/dev/null"
  11017. const m__PATH_KLOG = "/proc/kmsg"
  11018. const m__PATH_LASTLOG = "/var/log/lastlog"
  11019. const m__PATH_MAILDIR = "/var/mail"
  11020. const m__PATH_MAN = "/usr/share/man"
  11021. const m__PATH_MNTTAB = "/etc/fstab"
  11022. const m__PATH_MOUNTED = "/etc/mtab"
  11023. const m__PATH_NOLOGIN = "/etc/nologin"
  11024. const m__PATH_SENDMAIL = "/usr/sbin/sendmail"
  11025. const m__PATH_SHADOW = "/etc/shadow"
  11026. const m__PATH_SHELLS = "/etc/shells"
  11027. const m__PATH_STDPATH = "/bin:/usr/bin:/sbin:/usr/sbin"
  11028. const m__PATH_TMP = "/tmp/"
  11029. const m__PATH_TTY = "/dev/tty"
  11030. const m__PATH_UTMP = "/dev/null/utmp"
  11031. const m__PATH_VARDB = "/var/lib/misc/"
  11032. const m__PATH_VARRUN = "/var/run/"
  11033. const m__PATH_VARTMP = "/var/tmp/"
  11034. const m__PATH_VI = "/usr/bin/vi"
  11035. const m__PATH_WTMP = "/dev/null/wtmp"
  11036. type Twinsize = struct {
  11037. Fws_row uint16
  11038. Fws_col uint16
  11039. Fws_xpixel uint16
  11040. Fws_ypixel uint16
  11041. }
  11042. type Tcc_t = uint8
  11043. type Tspeed_t = uint32
  11044. type Ttcflag_t = uint32
  11045. type Ttermios = struct {
  11046. Fc_iflag Ttcflag_t
  11047. Fc_oflag Ttcflag_t
  11048. Fc_cflag Ttcflag_t
  11049. Fc_lflag Ttcflag_t
  11050. Fc_line Tcc_t
  11051. Fc_cc [32]Tcc_t
  11052. F__c_ispeed Tspeed_t
  11053. F__c_ospeed Tspeed_t
  11054. }
  11055. var _signo [65]Tsig_atomic_t
  11056. func Xreadpassphrase(tls *libc.TLS, prompt uintptr, buf uintptr, bufsiz Tsize_t, flags int32) (r uintptr) {
  11057. bp := tls.Alloc(1648)
  11058. defer tls.Free(1648)
  11059. var end, p, v6, v8 uintptr
  11060. var i, input, need_restart, output, save_errno, sigttou, v2, v3 int32
  11061. var nr, v5 Tssize_t
  11062. var v4 bool
  11063. var _ /* ch at bp+0 */ int8
  11064. var _ /* oterm at bp+64 */ Ttermios
  11065. var _ /* sa at bp+128 */ Tsigaction
  11066. var _ /* savealrm at bp+280 */ Tsigaction
  11067. var _ /* savehup at bp+584 */ Tsigaction
  11068. var _ /* saveint at bp+432 */ Tsigaction
  11069. var _ /* savepipe at bp+1496 */ Tsigaction
  11070. var _ /* savequit at bp+736 */ Tsigaction
  11071. var _ /* saveterm at bp+888 */ Tsigaction
  11072. var _ /* savetstp at bp+1040 */ Tsigaction
  11073. var _ /* savettin at bp+1192 */ Tsigaction
  11074. var _ /* savettou at bp+1344 */ Tsigaction
  11075. var _ /* term at bp+4 */ Ttermios
  11076. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = end, i, input, need_restart, nr, output, p, save_errno, sigttou, v2, v3, v4, v5, v6, v8
  11077. /* I suppose we could alloc on demand in this case (XXX). */
  11078. if bufsiz == uint64(0) {
  11079. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11080. return libc.UintptrFromInt32(0)
  11081. }
  11082. goto restart
  11083. restart:
  11084. ;
  11085. i = 0
  11086. for {
  11087. if !(i < int32(m__NSIG)) {
  11088. break
  11089. }
  11090. libc.AtomicStorePInt32(uintptr(unsafe.Pointer(&_signo))+uintptr(i)*4, 0)
  11091. goto _1
  11092. _1:
  11093. ;
  11094. i++
  11095. }
  11096. nr = int64(-int32(1))
  11097. save_errno = 0
  11098. need_restart = 0
  11099. /*
  11100. * Read and write to /dev/tty if available. If not, read from
  11101. * stdin and write to stderr unless a tty is required.
  11102. */
  11103. if v4 = flags&int32(m_RPP_STDIN) != 0; !v4 {
  11104. v3 = libc.Xopen(tls, __ccgo_ts+430, int32(m_O_RDWR1), 0)
  11105. output = v3
  11106. v2 = v3
  11107. input = v2
  11108. }
  11109. if v4 || v2 == -int32(1) {
  11110. if flags&int32(m_RPP_REQUIRE_TTY) != 0 {
  11111. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOTTY)
  11112. return libc.UintptrFromInt32(0)
  11113. }
  11114. input = m_STDIN_FILENO
  11115. output = int32(m_STDERR_FILENO)
  11116. }
  11117. /*
  11118. * Turn off echo if possible.
  11119. * If we are using a tty but are not the foreground pgrp this will
  11120. * generate SIGTTOU, so do it *before* installing the signal handlers.
  11121. */
  11122. if input != m_STDIN_FILENO && libc.Xtcgetattr(tls, input, bp+64) == 0 {
  11123. libc.Xmemcpy(tls, bp+4, bp+64, uint64(60))
  11124. if !(flags&libc.Int32FromInt32(m_RPP_ECHO_ON) != 0) {
  11125. (*(*Ttermios)(unsafe.Pointer(bp + 4))).Fc_lflag &= libc.Uint32FromInt32(^(libc.Int32FromInt32(m_ECHO) | libc.Int32FromInt32(m_ECHONL)))
  11126. }
  11127. libc.Xtcsetattr(tls, input, libc.Int32FromInt32(m_TCSAFLUSH)|libc.Int32FromInt32(m_TCSASOFT), bp+4)
  11128. } else {
  11129. libc.Xmemset(tls, bp+4, 0, uint64(60))
  11130. (*(*Ttermios)(unsafe.Pointer(bp + 4))).Fc_lflag |= uint32(m_ECHO)
  11131. libc.Xmemset(tls, bp+64, 0, uint64(60))
  11132. (*(*Ttermios)(unsafe.Pointer(bp + 64))).Fc_lflag |= uint32(m_ECHO)
  11133. }
  11134. /*
  11135. * Catch signals that would otherwise cause the user to end
  11136. * up with echo turned off in the shell. Don't worry about
  11137. * things like SIGXCPU and SIGVTALRM for now.
  11138. */
  11139. libc.Xsigemptyset(tls, bp+128+8)
  11140. (*(*Tsigaction)(unsafe.Pointer(bp + 128))).Fsa_flags = 0 /* don't restart system calls */
  11141. *(*uintptr)(unsafe.Pointer(bp + 128)) = __ccgo_fp(_handler)
  11142. libc.Xsigaction(tls, int32(m_SIGALRM), bp+128, bp+280)
  11143. libc.Xsigaction(tls, int32(m_SIGHUP), bp+128, bp+584)
  11144. libc.Xsigaction(tls, int32(m_SIGINT), bp+128, bp+432)
  11145. libc.Xsigaction(tls, int32(m_SIGPIPE), bp+128, bp+1496)
  11146. libc.Xsigaction(tls, int32(m_SIGQUIT), bp+128, bp+736)
  11147. libc.Xsigaction(tls, int32(m_SIGTERM), bp+128, bp+888)
  11148. libc.Xsigaction(tls, int32(m_SIGTSTP), bp+128, bp+1040)
  11149. libc.Xsigaction(tls, int32(m_SIGTTIN), bp+128, bp+1192)
  11150. libc.Xsigaction(tls, int32(m_SIGTTOU), bp+128, bp+1344)
  11151. if !(flags&libc.Int32FromInt32(m_RPP_STDIN) != 0) {
  11152. libc.Xwrite(tls, output, prompt, libc.Xstrlen(tls, prompt))
  11153. }
  11154. end = buf + uintptr(bufsiz) - uintptr(1)
  11155. p = buf
  11156. for {
  11157. v5 = libc.Xread(tls, input, bp, uint64(1))
  11158. nr = v5
  11159. if !(v5 == int64(1) && int32(*(*int8)(unsafe.Pointer(bp))) != int32('\n') && int32(*(*int8)(unsafe.Pointer(bp))) != int32('\r')) {
  11160. break
  11161. }
  11162. if p < end {
  11163. if flags&int32(m_RPP_SEVENBIT) != 0 {
  11164. *(*int8)(unsafe.Pointer(bp)) = int8(int32(*(*int8)(unsafe.Pointer(bp))) & libc.Int32FromInt32(0x7f))
  11165. }
  11166. if libc.BoolInt32(uint32(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(bp))))|uint32(32)-uint32('a') < uint32(26)) != 0 {
  11167. if flags&int32(m_RPP_FORCELOWER) != 0 {
  11168. *(*int8)(unsafe.Pointer(bp)) = int8(libc.Xtolower(tls, libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(bp))))))
  11169. }
  11170. if flags&int32(m_RPP_FORCEUPPER) != 0 {
  11171. *(*int8)(unsafe.Pointer(bp)) = int8(libc.Xtoupper(tls, libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(bp))))))
  11172. }
  11173. }
  11174. v6 = p
  11175. p++
  11176. *(*int8)(unsafe.Pointer(v6)) = *(*int8)(unsafe.Pointer(bp))
  11177. }
  11178. }
  11179. *(*int8)(unsafe.Pointer(p)) = int8('\000')
  11180. save_errno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  11181. if !((*(*Ttermios)(unsafe.Pointer(bp + 4))).Fc_lflag&libc.Uint32FromInt32(m_ECHO) != 0) {
  11182. libc.Xwrite(tls, output, __ccgo_ts+439, uint64(1))
  11183. }
  11184. /* Restore old terminal settings and signals. */
  11185. if libc.Xmemcmp(tls, bp+4, bp+64, uint64(60)) != 0 {
  11186. sigttou = libc.AtomicLoadPInt32(uintptr(unsafe.Pointer(&_signo)) + libc.UintptrFromInt32(m_SIGTTOU)*4)
  11187. /* Ignore SIGTTOU generated when we are not the fg pgrp. */
  11188. 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) {
  11189. continue
  11190. }
  11191. libc.AtomicStorePInt32(uintptr(unsafe.Pointer(&_signo))+22*4, sigttou)
  11192. }
  11193. libc.Xsigaction(tls, int32(m_SIGALRM), bp+280, libc.UintptrFromInt32(0))
  11194. libc.Xsigaction(tls, int32(m_SIGHUP), bp+584, libc.UintptrFromInt32(0))
  11195. libc.Xsigaction(tls, int32(m_SIGINT), bp+432, libc.UintptrFromInt32(0))
  11196. libc.Xsigaction(tls, int32(m_SIGQUIT), bp+736, libc.UintptrFromInt32(0))
  11197. libc.Xsigaction(tls, int32(m_SIGPIPE), bp+1496, libc.UintptrFromInt32(0))
  11198. libc.Xsigaction(tls, int32(m_SIGTERM), bp+888, libc.UintptrFromInt32(0))
  11199. libc.Xsigaction(tls, int32(m_SIGTSTP), bp+1040, libc.UintptrFromInt32(0))
  11200. libc.Xsigaction(tls, int32(m_SIGTTIN), bp+1192, libc.UintptrFromInt32(0))
  11201. libc.Xsigaction(tls, int32(m_SIGTTOU), bp+1344, libc.UintptrFromInt32(0))
  11202. if input != m_STDIN_FILENO {
  11203. libc.Xclose(tls, input)
  11204. }
  11205. /*
  11206. * If we were interrupted by a signal, resend it to ourselves
  11207. * now that we have restored the signal handlers.
  11208. */
  11209. i = 0
  11210. for {
  11211. if !(i < int32(m__NSIG)) {
  11212. break
  11213. }
  11214. if libc.AtomicLoadPInt32(uintptr(unsafe.Pointer(&_signo))+uintptr(i)*4) != 0 {
  11215. libc.Xkill(tls, libc.Xgetpid(tls), i)
  11216. switch i {
  11217. case int32(m_SIGTSTP):
  11218. fallthrough
  11219. case int32(m_SIGTTIN):
  11220. fallthrough
  11221. case int32(m_SIGTTOU):
  11222. need_restart = int32(1)
  11223. }
  11224. }
  11225. goto _7
  11226. _7:
  11227. ;
  11228. i++
  11229. }
  11230. if need_restart != 0 {
  11231. goto restart
  11232. }
  11233. if save_errno != 0 {
  11234. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = save_errno
  11235. }
  11236. if nr == int64(-int32(1)) {
  11237. v8 = libc.UintptrFromInt32(0)
  11238. } else {
  11239. v8 = buf
  11240. }
  11241. return v8
  11242. }
  11243. func _handler(tls *libc.TLS, s int32) {
  11244. libc.AtomicStorePInt32(uintptr(unsafe.Pointer(&_signo))+uintptr(s)*4, int32(1))
  11245. }
  11246. const m_UINT64_MAX1 = 18446744073709551615
  11247. /*
  11248. * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
  11249. * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
  11250. */
  11251. func Xreallocarray(tls *libc.TLS, optr uintptr, nmemb Tsize_t, size Tsize_t) (r uintptr) {
  11252. 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 {
  11253. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOMEM)
  11254. return libc.UintptrFromInt32(0)
  11255. }
  11256. return libc.Xrealloc(tls, optr, size*nmemb)
  11257. }
  11258. const m_UINT64_MAX2 = "0xffffffffffffffffu"
  11259. func Xreallocf(tls *libc.TLS, ptr uintptr, size Tsize_t) (r uintptr) {
  11260. var nptr uintptr
  11261. _ = nptr
  11262. nptr = libc.Xrealloc(tls, ptr, size)
  11263. /*
  11264. * When the System V compatibility option (malloc "V" flag) is
  11265. * in effect, realloc(ptr, 0) frees the memory and returns NULL.
  11266. * So, to avoid double free, call free() only when size != 0.
  11267. * realloc(ptr, 0) can't fail when ptr != NULL.
  11268. */
  11269. if !(nptr != 0) && ptr != 0 && size != uint64(0) {
  11270. libc.Xfree(tls, ptr)
  11271. }
  11272. return nptr
  11273. }
  11274. const m_UINT64_MAX3 = 18446744073709551615
  11275. /*
  11276. * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
  11277. * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
  11278. */
  11279. func Xrecallocarray(tls *libc.TLS, ptr uintptr, oldnmemb Tsize_t, newnmemb Tsize_t, size Tsize_t) (r uintptr) {
  11280. var d, newsize, oldsize Tsize_t
  11281. var newptr uintptr
  11282. _, _, _, _ = d, newptr, newsize, oldsize
  11283. if ptr == libc.UintptrFromInt32(0) {
  11284. return libc.Xcalloc(tls, newnmemb, size)
  11285. }
  11286. 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 {
  11287. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOMEM)
  11288. return libc.UintptrFromInt32(0)
  11289. }
  11290. newsize = newnmemb * size
  11291. 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 {
  11292. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11293. return libc.UintptrFromInt32(0)
  11294. }
  11295. oldsize = oldnmemb * size
  11296. /*
  11297. * Don't bother too much if we're shrinking just a bit,
  11298. * we do not shrink for series of small steps, oh well.
  11299. */
  11300. if newsize <= oldsize {
  11301. d = oldsize - newsize
  11302. if d < oldsize/uint64(2) && d < libc.Uint64FromInt32(libc.Xgetpagesize(tls)) {
  11303. libc.Xmemset(tls, ptr+uintptr(newsize), 0, d)
  11304. return ptr
  11305. }
  11306. }
  11307. newptr = libc.Xmalloc(tls, newsize)
  11308. if newptr == libc.UintptrFromInt32(0) {
  11309. return libc.UintptrFromInt32(0)
  11310. }
  11311. if newsize > oldsize {
  11312. libc.Xmemcpy(tls, newptr, ptr, oldsize)
  11313. libc.Xmemset(tls, newptr+uintptr(oldsize), 0, newsize-oldsize)
  11314. } else {
  11315. libc.Xmemcpy(tls, newptr, ptr, newsize)
  11316. }
  11317. Xexplicit_bzero(tls, ptr, oldsize)
  11318. libc.Xfree(tls, ptr)
  11319. return newptr
  11320. }
  11321. const m_UINT64_MAX4 = "0xffffffffffffffffu"
  11322. /*
  11323. * Swap two areas of size number of bytes. Although qsort(3) permits random
  11324. * blocks of memory to be sorted, sorting pointers is almost certainly the
  11325. * common case (and, were it not, could easily be made so). Regardless, it
  11326. * isn't worth optimizing; the SWAP's get sped up by the cache, and pointer
  11327. * arithmetic gets lost in the time required for comparison function calls.
  11328. */
  11329. /* Copy one block of size size to another. */
  11330. /*
  11331. * Build the list into a heap, where a heap is defined such that for
  11332. * the records K1 ... KN, Kj/2 >= Kj for 1 <= j/2 <= j <= N.
  11333. *
  11334. * There are two cases. If j == nmemb, select largest of Ki and Kj. If
  11335. * j < nmemb, select largest of Ki, Kj and Kj+1.
  11336. */
  11337. /*
  11338. * Select the top of the heap and 'heapify'. Since by far the most expensive
  11339. * action is the call to the compar function, a considerable optimization
  11340. * in the average case can be achieved due to the fact that k, the displaced
  11341. * element, is usually quite small, so it would be preferable to first
  11342. * heapify, always maintaining the invariant that the larger child is copied
  11343. * over its parent's record.
  11344. *
  11345. * Then, starting from the *bottom* of the heap, finding k's correct place,
  11346. * again maintaining the invariant. As a result of the invariant no element
  11347. * is 'lost' when k is assigned its correct place in the heap.
  11348. *
  11349. * The time savings from this optimization are on the order of 15-20% for the
  11350. * average case. See Knuth, Vol. 3, page 158, problem 18.
  11351. *
  11352. * XXX Don't break the #define SELECT line, below. Reiser cpp gets upset.
  11353. */
  11354. // C documentation
  11355. //
  11356. // /*
  11357. // * Heapsort -- Knuth, Vol. 3, page 145. Runs in O (N lg N), both average
  11358. // * and worst. While heapsort is faster than the worst case of quicksort,
  11359. // * the BSD quicksort does median selection so that the chance of finding
  11360. // * a data set that will trigger the worst case is nonexistent. Heapsort's
  11361. // * only advantage over quicksort is that it requires little additional memory.
  11362. // */
  11363. func Xheapsort(tls *libc.TLS, vbase uintptr, nmemb Tsize_t, size Tsize_t, compar uintptr) (r int32) {
  11364. var base, k, p, t, tmp1, tmp2, v1, v12, v13, v16, v17, v22, v23, v27, v28, v31, v32, v8, v9 uintptr
  11365. var cnt, i, j, l, v10, v14, v19, v20, v25, v29, v3, v5, v6 Tsize_t
  11366. var tmp int8
  11367. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  11368. if nmemb <= uint64(1) {
  11369. return 0
  11370. }
  11371. if !(size != 0) {
  11372. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11373. return -int32(1)
  11374. }
  11375. v1 = libc.Xmalloc(tls, size)
  11376. k = v1
  11377. if v1 == libc.UintptrFromInt32(0) {
  11378. return -int32(1)
  11379. }
  11380. /*
  11381. * Items are numbered from 1 to nmemb, so offset from size bytes
  11382. * below the starting address.
  11383. */
  11384. base = vbase - uintptr(size)
  11385. l = nmemb/uint64(2) + uint64(1)
  11386. for {
  11387. l--
  11388. v3 = l
  11389. if !(v3 != 0) {
  11390. break
  11391. }
  11392. i = l
  11393. for {
  11394. v5 = i * libc.Uint64FromInt32(2)
  11395. j = v5
  11396. if !(v5 <= nmemb) {
  11397. break
  11398. }
  11399. p = base + uintptr(j*size)
  11400. if j < nmemb && (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{compar})))(tls, p, p+uintptr(size)) < 0 {
  11401. p += uintptr(size)
  11402. j++
  11403. }
  11404. t = base + uintptr(i*size)
  11405. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{compar})))(tls, p, t) <= 0 {
  11406. break
  11407. }
  11408. cnt = size
  11409. for {
  11410. tmp = *(*int8)(unsafe.Pointer(t))
  11411. v8 = t
  11412. t++
  11413. *(*int8)(unsafe.Pointer(v8)) = *(*int8)(unsafe.Pointer(p))
  11414. v9 = p
  11415. p++
  11416. *(*int8)(unsafe.Pointer(v9)) = tmp
  11417. goto _7
  11418. _7:
  11419. ;
  11420. cnt--
  11421. v6 = cnt
  11422. if !(v6 != 0) {
  11423. break
  11424. }
  11425. }
  11426. goto _4
  11427. _4:
  11428. ;
  11429. i = j
  11430. }
  11431. goto _2
  11432. _2:
  11433. }
  11434. /*
  11435. * For each element of the heap, save the largest element into its
  11436. * final slot, save the displaced element (k), then recreate the
  11437. * heap.
  11438. */
  11439. for nmemb > uint64(1) {
  11440. cnt = size
  11441. tmp1 = k
  11442. tmp2 = base + uintptr(nmemb*size)
  11443. for {
  11444. v12 = tmp1
  11445. tmp1++
  11446. v13 = tmp2
  11447. tmp2++
  11448. *(*int8)(unsafe.Pointer(v12)) = *(*int8)(unsafe.Pointer(v13))
  11449. goto _11
  11450. _11:
  11451. ;
  11452. cnt--
  11453. v10 = cnt
  11454. if !(v10 != 0) {
  11455. break
  11456. }
  11457. }
  11458. cnt = size
  11459. tmp1 = base + uintptr(nmemb*size)
  11460. tmp2 = base + uintptr(size)
  11461. for {
  11462. v16 = tmp1
  11463. tmp1++
  11464. v17 = tmp2
  11465. tmp2++
  11466. *(*int8)(unsafe.Pointer(v16)) = *(*int8)(unsafe.Pointer(v17))
  11467. goto _15
  11468. _15:
  11469. ;
  11470. cnt--
  11471. v14 = cnt
  11472. if !(v14 != 0) {
  11473. break
  11474. }
  11475. }
  11476. nmemb--
  11477. i = uint64(1)
  11478. for {
  11479. v19 = i * libc.Uint64FromInt32(2)
  11480. j = v19
  11481. if !(v19 <= nmemb) {
  11482. break
  11483. }
  11484. p = base + uintptr(j*size)
  11485. if j < nmemb && (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{compar})))(tls, p, p+uintptr(size)) < 0 {
  11486. p += uintptr(size)
  11487. j++
  11488. }
  11489. t = base + uintptr(i*size)
  11490. cnt = size
  11491. tmp1 = t
  11492. tmp2 = p
  11493. for {
  11494. v22 = tmp1
  11495. tmp1++
  11496. v23 = tmp2
  11497. tmp2++
  11498. *(*int8)(unsafe.Pointer(v22)) = *(*int8)(unsafe.Pointer(v23))
  11499. goto _21
  11500. _21:
  11501. ;
  11502. cnt--
  11503. v20 = cnt
  11504. if !(v20 != 0) {
  11505. break
  11506. }
  11507. }
  11508. goto _18
  11509. _18:
  11510. ;
  11511. i = j
  11512. }
  11513. for {
  11514. j = i
  11515. i = j / uint64(2)
  11516. p = base + uintptr(j*size)
  11517. t = base + uintptr(i*size)
  11518. if j == uint64(1) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{compar})))(tls, k, t) < 0 {
  11519. cnt = size
  11520. tmp1 = p
  11521. tmp2 = k
  11522. for {
  11523. v27 = tmp1
  11524. tmp1++
  11525. v28 = tmp2
  11526. tmp2++
  11527. *(*int8)(unsafe.Pointer(v27)) = *(*int8)(unsafe.Pointer(v28))
  11528. goto _26
  11529. _26:
  11530. ;
  11531. cnt--
  11532. v25 = cnt
  11533. if !(v25 != 0) {
  11534. break
  11535. }
  11536. }
  11537. break
  11538. }
  11539. cnt = size
  11540. tmp1 = p
  11541. tmp2 = t
  11542. for {
  11543. v31 = tmp1
  11544. tmp1++
  11545. v32 = tmp2
  11546. tmp2++
  11547. *(*int8)(unsafe.Pointer(v31)) = *(*int8)(unsafe.Pointer(v32))
  11548. goto _30
  11549. _30:
  11550. ;
  11551. cnt--
  11552. v29 = cnt
  11553. if !(v29 != 0) {
  11554. break
  11555. }
  11556. }
  11557. goto _24
  11558. _24:
  11559. }
  11560. }
  11561. libc.Xfree(tls, k)
  11562. return 0
  11563. }
  11564. const m_THRESHOLD = 16
  11565. /*
  11566. * Find the next possible pointer head. (Trickery for forcing an array
  11567. * to do double duty as a linked list when objects do not align with word
  11568. * boundaries.
  11569. */
  11570. /* Assumption: PSIZE is a power of 2. */
  11571. // C documentation
  11572. //
  11573. // /*
  11574. // * Arguments are as for qsort.
  11575. // */
  11576. func Xmergesort(tls *libc.TLS, base uintptr, nmemb Tsize_t, size Tsize_t, cmp uintptr) (r int32) {
  11577. 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
  11578. var big, iflag, sense, v2 int32
  11579. var i, v8 Tsize_t
  11580. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  11581. if size < libc.Uint64FromInt64(8)/libc.Uint64FromInt32(2) { /* Pointers must fit into 2 * size. */
  11582. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11583. return -int32(1)
  11584. }
  11585. if nmemb == uint64(0) {
  11586. return 0
  11587. }
  11588. /*
  11589. * XXX
  11590. * Stupid subtraction for the Cray.
  11591. */
  11592. iflag = 0
  11593. if !(size%libc.Uint64FromInt64(4) != 0) && !(libc.Uint64FromInt64(int64(base)-int64(libc.UintptrFromInt32(0)))%libc.Uint64FromInt64(4) != 0) {
  11594. iflag = int32(1)
  11595. }
  11596. v1 = libc.Xmalloc(tls, nmemb*size+uint64(8))
  11597. list2 = v1
  11598. if v1 == libc.UintptrFromInt32(0) {
  11599. return -int32(1)
  11600. }
  11601. list1 = base
  11602. _setup(tls, list1, list2, nmemb, size, cmp)
  11603. last = list2 + uintptr(nmemb*size)
  11604. v2 = libc.Int32FromInt32(0)
  11605. big = v2
  11606. i = libc.Uint64FromInt32(v2)
  11607. for *(*uintptr)(unsafe.Pointer(uintptr(libc.Uint64FromInt64(int64(list2+libc.UintptrFromInt64(8)-libc.UintptrFromInt32(1))-int64(libc.UintptrFromInt32(0))) & ^(libc.Uint64FromInt64(8) - libc.Uint64FromInt32(1))))) != last {
  11608. l2 = list1
  11609. p1 = uintptr(libc.Uint64FromInt64(int64(list1+libc.UintptrFromInt64(8)-libc.UintptrFromInt32(1))-int64(libc.UintptrFromInt32(0))) & ^(libc.Uint64FromInt64(8) - libc.Uint64FromInt32(1)))
  11610. v4 = list2
  11611. p2 = v4
  11612. tp2 = v4
  11613. for {
  11614. if !(p2 != last) {
  11615. break
  11616. }
  11617. p2 = *(*uintptr)(unsafe.Pointer(uintptr(libc.Uint64FromInt64(int64(p2+libc.UintptrFromInt64(8)-libc.UintptrFromInt32(1))-int64(libc.UintptrFromInt32(0))) & ^(libc.Uint64FromInt64(8) - libc.Uint64FromInt32(1)))))
  11618. f1 = l2
  11619. v5 = list1 + uintptr(int64(p2)-int64(list2))
  11620. l1 = v5
  11621. f2 = v5
  11622. if p2 != last {
  11623. p2 = *(*uintptr)(unsafe.Pointer(uintptr(libc.Uint64FromInt64(int64(p2+libc.UintptrFromInt64(8)-libc.UintptrFromInt32(1))-int64(libc.UintptrFromInt32(0))) & ^(libc.Uint64FromInt64(8) - libc.Uint64FromInt32(1)))))
  11624. }
  11625. l2 = list1 + uintptr(int64(p2)-int64(list2))
  11626. for f1 < l1 && f2 < l2 {
  11627. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f1, f2) <= 0 {
  11628. q = f2
  11629. b = f1
  11630. t = l1
  11631. sense = -int32(1)
  11632. } else {
  11633. q = f1
  11634. b = f2
  11635. t = l2
  11636. sense = 0
  11637. }
  11638. if !!(big != 0) {
  11639. goto _6
  11640. } /* here i = 0 */
  11641. for {
  11642. b += uintptr(size)
  11643. if !(b < t && (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, b) > sense) {
  11644. break
  11645. }
  11646. i++
  11647. v8 = i
  11648. if v8 == uint64(6) {
  11649. big = int32(1)
  11650. goto EXPONENTIAL
  11651. }
  11652. }
  11653. goto _7
  11654. _6:
  11655. ;
  11656. goto EXPONENTIAL
  11657. EXPONENTIAL:
  11658. ;
  11659. i = size
  11660. for {
  11661. v10 = b + uintptr(i)
  11662. p = v10
  11663. if v10 >= t {
  11664. v11 = t - uintptr(size)
  11665. p = v11
  11666. if v11 > b && (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, p) <= sense {
  11667. t = p
  11668. } else {
  11669. b = p
  11670. }
  11671. break
  11672. } else {
  11673. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, p) <= sense {
  11674. t = p
  11675. if i == size {
  11676. big = 0
  11677. }
  11678. goto FASTCASE
  11679. } else {
  11680. b = p
  11681. }
  11682. }
  11683. goto _9
  11684. _9:
  11685. ;
  11686. i <<= uint64(1)
  11687. }
  11688. for t > b+uintptr(size) {
  11689. i = libc.Uint64FromInt64(int64(t)-int64(b)) / size >> int32(1) * size
  11690. v12 = b + uintptr(i)
  11691. p = v12
  11692. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, v12) <= sense {
  11693. t = p
  11694. } else {
  11695. b = p
  11696. }
  11697. }
  11698. goto COPY
  11699. goto FASTCASE
  11700. FASTCASE:
  11701. ;
  11702. for i > size {
  11703. i >>= uint64(1)
  11704. v13 = b + uintptr(i)
  11705. p = v13
  11706. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, v13) <= sense {
  11707. t = p
  11708. } else {
  11709. b = p
  11710. }
  11711. }
  11712. goto COPY
  11713. COPY:
  11714. ;
  11715. b = t
  11716. _7:
  11717. ;
  11718. i = size
  11719. if q == f1 {
  11720. if iflag != 0 {
  11721. for cond := true; cond; cond = f2 < b {
  11722. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f2))
  11723. f2 += uintptr(4)
  11724. tp2 += uintptr(4)
  11725. }
  11726. for {
  11727. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f1))
  11728. f1 += uintptr(4)
  11729. tp2 += uintptr(4)
  11730. goto _14
  11731. _14:
  11732. ;
  11733. i -= uint64(4)
  11734. if !(i != 0) {
  11735. break
  11736. }
  11737. }
  11738. } else {
  11739. for cond := true; cond; cond = f2 < b {
  11740. v15 = tp2
  11741. tp2++
  11742. v16 = f2
  11743. f2++
  11744. *(*uint8)(unsafe.Pointer(v15)) = *(*uint8)(unsafe.Pointer(v16))
  11745. }
  11746. for {
  11747. v18 = tp2
  11748. tp2++
  11749. v19 = f1
  11750. f1++
  11751. *(*uint8)(unsafe.Pointer(v18)) = *(*uint8)(unsafe.Pointer(v19))
  11752. goto _17
  11753. _17:
  11754. ;
  11755. i -= uint64(1)
  11756. if !(i != 0) {
  11757. break
  11758. }
  11759. }
  11760. }
  11761. } else {
  11762. if iflag != 0 {
  11763. for cond := true; cond; cond = f1 < b {
  11764. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f1))
  11765. f1 += uintptr(4)
  11766. tp2 += uintptr(4)
  11767. }
  11768. for {
  11769. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f2))
  11770. f2 += uintptr(4)
  11771. tp2 += uintptr(4)
  11772. goto _20
  11773. _20:
  11774. ;
  11775. i -= uint64(4)
  11776. if !(i != 0) {
  11777. break
  11778. }
  11779. }
  11780. } else {
  11781. for cond := true; cond; cond = f1 < b {
  11782. v21 = tp2
  11783. tp2++
  11784. v22 = f1
  11785. f1++
  11786. *(*uint8)(unsafe.Pointer(v21)) = *(*uint8)(unsafe.Pointer(v22))
  11787. }
  11788. for {
  11789. v24 = tp2
  11790. tp2++
  11791. v25 = f2
  11792. f2++
  11793. *(*uint8)(unsafe.Pointer(v24)) = *(*uint8)(unsafe.Pointer(v25))
  11794. goto _23
  11795. _23:
  11796. ;
  11797. i -= uint64(1)
  11798. if !(i != 0) {
  11799. break
  11800. }
  11801. }
  11802. }
  11803. }
  11804. }
  11805. if f2 < l2 {
  11806. if iflag != 0 {
  11807. for cond := true; cond; cond = f2 < l2 {
  11808. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f2))
  11809. f2 += uintptr(4)
  11810. tp2 += uintptr(4)
  11811. }
  11812. } else {
  11813. for cond := true; cond; cond = f2 < l2 {
  11814. v26 = tp2
  11815. tp2++
  11816. v27 = f2
  11817. f2++
  11818. *(*uint8)(unsafe.Pointer(v26)) = *(*uint8)(unsafe.Pointer(v27))
  11819. }
  11820. }
  11821. } else {
  11822. if f1 < l1 {
  11823. if iflag != 0 {
  11824. for cond := true; cond; cond = f1 < l1 {
  11825. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f1))
  11826. f1 += uintptr(4)
  11827. tp2 += uintptr(4)
  11828. }
  11829. } else {
  11830. for cond := true; cond; cond = f1 < l1 {
  11831. v28 = tp2
  11832. tp2++
  11833. v29 = f1
  11834. f1++
  11835. *(*uint8)(unsafe.Pointer(v28)) = *(*uint8)(unsafe.Pointer(v29))
  11836. }
  11837. }
  11838. }
  11839. }
  11840. *(*uintptr)(unsafe.Pointer(p1)) = l2
  11841. goto _3
  11842. _3:
  11843. ;
  11844. p1 = uintptr(libc.Uint64FromInt64(int64(l2+libc.UintptrFromInt64(8)-libc.UintptrFromInt32(1))-int64(libc.UintptrFromInt32(0))) & ^(libc.Uint64FromInt64(8) - libc.Uint64FromInt32(1)))
  11845. }
  11846. tp2 = list1 /* swap list1, list2 */
  11847. list1 = list2
  11848. list2 = tp2
  11849. last = list2 + uintptr(nmemb*size)
  11850. }
  11851. if base == list2 {
  11852. libc.Xmemmove(tls, list2, list1, nmemb*size)
  11853. list2 = list1
  11854. }
  11855. libc.Xfree(tls, list2)
  11856. return 0
  11857. }
  11858. // C documentation
  11859. //
  11860. // /*
  11861. // * Optional hybrid natural/pairwise first pass. Eats up list1 in runs of
  11862. // * increasing order, list2 in a corresponding linked list. Checks for runs
  11863. // * when THRESHOLD/2 pairs compare with same sense. (Only used when NATURAL
  11864. // * is defined. Otherwise simple pairwise merging is used.)
  11865. // */
  11866. func _setup(tls *libc.TLS, list1 uintptr, list2 uintptr, n Tsize_t, size Tsize_t, cmp uintptr) {
  11867. var f1, f2, l2, last, p2, s, v10, v13, v14, v17, v18, v19, v20, v4, v7, v8 uintptr
  11868. var i, length, sense, size2, tmp, v11, v15, v5 int32
  11869. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = f1, f2, i, l2, last, length, p2, s, sense, size2, tmp, v10, v11, v13, v14, v15, v17, v18, v19, v20, v4, v5, v7, v8
  11870. size2 = libc.Int32FromUint64(size * uint64(2))
  11871. if n <= uint64(5) {
  11872. _insertionsort(tls, list1, n, size, cmp)
  11873. *(*uintptr)(unsafe.Pointer(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)
  11874. return
  11875. }
  11876. /*
  11877. * Avoid running pointers out of bounds; limit n to evens
  11878. * for simplicity.
  11879. */
  11880. i = libc.Int32FromUint64(uint64(4) + n&uint64(1))
  11881. _insertionsort(tls, list1+uintptr((n-libc.Uint64FromInt32(i))*size), libc.Uint64FromInt32(i), size, cmp)
  11882. last = list1 + uintptr(size*(n-libc.Uint64FromInt32(i)))
  11883. *(*uintptr)(unsafe.Pointer(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)
  11884. p2 = list2
  11885. f1 = list1
  11886. sense = libc.BoolInt32((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f1, f1+uintptr(size)) > 0)
  11887. for {
  11888. if !(f1 < last) {
  11889. break
  11890. }
  11891. length = int32(2)
  11892. /* Find pairs with same sense. */
  11893. f2 = f1 + uintptr(size2)
  11894. for {
  11895. if !(f2 < last) {
  11896. break
  11897. }
  11898. if libc.BoolInt32((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f2, f2+uintptr(size)) > 0) != sense {
  11899. break
  11900. }
  11901. length += int32(2)
  11902. goto _2
  11903. _2:
  11904. ;
  11905. f2 += uintptr(size2)
  11906. }
  11907. if length < int32(m_THRESHOLD) { /* Pairwise merge */
  11908. for {
  11909. v4 = uintptr(int64(f1+uintptr(size2))-int64(list1)) + list2
  11910. *(*uintptr)(unsafe.Pointer(uintptr(libc.Uint64FromInt64(int64(p2+libc.UintptrFromInt64(8)-libc.UintptrFromInt32(1))-int64(libc.UintptrFromInt32(0))) & ^(libc.Uint64FromInt64(8) - libc.Uint64FromInt32(1))))) = v4
  11911. p2 = v4
  11912. if sense > 0 {
  11913. s = f1 + uintptr(size)
  11914. i = libc.Int32FromUint64(size)
  11915. for {
  11916. tmp = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f1)))
  11917. v7 = f1
  11918. f1++
  11919. *(*uint8)(unsafe.Pointer(v7)) = *(*uint8)(unsafe.Pointer(s))
  11920. v8 = s
  11921. s++
  11922. *(*uint8)(unsafe.Pointer(v8)) = libc.Uint8FromInt32(tmp)
  11923. goto _6
  11924. _6:
  11925. ;
  11926. i--
  11927. v5 = i
  11928. if !(v5 != 0) {
  11929. break
  11930. }
  11931. }
  11932. f1 -= uintptr(size)
  11933. }
  11934. goto _3
  11935. _3:
  11936. ;
  11937. f1 += uintptr(size2)
  11938. if !(f1 < f2) {
  11939. break
  11940. }
  11941. }
  11942. } else { /* Natural merge */
  11943. l2 = f2
  11944. f2 = f1 + uintptr(size2)
  11945. for {
  11946. if !(f2 < l2) {
  11947. break
  11948. }
  11949. if libc.BoolInt32((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f2-uintptr(size), f2) > 0) != sense {
  11950. v10 = uintptr(int64(f2)-int64(list1)) + list2
  11951. *(*uintptr)(unsafe.Pointer(uintptr(libc.Uint64FromInt64(int64(p2+libc.UintptrFromInt64(8)-libc.UintptrFromInt32(1))-int64(libc.UintptrFromInt32(0))) & ^(libc.Uint64FromInt64(8) - libc.Uint64FromInt32(1))))) = v10
  11952. p2 = v10
  11953. if sense > 0 {
  11954. s = f2 - uintptr(size)
  11955. for cond := true; cond; cond = f1 < s {
  11956. i = libc.Int32FromUint64(size)
  11957. for {
  11958. tmp = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f1)))
  11959. v13 = f1
  11960. f1++
  11961. *(*uint8)(unsafe.Pointer(v13)) = *(*uint8)(unsafe.Pointer(s))
  11962. v14 = s
  11963. s++
  11964. *(*uint8)(unsafe.Pointer(v14)) = libc.Uint8FromInt32(tmp)
  11965. goto _12
  11966. _12:
  11967. ;
  11968. i--
  11969. v11 = i
  11970. if !(v11 != 0) {
  11971. break
  11972. }
  11973. }
  11974. s -= uintptr(size2)
  11975. }
  11976. }
  11977. f1 = f2
  11978. }
  11979. goto _9
  11980. _9:
  11981. ;
  11982. f2 += uintptr(size2)
  11983. }
  11984. if sense > 0 {
  11985. s = f2 - uintptr(size)
  11986. for cond := true; cond; cond = f1 < s {
  11987. i = libc.Int32FromUint64(size)
  11988. for {
  11989. tmp = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f1)))
  11990. v17 = f1
  11991. f1++
  11992. *(*uint8)(unsafe.Pointer(v17)) = *(*uint8)(unsafe.Pointer(s))
  11993. v18 = s
  11994. s++
  11995. *(*uint8)(unsafe.Pointer(v18)) = libc.Uint8FromInt32(tmp)
  11996. goto _16
  11997. _16:
  11998. ;
  11999. i--
  12000. v15 = i
  12001. if !(v15 != 0) {
  12002. break
  12003. }
  12004. }
  12005. s -= uintptr(size2)
  12006. }
  12007. }
  12008. f1 = f2
  12009. if f2 < last || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f2-uintptr(size), f2) > 0 {
  12010. v19 = uintptr(int64(f2)-int64(list1)) + list2
  12011. *(*uintptr)(unsafe.Pointer(uintptr(libc.Uint64FromInt64(int64(p2+libc.UintptrFromInt64(8)-libc.UintptrFromInt32(1))-int64(libc.UintptrFromInt32(0))) & ^(libc.Uint64FromInt64(8) - libc.Uint64FromInt32(1))))) = v19
  12012. p2 = v19
  12013. } else {
  12014. v20 = list2 + uintptr(n*size)
  12015. *(*uintptr)(unsafe.Pointer(uintptr(libc.Uint64FromInt64(int64(p2+libc.UintptrFromInt64(8)-libc.UintptrFromInt32(1))-int64(libc.UintptrFromInt32(0))) & ^(libc.Uint64FromInt64(8) - libc.Uint64FromInt32(1))))) = v20
  12016. p2 = v20
  12017. }
  12018. }
  12019. goto _1
  12020. _1:
  12021. ;
  12022. sense = libc.BoolInt32(!(sense != 0))
  12023. }
  12024. }
  12025. // C documentation
  12026. //
  12027. // /*
  12028. // * This is to avoid out-of-bounds addresses in sorting the
  12029. // * last 4 elements.
  12030. // */
  12031. func _insertionsort(tls *libc.TLS, a uintptr, n Tsize_t, size Tsize_t, cmp uintptr) {
  12032. var ai, s, t, u, v6, v7 uintptr
  12033. var i, v4 int32
  12034. var tmp uint8
  12035. var v2 Tsize_t
  12036. _, _, _, _, _, _, _, _, _, _ = ai, i, s, t, tmp, u, v2, v4, v6, v7
  12037. ai = a + uintptr(size)
  12038. for {
  12039. n--
  12040. v2 = n
  12041. if !(v2 >= uint64(1)) {
  12042. break
  12043. }
  12044. t = ai
  12045. for {
  12046. if !(t > a) {
  12047. break
  12048. }
  12049. u = t - uintptr(size)
  12050. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, u, t) <= 0 {
  12051. break
  12052. }
  12053. s = t
  12054. i = libc.Int32FromUint64(size)
  12055. for {
  12056. tmp = *(*uint8)(unsafe.Pointer(u))
  12057. v6 = u
  12058. u++
  12059. *(*uint8)(unsafe.Pointer(v6)) = *(*uint8)(unsafe.Pointer(s))
  12060. v7 = s
  12061. s++
  12062. *(*uint8)(unsafe.Pointer(v7)) = tmp
  12063. goto _5
  12064. _5:
  12065. ;
  12066. i--
  12067. v4 = i
  12068. if !(v4 != 0) {
  12069. break
  12070. }
  12071. }
  12072. u -= uintptr(size)
  12073. goto _3
  12074. _3:
  12075. ;
  12076. t -= uintptr(size)
  12077. }
  12078. goto _1
  12079. _1:
  12080. ;
  12081. ai += uintptr(size)
  12082. }
  12083. }
  12084. const m_SIZE = 512
  12085. const m_THRESHOLD1 = 20
  12086. type Tstack = struct {
  12087. Fsa uintptr
  12088. Fsn int32
  12089. Fsi int32
  12090. }
  12091. func Xradixsort(tls *libc.TLS, a uintptr, n int32, tab uintptr, endch uint32) (r int32) {
  12092. bp := tls.Alloc(256)
  12093. defer tls.Free(256)
  12094. var c uint32
  12095. var tr uintptr
  12096. var _ /* tr0 at bp+0 */ [256]uint8
  12097. _, _ = c, tr
  12098. if tab == libc.UintptrFromInt32(0) {
  12099. tr = bp
  12100. c = uint32(0)
  12101. for {
  12102. if !(c < endch) {
  12103. break
  12104. }
  12105. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(c + uint32(1))
  12106. goto _1
  12107. _1:
  12108. ;
  12109. c++
  12110. }
  12111. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(0)
  12112. c++
  12113. for {
  12114. if !(c < uint32(256)) {
  12115. break
  12116. }
  12117. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(c)
  12118. goto _2
  12119. _2:
  12120. ;
  12121. c++
  12122. }
  12123. endch = uint32(0)
  12124. } else {
  12125. endch = uint32(*(*uint8)(unsafe.Pointer(tab + uintptr(endch))))
  12126. tr = tab
  12127. if endch != uint32(0) && endch != uint32(255) {
  12128. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  12129. return -int32(1)
  12130. }
  12131. }
  12132. _r_sort_a(tls, a, n, 0, tr, endch)
  12133. return 0
  12134. }
  12135. func Xsradixsort(tls *libc.TLS, a uintptr, n int32, tab uintptr, endch uint32) (r int32) {
  12136. bp := tls.Alloc(256)
  12137. defer tls.Free(256)
  12138. var c uint32
  12139. var ta, tr uintptr
  12140. var _ /* tr0 at bp+0 */ [256]uint8
  12141. _, _, _ = c, ta, tr
  12142. if a == libc.UintptrFromInt32(0) {
  12143. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EFAULT)
  12144. return -int32(1)
  12145. }
  12146. if tab == libc.UintptrFromInt32(0) {
  12147. tr = bp
  12148. c = uint32(0)
  12149. for {
  12150. if !(c < endch) {
  12151. break
  12152. }
  12153. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(c + uint32(1))
  12154. goto _1
  12155. _1:
  12156. ;
  12157. c++
  12158. }
  12159. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(0)
  12160. c++
  12161. for {
  12162. if !(c < uint32(256)) {
  12163. break
  12164. }
  12165. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(c)
  12166. goto _2
  12167. _2:
  12168. ;
  12169. c++
  12170. }
  12171. endch = uint32(0)
  12172. } else {
  12173. endch = uint32(*(*uint8)(unsafe.Pointer(tab + uintptr(endch))))
  12174. tr = tab
  12175. if endch != uint32(0) && endch != uint32(255) {
  12176. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  12177. return -int32(1)
  12178. }
  12179. }
  12180. if n < int32(m_THRESHOLD1) {
  12181. _simplesort(tls, a, n, 0, tr, endch)
  12182. } else {
  12183. ta = Xreallocarray(tls, libc.UintptrFromInt32(0), libc.Uint64FromInt32(n), uint64(8))
  12184. if ta == libc.UintptrFromInt32(0) {
  12185. return -int32(1)
  12186. }
  12187. _r_sort_b(tls, a, ta, n, 0, tr, endch)
  12188. libc.Xfree(tls, ta)
  12189. }
  12190. return 0
  12191. }
  12192. // C documentation
  12193. //
  12194. // /* Unstable, in-place sort. */
  12195. func _r_sort_a(tls *libc.TLS, a uintptr, n int32, i int32, tr uintptr, endch uint32) {
  12196. bp := tls.Alloc(10240)
  12197. defer tls.Free(10240)
  12198. var aj, ak, an, cp, r, sp, sp0, sp1, t, v1, v10, v12, v15, v16, v17, v2, v4, v6, v7, v9 uintptr
  12199. var bigc, c, v18, v5, v8 uint32
  12200. var temp Tstack
  12201. var _ /* s at bp+0 */ [512]Tstack
  12202. var _ /* top at bp+8192 */ [256]uintptr
  12203. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  12204. /* Set up stack. */
  12205. sp = bp
  12206. (*Tstack)(unsafe.Pointer(sp)).Fsa = a
  12207. (*Tstack)(unsafe.Pointer(sp)).Fsn = n
  12208. v1 = sp
  12209. sp += 16
  12210. (*Tstack)(unsafe.Pointer(v1)).Fsi = i
  12211. for !(bp >= sp) {
  12212. sp -= 16
  12213. v2 = sp
  12214. a = (*Tstack)(unsafe.Pointer(v2)).Fsa
  12215. n = (*Tstack)(unsafe.Pointer(sp)).Fsn
  12216. i = (*Tstack)(unsafe.Pointer(sp)).Fsi
  12217. if n < int32(m_THRESHOLD1) {
  12218. _simplesort(tls, a, n, i, tr, endch)
  12219. continue
  12220. }
  12221. an = a + uintptr(n)*8
  12222. /* Make character histogram. */
  12223. if _nc == uint32(0) {
  12224. _bmin = uint32(255) /* First occupied bin, excluding eos. */
  12225. ak = a
  12226. for {
  12227. if !(ak < an) {
  12228. break
  12229. }
  12230. v4 = ak
  12231. ak += 8
  12232. c = uint32(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(v4)) + uintptr(i)))))))
  12233. v6 = uintptr(unsafe.Pointer(&_count)) + uintptr(c)*4
  12234. *(*uint32)(unsafe.Pointer(v6))++
  12235. v5 = *(*uint32)(unsafe.Pointer(v6))
  12236. if v5 == uint32(1) && c != endch {
  12237. if c < _bmin {
  12238. _bmin = c
  12239. }
  12240. _nc++
  12241. }
  12242. goto _3
  12243. _3:
  12244. }
  12245. if sp+uintptr(_nc)*16 > bp+uintptr(m_SIZE)*16 { /* Get more stack. */
  12246. _r_sort_a(tls, a, n, i, tr, endch)
  12247. continue
  12248. }
  12249. }
  12250. /*
  12251. * Special case: if all strings have the same
  12252. * character at position i, move on to the next
  12253. * character.
  12254. */
  12255. if _nc == uint32(1) && _count[_bmin] == libc.Uint32FromInt32(n) {
  12256. (*Tstack)(unsafe.Pointer(sp)).Fsa = a
  12257. (*Tstack)(unsafe.Pointer(sp)).Fsn = n
  12258. v7 = sp
  12259. sp += 16
  12260. (*Tstack)(unsafe.Pointer(v7)).Fsi = i + libc.Int32FromInt32(1)
  12261. v8 = libc.Uint32FromInt32(0)
  12262. _count[_bmin] = v8
  12263. _nc = v8
  12264. continue
  12265. }
  12266. /*
  12267. * Set top[]; push incompletely sorted bins onto stack.
  12268. * top[] = pointers to last out-of-place element in bins.
  12269. * count[] = counts of elements in bins.
  12270. * Before permuting: top[c-1] + count[c] = top[c];
  12271. * during deal: top[c] counts down to top[c-1].
  12272. */
  12273. v9 = sp
  12274. sp1 = v9
  12275. sp0 = v9 /* Stack position of biggest bin. */
  12276. bigc = uint32(2) /* Size of biggest bin. */
  12277. if endch == uint32(0) { /* Special case: set top[eos]. */
  12278. v10 = a + uintptr(_count[0])*8
  12279. ak = v10
  12280. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[0] = v10
  12281. } else {
  12282. ak = a
  12283. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[int32(255)] = an
  12284. }
  12285. cp = uintptr(unsafe.Pointer(&_count)) + uintptr(_bmin)*4
  12286. for {
  12287. if !(_nc > uint32(0)) {
  12288. break
  12289. }
  12290. for *(*uint32)(unsafe.Pointer(cp)) == uint32(0) { /* Find next non-empty pile. */
  12291. cp += 4
  12292. }
  12293. if *(*uint32)(unsafe.Pointer(cp)) > uint32(1) {
  12294. if *(*uint32)(unsafe.Pointer(cp)) > bigc {
  12295. bigc = *(*uint32)(unsafe.Pointer(cp))
  12296. sp1 = sp
  12297. }
  12298. (*Tstack)(unsafe.Pointer(sp)).Fsa = ak
  12299. (*Tstack)(unsafe.Pointer(sp)).Fsn = libc.Int32FromUint32(*(*uint32)(unsafe.Pointer(cp)))
  12300. v12 = sp
  12301. sp += 16
  12302. (*Tstack)(unsafe.Pointer(v12)).Fsi = i + libc.Int32FromInt32(1)
  12303. }
  12304. ak += uintptr(*(*uint32)(unsafe.Pointer(cp))) * 8
  12305. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[(int64(cp)-t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_count))))/4] = ak
  12306. _nc--
  12307. goto _11
  12308. _11:
  12309. ;
  12310. cp += 4
  12311. }
  12312. temp = *(*Tstack)(unsafe.Pointer(sp0))
  12313. *(*Tstack)(unsafe.Pointer(sp0)) = *(*Tstack)(unsafe.Pointer(sp1))
  12314. *(*Tstack)(unsafe.Pointer(sp1)) = temp /* Play it safe -- biggest bin last. */
  12315. /*
  12316. * Permute misplacements home. Already home: everything
  12317. * before aj, and in bin[c], items from top[c] on.
  12318. * Inner loop:
  12319. * r = next element to put in place;
  12320. * ak = top[r[i]] = location to put the next element.
  12321. * aj = bottom of 1st disordered bin.
  12322. * Outer loop:
  12323. * Once the 1st disordered bin is done, ie. aj >= ak,
  12324. * aj<-aj + count[c] connects the bins in a linked list;
  12325. * reset count[c].
  12326. */
  12327. aj = a
  12328. for {
  12329. if !(aj < an) {
  12330. break
  12331. }
  12332. r = *(*uintptr)(unsafe.Pointer(aj))
  12333. for {
  12334. v18 = uint32(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(r + uintptr(i)))))))
  12335. c = v18
  12336. v17 = bp + 8192 + uintptr(v18)*8
  12337. *(*uintptr)(unsafe.Pointer(v17)) -= 8
  12338. v16 = *(*uintptr)(unsafe.Pointer(v17))
  12339. v15 = v16
  12340. ak = v15
  12341. if !(aj < v15) {
  12342. break
  12343. }
  12344. t = *(*uintptr)(unsafe.Pointer(ak))
  12345. *(*uintptr)(unsafe.Pointer(ak)) = r
  12346. r = t
  12347. goto _14
  12348. _14:
  12349. }
  12350. goto _13
  12351. _13:
  12352. ;
  12353. *(*uintptr)(unsafe.Pointer(aj)) = r
  12354. aj += uintptr(_count[c]) * 8
  12355. _count[c] = libc.Uint32FromInt32(0)
  12356. }
  12357. }
  12358. }
  12359. var _count [256]uint32
  12360. var _nc uint32
  12361. var _bmin uint32
  12362. // C documentation
  12363. //
  12364. // /* Stable sort, requiring additional memory. */
  12365. func _r_sort_b(tls *libc.TLS, a uintptr, ta uintptr, n int32, i int32, tr uintptr, endch uint32) {
  12366. bp := tls.Alloc(10240)
  12367. defer tls.Free(10240)
  12368. var ai, ak, cp, sp, sp0, sp1, v1, v11, v13, v14, v16, v17, v18, v2, v4, v6, v7, v8 uintptr
  12369. var bigc, c, v10, v5 uint32
  12370. var temp Tstack
  12371. var _ /* s at bp+0 */ [512]Tstack
  12372. var _ /* top at bp+8192 */ [256]uintptr
  12373. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ai, ak, bigc, c, cp, sp, sp0, sp1, temp, v1, v10, v11, v13, v14, v16, v17, v18, v2, v4, v5, v6, v7, v8
  12374. sp = bp
  12375. (*Tstack)(unsafe.Pointer(sp)).Fsa = a
  12376. (*Tstack)(unsafe.Pointer(sp)).Fsn = n
  12377. v1 = sp
  12378. sp += 16
  12379. (*Tstack)(unsafe.Pointer(v1)).Fsi = i
  12380. for !(bp >= sp) {
  12381. sp -= 16
  12382. v2 = sp
  12383. a = (*Tstack)(unsafe.Pointer(v2)).Fsa
  12384. n = (*Tstack)(unsafe.Pointer(sp)).Fsn
  12385. i = (*Tstack)(unsafe.Pointer(sp)).Fsi
  12386. if n < int32(m_THRESHOLD1) {
  12387. _simplesort(tls, a, n, i, tr, endch)
  12388. continue
  12389. }
  12390. if _nc1 == uint32(0) {
  12391. _bmin1 = uint32(255)
  12392. ak = a + uintptr(n)*8
  12393. for {
  12394. ak -= 8
  12395. v4 = ak
  12396. if !(v4 >= a) {
  12397. break
  12398. }
  12399. c = uint32(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ak)) + uintptr(i)))))))
  12400. v6 = uintptr(unsafe.Pointer(&_count1)) + uintptr(c)*4
  12401. *(*uint32)(unsafe.Pointer(v6))++
  12402. v5 = *(*uint32)(unsafe.Pointer(v6))
  12403. if v5 == uint32(1) && c != endch {
  12404. if c < _bmin1 {
  12405. _bmin1 = c
  12406. }
  12407. _nc1++
  12408. }
  12409. goto _3
  12410. _3:
  12411. }
  12412. if sp+uintptr(_nc1)*16 > bp+uintptr(m_SIZE)*16 {
  12413. _r_sort_b(tls, a, ta, n, i, tr, endch)
  12414. continue
  12415. }
  12416. }
  12417. v7 = sp
  12418. sp1 = v7
  12419. sp0 = v7
  12420. bigc = uint32(2)
  12421. if endch == uint32(0) {
  12422. v8 = a + uintptr(_count1[0])*8
  12423. ak = v8
  12424. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[0] = v8
  12425. _count1[0] = uint32(0)
  12426. } else {
  12427. ak = a
  12428. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[int32(255)] = a + uintptr(n)*8
  12429. _count1[int32(255)] = uint32(0)
  12430. }
  12431. cp = uintptr(unsafe.Pointer(&_count1)) + uintptr(_bmin1)*4
  12432. for {
  12433. if !(_nc1 > uint32(0)) {
  12434. break
  12435. }
  12436. for *(*uint32)(unsafe.Pointer(cp)) == uint32(0) {
  12437. cp += 4
  12438. }
  12439. v10 = *(*uint32)(unsafe.Pointer(cp))
  12440. c = v10
  12441. if v10 > uint32(1) {
  12442. if c > bigc {
  12443. bigc = c
  12444. sp1 = sp
  12445. }
  12446. (*Tstack)(unsafe.Pointer(sp)).Fsa = ak
  12447. (*Tstack)(unsafe.Pointer(sp)).Fsn = libc.Int32FromUint32(c)
  12448. v11 = sp
  12449. sp += 16
  12450. (*Tstack)(unsafe.Pointer(v11)).Fsi = i + libc.Int32FromInt32(1)
  12451. }
  12452. ak += uintptr(c) * 8
  12453. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[(int64(cp)-t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_count1))))/4] = ak
  12454. *(*uint32)(unsafe.Pointer(cp)) = uint32(0) /* Reset count[]. */
  12455. _nc1--
  12456. goto _9
  12457. _9:
  12458. ;
  12459. cp += 4
  12460. }
  12461. temp = *(*Tstack)(unsafe.Pointer(sp0))
  12462. *(*Tstack)(unsafe.Pointer(sp0)) = *(*Tstack)(unsafe.Pointer(sp1))
  12463. *(*Tstack)(unsafe.Pointer(sp1)) = temp
  12464. ak = ta + uintptr(n)*8
  12465. ai = a + uintptr(n)*8
  12466. for {
  12467. if !(ak > ta) {
  12468. break
  12469. } /* Copy to temp. */
  12470. ak -= 8
  12471. v13 = ak
  12472. ai -= 8
  12473. v14 = ai
  12474. *(*uintptr)(unsafe.Pointer(v13)) = *(*uintptr)(unsafe.Pointer(v14))
  12475. goto _12
  12476. _12:
  12477. }
  12478. ak = ta + uintptr(n)*8
  12479. for {
  12480. ak -= 8
  12481. v16 = ak
  12482. if !(v16 >= ta) {
  12483. break
  12484. } /* Deal to piles. */
  12485. v18 = bp + 8192 + uintptr(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ak)) + uintptr(i)))))))*8
  12486. *(*uintptr)(unsafe.Pointer(v18)) -= 8
  12487. v17 = *(*uintptr)(unsafe.Pointer(v18))
  12488. *(*uintptr)(unsafe.Pointer(v17)) = *(*uintptr)(unsafe.Pointer(ak))
  12489. goto _15
  12490. _15:
  12491. }
  12492. }
  12493. }
  12494. var _count1 [256]uint32
  12495. var _nc1 uint32
  12496. var _bmin1 uint32
  12497. // C documentation
  12498. //
  12499. // /* insertion sort */
  12500. func _simplesort(tls *libc.TLS, a uintptr, n int32, b int32, tr uintptr, endch uint32) {
  12501. var ai, ak, s, t uintptr
  12502. var ch, v5 uint8
  12503. var v2 int32
  12504. _, _, _, _, _, _, _ = ai, ak, ch, s, t, v2, v5
  12505. ak = a + uintptr(1)*8
  12506. for {
  12507. n--
  12508. v2 = n
  12509. if !(v2 >= int32(1)) {
  12510. break
  12511. }
  12512. ai = ak
  12513. for {
  12514. if !(ai > a) {
  12515. break
  12516. }
  12517. s = *(*uintptr)(unsafe.Pointer(ai)) + uintptr(b)
  12518. t = *(*uintptr)(unsafe.Pointer(ai + uintptr(-libc.Int32FromInt32(1))*8)) + uintptr(b)
  12519. for {
  12520. v5 = *(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(s)))))
  12521. ch = v5
  12522. if !(uint32(v5) != endch) {
  12523. break
  12524. }
  12525. if libc.Int32FromUint8(ch) != libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(t)))))) {
  12526. break
  12527. }
  12528. goto _4
  12529. _4:
  12530. ;
  12531. s++
  12532. t++
  12533. }
  12534. if libc.Int32FromUint8(ch) >= libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(t)))))) {
  12535. break
  12536. }
  12537. s = *(*uintptr)(unsafe.Pointer(ai))
  12538. *(*uintptr)(unsafe.Pointer(ai)) = *(*uintptr)(unsafe.Pointer(ai + uintptr(-libc.Int32FromInt32(1))*8))
  12539. *(*uintptr)(unsafe.Pointer(ai + uintptr(-libc.Int32FromInt32(1))*8)) = s
  12540. goto _3
  12541. _3:
  12542. ;
  12543. ai -= 8
  12544. }
  12545. goto _1
  12546. _1:
  12547. ;
  12548. ak += 8
  12549. }
  12550. }
  12551. const m__SL_CHUNKSIZE = 20
  12552. type TStringList = struct {
  12553. Fsl_str uintptr
  12554. Fsl_max Tsize_t
  12555. Fsl_cur Tsize_t
  12556. }
  12557. type T_stringlist = TStringList
  12558. // C documentation
  12559. //
  12560. // /*
  12561. // * sl_init(): Initialize a string list
  12562. // */
  12563. func Xsl_init(tls *libc.TLS) (r uintptr) {
  12564. var sl uintptr
  12565. _ = sl
  12566. sl = libc.Xmalloc(tls, uint64(24))
  12567. if sl == libc.UintptrFromInt32(0) {
  12568. return libc.UintptrFromInt32(0)
  12569. }
  12570. (*TStringList)(unsafe.Pointer(sl)).Fsl_cur = uint64(0)
  12571. (*TStringList)(unsafe.Pointer(sl)).Fsl_max = uint64(m__SL_CHUNKSIZE)
  12572. (*TStringList)(unsafe.Pointer(sl)).Fsl_str = Xreallocarray(tls, libc.UintptrFromInt32(0), (*TStringList)(unsafe.Pointer(sl)).Fsl_max, uint64(8))
  12573. if (*TStringList)(unsafe.Pointer(sl)).Fsl_str == libc.UintptrFromInt32(0) {
  12574. libc.Xfree(tls, sl)
  12575. sl = libc.UintptrFromInt32(0)
  12576. }
  12577. return sl
  12578. }
  12579. // C documentation
  12580. //
  12581. // /*
  12582. // * sl_add(): Add an item to the string list
  12583. // */
  12584. func Xsl_add(tls *libc.TLS, sl uintptr, name uintptr) (r int32) {
  12585. var new1, v2 uintptr
  12586. var v1 Tsize_t
  12587. _, _, _ = new1, v1, v2
  12588. if (*TStringList)(unsafe.Pointer(sl)).Fsl_cur == (*TStringList)(unsafe.Pointer(sl)).Fsl_max-uint64(1) {
  12589. new1 = Xreallocarray(tls, (*TStringList)(unsafe.Pointer(sl)).Fsl_str, (*TStringList)(unsafe.Pointer(sl)).Fsl_max+libc.Uint64FromInt32(m__SL_CHUNKSIZE), uint64(8))
  12590. if new1 == libc.UintptrFromInt32(0) {
  12591. return -int32(1)
  12592. }
  12593. *(*Tsize_t)(unsafe.Pointer(sl + 8)) += uint64(m__SL_CHUNKSIZE)
  12594. (*TStringList)(unsafe.Pointer(sl)).Fsl_str = new1
  12595. }
  12596. v2 = sl + 16
  12597. v1 = *(*Tsize_t)(unsafe.Pointer(v2))
  12598. *(*Tsize_t)(unsafe.Pointer(v2))++
  12599. *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(v1)*8)) = name
  12600. return 0
  12601. }
  12602. // C documentation
  12603. //
  12604. // /*
  12605. // * sl_free(): Free a stringlist
  12606. // */
  12607. func Xsl_free(tls *libc.TLS, sl uintptr, all int32) {
  12608. var i Tsize_t
  12609. _ = i
  12610. if sl == libc.UintptrFromInt32(0) {
  12611. return
  12612. }
  12613. if (*TStringList)(unsafe.Pointer(sl)).Fsl_str != 0 {
  12614. if all != 0 {
  12615. i = uint64(0)
  12616. for {
  12617. if !(i < (*TStringList)(unsafe.Pointer(sl)).Fsl_cur) {
  12618. break
  12619. }
  12620. libc.Xfree(tls, *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*8)))
  12621. goto _1
  12622. _1:
  12623. ;
  12624. i++
  12625. }
  12626. }
  12627. libc.Xfree(tls, (*TStringList)(unsafe.Pointer(sl)).Fsl_str)
  12628. }
  12629. libc.Xfree(tls, sl)
  12630. }
  12631. // C documentation
  12632. //
  12633. // /*
  12634. // * sl_find(): Find a name in the string list
  12635. // */
  12636. func Xsl_find(tls *libc.TLS, sl uintptr, name uintptr) (r uintptr) {
  12637. var i Tsize_t
  12638. _ = i
  12639. i = uint64(0)
  12640. for {
  12641. if !(i < (*TStringList)(unsafe.Pointer(sl)).Fsl_cur) {
  12642. break
  12643. }
  12644. if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*8)), name) == 0 {
  12645. return *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*8))
  12646. }
  12647. goto _1
  12648. _1:
  12649. ;
  12650. i++
  12651. }
  12652. return libc.UintptrFromInt32(0)
  12653. }
  12654. func Xsl_delete(tls *libc.TLS, sl uintptr, name uintptr, all int32) (r int32) {
  12655. var i, j, v3 Tsize_t
  12656. var v4 uintptr
  12657. _, _, _, _ = i, j, v3, v4
  12658. i = uint64(0)
  12659. for {
  12660. if !(i < (*TStringList)(unsafe.Pointer(sl)).Fsl_cur) {
  12661. break
  12662. }
  12663. if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*8)), name) == 0 {
  12664. if all != 0 {
  12665. libc.Xfree(tls, *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*8)))
  12666. }
  12667. j = i + uint64(1)
  12668. for {
  12669. if !(j < (*TStringList)(unsafe.Pointer(sl)).Fsl_cur) {
  12670. break
  12671. }
  12672. *(*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))
  12673. goto _2
  12674. _2:
  12675. ;
  12676. j++
  12677. }
  12678. v4 = sl + 16
  12679. *(*Tsize_t)(unsafe.Pointer(v4))--
  12680. v3 = *(*Tsize_t)(unsafe.Pointer(v4))
  12681. *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(v3)*8)) = libc.UintptrFromInt32(0)
  12682. return 0
  12683. }
  12684. goto _1
  12685. _1:
  12686. ;
  12687. i++
  12688. }
  12689. return -int32(1)
  12690. }
  12691. // C documentation
  12692. //
  12693. // /*
  12694. // * Appends src to string dst of size dsize (unlike strncat, dsize is the
  12695. // * full size of dst, not space left). At most dsize-1 characters
  12696. // * will be copied. Always NUL terminates (unless dsize <= strlen(dst)).
  12697. // * Returns strlen(src) + MIN(dsize, strlen(initial dst)).
  12698. // * If retval >= dsize, truncation occurred.
  12699. // */
  12700. func Xstrlcat(tls *libc.TLS, dst uintptr, src uintptr, dsize Tsize_t) (r Tsize_t) {
  12701. var dlen, n, v1, v2 Tsize_t
  12702. var odst, osrc, v3 uintptr
  12703. _, _, _, _, _, _, _ = dlen, n, odst, osrc, v1, v2, v3
  12704. odst = dst
  12705. osrc = src
  12706. n = dsize
  12707. /* Find the end of dst and adjust bytes left but don't go past end. */
  12708. for {
  12709. v1 = n
  12710. n--
  12711. if !(v1 != uint64(0) && int32(*(*int8)(unsafe.Pointer(dst))) != int32('\000')) {
  12712. break
  12713. }
  12714. dst++
  12715. }
  12716. dlen = libc.Uint64FromInt64(int64(dst) - int64(odst))
  12717. n = dsize - dlen
  12718. v2 = n
  12719. n--
  12720. if v2 == uint64(0) {
  12721. return dlen + libc.Xstrlen(tls, src)
  12722. }
  12723. for int32(*(*int8)(unsafe.Pointer(src))) != int32('\000') {
  12724. if n != uint64(0) {
  12725. v3 = dst
  12726. dst++
  12727. *(*int8)(unsafe.Pointer(v3)) = *(*int8)(unsafe.Pointer(src))
  12728. n--
  12729. }
  12730. src++
  12731. }
  12732. *(*int8)(unsafe.Pointer(dst)) = int8('\000')
  12733. return dlen + libc.Uint64FromInt64(int64(src)-int64(osrc)) /* count does not include NUL */
  12734. }
  12735. // C documentation
  12736. //
  12737. // /*
  12738. // * Copy string src to buffer dst of size dsize. At most dsize-1
  12739. // * chars will be copied. Always NUL terminates (unless dsize == 0).
  12740. // * Returns strlen(src); if retval >= dsize, truncation occurred.
  12741. // */
  12742. func Xstrlcpy(tls *libc.TLS, dst uintptr, src uintptr, dsize Tsize_t) (r Tsize_t) {
  12743. var nleft, v1 Tsize_t
  12744. var osrc, v3, v4, v5 uintptr
  12745. var v2 int8
  12746. _, _, _, _, _, _, _ = nleft, osrc, v1, v2, v3, v4, v5
  12747. osrc = src
  12748. nleft = dsize
  12749. /* Copy as many bytes as will fit. */
  12750. if nleft != uint64(0) {
  12751. for {
  12752. nleft--
  12753. v1 = nleft
  12754. if !(v1 != uint64(0)) {
  12755. break
  12756. }
  12757. v3 = src
  12758. src++
  12759. v2 = *(*int8)(unsafe.Pointer(v3))
  12760. v4 = dst
  12761. dst++
  12762. *(*int8)(unsafe.Pointer(v4)) = v2
  12763. if int32(v2) == int32('\000') {
  12764. break
  12765. }
  12766. }
  12767. }
  12768. /* Not enough room in dst, add NUL and traverse rest of src. */
  12769. if nleft == uint64(0) {
  12770. if dsize != uint64(0) {
  12771. *(*int8)(unsafe.Pointer(dst)) = int8('\000')
  12772. } /* NUL-terminate dst */
  12773. for {
  12774. v5 = src
  12775. src++
  12776. if !(*(*int8)(unsafe.Pointer(v5)) != 0) {
  12777. break
  12778. }
  12779. }
  12780. }
  12781. return libc.Uint64FromInt64(int64(src) - int64(osrc) - libc.Int64FromInt32(1)) /* count does not include NUL */
  12782. }
  12783. const m_S_IFBLK1 = 24576
  12784. const m_S_IFCHR1 = 8192
  12785. const m_S_IFDIR2 = 16384
  12786. const m_S_IFIFO1 = 4096
  12787. const m_S_IFLNK1 = 40960
  12788. const m_S_IFMT1 = 61440
  12789. const m_S_IFREG1 = 32768
  12790. const m_S_IFSOCK1 = 49152
  12791. const m_S_IRGRP2 = 32
  12792. const m_S_IROTH2 = 4
  12793. const m_S_IRUSR2 = 256
  12794. const m_S_ISGID2 = 1024
  12795. const m_S_ISUID2 = 2048
  12796. const m_S_ISVTX2 = 512
  12797. const m_S_IWGRP2 = 16
  12798. const m_S_IWOTH2 = 2
  12799. const m_S_IWUSR2 = 128
  12800. const m_S_IXGRP2 = 8
  12801. const m_S_IXOTH2 = 1
  12802. const m_S_IXUSR2 = 64
  12803. func Xstrmode(tls *libc.TLS, mode Tmode_t, p uintptr) {
  12804. 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
  12805. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  12806. /* print type */
  12807. switch mode & libc.Uint32FromInt32(m_S_IFMT1) {
  12808. case uint32(m_S_IFDIR2): /* directory */
  12809. v1 = p
  12810. p++
  12811. *(*int8)(unsafe.Pointer(v1)) = int8('d')
  12812. case uint32(m_S_IFCHR1): /* character special */
  12813. v2 = p
  12814. p++
  12815. *(*int8)(unsafe.Pointer(v2)) = int8('c')
  12816. case uint32(m_S_IFBLK1): /* block special */
  12817. v3 = p
  12818. p++
  12819. *(*int8)(unsafe.Pointer(v3)) = int8('b')
  12820. case uint32(m_S_IFREG1): /* regular */
  12821. v4 = p
  12822. p++
  12823. *(*int8)(unsafe.Pointer(v4)) = int8('-')
  12824. case uint32(m_S_IFLNK1): /* symbolic link */
  12825. v5 = p
  12826. p++
  12827. *(*int8)(unsafe.Pointer(v5)) = int8('l')
  12828. case uint32(m_S_IFSOCK1): /* socket */
  12829. v6 = p
  12830. p++
  12831. *(*int8)(unsafe.Pointer(v6)) = int8('s')
  12832. case uint32(m_S_IFIFO1): /* fifo */
  12833. v7 = p
  12834. p++
  12835. *(*int8)(unsafe.Pointer(v7)) = int8('p')
  12836. default: /* unknown */
  12837. v8 = p
  12838. p++
  12839. *(*int8)(unsafe.Pointer(v8)) = int8('?')
  12840. break
  12841. }
  12842. /* usr */
  12843. if mode&uint32(m_S_IRUSR2) != 0 {
  12844. v9 = p
  12845. p++
  12846. *(*int8)(unsafe.Pointer(v9)) = int8('r')
  12847. } else {
  12848. v10 = p
  12849. p++
  12850. *(*int8)(unsafe.Pointer(v10)) = int8('-')
  12851. }
  12852. if mode&uint32(m_S_IWUSR2) != 0 {
  12853. v11 = p
  12854. p++
  12855. *(*int8)(unsafe.Pointer(v11)) = int8('w')
  12856. } else {
  12857. v12 = p
  12858. p++
  12859. *(*int8)(unsafe.Pointer(v12)) = int8('-')
  12860. }
  12861. switch mode & libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXUSR2)|libc.Int32FromInt32(m_S_ISUID2)) {
  12862. case uint32(0):
  12863. v13 = p
  12864. p++
  12865. *(*int8)(unsafe.Pointer(v13)) = int8('-')
  12866. case uint32(m_S_IXUSR2):
  12867. v14 = p
  12868. p++
  12869. *(*int8)(unsafe.Pointer(v14)) = int8('x')
  12870. case uint32(m_S_ISUID2):
  12871. v15 = p
  12872. p++
  12873. *(*int8)(unsafe.Pointer(v15)) = int8('S')
  12874. case libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXUSR2) | libc.Int32FromInt32(m_S_ISUID2)):
  12875. v16 = p
  12876. p++
  12877. *(*int8)(unsafe.Pointer(v16)) = int8('s')
  12878. break
  12879. }
  12880. /* group */
  12881. if mode&uint32(m_S_IRGRP2) != 0 {
  12882. v17 = p
  12883. p++
  12884. *(*int8)(unsafe.Pointer(v17)) = int8('r')
  12885. } else {
  12886. v18 = p
  12887. p++
  12888. *(*int8)(unsafe.Pointer(v18)) = int8('-')
  12889. }
  12890. if mode&uint32(m_S_IWGRP2) != 0 {
  12891. v19 = p
  12892. p++
  12893. *(*int8)(unsafe.Pointer(v19)) = int8('w')
  12894. } else {
  12895. v20 = p
  12896. p++
  12897. *(*int8)(unsafe.Pointer(v20)) = int8('-')
  12898. }
  12899. switch mode & libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXGRP2)|libc.Int32FromInt32(m_S_ISGID2)) {
  12900. case uint32(0):
  12901. v21 = p
  12902. p++
  12903. *(*int8)(unsafe.Pointer(v21)) = int8('-')
  12904. case uint32(m_S_IXGRP2):
  12905. v22 = p
  12906. p++
  12907. *(*int8)(unsafe.Pointer(v22)) = int8('x')
  12908. case uint32(m_S_ISGID2):
  12909. v23 = p
  12910. p++
  12911. *(*int8)(unsafe.Pointer(v23)) = int8('S')
  12912. case libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXGRP2) | libc.Int32FromInt32(m_S_ISGID2)):
  12913. v24 = p
  12914. p++
  12915. *(*int8)(unsafe.Pointer(v24)) = int8('s')
  12916. break
  12917. }
  12918. /* other */
  12919. if mode&uint32(m_S_IROTH2) != 0 {
  12920. v25 = p
  12921. p++
  12922. *(*int8)(unsafe.Pointer(v25)) = int8('r')
  12923. } else {
  12924. v26 = p
  12925. p++
  12926. *(*int8)(unsafe.Pointer(v26)) = int8('-')
  12927. }
  12928. if mode&uint32(m_S_IWOTH2) != 0 {
  12929. v27 = p
  12930. p++
  12931. *(*int8)(unsafe.Pointer(v27)) = int8('w')
  12932. } else {
  12933. v28 = p
  12934. p++
  12935. *(*int8)(unsafe.Pointer(v28)) = int8('-')
  12936. }
  12937. switch mode & libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXOTH2)|libc.Int32FromInt32(m_S_ISVTX2)) {
  12938. case uint32(0):
  12939. v29 = p
  12940. p++
  12941. *(*int8)(unsafe.Pointer(v29)) = int8('-')
  12942. case uint32(m_S_IXOTH2):
  12943. v30 = p
  12944. p++
  12945. *(*int8)(unsafe.Pointer(v30)) = int8('x')
  12946. case uint32(m_S_ISVTX2):
  12947. v31 = p
  12948. p++
  12949. *(*int8)(unsafe.Pointer(v31)) = int8('T')
  12950. case libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXOTH2) | libc.Int32FromInt32(m_S_ISVTX2)):
  12951. v32 = p
  12952. p++
  12953. *(*int8)(unsafe.Pointer(v32)) = int8('t')
  12954. break
  12955. }
  12956. v33 = p
  12957. p++
  12958. *(*int8)(unsafe.Pointer(v33)) = int8(' ') /* will be a '+' if ACL's implemented */
  12959. *(*int8)(unsafe.Pointer(p)) = int8('\000')
  12960. }
  12961. // C documentation
  12962. //
  12963. // /*
  12964. // * Find the first occurrence of find in s, where the search is limited to the
  12965. // * first slen characters of s.
  12966. // */
  12967. func Xstrnstr(tls *libc.TLS, s uintptr, find uintptr, slen Tsize_t) (r uintptr) {
  12968. var c, sc, v1, v4 int8
  12969. var len1, v3 Tsize_t
  12970. var v2, v5 uintptr
  12971. var v6 bool
  12972. _, _, _, _, _, _, _, _, _ = c, len1, sc, v1, v2, v3, v4, v5, v6
  12973. v2 = find
  12974. find++
  12975. v1 = *(*int8)(unsafe.Pointer(v2))
  12976. c = v1
  12977. if int32(v1) != int32('\000') {
  12978. len1 = libc.Xstrlen(tls, find)
  12979. for cond := true; cond; cond = libc.Xstrncmp(tls, s, find, len1) != 0 {
  12980. for cond := true; cond; cond = int32(sc) != int32(c) {
  12981. v3 = slen
  12982. slen--
  12983. if v6 = v3 < uint64(1); !v6 {
  12984. v5 = s
  12985. s++
  12986. v4 = *(*int8)(unsafe.Pointer(v5))
  12987. sc = v4
  12988. }
  12989. if v6 || int32(v4) == int32('\000') {
  12990. return libc.UintptrFromInt32(0)
  12991. }
  12992. }
  12993. if len1 > slen {
  12994. return libc.UintptrFromInt32(0)
  12995. }
  12996. }
  12997. s--
  12998. }
  12999. return s
  13000. }
  13001. const m_S_IFBLK2 = 0060000
  13002. const m_S_IFCHR2 = 0020000
  13003. const m_S_IFDIR3 = 0040000
  13004. const m_S_IFIFO2 = 0010000
  13005. const m_S_IFLNK2 = 0120000
  13006. const m_S_IFMT2 = 0170000
  13007. const m_S_IFREG2 = 0100000
  13008. const m_S_IFSOCK2 = 0140000
  13009. const m_S_IRGRP3 = 0040
  13010. const m_S_IROTH3 = 0004
  13011. const m_S_IRUSR3 = 0400
  13012. const m_S_ISGID3 = 02000
  13013. const m_S_ISUID3 = 04000
  13014. const m_S_ISVTX3 = 01000
  13015. const m_S_IWGRP3 = 0020
  13016. const m_S_IWOTH3 = 0002
  13017. const m_S_IWUSR3 = 0200
  13018. const m_S_IXGRP3 = 0010
  13019. const m_S_IXOTH3 = 0001
  13020. const m_S_IXUSR3 = 0100
  13021. func Xstrtonum(tls *libc.TLS, nptr uintptr, minval int64, maxval int64, errstr uintptr) (r int64) {
  13022. bp := tls.Alloc(32)
  13023. defer tls.Free(32)
  13024. var rv int64
  13025. var v1 uintptr
  13026. var _ /* e at bp+0 */ int32
  13027. var _ /* eptr at bp+16 */ uintptr
  13028. var _ /* resp at bp+8 */ uintptr
  13029. _, _ = rv, v1
  13030. if errstr == libc.UintptrFromInt32(0) {
  13031. errstr = bp + 8
  13032. }
  13033. if minval > maxval {
  13034. goto out
  13035. }
  13036. rv = Xstrtoi(tls, nptr, bp+16, int32(10), minval, maxval, bp)
  13037. switch *(*int32)(unsafe.Pointer(bp)) {
  13038. case 0:
  13039. *(*uintptr)(unsafe.Pointer(errstr)) = libc.UintptrFromInt32(0)
  13040. return rv
  13041. case int32(m_ECANCELED):
  13042. fallthrough
  13043. case int32(m_EOPNOTSUPP):
  13044. goto out
  13045. case int32(m_ERANGE):
  13046. if *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))) != 0 {
  13047. goto out
  13048. }
  13049. if rv == maxval {
  13050. v1 = __ccgo_ts + 441
  13051. } else {
  13052. v1 = __ccgo_ts + 451
  13053. }
  13054. *(*uintptr)(unsafe.Pointer(errstr)) = v1
  13055. return 0
  13056. default:
  13057. libc.Xabort(tls)
  13058. }
  13059. goto out
  13060. out:
  13061. ;
  13062. *(*uintptr)(unsafe.Pointer(errstr)) = __ccgo_ts + 461
  13063. return 0
  13064. }
  13065. func Xstrtoi(tls *libc.TLS, nptr uintptr, endptr uintptr, base int32, lo Tintmax_t, hi Tintmax_t, rstatus uintptr) (r Tintmax_t) {
  13066. bp := tls.Alloc(16)
  13067. defer tls.Free(16)
  13068. var im Tintmax_t
  13069. var serrno int32
  13070. var _ /* ep at bp+0 */ uintptr
  13071. var _ /* rep at bp+8 */ int32
  13072. _, _ = im, serrno
  13073. /* endptr may be NULL */
  13074. if endptr == libc.UintptrFromInt32(0) {
  13075. endptr = bp
  13076. }
  13077. if rstatus == libc.UintptrFromInt32(0) {
  13078. rstatus = bp + 8
  13079. }
  13080. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  13081. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  13082. im = libc.Xstrtoimax(tls, nptr, endptr, base)
  13083. *(*int32)(unsafe.Pointer(rstatus)) = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  13084. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  13085. /* No digits were found */
  13086. if *(*int32)(unsafe.Pointer(rstatus)) == 0 && nptr == *(*uintptr)(unsafe.Pointer(endptr)) {
  13087. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ECANCELED)
  13088. }
  13089. if im < lo {
  13090. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  13091. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ERANGE)
  13092. }
  13093. return lo
  13094. }
  13095. if im > hi {
  13096. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  13097. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ERANGE)
  13098. }
  13099. return hi
  13100. }
  13101. /* There are further characters after number */
  13102. if *(*int32)(unsafe.Pointer(rstatus)) == 0 && int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(endptr))))) != int32('\000') {
  13103. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_EOPNOTSUPP)
  13104. }
  13105. return im
  13106. }
  13107. func Xstrtou(tls *libc.TLS, nptr uintptr, endptr uintptr, base int32, lo Tuintmax_t, hi Tuintmax_t, rstatus uintptr) (r Tuintmax_t) {
  13108. bp := tls.Alloc(16)
  13109. defer tls.Free(16)
  13110. var im Tuintmax_t
  13111. var serrno int32
  13112. var _ /* ep at bp+0 */ uintptr
  13113. var _ /* rep at bp+8 */ int32
  13114. _, _ = im, serrno
  13115. /* endptr may be NULL */
  13116. if endptr == libc.UintptrFromInt32(0) {
  13117. endptr = bp
  13118. }
  13119. if rstatus == libc.UintptrFromInt32(0) {
  13120. rstatus = bp + 8
  13121. }
  13122. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  13123. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  13124. im = libc.Xstrtoumax(tls, nptr, endptr, base)
  13125. *(*int32)(unsafe.Pointer(rstatus)) = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  13126. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  13127. /* No digits were found */
  13128. if *(*int32)(unsafe.Pointer(rstatus)) == 0 && nptr == *(*uintptr)(unsafe.Pointer(endptr)) {
  13129. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ECANCELED)
  13130. }
  13131. if im < lo {
  13132. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  13133. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ERANGE)
  13134. }
  13135. return lo
  13136. }
  13137. if im > hi {
  13138. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  13139. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ERANGE)
  13140. }
  13141. return hi
  13142. }
  13143. /* There are further characters after number */
  13144. if *(*int32)(unsafe.Pointer(rstatus)) == 0 && int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(endptr))))) != int32('\000') {
  13145. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_EOPNOTSUPP)
  13146. }
  13147. return im
  13148. }
  13149. /*
  13150. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  13151. *
  13152. * Redistribution and use in source and binary forms, with or without
  13153. * modification, are permitted provided that the following conditions
  13154. * are met:
  13155. * 1. Redistributions of source code must retain the above copyright
  13156. * notice, this list of conditions and the following disclaimer.
  13157. * 2. Redistributions in binary form must reproduce the above copyright
  13158. * notice, this list of conditions and the following disclaimer in the
  13159. * documentation and/or other materials provided with the distribution.
  13160. * 3. The name of the author may not be used to endorse or promote products
  13161. * derived from this software without specific prior written permission.
  13162. *
  13163. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  13164. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  13165. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  13166. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  13167. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13168. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  13169. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  13170. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  13171. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  13172. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  13173. */
  13174. /*
  13175. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  13176. *
  13177. * Redistribution and use in source and binary forms, with or without
  13178. * modification, are permitted provided that the following conditions
  13179. * are met:
  13180. * 1. Redistributions of source code must retain the above copyright
  13181. * notice, this list of conditions and the following disclaimer.
  13182. * 2. Redistributions in binary form must reproduce the above copyright
  13183. * notice, this list of conditions and the following disclaimer in the
  13184. * documentation and/or other materials provided with the distribution.
  13185. * 3. The name of the author may not be used to endorse or promote products
  13186. * derived from this software without specific prior written permission.
  13187. *
  13188. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  13189. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  13190. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  13191. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  13192. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13193. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  13194. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  13195. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  13196. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  13197. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  13198. */
  13199. /* Clang expands this to 1 if an identifier is *not* reserved. */
  13200. /*
  13201. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  13202. * musl, try to handle this gracefully.
  13203. */
  13204. /* Copyright (C) 1992-2023 Free Software Foundation, Inc.
  13205. Copyright The GNU Toolchain Authors.
  13206. This file is part of the GNU C Library.
  13207. The GNU C Library is free software; you can redistribute it and/or
  13208. modify it under the terms of the GNU Lesser General Public
  13209. License as published by the Free Software Foundation; either
  13210. version 2.1 of the License, or (at your option) any later version.
  13211. The GNU C Library is distributed in the hope that it will be useful,
  13212. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13213. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13214. Lesser General Public License for more details.
  13215. You should have received a copy of the GNU Lesser General Public
  13216. License along with the GNU C Library; if not, see
  13217. <https://www.gnu.org/licenses/>. */
  13218. /*
  13219. * - enable time64 functions
  13220. * - symver libbsd<func>_time64 -> <func> 0.7
  13221. */
  13222. type Tlibbsd_time64_t = int64
  13223. func Xlibbsd_time32_to_time_time64(tls *libc.TLS, t32 Tint32_t) (r Tlibbsd_time64_t) {
  13224. return int64(t32)
  13225. }
  13226. func Xlibbsd_time_to_time32_time64(tls *libc.TLS, t Tlibbsd_time64_t) (r Tint32_t) {
  13227. return int32(t)
  13228. }
  13229. func Xlibbsd_time64_to_time_time64(tls *libc.TLS, t64 Tint64_t) (r Tlibbsd_time64_t) {
  13230. return t64
  13231. }
  13232. func Xlibbsd_time_to_time64_time64(tls *libc.TLS, t Tlibbsd_time64_t) (r Tint64_t) {
  13233. return t
  13234. }
  13235. func Xlibbsd_time_to_long_time64(tls *libc.TLS, t Tlibbsd_time64_t) (r int64) {
  13236. if uint64(8) == uint64(8) {
  13237. return Xlibbsd_time_to_time64_time64(tls, t)
  13238. }
  13239. return t
  13240. }
  13241. func Xlibbsd_long_to_time_time64(tls *libc.TLS, tlong int64) (r Tlibbsd_time64_t) {
  13242. if uint64(8) == uint64(4) {
  13243. return Xlibbsd_time32_to_time_time64(tls, int32(tlong))
  13244. }
  13245. return tlong
  13246. }
  13247. func Xlibbsd_time_to_int_time64(tls *libc.TLS, t Ttime_t) (r int32) {
  13248. if uint64(4) == uint64(8) {
  13249. return int32(Xlibbsd_time_to_time64_time64(tls, t))
  13250. }
  13251. return int32(t)
  13252. }
  13253. func Xlibbsd_int_to_time_time64(tls *libc.TLS, tint int32) (r Tlibbsd_time64_t) {
  13254. if uint64(4) == uint64(4) {
  13255. return Xlibbsd_time32_to_time_time64(tls, tint)
  13256. }
  13257. return int64(tint)
  13258. }
  13259. const m_S_AMP = 13
  13260. const m_S_CTRL = 4
  13261. const m_S_EATCRNL = 12
  13262. const m_S_GROUND = 0
  13263. const m_S_HEX = 7
  13264. const m_S_HEX1 = 8
  13265. const m_S_HEX2 = 9
  13266. const m_S_META = 2
  13267. const m_S_META1 = 3
  13268. const m_S_MIME1 = 10
  13269. const m_S_MIME2 = 11
  13270. const m_S_NUMBER = 14
  13271. const m_S_OCTAL2 = 5
  13272. const m_S_OCTAL3 = 6
  13273. const m_S_START = 1
  13274. const m_S_STRING = 15
  13275. const m_UNVIS_END = "_VIS_END"
  13276. const m_UNVIS_NOCHAR = 3
  13277. const m_UNVIS_VALID = 1
  13278. const m_UNVIS_VALIDPUSH = 2
  13279. const m_VIS_CSTYLE = 0x0002
  13280. const m_VIS_DQ = 0x8000
  13281. const m_VIS_GLOB = 0x1000
  13282. const m_VIS_HTTP1808 = 128
  13283. const m_VIS_HTTP1866 = 512
  13284. const m_VIS_HTTPSTYLE = 0x0080
  13285. const m_VIS_MIMESTYLE = 256
  13286. const m_VIS_NL = 0x0010
  13287. const m_VIS_NOESCAPE = 1024
  13288. const m_VIS_NOLOCALE = 0x4000
  13289. const m_VIS_NOSLASH = 0x0040
  13290. const m_VIS_OCTAL = 0x0001
  13291. const m_VIS_SAFE = 0x0020
  13292. const m_VIS_SHELL = 0x2000
  13293. const m_VIS_SP = 0x0004
  13294. const m_VIS_TAB = 0x0008
  13295. const m__VIS_END = 2048
  13296. /*
  13297. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  13298. *
  13299. * Redistribution and use in source and binary forms, with or without
  13300. * modification, are permitted provided that the following conditions
  13301. * are met:
  13302. * 1. Redistributions of source code must retain the above copyright
  13303. * notice, this list of conditions and the following disclaimer.
  13304. * 2. Redistributions in binary form must reproduce the above copyright
  13305. * notice, this list of conditions and the following disclaimer in the
  13306. * documentation and/or other materials provided with the distribution.
  13307. * 3. The name of the author may not be used to endorse or promote products
  13308. * derived from this software without specific prior written permission.
  13309. *
  13310. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  13311. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  13312. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  13313. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  13314. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13315. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  13316. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  13317. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  13318. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  13319. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  13320. */
  13321. /*
  13322. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  13323. *
  13324. * Redistribution and use in source and binary forms, with or without
  13325. * modification, are permitted provided that the following conditions
  13326. * are met:
  13327. * 1. Redistributions of source code must retain the above copyright
  13328. * notice, this list of conditions and the following disclaimer.
  13329. * 2. Redistributions in binary form must reproduce the above copyright
  13330. * notice, this list of conditions and the following disclaimer in the
  13331. * documentation and/or other materials provided with the distribution.
  13332. * 3. The name of the author may not be used to endorse or promote products
  13333. * derived from this software without specific prior written permission.
  13334. *
  13335. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  13336. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  13337. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  13338. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  13339. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13340. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  13341. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  13342. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  13343. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  13344. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  13345. */
  13346. /* Clang expands this to 1 if an identifier is *not* reserved. */
  13347. /*
  13348. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  13349. * musl, try to handle this gracefully.
  13350. */
  13351. /* Copyright (C) 1992-2023 Free Software Foundation, Inc.
  13352. Copyright The GNU Toolchain Authors.
  13353. This file is part of the GNU C Library.
  13354. The GNU C Library is free software; you can redistribute it and/or
  13355. modify it under the terms of the GNU Lesser General Public
  13356. License as published by the Free Software Foundation; either
  13357. version 2.1 of the License, or (at your option) any later version.
  13358. The GNU C Library is distributed in the hope that it will be useful,
  13359. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13360. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13361. Lesser General Public License for more details.
  13362. You should have received a copy of the GNU Lesser General Public
  13363. License along with the GNU C Library; if not, see
  13364. <https://www.gnu.org/licenses/>. */
  13365. /*
  13366. * decode driven by state machine
  13367. */
  13368. // C documentation
  13369. //
  13370. // /*
  13371. // * RFC 1866
  13372. // */
  13373. type Tnv = struct {
  13374. Fname [7]int8
  13375. Fvalue Tuint8_t
  13376. }
  13377. /*
  13378. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  13379. *
  13380. * Redistribution and use in source and binary forms, with or without
  13381. * modification, are permitted provided that the following conditions
  13382. * are met:
  13383. * 1. Redistributions of source code must retain the above copyright
  13384. * notice, this list of conditions and the following disclaimer.
  13385. * 2. Redistributions in binary form must reproduce the above copyright
  13386. * notice, this list of conditions and the following disclaimer in the
  13387. * documentation and/or other materials provided with the distribution.
  13388. * 3. The name of the author may not be used to endorse or promote products
  13389. * derived from this software without specific prior written permission.
  13390. *
  13391. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  13392. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  13393. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  13394. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  13395. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13396. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  13397. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  13398. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  13399. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  13400. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  13401. */
  13402. /*
  13403. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  13404. *
  13405. * Redistribution and use in source and binary forms, with or without
  13406. * modification, are permitted provided that the following conditions
  13407. * are met:
  13408. * 1. Redistributions of source code must retain the above copyright
  13409. * notice, this list of conditions and the following disclaimer.
  13410. * 2. Redistributions in binary form must reproduce the above copyright
  13411. * notice, this list of conditions and the following disclaimer in the
  13412. * documentation and/or other materials provided with the distribution.
  13413. * 3. The name of the author may not be used to endorse or promote products
  13414. * derived from this software without specific prior written permission.
  13415. *
  13416. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  13417. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  13418. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  13419. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  13420. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13421. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  13422. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  13423. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  13424. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  13425. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  13426. */
  13427. /* Clang expands this to 1 if an identifier is *not* reserved. */
  13428. /*
  13429. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  13430. * musl, try to handle this gracefully.
  13431. */
  13432. /* Copyright (C) 1992-2023 Free Software Foundation, Inc.
  13433. Copyright The GNU Toolchain Authors.
  13434. This file is part of the GNU C Library.
  13435. The GNU C Library is free software; you can redistribute it and/or
  13436. modify it under the terms of the GNU Lesser General Public
  13437. License as published by the Free Software Foundation; either
  13438. version 2.1 of the License, or (at your option) any later version.
  13439. The GNU C Library is distributed in the hope that it will be useful,
  13440. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13441. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13442. Lesser General Public License for more details.
  13443. You should have received a copy of the GNU Lesser General Public
  13444. License along with the GNU C Library; if not, see
  13445. <https://www.gnu.org/licenses/>. */
  13446. /*
  13447. * decode driven by state machine
  13448. */
  13449. // C documentation
  13450. //
  13451. // /*
  13452. // * RFC 1866
  13453. // */
  13454. var _nv = [100]Tnv{
  13455. 0: {
  13456. Fname: [7]int8{'A', 'E', 'l', 'i', 'g'},
  13457. Fvalue: uint8(198),
  13458. },
  13459. 1: {
  13460. Fname: [7]int8{'A', 'a', 'c', 'u', 't', 'e'},
  13461. Fvalue: uint8(193),
  13462. },
  13463. 2: {
  13464. Fname: [7]int8{'A', 'c', 'i', 'r', 'c'},
  13465. Fvalue: uint8(194),
  13466. },
  13467. 3: {
  13468. Fname: [7]int8{'A', 'g', 'r', 'a', 'v', 'e'},
  13469. Fvalue: uint8(192),
  13470. },
  13471. 4: {
  13472. Fname: [7]int8{'A', 'r', 'i', 'n', 'g'},
  13473. Fvalue: uint8(197),
  13474. },
  13475. 5: {
  13476. Fname: [7]int8{'A', 't', 'i', 'l', 'd', 'e'},
  13477. Fvalue: uint8(195),
  13478. },
  13479. 6: {
  13480. Fname: [7]int8{'A', 'u', 'm', 'l'},
  13481. Fvalue: uint8(196),
  13482. },
  13483. 7: {
  13484. Fname: [7]int8{'C', 'c', 'e', 'd', 'i', 'l'},
  13485. Fvalue: uint8(199),
  13486. },
  13487. 8: {
  13488. Fname: [7]int8{'E', 'T', 'H'},
  13489. Fvalue: uint8(208),
  13490. },
  13491. 9: {
  13492. Fname: [7]int8{'E', 'a', 'c', 'u', 't', 'e'},
  13493. Fvalue: uint8(201),
  13494. },
  13495. 10: {
  13496. Fname: [7]int8{'E', 'c', 'i', 'r', 'c'},
  13497. Fvalue: uint8(202),
  13498. },
  13499. 11: {
  13500. Fname: [7]int8{'E', 'g', 'r', 'a', 'v', 'e'},
  13501. Fvalue: uint8(200),
  13502. },
  13503. 12: {
  13504. Fname: [7]int8{'E', 'u', 'm', 'l'},
  13505. Fvalue: uint8(203),
  13506. },
  13507. 13: {
  13508. Fname: [7]int8{'I', 'a', 'c', 'u', 't', 'e'},
  13509. Fvalue: uint8(205),
  13510. },
  13511. 14: {
  13512. Fname: [7]int8{'I', 'c', 'i', 'r', 'c'},
  13513. Fvalue: uint8(206),
  13514. },
  13515. 15: {
  13516. Fname: [7]int8{'I', 'g', 'r', 'a', 'v', 'e'},
  13517. Fvalue: uint8(204),
  13518. },
  13519. 16: {
  13520. Fname: [7]int8{'I', 'u', 'm', 'l'},
  13521. Fvalue: uint8(207),
  13522. },
  13523. 17: {
  13524. Fname: [7]int8{'N', 't', 'i', 'l', 'd', 'e'},
  13525. Fvalue: uint8(209),
  13526. },
  13527. 18: {
  13528. Fname: [7]int8{'O', 'a', 'c', 'u', 't', 'e'},
  13529. Fvalue: uint8(211),
  13530. },
  13531. 19: {
  13532. Fname: [7]int8{'O', 'c', 'i', 'r', 'c'},
  13533. Fvalue: uint8(212),
  13534. },
  13535. 20: {
  13536. Fname: [7]int8{'O', 'g', 'r', 'a', 'v', 'e'},
  13537. Fvalue: uint8(210),
  13538. },
  13539. 21: {
  13540. Fname: [7]int8{'O', 's', 'l', 'a', 's', 'h'},
  13541. Fvalue: uint8(216),
  13542. },
  13543. 22: {
  13544. Fname: [7]int8{'O', 't', 'i', 'l', 'd', 'e'},
  13545. Fvalue: uint8(213),
  13546. },
  13547. 23: {
  13548. Fname: [7]int8{'O', 'u', 'm', 'l'},
  13549. Fvalue: uint8(214),
  13550. },
  13551. 24: {
  13552. Fname: [7]int8{'T', 'H', 'O', 'R', 'N'},
  13553. Fvalue: uint8(222),
  13554. },
  13555. 25: {
  13556. Fname: [7]int8{'U', 'a', 'c', 'u', 't', 'e'},
  13557. Fvalue: uint8(218),
  13558. },
  13559. 26: {
  13560. Fname: [7]int8{'U', 'c', 'i', 'r', 'c'},
  13561. Fvalue: uint8(219),
  13562. },
  13563. 27: {
  13564. Fname: [7]int8{'U', 'g', 'r', 'a', 'v', 'e'},
  13565. Fvalue: uint8(217),
  13566. },
  13567. 28: {
  13568. Fname: [7]int8{'U', 'u', 'm', 'l'},
  13569. Fvalue: uint8(220),
  13570. },
  13571. 29: {
  13572. Fname: [7]int8{'Y', 'a', 'c', 'u', 't', 'e'},
  13573. Fvalue: uint8(221),
  13574. },
  13575. 30: {
  13576. Fname: [7]int8{'a', 'a', 'c', 'u', 't', 'e'},
  13577. Fvalue: uint8(225),
  13578. },
  13579. 31: {
  13580. Fname: [7]int8{'a', 'c', 'i', 'r', 'c'},
  13581. Fvalue: uint8(226),
  13582. },
  13583. 32: {
  13584. Fname: [7]int8{'a', 'c', 'u', 't', 'e'},
  13585. Fvalue: uint8(180),
  13586. },
  13587. 33: {
  13588. Fname: [7]int8{'a', 'e', 'l', 'i', 'g'},
  13589. Fvalue: uint8(230),
  13590. },
  13591. 34: {
  13592. Fname: [7]int8{'a', 'g', 'r', 'a', 'v', 'e'},
  13593. Fvalue: uint8(224),
  13594. },
  13595. 35: {
  13596. Fname: [7]int8{'a', 'm', 'p'},
  13597. Fvalue: uint8(38),
  13598. },
  13599. 36: {
  13600. Fname: [7]int8{'a', 'r', 'i', 'n', 'g'},
  13601. Fvalue: uint8(229),
  13602. },
  13603. 37: {
  13604. Fname: [7]int8{'a', 't', 'i', 'l', 'd', 'e'},
  13605. Fvalue: uint8(227),
  13606. },
  13607. 38: {
  13608. Fname: [7]int8{'a', 'u', 'm', 'l'},
  13609. Fvalue: uint8(228),
  13610. },
  13611. 39: {
  13612. Fname: [7]int8{'b', 'r', 'v', 'b', 'a', 'r'},
  13613. Fvalue: uint8(166),
  13614. },
  13615. 40: {
  13616. Fname: [7]int8{'c', 'c', 'e', 'd', 'i', 'l'},
  13617. Fvalue: uint8(231),
  13618. },
  13619. 41: {
  13620. Fname: [7]int8{'c', 'e', 'd', 'i', 'l'},
  13621. Fvalue: uint8(184),
  13622. },
  13623. 42: {
  13624. Fname: [7]int8{'c', 'e', 'n', 't'},
  13625. Fvalue: uint8(162),
  13626. },
  13627. 43: {
  13628. Fname: [7]int8{'c', 'o', 'p', 'y'},
  13629. Fvalue: uint8(169),
  13630. },
  13631. 44: {
  13632. Fname: [7]int8{'c', 'u', 'r', 'r', 'e', 'n'},
  13633. Fvalue: uint8(164),
  13634. },
  13635. 45: {
  13636. Fname: [7]int8{'d', 'e', 'g'},
  13637. Fvalue: uint8(176),
  13638. },
  13639. 46: {
  13640. Fname: [7]int8{'d', 'i', 'v', 'i', 'd', 'e'},
  13641. Fvalue: uint8(247),
  13642. },
  13643. 47: {
  13644. Fname: [7]int8{'e', 'a', 'c', 'u', 't', 'e'},
  13645. Fvalue: uint8(233),
  13646. },
  13647. 48: {
  13648. Fname: [7]int8{'e', 'c', 'i', 'r', 'c'},
  13649. Fvalue: uint8(234),
  13650. },
  13651. 49: {
  13652. Fname: [7]int8{'e', 'g', 'r', 'a', 'v', 'e'},
  13653. Fvalue: uint8(232),
  13654. },
  13655. 50: {
  13656. Fname: [7]int8{'e', 't', 'h'},
  13657. Fvalue: uint8(240),
  13658. },
  13659. 51: {
  13660. Fname: [7]int8{'e', 'u', 'm', 'l'},
  13661. Fvalue: uint8(235),
  13662. },
  13663. 52: {
  13664. Fname: [7]int8{'f', 'r', 'a', 'c', '1', '2'},
  13665. Fvalue: uint8(189),
  13666. },
  13667. 53: {
  13668. Fname: [7]int8{'f', 'r', 'a', 'c', '1', '4'},
  13669. Fvalue: uint8(188),
  13670. },
  13671. 54: {
  13672. Fname: [7]int8{'f', 'r', 'a', 'c', '3', '4'},
  13673. Fvalue: uint8(190),
  13674. },
  13675. 55: {
  13676. Fname: [7]int8{'g', 't'},
  13677. Fvalue: uint8(62),
  13678. },
  13679. 56: {
  13680. Fname: [7]int8{'i', 'a', 'c', 'u', 't', 'e'},
  13681. Fvalue: uint8(237),
  13682. },
  13683. 57: {
  13684. Fname: [7]int8{'i', 'c', 'i', 'r', 'c'},
  13685. Fvalue: uint8(238),
  13686. },
  13687. 58: {
  13688. Fname: [7]int8{'i', 'e', 'x', 'c', 'l'},
  13689. Fvalue: uint8(161),
  13690. },
  13691. 59: {
  13692. Fname: [7]int8{'i', 'g', 'r', 'a', 'v', 'e'},
  13693. Fvalue: uint8(236),
  13694. },
  13695. 60: {
  13696. Fname: [7]int8{'i', 'q', 'u', 'e', 's', 't'},
  13697. Fvalue: uint8(191),
  13698. },
  13699. 61: {
  13700. Fname: [7]int8{'i', 'u', 'm', 'l'},
  13701. Fvalue: uint8(239),
  13702. },
  13703. 62: {
  13704. Fname: [7]int8{'l', 'a', 'q', 'u', 'o'},
  13705. Fvalue: uint8(171),
  13706. },
  13707. 63: {
  13708. Fname: [7]int8{'l', 't'},
  13709. Fvalue: uint8(60),
  13710. },
  13711. 64: {
  13712. Fname: [7]int8{'m', 'a', 'c', 'r'},
  13713. Fvalue: uint8(175),
  13714. },
  13715. 65: {
  13716. Fname: [7]int8{'m', 'i', 'c', 'r', 'o'},
  13717. Fvalue: uint8(181),
  13718. },
  13719. 66: {
  13720. Fname: [7]int8{'m', 'i', 'd', 'd', 'o', 't'},
  13721. Fvalue: uint8(183),
  13722. },
  13723. 67: {
  13724. Fname: [7]int8{'n', 'b', 's', 'p'},
  13725. Fvalue: uint8(160),
  13726. },
  13727. 68: {
  13728. Fname: [7]int8{'n', 'o', 't'},
  13729. Fvalue: uint8(172),
  13730. },
  13731. 69: {
  13732. Fname: [7]int8{'n', 't', 'i', 'l', 'd', 'e'},
  13733. Fvalue: uint8(241),
  13734. },
  13735. 70: {
  13736. Fname: [7]int8{'o', 'a', 'c', 'u', 't', 'e'},
  13737. Fvalue: uint8(243),
  13738. },
  13739. 71: {
  13740. Fname: [7]int8{'o', 'c', 'i', 'r', 'c'},
  13741. Fvalue: uint8(244),
  13742. },
  13743. 72: {
  13744. Fname: [7]int8{'o', 'g', 'r', 'a', 'v', 'e'},
  13745. Fvalue: uint8(242),
  13746. },
  13747. 73: {
  13748. Fname: [7]int8{'o', 'r', 'd', 'f'},
  13749. Fvalue: uint8(170),
  13750. },
  13751. 74: {
  13752. Fname: [7]int8{'o', 'r', 'd', 'm'},
  13753. Fvalue: uint8(186),
  13754. },
  13755. 75: {
  13756. Fname: [7]int8{'o', 's', 'l', 'a', 's', 'h'},
  13757. Fvalue: uint8(248),
  13758. },
  13759. 76: {
  13760. Fname: [7]int8{'o', 't', 'i', 'l', 'd', 'e'},
  13761. Fvalue: uint8(245),
  13762. },
  13763. 77: {
  13764. Fname: [7]int8{'o', 'u', 'm', 'l'},
  13765. Fvalue: uint8(246),
  13766. },
  13767. 78: {
  13768. Fname: [7]int8{'p', 'a', 'r', 'a'},
  13769. Fvalue: uint8(182),
  13770. },
  13771. 79: {
  13772. Fname: [7]int8{'p', 'l', 'u', 's', 'm', 'n'},
  13773. Fvalue: uint8(177),
  13774. },
  13775. 80: {
  13776. Fname: [7]int8{'p', 'o', 'u', 'n', 'd'},
  13777. Fvalue: uint8(163),
  13778. },
  13779. 81: {
  13780. Fname: [7]int8{'q', 'u', 'o', 't'},
  13781. Fvalue: uint8(34),
  13782. },
  13783. 82: {
  13784. Fname: [7]int8{'r', 'a', 'q', 'u', 'o'},
  13785. Fvalue: uint8(187),
  13786. },
  13787. 83: {
  13788. Fname: [7]int8{'r', 'e', 'g'},
  13789. Fvalue: uint8(174),
  13790. },
  13791. 84: {
  13792. Fname: [7]int8{'s', 'e', 'c', 't'},
  13793. Fvalue: uint8(167),
  13794. },
  13795. 85: {
  13796. Fname: [7]int8{'s', 'h', 'y'},
  13797. Fvalue: uint8(173),
  13798. },
  13799. 86: {
  13800. Fname: [7]int8{'s', 'u', 'p', '1'},
  13801. Fvalue: uint8(185),
  13802. },
  13803. 87: {
  13804. Fname: [7]int8{'s', 'u', 'p', '2'},
  13805. Fvalue: uint8(178),
  13806. },
  13807. 88: {
  13808. Fname: [7]int8{'s', 'u', 'p', '3'},
  13809. Fvalue: uint8(179),
  13810. },
  13811. 89: {
  13812. Fname: [7]int8{'s', 'z', 'l', 'i', 'g'},
  13813. Fvalue: uint8(223),
  13814. },
  13815. 90: {
  13816. Fname: [7]int8{'t', 'h', 'o', 'r', 'n'},
  13817. Fvalue: uint8(254),
  13818. },
  13819. 91: {
  13820. Fname: [7]int8{'t', 'i', 'm', 'e', 's'},
  13821. Fvalue: uint8(215),
  13822. },
  13823. 92: {
  13824. Fname: [7]int8{'u', 'a', 'c', 'u', 't', 'e'},
  13825. Fvalue: uint8(250),
  13826. },
  13827. 93: {
  13828. Fname: [7]int8{'u', 'c', 'i', 'r', 'c'},
  13829. Fvalue: uint8(251),
  13830. },
  13831. 94: {
  13832. Fname: [7]int8{'u', 'g', 'r', 'a', 'v', 'e'},
  13833. Fvalue: uint8(249),
  13834. },
  13835. 95: {
  13836. Fname: [7]int8{'u', 'm', 'l'},
  13837. Fvalue: uint8(168),
  13838. },
  13839. 96: {
  13840. Fname: [7]int8{'u', 'u', 'm', 'l'},
  13841. Fvalue: uint8(252),
  13842. },
  13843. 97: {
  13844. Fname: [7]int8{'y', 'a', 'c', 'u', 't', 'e'},
  13845. Fvalue: uint8(253),
  13846. },
  13847. 98: {
  13848. Fname: [7]int8{'y', 'e', 'n'},
  13849. Fvalue: uint8(165),
  13850. },
  13851. 99: {
  13852. Fname: [7]int8{'y', 'u', 'm', 'l'},
  13853. Fvalue: uint8(255),
  13854. },
  13855. }
  13856. // C documentation
  13857. //
  13858. // /*
  13859. // * unvis - decode characters previously encoded by vis
  13860. // */
  13861. func Xunvis(tls *libc.TLS, cp uintptr, c int32, astate uintptr, flag int32) (r int32) {
  13862. var ia, is, lc, st, uc uint8
  13863. var v22, v23, v24, v25, v26 int32
  13864. var p19, p20, p21, p28 uintptr
  13865. _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ia, is, lc, st, uc, v22, v23, v24, v25, v26, p19, p20, p21, p28
  13866. uc = libc.Uint8FromInt32(c)
  13867. /*
  13868. * Bottom 8 bits of astate hold the state machine state.
  13869. * Top 8 bits hold the current character in the http 1866 nv string decoding
  13870. */
  13871. st = libc.Uint8FromInt32(*(*int32)(unsafe.Pointer(astate)) & libc.Int32FromInt32(0xff))
  13872. if flag&int32(m__VIS_END) != 0 {
  13873. switch libc.Int32FromUint8(st) {
  13874. case int32(m_S_OCTAL2):
  13875. fallthrough
  13876. case int32(m_S_OCTAL3):
  13877. fallthrough
  13878. case int32(m_S_HEX2):
  13879. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13880. return int32(m_UNVIS_VALID)
  13881. case m_S_GROUND:
  13882. return int32(m_UNVIS_NOCHAR)
  13883. default:
  13884. return -int32(1)
  13885. }
  13886. }
  13887. switch libc.Int32FromUint8(st) {
  13888. case m_S_GROUND:
  13889. goto _1
  13890. case int32(m_S_START):
  13891. goto _2
  13892. case int32(m_S_META):
  13893. goto _3
  13894. case int32(m_S_META1):
  13895. goto _4
  13896. case int32(m_S_CTRL):
  13897. goto _5
  13898. case int32(m_S_OCTAL2):
  13899. goto _6
  13900. case int32(m_S_OCTAL3):
  13901. goto _7
  13902. case int32(m_S_HEX):
  13903. goto _8
  13904. case int32(m_S_HEX1):
  13905. goto _9
  13906. case int32(m_S_HEX2):
  13907. goto _10
  13908. case int32(m_S_MIME1):
  13909. goto _11
  13910. case int32(m_S_MIME2):
  13911. goto _12
  13912. case int32(m_S_EATCRNL):
  13913. goto _13
  13914. case int32(m_S_AMP):
  13915. goto _14
  13916. case int32(m_S_STRING):
  13917. goto _15
  13918. case int32(m_S_NUMBER):
  13919. goto _16
  13920. default:
  13921. goto _17
  13922. }
  13923. goto _18
  13924. _1:
  13925. ;
  13926. *(*int8)(unsafe.Pointer(cp)) = 0
  13927. if flag&int32(m_VIS_NOESCAPE) == 0 && c == int32('\\') {
  13928. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_START)))
  13929. return int32(m_UNVIS_NOCHAR)
  13930. }
  13931. if flag&int32(m_VIS_HTTP1808) != 0 && c == int32('%') {
  13932. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_HEX1)))
  13933. return int32(m_UNVIS_NOCHAR)
  13934. }
  13935. if flag&int32(m_VIS_HTTP1866) != 0 && c == int32('&') {
  13936. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_AMP)))
  13937. return int32(m_UNVIS_NOCHAR)
  13938. }
  13939. if flag&int32(m_VIS_MIMESTYLE) != 0 && c == int32('=') {
  13940. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_MIME1)))
  13941. return int32(m_UNVIS_NOCHAR)
  13942. }
  13943. *(*int8)(unsafe.Pointer(cp)) = int8(c)
  13944. return int32(m_UNVIS_VALID)
  13945. _2:
  13946. ;
  13947. switch c {
  13948. case int32('\\'):
  13949. *(*int8)(unsafe.Pointer(cp)) = int8(c)
  13950. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13951. return int32(m_UNVIS_VALID)
  13952. case int32('0'):
  13953. fallthrough
  13954. case int32('1'):
  13955. fallthrough
  13956. case int32('2'):
  13957. fallthrough
  13958. case int32('3'):
  13959. fallthrough
  13960. case int32('4'):
  13961. fallthrough
  13962. case int32('5'):
  13963. fallthrough
  13964. case int32('6'):
  13965. fallthrough
  13966. case int32('7'):
  13967. *(*int8)(unsafe.Pointer(cp)) = int8(c - libc.Int32FromUint8('0'))
  13968. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_OCTAL2)))
  13969. return int32(m_UNVIS_NOCHAR)
  13970. case int32('M'):
  13971. *(*int8)(unsafe.Pointer(cp)) = libc.Int8FromInt32(0200)
  13972. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_META)))
  13973. return int32(m_UNVIS_NOCHAR)
  13974. case int32('^'):
  13975. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_CTRL)))
  13976. return int32(m_UNVIS_NOCHAR)
  13977. case int32('n'):
  13978. *(*int8)(unsafe.Pointer(cp)) = int8('\n')
  13979. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13980. return int32(m_UNVIS_VALID)
  13981. case int32('r'):
  13982. *(*int8)(unsafe.Pointer(cp)) = int8('\r')
  13983. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13984. return int32(m_UNVIS_VALID)
  13985. case int32('b'):
  13986. *(*int8)(unsafe.Pointer(cp)) = int8('\b')
  13987. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13988. return int32(m_UNVIS_VALID)
  13989. case int32('a'):
  13990. *(*int8)(unsafe.Pointer(cp)) = int8('\007')
  13991. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13992. return int32(m_UNVIS_VALID)
  13993. case int32('v'):
  13994. *(*int8)(unsafe.Pointer(cp)) = int8('\v')
  13995. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13996. return int32(m_UNVIS_VALID)
  13997. case int32('t'):
  13998. *(*int8)(unsafe.Pointer(cp)) = int8('\t')
  13999. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14000. return int32(m_UNVIS_VALID)
  14001. case int32('f'):
  14002. *(*int8)(unsafe.Pointer(cp)) = int8('\f')
  14003. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14004. return int32(m_UNVIS_VALID)
  14005. case int32('s'):
  14006. *(*int8)(unsafe.Pointer(cp)) = int8(' ')
  14007. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14008. return int32(m_UNVIS_VALID)
  14009. case int32('E'):
  14010. *(*int8)(unsafe.Pointer(cp)) = int8('\033')
  14011. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14012. return int32(m_UNVIS_VALID)
  14013. case int32('x'):
  14014. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_HEX)))
  14015. return int32(m_UNVIS_NOCHAR)
  14016. case int32('\n'):
  14017. /*
  14018. * hidden newline
  14019. */
  14020. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14021. return int32(m_UNVIS_NOCHAR)
  14022. case int32('$'):
  14023. /*
  14024. * hidden marker
  14025. */
  14026. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14027. return int32(m_UNVIS_NOCHAR)
  14028. default:
  14029. if libc.BoolInt32(libc.Uint32FromInt32(c)-uint32(0x21) < uint32(0x5e)) != 0 {
  14030. *(*int8)(unsafe.Pointer(cp)) = int8(c)
  14031. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14032. return int32(m_UNVIS_VALID)
  14033. }
  14034. }
  14035. goto bad
  14036. _3:
  14037. ;
  14038. if c == int32('-') {
  14039. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_META1)))
  14040. } else {
  14041. if c == int32('^') {
  14042. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_CTRL)))
  14043. } else {
  14044. goto bad
  14045. }
  14046. }
  14047. return int32(m_UNVIS_NOCHAR)
  14048. _4:
  14049. ;
  14050. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14051. p19 = cp
  14052. *(*int8)(unsafe.Pointer(p19)) = int8(int32(*(*int8)(unsafe.Pointer(p19))) | c)
  14053. return int32(m_UNVIS_VALID)
  14054. _5:
  14055. ;
  14056. if c == int32('?') {
  14057. p20 = cp
  14058. *(*int8)(unsafe.Pointer(p20)) = int8(int32(*(*int8)(unsafe.Pointer(p20))) | libc.Int32FromInt32(0177))
  14059. } else {
  14060. p21 = cp
  14061. *(*int8)(unsafe.Pointer(p21)) = int8(int32(*(*int8)(unsafe.Pointer(p21))) | c&libc.Int32FromInt32(037))
  14062. }
  14063. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14064. return int32(m_UNVIS_VALID)
  14065. _6:
  14066. ; /* second possible octal digit */
  14067. if libc.Int32FromUint8(uc) >= int32('0') && libc.Int32FromUint8(uc) <= int32('7') {
  14068. /*
  14069. * yes - and maybe a third
  14070. */
  14071. *(*int8)(unsafe.Pointer(cp)) = int8(int32(*(*int8)(unsafe.Pointer(cp)))<<int32(3) + (c - int32('0')))
  14072. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_OCTAL3)))
  14073. return int32(m_UNVIS_NOCHAR)
  14074. }
  14075. /*
  14076. * no - done with current sequence, push back passed char
  14077. */
  14078. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14079. return int32(m_UNVIS_VALIDPUSH)
  14080. _7:
  14081. ; /* third possible octal digit */
  14082. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14083. if libc.Int32FromUint8(uc) >= int32('0') && libc.Int32FromUint8(uc) <= int32('7') {
  14084. *(*int8)(unsafe.Pointer(cp)) = int8(int32(*(*int8)(unsafe.Pointer(cp)))<<int32(3) + (c - int32('0')))
  14085. return int32(m_UNVIS_VALID)
  14086. }
  14087. /*
  14088. * we were done, push back passed char
  14089. */
  14090. return int32(m_UNVIS_VALIDPUSH)
  14091. _8:
  14092. ;
  14093. if !(libc.Xisxdigit(tls, libc.Int32FromUint8(uc)) != 0) {
  14094. goto bad
  14095. }
  14096. /*FALLTHROUGH*/
  14097. _9:
  14098. ;
  14099. if libc.Xisxdigit(tls, libc.Int32FromUint8(uc)) != 0 {
  14100. if libc.BoolInt32(uint32(uc)-uint32('0') < uint32(10)) != 0 {
  14101. v22 = libc.Int32FromUint8(uc) - int32('0')
  14102. } else {
  14103. v22 = libc.Xtolower(tls, libc.Int32FromUint8(uc)) - int32('a') + int32(10)
  14104. }
  14105. *(*int8)(unsafe.Pointer(cp)) = int8(v22)
  14106. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_HEX2)))
  14107. return int32(m_UNVIS_NOCHAR)
  14108. }
  14109. /*
  14110. * no - done with current sequence, push back passed char
  14111. */
  14112. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14113. return int32(m_UNVIS_VALIDPUSH)
  14114. _10:
  14115. ;
  14116. *(*int32)(unsafe.Pointer(astate)) = m_S_GROUND
  14117. if libc.Xisxdigit(tls, libc.Int32FromUint8(uc)) != 0 {
  14118. if libc.BoolInt32(uint32(uc)-uint32('0') < uint32(10)) != 0 {
  14119. v23 = libc.Int32FromUint8(uc) - int32('0')
  14120. } else {
  14121. v23 = libc.Xtolower(tls, libc.Int32FromUint8(uc)) - int32('a') + int32(10)
  14122. }
  14123. *(*int8)(unsafe.Pointer(cp)) = int8(v23 | int32(*(*int8)(unsafe.Pointer(cp)))<<int32(4))
  14124. return int32(m_UNVIS_VALID)
  14125. }
  14126. return int32(m_UNVIS_VALIDPUSH)
  14127. _11:
  14128. ;
  14129. if libc.Int32FromUint8(uc) == int32('\n') || libc.Int32FromUint8(uc) == int32('\r') {
  14130. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_EATCRNL)))
  14131. return int32(m_UNVIS_NOCHAR)
  14132. }
  14133. 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) {
  14134. if libc.BoolInt32(uint32(uc)-uint32('0') < uint32(10)) != 0 {
  14135. v24 = libc.Int32FromUint8(uc) - int32('0')
  14136. } else {
  14137. v24 = libc.Int32FromUint8(uc) - int32('A') + int32(10)
  14138. }
  14139. *(*int8)(unsafe.Pointer(cp)) = int8(v24)
  14140. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_MIME2)))
  14141. return int32(m_UNVIS_NOCHAR)
  14142. }
  14143. goto bad
  14144. _12:
  14145. ;
  14146. 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) {
  14147. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14148. if libc.BoolInt32(uint32(uc)-uint32('0') < uint32(10)) != 0 {
  14149. v25 = libc.Int32FromUint8(uc) - int32('0')
  14150. } else {
  14151. v25 = libc.Int32FromUint8(uc) - int32('A') + int32(10)
  14152. }
  14153. *(*int8)(unsafe.Pointer(cp)) = int8(v25 | int32(*(*int8)(unsafe.Pointer(cp)))<<int32(4))
  14154. return int32(m_UNVIS_VALID)
  14155. }
  14156. goto bad
  14157. _13:
  14158. ;
  14159. switch libc.Int32FromUint8(uc) {
  14160. case int32('\r'):
  14161. fallthrough
  14162. case int32('\n'):
  14163. return int32(m_UNVIS_NOCHAR)
  14164. case int32('='):
  14165. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_MIME1)))
  14166. return int32(m_UNVIS_NOCHAR)
  14167. default:
  14168. *(*int8)(unsafe.Pointer(cp)) = libc.Int8FromUint8(uc)
  14169. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14170. return int32(m_UNVIS_VALID)
  14171. }
  14172. _14:
  14173. ;
  14174. *(*int8)(unsafe.Pointer(cp)) = 0
  14175. if libc.Int32FromUint8(uc) == int32('#') {
  14176. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_NUMBER)))
  14177. return int32(m_UNVIS_NOCHAR)
  14178. }
  14179. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_STRING)))
  14180. /*FALLTHROUGH*/
  14181. _15:
  14182. ;
  14183. ia = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(cp))) /* index in the array */
  14184. is = uint8(libc.Uint32FromInt32(*(*int32)(unsafe.Pointer(astate))) >> libc.Int32FromInt32(24)) /* index in the string */
  14185. if libc.Int32FromUint8(is) == 0 {
  14186. v26 = 0
  14187. } else {
  14188. v26 = int32(*(*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_nv)) + uintptr(ia)*8 + uintptr(libc.Int32FromUint8(is)-int32(1)))))
  14189. }
  14190. lc = libc.Uint8FromInt32(v26) /* last character */
  14191. if libc.Int32FromUint8(uc) == int32(';') {
  14192. uc = uint8('\000')
  14193. }
  14194. for {
  14195. if !(uint64(ia) < libc.Uint64FromInt64(800)/libc.Uint64FromInt64(8)) {
  14196. break
  14197. }
  14198. if libc.Int32FromUint8(is) != 0 && int32(*(*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_nv)) + uintptr(ia)*8 + uintptr(libc.Int32FromUint8(is)-int32(1))))) != libc.Int32FromUint8(lc) {
  14199. goto bad
  14200. }
  14201. if int32(*(*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_nv)) + uintptr(ia)*8 + uintptr(is)))) == libc.Int32FromUint8(uc) {
  14202. break
  14203. }
  14204. goto _27
  14205. _27:
  14206. ;
  14207. ia++
  14208. }
  14209. if uint64(ia) == libc.Uint64FromInt64(800)/libc.Uint64FromInt64(8) {
  14210. goto bad
  14211. }
  14212. if libc.Int32FromUint8(uc) != 0 {
  14213. *(*int8)(unsafe.Pointer(cp)) = libc.Int8FromUint8(ia)
  14214. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromUint8(is)+libc.Int32FromInt32(1))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_STRING)))
  14215. return int32(m_UNVIS_NOCHAR)
  14216. }
  14217. *(*int8)(unsafe.Pointer(cp)) = libc.Int8FromUint8(_nv[ia].Fvalue)
  14218. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14219. return int32(m_UNVIS_VALID)
  14220. _16:
  14221. ;
  14222. if libc.Int32FromUint8(uc) == int32(';') {
  14223. return int32(m_UNVIS_VALID)
  14224. }
  14225. if !(libc.BoolInt32(uint32(uc)-libc.Uint32FromUint8('0') < libc.Uint32FromInt32(10)) != 0) {
  14226. goto bad
  14227. }
  14228. p28 = cp
  14229. *(*int8)(unsafe.Pointer(p28)) = int8(int32(*(*int8)(unsafe.Pointer(p28))) + (int32(*(*int8)(unsafe.Pointer(cp)))*libc.Int32FromInt32(10) + libc.Int32FromUint8(uc) - libc.Int32FromUint8('0')))
  14230. return int32(m_UNVIS_NOCHAR)
  14231. _17:
  14232. ;
  14233. goto bad
  14234. bad:
  14235. ;
  14236. /*
  14237. * decoder in unknown state - (probably uninitialized)
  14238. */
  14239. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14240. return -int32(1)
  14241. _18:
  14242. ;
  14243. return r
  14244. }
  14245. /*
  14246. * strnunvisx - decode src into dst
  14247. *
  14248. * Number of chars decoded into dst is returned, -1 on error.
  14249. * Dst is null terminated.
  14250. */
  14251. func Xstrnunvisx(tls *libc.TLS, dst uintptr, dlen Tsize_t, src uintptr, flag int32) (r int32) {
  14252. bp := tls.Alloc(16)
  14253. defer tls.Free(16)
  14254. var c, v1 int8
  14255. var start, v14, v16, v18, v2 uintptr
  14256. var v13, v15, v17, v19 Tsize_t
  14257. var _ /* state at bp+4 */ int32
  14258. var _ /* t at bp+0 */ int8
  14259. _, _, _, _, _, _, _, _, _, _, _ = c, start, v1, v13, v14, v15, v16, v17, v18, v19, v2
  14260. *(*int8)(unsafe.Pointer(bp)) = int8('\000')
  14261. start = dst
  14262. *(*int32)(unsafe.Pointer(bp + 4)) = 0
  14263. for {
  14264. v2 = src
  14265. src++
  14266. v1 = *(*int8)(unsafe.Pointer(v2))
  14267. c = v1
  14268. if !(int32(v1) != int32('\000')) {
  14269. break
  14270. }
  14271. goto again
  14272. again:
  14273. ;
  14274. switch Xunvis(tls, bp, int32(c), bp+4, flag) {
  14275. case int32(m_UNVIS_VALID):
  14276. goto _3
  14277. case int32(m_UNVIS_VALIDPUSH):
  14278. goto _4
  14279. case int32(m_UNVIS_NOCHAR):
  14280. goto _5
  14281. case 0:
  14282. goto _6
  14283. case -int32(1):
  14284. goto _7
  14285. default:
  14286. goto _8
  14287. }
  14288. goto _9
  14289. _3:
  14290. ;
  14291. _12:
  14292. ;
  14293. v13 = dlen
  14294. dlen--
  14295. if v13 == uint64(0) {
  14296. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14297. return -int32(1)
  14298. }
  14299. goto _11
  14300. _11:
  14301. ;
  14302. if 0 != 0 {
  14303. goto _12
  14304. }
  14305. goto _10
  14306. _10:
  14307. ;
  14308. v14 = dst
  14309. dst++
  14310. *(*int8)(unsafe.Pointer(v14)) = *(*int8)(unsafe.Pointer(bp))
  14311. goto _9
  14312. _4:
  14313. ;
  14314. v15 = dlen
  14315. dlen--
  14316. if v15 == uint64(0) {
  14317. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14318. return -int32(1)
  14319. }
  14320. v16 = dst
  14321. dst++
  14322. *(*int8)(unsafe.Pointer(v16)) = *(*int8)(unsafe.Pointer(bp))
  14323. goto again
  14324. _6:
  14325. ;
  14326. _5:
  14327. ;
  14328. goto _9
  14329. _7:
  14330. ;
  14331. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  14332. return -int32(1)
  14333. _8:
  14334. ;
  14335. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  14336. return -int32(1)
  14337. _9:
  14338. }
  14339. if Xunvis(tls, bp, int32(c), bp+4, int32(m__VIS_END)) == int32(m_UNVIS_VALID) {
  14340. v17 = dlen
  14341. dlen--
  14342. if v17 == uint64(0) {
  14343. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14344. return -int32(1)
  14345. }
  14346. v18 = dst
  14347. dst++
  14348. *(*int8)(unsafe.Pointer(v18)) = *(*int8)(unsafe.Pointer(bp))
  14349. }
  14350. v19 = dlen
  14351. dlen--
  14352. if v19 == uint64(0) {
  14353. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14354. return -int32(1)
  14355. }
  14356. *(*int8)(unsafe.Pointer(dst)) = int8('\000')
  14357. return int32(int64(dst) - int64(start))
  14358. }
  14359. func Xstrunvisx(tls *libc.TLS, dst uintptr, src uintptr, flag int32) (r int32) {
  14360. return Xstrnunvisx(tls, dst, libc.Uint64FromInt32(^libc.Int32FromInt32(0)), src, flag)
  14361. }
  14362. func Xstrunvis(tls *libc.TLS, dst uintptr, src uintptr) (r int32) {
  14363. return Xstrnunvisx(tls, dst, libc.Uint64FromInt32(^libc.Int32FromInt32(0)), src, 0)
  14364. }
  14365. func Xstrnunvis_openbsd(tls *libc.TLS, dst uintptr, src uintptr, dlen Tsize_t) (r Tssize_t) {
  14366. return int64(Xstrnunvisx(tls, dst, dlen, src, 0))
  14367. }
  14368. func Xstrnunvis_netbsd(tls *libc.TLS, dst uintptr, dlen Tsize_t, src uintptr) (r int32) {
  14369. return Xstrnunvisx(tls, dst, dlen, src, 0)
  14370. }
  14371. const m_MAXEXTRAS = 30
  14372. const m_VIS_CSTYLE1 = 2
  14373. const m_VIS_DQ1 = 32768
  14374. const m_VIS_GLOB1 = 4096
  14375. const m_VIS_HTTP18081 = 0x0080
  14376. const m_VIS_HTTP18661 = 0x0200
  14377. const m_VIS_HTTPSTYLE1 = 128
  14378. const m_VIS_NL1 = 16
  14379. const m_VIS_NOESCAPE1 = 0x0400
  14380. const m_VIS_NOLOCALE1 = 16384
  14381. const m_VIS_NOSLASH1 = 64
  14382. const m_VIS_OCTAL1 = 1
  14383. const m_VIS_SAFE1 = 32
  14384. const m_VIS_SHELL1 = 8192
  14385. const m_VIS_SP1 = 4
  14386. const m_VIS_TAB1 = 8
  14387. const m__VIS_END1 = 0x0800
  14388. type Twctrans_t = uintptr
  14389. /* Keep it simple for now, no locale stuff */
  14390. var _char_shell = [19]Twchar_t{'\'', '`', '"', ';', '&', '<', '>', '(', ')', '|', '{', '}', ']', '\\', '$', '!', '^', '~'}
  14391. var _char_glob = [5]Twchar_t{'*', '?', '[', '#'}
  14392. /*
  14393. * On NetBSD and glibc MB_LEN_MAX is currently > 8 which does not fit on any
  14394. * integer integral type and it is probably wrong, since currently the maximum
  14395. * number of bytes and character needs is 6. Until this is fixed, the
  14396. * loops below are using sizeof(uint64_t) - 1 instead of MB_LEN_MAX, and
  14397. * the assertion is commented out.
  14398. */
  14399. // C documentation
  14400. //
  14401. // /*
  14402. // * This is do_hvis, for HTTP style (RFC 1808)
  14403. // */
  14404. func _do_hvis(tls *libc.TLS, dst uintptr, c Twint_t, flags int32, nextc Twint_t, extra uintptr) (r uintptr) {
  14405. var v1, v2, v3 uintptr
  14406. _, _, _ = v1, v2, v3
  14407. 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(',') {
  14408. dst = _do_svis(tls, dst, c, flags, nextc, extra)
  14409. } else {
  14410. v1 = dst
  14411. dst += 4
  14412. *(*Twchar_t)(unsafe.Pointer(v1)) = int32('%')
  14413. v2 = dst
  14414. dst += 4
  14415. *(*Twchar_t)(unsafe.Pointer(v2)) = *(*t__predefined_wchar_t)(unsafe.Pointer(__ccgo_ts + 469 + uintptr(c>>int32(4)&uint32(0xf))*4))
  14416. v3 = dst
  14417. dst += 4
  14418. *(*Twchar_t)(unsafe.Pointer(v3)) = *(*t__predefined_wchar_t)(unsafe.Pointer(__ccgo_ts + 469 + uintptr(c&uint32(0xf))*4))
  14419. }
  14420. return dst
  14421. }
  14422. // C documentation
  14423. //
  14424. // /*
  14425. // * This is do_mvis, for Quoted-Printable MIME (RFC 2045)
  14426. // * NB: No handling of long lines or CRLF.
  14427. // */
  14428. func _do_mvis(tls *libc.TLS, dst uintptr, c Twint_t, flags int32, nextc Twint_t, extra uintptr) (r uintptr) {
  14429. var v1, v2, v3 uintptr
  14430. _, _, _ = v1, v2, v3
  14431. 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+537, libc.Int32FromUint32(c)) != libc.UintptrFromInt32(0)) {
  14432. v1 = dst
  14433. dst += 4
  14434. *(*Twchar_t)(unsafe.Pointer(v1)) = int32('=')
  14435. v2 = dst
  14436. dst += 4
  14437. *(*Twchar_t)(unsafe.Pointer(v2)) = *(*t__predefined_wchar_t)(unsafe.Pointer(__ccgo_ts + 589 + uintptr(c>>int32(4)&uint32(0xf))*4))
  14438. v3 = dst
  14439. dst += 4
  14440. *(*Twchar_t)(unsafe.Pointer(v3)) = *(*t__predefined_wchar_t)(unsafe.Pointer(__ccgo_ts + 589 + uintptr(c&uint32(0xf))*4))
  14441. } else {
  14442. dst = _do_svis(tls, dst, c, flags, nextc, extra)
  14443. }
  14444. return dst
  14445. }
  14446. // C documentation
  14447. //
  14448. // /*
  14449. // * Output single byte of multibyte character.
  14450. // */
  14451. func _do_mbyte(tls *libc.TLS, dst uintptr, c Twint_t, flags int32, nextc Twint_t, iswextra int32) (r uintptr) {
  14452. 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
  14453. var v21 int32
  14454. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  14455. if flags&int32(m_VIS_CSTYLE1) != 0 {
  14456. switch c {
  14457. case uint32('\n'):
  14458. v1 = dst
  14459. dst += 4
  14460. *(*Twchar_t)(unsafe.Pointer(v1)) = int32('\\')
  14461. v2 = dst
  14462. dst += 4
  14463. *(*Twchar_t)(unsafe.Pointer(v2)) = int32('n')
  14464. return dst
  14465. case uint32('\r'):
  14466. v3 = dst
  14467. dst += 4
  14468. *(*Twchar_t)(unsafe.Pointer(v3)) = int32('\\')
  14469. v4 = dst
  14470. dst += 4
  14471. *(*Twchar_t)(unsafe.Pointer(v4)) = int32('r')
  14472. return dst
  14473. case uint32('\b'):
  14474. v5 = dst
  14475. dst += 4
  14476. *(*Twchar_t)(unsafe.Pointer(v5)) = int32('\\')
  14477. v6 = dst
  14478. dst += 4
  14479. *(*Twchar_t)(unsafe.Pointer(v6)) = int32('b')
  14480. return dst
  14481. case uint32('\a'):
  14482. v7 = dst
  14483. dst += 4
  14484. *(*Twchar_t)(unsafe.Pointer(v7)) = int32('\\')
  14485. v8 = dst
  14486. dst += 4
  14487. *(*Twchar_t)(unsafe.Pointer(v8)) = int32('a')
  14488. return dst
  14489. case uint32('\v'):
  14490. v9 = dst
  14491. dst += 4
  14492. *(*Twchar_t)(unsafe.Pointer(v9)) = int32('\\')
  14493. v10 = dst
  14494. dst += 4
  14495. *(*Twchar_t)(unsafe.Pointer(v10)) = int32('v')
  14496. return dst
  14497. case uint32('\t'):
  14498. v11 = dst
  14499. dst += 4
  14500. *(*Twchar_t)(unsafe.Pointer(v11)) = int32('\\')
  14501. v12 = dst
  14502. dst += 4
  14503. *(*Twchar_t)(unsafe.Pointer(v12)) = int32('t')
  14504. return dst
  14505. case uint32('\f'):
  14506. v13 = dst
  14507. dst += 4
  14508. *(*Twchar_t)(unsafe.Pointer(v13)) = int32('\\')
  14509. v14 = dst
  14510. dst += 4
  14511. *(*Twchar_t)(unsafe.Pointer(v14)) = int32('f')
  14512. return dst
  14513. case uint32(' '):
  14514. v15 = dst
  14515. dst += 4
  14516. *(*Twchar_t)(unsafe.Pointer(v15)) = int32('\\')
  14517. v16 = dst
  14518. dst += 4
  14519. *(*Twchar_t)(unsafe.Pointer(v16)) = int32('s')
  14520. return dst
  14521. case uint32('\000'):
  14522. v17 = dst
  14523. dst += 4
  14524. *(*Twchar_t)(unsafe.Pointer(v17)) = int32('\\')
  14525. v18 = dst
  14526. dst += 4
  14527. *(*Twchar_t)(unsafe.Pointer(v18)) = int32('0')
  14528. if libc.Int32FromUint8(uint8(nextc)) >= int32('0') && libc.Int32FromUint8(uint8(nextc)) <= int32('7') {
  14529. v19 = dst
  14530. dst += 4
  14531. *(*Twchar_t)(unsafe.Pointer(v19)) = int32('0')
  14532. v20 = dst
  14533. dst += 4
  14534. *(*Twchar_t)(unsafe.Pointer(v20)) = int32('0')
  14535. }
  14536. return dst
  14537. /* We cannot encode these characters in VIS_CSTYLE
  14538. * because they special meaning */
  14539. fallthrough
  14540. case uint32('n'):
  14541. fallthrough
  14542. case uint32('r'):
  14543. fallthrough
  14544. case uint32('b'):
  14545. fallthrough
  14546. case uint32('a'):
  14547. fallthrough
  14548. case uint32('v'):
  14549. fallthrough
  14550. case uint32('t'):
  14551. fallthrough
  14552. case uint32('f'):
  14553. fallthrough
  14554. case uint32('s'):
  14555. fallthrough
  14556. case uint32('0'):
  14557. fallthrough
  14558. case uint32('M'):
  14559. fallthrough
  14560. case uint32('^'):
  14561. fallthrough
  14562. case uint32('$'): /* vis(1) -l */
  14563. default:
  14564. if flags&int32(m_VIS_NOLOCALE1) != 0 {
  14565. v21 = libc.BoolInt32(c-uint32(0x21) < uint32(0x5e))
  14566. } else {
  14567. v21 = libc.Xiswgraph(tls, c)
  14568. }
  14569. if v21 != 0 && !(libc.Int32FromUint8(uint8(c)) >= int32('0') && libc.Int32FromUint8(uint8(c)) <= int32('7')) {
  14570. v22 = dst
  14571. dst += 4
  14572. *(*Twchar_t)(unsafe.Pointer(v22)) = int32('\\')
  14573. v23 = dst
  14574. dst += 4
  14575. *(*Twchar_t)(unsafe.Pointer(v23)) = libc.Int32FromUint32(c)
  14576. return dst
  14577. }
  14578. }
  14579. }
  14580. if iswextra != 0 || c&uint32(0177) == uint32(' ') || flags&int32(m_VIS_OCTAL1) != 0 {
  14581. v24 = dst
  14582. dst += 4
  14583. *(*Twchar_t)(unsafe.Pointer(v24)) = int32('\\')
  14584. v25 = dst
  14585. dst += 4
  14586. *(*Twchar_t)(unsafe.Pointer(v25)) = libc.Int32FromUint8(uint8(uint32(uint8(c))>>libc.Int32FromInt32(6)&libc.Uint32FromInt32(03))) + int32('0')
  14587. v26 = dst
  14588. dst += 4
  14589. *(*Twchar_t)(unsafe.Pointer(v26)) = libc.Int32FromUint8(uint8(uint32(uint8(c))>>libc.Int32FromInt32(3)&libc.Uint32FromInt32(07))) + int32('0')
  14590. v27 = dst
  14591. dst += 4
  14592. *(*Twchar_t)(unsafe.Pointer(v27)) = libc.Int32FromUint32(c&uint32(07) + uint32('0'))
  14593. } else {
  14594. if flags&int32(m_VIS_NOSLASH1) == 0 {
  14595. v28 = dst
  14596. dst += 4
  14597. *(*Twchar_t)(unsafe.Pointer(v28)) = int32('\\')
  14598. }
  14599. if c&uint32(0200) != 0 {
  14600. c &= uint32(0177)
  14601. v29 = dst
  14602. dst += 4
  14603. *(*Twchar_t)(unsafe.Pointer(v29)) = int32('M')
  14604. }
  14605. if libc.Xiswcntrl(tls, c) != 0 {
  14606. v30 = dst
  14607. dst += 4
  14608. *(*Twchar_t)(unsafe.Pointer(v30)) = int32('^')
  14609. if c == uint32(0177) {
  14610. v31 = dst
  14611. dst += 4
  14612. *(*Twchar_t)(unsafe.Pointer(v31)) = int32('?')
  14613. } else {
  14614. v32 = dst
  14615. dst += 4
  14616. *(*Twchar_t)(unsafe.Pointer(v32)) = libc.Int32FromUint32(c + uint32('@'))
  14617. }
  14618. } else {
  14619. v33 = dst
  14620. dst += 4
  14621. *(*Twchar_t)(unsafe.Pointer(v33)) = int32('-')
  14622. v34 = dst
  14623. dst += 4
  14624. *(*Twchar_t)(unsafe.Pointer(v34)) = libc.Int32FromUint32(c)
  14625. }
  14626. }
  14627. return dst
  14628. }
  14629. // C documentation
  14630. //
  14631. // /*
  14632. // * This is do_vis, the central code of vis.
  14633. // * dst: Pointer to the destination buffer
  14634. // * c: Character to encode
  14635. // * flags: Flags word
  14636. // * nextc: The character following 'c'
  14637. // * extra: Pointer to the list of extra characters to be
  14638. // * backslash-protected.
  14639. // */
  14640. func _do_svis(tls *libc.TLS, dst uintptr, c Twint_t, flags int32, nextc Twint_t, extra uintptr) (r uintptr) {
  14641. var bmsk, wmsk Tuint64_t
  14642. var i, iswextra, shft, v1 int32
  14643. var v2 bool
  14644. var v3 uintptr
  14645. _, _, _, _, _, _, _, _ = bmsk, i, iswextra, shft, wmsk, v1, v2, v3
  14646. iswextra = libc.BoolInt32(libc.Xwcschr(tls, extra, libc.Int32FromUint32(c)) != libc.UintptrFromInt32(0))
  14647. if v2 = !(iswextra != 0); v2 {
  14648. if flags&int32(m_VIS_NOLOCALE1) != 0 {
  14649. v1 = libc.BoolInt32(c-uint32(0x21) < uint32(0x5e))
  14650. } else {
  14651. v1 = libc.Xiswgraph(tls, c)
  14652. }
  14653. }
  14654. 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'))) {
  14655. v3 = dst
  14656. dst += 4
  14657. *(*Twchar_t)(unsafe.Pointer(v3)) = libc.Int32FromUint32(c)
  14658. return dst
  14659. }
  14660. /* See comment in istrsenvisx() output loop, below. */
  14661. wmsk = uint64(0)
  14662. i = libc.Int32FromUint64(libc.Uint64FromInt64(8) - libc.Uint64FromInt32(1))
  14663. for {
  14664. if !(i >= 0) {
  14665. break
  14666. }
  14667. shft = i * int32(m_CHAR_BIT)
  14668. bmsk = libc.Uint64FromInt64(0xff) << shft
  14669. wmsk |= bmsk
  14670. if uint64(c)&wmsk != 0 || i == 0 {
  14671. dst = _do_mbyte(tls, dst, uint32(uint64(c)&bmsk>>shft), flags, nextc, iswextra)
  14672. }
  14673. goto _4
  14674. _4:
  14675. ;
  14676. i--
  14677. }
  14678. return dst
  14679. }
  14680. type Tvisfun_t = uintptr
  14681. // C documentation
  14682. //
  14683. // /*
  14684. // * Return the appropriate encoding function depending on the flags given.
  14685. // */
  14686. func _getvisfun(tls *libc.TLS, flags int32) (r Tvisfun_t) {
  14687. if flags&int32(m_VIS_HTTPSTYLE1) != 0 {
  14688. return __ccgo_fp(_do_hvis)
  14689. }
  14690. if flags&int32(m_VIS_MIMESTYLE) != 0 {
  14691. return __ccgo_fp(_do_mvis)
  14692. }
  14693. return __ccgo_fp(_do_svis)
  14694. }
  14695. // C documentation
  14696. //
  14697. // /*
  14698. // * Expand list of extra characters to not visually encode.
  14699. // */
  14700. func _makeextralist(tls *libc.TLS, flags int32, src uintptr) (r uintptr) {
  14701. var d, dst, s, v1, v10, v11, v12, v13, v4, v5, v7, v8, v9 uintptr
  14702. var i, len1 Tsize_t
  14703. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = d, dst, i, len1, s, v1, v10, v11, v12, v13, v4, v5, v7, v8, v9
  14704. len1 = libc.Xstrlen(tls, src)
  14705. v1 = libc.Xcalloc(tls, len1+uint64(m_MAXEXTRAS), uint64(4))
  14706. dst = v1
  14707. if v1 == libc.UintptrFromInt32(0) {
  14708. return libc.UintptrFromInt32(0)
  14709. }
  14710. if flags&int32(m_VIS_NOLOCALE1) != 0 || libc.Xmbstowcs(tls, dst, src, len1) == libc.Uint64FromInt32(-libc.Int32FromInt32(1)) {
  14711. i = uint64(0)
  14712. for {
  14713. if !(i < len1) {
  14714. break
  14715. }
  14716. *(*Twchar_t)(unsafe.Pointer(dst + uintptr(i)*4)) = libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(src + uintptr(i)))))
  14717. goto _2
  14718. _2:
  14719. ;
  14720. i++
  14721. }
  14722. d = dst + uintptr(len1)*4
  14723. } else {
  14724. d = dst + uintptr(libc.Xwcslen(tls, dst))*4
  14725. }
  14726. if flags&int32(m_VIS_GLOB1) != 0 {
  14727. s = uintptr(unsafe.Pointer(&_char_glob))
  14728. for {
  14729. if !(*(*Twchar_t)(unsafe.Pointer(s)) != 0) {
  14730. break
  14731. }
  14732. goto _3
  14733. goto _3
  14734. _3:
  14735. ;
  14736. v4 = d
  14737. d += 4
  14738. v5 = s
  14739. s += 4
  14740. *(*Twchar_t)(unsafe.Pointer(v4)) = *(*Twchar_t)(unsafe.Pointer(v5))
  14741. }
  14742. }
  14743. if flags&int32(m_VIS_SHELL1) != 0 {
  14744. s = uintptr(unsafe.Pointer(&_char_shell))
  14745. for {
  14746. if !(*(*Twchar_t)(unsafe.Pointer(s)) != 0) {
  14747. break
  14748. }
  14749. goto _6
  14750. goto _6
  14751. _6:
  14752. ;
  14753. v7 = d
  14754. d += 4
  14755. v8 = s
  14756. s += 4
  14757. *(*Twchar_t)(unsafe.Pointer(v7)) = *(*Twchar_t)(unsafe.Pointer(v8))
  14758. }
  14759. }
  14760. if flags&int32(m_VIS_SP1) != 0 {
  14761. v9 = d
  14762. d += 4
  14763. *(*Twchar_t)(unsafe.Pointer(v9)) = int32(' ')
  14764. }
  14765. if flags&int32(m_VIS_TAB1) != 0 {
  14766. v10 = d
  14767. d += 4
  14768. *(*Twchar_t)(unsafe.Pointer(v10)) = int32('\t')
  14769. }
  14770. if flags&int32(m_VIS_NL1) != 0 {
  14771. v11 = d
  14772. d += 4
  14773. *(*Twchar_t)(unsafe.Pointer(v11)) = int32('\n')
  14774. }
  14775. if flags&int32(m_VIS_DQ1) != 0 {
  14776. v12 = d
  14777. d += 4
  14778. *(*Twchar_t)(unsafe.Pointer(v12)) = int32('"')
  14779. }
  14780. if flags&int32(m_VIS_NOSLASH1) == 0 {
  14781. v13 = d
  14782. d += 4
  14783. *(*Twchar_t)(unsafe.Pointer(v13)) = int32('\\')
  14784. }
  14785. *(*Twchar_t)(unsafe.Pointer(d)) = int32('\000')
  14786. return dst
  14787. }
  14788. // C documentation
  14789. //
  14790. // /*
  14791. // * istrsenvisx()
  14792. // * The main internal function.
  14793. // * All user-visible functions call this one.
  14794. // */
  14795. func _istrsenvisx(tls *libc.TLS, mbdstp uintptr, dlen uintptr, mbsrc uintptr, mblength Tsize_t, flags int32, mbextra uintptr, cerr_ptr uintptr) (r int32) {
  14796. var bmsk, wmsk Tuint64_t
  14797. var c Twint_t
  14798. var cerr, clen, error1, i, shft, v12, v6 int32
  14799. var dst, extra, mbdst, mdst, pdst, psrc, src, start, v1, v2, v3, v4, v5, v8 uintptr
  14800. var f Tvisfun_t
  14801. var len1, olen Tsize_t
  14802. var maxolen, mbslength Tssize_t
  14803. var v9 uint64
  14804. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  14805. clen = 0
  14806. error1 = -int32(1)
  14807. mbslength = libc.Int64FromUint64(mblength)
  14808. /*
  14809. * When inputing a single character, must also read in the
  14810. * next character for nextc, the look-ahead character.
  14811. */
  14812. if mbslength == int64(1) {
  14813. mbslength++
  14814. }
  14815. /*
  14816. * Input (mbsrc) is a char string considered to be multibyte
  14817. * characters. The input loop will read this string pulling
  14818. * one character, possibly multiple bytes, from mbsrc and
  14819. * converting each to wchar_t in src.
  14820. *
  14821. * The vis conversion will be done using the wide char
  14822. * wchar_t string.
  14823. *
  14824. * This will then be converted back to a multibyte string to
  14825. * return to the caller.
  14826. */
  14827. /* Allocate space for the wide char strings */
  14828. v2 = libc.UintptrFromInt32(0)
  14829. extra = v2
  14830. v1 = v2
  14831. pdst = v1
  14832. psrc = v1
  14833. mdst = libc.UintptrFromInt32(0)
  14834. v3 = libc.Xcalloc(tls, libc.Uint64FromInt64(mbslength+int64(1)), uint64(4))
  14835. psrc = v3
  14836. if v3 == libc.UintptrFromInt32(0) {
  14837. return -int32(1)
  14838. }
  14839. v4 = libc.Xcalloc(tls, libc.Uint64FromInt64(int64(16)*mbslength+int64(1)), uint64(4))
  14840. pdst = v4
  14841. if v4 == libc.UintptrFromInt32(0) {
  14842. goto out
  14843. }
  14844. if *(*uintptr)(unsafe.Pointer(mbdstp)) == libc.UintptrFromInt32(0) {
  14845. v5 = libc.Xcalloc(tls, libc.Uint64FromInt64(int64(16)*mbslength+int64(1)), uint64(1))
  14846. mdst = v5
  14847. if v5 == libc.UintptrFromInt32(0) {
  14848. goto out
  14849. }
  14850. *(*uintptr)(unsafe.Pointer(mbdstp)) = mdst
  14851. }
  14852. mbdst = *(*uintptr)(unsafe.Pointer(mbdstp))
  14853. dst = pdst
  14854. src = psrc
  14855. if flags&int32(m_VIS_NOLOCALE1) != 0 {
  14856. /* Do one byte at a time conversion */
  14857. cerr = int32(1)
  14858. } else {
  14859. /* Use caller's multibyte conversion error flag. */
  14860. if cerr_ptr != 0 {
  14861. v6 = *(*int32)(unsafe.Pointer(cerr_ptr))
  14862. } else {
  14863. v6 = 0
  14864. }
  14865. cerr = v6
  14866. }
  14867. /*
  14868. * Input loop.
  14869. * Handle up to mblength characters (not bytes). We do not
  14870. * stop at NULs because we may be processing a block of data
  14871. * that includes NULs.
  14872. */
  14873. for mbslength > 0 {
  14874. /* Convert one multibyte character to wchar_t. */
  14875. if !(cerr != 0) {
  14876. clen = libc.Xmbtowc(tls, src, mbsrc, uint64(m_MB_LEN_MAX))
  14877. }
  14878. if cerr != 0 || clen < 0 {
  14879. /* Conversion error, process as a byte instead. */
  14880. *(*Twchar_t)(unsafe.Pointer(src)) = libc.Int32FromUint32(uint32(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(mbsrc)))))
  14881. clen = int32(1)
  14882. cerr = int32(1)
  14883. }
  14884. if clen == 0 {
  14885. /*
  14886. * NUL in input gives 0 return value. process
  14887. * as single NUL byte and keep going.
  14888. */
  14889. clen = int32(1)
  14890. }
  14891. /* Advance buffer character pointer. */
  14892. src += 4
  14893. /* Advance input pointer by number of bytes read. */
  14894. mbsrc += uintptr(clen)
  14895. /* Decrement input byte count. */
  14896. mbslength -= int64(clen)
  14897. }
  14898. len1 = libc.Uint64FromInt64((int64(src) - int64(psrc)) / 4)
  14899. src = psrc
  14900. /*
  14901. * In the single character input case, we will have actually
  14902. * processed two characters, c and nextc. Reset len back to
  14903. * just a single character.
  14904. */
  14905. if mblength < len1 {
  14906. len1 = mblength
  14907. }
  14908. /* Convert extra argument to list of characters for this mode. */
  14909. extra = _makeextralist(tls, flags, mbextra)
  14910. if !(extra != 0) {
  14911. if dlen != 0 && *(*Tsize_t)(unsafe.Pointer(dlen)) == uint64(0) {
  14912. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14913. goto out
  14914. }
  14915. *(*int8)(unsafe.Pointer(mbdst)) = int8('\000') /* can't create extra, return "" */
  14916. error1 = 0
  14917. goto out
  14918. }
  14919. /* Look up which processing function to call. */
  14920. f = _getvisfun(tls, flags)
  14921. /*
  14922. * Main processing loop.
  14923. * Call do_Xvis processing function one character at a time
  14924. * with next character available for look-ahead.
  14925. */
  14926. start = dst
  14927. for {
  14928. if !(len1 > uint64(0)) {
  14929. break
  14930. }
  14931. v8 = src
  14932. src += 4
  14933. c = libc.Uint32FromInt32(*(*Twchar_t)(unsafe.Pointer(v8)))
  14934. 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)
  14935. if dst == libc.UintptrFromInt32(0) {
  14936. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14937. goto out
  14938. }
  14939. goto _7
  14940. _7:
  14941. ;
  14942. len1--
  14943. }
  14944. /* Terminate the string in the buffer. */
  14945. *(*Twchar_t)(unsafe.Pointer(dst)) = int32('\000')
  14946. /*
  14947. * Output loop.
  14948. * Convert wchar_t string back to multibyte output string.
  14949. * If we have hit a multi-byte conversion error on input,
  14950. * output byte-by-byte here. Else use wctomb().
  14951. */
  14952. len1 = libc.Xwcslen(tls, start)
  14953. if dlen != 0 {
  14954. v9 = *(*Tsize_t)(unsafe.Pointer(dlen))
  14955. } else {
  14956. v9 = libc.Xwcslen(tls, start)*uint64(m_MB_LEN_MAX) + uint64(1)
  14957. }
  14958. maxolen = libc.Int64FromUint64(v9)
  14959. olen = uint64(0)
  14960. dst = start
  14961. for {
  14962. if !(len1 > uint64(0)) {
  14963. break
  14964. }
  14965. if !(cerr != 0) {
  14966. clen = libc.Xwctomb(tls, mbdst, *(*Twchar_t)(unsafe.Pointer(dst)))
  14967. }
  14968. if cerr != 0 || clen < 0 {
  14969. /*
  14970. * Conversion error, process as a byte(s) instead.
  14971. * Examine each byte and higher-order bytes for
  14972. * data. E.g.,
  14973. * 0x000000000000a264 -> a2 64
  14974. * 0x000000001f00a264 -> 1f 00 a2 64
  14975. */
  14976. clen = 0
  14977. wmsk = uint64(0)
  14978. i = libc.Int32FromUint64(libc.Uint64FromInt64(8) - libc.Uint64FromInt32(1))
  14979. for {
  14980. if !(i >= 0) {
  14981. break
  14982. }
  14983. shft = i * int32(m_CHAR_BIT)
  14984. bmsk = libc.Uint64FromInt64(0xff) << shft
  14985. wmsk |= bmsk
  14986. if libc.Uint64FromInt32(*(*Twchar_t)(unsafe.Pointer(dst)))&wmsk != 0 || i == 0 {
  14987. v12 = clen
  14988. clen++
  14989. *(*int8)(unsafe.Pointer(mbdst + uintptr(v12))) = libc.Int8FromUint64(libc.Uint64FromInt32(*(*Twchar_t)(unsafe.Pointer(dst))) & bmsk >> shft)
  14990. }
  14991. goto _11
  14992. _11:
  14993. ;
  14994. i--
  14995. }
  14996. cerr = int32(1)
  14997. }
  14998. /* If this character would exceed our output limit, stop. */
  14999. if olen+libc.Uint64FromInt32(clen) > libc.Uint64FromInt64(maxolen) {
  15000. break
  15001. }
  15002. /* Advance output pointer by number of bytes written. */
  15003. mbdst += uintptr(clen)
  15004. /* Advance buffer character pointer. */
  15005. dst += 4
  15006. /* Incrment output character count. */
  15007. olen += libc.Uint64FromInt32(clen)
  15008. goto _10
  15009. _10:
  15010. ;
  15011. len1--
  15012. }
  15013. /* Terminate the output string. */
  15014. *(*int8)(unsafe.Pointer(mbdst)) = int8('\000')
  15015. if flags&int32(m_VIS_NOLOCALE1) != 0 {
  15016. /* Pass conversion error flag out. */
  15017. if cerr_ptr != 0 {
  15018. *(*int32)(unsafe.Pointer(cerr_ptr)) = cerr
  15019. }
  15020. }
  15021. libc.Xfree(tls, extra)
  15022. libc.Xfree(tls, pdst)
  15023. libc.Xfree(tls, psrc)
  15024. return libc.Int32FromUint64(olen)
  15025. goto out
  15026. out:
  15027. ;
  15028. libc.Xfree(tls, extra)
  15029. libc.Xfree(tls, pdst)
  15030. libc.Xfree(tls, psrc)
  15031. libc.Xfree(tls, mdst)
  15032. return error1
  15033. }
  15034. func _istrsenvisxna(tls *libc.TLS, _mbdst uintptr, dlen uintptr, mbsrc uintptr, mblength Tsize_t, flags int32, mbextra uintptr, cerr_ptr uintptr) (r int32) {
  15035. bp := tls.Alloc(16)
  15036. defer tls.Free(16)
  15037. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  15038. return _istrsenvisx(tls, bp, dlen, mbsrc, mblength, flags, mbextra, cerr_ptr)
  15039. }
  15040. func _istrsenvisxl(tls *libc.TLS, mbdst uintptr, dlen uintptr, mbsrc uintptr, flags int32, mbextra uintptr, cerr_ptr uintptr) (r int32) {
  15041. var v1 uint64
  15042. _ = v1
  15043. if mbsrc != libc.UintptrFromInt32(0) {
  15044. v1 = libc.Xstrlen(tls, mbsrc)
  15045. } else {
  15046. v1 = uint64(0)
  15047. }
  15048. return _istrsenvisxna(tls, mbdst, dlen, mbsrc, v1, flags, mbextra, cerr_ptr)
  15049. }
  15050. /*
  15051. * The "svis" variants all take an "extra" arg that is a pointer
  15052. * to a NUL-terminated list of characters to be encoded, too.
  15053. * These functions are useful e. g. to encode strings in such a
  15054. * way so that they are not interpreted by a shell.
  15055. */
  15056. func Xsvis(tls *libc.TLS, _mbdst uintptr, c int32, flags int32, nextc int32, mbextra uintptr) (r uintptr) {
  15057. bp := tls.Alloc(16)
  15058. defer tls.Free(16)
  15059. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  15060. var ret int32
  15061. var _ /* cc at bp+8 */ [2]int8
  15062. _ = ret
  15063. (*(*[2]int8)(unsafe.Pointer(bp + 8)))[0] = int8(c)
  15064. (*(*[2]int8)(unsafe.Pointer(bp + 8)))[int32(1)] = int8(nextc)
  15065. ret = _istrsenvisx(tls, bp, libc.UintptrFromInt32(0), bp+8, uint64(1), flags, mbextra, libc.UintptrFromInt32(0))
  15066. if ret < 0 {
  15067. return libc.UintptrFromInt32(0)
  15068. }
  15069. return *(*uintptr)(unsafe.Pointer(bp)) + uintptr(ret)
  15070. }
  15071. func Xsnvis(tls *libc.TLS, _mbdst uintptr, _dlen Tsize_t, c int32, flags int32, nextc int32, mbextra uintptr) (r uintptr) {
  15072. bp := tls.Alloc(32)
  15073. defer tls.Free(32)
  15074. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  15075. *(*Tsize_t)(unsafe.Pointer(bp + 8)) = _dlen
  15076. var ret int32
  15077. var _ /* cc at bp+16 */ [2]int8
  15078. _ = ret
  15079. (*(*[2]int8)(unsafe.Pointer(bp + 16)))[0] = int8(c)
  15080. (*(*[2]int8)(unsafe.Pointer(bp + 16)))[int32(1)] = int8(nextc)
  15081. ret = _istrsenvisx(tls, bp, bp+8, bp+16, uint64(1), flags, mbextra, libc.UintptrFromInt32(0))
  15082. if ret < 0 {
  15083. return libc.UintptrFromInt32(0)
  15084. }
  15085. return *(*uintptr)(unsafe.Pointer(bp)) + uintptr(ret)
  15086. }
  15087. func Xstrsvis(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, flags int32, mbextra uintptr) (r int32) {
  15088. return _istrsenvisxl(tls, mbdst, libc.UintptrFromInt32(0), mbsrc, flags, mbextra, libc.UintptrFromInt32(0))
  15089. }
  15090. func Xstrsnvis(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, flags int32, mbextra uintptr) (r int32) {
  15091. bp := tls.Alloc(16)
  15092. defer tls.Free(16)
  15093. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15094. return _istrsenvisxl(tls, mbdst, bp, mbsrc, flags, mbextra, libc.UintptrFromInt32(0))
  15095. }
  15096. func Xstrsvisx(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, len1 Tsize_t, flags int32, mbextra uintptr) (r int32) {
  15097. return _istrsenvisxna(tls, mbdst, libc.UintptrFromInt32(0), mbsrc, len1, flags, mbextra, libc.UintptrFromInt32(0))
  15098. }
  15099. func Xstrsnvisx(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, len1 Tsize_t, flags int32, mbextra uintptr) (r int32) {
  15100. bp := tls.Alloc(16)
  15101. defer tls.Free(16)
  15102. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15103. return _istrsenvisxna(tls, mbdst, bp, mbsrc, len1, flags, mbextra, libc.UintptrFromInt32(0))
  15104. }
  15105. func Xstrsenvisx(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, len1 Tsize_t, flags int32, mbextra uintptr, cerr_ptr uintptr) (r int32) {
  15106. bp := tls.Alloc(16)
  15107. defer tls.Free(16)
  15108. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15109. return _istrsenvisxna(tls, mbdst, bp, mbsrc, len1, flags, mbextra, cerr_ptr)
  15110. }
  15111. // C documentation
  15112. //
  15113. // /*
  15114. // * vis - visually encode characters
  15115. // */
  15116. func Xvis(tls *libc.TLS, _mbdst uintptr, c int32, flags int32, nextc int32) (r uintptr) {
  15117. bp := tls.Alloc(16)
  15118. defer tls.Free(16)
  15119. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  15120. var ret int32
  15121. var _ /* cc at bp+8 */ [2]int8
  15122. _ = ret
  15123. (*(*[2]int8)(unsafe.Pointer(bp + 8)))[0] = int8(c)
  15124. (*(*[2]int8)(unsafe.Pointer(bp + 8)))[int32(1)] = int8(nextc)
  15125. ret = _istrsenvisx(tls, bp, libc.UintptrFromInt32(0), bp+8, uint64(1), flags, __ccgo_ts+60, libc.UintptrFromInt32(0))
  15126. if ret < 0 {
  15127. return libc.UintptrFromInt32(0)
  15128. }
  15129. return *(*uintptr)(unsafe.Pointer(bp)) + uintptr(ret)
  15130. }
  15131. func Xnvis(tls *libc.TLS, _mbdst uintptr, _dlen Tsize_t, c int32, flags int32, nextc int32) (r uintptr) {
  15132. bp := tls.Alloc(32)
  15133. defer tls.Free(32)
  15134. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  15135. *(*Tsize_t)(unsafe.Pointer(bp + 8)) = _dlen
  15136. var ret int32
  15137. var _ /* cc at bp+16 */ [2]int8
  15138. _ = ret
  15139. (*(*[2]int8)(unsafe.Pointer(bp + 16)))[0] = int8(c)
  15140. (*(*[2]int8)(unsafe.Pointer(bp + 16)))[int32(1)] = int8(nextc)
  15141. ret = _istrsenvisx(tls, bp, bp+8, bp+16, uint64(1), flags, __ccgo_ts+60, libc.UintptrFromInt32(0))
  15142. if ret < 0 {
  15143. return libc.UintptrFromInt32(0)
  15144. }
  15145. return *(*uintptr)(unsafe.Pointer(bp)) + uintptr(ret)
  15146. }
  15147. /*
  15148. * strvis - visually encode characters from src into dst
  15149. *
  15150. * Dst must be 4 times the size of src to account for possible
  15151. * expansion. The length of dst, not including the trailing NULL,
  15152. * is returned.
  15153. */
  15154. func Xstrvis(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, flags int32) (r int32) {
  15155. return _istrsenvisxl(tls, mbdst, libc.UintptrFromInt32(0), mbsrc, flags, __ccgo_ts+60, libc.UintptrFromInt32(0))
  15156. }
  15157. func Xstrnvis_openbsd(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, _dlen Tsize_t, flags int32) (r int32) {
  15158. bp := tls.Alloc(16)
  15159. defer tls.Free(16)
  15160. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15161. return _istrsenvisxl(tls, mbdst, bp, mbsrc, flags, __ccgo_ts+60, libc.UintptrFromInt32(0))
  15162. }
  15163. func Xstrnvis_netbsd(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, flags int32) (r int32) {
  15164. bp := tls.Alloc(16)
  15165. defer tls.Free(16)
  15166. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15167. return _istrsenvisxl(tls, mbdst, bp, mbsrc, flags, __ccgo_ts+60, libc.UintptrFromInt32(0))
  15168. }
  15169. func Xstravis(tls *libc.TLS, mbdstp uintptr, mbsrc uintptr, flags int32) (r int32) {
  15170. var v1 uint64
  15171. _ = v1
  15172. *(*uintptr)(unsafe.Pointer(mbdstp)) = libc.UintptrFromInt32(0)
  15173. if mbsrc != libc.UintptrFromInt32(0) {
  15174. v1 = libc.Xstrlen(tls, mbsrc)
  15175. } else {
  15176. v1 = uint64(0)
  15177. }
  15178. return _istrsenvisx(tls, mbdstp, libc.UintptrFromInt32(0), mbsrc, v1, flags, __ccgo_ts+60, libc.UintptrFromInt32(0))
  15179. }
  15180. /*
  15181. * strvisx - visually encode characters from src into dst
  15182. *
  15183. * Dst must be 4 times the size of src to account for possible
  15184. * expansion. The length of dst, not including the trailing NULL,
  15185. * is returned.
  15186. *
  15187. * Strvisx encodes exactly len characters from src into dst.
  15188. * This is useful for encoding a block of data.
  15189. */
  15190. func Xstrvisx(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, len1 Tsize_t, flags int32) (r int32) {
  15191. return _istrsenvisxna(tls, mbdst, libc.UintptrFromInt32(0), mbsrc, len1, flags, __ccgo_ts+60, libc.UintptrFromInt32(0))
  15192. }
  15193. func Xstrnvisx(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, len1 Tsize_t, flags int32) (r int32) {
  15194. bp := tls.Alloc(16)
  15195. defer tls.Free(16)
  15196. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15197. return _istrsenvisxna(tls, mbdst, bp, mbsrc, len1, flags, __ccgo_ts+60, libc.UintptrFromInt32(0))
  15198. }
  15199. func Xstrenvisx(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, len1 Tsize_t, flags int32, cerr_ptr uintptr) (r int32) {
  15200. bp := tls.Alloc(16)
  15201. defer tls.Free(16)
  15202. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15203. return _istrsenvisxna(tls, mbdst, bp, mbsrc, len1, flags, __ccgo_ts+60, cerr_ptr)
  15204. }
  15205. // C documentation
  15206. //
  15207. // /*
  15208. // * Appends src to string dst of size siz (unlike wcsncat, siz is the
  15209. // * full size of dst, not space left). At most siz-1 characters
  15210. // * will be copied. Always NUL terminates (unless siz == 0).
  15211. // * Returns wcslen(initial dst) + wcslen(src); if retval >= siz,
  15212. // * truncation occurred.
  15213. // */
  15214. func Xwcslcat(tls *libc.TLS, dst uintptr, src uintptr, siz Tsize_t) (r Tsize_t) {
  15215. var d, s, v3 uintptr
  15216. var dlen, n, v1 Tsize_t
  15217. var v2 bool
  15218. _, _, _, _, _, _, _ = d, dlen, n, s, v1, v2, v3
  15219. d = dst
  15220. s = src
  15221. n = siz
  15222. /* Find the end of dst and adjust bytes left but don't go past end */
  15223. for {
  15224. if v2 = *(*Twchar_t)(unsafe.Pointer(d)) != int32('\000'); v2 {
  15225. v1 = n
  15226. n--
  15227. }
  15228. if !(v2 && v1 != uint64(0)) {
  15229. break
  15230. }
  15231. d += 4
  15232. }
  15233. dlen = libc.Uint64FromInt64((int64(d) - int64(dst)) / 4)
  15234. n = siz - dlen
  15235. if n == uint64(0) {
  15236. return dlen + libc.Xwcslen(tls, s)
  15237. }
  15238. for *(*Twchar_t)(unsafe.Pointer(s)) != int32('\000') {
  15239. if n != uint64(1) {
  15240. v3 = d
  15241. d += 4
  15242. *(*Twchar_t)(unsafe.Pointer(v3)) = *(*Twchar_t)(unsafe.Pointer(s))
  15243. n--
  15244. }
  15245. s += 4
  15246. }
  15247. *(*Twchar_t)(unsafe.Pointer(d)) = int32('\000')
  15248. return dlen + libc.Uint64FromInt64((int64(s)-int64(src))/4) /* count does not include NUL */
  15249. }
  15250. // C documentation
  15251. //
  15252. // /*
  15253. // * Copy src to string dst of size siz. At most siz-1 characters
  15254. // * will be copied. Always NUL terminates (unless siz == 0).
  15255. // * Returns wcslen(src); if retval >= siz, truncation occurred.
  15256. // */
  15257. func Xwcslcpy(tls *libc.TLS, dst uintptr, src uintptr, siz Tsize_t) (r Tsize_t) {
  15258. var d, s, v6, v7, v8 uintptr
  15259. var n, v1, v3 Tsize_t
  15260. var v2 bool
  15261. var v5 Twchar_t
  15262. _, _, _, _, _, _, _, _, _, _ = d, n, s, v1, v2, v3, v5, v6, v7, v8
  15263. d = dst
  15264. s = src
  15265. n = siz
  15266. /* Copy as many bytes as will fit */
  15267. if v2 = n != uint64(0); v2 {
  15268. n--
  15269. v1 = n
  15270. }
  15271. if v2 && v1 != uint64(0) {
  15272. for {
  15273. v6 = s
  15274. s += 4
  15275. v5 = *(*Twchar_t)(unsafe.Pointer(v6))
  15276. v7 = d
  15277. d += 4
  15278. *(*Twchar_t)(unsafe.Pointer(v7)) = v5
  15279. if v5 == 0 {
  15280. break
  15281. }
  15282. goto _4
  15283. _4:
  15284. ;
  15285. n--
  15286. v3 = n
  15287. if !(v3 != uint64(0)) {
  15288. break
  15289. }
  15290. }
  15291. }
  15292. /* Not enough room in dst, add NUL and traverse rest of src */
  15293. if n == uint64(0) {
  15294. if siz != uint64(0) {
  15295. *(*Twchar_t)(unsafe.Pointer(d)) = int32('\000')
  15296. } /* NUL-terminate dst */
  15297. for {
  15298. v8 = s
  15299. s += 4
  15300. if !(*(*Twchar_t)(unsafe.Pointer(v8)) != 0) {
  15301. break
  15302. }
  15303. }
  15304. }
  15305. return libc.Uint64FromInt64((int64(s)-int64(src))/4 - libc.Int64FromInt32(1)) /* count does not include NUL */
  15306. }
  15307. func __ccgo_fp(f interface{}) uintptr {
  15308. type iface [2]uintptr
  15309. return (*iface)(unsafe.Pointer(&f))[1]
  15310. }
  15311. var Xoptreset int32
  15312. var __ccgo_ts = (*reflect.StringHeader)(unsafe.Pointer(&__ccgo_ts1)).Data
  15313. var __ccgo_ts1 = "/proc/self/fd\x00%s: \x00: \x00%s\n\x00diouxX\x00DOU\x00aAeEfFgG\x00#'0- +\x00r\x00r+\x00w\x00\x00BLOCKSIZE\x00G\x00K\x00M\x00%s: unknown blocksize\x00maximum blocksize is %ldG\x00minimum blocksize is 512\x00%ld%s-blocks\x00B\x00\x00Ki\x00Mi\x00Gi\x00Ti\x00Pi\x00Ei\x00\x00\x00\x00Ki\x00Mi\x00Gi\x00Ti\x00Pi\x00Ei\x00B\x00\x00k\x00\x00M\x00\x00G\x00\x00T\x00\x00P\x00\x00E\x00\x00\x00\x00k\x00\x00M\x00\x00G\x00\x00T\x00\x00P\x00\x00E\x00B\x00\x00K\x00\x00M\x00\x00G\x00\x00T\x00\x00P\x00\x00E\x00\x00\x00\x00K\x00\x00M\x00\x00G\x00\x00T\x00\x00P\x00\x00E\x00 \x00%d%s%d%s%s%s\x00%ld%s%s%s\x00/var/run/%s.pid\x00%u\x00setproctitle not initialized, please either call setproctitle_init() or link against libbsd-ctor.\x00%s\x00/dev/tty\x00\n\x00too large\x00too small\x00invalid\x000\x00\x00\x001\x00\x00\x002\x00\x00\x003\x00\x00\x004\x00\x00\x005\x00\x00\x006\x00\x00\x007\x00\x00\x008\x00\x00\x009\x00\x00\x00a\x00\x00\x00b\x00\x00\x00c\x00\x00\x00d\x00\x00\x00e\x00\x00\x00f\x00\x00\x00\x00\x00\x00\x00#\x00\x00\x00$\x00\x00\x00@\x00\x00\x00[\x00\x00\x00\\\x00\x00\x00]\x00\x00\x00^\x00\x00\x00`\x00\x00\x00{\x00\x00\x00|\x00\x00\x00}\x00\x00\x00~\x00\x00\x00\x00\x00\x00\x000\x00\x00\x001\x00\x00\x002\x00\x00\x003\x00\x00\x004\x00\x00\x005\x00\x00\x006\x00\x00\x007\x00\x00\x008\x00\x00\x009\x00\x00\x00A\x00\x00\x00B\x00\x00\x00C\x00\x00\x00D\x00\x00\x00E\x00\x00\x00F\x00\x00\x00\x00\x00\x00\x00"