ccgo_linux_ppc64le.go 488 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046
  1. // Code generated for linux/ppc64le 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/debian/src/modernc.org/builder/.exclude/modernc.org/libc/include/linux/ppc64le -I /home/debian/src/modernc.org/builder/.exclude/modernc.org/limd/include/linux/ppc64le -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 -mlong-double-64 -o .libs/libbsd.so.0.12.0.go', DO NOT EDIT.
  2. //go:build linux && ppc64le
  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 = 58
  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_LIBBSD_ABI_ACCMODE = 1
  277. const m_LIBBSD_ABI_ARC4RANDOM = 1
  278. const m_LIBBSD_ABI_ARC4RANDOM_STIR = 1
  279. const m_LIBBSD_ABI_ASPRINTF = 0
  280. const m_LIBBSD_ABI_BSD_GETOPT = 1
  281. const m_LIBBSD_ABI_CLOSEFROM = 1
  282. const m_LIBBSD_ABI_ERR = 0
  283. const m_LIBBSD_ABI_ERRC = 1
  284. const m_LIBBSD_ABI_EXPAND_NUMBER = 1
  285. const m_LIBBSD_ABI_EXPLICIT_BZERO = 1
  286. const m_LIBBSD_ABI_FGETLN = 1
  287. const m_LIBBSD_ABI_FLOPEN = 1
  288. const m_LIBBSD_ABI_FMTCHECK = 1
  289. const m_LIBBSD_ABI_FPURGE = 1
  290. const m_LIBBSD_ABI_FREEZERO = 1
  291. const m_LIBBSD_ABI_FUNOPEN = 1
  292. const m_LIBBSD_ABI_GETBSIZE = 1
  293. const m_LIBBSD_ABI_GETPEEREID = 1
  294. const m_LIBBSD_ABI_HUMANIZE_NUMBER = 1
  295. const m_LIBBSD_ABI_ID_FROM_NAME = 1
  296. const m_LIBBSD_ABI_INET_NET_PTON = 1
  297. const m_LIBBSD_ABI_MD5 = 1
  298. const m_LIBBSD_ABI_NAME_FROM_ID = 1
  299. const m_LIBBSD_ABI_NLIST = 1
  300. const m_LIBBSD_ABI_PIDFILE = 1
  301. const m_LIBBSD_ABI_PROCTITLE = 1
  302. const m_LIBBSD_ABI_PROGNAME = 1
  303. const m_LIBBSD_ABI_PWCACHE = 1
  304. const m_LIBBSD_ABI_READPASSPHRASE = 1
  305. const m_LIBBSD_ABI_REALLOCARRAY = 1
  306. const m_LIBBSD_ABI_REALLOCF = 1
  307. const m_LIBBSD_ABI_RECALLOCARRAY = 1
  308. const m_LIBBSD_ABI_SORT = 1
  309. const m_LIBBSD_ABI_STRINGLIST = 1
  310. const m_LIBBSD_ABI_STRL = 1
  311. const m_LIBBSD_ABI_STRMODE = 1
  312. const m_LIBBSD_ABI_STRNSTR = 1
  313. const m_LIBBSD_ABI_STRTONUM = 1
  314. const m_LIBBSD_ABI_STRTOX = 1
  315. const m_LIBBSD_ABI_TIME64 = 0
  316. const m_LIBBSD_ABI_TIMECONV = 1
  317. const m_LIBBSD_ABI_TRANSPARENT_LIBMD = 1
  318. const m_LIBBSD_ABI_VIS = 1
  319. const m_LIBBSD_ABI_WCSL = 1
  320. const m_LIBBSD_DISABLE_DEPRECATED = 1
  321. const m_LIBBSD_OVERLAY = 1
  322. const m_LIBBSD_SYS_HAS_TIME64 = 1
  323. const m_LIBBSD_SYS_TIME_BITS = 64
  324. const m_LINE_MAX = 4096
  325. const m_LITTLE_ENDIAN = "__LITTLE_ENDIAN"
  326. const m_LLONG_MAX = 0x7fffffffffffffff
  327. const m_LOGIN_NAME_MAX = 256
  328. const m_LONG_BIT = 64
  329. const m_LONG_MAX = "__LONG_MAX"
  330. const m_LT_OBJDIR = ".libs/"
  331. const m_L_INCR = 1
  332. const m_L_SET = 0
  333. const m_L_XTND = 2
  334. const m_L_ctermid = 20
  335. const m_L_cuserid = 20
  336. const m_L_tmpnam = 20
  337. const m_MB_LEN_MAX = 4
  338. const m_MINSIGSTKSZ = 4096
  339. const m_MQ_PRIO_MAX = 32768
  340. const m_NAME_MAX = 255
  341. const m_NDEBUG = 1
  342. const m_NGROUPS_MAX = 32
  343. const m_NL_ARGMAX = 9
  344. const m_NL_LANGMAX = 32
  345. const m_NL_MSGMAX = 32767
  346. const m_NL_NMAX = 16
  347. const m_NL_SETMAX = 255
  348. const m_NL_TEXTMAX = 2048
  349. const m_NSIG = "_NSIG"
  350. const m_NZERO = 20
  351. const m_PACKAGE = "libbsd"
  352. const m_PACKAGE_BUGREPORT = "libbsd@lists.freedesktop.org"
  353. const m_PACKAGE_NAME = "libbsd"
  354. const m_PACKAGE_STRING = "libbsd 0.12.0"
  355. const m_PACKAGE_TARNAME = "libbsd"
  356. const m_PACKAGE_URL = ""
  357. const m_PACKAGE_VERSION = "0.12.0"
  358. const m_PATH_MAX = 4096
  359. const m_PDP_ENDIAN = "__PDP_ENDIAN"
  360. const m_PIC = 1
  361. const m_PIPE_BUF = 4096
  362. const m_POLL_ERR = 4
  363. const m_POLL_HUP = 6
  364. const m_POLL_IN = 1
  365. const m_POLL_MSG = 3
  366. const m_POLL_OUT = 2
  367. const m_POLL_PRI = 5
  368. const m_POSIX_CLOSE_RESTART = 0
  369. const m_PTHREAD_DESTRUCTOR_ITERATIONS = 4
  370. const m_PTHREAD_KEYS_MAX = 128
  371. const m_PTHREAD_STACK_MIN = 2048
  372. const m_PTRDIFF_MAX = "INT64_MAX"
  373. const m_PTRDIFF_MIN = "INT64_MIN"
  374. const m_P_tmpdir = "/tmp"
  375. const m_RAND_MAX = 0x7fffffff
  376. const m_RE_DUP_MAX = 255
  377. const m_R_OK = 4
  378. const m_SA_EXPOSE_TAGBITS = 0x00000800
  379. const m_SA_NOCLDSTOP = 1
  380. const m_SA_NOCLDWAIT = 2
  381. const m_SA_NODEFER = 0x40000000
  382. const m_SA_NOMASK = "SA_NODEFER"
  383. const m_SA_ONESHOT = "SA_RESETHAND"
  384. const m_SA_ONSTACK = 0x08000000
  385. const m_SA_RESETHAND = 0x80000000
  386. const m_SA_RESTART = 0x10000000
  387. const m_SA_RESTORER = 0x04000000
  388. const m_SA_SIGINFO = 4
  389. const m_SA_UNSUPPORTED = 0x00000400
  390. const m_SCHAR_MAX = 127
  391. const m_SEEK_DATA = 3
  392. const m_SEEK_HOLE = 4
  393. const m_SEGV_ACCERR = 2
  394. const m_SEGV_BNDERR = 3
  395. const m_SEGV_MAPERR = 1
  396. const m_SEGV_MTEAERR = 8
  397. const m_SEGV_MTESERR = 9
  398. const m_SEGV_PKUERR = 4
  399. const m_SEM_NSEMS_MAX = 256
  400. const m_SEM_VALUE_MAX = 0x7fffffff
  401. const m_SET_LEN = 6
  402. const m_SET_LEN_INCR = 4
  403. const m_SHRT_MAX = 0x7fff
  404. const m_SIGABRT = 6
  405. const m_SIGALRM = 14
  406. const m_SIGBUS = 7
  407. const m_SIGCHLD = 17
  408. const m_SIGCONT = 18
  409. const m_SIGEV_NONE = 1
  410. const m_SIGEV_SIGNAL = 0
  411. const m_SIGEV_THREAD = 2
  412. const m_SIGEV_THREAD_ID = 4
  413. const m_SIGFPE = 8
  414. const m_SIGHUP = 1
  415. const m_SIGILL = 4
  416. const m_SIGINT = 2
  417. const m_SIGIO = 29
  418. const m_SIGIOT = "SIGABRT"
  419. const m_SIGKILL = 9
  420. const m_SIGPIPE = 13
  421. const m_SIGPOLL = "SIGIO"
  422. const m_SIGPROF = 27
  423. const m_SIGPWR = 30
  424. const m_SIGQUIT = 3
  425. const m_SIGSEGV = 11
  426. const m_SIGSTKFLT = 16
  427. const m_SIGSTKSZ = 10240
  428. const m_SIGSTOP = 19
  429. const m_SIGSYS = 31
  430. const m_SIGTERM = 15
  431. const m_SIGTRAP = 5
  432. const m_SIGTSTP = 20
  433. const m_SIGTTIN = 21
  434. const m_SIGTTOU = 22
  435. const m_SIGUNUSED = "SIGSYS"
  436. const m_SIGURG = 23
  437. const m_SIGUSR1 = 10
  438. const m_SIGUSR2 = 12
  439. const m_SIGVTALRM = 26
  440. const m_SIGWINCH = 28
  441. const m_SIGXCPU = 24
  442. const m_SIGXFSZ = 25
  443. const m_SIG_ATOMIC_MAX = "INT32_MAX"
  444. const m_SIG_ATOMIC_MIN = "INT32_MIN"
  445. const m_SIG_BLOCK = 0
  446. const m_SIG_SETMASK = 2
  447. const m_SIG_UNBLOCK = 1
  448. const m_SIZEOF_TIME_T = 8
  449. const m_SIZE_MAX = "UINT64_MAX"
  450. const m_SI_KERNEL = 128
  451. const m_SI_USER = 0
  452. const m_SSIZE_MAX = "LONG_MAX"
  453. const m_SS_DISABLE = 2
  454. const m_SS_FLAG_BITS = "SS_AUTODISARM"
  455. const m_SS_ONSTACK = 1
  456. const m_STATX_ALL = 0xfff
  457. const m_STATX_ATIME = 0x20
  458. const m_STATX_BASIC_STATS = 0x7ff
  459. const m_STATX_BLOCKS = 0x400
  460. const m_STATX_BTIME = 0x800
  461. const m_STATX_CTIME = 0x80
  462. const m_STATX_GID = 0x10
  463. const m_STATX_INO = 0x100
  464. const m_STATX_MODE = 2
  465. const m_STATX_MTIME = 0x40
  466. const m_STATX_NLINK = 4
  467. const m_STATX_SIZE = 0x200
  468. const m_STATX_TYPE = 1
  469. const m_STATX_UID = 8
  470. const m_STDC_HEADERS = 1
  471. const m_STDERR_FILENO = 2
  472. const m_STDIN_FILENO = 0
  473. const m_STDOUT_FILENO = 1
  474. const m_SYMLOOP_MAX = 40
  475. const m_SYS_SECCOMP = 1
  476. const m_SYS_USER_DISPATCH = 2
  477. const m_S_IEXEC = "S_IXUSR"
  478. const m_S_IFBLK = 0060000
  479. const m_S_IFCHR = 0020000
  480. const m_S_IFDIR = 16384
  481. const m_S_IFIFO = 0010000
  482. const m_S_IFLNK = 0120000
  483. const m_S_IFMT = 0170000
  484. const m_S_IFREG = 0100000
  485. const m_S_IFSOCK = 0140000
  486. const m_S_IREAD = "S_IRUSR"
  487. const m_S_IRGRP = 32
  488. const m_S_IROTH = 4
  489. const m_S_IRUSR = 256
  490. const m_S_IRWXG = 56
  491. const m_S_IRWXO = 7
  492. const m_S_IRWXU = 448
  493. const m_S_ISGID = 1024
  494. const m_S_ISTXT = "S_ISVTX"
  495. const m_S_ISUID = 2048
  496. const m_S_ISVTX = 512
  497. const m_S_IWGRP = 16
  498. const m_S_IWOTH = 2
  499. const m_S_IWRITE = "S_IWUSR"
  500. const m_S_IWUSR = 128
  501. const m_S_IXGRP = 8
  502. const m_S_IXOTH = 1
  503. const m_S_IXUSR = 64
  504. const m_TMP_MAX = 10000
  505. const m_TRAP_BRANCH = 3
  506. const m_TRAP_BRKPT = 1
  507. const m_TRAP_HWBKPT = 4
  508. const m_TRAP_TRACE = 2
  509. const m_TRAP_UNK = 5
  510. const m_TTY_NAME_MAX = 32
  511. const m_TZNAME_MAX = 6
  512. const m_UCHAR_MAX = 255
  513. const m_UINT16_MAX = 0xffff
  514. const m_UINT32_MAX = "0xffffffffu"
  515. const m_UINT64_MAX = "0xffffffffffffffffu"
  516. const m_UINT8_MAX = 0xff
  517. const m_UINTMAX_MAX = "UINT64_MAX"
  518. const m_UINTPTR_MAX = "UINT64_MAX"
  519. const m_UINT_FAST16_MAX = "UINT32_MAX"
  520. const m_UINT_FAST32_MAX = "UINT32_MAX"
  521. const m_UINT_FAST64_MAX = "UINT64_MAX"
  522. const m_UINT_FAST8_MAX = "UINT8_MAX"
  523. const m_UINT_LEAST16_MAX = "UINT16_MAX"
  524. const m_UINT_LEAST32_MAX = "UINT32_MAX"
  525. const m_UINT_LEAST64_MAX = "UINT64_MAX"
  526. const m_UINT_LEAST8_MAX = "UINT8_MAX"
  527. const m_UINT_MAX = 0xffffffff
  528. const m_USHRT_MAX = 0xffff
  529. const m_UTIME_NOW = 0x3fffffff
  530. const m_UTIME_OMIT = 0x3ffffffe
  531. const m_VERSION = "0.12.0"
  532. const m_WINT_MAX = "UINT32_MAX"
  533. const m_WINT_MIN = 0
  534. const m_WNOHANG = 1
  535. const m_WORD_BIT = 32
  536. const m_WUNTRACED = 2
  537. const m_W_OK = 2
  538. const m_X_OK = 1
  539. const m__ALL_SOURCE = 1
  540. const m__ARCH_PPC = 1
  541. const m__ARCH_PPC64 = 1
  542. const m__ARCH_PPCGR = 1
  543. const m__ARCH_PPCSQ = 1
  544. const m__ARCH_PWR4 = 1
  545. const m__ARCH_PWR5 = 1
  546. const m__ARCH_PWR5X = 1
  547. const m__ARCH_PWR6 = 1
  548. const m__ARCH_PWR7 = 1
  549. const m__ARCH_PWR8 = 1
  550. const m__CALL_ELF = 2
  551. const m__CALL_LINUX = 1
  552. const m__CS_GNU_LIBC_VERSION = 2
  553. const m__CS_GNU_LIBPTHREAD_VERSION = 3
  554. const m__CS_PATH = 0
  555. const m__CS_POSIX_V5_WIDTH_RESTRICTED_ENVS = 4
  556. const m__CS_POSIX_V6_ILP32_OFF32_CFLAGS = 1116
  557. const m__CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 1117
  558. const m__CS_POSIX_V6_ILP32_OFF32_LIBS = 1118
  559. const m__CS_POSIX_V6_ILP32_OFF32_LINTFLAGS = 1119
  560. const m__CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 1120
  561. const m__CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 1121
  562. const m__CS_POSIX_V6_ILP32_OFFBIG_LIBS = 1122
  563. const m__CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS = 1123
  564. const m__CS_POSIX_V6_LP64_OFF64_CFLAGS = 1124
  565. const m__CS_POSIX_V6_LP64_OFF64_LDFLAGS = 1125
  566. const m__CS_POSIX_V6_LP64_OFF64_LIBS = 1126
  567. const m__CS_POSIX_V6_LP64_OFF64_LINTFLAGS = 1127
  568. const m__CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 1128
  569. const m__CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 1129
  570. const m__CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 1130
  571. const m__CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS = 1131
  572. const m__CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 1
  573. const m__CS_POSIX_V7_ILP32_OFF32_CFLAGS = 1132
  574. const m__CS_POSIX_V7_ILP32_OFF32_LDFLAGS = 1133
  575. const m__CS_POSIX_V7_ILP32_OFF32_LIBS = 1134
  576. const m__CS_POSIX_V7_ILP32_OFF32_LINTFLAGS = 1135
  577. const m__CS_POSIX_V7_ILP32_OFFBIG_CFLAGS = 1136
  578. const m__CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS = 1137
  579. const m__CS_POSIX_V7_ILP32_OFFBIG_LIBS = 1138
  580. const m__CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS = 1139
  581. const m__CS_POSIX_V7_LP64_OFF64_CFLAGS = 1140
  582. const m__CS_POSIX_V7_LP64_OFF64_LDFLAGS = 1141
  583. const m__CS_POSIX_V7_LP64_OFF64_LIBS = 1142
  584. const m__CS_POSIX_V7_LP64_OFF64_LINTFLAGS = 1143
  585. const m__CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS = 1144
  586. const m__CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS = 1145
  587. const m__CS_POSIX_V7_LPBIG_OFFBIG_LIBS = 1146
  588. const m__CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS = 1147
  589. const m__CS_POSIX_V7_THREADS_CFLAGS = 1150
  590. const m__CS_POSIX_V7_THREADS_LDFLAGS = 1151
  591. const m__CS_POSIX_V7_WIDTH_RESTRICTED_ENVS = 5
  592. const m__CS_V6_ENV = 1148
  593. const m__CS_V7_ENV = 1149
  594. const m__DARWIN_C_SOURCE = 1
  595. const m__GNU_SOURCE = 1
  596. const m__HPUX_ALT_XOPEN_SOCKET_API = 1
  597. const m__IOFBF = 0
  598. const m__IOLBF = 1
  599. const m__IONBF = 2
  600. const m__LITTLE_ENDIAN = 1
  601. const m__LP64 = 1
  602. const m__NETBSD_SOURCE = 1
  603. const m__NSIG = 65
  604. const m__OPENBSD_SOURCE = 1
  605. const m__PC_2_SYMLINKS = 20
  606. const m__PC_ALLOC_SIZE_MIN = 18
  607. const m__PC_ASYNC_IO = 10
  608. const m__PC_CHOWN_RESTRICTED = 6
  609. const m__PC_FILESIZEBITS = 13
  610. const m__PC_LINK_MAX = 0
  611. const m__PC_MAX_CANON = 1
  612. const m__PC_MAX_INPUT = 2
  613. const m__PC_NAME_MAX = 3
  614. const m__PC_NO_TRUNC = 7
  615. const m__PC_PATH_MAX = 4
  616. const m__PC_PIPE_BUF = 5
  617. const m__PC_PRIO_IO = 11
  618. const m__PC_REC_INCR_XFER_SIZE = 14
  619. const m__PC_REC_MAX_XFER_SIZE = 15
  620. const m__PC_REC_MIN_XFER_SIZE = 16
  621. const m__PC_REC_XFER_ALIGN = 17
  622. const m__PC_SOCK_MAXBUF = 12
  623. const m__PC_SYMLINK_MAX = 19
  624. const m__PC_SYNC_IO = 9
  625. const m__PC_VDISABLE = 8
  626. const m__POSIX2_BC_BASE_MAX = 99
  627. const m__POSIX2_BC_DIM_MAX = 2048
  628. const m__POSIX2_BC_SCALE_MAX = 99
  629. const m__POSIX2_BC_STRING_MAX = 1000
  630. const m__POSIX2_CHARCLASS_NAME_MAX = 14
  631. const m__POSIX2_COLL_WEIGHTS_MAX = 2
  632. const m__POSIX2_C_BIND = "_POSIX_VERSION"
  633. const m__POSIX2_EXPR_NEST_MAX = 32
  634. const m__POSIX2_LINE_MAX = 2048
  635. const m__POSIX2_RE_DUP_MAX = 255
  636. const m__POSIX2_VERSION = "_POSIX_VERSION"
  637. const m__POSIX_ADVISORY_INFO = "_POSIX_VERSION"
  638. const m__POSIX_AIO_LISTIO_MAX = 2
  639. const m__POSIX_AIO_MAX = 1
  640. const m__POSIX_ARG_MAX = 4096
  641. const m__POSIX_ASYNCHRONOUS_IO = "_POSIX_VERSION"
  642. const m__POSIX_BARRIERS = "_POSIX_VERSION"
  643. const m__POSIX_CHILD_MAX = 25
  644. const m__POSIX_CHOWN_RESTRICTED = 1
  645. const m__POSIX_CLOCKRES_MIN = 20000000
  646. const m__POSIX_CLOCK_SELECTION = "_POSIX_VERSION"
  647. const m__POSIX_CPUTIME = "_POSIX_VERSION"
  648. const m__POSIX_DELAYTIMER_MAX = 32
  649. const m__POSIX_FSYNC = "_POSIX_VERSION"
  650. const m__POSIX_HOST_NAME_MAX = 255
  651. const m__POSIX_IPV6 = "_POSIX_VERSION"
  652. const m__POSIX_JOB_CONTROL = 1
  653. const m__POSIX_LINK_MAX = 8
  654. const m__POSIX_LOGIN_NAME_MAX = 9
  655. const m__POSIX_MAPPED_FILES = "_POSIX_VERSION"
  656. const m__POSIX_MAX_CANON = 255
  657. const m__POSIX_MAX_INPUT = 255
  658. const m__POSIX_MEMLOCK = "_POSIX_VERSION"
  659. const m__POSIX_MEMLOCK_RANGE = "_POSIX_VERSION"
  660. const m__POSIX_MEMORY_PROTECTION = "_POSIX_VERSION"
  661. const m__POSIX_MESSAGE_PASSING = "_POSIX_VERSION"
  662. const m__POSIX_MONOTONIC_CLOCK = "_POSIX_VERSION"
  663. const m__POSIX_MQ_OPEN_MAX = 8
  664. const m__POSIX_MQ_PRIO_MAX = 32
  665. const m__POSIX_NAME_MAX = 14
  666. const m__POSIX_NGROUPS_MAX = 8
  667. const m__POSIX_NO_TRUNC = 1
  668. const m__POSIX_OPEN_MAX = 20
  669. const m__POSIX_PATH_MAX = 256
  670. const m__POSIX_PIPE_BUF = 512
  671. const m__POSIX_PTHREAD_SEMANTICS = 1
  672. const m__POSIX_RAW_SOCKETS = "_POSIX_VERSION"
  673. const m__POSIX_READER_WRITER_LOCKS = "_POSIX_VERSION"
  674. const m__POSIX_REALTIME_SIGNALS = "_POSIX_VERSION"
  675. const m__POSIX_REGEXP = 1
  676. const m__POSIX_RE_DUP_MAX = 255
  677. const m__POSIX_RTSIG_MAX = 8
  678. const m__POSIX_SAVED_IDS = 1
  679. const m__POSIX_SEMAPHORES = "_POSIX_VERSION"
  680. const m__POSIX_SEM_NSEMS_MAX = 256
  681. const m__POSIX_SEM_VALUE_MAX = 32767
  682. const m__POSIX_SHARED_MEMORY_OBJECTS = "_POSIX_VERSION"
  683. const m__POSIX_SHELL = 1
  684. const m__POSIX_SIGQUEUE_MAX = 32
  685. const m__POSIX_SPAWN = "_POSIX_VERSION"
  686. const m__POSIX_SPIN_LOCKS = "_POSIX_VERSION"
  687. const m__POSIX_SSIZE_MAX = 32767
  688. const m__POSIX_SS_REPL_MAX = 4
  689. const m__POSIX_STREAM_MAX = 8
  690. const m__POSIX_SYMLINK_MAX = 255
  691. const m__POSIX_SYMLOOP_MAX = 8
  692. const m__POSIX_THREADS = "_POSIX_VERSION"
  693. const m__POSIX_THREAD_ATTR_STACKADDR = "_POSIX_VERSION"
  694. const m__POSIX_THREAD_ATTR_STACKSIZE = "_POSIX_VERSION"
  695. const m__POSIX_THREAD_CPUTIME = "_POSIX_VERSION"
  696. const m__POSIX_THREAD_DESTRUCTOR_ITERATIONS = 4
  697. const m__POSIX_THREAD_KEYS_MAX = 128
  698. const m__POSIX_THREAD_PRIORITY_SCHEDULING = "_POSIX_VERSION"
  699. const m__POSIX_THREAD_PROCESS_SHARED = "_POSIX_VERSION"
  700. const m__POSIX_THREAD_SAFE_FUNCTIONS = "_POSIX_VERSION"
  701. const m__POSIX_THREAD_THREADS_MAX = 64
  702. const m__POSIX_TIMEOUTS = "_POSIX_VERSION"
  703. const m__POSIX_TIMERS = "_POSIX_VERSION"
  704. const m__POSIX_TIMER_MAX = 32
  705. const m__POSIX_TRACE_EVENT_NAME_MAX = 30
  706. const m__POSIX_TRACE_NAME_MAX = 8
  707. const m__POSIX_TRACE_SYS_MAX = 8
  708. const m__POSIX_TRACE_USER_EVENT_MAX = 32
  709. const m__POSIX_TTY_NAME_MAX = 9
  710. const m__POSIX_TZNAME_MAX = 6
  711. const m__POSIX_V6_LP64_OFF64 = 1
  712. const m__POSIX_V7_LP64_OFF64 = 1
  713. const m__POSIX_VDISABLE = 0
  714. const m__POSIX_VERSION = 200809
  715. const m__SC_2_CHAR_TERM = 95
  716. const m__SC_2_C_BIND = 47
  717. const m__SC_2_C_DEV = 48
  718. const m__SC_2_FORT_DEV = 49
  719. const m__SC_2_FORT_RUN = 50
  720. const m__SC_2_LOCALEDEF = 52
  721. const m__SC_2_PBS = 168
  722. const m__SC_2_PBS_ACCOUNTING = 169
  723. const m__SC_2_PBS_CHECKPOINT = 175
  724. const m__SC_2_PBS_LOCATE = 170
  725. const m__SC_2_PBS_MESSAGE = 171
  726. const m__SC_2_PBS_TRACK = 172
  727. const m__SC_2_SW_DEV = 51
  728. const m__SC_2_UPE = 97
  729. const m__SC_2_VERSION = 46
  730. const m__SC_ADVISORY_INFO = 132
  731. const m__SC_AIO_LISTIO_MAX = 23
  732. const m__SC_AIO_MAX = 24
  733. const m__SC_AIO_PRIO_DELTA_MAX = 25
  734. const m__SC_ARG_MAX = 0
  735. const m__SC_ASYNCHRONOUS_IO = 12
  736. const m__SC_ATEXIT_MAX = 87
  737. const m__SC_AVPHYS_PAGES = 86
  738. const m__SC_BARRIERS = 133
  739. const m__SC_BC_BASE_MAX = 36
  740. const m__SC_BC_DIM_MAX = 37
  741. const m__SC_BC_SCALE_MAX = 38
  742. const m__SC_BC_STRING_MAX = 39
  743. const m__SC_CHILD_MAX = 1
  744. const m__SC_CLK_TCK = 2
  745. const m__SC_CLOCK_SELECTION = 137
  746. const m__SC_COLL_WEIGHTS_MAX = 40
  747. const m__SC_CPUTIME = 138
  748. const m__SC_DELAYTIMER_MAX = 26
  749. const m__SC_EXPR_NEST_MAX = 42
  750. const m__SC_FSYNC = 15
  751. const m__SC_GETGR_R_SIZE_MAX = 69
  752. const m__SC_GETPW_R_SIZE_MAX = 70
  753. const m__SC_HOST_NAME_MAX = 180
  754. const m__SC_IOV_MAX = 60
  755. const m__SC_IPV6 = 235
  756. const m__SC_JOB_CONTROL = 7
  757. const m__SC_LINE_MAX = 43
  758. const m__SC_LOGIN_NAME_MAX = 71
  759. const m__SC_MAPPED_FILES = 16
  760. const m__SC_MEMLOCK = 17
  761. const m__SC_MEMLOCK_RANGE = 18
  762. const m__SC_MEMORY_PROTECTION = 19
  763. const m__SC_MESSAGE_PASSING = 20
  764. const m__SC_MINSIGSTKSZ = 249
  765. const m__SC_MONOTONIC_CLOCK = 149
  766. const m__SC_MQ_OPEN_MAX = 27
  767. const m__SC_MQ_PRIO_MAX = 28
  768. const m__SC_NGROUPS_MAX = 3
  769. const m__SC_NPROCESSORS_CONF = 83
  770. const m__SC_NPROCESSORS_ONLN = 84
  771. const m__SC_NZERO = 109
  772. const m__SC_OPEN_MAX = 4
  773. const m__SC_PAGESIZE = 30
  774. const m__SC_PAGE_SIZE = 30
  775. const m__SC_PASS_MAX = 88
  776. const m__SC_PHYS_PAGES = 85
  777. const m__SC_PRIORITIZED_IO = 13
  778. const m__SC_PRIORITY_SCHEDULING = 10
  779. const m__SC_RAW_SOCKETS = 236
  780. const m__SC_READER_WRITER_LOCKS = 153
  781. const m__SC_REALTIME_SIGNALS = 9
  782. const m__SC_REGEXP = 155
  783. const m__SC_RE_DUP_MAX = 44
  784. const m__SC_RTSIG_MAX = 31
  785. const m__SC_SAVED_IDS = 8
  786. const m__SC_SEMAPHORES = 21
  787. const m__SC_SEM_NSEMS_MAX = 32
  788. const m__SC_SEM_VALUE_MAX = 33
  789. const m__SC_SHARED_MEMORY_OBJECTS = 22
  790. const m__SC_SHELL = 157
  791. const m__SC_SIGQUEUE_MAX = 34
  792. const m__SC_SIGSTKSZ = 250
  793. const m__SC_SPAWN = 159
  794. const m__SC_SPIN_LOCKS = 154
  795. const m__SC_SPORADIC_SERVER = 160
  796. const m__SC_SS_REPL_MAX = 241
  797. const m__SC_STREAMS = 174
  798. const m__SC_STREAM_MAX = 5
  799. const m__SC_SYMLOOP_MAX = 173
  800. const m__SC_SYNCHRONIZED_IO = 14
  801. const m__SC_THREADS = 67
  802. const m__SC_THREAD_ATTR_STACKADDR = 77
  803. const m__SC_THREAD_ATTR_STACKSIZE = 78
  804. const m__SC_THREAD_CPUTIME = 139
  805. const m__SC_THREAD_DESTRUCTOR_ITERATIONS = 73
  806. const m__SC_THREAD_KEYS_MAX = 74
  807. const m__SC_THREAD_PRIORITY_SCHEDULING = 79
  808. const m__SC_THREAD_PRIO_INHERIT = 80
  809. const m__SC_THREAD_PRIO_PROTECT = 81
  810. const m__SC_THREAD_PROCESS_SHARED = 82
  811. const m__SC_THREAD_ROBUST_PRIO_INHERIT = 247
  812. const m__SC_THREAD_ROBUST_PRIO_PROTECT = 248
  813. const m__SC_THREAD_SAFE_FUNCTIONS = 68
  814. const m__SC_THREAD_SPORADIC_SERVER = 161
  815. const m__SC_THREAD_STACK_MIN = 75
  816. const m__SC_THREAD_THREADS_MAX = 76
  817. const m__SC_TIMEOUTS = 164
  818. const m__SC_TIMERS = 11
  819. const m__SC_TIMER_MAX = 35
  820. const m__SC_TRACE = 181
  821. const m__SC_TRACE_EVENT_FILTER = 182
  822. const m__SC_TRACE_EVENT_NAME_MAX = 242
  823. const m__SC_TRACE_INHERIT = 183
  824. const m__SC_TRACE_LOG = 184
  825. const m__SC_TRACE_NAME_MAX = 243
  826. const m__SC_TRACE_SYS_MAX = 244
  827. const m__SC_TRACE_USER_EVENT_MAX = 245
  828. const m__SC_TTY_NAME_MAX = 72
  829. const m__SC_TYPED_MEMORY_OBJECTS = 165
  830. const m__SC_TZNAME_MAX = 6
  831. const m__SC_UIO_MAXIOV = 60
  832. const m__SC_V6_ILP32_OFF32 = 176
  833. const m__SC_V6_ILP32_OFFBIG = 177
  834. const m__SC_V6_LP64_OFF64 = 178
  835. const m__SC_V6_LPBIG_OFFBIG = 179
  836. const m__SC_V7_ILP32_OFF32 = 237
  837. const m__SC_V7_ILP32_OFFBIG = 238
  838. const m__SC_V7_LP64_OFF64 = 239
  839. const m__SC_V7_LPBIG_OFFBIG = 240
  840. const m__SC_VERSION = 29
  841. const m__SC_XBS5_ILP32_OFF32 = 125
  842. const m__SC_XBS5_ILP32_OFFBIG = 126
  843. const m__SC_XBS5_LP64_OFF64 = 127
  844. const m__SC_XBS5_LPBIG_OFFBIG = 128
  845. const m__SC_XOPEN_CRYPT = 92
  846. const m__SC_XOPEN_ENH_I18N = 93
  847. const m__SC_XOPEN_LEGACY = 129
  848. const m__SC_XOPEN_REALTIME = 130
  849. const m__SC_XOPEN_REALTIME_THREADS = 131
  850. const m__SC_XOPEN_SHM = 94
  851. const m__SC_XOPEN_STREAMS = 246
  852. const m__SC_XOPEN_UNIX = 91
  853. const m__SC_XOPEN_VERSION = 89
  854. const m__SC_XOPEN_XCU_VERSION = 90
  855. const m__SC_XOPEN_XPG2 = 98
  856. const m__SC_XOPEN_XPG3 = 99
  857. const m__SC_XOPEN_XPG4 = 100
  858. const m__STDC_PREDEF_H = 1
  859. const m__SYS_CDEFS_H = 1
  860. const m__TANDEM_SOURCE = 1
  861. const m__XOPEN_ENH_I18N = 1
  862. const m__XOPEN_IOV_MAX = 16
  863. const m__XOPEN_NAME_MAX = 255
  864. const m__XOPEN_PATH_MAX = 1024
  865. const m__XOPEN_UNIX = 1
  866. const m__XOPEN_VERSION = 700
  867. const m___ALTIVEC__ = 1
  868. const m___APPLE_ALTIVEC__ = 1
  869. const m___ATOMIC_ACQUIRE = 2
  870. const m___ATOMIC_ACQ_REL = 4
  871. const m___ATOMIC_CONSUME = 1
  872. const m___ATOMIC_RELAXED = 0
  873. const m___ATOMIC_RELEASE = 3
  874. const m___ATOMIC_SEQ_CST = 5
  875. const m___BIGGEST_ALIGNMENT__ = 16
  876. const m___BIG_ENDIAN = 4321
  877. const m___BUILTIN_CPU_SUPPORTS__ = 1
  878. const m___BYTE_ORDER = 1234
  879. const m___BYTE_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  880. const m___CCGO__ = 1
  881. const m___CHAR_BIT__ = 8
  882. const m___CHAR_UNSIGNED__ = 1
  883. const m___CMODEL_MEDIUM__ = 1
  884. const m___CRYPTO__ = 1
  885. const m___DBL_DECIMAL_DIG__ = 17
  886. const m___DBL_DIG__ = 15
  887. const m___DBL_HAS_DENORM__ = 1
  888. const m___DBL_HAS_INFINITY__ = 1
  889. const m___DBL_HAS_QUIET_NAN__ = 1
  890. const m___DBL_MANT_DIG__ = 53
  891. const m___DBL_MAX_10_EXP__ = 308
  892. const m___DBL_MAX_EXP__ = 1024
  893. const m___DEC128_EPSILON__ = 1e-33
  894. const m___DEC128_MANT_DIG__ = 34
  895. const m___DEC128_MAX_EXP__ = 6145
  896. const m___DEC128_MAX__ = "9.999999999999999999999999999999999E6144"
  897. const m___DEC128_MIN__ = 1e-6143
  898. const m___DEC128_SUBNORMAL_MIN__ = 0.000000000000000000000000000000001e-6143
  899. const m___DEC32_EPSILON__ = 1e-6
  900. const m___DEC32_MANT_DIG__ = 7
  901. const m___DEC32_MAX_EXP__ = 97
  902. const m___DEC32_MAX__ = 9.999999e96
  903. const m___DEC32_MIN__ = 1e-95
  904. const m___DEC32_SUBNORMAL_MIN__ = 0.000001e-95
  905. const m___DEC64_EPSILON__ = 1e-15
  906. const m___DEC64_MANT_DIG__ = 16
  907. const m___DEC64_MAX_EXP__ = 385
  908. const m___DEC64_MAX__ = "9.999999999999999E384"
  909. const m___DEC64_MIN__ = 1e-383
  910. const m___DEC64_SUBNORMAL_MIN__ = 0.000000000000001e-383
  911. const m___DECIMAL_DIG__ = 17
  912. const m___DEC_EVAL_METHOD__ = 2
  913. const m___ELF__ = 1
  914. const m___EXTENSIONS__ = 1
  915. const m___FINITE_MATH_ONLY__ = 0
  916. const m___FLOAT128_TYPE__ = 1
  917. const m___FLOAT128__ = 1
  918. const m___FLOAT_WORD_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  919. const m___FLT128_DECIMAL_DIG__ = 36
  920. const m___FLT128_DENORM_MIN__ = 6.47517511943802511092443895822764655e-4966
  921. const m___FLT128_DIG__ = 33
  922. const m___FLT128_EPSILON__ = 1.92592994438723585305597794258492732e-34
  923. const m___FLT128_HAS_DENORM__ = 1
  924. const m___FLT128_HAS_INFINITY__ = 1
  925. const m___FLT128_HAS_QUIET_NAN__ = 1
  926. const m___FLT128_MANT_DIG__ = 113
  927. const m___FLT128_MAX_10_EXP__ = 4932
  928. const m___FLT128_MAX_EXP__ = 16384
  929. const m___FLT128_MAX__ = "1.18973149535723176508575932662800702e+4932"
  930. const m___FLT128_MIN__ = 3.36210314311209350626267781732175260e-4932
  931. const m___FLT128_NORM_MAX__ = "1.18973149535723176508575932662800702e+4932"
  932. const m___FLT32X_DECIMAL_DIG__ = 17
  933. const m___FLT32X_DENORM_MIN__ = 4.94065645841246544176568792868221372e-324
  934. const m___FLT32X_DIG__ = 15
  935. const m___FLT32X_EPSILON__ = 2.22044604925031308084726333618164062e-16
  936. const m___FLT32X_HAS_DENORM__ = 1
  937. const m___FLT32X_HAS_INFINITY__ = 1
  938. const m___FLT32X_HAS_QUIET_NAN__ = 1
  939. const m___FLT32X_MANT_DIG__ = 53
  940. const m___FLT32X_MAX_10_EXP__ = 308
  941. const m___FLT32X_MAX_EXP__ = 1024
  942. const m___FLT32X_MAX__ = 1.79769313486231570814527423731704357e+308
  943. const m___FLT32X_MIN__ = 2.22507385850720138309023271733240406e-308
  944. const m___FLT32X_NORM_MAX__ = 1.79769313486231570814527423731704357e+308
  945. const m___FLT32_DECIMAL_DIG__ = 9
  946. const m___FLT32_DENORM_MIN__ = 1.40129846432481707092372958328991613e-45
  947. const m___FLT32_DIG__ = 6
  948. const m___FLT32_EPSILON__ = 1.19209289550781250000000000000000000e-7
  949. const m___FLT32_HAS_DENORM__ = 1
  950. const m___FLT32_HAS_INFINITY__ = 1
  951. const m___FLT32_HAS_QUIET_NAN__ = 1
  952. const m___FLT32_MANT_DIG__ = 24
  953. const m___FLT32_MAX_10_EXP__ = 38
  954. const m___FLT32_MAX_EXP__ = 128
  955. const m___FLT32_MAX__ = 3.40282346638528859811704183484516925e+38
  956. const m___FLT32_MIN__ = 1.17549435082228750796873653722224568e-38
  957. const m___FLT32_NORM_MAX__ = 3.40282346638528859811704183484516925e+38
  958. const m___FLT64X_DECIMAL_DIG__ = 36
  959. const m___FLT64X_DENORM_MIN__ = 6.47517511943802511092443895822764655e-4966
  960. const m___FLT64X_DIG__ = 33
  961. const m___FLT64X_EPSILON__ = 1.92592994438723585305597794258492732e-34
  962. const m___FLT64X_HAS_DENORM__ = 1
  963. const m___FLT64X_HAS_INFINITY__ = 1
  964. const m___FLT64X_HAS_QUIET_NAN__ = 1
  965. const m___FLT64X_MANT_DIG__ = 113
  966. const m___FLT64X_MAX_10_EXP__ = 4932
  967. const m___FLT64X_MAX_EXP__ = 16384
  968. const m___FLT64X_MAX__ = "1.18973149535723176508575932662800702e+4932"
  969. const m___FLT64X_MIN__ = 3.36210314311209350626267781732175260e-4932
  970. const m___FLT64X_NORM_MAX__ = "1.18973149535723176508575932662800702e+4932"
  971. const m___FLT64_DECIMAL_DIG__ = 17
  972. const m___FLT64_DENORM_MIN__ = 4.94065645841246544176568792868221372e-324
  973. const m___FLT64_DIG__ = 15
  974. const m___FLT64_EPSILON__ = 2.22044604925031308084726333618164062e-16
  975. const m___FLT64_HAS_DENORM__ = 1
  976. const m___FLT64_HAS_INFINITY__ = 1
  977. const m___FLT64_HAS_QUIET_NAN__ = 1
  978. const m___FLT64_MANT_DIG__ = 53
  979. const m___FLT64_MAX_10_EXP__ = 308
  980. const m___FLT64_MAX_EXP__ = 1024
  981. const m___FLT64_MAX__ = 1.79769313486231570814527423731704357e+308
  982. const m___FLT64_MIN__ = 2.22507385850720138309023271733240406e-308
  983. const m___FLT64_NORM_MAX__ = 1.79769313486231570814527423731704357e+308
  984. const m___FLT_DECIMAL_DIG__ = 9
  985. const m___FLT_DENORM_MIN__ = 1.40129846432481707092372958328991613e-45
  986. const m___FLT_DIG__ = 6
  987. const m___FLT_EPSILON__ = 1.19209289550781250000000000000000000e-7
  988. const m___FLT_EVAL_METHOD_TS_18661_3__ = 0
  989. const m___FLT_EVAL_METHOD__ = 0
  990. const m___FLT_HAS_DENORM__ = 1
  991. const m___FLT_HAS_INFINITY__ = 1
  992. const m___FLT_HAS_QUIET_NAN__ = 1
  993. const m___FLT_MANT_DIG__ = 24
  994. const m___FLT_MAX_10_EXP__ = 38
  995. const m___FLT_MAX_EXP__ = 128
  996. const m___FLT_MAX__ = 3.40282346638528859811704183484516925e+38
  997. const m___FLT_MIN__ = 1.17549435082228750796873653722224568e-38
  998. const m___FLT_NORM_MAX__ = 3.40282346638528859811704183484516925e+38
  999. const m___FLT_RADIX__ = 2
  1000. const m___FP_FAST_FMA = 1
  1001. const m___FP_FAST_FMAF = 1
  1002. const m___FP_FAST_FMAF32 = 1
  1003. const m___FP_FAST_FMAF32x = 1
  1004. const m___FP_FAST_FMAF64 = 1
  1005. const m___FP_FAST_FMAL = 1
  1006. const m___FUNCTION__ = "__func__"
  1007. const m___GCC_ATOMIC_BOOL_LOCK_FREE = 2
  1008. const m___GCC_ATOMIC_CHAR16_T_LOCK_FREE = 2
  1009. const m___GCC_ATOMIC_CHAR32_T_LOCK_FREE = 2
  1010. const m___GCC_ATOMIC_CHAR_LOCK_FREE = 2
  1011. const m___GCC_ATOMIC_INT_LOCK_FREE = 2
  1012. const m___GCC_ATOMIC_LLONG_LOCK_FREE = 2
  1013. const m___GCC_ATOMIC_LONG_LOCK_FREE = 2
  1014. const m___GCC_ATOMIC_POINTER_LOCK_FREE = 2
  1015. const m___GCC_ATOMIC_SHORT_LOCK_FREE = 2
  1016. const m___GCC_ATOMIC_TEST_AND_SET_TRUEVAL = 1
  1017. const m___GCC_ATOMIC_WCHAR_T_LOCK_FREE = 2
  1018. const m___GCC_HAVE_DWARF2_CFI_ASM = 1
  1019. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 = 1
  1020. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 = 1
  1021. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 = 1
  1022. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 = 1
  1023. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 = 1
  1024. const m___GCC_IEC_559 = 2
  1025. const m___GCC_IEC_559_COMPLEX = 2
  1026. const m___GNUC_MINOR__ = 2
  1027. const m___GNUC_PATCHLEVEL__ = 1
  1028. const m___GNUC_STDC_INLINE__ = 1
  1029. const m___GNUC__ = 10
  1030. const m___GXX_ABI_VERSION = 1014
  1031. const m___HAVE_BSWAP__ = 1
  1032. const m___HAVE_GENERIC_SELECTION = 0
  1033. const m___HAVE_SPECULATION_SAFE_VALUE = 1
  1034. const m___HTM__ = 1
  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___LDBL_COMPAT = 1
  1064. const m___LDBL_DECIMAL_DIG__ = 17
  1065. const m___LDBL_DENORM_MIN__ = 4.94065645841246544176568792868221372e-324
  1066. const m___LDBL_DIG__ = 15
  1067. const m___LDBL_EPSILON__ = 2.22044604925031308084726333618164062e-16
  1068. const m___LDBL_HAS_DENORM__ = 1
  1069. const m___LDBL_HAS_INFINITY__ = 1
  1070. const m___LDBL_HAS_QUIET_NAN__ = 1
  1071. const m___LDBL_MANT_DIG__ = 53
  1072. const m___LDBL_MAX_10_EXP__ = 308
  1073. const m___LDBL_MAX_EXP__ = 1024
  1074. const m___LDBL_MAX__ = 1.79769313486231570814527423731704357e+308
  1075. const m___LDBL_MIN__ = 2.22507385850720138309023271733240406e-308
  1076. const m___LDBL_NORM_MAX__ = 1.79769313486231570814527423731704357e+308
  1077. const m___LITTLE_ENDIAN = 1234
  1078. const m___LITTLE_ENDIAN__ = 1
  1079. const m___LONG_DOUBLE_MATH_OPTIONAL = 1
  1080. const m___LONG_DOUBLE_USES_FLOAT128 = 0
  1081. const m___LONG_LONG_MAX__ = 0x7fffffffffffffff
  1082. const m___LONG_LONG_WIDTH__ = 64
  1083. const m___LONG_MAX = 9223372036854775807
  1084. const m___LONG_MAX__ = 0x7fffffffffffffff
  1085. const m___LONG_WIDTH__ = 64
  1086. const m___LP64__ = 1
  1087. const m___NO_INLINE__ = 1
  1088. const m___NO_LONG_DOUBLE_MATH = 1
  1089. const m___ORDER_BIG_ENDIAN__ = 4321
  1090. const m___ORDER_LITTLE_ENDIAN__ = 1234
  1091. const m___ORDER_PDP_ENDIAN__ = 3412
  1092. const m___PDP_ENDIAN = 3412
  1093. const m___PIC__ = 2
  1094. const m___PIE__ = 2
  1095. const m___POWER8_VECTOR__ = 1
  1096. const m___PPC64__ = 1
  1097. const m___PPC__ = 1
  1098. const m___PRAGMA_REDEFINE_EXTNAME = 1
  1099. const m___PRETTY_FUNCTION__ = "__func__"
  1100. const m___PTRDIFF_MAX__ = 0x7fffffffffffffff
  1101. const m___PTRDIFF_WIDTH__ = 64
  1102. const m___QUAD_MEMORY_ATOMIC__ = 1
  1103. const m___RECIPF__ = 1
  1104. const m___RECIP_PRECISION__ = 1
  1105. const m___RECIP__ = 1
  1106. const m___REENTRANT = 1
  1107. const m___RSQRTEF__ = 1
  1108. const m___RSQRTE__ = 1
  1109. const m___SCHAR_MAX__ = 0x7f
  1110. const m___SCHAR_WIDTH__ = 8
  1111. const m___SHRT_MAX__ = 0x7fff
  1112. const m___SHRT_WIDTH__ = 16
  1113. const m___SIG_ATOMIC_MAX__ = 0x7fffffff
  1114. const m___SIG_ATOMIC_TYPE__ = "int"
  1115. const m___SIG_ATOMIC_WIDTH__ = 32
  1116. const m___SIZEOF_DOUBLE__ = 8
  1117. const m___SIZEOF_FLOAT__ = 4
  1118. const m___SIZEOF_INT128__ = 16
  1119. const m___SIZEOF_INT__ = 4
  1120. const m___SIZEOF_LONG_DOUBLE__ = 8
  1121. const m___SIZEOF_LONG_LONG__ = 8
  1122. const m___SIZEOF_LONG__ = 8
  1123. const m___SIZEOF_POINTER__ = 8
  1124. const m___SIZEOF_PTRDIFF_T__ = 8
  1125. const m___SIZEOF_SHORT__ = 2
  1126. const m___SIZEOF_SIZE_T__ = 8
  1127. const m___SIZEOF_WCHAR_T__ = 4
  1128. const m___SIZEOF_WINT_T__ = 4
  1129. const m___SIZE_MAX__ = 0xffffffffffffffff
  1130. const m___SIZE_WIDTH__ = 64
  1131. const m___STDC_HOSTED__ = 1
  1132. const m___STDC_IEC_559_COMPLEX__ = 1
  1133. const m___STDC_IEC_559__ = 1
  1134. const m___STDC_ISO_10646__ = 201706
  1135. const m___STDC_UTF_16__ = 1
  1136. const m___STDC_UTF_32__ = 1
  1137. const m___STDC_VERSION__ = 201710
  1138. const m___STDC_WANT_IEC_60559_ATTRIBS_EXT__ = 1
  1139. const m___STDC_WANT_IEC_60559_BFP_EXT__ = 1
  1140. const m___STDC_WANT_IEC_60559_DFP_EXT__ = 1
  1141. const m___STDC_WANT_IEC_60559_FUNCS_EXT__ = 1
  1142. const m___STDC_WANT_IEC_60559_TYPES_EXT__ = 1
  1143. const m___STDC_WANT_LIB_EXT2__ = 1
  1144. const m___STDC_WANT_MATH_SPEC_FUNCS__ = 1
  1145. const m___STDC__ = 1
  1146. const m___STRUCT_PARM_ALIGN__ = 16
  1147. const m___TM_FENCE__ = 1
  1148. const m___UINT16_MAX__ = 0xffff
  1149. const m___UINT32_MAX__ = 0xffffffff
  1150. const m___UINT64_MAX__ = 0xffffffffffffffff
  1151. const m___UINT8_MAX__ = 0xff
  1152. const m___UINTMAX_MAX__ = 0xffffffffffffffff
  1153. const m___UINTPTR_MAX__ = 0xffffffffffffffff
  1154. const m___UINT_FAST16_MAX__ = 0xffffffffffffffff
  1155. const m___UINT_FAST32_MAX__ = 0xffffffffffffffff
  1156. const m___UINT_FAST64_MAX__ = 0xffffffffffffffff
  1157. const m___UINT_FAST8_MAX__ = 0xff
  1158. const m___UINT_LEAST16_MAX__ = 0xffff
  1159. const m___UINT_LEAST32_MAX__ = 0xffffffff
  1160. const m___UINT_LEAST64_MAX__ = 0xffffffffffffffff
  1161. const m___UINT_LEAST8_MAX__ = 0xff
  1162. const m___USE_TIME_BITS64 = 1
  1163. const m___VEC_ELEMENT_REG_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  1164. const m___VEC__ = 10206
  1165. const m___VERSION__ = "10.2.1 20210110"
  1166. const m___VSX__ = 1
  1167. const m___WCHAR_MAX__ = 0x7fffffff
  1168. const m___WCHAR_TYPE__ = "int"
  1169. const m___WCHAR_WIDTH__ = 32
  1170. const m___WINT_MAX__ = 0xffffffff
  1171. const m___WINT_MIN__ = 0
  1172. const m___WINT_WIDTH__ = 32
  1173. const m___WORDSIZE = 64
  1174. const m___WORDSIZE_TIME64_COMPAT32 = 1
  1175. const m___builtin_copysignq = "__builtin_copysignf128"
  1176. const m___builtin_fabsq = "__builtin_fabsf128"
  1177. const m___builtin_huge_valq = "__builtin_huge_valf128"
  1178. const m___builtin_infq = "__builtin_inff128"
  1179. const m___builtin_nanq = "__builtin_nanf128"
  1180. const m___builtin_nansq = "__builtin_nansf128"
  1181. const m___builtin_vsx_vperm = "__builtin_vec_perm"
  1182. const m___builtin_vsx_xvmaddadp = "__builtin_vsx_xvmadddp"
  1183. const m___builtin_vsx_xvmaddasp = "__builtin_vsx_xvmaddsp"
  1184. const m___builtin_vsx_xvmaddmdp = "__builtin_vsx_xvmadddp"
  1185. const m___builtin_vsx_xvmaddmsp = "__builtin_vsx_xvmaddsp"
  1186. const m___builtin_vsx_xvmsubadp = "__builtin_vsx_xvmsubdp"
  1187. const m___builtin_vsx_xvmsubasp = "__builtin_vsx_xvmsubsp"
  1188. const m___builtin_vsx_xvmsubmdp = "__builtin_vsx_xvmsubdp"
  1189. const m___builtin_vsx_xvmsubmsp = "__builtin_vsx_xvmsubsp"
  1190. const m___builtin_vsx_xvnmaddadp = "__builtin_vsx_xvnmadddp"
  1191. const m___builtin_vsx_xvnmaddasp = "__builtin_vsx_xvnmaddsp"
  1192. const m___builtin_vsx_xvnmaddmdp = "__builtin_vsx_xvnmadddp"
  1193. const m___builtin_vsx_xvnmaddmsp = "__builtin_vsx_xvnmaddsp"
  1194. const m___builtin_vsx_xvnmsubadp = "__builtin_vsx_xvnmsubdp"
  1195. const m___builtin_vsx_xvnmsubasp = "__builtin_vsx_xvnmsubsp"
  1196. const m___builtin_vsx_xvnmsubmdp = "__builtin_vsx_xvnmsubdp"
  1197. const m___builtin_vsx_xvnmsubmsp = "__builtin_vsx_xvnmsubsp"
  1198. const m___builtin_vsx_xxland = "__builtin_vec_and"
  1199. const m___builtin_vsx_xxlandc = "__builtin_vec_andc"
  1200. const m___builtin_vsx_xxlnor = "__builtin_vec_nor"
  1201. const m___builtin_vsx_xxlor = "__builtin_vec_or"
  1202. const m___builtin_vsx_xxlxor = "__builtin_vec_xor"
  1203. const m___builtin_vsx_xxsel = "__builtin_vec_sel"
  1204. const m___float128 = "__ieee128"
  1205. const m___glibc_c99_flexarr_available = 1
  1206. const m___gnu_linux__ = 1
  1207. const m___inline = "inline"
  1208. const m___linux = 1
  1209. const m___linux__ = 1
  1210. const m___pic__ = 2
  1211. const m___pie__ = 2
  1212. const m___powerpc64__ = 1
  1213. const m___powerpc__ = 1
  1214. const m___restrict = "restrict"
  1215. const m___ucontext = "ucontext"
  1216. const m___unix = 1
  1217. const m___unix__ = 1
  1218. const m_alloca = "__builtin_alloca"
  1219. const m_linux = 1
  1220. const m_unix = 1
  1221. type t__builtin_va_list = uintptr
  1222. type t__predefined_size_t = uint64
  1223. type t__predefined_wchar_t = int32
  1224. type t__predefined_ptrdiff_t = int64
  1225. type Tsize_t = uint64
  1226. type Tssize_t = int64
  1227. type Tregister_t = int64
  1228. type Ttime_t = int64
  1229. type Tsuseconds_t = int64
  1230. type Tint8_t = int8
  1231. type Tint16_t = int16
  1232. type Tint32_t = int32
  1233. type Tint64_t = int64
  1234. type Tu_int64_t = uint64
  1235. type Tmode_t = uint32
  1236. type Tnlink_t = uint64
  1237. type Toff_t = int64
  1238. type Tino_t = uint64
  1239. type Tdev_t = uint64
  1240. type Tblksize_t = int64
  1241. type Tblkcnt_t = int64
  1242. type Tfsblkcnt_t = uint64
  1243. type Tfsfilcnt_t = uint64
  1244. type Ttimer_t = uintptr
  1245. type Tclockid_t = int32
  1246. type Tclock_t = int64
  1247. type Tpid_t = int32
  1248. type Tid_t = uint32
  1249. type Tuid_t = uint32
  1250. type Tgid_t = uint32
  1251. type Tkey_t = int32
  1252. type Tuseconds_t = uint32
  1253. type Tpthread_t = uintptr
  1254. type Tpthread_once_t = int32
  1255. type Tpthread_key_t = uint32
  1256. type Tpthread_spinlock_t = int32
  1257. type Tpthread_mutexattr_t = struct {
  1258. F__attr uint32
  1259. }
  1260. type Tpthread_condattr_t = struct {
  1261. F__attr uint32
  1262. }
  1263. type Tpthread_barrierattr_t = struct {
  1264. F__attr uint32
  1265. }
  1266. type Tpthread_rwlockattr_t = struct {
  1267. F__attr [2]uint32
  1268. }
  1269. type Tpthread_attr_t = struct {
  1270. F__u struct {
  1271. F__vi [0][14]int32
  1272. F__s [0][7]uint64
  1273. F__i [14]int32
  1274. }
  1275. }
  1276. type Tpthread_mutex_t = struct {
  1277. F__u struct {
  1278. F__vi [0][10]int32
  1279. F__p [0][5]uintptr
  1280. F__i [10]int32
  1281. }
  1282. }
  1283. type Tpthread_cond_t = struct {
  1284. F__u struct {
  1285. F__vi [0][12]int32
  1286. F__p [0][6]uintptr
  1287. F__i [12]int32
  1288. }
  1289. }
  1290. type Tpthread_rwlock_t = struct {
  1291. F__u struct {
  1292. F__vi [0][14]int32
  1293. F__p [0][7]uintptr
  1294. F__i [14]int32
  1295. }
  1296. }
  1297. type Tpthread_barrier_t = struct {
  1298. F__u struct {
  1299. F__vi [0][8]int32
  1300. F__p [0][4]uintptr
  1301. F__i [8]int32
  1302. }
  1303. }
  1304. type Tu_int8_t = uint8
  1305. type Tu_int16_t = uint16
  1306. type Tu_int32_t = uint32
  1307. type Tcaddr_t = uintptr
  1308. type Tu_char = uint8
  1309. type Tu_short = uint16
  1310. type Tushort = uint16
  1311. type Tu_int = uint32
  1312. type Tuint = uint32
  1313. type Tu_long = uint64
  1314. type Tulong = uint64
  1315. type Tquad_t = int64
  1316. type Tu_quad_t = uint64
  1317. type Tuint16_t = uint16
  1318. type Tuint32_t = uint32
  1319. type Tuint64_t = uint64
  1320. type Ttimeval = struct {
  1321. Ftv_sec Ttime_t
  1322. Ftv_usec Tsuseconds_t
  1323. }
  1324. type Ttimespec = struct {
  1325. Ftv_sec Ttime_t
  1326. Ftv_nsec int64
  1327. }
  1328. type Tsigset_t = struct {
  1329. F__bits [16]uint64
  1330. }
  1331. type t__sigset_t = Tsigset_t
  1332. type Tfd_mask = uint64
  1333. type Tfd_set = struct {
  1334. Ffds_bits [16]uint64
  1335. }
  1336. type Tstat = struct {
  1337. Fst_dev Tdev_t
  1338. Fst_ino Tino_t
  1339. Fst_nlink Tnlink_t
  1340. Fst_mode Tmode_t
  1341. Fst_uid Tuid_t
  1342. Fst_gid Tgid_t
  1343. Fst_rdev Tdev_t
  1344. Fst_size Toff_t
  1345. Fst_blksize Tblksize_t
  1346. Fst_blocks Tblkcnt_t
  1347. Fst_atim Ttimespec
  1348. Fst_mtim Ttimespec
  1349. Fst_ctim Ttimespec
  1350. F__unused [3]uint64
  1351. }
  1352. type Tstatx_timestamp = struct {
  1353. Ftv_sec Tint64_t
  1354. Ftv_nsec Tuint32_t
  1355. F__pad Tuint32_t
  1356. }
  1357. type Tstatx = struct {
  1358. Fstx_mask Tuint32_t
  1359. Fstx_blksize Tuint32_t
  1360. Fstx_attributes Tuint64_t
  1361. Fstx_nlink Tuint32_t
  1362. Fstx_uid Tuint32_t
  1363. Fstx_gid Tuint32_t
  1364. Fstx_mode Tuint16_t
  1365. F__pad0 [1]Tuint16_t
  1366. Fstx_ino Tuint64_t
  1367. Fstx_size Tuint64_t
  1368. Fstx_blocks Tuint64_t
  1369. Fstx_attributes_mask Tuint64_t
  1370. Fstx_atime Tstatx_timestamp
  1371. Fstx_btime Tstatx_timestamp
  1372. Fstx_ctime Tstatx_timestamp
  1373. Fstx_mtime Tstatx_timestamp
  1374. Fstx_rdev_major Tuint32_t
  1375. Fstx_rdev_minor Tuint32_t
  1376. Fstx_dev_major Tuint32_t
  1377. Fstx_dev_minor Tuint32_t
  1378. F__pad1 [14]Tuint64_t
  1379. }
  1380. type Twchar_t = int32
  1381. type Tmax_align_t = struct {
  1382. F__ll int64
  1383. F__ld float64
  1384. }
  1385. type Tptrdiff_t = int64
  1386. type Tlocale_t = uintptr
  1387. type Tstack_t = struct {
  1388. Fss_sp uintptr
  1389. Fss_flags int32
  1390. Fss_size Tsize_t
  1391. }
  1392. type Tsigaltstack = Tstack_t
  1393. type Tgreg_t = uint64
  1394. type Tgregset_t = [48]uint64
  1395. type Tfpregset_t = [33]float64
  1396. type Tvrregset_t = struct {
  1397. F__ccgo_align [0]uint64
  1398. Fvrregs [32][4]uint32
  1399. Fvscr struct {
  1400. Fvscr_word uint32
  1401. F_pad [3]uint32
  1402. }
  1403. Fvrsave uint32
  1404. F_pad [3]uint32
  1405. }
  1406. type Tmcontext_t = struct {
  1407. F_unused [4]uint64
  1408. Fsignal int32
  1409. F_pad0 int32
  1410. Fhandler uint64
  1411. Foldmask uint64
  1412. Fregs uintptr
  1413. Fgp_regs Tgregset_t
  1414. Ffp_regs Tfpregset_t
  1415. Fv_regs uintptr
  1416. Fvmx_reserve [101]int64
  1417. }
  1418. type Tsigcontext = Tmcontext_t
  1419. type Tucontext_t = struct {
  1420. Fuc_flags uint64
  1421. Fuc_link uintptr
  1422. Fuc_stack Tstack_t
  1423. Fuc_sigmask Tsigset_t
  1424. Fuc_mcontext Tmcontext_t
  1425. }
  1426. type Tucontext = Tucontext_t
  1427. type Tsigval = struct {
  1428. Fsival_ptr [0]uintptr
  1429. Fsival_int int32
  1430. F__ccgo_pad2 [4]byte
  1431. }
  1432. type Tsiginfo_t = struct {
  1433. Fsi_signo int32
  1434. Fsi_errno int32
  1435. Fsi_code int32
  1436. F__si_fields struct {
  1437. F__si_common [0]struct {
  1438. F__first struct {
  1439. F__timer [0]struct {
  1440. Fsi_timerid int32
  1441. Fsi_overrun int32
  1442. }
  1443. F__piduid struct {
  1444. Fsi_pid Tpid_t
  1445. Fsi_uid Tuid_t
  1446. }
  1447. }
  1448. F__second struct {
  1449. F__sigchld [0]struct {
  1450. Fsi_status int32
  1451. Fsi_utime Tclock_t
  1452. Fsi_stime Tclock_t
  1453. }
  1454. Fsi_value Tsigval
  1455. F__ccgo_pad2 [16]byte
  1456. }
  1457. }
  1458. F__sigfault [0]struct {
  1459. Fsi_addr uintptr
  1460. Fsi_addr_lsb int16
  1461. F__first struct {
  1462. Fsi_pkey [0]uint32
  1463. F__addr_bnd struct {
  1464. Fsi_lower uintptr
  1465. Fsi_upper uintptr
  1466. }
  1467. }
  1468. }
  1469. F__sigpoll [0]struct {
  1470. Fsi_band int64
  1471. Fsi_fd int32
  1472. }
  1473. F__sigsys [0]struct {
  1474. Fsi_call_addr uintptr
  1475. Fsi_syscall int32
  1476. Fsi_arch uint32
  1477. }
  1478. F__pad [112]uint8
  1479. }
  1480. }
  1481. type Tsigaction = struct {
  1482. F__sa_handler struct {
  1483. Fsa_sigaction [0]uintptr
  1484. Fsa_handler uintptr
  1485. }
  1486. Fsa_mask Tsigset_t
  1487. Fsa_flags int32
  1488. Fsa_restorer uintptr
  1489. }
  1490. type Tsigevent = struct {
  1491. Fsigev_value Tsigval
  1492. Fsigev_signo int32
  1493. Fsigev_notify int32
  1494. F__sev_fields struct {
  1495. Fsigev_notify_thread_id [0]Tpid_t
  1496. F__sev_thread [0]struct {
  1497. Fsigev_notify_function uintptr
  1498. Fsigev_notify_attributes uintptr
  1499. }
  1500. F__pad [48]uint8
  1501. }
  1502. }
  1503. type Tsig_t = uintptr
  1504. type Tsighandler_t = uintptr
  1505. type Tsig_atomic_t = int32
  1506. type Tdiv_t = struct {
  1507. Fquot int32
  1508. Frem int32
  1509. }
  1510. type Tldiv_t = struct {
  1511. Fquot int64
  1512. Frem int64
  1513. }
  1514. type Tlldiv_t = struct {
  1515. Fquot int64
  1516. Frem int64
  1517. }
  1518. type Tuintptr_t = uint64
  1519. type Tintptr_t = int64
  1520. type Tintmax_t = int64
  1521. type Tuint8_t = uint8
  1522. type Tuintmax_t = uint64
  1523. type Tint_fast8_t = int8
  1524. type Tint_fast64_t = int64
  1525. type Tint_least8_t = int8
  1526. type Tint_least16_t = int16
  1527. type Tint_least32_t = int32
  1528. type Tint_least64_t = int64
  1529. type Tuint_fast8_t = uint8
  1530. type Tuint_fast64_t = uint64
  1531. type Tuint_least8_t = uint8
  1532. type Tuint_least16_t = uint16
  1533. type Tuint_least32_t = uint32
  1534. type Tuint_least64_t = uint64
  1535. type Tint_fast16_t = int32
  1536. type Tint_fast32_t = int32
  1537. type Tuint_fast16_t = uint32
  1538. type Tuint_fast32_t = uint32
  1539. type Tva_list = uintptr
  1540. type t__isoc_va_list = uintptr
  1541. type Tfpos_t = struct {
  1542. F__lldata [0]int64
  1543. F__align [0]float64
  1544. F__opaque [16]uint8
  1545. }
  1546. type T_G_fpos64_t = Tfpos_t
  1547. type Tcookie_io_functions_t = struct {
  1548. Fread uintptr
  1549. Fwrite uintptr
  1550. Fseek uintptr
  1551. Fclose1 uintptr
  1552. }
  1553. type T_IO_cookie_io_functions_t = Tcookie_io_functions_t
  1554. type TBITCMD = struct {
  1555. Fcmd uint8
  1556. Fcmd2 uint8
  1557. Fbits Tmode_t
  1558. }
  1559. type Tbitcmd = TBITCMD
  1560. // C documentation
  1561. //
  1562. // /*
  1563. // * Given the old mode and an array of bitcmd structures, apply the operations
  1564. // * described in the bitcmd structures to the old mode, and return the new mode.
  1565. // * Note that there is no '=' command; a strict assignment is just a '-' (clear
  1566. // * bits) followed by a '+' (set bits).
  1567. // */
  1568. func Xgetmode(tls *libc.TLS, bbox uintptr, omode Tmode_t) (r Tmode_t) {
  1569. var clrval, newmode, value Tmode_t
  1570. var set uintptr
  1571. var v11 uint32
  1572. _, _, _, _, _ = clrval, newmode, set, value, v11
  1573. set = bbox
  1574. newmode = omode
  1575. value = uint32(0)
  1576. for {
  1577. switch libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd) {
  1578. case int32('u'):
  1579. goto _2
  1580. case int32('g'):
  1581. goto _3
  1582. case int32('o'):
  1583. goto _4
  1584. case int32('+'):
  1585. goto _5
  1586. case int32('-'):
  1587. goto _6
  1588. case int32('X'):
  1589. goto _7
  1590. default:
  1591. goto _8
  1592. case int32('\000'):
  1593. goto _9
  1594. }
  1595. goto _10
  1596. /*
  1597. * When copying the user, group or other bits around, we "know"
  1598. * where the bits are in the mode so that we can do shifts to
  1599. * copy them around. If we don't use shifts, it gets real
  1600. * grundgy with lots of single bit checks and bit sets.
  1601. */
  1602. _2:
  1603. ;
  1604. value = newmode & uint32(m_S_IRWXU) >> int32(6)
  1605. goto common
  1606. _3:
  1607. ;
  1608. value = newmode & uint32(m_S_IRWXG) >> int32(3)
  1609. goto common
  1610. _4:
  1611. ;
  1612. value = newmode & uint32(m_S_IRWXO)
  1613. goto common
  1614. common:
  1615. ;
  1616. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_CLR) != 0 {
  1617. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_SET) != 0 {
  1618. v11 = uint32(m_S_IRWXO)
  1619. } else {
  1620. v11 = value
  1621. }
  1622. clrval = v11
  1623. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_UBITS) != 0 {
  1624. newmode &= ^(clrval << libc.Int32FromInt32(6) & (*TBITCMD)(unsafe.Pointer(set)).Fbits)
  1625. }
  1626. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_GBITS) != 0 {
  1627. newmode &= ^(clrval << libc.Int32FromInt32(3) & (*TBITCMD)(unsafe.Pointer(set)).Fbits)
  1628. }
  1629. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_OBITS) != 0 {
  1630. newmode &= ^(clrval & (*TBITCMD)(unsafe.Pointer(set)).Fbits)
  1631. }
  1632. }
  1633. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_SET) != 0 {
  1634. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_UBITS) != 0 {
  1635. newmode |= value << libc.Int32FromInt32(6) & (*TBITCMD)(unsafe.Pointer(set)).Fbits
  1636. }
  1637. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_GBITS) != 0 {
  1638. newmode |= value << libc.Int32FromInt32(3) & (*TBITCMD)(unsafe.Pointer(set)).Fbits
  1639. }
  1640. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_OBITS) != 0 {
  1641. newmode |= value & (*TBITCMD)(unsafe.Pointer(set)).Fbits
  1642. }
  1643. }
  1644. goto _10
  1645. _5:
  1646. ;
  1647. newmode |= (*TBITCMD)(unsafe.Pointer(set)).Fbits
  1648. goto _10
  1649. _6:
  1650. ;
  1651. newmode &= ^(*TBITCMD)(unsafe.Pointer(set)).Fbits
  1652. goto _10
  1653. _7:
  1654. ;
  1655. 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 {
  1656. newmode |= (*TBITCMD)(unsafe.Pointer(set)).Fbits
  1657. }
  1658. goto _10
  1659. _9:
  1660. ;
  1661. _8:
  1662. ;
  1663. return newmode
  1664. _10:
  1665. ;
  1666. goto _1
  1667. _1:
  1668. ;
  1669. set += 8
  1670. }
  1671. return r
  1672. }
  1673. func Xsetmode(tls *libc.TLS, p uintptr) (r uintptr) {
  1674. bp := tls.Alloc(272)
  1675. defer tls.Free(272)
  1676. var endset, newset, newset1, newset2, newset3, newset4, newset5, saveset, set, v5 uintptr
  1677. var equalopdone, serrno, setlen int32
  1678. var lval int64
  1679. var mask, perm, permXbits, who, v1 Tmode_t
  1680. var op, v4 uint8
  1681. var setdiff, setdiff1, setdiff2, setdiff3, setdiff4, setdiff5 Tptrdiff_t
  1682. var _ /* ep at bp+0 */ uintptr
  1683. var _ /* signset at bp+8 */ Tsigset_t
  1684. var _ /* sigoset at bp+136 */ Tsigset_t
  1685. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  1686. equalopdone = 0
  1687. if !(*(*uint8)(unsafe.Pointer(p)) != 0) {
  1688. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  1689. return libc.UintptrFromInt32(0)
  1690. }
  1691. /*
  1692. * Get a copy of the mask for the permissions that are mask relative.
  1693. * Flip the bits, we want what's not set. Since it's possible that
  1694. * the caller is opening files inside a signal handler, protect them
  1695. * as best we can.
  1696. */
  1697. libc.Xsigfillset(tls, bp+8)
  1698. libc.Xsigprocmask(tls, m_SIG_BLOCK, bp+8, bp+136)
  1699. v1 = libc.Xumask(tls, uint32(0))
  1700. mask = v1
  1701. libc.Xumask(tls, v1)
  1702. mask = ^mask
  1703. libc.Xsigprocmask(tls, int32(m_SIG_SETMASK), bp+136, libc.UintptrFromInt32(0))
  1704. setlen = libc.Int32FromInt32(m_SET_LEN) + libc.Int32FromInt32(2)
  1705. set = Xreallocarray(tls, libc.UintptrFromInt32(0), libc.Uint64FromInt32(setlen), uint64(8))
  1706. if set == libc.UintptrFromInt32(0) {
  1707. return libc.UintptrFromInt32(0)
  1708. }
  1709. saveset = set
  1710. endset = set + uintptr(setlen-libc.Int32FromInt32(2))*8
  1711. /*
  1712. * If an absolute number, get it and return; disallow non-octal digits
  1713. * or illegal bits.
  1714. */
  1715. if libc.BoolInt32(uint32(*(*uint8)(unsafe.Pointer(p)))-uint32('0') < uint32(10)) != 0 {
  1716. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  1717. lval = libc.Xstrtol(tls, p, bp, int32(8))
  1718. if *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))) != 0 {
  1719. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  1720. goto out
  1721. }
  1722. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_ERANGE) && (lval == int64(0x7fffffffffffffff) || lval == -libc.Int64FromInt64(0x7fffffffffffffff)-libc.Int64FromInt32(1)) {
  1723. goto out
  1724. }
  1725. 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 {
  1726. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  1727. goto out
  1728. }
  1729. perm = libc.Uint32FromInt64(lval)
  1730. if set >= endset {
  1731. setdiff = (int64(set) - int64(saveset)) / 8
  1732. setlen += int32(m_SET_LEN_INCR)
  1733. newset = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  1734. if newset == libc.UintptrFromInt32(0) {
  1735. goto out
  1736. }
  1737. set = newset + uintptr(setdiff)*8
  1738. saveset = newset
  1739. endset = newset + uintptr(setlen-libc.Int32FromInt32(2))*8
  1740. }
  1741. 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)
  1742. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8(0)
  1743. return saveset
  1744. }
  1745. /*
  1746. * Build list of structures to set/clear/copy bits as described by
  1747. * each clause of the symbolic mode.
  1748. */
  1749. for {
  1750. /* First, find out which bits might be modified. */
  1751. who = uint32(0)
  1752. for {
  1753. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) {
  1754. case int32('a'):
  1755. 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))
  1756. case int32('u'):
  1757. who |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_ISUID) | libc.Int32FromInt32(m_S_IRWXU))
  1758. case int32('g'):
  1759. who |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_ISGID) | libc.Int32FromInt32(m_S_IRWXG))
  1760. case int32('o'):
  1761. who |= uint32(m_S_IRWXO)
  1762. default:
  1763. goto getop
  1764. }
  1765. goto _3
  1766. _3:
  1767. ;
  1768. p++
  1769. }
  1770. goto getop
  1771. getop:
  1772. ;
  1773. v5 = p
  1774. p++
  1775. v4 = *(*uint8)(unsafe.Pointer(v5))
  1776. op = v4
  1777. if libc.Int32FromUint8(v4) != int32('+') && libc.Int32FromUint8(op) != int32('-') && libc.Int32FromUint8(op) != int32('=') {
  1778. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  1779. goto out
  1780. }
  1781. if libc.Int32FromUint8(op) == int32('=') {
  1782. equalopdone = 0
  1783. }
  1784. who &= libc.Uint32FromInt32(^libc.Int32FromInt32(m_S_ISVTX))
  1785. perm = uint32(0)
  1786. permXbits = libc.Uint32FromInt32(0)
  1787. for {
  1788. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) {
  1789. case int32('r'):
  1790. perm |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IRUSR) | libc.Int32FromInt32(m_S_IRGRP) | libc.Int32FromInt32(m_S_IROTH))
  1791. case int32('s'):
  1792. /*
  1793. * If specific bits where requested and
  1794. * only "other" bits ignore set-id.
  1795. */
  1796. if who == uint32(0) || who&libc.Uint32FromInt32(^libc.Int32FromInt32(m_S_IRWXO)) != 0 {
  1797. perm |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_ISUID) | libc.Int32FromInt32(m_S_ISGID))
  1798. }
  1799. case int32('t'):
  1800. /*
  1801. * If specific bits where requested and
  1802. * only "other" bits ignore set-id.
  1803. */
  1804. if who == uint32(0) || who&libc.Uint32FromInt32(^libc.Int32FromInt32(m_S_IRWXO)) != 0 {
  1805. who |= uint32(m_S_ISVTX)
  1806. perm |= uint32(m_S_ISVTX)
  1807. }
  1808. case int32('w'):
  1809. perm |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IWUSR) | libc.Int32FromInt32(m_S_IWGRP) | libc.Int32FromInt32(m_S_IWOTH))
  1810. case int32('X'):
  1811. permXbits = libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXUSR) | libc.Int32FromInt32(m_S_IXGRP) | libc.Int32FromInt32(m_S_IXOTH))
  1812. case int32('x'):
  1813. perm |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXUSR) | libc.Int32FromInt32(m_S_IXGRP) | libc.Int32FromInt32(m_S_IXOTH))
  1814. case int32('u'):
  1815. fallthrough
  1816. case int32('g'):
  1817. fallthrough
  1818. case int32('o'):
  1819. /*
  1820. * When ever we hit 'u', 'g', or 'o', we have
  1821. * to flush out any partial mode that we have,
  1822. * and then do the copying of the mode bits.
  1823. */
  1824. if perm != 0 {
  1825. if set >= endset {
  1826. setdiff1 = (int64(set) - int64(saveset)) / 8
  1827. setlen += int32(m_SET_LEN_INCR)
  1828. newset1 = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  1829. if newset1 == libc.UintptrFromInt32(0) {
  1830. goto out
  1831. }
  1832. set = newset1 + uintptr(setdiff1)*8
  1833. saveset = newset1
  1834. endset = newset1 + uintptr(setlen-libc.Int32FromInt32(2))*8
  1835. }
  1836. set = _addcmd(tls, set, uint32(op), who, perm, mask)
  1837. perm = uint32(0)
  1838. }
  1839. if libc.Int32FromUint8(op) == int32('=') {
  1840. equalopdone = int32(1)
  1841. }
  1842. if libc.Int32FromUint8(op) == int32('+') && permXbits != 0 {
  1843. if set >= endset {
  1844. setdiff2 = (int64(set) - int64(saveset)) / 8
  1845. setlen += int32(m_SET_LEN_INCR)
  1846. newset2 = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  1847. if newset2 == libc.UintptrFromInt32(0) {
  1848. goto out
  1849. }
  1850. set = newset2 + uintptr(setdiff2)*8
  1851. saveset = newset2
  1852. endset = newset2 + uintptr(setlen-libc.Int32FromInt32(2))*8
  1853. }
  1854. set = _addcmd(tls, set, libc.Uint32FromInt32(libc.Int32FromUint8('X')), who, permXbits, mask)
  1855. permXbits = uint32(0)
  1856. }
  1857. if set >= endset {
  1858. setdiff3 = (int64(set) - int64(saveset)) / 8
  1859. setlen += int32(m_SET_LEN_INCR)
  1860. newset3 = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  1861. if newset3 == libc.UintptrFromInt32(0) {
  1862. goto out
  1863. }
  1864. set = newset3 + uintptr(setdiff3)*8
  1865. saveset = newset3
  1866. endset = newset3 + uintptr(setlen-libc.Int32FromInt32(2))*8
  1867. }
  1868. set = _addcmd(tls, set, uint32(*(*uint8)(unsafe.Pointer(p))), who, uint32(op), mask)
  1869. default:
  1870. /*
  1871. * Add any permissions that we haven't already
  1872. * done.
  1873. */
  1874. if perm != 0 || libc.Int32FromUint8(op) == int32('=') && !(equalopdone != 0) {
  1875. if libc.Int32FromUint8(op) == int32('=') {
  1876. equalopdone = int32(1)
  1877. }
  1878. if set >= endset {
  1879. setdiff4 = (int64(set) - int64(saveset)) / 8
  1880. setlen += int32(m_SET_LEN_INCR)
  1881. newset4 = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  1882. if newset4 == libc.UintptrFromInt32(0) {
  1883. goto out
  1884. }
  1885. set = newset4 + uintptr(setdiff4)*8
  1886. saveset = newset4
  1887. endset = newset4 + uintptr(setlen-libc.Int32FromInt32(2))*8
  1888. }
  1889. set = _addcmd(tls, set, uint32(op), who, perm, mask)
  1890. perm = uint32(0)
  1891. }
  1892. if permXbits != 0 {
  1893. if set >= endset {
  1894. setdiff5 = (int64(set) - int64(saveset)) / 8
  1895. setlen += int32(m_SET_LEN_INCR)
  1896. newset5 = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  1897. if newset5 == libc.UintptrFromInt32(0) {
  1898. goto out
  1899. }
  1900. set = newset5 + uintptr(setdiff5)*8
  1901. saveset = newset5
  1902. endset = newset5 + uintptr(setlen-libc.Int32FromInt32(2))*8
  1903. }
  1904. set = _addcmd(tls, set, libc.Uint32FromInt32(libc.Int32FromUint8('X')), who, permXbits, mask)
  1905. permXbits = uint32(0)
  1906. }
  1907. goto apply
  1908. }
  1909. goto _6
  1910. _6:
  1911. ;
  1912. p++
  1913. }
  1914. goto apply
  1915. apply:
  1916. ;
  1917. if !(*(*uint8)(unsafe.Pointer(p)) != 0) {
  1918. break
  1919. }
  1920. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) != int32(',') {
  1921. goto getop
  1922. }
  1923. p++
  1924. goto _2
  1925. _2:
  1926. }
  1927. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8(0)
  1928. _compress_mode(tls, saveset)
  1929. return saveset
  1930. goto out
  1931. out:
  1932. ;
  1933. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  1934. libc.Xfree(tls, saveset)
  1935. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  1936. return libc.UintptrFromInt32(0)
  1937. }
  1938. func _addcmd(tls *libc.TLS, set uintptr, op Tmode_t, who Tmode_t, oparg Tmode_t, mask Tmode_t) (r uintptr) {
  1939. var v1, v2 uint32
  1940. var v3, v4, v5 int32
  1941. var p6, p7, p8 uintptr
  1942. _, _, _, _, _, _, _, _ = v1, v2, v3, v4, v5, p6, p7, p8
  1943. switch op {
  1944. case uint32('='):
  1945. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8('-')
  1946. if who != 0 {
  1947. v1 = who
  1948. } else {
  1949. 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))
  1950. }
  1951. (*TBITCMD)(unsafe.Pointer(set)).Fbits = v1
  1952. set += 8
  1953. op = uint32('+')
  1954. /* FALLTHROUGH */
  1955. fallthrough
  1956. case uint32('+'):
  1957. fallthrough
  1958. case uint32('-'):
  1959. fallthrough
  1960. case uint32('X'):
  1961. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8(op)
  1962. if who != 0 {
  1963. v2 = who
  1964. } else {
  1965. v2 = mask
  1966. }
  1967. (*TBITCMD)(unsafe.Pointer(set)).Fbits = v2 & oparg
  1968. case uint32('u'):
  1969. fallthrough
  1970. case uint32('g'):
  1971. fallthrough
  1972. case uint32('o'):
  1973. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8(op)
  1974. if who != 0 {
  1975. if who&uint32(m_S_IRUSR) != 0 {
  1976. v3 = int32(m_CMD2_UBITS)
  1977. } else {
  1978. v3 = 0
  1979. }
  1980. if who&uint32(m_S_IRGRP) != 0 {
  1981. v4 = int32(m_CMD2_GBITS)
  1982. } else {
  1983. v4 = 0
  1984. }
  1985. if who&uint32(m_S_IROTH) != 0 {
  1986. v5 = int32(m_CMD2_OBITS)
  1987. } else {
  1988. v5 = 0
  1989. }
  1990. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = libc.Uint8FromInt32(v3 | v4 | v5)
  1991. (*TBITCMD)(unsafe.Pointer(set)).Fbits = libc.Uint32FromInt32(^libc.Int32FromInt32(0))
  1992. } else {
  1993. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = libc.Uint8FromInt32(libc.Int32FromInt32(m_CMD2_UBITS) | libc.Int32FromInt32(m_CMD2_GBITS) | libc.Int32FromInt32(m_CMD2_OBITS))
  1994. (*TBITCMD)(unsafe.Pointer(set)).Fbits = mask
  1995. }
  1996. if oparg == uint32('+') {
  1997. p6 = set + 1
  1998. *(*uint8)(unsafe.Pointer(p6)) = uint8(int32(*(*uint8)(unsafe.Pointer(p6))) | libc.Int32FromInt32(m_CMD2_SET))
  1999. } else {
  2000. if oparg == uint32('-') {
  2001. p7 = set + 1
  2002. *(*uint8)(unsafe.Pointer(p7)) = uint8(int32(*(*uint8)(unsafe.Pointer(p7))) | libc.Int32FromInt32(m_CMD2_CLR))
  2003. } else {
  2004. if oparg == uint32('=') {
  2005. p8 = set + 1
  2006. *(*uint8)(unsafe.Pointer(p8)) = uint8(int32(*(*uint8)(unsafe.Pointer(p8))) | (libc.Int32FromInt32(m_CMD2_SET) | libc.Int32FromInt32(m_CMD2_CLR)))
  2007. }
  2008. }
  2009. }
  2010. break
  2011. }
  2012. return set + libc.UintptrFromInt32(1)*8
  2013. }
  2014. // C documentation
  2015. //
  2016. // /*
  2017. // * Given an array of bitcmd structures, compress by compacting consecutive
  2018. // * '+', '-' and 'X' commands into at most 3 commands, one of each. The 'u',
  2019. // * 'g' and 'o' commands continue to be separate. They could probably be
  2020. // * compacted, but it's not worth the effort.
  2021. // */
  2022. func _compress_mode(tls *libc.TLS, set uintptr) {
  2023. var Xbits, clrbits, op, setbits, v2, v6, v7, v8 int32
  2024. var nset, v3, v4 uintptr
  2025. _, _, _, _, _, _, _, _, _, _, _ = Xbits, clrbits, nset, op, setbits, v2, v3, v4, v6, v7, v8
  2026. nset = set
  2027. for {
  2028. /* Copy over any 'u', 'g' and 'o' commands. */
  2029. for {
  2030. v2 = libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(nset)).Fcmd)
  2031. op = v2
  2032. if !(v2 != int32('+') && op != int32('-') && op != int32('X')) {
  2033. break
  2034. }
  2035. v3 = set
  2036. set += 8
  2037. v4 = nset
  2038. nset += 8
  2039. *(*TBITCMD)(unsafe.Pointer(v3)) = *(*TBITCMD)(unsafe.Pointer(v4))
  2040. if !(op != 0) {
  2041. return
  2042. }
  2043. }
  2044. v7 = libc.Int32FromInt32(0)
  2045. Xbits = v7
  2046. v6 = v7
  2047. clrbits = v6
  2048. setbits = v6
  2049. for {
  2050. v8 = libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(nset)).Fcmd)
  2051. op = v8
  2052. if v8 == int32('-') {
  2053. clrbits = int32(uint32(clrbits) | (*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  2054. setbits = int32(uint32(setbits) & ^(*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  2055. Xbits = int32(uint32(Xbits) & ^(*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  2056. } else {
  2057. if op == int32('+') {
  2058. setbits = int32(uint32(setbits) | (*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  2059. clrbits = int32(uint32(clrbits) & ^(*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  2060. Xbits = int32(uint32(Xbits) & ^(*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  2061. } else {
  2062. if op == int32('X') {
  2063. Xbits = int32(uint32(Xbits) | (*TBITCMD)(unsafe.Pointer(nset)).Fbits&libc.Uint32FromInt32(^setbits))
  2064. } else {
  2065. break
  2066. }
  2067. }
  2068. }
  2069. goto _5
  2070. _5:
  2071. ;
  2072. nset += 8
  2073. }
  2074. if clrbits != 0 {
  2075. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8('-')
  2076. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = uint8(0)
  2077. (*TBITCMD)(unsafe.Pointer(set)).Fbits = libc.Uint32FromInt32(clrbits)
  2078. set += 8
  2079. }
  2080. if setbits != 0 {
  2081. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8('+')
  2082. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = uint8(0)
  2083. (*TBITCMD)(unsafe.Pointer(set)).Fbits = libc.Uint32FromInt32(setbits)
  2084. set += 8
  2085. }
  2086. if Xbits != 0 {
  2087. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8('X')
  2088. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = uint8(0)
  2089. (*TBITCMD)(unsafe.Pointer(set)).Fbits = libc.Uint32FromInt32(Xbits)
  2090. set += 8
  2091. }
  2092. goto _1
  2093. _1:
  2094. }
  2095. }
  2096. const m_AT_EACCESS = 0x200
  2097. const m_AT_EMPTY_PATH = 0x1000
  2098. const m_AT_NO_AUTOMOUNT = 0x800
  2099. const m_AT_RECURSIVE = 0x8000
  2100. const m_AT_REMOVEDIR = 0x200
  2101. const m_AT_STATX_DONT_SYNC = 0x4000
  2102. const m_AT_STATX_FORCE_SYNC = 0x2000
  2103. const m_AT_STATX_SYNC_AS_STAT = 0x0000
  2104. const m_AT_STATX_SYNC_TYPE = 0x6000
  2105. const m_AT_SYMLINK_FOLLOW = 0x400
  2106. const m_AT_SYMLINK_NOFOLLOW = 0x100
  2107. const m_BLOCKSZ = 64
  2108. const m_CANBSIZ = 255
  2109. const m_CLOCKS_PER_SEC = 1000000
  2110. const m_CLOCK_BOOTTIME = 7
  2111. const m_CLOCK_BOOTTIME_ALARM = 9
  2112. const m_CLOCK_MONOTONIC = 1
  2113. const m_CLOCK_MONOTONIC_COARSE = 6
  2114. const m_CLOCK_MONOTONIC_RAW = 4
  2115. const m_CLOCK_PROCESS_CPUTIME_ID = 2
  2116. const m_CLOCK_REALTIME = 0
  2117. const m_CLOCK_REALTIME_ALARM = 8
  2118. const m_CLOCK_REALTIME_COARSE = 5
  2119. const m_CLOCK_SGI_CYCLE = 10
  2120. const m_CLOCK_TAI = 11
  2121. const m_CLOCK_THREAD_CPUTIME_ID = 3
  2122. const m_CLONE_CHILD_CLEARTID = 0x00200000
  2123. const m_CLONE_CHILD_SETTID = 0x01000000
  2124. const m_CLONE_DETACHED = 0x00400000
  2125. const m_CLONE_FILES = 0x00000400
  2126. const m_CLONE_FS = 0x00000200
  2127. const m_CLONE_IO = 0x80000000
  2128. const m_CLONE_NEWCGROUP = 0x02000000
  2129. const m_CLONE_NEWIPC = 0x08000000
  2130. const m_CLONE_NEWNET = 0x40000000
  2131. const m_CLONE_NEWNS = 0x00020000
  2132. const m_CLONE_NEWPID = 0x20000000
  2133. const m_CLONE_NEWTIME = 0x00000080
  2134. const m_CLONE_NEWUSER = 0x10000000
  2135. const m_CLONE_NEWUTS = 0x04000000
  2136. const m_CLONE_PARENT = 0x00008000
  2137. const m_CLONE_PARENT_SETTID = 0x00100000
  2138. const m_CLONE_PIDFD = 0x00001000
  2139. const m_CLONE_PTRACE = 0x00002000
  2140. const m_CLONE_SETTLS = 0x00080000
  2141. const m_CLONE_SIGHAND = 0x00000800
  2142. const m_CLONE_SYSVSEM = 0x00040000
  2143. const m_CLONE_THREAD = 0x00010000
  2144. const m_CLONE_UNTRACED = 0x00800000
  2145. const m_CLONE_VFORK = 0x00004000
  2146. const m_CLONE_VM = 0x00000100
  2147. const m_CPU_SETSIZE = 1024
  2148. const m_CSIGNAL = 0x000000ff
  2149. const m_DEV_BSIZE = 512
  2150. const m_DN_ACCESS = 0x00000001
  2151. const m_DN_ATTRIB = 0x00000020
  2152. const m_DN_CREATE = 0x00000004
  2153. const m_DN_DELETE = 0x00000008
  2154. const m_DN_MODIFY = 0x00000002
  2155. const m_DN_MULTISHOT = 0x80000000
  2156. const m_DN_RENAME = 0x00000010
  2157. const m_FALLOC_FL_KEEP_SIZE = 1
  2158. const m_FALLOC_FL_PUNCH_HOLE = 2
  2159. const m_FAPPEND = "O_APPEND"
  2160. const m_FASYNC = "O_ASYNC"
  2161. const m_FD_CLOEXEC = 1
  2162. const m_FFSYNC = "O_SYNC"
  2163. const m_FNDELAY = "O_NDELAY"
  2164. const m_FNONBLOCK = "O_NONBLOCK"
  2165. const m_F_ADD_SEALS = 1033
  2166. const m_F_CANCELLK = 1029
  2167. const m_F_DUPFD = 0
  2168. const m_F_DUPFD_CLOEXEC = 1030
  2169. const m_F_GETFD = 1
  2170. const m_F_GETFL = 3
  2171. const m_F_GETLEASE = 1025
  2172. const m_F_GETLK = 5
  2173. const m_F_GETOWN = 9
  2174. const m_F_GETOWNER_UIDS = 17
  2175. const m_F_GETOWN_EX = 16
  2176. const m_F_GETPIPE_SZ = 1032
  2177. const m_F_GETSIG = 11
  2178. const m_F_GET_FILE_RW_HINT = 1037
  2179. const m_F_GET_RW_HINT = 1035
  2180. const m_F_GET_SEALS = 1034
  2181. const m_F_NOTIFY = 1026
  2182. const m_F_OFD_GETLK = 36
  2183. const m_F_OFD_SETLK = 37
  2184. const m_F_OFD_SETLKW = 38
  2185. const m_F_OWNER_GID = 2
  2186. const m_F_OWNER_PGRP = 2
  2187. const m_F_OWNER_PID = 1
  2188. const m_F_OWNER_TID = 0
  2189. const m_F_RDLCK = 0
  2190. const m_F_SEAL_FUTURE_WRITE = 0x0010
  2191. const m_F_SEAL_GROW = 0x0004
  2192. const m_F_SEAL_SEAL = 0x0001
  2193. const m_F_SEAL_SHRINK = 0x0002
  2194. const m_F_SEAL_WRITE = 0x0008
  2195. const m_F_SETFD = 2
  2196. const m_F_SETFL = 4
  2197. const m_F_SETLEASE = 1024
  2198. const m_F_SETLK = 6
  2199. const m_F_SETLKW = 7
  2200. const m_F_SETOWN = 8
  2201. const m_F_SETOWN_EX = 15
  2202. const m_F_SETPIPE_SZ = 1031
  2203. const m_F_SETSIG = 10
  2204. const m_F_SET_FILE_RW_HINT = 1038
  2205. const m_F_SET_RW_HINT = 1036
  2206. const m_F_UNLCK = 2
  2207. const m_F_WRLCK = 1
  2208. const m_ITIMER_PROF = 2
  2209. const m_ITIMER_REAL = 0
  2210. const m_ITIMER_VIRTUAL = 1
  2211. const m_IVSZ = 8
  2212. const m_KEYSZ = 32
  2213. const m_MADV_COLD = 20
  2214. const m_MADV_DODUMP = 17
  2215. const m_MADV_DOFORK = 11
  2216. const m_MADV_DONTDUMP = 16
  2217. const m_MADV_DONTFORK = 10
  2218. const m_MADV_DONTNEED = 4
  2219. const m_MADV_FREE = 8
  2220. const m_MADV_HUGEPAGE = 14
  2221. const m_MADV_HWPOISON = 100
  2222. const m_MADV_KEEPONFORK = 19
  2223. const m_MADV_MERGEABLE = 12
  2224. const m_MADV_NOHUGEPAGE = 15
  2225. const m_MADV_NORMAL = 0
  2226. const m_MADV_PAGEOUT = 21
  2227. const m_MADV_RANDOM = 1
  2228. const m_MADV_REMOVE = 9
  2229. const m_MADV_SEQUENTIAL = 2
  2230. const m_MADV_SOFT_OFFLINE = 101
  2231. const m_MADV_UNMERGEABLE = 13
  2232. const m_MADV_WILLNEED = 3
  2233. const m_MADV_WIPEONFORK = 18
  2234. const m_MAP_ANON = 32
  2235. const m_MAP_ANONYMOUS = "MAP_ANON"
  2236. const m_MAP_DENYWRITE = 0x0800
  2237. const m_MAP_EXECUTABLE = 0x1000
  2238. const m_MAP_FILE = 0
  2239. const m_MAP_FIXED = 0x10
  2240. const m_MAP_FIXED_NOREPLACE = 0x100000
  2241. const m_MAP_GROWSDOWN = 0x0100
  2242. const m_MAP_HUGETLB = 0x40000
  2243. const m_MAP_HUGE_MASK = 0x3f
  2244. const m_MAP_HUGE_SHIFT = 26
  2245. const m_MAP_NONBLOCK = 0x10000
  2246. const m_MAP_POPULATE = 0x8000
  2247. const m_MAP_PRIVATE = 2
  2248. const m_MAP_SHARED = 0x01
  2249. const m_MAP_SHARED_VALIDATE = 0x03
  2250. const m_MAP_STACK = 0x20000
  2251. const m_MAP_SYNC = 0x80000
  2252. const m_MAP_TYPE = 0x0f
  2253. const m_MAXHOSTNAMELEN = 64
  2254. const m_MAXNAMLEN = 255
  2255. const m_MAXPATHLEN = 4096
  2256. const m_MAXSYMLINKS = 20
  2257. const m_MAX_HANDLE_SZ = 128
  2258. const m_MFD_ALLOW_SEALING = 0x0002
  2259. const m_MFD_CLOEXEC = 0x0001
  2260. const m_MFD_HUGETLB = 0x0004
  2261. const m_MLOCK_ONFAULT = 0x01
  2262. const m_MREMAP_DONTUNMAP = 4
  2263. const m_MREMAP_FIXED = 2
  2264. const m_MREMAP_MAYMOVE = 1
  2265. const m_MS_ASYNC = 1
  2266. const m_MS_INVALIDATE = 2
  2267. const m_MS_SYNC = 4
  2268. const m_NBBY = 8
  2269. const m_NCARGS = 131072
  2270. const m_NGROUPS = 32
  2271. const m_NOFILE = 256
  2272. const m_O_APPEND = 02000
  2273. const m_O_ASYNC = 020000
  2274. const m_O_CLOEXEC = 02000000
  2275. const m_O_CREAT = 0100
  2276. const m_O_DIRECT = 0400000
  2277. const m_O_DIRECTORY = 040000
  2278. const m_O_DSYNC = 010000
  2279. const m_O_EXCL = 0200
  2280. const m_O_EXEC = "O_PATH"
  2281. const m_O_LARGEFILE = 0200000
  2282. const m_O_NDELAY = "O_NONBLOCK"
  2283. const m_O_NOATIME = 01000000
  2284. const m_O_NOCTTY = 0400
  2285. const m_O_NOFOLLOW = 0100000
  2286. const m_O_NONBLOCK = 04000
  2287. const m_O_PATH = 010000000
  2288. const m_O_RDONLY = 00
  2289. const m_O_RDWR = 02
  2290. const m_O_RSYNC = 04010000
  2291. const m_O_SEARCH = "O_PATH"
  2292. const m_O_SYNC = 04010000
  2293. const m_O_TMPFILE = 020040000
  2294. const m_O_TRUNC = 01000
  2295. const m_O_TTY_INIT = 0
  2296. const m_O_WRONLY = 01
  2297. const m_POSIX_FADV_DONTNEED = 4
  2298. const m_POSIX_FADV_NOREUSE = 5
  2299. const m_POSIX_FADV_NORMAL = 0
  2300. const m_POSIX_FADV_RANDOM = 1
  2301. const m_POSIX_FADV_SEQUENTIAL = 2
  2302. const m_POSIX_FADV_WILLNEED = 3
  2303. const m_POSIX_MADV_DONTNEED = 4
  2304. const m_POSIX_MADV_NORMAL = 0
  2305. const m_POSIX_MADV_RANDOM = 1
  2306. const m_POSIX_MADV_SEQUENTIAL = 2
  2307. const m_POSIX_MADV_WILLNEED = 3
  2308. const m_PRIO_MAX = 20
  2309. const m_PRIO_PGRP = 1
  2310. const m_PRIO_PROCESS = 0
  2311. const m_PRIO_USER = 2
  2312. const m_PROT_EXEC = 4
  2313. const m_PROT_GROWSDOWN = 0x01000000
  2314. const m_PROT_GROWSUP = 0x02000000
  2315. const m_PROT_NONE = 0
  2316. const m_PROT_READ = 1
  2317. const m_PROT_SAO = 0x10
  2318. const m_PROT_WRITE = 2
  2319. const m_PTHREAD_CANCEL_ASYNCHRONOUS = 1
  2320. const m_PTHREAD_CANCEL_DEFERRED = 0
  2321. const m_PTHREAD_CANCEL_DISABLE = 1
  2322. const m_PTHREAD_CANCEL_ENABLE = 0
  2323. const m_PTHREAD_CANCEL_MASKED = 2
  2324. const m_PTHREAD_CREATE_DETACHED = 1
  2325. const m_PTHREAD_CREATE_JOINABLE = 0
  2326. const m_PTHREAD_EXPLICIT_SCHED = 1
  2327. const m_PTHREAD_INHERIT_SCHED = 0
  2328. const m_PTHREAD_MUTEX_DEFAULT = 0
  2329. const m_PTHREAD_MUTEX_ERRORCHECK = 2
  2330. const m_PTHREAD_MUTEX_NORMAL = 0
  2331. const m_PTHREAD_MUTEX_RECURSIVE = 1
  2332. const m_PTHREAD_MUTEX_ROBUST = 1
  2333. const m_PTHREAD_MUTEX_STALLED = 0
  2334. const m_PTHREAD_ONCE_INIT = 0
  2335. const m_PTHREAD_PRIO_INHERIT = 1
  2336. const m_PTHREAD_PRIO_NONE = 0
  2337. const m_PTHREAD_PRIO_PROTECT = 2
  2338. const m_PTHREAD_PROCESS_PRIVATE = 0
  2339. const m_PTHREAD_PROCESS_SHARED = 1
  2340. const m_PTHREAD_SCOPE_PROCESS = 1
  2341. const m_PTHREAD_SCOPE_SYSTEM = 0
  2342. const m_RLIMIT_AS = 9
  2343. const m_RLIMIT_CORE = 4
  2344. const m_RLIMIT_CPU = 0
  2345. const m_RLIMIT_DATA = 2
  2346. const m_RLIMIT_FSIZE = 1
  2347. const m_RLIMIT_LOCKS = 10
  2348. const m_RLIMIT_MEMLOCK = 8
  2349. const m_RLIMIT_MSGQUEUE = 12
  2350. const m_RLIMIT_NICE = 13
  2351. const m_RLIMIT_NLIMITS = 16
  2352. const m_RLIMIT_NOFILE = 7
  2353. const m_RLIMIT_NPROC = 6
  2354. const m_RLIMIT_RSS = 5
  2355. const m_RLIMIT_RTPRIO = 14
  2356. const m_RLIMIT_RTTIME = 15
  2357. const m_RLIMIT_SIGPENDING = 11
  2358. const m_RLIMIT_STACK = 3
  2359. const m_RLIM_NLIMITS = "RLIMIT_NLIMITS"
  2360. const m_RLIM_SAVED_CUR = "RLIM_INFINITY"
  2361. const m_RLIM_SAVED_MAX = "RLIM_INFINITY"
  2362. const m_RUSAGE_SELF = 0
  2363. const m_RUSAGE_THREAD = 1
  2364. const m_RWF_WRITE_LIFE_NOT_SET = 0
  2365. const m_RWH_WRITE_LIFE_EXTREME = 5
  2366. const m_RWH_WRITE_LIFE_LONG = 4
  2367. const m_RWH_WRITE_LIFE_MEDIUM = 3
  2368. const m_RWH_WRITE_LIFE_NONE = 1
  2369. const m_RWH_WRITE_LIFE_SHORT = 2
  2370. const m_SCHED_BATCH = 3
  2371. const m_SCHED_DEADLINE = 6
  2372. const m_SCHED_FIFO = 1
  2373. const m_SCHED_IDLE = 5
  2374. const m_SCHED_OTHER = 0
  2375. const m_SCHED_RESET_ON_FORK = 0x40000000
  2376. const m_SCHED_RR = 2
  2377. const m_SPLICE_F_GIFT = 8
  2378. const m_SPLICE_F_MORE = 4
  2379. const m_SPLICE_F_MOVE = 1
  2380. const m_SPLICE_F_NONBLOCK = 2
  2381. const m_SYNC_FILE_RANGE_WAIT_AFTER = 4
  2382. const m_SYNC_FILE_RANGE_WAIT_BEFORE = 1
  2383. const m_SYNC_FILE_RANGE_WRITE = 2
  2384. const m_S_IFDIR1 = 0040000
  2385. const m_S_IRGRP1 = 0040
  2386. const m_S_IROTH1 = 0004
  2387. const m_S_IRUSR1 = 0400
  2388. const m_S_IRWXG1 = 0070
  2389. const m_S_IRWXO1 = 0007
  2390. const m_S_IRWXU1 = 0700
  2391. const m_S_ISGID1 = 02000
  2392. const m_S_ISUID1 = 04000
  2393. const m_S_ISVTX1 = 01000
  2394. const m_S_IWGRP1 = 0020
  2395. const m_S_IWOTH1 = 0002
  2396. const m_S_IWUSR1 = 0200
  2397. const m_S_IXGRP1 = 0010
  2398. const m_S_IXOTH1 = 0001
  2399. const m_S_IXUSR1 = 0100
  2400. const m_TIMER_ABSTIME = 1
  2401. const m_TIME_UTC = 1
  2402. const m___LONG_MAX1 = 0x7fffffffffffffff
  2403. const m___tm_gmtoff = "tm_gmtoff"
  2404. const m___tm_zone = "tm_zone"
  2405. const m_inline = "__inline"
  2406. const m_loff_t = "off_t"
  2407. const m_prlimit64 = "prlimit"
  2408. type Tiovec = struct {
  2409. Fiov_base uintptr
  2410. Fiov_len Tsize_t
  2411. }
  2412. type Tflock = struct {
  2413. Fl_type int16
  2414. Fl_whence int16
  2415. Fl_start Toff_t
  2416. Fl_len Toff_t
  2417. Fl_pid Tpid_t
  2418. }
  2419. type Tfile_handle = struct {
  2420. Fhandle_bytes uint32
  2421. Fhandle_type int32
  2422. }
  2423. type Tf_owner_ex = struct {
  2424. Ftype1 int32
  2425. Fpid Tpid_t
  2426. }
  2427. type Titimerval = struct {
  2428. Fit_interval Ttimeval
  2429. Fit_value Ttimeval
  2430. }
  2431. type Ttimezone = struct {
  2432. Ftz_minuteswest int32
  2433. Ftz_dsttime int32
  2434. }
  2435. type Tu8 = uint8
  2436. type Tu32 = uint32
  2437. type Tchacha_ctx = struct {
  2438. Finput [16]Tu32
  2439. }
  2440. var _sigma = [16]uint8{'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'}
  2441. var _tau = [16]uint8{'e', 'x', 'p', 'a', 'n', 'd', ' ', '1', '6', '-', 'b', 'y', 't', 'e', ' ', 'k'}
  2442. func _chacha_keysetup(tls *libc.TLS, x uintptr, k uintptr, kbits Tu32) {
  2443. var constants uintptr
  2444. _ = constants
  2445. *(*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)
  2446. *(*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)
  2447. *(*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)
  2448. *(*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)
  2449. if kbits == uint32(256) {
  2450. k += uintptr(16)
  2451. constants = uintptr(unsafe.Pointer(&_sigma))
  2452. } else {
  2453. constants = uintptr(unsafe.Pointer(&_tau))
  2454. }
  2455. *(*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)
  2456. *(*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)
  2457. *(*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)
  2458. *(*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)
  2459. *(*Tu32)(unsafe.Pointer(x)) = uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(0)))) | uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(0) + 1)))<<libc.Int32FromInt32(8) | uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(0) + 2)))<<libc.Int32FromInt32(16) | uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(0) + 3)))<<libc.Int32FromInt32(24)
  2460. *(*Tu32)(unsafe.Pointer(x + 1*4)) = uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(4)))) | uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(4) + 1)))<<libc.Int32FromInt32(8) | uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(4) + 2)))<<libc.Int32FromInt32(16) | uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(4) + 3)))<<libc.Int32FromInt32(24)
  2461. *(*Tu32)(unsafe.Pointer(x + 2*4)) = uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(8)))) | uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(8) + 1)))<<libc.Int32FromInt32(8) | uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(8) + 2)))<<libc.Int32FromInt32(16) | uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(8) + 3)))<<libc.Int32FromInt32(24)
  2462. *(*Tu32)(unsafe.Pointer(x + 3*4)) = uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(12)))) | uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(12) + 1)))<<libc.Int32FromInt32(8) | uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(12) + 2)))<<libc.Int32FromInt32(16) | uint32(*(*uint8)(unsafe.Pointer(constants + libc.UintptrFromInt32(12) + 3)))<<libc.Int32FromInt32(24)
  2463. }
  2464. func _chacha_ivsetup(tls *libc.TLS, x uintptr, iv uintptr) {
  2465. *(*Tu32)(unsafe.Pointer(x + 12*4)) = uint32(0)
  2466. *(*Tu32)(unsafe.Pointer(x + 13*4)) = uint32(0)
  2467. *(*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)
  2468. *(*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)
  2469. }
  2470. func _chacha_encrypt_bytes(tls *libc.TLS, x uintptr, m uintptr, c uintptr, bytes Tu32) {
  2471. bp := tls.Alloc(64)
  2472. defer tls.Free(64)
  2473. var ctarget uintptr
  2474. var i uint32
  2475. 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
  2476. var _ /* tmp at bp+0 */ [64]Tu8
  2477. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  2478. ctarget = libc.UintptrFromInt32(0)
  2479. if !(bytes != 0) {
  2480. return
  2481. }
  2482. j0 = *(*Tu32)(unsafe.Pointer(x))
  2483. j1 = *(*Tu32)(unsafe.Pointer(x + 1*4))
  2484. j2 = *(*Tu32)(unsafe.Pointer(x + 2*4))
  2485. j3 = *(*Tu32)(unsafe.Pointer(x + 3*4))
  2486. j4 = *(*Tu32)(unsafe.Pointer(x + 4*4))
  2487. j5 = *(*Tu32)(unsafe.Pointer(x + 5*4))
  2488. j6 = *(*Tu32)(unsafe.Pointer(x + 6*4))
  2489. j7 = *(*Tu32)(unsafe.Pointer(x + 7*4))
  2490. j8 = *(*Tu32)(unsafe.Pointer(x + 8*4))
  2491. j9 = *(*Tu32)(unsafe.Pointer(x + 9*4))
  2492. j10 = *(*Tu32)(unsafe.Pointer(x + 10*4))
  2493. j11 = *(*Tu32)(unsafe.Pointer(x + 11*4))
  2494. j12 = *(*Tu32)(unsafe.Pointer(x + 12*4))
  2495. j13 = *(*Tu32)(unsafe.Pointer(x + 13*4))
  2496. j14 = *(*Tu32)(unsafe.Pointer(x + 14*4))
  2497. j15 = *(*Tu32)(unsafe.Pointer(x + 15*4))
  2498. for {
  2499. if bytes < uint32(64) {
  2500. i = uint32(0)
  2501. for {
  2502. if !(i < bytes) {
  2503. break
  2504. }
  2505. (*(*[64]Tu8)(unsafe.Pointer(bp)))[i] = *(*Tu8)(unsafe.Pointer(m + uintptr(i)))
  2506. goto _2
  2507. _2:
  2508. ;
  2509. i++
  2510. }
  2511. m = bp
  2512. ctarget = c
  2513. c = bp
  2514. }
  2515. x0 = j0
  2516. x1 = j1
  2517. x2 = j2
  2518. x3 = j3
  2519. x4 = j4
  2520. x5 = j5
  2521. x6 = j6
  2522. x7 = j7
  2523. x8 = j8
  2524. x9 = j9
  2525. x10 = j10
  2526. x11 = j11
  2527. x12 = j12
  2528. x13 = j13
  2529. x14 = j14
  2530. x15 = j15
  2531. i = uint32(20)
  2532. for {
  2533. if !(i > uint32(0)) {
  2534. break
  2535. }
  2536. x0 = (x0 + x4) & libc.Uint32FromUint32(0xFFFFFFFF)
  2537. x12 = (x12^x0)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x12^x0)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  2538. x8 = (x8 + x12) & libc.Uint32FromUint32(0xFFFFFFFF)
  2539. x4 = (x4^x8)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x4^x8)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  2540. x0 = (x0 + x4) & libc.Uint32FromUint32(0xFFFFFFFF)
  2541. x12 = (x12^x0)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x12^x0)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  2542. x8 = (x8 + x12) & libc.Uint32FromUint32(0xFFFFFFFF)
  2543. x4 = (x4^x8)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x4^x8)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  2544. x1 = (x1 + x5) & libc.Uint32FromUint32(0xFFFFFFFF)
  2545. x13 = (x13^x1)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x13^x1)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  2546. x9 = (x9 + x13) & libc.Uint32FromUint32(0xFFFFFFFF)
  2547. x5 = (x5^x9)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x5^x9)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  2548. x1 = (x1 + x5) & libc.Uint32FromUint32(0xFFFFFFFF)
  2549. x13 = (x13^x1)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x13^x1)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  2550. x9 = (x9 + x13) & libc.Uint32FromUint32(0xFFFFFFFF)
  2551. x5 = (x5^x9)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x5^x9)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  2552. x2 = (x2 + x6) & libc.Uint32FromUint32(0xFFFFFFFF)
  2553. x14 = (x14^x2)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x14^x2)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  2554. x10 = (x10 + x14) & libc.Uint32FromUint32(0xFFFFFFFF)
  2555. x6 = (x6^x10)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x6^x10)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  2556. x2 = (x2 + x6) & libc.Uint32FromUint32(0xFFFFFFFF)
  2557. x14 = (x14^x2)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x14^x2)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  2558. x10 = (x10 + x14) & libc.Uint32FromUint32(0xFFFFFFFF)
  2559. x6 = (x6^x10)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x6^x10)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  2560. x3 = (x3 + x7) & libc.Uint32FromUint32(0xFFFFFFFF)
  2561. x15 = (x15^x3)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x15^x3)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  2562. x11 = (x11 + x15) & libc.Uint32FromUint32(0xFFFFFFFF)
  2563. x7 = (x7^x11)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x7^x11)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  2564. x3 = (x3 + x7) & libc.Uint32FromUint32(0xFFFFFFFF)
  2565. x15 = (x15^x3)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x15^x3)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  2566. x11 = (x11 + x15) & libc.Uint32FromUint32(0xFFFFFFFF)
  2567. x7 = (x7^x11)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x7^x11)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  2568. x0 = (x0 + x5) & libc.Uint32FromUint32(0xFFFFFFFF)
  2569. x15 = (x15^x0)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x15^x0)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  2570. x10 = (x10 + x15) & libc.Uint32FromUint32(0xFFFFFFFF)
  2571. x5 = (x5^x10)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x5^x10)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  2572. x0 = (x0 + x5) & libc.Uint32FromUint32(0xFFFFFFFF)
  2573. x15 = (x15^x0)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x15^x0)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  2574. x10 = (x10 + x15) & libc.Uint32FromUint32(0xFFFFFFFF)
  2575. x5 = (x5^x10)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x5^x10)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  2576. x1 = (x1 + x6) & libc.Uint32FromUint32(0xFFFFFFFF)
  2577. x12 = (x12^x1)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x12^x1)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  2578. x11 = (x11 + x12) & libc.Uint32FromUint32(0xFFFFFFFF)
  2579. x6 = (x6^x11)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x6^x11)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  2580. x1 = (x1 + x6) & libc.Uint32FromUint32(0xFFFFFFFF)
  2581. x12 = (x12^x1)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x12^x1)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  2582. x11 = (x11 + x12) & libc.Uint32FromUint32(0xFFFFFFFF)
  2583. x6 = (x6^x11)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x6^x11)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  2584. x2 = (x2 + x7) & libc.Uint32FromUint32(0xFFFFFFFF)
  2585. x13 = (x13^x2)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x13^x2)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  2586. x8 = (x8 + x13) & libc.Uint32FromUint32(0xFFFFFFFF)
  2587. x7 = (x7^x8)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x7^x8)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  2588. x2 = (x2 + x7) & libc.Uint32FromUint32(0xFFFFFFFF)
  2589. x13 = (x13^x2)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x13^x2)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  2590. x8 = (x8 + x13) & libc.Uint32FromUint32(0xFFFFFFFF)
  2591. x7 = (x7^x8)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x7^x8)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  2592. x3 = (x3 + x4) & libc.Uint32FromUint32(0xFFFFFFFF)
  2593. x14 = (x14^x3)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x14^x3)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  2594. x9 = (x9 + x14) & libc.Uint32FromUint32(0xFFFFFFFF)
  2595. x4 = (x4^x9)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x4^x9)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  2596. x3 = (x3 + x4) & libc.Uint32FromUint32(0xFFFFFFFF)
  2597. x14 = (x14^x3)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x14^x3)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  2598. x9 = (x9 + x14) & libc.Uint32FromUint32(0xFFFFFFFF)
  2599. x4 = (x4^x9)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x4^x9)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  2600. goto _3
  2601. _3:
  2602. ;
  2603. i -= uint32(2)
  2604. }
  2605. x0 = (x0 + j0) & libc.Uint32FromUint32(0xFFFFFFFF)
  2606. x1 = (x1 + j1) & libc.Uint32FromUint32(0xFFFFFFFF)
  2607. x2 = (x2 + j2) & libc.Uint32FromUint32(0xFFFFFFFF)
  2608. x3 = (x3 + j3) & libc.Uint32FromUint32(0xFFFFFFFF)
  2609. x4 = (x4 + j4) & libc.Uint32FromUint32(0xFFFFFFFF)
  2610. x5 = (x5 + j5) & libc.Uint32FromUint32(0xFFFFFFFF)
  2611. x6 = (x6 + j6) & libc.Uint32FromUint32(0xFFFFFFFF)
  2612. x7 = (x7 + j7) & libc.Uint32FromUint32(0xFFFFFFFF)
  2613. x8 = (x8 + j8) & libc.Uint32FromUint32(0xFFFFFFFF)
  2614. x9 = (x9 + j9) & libc.Uint32FromUint32(0xFFFFFFFF)
  2615. x10 = (x10 + j10) & libc.Uint32FromUint32(0xFFFFFFFF)
  2616. x11 = (x11 + j11) & libc.Uint32FromUint32(0xFFFFFFFF)
  2617. x12 = (x12 + j12) & libc.Uint32FromUint32(0xFFFFFFFF)
  2618. x13 = (x13 + j13) & libc.Uint32FromUint32(0xFFFFFFFF)
  2619. x14 = (x14 + j14) & libc.Uint32FromUint32(0xFFFFFFFF)
  2620. x15 = (x15 + j15) & libc.Uint32FromUint32(0xFFFFFFFF)
  2621. j12 = (j12 + libc.Uint32FromInt32(libc.Int32FromInt32(1))) & libc.Uint32FromUint32(0xFFFFFFFF)
  2622. if !(j12 != 0) {
  2623. j13 = (j13 + libc.Uint32FromInt32(libc.Int32FromInt32(1))) & libc.Uint32FromUint32(0xFFFFFFFF)
  2624. }
  2625. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(0))) = uint8(uint32(uint8(x0)) & libc.Uint32FromUint32(0xFF))
  2626. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(0) + 1)) = uint8(uint32(uint8(x0>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2627. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(0) + 2)) = uint8(uint32(uint8(x0>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2628. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(0) + 3)) = uint8(uint32(uint8(x0>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2629. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(4))) = uint8(uint32(uint8(x1)) & libc.Uint32FromUint32(0xFF))
  2630. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(4) + 1)) = uint8(uint32(uint8(x1>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2631. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(4) + 2)) = uint8(uint32(uint8(x1>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2632. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(4) + 3)) = uint8(uint32(uint8(x1>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2633. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(8))) = uint8(uint32(uint8(x2)) & libc.Uint32FromUint32(0xFF))
  2634. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(8) + 1)) = uint8(uint32(uint8(x2>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2635. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(8) + 2)) = uint8(uint32(uint8(x2>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2636. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(8) + 3)) = uint8(uint32(uint8(x2>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2637. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(12))) = uint8(uint32(uint8(x3)) & libc.Uint32FromUint32(0xFF))
  2638. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(12) + 1)) = uint8(uint32(uint8(x3>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2639. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(12) + 2)) = uint8(uint32(uint8(x3>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2640. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(12) + 3)) = uint8(uint32(uint8(x3>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2641. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(16))) = uint8(uint32(uint8(x4)) & libc.Uint32FromUint32(0xFF))
  2642. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(16) + 1)) = uint8(uint32(uint8(x4>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2643. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(16) + 2)) = uint8(uint32(uint8(x4>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2644. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(16) + 3)) = uint8(uint32(uint8(x4>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2645. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(20))) = uint8(uint32(uint8(x5)) & libc.Uint32FromUint32(0xFF))
  2646. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(20) + 1)) = uint8(uint32(uint8(x5>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2647. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(20) + 2)) = uint8(uint32(uint8(x5>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2648. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(20) + 3)) = uint8(uint32(uint8(x5>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2649. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(24))) = uint8(uint32(uint8(x6)) & libc.Uint32FromUint32(0xFF))
  2650. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(24) + 1)) = uint8(uint32(uint8(x6>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2651. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(24) + 2)) = uint8(uint32(uint8(x6>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2652. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(24) + 3)) = uint8(uint32(uint8(x6>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2653. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(28))) = uint8(uint32(uint8(x7)) & libc.Uint32FromUint32(0xFF))
  2654. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(28) + 1)) = uint8(uint32(uint8(x7>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2655. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(28) + 2)) = uint8(uint32(uint8(x7>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2656. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(28) + 3)) = uint8(uint32(uint8(x7>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2657. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(32))) = uint8(uint32(uint8(x8)) & libc.Uint32FromUint32(0xFF))
  2658. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(32) + 1)) = uint8(uint32(uint8(x8>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2659. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(32) + 2)) = uint8(uint32(uint8(x8>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2660. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(32) + 3)) = uint8(uint32(uint8(x8>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2661. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(36))) = uint8(uint32(uint8(x9)) & libc.Uint32FromUint32(0xFF))
  2662. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(36) + 1)) = uint8(uint32(uint8(x9>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2663. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(36) + 2)) = uint8(uint32(uint8(x9>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2664. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(36) + 3)) = uint8(uint32(uint8(x9>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2665. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(40))) = uint8(uint32(uint8(x10)) & libc.Uint32FromUint32(0xFF))
  2666. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(40) + 1)) = uint8(uint32(uint8(x10>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2667. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(40) + 2)) = uint8(uint32(uint8(x10>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2668. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(40) + 3)) = uint8(uint32(uint8(x10>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2669. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(44))) = uint8(uint32(uint8(x11)) & libc.Uint32FromUint32(0xFF))
  2670. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(44) + 1)) = uint8(uint32(uint8(x11>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2671. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(44) + 2)) = uint8(uint32(uint8(x11>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2672. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(44) + 3)) = uint8(uint32(uint8(x11>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2673. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(48))) = uint8(uint32(uint8(x12)) & libc.Uint32FromUint32(0xFF))
  2674. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(48) + 1)) = uint8(uint32(uint8(x12>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2675. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(48) + 2)) = uint8(uint32(uint8(x12>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2676. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(48) + 3)) = uint8(uint32(uint8(x12>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2677. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(52))) = uint8(uint32(uint8(x13)) & libc.Uint32FromUint32(0xFF))
  2678. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(52) + 1)) = uint8(uint32(uint8(x13>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2679. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(52) + 2)) = uint8(uint32(uint8(x13>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2680. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(52) + 3)) = uint8(uint32(uint8(x13>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2681. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(56))) = uint8(uint32(uint8(x14)) & libc.Uint32FromUint32(0xFF))
  2682. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(56) + 1)) = uint8(uint32(uint8(x14>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2683. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(56) + 2)) = uint8(uint32(uint8(x14>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2684. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(56) + 3)) = uint8(uint32(uint8(x14>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2685. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(60))) = uint8(uint32(uint8(x15)) & libc.Uint32FromUint32(0xFF))
  2686. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(60) + 1)) = uint8(uint32(uint8(x15>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2687. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(60) + 2)) = uint8(uint32(uint8(x15>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2688. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(60) + 3)) = uint8(uint32(uint8(x15>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2689. if bytes <= uint32(64) {
  2690. if bytes < uint32(64) {
  2691. i = uint32(0)
  2692. for {
  2693. if !(i < bytes) {
  2694. break
  2695. }
  2696. *(*Tu8)(unsafe.Pointer(ctarget + uintptr(i))) = *(*Tu8)(unsafe.Pointer(c + uintptr(i)))
  2697. goto _4
  2698. _4:
  2699. ;
  2700. i++
  2701. }
  2702. }
  2703. *(*Tu32)(unsafe.Pointer(x + 12*4)) = j12
  2704. *(*Tu32)(unsafe.Pointer(x + 13*4)) = j13
  2705. return
  2706. }
  2707. bytes -= uint32(64)
  2708. c += uintptr(64)
  2709. goto _1
  2710. _1:
  2711. }
  2712. }
  2713. // C documentation
  2714. //
  2715. // /* Marked MAP_INHERIT_ZERO, so zero'd out in fork children. */
  2716. type T_rs = struct {
  2717. Frs_have Tsize_t
  2718. Frs_count Tsize_t
  2719. }
  2720. // C documentation
  2721. //
  2722. // /* Marked MAP_INHERIT_ZERO, so zero'd out in fork children. */
  2723. var _rs uintptr
  2724. // C documentation
  2725. //
  2726. // /* Maybe be preserved in fork children, if _rs_allocate() decides. */
  2727. type T_rsx = struct {
  2728. Frs_chacha Tchacha_ctx
  2729. Frs_buf [1024]uint8
  2730. }
  2731. // C documentation
  2732. //
  2733. // /* Maybe be preserved in fork children, if _rs_allocate() decides. */
  2734. var _rsx uintptr
  2735. type Trlim_t = uint64
  2736. type Trlimit = struct {
  2737. Frlim_cur Trlim_t
  2738. Frlim_max Trlim_t
  2739. }
  2740. type Trusage = struct {
  2741. Fru_utime Ttimeval
  2742. Fru_stime Ttimeval
  2743. Fru_maxrss int64
  2744. Fru_ixrss int64
  2745. Fru_idrss int64
  2746. Fru_isrss int64
  2747. Fru_minflt int64
  2748. Fru_majflt int64
  2749. Fru_nswap int64
  2750. Fru_inblock int64
  2751. Fru_oublock int64
  2752. Fru_msgsnd int64
  2753. Fru_msgrcv int64
  2754. Fru_nsignals int64
  2755. Fru_nvcsw int64
  2756. Fru_nivcsw int64
  2757. F__reserved [16]int64
  2758. }
  2759. type Tsched_param = struct {
  2760. Fsched_priority int32
  2761. F__reserved1 int32
  2762. F__reserved2 [2]struct {
  2763. F__reserved1 Ttime_t
  2764. F__reserved2 int64
  2765. }
  2766. F__reserved3 int32
  2767. }
  2768. type Tcpu_set_t = struct {
  2769. F__bits [16]uint64
  2770. }
  2771. type Ttm = struct {
  2772. Ftm_sec int32
  2773. Ftm_min int32
  2774. Ftm_hour int32
  2775. Ftm_mday int32
  2776. Ftm_mon int32
  2777. Ftm_year int32
  2778. Ftm_wday int32
  2779. Ftm_yday int32
  2780. Ftm_isdst int32
  2781. Ftm_gmtoff int64
  2782. Ftm_zone uintptr
  2783. }
  2784. type Titimerspec = struct {
  2785. Fit_interval Ttimespec
  2786. Fit_value Ttimespec
  2787. }
  2788. type t__ptcb = struct {
  2789. F__f uintptr
  2790. F__x uintptr
  2791. F__next uintptr
  2792. }
  2793. type Tcpu_set_t1 = struct {
  2794. F__bits [16]uint64
  2795. }
  2796. var _arc4random_mtx = Tpthread_mutex_t{}
  2797. var __rs_forked Tsig_atomic_t
  2798. func __rs_init(tls *libc.TLS, buf uintptr, n Tsize_t) {
  2799. var v1, v2, v3, v6 uintptr
  2800. var v4 int32
  2801. _, _, _, _, _ = v1, v2, v3, v4, v6
  2802. if n < libc.Uint64FromInt32(libc.Int32FromInt32(m_KEYSZ)+libc.Int32FromInt32(m_IVSZ)) {
  2803. return
  2804. }
  2805. if _rs == libc.UintptrFromInt32(0) {
  2806. v1 = uintptr(unsafe.Pointer(&_rs))
  2807. v2 = uintptr(unsafe.Pointer(&_rsx))
  2808. 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)
  2809. *(*uintptr)(unsafe.Pointer(v1)) = v3
  2810. if v3 == uintptr(-libc.Int32FromInt32(1)) {
  2811. v4 = -int32(1)
  2812. goto _5
  2813. }
  2814. 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)
  2815. *(*uintptr)(unsafe.Pointer(v2)) = v6
  2816. if v6 == uintptr(-libc.Int32FromInt32(1)) {
  2817. libc.Xmunmap(tls, *(*uintptr)(unsafe.Pointer(v1)), uint64(16))
  2818. *(*uintptr)(unsafe.Pointer(v1)) = libc.UintptrFromInt32(0)
  2819. v4 = -int32(1)
  2820. goto _5
  2821. }
  2822. libc.Xpthread_atfork(tls, libc.UintptrFromInt32(0), libc.UintptrFromInt32(0), __ccgo_fp(__rs_forkhandler))
  2823. v4 = 0
  2824. goto _5
  2825. _5:
  2826. if v4 == -int32(1) {
  2827. libc.X_exit(tls, int32(1))
  2828. }
  2829. }
  2830. _chacha_keysetup(tls, _rsx, buf, libc.Uint32FromInt32(libc.Int32FromInt32(m_KEYSZ)*libc.Int32FromInt32(8)))
  2831. _chacha_ivsetup(tls, _rsx, buf+uintptr(m_KEYSZ))
  2832. }
  2833. func __rs_rekey(tls *libc.TLS, dat uintptr, datlen Tsize_t) {
  2834. var i, m Tsize_t
  2835. var v1 uint64
  2836. var p3 uintptr
  2837. _, _, _, _ = i, m, v1, p3
  2838. /* fill rs_buf with the keystream */
  2839. _chacha_encrypt_bytes(tls, _rsx, _rsx+64, _rsx+64, uint32(1024))
  2840. /* mix in optional user provided data */
  2841. if dat != 0 {
  2842. if datlen < libc.Uint64FromInt32(libc.Int32FromInt32(m_KEYSZ)+libc.Int32FromInt32(m_IVSZ)) {
  2843. v1 = datlen
  2844. } else {
  2845. v1 = libc.Uint64FromInt32(libc.Int32FromInt32(m_KEYSZ) + libc.Int32FromInt32(m_IVSZ))
  2846. }
  2847. m = v1
  2848. i = uint64(0)
  2849. for {
  2850. if !(i < m) {
  2851. break
  2852. }
  2853. p3 = _rsx + 64 + uintptr(i)
  2854. *(*uint8)(unsafe.Pointer(p3)) = uint8(int32(*(*uint8)(unsafe.Pointer(p3))) ^ libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(dat + uintptr(i)))))
  2855. goto _2
  2856. _2:
  2857. ;
  2858. i++
  2859. }
  2860. }
  2861. /* immediately reinit for backtracking resistance */
  2862. __rs_init(tls, _rsx+64, libc.Uint64FromInt32(libc.Int32FromInt32(m_KEYSZ)+libc.Int32FromInt32(m_IVSZ)))
  2863. libc.Xmemset(tls, _rsx+64, 0, libc.Uint64FromInt32(libc.Int32FromInt32(m_KEYSZ)+libc.Int32FromInt32(m_IVSZ)))
  2864. (*T_rs)(unsafe.Pointer(_rs)).Frs_have = libc.Uint64FromInt64(1024) - libc.Uint64FromInt32(m_KEYSZ) - libc.Uint64FromInt32(m_IVSZ)
  2865. }
  2866. func __rs_stir(tls *libc.TLS) {
  2867. bp := tls.Alloc(48)
  2868. defer tls.Free(48)
  2869. var _ /* rekey_fuzz at bp+40 */ Tuint32_t
  2870. var _ /* rnd at bp+0 */ [40]uint8
  2871. *(*Tuint32_t)(unsafe.Pointer(bp + 40)) = uint32(0)
  2872. if libc.Xgetentropy(tls, bp, uint64(40)) == -int32(1) {
  2873. libc.Xraise(tls, int32(m_SIGKILL))
  2874. }
  2875. if !(_rs != 0) {
  2876. __rs_init(tls, bp, uint64(40))
  2877. } else {
  2878. __rs_rekey(tls, bp, uint64(40))
  2879. }
  2880. Xexplicit_bzero(tls, bp, uint64(40)) /* discard source seed */
  2881. /* invalidate rs_buf */
  2882. (*T_rs)(unsafe.Pointer(_rs)).Frs_have = uint64(0)
  2883. libc.Xmemset(tls, _rsx+64, 0, uint64(1024))
  2884. /* rekey interval should not be predictable */
  2885. _chacha_encrypt_bytes(tls, _rsx, bp+40, bp+40, uint32(4))
  2886. (*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)))
  2887. }
  2888. func __rs_stir_if_needed(tls *libc.TLS, len1 Tsize_t) {
  2889. __rs_forkdetect(tls)
  2890. if !(_rs != 0) || (*T_rs)(unsafe.Pointer(_rs)).Frs_count <= len1 {
  2891. __rs_stir(tls)
  2892. }
  2893. if (*T_rs)(unsafe.Pointer(_rs)).Frs_count <= len1 {
  2894. (*T_rs)(unsafe.Pointer(_rs)).Frs_count = uint64(0)
  2895. } else {
  2896. *(*Tsize_t)(unsafe.Pointer(_rs + 8)) -= len1
  2897. }
  2898. }
  2899. func __rs_random_buf(tls *libc.TLS, _buf uintptr, n Tsize_t) {
  2900. var buf, keystream uintptr
  2901. var m Tsize_t
  2902. var v1 uint64
  2903. _, _, _, _ = buf, keystream, m, v1
  2904. buf = _buf
  2905. __rs_stir_if_needed(tls, n)
  2906. for n > uint64(0) {
  2907. if (*T_rs)(unsafe.Pointer(_rs)).Frs_have > uint64(0) {
  2908. if n < (*T_rs)(unsafe.Pointer(_rs)).Frs_have {
  2909. v1 = n
  2910. } else {
  2911. v1 = (*T_rs)(unsafe.Pointer(_rs)).Frs_have
  2912. }
  2913. m = v1
  2914. keystream = _rsx + 64 + uintptr(1024) - uintptr((*T_rs)(unsafe.Pointer(_rs)).Frs_have)
  2915. libc.Xmemcpy(tls, buf, keystream, m)
  2916. libc.Xmemset(tls, keystream, 0, m)
  2917. buf += uintptr(m)
  2918. n -= m
  2919. *(*Tsize_t)(unsafe.Pointer(_rs)) -= m
  2920. }
  2921. if (*T_rs)(unsafe.Pointer(_rs)).Frs_have == uint64(0) {
  2922. __rs_rekey(tls, libc.UintptrFromInt32(0), uint64(0))
  2923. }
  2924. }
  2925. }
  2926. func __rs_random_u32(tls *libc.TLS, val uintptr) {
  2927. var keystream uintptr
  2928. _ = keystream
  2929. __rs_stir_if_needed(tls, uint64(4))
  2930. if (*T_rs)(unsafe.Pointer(_rs)).Frs_have < uint64(4) {
  2931. __rs_rekey(tls, libc.UintptrFromInt32(0), uint64(0))
  2932. }
  2933. keystream = _rsx + 64 + uintptr(1024) - uintptr((*T_rs)(unsafe.Pointer(_rs)).Frs_have)
  2934. libc.Xmemcpy(tls, val, keystream, uint64(4))
  2935. libc.Xmemset(tls, keystream, 0, uint64(4))
  2936. *(*Tsize_t)(unsafe.Pointer(_rs)) -= uint64(4)
  2937. }
  2938. func Xarc4random_stir(tls *libc.TLS) {
  2939. libc.Xpthread_mutex_lock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2940. __rs_stir(tls)
  2941. libc.Xpthread_mutex_unlock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2942. }
  2943. func Xarc4random_addrandom(tls *libc.TLS, dat uintptr, datlen int32) {
  2944. libc.Xpthread_mutex_lock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2945. __rs_stir_if_needed(tls, libc.Uint64FromInt32(datlen))
  2946. __rs_rekey(tls, dat, libc.Uint64FromInt32(datlen))
  2947. libc.Xpthread_mutex_unlock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2948. }
  2949. func Xarc4random(tls *libc.TLS) (r Tuint32_t) {
  2950. bp := tls.Alloc(16)
  2951. defer tls.Free(16)
  2952. var _ /* val at bp+0 */ Tuint32_t
  2953. libc.Xpthread_mutex_lock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2954. __rs_random_u32(tls, bp)
  2955. libc.Xpthread_mutex_unlock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2956. return *(*Tuint32_t)(unsafe.Pointer(bp))
  2957. }
  2958. func Xarc4random_buf(tls *libc.TLS, buf uintptr, n Tsize_t) {
  2959. libc.Xpthread_mutex_lock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2960. __rs_random_buf(tls, buf, n)
  2961. libc.Xpthread_mutex_unlock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2962. }
  2963. // C documentation
  2964. //
  2965. // /*
  2966. // * Calculate a uniformly distributed random number less than upper_bound
  2967. // * avoiding "modulo bias".
  2968. // *
  2969. // * Uniformity is achieved by generating new random numbers until the one
  2970. // * returned is outside the range [0, 2**32 % upper_bound). This
  2971. // * guarantees the selected random number will be inside
  2972. // * [2**32 % upper_bound, 2**32) which maps back to [0, upper_bound)
  2973. // * after reduction modulo upper_bound.
  2974. // */
  2975. func Xarc4random_uniform(tls *libc.TLS, upper_bound Tuint32_t) (r1 Tuint32_t) {
  2976. var min, r Tuint32_t
  2977. _, _ = min, r
  2978. if upper_bound < uint32(2) {
  2979. return uint32(0)
  2980. }
  2981. /* 2**32 % x == (2**32 - x) % x */
  2982. min = -upper_bound % upper_bound
  2983. /*
  2984. * This could theoretically loop forever but each retry has
  2985. * p > 0.5 (worst case, usually far better) of selecting a
  2986. * number inside the range we need, so it should rarely need
  2987. * to re-roll.
  2988. */
  2989. for {
  2990. r = Xarc4random(tls)
  2991. if r >= min {
  2992. break
  2993. }
  2994. goto _1
  2995. _1:
  2996. }
  2997. return r % upper_bound
  2998. }
  2999. const m_SEEK_CUR = 1
  3000. const m_SEEK_END = 2
  3001. const m_SEEK_SET = 0
  3002. const m_no_argument = 0
  3003. const m_optional_argument = 2
  3004. const m_required_argument = 1
  3005. type Toption = struct {
  3006. Fname uintptr
  3007. Fhas_arg int32
  3008. Fflag uintptr
  3009. Fval int32
  3010. }
  3011. func Xbsd_getopt(tls *libc.TLS, argc int32, argv uintptr, shortopts uintptr) (r int32) {
  3012. if Xoptreset == int32(1) {
  3013. Xoptreset = 0
  3014. libc.Xoptind = 0
  3015. }
  3016. /*
  3017. * Make sure we are using the system getopt() and not a possible
  3018. * overlay macro.
  3019. */
  3020. return libc.Xgetopt(tls, argc, argv, shortopts)
  3021. }
  3022. const m_DT_BLK = 6
  3023. const m_DT_CHR = 2
  3024. const m_DT_DIR = 4
  3025. const m_DT_FIFO = 1
  3026. const m_DT_LNK = 10
  3027. const m_DT_REG = 8
  3028. const m_DT_SOCK = 12
  3029. const m_DT_UNKNOWN = 0
  3030. const m_DT_WHT = 14
  3031. const m_INT_MAX1 = 2147483647
  3032. const m_OPEN_MAX = 256
  3033. const m_SYS__llseek = 140
  3034. const m_SYS__newselect = 142
  3035. const m_SYS__sysctl = 149
  3036. const m_SYS_accept = 330
  3037. const m_SYS_accept4 = 344
  3038. const m_SYS_access = 33
  3039. const m_SYS_acct = 51
  3040. const m_SYS_add_key = 269
  3041. const m_SYS_adjtimex = 124
  3042. const m_SYS_afs_syscall = 137
  3043. const m_SYS_alarm = 27
  3044. const m_SYS_bdflush = 134
  3045. const m_SYS_bind = 327
  3046. const m_SYS_bpf = 361
  3047. const m_SYS_break = 17
  3048. const m_SYS_brk = 45
  3049. const m_SYS_cachestat = 451
  3050. const m_SYS_capget = 183
  3051. const m_SYS_capset = 184
  3052. const m_SYS_chdir = 12
  3053. const m_SYS_chmod = 15
  3054. const m_SYS_chown = 181
  3055. const m_SYS_chroot = 61
  3056. const m_SYS_clock_adjtime = 347
  3057. const m_SYS_clock_getres = 247
  3058. const m_SYS_clock_gettime = 246
  3059. const m_SYS_clock_nanosleep = 248
  3060. const m_SYS_clock_settime = 245
  3061. const m_SYS_clone = 120
  3062. const m_SYS_clone3 = 435
  3063. const m_SYS_close = 6
  3064. const m_SYS_close_range = 436
  3065. const m_SYS_connect = 328
  3066. const m_SYS_copy_file_range = 379
  3067. const m_SYS_creat = 8
  3068. const m_SYS_create_module = 127
  3069. const m_SYS_delete_module = 129
  3070. const m_SYS_dup = 41
  3071. const m_SYS_dup2 = 63
  3072. const m_SYS_dup3 = 316
  3073. const m_SYS_epoll_create = 236
  3074. const m_SYS_epoll_create1 = 315
  3075. const m_SYS_epoll_ctl = 237
  3076. const m_SYS_epoll_pwait = 303
  3077. const m_SYS_epoll_pwait2 = 441
  3078. const m_SYS_epoll_wait = 238
  3079. const m_SYS_eventfd = 307
  3080. const m_SYS_eventfd2 = 314
  3081. const m_SYS_execve = 11
  3082. const m_SYS_execveat = 362
  3083. const m_SYS_exit = 1
  3084. const m_SYS_exit_group = 234
  3085. const m_SYS_faccessat = 298
  3086. const m_SYS_faccessat2 = 439
  3087. const m_SYS_fadvise64 = 233
  3088. const m_SYS_fallocate = 309
  3089. const m_SYS_fanotify_init = 323
  3090. const m_SYS_fanotify_mark = 324
  3091. const m_SYS_fchdir = 133
  3092. const m_SYS_fchmod = 94
  3093. const m_SYS_fchmodat = 297
  3094. const m_SYS_fchmodat2 = 452
  3095. const m_SYS_fchown = 95
  3096. const m_SYS_fchownat = 289
  3097. const m_SYS_fcntl = 55
  3098. const m_SYS_fdatasync = 148
  3099. const m_SYS_fgetxattr = 214
  3100. const m_SYS_finit_module = 353
  3101. const m_SYS_flistxattr = 217
  3102. const m_SYS_flock = 143
  3103. const m_SYS_fork = 2
  3104. const m_SYS_fremovexattr = 220
  3105. const m_SYS_fsconfig = 431
  3106. const m_SYS_fsetxattr = 211
  3107. const m_SYS_fsmount = 432
  3108. const m_SYS_fsopen = 430
  3109. const m_SYS_fspick = 433
  3110. const m_SYS_fstat = 108
  3111. const m_SYS_fstatfs = 100
  3112. const m_SYS_fstatfs64 = 253
  3113. const m_SYS_fsync = 118
  3114. const m_SYS_ftime = 35
  3115. const m_SYS_ftruncate = 93
  3116. const m_SYS_futex = 221
  3117. const m_SYS_futex_waitv = 449
  3118. const m_SYS_futimesat = 290
  3119. const m_SYS_get_kernel_syms = 130
  3120. const m_SYS_get_mempolicy = 260
  3121. const m_SYS_get_robust_list = 299
  3122. const m_SYS_getcpu = 302
  3123. const m_SYS_getcwd = 182
  3124. const m_SYS_getdents = 141
  3125. const m_SYS_getdents64 = 202
  3126. const m_SYS_getegid = 50
  3127. const m_SYS_geteuid = 49
  3128. const m_SYS_getgid = 47
  3129. const m_SYS_getgroups = 80
  3130. const m_SYS_getitimer = 105
  3131. const m_SYS_getpeername = 332
  3132. const m_SYS_getpgid = 132
  3133. const m_SYS_getpgrp = 65
  3134. const m_SYS_getpid = 20
  3135. const m_SYS_getpmsg = 187
  3136. const m_SYS_getppid = 64
  3137. const m_SYS_getpriority = 96
  3138. const m_SYS_getrandom = 359
  3139. const m_SYS_getresgid = 170
  3140. const m_SYS_getresuid = 165
  3141. const m_SYS_getrlimit = 76
  3142. const m_SYS_getrusage = 77
  3143. const m_SYS_getsid = 147
  3144. const m_SYS_getsockname = 331
  3145. const m_SYS_getsockopt = 340
  3146. const m_SYS_gettid = 207
  3147. const m_SYS_gettimeofday = 78
  3148. const m_SYS_getuid = 24
  3149. const m_SYS_getxattr = 212
  3150. const m_SYS_gtty = 32
  3151. const m_SYS_idle = 112
  3152. const m_SYS_init_module = 128
  3153. const m_SYS_inotify_add_watch = 276
  3154. const m_SYS_inotify_init = 275
  3155. const m_SYS_inotify_init1 = 318
  3156. const m_SYS_inotify_rm_watch = 277
  3157. const m_SYS_io_cancel = 231
  3158. const m_SYS_io_destroy = 228
  3159. const m_SYS_io_getevents = 229
  3160. const m_SYS_io_pgetevents = 388
  3161. const m_SYS_io_setup = 227
  3162. const m_SYS_io_submit = 230
  3163. const m_SYS_io_uring_enter = 426
  3164. const m_SYS_io_uring_register = 427
  3165. const m_SYS_io_uring_setup = 425
  3166. const m_SYS_ioctl = 54
  3167. const m_SYS_ioperm = 101
  3168. const m_SYS_iopl = 110
  3169. const m_SYS_ioprio_get = 274
  3170. const m_SYS_ioprio_set = 273
  3171. const m_SYS_ipc = 117
  3172. const m_SYS_kcmp = 354
  3173. const m_SYS_kexec_file_load = 382
  3174. const m_SYS_kexec_load = 268
  3175. const m_SYS_keyctl = 271
  3176. const m_SYS_kill = 37
  3177. const m_SYS_landlock_add_rule = 445
  3178. const m_SYS_landlock_create_ruleset = 444
  3179. const m_SYS_landlock_restrict_self = 446
  3180. const m_SYS_lchown = 16
  3181. const m_SYS_lgetxattr = 213
  3182. const m_SYS_link = 9
  3183. const m_SYS_linkat = 294
  3184. const m_SYS_listen = 329
  3185. const m_SYS_listxattr = 215
  3186. const m_SYS_llistxattr = 216
  3187. const m_SYS_lock = 53
  3188. const m_SYS_lookup_dcookie = 235
  3189. const m_SYS_lremovexattr = 219
  3190. const m_SYS_lseek = 19
  3191. const m_SYS_lsetxattr = 210
  3192. const m_SYS_lstat = 107
  3193. const m_SYS_madvise = 205
  3194. const m_SYS_mbind = 259
  3195. const m_SYS_membarrier = 365
  3196. const m_SYS_memfd_create = 360
  3197. const m_SYS_migrate_pages = 258
  3198. const m_SYS_mincore = 206
  3199. const m_SYS_mkdir = 39
  3200. const m_SYS_mkdirat = 287
  3201. const m_SYS_mknod = 14
  3202. const m_SYS_mknodat = 288
  3203. const m_SYS_mlock = 150
  3204. const m_SYS_mlock2 = 378
  3205. const m_SYS_mlockall = 152
  3206. const m_SYS_mmap = 90
  3207. const m_SYS_modify_ldt = 123
  3208. const m_SYS_mount = 21
  3209. const m_SYS_mount_setattr = 442
  3210. const m_SYS_move_mount = 429
  3211. const m_SYS_move_pages = 301
  3212. const m_SYS_mprotect = 125
  3213. const m_SYS_mpx = 56
  3214. const m_SYS_mq_getsetattr = 267
  3215. const m_SYS_mq_notify = 266
  3216. const m_SYS_mq_open = 262
  3217. const m_SYS_mq_timedreceive = 265
  3218. const m_SYS_mq_timedsend = 264
  3219. const m_SYS_mq_unlink = 263
  3220. const m_SYS_mremap = 163
  3221. const m_SYS_msgctl = 402
  3222. const m_SYS_msgget = 399
  3223. const m_SYS_msgrcv = 401
  3224. const m_SYS_msgsnd = 400
  3225. const m_SYS_msync = 144
  3226. const m_SYS_multiplexer = 201
  3227. const m_SYS_munlock = 151
  3228. const m_SYS_munlockall = 153
  3229. const m_SYS_munmap = 91
  3230. const m_SYS_name_to_handle_at = 345
  3231. const m_SYS_nanosleep = 162
  3232. const m_SYS_newfstatat = 291
  3233. const m_SYS_nfsservctl = 168
  3234. const m_SYS_nice = 34
  3235. const m_SYS_oldfstat = 28
  3236. const m_SYS_oldlstat = 84
  3237. const m_SYS_oldolduname = 59
  3238. const m_SYS_oldstat = 18
  3239. const m_SYS_olduname = 109
  3240. const m_SYS_open = 5
  3241. const m_SYS_open_by_handle_at = 346
  3242. const m_SYS_open_tree = 428
  3243. const m_SYS_openat = 286
  3244. const m_SYS_openat2 = 437
  3245. const m_SYS_pause = 29
  3246. const m_SYS_pciconfig_iobase = 200
  3247. const m_SYS_pciconfig_read = 198
  3248. const m_SYS_pciconfig_write = 199
  3249. const m_SYS_perf_event_open = 319
  3250. const m_SYS_personality = 136
  3251. const m_SYS_pidfd_getfd = 438
  3252. const m_SYS_pidfd_open = 434
  3253. const m_SYS_pidfd_send_signal = 424
  3254. const m_SYS_pipe = 42
  3255. const m_SYS_pipe2 = 317
  3256. const m_SYS_pivot_root = 203
  3257. const m_SYS_pkey_alloc = 384
  3258. const m_SYS_pkey_free = 385
  3259. const m_SYS_pkey_mprotect = 386
  3260. const m_SYS_poll = 167
  3261. const m_SYS_ppoll = 281
  3262. const m_SYS_prctl = 171
  3263. const m_SYS_pread64 = 179
  3264. const m_SYS_preadv = 320
  3265. const m_SYS_preadv2 = 380
  3266. const m_SYS_prlimit64 = 325
  3267. const m_SYS_process_madvise = 440
  3268. const m_SYS_process_mrelease = 448
  3269. const m_SYS_process_vm_readv = 351
  3270. const m_SYS_process_vm_writev = 352
  3271. const m_SYS_prof = 44
  3272. const m_SYS_profil = 98
  3273. const m_SYS_pselect6 = 280
  3274. const m_SYS_ptrace = 26
  3275. const m_SYS_putpmsg = 188
  3276. const m_SYS_pwrite64 = 180
  3277. const m_SYS_pwritev = 321
  3278. const m_SYS_pwritev2 = 381
  3279. const m_SYS_query_module = 166
  3280. const m_SYS_quotactl = 131
  3281. const m_SYS_read = 3
  3282. const m_SYS_readahead = 191
  3283. const m_SYS_readdir = 89
  3284. const m_SYS_readlink = 85
  3285. const m_SYS_readlinkat = 296
  3286. const m_SYS_readv = 145
  3287. const m_SYS_reboot = 88
  3288. const m_SYS_recv = 336
  3289. const m_SYS_recvfrom = 337
  3290. const m_SYS_recvmmsg = 343
  3291. const m_SYS_recvmsg = 342
  3292. const m_SYS_remap_file_pages = 239
  3293. const m_SYS_removexattr = 218
  3294. const m_SYS_rename = 38
  3295. const m_SYS_renameat = 293
  3296. const m_SYS_renameat2 = 357
  3297. const m_SYS_request_key = 270
  3298. const m_SYS_restart_syscall = 0
  3299. const m_SYS_rmdir = 40
  3300. const m_SYS_rseq = 387
  3301. const m_SYS_rt_sigaction = 173
  3302. const m_SYS_rt_sigpending = 175
  3303. const m_SYS_rt_sigprocmask = 174
  3304. const m_SYS_rt_sigqueueinfo = 177
  3305. const m_SYS_rt_sigreturn = 172
  3306. const m_SYS_rt_sigsuspend = 178
  3307. const m_SYS_rt_sigtimedwait = 176
  3308. const m_SYS_rt_tgsigqueueinfo = 322
  3309. const m_SYS_rtas = 255
  3310. const m_SYS_sched_get_priority_max = 159
  3311. const m_SYS_sched_get_priority_min = 160
  3312. const m_SYS_sched_getaffinity = 223
  3313. const m_SYS_sched_getattr = 356
  3314. const m_SYS_sched_getparam = 155
  3315. const m_SYS_sched_getscheduler = 157
  3316. const m_SYS_sched_rr_get_interval = 161
  3317. const m_SYS_sched_setaffinity = 222
  3318. const m_SYS_sched_setattr = 355
  3319. const m_SYS_sched_setparam = 154
  3320. const m_SYS_sched_setscheduler = 156
  3321. const m_SYS_sched_yield = 158
  3322. const m_SYS_seccomp = 358
  3323. const m_SYS_select = 82
  3324. const m_SYS_semctl = 394
  3325. const m_SYS_semget = 393
  3326. const m_SYS_semtimedop = 392
  3327. const m_SYS_send = 334
  3328. const m_SYS_sendfile = 186
  3329. const m_SYS_sendmmsg = 349
  3330. const m_SYS_sendmsg = 341
  3331. const m_SYS_sendto = 335
  3332. const m_SYS_set_mempolicy = 261
  3333. const m_SYS_set_mempolicy_home_node = 450
  3334. const m_SYS_set_robust_list = 300
  3335. const m_SYS_set_tid_address = 232
  3336. const m_SYS_setdomainname = 121
  3337. const m_SYS_setfsgid = 139
  3338. const m_SYS_setfsuid = 138
  3339. const m_SYS_setgid = 46
  3340. const m_SYS_setgroups = 81
  3341. const m_SYS_sethostname = 74
  3342. const m_SYS_setitimer = 104
  3343. const m_SYS_setns = 350
  3344. const m_SYS_setpgid = 57
  3345. const m_SYS_setpriority = 97
  3346. const m_SYS_setregid = 71
  3347. const m_SYS_setresgid = 169
  3348. const m_SYS_setresuid = 164
  3349. const m_SYS_setreuid = 70
  3350. const m_SYS_setrlimit = 75
  3351. const m_SYS_setsid = 66
  3352. const m_SYS_setsockopt = 339
  3353. const m_SYS_settimeofday = 79
  3354. const m_SYS_setuid = 23
  3355. const m_SYS_setxattr = 209
  3356. const m_SYS_sgetmask = 68
  3357. const m_SYS_shmat = 397
  3358. const m_SYS_shmctl = 396
  3359. const m_SYS_shmdt = 398
  3360. const m_SYS_shmget = 395
  3361. const m_SYS_shutdown = 338
  3362. const m_SYS_sigaction = 67
  3363. const m_SYS_sigaltstack = 185
  3364. const m_SYS_signal = 48
  3365. const m_SYS_signalfd = 305
  3366. const m_SYS_signalfd4 = 313
  3367. const m_SYS_sigpending = 73
  3368. const m_SYS_sigprocmask = 126
  3369. const m_SYS_sigreturn = 119
  3370. const m_SYS_sigsuspend = 72
  3371. const m_SYS_socket = 326
  3372. const m_SYS_socketcall = 102
  3373. const m_SYS_socketpair = 333
  3374. const m_SYS_splice = 283
  3375. const m_SYS_spu_create = 279
  3376. const m_SYS_spu_run = 278
  3377. const m_SYS_ssetmask = 69
  3378. const m_SYS_stat = 106
  3379. const m_SYS_statfs = 99
  3380. const m_SYS_statfs64 = 252
  3381. const m_SYS_statx = 383
  3382. const m_SYS_stime = 25
  3383. const m_SYS_stty = 31
  3384. const m_SYS_subpage_prot = 310
  3385. const m_SYS_swapcontext = 249
  3386. const m_SYS_swapoff = 115
  3387. const m_SYS_swapon = 87
  3388. const m_SYS_switch_endian = 363
  3389. const m_SYS_symlink = 83
  3390. const m_SYS_symlinkat = 295
  3391. const m_SYS_sync = 36
  3392. const m_SYS_sync_file_range2 = 308
  3393. const m_SYS_syncfs = 348
  3394. const m_SYS_sys_debug_setcontext = 256
  3395. const m_SYS_sysfs = 135
  3396. const m_SYS_sysinfo = 116
  3397. const m_SYS_syslog = 103
  3398. const m_SYS_tee = 284
  3399. const m_SYS_tgkill = 250
  3400. const m_SYS_time = 13
  3401. const m_SYS_timer_create = 240
  3402. const m_SYS_timer_delete = 244
  3403. const m_SYS_timer_getoverrun = 243
  3404. const m_SYS_timer_gettime = 242
  3405. const m_SYS_timer_settime = 241
  3406. const m_SYS_timerfd_create = 306
  3407. const m_SYS_timerfd_gettime = 312
  3408. const m_SYS_timerfd_settime = 311
  3409. const m_SYS_times = 43
  3410. const m_SYS_tkill = 208
  3411. const m_SYS_truncate = 92
  3412. const m_SYS_tuxcall = 225
  3413. const m_SYS_ugetrlimit = 190
  3414. const m_SYS_ulimit = 58
  3415. const m_SYS_umask = 60
  3416. const m_SYS_umount = 22
  3417. const m_SYS_umount2 = 52
  3418. const m_SYS_uname = 122
  3419. const m_SYS_unlink = 10
  3420. const m_SYS_unlinkat = 292
  3421. const m_SYS_unshare = 282
  3422. const m_SYS_uselib = 86
  3423. const m_SYS_userfaultfd = 364
  3424. const m_SYS_ustat = 62
  3425. const m_SYS_utime = 30
  3426. const m_SYS_utimensat = 304
  3427. const m_SYS_utimes = 251
  3428. const m_SYS_vfork = 189
  3429. const m_SYS_vhangup = 111
  3430. const m_SYS_vm86 = 113
  3431. const m_SYS_vmsplice = 285
  3432. const m_SYS_wait4 = 114
  3433. const m_SYS_waitid = 272
  3434. const m_SYS_waitpid = 7
  3435. const m_SYS_write = 4
  3436. const m_SYS_writev = 146
  3437. const m_UINT_MAX1 = 4294967295
  3438. const m___NR__llseek = 140
  3439. const m___NR__newselect = 142
  3440. const m___NR__sysctl = 149
  3441. const m___NR_accept = 330
  3442. const m___NR_accept4 = 344
  3443. const m___NR_access = 33
  3444. const m___NR_acct = 51
  3445. const m___NR_add_key = 269
  3446. const m___NR_adjtimex = 124
  3447. const m___NR_afs_syscall = 137
  3448. const m___NR_alarm = 27
  3449. const m___NR_bdflush = 134
  3450. const m___NR_bind = 327
  3451. const m___NR_bpf = 361
  3452. const m___NR_break = 17
  3453. const m___NR_brk = 45
  3454. const m___NR_cachestat = 451
  3455. const m___NR_capget = 183
  3456. const m___NR_capset = 184
  3457. const m___NR_chdir = 12
  3458. const m___NR_chmod = 15
  3459. const m___NR_chown = 181
  3460. const m___NR_chroot = 61
  3461. const m___NR_clock_adjtime = 347
  3462. const m___NR_clock_getres = 247
  3463. const m___NR_clock_gettime = 246
  3464. const m___NR_clock_nanosleep = 248
  3465. const m___NR_clock_settime = 245
  3466. const m___NR_clone = 120
  3467. const m___NR_clone3 = 435
  3468. const m___NR_close = 6
  3469. const m___NR_close_range = 436
  3470. const m___NR_connect = 328
  3471. const m___NR_copy_file_range = 379
  3472. const m___NR_creat = 8
  3473. const m___NR_create_module = 127
  3474. const m___NR_delete_module = 129
  3475. const m___NR_dup = 41
  3476. const m___NR_dup2 = 63
  3477. const m___NR_dup3 = 316
  3478. const m___NR_epoll_create = 236
  3479. const m___NR_epoll_create1 = 315
  3480. const m___NR_epoll_ctl = 237
  3481. const m___NR_epoll_pwait = 303
  3482. const m___NR_epoll_pwait2 = 441
  3483. const m___NR_epoll_wait = 238
  3484. const m___NR_eventfd = 307
  3485. const m___NR_eventfd2 = 314
  3486. const m___NR_execve = 11
  3487. const m___NR_execveat = 362
  3488. const m___NR_exit = 1
  3489. const m___NR_exit_group = 234
  3490. const m___NR_faccessat = 298
  3491. const m___NR_faccessat2 = 439
  3492. const m___NR_fadvise64 = 233
  3493. const m___NR_fallocate = 309
  3494. const m___NR_fanotify_init = 323
  3495. const m___NR_fanotify_mark = 324
  3496. const m___NR_fchdir = 133
  3497. const m___NR_fchmod = 94
  3498. const m___NR_fchmodat = 297
  3499. const m___NR_fchmodat2 = 452
  3500. const m___NR_fchown = 95
  3501. const m___NR_fchownat = 289
  3502. const m___NR_fcntl = 55
  3503. const m___NR_fdatasync = 148
  3504. const m___NR_fgetxattr = 214
  3505. const m___NR_finit_module = 353
  3506. const m___NR_flistxattr = 217
  3507. const m___NR_flock = 143
  3508. const m___NR_fork = 2
  3509. const m___NR_fremovexattr = 220
  3510. const m___NR_fsconfig = 431
  3511. const m___NR_fsetxattr = 211
  3512. const m___NR_fsmount = 432
  3513. const m___NR_fsopen = 430
  3514. const m___NR_fspick = 433
  3515. const m___NR_fstat = 108
  3516. const m___NR_fstatfs = 100
  3517. const m___NR_fstatfs64 = 253
  3518. const m___NR_fsync = 118
  3519. const m___NR_ftime = 35
  3520. const m___NR_ftruncate = 93
  3521. const m___NR_futex = 221
  3522. const m___NR_futex_waitv = 449
  3523. const m___NR_futimesat = 290
  3524. const m___NR_get_kernel_syms = 130
  3525. const m___NR_get_mempolicy = 260
  3526. const m___NR_get_robust_list = 299
  3527. const m___NR_getcpu = 302
  3528. const m___NR_getcwd = 182
  3529. const m___NR_getdents = 141
  3530. const m___NR_getdents64 = 202
  3531. const m___NR_getegid = 50
  3532. const m___NR_geteuid = 49
  3533. const m___NR_getgid = 47
  3534. const m___NR_getgroups = 80
  3535. const m___NR_getitimer = 105
  3536. const m___NR_getpeername = 332
  3537. const m___NR_getpgid = 132
  3538. const m___NR_getpgrp = 65
  3539. const m___NR_getpid = 20
  3540. const m___NR_getpmsg = 187
  3541. const m___NR_getppid = 64
  3542. const m___NR_getpriority = 96
  3543. const m___NR_getrandom = 359
  3544. const m___NR_getresgid = 170
  3545. const m___NR_getresuid = 165
  3546. const m___NR_getrlimit = 76
  3547. const m___NR_getrusage = 77
  3548. const m___NR_getsid = 147
  3549. const m___NR_getsockname = 331
  3550. const m___NR_getsockopt = 340
  3551. const m___NR_gettid = 207
  3552. const m___NR_gettimeofday = 78
  3553. const m___NR_getuid = 24
  3554. const m___NR_getxattr = 212
  3555. const m___NR_gtty = 32
  3556. const m___NR_idle = 112
  3557. const m___NR_init_module = 128
  3558. const m___NR_inotify_add_watch = 276
  3559. const m___NR_inotify_init = 275
  3560. const m___NR_inotify_init1 = 318
  3561. const m___NR_inotify_rm_watch = 277
  3562. const m___NR_io_cancel = 231
  3563. const m___NR_io_destroy = 228
  3564. const m___NR_io_getevents = 229
  3565. const m___NR_io_pgetevents = 388
  3566. const m___NR_io_setup = 227
  3567. const m___NR_io_submit = 230
  3568. const m___NR_io_uring_enter = 426
  3569. const m___NR_io_uring_register = 427
  3570. const m___NR_io_uring_setup = 425
  3571. const m___NR_ioctl = 54
  3572. const m___NR_ioperm = 101
  3573. const m___NR_iopl = 110
  3574. const m___NR_ioprio_get = 274
  3575. const m___NR_ioprio_set = 273
  3576. const m___NR_ipc = 117
  3577. const m___NR_kcmp = 354
  3578. const m___NR_kexec_file_load = 382
  3579. const m___NR_kexec_load = 268
  3580. const m___NR_keyctl = 271
  3581. const m___NR_kill = 37
  3582. const m___NR_landlock_add_rule = 445
  3583. const m___NR_landlock_create_ruleset = 444
  3584. const m___NR_landlock_restrict_self = 446
  3585. const m___NR_lchown = 16
  3586. const m___NR_lgetxattr = 213
  3587. const m___NR_link = 9
  3588. const m___NR_linkat = 294
  3589. const m___NR_listen = 329
  3590. const m___NR_listxattr = 215
  3591. const m___NR_llistxattr = 216
  3592. const m___NR_lock = 53
  3593. const m___NR_lookup_dcookie = 235
  3594. const m___NR_lremovexattr = 219
  3595. const m___NR_lseek = 19
  3596. const m___NR_lsetxattr = 210
  3597. const m___NR_lstat = 107
  3598. const m___NR_madvise = 205
  3599. const m___NR_mbind = 259
  3600. const m___NR_membarrier = 365
  3601. const m___NR_memfd_create = 360
  3602. const m___NR_migrate_pages = 258
  3603. const m___NR_mincore = 206
  3604. const m___NR_mkdir = 39
  3605. const m___NR_mkdirat = 287
  3606. const m___NR_mknod = 14
  3607. const m___NR_mknodat = 288
  3608. const m___NR_mlock = 150
  3609. const m___NR_mlock2 = 378
  3610. const m___NR_mlockall = 152
  3611. const m___NR_mmap = 90
  3612. const m___NR_modify_ldt = 123
  3613. const m___NR_mount = 21
  3614. const m___NR_mount_setattr = 442
  3615. const m___NR_move_mount = 429
  3616. const m___NR_move_pages = 301
  3617. const m___NR_mprotect = 125
  3618. const m___NR_mpx = 56
  3619. const m___NR_mq_getsetattr = 267
  3620. const m___NR_mq_notify = 266
  3621. const m___NR_mq_open = 262
  3622. const m___NR_mq_timedreceive = 265
  3623. const m___NR_mq_timedsend = 264
  3624. const m___NR_mq_unlink = 263
  3625. const m___NR_mremap = 163
  3626. const m___NR_msgctl = 402
  3627. const m___NR_msgget = 399
  3628. const m___NR_msgrcv = 401
  3629. const m___NR_msgsnd = 400
  3630. const m___NR_msync = 144
  3631. const m___NR_multiplexer = 201
  3632. const m___NR_munlock = 151
  3633. const m___NR_munlockall = 153
  3634. const m___NR_munmap = 91
  3635. const m___NR_name_to_handle_at = 345
  3636. const m___NR_nanosleep = 162
  3637. const m___NR_newfstatat = 291
  3638. const m___NR_nfsservctl = 168
  3639. const m___NR_nice = 34
  3640. const m___NR_oldfstat = 28
  3641. const m___NR_oldlstat = 84
  3642. const m___NR_oldolduname = 59
  3643. const m___NR_oldstat = 18
  3644. const m___NR_olduname = 109
  3645. const m___NR_open = 5
  3646. const m___NR_open_by_handle_at = 346
  3647. const m___NR_open_tree = 428
  3648. const m___NR_openat = 286
  3649. const m___NR_openat2 = 437
  3650. const m___NR_pause = 29
  3651. const m___NR_pciconfig_iobase = 200
  3652. const m___NR_pciconfig_read = 198
  3653. const m___NR_pciconfig_write = 199
  3654. const m___NR_perf_event_open = 319
  3655. const m___NR_personality = 136
  3656. const m___NR_pidfd_getfd = 438
  3657. const m___NR_pidfd_open = 434
  3658. const m___NR_pidfd_send_signal = 424
  3659. const m___NR_pipe = 42
  3660. const m___NR_pipe2 = 317
  3661. const m___NR_pivot_root = 203
  3662. const m___NR_pkey_alloc = 384
  3663. const m___NR_pkey_free = 385
  3664. const m___NR_pkey_mprotect = 386
  3665. const m___NR_poll = 167
  3666. const m___NR_ppoll = 281
  3667. const m___NR_prctl = 171
  3668. const m___NR_pread64 = 179
  3669. const m___NR_preadv = 320
  3670. const m___NR_preadv2 = 380
  3671. const m___NR_prlimit64 = 325
  3672. const m___NR_process_madvise = 440
  3673. const m___NR_process_mrelease = 448
  3674. const m___NR_process_vm_readv = 351
  3675. const m___NR_process_vm_writev = 352
  3676. const m___NR_prof = 44
  3677. const m___NR_profil = 98
  3678. const m___NR_pselect6 = 280
  3679. const m___NR_ptrace = 26
  3680. const m___NR_putpmsg = 188
  3681. const m___NR_pwrite64 = 180
  3682. const m___NR_pwritev = 321
  3683. const m___NR_pwritev2 = 381
  3684. const m___NR_query_module = 166
  3685. const m___NR_quotactl = 131
  3686. const m___NR_read = 3
  3687. const m___NR_readahead = 191
  3688. const m___NR_readdir = 89
  3689. const m___NR_readlink = 85
  3690. const m___NR_readlinkat = 296
  3691. const m___NR_readv = 145
  3692. const m___NR_reboot = 88
  3693. const m___NR_recv = 336
  3694. const m___NR_recvfrom = 337
  3695. const m___NR_recvmmsg = 343
  3696. const m___NR_recvmsg = 342
  3697. const m___NR_remap_file_pages = 239
  3698. const m___NR_removexattr = 218
  3699. const m___NR_rename = 38
  3700. const m___NR_renameat = 293
  3701. const m___NR_renameat2 = 357
  3702. const m___NR_request_key = 270
  3703. const m___NR_restart_syscall = 0
  3704. const m___NR_rmdir = 40
  3705. const m___NR_rseq = 387
  3706. const m___NR_rt_sigaction = 173
  3707. const m___NR_rt_sigpending = 175
  3708. const m___NR_rt_sigprocmask = 174
  3709. const m___NR_rt_sigqueueinfo = 177
  3710. const m___NR_rt_sigreturn = 172
  3711. const m___NR_rt_sigsuspend = 178
  3712. const m___NR_rt_sigtimedwait = 176
  3713. const m___NR_rt_tgsigqueueinfo = 322
  3714. const m___NR_rtas = 255
  3715. const m___NR_sched_get_priority_max = 159
  3716. const m___NR_sched_get_priority_min = 160
  3717. const m___NR_sched_getaffinity = 223
  3718. const m___NR_sched_getattr = 356
  3719. const m___NR_sched_getparam = 155
  3720. const m___NR_sched_getscheduler = 157
  3721. const m___NR_sched_rr_get_interval = 161
  3722. const m___NR_sched_setaffinity = 222
  3723. const m___NR_sched_setattr = 355
  3724. const m___NR_sched_setparam = 154
  3725. const m___NR_sched_setscheduler = 156
  3726. const m___NR_sched_yield = 158
  3727. const m___NR_seccomp = 358
  3728. const m___NR_select = 82
  3729. const m___NR_semctl = 394
  3730. const m___NR_semget = 393
  3731. const m___NR_semtimedop = 392
  3732. const m___NR_send = 334
  3733. const m___NR_sendfile = 186
  3734. const m___NR_sendmmsg = 349
  3735. const m___NR_sendmsg = 341
  3736. const m___NR_sendto = 335
  3737. const m___NR_set_mempolicy = 261
  3738. const m___NR_set_mempolicy_home_node = 450
  3739. const m___NR_set_robust_list = 300
  3740. const m___NR_set_tid_address = 232
  3741. const m___NR_setdomainname = 121
  3742. const m___NR_setfsgid = 139
  3743. const m___NR_setfsuid = 138
  3744. const m___NR_setgid = 46
  3745. const m___NR_setgroups = 81
  3746. const m___NR_sethostname = 74
  3747. const m___NR_setitimer = 104
  3748. const m___NR_setns = 350
  3749. const m___NR_setpgid = 57
  3750. const m___NR_setpriority = 97
  3751. const m___NR_setregid = 71
  3752. const m___NR_setresgid = 169
  3753. const m___NR_setresuid = 164
  3754. const m___NR_setreuid = 70
  3755. const m___NR_setrlimit = 75
  3756. const m___NR_setsid = 66
  3757. const m___NR_setsockopt = 339
  3758. const m___NR_settimeofday = 79
  3759. const m___NR_setuid = 23
  3760. const m___NR_setxattr = 209
  3761. const m___NR_sgetmask = 68
  3762. const m___NR_shmat = 397
  3763. const m___NR_shmctl = 396
  3764. const m___NR_shmdt = 398
  3765. const m___NR_shmget = 395
  3766. const m___NR_shutdown = 338
  3767. const m___NR_sigaction = 67
  3768. const m___NR_sigaltstack = 185
  3769. const m___NR_signal = 48
  3770. const m___NR_signalfd = 305
  3771. const m___NR_signalfd4 = 313
  3772. const m___NR_sigpending = 73
  3773. const m___NR_sigprocmask = 126
  3774. const m___NR_sigreturn = 119
  3775. const m___NR_sigsuspend = 72
  3776. const m___NR_socket = 326
  3777. const m___NR_socketcall = 102
  3778. const m___NR_socketpair = 333
  3779. const m___NR_splice = 283
  3780. const m___NR_spu_create = 279
  3781. const m___NR_spu_run = 278
  3782. const m___NR_ssetmask = 69
  3783. const m___NR_stat = 106
  3784. const m___NR_statfs = 99
  3785. const m___NR_statfs64 = 252
  3786. const m___NR_statx = 383
  3787. const m___NR_stime = 25
  3788. const m___NR_stty = 31
  3789. const m___NR_subpage_prot = 310
  3790. const m___NR_swapcontext = 249
  3791. const m___NR_swapoff = 115
  3792. const m___NR_swapon = 87
  3793. const m___NR_switch_endian = 363
  3794. const m___NR_symlink = 83
  3795. const m___NR_symlinkat = 295
  3796. const m___NR_sync = 36
  3797. const m___NR_sync_file_range2 = 308
  3798. const m___NR_syncfs = 348
  3799. const m___NR_sys_debug_setcontext = 256
  3800. const m___NR_sysfs = 135
  3801. const m___NR_sysinfo = 116
  3802. const m___NR_syslog = 103
  3803. const m___NR_tee = 284
  3804. const m___NR_tgkill = 250
  3805. const m___NR_time = 13
  3806. const m___NR_timer_create = 240
  3807. const m___NR_timer_delete = 244
  3808. const m___NR_timer_getoverrun = 243
  3809. const m___NR_timer_gettime = 242
  3810. const m___NR_timer_settime = 241
  3811. const m___NR_timerfd_create = 306
  3812. const m___NR_timerfd_gettime = 312
  3813. const m___NR_timerfd_settime = 311
  3814. const m___NR_times = 43
  3815. const m___NR_tkill = 208
  3816. const m___NR_truncate = 92
  3817. const m___NR_tuxcall = 225
  3818. const m___NR_ugetrlimit = 190
  3819. const m___NR_ulimit = 58
  3820. const m___NR_umask = 60
  3821. const m___NR_umount = 22
  3822. const m___NR_umount2 = 52
  3823. const m___NR_uname = 122
  3824. const m___NR_unlink = 10
  3825. const m___NR_unlinkat = 292
  3826. const m___NR_unshare = 282
  3827. const m___NR_uselib = 86
  3828. const m___NR_userfaultfd = 364
  3829. const m___NR_ustat = 62
  3830. const m___NR_utime = 30
  3831. const m___NR_utimensat = 304
  3832. const m___NR_utimes = 251
  3833. const m___NR_vfork = 189
  3834. const m___NR_vhangup = 111
  3835. const m___NR_vm86 = 113
  3836. const m___NR_vmsplice = 285
  3837. const m___NR_wait4 = 114
  3838. const m___NR_waitid = 272
  3839. const m___NR_waitpid = 7
  3840. const m___NR_write = 4
  3841. const m___NR_writev = 146
  3842. const m_d_fileno = "d_ino"
  3843. type Tdirent = struct {
  3844. Fd_ino Tino_t
  3845. Fd_off Toff_t
  3846. Fd_reclen uint16
  3847. Fd_type uint8
  3848. Fd_name [256]uint8
  3849. }
  3850. func _closefrom_close(tls *libc.TLS, fd int32) {
  3851. libc.Xclose(tls, fd)
  3852. }
  3853. func _sys_close_range(tls *libc.TLS, fd uint32, max_fd uint32, flags uint32) (r int32) {
  3854. bp := tls.Alloc(32)
  3855. defer tls.Free(32)
  3856. return int32(libc.Xsyscall(tls, int64(m_SYS_close_range), libc.VaList(bp+8, fd, max_fd, flags)))
  3857. }
  3858. // C documentation
  3859. //
  3860. // /*
  3861. // * Close all file descriptors greater than or equal to lowfd.
  3862. // * This is the expensive (fallback) method.
  3863. // */
  3864. func _closefrom_fallback(tls *libc.TLS, lowfd int32) {
  3865. var fd, maxfd int64
  3866. _, _ = fd, maxfd
  3867. /*
  3868. * Fall back on sysconf(_SC_OPEN_MAX) or getdtablesize(). This is
  3869. * equivalent to checking the RLIMIT_NOFILE soft limit. It is
  3870. * possible for there to be open file descriptors past this limit
  3871. * but there is not much we can do about that since the hard limit
  3872. * may be RLIM_INFINITY (LLONG_MAX or ULLONG_MAX on modern systems).
  3873. */
  3874. maxfd = libc.Xsysconf(tls, int32(m__SC_OPEN_MAX))
  3875. if maxfd < int64(m_OPEN_MAX) {
  3876. maxfd = int64(m_OPEN_MAX)
  3877. }
  3878. /* Make sure we did not get RLIM_INFINITY as the upper limit. */
  3879. if maxfd > int64(m_INT_MAX1) {
  3880. maxfd = int64(m_INT_MAX1)
  3881. }
  3882. fd = int64(lowfd)
  3883. for {
  3884. if !(fd < maxfd) {
  3885. break
  3886. }
  3887. _closefrom_close(tls, int32(fd))
  3888. goto _1
  3889. _1:
  3890. ;
  3891. fd++
  3892. }
  3893. }
  3894. func _closefrom_procfs(tls *libc.TLS, lowfd int32) (r int32) {
  3895. bp := tls.Alloc(16)
  3896. defer tls.Free(16)
  3897. var dent, dirp, fd_array, path, ptr, v1 uintptr
  3898. var fd, fd_array_size, fd_array_used, i, ret, v2 int32
  3899. var _ /* errstr at bp+0 */ uintptr
  3900. _, _, _, _, _, _, _, _, _, _, _, _ = dent, dirp, fd, fd_array, fd_array_size, fd_array_used, i, path, ptr, ret, v1, v2
  3901. fd_array = libc.UintptrFromInt32(0)
  3902. fd_array_used = 0
  3903. fd_array_size = 0
  3904. ret = 0
  3905. /* Use /proc/self/fd (or /dev/fd on macOS) if it exists. */
  3906. path = __ccgo_ts
  3907. dirp = libc.Xopendir(tls, path)
  3908. if dirp == libc.UintptrFromInt32(0) {
  3909. return -int32(1)
  3910. }
  3911. for {
  3912. v1 = libc.Xreaddir(tls, dirp)
  3913. dent = v1
  3914. if !(v1 != libc.UintptrFromInt32(0)) {
  3915. break
  3916. }
  3917. fd = int32(Xstrtonum(tls, dent+19, int64(lowfd), int64(m_INT_MAX1), bp))
  3918. if *(*uintptr)(unsafe.Pointer(bp)) != libc.UintptrFromInt32(0) || fd == libc.Xdirfd(tls, dirp) {
  3919. continue
  3920. }
  3921. if fd_array_used >= fd_array_size {
  3922. if fd_array_size > 0 {
  3923. fd_array_size *= int32(2)
  3924. } else {
  3925. fd_array_size = int32(32)
  3926. }
  3927. ptr = Xreallocarray(tls, fd_array, libc.Uint64FromInt32(fd_array_size), uint64(4))
  3928. if ptr == libc.UintptrFromInt32(0) {
  3929. ret = -int32(1)
  3930. break
  3931. }
  3932. fd_array = ptr
  3933. }
  3934. v2 = fd_array_used
  3935. fd_array_used++
  3936. *(*int32)(unsafe.Pointer(fd_array + uintptr(v2)*4)) = fd
  3937. }
  3938. i = 0
  3939. for {
  3940. if !(i < fd_array_used) {
  3941. break
  3942. }
  3943. _closefrom_close(tls, *(*int32)(unsafe.Pointer(fd_array + uintptr(i)*4)))
  3944. goto _3
  3945. _3:
  3946. ;
  3947. i++
  3948. }
  3949. libc.Xfree(tls, fd_array)
  3950. libc.Xclosedir(tls, dirp)
  3951. return ret
  3952. }
  3953. // C documentation
  3954. //
  3955. // /*
  3956. // * Close all file descriptors greater than or equal to lowfd.
  3957. // * We try the fast way first, falling back on the slow method.
  3958. // */
  3959. func Xclosefrom(tls *libc.TLS, lowfd int32) {
  3960. if lowfd < 0 {
  3961. lowfd = 0
  3962. }
  3963. /* Try the fast methods first, if possible. */
  3964. if _sys_close_range(tls, libc.Uint32FromInt32(lowfd), uint32(0xffffffff), uint32(0)) == 0 {
  3965. return
  3966. }
  3967. if _closefrom_procfs(tls, lowfd) != -int32(1) {
  3968. return
  3969. }
  3970. /* Do things the slow way. */
  3971. _closefrom_fallback(tls, lowfd)
  3972. }
  3973. /*
  3974. * Copyright © 2004-2024 Guillem Jover <guillem@hadrons.org>
  3975. *
  3976. * Redistribution and use in source and binary forms, with or without
  3977. * modification, are permitted provided that the following conditions
  3978. * are met:
  3979. * 1. Redistributions of source code must retain the above copyright
  3980. * notice, this list of conditions and the following disclaimer.
  3981. * 2. Redistributions in binary form must reproduce the above copyright
  3982. * notice, this list of conditions and the following disclaimer in the
  3983. * documentation and/or other materials provided with the distribution.
  3984. * 3. The name of the author may not be used to endorse or promote products
  3985. * derived from this software without specific prior written permission.
  3986. *
  3987. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  3988. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  3989. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  3990. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  3991. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  3992. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  3993. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  3994. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  3995. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  3996. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  3997. */
  3998. func Xvwarnc(tls *libc.TLS, code int32, format uintptr, ap Tva_list) {
  3999. bp := tls.Alloc(16)
  4000. defer tls.Free(16)
  4001. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+14, libc.VaList(bp+8, Xgetprogname(tls)))
  4002. if format != 0 {
  4003. libc.Xvfprintf(tls, libc.Xstderr, format, ap)
  4004. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+19, 0)
  4005. }
  4006. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+22, libc.VaList(bp+8, libc.Xstrerror(tls, code)))
  4007. }
  4008. func Xwarnc(tls *libc.TLS, code int32, format uintptr, va uintptr) {
  4009. var ap Tva_list
  4010. _ = ap
  4011. ap = va
  4012. Xvwarnc(tls, code, format, ap)
  4013. _ = ap
  4014. }
  4015. func Xverrc(tls *libc.TLS, status int32, code int32, format uintptr, ap Tva_list) {
  4016. bp := tls.Alloc(16)
  4017. defer tls.Free(16)
  4018. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+14, libc.VaList(bp+8, Xgetprogname(tls)))
  4019. if format != 0 {
  4020. libc.Xvfprintf(tls, libc.Xstderr, format, ap)
  4021. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+19, 0)
  4022. }
  4023. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+22, libc.VaList(bp+8, libc.Xstrerror(tls, code)))
  4024. libc.Xexit(tls, status)
  4025. }
  4026. func Xerrc(tls *libc.TLS, status int32, code int32, format uintptr, va uintptr) {
  4027. var ap Tva_list
  4028. _ = ap
  4029. ap = va
  4030. Xverrc(tls, status, code, format, ap)
  4031. _ = ap
  4032. }
  4033. const m_PRIX16 = "X"
  4034. const m_PRIX32 = "X"
  4035. const m_PRIX8 = "X"
  4036. const m_PRIXFAST16 = "X"
  4037. const m_PRIXFAST32 = "X"
  4038. const m_PRIXFAST8 = "X"
  4039. const m_PRIXLEAST16 = "X"
  4040. const m_PRIXLEAST32 = "X"
  4041. const m_PRIXLEAST8 = "X"
  4042. const m_PRId16 = "d"
  4043. const m_PRId32 = "d"
  4044. const m_PRId8 = "d"
  4045. const m_PRIdFAST16 = "d"
  4046. const m_PRIdFAST32 = "d"
  4047. const m_PRIdFAST8 = "d"
  4048. const m_PRIdLEAST16 = "d"
  4049. const m_PRIdLEAST32 = "d"
  4050. const m_PRIdLEAST8 = "d"
  4051. const m_PRIi16 = "i"
  4052. const m_PRIi32 = "i"
  4053. const m_PRIi8 = "i"
  4054. const m_PRIiFAST16 = "i"
  4055. const m_PRIiFAST32 = "i"
  4056. const m_PRIiFAST8 = "i"
  4057. const m_PRIiLEAST16 = "i"
  4058. const m_PRIiLEAST32 = "i"
  4059. const m_PRIiLEAST8 = "i"
  4060. const m_PRIo16 = "o"
  4061. const m_PRIo32 = "o"
  4062. const m_PRIo8 = "o"
  4063. const m_PRIoFAST16 = "o"
  4064. const m_PRIoFAST32 = "o"
  4065. const m_PRIoFAST8 = "o"
  4066. const m_PRIoLEAST16 = "o"
  4067. const m_PRIoLEAST32 = "o"
  4068. const m_PRIoLEAST8 = "o"
  4069. const m_PRIu16 = "u"
  4070. const m_PRIu32 = "u"
  4071. const m_PRIu8 = "u"
  4072. const m_PRIuFAST16 = "u"
  4073. const m_PRIuFAST32 = "u"
  4074. const m_PRIuFAST8 = "u"
  4075. const m_PRIuLEAST16 = "u"
  4076. const m_PRIuLEAST32 = "u"
  4077. const m_PRIuLEAST8 = "u"
  4078. const m_PRIx16 = "x"
  4079. const m_PRIx32 = "x"
  4080. const m_PRIx8 = "x"
  4081. const m_PRIxFAST16 = "x"
  4082. const m_PRIxFAST32 = "x"
  4083. const m_PRIxFAST8 = "x"
  4084. const m_PRIxLEAST16 = "x"
  4085. const m_PRIxLEAST32 = "x"
  4086. const m_PRIxLEAST8 = "x"
  4087. const m_SCNd16 = "hd"
  4088. const m_SCNd32 = "d"
  4089. const m_SCNd8 = "hhd"
  4090. const m_SCNdFAST16 = "d"
  4091. const m_SCNdFAST32 = "d"
  4092. const m_SCNdFAST8 = "hhd"
  4093. const m_SCNdLEAST16 = "hd"
  4094. const m_SCNdLEAST32 = "d"
  4095. const m_SCNdLEAST8 = "hhd"
  4096. const m_SCNi16 = "hi"
  4097. const m_SCNi32 = "i"
  4098. const m_SCNi8 = "hhi"
  4099. const m_SCNiFAST16 = "i"
  4100. const m_SCNiFAST32 = "i"
  4101. const m_SCNiFAST8 = "hhi"
  4102. const m_SCNiLEAST16 = "hi"
  4103. const m_SCNiLEAST32 = "i"
  4104. const m_SCNiLEAST8 = "hhi"
  4105. const m_SCNo16 = "ho"
  4106. const m_SCNo32 = "o"
  4107. const m_SCNo8 = "hho"
  4108. const m_SCNoFAST16 = "o"
  4109. const m_SCNoFAST32 = "o"
  4110. const m_SCNoFAST8 = "hho"
  4111. const m_SCNoLEAST16 = "ho"
  4112. const m_SCNoLEAST32 = "o"
  4113. const m_SCNoLEAST8 = "hho"
  4114. const m_SCNu16 = "hu"
  4115. const m_SCNu32 = "u"
  4116. const m_SCNu8 = "hhu"
  4117. const m_SCNuFAST16 = "u"
  4118. const m_SCNuFAST32 = "u"
  4119. const m_SCNuFAST8 = "hhu"
  4120. const m_SCNuLEAST16 = "hu"
  4121. const m_SCNuLEAST32 = "u"
  4122. const m_SCNuLEAST8 = "hhu"
  4123. const m_SCNx16 = "hx"
  4124. const m_SCNx32 = "x"
  4125. const m_SCNx8 = "hhx"
  4126. const m_SCNxFAST16 = "x"
  4127. const m_SCNxFAST32 = "x"
  4128. const m_SCNxFAST8 = "hhx"
  4129. const m_SCNxLEAST16 = "hx"
  4130. const m_SCNxLEAST32 = "x"
  4131. const m_SCNxLEAST8 = "hhx"
  4132. const m___PRI64 = "l"
  4133. const m___PRIPTR = "l"
  4134. type Timaxdiv_t = struct {
  4135. Fquot Tintmax_t
  4136. Frem Tintmax_t
  4137. }
  4138. /* Values for humanize_number(3)'s flags parameter. */
  4139. /* Values for humanize_number(3)'s scale parameter. */
  4140. /*
  4141. * fparseln() specific operation flags.
  4142. */
  4143. // C documentation
  4144. //
  4145. // /*
  4146. // * Convert an expression of the following forms to a uint64_t.
  4147. // * 1) A positive decimal number.
  4148. // * 2) A positive decimal number followed by a 'b' or 'B' (mult by 1).
  4149. // * 3) A positive decimal number followed by a 'k' or 'K' (mult by 1 << 10).
  4150. // * 4) A positive decimal number followed by a 'm' or 'M' (mult by 1 << 20).
  4151. // * 5) A positive decimal number followed by a 'g' or 'G' (mult by 1 << 30).
  4152. // * 6) A positive decimal number followed by a 't' or 'T' (mult by 1 << 40).
  4153. // * 7) A positive decimal number followed by a 'p' or 'P' (mult by 1 << 50).
  4154. // * 8) A positive decimal number followed by a 'e' or 'E' (mult by 1 << 60).
  4155. // */
  4156. func Xexpand_number(tls *libc.TLS, buf uintptr, num uintptr) (r int32) {
  4157. bp := tls.Alloc(16)
  4158. defer tls.Free(16)
  4159. var number Tuint64_t
  4160. var shift uint32
  4161. var _ /* endptr at bp+0 */ uintptr
  4162. _, _ = number, shift
  4163. number = libc.Xstrtoumax(tls, buf, bp, 0)
  4164. if *(*uintptr)(unsafe.Pointer(bp)) == buf {
  4165. /* No valid digits. */
  4166. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  4167. return -int32(1)
  4168. }
  4169. switch libc.Xtolower(tls, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))) {
  4170. case int32('e'):
  4171. shift = uint32(60)
  4172. case int32('p'):
  4173. shift = uint32(50)
  4174. case int32('t'):
  4175. shift = uint32(40)
  4176. case int32('g'):
  4177. shift = uint32(30)
  4178. case int32('m'):
  4179. shift = uint32(20)
  4180. case int32('k'):
  4181. shift = uint32(10)
  4182. case int32('b'):
  4183. fallthrough
  4184. case int32('\000'): /* No unit. */
  4185. *(*Tuint64_t)(unsafe.Pointer(num)) = number
  4186. return 0
  4187. default:
  4188. /* Unrecognized unit. */
  4189. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  4190. return -int32(1)
  4191. }
  4192. if number<<shift>>shift != number {
  4193. /* Overflow */
  4194. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ERANGE)
  4195. return -int32(1)
  4196. }
  4197. *(*Tuint64_t)(unsafe.Pointer(num)) = number << shift
  4198. return 0
  4199. }
  4200. func X__explicit_bzero_hook(tls *libc.TLS, buf uintptr, len1 Tsize_t) {
  4201. }
  4202. func Xexplicit_bzero(tls *libc.TLS, buf uintptr, len1 Tsize_t) {
  4203. libc.Xmemset(tls, buf, 0, len1)
  4204. X__explicit_bzero_hook(tls, buf, len1)
  4205. }
  4206. const m_FILEBUF_POOL_ITEMS = 32
  4207. /*
  4208. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  4209. *
  4210. * Redistribution and use in source and binary forms, with or without
  4211. * modification, are permitted provided that the following conditions
  4212. * are met:
  4213. * 1. Redistributions of source code must retain the above copyright
  4214. * notice, this list of conditions and the following disclaimer.
  4215. * 2. Redistributions in binary form must reproduce the above copyright
  4216. * notice, this list of conditions and the following disclaimer in the
  4217. * documentation and/or other materials provided with the distribution.
  4218. * 3. The name of the author may not be used to endorse or promote products
  4219. * derived from this software without specific prior written permission.
  4220. *
  4221. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  4222. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  4223. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  4224. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  4225. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  4226. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  4227. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  4228. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  4229. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  4230. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  4231. */
  4232. /*
  4233. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  4234. *
  4235. * Redistribution and use in source and binary forms, with or without
  4236. * modification, are permitted provided that the following conditions
  4237. * are met:
  4238. * 1. Redistributions of source code must retain the above copyright
  4239. * notice, this list of conditions and the following disclaimer.
  4240. * 2. Redistributions in binary form must reproduce the above copyright
  4241. * notice, this list of conditions and the following disclaimer in the
  4242. * documentation and/or other materials provided with the distribution.
  4243. * 3. The name of the author may not be used to endorse or promote products
  4244. * derived from this software without specific prior written permission.
  4245. *
  4246. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  4247. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  4248. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  4249. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  4250. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  4251. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  4252. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  4253. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  4254. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  4255. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  4256. */
  4257. /* Clang expands this to 1 if an identifier is *not* reserved. */
  4258. /*
  4259. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  4260. * musl, try to handle this gracefully.
  4261. */
  4262. /* Copyright (C) 1992-2020 Free Software Foundation, Inc.
  4263. This file is part of the GNU C Library.
  4264. The GNU C Library is free software; you can redistribute it and/or
  4265. modify it under the terms of the GNU Lesser General Public
  4266. License as published by the Free Software Foundation; either
  4267. version 2.1 of the License, or (at your option) any later version.
  4268. The GNU C Library is distributed in the hope that it will be useful,
  4269. but WITHOUT ANY WARRANTY; without even the implied warranty of
  4270. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  4271. Lesser General Public License for more details.
  4272. You should have received a copy of the GNU Lesser General Public
  4273. License along with the GNU C Library; if not, see
  4274. <https://www.gnu.org/licenses/>. */
  4275. type Tfilebuf = struct {
  4276. Ffp uintptr
  4277. Fbuf uintptr
  4278. Flen1 Tsize_t
  4279. }
  4280. var _fb_pool [32]Tfilebuf
  4281. var _fb_pool_cur int32
  4282. func Xfgetln(tls *libc.TLS, stream uintptr, len1 uintptr) (r uintptr) {
  4283. var fb uintptr
  4284. var nread Tssize_t
  4285. _, _ = fb, nread
  4286. libc.Xflockfile(tls, stream)
  4287. /* Try to diminish the possibility of several fgetln() calls being
  4288. * used on different streams, by using a pool of buffers per file. */
  4289. fb = uintptr(unsafe.Pointer(&_fb_pool)) + uintptr(_fb_pool_cur)*24
  4290. if (*Tfilebuf)(unsafe.Pointer(fb)).Ffp != stream && (*Tfilebuf)(unsafe.Pointer(fb)).Ffp != libc.UintptrFromInt32(0) {
  4291. _fb_pool_cur++
  4292. _fb_pool_cur %= int32(m_FILEBUF_POOL_ITEMS)
  4293. fb = uintptr(unsafe.Pointer(&_fb_pool)) + uintptr(_fb_pool_cur)*24
  4294. }
  4295. (*Tfilebuf)(unsafe.Pointer(fb)).Ffp = stream
  4296. nread = libc.Xgetline(tls, fb+8, fb+16, stream)
  4297. libc.Xfunlockfile(tls, stream)
  4298. /* Note: the getdelim/getline API ensures nread != 0. */
  4299. if nread == int64(-int32(1)) {
  4300. *(*Tsize_t)(unsafe.Pointer(len1)) = uint64(0)
  4301. return libc.UintptrFromInt32(0)
  4302. } else {
  4303. *(*Tsize_t)(unsafe.Pointer(len1)) = libc.Uint64FromInt64(nread)
  4304. return (*Tfilebuf)(unsafe.Pointer(fb)).Fbuf
  4305. }
  4306. return r
  4307. }
  4308. var _libbsd_emit_link_warning_fgetln = [115]uint8{'T', 'h', 'e', ' ', 'f', 'g', 'e', 't', 'l', 'n', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'c', 'a', 'n', 'n', 'o', 't', ' ', 'b', 'e', ' ', 's', 'a', 'f', 'e', 'l', 'y', ' ', 'p', 'o', 'r', 't', 'e', 'd', ',', ' ', 'u', 's', 'e', ' ', 'g', 'e', 't', 'l', 'i', 'n', 'e', '(', '3', ')', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', ',', ' ', 'a', 's', ' ', 'i', 't', ' ', 'i', 's', ' ', 's', 'u', 'p', 'p', 'o', 'r', 't', 'e', 'd', ' ', 'b', 'y', ' ', 'G', 'N', 'U', ' ', 'a', 'n', 'd', ' ', 'P', 'O', 'S', 'I', 'X', '.', '1', '-', '2', '0', '0', '8', '.'}
  4309. const m_FILEWBUF_INIT_LEN = 128
  4310. const m_FILEWBUF_POOL_ITEMS = 32
  4311. type Twint_t = uint32
  4312. type Twctype_t = uint64
  4313. type Tmbstate_t = struct {
  4314. F__opaque1 uint32
  4315. F__opaque2 uint32
  4316. }
  4317. type t__mbstate_t = Tmbstate_t
  4318. /*
  4319. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  4320. *
  4321. * Redistribution and use in source and binary forms, with or without
  4322. * modification, are permitted provided that the following conditions
  4323. * are met:
  4324. * 1. Redistributions of source code must retain the above copyright
  4325. * notice, this list of conditions and the following disclaimer.
  4326. * 2. Redistributions in binary form must reproduce the above copyright
  4327. * notice, this list of conditions and the following disclaimer in the
  4328. * documentation and/or other materials provided with the distribution.
  4329. * 3. The name of the author may not be used to endorse or promote products
  4330. * derived from this software without specific prior written permission.
  4331. *
  4332. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  4333. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  4334. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  4335. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  4336. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  4337. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  4338. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  4339. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  4340. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  4341. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  4342. */
  4343. /*
  4344. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  4345. *
  4346. * Redistribution and use in source and binary forms, with or without
  4347. * modification, are permitted provided that the following conditions
  4348. * are met:
  4349. * 1. Redistributions of source code must retain the above copyright
  4350. * notice, this list of conditions and the following disclaimer.
  4351. * 2. Redistributions in binary form must reproduce the above copyright
  4352. * notice, this list of conditions and the following disclaimer in the
  4353. * documentation and/or other materials provided with the distribution.
  4354. * 3. The name of the author may not be used to endorse or promote products
  4355. * derived from this software without specific prior written permission.
  4356. *
  4357. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  4358. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  4359. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  4360. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  4361. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  4362. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  4363. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  4364. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  4365. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  4366. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  4367. */
  4368. /* Clang expands this to 1 if an identifier is *not* reserved. */
  4369. /*
  4370. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  4371. * musl, try to handle this gracefully.
  4372. */
  4373. /* Copyright (C) 1992-2020 Free Software Foundation, Inc.
  4374. This file is part of the GNU C Library.
  4375. The GNU C Library is free software; you can redistribute it and/or
  4376. modify it under the terms of the GNU Lesser General Public
  4377. License as published by the Free Software Foundation; either
  4378. version 2.1 of the License, or (at your option) any later version.
  4379. The GNU C Library is distributed in the hope that it will be useful,
  4380. but WITHOUT ANY WARRANTY; without even the implied warranty of
  4381. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  4382. Lesser General Public License for more details.
  4383. You should have received a copy of the GNU Lesser General Public
  4384. License along with the GNU C Library; if not, see
  4385. <https://www.gnu.org/licenses/>. */
  4386. type Tfilewbuf = struct {
  4387. Ffp uintptr
  4388. Fwbuf uintptr
  4389. Flen1 Tsize_t
  4390. }
  4391. var _fb_pool1 [32]Tfilewbuf
  4392. var _fb_pool_cur1 int32
  4393. func Xfgetwln(tls *libc.TLS, stream uintptr, lenp uintptr) (r uintptr) {
  4394. var fb, wp, v3 uintptr
  4395. var wc, v1 Twint_t
  4396. var wused, v2 Tsize_t
  4397. _, _, _, _, _, _, _ = fb, wc, wp, wused, v1, v2, v3
  4398. wused = uint64(0)
  4399. /* Try to diminish the possibility of several fgetwln() calls being
  4400. * used on different streams, by using a pool of buffers per file. */
  4401. fb = uintptr(unsafe.Pointer(&_fb_pool1)) + uintptr(_fb_pool_cur1)*24
  4402. if (*Tfilewbuf)(unsafe.Pointer(fb)).Ffp != stream && (*Tfilewbuf)(unsafe.Pointer(fb)).Ffp != libc.UintptrFromInt32(0) {
  4403. _fb_pool_cur1++
  4404. _fb_pool_cur1 %= int32(m_FILEWBUF_POOL_ITEMS)
  4405. fb = uintptr(unsafe.Pointer(&_fb_pool1)) + uintptr(_fb_pool_cur1)*24
  4406. }
  4407. (*Tfilewbuf)(unsafe.Pointer(fb)).Ffp = stream
  4408. for {
  4409. v1 = libc.Xfgetwc(tls, stream)
  4410. wc = v1
  4411. if !(v1 != uint32(0xffffffff)) {
  4412. break
  4413. }
  4414. if !((*Tfilewbuf)(unsafe.Pointer(fb)).Flen1 != 0) || wused >= (*Tfilewbuf)(unsafe.Pointer(fb)).Flen1 {
  4415. if (*Tfilewbuf)(unsafe.Pointer(fb)).Flen1 != 0 {
  4416. *(*Tsize_t)(unsafe.Pointer(fb + 16)) *= uint64(2)
  4417. } else {
  4418. (*Tfilewbuf)(unsafe.Pointer(fb)).Flen1 = uint64(m_FILEWBUF_INIT_LEN)
  4419. }
  4420. wp = Xreallocarray(tls, (*Tfilewbuf)(unsafe.Pointer(fb)).Fwbuf, (*Tfilewbuf)(unsafe.Pointer(fb)).Flen1, uint64(4))
  4421. if wp == libc.UintptrFromInt32(0) {
  4422. wused = uint64(0)
  4423. break
  4424. }
  4425. (*Tfilewbuf)(unsafe.Pointer(fb)).Fwbuf = wp
  4426. }
  4427. v2 = wused
  4428. wused++
  4429. *(*Twchar_t)(unsafe.Pointer((*Tfilewbuf)(unsafe.Pointer(fb)).Fwbuf + uintptr(v2)*4)) = libc.Int32FromUint32(wc)
  4430. if wc == uint32('\n') {
  4431. break
  4432. }
  4433. }
  4434. *(*Tsize_t)(unsafe.Pointer(lenp)) = wused
  4435. if wused != 0 {
  4436. v3 = (*Tfilewbuf)(unsafe.Pointer(fb)).Fwbuf
  4437. } else {
  4438. v3 = libc.UintptrFromInt32(0)
  4439. }
  4440. return v3
  4441. }
  4442. // C documentation
  4443. //
  4444. // /* XXX: Ideally we'd recommend getwline(3), but unfortunately even though it
  4445. // * was part of the ISO/IEC TR 24731-2:2010 draft, it did not make it into C11
  4446. // * and is not widely implemented. */
  4447. var _libbsd_emit_link_warning_fgetwln = [115]uint8{'T', 'h', 'e', ' ', 'f', 'g', 'e', 't', 'w', 'l', 'n', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'c', 'a', 'n', 'n', 'o', 't', ' ', 'b', 'e', ' ', 's', 'a', 'f', 'e', 'l', 'y', ' ', 'p', 'o', 'r', 't', 'e', 'd', ',', ' ', 'u', 's', 'e', ' ', 'f', 'g', 'e', 't', 'w', 'c', '(', '3', ')', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', ',', ' ', 'a', 's', ' ', 'i', 't', ' ', 'i', 's', ' ', 's', 'u', 'p', 'p', 'o', 'r', 't', 'e', 'd', ' ', 'b', 'y', ' ', 'C', '9', '9', ' ', 'a', 'n', 'd', ' ', 'P', 'O', 'S', 'I', 'X', '.', '1', '-', '2', '0', '0', '1', '.'}
  4448. const m_FPARSELN_UNESCALL1 = 15
  4449. const m_FPARSELN_UNESCCOMM1 = 4
  4450. const m_FPARSELN_UNESCCONT1 = 2
  4451. const m_FPARSELN_UNESCESC1 = 1
  4452. const m_FPARSELN_UNESCREST1 = 8
  4453. const m_static_assert = "_Static_assert"
  4454. // C documentation
  4455. //
  4456. // /* isescaped():
  4457. // * Return true if the character in *p that belongs to a string
  4458. // * that starts in *sp, is escaped by the escape character esc.
  4459. // */
  4460. func _isescaped(tls *libc.TLS, sp uintptr, p uintptr, esc int32) (r int32) {
  4461. var cp, v2 uintptr
  4462. var ne Tsize_t
  4463. _, _, _ = cp, ne, v2
  4464. /* No escape character */
  4465. if esc == int32('\000') {
  4466. return 0
  4467. }
  4468. /* Count the number of escape characters that precede ours */
  4469. ne = uint64(0)
  4470. cp = p
  4471. for {
  4472. cp--
  4473. v2 = cp
  4474. if !(v2 >= sp && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) == esc) {
  4475. break
  4476. }
  4477. goto _1
  4478. goto _1
  4479. _1:
  4480. ;
  4481. ne++
  4482. }
  4483. /* Return true if odd number of escape characters */
  4484. return libc.BoolInt32(ne&uint64(1) != uint64(0))
  4485. }
  4486. // C documentation
  4487. //
  4488. // /* fparseln():
  4489. // * Read a line from a file parsing continuations ending in * and eliminating trailing newlines, or comments starting with
  4490. // * the comment char.
  4491. // */
  4492. func Xfparseln(tls *libc.TLS, fp uintptr, size uintptr, lineno uintptr, str uintptr, flags int32) (r uintptr) {
  4493. bp := tls.Alloc(16)
  4494. defer tls.Free(16)
  4495. var buf, cp, v2, v3, v4, v5, v6, v7, v8, v9 uintptr
  4496. var cnt, skipesc int32
  4497. var com, con, esc, nl uint8
  4498. var len1 Tsize_t
  4499. var s Tssize_t
  4500. var _ /* ptr at bp+8 */ uintptr
  4501. var _ /* ptrlen at bp+0 */ Tsize_t
  4502. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = buf, cnt, com, con, cp, esc, len1, nl, s, skipesc, v2, v3, v4, v5, v6, v7, v8, v9
  4503. len1 = uint64(0)
  4504. buf = libc.UintptrFromInt32(0)
  4505. *(*Tsize_t)(unsafe.Pointer(bp)) = uint64(0)
  4506. *(*uintptr)(unsafe.Pointer(bp + 8)) = libc.UintptrFromInt32(0)
  4507. cnt = int32(1)
  4508. if str == libc.UintptrFromInt32(0) {
  4509. str = uintptr(unsafe.Pointer(&_dstr))
  4510. }
  4511. esc = *(*uint8)(unsafe.Pointer(str))
  4512. con = *(*uint8)(unsafe.Pointer(str + 1))
  4513. com = *(*uint8)(unsafe.Pointer(str + 2))
  4514. /*
  4515. * XXX: it would be cool to be able to specify the newline character,
  4516. * getdelim(3) does let us, but supporting it would diverge from BSDs.
  4517. */
  4518. nl = uint8('\n')
  4519. libc.Xflockfile(tls, fp)
  4520. for cnt != 0 {
  4521. cnt = 0
  4522. if lineno != 0 {
  4523. *(*Tsize_t)(unsafe.Pointer(lineno))++
  4524. }
  4525. s = libc.Xgetline(tls, bp+8, bp, fp)
  4526. if s < 0 {
  4527. break
  4528. }
  4529. if s != 0 && com != 0 { /* Check and eliminate comments */
  4530. cp = *(*uintptr)(unsafe.Pointer(bp + 8))
  4531. for {
  4532. if !(cp < *(*uintptr)(unsafe.Pointer(bp + 8))+uintptr(s)) {
  4533. break
  4534. }
  4535. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) == libc.Int32FromUint8(com) && !(_isescaped(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), cp, libc.Int32FromUint8(esc)) != 0) {
  4536. s = int64(cp) - int64(*(*uintptr)(unsafe.Pointer(bp + 8)))
  4537. cnt = libc.BoolInt32(s == 0 && buf == libc.UintptrFromInt32(0))
  4538. break
  4539. }
  4540. goto _1
  4541. _1:
  4542. ;
  4543. cp++
  4544. }
  4545. }
  4546. if s != 0 && nl != 0 { /* Check and eliminate newlines */
  4547. cp = *(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(s-int64(1))
  4548. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) == libc.Int32FromUint8(nl) {
  4549. s--
  4550. } /* forget newline */
  4551. }
  4552. if s != 0 && con != 0 { /* Check and eliminate continuations */
  4553. cp = *(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(s-int64(1))
  4554. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) == libc.Int32FromUint8(con) && !(_isescaped(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), cp, libc.Int32FromUint8(esc)) != 0) {
  4555. s-- /* forget continuation char */
  4556. cnt = int32(1)
  4557. }
  4558. }
  4559. if s == 0 {
  4560. /*
  4561. * nothing to add, skip realloc except in case
  4562. * we need a minimal buf to return an empty line
  4563. */
  4564. if cnt != 0 || buf != libc.UintptrFromInt32(0) {
  4565. continue
  4566. }
  4567. }
  4568. v2 = libc.Xrealloc(tls, buf, len1+libc.Uint64FromInt64(s)+uint64(1))
  4569. cp = v2
  4570. if v2 == libc.UintptrFromInt32(0) {
  4571. libc.Xfunlockfile(tls, fp)
  4572. libc.Xfree(tls, buf)
  4573. libc.Xfree(tls, *(*uintptr)(unsafe.Pointer(bp + 8)))
  4574. return libc.UintptrFromInt32(0)
  4575. }
  4576. buf = cp
  4577. libc.Xmemcpy(tls, buf+uintptr(len1), *(*uintptr)(unsafe.Pointer(bp + 8)), libc.Uint64FromInt64(s))
  4578. len1 += libc.Uint64FromInt64(s)
  4579. *(*uint8)(unsafe.Pointer(buf + uintptr(len1))) = uint8('\000')
  4580. }
  4581. libc.Xfunlockfile(tls, fp)
  4582. libc.Xfree(tls, *(*uintptr)(unsafe.Pointer(bp + 8)))
  4583. if flags&int32(m_FPARSELN_UNESCALL1) != 0 && esc != 0 && buf != libc.UintptrFromInt32(0) && libc.Xstrchr(tls, buf, libc.Int32FromUint8(esc)) != libc.UintptrFromInt32(0) {
  4584. v3 = buf
  4585. cp = v3
  4586. *(*uintptr)(unsafe.Pointer(bp + 8)) = v3
  4587. for libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) != int32('\000') {
  4588. for libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) != int32('\000') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) != libc.Int32FromUint8(esc) {
  4589. v4 = *(*uintptr)(unsafe.Pointer(bp + 8))
  4590. *(*uintptr)(unsafe.Pointer(bp + 8))++
  4591. v5 = cp
  4592. cp++
  4593. *(*uint8)(unsafe.Pointer(v4)) = *(*uint8)(unsafe.Pointer(v5))
  4594. }
  4595. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) == int32('\000') || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + 1))) == int32('\000') {
  4596. break
  4597. }
  4598. skipesc = 0
  4599. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + 1))) == libc.Int32FromUint8(com) {
  4600. skipesc += flags & int32(m_FPARSELN_UNESCCOMM1)
  4601. }
  4602. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + 1))) == libc.Int32FromUint8(con) {
  4603. skipesc += flags & int32(m_FPARSELN_UNESCCONT1)
  4604. }
  4605. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + 1))) == libc.Int32FromUint8(esc) {
  4606. skipesc += flags & int32(m_FPARSELN_UNESCESC1)
  4607. }
  4608. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + 1))) != libc.Int32FromUint8(com) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + 1))) != libc.Int32FromUint8(con) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + 1))) != libc.Int32FromUint8(esc) {
  4609. skipesc = flags & int32(m_FPARSELN_UNESCREST1)
  4610. }
  4611. if skipesc != 0 {
  4612. cp++
  4613. } else {
  4614. v6 = *(*uintptr)(unsafe.Pointer(bp + 8))
  4615. *(*uintptr)(unsafe.Pointer(bp + 8))++
  4616. v7 = cp
  4617. cp++
  4618. *(*uint8)(unsafe.Pointer(v6)) = *(*uint8)(unsafe.Pointer(v7))
  4619. }
  4620. v8 = *(*uintptr)(unsafe.Pointer(bp + 8))
  4621. *(*uintptr)(unsafe.Pointer(bp + 8))++
  4622. v9 = cp
  4623. cp++
  4624. *(*uint8)(unsafe.Pointer(v8)) = *(*uint8)(unsafe.Pointer(v9))
  4625. }
  4626. *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))) = uint8('\000')
  4627. len1 = libc.Xstrlen(tls, buf)
  4628. }
  4629. if size != 0 {
  4630. *(*Tsize_t)(unsafe.Pointer(size)) = len1
  4631. }
  4632. return buf
  4633. }
  4634. var _dstr = [3]uint8{
  4635. 0: uint8('\\'),
  4636. 1: uint8('\\'),
  4637. 2: uint8('#'),
  4638. }
  4639. const m_FPARSELN_UNESCALL2 = 0x0f
  4640. const m_FPARSELN_UNESCCOMM2 = 0x04
  4641. const m_FPARSELN_UNESCCONT2 = 0x02
  4642. const m_FPARSELN_UNESCESC2 = 0x01
  4643. const m_FPARSELN_UNESCREST2 = 0x08
  4644. const m_LOCK_EX = 2
  4645. const m_LOCK_NB = 4
  4646. const m_LOCK_SH = 1
  4647. const m_LOCK_UN = 8
  4648. const m_O_CREAT1 = 64
  4649. const m_O_NONBLOCK1 = 2048
  4650. const m_O_TRUNC1 = 512
  4651. /* Values for humanize_number(3)'s flags parameter. */
  4652. /* Values for humanize_number(3)'s scale parameter. */
  4653. /*
  4654. * fparseln() specific operation flags.
  4655. */
  4656. func _lock_file(tls *libc.TLS, fd int32, flags int32) (r int32) {
  4657. var operation int32
  4658. _ = operation
  4659. operation = int32(m_LOCK_EX)
  4660. if flags&int32(m_O_NONBLOCK1) != 0 {
  4661. operation |= int32(m_LOCK_NB)
  4662. }
  4663. return libc.Xflock(tls, fd, operation)
  4664. }
  4665. // C documentation
  4666. //
  4667. // /*
  4668. // * Reliably open and lock a file.
  4669. // *
  4670. // * Please do not modify this code without first reading the revision history
  4671. // * and discussing your changes with <des@freebsd.org>. Don't be fooled by the
  4672. // * code's apparent simplicity; there would be no need for this function if it
  4673. // * was easy to get right.
  4674. // */
  4675. func _vflopenat(tls *libc.TLS, dirfd int32, path uintptr, flags int32, ap Tva_list) (r int32) {
  4676. bp := tls.Alloc(304)
  4677. defer tls.Free(304)
  4678. var fd, serrno, trunc, v2 int32
  4679. var mode Tmode_t
  4680. var _ /* fsb at bp+144 */ Tstat
  4681. var _ /* sb at bp+0 */ Tstat
  4682. _, _, _, _, _ = fd, mode, serrno, trunc, v2
  4683. mode = uint32(0)
  4684. if flags&int32(m_O_CREAT1) != 0 {
  4685. mode = libc.Uint32FromInt32(libc.VaInt32(&ap)) /* mode_t promoted to int */
  4686. }
  4687. trunc = flags & int32(m_O_TRUNC1)
  4688. flags &= ^libc.Int32FromInt32(m_O_TRUNC1)
  4689. for {
  4690. v2 = libc.Xopenat(tls, dirfd, path, flags, libc.VaList(bp+296, mode))
  4691. fd = v2
  4692. if v2 == -int32(1) {
  4693. /* non-existent or no access */
  4694. return -int32(1)
  4695. }
  4696. if _lock_file(tls, fd, flags) == -int32(1) {
  4697. /* unsupported or interrupted */
  4698. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  4699. libc.Xclose(tls, fd)
  4700. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  4701. return -int32(1)
  4702. }
  4703. if libc.Xfstatat(tls, dirfd, path, bp, 0) == -int32(1) {
  4704. /* disappeared from under our feet */
  4705. libc.Xclose(tls, fd)
  4706. goto _1
  4707. }
  4708. if libc.Xfstat(tls, fd, bp+144) == -int32(1) {
  4709. /* can't happen [tm] */
  4710. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  4711. libc.Xclose(tls, fd)
  4712. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  4713. return -int32(1)
  4714. }
  4715. if (*(*Tstat)(unsafe.Pointer(bp))).Fst_dev != (*(*Tstat)(unsafe.Pointer(bp + 144))).Fst_dev || (*(*Tstat)(unsafe.Pointer(bp))).Fst_ino != (*(*Tstat)(unsafe.Pointer(bp + 144))).Fst_ino {
  4716. /* changed under our feet */
  4717. libc.Xclose(tls, fd)
  4718. goto _1
  4719. }
  4720. if trunc != 0 && libc.Xftruncate(tls, fd, 0) != 0 {
  4721. /* can't happen [tm] */
  4722. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  4723. libc.Xclose(tls, fd)
  4724. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  4725. return -int32(1)
  4726. }
  4727. /*
  4728. * The following change is provided as a specific example to
  4729. * avoid.
  4730. */
  4731. return fd
  4732. goto _1
  4733. _1:
  4734. }
  4735. return r
  4736. }
  4737. func Xflopen(tls *libc.TLS, path uintptr, flags int32, va uintptr) (r int32) {
  4738. var ap Tva_list
  4739. var ret int32
  4740. _, _ = ap, ret
  4741. ap = va
  4742. ret = _vflopenat(tls, -int32(100), path, flags, ap)
  4743. _ = ap
  4744. return ret
  4745. }
  4746. func Xflopenat(tls *libc.TLS, dirfd int32, path uintptr, flags int32, va uintptr) (r int32) {
  4747. var ap Tva_list
  4748. var ret int32
  4749. _, _ = ap, ret
  4750. ap = va
  4751. ret = _vflopenat(tls, dirfd, path, flags, ap)
  4752. _ = ap
  4753. return ret
  4754. }
  4755. type ___e_fmtcheck_types = int32
  4756. const _FMTCHECK_START = 0
  4757. const _FMTCHECK_SHORT = 1
  4758. const _FMTCHECK_INT = 2
  4759. const _FMTCHECK_WINTT = 3
  4760. const _FMTCHECK_LONG = 4
  4761. const _FMTCHECK_QUAD = 5
  4762. const _FMTCHECK_INTMAXT = 6
  4763. const _FMTCHECK_PTRDIFFT = 7
  4764. const _FMTCHECK_SIZET = 8
  4765. const _FMTCHECK_POINTER = 9
  4766. const _FMTCHECK_CHARPOINTER = 10
  4767. const _FMTCHECK_SHORTPOINTER = 11
  4768. const _FMTCHECK_INTPOINTER = 12
  4769. const _FMTCHECK_LONGPOINTER = 13
  4770. const _FMTCHECK_QUADPOINTER = 14
  4771. const _FMTCHECK_INTMAXTPOINTER = 15
  4772. const _FMTCHECK_PTRDIFFTPOINTER = 16
  4773. const _FMTCHECK_SIZETPOINTER = 17
  4774. const _FMTCHECK_DOUBLE = 18
  4775. const _FMTCHECK_LONGDOUBLE = 19
  4776. const _FMTCHECK_STRING = 20
  4777. const _FMTCHECK_WSTRING = 21
  4778. const _FMTCHECK_WIDTH = 22
  4779. const _FMTCHECK_PRECISION = 23
  4780. const _FMTCHECK_DONE = 24
  4781. const _FMTCHECK_UNKNOWN = 25
  4782. type TEFT = int32
  4783. type _e_modifier = int32
  4784. const _MOD_NONE = 0
  4785. const _MOD_CHAR = 1
  4786. const _MOD_SHORT = 2
  4787. const _MOD_LONG = 3
  4788. const _MOD_QUAD = 4
  4789. const _MOD_INTMAXT = 5
  4790. const _MOD_LONGDOUBLE = 6
  4791. const _MOD_PTRDIFFT = 7
  4792. const _MOD_SIZET = 8
  4793. func _get_next_format_from_precision(tls *libc.TLS, pf uintptr) (r TEFT) {
  4794. var f uintptr
  4795. var modifier _e_modifier
  4796. _, _ = f, modifier
  4797. f = *(*uintptr)(unsafe.Pointer(pf))
  4798. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) {
  4799. case int32('h'):
  4800. f++
  4801. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  4802. *(*uintptr)(unsafe.Pointer(pf)) = f
  4803. return int32(_FMTCHECK_UNKNOWN)
  4804. }
  4805. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('h') {
  4806. f++
  4807. modifier = int32(_MOD_CHAR)
  4808. } else {
  4809. modifier = int32(_MOD_SHORT)
  4810. }
  4811. case int32('j'):
  4812. f++
  4813. modifier = int32(_MOD_INTMAXT)
  4814. case int32('l'):
  4815. f++
  4816. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  4817. *(*uintptr)(unsafe.Pointer(pf)) = f
  4818. return int32(_FMTCHECK_UNKNOWN)
  4819. }
  4820. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('l') {
  4821. f++
  4822. modifier = int32(_MOD_QUAD)
  4823. } else {
  4824. modifier = int32(_MOD_LONG)
  4825. }
  4826. case int32('q'):
  4827. f++
  4828. modifier = int32(_MOD_QUAD)
  4829. case int32('t'):
  4830. f++
  4831. modifier = int32(_MOD_PTRDIFFT)
  4832. case int32('z'):
  4833. f++
  4834. modifier = int32(_MOD_SIZET)
  4835. case int32('L'):
  4836. f++
  4837. modifier = int32(_MOD_LONGDOUBLE)
  4838. default:
  4839. modifier = int32(_MOD_NONE)
  4840. break
  4841. }
  4842. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  4843. *(*uintptr)(unsafe.Pointer(pf)) = f
  4844. return int32(_FMTCHECK_UNKNOWN)
  4845. }
  4846. if libc.Xstrchr(tls, __ccgo_ts+26, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f)))) != 0 {
  4847. switch modifier {
  4848. case int32(_MOD_LONG):
  4849. goto _1
  4850. case int32(_MOD_QUAD):
  4851. goto _2
  4852. case int32(_MOD_INTMAXT):
  4853. goto _3
  4854. case int32(_MOD_PTRDIFFT):
  4855. goto _4
  4856. case int32(_MOD_SIZET):
  4857. goto _5
  4858. case int32(_MOD_NONE):
  4859. goto _6
  4860. case int32(_MOD_SHORT):
  4861. goto _7
  4862. case int32(_MOD_CHAR):
  4863. goto _8
  4864. default:
  4865. goto _9
  4866. }
  4867. goto _10
  4868. _1:
  4869. ;
  4870. _13:
  4871. ;
  4872. *(*uintptr)(unsafe.Pointer(pf)) = f
  4873. return int32(_FMTCHECK_LONG)
  4874. goto _12
  4875. _12:
  4876. ;
  4877. if 0 != 0 {
  4878. goto _13
  4879. }
  4880. goto _11
  4881. _11:
  4882. ;
  4883. _2:
  4884. ;
  4885. *(*uintptr)(unsafe.Pointer(pf)) = f
  4886. return int32(_FMTCHECK_QUAD)
  4887. _3:
  4888. ;
  4889. *(*uintptr)(unsafe.Pointer(pf)) = f
  4890. return int32(_FMTCHECK_INTMAXT)
  4891. _4:
  4892. ;
  4893. *(*uintptr)(unsafe.Pointer(pf)) = f
  4894. return int32(_FMTCHECK_PTRDIFFT)
  4895. _5:
  4896. ;
  4897. *(*uintptr)(unsafe.Pointer(pf)) = f
  4898. return int32(_FMTCHECK_SIZET)
  4899. _8:
  4900. ;
  4901. _7:
  4902. ;
  4903. _6:
  4904. ;
  4905. *(*uintptr)(unsafe.Pointer(pf)) = f
  4906. return int32(_FMTCHECK_INT)
  4907. _9:
  4908. ;
  4909. *(*uintptr)(unsafe.Pointer(pf)) = f
  4910. return int32(_FMTCHECK_UNKNOWN)
  4911. _10:
  4912. }
  4913. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('n') {
  4914. switch modifier {
  4915. case int32(_MOD_CHAR):
  4916. goto _14
  4917. case int32(_MOD_SHORT):
  4918. goto _15
  4919. case int32(_MOD_LONG):
  4920. goto _16
  4921. case int32(_MOD_QUAD):
  4922. goto _17
  4923. case int32(_MOD_INTMAXT):
  4924. goto _18
  4925. case int32(_MOD_PTRDIFFT):
  4926. goto _19
  4927. case int32(_MOD_SIZET):
  4928. goto _20
  4929. case int32(_MOD_NONE):
  4930. goto _21
  4931. default:
  4932. goto _22
  4933. }
  4934. goto _23
  4935. _14:
  4936. ;
  4937. _26:
  4938. ;
  4939. *(*uintptr)(unsafe.Pointer(pf)) = f
  4940. return int32(_FMTCHECK_CHARPOINTER)
  4941. goto _25
  4942. _25:
  4943. ;
  4944. if 0 != 0 {
  4945. goto _26
  4946. }
  4947. goto _24
  4948. _24:
  4949. ;
  4950. _15:
  4951. ;
  4952. *(*uintptr)(unsafe.Pointer(pf)) = f
  4953. return int32(_FMTCHECK_SHORTPOINTER)
  4954. _16:
  4955. ;
  4956. *(*uintptr)(unsafe.Pointer(pf)) = f
  4957. return int32(_FMTCHECK_LONGPOINTER)
  4958. _17:
  4959. ;
  4960. *(*uintptr)(unsafe.Pointer(pf)) = f
  4961. return int32(_FMTCHECK_QUADPOINTER)
  4962. _18:
  4963. ;
  4964. *(*uintptr)(unsafe.Pointer(pf)) = f
  4965. return int32(_FMTCHECK_INTMAXTPOINTER)
  4966. _19:
  4967. ;
  4968. *(*uintptr)(unsafe.Pointer(pf)) = f
  4969. return int32(_FMTCHECK_PTRDIFFTPOINTER)
  4970. _20:
  4971. ;
  4972. *(*uintptr)(unsafe.Pointer(pf)) = f
  4973. return int32(_FMTCHECK_SIZETPOINTER)
  4974. _21:
  4975. ;
  4976. *(*uintptr)(unsafe.Pointer(pf)) = f
  4977. return int32(_FMTCHECK_INTPOINTER)
  4978. _22:
  4979. ;
  4980. *(*uintptr)(unsafe.Pointer(pf)) = f
  4981. return int32(_FMTCHECK_UNKNOWN)
  4982. _23:
  4983. }
  4984. if libc.Xstrchr(tls, __ccgo_ts+33, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f)))) != 0 {
  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_LONG)
  4991. }
  4992. if libc.Xstrchr(tls, __ccgo_ts+37, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f)))) != 0 {
  4993. switch modifier {
  4994. case int32(_MOD_LONGDOUBLE):
  4995. goto _27
  4996. case int32(_MOD_NONE):
  4997. goto _28
  4998. case int32(_MOD_LONG):
  4999. goto _29
  5000. default:
  5001. goto _30
  5002. }
  5003. goto _31
  5004. _27:
  5005. ;
  5006. _34:
  5007. ;
  5008. *(*uintptr)(unsafe.Pointer(pf)) = f
  5009. return int32(_FMTCHECK_LONGDOUBLE)
  5010. goto _33
  5011. _33:
  5012. ;
  5013. if 0 != 0 {
  5014. goto _34
  5015. }
  5016. goto _32
  5017. _32:
  5018. ;
  5019. _29:
  5020. ;
  5021. _28:
  5022. ;
  5023. *(*uintptr)(unsafe.Pointer(pf)) = f
  5024. return int32(_FMTCHECK_DOUBLE)
  5025. _30:
  5026. ;
  5027. *(*uintptr)(unsafe.Pointer(pf)) = f
  5028. return int32(_FMTCHECK_UNKNOWN)
  5029. _31:
  5030. }
  5031. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('c') {
  5032. switch modifier {
  5033. case int32(_MOD_LONG):
  5034. goto _35
  5035. case int32(_MOD_NONE):
  5036. goto _36
  5037. default:
  5038. goto _37
  5039. }
  5040. goto _38
  5041. _35:
  5042. ;
  5043. _41:
  5044. ;
  5045. *(*uintptr)(unsafe.Pointer(pf)) = f
  5046. return int32(_FMTCHECK_WINTT)
  5047. goto _40
  5048. _40:
  5049. ;
  5050. if 0 != 0 {
  5051. goto _41
  5052. }
  5053. goto _39
  5054. _39:
  5055. ;
  5056. _36:
  5057. ;
  5058. *(*uintptr)(unsafe.Pointer(pf)) = f
  5059. return int32(_FMTCHECK_INT)
  5060. _37:
  5061. ;
  5062. *(*uintptr)(unsafe.Pointer(pf)) = f
  5063. return int32(_FMTCHECK_UNKNOWN)
  5064. _38:
  5065. }
  5066. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('C') {
  5067. if modifier != int32(_MOD_NONE) {
  5068. *(*uintptr)(unsafe.Pointer(pf)) = f
  5069. return int32(_FMTCHECK_UNKNOWN)
  5070. }
  5071. *(*uintptr)(unsafe.Pointer(pf)) = f
  5072. return int32(_FMTCHECK_WINTT)
  5073. }
  5074. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('s') {
  5075. switch modifier {
  5076. case int32(_MOD_LONG):
  5077. goto _42
  5078. case int32(_MOD_NONE):
  5079. goto _43
  5080. default:
  5081. goto _44
  5082. }
  5083. goto _45
  5084. _42:
  5085. ;
  5086. _48:
  5087. ;
  5088. *(*uintptr)(unsafe.Pointer(pf)) = f
  5089. return int32(_FMTCHECK_WSTRING)
  5090. goto _47
  5091. _47:
  5092. ;
  5093. if 0 != 0 {
  5094. goto _48
  5095. }
  5096. goto _46
  5097. _46:
  5098. ;
  5099. _43:
  5100. ;
  5101. *(*uintptr)(unsafe.Pointer(pf)) = f
  5102. return int32(_FMTCHECK_STRING)
  5103. _44:
  5104. ;
  5105. *(*uintptr)(unsafe.Pointer(pf)) = f
  5106. return int32(_FMTCHECK_UNKNOWN)
  5107. _45:
  5108. }
  5109. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('S') {
  5110. if modifier != int32(_MOD_NONE) {
  5111. *(*uintptr)(unsafe.Pointer(pf)) = f
  5112. return int32(_FMTCHECK_UNKNOWN)
  5113. }
  5114. *(*uintptr)(unsafe.Pointer(pf)) = f
  5115. return int32(_FMTCHECK_WSTRING)
  5116. }
  5117. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('p') {
  5118. if modifier != int32(_MOD_NONE) {
  5119. *(*uintptr)(unsafe.Pointer(pf)) = f
  5120. return int32(_FMTCHECK_UNKNOWN)
  5121. }
  5122. *(*uintptr)(unsafe.Pointer(pf)) = f
  5123. return int32(_FMTCHECK_POINTER)
  5124. }
  5125. *(*uintptr)(unsafe.Pointer(pf)) = f
  5126. return int32(_FMTCHECK_UNKNOWN)
  5127. /*NOTREACHED*/
  5128. return r
  5129. }
  5130. func _get_next_format_from_width(tls *libc.TLS, pf uintptr) (r TEFT) {
  5131. var f uintptr
  5132. _ = f
  5133. f = *(*uintptr)(unsafe.Pointer(pf))
  5134. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('.') {
  5135. f++
  5136. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('*') {
  5137. *(*uintptr)(unsafe.Pointer(pf)) = f
  5138. return int32(_FMTCHECK_PRECISION)
  5139. }
  5140. /* eat any precision (empty is allowed) */
  5141. for libc.BoolInt32(uint32(*(*uint8)(unsafe.Pointer(f)))-uint32('0') < uint32(10)) != 0 {
  5142. f++
  5143. }
  5144. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  5145. *(*uintptr)(unsafe.Pointer(pf)) = f
  5146. return int32(_FMTCHECK_UNKNOWN)
  5147. }
  5148. }
  5149. *(*uintptr)(unsafe.Pointer(pf)) = f
  5150. return _get_next_format_from_precision(tls, pf)
  5151. /*NOTREACHED*/
  5152. return r
  5153. }
  5154. func _get_next_format(tls *libc.TLS, pf uintptr, eft TEFT) (r TEFT) {
  5155. var f uintptr
  5156. var infmt int32
  5157. _, _ = f, infmt
  5158. if eft == int32(_FMTCHECK_WIDTH) {
  5159. *(*uintptr)(unsafe.Pointer(pf))++
  5160. return _get_next_format_from_width(tls, pf)
  5161. } else {
  5162. if eft == int32(_FMTCHECK_PRECISION) {
  5163. *(*uintptr)(unsafe.Pointer(pf))++
  5164. return _get_next_format_from_precision(tls, pf)
  5165. }
  5166. }
  5167. f = *(*uintptr)(unsafe.Pointer(pf))
  5168. infmt = 0
  5169. for !(infmt != 0) {
  5170. f = libc.Xstrchr(tls, f, int32('%'))
  5171. if f == libc.UintptrFromInt32(0) {
  5172. *(*uintptr)(unsafe.Pointer(pf)) = f
  5173. return int32(_FMTCHECK_DONE)
  5174. }
  5175. f++
  5176. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  5177. *(*uintptr)(unsafe.Pointer(pf)) = f
  5178. return int32(_FMTCHECK_UNKNOWN)
  5179. }
  5180. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) != int32('%') {
  5181. infmt = int32(1)
  5182. } else {
  5183. f++
  5184. }
  5185. }
  5186. /* Eat any of the flags */
  5187. for *(*uint8)(unsafe.Pointer(f)) != 0 && libc.Xstrchr(tls, __ccgo_ts+46, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f)))) != 0 {
  5188. f++
  5189. }
  5190. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('*') {
  5191. *(*uintptr)(unsafe.Pointer(pf)) = f
  5192. return int32(_FMTCHECK_WIDTH)
  5193. }
  5194. /* eat any width */
  5195. for libc.BoolInt32(uint32(*(*uint8)(unsafe.Pointer(f)))-uint32('0') < uint32(10)) != 0 {
  5196. f++
  5197. }
  5198. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  5199. *(*uintptr)(unsafe.Pointer(pf)) = f
  5200. return int32(_FMTCHECK_UNKNOWN)
  5201. }
  5202. *(*uintptr)(unsafe.Pointer(pf)) = f
  5203. return _get_next_format_from_width(tls, pf)
  5204. /*NOTREACHED*/
  5205. return r
  5206. }
  5207. func Xfmtcheck(tls *libc.TLS, f1 uintptr, f2 uintptr) (r uintptr) {
  5208. bp := tls.Alloc(16)
  5209. defer tls.Free(16)
  5210. var f1t, f2t, v1 TEFT
  5211. var _ /* f1p at bp+0 */ uintptr
  5212. var _ /* f2p at bp+8 */ uintptr
  5213. _, _, _ = f1t, f2t, v1
  5214. if !(f1 != 0) {
  5215. return f2
  5216. }
  5217. *(*uintptr)(unsafe.Pointer(bp)) = f1
  5218. f1t = int32(_FMTCHECK_START)
  5219. *(*uintptr)(unsafe.Pointer(bp + 8)) = f2
  5220. f2t = int32(_FMTCHECK_START)
  5221. for {
  5222. v1 = _get_next_format(tls, bp, f1t)
  5223. f1t = v1
  5224. if !(v1 != int32(_FMTCHECK_DONE)) {
  5225. break
  5226. }
  5227. if f1t == int32(_FMTCHECK_UNKNOWN) {
  5228. return f2
  5229. }
  5230. f2t = _get_next_format(tls, bp+8, f2t)
  5231. if f1t != f2t {
  5232. return f2
  5233. }
  5234. }
  5235. return f1
  5236. }
  5237. const m_FSETLOCKING_BYCALLER = 2
  5238. const m_FSETLOCKING_INTERNAL = 1
  5239. const m_FSETLOCKING_QUERY = 0
  5240. func Xfpurge(tls *libc.TLS, fp uintptr) (r int32) {
  5241. if fp == libc.UintptrFromInt32(0) {
  5242. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EBADF)
  5243. return -int32(1)
  5244. }
  5245. libc.X__fpurge(tls, fp)
  5246. return 0
  5247. }
  5248. func Xfreezero(tls *libc.TLS, ptr uintptr, sz Tsize_t) {
  5249. /* This is legal. */
  5250. if ptr == libc.UintptrFromInt32(0) {
  5251. return
  5252. }
  5253. Xexplicit_bzero(tls, ptr, sz)
  5254. libc.Xfree(tls, ptr)
  5255. }
  5256. /*
  5257. * Copyright © 2004-2024 Guillem Jover <guillem@hadrons.org>
  5258. *
  5259. * Redistribution and use in source and binary forms, with or without
  5260. * modification, are permitted provided that the following conditions
  5261. * are met:
  5262. * 1. Redistributions of source code must retain the above copyright
  5263. * notice, this list of conditions and the following disclaimer.
  5264. * 2. Redistributions in binary form must reproduce the above copyright
  5265. * notice, this list of conditions and the following disclaimer in the
  5266. * documentation and/or other materials provided with the distribution.
  5267. * 3. The name of the author may not be used to endorse or promote products
  5268. * derived from this software without specific prior written permission.
  5269. *
  5270. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  5271. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  5272. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  5273. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  5274. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  5275. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  5276. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  5277. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  5278. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  5279. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  5280. */
  5281. type Tfunopen_cookie = struct {
  5282. Forig_cookie uintptr
  5283. Freadfn uintptr
  5284. Fwritefn uintptr
  5285. Fseekfn uintptr
  5286. Fclosefn uintptr
  5287. }
  5288. func _funopen_read(tls *libc.TLS, cookie uintptr, buf uintptr, size Tsize_t) (r Tssize_t) {
  5289. var cookiewrap uintptr
  5290. _ = cookiewrap
  5291. cookiewrap = cookie
  5292. if (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Freadfn == libc.UintptrFromInt32(0) {
  5293. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EBADF)
  5294. return int64(-int32(1))
  5295. }
  5296. 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)))
  5297. }
  5298. func _funopen_write(tls *libc.TLS, cookie uintptr, buf uintptr, size Tsize_t) (r Tssize_t) {
  5299. var cookiewrap uintptr
  5300. _ = cookiewrap
  5301. cookiewrap = cookie
  5302. if (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Fwritefn == libc.UintptrFromInt32(0) {
  5303. return int64(-libc.Int32FromInt32(1))
  5304. }
  5305. 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)))
  5306. }
  5307. func _funopen_seek(tls *libc.TLS, cookie uintptr, offset uintptr, whence int32) (r int32) {
  5308. var cookiewrap uintptr
  5309. var soff Toff_t
  5310. _, _ = cookiewrap, soff
  5311. cookiewrap = cookie
  5312. soff = *(*Toff_t)(unsafe.Pointer(offset))
  5313. if (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Fseekfn == libc.UintptrFromInt32(0) {
  5314. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ESPIPE)
  5315. return -int32(1)
  5316. }
  5317. 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)
  5318. *(*Toff_t)(unsafe.Pointer(offset)) = soff
  5319. return int32(*(*Toff_t)(unsafe.Pointer(offset)))
  5320. }
  5321. func _funopen_close(tls *libc.TLS, cookie uintptr) (r int32) {
  5322. var cookiewrap uintptr
  5323. var rc int32
  5324. _, _ = cookiewrap, rc
  5325. cookiewrap = cookie
  5326. if (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Fclosefn != 0 {
  5327. rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Fclosefn})))(tls, (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Forig_cookie)
  5328. } else {
  5329. rc = 0
  5330. }
  5331. libc.Xfree(tls, cookiewrap)
  5332. return rc
  5333. }
  5334. func Xfunopen(tls *libc.TLS, cookie uintptr, readfn uintptr, writefn uintptr, seekfn uintptr, closefn uintptr) (r uintptr) {
  5335. var cookiewrap, mode uintptr
  5336. var funcswrap Tcookie_io_functions_t
  5337. _, _, _ = cookiewrap, funcswrap, mode
  5338. funcswrap = Tcookie_io_functions_t{
  5339. Fread: __ccgo_fp(_funopen_read),
  5340. Fwrite: __ccgo_fp(_funopen_write),
  5341. Fseek: __ccgo_fp(_funopen_seek),
  5342. Fclose1: __ccgo_fp(_funopen_close),
  5343. }
  5344. if readfn != 0 {
  5345. if writefn == libc.UintptrFromInt32(0) {
  5346. mode = __ccgo_ts + 53
  5347. } else {
  5348. mode = __ccgo_ts + 55
  5349. }
  5350. } else {
  5351. if writefn != 0 {
  5352. mode = __ccgo_ts + 58
  5353. } else {
  5354. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  5355. return libc.UintptrFromInt32(0)
  5356. }
  5357. }
  5358. cookiewrap = libc.Xmalloc(tls, uint64(40))
  5359. if cookiewrap == libc.UintptrFromInt32(0) {
  5360. return libc.UintptrFromInt32(0)
  5361. }
  5362. (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Forig_cookie = cookie
  5363. (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Freadfn = readfn
  5364. (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Fwritefn = writefn
  5365. (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Fseekfn = seekfn
  5366. (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Fclosefn = closefn
  5367. return libc.Xfopencookie(tls, cookiewrap, mode, funcswrap)
  5368. }
  5369. const m_KB = 1024
  5370. const m_MAXB = "GB"
  5371. func Xgetbsize(tls *libc.TLS, headerlenp uintptr, blocksizep uintptr) (r uintptr) {
  5372. bp := tls.Alloc(32)
  5373. defer tls.Free(32)
  5374. var blocksize, max, mul, n, v15, v16, v17, v4 int64
  5375. var form, p, v3 uintptr
  5376. var _ /* ep at bp+0 */ uintptr
  5377. _, _, _, _, _, _, _, _, _, _, _ = blocksize, form, max, mul, n, p, v15, v16, v17, v3, v4
  5378. form = __ccgo_ts + 60
  5379. v3 = libc.Xgetenv(tls, __ccgo_ts+61)
  5380. p = v3
  5381. if !(v3 != libc.UintptrFromInt32(0) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) != int32('\000')) {
  5382. goto _1
  5383. }
  5384. v4 = libc.Xstrtol(tls, p, bp, int32(10))
  5385. n = v4
  5386. if v4 < 0 {
  5387. goto underflow
  5388. }
  5389. if n == 0 {
  5390. n = int64(1)
  5391. }
  5392. if *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))) != 0 && *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)) != 0 {
  5393. goto fmterr
  5394. }
  5395. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) {
  5396. case int32('g'):
  5397. goto _5
  5398. case int32('G'):
  5399. goto _6
  5400. case int32('k'):
  5401. goto _7
  5402. case int32('K'):
  5403. goto _8
  5404. case int32('m'):
  5405. goto _9
  5406. case int32('M'):
  5407. goto _10
  5408. case int32('\000'):
  5409. goto _11
  5410. default:
  5411. goto _12
  5412. }
  5413. goto _13
  5414. _6:
  5415. ;
  5416. _5:
  5417. ;
  5418. form = __ccgo_ts + 71
  5419. max = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) / (libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024))
  5420. mul = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024)
  5421. goto _13
  5422. _8:
  5423. ;
  5424. _7:
  5425. ;
  5426. form = __ccgo_ts + 73
  5427. max = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) / libc.Int64FromInt64(1024)
  5428. mul = int64(1024)
  5429. goto _13
  5430. _10:
  5431. ;
  5432. _9:
  5433. ;
  5434. form = __ccgo_ts + 75
  5435. max = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) / (libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024))
  5436. mul = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024)
  5437. goto _13
  5438. _11:
  5439. ;
  5440. max = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024)
  5441. mul = int64(1)
  5442. goto _13
  5443. _12:
  5444. ;
  5445. goto fmterr
  5446. fmterr:
  5447. ;
  5448. libc.Xwarnx(tls, __ccgo_ts+77, libc.VaList(bp+16, p))
  5449. n = int64(512)
  5450. max = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024)
  5451. mul = int64(1)
  5452. goto _13
  5453. _13:
  5454. ;
  5455. if n > max {
  5456. 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))))
  5457. n = max
  5458. }
  5459. v15 = n * mul
  5460. blocksize = v15
  5461. if !(v15 < int64(512)) {
  5462. goto _14
  5463. }
  5464. goto underflow
  5465. underflow:
  5466. ;
  5467. libc.Xwarnx(tls, __ccgo_ts+125, 0)
  5468. form = __ccgo_ts + 60
  5469. v16 = libc.Int64FromInt32(512)
  5470. n = v16
  5471. blocksize = v16
  5472. _14:
  5473. ;
  5474. goto _2
  5475. _1:
  5476. ;
  5477. v17 = libc.Int64FromInt32(512)
  5478. n = v17
  5479. blocksize = v17
  5480. _2:
  5481. ;
  5482. libc.X__builtin_snprintf(tls, uintptr(unsafe.Pointer(&_header)), uint64(20), __ccgo_ts+150, libc.VaList(bp+16, n, form))
  5483. *(*int32)(unsafe.Pointer(headerlenp)) = libc.Int32FromUint64(libc.Xstrlen(tls, uintptr(unsafe.Pointer(&_header))))
  5484. *(*int64)(unsafe.Pointer(blocksizep)) = blocksize
  5485. return uintptr(unsafe.Pointer(&_header))
  5486. }
  5487. var _header [20]uint8
  5488. const m_AF_ALG = "PF_ALG"
  5489. const m_AF_APPLETALK = "PF_APPLETALK"
  5490. const m_AF_ASH = "PF_ASH"
  5491. const m_AF_ATMPVC = "PF_ATMPVC"
  5492. const m_AF_ATMSVC = "PF_ATMSVC"
  5493. const m_AF_AX25 = "PF_AX25"
  5494. const m_AF_BLUETOOTH = "PF_BLUETOOTH"
  5495. const m_AF_BRIDGE = "PF_BRIDGE"
  5496. const m_AF_CAIF = "PF_CAIF"
  5497. const m_AF_CAN = "PF_CAN"
  5498. const m_AF_DECnet = "PF_DECnet"
  5499. const m_AF_ECONET = "PF_ECONET"
  5500. const m_AF_FILE = "AF_LOCAL"
  5501. const m_AF_IB = "PF_IB"
  5502. const m_AF_IEEE802154 = "PF_IEEE802154"
  5503. const m_AF_INET = "PF_INET"
  5504. const m_AF_INET6 = "PF_INET6"
  5505. const m_AF_IPX = "PF_IPX"
  5506. const m_AF_IRDA = "PF_IRDA"
  5507. const m_AF_ISDN = "PF_ISDN"
  5508. const m_AF_IUCV = "PF_IUCV"
  5509. const m_AF_KCM = "PF_KCM"
  5510. const m_AF_KEY = "PF_KEY"
  5511. const m_AF_LLC = "PF_LLC"
  5512. const m_AF_LOCAL = "PF_LOCAL"
  5513. const m_AF_MAX = "PF_MAX"
  5514. const m_AF_MPLS = "PF_MPLS"
  5515. const m_AF_NETBEUI = "PF_NETBEUI"
  5516. const m_AF_NETLINK = "PF_NETLINK"
  5517. const m_AF_NETROM = "PF_NETROM"
  5518. const m_AF_NFC = "PF_NFC"
  5519. const m_AF_PACKET = "PF_PACKET"
  5520. const m_AF_PHONET = "PF_PHONET"
  5521. const m_AF_PPPOX = "PF_PPPOX"
  5522. const m_AF_QIPCRTR = "PF_QIPCRTR"
  5523. const m_AF_RDS = "PF_RDS"
  5524. const m_AF_ROSE = "PF_ROSE"
  5525. const m_AF_ROUTE = "PF_ROUTE"
  5526. const m_AF_RXRPC = "PF_RXRPC"
  5527. const m_AF_SECURITY = "PF_SECURITY"
  5528. const m_AF_SMC = "PF_SMC"
  5529. const m_AF_SNA = "PF_SNA"
  5530. const m_AF_TIPC = "PF_TIPC"
  5531. const m_AF_UNIX = "AF_LOCAL"
  5532. const m_AF_UNSPEC = "PF_UNSPEC"
  5533. const m_AF_VSOCK = "PF_VSOCK"
  5534. const m_AF_WANPIPE = "PF_WANPIPE"
  5535. const m_AF_X25 = "PF_X25"
  5536. const m_AF_XDP = "PF_XDP"
  5537. const m_INT_MAX2 = 0x7fffffff
  5538. const m_MSG_BATCH = 0x40000
  5539. const m_MSG_CMSG_CLOEXEC = 0x40000000
  5540. const m_MSG_CONFIRM = 0x0800
  5541. const m_MSG_CTRUNC = 0x0008
  5542. const m_MSG_DONTROUTE = 0x0004
  5543. const m_MSG_DONTWAIT = 0x0040
  5544. const m_MSG_EOR = 0x0080
  5545. const m_MSG_ERRQUEUE = 0x2000
  5546. const m_MSG_FASTOPEN = 0x20000000
  5547. const m_MSG_FIN = 0x0200
  5548. const m_MSG_MORE = 0x8000
  5549. const m_MSG_NOSIGNAL = 0x4000
  5550. const m_MSG_OOB = 0x0001
  5551. const m_MSG_PEEK = 0x0002
  5552. const m_MSG_PROXY = 0x0010
  5553. const m_MSG_RST = 0x1000
  5554. const m_MSG_SYN = 0x0400
  5555. const m_MSG_TRUNC = 0x0020
  5556. const m_MSG_WAITALL = 0x0100
  5557. const m_MSG_WAITFORONE = 0x10000
  5558. const m_MSG_ZEROCOPY = 0x4000000
  5559. const m_PF_ALG = 38
  5560. const m_PF_APPLETALK = 5
  5561. const m_PF_ASH = 18
  5562. const m_PF_ATMPVC = 8
  5563. const m_PF_ATMSVC = 20
  5564. const m_PF_AX25 = 3
  5565. const m_PF_BLUETOOTH = 31
  5566. const m_PF_BRIDGE = 7
  5567. const m_PF_CAIF = 37
  5568. const m_PF_CAN = 29
  5569. const m_PF_DECnet = 12
  5570. const m_PF_ECONET = 19
  5571. const m_PF_FILE = "PF_LOCAL"
  5572. const m_PF_IB = 27
  5573. const m_PF_IEEE802154 = 36
  5574. const m_PF_INET = 2
  5575. const m_PF_INET6 = 10
  5576. const m_PF_IPX = 4
  5577. const m_PF_IRDA = 23
  5578. const m_PF_ISDN = 34
  5579. const m_PF_IUCV = 32
  5580. const m_PF_KCM = 41
  5581. const m_PF_KEY = 15
  5582. const m_PF_LLC = 26
  5583. const m_PF_LOCAL = 1
  5584. const m_PF_MAX = 45
  5585. const m_PF_MPLS = 28
  5586. const m_PF_NETBEUI = 13
  5587. const m_PF_NETLINK = 16
  5588. const m_PF_NETROM = 6
  5589. const m_PF_NFC = 39
  5590. const m_PF_PACKET = 17
  5591. const m_PF_PHONET = 35
  5592. const m_PF_PPPOX = 24
  5593. const m_PF_QIPCRTR = 42
  5594. const m_PF_RDS = 21
  5595. const m_PF_ROSE = 11
  5596. const m_PF_ROUTE = "PF_NETLINK"
  5597. const m_PF_RXRPC = 33
  5598. const m_PF_SECURITY = 14
  5599. const m_PF_SMC = 43
  5600. const m_PF_SNA = 22
  5601. const m_PF_TIPC = 30
  5602. const m_PF_UNIX = "PF_LOCAL"
  5603. const m_PF_UNSPEC = 0
  5604. const m_PF_VSOCK = 40
  5605. const m_PF_WANPIPE = 25
  5606. const m_PF_X25 = 9
  5607. const m_PF_XDP = 44
  5608. const m_SCM_CREDENTIALS = 0x02
  5609. const m_SCM_RIGHTS = 0x01
  5610. const m_SCM_TIMESTAMP = "SO_TIMESTAMP"
  5611. const m_SCM_TIMESTAMPING = "SO_TIMESTAMPING"
  5612. const m_SCM_TIMESTAMPING_OPT_STATS = 54
  5613. const m_SCM_TIMESTAMPING_PKTINFO = 58
  5614. const m_SCM_TIMESTAMPNS = "SO_TIMESTAMPNS"
  5615. const m_SCM_TXTIME = "SO_TXTIME"
  5616. const m_SCM_WIFI_STATUS = "SO_WIFI_STATUS"
  5617. const m_SHUT_RD = 0
  5618. const m_SHUT_RDWR = 2
  5619. const m_SHUT_WR = 1
  5620. const m_SOCK_CLOEXEC = 02000000
  5621. const m_SOCK_DCCP = 6
  5622. const m_SOCK_DGRAM = 2
  5623. const m_SOCK_NONBLOCK = 04000
  5624. const m_SOCK_PACKET = 10
  5625. const m_SOCK_RAW = 3
  5626. const m_SOCK_RDM = 4
  5627. const m_SOCK_SEQPACKET = 5
  5628. const m_SOCK_STREAM = 1
  5629. const m_SOL_AAL = 265
  5630. const m_SOL_ALG = 279
  5631. const m_SOL_ATM = 264
  5632. const m_SOL_BLUETOOTH = 274
  5633. const m_SOL_CAIF = 278
  5634. const m_SOL_DCCP = 269
  5635. const m_SOL_DECNET = 261
  5636. const m_SOL_ICMPV6 = 58
  5637. const m_SOL_IP = 0
  5638. const m_SOL_IPV6 = 41
  5639. const m_SOL_IRDA = 266
  5640. const m_SOL_IUCV = 277
  5641. const m_SOL_KCM = 281
  5642. const m_SOL_LLC = 268
  5643. const m_SOL_NETBEUI = 267
  5644. const m_SOL_NETLINK = 270
  5645. const m_SOL_NFC = 280
  5646. const m_SOL_PACKET = 263
  5647. const m_SOL_PNPIPE = 275
  5648. const m_SOL_PPPOL2TP = 273
  5649. const m_SOL_RAW = 255
  5650. const m_SOL_RDS = 276
  5651. const m_SOL_RXRPC = 272
  5652. const m_SOL_SOCKET = 1
  5653. const m_SOL_TIPC = 271
  5654. const m_SOL_TLS = 282
  5655. const m_SOL_X25 = 262
  5656. const m_SOL_XDP = 283
  5657. const m_SOMAXCONN = 128
  5658. const m_SO_ACCEPTCONN = 30
  5659. const m_SO_ATTACH_BPF = 50
  5660. const m_SO_ATTACH_FILTER = 26
  5661. const m_SO_ATTACH_REUSEPORT_CBPF = 51
  5662. const m_SO_ATTACH_REUSEPORT_EBPF = 52
  5663. const m_SO_BINDTODEVICE = 25
  5664. const m_SO_BINDTOIFINDEX = 62
  5665. const m_SO_BPF_EXTENSIONS = 48
  5666. const m_SO_BROADCAST = 6
  5667. const m_SO_BSDCOMPAT = 14
  5668. const m_SO_BUSY_POLL = 46
  5669. const m_SO_BUSY_POLL_BUDGET = 70
  5670. const m_SO_CNX_ADVICE = 53
  5671. const m_SO_COOKIE = 57
  5672. const m_SO_DEBUG = 1
  5673. const m_SO_DETACH_BPF = "SO_DETACH_FILTER"
  5674. const m_SO_DETACH_FILTER = 27
  5675. const m_SO_DETACH_REUSEPORT_BPF = 68
  5676. const m_SO_DOMAIN = 39
  5677. const m_SO_DONTROUTE = 5
  5678. const m_SO_ERROR = 4
  5679. const m_SO_GET_FILTER = "SO_ATTACH_FILTER"
  5680. const m_SO_INCOMING_CPU = 49
  5681. const m_SO_INCOMING_NAPI_ID = 56
  5682. const m_SO_KEEPALIVE = 9
  5683. const m_SO_LINGER = 13
  5684. const m_SO_LOCK_FILTER = 44
  5685. const m_SO_MARK = 36
  5686. const m_SO_MAX_PACING_RATE = 47
  5687. const m_SO_MEMINFO = 55
  5688. const m_SO_NOFCS = 43
  5689. const m_SO_NO_CHECK = 11
  5690. const m_SO_OOBINLINE = 10
  5691. const m_SO_PASSCRED = 20
  5692. const m_SO_PASSSEC = 34
  5693. const m_SO_PEEK_OFF = 42
  5694. const m_SO_PEERCRED = 21
  5695. const m_SO_PEERGROUPS = 59
  5696. const m_SO_PEERNAME = 28
  5697. const m_SO_PEERSEC = 31
  5698. const m_SO_PREFER_BUSY_POLL = 69
  5699. const m_SO_PRIORITY = 12
  5700. const m_SO_PROTOCOL = 38
  5701. const m_SO_RCVBUF = 8
  5702. const m_SO_RCVBUFFORCE = 33
  5703. const m_SO_RCVLOWAT = 16
  5704. const m_SO_RCVTIMEO = 18
  5705. const m_SO_REUSEADDR = 2
  5706. const m_SO_REUSEPORT = 15
  5707. const m_SO_RXQ_OVFL = 40
  5708. const m_SO_SECURITY_AUTHENTICATION = 22
  5709. const m_SO_SECURITY_ENCRYPTION_NETWORK = 24
  5710. const m_SO_SECURITY_ENCRYPTION_TRANSPORT = 23
  5711. const m_SO_SELECT_ERR_QUEUE = 45
  5712. const m_SO_SNDBUF = 7
  5713. const m_SO_SNDBUFFORCE = 32
  5714. const m_SO_SNDLOWAT = 17
  5715. const m_SO_SNDTIMEO = 19
  5716. const m_SO_TIMESTAMP = 29
  5717. const m_SO_TIMESTAMPING = 37
  5718. const m_SO_TIMESTAMPNS = 35
  5719. const m_SO_TXTIME = 61
  5720. const m_SO_TYPE = 3
  5721. const m_SO_WIFI_STATUS = 41
  5722. const m_SO_ZEROCOPY = 60
  5723. const m_UINT_MAX2 = 0xffffffff
  5724. type Tsocklen_t = uint32
  5725. type Tsa_family_t = uint16
  5726. type Tmsghdr = struct {
  5727. Fmsg_name uintptr
  5728. Fmsg_namelen Tsocklen_t
  5729. Fmsg_iov uintptr
  5730. Fmsg_iovlen int32
  5731. F__pad1 int32
  5732. Fmsg_control uintptr
  5733. Fmsg_controllen Tsocklen_t
  5734. F__pad2 int32
  5735. Fmsg_flags int32
  5736. }
  5737. type Tcmsghdr = struct {
  5738. Fcmsg_len Tsocklen_t
  5739. F__pad1 int32
  5740. Fcmsg_level int32
  5741. Fcmsg_type int32
  5742. }
  5743. type Tucred = struct {
  5744. Fpid Tpid_t
  5745. Fuid Tuid_t
  5746. Fgid Tgid_t
  5747. }
  5748. type Tmmsghdr = struct {
  5749. Fmsg_hdr Tmsghdr
  5750. Fmsg_len uint32
  5751. }
  5752. type Tlinger = struct {
  5753. Fl_onoff int32
  5754. Fl_linger int32
  5755. }
  5756. type Tsockaddr = struct {
  5757. Fsa_family Tsa_family_t
  5758. Fsa_data [14]uint8
  5759. }
  5760. type Tsockaddr_storage = struct {
  5761. Fss_family Tsa_family_t
  5762. F__ss_padding [118]uint8
  5763. F__ss_align uint64
  5764. }
  5765. type Tsockaddr_un = struct {
  5766. Fsun_family Tsa_family_t
  5767. Fsun_path [108]uint8
  5768. }
  5769. // C documentation
  5770. //
  5771. // /* Linux and OpenBSD */
  5772. func Xgetpeereid(tls *libc.TLS, s int32, euid uintptr, egid uintptr) (r int32) {
  5773. bp := tls.Alloc(16)
  5774. defer tls.Free(16)
  5775. var ret int32
  5776. var _ /* cred at bp+0 */ Tucred
  5777. var _ /* credlen at bp+12 */ Tsocklen_t
  5778. _ = ret
  5779. *(*Tsocklen_t)(unsafe.Pointer(bp + 12)) = uint32(12)
  5780. ret = libc.Xgetsockopt(tls, s, int32(m_SOL_SOCKET), int32(m_SO_PEERCRED), bp, bp+12)
  5781. if ret != 0 {
  5782. return ret
  5783. }
  5784. *(*Tuid_t)(unsafe.Pointer(euid)) = (*(*Tucred)(unsafe.Pointer(bp))).Fuid
  5785. *(*Tgid_t)(unsafe.Pointer(egid)) = (*(*Tucred)(unsafe.Pointer(bp))).Fgid
  5786. return 0
  5787. }
  5788. const m_INT64_MAX1 = 9223372036854775807
  5789. func Xdehumanize_number(tls *libc.TLS, buf uintptr, num uintptr) (r int32) {
  5790. bp := tls.Alloc(16)
  5791. defer tls.Free(16)
  5792. var rc, sign, v1, v2 int32
  5793. var rmax Tuint64_t
  5794. var _ /* rval at bp+0 */ Tuint64_t
  5795. _, _, _, _, _ = rc, rmax, sign, v1, v2
  5796. sign = +libc.Int32FromInt32(1)
  5797. /* The current expand_number() implementation uses bit shifts, so
  5798. * we cannot pass negative numbers, preserve the sign and apply it
  5799. * later. */
  5800. for {
  5801. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(buf)))
  5802. v2 = libc.BoolInt32(v1 == int32(' ') || libc.Uint32FromInt32(v1)-uint32('\t') < uint32(5))
  5803. goto _3
  5804. _3:
  5805. if !(v2 != 0) {
  5806. break
  5807. }
  5808. buf++
  5809. }
  5810. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(buf))) == int32('-') {
  5811. sign = -int32(1)
  5812. buf++
  5813. }
  5814. rc = Xexpand_number(tls, buf, bp)
  5815. if rc < 0 {
  5816. return rc
  5817. }
  5818. /* The sign has been stripped, so rval has the absolute value.
  5819. * Error out, regardless of the sign, if rval is greater than
  5820. * abs(INT64_MIN) (== INT64_MAX + 1), or if the sign is positive
  5821. * and the value has overflown by one (INT64_MAX + 1). */
  5822. rmax = uint64(libc.Uint64FromInt64(libc.Int64FromInt64(m_INT64_MAX1)) + libc.Uint64FromUint64(1))
  5823. if *(*Tuint64_t)(unsafe.Pointer(bp)) > rmax || *(*Tuint64_t)(unsafe.Pointer(bp)) == rmax && sign == +libc.Int32FromInt32(1) {
  5824. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ERANGE)
  5825. return -int32(1)
  5826. }
  5827. *(*Tint64_t)(unsafe.Pointer(num)) = libc.Int64FromUint64(*(*Tuint64_t)(unsafe.Pointer(bp)) * libc.Uint64FromInt32(sign))
  5828. return 0
  5829. }
  5830. const m_HN_AUTOSCALE1 = 32
  5831. const m_HN_B1 = 4
  5832. const m_HN_DECIMAL1 = 1
  5833. const m_HN_DIVISOR_10001 = 8
  5834. const m_HN_GETSCALE1 = 16
  5835. const m_HN_IEC_PREFIXES1 = 16
  5836. const m_HN_NOSPACE1 = 2
  5837. const m_INT64_MAX2 = 0x7fffffffffffffff
  5838. const m_LC_ALL = 6
  5839. const m_LC_ALL_MASK = 0x7fffffff
  5840. const m_LC_COLLATE = 3
  5841. const m_LC_CTYPE = 0
  5842. const m_LC_MESSAGES = 5
  5843. const m_LC_MONETARY = 4
  5844. const m_LC_NUMERIC = 1
  5845. const m_LC_TIME = 2
  5846. type Tlconv = struct {
  5847. Fdecimal_point uintptr
  5848. Fthousands_sep uintptr
  5849. Fgrouping uintptr
  5850. Fint_curr_symbol uintptr
  5851. Fcurrency_symbol uintptr
  5852. Fmon_decimal_point uintptr
  5853. Fmon_thousands_sep uintptr
  5854. Fmon_grouping uintptr
  5855. Fpositive_sign uintptr
  5856. Fnegative_sign uintptr
  5857. Fint_frac_digits uint8
  5858. Ffrac_digits uint8
  5859. Fp_cs_precedes uint8
  5860. Fp_sep_by_space uint8
  5861. Fn_cs_precedes uint8
  5862. Fn_sep_by_space uint8
  5863. Fp_sign_posn uint8
  5864. Fn_sign_posn uint8
  5865. Fint_p_cs_precedes uint8
  5866. Fint_p_sep_by_space uint8
  5867. Fint_n_cs_precedes uint8
  5868. Fint_n_sep_by_space uint8
  5869. Fint_p_sign_posn uint8
  5870. Fint_n_sign_posn uint8
  5871. }
  5872. /*
  5873. * Copyright (c) 1996 Peter Wemm <peter@FreeBSD.org>.
  5874. * All rights reserved.
  5875. * Copyright (c) 2002 Networks Associates Technology, Inc.
  5876. * All rights reserved.
  5877. *
  5878. * Portions of this software were developed for the FreeBSD Project by
  5879. * ThinkSec AS and NAI Labs, the Security Research Division of Network
  5880. * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
  5881. * ("CBOSS"), as part of the DARPA CHATS research program.
  5882. *
  5883. * Redistribution and use in source and binary forms, with or without
  5884. * modification, is permitted provided that the following conditions
  5885. * are met:
  5886. * 1. Redistributions of source code must retain the above copyright
  5887. * notice, this list of conditions and the following disclaimer.
  5888. * 2. Redistributions in binary form must reproduce the above copyright
  5889. * notice, this list of conditions and the following disclaimer in the
  5890. * documentation and/or other materials provided with the distribution.
  5891. * 3. The name of the author may not be used to endorse or promote
  5892. * products derived from this software without specific prior written
  5893. * permission.
  5894. *
  5895. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  5896. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  5897. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  5898. * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  5899. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  5900. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  5901. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  5902. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  5903. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  5904. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  5905. * SUCH DAMAGE.
  5906. *
  5907. * $FreeBSD: src/lib/libutil/libutil.h,v 1.47 2008/04/23 00:49:12 scf Exp $
  5908. */
  5909. var _maxscale = int32(6)
  5910. func Xhumanize_number(tls *libc.TLS, buf uintptr, len1 Tsize_t, quotient Tint64_t, suffix uintptr, scale int32, flags int32) (r1 int32) {
  5911. bp := tls.Alloc(64)
  5912. defer tls.Free(64)
  5913. var baselen Tsize_t
  5914. var divisor, max Tint64_t
  5915. var divisordeccut, i, r, remainder, s1, s2, sign, v2 int32
  5916. var prefixes, sep uintptr
  5917. _, _, _, _, _, _, _, _, _, _, _, _, _ = baselen, divisor, divisordeccut, i, max, prefixes, r, remainder, s1, s2, sep, sign, v2
  5918. /* Since so many callers don't check -1, NUL terminate the buffer */
  5919. if len1 > uint64(0) {
  5920. *(*uint8)(unsafe.Pointer(buf)) = uint8('\000')
  5921. }
  5922. /* validate args */
  5923. if buf == libc.UintptrFromInt32(0) || suffix == libc.UintptrFromInt32(0) {
  5924. return -int32(1)
  5925. }
  5926. if scale < 0 {
  5927. return -int32(1)
  5928. } else {
  5929. if scale > _maxscale && scale & ^(libc.Int32FromInt32(m_HN_AUTOSCALE1)|libc.Int32FromInt32(m_HN_GETSCALE1)) != 0 {
  5930. return -int32(1)
  5931. }
  5932. }
  5933. if flags&int32(m_HN_DIVISOR_10001) != 0 && flags&int32(m_HN_IEC_PREFIXES1) != 0 {
  5934. return -int32(1)
  5935. }
  5936. /* setup parameters */
  5937. remainder = 0
  5938. if flags&int32(m_HN_IEC_PREFIXES1) != 0 {
  5939. baselen = uint64(2)
  5940. /*
  5941. * Use the prefixes for power of two recommended by
  5942. * the International Electrotechnical Commission
  5943. * (IEC) in IEC 80000-3 (i.e. Ki, Mi, Gi...).
  5944. *
  5945. * HN_IEC_PREFIXES implies a divisor of 1024 here
  5946. * (use of HN_DIVISOR_1000 would have triggered
  5947. * an assertion earlier).
  5948. */
  5949. divisor = int64(1024)
  5950. divisordeccut = int32(973) /* ceil(.95 * 1024) */
  5951. if flags&int32(m_HN_B1) != 0 {
  5952. prefixes = __ccgo_ts + 163
  5953. } else {
  5954. prefixes = __ccgo_ts + 184
  5955. }
  5956. } else {
  5957. baselen = uint64(1)
  5958. if flags&int32(m_HN_DIVISOR_10001) != 0 {
  5959. divisor = int64(1000)
  5960. divisordeccut = int32(950)
  5961. if flags&int32(m_HN_B1) != 0 {
  5962. prefixes = __ccgo_ts + 205
  5963. } else {
  5964. prefixes = __ccgo_ts + 225
  5965. }
  5966. } else {
  5967. divisor = int64(1024)
  5968. divisordeccut = int32(973) /* ceil(.95 * 1024) */
  5969. if flags&int32(m_HN_B1) != 0 {
  5970. prefixes = __ccgo_ts + 245
  5971. } else {
  5972. prefixes = __ccgo_ts + 265
  5973. }
  5974. }
  5975. }
  5976. if quotient < 0 {
  5977. sign = -int32(1)
  5978. quotient = -quotient
  5979. baselen += uint64(2) /* sign, digit */
  5980. } else {
  5981. sign = int32(1)
  5982. baselen += uint64(1) /* digit */
  5983. }
  5984. if flags&int32(m_HN_NOSPACE1) != 0 {
  5985. sep = __ccgo_ts + 60
  5986. } else {
  5987. sep = __ccgo_ts + 285
  5988. baselen++
  5989. }
  5990. baselen += libc.Xstrlen(tls, suffix)
  5991. /* Check if enough room for `x y' + suffix + `\0' */
  5992. if len1 < baselen+uint64(1) {
  5993. return -int32(1)
  5994. }
  5995. if scale&(libc.Int32FromInt32(m_HN_AUTOSCALE1)|libc.Int32FromInt32(m_HN_GETSCALE1)) != 0 {
  5996. /* See if there is additional columns can be used. */
  5997. max = int64(1)
  5998. i = libc.Int32FromUint64(len1 - baselen)
  5999. for {
  6000. v2 = i
  6001. i--
  6002. if !(v2 > 0) {
  6003. break
  6004. }
  6005. max *= int64(10)
  6006. goto _1
  6007. _1:
  6008. }
  6009. /*
  6010. * Divide the number until it fits the given column.
  6011. * If there will be an overflow by the rounding below,
  6012. * divide once more.
  6013. */
  6014. i = 0
  6015. for {
  6016. if !((quotient >= max || quotient == max-int64(1) && (remainder >= divisordeccut || int64(remainder) >= divisor/int64(2))) && i < _maxscale) {
  6017. break
  6018. }
  6019. remainder = int32(quotient % divisor)
  6020. quotient /= divisor
  6021. goto _3
  6022. _3:
  6023. ;
  6024. i++
  6025. }
  6026. if scale&int32(m_HN_GETSCALE1) != 0 {
  6027. return i
  6028. }
  6029. } else {
  6030. i = 0
  6031. for {
  6032. if !(i < scale && i < _maxscale) {
  6033. break
  6034. }
  6035. remainder = int32(quotient % divisor)
  6036. quotient /= divisor
  6037. goto _4
  6038. _4:
  6039. ;
  6040. i++
  6041. }
  6042. }
  6043. /* If a value <= 9.9 after rounding and ... */
  6044. /*
  6045. * XXX - should we make sure there is enough space for the decimal
  6046. * place and if not, don't do HN_DECIMAL?
  6047. */
  6048. if (quotient == int64(9) && remainder < divisordeccut || quotient < int64(9)) && i > 0 && flags&int32(m_HN_DECIMAL1) != 0 {
  6049. s1 = int32(int64(int32(quotient)) + (int64(remainder*int32(10))+divisor/int64(2))/divisor/int64(10))
  6050. s2 = int32((int64(remainder*int32(10)) + divisor/int64(2)) / divisor % int64(10))
  6051. 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))
  6052. } else {
  6053. 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))
  6054. }
  6055. return r
  6056. }
  6057. const m_HN_AUTOSCALE2 = 0x20
  6058. const m_HN_B2 = 0x04
  6059. const m_HN_DECIMAL2 = 0x01
  6060. const m_HN_DIVISOR_10002 = 0x08
  6061. const m_HN_GETSCALE2 = 0x10
  6062. const m_HN_IEC_PREFIXES2 = 0x10
  6063. const m_HN_NOSPACE2 = 0x02
  6064. const m_INET6_ADDRSTRLEN = 46
  6065. const m_INET_ADDRSTRLEN = 16
  6066. const m_IN_CLASSA_MAX = 128
  6067. const m_IN_CLASSA_NET = 0xff000000
  6068. const m_IN_CLASSA_NSHIFT = 24
  6069. const m_IN_CLASSB_MAX = 65536
  6070. const m_IN_CLASSB_NET = 0xffff0000
  6071. const m_IN_CLASSB_NSHIFT = 16
  6072. const m_IN_CLASSC_NET = 0xffffff00
  6073. const m_IN_CLASSC_NSHIFT = 8
  6074. const m_IN_LOOPBACKNET = 127
  6075. const m_IPPORT_RESERVED = 1024
  6076. const m_IPPROTO_AH = 51
  6077. const m_IPPROTO_BEETPH = 94
  6078. const m_IPPROTO_COMP = 108
  6079. const m_IPPROTO_DCCP = 33
  6080. const m_IPPROTO_DSTOPTS = 60
  6081. const m_IPPROTO_EGP = 8
  6082. const m_IPPROTO_ENCAP = 98
  6083. const m_IPPROTO_ESP = 50
  6084. const m_IPPROTO_ETHERNET = 143
  6085. const m_IPPROTO_FRAGMENT = 44
  6086. const m_IPPROTO_GRE = 47
  6087. const m_IPPROTO_HOPOPTS = 0
  6088. const m_IPPROTO_ICMP = 1
  6089. const m_IPPROTO_ICMPV6 = 58
  6090. const m_IPPROTO_IDP = 22
  6091. const m_IPPROTO_IGMP = 2
  6092. const m_IPPROTO_IP = 0
  6093. const m_IPPROTO_IPIP = 4
  6094. const m_IPPROTO_IPV6 = 41
  6095. const m_IPPROTO_MAX = 263
  6096. const m_IPPROTO_MH = 135
  6097. const m_IPPROTO_MPLS = 137
  6098. const m_IPPROTO_MPTCP = 262
  6099. const m_IPPROTO_MTP = 92
  6100. const m_IPPROTO_NONE = 59
  6101. const m_IPPROTO_PIM = 103
  6102. const m_IPPROTO_PUP = 12
  6103. const m_IPPROTO_RAW = 255
  6104. const m_IPPROTO_ROUTING = 43
  6105. const m_IPPROTO_RSVP = 46
  6106. const m_IPPROTO_SCTP = 132
  6107. const m_IPPROTO_TCP = 6
  6108. const m_IPPROTO_TP = 29
  6109. const m_IPPROTO_UDP = 17
  6110. const m_IPPROTO_UDPLITE = 136
  6111. const m_IPV6_2292DSTOPTS = 4
  6112. const m_IPV6_2292HOPLIMIT = 8
  6113. const m_IPV6_2292HOPOPTS = 3
  6114. const m_IPV6_2292PKTINFO = 2
  6115. const m_IPV6_2292PKTOPTIONS = 6
  6116. const m_IPV6_2292RTHDR = 5
  6117. const m_IPV6_ADDRFORM = 1
  6118. const m_IPV6_ADDR_PREFERENCES = 72
  6119. const m_IPV6_ADD_MEMBERSHIP = "IPV6_JOIN_GROUP"
  6120. const m_IPV6_AUTHHDR = 10
  6121. const m_IPV6_AUTOFLOWLABEL = 70
  6122. const m_IPV6_CHECKSUM = 7
  6123. const m_IPV6_DONTFRAG = 62
  6124. const m_IPV6_DROP_MEMBERSHIP = "IPV6_LEAVE_GROUP"
  6125. const m_IPV6_DSTOPTS = 59
  6126. const m_IPV6_FREEBIND = 78
  6127. const m_IPV6_HDRINCL = 36
  6128. const m_IPV6_HOPLIMIT = 52
  6129. const m_IPV6_HOPOPTS = 54
  6130. const m_IPV6_IPSEC_POLICY = 34
  6131. const m_IPV6_JOIN_ANYCAST = 27
  6132. const m_IPV6_JOIN_GROUP = 20
  6133. const m_IPV6_LEAVE_ANYCAST = 28
  6134. const m_IPV6_LEAVE_GROUP = 21
  6135. const m_IPV6_MINHOPCOUNT = 73
  6136. const m_IPV6_MTU = 24
  6137. const m_IPV6_MTU_DISCOVER = 23
  6138. const m_IPV6_MULTICAST_ALL = 29
  6139. const m_IPV6_MULTICAST_HOPS = 18
  6140. const m_IPV6_MULTICAST_IF = 17
  6141. const m_IPV6_MULTICAST_LOOP = 19
  6142. const m_IPV6_NEXTHOP = 9
  6143. const m_IPV6_ORIGDSTADDR = 74
  6144. const m_IPV6_PATHMTU = 61
  6145. const m_IPV6_PKTINFO = 50
  6146. const m_IPV6_PMTUDISC_DO = 2
  6147. const m_IPV6_PMTUDISC_DONT = 0
  6148. const m_IPV6_PMTUDISC_INTERFACE = 4
  6149. const m_IPV6_PMTUDISC_OMIT = 5
  6150. const m_IPV6_PMTUDISC_PROBE = 3
  6151. const m_IPV6_PMTUDISC_WANT = 1
  6152. const m_IPV6_PREFER_SRC_CGA = 0x0008
  6153. const m_IPV6_PREFER_SRC_COA = 0x0004
  6154. const m_IPV6_PREFER_SRC_HOME = 0x0400
  6155. const m_IPV6_PREFER_SRC_NONCGA = 0x0800
  6156. const m_IPV6_PREFER_SRC_PUBLIC = 0x0002
  6157. const m_IPV6_PREFER_SRC_PUBTMP_DEFAULT = 0x0100
  6158. const m_IPV6_PREFER_SRC_TMP = 0x0001
  6159. const m_IPV6_RECVDSTOPTS = 58
  6160. const m_IPV6_RECVERR = 25
  6161. const m_IPV6_RECVFRAGSIZE = 77
  6162. const m_IPV6_RECVHOPLIMIT = 51
  6163. const m_IPV6_RECVHOPOPTS = 53
  6164. const m_IPV6_RECVORIGDSTADDR = "IPV6_ORIGDSTADDR"
  6165. const m_IPV6_RECVPATHMTU = 60
  6166. const m_IPV6_RECVPKTINFO = 49
  6167. const m_IPV6_RECVRTHDR = 56
  6168. const m_IPV6_RECVTCLASS = 66
  6169. const m_IPV6_ROUTER_ALERT = 22
  6170. const m_IPV6_ROUTER_ALERT_ISOLATE = 30
  6171. const m_IPV6_RTHDR = 57
  6172. const m_IPV6_RTHDRDSTOPTS = 55
  6173. const m_IPV6_RTHDR_LOOSE = 0
  6174. const m_IPV6_RTHDR_STRICT = 1
  6175. const m_IPV6_RTHDR_TYPE_0 = 0
  6176. const m_IPV6_RXDSTOPTS = "IPV6_DSTOPTS"
  6177. const m_IPV6_RXHOPOPTS = "IPV6_HOPOPTS"
  6178. const m_IPV6_TCLASS = 67
  6179. const m_IPV6_TRANSPARENT = 75
  6180. const m_IPV6_UNICAST_HOPS = 16
  6181. const m_IPV6_UNICAST_IF = 76
  6182. const m_IPV6_V6ONLY = 26
  6183. const m_IPV6_XFRM_POLICY = 35
  6184. const m_IP_ADD_MEMBERSHIP = 35
  6185. const m_IP_ADD_SOURCE_MEMBERSHIP = 39
  6186. const m_IP_BIND_ADDRESS_NO_PORT = 24
  6187. const m_IP_BLOCK_SOURCE = 38
  6188. const m_IP_CHECKSUM = 23
  6189. const m_IP_DEFAULT_MULTICAST_LOOP = 1
  6190. const m_IP_DEFAULT_MULTICAST_TTL = 1
  6191. const m_IP_DROP_MEMBERSHIP = 36
  6192. const m_IP_DROP_SOURCE_MEMBERSHIP = 40
  6193. const m_IP_FREEBIND = 15
  6194. const m_IP_HDRINCL = 3
  6195. const m_IP_IPSEC_POLICY = 16
  6196. const m_IP_MAX_MEMBERSHIPS = 20
  6197. const m_IP_MINTTL = 21
  6198. const m_IP_MSFILTER = 41
  6199. const m_IP_MTU = 14
  6200. const m_IP_MTU_DISCOVER = 10
  6201. const m_IP_MULTICAST_ALL = 49
  6202. const m_IP_MULTICAST_IF = 32
  6203. const m_IP_MULTICAST_LOOP = 34
  6204. const m_IP_MULTICAST_TTL = 33
  6205. const m_IP_NODEFRAG = 22
  6206. const m_IP_OPTIONS = 4
  6207. const m_IP_ORIGDSTADDR = 20
  6208. const m_IP_PASSSEC = 18
  6209. const m_IP_PKTINFO = 8
  6210. const m_IP_PKTOPTIONS = 9
  6211. const m_IP_PMTUDISC = 10
  6212. const m_IP_PMTUDISC_DO = 2
  6213. const m_IP_PMTUDISC_DONT = 0
  6214. const m_IP_PMTUDISC_INTERFACE = 4
  6215. const m_IP_PMTUDISC_OMIT = 5
  6216. const m_IP_PMTUDISC_PROBE = 3
  6217. const m_IP_PMTUDISC_WANT = 1
  6218. const m_IP_RECVERR = 11
  6219. const m_IP_RECVERR_RFC4884 = 26
  6220. const m_IP_RECVFRAGSIZE = 25
  6221. const m_IP_RECVOPTS = 6
  6222. const m_IP_RECVORIGDSTADDR = "IP_ORIGDSTADDR"
  6223. const m_IP_RECVRETOPTS = "IP_RETOPTS"
  6224. const m_IP_RECVTOS = 13
  6225. const m_IP_RECVTTL = 12
  6226. const m_IP_RETOPTS = 7
  6227. const m_IP_ROUTER_ALERT = 5
  6228. const m_IP_TOS = 1
  6229. const m_IP_TRANSPARENT = 19
  6230. const m_IP_TTL = 2
  6231. const m_IP_UNBLOCK_SOURCE = 37
  6232. const m_IP_UNICAST_IF = 50
  6233. const m_IP_XFRM_POLICY = 17
  6234. const m_MCAST_BLOCK_SOURCE = 43
  6235. const m_MCAST_EXCLUDE = 0
  6236. const m_MCAST_INCLUDE = 1
  6237. const m_MCAST_JOIN_GROUP = 42
  6238. const m_MCAST_JOIN_SOURCE_GROUP = 46
  6239. const m_MCAST_LEAVE_GROUP = 45
  6240. const m_MCAST_LEAVE_SOURCE_GROUP = 47
  6241. const m_MCAST_MSFILTER = 48
  6242. const m_MCAST_UNBLOCK_SOURCE = 44
  6243. const m___UAPI_DEF_IN6_ADDR = 0
  6244. const m___UAPI_DEF_IN6_ADDR_ALT = 0
  6245. const m___UAPI_DEF_IN6_PKTINFO = 0
  6246. const m___UAPI_DEF_IN_ADDR = 0
  6247. const m___UAPI_DEF_IN_CLASS = 0
  6248. const m___UAPI_DEF_IN_IPPROTO = 0
  6249. const m___UAPI_DEF_IN_PKTINFO = 0
  6250. const m___UAPI_DEF_IP6_MTUINFO = 0
  6251. const m___UAPI_DEF_IPPROTO_V6 = 0
  6252. const m___UAPI_DEF_IPV6_MREQ = 0
  6253. const m___UAPI_DEF_IPV6_OPTIONS = 0
  6254. const m___UAPI_DEF_IP_MREQ = 0
  6255. const m___UAPI_DEF_SOCKADDR_IN = 0
  6256. const m___UAPI_DEF_SOCKADDR_IN6 = 0
  6257. type Tin_port_t = uint16
  6258. type Tin_addr_t = uint32
  6259. type Tin_addr = struct {
  6260. Fs_addr Tin_addr_t
  6261. }
  6262. type Tsockaddr_in = struct {
  6263. Fsin_family Tsa_family_t
  6264. Fsin_port Tin_port_t
  6265. Fsin_addr Tin_addr
  6266. Fsin_zero [8]Tuint8_t
  6267. }
  6268. type Tin6_addr = struct {
  6269. F__in6_union struct {
  6270. F__s6_addr16 [0][8]Tuint16_t
  6271. F__s6_addr32 [0][4]Tuint32_t
  6272. F__s6_addr [16]Tuint8_t
  6273. }
  6274. }
  6275. type Tsockaddr_in6 = struct {
  6276. Fsin6_family Tsa_family_t
  6277. Fsin6_port Tin_port_t
  6278. Fsin6_flowinfo Tuint32_t
  6279. Fsin6_addr Tin6_addr
  6280. Fsin6_scope_id Tuint32_t
  6281. }
  6282. type Tipv6_mreq = struct {
  6283. Fipv6mr_multiaddr Tin6_addr
  6284. Fipv6mr_interface uint32
  6285. }
  6286. type Tip_opts = struct {
  6287. Fip_dst Tin_addr
  6288. Fip_opts [40]uint8
  6289. }
  6290. type Tip_mreq = struct {
  6291. Fimr_multiaddr Tin_addr
  6292. Fimr_interface Tin_addr
  6293. }
  6294. type Tip_mreqn = struct {
  6295. Fimr_multiaddr Tin_addr
  6296. Fimr_address Tin_addr
  6297. Fimr_ifindex int32
  6298. }
  6299. type Tip_mreq_source = struct {
  6300. Fimr_multiaddr Tin_addr
  6301. Fimr_interface Tin_addr
  6302. Fimr_sourceaddr Tin_addr
  6303. }
  6304. type Tip_msfilter = struct {
  6305. Fimsf_multiaddr Tin_addr
  6306. Fimsf_interface Tin_addr
  6307. Fimsf_fmode Tuint32_t
  6308. Fimsf_numsrc Tuint32_t
  6309. Fimsf_slist [1]Tin_addr
  6310. }
  6311. type Tgroup_req = struct {
  6312. Fgr_interface Tuint32_t
  6313. Fgr_group Tsockaddr_storage
  6314. }
  6315. type Tgroup_source_req = struct {
  6316. Fgsr_interface Tuint32_t
  6317. Fgsr_group Tsockaddr_storage
  6318. Fgsr_source Tsockaddr_storage
  6319. }
  6320. type Tgroup_filter = struct {
  6321. Fgf_interface Tuint32_t
  6322. Fgf_group Tsockaddr_storage
  6323. Fgf_fmode Tuint32_t
  6324. Fgf_numsrc Tuint32_t
  6325. Fgf_slist [1]Tsockaddr_storage
  6326. }
  6327. type Tin_pktinfo = struct {
  6328. Fipi_ifindex int32
  6329. Fipi_spec_dst Tin_addr
  6330. Fipi_addr Tin_addr
  6331. }
  6332. type Tin6_pktinfo = struct {
  6333. Fipi6_addr Tin6_addr
  6334. Fipi6_ifindex uint32
  6335. }
  6336. type Tip6_mtuinfo = struct {
  6337. Fip6m_addr Tsockaddr_in6
  6338. Fip6m_mtu Tuint32_t
  6339. }
  6340. // C documentation
  6341. //
  6342. // /*
  6343. // * static int
  6344. // * inet_net_pton(af, src, dst, size)
  6345. // * convert network number from presentation to network format.
  6346. // * accepts hex octets, hex strings, decimal octets, and /CIDR.
  6347. // * "size" is in bytes and describes "dst".
  6348. // * return:
  6349. // * number of bits, either imputed classfully or specified with /CIDR,
  6350. // * or -1 if some failure occurred (check errno). ENOENT means it was
  6351. // * not a valid network specification.
  6352. // * author:
  6353. // * Paul Vixie (ISC), June 1996
  6354. // */
  6355. func Xinet_net_pton(tls *libc.TLS, af int32, src uintptr, dst uintptr, size Tsize_t) (r int32) {
  6356. switch af {
  6357. case int32(m_PF_INET):
  6358. return _inet_net_pton_ipv4(tls, src, dst, size)
  6359. default:
  6360. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EAFNOSUPPORT)
  6361. return -int32(1)
  6362. }
  6363. return r
  6364. }
  6365. // C documentation
  6366. //
  6367. // /*
  6368. // * static int
  6369. // * inet_net_pton_ipv4(src, dst, size)
  6370. // * convert IPv4 network number from presentation to network format.
  6371. // * accepts hex octets, hex strings, decimal octets, and /CIDR.
  6372. // * "size" is in bytes and describes "dst".
  6373. // * return:
  6374. // * number of bits, either imputed classfully or specified with /CIDR,
  6375. // * or -1 if some failure occurred (check errno). ENOENT means it was
  6376. // * not an IPv4 network specification.
  6377. // * note:
  6378. // * network byte order assumed. this means 192.5.5.240/28 has
  6379. // * 0x11110000 in its fourth octet.
  6380. // * author:
  6381. // * Paul Vixie (ISC), June 1996
  6382. // */
  6383. func _inet_net_pton_ipv4(tls *libc.TLS, src uintptr, dst uintptr, size Tsize_t) (r int32) {
  6384. var bits, ch, dirty, n, tmp, v10, v17, v2, v5 int32
  6385. var odst, v1, v11, v14, v15, v16, v18, v21, v3, v8, p4, p6 uintptr
  6386. var v13, v20, v7 Tsize_t
  6387. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bits, ch, dirty, n, odst, tmp, v1, v10, v11, v13, v14, v15, v16, v17, v18, v2, v20, v21, v3, v5, v7, v8, p4, p6
  6388. odst = dst
  6389. v1 = src
  6390. src++
  6391. ch = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v1)))
  6392. if ch == int32('0') && (libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(src))) == int32('x') || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(src))) == int32('X')) && libc.BoolInt32(uint32(*(*uint8)(unsafe.Pointer(src + 1))) < uint32(128)) != 0 && libc.Xisxdigit(tls, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(src + 1)))) != 0 {
  6393. /* Hexadecimal: Eat nybble string. */
  6394. if size <= uint64(0) {
  6395. goto emsgsize
  6396. }
  6397. *(*uint8)(unsafe.Pointer(dst)) = uint8(0)
  6398. dirty = libc.Int32FromInt32(0)
  6399. src++ /* skip x or X. */
  6400. for {
  6401. v3 = src
  6402. src++
  6403. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v3)))
  6404. ch = v2
  6405. if !(v2 != int32('\000') && libc.BoolInt32(libc.Uint32FromInt32(ch) < uint32(128)) != 0 && libc.Xisxdigit(tls, ch) != 0) {
  6406. break
  6407. }
  6408. if libc.BoolInt32(libc.Uint32FromInt32(ch)-uint32('A') < uint32(26)) != 0 {
  6409. ch = libc.Xtolower(tls, ch)
  6410. }
  6411. n = int32(int64(libc.Xstrchr(tls, uintptr(unsafe.Pointer(&_xdigits)), ch)) - t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_xdigits))))
  6412. p4 = dst
  6413. *(*uint8)(unsafe.Pointer(p4)) = uint8(int32(*(*uint8)(unsafe.Pointer(p4))) | n)
  6414. v5 = dirty
  6415. dirty++
  6416. if !(v5 != 0) {
  6417. p6 = dst
  6418. *(*uint8)(unsafe.Pointer(p6)) = uint8(int32(*(*uint8)(unsafe.Pointer(p6))) << libc.Int32FromInt32(4))
  6419. } else {
  6420. v7 = size
  6421. size--
  6422. if v7 > uint64(0) {
  6423. dst++
  6424. v8 = dst
  6425. *(*uint8)(unsafe.Pointer(v8)) = uint8(0)
  6426. dirty = libc.Int32FromInt32(0)
  6427. } else {
  6428. goto emsgsize
  6429. }
  6430. }
  6431. }
  6432. if dirty != 0 {
  6433. size--
  6434. }
  6435. } else {
  6436. if libc.BoolInt32(libc.Uint32FromInt32(ch) < uint32(128)) != 0 && libc.BoolInt32(libc.Uint32FromInt32(ch)-uint32('0') < uint32(10)) != 0 {
  6437. /* Decimal: eat dotted digit string. */
  6438. for {
  6439. tmp = 0
  6440. for {
  6441. n = int32(int64(libc.Xstrchr(tls, uintptr(unsafe.Pointer(&_digits)), ch)) - t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_digits))))
  6442. tmp *= int32(10)
  6443. tmp += n
  6444. if tmp > int32(255) {
  6445. goto enoent
  6446. }
  6447. goto _12
  6448. _12:
  6449. ;
  6450. v11 = src
  6451. src++
  6452. v10 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v11)))
  6453. ch = v10
  6454. if !(v10 != int32('\000') && libc.BoolInt32(libc.Uint32FromInt32(ch) < uint32(128)) != 0 && libc.BoolInt32(libc.Uint32FromInt32(ch)-uint32('0') < uint32(10)) != 0) {
  6455. break
  6456. }
  6457. }
  6458. v13 = size
  6459. size--
  6460. if v13 <= uint64(0) {
  6461. goto emsgsize
  6462. }
  6463. v14 = dst
  6464. dst++
  6465. *(*uint8)(unsafe.Pointer(v14)) = libc.Uint8FromInt32(tmp)
  6466. if ch == int32('\000') || ch == int32('/') {
  6467. break
  6468. }
  6469. if ch != int32('.') {
  6470. goto enoent
  6471. }
  6472. v15 = src
  6473. src++
  6474. ch = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v15)))
  6475. if !(libc.BoolInt32(libc.Uint32FromInt32(ch) < libc.Uint32FromInt32(128)) != 0) || !(libc.BoolInt32(libc.Uint32FromInt32(ch)-libc.Uint32FromUint8('0') < libc.Uint32FromInt32(10)) != 0) {
  6476. goto enoent
  6477. }
  6478. goto _9
  6479. _9:
  6480. }
  6481. } else {
  6482. goto enoent
  6483. }
  6484. }
  6485. bits = -int32(1)
  6486. if ch == int32('/') && libc.BoolInt32(uint32(*(*uint8)(unsafe.Pointer(src))) < uint32(128)) != 0 && libc.BoolInt32(uint32(*(*uint8)(unsafe.Pointer(src)))-uint32('0') < uint32(10)) != 0 && dst > odst {
  6487. /* CIDR width specifier. Nothing can follow it. */
  6488. v16 = src
  6489. src++
  6490. ch = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v16))) /* Skip over the /. */
  6491. bits = 0
  6492. for {
  6493. n = int32(int64(libc.Xstrchr(tls, uintptr(unsafe.Pointer(&_digits)), ch)) - t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_digits))))
  6494. bits *= int32(10)
  6495. bits += n
  6496. goto _19
  6497. _19:
  6498. ;
  6499. v18 = src
  6500. src++
  6501. v17 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v18)))
  6502. ch = v17
  6503. if !(v17 != int32('\000') && libc.BoolInt32(libc.Uint32FromInt32(ch) < uint32(128)) != 0 && libc.BoolInt32(libc.Uint32FromInt32(ch)-uint32('0') < uint32(10)) != 0) {
  6504. break
  6505. }
  6506. }
  6507. if ch != int32('\000') {
  6508. goto enoent
  6509. }
  6510. if bits > int32(32) {
  6511. goto emsgsize
  6512. }
  6513. }
  6514. /* Firey death and destruction unless we prefetched EOS. */
  6515. if ch != int32('\000') {
  6516. goto enoent
  6517. }
  6518. /* If nothing was written to the destination, we found no address. */
  6519. if dst == odst {
  6520. goto enoent
  6521. }
  6522. /* If no CIDR spec was given, infer width from net class. */
  6523. if bits == -int32(1) {
  6524. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(odst))) >= int32(240) { /* Class E */
  6525. bits = int32(32)
  6526. } else {
  6527. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(odst))) >= int32(224) { /* Class D */
  6528. bits = int32(4)
  6529. } else {
  6530. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(odst))) >= int32(192) { /* Class C */
  6531. bits = int32(24)
  6532. } else {
  6533. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(odst))) >= int32(128) { /* Class B */
  6534. bits = int32(16)
  6535. } else { /* Class A */
  6536. bits = int32(8)
  6537. }
  6538. }
  6539. }
  6540. }
  6541. /* If imputed mask is narrower than specified octets, widen. */
  6542. if int64(bits) < (int64(dst)-int64(odst))*int64(8) {
  6543. bits = int32((int64(dst) - int64(odst)) * int64(8))
  6544. }
  6545. }
  6546. /* Extend network to cover the actual mask. */
  6547. for int64(bits) > (int64(dst)-int64(odst))*int64(8) {
  6548. v20 = size
  6549. size--
  6550. if v20 <= uint64(0) {
  6551. goto emsgsize
  6552. }
  6553. v21 = dst
  6554. dst++
  6555. *(*uint8)(unsafe.Pointer(v21)) = uint8('\000')
  6556. }
  6557. return bits
  6558. goto enoent
  6559. enoent:
  6560. ;
  6561. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOENT)
  6562. return -int32(1)
  6563. goto emsgsize
  6564. emsgsize:
  6565. ;
  6566. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EMSGSIZE)
  6567. return -int32(1)
  6568. }
  6569. var _xdigits = [17]uint8{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}
  6570. var _digits = [11]uint8{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}
  6571. const m_MD5_BLOCK_LENGTH = 64
  6572. const m_MD5_DIGEST_LENGTH = 16
  6573. type TMD5_CTX = struct {
  6574. Fstate [4]Tuint32_t
  6575. Fcount Tuint64_t
  6576. Fbuffer [64]Tuint8_t
  6577. }
  6578. type TMD5Context = TMD5_CTX
  6579. /* Avoid polluting the namespace. Even though this makes this usage
  6580. * implementation-specific, defining it unconditionally should not be
  6581. * a problem, and better than possibly breaking unexpecting code. */
  6582. /*
  6583. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  6584. *
  6585. * Redistribution and use in source and binary forms, with or without
  6586. * modification, are permitted provided that the following conditions
  6587. * are met:
  6588. * 1. Redistributions of source code must retain the above copyright
  6589. * notice, this list of conditions and the following disclaimer.
  6590. * 2. Redistributions in binary form must reproduce the above copyright
  6591. * notice, this list of conditions and the following disclaimer in the
  6592. * documentation and/or other materials provided with the distribution.
  6593. * 3. The name of the author may not be used to endorse or promote products
  6594. * derived from this software without specific prior written permission.
  6595. *
  6596. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  6597. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  6598. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  6599. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  6600. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  6601. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  6602. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  6603. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  6604. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  6605. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  6606. */
  6607. /*
  6608. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  6609. *
  6610. * Redistribution and use in source and binary forms, with or without
  6611. * modification, are permitted provided that the following conditions
  6612. * are met:
  6613. * 1. Redistributions of source code must retain the above copyright
  6614. * notice, this list of conditions and the following disclaimer.
  6615. * 2. Redistributions in binary form must reproduce the above copyright
  6616. * notice, this list of conditions and the following disclaimer in the
  6617. * documentation and/or other materials provided with the distribution.
  6618. * 3. The name of the author may not be used to endorse or promote products
  6619. * derived from this software without specific prior written permission.
  6620. *
  6621. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  6622. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  6623. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  6624. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  6625. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  6626. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  6627. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  6628. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  6629. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  6630. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  6631. */
  6632. /* Clang expands this to 1 if an identifier is *not* reserved. */
  6633. /*
  6634. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  6635. * musl, try to handle this gracefully.
  6636. */
  6637. /* Copyright (C) 1992-2020 Free Software Foundation, Inc.
  6638. This file is part of the GNU C Library.
  6639. The GNU C Library is free software; you can redistribute it and/or
  6640. modify it under the terms of the GNU Lesser General Public
  6641. License as published by the Free Software Foundation; either
  6642. version 2.1 of the License, or (at your option) any later version.
  6643. The GNU C Library is distributed in the hope that it will be useful,
  6644. but WITHOUT ANY WARRANTY; without even the implied warranty of
  6645. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  6646. Lesser General Public License for more details.
  6647. You should have received a copy of the GNU Lesser General Public
  6648. License along with the GNU C Library; if not, see
  6649. <https://www.gnu.org/licenses/>. */
  6650. /* We are almost always included from features.h. */
  6651. /* The GNU libc does not support any K&R compilers or the traditional mode
  6652. of ISO C compilers anymore. Check for some of the combinations not
  6653. anymore supported. */
  6654. /* Some user header file might have defined this before. */
  6655. /* All functions, except those with callbacks or those that
  6656. synchronize memory, are leaf functions. */
  6657. /* GCC can always grok prototypes. For C++ programs we add throw()
  6658. to help it optimize the function calls. But this works only with
  6659. gcc 2.8.x and egcs. For gcc 3.2 and up we even mark C functions
  6660. as non-throwing using a function attribute since programs can use
  6661. the -fexceptions options for C code as well. */
  6662. /* Compilers that are not clang may object to
  6663. #if defined __clang__ && __has_extension(...)
  6664. even though they do not need to evaluate the right-hand side of the &&. */
  6665. /* These two macros are not used in glibc anymore. They are kept here
  6666. only because some other projects expect the macros to be defined. */
  6667. /* For these things, GCC behaves the ANSI way normally,
  6668. and the non-ANSI way under -traditional. */
  6669. /* This is not a typedef so `const __ptr_t' does the right thing. */
  6670. /* C++ needs to know that types and declarations are C, not C++. */
  6671. /* Fortify support. */
  6672. /* Support for flexible arrays.
  6673. Headers that should use flexible arrays only if they're "real"
  6674. (e.g. only if they won't affect sizeof()) should test
  6675. #if __glibc_c99_flexarr_available. */
  6676. /* __asm__ ("xyz") is used throughout the headers to rename functions
  6677. at the assembly language level. This is wrapped by the __REDIRECT
  6678. macro, in order to support compilers that can do this some other
  6679. way. When compilers don't support asm-names at all, we have to do
  6680. preprocessor tricks instead (which don't have exactly the right
  6681. semantics, but it's the best we can do).
  6682. Example:
  6683. int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */
  6684. /*
  6685. #elif __SOME_OTHER_COMPILER__
  6686. # define __REDIRECT(name, proto, alias) name proto; _Pragma("let " #name " = " #alias)
  6687. */
  6688. /* GCC has various useful declarations that can be made with the
  6689. `__attribute__' syntax. All of the ways we use this do fine if
  6690. they are omitted for compilers that don't understand it. */
  6691. /* At some point during the gcc 2.96 development the `malloc' attribute
  6692. for functions was introduced. We don't want to use it unconditionally
  6693. (although this would be possible) since it generates warnings. */
  6694. /* Tell the compiler which arguments to an allocation function
  6695. indicate the size of the allocation. */
  6696. /* At some point during the gcc 2.96 development the `pure' attribute
  6697. for functions was introduced. We don't want to use it unconditionally
  6698. (although this would be possible) since it generates warnings. */
  6699. /* This declaration tells the compiler that the value is constant. */
  6700. /* At some point during the gcc 3.1 development the `used' attribute
  6701. for functions was introduced. We don't want to use it unconditionally
  6702. (although this would be possible) since it generates warnings. */
  6703. /* Since version 3.2, gcc allows marking deprecated functions. */
  6704. /* Since version 4.5, gcc also allows one to specify the message printed
  6705. when a deprecated function is used. clang claims to be gcc 4.2, but
  6706. may also support this feature. */
  6707. /* At some point during the gcc 2.8 development the `format_arg' attribute
  6708. for functions was introduced. We don't want to use it unconditionally
  6709. (although this would be possible) since it generates warnings.
  6710. If several `format_arg' attributes are given for the same function, in
  6711. gcc-3.0 and older, all but the last one are ignored. In newer gccs,
  6712. all designated arguments are considered. */
  6713. /* At some point during the gcc 2.97 development the `strfmon' format
  6714. attribute for functions was introduced. We don't want to use it
  6715. unconditionally (although this would be possible) since it
  6716. generates warnings. */
  6717. /* The nonull function attribute allows to mark pointer parameters which
  6718. must not be NULL. */
  6719. /* If fortification mode, we warn about unused results of certain
  6720. function calls which can lead to problems. */
  6721. /* Forces a function to be always inlined. */
  6722. /* Associate error messages with the source location of the call site rather
  6723. than with the source location inside the function. */
  6724. /* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
  6725. inline semantics, unless -fgnu89-inline is used. Using __GNUC_STDC_INLINE__
  6726. or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions
  6727. older than 4.3 may define these macros and still not guarantee GNU inlining
  6728. semantics.
  6729. clang++ identifies itself as gcc-4.2, but has support for GNU inlining
  6730. semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and
  6731. __GNUC_GNU_INLINE__ macro definitions. */
  6732. /* GCC 4.3 and above allow passing all anonymous arguments of an
  6733. __extern_always_inline function to some other vararg function. */
  6734. /* It is possible to compile containing GCC extensions even if GCC is
  6735. run in pedantic mode if the uses are carefully marked using the
  6736. `__extension__' keyword. But this is not generally available before
  6737. version 2.8. */
  6738. /* __restrict is known in EGCS 1.2 and above. */
  6739. /* ISO C99 also allows to declare arrays as non-overlapping. The syntax is
  6740. array_name[restrict]
  6741. GCC 3.1 supports this. */
  6742. /* Undefine (also defined in libc-symbols.h). */
  6743. /* Determine the wordsize from the preprocessor defines. */
  6744. /* Properties of long double type. ldbl-opt version.
  6745. Copyright (C) 2016-2020 Free Software Foundation, Inc.
  6746. This file is part of the GNU C Library.
  6747. The GNU C Library is free software; you can redistribute it and/or
  6748. modify it under the terms of the GNU Lesser General Public
  6749. License published by the Free Software Foundation; either
  6750. version 2.1 of the License, or (at your option) any later version.
  6751. The GNU C Library is distributed in the hope that it will be useful,
  6752. but WITHOUT ANY WARRANTY; without even the implied warranty of
  6753. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  6754. Lesser General Public License for more details.
  6755. You should have received a copy of the GNU Lesser General Public
  6756. License along with the GNU C Library; if not, see
  6757. <https://www.gnu.org/licenses/>. */
  6758. /* __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is
  6759. intended for use in preprocessor macros.
  6760. Note: MESSAGE must be a _single_ string; concatenation of string
  6761. literals is not supported. */
  6762. /* Generic selection (ISO C11) is a C-only feature, available in GCC
  6763. since version 4.9. Previous versions do not provide generic
  6764. selection, even though they might set __STDC_VERSION__ to 201112L,
  6765. when in -std=c11 mode. Thus, we must check for !defined __GNUC__
  6766. when testing __STDC_VERSION__ for generic selection support.
  6767. On the other hand, Clang also defines __GNUC__, so a clang-specific
  6768. check is required to enable the use of generic selection. */
  6769. /*
  6770. * On non-glibc based systems, we cannot unconditionally use the
  6771. * __GLIBC_PREREQ macro as it gets expanded before evaluation.
  6772. */
  6773. /*
  6774. * Some kFreeBSD headers expect those macros to be set for sanity checks.
  6775. */
  6776. /* Define the ABI for the current system. */
  6777. //#define LIBBSD_SYS_TIME_BITS 0
  6778. //#define LIBBSD_SYS_HAS_TIME64 0
  6779. /* Linux headers define a struct with a member names __unused.
  6780. * Debian bugs: #522773 (linux), #522774 (libc).
  6781. * Disable for now. */
  6782. /*
  6783. * Return the number of elements in a statically-allocated array,
  6784. * __x.
  6785. */
  6786. /*
  6787. * We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h>
  6788. * require it.
  6789. */
  6790. /*
  6791. * Given the pointer x to the member m of the struct s, return
  6792. * a pointer to the containing structure. When using GCC, we first
  6793. * assign pointer x to a local variable, to check that its type is
  6794. * compatible with member m.
  6795. */
  6796. func Xlibbsd_MD5Init(tls *libc.TLS, context uintptr) {
  6797. libmd.XMD5Init(tls, context)
  6798. }
  6799. var _libbsd_emit_link_warning_MD5Init = [77]uint8{'T', 'h', 'e', ' ', 'M', 'D', '5', 'I', 'n', 'i', 't', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i', 'n', ' ', 'l', 'i', 'b', 'b', 's', 'd', ' ', 'i', 's', ' ', 'a', ' ', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', ' ', 'w', 'r', 'a', 'p', 'p', 'e', 'r', ',', ' ', 'u', 's', 'e', ' ', 'l', 'i', 'b', 'm', 'd', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', '.'}
  6800. func Xlibbsd_MD5Update(tls *libc.TLS, context uintptr, data uintptr, len1 Tsize_t) {
  6801. libmd.XMD5Update(tls, context, data, len1)
  6802. }
  6803. var _libbsd_emit_link_warning_MD5Update = [79]uint8{'T', 'h', 'e', ' ', 'M', 'D', '5', 'U', 'p', 'd', 'a', 't', 'e', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i', 'n', ' ', 'l', 'i', 'b', 'b', 's', 'd', ' ', 'i', 's', ' ', 'a', ' ', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', ' ', 'w', 'r', 'a', 'p', 'p', 'e', 'r', ',', ' ', 'u', 's', 'e', ' ', 'l', 'i', 'b', 'm', 'd', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', '.'}
  6804. func Xlibbsd_MD5Pad(tls *libc.TLS, context uintptr) {
  6805. libmd.XMD5Pad(tls, context)
  6806. }
  6807. var _libbsd_emit_link_warning_MD5Pad = [76]uint8{'T', 'h', 'e', ' ', 'M', 'D', '5', 'P', 'a', 'd', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i', 'n', ' ', 'l', 'i', 'b', 'b', 's', 'd', ' ', 'i', 's', ' ', 'a', ' ', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', ' ', 'w', 'r', 'a', 'p', 'p', 'e', 'r', ',', ' ', 'u', 's', 'e', ' ', 'l', 'i', 'b', 'm', 'd', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', '.'}
  6808. func Xlibbsd_MD5Final(tls *libc.TLS, digest uintptr, context uintptr) {
  6809. libmd.XMD5Final(tls, digest, context)
  6810. }
  6811. var _libbsd_emit_link_warning_MD5Final = [78]uint8{'T', 'h', 'e', ' ', 'M', 'D', '5', 'F', 'i', 'n', 'a', 'l', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i', 'n', ' ', 'l', 'i', 'b', 'b', 's', 'd', ' ', 'i', 's', ' ', 'a', ' ', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', ' ', 'w', 'r', 'a', 'p', 'p', 'e', 'r', ',', ' ', 'u', 's', 'e', ' ', 'l', 'i', 'b', 'm', 'd', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', '.'}
  6812. func Xlibbsd_MD5Transform(tls *libc.TLS, state uintptr, block uintptr) {
  6813. libmd.XMD5Transform(tls, state, block)
  6814. }
  6815. var _libbsd_emit_link_warning_MD5Transform = [82]uint8{'T', 'h', 'e', ' ', 'M', 'D', '5', 'T', 'r', 'a', 'n', 's', 'f', 'o', 'r', 'm', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i', 'n', ' ', 'l', 'i', 'b', 'b', 's', 'd', ' ', 'i', 's', ' ', 'a', ' ', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', ' ', 'w', 'r', 'a', 'p', 'p', 'e', 'r', ',', ' ', 'u', 's', 'e', ' ', 'l', 'i', 'b', 'm', 'd', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', '.'}
  6816. func Xlibbsd_MD5End(tls *libc.TLS, context uintptr, buf uintptr) (r uintptr) {
  6817. return libmd.XMD5End(tls, context, buf)
  6818. }
  6819. var _libbsd_emit_link_warning_MD5End = [76]uint8{'T', 'h', 'e', ' ', 'M', 'D', '5', 'E', 'n', 'd', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i', 'n', ' ', 'l', 'i', 'b', 'b', 's', 'd', ' ', 'i', 's', ' ', 'a', ' ', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', ' ', 'w', 'r', 'a', 'p', 'p', 'e', 'r', ',', ' ', 'u', 's', 'e', ' ', 'l', 'i', 'b', 'm', 'd', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', '.'}
  6820. func Xlibbsd_MD5File(tls *libc.TLS, filename uintptr, buf uintptr) (r uintptr) {
  6821. return libmd.XMD5File(tls, filename, buf)
  6822. }
  6823. var _libbsd_emit_link_warning_MD5File = [77]uint8{'T', 'h', 'e', ' ', 'M', 'D', '5', 'F', 'i', 'l', 'e', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i', 'n', ' ', 'l', 'i', 'b', 'b', 's', 'd', ' ', 'i', 's', ' ', 'a', ' ', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', ' ', 'w', 'r', 'a', 'p', 'p', 'e', 'r', ',', ' ', 'u', 's', 'e', ' ', 'l', 'i', 'b', 'm', 'd', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', '.'}
  6824. func Xlibbsd_MD5FileChunk(tls *libc.TLS, filename uintptr, buf uintptr, offset Toff_t, length Toff_t) (r uintptr) {
  6825. return libmd.XMD5FileChunk(tls, filename, buf, offset, length)
  6826. }
  6827. var _libbsd_emit_link_warning_MD5FileChunk = [82]uint8{'T', 'h', 'e', ' ', 'M', 'D', '5', 'F', 'i', 'l', 'e', 'C', 'h', 'u', 'n', 'k', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i', 'n', ' ', 'l', 'i', 'b', 'b', 's', 'd', ' ', 'i', 's', ' ', 'a', ' ', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', ' ', 'w', 'r', 'a', 'p', 'p', 'e', 'r', ',', ' ', 'u', 's', 'e', ' ', 'l', 'i', 'b', 'm', 'd', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', '.'}
  6828. func Xlibbsd_MD5Data(tls *libc.TLS, data uintptr, len1 Tsize_t, buf uintptr) (r uintptr) {
  6829. return libmd.XMD5Data(tls, data, len1, buf)
  6830. }
  6831. var _libbsd_emit_link_warning_MD5Data = [77]uint8{'T', 'h', 'e', ' ', 'M', 'D', '5', 'D', 'a', 't', 'a', '(', ')', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i', 'n', ' ', 'l', 'i', 'b', 'b', 's', 'd', ' ', 'i', 's', ' ', 'a', ' ', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', ' ', 'w', 'r', 'a', 'p', 'p', 'e', 'r', ',', ' ', 'u', 's', 'e', ' ', 'l', 'i', 'b', 'm', 'd', ' ', 'i', 'n', 's', 't', 'e', 'a', 'd', '.'}
  6832. const m_AT_BASE = 7
  6833. const m_AT_BASE_PLATFORM = 24
  6834. const m_AT_CLKTCK = 17
  6835. const m_AT_DCACHEBSIZE = 19
  6836. const m_AT_EGID = 14
  6837. const m_AT_ENTRY = 9
  6838. const m_AT_EUID = 12
  6839. const m_AT_EXECFD = 2
  6840. const m_AT_EXECFN = 31
  6841. const m_AT_FLAGS = 8
  6842. const m_AT_FPUCW = 18
  6843. const m_AT_GID = 13
  6844. const m_AT_HWCAP = 16
  6845. const m_AT_HWCAP2 = 26
  6846. const m_AT_ICACHEBSIZE = 20
  6847. const m_AT_IGNORE = 1
  6848. const m_AT_IGNOREPPC = 22
  6849. const m_AT_L1D_CACHEGEOMETRY = 43
  6850. const m_AT_L1D_CACHESHAPE = 35
  6851. const m_AT_L1D_CACHESIZE = 42
  6852. const m_AT_L1I_CACHEGEOMETRY = 41
  6853. const m_AT_L1I_CACHESHAPE = 34
  6854. const m_AT_L1I_CACHESIZE = 40
  6855. const m_AT_L2_CACHEGEOMETRY = 45
  6856. const m_AT_L2_CACHESHAPE = 36
  6857. const m_AT_L2_CACHESIZE = 44
  6858. const m_AT_L3_CACHEGEOMETRY = 47
  6859. const m_AT_L3_CACHESHAPE = 37
  6860. const m_AT_L3_CACHESIZE = 46
  6861. const m_AT_MINSIGSTKSZ = 51
  6862. const m_AT_NOTELF = 10
  6863. const m_AT_NULL = 0
  6864. const m_AT_PAGESZ = 6
  6865. const m_AT_PHDR = 3
  6866. const m_AT_PHENT = 4
  6867. const m_AT_PHNUM = 5
  6868. const m_AT_PLATFORM = 15
  6869. const m_AT_RANDOM = 25
  6870. const m_AT_SECURE = 23
  6871. const m_AT_SYSINFO = 32
  6872. const m_AT_SYSINFO_EHDR = 33
  6873. const m_AT_UCACHEBSIZE = 21
  6874. const m_AT_UID = 11
  6875. const m_AUX_FUNC = 2
  6876. const m_AUX_OBJECT = 1
  6877. const m_BIND_WEAK = 2
  6878. const m_DF_1_CONFALT = 0x00002000
  6879. const m_DF_1_DIRECT = 0x00000100
  6880. const m_DF_1_DISPRELDNE = 0x00008000
  6881. const m_DF_1_DISPRELPND = 0x00010000
  6882. const m_DF_1_EDITED = 0x00200000
  6883. const m_DF_1_ENDFILTEE = 0x00004000
  6884. const m_DF_1_GLOBAL = 0x00000002
  6885. const m_DF_1_GLOBAUDIT = 0x01000000
  6886. const m_DF_1_GROUP = 0x00000004
  6887. const m_DF_1_IGNMULDEF = 0x00040000
  6888. const m_DF_1_INITFIRST = 0x00000020
  6889. const m_DF_1_INTERPOSE = 0x00000400
  6890. const m_DF_1_LOADFLTR = 0x00000010
  6891. const m_DF_1_NODEFLIB = 0x00000800
  6892. const m_DF_1_NODELETE = 0x00000008
  6893. const m_DF_1_NODIRECT = 0x00020000
  6894. const m_DF_1_NODUMP = 0x00001000
  6895. const m_DF_1_NOHDR = 0x00100000
  6896. const m_DF_1_NOKSYMS = 0x00080000
  6897. const m_DF_1_NOOPEN = 0x00000040
  6898. const m_DF_1_NORELOC = 0x00400000
  6899. const m_DF_1_NOW = 0x00000001
  6900. const m_DF_1_ORIGIN = 0x00000080
  6901. const m_DF_1_PIE = 0x08000000
  6902. const m_DF_1_SINGLETON = 0x02000000
  6903. const m_DF_1_STUB = 0x04000000
  6904. const m_DF_1_SYMINTPOSE = 0x00800000
  6905. const m_DF_1_TRANS = 0x00000200
  6906. const m_DF_BIND_NOW = 0x00000008
  6907. const m_DF_ORIGIN = 0x00000001
  6908. const m_DF_P1_GROUPPERM = 0x00000002
  6909. const m_DF_P1_LAZYLOAD = 0x00000001
  6910. const m_DF_STATIC_TLS = 0x00000010
  6911. const m_DF_SYMBOLIC = 0x00000002
  6912. const m_DF_TEXTREL = 0x00000004
  6913. const m_DTF_1_CONFEXP = 0x00000002
  6914. const m_DTF_1_PARINIT = 0x00000001
  6915. const m_DT_ADDRNUM = 11
  6916. const m_DT_ADDRRNGHI = 0x6ffffeff
  6917. const m_DT_ADDRRNGLO = 0x6ffffe00
  6918. const m_DT_ALPHA_NUM = 1
  6919. const m_DT_AUDIT = 0x6ffffefc
  6920. const m_DT_AUXILIARY = 0x7ffffffd
  6921. const m_DT_BIND_NOW = 24
  6922. const m_DT_CHECKSUM = 0x6ffffdf8
  6923. const m_DT_CONFIG = 0x6ffffefa
  6924. const m_DT_DEBUG = 21
  6925. const m_DT_DEPAUDIT = 0x6ffffefb
  6926. const m_DT_ENCODING = 32
  6927. const m_DT_EXTRANUM = 3
  6928. const m_DT_FEATURE_1 = 0x6ffffdfc
  6929. const m_DT_FILTER = 0x7fffffff
  6930. const m_DT_FINI = 13
  6931. const m_DT_FINI_ARRAY = 26
  6932. const m_DT_FINI_ARRAYSZ = 28
  6933. const m_DT_FLAGS = 30
  6934. const m_DT_FLAGS_1 = 0x6ffffffb
  6935. const m_DT_GNU_CONFLICT = 0x6ffffef8
  6936. const m_DT_GNU_CONFLICTSZ = 0x6ffffdf6
  6937. const m_DT_GNU_HASH = 0x6ffffef5
  6938. const m_DT_GNU_LIBLIST = 0x6ffffef9
  6939. const m_DT_GNU_LIBLISTSZ = 0x6ffffdf7
  6940. const m_DT_GNU_PRELINKED = 0x6ffffdf5
  6941. const m_DT_HASH = 4
  6942. const m_DT_HIOS = 0x6ffff000
  6943. const m_DT_HIPROC = 0x7fffffff
  6944. const m_DT_IA_64_NUM = 1
  6945. const m_DT_INIT = 12
  6946. const m_DT_INIT_ARRAY = 25
  6947. const m_DT_INIT_ARRAYSZ = 27
  6948. const m_DT_JMPREL = 23
  6949. const m_DT_LOOS = 0x6000000d
  6950. const m_DT_LOPROC = 0x70000000
  6951. const m_DT_MIPS_AUX_DYNAMIC = 0x70000031
  6952. const m_DT_MIPS_BASE_ADDRESS = 0x70000006
  6953. const m_DT_MIPS_COMPACT_SIZE = 0x7000002f
  6954. const m_DT_MIPS_CONFLICT = 0x70000008
  6955. const m_DT_MIPS_CONFLICTNO = 0x7000000b
  6956. const m_DT_MIPS_CXX_FLAGS = 0x70000022
  6957. const m_DT_MIPS_DELTA_CLASS = 0x70000017
  6958. const m_DT_MIPS_DELTA_CLASSSYM = 0x70000020
  6959. const m_DT_MIPS_DELTA_CLASSSYM_NO = 0x70000021
  6960. const m_DT_MIPS_DELTA_CLASS_NO = 0x70000018
  6961. const m_DT_MIPS_DELTA_INSTANCE = 0x70000019
  6962. const m_DT_MIPS_DELTA_INSTANCE_NO = 0x7000001a
  6963. const m_DT_MIPS_DELTA_RELOC = 0x7000001b
  6964. const m_DT_MIPS_DELTA_RELOC_NO = 0x7000001c
  6965. const m_DT_MIPS_DELTA_SYM = 0x7000001d
  6966. const m_DT_MIPS_DELTA_SYM_NO = 0x7000001e
  6967. const m_DT_MIPS_DYNSTR_ALIGN = 0x7000002b
  6968. const m_DT_MIPS_FLAGS = 0x70000005
  6969. const m_DT_MIPS_GOTSYM = 0x70000013
  6970. const m_DT_MIPS_GP_VALUE = 0x70000030
  6971. const m_DT_MIPS_HIDDEN_GOTIDX = 0x70000027
  6972. const m_DT_MIPS_HIPAGENO = 0x70000014
  6973. const m_DT_MIPS_ICHECKSUM = 0x70000003
  6974. const m_DT_MIPS_INTERFACE = 0x7000002a
  6975. const m_DT_MIPS_INTERFACE_SIZE = 0x7000002c
  6976. const m_DT_MIPS_IVERSION = 0x70000004
  6977. const m_DT_MIPS_LIBLIST = 0x70000009
  6978. const m_DT_MIPS_LIBLISTNO = 0x70000010
  6979. const m_DT_MIPS_LOCALPAGE_GOTIDX = 0x70000025
  6980. const m_DT_MIPS_LOCAL_GOTIDX = 0x70000026
  6981. const m_DT_MIPS_LOCAL_GOTNO = 0x7000000a
  6982. const m_DT_MIPS_MSYM = 0x70000007
  6983. const m_DT_MIPS_NUM = 0x36
  6984. const m_DT_MIPS_OPTIONS = 0x70000029
  6985. const m_DT_MIPS_PERF_SUFFIX = 0x7000002e
  6986. const m_DT_MIPS_PIXIE_INIT = 0x70000023
  6987. const m_DT_MIPS_PLTGOT = 0x70000032
  6988. const m_DT_MIPS_PROTECTED_GOTIDX = 0x70000028
  6989. const m_DT_MIPS_RLD_MAP = 0x70000016
  6990. const m_DT_MIPS_RLD_MAP_REL = 0x70000035
  6991. const m_DT_MIPS_RLD_TEXT_RESOLVE_ADDR = 0x7000002d
  6992. const m_DT_MIPS_RLD_VERSION = 0x70000001
  6993. const m_DT_MIPS_RWPLT = 0x70000034
  6994. const m_DT_MIPS_SYMBOL_LIB = 0x70000024
  6995. const m_DT_MIPS_SYMTABNO = 0x70000011
  6996. const m_DT_MIPS_TIME_STAMP = 0x70000002
  6997. const m_DT_MIPS_UNREFEXTNO = 0x70000012
  6998. const m_DT_MOVEENT = 0x6ffffdfa
  6999. const m_DT_MOVESZ = 0x6ffffdfb
  7000. const m_DT_MOVETAB = 0x6ffffefe
  7001. const m_DT_NEEDED = 1
  7002. const m_DT_NIOS2_GP = 0x70000002
  7003. const m_DT_NULL = 0
  7004. const m_DT_NUM = 38
  7005. const m_DT_PLTGOT = 3
  7006. const m_DT_PLTPAD = 0x6ffffefd
  7007. const m_DT_PLTPADSZ = 0x6ffffdf9
  7008. const m_DT_PLTREL = 20
  7009. const m_DT_PLTRELSZ = 2
  7010. const m_DT_POSFLAG_1 = 0x6ffffdfd
  7011. const m_DT_PPC64_NUM = 4
  7012. const m_DT_PPC_NUM = 2
  7013. const m_DT_PREINIT_ARRAY = 32
  7014. const m_DT_PREINIT_ARRAYSZ = 33
  7015. const m_DT_PROCNUM = "DT_MIPS_NUM"
  7016. const m_DT_REL = 17
  7017. const m_DT_RELA = 7
  7018. const m_DT_RELACOUNT = 0x6ffffff9
  7019. const m_DT_RELAENT = 9
  7020. const m_DT_RELASZ = 8
  7021. const m_DT_RELCOUNT = 0x6ffffffa
  7022. const m_DT_RELENT = 19
  7023. const m_DT_RELR = 36
  7024. const m_DT_RELRENT = 37
  7025. const m_DT_RELRSZ = 35
  7026. const m_DT_RELSZ = 18
  7027. const m_DT_RPATH = 15
  7028. const m_DT_RUNPATH = 29
  7029. const m_DT_SONAME = 14
  7030. const m_DT_SPARC_NUM = 2
  7031. const m_DT_SPARC_REGISTER = 0x70000001
  7032. const m_DT_STRSZ = 10
  7033. const m_DT_STRTAB = 5
  7034. const m_DT_SYMBOLIC = 16
  7035. const m_DT_SYMENT = 11
  7036. const m_DT_SYMINENT = 0x6ffffdff
  7037. const m_DT_SYMINFO = 0x6ffffeff
  7038. const m_DT_SYMINSZ = 0x6ffffdfe
  7039. const m_DT_SYMTAB = 6
  7040. const m_DT_SYMTAB_SHNDX = 34
  7041. const m_DT_TEXTREL = 22
  7042. const m_DT_TLSDESC_GOT = 0x6ffffef7
  7043. const m_DT_TLSDESC_PLT = 0x6ffffef6
  7044. const m_DT_VALNUM = 12
  7045. const m_DT_VALRNGHI = 0x6ffffdff
  7046. const m_DT_VALRNGLO = 0x6ffffd00
  7047. const m_DT_VERDEF = 0x6ffffffc
  7048. const m_DT_VERDEFNUM = 0x6ffffffd
  7049. const m_DT_VERNEED = 0x6ffffffe
  7050. const m_DT_VERNEEDNUM = 0x6fffffff
  7051. const m_DT_VERSIONTAGNUM = 16
  7052. const m_DT_VERSYM = 0x6ffffff0
  7053. const m_EFA_PARISC_1_0 = 0x020b
  7054. const m_EFA_PARISC_1_1 = 0x0210
  7055. const m_EFA_PARISC_2_0 = 0x0214
  7056. const m_EF_ALPHA_32BIT = 1
  7057. const m_EF_ALPHA_CANRELAX = 2
  7058. const m_EF_ARM_ABI_FLOAT_HARD = 0x400
  7059. const m_EF_ARM_ABI_FLOAT_SOFT = 0x200
  7060. const m_EF_ARM_ALIGN8 = 0x40
  7061. const m_EF_ARM_APCS_26 = 0x08
  7062. const m_EF_ARM_APCS_FLOAT = 0x10
  7063. const m_EF_ARM_BE8 = 0x00800000
  7064. const m_EF_ARM_DYNSYMSUSESEGIDX = 0x08
  7065. const m_EF_ARM_EABIMASK = 0xFF000000
  7066. const m_EF_ARM_EABI_UNKNOWN = 0x00000000
  7067. const m_EF_ARM_EABI_VER1 = 0x01000000
  7068. const m_EF_ARM_EABI_VER2 = 0x02000000
  7069. const m_EF_ARM_EABI_VER3 = 0x03000000
  7070. const m_EF_ARM_EABI_VER4 = 0x04000000
  7071. const m_EF_ARM_EABI_VER5 = 0x05000000
  7072. const m_EF_ARM_HASENTRY = 0x02
  7073. const m_EF_ARM_INTERWORK = 0x04
  7074. const m_EF_ARM_LE8 = 0x00400000
  7075. const m_EF_ARM_MAPSYMSFIRST = 0x10
  7076. const m_EF_ARM_MAVERICK_FLOAT = 0x800
  7077. const m_EF_ARM_NEW_ABI = 0x80
  7078. const m_EF_ARM_OLD_ABI = 0x100
  7079. const m_EF_ARM_PIC = 0x20
  7080. const m_EF_ARM_RELEXEC = 0x01
  7081. const m_EF_ARM_SOFT_FLOAT = 0x200
  7082. const m_EF_ARM_SYMSARESORTED = 0x04
  7083. const m_EF_ARM_VFP_FLOAT = 0x400
  7084. const m_EF_CPU32 = 0x00810000
  7085. const m_EF_IA_64_ABI64 = 0x00000010
  7086. const m_EF_IA_64_ARCH = 0xff000000
  7087. const m_EF_IA_64_MASKOS = 0x0000000f
  7088. const m_EF_LARCH_ABI_DOUBLE_FLOAT = 0x03
  7089. const m_EF_LARCH_ABI_MODIFIER_MASK = 0x07
  7090. const m_EF_LARCH_ABI_SINGLE_FLOAT = 0x02
  7091. const m_EF_LARCH_ABI_SOFT_FLOAT = 0x01
  7092. const m_EF_LARCH_OBJABI_V1 = 0x40
  7093. const m_EF_MIPS_64BIT_WHIRL = 16
  7094. const m_EF_MIPS_ABI2 = 32
  7095. const m_EF_MIPS_ABI_ON32 = 64
  7096. const m_EF_MIPS_ARCH = 0xf0000000
  7097. const m_EF_MIPS_ARCH_1 = 0x00000000
  7098. const m_EF_MIPS_ARCH_2 = 0x10000000
  7099. const m_EF_MIPS_ARCH_3 = 0x20000000
  7100. const m_EF_MIPS_ARCH_32 = 0x50000000
  7101. const m_EF_MIPS_ARCH_32R2 = 0x70000000
  7102. const m_EF_MIPS_ARCH_4 = 0x30000000
  7103. const m_EF_MIPS_ARCH_5 = 0x40000000
  7104. const m_EF_MIPS_ARCH_64 = 0x60000000
  7105. const m_EF_MIPS_ARCH_64R2 = 0x80000000
  7106. const m_EF_MIPS_CPIC = 4
  7107. const m_EF_MIPS_FP64 = 512
  7108. const m_EF_MIPS_NAN2008 = 1024
  7109. const m_EF_MIPS_NOREORDER = 1
  7110. const m_EF_MIPS_PIC = 2
  7111. const m_EF_MIPS_XGOT = 8
  7112. const m_EF_PARISC_ARCH = 0x0000ffff
  7113. const m_EF_PARISC_EXT = 0x00020000
  7114. const m_EF_PARISC_LAZYSWAP = 0x00400000
  7115. const m_EF_PARISC_LSB = 0x00040000
  7116. const m_EF_PARISC_NO_KABP = 0x00100000
  7117. const m_EF_PARISC_TRAPNIL = 0x00010000
  7118. const m_EF_PARISC_WIDE = 0x00080000
  7119. const m_EF_PPC64_ABI = 3
  7120. const m_EF_PPC_EMB = 0x80000000
  7121. const m_EF_PPC_RELOCATABLE = 0x00010000
  7122. const m_EF_PPC_RELOCATABLE_LIB = 0x00008000
  7123. const m_EF_SH1 = 0x1
  7124. const m_EF_SH2 = 0x2
  7125. const m_EF_SH2A = 0xd
  7126. const m_EF_SH2A_NOFPU = 0x13
  7127. const m_EF_SH2A_SH3E = 0x18
  7128. const m_EF_SH2A_SH3_NOFPU = 0x16
  7129. const m_EF_SH2A_SH4 = 0x17
  7130. const m_EF_SH2A_SH4_NOFPU = 0x15
  7131. const m_EF_SH2E = 0xb
  7132. const m_EF_SH3 = 0x3
  7133. const m_EF_SH3E = 0x8
  7134. const m_EF_SH3_DSP = 0x5
  7135. const m_EF_SH3_NOMMU = 0x14
  7136. const m_EF_SH4 = 0x9
  7137. const m_EF_SH4A = 0xc
  7138. const m_EF_SH4AL_DSP = 0x6
  7139. const m_EF_SH4A_NOFPU = 0x11
  7140. const m_EF_SH4_NOFPU = 0x10
  7141. const m_EF_SH4_NOMMU_NOFPU = 0x12
  7142. const m_EF_SH_DSP = 0x4
  7143. const m_EF_SH_MACH_MASK = 0x1f
  7144. const m_EF_SH_UNKNOWN = 0x0
  7145. const m_EF_SPARCV9_MM = 3
  7146. const m_EF_SPARCV9_PSO = 1
  7147. const m_EF_SPARCV9_RMO = 2
  7148. const m_EF_SPARCV9_TSO = 0
  7149. const m_EF_SPARC_32PLUS = 0x000100
  7150. const m_EF_SPARC_EXT_MASK = 0xFFFF00
  7151. const m_EF_SPARC_HAL_R1 = 0x000400
  7152. const m_EF_SPARC_LEDATA = 0x800000
  7153. const m_EF_SPARC_SUN_US1 = 0x000200
  7154. const m_EF_SPARC_SUN_US3 = 0x000800
  7155. const m_EI_ABIVERSION = 8
  7156. const m_EI_CLASS = 4
  7157. const m_EI_DATA = 5
  7158. const m_EI_MAG0 = 0
  7159. const m_EI_MAG1 = 1
  7160. const m_EI_MAG2 = 2
  7161. const m_EI_MAG3 = 3
  7162. const m_EI_NIDENT = 16
  7163. const m_EI_OSABI = 7
  7164. const m_EI_PAD = 9
  7165. const m_EI_VERSION = 6
  7166. const m_ELFCLASS32 = 1
  7167. const m_ELFCLASS64 = 2
  7168. const m_ELFCLASSNONE = 0
  7169. const m_ELFCLASSNUM = 3
  7170. const m_ELFCOMPRESS_HIOS = 0x6fffffff
  7171. const m_ELFCOMPRESS_HIPROC = 0x7fffffff
  7172. const m_ELFCOMPRESS_LOOS = 0x60000000
  7173. const m_ELFCOMPRESS_LOPROC = 0x70000000
  7174. const m_ELFCOMPRESS_ZLIB = 1
  7175. const m_ELFCOMPRESS_ZSTD = 2
  7176. const m_ELFDATA2LSB = 1
  7177. const m_ELFDATA2MSB = 2
  7178. const m_ELFDATANONE = 0
  7179. const m_ELFDATANUM = 3
  7180. const m_ELFMAG = "\\177ELF"
  7181. const m_ELFMAG0 = 127
  7182. const m_ELFMAG1 = 69
  7183. const m_ELFMAG2 = 76
  7184. const m_ELFMAG3 = 70
  7185. const m_ELFOSABI_AIX = 7
  7186. const m_ELFOSABI_ARM = 97
  7187. const m_ELFOSABI_FREEBSD = 9
  7188. const m_ELFOSABI_GNU = 3
  7189. const m_ELFOSABI_HPUX = 1
  7190. const m_ELFOSABI_IRIX = 8
  7191. const m_ELFOSABI_LINUX = 3
  7192. const m_ELFOSABI_MODESTO = 11
  7193. const m_ELFOSABI_NETBSD = 2
  7194. const m_ELFOSABI_NONE = 0
  7195. const m_ELFOSABI_OPENBSD = 12
  7196. const m_ELFOSABI_SOLARIS = 6
  7197. const m_ELFOSABI_STANDALONE = 255
  7198. const m_ELFOSABI_SYSV = 0
  7199. const m_ELFOSABI_TRU64 = 10
  7200. const m_ELF_NOTE_ABI = "NT_GNU_ABI_TAG"
  7201. const m_ELF_NOTE_GNU = "GNU"
  7202. const m_ELF_NOTE_OS_FREEBSD = 3
  7203. const m_ELF_NOTE_OS_GNU = 1
  7204. const m_ELF_NOTE_OS_LINUX = 0
  7205. const m_ELF_NOTE_OS_SOLARIS2 = 2
  7206. const m_ELF_NOTE_PAGESIZE_HINT = 1
  7207. const m_ELF_NOTE_SOLARIS = "SUNW Solaris"
  7208. const m_ELF_ST_BIND = "ELF64_ST_BIND"
  7209. const m_ELF_ST_TYPE = "ELF64_ST_TYPE"
  7210. const m_ELF_TARG_CLASS = "ELFCLASS64"
  7211. const m_ELF_TARG_DATA = "ELFDATA2LSB"
  7212. const m_ELF_TARG_MACH = "EM_PPC64"
  7213. const m_ELF_TARG_VER = "EV_CURRENT"
  7214. const m_EM_386 = 3
  7215. const m_EM_56800EX = 200
  7216. const m_EM_68HC05 = 72
  7217. const m_EM_68HC08 = 71
  7218. const m_EM_68HC11 = 70
  7219. const m_EM_68HC12 = 53
  7220. const m_EM_68HC16 = 69
  7221. const m_EM_68K = 4
  7222. const m_EM_78KOR = 199
  7223. const m_EM_8051 = 165
  7224. const m_EM_860 = 7
  7225. const m_EM_88K = 5
  7226. const m_EM_960 = 19
  7227. const m_EM_AARCH64 = 183
  7228. const m_EM_ALPHA = 0x9026
  7229. const m_EM_ALTERA_NIOS2 = 113
  7230. const m_EM_AMDGPU = 224
  7231. const m_EM_ARC = 45
  7232. const m_EM_ARCA = 109
  7233. const m_EM_ARC_A5 = 93
  7234. const m_EM_ARC_COMPACT = 93
  7235. const m_EM_ARC_COMPACT2 = 195
  7236. const m_EM_ARM = 40
  7237. const m_EM_AVR = 83
  7238. const m_EM_AVR32 = 185
  7239. const m_EM_BA1 = 201
  7240. const m_EM_BA2 = 202
  7241. const m_EM_BLACKFIN = 106
  7242. const m_EM_BPF = 247
  7243. const m_EM_C166 = 116
  7244. const m_EM_CDP = 215
  7245. const m_EM_CE = 119
  7246. const m_EM_CLOUDSHIELD = 192
  7247. const m_EM_COGE = 216
  7248. const m_EM_COLDFIRE = 52
  7249. const m_EM_COOL = 217
  7250. const m_EM_COREA_1ST = 193
  7251. const m_EM_COREA_2ND = 194
  7252. const m_EM_CR = 103
  7253. const m_EM_CR16 = 177
  7254. const m_EM_CRAYNV2 = 172
  7255. const m_EM_CRIS = 76
  7256. const m_EM_CRX = 114
  7257. const m_EM_CSKY = 252
  7258. const m_EM_CSR_KALIMBA = 219
  7259. const m_EM_CUDA = 190
  7260. const m_EM_CYPRESS_M8C = 161
  7261. const m_EM_D10V = 85
  7262. const m_EM_D30V = 86
  7263. const m_EM_DSP24 = 136
  7264. const m_EM_DSPIC30F = 118
  7265. const m_EM_DXP = 112
  7266. const m_EM_ECOG16 = 176
  7267. const m_EM_ECOG1X = 168
  7268. const m_EM_ECOG2 = 134
  7269. const m_EM_EMX16 = 212
  7270. const m_EM_EMX8 = 213
  7271. const m_EM_ETPU = 178
  7272. const m_EM_EXCESS = 111
  7273. const m_EM_F2MC16 = 104
  7274. const m_EM_FAKE_ALPHA = 41
  7275. const m_EM_FIREPATH = 78
  7276. const m_EM_FR20 = 37
  7277. const m_EM_FR30 = 84
  7278. const m_EM_FT32 = 222
  7279. const m_EM_FX66 = 66
  7280. const m_EM_H8S = 48
  7281. const m_EM_H8_300 = 46
  7282. const m_EM_H8_300H = 47
  7283. const m_EM_H8_500 = 49
  7284. const m_EM_HUANY = 81
  7285. const m_EM_IA_64 = 50
  7286. const m_EM_IP2K = 101
  7287. const m_EM_JAVELIN = 77
  7288. const m_EM_K10M = 181
  7289. const m_EM_KM32 = 210
  7290. const m_EM_KMX32 = 211
  7291. const m_EM_KVARC = 214
  7292. const m_EM_L10M = 180
  7293. const m_EM_LATTICEMICO32 = 138
  7294. const m_EM_LOONGARCH = 258
  7295. const m_EM_M16C = 117
  7296. const m_EM_M32 = 1
  7297. const m_EM_M32C = 120
  7298. const m_EM_M32R = 88
  7299. const m_EM_MANIK = 171
  7300. const m_EM_MAX = 102
  7301. const m_EM_MAXQ30 = 169
  7302. const m_EM_MCHP_PIC = 204
  7303. const m_EM_MCST_ELBRUS = 175
  7304. const m_EM_ME16 = 59
  7305. const m_EM_METAG = 174
  7306. const m_EM_MICROBLAZE = 189
  7307. const m_EM_MIPS = 8
  7308. const m_EM_MIPS_RS3_LE = 10
  7309. const m_EM_MIPS_X = 51
  7310. const m_EM_MMA = 54
  7311. const m_EM_MMDSP_PLUS = 160
  7312. const m_EM_MMIX = 80
  7313. const m_EM_MN10200 = 90
  7314. const m_EM_MN10300 = 89
  7315. const m_EM_MOXIE = 223
  7316. const m_EM_MSP430 = 105
  7317. const m_EM_NCPU = 56
  7318. const m_EM_NDR1 = 57
  7319. const m_EM_NDS32 = 167
  7320. const m_EM_NONE = 0
  7321. const m_EM_NORC = 218
  7322. const m_EM_NS32K = 97
  7323. const m_EM_NUM = 259
  7324. const m_EM_OPEN8 = 196
  7325. const m_EM_OPENRISC = 92
  7326. const m_EM_OR1K = 92
  7327. const m_EM_PARISC = 15
  7328. const m_EM_PCP = 55
  7329. const m_EM_PDSP = 63
  7330. const m_EM_PJ = 91
  7331. const m_EM_PPC = 20
  7332. const m_EM_PPC64 = 21
  7333. const m_EM_PRISM = 82
  7334. const m_EM_QDSP6 = 164
  7335. const m_EM_R32C = 162
  7336. const m_EM_RCE = 39
  7337. const m_EM_RH32 = 38
  7338. const m_EM_RISCV = 243
  7339. const m_EM_RL78 = 197
  7340. const m_EM_RS08 = 132
  7341. const m_EM_RX = 173
  7342. const m_EM_S370 = 9
  7343. const m_EM_S390 = 22
  7344. const m_EM_SCORE7 = 135
  7345. const m_EM_SEP = 108
  7346. const m_EM_SE_C17 = 139
  7347. const m_EM_SE_C33 = 107
  7348. const m_EM_SH = 42
  7349. const m_EM_SHARC = 133
  7350. const m_EM_SLE9X = 179
  7351. const m_EM_SNP1K = 99
  7352. const m_EM_SPARC = 2
  7353. const m_EM_SPARC32PLUS = 18
  7354. const m_EM_SPARCV9 = 43
  7355. const m_EM_ST100 = 60
  7356. const m_EM_ST19 = 74
  7357. const m_EM_ST200 = 100
  7358. const m_EM_ST7 = 68
  7359. const m_EM_ST9PLUS = 67
  7360. const m_EM_STARCORE = 58
  7361. const m_EM_STM8 = 186
  7362. const m_EM_STXP7X = 166
  7363. const m_EM_SVX = 73
  7364. const m_EM_TILE64 = 187
  7365. const m_EM_TILEGX = 191
  7366. const m_EM_TILEPRO = 188
  7367. const m_EM_TINYJ = 61
  7368. const m_EM_TI_ARP32 = 143
  7369. const m_EM_TI_C2000 = 141
  7370. const m_EM_TI_C5500 = 142
  7371. const m_EM_TI_C6000 = 140
  7372. const m_EM_TI_PRU = 144
  7373. const m_EM_TMM_GPP = 96
  7374. const m_EM_TPC = 98
  7375. const m_EM_TRICORE = 44
  7376. const m_EM_TRIMEDIA = 163
  7377. const m_EM_TSK3000 = 131
  7378. const m_EM_UNICORE = 110
  7379. const m_EM_V800 = 36
  7380. const m_EM_V850 = 87
  7381. const m_EM_VAX = 75
  7382. const m_EM_VIDEOCORE = 95
  7383. const m_EM_VIDEOCORE3 = 137
  7384. const m_EM_VIDEOCORE5 = 198
  7385. const m_EM_VISIUM = 221
  7386. const m_EM_VPP500 = 17
  7387. const m_EM_X86_64 = 62
  7388. const m_EM_XCORE = 203
  7389. const m_EM_XGATE = 115
  7390. const m_EM_XIMO16 = 170
  7391. const m_EM_XTENSA = 94
  7392. const m_EM_Z80 = 220
  7393. const m_EM_ZSP = 79
  7394. const m_ET_CORE = 4
  7395. const m_ET_DYN = 3
  7396. const m_ET_EXEC = 2
  7397. const m_ET_HIOS = 0xfeff
  7398. const m_ET_HIPROC = 0xffff
  7399. const m_ET_LOOS = 0xfe00
  7400. const m_ET_LOPROC = 0xff00
  7401. const m_ET_NONE = 0
  7402. const m_ET_NUM = 5
  7403. const m_ET_REL = 1
  7404. const m_EV_CURRENT = 1
  7405. const m_EV_NONE = 0
  7406. const m_EV_NUM = 2
  7407. const m_E_MIPS_ARCH_1 = 0x00000000
  7408. const m_E_MIPS_ARCH_2 = 0x10000000
  7409. const m_E_MIPS_ARCH_3 = 0x20000000
  7410. const m_E_MIPS_ARCH_32 = 0x50000000
  7411. const m_E_MIPS_ARCH_4 = 0x30000000
  7412. const m_E_MIPS_ARCH_5 = 0x40000000
  7413. const m_E_MIPS_ARCH_64 = 0x60000000
  7414. const m_Elf_Ehdr = "Elf64_Ehdr"
  7415. const m_Elf_Off = "Elf64_Off"
  7416. const m_Elf_Shdr = "Elf64_Shdr"
  7417. const m_Elf_Sword = "Elf64_Sword"
  7418. const m_Elf_Sym = "Elf64_Sym"
  7419. const m_Elf_Word = "Elf64_Word"
  7420. const m_GRP_COMDAT = 0x1
  7421. const m_LITUSE_ALPHA_ADDR = 0
  7422. const m_LITUSE_ALPHA_BASE = 1
  7423. const m_LITUSE_ALPHA_BYTOFF = 2
  7424. const m_LITUSE_ALPHA_JSR = 3
  7425. const m_LITUSE_ALPHA_TLS_GD = 4
  7426. const m_LITUSE_ALPHA_TLS_LDM = 5
  7427. const m_LL_NONE = 0
  7428. const m_MAP_ANON1 = 0x20
  7429. const m_MAP_PRIVATE1 = 0x02
  7430. const m_MIPS_AFL_ASE_DSP = 0x00000001
  7431. const m_MIPS_AFL_ASE_DSPR2 = 0x00000002
  7432. const m_MIPS_AFL_ASE_EVA = 0x00000004
  7433. const m_MIPS_AFL_ASE_MASK = 0x00001fff
  7434. const m_MIPS_AFL_ASE_MCU = 0x00000008
  7435. const m_MIPS_AFL_ASE_MDMX = 0x00000010
  7436. const m_MIPS_AFL_ASE_MICROMIPS = 0x00000800
  7437. const m_MIPS_AFL_ASE_MIPS16 = 0x00000400
  7438. const m_MIPS_AFL_ASE_MIPS3D = 0x00000020
  7439. const m_MIPS_AFL_ASE_MSA = 0x00000200
  7440. const m_MIPS_AFL_ASE_MT = 0x00000040
  7441. const m_MIPS_AFL_ASE_SMARTMIPS = 0x00000080
  7442. const m_MIPS_AFL_ASE_VIRT = 0x00000100
  7443. const m_MIPS_AFL_ASE_XPA = 0x00001000
  7444. const m_MIPS_AFL_EXT_10000 = 11
  7445. const m_MIPS_AFL_EXT_3900 = 10
  7446. const m_MIPS_AFL_EXT_4010 = 8
  7447. const m_MIPS_AFL_EXT_4100 = 9
  7448. const m_MIPS_AFL_EXT_4111 = 13
  7449. const m_MIPS_AFL_EXT_4120 = 14
  7450. const m_MIPS_AFL_EXT_4650 = 7
  7451. const m_MIPS_AFL_EXT_5400 = 15
  7452. const m_MIPS_AFL_EXT_5500 = 16
  7453. const m_MIPS_AFL_EXT_5900 = 6
  7454. const m_MIPS_AFL_EXT_LOONGSON_2E = 17
  7455. const m_MIPS_AFL_EXT_LOONGSON_2F = 18
  7456. const m_MIPS_AFL_EXT_LOONGSON_3A = 4
  7457. const m_MIPS_AFL_EXT_OCTEON = 5
  7458. const m_MIPS_AFL_EXT_OCTEON2 = 2
  7459. const m_MIPS_AFL_EXT_OCTEONP = 3
  7460. const m_MIPS_AFL_EXT_SB1 = 12
  7461. const m_MIPS_AFL_EXT_XLR = 1
  7462. const m_MIPS_AFL_FLAGS1_ODDSPREG = 1
  7463. const m_MIPS_AFL_REG_128 = 0x03
  7464. const m_MIPS_AFL_REG_32 = 0x01
  7465. const m_MIPS_AFL_REG_64 = 0x02
  7466. const m_MIPS_AFL_REG_NONE = 0x00
  7467. const m_NT_386_IOPERM = 0x201
  7468. const m_NT_386_TLS = 0x200
  7469. const m_NT_ARC_V2 = 0x600
  7470. const m_NT_ARM_HW_BREAK = 0x402
  7471. const m_NT_ARM_HW_WATCH = 0x403
  7472. const m_NT_ARM_PACA_KEYS = 0x407
  7473. const m_NT_ARM_PACG_KEYS = 0x408
  7474. const m_NT_ARM_PAC_ENABLED_KEYS = 0x40a
  7475. const m_NT_ARM_PAC_MASK = 0x406
  7476. const m_NT_ARM_SVE = 0x405
  7477. const m_NT_ARM_SYSTEM_CALL = 0x404
  7478. const m_NT_ARM_TAGGED_ADDR_CTRL = 0x409
  7479. const m_NT_ARM_TLS = 0x401
  7480. const m_NT_ARM_VFP = 0x400
  7481. const m_NT_ASRS = 8
  7482. const m_NT_AUXV = 6
  7483. const m_NT_FILE = 0x46494c45
  7484. const m_NT_FPREGSET = 2
  7485. const m_NT_GNU_ABI_TAG = 1
  7486. const m_NT_GNU_BUILD_ID = 3
  7487. const m_NT_GNU_GOLD_VERSION = 4
  7488. const m_NT_GNU_PROPERTY_TYPE_0 = 5
  7489. const m_NT_GWINDOWS = 7
  7490. const m_NT_LOONGARCH_CPUCFG = 0xa00
  7491. const m_NT_LOONGARCH_CSR = 0xa01
  7492. const m_NT_LOONGARCH_LASX = 0xa03
  7493. const m_NT_LOONGARCH_LBT = 0xa04
  7494. const m_NT_LOONGARCH_LSX = 0xa02
  7495. const m_NT_LWPSINFO = 17
  7496. const m_NT_LWPSTATUS = 16
  7497. const m_NT_METAG_CBUF = 0x500
  7498. const m_NT_METAG_RPIPE = 0x501
  7499. const m_NT_METAG_TLS = 0x502
  7500. const m_NT_MIPS_DSP = 0x800
  7501. const m_NT_MIPS_FP_MODE = 0x801
  7502. const m_NT_MIPS_MSA = 0x802
  7503. const m_NT_PLATFORM = 5
  7504. const m_NT_PPC_DSCR = 0x105
  7505. const m_NT_PPC_EBB = 0x106
  7506. const m_NT_PPC_PMU = 0x107
  7507. const m_NT_PPC_PPR = 0x104
  7508. const m_NT_PPC_SPE = 0x101
  7509. const m_NT_PPC_TAR = 0x103
  7510. const m_NT_PPC_TM_CDSCR = 0x10f
  7511. const m_NT_PPC_TM_CFPR = 0x109
  7512. const m_NT_PPC_TM_CGPR = 0x108
  7513. const m_NT_PPC_TM_CPPR = 0x10e
  7514. const m_NT_PPC_TM_CTAR = 0x10d
  7515. const m_NT_PPC_TM_CVMX = 0x10a
  7516. const m_NT_PPC_TM_CVSX = 0x10b
  7517. const m_NT_PPC_TM_SPR = 0x10c
  7518. const m_NT_PPC_VMX = 0x100
  7519. const m_NT_PPC_VSX = 0x102
  7520. const m_NT_PRCRED = 14
  7521. const m_NT_PRFPREG = 2
  7522. const m_NT_PRFPXREG = 20
  7523. const m_NT_PRPSINFO = 3
  7524. const m_NT_PRSTATUS = 1
  7525. const m_NT_PRXFPREG = 0x46e62b7f
  7526. const m_NT_PRXREG = 4
  7527. const m_NT_PSINFO = 13
  7528. const m_NT_PSTATUS = 10
  7529. const m_NT_RISCV_CSR = 0x900
  7530. const m_NT_RISCV_VECTOR = 0x901
  7531. const m_NT_S390_CTRS = 0x304
  7532. const m_NT_S390_GS_BC = 0x30c
  7533. const m_NT_S390_GS_CB = 0x30b
  7534. const m_NT_S390_HIGH_GPRS = 0x300
  7535. const m_NT_S390_LAST_BREAK = 0x306
  7536. const m_NT_S390_PREFIX = 0x305
  7537. const m_NT_S390_RI_CB = 0x30d
  7538. const m_NT_S390_SYSTEM_CALL = 0x307
  7539. const m_NT_S390_TDB = 0x308
  7540. const m_NT_S390_TIMER = 0x301
  7541. const m_NT_S390_TODCMP = 0x302
  7542. const m_NT_S390_TODPREG = 0x303
  7543. const m_NT_S390_VXRS_HIGH = 0x30a
  7544. const m_NT_S390_VXRS_LOW = 0x309
  7545. const m_NT_SIGINFO = 0x53494749
  7546. const m_NT_TASKSTRUCT = 4
  7547. const m_NT_UTSNAME = 15
  7548. const m_NT_VERSION = 1
  7549. const m_NT_VMCOREDD = 0x700
  7550. const m_NT_X86_XSTATE = 0x202
  7551. const m_N_ABS = 2
  7552. const m_N_BSS = 8
  7553. const m_N_COMM = 0x12
  7554. const m_N_DATA = 6
  7555. const m_N_EXT = 1
  7556. const m_N_FN = 30
  7557. const m_N_FORMAT = "%08x"
  7558. const m_N_INDR = 0x0a
  7559. const m_N_SETA = 0x14
  7560. const m_N_SETB = 0x1a
  7561. const m_N_SETD = 0x18
  7562. const m_N_SETT = 0x16
  7563. const m_N_SETV = 0x1c
  7564. const m_N_SIZE = 0x0c
  7565. const m_N_STAB = 0xe0
  7566. const m_N_TEXT = 4
  7567. const m_N_TYPE = 0x1e
  7568. const m_N_UNDF = 0
  7569. const m_N_WARN = 0x1e
  7570. const m_ODK_EXCEPTIONS = 2
  7571. const m_ODK_FILL = 5
  7572. const m_ODK_HWAND = 7
  7573. const m_ODK_HWOR = 8
  7574. const m_ODK_HWPATCH = 4
  7575. const m_ODK_NULL = 0
  7576. const m_ODK_PAD = 3
  7577. const m_ODK_REGINFO = 1
  7578. const m_ODK_TAGS = 6
  7579. const m_OEX_DISMISS = 0x80000
  7580. const m_OEX_FPDBUG = 0x40000
  7581. const m_OEX_FPU_DIV0 = 0x08
  7582. const m_OEX_FPU_INEX = 0x01
  7583. const m_OEX_FPU_INVAL = 0x10
  7584. const m_OEX_FPU_MAX = 0x1f00
  7585. const m_OEX_FPU_MIN = 0x1f
  7586. const m_OEX_FPU_OFLO = 0x04
  7587. const m_OEX_FPU_UFLO = 0x02
  7588. const m_OEX_PAGE0 = 0x10000
  7589. const m_OEX_PRECISEFP = "OEX_FPDBUG"
  7590. const m_OEX_SMM = 0x20000
  7591. const m_OHWA0_R4KEOP_CHECKED = 0x00000001
  7592. const m_OHWA1_R4KEOP_CLEAN = 0x00000002
  7593. const m_OHW_R4KEOP = 0x1
  7594. const m_OHW_R5KCVTL = 0x8
  7595. const m_OHW_R5KEOP = 0x4
  7596. const m_OHW_R8KPFETCH = 0x2
  7597. const m_OPAD_POSTFIX = 0x2
  7598. const m_OPAD_PREFIX = 0x1
  7599. const m_OPAD_SYMBOL = 0x4
  7600. const m_O_CREAT2 = 0100
  7601. const m_O_NONBLOCK2 = 04000
  7602. const m_O_RDONLY1 = 0
  7603. const m_O_TRUNC2 = 01000
  7604. const m_PF_ARM_ABS = 0x40000000
  7605. const m_PF_ARM_PI = 0x20000000
  7606. const m_PF_ARM_SB = 0x10000000
  7607. const m_PF_HP_CODE = 0x01000000
  7608. const m_PF_HP_FAR_SHARED = 0x00200000
  7609. const m_PF_HP_LAZYSWAP = 0x04000000
  7610. const m_PF_HP_MODIFY = 0x02000000
  7611. const m_PF_HP_NEAR_SHARED = 0x00400000
  7612. const m_PF_HP_PAGE_SIZE = 0x00100000
  7613. const m_PF_HP_SBP = 0x08000000
  7614. const m_PF_IA_64_NORECOV = 0x80000000
  7615. const m_PF_MASKOS = 0x0ff00000
  7616. const m_PF_MASKPROC = 0xf0000000
  7617. const m_PF_MIPS_LOCAL = 0x10000000
  7618. const m_PF_PARISC_SBP = 0x08000000
  7619. const m_PN_XNUM = 0xffff
  7620. const m_PPC64_OPT_LOCALENTRY = 4
  7621. const m_PPC64_OPT_MULTI_TOC = 2
  7622. const m_PPC64_OPT_TLS = 1
  7623. const m_PPC_OPT_TLS = 1
  7624. const m_PT_DYNAMIC = 2
  7625. const m_PT_GNU_EH_FRAME = 0x6474e550
  7626. const m_PT_GNU_PROPERTY = 0x6474e553
  7627. const m_PT_GNU_RELRO = 0x6474e552
  7628. const m_PT_GNU_STACK = 0x6474e551
  7629. const m_PT_HIOS = 0x6fffffff
  7630. const m_PT_HIPROC = 0x7fffffff
  7631. const m_PT_HISUNW = 0x6fffffff
  7632. const m_PT_INTERP = 3
  7633. const m_PT_LOAD = 1
  7634. const m_PT_LOOS = 0x60000000
  7635. const m_PT_LOPROC = 0x70000000
  7636. const m_PT_LOSUNW = 0x6ffffffa
  7637. const m_PT_MIPS_ABIFLAGS = 0x70000003
  7638. const m_PT_MIPS_OPTIONS = 0x70000002
  7639. const m_PT_MIPS_REGINFO = 0x70000000
  7640. const m_PT_MIPS_RTPROC = 0x70000001
  7641. const m_PT_NOTE = 4
  7642. const m_PT_NULL = 0
  7643. const m_PT_NUM = 8
  7644. const m_PT_PARISC_ARCHEXT = 0x70000000
  7645. const m_PT_PARISC_UNWIND = 0x70000001
  7646. const m_PT_PHDR = 6
  7647. const m_PT_SHLIB = 5
  7648. const m_PT_SUNWBSS = 0x6ffffffa
  7649. const m_PT_SUNWSTACK = 0x6ffffffb
  7650. const m_PT_TLS = 7
  7651. const m_RHF_NONE = 0
  7652. const m_R_386_16 = 20
  7653. const m_R_386_32 = 1
  7654. const m_R_386_32PLT = 11
  7655. const m_R_386_8 = 22
  7656. const m_R_386_COPY = 5
  7657. const m_R_386_GLOB_DAT = 6
  7658. const m_R_386_GOT32 = 3
  7659. const m_R_386_GOT32X = 43
  7660. const m_R_386_GOTOFF = 9
  7661. const m_R_386_GOTPC = 10
  7662. const m_R_386_IRELATIVE = 42
  7663. const m_R_386_JMP_SLOT = 7
  7664. const m_R_386_NONE = 0
  7665. const m_R_386_NUM = 44
  7666. const m_R_386_PC16 = 21
  7667. const m_R_386_PC32 = 2
  7668. const m_R_386_PC8 = 23
  7669. const m_R_386_PLT32 = 4
  7670. const m_R_386_RELATIVE = 8
  7671. const m_R_386_SIZE32 = 38
  7672. const m_R_386_TLS_DESC = 41
  7673. const m_R_386_TLS_DESC_CALL = 40
  7674. const m_R_386_TLS_DTPMOD32 = 35
  7675. const m_R_386_TLS_DTPOFF32 = 36
  7676. const m_R_386_TLS_GD = 18
  7677. const m_R_386_TLS_GD_32 = 24
  7678. const m_R_386_TLS_GD_CALL = 26
  7679. const m_R_386_TLS_GD_POP = 27
  7680. const m_R_386_TLS_GD_PUSH = 25
  7681. const m_R_386_TLS_GOTDESC = 39
  7682. const m_R_386_TLS_GOTIE = 16
  7683. const m_R_386_TLS_IE = 15
  7684. const m_R_386_TLS_IE_32 = 33
  7685. const m_R_386_TLS_LDM = 19
  7686. const m_R_386_TLS_LDM_32 = 28
  7687. const m_R_386_TLS_LDM_CALL = 30
  7688. const m_R_386_TLS_LDM_POP = 31
  7689. const m_R_386_TLS_LDM_PUSH = 29
  7690. const m_R_386_TLS_LDO_32 = 32
  7691. const m_R_386_TLS_LE = 17
  7692. const m_R_386_TLS_LE_32 = 34
  7693. const m_R_386_TLS_TPOFF = 14
  7694. const m_R_386_TLS_TPOFF32 = 37
  7695. const m_R_390_12 = 2
  7696. const m_R_390_16 = 3
  7697. const m_R_390_20 = 57
  7698. const m_R_390_32 = 4
  7699. const m_R_390_64 = 22
  7700. const m_R_390_8 = 1
  7701. const m_R_390_COPY = 9
  7702. const m_R_390_GLOB_DAT = 10
  7703. const m_R_390_GOT12 = 6
  7704. const m_R_390_GOT16 = 15
  7705. const m_R_390_GOT20 = 58
  7706. const m_R_390_GOT32 = 7
  7707. const m_R_390_GOT64 = 24
  7708. const m_R_390_GOTENT = 26
  7709. const m_R_390_GOTOFF16 = 27
  7710. const m_R_390_GOTOFF32 = 13
  7711. const m_R_390_GOTOFF64 = 28
  7712. const m_R_390_GOTPC = 14
  7713. const m_R_390_GOTPCDBL = 21
  7714. const m_R_390_GOTPLT12 = 29
  7715. const m_R_390_GOTPLT16 = 30
  7716. const m_R_390_GOTPLT20 = 59
  7717. const m_R_390_GOTPLT32 = 31
  7718. const m_R_390_GOTPLT64 = 32
  7719. const m_R_390_GOTPLTENT = 33
  7720. const m_R_390_JMP_SLOT = 11
  7721. const m_R_390_NONE = 0
  7722. const m_R_390_NUM = 61
  7723. const m_R_390_PC16 = 16
  7724. const m_R_390_PC16DBL = 17
  7725. const m_R_390_PC32 = 5
  7726. const m_R_390_PC32DBL = 19
  7727. const m_R_390_PC64 = 23
  7728. const m_R_390_PLT16DBL = 18
  7729. const m_R_390_PLT32 = 8
  7730. const m_R_390_PLT32DBL = 20
  7731. const m_R_390_PLT64 = 25
  7732. const m_R_390_PLTOFF16 = 34
  7733. const m_R_390_PLTOFF32 = 35
  7734. const m_R_390_PLTOFF64 = 36
  7735. const m_R_390_RELATIVE = 12
  7736. const m_R_390_TLS_DTPMOD = 54
  7737. const m_R_390_TLS_DTPOFF = 55
  7738. const m_R_390_TLS_GD32 = 40
  7739. const m_R_390_TLS_GD64 = 41
  7740. const m_R_390_TLS_GDCALL = 38
  7741. const m_R_390_TLS_GOTIE12 = 42
  7742. const m_R_390_TLS_GOTIE20 = 60
  7743. const m_R_390_TLS_GOTIE32 = 43
  7744. const m_R_390_TLS_GOTIE64 = 44
  7745. const m_R_390_TLS_IE32 = 47
  7746. const m_R_390_TLS_IE64 = 48
  7747. const m_R_390_TLS_IEENT = 49
  7748. const m_R_390_TLS_LDCALL = 39
  7749. const m_R_390_TLS_LDM32 = 45
  7750. const m_R_390_TLS_LDM64 = 46
  7751. const m_R_390_TLS_LDO32 = 52
  7752. const m_R_390_TLS_LDO64 = 53
  7753. const m_R_390_TLS_LE32 = 50
  7754. const m_R_390_TLS_LE64 = 51
  7755. const m_R_390_TLS_LOAD = 37
  7756. const m_R_390_TLS_TPOFF = 56
  7757. const m_R_68K_16 = 2
  7758. const m_R_68K_32 = 1
  7759. const m_R_68K_8 = 3
  7760. const m_R_68K_COPY = 19
  7761. const m_R_68K_GLOB_DAT = 20
  7762. const m_R_68K_GOT16 = 8
  7763. const m_R_68K_GOT16O = 11
  7764. const m_R_68K_GOT32 = 7
  7765. const m_R_68K_GOT32O = 10
  7766. const m_R_68K_GOT8 = 9
  7767. const m_R_68K_GOT8O = 12
  7768. const m_R_68K_JMP_SLOT = 21
  7769. const m_R_68K_NONE = 0
  7770. const m_R_68K_NUM = 43
  7771. const m_R_68K_PC16 = 5
  7772. const m_R_68K_PC32 = 4
  7773. const m_R_68K_PC8 = 6
  7774. const m_R_68K_PLT16 = 14
  7775. const m_R_68K_PLT16O = 17
  7776. const m_R_68K_PLT32 = 13
  7777. const m_R_68K_PLT32O = 16
  7778. const m_R_68K_PLT8 = 15
  7779. const m_R_68K_PLT8O = 18
  7780. const m_R_68K_RELATIVE = 22
  7781. const m_R_68K_TLS_DTPMOD32 = 40
  7782. const m_R_68K_TLS_DTPREL32 = 41
  7783. const m_R_68K_TLS_GD16 = 26
  7784. const m_R_68K_TLS_GD32 = 25
  7785. const m_R_68K_TLS_GD8 = 27
  7786. const m_R_68K_TLS_IE16 = 35
  7787. const m_R_68K_TLS_IE32 = 34
  7788. const m_R_68K_TLS_IE8 = 36
  7789. const m_R_68K_TLS_LDM16 = 29
  7790. const m_R_68K_TLS_LDM32 = 28
  7791. const m_R_68K_TLS_LDM8 = 30
  7792. const m_R_68K_TLS_LDO16 = 32
  7793. const m_R_68K_TLS_LDO32 = 31
  7794. const m_R_68K_TLS_LDO8 = 33
  7795. const m_R_68K_TLS_LE16 = 38
  7796. const m_R_68K_TLS_LE32 = 37
  7797. const m_R_68K_TLS_LE8 = 39
  7798. const m_R_68K_TLS_TPREL32 = 42
  7799. const m_R_AARCH64_ABS16 = 259
  7800. const m_R_AARCH64_ABS32 = 258
  7801. const m_R_AARCH64_ABS64 = 257
  7802. const m_R_AARCH64_ADD_ABS_LO12_NC = 277
  7803. const m_R_AARCH64_ADR_GOT_PAGE = 311
  7804. const m_R_AARCH64_ADR_PREL_LO21 = 274
  7805. const m_R_AARCH64_ADR_PREL_PG_HI21 = 275
  7806. const m_R_AARCH64_ADR_PREL_PG_HI21_NC = 276
  7807. const m_R_AARCH64_CALL26 = 283
  7808. const m_R_AARCH64_CONDBR19 = 280
  7809. const m_R_AARCH64_COPY = 1024
  7810. const m_R_AARCH64_GLOB_DAT = 1025
  7811. const m_R_AARCH64_GOTREL32 = 308
  7812. const m_R_AARCH64_GOTREL64 = 307
  7813. const m_R_AARCH64_GOT_LD_PREL19 = 309
  7814. const m_R_AARCH64_JUMP26 = 282
  7815. const m_R_AARCH64_JUMP_SLOT = 1026
  7816. const m_R_AARCH64_LD64_GOTOFF_LO15 = 310
  7817. const m_R_AARCH64_LD64_GOTPAGE_LO15 = 313
  7818. const m_R_AARCH64_LD64_GOT_LO12_NC = 312
  7819. const m_R_AARCH64_LDST128_ABS_LO12_NC = 299
  7820. const m_R_AARCH64_LDST16_ABS_LO12_NC = 284
  7821. const m_R_AARCH64_LDST32_ABS_LO12_NC = 285
  7822. const m_R_AARCH64_LDST64_ABS_LO12_NC = 286
  7823. const m_R_AARCH64_LDST8_ABS_LO12_NC = 278
  7824. const m_R_AARCH64_LD_PREL_LO19 = 273
  7825. const m_R_AARCH64_MOVW_GOTOFF_G0 = 300
  7826. const m_R_AARCH64_MOVW_GOTOFF_G0_NC = 301
  7827. const m_R_AARCH64_MOVW_GOTOFF_G1 = 302
  7828. const m_R_AARCH64_MOVW_GOTOFF_G1_NC = 303
  7829. const m_R_AARCH64_MOVW_GOTOFF_G2 = 304
  7830. const m_R_AARCH64_MOVW_GOTOFF_G2_NC = 305
  7831. const m_R_AARCH64_MOVW_GOTOFF_G3 = 306
  7832. const m_R_AARCH64_MOVW_PREL_G0 = 287
  7833. const m_R_AARCH64_MOVW_PREL_G0_NC = 288
  7834. const m_R_AARCH64_MOVW_PREL_G1 = 289
  7835. const m_R_AARCH64_MOVW_PREL_G1_NC = 290
  7836. const m_R_AARCH64_MOVW_PREL_G2 = 291
  7837. const m_R_AARCH64_MOVW_PREL_G2_NC = 292
  7838. const m_R_AARCH64_MOVW_PREL_G3 = 293
  7839. const m_R_AARCH64_MOVW_SABS_G0 = 270
  7840. const m_R_AARCH64_MOVW_SABS_G1 = 271
  7841. const m_R_AARCH64_MOVW_SABS_G2 = 272
  7842. const m_R_AARCH64_MOVW_UABS_G0 = 263
  7843. const m_R_AARCH64_MOVW_UABS_G0_NC = 264
  7844. const m_R_AARCH64_MOVW_UABS_G1 = 265
  7845. const m_R_AARCH64_MOVW_UABS_G1_NC = 266
  7846. const m_R_AARCH64_MOVW_UABS_G2 = 267
  7847. const m_R_AARCH64_MOVW_UABS_G2_NC = 268
  7848. const m_R_AARCH64_MOVW_UABS_G3 = 269
  7849. const m_R_AARCH64_NONE = 0
  7850. const m_R_AARCH64_P32_ABS32 = 1
  7851. const m_R_AARCH64_P32_COPY = 180
  7852. const m_R_AARCH64_P32_GLOB_DAT = 181
  7853. const m_R_AARCH64_P32_IRELATIVE = 188
  7854. const m_R_AARCH64_P32_JUMP_SLOT = 182
  7855. const m_R_AARCH64_P32_RELATIVE = 183
  7856. const m_R_AARCH64_P32_TLSDESC = 187
  7857. const m_R_AARCH64_P32_TLS_DTPMOD = 184
  7858. const m_R_AARCH64_P32_TLS_DTPREL = 185
  7859. const m_R_AARCH64_P32_TLS_TPREL = 186
  7860. const m_R_AARCH64_PREL16 = 262
  7861. const m_R_AARCH64_PREL32 = 261
  7862. const m_R_AARCH64_PREL64 = 260
  7863. const m_R_AARCH64_RELATIVE = 1027
  7864. const m_R_AARCH64_TLSDESC = 1031
  7865. const m_R_AARCH64_TLSDESC_ADD = 568
  7866. const m_R_AARCH64_TLSDESC_ADD_LO12 = 564
  7867. const m_R_AARCH64_TLSDESC_ADR_PAGE21 = 562
  7868. const m_R_AARCH64_TLSDESC_ADR_PREL21 = 561
  7869. const m_R_AARCH64_TLSDESC_CALL = 569
  7870. const m_R_AARCH64_TLSDESC_LD64_LO12 = 563
  7871. const m_R_AARCH64_TLSDESC_LDR = 567
  7872. const m_R_AARCH64_TLSDESC_LD_PREL19 = 560
  7873. const m_R_AARCH64_TLSDESC_OFF_G0_NC = 566
  7874. const m_R_AARCH64_TLSDESC_OFF_G1 = 565
  7875. const m_R_AARCH64_TLSGD_ADD_LO12_NC = 514
  7876. const m_R_AARCH64_TLSGD_ADR_PAGE21 = 513
  7877. const m_R_AARCH64_TLSGD_ADR_PREL21 = 512
  7878. const m_R_AARCH64_TLSGD_MOVW_G0_NC = 516
  7879. const m_R_AARCH64_TLSGD_MOVW_G1 = 515
  7880. const m_R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 = 541
  7881. const m_R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC = 542
  7882. const m_R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 = 543
  7883. const m_R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC = 540
  7884. const m_R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 = 539
  7885. const m_R_AARCH64_TLSLD_ADD_DTPREL_HI12 = 528
  7886. const m_R_AARCH64_TLSLD_ADD_DTPREL_LO12 = 529
  7887. const m_R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC = 530
  7888. const m_R_AARCH64_TLSLD_ADD_LO12_NC = 519
  7889. const m_R_AARCH64_TLSLD_ADR_PAGE21 = 518
  7890. const m_R_AARCH64_TLSLD_ADR_PREL21 = 517
  7891. const m_R_AARCH64_TLSLD_LDST128_DTPREL_LO12 = 572
  7892. const m_R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC = 573
  7893. const m_R_AARCH64_TLSLD_LDST16_DTPREL_LO12 = 533
  7894. const m_R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC = 534
  7895. const m_R_AARCH64_TLSLD_LDST32_DTPREL_LO12 = 535
  7896. const m_R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC = 536
  7897. const m_R_AARCH64_TLSLD_LDST64_DTPREL_LO12 = 537
  7898. const m_R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC = 538
  7899. const m_R_AARCH64_TLSLD_LDST8_DTPREL_LO12 = 531
  7900. const m_R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC = 532
  7901. const m_R_AARCH64_TLSLD_LD_PREL19 = 522
  7902. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G0 = 526
  7903. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC = 527
  7904. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G1 = 524
  7905. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC = 525
  7906. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G2 = 523
  7907. const m_R_AARCH64_TLSLD_MOVW_G0_NC = 521
  7908. const m_R_AARCH64_TLSLD_MOVW_G1 = 520
  7909. const m_R_AARCH64_TLSLE_ADD_TPREL_HI12 = 549
  7910. const m_R_AARCH64_TLSLE_ADD_TPREL_LO12 = 550
  7911. const m_R_AARCH64_TLSLE_ADD_TPREL_LO12_NC = 551
  7912. const m_R_AARCH64_TLSLE_LDST128_TPREL_LO12 = 570
  7913. const m_R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC = 571
  7914. const m_R_AARCH64_TLSLE_LDST16_TPREL_LO12 = 554
  7915. const m_R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC = 555
  7916. const m_R_AARCH64_TLSLE_LDST32_TPREL_LO12 = 556
  7917. const m_R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC = 557
  7918. const m_R_AARCH64_TLSLE_LDST64_TPREL_LO12 = 558
  7919. const m_R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC = 559
  7920. const m_R_AARCH64_TLSLE_LDST8_TPREL_LO12 = 552
  7921. const m_R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC = 553
  7922. const m_R_AARCH64_TLSLE_MOVW_TPREL_G0 = 547
  7923. const m_R_AARCH64_TLSLE_MOVW_TPREL_G0_NC = 548
  7924. const m_R_AARCH64_TLSLE_MOVW_TPREL_G1 = 545
  7925. const m_R_AARCH64_TLSLE_MOVW_TPREL_G1_NC = 546
  7926. const m_R_AARCH64_TLSLE_MOVW_TPREL_G2 = 544
  7927. const m_R_AARCH64_TLS_DTPMOD = 1028
  7928. const m_R_AARCH64_TLS_DTPMOD64 = 1028
  7929. const m_R_AARCH64_TLS_DTPREL = 1029
  7930. const m_R_AARCH64_TLS_DTPREL64 = 1029
  7931. const m_R_AARCH64_TLS_TPREL = 1030
  7932. const m_R_AARCH64_TLS_TPREL64 = 1030
  7933. const m_R_AARCH64_TSTBR14 = 279
  7934. const m_R_ALPHA_BRADDR = 7
  7935. const m_R_ALPHA_COPY = 24
  7936. const m_R_ALPHA_DTPMOD64 = 31
  7937. const m_R_ALPHA_DTPREL16 = 36
  7938. const m_R_ALPHA_DTPREL64 = 33
  7939. const m_R_ALPHA_DTPRELHI = 34
  7940. const m_R_ALPHA_DTPRELLO = 35
  7941. const m_R_ALPHA_GLOB_DAT = 25
  7942. const m_R_ALPHA_GOTDTPREL = 32
  7943. const m_R_ALPHA_GOTTPREL = 37
  7944. const m_R_ALPHA_GPDISP = 6
  7945. const m_R_ALPHA_GPREL16 = 19
  7946. const m_R_ALPHA_GPREL32 = 3
  7947. const m_R_ALPHA_GPRELHIGH = 17
  7948. const m_R_ALPHA_GPRELLOW = 18
  7949. const m_R_ALPHA_HINT = 8
  7950. const m_R_ALPHA_JMP_SLOT = 26
  7951. const m_R_ALPHA_LITERAL = 4
  7952. const m_R_ALPHA_LITUSE = 5
  7953. const m_R_ALPHA_NONE = 0
  7954. const m_R_ALPHA_NUM = 46
  7955. const m_R_ALPHA_REFLONG = 1
  7956. const m_R_ALPHA_REFQUAD = 2
  7957. const m_R_ALPHA_RELATIVE = 27
  7958. const m_R_ALPHA_SREL16 = 9
  7959. const m_R_ALPHA_SREL32 = 10
  7960. const m_R_ALPHA_SREL64 = 11
  7961. const m_R_ALPHA_TLSGD = 29
  7962. const m_R_ALPHA_TLS_GD_HI = 28
  7963. const m_R_ALPHA_TLS_LDM = 30
  7964. const m_R_ALPHA_TPREL16 = 41
  7965. const m_R_ALPHA_TPREL64 = 38
  7966. const m_R_ALPHA_TPRELHI = 39
  7967. const m_R_ALPHA_TPRELLO = 40
  7968. const m_R_ARM_ABS12 = 6
  7969. const m_R_ARM_ABS16 = 5
  7970. const m_R_ARM_ABS32 = 2
  7971. const m_R_ARM_ABS32_NOI = 55
  7972. const m_R_ARM_ABS8 = 8
  7973. const m_R_ARM_ALU_PCREL_15_8 = 33
  7974. const m_R_ARM_ALU_PCREL_23_15 = 34
  7975. const m_R_ARM_ALU_PCREL_7_0 = 32
  7976. const m_R_ARM_ALU_PC_G0 = 58
  7977. const m_R_ARM_ALU_PC_G0_NC = 57
  7978. const m_R_ARM_ALU_PC_G1 = 60
  7979. const m_R_ARM_ALU_PC_G1_NC = 59
  7980. const m_R_ARM_ALU_PC_G2 = 61
  7981. const m_R_ARM_ALU_SBREL_19_12 = 36
  7982. const m_R_ARM_ALU_SBREL_27_20 = 37
  7983. const m_R_ARM_ALU_SB_G0 = 71
  7984. const m_R_ARM_ALU_SB_G0_NC = 70
  7985. const m_R_ARM_ALU_SB_G1 = 73
  7986. const m_R_ARM_ALU_SB_G1_NC = 72
  7987. const m_R_ARM_ALU_SB_G2 = 74
  7988. const m_R_ARM_AMP_VCALL9 = 12
  7989. const m_R_ARM_BASE_ABS = 31
  7990. const m_R_ARM_CALL = 28
  7991. const m_R_ARM_COPY = 20
  7992. const m_R_ARM_GLOB_DAT = 21
  7993. const m_R_ARM_GNU_VTENTRY = 100
  7994. const m_R_ARM_GNU_VTINHERIT = 101
  7995. const m_R_ARM_GOT32 = 26
  7996. const m_R_ARM_GOTOFF = 24
  7997. const m_R_ARM_GOTOFF12 = 98
  7998. const m_R_ARM_GOTPC = 25
  7999. const m_R_ARM_GOTRELAX = 99
  8000. const m_R_ARM_GOT_ABS = 95
  8001. const m_R_ARM_GOT_BREL12 = 97
  8002. const m_R_ARM_GOT_PREL = 96
  8003. const m_R_ARM_IRELATIVE = 160
  8004. const m_R_ARM_JUMP24 = 29
  8005. const m_R_ARM_JUMP_SLOT = 22
  8006. const m_R_ARM_LDC_PC_G0 = 67
  8007. const m_R_ARM_LDC_PC_G1 = 68
  8008. const m_R_ARM_LDC_PC_G2 = 69
  8009. const m_R_ARM_LDC_SB_G0 = 81
  8010. const m_R_ARM_LDC_SB_G1 = 82
  8011. const m_R_ARM_LDC_SB_G2 = 83
  8012. const m_R_ARM_LDRS_PC_G0 = 64
  8013. const m_R_ARM_LDRS_PC_G1 = 65
  8014. const m_R_ARM_LDRS_PC_G2 = 66
  8015. const m_R_ARM_LDRS_SB_G0 = 78
  8016. const m_R_ARM_LDRS_SB_G1 = 79
  8017. const m_R_ARM_LDRS_SB_G2 = 80
  8018. const m_R_ARM_LDR_PC_G1 = 62
  8019. const m_R_ARM_LDR_PC_G2 = 63
  8020. const m_R_ARM_LDR_SBREL_11_0 = 35
  8021. const m_R_ARM_LDR_SB_G0 = 75
  8022. const m_R_ARM_LDR_SB_G1 = 76
  8023. const m_R_ARM_LDR_SB_G2 = 77
  8024. const m_R_ARM_ME_TOO = 128
  8025. const m_R_ARM_MOVT_ABS = 44
  8026. const m_R_ARM_MOVT_BREL = 85
  8027. const m_R_ARM_MOVT_PREL = 46
  8028. const m_R_ARM_MOVW_ABS_NC = 43
  8029. const m_R_ARM_MOVW_BREL = 86
  8030. const m_R_ARM_MOVW_BREL_NC = 84
  8031. const m_R_ARM_MOVW_PREL_NC = 45
  8032. const m_R_ARM_NONE = 0
  8033. const m_R_ARM_NUM = 256
  8034. const m_R_ARM_PC13 = 4
  8035. const m_R_ARM_PC24 = 1
  8036. const m_R_ARM_PLT32 = 27
  8037. const m_R_ARM_PLT32_ABS = 94
  8038. const m_R_ARM_PREL31 = 42
  8039. const m_R_ARM_RABS22 = 253
  8040. const m_R_ARM_RBASE = 255
  8041. const m_R_ARM_REL32 = 3
  8042. const m_R_ARM_REL32_NOI = 56
  8043. const m_R_ARM_RELATIVE = 23
  8044. const m_R_ARM_RPC24 = 254
  8045. const m_R_ARM_RREL32 = 252
  8046. const m_R_ARM_RSBREL32 = 250
  8047. const m_R_ARM_RXPC25 = 249
  8048. const m_R_ARM_SBREL31 = 39
  8049. const m_R_ARM_SBREL32 = 9
  8050. const m_R_ARM_TARGET1 = 38
  8051. const m_R_ARM_TARGET2 = 41
  8052. const m_R_ARM_THM_ABS5 = 7
  8053. const m_R_ARM_THM_ALU_PREL_11_0 = 53
  8054. const m_R_ARM_THM_GOT_BREL12 = 131
  8055. const m_R_ARM_THM_JUMP19 = 51
  8056. const m_R_ARM_THM_JUMP24 = 30
  8057. const m_R_ARM_THM_JUMP6 = 52
  8058. const m_R_ARM_THM_MOVT_ABS = 48
  8059. const m_R_ARM_THM_MOVT_BREL = 88
  8060. const m_R_ARM_THM_MOVT_PREL = 50
  8061. const m_R_ARM_THM_MOVW_ABS_NC = 47
  8062. const m_R_ARM_THM_MOVW_BREL = 89
  8063. const m_R_ARM_THM_MOVW_BREL_NC = 87
  8064. const m_R_ARM_THM_MOVW_PREL_NC = 49
  8065. const m_R_ARM_THM_PC11 = 102
  8066. const m_R_ARM_THM_PC12 = 54
  8067. const m_R_ARM_THM_PC22 = 10
  8068. const m_R_ARM_THM_PC8 = 11
  8069. const m_R_ARM_THM_PC9 = 103
  8070. const m_R_ARM_THM_RPC22 = 251
  8071. const m_R_ARM_THM_SWI8 = 14
  8072. const m_R_ARM_THM_TLS_CALL = 93
  8073. const m_R_ARM_THM_TLS_DESCSEQ = 129
  8074. const m_R_ARM_THM_TLS_DESCSEQ16 = 129
  8075. const m_R_ARM_THM_TLS_DESCSEQ32 = 130
  8076. const m_R_ARM_THM_XPC22 = 16
  8077. const m_R_ARM_TLS_CALL = 91
  8078. const m_R_ARM_TLS_DESC = 13
  8079. const m_R_ARM_TLS_DESCSEQ = 92
  8080. const m_R_ARM_TLS_DTPMOD32 = 17
  8081. const m_R_ARM_TLS_DTPOFF32 = 18
  8082. const m_R_ARM_TLS_GD32 = 104
  8083. const m_R_ARM_TLS_GOTDESC = 90
  8084. const m_R_ARM_TLS_IE12GP = 111
  8085. const m_R_ARM_TLS_IE32 = 107
  8086. const m_R_ARM_TLS_LDM32 = 105
  8087. const m_R_ARM_TLS_LDO12 = 109
  8088. const m_R_ARM_TLS_LDO32 = 106
  8089. const m_R_ARM_TLS_LE12 = 110
  8090. const m_R_ARM_TLS_LE32 = 108
  8091. const m_R_ARM_TLS_TPOFF32 = 19
  8092. const m_R_ARM_V4BX = 40
  8093. const m_R_ARM_XPC25 = 15
  8094. const m_R_BPF_MAP_FD = 1
  8095. const m_R_BPF_NONE = 0
  8096. const m_R_CKCORE_ADDR32 = 1
  8097. const m_R_CKCORE_ADDRGOT = 17
  8098. const m_R_CKCORE_ADDRGOT_HI16 = 36
  8099. const m_R_CKCORE_ADDRGOT_LO16 = 37
  8100. const m_R_CKCORE_ADDRPLT = 18
  8101. const m_R_CKCORE_ADDRPLT_HI16 = 38
  8102. const m_R_CKCORE_ADDRPLT_LO16 = 39
  8103. const m_R_CKCORE_ADDR_HI16 = 24
  8104. const m_R_CKCORE_ADDR_LO16 = 25
  8105. const m_R_CKCORE_COPY = 10
  8106. const m_R_CKCORE_DOFFSET_IMM18 = 44
  8107. const m_R_CKCORE_DOFFSET_IMM18BY2 = 45
  8108. const m_R_CKCORE_DOFFSET_IMM18BY4 = 46
  8109. const m_R_CKCORE_DOFFSET_LO16 = 42
  8110. const m_R_CKCORE_GLOB_DAT = 11
  8111. const m_R_CKCORE_GOT12 = 30
  8112. const m_R_CKCORE_GOT32 = 15
  8113. const m_R_CKCORE_GOTOFF = 13
  8114. const m_R_CKCORE_GOTOFF_HI16 = 28
  8115. const m_R_CKCORE_GOTOFF_LO16 = 29
  8116. const m_R_CKCORE_GOTPC = 14
  8117. const m_R_CKCORE_GOTPC_HI16 = 26
  8118. const m_R_CKCORE_GOTPC_LO16 = 27
  8119. const m_R_CKCORE_GOT_HI16 = 31
  8120. const m_R_CKCORE_GOT_IMM18BY4 = 48
  8121. const m_R_CKCORE_GOT_LO16 = 32
  8122. const m_R_CKCORE_JUMP_SLOT = 12
  8123. const m_R_CKCORE_NONE = 0
  8124. const m_R_CKCORE_PCREL32 = 5
  8125. const m_R_CKCORE_PCRELIMM11BY2 = 3
  8126. const m_R_CKCORE_PCRELIMM8BY4 = 2
  8127. const m_R_CKCORE_PCRELJSR_IMM11BY2 = 6
  8128. const m_R_CKCORE_PCREL_IMM10BY2 = 22
  8129. const m_R_CKCORE_PCREL_IMM10BY4 = 23
  8130. const m_R_CKCORE_PCREL_IMM16BY2 = 20
  8131. const m_R_CKCORE_PCREL_IMM16BY4 = 21
  8132. const m_R_CKCORE_PCREL_IMM18BY2 = 43
  8133. const m_R_CKCORE_PCREL_IMM26BY2 = 19
  8134. const m_R_CKCORE_PCREL_IMM7BY4 = 50
  8135. const m_R_CKCORE_PCREL_JSR_IMM26BY2 = 40
  8136. const m_R_CKCORE_PLT12 = 33
  8137. const m_R_CKCORE_PLT32 = 16
  8138. const m_R_CKCORE_PLT_HI16 = 34
  8139. const m_R_CKCORE_PLT_IMM18BY4 = 49
  8140. const m_R_CKCORE_PLT_LO16 = 35
  8141. const m_R_CKCORE_RELATIVE = 9
  8142. const m_R_CKCORE_TLS_DTPMOD32 = 56
  8143. const m_R_CKCORE_TLS_DTPOFF32 = 57
  8144. const m_R_CKCORE_TLS_GD32 = 53
  8145. const m_R_CKCORE_TLS_IE32 = 52
  8146. const m_R_CKCORE_TLS_LDM32 = 54
  8147. const m_R_CKCORE_TLS_LDO32 = 55
  8148. const m_R_CKCORE_TLS_LE32 = 51
  8149. const m_R_CKCORE_TLS_TPOFF32 = 58
  8150. const m_R_CKCORE_TOFFSET_LO16 = 41
  8151. const m_R_CRIS_16 = 2
  8152. const m_R_CRIS_16_GOT = 13
  8153. const m_R_CRIS_16_GOTPLT = 15
  8154. const m_R_CRIS_16_PCREL = 5
  8155. const m_R_CRIS_32 = 3
  8156. const m_R_CRIS_32_GOT = 14
  8157. const m_R_CRIS_32_GOTPLT = 16
  8158. const m_R_CRIS_32_GOTREL = 17
  8159. const m_R_CRIS_32_PCREL = 6
  8160. const m_R_CRIS_32_PLT_GOTREL = 18
  8161. const m_R_CRIS_32_PLT_PCREL = 19
  8162. const m_R_CRIS_8 = 1
  8163. const m_R_CRIS_8_PCREL = 4
  8164. const m_R_CRIS_COPY = 9
  8165. const m_R_CRIS_GLOB_DAT = 10
  8166. const m_R_CRIS_GNU_VTENTRY = 8
  8167. const m_R_CRIS_GNU_VTINHERIT = 7
  8168. const m_R_CRIS_JUMP_SLOT = 11
  8169. const m_R_CRIS_NONE = 0
  8170. const m_R_CRIS_NUM = 20
  8171. const m_R_CRIS_RELATIVE = 12
  8172. const m_R_IA64_COPY = 0x84
  8173. const m_R_IA64_DIR32LSB = 0x25
  8174. const m_R_IA64_DIR32MSB = 0x24
  8175. const m_R_IA64_DIR64LSB = 0x27
  8176. const m_R_IA64_DIR64MSB = 0x26
  8177. const m_R_IA64_DTPMOD64LSB = 0xa7
  8178. const m_R_IA64_DTPMOD64MSB = 0xa6
  8179. const m_R_IA64_DTPREL14 = 0xb1
  8180. const m_R_IA64_DTPREL22 = 0xb2
  8181. const m_R_IA64_DTPREL32LSB = 0xb5
  8182. const m_R_IA64_DTPREL32MSB = 0xb4
  8183. const m_R_IA64_DTPREL64I = 0xb3
  8184. const m_R_IA64_DTPREL64LSB = 0xb7
  8185. const m_R_IA64_DTPREL64MSB = 0xb6
  8186. const m_R_IA64_FPTR32LSB = 0x45
  8187. const m_R_IA64_FPTR32MSB = 0x44
  8188. const m_R_IA64_FPTR64I = 0x43
  8189. const m_R_IA64_FPTR64LSB = 0x47
  8190. const m_R_IA64_FPTR64MSB = 0x46
  8191. const m_R_IA64_GPREL22 = 0x2a
  8192. const m_R_IA64_GPREL32LSB = 0x2d
  8193. const m_R_IA64_GPREL32MSB = 0x2c
  8194. const m_R_IA64_GPREL64I = 0x2b
  8195. const m_R_IA64_GPREL64LSB = 0x2f
  8196. const m_R_IA64_GPREL64MSB = 0x2e
  8197. const m_R_IA64_IMM14 = 0x21
  8198. const m_R_IA64_IMM22 = 0x22
  8199. const m_R_IA64_IMM64 = 0x23
  8200. const m_R_IA64_IPLTLSB = 0x81
  8201. const m_R_IA64_IPLTMSB = 0x80
  8202. const m_R_IA64_LDXMOV = 0x87
  8203. const m_R_IA64_LTOFF22 = 0x32
  8204. const m_R_IA64_LTOFF22X = 0x86
  8205. const m_R_IA64_LTOFF64I = 0x33
  8206. const m_R_IA64_LTOFF_DTPMOD22 = 0xaa
  8207. const m_R_IA64_LTOFF_DTPREL22 = 0xba
  8208. const m_R_IA64_LTOFF_FPTR22 = 0x52
  8209. const m_R_IA64_LTOFF_FPTR32LSB = 0x55
  8210. const m_R_IA64_LTOFF_FPTR32MSB = 0x54
  8211. const m_R_IA64_LTOFF_FPTR64I = 0x53
  8212. const m_R_IA64_LTOFF_FPTR64LSB = 0x57
  8213. const m_R_IA64_LTOFF_FPTR64MSB = 0x56
  8214. const m_R_IA64_LTOFF_TPREL22 = 0x9a
  8215. const m_R_IA64_LTV32LSB = 0x75
  8216. const m_R_IA64_LTV32MSB = 0x74
  8217. const m_R_IA64_LTV64LSB = 0x77
  8218. const m_R_IA64_LTV64MSB = 0x76
  8219. const m_R_IA64_NONE = 0x00
  8220. const m_R_IA64_PCREL21B = 0x49
  8221. const m_R_IA64_PCREL21BI = 0x79
  8222. const m_R_IA64_PCREL21F = 0x4b
  8223. const m_R_IA64_PCREL21M = 0x4a
  8224. const m_R_IA64_PCREL22 = 0x7a
  8225. const m_R_IA64_PCREL32LSB = 0x4d
  8226. const m_R_IA64_PCREL32MSB = 0x4c
  8227. const m_R_IA64_PCREL60B = 0x48
  8228. const m_R_IA64_PCREL64I = 0x7b
  8229. const m_R_IA64_PCREL64LSB = 0x4f
  8230. const m_R_IA64_PCREL64MSB = 0x4e
  8231. const m_R_IA64_PLTOFF22 = 0x3a
  8232. const m_R_IA64_PLTOFF64I = 0x3b
  8233. const m_R_IA64_PLTOFF64LSB = 0x3f
  8234. const m_R_IA64_PLTOFF64MSB = 0x3e
  8235. const m_R_IA64_REL32LSB = 0x6d
  8236. const m_R_IA64_REL32MSB = 0x6c
  8237. const m_R_IA64_REL64LSB = 0x6f
  8238. const m_R_IA64_REL64MSB = 0x6e
  8239. const m_R_IA64_SECREL32LSB = 0x65
  8240. const m_R_IA64_SECREL32MSB = 0x64
  8241. const m_R_IA64_SECREL64LSB = 0x67
  8242. const m_R_IA64_SECREL64MSB = 0x66
  8243. const m_R_IA64_SEGREL32LSB = 0x5d
  8244. const m_R_IA64_SEGREL32MSB = 0x5c
  8245. const m_R_IA64_SEGREL64LSB = 0x5f
  8246. const m_R_IA64_SEGREL64MSB = 0x5e
  8247. const m_R_IA64_SUB = 0x85
  8248. const m_R_IA64_TPREL14 = 0x91
  8249. const m_R_IA64_TPREL22 = 0x92
  8250. const m_R_IA64_TPREL64I = 0x93
  8251. const m_R_IA64_TPREL64LSB = 0x97
  8252. const m_R_IA64_TPREL64MSB = 0x96
  8253. const m_R_LARCH_32 = 1
  8254. const m_R_LARCH_32_PCREL = 99
  8255. const m_R_LARCH_64 = 2
  8256. const m_R_LARCH_ABS64_HI12 = 70
  8257. const m_R_LARCH_ABS64_LO20 = 69
  8258. const m_R_LARCH_ABS_HI20 = 67
  8259. const m_R_LARCH_ABS_LO12 = 68
  8260. const m_R_LARCH_ADD16 = 48
  8261. const m_R_LARCH_ADD24 = 49
  8262. const m_R_LARCH_ADD32 = 50
  8263. const m_R_LARCH_ADD64 = 51
  8264. const m_R_LARCH_ADD8 = 47
  8265. const m_R_LARCH_B16 = 64
  8266. const m_R_LARCH_B21 = 65
  8267. const m_R_LARCH_B26 = 66
  8268. const m_R_LARCH_COPY = 4
  8269. const m_R_LARCH_GNU_VTENTRY = 58
  8270. const m_R_LARCH_GNU_VTINHERIT = 57
  8271. const m_R_LARCH_GOT64_HI12 = 82
  8272. const m_R_LARCH_GOT64_LO20 = 81
  8273. const m_R_LARCH_GOT64_PC_HI12 = 78
  8274. const m_R_LARCH_GOT64_PC_LO20 = 77
  8275. const m_R_LARCH_GOT_HI20 = 79
  8276. const m_R_LARCH_GOT_LO12 = 80
  8277. const m_R_LARCH_GOT_PC_HI20 = 75
  8278. const m_R_LARCH_GOT_PC_LO12 = 76
  8279. const m_R_LARCH_IRELATIVE = 12
  8280. const m_R_LARCH_JUMP_SLOT = 5
  8281. const m_R_LARCH_MARK_LA = 20
  8282. const m_R_LARCH_MARK_PCREL = 21
  8283. const m_R_LARCH_NONE = 0
  8284. const m_R_LARCH_PCALA64_HI12 = 74
  8285. const m_R_LARCH_PCALA64_LO20 = 73
  8286. const m_R_LARCH_PCALA_HI20 = 71
  8287. const m_R_LARCH_PCALA_LO12 = 72
  8288. const m_R_LARCH_RELATIVE = 3
  8289. const m_R_LARCH_RELAX = 100
  8290. const m_R_LARCH_SOP_ADD = 35
  8291. const m_R_LARCH_SOP_AND = 36
  8292. const m_R_LARCH_SOP_ASSERT = 30
  8293. const m_R_LARCH_SOP_IF_ELSE = 37
  8294. const m_R_LARCH_SOP_NOT = 31
  8295. const m_R_LARCH_SOP_POP_32_S_0_10_10_16_S2 = 45
  8296. const m_R_LARCH_SOP_POP_32_S_0_5_10_16_S2 = 44
  8297. const m_R_LARCH_SOP_POP_32_S_10_12 = 40
  8298. const m_R_LARCH_SOP_POP_32_S_10_16 = 41
  8299. const m_R_LARCH_SOP_POP_32_S_10_16_S2 = 42
  8300. const m_R_LARCH_SOP_POP_32_S_10_5 = 38
  8301. const m_R_LARCH_SOP_POP_32_S_5_20 = 43
  8302. const m_R_LARCH_SOP_POP_32_U = 46
  8303. const m_R_LARCH_SOP_POP_32_U_10_12 = 39
  8304. const m_R_LARCH_SOP_PUSH_ABSOLUTE = 23
  8305. const m_R_LARCH_SOP_PUSH_DUP = 24
  8306. const m_R_LARCH_SOP_PUSH_GPREL = 25
  8307. const m_R_LARCH_SOP_PUSH_PCREL = 22
  8308. const m_R_LARCH_SOP_PUSH_PLT_PCREL = 29
  8309. const m_R_LARCH_SOP_PUSH_TLS_GD = 28
  8310. const m_R_LARCH_SOP_PUSH_TLS_GOT = 27
  8311. const m_R_LARCH_SOP_PUSH_TLS_TPREL = 26
  8312. const m_R_LARCH_SOP_SL = 33
  8313. const m_R_LARCH_SOP_SR = 34
  8314. const m_R_LARCH_SOP_SUB = 32
  8315. const m_R_LARCH_SUB16 = 53
  8316. const m_R_LARCH_SUB24 = 54
  8317. const m_R_LARCH_SUB32 = 55
  8318. const m_R_LARCH_SUB64 = 56
  8319. const m_R_LARCH_SUB8 = 52
  8320. const m_R_LARCH_TLS_DTPMOD32 = 6
  8321. const m_R_LARCH_TLS_DTPMOD64 = 7
  8322. const m_R_LARCH_TLS_DTPREL32 = 8
  8323. const m_R_LARCH_TLS_DTPREL64 = 9
  8324. const m_R_LARCH_TLS_GD_HI20 = 98
  8325. const m_R_LARCH_TLS_GD_PC_HI20 = 97
  8326. const m_R_LARCH_TLS_IE64_HI12 = 94
  8327. const m_R_LARCH_TLS_IE64_LO20 = 93
  8328. const m_R_LARCH_TLS_IE64_PC_HI12 = 90
  8329. const m_R_LARCH_TLS_IE64_PC_LO20 = 89
  8330. const m_R_LARCH_TLS_IE_HI20 = 91
  8331. const m_R_LARCH_TLS_IE_LO12 = 92
  8332. const m_R_LARCH_TLS_IE_PC_HI20 = 87
  8333. const m_R_LARCH_TLS_IE_PC_LO12 = 88
  8334. const m_R_LARCH_TLS_LD_HI20 = 96
  8335. const m_R_LARCH_TLS_LD_PC_HI20 = 95
  8336. const m_R_LARCH_TLS_LE64_HI12 = 86
  8337. const m_R_LARCH_TLS_LE64_LO20 = 85
  8338. const m_R_LARCH_TLS_LE_HI20 = 83
  8339. const m_R_LARCH_TLS_LE_LO12 = 84
  8340. const m_R_LARCH_TLS_TPREL32 = 10
  8341. const m_R_LARCH_TLS_TPREL64 = 11
  8342. const m_R_M32R_10_PCREL = 4
  8343. const m_R_M32R_10_PCREL_RELA = 36
  8344. const m_R_M32R_16 = 1
  8345. const m_R_M32R_16_RELA = 33
  8346. const m_R_M32R_18_PCREL = 5
  8347. const m_R_M32R_18_PCREL_RELA = 37
  8348. const m_R_M32R_24 = 3
  8349. const m_R_M32R_24_RELA = 35
  8350. const m_R_M32R_26_PCREL = 6
  8351. const m_R_M32R_26_PCREL_RELA = 38
  8352. const m_R_M32R_26_PLTREL = 49
  8353. const m_R_M32R_32 = 2
  8354. const m_R_M32R_32_RELA = 34
  8355. const m_R_M32R_COPY = 50
  8356. const m_R_M32R_GLOB_DAT = 51
  8357. const m_R_M32R_GNU_VTENTRY = 12
  8358. const m_R_M32R_GNU_VTINHERIT = 11
  8359. const m_R_M32R_GOT16_HI_SLO = 57
  8360. const m_R_M32R_GOT16_HI_ULO = 56
  8361. const m_R_M32R_GOT16_LO = 58
  8362. const m_R_M32R_GOT24 = 48
  8363. const m_R_M32R_GOTOFF = 54
  8364. const m_R_M32R_GOTOFF_HI_SLO = 63
  8365. const m_R_M32R_GOTOFF_HI_ULO = 62
  8366. const m_R_M32R_GOTOFF_LO = 64
  8367. const m_R_M32R_GOTPC24 = 55
  8368. const m_R_M32R_GOTPC_HI_SLO = 60
  8369. const m_R_M32R_GOTPC_HI_ULO = 59
  8370. const m_R_M32R_GOTPC_LO = 61
  8371. const m_R_M32R_HI16_SLO = 8
  8372. const m_R_M32R_HI16_SLO_RELA = 40
  8373. const m_R_M32R_HI16_ULO = 7
  8374. const m_R_M32R_HI16_ULO_RELA = 39
  8375. const m_R_M32R_JMP_SLOT = 52
  8376. const m_R_M32R_LO16 = 9
  8377. const m_R_M32R_LO16_RELA = 41
  8378. const m_R_M32R_NONE = 0
  8379. const m_R_M32R_NUM = 256
  8380. const m_R_M32R_REL32 = 45
  8381. const m_R_M32R_RELATIVE = 53
  8382. const m_R_M32R_RELA_GNU_VTENTRY = 44
  8383. const m_R_M32R_RELA_GNU_VTINHERIT = 43
  8384. const m_R_M32R_SDA16 = 10
  8385. const m_R_M32R_SDA16_RELA = 42
  8386. const m_R_MICROBLAZE_32 = 1
  8387. const m_R_MICROBLAZE_32_LO = 6
  8388. const m_R_MICROBLAZE_32_PCREL = 2
  8389. const m_R_MICROBLAZE_32_PCREL_LO = 4
  8390. const m_R_MICROBLAZE_32_SYM_OP_SYM = 10
  8391. const m_R_MICROBLAZE_64 = 5
  8392. const m_R_MICROBLAZE_64_NONE = 9
  8393. const m_R_MICROBLAZE_64_PCREL = 3
  8394. const m_R_MICROBLAZE_COPY = 21
  8395. const m_R_MICROBLAZE_GLOB_DAT = 18
  8396. const m_R_MICROBLAZE_GNU_VTENTRY = 12
  8397. const m_R_MICROBLAZE_GNU_VTINHERIT = 11
  8398. const m_R_MICROBLAZE_GOTOFF_32 = 20
  8399. const m_R_MICROBLAZE_GOTOFF_64 = 19
  8400. const m_R_MICROBLAZE_GOTPC_64 = 13
  8401. const m_R_MICROBLAZE_GOT_64 = 14
  8402. const m_R_MICROBLAZE_JUMP_SLOT = 17
  8403. const m_R_MICROBLAZE_NONE = 0
  8404. const m_R_MICROBLAZE_PLT_64 = 15
  8405. const m_R_MICROBLAZE_REL = 16
  8406. const m_R_MICROBLAZE_SRO32 = 7
  8407. const m_R_MICROBLAZE_SRW32 = 8
  8408. const m_R_MICROBLAZE_TLS = 22
  8409. const m_R_MICROBLAZE_TLSDTPMOD32 = 25
  8410. const m_R_MICROBLAZE_TLSDTPREL32 = 26
  8411. const m_R_MICROBLAZE_TLSDTPREL64 = 27
  8412. const m_R_MICROBLAZE_TLSGD = 23
  8413. const m_R_MICROBLAZE_TLSGOTTPREL32 = 28
  8414. const m_R_MICROBLAZE_TLSLD = 24
  8415. const m_R_MICROBLAZE_TLSTPREL32 = 29
  8416. const m_R_MIPS_16 = 1
  8417. const m_R_MIPS_26 = 4
  8418. const m_R_MIPS_32 = 2
  8419. const m_R_MIPS_64 = 18
  8420. const m_R_MIPS_ADD_IMMEDIATE = 34
  8421. const m_R_MIPS_CALL16 = 11
  8422. const m_R_MIPS_CALL_HI16 = 30
  8423. const m_R_MIPS_CALL_LO16 = 31
  8424. const m_R_MIPS_COPY = 126
  8425. const m_R_MIPS_DELETE = 27
  8426. const m_R_MIPS_GLOB_DAT = 51
  8427. const m_R_MIPS_GOT16 = 9
  8428. const m_R_MIPS_GOT_DISP = 19
  8429. const m_R_MIPS_GOT_HI16 = 22
  8430. const m_R_MIPS_GOT_LO16 = 23
  8431. const m_R_MIPS_GOT_OFST = 21
  8432. const m_R_MIPS_GOT_PAGE = 20
  8433. const m_R_MIPS_GPREL16 = 7
  8434. const m_R_MIPS_GPREL32 = 12
  8435. const m_R_MIPS_HI16 = 5
  8436. const m_R_MIPS_HIGHER = 28
  8437. const m_R_MIPS_HIGHEST = 29
  8438. const m_R_MIPS_INSERT_A = 25
  8439. const m_R_MIPS_INSERT_B = 26
  8440. const m_R_MIPS_JALR = 37
  8441. const m_R_MIPS_JUMP_SLOT = 127
  8442. const m_R_MIPS_LITERAL = 8
  8443. const m_R_MIPS_LO16 = 6
  8444. const m_R_MIPS_NONE = 0
  8445. const m_R_MIPS_NUM = 128
  8446. const m_R_MIPS_PC16 = 10
  8447. const m_R_MIPS_PJUMP = 35
  8448. const m_R_MIPS_REL16 = 33
  8449. const m_R_MIPS_REL32 = 3
  8450. const m_R_MIPS_RELGOT = 36
  8451. const m_R_MIPS_SCN_DISP = 32
  8452. const m_R_MIPS_SHIFT5 = 16
  8453. const m_R_MIPS_SHIFT6 = 17
  8454. const m_R_MIPS_SUB = 24
  8455. const m_R_MIPS_TLS_DTPMOD32 = 38
  8456. const m_R_MIPS_TLS_DTPMOD64 = 40
  8457. const m_R_MIPS_TLS_DTPREL32 = 39
  8458. const m_R_MIPS_TLS_DTPREL64 = 41
  8459. const m_R_MIPS_TLS_DTPREL_HI16 = 44
  8460. const m_R_MIPS_TLS_DTPREL_LO16 = 45
  8461. const m_R_MIPS_TLS_GD = 42
  8462. const m_R_MIPS_TLS_GOTTPREL = 46
  8463. const m_R_MIPS_TLS_LDM = 43
  8464. const m_R_MIPS_TLS_TPREL32 = 47
  8465. const m_R_MIPS_TLS_TPREL64 = 48
  8466. const m_R_MIPS_TLS_TPREL_HI16 = 49
  8467. const m_R_MIPS_TLS_TPREL_LO16 = 50
  8468. const m_R_MN10300_16 = 2
  8469. const m_R_MN10300_24 = 9
  8470. const m_R_MN10300_32 = 1
  8471. const m_R_MN10300_8 = 3
  8472. const m_R_MN10300_COPY = 20
  8473. const m_R_MN10300_GLOB_DAT = 21
  8474. const m_R_MN10300_GNU_VTENTRY = 8
  8475. const m_R_MN10300_GNU_VTINHERIT = 7
  8476. const m_R_MN10300_GOT16 = 19
  8477. const m_R_MN10300_GOT24 = 18
  8478. const m_R_MN10300_GOT32 = 17
  8479. const m_R_MN10300_GOTOFF16 = 14
  8480. const m_R_MN10300_GOTOFF24 = 13
  8481. const m_R_MN10300_GOTOFF32 = 12
  8482. const m_R_MN10300_GOTPC16 = 11
  8483. const m_R_MN10300_GOTPC32 = 10
  8484. const m_R_MN10300_JMP_SLOT = 22
  8485. const m_R_MN10300_NONE = 0
  8486. const m_R_MN10300_NUM = 24
  8487. const m_R_MN10300_PCREL16 = 5
  8488. const m_R_MN10300_PCREL32 = 4
  8489. const m_R_MN10300_PCREL8 = 6
  8490. const m_R_MN10300_PLT16 = 16
  8491. const m_R_MN10300_PLT32 = 15
  8492. const m_R_MN10300_RELATIVE = 23
  8493. const m_R_NIOS2_ALIGN = 21
  8494. const m_R_NIOS2_BFD_RELOC_16 = 13
  8495. const m_R_NIOS2_BFD_RELOC_32 = 12
  8496. const m_R_NIOS2_BFD_RELOC_8 = 14
  8497. const m_R_NIOS2_CACHE_OPX = 6
  8498. const m_R_NIOS2_CALL16 = 23
  8499. const m_R_NIOS2_CALL26 = 4
  8500. const m_R_NIOS2_CALL26_NOAT = 41
  8501. const m_R_NIOS2_CALLR = 20
  8502. const m_R_NIOS2_CALL_HA = 45
  8503. const m_R_NIOS2_CALL_LO = 44
  8504. const m_R_NIOS2_CJMP = 19
  8505. const m_R_NIOS2_COPY = 36
  8506. const m_R_NIOS2_GLOB_DAT = 37
  8507. const m_R_NIOS2_GNU_VTENTRY = 17
  8508. const m_R_NIOS2_GNU_VTINHERIT = 16
  8509. const m_R_NIOS2_GOT16 = 22
  8510. const m_R_NIOS2_GOTOFF = 40
  8511. const m_R_NIOS2_GOTOFF_HA = 25
  8512. const m_R_NIOS2_GOTOFF_LO = 24
  8513. const m_R_NIOS2_GOT_HA = 43
  8514. const m_R_NIOS2_GOT_LO = 42
  8515. const m_R_NIOS2_GPREL = 15
  8516. const m_R_NIOS2_HI16 = 9
  8517. const m_R_NIOS2_HIADJ16 = 11
  8518. const m_R_NIOS2_IMM5 = 5
  8519. const m_R_NIOS2_IMM6 = 7
  8520. const m_R_NIOS2_IMM8 = 8
  8521. const m_R_NIOS2_JUMP_SLOT = 38
  8522. const m_R_NIOS2_LO16 = 10
  8523. const m_R_NIOS2_NONE = 0
  8524. const m_R_NIOS2_PCREL16 = 3
  8525. const m_R_NIOS2_PCREL_HA = 27
  8526. const m_R_NIOS2_PCREL_LO = 26
  8527. const m_R_NIOS2_RELATIVE = 39
  8528. const m_R_NIOS2_S16 = 1
  8529. const m_R_NIOS2_TLS_DTPMOD = 33
  8530. const m_R_NIOS2_TLS_DTPREL = 34
  8531. const m_R_NIOS2_TLS_GD16 = 28
  8532. const m_R_NIOS2_TLS_IE16 = 31
  8533. const m_R_NIOS2_TLS_LDM16 = 29
  8534. const m_R_NIOS2_TLS_LDO16 = 30
  8535. const m_R_NIOS2_TLS_LE16 = 32
  8536. const m_R_NIOS2_TLS_TPREL = 35
  8537. const m_R_NIOS2_U16 = 2
  8538. const m_R_NIOS2_UJMP = 18
  8539. const m_R_OR1K_16 = 2
  8540. const m_R_OR1K_16_PCREL = 10
  8541. const m_R_OR1K_32 = 1
  8542. const m_R_OR1K_32_PCREL = 9
  8543. const m_R_OR1K_8 = 3
  8544. const m_R_OR1K_8_PCREL = 11
  8545. const m_R_OR1K_COPY = 18
  8546. const m_R_OR1K_GLOB_DAT = 19
  8547. const m_R_OR1K_GNU_VTENTRY = 7
  8548. const m_R_OR1K_GNU_VTINHERIT = 8
  8549. const m_R_OR1K_GOT16 = 14
  8550. const m_R_OR1K_GOTOFF_HI16 = 16
  8551. const m_R_OR1K_GOTOFF_LO16 = 17
  8552. const m_R_OR1K_GOTPC_HI16 = 12
  8553. const m_R_OR1K_GOTPC_LO16 = 13
  8554. const m_R_OR1K_HI_16_IN_INSN = 5
  8555. const m_R_OR1K_INSN_REL_26 = 6
  8556. const m_R_OR1K_JMP_SLOT = 20
  8557. const m_R_OR1K_LO_16_IN_INSN = 4
  8558. const m_R_OR1K_NONE = 0
  8559. const m_R_OR1K_PLT26 = 15
  8560. const m_R_OR1K_RELATIVE = 21
  8561. const m_R_OR1K_TLS_DTPMOD = 34
  8562. const m_R_OR1K_TLS_DTPOFF = 33
  8563. const m_R_OR1K_TLS_GD_HI16 = 22
  8564. const m_R_OR1K_TLS_GD_LO16 = 23
  8565. const m_R_OR1K_TLS_IE_HI16 = 28
  8566. const m_R_OR1K_TLS_IE_LO16 = 29
  8567. const m_R_OR1K_TLS_LDM_HI16 = 24
  8568. const m_R_OR1K_TLS_LDM_LO16 = 25
  8569. const m_R_OR1K_TLS_LDO_HI16 = 26
  8570. const m_R_OR1K_TLS_LDO_LO16 = 27
  8571. const m_R_OR1K_TLS_LE_HI16 = 30
  8572. const m_R_OR1K_TLS_LE_LO16 = 31
  8573. const m_R_OR1K_TLS_TPOFF = 32
  8574. const m_R_PARISC_COPY = 128
  8575. const m_R_PARISC_DIR14DR = 84
  8576. const m_R_PARISC_DIR14R = 6
  8577. const m_R_PARISC_DIR14WR = 83
  8578. const m_R_PARISC_DIR16DF = 87
  8579. const m_R_PARISC_DIR16F = 85
  8580. const m_R_PARISC_DIR16WF = 86
  8581. const m_R_PARISC_DIR17F = 4
  8582. const m_R_PARISC_DIR17R = 3
  8583. const m_R_PARISC_DIR21L = 2
  8584. const m_R_PARISC_DIR32 = 1
  8585. const m_R_PARISC_DIR64 = 80
  8586. const m_R_PARISC_DPREL14R = 22
  8587. const m_R_PARISC_DPREL21L = 18
  8588. const m_R_PARISC_EPLT = 130
  8589. const m_R_PARISC_FPTR64 = 64
  8590. const m_R_PARISC_GNU_VTENTRY = 232
  8591. const m_R_PARISC_GNU_VTINHERIT = 233
  8592. const m_R_PARISC_GPREL14DR = 92
  8593. const m_R_PARISC_GPREL14R = 30
  8594. const m_R_PARISC_GPREL14WR = 91
  8595. const m_R_PARISC_GPREL16DF = 95
  8596. const m_R_PARISC_GPREL16F = 93
  8597. const m_R_PARISC_GPREL16WF = 94
  8598. const m_R_PARISC_GPREL21L = 26
  8599. const m_R_PARISC_GPREL64 = 88
  8600. const m_R_PARISC_HIRESERVE = 255
  8601. const m_R_PARISC_IPLT = 129
  8602. const m_R_PARISC_LORESERVE = 128
  8603. const m_R_PARISC_LTOFF14DR = 100
  8604. const m_R_PARISC_LTOFF14R = 38
  8605. const m_R_PARISC_LTOFF14WR = 99
  8606. const m_R_PARISC_LTOFF16DF = 103
  8607. const m_R_PARISC_LTOFF16F = 101
  8608. const m_R_PARISC_LTOFF16WF = 102
  8609. const m_R_PARISC_LTOFF21L = 34
  8610. const m_R_PARISC_LTOFF64 = 96
  8611. const m_R_PARISC_LTOFF_FPTR14DR = 124
  8612. const m_R_PARISC_LTOFF_FPTR14R = 62
  8613. const m_R_PARISC_LTOFF_FPTR14WR = 123
  8614. const m_R_PARISC_LTOFF_FPTR16DF = 127
  8615. const m_R_PARISC_LTOFF_FPTR16F = 125
  8616. const m_R_PARISC_LTOFF_FPTR16WF = 126
  8617. const m_R_PARISC_LTOFF_FPTR21L = 58
  8618. const m_R_PARISC_LTOFF_FPTR32 = 57
  8619. const m_R_PARISC_LTOFF_FPTR64 = 120
  8620. const m_R_PARISC_LTOFF_TP14DR = 228
  8621. const m_R_PARISC_LTOFF_TP14F = 167
  8622. const m_R_PARISC_LTOFF_TP14R = 166
  8623. const m_R_PARISC_LTOFF_TP14WR = 227
  8624. const m_R_PARISC_LTOFF_TP16DF = 231
  8625. const m_R_PARISC_LTOFF_TP16F = 229
  8626. const m_R_PARISC_LTOFF_TP16WF = 230
  8627. const m_R_PARISC_LTOFF_TP21L = 162
  8628. const m_R_PARISC_LTOFF_TP64 = 224
  8629. const m_R_PARISC_NONE = 0
  8630. const m_R_PARISC_PCREL14DR = 76
  8631. const m_R_PARISC_PCREL14R = 14
  8632. const m_R_PARISC_PCREL14WR = 75
  8633. const m_R_PARISC_PCREL16DF = 79
  8634. const m_R_PARISC_PCREL16F = 77
  8635. const m_R_PARISC_PCREL16WF = 78
  8636. const m_R_PARISC_PCREL17F = 12
  8637. const m_R_PARISC_PCREL17R = 11
  8638. const m_R_PARISC_PCREL21L = 10
  8639. const m_R_PARISC_PCREL22F = 74
  8640. const m_R_PARISC_PCREL32 = 9
  8641. const m_R_PARISC_PCREL64 = 72
  8642. const m_R_PARISC_PLABEL14R = 70
  8643. const m_R_PARISC_PLABEL21L = 66
  8644. const m_R_PARISC_PLABEL32 = 65
  8645. const m_R_PARISC_PLTOFF14DR = 116
  8646. const m_R_PARISC_PLTOFF14R = 54
  8647. const m_R_PARISC_PLTOFF14WR = 115
  8648. const m_R_PARISC_PLTOFF16DF = 119
  8649. const m_R_PARISC_PLTOFF16F = 117
  8650. const m_R_PARISC_PLTOFF16WF = 118
  8651. const m_R_PARISC_PLTOFF21L = 50
  8652. const m_R_PARISC_SECREL32 = 41
  8653. const m_R_PARISC_SECREL64 = 104
  8654. const m_R_PARISC_SEGBASE = 48
  8655. const m_R_PARISC_SEGREL32 = 49
  8656. const m_R_PARISC_SEGREL64 = 112
  8657. const m_R_PARISC_TLS_DTPMOD32 = 242
  8658. const m_R_PARISC_TLS_DTPMOD64 = 243
  8659. const m_R_PARISC_TLS_DTPOFF32 = 244
  8660. const m_R_PARISC_TLS_DTPOFF64 = 245
  8661. const m_R_PARISC_TLS_GD14R = 235
  8662. const m_R_PARISC_TLS_GD21L = 234
  8663. const m_R_PARISC_TLS_GDCALL = 236
  8664. const m_R_PARISC_TLS_IE14R = "R_PARISC_LTOFF_TP14R"
  8665. const m_R_PARISC_TLS_IE21L = "R_PARISC_LTOFF_TP21L"
  8666. const m_R_PARISC_TLS_LDM14R = 238
  8667. const m_R_PARISC_TLS_LDM21L = 237
  8668. const m_R_PARISC_TLS_LDMCALL = 239
  8669. const m_R_PARISC_TLS_LDO14R = 241
  8670. const m_R_PARISC_TLS_LDO21L = 240
  8671. const m_R_PARISC_TLS_LE14R = "R_PARISC_TPREL14R"
  8672. const m_R_PARISC_TLS_LE21L = "R_PARISC_TPREL21L"
  8673. const m_R_PARISC_TLS_TPREL32 = "R_PARISC_TPREL32"
  8674. const m_R_PARISC_TLS_TPREL64 = "R_PARISC_TPREL64"
  8675. const m_R_PARISC_TPREL14DR = 220
  8676. const m_R_PARISC_TPREL14R = 158
  8677. const m_R_PARISC_TPREL14WR = 219
  8678. const m_R_PARISC_TPREL16DF = 223
  8679. const m_R_PARISC_TPREL16F = 221
  8680. const m_R_PARISC_TPREL16WF = 222
  8681. const m_R_PARISC_TPREL21L = 154
  8682. const m_R_PARISC_TPREL32 = 153
  8683. const m_R_PARISC_TPREL64 = 216
  8684. const m_R_PPC64_ADDR14 = "R_PPC_ADDR14"
  8685. const m_R_PPC64_ADDR14_BRNTAKEN = "R_PPC_ADDR14_BRNTAKEN"
  8686. const m_R_PPC64_ADDR14_BRTAKEN = "R_PPC_ADDR14_BRTAKEN"
  8687. const m_R_PPC64_ADDR16 = "R_PPC_ADDR16"
  8688. const m_R_PPC64_ADDR16_DS = 56
  8689. const m_R_PPC64_ADDR16_HA = "R_PPC_ADDR16_HA"
  8690. const m_R_PPC64_ADDR16_HI = "R_PPC_ADDR16_HI"
  8691. const m_R_PPC64_ADDR16_HIGH = 110
  8692. const m_R_PPC64_ADDR16_HIGHA = 111
  8693. const m_R_PPC64_ADDR16_HIGHER = 39
  8694. const m_R_PPC64_ADDR16_HIGHERA = 40
  8695. const m_R_PPC64_ADDR16_HIGHEST = 41
  8696. const m_R_PPC64_ADDR16_HIGHESTA = 42
  8697. const m_R_PPC64_ADDR16_LO = "R_PPC_ADDR16_LO"
  8698. const m_R_PPC64_ADDR16_LO_DS = 57
  8699. const m_R_PPC64_ADDR24 = "R_PPC_ADDR24"
  8700. const m_R_PPC64_ADDR30 = 37
  8701. const m_R_PPC64_ADDR32 = "R_PPC_ADDR32"
  8702. const m_R_PPC64_ADDR64 = 38
  8703. const m_R_PPC64_COPY = "R_PPC_COPY"
  8704. const m_R_PPC64_DTPMOD64 = 68
  8705. const m_R_PPC64_DTPREL16 = 74
  8706. const m_R_PPC64_DTPREL16_DS = 101
  8707. const m_R_PPC64_DTPREL16_HA = 77
  8708. const m_R_PPC64_DTPREL16_HI = 76
  8709. const m_R_PPC64_DTPREL16_HIGH = 114
  8710. const m_R_PPC64_DTPREL16_HIGHA = 115
  8711. const m_R_PPC64_DTPREL16_HIGHER = 103
  8712. const m_R_PPC64_DTPREL16_HIGHERA = 104
  8713. const m_R_PPC64_DTPREL16_HIGHEST = 105
  8714. const m_R_PPC64_DTPREL16_HIGHESTA = 106
  8715. const m_R_PPC64_DTPREL16_LO = 75
  8716. const m_R_PPC64_DTPREL16_LO_DS = 102
  8717. const m_R_PPC64_DTPREL64 = 78
  8718. const m_R_PPC64_GLOB_DAT = "R_PPC_GLOB_DAT"
  8719. const m_R_PPC64_GOT16 = "R_PPC_GOT16"
  8720. const m_R_PPC64_GOT16_DS = 58
  8721. const m_R_PPC64_GOT16_HA = "R_PPC_GOT16_HA"
  8722. const m_R_PPC64_GOT16_HI = "R_PPC_GOT16_HI"
  8723. const m_R_PPC64_GOT16_LO = "R_PPC_GOT16_LO"
  8724. const m_R_PPC64_GOT16_LO_DS = 59
  8725. const m_R_PPC64_GOT_DTPREL16_DS = 91
  8726. const m_R_PPC64_GOT_DTPREL16_HA = 94
  8727. const m_R_PPC64_GOT_DTPREL16_HI = 93
  8728. const m_R_PPC64_GOT_DTPREL16_LO_DS = 92
  8729. const m_R_PPC64_GOT_TLSGD16 = 79
  8730. const m_R_PPC64_GOT_TLSGD16_HA = 82
  8731. const m_R_PPC64_GOT_TLSGD16_HI = 81
  8732. const m_R_PPC64_GOT_TLSGD16_LO = 80
  8733. const m_R_PPC64_GOT_TLSLD16 = 83
  8734. const m_R_PPC64_GOT_TLSLD16_HA = 86
  8735. const m_R_PPC64_GOT_TLSLD16_HI = 85
  8736. const m_R_PPC64_GOT_TLSLD16_LO = 84
  8737. const m_R_PPC64_GOT_TPREL16_DS = 87
  8738. const m_R_PPC64_GOT_TPREL16_HA = 90
  8739. const m_R_PPC64_GOT_TPREL16_HI = 89
  8740. const m_R_PPC64_GOT_TPREL16_LO_DS = 88
  8741. const m_R_PPC64_IRELATIVE = 248
  8742. const m_R_PPC64_JMP_IREL = 247
  8743. const m_R_PPC64_JMP_SLOT = "R_PPC_JMP_SLOT"
  8744. const m_R_PPC64_NONE = "R_PPC_NONE"
  8745. const m_R_PPC64_PLT16_HA = "R_PPC_PLT16_HA"
  8746. const m_R_PPC64_PLT16_HI = "R_PPC_PLT16_HI"
  8747. const m_R_PPC64_PLT16_LO = "R_PPC_PLT16_LO"
  8748. const m_R_PPC64_PLT16_LO_DS = 60
  8749. const m_R_PPC64_PLT32 = "R_PPC_PLT32"
  8750. const m_R_PPC64_PLT64 = 45
  8751. const m_R_PPC64_PLTGOT16 = 52
  8752. const m_R_PPC64_PLTGOT16_DS = 65
  8753. const m_R_PPC64_PLTGOT16_HA = 55
  8754. const m_R_PPC64_PLTGOT16_HI = 54
  8755. const m_R_PPC64_PLTGOT16_LO = 53
  8756. const m_R_PPC64_PLTGOT16_LO_DS = 66
  8757. const m_R_PPC64_PLTREL32 = "R_PPC_PLTREL32"
  8758. const m_R_PPC64_PLTREL64 = 46
  8759. const m_R_PPC64_REL14 = "R_PPC_REL14"
  8760. const m_R_PPC64_REL14_BRNTAKEN = "R_PPC_REL14_BRNTAKEN"
  8761. const m_R_PPC64_REL14_BRTAKEN = "R_PPC_REL14_BRTAKEN"
  8762. const m_R_PPC64_REL16 = 249
  8763. const m_R_PPC64_REL16_HA = 252
  8764. const m_R_PPC64_REL16_HI = 251
  8765. const m_R_PPC64_REL16_LO = 250
  8766. const m_R_PPC64_REL24 = "R_PPC_REL24"
  8767. const m_R_PPC64_REL32 = "R_PPC_REL32"
  8768. const m_R_PPC64_REL64 = 44
  8769. const m_R_PPC64_RELATIVE = "R_PPC_RELATIVE"
  8770. const m_R_PPC64_SECTOFF = "R_PPC_SECTOFF"
  8771. const m_R_PPC64_SECTOFF_DS = 61
  8772. const m_R_PPC64_SECTOFF_HA = "R_PPC_SECTOFF_HA"
  8773. const m_R_PPC64_SECTOFF_HI = "R_PPC_SECTOFF_HI"
  8774. const m_R_PPC64_SECTOFF_LO = "R_PPC_SECTOFF_LO"
  8775. const m_R_PPC64_SECTOFF_LO_DS = 62
  8776. const m_R_PPC64_TLS = 67
  8777. const m_R_PPC64_TLSGD = 107
  8778. const m_R_PPC64_TLSLD = 108
  8779. const m_R_PPC64_TOC = 51
  8780. const m_R_PPC64_TOC16 = 47
  8781. const m_R_PPC64_TOC16_DS = 63
  8782. const m_R_PPC64_TOC16_HA = 50
  8783. const m_R_PPC64_TOC16_HI = 49
  8784. const m_R_PPC64_TOC16_LO = 48
  8785. const m_R_PPC64_TOC16_LO_DS = 64
  8786. const m_R_PPC64_TOCSAVE = 109
  8787. const m_R_PPC64_TPREL16 = 69
  8788. const m_R_PPC64_TPREL16_DS = 95
  8789. const m_R_PPC64_TPREL16_HA = 72
  8790. const m_R_PPC64_TPREL16_HI = 71
  8791. const m_R_PPC64_TPREL16_HIGH = 112
  8792. const m_R_PPC64_TPREL16_HIGHA = 113
  8793. const m_R_PPC64_TPREL16_HIGHER = 97
  8794. const m_R_PPC64_TPREL16_HIGHERA = 98
  8795. const m_R_PPC64_TPREL16_HIGHEST = 99
  8796. const m_R_PPC64_TPREL16_HIGHESTA = 100
  8797. const m_R_PPC64_TPREL16_LO = 70
  8798. const m_R_PPC64_TPREL16_LO_DS = 96
  8799. const m_R_PPC64_TPREL64 = 73
  8800. const m_R_PPC64_UADDR16 = "R_PPC_UADDR16"
  8801. const m_R_PPC64_UADDR32 = "R_PPC_UADDR32"
  8802. const m_R_PPC64_UADDR64 = 43
  8803. const m_R_PPC_ADDR14 = 7
  8804. const m_R_PPC_ADDR14_BRNTAKEN = 9
  8805. const m_R_PPC_ADDR14_BRTAKEN = 8
  8806. const m_R_PPC_ADDR16 = 3
  8807. const m_R_PPC_ADDR16_HA = 6
  8808. const m_R_PPC_ADDR16_HI = 5
  8809. const m_R_PPC_ADDR16_LO = 4
  8810. const m_R_PPC_ADDR24 = 2
  8811. const m_R_PPC_ADDR32 = 1
  8812. const m_R_PPC_COPY = 19
  8813. const m_R_PPC_DIAB_RELSDA_HA = 185
  8814. const m_R_PPC_DIAB_RELSDA_HI = 184
  8815. const m_R_PPC_DIAB_RELSDA_LO = 183
  8816. const m_R_PPC_DIAB_SDA21_HA = 182
  8817. const m_R_PPC_DIAB_SDA21_HI = 181
  8818. const m_R_PPC_DIAB_SDA21_LO = 180
  8819. const m_R_PPC_DTPMOD32 = 68
  8820. const m_R_PPC_DTPREL16 = 74
  8821. const m_R_PPC_DTPREL16_HA = 77
  8822. const m_R_PPC_DTPREL16_HI = 76
  8823. const m_R_PPC_DTPREL16_LO = 75
  8824. const m_R_PPC_DTPREL32 = 78
  8825. const m_R_PPC_EMB_BIT_FLD = 115
  8826. const m_R_PPC_EMB_MRKREF = 110
  8827. const m_R_PPC_EMB_NADDR16 = 102
  8828. const m_R_PPC_EMB_NADDR16_HA = 105
  8829. const m_R_PPC_EMB_NADDR16_HI = 104
  8830. const m_R_PPC_EMB_NADDR16_LO = 103
  8831. const m_R_PPC_EMB_NADDR32 = 101
  8832. const m_R_PPC_EMB_RELSDA = 116
  8833. const m_R_PPC_EMB_RELSEC16 = 111
  8834. const m_R_PPC_EMB_RELST_HA = 114
  8835. const m_R_PPC_EMB_RELST_HI = 113
  8836. const m_R_PPC_EMB_RELST_LO = 112
  8837. const m_R_PPC_EMB_SDA21 = 109
  8838. const m_R_PPC_EMB_SDA2I16 = 107
  8839. const m_R_PPC_EMB_SDA2REL = 108
  8840. const m_R_PPC_EMB_SDAI16 = 106
  8841. const m_R_PPC_GLOB_DAT = 20
  8842. const m_R_PPC_GOT16 = 14
  8843. const m_R_PPC_GOT16_HA = 17
  8844. const m_R_PPC_GOT16_HI = 16
  8845. const m_R_PPC_GOT16_LO = 15
  8846. const m_R_PPC_GOT_DTPREL16 = 91
  8847. const m_R_PPC_GOT_DTPREL16_HA = 94
  8848. const m_R_PPC_GOT_DTPREL16_HI = 93
  8849. const m_R_PPC_GOT_DTPREL16_LO = 92
  8850. const m_R_PPC_GOT_TLSGD16 = 79
  8851. const m_R_PPC_GOT_TLSGD16_HA = 82
  8852. const m_R_PPC_GOT_TLSGD16_HI = 81
  8853. const m_R_PPC_GOT_TLSGD16_LO = 80
  8854. const m_R_PPC_GOT_TLSLD16 = 83
  8855. const m_R_PPC_GOT_TLSLD16_HA = 86
  8856. const m_R_PPC_GOT_TLSLD16_HI = 85
  8857. const m_R_PPC_GOT_TLSLD16_LO = 84
  8858. const m_R_PPC_GOT_TPREL16 = 87
  8859. const m_R_PPC_GOT_TPREL16_HA = 90
  8860. const m_R_PPC_GOT_TPREL16_HI = 89
  8861. const m_R_PPC_GOT_TPREL16_LO = 88
  8862. const m_R_PPC_IRELATIVE = 248
  8863. const m_R_PPC_JMP_SLOT = 21
  8864. const m_R_PPC_LOCAL24PC = 23
  8865. const m_R_PPC_NONE = 0
  8866. const m_R_PPC_PLT16_HA = 31
  8867. const m_R_PPC_PLT16_HI = 30
  8868. const m_R_PPC_PLT16_LO = 29
  8869. const m_R_PPC_PLT32 = 27
  8870. const m_R_PPC_PLTREL24 = 18
  8871. const m_R_PPC_PLTREL32 = 28
  8872. const m_R_PPC_REL14 = 11
  8873. const m_R_PPC_REL14_BRNTAKEN = 13
  8874. const m_R_PPC_REL14_BRTAKEN = 12
  8875. const m_R_PPC_REL16 = 249
  8876. const m_R_PPC_REL16_HA = 252
  8877. const m_R_PPC_REL16_HI = 251
  8878. const m_R_PPC_REL16_LO = 250
  8879. const m_R_PPC_REL24 = 10
  8880. const m_R_PPC_REL32 = 26
  8881. const m_R_PPC_RELATIVE = 22
  8882. const m_R_PPC_SDAREL16 = 32
  8883. const m_R_PPC_SECTOFF = 33
  8884. const m_R_PPC_SECTOFF_HA = 36
  8885. const m_R_PPC_SECTOFF_HI = 35
  8886. const m_R_PPC_SECTOFF_LO = 34
  8887. const m_R_PPC_TLS = 67
  8888. const m_R_PPC_TLSGD = 95
  8889. const m_R_PPC_TLSLD = 96
  8890. const m_R_PPC_TOC16 = 255
  8891. const m_R_PPC_TPREL16 = 69
  8892. const m_R_PPC_TPREL16_HA = 72
  8893. const m_R_PPC_TPREL16_HI = 71
  8894. const m_R_PPC_TPREL16_LO = 70
  8895. const m_R_PPC_TPREL32 = 73
  8896. const m_R_PPC_UADDR16 = 25
  8897. const m_R_PPC_UADDR32 = 24
  8898. const m_R_RISCV_32 = 1
  8899. const m_R_RISCV_32_PCREL = 57
  8900. const m_R_RISCV_64 = 2
  8901. const m_R_RISCV_ADD16 = 34
  8902. const m_R_RISCV_ADD32 = 35
  8903. const m_R_RISCV_ADD64 = 36
  8904. const m_R_RISCV_ADD8 = 33
  8905. const m_R_RISCV_ALIGN = 43
  8906. const m_R_RISCV_BRANCH = 16
  8907. const m_R_RISCV_CALL = 18
  8908. const m_R_RISCV_CALL_PLT = 19
  8909. const m_R_RISCV_COPY = 4
  8910. const m_R_RISCV_GOT32_PCREL = 41
  8911. const m_R_RISCV_GOT_HI20 = 20
  8912. const m_R_RISCV_HI20 = 26
  8913. const m_R_RISCV_IRELATIVE = 58
  8914. const m_R_RISCV_JAL = 17
  8915. const m_R_RISCV_JUMP_SLOT = 5
  8916. const m_R_RISCV_LO12_I = 27
  8917. const m_R_RISCV_LO12_S = 28
  8918. const m_R_RISCV_NONE = 0
  8919. const m_R_RISCV_PCREL_HI20 = 23
  8920. const m_R_RISCV_PCREL_LO12_I = 24
  8921. const m_R_RISCV_PCREL_LO12_S = 25
  8922. const m_R_RISCV_PLT32 = 59
  8923. const m_R_RISCV_RELATIVE = 3
  8924. const m_R_RISCV_RELAX = 51
  8925. const m_R_RISCV_RVC_BRANCH = 44
  8926. const m_R_RISCV_RVC_JUMP = 45
  8927. const m_R_RISCV_RVC_LUI = 46
  8928. const m_R_RISCV_SET16 = 55
  8929. const m_R_RISCV_SET32 = 56
  8930. const m_R_RISCV_SET6 = 53
  8931. const m_R_RISCV_SET8 = 54
  8932. const m_R_RISCV_SET_ULEB128 = 60
  8933. const m_R_RISCV_SUB16 = 38
  8934. const m_R_RISCV_SUB32 = 39
  8935. const m_R_RISCV_SUB6 = 52
  8936. const m_R_RISCV_SUB64 = 40
  8937. const m_R_RISCV_SUB8 = 37
  8938. const m_R_RISCV_SUB_ULEB128 = 61
  8939. const m_R_RISCV_TLSDESC = 12
  8940. const m_R_RISCV_TLSDESC_ADD_LO12 = 64
  8941. const m_R_RISCV_TLSDESC_CALL = 65
  8942. const m_R_RISCV_TLSDESC_HI20 = 62
  8943. const m_R_RISCV_TLSDESC_LOAD_LO12 = 63
  8944. const m_R_RISCV_TLS_DTPMOD32 = 6
  8945. const m_R_RISCV_TLS_DTPMOD64 = 7
  8946. const m_R_RISCV_TLS_DTPREL32 = 8
  8947. const m_R_RISCV_TLS_DTPREL64 = 9
  8948. const m_R_RISCV_TLS_GD_HI20 = 22
  8949. const m_R_RISCV_TLS_GOT_HI20 = 21
  8950. const m_R_RISCV_TLS_TPREL32 = 10
  8951. const m_R_RISCV_TLS_TPREL64 = 11
  8952. const m_R_RISCV_TPREL_ADD = 32
  8953. const m_R_RISCV_TPREL_HI20 = 29
  8954. const m_R_RISCV_TPREL_LO12_I = 30
  8955. const m_R_RISCV_TPREL_LO12_S = 31
  8956. const m_R_SH_ALIGN = 29
  8957. const m_R_SH_CODE = 30
  8958. const m_R_SH_COPY = 162
  8959. const m_R_SH_COUNT = 28
  8960. const m_R_SH_DATA = 31
  8961. const m_R_SH_DIR32 = 1
  8962. const m_R_SH_DIR8BP = 7
  8963. const m_R_SH_DIR8L = 9
  8964. const m_R_SH_DIR8W = 8
  8965. const m_R_SH_DIR8WPL = 5
  8966. const m_R_SH_DIR8WPN = 3
  8967. const m_R_SH_DIR8WPZ = 6
  8968. const m_R_SH_FUNCDESC = 207
  8969. const m_R_SH_FUNCDESC_VALUE = 208
  8970. const m_R_SH_GLOB_DAT = 163
  8971. const m_R_SH_GNU_VTENTRY = 35
  8972. const m_R_SH_GNU_VTINHERIT = 34
  8973. const m_R_SH_GOT20 = 201
  8974. const m_R_SH_GOT32 = 160
  8975. const m_R_SH_GOTFUNCDESC = 203
  8976. const m_R_SH_GOTFUNCDEST20 = 204
  8977. const m_R_SH_GOTOFF = 166
  8978. const m_R_SH_GOTOFF20 = 202
  8979. const m_R_SH_GOTOFFFUNCDESC = 205
  8980. const m_R_SH_GOTOFFFUNCDEST20 = 206
  8981. const m_R_SH_GOTPC = 167
  8982. const m_R_SH_IND12W = 4
  8983. const m_R_SH_JMP_SLOT = 164
  8984. const m_R_SH_LABEL = 32
  8985. const m_R_SH_NONE = 0
  8986. const m_R_SH_NUM = 256
  8987. const m_R_SH_PLT32 = 161
  8988. const m_R_SH_REL32 = 2
  8989. const m_R_SH_RELATIVE = 165
  8990. const m_R_SH_SWITCH16 = 25
  8991. const m_R_SH_SWITCH32 = 26
  8992. const m_R_SH_SWITCH8 = 33
  8993. const m_R_SH_TLS_DTPMOD32 = 149
  8994. const m_R_SH_TLS_DTPOFF32 = 150
  8995. const m_R_SH_TLS_GD_32 = 144
  8996. const m_R_SH_TLS_IE_32 = 147
  8997. const m_R_SH_TLS_LDO_32 = 146
  8998. const m_R_SH_TLS_LD_32 = 145
  8999. const m_R_SH_TLS_LE_32 = 148
  9000. const m_R_SH_TLS_TPOFF32 = 151
  9001. const m_R_SH_USES = 27
  9002. const m_R_SPARC_10 = 30
  9003. const m_R_SPARC_11 = 31
  9004. const m_R_SPARC_13 = 11
  9005. const m_R_SPARC_16 = 2
  9006. const m_R_SPARC_22 = 10
  9007. const m_R_SPARC_32 = 3
  9008. const m_R_SPARC_5 = 44
  9009. const m_R_SPARC_6 = 45
  9010. const m_R_SPARC_64 = 32
  9011. const m_R_SPARC_7 = 43
  9012. const m_R_SPARC_8 = 1
  9013. const m_R_SPARC_COPY = 19
  9014. const m_R_SPARC_DISP16 = 5
  9015. const m_R_SPARC_DISP32 = 6
  9016. const m_R_SPARC_DISP64 = 46
  9017. const m_R_SPARC_DISP8 = 4
  9018. const m_R_SPARC_GLOB_DAT = 20
  9019. const m_R_SPARC_GLOB_JMP = 42
  9020. const m_R_SPARC_GNU_VTENTRY = 251
  9021. const m_R_SPARC_GNU_VTINHERIT = 250
  9022. const m_R_SPARC_GOT10 = 13
  9023. const m_R_SPARC_GOT13 = 14
  9024. const m_R_SPARC_GOT22 = 15
  9025. const m_R_SPARC_GOTDATA_HIX22 = 80
  9026. const m_R_SPARC_GOTDATA_LOX10 = 81
  9027. const m_R_SPARC_GOTDATA_OP = 84
  9028. const m_R_SPARC_GOTDATA_OP_HIX22 = 82
  9029. const m_R_SPARC_GOTDATA_OP_LOX10 = 83
  9030. const m_R_SPARC_H34 = 85
  9031. const m_R_SPARC_H44 = 50
  9032. const m_R_SPARC_HH22 = 34
  9033. const m_R_SPARC_HI22 = 9
  9034. const m_R_SPARC_HIPLT22 = 25
  9035. const m_R_SPARC_HIX22 = 48
  9036. const m_R_SPARC_HM10 = 35
  9037. const m_R_SPARC_JMP_SLOT = 21
  9038. const m_R_SPARC_L44 = 52
  9039. const m_R_SPARC_LM22 = 36
  9040. const m_R_SPARC_LO10 = 12
  9041. const m_R_SPARC_LOPLT10 = 26
  9042. const m_R_SPARC_LOX10 = 49
  9043. const m_R_SPARC_M44 = 51
  9044. const m_R_SPARC_NONE = 0
  9045. const m_R_SPARC_NUM = 253
  9046. const m_R_SPARC_OLO10 = 33
  9047. const m_R_SPARC_PC10 = 16
  9048. const m_R_SPARC_PC22 = 17
  9049. const m_R_SPARC_PCPLT10 = 29
  9050. const m_R_SPARC_PCPLT22 = 28
  9051. const m_R_SPARC_PCPLT32 = 27
  9052. const m_R_SPARC_PC_HH22 = 37
  9053. const m_R_SPARC_PC_HM10 = 38
  9054. const m_R_SPARC_PC_LM22 = 39
  9055. const m_R_SPARC_PLT32 = 24
  9056. const m_R_SPARC_PLT64 = 47
  9057. const m_R_SPARC_REGISTER = 53
  9058. const m_R_SPARC_RELATIVE = 22
  9059. const m_R_SPARC_REV32 = 252
  9060. const m_R_SPARC_SIZE32 = 86
  9061. const m_R_SPARC_SIZE64 = 87
  9062. const m_R_SPARC_TLS_DTPMOD32 = 74
  9063. const m_R_SPARC_TLS_DTPMOD64 = 75
  9064. const m_R_SPARC_TLS_DTPOFF32 = 76
  9065. const m_R_SPARC_TLS_DTPOFF64 = 77
  9066. const m_R_SPARC_TLS_GD_ADD = 58
  9067. const m_R_SPARC_TLS_GD_CALL = 59
  9068. const m_R_SPARC_TLS_GD_HI22 = 56
  9069. const m_R_SPARC_TLS_GD_LO10 = 57
  9070. const m_R_SPARC_TLS_IE_ADD = 71
  9071. const m_R_SPARC_TLS_IE_HI22 = 67
  9072. const m_R_SPARC_TLS_IE_LD = 69
  9073. const m_R_SPARC_TLS_IE_LDX = 70
  9074. const m_R_SPARC_TLS_IE_LO10 = 68
  9075. const m_R_SPARC_TLS_LDM_ADD = 62
  9076. const m_R_SPARC_TLS_LDM_CALL = 63
  9077. const m_R_SPARC_TLS_LDM_HI22 = 60
  9078. const m_R_SPARC_TLS_LDM_LO10 = 61
  9079. const m_R_SPARC_TLS_LDO_ADD = 66
  9080. const m_R_SPARC_TLS_LDO_HIX22 = 64
  9081. const m_R_SPARC_TLS_LDO_LOX10 = 65
  9082. const m_R_SPARC_TLS_LE_HIX22 = 72
  9083. const m_R_SPARC_TLS_LE_LOX10 = 73
  9084. const m_R_SPARC_TLS_TPOFF32 = 78
  9085. const m_R_SPARC_TLS_TPOFF64 = 79
  9086. const m_R_SPARC_UA16 = 55
  9087. const m_R_SPARC_UA32 = 23
  9088. const m_R_SPARC_UA64 = 54
  9089. const m_R_SPARC_WDISP16 = 40
  9090. const m_R_SPARC_WDISP19 = 41
  9091. const m_R_SPARC_WDISP22 = 8
  9092. const m_R_SPARC_WDISP30 = 7
  9093. const m_R_SPARC_WPLT30 = 18
  9094. const m_R_X86_64_16 = 12
  9095. const m_R_X86_64_32 = 10
  9096. const m_R_X86_64_32S = 11
  9097. const m_R_X86_64_64 = 1
  9098. const m_R_X86_64_8 = 14
  9099. const m_R_X86_64_COPY = 5
  9100. const m_R_X86_64_DTPMOD64 = 16
  9101. const m_R_X86_64_DTPOFF32 = 21
  9102. const m_R_X86_64_DTPOFF64 = 17
  9103. const m_R_X86_64_GLOB_DAT = 6
  9104. const m_R_X86_64_GOT32 = 3
  9105. const m_R_X86_64_GOT64 = 27
  9106. const m_R_X86_64_GOTOFF64 = 25
  9107. const m_R_X86_64_GOTPC32 = 26
  9108. const m_R_X86_64_GOTPC32_TLSDESC = 34
  9109. const m_R_X86_64_GOTPC64 = 29
  9110. const m_R_X86_64_GOTPCREL = 9
  9111. const m_R_X86_64_GOTPCREL64 = 28
  9112. const m_R_X86_64_GOTPCRELX = 41
  9113. const m_R_X86_64_GOTPLT64 = 30
  9114. const m_R_X86_64_GOTTPOFF = 22
  9115. const m_R_X86_64_IRELATIVE = 37
  9116. const m_R_X86_64_JUMP_SLOT = 7
  9117. const m_R_X86_64_NONE = 0
  9118. const m_R_X86_64_NUM = 43
  9119. const m_R_X86_64_PC16 = 13
  9120. const m_R_X86_64_PC32 = 2
  9121. const m_R_X86_64_PC64 = 24
  9122. const m_R_X86_64_PC8 = 15
  9123. const m_R_X86_64_PLT32 = 4
  9124. const m_R_X86_64_PLTOFF64 = 31
  9125. const m_R_X86_64_RELATIVE = 8
  9126. const m_R_X86_64_RELATIVE64 = 38
  9127. const m_R_X86_64_REX_GOTPCRELX = 42
  9128. const m_R_X86_64_SIZE32 = 32
  9129. const m_R_X86_64_SIZE64 = 33
  9130. const m_R_X86_64_TLSDESC = 36
  9131. const m_R_X86_64_TLSDESC_CALL = 35
  9132. const m_R_X86_64_TLSGD = 19
  9133. const m_R_X86_64_TLSLD = 20
  9134. const m_R_X86_64_TPOFF32 = 23
  9135. const m_R_X86_64_TPOFF64 = 18
  9136. const m_SELFMAG = 4
  9137. const m_SHF_ALPHA_GPREL = 0x10000000
  9138. const m_SHF_ARM_COMDEF = 0x80000000
  9139. const m_SHF_ARM_ENTRYSECT = 0x10000000
  9140. const m_SHF_IA_64_NORECOV = 0x20000000
  9141. const m_SHF_IA_64_SHORT = 0x10000000
  9142. const m_SHF_MASKOS = 0x0ff00000
  9143. const m_SHF_MASKPROC = 0xf0000000
  9144. const m_SHF_MIPS_ADDR = 0x40000000
  9145. const m_SHF_MIPS_GPREL = 0x10000000
  9146. const m_SHF_MIPS_LOCAL = 0x04000000
  9147. const m_SHF_MIPS_MERGE = 0x20000000
  9148. const m_SHF_MIPS_NAMES = 0x02000000
  9149. const m_SHF_MIPS_NODUPE = 0x01000000
  9150. const m_SHF_MIPS_NOSTRIP = 0x08000000
  9151. const m_SHF_MIPS_STRINGS = 0x80000000
  9152. const m_SHF_PARISC_HUGE = 0x40000000
  9153. const m_SHF_PARISC_SBP = 0x80000000
  9154. const m_SHF_PARISC_SHORT = 0x20000000
  9155. const m_SHN_ABS = 65521
  9156. const m_SHN_AFTER = 0xff01
  9157. const m_SHN_BEFORE = 0xff00
  9158. const m_SHN_COMMON = 65522
  9159. const m_SHN_HIOS = 0xff3f
  9160. const m_SHN_HIPROC = 0xff1f
  9161. const m_SHN_HIRESERVE = 0xffff
  9162. const m_SHN_LOOS = 0xff20
  9163. const m_SHN_LOPROC = 0xff00
  9164. const m_SHN_LORESERVE = 0xff00
  9165. const m_SHN_MIPS_ACOMMON = 0xff00
  9166. const m_SHN_MIPS_DATA = 0xff02
  9167. const m_SHN_MIPS_SCOMMON = 0xff03
  9168. const m_SHN_MIPS_SUNDEFINED = 0xff04
  9169. const m_SHN_MIPS_TEXT = 0xff01
  9170. const m_SHN_PARISC_ANSI_COMMON = 0xff00
  9171. const m_SHN_PARISC_HUGE_COMMON = 0xff01
  9172. const m_SHN_UNDEF = 0
  9173. const m_SHN_XINDEX = 0xffff
  9174. const m_SHT_ALPHA_DEBUG = 0x70000001
  9175. const m_SHT_ALPHA_REGINFO = 0x70000002
  9176. const m_SHT_CHECKSUM = 0x6ffffff8
  9177. const m_SHT_DYNAMIC = 6
  9178. const m_SHT_DYNSYM = 11
  9179. const m_SHT_FINI_ARRAY = 15
  9180. const m_SHT_GNU_ATTRIBUTES = 0x6ffffff5
  9181. const m_SHT_GNU_HASH = 0x6ffffff6
  9182. const m_SHT_GNU_LIBLIST = 0x6ffffff7
  9183. const m_SHT_GNU_verdef = 0x6ffffffd
  9184. const m_SHT_GNU_verneed = 0x6ffffffe
  9185. const m_SHT_GNU_versym = 0x6fffffff
  9186. const m_SHT_GROUP = 17
  9187. const m_SHT_HASH = 5
  9188. const m_SHT_HIOS = 0x6fffffff
  9189. const m_SHT_HIPROC = 0x7fffffff
  9190. const m_SHT_HISUNW = 0x6fffffff
  9191. const m_SHT_HIUSER = 0x8fffffff
  9192. const m_SHT_INIT_ARRAY = 14
  9193. const m_SHT_LOOS = 0x60000000
  9194. const m_SHT_LOPROC = 0x70000000
  9195. const m_SHT_LOSUNW = 0x6ffffffa
  9196. const m_SHT_LOUSER = 0x80000000
  9197. const m_SHT_MIPS_AUXSYM = 0x70000016
  9198. const m_SHT_MIPS_CONFLICT = 0x70000002
  9199. const m_SHT_MIPS_CONTENT = 0x7000000c
  9200. const m_SHT_MIPS_DEBUG = 0x70000005
  9201. const m_SHT_MIPS_DELTACLASS = 0x7000001d
  9202. const m_SHT_MIPS_DELTADECL = 0x7000001f
  9203. const m_SHT_MIPS_DELTAINST = 0x7000001c
  9204. const m_SHT_MIPS_DELTASYM = 0x7000001b
  9205. const m_SHT_MIPS_DENSE = 0x70000013
  9206. const m_SHT_MIPS_DWARF = 0x7000001e
  9207. const m_SHT_MIPS_EH_REGION = 0x70000027
  9208. const m_SHT_MIPS_EVENTS = 0x70000021
  9209. const m_SHT_MIPS_EXTSYM = 0x70000012
  9210. const m_SHT_MIPS_FDESC = 0x70000011
  9211. const m_SHT_MIPS_GPTAB = 0x70000003
  9212. const m_SHT_MIPS_IFACE = 0x7000000b
  9213. const m_SHT_MIPS_LIBLIST = 0x70000000
  9214. const m_SHT_MIPS_LINE = 0x70000019
  9215. const m_SHT_MIPS_LOCSTR = 0x70000018
  9216. const m_SHT_MIPS_LOCSYM = 0x70000015
  9217. const m_SHT_MIPS_MSYM = 0x70000001
  9218. const m_SHT_MIPS_OPTIONS = 0x7000000d
  9219. const m_SHT_MIPS_OPTSYM = 0x70000017
  9220. const m_SHT_MIPS_PACKAGE = 0x70000007
  9221. const m_SHT_MIPS_PACKSYM = 0x70000008
  9222. const m_SHT_MIPS_PDESC = 0x70000014
  9223. const m_SHT_MIPS_PDR_EXCEPTION = 0x70000029
  9224. const m_SHT_MIPS_PIXIE = 0x70000023
  9225. const m_SHT_MIPS_REGINFO = 0x70000006
  9226. const m_SHT_MIPS_RELD = 0x70000009
  9227. const m_SHT_MIPS_RFDESC = 0x7000001a
  9228. const m_SHT_MIPS_SHDR = 0x70000010
  9229. const m_SHT_MIPS_SYMBOL_LIB = 0x70000020
  9230. const m_SHT_MIPS_TRANSLATE = 0x70000022
  9231. const m_SHT_MIPS_UCODE = 0x70000004
  9232. const m_SHT_MIPS_WHIRL = 0x70000026
  9233. const m_SHT_MIPS_XLATE = 0x70000024
  9234. const m_SHT_MIPS_XLATE_DEBUG = 0x70000025
  9235. const m_SHT_MIPS_XLATE_OLD = 0x70000028
  9236. const m_SHT_NOBITS = 8
  9237. const m_SHT_NOTE = 7
  9238. const m_SHT_NULL = 0
  9239. const m_SHT_NUM = 20
  9240. const m_SHT_PARISC_DOC = 0x70000002
  9241. const m_SHT_PARISC_EXT = 0x70000000
  9242. const m_SHT_PARISC_UNWIND = 0x70000001
  9243. const m_SHT_PREINIT_ARRAY = 16
  9244. const m_SHT_PROGBITS = 1
  9245. const m_SHT_REL = 9
  9246. const m_SHT_RELA = 4
  9247. const m_SHT_RELR = 19
  9248. const m_SHT_SHLIB = 10
  9249. const m_SHT_STRTAB = 3
  9250. const m_SHT_SUNW_COMDAT = 0x6ffffffb
  9251. const m_SHT_SUNW_move = 0x6ffffffa
  9252. const m_SHT_SUNW_syminfo = 0x6ffffffc
  9253. const m_SHT_SYMTAB = 2
  9254. const m_SHT_SYMTAB_SHNDX = 18
  9255. const m_STB_GLOBAL = 1
  9256. const m_STB_GNU_UNIQUE = 10
  9257. const m_STB_HIOS = 12
  9258. const m_STB_HIPROC = 15
  9259. const m_STB_LOCAL = 0
  9260. const m_STB_LOOS = 10
  9261. const m_STB_LOPROC = 13
  9262. const m_STB_MIPS_SPLIT_COMMON = 13
  9263. const m_STB_NUM = 3
  9264. const m_STB_WEAK = 2
  9265. const m_STN_UNDEF = 0
  9266. const m_STO_ALPHA_NOPV = 0x80
  9267. const m_STO_ALPHA_STD_GPLOAD = 0x88
  9268. const m_STO_MIPS_DEFAULT = 0x0
  9269. const m_STO_MIPS_HIDDEN = 0x2
  9270. const m_STO_MIPS_INTERNAL = 0x1
  9271. const m_STO_MIPS_PLT = 0x8
  9272. const m_STO_MIPS_PROTECTED = 0x3
  9273. const m_STO_MIPS_SC_ALIGN_UNUSED = 0xff
  9274. const m_STO_PPC64_LOCAL_BIT = 5
  9275. const m_STO_PPC64_LOCAL_MASK = 0xe0
  9276. const m_STT_ARM_16BIT = "STT_HIPROC"
  9277. const m_STT_ARM_TFUNC = "STT_LOPROC"
  9278. const m_STT_COMMON = 5
  9279. const m_STT_FILE = 4
  9280. const m_STT_FUNC = 2
  9281. const m_STT_GNU_IFUNC = 10
  9282. const m_STT_HIOS = 12
  9283. const m_STT_HIPROC = 15
  9284. const m_STT_LOOS = 10
  9285. const m_STT_LOPROC = 13
  9286. const m_STT_NOTYPE = 0
  9287. const m_STT_NUM = 7
  9288. const m_STT_OBJECT = 1
  9289. const m_STT_PARISC_MILLICODE = 13
  9290. const m_STT_SECTION = 3
  9291. const m_STT_SPARC_REGISTER = 13
  9292. const m_STT_TLS = 6
  9293. const m_STV_DEFAULT = 0
  9294. const m_STV_HIDDEN = 2
  9295. const m_STV_INTERNAL = 1
  9296. const m_STV_PROTECTED = 3
  9297. const m_SYMINFO_BT_LOWRESERVE = 0xff00
  9298. const m_SYMINFO_BT_PARENT = 0xfffe
  9299. const m_SYMINFO_BT_SELF = 0xffff
  9300. const m_SYMINFO_CURRENT = 1
  9301. const m_SYMINFO_FLG_COPY = 0x0004
  9302. const m_SYMINFO_FLG_DIRECT = 0x0001
  9303. const m_SYMINFO_FLG_LAZYLOAD = 0x0008
  9304. const m_SYMINFO_FLG_PASSTHRU = 0x0002
  9305. const m_SYMINFO_NONE = 0
  9306. const m_SYMINFO_NUM = 2
  9307. const m_VER_DEF_CURRENT = 1
  9308. const m_VER_DEF_NONE = 0
  9309. const m_VER_DEF_NUM = 2
  9310. const m_VER_FLG_BASE = 0x1
  9311. const m_VER_FLG_WEAK = 0x2
  9312. const m_VER_NDX_ELIMINATE = 0xff01
  9313. const m_VER_NDX_GLOBAL = 1
  9314. const m_VER_NDX_LOCAL = 0
  9315. const m_VER_NDX_LORESERVE = 0xff00
  9316. const m_VER_NEED_CURRENT = 1
  9317. const m_VER_NEED_NONE = 0
  9318. const m_VER_NEED_NUM = 2
  9319. const m_n_hash = "n_desc"
  9320. type Tnlist = struct {
  9321. F__ccgo0_0 struct {
  9322. Fn_un [0]struct {
  9323. Fn_next [0]uintptr
  9324. Fn_strx [0]int64
  9325. Fn_name uintptr
  9326. }
  9327. Fn_name uintptr
  9328. }
  9329. Fn_type uint8
  9330. Fn_other uint8
  9331. Fn_desc int16
  9332. Fn_value uint64
  9333. }
  9334. type TElf32_Half = uint16
  9335. type TElf64_Half = uint16
  9336. type TElf32_Word = uint32
  9337. type TElf32_Sword = int32
  9338. type TElf64_Word = uint32
  9339. type TElf64_Sword = int32
  9340. type TElf32_Xword = uint64
  9341. type TElf32_Sxword = int64
  9342. type TElf64_Xword = uint64
  9343. type TElf64_Sxword = int64
  9344. type TElf32_Addr = uint32
  9345. type TElf64_Addr = uint64
  9346. type TElf32_Off = uint32
  9347. type TElf64_Off = uint64
  9348. type TElf32_Section = uint16
  9349. type TElf64_Section = uint16
  9350. type TElf32_Versym = uint16
  9351. type TElf64_Versym = uint16
  9352. type TElf32_Ehdr = struct {
  9353. Fe_ident [16]uint8
  9354. Fe_type TElf32_Half
  9355. Fe_machine TElf32_Half
  9356. Fe_version TElf32_Word
  9357. Fe_entry TElf32_Addr
  9358. Fe_phoff TElf32_Off
  9359. Fe_shoff TElf32_Off
  9360. Fe_flags TElf32_Word
  9361. Fe_ehsize TElf32_Half
  9362. Fe_phentsize TElf32_Half
  9363. Fe_phnum TElf32_Half
  9364. Fe_shentsize TElf32_Half
  9365. Fe_shnum TElf32_Half
  9366. Fe_shstrndx TElf32_Half
  9367. }
  9368. type TElf64_Ehdr = struct {
  9369. Fe_ident [16]uint8
  9370. Fe_type TElf64_Half
  9371. Fe_machine TElf64_Half
  9372. Fe_version TElf64_Word
  9373. Fe_entry TElf64_Addr
  9374. Fe_phoff TElf64_Off
  9375. Fe_shoff TElf64_Off
  9376. Fe_flags TElf64_Word
  9377. Fe_ehsize TElf64_Half
  9378. Fe_phentsize TElf64_Half
  9379. Fe_phnum TElf64_Half
  9380. Fe_shentsize TElf64_Half
  9381. Fe_shnum TElf64_Half
  9382. Fe_shstrndx TElf64_Half
  9383. }
  9384. type TElf32_Shdr = struct {
  9385. Fsh_name TElf32_Word
  9386. Fsh_type TElf32_Word
  9387. Fsh_flags TElf32_Word
  9388. Fsh_addr TElf32_Addr
  9389. Fsh_offset TElf32_Off
  9390. Fsh_size TElf32_Word
  9391. Fsh_link TElf32_Word
  9392. Fsh_info TElf32_Word
  9393. Fsh_addralign TElf32_Word
  9394. Fsh_entsize TElf32_Word
  9395. }
  9396. type TElf64_Shdr = struct {
  9397. Fsh_name TElf64_Word
  9398. Fsh_type TElf64_Word
  9399. Fsh_flags TElf64_Xword
  9400. Fsh_addr TElf64_Addr
  9401. Fsh_offset TElf64_Off
  9402. Fsh_size TElf64_Xword
  9403. Fsh_link TElf64_Word
  9404. Fsh_info TElf64_Word
  9405. Fsh_addralign TElf64_Xword
  9406. Fsh_entsize TElf64_Xword
  9407. }
  9408. type TElf32_Chdr = struct {
  9409. Fch_type TElf32_Word
  9410. Fch_size TElf32_Word
  9411. Fch_addralign TElf32_Word
  9412. }
  9413. type TElf64_Chdr = struct {
  9414. Fch_type TElf64_Word
  9415. Fch_reserved TElf64_Word
  9416. Fch_size TElf64_Xword
  9417. Fch_addralign TElf64_Xword
  9418. }
  9419. type TElf32_Sym = struct {
  9420. Fst_name TElf32_Word
  9421. Fst_value TElf32_Addr
  9422. Fst_size TElf32_Word
  9423. Fst_info uint8
  9424. Fst_other uint8
  9425. Fst_shndx TElf32_Section
  9426. }
  9427. type TElf64_Sym = struct {
  9428. Fst_name TElf64_Word
  9429. Fst_info uint8
  9430. Fst_other uint8
  9431. Fst_shndx TElf64_Section
  9432. Fst_value TElf64_Addr
  9433. Fst_size TElf64_Xword
  9434. }
  9435. type TElf32_Syminfo = struct {
  9436. Fsi_boundto TElf32_Half
  9437. Fsi_flags TElf32_Half
  9438. }
  9439. type TElf64_Syminfo = struct {
  9440. Fsi_boundto TElf64_Half
  9441. Fsi_flags TElf64_Half
  9442. }
  9443. type TElf32_Rel = struct {
  9444. Fr_offset TElf32_Addr
  9445. Fr_info TElf32_Word
  9446. }
  9447. type TElf64_Rel = struct {
  9448. Fr_offset TElf64_Addr
  9449. Fr_info TElf64_Xword
  9450. }
  9451. type TElf32_Rela = struct {
  9452. Fr_offset TElf32_Addr
  9453. Fr_info TElf32_Word
  9454. Fr_addend TElf32_Sword
  9455. }
  9456. type TElf64_Rela = struct {
  9457. Fr_offset TElf64_Addr
  9458. Fr_info TElf64_Xword
  9459. Fr_addend TElf64_Sxword
  9460. }
  9461. type TElf32_Relr = uint32
  9462. type TElf64_Relr = uint64
  9463. type TElf32_Phdr = struct {
  9464. Fp_type TElf32_Word
  9465. Fp_offset TElf32_Off
  9466. Fp_vaddr TElf32_Addr
  9467. Fp_paddr TElf32_Addr
  9468. Fp_filesz TElf32_Word
  9469. Fp_memsz TElf32_Word
  9470. Fp_flags TElf32_Word
  9471. Fp_align TElf32_Word
  9472. }
  9473. type TElf64_Phdr = struct {
  9474. Fp_type TElf64_Word
  9475. Fp_flags TElf64_Word
  9476. Fp_offset TElf64_Off
  9477. Fp_vaddr TElf64_Addr
  9478. Fp_paddr TElf64_Addr
  9479. Fp_filesz TElf64_Xword
  9480. Fp_memsz TElf64_Xword
  9481. Fp_align TElf64_Xword
  9482. }
  9483. type TElf32_Dyn = struct {
  9484. Fd_tag TElf32_Sword
  9485. Fd_un struct {
  9486. Fd_ptr [0]TElf32_Addr
  9487. Fd_val TElf32_Word
  9488. }
  9489. }
  9490. type TElf64_Dyn = struct {
  9491. Fd_tag TElf64_Sxword
  9492. Fd_un struct {
  9493. Fd_ptr [0]TElf64_Addr
  9494. Fd_val TElf64_Xword
  9495. }
  9496. }
  9497. type TElf32_Verdef = struct {
  9498. Fvd_version TElf32_Half
  9499. Fvd_flags TElf32_Half
  9500. Fvd_ndx TElf32_Half
  9501. Fvd_cnt TElf32_Half
  9502. Fvd_hash TElf32_Word
  9503. Fvd_aux TElf32_Word
  9504. Fvd_next TElf32_Word
  9505. }
  9506. type TElf64_Verdef = struct {
  9507. Fvd_version TElf64_Half
  9508. Fvd_flags TElf64_Half
  9509. Fvd_ndx TElf64_Half
  9510. Fvd_cnt TElf64_Half
  9511. Fvd_hash TElf64_Word
  9512. Fvd_aux TElf64_Word
  9513. Fvd_next TElf64_Word
  9514. }
  9515. type TElf32_Verdaux = struct {
  9516. Fvda_name TElf32_Word
  9517. Fvda_next TElf32_Word
  9518. }
  9519. type TElf64_Verdaux = struct {
  9520. Fvda_name TElf64_Word
  9521. Fvda_next TElf64_Word
  9522. }
  9523. type TElf32_Verneed = struct {
  9524. Fvn_version TElf32_Half
  9525. Fvn_cnt TElf32_Half
  9526. Fvn_file TElf32_Word
  9527. Fvn_aux TElf32_Word
  9528. Fvn_next TElf32_Word
  9529. }
  9530. type TElf64_Verneed = struct {
  9531. Fvn_version TElf64_Half
  9532. Fvn_cnt TElf64_Half
  9533. Fvn_file TElf64_Word
  9534. Fvn_aux TElf64_Word
  9535. Fvn_next TElf64_Word
  9536. }
  9537. type TElf32_Vernaux = struct {
  9538. Fvna_hash TElf32_Word
  9539. Fvna_flags TElf32_Half
  9540. Fvna_other TElf32_Half
  9541. Fvna_name TElf32_Word
  9542. Fvna_next TElf32_Word
  9543. }
  9544. type TElf64_Vernaux = struct {
  9545. Fvna_hash TElf64_Word
  9546. Fvna_flags TElf64_Half
  9547. Fvna_other TElf64_Half
  9548. Fvna_name TElf64_Word
  9549. Fvna_next TElf64_Word
  9550. }
  9551. type TElf32_auxv_t = struct {
  9552. Fa_type Tuint32_t
  9553. Fa_un struct {
  9554. Fa_val Tuint32_t
  9555. }
  9556. }
  9557. type TElf64_auxv_t = struct {
  9558. Fa_type Tuint64_t
  9559. Fa_un struct {
  9560. Fa_val Tuint64_t
  9561. }
  9562. }
  9563. type TElf32_Nhdr = struct {
  9564. Fn_namesz TElf32_Word
  9565. Fn_descsz TElf32_Word
  9566. Fn_type TElf32_Word
  9567. }
  9568. type TElf64_Nhdr = struct {
  9569. Fn_namesz TElf64_Word
  9570. Fn_descsz TElf64_Word
  9571. Fn_type TElf64_Word
  9572. }
  9573. type TElf32_Move = struct {
  9574. Fm_value TElf32_Xword
  9575. Fm_info TElf32_Word
  9576. Fm_poffset TElf32_Word
  9577. Fm_repeat TElf32_Half
  9578. Fm_stride TElf32_Half
  9579. }
  9580. type TElf64_Move = struct {
  9581. Fm_value TElf64_Xword
  9582. Fm_info TElf64_Xword
  9583. Fm_poffset TElf64_Xword
  9584. Fm_repeat TElf64_Half
  9585. Fm_stride TElf64_Half
  9586. }
  9587. type TElf32_gptab = struct {
  9588. Fgt_entry [0]struct {
  9589. Fgt_g_value TElf32_Word
  9590. Fgt_bytes TElf32_Word
  9591. }
  9592. Fgt_header struct {
  9593. Fgt_current_g_value TElf32_Word
  9594. Fgt_unused TElf32_Word
  9595. }
  9596. }
  9597. type TElf32_RegInfo = struct {
  9598. Fri_gprmask TElf32_Word
  9599. Fri_cprmask [4]TElf32_Word
  9600. Fri_gp_value TElf32_Sword
  9601. }
  9602. type TElf_Options = struct {
  9603. Fkind uint8
  9604. Fsize uint8
  9605. Fsection TElf32_Section
  9606. Finfo TElf32_Word
  9607. }
  9608. type TElf_Options_Hw = struct {
  9609. Fhwp_flags1 TElf32_Word
  9610. Fhwp_flags2 TElf32_Word
  9611. }
  9612. type TElf32_Lib = struct {
  9613. Fl_name TElf32_Word
  9614. Fl_time_stamp TElf32_Word
  9615. Fl_checksum TElf32_Word
  9616. Fl_version TElf32_Word
  9617. Fl_flags TElf32_Word
  9618. }
  9619. type TElf64_Lib = struct {
  9620. Fl_name TElf64_Word
  9621. Fl_time_stamp TElf64_Word
  9622. Fl_checksum TElf64_Word
  9623. Fl_version TElf64_Word
  9624. Fl_flags TElf64_Word
  9625. }
  9626. type TElf32_Conflict = uint32
  9627. type TElf_MIPS_ABIFlags_v0 = struct {
  9628. Fversion TElf32_Half
  9629. Fisa_level uint8
  9630. Fisa_rev uint8
  9631. Fgpr_size uint8
  9632. Fcpr1_size uint8
  9633. Fcpr2_size uint8
  9634. Ffp_abi uint8
  9635. Fisa_ext TElf32_Word
  9636. Fases TElf32_Word
  9637. Fflags1 TElf32_Word
  9638. Fflags2 TElf32_Word
  9639. }
  9640. const _Val_GNU_MIPS_ABI_FP_ANY = 0
  9641. const _Val_GNU_MIPS_ABI_FP_DOUBLE = 1
  9642. const _Val_GNU_MIPS_ABI_FP_SINGLE = 2
  9643. const _Val_GNU_MIPS_ABI_FP_SOFT = 3
  9644. const _Val_GNU_MIPS_ABI_FP_OLD_64 = 4
  9645. const _Val_GNU_MIPS_ABI_FP_XX = 5
  9646. const _Val_GNU_MIPS_ABI_FP_64 = 6
  9647. const _Val_GNU_MIPS_ABI_FP_64A = 7
  9648. const _Val_GNU_MIPS_ABI_FP_MAX = 7
  9649. // C documentation
  9650. //
  9651. // /*
  9652. // * __elf_is_okay__ - Determine if ehdr really
  9653. // * is ELF and valid for the target platform.
  9654. // *
  9655. // * WARNING: This is NOT an ELF ABI function and
  9656. // * as such its use should be restricted.
  9657. // */
  9658. func ___elf_is_okay__(tls *libc.TLS, ehdr uintptr) (r int32) {
  9659. var retval int32
  9660. _ = retval
  9661. retval = 0
  9662. /*
  9663. * We need to check magic, class size, endianess,
  9664. * and version before we look at the rest of the
  9665. * Elf_Ehdr structure. These few elements are
  9666. * represented in a machine independent fashion.
  9667. */
  9668. 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) {
  9669. /* Now check the machine dependent header */
  9670. if libc.Int32FromUint16((*TElf64_Ehdr)(unsafe.Pointer(ehdr)).Fe_machine) == int32(m_EM_PPC64) && (*TElf64_Ehdr)(unsafe.Pointer(ehdr)).Fe_version == uint32(m_EV_CURRENT) {
  9671. retval = int32(1)
  9672. }
  9673. }
  9674. return retval
  9675. }
  9676. // C documentation
  9677. //
  9678. // /*
  9679. // * Convert an Elf_Sym into an nlist structure. This fills in only the
  9680. // * n_value and n_type members.
  9681. // */
  9682. func _elf_sym_to_nlist(tls *libc.TLS, nl uintptr, s uintptr, shdr uintptr, shnum int32) {
  9683. var sh, p5 uintptr
  9684. var v1, v2, v3, v4 int32
  9685. _, _, _, _, _, _ = sh, v1, v2, v3, v4, p5
  9686. (*Tnlist)(unsafe.Pointer(nl)).Fn_value = (*TElf64_Sym)(unsafe.Pointer(s)).Fst_value
  9687. switch libc.Int32FromUint16((*TElf64_Sym)(unsafe.Pointer(s)).Fst_shndx) {
  9688. case m_SHN_UNDEF:
  9689. fallthrough
  9690. case int32(m_SHN_COMMON):
  9691. (*Tnlist)(unsafe.Pointer(nl)).Fn_type = uint8(m_N_UNDF)
  9692. case int32(m_SHN_ABS):
  9693. if libc.Int32FromUint8((*TElf64_Sym)(unsafe.Pointer(s)).Fst_info)&int32(0xf) == int32(m_STT_FILE) {
  9694. v1 = int32(m_N_FN)
  9695. } else {
  9696. v1 = int32(m_N_ABS)
  9697. }
  9698. (*Tnlist)(unsafe.Pointer(nl)).Fn_type = libc.Uint8FromInt32(v1)
  9699. default:
  9700. if libc.Int32FromUint16((*TElf64_Sym)(unsafe.Pointer(s)).Fst_shndx) >= shnum {
  9701. (*Tnlist)(unsafe.Pointer(nl)).Fn_type = uint8(m_N_UNDF)
  9702. } else {
  9703. sh = shdr + uintptr((*TElf64_Sym)(unsafe.Pointer(s)).Fst_shndx)*64
  9704. if (*TElf64_Shdr)(unsafe.Pointer(sh)).Fsh_type == uint32(m_SHT_PROGBITS) {
  9705. if (*TElf64_Shdr)(unsafe.Pointer(sh)).Fsh_flags&libc.Uint64FromInt32(libc.Int32FromInt32(1)<<libc.Int32FromInt32(0)) != 0 {
  9706. v3 = int32(m_N_DATA)
  9707. } else {
  9708. v3 = int32(m_N_TEXT)
  9709. }
  9710. v2 = v3
  9711. } else {
  9712. if (*TElf64_Shdr)(unsafe.Pointer(sh)).Fsh_type == uint32(m_SHT_NOBITS) {
  9713. v4 = int32(m_N_BSS)
  9714. } else {
  9715. v4 = m_N_UNDF
  9716. }
  9717. v2 = v4
  9718. }
  9719. (*Tnlist)(unsafe.Pointer(nl)).Fn_type = libc.Uint8FromInt32(v2)
  9720. }
  9721. break
  9722. }
  9723. 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) {
  9724. p5 = nl + 8
  9725. *(*uint8)(unsafe.Pointer(p5)) = uint8(int32(*(*uint8)(unsafe.Pointer(p5))) | libc.Int32FromInt32(m_N_EXT))
  9726. }
  9727. }
  9728. func X__fdnlist(tls *libc.TLS, fd int32, list uintptr) (r int32) {
  9729. bp := tls.Alloc(24784)
  9730. defer tls.Free(24784)
  9731. var cc, i TElf64_Sword
  9732. var errsave, nent, v6 int32
  9733. var name, p, s, shdr, strtab uintptr
  9734. var shdr_size, size, symsize, symstrsize TElf64_Word
  9735. var symoff, symstroff TElf64_Off
  9736. var v3 uint64
  9737. var _ /* ehdr at bp+24576 */ TElf64_Ehdr
  9738. var _ /* sbuf at bp+0 */ [1024]TElf64_Sym
  9739. var _ /* st at bp+24640 */ Tstat
  9740. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = cc, errsave, i, name, nent, p, s, shdr, shdr_size, size, strtab, symoff, symsize, symstroff, symstrsize, v3, v6
  9741. symoff = uint64(0)
  9742. symstroff = uint64(0)
  9743. symsize = uint32(0)
  9744. symstrsize = uint32(0)
  9745. nent = -int32(1)
  9746. strtab = libc.UintptrFromInt32(0)
  9747. shdr = libc.UintptrFromInt32(0)
  9748. /* Make sure obj is OK */
  9749. 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 {
  9750. return -int32(1)
  9751. }
  9752. if libc.Int32FromUint16((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shnum) == 0 || uint64((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shentsize) != uint64(64) {
  9753. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ERANGE)
  9754. return -int32(1)
  9755. }
  9756. /* calculate section header table size */
  9757. shdr_size = libc.Uint32FromInt32(libc.Int32FromUint16((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shentsize) * libc.Int32FromUint16((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shnum))
  9758. /* Make sure it's not too big to mmap */
  9759. if libc.Int64FromUint32(shdr_size) > (*(*Tstat)(unsafe.Pointer(bp + 24640))).Fst_size {
  9760. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EFBIG)
  9761. return -int32(1)
  9762. }
  9763. shdr = libc.Xmalloc(tls, uint64(shdr_size))
  9764. if shdr == libc.UintptrFromInt32(0) {
  9765. return -int32(1)
  9766. }
  9767. /* Load section header table. */
  9768. if libc.Xpread(tls, fd, shdr, uint64(shdr_size), libc.Int64FromUint64((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shoff)) != libc.Int64FromUint32(shdr_size) {
  9769. goto done
  9770. }
  9771. /*
  9772. * Find the symbol table entry and it's corresponding
  9773. * string table entry. Version 1.1 of the ABI states
  9774. * that there is only one symbol table but that this
  9775. * could change in the future.
  9776. */
  9777. i = 0
  9778. for {
  9779. if !(i < libc.Int32FromUint16((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shnum)) {
  9780. break
  9781. }
  9782. if (*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_type == uint32(m_SHT_SYMTAB) {
  9783. if (*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_link >= uint32((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shnum) {
  9784. goto done
  9785. }
  9786. symoff = (*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_offset
  9787. symsize = uint32((*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_size)
  9788. symstroff = (*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr((*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_link)*64))).Fsh_offset
  9789. symstrsize = uint32((*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr((*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_link)*64))).Fsh_size)
  9790. break
  9791. }
  9792. goto _1
  9793. _1:
  9794. ;
  9795. i++
  9796. }
  9797. /* Check for files too large to mmap. */
  9798. if libc.Int64FromUint32(symstrsize) > (*(*Tstat)(unsafe.Pointer(bp + 24640))).Fst_size {
  9799. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EFBIG)
  9800. goto done
  9801. }
  9802. /*
  9803. * Load string table into our address space. This gives us
  9804. * an easy way to randomly access all the strings, without
  9805. * making the memory allocation permanent as with malloc/free
  9806. * (i.e., munmap will return it to the system).
  9807. */
  9808. strtab = libc.Xmalloc(tls, uint64(symstrsize))
  9809. if strtab == libc.UintptrFromInt32(0) {
  9810. goto done
  9811. }
  9812. if libc.Xpread(tls, fd, strtab, uint64(symstrsize), libc.Int64FromUint64(symstroff)) != libc.Int64FromUint32(symstrsize) {
  9813. goto done
  9814. }
  9815. /*
  9816. * clean out any left-over information for all valid entries.
  9817. * Type and value defined to be 0 if not found; historical
  9818. * versions cleared other and desc as well. Also figure out
  9819. * the largest string length so don't read any more of the
  9820. * string table than we have to.
  9821. *
  9822. * XXX clearing anything other than n_type and n_value violates
  9823. * the semantics given in the man page.
  9824. */
  9825. nent = 0
  9826. p = list
  9827. for {
  9828. if !!(*(*uintptr)(unsafe.Pointer(p)) == uintptr(0) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p))))) == 0) {
  9829. break
  9830. }
  9831. (*Tnlist)(unsafe.Pointer(p)).Fn_type = uint8(0)
  9832. (*Tnlist)(unsafe.Pointer(p)).Fn_other = uint8(0)
  9833. (*Tnlist)(unsafe.Pointer(p)).Fn_desc = 0
  9834. (*Tnlist)(unsafe.Pointer(p)).Fn_value = uint64(0)
  9835. nent++
  9836. goto _2
  9837. _2:
  9838. ;
  9839. p += 24
  9840. }
  9841. /* Don't process any further if object is stripped. */
  9842. if symoff == uint64(0) {
  9843. goto done
  9844. }
  9845. if libc.Xlseek(tls, fd, libc.Int64FromUint64(symoff), 0) == int64(-int32(1)) {
  9846. nent = -int32(1)
  9847. goto done
  9848. }
  9849. for symsize > uint32(0) && nent > 0 {
  9850. if uint64(symsize) < libc.Uint64FromInt64(24576) {
  9851. v3 = uint64(symsize)
  9852. } else {
  9853. v3 = libc.Uint64FromInt64(24576)
  9854. }
  9855. cc = libc.Int32FromUint64(v3)
  9856. if libc.Xread(tls, fd, bp, libc.Uint64FromInt32(cc)) != int64(cc) {
  9857. break
  9858. }
  9859. symsize -= libc.Uint32FromInt32(cc)
  9860. s = bp
  9861. for {
  9862. if !(cc > 0 && nent > 0) {
  9863. break
  9864. }
  9865. name = strtab + uintptr((*TElf64_Sym)(unsafe.Pointer(s)).Fst_name)
  9866. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(name))) == int32('\000') {
  9867. goto _4
  9868. }
  9869. size = symstrsize - (*TElf64_Sym)(unsafe.Pointer(s)).Fst_name
  9870. p = list
  9871. for {
  9872. if !!(*(*uintptr)(unsafe.Pointer(p)) == uintptr(0) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p))))) == 0) {
  9873. break
  9874. }
  9875. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p))))) == int32('_') && libc.Xstrncmp(tls, name, *(*uintptr)(unsafe.Pointer(p))+uintptr(1), uint64(size)) == 0 || libc.Xstrncmp(tls, name, *(*uintptr)(unsafe.Pointer(p)), uint64(size)) == 0 {
  9876. _elf_sym_to_nlist(tls, p, s, shdr, libc.Int32FromUint16((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shnum))
  9877. nent--
  9878. v6 = nent
  9879. if v6 <= 0 {
  9880. break
  9881. }
  9882. }
  9883. goto _5
  9884. _5:
  9885. ;
  9886. p += 24
  9887. }
  9888. goto _4
  9889. _4:
  9890. ;
  9891. s += 24
  9892. cc = TElf64_Sword(uint64(cc) - libc.Uint64FromInt64(24))
  9893. }
  9894. }
  9895. goto done
  9896. done:
  9897. ;
  9898. errsave = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9899. libc.Xfree(tls, strtab)
  9900. libc.Xfree(tls, shdr)
  9901. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = errsave
  9902. return nent
  9903. }
  9904. func Xnlist(tls *libc.TLS, name uintptr, list uintptr) (r int32) {
  9905. bp := tls.Alloc(16)
  9906. defer tls.Free(16)
  9907. var fd, n int32
  9908. _, _ = fd, n
  9909. if list == libc.UintptrFromInt32(0) {
  9910. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  9911. return -int32(1)
  9912. }
  9913. fd = libc.Xopen(tls, name, m_O_RDONLY1, libc.VaList(bp+8, 0))
  9914. if fd < 0 {
  9915. return -int32(1)
  9916. }
  9917. n = X__fdnlist(tls, fd, list)
  9918. libc.Xclose(tls, fd)
  9919. return n
  9920. }
  9921. const m_O_CREAT3 = 64
  9922. const m_O_NONBLOCK3 = 2048
  9923. const m_O_TRUNC3 = 512
  9924. const m_O_WRONLY1 = 1
  9925. type Tpidfh = struct {
  9926. Fpf_fd int32
  9927. Fpf_path uintptr
  9928. Fpf_dev Tdev_t
  9929. Fpf_ino Tino_t
  9930. }
  9931. func _pidfile_verify(tls *libc.TLS, pfh uintptr) (r int32) {
  9932. bp := tls.Alloc(144)
  9933. defer tls.Free(144)
  9934. var _ /* sb at bp+0 */ Tstat
  9935. if pfh == libc.UintptrFromInt32(0) || (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd == -int32(1) {
  9936. return int32(m_EINVAL)
  9937. }
  9938. /*
  9939. * Check remembered descriptor.
  9940. */
  9941. if libc.Xfstat(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd, bp) == -int32(1) {
  9942. return *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9943. }
  9944. 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 {
  9945. return int32(m_EINVAL)
  9946. }
  9947. return 0
  9948. }
  9949. func _pidfile_read(tls *libc.TLS, path uintptr, pidptr uintptr) (r int32) {
  9950. bp := tls.Alloc(32)
  9951. defer tls.Free(32)
  9952. var error1, fd, i int32
  9953. var _ /* buf at bp+0 */ [16]uint8
  9954. var _ /* endptr at bp+16 */ uintptr
  9955. _, _, _ = error1, fd, i
  9956. fd = libc.Xopen(tls, path, m_O_RDONLY1, 0)
  9957. if fd == -int32(1) {
  9958. return *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9959. }
  9960. i = int32(libc.Xread(tls, fd, bp, libc.Uint64FromInt64(16)-libc.Uint64FromInt32(1)))
  9961. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) /* Remember errno in case close() wants to change it. */
  9962. libc.Xclose(tls, fd)
  9963. if i == -int32(1) {
  9964. return error1
  9965. } else {
  9966. if i == 0 {
  9967. return int32(m_EAGAIN)
  9968. }
  9969. }
  9970. (*(*[16]uint8)(unsafe.Pointer(bp)))[i] = uint8('\000')
  9971. *(*Tpid_t)(unsafe.Pointer(pidptr)) = int32(libc.Xstrtol(tls, bp, bp+16, int32(10)))
  9972. if *(*uintptr)(unsafe.Pointer(bp + 16)) != bp+uintptr(i) {
  9973. return int32(m_EINVAL)
  9974. }
  9975. return 0
  9976. }
  9977. func Xpidfile_open(tls *libc.TLS, path uintptr, mode Tmode_t, pidptr uintptr) (r uintptr) {
  9978. bp := tls.Alloc(176)
  9979. defer tls.Free(176)
  9980. var count, error1, fd, len1, v2 int32
  9981. var pfh uintptr
  9982. var v3 bool
  9983. var _ /* rqtp at bp+144 */ Ttimespec
  9984. var _ /* sb at bp+0 */ Tstat
  9985. _, _, _, _, _, _, _ = count, error1, fd, len1, pfh, v2, v3
  9986. pfh = libc.Xmalloc(tls, uint64(32))
  9987. if pfh == libc.UintptrFromInt32(0) {
  9988. return libc.UintptrFromInt32(0)
  9989. }
  9990. if path == libc.UintptrFromInt32(0) {
  9991. len1 = libc.Xasprintf(tls, pfh+8, __ccgo_ts+310, libc.VaList(bp+168, Xgetprogname(tls)))
  9992. if len1 < 0 {
  9993. libc.Xfree(tls, pfh)
  9994. return libc.UintptrFromInt32(0)
  9995. }
  9996. } else {
  9997. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path = libc.Xstrdup(tls, path)
  9998. }
  9999. /*
  10000. * Open the PID file and obtain exclusive lock.
  10001. * We truncate PID file here only to remove old PID immediately,
  10002. * PID file will be truncated again in pidfile_write(), so
  10003. * pidfile_write() can be called multiple times.
  10004. */
  10005. fd = Xflopen(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path, libc.Int32FromInt32(m_O_WRONLY1)|libc.Int32FromInt32(m_O_CREAT3)|libc.Int32FromInt32(m_O_TRUNC3)|libc.Int32FromInt32(m_O_NONBLOCK3), libc.VaList(bp+168, mode))
  10006. if fd == -int32(1) {
  10007. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EAGAIN) {
  10008. if pidptr == libc.UintptrFromInt32(0) {
  10009. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EEXIST)
  10010. } else {
  10011. count = int32(20)
  10012. (*(*Ttimespec)(unsafe.Pointer(bp + 144))).Ftv_sec = 0
  10013. (*(*Ttimespec)(unsafe.Pointer(bp + 144))).Ftv_nsec = int64(5000000)
  10014. for {
  10015. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = _pidfile_read(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path, pidptr)
  10016. if v3 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) != int32(m_EAGAIN); !v3 {
  10017. count--
  10018. v2 = count
  10019. }
  10020. if v3 || v2 == 0 {
  10021. break
  10022. }
  10023. libc.Xnanosleep(tls, bp+144, uintptr(0))
  10024. goto _1
  10025. _1:
  10026. }
  10027. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EAGAIN) {
  10028. *(*Tpid_t)(unsafe.Pointer(pidptr)) = -int32(1)
  10029. }
  10030. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == 0 || *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EAGAIN) {
  10031. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EEXIST)
  10032. }
  10033. }
  10034. }
  10035. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10036. libc.Xfree(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  10037. libc.Xfree(tls, pfh)
  10038. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  10039. return libc.UintptrFromInt32(0)
  10040. }
  10041. /*
  10042. * Remember file information, so in pidfile_write() we are sure we write
  10043. * to the proper descriptor.
  10044. */
  10045. if libc.Xfstat(tls, fd, bp) == -int32(1) {
  10046. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10047. libc.Xunlink(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  10048. libc.Xfree(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  10049. libc.Xclose(tls, fd)
  10050. libc.Xfree(tls, pfh)
  10051. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  10052. return libc.UintptrFromInt32(0)
  10053. }
  10054. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd = fd
  10055. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_dev = (*(*Tstat)(unsafe.Pointer(bp))).Fst_dev
  10056. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_ino = (*(*Tstat)(unsafe.Pointer(bp))).Fst_ino
  10057. return pfh
  10058. }
  10059. func Xpidfile_write(tls *libc.TLS, pfh uintptr) (r int32) {
  10060. bp := tls.Alloc(32)
  10061. defer tls.Free(32)
  10062. var error1, fd int32
  10063. var _ /* pidstr at bp+0 */ [16]uint8
  10064. _, _ = error1, fd
  10065. /*
  10066. * Check remembered descriptor, so we don't overwrite some other
  10067. * file if pidfile was closed and descriptor reused.
  10068. */
  10069. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = _pidfile_verify(tls, pfh)
  10070. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) != 0 {
  10071. /*
  10072. * Don't close descriptor, because we are not sure if it's ours.
  10073. */
  10074. return -int32(1)
  10075. }
  10076. fd = (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd
  10077. /*
  10078. * Truncate PID file, so multiple calls of pidfile_write() are allowed.
  10079. */
  10080. if libc.Xftruncate(tls, fd, 0) == -int32(1) {
  10081. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10082. __pidfile_remove(tls, pfh, 0)
  10083. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  10084. return -int32(1)
  10085. }
  10086. libc.X__builtin_snprintf(tls, bp, uint64(16), __ccgo_ts+326, libc.VaList(bp+24, libc.Xgetpid(tls)))
  10087. if libc.Xpwrite(tls, fd, bp, libc.Xstrlen(tls, bp), 0) != libc.Int64FromUint64(libc.Xstrlen(tls, bp)) {
  10088. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10089. __pidfile_remove(tls, pfh, 0)
  10090. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  10091. return -int32(1)
  10092. }
  10093. return 0
  10094. }
  10095. func Xpidfile_close(tls *libc.TLS, pfh uintptr) (r int32) {
  10096. var error1 int32
  10097. _ = error1
  10098. error1 = _pidfile_verify(tls, pfh)
  10099. if error1 != 0 {
  10100. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  10101. return -int32(1)
  10102. }
  10103. if libc.Xclose(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd) == -int32(1) {
  10104. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10105. }
  10106. libc.Xfree(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  10107. libc.Xfree(tls, pfh)
  10108. if error1 != 0 {
  10109. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  10110. return -int32(1)
  10111. }
  10112. return 0
  10113. }
  10114. func __pidfile_remove(tls *libc.TLS, pfh uintptr, freeit int32) (r int32) {
  10115. var error1 int32
  10116. _ = error1
  10117. error1 = _pidfile_verify(tls, pfh)
  10118. if error1 != 0 {
  10119. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  10120. return -int32(1)
  10121. }
  10122. if libc.Xunlink(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path) == -int32(1) {
  10123. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10124. }
  10125. if libc.Xclose(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd) == -int32(1) {
  10126. if error1 == 0 {
  10127. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10128. }
  10129. }
  10130. if freeit != 0 {
  10131. libc.Xfree(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  10132. libc.Xfree(tls, pfh)
  10133. } else {
  10134. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd = -int32(1)
  10135. }
  10136. if error1 != 0 {
  10137. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  10138. return -int32(1)
  10139. }
  10140. return 0
  10141. }
  10142. func Xpidfile_remove(tls *libc.TLS, pfh uintptr) (r int32) {
  10143. return __pidfile_remove(tls, pfh, int32(1))
  10144. }
  10145. func Xpidfile_fileno(tls *libc.TLS, pfh uintptr) (r int32) {
  10146. if pfh == libc.UintptrFromInt32(0) || (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd == -int32(1) {
  10147. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  10148. return -int32(1)
  10149. }
  10150. return (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd
  10151. }
  10152. const m_SPT_MAXTITLE = 255
  10153. const m___bool_true_false_are_defined = 1
  10154. const m_false = 0
  10155. const m_true = 1
  10156. /*
  10157. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  10158. *
  10159. * Redistribution and use in source and binary forms, with or without
  10160. * modification, are permitted provided that the following conditions
  10161. * are met:
  10162. * 1. Redistributions of source code must retain the above copyright
  10163. * notice, this list of conditions and the following disclaimer.
  10164. * 2. Redistributions in binary form must reproduce the above copyright
  10165. * notice, this list of conditions and the following disclaimer in the
  10166. * documentation and/or other materials provided with the distribution.
  10167. * 3. The name of the author may not be used to endorse or promote products
  10168. * derived from this software without specific prior written permission.
  10169. *
  10170. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  10171. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  10172. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  10173. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  10174. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  10175. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  10176. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  10177. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  10178. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  10179. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  10180. */
  10181. /*
  10182. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  10183. *
  10184. * Redistribution and use in source and binary forms, with or without
  10185. * modification, are permitted provided that the following conditions
  10186. * are met:
  10187. * 1. Redistributions of source code must retain the above copyright
  10188. * notice, this list of conditions and the following disclaimer.
  10189. * 2. Redistributions in binary form must reproduce the above copyright
  10190. * notice, this list of conditions and the following disclaimer in the
  10191. * documentation and/or other materials provided with the distribution.
  10192. * 3. The name of the author may not be used to endorse or promote products
  10193. * derived from this software without specific prior written permission.
  10194. *
  10195. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  10196. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  10197. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  10198. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  10199. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  10200. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  10201. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  10202. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  10203. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  10204. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  10205. */
  10206. /* Clang expands this to 1 if an identifier is *not* reserved. */
  10207. /*
  10208. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  10209. * musl, try to handle this gracefully.
  10210. */
  10211. /* Copyright (C) 1992-2020 Free Software Foundation, Inc.
  10212. This file is part of the GNU C Library.
  10213. The GNU C Library is free software; you can redistribute it and/or
  10214. modify it under the terms of the GNU Lesser General Public
  10215. License as published by the Free Software Foundation; either
  10216. version 2.1 of the License, or (at your option) any later version.
  10217. The GNU C Library is distributed in the hope that it will be useful,
  10218. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10219. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10220. Lesser General Public License for more details.
  10221. You should have received a copy of the GNU Lesser General Public
  10222. License along with the GNU C Library; if not, see
  10223. <https://www.gnu.org/licenses/>. */
  10224. var _SPT struct {
  10225. Farg0 uintptr
  10226. Fbase uintptr
  10227. Fend uintptr
  10228. Fnul uintptr
  10229. Fwarned uint8
  10230. Freset uint8
  10231. Ferror1 int32
  10232. }
  10233. func _spt_min(tls *libc.TLS, a Tsize_t, b Tsize_t) (r Tsize_t) {
  10234. var v1 uint64
  10235. _ = v1
  10236. if a < b {
  10237. v1 = a
  10238. } else {
  10239. v1 = b
  10240. }
  10241. return v1
  10242. }
  10243. // C documentation
  10244. //
  10245. // /*
  10246. // * For discussion on the portability of the various methods, see
  10247. // * https://lists.freebsd.org/pipermail/freebsd-stable/2008-June/043136.html
  10248. // */
  10249. func _spt_clearenv(tls *libc.TLS) (r int32) {
  10250. return libc.Xclearenv(tls)
  10251. }
  10252. func _spt_copyenv(tls *libc.TLS, envc int32, envp uintptr) (r int32) {
  10253. var envcopy, eq uintptr
  10254. var envsize, error1, i int32
  10255. _, _, _, _, _ = envcopy, envsize, eq, error1, i
  10256. if libc.Xenviron != envp {
  10257. return 0
  10258. }
  10259. /* Make a copy of the old environ array of pointers, in case
  10260. * clearenv() or setenv() is implemented to free the internal
  10261. * environ array, because we will need to access the old environ
  10262. * contents to make the new copy. */
  10263. envsize = libc.Int32FromUint64(libc.Uint64FromInt32(envc+libc.Int32FromInt32(1)) * uint64(8))
  10264. envcopy = libc.Xmalloc(tls, libc.Uint64FromInt32(envsize))
  10265. if envcopy == libc.UintptrFromInt32(0) {
  10266. return *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10267. }
  10268. libc.Xmemcpy(tls, envcopy, envp, libc.Uint64FromInt32(envsize))
  10269. error1 = _spt_clearenv(tls)
  10270. if error1 != 0 {
  10271. libc.Xenviron = envp
  10272. libc.Xfree(tls, envcopy)
  10273. return error1
  10274. }
  10275. i = 0
  10276. for {
  10277. if !(*(*uintptr)(unsafe.Pointer(envcopy + uintptr(i)*8)) != 0) {
  10278. break
  10279. }
  10280. eq = libc.Xstrchr(tls, *(*uintptr)(unsafe.Pointer(envcopy + uintptr(i)*8)), int32('='))
  10281. if eq == libc.UintptrFromInt32(0) {
  10282. goto _1
  10283. }
  10284. *(*uint8)(unsafe.Pointer(eq)) = uint8('\000')
  10285. if libc.Xsetenv(tls, *(*uintptr)(unsafe.Pointer(envcopy + uintptr(i)*8)), eq+uintptr(1), int32(1)) < 0 {
  10286. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10287. }
  10288. *(*uint8)(unsafe.Pointer(eq)) = uint8('=')
  10289. if error1 != 0 {
  10290. /* Because the old environ might not be available
  10291. * anymore we will make do with the shallow copy. */
  10292. libc.Xenviron = envcopy
  10293. return error1
  10294. }
  10295. goto _1
  10296. _1:
  10297. ;
  10298. i++
  10299. }
  10300. /* Dispose of the shallow copy, now that we've finished transfering
  10301. * the old environment. */
  10302. libc.Xfree(tls, envcopy)
  10303. return 0
  10304. }
  10305. func _spt_copyargs(tls *libc.TLS, argc int32, argv uintptr) (r int32) {
  10306. var i int32
  10307. var tmp uintptr
  10308. _, _ = i, tmp
  10309. i = int32(1)
  10310. for {
  10311. if !(i < argc || i >= argc && *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) != 0) {
  10312. break
  10313. }
  10314. if *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) == libc.UintptrFromInt32(0) {
  10315. goto _1
  10316. }
  10317. tmp = libc.Xstrdup(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))
  10318. if tmp == libc.UintptrFromInt32(0) {
  10319. return *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10320. }
  10321. *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) = tmp
  10322. goto _1
  10323. _1:
  10324. ;
  10325. i++
  10326. }
  10327. return 0
  10328. }
  10329. func Xsetproctitle_init(tls *libc.TLS, argc int32, argv uintptr, envp uintptr) {
  10330. var base, end, nul, tmp uintptr
  10331. var envc, error1, i int32
  10332. _, _, _, _, _, _, _ = base, end, envc, error1, i, nul, tmp
  10333. /* Try to make sure we got called with main() arguments. */
  10334. if argc < 0 {
  10335. return
  10336. }
  10337. base = *(*uintptr)(unsafe.Pointer(argv))
  10338. if base == libc.UintptrFromInt32(0) {
  10339. return
  10340. }
  10341. nul = base + uintptr(libc.Xstrlen(tls, base))
  10342. end = nul + uintptr(1)
  10343. i = 0
  10344. for {
  10345. if !(i < argc || i >= argc && *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) != 0) {
  10346. break
  10347. }
  10348. if *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) == libc.UintptrFromInt32(0) || *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) != end {
  10349. goto _1
  10350. }
  10351. end = *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) + uintptr(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))) + uintptr(1)
  10352. goto _1
  10353. _1:
  10354. ;
  10355. i++
  10356. }
  10357. i = 0
  10358. for {
  10359. if !(*(*uintptr)(unsafe.Pointer(envp + uintptr(i)*8)) != 0) {
  10360. break
  10361. }
  10362. if *(*uintptr)(unsafe.Pointer(envp + uintptr(i)*8)) != end {
  10363. goto _2
  10364. }
  10365. end = *(*uintptr)(unsafe.Pointer(envp + uintptr(i)*8)) + uintptr(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(envp + uintptr(i)*8)))) + uintptr(1)
  10366. goto _2
  10367. _2:
  10368. ;
  10369. i++
  10370. }
  10371. envc = i
  10372. _SPT.Farg0 = libc.Xstrdup(tls, *(*uintptr)(unsafe.Pointer(argv)))
  10373. if _SPT.Farg0 == libc.UintptrFromInt32(0) {
  10374. _SPT.Ferror1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10375. return
  10376. }
  10377. tmp = libc.Xstrdup(tls, Xgetprogname(tls))
  10378. if tmp == libc.UintptrFromInt32(0) {
  10379. _SPT.Ferror1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10380. return
  10381. }
  10382. Xsetprogname(tls, tmp)
  10383. error1 = _spt_copyenv(tls, envc, envp)
  10384. if error1 != 0 {
  10385. _SPT.Ferror1 = error1
  10386. return
  10387. }
  10388. error1 = _spt_copyargs(tls, argc, argv)
  10389. if error1 != 0 {
  10390. _SPT.Ferror1 = error1
  10391. return
  10392. }
  10393. _SPT.Fnul = nul
  10394. _SPT.Fbase = base
  10395. _SPT.Fend = end
  10396. }
  10397. func Xsetproctitle_impl(tls *libc.TLS, fmt uintptr, va uintptr) {
  10398. bp := tls.Alloc(272)
  10399. defer tls.Free(272)
  10400. var ap Tva_list
  10401. var len1 int32
  10402. var nul, v1 uintptr
  10403. var _ /* buf at bp+0 */ [256]uint8
  10404. _, _, _, _ = ap, len1, nul, v1
  10405. if _SPT.Fbase == libc.UintptrFromInt32(0) {
  10406. if !(_SPT.Fwarned != 0) {
  10407. libc.Xwarnx(tls, __ccgo_ts+329, 0)
  10408. _SPT.Fwarned = uint8(m_true)
  10409. }
  10410. return
  10411. }
  10412. if fmt != 0 {
  10413. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(fmt))) == int32('-') {
  10414. /* Skip program name prefix. */
  10415. fmt++
  10416. len1 = 0
  10417. } else {
  10418. /* Print program name heading for grep. */
  10419. libc.X__builtin_snprintf(tls, bp, uint64(256), __ccgo_ts+14, libc.VaList(bp+264, Xgetprogname(tls)))
  10420. len1 = libc.Int32FromUint64(libc.Xstrlen(tls, bp))
  10421. }
  10422. ap = va
  10423. len1 += libc.X__builtin_vsnprintf(tls, bp+uintptr(len1), uint64(256)-libc.Uint64FromInt32(len1), fmt, ap)
  10424. _ = ap
  10425. } else {
  10426. len1 = libc.X__builtin_snprintf(tls, bp, uint64(256), __ccgo_ts+427, libc.VaList(bp+264, _SPT.Farg0))
  10427. }
  10428. if len1 <= 0 {
  10429. _SPT.Ferror1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10430. return
  10431. }
  10432. if !(_SPT.Freset != 0) {
  10433. libc.Xmemset(tls, _SPT.Fbase, 0, libc.Uint64FromInt64(int64(_SPT.Fend)-int64(_SPT.Fbase)))
  10434. _SPT.Freset = uint8(m_true)
  10435. } else {
  10436. libc.Xmemset(tls, _SPT.Fbase, 0, _spt_min(tls, uint64(256), libc.Uint64FromInt64(int64(_SPT.Fend)-int64(_SPT.Fbase))))
  10437. }
  10438. len1 = libc.Int32FromUint64(_spt_min(tls, libc.Uint64FromInt32(len1), _spt_min(tls, uint64(256), libc.Uint64FromInt64(int64(_SPT.Fend)-int64(_SPT.Fbase)))-uint64(1)))
  10439. libc.Xmemcpy(tls, _SPT.Fbase, bp, libc.Uint64FromInt32(len1))
  10440. nul = _SPT.Fbase + uintptr(len1)
  10441. if nul < _SPT.Fnul {
  10442. *(*uint8)(unsafe.Pointer(_SPT.Fnul)) = uint8('.')
  10443. } else {
  10444. if nul == _SPT.Fnul && nul+uintptr(1) < _SPT.Fend {
  10445. *(*uint8)(unsafe.Pointer(_SPT.Fnul)) = uint8(' ')
  10446. nul++
  10447. v1 = nul
  10448. *(*uint8)(unsafe.Pointer(v1)) = uint8('\000')
  10449. }
  10450. }
  10451. }
  10452. func Xgetprogname(tls *libc.TLS) (r uintptr) {
  10453. if libc.Xprogram_invocation_short_name == libc.UintptrFromInt32(0) {
  10454. libc.Xprogram_invocation_short_name = libc.Xprogram_invocation_short_name
  10455. }
  10456. return libc.Xprogram_invocation_short_name
  10457. }
  10458. func Xsetprogname(tls *libc.TLS, progname uintptr) {
  10459. var i Tsize_t
  10460. _ = i
  10461. i = libc.Xstrlen(tls, progname)
  10462. for {
  10463. if !(i > uint64(0)) {
  10464. break
  10465. }
  10466. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(progname + uintptr(i-uint64(1))))) == int32('/') {
  10467. libc.Xprogram_invocation_short_name = progname + uintptr(i)
  10468. return
  10469. }
  10470. goto _1
  10471. _1:
  10472. ;
  10473. i--
  10474. }
  10475. libc.Xprogram_invocation_short_name = progname
  10476. }
  10477. const m_GID_SZ = 251
  10478. const m_GNMLEN = 32
  10479. const m_GNM_SZ = 251
  10480. const m_INVALID = 2
  10481. const m_UID_SZ = 317
  10482. const m_UNMLEN = 32
  10483. const m_UNM_SZ = 317
  10484. const m_VALID = 1
  10485. const m__PW_BUF_LEN = 1024
  10486. type Tgroup = struct {
  10487. Fgr_name uintptr
  10488. Fgr_passwd uintptr
  10489. Fgr_gid Tgid_t
  10490. Fgr_mem uintptr
  10491. }
  10492. type Tpasswd = struct {
  10493. Fpw_name uintptr
  10494. Fpw_passwd uintptr
  10495. Fpw_uid Tuid_t
  10496. Fpw_gid Tgid_t
  10497. Fpw_gecos uintptr
  10498. Fpw_dir uintptr
  10499. Fpw_shell uintptr
  10500. }
  10501. /*
  10502. * Constants and data structures used to implement group and password file
  10503. * caches. Name lengths have been chosen to be as large as those supported
  10504. * by the passwd and group files as well as the standard archive formats.
  10505. * CACHE SIZES MUST BE PRIME
  10506. */
  10507. /*
  10508. * Node structures used in the user, group, uid, and gid caches.
  10509. */
  10510. type TUIDC = struct {
  10511. Fvalid int32
  10512. Fname [32]uint8
  10513. Fuid Tuid_t
  10514. }
  10515. /*
  10516. * Constants and data structures used to implement group and password file
  10517. * caches. Name lengths have been chosen to be as large as those supported
  10518. * by the passwd and group files as well as the standard archive formats.
  10519. * CACHE SIZES MUST BE PRIME
  10520. */
  10521. /*
  10522. * Node structures used in the user, group, uid, and gid caches.
  10523. */
  10524. type Tuidc = TUIDC
  10525. type TGIDC = struct {
  10526. Fvalid int32
  10527. Fname [32]uint8
  10528. Fgid Tgid_t
  10529. }
  10530. type Tgidc = TGIDC
  10531. /*
  10532. * Routines that control user, group, uid and gid caches.
  10533. * Traditional passwd/group cache routines perform quite poorly with
  10534. * archives. The chances of hitting a valid lookup with an archive is quite a
  10535. * bit worse than with files already resident on the file system. These misses
  10536. * create a MAJOR performance cost. To adress this problem, these routines
  10537. * cache both hits and misses.
  10538. */
  10539. var _uidtb uintptr /* uid to name cache */
  10540. var _gidtb uintptr /* gid to name cache */
  10541. var _usrtb uintptr /* user name to uid cache */
  10542. var _grptb uintptr /* group name to gid cache */
  10543. func _st_hash(tls *libc.TLS, name uintptr, len1 Tsize_t, tabsz int32) (r Tu_int) {
  10544. var key Tu_int
  10545. var v1 Tsize_t
  10546. var v2 uintptr
  10547. _, _, _ = key, v1, v2
  10548. key = uint32(0)
  10549. for {
  10550. v1 = len1
  10551. len1--
  10552. if !(v1 != 0) {
  10553. break
  10554. }
  10555. v2 = name
  10556. name++
  10557. key += uint32(*(*uint8)(unsafe.Pointer(v2)))
  10558. key = key<<libc.Int32FromInt32(8) | key>>libc.Int32FromInt32(24)
  10559. }
  10560. return key % libc.Uint32FromInt32(tabsz)
  10561. }
  10562. // C documentation
  10563. //
  10564. // /*
  10565. // * uidtb_start
  10566. // * creates an an empty uidtb
  10567. // * Return:
  10568. // * 0 if ok, -1 otherwise
  10569. // */
  10570. func _uidtb_start(tls *libc.TLS) (r int32) {
  10571. var v1 uintptr
  10572. _ = v1
  10573. if _uidtb != libc.UintptrFromInt32(0) {
  10574. return 0
  10575. }
  10576. if _fail != 0 {
  10577. return -int32(1)
  10578. }
  10579. v1 = libc.Xcalloc(tls, uint64(m_UID_SZ), uint64(8))
  10580. _uidtb = v1
  10581. if v1 == libc.UintptrFromInt32(0) {
  10582. _fail++
  10583. return -int32(1)
  10584. }
  10585. return 0
  10586. }
  10587. var _fail int32
  10588. // C documentation
  10589. //
  10590. // /*
  10591. // * gidtb_start
  10592. // * creates an an empty gidtb
  10593. // * Return:
  10594. // * 0 if ok, -1 otherwise
  10595. // */
  10596. func _gidtb_start(tls *libc.TLS) (r int32) {
  10597. var v1 uintptr
  10598. _ = v1
  10599. if _gidtb != libc.UintptrFromInt32(0) {
  10600. return 0
  10601. }
  10602. if _fail1 != 0 {
  10603. return -int32(1)
  10604. }
  10605. v1 = libc.Xcalloc(tls, uint64(m_GID_SZ), uint64(8))
  10606. _gidtb = v1
  10607. if v1 == libc.UintptrFromInt32(0) {
  10608. _fail1++
  10609. return -int32(1)
  10610. }
  10611. return 0
  10612. }
  10613. var _fail1 int32
  10614. // C documentation
  10615. //
  10616. // /*
  10617. // * usrtb_start
  10618. // * creates an an empty usrtb
  10619. // * Return:
  10620. // * 0 if ok, -1 otherwise
  10621. // */
  10622. func _usrtb_start(tls *libc.TLS) (r int32) {
  10623. var v1 uintptr
  10624. _ = v1
  10625. if _usrtb != libc.UintptrFromInt32(0) {
  10626. return 0
  10627. }
  10628. if _fail2 != 0 {
  10629. return -int32(1)
  10630. }
  10631. v1 = libc.Xcalloc(tls, uint64(m_UNM_SZ), uint64(8))
  10632. _usrtb = v1
  10633. if v1 == libc.UintptrFromInt32(0) {
  10634. _fail2++
  10635. return -int32(1)
  10636. }
  10637. return 0
  10638. }
  10639. var _fail2 int32
  10640. // C documentation
  10641. //
  10642. // /*
  10643. // * grptb_start
  10644. // * creates an an empty grptb
  10645. // * Return:
  10646. // * 0 if ok, -1 otherwise
  10647. // */
  10648. func _grptb_start(tls *libc.TLS) (r int32) {
  10649. var v1 uintptr
  10650. _ = v1
  10651. if _grptb != libc.UintptrFromInt32(0) {
  10652. return 0
  10653. }
  10654. if _fail3 != 0 {
  10655. return -int32(1)
  10656. }
  10657. v1 = libc.Xcalloc(tls, uint64(m_GNM_SZ), uint64(8))
  10658. _grptb = v1
  10659. if v1 == libc.UintptrFromInt32(0) {
  10660. _fail3++
  10661. return -int32(1)
  10662. }
  10663. return 0
  10664. }
  10665. var _fail3 int32
  10666. // C documentation
  10667. //
  10668. // /*
  10669. // * user_from_uid()
  10670. // * caches the name (if any) for the uid. If noname clear, we always
  10671. // * return the stored name (if valid or invalid match).
  10672. // * We use a simple hash table.
  10673. // * Return:
  10674. // * Pointer to stored name (or a empty string)
  10675. // */
  10676. func Xuser_from_uid(tls *libc.TLS, uid Tuid_t, noname int32) (r uintptr) {
  10677. bp := tls.Alloc(1104)
  10678. defer tls.Free(1104)
  10679. var pptr, ptr, v1 uintptr
  10680. var _ /* pw at bp+48 */ uintptr
  10681. var _ /* pwbuf at bp+56 */ [1024]uint8
  10682. var _ /* pwstore at bp+0 */ Tpasswd
  10683. _, _, _ = pptr, ptr, v1
  10684. *(*uintptr)(unsafe.Pointer(bp + 48)) = libc.UintptrFromInt32(0)
  10685. ptr = libc.UintptrFromInt32(0)
  10686. if _uidtb != libc.UintptrFromInt32(0) || _uidtb_start(tls) == 0 {
  10687. /*
  10688. * see if we have this uid cached
  10689. */
  10690. pptr = _uidtb + uintptr(uid%libc.Uint32FromInt32(m_UID_SZ))*8
  10691. ptr = *(*uintptr)(unsafe.Pointer(pptr))
  10692. if ptr != libc.UintptrFromInt32(0) && (*TUIDC)(unsafe.Pointer(ptr)).Fvalid > 0 && (*TUIDC)(unsafe.Pointer(ptr)).Fuid == uid {
  10693. /*
  10694. * have an entry for this uid
  10695. */
  10696. if !(noname != 0) || (*TUIDC)(unsafe.Pointer(ptr)).Fvalid == int32(m_VALID) {
  10697. return ptr + 4
  10698. }
  10699. return libc.UintptrFromInt32(0)
  10700. }
  10701. if ptr == libc.UintptrFromInt32(0) {
  10702. v1 = libc.Xmalloc(tls, uint64(40))
  10703. ptr = v1
  10704. *(*uintptr)(unsafe.Pointer(pptr)) = v1
  10705. }
  10706. }
  10707. libc.Xgetpwuid_r(tls, uid, bp, bp+56, uint64(1024), bp+48)
  10708. if *(*uintptr)(unsafe.Pointer(bp + 48)) == libc.UintptrFromInt32(0) {
  10709. /*
  10710. * no match for this uid in the local password file
  10711. * a string that is the uid in numeric format
  10712. */
  10713. if ptr == libc.UintptrFromInt32(0) {
  10714. return libc.UintptrFromInt32(0)
  10715. }
  10716. (*TUIDC)(unsafe.Pointer(ptr)).Fuid = uid
  10717. libc.X__builtin_snprintf(tls, ptr+4, uint64(m_UNMLEN), __ccgo_ts+326, libc.VaList(bp+1088, uid))
  10718. (*TUIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_INVALID)
  10719. if noname != 0 {
  10720. return libc.UintptrFromInt32(0)
  10721. }
  10722. } else {
  10723. /*
  10724. * there is an entry for this uid in the password file
  10725. */
  10726. if ptr == libc.UintptrFromInt32(0) {
  10727. return (*Tpasswd)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48)))).Fpw_name
  10728. }
  10729. (*TUIDC)(unsafe.Pointer(ptr)).Fuid = uid
  10730. Xstrlcpy(tls, ptr+4, (*Tpasswd)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48)))).Fpw_name, uint64(32))
  10731. (*TUIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_VALID)
  10732. }
  10733. return ptr + 4
  10734. }
  10735. // C documentation
  10736. //
  10737. // /*
  10738. // * group_from_gid()
  10739. // * caches the name (if any) for the gid. If noname clear, we always
  10740. // * return the stored name (if valid or invalid match).
  10741. // * We use a simple hash table.
  10742. // * Return:
  10743. // * Pointer to stored name (or a empty string)
  10744. // */
  10745. func Xgroup_from_gid(tls *libc.TLS, gid Tgid_t, noname int32) (r uintptr) {
  10746. bp := tls.Alloc(2688)
  10747. defer tls.Free(2688)
  10748. var pptr, ptr, v1 uintptr
  10749. var _ /* gr at bp+32 */ uintptr
  10750. var _ /* grbuf at bp+40 */ [2624]uint8
  10751. var _ /* grstore at bp+0 */ Tgroup
  10752. _, _, _ = pptr, ptr, v1
  10753. *(*uintptr)(unsafe.Pointer(bp + 32)) = libc.UintptrFromInt32(0)
  10754. ptr = libc.UintptrFromInt32(0)
  10755. if _gidtb != libc.UintptrFromInt32(0) || _gidtb_start(tls) == 0 {
  10756. /*
  10757. * see if we have this gid cached
  10758. */
  10759. pptr = _gidtb + uintptr(gid%libc.Uint32FromInt32(m_GID_SZ))*8
  10760. ptr = *(*uintptr)(unsafe.Pointer(pptr))
  10761. if ptr != libc.UintptrFromInt32(0) && (*TGIDC)(unsafe.Pointer(ptr)).Fvalid > 0 && (*TGIDC)(unsafe.Pointer(ptr)).Fgid == gid {
  10762. /*
  10763. * have an entry for this gid
  10764. */
  10765. if !(noname != 0) || (*TGIDC)(unsafe.Pointer(ptr)).Fvalid == int32(m_VALID) {
  10766. return ptr + 4
  10767. }
  10768. return libc.UintptrFromInt32(0)
  10769. }
  10770. if ptr == libc.UintptrFromInt32(0) {
  10771. v1 = libc.Xmalloc(tls, uint64(40))
  10772. ptr = v1
  10773. *(*uintptr)(unsafe.Pointer(pptr)) = v1
  10774. }
  10775. }
  10776. libc.Xgetgrgid_r(tls, gid, bp, bp+40, uint64(2624), bp+32)
  10777. if *(*uintptr)(unsafe.Pointer(bp + 32)) == libc.UintptrFromInt32(0) {
  10778. /*
  10779. * no match for this gid in the local group file, put in
  10780. * a string that is the gid in numeric format
  10781. */
  10782. if ptr == libc.UintptrFromInt32(0) {
  10783. return libc.UintptrFromInt32(0)
  10784. }
  10785. (*TGIDC)(unsafe.Pointer(ptr)).Fgid = gid
  10786. libc.X__builtin_snprintf(tls, ptr+4, uint64(m_GNMLEN), __ccgo_ts+326, libc.VaList(bp+2672, gid))
  10787. (*TGIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_INVALID)
  10788. if noname != 0 {
  10789. return libc.UintptrFromInt32(0)
  10790. }
  10791. } else {
  10792. /*
  10793. * there is an entry for this group in the group file
  10794. */
  10795. if ptr == libc.UintptrFromInt32(0) {
  10796. return (*Tgroup)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32)))).Fgr_name
  10797. }
  10798. (*TGIDC)(unsafe.Pointer(ptr)).Fgid = gid
  10799. Xstrlcpy(tls, ptr+4, (*Tgroup)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32)))).Fgr_name, uint64(32))
  10800. (*TGIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_VALID)
  10801. }
  10802. return ptr + 4
  10803. }
  10804. // C documentation
  10805. //
  10806. // /*
  10807. // * uid_from_user()
  10808. // * caches the uid for a given user name. We use a simple hash table.
  10809. // * Return:
  10810. // * 0 if the user name is found (filling in uid), -1 otherwise
  10811. // */
  10812. func Xuid_from_user(tls *libc.TLS, name uintptr, uid uintptr) (r int32) {
  10813. bp := tls.Alloc(1088)
  10814. defer tls.Free(1088)
  10815. var namelen, v1 Tsize_t
  10816. var pptr, ptr, v3 uintptr
  10817. var v2 bool
  10818. var v4 Tuid_t
  10819. var _ /* pw at bp+48 */ uintptr
  10820. var _ /* pwbuf at bp+56 */ [1024]uint8
  10821. var _ /* pwstore at bp+0 */ Tpasswd
  10822. _, _, _, _, _, _, _ = namelen, pptr, ptr, v1, v2, v3, v4
  10823. *(*uintptr)(unsafe.Pointer(bp + 48)) = libc.UintptrFromInt32(0)
  10824. ptr = libc.UintptrFromInt32(0)
  10825. /*
  10826. * return -1 for mangled names
  10827. */
  10828. if v2 = name == libc.UintptrFromInt32(0); !v2 {
  10829. v1 = libc.Xstrlen(tls, name)
  10830. namelen = v1
  10831. }
  10832. if v2 || v1 == uint64(0) {
  10833. return -int32(1)
  10834. }
  10835. if _usrtb != libc.UintptrFromInt32(0) || _usrtb_start(tls) == 0 {
  10836. /*
  10837. * look up in hash table, if found and valid return the uid,
  10838. * if found and invalid, return a -1
  10839. */
  10840. pptr = _usrtb + uintptr(_st_hash(tls, name, namelen, int32(m_UNM_SZ)))*8
  10841. ptr = *(*uintptr)(unsafe.Pointer(pptr))
  10842. if ptr != libc.UintptrFromInt32(0) && (*TUIDC)(unsafe.Pointer(ptr)).Fvalid > 0 && libc.Xstrcmp(tls, name, ptr+4) == 0 {
  10843. if (*TUIDC)(unsafe.Pointer(ptr)).Fvalid == int32(m_INVALID) {
  10844. return -int32(1)
  10845. }
  10846. *(*Tuid_t)(unsafe.Pointer(uid)) = (*TUIDC)(unsafe.Pointer(ptr)).Fuid
  10847. return 0
  10848. }
  10849. if ptr == libc.UintptrFromInt32(0) {
  10850. v3 = libc.Xmalloc(tls, uint64(40))
  10851. ptr = v3
  10852. *(*uintptr)(unsafe.Pointer(pptr)) = v3
  10853. }
  10854. }
  10855. /*
  10856. * no match, look it up, if no match store it as an invalid entry,
  10857. * or store the matching uid
  10858. */
  10859. libc.Xgetpwnam_r(tls, name, bp, bp+56, uint64(1024), bp+48)
  10860. if ptr == libc.UintptrFromInt32(0) {
  10861. if *(*uintptr)(unsafe.Pointer(bp + 48)) == libc.UintptrFromInt32(0) {
  10862. return -int32(1)
  10863. }
  10864. *(*Tuid_t)(unsafe.Pointer(uid)) = (*Tpasswd)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48)))).Fpw_uid
  10865. return 0
  10866. }
  10867. Xstrlcpy(tls, ptr+4, name, uint64(32))
  10868. if *(*uintptr)(unsafe.Pointer(bp + 48)) == libc.UintptrFromInt32(0) {
  10869. (*TUIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_INVALID)
  10870. return -int32(1)
  10871. }
  10872. (*TUIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_VALID)
  10873. v4 = (*Tpasswd)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48)))).Fpw_uid
  10874. (*TUIDC)(unsafe.Pointer(ptr)).Fuid = v4
  10875. *(*Tuid_t)(unsafe.Pointer(uid)) = v4
  10876. return 0
  10877. }
  10878. // C documentation
  10879. //
  10880. // /*
  10881. // * gid_from_group()
  10882. // * caches the gid for a given group name. We use a simple hash table.
  10883. // * Return:
  10884. // * 0 if the group name is found (filling in gid), -1 otherwise
  10885. // */
  10886. func Xgid_from_group(tls *libc.TLS, name uintptr, gid uintptr) (r int32) {
  10887. bp := tls.Alloc(2672)
  10888. defer tls.Free(2672)
  10889. var namelen, v1 Tsize_t
  10890. var pptr, ptr, v3 uintptr
  10891. var v2 bool
  10892. var v4 Tgid_t
  10893. var _ /* gr at bp+32 */ uintptr
  10894. var _ /* grbuf at bp+40 */ [2624]uint8
  10895. var _ /* grstore at bp+0 */ Tgroup
  10896. _, _, _, _, _, _, _ = namelen, pptr, ptr, v1, v2, v3, v4
  10897. *(*uintptr)(unsafe.Pointer(bp + 32)) = libc.UintptrFromInt32(0)
  10898. ptr = libc.UintptrFromInt32(0)
  10899. /*
  10900. * return -1 for mangled names
  10901. */
  10902. if v2 = name == libc.UintptrFromInt32(0); !v2 {
  10903. v1 = libc.Xstrlen(tls, name)
  10904. namelen = v1
  10905. }
  10906. if v2 || v1 == uint64(0) {
  10907. return -int32(1)
  10908. }
  10909. if _grptb != libc.UintptrFromInt32(0) || _grptb_start(tls) == 0 {
  10910. /*
  10911. * look up in hash table, if found and valid return the uid,
  10912. * if found and invalid, return a -1
  10913. */
  10914. pptr = _grptb + uintptr(_st_hash(tls, name, namelen, int32(m_GID_SZ)))*8
  10915. ptr = *(*uintptr)(unsafe.Pointer(pptr))
  10916. if ptr != libc.UintptrFromInt32(0) && (*TGIDC)(unsafe.Pointer(ptr)).Fvalid > 0 && libc.Xstrcmp(tls, name, ptr+4) == 0 {
  10917. if (*TGIDC)(unsafe.Pointer(ptr)).Fvalid == int32(m_INVALID) {
  10918. return -int32(1)
  10919. }
  10920. *(*Tgid_t)(unsafe.Pointer(gid)) = (*TGIDC)(unsafe.Pointer(ptr)).Fgid
  10921. return 0
  10922. }
  10923. if ptr == libc.UintptrFromInt32(0) {
  10924. v3 = libc.Xmalloc(tls, uint64(40))
  10925. ptr = v3
  10926. *(*uintptr)(unsafe.Pointer(pptr)) = v3
  10927. }
  10928. }
  10929. /*
  10930. * no match, look it up, if no match store it as an invalid entry,
  10931. * or store the matching gid
  10932. */
  10933. libc.Xgetgrnam_r(tls, name, bp, bp+40, uint64(2624), bp+32)
  10934. if ptr == libc.UintptrFromInt32(0) {
  10935. if *(*uintptr)(unsafe.Pointer(bp + 32)) == libc.UintptrFromInt32(0) {
  10936. return -int32(1)
  10937. }
  10938. *(*Tgid_t)(unsafe.Pointer(gid)) = (*Tgroup)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32)))).Fgr_gid
  10939. return 0
  10940. }
  10941. Xstrlcpy(tls, ptr+4, name, uint64(32))
  10942. if *(*uintptr)(unsafe.Pointer(bp + 32)) == libc.UintptrFromInt32(0) {
  10943. (*TGIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_INVALID)
  10944. return -int32(1)
  10945. }
  10946. (*TGIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_VALID)
  10947. v4 = (*Tgroup)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32)))).Fgr_gid
  10948. (*TGIDC)(unsafe.Pointer(ptr)).Fgid = v4
  10949. *(*Tgid_t)(unsafe.Pointer(gid)) = v4
  10950. return 0
  10951. }
  10952. const m_B0 = 0000000
  10953. const m_B1000000 = 00027
  10954. const m_B110 = 0000003
  10955. const m_B115200 = 00021
  10956. const m_B1152000 = 00030
  10957. const m_B1200 = 0000011
  10958. const m_B134 = 0000004
  10959. const m_B150 = 0000005
  10960. const m_B1500000 = 00031
  10961. const m_B1800 = 0000012
  10962. const m_B19200 = 0000016
  10963. const m_B200 = 0000006
  10964. const m_B2000000 = 00032
  10965. const m_B230400 = 00022
  10966. const m_B2400 = 0000013
  10967. const m_B2500000 = 00033
  10968. const m_B300 = 0000007
  10969. const m_B3000000 = 00034
  10970. const m_B3500000 = 00035
  10971. const m_B38400 = 0000017
  10972. const m_B4000000 = 00036
  10973. const m_B460800 = 00023
  10974. const m_B4800 = 0000014
  10975. const m_B50 = 0000001
  10976. const m_B500000 = 00024
  10977. const m_B57600 = 00020
  10978. const m_B576000 = 00025
  10979. const m_B600 = 0000010
  10980. const m_B75 = 0000002
  10981. const m_B921600 = 00026
  10982. const m_B9600 = 0000015
  10983. const m_BRKINT = 0000002
  10984. const m_BS0 = 0000000
  10985. const m_BS1 = 0100000
  10986. const m_BSDLY = 0100000
  10987. const m_CBAUD = 00377
  10988. const m_CBAUDEX = 0000020
  10989. const m_CIBAUD = 077600000
  10990. const m_CLOCAL = 00100000
  10991. const m_CMSPAR = 010000000000
  10992. const m_CR0 = 0000000
  10993. const m_CR1 = 0010000
  10994. const m_CR2 = 0020000
  10995. const m_CR3 = 0030000
  10996. const m_CRDLY = 0030000
  10997. const m_CREAD = 00004000
  10998. const m_CRTSCTS = 020000000000
  10999. const m_CS5 = 00000000
  11000. const m_CS6 = 00000400
  11001. const m_CS7 = 00001000
  11002. const m_CS8 = 00001400
  11003. const m_CSIZE = 00001400
  11004. const m_CSTOPB = 00002000
  11005. const m_ECHO = 8
  11006. const m_ECHOCTL = 0x00000040
  11007. const m_ECHOE = 0x00000002
  11008. const m_ECHOK = 0x00000004
  11009. const m_ECHOKE = 0x00000001
  11010. const m_ECHONL = 16
  11011. const m_ECHOPRT = 0x00000020
  11012. const m_EXTA = 0000016
  11013. const m_EXTB = 0000017
  11014. const m_EXTPROC = 0x10000000
  11015. const m_FF0 = 0000000
  11016. const m_FF1 = 0040000
  11017. const m_FFDLY = 0040000
  11018. const m_FLUSHO = 0x00800000
  11019. const m_HUPCL = 00040000
  11020. const m_ICANON = 0x00000100
  11021. const m_ICRNL = 0000400
  11022. const m_IEXTEN = 0x00000400
  11023. const m_IGNBRK = 0000001
  11024. const m_IGNCR = 0000200
  11025. const m_IGNPAR = 0000004
  11026. const m_IMAXBEL = 0020000
  11027. const m_INLCR = 0000100
  11028. const m_INPCK = 0000020
  11029. const m_ISIG = 0x00000080
  11030. const m_ISTRIP = 0000040
  11031. const m_IUCLC = 0010000
  11032. const m_IUTF8 = 0040000
  11033. const m_IXANY = 0004000
  11034. const m_IXOFF = 0002000
  11035. const m_IXON = 0001000
  11036. const m_NL0 = 0000000
  11037. const m_NL1 = 0000400
  11038. const m_NL2 = 0001000
  11039. const m_NL3 = 0001400
  11040. const m_NLDLY = 0001400
  11041. const m_NOFLSH = 0x80000000
  11042. const m_OCRNL = 0000010
  11043. const m_OFDEL = 0000200
  11044. const m_OFILL = 0000100
  11045. const m_OLCUC = 0000004
  11046. const m_ONLCR = 0000002
  11047. const m_ONLRET = 0000040
  11048. const m_ONOCR = 0000020
  11049. const m_OPOST = 0000001
  11050. const m_O_CREAT4 = 0100
  11051. const m_O_NONBLOCK4 = 04000
  11052. const m_O_RDONLY2 = 00
  11053. const m_O_RDWR1 = 2
  11054. const m_O_TRUNC4 = 01000
  11055. const m_O_WRONLY2 = 01
  11056. const m_PARENB = 00010000
  11057. const m_PARMRK = 0000010
  11058. const m_PARODD = 00020000
  11059. const m_PENDIN = 0x20000000
  11060. const m_RPP_ECHO_OFF = 0x00
  11061. const m_RPP_ECHO_ON = 1
  11062. const m_RPP_FORCELOWER = 4
  11063. const m_RPP_FORCEUPPER = 8
  11064. const m_RPP_REQUIRE_TTY = 2
  11065. const m_RPP_SEVENBIT = 16
  11066. const m_RPP_STDIN = 32
  11067. const m_TAB0 = 0000000
  11068. const m_TAB1 = 0002000
  11069. const m_TAB2 = 0004000
  11070. const m_TAB3 = 0006000
  11071. const m_TABDLY = 0006000
  11072. const m_TCIFLUSH = 0
  11073. const m_TCIOFF = 2
  11074. const m_TCIOFLUSH = 2
  11075. const m_TCION = 3
  11076. const m_TCOFLUSH = 1
  11077. const m_TCOOFF = 0
  11078. const m_TCOON = 1
  11079. const m_TCSADRAIN = 1
  11080. const m_TCSAFLUSH = 2
  11081. const m_TCSANOW = 0
  11082. const m_TCSASOFT = 0
  11083. const m_TIOCSER_TEMT = 1
  11084. const m_TOSTOP = 0x00400000
  11085. const m_VDISCARD = 16
  11086. const m_VEOF = 4
  11087. const m_VEOL = 6
  11088. const m_VEOL2 = 8
  11089. const m_VERASE = 2
  11090. const m_VINTR = 0
  11091. const m_VKILL = 3
  11092. const m_VLNEXT = 15
  11093. const m_VMIN = 5
  11094. const m_VQUIT = 1
  11095. const m_VREPRINT = 11
  11096. const m_VSTART = 13
  11097. const m_VSTOP = 14
  11098. const m_VSUSP = 12
  11099. const m_VSWTC = 9
  11100. const m_VT0 = 0000000
  11101. const m_VT1 = 0200000
  11102. const m_VTDLY = 0200000
  11103. const m_VTIME = 7
  11104. const m_VWERASE = 10
  11105. const m_XCASE = 0x00004000
  11106. const m_XTABS = 00006000
  11107. const m__PATH_BSHELL = "/bin/sh"
  11108. const m__PATH_CONSOLE = "/dev/console"
  11109. const m__PATH_DEFPATH = "/usr/local/bin:/bin:/usr/bin"
  11110. const m__PATH_DEV = "/dev/"
  11111. const m__PATH_DEVNULL = "/dev/null"
  11112. const m__PATH_KLOG = "/proc/kmsg"
  11113. const m__PATH_LASTLOG = "/var/log/lastlog"
  11114. const m__PATH_MAILDIR = "/var/mail"
  11115. const m__PATH_MAN = "/usr/share/man"
  11116. const m__PATH_MNTTAB = "/etc/fstab"
  11117. const m__PATH_MOUNTED = "/etc/mtab"
  11118. const m__PATH_NOLOGIN = "/etc/nologin"
  11119. const m__PATH_SENDMAIL = "/usr/sbin/sendmail"
  11120. const m__PATH_SHADOW = "/etc/shadow"
  11121. const m__PATH_SHELLS = "/etc/shells"
  11122. const m__PATH_STDPATH = "/bin:/usr/bin:/sbin:/usr/sbin"
  11123. const m__PATH_TMP = "/tmp/"
  11124. const m__PATH_TTY = "/dev/tty"
  11125. const m__PATH_UTMP = "/dev/null/utmp"
  11126. const m__PATH_VARDB = "/var/lib/misc/"
  11127. const m__PATH_VARRUN = "/var/run/"
  11128. const m__PATH_VARTMP = "/var/tmp/"
  11129. const m__PATH_VI = "/usr/bin/vi"
  11130. const m__PATH_WTMP = "/dev/null/wtmp"
  11131. type Twinsize = struct {
  11132. Fws_row uint16
  11133. Fws_col uint16
  11134. Fws_xpixel uint16
  11135. Fws_ypixel uint16
  11136. }
  11137. type Tcc_t = uint8
  11138. type Tspeed_t = uint32
  11139. type Ttcflag_t = uint32
  11140. type Ttermios = struct {
  11141. Fc_iflag Ttcflag_t
  11142. Fc_oflag Ttcflag_t
  11143. Fc_cflag Ttcflag_t
  11144. Fc_lflag Ttcflag_t
  11145. Fc_cc [19]Tcc_t
  11146. Fc_line Tcc_t
  11147. F__c_ispeed Tspeed_t
  11148. F__c_ospeed Tspeed_t
  11149. }
  11150. var _signo [65]Tsig_atomic_t
  11151. func Xreadpassphrase(tls *libc.TLS, prompt uintptr, buf uintptr, bufsiz Tsize_t, flags int32) (r uintptr) {
  11152. bp := tls.Alloc(1616)
  11153. defer tls.Free(1616)
  11154. var end, p, v6, v8 uintptr
  11155. var i, input, need_restart, output, save_errno, sigttou, v2, v3 int32
  11156. var nr, v5 Tssize_t
  11157. var v4 bool
  11158. var _ /* ch at bp+0 */ uint8
  11159. var _ /* oterm at bp+48 */ Ttermios
  11160. var _ /* sa at bp+96 */ Tsigaction
  11161. var _ /* savealrm at bp+248 */ Tsigaction
  11162. var _ /* savehup at bp+552 */ Tsigaction
  11163. var _ /* saveint at bp+400 */ Tsigaction
  11164. var _ /* savepipe at bp+1464 */ Tsigaction
  11165. var _ /* savequit at bp+704 */ Tsigaction
  11166. var _ /* saveterm at bp+856 */ Tsigaction
  11167. var _ /* savetstp at bp+1008 */ Tsigaction
  11168. var _ /* savettin at bp+1160 */ Tsigaction
  11169. var _ /* savettou at bp+1312 */ Tsigaction
  11170. var _ /* term at bp+4 */ Ttermios
  11171. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = end, i, input, need_restart, nr, output, p, save_errno, sigttou, v2, v3, v4, v5, v6, v8
  11172. /* I suppose we could alloc on demand in this case (XXX). */
  11173. if bufsiz == uint64(0) {
  11174. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11175. return libc.UintptrFromInt32(0)
  11176. }
  11177. goto restart
  11178. restart:
  11179. ;
  11180. i = 0
  11181. for {
  11182. if !(i < int32(m__NSIG)) {
  11183. break
  11184. }
  11185. libc.AtomicStorePInt32(uintptr(unsafe.Pointer(&_signo))+uintptr(i)*4, 0)
  11186. goto _1
  11187. _1:
  11188. ;
  11189. i++
  11190. }
  11191. nr = int64(-int32(1))
  11192. save_errno = 0
  11193. need_restart = 0
  11194. /*
  11195. * Read and write to /dev/tty if available. If not, read from
  11196. * stdin and write to stderr unless a tty is required.
  11197. */
  11198. if v4 = flags&int32(m_RPP_STDIN) != 0; !v4 {
  11199. v3 = libc.Xopen(tls, __ccgo_ts+430, int32(m_O_RDWR1), 0)
  11200. output = v3
  11201. v2 = v3
  11202. input = v2
  11203. }
  11204. if v4 || v2 == -int32(1) {
  11205. if flags&int32(m_RPP_REQUIRE_TTY) != 0 {
  11206. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOTTY)
  11207. return libc.UintptrFromInt32(0)
  11208. }
  11209. input = m_STDIN_FILENO
  11210. output = int32(m_STDERR_FILENO)
  11211. }
  11212. /*
  11213. * Turn off echo if possible.
  11214. * If we are using a tty but are not the foreground pgrp this will
  11215. * generate SIGTTOU, so do it *before* installing the signal handlers.
  11216. */
  11217. if input != m_STDIN_FILENO && libc.Xtcgetattr(tls, input, bp+48) == 0 {
  11218. libc.Xmemcpy(tls, bp+4, bp+48, uint64(44))
  11219. if !(flags&libc.Int32FromInt32(m_RPP_ECHO_ON) != 0) {
  11220. (*(*Ttermios)(unsafe.Pointer(bp + 4))).Fc_lflag &= libc.Uint32FromInt32(^(libc.Int32FromInt32(m_ECHO) | libc.Int32FromInt32(m_ECHONL)))
  11221. }
  11222. libc.Xtcsetattr(tls, input, libc.Int32FromInt32(m_TCSAFLUSH)|libc.Int32FromInt32(m_TCSASOFT), bp+4)
  11223. } else {
  11224. libc.Xmemset(tls, bp+4, 0, uint64(44))
  11225. (*(*Ttermios)(unsafe.Pointer(bp + 4))).Fc_lflag |= uint32(m_ECHO)
  11226. libc.Xmemset(tls, bp+48, 0, uint64(44))
  11227. (*(*Ttermios)(unsafe.Pointer(bp + 48))).Fc_lflag |= uint32(m_ECHO)
  11228. }
  11229. /*
  11230. * Catch signals that would otherwise cause the user to end
  11231. * up with echo turned off in the shell. Don't worry about
  11232. * things like SIGXCPU and SIGVTALRM for now.
  11233. */
  11234. libc.Xsigemptyset(tls, bp+96+8)
  11235. (*(*Tsigaction)(unsafe.Pointer(bp + 96))).Fsa_flags = 0 /* don't restart system calls */
  11236. *(*uintptr)(unsafe.Pointer(bp + 96)) = __ccgo_fp(_handler)
  11237. libc.Xsigaction(tls, int32(m_SIGALRM), bp+96, bp+248)
  11238. libc.Xsigaction(tls, int32(m_SIGHUP), bp+96, bp+552)
  11239. libc.Xsigaction(tls, int32(m_SIGINT), bp+96, bp+400)
  11240. libc.Xsigaction(tls, int32(m_SIGPIPE), bp+96, bp+1464)
  11241. libc.Xsigaction(tls, int32(m_SIGQUIT), bp+96, bp+704)
  11242. libc.Xsigaction(tls, int32(m_SIGTERM), bp+96, bp+856)
  11243. libc.Xsigaction(tls, int32(m_SIGTSTP), bp+96, bp+1008)
  11244. libc.Xsigaction(tls, int32(m_SIGTTIN), bp+96, bp+1160)
  11245. libc.Xsigaction(tls, int32(m_SIGTTOU), bp+96, bp+1312)
  11246. if !(flags&libc.Int32FromInt32(m_RPP_STDIN) != 0) {
  11247. libc.Xwrite(tls, output, prompt, libc.Xstrlen(tls, prompt))
  11248. }
  11249. end = buf + uintptr(bufsiz) - uintptr(1)
  11250. p = buf
  11251. for {
  11252. v5 = libc.Xread(tls, input, bp, uint64(1))
  11253. nr = v5
  11254. if !(v5 == int64(1) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp))) != int32('\n') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp))) != int32('\r')) {
  11255. break
  11256. }
  11257. if p < end {
  11258. if flags&int32(m_RPP_SEVENBIT) != 0 {
  11259. *(*uint8)(unsafe.Pointer(bp)) = uint8(int32(*(*uint8)(unsafe.Pointer(bp))) & libc.Int32FromInt32(0x7f))
  11260. }
  11261. if libc.BoolInt32(uint32(*(*uint8)(unsafe.Pointer(bp)))|uint32(32)-uint32('a') < uint32(26)) != 0 {
  11262. if flags&int32(m_RPP_FORCELOWER) != 0 {
  11263. *(*uint8)(unsafe.Pointer(bp)) = libc.Uint8FromInt32(libc.Xtolower(tls, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp)))))
  11264. }
  11265. if flags&int32(m_RPP_FORCEUPPER) != 0 {
  11266. *(*uint8)(unsafe.Pointer(bp)) = libc.Uint8FromInt32(libc.Xtoupper(tls, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp)))))
  11267. }
  11268. }
  11269. v6 = p
  11270. p++
  11271. *(*uint8)(unsafe.Pointer(v6)) = *(*uint8)(unsafe.Pointer(bp))
  11272. }
  11273. }
  11274. *(*uint8)(unsafe.Pointer(p)) = uint8('\000')
  11275. save_errno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  11276. if !((*(*Ttermios)(unsafe.Pointer(bp + 4))).Fc_lflag&libc.Uint32FromInt32(m_ECHO) != 0) {
  11277. libc.Xwrite(tls, output, __ccgo_ts+439, uint64(1))
  11278. }
  11279. /* Restore old terminal settings and signals. */
  11280. if libc.Xmemcmp(tls, bp+4, bp+48, uint64(44)) != 0 {
  11281. sigttou = libc.AtomicLoadPInt32(uintptr(unsafe.Pointer(&_signo)) + libc.UintptrFromInt32(m_SIGTTOU)*4)
  11282. /* Ignore SIGTTOU generated when we are not the fg pgrp. */
  11283. for libc.Xtcsetattr(tls, input, libc.Int32FromInt32(m_TCSAFLUSH)|libc.Int32FromInt32(m_TCSASOFT), bp+48) == -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) {
  11284. continue
  11285. }
  11286. libc.AtomicStorePInt32(uintptr(unsafe.Pointer(&_signo))+22*4, sigttou)
  11287. }
  11288. libc.Xsigaction(tls, int32(m_SIGALRM), bp+248, libc.UintptrFromInt32(0))
  11289. libc.Xsigaction(tls, int32(m_SIGHUP), bp+552, libc.UintptrFromInt32(0))
  11290. libc.Xsigaction(tls, int32(m_SIGINT), bp+400, libc.UintptrFromInt32(0))
  11291. libc.Xsigaction(tls, int32(m_SIGQUIT), bp+704, libc.UintptrFromInt32(0))
  11292. libc.Xsigaction(tls, int32(m_SIGPIPE), bp+1464, libc.UintptrFromInt32(0))
  11293. libc.Xsigaction(tls, int32(m_SIGTERM), bp+856, libc.UintptrFromInt32(0))
  11294. libc.Xsigaction(tls, int32(m_SIGTSTP), bp+1008, libc.UintptrFromInt32(0))
  11295. libc.Xsigaction(tls, int32(m_SIGTTIN), bp+1160, libc.UintptrFromInt32(0))
  11296. libc.Xsigaction(tls, int32(m_SIGTTOU), bp+1312, libc.UintptrFromInt32(0))
  11297. if input != m_STDIN_FILENO {
  11298. libc.Xclose(tls, input)
  11299. }
  11300. /*
  11301. * If we were interrupted by a signal, resend it to ourselves
  11302. * now that we have restored the signal handlers.
  11303. */
  11304. i = 0
  11305. for {
  11306. if !(i < int32(m__NSIG)) {
  11307. break
  11308. }
  11309. if libc.AtomicLoadPInt32(uintptr(unsafe.Pointer(&_signo))+uintptr(i)*4) != 0 {
  11310. libc.Xkill(tls, libc.Xgetpid(tls), i)
  11311. switch i {
  11312. case int32(m_SIGTSTP):
  11313. fallthrough
  11314. case int32(m_SIGTTIN):
  11315. fallthrough
  11316. case int32(m_SIGTTOU):
  11317. need_restart = int32(1)
  11318. }
  11319. }
  11320. goto _7
  11321. _7:
  11322. ;
  11323. i++
  11324. }
  11325. if need_restart != 0 {
  11326. goto restart
  11327. }
  11328. if save_errno != 0 {
  11329. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = save_errno
  11330. }
  11331. if nr == int64(-int32(1)) {
  11332. v8 = libc.UintptrFromInt32(0)
  11333. } else {
  11334. v8 = buf
  11335. }
  11336. return v8
  11337. }
  11338. func _handler(tls *libc.TLS, s int32) {
  11339. libc.AtomicStorePInt32(uintptr(unsafe.Pointer(&_signo))+uintptr(s)*4, int32(1))
  11340. }
  11341. const m_UINT64_MAX1 = 18446744073709551615
  11342. /*
  11343. * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
  11344. * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
  11345. */
  11346. func Xreallocarray(tls *libc.TLS, optr uintptr, nmemb Tsize_t, size Tsize_t) (r uintptr) {
  11347. 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 {
  11348. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOMEM)
  11349. return libc.UintptrFromInt32(0)
  11350. }
  11351. return libc.Xrealloc(tls, optr, size*nmemb)
  11352. }
  11353. const m_UINT64_MAX2 = "0xffffffffffffffffu"
  11354. func Xreallocf(tls *libc.TLS, ptr uintptr, size Tsize_t) (r uintptr) {
  11355. var nptr uintptr
  11356. _ = nptr
  11357. nptr = libc.Xrealloc(tls, ptr, size)
  11358. /*
  11359. * When the System V compatibility option (malloc "V" flag) is
  11360. * in effect, realloc(ptr, 0) frees the memory and returns NULL.
  11361. * So, to avoid double free, call free() only when size != 0.
  11362. * realloc(ptr, 0) can't fail when ptr != NULL.
  11363. */
  11364. if !(nptr != 0) && ptr != 0 && size != uint64(0) {
  11365. libc.Xfree(tls, ptr)
  11366. }
  11367. return nptr
  11368. }
  11369. const m_UINT64_MAX3 = 18446744073709551615
  11370. /*
  11371. * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
  11372. * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
  11373. */
  11374. func Xrecallocarray(tls *libc.TLS, ptr uintptr, oldnmemb Tsize_t, newnmemb Tsize_t, size Tsize_t) (r uintptr) {
  11375. var d, newsize, oldsize Tsize_t
  11376. var newptr uintptr
  11377. _, _, _, _ = d, newptr, newsize, oldsize
  11378. if ptr == libc.UintptrFromInt32(0) {
  11379. return libc.Xcalloc(tls, newnmemb, size)
  11380. }
  11381. 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 {
  11382. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOMEM)
  11383. return libc.UintptrFromInt32(0)
  11384. }
  11385. newsize = newnmemb * size
  11386. 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 {
  11387. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11388. return libc.UintptrFromInt32(0)
  11389. }
  11390. oldsize = oldnmemb * size
  11391. /*
  11392. * Don't bother too much if we're shrinking just a bit,
  11393. * we do not shrink for series of small steps, oh well.
  11394. */
  11395. if newsize <= oldsize {
  11396. d = oldsize - newsize
  11397. if d < oldsize/uint64(2) && d < libc.Uint64FromInt32(libc.Xgetpagesize(tls)) {
  11398. libc.Xmemset(tls, ptr+uintptr(newsize), 0, d)
  11399. return ptr
  11400. }
  11401. }
  11402. newptr = libc.Xmalloc(tls, newsize)
  11403. if newptr == libc.UintptrFromInt32(0) {
  11404. return libc.UintptrFromInt32(0)
  11405. }
  11406. if newsize > oldsize {
  11407. libc.Xmemcpy(tls, newptr, ptr, oldsize)
  11408. libc.Xmemset(tls, newptr+uintptr(oldsize), 0, newsize-oldsize)
  11409. } else {
  11410. libc.Xmemcpy(tls, newptr, ptr, newsize)
  11411. }
  11412. Xexplicit_bzero(tls, ptr, oldsize)
  11413. libc.Xfree(tls, ptr)
  11414. return newptr
  11415. }
  11416. const m_UINT64_MAX4 = "0xffffffffffffffffu"
  11417. /*
  11418. * Swap two areas of size number of bytes. Although qsort(3) permits random
  11419. * blocks of memory to be sorted, sorting pointers is almost certainly the
  11420. * common case (and, were it not, could easily be made so). Regardless, it
  11421. * isn't worth optimizing; the SWAP's get sped up by the cache, and pointer
  11422. * arithmetic gets lost in the time required for comparison function calls.
  11423. */
  11424. /* Copy one block of size size to another. */
  11425. /*
  11426. * Build the list into a heap, where a heap is defined such that for
  11427. * the records K1 ... KN, Kj/2 >= Kj for 1 <= j/2 <= j <= N.
  11428. *
  11429. * There are two cases. If j == nmemb, select largest of Ki and Kj. If
  11430. * j < nmemb, select largest of Ki, Kj and Kj+1.
  11431. */
  11432. /*
  11433. * Select the top of the heap and 'heapify'. Since by far the most expensive
  11434. * action is the call to the compar function, a considerable optimization
  11435. * in the average case can be achieved due to the fact that k, the displaced
  11436. * element, is usually quite small, so it would be preferable to first
  11437. * heapify, always maintaining the invariant that the larger child is copied
  11438. * over its parent's record.
  11439. *
  11440. * Then, starting from the *bottom* of the heap, finding k's correct place,
  11441. * again maintaining the invariant. As a result of the invariant no element
  11442. * is 'lost' when k is assigned its correct place in the heap.
  11443. *
  11444. * The time savings from this optimization are on the order of 15-20% for the
  11445. * average case. See Knuth, Vol. 3, page 158, problem 18.
  11446. *
  11447. * XXX Don't break the #define SELECT line, below. Reiser cpp gets upset.
  11448. */
  11449. // C documentation
  11450. //
  11451. // /*
  11452. // * Heapsort -- Knuth, Vol. 3, page 145. Runs in O (N lg N), both average
  11453. // * and worst. While heapsort is faster than the worst case of quicksort,
  11454. // * the BSD quicksort does median selection so that the chance of finding
  11455. // * a data set that will trigger the worst case is nonexistent. Heapsort's
  11456. // * only advantage over quicksort is that it requires little additional memory.
  11457. // */
  11458. func Xheapsort(tls *libc.TLS, vbase uintptr, nmemb Tsize_t, size Tsize_t, compar uintptr) (r int32) {
  11459. var base, k, p, t, tmp1, tmp2, v1, v12, v13, v16, v17, v22, v23, v27, v28, v31, v32, v8, v9 uintptr
  11460. var cnt, i, j, l, v10, v14, v19, v20, v25, v29, v3, v5, v6 Tsize_t
  11461. var tmp uint8
  11462. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  11463. if nmemb <= uint64(1) {
  11464. return 0
  11465. }
  11466. if !(size != 0) {
  11467. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11468. return -int32(1)
  11469. }
  11470. v1 = libc.Xmalloc(tls, size)
  11471. k = v1
  11472. if v1 == libc.UintptrFromInt32(0) {
  11473. return -int32(1)
  11474. }
  11475. /*
  11476. * Items are numbered from 1 to nmemb, so offset from size bytes
  11477. * below the starting address.
  11478. */
  11479. base = vbase - uintptr(size)
  11480. l = nmemb/uint64(2) + uint64(1)
  11481. for {
  11482. l--
  11483. v3 = l
  11484. if !(v3 != 0) {
  11485. break
  11486. }
  11487. i = l
  11488. for {
  11489. v5 = i * libc.Uint64FromInt32(2)
  11490. j = v5
  11491. if !(v5 <= nmemb) {
  11492. break
  11493. }
  11494. p = base + uintptr(j*size)
  11495. if j < nmemb && (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{compar})))(tls, p, p+uintptr(size)) < 0 {
  11496. p += uintptr(size)
  11497. j++
  11498. }
  11499. t = base + uintptr(i*size)
  11500. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{compar})))(tls, p, t) <= 0 {
  11501. break
  11502. }
  11503. cnt = size
  11504. for {
  11505. tmp = *(*uint8)(unsafe.Pointer(t))
  11506. v8 = t
  11507. t++
  11508. *(*uint8)(unsafe.Pointer(v8)) = *(*uint8)(unsafe.Pointer(p))
  11509. v9 = p
  11510. p++
  11511. *(*uint8)(unsafe.Pointer(v9)) = tmp
  11512. goto _7
  11513. _7:
  11514. ;
  11515. cnt--
  11516. v6 = cnt
  11517. if !(v6 != 0) {
  11518. break
  11519. }
  11520. }
  11521. goto _4
  11522. _4:
  11523. ;
  11524. i = j
  11525. }
  11526. goto _2
  11527. _2:
  11528. }
  11529. /*
  11530. * For each element of the heap, save the largest element into its
  11531. * final slot, save the displaced element (k), then recreate the
  11532. * heap.
  11533. */
  11534. for nmemb > uint64(1) {
  11535. cnt = size
  11536. tmp1 = k
  11537. tmp2 = base + uintptr(nmemb*size)
  11538. for {
  11539. v12 = tmp1
  11540. tmp1++
  11541. v13 = tmp2
  11542. tmp2++
  11543. *(*uint8)(unsafe.Pointer(v12)) = *(*uint8)(unsafe.Pointer(v13))
  11544. goto _11
  11545. _11:
  11546. ;
  11547. cnt--
  11548. v10 = cnt
  11549. if !(v10 != 0) {
  11550. break
  11551. }
  11552. }
  11553. cnt = size
  11554. tmp1 = base + uintptr(nmemb*size)
  11555. tmp2 = base + uintptr(size)
  11556. for {
  11557. v16 = tmp1
  11558. tmp1++
  11559. v17 = tmp2
  11560. tmp2++
  11561. *(*uint8)(unsafe.Pointer(v16)) = *(*uint8)(unsafe.Pointer(v17))
  11562. goto _15
  11563. _15:
  11564. ;
  11565. cnt--
  11566. v14 = cnt
  11567. if !(v14 != 0) {
  11568. break
  11569. }
  11570. }
  11571. nmemb--
  11572. i = uint64(1)
  11573. for {
  11574. v19 = i * libc.Uint64FromInt32(2)
  11575. j = v19
  11576. if !(v19 <= nmemb) {
  11577. break
  11578. }
  11579. p = base + uintptr(j*size)
  11580. if j < nmemb && (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{compar})))(tls, p, p+uintptr(size)) < 0 {
  11581. p += uintptr(size)
  11582. j++
  11583. }
  11584. t = base + uintptr(i*size)
  11585. cnt = size
  11586. tmp1 = t
  11587. tmp2 = p
  11588. for {
  11589. v22 = tmp1
  11590. tmp1++
  11591. v23 = tmp2
  11592. tmp2++
  11593. *(*uint8)(unsafe.Pointer(v22)) = *(*uint8)(unsafe.Pointer(v23))
  11594. goto _21
  11595. _21:
  11596. ;
  11597. cnt--
  11598. v20 = cnt
  11599. if !(v20 != 0) {
  11600. break
  11601. }
  11602. }
  11603. goto _18
  11604. _18:
  11605. ;
  11606. i = j
  11607. }
  11608. for {
  11609. j = i
  11610. i = j / uint64(2)
  11611. p = base + uintptr(j*size)
  11612. t = base + uintptr(i*size)
  11613. if j == uint64(1) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{compar})))(tls, k, t) < 0 {
  11614. cnt = size
  11615. tmp1 = p
  11616. tmp2 = k
  11617. for {
  11618. v27 = tmp1
  11619. tmp1++
  11620. v28 = tmp2
  11621. tmp2++
  11622. *(*uint8)(unsafe.Pointer(v27)) = *(*uint8)(unsafe.Pointer(v28))
  11623. goto _26
  11624. _26:
  11625. ;
  11626. cnt--
  11627. v25 = cnt
  11628. if !(v25 != 0) {
  11629. break
  11630. }
  11631. }
  11632. break
  11633. }
  11634. cnt = size
  11635. tmp1 = p
  11636. tmp2 = t
  11637. for {
  11638. v31 = tmp1
  11639. tmp1++
  11640. v32 = tmp2
  11641. tmp2++
  11642. *(*uint8)(unsafe.Pointer(v31)) = *(*uint8)(unsafe.Pointer(v32))
  11643. goto _30
  11644. _30:
  11645. ;
  11646. cnt--
  11647. v29 = cnt
  11648. if !(v29 != 0) {
  11649. break
  11650. }
  11651. }
  11652. goto _24
  11653. _24:
  11654. }
  11655. }
  11656. libc.Xfree(tls, k)
  11657. return 0
  11658. }
  11659. const m_THRESHOLD = 16
  11660. /*
  11661. * Find the next possible pointer head. (Trickery for forcing an array
  11662. * to do double duty as a linked list when objects do not align with word
  11663. * boundaries.
  11664. */
  11665. /* Assumption: PSIZE is a power of 2. */
  11666. // C documentation
  11667. //
  11668. // /*
  11669. // * Arguments are as for qsort.
  11670. // */
  11671. func Xmergesort(tls *libc.TLS, base uintptr, nmemb Tsize_t, size Tsize_t, cmp uintptr) (r int32) {
  11672. 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
  11673. var big, iflag, sense, v2 int32
  11674. var i, v8 Tsize_t
  11675. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  11676. if size < libc.Uint64FromInt64(8)/libc.Uint64FromInt32(2) { /* Pointers must fit into 2 * size. */
  11677. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11678. return -int32(1)
  11679. }
  11680. if nmemb == uint64(0) {
  11681. return 0
  11682. }
  11683. /*
  11684. * XXX
  11685. * Stupid subtraction for the Cray.
  11686. */
  11687. iflag = 0
  11688. if !(size%libc.Uint64FromInt64(4) != 0) && !(libc.Uint64FromInt64(int64(base)-int64(libc.UintptrFromInt32(0)))%libc.Uint64FromInt64(4) != 0) {
  11689. iflag = int32(1)
  11690. }
  11691. v1 = libc.Xmalloc(tls, nmemb*size+uint64(8))
  11692. list2 = v1
  11693. if v1 == libc.UintptrFromInt32(0) {
  11694. return -int32(1)
  11695. }
  11696. list1 = base
  11697. _setup(tls, list1, list2, nmemb, size, cmp)
  11698. last = list2 + uintptr(nmemb*size)
  11699. v2 = libc.Int32FromInt32(0)
  11700. big = v2
  11701. i = libc.Uint64FromInt32(v2)
  11702. 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 {
  11703. l2 = list1
  11704. p1 = uintptr(libc.Uint64FromInt64(int64(list1+libc.UintptrFromInt64(8)-libc.UintptrFromInt32(1))-int64(libc.UintptrFromInt32(0))) & ^(libc.Uint64FromInt64(8) - libc.Uint64FromInt32(1)))
  11705. v4 = list2
  11706. p2 = v4
  11707. tp2 = v4
  11708. for {
  11709. if !(p2 != last) {
  11710. break
  11711. }
  11712. 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)))))
  11713. f1 = l2
  11714. v5 = list1 + uintptr(int64(p2)-int64(list2))
  11715. l1 = v5
  11716. f2 = v5
  11717. if p2 != last {
  11718. 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)))))
  11719. }
  11720. l2 = list1 + uintptr(int64(p2)-int64(list2))
  11721. for f1 < l1 && f2 < l2 {
  11722. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f1, f2) <= 0 {
  11723. q = f2
  11724. b = f1
  11725. t = l1
  11726. sense = -int32(1)
  11727. } else {
  11728. q = f1
  11729. b = f2
  11730. t = l2
  11731. sense = 0
  11732. }
  11733. if !!(big != 0) {
  11734. goto _6
  11735. } /* here i = 0 */
  11736. for {
  11737. b += uintptr(size)
  11738. if !(b < t && (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, b) > sense) {
  11739. break
  11740. }
  11741. i++
  11742. v8 = i
  11743. if v8 == uint64(6) {
  11744. big = int32(1)
  11745. goto EXPONENTIAL
  11746. }
  11747. }
  11748. goto _7
  11749. _6:
  11750. ;
  11751. goto EXPONENTIAL
  11752. EXPONENTIAL:
  11753. ;
  11754. i = size
  11755. for {
  11756. v10 = b + uintptr(i)
  11757. p = v10
  11758. if v10 >= t {
  11759. v11 = t - uintptr(size)
  11760. p = v11
  11761. if v11 > b && (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, p) <= sense {
  11762. t = p
  11763. } else {
  11764. b = p
  11765. }
  11766. break
  11767. } else {
  11768. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, p) <= sense {
  11769. t = p
  11770. if i == size {
  11771. big = 0
  11772. }
  11773. goto FASTCASE
  11774. } else {
  11775. b = p
  11776. }
  11777. }
  11778. goto _9
  11779. _9:
  11780. ;
  11781. i <<= uint64(1)
  11782. }
  11783. for t > b+uintptr(size) {
  11784. i = libc.Uint64FromInt64(int64(t)-int64(b)) / size >> int32(1) * size
  11785. v12 = b + uintptr(i)
  11786. p = v12
  11787. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, v12) <= sense {
  11788. t = p
  11789. } else {
  11790. b = p
  11791. }
  11792. }
  11793. goto COPY
  11794. goto FASTCASE
  11795. FASTCASE:
  11796. ;
  11797. for i > size {
  11798. i >>= uint64(1)
  11799. v13 = b + uintptr(i)
  11800. p = v13
  11801. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, v13) <= sense {
  11802. t = p
  11803. } else {
  11804. b = p
  11805. }
  11806. }
  11807. goto COPY
  11808. COPY:
  11809. ;
  11810. b = t
  11811. _7:
  11812. ;
  11813. i = size
  11814. if q == f1 {
  11815. if iflag != 0 {
  11816. for cond := true; cond; cond = f2 < b {
  11817. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f2))
  11818. f2 += uintptr(4)
  11819. tp2 += uintptr(4)
  11820. }
  11821. for {
  11822. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f1))
  11823. f1 += uintptr(4)
  11824. tp2 += uintptr(4)
  11825. goto _14
  11826. _14:
  11827. ;
  11828. i -= uint64(4)
  11829. if !(i != 0) {
  11830. break
  11831. }
  11832. }
  11833. } else {
  11834. for cond := true; cond; cond = f2 < b {
  11835. v15 = tp2
  11836. tp2++
  11837. v16 = f2
  11838. f2++
  11839. *(*uint8)(unsafe.Pointer(v15)) = *(*uint8)(unsafe.Pointer(v16))
  11840. }
  11841. for {
  11842. v18 = tp2
  11843. tp2++
  11844. v19 = f1
  11845. f1++
  11846. *(*uint8)(unsafe.Pointer(v18)) = *(*uint8)(unsafe.Pointer(v19))
  11847. goto _17
  11848. _17:
  11849. ;
  11850. i -= uint64(1)
  11851. if !(i != 0) {
  11852. break
  11853. }
  11854. }
  11855. }
  11856. } else {
  11857. if iflag != 0 {
  11858. for cond := true; cond; cond = f1 < b {
  11859. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f1))
  11860. f1 += uintptr(4)
  11861. tp2 += uintptr(4)
  11862. }
  11863. for {
  11864. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f2))
  11865. f2 += uintptr(4)
  11866. tp2 += uintptr(4)
  11867. goto _20
  11868. _20:
  11869. ;
  11870. i -= uint64(4)
  11871. if !(i != 0) {
  11872. break
  11873. }
  11874. }
  11875. } else {
  11876. for cond := true; cond; cond = f1 < b {
  11877. v21 = tp2
  11878. tp2++
  11879. v22 = f1
  11880. f1++
  11881. *(*uint8)(unsafe.Pointer(v21)) = *(*uint8)(unsafe.Pointer(v22))
  11882. }
  11883. for {
  11884. v24 = tp2
  11885. tp2++
  11886. v25 = f2
  11887. f2++
  11888. *(*uint8)(unsafe.Pointer(v24)) = *(*uint8)(unsafe.Pointer(v25))
  11889. goto _23
  11890. _23:
  11891. ;
  11892. i -= uint64(1)
  11893. if !(i != 0) {
  11894. break
  11895. }
  11896. }
  11897. }
  11898. }
  11899. }
  11900. if f2 < l2 {
  11901. if iflag != 0 {
  11902. for cond := true; cond; cond = f2 < l2 {
  11903. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f2))
  11904. f2 += uintptr(4)
  11905. tp2 += uintptr(4)
  11906. }
  11907. } else {
  11908. for cond := true; cond; cond = f2 < l2 {
  11909. v26 = tp2
  11910. tp2++
  11911. v27 = f2
  11912. f2++
  11913. *(*uint8)(unsafe.Pointer(v26)) = *(*uint8)(unsafe.Pointer(v27))
  11914. }
  11915. }
  11916. } else {
  11917. if f1 < l1 {
  11918. if iflag != 0 {
  11919. for cond := true; cond; cond = f1 < l1 {
  11920. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f1))
  11921. f1 += uintptr(4)
  11922. tp2 += uintptr(4)
  11923. }
  11924. } else {
  11925. for cond := true; cond; cond = f1 < l1 {
  11926. v28 = tp2
  11927. tp2++
  11928. v29 = f1
  11929. f1++
  11930. *(*uint8)(unsafe.Pointer(v28)) = *(*uint8)(unsafe.Pointer(v29))
  11931. }
  11932. }
  11933. }
  11934. }
  11935. *(*uintptr)(unsafe.Pointer(p1)) = l2
  11936. goto _3
  11937. _3:
  11938. ;
  11939. p1 = uintptr(libc.Uint64FromInt64(int64(l2+libc.UintptrFromInt64(8)-libc.UintptrFromInt32(1))-int64(libc.UintptrFromInt32(0))) & ^(libc.Uint64FromInt64(8) - libc.Uint64FromInt32(1)))
  11940. }
  11941. tp2 = list1 /* swap list1, list2 */
  11942. list1 = list2
  11943. list2 = tp2
  11944. last = list2 + uintptr(nmemb*size)
  11945. }
  11946. if base == list2 {
  11947. libc.Xmemmove(tls, list2, list1, nmemb*size)
  11948. list2 = list1
  11949. }
  11950. libc.Xfree(tls, list2)
  11951. return 0
  11952. }
  11953. // C documentation
  11954. //
  11955. // /*
  11956. // * Optional hybrid natural/pairwise first pass. Eats up list1 in runs of
  11957. // * increasing order, list2 in a corresponding linked list. Checks for runs
  11958. // * when THRESHOLD/2 pairs compare with same sense. (Only used when NATURAL
  11959. // * is defined. Otherwise simple pairwise merging is used.)
  11960. // */
  11961. func _setup(tls *libc.TLS, list1 uintptr, list2 uintptr, n Tsize_t, size Tsize_t, cmp uintptr) {
  11962. var f1, f2, l2, last, p2, s, v10, v13, v14, v17, v18, v19, v20, v4, v7, v8 uintptr
  11963. var i, length, sense, size2, tmp, v11, v15, v5 int32
  11964. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = f1, f2, i, l2, last, length, p2, s, sense, size2, tmp, v10, v11, v13, v14, v15, v17, v18, v19, v20, v4, v5, v7, v8
  11965. size2 = libc.Int32FromUint64(size * uint64(2))
  11966. if n <= uint64(5) {
  11967. _insertionsort(tls, list1, n, size, cmp)
  11968. *(*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)
  11969. return
  11970. }
  11971. /*
  11972. * Avoid running pointers out of bounds; limit n to evens
  11973. * for simplicity.
  11974. */
  11975. i = libc.Int32FromUint64(uint64(4) + n&uint64(1))
  11976. _insertionsort(tls, list1+uintptr((n-libc.Uint64FromInt32(i))*size), libc.Uint64FromInt32(i), size, cmp)
  11977. last = list1 + uintptr(size*(n-libc.Uint64FromInt32(i)))
  11978. *(*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)
  11979. p2 = list2
  11980. f1 = list1
  11981. sense = libc.BoolInt32((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f1, f1+uintptr(size)) > 0)
  11982. for {
  11983. if !(f1 < last) {
  11984. break
  11985. }
  11986. length = int32(2)
  11987. /* Find pairs with same sense. */
  11988. f2 = f1 + uintptr(size2)
  11989. for {
  11990. if !(f2 < last) {
  11991. break
  11992. }
  11993. if libc.BoolInt32((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f2, f2+uintptr(size)) > 0) != sense {
  11994. break
  11995. }
  11996. length += int32(2)
  11997. goto _2
  11998. _2:
  11999. ;
  12000. f2 += uintptr(size2)
  12001. }
  12002. if length < int32(m_THRESHOLD) { /* Pairwise merge */
  12003. for {
  12004. v4 = uintptr(int64(f1+uintptr(size2))-int64(list1)) + list2
  12005. *(*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
  12006. p2 = v4
  12007. if sense > 0 {
  12008. s = f1 + uintptr(size)
  12009. i = libc.Int32FromUint64(size)
  12010. for {
  12011. tmp = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f1)))
  12012. v7 = f1
  12013. f1++
  12014. *(*uint8)(unsafe.Pointer(v7)) = *(*uint8)(unsafe.Pointer(s))
  12015. v8 = s
  12016. s++
  12017. *(*uint8)(unsafe.Pointer(v8)) = libc.Uint8FromInt32(tmp)
  12018. goto _6
  12019. _6:
  12020. ;
  12021. i--
  12022. v5 = i
  12023. if !(v5 != 0) {
  12024. break
  12025. }
  12026. }
  12027. f1 -= uintptr(size)
  12028. }
  12029. goto _3
  12030. _3:
  12031. ;
  12032. f1 += uintptr(size2)
  12033. if !(f1 < f2) {
  12034. break
  12035. }
  12036. }
  12037. } else { /* Natural merge */
  12038. l2 = f2
  12039. f2 = f1 + uintptr(size2)
  12040. for {
  12041. if !(f2 < l2) {
  12042. break
  12043. }
  12044. if libc.BoolInt32((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f2-uintptr(size), f2) > 0) != sense {
  12045. v10 = uintptr(int64(f2)-int64(list1)) + list2
  12046. *(*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
  12047. p2 = v10
  12048. if sense > 0 {
  12049. s = f2 - uintptr(size)
  12050. for cond := true; cond; cond = f1 < s {
  12051. i = libc.Int32FromUint64(size)
  12052. for {
  12053. tmp = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f1)))
  12054. v13 = f1
  12055. f1++
  12056. *(*uint8)(unsafe.Pointer(v13)) = *(*uint8)(unsafe.Pointer(s))
  12057. v14 = s
  12058. s++
  12059. *(*uint8)(unsafe.Pointer(v14)) = libc.Uint8FromInt32(tmp)
  12060. goto _12
  12061. _12:
  12062. ;
  12063. i--
  12064. v11 = i
  12065. if !(v11 != 0) {
  12066. break
  12067. }
  12068. }
  12069. s -= uintptr(size2)
  12070. }
  12071. }
  12072. f1 = f2
  12073. }
  12074. goto _9
  12075. _9:
  12076. ;
  12077. f2 += uintptr(size2)
  12078. }
  12079. if sense > 0 {
  12080. s = f2 - uintptr(size)
  12081. for cond := true; cond; cond = f1 < s {
  12082. i = libc.Int32FromUint64(size)
  12083. for {
  12084. tmp = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f1)))
  12085. v17 = f1
  12086. f1++
  12087. *(*uint8)(unsafe.Pointer(v17)) = *(*uint8)(unsafe.Pointer(s))
  12088. v18 = s
  12089. s++
  12090. *(*uint8)(unsafe.Pointer(v18)) = libc.Uint8FromInt32(tmp)
  12091. goto _16
  12092. _16:
  12093. ;
  12094. i--
  12095. v15 = i
  12096. if !(v15 != 0) {
  12097. break
  12098. }
  12099. }
  12100. s -= uintptr(size2)
  12101. }
  12102. }
  12103. f1 = f2
  12104. if f2 < last || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f2-uintptr(size), f2) > 0 {
  12105. v19 = uintptr(int64(f2)-int64(list1)) + list2
  12106. *(*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
  12107. p2 = v19
  12108. } else {
  12109. v20 = list2 + uintptr(n*size)
  12110. *(*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
  12111. p2 = v20
  12112. }
  12113. }
  12114. goto _1
  12115. _1:
  12116. ;
  12117. sense = libc.BoolInt32(!(sense != 0))
  12118. }
  12119. }
  12120. // C documentation
  12121. //
  12122. // /*
  12123. // * This is to avoid out-of-bounds addresses in sorting the
  12124. // * last 4 elements.
  12125. // */
  12126. func _insertionsort(tls *libc.TLS, a uintptr, n Tsize_t, size Tsize_t, cmp uintptr) {
  12127. var ai, s, t, u, v6, v7 uintptr
  12128. var i, v4 int32
  12129. var tmp uint8
  12130. var v2 Tsize_t
  12131. _, _, _, _, _, _, _, _, _, _ = ai, i, s, t, tmp, u, v2, v4, v6, v7
  12132. ai = a + uintptr(size)
  12133. for {
  12134. n--
  12135. v2 = n
  12136. if !(v2 >= uint64(1)) {
  12137. break
  12138. }
  12139. t = ai
  12140. for {
  12141. if !(t > a) {
  12142. break
  12143. }
  12144. u = t - uintptr(size)
  12145. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, u, t) <= 0 {
  12146. break
  12147. }
  12148. s = t
  12149. i = libc.Int32FromUint64(size)
  12150. for {
  12151. tmp = *(*uint8)(unsafe.Pointer(u))
  12152. v6 = u
  12153. u++
  12154. *(*uint8)(unsafe.Pointer(v6)) = *(*uint8)(unsafe.Pointer(s))
  12155. v7 = s
  12156. s++
  12157. *(*uint8)(unsafe.Pointer(v7)) = tmp
  12158. goto _5
  12159. _5:
  12160. ;
  12161. i--
  12162. v4 = i
  12163. if !(v4 != 0) {
  12164. break
  12165. }
  12166. }
  12167. u -= uintptr(size)
  12168. goto _3
  12169. _3:
  12170. ;
  12171. t -= uintptr(size)
  12172. }
  12173. goto _1
  12174. _1:
  12175. ;
  12176. ai += uintptr(size)
  12177. }
  12178. }
  12179. const m_SIZE = 512
  12180. const m_THRESHOLD1 = 20
  12181. type Tstack = struct {
  12182. Fsa uintptr
  12183. Fsn int32
  12184. Fsi int32
  12185. }
  12186. func Xradixsort(tls *libc.TLS, a uintptr, n int32, tab uintptr, endch uint32) (r int32) {
  12187. bp := tls.Alloc(256)
  12188. defer tls.Free(256)
  12189. var c uint32
  12190. var tr uintptr
  12191. var _ /* tr0 at bp+0 */ [256]uint8
  12192. _, _ = c, tr
  12193. if tab == libc.UintptrFromInt32(0) {
  12194. tr = bp
  12195. c = uint32(0)
  12196. for {
  12197. if !(c < endch) {
  12198. break
  12199. }
  12200. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(c + uint32(1))
  12201. goto _1
  12202. _1:
  12203. ;
  12204. c++
  12205. }
  12206. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(0)
  12207. c++
  12208. for {
  12209. if !(c < uint32(256)) {
  12210. break
  12211. }
  12212. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(c)
  12213. goto _2
  12214. _2:
  12215. ;
  12216. c++
  12217. }
  12218. endch = uint32(0)
  12219. } else {
  12220. endch = uint32(*(*uint8)(unsafe.Pointer(tab + uintptr(endch))))
  12221. tr = tab
  12222. if endch != uint32(0) && endch != uint32(255) {
  12223. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  12224. return -int32(1)
  12225. }
  12226. }
  12227. _r_sort_a(tls, a, n, 0, tr, endch)
  12228. return 0
  12229. }
  12230. func Xsradixsort(tls *libc.TLS, a uintptr, n int32, tab uintptr, endch uint32) (r int32) {
  12231. bp := tls.Alloc(256)
  12232. defer tls.Free(256)
  12233. var c uint32
  12234. var ta, tr uintptr
  12235. var _ /* tr0 at bp+0 */ [256]uint8
  12236. _, _, _ = c, ta, tr
  12237. if a == libc.UintptrFromInt32(0) {
  12238. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EFAULT)
  12239. return -int32(1)
  12240. }
  12241. if tab == libc.UintptrFromInt32(0) {
  12242. tr = bp
  12243. c = uint32(0)
  12244. for {
  12245. if !(c < endch) {
  12246. break
  12247. }
  12248. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(c + uint32(1))
  12249. goto _1
  12250. _1:
  12251. ;
  12252. c++
  12253. }
  12254. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(0)
  12255. c++
  12256. for {
  12257. if !(c < uint32(256)) {
  12258. break
  12259. }
  12260. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(c)
  12261. goto _2
  12262. _2:
  12263. ;
  12264. c++
  12265. }
  12266. endch = uint32(0)
  12267. } else {
  12268. endch = uint32(*(*uint8)(unsafe.Pointer(tab + uintptr(endch))))
  12269. tr = tab
  12270. if endch != uint32(0) && endch != uint32(255) {
  12271. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  12272. return -int32(1)
  12273. }
  12274. }
  12275. if n < int32(m_THRESHOLD1) {
  12276. _simplesort(tls, a, n, 0, tr, endch)
  12277. } else {
  12278. ta = Xreallocarray(tls, libc.UintptrFromInt32(0), libc.Uint64FromInt32(n), uint64(8))
  12279. if ta == libc.UintptrFromInt32(0) {
  12280. return -int32(1)
  12281. }
  12282. _r_sort_b(tls, a, ta, n, 0, tr, endch)
  12283. libc.Xfree(tls, ta)
  12284. }
  12285. return 0
  12286. }
  12287. // C documentation
  12288. //
  12289. // /* Unstable, in-place sort. */
  12290. func _r_sort_a(tls *libc.TLS, a uintptr, n int32, i int32, tr uintptr, endch uint32) {
  12291. bp := tls.Alloc(10240)
  12292. defer tls.Free(10240)
  12293. var aj, ak, an, cp, r, sp, sp0, sp1, t, v1, v10, v12, v15, v16, v17, v2, v4, v6, v7, v9 uintptr
  12294. var bigc, c, v18, v5, v8 uint32
  12295. var temp Tstack
  12296. var _ /* s at bp+0 */ [512]Tstack
  12297. var _ /* top at bp+8192 */ [256]uintptr
  12298. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  12299. /* Set up stack. */
  12300. sp = bp
  12301. (*Tstack)(unsafe.Pointer(sp)).Fsa = a
  12302. (*Tstack)(unsafe.Pointer(sp)).Fsn = n
  12303. v1 = sp
  12304. sp += 16
  12305. (*Tstack)(unsafe.Pointer(v1)).Fsi = i
  12306. for !(bp >= sp) {
  12307. sp -= 16
  12308. v2 = sp
  12309. a = (*Tstack)(unsafe.Pointer(v2)).Fsa
  12310. n = (*Tstack)(unsafe.Pointer(sp)).Fsn
  12311. i = (*Tstack)(unsafe.Pointer(sp)).Fsi
  12312. if n < int32(m_THRESHOLD1) {
  12313. _simplesort(tls, a, n, i, tr, endch)
  12314. continue
  12315. }
  12316. an = a + uintptr(n)*8
  12317. /* Make character histogram. */
  12318. if _nc == uint32(0) {
  12319. _bmin = uint32(255) /* First occupied bin, excluding eos. */
  12320. ak = a
  12321. for {
  12322. if !(ak < an) {
  12323. break
  12324. }
  12325. v4 = ak
  12326. ak += 8
  12327. c = uint32(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(v4)) + uintptr(i)))))))
  12328. v6 = uintptr(unsafe.Pointer(&_count)) + uintptr(c)*4
  12329. *(*uint32)(unsafe.Pointer(v6))++
  12330. v5 = *(*uint32)(unsafe.Pointer(v6))
  12331. if v5 == uint32(1) && c != endch {
  12332. if c < _bmin {
  12333. _bmin = c
  12334. }
  12335. _nc++
  12336. }
  12337. goto _3
  12338. _3:
  12339. }
  12340. if sp+uintptr(_nc)*16 > bp+uintptr(m_SIZE)*16 { /* Get more stack. */
  12341. _r_sort_a(tls, a, n, i, tr, endch)
  12342. continue
  12343. }
  12344. }
  12345. /*
  12346. * Special case: if all strings have the same
  12347. * character at position i, move on to the next
  12348. * character.
  12349. */
  12350. if _nc == uint32(1) && _count[_bmin] == libc.Uint32FromInt32(n) {
  12351. (*Tstack)(unsafe.Pointer(sp)).Fsa = a
  12352. (*Tstack)(unsafe.Pointer(sp)).Fsn = n
  12353. v7 = sp
  12354. sp += 16
  12355. (*Tstack)(unsafe.Pointer(v7)).Fsi = i + libc.Int32FromInt32(1)
  12356. v8 = libc.Uint32FromInt32(0)
  12357. _count[_bmin] = v8
  12358. _nc = v8
  12359. continue
  12360. }
  12361. /*
  12362. * Set top[]; push incompletely sorted bins onto stack.
  12363. * top[] = pointers to last out-of-place element in bins.
  12364. * count[] = counts of elements in bins.
  12365. * Before permuting: top[c-1] + count[c] = top[c];
  12366. * during deal: top[c] counts down to top[c-1].
  12367. */
  12368. v9 = sp
  12369. sp1 = v9
  12370. sp0 = v9 /* Stack position of biggest bin. */
  12371. bigc = uint32(2) /* Size of biggest bin. */
  12372. if endch == uint32(0) { /* Special case: set top[eos]. */
  12373. v10 = a + uintptr(_count[0])*8
  12374. ak = v10
  12375. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[0] = v10
  12376. } else {
  12377. ak = a
  12378. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[int32(255)] = an
  12379. }
  12380. cp = uintptr(unsafe.Pointer(&_count)) + uintptr(_bmin)*4
  12381. for {
  12382. if !(_nc > uint32(0)) {
  12383. break
  12384. }
  12385. for *(*uint32)(unsafe.Pointer(cp)) == uint32(0) { /* Find next non-empty pile. */
  12386. cp += 4
  12387. }
  12388. if *(*uint32)(unsafe.Pointer(cp)) > uint32(1) {
  12389. if *(*uint32)(unsafe.Pointer(cp)) > bigc {
  12390. bigc = *(*uint32)(unsafe.Pointer(cp))
  12391. sp1 = sp
  12392. }
  12393. (*Tstack)(unsafe.Pointer(sp)).Fsa = ak
  12394. (*Tstack)(unsafe.Pointer(sp)).Fsn = libc.Int32FromUint32(*(*uint32)(unsafe.Pointer(cp)))
  12395. v12 = sp
  12396. sp += 16
  12397. (*Tstack)(unsafe.Pointer(v12)).Fsi = i + libc.Int32FromInt32(1)
  12398. }
  12399. ak += uintptr(*(*uint32)(unsafe.Pointer(cp))) * 8
  12400. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[(int64(cp)-t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_count))))/4] = ak
  12401. _nc--
  12402. goto _11
  12403. _11:
  12404. ;
  12405. cp += 4
  12406. }
  12407. temp = *(*Tstack)(unsafe.Pointer(sp0))
  12408. *(*Tstack)(unsafe.Pointer(sp0)) = *(*Tstack)(unsafe.Pointer(sp1))
  12409. *(*Tstack)(unsafe.Pointer(sp1)) = temp /* Play it safe -- biggest bin last. */
  12410. /*
  12411. * Permute misplacements home. Already home: everything
  12412. * before aj, and in bin[c], items from top[c] on.
  12413. * Inner loop:
  12414. * r = next element to put in place;
  12415. * ak = top[r[i]] = location to put the next element.
  12416. * aj = bottom of 1st disordered bin.
  12417. * Outer loop:
  12418. * Once the 1st disordered bin is done, ie. aj >= ak,
  12419. * aj<-aj + count[c] connects the bins in a linked list;
  12420. * reset count[c].
  12421. */
  12422. aj = a
  12423. for {
  12424. if !(aj < an) {
  12425. break
  12426. }
  12427. r = *(*uintptr)(unsafe.Pointer(aj))
  12428. for {
  12429. v18 = uint32(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(r + uintptr(i)))))))
  12430. c = v18
  12431. v17 = bp + 8192 + uintptr(v18)*8
  12432. *(*uintptr)(unsafe.Pointer(v17)) -= 8
  12433. v16 = *(*uintptr)(unsafe.Pointer(v17))
  12434. v15 = v16
  12435. ak = v15
  12436. if !(aj < v15) {
  12437. break
  12438. }
  12439. t = *(*uintptr)(unsafe.Pointer(ak))
  12440. *(*uintptr)(unsafe.Pointer(ak)) = r
  12441. r = t
  12442. goto _14
  12443. _14:
  12444. }
  12445. goto _13
  12446. _13:
  12447. ;
  12448. *(*uintptr)(unsafe.Pointer(aj)) = r
  12449. aj += uintptr(_count[c]) * 8
  12450. _count[c] = libc.Uint32FromInt32(0)
  12451. }
  12452. }
  12453. }
  12454. var _count [256]uint32
  12455. var _nc uint32
  12456. var _bmin uint32
  12457. // C documentation
  12458. //
  12459. // /* Stable sort, requiring additional memory. */
  12460. func _r_sort_b(tls *libc.TLS, a uintptr, ta uintptr, n int32, i int32, tr uintptr, endch uint32) {
  12461. bp := tls.Alloc(10240)
  12462. defer tls.Free(10240)
  12463. var ai, ak, cp, sp, sp0, sp1, v1, v11, v13, v14, v16, v17, v18, v2, v4, v6, v7, v8 uintptr
  12464. var bigc, c, v10, v5 uint32
  12465. var temp Tstack
  12466. var _ /* s at bp+0 */ [512]Tstack
  12467. var _ /* top at bp+8192 */ [256]uintptr
  12468. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ai, ak, bigc, c, cp, sp, sp0, sp1, temp, v1, v10, v11, v13, v14, v16, v17, v18, v2, v4, v5, v6, v7, v8
  12469. sp = bp
  12470. (*Tstack)(unsafe.Pointer(sp)).Fsa = a
  12471. (*Tstack)(unsafe.Pointer(sp)).Fsn = n
  12472. v1 = sp
  12473. sp += 16
  12474. (*Tstack)(unsafe.Pointer(v1)).Fsi = i
  12475. for !(bp >= sp) {
  12476. sp -= 16
  12477. v2 = sp
  12478. a = (*Tstack)(unsafe.Pointer(v2)).Fsa
  12479. n = (*Tstack)(unsafe.Pointer(sp)).Fsn
  12480. i = (*Tstack)(unsafe.Pointer(sp)).Fsi
  12481. if n < int32(m_THRESHOLD1) {
  12482. _simplesort(tls, a, n, i, tr, endch)
  12483. continue
  12484. }
  12485. if _nc1 == uint32(0) {
  12486. _bmin1 = uint32(255)
  12487. ak = a + uintptr(n)*8
  12488. for {
  12489. ak -= 8
  12490. v4 = ak
  12491. if !(v4 >= a) {
  12492. break
  12493. }
  12494. c = uint32(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ak)) + uintptr(i)))))))
  12495. v6 = uintptr(unsafe.Pointer(&_count1)) + uintptr(c)*4
  12496. *(*uint32)(unsafe.Pointer(v6))++
  12497. v5 = *(*uint32)(unsafe.Pointer(v6))
  12498. if v5 == uint32(1) && c != endch {
  12499. if c < _bmin1 {
  12500. _bmin1 = c
  12501. }
  12502. _nc1++
  12503. }
  12504. goto _3
  12505. _3:
  12506. }
  12507. if sp+uintptr(_nc1)*16 > bp+uintptr(m_SIZE)*16 {
  12508. _r_sort_b(tls, a, ta, n, i, tr, endch)
  12509. continue
  12510. }
  12511. }
  12512. v7 = sp
  12513. sp1 = v7
  12514. sp0 = v7
  12515. bigc = uint32(2)
  12516. if endch == uint32(0) {
  12517. v8 = a + uintptr(_count1[0])*8
  12518. ak = v8
  12519. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[0] = v8
  12520. _count1[0] = uint32(0)
  12521. } else {
  12522. ak = a
  12523. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[int32(255)] = a + uintptr(n)*8
  12524. _count1[int32(255)] = uint32(0)
  12525. }
  12526. cp = uintptr(unsafe.Pointer(&_count1)) + uintptr(_bmin1)*4
  12527. for {
  12528. if !(_nc1 > uint32(0)) {
  12529. break
  12530. }
  12531. for *(*uint32)(unsafe.Pointer(cp)) == uint32(0) {
  12532. cp += 4
  12533. }
  12534. v10 = *(*uint32)(unsafe.Pointer(cp))
  12535. c = v10
  12536. if v10 > uint32(1) {
  12537. if c > bigc {
  12538. bigc = c
  12539. sp1 = sp
  12540. }
  12541. (*Tstack)(unsafe.Pointer(sp)).Fsa = ak
  12542. (*Tstack)(unsafe.Pointer(sp)).Fsn = libc.Int32FromUint32(c)
  12543. v11 = sp
  12544. sp += 16
  12545. (*Tstack)(unsafe.Pointer(v11)).Fsi = i + libc.Int32FromInt32(1)
  12546. }
  12547. ak += uintptr(c) * 8
  12548. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[(int64(cp)-t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_count1))))/4] = ak
  12549. *(*uint32)(unsafe.Pointer(cp)) = uint32(0) /* Reset count[]. */
  12550. _nc1--
  12551. goto _9
  12552. _9:
  12553. ;
  12554. cp += 4
  12555. }
  12556. temp = *(*Tstack)(unsafe.Pointer(sp0))
  12557. *(*Tstack)(unsafe.Pointer(sp0)) = *(*Tstack)(unsafe.Pointer(sp1))
  12558. *(*Tstack)(unsafe.Pointer(sp1)) = temp
  12559. ak = ta + uintptr(n)*8
  12560. ai = a + uintptr(n)*8
  12561. for {
  12562. if !(ak > ta) {
  12563. break
  12564. } /* Copy to temp. */
  12565. ak -= 8
  12566. v13 = ak
  12567. ai -= 8
  12568. v14 = ai
  12569. *(*uintptr)(unsafe.Pointer(v13)) = *(*uintptr)(unsafe.Pointer(v14))
  12570. goto _12
  12571. _12:
  12572. }
  12573. ak = ta + uintptr(n)*8
  12574. for {
  12575. ak -= 8
  12576. v16 = ak
  12577. if !(v16 >= ta) {
  12578. break
  12579. } /* Deal to piles. */
  12580. v18 = bp + 8192 + uintptr(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ak)) + uintptr(i)))))))*8
  12581. *(*uintptr)(unsafe.Pointer(v18)) -= 8
  12582. v17 = *(*uintptr)(unsafe.Pointer(v18))
  12583. *(*uintptr)(unsafe.Pointer(v17)) = *(*uintptr)(unsafe.Pointer(ak))
  12584. goto _15
  12585. _15:
  12586. }
  12587. }
  12588. }
  12589. var _count1 [256]uint32
  12590. var _nc1 uint32
  12591. var _bmin1 uint32
  12592. // C documentation
  12593. //
  12594. // /* insertion sort */
  12595. func _simplesort(tls *libc.TLS, a uintptr, n int32, b int32, tr uintptr, endch uint32) {
  12596. var ai, ak, s, t uintptr
  12597. var ch, v5 uint8
  12598. var v2 int32
  12599. _, _, _, _, _, _, _ = ai, ak, ch, s, t, v2, v5
  12600. ak = a + uintptr(1)*8
  12601. for {
  12602. n--
  12603. v2 = n
  12604. if !(v2 >= int32(1)) {
  12605. break
  12606. }
  12607. ai = ak
  12608. for {
  12609. if !(ai > a) {
  12610. break
  12611. }
  12612. s = *(*uintptr)(unsafe.Pointer(ai)) + uintptr(b)
  12613. t = *(*uintptr)(unsafe.Pointer(ai + uintptr(-libc.Int32FromInt32(1))*8)) + uintptr(b)
  12614. for {
  12615. v5 = *(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(s)))))
  12616. ch = v5
  12617. if !(uint32(v5) != endch) {
  12618. break
  12619. }
  12620. if libc.Int32FromUint8(ch) != libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(t)))))) {
  12621. break
  12622. }
  12623. goto _4
  12624. _4:
  12625. ;
  12626. s++
  12627. t++
  12628. }
  12629. if libc.Int32FromUint8(ch) >= libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(t)))))) {
  12630. break
  12631. }
  12632. s = *(*uintptr)(unsafe.Pointer(ai))
  12633. *(*uintptr)(unsafe.Pointer(ai)) = *(*uintptr)(unsafe.Pointer(ai + uintptr(-libc.Int32FromInt32(1))*8))
  12634. *(*uintptr)(unsafe.Pointer(ai + uintptr(-libc.Int32FromInt32(1))*8)) = s
  12635. goto _3
  12636. _3:
  12637. ;
  12638. ai -= 8
  12639. }
  12640. goto _1
  12641. _1:
  12642. ;
  12643. ak += 8
  12644. }
  12645. }
  12646. const m__SL_CHUNKSIZE = 20
  12647. type TStringList = struct {
  12648. Fsl_str uintptr
  12649. Fsl_max Tsize_t
  12650. Fsl_cur Tsize_t
  12651. }
  12652. type T_stringlist = TStringList
  12653. // C documentation
  12654. //
  12655. // /*
  12656. // * sl_init(): Initialize a string list
  12657. // */
  12658. func Xsl_init(tls *libc.TLS) (r uintptr) {
  12659. var sl uintptr
  12660. _ = sl
  12661. sl = libc.Xmalloc(tls, uint64(24))
  12662. if sl == libc.UintptrFromInt32(0) {
  12663. return libc.UintptrFromInt32(0)
  12664. }
  12665. (*TStringList)(unsafe.Pointer(sl)).Fsl_cur = uint64(0)
  12666. (*TStringList)(unsafe.Pointer(sl)).Fsl_max = uint64(m__SL_CHUNKSIZE)
  12667. (*TStringList)(unsafe.Pointer(sl)).Fsl_str = Xreallocarray(tls, libc.UintptrFromInt32(0), (*TStringList)(unsafe.Pointer(sl)).Fsl_max, uint64(8))
  12668. if (*TStringList)(unsafe.Pointer(sl)).Fsl_str == libc.UintptrFromInt32(0) {
  12669. libc.Xfree(tls, sl)
  12670. sl = libc.UintptrFromInt32(0)
  12671. }
  12672. return sl
  12673. }
  12674. // C documentation
  12675. //
  12676. // /*
  12677. // * sl_add(): Add an item to the string list
  12678. // */
  12679. func Xsl_add(tls *libc.TLS, sl uintptr, name uintptr) (r int32) {
  12680. var new1, v2 uintptr
  12681. var v1 Tsize_t
  12682. _, _, _ = new1, v1, v2
  12683. if (*TStringList)(unsafe.Pointer(sl)).Fsl_cur == (*TStringList)(unsafe.Pointer(sl)).Fsl_max-uint64(1) {
  12684. new1 = Xreallocarray(tls, (*TStringList)(unsafe.Pointer(sl)).Fsl_str, (*TStringList)(unsafe.Pointer(sl)).Fsl_max+libc.Uint64FromInt32(m__SL_CHUNKSIZE), uint64(8))
  12685. if new1 == libc.UintptrFromInt32(0) {
  12686. return -int32(1)
  12687. }
  12688. *(*Tsize_t)(unsafe.Pointer(sl + 8)) += uint64(m__SL_CHUNKSIZE)
  12689. (*TStringList)(unsafe.Pointer(sl)).Fsl_str = new1
  12690. }
  12691. v2 = sl + 16
  12692. v1 = *(*Tsize_t)(unsafe.Pointer(v2))
  12693. *(*Tsize_t)(unsafe.Pointer(v2))++
  12694. *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(v1)*8)) = name
  12695. return 0
  12696. }
  12697. // C documentation
  12698. //
  12699. // /*
  12700. // * sl_free(): Free a stringlist
  12701. // */
  12702. func Xsl_free(tls *libc.TLS, sl uintptr, all int32) {
  12703. var i Tsize_t
  12704. _ = i
  12705. if sl == libc.UintptrFromInt32(0) {
  12706. return
  12707. }
  12708. if (*TStringList)(unsafe.Pointer(sl)).Fsl_str != 0 {
  12709. if all != 0 {
  12710. i = uint64(0)
  12711. for {
  12712. if !(i < (*TStringList)(unsafe.Pointer(sl)).Fsl_cur) {
  12713. break
  12714. }
  12715. libc.Xfree(tls, *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*8)))
  12716. goto _1
  12717. _1:
  12718. ;
  12719. i++
  12720. }
  12721. }
  12722. libc.Xfree(tls, (*TStringList)(unsafe.Pointer(sl)).Fsl_str)
  12723. }
  12724. libc.Xfree(tls, sl)
  12725. }
  12726. // C documentation
  12727. //
  12728. // /*
  12729. // * sl_find(): Find a name in the string list
  12730. // */
  12731. func Xsl_find(tls *libc.TLS, sl uintptr, name uintptr) (r uintptr) {
  12732. var i Tsize_t
  12733. _ = i
  12734. i = uint64(0)
  12735. for {
  12736. if !(i < (*TStringList)(unsafe.Pointer(sl)).Fsl_cur) {
  12737. break
  12738. }
  12739. if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*8)), name) == 0 {
  12740. return *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*8))
  12741. }
  12742. goto _1
  12743. _1:
  12744. ;
  12745. i++
  12746. }
  12747. return libc.UintptrFromInt32(0)
  12748. }
  12749. func Xsl_delete(tls *libc.TLS, sl uintptr, name uintptr, all int32) (r int32) {
  12750. var i, j, v3 Tsize_t
  12751. var v4 uintptr
  12752. _, _, _, _ = i, j, v3, v4
  12753. i = uint64(0)
  12754. for {
  12755. if !(i < (*TStringList)(unsafe.Pointer(sl)).Fsl_cur) {
  12756. break
  12757. }
  12758. if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*8)), name) == 0 {
  12759. if all != 0 {
  12760. libc.Xfree(tls, *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*8)))
  12761. }
  12762. j = i + uint64(1)
  12763. for {
  12764. if !(j < (*TStringList)(unsafe.Pointer(sl)).Fsl_cur) {
  12765. break
  12766. }
  12767. *(*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))
  12768. goto _2
  12769. _2:
  12770. ;
  12771. j++
  12772. }
  12773. v4 = sl + 16
  12774. *(*Tsize_t)(unsafe.Pointer(v4))--
  12775. v3 = *(*Tsize_t)(unsafe.Pointer(v4))
  12776. *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(v3)*8)) = libc.UintptrFromInt32(0)
  12777. return 0
  12778. }
  12779. goto _1
  12780. _1:
  12781. ;
  12782. i++
  12783. }
  12784. return -int32(1)
  12785. }
  12786. // C documentation
  12787. //
  12788. // /*
  12789. // * Appends src to string dst of size dsize (unlike strncat, dsize is the
  12790. // * full size of dst, not space left). At most dsize-1 characters
  12791. // * will be copied. Always NUL terminates (unless dsize <= strlen(dst)).
  12792. // * Returns strlen(src) + MIN(dsize, strlen(initial dst)).
  12793. // * If retval >= dsize, truncation occurred.
  12794. // */
  12795. func Xstrlcat(tls *libc.TLS, dst uintptr, src uintptr, dsize Tsize_t) (r Tsize_t) {
  12796. var dlen, n, v1, v2 Tsize_t
  12797. var odst, osrc, v3 uintptr
  12798. _, _, _, _, _, _, _ = dlen, n, odst, osrc, v1, v2, v3
  12799. odst = dst
  12800. osrc = src
  12801. n = dsize
  12802. /* Find the end of dst and adjust bytes left but don't go past end. */
  12803. for {
  12804. v1 = n
  12805. n--
  12806. if !(v1 != uint64(0) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(dst))) != int32('\000')) {
  12807. break
  12808. }
  12809. dst++
  12810. }
  12811. dlen = libc.Uint64FromInt64(int64(dst) - int64(odst))
  12812. n = dsize - dlen
  12813. v2 = n
  12814. n--
  12815. if v2 == uint64(0) {
  12816. return dlen + libc.Xstrlen(tls, src)
  12817. }
  12818. for libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(src))) != int32('\000') {
  12819. if n != uint64(0) {
  12820. v3 = dst
  12821. dst++
  12822. *(*uint8)(unsafe.Pointer(v3)) = *(*uint8)(unsafe.Pointer(src))
  12823. n--
  12824. }
  12825. src++
  12826. }
  12827. *(*uint8)(unsafe.Pointer(dst)) = uint8('\000')
  12828. return dlen + libc.Uint64FromInt64(int64(src)-int64(osrc)) /* count does not include NUL */
  12829. }
  12830. // C documentation
  12831. //
  12832. // /*
  12833. // * Copy string src to buffer dst of size dsize. At most dsize-1
  12834. // * chars will be copied. Always NUL terminates (unless dsize == 0).
  12835. // * Returns strlen(src); if retval >= dsize, truncation occurred.
  12836. // */
  12837. func Xstrlcpy(tls *libc.TLS, dst uintptr, src uintptr, dsize Tsize_t) (r Tsize_t) {
  12838. var nleft, v1 Tsize_t
  12839. var osrc, v3, v4, v5 uintptr
  12840. var v2 uint8
  12841. _, _, _, _, _, _, _ = nleft, osrc, v1, v2, v3, v4, v5
  12842. osrc = src
  12843. nleft = dsize
  12844. /* Copy as many bytes as will fit. */
  12845. if nleft != uint64(0) {
  12846. for {
  12847. nleft--
  12848. v1 = nleft
  12849. if !(v1 != uint64(0)) {
  12850. break
  12851. }
  12852. v3 = src
  12853. src++
  12854. v2 = *(*uint8)(unsafe.Pointer(v3))
  12855. v4 = dst
  12856. dst++
  12857. *(*uint8)(unsafe.Pointer(v4)) = v2
  12858. if libc.Int32FromUint8(v2) == int32('\000') {
  12859. break
  12860. }
  12861. }
  12862. }
  12863. /* Not enough room in dst, add NUL and traverse rest of src. */
  12864. if nleft == uint64(0) {
  12865. if dsize != uint64(0) {
  12866. *(*uint8)(unsafe.Pointer(dst)) = uint8('\000')
  12867. } /* NUL-terminate dst */
  12868. for {
  12869. v5 = src
  12870. src++
  12871. if !(*(*uint8)(unsafe.Pointer(v5)) != 0) {
  12872. break
  12873. }
  12874. }
  12875. }
  12876. return libc.Uint64FromInt64(int64(src) - int64(osrc) - libc.Int64FromInt32(1)) /* count does not include NUL */
  12877. }
  12878. const m_S_IFBLK1 = 24576
  12879. const m_S_IFCHR1 = 8192
  12880. const m_S_IFDIR2 = 16384
  12881. const m_S_IFIFO1 = 4096
  12882. const m_S_IFLNK1 = 40960
  12883. const m_S_IFMT1 = 61440
  12884. const m_S_IFREG1 = 32768
  12885. const m_S_IFSOCK1 = 49152
  12886. const m_S_IRGRP2 = 32
  12887. const m_S_IROTH2 = 4
  12888. const m_S_IRUSR2 = 256
  12889. const m_S_ISGID2 = 1024
  12890. const m_S_ISUID2 = 2048
  12891. const m_S_ISVTX2 = 512
  12892. const m_S_IWGRP2 = 16
  12893. const m_S_IWOTH2 = 2
  12894. const m_S_IWUSR2 = 128
  12895. const m_S_IXGRP2 = 8
  12896. const m_S_IXOTH2 = 1
  12897. const m_S_IXUSR2 = 64
  12898. func Xstrmode(tls *libc.TLS, mode Tmode_t, p uintptr) {
  12899. 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
  12900. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  12901. /* print type */
  12902. switch mode & libc.Uint32FromInt32(m_S_IFMT1) {
  12903. case uint32(m_S_IFDIR2): /* directory */
  12904. v1 = p
  12905. p++
  12906. *(*uint8)(unsafe.Pointer(v1)) = uint8('d')
  12907. case uint32(m_S_IFCHR1): /* character special */
  12908. v2 = p
  12909. p++
  12910. *(*uint8)(unsafe.Pointer(v2)) = uint8('c')
  12911. case uint32(m_S_IFBLK1): /* block special */
  12912. v3 = p
  12913. p++
  12914. *(*uint8)(unsafe.Pointer(v3)) = uint8('b')
  12915. case uint32(m_S_IFREG1): /* regular */
  12916. v4 = p
  12917. p++
  12918. *(*uint8)(unsafe.Pointer(v4)) = uint8('-')
  12919. case uint32(m_S_IFLNK1): /* symbolic link */
  12920. v5 = p
  12921. p++
  12922. *(*uint8)(unsafe.Pointer(v5)) = uint8('l')
  12923. case uint32(m_S_IFSOCK1): /* socket */
  12924. v6 = p
  12925. p++
  12926. *(*uint8)(unsafe.Pointer(v6)) = uint8('s')
  12927. case uint32(m_S_IFIFO1): /* fifo */
  12928. v7 = p
  12929. p++
  12930. *(*uint8)(unsafe.Pointer(v7)) = uint8('p')
  12931. default: /* unknown */
  12932. v8 = p
  12933. p++
  12934. *(*uint8)(unsafe.Pointer(v8)) = uint8('?')
  12935. break
  12936. }
  12937. /* usr */
  12938. if mode&uint32(m_S_IRUSR2) != 0 {
  12939. v9 = p
  12940. p++
  12941. *(*uint8)(unsafe.Pointer(v9)) = uint8('r')
  12942. } else {
  12943. v10 = p
  12944. p++
  12945. *(*uint8)(unsafe.Pointer(v10)) = uint8('-')
  12946. }
  12947. if mode&uint32(m_S_IWUSR2) != 0 {
  12948. v11 = p
  12949. p++
  12950. *(*uint8)(unsafe.Pointer(v11)) = uint8('w')
  12951. } else {
  12952. v12 = p
  12953. p++
  12954. *(*uint8)(unsafe.Pointer(v12)) = uint8('-')
  12955. }
  12956. switch mode & libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXUSR2)|libc.Int32FromInt32(m_S_ISUID2)) {
  12957. case uint32(0):
  12958. v13 = p
  12959. p++
  12960. *(*uint8)(unsafe.Pointer(v13)) = uint8('-')
  12961. case uint32(m_S_IXUSR2):
  12962. v14 = p
  12963. p++
  12964. *(*uint8)(unsafe.Pointer(v14)) = uint8('x')
  12965. case uint32(m_S_ISUID2):
  12966. v15 = p
  12967. p++
  12968. *(*uint8)(unsafe.Pointer(v15)) = uint8('S')
  12969. case libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXUSR2) | libc.Int32FromInt32(m_S_ISUID2)):
  12970. v16 = p
  12971. p++
  12972. *(*uint8)(unsafe.Pointer(v16)) = uint8('s')
  12973. break
  12974. }
  12975. /* group */
  12976. if mode&uint32(m_S_IRGRP2) != 0 {
  12977. v17 = p
  12978. p++
  12979. *(*uint8)(unsafe.Pointer(v17)) = uint8('r')
  12980. } else {
  12981. v18 = p
  12982. p++
  12983. *(*uint8)(unsafe.Pointer(v18)) = uint8('-')
  12984. }
  12985. if mode&uint32(m_S_IWGRP2) != 0 {
  12986. v19 = p
  12987. p++
  12988. *(*uint8)(unsafe.Pointer(v19)) = uint8('w')
  12989. } else {
  12990. v20 = p
  12991. p++
  12992. *(*uint8)(unsafe.Pointer(v20)) = uint8('-')
  12993. }
  12994. switch mode & libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXGRP2)|libc.Int32FromInt32(m_S_ISGID2)) {
  12995. case uint32(0):
  12996. v21 = p
  12997. p++
  12998. *(*uint8)(unsafe.Pointer(v21)) = uint8('-')
  12999. case uint32(m_S_IXGRP2):
  13000. v22 = p
  13001. p++
  13002. *(*uint8)(unsafe.Pointer(v22)) = uint8('x')
  13003. case uint32(m_S_ISGID2):
  13004. v23 = p
  13005. p++
  13006. *(*uint8)(unsafe.Pointer(v23)) = uint8('S')
  13007. case libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXGRP2) | libc.Int32FromInt32(m_S_ISGID2)):
  13008. v24 = p
  13009. p++
  13010. *(*uint8)(unsafe.Pointer(v24)) = uint8('s')
  13011. break
  13012. }
  13013. /* other */
  13014. if mode&uint32(m_S_IROTH2) != 0 {
  13015. v25 = p
  13016. p++
  13017. *(*uint8)(unsafe.Pointer(v25)) = uint8('r')
  13018. } else {
  13019. v26 = p
  13020. p++
  13021. *(*uint8)(unsafe.Pointer(v26)) = uint8('-')
  13022. }
  13023. if mode&uint32(m_S_IWOTH2) != 0 {
  13024. v27 = p
  13025. p++
  13026. *(*uint8)(unsafe.Pointer(v27)) = uint8('w')
  13027. } else {
  13028. v28 = p
  13029. p++
  13030. *(*uint8)(unsafe.Pointer(v28)) = uint8('-')
  13031. }
  13032. switch mode & libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXOTH2)|libc.Int32FromInt32(m_S_ISVTX2)) {
  13033. case uint32(0):
  13034. v29 = p
  13035. p++
  13036. *(*uint8)(unsafe.Pointer(v29)) = uint8('-')
  13037. case uint32(m_S_IXOTH2):
  13038. v30 = p
  13039. p++
  13040. *(*uint8)(unsafe.Pointer(v30)) = uint8('x')
  13041. case uint32(m_S_ISVTX2):
  13042. v31 = p
  13043. p++
  13044. *(*uint8)(unsafe.Pointer(v31)) = uint8('T')
  13045. case libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXOTH2) | libc.Int32FromInt32(m_S_ISVTX2)):
  13046. v32 = p
  13047. p++
  13048. *(*uint8)(unsafe.Pointer(v32)) = uint8('t')
  13049. break
  13050. }
  13051. v33 = p
  13052. p++
  13053. *(*uint8)(unsafe.Pointer(v33)) = uint8(' ') /* will be a '+' if ACL's implemented */
  13054. *(*uint8)(unsafe.Pointer(p)) = uint8('\000')
  13055. }
  13056. // C documentation
  13057. //
  13058. // /*
  13059. // * Find the first occurrence of find in s, where the search is limited to the
  13060. // * first slen characters of s.
  13061. // */
  13062. func Xstrnstr(tls *libc.TLS, s uintptr, find uintptr, slen Tsize_t) (r uintptr) {
  13063. var c, sc, v1, v4 uint8
  13064. var len1, v3 Tsize_t
  13065. var v2, v5 uintptr
  13066. var v6 bool
  13067. _, _, _, _, _, _, _, _, _ = c, len1, sc, v1, v2, v3, v4, v5, v6
  13068. v2 = find
  13069. find++
  13070. v1 = *(*uint8)(unsafe.Pointer(v2))
  13071. c = v1
  13072. if libc.Int32FromUint8(v1) != int32('\000') {
  13073. len1 = libc.Xstrlen(tls, find)
  13074. for cond := true; cond; cond = libc.Xstrncmp(tls, s, find, len1) != 0 {
  13075. for cond := true; cond; cond = libc.Int32FromUint8(sc) != libc.Int32FromUint8(c) {
  13076. v3 = slen
  13077. slen--
  13078. if v6 = v3 < uint64(1); !v6 {
  13079. v5 = s
  13080. s++
  13081. v4 = *(*uint8)(unsafe.Pointer(v5))
  13082. sc = v4
  13083. }
  13084. if v6 || libc.Int32FromUint8(v4) == int32('\000') {
  13085. return libc.UintptrFromInt32(0)
  13086. }
  13087. }
  13088. if len1 > slen {
  13089. return libc.UintptrFromInt32(0)
  13090. }
  13091. }
  13092. s--
  13093. }
  13094. return s
  13095. }
  13096. const m_S_IFBLK2 = 0060000
  13097. const m_S_IFCHR2 = 0020000
  13098. const m_S_IFDIR3 = 0040000
  13099. const m_S_IFIFO2 = 0010000
  13100. const m_S_IFLNK2 = 0120000
  13101. const m_S_IFMT2 = 0170000
  13102. const m_S_IFREG2 = 0100000
  13103. const m_S_IFSOCK2 = 0140000
  13104. const m_S_IRGRP3 = 0040
  13105. const m_S_IROTH3 = 0004
  13106. const m_S_IRUSR3 = 0400
  13107. const m_S_ISGID3 = 02000
  13108. const m_S_ISUID3 = 04000
  13109. const m_S_ISVTX3 = 01000
  13110. const m_S_IWGRP3 = 0020
  13111. const m_S_IWOTH3 = 0002
  13112. const m_S_IWUSR3 = 0200
  13113. const m_S_IXGRP3 = 0010
  13114. const m_S_IXOTH3 = 0001
  13115. const m_S_IXUSR3 = 0100
  13116. func Xstrtonum(tls *libc.TLS, nptr uintptr, minval int64, maxval int64, errstr uintptr) (r int64) {
  13117. bp := tls.Alloc(32)
  13118. defer tls.Free(32)
  13119. var rv int64
  13120. var v1 uintptr
  13121. var _ /* e at bp+0 */ int32
  13122. var _ /* eptr at bp+16 */ uintptr
  13123. var _ /* resp at bp+8 */ uintptr
  13124. _, _ = rv, v1
  13125. if errstr == libc.UintptrFromInt32(0) {
  13126. errstr = bp + 8
  13127. }
  13128. if minval > maxval {
  13129. goto out
  13130. }
  13131. rv = Xstrtoi(tls, nptr, bp+16, int32(10), minval, maxval, bp)
  13132. switch *(*int32)(unsafe.Pointer(bp)) {
  13133. case 0:
  13134. *(*uintptr)(unsafe.Pointer(errstr)) = libc.UintptrFromInt32(0)
  13135. return rv
  13136. case int32(m_ECANCELED):
  13137. fallthrough
  13138. case int32(m_EOPNOTSUPP):
  13139. goto out
  13140. case int32(m_ERANGE):
  13141. if *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))) != 0 {
  13142. goto out
  13143. }
  13144. if rv == maxval {
  13145. v1 = __ccgo_ts + 441
  13146. } else {
  13147. v1 = __ccgo_ts + 451
  13148. }
  13149. *(*uintptr)(unsafe.Pointer(errstr)) = v1
  13150. return 0
  13151. default:
  13152. libc.Xabort(tls)
  13153. }
  13154. goto out
  13155. out:
  13156. ;
  13157. *(*uintptr)(unsafe.Pointer(errstr)) = __ccgo_ts + 461
  13158. return 0
  13159. }
  13160. func Xstrtoi(tls *libc.TLS, nptr uintptr, endptr uintptr, base int32, lo Tintmax_t, hi Tintmax_t, rstatus uintptr) (r Tintmax_t) {
  13161. bp := tls.Alloc(16)
  13162. defer tls.Free(16)
  13163. var im Tintmax_t
  13164. var serrno int32
  13165. var _ /* ep at bp+0 */ uintptr
  13166. var _ /* rep at bp+8 */ int32
  13167. _, _ = im, serrno
  13168. /* endptr may be NULL */
  13169. if endptr == libc.UintptrFromInt32(0) {
  13170. endptr = bp
  13171. }
  13172. if rstatus == libc.UintptrFromInt32(0) {
  13173. rstatus = bp + 8
  13174. }
  13175. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  13176. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  13177. im = libc.Xstrtoimax(tls, nptr, endptr, base)
  13178. *(*int32)(unsafe.Pointer(rstatus)) = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  13179. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  13180. /* No digits were found */
  13181. if *(*int32)(unsafe.Pointer(rstatus)) == 0 && nptr == *(*uintptr)(unsafe.Pointer(endptr)) {
  13182. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ECANCELED)
  13183. }
  13184. if im < lo {
  13185. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  13186. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ERANGE)
  13187. }
  13188. return lo
  13189. }
  13190. if im > hi {
  13191. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  13192. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ERANGE)
  13193. }
  13194. return hi
  13195. }
  13196. /* There are further characters after number */
  13197. if *(*int32)(unsafe.Pointer(rstatus)) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(endptr))))) != int32('\000') {
  13198. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_EOPNOTSUPP)
  13199. }
  13200. return im
  13201. }
  13202. func Xstrtou(tls *libc.TLS, nptr uintptr, endptr uintptr, base int32, lo Tuintmax_t, hi Tuintmax_t, rstatus uintptr) (r Tuintmax_t) {
  13203. bp := tls.Alloc(16)
  13204. defer tls.Free(16)
  13205. var im Tuintmax_t
  13206. var serrno int32
  13207. var _ /* ep at bp+0 */ uintptr
  13208. var _ /* rep at bp+8 */ int32
  13209. _, _ = im, serrno
  13210. /* endptr may be NULL */
  13211. if endptr == libc.UintptrFromInt32(0) {
  13212. endptr = bp
  13213. }
  13214. if rstatus == libc.UintptrFromInt32(0) {
  13215. rstatus = bp + 8
  13216. }
  13217. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  13218. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  13219. im = libc.Xstrtoumax(tls, nptr, endptr, base)
  13220. *(*int32)(unsafe.Pointer(rstatus)) = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  13221. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  13222. /* No digits were found */
  13223. if *(*int32)(unsafe.Pointer(rstatus)) == 0 && nptr == *(*uintptr)(unsafe.Pointer(endptr)) {
  13224. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ECANCELED)
  13225. }
  13226. if im < lo {
  13227. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  13228. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ERANGE)
  13229. }
  13230. return lo
  13231. }
  13232. if im > hi {
  13233. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  13234. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ERANGE)
  13235. }
  13236. return hi
  13237. }
  13238. /* There are further characters after number */
  13239. if *(*int32)(unsafe.Pointer(rstatus)) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(endptr))))) != int32('\000') {
  13240. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_EOPNOTSUPP)
  13241. }
  13242. return im
  13243. }
  13244. /*
  13245. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  13246. *
  13247. * Redistribution and use in source and binary forms, with or without
  13248. * modification, are permitted provided that the following conditions
  13249. * are met:
  13250. * 1. Redistributions of source code must retain the above copyright
  13251. * notice, this list of conditions and the following disclaimer.
  13252. * 2. Redistributions in binary form must reproduce the above copyright
  13253. * notice, this list of conditions and the following disclaimer in the
  13254. * documentation and/or other materials provided with the distribution.
  13255. * 3. The name of the author may not be used to endorse or promote products
  13256. * derived from this software without specific prior written permission.
  13257. *
  13258. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  13259. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  13260. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  13261. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  13262. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13263. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  13264. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  13265. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  13266. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  13267. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  13268. */
  13269. /*
  13270. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  13271. *
  13272. * Redistribution and use in source and binary forms, with or without
  13273. * modification, are permitted provided that the following conditions
  13274. * are met:
  13275. * 1. Redistributions of source code must retain the above copyright
  13276. * notice, this list of conditions and the following disclaimer.
  13277. * 2. Redistributions in binary form must reproduce the above copyright
  13278. * notice, this list of conditions and the following disclaimer in the
  13279. * documentation and/or other materials provided with the distribution.
  13280. * 3. The name of the author may not be used to endorse or promote products
  13281. * derived from this software without specific prior written permission.
  13282. *
  13283. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  13284. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  13285. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  13286. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  13287. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13288. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  13289. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  13290. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  13291. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  13292. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  13293. */
  13294. /* Clang expands this to 1 if an identifier is *not* reserved. */
  13295. /*
  13296. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  13297. * musl, try to handle this gracefully.
  13298. */
  13299. /* Copyright (C) 1992-2020 Free Software Foundation, Inc.
  13300. This file is part of the GNU C Library.
  13301. The GNU C Library is free software; you can redistribute it and/or
  13302. modify it under the terms of the GNU Lesser General Public
  13303. License as published by the Free Software Foundation; either
  13304. version 2.1 of the License, or (at your option) any later version.
  13305. The GNU C Library is distributed in the hope that it will be useful,
  13306. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13307. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13308. Lesser General Public License for more details.
  13309. You should have received a copy of the GNU Lesser General Public
  13310. License along with the GNU C Library; if not, see
  13311. <https://www.gnu.org/licenses/>. */
  13312. /*
  13313. * - enable time64 functions
  13314. * - symver libbsd<func>_time64 -> <func> 0.7
  13315. */
  13316. type Tlibbsd_time64_t = int64
  13317. func Xlibbsd_time32_to_time_time64(tls *libc.TLS, t32 Tint32_t) (r Tlibbsd_time64_t) {
  13318. return int64(t32)
  13319. }
  13320. func Xlibbsd_time_to_time32_time64(tls *libc.TLS, t Tlibbsd_time64_t) (r Tint32_t) {
  13321. return int32(t)
  13322. }
  13323. func Xlibbsd_time64_to_time_time64(tls *libc.TLS, t64 Tint64_t) (r Tlibbsd_time64_t) {
  13324. return t64
  13325. }
  13326. func Xlibbsd_time_to_time64_time64(tls *libc.TLS, t Tlibbsd_time64_t) (r Tint64_t) {
  13327. return t
  13328. }
  13329. func Xlibbsd_time_to_long_time64(tls *libc.TLS, t Tlibbsd_time64_t) (r int64) {
  13330. if uint64(8) == uint64(8) {
  13331. return Xlibbsd_time_to_time64_time64(tls, t)
  13332. }
  13333. return t
  13334. }
  13335. func Xlibbsd_long_to_time_time64(tls *libc.TLS, tlong int64) (r Tlibbsd_time64_t) {
  13336. if uint64(8) == uint64(4) {
  13337. return Xlibbsd_time32_to_time_time64(tls, int32(tlong))
  13338. }
  13339. return tlong
  13340. }
  13341. func Xlibbsd_time_to_int_time64(tls *libc.TLS, t Ttime_t) (r int32) {
  13342. if uint64(4) == uint64(8) {
  13343. return int32(Xlibbsd_time_to_time64_time64(tls, t))
  13344. }
  13345. return int32(t)
  13346. }
  13347. func Xlibbsd_int_to_time_time64(tls *libc.TLS, tint int32) (r Tlibbsd_time64_t) {
  13348. if uint64(4) == uint64(4) {
  13349. return Xlibbsd_time32_to_time_time64(tls, tint)
  13350. }
  13351. return int64(tint)
  13352. }
  13353. const m_S_AMP = 13
  13354. const m_S_CTRL = 4
  13355. const m_S_EATCRNL = 12
  13356. const m_S_GROUND = 0
  13357. const m_S_HEX = 7
  13358. const m_S_HEX1 = 8
  13359. const m_S_HEX2 = 9
  13360. const m_S_META = 2
  13361. const m_S_META1 = 3
  13362. const m_S_MIME1 = 10
  13363. const m_S_MIME2 = 11
  13364. const m_S_NUMBER = 14
  13365. const m_S_OCTAL2 = 5
  13366. const m_S_OCTAL3 = 6
  13367. const m_S_START = 1
  13368. const m_S_STRING = 15
  13369. const m_UNVIS_END = "_VIS_END"
  13370. const m_UNVIS_NOCHAR = 3
  13371. const m_UNVIS_VALID = 1
  13372. const m_UNVIS_VALIDPUSH = 2
  13373. const m_VIS_CSTYLE = 0x0002
  13374. const m_VIS_DQ = 0x8000
  13375. const m_VIS_GLOB = 0x1000
  13376. const m_VIS_HTTP1808 = 128
  13377. const m_VIS_HTTP1866 = 512
  13378. const m_VIS_HTTPSTYLE = 0x0080
  13379. const m_VIS_MIMESTYLE = 256
  13380. const m_VIS_NL = 0x0010
  13381. const m_VIS_NOESCAPE = 1024
  13382. const m_VIS_NOLOCALE = 0x4000
  13383. const m_VIS_NOSLASH = 0x0040
  13384. const m_VIS_OCTAL = 0x0001
  13385. const m_VIS_SAFE = 0x0020
  13386. const m_VIS_SHELL = 0x2000
  13387. const m_VIS_SP = 0x0004
  13388. const m_VIS_TAB = 0x0008
  13389. const m__VIS_END = 2048
  13390. /*
  13391. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  13392. *
  13393. * Redistribution and use in source and binary forms, with or without
  13394. * modification, are permitted provided that the following conditions
  13395. * are met:
  13396. * 1. Redistributions of source code must retain the above copyright
  13397. * notice, this list of conditions and the following disclaimer.
  13398. * 2. Redistributions in binary form must reproduce the above copyright
  13399. * notice, this list of conditions and the following disclaimer in the
  13400. * documentation and/or other materials provided with the distribution.
  13401. * 3. The name of the author may not be used to endorse or promote products
  13402. * derived from this software without specific prior written permission.
  13403. *
  13404. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  13405. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  13406. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  13407. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  13408. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13409. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  13410. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  13411. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  13412. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  13413. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  13414. */
  13415. /*
  13416. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  13417. *
  13418. * Redistribution and use in source and binary forms, with or without
  13419. * modification, are permitted provided that the following conditions
  13420. * are met:
  13421. * 1. Redistributions of source code must retain the above copyright
  13422. * notice, this list of conditions and the following disclaimer.
  13423. * 2. Redistributions in binary form must reproduce the above copyright
  13424. * notice, this list of conditions and the following disclaimer in the
  13425. * documentation and/or other materials provided with the distribution.
  13426. * 3. The name of the author may not be used to endorse or promote products
  13427. * derived from this software without specific prior written permission.
  13428. *
  13429. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  13430. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  13431. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  13432. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  13433. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13434. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  13435. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  13436. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  13437. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  13438. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  13439. */
  13440. /* Clang expands this to 1 if an identifier is *not* reserved. */
  13441. /*
  13442. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  13443. * musl, try to handle this gracefully.
  13444. */
  13445. /* Copyright (C) 1992-2020 Free Software Foundation, Inc.
  13446. This file is part of the GNU C Library.
  13447. The GNU C Library is free software; you can redistribute it and/or
  13448. modify it under the terms of the GNU Lesser General Public
  13449. License as published by the Free Software Foundation; either
  13450. version 2.1 of the License, or (at your option) any later version.
  13451. The GNU C Library is distributed in the hope that it will be useful,
  13452. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13453. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13454. Lesser General Public License for more details.
  13455. You should have received a copy of the GNU Lesser General Public
  13456. License along with the GNU C Library; if not, see
  13457. <https://www.gnu.org/licenses/>. */
  13458. /*
  13459. * decode driven by state machine
  13460. */
  13461. // C documentation
  13462. //
  13463. // /*
  13464. // * RFC 1866
  13465. // */
  13466. type Tnv = struct {
  13467. Fname [7]uint8
  13468. Fvalue Tuint8_t
  13469. }
  13470. /*
  13471. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  13472. *
  13473. * Redistribution and use in source and binary forms, with or without
  13474. * modification, are permitted provided that the following conditions
  13475. * are met:
  13476. * 1. Redistributions of source code must retain the above copyright
  13477. * notice, this list of conditions and the following disclaimer.
  13478. * 2. Redistributions in binary form must reproduce the above copyright
  13479. * notice, this list of conditions and the following disclaimer in the
  13480. * documentation and/or other materials provided with the distribution.
  13481. * 3. The name of the author may not be used to endorse or promote products
  13482. * derived from this software without specific prior written permission.
  13483. *
  13484. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  13485. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  13486. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  13487. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  13488. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13489. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  13490. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  13491. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  13492. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  13493. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  13494. */
  13495. /*
  13496. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  13497. *
  13498. * Redistribution and use in source and binary forms, with or without
  13499. * modification, are permitted provided that the following conditions
  13500. * are met:
  13501. * 1. Redistributions of source code must retain the above copyright
  13502. * notice, this list of conditions and the following disclaimer.
  13503. * 2. Redistributions in binary form must reproduce the above copyright
  13504. * notice, this list of conditions and the following disclaimer in the
  13505. * documentation and/or other materials provided with the distribution.
  13506. * 3. The name of the author may not be used to endorse or promote products
  13507. * derived from this software without specific prior written permission.
  13508. *
  13509. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  13510. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  13511. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  13512. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  13513. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13514. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  13515. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  13516. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  13517. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  13518. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  13519. */
  13520. /* Clang expands this to 1 if an identifier is *not* reserved. */
  13521. /*
  13522. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  13523. * musl, try to handle this gracefully.
  13524. */
  13525. /* Copyright (C) 1992-2020 Free Software Foundation, Inc.
  13526. This file is part of the GNU C Library.
  13527. The GNU C Library is free software; you can redistribute it and/or
  13528. modify it under the terms of the GNU Lesser General Public
  13529. License as published by the Free Software Foundation; either
  13530. version 2.1 of the License, or (at your option) any later version.
  13531. The GNU C Library is distributed in the hope that it will be useful,
  13532. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13533. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13534. Lesser General Public License for more details.
  13535. You should have received a copy of the GNU Lesser General Public
  13536. License along with the GNU C Library; if not, see
  13537. <https://www.gnu.org/licenses/>. */
  13538. /*
  13539. * decode driven by state machine
  13540. */
  13541. // C documentation
  13542. //
  13543. // /*
  13544. // * RFC 1866
  13545. // */
  13546. var _nv = [100]Tnv{
  13547. 0: {
  13548. Fname: [7]uint8{'A', 'E', 'l', 'i', 'g'},
  13549. Fvalue: uint8(198),
  13550. },
  13551. 1: {
  13552. Fname: [7]uint8{'A', 'a', 'c', 'u', 't', 'e'},
  13553. Fvalue: uint8(193),
  13554. },
  13555. 2: {
  13556. Fname: [7]uint8{'A', 'c', 'i', 'r', 'c'},
  13557. Fvalue: uint8(194),
  13558. },
  13559. 3: {
  13560. Fname: [7]uint8{'A', 'g', 'r', 'a', 'v', 'e'},
  13561. Fvalue: uint8(192),
  13562. },
  13563. 4: {
  13564. Fname: [7]uint8{'A', 'r', 'i', 'n', 'g'},
  13565. Fvalue: uint8(197),
  13566. },
  13567. 5: {
  13568. Fname: [7]uint8{'A', 't', 'i', 'l', 'd', 'e'},
  13569. Fvalue: uint8(195),
  13570. },
  13571. 6: {
  13572. Fname: [7]uint8{'A', 'u', 'm', 'l'},
  13573. Fvalue: uint8(196),
  13574. },
  13575. 7: {
  13576. Fname: [7]uint8{'C', 'c', 'e', 'd', 'i', 'l'},
  13577. Fvalue: uint8(199),
  13578. },
  13579. 8: {
  13580. Fname: [7]uint8{'E', 'T', 'H'},
  13581. Fvalue: uint8(208),
  13582. },
  13583. 9: {
  13584. Fname: [7]uint8{'E', 'a', 'c', 'u', 't', 'e'},
  13585. Fvalue: uint8(201),
  13586. },
  13587. 10: {
  13588. Fname: [7]uint8{'E', 'c', 'i', 'r', 'c'},
  13589. Fvalue: uint8(202),
  13590. },
  13591. 11: {
  13592. Fname: [7]uint8{'E', 'g', 'r', 'a', 'v', 'e'},
  13593. Fvalue: uint8(200),
  13594. },
  13595. 12: {
  13596. Fname: [7]uint8{'E', 'u', 'm', 'l'},
  13597. Fvalue: uint8(203),
  13598. },
  13599. 13: {
  13600. Fname: [7]uint8{'I', 'a', 'c', 'u', 't', 'e'},
  13601. Fvalue: uint8(205),
  13602. },
  13603. 14: {
  13604. Fname: [7]uint8{'I', 'c', 'i', 'r', 'c'},
  13605. Fvalue: uint8(206),
  13606. },
  13607. 15: {
  13608. Fname: [7]uint8{'I', 'g', 'r', 'a', 'v', 'e'},
  13609. Fvalue: uint8(204),
  13610. },
  13611. 16: {
  13612. Fname: [7]uint8{'I', 'u', 'm', 'l'},
  13613. Fvalue: uint8(207),
  13614. },
  13615. 17: {
  13616. Fname: [7]uint8{'N', 't', 'i', 'l', 'd', 'e'},
  13617. Fvalue: uint8(209),
  13618. },
  13619. 18: {
  13620. Fname: [7]uint8{'O', 'a', 'c', 'u', 't', 'e'},
  13621. Fvalue: uint8(211),
  13622. },
  13623. 19: {
  13624. Fname: [7]uint8{'O', 'c', 'i', 'r', 'c'},
  13625. Fvalue: uint8(212),
  13626. },
  13627. 20: {
  13628. Fname: [7]uint8{'O', 'g', 'r', 'a', 'v', 'e'},
  13629. Fvalue: uint8(210),
  13630. },
  13631. 21: {
  13632. Fname: [7]uint8{'O', 's', 'l', 'a', 's', 'h'},
  13633. Fvalue: uint8(216),
  13634. },
  13635. 22: {
  13636. Fname: [7]uint8{'O', 't', 'i', 'l', 'd', 'e'},
  13637. Fvalue: uint8(213),
  13638. },
  13639. 23: {
  13640. Fname: [7]uint8{'O', 'u', 'm', 'l'},
  13641. Fvalue: uint8(214),
  13642. },
  13643. 24: {
  13644. Fname: [7]uint8{'T', 'H', 'O', 'R', 'N'},
  13645. Fvalue: uint8(222),
  13646. },
  13647. 25: {
  13648. Fname: [7]uint8{'U', 'a', 'c', 'u', 't', 'e'},
  13649. Fvalue: uint8(218),
  13650. },
  13651. 26: {
  13652. Fname: [7]uint8{'U', 'c', 'i', 'r', 'c'},
  13653. Fvalue: uint8(219),
  13654. },
  13655. 27: {
  13656. Fname: [7]uint8{'U', 'g', 'r', 'a', 'v', 'e'},
  13657. Fvalue: uint8(217),
  13658. },
  13659. 28: {
  13660. Fname: [7]uint8{'U', 'u', 'm', 'l'},
  13661. Fvalue: uint8(220),
  13662. },
  13663. 29: {
  13664. Fname: [7]uint8{'Y', 'a', 'c', 'u', 't', 'e'},
  13665. Fvalue: uint8(221),
  13666. },
  13667. 30: {
  13668. Fname: [7]uint8{'a', 'a', 'c', 'u', 't', 'e'},
  13669. Fvalue: uint8(225),
  13670. },
  13671. 31: {
  13672. Fname: [7]uint8{'a', 'c', 'i', 'r', 'c'},
  13673. Fvalue: uint8(226),
  13674. },
  13675. 32: {
  13676. Fname: [7]uint8{'a', 'c', 'u', 't', 'e'},
  13677. Fvalue: uint8(180),
  13678. },
  13679. 33: {
  13680. Fname: [7]uint8{'a', 'e', 'l', 'i', 'g'},
  13681. Fvalue: uint8(230),
  13682. },
  13683. 34: {
  13684. Fname: [7]uint8{'a', 'g', 'r', 'a', 'v', 'e'},
  13685. Fvalue: uint8(224),
  13686. },
  13687. 35: {
  13688. Fname: [7]uint8{'a', 'm', 'p'},
  13689. Fvalue: uint8(38),
  13690. },
  13691. 36: {
  13692. Fname: [7]uint8{'a', 'r', 'i', 'n', 'g'},
  13693. Fvalue: uint8(229),
  13694. },
  13695. 37: {
  13696. Fname: [7]uint8{'a', 't', 'i', 'l', 'd', 'e'},
  13697. Fvalue: uint8(227),
  13698. },
  13699. 38: {
  13700. Fname: [7]uint8{'a', 'u', 'm', 'l'},
  13701. Fvalue: uint8(228),
  13702. },
  13703. 39: {
  13704. Fname: [7]uint8{'b', 'r', 'v', 'b', 'a', 'r'},
  13705. Fvalue: uint8(166),
  13706. },
  13707. 40: {
  13708. Fname: [7]uint8{'c', 'c', 'e', 'd', 'i', 'l'},
  13709. Fvalue: uint8(231),
  13710. },
  13711. 41: {
  13712. Fname: [7]uint8{'c', 'e', 'd', 'i', 'l'},
  13713. Fvalue: uint8(184),
  13714. },
  13715. 42: {
  13716. Fname: [7]uint8{'c', 'e', 'n', 't'},
  13717. Fvalue: uint8(162),
  13718. },
  13719. 43: {
  13720. Fname: [7]uint8{'c', 'o', 'p', 'y'},
  13721. Fvalue: uint8(169),
  13722. },
  13723. 44: {
  13724. Fname: [7]uint8{'c', 'u', 'r', 'r', 'e', 'n'},
  13725. Fvalue: uint8(164),
  13726. },
  13727. 45: {
  13728. Fname: [7]uint8{'d', 'e', 'g'},
  13729. Fvalue: uint8(176),
  13730. },
  13731. 46: {
  13732. Fname: [7]uint8{'d', 'i', 'v', 'i', 'd', 'e'},
  13733. Fvalue: uint8(247),
  13734. },
  13735. 47: {
  13736. Fname: [7]uint8{'e', 'a', 'c', 'u', 't', 'e'},
  13737. Fvalue: uint8(233),
  13738. },
  13739. 48: {
  13740. Fname: [7]uint8{'e', 'c', 'i', 'r', 'c'},
  13741. Fvalue: uint8(234),
  13742. },
  13743. 49: {
  13744. Fname: [7]uint8{'e', 'g', 'r', 'a', 'v', 'e'},
  13745. Fvalue: uint8(232),
  13746. },
  13747. 50: {
  13748. Fname: [7]uint8{'e', 't', 'h'},
  13749. Fvalue: uint8(240),
  13750. },
  13751. 51: {
  13752. Fname: [7]uint8{'e', 'u', 'm', 'l'},
  13753. Fvalue: uint8(235),
  13754. },
  13755. 52: {
  13756. Fname: [7]uint8{'f', 'r', 'a', 'c', '1', '2'},
  13757. Fvalue: uint8(189),
  13758. },
  13759. 53: {
  13760. Fname: [7]uint8{'f', 'r', 'a', 'c', '1', '4'},
  13761. Fvalue: uint8(188),
  13762. },
  13763. 54: {
  13764. Fname: [7]uint8{'f', 'r', 'a', 'c', '3', '4'},
  13765. Fvalue: uint8(190),
  13766. },
  13767. 55: {
  13768. Fname: [7]uint8{'g', 't'},
  13769. Fvalue: uint8(62),
  13770. },
  13771. 56: {
  13772. Fname: [7]uint8{'i', 'a', 'c', 'u', 't', 'e'},
  13773. Fvalue: uint8(237),
  13774. },
  13775. 57: {
  13776. Fname: [7]uint8{'i', 'c', 'i', 'r', 'c'},
  13777. Fvalue: uint8(238),
  13778. },
  13779. 58: {
  13780. Fname: [7]uint8{'i', 'e', 'x', 'c', 'l'},
  13781. Fvalue: uint8(161),
  13782. },
  13783. 59: {
  13784. Fname: [7]uint8{'i', 'g', 'r', 'a', 'v', 'e'},
  13785. Fvalue: uint8(236),
  13786. },
  13787. 60: {
  13788. Fname: [7]uint8{'i', 'q', 'u', 'e', 's', 't'},
  13789. Fvalue: uint8(191),
  13790. },
  13791. 61: {
  13792. Fname: [7]uint8{'i', 'u', 'm', 'l'},
  13793. Fvalue: uint8(239),
  13794. },
  13795. 62: {
  13796. Fname: [7]uint8{'l', 'a', 'q', 'u', 'o'},
  13797. Fvalue: uint8(171),
  13798. },
  13799. 63: {
  13800. Fname: [7]uint8{'l', 't'},
  13801. Fvalue: uint8(60),
  13802. },
  13803. 64: {
  13804. Fname: [7]uint8{'m', 'a', 'c', 'r'},
  13805. Fvalue: uint8(175),
  13806. },
  13807. 65: {
  13808. Fname: [7]uint8{'m', 'i', 'c', 'r', 'o'},
  13809. Fvalue: uint8(181),
  13810. },
  13811. 66: {
  13812. Fname: [7]uint8{'m', 'i', 'd', 'd', 'o', 't'},
  13813. Fvalue: uint8(183),
  13814. },
  13815. 67: {
  13816. Fname: [7]uint8{'n', 'b', 's', 'p'},
  13817. Fvalue: uint8(160),
  13818. },
  13819. 68: {
  13820. Fname: [7]uint8{'n', 'o', 't'},
  13821. Fvalue: uint8(172),
  13822. },
  13823. 69: {
  13824. Fname: [7]uint8{'n', 't', 'i', 'l', 'd', 'e'},
  13825. Fvalue: uint8(241),
  13826. },
  13827. 70: {
  13828. Fname: [7]uint8{'o', 'a', 'c', 'u', 't', 'e'},
  13829. Fvalue: uint8(243),
  13830. },
  13831. 71: {
  13832. Fname: [7]uint8{'o', 'c', 'i', 'r', 'c'},
  13833. Fvalue: uint8(244),
  13834. },
  13835. 72: {
  13836. Fname: [7]uint8{'o', 'g', 'r', 'a', 'v', 'e'},
  13837. Fvalue: uint8(242),
  13838. },
  13839. 73: {
  13840. Fname: [7]uint8{'o', 'r', 'd', 'f'},
  13841. Fvalue: uint8(170),
  13842. },
  13843. 74: {
  13844. Fname: [7]uint8{'o', 'r', 'd', 'm'},
  13845. Fvalue: uint8(186),
  13846. },
  13847. 75: {
  13848. Fname: [7]uint8{'o', 's', 'l', 'a', 's', 'h'},
  13849. Fvalue: uint8(248),
  13850. },
  13851. 76: {
  13852. Fname: [7]uint8{'o', 't', 'i', 'l', 'd', 'e'},
  13853. Fvalue: uint8(245),
  13854. },
  13855. 77: {
  13856. Fname: [7]uint8{'o', 'u', 'm', 'l'},
  13857. Fvalue: uint8(246),
  13858. },
  13859. 78: {
  13860. Fname: [7]uint8{'p', 'a', 'r', 'a'},
  13861. Fvalue: uint8(182),
  13862. },
  13863. 79: {
  13864. Fname: [7]uint8{'p', 'l', 'u', 's', 'm', 'n'},
  13865. Fvalue: uint8(177),
  13866. },
  13867. 80: {
  13868. Fname: [7]uint8{'p', 'o', 'u', 'n', 'd'},
  13869. Fvalue: uint8(163),
  13870. },
  13871. 81: {
  13872. Fname: [7]uint8{'q', 'u', 'o', 't'},
  13873. Fvalue: uint8(34),
  13874. },
  13875. 82: {
  13876. Fname: [7]uint8{'r', 'a', 'q', 'u', 'o'},
  13877. Fvalue: uint8(187),
  13878. },
  13879. 83: {
  13880. Fname: [7]uint8{'r', 'e', 'g'},
  13881. Fvalue: uint8(174),
  13882. },
  13883. 84: {
  13884. Fname: [7]uint8{'s', 'e', 'c', 't'},
  13885. Fvalue: uint8(167),
  13886. },
  13887. 85: {
  13888. Fname: [7]uint8{'s', 'h', 'y'},
  13889. Fvalue: uint8(173),
  13890. },
  13891. 86: {
  13892. Fname: [7]uint8{'s', 'u', 'p', '1'},
  13893. Fvalue: uint8(185),
  13894. },
  13895. 87: {
  13896. Fname: [7]uint8{'s', 'u', 'p', '2'},
  13897. Fvalue: uint8(178),
  13898. },
  13899. 88: {
  13900. Fname: [7]uint8{'s', 'u', 'p', '3'},
  13901. Fvalue: uint8(179),
  13902. },
  13903. 89: {
  13904. Fname: [7]uint8{'s', 'z', 'l', 'i', 'g'},
  13905. Fvalue: uint8(223),
  13906. },
  13907. 90: {
  13908. Fname: [7]uint8{'t', 'h', 'o', 'r', 'n'},
  13909. Fvalue: uint8(254),
  13910. },
  13911. 91: {
  13912. Fname: [7]uint8{'t', 'i', 'm', 'e', 's'},
  13913. Fvalue: uint8(215),
  13914. },
  13915. 92: {
  13916. Fname: [7]uint8{'u', 'a', 'c', 'u', 't', 'e'},
  13917. Fvalue: uint8(250),
  13918. },
  13919. 93: {
  13920. Fname: [7]uint8{'u', 'c', 'i', 'r', 'c'},
  13921. Fvalue: uint8(251),
  13922. },
  13923. 94: {
  13924. Fname: [7]uint8{'u', 'g', 'r', 'a', 'v', 'e'},
  13925. Fvalue: uint8(249),
  13926. },
  13927. 95: {
  13928. Fname: [7]uint8{'u', 'm', 'l'},
  13929. Fvalue: uint8(168),
  13930. },
  13931. 96: {
  13932. Fname: [7]uint8{'u', 'u', 'm', 'l'},
  13933. Fvalue: uint8(252),
  13934. },
  13935. 97: {
  13936. Fname: [7]uint8{'y', 'a', 'c', 'u', 't', 'e'},
  13937. Fvalue: uint8(253),
  13938. },
  13939. 98: {
  13940. Fname: [7]uint8{'y', 'e', 'n'},
  13941. Fvalue: uint8(165),
  13942. },
  13943. 99: {
  13944. Fname: [7]uint8{'y', 'u', 'm', 'l'},
  13945. Fvalue: uint8(255),
  13946. },
  13947. }
  13948. // C documentation
  13949. //
  13950. // /*
  13951. // * unvis - decode characters previously encoded by vis
  13952. // */
  13953. func Xunvis(tls *libc.TLS, cp uintptr, c int32, astate uintptr, flag int32) (r int32) {
  13954. var ia, is, lc, st, uc uint8
  13955. var v22, v23, v24, v25, v26 int32
  13956. var p19, p20, p21, p28 uintptr
  13957. _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ia, is, lc, st, uc, v22, v23, v24, v25, v26, p19, p20, p21, p28
  13958. uc = libc.Uint8FromInt32(c)
  13959. /*
  13960. * Bottom 8 bits of astate hold the state machine state.
  13961. * Top 8 bits hold the current character in the http 1866 nv string decoding
  13962. */
  13963. st = libc.Uint8FromInt32(*(*int32)(unsafe.Pointer(astate)) & libc.Int32FromInt32(0xff))
  13964. if flag&int32(m__VIS_END) != 0 {
  13965. switch libc.Int32FromUint8(st) {
  13966. case int32(m_S_OCTAL2):
  13967. fallthrough
  13968. case int32(m_S_OCTAL3):
  13969. fallthrough
  13970. case int32(m_S_HEX2):
  13971. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13972. return int32(m_UNVIS_VALID)
  13973. case m_S_GROUND:
  13974. return int32(m_UNVIS_NOCHAR)
  13975. default:
  13976. return -int32(1)
  13977. }
  13978. }
  13979. switch libc.Int32FromUint8(st) {
  13980. case m_S_GROUND:
  13981. goto _1
  13982. case int32(m_S_START):
  13983. goto _2
  13984. case int32(m_S_META):
  13985. goto _3
  13986. case int32(m_S_META1):
  13987. goto _4
  13988. case int32(m_S_CTRL):
  13989. goto _5
  13990. case int32(m_S_OCTAL2):
  13991. goto _6
  13992. case int32(m_S_OCTAL3):
  13993. goto _7
  13994. case int32(m_S_HEX):
  13995. goto _8
  13996. case int32(m_S_HEX1):
  13997. goto _9
  13998. case int32(m_S_HEX2):
  13999. goto _10
  14000. case int32(m_S_MIME1):
  14001. goto _11
  14002. case int32(m_S_MIME2):
  14003. goto _12
  14004. case int32(m_S_EATCRNL):
  14005. goto _13
  14006. case int32(m_S_AMP):
  14007. goto _14
  14008. case int32(m_S_STRING):
  14009. goto _15
  14010. case int32(m_S_NUMBER):
  14011. goto _16
  14012. default:
  14013. goto _17
  14014. }
  14015. goto _18
  14016. _1:
  14017. ;
  14018. *(*uint8)(unsafe.Pointer(cp)) = uint8(0)
  14019. if flag&int32(m_VIS_NOESCAPE) == 0 && c == int32('\\') {
  14020. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_START)))
  14021. return int32(m_UNVIS_NOCHAR)
  14022. }
  14023. if flag&int32(m_VIS_HTTP1808) != 0 && c == int32('%') {
  14024. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_HEX1)))
  14025. return int32(m_UNVIS_NOCHAR)
  14026. }
  14027. if flag&int32(m_VIS_HTTP1866) != 0 && c == int32('&') {
  14028. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_AMP)))
  14029. return int32(m_UNVIS_NOCHAR)
  14030. }
  14031. if flag&int32(m_VIS_MIMESTYLE) != 0 && c == int32('=') {
  14032. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_MIME1)))
  14033. return int32(m_UNVIS_NOCHAR)
  14034. }
  14035. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(c)
  14036. return int32(m_UNVIS_VALID)
  14037. _2:
  14038. ;
  14039. switch c {
  14040. case int32('\\'):
  14041. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(c)
  14042. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14043. return int32(m_UNVIS_VALID)
  14044. case int32('0'):
  14045. fallthrough
  14046. case int32('1'):
  14047. fallthrough
  14048. case int32('2'):
  14049. fallthrough
  14050. case int32('3'):
  14051. fallthrough
  14052. case int32('4'):
  14053. fallthrough
  14054. case int32('5'):
  14055. fallthrough
  14056. case int32('6'):
  14057. fallthrough
  14058. case int32('7'):
  14059. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(c - libc.Int32FromUint8('0'))
  14060. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_OCTAL2)))
  14061. return int32(m_UNVIS_NOCHAR)
  14062. case int32('M'):
  14063. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(0200)
  14064. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_META)))
  14065. return int32(m_UNVIS_NOCHAR)
  14066. case int32('^'):
  14067. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_CTRL)))
  14068. return int32(m_UNVIS_NOCHAR)
  14069. case int32('n'):
  14070. *(*uint8)(unsafe.Pointer(cp)) = uint8('\n')
  14071. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14072. return int32(m_UNVIS_VALID)
  14073. case int32('r'):
  14074. *(*uint8)(unsafe.Pointer(cp)) = uint8('\r')
  14075. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14076. return int32(m_UNVIS_VALID)
  14077. case int32('b'):
  14078. *(*uint8)(unsafe.Pointer(cp)) = uint8('\b')
  14079. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14080. return int32(m_UNVIS_VALID)
  14081. case int32('a'):
  14082. *(*uint8)(unsafe.Pointer(cp)) = uint8('\007')
  14083. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14084. return int32(m_UNVIS_VALID)
  14085. case int32('v'):
  14086. *(*uint8)(unsafe.Pointer(cp)) = uint8('\v')
  14087. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14088. return int32(m_UNVIS_VALID)
  14089. case int32('t'):
  14090. *(*uint8)(unsafe.Pointer(cp)) = uint8('\t')
  14091. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14092. return int32(m_UNVIS_VALID)
  14093. case int32('f'):
  14094. *(*uint8)(unsafe.Pointer(cp)) = uint8('\f')
  14095. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14096. return int32(m_UNVIS_VALID)
  14097. case int32('s'):
  14098. *(*uint8)(unsafe.Pointer(cp)) = uint8(' ')
  14099. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14100. return int32(m_UNVIS_VALID)
  14101. case int32('E'):
  14102. *(*uint8)(unsafe.Pointer(cp)) = uint8('\033')
  14103. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14104. return int32(m_UNVIS_VALID)
  14105. case int32('x'):
  14106. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_HEX)))
  14107. return int32(m_UNVIS_NOCHAR)
  14108. case int32('\n'):
  14109. /*
  14110. * hidden newline
  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_NOCHAR)
  14114. case int32('$'):
  14115. /*
  14116. * hidden marker
  14117. */
  14118. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14119. return int32(m_UNVIS_NOCHAR)
  14120. default:
  14121. if libc.BoolInt32(libc.Uint32FromInt32(c)-uint32(0x21) < uint32(0x5e)) != 0 {
  14122. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(c)
  14123. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14124. return int32(m_UNVIS_VALID)
  14125. }
  14126. }
  14127. goto bad
  14128. _3:
  14129. ;
  14130. if c == int32('-') {
  14131. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_META1)))
  14132. } else {
  14133. if c == int32('^') {
  14134. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_CTRL)))
  14135. } else {
  14136. goto bad
  14137. }
  14138. }
  14139. return int32(m_UNVIS_NOCHAR)
  14140. _4:
  14141. ;
  14142. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14143. p19 = cp
  14144. *(*uint8)(unsafe.Pointer(p19)) = uint8(int32(*(*uint8)(unsafe.Pointer(p19))) | c)
  14145. return int32(m_UNVIS_VALID)
  14146. _5:
  14147. ;
  14148. if c == int32('?') {
  14149. p20 = cp
  14150. *(*uint8)(unsafe.Pointer(p20)) = uint8(int32(*(*uint8)(unsafe.Pointer(p20))) | libc.Int32FromInt32(0177))
  14151. } else {
  14152. p21 = cp
  14153. *(*uint8)(unsafe.Pointer(p21)) = uint8(int32(*(*uint8)(unsafe.Pointer(p21))) | c&libc.Int32FromInt32(037))
  14154. }
  14155. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14156. return int32(m_UNVIS_VALID)
  14157. _6:
  14158. ; /* second possible octal digit */
  14159. if libc.Int32FromUint8(uc) >= int32('0') && libc.Int32FromUint8(uc) <= int32('7') {
  14160. /*
  14161. * yes - and maybe a third
  14162. */
  14163. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))<<int32(3) + (c - int32('0')))
  14164. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_OCTAL3)))
  14165. return int32(m_UNVIS_NOCHAR)
  14166. }
  14167. /*
  14168. * no - done with current sequence, push back passed char
  14169. */
  14170. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14171. return int32(m_UNVIS_VALIDPUSH)
  14172. _7:
  14173. ; /* third possible octal digit */
  14174. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14175. if libc.Int32FromUint8(uc) >= int32('0') && libc.Int32FromUint8(uc) <= int32('7') {
  14176. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))<<int32(3) + (c - int32('0')))
  14177. return int32(m_UNVIS_VALID)
  14178. }
  14179. /*
  14180. * we were done, push back passed char
  14181. */
  14182. return int32(m_UNVIS_VALIDPUSH)
  14183. _8:
  14184. ;
  14185. if !(libc.Xisxdigit(tls, libc.Int32FromUint8(uc)) != 0) {
  14186. goto bad
  14187. }
  14188. /*FALLTHROUGH*/
  14189. _9:
  14190. ;
  14191. if libc.Xisxdigit(tls, libc.Int32FromUint8(uc)) != 0 {
  14192. if libc.BoolInt32(uint32(uc)-uint32('0') < uint32(10)) != 0 {
  14193. v22 = libc.Int32FromUint8(uc) - int32('0')
  14194. } else {
  14195. v22 = libc.Xtolower(tls, libc.Int32FromUint8(uc)) - int32('a') + int32(10)
  14196. }
  14197. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(v22)
  14198. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_HEX2)))
  14199. return int32(m_UNVIS_NOCHAR)
  14200. }
  14201. /*
  14202. * no - done with current sequence, push back passed char
  14203. */
  14204. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14205. return int32(m_UNVIS_VALIDPUSH)
  14206. _10:
  14207. ;
  14208. *(*int32)(unsafe.Pointer(astate)) = m_S_GROUND
  14209. if libc.Xisxdigit(tls, libc.Int32FromUint8(uc)) != 0 {
  14210. if libc.BoolInt32(uint32(uc)-uint32('0') < uint32(10)) != 0 {
  14211. v23 = libc.Int32FromUint8(uc) - int32('0')
  14212. } else {
  14213. v23 = libc.Xtolower(tls, libc.Int32FromUint8(uc)) - int32('a') + int32(10)
  14214. }
  14215. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(v23 | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))<<int32(4))
  14216. return int32(m_UNVIS_VALID)
  14217. }
  14218. return int32(m_UNVIS_VALIDPUSH)
  14219. _11:
  14220. ;
  14221. if libc.Int32FromUint8(uc) == int32('\n') || libc.Int32FromUint8(uc) == int32('\r') {
  14222. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_EATCRNL)))
  14223. return int32(m_UNVIS_NOCHAR)
  14224. }
  14225. 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) {
  14226. if libc.BoolInt32(uint32(uc)-uint32('0') < uint32(10)) != 0 {
  14227. v24 = libc.Int32FromUint8(uc) - int32('0')
  14228. } else {
  14229. v24 = libc.Int32FromUint8(uc) - int32('A') + int32(10)
  14230. }
  14231. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(v24)
  14232. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_MIME2)))
  14233. return int32(m_UNVIS_NOCHAR)
  14234. }
  14235. goto bad
  14236. _12:
  14237. ;
  14238. 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) {
  14239. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14240. if libc.BoolInt32(uint32(uc)-uint32('0') < uint32(10)) != 0 {
  14241. v25 = libc.Int32FromUint8(uc) - int32('0')
  14242. } else {
  14243. v25 = libc.Int32FromUint8(uc) - int32('A') + int32(10)
  14244. }
  14245. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(v25 | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))<<int32(4))
  14246. return int32(m_UNVIS_VALID)
  14247. }
  14248. goto bad
  14249. _13:
  14250. ;
  14251. switch libc.Int32FromUint8(uc) {
  14252. case int32('\r'):
  14253. fallthrough
  14254. case int32('\n'):
  14255. return int32(m_UNVIS_NOCHAR)
  14256. case int32('='):
  14257. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_MIME1)))
  14258. return int32(m_UNVIS_NOCHAR)
  14259. default:
  14260. *(*uint8)(unsafe.Pointer(cp)) = uc
  14261. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14262. return int32(m_UNVIS_VALID)
  14263. }
  14264. _14:
  14265. ;
  14266. *(*uint8)(unsafe.Pointer(cp)) = uint8(0)
  14267. if libc.Int32FromUint8(uc) == int32('#') {
  14268. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_NUMBER)))
  14269. return int32(m_UNVIS_NOCHAR)
  14270. }
  14271. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_STRING)))
  14272. /*FALLTHROUGH*/
  14273. _15:
  14274. ;
  14275. ia = *(*uint8)(unsafe.Pointer(cp)) /* index in the array */
  14276. is = uint8(libc.Uint32FromInt32(*(*int32)(unsafe.Pointer(astate))) >> libc.Int32FromInt32(24)) /* index in the string */
  14277. if libc.Int32FromUint8(is) == 0 {
  14278. v26 = 0
  14279. } else {
  14280. v26 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_nv)) + uintptr(ia)*8 + uintptr(libc.Int32FromUint8(is)-int32(1)))))
  14281. }
  14282. lc = libc.Uint8FromInt32(v26) /* last character */
  14283. if libc.Int32FromUint8(uc) == int32(';') {
  14284. uc = uint8('\000')
  14285. }
  14286. for {
  14287. if !(uint64(ia) < libc.Uint64FromInt64(800)/libc.Uint64FromInt64(8)) {
  14288. break
  14289. }
  14290. if libc.Int32FromUint8(is) != 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_nv)) + uintptr(ia)*8 + uintptr(libc.Int32FromUint8(is)-int32(1))))) != libc.Int32FromUint8(lc) {
  14291. goto bad
  14292. }
  14293. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_nv)) + uintptr(ia)*8 + uintptr(is)))) == libc.Int32FromUint8(uc) {
  14294. break
  14295. }
  14296. goto _27
  14297. _27:
  14298. ;
  14299. ia++
  14300. }
  14301. if uint64(ia) == libc.Uint64FromInt64(800)/libc.Uint64FromInt64(8) {
  14302. goto bad
  14303. }
  14304. if libc.Int32FromUint8(uc) != 0 {
  14305. *(*uint8)(unsafe.Pointer(cp)) = ia
  14306. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromUint8(is)+libc.Int32FromInt32(1))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_STRING)))
  14307. return int32(m_UNVIS_NOCHAR)
  14308. }
  14309. *(*uint8)(unsafe.Pointer(cp)) = _nv[ia].Fvalue
  14310. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14311. return int32(m_UNVIS_VALID)
  14312. _16:
  14313. ;
  14314. if libc.Int32FromUint8(uc) == int32(';') {
  14315. return int32(m_UNVIS_VALID)
  14316. }
  14317. if !(libc.BoolInt32(uint32(uc)-libc.Uint32FromUint8('0') < libc.Uint32FromInt32(10)) != 0) {
  14318. goto bad
  14319. }
  14320. p28 = cp
  14321. *(*uint8)(unsafe.Pointer(p28)) = uint8(int32(*(*uint8)(unsafe.Pointer(p28))) + (libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))*libc.Int32FromInt32(10) + libc.Int32FromUint8(uc) - libc.Int32FromUint8('0')))
  14322. return int32(m_UNVIS_NOCHAR)
  14323. _17:
  14324. ;
  14325. goto bad
  14326. bad:
  14327. ;
  14328. /*
  14329. * decoder in unknown state - (probably uninitialized)
  14330. */
  14331. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14332. return -int32(1)
  14333. _18:
  14334. ;
  14335. return r
  14336. }
  14337. /*
  14338. * strnunvisx - decode src into dst
  14339. *
  14340. * Number of chars decoded into dst is returned, -1 on error.
  14341. * Dst is null terminated.
  14342. */
  14343. func Xstrnunvisx(tls *libc.TLS, dst uintptr, dlen Tsize_t, src uintptr, flag int32) (r int32) {
  14344. bp := tls.Alloc(16)
  14345. defer tls.Free(16)
  14346. var c, v1 uint8
  14347. var start, v14, v16, v18, v2 uintptr
  14348. var v13, v15, v17, v19 Tsize_t
  14349. var _ /* state at bp+4 */ int32
  14350. var _ /* t at bp+0 */ uint8
  14351. _, _, _, _, _, _, _, _, _, _, _ = c, start, v1, v13, v14, v15, v16, v17, v18, v19, v2
  14352. *(*uint8)(unsafe.Pointer(bp)) = uint8('\000')
  14353. start = dst
  14354. *(*int32)(unsafe.Pointer(bp + 4)) = 0
  14355. for {
  14356. v2 = src
  14357. src++
  14358. v1 = *(*uint8)(unsafe.Pointer(v2))
  14359. c = v1
  14360. if !(libc.Int32FromUint8(v1) != int32('\000')) {
  14361. break
  14362. }
  14363. goto again
  14364. again:
  14365. ;
  14366. switch Xunvis(tls, bp, libc.Int32FromUint8(c), bp+4, flag) {
  14367. case int32(m_UNVIS_VALID):
  14368. goto _3
  14369. case int32(m_UNVIS_VALIDPUSH):
  14370. goto _4
  14371. case int32(m_UNVIS_NOCHAR):
  14372. goto _5
  14373. case 0:
  14374. goto _6
  14375. case -int32(1):
  14376. goto _7
  14377. default:
  14378. goto _8
  14379. }
  14380. goto _9
  14381. _3:
  14382. ;
  14383. _12:
  14384. ;
  14385. v13 = dlen
  14386. dlen--
  14387. if v13 == uint64(0) {
  14388. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14389. return -int32(1)
  14390. }
  14391. goto _11
  14392. _11:
  14393. ;
  14394. if 0 != 0 {
  14395. goto _12
  14396. }
  14397. goto _10
  14398. _10:
  14399. ;
  14400. v14 = dst
  14401. dst++
  14402. *(*uint8)(unsafe.Pointer(v14)) = *(*uint8)(unsafe.Pointer(bp))
  14403. goto _9
  14404. _4:
  14405. ;
  14406. v15 = dlen
  14407. dlen--
  14408. if v15 == uint64(0) {
  14409. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14410. return -int32(1)
  14411. }
  14412. v16 = dst
  14413. dst++
  14414. *(*uint8)(unsafe.Pointer(v16)) = *(*uint8)(unsafe.Pointer(bp))
  14415. goto again
  14416. _6:
  14417. ;
  14418. _5:
  14419. ;
  14420. goto _9
  14421. _7:
  14422. ;
  14423. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  14424. return -int32(1)
  14425. _8:
  14426. ;
  14427. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  14428. return -int32(1)
  14429. _9:
  14430. }
  14431. if Xunvis(tls, bp, libc.Int32FromUint8(c), bp+4, int32(m__VIS_END)) == int32(m_UNVIS_VALID) {
  14432. v17 = dlen
  14433. dlen--
  14434. if v17 == uint64(0) {
  14435. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14436. return -int32(1)
  14437. }
  14438. v18 = dst
  14439. dst++
  14440. *(*uint8)(unsafe.Pointer(v18)) = *(*uint8)(unsafe.Pointer(bp))
  14441. }
  14442. v19 = dlen
  14443. dlen--
  14444. if v19 == uint64(0) {
  14445. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14446. return -int32(1)
  14447. }
  14448. *(*uint8)(unsafe.Pointer(dst)) = uint8('\000')
  14449. return int32(int64(dst) - int64(start))
  14450. }
  14451. func Xstrunvisx(tls *libc.TLS, dst uintptr, src uintptr, flag int32) (r int32) {
  14452. return Xstrnunvisx(tls, dst, libc.Uint64FromInt32(^libc.Int32FromInt32(0)), src, flag)
  14453. }
  14454. func Xstrunvis(tls *libc.TLS, dst uintptr, src uintptr) (r int32) {
  14455. return Xstrnunvisx(tls, dst, libc.Uint64FromInt32(^libc.Int32FromInt32(0)), src, 0)
  14456. }
  14457. func Xstrnunvis_openbsd(tls *libc.TLS, dst uintptr, src uintptr, dlen Tsize_t) (r Tssize_t) {
  14458. return int64(Xstrnunvisx(tls, dst, dlen, src, 0))
  14459. }
  14460. func Xstrnunvis_netbsd(tls *libc.TLS, dst uintptr, dlen Tsize_t, src uintptr) (r int32) {
  14461. return Xstrnunvisx(tls, dst, dlen, src, 0)
  14462. }
  14463. const m_MAXEXTRAS = 30
  14464. const m_VIS_CSTYLE1 = 2
  14465. const m_VIS_DQ1 = 32768
  14466. const m_VIS_GLOB1 = 4096
  14467. const m_VIS_HTTP18081 = 0x0080
  14468. const m_VIS_HTTP18661 = 0x0200
  14469. const m_VIS_HTTPSTYLE1 = 128
  14470. const m_VIS_NL1 = 16
  14471. const m_VIS_NOESCAPE1 = 0x0400
  14472. const m_VIS_NOLOCALE1 = 16384
  14473. const m_VIS_NOSLASH1 = 64
  14474. const m_VIS_OCTAL1 = 1
  14475. const m_VIS_SAFE1 = 32
  14476. const m_VIS_SHELL1 = 8192
  14477. const m_VIS_SP1 = 4
  14478. const m_VIS_TAB1 = 8
  14479. const m__VIS_END1 = 0x0800
  14480. type Twctrans_t = uintptr
  14481. /* Keep it simple for now, no locale stuff */
  14482. var _char_shell = [19]Twchar_t{'\'', '`', '"', ';', '&', '<', '>', '(', ')', '|', '{', '}', ']', '\\', '$', '!', '^', '~'}
  14483. var _char_glob = [5]Twchar_t{'*', '?', '[', '#'}
  14484. /*
  14485. * On NetBSD and glibc MB_LEN_MAX is currently > 8 which does not fit on any
  14486. * integer integral type and it is probably wrong, since currently the maximum
  14487. * number of bytes and character needs is 6. Until this is fixed, the
  14488. * loops below are using sizeof(uint64_t) - 1 instead of MB_LEN_MAX, and
  14489. * the assertion is commented out.
  14490. */
  14491. // C documentation
  14492. //
  14493. // /*
  14494. // * This is do_hvis, for HTTP style (RFC 1808)
  14495. // */
  14496. func _do_hvis(tls *libc.TLS, dst uintptr, c Twint_t, flags int32, nextc Twint_t, extra uintptr) (r uintptr) {
  14497. var v1, v2, v3 uintptr
  14498. _, _, _ = v1, v2, v3
  14499. 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(',') {
  14500. dst = _do_svis(tls, dst, c, flags, nextc, extra)
  14501. } else {
  14502. v1 = dst
  14503. dst += 4
  14504. *(*Twchar_t)(unsafe.Pointer(v1)) = int32('%')
  14505. v2 = dst
  14506. dst += 4
  14507. *(*Twchar_t)(unsafe.Pointer(v2)) = *(*t__predefined_wchar_t)(unsafe.Pointer(__ccgo_ts + 469 + uintptr(c>>int32(4)&uint32(0xf))*4))
  14508. v3 = dst
  14509. dst += 4
  14510. *(*Twchar_t)(unsafe.Pointer(v3)) = *(*t__predefined_wchar_t)(unsafe.Pointer(__ccgo_ts + 469 + uintptr(c&uint32(0xf))*4))
  14511. }
  14512. return dst
  14513. }
  14514. // C documentation
  14515. //
  14516. // /*
  14517. // * This is do_mvis, for Quoted-Printable MIME (RFC 2045)
  14518. // * NB: No handling of long lines or CRLF.
  14519. // */
  14520. func _do_mvis(tls *libc.TLS, dst uintptr, c Twint_t, flags int32, nextc Twint_t, extra uintptr) (r uintptr) {
  14521. var v1, v2, v3 uintptr
  14522. _, _, _ = v1, v2, v3
  14523. 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)) {
  14524. v1 = dst
  14525. dst += 4
  14526. *(*Twchar_t)(unsafe.Pointer(v1)) = int32('=')
  14527. v2 = dst
  14528. dst += 4
  14529. *(*Twchar_t)(unsafe.Pointer(v2)) = *(*t__predefined_wchar_t)(unsafe.Pointer(__ccgo_ts + 589 + uintptr(c>>int32(4)&uint32(0xf))*4))
  14530. v3 = dst
  14531. dst += 4
  14532. *(*Twchar_t)(unsafe.Pointer(v3)) = *(*t__predefined_wchar_t)(unsafe.Pointer(__ccgo_ts + 589 + uintptr(c&uint32(0xf))*4))
  14533. } else {
  14534. dst = _do_svis(tls, dst, c, flags, nextc, extra)
  14535. }
  14536. return dst
  14537. }
  14538. // C documentation
  14539. //
  14540. // /*
  14541. // * Output single byte of multibyte character.
  14542. // */
  14543. func _do_mbyte(tls *libc.TLS, dst uintptr, c Twint_t, flags int32, nextc Twint_t, iswextra int32) (r uintptr) {
  14544. 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
  14545. var v21 int32
  14546. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  14547. if flags&int32(m_VIS_CSTYLE1) != 0 {
  14548. switch c {
  14549. case uint32('\n'):
  14550. v1 = dst
  14551. dst += 4
  14552. *(*Twchar_t)(unsafe.Pointer(v1)) = int32('\\')
  14553. v2 = dst
  14554. dst += 4
  14555. *(*Twchar_t)(unsafe.Pointer(v2)) = int32('n')
  14556. return dst
  14557. case uint32('\r'):
  14558. v3 = dst
  14559. dst += 4
  14560. *(*Twchar_t)(unsafe.Pointer(v3)) = int32('\\')
  14561. v4 = dst
  14562. dst += 4
  14563. *(*Twchar_t)(unsafe.Pointer(v4)) = int32('r')
  14564. return dst
  14565. case uint32('\b'):
  14566. v5 = dst
  14567. dst += 4
  14568. *(*Twchar_t)(unsafe.Pointer(v5)) = int32('\\')
  14569. v6 = dst
  14570. dst += 4
  14571. *(*Twchar_t)(unsafe.Pointer(v6)) = int32('b')
  14572. return dst
  14573. case uint32('\a'):
  14574. v7 = dst
  14575. dst += 4
  14576. *(*Twchar_t)(unsafe.Pointer(v7)) = int32('\\')
  14577. v8 = dst
  14578. dst += 4
  14579. *(*Twchar_t)(unsafe.Pointer(v8)) = int32('a')
  14580. return dst
  14581. case uint32('\v'):
  14582. v9 = dst
  14583. dst += 4
  14584. *(*Twchar_t)(unsafe.Pointer(v9)) = int32('\\')
  14585. v10 = dst
  14586. dst += 4
  14587. *(*Twchar_t)(unsafe.Pointer(v10)) = int32('v')
  14588. return dst
  14589. case uint32('\t'):
  14590. v11 = dst
  14591. dst += 4
  14592. *(*Twchar_t)(unsafe.Pointer(v11)) = int32('\\')
  14593. v12 = dst
  14594. dst += 4
  14595. *(*Twchar_t)(unsafe.Pointer(v12)) = int32('t')
  14596. return dst
  14597. case uint32('\f'):
  14598. v13 = dst
  14599. dst += 4
  14600. *(*Twchar_t)(unsafe.Pointer(v13)) = int32('\\')
  14601. v14 = dst
  14602. dst += 4
  14603. *(*Twchar_t)(unsafe.Pointer(v14)) = int32('f')
  14604. return dst
  14605. case uint32(' '):
  14606. v15 = dst
  14607. dst += 4
  14608. *(*Twchar_t)(unsafe.Pointer(v15)) = int32('\\')
  14609. v16 = dst
  14610. dst += 4
  14611. *(*Twchar_t)(unsafe.Pointer(v16)) = int32('s')
  14612. return dst
  14613. case uint32('\000'):
  14614. v17 = dst
  14615. dst += 4
  14616. *(*Twchar_t)(unsafe.Pointer(v17)) = int32('\\')
  14617. v18 = dst
  14618. dst += 4
  14619. *(*Twchar_t)(unsafe.Pointer(v18)) = int32('0')
  14620. if libc.Int32FromUint8(uint8(nextc)) >= int32('0') && libc.Int32FromUint8(uint8(nextc)) <= int32('7') {
  14621. v19 = dst
  14622. dst += 4
  14623. *(*Twchar_t)(unsafe.Pointer(v19)) = int32('0')
  14624. v20 = dst
  14625. dst += 4
  14626. *(*Twchar_t)(unsafe.Pointer(v20)) = int32('0')
  14627. }
  14628. return dst
  14629. /* We cannot encode these characters in VIS_CSTYLE
  14630. * because they special meaning */
  14631. fallthrough
  14632. case uint32('n'):
  14633. fallthrough
  14634. case uint32('r'):
  14635. fallthrough
  14636. case uint32('b'):
  14637. fallthrough
  14638. case uint32('a'):
  14639. fallthrough
  14640. case uint32('v'):
  14641. fallthrough
  14642. case uint32('t'):
  14643. fallthrough
  14644. case uint32('f'):
  14645. fallthrough
  14646. case uint32('s'):
  14647. fallthrough
  14648. case uint32('0'):
  14649. fallthrough
  14650. case uint32('M'):
  14651. fallthrough
  14652. case uint32('^'):
  14653. fallthrough
  14654. case uint32('$'): /* vis(1) -l */
  14655. default:
  14656. if flags&int32(m_VIS_NOLOCALE1) != 0 {
  14657. v21 = libc.BoolInt32(c-uint32(0x21) < uint32(0x5e))
  14658. } else {
  14659. v21 = libc.Xiswgraph(tls, c)
  14660. }
  14661. if v21 != 0 && !(libc.Int32FromUint8(uint8(c)) >= int32('0') && libc.Int32FromUint8(uint8(c)) <= int32('7')) {
  14662. v22 = dst
  14663. dst += 4
  14664. *(*Twchar_t)(unsafe.Pointer(v22)) = int32('\\')
  14665. v23 = dst
  14666. dst += 4
  14667. *(*Twchar_t)(unsafe.Pointer(v23)) = libc.Int32FromUint32(c)
  14668. return dst
  14669. }
  14670. }
  14671. }
  14672. if iswextra != 0 || c&uint32(0177) == uint32(' ') || flags&int32(m_VIS_OCTAL1) != 0 {
  14673. v24 = dst
  14674. dst += 4
  14675. *(*Twchar_t)(unsafe.Pointer(v24)) = int32('\\')
  14676. v25 = dst
  14677. dst += 4
  14678. *(*Twchar_t)(unsafe.Pointer(v25)) = libc.Int32FromUint8(uint8(uint32(uint8(c))>>libc.Int32FromInt32(6)&libc.Uint32FromInt32(03))) + int32('0')
  14679. v26 = dst
  14680. dst += 4
  14681. *(*Twchar_t)(unsafe.Pointer(v26)) = libc.Int32FromUint8(uint8(uint32(uint8(c))>>libc.Int32FromInt32(3)&libc.Uint32FromInt32(07))) + int32('0')
  14682. v27 = dst
  14683. dst += 4
  14684. *(*Twchar_t)(unsafe.Pointer(v27)) = libc.Int32FromUint32(c&uint32(07) + uint32('0'))
  14685. } else {
  14686. if flags&int32(m_VIS_NOSLASH1) == 0 {
  14687. v28 = dst
  14688. dst += 4
  14689. *(*Twchar_t)(unsafe.Pointer(v28)) = int32('\\')
  14690. }
  14691. if c&uint32(0200) != 0 {
  14692. c &= uint32(0177)
  14693. v29 = dst
  14694. dst += 4
  14695. *(*Twchar_t)(unsafe.Pointer(v29)) = int32('M')
  14696. }
  14697. if libc.Xiswcntrl(tls, c) != 0 {
  14698. v30 = dst
  14699. dst += 4
  14700. *(*Twchar_t)(unsafe.Pointer(v30)) = int32('^')
  14701. if c == uint32(0177) {
  14702. v31 = dst
  14703. dst += 4
  14704. *(*Twchar_t)(unsafe.Pointer(v31)) = int32('?')
  14705. } else {
  14706. v32 = dst
  14707. dst += 4
  14708. *(*Twchar_t)(unsafe.Pointer(v32)) = libc.Int32FromUint32(c + uint32('@'))
  14709. }
  14710. } else {
  14711. v33 = dst
  14712. dst += 4
  14713. *(*Twchar_t)(unsafe.Pointer(v33)) = int32('-')
  14714. v34 = dst
  14715. dst += 4
  14716. *(*Twchar_t)(unsafe.Pointer(v34)) = libc.Int32FromUint32(c)
  14717. }
  14718. }
  14719. return dst
  14720. }
  14721. // C documentation
  14722. //
  14723. // /*
  14724. // * This is do_vis, the central code of vis.
  14725. // * dst: Pointer to the destination buffer
  14726. // * c: Character to encode
  14727. // * flags: Flags word
  14728. // * nextc: The character following 'c'
  14729. // * extra: Pointer to the list of extra characters to be
  14730. // * backslash-protected.
  14731. // */
  14732. func _do_svis(tls *libc.TLS, dst uintptr, c Twint_t, flags int32, nextc Twint_t, extra uintptr) (r uintptr) {
  14733. var bmsk, wmsk Tuint64_t
  14734. var i, iswextra, shft, v1 int32
  14735. var v2 bool
  14736. var v3 uintptr
  14737. _, _, _, _, _, _, _, _ = bmsk, i, iswextra, shft, wmsk, v1, v2, v3
  14738. iswextra = libc.BoolInt32(libc.Xwcschr(tls, extra, libc.Int32FromUint32(c)) != libc.UintptrFromInt32(0))
  14739. if v2 = !(iswextra != 0); v2 {
  14740. if flags&int32(m_VIS_NOLOCALE1) != 0 {
  14741. v1 = libc.BoolInt32(c-uint32(0x21) < uint32(0x5e))
  14742. } else {
  14743. v1 = libc.Xiswgraph(tls, c)
  14744. }
  14745. }
  14746. 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'))) {
  14747. v3 = dst
  14748. dst += 4
  14749. *(*Twchar_t)(unsafe.Pointer(v3)) = libc.Int32FromUint32(c)
  14750. return dst
  14751. }
  14752. /* See comment in istrsenvisx() output loop, below. */
  14753. wmsk = uint64(0)
  14754. i = libc.Int32FromUint64(libc.Uint64FromInt64(8) - libc.Uint64FromInt32(1))
  14755. for {
  14756. if !(i >= 0) {
  14757. break
  14758. }
  14759. shft = i * int32(m_CHAR_BIT)
  14760. bmsk = libc.Uint64FromInt64(0xff) << shft
  14761. wmsk |= bmsk
  14762. if uint64(c)&wmsk != 0 || i == 0 {
  14763. dst = _do_mbyte(tls, dst, uint32(uint64(c)&bmsk>>shft), flags, nextc, iswextra)
  14764. }
  14765. goto _4
  14766. _4:
  14767. ;
  14768. i--
  14769. }
  14770. return dst
  14771. }
  14772. type Tvisfun_t = uintptr
  14773. // C documentation
  14774. //
  14775. // /*
  14776. // * Return the appropriate encoding function depending on the flags given.
  14777. // */
  14778. func _getvisfun(tls *libc.TLS, flags int32) (r Tvisfun_t) {
  14779. if flags&int32(m_VIS_HTTPSTYLE1) != 0 {
  14780. return __ccgo_fp(_do_hvis)
  14781. }
  14782. if flags&int32(m_VIS_MIMESTYLE) != 0 {
  14783. return __ccgo_fp(_do_mvis)
  14784. }
  14785. return __ccgo_fp(_do_svis)
  14786. }
  14787. // C documentation
  14788. //
  14789. // /*
  14790. // * Expand list of extra characters to not visually encode.
  14791. // */
  14792. func _makeextralist(tls *libc.TLS, flags int32, src uintptr) (r uintptr) {
  14793. var d, dst, s, v1, v10, v11, v12, v13, v4, v5, v7, v8, v9 uintptr
  14794. var i, len1 Tsize_t
  14795. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = d, dst, i, len1, s, v1, v10, v11, v12, v13, v4, v5, v7, v8, v9
  14796. len1 = libc.Xstrlen(tls, src)
  14797. v1 = libc.Xcalloc(tls, len1+uint64(m_MAXEXTRAS), uint64(4))
  14798. dst = v1
  14799. if v1 == libc.UintptrFromInt32(0) {
  14800. return libc.UintptrFromInt32(0)
  14801. }
  14802. if flags&int32(m_VIS_NOLOCALE1) != 0 || libc.Xmbstowcs(tls, dst, src, len1) == libc.Uint64FromInt32(-libc.Int32FromInt32(1)) {
  14803. i = uint64(0)
  14804. for {
  14805. if !(i < len1) {
  14806. break
  14807. }
  14808. *(*Twchar_t)(unsafe.Pointer(dst + uintptr(i)*4)) = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(src + uintptr(i))))
  14809. goto _2
  14810. _2:
  14811. ;
  14812. i++
  14813. }
  14814. d = dst + uintptr(len1)*4
  14815. } else {
  14816. d = dst + uintptr(libc.Xwcslen(tls, dst))*4
  14817. }
  14818. if flags&int32(m_VIS_GLOB1) != 0 {
  14819. s = uintptr(unsafe.Pointer(&_char_glob))
  14820. for {
  14821. if !(*(*Twchar_t)(unsafe.Pointer(s)) != 0) {
  14822. break
  14823. }
  14824. goto _3
  14825. goto _3
  14826. _3:
  14827. ;
  14828. v4 = d
  14829. d += 4
  14830. v5 = s
  14831. s += 4
  14832. *(*Twchar_t)(unsafe.Pointer(v4)) = *(*Twchar_t)(unsafe.Pointer(v5))
  14833. }
  14834. }
  14835. if flags&int32(m_VIS_SHELL1) != 0 {
  14836. s = uintptr(unsafe.Pointer(&_char_shell))
  14837. for {
  14838. if !(*(*Twchar_t)(unsafe.Pointer(s)) != 0) {
  14839. break
  14840. }
  14841. goto _6
  14842. goto _6
  14843. _6:
  14844. ;
  14845. v7 = d
  14846. d += 4
  14847. v8 = s
  14848. s += 4
  14849. *(*Twchar_t)(unsafe.Pointer(v7)) = *(*Twchar_t)(unsafe.Pointer(v8))
  14850. }
  14851. }
  14852. if flags&int32(m_VIS_SP1) != 0 {
  14853. v9 = d
  14854. d += 4
  14855. *(*Twchar_t)(unsafe.Pointer(v9)) = int32(' ')
  14856. }
  14857. if flags&int32(m_VIS_TAB1) != 0 {
  14858. v10 = d
  14859. d += 4
  14860. *(*Twchar_t)(unsafe.Pointer(v10)) = int32('\t')
  14861. }
  14862. if flags&int32(m_VIS_NL1) != 0 {
  14863. v11 = d
  14864. d += 4
  14865. *(*Twchar_t)(unsafe.Pointer(v11)) = int32('\n')
  14866. }
  14867. if flags&int32(m_VIS_DQ1) != 0 {
  14868. v12 = d
  14869. d += 4
  14870. *(*Twchar_t)(unsafe.Pointer(v12)) = int32('"')
  14871. }
  14872. if flags&int32(m_VIS_NOSLASH1) == 0 {
  14873. v13 = d
  14874. d += 4
  14875. *(*Twchar_t)(unsafe.Pointer(v13)) = int32('\\')
  14876. }
  14877. *(*Twchar_t)(unsafe.Pointer(d)) = int32('\000')
  14878. return dst
  14879. }
  14880. // C documentation
  14881. //
  14882. // /*
  14883. // * istrsenvisx()
  14884. // * The main internal function.
  14885. // * All user-visible functions call this one.
  14886. // */
  14887. func _istrsenvisx(tls *libc.TLS, mbdstp uintptr, dlen uintptr, mbsrc uintptr, mblength Tsize_t, flags int32, mbextra uintptr, cerr_ptr uintptr) (r int32) {
  14888. var bmsk, wmsk Tuint64_t
  14889. var c Twint_t
  14890. var cerr, clen, error1, i, shft, v12, v6 int32
  14891. var dst, extra, mbdst, mdst, pdst, psrc, src, start, v1, v2, v3, v4, v5, v8 uintptr
  14892. var f Tvisfun_t
  14893. var len1, olen Tsize_t
  14894. var maxolen, mbslength Tssize_t
  14895. var v9 uint64
  14896. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  14897. clen = 0
  14898. error1 = -int32(1)
  14899. mbslength = libc.Int64FromUint64(mblength)
  14900. /*
  14901. * When inputing a single character, must also read in the
  14902. * next character for nextc, the look-ahead character.
  14903. */
  14904. if mbslength == int64(1) {
  14905. mbslength++
  14906. }
  14907. /*
  14908. * Input (mbsrc) is a char string considered to be multibyte
  14909. * characters. The input loop will read this string pulling
  14910. * one character, possibly multiple bytes, from mbsrc and
  14911. * converting each to wchar_t in src.
  14912. *
  14913. * The vis conversion will be done using the wide char
  14914. * wchar_t string.
  14915. *
  14916. * This will then be converted back to a multibyte string to
  14917. * return to the caller.
  14918. */
  14919. /* Allocate space for the wide char strings */
  14920. v2 = libc.UintptrFromInt32(0)
  14921. extra = v2
  14922. v1 = v2
  14923. pdst = v1
  14924. psrc = v1
  14925. mdst = libc.UintptrFromInt32(0)
  14926. v3 = libc.Xcalloc(tls, libc.Uint64FromInt64(mbslength+int64(1)), uint64(4))
  14927. psrc = v3
  14928. if v3 == libc.UintptrFromInt32(0) {
  14929. return -int32(1)
  14930. }
  14931. v4 = libc.Xcalloc(tls, libc.Uint64FromInt64(int64(16)*mbslength+int64(1)), uint64(4))
  14932. pdst = v4
  14933. if v4 == libc.UintptrFromInt32(0) {
  14934. goto out
  14935. }
  14936. if *(*uintptr)(unsafe.Pointer(mbdstp)) == libc.UintptrFromInt32(0) {
  14937. v5 = libc.Xcalloc(tls, libc.Uint64FromInt64(int64(16)*mbslength+int64(1)), uint64(1))
  14938. mdst = v5
  14939. if v5 == libc.UintptrFromInt32(0) {
  14940. goto out
  14941. }
  14942. *(*uintptr)(unsafe.Pointer(mbdstp)) = mdst
  14943. }
  14944. mbdst = *(*uintptr)(unsafe.Pointer(mbdstp))
  14945. dst = pdst
  14946. src = psrc
  14947. if flags&int32(m_VIS_NOLOCALE1) != 0 {
  14948. /* Do one byte at a time conversion */
  14949. cerr = int32(1)
  14950. } else {
  14951. /* Use caller's multibyte conversion error flag. */
  14952. if cerr_ptr != 0 {
  14953. v6 = *(*int32)(unsafe.Pointer(cerr_ptr))
  14954. } else {
  14955. v6 = 0
  14956. }
  14957. cerr = v6
  14958. }
  14959. /*
  14960. * Input loop.
  14961. * Handle up to mblength characters (not bytes). We do not
  14962. * stop at NULs because we may be processing a block of data
  14963. * that includes NULs.
  14964. */
  14965. for mbslength > 0 {
  14966. /* Convert one multibyte character to wchar_t. */
  14967. if !(cerr != 0) {
  14968. clen = libc.Xmbtowc(tls, src, mbsrc, uint64(m_MB_LEN_MAX))
  14969. }
  14970. if cerr != 0 || clen < 0 {
  14971. /* Conversion error, process as a byte instead. */
  14972. *(*Twchar_t)(unsafe.Pointer(src)) = libc.Int32FromUint32(uint32(*(*uint8)(unsafe.Pointer(mbsrc))))
  14973. clen = int32(1)
  14974. cerr = int32(1)
  14975. }
  14976. if clen == 0 {
  14977. /*
  14978. * NUL in input gives 0 return value. process
  14979. * as single NUL byte and keep going.
  14980. */
  14981. clen = int32(1)
  14982. }
  14983. /* Advance buffer character pointer. */
  14984. src += 4
  14985. /* Advance input pointer by number of bytes read. */
  14986. mbsrc += uintptr(clen)
  14987. /* Decrement input byte count. */
  14988. mbslength -= int64(clen)
  14989. }
  14990. len1 = libc.Uint64FromInt64((int64(src) - int64(psrc)) / 4)
  14991. src = psrc
  14992. /*
  14993. * In the single character input case, we will have actually
  14994. * processed two characters, c and nextc. Reset len back to
  14995. * just a single character.
  14996. */
  14997. if mblength < len1 {
  14998. len1 = mblength
  14999. }
  15000. /* Convert extra argument to list of characters for this mode. */
  15001. extra = _makeextralist(tls, flags, mbextra)
  15002. if !(extra != 0) {
  15003. if dlen != 0 && *(*Tsize_t)(unsafe.Pointer(dlen)) == uint64(0) {
  15004. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  15005. goto out
  15006. }
  15007. *(*uint8)(unsafe.Pointer(mbdst)) = uint8('\000') /* can't create extra, return "" */
  15008. error1 = 0
  15009. goto out
  15010. }
  15011. /* Look up which processing function to call. */
  15012. f = _getvisfun(tls, flags)
  15013. /*
  15014. * Main processing loop.
  15015. * Call do_Xvis processing function one character at a time
  15016. * with next character available for look-ahead.
  15017. */
  15018. start = dst
  15019. for {
  15020. if !(len1 > uint64(0)) {
  15021. break
  15022. }
  15023. v8 = src
  15024. src += 4
  15025. c = libc.Uint32FromInt32(*(*Twchar_t)(unsafe.Pointer(v8)))
  15026. 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)
  15027. if dst == libc.UintptrFromInt32(0) {
  15028. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  15029. goto out
  15030. }
  15031. goto _7
  15032. _7:
  15033. ;
  15034. len1--
  15035. }
  15036. /* Terminate the string in the buffer. */
  15037. *(*Twchar_t)(unsafe.Pointer(dst)) = int32('\000')
  15038. /*
  15039. * Output loop.
  15040. * Convert wchar_t string back to multibyte output string.
  15041. * If we have hit a multi-byte conversion error on input,
  15042. * output byte-by-byte here. Else use wctomb().
  15043. */
  15044. len1 = libc.Xwcslen(tls, start)
  15045. if dlen != 0 {
  15046. v9 = *(*Tsize_t)(unsafe.Pointer(dlen))
  15047. } else {
  15048. v9 = libc.Xwcslen(tls, start)*uint64(m_MB_LEN_MAX) + uint64(1)
  15049. }
  15050. maxolen = libc.Int64FromUint64(v9)
  15051. olen = uint64(0)
  15052. dst = start
  15053. for {
  15054. if !(len1 > uint64(0)) {
  15055. break
  15056. }
  15057. if !(cerr != 0) {
  15058. clen = libc.Xwctomb(tls, mbdst, *(*Twchar_t)(unsafe.Pointer(dst)))
  15059. }
  15060. if cerr != 0 || clen < 0 {
  15061. /*
  15062. * Conversion error, process as a byte(s) instead.
  15063. * Examine each byte and higher-order bytes for
  15064. * data. E.g.,
  15065. * 0x000000000000a264 -> a2 64
  15066. * 0x000000001f00a264 -> 1f 00 a2 64
  15067. */
  15068. clen = 0
  15069. wmsk = uint64(0)
  15070. i = libc.Int32FromUint64(libc.Uint64FromInt64(8) - libc.Uint64FromInt32(1))
  15071. for {
  15072. if !(i >= 0) {
  15073. break
  15074. }
  15075. shft = i * int32(m_CHAR_BIT)
  15076. bmsk = libc.Uint64FromInt64(0xff) << shft
  15077. wmsk |= bmsk
  15078. if libc.Uint64FromInt32(*(*Twchar_t)(unsafe.Pointer(dst)))&wmsk != 0 || i == 0 {
  15079. v12 = clen
  15080. clen++
  15081. *(*uint8)(unsafe.Pointer(mbdst + uintptr(v12))) = uint8(libc.Uint64FromInt32(*(*Twchar_t)(unsafe.Pointer(dst))) & bmsk >> shft)
  15082. }
  15083. goto _11
  15084. _11:
  15085. ;
  15086. i--
  15087. }
  15088. cerr = int32(1)
  15089. }
  15090. /* If this character would exceed our output limit, stop. */
  15091. if olen+libc.Uint64FromInt32(clen) > libc.Uint64FromInt64(maxolen) {
  15092. break
  15093. }
  15094. /* Advance output pointer by number of bytes written. */
  15095. mbdst += uintptr(clen)
  15096. /* Advance buffer character pointer. */
  15097. dst += 4
  15098. /* Incrment output character count. */
  15099. olen += libc.Uint64FromInt32(clen)
  15100. goto _10
  15101. _10:
  15102. ;
  15103. len1--
  15104. }
  15105. /* Terminate the output string. */
  15106. *(*uint8)(unsafe.Pointer(mbdst)) = uint8('\000')
  15107. if flags&int32(m_VIS_NOLOCALE1) != 0 {
  15108. /* Pass conversion error flag out. */
  15109. if cerr_ptr != 0 {
  15110. *(*int32)(unsafe.Pointer(cerr_ptr)) = cerr
  15111. }
  15112. }
  15113. libc.Xfree(tls, extra)
  15114. libc.Xfree(tls, pdst)
  15115. libc.Xfree(tls, psrc)
  15116. return libc.Int32FromUint64(olen)
  15117. goto out
  15118. out:
  15119. ;
  15120. libc.Xfree(tls, extra)
  15121. libc.Xfree(tls, pdst)
  15122. libc.Xfree(tls, psrc)
  15123. libc.Xfree(tls, mdst)
  15124. return error1
  15125. }
  15126. func _istrsenvisxna(tls *libc.TLS, _mbdst uintptr, dlen uintptr, mbsrc uintptr, mblength Tsize_t, flags int32, mbextra uintptr, cerr_ptr uintptr) (r int32) {
  15127. bp := tls.Alloc(16)
  15128. defer tls.Free(16)
  15129. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  15130. return _istrsenvisx(tls, bp, dlen, mbsrc, mblength, flags, mbextra, cerr_ptr)
  15131. }
  15132. func _istrsenvisxl(tls *libc.TLS, mbdst uintptr, dlen uintptr, mbsrc uintptr, flags int32, mbextra uintptr, cerr_ptr uintptr) (r int32) {
  15133. var v1 uint64
  15134. _ = v1
  15135. if mbsrc != libc.UintptrFromInt32(0) {
  15136. v1 = libc.Xstrlen(tls, mbsrc)
  15137. } else {
  15138. v1 = uint64(0)
  15139. }
  15140. return _istrsenvisxna(tls, mbdst, dlen, mbsrc, v1, flags, mbextra, cerr_ptr)
  15141. }
  15142. /*
  15143. * The "svis" variants all take an "extra" arg that is a pointer
  15144. * to a NUL-terminated list of characters to be encoded, too.
  15145. * These functions are useful e. g. to encode strings in such a
  15146. * way so that they are not interpreted by a shell.
  15147. */
  15148. func Xsvis(tls *libc.TLS, _mbdst uintptr, c int32, flags int32, nextc int32, mbextra uintptr) (r uintptr) {
  15149. bp := tls.Alloc(16)
  15150. defer tls.Free(16)
  15151. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  15152. var ret int32
  15153. var _ /* cc at bp+8 */ [2]uint8
  15154. _ = ret
  15155. (*(*[2]uint8)(unsafe.Pointer(bp + 8)))[0] = libc.Uint8FromInt32(c)
  15156. (*(*[2]uint8)(unsafe.Pointer(bp + 8)))[int32(1)] = libc.Uint8FromInt32(nextc)
  15157. ret = _istrsenvisx(tls, bp, libc.UintptrFromInt32(0), bp+8, uint64(1), flags, mbextra, libc.UintptrFromInt32(0))
  15158. if ret < 0 {
  15159. return libc.UintptrFromInt32(0)
  15160. }
  15161. return *(*uintptr)(unsafe.Pointer(bp)) + uintptr(ret)
  15162. }
  15163. func Xsnvis(tls *libc.TLS, _mbdst uintptr, _dlen Tsize_t, c int32, flags int32, nextc int32, mbextra uintptr) (r uintptr) {
  15164. bp := tls.Alloc(32)
  15165. defer tls.Free(32)
  15166. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  15167. *(*Tsize_t)(unsafe.Pointer(bp + 8)) = _dlen
  15168. var ret int32
  15169. var _ /* cc at bp+16 */ [2]uint8
  15170. _ = ret
  15171. (*(*[2]uint8)(unsafe.Pointer(bp + 16)))[0] = libc.Uint8FromInt32(c)
  15172. (*(*[2]uint8)(unsafe.Pointer(bp + 16)))[int32(1)] = libc.Uint8FromInt32(nextc)
  15173. ret = _istrsenvisx(tls, bp, bp+8, bp+16, uint64(1), flags, mbextra, libc.UintptrFromInt32(0))
  15174. if ret < 0 {
  15175. return libc.UintptrFromInt32(0)
  15176. }
  15177. return *(*uintptr)(unsafe.Pointer(bp)) + uintptr(ret)
  15178. }
  15179. func Xstrsvis(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, flags int32, mbextra uintptr) (r int32) {
  15180. return _istrsenvisxl(tls, mbdst, libc.UintptrFromInt32(0), mbsrc, flags, mbextra, libc.UintptrFromInt32(0))
  15181. }
  15182. func Xstrsnvis(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, flags int32, mbextra uintptr) (r int32) {
  15183. bp := tls.Alloc(16)
  15184. defer tls.Free(16)
  15185. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15186. return _istrsenvisxl(tls, mbdst, bp, mbsrc, flags, mbextra, libc.UintptrFromInt32(0))
  15187. }
  15188. func Xstrsvisx(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, len1 Tsize_t, flags int32, mbextra uintptr) (r int32) {
  15189. return _istrsenvisxna(tls, mbdst, libc.UintptrFromInt32(0), mbsrc, len1, flags, mbextra, libc.UintptrFromInt32(0))
  15190. }
  15191. func Xstrsnvisx(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, len1 Tsize_t, flags int32, mbextra uintptr) (r int32) {
  15192. bp := tls.Alloc(16)
  15193. defer tls.Free(16)
  15194. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15195. return _istrsenvisxna(tls, mbdst, bp, mbsrc, len1, flags, mbextra, libc.UintptrFromInt32(0))
  15196. }
  15197. func Xstrsenvisx(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, len1 Tsize_t, flags int32, mbextra uintptr, cerr_ptr uintptr) (r int32) {
  15198. bp := tls.Alloc(16)
  15199. defer tls.Free(16)
  15200. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15201. return _istrsenvisxna(tls, mbdst, bp, mbsrc, len1, flags, mbextra, cerr_ptr)
  15202. }
  15203. // C documentation
  15204. //
  15205. // /*
  15206. // * vis - visually encode characters
  15207. // */
  15208. func Xvis(tls *libc.TLS, _mbdst uintptr, c int32, flags int32, nextc int32) (r uintptr) {
  15209. bp := tls.Alloc(16)
  15210. defer tls.Free(16)
  15211. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  15212. var ret int32
  15213. var _ /* cc at bp+8 */ [2]uint8
  15214. _ = ret
  15215. (*(*[2]uint8)(unsafe.Pointer(bp + 8)))[0] = libc.Uint8FromInt32(c)
  15216. (*(*[2]uint8)(unsafe.Pointer(bp + 8)))[int32(1)] = libc.Uint8FromInt32(nextc)
  15217. ret = _istrsenvisx(tls, bp, libc.UintptrFromInt32(0), bp+8, uint64(1), flags, __ccgo_ts+60, libc.UintptrFromInt32(0))
  15218. if ret < 0 {
  15219. return libc.UintptrFromInt32(0)
  15220. }
  15221. return *(*uintptr)(unsafe.Pointer(bp)) + uintptr(ret)
  15222. }
  15223. func Xnvis(tls *libc.TLS, _mbdst uintptr, _dlen Tsize_t, c int32, flags int32, nextc int32) (r uintptr) {
  15224. bp := tls.Alloc(32)
  15225. defer tls.Free(32)
  15226. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  15227. *(*Tsize_t)(unsafe.Pointer(bp + 8)) = _dlen
  15228. var ret int32
  15229. var _ /* cc at bp+16 */ [2]uint8
  15230. _ = ret
  15231. (*(*[2]uint8)(unsafe.Pointer(bp + 16)))[0] = libc.Uint8FromInt32(c)
  15232. (*(*[2]uint8)(unsafe.Pointer(bp + 16)))[int32(1)] = libc.Uint8FromInt32(nextc)
  15233. ret = _istrsenvisx(tls, bp, bp+8, bp+16, uint64(1), flags, __ccgo_ts+60, libc.UintptrFromInt32(0))
  15234. if ret < 0 {
  15235. return libc.UintptrFromInt32(0)
  15236. }
  15237. return *(*uintptr)(unsafe.Pointer(bp)) + uintptr(ret)
  15238. }
  15239. /*
  15240. * strvis - visually encode characters from src into dst
  15241. *
  15242. * Dst must be 4 times the size of src to account for possible
  15243. * expansion. The length of dst, not including the trailing NULL,
  15244. * is returned.
  15245. */
  15246. func Xstrvis(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, flags int32) (r int32) {
  15247. return _istrsenvisxl(tls, mbdst, libc.UintptrFromInt32(0), mbsrc, flags, __ccgo_ts+60, libc.UintptrFromInt32(0))
  15248. }
  15249. func Xstrnvis_openbsd(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, _dlen Tsize_t, flags int32) (r int32) {
  15250. bp := tls.Alloc(16)
  15251. defer tls.Free(16)
  15252. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15253. return _istrsenvisxl(tls, mbdst, bp, mbsrc, flags, __ccgo_ts+60, libc.UintptrFromInt32(0))
  15254. }
  15255. func Xstrnvis_netbsd(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, flags int32) (r int32) {
  15256. bp := tls.Alloc(16)
  15257. defer tls.Free(16)
  15258. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15259. return _istrsenvisxl(tls, mbdst, bp, mbsrc, flags, __ccgo_ts+60, libc.UintptrFromInt32(0))
  15260. }
  15261. func Xstravis(tls *libc.TLS, mbdstp uintptr, mbsrc uintptr, flags int32) (r int32) {
  15262. var v1 uint64
  15263. _ = v1
  15264. *(*uintptr)(unsafe.Pointer(mbdstp)) = libc.UintptrFromInt32(0)
  15265. if mbsrc != libc.UintptrFromInt32(0) {
  15266. v1 = libc.Xstrlen(tls, mbsrc)
  15267. } else {
  15268. v1 = uint64(0)
  15269. }
  15270. return _istrsenvisx(tls, mbdstp, libc.UintptrFromInt32(0), mbsrc, v1, flags, __ccgo_ts+60, libc.UintptrFromInt32(0))
  15271. }
  15272. /*
  15273. * strvisx - visually encode characters from src into dst
  15274. *
  15275. * Dst must be 4 times the size of src to account for possible
  15276. * expansion. The length of dst, not including the trailing NULL,
  15277. * is returned.
  15278. *
  15279. * Strvisx encodes exactly len characters from src into dst.
  15280. * This is useful for encoding a block of data.
  15281. */
  15282. func Xstrvisx(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, len1 Tsize_t, flags int32) (r int32) {
  15283. return _istrsenvisxna(tls, mbdst, libc.UintptrFromInt32(0), mbsrc, len1, flags, __ccgo_ts+60, libc.UintptrFromInt32(0))
  15284. }
  15285. func Xstrnvisx(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, len1 Tsize_t, flags int32) (r int32) {
  15286. bp := tls.Alloc(16)
  15287. defer tls.Free(16)
  15288. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15289. return _istrsenvisxna(tls, mbdst, bp, mbsrc, len1, flags, __ccgo_ts+60, libc.UintptrFromInt32(0))
  15290. }
  15291. func Xstrenvisx(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, len1 Tsize_t, flags int32, cerr_ptr uintptr) (r int32) {
  15292. bp := tls.Alloc(16)
  15293. defer tls.Free(16)
  15294. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15295. return _istrsenvisxna(tls, mbdst, bp, mbsrc, len1, flags, __ccgo_ts+60, cerr_ptr)
  15296. }
  15297. // C documentation
  15298. //
  15299. // /*
  15300. // * Appends src to string dst of size siz (unlike wcsncat, siz is the
  15301. // * full size of dst, not space left). At most siz-1 characters
  15302. // * will be copied. Always NUL terminates (unless siz == 0).
  15303. // * Returns wcslen(initial dst) + wcslen(src); if retval >= siz,
  15304. // * truncation occurred.
  15305. // */
  15306. func Xwcslcat(tls *libc.TLS, dst uintptr, src uintptr, siz Tsize_t) (r Tsize_t) {
  15307. var d, s, v3 uintptr
  15308. var dlen, n, v1 Tsize_t
  15309. var v2 bool
  15310. _, _, _, _, _, _, _ = d, dlen, n, s, v1, v2, v3
  15311. d = dst
  15312. s = src
  15313. n = siz
  15314. /* Find the end of dst and adjust bytes left but don't go past end */
  15315. for {
  15316. if v2 = *(*Twchar_t)(unsafe.Pointer(d)) != int32('\000'); v2 {
  15317. v1 = n
  15318. n--
  15319. }
  15320. if !(v2 && v1 != uint64(0)) {
  15321. break
  15322. }
  15323. d += 4
  15324. }
  15325. dlen = libc.Uint64FromInt64((int64(d) - int64(dst)) / 4)
  15326. n = siz - dlen
  15327. if n == uint64(0) {
  15328. return dlen + libc.Xwcslen(tls, s)
  15329. }
  15330. for *(*Twchar_t)(unsafe.Pointer(s)) != int32('\000') {
  15331. if n != uint64(1) {
  15332. v3 = d
  15333. d += 4
  15334. *(*Twchar_t)(unsafe.Pointer(v3)) = *(*Twchar_t)(unsafe.Pointer(s))
  15335. n--
  15336. }
  15337. s += 4
  15338. }
  15339. *(*Twchar_t)(unsafe.Pointer(d)) = int32('\000')
  15340. return dlen + libc.Uint64FromInt64((int64(s)-int64(src))/4) /* count does not include NUL */
  15341. }
  15342. // C documentation
  15343. //
  15344. // /*
  15345. // * Copy src to string dst of size siz. At most siz-1 characters
  15346. // * will be copied. Always NUL terminates (unless siz == 0).
  15347. // * Returns wcslen(src); if retval >= siz, truncation occurred.
  15348. // */
  15349. func Xwcslcpy(tls *libc.TLS, dst uintptr, src uintptr, siz Tsize_t) (r Tsize_t) {
  15350. var d, s, v6, v7, v8 uintptr
  15351. var n, v1, v3 Tsize_t
  15352. var v2 bool
  15353. var v5 Twchar_t
  15354. _, _, _, _, _, _, _, _, _, _ = d, n, s, v1, v2, v3, v5, v6, v7, v8
  15355. d = dst
  15356. s = src
  15357. n = siz
  15358. /* Copy as many bytes as will fit */
  15359. if v2 = n != uint64(0); v2 {
  15360. n--
  15361. v1 = n
  15362. }
  15363. if v2 && v1 != uint64(0) {
  15364. for {
  15365. v6 = s
  15366. s += 4
  15367. v5 = *(*Twchar_t)(unsafe.Pointer(v6))
  15368. v7 = d
  15369. d += 4
  15370. *(*Twchar_t)(unsafe.Pointer(v7)) = v5
  15371. if v5 == 0 {
  15372. break
  15373. }
  15374. goto _4
  15375. _4:
  15376. ;
  15377. n--
  15378. v3 = n
  15379. if !(v3 != uint64(0)) {
  15380. break
  15381. }
  15382. }
  15383. }
  15384. /* Not enough room in dst, add NUL and traverse rest of src */
  15385. if n == uint64(0) {
  15386. if siz != uint64(0) {
  15387. *(*Twchar_t)(unsafe.Pointer(d)) = int32('\000')
  15388. } /* NUL-terminate dst */
  15389. for {
  15390. v8 = s
  15391. s += 4
  15392. if !(*(*Twchar_t)(unsafe.Pointer(v8)) != 0) {
  15393. break
  15394. }
  15395. }
  15396. }
  15397. return libc.Uint64FromInt64((int64(s)-int64(src))/4 - libc.Int64FromInt32(1)) /* count does not include NUL */
  15398. }
  15399. func __ccgo_fp(f interface{}) uintptr {
  15400. type iface [2]uintptr
  15401. return (*iface)(unsafe.Pointer(&f))[1]
  15402. }
  15403. var Xoptreset int32
  15404. var __ccgo_ts = (*reflect.StringHeader)(unsafe.Pointer(&__ccgo_ts1)).Data
  15405. 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"