ccgo_linux_riscv64.go 484 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893
  1. // Code generated for linux/riscv64 by 'gcc -no-main-minimize --prefix-enumerator=_ --prefix-external=x_ --prefix-field=F --prefix-macro=m_ --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-enum=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -extended-errors -ignore-link-errors -ignore-unsupported-alignment -ignore-link-errors -I /home/jnml/src/modernc.org/builder/.exclude/modernc.org/libc/include/linux/riscv64 -I /home/jnml/src/modernc.org/builder/.exclude/modernc.org/limd/include/linux/riscv64 -shared -DPIC .libs/setmode.o.go .libs/arc4random.o.go .libs/arc4random_uniform.o.go .libs/bsd_getopt.o.go .libs/closefrom.o.go .libs/errc.o.go .libs/expand_number.o.go .libs/explicit_bzero.o.go .libs/fgetln.o.go .libs/fgetwln.o.go .libs/fparseln.o.go .libs/flopen.o.go .libs/fmtcheck.o.go .libs/fpurge.o.go .libs/freezero.o.go .libs/funopen.o.go .libs/getbsize.o.go .libs/getpeereid.o.go .libs/dehumanize_number.o.go .libs/humanize_number.o.go .libs/inet_net_pton.o.go .libs/md5.o.go .libs/nlist.o.go .libs/pidfile.o.go .libs/setproctitle.o.go .libs/progname.o.go .libs/pwcache.o.go .libs/readpassphrase.o.go .libs/reallocarray.o.go .libs/reallocf.o.go .libs/recallocarray.o.go .libs/heapsort.o.go .libs/merge.o.go .libs/radixsort.o.go .libs/stringlist.o.go .libs/strlcat.o.go .libs/strlcpy.o.go .libs/strmode.o.go .libs/strnstr.o.go .libs/strtonum.o.go .libs/strtoi.o.go .libs/strtou.o.go .libs/timeconv.o.go .libs/unvis.o.go .libs/vis.o.go .libs/wcslcat.o.go .libs/wcslcpy.o.go -lmd -o .libs/libbsd.so.0.12.2.go', DO NOT EDIT.
  2. //go:build linux && riscv64
  3. package libbsd
  4. import (
  5. "reflect"
  6. "unsafe"
  7. "modernc.org/libc"
  8. "modernc.org/libmd"
  9. )
  10. var _ reflect.Type
  11. var _ unsafe.Pointer
  12. const m_ARG_MAX = 131072
  13. const m_BC_BASE_MAX = 99
  14. const m_BC_DIM_MAX = 2048
  15. const m_BC_SCALE_MAX = 99
  16. const m_BC_STRING_MAX = 1000
  17. const m_BIG_ENDIAN = "__BIG_ENDIAN"
  18. const m_BUFSIZ = 1024
  19. const m_BUS_ADRALN = 1
  20. const m_BUS_ADRERR = 2
  21. const m_BUS_MCEERR_AO = 5
  22. const m_BUS_MCEERR_AR = 4
  23. const m_BUS_OBJERR = 3
  24. const m_BYTE_ORDER = "__BYTE_ORDER"
  25. const m_CHARCLASS_NAME_MAX = 14
  26. const m_CHAR_BIT = 8
  27. const m_CHAR_MAX = 255
  28. const m_CHAR_MIN = 0
  29. const m_CLD_CONTINUED = 6
  30. const m_CLD_DUMPED = 3
  31. const m_CLD_EXITED = 1
  32. const m_CLD_KILLED = 2
  33. const m_CLD_STOPPED = 5
  34. const m_CLD_TRAPPED = 4
  35. const m_CMD2_CLR = 1
  36. const m_CMD2_GBITS = 4
  37. const m_CMD2_OBITS = 8
  38. const m_CMD2_SET = 2
  39. const m_CMD2_UBITS = 16
  40. const m_COLL_WEIGHTS_MAX = 2
  41. const m_DELAYTIMER_MAX = 0x7fffffff
  42. const m_E2BIG = 7
  43. const m_EACCES = 13
  44. const m_EADDRINUSE = 98
  45. const m_EADDRNOTAVAIL = 99
  46. const m_EADV = 68
  47. const m_EAFNOSUPPORT = 97
  48. const m_EAGAIN = 11
  49. const m_EALREADY = 114
  50. const m_EBADE = 52
  51. const m_EBADF = 9
  52. const m_EBADFD = 77
  53. const m_EBADMSG = 74
  54. const m_EBADR = 53
  55. const m_EBADRQC = 56
  56. const m_EBADSLT = 57
  57. const m_EBFONT = 59
  58. const m_EBUSY = 16
  59. const m_ECANCELED = 125
  60. const m_ECHILD = 10
  61. const m_ECHRNG = 44
  62. const m_ECOMM = 70
  63. const m_ECONNABORTED = 103
  64. const m_ECONNREFUSED = 111
  65. const m_ECONNRESET = 104
  66. const m_EDEADLK = 35
  67. const m_EDEADLOCK = "EDEADLK"
  68. const m_EDESTADDRREQ = 89
  69. const m_EDOM = 33
  70. const m_EDOTDOT = 73
  71. const m_EDQUOT = 122
  72. const m_EEXIST = 17
  73. const m_EFAULT = 14
  74. const m_EFBIG = 27
  75. const m_EHOSTDOWN = 112
  76. const m_EHOSTUNREACH = 113
  77. const m_EHWPOISON = 133
  78. const m_EIDRM = 43
  79. const m_EILSEQ = 84
  80. const m_EINPROGRESS = 115
  81. const m_EINTR = 4
  82. const m_EINVAL = 22
  83. const m_EIO = 5
  84. const m_EISCONN = 106
  85. const m_EISDIR = 21
  86. const m_EISNAM = 120
  87. const m_EKEYEXPIRED = 127
  88. const m_EKEYREJECTED = 129
  89. const m_EKEYREVOKED = 128
  90. const m_EL2HLT = 51
  91. const m_EL2NSYNC = 45
  92. const m_EL3HLT = 46
  93. const m_EL3RST = 47
  94. const m_ELIBACC = 79
  95. const m_ELIBBAD = 80
  96. const m_ELIBEXEC = 83
  97. const m_ELIBMAX = 82
  98. const m_ELIBSCN = 81
  99. const m_ELNRNG = 48
  100. const m_ELOOP = 40
  101. const m_EMEDIUMTYPE = 124
  102. const m_EMFILE = 24
  103. const m_EMLINK = 31
  104. const m_EMSGSIZE = 90
  105. const m_EMULTIHOP = 72
  106. const m_ENAMETOOLONG = 36
  107. const m_ENAVAIL = 119
  108. const m_ENETDOWN = 100
  109. const m_ENETRESET = 102
  110. const m_ENETUNREACH = 101
  111. const m_ENFILE = 23
  112. const m_ENOANO = 55
  113. const m_ENOBUFS = 105
  114. const m_ENOCSI = 50
  115. const m_ENODATA = 61
  116. const m_ENODEV = 19
  117. const m_ENOENT = 2
  118. const m_ENOEXEC = 8
  119. const m_ENOKEY = 126
  120. const m_ENOLCK = 37
  121. const m_ENOLINK = 67
  122. const m_ENOMEDIUM = 123
  123. const m_ENOMEM = 12
  124. const m_ENOMSG = 42
  125. const m_ENONET = 64
  126. const m_ENOPKG = 65
  127. const m_ENOPROTOOPT = 92
  128. const m_ENOSPC = 28
  129. const m_ENOSR = 63
  130. const m_ENOSTR = 60
  131. const m_ENOSYS = 38
  132. const m_ENOTBLK = 15
  133. const m_ENOTCONN = 107
  134. const m_ENOTDIR = 20
  135. const m_ENOTEMPTY = 39
  136. const m_ENOTNAM = 118
  137. const m_ENOTRECOVERABLE = 131
  138. const m_ENOTSOCK = 88
  139. const m_ENOTSUP = "EOPNOTSUPP"
  140. const m_ENOTTY = 25
  141. const m_ENOTUNIQ = 76
  142. const m_ENXIO = 6
  143. const m_EOPNOTSUPP = 95
  144. const m_EOVERFLOW = 75
  145. const m_EOWNERDEAD = 130
  146. const m_EPERM = 1
  147. const m_EPFNOSUPPORT = 96
  148. const m_EPIPE = 32
  149. const m_EPROTO = 71
  150. const m_EPROTONOSUPPORT = 93
  151. const m_EPROTOTYPE = 91
  152. const m_ERANGE = 34
  153. const m_EREMCHG = 78
  154. const m_EREMOTE = 66
  155. const m_EREMOTEIO = 121
  156. const m_ERESTART = 85
  157. const m_ERFKILL = 132
  158. const m_EROFS = 30
  159. const m_ESHUTDOWN = 108
  160. const m_ESOCKTNOSUPPORT = 94
  161. const m_ESPIPE = 29
  162. const m_ESRCH = 3
  163. const m_ESRMNT = 69
  164. const m_ESTALE = 116
  165. const m_ESTRPIPE = 86
  166. const m_ETIME = 62
  167. const m_ETIMEDOUT = 110
  168. const m_ETOOMANYREFS = 109
  169. const m_ETXTBSY = 26
  170. const m_EUCLEAN = 117
  171. const m_EUNATCH = 49
  172. const m_EUSERS = 87
  173. const m_EWOULDBLOCK = "EAGAIN"
  174. const m_EXDEV = 18
  175. const m_EXFULL = 54
  176. const m_EXIT_FAILURE = 1
  177. const m_EXIT_SUCCESS = 0
  178. const m_EXPR_NEST_MAX = 32
  179. const m_FD_SETSIZE = 1024
  180. const m_FILENAME_MAX = 4096
  181. const m_FILESIZEBITS = 64
  182. const m_FOPEN_MAX = 1000
  183. const m_FPARSELN_UNESCALL = 0x0f
  184. const m_FPARSELN_UNESCCOMM = 0x04
  185. const m_FPARSELN_UNESCCONT = 0x02
  186. const m_FPARSELN_UNESCESC = 0x01
  187. const m_FPARSELN_UNESCREST = 0x08
  188. const m_FPE_FLTDIV = 3
  189. const m_FPE_FLTINV = 7
  190. const m_FPE_FLTOVF = 4
  191. const m_FPE_FLTRES = 6
  192. const m_FPE_FLTSUB = 8
  193. const m_FPE_FLTUND = 5
  194. const m_FPE_INTDIV = 1
  195. const m_FPE_INTOVF = 2
  196. const m_F_LOCK = 1
  197. const m_F_OK = 0
  198. const m_F_TEST = 3
  199. const m_F_TLOCK = 2
  200. const m_F_ULOCK = 0
  201. const m_HAVE_ASPRINTF = 1
  202. const m_HAVE_CLEARENV = 1
  203. const m_HAVE_CONFIG_H = 1
  204. const m_HAVE_DECL_ENVIRON = 1
  205. const m_HAVE_DIRENT_H = 1
  206. const m_HAVE_DIRFD = 1
  207. const m_HAVE_DLFCN_H = 1
  208. const m_HAVE_FLOCK = 1
  209. const m_HAVE_FOPENCOOKIE = 1
  210. const m_HAVE_GETAUXVAL = 1
  211. const m_HAVE_GETENTROPY = 1
  212. const m_HAVE_GETLINE = 1
  213. const m_HAVE_GRP_H = 1
  214. const m_HAVE_INTTYPES_H = 1
  215. const m_HAVE_OPEN_MEMSTREAM = 1
  216. const m_HAVE_PROGRAM_INVOCATION_SHORT_NAME = 1
  217. const m_HAVE_PWD_H = 1
  218. const m_HAVE_STDINT_H = 1
  219. const m_HAVE_STDIO_EXT_H = 1
  220. const m_HAVE_STDIO_H = 1
  221. const m_HAVE_STDLIB_H = 1
  222. const m_HAVE_STRINGS_H = 1
  223. const m_HAVE_STRING_H = 1
  224. const m_HAVE_SYSCONF = 1
  225. const m_HAVE_SYS_DIR_H = 1
  226. const m_HAVE_SYS_STAT_H = 1
  227. const m_HAVE_SYS_TYPES_H = 1
  228. const m_HAVE_TYPEOF = 1
  229. const m_HAVE_UNISTD_H = 1
  230. const m_HAVE_VASPRINTF = 1
  231. const m_HAVE_WCHAR_H = 1
  232. const m_HAVE___FPURGE = 1
  233. const m_HAVE___PROGNAME = 1
  234. const m_HN_AUTOSCALE = 0x20
  235. const m_HN_B = 0x04
  236. const m_HN_DECIMAL = 0x01
  237. const m_HN_DIVISOR_1000 = 0x08
  238. const m_HN_GETSCALE = 0x10
  239. const m_HN_IEC_PREFIXES = 0x10
  240. const m_HN_NOSPACE = 0x02
  241. const m_HOST_NAME_MAX = 255
  242. const m_ILL_BADSTK = 8
  243. const m_ILL_COPROC = 7
  244. const m_ILL_ILLADR = 3
  245. const m_ILL_ILLOPC = 1
  246. const m_ILL_ILLOPN = 2
  247. const m_ILL_ILLTRP = 4
  248. const m_ILL_PRVOPC = 5
  249. const m_ILL_PRVREG = 6
  250. const m_INT16_MAX = 0x7fff
  251. const m_INT32_MAX = 0x7fffffff
  252. const m_INT64_MAX = 0x7fffffffffffffff
  253. const m_INT8_MAX = 0x7f
  254. const m_INTMAX_MAX = "INT64_MAX"
  255. const m_INTMAX_MIN = "INT64_MIN"
  256. const m_INTPTR_MAX = "INT64_MAX"
  257. const m_INTPTR_MIN = "INT64_MIN"
  258. const m_INT_FAST16_MAX = "INT32_MAX"
  259. const m_INT_FAST16_MIN = "INT32_MIN"
  260. const m_INT_FAST32_MAX = "INT32_MAX"
  261. const m_INT_FAST32_MIN = "INT32_MIN"
  262. const m_INT_FAST64_MAX = "INT64_MAX"
  263. const m_INT_FAST64_MIN = "INT64_MIN"
  264. const m_INT_FAST8_MAX = "INT8_MAX"
  265. const m_INT_FAST8_MIN = "INT8_MIN"
  266. const m_INT_LEAST16_MAX = "INT16_MAX"
  267. const m_INT_LEAST16_MIN = "INT16_MIN"
  268. const m_INT_LEAST32_MAX = "INT32_MAX"
  269. const m_INT_LEAST32_MIN = "INT32_MIN"
  270. const m_INT_LEAST64_MAX = "INT64_MAX"
  271. const m_INT_LEAST64_MIN = "INT64_MIN"
  272. const m_INT_LEAST8_MAX = "INT8_MAX"
  273. const m_INT_LEAST8_MIN = "INT8_MIN"
  274. const m_INT_MAX = 0x7fffffff
  275. const m_IOV_MAX = 1024
  276. const m_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_ERR_H = 1
  285. const m_LIBBSD_ABI_EXPAND_NUMBER = 1
  286. const m_LIBBSD_ABI_EXPLICIT_BZERO = 1
  287. const m_LIBBSD_ABI_FGETLN = 1
  288. const m_LIBBSD_ABI_FLOPEN = 1
  289. const m_LIBBSD_ABI_FMTCHECK = 1
  290. const m_LIBBSD_ABI_FPURGE = 1
  291. const m_LIBBSD_ABI_FREEZERO = 1
  292. const m_LIBBSD_ABI_FUNOPEN = 1
  293. const m_LIBBSD_ABI_GETBSIZE = 1
  294. const m_LIBBSD_ABI_GETPEEREID = 1
  295. const m_LIBBSD_ABI_HUMANIZE_NUMBER = 1
  296. const m_LIBBSD_ABI_ID_FROM_NAME = 1
  297. const m_LIBBSD_ABI_INET_NET_PTON = 1
  298. const m_LIBBSD_ABI_MD5 = 1
  299. const m_LIBBSD_ABI_NAME_FROM_ID = 1
  300. const m_LIBBSD_ABI_NLIST = 1
  301. const m_LIBBSD_ABI_PIDFILE = 1
  302. const m_LIBBSD_ABI_PROCTITLE = 1
  303. const m_LIBBSD_ABI_PROGNAME = 1
  304. const m_LIBBSD_ABI_PWCACHE = 1
  305. const m_LIBBSD_ABI_READPASSPHRASE = 1
  306. const m_LIBBSD_ABI_REALLOCARRAY = 1
  307. const m_LIBBSD_ABI_REALLOCF = 1
  308. const m_LIBBSD_ABI_RECALLOCARRAY = 1
  309. const m_LIBBSD_ABI_SORT = 1
  310. const m_LIBBSD_ABI_STRINGLIST = 1
  311. const m_LIBBSD_ABI_STRL = 1
  312. const m_LIBBSD_ABI_STRMODE = 1
  313. const m_LIBBSD_ABI_STRNSTR = 1
  314. const m_LIBBSD_ABI_STRTONUM = 1
  315. const m_LIBBSD_ABI_STRTOX = 1
  316. const m_LIBBSD_ABI_TIME64 = 0
  317. const m_LIBBSD_ABI_TIMECONV = 1
  318. const m_LIBBSD_ABI_TRANSPARENT_LIBMD = 1
  319. const m_LIBBSD_ABI_VIS = 1
  320. const m_LIBBSD_ABI_WCSL = 1
  321. const m_LIBBSD_API_TIME_MACROS = 0
  322. const m_LIBBSD_DISABLE_DEPRECATED = 1
  323. const m_LIBBSD_OVERLAY = 1
  324. const m_LIBBSD_SYS_HAS_TIME64 = 1
  325. const m_LIBBSD_SYS_TIME_BITS = 64
  326. const m_LINE_MAX = 4096
  327. const m_LITTLE_ENDIAN = "__LITTLE_ENDIAN"
  328. const m_LLONG_MAX = 0x7fffffffffffffff
  329. const m_LOGIN_NAME_MAX = 256
  330. const m_LONG_BIT = 64
  331. const m_LONG_MAX = "__LONG_MAX"
  332. const m_LT_OBJDIR = ".libs/"
  333. const m_L_INCR = 1
  334. const m_L_SET = 0
  335. const m_L_XTND = 2
  336. const m_L_ctermid = 20
  337. const m_L_cuserid = 20
  338. const m_L_tmpnam = 20
  339. const m_MB_LEN_MAX = 4
  340. const m_MINSIGSTKSZ = 2048
  341. const m_MQ_PRIO_MAX = 32768
  342. const m_NAME_MAX = 255
  343. const m_NDEBUG = 1
  344. const m_NGROUPS_MAX = 32
  345. const m_NL_ARGMAX = 9
  346. const m_NL_LANGMAX = 32
  347. const m_NL_MSGMAX = 32767
  348. const m_NL_NMAX = 16
  349. const m_NL_SETMAX = 255
  350. const m_NL_TEXTMAX = 2048
  351. const m_NSIG = "_NSIG"
  352. const m_NZERO = 20
  353. const m_PACKAGE = "libbsd"
  354. const m_PACKAGE_BUGREPORT = "libbsd@lists.freedesktop.org"
  355. const m_PACKAGE_NAME = "libbsd"
  356. const m_PACKAGE_STRING = "libbsd 0.12.2"
  357. const m_PACKAGE_TARNAME = "libbsd"
  358. const m_PACKAGE_URL = ""
  359. const m_PACKAGE_VERSION = "0.12.2"
  360. const m_PATH_MAX = 4096
  361. const m_PDP_ENDIAN = "__PDP_ENDIAN"
  362. const m_PIC = 1
  363. const m_PIPE_BUF = 4096
  364. const m_POLL_ERR = 4
  365. const m_POLL_HUP = 6
  366. const m_POLL_IN = 1
  367. const m_POLL_MSG = 3
  368. const m_POLL_OUT = 2
  369. const m_POLL_PRI = 5
  370. const m_POSIX_CLOSE_RESTART = 0
  371. const m_PTHREAD_DESTRUCTOR_ITERATIONS = 4
  372. const m_PTHREAD_KEYS_MAX = 128
  373. const m_PTHREAD_STACK_MIN = 2048
  374. const m_PTRDIFF_MAX = "INT64_MAX"
  375. const m_PTRDIFF_MIN = "INT64_MIN"
  376. const m_P_tmpdir = "/tmp"
  377. const m_RAND_MAX = 0x7fffffff
  378. const m_REG_A0 = 10
  379. const m_REG_PC = 0
  380. const m_REG_RA = 1
  381. const m_REG_S0 = 8
  382. const m_REG_S1 = 9
  383. const m_REG_S2 = 18
  384. const m_REG_SP = 2
  385. const m_REG_TP = 4
  386. const m_RE_DUP_MAX = 255
  387. const m_R_OK = 4
  388. const m_SA_EXPOSE_TAGBITS = 0x00000800
  389. const m_SA_NOCLDSTOP = 1
  390. const m_SA_NOCLDWAIT = 2
  391. const m_SA_NODEFER = 0x40000000
  392. const m_SA_NOMASK = "SA_NODEFER"
  393. const m_SA_ONESHOT = "SA_RESETHAND"
  394. const m_SA_ONSTACK = 0x08000000
  395. const m_SA_RESETHAND = 0x80000000
  396. const m_SA_RESTART = 0x10000000
  397. const m_SA_SIGINFO = 4
  398. const m_SA_UNSUPPORTED = 0x00000400
  399. const m_SCHAR_MAX = 127
  400. const m_SEEK_DATA = 3
  401. const m_SEEK_HOLE = 4
  402. const m_SEGV_ACCERR = 2
  403. const m_SEGV_BNDERR = 3
  404. const m_SEGV_MAPERR = 1
  405. const m_SEGV_MTEAERR = 8
  406. const m_SEGV_MTESERR = 9
  407. const m_SEGV_PKUERR = 4
  408. const m_SEM_NSEMS_MAX = 256
  409. const m_SEM_VALUE_MAX = 0x7fffffff
  410. const m_SET_LEN = 6
  411. const m_SET_LEN_INCR = 4
  412. const m_SHRT_MAX = 0x7fff
  413. const m_SIGABRT = 6
  414. const m_SIGALRM = 14
  415. const m_SIGBUS = 7
  416. const m_SIGCHLD = 17
  417. const m_SIGCONT = 18
  418. const m_SIGEV_NONE = 1
  419. const m_SIGEV_SIGNAL = 0
  420. const m_SIGEV_THREAD = 2
  421. const m_SIGEV_THREAD_ID = 4
  422. const m_SIGFPE = 8
  423. const m_SIGHUP = 1
  424. const m_SIGILL = 4
  425. const m_SIGINT = 2
  426. const m_SIGIO = 29
  427. const m_SIGIOT = "SIGABRT"
  428. const m_SIGKILL = 9
  429. const m_SIGPIPE = 13
  430. const m_SIGPOLL = "SIGIO"
  431. const m_SIGPROF = 27
  432. const m_SIGPWR = 30
  433. const m_SIGQUIT = 3
  434. const m_SIGSEGV = 11
  435. const m_SIGSTKFLT = 16
  436. const m_SIGSTKSZ = 8192
  437. const m_SIGSTOP = 19
  438. const m_SIGSYS = 31
  439. const m_SIGTERM = 15
  440. const m_SIGTRAP = 5
  441. const m_SIGTSTP = 20
  442. const m_SIGTTIN = 21
  443. const m_SIGTTOU = 22
  444. const m_SIGUNUSED = "SIGSYS"
  445. const m_SIGURG = 23
  446. const m_SIGUSR1 = 10
  447. const m_SIGUSR2 = 12
  448. const m_SIGVTALRM = 26
  449. const m_SIGWINCH = 28
  450. const m_SIGXCPU = 24
  451. const m_SIGXFSZ = 25
  452. const m_SIG_ATOMIC_MAX = "INT32_MAX"
  453. const m_SIG_ATOMIC_MIN = "INT32_MIN"
  454. const m_SIG_BLOCK = 0
  455. const m_SIG_SETMASK = 2
  456. const m_SIG_UNBLOCK = 1
  457. const m_SIZEOF_OFF_T = 8
  458. const m_SIZEOF_TIME_T = 8
  459. const m_SIZE_MAX = "UINT64_MAX"
  460. const m_SI_KERNEL = 128
  461. const m_SI_USER = 0
  462. const m_SSIZE_MAX = "LONG_MAX"
  463. const m_SS_DISABLE = 2
  464. const m_SS_FLAG_BITS = "SS_AUTODISARM"
  465. const m_SS_ONSTACK = 1
  466. const m_STATX_ALL = 0xfff
  467. const m_STATX_ATIME = 0x20
  468. const m_STATX_BASIC_STATS = 0x7ff
  469. const m_STATX_BLOCKS = 0x400
  470. const m_STATX_BTIME = 0x800
  471. const m_STATX_CTIME = 0x80
  472. const m_STATX_GID = 0x10
  473. const m_STATX_INO = 0x100
  474. const m_STATX_MODE = 2
  475. const m_STATX_MTIME = 0x40
  476. const m_STATX_NLINK = 4
  477. const m_STATX_SIZE = 0x200
  478. const m_STATX_TYPE = 1
  479. const m_STATX_UID = 8
  480. const m_STDC_HEADERS = 1
  481. const m_STDERR_FILENO = 2
  482. const m_STDIN_FILENO = 0
  483. const m_STDOUT_FILENO = 1
  484. const m_SYMLOOP_MAX = 40
  485. const m_SYS_SECCOMP = 1
  486. const m_SYS_USER_DISPATCH = 2
  487. const m_S_IEXEC = "S_IXUSR"
  488. const m_S_IFBLK = 0060000
  489. const m_S_IFCHR = 0020000
  490. const m_S_IFDIR = 16384
  491. const m_S_IFIFO = 0010000
  492. const m_S_IFLNK = 0120000
  493. const m_S_IFMT = 0170000
  494. const m_S_IFREG = 0100000
  495. const m_S_IFSOCK = 0140000
  496. const m_S_IREAD = "S_IRUSR"
  497. const m_S_IRGRP = 32
  498. const m_S_IROTH = 4
  499. const m_S_IRUSR = 256
  500. const m_S_IRWXG = 56
  501. const m_S_IRWXO = 7
  502. const m_S_IRWXU = 448
  503. const m_S_ISGID = 1024
  504. const m_S_ISTXT = "S_ISVTX"
  505. const m_S_ISUID = 2048
  506. const m_S_ISVTX = 512
  507. const m_S_IWGRP = 16
  508. const m_S_IWOTH = 2
  509. const m_S_IWRITE = "S_IWUSR"
  510. const m_S_IWUSR = 128
  511. const m_S_IXGRP = 8
  512. const m_S_IXOTH = 1
  513. const m_S_IXUSR = 64
  514. const m_TMP_MAX = 10000
  515. const m_TRAP_BRANCH = 3
  516. const m_TRAP_BRKPT = 1
  517. const m_TRAP_HWBKPT = 4
  518. const m_TRAP_TRACE = 2
  519. const m_TRAP_UNK = 5
  520. const m_TTY_NAME_MAX = 32
  521. const m_TZNAME_MAX = 6
  522. const m_UCHAR_MAX = 255
  523. const m_UINT16_MAX = 0xffff
  524. const m_UINT32_MAX = "0xffffffffu"
  525. const m_UINT64_MAX = "0xffffffffffffffffu"
  526. const m_UINT8_MAX = 0xff
  527. const m_UINTMAX_MAX = "UINT64_MAX"
  528. const m_UINTPTR_MAX = "UINT64_MAX"
  529. const m_UINT_FAST16_MAX = "UINT32_MAX"
  530. const m_UINT_FAST32_MAX = "UINT32_MAX"
  531. const m_UINT_FAST64_MAX = "UINT64_MAX"
  532. const m_UINT_FAST8_MAX = "UINT8_MAX"
  533. const m_UINT_LEAST16_MAX = "UINT16_MAX"
  534. const m_UINT_LEAST32_MAX = "UINT32_MAX"
  535. const m_UINT_LEAST64_MAX = "UINT64_MAX"
  536. const m_UINT_LEAST8_MAX = "UINT8_MAX"
  537. const m_UINT_MAX = 0xffffffff
  538. const m_USHRT_MAX = 0xffff
  539. const m_UTIME_NOW = 0x3fffffff
  540. const m_UTIME_OMIT = 0x3ffffffe
  541. const m_VERSION = "0.12.2"
  542. const m_WINT_MAX = "UINT32_MAX"
  543. const m_WINT_MIN = 0
  544. const m_WNOHANG = 1
  545. const m_WORD_BIT = 32
  546. const m_WUNTRACED = 2
  547. const m_W_OK = 2
  548. const m_X_OK = 1
  549. const m__ALL_SOURCE = 1
  550. const m__CS_GNU_LIBC_VERSION = 2
  551. const m__CS_GNU_LIBPTHREAD_VERSION = 3
  552. const m__CS_PATH = 0
  553. const m__CS_POSIX_V5_WIDTH_RESTRICTED_ENVS = 4
  554. const m__CS_POSIX_V6_ILP32_OFF32_CFLAGS = 1116
  555. const m__CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 1117
  556. const m__CS_POSIX_V6_ILP32_OFF32_LIBS = 1118
  557. const m__CS_POSIX_V6_ILP32_OFF32_LINTFLAGS = 1119
  558. const m__CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 1120
  559. const m__CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 1121
  560. const m__CS_POSIX_V6_ILP32_OFFBIG_LIBS = 1122
  561. const m__CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS = 1123
  562. const m__CS_POSIX_V6_LP64_OFF64_CFLAGS = 1124
  563. const m__CS_POSIX_V6_LP64_OFF64_LDFLAGS = 1125
  564. const m__CS_POSIX_V6_LP64_OFF64_LIBS = 1126
  565. const m__CS_POSIX_V6_LP64_OFF64_LINTFLAGS = 1127
  566. const m__CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 1128
  567. const m__CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 1129
  568. const m__CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 1130
  569. const m__CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS = 1131
  570. const m__CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 1
  571. const m__CS_POSIX_V7_ILP32_OFF32_CFLAGS = 1132
  572. const m__CS_POSIX_V7_ILP32_OFF32_LDFLAGS = 1133
  573. const m__CS_POSIX_V7_ILP32_OFF32_LIBS = 1134
  574. const m__CS_POSIX_V7_ILP32_OFF32_LINTFLAGS = 1135
  575. const m__CS_POSIX_V7_ILP32_OFFBIG_CFLAGS = 1136
  576. const m__CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS = 1137
  577. const m__CS_POSIX_V7_ILP32_OFFBIG_LIBS = 1138
  578. const m__CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS = 1139
  579. const m__CS_POSIX_V7_LP64_OFF64_CFLAGS = 1140
  580. const m__CS_POSIX_V7_LP64_OFF64_LDFLAGS = 1141
  581. const m__CS_POSIX_V7_LP64_OFF64_LIBS = 1142
  582. const m__CS_POSIX_V7_LP64_OFF64_LINTFLAGS = 1143
  583. const m__CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS = 1144
  584. const m__CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS = 1145
  585. const m__CS_POSIX_V7_LPBIG_OFFBIG_LIBS = 1146
  586. const m__CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS = 1147
  587. const m__CS_POSIX_V7_THREADS_CFLAGS = 1150
  588. const m__CS_POSIX_V7_THREADS_LDFLAGS = 1151
  589. const m__CS_POSIX_V7_WIDTH_RESTRICTED_ENVS = 5
  590. const m__CS_V6_ENV = 1148
  591. const m__CS_V7_ENV = 1149
  592. const m__DARWIN_C_SOURCE = 1
  593. const m__GNU_SOURCE = 1
  594. const m__HPUX_ALT_XOPEN_SOCKET_API = 1
  595. const m__IOFBF = 0
  596. const m__IOLBF = 1
  597. const m__IONBF = 2
  598. const m__LP64 = 1
  599. const m__NETBSD_SOURCE = 1
  600. const m__NSIG = 65
  601. const m__OPENBSD_SOURCE = 1
  602. const m__PC_2_SYMLINKS = 20
  603. const m__PC_ALLOC_SIZE_MIN = 18
  604. const m__PC_ASYNC_IO = 10
  605. const m__PC_CHOWN_RESTRICTED = 6
  606. const m__PC_FILESIZEBITS = 13
  607. const m__PC_LINK_MAX = 0
  608. const m__PC_MAX_CANON = 1
  609. const m__PC_MAX_INPUT = 2
  610. const m__PC_NAME_MAX = 3
  611. const m__PC_NO_TRUNC = 7
  612. const m__PC_PATH_MAX = 4
  613. const m__PC_PIPE_BUF = 5
  614. const m__PC_PRIO_IO = 11
  615. const m__PC_REC_INCR_XFER_SIZE = 14
  616. const m__PC_REC_MAX_XFER_SIZE = 15
  617. const m__PC_REC_MIN_XFER_SIZE = 16
  618. const m__PC_REC_XFER_ALIGN = 17
  619. const m__PC_SOCK_MAXBUF = 12
  620. const m__PC_SYMLINK_MAX = 19
  621. const m__PC_SYNC_IO = 9
  622. const m__PC_VDISABLE = 8
  623. const m__POSIX2_BC_BASE_MAX = 99
  624. const m__POSIX2_BC_DIM_MAX = 2048
  625. const m__POSIX2_BC_SCALE_MAX = 99
  626. const m__POSIX2_BC_STRING_MAX = 1000
  627. const m__POSIX2_CHARCLASS_NAME_MAX = 14
  628. const m__POSIX2_COLL_WEIGHTS_MAX = 2
  629. const m__POSIX2_C_BIND = "_POSIX_VERSION"
  630. const m__POSIX2_EXPR_NEST_MAX = 32
  631. const m__POSIX2_LINE_MAX = 2048
  632. const m__POSIX2_RE_DUP_MAX = 255
  633. const m__POSIX2_VERSION = "_POSIX_VERSION"
  634. const m__POSIX_ADVISORY_INFO = "_POSIX_VERSION"
  635. const m__POSIX_AIO_LISTIO_MAX = 2
  636. const m__POSIX_AIO_MAX = 1
  637. const m__POSIX_ARG_MAX = 4096
  638. const m__POSIX_ASYNCHRONOUS_IO = "_POSIX_VERSION"
  639. const m__POSIX_BARRIERS = "_POSIX_VERSION"
  640. const m__POSIX_CHILD_MAX = 25
  641. const m__POSIX_CHOWN_RESTRICTED = 1
  642. const m__POSIX_CLOCKRES_MIN = 20000000
  643. const m__POSIX_CLOCK_SELECTION = "_POSIX_VERSION"
  644. const m__POSIX_CPUTIME = "_POSIX_VERSION"
  645. const m__POSIX_DELAYTIMER_MAX = 32
  646. const m__POSIX_FSYNC = "_POSIX_VERSION"
  647. const m__POSIX_HOST_NAME_MAX = 255
  648. const m__POSIX_IPV6 = "_POSIX_VERSION"
  649. const m__POSIX_JOB_CONTROL = 1
  650. const m__POSIX_LINK_MAX = 8
  651. const m__POSIX_LOGIN_NAME_MAX = 9
  652. const m__POSIX_MAPPED_FILES = "_POSIX_VERSION"
  653. const m__POSIX_MAX_CANON = 255
  654. const m__POSIX_MAX_INPUT = 255
  655. const m__POSIX_MEMLOCK = "_POSIX_VERSION"
  656. const m__POSIX_MEMLOCK_RANGE = "_POSIX_VERSION"
  657. const m__POSIX_MEMORY_PROTECTION = "_POSIX_VERSION"
  658. const m__POSIX_MESSAGE_PASSING = "_POSIX_VERSION"
  659. const m__POSIX_MONOTONIC_CLOCK = "_POSIX_VERSION"
  660. const m__POSIX_MQ_OPEN_MAX = 8
  661. const m__POSIX_MQ_PRIO_MAX = 32
  662. const m__POSIX_NAME_MAX = 14
  663. const m__POSIX_NGROUPS_MAX = 8
  664. const m__POSIX_NO_TRUNC = 1
  665. const m__POSIX_OPEN_MAX = 20
  666. const m__POSIX_PATH_MAX = 256
  667. const m__POSIX_PIPE_BUF = 512
  668. const m__POSIX_PTHREAD_SEMANTICS = 1
  669. const m__POSIX_RAW_SOCKETS = "_POSIX_VERSION"
  670. const m__POSIX_READER_WRITER_LOCKS = "_POSIX_VERSION"
  671. const m__POSIX_REALTIME_SIGNALS = "_POSIX_VERSION"
  672. const m__POSIX_REGEXP = 1
  673. const m__POSIX_RE_DUP_MAX = 255
  674. const m__POSIX_RTSIG_MAX = 8
  675. const m__POSIX_SAVED_IDS = 1
  676. const m__POSIX_SEMAPHORES = "_POSIX_VERSION"
  677. const m__POSIX_SEM_NSEMS_MAX = 256
  678. const m__POSIX_SEM_VALUE_MAX = 32767
  679. const m__POSIX_SHARED_MEMORY_OBJECTS = "_POSIX_VERSION"
  680. const m__POSIX_SHELL = 1
  681. const m__POSIX_SIGQUEUE_MAX = 32
  682. const m__POSIX_SPAWN = "_POSIX_VERSION"
  683. const m__POSIX_SPIN_LOCKS = "_POSIX_VERSION"
  684. const m__POSIX_SSIZE_MAX = 32767
  685. const m__POSIX_SS_REPL_MAX = 4
  686. const m__POSIX_STREAM_MAX = 8
  687. const m__POSIX_SYMLINK_MAX = 255
  688. const m__POSIX_SYMLOOP_MAX = 8
  689. const m__POSIX_THREADS = "_POSIX_VERSION"
  690. const m__POSIX_THREAD_ATTR_STACKADDR = "_POSIX_VERSION"
  691. const m__POSIX_THREAD_ATTR_STACKSIZE = "_POSIX_VERSION"
  692. const m__POSIX_THREAD_CPUTIME = "_POSIX_VERSION"
  693. const m__POSIX_THREAD_DESTRUCTOR_ITERATIONS = 4
  694. const m__POSIX_THREAD_KEYS_MAX = 128
  695. const m__POSIX_THREAD_PRIORITY_SCHEDULING = "_POSIX_VERSION"
  696. const m__POSIX_THREAD_PROCESS_SHARED = "_POSIX_VERSION"
  697. const m__POSIX_THREAD_SAFE_FUNCTIONS = "_POSIX_VERSION"
  698. const m__POSIX_THREAD_THREADS_MAX = 64
  699. const m__POSIX_TIMEOUTS = "_POSIX_VERSION"
  700. const m__POSIX_TIMERS = "_POSIX_VERSION"
  701. const m__POSIX_TIMER_MAX = 32
  702. const m__POSIX_TRACE_EVENT_NAME_MAX = 30
  703. const m__POSIX_TRACE_NAME_MAX = 8
  704. const m__POSIX_TRACE_SYS_MAX = 8
  705. const m__POSIX_TRACE_USER_EVENT_MAX = 32
  706. const m__POSIX_TTY_NAME_MAX = 9
  707. const m__POSIX_TZNAME_MAX = 6
  708. const m__POSIX_V6_LP64_OFF64 = 1
  709. const m__POSIX_V7_LP64_OFF64 = 1
  710. const m__POSIX_VDISABLE = 0
  711. const m__POSIX_VERSION = 200809
  712. const m__SC_2_CHAR_TERM = 95
  713. const m__SC_2_C_BIND = 47
  714. const m__SC_2_C_DEV = 48
  715. const m__SC_2_FORT_DEV = 49
  716. const m__SC_2_FORT_RUN = 50
  717. const m__SC_2_LOCALEDEF = 52
  718. const m__SC_2_PBS = 168
  719. const m__SC_2_PBS_ACCOUNTING = 169
  720. const m__SC_2_PBS_CHECKPOINT = 175
  721. const m__SC_2_PBS_LOCATE = 170
  722. const m__SC_2_PBS_MESSAGE = 171
  723. const m__SC_2_PBS_TRACK = 172
  724. const m__SC_2_SW_DEV = 51
  725. const m__SC_2_UPE = 97
  726. const m__SC_2_VERSION = 46
  727. const m__SC_ADVISORY_INFO = 132
  728. const m__SC_AIO_LISTIO_MAX = 23
  729. const m__SC_AIO_MAX = 24
  730. const m__SC_AIO_PRIO_DELTA_MAX = 25
  731. const m__SC_ARG_MAX = 0
  732. const m__SC_ASYNCHRONOUS_IO = 12
  733. const m__SC_ATEXIT_MAX = 87
  734. const m__SC_AVPHYS_PAGES = 86
  735. const m__SC_BARRIERS = 133
  736. const m__SC_BC_BASE_MAX = 36
  737. const m__SC_BC_DIM_MAX = 37
  738. const m__SC_BC_SCALE_MAX = 38
  739. const m__SC_BC_STRING_MAX = 39
  740. const m__SC_CHILD_MAX = 1
  741. const m__SC_CLK_TCK = 2
  742. const m__SC_CLOCK_SELECTION = 137
  743. const m__SC_COLL_WEIGHTS_MAX = 40
  744. const m__SC_CPUTIME = 138
  745. const m__SC_DELAYTIMER_MAX = 26
  746. const m__SC_EXPR_NEST_MAX = 42
  747. const m__SC_FSYNC = 15
  748. const m__SC_GETGR_R_SIZE_MAX = 69
  749. const m__SC_GETPW_R_SIZE_MAX = 70
  750. const m__SC_HOST_NAME_MAX = 180
  751. const m__SC_IOV_MAX = 60
  752. const m__SC_IPV6 = 235
  753. const m__SC_JOB_CONTROL = 7
  754. const m__SC_LINE_MAX = 43
  755. const m__SC_LOGIN_NAME_MAX = 71
  756. const m__SC_MAPPED_FILES = 16
  757. const m__SC_MEMLOCK = 17
  758. const m__SC_MEMLOCK_RANGE = 18
  759. const m__SC_MEMORY_PROTECTION = 19
  760. const m__SC_MESSAGE_PASSING = 20
  761. const m__SC_MINSIGSTKSZ = 249
  762. const m__SC_MONOTONIC_CLOCK = 149
  763. const m__SC_MQ_OPEN_MAX = 27
  764. const m__SC_MQ_PRIO_MAX = 28
  765. const m__SC_NGROUPS_MAX = 3
  766. const m__SC_NPROCESSORS_CONF = 83
  767. const m__SC_NPROCESSORS_ONLN = 84
  768. const m__SC_NZERO = 109
  769. const m__SC_OPEN_MAX = 4
  770. const m__SC_PAGESIZE = 30
  771. const m__SC_PAGE_SIZE = 30
  772. const m__SC_PASS_MAX = 88
  773. const m__SC_PHYS_PAGES = 85
  774. const m__SC_PRIORITIZED_IO = 13
  775. const m__SC_PRIORITY_SCHEDULING = 10
  776. const m__SC_RAW_SOCKETS = 236
  777. const m__SC_READER_WRITER_LOCKS = 153
  778. const m__SC_REALTIME_SIGNALS = 9
  779. const m__SC_REGEXP = 155
  780. const m__SC_RE_DUP_MAX = 44
  781. const m__SC_RTSIG_MAX = 31
  782. const m__SC_SAVED_IDS = 8
  783. const m__SC_SEMAPHORES = 21
  784. const m__SC_SEM_NSEMS_MAX = 32
  785. const m__SC_SEM_VALUE_MAX = 33
  786. const m__SC_SHARED_MEMORY_OBJECTS = 22
  787. const m__SC_SHELL = 157
  788. const m__SC_SIGQUEUE_MAX = 34
  789. const m__SC_SIGSTKSZ = 250
  790. const m__SC_SPAWN = 159
  791. const m__SC_SPIN_LOCKS = 154
  792. const m__SC_SPORADIC_SERVER = 160
  793. const m__SC_SS_REPL_MAX = 241
  794. const m__SC_STREAMS = 174
  795. const m__SC_STREAM_MAX = 5
  796. const m__SC_SYMLOOP_MAX = 173
  797. const m__SC_SYNCHRONIZED_IO = 14
  798. const m__SC_THREADS = 67
  799. const m__SC_THREAD_ATTR_STACKADDR = 77
  800. const m__SC_THREAD_ATTR_STACKSIZE = 78
  801. const m__SC_THREAD_CPUTIME = 139
  802. const m__SC_THREAD_DESTRUCTOR_ITERATIONS = 73
  803. const m__SC_THREAD_KEYS_MAX = 74
  804. const m__SC_THREAD_PRIORITY_SCHEDULING = 79
  805. const m__SC_THREAD_PRIO_INHERIT = 80
  806. const m__SC_THREAD_PRIO_PROTECT = 81
  807. const m__SC_THREAD_PROCESS_SHARED = 82
  808. const m__SC_THREAD_ROBUST_PRIO_INHERIT = 247
  809. const m__SC_THREAD_ROBUST_PRIO_PROTECT = 248
  810. const m__SC_THREAD_SAFE_FUNCTIONS = 68
  811. const m__SC_THREAD_SPORADIC_SERVER = 161
  812. const m__SC_THREAD_STACK_MIN = 75
  813. const m__SC_THREAD_THREADS_MAX = 76
  814. const m__SC_TIMEOUTS = 164
  815. const m__SC_TIMERS = 11
  816. const m__SC_TIMER_MAX = 35
  817. const m__SC_TRACE = 181
  818. const m__SC_TRACE_EVENT_FILTER = 182
  819. const m__SC_TRACE_EVENT_NAME_MAX = 242
  820. const m__SC_TRACE_INHERIT = 183
  821. const m__SC_TRACE_LOG = 184
  822. const m__SC_TRACE_NAME_MAX = 243
  823. const m__SC_TRACE_SYS_MAX = 244
  824. const m__SC_TRACE_USER_EVENT_MAX = 245
  825. const m__SC_TTY_NAME_MAX = 72
  826. const m__SC_TYPED_MEMORY_OBJECTS = 165
  827. const m__SC_TZNAME_MAX = 6
  828. const m__SC_UIO_MAXIOV = 60
  829. const m__SC_V6_ILP32_OFF32 = 176
  830. const m__SC_V6_ILP32_OFFBIG = 177
  831. const m__SC_V6_LP64_OFF64 = 178
  832. const m__SC_V6_LPBIG_OFFBIG = 179
  833. const m__SC_V7_ILP32_OFF32 = 237
  834. const m__SC_V7_ILP32_OFFBIG = 238
  835. const m__SC_V7_LP64_OFF64 = 239
  836. const m__SC_V7_LPBIG_OFFBIG = 240
  837. const m__SC_VERSION = 29
  838. const m__SC_XBS5_ILP32_OFF32 = 125
  839. const m__SC_XBS5_ILP32_OFFBIG = 126
  840. const m__SC_XBS5_LP64_OFF64 = 127
  841. const m__SC_XBS5_LPBIG_OFFBIG = 128
  842. const m__SC_XOPEN_CRYPT = 92
  843. const m__SC_XOPEN_ENH_I18N = 93
  844. const m__SC_XOPEN_LEGACY = 129
  845. const m__SC_XOPEN_REALTIME = 130
  846. const m__SC_XOPEN_REALTIME_THREADS = 131
  847. const m__SC_XOPEN_SHM = 94
  848. const m__SC_XOPEN_STREAMS = 246
  849. const m__SC_XOPEN_UNIX = 91
  850. const m__SC_XOPEN_VERSION = 89
  851. const m__SC_XOPEN_XCU_VERSION = 90
  852. const m__SC_XOPEN_XPG2 = 98
  853. const m__SC_XOPEN_XPG3 = 99
  854. const m__SC_XOPEN_XPG4 = 100
  855. const m__STDC_PREDEF_H = 1
  856. const m__SYS_CDEFS_H = 1
  857. const m__TANDEM_SOURCE = 1
  858. const m__XOPEN_ENH_I18N = 1
  859. const m__XOPEN_IOV_MAX = 16
  860. const m__XOPEN_NAME_MAX = 255
  861. const m__XOPEN_PATH_MAX = 1024
  862. const m__XOPEN_UNIX = 1
  863. const m__XOPEN_VERSION = 700
  864. const m___ATOMIC_ACQUIRE = 2
  865. const m___ATOMIC_ACQ_REL = 4
  866. const m___ATOMIC_CONSUME = 1
  867. const m___ATOMIC_RELAXED = 0
  868. const m___ATOMIC_RELEASE = 3
  869. const m___ATOMIC_SEQ_CST = 5
  870. const m___BIGGEST_ALIGNMENT__ = 16
  871. const m___BIG_ENDIAN = 4321
  872. const m___BYTE_ORDER = 1234
  873. const m___BYTE_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  874. const m___CCGO__ = 1
  875. const m___CHAR_BIT__ = 8
  876. const m___CHAR_UNSIGNED__ = 1
  877. const m___DBL_DECIMAL_DIG__ = 17
  878. const m___DBL_DIG__ = 15
  879. const m___DBL_HAS_DENORM__ = 1
  880. const m___DBL_HAS_INFINITY__ = 1
  881. const m___DBL_HAS_QUIET_NAN__ = 1
  882. const m___DBL_IS_IEC_60559__ = 1
  883. const m___DBL_MANT_DIG__ = 53
  884. const m___DBL_MAX_10_EXP__ = 308
  885. const m___DBL_MAX_EXP__ = 1024
  886. const m___DECIMAL_DIG__ = 36
  887. const m___DEC_EVAL_METHOD__ = 2
  888. const m___ELF__ = 1
  889. const m___EXTENSIONS__ = 1
  890. const m___FINITE_MATH_ONLY__ = 0
  891. const m___FLOAT_WORD_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  892. const m___FLT128_DECIMAL_DIG__ = 36
  893. const m___FLT128_DENORM_MIN__ = 6.47517511943802511092443895822764655e-4966
  894. const m___FLT128_DIG__ = 33
  895. const m___FLT128_EPSILON__ = 1.92592994438723585305597794258492732e-34
  896. const m___FLT128_HAS_DENORM__ = 1
  897. const m___FLT128_HAS_INFINITY__ = 1
  898. const m___FLT128_HAS_QUIET_NAN__ = 1
  899. const m___FLT128_IS_IEC_60559__ = 1
  900. const m___FLT128_MANT_DIG__ = 113
  901. const m___FLT128_MAX_10_EXP__ = 4932
  902. const m___FLT128_MAX_EXP__ = 16384
  903. const m___FLT128_MAX__ = "1.18973149535723176508575932662800702e+4932"
  904. const m___FLT128_MIN__ = 3.36210314311209350626267781732175260e-4932
  905. const m___FLT128_NORM_MAX__ = "1.18973149535723176508575932662800702e+4932"
  906. const m___FLT16_DECIMAL_DIG__ = 5
  907. const m___FLT16_DENORM_MIN__ = 5.96046447753906250000000000000000000e-8
  908. const m___FLT16_DIG__ = 3
  909. const m___FLT16_EPSILON__ = 9.76562500000000000000000000000000000e-4
  910. const m___FLT16_HAS_DENORM__ = 1
  911. const m___FLT16_HAS_INFINITY__ = 1
  912. const m___FLT16_HAS_QUIET_NAN__ = 1
  913. const m___FLT16_IS_IEC_60559__ = 1
  914. const m___FLT16_MANT_DIG__ = 11
  915. const m___FLT16_MAX_10_EXP__ = 4
  916. const m___FLT16_MAX_EXP__ = 16
  917. const m___FLT16_MAX__ = 6.55040000000000000000000000000000000e+4
  918. const m___FLT16_MIN__ = 6.10351562500000000000000000000000000e-5
  919. const m___FLT16_NORM_MAX__ = 6.55040000000000000000000000000000000e+4
  920. const m___FLT32X_DECIMAL_DIG__ = 17
  921. const m___FLT32X_DENORM_MIN__ = 4.94065645841246544176568792868221372e-324
  922. const m___FLT32X_DIG__ = 15
  923. const m___FLT32X_EPSILON__ = 2.22044604925031308084726333618164062e-16
  924. const m___FLT32X_HAS_DENORM__ = 1
  925. const m___FLT32X_HAS_INFINITY__ = 1
  926. const m___FLT32X_HAS_QUIET_NAN__ = 1
  927. const m___FLT32X_IS_IEC_60559__ = 1
  928. const m___FLT32X_MANT_DIG__ = 53
  929. const m___FLT32X_MAX_10_EXP__ = 308
  930. const m___FLT32X_MAX_EXP__ = 1024
  931. const m___FLT32X_MAX__ = 1.79769313486231570814527423731704357e+308
  932. const m___FLT32X_MIN__ = 2.22507385850720138309023271733240406e-308
  933. const m___FLT32X_NORM_MAX__ = 1.79769313486231570814527423731704357e+308
  934. const m___FLT32_DECIMAL_DIG__ = 9
  935. const m___FLT32_DENORM_MIN__ = 1.40129846432481707092372958328991613e-45
  936. const m___FLT32_DIG__ = 6
  937. const m___FLT32_EPSILON__ = 1.19209289550781250000000000000000000e-7
  938. const m___FLT32_HAS_DENORM__ = 1
  939. const m___FLT32_HAS_INFINITY__ = 1
  940. const m___FLT32_HAS_QUIET_NAN__ = 1
  941. const m___FLT32_IS_IEC_60559__ = 1
  942. const m___FLT32_MANT_DIG__ = 24
  943. const m___FLT32_MAX_10_EXP__ = 38
  944. const m___FLT32_MAX_EXP__ = 128
  945. const m___FLT32_MAX__ = 3.40282346638528859811704183484516925e+38
  946. const m___FLT32_MIN__ = 1.17549435082228750796873653722224568e-38
  947. const m___FLT32_NORM_MAX__ = 3.40282346638528859811704183484516925e+38
  948. const m___FLT64X_DECIMAL_DIG__ = 36
  949. const m___FLT64X_DENORM_MIN__ = 6.47517511943802511092443895822764655e-4966
  950. const m___FLT64X_DIG__ = 33
  951. const m___FLT64X_EPSILON__ = 1.92592994438723585305597794258492732e-34
  952. const m___FLT64X_HAS_DENORM__ = 1
  953. const m___FLT64X_HAS_INFINITY__ = 1
  954. const m___FLT64X_HAS_QUIET_NAN__ = 1
  955. const m___FLT64X_IS_IEC_60559__ = 1
  956. const m___FLT64X_MANT_DIG__ = 113
  957. const m___FLT64X_MAX_10_EXP__ = 4932
  958. const m___FLT64X_MAX_EXP__ = 16384
  959. const m___FLT64X_MAX__ = "1.18973149535723176508575932662800702e+4932"
  960. const m___FLT64X_MIN__ = 3.36210314311209350626267781732175260e-4932
  961. const m___FLT64X_NORM_MAX__ = "1.18973149535723176508575932662800702e+4932"
  962. const m___FLT64_DECIMAL_DIG__ = 17
  963. const m___FLT64_DENORM_MIN__ = 4.94065645841246544176568792868221372e-324
  964. const m___FLT64_DIG__ = 15
  965. const m___FLT64_EPSILON__ = 2.22044604925031308084726333618164062e-16
  966. const m___FLT64_HAS_DENORM__ = 1
  967. const m___FLT64_HAS_INFINITY__ = 1
  968. const m___FLT64_HAS_QUIET_NAN__ = 1
  969. const m___FLT64_IS_IEC_60559__ = 1
  970. const m___FLT64_MANT_DIG__ = 53
  971. const m___FLT64_MAX_10_EXP__ = 308
  972. const m___FLT64_MAX_EXP__ = 1024
  973. const m___FLT64_MAX__ = 1.79769313486231570814527423731704357e+308
  974. const m___FLT64_MIN__ = 2.22507385850720138309023271733240406e-308
  975. const m___FLT64_NORM_MAX__ = 1.79769313486231570814527423731704357e+308
  976. const m___FLT_DECIMAL_DIG__ = 9
  977. const m___FLT_DENORM_MIN__ = 1.40129846432481707092372958328991613e-45
  978. const m___FLT_DIG__ = 6
  979. const m___FLT_EPSILON__ = 1.19209289550781250000000000000000000e-7
  980. const m___FLT_EVAL_METHOD_TS_18661_3__ = 0
  981. const m___FLT_EVAL_METHOD__ = 0
  982. const m___FLT_HAS_DENORM__ = 1
  983. const m___FLT_HAS_INFINITY__ = 1
  984. const m___FLT_HAS_QUIET_NAN__ = 1
  985. const m___FLT_IS_IEC_60559__ = 1
  986. const m___FLT_MANT_DIG__ = 24
  987. const m___FLT_MAX_10_EXP__ = 38
  988. const m___FLT_MAX_EXP__ = 128
  989. const m___FLT_MAX__ = 3.40282346638528859811704183484516925e+38
  990. const m___FLT_MIN__ = 1.17549435082228750796873653722224568e-38
  991. const m___FLT_NORM_MAX__ = 3.40282346638528859811704183484516925e+38
  992. const m___FLT_RADIX__ = 2
  993. const m___FP_FAST_FMA = 1
  994. const m___FP_FAST_FMAF = 1
  995. const m___FP_FAST_FMAF32 = 1
  996. const m___FP_FAST_FMAF32x = 1
  997. const m___FP_FAST_FMAF64 = 1
  998. const m___FUNCTION__ = "__func__"
  999. const m___GCC_ATOMIC_BOOL_LOCK_FREE = 2
  1000. const m___GCC_ATOMIC_CHAR16_T_LOCK_FREE = 2
  1001. const m___GCC_ATOMIC_CHAR32_T_LOCK_FREE = 2
  1002. const m___GCC_ATOMIC_CHAR_LOCK_FREE = 2
  1003. const m___GCC_ATOMIC_INT_LOCK_FREE = 2
  1004. const m___GCC_ATOMIC_LLONG_LOCK_FREE = 2
  1005. const m___GCC_ATOMIC_LONG_LOCK_FREE = 2
  1006. const m___GCC_ATOMIC_POINTER_LOCK_FREE = 2
  1007. const m___GCC_ATOMIC_SHORT_LOCK_FREE = 2
  1008. const m___GCC_ATOMIC_TEST_AND_SET_TRUEVAL = 1
  1009. const m___GCC_ATOMIC_WCHAR_T_LOCK_FREE = 2
  1010. const m___GCC_HAVE_DWARF2_CFI_ASM = 1
  1011. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 = 1
  1012. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 = 1
  1013. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 = 1
  1014. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 = 1
  1015. const m___GCC_IEC_559 = 2
  1016. const m___GCC_IEC_559_COMPLEX = 2
  1017. const m___GNUC_EXECUTION_CHARSET_NAME = "UTF-8"
  1018. const m___GNUC_MINOR__ = 2
  1019. const m___GNUC_PATCHLEVEL__ = 0
  1020. const m___GNUC_STDC_INLINE__ = 1
  1021. const m___GNUC_WIDE_EXECUTION_CHARSET_NAME = "UTF-32LE"
  1022. const m___GNUC__ = 14
  1023. const m___GXX_ABI_VERSION = 1019
  1024. const m___HAVE_GENERIC_SELECTION = 0
  1025. const m___INT16_MAX__ = 0x7fff
  1026. const m___INT32_MAX__ = 0x7fffffff
  1027. const m___INT32_TYPE__ = "int"
  1028. const m___INT64_MAX__ = 0x7fffffffffffffff
  1029. const m___INT8_MAX__ = 0x7f
  1030. const m___INTMAX_MAX__ = 0x7fffffffffffffff
  1031. const m___INTMAX_WIDTH__ = 64
  1032. const m___INTPTR_MAX__ = 0x7fffffffffffffff
  1033. const m___INTPTR_WIDTH__ = 64
  1034. const m___INT_FAST16_MAX__ = 0x7fffffffffffffff
  1035. const m___INT_FAST16_WIDTH__ = 64
  1036. const m___INT_FAST32_MAX__ = 0x7fffffffffffffff
  1037. const m___INT_FAST32_WIDTH__ = 64
  1038. const m___INT_FAST64_MAX__ = 0x7fffffffffffffff
  1039. const m___INT_FAST64_WIDTH__ = 64
  1040. const m___INT_FAST8_MAX__ = 0x7f
  1041. const m___INT_FAST8_WIDTH__ = 8
  1042. const m___INT_LEAST16_MAX__ = 0x7fff
  1043. const m___INT_LEAST16_WIDTH__ = 16
  1044. const m___INT_LEAST32_MAX__ = 0x7fffffff
  1045. const m___INT_LEAST32_TYPE__ = "int"
  1046. const m___INT_LEAST32_WIDTH__ = 32
  1047. const m___INT_LEAST64_MAX__ = 0x7fffffffffffffff
  1048. const m___INT_LEAST64_WIDTH__ = 64
  1049. const m___INT_LEAST8_MAX__ = 0x7f
  1050. const m___INT_LEAST8_WIDTH__ = 8
  1051. const m___INT_MAX__ = 0x7fffffff
  1052. const m___INT_WIDTH__ = 32
  1053. const m___LDBL_DECIMAL_DIG__ = 36
  1054. const m___LDBL_DENORM_MIN__ = 6.47517511943802511092443895822764655e-4966
  1055. const m___LDBL_DIG__ = 33
  1056. const m___LDBL_EPSILON__ = 1.92592994438723585305597794258492732e-34
  1057. const m___LDBL_HAS_DENORM__ = 1
  1058. const m___LDBL_HAS_INFINITY__ = 1
  1059. const m___LDBL_HAS_QUIET_NAN__ = 1
  1060. const m___LDBL_IS_IEC_60559__ = 1
  1061. const m___LDBL_MANT_DIG__ = 113
  1062. const m___LDBL_MAX_10_EXP__ = 4932
  1063. const m___LDBL_MAX_EXP__ = 16384
  1064. const m___LDBL_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1065. const m___LDBL_MIN__ = 3.36210314311209350626267781732175260e-4932
  1066. const m___LDBL_NORM_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1067. const m___LDOUBLE_REDIRECTS_TO_FLOAT128_ABI = 0
  1068. const m___LITTLE_ENDIAN = 1234
  1069. const m___LONG_LONG_MAX__ = 0x7fffffffffffffff
  1070. const m___LONG_LONG_WIDTH__ = 64
  1071. const m___LONG_MAX = 9223372036854775807
  1072. const m___LONG_MAX__ = 0x7fffffffffffffff
  1073. const m___LONG_WIDTH__ = 64
  1074. const m___LP64__ = 1
  1075. const m___NO_INLINE__ = 1
  1076. const m___ORDER_BIG_ENDIAN__ = 4321
  1077. const m___ORDER_LITTLE_ENDIAN__ = 1234
  1078. const m___ORDER_PDP_ENDIAN__ = 3412
  1079. const m___PDP_ENDIAN = 3412
  1080. const m___PIC__ = 2
  1081. const m___PIE__ = 2
  1082. const m___PRAGMA_REDEFINE_EXTNAME = 1
  1083. const m___PRETTY_FUNCTION__ = "__func__"
  1084. const m___PTRDIFF_MAX__ = 0x7fffffffffffffff
  1085. const m___PTRDIFF_WIDTH__ = 64
  1086. const m___REDIRECT_FORTIFY = "__REDIRECT"
  1087. const m___REDIRECT_FORTIFY_NTH = "__REDIRECT_NTH"
  1088. const m___REENTRANT = 1
  1089. const m___SCHAR_MAX__ = 0x7f
  1090. const m___SCHAR_WIDTH__ = 8
  1091. const m___SHRT_MAX__ = 0x7fff
  1092. const m___SHRT_WIDTH__ = 16
  1093. const m___SIG_ATOMIC_MAX__ = 0x7fffffff
  1094. const m___SIG_ATOMIC_TYPE__ = "int"
  1095. const m___SIG_ATOMIC_WIDTH__ = 32
  1096. const m___SIZEOF_DOUBLE__ = 8
  1097. const m___SIZEOF_FLOAT__ = 4
  1098. const m___SIZEOF_INT128__ = 16
  1099. const m___SIZEOF_INT__ = 4
  1100. const m___SIZEOF_LONG_DOUBLE__ = 8
  1101. const m___SIZEOF_LONG_LONG__ = 8
  1102. const m___SIZEOF_LONG__ = 8
  1103. const m___SIZEOF_POINTER__ = 8
  1104. const m___SIZEOF_PTRDIFF_T__ = 8
  1105. const m___SIZEOF_SHORT__ = 2
  1106. const m___SIZEOF_SIZE_T__ = 8
  1107. const m___SIZEOF_WCHAR_T__ = 4
  1108. const m___SIZEOF_WINT_T__ = 4
  1109. const m___SIZE_MAX__ = 0xffffffffffffffff
  1110. const m___SIZE_WIDTH__ = 64
  1111. const m___STDC_HOSTED__ = 1
  1112. const m___STDC_IEC_559_COMPLEX__ = 1
  1113. const m___STDC_IEC_559__ = 1
  1114. const m___STDC_IEC_60559_BFP__ = 201404
  1115. const m___STDC_IEC_60559_COMPLEX__ = 201404
  1116. const m___STDC_ISO_10646__ = 201706
  1117. const m___STDC_UTF_16__ = 1
  1118. const m___STDC_UTF_32__ = 1
  1119. const m___STDC_VERSION__ = 201710
  1120. const m___STDC_WANT_IEC_60559_ATTRIBS_EXT__ = 1
  1121. const m___STDC_WANT_IEC_60559_BFP_EXT__ = 1
  1122. const m___STDC_WANT_IEC_60559_DFP_EXT__ = 1
  1123. const m___STDC_WANT_IEC_60559_EXT__ = 1
  1124. const m___STDC_WANT_IEC_60559_FUNCS_EXT__ = 1
  1125. const m___STDC_WANT_IEC_60559_TYPES_EXT__ = 1
  1126. const m___STDC_WANT_LIB_EXT2__ = 1
  1127. const m___STDC_WANT_MATH_SPEC_FUNCS__ = 1
  1128. const m___STDC__ = 1
  1129. const m___UINT16_MAX__ = 0xffff
  1130. const m___UINT32_MAX__ = 0xffffffff
  1131. const m___UINT64_MAX__ = 0xffffffffffffffff
  1132. const m___UINT8_MAX__ = 0xff
  1133. const m___UINTMAX_MAX__ = 0xffffffffffffffff
  1134. const m___UINTPTR_MAX__ = 0xffffffffffffffff
  1135. const m___UINT_FAST16_MAX__ = 0xffffffffffffffff
  1136. const m___UINT_FAST32_MAX__ = 0xffffffffffffffff
  1137. const m___UINT_FAST64_MAX__ = 0xffffffffffffffff
  1138. const m___UINT_FAST8_MAX__ = 0xff
  1139. const m___UINT_LEAST16_MAX__ = 0xffff
  1140. const m___UINT_LEAST32_MAX__ = 0xffffffff
  1141. const m___UINT_LEAST64_MAX__ = 0xffffffffffffffff
  1142. const m___UINT_LEAST8_MAX__ = 0xff
  1143. const m___USE_TIME_BITS64 = 1
  1144. const m___VERSION__ = "14.2.0"
  1145. const m___WCHAR_MAX__ = 0x7fffffff
  1146. const m___WCHAR_TYPE__ = "int"
  1147. const m___WCHAR_WIDTH__ = 32
  1148. const m___WINT_MAX__ = 0xffffffff
  1149. const m___WINT_MIN__ = 0
  1150. const m___WINT_WIDTH__ = 32
  1151. const m___WORDSIZE = "__riscv_xlen"
  1152. const m___WORDSIZE_TIME64_COMPAT32 = 1
  1153. const m___glibc_c99_flexarr_available = 1
  1154. const m___gnu_linux__ = 1
  1155. const m___inline = "inline"
  1156. const m___linux = 1
  1157. const m___linux__ = 1
  1158. const m___pic__ = 2
  1159. const m___pie__ = 2
  1160. const m___restrict = "restrict"
  1161. const m___riscv = 1
  1162. const m___riscv_a = 2001000
  1163. const m___riscv_arch_test = 1
  1164. const m___riscv_atomic = 1
  1165. const m___riscv_c = 2000000
  1166. const m___riscv_cmodel_medany = 1
  1167. const m___riscv_compressed = 1
  1168. const m___riscv_d = 2002000
  1169. const m___riscv_div = 1
  1170. const m___riscv_f = 2002000
  1171. const m___riscv_fdiv = 1
  1172. const m___riscv_flen = 64
  1173. const m___riscv_float_abi_double = 1
  1174. const m___riscv_fsqrt = 1
  1175. const m___riscv_i = 2001000
  1176. const m___riscv_m = 2000000
  1177. const m___riscv_misaligned_slow = 1
  1178. const m___riscv_mul = 1
  1179. const m___riscv_muldiv = 1
  1180. const m___riscv_xlen = 64
  1181. const m___riscv_zicsr = 2000000
  1182. const m___riscv_zifencei = 2000000
  1183. const m___ucontext = "ucontext"
  1184. const m___unix = 1
  1185. const m___unix__ = 1
  1186. const m_alloca = "__builtin_alloca"
  1187. const m_linux = 1
  1188. const m_unix = 1
  1189. type t__builtin_va_list = uintptr
  1190. type t__predefined_size_t = uint64
  1191. type t__predefined_wchar_t = int32
  1192. type t__predefined_ptrdiff_t = int64
  1193. type Tblksize_t = int32
  1194. type Tnlink_t = uint32
  1195. type Tsize_t = uint64
  1196. type Tssize_t = int64
  1197. type Tregister_t = int64
  1198. type Ttime_t = int64
  1199. type Tsuseconds_t = int64
  1200. type Tint8_t = int8
  1201. type Tint16_t = int16
  1202. type Tint32_t = int32
  1203. type Tint64_t = int64
  1204. type Tu_int64_t = uint64
  1205. type Tmode_t = uint32
  1206. type Toff_t = int64
  1207. type Tino_t = uint64
  1208. type Tdev_t = uint64
  1209. type Tblkcnt_t = int64
  1210. type Tfsblkcnt_t = uint64
  1211. type Tfsfilcnt_t = uint64
  1212. type Ttimer_t = uintptr
  1213. type Tclockid_t = int32
  1214. type Tclock_t = int64
  1215. type Tpid_t = int32
  1216. type Tid_t = uint32
  1217. type Tuid_t = uint32
  1218. type Tgid_t = uint32
  1219. type Tkey_t = int32
  1220. type Tuseconds_t = uint32
  1221. type Tpthread_t = uintptr
  1222. type Tpthread_once_t = int32
  1223. type Tpthread_key_t = uint32
  1224. type Tpthread_spinlock_t = int32
  1225. type Tpthread_mutexattr_t = struct {
  1226. F__attr uint32
  1227. }
  1228. type Tpthread_condattr_t = struct {
  1229. F__attr uint32
  1230. }
  1231. type Tpthread_barrierattr_t = struct {
  1232. F__attr uint32
  1233. }
  1234. type Tpthread_rwlockattr_t = struct {
  1235. F__attr [2]uint32
  1236. }
  1237. type Tpthread_attr_t = struct {
  1238. F__u struct {
  1239. F__vi [0][14]int32
  1240. F__s [0][7]uint64
  1241. F__i [14]int32
  1242. }
  1243. }
  1244. type Tpthread_mutex_t = struct {
  1245. F__u struct {
  1246. F__vi [0][10]int32
  1247. F__p [0][5]uintptr
  1248. F__i [10]int32
  1249. }
  1250. }
  1251. type Tpthread_cond_t = struct {
  1252. F__u struct {
  1253. F__vi [0][12]int32
  1254. F__p [0][6]uintptr
  1255. F__i [12]int32
  1256. }
  1257. }
  1258. type Tpthread_rwlock_t = struct {
  1259. F__u struct {
  1260. F__vi [0][14]int32
  1261. F__p [0][7]uintptr
  1262. F__i [14]int32
  1263. }
  1264. }
  1265. type Tpthread_barrier_t = struct {
  1266. F__u struct {
  1267. F__vi [0][8]int32
  1268. F__p [0][4]uintptr
  1269. F__i [8]int32
  1270. }
  1271. }
  1272. type Tu_int8_t = uint8
  1273. type Tu_int16_t = uint16
  1274. type Tu_int32_t = uint32
  1275. type Tcaddr_t = uintptr
  1276. type Tu_char = uint8
  1277. type Tu_short = uint16
  1278. type Tushort = uint16
  1279. type Tu_int = uint32
  1280. type Tuint = uint32
  1281. type Tu_long = uint64
  1282. type Tulong = uint64
  1283. type Tquad_t = int64
  1284. type Tu_quad_t = uint64
  1285. type Tuint16_t = uint16
  1286. type Tuint32_t = uint32
  1287. type Tuint64_t = uint64
  1288. type Ttimeval = struct {
  1289. Ftv_sec Ttime_t
  1290. Ftv_usec Tsuseconds_t
  1291. }
  1292. type Ttimespec = struct {
  1293. Ftv_sec Ttime_t
  1294. Ftv_nsec int64
  1295. }
  1296. type Tsigset_t = struct {
  1297. F__bits [16]uint64
  1298. }
  1299. type t__sigset_t = Tsigset_t
  1300. type Tfd_mask = uint64
  1301. type Tfd_set = struct {
  1302. Ffds_bits [16]uint64
  1303. }
  1304. type Tstat = struct {
  1305. Fst_dev Tdev_t
  1306. Fst_ino Tino_t
  1307. Fst_mode Tmode_t
  1308. Fst_nlink Tnlink_t
  1309. Fst_uid Tuid_t
  1310. Fst_gid Tgid_t
  1311. Fst_rdev Tdev_t
  1312. F__pad uint64
  1313. Fst_size Toff_t
  1314. Fst_blksize Tblksize_t
  1315. F__pad2 int32
  1316. Fst_blocks Tblkcnt_t
  1317. Fst_atim Ttimespec
  1318. Fst_mtim Ttimespec
  1319. Fst_ctim Ttimespec
  1320. F__unused [2]uint32
  1321. }
  1322. type Tstatx_timestamp = struct {
  1323. Ftv_sec Tint64_t
  1324. Ftv_nsec Tuint32_t
  1325. F__pad Tuint32_t
  1326. }
  1327. type Tstatx = struct {
  1328. Fstx_mask Tuint32_t
  1329. Fstx_blksize Tuint32_t
  1330. Fstx_attributes Tuint64_t
  1331. Fstx_nlink Tuint32_t
  1332. Fstx_uid Tuint32_t
  1333. Fstx_gid Tuint32_t
  1334. Fstx_mode Tuint16_t
  1335. F__pad0 [1]Tuint16_t
  1336. Fstx_ino Tuint64_t
  1337. Fstx_size Tuint64_t
  1338. Fstx_blocks Tuint64_t
  1339. Fstx_attributes_mask Tuint64_t
  1340. Fstx_atime Tstatx_timestamp
  1341. Fstx_btime Tstatx_timestamp
  1342. Fstx_ctime Tstatx_timestamp
  1343. Fstx_mtime Tstatx_timestamp
  1344. Fstx_rdev_major Tuint32_t
  1345. Fstx_rdev_minor Tuint32_t
  1346. Fstx_dev_major Tuint32_t
  1347. Fstx_dev_minor Tuint32_t
  1348. F__pad1 [14]Tuint64_t
  1349. }
  1350. type Twchar_t = int32
  1351. type Tmax_align_t = struct {
  1352. F__ll int64
  1353. F__ld float64
  1354. }
  1355. type Tptrdiff_t = int64
  1356. type Tlocale_t = uintptr
  1357. type Tstack_t = struct {
  1358. Fss_sp uintptr
  1359. Fss_flags int32
  1360. Fss_size Tsize_t
  1361. }
  1362. type Tsigaltstack = Tstack_t
  1363. type t__riscv_mc_gp_state = [32]uint64
  1364. type t__riscv_mc_f_ext_state = struct {
  1365. F__f [32]uint32
  1366. F__fcsr uint32
  1367. }
  1368. type t__riscv_mc_d_ext_state = struct {
  1369. F__f [32]uint64
  1370. F__fcsr uint32
  1371. }
  1372. type t__riscv_mc_q_ext_state = struct {
  1373. F__f [64]uint64
  1374. F__fcsr uint32
  1375. F__reserved [3]uint32
  1376. }
  1377. type t__riscv_mc_fp_state = struct {
  1378. F__d [0]t__riscv_mc_d_ext_state
  1379. F__q [0]t__riscv_mc_q_ext_state
  1380. F__f t__riscv_mc_f_ext_state
  1381. F__ccgo_pad3 [396]byte
  1382. }
  1383. type Tmcontext_t = struct {
  1384. F__gregs t__riscv_mc_gp_state
  1385. F__fpregs t__riscv_mc_fp_state
  1386. }
  1387. type Tgreg_t = uint64
  1388. type Tgregset_t = [32]uint64
  1389. type Tfpregset_t = struct {
  1390. F__d [0]t__riscv_mc_d_ext_state
  1391. F__q [0]t__riscv_mc_q_ext_state
  1392. F__f t__riscv_mc_f_ext_state
  1393. F__ccgo_pad3 [396]byte
  1394. }
  1395. type Tsigcontext = struct {
  1396. Fgregs Tgregset_t
  1397. Ffpregs Tfpregset_t
  1398. }
  1399. type Tucontext_t = struct {
  1400. Fuc_flags uint64
  1401. Fuc_link uintptr
  1402. Fuc_stack Tstack_t
  1403. Fuc_sigmask Tsigset_t
  1404. Fuc_mcontext Tmcontext_t
  1405. }
  1406. type Tucontext = Tucontext_t
  1407. type Tsigval = struct {
  1408. Fsival_ptr [0]uintptr
  1409. Fsival_int int32
  1410. F__ccgo_pad2 [4]byte
  1411. }
  1412. type Tsiginfo_t = struct {
  1413. Fsi_signo int32
  1414. Fsi_errno int32
  1415. Fsi_code int32
  1416. F__si_fields struct {
  1417. F__si_common [0]struct {
  1418. F__first struct {
  1419. F__timer [0]struct {
  1420. Fsi_timerid int32
  1421. Fsi_overrun int32
  1422. }
  1423. F__piduid struct {
  1424. Fsi_pid Tpid_t
  1425. Fsi_uid Tuid_t
  1426. }
  1427. }
  1428. F__second struct {
  1429. F__sigchld [0]struct {
  1430. Fsi_status int32
  1431. Fsi_utime Tclock_t
  1432. Fsi_stime Tclock_t
  1433. }
  1434. Fsi_value Tsigval
  1435. F__ccgo_pad2 [16]byte
  1436. }
  1437. }
  1438. F__sigfault [0]struct {
  1439. Fsi_addr uintptr
  1440. Fsi_addr_lsb int16
  1441. F__first struct {
  1442. Fsi_pkey [0]uint32
  1443. F__addr_bnd struct {
  1444. Fsi_lower uintptr
  1445. Fsi_upper uintptr
  1446. }
  1447. }
  1448. }
  1449. F__sigpoll [0]struct {
  1450. Fsi_band int64
  1451. Fsi_fd int32
  1452. }
  1453. F__sigsys [0]struct {
  1454. Fsi_call_addr uintptr
  1455. Fsi_syscall int32
  1456. Fsi_arch uint32
  1457. }
  1458. F__pad [112]uint8
  1459. }
  1460. }
  1461. type Tsigaction = struct {
  1462. F__sa_handler struct {
  1463. Fsa_sigaction [0]uintptr
  1464. Fsa_handler uintptr
  1465. }
  1466. Fsa_mask Tsigset_t
  1467. Fsa_flags int32
  1468. Fsa_restorer uintptr
  1469. }
  1470. type Tsigevent = struct {
  1471. Fsigev_value Tsigval
  1472. Fsigev_signo int32
  1473. Fsigev_notify int32
  1474. F__sev_fields struct {
  1475. Fsigev_notify_thread_id [0]Tpid_t
  1476. F__sev_thread [0]struct {
  1477. Fsigev_notify_function uintptr
  1478. Fsigev_notify_attributes uintptr
  1479. }
  1480. F__pad [48]uint8
  1481. }
  1482. }
  1483. type Tsig_t = uintptr
  1484. type Tsighandler_t = uintptr
  1485. type Tsig_atomic_t = int32
  1486. type Tdiv_t = struct {
  1487. Fquot int32
  1488. Frem int32
  1489. }
  1490. type Tldiv_t = struct {
  1491. Fquot int64
  1492. Frem int64
  1493. }
  1494. type Tlldiv_t = struct {
  1495. Fquot int64
  1496. Frem int64
  1497. }
  1498. type Tuintptr_t = uint64
  1499. type Tintptr_t = int64
  1500. type Tintmax_t = int64
  1501. type Tuint8_t = uint8
  1502. type Tuintmax_t = uint64
  1503. type Tint_fast8_t = int8
  1504. type Tint_fast64_t = int64
  1505. type Tint_least8_t = int8
  1506. type Tint_least16_t = int16
  1507. type Tint_least32_t = int32
  1508. type Tint_least64_t = int64
  1509. type Tuint_fast8_t = uint8
  1510. type Tuint_fast64_t = uint64
  1511. type Tuint_least8_t = uint8
  1512. type Tuint_least16_t = uint16
  1513. type Tuint_least32_t = uint32
  1514. type Tuint_least64_t = uint64
  1515. type Tint_fast16_t = int32
  1516. type Tint_fast32_t = int32
  1517. type Tuint_fast16_t = uint32
  1518. type Tuint_fast32_t = uint32
  1519. type Tva_list = uintptr
  1520. type t__isoc_va_list = uintptr
  1521. type Tfpos_t = struct {
  1522. F__lldata [0]int64
  1523. F__align [0]float64
  1524. F__opaque [16]uint8
  1525. }
  1526. type T_G_fpos64_t = Tfpos_t
  1527. type Tcookie_io_functions_t = struct {
  1528. Fread uintptr
  1529. Fwrite uintptr
  1530. Fseek uintptr
  1531. Fclose1 uintptr
  1532. }
  1533. type T_IO_cookie_io_functions_t = Tcookie_io_functions_t
  1534. type TBITCMD = struct {
  1535. Fcmd uint8
  1536. Fcmd2 uint8
  1537. Fbits Tmode_t
  1538. }
  1539. type Tbitcmd = TBITCMD
  1540. // C documentation
  1541. //
  1542. // /*
  1543. // * Given the old mode and an array of bitcmd structures, apply the operations
  1544. // * described in the bitcmd structures to the old mode, and return the new mode.
  1545. // * Note that there is no '=' command; a strict assignment is just a '-' (clear
  1546. // * bits) followed by a '+' (set bits).
  1547. // */
  1548. func Xgetmode(tls *libc.TLS, bbox uintptr, omode Tmode_t) (r Tmode_t) {
  1549. var clrval, newmode, value Tmode_t
  1550. var set uintptr
  1551. var v11 uint32
  1552. _, _, _, _, _ = clrval, newmode, set, value, v11
  1553. set = bbox
  1554. newmode = omode
  1555. value = uint32(0)
  1556. for {
  1557. switch libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd) {
  1558. case int32('u'):
  1559. goto _2
  1560. case int32('g'):
  1561. goto _3
  1562. case int32('o'):
  1563. goto _4
  1564. case int32('+'):
  1565. goto _5
  1566. case int32('-'):
  1567. goto _6
  1568. case int32('X'):
  1569. goto _7
  1570. default:
  1571. goto _8
  1572. case int32('\000'):
  1573. goto _9
  1574. }
  1575. goto _10
  1576. /*
  1577. * When copying the user, group or other bits around, we "know"
  1578. * where the bits are in the mode so that we can do shifts to
  1579. * copy them around. If we don't use shifts, it gets real
  1580. * grundgy with lots of single bit checks and bit sets.
  1581. */
  1582. _2:
  1583. ;
  1584. value = newmode & uint32(m_S_IRWXU) >> int32(6)
  1585. goto common
  1586. _3:
  1587. ;
  1588. value = newmode & uint32(m_S_IRWXG) >> int32(3)
  1589. goto common
  1590. _4:
  1591. ;
  1592. value = newmode & uint32(m_S_IRWXO)
  1593. goto common
  1594. common:
  1595. ;
  1596. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_CLR) != 0 {
  1597. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_SET) != 0 {
  1598. v11 = uint32(m_S_IRWXO)
  1599. } else {
  1600. v11 = value
  1601. }
  1602. clrval = v11
  1603. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_UBITS) != 0 {
  1604. newmode &= ^(clrval << libc.Int32FromInt32(6) & (*TBITCMD)(unsafe.Pointer(set)).Fbits)
  1605. }
  1606. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_GBITS) != 0 {
  1607. newmode &= ^(clrval << libc.Int32FromInt32(3) & (*TBITCMD)(unsafe.Pointer(set)).Fbits)
  1608. }
  1609. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_OBITS) != 0 {
  1610. newmode &= ^(clrval & (*TBITCMD)(unsafe.Pointer(set)).Fbits)
  1611. }
  1612. }
  1613. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_SET) != 0 {
  1614. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_UBITS) != 0 {
  1615. newmode |= value << libc.Int32FromInt32(6) & (*TBITCMD)(unsafe.Pointer(set)).Fbits
  1616. }
  1617. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_GBITS) != 0 {
  1618. newmode |= value << libc.Int32FromInt32(3) & (*TBITCMD)(unsafe.Pointer(set)).Fbits
  1619. }
  1620. if libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(set)).Fcmd2)&int32(m_CMD2_OBITS) != 0 {
  1621. newmode |= value & (*TBITCMD)(unsafe.Pointer(set)).Fbits
  1622. }
  1623. }
  1624. goto _10
  1625. _5:
  1626. ;
  1627. newmode |= (*TBITCMD)(unsafe.Pointer(set)).Fbits
  1628. goto _10
  1629. _6:
  1630. ;
  1631. newmode &= ^(*TBITCMD)(unsafe.Pointer(set)).Fbits
  1632. goto _10
  1633. _7:
  1634. ;
  1635. 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 {
  1636. newmode |= (*TBITCMD)(unsafe.Pointer(set)).Fbits
  1637. }
  1638. goto _10
  1639. _9:
  1640. ;
  1641. _8:
  1642. ;
  1643. return newmode
  1644. _10:
  1645. ;
  1646. goto _1
  1647. _1:
  1648. ;
  1649. set += 8
  1650. }
  1651. return r
  1652. }
  1653. func Xsetmode(tls *libc.TLS, p uintptr) (r uintptr) {
  1654. bp := tls.Alloc(272)
  1655. defer tls.Free(272)
  1656. var endset, newset, newset1, newset2, newset3, newset4, newset5, saveset, set, v5 uintptr
  1657. var equalopdone, serrno, setlen int32
  1658. var lval int64
  1659. var mask, perm, permXbits, who, v1 Tmode_t
  1660. var op, v4 uint8
  1661. var setdiff, setdiff1, setdiff2, setdiff3, setdiff4, setdiff5 Tptrdiff_t
  1662. var _ /* ep at bp+0 */ uintptr
  1663. var _ /* signset at bp+8 */ Tsigset_t
  1664. var _ /* sigoset at bp+136 */ Tsigset_t
  1665. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  1666. equalopdone = 0
  1667. if !(*(*uint8)(unsafe.Pointer(p)) != 0) {
  1668. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  1669. return libc.UintptrFromInt32(0)
  1670. }
  1671. /*
  1672. * Get a copy of the mask for the permissions that are mask relative.
  1673. * Flip the bits, we want what's not set. Since it's possible that
  1674. * the caller is opening files inside a signal handler, protect them
  1675. * as best we can.
  1676. */
  1677. libc.Xsigfillset(tls, bp+8)
  1678. libc.Xsigprocmask(tls, m_SIG_BLOCK, bp+8, bp+136)
  1679. v1 = libc.Xumask(tls, uint32(0))
  1680. mask = v1
  1681. libc.Xumask(tls, v1)
  1682. mask = ^mask
  1683. libc.Xsigprocmask(tls, int32(m_SIG_SETMASK), bp+136, libc.UintptrFromInt32(0))
  1684. setlen = libc.Int32FromInt32(m_SET_LEN) + libc.Int32FromInt32(2)
  1685. set = Xreallocarray(tls, libc.UintptrFromInt32(0), libc.Uint64FromInt32(setlen), uint64(8))
  1686. if set == libc.UintptrFromInt32(0) {
  1687. return libc.UintptrFromInt32(0)
  1688. }
  1689. saveset = set
  1690. endset = set + uintptr(setlen-libc.Int32FromInt32(2))*8
  1691. /*
  1692. * If an absolute number, get it and return; disallow non-octal digits
  1693. * or illegal bits.
  1694. */
  1695. if libc.BoolInt32(uint32(*(*uint8)(unsafe.Pointer(p)))-uint32('0') < uint32(10)) != 0 {
  1696. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  1697. lval = libc.Xstrtol(tls, p, bp, int32(8))
  1698. if *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))) != 0 {
  1699. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  1700. goto out
  1701. }
  1702. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_ERANGE) && (lval == int64(0x7fffffffffffffff) || lval == -libc.Int64FromInt64(0x7fffffffffffffff)-libc.Int64FromInt32(1)) {
  1703. goto out
  1704. }
  1705. 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 {
  1706. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  1707. goto out
  1708. }
  1709. perm = libc.Uint32FromInt64(lval)
  1710. if set >= endset {
  1711. setdiff = (int64(set) - int64(saveset)) / 8
  1712. setlen += int32(m_SET_LEN_INCR)
  1713. newset = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  1714. if newset == libc.UintptrFromInt32(0) {
  1715. goto out
  1716. }
  1717. set = newset + uintptr(setdiff)*8
  1718. saveset = newset
  1719. endset = newset + uintptr(setlen-libc.Int32FromInt32(2))*8
  1720. }
  1721. 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)
  1722. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8(0)
  1723. return saveset
  1724. }
  1725. /*
  1726. * Build list of structures to set/clear/copy bits as described by
  1727. * each clause of the symbolic mode.
  1728. */
  1729. for {
  1730. /* First, find out which bits might be modified. */
  1731. who = uint32(0)
  1732. for {
  1733. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) {
  1734. case int32('a'):
  1735. 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))
  1736. case int32('u'):
  1737. who |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_ISUID) | libc.Int32FromInt32(m_S_IRWXU))
  1738. case int32('g'):
  1739. who |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_ISGID) | libc.Int32FromInt32(m_S_IRWXG))
  1740. case int32('o'):
  1741. who |= uint32(m_S_IRWXO)
  1742. default:
  1743. goto getop
  1744. }
  1745. goto _3
  1746. _3:
  1747. ;
  1748. p++
  1749. }
  1750. goto getop
  1751. getop:
  1752. ;
  1753. v5 = p
  1754. p++
  1755. v4 = *(*uint8)(unsafe.Pointer(v5))
  1756. op = v4
  1757. if libc.Int32FromUint8(v4) != int32('+') && libc.Int32FromUint8(op) != int32('-') && libc.Int32FromUint8(op) != int32('=') {
  1758. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  1759. goto out
  1760. }
  1761. if libc.Int32FromUint8(op) == int32('=') {
  1762. equalopdone = 0
  1763. }
  1764. who &= libc.Uint32FromInt32(^libc.Int32FromInt32(m_S_ISVTX))
  1765. perm = uint32(0)
  1766. permXbits = libc.Uint32FromInt32(0)
  1767. for {
  1768. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) {
  1769. case int32('r'):
  1770. perm |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IRUSR) | libc.Int32FromInt32(m_S_IRGRP) | libc.Int32FromInt32(m_S_IROTH))
  1771. case int32('s'):
  1772. /*
  1773. * If specific bits where requested and
  1774. * only "other" bits ignore set-id.
  1775. */
  1776. if who == uint32(0) || who&libc.Uint32FromInt32(^libc.Int32FromInt32(m_S_IRWXO)) != 0 {
  1777. perm |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_ISUID) | libc.Int32FromInt32(m_S_ISGID))
  1778. }
  1779. case int32('t'):
  1780. /*
  1781. * If specific bits where requested and
  1782. * only "other" bits ignore set-id.
  1783. */
  1784. if who == uint32(0) || who&libc.Uint32FromInt32(^libc.Int32FromInt32(m_S_IRWXO)) != 0 {
  1785. who |= uint32(m_S_ISVTX)
  1786. perm |= uint32(m_S_ISVTX)
  1787. }
  1788. case int32('w'):
  1789. perm |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IWUSR) | libc.Int32FromInt32(m_S_IWGRP) | libc.Int32FromInt32(m_S_IWOTH))
  1790. case int32('X'):
  1791. permXbits = libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXUSR) | libc.Int32FromInt32(m_S_IXGRP) | libc.Int32FromInt32(m_S_IXOTH))
  1792. case int32('x'):
  1793. perm |= libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXUSR) | libc.Int32FromInt32(m_S_IXGRP) | libc.Int32FromInt32(m_S_IXOTH))
  1794. case int32('u'):
  1795. fallthrough
  1796. case int32('g'):
  1797. fallthrough
  1798. case int32('o'):
  1799. /*
  1800. * When ever we hit 'u', 'g', or 'o', we have
  1801. * to flush out any partial mode that we have,
  1802. * and then do the copying of the mode bits.
  1803. */
  1804. if perm != 0 {
  1805. if set >= endset {
  1806. setdiff1 = (int64(set) - int64(saveset)) / 8
  1807. setlen += int32(m_SET_LEN_INCR)
  1808. newset1 = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  1809. if newset1 == libc.UintptrFromInt32(0) {
  1810. goto out
  1811. }
  1812. set = newset1 + uintptr(setdiff1)*8
  1813. saveset = newset1
  1814. endset = newset1 + uintptr(setlen-libc.Int32FromInt32(2))*8
  1815. }
  1816. set = _addcmd(tls, set, uint32(op), who, perm, mask)
  1817. perm = uint32(0)
  1818. }
  1819. if libc.Int32FromUint8(op) == int32('=') {
  1820. equalopdone = int32(1)
  1821. }
  1822. if libc.Int32FromUint8(op) == int32('+') && permXbits != 0 {
  1823. if set >= endset {
  1824. setdiff2 = (int64(set) - int64(saveset)) / 8
  1825. setlen += int32(m_SET_LEN_INCR)
  1826. newset2 = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  1827. if newset2 == libc.UintptrFromInt32(0) {
  1828. goto out
  1829. }
  1830. set = newset2 + uintptr(setdiff2)*8
  1831. saveset = newset2
  1832. endset = newset2 + uintptr(setlen-libc.Int32FromInt32(2))*8
  1833. }
  1834. set = _addcmd(tls, set, libc.Uint32FromInt32(libc.Int32FromUint8('X')), who, permXbits, mask)
  1835. permXbits = uint32(0)
  1836. }
  1837. if set >= endset {
  1838. setdiff3 = (int64(set) - int64(saveset)) / 8
  1839. setlen += int32(m_SET_LEN_INCR)
  1840. newset3 = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  1841. if newset3 == libc.UintptrFromInt32(0) {
  1842. goto out
  1843. }
  1844. set = newset3 + uintptr(setdiff3)*8
  1845. saveset = newset3
  1846. endset = newset3 + uintptr(setlen-libc.Int32FromInt32(2))*8
  1847. }
  1848. set = _addcmd(tls, set, uint32(*(*uint8)(unsafe.Pointer(p))), who, uint32(op), mask)
  1849. default:
  1850. /*
  1851. * Add any permissions that we haven't already
  1852. * done.
  1853. */
  1854. if perm != 0 || libc.Int32FromUint8(op) == int32('=') && !(equalopdone != 0) {
  1855. if libc.Int32FromUint8(op) == int32('=') {
  1856. equalopdone = int32(1)
  1857. }
  1858. if set >= endset {
  1859. setdiff4 = (int64(set) - int64(saveset)) / 8
  1860. setlen += int32(m_SET_LEN_INCR)
  1861. newset4 = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  1862. if newset4 == libc.UintptrFromInt32(0) {
  1863. goto out
  1864. }
  1865. set = newset4 + uintptr(setdiff4)*8
  1866. saveset = newset4
  1867. endset = newset4 + uintptr(setlen-libc.Int32FromInt32(2))*8
  1868. }
  1869. set = _addcmd(tls, set, uint32(op), who, perm, mask)
  1870. perm = uint32(0)
  1871. }
  1872. if permXbits != 0 {
  1873. if set >= endset {
  1874. setdiff5 = (int64(set) - int64(saveset)) / 8
  1875. setlen += int32(m_SET_LEN_INCR)
  1876. newset5 = Xreallocarray(tls, saveset, libc.Uint64FromInt32(setlen), uint64(8))
  1877. if newset5 == libc.UintptrFromInt32(0) {
  1878. goto out
  1879. }
  1880. set = newset5 + uintptr(setdiff5)*8
  1881. saveset = newset5
  1882. endset = newset5 + uintptr(setlen-libc.Int32FromInt32(2))*8
  1883. }
  1884. set = _addcmd(tls, set, libc.Uint32FromInt32(libc.Int32FromUint8('X')), who, permXbits, mask)
  1885. permXbits = uint32(0)
  1886. }
  1887. goto apply
  1888. }
  1889. goto _6
  1890. _6:
  1891. ;
  1892. p++
  1893. }
  1894. goto apply
  1895. apply:
  1896. ;
  1897. if !(*(*uint8)(unsafe.Pointer(p)) != 0) {
  1898. break
  1899. }
  1900. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) != int32(',') {
  1901. goto getop
  1902. }
  1903. p++
  1904. goto _2
  1905. _2:
  1906. }
  1907. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8(0)
  1908. _compress_mode(tls, saveset)
  1909. return saveset
  1910. goto out
  1911. out:
  1912. ;
  1913. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  1914. libc.Xfree(tls, saveset)
  1915. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  1916. return libc.UintptrFromInt32(0)
  1917. }
  1918. func _addcmd(tls *libc.TLS, set uintptr, op Tmode_t, who Tmode_t, oparg Tmode_t, mask Tmode_t) (r uintptr) {
  1919. var v1, v2 uint32
  1920. var v3, v4, v5 int32
  1921. var p6, p7, p8 uintptr
  1922. _, _, _, _, _, _, _, _ = v1, v2, v3, v4, v5, p6, p7, p8
  1923. switch op {
  1924. case uint32('='):
  1925. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8('-')
  1926. if who != 0 {
  1927. v1 = who
  1928. } else {
  1929. 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))
  1930. }
  1931. (*TBITCMD)(unsafe.Pointer(set)).Fbits = v1
  1932. set += 8
  1933. op = uint32('+')
  1934. /* FALLTHROUGH */
  1935. fallthrough
  1936. case uint32('+'):
  1937. fallthrough
  1938. case uint32('-'):
  1939. fallthrough
  1940. case uint32('X'):
  1941. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8(op)
  1942. if who != 0 {
  1943. v2 = who
  1944. } else {
  1945. v2 = mask
  1946. }
  1947. (*TBITCMD)(unsafe.Pointer(set)).Fbits = v2 & oparg
  1948. case uint32('u'):
  1949. fallthrough
  1950. case uint32('g'):
  1951. fallthrough
  1952. case uint32('o'):
  1953. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8(op)
  1954. if who != 0 {
  1955. if who&uint32(m_S_IRUSR) != 0 {
  1956. v3 = int32(m_CMD2_UBITS)
  1957. } else {
  1958. v3 = 0
  1959. }
  1960. if who&uint32(m_S_IRGRP) != 0 {
  1961. v4 = int32(m_CMD2_GBITS)
  1962. } else {
  1963. v4 = 0
  1964. }
  1965. if who&uint32(m_S_IROTH) != 0 {
  1966. v5 = int32(m_CMD2_OBITS)
  1967. } else {
  1968. v5 = 0
  1969. }
  1970. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = libc.Uint8FromInt32(v3 | v4 | v5)
  1971. (*TBITCMD)(unsafe.Pointer(set)).Fbits = libc.Uint32FromInt32(^libc.Int32FromInt32(0))
  1972. } else {
  1973. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = libc.Uint8FromInt32(libc.Int32FromInt32(m_CMD2_UBITS) | libc.Int32FromInt32(m_CMD2_GBITS) | libc.Int32FromInt32(m_CMD2_OBITS))
  1974. (*TBITCMD)(unsafe.Pointer(set)).Fbits = mask
  1975. }
  1976. if oparg == uint32('+') {
  1977. p6 = set + 1
  1978. *(*uint8)(unsafe.Pointer(p6)) = uint8(int32(*(*uint8)(unsafe.Pointer(p6))) | libc.Int32FromInt32(m_CMD2_SET))
  1979. } else {
  1980. if oparg == uint32('-') {
  1981. p7 = set + 1
  1982. *(*uint8)(unsafe.Pointer(p7)) = uint8(int32(*(*uint8)(unsafe.Pointer(p7))) | libc.Int32FromInt32(m_CMD2_CLR))
  1983. } else {
  1984. if oparg == uint32('=') {
  1985. p8 = set + 1
  1986. *(*uint8)(unsafe.Pointer(p8)) = uint8(int32(*(*uint8)(unsafe.Pointer(p8))) | (libc.Int32FromInt32(m_CMD2_SET) | libc.Int32FromInt32(m_CMD2_CLR)))
  1987. }
  1988. }
  1989. }
  1990. break
  1991. }
  1992. return set + libc.UintptrFromInt32(1)*8
  1993. }
  1994. // C documentation
  1995. //
  1996. // /*
  1997. // * Given an array of bitcmd structures, compress by compacting consecutive
  1998. // * '+', '-' and 'X' commands into at most 3 commands, one of each. The 'u',
  1999. // * 'g' and 'o' commands continue to be separate. They could probably be
  2000. // * compacted, but it's not worth the effort.
  2001. // */
  2002. func _compress_mode(tls *libc.TLS, set uintptr) {
  2003. var Xbits, clrbits, op, setbits, v2, v6, v7, v8 int32
  2004. var nset, v3, v4 uintptr
  2005. _, _, _, _, _, _, _, _, _, _, _ = Xbits, clrbits, nset, op, setbits, v2, v3, v4, v6, v7, v8
  2006. nset = set
  2007. for {
  2008. /* Copy over any 'u', 'g' and 'o' commands. */
  2009. for {
  2010. v2 = libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(nset)).Fcmd)
  2011. op = v2
  2012. if !(v2 != int32('+') && op != int32('-') && op != int32('X')) {
  2013. break
  2014. }
  2015. v3 = set
  2016. set += 8
  2017. v4 = nset
  2018. nset += 8
  2019. *(*TBITCMD)(unsafe.Pointer(v3)) = *(*TBITCMD)(unsafe.Pointer(v4))
  2020. if !(op != 0) {
  2021. return
  2022. }
  2023. }
  2024. v7 = libc.Int32FromInt32(0)
  2025. Xbits = v7
  2026. v6 = v7
  2027. clrbits = v6
  2028. setbits = v6
  2029. for {
  2030. v8 = libc.Int32FromUint8((*TBITCMD)(unsafe.Pointer(nset)).Fcmd)
  2031. op = v8
  2032. if v8 == int32('-') {
  2033. clrbits = int32(uint32(clrbits) | (*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  2034. setbits = int32(uint32(setbits) & ^(*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  2035. Xbits = int32(uint32(Xbits) & ^(*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  2036. } else {
  2037. if op == int32('+') {
  2038. setbits = int32(uint32(setbits) | (*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  2039. clrbits = int32(uint32(clrbits) & ^(*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  2040. Xbits = int32(uint32(Xbits) & ^(*TBITCMD)(unsafe.Pointer(nset)).Fbits)
  2041. } else {
  2042. if op == int32('X') {
  2043. Xbits = int32(uint32(Xbits) | (*TBITCMD)(unsafe.Pointer(nset)).Fbits&libc.Uint32FromInt32(^setbits))
  2044. } else {
  2045. break
  2046. }
  2047. }
  2048. }
  2049. goto _5
  2050. _5:
  2051. ;
  2052. nset += 8
  2053. }
  2054. if clrbits != 0 {
  2055. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8('-')
  2056. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = uint8(0)
  2057. (*TBITCMD)(unsafe.Pointer(set)).Fbits = libc.Uint32FromInt32(clrbits)
  2058. set += 8
  2059. }
  2060. if setbits != 0 {
  2061. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8('+')
  2062. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = uint8(0)
  2063. (*TBITCMD)(unsafe.Pointer(set)).Fbits = libc.Uint32FromInt32(setbits)
  2064. set += 8
  2065. }
  2066. if Xbits != 0 {
  2067. (*TBITCMD)(unsafe.Pointer(set)).Fcmd = uint8('X')
  2068. (*TBITCMD)(unsafe.Pointer(set)).Fcmd2 = uint8(0)
  2069. (*TBITCMD)(unsafe.Pointer(set)).Fbits = libc.Uint32FromInt32(Xbits)
  2070. set += 8
  2071. }
  2072. goto _1
  2073. _1:
  2074. }
  2075. }
  2076. const m_AT_EACCESS = 0x200
  2077. const m_AT_EMPTY_PATH = 0x1000
  2078. const m_AT_NO_AUTOMOUNT = 0x800
  2079. const m_AT_RECURSIVE = 0x8000
  2080. const m_AT_REMOVEDIR = 0x200
  2081. const m_AT_STATX_DONT_SYNC = 0x4000
  2082. const m_AT_STATX_FORCE_SYNC = 0x2000
  2083. const m_AT_STATX_SYNC_AS_STAT = 0x0000
  2084. const m_AT_STATX_SYNC_TYPE = 0x6000
  2085. const m_AT_SYMLINK_FOLLOW = 0x400
  2086. const m_AT_SYMLINK_NOFOLLOW = 0x100
  2087. const m_BLOCKSZ = 64
  2088. const m_CANBSIZ = 255
  2089. const m_CLOCKS_PER_SEC = 1000000
  2090. const m_CLOCK_BOOTTIME = 7
  2091. const m_CLOCK_BOOTTIME_ALARM = 9
  2092. const m_CLOCK_MONOTONIC = 1
  2093. const m_CLOCK_MONOTONIC_COARSE = 6
  2094. const m_CLOCK_MONOTONIC_RAW = 4
  2095. const m_CLOCK_PROCESS_CPUTIME_ID = 2
  2096. const m_CLOCK_REALTIME = 0
  2097. const m_CLOCK_REALTIME_ALARM = 8
  2098. const m_CLOCK_REALTIME_COARSE = 5
  2099. const m_CLOCK_SGI_CYCLE = 10
  2100. const m_CLOCK_TAI = 11
  2101. const m_CLOCK_THREAD_CPUTIME_ID = 3
  2102. const m_CLONE_CHILD_CLEARTID = 0x00200000
  2103. const m_CLONE_CHILD_SETTID = 0x01000000
  2104. const m_CLONE_DETACHED = 0x00400000
  2105. const m_CLONE_FILES = 0x00000400
  2106. const m_CLONE_FS = 0x00000200
  2107. const m_CLONE_IO = 0x80000000
  2108. const m_CLONE_NEWCGROUP = 0x02000000
  2109. const m_CLONE_NEWIPC = 0x08000000
  2110. const m_CLONE_NEWNET = 0x40000000
  2111. const m_CLONE_NEWNS = 0x00020000
  2112. const m_CLONE_NEWPID = 0x20000000
  2113. const m_CLONE_NEWTIME = 0x00000080
  2114. const m_CLONE_NEWUSER = 0x10000000
  2115. const m_CLONE_NEWUTS = 0x04000000
  2116. const m_CLONE_PARENT = 0x00008000
  2117. const m_CLONE_PARENT_SETTID = 0x00100000
  2118. const m_CLONE_PIDFD = 0x00001000
  2119. const m_CLONE_PTRACE = 0x00002000
  2120. const m_CLONE_SETTLS = 0x00080000
  2121. const m_CLONE_SIGHAND = 0x00000800
  2122. const m_CLONE_SYSVSEM = 0x00040000
  2123. const m_CLONE_THREAD = 0x00010000
  2124. const m_CLONE_UNTRACED = 0x00800000
  2125. const m_CLONE_VFORK = 0x00004000
  2126. const m_CLONE_VM = 0x00000100
  2127. const m_CPU_SETSIZE = 1024
  2128. const m_CSIGNAL = 0x000000ff
  2129. const m_DEV_BSIZE = 512
  2130. const m_DN_ACCESS = 0x00000001
  2131. const m_DN_ATTRIB = 0x00000020
  2132. const m_DN_CREATE = 0x00000004
  2133. const m_DN_DELETE = 0x00000008
  2134. const m_DN_MODIFY = 0x00000002
  2135. const m_DN_MULTISHOT = 0x80000000
  2136. const m_DN_RENAME = 0x00000010
  2137. const m_FALLOC_FL_KEEP_SIZE = 1
  2138. const m_FALLOC_FL_PUNCH_HOLE = 2
  2139. const m_FAPPEND = "O_APPEND"
  2140. const m_FASYNC = "O_ASYNC"
  2141. const m_FD_CLOEXEC = 1
  2142. const m_FFSYNC = "O_SYNC"
  2143. const m_FNDELAY = "O_NDELAY"
  2144. const m_FNONBLOCK = "O_NONBLOCK"
  2145. const m_F_ADD_SEALS = 1033
  2146. const m_F_CANCELLK = 1029
  2147. const m_F_DUPFD = 0
  2148. const m_F_DUPFD_CLOEXEC = 1030
  2149. const m_F_GETFD = 1
  2150. const m_F_GETFL = 3
  2151. const m_F_GETLEASE = 1025
  2152. const m_F_GETLK = 5
  2153. const m_F_GETOWN = 9
  2154. const m_F_GETOWNER_UIDS = 17
  2155. const m_F_GETOWN_EX = 16
  2156. const m_F_GETPIPE_SZ = 1032
  2157. const m_F_GETSIG = 11
  2158. const m_F_GET_FILE_RW_HINT = 1037
  2159. const m_F_GET_RW_HINT = 1035
  2160. const m_F_GET_SEALS = 1034
  2161. const m_F_NOTIFY = 1026
  2162. const m_F_OFD_GETLK = 36
  2163. const m_F_OFD_SETLK = 37
  2164. const m_F_OFD_SETLKW = 38
  2165. const m_F_OWNER_GID = 2
  2166. const m_F_OWNER_PGRP = 2
  2167. const m_F_OWNER_PID = 1
  2168. const m_F_OWNER_TID = 0
  2169. const m_F_RDLCK = 0
  2170. const m_F_SEAL_FUTURE_WRITE = 0x0010
  2171. const m_F_SEAL_GROW = 0x0004
  2172. const m_F_SEAL_SEAL = 0x0001
  2173. const m_F_SEAL_SHRINK = 0x0002
  2174. const m_F_SEAL_WRITE = 0x0008
  2175. const m_F_SETFD = 2
  2176. const m_F_SETFL = 4
  2177. const m_F_SETLEASE = 1024
  2178. const m_F_SETLK = 6
  2179. const m_F_SETLKW = 7
  2180. const m_F_SETOWN = 8
  2181. const m_F_SETOWN_EX = 15
  2182. const m_F_SETPIPE_SZ = 1031
  2183. const m_F_SETSIG = 10
  2184. const m_F_SET_FILE_RW_HINT = 1038
  2185. const m_F_SET_RW_HINT = 1036
  2186. const m_F_UNLCK = 2
  2187. const m_F_WRLCK = 1
  2188. const m_ITIMER_PROF = 2
  2189. const m_ITIMER_REAL = 0
  2190. const m_ITIMER_VIRTUAL = 1
  2191. const m_IVSZ = 8
  2192. const m_KEYSZ = 32
  2193. const m_MADV_COLD = 20
  2194. const m_MADV_DODUMP = 17
  2195. const m_MADV_DOFORK = 11
  2196. const m_MADV_DONTDUMP = 16
  2197. const m_MADV_DONTFORK = 10
  2198. const m_MADV_DONTNEED = 4
  2199. const m_MADV_FREE = 8
  2200. const m_MADV_HUGEPAGE = 14
  2201. const m_MADV_HWPOISON = 100
  2202. const m_MADV_KEEPONFORK = 19
  2203. const m_MADV_MERGEABLE = 12
  2204. const m_MADV_NOHUGEPAGE = 15
  2205. const m_MADV_NORMAL = 0
  2206. const m_MADV_PAGEOUT = 21
  2207. const m_MADV_RANDOM = 1
  2208. const m_MADV_REMOVE = 9
  2209. const m_MADV_SEQUENTIAL = 2
  2210. const m_MADV_SOFT_OFFLINE = 101
  2211. const m_MADV_UNMERGEABLE = 13
  2212. const m_MADV_WILLNEED = 3
  2213. const m_MADV_WIPEONFORK = 18
  2214. const m_MAP_ANON = 32
  2215. const m_MAP_ANONYMOUS = "MAP_ANON"
  2216. const m_MAP_DENYWRITE = 0x0800
  2217. const m_MAP_EXECUTABLE = 0x1000
  2218. const m_MAP_FILE = 0
  2219. const m_MAP_FIXED = 0x10
  2220. const m_MAP_FIXED_NOREPLACE = 0x100000
  2221. const m_MAP_GROWSDOWN = 0x0100
  2222. const m_MAP_HUGETLB = 0x40000
  2223. const m_MAP_HUGE_MASK = 0x3f
  2224. const m_MAP_HUGE_SHIFT = 26
  2225. const m_MAP_LOCKED = 0x2000
  2226. const m_MAP_NONBLOCK = 0x10000
  2227. const m_MAP_NORESERVE = 0x4000
  2228. const m_MAP_POPULATE = 0x8000
  2229. const m_MAP_PRIVATE = 2
  2230. const m_MAP_SHARED = 0x01
  2231. const m_MAP_SHARED_VALIDATE = 0x03
  2232. const m_MAP_STACK = 0x20000
  2233. const m_MAP_SYNC = 0x80000
  2234. const m_MAP_TYPE = 0x0f
  2235. const m_MAXHOSTNAMELEN = 64
  2236. const m_MAXNAMLEN = 255
  2237. const m_MAXPATHLEN = 4096
  2238. const m_MAXSYMLINKS = 20
  2239. const m_MAX_HANDLE_SZ = 128
  2240. const m_MCL_CURRENT = 1
  2241. const m_MCL_FUTURE = 2
  2242. const m_MCL_ONFAULT = 4
  2243. const m_MFD_ALLOW_SEALING = 0x0002
  2244. const m_MFD_CLOEXEC = 0x0001
  2245. const m_MFD_HUGETLB = 0x0004
  2246. const m_MLOCK_ONFAULT = 0x01
  2247. const m_MREMAP_DONTUNMAP = 4
  2248. const m_MREMAP_FIXED = 2
  2249. const m_MREMAP_MAYMOVE = 1
  2250. const m_MS_ASYNC = 1
  2251. const m_MS_INVALIDATE = 2
  2252. const m_MS_SYNC = 4
  2253. const m_NBBY = 8
  2254. const m_NCARGS = 131072
  2255. const m_NGROUPS = 32
  2256. const m_NOFILE = 256
  2257. const m_O_APPEND = 02000
  2258. const m_O_ASYNC = 020000
  2259. const m_O_CLOEXEC = 02000000
  2260. const m_O_CREAT = 0100
  2261. const m_O_DIRECT = 040000
  2262. const m_O_DIRECTORY = 0200000
  2263. const m_O_DSYNC = 010000
  2264. const m_O_EXCL = 0200
  2265. const m_O_EXEC = "O_PATH"
  2266. const m_O_LARGEFILE = 0100000
  2267. const m_O_NDELAY = "O_NONBLOCK"
  2268. const m_O_NOATIME = 01000000
  2269. const m_O_NOCTTY = 0400
  2270. const m_O_NOFOLLOW = 0400000
  2271. const m_O_NONBLOCK = 04000
  2272. const m_O_PATH = 010000000
  2273. const m_O_RDONLY = 00
  2274. const m_O_RDWR = 02
  2275. const m_O_RSYNC = 04010000
  2276. const m_O_SEARCH = "O_PATH"
  2277. const m_O_SYNC = 04010000
  2278. const m_O_TMPFILE = 020200000
  2279. const m_O_TRUNC = 01000
  2280. const m_O_TTY_INIT = 0
  2281. const m_O_WRONLY = 01
  2282. const m_POSIX_FADV_DONTNEED = 4
  2283. const m_POSIX_FADV_NOREUSE = 5
  2284. const m_POSIX_FADV_NORMAL = 0
  2285. const m_POSIX_FADV_RANDOM = 1
  2286. const m_POSIX_FADV_SEQUENTIAL = 2
  2287. const m_POSIX_FADV_WILLNEED = 3
  2288. const m_POSIX_MADV_DONTNEED = 4
  2289. const m_POSIX_MADV_NORMAL = 0
  2290. const m_POSIX_MADV_RANDOM = 1
  2291. const m_POSIX_MADV_SEQUENTIAL = 2
  2292. const m_POSIX_MADV_WILLNEED = 3
  2293. const m_PRIO_MAX = 20
  2294. const m_PRIO_PGRP = 1
  2295. const m_PRIO_PROCESS = 0
  2296. const m_PRIO_USER = 2
  2297. const m_PROT_EXEC = 4
  2298. const m_PROT_GROWSDOWN = 0x01000000
  2299. const m_PROT_GROWSUP = 0x02000000
  2300. const m_PROT_NONE = 0
  2301. const m_PROT_READ = 1
  2302. const m_PROT_WRITE = 2
  2303. const m_PTHREAD_CANCEL_ASYNCHRONOUS = 1
  2304. const m_PTHREAD_CANCEL_DEFERRED = 0
  2305. const m_PTHREAD_CANCEL_DISABLE = 1
  2306. const m_PTHREAD_CANCEL_ENABLE = 0
  2307. const m_PTHREAD_CANCEL_MASKED = 2
  2308. const m_PTHREAD_CREATE_DETACHED = 1
  2309. const m_PTHREAD_CREATE_JOINABLE = 0
  2310. const m_PTHREAD_EXPLICIT_SCHED = 1
  2311. const m_PTHREAD_INHERIT_SCHED = 0
  2312. const m_PTHREAD_MUTEX_DEFAULT = 0
  2313. const m_PTHREAD_MUTEX_ERRORCHECK = 2
  2314. const m_PTHREAD_MUTEX_NORMAL = 0
  2315. const m_PTHREAD_MUTEX_RECURSIVE = 1
  2316. const m_PTHREAD_MUTEX_ROBUST = 1
  2317. const m_PTHREAD_MUTEX_STALLED = 0
  2318. const m_PTHREAD_ONCE_INIT = 0
  2319. const m_PTHREAD_PRIO_INHERIT = 1
  2320. const m_PTHREAD_PRIO_NONE = 0
  2321. const m_PTHREAD_PRIO_PROTECT = 2
  2322. const m_PTHREAD_PROCESS_PRIVATE = 0
  2323. const m_PTHREAD_PROCESS_SHARED = 1
  2324. const m_PTHREAD_SCOPE_PROCESS = 1
  2325. const m_PTHREAD_SCOPE_SYSTEM = 0
  2326. const m_RLIMIT_AS = 9
  2327. const m_RLIMIT_CORE = 4
  2328. const m_RLIMIT_CPU = 0
  2329. const m_RLIMIT_DATA = 2
  2330. const m_RLIMIT_FSIZE = 1
  2331. const m_RLIMIT_LOCKS = 10
  2332. const m_RLIMIT_MEMLOCK = 8
  2333. const m_RLIMIT_MSGQUEUE = 12
  2334. const m_RLIMIT_NICE = 13
  2335. const m_RLIMIT_NLIMITS = 16
  2336. const m_RLIMIT_NOFILE = 7
  2337. const m_RLIMIT_NPROC = 6
  2338. const m_RLIMIT_RSS = 5
  2339. const m_RLIMIT_RTPRIO = 14
  2340. const m_RLIMIT_RTTIME = 15
  2341. const m_RLIMIT_SIGPENDING = 11
  2342. const m_RLIMIT_STACK = 3
  2343. const m_RLIM_NLIMITS = "RLIMIT_NLIMITS"
  2344. const m_RLIM_SAVED_CUR = "RLIM_INFINITY"
  2345. const m_RLIM_SAVED_MAX = "RLIM_INFINITY"
  2346. const m_RUSAGE_SELF = 0
  2347. const m_RUSAGE_THREAD = 1
  2348. const m_RWF_WRITE_LIFE_NOT_SET = 0
  2349. const m_RWH_WRITE_LIFE_EXTREME = 5
  2350. const m_RWH_WRITE_LIFE_LONG = 4
  2351. const m_RWH_WRITE_LIFE_MEDIUM = 3
  2352. const m_RWH_WRITE_LIFE_NONE = 1
  2353. const m_RWH_WRITE_LIFE_SHORT = 2
  2354. const m_SCHED_BATCH = 3
  2355. const m_SCHED_DEADLINE = 6
  2356. const m_SCHED_FIFO = 1
  2357. const m_SCHED_IDLE = 5
  2358. const m_SCHED_OTHER = 0
  2359. const m_SCHED_RESET_ON_FORK = 0x40000000
  2360. const m_SCHED_RR = 2
  2361. const m_SPLICE_F_GIFT = 8
  2362. const m_SPLICE_F_MORE = 4
  2363. const m_SPLICE_F_MOVE = 1
  2364. const m_SPLICE_F_NONBLOCK = 2
  2365. const m_SYNC_FILE_RANGE_WAIT_AFTER = 4
  2366. const m_SYNC_FILE_RANGE_WAIT_BEFORE = 1
  2367. const m_SYNC_FILE_RANGE_WRITE = 2
  2368. const m_S_IFDIR1 = 0040000
  2369. const m_S_IRGRP1 = 0040
  2370. const m_S_IROTH1 = 0004
  2371. const m_S_IRUSR1 = 0400
  2372. const m_S_IRWXG1 = 0070
  2373. const m_S_IRWXO1 = 0007
  2374. const m_S_IRWXU1 = 0700
  2375. const m_S_ISGID1 = 02000
  2376. const m_S_ISUID1 = 04000
  2377. const m_S_ISVTX1 = 01000
  2378. const m_S_IWGRP1 = 0020
  2379. const m_S_IWOTH1 = 0002
  2380. const m_S_IWUSR1 = 0200
  2381. const m_S_IXGRP1 = 0010
  2382. const m_S_IXOTH1 = 0001
  2383. const m_S_IXUSR1 = 0100
  2384. const m_TIMER_ABSTIME = 1
  2385. const m_TIME_UTC = 1
  2386. const m___LONG_MAX1 = 0x7fffffffffffffff
  2387. const m___tm_gmtoff = "tm_gmtoff"
  2388. const m___tm_zone = "tm_zone"
  2389. const m_inline = "__inline"
  2390. const m_loff_t = "off_t"
  2391. const m_prlimit64 = "prlimit"
  2392. type Tiovec = struct {
  2393. Fiov_base uintptr
  2394. Fiov_len Tsize_t
  2395. }
  2396. type Tflock = struct {
  2397. Fl_type int16
  2398. Fl_whence int16
  2399. Fl_start Toff_t
  2400. Fl_len Toff_t
  2401. Fl_pid Tpid_t
  2402. }
  2403. type Tfile_handle = struct {
  2404. Fhandle_bytes uint32
  2405. Fhandle_type int32
  2406. }
  2407. type Tf_owner_ex = struct {
  2408. Ftype1 int32
  2409. Fpid Tpid_t
  2410. }
  2411. type Titimerval = struct {
  2412. Fit_interval Ttimeval
  2413. Fit_value Ttimeval
  2414. }
  2415. type Ttimezone = struct {
  2416. Ftz_minuteswest int32
  2417. Ftz_dsttime int32
  2418. }
  2419. type Tu8 = uint8
  2420. type Tu32 = uint32
  2421. type Tchacha_ctx = struct {
  2422. Finput [16]Tu32
  2423. }
  2424. var _sigma = [16]uint8{'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'}
  2425. var _tau = [16]uint8{'e', 'x', 'p', 'a', 'n', 'd', ' ', '1', '6', '-', 'b', 'y', 't', 'e', ' ', 'k'}
  2426. func _chacha_keysetup(tls *libc.TLS, x uintptr, k uintptr, kbits Tu32) {
  2427. var constants uintptr
  2428. _ = constants
  2429. *(*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)
  2430. *(*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)
  2431. *(*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)
  2432. *(*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)
  2433. if kbits == uint32(256) {
  2434. k += uintptr(16)
  2435. constants = uintptr(unsafe.Pointer(&_sigma))
  2436. } else {
  2437. constants = uintptr(unsafe.Pointer(&_tau))
  2438. }
  2439. *(*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)
  2440. *(*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)
  2441. *(*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)
  2442. *(*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)
  2443. *(*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)
  2444. *(*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)
  2445. *(*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)
  2446. *(*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)
  2447. }
  2448. func _chacha_ivsetup(tls *libc.TLS, x uintptr, iv uintptr) {
  2449. *(*Tu32)(unsafe.Pointer(x + 12*4)) = uint32(0)
  2450. *(*Tu32)(unsafe.Pointer(x + 13*4)) = uint32(0)
  2451. *(*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)
  2452. *(*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)
  2453. }
  2454. func _chacha_encrypt_bytes(tls *libc.TLS, x uintptr, m uintptr, c uintptr, bytes Tu32) {
  2455. bp := tls.Alloc(64)
  2456. defer tls.Free(64)
  2457. var ctarget uintptr
  2458. var i uint32
  2459. 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
  2460. var _ /* tmp at bp+0 */ [64]Tu8
  2461. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  2462. ctarget = libc.UintptrFromInt32(0)
  2463. if !(bytes != 0) {
  2464. return
  2465. }
  2466. j0 = *(*Tu32)(unsafe.Pointer(x))
  2467. j1 = *(*Tu32)(unsafe.Pointer(x + 1*4))
  2468. j2 = *(*Tu32)(unsafe.Pointer(x + 2*4))
  2469. j3 = *(*Tu32)(unsafe.Pointer(x + 3*4))
  2470. j4 = *(*Tu32)(unsafe.Pointer(x + 4*4))
  2471. j5 = *(*Tu32)(unsafe.Pointer(x + 5*4))
  2472. j6 = *(*Tu32)(unsafe.Pointer(x + 6*4))
  2473. j7 = *(*Tu32)(unsafe.Pointer(x + 7*4))
  2474. j8 = *(*Tu32)(unsafe.Pointer(x + 8*4))
  2475. j9 = *(*Tu32)(unsafe.Pointer(x + 9*4))
  2476. j10 = *(*Tu32)(unsafe.Pointer(x + 10*4))
  2477. j11 = *(*Tu32)(unsafe.Pointer(x + 11*4))
  2478. j12 = *(*Tu32)(unsafe.Pointer(x + 12*4))
  2479. j13 = *(*Tu32)(unsafe.Pointer(x + 13*4))
  2480. j14 = *(*Tu32)(unsafe.Pointer(x + 14*4))
  2481. j15 = *(*Tu32)(unsafe.Pointer(x + 15*4))
  2482. for {
  2483. if bytes < uint32(64) {
  2484. i = uint32(0)
  2485. for {
  2486. if !(i < bytes) {
  2487. break
  2488. }
  2489. (*(*[64]Tu8)(unsafe.Pointer(bp)))[i] = *(*Tu8)(unsafe.Pointer(m + uintptr(i)))
  2490. goto _2
  2491. _2:
  2492. ;
  2493. i++
  2494. }
  2495. m = bp
  2496. ctarget = c
  2497. c = bp
  2498. }
  2499. x0 = j0
  2500. x1 = j1
  2501. x2 = j2
  2502. x3 = j3
  2503. x4 = j4
  2504. x5 = j5
  2505. x6 = j6
  2506. x7 = j7
  2507. x8 = j8
  2508. x9 = j9
  2509. x10 = j10
  2510. x11 = j11
  2511. x12 = j12
  2512. x13 = j13
  2513. x14 = j14
  2514. x15 = j15
  2515. i = uint32(20)
  2516. for {
  2517. if !(i > uint32(0)) {
  2518. break
  2519. }
  2520. x0 = (x0 + x4) & libc.Uint32FromUint32(0xFFFFFFFF)
  2521. x12 = (x12^x0)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x12^x0)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  2522. x8 = (x8 + x12) & libc.Uint32FromUint32(0xFFFFFFFF)
  2523. x4 = (x4^x8)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x4^x8)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  2524. x0 = (x0 + x4) & libc.Uint32FromUint32(0xFFFFFFFF)
  2525. x12 = (x12^x0)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x12^x0)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  2526. x8 = (x8 + x12) & libc.Uint32FromUint32(0xFFFFFFFF)
  2527. x4 = (x4^x8)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x4^x8)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  2528. x1 = (x1 + x5) & libc.Uint32FromUint32(0xFFFFFFFF)
  2529. x13 = (x13^x1)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x13^x1)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  2530. x9 = (x9 + x13) & libc.Uint32FromUint32(0xFFFFFFFF)
  2531. x5 = (x5^x9)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x5^x9)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  2532. x1 = (x1 + x5) & libc.Uint32FromUint32(0xFFFFFFFF)
  2533. x13 = (x13^x1)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x13^x1)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  2534. x9 = (x9 + x13) & libc.Uint32FromUint32(0xFFFFFFFF)
  2535. x5 = (x5^x9)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x5^x9)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  2536. x2 = (x2 + x6) & libc.Uint32FromUint32(0xFFFFFFFF)
  2537. x14 = (x14^x2)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x14^x2)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  2538. x10 = (x10 + x14) & libc.Uint32FromUint32(0xFFFFFFFF)
  2539. x6 = (x6^x10)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x6^x10)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  2540. x2 = (x2 + x6) & libc.Uint32FromUint32(0xFFFFFFFF)
  2541. x14 = (x14^x2)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x14^x2)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  2542. x10 = (x10 + x14) & libc.Uint32FromUint32(0xFFFFFFFF)
  2543. x6 = (x6^x10)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x6^x10)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  2544. x3 = (x3 + x7) & libc.Uint32FromUint32(0xFFFFFFFF)
  2545. x15 = (x15^x3)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x15^x3)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  2546. x11 = (x11 + x15) & libc.Uint32FromUint32(0xFFFFFFFF)
  2547. x7 = (x7^x11)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x7^x11)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  2548. x3 = (x3 + x7) & libc.Uint32FromUint32(0xFFFFFFFF)
  2549. x15 = (x15^x3)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x15^x3)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  2550. x11 = (x11 + x15) & libc.Uint32FromUint32(0xFFFFFFFF)
  2551. x7 = (x7^x11)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x7^x11)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  2552. x0 = (x0 + x5) & libc.Uint32FromUint32(0xFFFFFFFF)
  2553. x15 = (x15^x0)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x15^x0)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  2554. x10 = (x10 + x15) & libc.Uint32FromUint32(0xFFFFFFFF)
  2555. x5 = (x5^x10)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x5^x10)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  2556. x0 = (x0 + x5) & libc.Uint32FromUint32(0xFFFFFFFF)
  2557. x15 = (x15^x0)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x15^x0)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  2558. x10 = (x10 + x15) & libc.Uint32FromUint32(0xFFFFFFFF)
  2559. x5 = (x5^x10)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x5^x10)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  2560. x1 = (x1 + x6) & libc.Uint32FromUint32(0xFFFFFFFF)
  2561. x12 = (x12^x1)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x12^x1)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  2562. x11 = (x11 + x12) & libc.Uint32FromUint32(0xFFFFFFFF)
  2563. x6 = (x6^x11)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x6^x11)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  2564. x1 = (x1 + x6) & libc.Uint32FromUint32(0xFFFFFFFF)
  2565. x12 = (x12^x1)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x12^x1)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  2566. x11 = (x11 + x12) & libc.Uint32FromUint32(0xFFFFFFFF)
  2567. x6 = (x6^x11)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x6^x11)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  2568. x2 = (x2 + x7) & libc.Uint32FromUint32(0xFFFFFFFF)
  2569. x13 = (x13^x2)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x13^x2)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  2570. x8 = (x8 + x13) & libc.Uint32FromUint32(0xFFFFFFFF)
  2571. x7 = (x7^x8)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x7^x8)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  2572. x2 = (x2 + x7) & libc.Uint32FromUint32(0xFFFFFFFF)
  2573. x13 = (x13^x2)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x13^x2)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  2574. x8 = (x8 + x13) & libc.Uint32FromUint32(0xFFFFFFFF)
  2575. x7 = (x7^x8)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x7^x8)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  2576. x3 = (x3 + x4) & libc.Uint32FromUint32(0xFFFFFFFF)
  2577. x14 = (x14^x3)<<libc.Int32FromInt32(16)&libc.Uint32FromUint32(0xFFFFFFFF) | (x14^x3)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16))
  2578. x9 = (x9 + x14) & libc.Uint32FromUint32(0xFFFFFFFF)
  2579. x4 = (x4^x9)<<libc.Int32FromInt32(12)&libc.Uint32FromUint32(0xFFFFFFFF) | (x4^x9)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12))
  2580. x3 = (x3 + x4) & libc.Uint32FromUint32(0xFFFFFFFF)
  2581. x14 = (x14^x3)<<libc.Int32FromInt32(8)&libc.Uint32FromUint32(0xFFFFFFFF) | (x14^x3)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8))
  2582. x9 = (x9 + x14) & libc.Uint32FromUint32(0xFFFFFFFF)
  2583. x4 = (x4^x9)<<libc.Int32FromInt32(7)&libc.Uint32FromUint32(0xFFFFFFFF) | (x4^x9)>>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7))
  2584. goto _3
  2585. _3:
  2586. ;
  2587. i -= uint32(2)
  2588. }
  2589. x0 = (x0 + j0) & libc.Uint32FromUint32(0xFFFFFFFF)
  2590. x1 = (x1 + j1) & libc.Uint32FromUint32(0xFFFFFFFF)
  2591. x2 = (x2 + j2) & libc.Uint32FromUint32(0xFFFFFFFF)
  2592. x3 = (x3 + j3) & libc.Uint32FromUint32(0xFFFFFFFF)
  2593. x4 = (x4 + j4) & libc.Uint32FromUint32(0xFFFFFFFF)
  2594. x5 = (x5 + j5) & libc.Uint32FromUint32(0xFFFFFFFF)
  2595. x6 = (x6 + j6) & libc.Uint32FromUint32(0xFFFFFFFF)
  2596. x7 = (x7 + j7) & libc.Uint32FromUint32(0xFFFFFFFF)
  2597. x8 = (x8 + j8) & libc.Uint32FromUint32(0xFFFFFFFF)
  2598. x9 = (x9 + j9) & libc.Uint32FromUint32(0xFFFFFFFF)
  2599. x10 = (x10 + j10) & libc.Uint32FromUint32(0xFFFFFFFF)
  2600. x11 = (x11 + j11) & libc.Uint32FromUint32(0xFFFFFFFF)
  2601. x12 = (x12 + j12) & libc.Uint32FromUint32(0xFFFFFFFF)
  2602. x13 = (x13 + j13) & libc.Uint32FromUint32(0xFFFFFFFF)
  2603. x14 = (x14 + j14) & libc.Uint32FromUint32(0xFFFFFFFF)
  2604. x15 = (x15 + j15) & libc.Uint32FromUint32(0xFFFFFFFF)
  2605. j12 = (j12 + libc.Uint32FromInt32(libc.Int32FromInt32(1))) & libc.Uint32FromUint32(0xFFFFFFFF)
  2606. if !(j12 != 0) {
  2607. j13 = (j13 + libc.Uint32FromInt32(libc.Int32FromInt32(1))) & libc.Uint32FromUint32(0xFFFFFFFF)
  2608. }
  2609. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(0))) = uint8(uint32(uint8(x0)) & libc.Uint32FromUint32(0xFF))
  2610. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(0) + 1)) = uint8(uint32(uint8(x0>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2611. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(0) + 2)) = uint8(uint32(uint8(x0>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2612. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(0) + 3)) = uint8(uint32(uint8(x0>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2613. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(4))) = uint8(uint32(uint8(x1)) & libc.Uint32FromUint32(0xFF))
  2614. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(4) + 1)) = uint8(uint32(uint8(x1>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2615. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(4) + 2)) = uint8(uint32(uint8(x1>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2616. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(4) + 3)) = uint8(uint32(uint8(x1>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2617. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(8))) = uint8(uint32(uint8(x2)) & libc.Uint32FromUint32(0xFF))
  2618. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(8) + 1)) = uint8(uint32(uint8(x2>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2619. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(8) + 2)) = uint8(uint32(uint8(x2>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2620. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(8) + 3)) = uint8(uint32(uint8(x2>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2621. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(12))) = uint8(uint32(uint8(x3)) & libc.Uint32FromUint32(0xFF))
  2622. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(12) + 1)) = uint8(uint32(uint8(x3>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2623. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(12) + 2)) = uint8(uint32(uint8(x3>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2624. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(12) + 3)) = uint8(uint32(uint8(x3>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2625. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(16))) = uint8(uint32(uint8(x4)) & libc.Uint32FromUint32(0xFF))
  2626. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(16) + 1)) = uint8(uint32(uint8(x4>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2627. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(16) + 2)) = uint8(uint32(uint8(x4>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2628. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(16) + 3)) = uint8(uint32(uint8(x4>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2629. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(20))) = uint8(uint32(uint8(x5)) & libc.Uint32FromUint32(0xFF))
  2630. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(20) + 1)) = uint8(uint32(uint8(x5>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2631. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(20) + 2)) = uint8(uint32(uint8(x5>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2632. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(20) + 3)) = uint8(uint32(uint8(x5>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2633. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(24))) = uint8(uint32(uint8(x6)) & libc.Uint32FromUint32(0xFF))
  2634. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(24) + 1)) = uint8(uint32(uint8(x6>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2635. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(24) + 2)) = uint8(uint32(uint8(x6>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2636. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(24) + 3)) = uint8(uint32(uint8(x6>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2637. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(28))) = uint8(uint32(uint8(x7)) & libc.Uint32FromUint32(0xFF))
  2638. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(28) + 1)) = uint8(uint32(uint8(x7>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2639. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(28) + 2)) = uint8(uint32(uint8(x7>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2640. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(28) + 3)) = uint8(uint32(uint8(x7>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2641. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(32))) = uint8(uint32(uint8(x8)) & libc.Uint32FromUint32(0xFF))
  2642. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(32) + 1)) = uint8(uint32(uint8(x8>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2643. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(32) + 2)) = uint8(uint32(uint8(x8>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2644. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(32) + 3)) = uint8(uint32(uint8(x8>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2645. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(36))) = uint8(uint32(uint8(x9)) & libc.Uint32FromUint32(0xFF))
  2646. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(36) + 1)) = uint8(uint32(uint8(x9>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2647. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(36) + 2)) = uint8(uint32(uint8(x9>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2648. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(36) + 3)) = uint8(uint32(uint8(x9>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2649. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(40))) = uint8(uint32(uint8(x10)) & libc.Uint32FromUint32(0xFF))
  2650. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(40) + 1)) = uint8(uint32(uint8(x10>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2651. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(40) + 2)) = uint8(uint32(uint8(x10>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2652. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(40) + 3)) = uint8(uint32(uint8(x10>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2653. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(44))) = uint8(uint32(uint8(x11)) & libc.Uint32FromUint32(0xFF))
  2654. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(44) + 1)) = uint8(uint32(uint8(x11>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2655. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(44) + 2)) = uint8(uint32(uint8(x11>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2656. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(44) + 3)) = uint8(uint32(uint8(x11>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2657. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(48))) = uint8(uint32(uint8(x12)) & libc.Uint32FromUint32(0xFF))
  2658. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(48) + 1)) = uint8(uint32(uint8(x12>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2659. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(48) + 2)) = uint8(uint32(uint8(x12>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2660. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(48) + 3)) = uint8(uint32(uint8(x12>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2661. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(52))) = uint8(uint32(uint8(x13)) & libc.Uint32FromUint32(0xFF))
  2662. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(52) + 1)) = uint8(uint32(uint8(x13>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2663. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(52) + 2)) = uint8(uint32(uint8(x13>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2664. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(52) + 3)) = uint8(uint32(uint8(x13>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2665. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(56))) = uint8(uint32(uint8(x14)) & libc.Uint32FromUint32(0xFF))
  2666. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(56) + 1)) = uint8(uint32(uint8(x14>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2667. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(56) + 2)) = uint8(uint32(uint8(x14>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2668. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(56) + 3)) = uint8(uint32(uint8(x14>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2669. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(60))) = uint8(uint32(uint8(x15)) & libc.Uint32FromUint32(0xFF))
  2670. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(60) + 1)) = uint8(uint32(uint8(x15>>libc.Int32FromInt32(8))) & libc.Uint32FromUint32(0xFF))
  2671. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(60) + 2)) = uint8(uint32(uint8(x15>>libc.Int32FromInt32(16))) & libc.Uint32FromUint32(0xFF))
  2672. *(*Tu8)(unsafe.Pointer(c + libc.UintptrFromInt32(60) + 3)) = uint8(uint32(uint8(x15>>libc.Int32FromInt32(24))) & libc.Uint32FromUint32(0xFF))
  2673. if bytes <= uint32(64) {
  2674. if bytes < uint32(64) {
  2675. i = uint32(0)
  2676. for {
  2677. if !(i < bytes) {
  2678. break
  2679. }
  2680. *(*Tu8)(unsafe.Pointer(ctarget + uintptr(i))) = *(*Tu8)(unsafe.Pointer(c + uintptr(i)))
  2681. goto _4
  2682. _4:
  2683. ;
  2684. i++
  2685. }
  2686. }
  2687. *(*Tu32)(unsafe.Pointer(x + 12*4)) = j12
  2688. *(*Tu32)(unsafe.Pointer(x + 13*4)) = j13
  2689. return
  2690. }
  2691. bytes -= uint32(64)
  2692. c += uintptr(64)
  2693. goto _1
  2694. _1:
  2695. }
  2696. }
  2697. // C documentation
  2698. //
  2699. // /* Marked MAP_INHERIT_ZERO, so zero'd out in fork children. */
  2700. type T_rs = struct {
  2701. Frs_have Tsize_t
  2702. Frs_count Tsize_t
  2703. }
  2704. // C documentation
  2705. //
  2706. // /* Marked MAP_INHERIT_ZERO, so zero'd out in fork children. */
  2707. var _rs uintptr
  2708. // C documentation
  2709. //
  2710. // /* Maybe be preserved in fork children, if _rs_allocate() decides. */
  2711. type T_rsx = struct {
  2712. Frs_chacha Tchacha_ctx
  2713. Frs_buf [1024]uint8
  2714. }
  2715. // C documentation
  2716. //
  2717. // /* Maybe be preserved in fork children, if _rs_allocate() decides. */
  2718. var _rsx uintptr
  2719. type Trlim_t = uint64
  2720. type Trlimit = struct {
  2721. Frlim_cur Trlim_t
  2722. Frlim_max Trlim_t
  2723. }
  2724. type Trusage = struct {
  2725. Fru_utime Ttimeval
  2726. Fru_stime Ttimeval
  2727. Fru_maxrss int64
  2728. Fru_ixrss int64
  2729. Fru_idrss int64
  2730. Fru_isrss int64
  2731. Fru_minflt int64
  2732. Fru_majflt int64
  2733. Fru_nswap int64
  2734. Fru_inblock int64
  2735. Fru_oublock int64
  2736. Fru_msgsnd int64
  2737. Fru_msgrcv int64
  2738. Fru_nsignals int64
  2739. Fru_nvcsw int64
  2740. Fru_nivcsw int64
  2741. F__reserved [16]int64
  2742. }
  2743. type Tsched_param = struct {
  2744. Fsched_priority int32
  2745. F__reserved1 int32
  2746. F__reserved2 [2]struct {
  2747. F__reserved1 Ttime_t
  2748. F__reserved2 int64
  2749. }
  2750. F__reserved3 int32
  2751. }
  2752. type Tcpu_set_t = struct {
  2753. F__bits [16]uint64
  2754. }
  2755. type Ttm = struct {
  2756. Ftm_sec int32
  2757. Ftm_min int32
  2758. Ftm_hour int32
  2759. Ftm_mday int32
  2760. Ftm_mon int32
  2761. Ftm_year int32
  2762. Ftm_wday int32
  2763. Ftm_yday int32
  2764. Ftm_isdst int32
  2765. Ftm_gmtoff int64
  2766. Ftm_zone uintptr
  2767. }
  2768. type Titimerspec = struct {
  2769. Fit_interval Ttimespec
  2770. Fit_value Ttimespec
  2771. }
  2772. type t__ptcb = struct {
  2773. F__f uintptr
  2774. F__x uintptr
  2775. F__next uintptr
  2776. }
  2777. type Tcpu_set_t1 = struct {
  2778. F__bits [16]uint64
  2779. }
  2780. var _arc4random_mtx = Tpthread_mutex_t{}
  2781. var __rs_forked Tsig_atomic_t
  2782. func __rs_init(tls *libc.TLS, buf uintptr, n Tsize_t) {
  2783. var v1, v2, v3, v6 uintptr
  2784. var v4 int32
  2785. _, _, _, _, _ = v1, v2, v3, v4, v6
  2786. if n < libc.Uint64FromInt32(libc.Int32FromInt32(m_KEYSZ)+libc.Int32FromInt32(m_IVSZ)) {
  2787. return
  2788. }
  2789. if _rs == libc.UintptrFromInt32(0) {
  2790. v1 = uintptr(unsafe.Pointer(&_rs))
  2791. v2 = uintptr(unsafe.Pointer(&_rsx))
  2792. 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)
  2793. *(*uintptr)(unsafe.Pointer(v1)) = v3
  2794. if v3 == uintptr(-libc.Int32FromInt32(1)) {
  2795. v4 = -int32(1)
  2796. goto _5
  2797. }
  2798. 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)
  2799. *(*uintptr)(unsafe.Pointer(v2)) = v6
  2800. if v6 == uintptr(-libc.Int32FromInt32(1)) {
  2801. libc.Xmunmap(tls, *(*uintptr)(unsafe.Pointer(v1)), uint64(16))
  2802. *(*uintptr)(unsafe.Pointer(v1)) = libc.UintptrFromInt32(0)
  2803. v4 = -int32(1)
  2804. goto _5
  2805. }
  2806. libc.Xpthread_atfork(tls, libc.UintptrFromInt32(0), libc.UintptrFromInt32(0), __ccgo_fp(__rs_forkhandler))
  2807. v4 = 0
  2808. goto _5
  2809. _5:
  2810. if v4 == -int32(1) {
  2811. libc.X_exit(tls, int32(1))
  2812. }
  2813. }
  2814. _chacha_keysetup(tls, _rsx, buf, libc.Uint32FromInt32(libc.Int32FromInt32(m_KEYSZ)*libc.Int32FromInt32(8)))
  2815. _chacha_ivsetup(tls, _rsx, buf+uintptr(m_KEYSZ))
  2816. }
  2817. func __rs_rekey(tls *libc.TLS, dat uintptr, datlen Tsize_t) {
  2818. var i, m Tsize_t
  2819. var v1 uint64
  2820. var p3 uintptr
  2821. _, _, _, _ = i, m, v1, p3
  2822. /* fill rs_buf with the keystream */
  2823. _chacha_encrypt_bytes(tls, _rsx, _rsx+64, _rsx+64, uint32(1024))
  2824. /* mix in optional user provided data */
  2825. if dat != 0 {
  2826. if datlen < libc.Uint64FromInt32(libc.Int32FromInt32(m_KEYSZ)+libc.Int32FromInt32(m_IVSZ)) {
  2827. v1 = datlen
  2828. } else {
  2829. v1 = libc.Uint64FromInt32(libc.Int32FromInt32(m_KEYSZ) + libc.Int32FromInt32(m_IVSZ))
  2830. }
  2831. m = v1
  2832. i = uint64(0)
  2833. for {
  2834. if !(i < m) {
  2835. break
  2836. }
  2837. p3 = _rsx + 64 + uintptr(i)
  2838. *(*uint8)(unsafe.Pointer(p3)) = uint8(int32(*(*uint8)(unsafe.Pointer(p3))) ^ libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(dat + uintptr(i)))))
  2839. goto _2
  2840. _2:
  2841. ;
  2842. i++
  2843. }
  2844. }
  2845. /* immediately reinit for backtracking resistance */
  2846. __rs_init(tls, _rsx+64, libc.Uint64FromInt32(libc.Int32FromInt32(m_KEYSZ)+libc.Int32FromInt32(m_IVSZ)))
  2847. libc.Xmemset(tls, _rsx+64, 0, libc.Uint64FromInt32(libc.Int32FromInt32(m_KEYSZ)+libc.Int32FromInt32(m_IVSZ)))
  2848. (*T_rs)(unsafe.Pointer(_rs)).Frs_have = libc.Uint64FromInt64(1024) - libc.Uint64FromInt32(m_KEYSZ) - libc.Uint64FromInt32(m_IVSZ)
  2849. }
  2850. func __rs_stir(tls *libc.TLS) {
  2851. bp := tls.Alloc(48)
  2852. defer tls.Free(48)
  2853. var _ /* rekey_fuzz at bp+40 */ Tuint32_t
  2854. var _ /* rnd at bp+0 */ [40]uint8
  2855. *(*Tuint32_t)(unsafe.Pointer(bp + 40)) = uint32(0)
  2856. if libc.Xgetentropy(tls, bp, uint64(40)) == -int32(1) {
  2857. libc.Xraise(tls, int32(m_SIGKILL))
  2858. }
  2859. if !(_rs != 0) {
  2860. __rs_init(tls, bp, uint64(40))
  2861. } else {
  2862. __rs_rekey(tls, bp, uint64(40))
  2863. }
  2864. Xexplicit_bzero(tls, bp, uint64(40)) /* discard source seed */
  2865. /* invalidate rs_buf */
  2866. (*T_rs)(unsafe.Pointer(_rs)).Frs_have = uint64(0)
  2867. libc.Xmemset(tls, _rsx+64, 0, uint64(1024))
  2868. /* rekey interval should not be predictable */
  2869. _chacha_encrypt_bytes(tls, _rsx, bp+40, bp+40, uint32(4))
  2870. (*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)))
  2871. }
  2872. func __rs_stir_if_needed(tls *libc.TLS, len1 Tsize_t) {
  2873. __rs_forkdetect(tls)
  2874. if !(_rs != 0) || (*T_rs)(unsafe.Pointer(_rs)).Frs_count <= len1 {
  2875. __rs_stir(tls)
  2876. }
  2877. if (*T_rs)(unsafe.Pointer(_rs)).Frs_count <= len1 {
  2878. (*T_rs)(unsafe.Pointer(_rs)).Frs_count = uint64(0)
  2879. } else {
  2880. *(*Tsize_t)(unsafe.Pointer(_rs + 8)) -= len1
  2881. }
  2882. }
  2883. func __rs_random_buf(tls *libc.TLS, _buf uintptr, n Tsize_t) {
  2884. var buf, keystream uintptr
  2885. var m Tsize_t
  2886. var v1 uint64
  2887. _, _, _, _ = buf, keystream, m, v1
  2888. buf = _buf
  2889. __rs_stir_if_needed(tls, n)
  2890. for n > uint64(0) {
  2891. if (*T_rs)(unsafe.Pointer(_rs)).Frs_have > uint64(0) {
  2892. if n < (*T_rs)(unsafe.Pointer(_rs)).Frs_have {
  2893. v1 = n
  2894. } else {
  2895. v1 = (*T_rs)(unsafe.Pointer(_rs)).Frs_have
  2896. }
  2897. m = v1
  2898. keystream = _rsx + 64 + uintptr(1024) - uintptr((*T_rs)(unsafe.Pointer(_rs)).Frs_have)
  2899. libc.Xmemcpy(tls, buf, keystream, m)
  2900. libc.Xmemset(tls, keystream, 0, m)
  2901. buf += uintptr(m)
  2902. n -= m
  2903. *(*Tsize_t)(unsafe.Pointer(_rs)) -= m
  2904. }
  2905. if (*T_rs)(unsafe.Pointer(_rs)).Frs_have == uint64(0) {
  2906. __rs_rekey(tls, libc.UintptrFromInt32(0), uint64(0))
  2907. }
  2908. }
  2909. }
  2910. func __rs_random_u32(tls *libc.TLS, val uintptr) {
  2911. var keystream uintptr
  2912. _ = keystream
  2913. __rs_stir_if_needed(tls, uint64(4))
  2914. if (*T_rs)(unsafe.Pointer(_rs)).Frs_have < uint64(4) {
  2915. __rs_rekey(tls, libc.UintptrFromInt32(0), uint64(0))
  2916. }
  2917. keystream = _rsx + 64 + uintptr(1024) - uintptr((*T_rs)(unsafe.Pointer(_rs)).Frs_have)
  2918. libc.Xmemcpy(tls, val, keystream, uint64(4))
  2919. libc.Xmemset(tls, keystream, 0, uint64(4))
  2920. *(*Tsize_t)(unsafe.Pointer(_rs)) -= uint64(4)
  2921. }
  2922. func Xarc4random_stir(tls *libc.TLS) {
  2923. libc.Xpthread_mutex_lock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2924. __rs_stir(tls)
  2925. libc.Xpthread_mutex_unlock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2926. }
  2927. func Xarc4random_addrandom(tls *libc.TLS, dat uintptr, datlen int32) {
  2928. libc.Xpthread_mutex_lock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2929. __rs_stir_if_needed(tls, libc.Uint64FromInt32(datlen))
  2930. __rs_rekey(tls, dat, libc.Uint64FromInt32(datlen))
  2931. libc.Xpthread_mutex_unlock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2932. }
  2933. func Xarc4random(tls *libc.TLS) (r Tuint32_t) {
  2934. bp := tls.Alloc(16)
  2935. defer tls.Free(16)
  2936. var _ /* val at bp+0 */ Tuint32_t
  2937. libc.Xpthread_mutex_lock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2938. __rs_random_u32(tls, bp)
  2939. libc.Xpthread_mutex_unlock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2940. return *(*Tuint32_t)(unsafe.Pointer(bp))
  2941. }
  2942. func Xarc4random_buf(tls *libc.TLS, buf uintptr, n Tsize_t) {
  2943. libc.Xpthread_mutex_lock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2944. __rs_random_buf(tls, buf, n)
  2945. libc.Xpthread_mutex_unlock(tls, uintptr(unsafe.Pointer(&_arc4random_mtx)))
  2946. }
  2947. // C documentation
  2948. //
  2949. // /*
  2950. // * Calculate a uniformly distributed random number less than upper_bound
  2951. // * avoiding "modulo bias".
  2952. // *
  2953. // * Uniformity is achieved by generating new random numbers until the one
  2954. // * returned is outside the range [0, 2**32 % upper_bound). This
  2955. // * guarantees the selected random number will be inside
  2956. // * [2**32 % upper_bound, 2**32) which maps back to [0, upper_bound)
  2957. // * after reduction modulo upper_bound.
  2958. // */
  2959. func Xarc4random_uniform(tls *libc.TLS, upper_bound Tuint32_t) (r1 Tuint32_t) {
  2960. var min, r Tuint32_t
  2961. _, _ = min, r
  2962. if upper_bound < uint32(2) {
  2963. return uint32(0)
  2964. }
  2965. /* 2**32 % x == (2**32 - x) % x */
  2966. min = -upper_bound % upper_bound
  2967. /*
  2968. * This could theoretically loop forever but each retry has
  2969. * p > 0.5 (worst case, usually far better) of selecting a
  2970. * number inside the range we need, so it should rarely need
  2971. * to re-roll.
  2972. */
  2973. for {
  2974. r = Xarc4random(tls)
  2975. if r >= min {
  2976. break
  2977. }
  2978. goto _1
  2979. _1:
  2980. }
  2981. return r % upper_bound
  2982. }
  2983. const m_SEEK_CUR = 1
  2984. const m_SEEK_END = 2
  2985. const m_SEEK_SET = 0
  2986. const m_no_argument = 0
  2987. const m_optional_argument = 2
  2988. const m_required_argument = 1
  2989. type Toption = struct {
  2990. Fname uintptr
  2991. Fhas_arg int32
  2992. Fflag uintptr
  2993. Fval int32
  2994. }
  2995. func Xbsd_getopt(tls *libc.TLS, argc int32, argv uintptr, shortopts uintptr) (r int32) {
  2996. if Xoptreset == int32(1) {
  2997. Xoptreset = 0
  2998. libc.Xoptind = 0
  2999. }
  3000. /*
  3001. * Make sure we are using the system getopt() and not a possible
  3002. * overlay macro.
  3003. */
  3004. return libc.Xgetopt(tls, argc, argv, shortopts)
  3005. }
  3006. const m_DT_BLK = 6
  3007. const m_DT_CHR = 2
  3008. const m_DT_DIR = 4
  3009. const m_DT_FIFO = 1
  3010. const m_DT_LNK = 10
  3011. const m_DT_REG = 8
  3012. const m_DT_SOCK = 12
  3013. const m_DT_UNKNOWN = 0
  3014. const m_DT_WHT = 14
  3015. const m_INT_MAX1 = 2147483647
  3016. const m_OPEN_MAX = 256
  3017. const m_SYS_accept = 202
  3018. const m_SYS_accept4 = 242
  3019. const m_SYS_acct = 89
  3020. const m_SYS_add_key = 217
  3021. const m_SYS_adjtimex = 171
  3022. const m_SYS_arch_specific_syscall = 244
  3023. const m_SYS_bind = 200
  3024. const m_SYS_bpf = 280
  3025. const m_SYS_brk = 214
  3026. const m_SYS_cachestat = 451
  3027. const m_SYS_capget = 90
  3028. const m_SYS_capset = 91
  3029. const m_SYS_chdir = 49
  3030. const m_SYS_chroot = 51
  3031. const m_SYS_clock_adjtime = 266
  3032. const m_SYS_clock_getres = 114
  3033. const m_SYS_clock_gettime = 113
  3034. const m_SYS_clock_nanosleep = 115
  3035. const m_SYS_clock_settime = 112
  3036. const m_SYS_clone = 220
  3037. const m_SYS_clone3 = 435
  3038. const m_SYS_close = 57
  3039. const m_SYS_close_range = 436
  3040. const m_SYS_connect = 203
  3041. const m_SYS_copy_file_range = 285
  3042. const m_SYS_delete_module = 106
  3043. const m_SYS_dup = 23
  3044. const m_SYS_dup3 = 24
  3045. const m_SYS_epoll_create1 = 20
  3046. const m_SYS_epoll_ctl = 21
  3047. const m_SYS_epoll_pwait = 22
  3048. const m_SYS_epoll_pwait2 = 441
  3049. const m_SYS_eventfd2 = 19
  3050. const m_SYS_execve = 221
  3051. const m_SYS_execveat = 281
  3052. const m_SYS_exit = 93
  3053. const m_SYS_exit_group = 94
  3054. const m_SYS_faccessat = 48
  3055. const m_SYS_faccessat2 = 439
  3056. const m_SYS_fadvise64 = 223
  3057. const m_SYS_fallocate = 47
  3058. const m_SYS_fanotify_init = 262
  3059. const m_SYS_fanotify_mark = 263
  3060. const m_SYS_fchdir = 50
  3061. const m_SYS_fchmod = 52
  3062. const m_SYS_fchmodat = 53
  3063. const m_SYS_fchmodat2 = 452
  3064. const m_SYS_fchown = 55
  3065. const m_SYS_fchownat = 54
  3066. const m_SYS_fcntl = 25
  3067. const m_SYS_fdatasync = 83
  3068. const m_SYS_fgetxattr = 10
  3069. const m_SYS_finit_module = 273
  3070. const m_SYS_flistxattr = 13
  3071. const m_SYS_flock = 32
  3072. const m_SYS_fremovexattr = 16
  3073. const m_SYS_fsconfig = 431
  3074. const m_SYS_fsetxattr = 7
  3075. const m_SYS_fsmount = 432
  3076. const m_SYS_fsopen = 430
  3077. const m_SYS_fspick = 433
  3078. const m_SYS_fstat = 80
  3079. const m_SYS_fstatfs = 44
  3080. const m_SYS_fsync = 82
  3081. const m_SYS_ftruncate = 46
  3082. const m_SYS_futex = 98
  3083. const m_SYS_futex_waitv = 449
  3084. const m_SYS_get_mempolicy = 236
  3085. const m_SYS_get_robust_list = 100
  3086. const m_SYS_getcpu = 168
  3087. const m_SYS_getcwd = 17
  3088. const m_SYS_getdents64 = 61
  3089. const m_SYS_getegid = 177
  3090. const m_SYS_geteuid = 175
  3091. const m_SYS_getgid = 176
  3092. const m_SYS_getgroups = 158
  3093. const m_SYS_getitimer = 102
  3094. const m_SYS_getpeername = 205
  3095. const m_SYS_getpgid = 155
  3096. const m_SYS_getpid = 172
  3097. const m_SYS_getppid = 173
  3098. const m_SYS_getpriority = 141
  3099. const m_SYS_getrandom = 278
  3100. const m_SYS_getresgid = 150
  3101. const m_SYS_getresuid = 148
  3102. const m_SYS_getrlimit = 163
  3103. const m_SYS_getrusage = 165
  3104. const m_SYS_getsid = 156
  3105. const m_SYS_getsockname = 204
  3106. const m_SYS_getsockopt = 209
  3107. const m_SYS_gettid = 178
  3108. const m_SYS_gettimeofday = 169
  3109. const m_SYS_getuid = 174
  3110. const m_SYS_getxattr = 8
  3111. const m_SYS_init_module = 105
  3112. const m_SYS_inotify_add_watch = 27
  3113. const m_SYS_inotify_init1 = 26
  3114. const m_SYS_inotify_rm_watch = 28
  3115. const m_SYS_io_cancel = 3
  3116. const m_SYS_io_destroy = 1
  3117. const m_SYS_io_getevents = 4
  3118. const m_SYS_io_pgetevents = 292
  3119. const m_SYS_io_setup = 0
  3120. const m_SYS_io_submit = 2
  3121. const m_SYS_io_uring_enter = 426
  3122. const m_SYS_io_uring_register = 427
  3123. const m_SYS_io_uring_setup = 425
  3124. const m_SYS_ioctl = 29
  3125. const m_SYS_ioprio_get = 31
  3126. const m_SYS_ioprio_set = 30
  3127. const m_SYS_kcmp = 272
  3128. const m_SYS_kexec_file_load = 294
  3129. const m_SYS_kexec_load = 104
  3130. const m_SYS_keyctl = 219
  3131. const m_SYS_kill = 129
  3132. const m_SYS_landlock_add_rule = 445
  3133. const m_SYS_landlock_create_ruleset = 444
  3134. const m_SYS_landlock_restrict_self = 446
  3135. const m_SYS_lgetxattr = 9
  3136. const m_SYS_linkat = 37
  3137. const m_SYS_listen = 201
  3138. const m_SYS_listxattr = 11
  3139. const m_SYS_llistxattr = 12
  3140. const m_SYS_lookup_dcookie = 18
  3141. const m_SYS_lremovexattr = 15
  3142. const m_SYS_lseek = 62
  3143. const m_SYS_lsetxattr = 6
  3144. const m_SYS_madvise = 233
  3145. const m_SYS_mbind = 235
  3146. const m_SYS_membarrier = 283
  3147. const m_SYS_memfd_create = 279
  3148. const m_SYS_migrate_pages = 238
  3149. const m_SYS_mincore = 232
  3150. const m_SYS_mkdirat = 34
  3151. const m_SYS_mknodat = 33
  3152. const m_SYS_mlock = 228
  3153. const m_SYS_mlock2 = 284
  3154. const m_SYS_mlockall = 230
  3155. const m_SYS_mmap = 222
  3156. const m_SYS_mount = 40
  3157. const m_SYS_mount_setattr = 442
  3158. const m_SYS_move_mount = 429
  3159. const m_SYS_move_pages = 239
  3160. const m_SYS_mprotect = 226
  3161. const m_SYS_mq_getsetattr = 185
  3162. const m_SYS_mq_notify = 184
  3163. const m_SYS_mq_open = 180
  3164. const m_SYS_mq_timedreceive = 183
  3165. const m_SYS_mq_timedsend = 182
  3166. const m_SYS_mq_unlink = 181
  3167. const m_SYS_mremap = 216
  3168. const m_SYS_msgctl = 187
  3169. const m_SYS_msgget = 186
  3170. const m_SYS_msgrcv = 188
  3171. const m_SYS_msgsnd = 189
  3172. const m_SYS_msync = 227
  3173. const m_SYS_munlock = 229
  3174. const m_SYS_munlockall = 231
  3175. const m_SYS_munmap = 215
  3176. const m_SYS_name_to_handle_at = 264
  3177. const m_SYS_nanosleep = 101
  3178. const m_SYS_newfstatat = 79
  3179. const m_SYS_nfsservctl = 42
  3180. const m_SYS_open_by_handle_at = 265
  3181. const m_SYS_open_tree = 428
  3182. const m_SYS_openat = 56
  3183. const m_SYS_openat2 = 437
  3184. const m_SYS_perf_event_open = 241
  3185. const m_SYS_personality = 92
  3186. const m_SYS_pidfd_getfd = 438
  3187. const m_SYS_pidfd_open = 434
  3188. const m_SYS_pidfd_send_signal = 424
  3189. const m_SYS_pipe2 = 59
  3190. const m_SYS_pivot_root = 41
  3191. const m_SYS_pkey_alloc = 289
  3192. const m_SYS_pkey_free = 290
  3193. const m_SYS_pkey_mprotect = 288
  3194. const m_SYS_ppoll = 73
  3195. const m_SYS_prctl = 167
  3196. const m_SYS_pread64 = 67
  3197. const m_SYS_preadv = 69
  3198. const m_SYS_preadv2 = 286
  3199. const m_SYS_prlimit64 = 261
  3200. const m_SYS_process_madvise = 440
  3201. const m_SYS_process_mrelease = 448
  3202. const m_SYS_process_vm_readv = 270
  3203. const m_SYS_process_vm_writev = 271
  3204. const m_SYS_pselect6 = 72
  3205. const m_SYS_ptrace = 117
  3206. const m_SYS_pwrite64 = 68
  3207. const m_SYS_pwritev = 70
  3208. const m_SYS_pwritev2 = 287
  3209. const m_SYS_quotactl = 60
  3210. const m_SYS_read = 63
  3211. const m_SYS_readahead = 213
  3212. const m_SYS_readlinkat = 78
  3213. const m_SYS_readv = 65
  3214. const m_SYS_reboot = 142
  3215. const m_SYS_recvfrom = 207
  3216. const m_SYS_recvmmsg = 243
  3217. const m_SYS_recvmsg = 212
  3218. const m_SYS_remap_file_pages = 234
  3219. const m_SYS_removexattr = 14
  3220. const m_SYS_renameat2 = 276
  3221. const m_SYS_request_key = 218
  3222. const m_SYS_restart_syscall = 128
  3223. const m_SYS_rseq = 293
  3224. const m_SYS_rt_sigaction = 134
  3225. const m_SYS_rt_sigpending = 136
  3226. const m_SYS_rt_sigprocmask = 135
  3227. const m_SYS_rt_sigqueueinfo = 138
  3228. const m_SYS_rt_sigreturn = 139
  3229. const m_SYS_rt_sigsuspend = 133
  3230. const m_SYS_rt_sigtimedwait = 137
  3231. const m_SYS_rt_tgsigqueueinfo = 240
  3232. const m_SYS_sched_get_priority_max = 125
  3233. const m_SYS_sched_get_priority_min = 126
  3234. const m_SYS_sched_getaffinity = 123
  3235. const m_SYS_sched_getattr = 275
  3236. const m_SYS_sched_getparam = 121
  3237. const m_SYS_sched_getscheduler = 120
  3238. const m_SYS_sched_rr_get_interval = 127
  3239. const m_SYS_sched_setaffinity = 122
  3240. const m_SYS_sched_setattr = 274
  3241. const m_SYS_sched_setparam = 118
  3242. const m_SYS_sched_setscheduler = 119
  3243. const m_SYS_sched_yield = 124
  3244. const m_SYS_seccomp = 277
  3245. const m_SYS_semctl = 191
  3246. const m_SYS_semget = 190
  3247. const m_SYS_semop = 193
  3248. const m_SYS_semtimedop = 192
  3249. const m_SYS_sendfile = 71
  3250. const m_SYS_sendmmsg = 269
  3251. const m_SYS_sendmsg = 211
  3252. const m_SYS_sendto = 206
  3253. const m_SYS_set_mempolicy = 237
  3254. const m_SYS_set_mempolicy_home_node = 450
  3255. const m_SYS_set_robust_list = 99
  3256. const m_SYS_set_tid_address = 96
  3257. const m_SYS_setdomainname = 162
  3258. const m_SYS_setfsgid = 152
  3259. const m_SYS_setfsuid = 151
  3260. const m_SYS_setgid = 144
  3261. const m_SYS_setgroups = 159
  3262. const m_SYS_sethostname = 161
  3263. const m_SYS_setitimer = 103
  3264. const m_SYS_setns = 268
  3265. const m_SYS_setpgid = 154
  3266. const m_SYS_setpriority = 140
  3267. const m_SYS_setregid = 143
  3268. const m_SYS_setresgid = 149
  3269. const m_SYS_setresuid = 147
  3270. const m_SYS_setreuid = 145
  3271. const m_SYS_setrlimit = 164
  3272. const m_SYS_setsid = 157
  3273. const m_SYS_setsockopt = 208
  3274. const m_SYS_settimeofday = 170
  3275. const m_SYS_setuid = 146
  3276. const m_SYS_setxattr = 5
  3277. const m_SYS_shmat = 196
  3278. const m_SYS_shmctl = 195
  3279. const m_SYS_shmdt = 197
  3280. const m_SYS_shmget = 194
  3281. const m_SYS_shutdown = 210
  3282. const m_SYS_sigaltstack = 132
  3283. const m_SYS_signalfd4 = 74
  3284. const m_SYS_socket = 198
  3285. const m_SYS_socketpair = 199
  3286. const m_SYS_splice = 76
  3287. const m_SYS_statfs = 43
  3288. const m_SYS_statx = 291
  3289. const m_SYS_swapoff = 225
  3290. const m_SYS_swapon = 224
  3291. const m_SYS_symlinkat = 36
  3292. const m_SYS_sync = 81
  3293. const m_SYS_sync_file_range = 84
  3294. const m_SYS_syncfs = 267
  3295. const m_SYS_sysinfo = 179
  3296. const m_SYS_syslog = 116
  3297. const m_SYS_sysriscv = "__NR_arch_specific_syscall"
  3298. const m_SYS_tee = 77
  3299. const m_SYS_tgkill = 131
  3300. const m_SYS_timer_create = 107
  3301. const m_SYS_timer_delete = 111
  3302. const m_SYS_timer_getoverrun = 109
  3303. const m_SYS_timer_gettime = 108
  3304. const m_SYS_timer_settime = 110
  3305. const m_SYS_timerfd_create = 85
  3306. const m_SYS_timerfd_gettime = 87
  3307. const m_SYS_timerfd_settime = 86
  3308. const m_SYS_times = 153
  3309. const m_SYS_tkill = 130
  3310. const m_SYS_truncate = 45
  3311. const m_SYS_umask = 166
  3312. const m_SYS_umount2 = 39
  3313. const m_SYS_uname = 160
  3314. const m_SYS_unlinkat = 35
  3315. const m_SYS_unshare = 97
  3316. const m_SYS_userfaultfd = 282
  3317. const m_SYS_utimensat = 88
  3318. const m_SYS_vhangup = 58
  3319. const m_SYS_vmsplice = 75
  3320. const m_SYS_wait4 = 260
  3321. const m_SYS_waitid = 95
  3322. const m_SYS_write = 64
  3323. const m_SYS_writev = 66
  3324. const m_UINT_MAX1 = 4294967295
  3325. const m___NR_accept = 202
  3326. const m___NR_accept4 = 242
  3327. const m___NR_acct = 89
  3328. const m___NR_add_key = 217
  3329. const m___NR_adjtimex = 171
  3330. const m___NR_arch_specific_syscall = 244
  3331. const m___NR_bind = 200
  3332. const m___NR_bpf = 280
  3333. const m___NR_brk = 214
  3334. const m___NR_cachestat = 451
  3335. const m___NR_capget = 90
  3336. const m___NR_capset = 91
  3337. const m___NR_chdir = 49
  3338. const m___NR_chroot = 51
  3339. const m___NR_clock_adjtime = 266
  3340. const m___NR_clock_getres = 114
  3341. const m___NR_clock_gettime = 113
  3342. const m___NR_clock_nanosleep = 115
  3343. const m___NR_clock_settime = 112
  3344. const m___NR_clone = 220
  3345. const m___NR_clone3 = 435
  3346. const m___NR_close = 57
  3347. const m___NR_close_range = 436
  3348. const m___NR_connect = 203
  3349. const m___NR_copy_file_range = 285
  3350. const m___NR_delete_module = 106
  3351. const m___NR_dup = 23
  3352. const m___NR_dup3 = 24
  3353. const m___NR_epoll_create1 = 20
  3354. const m___NR_epoll_ctl = 21
  3355. const m___NR_epoll_pwait = 22
  3356. const m___NR_epoll_pwait2 = 441
  3357. const m___NR_eventfd2 = 19
  3358. const m___NR_execve = 221
  3359. const m___NR_execveat = 281
  3360. const m___NR_exit = 93
  3361. const m___NR_exit_group = 94
  3362. const m___NR_faccessat = 48
  3363. const m___NR_faccessat2 = 439
  3364. const m___NR_fadvise64 = 223
  3365. const m___NR_fallocate = 47
  3366. const m___NR_fanotify_init = 262
  3367. const m___NR_fanotify_mark = 263
  3368. const m___NR_fchdir = 50
  3369. const m___NR_fchmod = 52
  3370. const m___NR_fchmodat = 53
  3371. const m___NR_fchmodat2 = 452
  3372. const m___NR_fchown = 55
  3373. const m___NR_fchownat = 54
  3374. const m___NR_fcntl = 25
  3375. const m___NR_fdatasync = 83
  3376. const m___NR_fgetxattr = 10
  3377. const m___NR_finit_module = 273
  3378. const m___NR_flistxattr = 13
  3379. const m___NR_flock = 32
  3380. const m___NR_fremovexattr = 16
  3381. const m___NR_fsconfig = 431
  3382. const m___NR_fsetxattr = 7
  3383. const m___NR_fsmount = 432
  3384. const m___NR_fsopen = 430
  3385. const m___NR_fspick = 433
  3386. const m___NR_fstat = 80
  3387. const m___NR_fstatfs = 44
  3388. const m___NR_fsync = 82
  3389. const m___NR_ftruncate = 46
  3390. const m___NR_futex = 98
  3391. const m___NR_futex_waitv = 449
  3392. const m___NR_get_mempolicy = 236
  3393. const m___NR_get_robust_list = 100
  3394. const m___NR_getcpu = 168
  3395. const m___NR_getcwd = 17
  3396. const m___NR_getdents64 = 61
  3397. const m___NR_getegid = 177
  3398. const m___NR_geteuid = 175
  3399. const m___NR_getgid = 176
  3400. const m___NR_getgroups = 158
  3401. const m___NR_getitimer = 102
  3402. const m___NR_getpeername = 205
  3403. const m___NR_getpgid = 155
  3404. const m___NR_getpid = 172
  3405. const m___NR_getppid = 173
  3406. const m___NR_getpriority = 141
  3407. const m___NR_getrandom = 278
  3408. const m___NR_getresgid = 150
  3409. const m___NR_getresuid = 148
  3410. const m___NR_getrlimit = 163
  3411. const m___NR_getrusage = 165
  3412. const m___NR_getsid = 156
  3413. const m___NR_getsockname = 204
  3414. const m___NR_getsockopt = 209
  3415. const m___NR_gettid = 178
  3416. const m___NR_gettimeofday = 169
  3417. const m___NR_getuid = 174
  3418. const m___NR_getxattr = 8
  3419. const m___NR_init_module = 105
  3420. const m___NR_inotify_add_watch = 27
  3421. const m___NR_inotify_init1 = 26
  3422. const m___NR_inotify_rm_watch = 28
  3423. const m___NR_io_cancel = 3
  3424. const m___NR_io_destroy = 1
  3425. const m___NR_io_getevents = 4
  3426. const m___NR_io_pgetevents = 292
  3427. const m___NR_io_setup = 0
  3428. const m___NR_io_submit = 2
  3429. const m___NR_io_uring_enter = 426
  3430. const m___NR_io_uring_register = 427
  3431. const m___NR_io_uring_setup = 425
  3432. const m___NR_ioctl = 29
  3433. const m___NR_ioprio_get = 31
  3434. const m___NR_ioprio_set = 30
  3435. const m___NR_kcmp = 272
  3436. const m___NR_kexec_file_load = 294
  3437. const m___NR_kexec_load = 104
  3438. const m___NR_keyctl = 219
  3439. const m___NR_kill = 129
  3440. const m___NR_landlock_add_rule = 445
  3441. const m___NR_landlock_create_ruleset = 444
  3442. const m___NR_landlock_restrict_self = 446
  3443. const m___NR_lgetxattr = 9
  3444. const m___NR_linkat = 37
  3445. const m___NR_listen = 201
  3446. const m___NR_listxattr = 11
  3447. const m___NR_llistxattr = 12
  3448. const m___NR_lookup_dcookie = 18
  3449. const m___NR_lremovexattr = 15
  3450. const m___NR_lseek = 62
  3451. const m___NR_lsetxattr = 6
  3452. const m___NR_madvise = 233
  3453. const m___NR_mbind = 235
  3454. const m___NR_membarrier = 283
  3455. const m___NR_memfd_create = 279
  3456. const m___NR_migrate_pages = 238
  3457. const m___NR_mincore = 232
  3458. const m___NR_mkdirat = 34
  3459. const m___NR_mknodat = 33
  3460. const m___NR_mlock = 228
  3461. const m___NR_mlock2 = 284
  3462. const m___NR_mlockall = 230
  3463. const m___NR_mmap = 222
  3464. const m___NR_mount = 40
  3465. const m___NR_mount_setattr = 442
  3466. const m___NR_move_mount = 429
  3467. const m___NR_move_pages = 239
  3468. const m___NR_mprotect = 226
  3469. const m___NR_mq_getsetattr = 185
  3470. const m___NR_mq_notify = 184
  3471. const m___NR_mq_open = 180
  3472. const m___NR_mq_timedreceive = 183
  3473. const m___NR_mq_timedsend = 182
  3474. const m___NR_mq_unlink = 181
  3475. const m___NR_mremap = 216
  3476. const m___NR_msgctl = 187
  3477. const m___NR_msgget = 186
  3478. const m___NR_msgrcv = 188
  3479. const m___NR_msgsnd = 189
  3480. const m___NR_msync = 227
  3481. const m___NR_munlock = 229
  3482. const m___NR_munlockall = 231
  3483. const m___NR_munmap = 215
  3484. const m___NR_name_to_handle_at = 264
  3485. const m___NR_nanosleep = 101
  3486. const m___NR_newfstatat = 79
  3487. const m___NR_nfsservctl = 42
  3488. const m___NR_open_by_handle_at = 265
  3489. const m___NR_open_tree = 428
  3490. const m___NR_openat = 56
  3491. const m___NR_openat2 = 437
  3492. const m___NR_perf_event_open = 241
  3493. const m___NR_personality = 92
  3494. const m___NR_pidfd_getfd = 438
  3495. const m___NR_pidfd_open = 434
  3496. const m___NR_pidfd_send_signal = 424
  3497. const m___NR_pipe2 = 59
  3498. const m___NR_pivot_root = 41
  3499. const m___NR_pkey_alloc = 289
  3500. const m___NR_pkey_free = 290
  3501. const m___NR_pkey_mprotect = 288
  3502. const m___NR_ppoll = 73
  3503. const m___NR_prctl = 167
  3504. const m___NR_pread64 = 67
  3505. const m___NR_preadv = 69
  3506. const m___NR_preadv2 = 286
  3507. const m___NR_prlimit64 = 261
  3508. const m___NR_process_madvise = 440
  3509. const m___NR_process_mrelease = 448
  3510. const m___NR_process_vm_readv = 270
  3511. const m___NR_process_vm_writev = 271
  3512. const m___NR_pselect6 = 72
  3513. const m___NR_ptrace = 117
  3514. const m___NR_pwrite64 = 68
  3515. const m___NR_pwritev = 70
  3516. const m___NR_pwritev2 = 287
  3517. const m___NR_quotactl = 60
  3518. const m___NR_read = 63
  3519. const m___NR_readahead = 213
  3520. const m___NR_readlinkat = 78
  3521. const m___NR_readv = 65
  3522. const m___NR_reboot = 142
  3523. const m___NR_recvfrom = 207
  3524. const m___NR_recvmmsg = 243
  3525. const m___NR_recvmsg = 212
  3526. const m___NR_remap_file_pages = 234
  3527. const m___NR_removexattr = 14
  3528. const m___NR_renameat2 = 276
  3529. const m___NR_request_key = 218
  3530. const m___NR_restart_syscall = 128
  3531. const m___NR_rseq = 293
  3532. const m___NR_rt_sigaction = 134
  3533. const m___NR_rt_sigpending = 136
  3534. const m___NR_rt_sigprocmask = 135
  3535. const m___NR_rt_sigqueueinfo = 138
  3536. const m___NR_rt_sigreturn = 139
  3537. const m___NR_rt_sigsuspend = 133
  3538. const m___NR_rt_sigtimedwait = 137
  3539. const m___NR_rt_tgsigqueueinfo = 240
  3540. const m___NR_sched_get_priority_max = 125
  3541. const m___NR_sched_get_priority_min = 126
  3542. const m___NR_sched_getaffinity = 123
  3543. const m___NR_sched_getattr = 275
  3544. const m___NR_sched_getparam = 121
  3545. const m___NR_sched_getscheduler = 120
  3546. const m___NR_sched_rr_get_interval = 127
  3547. const m___NR_sched_setaffinity = 122
  3548. const m___NR_sched_setattr = 274
  3549. const m___NR_sched_setparam = 118
  3550. const m___NR_sched_setscheduler = 119
  3551. const m___NR_sched_yield = 124
  3552. const m___NR_seccomp = 277
  3553. const m___NR_semctl = 191
  3554. const m___NR_semget = 190
  3555. const m___NR_semop = 193
  3556. const m___NR_semtimedop = 192
  3557. const m___NR_sendfile = 71
  3558. const m___NR_sendmmsg = 269
  3559. const m___NR_sendmsg = 211
  3560. const m___NR_sendto = 206
  3561. const m___NR_set_mempolicy = 237
  3562. const m___NR_set_mempolicy_home_node = 450
  3563. const m___NR_set_robust_list = 99
  3564. const m___NR_set_tid_address = 96
  3565. const m___NR_setdomainname = 162
  3566. const m___NR_setfsgid = 152
  3567. const m___NR_setfsuid = 151
  3568. const m___NR_setgid = 144
  3569. const m___NR_setgroups = 159
  3570. const m___NR_sethostname = 161
  3571. const m___NR_setitimer = 103
  3572. const m___NR_setns = 268
  3573. const m___NR_setpgid = 154
  3574. const m___NR_setpriority = 140
  3575. const m___NR_setregid = 143
  3576. const m___NR_setresgid = 149
  3577. const m___NR_setresuid = 147
  3578. const m___NR_setreuid = 145
  3579. const m___NR_setrlimit = 164
  3580. const m___NR_setsid = 157
  3581. const m___NR_setsockopt = 208
  3582. const m___NR_settimeofday = 170
  3583. const m___NR_setuid = 146
  3584. const m___NR_setxattr = 5
  3585. const m___NR_shmat = 196
  3586. const m___NR_shmctl = 195
  3587. const m___NR_shmdt = 197
  3588. const m___NR_shmget = 194
  3589. const m___NR_shutdown = 210
  3590. const m___NR_sigaltstack = 132
  3591. const m___NR_signalfd4 = 74
  3592. const m___NR_socket = 198
  3593. const m___NR_socketpair = 199
  3594. const m___NR_splice = 76
  3595. const m___NR_statfs = 43
  3596. const m___NR_statx = 291
  3597. const m___NR_swapoff = 225
  3598. const m___NR_swapon = 224
  3599. const m___NR_symlinkat = 36
  3600. const m___NR_sync = 81
  3601. const m___NR_sync_file_range = 84
  3602. const m___NR_syncfs = 267
  3603. const m___NR_sysinfo = 179
  3604. const m___NR_syslog = 116
  3605. const m___NR_sysriscv = "__NR_arch_specific_syscall"
  3606. const m___NR_tee = 77
  3607. const m___NR_tgkill = 131
  3608. const m___NR_timer_create = 107
  3609. const m___NR_timer_delete = 111
  3610. const m___NR_timer_getoverrun = 109
  3611. const m___NR_timer_gettime = 108
  3612. const m___NR_timer_settime = 110
  3613. const m___NR_timerfd_create = 85
  3614. const m___NR_timerfd_gettime = 87
  3615. const m___NR_timerfd_settime = 86
  3616. const m___NR_times = 153
  3617. const m___NR_tkill = 130
  3618. const m___NR_truncate = 45
  3619. const m___NR_umask = 166
  3620. const m___NR_umount2 = 39
  3621. const m___NR_uname = 160
  3622. const m___NR_unlinkat = 35
  3623. const m___NR_unshare = 97
  3624. const m___NR_userfaultfd = 282
  3625. const m___NR_utimensat = 88
  3626. const m___NR_vhangup = 58
  3627. const m___NR_vmsplice = 75
  3628. const m___NR_wait4 = 260
  3629. const m___NR_waitid = 95
  3630. const m___NR_write = 64
  3631. const m___NR_writev = 66
  3632. const m_d_fileno = "d_ino"
  3633. type Tdirent = struct {
  3634. Fd_ino Tino_t
  3635. Fd_off Toff_t
  3636. Fd_reclen uint16
  3637. Fd_type uint8
  3638. Fd_name [256]uint8
  3639. }
  3640. func _closefrom_close(tls *libc.TLS, fd int32) {
  3641. libc.Xclose(tls, fd)
  3642. }
  3643. func _sys_close_range(tls *libc.TLS, fd uint32, max_fd uint32, flags uint32) (r int32) {
  3644. bp := tls.Alloc(32)
  3645. defer tls.Free(32)
  3646. return int32(libc.Xsyscall(tls, int64(m_SYS_close_range), libc.VaList(bp+8, fd, max_fd, flags)))
  3647. }
  3648. // C documentation
  3649. //
  3650. // /*
  3651. // * Close all file descriptors greater than or equal to lowfd.
  3652. // * This is the expensive (fallback) method.
  3653. // */
  3654. func _closefrom_fallback(tls *libc.TLS, lowfd int32) {
  3655. var fd, maxfd int64
  3656. _, _ = fd, maxfd
  3657. /*
  3658. * Fall back on sysconf(_SC_OPEN_MAX) or getdtablesize(). This is
  3659. * equivalent to checking the RLIMIT_NOFILE soft limit. It is
  3660. * possible for there to be open file descriptors past this limit
  3661. * but there is not much we can do about that since the hard limit
  3662. * may be RLIM_INFINITY (LLONG_MAX or ULLONG_MAX on modern systems).
  3663. */
  3664. maxfd = libc.Xsysconf(tls, int32(m__SC_OPEN_MAX))
  3665. if maxfd < int64(m_OPEN_MAX) {
  3666. maxfd = int64(m_OPEN_MAX)
  3667. }
  3668. /* Make sure we did not get RLIM_INFINITY as the upper limit. */
  3669. if maxfd > int64(m_INT_MAX1) {
  3670. maxfd = int64(m_INT_MAX1)
  3671. }
  3672. fd = int64(lowfd)
  3673. for {
  3674. if !(fd < maxfd) {
  3675. break
  3676. }
  3677. _closefrom_close(tls, int32(fd))
  3678. goto _1
  3679. _1:
  3680. ;
  3681. fd++
  3682. }
  3683. }
  3684. func _closefrom_procfs(tls *libc.TLS, lowfd int32) (r int32) {
  3685. bp := tls.Alloc(16)
  3686. defer tls.Free(16)
  3687. var dent, dirp, fd_array, path, ptr, v1 uintptr
  3688. var fd, fd_array_size, fd_array_used, i, ret, v2 int32
  3689. var _ /* errstr at bp+0 */ uintptr
  3690. _, _, _, _, _, _, _, _, _, _, _, _ = dent, dirp, fd, fd_array, fd_array_size, fd_array_used, i, path, ptr, ret, v1, v2
  3691. fd_array = libc.UintptrFromInt32(0)
  3692. fd_array_used = 0
  3693. fd_array_size = 0
  3694. ret = 0
  3695. /* Use /proc/self/fd (or /dev/fd on macOS) if it exists. */
  3696. path = __ccgo_ts
  3697. dirp = libc.Xopendir(tls, path)
  3698. if dirp == libc.UintptrFromInt32(0) {
  3699. return -int32(1)
  3700. }
  3701. for {
  3702. v1 = libc.Xreaddir(tls, dirp)
  3703. dent = v1
  3704. if !(v1 != libc.UintptrFromInt32(0)) {
  3705. break
  3706. }
  3707. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(dent + 19))) == int32('.') {
  3708. continue
  3709. }
  3710. fd = int32(Xstrtonum(tls, dent+19, int64(lowfd), int64(m_INT_MAX1), bp))
  3711. if *(*uintptr)(unsafe.Pointer(bp)) != libc.UintptrFromInt32(0) || fd == libc.Xdirfd(tls, dirp) {
  3712. continue
  3713. }
  3714. if fd_array_used >= fd_array_size {
  3715. if fd_array_size > 0 {
  3716. fd_array_size *= int32(2)
  3717. } else {
  3718. fd_array_size = int32(32)
  3719. }
  3720. ptr = Xreallocarray(tls, fd_array, libc.Uint64FromInt32(fd_array_size), uint64(4))
  3721. if ptr == libc.UintptrFromInt32(0) {
  3722. ret = -int32(1)
  3723. break
  3724. }
  3725. fd_array = ptr
  3726. }
  3727. v2 = fd_array_used
  3728. fd_array_used++
  3729. *(*int32)(unsafe.Pointer(fd_array + uintptr(v2)*4)) = fd
  3730. }
  3731. i = 0
  3732. for {
  3733. if !(i < fd_array_used) {
  3734. break
  3735. }
  3736. _closefrom_close(tls, *(*int32)(unsafe.Pointer(fd_array + uintptr(i)*4)))
  3737. goto _3
  3738. _3:
  3739. ;
  3740. i++
  3741. }
  3742. libc.Xfree(tls, fd_array)
  3743. libc.Xclosedir(tls, dirp)
  3744. return ret
  3745. }
  3746. // C documentation
  3747. //
  3748. // /*
  3749. // * Close all file descriptors greater than or equal to lowfd.
  3750. // * We try the fast way first, falling back on the slow method.
  3751. // */
  3752. func Xclosefrom(tls *libc.TLS, lowfd int32) {
  3753. if lowfd < 0 {
  3754. lowfd = 0
  3755. }
  3756. /* Try the fast methods first, if possible. */
  3757. if _sys_close_range(tls, libc.Uint32FromInt32(lowfd), uint32(0xffffffff), uint32(0)) == 0 {
  3758. return
  3759. }
  3760. if _closefrom_procfs(tls, lowfd) != -int32(1) {
  3761. return
  3762. }
  3763. /* Do things the slow way. */
  3764. _closefrom_fallback(tls, lowfd)
  3765. }
  3766. /*
  3767. * Copyright © 2004-2024 Guillem Jover <guillem@hadrons.org>
  3768. *
  3769. * Redistribution and use in source and binary forms, with or without
  3770. * modification, are permitted provided that the following conditions
  3771. * are met:
  3772. * 1. Redistributions of source code must retain the above copyright
  3773. * notice, this list of conditions and the following disclaimer.
  3774. * 2. Redistributions in binary form must reproduce the above copyright
  3775. * notice, this list of conditions and the following disclaimer in the
  3776. * documentation and/or other materials provided with the distribution.
  3777. * 3. The name of the author may not be used to endorse or promote products
  3778. * derived from this software without specific prior written permission.
  3779. *
  3780. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  3781. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  3782. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  3783. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  3784. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  3785. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  3786. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  3787. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  3788. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  3789. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  3790. */
  3791. func Xvwarnc(tls *libc.TLS, code int32, format uintptr, ap Tva_list) {
  3792. bp := tls.Alloc(16)
  3793. defer tls.Free(16)
  3794. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+14, libc.VaList(bp+8, Xgetprogname(tls)))
  3795. if format != 0 {
  3796. libc.Xvfprintf(tls, libc.Xstderr, format, ap)
  3797. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+19, 0)
  3798. }
  3799. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+22, libc.VaList(bp+8, libc.Xstrerror(tls, code)))
  3800. }
  3801. func Xwarnc(tls *libc.TLS, code int32, format uintptr, va uintptr) {
  3802. var ap Tva_list
  3803. _ = ap
  3804. ap = va
  3805. Xvwarnc(tls, code, format, ap)
  3806. _ = ap
  3807. }
  3808. func Xverrc(tls *libc.TLS, status int32, code int32, format uintptr, ap Tva_list) {
  3809. bp := tls.Alloc(16)
  3810. defer tls.Free(16)
  3811. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+14, libc.VaList(bp+8, Xgetprogname(tls)))
  3812. if format != 0 {
  3813. libc.Xvfprintf(tls, libc.Xstderr, format, ap)
  3814. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+19, 0)
  3815. }
  3816. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+22, libc.VaList(bp+8, libc.Xstrerror(tls, code)))
  3817. libc.Xexit(tls, status)
  3818. }
  3819. func Xerrc(tls *libc.TLS, status int32, code int32, format uintptr, va uintptr) {
  3820. var ap Tva_list
  3821. _ = ap
  3822. ap = va
  3823. Xverrc(tls, status, code, format, ap)
  3824. _ = ap
  3825. }
  3826. const m_PRIX16 = "X"
  3827. const m_PRIX32 = "X"
  3828. const m_PRIX8 = "X"
  3829. const m_PRIXFAST16 = "X"
  3830. const m_PRIXFAST32 = "X"
  3831. const m_PRIXFAST8 = "X"
  3832. const m_PRIXLEAST16 = "X"
  3833. const m_PRIXLEAST32 = "X"
  3834. const m_PRIXLEAST8 = "X"
  3835. const m_PRId16 = "d"
  3836. const m_PRId32 = "d"
  3837. const m_PRId8 = "d"
  3838. const m_PRIdFAST16 = "d"
  3839. const m_PRIdFAST32 = "d"
  3840. const m_PRIdFAST8 = "d"
  3841. const m_PRIdLEAST16 = "d"
  3842. const m_PRIdLEAST32 = "d"
  3843. const m_PRIdLEAST8 = "d"
  3844. const m_PRIi16 = "i"
  3845. const m_PRIi32 = "i"
  3846. const m_PRIi8 = "i"
  3847. const m_PRIiFAST16 = "i"
  3848. const m_PRIiFAST32 = "i"
  3849. const m_PRIiFAST8 = "i"
  3850. const m_PRIiLEAST16 = "i"
  3851. const m_PRIiLEAST32 = "i"
  3852. const m_PRIiLEAST8 = "i"
  3853. const m_PRIo16 = "o"
  3854. const m_PRIo32 = "o"
  3855. const m_PRIo8 = "o"
  3856. const m_PRIoFAST16 = "o"
  3857. const m_PRIoFAST32 = "o"
  3858. const m_PRIoFAST8 = "o"
  3859. const m_PRIoLEAST16 = "o"
  3860. const m_PRIoLEAST32 = "o"
  3861. const m_PRIoLEAST8 = "o"
  3862. const m_PRIu16 = "u"
  3863. const m_PRIu32 = "u"
  3864. const m_PRIu8 = "u"
  3865. const m_PRIuFAST16 = "u"
  3866. const m_PRIuFAST32 = "u"
  3867. const m_PRIuFAST8 = "u"
  3868. const m_PRIuLEAST16 = "u"
  3869. const m_PRIuLEAST32 = "u"
  3870. const m_PRIuLEAST8 = "u"
  3871. const m_PRIx16 = "x"
  3872. const m_PRIx32 = "x"
  3873. const m_PRIx8 = "x"
  3874. const m_PRIxFAST16 = "x"
  3875. const m_PRIxFAST32 = "x"
  3876. const m_PRIxFAST8 = "x"
  3877. const m_PRIxLEAST16 = "x"
  3878. const m_PRIxLEAST32 = "x"
  3879. const m_PRIxLEAST8 = "x"
  3880. const m_SCNd16 = "hd"
  3881. const m_SCNd32 = "d"
  3882. const m_SCNd8 = "hhd"
  3883. const m_SCNdFAST16 = "d"
  3884. const m_SCNdFAST32 = "d"
  3885. const m_SCNdFAST8 = "hhd"
  3886. const m_SCNdLEAST16 = "hd"
  3887. const m_SCNdLEAST32 = "d"
  3888. const m_SCNdLEAST8 = "hhd"
  3889. const m_SCNi16 = "hi"
  3890. const m_SCNi32 = "i"
  3891. const m_SCNi8 = "hhi"
  3892. const m_SCNiFAST16 = "i"
  3893. const m_SCNiFAST32 = "i"
  3894. const m_SCNiFAST8 = "hhi"
  3895. const m_SCNiLEAST16 = "hi"
  3896. const m_SCNiLEAST32 = "i"
  3897. const m_SCNiLEAST8 = "hhi"
  3898. const m_SCNo16 = "ho"
  3899. const m_SCNo32 = "o"
  3900. const m_SCNo8 = "hho"
  3901. const m_SCNoFAST16 = "o"
  3902. const m_SCNoFAST32 = "o"
  3903. const m_SCNoFAST8 = "hho"
  3904. const m_SCNoLEAST16 = "ho"
  3905. const m_SCNoLEAST32 = "o"
  3906. const m_SCNoLEAST8 = "hho"
  3907. const m_SCNu16 = "hu"
  3908. const m_SCNu32 = "u"
  3909. const m_SCNu8 = "hhu"
  3910. const m_SCNuFAST16 = "u"
  3911. const m_SCNuFAST32 = "u"
  3912. const m_SCNuFAST8 = "hhu"
  3913. const m_SCNuLEAST16 = "hu"
  3914. const m_SCNuLEAST32 = "u"
  3915. const m_SCNuLEAST8 = "hhu"
  3916. const m_SCNx16 = "hx"
  3917. const m_SCNx32 = "x"
  3918. const m_SCNx8 = "hhx"
  3919. const m_SCNxFAST16 = "x"
  3920. const m_SCNxFAST32 = "x"
  3921. const m_SCNxFAST8 = "hhx"
  3922. const m_SCNxLEAST16 = "hx"
  3923. const m_SCNxLEAST32 = "x"
  3924. const m_SCNxLEAST8 = "hhx"
  3925. const m___PRI64 = "l"
  3926. const m___PRIPTR = "l"
  3927. type Timaxdiv_t = struct {
  3928. Fquot Tintmax_t
  3929. Frem Tintmax_t
  3930. }
  3931. /* Values for humanize_number(3)'s flags parameter. */
  3932. /* Values for humanize_number(3)'s scale parameter. */
  3933. /*
  3934. * fparseln() specific operation flags.
  3935. */
  3936. // C documentation
  3937. //
  3938. // /*
  3939. // * Convert an expression of the following forms to a uint64_t.
  3940. // * 1) A positive decimal number.
  3941. // * 2) A positive decimal number followed by a 'b' or 'B' (mult by 1).
  3942. // * 3) A positive decimal number followed by a 'k' or 'K' (mult by 1 << 10).
  3943. // * 4) A positive decimal number followed by a 'm' or 'M' (mult by 1 << 20).
  3944. // * 5) A positive decimal number followed by a 'g' or 'G' (mult by 1 << 30).
  3945. // * 6) A positive decimal number followed by a 't' or 'T' (mult by 1 << 40).
  3946. // * 7) A positive decimal number followed by a 'p' or 'P' (mult by 1 << 50).
  3947. // * 8) A positive decimal number followed by a 'e' or 'E' (mult by 1 << 60).
  3948. // */
  3949. func Xexpand_number(tls *libc.TLS, buf uintptr, num uintptr) (r int32) {
  3950. bp := tls.Alloc(16)
  3951. defer tls.Free(16)
  3952. var number Tuint64_t
  3953. var shift uint32
  3954. var _ /* endptr at bp+0 */ uintptr
  3955. _, _ = number, shift
  3956. number = libc.Xstrtoumax(tls, buf, bp, 0)
  3957. if *(*uintptr)(unsafe.Pointer(bp)) == buf {
  3958. /* No valid digits. */
  3959. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  3960. return -int32(1)
  3961. }
  3962. switch libc.Xtolower(tls, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))) {
  3963. case int32('e'):
  3964. shift = uint32(60)
  3965. case int32('p'):
  3966. shift = uint32(50)
  3967. case int32('t'):
  3968. shift = uint32(40)
  3969. case int32('g'):
  3970. shift = uint32(30)
  3971. case int32('m'):
  3972. shift = uint32(20)
  3973. case int32('k'):
  3974. shift = uint32(10)
  3975. case int32('b'):
  3976. fallthrough
  3977. case int32('\000'): /* No unit. */
  3978. *(*Tuint64_t)(unsafe.Pointer(num)) = number
  3979. return 0
  3980. default:
  3981. /* Unrecognized unit. */
  3982. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  3983. return -int32(1)
  3984. }
  3985. if number<<shift>>shift != number {
  3986. /* Overflow */
  3987. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ERANGE)
  3988. return -int32(1)
  3989. }
  3990. *(*Tuint64_t)(unsafe.Pointer(num)) = number << shift
  3991. return 0
  3992. }
  3993. func X__explicit_bzero_hook(tls *libc.TLS, buf uintptr, len1 Tsize_t) {
  3994. }
  3995. func Xexplicit_bzero(tls *libc.TLS, buf uintptr, len1 Tsize_t) {
  3996. libc.Xmemset(tls, buf, 0, len1)
  3997. X__explicit_bzero_hook(tls, buf, len1)
  3998. }
  3999. const m_FILEBUF_POOL_ITEMS = 32
  4000. /*
  4001. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  4002. *
  4003. * Redistribution and use in source and binary forms, with or without
  4004. * modification, are permitted provided that the following conditions
  4005. * are met:
  4006. * 1. Redistributions of source code must retain the above copyright
  4007. * notice, this list of conditions and the following disclaimer.
  4008. * 2. Redistributions in binary form must reproduce the above copyright
  4009. * notice, this list of conditions and the following disclaimer in the
  4010. * documentation and/or other materials provided with the distribution.
  4011. * 3. The name of the author may not be used to endorse or promote products
  4012. * derived from this software without specific prior written permission.
  4013. *
  4014. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  4015. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  4016. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  4017. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  4018. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  4019. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  4020. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  4021. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  4022. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  4023. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  4024. */
  4025. /*
  4026. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  4027. *
  4028. * Redistribution and use in source and binary forms, with or without
  4029. * modification, are permitted provided that the following conditions
  4030. * are met:
  4031. * 1. Redistributions of source code must retain the above copyright
  4032. * notice, this list of conditions and the following disclaimer.
  4033. * 2. Redistributions in binary form must reproduce the above copyright
  4034. * notice, this list of conditions and the following disclaimer in the
  4035. * documentation and/or other materials provided with the distribution.
  4036. * 3. The name of the author may not be used to endorse or promote products
  4037. * derived from this software without specific prior written permission.
  4038. *
  4039. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  4040. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  4041. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  4042. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  4043. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  4044. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  4045. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  4046. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  4047. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  4048. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  4049. */
  4050. /* Clang expands this to 1 if an identifier is *not* reserved. */
  4051. /*
  4052. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  4053. * musl, try to handle this gracefully.
  4054. */
  4055. /* Copyright (C) 1992-2024 Free Software Foundation, Inc.
  4056. Copyright The GNU Toolchain Authors.
  4057. This file is part of the GNU C Library.
  4058. The GNU C Library is free software; you can redistribute it and/or
  4059. modify it under the terms of the GNU Lesser General Public
  4060. License as published by the Free Software Foundation; either
  4061. version 2.1 of the License, or (at your option) any later version.
  4062. The GNU C Library is distributed in the hope that it will be useful,
  4063. but WITHOUT ANY WARRANTY; without even the implied warranty of
  4064. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  4065. Lesser General Public License for more details.
  4066. You should have received a copy of the GNU Lesser General Public
  4067. License along with the GNU C Library; if not, see
  4068. <https://www.gnu.org/licenses/>. */
  4069. type Tfilebuf = struct {
  4070. Ffp uintptr
  4071. Fbuf uintptr
  4072. Flen1 Tsize_t
  4073. }
  4074. var _fb_pool [32]Tfilebuf
  4075. var _fb_pool_cur int32
  4076. func Xfgetln(tls *libc.TLS, stream uintptr, len1 uintptr) (r uintptr) {
  4077. var fb uintptr
  4078. var nread Tssize_t
  4079. _, _ = fb, nread
  4080. libc.Xflockfile(tls, stream)
  4081. /* Try to diminish the possibility of several fgetln() calls being
  4082. * used on different streams, by using a pool of buffers per file. */
  4083. fb = uintptr(unsafe.Pointer(&_fb_pool)) + uintptr(_fb_pool_cur)*24
  4084. if (*Tfilebuf)(unsafe.Pointer(fb)).Ffp != stream && (*Tfilebuf)(unsafe.Pointer(fb)).Ffp != libc.UintptrFromInt32(0) {
  4085. _fb_pool_cur++
  4086. _fb_pool_cur %= int32(m_FILEBUF_POOL_ITEMS)
  4087. fb = uintptr(unsafe.Pointer(&_fb_pool)) + uintptr(_fb_pool_cur)*24
  4088. }
  4089. (*Tfilebuf)(unsafe.Pointer(fb)).Ffp = stream
  4090. nread = libc.Xgetline(tls, fb+8, fb+16, stream)
  4091. libc.Xfunlockfile(tls, stream)
  4092. /* Note: the getdelim/getline API ensures nread != 0. */
  4093. if nread == int64(-int32(1)) {
  4094. *(*Tsize_t)(unsafe.Pointer(len1)) = uint64(0)
  4095. return libc.UintptrFromInt32(0)
  4096. } else {
  4097. *(*Tsize_t)(unsafe.Pointer(len1)) = libc.Uint64FromInt64(nread)
  4098. return (*Tfilebuf)(unsafe.Pointer(fb)).Fbuf
  4099. }
  4100. return r
  4101. }
  4102. 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', '.'}
  4103. const m_FILEWBUF_INIT_LEN = 128
  4104. const m_FILEWBUF_POOL_ITEMS = 32
  4105. type Twint_t = uint32
  4106. type Twctype_t = uint64
  4107. type Tmbstate_t = struct {
  4108. F__opaque1 uint32
  4109. F__opaque2 uint32
  4110. }
  4111. type t__mbstate_t = Tmbstate_t
  4112. /*
  4113. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  4114. *
  4115. * Redistribution and use in source and binary forms, with or without
  4116. * modification, are permitted provided that the following conditions
  4117. * are met:
  4118. * 1. Redistributions of source code must retain the above copyright
  4119. * notice, this list of conditions and the following disclaimer.
  4120. * 2. Redistributions in binary form must reproduce the above copyright
  4121. * notice, this list of conditions and the following disclaimer in the
  4122. * documentation and/or other materials provided with the distribution.
  4123. * 3. The name of the author may not be used to endorse or promote products
  4124. * derived from this software without specific prior written permission.
  4125. *
  4126. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  4127. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  4128. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  4129. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  4130. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  4131. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  4132. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  4133. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  4134. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  4135. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  4136. */
  4137. /*
  4138. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  4139. *
  4140. * Redistribution and use in source and binary forms, with or without
  4141. * modification, are permitted provided that the following conditions
  4142. * are met:
  4143. * 1. Redistributions of source code must retain the above copyright
  4144. * notice, this list of conditions and the following disclaimer.
  4145. * 2. Redistributions in binary form must reproduce the above copyright
  4146. * notice, this list of conditions and the following disclaimer in the
  4147. * documentation and/or other materials provided with the distribution.
  4148. * 3. The name of the author may not be used to endorse or promote products
  4149. * derived from this software without specific prior written permission.
  4150. *
  4151. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  4152. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  4153. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  4154. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  4155. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  4156. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  4157. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  4158. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  4159. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  4160. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  4161. */
  4162. /* Clang expands this to 1 if an identifier is *not* reserved. */
  4163. /*
  4164. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  4165. * musl, try to handle this gracefully.
  4166. */
  4167. /* Copyright (C) 1992-2024 Free Software Foundation, Inc.
  4168. Copyright The GNU Toolchain Authors.
  4169. This file is part of the GNU C Library.
  4170. The GNU C Library is free software; you can redistribute it and/or
  4171. modify it under the terms of the GNU Lesser General Public
  4172. License as published by the Free Software Foundation; either
  4173. version 2.1 of the License, or (at your option) any later version.
  4174. The GNU C Library is distributed in the hope that it will be useful,
  4175. but WITHOUT ANY WARRANTY; without even the implied warranty of
  4176. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  4177. Lesser General Public License for more details.
  4178. You should have received a copy of the GNU Lesser General Public
  4179. License along with the GNU C Library; if not, see
  4180. <https://www.gnu.org/licenses/>. */
  4181. type Tfilewbuf = struct {
  4182. Ffp uintptr
  4183. Fwbuf uintptr
  4184. Flen1 Tsize_t
  4185. }
  4186. var _fb_pool1 [32]Tfilewbuf
  4187. var _fb_pool_cur1 int32
  4188. func Xfgetwln(tls *libc.TLS, stream uintptr, lenp uintptr) (r uintptr) {
  4189. var fb, wp, v3 uintptr
  4190. var wc, v1 Twint_t
  4191. var wused, v2 Tsize_t
  4192. _, _, _, _, _, _, _ = fb, wc, wp, wused, v1, v2, v3
  4193. wused = uint64(0)
  4194. /* Try to diminish the possibility of several fgetwln() calls being
  4195. * used on different streams, by using a pool of buffers per file. */
  4196. fb = uintptr(unsafe.Pointer(&_fb_pool1)) + uintptr(_fb_pool_cur1)*24
  4197. if (*Tfilewbuf)(unsafe.Pointer(fb)).Ffp != stream && (*Tfilewbuf)(unsafe.Pointer(fb)).Ffp != libc.UintptrFromInt32(0) {
  4198. _fb_pool_cur1++
  4199. _fb_pool_cur1 %= int32(m_FILEWBUF_POOL_ITEMS)
  4200. fb = uintptr(unsafe.Pointer(&_fb_pool1)) + uintptr(_fb_pool_cur1)*24
  4201. }
  4202. (*Tfilewbuf)(unsafe.Pointer(fb)).Ffp = stream
  4203. for {
  4204. v1 = libc.Xfgetwc(tls, stream)
  4205. wc = v1
  4206. if !(v1 != uint32(0xffffffff)) {
  4207. break
  4208. }
  4209. if !((*Tfilewbuf)(unsafe.Pointer(fb)).Flen1 != 0) || wused >= (*Tfilewbuf)(unsafe.Pointer(fb)).Flen1 {
  4210. if (*Tfilewbuf)(unsafe.Pointer(fb)).Flen1 != 0 {
  4211. *(*Tsize_t)(unsafe.Pointer(fb + 16)) *= uint64(2)
  4212. } else {
  4213. (*Tfilewbuf)(unsafe.Pointer(fb)).Flen1 = uint64(m_FILEWBUF_INIT_LEN)
  4214. }
  4215. wp = Xreallocarray(tls, (*Tfilewbuf)(unsafe.Pointer(fb)).Fwbuf, (*Tfilewbuf)(unsafe.Pointer(fb)).Flen1, uint64(4))
  4216. if wp == libc.UintptrFromInt32(0) {
  4217. wused = uint64(0)
  4218. break
  4219. }
  4220. (*Tfilewbuf)(unsafe.Pointer(fb)).Fwbuf = wp
  4221. }
  4222. v2 = wused
  4223. wused++
  4224. *(*Twchar_t)(unsafe.Pointer((*Tfilewbuf)(unsafe.Pointer(fb)).Fwbuf + uintptr(v2)*4)) = libc.Int32FromUint32(wc)
  4225. if wc == uint32('\n') {
  4226. break
  4227. }
  4228. }
  4229. *(*Tsize_t)(unsafe.Pointer(lenp)) = wused
  4230. if wused != 0 {
  4231. v3 = (*Tfilewbuf)(unsafe.Pointer(fb)).Fwbuf
  4232. } else {
  4233. v3 = libc.UintptrFromInt32(0)
  4234. }
  4235. return v3
  4236. }
  4237. // C documentation
  4238. //
  4239. // /* XXX: Ideally we'd recommend getwline(3), but unfortunately even though it
  4240. // * was part of the ISO/IEC TR 24731-2:2010 draft, it did not make it into C11
  4241. // * and is not widely implemented. */
  4242. 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', '.'}
  4243. const m_FPARSELN_UNESCALL1 = 15
  4244. const m_FPARSELN_UNESCCOMM1 = 4
  4245. const m_FPARSELN_UNESCCONT1 = 2
  4246. const m_FPARSELN_UNESCESC1 = 1
  4247. const m_FPARSELN_UNESCREST1 = 8
  4248. const m_static_assert = "_Static_assert"
  4249. // C documentation
  4250. //
  4251. // /* isescaped():
  4252. // * Return true if the character in *p that belongs to a string
  4253. // * that starts in *sp, is escaped by the escape character esc.
  4254. // */
  4255. func _isescaped(tls *libc.TLS, sp uintptr, p uintptr, esc int32) (r int32) {
  4256. var cp, v2 uintptr
  4257. var ne Tsize_t
  4258. _, _, _ = cp, ne, v2
  4259. /* No escape character */
  4260. if esc == int32('\000') {
  4261. return 0
  4262. }
  4263. /* Count the number of escape characters that precede ours */
  4264. ne = uint64(0)
  4265. cp = p
  4266. for {
  4267. cp--
  4268. v2 = cp
  4269. if !(v2 >= sp && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) == esc) {
  4270. break
  4271. }
  4272. goto _1
  4273. goto _1
  4274. _1:
  4275. ;
  4276. ne++
  4277. }
  4278. /* Return true if odd number of escape characters */
  4279. return libc.BoolInt32(ne&uint64(1) != uint64(0))
  4280. }
  4281. // C documentation
  4282. //
  4283. // /* fparseln():
  4284. // * Read a line from a file parsing continuations ending in * and eliminating trailing newlines, or comments starting with
  4285. // * the comment char.
  4286. // */
  4287. func Xfparseln(tls *libc.TLS, fp uintptr, size uintptr, lineno uintptr, str uintptr, flags int32) (r uintptr) {
  4288. bp := tls.Alloc(16)
  4289. defer tls.Free(16)
  4290. var buf, cp, v2, v3, v4, v5, v6, v7, v8, v9 uintptr
  4291. var cnt, skipesc int32
  4292. var com, con, esc, nl uint8
  4293. var len1 Tsize_t
  4294. var s Tssize_t
  4295. var _ /* ptr at bp+8 */ uintptr
  4296. var _ /* ptrlen at bp+0 */ Tsize_t
  4297. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = buf, cnt, com, con, cp, esc, len1, nl, s, skipesc, v2, v3, v4, v5, v6, v7, v8, v9
  4298. len1 = uint64(0)
  4299. buf = libc.UintptrFromInt32(0)
  4300. *(*Tsize_t)(unsafe.Pointer(bp)) = uint64(0)
  4301. *(*uintptr)(unsafe.Pointer(bp + 8)) = libc.UintptrFromInt32(0)
  4302. cnt = int32(1)
  4303. if str == libc.UintptrFromInt32(0) {
  4304. str = uintptr(unsafe.Pointer(&_dstr))
  4305. }
  4306. esc = *(*uint8)(unsafe.Pointer(str))
  4307. con = *(*uint8)(unsafe.Pointer(str + 1))
  4308. com = *(*uint8)(unsafe.Pointer(str + 2))
  4309. /*
  4310. * XXX: it would be cool to be able to specify the newline character,
  4311. * getdelim(3) does let us, but supporting it would diverge from BSDs.
  4312. */
  4313. nl = uint8('\n')
  4314. libc.Xflockfile(tls, fp)
  4315. for cnt != 0 {
  4316. cnt = 0
  4317. if lineno != 0 {
  4318. *(*Tsize_t)(unsafe.Pointer(lineno))++
  4319. }
  4320. s = libc.Xgetline(tls, bp+8, bp, fp)
  4321. if s < 0 {
  4322. break
  4323. }
  4324. if s != 0 && com != 0 { /* Check and eliminate comments */
  4325. cp = *(*uintptr)(unsafe.Pointer(bp + 8))
  4326. for {
  4327. if !(cp < *(*uintptr)(unsafe.Pointer(bp + 8))+uintptr(s)) {
  4328. break
  4329. }
  4330. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) == libc.Int32FromUint8(com) && !(_isescaped(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), cp, libc.Int32FromUint8(esc)) != 0) {
  4331. s = int64(cp) - int64(*(*uintptr)(unsafe.Pointer(bp + 8)))
  4332. cnt = libc.BoolInt32(s == 0 && buf == libc.UintptrFromInt32(0))
  4333. break
  4334. }
  4335. goto _1
  4336. _1:
  4337. ;
  4338. cp++
  4339. }
  4340. }
  4341. if s != 0 && nl != 0 { /* Check and eliminate newlines */
  4342. cp = *(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(s-int64(1))
  4343. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) == libc.Int32FromUint8(nl) {
  4344. s--
  4345. } /* forget newline */
  4346. }
  4347. if s != 0 && con != 0 { /* Check and eliminate continuations */
  4348. cp = *(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(s-int64(1))
  4349. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) == libc.Int32FromUint8(con) && !(_isescaped(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), cp, libc.Int32FromUint8(esc)) != 0) {
  4350. s-- /* forget continuation char */
  4351. cnt = int32(1)
  4352. }
  4353. }
  4354. if s == 0 {
  4355. /*
  4356. * nothing to add, skip realloc except in case
  4357. * we need a minimal buf to return an empty line
  4358. */
  4359. if cnt != 0 || buf != libc.UintptrFromInt32(0) {
  4360. continue
  4361. }
  4362. }
  4363. v2 = libc.Xrealloc(tls, buf, len1+libc.Uint64FromInt64(s)+uint64(1))
  4364. cp = v2
  4365. if v2 == libc.UintptrFromInt32(0) {
  4366. libc.Xfunlockfile(tls, fp)
  4367. libc.Xfree(tls, buf)
  4368. libc.Xfree(tls, *(*uintptr)(unsafe.Pointer(bp + 8)))
  4369. return libc.UintptrFromInt32(0)
  4370. }
  4371. buf = cp
  4372. libc.Xmemcpy(tls, buf+uintptr(len1), *(*uintptr)(unsafe.Pointer(bp + 8)), libc.Uint64FromInt64(s))
  4373. len1 += libc.Uint64FromInt64(s)
  4374. *(*uint8)(unsafe.Pointer(buf + uintptr(len1))) = uint8('\000')
  4375. }
  4376. libc.Xfunlockfile(tls, fp)
  4377. libc.Xfree(tls, *(*uintptr)(unsafe.Pointer(bp + 8)))
  4378. if flags&int32(m_FPARSELN_UNESCALL1) != 0 && esc != 0 && buf != libc.UintptrFromInt32(0) && libc.Xstrchr(tls, buf, libc.Int32FromUint8(esc)) != libc.UintptrFromInt32(0) {
  4379. v3 = buf
  4380. cp = v3
  4381. *(*uintptr)(unsafe.Pointer(bp + 8)) = v3
  4382. for libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) != int32('\000') {
  4383. for libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) != int32('\000') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) != libc.Int32FromUint8(esc) {
  4384. v4 = *(*uintptr)(unsafe.Pointer(bp + 8))
  4385. *(*uintptr)(unsafe.Pointer(bp + 8))++
  4386. v5 = cp
  4387. cp++
  4388. *(*uint8)(unsafe.Pointer(v4)) = *(*uint8)(unsafe.Pointer(v5))
  4389. }
  4390. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) == int32('\000') || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + 1))) == int32('\000') {
  4391. break
  4392. }
  4393. skipesc = 0
  4394. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + 1))) == libc.Int32FromUint8(com) {
  4395. skipesc += flags & int32(m_FPARSELN_UNESCCOMM1)
  4396. }
  4397. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + 1))) == libc.Int32FromUint8(con) {
  4398. skipesc += flags & int32(m_FPARSELN_UNESCCONT1)
  4399. }
  4400. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + 1))) == libc.Int32FromUint8(esc) {
  4401. skipesc += flags & int32(m_FPARSELN_UNESCESC1)
  4402. }
  4403. 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) {
  4404. skipesc = flags & int32(m_FPARSELN_UNESCREST1)
  4405. }
  4406. if skipesc != 0 {
  4407. cp++
  4408. } else {
  4409. v6 = *(*uintptr)(unsafe.Pointer(bp + 8))
  4410. *(*uintptr)(unsafe.Pointer(bp + 8))++
  4411. v7 = cp
  4412. cp++
  4413. *(*uint8)(unsafe.Pointer(v6)) = *(*uint8)(unsafe.Pointer(v7))
  4414. }
  4415. v8 = *(*uintptr)(unsafe.Pointer(bp + 8))
  4416. *(*uintptr)(unsafe.Pointer(bp + 8))++
  4417. v9 = cp
  4418. cp++
  4419. *(*uint8)(unsafe.Pointer(v8)) = *(*uint8)(unsafe.Pointer(v9))
  4420. }
  4421. *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))) = uint8('\000')
  4422. len1 = libc.Xstrlen(tls, buf)
  4423. }
  4424. if size != 0 {
  4425. *(*Tsize_t)(unsafe.Pointer(size)) = len1
  4426. }
  4427. return buf
  4428. }
  4429. var _dstr = [3]uint8{
  4430. 0: uint8('\\'),
  4431. 1: uint8('\\'),
  4432. 2: uint8('#'),
  4433. }
  4434. const m_FPARSELN_UNESCALL2 = 0x0f
  4435. const m_FPARSELN_UNESCCOMM2 = 0x04
  4436. const m_FPARSELN_UNESCCONT2 = 0x02
  4437. const m_FPARSELN_UNESCESC2 = 0x01
  4438. const m_FPARSELN_UNESCREST2 = 0x08
  4439. const m_LOCK_EX = 2
  4440. const m_LOCK_NB = 4
  4441. const m_LOCK_SH = 1
  4442. const m_LOCK_UN = 8
  4443. const m_O_CREAT1 = 64
  4444. const m_O_NONBLOCK1 = 2048
  4445. const m_O_TRUNC1 = 512
  4446. /* Values for humanize_number(3)'s flags parameter. */
  4447. /* Values for humanize_number(3)'s scale parameter. */
  4448. /*
  4449. * fparseln() specific operation flags.
  4450. */
  4451. func _lock_file(tls *libc.TLS, fd int32, flags int32) (r int32) {
  4452. var operation int32
  4453. _ = operation
  4454. operation = int32(m_LOCK_EX)
  4455. if flags&int32(m_O_NONBLOCK1) != 0 {
  4456. operation |= int32(m_LOCK_NB)
  4457. }
  4458. return libc.Xflock(tls, fd, operation)
  4459. }
  4460. // C documentation
  4461. //
  4462. // /*
  4463. // * Reliably open and lock a file.
  4464. // *
  4465. // * Please do not modify this code without first reading the revision history
  4466. // * and discussing your changes with <des@freebsd.org>. Don't be fooled by the
  4467. // * code's apparent simplicity; there would be no need for this function if it
  4468. // * was easy to get right.
  4469. // */
  4470. func _vflopenat(tls *libc.TLS, dirfd int32, path uintptr, flags int32, ap Tva_list) (r int32) {
  4471. bp := tls.Alloc(272)
  4472. defer tls.Free(272)
  4473. var fd, serrno, trunc, v2 int32
  4474. var mode Tmode_t
  4475. var _ /* fsb at bp+128 */ Tstat
  4476. var _ /* sb at bp+0 */ Tstat
  4477. _, _, _, _, _ = fd, mode, serrno, trunc, v2
  4478. mode = uint32(0)
  4479. if flags&int32(m_O_CREAT1) != 0 {
  4480. mode = libc.Uint32FromInt32(libc.VaInt32(&ap)) /* mode_t promoted to int */
  4481. }
  4482. trunc = flags & int32(m_O_TRUNC1)
  4483. flags &= ^libc.Int32FromInt32(m_O_TRUNC1)
  4484. for {
  4485. v2 = libc.Xopenat(tls, dirfd, path, flags, libc.VaList(bp+264, mode))
  4486. fd = v2
  4487. if v2 == -int32(1) {
  4488. /* non-existent or no access */
  4489. return -int32(1)
  4490. }
  4491. if _lock_file(tls, fd, flags) == -int32(1) {
  4492. /* unsupported or interrupted */
  4493. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  4494. libc.Xclose(tls, fd)
  4495. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  4496. return -int32(1)
  4497. }
  4498. if libc.Xfstatat(tls, dirfd, path, bp, 0) == -int32(1) {
  4499. /* disappeared from under our feet */
  4500. libc.Xclose(tls, fd)
  4501. goto _1
  4502. }
  4503. if libc.Xfstat(tls, fd, bp+128) == -int32(1) {
  4504. /* can't happen [tm] */
  4505. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  4506. libc.Xclose(tls, fd)
  4507. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  4508. return -int32(1)
  4509. }
  4510. if (*(*Tstat)(unsafe.Pointer(bp))).Fst_dev != (*(*Tstat)(unsafe.Pointer(bp + 128))).Fst_dev || (*(*Tstat)(unsafe.Pointer(bp))).Fst_ino != (*(*Tstat)(unsafe.Pointer(bp + 128))).Fst_ino {
  4511. /* changed under our feet */
  4512. libc.Xclose(tls, fd)
  4513. goto _1
  4514. }
  4515. if trunc != 0 && libc.Xftruncate(tls, fd, 0) != 0 {
  4516. /* can't happen [tm] */
  4517. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  4518. libc.Xclose(tls, fd)
  4519. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  4520. return -int32(1)
  4521. }
  4522. /*
  4523. * The following change is provided as a specific example to
  4524. * avoid.
  4525. */
  4526. return fd
  4527. goto _1
  4528. _1:
  4529. }
  4530. return r
  4531. }
  4532. func Xflopen(tls *libc.TLS, path uintptr, flags int32, va uintptr) (r int32) {
  4533. var ap Tva_list
  4534. var ret int32
  4535. _, _ = ap, ret
  4536. ap = va
  4537. ret = _vflopenat(tls, -int32(100), path, flags, ap)
  4538. _ = ap
  4539. return ret
  4540. }
  4541. func Xflopenat(tls *libc.TLS, dirfd int32, path uintptr, flags int32, va uintptr) (r int32) {
  4542. var ap Tva_list
  4543. var ret int32
  4544. _, _ = ap, ret
  4545. ap = va
  4546. ret = _vflopenat(tls, dirfd, path, flags, ap)
  4547. _ = ap
  4548. return ret
  4549. }
  4550. type ___e_fmtcheck_types = int32
  4551. const _FMTCHECK_START = 0
  4552. const _FMTCHECK_SHORT = 1
  4553. const _FMTCHECK_INT = 2
  4554. const _FMTCHECK_WINTT = 3
  4555. const _FMTCHECK_LONG = 4
  4556. const _FMTCHECK_QUAD = 5
  4557. const _FMTCHECK_INTMAXT = 6
  4558. const _FMTCHECK_PTRDIFFT = 7
  4559. const _FMTCHECK_SIZET = 8
  4560. const _FMTCHECK_POINTER = 9
  4561. const _FMTCHECK_CHARPOINTER = 10
  4562. const _FMTCHECK_SHORTPOINTER = 11
  4563. const _FMTCHECK_INTPOINTER = 12
  4564. const _FMTCHECK_LONGPOINTER = 13
  4565. const _FMTCHECK_QUADPOINTER = 14
  4566. const _FMTCHECK_INTMAXTPOINTER = 15
  4567. const _FMTCHECK_PTRDIFFTPOINTER = 16
  4568. const _FMTCHECK_SIZETPOINTER = 17
  4569. const _FMTCHECK_DOUBLE = 18
  4570. const _FMTCHECK_LONGDOUBLE = 19
  4571. const _FMTCHECK_STRING = 20
  4572. const _FMTCHECK_WSTRING = 21
  4573. const _FMTCHECK_WIDTH = 22
  4574. const _FMTCHECK_PRECISION = 23
  4575. const _FMTCHECK_DONE = 24
  4576. const _FMTCHECK_UNKNOWN = 25
  4577. type TEFT = int32
  4578. type _e_modifier = int32
  4579. const _MOD_NONE = 0
  4580. const _MOD_CHAR = 1
  4581. const _MOD_SHORT = 2
  4582. const _MOD_LONG = 3
  4583. const _MOD_QUAD = 4
  4584. const _MOD_INTMAXT = 5
  4585. const _MOD_LONGDOUBLE = 6
  4586. const _MOD_PTRDIFFT = 7
  4587. const _MOD_SIZET = 8
  4588. func _get_next_format_from_precision(tls *libc.TLS, pf uintptr) (r TEFT) {
  4589. var f uintptr
  4590. var modifier _e_modifier
  4591. _, _ = f, modifier
  4592. f = *(*uintptr)(unsafe.Pointer(pf))
  4593. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) {
  4594. case int32('h'):
  4595. f++
  4596. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  4597. *(*uintptr)(unsafe.Pointer(pf)) = f
  4598. return int32(_FMTCHECK_UNKNOWN)
  4599. }
  4600. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('h') {
  4601. f++
  4602. modifier = int32(_MOD_CHAR)
  4603. } else {
  4604. modifier = int32(_MOD_SHORT)
  4605. }
  4606. case int32('j'):
  4607. f++
  4608. modifier = int32(_MOD_INTMAXT)
  4609. case int32('l'):
  4610. f++
  4611. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  4612. *(*uintptr)(unsafe.Pointer(pf)) = f
  4613. return int32(_FMTCHECK_UNKNOWN)
  4614. }
  4615. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('l') {
  4616. f++
  4617. modifier = int32(_MOD_QUAD)
  4618. } else {
  4619. modifier = int32(_MOD_LONG)
  4620. }
  4621. case int32('q'):
  4622. f++
  4623. modifier = int32(_MOD_QUAD)
  4624. case int32('t'):
  4625. f++
  4626. modifier = int32(_MOD_PTRDIFFT)
  4627. case int32('z'):
  4628. f++
  4629. modifier = int32(_MOD_SIZET)
  4630. case int32('L'):
  4631. f++
  4632. modifier = int32(_MOD_LONGDOUBLE)
  4633. default:
  4634. modifier = int32(_MOD_NONE)
  4635. break
  4636. }
  4637. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  4638. *(*uintptr)(unsafe.Pointer(pf)) = f
  4639. return int32(_FMTCHECK_UNKNOWN)
  4640. }
  4641. if libc.Xstrchr(tls, __ccgo_ts+26, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f)))) != 0 {
  4642. switch modifier {
  4643. case int32(_MOD_LONG):
  4644. goto _1
  4645. case int32(_MOD_QUAD):
  4646. goto _2
  4647. case int32(_MOD_INTMAXT):
  4648. goto _3
  4649. case int32(_MOD_PTRDIFFT):
  4650. goto _4
  4651. case int32(_MOD_SIZET):
  4652. goto _5
  4653. case int32(_MOD_NONE):
  4654. goto _6
  4655. case int32(_MOD_SHORT):
  4656. goto _7
  4657. case int32(_MOD_CHAR):
  4658. goto _8
  4659. default:
  4660. goto _9
  4661. }
  4662. goto _10
  4663. _1:
  4664. ;
  4665. _13:
  4666. ;
  4667. *(*uintptr)(unsafe.Pointer(pf)) = f
  4668. return int32(_FMTCHECK_LONG)
  4669. goto _12
  4670. _12:
  4671. ;
  4672. if 0 != 0 {
  4673. goto _13
  4674. }
  4675. goto _11
  4676. _11:
  4677. ;
  4678. _2:
  4679. ;
  4680. *(*uintptr)(unsafe.Pointer(pf)) = f
  4681. return int32(_FMTCHECK_QUAD)
  4682. _3:
  4683. ;
  4684. *(*uintptr)(unsafe.Pointer(pf)) = f
  4685. return int32(_FMTCHECK_INTMAXT)
  4686. _4:
  4687. ;
  4688. *(*uintptr)(unsafe.Pointer(pf)) = f
  4689. return int32(_FMTCHECK_PTRDIFFT)
  4690. _5:
  4691. ;
  4692. *(*uintptr)(unsafe.Pointer(pf)) = f
  4693. return int32(_FMTCHECK_SIZET)
  4694. _8:
  4695. ;
  4696. _7:
  4697. ;
  4698. _6:
  4699. ;
  4700. *(*uintptr)(unsafe.Pointer(pf)) = f
  4701. return int32(_FMTCHECK_INT)
  4702. _9:
  4703. ;
  4704. *(*uintptr)(unsafe.Pointer(pf)) = f
  4705. return int32(_FMTCHECK_UNKNOWN)
  4706. _10:
  4707. }
  4708. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('n') {
  4709. switch modifier {
  4710. case int32(_MOD_CHAR):
  4711. goto _14
  4712. case int32(_MOD_SHORT):
  4713. goto _15
  4714. case int32(_MOD_LONG):
  4715. goto _16
  4716. case int32(_MOD_QUAD):
  4717. goto _17
  4718. case int32(_MOD_INTMAXT):
  4719. goto _18
  4720. case int32(_MOD_PTRDIFFT):
  4721. goto _19
  4722. case int32(_MOD_SIZET):
  4723. goto _20
  4724. case int32(_MOD_NONE):
  4725. goto _21
  4726. default:
  4727. goto _22
  4728. }
  4729. goto _23
  4730. _14:
  4731. ;
  4732. _26:
  4733. ;
  4734. *(*uintptr)(unsafe.Pointer(pf)) = f
  4735. return int32(_FMTCHECK_CHARPOINTER)
  4736. goto _25
  4737. _25:
  4738. ;
  4739. if 0 != 0 {
  4740. goto _26
  4741. }
  4742. goto _24
  4743. _24:
  4744. ;
  4745. _15:
  4746. ;
  4747. *(*uintptr)(unsafe.Pointer(pf)) = f
  4748. return int32(_FMTCHECK_SHORTPOINTER)
  4749. _16:
  4750. ;
  4751. *(*uintptr)(unsafe.Pointer(pf)) = f
  4752. return int32(_FMTCHECK_LONGPOINTER)
  4753. _17:
  4754. ;
  4755. *(*uintptr)(unsafe.Pointer(pf)) = f
  4756. return int32(_FMTCHECK_QUADPOINTER)
  4757. _18:
  4758. ;
  4759. *(*uintptr)(unsafe.Pointer(pf)) = f
  4760. return int32(_FMTCHECK_INTMAXTPOINTER)
  4761. _19:
  4762. ;
  4763. *(*uintptr)(unsafe.Pointer(pf)) = f
  4764. return int32(_FMTCHECK_PTRDIFFTPOINTER)
  4765. _20:
  4766. ;
  4767. *(*uintptr)(unsafe.Pointer(pf)) = f
  4768. return int32(_FMTCHECK_SIZETPOINTER)
  4769. _21:
  4770. ;
  4771. *(*uintptr)(unsafe.Pointer(pf)) = f
  4772. return int32(_FMTCHECK_INTPOINTER)
  4773. _22:
  4774. ;
  4775. *(*uintptr)(unsafe.Pointer(pf)) = f
  4776. return int32(_FMTCHECK_UNKNOWN)
  4777. _23:
  4778. }
  4779. if libc.Xstrchr(tls, __ccgo_ts+33, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f)))) != 0 {
  4780. if modifier != int32(_MOD_NONE) {
  4781. *(*uintptr)(unsafe.Pointer(pf)) = f
  4782. return int32(_FMTCHECK_UNKNOWN)
  4783. }
  4784. *(*uintptr)(unsafe.Pointer(pf)) = f
  4785. return int32(_FMTCHECK_LONG)
  4786. }
  4787. if libc.Xstrchr(tls, __ccgo_ts+37, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f)))) != 0 {
  4788. switch modifier {
  4789. case int32(_MOD_LONGDOUBLE):
  4790. goto _27
  4791. case int32(_MOD_NONE):
  4792. goto _28
  4793. case int32(_MOD_LONG):
  4794. goto _29
  4795. default:
  4796. goto _30
  4797. }
  4798. goto _31
  4799. _27:
  4800. ;
  4801. _34:
  4802. ;
  4803. *(*uintptr)(unsafe.Pointer(pf)) = f
  4804. return int32(_FMTCHECK_LONGDOUBLE)
  4805. goto _33
  4806. _33:
  4807. ;
  4808. if 0 != 0 {
  4809. goto _34
  4810. }
  4811. goto _32
  4812. _32:
  4813. ;
  4814. _29:
  4815. ;
  4816. _28:
  4817. ;
  4818. *(*uintptr)(unsafe.Pointer(pf)) = f
  4819. return int32(_FMTCHECK_DOUBLE)
  4820. _30:
  4821. ;
  4822. *(*uintptr)(unsafe.Pointer(pf)) = f
  4823. return int32(_FMTCHECK_UNKNOWN)
  4824. _31:
  4825. }
  4826. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('c') {
  4827. switch modifier {
  4828. case int32(_MOD_LONG):
  4829. goto _35
  4830. case int32(_MOD_NONE):
  4831. goto _36
  4832. default:
  4833. goto _37
  4834. }
  4835. goto _38
  4836. _35:
  4837. ;
  4838. _41:
  4839. ;
  4840. *(*uintptr)(unsafe.Pointer(pf)) = f
  4841. return int32(_FMTCHECK_WINTT)
  4842. goto _40
  4843. _40:
  4844. ;
  4845. if 0 != 0 {
  4846. goto _41
  4847. }
  4848. goto _39
  4849. _39:
  4850. ;
  4851. _36:
  4852. ;
  4853. *(*uintptr)(unsafe.Pointer(pf)) = f
  4854. return int32(_FMTCHECK_INT)
  4855. _37:
  4856. ;
  4857. *(*uintptr)(unsafe.Pointer(pf)) = f
  4858. return int32(_FMTCHECK_UNKNOWN)
  4859. _38:
  4860. }
  4861. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('C') {
  4862. if modifier != int32(_MOD_NONE) {
  4863. *(*uintptr)(unsafe.Pointer(pf)) = f
  4864. return int32(_FMTCHECK_UNKNOWN)
  4865. }
  4866. *(*uintptr)(unsafe.Pointer(pf)) = f
  4867. return int32(_FMTCHECK_WINTT)
  4868. }
  4869. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('s') {
  4870. switch modifier {
  4871. case int32(_MOD_LONG):
  4872. goto _42
  4873. case int32(_MOD_NONE):
  4874. goto _43
  4875. default:
  4876. goto _44
  4877. }
  4878. goto _45
  4879. _42:
  4880. ;
  4881. _48:
  4882. ;
  4883. *(*uintptr)(unsafe.Pointer(pf)) = f
  4884. return int32(_FMTCHECK_WSTRING)
  4885. goto _47
  4886. _47:
  4887. ;
  4888. if 0 != 0 {
  4889. goto _48
  4890. }
  4891. goto _46
  4892. _46:
  4893. ;
  4894. _43:
  4895. ;
  4896. *(*uintptr)(unsafe.Pointer(pf)) = f
  4897. return int32(_FMTCHECK_STRING)
  4898. _44:
  4899. ;
  4900. *(*uintptr)(unsafe.Pointer(pf)) = f
  4901. return int32(_FMTCHECK_UNKNOWN)
  4902. _45:
  4903. }
  4904. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('S') {
  4905. if modifier != int32(_MOD_NONE) {
  4906. *(*uintptr)(unsafe.Pointer(pf)) = f
  4907. return int32(_FMTCHECK_UNKNOWN)
  4908. }
  4909. *(*uintptr)(unsafe.Pointer(pf)) = f
  4910. return int32(_FMTCHECK_WSTRING)
  4911. }
  4912. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('p') {
  4913. if modifier != int32(_MOD_NONE) {
  4914. *(*uintptr)(unsafe.Pointer(pf)) = f
  4915. return int32(_FMTCHECK_UNKNOWN)
  4916. }
  4917. *(*uintptr)(unsafe.Pointer(pf)) = f
  4918. return int32(_FMTCHECK_POINTER)
  4919. }
  4920. *(*uintptr)(unsafe.Pointer(pf)) = f
  4921. return int32(_FMTCHECK_UNKNOWN)
  4922. /*NOTREACHED*/
  4923. return r
  4924. }
  4925. func _get_next_format_from_width(tls *libc.TLS, pf uintptr) (r TEFT) {
  4926. var f uintptr
  4927. _ = f
  4928. f = *(*uintptr)(unsafe.Pointer(pf))
  4929. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('.') {
  4930. f++
  4931. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('*') {
  4932. *(*uintptr)(unsafe.Pointer(pf)) = f
  4933. return int32(_FMTCHECK_PRECISION)
  4934. }
  4935. /* eat any precision (empty is allowed) */
  4936. for libc.BoolInt32(uint32(*(*uint8)(unsafe.Pointer(f)))-uint32('0') < uint32(10)) != 0 {
  4937. f++
  4938. }
  4939. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  4940. *(*uintptr)(unsafe.Pointer(pf)) = f
  4941. return int32(_FMTCHECK_UNKNOWN)
  4942. }
  4943. }
  4944. *(*uintptr)(unsafe.Pointer(pf)) = f
  4945. return _get_next_format_from_precision(tls, pf)
  4946. /*NOTREACHED*/
  4947. return r
  4948. }
  4949. func _get_next_format(tls *libc.TLS, pf uintptr, eft TEFT) (r TEFT) {
  4950. var f uintptr
  4951. var infmt int32
  4952. _, _ = f, infmt
  4953. if eft == int32(_FMTCHECK_WIDTH) {
  4954. *(*uintptr)(unsafe.Pointer(pf))++
  4955. return _get_next_format_from_width(tls, pf)
  4956. } else {
  4957. if eft == int32(_FMTCHECK_PRECISION) {
  4958. *(*uintptr)(unsafe.Pointer(pf))++
  4959. return _get_next_format_from_precision(tls, pf)
  4960. }
  4961. }
  4962. f = *(*uintptr)(unsafe.Pointer(pf))
  4963. infmt = 0
  4964. for !(infmt != 0) {
  4965. f = libc.Xstrchr(tls, f, int32('%'))
  4966. if f == libc.UintptrFromInt32(0) {
  4967. *(*uintptr)(unsafe.Pointer(pf)) = f
  4968. return int32(_FMTCHECK_DONE)
  4969. }
  4970. f++
  4971. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  4972. *(*uintptr)(unsafe.Pointer(pf)) = f
  4973. return int32(_FMTCHECK_UNKNOWN)
  4974. }
  4975. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) != int32('%') {
  4976. infmt = int32(1)
  4977. } else {
  4978. f++
  4979. }
  4980. }
  4981. /* Eat any of the flags */
  4982. for *(*uint8)(unsafe.Pointer(f)) != 0 && libc.Xstrchr(tls, __ccgo_ts+46, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f)))) != 0 {
  4983. f++
  4984. }
  4985. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f))) == int32('*') {
  4986. *(*uintptr)(unsafe.Pointer(pf)) = f
  4987. return int32(_FMTCHECK_WIDTH)
  4988. }
  4989. /* eat any width */
  4990. for libc.BoolInt32(uint32(*(*uint8)(unsafe.Pointer(f)))-uint32('0') < uint32(10)) != 0 {
  4991. f++
  4992. }
  4993. if !(*(*uint8)(unsafe.Pointer(f)) != 0) {
  4994. *(*uintptr)(unsafe.Pointer(pf)) = f
  4995. return int32(_FMTCHECK_UNKNOWN)
  4996. }
  4997. *(*uintptr)(unsafe.Pointer(pf)) = f
  4998. return _get_next_format_from_width(tls, pf)
  4999. /*NOTREACHED*/
  5000. return r
  5001. }
  5002. func Xfmtcheck(tls *libc.TLS, f1 uintptr, f2 uintptr) (r uintptr) {
  5003. bp := tls.Alloc(16)
  5004. defer tls.Free(16)
  5005. var f1t, f2t, v1 TEFT
  5006. var _ /* f1p at bp+0 */ uintptr
  5007. var _ /* f2p at bp+8 */ uintptr
  5008. _, _, _ = f1t, f2t, v1
  5009. if !(f1 != 0) {
  5010. return f2
  5011. }
  5012. *(*uintptr)(unsafe.Pointer(bp)) = f1
  5013. f1t = int32(_FMTCHECK_START)
  5014. *(*uintptr)(unsafe.Pointer(bp + 8)) = f2
  5015. f2t = int32(_FMTCHECK_START)
  5016. for {
  5017. v1 = _get_next_format(tls, bp, f1t)
  5018. f1t = v1
  5019. if !(v1 != int32(_FMTCHECK_DONE)) {
  5020. break
  5021. }
  5022. if f1t == int32(_FMTCHECK_UNKNOWN) {
  5023. return f2
  5024. }
  5025. f2t = _get_next_format(tls, bp+8, f2t)
  5026. if f1t != f2t {
  5027. return f2
  5028. }
  5029. }
  5030. return f1
  5031. }
  5032. const m_FSETLOCKING_BYCALLER = 2
  5033. const m_FSETLOCKING_INTERNAL = 1
  5034. const m_FSETLOCKING_QUERY = 0
  5035. func Xfpurge(tls *libc.TLS, fp uintptr) (r int32) {
  5036. if fp == libc.UintptrFromInt32(0) {
  5037. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EBADF)
  5038. return -int32(1)
  5039. }
  5040. libc.X__fpurge(tls, fp)
  5041. return 0
  5042. }
  5043. func Xfreezero(tls *libc.TLS, ptr uintptr, sz Tsize_t) {
  5044. /* This is legal. */
  5045. if ptr == libc.UintptrFromInt32(0) {
  5046. return
  5047. }
  5048. Xexplicit_bzero(tls, ptr, sz)
  5049. libc.Xfree(tls, ptr)
  5050. }
  5051. /*
  5052. * Copyright © 2004-2024 Guillem Jover <guillem@hadrons.org>
  5053. *
  5054. * Redistribution and use in source and binary forms, with or without
  5055. * modification, are permitted provided that the following conditions
  5056. * are met:
  5057. * 1. Redistributions of source code must retain the above copyright
  5058. * notice, this list of conditions and the following disclaimer.
  5059. * 2. Redistributions in binary form must reproduce the above copyright
  5060. * notice, this list of conditions and the following disclaimer in the
  5061. * documentation and/or other materials provided with the distribution.
  5062. * 3. The name of the author may not be used to endorse or promote products
  5063. * derived from this software without specific prior written permission.
  5064. *
  5065. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  5066. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  5067. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  5068. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  5069. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  5070. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  5071. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  5072. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  5073. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  5074. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  5075. */
  5076. type Tfunopen_cookie = struct {
  5077. Forig_cookie uintptr
  5078. Freadfn uintptr
  5079. Fwritefn uintptr
  5080. Fseekfn uintptr
  5081. Fclosefn uintptr
  5082. }
  5083. func _funopen_read(tls *libc.TLS, cookie uintptr, buf uintptr, size Tsize_t) (r Tssize_t) {
  5084. var cookiewrap uintptr
  5085. _ = cookiewrap
  5086. cookiewrap = cookie
  5087. if (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Freadfn == libc.UintptrFromInt32(0) {
  5088. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EBADF)
  5089. return int64(-int32(1))
  5090. }
  5091. 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)))
  5092. }
  5093. func _funopen_write(tls *libc.TLS, cookie uintptr, buf uintptr, size Tsize_t) (r Tssize_t) {
  5094. var cookiewrap uintptr
  5095. _ = cookiewrap
  5096. cookiewrap = cookie
  5097. if (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Fwritefn == libc.UintptrFromInt32(0) {
  5098. return int64(-libc.Int32FromInt32(1))
  5099. }
  5100. 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)))
  5101. }
  5102. func _funopen_seek(tls *libc.TLS, cookie uintptr, offset uintptr, whence int32) (r int32) {
  5103. var cookiewrap uintptr
  5104. var soff Toff_t
  5105. _, _ = cookiewrap, soff
  5106. cookiewrap = cookie
  5107. soff = *(*Toff_t)(unsafe.Pointer(offset))
  5108. if (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Fseekfn == libc.UintptrFromInt32(0) {
  5109. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ESPIPE)
  5110. return -int32(1)
  5111. }
  5112. 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)
  5113. *(*Toff_t)(unsafe.Pointer(offset)) = soff
  5114. return int32(*(*Toff_t)(unsafe.Pointer(offset)))
  5115. }
  5116. func _funopen_close(tls *libc.TLS, cookie uintptr) (r int32) {
  5117. var cookiewrap uintptr
  5118. var rc int32
  5119. _, _ = cookiewrap, rc
  5120. cookiewrap = cookie
  5121. if (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Fclosefn != 0 {
  5122. rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Fclosefn})))(tls, (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Forig_cookie)
  5123. } else {
  5124. rc = 0
  5125. }
  5126. libc.Xfree(tls, cookiewrap)
  5127. return rc
  5128. }
  5129. func Xfunopen(tls *libc.TLS, cookie uintptr, readfn uintptr, writefn uintptr, seekfn uintptr, closefn uintptr) (r uintptr) {
  5130. var cookiewrap, mode uintptr
  5131. var funcswrap Tcookie_io_functions_t
  5132. _, _, _ = cookiewrap, funcswrap, mode
  5133. funcswrap = Tcookie_io_functions_t{
  5134. Fread: __ccgo_fp(_funopen_read),
  5135. Fwrite: __ccgo_fp(_funopen_write),
  5136. Fseek: __ccgo_fp(_funopen_seek),
  5137. Fclose1: __ccgo_fp(_funopen_close),
  5138. }
  5139. if readfn != 0 {
  5140. if writefn == libc.UintptrFromInt32(0) {
  5141. mode = __ccgo_ts + 53
  5142. } else {
  5143. mode = __ccgo_ts + 55
  5144. }
  5145. } else {
  5146. if writefn != 0 {
  5147. mode = __ccgo_ts + 58
  5148. } else {
  5149. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  5150. return libc.UintptrFromInt32(0)
  5151. }
  5152. }
  5153. cookiewrap = libc.Xmalloc(tls, uint64(40))
  5154. if cookiewrap == libc.UintptrFromInt32(0) {
  5155. return libc.UintptrFromInt32(0)
  5156. }
  5157. (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Forig_cookie = cookie
  5158. (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Freadfn = readfn
  5159. (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Fwritefn = writefn
  5160. (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Fseekfn = seekfn
  5161. (*Tfunopen_cookie)(unsafe.Pointer(cookiewrap)).Fclosefn = closefn
  5162. return libc.Xfopencookie(tls, cookiewrap, mode, funcswrap)
  5163. }
  5164. const m_KB = 1024
  5165. const m_MAXB = "GB"
  5166. func Xgetbsize(tls *libc.TLS, headerlenp uintptr, blocksizep uintptr) (r uintptr) {
  5167. bp := tls.Alloc(32)
  5168. defer tls.Free(32)
  5169. var blocksize, max, mul, n, v15, v16, v17, v4 int64
  5170. var form, p, v3 uintptr
  5171. var _ /* ep at bp+0 */ uintptr
  5172. _, _, _, _, _, _, _, _, _, _, _ = blocksize, form, max, mul, n, p, v15, v16, v17, v3, v4
  5173. form = __ccgo_ts + 60
  5174. v3 = libc.Xgetenv(tls, __ccgo_ts+61)
  5175. p = v3
  5176. if !(v3 != libc.UintptrFromInt32(0) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) != int32('\000')) {
  5177. goto _1
  5178. }
  5179. v4 = libc.Xstrtol(tls, p, bp, int32(10))
  5180. n = v4
  5181. if v4 < 0 {
  5182. goto underflow
  5183. }
  5184. if n == 0 {
  5185. n = int64(1)
  5186. }
  5187. if *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))) != 0 && *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)) != 0 {
  5188. goto fmterr
  5189. }
  5190. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) {
  5191. case int32('g'):
  5192. goto _5
  5193. case int32('G'):
  5194. goto _6
  5195. case int32('k'):
  5196. goto _7
  5197. case int32('K'):
  5198. goto _8
  5199. case int32('m'):
  5200. goto _9
  5201. case int32('M'):
  5202. goto _10
  5203. case int32('\000'):
  5204. goto _11
  5205. default:
  5206. goto _12
  5207. }
  5208. goto _13
  5209. _6:
  5210. ;
  5211. _5:
  5212. ;
  5213. form = __ccgo_ts + 71
  5214. max = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) / (libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024))
  5215. mul = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024)
  5216. goto _13
  5217. _8:
  5218. ;
  5219. _7:
  5220. ;
  5221. form = __ccgo_ts + 73
  5222. max = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) / libc.Int64FromInt64(1024)
  5223. mul = int64(1024)
  5224. goto _13
  5225. _10:
  5226. ;
  5227. _9:
  5228. ;
  5229. form = __ccgo_ts + 75
  5230. max = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) / (libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024))
  5231. mul = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024)
  5232. goto _13
  5233. _11:
  5234. ;
  5235. max = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024)
  5236. mul = int64(1)
  5237. goto _13
  5238. _12:
  5239. ;
  5240. goto fmterr
  5241. fmterr:
  5242. ;
  5243. libc.Xwarnx(tls, __ccgo_ts+77, libc.VaList(bp+16, p))
  5244. n = int64(512)
  5245. max = libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024) * libc.Int64FromInt64(1024)
  5246. mul = int64(1)
  5247. goto _13
  5248. _13:
  5249. ;
  5250. if n > max {
  5251. 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))))
  5252. n = max
  5253. }
  5254. v15 = n * mul
  5255. blocksize = v15
  5256. if !(v15 < int64(512)) {
  5257. goto _14
  5258. }
  5259. goto underflow
  5260. underflow:
  5261. ;
  5262. libc.Xwarnx(tls, __ccgo_ts+125, 0)
  5263. form = __ccgo_ts + 60
  5264. v16 = libc.Int64FromInt32(512)
  5265. n = v16
  5266. blocksize = v16
  5267. _14:
  5268. ;
  5269. goto _2
  5270. _1:
  5271. ;
  5272. v17 = libc.Int64FromInt32(512)
  5273. n = v17
  5274. blocksize = v17
  5275. _2:
  5276. ;
  5277. libc.X__builtin_snprintf(tls, uintptr(unsafe.Pointer(&_header)), uint64(20), __ccgo_ts+150, libc.VaList(bp+16, n, form))
  5278. *(*int32)(unsafe.Pointer(headerlenp)) = libc.Int32FromUint64(libc.Xstrlen(tls, uintptr(unsafe.Pointer(&_header))))
  5279. *(*int64)(unsafe.Pointer(blocksizep)) = blocksize
  5280. return uintptr(unsafe.Pointer(&_header))
  5281. }
  5282. var _header [20]uint8
  5283. const m_AF_ALG = "PF_ALG"
  5284. const m_AF_APPLETALK = "PF_APPLETALK"
  5285. const m_AF_ASH = "PF_ASH"
  5286. const m_AF_ATMPVC = "PF_ATMPVC"
  5287. const m_AF_ATMSVC = "PF_ATMSVC"
  5288. const m_AF_AX25 = "PF_AX25"
  5289. const m_AF_BLUETOOTH = "PF_BLUETOOTH"
  5290. const m_AF_BRIDGE = "PF_BRIDGE"
  5291. const m_AF_CAIF = "PF_CAIF"
  5292. const m_AF_CAN = "PF_CAN"
  5293. const m_AF_DECnet = "PF_DECnet"
  5294. const m_AF_ECONET = "PF_ECONET"
  5295. const m_AF_FILE = "AF_LOCAL"
  5296. const m_AF_IB = "PF_IB"
  5297. const m_AF_IEEE802154 = "PF_IEEE802154"
  5298. const m_AF_INET = "PF_INET"
  5299. const m_AF_INET6 = "PF_INET6"
  5300. const m_AF_IPX = "PF_IPX"
  5301. const m_AF_IRDA = "PF_IRDA"
  5302. const m_AF_ISDN = "PF_ISDN"
  5303. const m_AF_IUCV = "PF_IUCV"
  5304. const m_AF_KCM = "PF_KCM"
  5305. const m_AF_KEY = "PF_KEY"
  5306. const m_AF_LLC = "PF_LLC"
  5307. const m_AF_LOCAL = "PF_LOCAL"
  5308. const m_AF_MAX = "PF_MAX"
  5309. const m_AF_MPLS = "PF_MPLS"
  5310. const m_AF_NETBEUI = "PF_NETBEUI"
  5311. const m_AF_NETLINK = "PF_NETLINK"
  5312. const m_AF_NETROM = "PF_NETROM"
  5313. const m_AF_NFC = "PF_NFC"
  5314. const m_AF_PACKET = "PF_PACKET"
  5315. const m_AF_PHONET = "PF_PHONET"
  5316. const m_AF_PPPOX = "PF_PPPOX"
  5317. const m_AF_QIPCRTR = "PF_QIPCRTR"
  5318. const m_AF_RDS = "PF_RDS"
  5319. const m_AF_ROSE = "PF_ROSE"
  5320. const m_AF_ROUTE = "PF_ROUTE"
  5321. const m_AF_RXRPC = "PF_RXRPC"
  5322. const m_AF_SECURITY = "PF_SECURITY"
  5323. const m_AF_SMC = "PF_SMC"
  5324. const m_AF_SNA = "PF_SNA"
  5325. const m_AF_TIPC = "PF_TIPC"
  5326. const m_AF_UNIX = "AF_LOCAL"
  5327. const m_AF_UNSPEC = "PF_UNSPEC"
  5328. const m_AF_VSOCK = "PF_VSOCK"
  5329. const m_AF_WANPIPE = "PF_WANPIPE"
  5330. const m_AF_X25 = "PF_X25"
  5331. const m_AF_XDP = "PF_XDP"
  5332. const m_INT_MAX2 = 0x7fffffff
  5333. const m_MSG_BATCH = 0x40000
  5334. const m_MSG_CMSG_CLOEXEC = 0x40000000
  5335. const m_MSG_CONFIRM = 0x0800
  5336. const m_MSG_CTRUNC = 0x0008
  5337. const m_MSG_DONTROUTE = 0x0004
  5338. const m_MSG_DONTWAIT = 0x0040
  5339. const m_MSG_EOR = 0x0080
  5340. const m_MSG_ERRQUEUE = 0x2000
  5341. const m_MSG_FASTOPEN = 0x20000000
  5342. const m_MSG_FIN = 0x0200
  5343. const m_MSG_MORE = 0x8000
  5344. const m_MSG_NOSIGNAL = 0x4000
  5345. const m_MSG_OOB = 0x0001
  5346. const m_MSG_PEEK = 0x0002
  5347. const m_MSG_PROXY = 0x0010
  5348. const m_MSG_RST = 0x1000
  5349. const m_MSG_SYN = 0x0400
  5350. const m_MSG_TRUNC = 0x0020
  5351. const m_MSG_WAITALL = 0x0100
  5352. const m_MSG_WAITFORONE = 0x10000
  5353. const m_MSG_ZEROCOPY = 0x4000000
  5354. const m_PF_ALG = 38
  5355. const m_PF_APPLETALK = 5
  5356. const m_PF_ASH = 18
  5357. const m_PF_ATMPVC = 8
  5358. const m_PF_ATMSVC = 20
  5359. const m_PF_AX25 = 3
  5360. const m_PF_BLUETOOTH = 31
  5361. const m_PF_BRIDGE = 7
  5362. const m_PF_CAIF = 37
  5363. const m_PF_CAN = 29
  5364. const m_PF_DECnet = 12
  5365. const m_PF_ECONET = 19
  5366. const m_PF_FILE = "PF_LOCAL"
  5367. const m_PF_IB = 27
  5368. const m_PF_IEEE802154 = 36
  5369. const m_PF_INET = 2
  5370. const m_PF_INET6 = 10
  5371. const m_PF_IPX = 4
  5372. const m_PF_IRDA = 23
  5373. const m_PF_ISDN = 34
  5374. const m_PF_IUCV = 32
  5375. const m_PF_KCM = 41
  5376. const m_PF_KEY = 15
  5377. const m_PF_LLC = 26
  5378. const m_PF_LOCAL = 1
  5379. const m_PF_MAX = 45
  5380. const m_PF_MPLS = 28
  5381. const m_PF_NETBEUI = 13
  5382. const m_PF_NETLINK = 16
  5383. const m_PF_NETROM = 6
  5384. const m_PF_NFC = 39
  5385. const m_PF_PACKET = 17
  5386. const m_PF_PHONET = 35
  5387. const m_PF_PPPOX = 24
  5388. const m_PF_QIPCRTR = 42
  5389. const m_PF_RDS = 21
  5390. const m_PF_ROSE = 11
  5391. const m_PF_ROUTE = "PF_NETLINK"
  5392. const m_PF_RXRPC = 33
  5393. const m_PF_SECURITY = 14
  5394. const m_PF_SMC = 43
  5395. const m_PF_SNA = 22
  5396. const m_PF_TIPC = 30
  5397. const m_PF_UNIX = "PF_LOCAL"
  5398. const m_PF_UNSPEC = 0
  5399. const m_PF_VSOCK = 40
  5400. const m_PF_WANPIPE = 25
  5401. const m_PF_X25 = 9
  5402. const m_PF_XDP = 44
  5403. const m_SCM_CREDENTIALS = 0x02
  5404. const m_SCM_RIGHTS = 0x01
  5405. const m_SCM_TIMESTAMP = "SO_TIMESTAMP"
  5406. const m_SCM_TIMESTAMPING = "SO_TIMESTAMPING"
  5407. const m_SCM_TIMESTAMPING_OPT_STATS = 54
  5408. const m_SCM_TIMESTAMPING_PKTINFO = 58
  5409. const m_SCM_TIMESTAMPNS = "SO_TIMESTAMPNS"
  5410. const m_SCM_TXTIME = "SO_TXTIME"
  5411. const m_SCM_WIFI_STATUS = "SO_WIFI_STATUS"
  5412. const m_SHUT_RD = 0
  5413. const m_SHUT_RDWR = 2
  5414. const m_SHUT_WR = 1
  5415. const m_SOCK_CLOEXEC = 02000000
  5416. const m_SOCK_DCCP = 6
  5417. const m_SOCK_DGRAM = 2
  5418. const m_SOCK_NONBLOCK = 04000
  5419. const m_SOCK_PACKET = 10
  5420. const m_SOCK_RAW = 3
  5421. const m_SOCK_RDM = 4
  5422. const m_SOCK_SEQPACKET = 5
  5423. const m_SOCK_STREAM = 1
  5424. const m_SOL_AAL = 265
  5425. const m_SOL_ALG = 279
  5426. const m_SOL_ATM = 264
  5427. const m_SOL_BLUETOOTH = 274
  5428. const m_SOL_CAIF = 278
  5429. const m_SOL_DCCP = 269
  5430. const m_SOL_DECNET = 261
  5431. const m_SOL_ICMPV6 = 58
  5432. const m_SOL_IP = 0
  5433. const m_SOL_IPV6 = 41
  5434. const m_SOL_IRDA = 266
  5435. const m_SOL_IUCV = 277
  5436. const m_SOL_KCM = 281
  5437. const m_SOL_LLC = 268
  5438. const m_SOL_NETBEUI = 267
  5439. const m_SOL_NETLINK = 270
  5440. const m_SOL_NFC = 280
  5441. const m_SOL_PACKET = 263
  5442. const m_SOL_PNPIPE = 275
  5443. const m_SOL_PPPOL2TP = 273
  5444. const m_SOL_RAW = 255
  5445. const m_SOL_RDS = 276
  5446. const m_SOL_RXRPC = 272
  5447. const m_SOL_SOCKET = 1
  5448. const m_SOL_TIPC = 271
  5449. const m_SOL_TLS = 282
  5450. const m_SOL_X25 = 262
  5451. const m_SOL_XDP = 283
  5452. const m_SOMAXCONN = 128
  5453. const m_SO_ACCEPTCONN = 30
  5454. const m_SO_ATTACH_BPF = 50
  5455. const m_SO_ATTACH_FILTER = 26
  5456. const m_SO_ATTACH_REUSEPORT_CBPF = 51
  5457. const m_SO_ATTACH_REUSEPORT_EBPF = 52
  5458. const m_SO_BINDTODEVICE = 25
  5459. const m_SO_BINDTOIFINDEX = 62
  5460. const m_SO_BPF_EXTENSIONS = 48
  5461. const m_SO_BROADCAST = 6
  5462. const m_SO_BSDCOMPAT = 14
  5463. const m_SO_BUSY_POLL = 46
  5464. const m_SO_BUSY_POLL_BUDGET = 70
  5465. const m_SO_CNX_ADVICE = 53
  5466. const m_SO_COOKIE = 57
  5467. const m_SO_DEBUG = 1
  5468. const m_SO_DETACH_BPF = "SO_DETACH_FILTER"
  5469. const m_SO_DETACH_FILTER = 27
  5470. const m_SO_DETACH_REUSEPORT_BPF = 68
  5471. const m_SO_DOMAIN = 39
  5472. const m_SO_DONTROUTE = 5
  5473. const m_SO_ERROR = 4
  5474. const m_SO_GET_FILTER = "SO_ATTACH_FILTER"
  5475. const m_SO_INCOMING_CPU = 49
  5476. const m_SO_INCOMING_NAPI_ID = 56
  5477. const m_SO_KEEPALIVE = 9
  5478. const m_SO_LINGER = 13
  5479. const m_SO_LOCK_FILTER = 44
  5480. const m_SO_MARK = 36
  5481. const m_SO_MAX_PACING_RATE = 47
  5482. const m_SO_MEMINFO = 55
  5483. const m_SO_NOFCS = 43
  5484. const m_SO_NO_CHECK = 11
  5485. const m_SO_OOBINLINE = 10
  5486. const m_SO_PASSCRED = 16
  5487. const m_SO_PASSSEC = 34
  5488. const m_SO_PEEK_OFF = 42
  5489. const m_SO_PEERCRED = 17
  5490. const m_SO_PEERGROUPS = 59
  5491. const m_SO_PEERNAME = 28
  5492. const m_SO_PEERSEC = 31
  5493. const m_SO_PREFER_BUSY_POLL = 69
  5494. const m_SO_PRIORITY = 12
  5495. const m_SO_PROTOCOL = 38
  5496. const m_SO_RCVBUF = 8
  5497. const m_SO_RCVBUFFORCE = 33
  5498. const m_SO_RCVLOWAT = 18
  5499. const m_SO_RCVTIMEO = 20
  5500. const m_SO_REUSEADDR = 2
  5501. const m_SO_REUSEPORT = 15
  5502. const m_SO_RXQ_OVFL = 40
  5503. const m_SO_SECURITY_AUTHENTICATION = 22
  5504. const m_SO_SECURITY_ENCRYPTION_NETWORK = 24
  5505. const m_SO_SECURITY_ENCRYPTION_TRANSPORT = 23
  5506. const m_SO_SELECT_ERR_QUEUE = 45
  5507. const m_SO_SNDBUF = 7
  5508. const m_SO_SNDBUFFORCE = 32
  5509. const m_SO_SNDLOWAT = 19
  5510. const m_SO_SNDTIMEO = 21
  5511. const m_SO_TIMESTAMP = 29
  5512. const m_SO_TIMESTAMPING = 37
  5513. const m_SO_TIMESTAMPNS = 35
  5514. const m_SO_TXTIME = 61
  5515. const m_SO_TYPE = 3
  5516. const m_SO_WIFI_STATUS = 41
  5517. const m_SO_ZEROCOPY = 60
  5518. const m_UINT_MAX2 = 0xffffffff
  5519. type Tsocklen_t = uint32
  5520. type Tsa_family_t = uint16
  5521. type Tmsghdr = struct {
  5522. Fmsg_name uintptr
  5523. Fmsg_namelen Tsocklen_t
  5524. Fmsg_iov uintptr
  5525. Fmsg_iovlen int32
  5526. F__pad1 int32
  5527. Fmsg_control uintptr
  5528. Fmsg_controllen Tsocklen_t
  5529. F__pad2 int32
  5530. Fmsg_flags int32
  5531. }
  5532. type Tcmsghdr = struct {
  5533. Fcmsg_len Tsocklen_t
  5534. F__pad1 int32
  5535. Fcmsg_level int32
  5536. Fcmsg_type int32
  5537. }
  5538. type Tucred = struct {
  5539. Fpid Tpid_t
  5540. Fuid Tuid_t
  5541. Fgid Tgid_t
  5542. }
  5543. type Tmmsghdr = struct {
  5544. Fmsg_hdr Tmsghdr
  5545. Fmsg_len uint32
  5546. }
  5547. type Tlinger = struct {
  5548. Fl_onoff int32
  5549. Fl_linger int32
  5550. }
  5551. type Tsockaddr = struct {
  5552. Fsa_family Tsa_family_t
  5553. Fsa_data [14]uint8
  5554. }
  5555. type Tsockaddr_storage = struct {
  5556. Fss_family Tsa_family_t
  5557. F__ss_padding [118]uint8
  5558. F__ss_align uint64
  5559. }
  5560. type Tsockaddr_un = struct {
  5561. Fsun_family Tsa_family_t
  5562. Fsun_path [108]uint8
  5563. }
  5564. // C documentation
  5565. //
  5566. // /* Linux and OpenBSD */
  5567. func Xgetpeereid(tls *libc.TLS, s int32, euid uintptr, egid uintptr) (r int32) {
  5568. bp := tls.Alloc(16)
  5569. defer tls.Free(16)
  5570. var ret int32
  5571. var _ /* cred at bp+0 */ Tucred
  5572. var _ /* credlen at bp+12 */ Tsocklen_t
  5573. _ = ret
  5574. *(*Tsocklen_t)(unsafe.Pointer(bp + 12)) = uint32(12)
  5575. ret = libc.Xgetsockopt(tls, s, int32(m_SOL_SOCKET), int32(m_SO_PEERCRED), bp, bp+12)
  5576. if ret != 0 {
  5577. return ret
  5578. }
  5579. *(*Tuid_t)(unsafe.Pointer(euid)) = (*(*Tucred)(unsafe.Pointer(bp))).Fuid
  5580. *(*Tgid_t)(unsafe.Pointer(egid)) = (*(*Tucred)(unsafe.Pointer(bp))).Fgid
  5581. return 0
  5582. }
  5583. const m_INT64_MAX1 = 9223372036854775807
  5584. func Xdehumanize_number(tls *libc.TLS, buf uintptr, num uintptr) (r int32) {
  5585. bp := tls.Alloc(16)
  5586. defer tls.Free(16)
  5587. var rc, sign, v1, v2 int32
  5588. var rmax Tuint64_t
  5589. var _ /* rval at bp+0 */ Tuint64_t
  5590. _, _, _, _, _ = rc, rmax, sign, v1, v2
  5591. sign = +libc.Int32FromInt32(1)
  5592. /* The current expand_number() implementation uses bit shifts, so
  5593. * we cannot pass negative numbers, preserve the sign and apply it
  5594. * later. */
  5595. for {
  5596. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(buf)))
  5597. v2 = libc.BoolInt32(v1 == int32(' ') || libc.Uint32FromInt32(v1)-uint32('\t') < uint32(5))
  5598. goto _3
  5599. _3:
  5600. if !(v2 != 0) {
  5601. break
  5602. }
  5603. buf++
  5604. }
  5605. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(buf))) == int32('-') {
  5606. sign = -int32(1)
  5607. buf++
  5608. }
  5609. rc = Xexpand_number(tls, buf, bp)
  5610. if rc < 0 {
  5611. return rc
  5612. }
  5613. /* The sign has been stripped, so rval has the absolute value.
  5614. * Error out, regardless of the sign, if rval is greater than
  5615. * abs(INT64_MIN) (== INT64_MAX + 1), or if the sign is positive
  5616. * and the value has overflown by one (INT64_MAX + 1). */
  5617. rmax = uint64(libc.Uint64FromInt64(libc.Int64FromInt64(m_INT64_MAX1)) + libc.Uint64FromUint64(1))
  5618. if *(*Tuint64_t)(unsafe.Pointer(bp)) > rmax || *(*Tuint64_t)(unsafe.Pointer(bp)) == rmax && sign == +libc.Int32FromInt32(1) {
  5619. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ERANGE)
  5620. return -int32(1)
  5621. }
  5622. *(*Tint64_t)(unsafe.Pointer(num)) = libc.Int64FromUint64(*(*Tuint64_t)(unsafe.Pointer(bp)) * libc.Uint64FromInt32(sign))
  5623. return 0
  5624. }
  5625. const m_HN_AUTOSCALE1 = 32
  5626. const m_HN_B1 = 4
  5627. const m_HN_DECIMAL1 = 1
  5628. const m_HN_DIVISOR_10001 = 8
  5629. const m_HN_GETSCALE1 = 16
  5630. const m_HN_IEC_PREFIXES1 = 16
  5631. const m_HN_NOSPACE1 = 2
  5632. const m_INT64_MAX2 = 0x7fffffffffffffff
  5633. const m_LC_ALL = 6
  5634. const m_LC_ALL_MASK = 0x7fffffff
  5635. const m_LC_COLLATE = 3
  5636. const m_LC_CTYPE = 0
  5637. const m_LC_MESSAGES = 5
  5638. const m_LC_MONETARY = 4
  5639. const m_LC_NUMERIC = 1
  5640. const m_LC_TIME = 2
  5641. type Tlconv = struct {
  5642. Fdecimal_point uintptr
  5643. Fthousands_sep uintptr
  5644. Fgrouping uintptr
  5645. Fint_curr_symbol uintptr
  5646. Fcurrency_symbol uintptr
  5647. Fmon_decimal_point uintptr
  5648. Fmon_thousands_sep uintptr
  5649. Fmon_grouping uintptr
  5650. Fpositive_sign uintptr
  5651. Fnegative_sign uintptr
  5652. Fint_frac_digits uint8
  5653. Ffrac_digits uint8
  5654. Fp_cs_precedes uint8
  5655. Fp_sep_by_space uint8
  5656. Fn_cs_precedes uint8
  5657. Fn_sep_by_space uint8
  5658. Fp_sign_posn uint8
  5659. Fn_sign_posn uint8
  5660. Fint_p_cs_precedes uint8
  5661. Fint_p_sep_by_space uint8
  5662. Fint_n_cs_precedes uint8
  5663. Fint_n_sep_by_space uint8
  5664. Fint_p_sign_posn uint8
  5665. Fint_n_sign_posn uint8
  5666. }
  5667. /*
  5668. * Copyright (c) 1996 Peter Wemm <peter@FreeBSD.org>.
  5669. * All rights reserved.
  5670. * Copyright (c) 2002 Networks Associates Technology, Inc.
  5671. * All rights reserved.
  5672. *
  5673. * Portions of this software were developed for the FreeBSD Project by
  5674. * ThinkSec AS and NAI Labs, the Security Research Division of Network
  5675. * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
  5676. * ("CBOSS"), as part of the DARPA CHATS research program.
  5677. *
  5678. * Redistribution and use in source and binary forms, with or without
  5679. * modification, is permitted provided that the following conditions
  5680. * are met:
  5681. * 1. Redistributions of source code must retain the above copyright
  5682. * notice, this list of conditions and the following disclaimer.
  5683. * 2. Redistributions in binary form must reproduce the above copyright
  5684. * notice, this list of conditions and the following disclaimer in the
  5685. * documentation and/or other materials provided with the distribution.
  5686. * 3. The name of the author may not be used to endorse or promote
  5687. * products derived from this software without specific prior written
  5688. * permission.
  5689. *
  5690. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  5691. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  5692. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  5693. * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  5694. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  5695. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  5696. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  5697. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  5698. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  5699. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  5700. * SUCH DAMAGE.
  5701. *
  5702. * $FreeBSD: src/lib/libutil/libutil.h,v 1.47 2008/04/23 00:49:12 scf Exp $
  5703. */
  5704. var _maxscale = int32(6)
  5705. func Xhumanize_number(tls *libc.TLS, buf uintptr, len1 Tsize_t, quotient Tint64_t, suffix uintptr, scale int32, flags int32) (r1 int32) {
  5706. bp := tls.Alloc(64)
  5707. defer tls.Free(64)
  5708. var baselen Tsize_t
  5709. var divisor, max Tint64_t
  5710. var divisordeccut, i, r, remainder, s1, s2, sign, v2 int32
  5711. var prefixes, sep uintptr
  5712. _, _, _, _, _, _, _, _, _, _, _, _, _ = baselen, divisor, divisordeccut, i, max, prefixes, r, remainder, s1, s2, sep, sign, v2
  5713. /* Since so many callers don't check -1, NUL terminate the buffer */
  5714. if len1 > uint64(0) {
  5715. *(*uint8)(unsafe.Pointer(buf)) = uint8('\000')
  5716. }
  5717. /* validate args */
  5718. if buf == libc.UintptrFromInt32(0) || suffix == libc.UintptrFromInt32(0) {
  5719. return -int32(1)
  5720. }
  5721. if scale < 0 {
  5722. return -int32(1)
  5723. } else {
  5724. if scale > _maxscale && scale & ^(libc.Int32FromInt32(m_HN_AUTOSCALE1)|libc.Int32FromInt32(m_HN_GETSCALE1)) != 0 {
  5725. return -int32(1)
  5726. }
  5727. }
  5728. if flags&int32(m_HN_DIVISOR_10001) != 0 && flags&int32(m_HN_IEC_PREFIXES1) != 0 {
  5729. return -int32(1)
  5730. }
  5731. /* setup parameters */
  5732. remainder = 0
  5733. if flags&int32(m_HN_IEC_PREFIXES1) != 0 {
  5734. baselen = uint64(2)
  5735. /*
  5736. * Use the prefixes for power of two recommended by
  5737. * the International Electrotechnical Commission
  5738. * (IEC) in IEC 80000-3 (i.e. Ki, Mi, Gi...).
  5739. *
  5740. * HN_IEC_PREFIXES implies a divisor of 1024 here
  5741. * (use of HN_DIVISOR_1000 would have triggered
  5742. * an assertion earlier).
  5743. */
  5744. divisor = int64(1024)
  5745. divisordeccut = int32(973) /* ceil(.95 * 1024) */
  5746. if flags&int32(m_HN_B1) != 0 {
  5747. prefixes = __ccgo_ts + 163
  5748. } else {
  5749. prefixes = __ccgo_ts + 184
  5750. }
  5751. } else {
  5752. baselen = uint64(1)
  5753. if flags&int32(m_HN_DIVISOR_10001) != 0 {
  5754. divisor = int64(1000)
  5755. divisordeccut = int32(950)
  5756. if flags&int32(m_HN_B1) != 0 {
  5757. prefixes = __ccgo_ts + 205
  5758. } else {
  5759. prefixes = __ccgo_ts + 225
  5760. }
  5761. } else {
  5762. divisor = int64(1024)
  5763. divisordeccut = int32(973) /* ceil(.95 * 1024) */
  5764. if flags&int32(m_HN_B1) != 0 {
  5765. prefixes = __ccgo_ts + 245
  5766. } else {
  5767. prefixes = __ccgo_ts + 265
  5768. }
  5769. }
  5770. }
  5771. if quotient < 0 {
  5772. sign = -int32(1)
  5773. quotient = -quotient
  5774. baselen += uint64(2) /* sign, digit */
  5775. } else {
  5776. sign = int32(1)
  5777. baselen += uint64(1) /* digit */
  5778. }
  5779. if flags&int32(m_HN_NOSPACE1) != 0 {
  5780. sep = __ccgo_ts + 60
  5781. } else {
  5782. sep = __ccgo_ts + 285
  5783. baselen++
  5784. }
  5785. baselen += libc.Xstrlen(tls, suffix)
  5786. /* Check if enough room for `x y' + suffix + `\0' */
  5787. if len1 < baselen+uint64(1) {
  5788. return -int32(1)
  5789. }
  5790. if scale&(libc.Int32FromInt32(m_HN_AUTOSCALE1)|libc.Int32FromInt32(m_HN_GETSCALE1)) != 0 {
  5791. /* See if there is additional columns can be used. */
  5792. max = int64(1)
  5793. i = libc.Int32FromUint64(len1 - baselen)
  5794. for {
  5795. v2 = i
  5796. i--
  5797. if !(v2 > 0) {
  5798. break
  5799. }
  5800. max *= int64(10)
  5801. goto _1
  5802. _1:
  5803. }
  5804. /*
  5805. * Divide the number until it fits the given column.
  5806. * If there will be an overflow by the rounding below,
  5807. * divide once more.
  5808. */
  5809. i = 0
  5810. for {
  5811. if !((quotient >= max || quotient == max-int64(1) && (remainder >= divisordeccut || int64(remainder) >= divisor/int64(2))) && i < _maxscale) {
  5812. break
  5813. }
  5814. remainder = int32(quotient % divisor)
  5815. quotient /= divisor
  5816. goto _3
  5817. _3:
  5818. ;
  5819. i++
  5820. }
  5821. if scale&int32(m_HN_GETSCALE1) != 0 {
  5822. return i
  5823. }
  5824. } else {
  5825. i = 0
  5826. for {
  5827. if !(i < scale && i < _maxscale) {
  5828. break
  5829. }
  5830. remainder = int32(quotient % divisor)
  5831. quotient /= divisor
  5832. goto _4
  5833. _4:
  5834. ;
  5835. i++
  5836. }
  5837. }
  5838. /* If a value <= 9.9 after rounding and ... */
  5839. /*
  5840. * XXX - should we make sure there is enough space for the decimal
  5841. * place and if not, don't do HN_DECIMAL?
  5842. */
  5843. if (quotient == int64(9) && remainder < divisordeccut || quotient < int64(9)) && i > 0 && flags&int32(m_HN_DECIMAL1) != 0 {
  5844. s1 = int32(int64(int32(quotient)) + (int64(remainder*int32(10))+divisor/int64(2))/divisor/int64(10))
  5845. s2 = int32((int64(remainder*int32(10)) + divisor/int64(2)) / divisor % int64(10))
  5846. 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))
  5847. } else {
  5848. 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))
  5849. }
  5850. return r
  5851. }
  5852. const m_HN_AUTOSCALE2 = 0x20
  5853. const m_HN_B2 = 0x04
  5854. const m_HN_DECIMAL2 = 0x01
  5855. const m_HN_DIVISOR_10002 = 0x08
  5856. const m_HN_GETSCALE2 = 0x10
  5857. const m_HN_IEC_PREFIXES2 = 0x10
  5858. const m_HN_NOSPACE2 = 0x02
  5859. const m_INET6_ADDRSTRLEN = 46
  5860. const m_INET_ADDRSTRLEN = 16
  5861. const m_IN_CLASSA_MAX = 128
  5862. const m_IN_CLASSA_NET = 0xff000000
  5863. const m_IN_CLASSA_NSHIFT = 24
  5864. const m_IN_CLASSB_MAX = 65536
  5865. const m_IN_CLASSB_NET = 0xffff0000
  5866. const m_IN_CLASSB_NSHIFT = 16
  5867. const m_IN_CLASSC_NET = 0xffffff00
  5868. const m_IN_CLASSC_NSHIFT = 8
  5869. const m_IN_LOOPBACKNET = 127
  5870. const m_IPPORT_RESERVED = 1024
  5871. const m_IPPROTO_AH = 51
  5872. const m_IPPROTO_BEETPH = 94
  5873. const m_IPPROTO_COMP = 108
  5874. const m_IPPROTO_DCCP = 33
  5875. const m_IPPROTO_DSTOPTS = 60
  5876. const m_IPPROTO_EGP = 8
  5877. const m_IPPROTO_ENCAP = 98
  5878. const m_IPPROTO_ESP = 50
  5879. const m_IPPROTO_ETHERNET = 143
  5880. const m_IPPROTO_FRAGMENT = 44
  5881. const m_IPPROTO_GRE = 47
  5882. const m_IPPROTO_HOPOPTS = 0
  5883. const m_IPPROTO_ICMP = 1
  5884. const m_IPPROTO_ICMPV6 = 58
  5885. const m_IPPROTO_IDP = 22
  5886. const m_IPPROTO_IGMP = 2
  5887. const m_IPPROTO_IP = 0
  5888. const m_IPPROTO_IPIP = 4
  5889. const m_IPPROTO_IPV6 = 41
  5890. const m_IPPROTO_MAX = 263
  5891. const m_IPPROTO_MH = 135
  5892. const m_IPPROTO_MPLS = 137
  5893. const m_IPPROTO_MPTCP = 262
  5894. const m_IPPROTO_MTP = 92
  5895. const m_IPPROTO_NONE = 59
  5896. const m_IPPROTO_PIM = 103
  5897. const m_IPPROTO_PUP = 12
  5898. const m_IPPROTO_RAW = 255
  5899. const m_IPPROTO_ROUTING = 43
  5900. const m_IPPROTO_RSVP = 46
  5901. const m_IPPROTO_SCTP = 132
  5902. const m_IPPROTO_TCP = 6
  5903. const m_IPPROTO_TP = 29
  5904. const m_IPPROTO_UDP = 17
  5905. const m_IPPROTO_UDPLITE = 136
  5906. const m_IPV6_2292DSTOPTS = 4
  5907. const m_IPV6_2292HOPLIMIT = 8
  5908. const m_IPV6_2292HOPOPTS = 3
  5909. const m_IPV6_2292PKTINFO = 2
  5910. const m_IPV6_2292PKTOPTIONS = 6
  5911. const m_IPV6_2292RTHDR = 5
  5912. const m_IPV6_ADDRFORM = 1
  5913. const m_IPV6_ADDR_PREFERENCES = 72
  5914. const m_IPV6_ADD_MEMBERSHIP = "IPV6_JOIN_GROUP"
  5915. const m_IPV6_AUTHHDR = 10
  5916. const m_IPV6_AUTOFLOWLABEL = 70
  5917. const m_IPV6_CHECKSUM = 7
  5918. const m_IPV6_DONTFRAG = 62
  5919. const m_IPV6_DROP_MEMBERSHIP = "IPV6_LEAVE_GROUP"
  5920. const m_IPV6_DSTOPTS = 59
  5921. const m_IPV6_FREEBIND = 78
  5922. const m_IPV6_HDRINCL = 36
  5923. const m_IPV6_HOPLIMIT = 52
  5924. const m_IPV6_HOPOPTS = 54
  5925. const m_IPV6_IPSEC_POLICY = 34
  5926. const m_IPV6_JOIN_ANYCAST = 27
  5927. const m_IPV6_JOIN_GROUP = 20
  5928. const m_IPV6_LEAVE_ANYCAST = 28
  5929. const m_IPV6_LEAVE_GROUP = 21
  5930. const m_IPV6_MINHOPCOUNT = 73
  5931. const m_IPV6_MTU = 24
  5932. const m_IPV6_MTU_DISCOVER = 23
  5933. const m_IPV6_MULTICAST_ALL = 29
  5934. const m_IPV6_MULTICAST_HOPS = 18
  5935. const m_IPV6_MULTICAST_IF = 17
  5936. const m_IPV6_MULTICAST_LOOP = 19
  5937. const m_IPV6_NEXTHOP = 9
  5938. const m_IPV6_ORIGDSTADDR = 74
  5939. const m_IPV6_PATHMTU = 61
  5940. const m_IPV6_PKTINFO = 50
  5941. const m_IPV6_PMTUDISC_DO = 2
  5942. const m_IPV6_PMTUDISC_DONT = 0
  5943. const m_IPV6_PMTUDISC_INTERFACE = 4
  5944. const m_IPV6_PMTUDISC_OMIT = 5
  5945. const m_IPV6_PMTUDISC_PROBE = 3
  5946. const m_IPV6_PMTUDISC_WANT = 1
  5947. const m_IPV6_PREFER_SRC_CGA = 0x0008
  5948. const m_IPV6_PREFER_SRC_COA = 0x0004
  5949. const m_IPV6_PREFER_SRC_HOME = 0x0400
  5950. const m_IPV6_PREFER_SRC_NONCGA = 0x0800
  5951. const m_IPV6_PREFER_SRC_PUBLIC = 0x0002
  5952. const m_IPV6_PREFER_SRC_PUBTMP_DEFAULT = 0x0100
  5953. const m_IPV6_PREFER_SRC_TMP = 0x0001
  5954. const m_IPV6_RECVDSTOPTS = 58
  5955. const m_IPV6_RECVERR = 25
  5956. const m_IPV6_RECVFRAGSIZE = 77
  5957. const m_IPV6_RECVHOPLIMIT = 51
  5958. const m_IPV6_RECVHOPOPTS = 53
  5959. const m_IPV6_RECVORIGDSTADDR = "IPV6_ORIGDSTADDR"
  5960. const m_IPV6_RECVPATHMTU = 60
  5961. const m_IPV6_RECVPKTINFO = 49
  5962. const m_IPV6_RECVRTHDR = 56
  5963. const m_IPV6_RECVTCLASS = 66
  5964. const m_IPV6_ROUTER_ALERT = 22
  5965. const m_IPV6_ROUTER_ALERT_ISOLATE = 30
  5966. const m_IPV6_RTHDR = 57
  5967. const m_IPV6_RTHDRDSTOPTS = 55
  5968. const m_IPV6_RTHDR_LOOSE = 0
  5969. const m_IPV6_RTHDR_STRICT = 1
  5970. const m_IPV6_RTHDR_TYPE_0 = 0
  5971. const m_IPV6_RXDSTOPTS = "IPV6_DSTOPTS"
  5972. const m_IPV6_RXHOPOPTS = "IPV6_HOPOPTS"
  5973. const m_IPV6_TCLASS = 67
  5974. const m_IPV6_TRANSPARENT = 75
  5975. const m_IPV6_UNICAST_HOPS = 16
  5976. const m_IPV6_UNICAST_IF = 76
  5977. const m_IPV6_V6ONLY = 26
  5978. const m_IPV6_XFRM_POLICY = 35
  5979. const m_IP_ADD_MEMBERSHIP = 35
  5980. const m_IP_ADD_SOURCE_MEMBERSHIP = 39
  5981. const m_IP_BIND_ADDRESS_NO_PORT = 24
  5982. const m_IP_BLOCK_SOURCE = 38
  5983. const m_IP_CHECKSUM = 23
  5984. const m_IP_DEFAULT_MULTICAST_LOOP = 1
  5985. const m_IP_DEFAULT_MULTICAST_TTL = 1
  5986. const m_IP_DROP_MEMBERSHIP = 36
  5987. const m_IP_DROP_SOURCE_MEMBERSHIP = 40
  5988. const m_IP_FREEBIND = 15
  5989. const m_IP_HDRINCL = 3
  5990. const m_IP_IPSEC_POLICY = 16
  5991. const m_IP_MAX_MEMBERSHIPS = 20
  5992. const m_IP_MINTTL = 21
  5993. const m_IP_MSFILTER = 41
  5994. const m_IP_MTU = 14
  5995. const m_IP_MTU_DISCOVER = 10
  5996. const m_IP_MULTICAST_ALL = 49
  5997. const m_IP_MULTICAST_IF = 32
  5998. const m_IP_MULTICAST_LOOP = 34
  5999. const m_IP_MULTICAST_TTL = 33
  6000. const m_IP_NODEFRAG = 22
  6001. const m_IP_OPTIONS = 4
  6002. const m_IP_ORIGDSTADDR = 20
  6003. const m_IP_PASSSEC = 18
  6004. const m_IP_PKTINFO = 8
  6005. const m_IP_PKTOPTIONS = 9
  6006. const m_IP_PMTUDISC = 10
  6007. const m_IP_PMTUDISC_DO = 2
  6008. const m_IP_PMTUDISC_DONT = 0
  6009. const m_IP_PMTUDISC_INTERFACE = 4
  6010. const m_IP_PMTUDISC_OMIT = 5
  6011. const m_IP_PMTUDISC_PROBE = 3
  6012. const m_IP_PMTUDISC_WANT = 1
  6013. const m_IP_RECVERR = 11
  6014. const m_IP_RECVERR_RFC4884 = 26
  6015. const m_IP_RECVFRAGSIZE = 25
  6016. const m_IP_RECVOPTS = 6
  6017. const m_IP_RECVORIGDSTADDR = "IP_ORIGDSTADDR"
  6018. const m_IP_RECVRETOPTS = "IP_RETOPTS"
  6019. const m_IP_RECVTOS = 13
  6020. const m_IP_RECVTTL = 12
  6021. const m_IP_RETOPTS = 7
  6022. const m_IP_ROUTER_ALERT = 5
  6023. const m_IP_TOS = 1
  6024. const m_IP_TRANSPARENT = 19
  6025. const m_IP_TTL = 2
  6026. const m_IP_UNBLOCK_SOURCE = 37
  6027. const m_IP_UNICAST_IF = 50
  6028. const m_IP_XFRM_POLICY = 17
  6029. const m_MCAST_BLOCK_SOURCE = 43
  6030. const m_MCAST_EXCLUDE = 0
  6031. const m_MCAST_INCLUDE = 1
  6032. const m_MCAST_JOIN_GROUP = 42
  6033. const m_MCAST_JOIN_SOURCE_GROUP = 46
  6034. const m_MCAST_LEAVE_GROUP = 45
  6035. const m_MCAST_LEAVE_SOURCE_GROUP = 47
  6036. const m_MCAST_MSFILTER = 48
  6037. const m_MCAST_UNBLOCK_SOURCE = 44
  6038. const m___UAPI_DEF_IN6_ADDR = 0
  6039. const m___UAPI_DEF_IN6_ADDR_ALT = 0
  6040. const m___UAPI_DEF_IN6_PKTINFO = 0
  6041. const m___UAPI_DEF_IN_ADDR = 0
  6042. const m___UAPI_DEF_IN_CLASS = 0
  6043. const m___UAPI_DEF_IN_IPPROTO = 0
  6044. const m___UAPI_DEF_IN_PKTINFO = 0
  6045. const m___UAPI_DEF_IP6_MTUINFO = 0
  6046. const m___UAPI_DEF_IPPROTO_V6 = 0
  6047. const m___UAPI_DEF_IPV6_MREQ = 0
  6048. const m___UAPI_DEF_IPV6_OPTIONS = 0
  6049. const m___UAPI_DEF_IP_MREQ = 0
  6050. const m___UAPI_DEF_SOCKADDR_IN = 0
  6051. const m___UAPI_DEF_SOCKADDR_IN6 = 0
  6052. type Tin_port_t = uint16
  6053. type Tin_addr_t = uint32
  6054. type Tin_addr = struct {
  6055. Fs_addr Tin_addr_t
  6056. }
  6057. type Tsockaddr_in = struct {
  6058. Fsin_family Tsa_family_t
  6059. Fsin_port Tin_port_t
  6060. Fsin_addr Tin_addr
  6061. Fsin_zero [8]Tuint8_t
  6062. }
  6063. type Tin6_addr = struct {
  6064. F__in6_union struct {
  6065. F__s6_addr16 [0][8]Tuint16_t
  6066. F__s6_addr32 [0][4]Tuint32_t
  6067. F__s6_addr [16]Tuint8_t
  6068. }
  6069. }
  6070. type Tsockaddr_in6 = struct {
  6071. Fsin6_family Tsa_family_t
  6072. Fsin6_port Tin_port_t
  6073. Fsin6_flowinfo Tuint32_t
  6074. Fsin6_addr Tin6_addr
  6075. Fsin6_scope_id Tuint32_t
  6076. }
  6077. type Tipv6_mreq = struct {
  6078. Fipv6mr_multiaddr Tin6_addr
  6079. Fipv6mr_interface uint32
  6080. }
  6081. type Tip_opts = struct {
  6082. Fip_dst Tin_addr
  6083. Fip_opts [40]uint8
  6084. }
  6085. type Tip_mreq = struct {
  6086. Fimr_multiaddr Tin_addr
  6087. Fimr_interface Tin_addr
  6088. }
  6089. type Tip_mreqn = struct {
  6090. Fimr_multiaddr Tin_addr
  6091. Fimr_address Tin_addr
  6092. Fimr_ifindex int32
  6093. }
  6094. type Tip_mreq_source = struct {
  6095. Fimr_multiaddr Tin_addr
  6096. Fimr_interface Tin_addr
  6097. Fimr_sourceaddr Tin_addr
  6098. }
  6099. type Tip_msfilter = struct {
  6100. Fimsf_multiaddr Tin_addr
  6101. Fimsf_interface Tin_addr
  6102. Fimsf_fmode Tuint32_t
  6103. Fimsf_numsrc Tuint32_t
  6104. Fimsf_slist [1]Tin_addr
  6105. }
  6106. type Tgroup_req = struct {
  6107. Fgr_interface Tuint32_t
  6108. Fgr_group Tsockaddr_storage
  6109. }
  6110. type Tgroup_source_req = struct {
  6111. Fgsr_interface Tuint32_t
  6112. Fgsr_group Tsockaddr_storage
  6113. Fgsr_source Tsockaddr_storage
  6114. }
  6115. type Tgroup_filter = struct {
  6116. Fgf_interface Tuint32_t
  6117. Fgf_group Tsockaddr_storage
  6118. Fgf_fmode Tuint32_t
  6119. Fgf_numsrc Tuint32_t
  6120. Fgf_slist [1]Tsockaddr_storage
  6121. }
  6122. type Tin_pktinfo = struct {
  6123. Fipi_ifindex int32
  6124. Fipi_spec_dst Tin_addr
  6125. Fipi_addr Tin_addr
  6126. }
  6127. type Tin6_pktinfo = struct {
  6128. Fipi6_addr Tin6_addr
  6129. Fipi6_ifindex uint32
  6130. }
  6131. type Tip6_mtuinfo = struct {
  6132. Fip6m_addr Tsockaddr_in6
  6133. Fip6m_mtu Tuint32_t
  6134. }
  6135. // C documentation
  6136. //
  6137. // /*
  6138. // * static int
  6139. // * inet_net_pton(af, src, dst, size)
  6140. // * convert network number from presentation to network format.
  6141. // * accepts hex octets, hex strings, decimal octets, and /CIDR.
  6142. // * "size" is in bytes and describes "dst".
  6143. // * return:
  6144. // * number of bits, either imputed classfully or specified with /CIDR,
  6145. // * or -1 if some failure occurred (check errno). ENOENT means it was
  6146. // * not a valid network specification.
  6147. // * author:
  6148. // * Paul Vixie (ISC), June 1996
  6149. // */
  6150. func Xinet_net_pton(tls *libc.TLS, af int32, src uintptr, dst uintptr, size Tsize_t) (r int32) {
  6151. switch af {
  6152. case int32(m_PF_INET):
  6153. return _inet_net_pton_ipv4(tls, src, dst, size)
  6154. default:
  6155. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EAFNOSUPPORT)
  6156. return -int32(1)
  6157. }
  6158. return r
  6159. }
  6160. // C documentation
  6161. //
  6162. // /*
  6163. // * static int
  6164. // * inet_net_pton_ipv4(src, dst, size)
  6165. // * convert IPv4 network number from presentation to network format.
  6166. // * accepts hex octets, hex strings, decimal octets, and /CIDR.
  6167. // * "size" is in bytes and describes "dst".
  6168. // * return:
  6169. // * number of bits, either imputed classfully or specified with /CIDR,
  6170. // * or -1 if some failure occurred (check errno). ENOENT means it was
  6171. // * not an IPv4 network specification.
  6172. // * note:
  6173. // * network byte order assumed. this means 192.5.5.240/28 has
  6174. // * 0x11110000 in its fourth octet.
  6175. // * author:
  6176. // * Paul Vixie (ISC), June 1996
  6177. // */
  6178. func _inet_net_pton_ipv4(tls *libc.TLS, src uintptr, dst uintptr, size Tsize_t) (r int32) {
  6179. var bits, ch, dirty, n, tmp, v10, v17, v2, v5 int32
  6180. var odst, v1, v11, v14, v15, v16, v18, v21, v3, v8, p4, p6 uintptr
  6181. var v13, v20, v7 Tsize_t
  6182. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bits, ch, dirty, n, odst, tmp, v1, v10, v11, v13, v14, v15, v16, v17, v18, v2, v20, v21, v3, v5, v7, v8, p4, p6
  6183. odst = dst
  6184. v1 = src
  6185. src++
  6186. ch = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v1)))
  6187. 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 {
  6188. /* Hexadecimal: Eat nybble string. */
  6189. if size <= uint64(0) {
  6190. goto emsgsize
  6191. }
  6192. *(*uint8)(unsafe.Pointer(dst)) = uint8(0)
  6193. dirty = libc.Int32FromInt32(0)
  6194. src++ /* skip x or X. */
  6195. for {
  6196. v3 = src
  6197. src++
  6198. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v3)))
  6199. ch = v2
  6200. if !(v2 != int32('\000') && libc.BoolInt32(libc.Uint32FromInt32(ch) < uint32(128)) != 0 && libc.Xisxdigit(tls, ch) != 0) {
  6201. break
  6202. }
  6203. if libc.BoolInt32(libc.Uint32FromInt32(ch)-uint32('A') < uint32(26)) != 0 {
  6204. ch = libc.Xtolower(tls, ch)
  6205. }
  6206. n = int32(int64(libc.Xstrchr(tls, uintptr(unsafe.Pointer(&_xdigits)), ch)) - t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_xdigits))))
  6207. p4 = dst
  6208. *(*uint8)(unsafe.Pointer(p4)) = uint8(int32(*(*uint8)(unsafe.Pointer(p4))) | n)
  6209. v5 = dirty
  6210. dirty++
  6211. if !(v5 != 0) {
  6212. p6 = dst
  6213. *(*uint8)(unsafe.Pointer(p6)) = uint8(int32(*(*uint8)(unsafe.Pointer(p6))) << libc.Int32FromInt32(4))
  6214. } else {
  6215. v7 = size
  6216. size--
  6217. if v7 > uint64(0) {
  6218. dst++
  6219. v8 = dst
  6220. *(*uint8)(unsafe.Pointer(v8)) = uint8(0)
  6221. dirty = libc.Int32FromInt32(0)
  6222. } else {
  6223. goto emsgsize
  6224. }
  6225. }
  6226. }
  6227. if dirty != 0 {
  6228. size--
  6229. }
  6230. } else {
  6231. if libc.BoolInt32(libc.Uint32FromInt32(ch) < uint32(128)) != 0 && libc.BoolInt32(libc.Uint32FromInt32(ch)-uint32('0') < uint32(10)) != 0 {
  6232. /* Decimal: eat dotted digit string. */
  6233. for {
  6234. tmp = 0
  6235. for {
  6236. n = int32(int64(libc.Xstrchr(tls, uintptr(unsafe.Pointer(&_digits)), ch)) - t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_digits))))
  6237. tmp *= int32(10)
  6238. tmp += n
  6239. if tmp > int32(255) {
  6240. goto enoent
  6241. }
  6242. goto _12
  6243. _12:
  6244. ;
  6245. v11 = src
  6246. src++
  6247. v10 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v11)))
  6248. ch = v10
  6249. if !(v10 != int32('\000') && libc.BoolInt32(libc.Uint32FromInt32(ch) < uint32(128)) != 0 && libc.BoolInt32(libc.Uint32FromInt32(ch)-uint32('0') < uint32(10)) != 0) {
  6250. break
  6251. }
  6252. }
  6253. v13 = size
  6254. size--
  6255. if v13 <= uint64(0) {
  6256. goto emsgsize
  6257. }
  6258. v14 = dst
  6259. dst++
  6260. *(*uint8)(unsafe.Pointer(v14)) = libc.Uint8FromInt32(tmp)
  6261. if ch == int32('\000') || ch == int32('/') {
  6262. break
  6263. }
  6264. if ch != int32('.') {
  6265. goto enoent
  6266. }
  6267. v15 = src
  6268. src++
  6269. ch = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v15)))
  6270. if !(libc.BoolInt32(libc.Uint32FromInt32(ch) < libc.Uint32FromInt32(128)) != 0) || !(libc.BoolInt32(libc.Uint32FromInt32(ch)-libc.Uint32FromUint8('0') < libc.Uint32FromInt32(10)) != 0) {
  6271. goto enoent
  6272. }
  6273. goto _9
  6274. _9:
  6275. }
  6276. } else {
  6277. goto enoent
  6278. }
  6279. }
  6280. bits = -int32(1)
  6281. 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 {
  6282. /* CIDR width specifier. Nothing can follow it. */
  6283. v16 = src
  6284. src++
  6285. ch = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v16))) /* Skip over the /. */
  6286. bits = 0
  6287. for {
  6288. n = int32(int64(libc.Xstrchr(tls, uintptr(unsafe.Pointer(&_digits)), ch)) - t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_digits))))
  6289. bits *= int32(10)
  6290. bits += n
  6291. goto _19
  6292. _19:
  6293. ;
  6294. v18 = src
  6295. src++
  6296. v17 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v18)))
  6297. ch = v17
  6298. if !(v17 != int32('\000') && libc.BoolInt32(libc.Uint32FromInt32(ch) < uint32(128)) != 0 && libc.BoolInt32(libc.Uint32FromInt32(ch)-uint32('0') < uint32(10)) != 0) {
  6299. break
  6300. }
  6301. }
  6302. if ch != int32('\000') {
  6303. goto enoent
  6304. }
  6305. if bits > int32(32) {
  6306. goto emsgsize
  6307. }
  6308. }
  6309. /* Firey death and destruction unless we prefetched EOS. */
  6310. if ch != int32('\000') {
  6311. goto enoent
  6312. }
  6313. /* If nothing was written to the destination, we found no address. */
  6314. if dst == odst {
  6315. goto enoent
  6316. }
  6317. /* If no CIDR spec was given, infer width from net class. */
  6318. if bits == -int32(1) {
  6319. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(odst))) >= int32(240) { /* Class E */
  6320. bits = int32(32)
  6321. } else {
  6322. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(odst))) >= int32(224) { /* Class D */
  6323. bits = int32(4)
  6324. } else {
  6325. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(odst))) >= int32(192) { /* Class C */
  6326. bits = int32(24)
  6327. } else {
  6328. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(odst))) >= int32(128) { /* Class B */
  6329. bits = int32(16)
  6330. } else { /* Class A */
  6331. bits = int32(8)
  6332. }
  6333. }
  6334. }
  6335. }
  6336. /* If imputed mask is narrower than specified octets, widen. */
  6337. if int64(bits) < (int64(dst)-int64(odst))*int64(8) {
  6338. bits = int32((int64(dst) - int64(odst)) * int64(8))
  6339. }
  6340. }
  6341. /* Extend network to cover the actual mask. */
  6342. for int64(bits) > (int64(dst)-int64(odst))*int64(8) {
  6343. v20 = size
  6344. size--
  6345. if v20 <= uint64(0) {
  6346. goto emsgsize
  6347. }
  6348. v21 = dst
  6349. dst++
  6350. *(*uint8)(unsafe.Pointer(v21)) = uint8('\000')
  6351. }
  6352. return bits
  6353. goto enoent
  6354. enoent:
  6355. ;
  6356. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOENT)
  6357. return -int32(1)
  6358. goto emsgsize
  6359. emsgsize:
  6360. ;
  6361. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EMSGSIZE)
  6362. return -int32(1)
  6363. }
  6364. var _xdigits = [17]uint8{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}
  6365. var _digits = [11]uint8{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}
  6366. const m_MD5_BLOCK_LENGTH = 64
  6367. const m_MD5_DIGEST_LENGTH = 16
  6368. type TMD5_CTX = struct {
  6369. Fstate [4]Tuint32_t
  6370. Fcount Tuint64_t
  6371. Fbuffer [64]Tuint8_t
  6372. }
  6373. type TMD5Context = TMD5_CTX
  6374. /* Avoid polluting the namespace. Even though this makes this usage
  6375. * implementation-specific, defining it unconditionally should not be
  6376. * a problem, and better than possibly breaking unexpecting code. */
  6377. /*
  6378. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  6379. *
  6380. * Redistribution and use in source and binary forms, with or without
  6381. * modification, are permitted provided that the following conditions
  6382. * are met:
  6383. * 1. Redistributions of source code must retain the above copyright
  6384. * notice, this list of conditions and the following disclaimer.
  6385. * 2. Redistributions in binary form must reproduce the above copyright
  6386. * notice, this list of conditions and the following disclaimer in the
  6387. * documentation and/or other materials provided with the distribution.
  6388. * 3. The name of the author may not be used to endorse or promote products
  6389. * derived from this software without specific prior written permission.
  6390. *
  6391. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  6392. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  6393. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  6394. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  6395. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  6396. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  6397. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  6398. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  6399. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  6400. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  6401. */
  6402. /*
  6403. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  6404. *
  6405. * Redistribution and use in source and binary forms, with or without
  6406. * modification, are permitted provided that the following conditions
  6407. * are met:
  6408. * 1. Redistributions of source code must retain the above copyright
  6409. * notice, this list of conditions and the following disclaimer.
  6410. * 2. Redistributions in binary form must reproduce the above copyright
  6411. * notice, this list of conditions and the following disclaimer in the
  6412. * documentation and/or other materials provided with the distribution.
  6413. * 3. The name of the author may not be used to endorse or promote products
  6414. * derived from this software without specific prior written permission.
  6415. *
  6416. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  6417. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  6418. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  6419. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  6420. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  6421. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  6422. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  6423. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  6424. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  6425. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  6426. */
  6427. /* Clang expands this to 1 if an identifier is *not* reserved. */
  6428. /*
  6429. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  6430. * musl, try to handle this gracefully.
  6431. */
  6432. /* Copyright (C) 1992-2024 Free Software Foundation, Inc.
  6433. Copyright The GNU Toolchain Authors.
  6434. This file is part of the GNU C Library.
  6435. The GNU C Library is free software; you can redistribute it and/or
  6436. modify it under the terms of the GNU Lesser General Public
  6437. License as published by the Free Software Foundation; either
  6438. version 2.1 of the License, or (at your option) any later version.
  6439. The GNU C Library is distributed in the hope that it will be useful,
  6440. but WITHOUT ANY WARRANTY; without even the implied warranty of
  6441. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  6442. Lesser General Public License for more details.
  6443. You should have received a copy of the GNU Lesser General Public
  6444. License along with the GNU C Library; if not, see
  6445. <https://www.gnu.org/licenses/>. */
  6446. /* We are almost always included from features.h. */
  6447. /* The GNU libc does not support any K&R compilers or the traditional mode
  6448. of ISO C compilers anymore. Check for some of the combinations not
  6449. supported anymore. */
  6450. /* Some user header file might have defined this before. */
  6451. /* Compilers that lack __has_attribute may object to
  6452. #if defined __has_attribute && __has_attribute (...)
  6453. even though they do not need to evaluate the right-hand side of the &&.
  6454. Similarly for __has_builtin, etc. */
  6455. /* All functions, except those with callbacks or those that
  6456. synchronize memory, are leaf functions. */
  6457. /* GCC can always grok prototypes. For C++ programs we add throw()
  6458. to help it optimize the function calls. But this only works with
  6459. gcc 2.8.x and egcs. For gcc 3.4 and up we even mark C functions
  6460. as non-throwing using a function attribute since programs can use
  6461. the -fexceptions options for C code as well. */
  6462. /* These two macros are not used in glibc anymore. They are kept here
  6463. only because some other projects expect the macros to be defined. */
  6464. /* For these things, GCC behaves the ANSI way normally,
  6465. and the non-ANSI way under -traditional. */
  6466. /* This is not a typedef so `const __ptr_t' does the right thing. */
  6467. /* C++ needs to know that types and declarations are C, not C++. */
  6468. /* Fortify support. */
  6469. /* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available. */
  6470. /* Support for flexible arrays.
  6471. Headers that should use flexible arrays only if they're "real"
  6472. (e.g. only if they won't affect sizeof()) should test
  6473. #if __glibc_c99_flexarr_available. */
  6474. /* __asm__ ("xyz") is used throughout the headers to rename functions
  6475. at the assembly language level. This is wrapped by the __REDIRECT
  6476. macro, in order to support compilers that can do this some other
  6477. way. When compilers don't support asm-names at all, we have to do
  6478. preprocessor tricks instead (which don't have exactly the right
  6479. semantics, but it's the best we can do).
  6480. Example:
  6481. int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */
  6482. /*
  6483. #elif __SOME_OTHER_COMPILER__
  6484. # define __REDIRECT(name, proto, alias) name proto; _Pragma("let " #name " = " #alias)
  6485. */
  6486. /* GCC and clang have various useful declarations that can be made with
  6487. the '__attribute__' syntax. All of the ways we use this do fine if
  6488. they are omitted for compilers that don't understand it. */
  6489. /* At some point during the gcc 2.96 development the `malloc' attribute
  6490. for functions was introduced. We don't want to use it unconditionally
  6491. (although this would be possible) since it generates warnings. */
  6492. /* Tell the compiler which arguments to an allocation function
  6493. indicate the size of the allocation. */
  6494. /* Tell the compiler which argument to an allocation function
  6495. indicates the alignment of the allocation. */
  6496. /* At some point during the gcc 2.96 development the `pure' attribute
  6497. for functions was introduced. We don't want to use it unconditionally
  6498. (although this would be possible) since it generates warnings. */
  6499. /* This declaration tells the compiler that the value is constant. */
  6500. /* At some point during the gcc 3.1 development the `used' attribute
  6501. for functions was introduced. We don't want to use it unconditionally
  6502. (although this would be possible) since it generates warnings. */
  6503. /* Since version 3.2, gcc allows marking deprecated functions. */
  6504. /* Since version 4.5, gcc also allows one to specify the message printed
  6505. when a deprecated function is used. clang claims to be gcc 4.2, but
  6506. may also support this feature. */
  6507. /* At some point during the gcc 2.8 development the `format_arg' attribute
  6508. for functions was introduced. We don't want to use it unconditionally
  6509. (although this would be possible) since it generates warnings.
  6510. If several `format_arg' attributes are given for the same function, in
  6511. gcc-3.0 and older, all but the last one are ignored. In newer gccs,
  6512. all designated arguments are considered. */
  6513. /* At some point during the gcc 2.97 development the `strfmon' format
  6514. attribute for functions was introduced. We don't want to use it
  6515. unconditionally (although this would be possible) since it
  6516. generates warnings. */
  6517. /* The nonnull function attribute marks pointer parameters that
  6518. must not be NULL. This has the name __nonnull in glibc,
  6519. and __attribute_nonnull__ in files shared with Gnulib to avoid
  6520. collision with a different __nonnull in DragonFlyBSD 5.9. */
  6521. /* The returns_nonnull function attribute marks the return type of the function
  6522. as always being non-null. */
  6523. /* If fortification mode, we warn about unused results of certain
  6524. function calls which can lead to problems. */
  6525. /* Forces a function to be always inlined. */
  6526. /* Associate error messages with the source location of the call site rather
  6527. than with the source location inside the function. */
  6528. /* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
  6529. inline semantics, unless -fgnu89-inline is used. Using __GNUC_STDC_INLINE__
  6530. or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions
  6531. older than 4.3 may define these macros and still not guarantee GNU inlining
  6532. semantics.
  6533. clang++ identifies itself as gcc-4.2, but has support for GNU inlining
  6534. semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and
  6535. __GNUC_GNU_INLINE__ macro definitions. */
  6536. /* GCC 4.3 and above allow passing all anonymous arguments of an
  6537. __extern_always_inline function to some other vararg function. */
  6538. /* It is possible to compile containing GCC extensions even if GCC is
  6539. run in pedantic mode if the uses are carefully marked using the
  6540. `__extension__' keyword. But this is not generally available before
  6541. version 2.8. */
  6542. /* __restrict is known in EGCS 1.2 and above, and in clang.
  6543. It works also in C++ mode (outside of arrays), but only when spelled
  6544. as '__restrict', not 'restrict'. */
  6545. /* ISO C99 also allows to declare arrays as non-overlapping. The syntax is
  6546. array_name[restrict]
  6547. GCC 3.1 and clang support this.
  6548. This syntax is not usable in C++ mode. */
  6549. /* Undefine (also defined in libc-symbols.h). */
  6550. /* Gnulib avoids including these, as they don't work on non-glibc or
  6551. older glibc platforms. */
  6552. /* Determine the wordsize from the preprocessor defines. RISC-V version.
  6553. Copyright (C) 2002-2024 Free Software Foundation, Inc.
  6554. This file is part of the GNU C Library.
  6555. The GNU C Library is free software; you can redistribute it and/or
  6556. modify it under the terms of the GNU Lesser General Public
  6557. License as published by the Free Software Foundation; either
  6558. version 2.1 of the License, or (at your option) any later version.
  6559. The GNU C Library is distributed in the hope that it will be useful,
  6560. but WITHOUT ANY WARRANTY; without even the implied warranty of
  6561. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  6562. Lesser General Public License for more details.
  6563. You should have received a copy of the GNU Lesser General Public
  6564. License along with the GNU C Library. If not, see
  6565. <https://www.gnu.org/licenses/>. */
  6566. /* Properties of long double type. ldbl-128 version.
  6567. Copyright (C) 2016-2024 Free Software Foundation, Inc.
  6568. This file is part of the GNU C Library.
  6569. The GNU C Library is free software; you can redistribute it and/or
  6570. modify it under the terms of the GNU Lesser General Public
  6571. License published by the Free Software Foundation; either
  6572. version 2.1 of the License, or (at your option) any later version.
  6573. The GNU C Library is distributed in the hope that it will be useful,
  6574. but WITHOUT ANY WARRANTY; without even the implied warranty of
  6575. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  6576. Lesser General Public License for more details.
  6577. You should have received a copy of the GNU Lesser General Public
  6578. License along with the GNU C Library; if not, see
  6579. <https://www.gnu.org/licenses/>. */
  6580. /* long double is distinct from double, so there is nothing to
  6581. define here. */
  6582. /* __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is
  6583. intended for use in preprocessor macros.
  6584. Note: MESSAGE must be a _single_ string; concatenation of string
  6585. literals is not supported. */
  6586. /* Generic selection (ISO C11) is a C-only feature, available in GCC
  6587. since version 4.9. Previous versions do not provide generic
  6588. selection, even though they might set __STDC_VERSION__ to 201112L,
  6589. when in -std=c11 mode. Thus, we must check for !defined __GNUC__
  6590. when testing __STDC_VERSION__ for generic selection support.
  6591. On the other hand, Clang also defines __GNUC__, so a clang-specific
  6592. check is required to enable the use of generic selection. */
  6593. /* Specify that a function such as setjmp or vfork may return
  6594. twice. */
  6595. /* Mark struct types as aliasable. Restricted to compilers that
  6596. support forward declarations of structs in the presence of the
  6597. attribute. */
  6598. /*
  6599. * On non-glibc based systems, we cannot unconditionally use the
  6600. * __GLIBC_PREREQ macro as it gets expanded before evaluation.
  6601. */
  6602. /*
  6603. * Some kFreeBSD headers expect those macros to be set for sanity checks.
  6604. */
  6605. /* Define the ABI for the current system. */
  6606. //#define LIBBSD_SYS_TIME_BITS 0
  6607. //#define LIBBSD_SYS_HAS_TIME64 0
  6608. /* Linux headers define a struct with a member names __unused.
  6609. * Debian bugs: #522773 (linux), #522774 (libc).
  6610. * Disable for now. */
  6611. /*
  6612. * Return the number of elements in a statically-allocated array,
  6613. * __x.
  6614. */
  6615. /*
  6616. * We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h>
  6617. * require it.
  6618. */
  6619. /*
  6620. * Given the pointer x to the member m of the struct s, return
  6621. * a pointer to the containing structure. When using GCC, we first
  6622. * assign pointer x to a local variable, to check that its type is
  6623. * compatible with member m.
  6624. */
  6625. func Xlibbsd_MD5Init(tls *libc.TLS, context uintptr) {
  6626. libmd.XMD5Init(tls, context)
  6627. }
  6628. 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', '.'}
  6629. func Xlibbsd_MD5Update(tls *libc.TLS, context uintptr, data uintptr, len1 Tsize_t) {
  6630. libmd.XMD5Update(tls, context, data, len1)
  6631. }
  6632. 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', '.'}
  6633. func Xlibbsd_MD5Pad(tls *libc.TLS, context uintptr) {
  6634. libmd.XMD5Pad(tls, context)
  6635. }
  6636. 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', '.'}
  6637. func Xlibbsd_MD5Final(tls *libc.TLS, digest uintptr, context uintptr) {
  6638. libmd.XMD5Final(tls, digest, context)
  6639. }
  6640. 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', '.'}
  6641. func Xlibbsd_MD5Transform(tls *libc.TLS, state uintptr, block uintptr) {
  6642. libmd.XMD5Transform(tls, state, block)
  6643. }
  6644. 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', '.'}
  6645. func Xlibbsd_MD5End(tls *libc.TLS, context uintptr, buf uintptr) (r uintptr) {
  6646. return libmd.XMD5End(tls, context, buf)
  6647. }
  6648. 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', '.'}
  6649. func Xlibbsd_MD5File(tls *libc.TLS, filename uintptr, buf uintptr) (r uintptr) {
  6650. return libmd.XMD5File(tls, filename, buf)
  6651. }
  6652. 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', '.'}
  6653. func Xlibbsd_MD5FileChunk(tls *libc.TLS, filename uintptr, buf uintptr, offset Toff_t, length Toff_t) (r uintptr) {
  6654. return libmd.XMD5FileChunk(tls, filename, buf, offset, length)
  6655. }
  6656. 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', '.'}
  6657. func Xlibbsd_MD5Data(tls *libc.TLS, data uintptr, len1 Tsize_t, buf uintptr) (r uintptr) {
  6658. return libmd.XMD5Data(tls, data, len1, buf)
  6659. }
  6660. 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', '.'}
  6661. const m_AT_BASE = 7
  6662. const m_AT_BASE_PLATFORM = 24
  6663. const m_AT_CLKTCK = 17
  6664. const m_AT_DCACHEBSIZE = 19
  6665. const m_AT_EGID = 14
  6666. const m_AT_ENTRY = 9
  6667. const m_AT_EUID = 12
  6668. const m_AT_EXECFD = 2
  6669. const m_AT_EXECFN = 31
  6670. const m_AT_FLAGS = 8
  6671. const m_AT_FPUCW = 18
  6672. const m_AT_GID = 13
  6673. const m_AT_HWCAP = 16
  6674. const m_AT_HWCAP2 = 26
  6675. const m_AT_ICACHEBSIZE = 20
  6676. const m_AT_IGNORE = 1
  6677. const m_AT_IGNOREPPC = 22
  6678. const m_AT_L1D_CACHEGEOMETRY = 43
  6679. const m_AT_L1D_CACHESHAPE = 35
  6680. const m_AT_L1D_CACHESIZE = 42
  6681. const m_AT_L1I_CACHEGEOMETRY = 41
  6682. const m_AT_L1I_CACHESHAPE = 34
  6683. const m_AT_L1I_CACHESIZE = 40
  6684. const m_AT_L2_CACHEGEOMETRY = 45
  6685. const m_AT_L2_CACHESHAPE = 36
  6686. const m_AT_L2_CACHESIZE = 44
  6687. const m_AT_L3_CACHEGEOMETRY = 47
  6688. const m_AT_L3_CACHESHAPE = 37
  6689. const m_AT_L3_CACHESIZE = 46
  6690. const m_AT_MINSIGSTKSZ = 51
  6691. const m_AT_NOTELF = 10
  6692. const m_AT_NULL = 0
  6693. const m_AT_PAGESZ = 6
  6694. const m_AT_PHDR = 3
  6695. const m_AT_PHENT = 4
  6696. const m_AT_PHNUM = 5
  6697. const m_AT_PLATFORM = 15
  6698. const m_AT_RANDOM = 25
  6699. const m_AT_SECURE = 23
  6700. const m_AT_SYSINFO = 32
  6701. const m_AT_SYSINFO_EHDR = 33
  6702. const m_AT_UCACHEBSIZE = 21
  6703. const m_AT_UID = 11
  6704. const m_AUX_FUNC = 2
  6705. const m_AUX_OBJECT = 1
  6706. const m_BIND_WEAK = 2
  6707. const m_DF_1_CONFALT = 0x00002000
  6708. const m_DF_1_DIRECT = 0x00000100
  6709. const m_DF_1_DISPRELDNE = 0x00008000
  6710. const m_DF_1_DISPRELPND = 0x00010000
  6711. const m_DF_1_EDITED = 0x00200000
  6712. const m_DF_1_ENDFILTEE = 0x00004000
  6713. const m_DF_1_GLOBAL = 0x00000002
  6714. const m_DF_1_GLOBAUDIT = 0x01000000
  6715. const m_DF_1_GROUP = 0x00000004
  6716. const m_DF_1_IGNMULDEF = 0x00040000
  6717. const m_DF_1_INITFIRST = 0x00000020
  6718. const m_DF_1_INTERPOSE = 0x00000400
  6719. const m_DF_1_LOADFLTR = 0x00000010
  6720. const m_DF_1_NODEFLIB = 0x00000800
  6721. const m_DF_1_NODELETE = 0x00000008
  6722. const m_DF_1_NODIRECT = 0x00020000
  6723. const m_DF_1_NODUMP = 0x00001000
  6724. const m_DF_1_NOHDR = 0x00100000
  6725. const m_DF_1_NOKSYMS = 0x00080000
  6726. const m_DF_1_NOOPEN = 0x00000040
  6727. const m_DF_1_NORELOC = 0x00400000
  6728. const m_DF_1_NOW = 0x00000001
  6729. const m_DF_1_ORIGIN = 0x00000080
  6730. const m_DF_1_PIE = 0x08000000
  6731. const m_DF_1_SINGLETON = 0x02000000
  6732. const m_DF_1_STUB = 0x04000000
  6733. const m_DF_1_SYMINTPOSE = 0x00800000
  6734. const m_DF_1_TRANS = 0x00000200
  6735. const m_DF_BIND_NOW = 0x00000008
  6736. const m_DF_ORIGIN = 0x00000001
  6737. const m_DF_P1_GROUPPERM = 0x00000002
  6738. const m_DF_P1_LAZYLOAD = 0x00000001
  6739. const m_DF_STATIC_TLS = 0x00000010
  6740. const m_DF_SYMBOLIC = 0x00000002
  6741. const m_DF_TEXTREL = 0x00000004
  6742. const m_DTF_1_CONFEXP = 0x00000002
  6743. const m_DTF_1_PARINIT = 0x00000001
  6744. const m_DT_ADDRNUM = 11
  6745. const m_DT_ADDRRNGHI = 0x6ffffeff
  6746. const m_DT_ADDRRNGLO = 0x6ffffe00
  6747. const m_DT_ALPHA_NUM = 1
  6748. const m_DT_AUDIT = 0x6ffffefc
  6749. const m_DT_AUXILIARY = 0x7ffffffd
  6750. const m_DT_BIND_NOW = 24
  6751. const m_DT_CHECKSUM = 0x6ffffdf8
  6752. const m_DT_CONFIG = 0x6ffffefa
  6753. const m_DT_DEBUG = 21
  6754. const m_DT_DEPAUDIT = 0x6ffffefb
  6755. const m_DT_ENCODING = 32
  6756. const m_DT_EXTRANUM = 3
  6757. const m_DT_FEATURE_1 = 0x6ffffdfc
  6758. const m_DT_FILTER = 0x7fffffff
  6759. const m_DT_FINI = 13
  6760. const m_DT_FINI_ARRAY = 26
  6761. const m_DT_FINI_ARRAYSZ = 28
  6762. const m_DT_FLAGS = 30
  6763. const m_DT_FLAGS_1 = 0x6ffffffb
  6764. const m_DT_GNU_CONFLICT = 0x6ffffef8
  6765. const m_DT_GNU_CONFLICTSZ = 0x6ffffdf6
  6766. const m_DT_GNU_HASH = 0x6ffffef5
  6767. const m_DT_GNU_LIBLIST = 0x6ffffef9
  6768. const m_DT_GNU_LIBLISTSZ = 0x6ffffdf7
  6769. const m_DT_GNU_PRELINKED = 0x6ffffdf5
  6770. const m_DT_HASH = 4
  6771. const m_DT_HIOS = 0x6ffff000
  6772. const m_DT_HIPROC = 0x7fffffff
  6773. const m_DT_IA_64_NUM = 1
  6774. const m_DT_INIT = 12
  6775. const m_DT_INIT_ARRAY = 25
  6776. const m_DT_INIT_ARRAYSZ = 27
  6777. const m_DT_JMPREL = 23
  6778. const m_DT_LOOS = 0x6000000d
  6779. const m_DT_LOPROC = 0x70000000
  6780. const m_DT_MIPS_AUX_DYNAMIC = 0x70000031
  6781. const m_DT_MIPS_BASE_ADDRESS = 0x70000006
  6782. const m_DT_MIPS_COMPACT_SIZE = 0x7000002f
  6783. const m_DT_MIPS_CONFLICT = 0x70000008
  6784. const m_DT_MIPS_CONFLICTNO = 0x7000000b
  6785. const m_DT_MIPS_CXX_FLAGS = 0x70000022
  6786. const m_DT_MIPS_DELTA_CLASS = 0x70000017
  6787. const m_DT_MIPS_DELTA_CLASSSYM = 0x70000020
  6788. const m_DT_MIPS_DELTA_CLASSSYM_NO = 0x70000021
  6789. const m_DT_MIPS_DELTA_CLASS_NO = 0x70000018
  6790. const m_DT_MIPS_DELTA_INSTANCE = 0x70000019
  6791. const m_DT_MIPS_DELTA_INSTANCE_NO = 0x7000001a
  6792. const m_DT_MIPS_DELTA_RELOC = 0x7000001b
  6793. const m_DT_MIPS_DELTA_RELOC_NO = 0x7000001c
  6794. const m_DT_MIPS_DELTA_SYM = 0x7000001d
  6795. const m_DT_MIPS_DELTA_SYM_NO = 0x7000001e
  6796. const m_DT_MIPS_DYNSTR_ALIGN = 0x7000002b
  6797. const m_DT_MIPS_FLAGS = 0x70000005
  6798. const m_DT_MIPS_GOTSYM = 0x70000013
  6799. const m_DT_MIPS_GP_VALUE = 0x70000030
  6800. const m_DT_MIPS_HIDDEN_GOTIDX = 0x70000027
  6801. const m_DT_MIPS_HIPAGENO = 0x70000014
  6802. const m_DT_MIPS_ICHECKSUM = 0x70000003
  6803. const m_DT_MIPS_INTERFACE = 0x7000002a
  6804. const m_DT_MIPS_INTERFACE_SIZE = 0x7000002c
  6805. const m_DT_MIPS_IVERSION = 0x70000004
  6806. const m_DT_MIPS_LIBLIST = 0x70000009
  6807. const m_DT_MIPS_LIBLISTNO = 0x70000010
  6808. const m_DT_MIPS_LOCALPAGE_GOTIDX = 0x70000025
  6809. const m_DT_MIPS_LOCAL_GOTIDX = 0x70000026
  6810. const m_DT_MIPS_LOCAL_GOTNO = 0x7000000a
  6811. const m_DT_MIPS_MSYM = 0x70000007
  6812. const m_DT_MIPS_NUM = 0x36
  6813. const m_DT_MIPS_OPTIONS = 0x70000029
  6814. const m_DT_MIPS_PERF_SUFFIX = 0x7000002e
  6815. const m_DT_MIPS_PIXIE_INIT = 0x70000023
  6816. const m_DT_MIPS_PLTGOT = 0x70000032
  6817. const m_DT_MIPS_PROTECTED_GOTIDX = 0x70000028
  6818. const m_DT_MIPS_RLD_MAP = 0x70000016
  6819. const m_DT_MIPS_RLD_MAP_REL = 0x70000035
  6820. const m_DT_MIPS_RLD_TEXT_RESOLVE_ADDR = 0x7000002d
  6821. const m_DT_MIPS_RLD_VERSION = 0x70000001
  6822. const m_DT_MIPS_RWPLT = 0x70000034
  6823. const m_DT_MIPS_SYMBOL_LIB = 0x70000024
  6824. const m_DT_MIPS_SYMTABNO = 0x70000011
  6825. const m_DT_MIPS_TIME_STAMP = 0x70000002
  6826. const m_DT_MIPS_UNREFEXTNO = 0x70000012
  6827. const m_DT_MOVEENT = 0x6ffffdfa
  6828. const m_DT_MOVESZ = 0x6ffffdfb
  6829. const m_DT_MOVETAB = 0x6ffffefe
  6830. const m_DT_NEEDED = 1
  6831. const m_DT_NIOS2_GP = 0x70000002
  6832. const m_DT_NULL = 0
  6833. const m_DT_NUM = 38
  6834. const m_DT_PLTGOT = 3
  6835. const m_DT_PLTPAD = 0x6ffffefd
  6836. const m_DT_PLTPADSZ = 0x6ffffdf9
  6837. const m_DT_PLTREL = 20
  6838. const m_DT_PLTRELSZ = 2
  6839. const m_DT_POSFLAG_1 = 0x6ffffdfd
  6840. const m_DT_PPC64_NUM = 4
  6841. const m_DT_PPC_NUM = 2
  6842. const m_DT_PREINIT_ARRAY = 32
  6843. const m_DT_PREINIT_ARRAYSZ = 33
  6844. const m_DT_PROCNUM = "DT_MIPS_NUM"
  6845. const m_DT_REL = 17
  6846. const m_DT_RELA = 7
  6847. const m_DT_RELACOUNT = 0x6ffffff9
  6848. const m_DT_RELAENT = 9
  6849. const m_DT_RELASZ = 8
  6850. const m_DT_RELCOUNT = 0x6ffffffa
  6851. const m_DT_RELENT = 19
  6852. const m_DT_RELR = 36
  6853. const m_DT_RELRENT = 37
  6854. const m_DT_RELRSZ = 35
  6855. const m_DT_RELSZ = 18
  6856. const m_DT_RPATH = 15
  6857. const m_DT_RUNPATH = 29
  6858. const m_DT_SONAME = 14
  6859. const m_DT_SPARC_NUM = 2
  6860. const m_DT_SPARC_REGISTER = 0x70000001
  6861. const m_DT_STRSZ = 10
  6862. const m_DT_STRTAB = 5
  6863. const m_DT_SYMBOLIC = 16
  6864. const m_DT_SYMENT = 11
  6865. const m_DT_SYMINENT = 0x6ffffdff
  6866. const m_DT_SYMINFO = 0x6ffffeff
  6867. const m_DT_SYMINSZ = 0x6ffffdfe
  6868. const m_DT_SYMTAB = 6
  6869. const m_DT_SYMTAB_SHNDX = 34
  6870. const m_DT_TEXTREL = 22
  6871. const m_DT_TLSDESC_GOT = 0x6ffffef7
  6872. const m_DT_TLSDESC_PLT = 0x6ffffef6
  6873. const m_DT_VALNUM = 12
  6874. const m_DT_VALRNGHI = 0x6ffffdff
  6875. const m_DT_VALRNGLO = 0x6ffffd00
  6876. const m_DT_VERDEF = 0x6ffffffc
  6877. const m_DT_VERDEFNUM = 0x6ffffffd
  6878. const m_DT_VERNEED = 0x6ffffffe
  6879. const m_DT_VERNEEDNUM = 0x6fffffff
  6880. const m_DT_VERSIONTAGNUM = 16
  6881. const m_DT_VERSYM = 0x6ffffff0
  6882. const m_EFA_PARISC_1_0 = 0x020b
  6883. const m_EFA_PARISC_1_1 = 0x0210
  6884. const m_EFA_PARISC_2_0 = 0x0214
  6885. const m_EF_ALPHA_32BIT = 1
  6886. const m_EF_ALPHA_CANRELAX = 2
  6887. const m_EF_ARM_ABI_FLOAT_HARD = 0x400
  6888. const m_EF_ARM_ABI_FLOAT_SOFT = 0x200
  6889. const m_EF_ARM_ALIGN8 = 0x40
  6890. const m_EF_ARM_APCS_26 = 0x08
  6891. const m_EF_ARM_APCS_FLOAT = 0x10
  6892. const m_EF_ARM_BE8 = 0x00800000
  6893. const m_EF_ARM_DYNSYMSUSESEGIDX = 0x08
  6894. const m_EF_ARM_EABIMASK = 0xFF000000
  6895. const m_EF_ARM_EABI_UNKNOWN = 0x00000000
  6896. const m_EF_ARM_EABI_VER1 = 0x01000000
  6897. const m_EF_ARM_EABI_VER2 = 0x02000000
  6898. const m_EF_ARM_EABI_VER3 = 0x03000000
  6899. const m_EF_ARM_EABI_VER4 = 0x04000000
  6900. const m_EF_ARM_EABI_VER5 = 0x05000000
  6901. const m_EF_ARM_HASENTRY = 0x02
  6902. const m_EF_ARM_INTERWORK = 0x04
  6903. const m_EF_ARM_LE8 = 0x00400000
  6904. const m_EF_ARM_MAPSYMSFIRST = 0x10
  6905. const m_EF_ARM_MAVERICK_FLOAT = 0x800
  6906. const m_EF_ARM_NEW_ABI = 0x80
  6907. const m_EF_ARM_OLD_ABI = 0x100
  6908. const m_EF_ARM_PIC = 0x20
  6909. const m_EF_ARM_RELEXEC = 0x01
  6910. const m_EF_ARM_SOFT_FLOAT = 0x200
  6911. const m_EF_ARM_SYMSARESORTED = 0x04
  6912. const m_EF_ARM_VFP_FLOAT = 0x400
  6913. const m_EF_CPU32 = 0x00810000
  6914. const m_EF_IA_64_ABI64 = 0x00000010
  6915. const m_EF_IA_64_ARCH = 0xff000000
  6916. const m_EF_IA_64_MASKOS = 0x0000000f
  6917. const m_EF_LARCH_ABI_DOUBLE_FLOAT = 0x03
  6918. const m_EF_LARCH_ABI_MODIFIER_MASK = 0x07
  6919. const m_EF_LARCH_ABI_SINGLE_FLOAT = 0x02
  6920. const m_EF_LARCH_ABI_SOFT_FLOAT = 0x01
  6921. const m_EF_LARCH_OBJABI_V1 = 0x40
  6922. const m_EF_MIPS_64BIT_WHIRL = 16
  6923. const m_EF_MIPS_ABI2 = 32
  6924. const m_EF_MIPS_ABI_ON32 = 64
  6925. const m_EF_MIPS_ARCH = 0xf0000000
  6926. const m_EF_MIPS_ARCH_1 = 0x00000000
  6927. const m_EF_MIPS_ARCH_2 = 0x10000000
  6928. const m_EF_MIPS_ARCH_3 = 0x20000000
  6929. const m_EF_MIPS_ARCH_32 = 0x50000000
  6930. const m_EF_MIPS_ARCH_32R2 = 0x70000000
  6931. const m_EF_MIPS_ARCH_4 = 0x30000000
  6932. const m_EF_MIPS_ARCH_5 = 0x40000000
  6933. const m_EF_MIPS_ARCH_64 = 0x60000000
  6934. const m_EF_MIPS_ARCH_64R2 = 0x80000000
  6935. const m_EF_MIPS_CPIC = 4
  6936. const m_EF_MIPS_FP64 = 512
  6937. const m_EF_MIPS_NAN2008 = 1024
  6938. const m_EF_MIPS_NOREORDER = 1
  6939. const m_EF_MIPS_PIC = 2
  6940. const m_EF_MIPS_XGOT = 8
  6941. const m_EF_PARISC_ARCH = 0x0000ffff
  6942. const m_EF_PARISC_EXT = 0x00020000
  6943. const m_EF_PARISC_LAZYSWAP = 0x00400000
  6944. const m_EF_PARISC_LSB = 0x00040000
  6945. const m_EF_PARISC_NO_KABP = 0x00100000
  6946. const m_EF_PARISC_TRAPNIL = 0x00010000
  6947. const m_EF_PARISC_WIDE = 0x00080000
  6948. const m_EF_PPC64_ABI = 3
  6949. const m_EF_PPC_EMB = 0x80000000
  6950. const m_EF_PPC_RELOCATABLE = 0x00010000
  6951. const m_EF_PPC_RELOCATABLE_LIB = 0x00008000
  6952. const m_EF_SH1 = 0x1
  6953. const m_EF_SH2 = 0x2
  6954. const m_EF_SH2A = 0xd
  6955. const m_EF_SH2A_NOFPU = 0x13
  6956. const m_EF_SH2A_SH3E = 0x18
  6957. const m_EF_SH2A_SH3_NOFPU = 0x16
  6958. const m_EF_SH2A_SH4 = 0x17
  6959. const m_EF_SH2A_SH4_NOFPU = 0x15
  6960. const m_EF_SH2E = 0xb
  6961. const m_EF_SH3 = 0x3
  6962. const m_EF_SH3E = 0x8
  6963. const m_EF_SH3_DSP = 0x5
  6964. const m_EF_SH3_NOMMU = 0x14
  6965. const m_EF_SH4 = 0x9
  6966. const m_EF_SH4A = 0xc
  6967. const m_EF_SH4AL_DSP = 0x6
  6968. const m_EF_SH4A_NOFPU = 0x11
  6969. const m_EF_SH4_NOFPU = 0x10
  6970. const m_EF_SH4_NOMMU_NOFPU = 0x12
  6971. const m_EF_SH_DSP = 0x4
  6972. const m_EF_SH_MACH_MASK = 0x1f
  6973. const m_EF_SH_UNKNOWN = 0x0
  6974. const m_EF_SPARCV9_MM = 3
  6975. const m_EF_SPARCV9_PSO = 1
  6976. const m_EF_SPARCV9_RMO = 2
  6977. const m_EF_SPARCV9_TSO = 0
  6978. const m_EF_SPARC_32PLUS = 0x000100
  6979. const m_EF_SPARC_EXT_MASK = 0xFFFF00
  6980. const m_EF_SPARC_HAL_R1 = 0x000400
  6981. const m_EF_SPARC_LEDATA = 0x800000
  6982. const m_EF_SPARC_SUN_US1 = 0x000200
  6983. const m_EF_SPARC_SUN_US3 = 0x000800
  6984. const m_EI_ABIVERSION = 8
  6985. const m_EI_CLASS = 4
  6986. const m_EI_DATA = 5
  6987. const m_EI_MAG0 = 0
  6988. const m_EI_MAG1 = 1
  6989. const m_EI_MAG2 = 2
  6990. const m_EI_MAG3 = 3
  6991. const m_EI_NIDENT = 16
  6992. const m_EI_OSABI = 7
  6993. const m_EI_PAD = 9
  6994. const m_EI_VERSION = 6
  6995. const m_ELFCLASS32 = 1
  6996. const m_ELFCLASS64 = 2
  6997. const m_ELFCLASSNONE = 0
  6998. const m_ELFCLASSNUM = 3
  6999. const m_ELFCOMPRESS_HIOS = 0x6fffffff
  7000. const m_ELFCOMPRESS_HIPROC = 0x7fffffff
  7001. const m_ELFCOMPRESS_LOOS = 0x60000000
  7002. const m_ELFCOMPRESS_LOPROC = 0x70000000
  7003. const m_ELFCOMPRESS_ZLIB = 1
  7004. const m_ELFCOMPRESS_ZSTD = 2
  7005. const m_ELFDATA2LSB = 1
  7006. const m_ELFDATA2MSB = 2
  7007. const m_ELFDATANONE = 0
  7008. const m_ELFDATANUM = 3
  7009. const m_ELFMAG = "\\177ELF"
  7010. const m_ELFMAG0 = 127
  7011. const m_ELFMAG1 = 69
  7012. const m_ELFMAG2 = 76
  7013. const m_ELFMAG3 = 70
  7014. const m_ELFOSABI_AIX = 7
  7015. const m_ELFOSABI_ARM = 97
  7016. const m_ELFOSABI_FREEBSD = 9
  7017. const m_ELFOSABI_GNU = 3
  7018. const m_ELFOSABI_HPUX = 1
  7019. const m_ELFOSABI_IRIX = 8
  7020. const m_ELFOSABI_LINUX = 3
  7021. const m_ELFOSABI_MODESTO = 11
  7022. const m_ELFOSABI_NETBSD = 2
  7023. const m_ELFOSABI_NONE = 0
  7024. const m_ELFOSABI_OPENBSD = 12
  7025. const m_ELFOSABI_SOLARIS = 6
  7026. const m_ELFOSABI_STANDALONE = 255
  7027. const m_ELFOSABI_SYSV = 0
  7028. const m_ELFOSABI_TRU64 = 10
  7029. const m_ELF_NOTE_ABI = "NT_GNU_ABI_TAG"
  7030. const m_ELF_NOTE_GNU = "GNU"
  7031. const m_ELF_NOTE_OS_FREEBSD = 3
  7032. const m_ELF_NOTE_OS_GNU = 1
  7033. const m_ELF_NOTE_OS_LINUX = 0
  7034. const m_ELF_NOTE_OS_SOLARIS2 = 2
  7035. const m_ELF_NOTE_PAGESIZE_HINT = 1
  7036. const m_ELF_NOTE_SOLARIS = "SUNW Solaris"
  7037. const m_ELF_ST_BIND = "ELF64_ST_BIND"
  7038. const m_ELF_ST_TYPE = "ELF64_ST_TYPE"
  7039. const m_ELF_TARG_CLASS = "ELFCLASS64"
  7040. const m_ELF_TARG_DATA = "ELFDATA2LSB"
  7041. const m_ELF_TARG_MACH = "EM_RISCV"
  7042. const m_ELF_TARG_VER = "EV_CURRENT"
  7043. const m_EM_386 = 3
  7044. const m_EM_56800EX = 200
  7045. const m_EM_68HC05 = 72
  7046. const m_EM_68HC08 = 71
  7047. const m_EM_68HC11 = 70
  7048. const m_EM_68HC12 = 53
  7049. const m_EM_68HC16 = 69
  7050. const m_EM_68K = 4
  7051. const m_EM_78KOR = 199
  7052. const m_EM_8051 = 165
  7053. const m_EM_860 = 7
  7054. const m_EM_88K = 5
  7055. const m_EM_960 = 19
  7056. const m_EM_AARCH64 = 183
  7057. const m_EM_ALPHA = 0x9026
  7058. const m_EM_ALTERA_NIOS2 = 113
  7059. const m_EM_AMDGPU = 224
  7060. const m_EM_ARC = 45
  7061. const m_EM_ARCA = 109
  7062. const m_EM_ARC_A5 = 93
  7063. const m_EM_ARC_COMPACT = 93
  7064. const m_EM_ARC_COMPACT2 = 195
  7065. const m_EM_ARM = 40
  7066. const m_EM_AVR = 83
  7067. const m_EM_AVR32 = 185
  7068. const m_EM_BA1 = 201
  7069. const m_EM_BA2 = 202
  7070. const m_EM_BLACKFIN = 106
  7071. const m_EM_BPF = 247
  7072. const m_EM_C166 = 116
  7073. const m_EM_CDP = 215
  7074. const m_EM_CE = 119
  7075. const m_EM_CLOUDSHIELD = 192
  7076. const m_EM_COGE = 216
  7077. const m_EM_COLDFIRE = 52
  7078. const m_EM_COOL = 217
  7079. const m_EM_COREA_1ST = 193
  7080. const m_EM_COREA_2ND = 194
  7081. const m_EM_CR = 103
  7082. const m_EM_CR16 = 177
  7083. const m_EM_CRAYNV2 = 172
  7084. const m_EM_CRIS = 76
  7085. const m_EM_CRX = 114
  7086. const m_EM_CSKY = 252
  7087. const m_EM_CSR_KALIMBA = 219
  7088. const m_EM_CUDA = 190
  7089. const m_EM_CYPRESS_M8C = 161
  7090. const m_EM_D10V = 85
  7091. const m_EM_D30V = 86
  7092. const m_EM_DSP24 = 136
  7093. const m_EM_DSPIC30F = 118
  7094. const m_EM_DXP = 112
  7095. const m_EM_ECOG16 = 176
  7096. const m_EM_ECOG1X = 168
  7097. const m_EM_ECOG2 = 134
  7098. const m_EM_EMX16 = 212
  7099. const m_EM_EMX8 = 213
  7100. const m_EM_ETPU = 178
  7101. const m_EM_EXCESS = 111
  7102. const m_EM_F2MC16 = 104
  7103. const m_EM_FAKE_ALPHA = 41
  7104. const m_EM_FIREPATH = 78
  7105. const m_EM_FR20 = 37
  7106. const m_EM_FR30 = 84
  7107. const m_EM_FT32 = 222
  7108. const m_EM_FX66 = 66
  7109. const m_EM_H8S = 48
  7110. const m_EM_H8_300 = 46
  7111. const m_EM_H8_300H = 47
  7112. const m_EM_H8_500 = 49
  7113. const m_EM_HUANY = 81
  7114. const m_EM_IA_64 = 50
  7115. const m_EM_IP2K = 101
  7116. const m_EM_JAVELIN = 77
  7117. const m_EM_K10M = 181
  7118. const m_EM_KM32 = 210
  7119. const m_EM_KMX32 = 211
  7120. const m_EM_KVARC = 214
  7121. const m_EM_L10M = 180
  7122. const m_EM_LATTICEMICO32 = 138
  7123. const m_EM_LOONGARCH = 258
  7124. const m_EM_M16C = 117
  7125. const m_EM_M32 = 1
  7126. const m_EM_M32C = 120
  7127. const m_EM_M32R = 88
  7128. const m_EM_MANIK = 171
  7129. const m_EM_MAX = 102
  7130. const m_EM_MAXQ30 = 169
  7131. const m_EM_MCHP_PIC = 204
  7132. const m_EM_MCST_ELBRUS = 175
  7133. const m_EM_ME16 = 59
  7134. const m_EM_METAG = 174
  7135. const m_EM_MICROBLAZE = 189
  7136. const m_EM_MIPS = 8
  7137. const m_EM_MIPS_RS3_LE = 10
  7138. const m_EM_MIPS_X = 51
  7139. const m_EM_MMA = 54
  7140. const m_EM_MMDSP_PLUS = 160
  7141. const m_EM_MMIX = 80
  7142. const m_EM_MN10200 = 90
  7143. const m_EM_MN10300 = 89
  7144. const m_EM_MOXIE = 223
  7145. const m_EM_MSP430 = 105
  7146. const m_EM_NCPU = 56
  7147. const m_EM_NDR1 = 57
  7148. const m_EM_NDS32 = 167
  7149. const m_EM_NONE = 0
  7150. const m_EM_NORC = 218
  7151. const m_EM_NS32K = 97
  7152. const m_EM_NUM = 259
  7153. const m_EM_OPEN8 = 196
  7154. const m_EM_OPENRISC = 92
  7155. const m_EM_OR1K = 92
  7156. const m_EM_PARISC = 15
  7157. const m_EM_PCP = 55
  7158. const m_EM_PDSP = 63
  7159. const m_EM_PJ = 91
  7160. const m_EM_PPC = 20
  7161. const m_EM_PPC64 = 21
  7162. const m_EM_PRISM = 82
  7163. const m_EM_QDSP6 = 164
  7164. const m_EM_R32C = 162
  7165. const m_EM_RCE = 39
  7166. const m_EM_RH32 = 38
  7167. const m_EM_RISCV = 243
  7168. const m_EM_RL78 = 197
  7169. const m_EM_RS08 = 132
  7170. const m_EM_RX = 173
  7171. const m_EM_S370 = 9
  7172. const m_EM_S390 = 22
  7173. const m_EM_SCORE7 = 135
  7174. const m_EM_SEP = 108
  7175. const m_EM_SE_C17 = 139
  7176. const m_EM_SE_C33 = 107
  7177. const m_EM_SH = 42
  7178. const m_EM_SHARC = 133
  7179. const m_EM_SLE9X = 179
  7180. const m_EM_SNP1K = 99
  7181. const m_EM_SPARC = 2
  7182. const m_EM_SPARC32PLUS = 18
  7183. const m_EM_SPARCV9 = 43
  7184. const m_EM_ST100 = 60
  7185. const m_EM_ST19 = 74
  7186. const m_EM_ST200 = 100
  7187. const m_EM_ST7 = 68
  7188. const m_EM_ST9PLUS = 67
  7189. const m_EM_STARCORE = 58
  7190. const m_EM_STM8 = 186
  7191. const m_EM_STXP7X = 166
  7192. const m_EM_SVX = 73
  7193. const m_EM_TILE64 = 187
  7194. const m_EM_TILEGX = 191
  7195. const m_EM_TILEPRO = 188
  7196. const m_EM_TINYJ = 61
  7197. const m_EM_TI_ARP32 = 143
  7198. const m_EM_TI_C2000 = 141
  7199. const m_EM_TI_C5500 = 142
  7200. const m_EM_TI_C6000 = 140
  7201. const m_EM_TI_PRU = 144
  7202. const m_EM_TMM_GPP = 96
  7203. const m_EM_TPC = 98
  7204. const m_EM_TRICORE = 44
  7205. const m_EM_TRIMEDIA = 163
  7206. const m_EM_TSK3000 = 131
  7207. const m_EM_UNICORE = 110
  7208. const m_EM_V800 = 36
  7209. const m_EM_V850 = 87
  7210. const m_EM_VAX = 75
  7211. const m_EM_VIDEOCORE = 95
  7212. const m_EM_VIDEOCORE3 = 137
  7213. const m_EM_VIDEOCORE5 = 198
  7214. const m_EM_VISIUM = 221
  7215. const m_EM_VPP500 = 17
  7216. const m_EM_X86_64 = 62
  7217. const m_EM_XCORE = 203
  7218. const m_EM_XGATE = 115
  7219. const m_EM_XIMO16 = 170
  7220. const m_EM_XTENSA = 94
  7221. const m_EM_Z80 = 220
  7222. const m_EM_ZSP = 79
  7223. const m_ET_CORE = 4
  7224. const m_ET_DYN = 3
  7225. const m_ET_EXEC = 2
  7226. const m_ET_HIOS = 0xfeff
  7227. const m_ET_HIPROC = 0xffff
  7228. const m_ET_LOOS = 0xfe00
  7229. const m_ET_LOPROC = 0xff00
  7230. const m_ET_NONE = 0
  7231. const m_ET_NUM = 5
  7232. const m_ET_REL = 1
  7233. const m_EV_CURRENT = 1
  7234. const m_EV_NONE = 0
  7235. const m_EV_NUM = 2
  7236. const m_E_MIPS_ARCH_1 = 0x00000000
  7237. const m_E_MIPS_ARCH_2 = 0x10000000
  7238. const m_E_MIPS_ARCH_3 = 0x20000000
  7239. const m_E_MIPS_ARCH_32 = 0x50000000
  7240. const m_E_MIPS_ARCH_4 = 0x30000000
  7241. const m_E_MIPS_ARCH_5 = 0x40000000
  7242. const m_E_MIPS_ARCH_64 = 0x60000000
  7243. const m_Elf_Ehdr = "Elf64_Ehdr"
  7244. const m_Elf_Off = "Elf64_Off"
  7245. const m_Elf_Shdr = "Elf64_Shdr"
  7246. const m_Elf_Sword = "Elf64_Sword"
  7247. const m_Elf_Sym = "Elf64_Sym"
  7248. const m_Elf_Word = "Elf64_Word"
  7249. const m_GRP_COMDAT = 0x1
  7250. const m_LITUSE_ALPHA_ADDR = 0
  7251. const m_LITUSE_ALPHA_BASE = 1
  7252. const m_LITUSE_ALPHA_BYTOFF = 2
  7253. const m_LITUSE_ALPHA_JSR = 3
  7254. const m_LITUSE_ALPHA_TLS_GD = 4
  7255. const m_LITUSE_ALPHA_TLS_LDM = 5
  7256. const m_LL_NONE = 0
  7257. const m_MAP_ANON1 = 0x20
  7258. const m_MAP_PRIVATE1 = 0x02
  7259. const m_MIPS_AFL_ASE_DSP = 0x00000001
  7260. const m_MIPS_AFL_ASE_DSPR2 = 0x00000002
  7261. const m_MIPS_AFL_ASE_EVA = 0x00000004
  7262. const m_MIPS_AFL_ASE_MASK = 0x00001fff
  7263. const m_MIPS_AFL_ASE_MCU = 0x00000008
  7264. const m_MIPS_AFL_ASE_MDMX = 0x00000010
  7265. const m_MIPS_AFL_ASE_MICROMIPS = 0x00000800
  7266. const m_MIPS_AFL_ASE_MIPS16 = 0x00000400
  7267. const m_MIPS_AFL_ASE_MIPS3D = 0x00000020
  7268. const m_MIPS_AFL_ASE_MSA = 0x00000200
  7269. const m_MIPS_AFL_ASE_MT = 0x00000040
  7270. const m_MIPS_AFL_ASE_SMARTMIPS = 0x00000080
  7271. const m_MIPS_AFL_ASE_VIRT = 0x00000100
  7272. const m_MIPS_AFL_ASE_XPA = 0x00001000
  7273. const m_MIPS_AFL_EXT_10000 = 11
  7274. const m_MIPS_AFL_EXT_3900 = 10
  7275. const m_MIPS_AFL_EXT_4010 = 8
  7276. const m_MIPS_AFL_EXT_4100 = 9
  7277. const m_MIPS_AFL_EXT_4111 = 13
  7278. const m_MIPS_AFL_EXT_4120 = 14
  7279. const m_MIPS_AFL_EXT_4650 = 7
  7280. const m_MIPS_AFL_EXT_5400 = 15
  7281. const m_MIPS_AFL_EXT_5500 = 16
  7282. const m_MIPS_AFL_EXT_5900 = 6
  7283. const m_MIPS_AFL_EXT_LOONGSON_2E = 17
  7284. const m_MIPS_AFL_EXT_LOONGSON_2F = 18
  7285. const m_MIPS_AFL_EXT_LOONGSON_3A = 4
  7286. const m_MIPS_AFL_EXT_OCTEON = 5
  7287. const m_MIPS_AFL_EXT_OCTEON2 = 2
  7288. const m_MIPS_AFL_EXT_OCTEONP = 3
  7289. const m_MIPS_AFL_EXT_SB1 = 12
  7290. const m_MIPS_AFL_EXT_XLR = 1
  7291. const m_MIPS_AFL_FLAGS1_ODDSPREG = 1
  7292. const m_MIPS_AFL_REG_128 = 0x03
  7293. const m_MIPS_AFL_REG_32 = 0x01
  7294. const m_MIPS_AFL_REG_64 = 0x02
  7295. const m_MIPS_AFL_REG_NONE = 0x00
  7296. const m_NT_386_IOPERM = 0x201
  7297. const m_NT_386_TLS = 0x200
  7298. const m_NT_ARC_V2 = 0x600
  7299. const m_NT_ARM_HW_BREAK = 0x402
  7300. const m_NT_ARM_HW_WATCH = 0x403
  7301. const m_NT_ARM_PACA_KEYS = 0x407
  7302. const m_NT_ARM_PACG_KEYS = 0x408
  7303. const m_NT_ARM_PAC_ENABLED_KEYS = 0x40a
  7304. const m_NT_ARM_PAC_MASK = 0x406
  7305. const m_NT_ARM_SVE = 0x405
  7306. const m_NT_ARM_SYSTEM_CALL = 0x404
  7307. const m_NT_ARM_TAGGED_ADDR_CTRL = 0x409
  7308. const m_NT_ARM_TLS = 0x401
  7309. const m_NT_ARM_VFP = 0x400
  7310. const m_NT_ASRS = 8
  7311. const m_NT_AUXV = 6
  7312. const m_NT_FILE = 0x46494c45
  7313. const m_NT_FPREGSET = 2
  7314. const m_NT_GNU_ABI_TAG = 1
  7315. const m_NT_GNU_BUILD_ID = 3
  7316. const m_NT_GNU_GOLD_VERSION = 4
  7317. const m_NT_GNU_PROPERTY_TYPE_0 = 5
  7318. const m_NT_GWINDOWS = 7
  7319. const m_NT_LOONGARCH_CPUCFG = 0xa00
  7320. const m_NT_LOONGARCH_CSR = 0xa01
  7321. const m_NT_LOONGARCH_LASX = 0xa03
  7322. const m_NT_LOONGARCH_LBT = 0xa04
  7323. const m_NT_LOONGARCH_LSX = 0xa02
  7324. const m_NT_LWPSINFO = 17
  7325. const m_NT_LWPSTATUS = 16
  7326. const m_NT_METAG_CBUF = 0x500
  7327. const m_NT_METAG_RPIPE = 0x501
  7328. const m_NT_METAG_TLS = 0x502
  7329. const m_NT_MIPS_DSP = 0x800
  7330. const m_NT_MIPS_FP_MODE = 0x801
  7331. const m_NT_MIPS_MSA = 0x802
  7332. const m_NT_PLATFORM = 5
  7333. const m_NT_PPC_DSCR = 0x105
  7334. const m_NT_PPC_EBB = 0x106
  7335. const m_NT_PPC_PMU = 0x107
  7336. const m_NT_PPC_PPR = 0x104
  7337. const m_NT_PPC_SPE = 0x101
  7338. const m_NT_PPC_TAR = 0x103
  7339. const m_NT_PPC_TM_CDSCR = 0x10f
  7340. const m_NT_PPC_TM_CFPR = 0x109
  7341. const m_NT_PPC_TM_CGPR = 0x108
  7342. const m_NT_PPC_TM_CPPR = 0x10e
  7343. const m_NT_PPC_TM_CTAR = 0x10d
  7344. const m_NT_PPC_TM_CVMX = 0x10a
  7345. const m_NT_PPC_TM_CVSX = 0x10b
  7346. const m_NT_PPC_TM_SPR = 0x10c
  7347. const m_NT_PPC_VMX = 0x100
  7348. const m_NT_PPC_VSX = 0x102
  7349. const m_NT_PRCRED = 14
  7350. const m_NT_PRFPREG = 2
  7351. const m_NT_PRFPXREG = 20
  7352. const m_NT_PRPSINFO = 3
  7353. const m_NT_PRSTATUS = 1
  7354. const m_NT_PRXFPREG = 0x46e62b7f
  7355. const m_NT_PRXREG = 4
  7356. const m_NT_PSINFO = 13
  7357. const m_NT_PSTATUS = 10
  7358. const m_NT_RISCV_CSR = 0x900
  7359. const m_NT_RISCV_VECTOR = 0x901
  7360. const m_NT_S390_CTRS = 0x304
  7361. const m_NT_S390_GS_BC = 0x30c
  7362. const m_NT_S390_GS_CB = 0x30b
  7363. const m_NT_S390_HIGH_GPRS = 0x300
  7364. const m_NT_S390_LAST_BREAK = 0x306
  7365. const m_NT_S390_PREFIX = 0x305
  7366. const m_NT_S390_RI_CB = 0x30d
  7367. const m_NT_S390_SYSTEM_CALL = 0x307
  7368. const m_NT_S390_TDB = 0x308
  7369. const m_NT_S390_TIMER = 0x301
  7370. const m_NT_S390_TODCMP = 0x302
  7371. const m_NT_S390_TODPREG = 0x303
  7372. const m_NT_S390_VXRS_HIGH = 0x30a
  7373. const m_NT_S390_VXRS_LOW = 0x309
  7374. const m_NT_SIGINFO = 0x53494749
  7375. const m_NT_TASKSTRUCT = 4
  7376. const m_NT_UTSNAME = 15
  7377. const m_NT_VERSION = 1
  7378. const m_NT_VMCOREDD = 0x700
  7379. const m_NT_X86_XSTATE = 0x202
  7380. const m_N_ABS = 2
  7381. const m_N_BSS = 8
  7382. const m_N_COMM = 0x12
  7383. const m_N_DATA = 6
  7384. const m_N_EXT = 1
  7385. const m_N_FN = 30
  7386. const m_N_FORMAT = "%08x"
  7387. const m_N_INDR = 0x0a
  7388. const m_N_SETA = 0x14
  7389. const m_N_SETB = 0x1a
  7390. const m_N_SETD = 0x18
  7391. const m_N_SETT = 0x16
  7392. const m_N_SETV = 0x1c
  7393. const m_N_SIZE = 0x0c
  7394. const m_N_STAB = 0xe0
  7395. const m_N_TEXT = 4
  7396. const m_N_TYPE = 0x1e
  7397. const m_N_UNDF = 0
  7398. const m_N_WARN = 0x1e
  7399. const m_ODK_EXCEPTIONS = 2
  7400. const m_ODK_FILL = 5
  7401. const m_ODK_HWAND = 7
  7402. const m_ODK_HWOR = 8
  7403. const m_ODK_HWPATCH = 4
  7404. const m_ODK_NULL = 0
  7405. const m_ODK_PAD = 3
  7406. const m_ODK_REGINFO = 1
  7407. const m_ODK_TAGS = 6
  7408. const m_OEX_DISMISS = 0x80000
  7409. const m_OEX_FPDBUG = 0x40000
  7410. const m_OEX_FPU_DIV0 = 0x08
  7411. const m_OEX_FPU_INEX = 0x01
  7412. const m_OEX_FPU_INVAL = 0x10
  7413. const m_OEX_FPU_MAX = 0x1f00
  7414. const m_OEX_FPU_MIN = 0x1f
  7415. const m_OEX_FPU_OFLO = 0x04
  7416. const m_OEX_FPU_UFLO = 0x02
  7417. const m_OEX_PAGE0 = 0x10000
  7418. const m_OEX_PRECISEFP = "OEX_FPDBUG"
  7419. const m_OEX_SMM = 0x20000
  7420. const m_OHWA0_R4KEOP_CHECKED = 0x00000001
  7421. const m_OHWA1_R4KEOP_CLEAN = 0x00000002
  7422. const m_OHW_R4KEOP = 0x1
  7423. const m_OHW_R5KCVTL = 0x8
  7424. const m_OHW_R5KEOP = 0x4
  7425. const m_OHW_R8KPFETCH = 0x2
  7426. const m_OPAD_POSTFIX = 0x2
  7427. const m_OPAD_PREFIX = 0x1
  7428. const m_OPAD_SYMBOL = 0x4
  7429. const m_O_CREAT2 = 0100
  7430. const m_O_NONBLOCK2 = 04000
  7431. const m_O_RDONLY1 = 0
  7432. const m_O_TRUNC2 = 01000
  7433. const m_PF_ARM_ABS = 0x40000000
  7434. const m_PF_ARM_PI = 0x20000000
  7435. const m_PF_ARM_SB = 0x10000000
  7436. const m_PF_HP_CODE = 0x01000000
  7437. const m_PF_HP_FAR_SHARED = 0x00200000
  7438. const m_PF_HP_LAZYSWAP = 0x04000000
  7439. const m_PF_HP_MODIFY = 0x02000000
  7440. const m_PF_HP_NEAR_SHARED = 0x00400000
  7441. const m_PF_HP_PAGE_SIZE = 0x00100000
  7442. const m_PF_HP_SBP = 0x08000000
  7443. const m_PF_IA_64_NORECOV = 0x80000000
  7444. const m_PF_MASKOS = 0x0ff00000
  7445. const m_PF_MASKPROC = 0xf0000000
  7446. const m_PF_MIPS_LOCAL = 0x10000000
  7447. const m_PF_PARISC_SBP = 0x08000000
  7448. const m_PN_XNUM = 0xffff
  7449. const m_PPC64_OPT_LOCALENTRY = 4
  7450. const m_PPC64_OPT_MULTI_TOC = 2
  7451. const m_PPC64_OPT_TLS = 1
  7452. const m_PPC_OPT_TLS = 1
  7453. const m_PT_DYNAMIC = 2
  7454. const m_PT_GNU_EH_FRAME = 0x6474e550
  7455. const m_PT_GNU_PROPERTY = 0x6474e553
  7456. const m_PT_GNU_RELRO = 0x6474e552
  7457. const m_PT_GNU_STACK = 0x6474e551
  7458. const m_PT_HIOS = 0x6fffffff
  7459. const m_PT_HIPROC = 0x7fffffff
  7460. const m_PT_HISUNW = 0x6fffffff
  7461. const m_PT_INTERP = 3
  7462. const m_PT_LOAD = 1
  7463. const m_PT_LOOS = 0x60000000
  7464. const m_PT_LOPROC = 0x70000000
  7465. const m_PT_LOSUNW = 0x6ffffffa
  7466. const m_PT_MIPS_ABIFLAGS = 0x70000003
  7467. const m_PT_MIPS_OPTIONS = 0x70000002
  7468. const m_PT_MIPS_REGINFO = 0x70000000
  7469. const m_PT_MIPS_RTPROC = 0x70000001
  7470. const m_PT_NOTE = 4
  7471. const m_PT_NULL = 0
  7472. const m_PT_NUM = 8
  7473. const m_PT_PARISC_ARCHEXT = 0x70000000
  7474. const m_PT_PARISC_UNWIND = 0x70000001
  7475. const m_PT_PHDR = 6
  7476. const m_PT_SHLIB = 5
  7477. const m_PT_SUNWBSS = 0x6ffffffa
  7478. const m_PT_SUNWSTACK = 0x6ffffffb
  7479. const m_PT_TLS = 7
  7480. const m_RHF_NONE = 0
  7481. const m_R_386_16 = 20
  7482. const m_R_386_32 = 1
  7483. const m_R_386_32PLT = 11
  7484. const m_R_386_8 = 22
  7485. const m_R_386_COPY = 5
  7486. const m_R_386_GLOB_DAT = 6
  7487. const m_R_386_GOT32 = 3
  7488. const m_R_386_GOT32X = 43
  7489. const m_R_386_GOTOFF = 9
  7490. const m_R_386_GOTPC = 10
  7491. const m_R_386_IRELATIVE = 42
  7492. const m_R_386_JMP_SLOT = 7
  7493. const m_R_386_NONE = 0
  7494. const m_R_386_NUM = 44
  7495. const m_R_386_PC16 = 21
  7496. const m_R_386_PC32 = 2
  7497. const m_R_386_PC8 = 23
  7498. const m_R_386_PLT32 = 4
  7499. const m_R_386_RELATIVE = 8
  7500. const m_R_386_SIZE32 = 38
  7501. const m_R_386_TLS_DESC = 41
  7502. const m_R_386_TLS_DESC_CALL = 40
  7503. const m_R_386_TLS_DTPMOD32 = 35
  7504. const m_R_386_TLS_DTPOFF32 = 36
  7505. const m_R_386_TLS_GD = 18
  7506. const m_R_386_TLS_GD_32 = 24
  7507. const m_R_386_TLS_GD_CALL = 26
  7508. const m_R_386_TLS_GD_POP = 27
  7509. const m_R_386_TLS_GD_PUSH = 25
  7510. const m_R_386_TLS_GOTDESC = 39
  7511. const m_R_386_TLS_GOTIE = 16
  7512. const m_R_386_TLS_IE = 15
  7513. const m_R_386_TLS_IE_32 = 33
  7514. const m_R_386_TLS_LDM = 19
  7515. const m_R_386_TLS_LDM_32 = 28
  7516. const m_R_386_TLS_LDM_CALL = 30
  7517. const m_R_386_TLS_LDM_POP = 31
  7518. const m_R_386_TLS_LDM_PUSH = 29
  7519. const m_R_386_TLS_LDO_32 = 32
  7520. const m_R_386_TLS_LE = 17
  7521. const m_R_386_TLS_LE_32 = 34
  7522. const m_R_386_TLS_TPOFF = 14
  7523. const m_R_386_TLS_TPOFF32 = 37
  7524. const m_R_390_12 = 2
  7525. const m_R_390_16 = 3
  7526. const m_R_390_20 = 57
  7527. const m_R_390_32 = 4
  7528. const m_R_390_64 = 22
  7529. const m_R_390_8 = 1
  7530. const m_R_390_COPY = 9
  7531. const m_R_390_GLOB_DAT = 10
  7532. const m_R_390_GOT12 = 6
  7533. const m_R_390_GOT16 = 15
  7534. const m_R_390_GOT20 = 58
  7535. const m_R_390_GOT32 = 7
  7536. const m_R_390_GOT64 = 24
  7537. const m_R_390_GOTENT = 26
  7538. const m_R_390_GOTOFF16 = 27
  7539. const m_R_390_GOTOFF32 = 13
  7540. const m_R_390_GOTOFF64 = 28
  7541. const m_R_390_GOTPC = 14
  7542. const m_R_390_GOTPCDBL = 21
  7543. const m_R_390_GOTPLT12 = 29
  7544. const m_R_390_GOTPLT16 = 30
  7545. const m_R_390_GOTPLT20 = 59
  7546. const m_R_390_GOTPLT32 = 31
  7547. const m_R_390_GOTPLT64 = 32
  7548. const m_R_390_GOTPLTENT = 33
  7549. const m_R_390_JMP_SLOT = 11
  7550. const m_R_390_NONE = 0
  7551. const m_R_390_NUM = 61
  7552. const m_R_390_PC16 = 16
  7553. const m_R_390_PC16DBL = 17
  7554. const m_R_390_PC32 = 5
  7555. const m_R_390_PC32DBL = 19
  7556. const m_R_390_PC64 = 23
  7557. const m_R_390_PLT16DBL = 18
  7558. const m_R_390_PLT32 = 8
  7559. const m_R_390_PLT32DBL = 20
  7560. const m_R_390_PLT64 = 25
  7561. const m_R_390_PLTOFF16 = 34
  7562. const m_R_390_PLTOFF32 = 35
  7563. const m_R_390_PLTOFF64 = 36
  7564. const m_R_390_RELATIVE = 12
  7565. const m_R_390_TLS_DTPMOD = 54
  7566. const m_R_390_TLS_DTPOFF = 55
  7567. const m_R_390_TLS_GD32 = 40
  7568. const m_R_390_TLS_GD64 = 41
  7569. const m_R_390_TLS_GDCALL = 38
  7570. const m_R_390_TLS_GOTIE12 = 42
  7571. const m_R_390_TLS_GOTIE20 = 60
  7572. const m_R_390_TLS_GOTIE32 = 43
  7573. const m_R_390_TLS_GOTIE64 = 44
  7574. const m_R_390_TLS_IE32 = 47
  7575. const m_R_390_TLS_IE64 = 48
  7576. const m_R_390_TLS_IEENT = 49
  7577. const m_R_390_TLS_LDCALL = 39
  7578. const m_R_390_TLS_LDM32 = 45
  7579. const m_R_390_TLS_LDM64 = 46
  7580. const m_R_390_TLS_LDO32 = 52
  7581. const m_R_390_TLS_LDO64 = 53
  7582. const m_R_390_TLS_LE32 = 50
  7583. const m_R_390_TLS_LE64 = 51
  7584. const m_R_390_TLS_LOAD = 37
  7585. const m_R_390_TLS_TPOFF = 56
  7586. const m_R_68K_16 = 2
  7587. const m_R_68K_32 = 1
  7588. const m_R_68K_8 = 3
  7589. const m_R_68K_COPY = 19
  7590. const m_R_68K_GLOB_DAT = 20
  7591. const m_R_68K_GOT16 = 8
  7592. const m_R_68K_GOT16O = 11
  7593. const m_R_68K_GOT32 = 7
  7594. const m_R_68K_GOT32O = 10
  7595. const m_R_68K_GOT8 = 9
  7596. const m_R_68K_GOT8O = 12
  7597. const m_R_68K_JMP_SLOT = 21
  7598. const m_R_68K_NONE = 0
  7599. const m_R_68K_NUM = 43
  7600. const m_R_68K_PC16 = 5
  7601. const m_R_68K_PC32 = 4
  7602. const m_R_68K_PC8 = 6
  7603. const m_R_68K_PLT16 = 14
  7604. const m_R_68K_PLT16O = 17
  7605. const m_R_68K_PLT32 = 13
  7606. const m_R_68K_PLT32O = 16
  7607. const m_R_68K_PLT8 = 15
  7608. const m_R_68K_PLT8O = 18
  7609. const m_R_68K_RELATIVE = 22
  7610. const m_R_68K_TLS_DTPMOD32 = 40
  7611. const m_R_68K_TLS_DTPREL32 = 41
  7612. const m_R_68K_TLS_GD16 = 26
  7613. const m_R_68K_TLS_GD32 = 25
  7614. const m_R_68K_TLS_GD8 = 27
  7615. const m_R_68K_TLS_IE16 = 35
  7616. const m_R_68K_TLS_IE32 = 34
  7617. const m_R_68K_TLS_IE8 = 36
  7618. const m_R_68K_TLS_LDM16 = 29
  7619. const m_R_68K_TLS_LDM32 = 28
  7620. const m_R_68K_TLS_LDM8 = 30
  7621. const m_R_68K_TLS_LDO16 = 32
  7622. const m_R_68K_TLS_LDO32 = 31
  7623. const m_R_68K_TLS_LDO8 = 33
  7624. const m_R_68K_TLS_LE16 = 38
  7625. const m_R_68K_TLS_LE32 = 37
  7626. const m_R_68K_TLS_LE8 = 39
  7627. const m_R_68K_TLS_TPREL32 = 42
  7628. const m_R_AARCH64_ABS16 = 259
  7629. const m_R_AARCH64_ABS32 = 258
  7630. const m_R_AARCH64_ABS64 = 257
  7631. const m_R_AARCH64_ADD_ABS_LO12_NC = 277
  7632. const m_R_AARCH64_ADR_GOT_PAGE = 311
  7633. const m_R_AARCH64_ADR_PREL_LO21 = 274
  7634. const m_R_AARCH64_ADR_PREL_PG_HI21 = 275
  7635. const m_R_AARCH64_ADR_PREL_PG_HI21_NC = 276
  7636. const m_R_AARCH64_CALL26 = 283
  7637. const m_R_AARCH64_CONDBR19 = 280
  7638. const m_R_AARCH64_COPY = 1024
  7639. const m_R_AARCH64_GLOB_DAT = 1025
  7640. const m_R_AARCH64_GOTREL32 = 308
  7641. const m_R_AARCH64_GOTREL64 = 307
  7642. const m_R_AARCH64_GOT_LD_PREL19 = 309
  7643. const m_R_AARCH64_JUMP26 = 282
  7644. const m_R_AARCH64_JUMP_SLOT = 1026
  7645. const m_R_AARCH64_LD64_GOTOFF_LO15 = 310
  7646. const m_R_AARCH64_LD64_GOTPAGE_LO15 = 313
  7647. const m_R_AARCH64_LD64_GOT_LO12_NC = 312
  7648. const m_R_AARCH64_LDST128_ABS_LO12_NC = 299
  7649. const m_R_AARCH64_LDST16_ABS_LO12_NC = 284
  7650. const m_R_AARCH64_LDST32_ABS_LO12_NC = 285
  7651. const m_R_AARCH64_LDST64_ABS_LO12_NC = 286
  7652. const m_R_AARCH64_LDST8_ABS_LO12_NC = 278
  7653. const m_R_AARCH64_LD_PREL_LO19 = 273
  7654. const m_R_AARCH64_MOVW_GOTOFF_G0 = 300
  7655. const m_R_AARCH64_MOVW_GOTOFF_G0_NC = 301
  7656. const m_R_AARCH64_MOVW_GOTOFF_G1 = 302
  7657. const m_R_AARCH64_MOVW_GOTOFF_G1_NC = 303
  7658. const m_R_AARCH64_MOVW_GOTOFF_G2 = 304
  7659. const m_R_AARCH64_MOVW_GOTOFF_G2_NC = 305
  7660. const m_R_AARCH64_MOVW_GOTOFF_G3 = 306
  7661. const m_R_AARCH64_MOVW_PREL_G0 = 287
  7662. const m_R_AARCH64_MOVW_PREL_G0_NC = 288
  7663. const m_R_AARCH64_MOVW_PREL_G1 = 289
  7664. const m_R_AARCH64_MOVW_PREL_G1_NC = 290
  7665. const m_R_AARCH64_MOVW_PREL_G2 = 291
  7666. const m_R_AARCH64_MOVW_PREL_G2_NC = 292
  7667. const m_R_AARCH64_MOVW_PREL_G3 = 293
  7668. const m_R_AARCH64_MOVW_SABS_G0 = 270
  7669. const m_R_AARCH64_MOVW_SABS_G1 = 271
  7670. const m_R_AARCH64_MOVW_SABS_G2 = 272
  7671. const m_R_AARCH64_MOVW_UABS_G0 = 263
  7672. const m_R_AARCH64_MOVW_UABS_G0_NC = 264
  7673. const m_R_AARCH64_MOVW_UABS_G1 = 265
  7674. const m_R_AARCH64_MOVW_UABS_G1_NC = 266
  7675. const m_R_AARCH64_MOVW_UABS_G2 = 267
  7676. const m_R_AARCH64_MOVW_UABS_G2_NC = 268
  7677. const m_R_AARCH64_MOVW_UABS_G3 = 269
  7678. const m_R_AARCH64_NONE = 0
  7679. const m_R_AARCH64_P32_ABS32 = 1
  7680. const m_R_AARCH64_P32_COPY = 180
  7681. const m_R_AARCH64_P32_GLOB_DAT = 181
  7682. const m_R_AARCH64_P32_IRELATIVE = 188
  7683. const m_R_AARCH64_P32_JUMP_SLOT = 182
  7684. const m_R_AARCH64_P32_RELATIVE = 183
  7685. const m_R_AARCH64_P32_TLSDESC = 187
  7686. const m_R_AARCH64_P32_TLS_DTPMOD = 184
  7687. const m_R_AARCH64_P32_TLS_DTPREL = 185
  7688. const m_R_AARCH64_P32_TLS_TPREL = 186
  7689. const m_R_AARCH64_PREL16 = 262
  7690. const m_R_AARCH64_PREL32 = 261
  7691. const m_R_AARCH64_PREL64 = 260
  7692. const m_R_AARCH64_RELATIVE = 1027
  7693. const m_R_AARCH64_TLSDESC = 1031
  7694. const m_R_AARCH64_TLSDESC_ADD = 568
  7695. const m_R_AARCH64_TLSDESC_ADD_LO12 = 564
  7696. const m_R_AARCH64_TLSDESC_ADR_PAGE21 = 562
  7697. const m_R_AARCH64_TLSDESC_ADR_PREL21 = 561
  7698. const m_R_AARCH64_TLSDESC_CALL = 569
  7699. const m_R_AARCH64_TLSDESC_LD64_LO12 = 563
  7700. const m_R_AARCH64_TLSDESC_LDR = 567
  7701. const m_R_AARCH64_TLSDESC_LD_PREL19 = 560
  7702. const m_R_AARCH64_TLSDESC_OFF_G0_NC = 566
  7703. const m_R_AARCH64_TLSDESC_OFF_G1 = 565
  7704. const m_R_AARCH64_TLSGD_ADD_LO12_NC = 514
  7705. const m_R_AARCH64_TLSGD_ADR_PAGE21 = 513
  7706. const m_R_AARCH64_TLSGD_ADR_PREL21 = 512
  7707. const m_R_AARCH64_TLSGD_MOVW_G0_NC = 516
  7708. const m_R_AARCH64_TLSGD_MOVW_G1 = 515
  7709. const m_R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 = 541
  7710. const m_R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC = 542
  7711. const m_R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 = 543
  7712. const m_R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC = 540
  7713. const m_R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 = 539
  7714. const m_R_AARCH64_TLSLD_ADD_DTPREL_HI12 = 528
  7715. const m_R_AARCH64_TLSLD_ADD_DTPREL_LO12 = 529
  7716. const m_R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC = 530
  7717. const m_R_AARCH64_TLSLD_ADD_LO12_NC = 519
  7718. const m_R_AARCH64_TLSLD_ADR_PAGE21 = 518
  7719. const m_R_AARCH64_TLSLD_ADR_PREL21 = 517
  7720. const m_R_AARCH64_TLSLD_LDST128_DTPREL_LO12 = 572
  7721. const m_R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC = 573
  7722. const m_R_AARCH64_TLSLD_LDST16_DTPREL_LO12 = 533
  7723. const m_R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC = 534
  7724. const m_R_AARCH64_TLSLD_LDST32_DTPREL_LO12 = 535
  7725. const m_R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC = 536
  7726. const m_R_AARCH64_TLSLD_LDST64_DTPREL_LO12 = 537
  7727. const m_R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC = 538
  7728. const m_R_AARCH64_TLSLD_LDST8_DTPREL_LO12 = 531
  7729. const m_R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC = 532
  7730. const m_R_AARCH64_TLSLD_LD_PREL19 = 522
  7731. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G0 = 526
  7732. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC = 527
  7733. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G1 = 524
  7734. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC = 525
  7735. const m_R_AARCH64_TLSLD_MOVW_DTPREL_G2 = 523
  7736. const m_R_AARCH64_TLSLD_MOVW_G0_NC = 521
  7737. const m_R_AARCH64_TLSLD_MOVW_G1 = 520
  7738. const m_R_AARCH64_TLSLE_ADD_TPREL_HI12 = 549
  7739. const m_R_AARCH64_TLSLE_ADD_TPREL_LO12 = 550
  7740. const m_R_AARCH64_TLSLE_ADD_TPREL_LO12_NC = 551
  7741. const m_R_AARCH64_TLSLE_LDST128_TPREL_LO12 = 570
  7742. const m_R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC = 571
  7743. const m_R_AARCH64_TLSLE_LDST16_TPREL_LO12 = 554
  7744. const m_R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC = 555
  7745. const m_R_AARCH64_TLSLE_LDST32_TPREL_LO12 = 556
  7746. const m_R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC = 557
  7747. const m_R_AARCH64_TLSLE_LDST64_TPREL_LO12 = 558
  7748. const m_R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC = 559
  7749. const m_R_AARCH64_TLSLE_LDST8_TPREL_LO12 = 552
  7750. const m_R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC = 553
  7751. const m_R_AARCH64_TLSLE_MOVW_TPREL_G0 = 547
  7752. const m_R_AARCH64_TLSLE_MOVW_TPREL_G0_NC = 548
  7753. const m_R_AARCH64_TLSLE_MOVW_TPREL_G1 = 545
  7754. const m_R_AARCH64_TLSLE_MOVW_TPREL_G1_NC = 546
  7755. const m_R_AARCH64_TLSLE_MOVW_TPREL_G2 = 544
  7756. const m_R_AARCH64_TLS_DTPMOD = 1028
  7757. const m_R_AARCH64_TLS_DTPMOD64 = 1028
  7758. const m_R_AARCH64_TLS_DTPREL = 1029
  7759. const m_R_AARCH64_TLS_DTPREL64 = 1029
  7760. const m_R_AARCH64_TLS_TPREL = 1030
  7761. const m_R_AARCH64_TLS_TPREL64 = 1030
  7762. const m_R_AARCH64_TSTBR14 = 279
  7763. const m_R_ALPHA_BRADDR = 7
  7764. const m_R_ALPHA_COPY = 24
  7765. const m_R_ALPHA_DTPMOD64 = 31
  7766. const m_R_ALPHA_DTPREL16 = 36
  7767. const m_R_ALPHA_DTPREL64 = 33
  7768. const m_R_ALPHA_DTPRELHI = 34
  7769. const m_R_ALPHA_DTPRELLO = 35
  7770. const m_R_ALPHA_GLOB_DAT = 25
  7771. const m_R_ALPHA_GOTDTPREL = 32
  7772. const m_R_ALPHA_GOTTPREL = 37
  7773. const m_R_ALPHA_GPDISP = 6
  7774. const m_R_ALPHA_GPREL16 = 19
  7775. const m_R_ALPHA_GPREL32 = 3
  7776. const m_R_ALPHA_GPRELHIGH = 17
  7777. const m_R_ALPHA_GPRELLOW = 18
  7778. const m_R_ALPHA_HINT = 8
  7779. const m_R_ALPHA_JMP_SLOT = 26
  7780. const m_R_ALPHA_LITERAL = 4
  7781. const m_R_ALPHA_LITUSE = 5
  7782. const m_R_ALPHA_NONE = 0
  7783. const m_R_ALPHA_NUM = 46
  7784. const m_R_ALPHA_REFLONG = 1
  7785. const m_R_ALPHA_REFQUAD = 2
  7786. const m_R_ALPHA_RELATIVE = 27
  7787. const m_R_ALPHA_SREL16 = 9
  7788. const m_R_ALPHA_SREL32 = 10
  7789. const m_R_ALPHA_SREL64 = 11
  7790. const m_R_ALPHA_TLSGD = 29
  7791. const m_R_ALPHA_TLS_GD_HI = 28
  7792. const m_R_ALPHA_TLS_LDM = 30
  7793. const m_R_ALPHA_TPREL16 = 41
  7794. const m_R_ALPHA_TPREL64 = 38
  7795. const m_R_ALPHA_TPRELHI = 39
  7796. const m_R_ALPHA_TPRELLO = 40
  7797. const m_R_ARM_ABS12 = 6
  7798. const m_R_ARM_ABS16 = 5
  7799. const m_R_ARM_ABS32 = 2
  7800. const m_R_ARM_ABS32_NOI = 55
  7801. const m_R_ARM_ABS8 = 8
  7802. const m_R_ARM_ALU_PCREL_15_8 = 33
  7803. const m_R_ARM_ALU_PCREL_23_15 = 34
  7804. const m_R_ARM_ALU_PCREL_7_0 = 32
  7805. const m_R_ARM_ALU_PC_G0 = 58
  7806. const m_R_ARM_ALU_PC_G0_NC = 57
  7807. const m_R_ARM_ALU_PC_G1 = 60
  7808. const m_R_ARM_ALU_PC_G1_NC = 59
  7809. const m_R_ARM_ALU_PC_G2 = 61
  7810. const m_R_ARM_ALU_SBREL_19_12 = 36
  7811. const m_R_ARM_ALU_SBREL_27_20 = 37
  7812. const m_R_ARM_ALU_SB_G0 = 71
  7813. const m_R_ARM_ALU_SB_G0_NC = 70
  7814. const m_R_ARM_ALU_SB_G1 = 73
  7815. const m_R_ARM_ALU_SB_G1_NC = 72
  7816. const m_R_ARM_ALU_SB_G2 = 74
  7817. const m_R_ARM_AMP_VCALL9 = 12
  7818. const m_R_ARM_BASE_ABS = 31
  7819. const m_R_ARM_CALL = 28
  7820. const m_R_ARM_COPY = 20
  7821. const m_R_ARM_GLOB_DAT = 21
  7822. const m_R_ARM_GNU_VTENTRY = 100
  7823. const m_R_ARM_GNU_VTINHERIT = 101
  7824. const m_R_ARM_GOT32 = 26
  7825. const m_R_ARM_GOTOFF = 24
  7826. const m_R_ARM_GOTOFF12 = 98
  7827. const m_R_ARM_GOTPC = 25
  7828. const m_R_ARM_GOTRELAX = 99
  7829. const m_R_ARM_GOT_ABS = 95
  7830. const m_R_ARM_GOT_BREL12 = 97
  7831. const m_R_ARM_GOT_PREL = 96
  7832. const m_R_ARM_IRELATIVE = 160
  7833. const m_R_ARM_JUMP24 = 29
  7834. const m_R_ARM_JUMP_SLOT = 22
  7835. const m_R_ARM_LDC_PC_G0 = 67
  7836. const m_R_ARM_LDC_PC_G1 = 68
  7837. const m_R_ARM_LDC_PC_G2 = 69
  7838. const m_R_ARM_LDC_SB_G0 = 81
  7839. const m_R_ARM_LDC_SB_G1 = 82
  7840. const m_R_ARM_LDC_SB_G2 = 83
  7841. const m_R_ARM_LDRS_PC_G0 = 64
  7842. const m_R_ARM_LDRS_PC_G1 = 65
  7843. const m_R_ARM_LDRS_PC_G2 = 66
  7844. const m_R_ARM_LDRS_SB_G0 = 78
  7845. const m_R_ARM_LDRS_SB_G1 = 79
  7846. const m_R_ARM_LDRS_SB_G2 = 80
  7847. const m_R_ARM_LDR_PC_G1 = 62
  7848. const m_R_ARM_LDR_PC_G2 = 63
  7849. const m_R_ARM_LDR_SBREL_11_0 = 35
  7850. const m_R_ARM_LDR_SB_G0 = 75
  7851. const m_R_ARM_LDR_SB_G1 = 76
  7852. const m_R_ARM_LDR_SB_G2 = 77
  7853. const m_R_ARM_ME_TOO = 128
  7854. const m_R_ARM_MOVT_ABS = 44
  7855. const m_R_ARM_MOVT_BREL = 85
  7856. const m_R_ARM_MOVT_PREL = 46
  7857. const m_R_ARM_MOVW_ABS_NC = 43
  7858. const m_R_ARM_MOVW_BREL = 86
  7859. const m_R_ARM_MOVW_BREL_NC = 84
  7860. const m_R_ARM_MOVW_PREL_NC = 45
  7861. const m_R_ARM_NONE = 0
  7862. const m_R_ARM_NUM = 256
  7863. const m_R_ARM_PC13 = 4
  7864. const m_R_ARM_PC24 = 1
  7865. const m_R_ARM_PLT32 = 27
  7866. const m_R_ARM_PLT32_ABS = 94
  7867. const m_R_ARM_PREL31 = 42
  7868. const m_R_ARM_RABS22 = 253
  7869. const m_R_ARM_RBASE = 255
  7870. const m_R_ARM_REL32 = 3
  7871. const m_R_ARM_REL32_NOI = 56
  7872. const m_R_ARM_RELATIVE = 23
  7873. const m_R_ARM_RPC24 = 254
  7874. const m_R_ARM_RREL32 = 252
  7875. const m_R_ARM_RSBREL32 = 250
  7876. const m_R_ARM_RXPC25 = 249
  7877. const m_R_ARM_SBREL31 = 39
  7878. const m_R_ARM_SBREL32 = 9
  7879. const m_R_ARM_TARGET1 = 38
  7880. const m_R_ARM_TARGET2 = 41
  7881. const m_R_ARM_THM_ABS5 = 7
  7882. const m_R_ARM_THM_ALU_PREL_11_0 = 53
  7883. const m_R_ARM_THM_GOT_BREL12 = 131
  7884. const m_R_ARM_THM_JUMP19 = 51
  7885. const m_R_ARM_THM_JUMP24 = 30
  7886. const m_R_ARM_THM_JUMP6 = 52
  7887. const m_R_ARM_THM_MOVT_ABS = 48
  7888. const m_R_ARM_THM_MOVT_BREL = 88
  7889. const m_R_ARM_THM_MOVT_PREL = 50
  7890. const m_R_ARM_THM_MOVW_ABS_NC = 47
  7891. const m_R_ARM_THM_MOVW_BREL = 89
  7892. const m_R_ARM_THM_MOVW_BREL_NC = 87
  7893. const m_R_ARM_THM_MOVW_PREL_NC = 49
  7894. const m_R_ARM_THM_PC11 = 102
  7895. const m_R_ARM_THM_PC12 = 54
  7896. const m_R_ARM_THM_PC22 = 10
  7897. const m_R_ARM_THM_PC8 = 11
  7898. const m_R_ARM_THM_PC9 = 103
  7899. const m_R_ARM_THM_RPC22 = 251
  7900. const m_R_ARM_THM_SWI8 = 14
  7901. const m_R_ARM_THM_TLS_CALL = 93
  7902. const m_R_ARM_THM_TLS_DESCSEQ = 129
  7903. const m_R_ARM_THM_TLS_DESCSEQ16 = 129
  7904. const m_R_ARM_THM_TLS_DESCSEQ32 = 130
  7905. const m_R_ARM_THM_XPC22 = 16
  7906. const m_R_ARM_TLS_CALL = 91
  7907. const m_R_ARM_TLS_DESC = 13
  7908. const m_R_ARM_TLS_DESCSEQ = 92
  7909. const m_R_ARM_TLS_DTPMOD32 = 17
  7910. const m_R_ARM_TLS_DTPOFF32 = 18
  7911. const m_R_ARM_TLS_GD32 = 104
  7912. const m_R_ARM_TLS_GOTDESC = 90
  7913. const m_R_ARM_TLS_IE12GP = 111
  7914. const m_R_ARM_TLS_IE32 = 107
  7915. const m_R_ARM_TLS_LDM32 = 105
  7916. const m_R_ARM_TLS_LDO12 = 109
  7917. const m_R_ARM_TLS_LDO32 = 106
  7918. const m_R_ARM_TLS_LE12 = 110
  7919. const m_R_ARM_TLS_LE32 = 108
  7920. const m_R_ARM_TLS_TPOFF32 = 19
  7921. const m_R_ARM_V4BX = 40
  7922. const m_R_ARM_XPC25 = 15
  7923. const m_R_BPF_MAP_FD = 1
  7924. const m_R_BPF_NONE = 0
  7925. const m_R_CKCORE_ADDR32 = 1
  7926. const m_R_CKCORE_ADDRGOT = 17
  7927. const m_R_CKCORE_ADDRGOT_HI16 = 36
  7928. const m_R_CKCORE_ADDRGOT_LO16 = 37
  7929. const m_R_CKCORE_ADDRPLT = 18
  7930. const m_R_CKCORE_ADDRPLT_HI16 = 38
  7931. const m_R_CKCORE_ADDRPLT_LO16 = 39
  7932. const m_R_CKCORE_ADDR_HI16 = 24
  7933. const m_R_CKCORE_ADDR_LO16 = 25
  7934. const m_R_CKCORE_COPY = 10
  7935. const m_R_CKCORE_DOFFSET_IMM18 = 44
  7936. const m_R_CKCORE_DOFFSET_IMM18BY2 = 45
  7937. const m_R_CKCORE_DOFFSET_IMM18BY4 = 46
  7938. const m_R_CKCORE_DOFFSET_LO16 = 42
  7939. const m_R_CKCORE_GLOB_DAT = 11
  7940. const m_R_CKCORE_GOT12 = 30
  7941. const m_R_CKCORE_GOT32 = 15
  7942. const m_R_CKCORE_GOTOFF = 13
  7943. const m_R_CKCORE_GOTOFF_HI16 = 28
  7944. const m_R_CKCORE_GOTOFF_LO16 = 29
  7945. const m_R_CKCORE_GOTPC = 14
  7946. const m_R_CKCORE_GOTPC_HI16 = 26
  7947. const m_R_CKCORE_GOTPC_LO16 = 27
  7948. const m_R_CKCORE_GOT_HI16 = 31
  7949. const m_R_CKCORE_GOT_IMM18BY4 = 48
  7950. const m_R_CKCORE_GOT_LO16 = 32
  7951. const m_R_CKCORE_JUMP_SLOT = 12
  7952. const m_R_CKCORE_NONE = 0
  7953. const m_R_CKCORE_PCREL32 = 5
  7954. const m_R_CKCORE_PCRELIMM11BY2 = 3
  7955. const m_R_CKCORE_PCRELIMM8BY4 = 2
  7956. const m_R_CKCORE_PCRELJSR_IMM11BY2 = 6
  7957. const m_R_CKCORE_PCREL_IMM10BY2 = 22
  7958. const m_R_CKCORE_PCREL_IMM10BY4 = 23
  7959. const m_R_CKCORE_PCREL_IMM16BY2 = 20
  7960. const m_R_CKCORE_PCREL_IMM16BY4 = 21
  7961. const m_R_CKCORE_PCREL_IMM18BY2 = 43
  7962. const m_R_CKCORE_PCREL_IMM26BY2 = 19
  7963. const m_R_CKCORE_PCREL_IMM7BY4 = 50
  7964. const m_R_CKCORE_PCREL_JSR_IMM26BY2 = 40
  7965. const m_R_CKCORE_PLT12 = 33
  7966. const m_R_CKCORE_PLT32 = 16
  7967. const m_R_CKCORE_PLT_HI16 = 34
  7968. const m_R_CKCORE_PLT_IMM18BY4 = 49
  7969. const m_R_CKCORE_PLT_LO16 = 35
  7970. const m_R_CKCORE_RELATIVE = 9
  7971. const m_R_CKCORE_TLS_DTPMOD32 = 56
  7972. const m_R_CKCORE_TLS_DTPOFF32 = 57
  7973. const m_R_CKCORE_TLS_GD32 = 53
  7974. const m_R_CKCORE_TLS_IE32 = 52
  7975. const m_R_CKCORE_TLS_LDM32 = 54
  7976. const m_R_CKCORE_TLS_LDO32 = 55
  7977. const m_R_CKCORE_TLS_LE32 = 51
  7978. const m_R_CKCORE_TLS_TPOFF32 = 58
  7979. const m_R_CKCORE_TOFFSET_LO16 = 41
  7980. const m_R_CRIS_16 = 2
  7981. const m_R_CRIS_16_GOT = 13
  7982. const m_R_CRIS_16_GOTPLT = 15
  7983. const m_R_CRIS_16_PCREL = 5
  7984. const m_R_CRIS_32 = 3
  7985. const m_R_CRIS_32_GOT = 14
  7986. const m_R_CRIS_32_GOTPLT = 16
  7987. const m_R_CRIS_32_GOTREL = 17
  7988. const m_R_CRIS_32_PCREL = 6
  7989. const m_R_CRIS_32_PLT_GOTREL = 18
  7990. const m_R_CRIS_32_PLT_PCREL = 19
  7991. const m_R_CRIS_8 = 1
  7992. const m_R_CRIS_8_PCREL = 4
  7993. const m_R_CRIS_COPY = 9
  7994. const m_R_CRIS_GLOB_DAT = 10
  7995. const m_R_CRIS_GNU_VTENTRY = 8
  7996. const m_R_CRIS_GNU_VTINHERIT = 7
  7997. const m_R_CRIS_JUMP_SLOT = 11
  7998. const m_R_CRIS_NONE = 0
  7999. const m_R_CRIS_NUM = 20
  8000. const m_R_CRIS_RELATIVE = 12
  8001. const m_R_IA64_COPY = 0x84
  8002. const m_R_IA64_DIR32LSB = 0x25
  8003. const m_R_IA64_DIR32MSB = 0x24
  8004. const m_R_IA64_DIR64LSB = 0x27
  8005. const m_R_IA64_DIR64MSB = 0x26
  8006. const m_R_IA64_DTPMOD64LSB = 0xa7
  8007. const m_R_IA64_DTPMOD64MSB = 0xa6
  8008. const m_R_IA64_DTPREL14 = 0xb1
  8009. const m_R_IA64_DTPREL22 = 0xb2
  8010. const m_R_IA64_DTPREL32LSB = 0xb5
  8011. const m_R_IA64_DTPREL32MSB = 0xb4
  8012. const m_R_IA64_DTPREL64I = 0xb3
  8013. const m_R_IA64_DTPREL64LSB = 0xb7
  8014. const m_R_IA64_DTPREL64MSB = 0xb6
  8015. const m_R_IA64_FPTR32LSB = 0x45
  8016. const m_R_IA64_FPTR32MSB = 0x44
  8017. const m_R_IA64_FPTR64I = 0x43
  8018. const m_R_IA64_FPTR64LSB = 0x47
  8019. const m_R_IA64_FPTR64MSB = 0x46
  8020. const m_R_IA64_GPREL22 = 0x2a
  8021. const m_R_IA64_GPREL32LSB = 0x2d
  8022. const m_R_IA64_GPREL32MSB = 0x2c
  8023. const m_R_IA64_GPREL64I = 0x2b
  8024. const m_R_IA64_GPREL64LSB = 0x2f
  8025. const m_R_IA64_GPREL64MSB = 0x2e
  8026. const m_R_IA64_IMM14 = 0x21
  8027. const m_R_IA64_IMM22 = 0x22
  8028. const m_R_IA64_IMM64 = 0x23
  8029. const m_R_IA64_IPLTLSB = 0x81
  8030. const m_R_IA64_IPLTMSB = 0x80
  8031. const m_R_IA64_LDXMOV = 0x87
  8032. const m_R_IA64_LTOFF22 = 0x32
  8033. const m_R_IA64_LTOFF22X = 0x86
  8034. const m_R_IA64_LTOFF64I = 0x33
  8035. const m_R_IA64_LTOFF_DTPMOD22 = 0xaa
  8036. const m_R_IA64_LTOFF_DTPREL22 = 0xba
  8037. const m_R_IA64_LTOFF_FPTR22 = 0x52
  8038. const m_R_IA64_LTOFF_FPTR32LSB = 0x55
  8039. const m_R_IA64_LTOFF_FPTR32MSB = 0x54
  8040. const m_R_IA64_LTOFF_FPTR64I = 0x53
  8041. const m_R_IA64_LTOFF_FPTR64LSB = 0x57
  8042. const m_R_IA64_LTOFF_FPTR64MSB = 0x56
  8043. const m_R_IA64_LTOFF_TPREL22 = 0x9a
  8044. const m_R_IA64_LTV32LSB = 0x75
  8045. const m_R_IA64_LTV32MSB = 0x74
  8046. const m_R_IA64_LTV64LSB = 0x77
  8047. const m_R_IA64_LTV64MSB = 0x76
  8048. const m_R_IA64_NONE = 0x00
  8049. const m_R_IA64_PCREL21B = 0x49
  8050. const m_R_IA64_PCREL21BI = 0x79
  8051. const m_R_IA64_PCREL21F = 0x4b
  8052. const m_R_IA64_PCREL21M = 0x4a
  8053. const m_R_IA64_PCREL22 = 0x7a
  8054. const m_R_IA64_PCREL32LSB = 0x4d
  8055. const m_R_IA64_PCREL32MSB = 0x4c
  8056. const m_R_IA64_PCREL60B = 0x48
  8057. const m_R_IA64_PCREL64I = 0x7b
  8058. const m_R_IA64_PCREL64LSB = 0x4f
  8059. const m_R_IA64_PCREL64MSB = 0x4e
  8060. const m_R_IA64_PLTOFF22 = 0x3a
  8061. const m_R_IA64_PLTOFF64I = 0x3b
  8062. const m_R_IA64_PLTOFF64LSB = 0x3f
  8063. const m_R_IA64_PLTOFF64MSB = 0x3e
  8064. const m_R_IA64_REL32LSB = 0x6d
  8065. const m_R_IA64_REL32MSB = 0x6c
  8066. const m_R_IA64_REL64LSB = 0x6f
  8067. const m_R_IA64_REL64MSB = 0x6e
  8068. const m_R_IA64_SECREL32LSB = 0x65
  8069. const m_R_IA64_SECREL32MSB = 0x64
  8070. const m_R_IA64_SECREL64LSB = 0x67
  8071. const m_R_IA64_SECREL64MSB = 0x66
  8072. const m_R_IA64_SEGREL32LSB = 0x5d
  8073. const m_R_IA64_SEGREL32MSB = 0x5c
  8074. const m_R_IA64_SEGREL64LSB = 0x5f
  8075. const m_R_IA64_SEGREL64MSB = 0x5e
  8076. const m_R_IA64_SUB = 0x85
  8077. const m_R_IA64_TPREL14 = 0x91
  8078. const m_R_IA64_TPREL22 = 0x92
  8079. const m_R_IA64_TPREL64I = 0x93
  8080. const m_R_IA64_TPREL64LSB = 0x97
  8081. const m_R_IA64_TPREL64MSB = 0x96
  8082. const m_R_LARCH_32 = 1
  8083. const m_R_LARCH_32_PCREL = 99
  8084. const m_R_LARCH_64 = 2
  8085. const m_R_LARCH_ABS64_HI12 = 70
  8086. const m_R_LARCH_ABS64_LO20 = 69
  8087. const m_R_LARCH_ABS_HI20 = 67
  8088. const m_R_LARCH_ABS_LO12 = 68
  8089. const m_R_LARCH_ADD16 = 48
  8090. const m_R_LARCH_ADD24 = 49
  8091. const m_R_LARCH_ADD32 = 50
  8092. const m_R_LARCH_ADD64 = 51
  8093. const m_R_LARCH_ADD8 = 47
  8094. const m_R_LARCH_B16 = 64
  8095. const m_R_LARCH_B21 = 65
  8096. const m_R_LARCH_B26 = 66
  8097. const m_R_LARCH_COPY = 4
  8098. const m_R_LARCH_GNU_VTENTRY = 58
  8099. const m_R_LARCH_GNU_VTINHERIT = 57
  8100. const m_R_LARCH_GOT64_HI12 = 82
  8101. const m_R_LARCH_GOT64_LO20 = 81
  8102. const m_R_LARCH_GOT64_PC_HI12 = 78
  8103. const m_R_LARCH_GOT64_PC_LO20 = 77
  8104. const m_R_LARCH_GOT_HI20 = 79
  8105. const m_R_LARCH_GOT_LO12 = 80
  8106. const m_R_LARCH_GOT_PC_HI20 = 75
  8107. const m_R_LARCH_GOT_PC_LO12 = 76
  8108. const m_R_LARCH_IRELATIVE = 12
  8109. const m_R_LARCH_JUMP_SLOT = 5
  8110. const m_R_LARCH_MARK_LA = 20
  8111. const m_R_LARCH_MARK_PCREL = 21
  8112. const m_R_LARCH_NONE = 0
  8113. const m_R_LARCH_PCALA64_HI12 = 74
  8114. const m_R_LARCH_PCALA64_LO20 = 73
  8115. const m_R_LARCH_PCALA_HI20 = 71
  8116. const m_R_LARCH_PCALA_LO12 = 72
  8117. const m_R_LARCH_RELATIVE = 3
  8118. const m_R_LARCH_RELAX = 100
  8119. const m_R_LARCH_SOP_ADD = 35
  8120. const m_R_LARCH_SOP_AND = 36
  8121. const m_R_LARCH_SOP_ASSERT = 30
  8122. const m_R_LARCH_SOP_IF_ELSE = 37
  8123. const m_R_LARCH_SOP_NOT = 31
  8124. const m_R_LARCH_SOP_POP_32_S_0_10_10_16_S2 = 45
  8125. const m_R_LARCH_SOP_POP_32_S_0_5_10_16_S2 = 44
  8126. const m_R_LARCH_SOP_POP_32_S_10_12 = 40
  8127. const m_R_LARCH_SOP_POP_32_S_10_16 = 41
  8128. const m_R_LARCH_SOP_POP_32_S_10_16_S2 = 42
  8129. const m_R_LARCH_SOP_POP_32_S_10_5 = 38
  8130. const m_R_LARCH_SOP_POP_32_S_5_20 = 43
  8131. const m_R_LARCH_SOP_POP_32_U = 46
  8132. const m_R_LARCH_SOP_POP_32_U_10_12 = 39
  8133. const m_R_LARCH_SOP_PUSH_ABSOLUTE = 23
  8134. const m_R_LARCH_SOP_PUSH_DUP = 24
  8135. const m_R_LARCH_SOP_PUSH_GPREL = 25
  8136. const m_R_LARCH_SOP_PUSH_PCREL = 22
  8137. const m_R_LARCH_SOP_PUSH_PLT_PCREL = 29
  8138. const m_R_LARCH_SOP_PUSH_TLS_GD = 28
  8139. const m_R_LARCH_SOP_PUSH_TLS_GOT = 27
  8140. const m_R_LARCH_SOP_PUSH_TLS_TPREL = 26
  8141. const m_R_LARCH_SOP_SL = 33
  8142. const m_R_LARCH_SOP_SR = 34
  8143. const m_R_LARCH_SOP_SUB = 32
  8144. const m_R_LARCH_SUB16 = 53
  8145. const m_R_LARCH_SUB24 = 54
  8146. const m_R_LARCH_SUB32 = 55
  8147. const m_R_LARCH_SUB64 = 56
  8148. const m_R_LARCH_SUB8 = 52
  8149. const m_R_LARCH_TLS_DTPMOD32 = 6
  8150. const m_R_LARCH_TLS_DTPMOD64 = 7
  8151. const m_R_LARCH_TLS_DTPREL32 = 8
  8152. const m_R_LARCH_TLS_DTPREL64 = 9
  8153. const m_R_LARCH_TLS_GD_HI20 = 98
  8154. const m_R_LARCH_TLS_GD_PC_HI20 = 97
  8155. const m_R_LARCH_TLS_IE64_HI12 = 94
  8156. const m_R_LARCH_TLS_IE64_LO20 = 93
  8157. const m_R_LARCH_TLS_IE64_PC_HI12 = 90
  8158. const m_R_LARCH_TLS_IE64_PC_LO20 = 89
  8159. const m_R_LARCH_TLS_IE_HI20 = 91
  8160. const m_R_LARCH_TLS_IE_LO12 = 92
  8161. const m_R_LARCH_TLS_IE_PC_HI20 = 87
  8162. const m_R_LARCH_TLS_IE_PC_LO12 = 88
  8163. const m_R_LARCH_TLS_LD_HI20 = 96
  8164. const m_R_LARCH_TLS_LD_PC_HI20 = 95
  8165. const m_R_LARCH_TLS_LE64_HI12 = 86
  8166. const m_R_LARCH_TLS_LE64_LO20 = 85
  8167. const m_R_LARCH_TLS_LE_HI20 = 83
  8168. const m_R_LARCH_TLS_LE_LO12 = 84
  8169. const m_R_LARCH_TLS_TPREL32 = 10
  8170. const m_R_LARCH_TLS_TPREL64 = 11
  8171. const m_R_M32R_10_PCREL = 4
  8172. const m_R_M32R_10_PCREL_RELA = 36
  8173. const m_R_M32R_16 = 1
  8174. const m_R_M32R_16_RELA = 33
  8175. const m_R_M32R_18_PCREL = 5
  8176. const m_R_M32R_18_PCREL_RELA = 37
  8177. const m_R_M32R_24 = 3
  8178. const m_R_M32R_24_RELA = 35
  8179. const m_R_M32R_26_PCREL = 6
  8180. const m_R_M32R_26_PCREL_RELA = 38
  8181. const m_R_M32R_26_PLTREL = 49
  8182. const m_R_M32R_32 = 2
  8183. const m_R_M32R_32_RELA = 34
  8184. const m_R_M32R_COPY = 50
  8185. const m_R_M32R_GLOB_DAT = 51
  8186. const m_R_M32R_GNU_VTENTRY = 12
  8187. const m_R_M32R_GNU_VTINHERIT = 11
  8188. const m_R_M32R_GOT16_HI_SLO = 57
  8189. const m_R_M32R_GOT16_HI_ULO = 56
  8190. const m_R_M32R_GOT16_LO = 58
  8191. const m_R_M32R_GOT24 = 48
  8192. const m_R_M32R_GOTOFF = 54
  8193. const m_R_M32R_GOTOFF_HI_SLO = 63
  8194. const m_R_M32R_GOTOFF_HI_ULO = 62
  8195. const m_R_M32R_GOTOFF_LO = 64
  8196. const m_R_M32R_GOTPC24 = 55
  8197. const m_R_M32R_GOTPC_HI_SLO = 60
  8198. const m_R_M32R_GOTPC_HI_ULO = 59
  8199. const m_R_M32R_GOTPC_LO = 61
  8200. const m_R_M32R_HI16_SLO = 8
  8201. const m_R_M32R_HI16_SLO_RELA = 40
  8202. const m_R_M32R_HI16_ULO = 7
  8203. const m_R_M32R_HI16_ULO_RELA = 39
  8204. const m_R_M32R_JMP_SLOT = 52
  8205. const m_R_M32R_LO16 = 9
  8206. const m_R_M32R_LO16_RELA = 41
  8207. const m_R_M32R_NONE = 0
  8208. const m_R_M32R_NUM = 256
  8209. const m_R_M32R_REL32 = 45
  8210. const m_R_M32R_RELATIVE = 53
  8211. const m_R_M32R_RELA_GNU_VTENTRY = 44
  8212. const m_R_M32R_RELA_GNU_VTINHERIT = 43
  8213. const m_R_M32R_SDA16 = 10
  8214. const m_R_M32R_SDA16_RELA = 42
  8215. const m_R_MICROBLAZE_32 = 1
  8216. const m_R_MICROBLAZE_32_LO = 6
  8217. const m_R_MICROBLAZE_32_PCREL = 2
  8218. const m_R_MICROBLAZE_32_PCREL_LO = 4
  8219. const m_R_MICROBLAZE_32_SYM_OP_SYM = 10
  8220. const m_R_MICROBLAZE_64 = 5
  8221. const m_R_MICROBLAZE_64_NONE = 9
  8222. const m_R_MICROBLAZE_64_PCREL = 3
  8223. const m_R_MICROBLAZE_COPY = 21
  8224. const m_R_MICROBLAZE_GLOB_DAT = 18
  8225. const m_R_MICROBLAZE_GNU_VTENTRY = 12
  8226. const m_R_MICROBLAZE_GNU_VTINHERIT = 11
  8227. const m_R_MICROBLAZE_GOTOFF_32 = 20
  8228. const m_R_MICROBLAZE_GOTOFF_64 = 19
  8229. const m_R_MICROBLAZE_GOTPC_64 = 13
  8230. const m_R_MICROBLAZE_GOT_64 = 14
  8231. const m_R_MICROBLAZE_JUMP_SLOT = 17
  8232. const m_R_MICROBLAZE_NONE = 0
  8233. const m_R_MICROBLAZE_PLT_64 = 15
  8234. const m_R_MICROBLAZE_REL = 16
  8235. const m_R_MICROBLAZE_SRO32 = 7
  8236. const m_R_MICROBLAZE_SRW32 = 8
  8237. const m_R_MICROBLAZE_TLS = 22
  8238. const m_R_MICROBLAZE_TLSDTPMOD32 = 25
  8239. const m_R_MICROBLAZE_TLSDTPREL32 = 26
  8240. const m_R_MICROBLAZE_TLSDTPREL64 = 27
  8241. const m_R_MICROBLAZE_TLSGD = 23
  8242. const m_R_MICROBLAZE_TLSGOTTPREL32 = 28
  8243. const m_R_MICROBLAZE_TLSLD = 24
  8244. const m_R_MICROBLAZE_TLSTPREL32 = 29
  8245. const m_R_MIPS_16 = 1
  8246. const m_R_MIPS_26 = 4
  8247. const m_R_MIPS_32 = 2
  8248. const m_R_MIPS_64 = 18
  8249. const m_R_MIPS_ADD_IMMEDIATE = 34
  8250. const m_R_MIPS_CALL16 = 11
  8251. const m_R_MIPS_CALL_HI16 = 30
  8252. const m_R_MIPS_CALL_LO16 = 31
  8253. const m_R_MIPS_COPY = 126
  8254. const m_R_MIPS_DELETE = 27
  8255. const m_R_MIPS_GLOB_DAT = 51
  8256. const m_R_MIPS_GOT16 = 9
  8257. const m_R_MIPS_GOT_DISP = 19
  8258. const m_R_MIPS_GOT_HI16 = 22
  8259. const m_R_MIPS_GOT_LO16 = 23
  8260. const m_R_MIPS_GOT_OFST = 21
  8261. const m_R_MIPS_GOT_PAGE = 20
  8262. const m_R_MIPS_GPREL16 = 7
  8263. const m_R_MIPS_GPREL32 = 12
  8264. const m_R_MIPS_HI16 = 5
  8265. const m_R_MIPS_HIGHER = 28
  8266. const m_R_MIPS_HIGHEST = 29
  8267. const m_R_MIPS_INSERT_A = 25
  8268. const m_R_MIPS_INSERT_B = 26
  8269. const m_R_MIPS_JALR = 37
  8270. const m_R_MIPS_JUMP_SLOT = 127
  8271. const m_R_MIPS_LITERAL = 8
  8272. const m_R_MIPS_LO16 = 6
  8273. const m_R_MIPS_NONE = 0
  8274. const m_R_MIPS_NUM = 128
  8275. const m_R_MIPS_PC16 = 10
  8276. const m_R_MIPS_PJUMP = 35
  8277. const m_R_MIPS_REL16 = 33
  8278. const m_R_MIPS_REL32 = 3
  8279. const m_R_MIPS_RELGOT = 36
  8280. const m_R_MIPS_SCN_DISP = 32
  8281. const m_R_MIPS_SHIFT5 = 16
  8282. const m_R_MIPS_SHIFT6 = 17
  8283. const m_R_MIPS_SUB = 24
  8284. const m_R_MIPS_TLS_DTPMOD32 = 38
  8285. const m_R_MIPS_TLS_DTPMOD64 = 40
  8286. const m_R_MIPS_TLS_DTPREL32 = 39
  8287. const m_R_MIPS_TLS_DTPREL64 = 41
  8288. const m_R_MIPS_TLS_DTPREL_HI16 = 44
  8289. const m_R_MIPS_TLS_DTPREL_LO16 = 45
  8290. const m_R_MIPS_TLS_GD = 42
  8291. const m_R_MIPS_TLS_GOTTPREL = 46
  8292. const m_R_MIPS_TLS_LDM = 43
  8293. const m_R_MIPS_TLS_TPREL32 = 47
  8294. const m_R_MIPS_TLS_TPREL64 = 48
  8295. const m_R_MIPS_TLS_TPREL_HI16 = 49
  8296. const m_R_MIPS_TLS_TPREL_LO16 = 50
  8297. const m_R_MN10300_16 = 2
  8298. const m_R_MN10300_24 = 9
  8299. const m_R_MN10300_32 = 1
  8300. const m_R_MN10300_8 = 3
  8301. const m_R_MN10300_COPY = 20
  8302. const m_R_MN10300_GLOB_DAT = 21
  8303. const m_R_MN10300_GNU_VTENTRY = 8
  8304. const m_R_MN10300_GNU_VTINHERIT = 7
  8305. const m_R_MN10300_GOT16 = 19
  8306. const m_R_MN10300_GOT24 = 18
  8307. const m_R_MN10300_GOT32 = 17
  8308. const m_R_MN10300_GOTOFF16 = 14
  8309. const m_R_MN10300_GOTOFF24 = 13
  8310. const m_R_MN10300_GOTOFF32 = 12
  8311. const m_R_MN10300_GOTPC16 = 11
  8312. const m_R_MN10300_GOTPC32 = 10
  8313. const m_R_MN10300_JMP_SLOT = 22
  8314. const m_R_MN10300_NONE = 0
  8315. const m_R_MN10300_NUM = 24
  8316. const m_R_MN10300_PCREL16 = 5
  8317. const m_R_MN10300_PCREL32 = 4
  8318. const m_R_MN10300_PCREL8 = 6
  8319. const m_R_MN10300_PLT16 = 16
  8320. const m_R_MN10300_PLT32 = 15
  8321. const m_R_MN10300_RELATIVE = 23
  8322. const m_R_NIOS2_ALIGN = 21
  8323. const m_R_NIOS2_BFD_RELOC_16 = 13
  8324. const m_R_NIOS2_BFD_RELOC_32 = 12
  8325. const m_R_NIOS2_BFD_RELOC_8 = 14
  8326. const m_R_NIOS2_CACHE_OPX = 6
  8327. const m_R_NIOS2_CALL16 = 23
  8328. const m_R_NIOS2_CALL26 = 4
  8329. const m_R_NIOS2_CALL26_NOAT = 41
  8330. const m_R_NIOS2_CALLR = 20
  8331. const m_R_NIOS2_CALL_HA = 45
  8332. const m_R_NIOS2_CALL_LO = 44
  8333. const m_R_NIOS2_CJMP = 19
  8334. const m_R_NIOS2_COPY = 36
  8335. const m_R_NIOS2_GLOB_DAT = 37
  8336. const m_R_NIOS2_GNU_VTENTRY = 17
  8337. const m_R_NIOS2_GNU_VTINHERIT = 16
  8338. const m_R_NIOS2_GOT16 = 22
  8339. const m_R_NIOS2_GOTOFF = 40
  8340. const m_R_NIOS2_GOTOFF_HA = 25
  8341. const m_R_NIOS2_GOTOFF_LO = 24
  8342. const m_R_NIOS2_GOT_HA = 43
  8343. const m_R_NIOS2_GOT_LO = 42
  8344. const m_R_NIOS2_GPREL = 15
  8345. const m_R_NIOS2_HI16 = 9
  8346. const m_R_NIOS2_HIADJ16 = 11
  8347. const m_R_NIOS2_IMM5 = 5
  8348. const m_R_NIOS2_IMM6 = 7
  8349. const m_R_NIOS2_IMM8 = 8
  8350. const m_R_NIOS2_JUMP_SLOT = 38
  8351. const m_R_NIOS2_LO16 = 10
  8352. const m_R_NIOS2_NONE = 0
  8353. const m_R_NIOS2_PCREL16 = 3
  8354. const m_R_NIOS2_PCREL_HA = 27
  8355. const m_R_NIOS2_PCREL_LO = 26
  8356. const m_R_NIOS2_RELATIVE = 39
  8357. const m_R_NIOS2_S16 = 1
  8358. const m_R_NIOS2_TLS_DTPMOD = 33
  8359. const m_R_NIOS2_TLS_DTPREL = 34
  8360. const m_R_NIOS2_TLS_GD16 = 28
  8361. const m_R_NIOS2_TLS_IE16 = 31
  8362. const m_R_NIOS2_TLS_LDM16 = 29
  8363. const m_R_NIOS2_TLS_LDO16 = 30
  8364. const m_R_NIOS2_TLS_LE16 = 32
  8365. const m_R_NIOS2_TLS_TPREL = 35
  8366. const m_R_NIOS2_U16 = 2
  8367. const m_R_NIOS2_UJMP = 18
  8368. const m_R_OR1K_16 = 2
  8369. const m_R_OR1K_16_PCREL = 10
  8370. const m_R_OR1K_32 = 1
  8371. const m_R_OR1K_32_PCREL = 9
  8372. const m_R_OR1K_8 = 3
  8373. const m_R_OR1K_8_PCREL = 11
  8374. const m_R_OR1K_COPY = 18
  8375. const m_R_OR1K_GLOB_DAT = 19
  8376. const m_R_OR1K_GNU_VTENTRY = 7
  8377. const m_R_OR1K_GNU_VTINHERIT = 8
  8378. const m_R_OR1K_GOT16 = 14
  8379. const m_R_OR1K_GOTOFF_HI16 = 16
  8380. const m_R_OR1K_GOTOFF_LO16 = 17
  8381. const m_R_OR1K_GOTPC_HI16 = 12
  8382. const m_R_OR1K_GOTPC_LO16 = 13
  8383. const m_R_OR1K_HI_16_IN_INSN = 5
  8384. const m_R_OR1K_INSN_REL_26 = 6
  8385. const m_R_OR1K_JMP_SLOT = 20
  8386. const m_R_OR1K_LO_16_IN_INSN = 4
  8387. const m_R_OR1K_NONE = 0
  8388. const m_R_OR1K_PLT26 = 15
  8389. const m_R_OR1K_RELATIVE = 21
  8390. const m_R_OR1K_TLS_DTPMOD = 34
  8391. const m_R_OR1K_TLS_DTPOFF = 33
  8392. const m_R_OR1K_TLS_GD_HI16 = 22
  8393. const m_R_OR1K_TLS_GD_LO16 = 23
  8394. const m_R_OR1K_TLS_IE_HI16 = 28
  8395. const m_R_OR1K_TLS_IE_LO16 = 29
  8396. const m_R_OR1K_TLS_LDM_HI16 = 24
  8397. const m_R_OR1K_TLS_LDM_LO16 = 25
  8398. const m_R_OR1K_TLS_LDO_HI16 = 26
  8399. const m_R_OR1K_TLS_LDO_LO16 = 27
  8400. const m_R_OR1K_TLS_LE_HI16 = 30
  8401. const m_R_OR1K_TLS_LE_LO16 = 31
  8402. const m_R_OR1K_TLS_TPOFF = 32
  8403. const m_R_PARISC_COPY = 128
  8404. const m_R_PARISC_DIR14DR = 84
  8405. const m_R_PARISC_DIR14R = 6
  8406. const m_R_PARISC_DIR14WR = 83
  8407. const m_R_PARISC_DIR16DF = 87
  8408. const m_R_PARISC_DIR16F = 85
  8409. const m_R_PARISC_DIR16WF = 86
  8410. const m_R_PARISC_DIR17F = 4
  8411. const m_R_PARISC_DIR17R = 3
  8412. const m_R_PARISC_DIR21L = 2
  8413. const m_R_PARISC_DIR32 = 1
  8414. const m_R_PARISC_DIR64 = 80
  8415. const m_R_PARISC_DPREL14R = 22
  8416. const m_R_PARISC_DPREL21L = 18
  8417. const m_R_PARISC_EPLT = 130
  8418. const m_R_PARISC_FPTR64 = 64
  8419. const m_R_PARISC_GNU_VTENTRY = 232
  8420. const m_R_PARISC_GNU_VTINHERIT = 233
  8421. const m_R_PARISC_GPREL14DR = 92
  8422. const m_R_PARISC_GPREL14R = 30
  8423. const m_R_PARISC_GPREL14WR = 91
  8424. const m_R_PARISC_GPREL16DF = 95
  8425. const m_R_PARISC_GPREL16F = 93
  8426. const m_R_PARISC_GPREL16WF = 94
  8427. const m_R_PARISC_GPREL21L = 26
  8428. const m_R_PARISC_GPREL64 = 88
  8429. const m_R_PARISC_HIRESERVE = 255
  8430. const m_R_PARISC_IPLT = 129
  8431. const m_R_PARISC_LORESERVE = 128
  8432. const m_R_PARISC_LTOFF14DR = 100
  8433. const m_R_PARISC_LTOFF14R = 38
  8434. const m_R_PARISC_LTOFF14WR = 99
  8435. const m_R_PARISC_LTOFF16DF = 103
  8436. const m_R_PARISC_LTOFF16F = 101
  8437. const m_R_PARISC_LTOFF16WF = 102
  8438. const m_R_PARISC_LTOFF21L = 34
  8439. const m_R_PARISC_LTOFF64 = 96
  8440. const m_R_PARISC_LTOFF_FPTR14DR = 124
  8441. const m_R_PARISC_LTOFF_FPTR14R = 62
  8442. const m_R_PARISC_LTOFF_FPTR14WR = 123
  8443. const m_R_PARISC_LTOFF_FPTR16DF = 127
  8444. const m_R_PARISC_LTOFF_FPTR16F = 125
  8445. const m_R_PARISC_LTOFF_FPTR16WF = 126
  8446. const m_R_PARISC_LTOFF_FPTR21L = 58
  8447. const m_R_PARISC_LTOFF_FPTR32 = 57
  8448. const m_R_PARISC_LTOFF_FPTR64 = 120
  8449. const m_R_PARISC_LTOFF_TP14DR = 228
  8450. const m_R_PARISC_LTOFF_TP14F = 167
  8451. const m_R_PARISC_LTOFF_TP14R = 166
  8452. const m_R_PARISC_LTOFF_TP14WR = 227
  8453. const m_R_PARISC_LTOFF_TP16DF = 231
  8454. const m_R_PARISC_LTOFF_TP16F = 229
  8455. const m_R_PARISC_LTOFF_TP16WF = 230
  8456. const m_R_PARISC_LTOFF_TP21L = 162
  8457. const m_R_PARISC_LTOFF_TP64 = 224
  8458. const m_R_PARISC_NONE = 0
  8459. const m_R_PARISC_PCREL14DR = 76
  8460. const m_R_PARISC_PCREL14R = 14
  8461. const m_R_PARISC_PCREL14WR = 75
  8462. const m_R_PARISC_PCREL16DF = 79
  8463. const m_R_PARISC_PCREL16F = 77
  8464. const m_R_PARISC_PCREL16WF = 78
  8465. const m_R_PARISC_PCREL17F = 12
  8466. const m_R_PARISC_PCREL17R = 11
  8467. const m_R_PARISC_PCREL21L = 10
  8468. const m_R_PARISC_PCREL22F = 74
  8469. const m_R_PARISC_PCREL32 = 9
  8470. const m_R_PARISC_PCREL64 = 72
  8471. const m_R_PARISC_PLABEL14R = 70
  8472. const m_R_PARISC_PLABEL21L = 66
  8473. const m_R_PARISC_PLABEL32 = 65
  8474. const m_R_PARISC_PLTOFF14DR = 116
  8475. const m_R_PARISC_PLTOFF14R = 54
  8476. const m_R_PARISC_PLTOFF14WR = 115
  8477. const m_R_PARISC_PLTOFF16DF = 119
  8478. const m_R_PARISC_PLTOFF16F = 117
  8479. const m_R_PARISC_PLTOFF16WF = 118
  8480. const m_R_PARISC_PLTOFF21L = 50
  8481. const m_R_PARISC_SECREL32 = 41
  8482. const m_R_PARISC_SECREL64 = 104
  8483. const m_R_PARISC_SEGBASE = 48
  8484. const m_R_PARISC_SEGREL32 = 49
  8485. const m_R_PARISC_SEGREL64 = 112
  8486. const m_R_PARISC_TLS_DTPMOD32 = 242
  8487. const m_R_PARISC_TLS_DTPMOD64 = 243
  8488. const m_R_PARISC_TLS_DTPOFF32 = 244
  8489. const m_R_PARISC_TLS_DTPOFF64 = 245
  8490. const m_R_PARISC_TLS_GD14R = 235
  8491. const m_R_PARISC_TLS_GD21L = 234
  8492. const m_R_PARISC_TLS_GDCALL = 236
  8493. const m_R_PARISC_TLS_IE14R = "R_PARISC_LTOFF_TP14R"
  8494. const m_R_PARISC_TLS_IE21L = "R_PARISC_LTOFF_TP21L"
  8495. const m_R_PARISC_TLS_LDM14R = 238
  8496. const m_R_PARISC_TLS_LDM21L = 237
  8497. const m_R_PARISC_TLS_LDMCALL = 239
  8498. const m_R_PARISC_TLS_LDO14R = 241
  8499. const m_R_PARISC_TLS_LDO21L = 240
  8500. const m_R_PARISC_TLS_LE14R = "R_PARISC_TPREL14R"
  8501. const m_R_PARISC_TLS_LE21L = "R_PARISC_TPREL21L"
  8502. const m_R_PARISC_TLS_TPREL32 = "R_PARISC_TPREL32"
  8503. const m_R_PARISC_TLS_TPREL64 = "R_PARISC_TPREL64"
  8504. const m_R_PARISC_TPREL14DR = 220
  8505. const m_R_PARISC_TPREL14R = 158
  8506. const m_R_PARISC_TPREL14WR = 219
  8507. const m_R_PARISC_TPREL16DF = 223
  8508. const m_R_PARISC_TPREL16F = 221
  8509. const m_R_PARISC_TPREL16WF = 222
  8510. const m_R_PARISC_TPREL21L = 154
  8511. const m_R_PARISC_TPREL32 = 153
  8512. const m_R_PARISC_TPREL64 = 216
  8513. const m_R_PPC64_ADDR14 = "R_PPC_ADDR14"
  8514. const m_R_PPC64_ADDR14_BRNTAKEN = "R_PPC_ADDR14_BRNTAKEN"
  8515. const m_R_PPC64_ADDR14_BRTAKEN = "R_PPC_ADDR14_BRTAKEN"
  8516. const m_R_PPC64_ADDR16 = "R_PPC_ADDR16"
  8517. const m_R_PPC64_ADDR16_DS = 56
  8518. const m_R_PPC64_ADDR16_HA = "R_PPC_ADDR16_HA"
  8519. const m_R_PPC64_ADDR16_HI = "R_PPC_ADDR16_HI"
  8520. const m_R_PPC64_ADDR16_HIGH = 110
  8521. const m_R_PPC64_ADDR16_HIGHA = 111
  8522. const m_R_PPC64_ADDR16_HIGHER = 39
  8523. const m_R_PPC64_ADDR16_HIGHERA = 40
  8524. const m_R_PPC64_ADDR16_HIGHEST = 41
  8525. const m_R_PPC64_ADDR16_HIGHESTA = 42
  8526. const m_R_PPC64_ADDR16_LO = "R_PPC_ADDR16_LO"
  8527. const m_R_PPC64_ADDR16_LO_DS = 57
  8528. const m_R_PPC64_ADDR24 = "R_PPC_ADDR24"
  8529. const m_R_PPC64_ADDR30 = 37
  8530. const m_R_PPC64_ADDR32 = "R_PPC_ADDR32"
  8531. const m_R_PPC64_ADDR64 = 38
  8532. const m_R_PPC64_COPY = "R_PPC_COPY"
  8533. const m_R_PPC64_DTPMOD64 = 68
  8534. const m_R_PPC64_DTPREL16 = 74
  8535. const m_R_PPC64_DTPREL16_DS = 101
  8536. const m_R_PPC64_DTPREL16_HA = 77
  8537. const m_R_PPC64_DTPREL16_HI = 76
  8538. const m_R_PPC64_DTPREL16_HIGH = 114
  8539. const m_R_PPC64_DTPREL16_HIGHA = 115
  8540. const m_R_PPC64_DTPREL16_HIGHER = 103
  8541. const m_R_PPC64_DTPREL16_HIGHERA = 104
  8542. const m_R_PPC64_DTPREL16_HIGHEST = 105
  8543. const m_R_PPC64_DTPREL16_HIGHESTA = 106
  8544. const m_R_PPC64_DTPREL16_LO = 75
  8545. const m_R_PPC64_DTPREL16_LO_DS = 102
  8546. const m_R_PPC64_DTPREL64 = 78
  8547. const m_R_PPC64_GLOB_DAT = "R_PPC_GLOB_DAT"
  8548. const m_R_PPC64_GOT16 = "R_PPC_GOT16"
  8549. const m_R_PPC64_GOT16_DS = 58
  8550. const m_R_PPC64_GOT16_HA = "R_PPC_GOT16_HA"
  8551. const m_R_PPC64_GOT16_HI = "R_PPC_GOT16_HI"
  8552. const m_R_PPC64_GOT16_LO = "R_PPC_GOT16_LO"
  8553. const m_R_PPC64_GOT16_LO_DS = 59
  8554. const m_R_PPC64_GOT_DTPREL16_DS = 91
  8555. const m_R_PPC64_GOT_DTPREL16_HA = 94
  8556. const m_R_PPC64_GOT_DTPREL16_HI = 93
  8557. const m_R_PPC64_GOT_DTPREL16_LO_DS = 92
  8558. const m_R_PPC64_GOT_TLSGD16 = 79
  8559. const m_R_PPC64_GOT_TLSGD16_HA = 82
  8560. const m_R_PPC64_GOT_TLSGD16_HI = 81
  8561. const m_R_PPC64_GOT_TLSGD16_LO = 80
  8562. const m_R_PPC64_GOT_TLSLD16 = 83
  8563. const m_R_PPC64_GOT_TLSLD16_HA = 86
  8564. const m_R_PPC64_GOT_TLSLD16_HI = 85
  8565. const m_R_PPC64_GOT_TLSLD16_LO = 84
  8566. const m_R_PPC64_GOT_TPREL16_DS = 87
  8567. const m_R_PPC64_GOT_TPREL16_HA = 90
  8568. const m_R_PPC64_GOT_TPREL16_HI = 89
  8569. const m_R_PPC64_GOT_TPREL16_LO_DS = 88
  8570. const m_R_PPC64_IRELATIVE = 248
  8571. const m_R_PPC64_JMP_IREL = 247
  8572. const m_R_PPC64_JMP_SLOT = "R_PPC_JMP_SLOT"
  8573. const m_R_PPC64_NONE = "R_PPC_NONE"
  8574. const m_R_PPC64_PLT16_HA = "R_PPC_PLT16_HA"
  8575. const m_R_PPC64_PLT16_HI = "R_PPC_PLT16_HI"
  8576. const m_R_PPC64_PLT16_LO = "R_PPC_PLT16_LO"
  8577. const m_R_PPC64_PLT16_LO_DS = 60
  8578. const m_R_PPC64_PLT32 = "R_PPC_PLT32"
  8579. const m_R_PPC64_PLT64 = 45
  8580. const m_R_PPC64_PLTGOT16 = 52
  8581. const m_R_PPC64_PLTGOT16_DS = 65
  8582. const m_R_PPC64_PLTGOT16_HA = 55
  8583. const m_R_PPC64_PLTGOT16_HI = 54
  8584. const m_R_PPC64_PLTGOT16_LO = 53
  8585. const m_R_PPC64_PLTGOT16_LO_DS = 66
  8586. const m_R_PPC64_PLTREL32 = "R_PPC_PLTREL32"
  8587. const m_R_PPC64_PLTREL64 = 46
  8588. const m_R_PPC64_REL14 = "R_PPC_REL14"
  8589. const m_R_PPC64_REL14_BRNTAKEN = "R_PPC_REL14_BRNTAKEN"
  8590. const m_R_PPC64_REL14_BRTAKEN = "R_PPC_REL14_BRTAKEN"
  8591. const m_R_PPC64_REL16 = 249
  8592. const m_R_PPC64_REL16_HA = 252
  8593. const m_R_PPC64_REL16_HI = 251
  8594. const m_R_PPC64_REL16_LO = 250
  8595. const m_R_PPC64_REL24 = "R_PPC_REL24"
  8596. const m_R_PPC64_REL32 = "R_PPC_REL32"
  8597. const m_R_PPC64_REL64 = 44
  8598. const m_R_PPC64_RELATIVE = "R_PPC_RELATIVE"
  8599. const m_R_PPC64_SECTOFF = "R_PPC_SECTOFF"
  8600. const m_R_PPC64_SECTOFF_DS = 61
  8601. const m_R_PPC64_SECTOFF_HA = "R_PPC_SECTOFF_HA"
  8602. const m_R_PPC64_SECTOFF_HI = "R_PPC_SECTOFF_HI"
  8603. const m_R_PPC64_SECTOFF_LO = "R_PPC_SECTOFF_LO"
  8604. const m_R_PPC64_SECTOFF_LO_DS = 62
  8605. const m_R_PPC64_TLS = 67
  8606. const m_R_PPC64_TLSGD = 107
  8607. const m_R_PPC64_TLSLD = 108
  8608. const m_R_PPC64_TOC = 51
  8609. const m_R_PPC64_TOC16 = 47
  8610. const m_R_PPC64_TOC16_DS = 63
  8611. const m_R_PPC64_TOC16_HA = 50
  8612. const m_R_PPC64_TOC16_HI = 49
  8613. const m_R_PPC64_TOC16_LO = 48
  8614. const m_R_PPC64_TOC16_LO_DS = 64
  8615. const m_R_PPC64_TOCSAVE = 109
  8616. const m_R_PPC64_TPREL16 = 69
  8617. const m_R_PPC64_TPREL16_DS = 95
  8618. const m_R_PPC64_TPREL16_HA = 72
  8619. const m_R_PPC64_TPREL16_HI = 71
  8620. const m_R_PPC64_TPREL16_HIGH = 112
  8621. const m_R_PPC64_TPREL16_HIGHA = 113
  8622. const m_R_PPC64_TPREL16_HIGHER = 97
  8623. const m_R_PPC64_TPREL16_HIGHERA = 98
  8624. const m_R_PPC64_TPREL16_HIGHEST = 99
  8625. const m_R_PPC64_TPREL16_HIGHESTA = 100
  8626. const m_R_PPC64_TPREL16_LO = 70
  8627. const m_R_PPC64_TPREL16_LO_DS = 96
  8628. const m_R_PPC64_TPREL64 = 73
  8629. const m_R_PPC64_UADDR16 = "R_PPC_UADDR16"
  8630. const m_R_PPC64_UADDR32 = "R_PPC_UADDR32"
  8631. const m_R_PPC64_UADDR64 = 43
  8632. const m_R_PPC_ADDR14 = 7
  8633. const m_R_PPC_ADDR14_BRNTAKEN = 9
  8634. const m_R_PPC_ADDR14_BRTAKEN = 8
  8635. const m_R_PPC_ADDR16 = 3
  8636. const m_R_PPC_ADDR16_HA = 6
  8637. const m_R_PPC_ADDR16_HI = 5
  8638. const m_R_PPC_ADDR16_LO = 4
  8639. const m_R_PPC_ADDR24 = 2
  8640. const m_R_PPC_ADDR32 = 1
  8641. const m_R_PPC_COPY = 19
  8642. const m_R_PPC_DIAB_RELSDA_HA = 185
  8643. const m_R_PPC_DIAB_RELSDA_HI = 184
  8644. const m_R_PPC_DIAB_RELSDA_LO = 183
  8645. const m_R_PPC_DIAB_SDA21_HA = 182
  8646. const m_R_PPC_DIAB_SDA21_HI = 181
  8647. const m_R_PPC_DIAB_SDA21_LO = 180
  8648. const m_R_PPC_DTPMOD32 = 68
  8649. const m_R_PPC_DTPREL16 = 74
  8650. const m_R_PPC_DTPREL16_HA = 77
  8651. const m_R_PPC_DTPREL16_HI = 76
  8652. const m_R_PPC_DTPREL16_LO = 75
  8653. const m_R_PPC_DTPREL32 = 78
  8654. const m_R_PPC_EMB_BIT_FLD = 115
  8655. const m_R_PPC_EMB_MRKREF = 110
  8656. const m_R_PPC_EMB_NADDR16 = 102
  8657. const m_R_PPC_EMB_NADDR16_HA = 105
  8658. const m_R_PPC_EMB_NADDR16_HI = 104
  8659. const m_R_PPC_EMB_NADDR16_LO = 103
  8660. const m_R_PPC_EMB_NADDR32 = 101
  8661. const m_R_PPC_EMB_RELSDA = 116
  8662. const m_R_PPC_EMB_RELSEC16 = 111
  8663. const m_R_PPC_EMB_RELST_HA = 114
  8664. const m_R_PPC_EMB_RELST_HI = 113
  8665. const m_R_PPC_EMB_RELST_LO = 112
  8666. const m_R_PPC_EMB_SDA21 = 109
  8667. const m_R_PPC_EMB_SDA2I16 = 107
  8668. const m_R_PPC_EMB_SDA2REL = 108
  8669. const m_R_PPC_EMB_SDAI16 = 106
  8670. const m_R_PPC_GLOB_DAT = 20
  8671. const m_R_PPC_GOT16 = 14
  8672. const m_R_PPC_GOT16_HA = 17
  8673. const m_R_PPC_GOT16_HI = 16
  8674. const m_R_PPC_GOT16_LO = 15
  8675. const m_R_PPC_GOT_DTPREL16 = 91
  8676. const m_R_PPC_GOT_DTPREL16_HA = 94
  8677. const m_R_PPC_GOT_DTPREL16_HI = 93
  8678. const m_R_PPC_GOT_DTPREL16_LO = 92
  8679. const m_R_PPC_GOT_TLSGD16 = 79
  8680. const m_R_PPC_GOT_TLSGD16_HA = 82
  8681. const m_R_PPC_GOT_TLSGD16_HI = 81
  8682. const m_R_PPC_GOT_TLSGD16_LO = 80
  8683. const m_R_PPC_GOT_TLSLD16 = 83
  8684. const m_R_PPC_GOT_TLSLD16_HA = 86
  8685. const m_R_PPC_GOT_TLSLD16_HI = 85
  8686. const m_R_PPC_GOT_TLSLD16_LO = 84
  8687. const m_R_PPC_GOT_TPREL16 = 87
  8688. const m_R_PPC_GOT_TPREL16_HA = 90
  8689. const m_R_PPC_GOT_TPREL16_HI = 89
  8690. const m_R_PPC_GOT_TPREL16_LO = 88
  8691. const m_R_PPC_IRELATIVE = 248
  8692. const m_R_PPC_JMP_SLOT = 21
  8693. const m_R_PPC_LOCAL24PC = 23
  8694. const m_R_PPC_NONE = 0
  8695. const m_R_PPC_PLT16_HA = 31
  8696. const m_R_PPC_PLT16_HI = 30
  8697. const m_R_PPC_PLT16_LO = 29
  8698. const m_R_PPC_PLT32 = 27
  8699. const m_R_PPC_PLTREL24 = 18
  8700. const m_R_PPC_PLTREL32 = 28
  8701. const m_R_PPC_REL14 = 11
  8702. const m_R_PPC_REL14_BRNTAKEN = 13
  8703. const m_R_PPC_REL14_BRTAKEN = 12
  8704. const m_R_PPC_REL16 = 249
  8705. const m_R_PPC_REL16_HA = 252
  8706. const m_R_PPC_REL16_HI = 251
  8707. const m_R_PPC_REL16_LO = 250
  8708. const m_R_PPC_REL24 = 10
  8709. const m_R_PPC_REL32 = 26
  8710. const m_R_PPC_RELATIVE = 22
  8711. const m_R_PPC_SDAREL16 = 32
  8712. const m_R_PPC_SECTOFF = 33
  8713. const m_R_PPC_SECTOFF_HA = 36
  8714. const m_R_PPC_SECTOFF_HI = 35
  8715. const m_R_PPC_SECTOFF_LO = 34
  8716. const m_R_PPC_TLS = 67
  8717. const m_R_PPC_TLSGD = 95
  8718. const m_R_PPC_TLSLD = 96
  8719. const m_R_PPC_TOC16 = 255
  8720. const m_R_PPC_TPREL16 = 69
  8721. const m_R_PPC_TPREL16_HA = 72
  8722. const m_R_PPC_TPREL16_HI = 71
  8723. const m_R_PPC_TPREL16_LO = 70
  8724. const m_R_PPC_TPREL32 = 73
  8725. const m_R_PPC_UADDR16 = 25
  8726. const m_R_PPC_UADDR32 = 24
  8727. const m_R_RISCV_32 = 1
  8728. const m_R_RISCV_32_PCREL = 57
  8729. const m_R_RISCV_64 = 2
  8730. const m_R_RISCV_ADD16 = 34
  8731. const m_R_RISCV_ADD32 = 35
  8732. const m_R_RISCV_ADD64 = 36
  8733. const m_R_RISCV_ADD8 = 33
  8734. const m_R_RISCV_ALIGN = 43
  8735. const m_R_RISCV_BRANCH = 16
  8736. const m_R_RISCV_CALL = 18
  8737. const m_R_RISCV_CALL_PLT = 19
  8738. const m_R_RISCV_COPY = 4
  8739. const m_R_RISCV_GOT32_PCREL = 41
  8740. const m_R_RISCV_GOT_HI20 = 20
  8741. const m_R_RISCV_HI20 = 26
  8742. const m_R_RISCV_IRELATIVE = 58
  8743. const m_R_RISCV_JAL = 17
  8744. const m_R_RISCV_JUMP_SLOT = 5
  8745. const m_R_RISCV_LO12_I = 27
  8746. const m_R_RISCV_LO12_S = 28
  8747. const m_R_RISCV_NONE = 0
  8748. const m_R_RISCV_PCREL_HI20 = 23
  8749. const m_R_RISCV_PCREL_LO12_I = 24
  8750. const m_R_RISCV_PCREL_LO12_S = 25
  8751. const m_R_RISCV_PLT32 = 59
  8752. const m_R_RISCV_RELATIVE = 3
  8753. const m_R_RISCV_RELAX = 51
  8754. const m_R_RISCV_RVC_BRANCH = 44
  8755. const m_R_RISCV_RVC_JUMP = 45
  8756. const m_R_RISCV_RVC_LUI = 46
  8757. const m_R_RISCV_SET16 = 55
  8758. const m_R_RISCV_SET32 = 56
  8759. const m_R_RISCV_SET6 = 53
  8760. const m_R_RISCV_SET8 = 54
  8761. const m_R_RISCV_SET_ULEB128 = 60
  8762. const m_R_RISCV_SUB16 = 38
  8763. const m_R_RISCV_SUB32 = 39
  8764. const m_R_RISCV_SUB6 = 52
  8765. const m_R_RISCV_SUB64 = 40
  8766. const m_R_RISCV_SUB8 = 37
  8767. const m_R_RISCV_SUB_ULEB128 = 61
  8768. const m_R_RISCV_TLSDESC = 12
  8769. const m_R_RISCV_TLSDESC_ADD_LO12 = 64
  8770. const m_R_RISCV_TLSDESC_CALL = 65
  8771. const m_R_RISCV_TLSDESC_HI20 = 62
  8772. const m_R_RISCV_TLSDESC_LOAD_LO12 = 63
  8773. const m_R_RISCV_TLS_DTPMOD32 = 6
  8774. const m_R_RISCV_TLS_DTPMOD64 = 7
  8775. const m_R_RISCV_TLS_DTPREL32 = 8
  8776. const m_R_RISCV_TLS_DTPREL64 = 9
  8777. const m_R_RISCV_TLS_GD_HI20 = 22
  8778. const m_R_RISCV_TLS_GOT_HI20 = 21
  8779. const m_R_RISCV_TLS_TPREL32 = 10
  8780. const m_R_RISCV_TLS_TPREL64 = 11
  8781. const m_R_RISCV_TPREL_ADD = 32
  8782. const m_R_RISCV_TPREL_HI20 = 29
  8783. const m_R_RISCV_TPREL_LO12_I = 30
  8784. const m_R_RISCV_TPREL_LO12_S = 31
  8785. const m_R_SH_ALIGN = 29
  8786. const m_R_SH_CODE = 30
  8787. const m_R_SH_COPY = 162
  8788. const m_R_SH_COUNT = 28
  8789. const m_R_SH_DATA = 31
  8790. const m_R_SH_DIR32 = 1
  8791. const m_R_SH_DIR8BP = 7
  8792. const m_R_SH_DIR8L = 9
  8793. const m_R_SH_DIR8W = 8
  8794. const m_R_SH_DIR8WPL = 5
  8795. const m_R_SH_DIR8WPN = 3
  8796. const m_R_SH_DIR8WPZ = 6
  8797. const m_R_SH_FUNCDESC = 207
  8798. const m_R_SH_FUNCDESC_VALUE = 208
  8799. const m_R_SH_GLOB_DAT = 163
  8800. const m_R_SH_GNU_VTENTRY = 35
  8801. const m_R_SH_GNU_VTINHERIT = 34
  8802. const m_R_SH_GOT20 = 201
  8803. const m_R_SH_GOT32 = 160
  8804. const m_R_SH_GOTFUNCDESC = 203
  8805. const m_R_SH_GOTFUNCDEST20 = 204
  8806. const m_R_SH_GOTOFF = 166
  8807. const m_R_SH_GOTOFF20 = 202
  8808. const m_R_SH_GOTOFFFUNCDESC = 205
  8809. const m_R_SH_GOTOFFFUNCDEST20 = 206
  8810. const m_R_SH_GOTPC = 167
  8811. const m_R_SH_IND12W = 4
  8812. const m_R_SH_JMP_SLOT = 164
  8813. const m_R_SH_LABEL = 32
  8814. const m_R_SH_NONE = 0
  8815. const m_R_SH_NUM = 256
  8816. const m_R_SH_PLT32 = 161
  8817. const m_R_SH_REL32 = 2
  8818. const m_R_SH_RELATIVE = 165
  8819. const m_R_SH_SWITCH16 = 25
  8820. const m_R_SH_SWITCH32 = 26
  8821. const m_R_SH_SWITCH8 = 33
  8822. const m_R_SH_TLS_DTPMOD32 = 149
  8823. const m_R_SH_TLS_DTPOFF32 = 150
  8824. const m_R_SH_TLS_GD_32 = 144
  8825. const m_R_SH_TLS_IE_32 = 147
  8826. const m_R_SH_TLS_LDO_32 = 146
  8827. const m_R_SH_TLS_LD_32 = 145
  8828. const m_R_SH_TLS_LE_32 = 148
  8829. const m_R_SH_TLS_TPOFF32 = 151
  8830. const m_R_SH_USES = 27
  8831. const m_R_SPARC_10 = 30
  8832. const m_R_SPARC_11 = 31
  8833. const m_R_SPARC_13 = 11
  8834. const m_R_SPARC_16 = 2
  8835. const m_R_SPARC_22 = 10
  8836. const m_R_SPARC_32 = 3
  8837. const m_R_SPARC_5 = 44
  8838. const m_R_SPARC_6 = 45
  8839. const m_R_SPARC_64 = 32
  8840. const m_R_SPARC_7 = 43
  8841. const m_R_SPARC_8 = 1
  8842. const m_R_SPARC_COPY = 19
  8843. const m_R_SPARC_DISP16 = 5
  8844. const m_R_SPARC_DISP32 = 6
  8845. const m_R_SPARC_DISP64 = 46
  8846. const m_R_SPARC_DISP8 = 4
  8847. const m_R_SPARC_GLOB_DAT = 20
  8848. const m_R_SPARC_GLOB_JMP = 42
  8849. const m_R_SPARC_GNU_VTENTRY = 251
  8850. const m_R_SPARC_GNU_VTINHERIT = 250
  8851. const m_R_SPARC_GOT10 = 13
  8852. const m_R_SPARC_GOT13 = 14
  8853. const m_R_SPARC_GOT22 = 15
  8854. const m_R_SPARC_GOTDATA_HIX22 = 80
  8855. const m_R_SPARC_GOTDATA_LOX10 = 81
  8856. const m_R_SPARC_GOTDATA_OP = 84
  8857. const m_R_SPARC_GOTDATA_OP_HIX22 = 82
  8858. const m_R_SPARC_GOTDATA_OP_LOX10 = 83
  8859. const m_R_SPARC_H34 = 85
  8860. const m_R_SPARC_H44 = 50
  8861. const m_R_SPARC_HH22 = 34
  8862. const m_R_SPARC_HI22 = 9
  8863. const m_R_SPARC_HIPLT22 = 25
  8864. const m_R_SPARC_HIX22 = 48
  8865. const m_R_SPARC_HM10 = 35
  8866. const m_R_SPARC_JMP_SLOT = 21
  8867. const m_R_SPARC_L44 = 52
  8868. const m_R_SPARC_LM22 = 36
  8869. const m_R_SPARC_LO10 = 12
  8870. const m_R_SPARC_LOPLT10 = 26
  8871. const m_R_SPARC_LOX10 = 49
  8872. const m_R_SPARC_M44 = 51
  8873. const m_R_SPARC_NONE = 0
  8874. const m_R_SPARC_NUM = 253
  8875. const m_R_SPARC_OLO10 = 33
  8876. const m_R_SPARC_PC10 = 16
  8877. const m_R_SPARC_PC22 = 17
  8878. const m_R_SPARC_PCPLT10 = 29
  8879. const m_R_SPARC_PCPLT22 = 28
  8880. const m_R_SPARC_PCPLT32 = 27
  8881. const m_R_SPARC_PC_HH22 = 37
  8882. const m_R_SPARC_PC_HM10 = 38
  8883. const m_R_SPARC_PC_LM22 = 39
  8884. const m_R_SPARC_PLT32 = 24
  8885. const m_R_SPARC_PLT64 = 47
  8886. const m_R_SPARC_REGISTER = 53
  8887. const m_R_SPARC_RELATIVE = 22
  8888. const m_R_SPARC_REV32 = 252
  8889. const m_R_SPARC_SIZE32 = 86
  8890. const m_R_SPARC_SIZE64 = 87
  8891. const m_R_SPARC_TLS_DTPMOD32 = 74
  8892. const m_R_SPARC_TLS_DTPMOD64 = 75
  8893. const m_R_SPARC_TLS_DTPOFF32 = 76
  8894. const m_R_SPARC_TLS_DTPOFF64 = 77
  8895. const m_R_SPARC_TLS_GD_ADD = 58
  8896. const m_R_SPARC_TLS_GD_CALL = 59
  8897. const m_R_SPARC_TLS_GD_HI22 = 56
  8898. const m_R_SPARC_TLS_GD_LO10 = 57
  8899. const m_R_SPARC_TLS_IE_ADD = 71
  8900. const m_R_SPARC_TLS_IE_HI22 = 67
  8901. const m_R_SPARC_TLS_IE_LD = 69
  8902. const m_R_SPARC_TLS_IE_LDX = 70
  8903. const m_R_SPARC_TLS_IE_LO10 = 68
  8904. const m_R_SPARC_TLS_LDM_ADD = 62
  8905. const m_R_SPARC_TLS_LDM_CALL = 63
  8906. const m_R_SPARC_TLS_LDM_HI22 = 60
  8907. const m_R_SPARC_TLS_LDM_LO10 = 61
  8908. const m_R_SPARC_TLS_LDO_ADD = 66
  8909. const m_R_SPARC_TLS_LDO_HIX22 = 64
  8910. const m_R_SPARC_TLS_LDO_LOX10 = 65
  8911. const m_R_SPARC_TLS_LE_HIX22 = 72
  8912. const m_R_SPARC_TLS_LE_LOX10 = 73
  8913. const m_R_SPARC_TLS_TPOFF32 = 78
  8914. const m_R_SPARC_TLS_TPOFF64 = 79
  8915. const m_R_SPARC_UA16 = 55
  8916. const m_R_SPARC_UA32 = 23
  8917. const m_R_SPARC_UA64 = 54
  8918. const m_R_SPARC_WDISP16 = 40
  8919. const m_R_SPARC_WDISP19 = 41
  8920. const m_R_SPARC_WDISP22 = 8
  8921. const m_R_SPARC_WDISP30 = 7
  8922. const m_R_SPARC_WPLT30 = 18
  8923. const m_R_X86_64_16 = 12
  8924. const m_R_X86_64_32 = 10
  8925. const m_R_X86_64_32S = 11
  8926. const m_R_X86_64_64 = 1
  8927. const m_R_X86_64_8 = 14
  8928. const m_R_X86_64_COPY = 5
  8929. const m_R_X86_64_DTPMOD64 = 16
  8930. const m_R_X86_64_DTPOFF32 = 21
  8931. const m_R_X86_64_DTPOFF64 = 17
  8932. const m_R_X86_64_GLOB_DAT = 6
  8933. const m_R_X86_64_GOT32 = 3
  8934. const m_R_X86_64_GOT64 = 27
  8935. const m_R_X86_64_GOTOFF64 = 25
  8936. const m_R_X86_64_GOTPC32 = 26
  8937. const m_R_X86_64_GOTPC32_TLSDESC = 34
  8938. const m_R_X86_64_GOTPC64 = 29
  8939. const m_R_X86_64_GOTPCREL = 9
  8940. const m_R_X86_64_GOTPCREL64 = 28
  8941. const m_R_X86_64_GOTPCRELX = 41
  8942. const m_R_X86_64_GOTPLT64 = 30
  8943. const m_R_X86_64_GOTTPOFF = 22
  8944. const m_R_X86_64_IRELATIVE = 37
  8945. const m_R_X86_64_JUMP_SLOT = 7
  8946. const m_R_X86_64_NONE = 0
  8947. const m_R_X86_64_NUM = 43
  8948. const m_R_X86_64_PC16 = 13
  8949. const m_R_X86_64_PC32 = 2
  8950. const m_R_X86_64_PC64 = 24
  8951. const m_R_X86_64_PC8 = 15
  8952. const m_R_X86_64_PLT32 = 4
  8953. const m_R_X86_64_PLTOFF64 = 31
  8954. const m_R_X86_64_RELATIVE = 8
  8955. const m_R_X86_64_RELATIVE64 = 38
  8956. const m_R_X86_64_REX_GOTPCRELX = 42
  8957. const m_R_X86_64_SIZE32 = 32
  8958. const m_R_X86_64_SIZE64 = 33
  8959. const m_R_X86_64_TLSDESC = 36
  8960. const m_R_X86_64_TLSDESC_CALL = 35
  8961. const m_R_X86_64_TLSGD = 19
  8962. const m_R_X86_64_TLSLD = 20
  8963. const m_R_X86_64_TPOFF32 = 23
  8964. const m_R_X86_64_TPOFF64 = 18
  8965. const m_SELFMAG = 4
  8966. const m_SHF_ALPHA_GPREL = 0x10000000
  8967. const m_SHF_ARM_COMDEF = 0x80000000
  8968. const m_SHF_ARM_ENTRYSECT = 0x10000000
  8969. const m_SHF_IA_64_NORECOV = 0x20000000
  8970. const m_SHF_IA_64_SHORT = 0x10000000
  8971. const m_SHF_MASKOS = 0x0ff00000
  8972. const m_SHF_MASKPROC = 0xf0000000
  8973. const m_SHF_MIPS_ADDR = 0x40000000
  8974. const m_SHF_MIPS_GPREL = 0x10000000
  8975. const m_SHF_MIPS_LOCAL = 0x04000000
  8976. const m_SHF_MIPS_MERGE = 0x20000000
  8977. const m_SHF_MIPS_NAMES = 0x02000000
  8978. const m_SHF_MIPS_NODUPE = 0x01000000
  8979. const m_SHF_MIPS_NOSTRIP = 0x08000000
  8980. const m_SHF_MIPS_STRINGS = 0x80000000
  8981. const m_SHF_PARISC_HUGE = 0x40000000
  8982. const m_SHF_PARISC_SBP = 0x80000000
  8983. const m_SHF_PARISC_SHORT = 0x20000000
  8984. const m_SHN_ABS = 65521
  8985. const m_SHN_AFTER = 0xff01
  8986. const m_SHN_BEFORE = 0xff00
  8987. const m_SHN_COMMON = 65522
  8988. const m_SHN_HIOS = 0xff3f
  8989. const m_SHN_HIPROC = 0xff1f
  8990. const m_SHN_HIRESERVE = 0xffff
  8991. const m_SHN_LOOS = 0xff20
  8992. const m_SHN_LOPROC = 0xff00
  8993. const m_SHN_LORESERVE = 0xff00
  8994. const m_SHN_MIPS_ACOMMON = 0xff00
  8995. const m_SHN_MIPS_DATA = 0xff02
  8996. const m_SHN_MIPS_SCOMMON = 0xff03
  8997. const m_SHN_MIPS_SUNDEFINED = 0xff04
  8998. const m_SHN_MIPS_TEXT = 0xff01
  8999. const m_SHN_PARISC_ANSI_COMMON = 0xff00
  9000. const m_SHN_PARISC_HUGE_COMMON = 0xff01
  9001. const m_SHN_UNDEF = 0
  9002. const m_SHN_XINDEX = 0xffff
  9003. const m_SHT_ALPHA_DEBUG = 0x70000001
  9004. const m_SHT_ALPHA_REGINFO = 0x70000002
  9005. const m_SHT_CHECKSUM = 0x6ffffff8
  9006. const m_SHT_DYNAMIC = 6
  9007. const m_SHT_DYNSYM = 11
  9008. const m_SHT_FINI_ARRAY = 15
  9009. const m_SHT_GNU_ATTRIBUTES = 0x6ffffff5
  9010. const m_SHT_GNU_HASH = 0x6ffffff6
  9011. const m_SHT_GNU_LIBLIST = 0x6ffffff7
  9012. const m_SHT_GNU_verdef = 0x6ffffffd
  9013. const m_SHT_GNU_verneed = 0x6ffffffe
  9014. const m_SHT_GNU_versym = 0x6fffffff
  9015. const m_SHT_GROUP = 17
  9016. const m_SHT_HASH = 5
  9017. const m_SHT_HIOS = 0x6fffffff
  9018. const m_SHT_HIPROC = 0x7fffffff
  9019. const m_SHT_HISUNW = 0x6fffffff
  9020. const m_SHT_HIUSER = 0x8fffffff
  9021. const m_SHT_INIT_ARRAY = 14
  9022. const m_SHT_LOOS = 0x60000000
  9023. const m_SHT_LOPROC = 0x70000000
  9024. const m_SHT_LOSUNW = 0x6ffffffa
  9025. const m_SHT_LOUSER = 0x80000000
  9026. const m_SHT_MIPS_AUXSYM = 0x70000016
  9027. const m_SHT_MIPS_CONFLICT = 0x70000002
  9028. const m_SHT_MIPS_CONTENT = 0x7000000c
  9029. const m_SHT_MIPS_DEBUG = 0x70000005
  9030. const m_SHT_MIPS_DELTACLASS = 0x7000001d
  9031. const m_SHT_MIPS_DELTADECL = 0x7000001f
  9032. const m_SHT_MIPS_DELTAINST = 0x7000001c
  9033. const m_SHT_MIPS_DELTASYM = 0x7000001b
  9034. const m_SHT_MIPS_DENSE = 0x70000013
  9035. const m_SHT_MIPS_DWARF = 0x7000001e
  9036. const m_SHT_MIPS_EH_REGION = 0x70000027
  9037. const m_SHT_MIPS_EVENTS = 0x70000021
  9038. const m_SHT_MIPS_EXTSYM = 0x70000012
  9039. const m_SHT_MIPS_FDESC = 0x70000011
  9040. const m_SHT_MIPS_GPTAB = 0x70000003
  9041. const m_SHT_MIPS_IFACE = 0x7000000b
  9042. const m_SHT_MIPS_LIBLIST = 0x70000000
  9043. const m_SHT_MIPS_LINE = 0x70000019
  9044. const m_SHT_MIPS_LOCSTR = 0x70000018
  9045. const m_SHT_MIPS_LOCSYM = 0x70000015
  9046. const m_SHT_MIPS_MSYM = 0x70000001
  9047. const m_SHT_MIPS_OPTIONS = 0x7000000d
  9048. const m_SHT_MIPS_OPTSYM = 0x70000017
  9049. const m_SHT_MIPS_PACKAGE = 0x70000007
  9050. const m_SHT_MIPS_PACKSYM = 0x70000008
  9051. const m_SHT_MIPS_PDESC = 0x70000014
  9052. const m_SHT_MIPS_PDR_EXCEPTION = 0x70000029
  9053. const m_SHT_MIPS_PIXIE = 0x70000023
  9054. const m_SHT_MIPS_REGINFO = 0x70000006
  9055. const m_SHT_MIPS_RELD = 0x70000009
  9056. const m_SHT_MIPS_RFDESC = 0x7000001a
  9057. const m_SHT_MIPS_SHDR = 0x70000010
  9058. const m_SHT_MIPS_SYMBOL_LIB = 0x70000020
  9059. const m_SHT_MIPS_TRANSLATE = 0x70000022
  9060. const m_SHT_MIPS_UCODE = 0x70000004
  9061. const m_SHT_MIPS_WHIRL = 0x70000026
  9062. const m_SHT_MIPS_XLATE = 0x70000024
  9063. const m_SHT_MIPS_XLATE_DEBUG = 0x70000025
  9064. const m_SHT_MIPS_XLATE_OLD = 0x70000028
  9065. const m_SHT_NOBITS = 8
  9066. const m_SHT_NOTE = 7
  9067. const m_SHT_NULL = 0
  9068. const m_SHT_NUM = 20
  9069. const m_SHT_PARISC_DOC = 0x70000002
  9070. const m_SHT_PARISC_EXT = 0x70000000
  9071. const m_SHT_PARISC_UNWIND = 0x70000001
  9072. const m_SHT_PREINIT_ARRAY = 16
  9073. const m_SHT_PROGBITS = 1
  9074. const m_SHT_REL = 9
  9075. const m_SHT_RELA = 4
  9076. const m_SHT_RELR = 19
  9077. const m_SHT_SHLIB = 10
  9078. const m_SHT_STRTAB = 3
  9079. const m_SHT_SUNW_COMDAT = 0x6ffffffb
  9080. const m_SHT_SUNW_move = 0x6ffffffa
  9081. const m_SHT_SUNW_syminfo = 0x6ffffffc
  9082. const m_SHT_SYMTAB = 2
  9083. const m_SHT_SYMTAB_SHNDX = 18
  9084. const m_STB_GLOBAL = 1
  9085. const m_STB_GNU_UNIQUE = 10
  9086. const m_STB_HIOS = 12
  9087. const m_STB_HIPROC = 15
  9088. const m_STB_LOCAL = 0
  9089. const m_STB_LOOS = 10
  9090. const m_STB_LOPROC = 13
  9091. const m_STB_MIPS_SPLIT_COMMON = 13
  9092. const m_STB_NUM = 3
  9093. const m_STB_WEAK = 2
  9094. const m_STN_UNDEF = 0
  9095. const m_STO_ALPHA_NOPV = 0x80
  9096. const m_STO_ALPHA_STD_GPLOAD = 0x88
  9097. const m_STO_MIPS_DEFAULT = 0x0
  9098. const m_STO_MIPS_HIDDEN = 0x2
  9099. const m_STO_MIPS_INTERNAL = 0x1
  9100. const m_STO_MIPS_PLT = 0x8
  9101. const m_STO_MIPS_PROTECTED = 0x3
  9102. const m_STO_MIPS_SC_ALIGN_UNUSED = 0xff
  9103. const m_STO_PPC64_LOCAL_BIT = 5
  9104. const m_STO_PPC64_LOCAL_MASK = 0xe0
  9105. const m_STT_ARM_16BIT = "STT_HIPROC"
  9106. const m_STT_ARM_TFUNC = "STT_LOPROC"
  9107. const m_STT_COMMON = 5
  9108. const m_STT_FILE = 4
  9109. const m_STT_FUNC = 2
  9110. const m_STT_GNU_IFUNC = 10
  9111. const m_STT_HIOS = 12
  9112. const m_STT_HIPROC = 15
  9113. const m_STT_LOOS = 10
  9114. const m_STT_LOPROC = 13
  9115. const m_STT_NOTYPE = 0
  9116. const m_STT_NUM = 7
  9117. const m_STT_OBJECT = 1
  9118. const m_STT_PARISC_MILLICODE = 13
  9119. const m_STT_SECTION = 3
  9120. const m_STT_SPARC_REGISTER = 13
  9121. const m_STT_TLS = 6
  9122. const m_STV_DEFAULT = 0
  9123. const m_STV_HIDDEN = 2
  9124. const m_STV_INTERNAL = 1
  9125. const m_STV_PROTECTED = 3
  9126. const m_SYMINFO_BT_LOWRESERVE = 0xff00
  9127. const m_SYMINFO_BT_PARENT = 0xfffe
  9128. const m_SYMINFO_BT_SELF = 0xffff
  9129. const m_SYMINFO_CURRENT = 1
  9130. const m_SYMINFO_FLG_COPY = 0x0004
  9131. const m_SYMINFO_FLG_DIRECT = 0x0001
  9132. const m_SYMINFO_FLG_LAZYLOAD = 0x0008
  9133. const m_SYMINFO_FLG_PASSTHRU = 0x0002
  9134. const m_SYMINFO_NONE = 0
  9135. const m_SYMINFO_NUM = 2
  9136. const m_VER_DEF_CURRENT = 1
  9137. const m_VER_DEF_NONE = 0
  9138. const m_VER_DEF_NUM = 2
  9139. const m_VER_FLG_BASE = 0x1
  9140. const m_VER_FLG_WEAK = 0x2
  9141. const m_VER_NDX_ELIMINATE = 0xff01
  9142. const m_VER_NDX_GLOBAL = 1
  9143. const m_VER_NDX_LOCAL = 0
  9144. const m_VER_NDX_LORESERVE = 0xff00
  9145. const m_VER_NEED_CURRENT = 1
  9146. const m_VER_NEED_NONE = 0
  9147. const m_VER_NEED_NUM = 2
  9148. const m_n_hash = "n_desc"
  9149. type Tnlist = struct {
  9150. F__ccgo0_0 struct {
  9151. Fn_un [0]struct {
  9152. Fn_next [0]uintptr
  9153. Fn_strx [0]int64
  9154. Fn_name uintptr
  9155. }
  9156. Fn_name uintptr
  9157. }
  9158. Fn_type uint8
  9159. Fn_other uint8
  9160. Fn_desc int16
  9161. Fn_value uint64
  9162. }
  9163. type TElf32_Half = uint16
  9164. type TElf64_Half = uint16
  9165. type TElf32_Word = uint32
  9166. type TElf32_Sword = int32
  9167. type TElf64_Word = uint32
  9168. type TElf64_Sword = int32
  9169. type TElf32_Xword = uint64
  9170. type TElf32_Sxword = int64
  9171. type TElf64_Xword = uint64
  9172. type TElf64_Sxword = int64
  9173. type TElf32_Addr = uint32
  9174. type TElf64_Addr = uint64
  9175. type TElf32_Off = uint32
  9176. type TElf64_Off = uint64
  9177. type TElf32_Section = uint16
  9178. type TElf64_Section = uint16
  9179. type TElf32_Versym = uint16
  9180. type TElf64_Versym = uint16
  9181. type TElf32_Ehdr = struct {
  9182. Fe_ident [16]uint8
  9183. Fe_type TElf32_Half
  9184. Fe_machine TElf32_Half
  9185. Fe_version TElf32_Word
  9186. Fe_entry TElf32_Addr
  9187. Fe_phoff TElf32_Off
  9188. Fe_shoff TElf32_Off
  9189. Fe_flags TElf32_Word
  9190. Fe_ehsize TElf32_Half
  9191. Fe_phentsize TElf32_Half
  9192. Fe_phnum TElf32_Half
  9193. Fe_shentsize TElf32_Half
  9194. Fe_shnum TElf32_Half
  9195. Fe_shstrndx TElf32_Half
  9196. }
  9197. type TElf64_Ehdr = struct {
  9198. Fe_ident [16]uint8
  9199. Fe_type TElf64_Half
  9200. Fe_machine TElf64_Half
  9201. Fe_version TElf64_Word
  9202. Fe_entry TElf64_Addr
  9203. Fe_phoff TElf64_Off
  9204. Fe_shoff TElf64_Off
  9205. Fe_flags TElf64_Word
  9206. Fe_ehsize TElf64_Half
  9207. Fe_phentsize TElf64_Half
  9208. Fe_phnum TElf64_Half
  9209. Fe_shentsize TElf64_Half
  9210. Fe_shnum TElf64_Half
  9211. Fe_shstrndx TElf64_Half
  9212. }
  9213. type TElf32_Shdr = struct {
  9214. Fsh_name TElf32_Word
  9215. Fsh_type TElf32_Word
  9216. Fsh_flags TElf32_Word
  9217. Fsh_addr TElf32_Addr
  9218. Fsh_offset TElf32_Off
  9219. Fsh_size TElf32_Word
  9220. Fsh_link TElf32_Word
  9221. Fsh_info TElf32_Word
  9222. Fsh_addralign TElf32_Word
  9223. Fsh_entsize TElf32_Word
  9224. }
  9225. type TElf64_Shdr = struct {
  9226. Fsh_name TElf64_Word
  9227. Fsh_type TElf64_Word
  9228. Fsh_flags TElf64_Xword
  9229. Fsh_addr TElf64_Addr
  9230. Fsh_offset TElf64_Off
  9231. Fsh_size TElf64_Xword
  9232. Fsh_link TElf64_Word
  9233. Fsh_info TElf64_Word
  9234. Fsh_addralign TElf64_Xword
  9235. Fsh_entsize TElf64_Xword
  9236. }
  9237. type TElf32_Chdr = struct {
  9238. Fch_type TElf32_Word
  9239. Fch_size TElf32_Word
  9240. Fch_addralign TElf32_Word
  9241. }
  9242. type TElf64_Chdr = struct {
  9243. Fch_type TElf64_Word
  9244. Fch_reserved TElf64_Word
  9245. Fch_size TElf64_Xword
  9246. Fch_addralign TElf64_Xword
  9247. }
  9248. type TElf32_Sym = struct {
  9249. Fst_name TElf32_Word
  9250. Fst_value TElf32_Addr
  9251. Fst_size TElf32_Word
  9252. Fst_info uint8
  9253. Fst_other uint8
  9254. Fst_shndx TElf32_Section
  9255. }
  9256. type TElf64_Sym = struct {
  9257. Fst_name TElf64_Word
  9258. Fst_info uint8
  9259. Fst_other uint8
  9260. Fst_shndx TElf64_Section
  9261. Fst_value TElf64_Addr
  9262. Fst_size TElf64_Xword
  9263. }
  9264. type TElf32_Syminfo = struct {
  9265. Fsi_boundto TElf32_Half
  9266. Fsi_flags TElf32_Half
  9267. }
  9268. type TElf64_Syminfo = struct {
  9269. Fsi_boundto TElf64_Half
  9270. Fsi_flags TElf64_Half
  9271. }
  9272. type TElf32_Rel = struct {
  9273. Fr_offset TElf32_Addr
  9274. Fr_info TElf32_Word
  9275. }
  9276. type TElf64_Rel = struct {
  9277. Fr_offset TElf64_Addr
  9278. Fr_info TElf64_Xword
  9279. }
  9280. type TElf32_Rela = struct {
  9281. Fr_offset TElf32_Addr
  9282. Fr_info TElf32_Word
  9283. Fr_addend TElf32_Sword
  9284. }
  9285. type TElf64_Rela = struct {
  9286. Fr_offset TElf64_Addr
  9287. Fr_info TElf64_Xword
  9288. Fr_addend TElf64_Sxword
  9289. }
  9290. type TElf32_Relr = uint32
  9291. type TElf64_Relr = uint64
  9292. type TElf32_Phdr = struct {
  9293. Fp_type TElf32_Word
  9294. Fp_offset TElf32_Off
  9295. Fp_vaddr TElf32_Addr
  9296. Fp_paddr TElf32_Addr
  9297. Fp_filesz TElf32_Word
  9298. Fp_memsz TElf32_Word
  9299. Fp_flags TElf32_Word
  9300. Fp_align TElf32_Word
  9301. }
  9302. type TElf64_Phdr = struct {
  9303. Fp_type TElf64_Word
  9304. Fp_flags TElf64_Word
  9305. Fp_offset TElf64_Off
  9306. Fp_vaddr TElf64_Addr
  9307. Fp_paddr TElf64_Addr
  9308. Fp_filesz TElf64_Xword
  9309. Fp_memsz TElf64_Xword
  9310. Fp_align TElf64_Xword
  9311. }
  9312. type TElf32_Dyn = struct {
  9313. Fd_tag TElf32_Sword
  9314. Fd_un struct {
  9315. Fd_ptr [0]TElf32_Addr
  9316. Fd_val TElf32_Word
  9317. }
  9318. }
  9319. type TElf64_Dyn = struct {
  9320. Fd_tag TElf64_Sxword
  9321. Fd_un struct {
  9322. Fd_ptr [0]TElf64_Addr
  9323. Fd_val TElf64_Xword
  9324. }
  9325. }
  9326. type TElf32_Verdef = struct {
  9327. Fvd_version TElf32_Half
  9328. Fvd_flags TElf32_Half
  9329. Fvd_ndx TElf32_Half
  9330. Fvd_cnt TElf32_Half
  9331. Fvd_hash TElf32_Word
  9332. Fvd_aux TElf32_Word
  9333. Fvd_next TElf32_Word
  9334. }
  9335. type TElf64_Verdef = struct {
  9336. Fvd_version TElf64_Half
  9337. Fvd_flags TElf64_Half
  9338. Fvd_ndx TElf64_Half
  9339. Fvd_cnt TElf64_Half
  9340. Fvd_hash TElf64_Word
  9341. Fvd_aux TElf64_Word
  9342. Fvd_next TElf64_Word
  9343. }
  9344. type TElf32_Verdaux = struct {
  9345. Fvda_name TElf32_Word
  9346. Fvda_next TElf32_Word
  9347. }
  9348. type TElf64_Verdaux = struct {
  9349. Fvda_name TElf64_Word
  9350. Fvda_next TElf64_Word
  9351. }
  9352. type TElf32_Verneed = struct {
  9353. Fvn_version TElf32_Half
  9354. Fvn_cnt TElf32_Half
  9355. Fvn_file TElf32_Word
  9356. Fvn_aux TElf32_Word
  9357. Fvn_next TElf32_Word
  9358. }
  9359. type TElf64_Verneed = struct {
  9360. Fvn_version TElf64_Half
  9361. Fvn_cnt TElf64_Half
  9362. Fvn_file TElf64_Word
  9363. Fvn_aux TElf64_Word
  9364. Fvn_next TElf64_Word
  9365. }
  9366. type TElf32_Vernaux = struct {
  9367. Fvna_hash TElf32_Word
  9368. Fvna_flags TElf32_Half
  9369. Fvna_other TElf32_Half
  9370. Fvna_name TElf32_Word
  9371. Fvna_next TElf32_Word
  9372. }
  9373. type TElf64_Vernaux = struct {
  9374. Fvna_hash TElf64_Word
  9375. Fvna_flags TElf64_Half
  9376. Fvna_other TElf64_Half
  9377. Fvna_name TElf64_Word
  9378. Fvna_next TElf64_Word
  9379. }
  9380. type TElf32_auxv_t = struct {
  9381. Fa_type Tuint32_t
  9382. Fa_un struct {
  9383. Fa_val Tuint32_t
  9384. }
  9385. }
  9386. type TElf64_auxv_t = struct {
  9387. Fa_type Tuint64_t
  9388. Fa_un struct {
  9389. Fa_val Tuint64_t
  9390. }
  9391. }
  9392. type TElf32_Nhdr = struct {
  9393. Fn_namesz TElf32_Word
  9394. Fn_descsz TElf32_Word
  9395. Fn_type TElf32_Word
  9396. }
  9397. type TElf64_Nhdr = struct {
  9398. Fn_namesz TElf64_Word
  9399. Fn_descsz TElf64_Word
  9400. Fn_type TElf64_Word
  9401. }
  9402. type TElf32_Move = struct {
  9403. Fm_value TElf32_Xword
  9404. Fm_info TElf32_Word
  9405. Fm_poffset TElf32_Word
  9406. Fm_repeat TElf32_Half
  9407. Fm_stride TElf32_Half
  9408. }
  9409. type TElf64_Move = struct {
  9410. Fm_value TElf64_Xword
  9411. Fm_info TElf64_Xword
  9412. Fm_poffset TElf64_Xword
  9413. Fm_repeat TElf64_Half
  9414. Fm_stride TElf64_Half
  9415. }
  9416. type TElf32_gptab = struct {
  9417. Fgt_entry [0]struct {
  9418. Fgt_g_value TElf32_Word
  9419. Fgt_bytes TElf32_Word
  9420. }
  9421. Fgt_header struct {
  9422. Fgt_current_g_value TElf32_Word
  9423. Fgt_unused TElf32_Word
  9424. }
  9425. }
  9426. type TElf32_RegInfo = struct {
  9427. Fri_gprmask TElf32_Word
  9428. Fri_cprmask [4]TElf32_Word
  9429. Fri_gp_value TElf32_Sword
  9430. }
  9431. type TElf_Options = struct {
  9432. Fkind uint8
  9433. Fsize uint8
  9434. Fsection TElf32_Section
  9435. Finfo TElf32_Word
  9436. }
  9437. type TElf_Options_Hw = struct {
  9438. Fhwp_flags1 TElf32_Word
  9439. Fhwp_flags2 TElf32_Word
  9440. }
  9441. type TElf32_Lib = struct {
  9442. Fl_name TElf32_Word
  9443. Fl_time_stamp TElf32_Word
  9444. Fl_checksum TElf32_Word
  9445. Fl_version TElf32_Word
  9446. Fl_flags TElf32_Word
  9447. }
  9448. type TElf64_Lib = struct {
  9449. Fl_name TElf64_Word
  9450. Fl_time_stamp TElf64_Word
  9451. Fl_checksum TElf64_Word
  9452. Fl_version TElf64_Word
  9453. Fl_flags TElf64_Word
  9454. }
  9455. type TElf32_Conflict = uint32
  9456. type TElf_MIPS_ABIFlags_v0 = struct {
  9457. Fversion TElf32_Half
  9458. Fisa_level uint8
  9459. Fisa_rev uint8
  9460. Fgpr_size uint8
  9461. Fcpr1_size uint8
  9462. Fcpr2_size uint8
  9463. Ffp_abi uint8
  9464. Fisa_ext TElf32_Word
  9465. Fases TElf32_Word
  9466. Fflags1 TElf32_Word
  9467. Fflags2 TElf32_Word
  9468. }
  9469. const _Val_GNU_MIPS_ABI_FP_ANY = 0
  9470. const _Val_GNU_MIPS_ABI_FP_DOUBLE = 1
  9471. const _Val_GNU_MIPS_ABI_FP_SINGLE = 2
  9472. const _Val_GNU_MIPS_ABI_FP_SOFT = 3
  9473. const _Val_GNU_MIPS_ABI_FP_OLD_64 = 4
  9474. const _Val_GNU_MIPS_ABI_FP_XX = 5
  9475. const _Val_GNU_MIPS_ABI_FP_64 = 6
  9476. const _Val_GNU_MIPS_ABI_FP_64A = 7
  9477. const _Val_GNU_MIPS_ABI_FP_MAX = 7
  9478. // C documentation
  9479. //
  9480. // /*
  9481. // * __elf_is_okay__ - Determine if ehdr really
  9482. // * is ELF and valid for the target platform.
  9483. // *
  9484. // * WARNING: This is NOT an ELF ABI function and
  9485. // * as such its use should be restricted.
  9486. // */
  9487. func ___elf_is_okay__(tls *libc.TLS, ehdr uintptr) (r int32) {
  9488. var retval int32
  9489. _ = retval
  9490. retval = 0
  9491. /*
  9492. * We need to check magic, class size, endianess,
  9493. * and version before we look at the rest of the
  9494. * Elf_Ehdr structure. These few elements are
  9495. * represented in a machine independent fashion.
  9496. */
  9497. 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) {
  9498. /* Now check the machine dependent header */
  9499. if libc.Int32FromUint16((*TElf64_Ehdr)(unsafe.Pointer(ehdr)).Fe_machine) == int32(m_EM_RISCV) && (*TElf64_Ehdr)(unsafe.Pointer(ehdr)).Fe_version == uint32(m_EV_CURRENT) {
  9500. retval = int32(1)
  9501. }
  9502. }
  9503. return retval
  9504. }
  9505. // C documentation
  9506. //
  9507. // /*
  9508. // * Convert an Elf_Sym into an nlist structure. This fills in only the
  9509. // * n_value and n_type members.
  9510. // */
  9511. func _elf_sym_to_nlist(tls *libc.TLS, nl uintptr, s uintptr, shdr uintptr, shnum int32) {
  9512. var sh, p5 uintptr
  9513. var v1, v2, v3, v4 int32
  9514. _, _, _, _, _, _ = sh, v1, v2, v3, v4, p5
  9515. (*Tnlist)(unsafe.Pointer(nl)).Fn_value = (*TElf64_Sym)(unsafe.Pointer(s)).Fst_value
  9516. switch libc.Int32FromUint16((*TElf64_Sym)(unsafe.Pointer(s)).Fst_shndx) {
  9517. case m_SHN_UNDEF:
  9518. fallthrough
  9519. case int32(m_SHN_COMMON):
  9520. (*Tnlist)(unsafe.Pointer(nl)).Fn_type = uint8(m_N_UNDF)
  9521. case int32(m_SHN_ABS):
  9522. if libc.Int32FromUint8((*TElf64_Sym)(unsafe.Pointer(s)).Fst_info)&int32(0xf) == int32(m_STT_FILE) {
  9523. v1 = int32(m_N_FN)
  9524. } else {
  9525. v1 = int32(m_N_ABS)
  9526. }
  9527. (*Tnlist)(unsafe.Pointer(nl)).Fn_type = libc.Uint8FromInt32(v1)
  9528. default:
  9529. if libc.Int32FromUint16((*TElf64_Sym)(unsafe.Pointer(s)).Fst_shndx) >= shnum {
  9530. (*Tnlist)(unsafe.Pointer(nl)).Fn_type = uint8(m_N_UNDF)
  9531. } else {
  9532. sh = shdr + uintptr((*TElf64_Sym)(unsafe.Pointer(s)).Fst_shndx)*64
  9533. if (*TElf64_Shdr)(unsafe.Pointer(sh)).Fsh_type == uint32(m_SHT_PROGBITS) {
  9534. if (*TElf64_Shdr)(unsafe.Pointer(sh)).Fsh_flags&libc.Uint64FromInt32(libc.Int32FromInt32(1)<<libc.Int32FromInt32(0)) != 0 {
  9535. v3 = int32(m_N_DATA)
  9536. } else {
  9537. v3 = int32(m_N_TEXT)
  9538. }
  9539. v2 = v3
  9540. } else {
  9541. if (*TElf64_Shdr)(unsafe.Pointer(sh)).Fsh_type == uint32(m_SHT_NOBITS) {
  9542. v4 = int32(m_N_BSS)
  9543. } else {
  9544. v4 = m_N_UNDF
  9545. }
  9546. v2 = v4
  9547. }
  9548. (*Tnlist)(unsafe.Pointer(nl)).Fn_type = libc.Uint8FromInt32(v2)
  9549. }
  9550. break
  9551. }
  9552. 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) {
  9553. p5 = nl + 8
  9554. *(*uint8)(unsafe.Pointer(p5)) = uint8(int32(*(*uint8)(unsafe.Pointer(p5))) | libc.Int32FromInt32(m_N_EXT))
  9555. }
  9556. }
  9557. func X__fdnlist(tls *libc.TLS, fd int32, list uintptr) (r int32) {
  9558. bp := tls.Alloc(24768)
  9559. defer tls.Free(24768)
  9560. var cc, i TElf64_Sword
  9561. var errsave, nent, v6 int32
  9562. var name, p, s, shdr, strtab uintptr
  9563. var shdr_size, size, symsize, symstrsize TElf64_Word
  9564. var symoff, symstroff TElf64_Off
  9565. var v3 uint64
  9566. var _ /* ehdr at bp+24576 */ TElf64_Ehdr
  9567. var _ /* sbuf at bp+0 */ [1024]TElf64_Sym
  9568. var _ /* st at bp+24640 */ Tstat
  9569. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = cc, errsave, i, name, nent, p, s, shdr, shdr_size, size, strtab, symoff, symsize, symstroff, symstrsize, v3, v6
  9570. symoff = uint64(0)
  9571. symstroff = uint64(0)
  9572. symsize = uint32(0)
  9573. symstrsize = uint32(0)
  9574. nent = -int32(1)
  9575. strtab = libc.UintptrFromInt32(0)
  9576. shdr = libc.UintptrFromInt32(0)
  9577. /* Make sure obj is OK */
  9578. 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 {
  9579. return -int32(1)
  9580. }
  9581. if libc.Int32FromUint16((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shnum) == 0 || uint64((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shentsize) != uint64(64) {
  9582. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ERANGE)
  9583. return -int32(1)
  9584. }
  9585. /* calculate section header table size */
  9586. shdr_size = libc.Uint32FromInt32(libc.Int32FromUint16((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shentsize) * libc.Int32FromUint16((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shnum))
  9587. /* Make sure it's not too big to mmap */
  9588. if libc.Int64FromUint32(shdr_size) > (*(*Tstat)(unsafe.Pointer(bp + 24640))).Fst_size {
  9589. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EFBIG)
  9590. return -int32(1)
  9591. }
  9592. shdr = libc.Xmalloc(tls, uint64(shdr_size))
  9593. if shdr == libc.UintptrFromInt32(0) {
  9594. return -int32(1)
  9595. }
  9596. /* Load section header table. */
  9597. if libc.Xpread(tls, fd, shdr, uint64(shdr_size), libc.Int64FromUint64((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shoff)) != libc.Int64FromUint32(shdr_size) {
  9598. goto done
  9599. }
  9600. /*
  9601. * Find the symbol table entry and it's corresponding
  9602. * string table entry. Version 1.1 of the ABI states
  9603. * that there is only one symbol table but that this
  9604. * could change in the future.
  9605. */
  9606. i = 0
  9607. for {
  9608. if !(i < libc.Int32FromUint16((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shnum)) {
  9609. break
  9610. }
  9611. if (*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_type == uint32(m_SHT_SYMTAB) {
  9612. if (*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_link >= uint32((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shnum) {
  9613. goto done
  9614. }
  9615. symoff = (*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_offset
  9616. symsize = uint32((*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_size)
  9617. symstroff = (*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr((*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_link)*64))).Fsh_offset
  9618. symstrsize = uint32((*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr((*(*TElf64_Shdr)(unsafe.Pointer(shdr + uintptr(i)*64))).Fsh_link)*64))).Fsh_size)
  9619. break
  9620. }
  9621. goto _1
  9622. _1:
  9623. ;
  9624. i++
  9625. }
  9626. /* Check for files too large to mmap. */
  9627. if libc.Int64FromUint32(symstrsize) > (*(*Tstat)(unsafe.Pointer(bp + 24640))).Fst_size {
  9628. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EFBIG)
  9629. goto done
  9630. }
  9631. /*
  9632. * Load string table into our address space. This gives us
  9633. * an easy way to randomly access all the strings, without
  9634. * making the memory allocation permanent as with malloc/free
  9635. * (i.e., munmap will return it to the system).
  9636. */
  9637. strtab = libc.Xmalloc(tls, uint64(symstrsize))
  9638. if strtab == libc.UintptrFromInt32(0) {
  9639. goto done
  9640. }
  9641. if libc.Xpread(tls, fd, strtab, uint64(symstrsize), libc.Int64FromUint64(symstroff)) != libc.Int64FromUint32(symstrsize) {
  9642. goto done
  9643. }
  9644. /*
  9645. * clean out any left-over information for all valid entries.
  9646. * Type and value defined to be 0 if not found; historical
  9647. * versions cleared other and desc as well. Also figure out
  9648. * the largest string length so don't read any more of the
  9649. * string table than we have to.
  9650. *
  9651. * XXX clearing anything other than n_type and n_value violates
  9652. * the semantics given in the man page.
  9653. */
  9654. nent = 0
  9655. p = list
  9656. for {
  9657. if !!(*(*uintptr)(unsafe.Pointer(p)) == uintptr(0) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p))))) == 0) {
  9658. break
  9659. }
  9660. (*Tnlist)(unsafe.Pointer(p)).Fn_type = uint8(0)
  9661. (*Tnlist)(unsafe.Pointer(p)).Fn_other = uint8(0)
  9662. (*Tnlist)(unsafe.Pointer(p)).Fn_desc = 0
  9663. (*Tnlist)(unsafe.Pointer(p)).Fn_value = uint64(0)
  9664. nent++
  9665. goto _2
  9666. _2:
  9667. ;
  9668. p += 24
  9669. }
  9670. /* Don't process any further if object is stripped. */
  9671. if symoff == uint64(0) {
  9672. goto done
  9673. }
  9674. if libc.Xlseek(tls, fd, libc.Int64FromUint64(symoff), 0) == int64(-int32(1)) {
  9675. nent = -int32(1)
  9676. goto done
  9677. }
  9678. for symsize > uint32(0) && nent > 0 {
  9679. if uint64(symsize) < libc.Uint64FromInt64(24576) {
  9680. v3 = uint64(symsize)
  9681. } else {
  9682. v3 = libc.Uint64FromInt64(24576)
  9683. }
  9684. cc = libc.Int32FromUint64(v3)
  9685. if libc.Xread(tls, fd, bp, libc.Uint64FromInt32(cc)) != int64(cc) {
  9686. break
  9687. }
  9688. symsize -= libc.Uint32FromInt32(cc)
  9689. s = bp
  9690. for {
  9691. if !(cc > 0 && nent > 0) {
  9692. break
  9693. }
  9694. name = strtab + uintptr((*TElf64_Sym)(unsafe.Pointer(s)).Fst_name)
  9695. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(name))) == int32('\000') {
  9696. goto _4
  9697. }
  9698. size = symstrsize - (*TElf64_Sym)(unsafe.Pointer(s)).Fst_name
  9699. p = list
  9700. for {
  9701. if !!(*(*uintptr)(unsafe.Pointer(p)) == uintptr(0) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p))))) == 0) {
  9702. break
  9703. }
  9704. 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 {
  9705. _elf_sym_to_nlist(tls, p, s, shdr, libc.Int32FromUint16((*(*TElf64_Ehdr)(unsafe.Pointer(bp + 24576))).Fe_shnum))
  9706. nent--
  9707. v6 = nent
  9708. if v6 <= 0 {
  9709. break
  9710. }
  9711. }
  9712. goto _5
  9713. _5:
  9714. ;
  9715. p += 24
  9716. }
  9717. goto _4
  9718. _4:
  9719. ;
  9720. s += 24
  9721. cc = TElf64_Sword(uint64(cc) - libc.Uint64FromInt64(24))
  9722. }
  9723. }
  9724. goto done
  9725. done:
  9726. ;
  9727. errsave = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9728. libc.Xfree(tls, strtab)
  9729. libc.Xfree(tls, shdr)
  9730. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = errsave
  9731. return nent
  9732. }
  9733. func Xnlist(tls *libc.TLS, name uintptr, list uintptr) (r int32) {
  9734. bp := tls.Alloc(16)
  9735. defer tls.Free(16)
  9736. var fd, n int32
  9737. _, _ = fd, n
  9738. if list == libc.UintptrFromInt32(0) {
  9739. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  9740. return -int32(1)
  9741. }
  9742. fd = libc.Xopen(tls, name, m_O_RDONLY1, libc.VaList(bp+8, 0))
  9743. if fd < 0 {
  9744. return -int32(1)
  9745. }
  9746. n = X__fdnlist(tls, fd, list)
  9747. libc.Xclose(tls, fd)
  9748. return n
  9749. }
  9750. const m_O_CREAT3 = 64
  9751. const m_O_NONBLOCK3 = 2048
  9752. const m_O_TRUNC3 = 512
  9753. const m_O_WRONLY1 = 1
  9754. type Tpidfh = struct {
  9755. Fpf_fd int32
  9756. Fpf_path uintptr
  9757. Fpf_dev Tdev_t
  9758. Fpf_ino Tino_t
  9759. }
  9760. func _pidfile_verify(tls *libc.TLS, pfh uintptr) (r int32) {
  9761. bp := tls.Alloc(128)
  9762. defer tls.Free(128)
  9763. var _ /* sb at bp+0 */ Tstat
  9764. if pfh == libc.UintptrFromInt32(0) || (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd == -int32(1) {
  9765. return int32(m_EINVAL)
  9766. }
  9767. /*
  9768. * Check remembered descriptor.
  9769. */
  9770. if libc.Xfstat(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd, bp) == -int32(1) {
  9771. return *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9772. }
  9773. 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 {
  9774. return int32(m_EINVAL)
  9775. }
  9776. return 0
  9777. }
  9778. func _pidfile_read(tls *libc.TLS, path uintptr, pidptr uintptr) (r int32) {
  9779. bp := tls.Alloc(32)
  9780. defer tls.Free(32)
  9781. var error1, fd, i int32
  9782. var _ /* buf at bp+0 */ [16]uint8
  9783. var _ /* endptr at bp+16 */ uintptr
  9784. _, _, _ = error1, fd, i
  9785. fd = libc.Xopen(tls, path, m_O_RDONLY1, 0)
  9786. if fd == -int32(1) {
  9787. return *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9788. }
  9789. i = int32(libc.Xread(tls, fd, bp, libc.Uint64FromInt64(16)-libc.Uint64FromInt32(1)))
  9790. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) /* Remember errno in case close() wants to change it. */
  9791. libc.Xclose(tls, fd)
  9792. if i == -int32(1) {
  9793. return error1
  9794. } else {
  9795. if i == 0 {
  9796. return int32(m_EAGAIN)
  9797. }
  9798. }
  9799. (*(*[16]uint8)(unsafe.Pointer(bp)))[i] = uint8('\000')
  9800. *(*Tpid_t)(unsafe.Pointer(pidptr)) = int32(libc.Xstrtol(tls, bp, bp+16, int32(10)))
  9801. if *(*uintptr)(unsafe.Pointer(bp + 16)) != bp+uintptr(i) {
  9802. return int32(m_EINVAL)
  9803. }
  9804. return 0
  9805. }
  9806. func Xpidfile_open(tls *libc.TLS, path uintptr, mode Tmode_t, pidptr uintptr) (r uintptr) {
  9807. bp := tls.Alloc(160)
  9808. defer tls.Free(160)
  9809. var count, error1, fd, len1, v2 int32
  9810. var pfh uintptr
  9811. var v3 bool
  9812. var _ /* rqtp at bp+128 */ Ttimespec
  9813. var _ /* sb at bp+0 */ Tstat
  9814. _, _, _, _, _, _, _ = count, error1, fd, len1, pfh, v2, v3
  9815. pfh = libc.Xmalloc(tls, uint64(32))
  9816. if pfh == libc.UintptrFromInt32(0) {
  9817. return libc.UintptrFromInt32(0)
  9818. }
  9819. if path == libc.UintptrFromInt32(0) {
  9820. len1 = libc.Xasprintf(tls, pfh+8, __ccgo_ts+310, libc.VaList(bp+152, Xgetprogname(tls)))
  9821. if len1 < 0 {
  9822. libc.Xfree(tls, pfh)
  9823. return libc.UintptrFromInt32(0)
  9824. }
  9825. } else {
  9826. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path = libc.Xstrdup(tls, path)
  9827. }
  9828. /*
  9829. * Open the PID file and obtain exclusive lock.
  9830. * We truncate PID file here only to remove old PID immediately,
  9831. * PID file will be truncated again in pidfile_write(), so
  9832. * pidfile_write() can be called multiple times.
  9833. */
  9834. fd = Xflopen(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path, libc.Int32FromInt32(m_O_WRONLY1)|libc.Int32FromInt32(m_O_CREAT3)|libc.Int32FromInt32(m_O_TRUNC3)|libc.Int32FromInt32(m_O_NONBLOCK3), libc.VaList(bp+152, mode))
  9835. if fd == -int32(1) {
  9836. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EAGAIN) {
  9837. if pidptr == libc.UintptrFromInt32(0) {
  9838. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EEXIST)
  9839. } else {
  9840. count = int32(20)
  9841. (*(*Ttimespec)(unsafe.Pointer(bp + 128))).Ftv_sec = 0
  9842. (*(*Ttimespec)(unsafe.Pointer(bp + 128))).Ftv_nsec = int64(5000000)
  9843. for {
  9844. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = _pidfile_read(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path, pidptr)
  9845. if v3 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) != int32(m_EAGAIN); !v3 {
  9846. count--
  9847. v2 = count
  9848. }
  9849. if v3 || v2 == 0 {
  9850. break
  9851. }
  9852. libc.Xnanosleep(tls, bp+128, uintptr(0))
  9853. goto _1
  9854. _1:
  9855. }
  9856. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EAGAIN) {
  9857. *(*Tpid_t)(unsafe.Pointer(pidptr)) = -int32(1)
  9858. }
  9859. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == 0 || *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EAGAIN) {
  9860. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EEXIST)
  9861. }
  9862. }
  9863. }
  9864. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9865. libc.Xfree(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  9866. libc.Xfree(tls, pfh)
  9867. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9868. return libc.UintptrFromInt32(0)
  9869. }
  9870. /*
  9871. * Remember file information, so in pidfile_write() we are sure we write
  9872. * to the proper descriptor.
  9873. */
  9874. if libc.Xfstat(tls, fd, bp) == -int32(1) {
  9875. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9876. libc.Xunlink(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  9877. libc.Xfree(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  9878. libc.Xclose(tls, fd)
  9879. libc.Xfree(tls, pfh)
  9880. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9881. return libc.UintptrFromInt32(0)
  9882. }
  9883. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd = fd
  9884. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_dev = (*(*Tstat)(unsafe.Pointer(bp))).Fst_dev
  9885. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_ino = (*(*Tstat)(unsafe.Pointer(bp))).Fst_ino
  9886. return pfh
  9887. }
  9888. func Xpidfile_write(tls *libc.TLS, pfh uintptr) (r int32) {
  9889. bp := tls.Alloc(32)
  9890. defer tls.Free(32)
  9891. var error1, fd int32
  9892. var _ /* pidstr at bp+0 */ [16]uint8
  9893. _, _ = error1, fd
  9894. /*
  9895. * Check remembered descriptor, so we don't overwrite some other
  9896. * file if pidfile was closed and descriptor reused.
  9897. */
  9898. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = _pidfile_verify(tls, pfh)
  9899. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) != 0 {
  9900. /*
  9901. * Don't close descriptor, because we are not sure if it's ours.
  9902. */
  9903. return -int32(1)
  9904. }
  9905. fd = (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd
  9906. /*
  9907. * Truncate PID file, so multiple calls of pidfile_write() are allowed.
  9908. */
  9909. if libc.Xftruncate(tls, fd, 0) == -int32(1) {
  9910. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9911. __pidfile_remove(tls, pfh, 0)
  9912. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9913. return -int32(1)
  9914. }
  9915. libc.X__builtin_snprintf(tls, bp, uint64(16), __ccgo_ts+326, libc.VaList(bp+24, libc.Xgetpid(tls)))
  9916. if libc.Xpwrite(tls, fd, bp, libc.Xstrlen(tls, bp), 0) != libc.Int64FromUint64(libc.Xstrlen(tls, bp)) {
  9917. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9918. __pidfile_remove(tls, pfh, 0)
  9919. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9920. return -int32(1)
  9921. }
  9922. return 0
  9923. }
  9924. func Xpidfile_close(tls *libc.TLS, pfh uintptr) (r int32) {
  9925. var error1 int32
  9926. _ = error1
  9927. error1 = _pidfile_verify(tls, pfh)
  9928. if error1 != 0 {
  9929. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9930. return -int32(1)
  9931. }
  9932. if libc.Xclose(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd) == -int32(1) {
  9933. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9934. }
  9935. libc.Xfree(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  9936. libc.Xfree(tls, pfh)
  9937. if error1 != 0 {
  9938. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9939. return -int32(1)
  9940. }
  9941. return 0
  9942. }
  9943. func __pidfile_remove(tls *libc.TLS, pfh uintptr, freeit int32) (r int32) {
  9944. var error1 int32
  9945. _ = error1
  9946. error1 = _pidfile_verify(tls, pfh)
  9947. if error1 != 0 {
  9948. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9949. return -int32(1)
  9950. }
  9951. if libc.Xunlink(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path) == -int32(1) {
  9952. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9953. }
  9954. if libc.Xclose(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd) == -int32(1) {
  9955. if error1 == 0 {
  9956. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  9957. }
  9958. }
  9959. if freeit != 0 {
  9960. libc.Xfree(tls, (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_path)
  9961. libc.Xfree(tls, pfh)
  9962. } else {
  9963. (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd = -int32(1)
  9964. }
  9965. if error1 != 0 {
  9966. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = error1
  9967. return -int32(1)
  9968. }
  9969. return 0
  9970. }
  9971. func Xpidfile_remove(tls *libc.TLS, pfh uintptr) (r int32) {
  9972. return __pidfile_remove(tls, pfh, int32(1))
  9973. }
  9974. func Xpidfile_fileno(tls *libc.TLS, pfh uintptr) (r int32) {
  9975. if pfh == libc.UintptrFromInt32(0) || (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd == -int32(1) {
  9976. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  9977. return -int32(1)
  9978. }
  9979. return (*Tpidfh)(unsafe.Pointer(pfh)).Fpf_fd
  9980. }
  9981. const m_SPT_MAXTITLE = 255
  9982. const m___bool_true_false_are_defined = 1
  9983. const m_bool = "_Bool"
  9984. const m_false = 0
  9985. const m_true = 1
  9986. /*
  9987. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  9988. *
  9989. * Redistribution and use in source and binary forms, with or without
  9990. * modification, are permitted provided that the following conditions
  9991. * are met:
  9992. * 1. Redistributions of source code must retain the above copyright
  9993. * notice, this list of conditions and the following disclaimer.
  9994. * 2. Redistributions in binary form must reproduce the above copyright
  9995. * notice, this list of conditions and the following disclaimer in the
  9996. * documentation and/or other materials provided with the distribution.
  9997. * 3. The name of the author may not be used to endorse or promote products
  9998. * derived from this software without specific prior written permission.
  9999. *
  10000. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  10001. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  10002. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  10003. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  10004. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  10005. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  10006. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  10007. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  10008. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  10009. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  10010. */
  10011. /*
  10012. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  10013. *
  10014. * Redistribution and use in source and binary forms, with or without
  10015. * modification, are permitted provided that the following conditions
  10016. * are met:
  10017. * 1. Redistributions of source code must retain the above copyright
  10018. * notice, this list of conditions and the following disclaimer.
  10019. * 2. Redistributions in binary form must reproduce the above copyright
  10020. * notice, this list of conditions and the following disclaimer in the
  10021. * documentation and/or other materials provided with the distribution.
  10022. * 3. The name of the author may not be used to endorse or promote products
  10023. * derived from this software without specific prior written permission.
  10024. *
  10025. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  10026. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  10027. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  10028. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  10029. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  10030. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  10031. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  10032. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  10033. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  10034. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  10035. */
  10036. /* Clang expands this to 1 if an identifier is *not* reserved. */
  10037. /*
  10038. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  10039. * musl, try to handle this gracefully.
  10040. */
  10041. /* Copyright (C) 1992-2024 Free Software Foundation, Inc.
  10042. Copyright The GNU Toolchain Authors.
  10043. This file is part of the GNU C Library.
  10044. The GNU C Library is free software; you can redistribute it and/or
  10045. modify it under the terms of the GNU Lesser General Public
  10046. License as published by the Free Software Foundation; either
  10047. version 2.1 of the License, or (at your option) any later version.
  10048. The GNU C Library is distributed in the hope that it will be useful,
  10049. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10050. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10051. Lesser General Public License for more details.
  10052. You should have received a copy of the GNU Lesser General Public
  10053. License along with the GNU C Library; if not, see
  10054. <https://www.gnu.org/licenses/>. */
  10055. var _SPT struct {
  10056. Farg0 uintptr
  10057. Fbase uintptr
  10058. Fend uintptr
  10059. Fnul uintptr
  10060. Fwarned uint8
  10061. Freset uint8
  10062. Ferror1 int32
  10063. }
  10064. func _spt_min(tls *libc.TLS, a Tsize_t, b Tsize_t) (r Tsize_t) {
  10065. var v1 uint64
  10066. _ = v1
  10067. if a < b {
  10068. v1 = a
  10069. } else {
  10070. v1 = b
  10071. }
  10072. return v1
  10073. }
  10074. // C documentation
  10075. //
  10076. // /*
  10077. // * For discussion on the portability of the various methods, see
  10078. // * https://lists.freebsd.org/pipermail/freebsd-stable/2008-June/043136.html
  10079. // */
  10080. func _spt_clearenv(tls *libc.TLS) (r int32) {
  10081. return libc.Xclearenv(tls)
  10082. }
  10083. func _spt_copyenv(tls *libc.TLS, envc int32, envp uintptr) (r int32) {
  10084. var envcopy, eq uintptr
  10085. var envsize, error1, i int32
  10086. _, _, _, _, _ = envcopy, envsize, eq, error1, i
  10087. if libc.Xenviron != envp {
  10088. return 0
  10089. }
  10090. /* Make a copy of the old environ array of pointers, in case
  10091. * clearenv() or setenv() is implemented to free the internal
  10092. * environ array, because we will need to access the old environ
  10093. * contents to make the new copy. */
  10094. envsize = libc.Int32FromUint64(libc.Uint64FromInt32(envc+libc.Int32FromInt32(1)) * uint64(8))
  10095. envcopy = libc.Xmalloc(tls, libc.Uint64FromInt32(envsize))
  10096. if envcopy == libc.UintptrFromInt32(0) {
  10097. return *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10098. }
  10099. libc.Xmemcpy(tls, envcopy, envp, libc.Uint64FromInt32(envsize))
  10100. error1 = _spt_clearenv(tls)
  10101. if error1 != 0 {
  10102. libc.Xenviron = envp
  10103. libc.Xfree(tls, envcopy)
  10104. return error1
  10105. }
  10106. i = 0
  10107. for {
  10108. if !(*(*uintptr)(unsafe.Pointer(envcopy + uintptr(i)*8)) != 0) {
  10109. break
  10110. }
  10111. eq = libc.Xstrchr(tls, *(*uintptr)(unsafe.Pointer(envcopy + uintptr(i)*8)), int32('='))
  10112. if eq == libc.UintptrFromInt32(0) {
  10113. goto _1
  10114. }
  10115. *(*uint8)(unsafe.Pointer(eq)) = uint8('\000')
  10116. if libc.Xsetenv(tls, *(*uintptr)(unsafe.Pointer(envcopy + uintptr(i)*8)), eq+uintptr(1), int32(1)) < 0 {
  10117. error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10118. }
  10119. *(*uint8)(unsafe.Pointer(eq)) = uint8('=')
  10120. if error1 != 0 {
  10121. /* Because the old environ might not be available
  10122. * anymore we will make do with the shallow copy. */
  10123. libc.Xenviron = envcopy
  10124. return error1
  10125. }
  10126. goto _1
  10127. _1:
  10128. ;
  10129. i++
  10130. }
  10131. /* Dispose of the shallow copy, now that we've finished transfering
  10132. * the old environment. */
  10133. libc.Xfree(tls, envcopy)
  10134. return 0
  10135. }
  10136. func _spt_copyargs(tls *libc.TLS, argc int32, argv uintptr) (r int32) {
  10137. var i int32
  10138. var tmp uintptr
  10139. _, _ = i, tmp
  10140. i = int32(1)
  10141. for {
  10142. if !(i < argc || i >= argc && *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) != 0) {
  10143. break
  10144. }
  10145. if *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) == libc.UintptrFromInt32(0) {
  10146. goto _1
  10147. }
  10148. tmp = libc.Xstrdup(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))
  10149. if tmp == libc.UintptrFromInt32(0) {
  10150. return *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10151. }
  10152. *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) = tmp
  10153. goto _1
  10154. _1:
  10155. ;
  10156. i++
  10157. }
  10158. return 0
  10159. }
  10160. func Xsetproctitle_init(tls *libc.TLS, argc int32, argv uintptr, envp uintptr) {
  10161. var base, end, nul, tmp uintptr
  10162. var envc, error1, i int32
  10163. _, _, _, _, _, _, _ = base, end, envc, error1, i, nul, tmp
  10164. /* Try to make sure we got called with main() arguments. */
  10165. if argc < 0 {
  10166. return
  10167. }
  10168. base = *(*uintptr)(unsafe.Pointer(argv))
  10169. if base == libc.UintptrFromInt32(0) {
  10170. return
  10171. }
  10172. nul = base + uintptr(libc.Xstrlen(tls, base))
  10173. end = nul + uintptr(1)
  10174. i = 0
  10175. for {
  10176. if !(i < argc || i >= argc && *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) != 0) {
  10177. break
  10178. }
  10179. if *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) == libc.UintptrFromInt32(0) || *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) != end {
  10180. goto _1
  10181. }
  10182. end = *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) + uintptr(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))) + uintptr(1)
  10183. goto _1
  10184. _1:
  10185. ;
  10186. i++
  10187. }
  10188. i = 0
  10189. for {
  10190. if !(*(*uintptr)(unsafe.Pointer(envp + uintptr(i)*8)) != 0) {
  10191. break
  10192. }
  10193. if *(*uintptr)(unsafe.Pointer(envp + uintptr(i)*8)) != end {
  10194. goto _2
  10195. }
  10196. end = *(*uintptr)(unsafe.Pointer(envp + uintptr(i)*8)) + uintptr(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(envp + uintptr(i)*8)))) + uintptr(1)
  10197. goto _2
  10198. _2:
  10199. ;
  10200. i++
  10201. }
  10202. envc = i
  10203. _SPT.Farg0 = libc.Xstrdup(tls, *(*uintptr)(unsafe.Pointer(argv)))
  10204. if _SPT.Farg0 == libc.UintptrFromInt32(0) {
  10205. _SPT.Ferror1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10206. return
  10207. }
  10208. tmp = libc.Xstrdup(tls, Xgetprogname(tls))
  10209. if tmp == libc.UintptrFromInt32(0) {
  10210. _SPT.Ferror1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10211. return
  10212. }
  10213. Xsetprogname(tls, tmp)
  10214. error1 = _spt_copyenv(tls, envc, envp)
  10215. if error1 != 0 {
  10216. _SPT.Ferror1 = error1
  10217. return
  10218. }
  10219. error1 = _spt_copyargs(tls, argc, argv)
  10220. if error1 != 0 {
  10221. _SPT.Ferror1 = error1
  10222. return
  10223. }
  10224. _SPT.Fnul = nul
  10225. _SPT.Fbase = base
  10226. _SPT.Fend = end
  10227. }
  10228. func Xsetproctitle_impl(tls *libc.TLS, fmt uintptr, va uintptr) {
  10229. bp := tls.Alloc(272)
  10230. defer tls.Free(272)
  10231. var ap Tva_list
  10232. var len1 int32
  10233. var nul, v1 uintptr
  10234. var _ /* buf at bp+0 */ [256]uint8
  10235. _, _, _, _ = ap, len1, nul, v1
  10236. if _SPT.Fbase == libc.UintptrFromInt32(0) {
  10237. if !(_SPT.Fwarned != 0) {
  10238. libc.Xwarnx(tls, __ccgo_ts+329, 0)
  10239. _SPT.Fwarned = uint8(m_true)
  10240. }
  10241. return
  10242. }
  10243. if fmt != 0 {
  10244. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(fmt))) == int32('-') {
  10245. /* Skip program name prefix. */
  10246. fmt++
  10247. len1 = 0
  10248. } else {
  10249. /* Print program name heading for grep. */
  10250. libc.X__builtin_snprintf(tls, bp, uint64(256), __ccgo_ts+14, libc.VaList(bp+264, Xgetprogname(tls)))
  10251. len1 = libc.Int32FromUint64(libc.Xstrlen(tls, bp))
  10252. }
  10253. ap = va
  10254. len1 += libc.X__builtin_vsnprintf(tls, bp+uintptr(len1), uint64(256)-libc.Uint64FromInt32(len1), fmt, ap)
  10255. _ = ap
  10256. } else {
  10257. len1 = libc.X__builtin_snprintf(tls, bp, uint64(256), __ccgo_ts+427, libc.VaList(bp+264, _SPT.Farg0))
  10258. }
  10259. if len1 <= 0 {
  10260. _SPT.Ferror1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  10261. return
  10262. }
  10263. if !(_SPT.Freset != 0) {
  10264. libc.Xmemset(tls, _SPT.Fbase, 0, libc.Uint64FromInt64(int64(_SPT.Fend)-int64(_SPT.Fbase)))
  10265. _SPT.Freset = uint8(m_true)
  10266. } else {
  10267. libc.Xmemset(tls, _SPT.Fbase, 0, _spt_min(tls, uint64(256), libc.Uint64FromInt64(int64(_SPT.Fend)-int64(_SPT.Fbase))))
  10268. }
  10269. len1 = libc.Int32FromUint64(_spt_min(tls, libc.Uint64FromInt32(len1), _spt_min(tls, uint64(256), libc.Uint64FromInt64(int64(_SPT.Fend)-int64(_SPT.Fbase)))-uint64(1)))
  10270. libc.Xmemcpy(tls, _SPT.Fbase, bp, libc.Uint64FromInt32(len1))
  10271. nul = _SPT.Fbase + uintptr(len1)
  10272. if nul < _SPT.Fnul {
  10273. *(*uint8)(unsafe.Pointer(_SPT.Fnul)) = uint8('.')
  10274. } else {
  10275. if nul == _SPT.Fnul && nul+uintptr(1) < _SPT.Fend {
  10276. *(*uint8)(unsafe.Pointer(_SPT.Fnul)) = uint8(' ')
  10277. nul++
  10278. v1 = nul
  10279. *(*uint8)(unsafe.Pointer(v1)) = uint8('\000')
  10280. }
  10281. }
  10282. }
  10283. func Xgetprogname(tls *libc.TLS) (r uintptr) {
  10284. if libc.Xprogram_invocation_short_name == libc.UintptrFromInt32(0) {
  10285. libc.Xprogram_invocation_short_name = libc.Xprogram_invocation_short_name
  10286. }
  10287. return libc.Xprogram_invocation_short_name
  10288. }
  10289. func Xsetprogname(tls *libc.TLS, progname uintptr) {
  10290. var i Tsize_t
  10291. _ = i
  10292. i = libc.Xstrlen(tls, progname)
  10293. for {
  10294. if !(i > uint64(0)) {
  10295. break
  10296. }
  10297. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(progname + uintptr(i-uint64(1))))) == int32('/') {
  10298. libc.Xprogram_invocation_short_name = progname + uintptr(i)
  10299. return
  10300. }
  10301. goto _1
  10302. _1:
  10303. ;
  10304. i--
  10305. }
  10306. libc.Xprogram_invocation_short_name = progname
  10307. }
  10308. const m_GID_SZ = 251
  10309. const m_GNMLEN = 32
  10310. const m_GNM_SZ = 251
  10311. const m_INVALID = 2
  10312. const m_UID_SZ = 317
  10313. const m_UNMLEN = 32
  10314. const m_UNM_SZ = 317
  10315. const m_VALID = 1
  10316. const m__PW_BUF_LEN = 1024
  10317. type Tgroup = struct {
  10318. Fgr_name uintptr
  10319. Fgr_passwd uintptr
  10320. Fgr_gid Tgid_t
  10321. Fgr_mem uintptr
  10322. }
  10323. type Tpasswd = struct {
  10324. Fpw_name uintptr
  10325. Fpw_passwd uintptr
  10326. Fpw_uid Tuid_t
  10327. Fpw_gid Tgid_t
  10328. Fpw_gecos uintptr
  10329. Fpw_dir uintptr
  10330. Fpw_shell uintptr
  10331. }
  10332. /*
  10333. * Constants and data structures used to implement group and password file
  10334. * caches. Name lengths have been chosen to be as large as those supported
  10335. * by the passwd and group files as well as the standard archive formats.
  10336. * CACHE SIZES MUST BE PRIME
  10337. */
  10338. /*
  10339. * Node structures used in the user, group, uid, and gid caches.
  10340. */
  10341. type TUIDC = struct {
  10342. Fvalid int32
  10343. Fname [32]uint8
  10344. Fuid Tuid_t
  10345. }
  10346. /*
  10347. * Constants and data structures used to implement group and password file
  10348. * caches. Name lengths have been chosen to be as large as those supported
  10349. * by the passwd and group files as well as the standard archive formats.
  10350. * CACHE SIZES MUST BE PRIME
  10351. */
  10352. /*
  10353. * Node structures used in the user, group, uid, and gid caches.
  10354. */
  10355. type Tuidc = TUIDC
  10356. type TGIDC = struct {
  10357. Fvalid int32
  10358. Fname [32]uint8
  10359. Fgid Tgid_t
  10360. }
  10361. type Tgidc = TGIDC
  10362. /*
  10363. * Routines that control user, group, uid and gid caches.
  10364. * Traditional passwd/group cache routines perform quite poorly with
  10365. * archives. The chances of hitting a valid lookup with an archive is quite a
  10366. * bit worse than with files already resident on the file system. These misses
  10367. * create a MAJOR performance cost. To adress this problem, these routines
  10368. * cache both hits and misses.
  10369. */
  10370. var _uidtb uintptr /* uid to name cache */
  10371. var _gidtb uintptr /* gid to name cache */
  10372. var _usrtb uintptr /* user name to uid cache */
  10373. var _grptb uintptr /* group name to gid cache */
  10374. func _st_hash(tls *libc.TLS, name uintptr, len1 Tsize_t, tabsz int32) (r Tu_int) {
  10375. var key Tu_int
  10376. var v1 Tsize_t
  10377. var v2 uintptr
  10378. _, _, _ = key, v1, v2
  10379. key = uint32(0)
  10380. for {
  10381. v1 = len1
  10382. len1--
  10383. if !(v1 != 0) {
  10384. break
  10385. }
  10386. v2 = name
  10387. name++
  10388. key += uint32(*(*uint8)(unsafe.Pointer(v2)))
  10389. key = key<<libc.Int32FromInt32(8) | key>>libc.Int32FromInt32(24)
  10390. }
  10391. return key % libc.Uint32FromInt32(tabsz)
  10392. }
  10393. // C documentation
  10394. //
  10395. // /*
  10396. // * uidtb_start
  10397. // * creates an an empty uidtb
  10398. // * Return:
  10399. // * 0 if ok, -1 otherwise
  10400. // */
  10401. func _uidtb_start(tls *libc.TLS) (r int32) {
  10402. var v1 uintptr
  10403. _ = v1
  10404. if _uidtb != libc.UintptrFromInt32(0) {
  10405. return 0
  10406. }
  10407. if _fail != 0 {
  10408. return -int32(1)
  10409. }
  10410. v1 = libc.Xcalloc(tls, uint64(m_UID_SZ), uint64(8))
  10411. _uidtb = v1
  10412. if v1 == libc.UintptrFromInt32(0) {
  10413. _fail++
  10414. return -int32(1)
  10415. }
  10416. return 0
  10417. }
  10418. var _fail int32
  10419. // C documentation
  10420. //
  10421. // /*
  10422. // * gidtb_start
  10423. // * creates an an empty gidtb
  10424. // * Return:
  10425. // * 0 if ok, -1 otherwise
  10426. // */
  10427. func _gidtb_start(tls *libc.TLS) (r int32) {
  10428. var v1 uintptr
  10429. _ = v1
  10430. if _gidtb != libc.UintptrFromInt32(0) {
  10431. return 0
  10432. }
  10433. if _fail1 != 0 {
  10434. return -int32(1)
  10435. }
  10436. v1 = libc.Xcalloc(tls, uint64(m_GID_SZ), uint64(8))
  10437. _gidtb = v1
  10438. if v1 == libc.UintptrFromInt32(0) {
  10439. _fail1++
  10440. return -int32(1)
  10441. }
  10442. return 0
  10443. }
  10444. var _fail1 int32
  10445. // C documentation
  10446. //
  10447. // /*
  10448. // * usrtb_start
  10449. // * creates an an empty usrtb
  10450. // * Return:
  10451. // * 0 if ok, -1 otherwise
  10452. // */
  10453. func _usrtb_start(tls *libc.TLS) (r int32) {
  10454. var v1 uintptr
  10455. _ = v1
  10456. if _usrtb != libc.UintptrFromInt32(0) {
  10457. return 0
  10458. }
  10459. if _fail2 != 0 {
  10460. return -int32(1)
  10461. }
  10462. v1 = libc.Xcalloc(tls, uint64(m_UNM_SZ), uint64(8))
  10463. _usrtb = v1
  10464. if v1 == libc.UintptrFromInt32(0) {
  10465. _fail2++
  10466. return -int32(1)
  10467. }
  10468. return 0
  10469. }
  10470. var _fail2 int32
  10471. // C documentation
  10472. //
  10473. // /*
  10474. // * grptb_start
  10475. // * creates an an empty grptb
  10476. // * Return:
  10477. // * 0 if ok, -1 otherwise
  10478. // */
  10479. func _grptb_start(tls *libc.TLS) (r int32) {
  10480. var v1 uintptr
  10481. _ = v1
  10482. if _grptb != libc.UintptrFromInt32(0) {
  10483. return 0
  10484. }
  10485. if _fail3 != 0 {
  10486. return -int32(1)
  10487. }
  10488. v1 = libc.Xcalloc(tls, uint64(m_GNM_SZ), uint64(8))
  10489. _grptb = v1
  10490. if v1 == libc.UintptrFromInt32(0) {
  10491. _fail3++
  10492. return -int32(1)
  10493. }
  10494. return 0
  10495. }
  10496. var _fail3 int32
  10497. // C documentation
  10498. //
  10499. // /*
  10500. // * user_from_uid()
  10501. // * caches the name (if any) for the uid. If noname clear, we always
  10502. // * return the stored name (if valid or invalid match).
  10503. // * We use a simple hash table.
  10504. // * Return:
  10505. // * Pointer to stored name (or a empty string)
  10506. // */
  10507. func Xuser_from_uid(tls *libc.TLS, uid Tuid_t, noname int32) (r uintptr) {
  10508. bp := tls.Alloc(1104)
  10509. defer tls.Free(1104)
  10510. var pptr, ptr, v1 uintptr
  10511. var _ /* pw at bp+48 */ uintptr
  10512. var _ /* pwbuf at bp+56 */ [1024]uint8
  10513. var _ /* pwstore at bp+0 */ Tpasswd
  10514. _, _, _ = pptr, ptr, v1
  10515. *(*uintptr)(unsafe.Pointer(bp + 48)) = libc.UintptrFromInt32(0)
  10516. ptr = libc.UintptrFromInt32(0)
  10517. if _uidtb != libc.UintptrFromInt32(0) || _uidtb_start(tls) == 0 {
  10518. /*
  10519. * see if we have this uid cached
  10520. */
  10521. pptr = _uidtb + uintptr(uid%libc.Uint32FromInt32(m_UID_SZ))*8
  10522. ptr = *(*uintptr)(unsafe.Pointer(pptr))
  10523. if ptr != libc.UintptrFromInt32(0) && (*TUIDC)(unsafe.Pointer(ptr)).Fvalid > 0 && (*TUIDC)(unsafe.Pointer(ptr)).Fuid == uid {
  10524. /*
  10525. * have an entry for this uid
  10526. */
  10527. if !(noname != 0) || (*TUIDC)(unsafe.Pointer(ptr)).Fvalid == int32(m_VALID) {
  10528. return ptr + 4
  10529. }
  10530. return libc.UintptrFromInt32(0)
  10531. }
  10532. if ptr == libc.UintptrFromInt32(0) {
  10533. v1 = libc.Xmalloc(tls, uint64(40))
  10534. ptr = v1
  10535. *(*uintptr)(unsafe.Pointer(pptr)) = v1
  10536. }
  10537. }
  10538. libc.Xgetpwuid_r(tls, uid, bp, bp+56, uint64(1024), bp+48)
  10539. if *(*uintptr)(unsafe.Pointer(bp + 48)) == libc.UintptrFromInt32(0) {
  10540. /*
  10541. * no match for this uid in the local password file
  10542. * a string that is the uid in numeric format
  10543. */
  10544. if ptr == libc.UintptrFromInt32(0) {
  10545. return libc.UintptrFromInt32(0)
  10546. }
  10547. (*TUIDC)(unsafe.Pointer(ptr)).Fuid = uid
  10548. libc.X__builtin_snprintf(tls, ptr+4, uint64(m_UNMLEN), __ccgo_ts+326, libc.VaList(bp+1088, uid))
  10549. (*TUIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_INVALID)
  10550. if noname != 0 {
  10551. return libc.UintptrFromInt32(0)
  10552. }
  10553. } else {
  10554. /*
  10555. * there is an entry for this uid in the password file
  10556. */
  10557. if ptr == libc.UintptrFromInt32(0) {
  10558. return (*Tpasswd)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48)))).Fpw_name
  10559. }
  10560. (*TUIDC)(unsafe.Pointer(ptr)).Fuid = uid
  10561. Xstrlcpy(tls, ptr+4, (*Tpasswd)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48)))).Fpw_name, uint64(32))
  10562. (*TUIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_VALID)
  10563. }
  10564. return ptr + 4
  10565. }
  10566. // C documentation
  10567. //
  10568. // /*
  10569. // * group_from_gid()
  10570. // * caches the name (if any) for the gid. If noname clear, we always
  10571. // * return the stored name (if valid or invalid match).
  10572. // * We use a simple hash table.
  10573. // * Return:
  10574. // * Pointer to stored name (or a empty string)
  10575. // */
  10576. func Xgroup_from_gid(tls *libc.TLS, gid Tgid_t, noname int32) (r uintptr) {
  10577. bp := tls.Alloc(2688)
  10578. defer tls.Free(2688)
  10579. var pptr, ptr, v1 uintptr
  10580. var _ /* gr at bp+32 */ uintptr
  10581. var _ /* grbuf at bp+40 */ [2624]uint8
  10582. var _ /* grstore at bp+0 */ Tgroup
  10583. _, _, _ = pptr, ptr, v1
  10584. *(*uintptr)(unsafe.Pointer(bp + 32)) = libc.UintptrFromInt32(0)
  10585. ptr = libc.UintptrFromInt32(0)
  10586. if _gidtb != libc.UintptrFromInt32(0) || _gidtb_start(tls) == 0 {
  10587. /*
  10588. * see if we have this gid cached
  10589. */
  10590. pptr = _gidtb + uintptr(gid%libc.Uint32FromInt32(m_GID_SZ))*8
  10591. ptr = *(*uintptr)(unsafe.Pointer(pptr))
  10592. if ptr != libc.UintptrFromInt32(0) && (*TGIDC)(unsafe.Pointer(ptr)).Fvalid > 0 && (*TGIDC)(unsafe.Pointer(ptr)).Fgid == gid {
  10593. /*
  10594. * have an entry for this gid
  10595. */
  10596. if !(noname != 0) || (*TGIDC)(unsafe.Pointer(ptr)).Fvalid == int32(m_VALID) {
  10597. return ptr + 4
  10598. }
  10599. return libc.UintptrFromInt32(0)
  10600. }
  10601. if ptr == libc.UintptrFromInt32(0) {
  10602. v1 = libc.Xmalloc(tls, uint64(40))
  10603. ptr = v1
  10604. *(*uintptr)(unsafe.Pointer(pptr)) = v1
  10605. }
  10606. }
  10607. libc.Xgetgrgid_r(tls, gid, bp, bp+40, uint64(2624), bp+32)
  10608. if *(*uintptr)(unsafe.Pointer(bp + 32)) == libc.UintptrFromInt32(0) {
  10609. /*
  10610. * no match for this gid in the local group file, put in
  10611. * a string that is the gid in numeric format
  10612. */
  10613. if ptr == libc.UintptrFromInt32(0) {
  10614. return libc.UintptrFromInt32(0)
  10615. }
  10616. (*TGIDC)(unsafe.Pointer(ptr)).Fgid = gid
  10617. libc.X__builtin_snprintf(tls, ptr+4, uint64(m_GNMLEN), __ccgo_ts+326, libc.VaList(bp+2672, gid))
  10618. (*TGIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_INVALID)
  10619. if noname != 0 {
  10620. return libc.UintptrFromInt32(0)
  10621. }
  10622. } else {
  10623. /*
  10624. * there is an entry for this group in the group file
  10625. */
  10626. if ptr == libc.UintptrFromInt32(0) {
  10627. return (*Tgroup)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32)))).Fgr_name
  10628. }
  10629. (*TGIDC)(unsafe.Pointer(ptr)).Fgid = gid
  10630. Xstrlcpy(tls, ptr+4, (*Tgroup)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32)))).Fgr_name, uint64(32))
  10631. (*TGIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_VALID)
  10632. }
  10633. return ptr + 4
  10634. }
  10635. // C documentation
  10636. //
  10637. // /*
  10638. // * uid_from_user()
  10639. // * caches the uid for a given user name. We use a simple hash table.
  10640. // * Return:
  10641. // * 0 if the user name is found (filling in uid), -1 otherwise
  10642. // */
  10643. func Xuid_from_user(tls *libc.TLS, name uintptr, uid uintptr) (r int32) {
  10644. bp := tls.Alloc(1088)
  10645. defer tls.Free(1088)
  10646. var namelen, v1 Tsize_t
  10647. var pptr, ptr, v3 uintptr
  10648. var v2 bool
  10649. var v4 Tuid_t
  10650. var _ /* pw at bp+48 */ uintptr
  10651. var _ /* pwbuf at bp+56 */ [1024]uint8
  10652. var _ /* pwstore at bp+0 */ Tpasswd
  10653. _, _, _, _, _, _, _ = namelen, pptr, ptr, v1, v2, v3, v4
  10654. *(*uintptr)(unsafe.Pointer(bp + 48)) = libc.UintptrFromInt32(0)
  10655. ptr = libc.UintptrFromInt32(0)
  10656. /*
  10657. * return -1 for mangled names
  10658. */
  10659. if v2 = name == libc.UintptrFromInt32(0); !v2 {
  10660. v1 = libc.Xstrlen(tls, name)
  10661. namelen = v1
  10662. }
  10663. if v2 || v1 == uint64(0) {
  10664. return -int32(1)
  10665. }
  10666. if _usrtb != libc.UintptrFromInt32(0) || _usrtb_start(tls) == 0 {
  10667. /*
  10668. * look up in hash table, if found and valid return the uid,
  10669. * if found and invalid, return a -1
  10670. */
  10671. pptr = _usrtb + uintptr(_st_hash(tls, name, namelen, int32(m_UNM_SZ)))*8
  10672. ptr = *(*uintptr)(unsafe.Pointer(pptr))
  10673. if ptr != libc.UintptrFromInt32(0) && (*TUIDC)(unsafe.Pointer(ptr)).Fvalid > 0 && libc.Xstrcmp(tls, name, ptr+4) == 0 {
  10674. if (*TUIDC)(unsafe.Pointer(ptr)).Fvalid == int32(m_INVALID) {
  10675. return -int32(1)
  10676. }
  10677. *(*Tuid_t)(unsafe.Pointer(uid)) = (*TUIDC)(unsafe.Pointer(ptr)).Fuid
  10678. return 0
  10679. }
  10680. if ptr == libc.UintptrFromInt32(0) {
  10681. v3 = libc.Xmalloc(tls, uint64(40))
  10682. ptr = v3
  10683. *(*uintptr)(unsafe.Pointer(pptr)) = v3
  10684. }
  10685. }
  10686. /*
  10687. * no match, look it up, if no match store it as an invalid entry,
  10688. * or store the matching uid
  10689. */
  10690. libc.Xgetpwnam_r(tls, name, bp, bp+56, uint64(1024), bp+48)
  10691. if ptr == libc.UintptrFromInt32(0) {
  10692. if *(*uintptr)(unsafe.Pointer(bp + 48)) == libc.UintptrFromInt32(0) {
  10693. return -int32(1)
  10694. }
  10695. *(*Tuid_t)(unsafe.Pointer(uid)) = (*Tpasswd)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48)))).Fpw_uid
  10696. return 0
  10697. }
  10698. Xstrlcpy(tls, ptr+4, name, uint64(32))
  10699. if *(*uintptr)(unsafe.Pointer(bp + 48)) == libc.UintptrFromInt32(0) {
  10700. (*TUIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_INVALID)
  10701. return -int32(1)
  10702. }
  10703. (*TUIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_VALID)
  10704. v4 = (*Tpasswd)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48)))).Fpw_uid
  10705. (*TUIDC)(unsafe.Pointer(ptr)).Fuid = v4
  10706. *(*Tuid_t)(unsafe.Pointer(uid)) = v4
  10707. return 0
  10708. }
  10709. // C documentation
  10710. //
  10711. // /*
  10712. // * gid_from_group()
  10713. // * caches the gid for a given group name. We use a simple hash table.
  10714. // * Return:
  10715. // * 0 if the group name is found (filling in gid), -1 otherwise
  10716. // */
  10717. func Xgid_from_group(tls *libc.TLS, name uintptr, gid uintptr) (r int32) {
  10718. bp := tls.Alloc(2672)
  10719. defer tls.Free(2672)
  10720. var namelen, v1 Tsize_t
  10721. var pptr, ptr, v3 uintptr
  10722. var v2 bool
  10723. var v4 Tgid_t
  10724. var _ /* gr at bp+32 */ uintptr
  10725. var _ /* grbuf at bp+40 */ [2624]uint8
  10726. var _ /* grstore at bp+0 */ Tgroup
  10727. _, _, _, _, _, _, _ = namelen, pptr, ptr, v1, v2, v3, v4
  10728. *(*uintptr)(unsafe.Pointer(bp + 32)) = libc.UintptrFromInt32(0)
  10729. ptr = libc.UintptrFromInt32(0)
  10730. /*
  10731. * return -1 for mangled names
  10732. */
  10733. if v2 = name == libc.UintptrFromInt32(0); !v2 {
  10734. v1 = libc.Xstrlen(tls, name)
  10735. namelen = v1
  10736. }
  10737. if v2 || v1 == uint64(0) {
  10738. return -int32(1)
  10739. }
  10740. if _grptb != libc.UintptrFromInt32(0) || _grptb_start(tls) == 0 {
  10741. /*
  10742. * look up in hash table, if found and valid return the uid,
  10743. * if found and invalid, return a -1
  10744. */
  10745. pptr = _grptb + uintptr(_st_hash(tls, name, namelen, int32(m_GID_SZ)))*8
  10746. ptr = *(*uintptr)(unsafe.Pointer(pptr))
  10747. if ptr != libc.UintptrFromInt32(0) && (*TGIDC)(unsafe.Pointer(ptr)).Fvalid > 0 && libc.Xstrcmp(tls, name, ptr+4) == 0 {
  10748. if (*TGIDC)(unsafe.Pointer(ptr)).Fvalid == int32(m_INVALID) {
  10749. return -int32(1)
  10750. }
  10751. *(*Tgid_t)(unsafe.Pointer(gid)) = (*TGIDC)(unsafe.Pointer(ptr)).Fgid
  10752. return 0
  10753. }
  10754. if ptr == libc.UintptrFromInt32(0) {
  10755. v3 = libc.Xmalloc(tls, uint64(40))
  10756. ptr = v3
  10757. *(*uintptr)(unsafe.Pointer(pptr)) = v3
  10758. }
  10759. }
  10760. /*
  10761. * no match, look it up, if no match store it as an invalid entry,
  10762. * or store the matching gid
  10763. */
  10764. libc.Xgetgrnam_r(tls, name, bp, bp+40, uint64(2624), bp+32)
  10765. if ptr == libc.UintptrFromInt32(0) {
  10766. if *(*uintptr)(unsafe.Pointer(bp + 32)) == libc.UintptrFromInt32(0) {
  10767. return -int32(1)
  10768. }
  10769. *(*Tgid_t)(unsafe.Pointer(gid)) = (*Tgroup)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32)))).Fgr_gid
  10770. return 0
  10771. }
  10772. Xstrlcpy(tls, ptr+4, name, uint64(32))
  10773. if *(*uintptr)(unsafe.Pointer(bp + 32)) == libc.UintptrFromInt32(0) {
  10774. (*TGIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_INVALID)
  10775. return -int32(1)
  10776. }
  10777. (*TGIDC)(unsafe.Pointer(ptr)).Fvalid = int32(m_VALID)
  10778. v4 = (*Tgroup)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32)))).Fgr_gid
  10779. (*TGIDC)(unsafe.Pointer(ptr)).Fgid = v4
  10780. *(*Tgid_t)(unsafe.Pointer(gid)) = v4
  10781. return 0
  10782. }
  10783. const m_B0 = 0000000
  10784. const m_B1000000 = 0010010
  10785. const m_B110 = 0000003
  10786. const m_B115200 = 0010002
  10787. const m_B1152000 = 0010011
  10788. const m_B1200 = 0000011
  10789. const m_B134 = 0000004
  10790. const m_B150 = 0000005
  10791. const m_B1500000 = 0010012
  10792. const m_B1800 = 0000012
  10793. const m_B19200 = 0000016
  10794. const m_B200 = 0000006
  10795. const m_B2000000 = 0010013
  10796. const m_B230400 = 0010003
  10797. const m_B2400 = 0000013
  10798. const m_B2500000 = 0010014
  10799. const m_B300 = 0000007
  10800. const m_B3000000 = 0010015
  10801. const m_B3500000 = 0010016
  10802. const m_B38400 = 0000017
  10803. const m_B4000000 = 0010017
  10804. const m_B460800 = 0010004
  10805. const m_B4800 = 0000014
  10806. const m_B50 = 0000001
  10807. const m_B500000 = 0010005
  10808. const m_B57600 = 0010001
  10809. const m_B576000 = 0010006
  10810. const m_B600 = 0000010
  10811. const m_B75 = 0000002
  10812. const m_B921600 = 0010007
  10813. const m_B9600 = 0000015
  10814. const m_BRKINT = 0000002
  10815. const m_BS0 = 0000000
  10816. const m_BS1 = 0020000
  10817. const m_BSDLY = 0020000
  10818. const m_CBAUD = 0010017
  10819. const m_CBAUDEX = 0010000
  10820. const m_CIBAUD = 002003600000
  10821. const m_CLOCAL = 0004000
  10822. const m_CMSPAR = 010000000000
  10823. const m_CR0 = 0000000
  10824. const m_CR1 = 0001000
  10825. const m_CR2 = 0002000
  10826. const m_CR3 = 0003000
  10827. const m_CRDLY = 0003000
  10828. const m_CREAD = 0000200
  10829. const m_CRTSCTS = 020000000000
  10830. const m_CS5 = 0000000
  10831. const m_CS6 = 0000020
  10832. const m_CS7 = 0000040
  10833. const m_CS8 = 0000060
  10834. const m_CSIZE = 0000060
  10835. const m_CSTOPB = 0000100
  10836. const m_ECHO = 8
  10837. const m_ECHOCTL = 0001000
  10838. const m_ECHOE = 0000020
  10839. const m_ECHOK = 0000040
  10840. const m_ECHOKE = 0004000
  10841. const m_ECHONL = 64
  10842. const m_ECHOPRT = 0002000
  10843. const m_EXTA = 0000016
  10844. const m_EXTB = 0000017
  10845. const m_EXTPROC = 0200000
  10846. const m_FF0 = 0000000
  10847. const m_FF1 = 0100000
  10848. const m_FFDLY = 0100000
  10849. const m_FLUSHO = 0010000
  10850. const m_HUPCL = 0002000
  10851. const m_ICANON = 0000002
  10852. const m_ICRNL = 0000400
  10853. const m_IEXTEN = 0100000
  10854. const m_IGNBRK = 0000001
  10855. const m_IGNCR = 0000200
  10856. const m_IGNPAR = 0000004
  10857. const m_IMAXBEL = 0020000
  10858. const m_INLCR = 0000100
  10859. const m_INPCK = 0000020
  10860. const m_ISIG = 0000001
  10861. const m_ISTRIP = 0000040
  10862. const m_IUCLC = 0001000
  10863. const m_IUTF8 = 0040000
  10864. const m_IXANY = 0004000
  10865. const m_IXOFF = 0010000
  10866. const m_IXON = 0002000
  10867. const m_NCCS = 32
  10868. const m_NL0 = 0000000
  10869. const m_NL1 = 0000400
  10870. const m_NLDLY = 0000400
  10871. const m_NOFLSH = 0000200
  10872. const m_OCRNL = 0000010
  10873. const m_OFDEL = 0000200
  10874. const m_OFILL = 0000100
  10875. const m_OLCUC = 0000002
  10876. const m_ONLCR = 0000004
  10877. const m_ONLRET = 0000040
  10878. const m_ONOCR = 0000020
  10879. const m_OPOST = 0000001
  10880. const m_O_CREAT4 = 0100
  10881. const m_O_NONBLOCK4 = 04000
  10882. const m_O_RDONLY2 = 00
  10883. const m_O_RDWR1 = 2
  10884. const m_O_TRUNC4 = 01000
  10885. const m_O_WRONLY2 = 01
  10886. const m_PARENB = 0000400
  10887. const m_PARMRK = 0000010
  10888. const m_PARODD = 0001000
  10889. const m_PENDIN = 0040000
  10890. const m_RPP_ECHO_OFF = 0x00
  10891. const m_RPP_ECHO_ON = 1
  10892. const m_RPP_FORCELOWER = 4
  10893. const m_RPP_FORCEUPPER = 8
  10894. const m_RPP_REQUIRE_TTY = 2
  10895. const m_RPP_SEVENBIT = 16
  10896. const m_RPP_STDIN = 32
  10897. const m_TAB0 = 0000000
  10898. const m_TAB1 = 0004000
  10899. const m_TAB2 = 0010000
  10900. const m_TAB3 = 0014000
  10901. const m_TABDLY = 0014000
  10902. const m_TCIFLUSH = 0
  10903. const m_TCIOFF = 2
  10904. const m_TCIOFLUSH = 2
  10905. const m_TCION = 3
  10906. const m_TCOFLUSH = 1
  10907. const m_TCOOFF = 0
  10908. const m_TCOON = 1
  10909. const m_TCSADRAIN = 1
  10910. const m_TCSAFLUSH = 2
  10911. const m_TCSANOW = 0
  10912. const m_TCSASOFT = 0
  10913. const m_TOSTOP = 0000400
  10914. const m_VDISCARD = 13
  10915. const m_VEOF = 4
  10916. const m_VEOL = 11
  10917. const m_VEOL2 = 16
  10918. const m_VERASE = 2
  10919. const m_VINTR = 0
  10920. const m_VKILL = 3
  10921. const m_VLNEXT = 15
  10922. const m_VMIN = 6
  10923. const m_VQUIT = 1
  10924. const m_VREPRINT = 12
  10925. const m_VSTART = 8
  10926. const m_VSTOP = 9
  10927. const m_VSUSP = 10
  10928. const m_VSWTC = 7
  10929. const m_VT0 = 0000000
  10930. const m_VT1 = 0040000
  10931. const m_VTDLY = 0040000
  10932. const m_VTIME = 5
  10933. const m_VWERASE = 14
  10934. const m_XCASE = 0000004
  10935. const m_XTABS = 0014000
  10936. const m__PATH_BSHELL = "/bin/sh"
  10937. const m__PATH_CONSOLE = "/dev/console"
  10938. const m__PATH_DEFPATH = "/usr/local/bin:/bin:/usr/bin"
  10939. const m__PATH_DEV = "/dev/"
  10940. const m__PATH_DEVNULL = "/dev/null"
  10941. const m__PATH_KLOG = "/proc/kmsg"
  10942. const m__PATH_LASTLOG = "/var/log/lastlog"
  10943. const m__PATH_MAILDIR = "/var/mail"
  10944. const m__PATH_MAN = "/usr/share/man"
  10945. const m__PATH_MNTTAB = "/etc/fstab"
  10946. const m__PATH_MOUNTED = "/etc/mtab"
  10947. const m__PATH_NOLOGIN = "/etc/nologin"
  10948. const m__PATH_SENDMAIL = "/usr/sbin/sendmail"
  10949. const m__PATH_SHADOW = "/etc/shadow"
  10950. const m__PATH_SHELLS = "/etc/shells"
  10951. const m__PATH_STDPATH = "/bin:/usr/bin:/sbin:/usr/sbin"
  10952. const m__PATH_TMP = "/tmp/"
  10953. const m__PATH_TTY = "/dev/tty"
  10954. const m__PATH_UTMP = "/dev/null/utmp"
  10955. const m__PATH_VARDB = "/var/lib/misc/"
  10956. const m__PATH_VARRUN = "/var/run/"
  10957. const m__PATH_VARTMP = "/var/tmp/"
  10958. const m__PATH_VI = "/usr/bin/vi"
  10959. const m__PATH_WTMP = "/dev/null/wtmp"
  10960. type Twinsize = struct {
  10961. Fws_row uint16
  10962. Fws_col uint16
  10963. Fws_xpixel uint16
  10964. Fws_ypixel uint16
  10965. }
  10966. type Tcc_t = uint8
  10967. type Tspeed_t = uint32
  10968. type Ttcflag_t = uint32
  10969. type Ttermios = struct {
  10970. Fc_iflag Ttcflag_t
  10971. Fc_oflag Ttcflag_t
  10972. Fc_cflag Ttcflag_t
  10973. Fc_lflag Ttcflag_t
  10974. Fc_line Tcc_t
  10975. Fc_cc [32]Tcc_t
  10976. F__c_ispeed Tspeed_t
  10977. F__c_ospeed Tspeed_t
  10978. }
  10979. var _signo [65]Tsig_atomic_t
  10980. func Xreadpassphrase(tls *libc.TLS, prompt uintptr, buf uintptr, bufsiz Tsize_t, flags int32) (r uintptr) {
  10981. bp := tls.Alloc(1648)
  10982. defer tls.Free(1648)
  10983. var end, p, v6, v8 uintptr
  10984. var i, input, need_restart, output, save_errno, sigttou, v2, v3 int32
  10985. var nr, v5 Tssize_t
  10986. var v4 bool
  10987. var _ /* ch at bp+0 */ uint8
  10988. var _ /* oterm at bp+64 */ Ttermios
  10989. var _ /* sa at bp+128 */ Tsigaction
  10990. var _ /* savealrm at bp+280 */ Tsigaction
  10991. var _ /* savehup at bp+584 */ Tsigaction
  10992. var _ /* saveint at bp+432 */ Tsigaction
  10993. var _ /* savepipe at bp+1496 */ Tsigaction
  10994. var _ /* savequit at bp+736 */ Tsigaction
  10995. var _ /* saveterm at bp+888 */ Tsigaction
  10996. var _ /* savetstp at bp+1040 */ Tsigaction
  10997. var _ /* savettin at bp+1192 */ Tsigaction
  10998. var _ /* savettou at bp+1344 */ Tsigaction
  10999. var _ /* term at bp+4 */ Ttermios
  11000. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = end, i, input, need_restart, nr, output, p, save_errno, sigttou, v2, v3, v4, v5, v6, v8
  11001. /* I suppose we could alloc on demand in this case (XXX). */
  11002. if bufsiz == uint64(0) {
  11003. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11004. return libc.UintptrFromInt32(0)
  11005. }
  11006. goto restart
  11007. restart:
  11008. ;
  11009. i = 0
  11010. for {
  11011. if !(i < int32(m__NSIG)) {
  11012. break
  11013. }
  11014. libc.AtomicStorePInt32(uintptr(unsafe.Pointer(&_signo))+uintptr(i)*4, 0)
  11015. goto _1
  11016. _1:
  11017. ;
  11018. i++
  11019. }
  11020. nr = int64(-int32(1))
  11021. save_errno = 0
  11022. need_restart = 0
  11023. /*
  11024. * Read and write to /dev/tty if available. If not, read from
  11025. * stdin and write to stderr unless a tty is required.
  11026. */
  11027. if v4 = flags&int32(m_RPP_STDIN) != 0; !v4 {
  11028. v3 = libc.Xopen(tls, __ccgo_ts+430, int32(m_O_RDWR1), 0)
  11029. output = v3
  11030. v2 = v3
  11031. input = v2
  11032. }
  11033. if v4 || v2 == -int32(1) {
  11034. if flags&int32(m_RPP_REQUIRE_TTY) != 0 {
  11035. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOTTY)
  11036. return libc.UintptrFromInt32(0)
  11037. }
  11038. input = m_STDIN_FILENO
  11039. output = int32(m_STDERR_FILENO)
  11040. }
  11041. /*
  11042. * Turn off echo if possible.
  11043. * If we are using a tty but are not the foreground pgrp this will
  11044. * generate SIGTTOU, so do it *before* installing the signal handlers.
  11045. */
  11046. if input != m_STDIN_FILENO && libc.Xtcgetattr(tls, input, bp+64) == 0 {
  11047. libc.Xmemcpy(tls, bp+4, bp+64, uint64(60))
  11048. if !(flags&libc.Int32FromInt32(m_RPP_ECHO_ON) != 0) {
  11049. (*(*Ttermios)(unsafe.Pointer(bp + 4))).Fc_lflag &= libc.Uint32FromInt32(^(libc.Int32FromInt32(m_ECHO) | libc.Int32FromInt32(m_ECHONL)))
  11050. }
  11051. libc.Xtcsetattr(tls, input, libc.Int32FromInt32(m_TCSAFLUSH)|libc.Int32FromInt32(m_TCSASOFT), bp+4)
  11052. } else {
  11053. libc.Xmemset(tls, bp+4, 0, uint64(60))
  11054. (*(*Ttermios)(unsafe.Pointer(bp + 4))).Fc_lflag |= uint32(m_ECHO)
  11055. libc.Xmemset(tls, bp+64, 0, uint64(60))
  11056. (*(*Ttermios)(unsafe.Pointer(bp + 64))).Fc_lflag |= uint32(m_ECHO)
  11057. }
  11058. /*
  11059. * Catch signals that would otherwise cause the user to end
  11060. * up with echo turned off in the shell. Don't worry about
  11061. * things like SIGXCPU and SIGVTALRM for now.
  11062. */
  11063. libc.Xsigemptyset(tls, bp+128+8)
  11064. (*(*Tsigaction)(unsafe.Pointer(bp + 128))).Fsa_flags = 0 /* don't restart system calls */
  11065. *(*uintptr)(unsafe.Pointer(bp + 128)) = __ccgo_fp(_handler)
  11066. libc.Xsigaction(tls, int32(m_SIGALRM), bp+128, bp+280)
  11067. libc.Xsigaction(tls, int32(m_SIGHUP), bp+128, bp+584)
  11068. libc.Xsigaction(tls, int32(m_SIGINT), bp+128, bp+432)
  11069. libc.Xsigaction(tls, int32(m_SIGPIPE), bp+128, bp+1496)
  11070. libc.Xsigaction(tls, int32(m_SIGQUIT), bp+128, bp+736)
  11071. libc.Xsigaction(tls, int32(m_SIGTERM), bp+128, bp+888)
  11072. libc.Xsigaction(tls, int32(m_SIGTSTP), bp+128, bp+1040)
  11073. libc.Xsigaction(tls, int32(m_SIGTTIN), bp+128, bp+1192)
  11074. libc.Xsigaction(tls, int32(m_SIGTTOU), bp+128, bp+1344)
  11075. if !(flags&libc.Int32FromInt32(m_RPP_STDIN) != 0) {
  11076. libc.Xwrite(tls, output, prompt, libc.Xstrlen(tls, prompt))
  11077. }
  11078. end = buf + uintptr(bufsiz) - uintptr(1)
  11079. p = buf
  11080. for {
  11081. v5 = libc.Xread(tls, input, bp, uint64(1))
  11082. nr = v5
  11083. if !(v5 == int64(1) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp))) != int32('\n') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp))) != int32('\r')) {
  11084. break
  11085. }
  11086. if p < end {
  11087. if flags&int32(m_RPP_SEVENBIT) != 0 {
  11088. *(*uint8)(unsafe.Pointer(bp)) = uint8(int32(*(*uint8)(unsafe.Pointer(bp))) & libc.Int32FromInt32(0x7f))
  11089. }
  11090. if libc.BoolInt32(uint32(*(*uint8)(unsafe.Pointer(bp)))|uint32(32)-uint32('a') < uint32(26)) != 0 {
  11091. if flags&int32(m_RPP_FORCELOWER) != 0 {
  11092. *(*uint8)(unsafe.Pointer(bp)) = libc.Uint8FromInt32(libc.Xtolower(tls, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp)))))
  11093. }
  11094. if flags&int32(m_RPP_FORCEUPPER) != 0 {
  11095. *(*uint8)(unsafe.Pointer(bp)) = libc.Uint8FromInt32(libc.Xtoupper(tls, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp)))))
  11096. }
  11097. }
  11098. v6 = p
  11099. p++
  11100. *(*uint8)(unsafe.Pointer(v6)) = *(*uint8)(unsafe.Pointer(bp))
  11101. }
  11102. }
  11103. *(*uint8)(unsafe.Pointer(p)) = uint8('\000')
  11104. save_errno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  11105. if !((*(*Ttermios)(unsafe.Pointer(bp + 4))).Fc_lflag&libc.Uint32FromInt32(m_ECHO) != 0) {
  11106. libc.Xwrite(tls, output, __ccgo_ts+439, uint64(1))
  11107. }
  11108. /* Restore old terminal settings and signals. */
  11109. if libc.Xmemcmp(tls, bp+4, bp+64, uint64(60)) != 0 {
  11110. sigttou = libc.AtomicLoadPInt32(uintptr(unsafe.Pointer(&_signo)) + libc.UintptrFromInt32(m_SIGTTOU)*4)
  11111. /* Ignore SIGTTOU generated when we are not the fg pgrp. */
  11112. for libc.Xtcsetattr(tls, input, libc.Int32FromInt32(m_TCSAFLUSH)|libc.Int32FromInt32(m_TCSASOFT), bp+64) == -int32(1) && *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EINTR) && !(libc.AtomicLoadPInt32(uintptr(unsafe.Pointer(&_signo))+libc.UintptrFromInt32(m_SIGTTOU)*4) != 0) {
  11113. continue
  11114. }
  11115. libc.AtomicStorePInt32(uintptr(unsafe.Pointer(&_signo))+22*4, sigttou)
  11116. }
  11117. libc.Xsigaction(tls, int32(m_SIGALRM), bp+280, libc.UintptrFromInt32(0))
  11118. libc.Xsigaction(tls, int32(m_SIGHUP), bp+584, libc.UintptrFromInt32(0))
  11119. libc.Xsigaction(tls, int32(m_SIGINT), bp+432, libc.UintptrFromInt32(0))
  11120. libc.Xsigaction(tls, int32(m_SIGQUIT), bp+736, libc.UintptrFromInt32(0))
  11121. libc.Xsigaction(tls, int32(m_SIGPIPE), bp+1496, libc.UintptrFromInt32(0))
  11122. libc.Xsigaction(tls, int32(m_SIGTERM), bp+888, libc.UintptrFromInt32(0))
  11123. libc.Xsigaction(tls, int32(m_SIGTSTP), bp+1040, libc.UintptrFromInt32(0))
  11124. libc.Xsigaction(tls, int32(m_SIGTTIN), bp+1192, libc.UintptrFromInt32(0))
  11125. libc.Xsigaction(tls, int32(m_SIGTTOU), bp+1344, libc.UintptrFromInt32(0))
  11126. if input != m_STDIN_FILENO {
  11127. libc.Xclose(tls, input)
  11128. }
  11129. /*
  11130. * If we were interrupted by a signal, resend it to ourselves
  11131. * now that we have restored the signal handlers.
  11132. */
  11133. i = 0
  11134. for {
  11135. if !(i < int32(m__NSIG)) {
  11136. break
  11137. }
  11138. if libc.AtomicLoadPInt32(uintptr(unsafe.Pointer(&_signo))+uintptr(i)*4) != 0 {
  11139. libc.Xkill(tls, libc.Xgetpid(tls), i)
  11140. switch i {
  11141. case int32(m_SIGTSTP):
  11142. fallthrough
  11143. case int32(m_SIGTTIN):
  11144. fallthrough
  11145. case int32(m_SIGTTOU):
  11146. need_restart = int32(1)
  11147. }
  11148. }
  11149. goto _7
  11150. _7:
  11151. ;
  11152. i++
  11153. }
  11154. if need_restart != 0 {
  11155. goto restart
  11156. }
  11157. if save_errno != 0 {
  11158. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = save_errno
  11159. }
  11160. if nr == int64(-int32(1)) {
  11161. v8 = libc.UintptrFromInt32(0)
  11162. } else {
  11163. v8 = buf
  11164. }
  11165. return v8
  11166. }
  11167. func _handler(tls *libc.TLS, s int32) {
  11168. libc.AtomicStorePInt32(uintptr(unsafe.Pointer(&_signo))+uintptr(s)*4, int32(1))
  11169. }
  11170. const m_UINT64_MAX1 = 18446744073709551615
  11171. /*
  11172. * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
  11173. * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
  11174. */
  11175. func Xreallocarray(tls *libc.TLS, optr uintptr, nmemb Tsize_t, size Tsize_t) (r uintptr) {
  11176. 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 {
  11177. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOMEM)
  11178. return libc.UintptrFromInt32(0)
  11179. }
  11180. return libc.Xrealloc(tls, optr, size*nmemb)
  11181. }
  11182. const m_UINT64_MAX2 = "0xffffffffffffffffu"
  11183. func Xreallocf(tls *libc.TLS, ptr uintptr, size Tsize_t) (r uintptr) {
  11184. var nptr uintptr
  11185. _ = nptr
  11186. nptr = libc.Xrealloc(tls, ptr, size)
  11187. /*
  11188. * When the System V compatibility option (malloc "V" flag) is
  11189. * in effect, realloc(ptr, 0) frees the memory and returns NULL.
  11190. * So, to avoid double free, call free() only when size != 0.
  11191. * realloc(ptr, 0) can't fail when ptr != NULL.
  11192. */
  11193. if !(nptr != 0) && ptr != 0 && size != uint64(0) {
  11194. libc.Xfree(tls, ptr)
  11195. }
  11196. return nptr
  11197. }
  11198. const m_UINT64_MAX3 = 18446744073709551615
  11199. /*
  11200. * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
  11201. * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
  11202. */
  11203. func Xrecallocarray(tls *libc.TLS, ptr uintptr, oldnmemb Tsize_t, newnmemb Tsize_t, size Tsize_t) (r uintptr) {
  11204. var d, newsize, oldsize Tsize_t
  11205. var newptr uintptr
  11206. _, _, _, _ = d, newptr, newsize, oldsize
  11207. if ptr == libc.UintptrFromInt32(0) {
  11208. return libc.Xcalloc(tls, newnmemb, size)
  11209. }
  11210. 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 {
  11211. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOMEM)
  11212. return libc.UintptrFromInt32(0)
  11213. }
  11214. newsize = newnmemb * size
  11215. 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 {
  11216. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11217. return libc.UintptrFromInt32(0)
  11218. }
  11219. oldsize = oldnmemb * size
  11220. /*
  11221. * Don't bother too much if we're shrinking just a bit,
  11222. * we do not shrink for series of small steps, oh well.
  11223. */
  11224. if newsize <= oldsize {
  11225. d = oldsize - newsize
  11226. if d < oldsize/uint64(2) && d < libc.Uint64FromInt32(libc.Xgetpagesize(tls)) {
  11227. libc.Xmemset(tls, ptr+uintptr(newsize), 0, d)
  11228. return ptr
  11229. }
  11230. }
  11231. newptr = libc.Xmalloc(tls, newsize)
  11232. if newptr == libc.UintptrFromInt32(0) {
  11233. return libc.UintptrFromInt32(0)
  11234. }
  11235. if newsize > oldsize {
  11236. libc.Xmemcpy(tls, newptr, ptr, oldsize)
  11237. libc.Xmemset(tls, newptr+uintptr(oldsize), 0, newsize-oldsize)
  11238. } else {
  11239. libc.Xmemcpy(tls, newptr, ptr, newsize)
  11240. }
  11241. Xexplicit_bzero(tls, ptr, oldsize)
  11242. libc.Xfree(tls, ptr)
  11243. return newptr
  11244. }
  11245. const m_UINT64_MAX4 = "0xffffffffffffffffu"
  11246. /*
  11247. * Swap two areas of size number of bytes. Although qsort(3) permits random
  11248. * blocks of memory to be sorted, sorting pointers is almost certainly the
  11249. * common case (and, were it not, could easily be made so). Regardless, it
  11250. * isn't worth optimizing; the SWAP's get sped up by the cache, and pointer
  11251. * arithmetic gets lost in the time required for comparison function calls.
  11252. */
  11253. /* Copy one block of size size to another. */
  11254. /*
  11255. * Build the list into a heap, where a heap is defined such that for
  11256. * the records K1 ... KN, Kj/2 >= Kj for 1 <= j/2 <= j <= N.
  11257. *
  11258. * There are two cases. If j == nmemb, select largest of Ki and Kj. If
  11259. * j < nmemb, select largest of Ki, Kj and Kj+1.
  11260. */
  11261. /*
  11262. * Select the top of the heap and 'heapify'. Since by far the most expensive
  11263. * action is the call to the compar function, a considerable optimization
  11264. * in the average case can be achieved due to the fact that k, the displaced
  11265. * element, is usually quite small, so it would be preferable to first
  11266. * heapify, always maintaining the invariant that the larger child is copied
  11267. * over its parent's record.
  11268. *
  11269. * Then, starting from the *bottom* of the heap, finding k's correct place,
  11270. * again maintaining the invariant. As a result of the invariant no element
  11271. * is 'lost' when k is assigned its correct place in the heap.
  11272. *
  11273. * The time savings from this optimization are on the order of 15-20% for the
  11274. * average case. See Knuth, Vol. 3, page 158, problem 18.
  11275. *
  11276. * XXX Don't break the #define SELECT line, below. Reiser cpp gets upset.
  11277. */
  11278. // C documentation
  11279. //
  11280. // /*
  11281. // * Heapsort -- Knuth, Vol. 3, page 145. Runs in O (N lg N), both average
  11282. // * and worst. While heapsort is faster than the worst case of quicksort,
  11283. // * the BSD quicksort does median selection so that the chance of finding
  11284. // * a data set that will trigger the worst case is nonexistent. Heapsort's
  11285. // * only advantage over quicksort is that it requires little additional memory.
  11286. // */
  11287. func Xheapsort(tls *libc.TLS, vbase uintptr, nmemb Tsize_t, size Tsize_t, compar uintptr) (r int32) {
  11288. var base, k, p, t, tmp1, tmp2, v1, v12, v13, v16, v17, v22, v23, v27, v28, v31, v32, v8, v9 uintptr
  11289. var cnt, i, j, l, v10, v14, v19, v20, v25, v29, v3, v5, v6 Tsize_t
  11290. var tmp uint8
  11291. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  11292. if nmemb <= uint64(1) {
  11293. return 0
  11294. }
  11295. if !(size != 0) {
  11296. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11297. return -int32(1)
  11298. }
  11299. v1 = libc.Xmalloc(tls, size)
  11300. k = v1
  11301. if v1 == libc.UintptrFromInt32(0) {
  11302. return -int32(1)
  11303. }
  11304. /*
  11305. * Items are numbered from 1 to nmemb, so offset from size bytes
  11306. * below the starting address.
  11307. */
  11308. base = vbase - uintptr(size)
  11309. l = nmemb/uint64(2) + uint64(1)
  11310. for {
  11311. l--
  11312. v3 = l
  11313. if !(v3 != 0) {
  11314. break
  11315. }
  11316. i = l
  11317. for {
  11318. v5 = i * libc.Uint64FromInt32(2)
  11319. j = v5
  11320. if !(v5 <= nmemb) {
  11321. break
  11322. }
  11323. p = base + uintptr(j*size)
  11324. if j < nmemb && (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{compar})))(tls, p, p+uintptr(size)) < 0 {
  11325. p += uintptr(size)
  11326. j++
  11327. }
  11328. t = base + uintptr(i*size)
  11329. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{compar})))(tls, p, t) <= 0 {
  11330. break
  11331. }
  11332. cnt = size
  11333. for {
  11334. tmp = *(*uint8)(unsafe.Pointer(t))
  11335. v8 = t
  11336. t++
  11337. *(*uint8)(unsafe.Pointer(v8)) = *(*uint8)(unsafe.Pointer(p))
  11338. v9 = p
  11339. p++
  11340. *(*uint8)(unsafe.Pointer(v9)) = tmp
  11341. goto _7
  11342. _7:
  11343. ;
  11344. cnt--
  11345. v6 = cnt
  11346. if !(v6 != 0) {
  11347. break
  11348. }
  11349. }
  11350. goto _4
  11351. _4:
  11352. ;
  11353. i = j
  11354. }
  11355. goto _2
  11356. _2:
  11357. }
  11358. /*
  11359. * For each element of the heap, save the largest element into its
  11360. * final slot, save the displaced element (k), then recreate the
  11361. * heap.
  11362. */
  11363. for nmemb > uint64(1) {
  11364. cnt = size
  11365. tmp1 = k
  11366. tmp2 = base + uintptr(nmemb*size)
  11367. for {
  11368. v12 = tmp1
  11369. tmp1++
  11370. v13 = tmp2
  11371. tmp2++
  11372. *(*uint8)(unsafe.Pointer(v12)) = *(*uint8)(unsafe.Pointer(v13))
  11373. goto _11
  11374. _11:
  11375. ;
  11376. cnt--
  11377. v10 = cnt
  11378. if !(v10 != 0) {
  11379. break
  11380. }
  11381. }
  11382. cnt = size
  11383. tmp1 = base + uintptr(nmemb*size)
  11384. tmp2 = base + uintptr(size)
  11385. for {
  11386. v16 = tmp1
  11387. tmp1++
  11388. v17 = tmp2
  11389. tmp2++
  11390. *(*uint8)(unsafe.Pointer(v16)) = *(*uint8)(unsafe.Pointer(v17))
  11391. goto _15
  11392. _15:
  11393. ;
  11394. cnt--
  11395. v14 = cnt
  11396. if !(v14 != 0) {
  11397. break
  11398. }
  11399. }
  11400. nmemb--
  11401. i = uint64(1)
  11402. for {
  11403. v19 = i * libc.Uint64FromInt32(2)
  11404. j = v19
  11405. if !(v19 <= nmemb) {
  11406. break
  11407. }
  11408. p = base + uintptr(j*size)
  11409. if j < nmemb && (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{compar})))(tls, p, p+uintptr(size)) < 0 {
  11410. p += uintptr(size)
  11411. j++
  11412. }
  11413. t = base + uintptr(i*size)
  11414. cnt = size
  11415. tmp1 = t
  11416. tmp2 = p
  11417. for {
  11418. v22 = tmp1
  11419. tmp1++
  11420. v23 = tmp2
  11421. tmp2++
  11422. *(*uint8)(unsafe.Pointer(v22)) = *(*uint8)(unsafe.Pointer(v23))
  11423. goto _21
  11424. _21:
  11425. ;
  11426. cnt--
  11427. v20 = cnt
  11428. if !(v20 != 0) {
  11429. break
  11430. }
  11431. }
  11432. goto _18
  11433. _18:
  11434. ;
  11435. i = j
  11436. }
  11437. for {
  11438. j = i
  11439. i = j / uint64(2)
  11440. p = base + uintptr(j*size)
  11441. t = base + uintptr(i*size)
  11442. if j == uint64(1) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{compar})))(tls, k, t) < 0 {
  11443. cnt = size
  11444. tmp1 = p
  11445. tmp2 = k
  11446. for {
  11447. v27 = tmp1
  11448. tmp1++
  11449. v28 = tmp2
  11450. tmp2++
  11451. *(*uint8)(unsafe.Pointer(v27)) = *(*uint8)(unsafe.Pointer(v28))
  11452. goto _26
  11453. _26:
  11454. ;
  11455. cnt--
  11456. v25 = cnt
  11457. if !(v25 != 0) {
  11458. break
  11459. }
  11460. }
  11461. break
  11462. }
  11463. cnt = size
  11464. tmp1 = p
  11465. tmp2 = t
  11466. for {
  11467. v31 = tmp1
  11468. tmp1++
  11469. v32 = tmp2
  11470. tmp2++
  11471. *(*uint8)(unsafe.Pointer(v31)) = *(*uint8)(unsafe.Pointer(v32))
  11472. goto _30
  11473. _30:
  11474. ;
  11475. cnt--
  11476. v29 = cnt
  11477. if !(v29 != 0) {
  11478. break
  11479. }
  11480. }
  11481. goto _24
  11482. _24:
  11483. }
  11484. }
  11485. libc.Xfree(tls, k)
  11486. return 0
  11487. }
  11488. const m_THRESHOLD = 16
  11489. /*
  11490. * Find the next possible pointer head. (Trickery for forcing an array
  11491. * to do double duty as a linked list when objects do not align with word
  11492. * boundaries.
  11493. */
  11494. /* Assumption: PSIZE is a power of 2. */
  11495. // C documentation
  11496. //
  11497. // /*
  11498. // * Arguments are as for qsort.
  11499. // */
  11500. func Xmergesort(tls *libc.TLS, base uintptr, nmemb Tsize_t, size Tsize_t, cmp uintptr) (r int32) {
  11501. 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
  11502. var big, iflag, sense, v2 int32
  11503. var i, v8 Tsize_t
  11504. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  11505. if size < libc.Uint64FromInt64(8)/libc.Uint64FromInt32(2) { /* Pointers must fit into 2 * size. */
  11506. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  11507. return -int32(1)
  11508. }
  11509. if nmemb == uint64(0) {
  11510. return 0
  11511. }
  11512. /*
  11513. * XXX
  11514. * Stupid subtraction for the Cray.
  11515. */
  11516. iflag = 0
  11517. if !(size%libc.Uint64FromInt64(4) != 0) && !(libc.Uint64FromInt64(int64(base)-int64(libc.UintptrFromInt32(0)))%libc.Uint64FromInt64(4) != 0) {
  11518. iflag = int32(1)
  11519. }
  11520. v1 = libc.Xmalloc(tls, nmemb*size+uint64(8))
  11521. list2 = v1
  11522. if v1 == libc.UintptrFromInt32(0) {
  11523. return -int32(1)
  11524. }
  11525. list1 = base
  11526. _setup(tls, list1, list2, nmemb, size, cmp)
  11527. last = list2 + uintptr(nmemb*size)
  11528. v2 = libc.Int32FromInt32(0)
  11529. big = v2
  11530. i = libc.Uint64FromInt32(v2)
  11531. 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 {
  11532. l2 = list1
  11533. p1 = uintptr(libc.Uint64FromInt64(int64(list1+libc.UintptrFromInt64(8)-libc.UintptrFromInt32(1))-int64(libc.UintptrFromInt32(0))) & ^(libc.Uint64FromInt64(8) - libc.Uint64FromInt32(1)))
  11534. v4 = list2
  11535. p2 = v4
  11536. tp2 = v4
  11537. for {
  11538. if !(p2 != last) {
  11539. break
  11540. }
  11541. 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)))))
  11542. f1 = l2
  11543. v5 = list1 + uintptr(int64(p2)-int64(list2))
  11544. l1 = v5
  11545. f2 = v5
  11546. if p2 != last {
  11547. 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)))))
  11548. }
  11549. l2 = list1 + uintptr(int64(p2)-int64(list2))
  11550. for f1 < l1 && f2 < l2 {
  11551. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f1, f2) <= 0 {
  11552. q = f2
  11553. b = f1
  11554. t = l1
  11555. sense = -int32(1)
  11556. } else {
  11557. q = f1
  11558. b = f2
  11559. t = l2
  11560. sense = 0
  11561. }
  11562. if !!(big != 0) {
  11563. goto _6
  11564. } /* here i = 0 */
  11565. for {
  11566. b += uintptr(size)
  11567. if !(b < t && (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, b) > sense) {
  11568. break
  11569. }
  11570. i++
  11571. v8 = i
  11572. if v8 == uint64(6) {
  11573. big = int32(1)
  11574. goto EXPONENTIAL
  11575. }
  11576. }
  11577. goto _7
  11578. _6:
  11579. ;
  11580. goto EXPONENTIAL
  11581. EXPONENTIAL:
  11582. ;
  11583. i = size
  11584. for {
  11585. v10 = b + uintptr(i)
  11586. p = v10
  11587. if v10 >= t {
  11588. v11 = t - uintptr(size)
  11589. p = v11
  11590. if v11 > b && (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, p) <= sense {
  11591. t = p
  11592. } else {
  11593. b = p
  11594. }
  11595. break
  11596. } else {
  11597. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, p) <= sense {
  11598. t = p
  11599. if i == size {
  11600. big = 0
  11601. }
  11602. goto FASTCASE
  11603. } else {
  11604. b = p
  11605. }
  11606. }
  11607. goto _9
  11608. _9:
  11609. ;
  11610. i <<= uint64(1)
  11611. }
  11612. for t > b+uintptr(size) {
  11613. i = libc.Uint64FromInt64(int64(t)-int64(b)) / size >> int32(1) * size
  11614. v12 = b + uintptr(i)
  11615. p = v12
  11616. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, v12) <= sense {
  11617. t = p
  11618. } else {
  11619. b = p
  11620. }
  11621. }
  11622. goto COPY
  11623. goto FASTCASE
  11624. FASTCASE:
  11625. ;
  11626. for i > size {
  11627. i >>= uint64(1)
  11628. v13 = b + uintptr(i)
  11629. p = v13
  11630. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, q, v13) <= sense {
  11631. t = p
  11632. } else {
  11633. b = p
  11634. }
  11635. }
  11636. goto COPY
  11637. COPY:
  11638. ;
  11639. b = t
  11640. _7:
  11641. ;
  11642. i = size
  11643. if q == f1 {
  11644. if iflag != 0 {
  11645. for cond := true; cond; cond = f2 < b {
  11646. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f2))
  11647. f2 += uintptr(4)
  11648. tp2 += uintptr(4)
  11649. }
  11650. for {
  11651. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f1))
  11652. f1 += uintptr(4)
  11653. tp2 += uintptr(4)
  11654. goto _14
  11655. _14:
  11656. ;
  11657. i -= uint64(4)
  11658. if !(i != 0) {
  11659. break
  11660. }
  11661. }
  11662. } else {
  11663. for cond := true; cond; cond = f2 < b {
  11664. v15 = tp2
  11665. tp2++
  11666. v16 = f2
  11667. f2++
  11668. *(*uint8)(unsafe.Pointer(v15)) = *(*uint8)(unsafe.Pointer(v16))
  11669. }
  11670. for {
  11671. v18 = tp2
  11672. tp2++
  11673. v19 = f1
  11674. f1++
  11675. *(*uint8)(unsafe.Pointer(v18)) = *(*uint8)(unsafe.Pointer(v19))
  11676. goto _17
  11677. _17:
  11678. ;
  11679. i -= uint64(1)
  11680. if !(i != 0) {
  11681. break
  11682. }
  11683. }
  11684. }
  11685. } else {
  11686. if iflag != 0 {
  11687. for cond := true; cond; cond = f1 < b {
  11688. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f1))
  11689. f1 += uintptr(4)
  11690. tp2 += uintptr(4)
  11691. }
  11692. for {
  11693. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f2))
  11694. f2 += uintptr(4)
  11695. tp2 += uintptr(4)
  11696. goto _20
  11697. _20:
  11698. ;
  11699. i -= uint64(4)
  11700. if !(i != 0) {
  11701. break
  11702. }
  11703. }
  11704. } else {
  11705. for cond := true; cond; cond = f1 < b {
  11706. v21 = tp2
  11707. tp2++
  11708. v22 = f1
  11709. f1++
  11710. *(*uint8)(unsafe.Pointer(v21)) = *(*uint8)(unsafe.Pointer(v22))
  11711. }
  11712. for {
  11713. v24 = tp2
  11714. tp2++
  11715. v25 = f2
  11716. f2++
  11717. *(*uint8)(unsafe.Pointer(v24)) = *(*uint8)(unsafe.Pointer(v25))
  11718. goto _23
  11719. _23:
  11720. ;
  11721. i -= uint64(1)
  11722. if !(i != 0) {
  11723. break
  11724. }
  11725. }
  11726. }
  11727. }
  11728. }
  11729. if f2 < l2 {
  11730. if iflag != 0 {
  11731. for cond := true; cond; cond = f2 < l2 {
  11732. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f2))
  11733. f2 += uintptr(4)
  11734. tp2 += uintptr(4)
  11735. }
  11736. } else {
  11737. for cond := true; cond; cond = f2 < l2 {
  11738. v26 = tp2
  11739. tp2++
  11740. v27 = f2
  11741. f2++
  11742. *(*uint8)(unsafe.Pointer(v26)) = *(*uint8)(unsafe.Pointer(v27))
  11743. }
  11744. }
  11745. } else {
  11746. if f1 < l1 {
  11747. if iflag != 0 {
  11748. for cond := true; cond; cond = f1 < l1 {
  11749. *(*int32)(unsafe.Pointer(tp2)) = *(*int32)(unsafe.Pointer(f1))
  11750. f1 += uintptr(4)
  11751. tp2 += uintptr(4)
  11752. }
  11753. } else {
  11754. for cond := true; cond; cond = f1 < l1 {
  11755. v28 = tp2
  11756. tp2++
  11757. v29 = f1
  11758. f1++
  11759. *(*uint8)(unsafe.Pointer(v28)) = *(*uint8)(unsafe.Pointer(v29))
  11760. }
  11761. }
  11762. }
  11763. }
  11764. *(*uintptr)(unsafe.Pointer(p1)) = l2
  11765. goto _3
  11766. _3:
  11767. ;
  11768. p1 = uintptr(libc.Uint64FromInt64(int64(l2+libc.UintptrFromInt64(8)-libc.UintptrFromInt32(1))-int64(libc.UintptrFromInt32(0))) & ^(libc.Uint64FromInt64(8) - libc.Uint64FromInt32(1)))
  11769. }
  11770. tp2 = list1 /* swap list1, list2 */
  11771. list1 = list2
  11772. list2 = tp2
  11773. last = list2 + uintptr(nmemb*size)
  11774. }
  11775. if base == list2 {
  11776. libc.Xmemmove(tls, list2, list1, nmemb*size)
  11777. list2 = list1
  11778. }
  11779. libc.Xfree(tls, list2)
  11780. return 0
  11781. }
  11782. // C documentation
  11783. //
  11784. // /*
  11785. // * Optional hybrid natural/pairwise first pass. Eats up list1 in runs of
  11786. // * increasing order, list2 in a corresponding linked list. Checks for runs
  11787. // * when THRESHOLD/2 pairs compare with same sense. (Only used when NATURAL
  11788. // * is defined. Otherwise simple pairwise merging is used.)
  11789. // */
  11790. func _setup(tls *libc.TLS, list1 uintptr, list2 uintptr, n Tsize_t, size Tsize_t, cmp uintptr) {
  11791. var f1, f2, l2, last, p2, s, v10, v13, v14, v17, v18, v19, v20, v4, v7, v8 uintptr
  11792. var i, length, sense, size2, tmp, v11, v15, v5 int32
  11793. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = f1, f2, i, l2, last, length, p2, s, sense, size2, tmp, v10, v11, v13, v14, v15, v17, v18, v19, v20, v4, v5, v7, v8
  11794. size2 = libc.Int32FromUint64(size * uint64(2))
  11795. if n <= uint64(5) {
  11796. _insertionsort(tls, list1, n, size, cmp)
  11797. *(*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)
  11798. return
  11799. }
  11800. /*
  11801. * Avoid running pointers out of bounds; limit n to evens
  11802. * for simplicity.
  11803. */
  11804. i = libc.Int32FromUint64(uint64(4) + n&uint64(1))
  11805. _insertionsort(tls, list1+uintptr((n-libc.Uint64FromInt32(i))*size), libc.Uint64FromInt32(i), size, cmp)
  11806. last = list1 + uintptr(size*(n-libc.Uint64FromInt32(i)))
  11807. *(*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)
  11808. p2 = list2
  11809. f1 = list1
  11810. sense = libc.BoolInt32((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f1, f1+uintptr(size)) > 0)
  11811. for {
  11812. if !(f1 < last) {
  11813. break
  11814. }
  11815. length = int32(2)
  11816. /* Find pairs with same sense. */
  11817. f2 = f1 + uintptr(size2)
  11818. for {
  11819. if !(f2 < last) {
  11820. break
  11821. }
  11822. if libc.BoolInt32((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f2, f2+uintptr(size)) > 0) != sense {
  11823. break
  11824. }
  11825. length += int32(2)
  11826. goto _2
  11827. _2:
  11828. ;
  11829. f2 += uintptr(size2)
  11830. }
  11831. if length < int32(m_THRESHOLD) { /* Pairwise merge */
  11832. for {
  11833. v4 = uintptr(int64(f1+uintptr(size2))-int64(list1)) + list2
  11834. *(*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
  11835. p2 = v4
  11836. if sense > 0 {
  11837. s = f1 + uintptr(size)
  11838. i = libc.Int32FromUint64(size)
  11839. for {
  11840. tmp = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f1)))
  11841. v7 = f1
  11842. f1++
  11843. *(*uint8)(unsafe.Pointer(v7)) = *(*uint8)(unsafe.Pointer(s))
  11844. v8 = s
  11845. s++
  11846. *(*uint8)(unsafe.Pointer(v8)) = libc.Uint8FromInt32(tmp)
  11847. goto _6
  11848. _6:
  11849. ;
  11850. i--
  11851. v5 = i
  11852. if !(v5 != 0) {
  11853. break
  11854. }
  11855. }
  11856. f1 -= uintptr(size)
  11857. }
  11858. goto _3
  11859. _3:
  11860. ;
  11861. f1 += uintptr(size2)
  11862. if !(f1 < f2) {
  11863. break
  11864. }
  11865. }
  11866. } else { /* Natural merge */
  11867. l2 = f2
  11868. f2 = f1 + uintptr(size2)
  11869. for {
  11870. if !(f2 < l2) {
  11871. break
  11872. }
  11873. if libc.BoolInt32((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f2-uintptr(size), f2) > 0) != sense {
  11874. v10 = uintptr(int64(f2)-int64(list1)) + list2
  11875. *(*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
  11876. p2 = v10
  11877. if sense > 0 {
  11878. s = f2 - uintptr(size)
  11879. for cond := true; cond; cond = f1 < s {
  11880. i = libc.Int32FromUint64(size)
  11881. for {
  11882. tmp = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f1)))
  11883. v13 = f1
  11884. f1++
  11885. *(*uint8)(unsafe.Pointer(v13)) = *(*uint8)(unsafe.Pointer(s))
  11886. v14 = s
  11887. s++
  11888. *(*uint8)(unsafe.Pointer(v14)) = libc.Uint8FromInt32(tmp)
  11889. goto _12
  11890. _12:
  11891. ;
  11892. i--
  11893. v11 = i
  11894. if !(v11 != 0) {
  11895. break
  11896. }
  11897. }
  11898. s -= uintptr(size2)
  11899. }
  11900. }
  11901. f1 = f2
  11902. }
  11903. goto _9
  11904. _9:
  11905. ;
  11906. f2 += uintptr(size2)
  11907. }
  11908. if sense > 0 {
  11909. s = f2 - uintptr(size)
  11910. for cond := true; cond; cond = f1 < s {
  11911. i = libc.Int32FromUint64(size)
  11912. for {
  11913. tmp = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(f1)))
  11914. v17 = f1
  11915. f1++
  11916. *(*uint8)(unsafe.Pointer(v17)) = *(*uint8)(unsafe.Pointer(s))
  11917. v18 = s
  11918. s++
  11919. *(*uint8)(unsafe.Pointer(v18)) = libc.Uint8FromInt32(tmp)
  11920. goto _16
  11921. _16:
  11922. ;
  11923. i--
  11924. v15 = i
  11925. if !(v15 != 0) {
  11926. break
  11927. }
  11928. }
  11929. s -= uintptr(size2)
  11930. }
  11931. }
  11932. f1 = f2
  11933. if f2 < last || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, f2-uintptr(size), f2) > 0 {
  11934. v19 = uintptr(int64(f2)-int64(list1)) + list2
  11935. *(*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
  11936. p2 = v19
  11937. } else {
  11938. v20 = list2 + uintptr(n*size)
  11939. *(*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
  11940. p2 = v20
  11941. }
  11942. }
  11943. goto _1
  11944. _1:
  11945. ;
  11946. sense = libc.BoolInt32(!(sense != 0))
  11947. }
  11948. }
  11949. // C documentation
  11950. //
  11951. // /*
  11952. // * This is to avoid out-of-bounds addresses in sorting the
  11953. // * last 4 elements.
  11954. // */
  11955. func _insertionsort(tls *libc.TLS, a uintptr, n Tsize_t, size Tsize_t, cmp uintptr) {
  11956. var ai, s, t, u, v6, v7 uintptr
  11957. var i, v4 int32
  11958. var tmp uint8
  11959. var v2 Tsize_t
  11960. _, _, _, _, _, _, _, _, _, _ = ai, i, s, t, tmp, u, v2, v4, v6, v7
  11961. ai = a + uintptr(size)
  11962. for {
  11963. n--
  11964. v2 = n
  11965. if !(v2 >= uint64(1)) {
  11966. break
  11967. }
  11968. t = ai
  11969. for {
  11970. if !(t > a) {
  11971. break
  11972. }
  11973. u = t - uintptr(size)
  11974. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{cmp})))(tls, u, t) <= 0 {
  11975. break
  11976. }
  11977. s = t
  11978. i = libc.Int32FromUint64(size)
  11979. for {
  11980. tmp = *(*uint8)(unsafe.Pointer(u))
  11981. v6 = u
  11982. u++
  11983. *(*uint8)(unsafe.Pointer(v6)) = *(*uint8)(unsafe.Pointer(s))
  11984. v7 = s
  11985. s++
  11986. *(*uint8)(unsafe.Pointer(v7)) = tmp
  11987. goto _5
  11988. _5:
  11989. ;
  11990. i--
  11991. v4 = i
  11992. if !(v4 != 0) {
  11993. break
  11994. }
  11995. }
  11996. u -= uintptr(size)
  11997. goto _3
  11998. _3:
  11999. ;
  12000. t -= uintptr(size)
  12001. }
  12002. goto _1
  12003. _1:
  12004. ;
  12005. ai += uintptr(size)
  12006. }
  12007. }
  12008. const m_SIZE = 512
  12009. const m_THRESHOLD1 = 20
  12010. type Tstack = struct {
  12011. Fsa uintptr
  12012. Fsn int32
  12013. Fsi int32
  12014. }
  12015. func Xradixsort(tls *libc.TLS, a uintptr, n int32, tab uintptr, endch uint32) (r int32) {
  12016. bp := tls.Alloc(256)
  12017. defer tls.Free(256)
  12018. var c uint32
  12019. var tr uintptr
  12020. var _ /* tr0 at bp+0 */ [256]uint8
  12021. _, _ = c, tr
  12022. if tab == libc.UintptrFromInt32(0) {
  12023. tr = bp
  12024. c = uint32(0)
  12025. for {
  12026. if !(c < endch) {
  12027. break
  12028. }
  12029. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(c + uint32(1))
  12030. goto _1
  12031. _1:
  12032. ;
  12033. c++
  12034. }
  12035. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(0)
  12036. c++
  12037. for {
  12038. if !(c < uint32(256)) {
  12039. break
  12040. }
  12041. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(c)
  12042. goto _2
  12043. _2:
  12044. ;
  12045. c++
  12046. }
  12047. endch = uint32(0)
  12048. } else {
  12049. endch = uint32(*(*uint8)(unsafe.Pointer(tab + uintptr(endch))))
  12050. tr = tab
  12051. if endch != uint32(0) && endch != uint32(255) {
  12052. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  12053. return -int32(1)
  12054. }
  12055. }
  12056. _r_sort_a(tls, a, n, 0, tr, endch)
  12057. return 0
  12058. }
  12059. func Xsradixsort(tls *libc.TLS, a uintptr, n int32, tab uintptr, endch uint32) (r int32) {
  12060. bp := tls.Alloc(256)
  12061. defer tls.Free(256)
  12062. var c uint32
  12063. var ta, tr uintptr
  12064. var _ /* tr0 at bp+0 */ [256]uint8
  12065. _, _, _ = c, ta, tr
  12066. if a == libc.UintptrFromInt32(0) {
  12067. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EFAULT)
  12068. return -int32(1)
  12069. }
  12070. if tab == libc.UintptrFromInt32(0) {
  12071. tr = bp
  12072. c = uint32(0)
  12073. for {
  12074. if !(c < endch) {
  12075. break
  12076. }
  12077. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(c + uint32(1))
  12078. goto _1
  12079. _1:
  12080. ;
  12081. c++
  12082. }
  12083. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(0)
  12084. c++
  12085. for {
  12086. if !(c < uint32(256)) {
  12087. break
  12088. }
  12089. (*(*[256]uint8)(unsafe.Pointer(bp)))[c] = uint8(c)
  12090. goto _2
  12091. _2:
  12092. ;
  12093. c++
  12094. }
  12095. endch = uint32(0)
  12096. } else {
  12097. endch = uint32(*(*uint8)(unsafe.Pointer(tab + uintptr(endch))))
  12098. tr = tab
  12099. if endch != uint32(0) && endch != uint32(255) {
  12100. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  12101. return -int32(1)
  12102. }
  12103. }
  12104. if n < int32(m_THRESHOLD1) {
  12105. _simplesort(tls, a, n, 0, tr, endch)
  12106. } else {
  12107. ta = Xreallocarray(tls, libc.UintptrFromInt32(0), libc.Uint64FromInt32(n), uint64(8))
  12108. if ta == libc.UintptrFromInt32(0) {
  12109. return -int32(1)
  12110. }
  12111. _r_sort_b(tls, a, ta, n, 0, tr, endch)
  12112. libc.Xfree(tls, ta)
  12113. }
  12114. return 0
  12115. }
  12116. // C documentation
  12117. //
  12118. // /* Unstable, in-place sort. */
  12119. func _r_sort_a(tls *libc.TLS, a uintptr, n int32, i int32, tr uintptr, endch uint32) {
  12120. bp := tls.Alloc(10240)
  12121. defer tls.Free(10240)
  12122. var aj, ak, an, cp, r, sp, sp0, sp1, t, v1, v10, v12, v15, v16, v17, v2, v4, v6, v7, v9 uintptr
  12123. var bigc, c, v18, v5, v8 uint32
  12124. var temp Tstack
  12125. var _ /* s at bp+0 */ [512]Tstack
  12126. var _ /* top at bp+8192 */ [256]uintptr
  12127. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  12128. /* Set up stack. */
  12129. sp = bp
  12130. (*Tstack)(unsafe.Pointer(sp)).Fsa = a
  12131. (*Tstack)(unsafe.Pointer(sp)).Fsn = n
  12132. v1 = sp
  12133. sp += 16
  12134. (*Tstack)(unsafe.Pointer(v1)).Fsi = i
  12135. for !(bp >= sp) {
  12136. sp -= 16
  12137. v2 = sp
  12138. a = (*Tstack)(unsafe.Pointer(v2)).Fsa
  12139. n = (*Tstack)(unsafe.Pointer(sp)).Fsn
  12140. i = (*Tstack)(unsafe.Pointer(sp)).Fsi
  12141. if n < int32(m_THRESHOLD1) {
  12142. _simplesort(tls, a, n, i, tr, endch)
  12143. continue
  12144. }
  12145. an = a + uintptr(n)*8
  12146. /* Make character histogram. */
  12147. if _nc == uint32(0) {
  12148. _bmin = uint32(255) /* First occupied bin, excluding eos. */
  12149. ak = a
  12150. for {
  12151. if !(ak < an) {
  12152. break
  12153. }
  12154. v4 = ak
  12155. ak += 8
  12156. c = uint32(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(v4)) + uintptr(i)))))))
  12157. v6 = uintptr(unsafe.Pointer(&_count)) + uintptr(c)*4
  12158. *(*uint32)(unsafe.Pointer(v6))++
  12159. v5 = *(*uint32)(unsafe.Pointer(v6))
  12160. if v5 == uint32(1) && c != endch {
  12161. if c < _bmin {
  12162. _bmin = c
  12163. }
  12164. _nc++
  12165. }
  12166. goto _3
  12167. _3:
  12168. }
  12169. if sp+uintptr(_nc)*16 > bp+uintptr(m_SIZE)*16 { /* Get more stack. */
  12170. _r_sort_a(tls, a, n, i, tr, endch)
  12171. continue
  12172. }
  12173. }
  12174. /*
  12175. * Special case: if all strings have the same
  12176. * character at position i, move on to the next
  12177. * character.
  12178. */
  12179. if _nc == uint32(1) && _count[_bmin] == libc.Uint32FromInt32(n) {
  12180. (*Tstack)(unsafe.Pointer(sp)).Fsa = a
  12181. (*Tstack)(unsafe.Pointer(sp)).Fsn = n
  12182. v7 = sp
  12183. sp += 16
  12184. (*Tstack)(unsafe.Pointer(v7)).Fsi = i + libc.Int32FromInt32(1)
  12185. v8 = libc.Uint32FromInt32(0)
  12186. _count[_bmin] = v8
  12187. _nc = v8
  12188. continue
  12189. }
  12190. /*
  12191. * Set top[]; push incompletely sorted bins onto stack.
  12192. * top[] = pointers to last out-of-place element in bins.
  12193. * count[] = counts of elements in bins.
  12194. * Before permuting: top[c-1] + count[c] = top[c];
  12195. * during deal: top[c] counts down to top[c-1].
  12196. */
  12197. v9 = sp
  12198. sp1 = v9
  12199. sp0 = v9 /* Stack position of biggest bin. */
  12200. bigc = uint32(2) /* Size of biggest bin. */
  12201. if endch == uint32(0) { /* Special case: set top[eos]. */
  12202. v10 = a + uintptr(_count[0])*8
  12203. ak = v10
  12204. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[0] = v10
  12205. } else {
  12206. ak = a
  12207. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[int32(255)] = an
  12208. }
  12209. cp = uintptr(unsafe.Pointer(&_count)) + uintptr(_bmin)*4
  12210. for {
  12211. if !(_nc > uint32(0)) {
  12212. break
  12213. }
  12214. for *(*uint32)(unsafe.Pointer(cp)) == uint32(0) { /* Find next non-empty pile. */
  12215. cp += 4
  12216. }
  12217. if *(*uint32)(unsafe.Pointer(cp)) > uint32(1) {
  12218. if *(*uint32)(unsafe.Pointer(cp)) > bigc {
  12219. bigc = *(*uint32)(unsafe.Pointer(cp))
  12220. sp1 = sp
  12221. }
  12222. (*Tstack)(unsafe.Pointer(sp)).Fsa = ak
  12223. (*Tstack)(unsafe.Pointer(sp)).Fsn = libc.Int32FromUint32(*(*uint32)(unsafe.Pointer(cp)))
  12224. v12 = sp
  12225. sp += 16
  12226. (*Tstack)(unsafe.Pointer(v12)).Fsi = i + libc.Int32FromInt32(1)
  12227. }
  12228. ak += uintptr(*(*uint32)(unsafe.Pointer(cp))) * 8
  12229. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[(int64(cp)-t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_count))))/4] = ak
  12230. _nc--
  12231. goto _11
  12232. _11:
  12233. ;
  12234. cp += 4
  12235. }
  12236. temp = *(*Tstack)(unsafe.Pointer(sp0))
  12237. *(*Tstack)(unsafe.Pointer(sp0)) = *(*Tstack)(unsafe.Pointer(sp1))
  12238. *(*Tstack)(unsafe.Pointer(sp1)) = temp /* Play it safe -- biggest bin last. */
  12239. /*
  12240. * Permute misplacements home. Already home: everything
  12241. * before aj, and in bin[c], items from top[c] on.
  12242. * Inner loop:
  12243. * r = next element to put in place;
  12244. * ak = top[r[i]] = location to put the next element.
  12245. * aj = bottom of 1st disordered bin.
  12246. * Outer loop:
  12247. * Once the 1st disordered bin is done, ie. aj >= ak,
  12248. * aj<-aj + count[c] connects the bins in a linked list;
  12249. * reset count[c].
  12250. */
  12251. aj = a
  12252. for {
  12253. if !(aj < an) {
  12254. break
  12255. }
  12256. r = *(*uintptr)(unsafe.Pointer(aj))
  12257. for {
  12258. v18 = uint32(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(r + uintptr(i)))))))
  12259. c = v18
  12260. v17 = bp + 8192 + uintptr(v18)*8
  12261. *(*uintptr)(unsafe.Pointer(v17)) -= 8
  12262. v16 = *(*uintptr)(unsafe.Pointer(v17))
  12263. v15 = v16
  12264. ak = v15
  12265. if !(aj < v15) {
  12266. break
  12267. }
  12268. t = *(*uintptr)(unsafe.Pointer(ak))
  12269. *(*uintptr)(unsafe.Pointer(ak)) = r
  12270. r = t
  12271. goto _14
  12272. _14:
  12273. }
  12274. goto _13
  12275. _13:
  12276. ;
  12277. *(*uintptr)(unsafe.Pointer(aj)) = r
  12278. aj += uintptr(_count[c]) * 8
  12279. _count[c] = libc.Uint32FromInt32(0)
  12280. }
  12281. }
  12282. }
  12283. var _count [256]uint32
  12284. var _nc uint32
  12285. var _bmin uint32
  12286. // C documentation
  12287. //
  12288. // /* Stable sort, requiring additional memory. */
  12289. func _r_sort_b(tls *libc.TLS, a uintptr, ta uintptr, n int32, i int32, tr uintptr, endch uint32) {
  12290. bp := tls.Alloc(10240)
  12291. defer tls.Free(10240)
  12292. var ai, ak, cp, sp, sp0, sp1, v1, v11, v13, v14, v16, v17, v18, v2, v4, v6, v7, v8 uintptr
  12293. var bigc, c, v10, v5 uint32
  12294. var temp Tstack
  12295. var _ /* s at bp+0 */ [512]Tstack
  12296. var _ /* top at bp+8192 */ [256]uintptr
  12297. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ai, ak, bigc, c, cp, sp, sp0, sp1, temp, v1, v10, v11, v13, v14, v16, v17, v18, v2, v4, v5, v6, v7, v8
  12298. sp = bp
  12299. (*Tstack)(unsafe.Pointer(sp)).Fsa = a
  12300. (*Tstack)(unsafe.Pointer(sp)).Fsn = n
  12301. v1 = sp
  12302. sp += 16
  12303. (*Tstack)(unsafe.Pointer(v1)).Fsi = i
  12304. for !(bp >= sp) {
  12305. sp -= 16
  12306. v2 = sp
  12307. a = (*Tstack)(unsafe.Pointer(v2)).Fsa
  12308. n = (*Tstack)(unsafe.Pointer(sp)).Fsn
  12309. i = (*Tstack)(unsafe.Pointer(sp)).Fsi
  12310. if n < int32(m_THRESHOLD1) {
  12311. _simplesort(tls, a, n, i, tr, endch)
  12312. continue
  12313. }
  12314. if _nc1 == uint32(0) {
  12315. _bmin1 = uint32(255)
  12316. ak = a + uintptr(n)*8
  12317. for {
  12318. ak -= 8
  12319. v4 = ak
  12320. if !(v4 >= a) {
  12321. break
  12322. }
  12323. c = uint32(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ak)) + uintptr(i)))))))
  12324. v6 = uintptr(unsafe.Pointer(&_count1)) + uintptr(c)*4
  12325. *(*uint32)(unsafe.Pointer(v6))++
  12326. v5 = *(*uint32)(unsafe.Pointer(v6))
  12327. if v5 == uint32(1) && c != endch {
  12328. if c < _bmin1 {
  12329. _bmin1 = c
  12330. }
  12331. _nc1++
  12332. }
  12333. goto _3
  12334. _3:
  12335. }
  12336. if sp+uintptr(_nc1)*16 > bp+uintptr(m_SIZE)*16 {
  12337. _r_sort_b(tls, a, ta, n, i, tr, endch)
  12338. continue
  12339. }
  12340. }
  12341. v7 = sp
  12342. sp1 = v7
  12343. sp0 = v7
  12344. bigc = uint32(2)
  12345. if endch == uint32(0) {
  12346. v8 = a + uintptr(_count1[0])*8
  12347. ak = v8
  12348. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[0] = v8
  12349. _count1[0] = uint32(0)
  12350. } else {
  12351. ak = a
  12352. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[int32(255)] = a + uintptr(n)*8
  12353. _count1[int32(255)] = uint32(0)
  12354. }
  12355. cp = uintptr(unsafe.Pointer(&_count1)) + uintptr(_bmin1)*4
  12356. for {
  12357. if !(_nc1 > uint32(0)) {
  12358. break
  12359. }
  12360. for *(*uint32)(unsafe.Pointer(cp)) == uint32(0) {
  12361. cp += 4
  12362. }
  12363. v10 = *(*uint32)(unsafe.Pointer(cp))
  12364. c = v10
  12365. if v10 > uint32(1) {
  12366. if c > bigc {
  12367. bigc = c
  12368. sp1 = sp
  12369. }
  12370. (*Tstack)(unsafe.Pointer(sp)).Fsa = ak
  12371. (*Tstack)(unsafe.Pointer(sp)).Fsn = libc.Int32FromUint32(c)
  12372. v11 = sp
  12373. sp += 16
  12374. (*Tstack)(unsafe.Pointer(v11)).Fsi = i + libc.Int32FromInt32(1)
  12375. }
  12376. ak += uintptr(c) * 8
  12377. (*(*[256]uintptr)(unsafe.Pointer(bp + 8192)))[(int64(cp)-t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_count1))))/4] = ak
  12378. *(*uint32)(unsafe.Pointer(cp)) = uint32(0) /* Reset count[]. */
  12379. _nc1--
  12380. goto _9
  12381. _9:
  12382. ;
  12383. cp += 4
  12384. }
  12385. temp = *(*Tstack)(unsafe.Pointer(sp0))
  12386. *(*Tstack)(unsafe.Pointer(sp0)) = *(*Tstack)(unsafe.Pointer(sp1))
  12387. *(*Tstack)(unsafe.Pointer(sp1)) = temp
  12388. ak = ta + uintptr(n)*8
  12389. ai = a + uintptr(n)*8
  12390. for {
  12391. if !(ak > ta) {
  12392. break
  12393. } /* Copy to temp. */
  12394. ak -= 8
  12395. v13 = ak
  12396. ai -= 8
  12397. v14 = ai
  12398. *(*uintptr)(unsafe.Pointer(v13)) = *(*uintptr)(unsafe.Pointer(v14))
  12399. goto _12
  12400. _12:
  12401. }
  12402. ak = ta + uintptr(n)*8
  12403. for {
  12404. ak -= 8
  12405. v16 = ak
  12406. if !(v16 >= ta) {
  12407. break
  12408. } /* Deal to piles. */
  12409. v18 = bp + 8192 + uintptr(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ak)) + uintptr(i)))))))*8
  12410. *(*uintptr)(unsafe.Pointer(v18)) -= 8
  12411. v17 = *(*uintptr)(unsafe.Pointer(v18))
  12412. *(*uintptr)(unsafe.Pointer(v17)) = *(*uintptr)(unsafe.Pointer(ak))
  12413. goto _15
  12414. _15:
  12415. }
  12416. }
  12417. }
  12418. var _count1 [256]uint32
  12419. var _nc1 uint32
  12420. var _bmin1 uint32
  12421. // C documentation
  12422. //
  12423. // /* insertion sort */
  12424. func _simplesort(tls *libc.TLS, a uintptr, n int32, b int32, tr uintptr, endch uint32) {
  12425. var ai, ak, s, t uintptr
  12426. var ch, v5 uint8
  12427. var v2 int32
  12428. _, _, _, _, _, _, _ = ai, ak, ch, s, t, v2, v5
  12429. ak = a + uintptr(1)*8
  12430. for {
  12431. n--
  12432. v2 = n
  12433. if !(v2 >= int32(1)) {
  12434. break
  12435. }
  12436. ai = ak
  12437. for {
  12438. if !(ai > a) {
  12439. break
  12440. }
  12441. s = *(*uintptr)(unsafe.Pointer(ai)) + uintptr(b)
  12442. t = *(*uintptr)(unsafe.Pointer(ai + uintptr(-libc.Int32FromInt32(1))*8)) + uintptr(b)
  12443. for {
  12444. v5 = *(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(s)))))
  12445. ch = v5
  12446. if !(uint32(v5) != endch) {
  12447. break
  12448. }
  12449. if libc.Int32FromUint8(ch) != libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(t)))))) {
  12450. break
  12451. }
  12452. goto _4
  12453. _4:
  12454. ;
  12455. s++
  12456. t++
  12457. }
  12458. if libc.Int32FromUint8(ch) >= libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(tr + uintptr(*(*uint8)(unsafe.Pointer(t)))))) {
  12459. break
  12460. }
  12461. s = *(*uintptr)(unsafe.Pointer(ai))
  12462. *(*uintptr)(unsafe.Pointer(ai)) = *(*uintptr)(unsafe.Pointer(ai + uintptr(-libc.Int32FromInt32(1))*8))
  12463. *(*uintptr)(unsafe.Pointer(ai + uintptr(-libc.Int32FromInt32(1))*8)) = s
  12464. goto _3
  12465. _3:
  12466. ;
  12467. ai -= 8
  12468. }
  12469. goto _1
  12470. _1:
  12471. ;
  12472. ak += 8
  12473. }
  12474. }
  12475. const m__SL_CHUNKSIZE = 20
  12476. type TStringList = struct {
  12477. Fsl_str uintptr
  12478. Fsl_max Tsize_t
  12479. Fsl_cur Tsize_t
  12480. }
  12481. type T_stringlist = TStringList
  12482. // C documentation
  12483. //
  12484. // /*
  12485. // * sl_init(): Initialize a string list
  12486. // */
  12487. func Xsl_init(tls *libc.TLS) (r uintptr) {
  12488. var sl uintptr
  12489. _ = sl
  12490. sl = libc.Xmalloc(tls, uint64(24))
  12491. if sl == libc.UintptrFromInt32(0) {
  12492. return libc.UintptrFromInt32(0)
  12493. }
  12494. (*TStringList)(unsafe.Pointer(sl)).Fsl_cur = uint64(0)
  12495. (*TStringList)(unsafe.Pointer(sl)).Fsl_max = uint64(m__SL_CHUNKSIZE)
  12496. (*TStringList)(unsafe.Pointer(sl)).Fsl_str = Xreallocarray(tls, libc.UintptrFromInt32(0), (*TStringList)(unsafe.Pointer(sl)).Fsl_max, uint64(8))
  12497. if (*TStringList)(unsafe.Pointer(sl)).Fsl_str == libc.UintptrFromInt32(0) {
  12498. libc.Xfree(tls, sl)
  12499. sl = libc.UintptrFromInt32(0)
  12500. }
  12501. return sl
  12502. }
  12503. // C documentation
  12504. //
  12505. // /*
  12506. // * sl_add(): Add an item to the string list
  12507. // */
  12508. func Xsl_add(tls *libc.TLS, sl uintptr, name uintptr) (r int32) {
  12509. var new1, v2 uintptr
  12510. var v1 Tsize_t
  12511. _, _, _ = new1, v1, v2
  12512. if (*TStringList)(unsafe.Pointer(sl)).Fsl_cur == (*TStringList)(unsafe.Pointer(sl)).Fsl_max-uint64(1) {
  12513. new1 = Xreallocarray(tls, (*TStringList)(unsafe.Pointer(sl)).Fsl_str, (*TStringList)(unsafe.Pointer(sl)).Fsl_max+libc.Uint64FromInt32(m__SL_CHUNKSIZE), uint64(8))
  12514. if new1 == libc.UintptrFromInt32(0) {
  12515. return -int32(1)
  12516. }
  12517. *(*Tsize_t)(unsafe.Pointer(sl + 8)) += uint64(m__SL_CHUNKSIZE)
  12518. (*TStringList)(unsafe.Pointer(sl)).Fsl_str = new1
  12519. }
  12520. v2 = sl + 16
  12521. v1 = *(*Tsize_t)(unsafe.Pointer(v2))
  12522. *(*Tsize_t)(unsafe.Pointer(v2))++
  12523. *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(v1)*8)) = name
  12524. return 0
  12525. }
  12526. // C documentation
  12527. //
  12528. // /*
  12529. // * sl_free(): Free a stringlist
  12530. // */
  12531. func Xsl_free(tls *libc.TLS, sl uintptr, all int32) {
  12532. var i Tsize_t
  12533. _ = i
  12534. if sl == libc.UintptrFromInt32(0) {
  12535. return
  12536. }
  12537. if (*TStringList)(unsafe.Pointer(sl)).Fsl_str != 0 {
  12538. if all != 0 {
  12539. i = uint64(0)
  12540. for {
  12541. if !(i < (*TStringList)(unsafe.Pointer(sl)).Fsl_cur) {
  12542. break
  12543. }
  12544. libc.Xfree(tls, *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*8)))
  12545. goto _1
  12546. _1:
  12547. ;
  12548. i++
  12549. }
  12550. }
  12551. libc.Xfree(tls, (*TStringList)(unsafe.Pointer(sl)).Fsl_str)
  12552. }
  12553. libc.Xfree(tls, sl)
  12554. }
  12555. // C documentation
  12556. //
  12557. // /*
  12558. // * sl_find(): Find a name in the string list
  12559. // */
  12560. func Xsl_find(tls *libc.TLS, sl uintptr, name uintptr) (r uintptr) {
  12561. var i Tsize_t
  12562. _ = i
  12563. i = uint64(0)
  12564. for {
  12565. if !(i < (*TStringList)(unsafe.Pointer(sl)).Fsl_cur) {
  12566. break
  12567. }
  12568. if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*8)), name) == 0 {
  12569. return *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*8))
  12570. }
  12571. goto _1
  12572. _1:
  12573. ;
  12574. i++
  12575. }
  12576. return libc.UintptrFromInt32(0)
  12577. }
  12578. func Xsl_delete(tls *libc.TLS, sl uintptr, name uintptr, all int32) (r int32) {
  12579. var i, j, v3 Tsize_t
  12580. var v4 uintptr
  12581. _, _, _, _ = i, j, v3, v4
  12582. i = uint64(0)
  12583. for {
  12584. if !(i < (*TStringList)(unsafe.Pointer(sl)).Fsl_cur) {
  12585. break
  12586. }
  12587. if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*8)), name) == 0 {
  12588. if all != 0 {
  12589. libc.Xfree(tls, *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(i)*8)))
  12590. }
  12591. j = i + uint64(1)
  12592. for {
  12593. if !(j < (*TStringList)(unsafe.Pointer(sl)).Fsl_cur) {
  12594. break
  12595. }
  12596. *(*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))
  12597. goto _2
  12598. _2:
  12599. ;
  12600. j++
  12601. }
  12602. v4 = sl + 16
  12603. *(*Tsize_t)(unsafe.Pointer(v4))--
  12604. v3 = *(*Tsize_t)(unsafe.Pointer(v4))
  12605. *(*uintptr)(unsafe.Pointer((*TStringList)(unsafe.Pointer(sl)).Fsl_str + uintptr(v3)*8)) = libc.UintptrFromInt32(0)
  12606. return 0
  12607. }
  12608. goto _1
  12609. _1:
  12610. ;
  12611. i++
  12612. }
  12613. return -int32(1)
  12614. }
  12615. // C documentation
  12616. //
  12617. // /*
  12618. // * Appends src to string dst of size dsize (unlike strncat, dsize is the
  12619. // * full size of dst, not space left). At most dsize-1 characters
  12620. // * will be copied. Always NUL terminates (unless dsize <= strlen(dst)).
  12621. // * Returns strlen(src) + MIN(dsize, strlen(initial dst)).
  12622. // * If retval >= dsize, truncation occurred.
  12623. // */
  12624. func Xstrlcat(tls *libc.TLS, dst uintptr, src uintptr, dsize Tsize_t) (r Tsize_t) {
  12625. var dlen, n, v1, v2 Tsize_t
  12626. var odst, osrc, v3 uintptr
  12627. _, _, _, _, _, _, _ = dlen, n, odst, osrc, v1, v2, v3
  12628. odst = dst
  12629. osrc = src
  12630. n = dsize
  12631. /* Find the end of dst and adjust bytes left but don't go past end. */
  12632. for {
  12633. v1 = n
  12634. n--
  12635. if !(v1 != uint64(0) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(dst))) != int32('\000')) {
  12636. break
  12637. }
  12638. dst++
  12639. }
  12640. dlen = libc.Uint64FromInt64(int64(dst) - int64(odst))
  12641. n = dsize - dlen
  12642. v2 = n
  12643. n--
  12644. if v2 == uint64(0) {
  12645. return dlen + libc.Xstrlen(tls, src)
  12646. }
  12647. for libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(src))) != int32('\000') {
  12648. if n != uint64(0) {
  12649. v3 = dst
  12650. dst++
  12651. *(*uint8)(unsafe.Pointer(v3)) = *(*uint8)(unsafe.Pointer(src))
  12652. n--
  12653. }
  12654. src++
  12655. }
  12656. *(*uint8)(unsafe.Pointer(dst)) = uint8('\000')
  12657. return dlen + libc.Uint64FromInt64(int64(src)-int64(osrc)) /* count does not include NUL */
  12658. }
  12659. // C documentation
  12660. //
  12661. // /*
  12662. // * Copy string src to buffer dst of size dsize. At most dsize-1
  12663. // * chars will be copied. Always NUL terminates (unless dsize == 0).
  12664. // * Returns strlen(src); if retval >= dsize, truncation occurred.
  12665. // */
  12666. func Xstrlcpy(tls *libc.TLS, dst uintptr, src uintptr, dsize Tsize_t) (r Tsize_t) {
  12667. var nleft, v1 Tsize_t
  12668. var osrc, v3, v4, v5 uintptr
  12669. var v2 uint8
  12670. _, _, _, _, _, _, _ = nleft, osrc, v1, v2, v3, v4, v5
  12671. osrc = src
  12672. nleft = dsize
  12673. /* Copy as many bytes as will fit. */
  12674. if nleft != uint64(0) {
  12675. for {
  12676. nleft--
  12677. v1 = nleft
  12678. if !(v1 != uint64(0)) {
  12679. break
  12680. }
  12681. v3 = src
  12682. src++
  12683. v2 = *(*uint8)(unsafe.Pointer(v3))
  12684. v4 = dst
  12685. dst++
  12686. *(*uint8)(unsafe.Pointer(v4)) = v2
  12687. if libc.Int32FromUint8(v2) == int32('\000') {
  12688. break
  12689. }
  12690. }
  12691. }
  12692. /* Not enough room in dst, add NUL and traverse rest of src. */
  12693. if nleft == uint64(0) {
  12694. if dsize != uint64(0) {
  12695. *(*uint8)(unsafe.Pointer(dst)) = uint8('\000')
  12696. } /* NUL-terminate dst */
  12697. for {
  12698. v5 = src
  12699. src++
  12700. if !(*(*uint8)(unsafe.Pointer(v5)) != 0) {
  12701. break
  12702. }
  12703. }
  12704. }
  12705. return libc.Uint64FromInt64(int64(src) - int64(osrc) - libc.Int64FromInt32(1)) /* count does not include NUL */
  12706. }
  12707. const m_S_IFBLK1 = 24576
  12708. const m_S_IFCHR1 = 8192
  12709. const m_S_IFDIR2 = 16384
  12710. const m_S_IFIFO1 = 4096
  12711. const m_S_IFLNK1 = 40960
  12712. const m_S_IFMT1 = 61440
  12713. const m_S_IFREG1 = 32768
  12714. const m_S_IFSOCK1 = 49152
  12715. const m_S_IRGRP2 = 32
  12716. const m_S_IROTH2 = 4
  12717. const m_S_IRUSR2 = 256
  12718. const m_S_ISGID2 = 1024
  12719. const m_S_ISUID2 = 2048
  12720. const m_S_ISVTX2 = 512
  12721. const m_S_IWGRP2 = 16
  12722. const m_S_IWOTH2 = 2
  12723. const m_S_IWUSR2 = 128
  12724. const m_S_IXGRP2 = 8
  12725. const m_S_IXOTH2 = 1
  12726. const m_S_IXUSR2 = 64
  12727. func Xstrmode(tls *libc.TLS, mode Tmode_t, p uintptr) {
  12728. 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
  12729. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  12730. /* print type */
  12731. switch mode & libc.Uint32FromInt32(m_S_IFMT1) {
  12732. case uint32(m_S_IFDIR2): /* directory */
  12733. v1 = p
  12734. p++
  12735. *(*uint8)(unsafe.Pointer(v1)) = uint8('d')
  12736. case uint32(m_S_IFCHR1): /* character special */
  12737. v2 = p
  12738. p++
  12739. *(*uint8)(unsafe.Pointer(v2)) = uint8('c')
  12740. case uint32(m_S_IFBLK1): /* block special */
  12741. v3 = p
  12742. p++
  12743. *(*uint8)(unsafe.Pointer(v3)) = uint8('b')
  12744. case uint32(m_S_IFREG1): /* regular */
  12745. v4 = p
  12746. p++
  12747. *(*uint8)(unsafe.Pointer(v4)) = uint8('-')
  12748. case uint32(m_S_IFLNK1): /* symbolic link */
  12749. v5 = p
  12750. p++
  12751. *(*uint8)(unsafe.Pointer(v5)) = uint8('l')
  12752. case uint32(m_S_IFSOCK1): /* socket */
  12753. v6 = p
  12754. p++
  12755. *(*uint8)(unsafe.Pointer(v6)) = uint8('s')
  12756. case uint32(m_S_IFIFO1): /* fifo */
  12757. v7 = p
  12758. p++
  12759. *(*uint8)(unsafe.Pointer(v7)) = uint8('p')
  12760. default: /* unknown */
  12761. v8 = p
  12762. p++
  12763. *(*uint8)(unsafe.Pointer(v8)) = uint8('?')
  12764. break
  12765. }
  12766. /* usr */
  12767. if mode&uint32(m_S_IRUSR2) != 0 {
  12768. v9 = p
  12769. p++
  12770. *(*uint8)(unsafe.Pointer(v9)) = uint8('r')
  12771. } else {
  12772. v10 = p
  12773. p++
  12774. *(*uint8)(unsafe.Pointer(v10)) = uint8('-')
  12775. }
  12776. if mode&uint32(m_S_IWUSR2) != 0 {
  12777. v11 = p
  12778. p++
  12779. *(*uint8)(unsafe.Pointer(v11)) = uint8('w')
  12780. } else {
  12781. v12 = p
  12782. p++
  12783. *(*uint8)(unsafe.Pointer(v12)) = uint8('-')
  12784. }
  12785. switch mode & libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXUSR2)|libc.Int32FromInt32(m_S_ISUID2)) {
  12786. case uint32(0):
  12787. v13 = p
  12788. p++
  12789. *(*uint8)(unsafe.Pointer(v13)) = uint8('-')
  12790. case uint32(m_S_IXUSR2):
  12791. v14 = p
  12792. p++
  12793. *(*uint8)(unsafe.Pointer(v14)) = uint8('x')
  12794. case uint32(m_S_ISUID2):
  12795. v15 = p
  12796. p++
  12797. *(*uint8)(unsafe.Pointer(v15)) = uint8('S')
  12798. case libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXUSR2) | libc.Int32FromInt32(m_S_ISUID2)):
  12799. v16 = p
  12800. p++
  12801. *(*uint8)(unsafe.Pointer(v16)) = uint8('s')
  12802. break
  12803. }
  12804. /* group */
  12805. if mode&uint32(m_S_IRGRP2) != 0 {
  12806. v17 = p
  12807. p++
  12808. *(*uint8)(unsafe.Pointer(v17)) = uint8('r')
  12809. } else {
  12810. v18 = p
  12811. p++
  12812. *(*uint8)(unsafe.Pointer(v18)) = uint8('-')
  12813. }
  12814. if mode&uint32(m_S_IWGRP2) != 0 {
  12815. v19 = p
  12816. p++
  12817. *(*uint8)(unsafe.Pointer(v19)) = uint8('w')
  12818. } else {
  12819. v20 = p
  12820. p++
  12821. *(*uint8)(unsafe.Pointer(v20)) = uint8('-')
  12822. }
  12823. switch mode & libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXGRP2)|libc.Int32FromInt32(m_S_ISGID2)) {
  12824. case uint32(0):
  12825. v21 = p
  12826. p++
  12827. *(*uint8)(unsafe.Pointer(v21)) = uint8('-')
  12828. case uint32(m_S_IXGRP2):
  12829. v22 = p
  12830. p++
  12831. *(*uint8)(unsafe.Pointer(v22)) = uint8('x')
  12832. case uint32(m_S_ISGID2):
  12833. v23 = p
  12834. p++
  12835. *(*uint8)(unsafe.Pointer(v23)) = uint8('S')
  12836. case libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXGRP2) | libc.Int32FromInt32(m_S_ISGID2)):
  12837. v24 = p
  12838. p++
  12839. *(*uint8)(unsafe.Pointer(v24)) = uint8('s')
  12840. break
  12841. }
  12842. /* other */
  12843. if mode&uint32(m_S_IROTH2) != 0 {
  12844. v25 = p
  12845. p++
  12846. *(*uint8)(unsafe.Pointer(v25)) = uint8('r')
  12847. } else {
  12848. v26 = p
  12849. p++
  12850. *(*uint8)(unsafe.Pointer(v26)) = uint8('-')
  12851. }
  12852. if mode&uint32(m_S_IWOTH2) != 0 {
  12853. v27 = p
  12854. p++
  12855. *(*uint8)(unsafe.Pointer(v27)) = uint8('w')
  12856. } else {
  12857. v28 = p
  12858. p++
  12859. *(*uint8)(unsafe.Pointer(v28)) = uint8('-')
  12860. }
  12861. switch mode & libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXOTH2)|libc.Int32FromInt32(m_S_ISVTX2)) {
  12862. case uint32(0):
  12863. v29 = p
  12864. p++
  12865. *(*uint8)(unsafe.Pointer(v29)) = uint8('-')
  12866. case uint32(m_S_IXOTH2):
  12867. v30 = p
  12868. p++
  12869. *(*uint8)(unsafe.Pointer(v30)) = uint8('x')
  12870. case uint32(m_S_ISVTX2):
  12871. v31 = p
  12872. p++
  12873. *(*uint8)(unsafe.Pointer(v31)) = uint8('T')
  12874. case libc.Uint32FromInt32(libc.Int32FromInt32(m_S_IXOTH2) | libc.Int32FromInt32(m_S_ISVTX2)):
  12875. v32 = p
  12876. p++
  12877. *(*uint8)(unsafe.Pointer(v32)) = uint8('t')
  12878. break
  12879. }
  12880. v33 = p
  12881. p++
  12882. *(*uint8)(unsafe.Pointer(v33)) = uint8(' ') /* will be a '+' if ACL's implemented */
  12883. *(*uint8)(unsafe.Pointer(p)) = uint8('\000')
  12884. }
  12885. // C documentation
  12886. //
  12887. // /*
  12888. // * Find the first occurrence of find in s, where the search is limited to the
  12889. // * first slen characters of s.
  12890. // */
  12891. func Xstrnstr(tls *libc.TLS, s uintptr, find uintptr, slen Tsize_t) (r uintptr) {
  12892. var c, sc, v1, v4 uint8
  12893. var len1, v3 Tsize_t
  12894. var v2, v5 uintptr
  12895. var v6 bool
  12896. _, _, _, _, _, _, _, _, _ = c, len1, sc, v1, v2, v3, v4, v5, v6
  12897. v2 = find
  12898. find++
  12899. v1 = *(*uint8)(unsafe.Pointer(v2))
  12900. c = v1
  12901. if libc.Int32FromUint8(v1) != int32('\000') {
  12902. len1 = libc.Xstrlen(tls, find)
  12903. for cond := true; cond; cond = libc.Xstrncmp(tls, s, find, len1) != 0 {
  12904. for cond := true; cond; cond = libc.Int32FromUint8(sc) != libc.Int32FromUint8(c) {
  12905. v3 = slen
  12906. slen--
  12907. if v6 = v3 < uint64(1); !v6 {
  12908. v5 = s
  12909. s++
  12910. v4 = *(*uint8)(unsafe.Pointer(v5))
  12911. sc = v4
  12912. }
  12913. if v6 || libc.Int32FromUint8(v4) == int32('\000') {
  12914. return libc.UintptrFromInt32(0)
  12915. }
  12916. }
  12917. if len1 > slen {
  12918. return libc.UintptrFromInt32(0)
  12919. }
  12920. }
  12921. s--
  12922. }
  12923. return s
  12924. }
  12925. const m_S_IFBLK2 = 0060000
  12926. const m_S_IFCHR2 = 0020000
  12927. const m_S_IFDIR3 = 0040000
  12928. const m_S_IFIFO2 = 0010000
  12929. const m_S_IFLNK2 = 0120000
  12930. const m_S_IFMT2 = 0170000
  12931. const m_S_IFREG2 = 0100000
  12932. const m_S_IFSOCK2 = 0140000
  12933. const m_S_IRGRP3 = 0040
  12934. const m_S_IROTH3 = 0004
  12935. const m_S_IRUSR3 = 0400
  12936. const m_S_ISGID3 = 02000
  12937. const m_S_ISUID3 = 04000
  12938. const m_S_ISVTX3 = 01000
  12939. const m_S_IWGRP3 = 0020
  12940. const m_S_IWOTH3 = 0002
  12941. const m_S_IWUSR3 = 0200
  12942. const m_S_IXGRP3 = 0010
  12943. const m_S_IXOTH3 = 0001
  12944. const m_S_IXUSR3 = 0100
  12945. func Xstrtonum(tls *libc.TLS, nptr uintptr, minval int64, maxval int64, errstr uintptr) (r int64) {
  12946. bp := tls.Alloc(32)
  12947. defer tls.Free(32)
  12948. var rv int64
  12949. var v1 uintptr
  12950. var _ /* e at bp+0 */ int32
  12951. var _ /* eptr at bp+16 */ uintptr
  12952. var _ /* resp at bp+8 */ uintptr
  12953. _, _ = rv, v1
  12954. if errstr == libc.UintptrFromInt32(0) {
  12955. errstr = bp + 8
  12956. }
  12957. if minval > maxval {
  12958. goto out
  12959. }
  12960. rv = Xstrtoi(tls, nptr, bp+16, int32(10), minval, maxval, bp)
  12961. switch *(*int32)(unsafe.Pointer(bp)) {
  12962. case 0:
  12963. *(*uintptr)(unsafe.Pointer(errstr)) = libc.UintptrFromInt32(0)
  12964. return rv
  12965. case int32(m_ECANCELED):
  12966. fallthrough
  12967. case int32(m_EOPNOTSUPP):
  12968. fallthrough
  12969. case int32(m_EINVAL):
  12970. goto out
  12971. case int32(m_ERANGE):
  12972. if *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))) != 0 {
  12973. goto out
  12974. }
  12975. if rv == maxval {
  12976. v1 = __ccgo_ts + 441
  12977. } else {
  12978. v1 = __ccgo_ts + 451
  12979. }
  12980. *(*uintptr)(unsafe.Pointer(errstr)) = v1
  12981. return 0
  12982. default:
  12983. libc.Xabort(tls)
  12984. }
  12985. goto out
  12986. out:
  12987. ;
  12988. *(*uintptr)(unsafe.Pointer(errstr)) = __ccgo_ts + 461
  12989. return 0
  12990. }
  12991. func Xstrtoi(tls *libc.TLS, nptr uintptr, endptr uintptr, base int32, lo Tintmax_t, hi Tintmax_t, rstatus uintptr) (r Tintmax_t) {
  12992. bp := tls.Alloc(16)
  12993. defer tls.Free(16)
  12994. var im Tintmax_t
  12995. var serrno int32
  12996. var _ /* ep at bp+0 */ uintptr
  12997. var _ /* rep at bp+8 */ int32
  12998. _, _ = im, serrno
  12999. /* endptr may be NULL */
  13000. if endptr == libc.UintptrFromInt32(0) {
  13001. endptr = bp
  13002. }
  13003. if rstatus == libc.UintptrFromInt32(0) {
  13004. rstatus = bp + 8
  13005. }
  13006. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  13007. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  13008. im = libc.Xstrtoimax(tls, nptr, endptr, base)
  13009. *(*int32)(unsafe.Pointer(rstatus)) = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  13010. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  13011. /* No digits were found */
  13012. if *(*int32)(unsafe.Pointer(rstatus)) == 0 && nptr == *(*uintptr)(unsafe.Pointer(endptr)) {
  13013. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ECANCELED)
  13014. }
  13015. if im < lo {
  13016. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  13017. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ERANGE)
  13018. }
  13019. return lo
  13020. }
  13021. if im > hi {
  13022. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  13023. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ERANGE)
  13024. }
  13025. return hi
  13026. }
  13027. /* There are further characters after number */
  13028. if *(*int32)(unsafe.Pointer(rstatus)) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(endptr))))) != int32('\000') {
  13029. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_EOPNOTSUPP)
  13030. }
  13031. return im
  13032. }
  13033. func Xstrtou(tls *libc.TLS, nptr uintptr, endptr uintptr, base int32, lo Tuintmax_t, hi Tuintmax_t, rstatus uintptr) (r Tuintmax_t) {
  13034. bp := tls.Alloc(16)
  13035. defer tls.Free(16)
  13036. var im Tuintmax_t
  13037. var serrno int32
  13038. var _ /* ep at bp+0 */ uintptr
  13039. var _ /* rep at bp+8 */ int32
  13040. _, _ = im, serrno
  13041. /* endptr may be NULL */
  13042. if endptr == libc.UintptrFromInt32(0) {
  13043. endptr = bp
  13044. }
  13045. if rstatus == libc.UintptrFromInt32(0) {
  13046. rstatus = bp + 8
  13047. }
  13048. serrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  13049. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  13050. im = libc.Xstrtoumax(tls, nptr, endptr, base)
  13051. *(*int32)(unsafe.Pointer(rstatus)) = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))
  13052. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = serrno
  13053. /* No digits were found */
  13054. if *(*int32)(unsafe.Pointer(rstatus)) == 0 && nptr == *(*uintptr)(unsafe.Pointer(endptr)) {
  13055. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ECANCELED)
  13056. }
  13057. if im < lo {
  13058. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  13059. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ERANGE)
  13060. }
  13061. return lo
  13062. }
  13063. if im > hi {
  13064. if *(*int32)(unsafe.Pointer(rstatus)) == 0 {
  13065. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_ERANGE)
  13066. }
  13067. return hi
  13068. }
  13069. /* There are further characters after number */
  13070. if *(*int32)(unsafe.Pointer(rstatus)) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(endptr))))) != int32('\000') {
  13071. *(*int32)(unsafe.Pointer(rstatus)) = int32(m_EOPNOTSUPP)
  13072. }
  13073. return im
  13074. }
  13075. /*
  13076. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  13077. *
  13078. * Redistribution and use in source and binary forms, with or without
  13079. * modification, are permitted provided that the following conditions
  13080. * are met:
  13081. * 1. Redistributions of source code must retain the above copyright
  13082. * notice, this list of conditions and the following disclaimer.
  13083. * 2. Redistributions in binary form must reproduce the above copyright
  13084. * notice, this list of conditions and the following disclaimer in the
  13085. * documentation and/or other materials provided with the distribution.
  13086. * 3. The name of the author may not be used to endorse or promote products
  13087. * derived from this software without specific prior written permission.
  13088. *
  13089. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  13090. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  13091. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  13092. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  13093. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13094. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  13095. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  13096. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  13097. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  13098. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  13099. */
  13100. /*
  13101. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  13102. *
  13103. * Redistribution and use in source and binary forms, with or without
  13104. * modification, are permitted provided that the following conditions
  13105. * are met:
  13106. * 1. Redistributions of source code must retain the above copyright
  13107. * notice, this list of conditions and the following disclaimer.
  13108. * 2. Redistributions in binary form must reproduce the above copyright
  13109. * notice, this list of conditions and the following disclaimer in the
  13110. * documentation and/or other materials provided with the distribution.
  13111. * 3. The name of the author may not be used to endorse or promote products
  13112. * derived from this software without specific prior written permission.
  13113. *
  13114. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  13115. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  13116. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  13117. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  13118. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13119. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  13120. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  13121. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  13122. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  13123. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  13124. */
  13125. /* Clang expands this to 1 if an identifier is *not* reserved. */
  13126. /*
  13127. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  13128. * musl, try to handle this gracefully.
  13129. */
  13130. /* Copyright (C) 1992-2024 Free Software Foundation, Inc.
  13131. Copyright The GNU Toolchain Authors.
  13132. This file is part of the GNU C Library.
  13133. The GNU C Library is free software; you can redistribute it and/or
  13134. modify it under the terms of the GNU Lesser General Public
  13135. License as published by the Free Software Foundation; either
  13136. version 2.1 of the License, or (at your option) any later version.
  13137. The GNU C Library is distributed in the hope that it will be useful,
  13138. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13139. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13140. Lesser General Public License for more details.
  13141. You should have received a copy of the GNU Lesser General Public
  13142. License along with the GNU C Library; if not, see
  13143. <https://www.gnu.org/licenses/>. */
  13144. /*
  13145. * - enable time64 functions
  13146. * - symver libbsd<func>_time64 -> <func> 0.7
  13147. */
  13148. type Tlibbsd_time64_t = int64
  13149. func Xlibbsd_time32_to_time_time64(tls *libc.TLS, t32 Tint32_t) (r Tlibbsd_time64_t) {
  13150. return int64(t32)
  13151. }
  13152. func Xlibbsd_time_to_time32_time64(tls *libc.TLS, t Tlibbsd_time64_t) (r Tint32_t) {
  13153. return int32(t)
  13154. }
  13155. func Xlibbsd_time64_to_time_time64(tls *libc.TLS, t64 Tint64_t) (r Tlibbsd_time64_t) {
  13156. return t64
  13157. }
  13158. func Xlibbsd_time_to_time64_time64(tls *libc.TLS, t Tlibbsd_time64_t) (r Tint64_t) {
  13159. return t
  13160. }
  13161. func Xlibbsd_time_to_long_time64(tls *libc.TLS, t Tlibbsd_time64_t) (r int64) {
  13162. if uint64(8) == uint64(8) {
  13163. return Xlibbsd_time_to_time64_time64(tls, t)
  13164. }
  13165. return t
  13166. }
  13167. func Xlibbsd_long_to_time_time64(tls *libc.TLS, tlong int64) (r Tlibbsd_time64_t) {
  13168. if uint64(8) == uint64(4) {
  13169. return Xlibbsd_time32_to_time_time64(tls, int32(tlong))
  13170. }
  13171. return tlong
  13172. }
  13173. func Xlibbsd_time_to_int_time64(tls *libc.TLS, t Ttime_t) (r int32) {
  13174. if uint64(4) == uint64(8) {
  13175. return int32(Xlibbsd_time_to_time64_time64(tls, t))
  13176. }
  13177. return int32(t)
  13178. }
  13179. func Xlibbsd_int_to_time_time64(tls *libc.TLS, tint int32) (r Tlibbsd_time64_t) {
  13180. if uint64(4) == uint64(4) {
  13181. return Xlibbsd_time32_to_time_time64(tls, tint)
  13182. }
  13183. return int64(tint)
  13184. }
  13185. const m_S_AMP = 13
  13186. const m_S_CTRL = 4
  13187. const m_S_EATCRNL = 12
  13188. const m_S_GROUND = 0
  13189. const m_S_HEX = 7
  13190. const m_S_HEX1 = 8
  13191. const m_S_HEX2 = 9
  13192. const m_S_META = 2
  13193. const m_S_META1 = 3
  13194. const m_S_MIME1 = 10
  13195. const m_S_MIME2 = 11
  13196. const m_S_NUMBER = 14
  13197. const m_S_OCTAL2 = 5
  13198. const m_S_OCTAL3 = 6
  13199. const m_S_START = 1
  13200. const m_S_STRING = 15
  13201. const m_UNVIS_END = "_VIS_END"
  13202. const m_UNVIS_NOCHAR = 3
  13203. const m_UNVIS_VALID = 1
  13204. const m_UNVIS_VALIDPUSH = 2
  13205. const m_VIS_CSTYLE = 0x0002
  13206. const m_VIS_DQ = 0x8000
  13207. const m_VIS_GLOB = 0x1000
  13208. const m_VIS_HTTP1808 = 128
  13209. const m_VIS_HTTP1866 = 512
  13210. const m_VIS_HTTPSTYLE = 0x0080
  13211. const m_VIS_MIMESTYLE = 256
  13212. const m_VIS_NL = 0x0010
  13213. const m_VIS_NOESCAPE = 1024
  13214. const m_VIS_NOLOCALE = 0x4000
  13215. const m_VIS_NOSLASH = 0x0040
  13216. const m_VIS_OCTAL = 0x0001
  13217. const m_VIS_SAFE = 0x0020
  13218. const m_VIS_SHELL = 0x2000
  13219. const m_VIS_SP = 0x0004
  13220. const m_VIS_TAB = 0x0008
  13221. const m__VIS_END = 2048
  13222. /*
  13223. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  13224. *
  13225. * Redistribution and use in source and binary forms, with or without
  13226. * modification, are permitted provided that the following conditions
  13227. * are met:
  13228. * 1. Redistributions of source code must retain the above copyright
  13229. * notice, this list of conditions and the following disclaimer.
  13230. * 2. Redistributions in binary form must reproduce the above copyright
  13231. * notice, this list of conditions and the following disclaimer in the
  13232. * documentation and/or other materials provided with the distribution.
  13233. * 3. The name of the author may not be used to endorse or promote products
  13234. * derived from this software without specific prior written permission.
  13235. *
  13236. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  13237. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  13238. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  13239. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  13240. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13241. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  13242. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  13243. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  13244. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  13245. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  13246. */
  13247. /*
  13248. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  13249. *
  13250. * Redistribution and use in source and binary forms, with or without
  13251. * modification, are permitted provided that the following conditions
  13252. * are met:
  13253. * 1. Redistributions of source code must retain the above copyright
  13254. * notice, this list of conditions and the following disclaimer.
  13255. * 2. Redistributions in binary form must reproduce the above copyright
  13256. * notice, this list of conditions and the following disclaimer in the
  13257. * documentation and/or other materials provided with the distribution.
  13258. * 3. The name of the author may not be used to endorse or promote products
  13259. * derived from this software without specific prior written permission.
  13260. *
  13261. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  13262. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  13263. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  13264. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  13265. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13266. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  13267. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  13268. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  13269. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  13270. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  13271. */
  13272. /* Clang expands this to 1 if an identifier is *not* reserved. */
  13273. /*
  13274. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  13275. * musl, try to handle this gracefully.
  13276. */
  13277. /* Copyright (C) 1992-2024 Free Software Foundation, Inc.
  13278. Copyright The GNU Toolchain Authors.
  13279. This file is part of the GNU C Library.
  13280. The GNU C Library is free software; you can redistribute it and/or
  13281. modify it under the terms of the GNU Lesser General Public
  13282. License as published by the Free Software Foundation; either
  13283. version 2.1 of the License, or (at your option) any later version.
  13284. The GNU C Library is distributed in the hope that it will be useful,
  13285. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13286. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13287. Lesser General Public License for more details.
  13288. You should have received a copy of the GNU Lesser General Public
  13289. License along with the GNU C Library; if not, see
  13290. <https://www.gnu.org/licenses/>. */
  13291. /*
  13292. * decode driven by state machine
  13293. */
  13294. // C documentation
  13295. //
  13296. // /*
  13297. // * RFC 1866
  13298. // */
  13299. type Tnv = struct {
  13300. Fname [7]uint8
  13301. Fvalue Tuint8_t
  13302. }
  13303. /*
  13304. * Copyright © 2015 Guillem Jover <guillem@hadrons.org>
  13305. *
  13306. * Redistribution and use in source and binary forms, with or without
  13307. * modification, are permitted provided that the following conditions
  13308. * are met:
  13309. * 1. Redistributions of source code must retain the above copyright
  13310. * notice, this list of conditions and the following disclaimer.
  13311. * 2. Redistributions in binary form must reproduce the above copyright
  13312. * notice, this list of conditions and the following disclaimer in the
  13313. * documentation and/or other materials provided with the distribution.
  13314. * 3. The name of the author may not be used to endorse or promote products
  13315. * derived from this software without specific prior written permission.
  13316. *
  13317. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  13318. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  13319. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  13320. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  13321. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13322. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  13323. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  13324. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  13325. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  13326. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  13327. */
  13328. /*
  13329. * Copyright © 2004-2006, 2009-2011 Guillem Jover <guillem@hadrons.org>
  13330. *
  13331. * Redistribution and use in source and binary forms, with or without
  13332. * modification, are permitted provided that the following conditions
  13333. * are met:
  13334. * 1. Redistributions of source code must retain the above copyright
  13335. * notice, this list of conditions and the following disclaimer.
  13336. * 2. Redistributions in binary form must reproduce the above copyright
  13337. * notice, this list of conditions and the following disclaimer in the
  13338. * documentation and/or other materials provided with the distribution.
  13339. * 3. The name of the author may not be used to endorse or promote products
  13340. * derived from this software without specific prior written permission.
  13341. *
  13342. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  13343. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  13344. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  13345. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  13346. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13347. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  13348. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  13349. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  13350. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  13351. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  13352. */
  13353. /* Clang expands this to 1 if an identifier is *not* reserved. */
  13354. /*
  13355. * Some libc implementations do not have a <sys/cdefs.h>, in particular
  13356. * musl, try to handle this gracefully.
  13357. */
  13358. /* Copyright (C) 1992-2024 Free Software Foundation, Inc.
  13359. Copyright The GNU Toolchain Authors.
  13360. This file is part of the GNU C Library.
  13361. The GNU C Library is free software; you can redistribute it and/or
  13362. modify it under the terms of the GNU Lesser General Public
  13363. License as published by the Free Software Foundation; either
  13364. version 2.1 of the License, or (at your option) any later version.
  13365. The GNU C Library is distributed in the hope that it will be useful,
  13366. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13367. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13368. Lesser General Public License for more details.
  13369. You should have received a copy of the GNU Lesser General Public
  13370. License along with the GNU C Library; if not, see
  13371. <https://www.gnu.org/licenses/>. */
  13372. /*
  13373. * decode driven by state machine
  13374. */
  13375. // C documentation
  13376. //
  13377. // /*
  13378. // * RFC 1866
  13379. // */
  13380. var _nv = [100]Tnv{
  13381. 0: {
  13382. Fname: [7]uint8{'A', 'E', 'l', 'i', 'g'},
  13383. Fvalue: uint8(198),
  13384. },
  13385. 1: {
  13386. Fname: [7]uint8{'A', 'a', 'c', 'u', 't', 'e'},
  13387. Fvalue: uint8(193),
  13388. },
  13389. 2: {
  13390. Fname: [7]uint8{'A', 'c', 'i', 'r', 'c'},
  13391. Fvalue: uint8(194),
  13392. },
  13393. 3: {
  13394. Fname: [7]uint8{'A', 'g', 'r', 'a', 'v', 'e'},
  13395. Fvalue: uint8(192),
  13396. },
  13397. 4: {
  13398. Fname: [7]uint8{'A', 'r', 'i', 'n', 'g'},
  13399. Fvalue: uint8(197),
  13400. },
  13401. 5: {
  13402. Fname: [7]uint8{'A', 't', 'i', 'l', 'd', 'e'},
  13403. Fvalue: uint8(195),
  13404. },
  13405. 6: {
  13406. Fname: [7]uint8{'A', 'u', 'm', 'l'},
  13407. Fvalue: uint8(196),
  13408. },
  13409. 7: {
  13410. Fname: [7]uint8{'C', 'c', 'e', 'd', 'i', 'l'},
  13411. Fvalue: uint8(199),
  13412. },
  13413. 8: {
  13414. Fname: [7]uint8{'E', 'T', 'H'},
  13415. Fvalue: uint8(208),
  13416. },
  13417. 9: {
  13418. Fname: [7]uint8{'E', 'a', 'c', 'u', 't', 'e'},
  13419. Fvalue: uint8(201),
  13420. },
  13421. 10: {
  13422. Fname: [7]uint8{'E', 'c', 'i', 'r', 'c'},
  13423. Fvalue: uint8(202),
  13424. },
  13425. 11: {
  13426. Fname: [7]uint8{'E', 'g', 'r', 'a', 'v', 'e'},
  13427. Fvalue: uint8(200),
  13428. },
  13429. 12: {
  13430. Fname: [7]uint8{'E', 'u', 'm', 'l'},
  13431. Fvalue: uint8(203),
  13432. },
  13433. 13: {
  13434. Fname: [7]uint8{'I', 'a', 'c', 'u', 't', 'e'},
  13435. Fvalue: uint8(205),
  13436. },
  13437. 14: {
  13438. Fname: [7]uint8{'I', 'c', 'i', 'r', 'c'},
  13439. Fvalue: uint8(206),
  13440. },
  13441. 15: {
  13442. Fname: [7]uint8{'I', 'g', 'r', 'a', 'v', 'e'},
  13443. Fvalue: uint8(204),
  13444. },
  13445. 16: {
  13446. Fname: [7]uint8{'I', 'u', 'm', 'l'},
  13447. Fvalue: uint8(207),
  13448. },
  13449. 17: {
  13450. Fname: [7]uint8{'N', 't', 'i', 'l', 'd', 'e'},
  13451. Fvalue: uint8(209),
  13452. },
  13453. 18: {
  13454. Fname: [7]uint8{'O', 'a', 'c', 'u', 't', 'e'},
  13455. Fvalue: uint8(211),
  13456. },
  13457. 19: {
  13458. Fname: [7]uint8{'O', 'c', 'i', 'r', 'c'},
  13459. Fvalue: uint8(212),
  13460. },
  13461. 20: {
  13462. Fname: [7]uint8{'O', 'g', 'r', 'a', 'v', 'e'},
  13463. Fvalue: uint8(210),
  13464. },
  13465. 21: {
  13466. Fname: [7]uint8{'O', 's', 'l', 'a', 's', 'h'},
  13467. Fvalue: uint8(216),
  13468. },
  13469. 22: {
  13470. Fname: [7]uint8{'O', 't', 'i', 'l', 'd', 'e'},
  13471. Fvalue: uint8(213),
  13472. },
  13473. 23: {
  13474. Fname: [7]uint8{'O', 'u', 'm', 'l'},
  13475. Fvalue: uint8(214),
  13476. },
  13477. 24: {
  13478. Fname: [7]uint8{'T', 'H', 'O', 'R', 'N'},
  13479. Fvalue: uint8(222),
  13480. },
  13481. 25: {
  13482. Fname: [7]uint8{'U', 'a', 'c', 'u', 't', 'e'},
  13483. Fvalue: uint8(218),
  13484. },
  13485. 26: {
  13486. Fname: [7]uint8{'U', 'c', 'i', 'r', 'c'},
  13487. Fvalue: uint8(219),
  13488. },
  13489. 27: {
  13490. Fname: [7]uint8{'U', 'g', 'r', 'a', 'v', 'e'},
  13491. Fvalue: uint8(217),
  13492. },
  13493. 28: {
  13494. Fname: [7]uint8{'U', 'u', 'm', 'l'},
  13495. Fvalue: uint8(220),
  13496. },
  13497. 29: {
  13498. Fname: [7]uint8{'Y', 'a', 'c', 'u', 't', 'e'},
  13499. Fvalue: uint8(221),
  13500. },
  13501. 30: {
  13502. Fname: [7]uint8{'a', 'a', 'c', 'u', 't', 'e'},
  13503. Fvalue: uint8(225),
  13504. },
  13505. 31: {
  13506. Fname: [7]uint8{'a', 'c', 'i', 'r', 'c'},
  13507. Fvalue: uint8(226),
  13508. },
  13509. 32: {
  13510. Fname: [7]uint8{'a', 'c', 'u', 't', 'e'},
  13511. Fvalue: uint8(180),
  13512. },
  13513. 33: {
  13514. Fname: [7]uint8{'a', 'e', 'l', 'i', 'g'},
  13515. Fvalue: uint8(230),
  13516. },
  13517. 34: {
  13518. Fname: [7]uint8{'a', 'g', 'r', 'a', 'v', 'e'},
  13519. Fvalue: uint8(224),
  13520. },
  13521. 35: {
  13522. Fname: [7]uint8{'a', 'm', 'p'},
  13523. Fvalue: uint8(38),
  13524. },
  13525. 36: {
  13526. Fname: [7]uint8{'a', 'r', 'i', 'n', 'g'},
  13527. Fvalue: uint8(229),
  13528. },
  13529. 37: {
  13530. Fname: [7]uint8{'a', 't', 'i', 'l', 'd', 'e'},
  13531. Fvalue: uint8(227),
  13532. },
  13533. 38: {
  13534. Fname: [7]uint8{'a', 'u', 'm', 'l'},
  13535. Fvalue: uint8(228),
  13536. },
  13537. 39: {
  13538. Fname: [7]uint8{'b', 'r', 'v', 'b', 'a', 'r'},
  13539. Fvalue: uint8(166),
  13540. },
  13541. 40: {
  13542. Fname: [7]uint8{'c', 'c', 'e', 'd', 'i', 'l'},
  13543. Fvalue: uint8(231),
  13544. },
  13545. 41: {
  13546. Fname: [7]uint8{'c', 'e', 'd', 'i', 'l'},
  13547. Fvalue: uint8(184),
  13548. },
  13549. 42: {
  13550. Fname: [7]uint8{'c', 'e', 'n', 't'},
  13551. Fvalue: uint8(162),
  13552. },
  13553. 43: {
  13554. Fname: [7]uint8{'c', 'o', 'p', 'y'},
  13555. Fvalue: uint8(169),
  13556. },
  13557. 44: {
  13558. Fname: [7]uint8{'c', 'u', 'r', 'r', 'e', 'n'},
  13559. Fvalue: uint8(164),
  13560. },
  13561. 45: {
  13562. Fname: [7]uint8{'d', 'e', 'g'},
  13563. Fvalue: uint8(176),
  13564. },
  13565. 46: {
  13566. Fname: [7]uint8{'d', 'i', 'v', 'i', 'd', 'e'},
  13567. Fvalue: uint8(247),
  13568. },
  13569. 47: {
  13570. Fname: [7]uint8{'e', 'a', 'c', 'u', 't', 'e'},
  13571. Fvalue: uint8(233),
  13572. },
  13573. 48: {
  13574. Fname: [7]uint8{'e', 'c', 'i', 'r', 'c'},
  13575. Fvalue: uint8(234),
  13576. },
  13577. 49: {
  13578. Fname: [7]uint8{'e', 'g', 'r', 'a', 'v', 'e'},
  13579. Fvalue: uint8(232),
  13580. },
  13581. 50: {
  13582. Fname: [7]uint8{'e', 't', 'h'},
  13583. Fvalue: uint8(240),
  13584. },
  13585. 51: {
  13586. Fname: [7]uint8{'e', 'u', 'm', 'l'},
  13587. Fvalue: uint8(235),
  13588. },
  13589. 52: {
  13590. Fname: [7]uint8{'f', 'r', 'a', 'c', '1', '2'},
  13591. Fvalue: uint8(189),
  13592. },
  13593. 53: {
  13594. Fname: [7]uint8{'f', 'r', 'a', 'c', '1', '4'},
  13595. Fvalue: uint8(188),
  13596. },
  13597. 54: {
  13598. Fname: [7]uint8{'f', 'r', 'a', 'c', '3', '4'},
  13599. Fvalue: uint8(190),
  13600. },
  13601. 55: {
  13602. Fname: [7]uint8{'g', 't'},
  13603. Fvalue: uint8(62),
  13604. },
  13605. 56: {
  13606. Fname: [7]uint8{'i', 'a', 'c', 'u', 't', 'e'},
  13607. Fvalue: uint8(237),
  13608. },
  13609. 57: {
  13610. Fname: [7]uint8{'i', 'c', 'i', 'r', 'c'},
  13611. Fvalue: uint8(238),
  13612. },
  13613. 58: {
  13614. Fname: [7]uint8{'i', 'e', 'x', 'c', 'l'},
  13615. Fvalue: uint8(161),
  13616. },
  13617. 59: {
  13618. Fname: [7]uint8{'i', 'g', 'r', 'a', 'v', 'e'},
  13619. Fvalue: uint8(236),
  13620. },
  13621. 60: {
  13622. Fname: [7]uint8{'i', 'q', 'u', 'e', 's', 't'},
  13623. Fvalue: uint8(191),
  13624. },
  13625. 61: {
  13626. Fname: [7]uint8{'i', 'u', 'm', 'l'},
  13627. Fvalue: uint8(239),
  13628. },
  13629. 62: {
  13630. Fname: [7]uint8{'l', 'a', 'q', 'u', 'o'},
  13631. Fvalue: uint8(171),
  13632. },
  13633. 63: {
  13634. Fname: [7]uint8{'l', 't'},
  13635. Fvalue: uint8(60),
  13636. },
  13637. 64: {
  13638. Fname: [7]uint8{'m', 'a', 'c', 'r'},
  13639. Fvalue: uint8(175),
  13640. },
  13641. 65: {
  13642. Fname: [7]uint8{'m', 'i', 'c', 'r', 'o'},
  13643. Fvalue: uint8(181),
  13644. },
  13645. 66: {
  13646. Fname: [7]uint8{'m', 'i', 'd', 'd', 'o', 't'},
  13647. Fvalue: uint8(183),
  13648. },
  13649. 67: {
  13650. Fname: [7]uint8{'n', 'b', 's', 'p'},
  13651. Fvalue: uint8(160),
  13652. },
  13653. 68: {
  13654. Fname: [7]uint8{'n', 'o', 't'},
  13655. Fvalue: uint8(172),
  13656. },
  13657. 69: {
  13658. Fname: [7]uint8{'n', 't', 'i', 'l', 'd', 'e'},
  13659. Fvalue: uint8(241),
  13660. },
  13661. 70: {
  13662. Fname: [7]uint8{'o', 'a', 'c', 'u', 't', 'e'},
  13663. Fvalue: uint8(243),
  13664. },
  13665. 71: {
  13666. Fname: [7]uint8{'o', 'c', 'i', 'r', 'c'},
  13667. Fvalue: uint8(244),
  13668. },
  13669. 72: {
  13670. Fname: [7]uint8{'o', 'g', 'r', 'a', 'v', 'e'},
  13671. Fvalue: uint8(242),
  13672. },
  13673. 73: {
  13674. Fname: [7]uint8{'o', 'r', 'd', 'f'},
  13675. Fvalue: uint8(170),
  13676. },
  13677. 74: {
  13678. Fname: [7]uint8{'o', 'r', 'd', 'm'},
  13679. Fvalue: uint8(186),
  13680. },
  13681. 75: {
  13682. Fname: [7]uint8{'o', 's', 'l', 'a', 's', 'h'},
  13683. Fvalue: uint8(248),
  13684. },
  13685. 76: {
  13686. Fname: [7]uint8{'o', 't', 'i', 'l', 'd', 'e'},
  13687. Fvalue: uint8(245),
  13688. },
  13689. 77: {
  13690. Fname: [7]uint8{'o', 'u', 'm', 'l'},
  13691. Fvalue: uint8(246),
  13692. },
  13693. 78: {
  13694. Fname: [7]uint8{'p', 'a', 'r', 'a'},
  13695. Fvalue: uint8(182),
  13696. },
  13697. 79: {
  13698. Fname: [7]uint8{'p', 'l', 'u', 's', 'm', 'n'},
  13699. Fvalue: uint8(177),
  13700. },
  13701. 80: {
  13702. Fname: [7]uint8{'p', 'o', 'u', 'n', 'd'},
  13703. Fvalue: uint8(163),
  13704. },
  13705. 81: {
  13706. Fname: [7]uint8{'q', 'u', 'o', 't'},
  13707. Fvalue: uint8(34),
  13708. },
  13709. 82: {
  13710. Fname: [7]uint8{'r', 'a', 'q', 'u', 'o'},
  13711. Fvalue: uint8(187),
  13712. },
  13713. 83: {
  13714. Fname: [7]uint8{'r', 'e', 'g'},
  13715. Fvalue: uint8(174),
  13716. },
  13717. 84: {
  13718. Fname: [7]uint8{'s', 'e', 'c', 't'},
  13719. Fvalue: uint8(167),
  13720. },
  13721. 85: {
  13722. Fname: [7]uint8{'s', 'h', 'y'},
  13723. Fvalue: uint8(173),
  13724. },
  13725. 86: {
  13726. Fname: [7]uint8{'s', 'u', 'p', '1'},
  13727. Fvalue: uint8(185),
  13728. },
  13729. 87: {
  13730. Fname: [7]uint8{'s', 'u', 'p', '2'},
  13731. Fvalue: uint8(178),
  13732. },
  13733. 88: {
  13734. Fname: [7]uint8{'s', 'u', 'p', '3'},
  13735. Fvalue: uint8(179),
  13736. },
  13737. 89: {
  13738. Fname: [7]uint8{'s', 'z', 'l', 'i', 'g'},
  13739. Fvalue: uint8(223),
  13740. },
  13741. 90: {
  13742. Fname: [7]uint8{'t', 'h', 'o', 'r', 'n'},
  13743. Fvalue: uint8(254),
  13744. },
  13745. 91: {
  13746. Fname: [7]uint8{'t', 'i', 'm', 'e', 's'},
  13747. Fvalue: uint8(215),
  13748. },
  13749. 92: {
  13750. Fname: [7]uint8{'u', 'a', 'c', 'u', 't', 'e'},
  13751. Fvalue: uint8(250),
  13752. },
  13753. 93: {
  13754. Fname: [7]uint8{'u', 'c', 'i', 'r', 'c'},
  13755. Fvalue: uint8(251),
  13756. },
  13757. 94: {
  13758. Fname: [7]uint8{'u', 'g', 'r', 'a', 'v', 'e'},
  13759. Fvalue: uint8(249),
  13760. },
  13761. 95: {
  13762. Fname: [7]uint8{'u', 'm', 'l'},
  13763. Fvalue: uint8(168),
  13764. },
  13765. 96: {
  13766. Fname: [7]uint8{'u', 'u', 'm', 'l'},
  13767. Fvalue: uint8(252),
  13768. },
  13769. 97: {
  13770. Fname: [7]uint8{'y', 'a', 'c', 'u', 't', 'e'},
  13771. Fvalue: uint8(253),
  13772. },
  13773. 98: {
  13774. Fname: [7]uint8{'y', 'e', 'n'},
  13775. Fvalue: uint8(165),
  13776. },
  13777. 99: {
  13778. Fname: [7]uint8{'y', 'u', 'm', 'l'},
  13779. Fvalue: uint8(255),
  13780. },
  13781. }
  13782. // C documentation
  13783. //
  13784. // /*
  13785. // * unvis - decode characters previously encoded by vis
  13786. // */
  13787. func Xunvis(tls *libc.TLS, cp uintptr, c int32, astate uintptr, flag int32) (r int32) {
  13788. var ia, is, lc, st, uc uint8
  13789. var v22, v23, v24, v25, v26 int32
  13790. var p19, p20, p21, p28 uintptr
  13791. _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ia, is, lc, st, uc, v22, v23, v24, v25, v26, p19, p20, p21, p28
  13792. uc = libc.Uint8FromInt32(c)
  13793. /*
  13794. * Bottom 8 bits of astate hold the state machine state.
  13795. * Top 8 bits hold the current character in the http 1866 nv string decoding
  13796. */
  13797. st = libc.Uint8FromInt32(*(*int32)(unsafe.Pointer(astate)) & libc.Int32FromInt32(0xff))
  13798. if flag&int32(m__VIS_END) != 0 {
  13799. switch libc.Int32FromUint8(st) {
  13800. case int32(m_S_OCTAL2):
  13801. fallthrough
  13802. case int32(m_S_OCTAL3):
  13803. fallthrough
  13804. case int32(m_S_HEX2):
  13805. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13806. return int32(m_UNVIS_VALID)
  13807. case m_S_GROUND:
  13808. return int32(m_UNVIS_NOCHAR)
  13809. default:
  13810. return -int32(1)
  13811. }
  13812. }
  13813. switch libc.Int32FromUint8(st) {
  13814. case m_S_GROUND:
  13815. goto _1
  13816. case int32(m_S_START):
  13817. goto _2
  13818. case int32(m_S_META):
  13819. goto _3
  13820. case int32(m_S_META1):
  13821. goto _4
  13822. case int32(m_S_CTRL):
  13823. goto _5
  13824. case int32(m_S_OCTAL2):
  13825. goto _6
  13826. case int32(m_S_OCTAL3):
  13827. goto _7
  13828. case int32(m_S_HEX):
  13829. goto _8
  13830. case int32(m_S_HEX1):
  13831. goto _9
  13832. case int32(m_S_HEX2):
  13833. goto _10
  13834. case int32(m_S_MIME1):
  13835. goto _11
  13836. case int32(m_S_MIME2):
  13837. goto _12
  13838. case int32(m_S_EATCRNL):
  13839. goto _13
  13840. case int32(m_S_AMP):
  13841. goto _14
  13842. case int32(m_S_STRING):
  13843. goto _15
  13844. case int32(m_S_NUMBER):
  13845. goto _16
  13846. default:
  13847. goto _17
  13848. }
  13849. goto _18
  13850. _1:
  13851. ;
  13852. *(*uint8)(unsafe.Pointer(cp)) = uint8(0)
  13853. if flag&int32(m_VIS_NOESCAPE) == 0 && c == int32('\\') {
  13854. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_START)))
  13855. return int32(m_UNVIS_NOCHAR)
  13856. }
  13857. if flag&int32(m_VIS_HTTP1808) != 0 && c == int32('%') {
  13858. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_HEX1)))
  13859. return int32(m_UNVIS_NOCHAR)
  13860. }
  13861. if flag&int32(m_VIS_HTTP1866) != 0 && c == int32('&') {
  13862. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_AMP)))
  13863. return int32(m_UNVIS_NOCHAR)
  13864. }
  13865. if flag&int32(m_VIS_MIMESTYLE) != 0 && c == int32('=') {
  13866. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_MIME1)))
  13867. return int32(m_UNVIS_NOCHAR)
  13868. }
  13869. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(c)
  13870. return int32(m_UNVIS_VALID)
  13871. _2:
  13872. ;
  13873. switch c {
  13874. case int32('\\'):
  13875. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(c)
  13876. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13877. return int32(m_UNVIS_VALID)
  13878. case int32('0'):
  13879. fallthrough
  13880. case int32('1'):
  13881. fallthrough
  13882. case int32('2'):
  13883. fallthrough
  13884. case int32('3'):
  13885. fallthrough
  13886. case int32('4'):
  13887. fallthrough
  13888. case int32('5'):
  13889. fallthrough
  13890. case int32('6'):
  13891. fallthrough
  13892. case int32('7'):
  13893. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(c - libc.Int32FromUint8('0'))
  13894. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_OCTAL2)))
  13895. return int32(m_UNVIS_NOCHAR)
  13896. case int32('M'):
  13897. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(0200)
  13898. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_META)))
  13899. return int32(m_UNVIS_NOCHAR)
  13900. case int32('^'):
  13901. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_CTRL)))
  13902. return int32(m_UNVIS_NOCHAR)
  13903. case int32('n'):
  13904. *(*uint8)(unsafe.Pointer(cp)) = uint8('\n')
  13905. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13906. return int32(m_UNVIS_VALID)
  13907. case int32('r'):
  13908. *(*uint8)(unsafe.Pointer(cp)) = uint8('\r')
  13909. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13910. return int32(m_UNVIS_VALID)
  13911. case int32('b'):
  13912. *(*uint8)(unsafe.Pointer(cp)) = uint8('\b')
  13913. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13914. return int32(m_UNVIS_VALID)
  13915. case int32('a'):
  13916. *(*uint8)(unsafe.Pointer(cp)) = uint8('\007')
  13917. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13918. return int32(m_UNVIS_VALID)
  13919. case int32('v'):
  13920. *(*uint8)(unsafe.Pointer(cp)) = uint8('\v')
  13921. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13922. return int32(m_UNVIS_VALID)
  13923. case int32('t'):
  13924. *(*uint8)(unsafe.Pointer(cp)) = uint8('\t')
  13925. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13926. return int32(m_UNVIS_VALID)
  13927. case int32('f'):
  13928. *(*uint8)(unsafe.Pointer(cp)) = uint8('\f')
  13929. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13930. return int32(m_UNVIS_VALID)
  13931. case int32('s'):
  13932. *(*uint8)(unsafe.Pointer(cp)) = uint8(' ')
  13933. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13934. return int32(m_UNVIS_VALID)
  13935. case int32('E'):
  13936. *(*uint8)(unsafe.Pointer(cp)) = uint8('\033')
  13937. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13938. return int32(m_UNVIS_VALID)
  13939. case int32('x'):
  13940. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_HEX)))
  13941. return int32(m_UNVIS_NOCHAR)
  13942. case int32('\n'):
  13943. /*
  13944. * hidden newline
  13945. */
  13946. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13947. return int32(m_UNVIS_NOCHAR)
  13948. case int32('$'):
  13949. /*
  13950. * hidden marker
  13951. */
  13952. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13953. return int32(m_UNVIS_NOCHAR)
  13954. default:
  13955. if libc.BoolInt32(libc.Uint32FromInt32(c)-uint32(0x21) < uint32(0x5e)) != 0 {
  13956. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(c)
  13957. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13958. return int32(m_UNVIS_VALID)
  13959. }
  13960. }
  13961. goto bad
  13962. _3:
  13963. ;
  13964. if c == int32('-') {
  13965. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_META1)))
  13966. } else {
  13967. if c == int32('^') {
  13968. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_CTRL)))
  13969. } else {
  13970. goto bad
  13971. }
  13972. }
  13973. return int32(m_UNVIS_NOCHAR)
  13974. _4:
  13975. ;
  13976. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13977. p19 = cp
  13978. *(*uint8)(unsafe.Pointer(p19)) = uint8(int32(*(*uint8)(unsafe.Pointer(p19))) | c)
  13979. return int32(m_UNVIS_VALID)
  13980. _5:
  13981. ;
  13982. if c == int32('?') {
  13983. p20 = cp
  13984. *(*uint8)(unsafe.Pointer(p20)) = uint8(int32(*(*uint8)(unsafe.Pointer(p20))) | libc.Int32FromInt32(0177))
  13985. } else {
  13986. p21 = cp
  13987. *(*uint8)(unsafe.Pointer(p21)) = uint8(int32(*(*uint8)(unsafe.Pointer(p21))) | c&libc.Int32FromInt32(037))
  13988. }
  13989. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  13990. return int32(m_UNVIS_VALID)
  13991. _6:
  13992. ; /* second possible octal digit */
  13993. if libc.Int32FromUint8(uc) >= int32('0') && libc.Int32FromUint8(uc) <= int32('7') {
  13994. /*
  13995. * yes - and maybe a third
  13996. */
  13997. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))<<int32(3) + (c - int32('0')))
  13998. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_OCTAL3)))
  13999. return int32(m_UNVIS_NOCHAR)
  14000. }
  14001. /*
  14002. * no - done with current sequence, push back passed char
  14003. */
  14004. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14005. return int32(m_UNVIS_VALIDPUSH)
  14006. _7:
  14007. ; /* third possible octal digit */
  14008. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14009. if libc.Int32FromUint8(uc) >= int32('0') && libc.Int32FromUint8(uc) <= int32('7') {
  14010. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))<<int32(3) + (c - int32('0')))
  14011. return int32(m_UNVIS_VALID)
  14012. }
  14013. /*
  14014. * we were done, push back passed char
  14015. */
  14016. return int32(m_UNVIS_VALIDPUSH)
  14017. _8:
  14018. ;
  14019. if !(libc.Xisxdigit(tls, libc.Int32FromUint8(uc)) != 0) {
  14020. goto bad
  14021. }
  14022. /*FALLTHROUGH*/
  14023. _9:
  14024. ;
  14025. if libc.Xisxdigit(tls, libc.Int32FromUint8(uc)) != 0 {
  14026. if libc.BoolInt32(uint32(uc)-uint32('0') < uint32(10)) != 0 {
  14027. v22 = libc.Int32FromUint8(uc) - int32('0')
  14028. } else {
  14029. v22 = libc.Xtolower(tls, libc.Int32FromUint8(uc)) - int32('a') + int32(10)
  14030. }
  14031. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(v22)
  14032. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_HEX2)))
  14033. return int32(m_UNVIS_NOCHAR)
  14034. }
  14035. /*
  14036. * no - done with current sequence, push back passed char
  14037. */
  14038. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14039. return int32(m_UNVIS_VALIDPUSH)
  14040. _10:
  14041. ;
  14042. *(*int32)(unsafe.Pointer(astate)) = m_S_GROUND
  14043. if libc.Xisxdigit(tls, libc.Int32FromUint8(uc)) != 0 {
  14044. if libc.BoolInt32(uint32(uc)-uint32('0') < uint32(10)) != 0 {
  14045. v23 = libc.Int32FromUint8(uc) - int32('0')
  14046. } else {
  14047. v23 = libc.Xtolower(tls, libc.Int32FromUint8(uc)) - int32('a') + int32(10)
  14048. }
  14049. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(v23 | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))<<int32(4))
  14050. return int32(m_UNVIS_VALID)
  14051. }
  14052. return int32(m_UNVIS_VALIDPUSH)
  14053. _11:
  14054. ;
  14055. if libc.Int32FromUint8(uc) == int32('\n') || libc.Int32FromUint8(uc) == int32('\r') {
  14056. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_EATCRNL)))
  14057. return int32(m_UNVIS_NOCHAR)
  14058. }
  14059. 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) {
  14060. if libc.BoolInt32(uint32(uc)-uint32('0') < uint32(10)) != 0 {
  14061. v24 = libc.Int32FromUint8(uc) - int32('0')
  14062. } else {
  14063. v24 = libc.Int32FromUint8(uc) - int32('A') + int32(10)
  14064. }
  14065. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(v24)
  14066. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_MIME2)))
  14067. return int32(m_UNVIS_NOCHAR)
  14068. }
  14069. goto bad
  14070. _12:
  14071. ;
  14072. 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) {
  14073. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14074. if libc.BoolInt32(uint32(uc)-uint32('0') < uint32(10)) != 0 {
  14075. v25 = libc.Int32FromUint8(uc) - int32('0')
  14076. } else {
  14077. v25 = libc.Int32FromUint8(uc) - int32('A') + int32(10)
  14078. }
  14079. *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32(v25 | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))<<int32(4))
  14080. return int32(m_UNVIS_VALID)
  14081. }
  14082. goto bad
  14083. _13:
  14084. ;
  14085. switch libc.Int32FromUint8(uc) {
  14086. case int32('\r'):
  14087. fallthrough
  14088. case int32('\n'):
  14089. return int32(m_UNVIS_NOCHAR)
  14090. case int32('='):
  14091. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_MIME1)))
  14092. return int32(m_UNVIS_NOCHAR)
  14093. default:
  14094. *(*uint8)(unsafe.Pointer(cp)) = uc
  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. }
  14098. _14:
  14099. ;
  14100. *(*uint8)(unsafe.Pointer(cp)) = uint8(0)
  14101. if libc.Int32FromUint8(uc) == int32('#') {
  14102. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_NUMBER)))
  14103. return int32(m_UNVIS_NOCHAR)
  14104. }
  14105. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_STRING)))
  14106. /*FALLTHROUGH*/
  14107. _15:
  14108. ;
  14109. ia = *(*uint8)(unsafe.Pointer(cp)) /* index in the array */
  14110. is = uint8(libc.Uint32FromInt32(*(*int32)(unsafe.Pointer(astate))) >> libc.Int32FromInt32(24)) /* index in the string */
  14111. if libc.Int32FromUint8(is) == 0 {
  14112. v26 = 0
  14113. } else {
  14114. v26 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_nv)) + uintptr(ia)*8 + uintptr(libc.Int32FromUint8(is)-int32(1)))))
  14115. }
  14116. lc = libc.Uint8FromInt32(v26) /* last character */
  14117. if libc.Int32FromUint8(uc) == int32(';') {
  14118. uc = uint8('\000')
  14119. }
  14120. for {
  14121. if !(uint64(ia) < libc.Uint64FromInt64(800)/libc.Uint64FromInt64(8)) {
  14122. break
  14123. }
  14124. 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) {
  14125. goto bad
  14126. }
  14127. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_nv)) + uintptr(ia)*8 + uintptr(is)))) == libc.Int32FromUint8(uc) {
  14128. break
  14129. }
  14130. goto _27
  14131. _27:
  14132. ;
  14133. ia++
  14134. }
  14135. if uint64(ia) == libc.Uint64FromInt64(800)/libc.Uint64FromInt64(8) {
  14136. goto bad
  14137. }
  14138. if libc.Int32FromUint8(uc) != 0 {
  14139. *(*uint8)(unsafe.Pointer(cp)) = ia
  14140. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromUint8(is)+libc.Int32FromInt32(1))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_STRING)))
  14141. return int32(m_UNVIS_NOCHAR)
  14142. }
  14143. *(*uint8)(unsafe.Pointer(cp)) = _nv[ia].Fvalue
  14144. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14145. return int32(m_UNVIS_VALID)
  14146. _16:
  14147. ;
  14148. if libc.Int32FromUint8(uc) == int32(';') {
  14149. return int32(m_UNVIS_VALID)
  14150. }
  14151. if !(libc.BoolInt32(uint32(uc)-libc.Uint32FromUint8('0') < libc.Uint32FromInt32(10)) != 0) {
  14152. goto bad
  14153. }
  14154. p28 = cp
  14155. *(*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')))
  14156. return int32(m_UNVIS_NOCHAR)
  14157. _17:
  14158. ;
  14159. goto bad
  14160. bad:
  14161. ;
  14162. /*
  14163. * decoder in unknown state - (probably uninitialized)
  14164. */
  14165. *(*int32)(unsafe.Pointer(astate)) = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(0))<<libc.Int32FromInt32(24) | libc.Uint32FromInt32(libc.Int32FromInt32(m_S_GROUND)))
  14166. return -int32(1)
  14167. _18:
  14168. ;
  14169. return r
  14170. }
  14171. /*
  14172. * strnunvisx - decode src into dst
  14173. *
  14174. * Number of chars decoded into dst is returned, -1 on error.
  14175. * Dst is null terminated.
  14176. */
  14177. func Xstrnunvisx(tls *libc.TLS, dst uintptr, dlen Tsize_t, src uintptr, flag int32) (r int32) {
  14178. bp := tls.Alloc(16)
  14179. defer tls.Free(16)
  14180. var c, v1 uint8
  14181. var start, v14, v16, v18, v2 uintptr
  14182. var v13, v15, v17, v19 Tsize_t
  14183. var _ /* state at bp+4 */ int32
  14184. var _ /* t at bp+0 */ uint8
  14185. _, _, _, _, _, _, _, _, _, _, _ = c, start, v1, v13, v14, v15, v16, v17, v18, v19, v2
  14186. *(*uint8)(unsafe.Pointer(bp)) = uint8('\000')
  14187. start = dst
  14188. *(*int32)(unsafe.Pointer(bp + 4)) = 0
  14189. for {
  14190. v2 = src
  14191. src++
  14192. v1 = *(*uint8)(unsafe.Pointer(v2))
  14193. c = v1
  14194. if !(libc.Int32FromUint8(v1) != int32('\000')) {
  14195. break
  14196. }
  14197. goto again
  14198. again:
  14199. ;
  14200. switch Xunvis(tls, bp, libc.Int32FromUint8(c), bp+4, flag) {
  14201. case int32(m_UNVIS_VALID):
  14202. goto _3
  14203. case int32(m_UNVIS_VALIDPUSH):
  14204. goto _4
  14205. case int32(m_UNVIS_NOCHAR):
  14206. goto _5
  14207. case 0:
  14208. goto _6
  14209. case -int32(1):
  14210. goto _7
  14211. default:
  14212. goto _8
  14213. }
  14214. goto _9
  14215. _3:
  14216. ;
  14217. _12:
  14218. ;
  14219. v13 = dlen
  14220. dlen--
  14221. if v13 == uint64(0) {
  14222. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14223. return -int32(1)
  14224. }
  14225. goto _11
  14226. _11:
  14227. ;
  14228. if 0 != 0 {
  14229. goto _12
  14230. }
  14231. goto _10
  14232. _10:
  14233. ;
  14234. v14 = dst
  14235. dst++
  14236. *(*uint8)(unsafe.Pointer(v14)) = *(*uint8)(unsafe.Pointer(bp))
  14237. goto _9
  14238. _4:
  14239. ;
  14240. v15 = dlen
  14241. dlen--
  14242. if v15 == uint64(0) {
  14243. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14244. return -int32(1)
  14245. }
  14246. v16 = dst
  14247. dst++
  14248. *(*uint8)(unsafe.Pointer(v16)) = *(*uint8)(unsafe.Pointer(bp))
  14249. goto again
  14250. _6:
  14251. ;
  14252. _5:
  14253. ;
  14254. goto _9
  14255. _7:
  14256. ;
  14257. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  14258. return -int32(1)
  14259. _8:
  14260. ;
  14261. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_EINVAL)
  14262. return -int32(1)
  14263. _9:
  14264. }
  14265. if Xunvis(tls, bp, libc.Int32FromUint8(c), bp+4, int32(m__VIS_END)) == int32(m_UNVIS_VALID) {
  14266. v17 = dlen
  14267. dlen--
  14268. if v17 == uint64(0) {
  14269. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14270. return -int32(1)
  14271. }
  14272. v18 = dst
  14273. dst++
  14274. *(*uint8)(unsafe.Pointer(v18)) = *(*uint8)(unsafe.Pointer(bp))
  14275. }
  14276. v19 = dlen
  14277. dlen--
  14278. if v19 == uint64(0) {
  14279. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14280. return -int32(1)
  14281. }
  14282. *(*uint8)(unsafe.Pointer(dst)) = uint8('\000')
  14283. return int32(int64(dst) - int64(start))
  14284. }
  14285. func Xstrunvisx(tls *libc.TLS, dst uintptr, src uintptr, flag int32) (r int32) {
  14286. return Xstrnunvisx(tls, dst, libc.Uint64FromInt32(^libc.Int32FromInt32(0)), src, flag)
  14287. }
  14288. func Xstrunvis(tls *libc.TLS, dst uintptr, src uintptr) (r int32) {
  14289. return Xstrnunvisx(tls, dst, libc.Uint64FromInt32(^libc.Int32FromInt32(0)), src, 0)
  14290. }
  14291. func Xstrnunvis_openbsd(tls *libc.TLS, dst uintptr, src uintptr, dlen Tsize_t) (r Tssize_t) {
  14292. return int64(Xstrnunvisx(tls, dst, dlen, src, 0))
  14293. }
  14294. func Xstrnunvis_netbsd(tls *libc.TLS, dst uintptr, dlen Tsize_t, src uintptr) (r int32) {
  14295. return Xstrnunvisx(tls, dst, dlen, src, 0)
  14296. }
  14297. const m_MAXEXTRAS = 30
  14298. const m_VIS_CSTYLE1 = 2
  14299. const m_VIS_DQ1 = 32768
  14300. const m_VIS_GLOB1 = 4096
  14301. const m_VIS_HTTP18081 = 0x0080
  14302. const m_VIS_HTTP18661 = 0x0200
  14303. const m_VIS_HTTPSTYLE1 = 128
  14304. const m_VIS_NL1 = 16
  14305. const m_VIS_NOESCAPE1 = 0x0400
  14306. const m_VIS_NOLOCALE1 = 16384
  14307. const m_VIS_NOSLASH1 = 64
  14308. const m_VIS_OCTAL1 = 1
  14309. const m_VIS_SAFE1 = 32
  14310. const m_VIS_SHELL1 = 8192
  14311. const m_VIS_SP1 = 4
  14312. const m_VIS_TAB1 = 8
  14313. const m__VIS_END1 = 0x0800
  14314. type Twctrans_t = uintptr
  14315. /* Keep it simple for now, no locale stuff */
  14316. var _char_shell = [19]Twchar_t{'\'', '`', '"', ';', '&', '<', '>', '(', ')', '|', '{', '}', ']', '\\', '$', '!', '^', '~'}
  14317. var _char_glob = [5]Twchar_t{'*', '?', '[', '#'}
  14318. /*
  14319. * On NetBSD and glibc MB_LEN_MAX is currently > 8 which does not fit on any
  14320. * integer integral type and it is probably wrong, since currently the maximum
  14321. * number of bytes and character needs is 6. Until this is fixed, the
  14322. * loops below are using sizeof(uint64_t) - 1 instead of MB_LEN_MAX, and
  14323. * the assertion is commented out.
  14324. */
  14325. // C documentation
  14326. //
  14327. // /*
  14328. // * This is do_hvis, for HTTP style (RFC 1808)
  14329. // */
  14330. func _do_hvis(tls *libc.TLS, dst uintptr, c Twint_t, flags int32, nextc Twint_t, extra uintptr) (r uintptr) {
  14331. var v1, v2, v3 uintptr
  14332. _, _, _ = v1, v2, v3
  14333. 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(',') {
  14334. dst = _do_svis(tls, dst, c, flags, nextc, extra)
  14335. } else {
  14336. v1 = dst
  14337. dst += 4
  14338. *(*Twchar_t)(unsafe.Pointer(v1)) = int32('%')
  14339. v2 = dst
  14340. dst += 4
  14341. *(*Twchar_t)(unsafe.Pointer(v2)) = *(*t__predefined_wchar_t)(unsafe.Pointer(__ccgo_ts + 469 + uintptr(c>>int32(4)&uint32(0xf))*4))
  14342. v3 = dst
  14343. dst += 4
  14344. *(*Twchar_t)(unsafe.Pointer(v3)) = *(*t__predefined_wchar_t)(unsafe.Pointer(__ccgo_ts + 469 + uintptr(c&uint32(0xf))*4))
  14345. }
  14346. return dst
  14347. }
  14348. // C documentation
  14349. //
  14350. // /*
  14351. // * This is do_mvis, for Quoted-Printable MIME (RFC 2045)
  14352. // * NB: No handling of long lines or CRLF.
  14353. // */
  14354. func _do_mvis(tls *libc.TLS, dst uintptr, c Twint_t, flags int32, nextc Twint_t, extra uintptr) (r uintptr) {
  14355. var v1, v2, v3 uintptr
  14356. _, _, _ = v1, v2, v3
  14357. 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)) {
  14358. v1 = dst
  14359. dst += 4
  14360. *(*Twchar_t)(unsafe.Pointer(v1)) = int32('=')
  14361. v2 = dst
  14362. dst += 4
  14363. *(*Twchar_t)(unsafe.Pointer(v2)) = *(*t__predefined_wchar_t)(unsafe.Pointer(__ccgo_ts + 589 + uintptr(c>>int32(4)&uint32(0xf))*4))
  14364. v3 = dst
  14365. dst += 4
  14366. *(*Twchar_t)(unsafe.Pointer(v3)) = *(*t__predefined_wchar_t)(unsafe.Pointer(__ccgo_ts + 589 + uintptr(c&uint32(0xf))*4))
  14367. } else {
  14368. dst = _do_svis(tls, dst, c, flags, nextc, extra)
  14369. }
  14370. return dst
  14371. }
  14372. // C documentation
  14373. //
  14374. // /*
  14375. // * Output single byte of multibyte character.
  14376. // */
  14377. func _do_mbyte(tls *libc.TLS, dst uintptr, c Twint_t, flags int32, nextc Twint_t, iswextra int32) (r uintptr) {
  14378. 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
  14379. var v21 int32
  14380. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  14381. if flags&int32(m_VIS_CSTYLE1) != 0 {
  14382. switch c {
  14383. case uint32('\n'):
  14384. v1 = dst
  14385. dst += 4
  14386. *(*Twchar_t)(unsafe.Pointer(v1)) = int32('\\')
  14387. v2 = dst
  14388. dst += 4
  14389. *(*Twchar_t)(unsafe.Pointer(v2)) = int32('n')
  14390. return dst
  14391. case uint32('\r'):
  14392. v3 = dst
  14393. dst += 4
  14394. *(*Twchar_t)(unsafe.Pointer(v3)) = int32('\\')
  14395. v4 = dst
  14396. dst += 4
  14397. *(*Twchar_t)(unsafe.Pointer(v4)) = int32('r')
  14398. return dst
  14399. case uint32('\b'):
  14400. v5 = dst
  14401. dst += 4
  14402. *(*Twchar_t)(unsafe.Pointer(v5)) = int32('\\')
  14403. v6 = dst
  14404. dst += 4
  14405. *(*Twchar_t)(unsafe.Pointer(v6)) = int32('b')
  14406. return dst
  14407. case uint32('\a'):
  14408. v7 = dst
  14409. dst += 4
  14410. *(*Twchar_t)(unsafe.Pointer(v7)) = int32('\\')
  14411. v8 = dst
  14412. dst += 4
  14413. *(*Twchar_t)(unsafe.Pointer(v8)) = int32('a')
  14414. return dst
  14415. case uint32('\v'):
  14416. v9 = dst
  14417. dst += 4
  14418. *(*Twchar_t)(unsafe.Pointer(v9)) = int32('\\')
  14419. v10 = dst
  14420. dst += 4
  14421. *(*Twchar_t)(unsafe.Pointer(v10)) = int32('v')
  14422. return dst
  14423. case uint32('\t'):
  14424. v11 = dst
  14425. dst += 4
  14426. *(*Twchar_t)(unsafe.Pointer(v11)) = int32('\\')
  14427. v12 = dst
  14428. dst += 4
  14429. *(*Twchar_t)(unsafe.Pointer(v12)) = int32('t')
  14430. return dst
  14431. case uint32('\f'):
  14432. v13 = dst
  14433. dst += 4
  14434. *(*Twchar_t)(unsafe.Pointer(v13)) = int32('\\')
  14435. v14 = dst
  14436. dst += 4
  14437. *(*Twchar_t)(unsafe.Pointer(v14)) = int32('f')
  14438. return dst
  14439. case uint32(' '):
  14440. v15 = dst
  14441. dst += 4
  14442. *(*Twchar_t)(unsafe.Pointer(v15)) = int32('\\')
  14443. v16 = dst
  14444. dst += 4
  14445. *(*Twchar_t)(unsafe.Pointer(v16)) = int32('s')
  14446. return dst
  14447. case uint32('\000'):
  14448. v17 = dst
  14449. dst += 4
  14450. *(*Twchar_t)(unsafe.Pointer(v17)) = int32('\\')
  14451. v18 = dst
  14452. dst += 4
  14453. *(*Twchar_t)(unsafe.Pointer(v18)) = int32('0')
  14454. if libc.Int32FromUint8(uint8(nextc)) >= int32('0') && libc.Int32FromUint8(uint8(nextc)) <= int32('7') {
  14455. v19 = dst
  14456. dst += 4
  14457. *(*Twchar_t)(unsafe.Pointer(v19)) = int32('0')
  14458. v20 = dst
  14459. dst += 4
  14460. *(*Twchar_t)(unsafe.Pointer(v20)) = int32('0')
  14461. }
  14462. return dst
  14463. /* We cannot encode these characters in VIS_CSTYLE
  14464. * because they special meaning */
  14465. fallthrough
  14466. case uint32('n'):
  14467. fallthrough
  14468. case uint32('r'):
  14469. fallthrough
  14470. case uint32('b'):
  14471. fallthrough
  14472. case uint32('a'):
  14473. fallthrough
  14474. case uint32('v'):
  14475. fallthrough
  14476. case uint32('t'):
  14477. fallthrough
  14478. case uint32('f'):
  14479. fallthrough
  14480. case uint32('s'):
  14481. fallthrough
  14482. case uint32('0'):
  14483. fallthrough
  14484. case uint32('M'):
  14485. fallthrough
  14486. case uint32('^'):
  14487. fallthrough
  14488. case uint32('$'): /* vis(1) -l */
  14489. default:
  14490. if flags&int32(m_VIS_NOLOCALE1) != 0 {
  14491. v21 = libc.BoolInt32(c-uint32(0x21) < uint32(0x5e))
  14492. } else {
  14493. v21 = libc.Xiswgraph(tls, c)
  14494. }
  14495. if v21 != 0 && !(libc.Int32FromUint8(uint8(c)) >= int32('0') && libc.Int32FromUint8(uint8(c)) <= int32('7')) {
  14496. v22 = dst
  14497. dst += 4
  14498. *(*Twchar_t)(unsafe.Pointer(v22)) = int32('\\')
  14499. v23 = dst
  14500. dst += 4
  14501. *(*Twchar_t)(unsafe.Pointer(v23)) = libc.Int32FromUint32(c)
  14502. return dst
  14503. }
  14504. }
  14505. }
  14506. if iswextra != 0 || c&uint32(0177) == uint32(' ') || flags&int32(m_VIS_OCTAL1) != 0 {
  14507. v24 = dst
  14508. dst += 4
  14509. *(*Twchar_t)(unsafe.Pointer(v24)) = int32('\\')
  14510. v25 = dst
  14511. dst += 4
  14512. *(*Twchar_t)(unsafe.Pointer(v25)) = libc.Int32FromUint8(uint8(uint32(uint8(c))>>libc.Int32FromInt32(6)&libc.Uint32FromInt32(03))) + int32('0')
  14513. v26 = dst
  14514. dst += 4
  14515. *(*Twchar_t)(unsafe.Pointer(v26)) = libc.Int32FromUint8(uint8(uint32(uint8(c))>>libc.Int32FromInt32(3)&libc.Uint32FromInt32(07))) + int32('0')
  14516. v27 = dst
  14517. dst += 4
  14518. *(*Twchar_t)(unsafe.Pointer(v27)) = libc.Int32FromUint32(c&uint32(07) + uint32('0'))
  14519. } else {
  14520. if flags&int32(m_VIS_NOSLASH1) == 0 {
  14521. v28 = dst
  14522. dst += 4
  14523. *(*Twchar_t)(unsafe.Pointer(v28)) = int32('\\')
  14524. }
  14525. if c&uint32(0200) != 0 {
  14526. c &= uint32(0177)
  14527. v29 = dst
  14528. dst += 4
  14529. *(*Twchar_t)(unsafe.Pointer(v29)) = int32('M')
  14530. }
  14531. if libc.Xiswcntrl(tls, c) != 0 {
  14532. v30 = dst
  14533. dst += 4
  14534. *(*Twchar_t)(unsafe.Pointer(v30)) = int32('^')
  14535. if c == uint32(0177) {
  14536. v31 = dst
  14537. dst += 4
  14538. *(*Twchar_t)(unsafe.Pointer(v31)) = int32('?')
  14539. } else {
  14540. v32 = dst
  14541. dst += 4
  14542. *(*Twchar_t)(unsafe.Pointer(v32)) = libc.Int32FromUint32(c + uint32('@'))
  14543. }
  14544. } else {
  14545. v33 = dst
  14546. dst += 4
  14547. *(*Twchar_t)(unsafe.Pointer(v33)) = int32('-')
  14548. v34 = dst
  14549. dst += 4
  14550. *(*Twchar_t)(unsafe.Pointer(v34)) = libc.Int32FromUint32(c)
  14551. }
  14552. }
  14553. return dst
  14554. }
  14555. // C documentation
  14556. //
  14557. // /*
  14558. // * This is do_vis, the central code of vis.
  14559. // * dst: Pointer to the destination buffer
  14560. // * c: Character to encode
  14561. // * flags: Flags word
  14562. // * nextc: The character following 'c'
  14563. // * extra: Pointer to the list of extra characters to be
  14564. // * backslash-protected.
  14565. // */
  14566. func _do_svis(tls *libc.TLS, dst uintptr, c Twint_t, flags int32, nextc Twint_t, extra uintptr) (r uintptr) {
  14567. var bmsk, wmsk Tuint64_t
  14568. var i, iswextra, shft, v1 int32
  14569. var v2 bool
  14570. var v3 uintptr
  14571. _, _, _, _, _, _, _, _ = bmsk, i, iswextra, shft, wmsk, v1, v2, v3
  14572. iswextra = libc.BoolInt32(libc.Xwcschr(tls, extra, libc.Int32FromUint32(c)) != libc.UintptrFromInt32(0))
  14573. if v2 = !(iswextra != 0); v2 {
  14574. if flags&int32(m_VIS_NOLOCALE1) != 0 {
  14575. v1 = libc.BoolInt32(c-uint32(0x21) < uint32(0x5e))
  14576. } else {
  14577. v1 = libc.Xiswgraph(tls, c)
  14578. }
  14579. }
  14580. 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'))) {
  14581. v3 = dst
  14582. dst += 4
  14583. *(*Twchar_t)(unsafe.Pointer(v3)) = libc.Int32FromUint32(c)
  14584. return dst
  14585. }
  14586. /* See comment in istrsenvisx() output loop, below. */
  14587. wmsk = uint64(0)
  14588. i = libc.Int32FromUint64(libc.Uint64FromInt64(8) - libc.Uint64FromInt32(1))
  14589. for {
  14590. if !(i >= 0) {
  14591. break
  14592. }
  14593. shft = i * int32(m_CHAR_BIT)
  14594. bmsk = libc.Uint64FromInt64(0xff) << shft
  14595. wmsk |= bmsk
  14596. if uint64(c)&wmsk != 0 || i == 0 {
  14597. dst = _do_mbyte(tls, dst, uint32(uint64(c)&bmsk>>shft), flags, nextc, iswextra)
  14598. }
  14599. goto _4
  14600. _4:
  14601. ;
  14602. i--
  14603. }
  14604. return dst
  14605. }
  14606. type Tvisfun_t = uintptr
  14607. // C documentation
  14608. //
  14609. // /*
  14610. // * Return the appropriate encoding function depending on the flags given.
  14611. // */
  14612. func _getvisfun(tls *libc.TLS, flags int32) (r Tvisfun_t) {
  14613. if flags&int32(m_VIS_HTTPSTYLE1) != 0 {
  14614. return __ccgo_fp(_do_hvis)
  14615. }
  14616. if flags&int32(m_VIS_MIMESTYLE) != 0 {
  14617. return __ccgo_fp(_do_mvis)
  14618. }
  14619. return __ccgo_fp(_do_svis)
  14620. }
  14621. // C documentation
  14622. //
  14623. // /*
  14624. // * Expand list of extra characters to not visually encode.
  14625. // */
  14626. func _makeextralist(tls *libc.TLS, flags int32, src uintptr) (r uintptr) {
  14627. var d, dst, s, v1, v10, v11, v12, v13, v4, v5, v7, v8, v9 uintptr
  14628. var i, len1 Tsize_t
  14629. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = d, dst, i, len1, s, v1, v10, v11, v12, v13, v4, v5, v7, v8, v9
  14630. len1 = libc.Xstrlen(tls, src)
  14631. v1 = libc.Xcalloc(tls, len1+uint64(m_MAXEXTRAS), uint64(4))
  14632. dst = v1
  14633. if v1 == libc.UintptrFromInt32(0) {
  14634. return libc.UintptrFromInt32(0)
  14635. }
  14636. if flags&int32(m_VIS_NOLOCALE1) != 0 || libc.Xmbstowcs(tls, dst, src, len1) == libc.Uint64FromInt32(-libc.Int32FromInt32(1)) {
  14637. i = uint64(0)
  14638. for {
  14639. if !(i < len1) {
  14640. break
  14641. }
  14642. *(*Twchar_t)(unsafe.Pointer(dst + uintptr(i)*4)) = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(src + uintptr(i))))
  14643. goto _2
  14644. _2:
  14645. ;
  14646. i++
  14647. }
  14648. d = dst + uintptr(len1)*4
  14649. } else {
  14650. d = dst + uintptr(libc.Xwcslen(tls, dst))*4
  14651. }
  14652. if flags&int32(m_VIS_GLOB1) != 0 {
  14653. s = uintptr(unsafe.Pointer(&_char_glob))
  14654. for {
  14655. if !(*(*Twchar_t)(unsafe.Pointer(s)) != 0) {
  14656. break
  14657. }
  14658. goto _3
  14659. goto _3
  14660. _3:
  14661. ;
  14662. v4 = d
  14663. d += 4
  14664. v5 = s
  14665. s += 4
  14666. *(*Twchar_t)(unsafe.Pointer(v4)) = *(*Twchar_t)(unsafe.Pointer(v5))
  14667. }
  14668. }
  14669. if flags&int32(m_VIS_SHELL1) != 0 {
  14670. s = uintptr(unsafe.Pointer(&_char_shell))
  14671. for {
  14672. if !(*(*Twchar_t)(unsafe.Pointer(s)) != 0) {
  14673. break
  14674. }
  14675. goto _6
  14676. goto _6
  14677. _6:
  14678. ;
  14679. v7 = d
  14680. d += 4
  14681. v8 = s
  14682. s += 4
  14683. *(*Twchar_t)(unsafe.Pointer(v7)) = *(*Twchar_t)(unsafe.Pointer(v8))
  14684. }
  14685. }
  14686. if flags&int32(m_VIS_SP1) != 0 {
  14687. v9 = d
  14688. d += 4
  14689. *(*Twchar_t)(unsafe.Pointer(v9)) = int32(' ')
  14690. }
  14691. if flags&int32(m_VIS_TAB1) != 0 {
  14692. v10 = d
  14693. d += 4
  14694. *(*Twchar_t)(unsafe.Pointer(v10)) = int32('\t')
  14695. }
  14696. if flags&int32(m_VIS_NL1) != 0 {
  14697. v11 = d
  14698. d += 4
  14699. *(*Twchar_t)(unsafe.Pointer(v11)) = int32('\n')
  14700. }
  14701. if flags&int32(m_VIS_DQ1) != 0 {
  14702. v12 = d
  14703. d += 4
  14704. *(*Twchar_t)(unsafe.Pointer(v12)) = int32('"')
  14705. }
  14706. if flags&int32(m_VIS_NOSLASH1) == 0 {
  14707. v13 = d
  14708. d += 4
  14709. *(*Twchar_t)(unsafe.Pointer(v13)) = int32('\\')
  14710. }
  14711. *(*Twchar_t)(unsafe.Pointer(d)) = int32('\000')
  14712. return dst
  14713. }
  14714. // C documentation
  14715. //
  14716. // /*
  14717. // * istrsenvisx()
  14718. // * The main internal function.
  14719. // * All user-visible functions call this one.
  14720. // */
  14721. func _istrsenvisx(tls *libc.TLS, mbdstp uintptr, dlen uintptr, mbsrc uintptr, mblength Tsize_t, flags int32, mbextra uintptr, cerr_ptr uintptr) (r int32) {
  14722. var bmsk, wmsk Tuint64_t
  14723. var c Twint_t
  14724. var cerr, clen, error1, i, shft, v12, v6 int32
  14725. var dst, extra, mbdst, mdst, pdst, psrc, src, start, v1, v2, v3, v4, v5, v8 uintptr
  14726. var f Tvisfun_t
  14727. var len1, olen Tsize_t
  14728. var maxolen, mbslength Tssize_t
  14729. var v9 uint64
  14730. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  14731. clen = 0
  14732. error1 = -int32(1)
  14733. mbslength = libc.Int64FromUint64(mblength)
  14734. /*
  14735. * When inputing a single character, must also read in the
  14736. * next character for nextc, the look-ahead character.
  14737. */
  14738. if mbslength == int64(1) {
  14739. mbslength++
  14740. }
  14741. /*
  14742. * Input (mbsrc) is a char string considered to be multibyte
  14743. * characters. The input loop will read this string pulling
  14744. * one character, possibly multiple bytes, from mbsrc and
  14745. * converting each to wchar_t in src.
  14746. *
  14747. * The vis conversion will be done using the wide char
  14748. * wchar_t string.
  14749. *
  14750. * This will then be converted back to a multibyte string to
  14751. * return to the caller.
  14752. */
  14753. /* Allocate space for the wide char strings */
  14754. v2 = libc.UintptrFromInt32(0)
  14755. extra = v2
  14756. v1 = v2
  14757. pdst = v1
  14758. psrc = v1
  14759. mdst = libc.UintptrFromInt32(0)
  14760. v3 = libc.Xcalloc(tls, libc.Uint64FromInt64(mbslength+int64(1)), uint64(4))
  14761. psrc = v3
  14762. if v3 == libc.UintptrFromInt32(0) {
  14763. return -int32(1)
  14764. }
  14765. v4 = libc.Xcalloc(tls, libc.Uint64FromInt64(int64(16)*mbslength+int64(1)), uint64(4))
  14766. pdst = v4
  14767. if v4 == libc.UintptrFromInt32(0) {
  14768. goto out
  14769. }
  14770. if *(*uintptr)(unsafe.Pointer(mbdstp)) == libc.UintptrFromInt32(0) {
  14771. v5 = libc.Xcalloc(tls, libc.Uint64FromInt64(int64(16)*mbslength+int64(1)), uint64(1))
  14772. mdst = v5
  14773. if v5 == libc.UintptrFromInt32(0) {
  14774. goto out
  14775. }
  14776. *(*uintptr)(unsafe.Pointer(mbdstp)) = mdst
  14777. }
  14778. mbdst = *(*uintptr)(unsafe.Pointer(mbdstp))
  14779. dst = pdst
  14780. src = psrc
  14781. if flags&int32(m_VIS_NOLOCALE1) != 0 {
  14782. /* Do one byte at a time conversion */
  14783. cerr = int32(1)
  14784. } else {
  14785. /* Use caller's multibyte conversion error flag. */
  14786. if cerr_ptr != 0 {
  14787. v6 = *(*int32)(unsafe.Pointer(cerr_ptr))
  14788. } else {
  14789. v6 = 0
  14790. }
  14791. cerr = v6
  14792. }
  14793. /*
  14794. * Input loop.
  14795. * Handle up to mblength characters (not bytes). We do not
  14796. * stop at NULs because we may be processing a block of data
  14797. * that includes NULs.
  14798. */
  14799. for mbslength > 0 {
  14800. /* Convert one multibyte character to wchar_t. */
  14801. if !(cerr != 0) {
  14802. clen = libc.Xmbtowc(tls, src, mbsrc, uint64(m_MB_LEN_MAX))
  14803. }
  14804. if cerr != 0 || clen < 0 {
  14805. /* Conversion error, process as a byte instead. */
  14806. *(*Twchar_t)(unsafe.Pointer(src)) = libc.Int32FromUint32(uint32(*(*uint8)(unsafe.Pointer(mbsrc))))
  14807. clen = int32(1)
  14808. cerr = int32(1)
  14809. }
  14810. if clen == 0 {
  14811. /*
  14812. * NUL in input gives 0 return value. process
  14813. * as single NUL byte and keep going.
  14814. */
  14815. clen = int32(1)
  14816. }
  14817. /* Advance buffer character pointer. */
  14818. src += 4
  14819. /* Advance input pointer by number of bytes read. */
  14820. mbsrc += uintptr(clen)
  14821. /* Decrement input byte count. */
  14822. mbslength -= int64(clen)
  14823. }
  14824. len1 = libc.Uint64FromInt64((int64(src) - int64(psrc)) / 4)
  14825. src = psrc
  14826. /*
  14827. * In the single character input case, we will have actually
  14828. * processed two characters, c and nextc. Reset len back to
  14829. * just a single character.
  14830. */
  14831. if mblength < len1 {
  14832. len1 = mblength
  14833. }
  14834. /* Convert extra argument to list of characters for this mode. */
  14835. extra = _makeextralist(tls, flags, mbextra)
  14836. if !(extra != 0) {
  14837. if dlen != 0 && *(*Tsize_t)(unsafe.Pointer(dlen)) == uint64(0) {
  14838. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14839. goto out
  14840. }
  14841. *(*uint8)(unsafe.Pointer(mbdst)) = uint8('\000') /* can't create extra, return "" */
  14842. error1 = 0
  14843. goto out
  14844. }
  14845. /* Look up which processing function to call. */
  14846. f = _getvisfun(tls, flags)
  14847. /*
  14848. * Main processing loop.
  14849. * Call do_Xvis processing function one character at a time
  14850. * with next character available for look-ahead.
  14851. */
  14852. start = dst
  14853. for {
  14854. if !(len1 > uint64(0)) {
  14855. break
  14856. }
  14857. v8 = src
  14858. src += 4
  14859. c = libc.Uint32FromInt32(*(*Twchar_t)(unsafe.Pointer(v8)))
  14860. 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)
  14861. if dst == libc.UintptrFromInt32(0) {
  14862. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(m_ENOSPC)
  14863. goto out
  14864. }
  14865. goto _7
  14866. _7:
  14867. ;
  14868. len1--
  14869. }
  14870. /* Terminate the string in the buffer. */
  14871. *(*Twchar_t)(unsafe.Pointer(dst)) = int32('\000')
  14872. /*
  14873. * Output loop.
  14874. * Convert wchar_t string back to multibyte output string.
  14875. * If we have hit a multi-byte conversion error on input,
  14876. * output byte-by-byte here. Else use wctomb().
  14877. */
  14878. len1 = libc.Xwcslen(tls, start)
  14879. if dlen != 0 {
  14880. v9 = *(*Tsize_t)(unsafe.Pointer(dlen))
  14881. } else {
  14882. v9 = libc.Xwcslen(tls, start)*uint64(m_MB_LEN_MAX) + uint64(1)
  14883. }
  14884. maxolen = libc.Int64FromUint64(v9)
  14885. olen = uint64(0)
  14886. dst = start
  14887. for {
  14888. if !(len1 > uint64(0)) {
  14889. break
  14890. }
  14891. if !(cerr != 0) {
  14892. clen = libc.Xwctomb(tls, mbdst, *(*Twchar_t)(unsafe.Pointer(dst)))
  14893. }
  14894. if cerr != 0 || clen < 0 {
  14895. /*
  14896. * Conversion error, process as a byte(s) instead.
  14897. * Examine each byte and higher-order bytes for
  14898. * data. E.g.,
  14899. * 0x000000000000a264 -> a2 64
  14900. * 0x000000001f00a264 -> 1f 00 a2 64
  14901. */
  14902. clen = 0
  14903. wmsk = uint64(0)
  14904. i = libc.Int32FromUint64(libc.Uint64FromInt64(8) - libc.Uint64FromInt32(1))
  14905. for {
  14906. if !(i >= 0) {
  14907. break
  14908. }
  14909. shft = i * int32(m_CHAR_BIT)
  14910. bmsk = libc.Uint64FromInt64(0xff) << shft
  14911. wmsk |= bmsk
  14912. if libc.Uint64FromInt32(*(*Twchar_t)(unsafe.Pointer(dst)))&wmsk != 0 || i == 0 {
  14913. v12 = clen
  14914. clen++
  14915. *(*uint8)(unsafe.Pointer(mbdst + uintptr(v12))) = uint8(libc.Uint64FromInt32(*(*Twchar_t)(unsafe.Pointer(dst))) & bmsk >> shft)
  14916. }
  14917. goto _11
  14918. _11:
  14919. ;
  14920. i--
  14921. }
  14922. cerr = int32(1)
  14923. }
  14924. /* If this character would exceed our output limit, stop. */
  14925. if olen+libc.Uint64FromInt32(clen) > libc.Uint64FromInt64(maxolen) {
  14926. break
  14927. }
  14928. /* Advance output pointer by number of bytes written. */
  14929. mbdst += uintptr(clen)
  14930. /* Advance buffer character pointer. */
  14931. dst += 4
  14932. /* Incrment output character count. */
  14933. olen += libc.Uint64FromInt32(clen)
  14934. goto _10
  14935. _10:
  14936. ;
  14937. len1--
  14938. }
  14939. /* Terminate the output string. */
  14940. *(*uint8)(unsafe.Pointer(mbdst)) = uint8('\000')
  14941. if flags&int32(m_VIS_NOLOCALE1) != 0 {
  14942. /* Pass conversion error flag out. */
  14943. if cerr_ptr != 0 {
  14944. *(*int32)(unsafe.Pointer(cerr_ptr)) = cerr
  14945. }
  14946. }
  14947. libc.Xfree(tls, extra)
  14948. libc.Xfree(tls, pdst)
  14949. libc.Xfree(tls, psrc)
  14950. return libc.Int32FromUint64(olen)
  14951. goto out
  14952. out:
  14953. ;
  14954. libc.Xfree(tls, extra)
  14955. libc.Xfree(tls, pdst)
  14956. libc.Xfree(tls, psrc)
  14957. libc.Xfree(tls, mdst)
  14958. return error1
  14959. }
  14960. func _istrsenvisxna(tls *libc.TLS, _mbdst uintptr, dlen uintptr, mbsrc uintptr, mblength Tsize_t, flags int32, mbextra uintptr, cerr_ptr uintptr) (r int32) {
  14961. bp := tls.Alloc(16)
  14962. defer tls.Free(16)
  14963. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  14964. return _istrsenvisx(tls, bp, dlen, mbsrc, mblength, flags, mbextra, cerr_ptr)
  14965. }
  14966. func _istrsenvisxl(tls *libc.TLS, mbdst uintptr, dlen uintptr, mbsrc uintptr, flags int32, mbextra uintptr, cerr_ptr uintptr) (r int32) {
  14967. var v1 uint64
  14968. _ = v1
  14969. if mbsrc != libc.UintptrFromInt32(0) {
  14970. v1 = libc.Xstrlen(tls, mbsrc)
  14971. } else {
  14972. v1 = uint64(0)
  14973. }
  14974. return _istrsenvisxna(tls, mbdst, dlen, mbsrc, v1, flags, mbextra, cerr_ptr)
  14975. }
  14976. /*
  14977. * The "svis" variants all take an "extra" arg that is a pointer
  14978. * to a NUL-terminated list of characters to be encoded, too.
  14979. * These functions are useful e. g. to encode strings in such a
  14980. * way so that they are not interpreted by a shell.
  14981. */
  14982. func Xsvis(tls *libc.TLS, _mbdst uintptr, c int32, flags int32, nextc int32, mbextra uintptr) (r uintptr) {
  14983. bp := tls.Alloc(16)
  14984. defer tls.Free(16)
  14985. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  14986. var ret int32
  14987. var _ /* cc at bp+8 */ [2]uint8
  14988. _ = ret
  14989. (*(*[2]uint8)(unsafe.Pointer(bp + 8)))[0] = libc.Uint8FromInt32(c)
  14990. (*(*[2]uint8)(unsafe.Pointer(bp + 8)))[int32(1)] = libc.Uint8FromInt32(nextc)
  14991. ret = _istrsenvisx(tls, bp, libc.UintptrFromInt32(0), bp+8, uint64(1), flags, mbextra, libc.UintptrFromInt32(0))
  14992. if ret < 0 {
  14993. return libc.UintptrFromInt32(0)
  14994. }
  14995. return *(*uintptr)(unsafe.Pointer(bp)) + uintptr(ret)
  14996. }
  14997. func Xsnvis(tls *libc.TLS, _mbdst uintptr, _dlen Tsize_t, c int32, flags int32, nextc int32, mbextra uintptr) (r uintptr) {
  14998. bp := tls.Alloc(32)
  14999. defer tls.Free(32)
  15000. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  15001. *(*Tsize_t)(unsafe.Pointer(bp + 8)) = _dlen
  15002. var ret int32
  15003. var _ /* cc at bp+16 */ [2]uint8
  15004. _ = ret
  15005. (*(*[2]uint8)(unsafe.Pointer(bp + 16)))[0] = libc.Uint8FromInt32(c)
  15006. (*(*[2]uint8)(unsafe.Pointer(bp + 16)))[int32(1)] = libc.Uint8FromInt32(nextc)
  15007. ret = _istrsenvisx(tls, bp, bp+8, bp+16, uint64(1), flags, mbextra, libc.UintptrFromInt32(0))
  15008. if ret < 0 {
  15009. return libc.UintptrFromInt32(0)
  15010. }
  15011. return *(*uintptr)(unsafe.Pointer(bp)) + uintptr(ret)
  15012. }
  15013. func Xstrsvis(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, flags int32, mbextra uintptr) (r int32) {
  15014. return _istrsenvisxl(tls, mbdst, libc.UintptrFromInt32(0), mbsrc, flags, mbextra, libc.UintptrFromInt32(0))
  15015. }
  15016. func Xstrsnvis(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, flags int32, mbextra uintptr) (r int32) {
  15017. bp := tls.Alloc(16)
  15018. defer tls.Free(16)
  15019. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15020. return _istrsenvisxl(tls, mbdst, bp, mbsrc, flags, mbextra, libc.UintptrFromInt32(0))
  15021. }
  15022. func Xstrsvisx(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, len1 Tsize_t, flags int32, mbextra uintptr) (r int32) {
  15023. return _istrsenvisxna(tls, mbdst, libc.UintptrFromInt32(0), mbsrc, len1, flags, mbextra, libc.UintptrFromInt32(0))
  15024. }
  15025. func Xstrsnvisx(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, len1 Tsize_t, flags int32, mbextra uintptr) (r int32) {
  15026. bp := tls.Alloc(16)
  15027. defer tls.Free(16)
  15028. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15029. return _istrsenvisxna(tls, mbdst, bp, mbsrc, len1, flags, mbextra, libc.UintptrFromInt32(0))
  15030. }
  15031. func Xstrsenvisx(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, len1 Tsize_t, flags int32, mbextra uintptr, cerr_ptr uintptr) (r int32) {
  15032. bp := tls.Alloc(16)
  15033. defer tls.Free(16)
  15034. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15035. return _istrsenvisxna(tls, mbdst, bp, mbsrc, len1, flags, mbextra, cerr_ptr)
  15036. }
  15037. // C documentation
  15038. //
  15039. // /*
  15040. // * vis - visually encode characters
  15041. // */
  15042. func Xvis(tls *libc.TLS, _mbdst uintptr, c int32, flags int32, nextc int32) (r uintptr) {
  15043. bp := tls.Alloc(16)
  15044. defer tls.Free(16)
  15045. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  15046. var ret int32
  15047. var _ /* cc at bp+8 */ [2]uint8
  15048. _ = ret
  15049. (*(*[2]uint8)(unsafe.Pointer(bp + 8)))[0] = libc.Uint8FromInt32(c)
  15050. (*(*[2]uint8)(unsafe.Pointer(bp + 8)))[int32(1)] = libc.Uint8FromInt32(nextc)
  15051. ret = _istrsenvisx(tls, bp, libc.UintptrFromInt32(0), bp+8, uint64(1), flags, __ccgo_ts+60, libc.UintptrFromInt32(0))
  15052. if ret < 0 {
  15053. return libc.UintptrFromInt32(0)
  15054. }
  15055. return *(*uintptr)(unsafe.Pointer(bp)) + uintptr(ret)
  15056. }
  15057. func Xnvis(tls *libc.TLS, _mbdst uintptr, _dlen Tsize_t, c int32, flags int32, nextc int32) (r uintptr) {
  15058. bp := tls.Alloc(32)
  15059. defer tls.Free(32)
  15060. *(*uintptr)(unsafe.Pointer(bp)) = _mbdst
  15061. *(*Tsize_t)(unsafe.Pointer(bp + 8)) = _dlen
  15062. var ret int32
  15063. var _ /* cc at bp+16 */ [2]uint8
  15064. _ = ret
  15065. (*(*[2]uint8)(unsafe.Pointer(bp + 16)))[0] = libc.Uint8FromInt32(c)
  15066. (*(*[2]uint8)(unsafe.Pointer(bp + 16)))[int32(1)] = libc.Uint8FromInt32(nextc)
  15067. ret = _istrsenvisx(tls, bp, bp+8, bp+16, uint64(1), flags, __ccgo_ts+60, libc.UintptrFromInt32(0))
  15068. if ret < 0 {
  15069. return libc.UintptrFromInt32(0)
  15070. }
  15071. return *(*uintptr)(unsafe.Pointer(bp)) + uintptr(ret)
  15072. }
  15073. /*
  15074. * strvis - visually encode characters from src into dst
  15075. *
  15076. * Dst must be 4 times the size of src to account for possible
  15077. * expansion. The length of dst, not including the trailing NULL,
  15078. * is returned.
  15079. */
  15080. func Xstrvis(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, flags int32) (r int32) {
  15081. return _istrsenvisxl(tls, mbdst, libc.UintptrFromInt32(0), mbsrc, flags, __ccgo_ts+60, libc.UintptrFromInt32(0))
  15082. }
  15083. func Xstrnvis_openbsd(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, _dlen Tsize_t, flags int32) (r int32) {
  15084. bp := tls.Alloc(16)
  15085. defer tls.Free(16)
  15086. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15087. return _istrsenvisxl(tls, mbdst, bp, mbsrc, flags, __ccgo_ts+60, libc.UintptrFromInt32(0))
  15088. }
  15089. func Xstrnvis_netbsd(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, flags int32) (r int32) {
  15090. bp := tls.Alloc(16)
  15091. defer tls.Free(16)
  15092. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15093. return _istrsenvisxl(tls, mbdst, bp, mbsrc, flags, __ccgo_ts+60, libc.UintptrFromInt32(0))
  15094. }
  15095. func Xstravis(tls *libc.TLS, mbdstp uintptr, mbsrc uintptr, flags int32) (r int32) {
  15096. var v1 uint64
  15097. _ = v1
  15098. *(*uintptr)(unsafe.Pointer(mbdstp)) = libc.UintptrFromInt32(0)
  15099. if mbsrc != libc.UintptrFromInt32(0) {
  15100. v1 = libc.Xstrlen(tls, mbsrc)
  15101. } else {
  15102. v1 = uint64(0)
  15103. }
  15104. return _istrsenvisx(tls, mbdstp, libc.UintptrFromInt32(0), mbsrc, v1, flags, __ccgo_ts+60, libc.UintptrFromInt32(0))
  15105. }
  15106. /*
  15107. * strvisx - visually encode characters from src into dst
  15108. *
  15109. * Dst must be 4 times the size of src to account for possible
  15110. * expansion. The length of dst, not including the trailing NULL,
  15111. * is returned.
  15112. *
  15113. * Strvisx encodes exactly len characters from src into dst.
  15114. * This is useful for encoding a block of data.
  15115. */
  15116. func Xstrvisx(tls *libc.TLS, mbdst uintptr, mbsrc uintptr, len1 Tsize_t, flags int32) (r int32) {
  15117. return _istrsenvisxna(tls, mbdst, libc.UintptrFromInt32(0), mbsrc, len1, flags, __ccgo_ts+60, libc.UintptrFromInt32(0))
  15118. }
  15119. func Xstrnvisx(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, len1 Tsize_t, flags int32) (r int32) {
  15120. bp := tls.Alloc(16)
  15121. defer tls.Free(16)
  15122. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15123. return _istrsenvisxna(tls, mbdst, bp, mbsrc, len1, flags, __ccgo_ts+60, libc.UintptrFromInt32(0))
  15124. }
  15125. func Xstrenvisx(tls *libc.TLS, mbdst uintptr, _dlen Tsize_t, mbsrc uintptr, len1 Tsize_t, flags int32, cerr_ptr uintptr) (r int32) {
  15126. bp := tls.Alloc(16)
  15127. defer tls.Free(16)
  15128. *(*Tsize_t)(unsafe.Pointer(bp)) = _dlen
  15129. return _istrsenvisxna(tls, mbdst, bp, mbsrc, len1, flags, __ccgo_ts+60, cerr_ptr)
  15130. }
  15131. // C documentation
  15132. //
  15133. // /*
  15134. // * Appends src to string dst of size siz (unlike wcsncat, siz is the
  15135. // * full size of dst, not space left). At most siz-1 characters
  15136. // * will be copied. Always NUL terminates (unless siz == 0).
  15137. // * Returns wcslen(initial dst) + wcslen(src); if retval >= siz,
  15138. // * truncation occurred.
  15139. // */
  15140. func Xwcslcat(tls *libc.TLS, dst uintptr, src uintptr, siz Tsize_t) (r Tsize_t) {
  15141. var d, s, v3 uintptr
  15142. var dlen, n, v1 Tsize_t
  15143. var v2 bool
  15144. _, _, _, _, _, _, _ = d, dlen, n, s, v1, v2, v3
  15145. d = dst
  15146. s = src
  15147. n = siz
  15148. /* Find the end of dst and adjust bytes left but don't go past end */
  15149. for {
  15150. if v2 = *(*Twchar_t)(unsafe.Pointer(d)) != int32('\000'); v2 {
  15151. v1 = n
  15152. n--
  15153. }
  15154. if !(v2 && v1 != uint64(0)) {
  15155. break
  15156. }
  15157. d += 4
  15158. }
  15159. dlen = libc.Uint64FromInt64((int64(d) - int64(dst)) / 4)
  15160. n = siz - dlen
  15161. if n == uint64(0) {
  15162. return dlen + libc.Xwcslen(tls, s)
  15163. }
  15164. for *(*Twchar_t)(unsafe.Pointer(s)) != int32('\000') {
  15165. if n != uint64(1) {
  15166. v3 = d
  15167. d += 4
  15168. *(*Twchar_t)(unsafe.Pointer(v3)) = *(*Twchar_t)(unsafe.Pointer(s))
  15169. n--
  15170. }
  15171. s += 4
  15172. }
  15173. *(*Twchar_t)(unsafe.Pointer(d)) = int32('\000')
  15174. return dlen + libc.Uint64FromInt64((int64(s)-int64(src))/4) /* count does not include NUL */
  15175. }
  15176. // C documentation
  15177. //
  15178. // /*
  15179. // * Copy src to string dst of size siz. At most siz-1 characters
  15180. // * will be copied. Always NUL terminates (unless siz == 0).
  15181. // * Returns wcslen(src); if retval >= siz, truncation occurred.
  15182. // */
  15183. func Xwcslcpy(tls *libc.TLS, dst uintptr, src uintptr, siz Tsize_t) (r Tsize_t) {
  15184. var d, s, v6, v7, v8 uintptr
  15185. var n, v1, v3 Tsize_t
  15186. var v2 bool
  15187. var v5 Twchar_t
  15188. _, _, _, _, _, _, _, _, _, _ = d, n, s, v1, v2, v3, v5, v6, v7, v8
  15189. d = dst
  15190. s = src
  15191. n = siz
  15192. /* Copy as many bytes as will fit */
  15193. if v2 = n != uint64(0); v2 {
  15194. n--
  15195. v1 = n
  15196. }
  15197. if v2 && v1 != uint64(0) {
  15198. for {
  15199. v6 = s
  15200. s += 4
  15201. v5 = *(*Twchar_t)(unsafe.Pointer(v6))
  15202. v7 = d
  15203. d += 4
  15204. *(*Twchar_t)(unsafe.Pointer(v7)) = v5
  15205. if v5 == 0 {
  15206. break
  15207. }
  15208. goto _4
  15209. _4:
  15210. ;
  15211. n--
  15212. v3 = n
  15213. if !(v3 != uint64(0)) {
  15214. break
  15215. }
  15216. }
  15217. }
  15218. /* Not enough room in dst, add NUL and traverse rest of src */
  15219. if n == uint64(0) {
  15220. if siz != uint64(0) {
  15221. *(*Twchar_t)(unsafe.Pointer(d)) = int32('\000')
  15222. } /* NUL-terminate dst */
  15223. for {
  15224. v8 = s
  15225. s += 4
  15226. if !(*(*Twchar_t)(unsafe.Pointer(v8)) != 0) {
  15227. break
  15228. }
  15229. }
  15230. }
  15231. return libc.Uint64FromInt64((int64(s)-int64(src))/4 - libc.Int64FromInt32(1)) /* count does not include NUL */
  15232. }
  15233. func __ccgo_fp(f interface{}) uintptr {
  15234. type iface [2]uintptr
  15235. return (*iface)(unsafe.Pointer(&f))[1]
  15236. }
  15237. var Xoptreset int32
  15238. var __ccgo_ts = (*reflect.StringHeader)(unsafe.Pointer(&__ccgo_ts1)).Data
  15239. 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"