musl-git-20140318.patch 262 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718
  1. diff -Nur musl-0.9.15/arch/arm/bits/sem.h musl-git/arch/arm/bits/sem.h
  2. --- musl-0.9.15/arch/arm/bits/sem.h 1970-01-01 01:00:00.000000000 +0100
  3. +++ musl-git/arch/arm/bits/sem.h 2014-03-17 16:49:44.000000000 +0100
  4. @@ -0,0 +1,16 @@
  5. +struct semid_ds {
  6. + struct ipc_perm sem_perm;
  7. + time_t sem_otime;
  8. + time_t __unused1;
  9. + time_t sem_ctime;
  10. + time_t __unused2;
  11. +#if __BYTE_ORDER == __LITTLE_ENDIAN
  12. + unsigned short sem_nsems;
  13. + char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
  14. +#else
  15. + char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
  16. + unsigned short sem_nsems;
  17. +#endif
  18. + time_t __unused3;
  19. + time_t __unused4;
  20. +};
  21. diff -Nur musl-0.9.15/arch/arm/bits/shm.h musl-git/arch/arm/bits/shm.h
  22. --- musl-0.9.15/arch/arm/bits/shm.h 2014-01-03 21:12:17.000000000 +0100
  23. +++ musl-git/arch/arm/bits/shm.h 2014-03-17 16:49:44.000000000 +0100
  24. @@ -16,3 +16,14 @@
  25. unsigned long __pad1;
  26. unsigned long __pad2;
  27. };
  28. +
  29. +struct shminfo {
  30. + unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
  31. +};
  32. +
  33. +struct shm_info {
  34. + int __used_ids;
  35. + unsigned long shm_tot, shm_rss, shm_swp;
  36. + unsigned long __swap_attempts, __swap_successes;
  37. +};
  38. +
  39. diff -Nur musl-0.9.15/arch/arm/bits/termios.h musl-git/arch/arm/bits/termios.h
  40. --- musl-0.9.15/arch/arm/bits/termios.h 2014-01-03 21:12:17.000000000 +0100
  41. +++ musl-git/arch/arm/bits/termios.h 2014-03-17 16:49:44.000000000 +0100
  42. @@ -42,6 +42,7 @@
  43. #define IXANY 0004000
  44. #define IXOFF 0010000
  45. #define IMAXBEL 0020000
  46. +#define IUTF8 0040000
  47. #define OPOST 0000001
  48. #define OLCUC 0000002
  49. @@ -75,9 +76,6 @@
  50. #define VT0 0000000
  51. #define VT1 0040000
  52. -/* ?? */
  53. -#define XTABS 0014000
  54. -
  55. #define B0 0000000
  56. #define B50 0000001
  57. #define B75 0000002
  58. @@ -125,8 +123,6 @@
  59. #define HUPCL 0002000
  60. #define CLOCAL 0004000
  61. -#define CRTSCTS 020000000000
  62. -
  63. #define ISIG 0000001
  64. #define ICANON 0000002
  65. #define ECHO 0000010
  66. @@ -137,14 +133,11 @@
  67. #define TOSTOP 0000400
  68. #define IEXTEN 0100000
  69. -/* Extensions? */
  70. -#define CBAUDEX 0010000
  71. #define ECHOCTL 0001000
  72. #define ECHOPRT 0002000
  73. #define ECHOKE 0004000
  74. #define FLUSHO 0010000
  75. #define PENDIN 0040000
  76. -#define EXTPROC 0200000
  77. #define TCOOFF 0
  78. #define TCOON 1
  79. @@ -158,3 +151,10 @@
  80. #define TCSANOW 0
  81. #define TCSADRAIN 1
  82. #define TCSAFLUSH 2
  83. +
  84. +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  85. +#define CBAUDEX 0010000
  86. +#define CRTSCTS 020000000000
  87. +#define EXTPROC 0200000
  88. +#define XTABS 0014000
  89. +#endif
  90. diff -Nur musl-0.9.15/arch/arm/syscall_arch.h musl-git/arch/arm/syscall_arch.h
  91. --- musl-0.9.15/arch/arm/syscall_arch.h 2014-01-03 21:12:17.000000000 +0100
  92. +++ musl-git/arch/arm/syscall_arch.h 2014-03-17 16:49:44.000000000 +0100
  93. @@ -3,6 +3,8 @@
  94. ((union { long long ll; long l[2]; }){ .ll = x }).l[1]
  95. #define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x))
  96. +long (__syscall)(long, ...);
  97. +
  98. #ifndef __clang__
  99. #define __asm_syscall(...) do { \
  100. diff -Nur musl-0.9.15/arch/i386/bits/sem.h musl-git/arch/i386/bits/sem.h
  101. --- musl-0.9.15/arch/i386/bits/sem.h 1970-01-01 01:00:00.000000000 +0100
  102. +++ musl-git/arch/i386/bits/sem.h 2014-03-17 16:49:44.000000000 +0100
  103. @@ -0,0 +1,16 @@
  104. +struct semid_ds {
  105. + struct ipc_perm sem_perm;
  106. + time_t sem_otime;
  107. + time_t __unused1;
  108. + time_t sem_ctime;
  109. + time_t __unused2;
  110. +#if __BYTE_ORDER == __LITTLE_ENDIAN
  111. + unsigned short sem_nsems;
  112. + char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
  113. +#else
  114. + char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
  115. + unsigned short sem_nsems;
  116. +#endif
  117. + time_t __unused3;
  118. + time_t __unused4;
  119. +};
  120. diff -Nur musl-0.9.15/arch/i386/bits/shm.h musl-git/arch/i386/bits/shm.h
  121. --- musl-0.9.15/arch/i386/bits/shm.h 2014-01-03 21:12:17.000000000 +0100
  122. +++ musl-git/arch/i386/bits/shm.h 2014-03-17 16:49:44.000000000 +0100
  123. @@ -16,3 +16,14 @@
  124. unsigned long __pad1;
  125. unsigned long __pad2;
  126. };
  127. +
  128. +struct shminfo {
  129. + unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
  130. +};
  131. +
  132. +struct shm_info {
  133. + int __used_ids;
  134. + unsigned long shm_tot, shm_rss, shm_swp;
  135. + unsigned long __swap_attempts, __swap_successes;
  136. +};
  137. +
  138. diff -Nur musl-0.9.15/arch/i386/bits/termios.h musl-git/arch/i386/bits/termios.h
  139. --- musl-0.9.15/arch/i386/bits/termios.h 2014-01-03 21:12:17.000000000 +0100
  140. +++ musl-git/arch/i386/bits/termios.h 2014-03-17 16:49:44.000000000 +0100
  141. @@ -42,6 +42,7 @@
  142. #define IXANY 0004000
  143. #define IXOFF 0010000
  144. #define IMAXBEL 0020000
  145. +#define IUTF8 0040000
  146. #define OPOST 0000001
  147. #define OLCUC 0000002
  148. @@ -75,9 +76,6 @@
  149. #define VT0 0000000
  150. #define VT1 0040000
  151. -/* ?? */
  152. -#define XTABS 0014000
  153. -
  154. #define B0 0000000
  155. #define B50 0000001
  156. #define B75 0000002
  157. @@ -125,8 +123,6 @@
  158. #define HUPCL 0002000
  159. #define CLOCAL 0004000
  160. -#define CRTSCTS 020000000000
  161. -
  162. #define ISIG 0000001
  163. #define ICANON 0000002
  164. #define ECHO 0000010
  165. @@ -137,14 +133,11 @@
  166. #define TOSTOP 0000400
  167. #define IEXTEN 0100000
  168. -/* Extensions? */
  169. -#define CBAUDEX 0010000
  170. #define ECHOCTL 0001000
  171. #define ECHOPRT 0002000
  172. #define ECHOKE 0004000
  173. #define FLUSHO 0010000
  174. #define PENDIN 0040000
  175. -#define EXTPROC 0200000
  176. #define TCOOFF 0
  177. #define TCOON 1
  178. @@ -158,3 +151,10 @@
  179. #define TCSANOW 0
  180. #define TCSADRAIN 1
  181. #define TCSAFLUSH 2
  182. +
  183. +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  184. +#define CBAUDEX 0010000
  185. +#define CRTSCTS 020000000000
  186. +#define EXTPROC 0200000
  187. +#define XTABS 0014000
  188. +#endif
  189. diff -Nur musl-0.9.15/arch/microblaze/bits/sem.h musl-git/arch/microblaze/bits/sem.h
  190. --- musl-0.9.15/arch/microblaze/bits/sem.h 1970-01-01 01:00:00.000000000 +0100
  191. +++ musl-git/arch/microblaze/bits/sem.h 2014-03-17 16:49:44.000000000 +0100
  192. @@ -0,0 +1,16 @@
  193. +struct semid_ds {
  194. + struct ipc_perm sem_perm;
  195. + time_t sem_otime;
  196. + time_t __unused1;
  197. + time_t sem_ctime;
  198. + time_t __unused2;
  199. +#if __BYTE_ORDER == __LITTLE_ENDIAN
  200. + unsigned short sem_nsems;
  201. + char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
  202. +#else
  203. + char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
  204. + unsigned short sem_nsems;
  205. +#endif
  206. + time_t __unused3;
  207. + time_t __unused4;
  208. +};
  209. diff -Nur musl-0.9.15/arch/microblaze/bits/shm.h musl-git/arch/microblaze/bits/shm.h
  210. --- musl-0.9.15/arch/microblaze/bits/shm.h 2014-01-03 21:12:17.000000000 +0100
  211. +++ musl-git/arch/microblaze/bits/shm.h 2014-03-17 16:49:44.000000000 +0100
  212. @@ -16,3 +16,14 @@
  213. unsigned long __pad1;
  214. unsigned long __pad2;
  215. };
  216. +
  217. +struct shminfo {
  218. + unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
  219. +};
  220. +
  221. +struct shm_info {
  222. + int __used_ids;
  223. + unsigned long shm_tot, shm_rss, shm_swp;
  224. + unsigned long __swap_attempts, __swap_successes;
  225. +};
  226. +
  227. diff -Nur musl-0.9.15/arch/microblaze/bits/termios.h musl-git/arch/microblaze/bits/termios.h
  228. --- musl-0.9.15/arch/microblaze/bits/termios.h 2014-01-03 21:12:17.000000000 +0100
  229. +++ musl-git/arch/microblaze/bits/termios.h 2014-03-17 16:49:44.000000000 +0100
  230. @@ -42,6 +42,7 @@
  231. #define IXANY 0004000
  232. #define IXOFF 0010000
  233. #define IMAXBEL 0020000
  234. +#define IUTF8 0040000
  235. #define OPOST 0000001
  236. #define OLCUC 0000002
  237. @@ -75,9 +76,6 @@
  238. #define VT0 0000000
  239. #define VT1 0040000
  240. -/* ?? */
  241. -#define XTABS 0014000
  242. -
  243. #define B0 0000000
  244. #define B50 0000001
  245. #define B75 0000002
  246. @@ -125,8 +123,6 @@
  247. #define HUPCL 0002000
  248. #define CLOCAL 0004000
  249. -#define CRTSCTS 020000000000
  250. -
  251. #define ISIG 0000001
  252. #define ICANON 0000002
  253. #define ECHO 0000010
  254. @@ -137,14 +133,11 @@
  255. #define TOSTOP 0000400
  256. #define IEXTEN 0100000
  257. -/* Extensions? */
  258. -#define CBAUDEX 0010000
  259. #define ECHOCTL 0001000
  260. #define ECHOPRT 0002000
  261. #define ECHOKE 0004000
  262. #define FLUSHO 0010000
  263. #define PENDIN 0040000
  264. -#define EXTPROC 0200000
  265. #define TCOOFF 0
  266. #define TCOON 1
  267. @@ -158,3 +151,10 @@
  268. #define TCSANOW 0
  269. #define TCSADRAIN 1
  270. #define TCSAFLUSH 2
  271. +
  272. +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  273. +#define CBAUDEX 0010000
  274. +#define CRTSCTS 020000000000
  275. +#define EXTPROC 0200000
  276. +#define XTABS 0014000
  277. +#endif
  278. diff -Nur musl-0.9.15/arch/microblaze/syscall_arch.h musl-git/arch/microblaze/syscall_arch.h
  279. --- musl-0.9.15/arch/microblaze/syscall_arch.h 2014-01-03 21:12:17.000000000 +0100
  280. +++ musl-git/arch/microblaze/syscall_arch.h 2014-03-17 16:49:44.000000000 +0100
  281. @@ -3,6 +3,8 @@
  282. ((union { long long ll; long l[2]; }){ .ll = x }).l[1]
  283. #define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x))
  284. +long (__syscall)(long, ...);
  285. +
  286. #ifndef __clang__
  287. static __inline long __syscall0(long n)
  288. diff -Nur musl-0.9.15/arch/mips/bits/fenv.h musl-git/arch/mips/bits/fenv.h
  289. --- musl-0.9.15/arch/mips/bits/fenv.h 2014-01-03 21:12:17.000000000 +0100
  290. +++ musl-git/arch/mips/bits/fenv.h 2014-03-17 16:49:44.000000000 +0100
  291. @@ -1,3 +1,7 @@
  292. +#ifdef __mips_soft_float
  293. +#define FE_ALL_EXCEPT 0
  294. +#define FE_TONEAREST 0
  295. +#else
  296. #define FE_INEXACT 4
  297. #define FE_UNDERFLOW 8
  298. #define FE_OVERFLOW 16
  299. @@ -10,6 +14,7 @@
  300. #define FE_TOWARDZERO 1
  301. #define FE_UPWARD 2
  302. #define FE_DOWNWARD 3
  303. +#endif
  304. typedef unsigned short fexcept_t;
  305. diff -Nur musl-0.9.15/arch/mips/bits/sem.h musl-git/arch/mips/bits/sem.h
  306. --- musl-0.9.15/arch/mips/bits/sem.h 1970-01-01 01:00:00.000000000 +0100
  307. +++ musl-git/arch/mips/bits/sem.h 2014-03-17 16:49:44.000000000 +0100
  308. @@ -0,0 +1,14 @@
  309. +struct semid_ds {
  310. + struct ipc_perm sem_perm;
  311. + time_t sem_otime;
  312. + time_t sem_ctime;
  313. +#if __BYTE_ORDER == __LITTLE_ENDIAN
  314. + unsigned short sem_nsems;
  315. + char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
  316. +#else
  317. + char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
  318. + unsigned short sem_nsems;
  319. +#endif
  320. + time_t __unused3;
  321. + time_t __unused4;
  322. +};
  323. diff -Nur musl-0.9.15/arch/mips/bits/shm.h musl-git/arch/mips/bits/shm.h
  324. --- musl-0.9.15/arch/mips/bits/shm.h 2014-01-03 21:12:17.000000000 +0100
  325. +++ musl-git/arch/mips/bits/shm.h 2014-03-17 16:49:44.000000000 +0100
  326. @@ -13,3 +13,14 @@
  327. unsigned long __pad1;
  328. unsigned long __pad2;
  329. };
  330. +
  331. +struct shminfo {
  332. + unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
  333. +};
  334. +
  335. +struct shm_info {
  336. + int __used_ids;
  337. + unsigned long shm_tot, shm_rss, shm_swp;
  338. + unsigned long __swap_attempts, __swap_successes;
  339. +};
  340. +
  341. diff -Nur musl-0.9.15/arch/mips/bits/statfs.h musl-git/arch/mips/bits/statfs.h
  342. --- musl-0.9.15/arch/mips/bits/statfs.h 2014-01-03 21:12:17.000000000 +0100
  343. +++ musl-git/arch/mips/bits/statfs.h 2014-03-17 16:49:44.000000000 +0100
  344. @@ -1,7 +1,8 @@
  345. struct statfs {
  346. - unsigned long f_type, f_bsize;
  347. - fsblkcnt_t f_blocks, f_bfree, f_bavail;
  348. + unsigned long f_type, f_bsize, f_frsize;
  349. + fsblkcnt_t f_blocks, f_bfree;
  350. fsfilcnt_t f_files, f_ffree;
  351. + fsblkcnt_t f_bavail;
  352. fsid_t f_fsid;
  353. - unsigned long f_namelen, f_frsize, f_flags, f_spare[4];
  354. + unsigned long f_namelen, f_flags, f_spare[5];
  355. };
  356. diff -Nur musl-0.9.15/arch/mips/bits/termios.h musl-git/arch/mips/bits/termios.h
  357. --- musl-0.9.15/arch/mips/bits/termios.h 2014-01-03 21:12:17.000000000 +0100
  358. +++ musl-git/arch/mips/bits/termios.h 2014-03-17 16:49:44.000000000 +0100
  359. @@ -77,9 +77,6 @@
  360. #define VT0 0000000
  361. #define VT1 0040000
  362. -/* ?? */
  363. -#define XTABS 0014000
  364. -
  365. #define B0 0000000
  366. #define B50 0000001
  367. #define B75 0000002
  368. @@ -129,12 +126,6 @@
  369. #define PARODD 0001000
  370. #define HUPCL 0002000
  371. #define CLOCAL 0004000
  372. -#define CBAUDEX 0010000
  373. -
  374. -#define CIBAUD 002003600000
  375. -#define CMSPAR 010000000000
  376. -#define CRTSCTS 020000000000
  377. -#define IBSHIFT 16
  378. #define ISIG 0000001
  379. #define ICANON 0000002
  380. @@ -152,9 +143,6 @@
  381. #define PENDIN 0040000
  382. #define TOSTOP 0100000
  383. #define ITOSTOP 0100000
  384. -#define EXTPROC 0200000
  385. -
  386. -#define TIOCSER_TEMT 1
  387. #define TCOOFF 0
  388. #define TCOON 1
  389. @@ -168,3 +156,14 @@
  390. #define TCSANOW 0
  391. #define TCSADRAIN 1
  392. #define TCSAFLUSH 2
  393. +
  394. +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  395. +#define CBAUDEX 0010000
  396. +#define CIBAUD 002003600000
  397. +#define IBSHIFT 16
  398. +#define CMSPAR 010000000000
  399. +#define CRTSCTS 020000000000
  400. +#define EXTPROC 0200000
  401. +#define XTABS 0014000
  402. +#define TIOCSER_TEMT 1
  403. +#endif
  404. diff -Nur musl-0.9.15/arch/mips/reloc.h musl-git/arch/mips/reloc.h
  405. --- musl-0.9.15/arch/mips/reloc.h 2014-01-03 21:12:17.000000000 +0100
  406. +++ musl-git/arch/mips/reloc.h 2014-03-17 16:49:44.000000000 +0100
  407. @@ -8,7 +8,13 @@
  408. #define ENDIAN_SUFFIX ""
  409. #endif
  410. -#define LDSO_ARCH "mips" ENDIAN_SUFFIX
  411. +#ifdef __mips_soft_float
  412. +#define FP_SUFFIX "-sf"
  413. +#else
  414. +#define FP_SUFFIX ""
  415. +#endif
  416. +
  417. +#define LDSO_ARCH "mips" ENDIAN_SUFFIX FP_SUFFIX
  418. #define IS_COPY(x) ((x)==R_MIPS_COPY)
  419. #define IS_PLT(x) 1
  420. diff -Nur musl-0.9.15/arch/mips/syscall_arch.h musl-git/arch/mips/syscall_arch.h
  421. --- musl-0.9.15/arch/mips/syscall_arch.h 2014-01-03 21:12:17.000000000 +0100
  422. +++ musl-git/arch/mips/syscall_arch.h 2014-03-17 16:49:44.000000000 +0100
  423. @@ -3,6 +3,8 @@
  424. ((union { long long ll; long l[2]; }){ .ll = x }).l[1]
  425. #define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x))
  426. +long (__syscall)(long, ...);
  427. +
  428. #ifndef __clang__
  429. #define __asm_syscall(...) do { \
  430. diff -Nur musl-0.9.15/arch/powerpc/bits/ipc.h musl-git/arch/powerpc/bits/ipc.h
  431. --- musl-0.9.15/arch/powerpc/bits/ipc.h 2014-01-03 21:12:17.000000000 +0100
  432. +++ musl-git/arch/powerpc/bits/ipc.h 2014-03-17 16:49:44.000000000 +0100
  433. @@ -7,8 +7,9 @@
  434. gid_t cgid;
  435. mode_t mode;
  436. int __ipc_perm_seq;
  437. - long __pad1;
  438. - long __pad2;
  439. + int __pad1;
  440. + long long __pad2;
  441. + long long __pad3;
  442. };
  443. #define IPC_64 0x100
  444. diff -Nur musl-0.9.15/arch/powerpc/bits/msg.h musl-git/arch/powerpc/bits/msg.h
  445. --- musl-0.9.15/arch/powerpc/bits/msg.h 2014-01-03 21:12:17.000000000 +0100
  446. +++ musl-git/arch/powerpc/bits/msg.h 2014-03-17 16:49:44.000000000 +0100
  447. @@ -1,12 +1,12 @@
  448. struct msqid_ds
  449. {
  450. struct ipc_perm msg_perm;
  451. - time_t msg_stime;
  452. int __unused1;
  453. - time_t msg_rtime;
  454. + time_t msg_stime;
  455. int __unused2;
  456. - time_t msg_ctime;
  457. + time_t msg_rtime;
  458. int __unused3;
  459. + time_t msg_ctime;
  460. unsigned long msg_cbytes;
  461. msgqnum_t msg_qnum;
  462. msglen_t msg_qbytes;
  463. diff -Nur musl-0.9.15/arch/powerpc/bits/sem.h musl-git/arch/powerpc/bits/sem.h
  464. --- musl-0.9.15/arch/powerpc/bits/sem.h 1970-01-01 01:00:00.000000000 +0100
  465. +++ musl-git/arch/powerpc/bits/sem.h 2014-03-17 16:49:44.000000000 +0100
  466. @@ -0,0 +1,10 @@
  467. +struct semid_ds {
  468. + struct ipc_perm sem_perm;
  469. + int __unused1;
  470. + time_t sem_otime;
  471. + int __unused2;
  472. + time_t sem_ctime;
  473. + unsigned short __sem_nsems_pad, sem_nsems;
  474. + long __unused3;
  475. + long __unused4;
  476. +};
  477. diff -Nur musl-0.9.15/arch/powerpc/bits/shm.h musl-git/arch/powerpc/bits/shm.h
  478. --- musl-0.9.15/arch/powerpc/bits/shm.h 2014-01-03 21:12:17.000000000 +0100
  479. +++ musl-git/arch/powerpc/bits/shm.h 2014-03-17 16:49:44.000000000 +0100
  480. @@ -3,16 +3,28 @@
  481. struct shmid_ds
  482. {
  483. struct ipc_perm shm_perm;
  484. - size_t shm_segsz;
  485. - time_t shm_atime;
  486. int __unused1;
  487. - time_t shm_dtime;
  488. + time_t shm_atime;
  489. int __unused2;
  490. - time_t shm_ctime;
  491. + time_t shm_dtime;
  492. int __unused3;
  493. + time_t shm_ctime;
  494. + int __unused4;
  495. + size_t shm_segsz;
  496. pid_t shm_cpid;
  497. pid_t shm_lpid;
  498. unsigned long shm_nattch;
  499. unsigned long __pad1;
  500. unsigned long __pad2;
  501. };
  502. +
  503. +struct shminfo {
  504. + unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
  505. +};
  506. +
  507. +struct shm_info {
  508. + int __used_ids;
  509. + unsigned long shm_tot, shm_rss, shm_swp;
  510. + unsigned long __swap_attempts, __swap_successes;
  511. +};
  512. +
  513. diff -Nur musl-0.9.15/arch/powerpc/bits/socket.h musl-git/arch/powerpc/bits/socket.h
  514. --- musl-0.9.15/arch/powerpc/bits/socket.h 2014-01-03 21:12:17.000000000 +0100
  515. +++ musl-git/arch/powerpc/bits/socket.h 2014-03-17 16:49:44.000000000 +0100
  516. @@ -1,12 +1,12 @@
  517. struct msghdr
  518. {
  519. void *msg_name;
  520. - int msg_namelen;
  521. + socklen_t msg_namelen;
  522. struct iovec *msg_iov;
  523. - unsigned long msg_iovlen;
  524. + int msg_iovlen;
  525. void *msg_control;
  526. - unsigned long msg_controllen;
  527. - unsigned msg_flags;
  528. + socklen_t msg_controllen;
  529. + int msg_flags;
  530. };
  531. struct cmsghdr
  532. diff -Nur musl-0.9.15/arch/powerpc/bits/termios.h musl-git/arch/powerpc/bits/termios.h
  533. --- musl-0.9.15/arch/powerpc/bits/termios.h 2014-01-03 21:12:17.000000000 +0100
  534. +++ musl-git/arch/powerpc/bits/termios.h 2014-03-17 16:49:44.000000000 +0100
  535. @@ -66,7 +66,6 @@
  536. #define TAB1 00002000
  537. #define TAB2 00004000
  538. #define TAB3 00006000
  539. -#define XTABS 00006000
  540. #define CRDLY 00030000
  541. #define CR0 00000000
  542. #define CR1 00010000
  543. @@ -101,7 +100,6 @@
  544. #define B38400 0000017
  545. #define EXTA B19200
  546. #define EXTB B38400
  547. -#define CBAUDEX 0000000
  548. #define B57600 00020
  549. #define B115200 00021
  550. #define B230400 00022
  551. @@ -120,9 +118,6 @@
  552. #define B4000000 00036
  553. #define BOTHER 00037
  554. -#define CIBAUD 077600000
  555. -#define IBSHIFT 16
  556. -
  557. #define CSIZE 00001400
  558. #define CS5 00000000
  559. #define CS6 00000400
  560. @@ -136,8 +131,6 @@
  561. #define HUPCL 00040000
  562. #define CLOCAL 00100000
  563. -#define CMSPAR 010000000000
  564. -#define CRTSCTS 020000000000
  565. #define ISIG 0x00000080
  566. #define ICANON 0x00000100
  567. @@ -154,7 +147,6 @@
  568. #define FLUSHO 0x00800000
  569. #define PENDIN 0x20000000
  570. #define IEXTEN 0x00000400
  571. -#define EXTPROC 0x10000000
  572. #define TCOOFF 0
  573. #define TCOON 1
  574. @@ -168,3 +160,13 @@
  575. #define TCSANOW 0
  576. #define TCSADRAIN 1
  577. #define TCSAFLUSH 2
  578. +
  579. +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  580. +#define CBAUDEX 0000000
  581. +#define CIBAUD 077600000
  582. +#define IBSHIFT 16
  583. +#define CMSPAR 010000000000
  584. +#define CRTSCTS 020000000000
  585. +#define EXTPROC 0x10000000
  586. +#define XTABS 00006000
  587. +#endif
  588. diff -Nur musl-0.9.15/arch/sh/atomic.h musl-git/arch/sh/atomic.h
  589. --- musl-0.9.15/arch/sh/atomic.h 1970-01-01 01:00:00.000000000 +0100
  590. +++ musl-git/arch/sh/atomic.h 2014-03-17 16:49:44.000000000 +0100
  591. @@ -0,0 +1,87 @@
  592. +#ifndef _INTERNAL_ATOMIC_H
  593. +#define _INTERNAL_ATOMIC_H
  594. +
  595. +#include <stdint.h>
  596. +
  597. +static inline int a_ctz_l(unsigned long x)
  598. +{
  599. + static const char debruijn32[32] = {
  600. + 0, 1, 23, 2, 29, 24, 19, 3, 30, 27, 25, 11, 20, 8, 4, 13,
  601. + 31, 22, 28, 18, 26, 10, 7, 12, 21, 17, 9, 6, 16, 5, 15, 14
  602. + };
  603. + return debruijn32[(x&-x)*0x076be629 >> 27];
  604. +}
  605. +
  606. +static inline int a_ctz_64(uint64_t x)
  607. +{
  608. + uint32_t y = x;
  609. + if (!y) {
  610. + y = x>>32;
  611. + return 32 + a_ctz_l(y);
  612. + }
  613. + return a_ctz_l(y);
  614. +}
  615. +
  616. +int __sh_cas(volatile int *, int, int);
  617. +int __sh_swap(volatile int *, int);
  618. +int __sh_fetch_add(volatile int *, int);
  619. +void __sh_store(volatile int *, int);
  620. +void __sh_and(volatile int *, int);
  621. +void __sh_or(volatile int *, int);
  622. +
  623. +#define a_cas(p,t,s) __sh_cas(p,t,s)
  624. +#define a_swap(x,v) __sh_swap(x,v)
  625. +#define a_fetch_add(x,v) __sh_fetch_add(x, v)
  626. +#define a_store(x,v) __sh_store(x, v)
  627. +#define a_and(x,v) __sh_and(x, v)
  628. +#define a_or(x,v) __sh_or(x, v)
  629. +
  630. +static inline void *a_cas_p(volatile void *p, void *t, void *s)
  631. +{
  632. + return (void *)a_cas(p, (int)t, (int)s);
  633. +}
  634. +
  635. +static inline long a_cas_l(volatile void *p, long t, long s)
  636. +{
  637. + return a_cas(p, t, s);
  638. +}
  639. +
  640. +static inline void a_inc(volatile int *x)
  641. +{
  642. + a_fetch_add(x, 1);
  643. +}
  644. +
  645. +static inline void a_dec(volatile int *x)
  646. +{
  647. + a_fetch_add(x, -1);
  648. +}
  649. +
  650. +static inline void a_spin()
  651. +{
  652. +}
  653. +
  654. +static inline void a_crash()
  655. +{
  656. + *(volatile char *)0=0;
  657. +}
  658. +
  659. +static inline void a_or_l(volatile void *p, long v)
  660. +{
  661. + a_or(p, v);
  662. +}
  663. +
  664. +static inline void a_and_64(volatile uint64_t *p, uint64_t v)
  665. +{
  666. + union { uint64_t v; uint32_t r[2]; } u = { v };
  667. + a_and((int *)p, u.r[0]);
  668. + a_and((int *)p+1, u.r[1]);
  669. +}
  670. +
  671. +static inline void a_or_64(volatile uint64_t *p, uint64_t v)
  672. +{
  673. + union { uint64_t v; uint32_t r[2]; } u = { v };
  674. + a_or((int *)p, u.r[0]);
  675. + a_or((int *)p+1, u.r[1]);
  676. +}
  677. +
  678. +#endif
  679. diff -Nur musl-0.9.15/arch/sh/bits/alltypes.h.in musl-git/arch/sh/bits/alltypes.h.in
  680. --- musl-0.9.15/arch/sh/bits/alltypes.h.in 1970-01-01 01:00:00.000000000 +0100
  681. +++ musl-git/arch/sh/bits/alltypes.h.in 2014-03-17 16:49:44.000000000 +0100
  682. @@ -0,0 +1,23 @@
  683. +#define _Addr int
  684. +#define _Int64 long long
  685. +#define _Reg int
  686. +
  687. +TYPEDEF __builtin_va_list va_list;
  688. +TYPEDEF __builtin_va_list __isoc_va_list;
  689. +
  690. +#ifndef __cplusplus
  691. +TYPEDEF long wchar_t;
  692. +#endif
  693. +TYPEDEF unsigned wint_t;
  694. +
  695. +TYPEDEF float float_t;
  696. +TYPEDEF double double_t;
  697. +
  698. +TYPEDEF long time_t;
  699. +TYPEDEF long suseconds_t;
  700. +
  701. +TYPEDEF struct { union { int __i[9]; unsigned __s[9]; } __u; } pthread_attr_t;
  702. +TYPEDEF struct { union { int __i[6]; void *__p[6]; } __u; } pthread_mutex_t;
  703. +TYPEDEF struct { union { int __i[12]; void *__p[12]; } __u; } pthread_cond_t;
  704. +TYPEDEF struct { union { int __i[8]; void *__p[8]; } __u; } pthread_rwlock_t;
  705. +TYPEDEF struct { union { int __i[5]; void *__p[5]; } __u; } pthread_barrier_t;
  706. diff -Nur musl-0.9.15/arch/sh/bits/endian.h musl-git/arch/sh/bits/endian.h
  707. --- musl-0.9.15/arch/sh/bits/endian.h 1970-01-01 01:00:00.000000000 +0100
  708. +++ musl-git/arch/sh/bits/endian.h 2014-03-17 16:49:44.000000000 +0100
  709. @@ -0,0 +1,5 @@
  710. +#if __BIG_ENDIAN__
  711. +#define __BYTE_ORDER __BIG_ENDIAN
  712. +#else
  713. +#define __BYTE_ORDER __LITTLE_ENDIAN
  714. +#endif
  715. diff -Nur musl-0.9.15/arch/sh/bits/errno.h musl-git/arch/sh/bits/errno.h
  716. --- musl-0.9.15/arch/sh/bits/errno.h 1970-01-01 01:00:00.000000000 +0100
  717. +++ musl-git/arch/sh/bits/errno.h 2014-03-17 16:49:44.000000000 +0100
  718. @@ -0,0 +1,134 @@
  719. +#define EPERM 1
  720. +#define ENOENT 2
  721. +#define ESRCH 3
  722. +#define EINTR 4
  723. +#define EIO 5
  724. +#define ENXIO 6
  725. +#define E2BIG 7
  726. +#define ENOEXEC 8
  727. +#define EBADF 9
  728. +#define ECHILD 10
  729. +#define EAGAIN 11
  730. +#define ENOMEM 12
  731. +#define EACCES 13
  732. +#define EFAULT 14
  733. +#define ENOTBLK 15
  734. +#define EBUSY 16
  735. +#define EEXIST 17
  736. +#define EXDEV 18
  737. +#define ENODEV 19
  738. +#define ENOTDIR 20
  739. +#define EISDIR 21
  740. +#define EINVAL 22
  741. +#define ENFILE 23
  742. +#define EMFILE 24
  743. +#define ENOTTY 25
  744. +#define ETXTBSY 26
  745. +#define EFBIG 27
  746. +#define ENOSPC 28
  747. +#define ESPIPE 29
  748. +#define EROFS 30
  749. +#define EMLINK 31
  750. +#define EPIPE 32
  751. +#define EDOM 33
  752. +#define ERANGE 34
  753. +#define EDEADLK 35
  754. +#define ENAMETOOLONG 36
  755. +#define ENOLCK 37
  756. +#define ENOSYS 38
  757. +#define ENOTEMPTY 39
  758. +#define ELOOP 40
  759. +#define EWOULDBLOCK EAGAIN
  760. +#define ENOMSG 42
  761. +#define EIDRM 43
  762. +#define ECHRNG 44
  763. +#define EL2NSYNC 45
  764. +#define EL3HLT 46
  765. +#define EL3RST 47
  766. +#define ELNRNG 48
  767. +#define EUNATCH 49
  768. +#define ENOCSI 50
  769. +#define EL2HLT 51
  770. +#define EBADE 52
  771. +#define EBADR 53
  772. +#define EXFULL 54
  773. +#define ENOANO 55
  774. +#define EBADRQC 56
  775. +#define EBADSLT 57
  776. +#define EDEADLOCK EDEADLK
  777. +#define EBFONT 59
  778. +#define ENOSTR 60
  779. +#define ENODATA 61
  780. +#define ETIME 62
  781. +#define ENOSR 63
  782. +#define ENONET 64
  783. +#define ENOPKG 65
  784. +#define EREMOTE 66
  785. +#define ENOLINK 67
  786. +#define EADV 68
  787. +#define ESRMNT 69
  788. +#define ECOMM 70
  789. +#define EPROTO 71
  790. +#define EMULTIHOP 72
  791. +#define EDOTDOT 73
  792. +#define EBADMSG 74
  793. +#define EOVERFLOW 75
  794. +#define ENOTUNIQ 76
  795. +#define EBADFD 77
  796. +#define EREMCHG 78
  797. +#define ELIBACC 79
  798. +#define ELIBBAD 80
  799. +#define ELIBSCN 81
  800. +#define ELIBMAX 82
  801. +#define ELIBEXEC 83
  802. +#define EILSEQ 84
  803. +#define ERESTART 85
  804. +#define ESTRPIPE 86
  805. +#define EUSERS 87
  806. +#define ENOTSOCK 88
  807. +#define EDESTADDRREQ 89
  808. +#define EMSGSIZE 90
  809. +#define EPROTOTYPE 91
  810. +#define ENOPROTOOPT 92
  811. +#define EPROTONOSUPPORT 93
  812. +#define ESOCKTNOSUPPORT 94
  813. +#define EOPNOTSUPP 95
  814. +#define ENOTSUP EOPNOTSUPP
  815. +#define EPFNOSUPPORT 96
  816. +#define EAFNOSUPPORT 97
  817. +#define EADDRINUSE 98
  818. +#define EADDRNOTAVAIL 99
  819. +#define ENETDOWN 100
  820. +#define ENETUNREACH 101
  821. +#define ENETRESET 102
  822. +#define ECONNABORTED 103
  823. +#define ECONNRESET 104
  824. +#define ENOBUFS 105
  825. +#define EISCONN 106
  826. +#define ENOTCONN 107
  827. +#define ESHUTDOWN 108
  828. +#define ETOOMANYREFS 109
  829. +#define ETIMEDOUT 110
  830. +#define ECONNREFUSED 111
  831. +#define EHOSTDOWN 112
  832. +#define EHOSTUNREACH 113
  833. +#define EALREADY 114
  834. +#define EINPROGRESS 115
  835. +#define ESTALE 116
  836. +#define EUCLEAN 117
  837. +#define ENOTNAM 118
  838. +#define ENAVAIL 119
  839. +#define EISNAM 120
  840. +#define EREMOTEIO 121
  841. +#define EDQUOT 122
  842. +#define ENOMEDIUM 123
  843. +#define EMEDIUMTYPE 124
  844. +#define ECANCELED 125
  845. +#define ENOKEY 126
  846. +#define EKEYEXPIRED 127
  847. +#define EKEYREVOKED 128
  848. +#define EKEYREJECTED 129
  849. +#define EOWNERDEAD 130
  850. +#define ENOTRECOVERABLE 131
  851. +#define ERFKILL 132
  852. +#define EHWPOISON 133
  853. diff -Nur musl-0.9.15/arch/sh/bits/fcntl.h musl-git/arch/sh/bits/fcntl.h
  854. --- musl-0.9.15/arch/sh/bits/fcntl.h 1970-01-01 01:00:00.000000000 +0100
  855. +++ musl-git/arch/sh/bits/fcntl.h 2014-03-17 16:49:44.000000000 +0100
  856. @@ -0,0 +1,39 @@
  857. +#define O_CREAT 0100
  858. +#define O_EXCL 0200
  859. +#define O_NOCTTY 0400
  860. +#define O_TRUNC 01000
  861. +#define O_APPEND 02000
  862. +#define O_NONBLOCK 04000
  863. +#define O_DSYNC 010000
  864. +#define O_SYNC 04010000
  865. +#define O_RSYNC 04010000
  866. +#define O_DIRECTORY 0200000
  867. +#define O_NOFOLLOW 0400000
  868. +#define O_CLOEXEC 02000000
  869. +
  870. +#define O_ASYNC 020000
  871. +#define O_DIRECT 040000
  872. +#define O_LARGEFILE 0100000
  873. +#define O_NOATIME 01000000
  874. +#define O_TMPFILE 020200000
  875. +#define O_NDELAY O_NONBLOCK
  876. +
  877. +#define F_DUPFD 0
  878. +#define F_GETFD 1
  879. +#define F_SETFD 2
  880. +#define F_GETFL 3
  881. +#define F_SETFL 4
  882. +
  883. +#define F_SETOWN 8
  884. +#define F_GETOWN 9
  885. +#define F_SETSIG 10
  886. +#define F_GETSIG 11
  887. +
  888. +#define F_GETLK 12
  889. +#define F_SETLK 13
  890. +#define F_SETLKW 14
  891. +
  892. +#define F_SETOWN_EX 15
  893. +#define F_GETOWN_EX 16
  894. +
  895. +#define F_GETOWNER_UIDS 17
  896. diff -Nur musl-0.9.15/arch/sh/bits/fenv.h musl-git/arch/sh/bits/fenv.h
  897. --- musl-0.9.15/arch/sh/bits/fenv.h 1970-01-01 01:00:00.000000000 +0100
  898. +++ musl-git/arch/sh/bits/fenv.h 2014-03-17 16:49:44.000000000 +0100
  899. @@ -0,0 +1,26 @@
  900. +#ifndef __SH_FPU_ANY__
  901. +
  902. +#define FE_ALL_EXCEPT 0
  903. +#define FE_TONEAREST 0
  904. +
  905. +#else
  906. +
  907. +#define FE_TONEAREST 0
  908. +#define FE_TOWARDZERO 1
  909. +
  910. +#define FE_INEXACT 0x04
  911. +#define FE_UNDERFLOW 0x08
  912. +#define FE_OVERFLOW 0x10
  913. +#define FE_DIVBYZERO 0x20
  914. +#define FE_INVALID 0x40
  915. +#define FE_ALL_EXCEPT 0x7c
  916. +
  917. +#endif
  918. +
  919. +typedef unsigned long fexcept_t;
  920. +
  921. +typedef struct {
  922. + unsigned long __cw;
  923. +} fenv_t;
  924. +
  925. +#define FE_DFL_ENV ((const fenv_t *) -1)
  926. diff -Nur musl-0.9.15/arch/sh/bits/float.h musl-git/arch/sh/bits/float.h
  927. --- musl-0.9.15/arch/sh/bits/float.h 1970-01-01 01:00:00.000000000 +0100
  928. +++ musl-git/arch/sh/bits/float.h 2014-03-17 16:49:44.000000000 +0100
  929. @@ -0,0 +1,17 @@
  930. +#define FLT_ROUNDS 1
  931. +#define FLT_EVAL_METHOD 0
  932. +
  933. +#define LDBL_TRUE_MIN 4.94065645841246544177e-324L
  934. +#define LDBL_MIN 2.22507385850720138309e-308L
  935. +#define LDBL_MAX 1.79769313486231570815e+308L
  936. +#define LDBL_EPSILON 2.22044604925031308085e-16L
  937. +
  938. +#define LDBL_MANT_DIG 53
  939. +#define LDBL_MIN_EXP (-1021)
  940. +#define LDBL_MAX_EXP 1024
  941. +
  942. +#define LDBL_DIG 15
  943. +#define LDBL_MIN_10_EXP (-307)
  944. +#define LDBL_MAX_10_EXP 308
  945. +
  946. +#define DECIMAL_DIG 17
  947. diff -Nur musl-0.9.15/arch/sh/bits/ioctl.h musl-git/arch/sh/bits/ioctl.h
  948. --- musl-0.9.15/arch/sh/bits/ioctl.h 1970-01-01 01:00:00.000000000 +0100
  949. +++ musl-git/arch/sh/bits/ioctl.h 2014-03-17 16:49:44.000000000 +0100
  950. @@ -0,0 +1,205 @@
  951. +#define _IOC(a,b,c,d) ( ((a)<<30) | ((b)<<8) | (c) | ((d)<<16) )
  952. +#define _IOC_NONE 0U
  953. +#define _IOC_WRITE 1U
  954. +#define _IOC_READ 2U
  955. +
  956. +#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
  957. +#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
  958. +#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
  959. +#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
  960. +
  961. +#define FIOCLEX _IO('f', 1)
  962. +#define FIONCLEX _IO('f', 2)
  963. +#define FIOASYNC _IOW('f', 125, int)
  964. +#define FIONBIO _IOW('f', 126, int)
  965. +#define FIONREAD _IOR('f', 127, int)
  966. +#define TIOCINQ FIONREAD
  967. +#define FIOQSIZE _IOR('f', 128, char[8])
  968. +
  969. +#define TCGETA _IOR('t', 23, char[18])
  970. +#define TCSETA _IOW('t', 24, char[18])
  971. +#define TCSETAW _IOW('t', 25, char[18])
  972. +#define TCSETAF _IOW('t', 28, char[18])
  973. +
  974. +#define TCSBRK _IO('t', 29)
  975. +#define TCXONC _IO('t', 30)
  976. +#define TCFLSH _IO('t', 31)
  977. +
  978. +#define TIOCSWINSZ _IOW('t', 103, char[8])
  979. +#define TIOCGWINSZ _IOR('t', 104, char[8])
  980. +#define TIOCSTART _IO('t', 110)
  981. +#define TIOCSTOP _IO('t', 111)
  982. +#define TIOCOUTQ _IOR('t', 115, int)
  983. +
  984. +#define TIOCSPGRP _IOW('t', 118, int)
  985. +#define TIOCGPGRP _IOR('t', 119, int)
  986. +
  987. +#define TIOCEXCL _IO('T', 12)
  988. +#define TIOCNXCL _IO('T', 13)
  989. +#define TIOCSCTTY _IO('T', 14)
  990. +
  991. +#define TIOCSTI _IOW('T', 18, char)
  992. +#define TIOCMGET _IOR('T', 21, unsigned int)
  993. +#define TIOCMBIS _IOW('T', 22, unsigned int)
  994. +#define TIOCMBIC _IOW('T', 23, unsigned int)
  995. +#define TIOCMSET _IOW('T', 24, unsigned int)
  996. +#define TIOCM_LE 0x001
  997. +#define TIOCM_DTR 0x002
  998. +#define TIOCM_RTS 0x004
  999. +#define TIOCM_ST 0x008
  1000. +#define TIOCM_SR 0x010
  1001. +#define TIOCM_CTS 0x020
  1002. +#define TIOCM_CAR 0x040
  1003. +#define TIOCM_RNG 0x080
  1004. +#define TIOCM_DSR 0x100
  1005. +#define TIOCM_CD TIOCM_CAR
  1006. +#define TIOCM_RI TIOCM_RNG
  1007. +#define TIOCM_OUT1 0x2000
  1008. +#define TIOCM_OUT2 0x4000
  1009. +#define TIOCM_LOOP 0x8000
  1010. +
  1011. +#define TIOCGSOFTCAR _IOR('T', 25, unsigned int)
  1012. +#define TIOCSSOFTCAR _IOW('T', 26, unsigned int)
  1013. +#define TIOCLINUX _IOW('T', 28, char)
  1014. +#define TIOCCONS _IO('T', 29)
  1015. +#define TIOCGSERIAL _IOR('T', 30, char[60])
  1016. +#define TIOCSSERIAL _IOW('T', 31, char[60])
  1017. +#define TIOCPKT _IOW('T', 32, int)
  1018. +#define TIOCPKT_DATA 0
  1019. +#define TIOCPKT_FLUSHREAD 1
  1020. +#define TIOCPKT_FLUSHWRITE 2
  1021. +#define TIOCPKT_STOP 4
  1022. +#define TIOCPKT_START 8
  1023. +#define TIOCPKT_NOSTOP 16
  1024. +#define TIOCPKT_DOSTOP 32
  1025. +#define TIOCPKT_IOCTL 64
  1026. +
  1027. +#define TIOCNOTTY _IO('T', 34)
  1028. +#define TIOCSETD _IOW('T', 35, int)
  1029. +#define TIOCGETD _IOR('T', 36, int)
  1030. +#define TCSBRKP _IOW('T', 37, int)
  1031. +#define TIOCSBRK _IO('T', 39)
  1032. +#define TIOCCBRK _IO('T', 40)
  1033. +#define TIOCGSID _IOR('T', 41, int)
  1034. +#define TCGETS _IOR('T', 42, char[44])
  1035. +#define TCSETS _IOW('T', 43, char[44])
  1036. +#define TCSETSW _IOW('T', 44, char[44])
  1037. +#define TCSETSF _IOW('T', 45, char[44])
  1038. +#define TIOCGPTN _IOR('T', 48, unsigned int)
  1039. +#define TIOCSPTLCK _IOW('T', 49, int)
  1040. +#define TIOCGDEV _IOR('T', 50, unsigned int)
  1041. +#define TIOCSIG _IOW('T', 54, int)
  1042. +#define TIOCVHANGUP _IO('T', 55)
  1043. +#define TIOCGPKT _IOR('T', 56, int)
  1044. +#define TIOCGPTLCK _IOR('T', 57, int)
  1045. +#define TIOCGEXCL _IOR('T', 64, int)
  1046. +
  1047. +#define TIOCSERCONFIG _IO('T', 83)
  1048. +#define TIOCSERGWILD _IOR('T', 84, int)
  1049. +#define TIOCSERSWILD _IOW('T', 85, int)
  1050. +#define TIOCGLCKTRMIOS _IO('T', 86)
  1051. +#define TIOCSLCKTRMIOS _IO('T', 87)
  1052. +#define TIOCSERGSTRUCT _IOR('T', 88, char[216])
  1053. +#define TIOCSERGETLSR _IOR('T', 89, unsigned int)
  1054. +#define TIOCSER_TEMT 0x01
  1055. +#define TIOCSERGETMULTI _IOR('T', 90, char[168])
  1056. +#define TIOCSERSETMULTI _IOW('T', 91, char[168])
  1057. +
  1058. +#define TIOCMIWAIT _IO('T', 92)
  1059. +#define TIOCGICOUNT _IO('T', 93)
  1060. +
  1061. +struct winsize {
  1062. + unsigned short ws_row;
  1063. + unsigned short ws_col;
  1064. + unsigned short ws_xpixel;
  1065. + unsigned short ws_ypixel;
  1066. +};
  1067. +
  1068. +#define TIOCM_MODEM_BITS TIOCM_OUT2
  1069. +
  1070. +#define N_TTY 0
  1071. +#define N_SLIP 1
  1072. +#define N_MOUSE 2
  1073. +#define N_PPP 3
  1074. +#define N_STRIP 4
  1075. +#define N_AX25 5
  1076. +#define N_X25 6
  1077. +#define N_6PACK 7
  1078. +#define N_MASC 8
  1079. +#define N_R3964 9
  1080. +#define N_PROFIBUS_FDL 10
  1081. +#define N_IRDA 11
  1082. +#define N_SMSBLOCK 12
  1083. +#define N_HDLC 13
  1084. +#define N_SYNC_PPP 14
  1085. +#define N_HCI 15
  1086. +
  1087. +#define FIOGETOWN _IOR('f', 123, int)
  1088. +#define FIOSETOWN _IOW('f', 124, int)
  1089. +
  1090. +#define SIOCATMARK _IOR('s', 7, int)
  1091. +#define SIOCSPGRP _IOW('s', 8, int)
  1092. +#define SIOCGPGRP _IOW('s', 9, int)
  1093. +#define SIOCGSTAMP _IOR('s', 100, char[8])
  1094. +
  1095. +#define SIOCADDRT 0x890B
  1096. +#define SIOCDELRT 0x890C
  1097. +#define SIOCRTMSG 0x890D
  1098. +
  1099. +#define SIOCGIFNAME 0x8910
  1100. +#define SIOCSIFLINK 0x8911
  1101. +#define SIOCGIFCONF 0x8912
  1102. +#define SIOCGIFFLAGS 0x8913
  1103. +#define SIOCSIFFLAGS 0x8914
  1104. +#define SIOCGIFADDR 0x8915
  1105. +#define SIOCSIFADDR 0x8916
  1106. +#define SIOCGIFDSTADDR 0x8917
  1107. +#define SIOCSIFDSTADDR 0x8918
  1108. +#define SIOCGIFBRDADDR 0x8919
  1109. +#define SIOCSIFBRDADDR 0x891a
  1110. +#define SIOCGIFNETMASK 0x891b
  1111. +#define SIOCSIFNETMASK 0x891c
  1112. +#define SIOCGIFMETRIC 0x891d
  1113. +#define SIOCSIFMETRIC 0x891e
  1114. +#define SIOCGIFMEM 0x891f
  1115. +#define SIOCSIFMEM 0x8920
  1116. +#define SIOCGIFMTU 0x8921
  1117. +#define SIOCSIFMTU 0x8922
  1118. +#define SIOCSIFHWADDR 0x8924
  1119. +#define SIOCGIFENCAP 0x8925
  1120. +#define SIOCSIFENCAP 0x8926
  1121. +#define SIOCGIFHWADDR 0x8927
  1122. +#define SIOCGIFSLAVE 0x8929
  1123. +#define SIOCSIFSLAVE 0x8930
  1124. +#define SIOCADDMULTI 0x8931
  1125. +#define SIOCDELMULTI 0x8932
  1126. +#define SIOCGIFINDEX 0x8933
  1127. +#define SIOGIFINDEX SIOCGIFINDEX
  1128. +#define SIOCSIFPFLAGS 0x8934
  1129. +#define SIOCGIFPFLAGS 0x8935
  1130. +#define SIOCDIFADDR 0x8936
  1131. +#define SIOCSIFHWBROADCAST 0x8937
  1132. +#define SIOCGIFCOUNT 0x8938
  1133. +
  1134. +#define SIOCGIFBR 0x8940
  1135. +#define SIOCSIFBR 0x8941
  1136. +
  1137. +#define SIOCGIFTXQLEN 0x8942
  1138. +#define SIOCSIFTXQLEN 0x8943
  1139. +
  1140. +#define SIOCDARP 0x8953
  1141. +#define SIOCGARP 0x8954
  1142. +#define SIOCSARP 0x8955
  1143. +
  1144. +#define SIOCDRARP 0x8960
  1145. +#define SIOCGRARP 0x8961
  1146. +#define SIOCSRARP 0x8962
  1147. +
  1148. +#define SIOCGIFMAP 0x8970
  1149. +#define SIOCSIFMAP 0x8971
  1150. +
  1151. +#define SIOCADDDLCI 0x8980
  1152. +#define SIOCDELDLCI 0x8981
  1153. +
  1154. +#define SIOCDEVPRIVATE 0x89F0
  1155. +#define SIOCPROTOPRIVATE 0x89E0
  1156. diff -Nur musl-0.9.15/arch/sh/bits/ipc.h musl-git/arch/sh/bits/ipc.h
  1157. --- musl-0.9.15/arch/sh/bits/ipc.h 1970-01-01 01:00:00.000000000 +0100
  1158. +++ musl-git/arch/sh/bits/ipc.h 2014-03-17 16:49:44.000000000 +0100
  1159. @@ -0,0 +1,14 @@
  1160. +struct ipc_perm
  1161. +{
  1162. + key_t __ipc_perm_key;
  1163. + uid_t uid;
  1164. + gid_t gid;
  1165. + uid_t cuid;
  1166. + gid_t cgid;
  1167. + mode_t mode;
  1168. + int __ipc_perm_seq;
  1169. + long __pad1;
  1170. + long __pad2;
  1171. +};
  1172. +
  1173. +#define IPC_64 0x100
  1174. diff -Nur musl-0.9.15/arch/sh/bits/limits.h musl-git/arch/sh/bits/limits.h
  1175. --- musl-0.9.15/arch/sh/bits/limits.h 1970-01-01 01:00:00.000000000 +0100
  1176. +++ musl-git/arch/sh/bits/limits.h 2014-03-17 16:49:44.000000000 +0100
  1177. @@ -0,0 +1,8 @@
  1178. +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  1179. + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  1180. +#define PAGE_SIZE 4096
  1181. +#define LONG_BIT 32
  1182. +#endif
  1183. +
  1184. +#define LONG_MAX 0x7fffffffL
  1185. +#define LLONG_MAX 0x7fffffffffffffffLL
  1186. diff -Nur musl-0.9.15/arch/sh/bits/mman.h musl-git/arch/sh/bits/mman.h
  1187. --- musl-0.9.15/arch/sh/bits/mman.h 1970-01-01 01:00:00.000000000 +0100
  1188. +++ musl-git/arch/sh/bits/mman.h 2014-03-17 16:49:44.000000000 +0100
  1189. @@ -0,0 +1,62 @@
  1190. +#define MAP_FAILED ((void *) -1)
  1191. +
  1192. +#define PROT_NONE 0
  1193. +#define PROT_READ 1
  1194. +#define PROT_WRITE 2
  1195. +#define PROT_EXEC 4
  1196. +#define PROT_GROWSDOWN 0x01000000
  1197. +#define PROT_GROWSUP 0x02000000
  1198. +
  1199. +#define MAP_SHARED 0x01
  1200. +#define MAP_PRIVATE 0x02
  1201. +#define MAP_FIXED 0x10
  1202. +
  1203. +#define MAP_TYPE 0x0f
  1204. +#define MAP_FILE 0x00
  1205. +#define MAP_ANON 0x20
  1206. +#define MAP_ANONYMOUS MAP_ANON
  1207. +#define MAP_32BIT 0x40
  1208. +#define MAP_NORESERVE 0x4000
  1209. +#define MAP_GROWSDOWN 0x0100
  1210. +#define MAP_DENYWRITE 0x0800
  1211. +#define MAP_EXECUTABLE 0x1000
  1212. +#define MAP_LOCKED 0x2000
  1213. +#define MAP_POPULATE 0x8000
  1214. +#define MAP_NONBLOCK 0x10000
  1215. +#define MAP_STACK 0x20000
  1216. +#define MAP_HUGETLB 0x40000
  1217. +
  1218. +#define POSIX_MADV_NORMAL 0
  1219. +#define POSIX_MADV_RANDOM 1
  1220. +#define POSIX_MADV_SEQUENTIAL 2
  1221. +#define POSIX_MADV_WILLNEED 3
  1222. +#define POSIX_MADV_DONTNEED 4
  1223. +
  1224. +#define MS_ASYNC 1
  1225. +#define MS_INVALIDATE 2
  1226. +#define MS_SYNC 4
  1227. +
  1228. +#define MCL_CURRENT 1
  1229. +#define MCL_FUTURE 2
  1230. +
  1231. +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  1232. +#define MADV_NORMAL 0
  1233. +#define MADV_RANDOM 1
  1234. +#define MADV_SEQUENTIAL 2
  1235. +#define MADV_WILLNEED 3
  1236. +#define MADV_DONTNEED 4
  1237. +#define MADV_REMOVE 9
  1238. +#define MADV_DONTFORK 10
  1239. +#define MADV_DOFORK 11
  1240. +#define MADV_MERGEABLE 12
  1241. +#define MADV_UNMERGEABLE 13
  1242. +#define MADV_HUGEPAGE 14
  1243. +#define MADV_NOHUGEPAGE 15
  1244. +#define MADV_DONTDUMP 16
  1245. +#define MADV_DODUMP 17
  1246. +#define MADV_HWPOISON 100
  1247. +#define MADV_SOFT_OFFLINE 101
  1248. +
  1249. +#define MREMAP_MAYMOVE 1
  1250. +#define MREMAP_FIXED 2
  1251. +#endif
  1252. diff -Nur musl-0.9.15/arch/sh/bits/msg.h musl-git/arch/sh/bits/msg.h
  1253. --- musl-0.9.15/arch/sh/bits/msg.h 1970-01-01 01:00:00.000000000 +0100
  1254. +++ musl-git/arch/sh/bits/msg.h 2014-03-17 16:49:44.000000000 +0100
  1255. @@ -0,0 +1,16 @@
  1256. +struct msqid_ds
  1257. +{
  1258. + struct ipc_perm msg_perm;
  1259. + time_t msg_stime;
  1260. + int __unused1;
  1261. + time_t msg_rtime;
  1262. + int __unused2;
  1263. + time_t msg_ctime;
  1264. + int __unused3;
  1265. + unsigned long msg_cbytes;
  1266. + msgqnum_t msg_qnum;
  1267. + msglen_t msg_qbytes;
  1268. + pid_t msg_lspid;
  1269. + pid_t msg_lrpid;
  1270. + unsigned long __unused[2];
  1271. +};
  1272. diff -Nur musl-0.9.15/arch/sh/bits/posix.h musl-git/arch/sh/bits/posix.h
  1273. --- musl-0.9.15/arch/sh/bits/posix.h 1970-01-01 01:00:00.000000000 +0100
  1274. +++ musl-git/arch/sh/bits/posix.h 2014-03-17 16:49:44.000000000 +0100
  1275. @@ -0,0 +1,2 @@
  1276. +#define _POSIX_V6_ILP32_OFFBIG 1
  1277. +#define _POSIX_V7_ILP32_OFFBIG 1
  1278. diff -Nur musl-0.9.15/arch/sh/bits/sem.h musl-git/arch/sh/bits/sem.h
  1279. --- musl-0.9.15/arch/sh/bits/sem.h 1970-01-01 01:00:00.000000000 +0100
  1280. +++ musl-git/arch/sh/bits/sem.h 2014-03-17 16:49:44.000000000 +0100
  1281. @@ -0,0 +1,16 @@
  1282. +struct semid_ds {
  1283. + struct ipc_perm sem_perm;
  1284. + time_t sem_otime;
  1285. + time_t __unused1;
  1286. + time_t sem_ctime;
  1287. + time_t __unused2;
  1288. +#if __BYTE_ORDER == __LITTLE_ENDIAN
  1289. + unsigned short sem_nsems;
  1290. + char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
  1291. +#else
  1292. + char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
  1293. + unsigned short sem_nsems;
  1294. +#endif
  1295. + time_t __unused3;
  1296. + time_t __unused4;
  1297. +};
  1298. diff -Nur musl-0.9.15/arch/sh/bits/setjmp.h musl-git/arch/sh/bits/setjmp.h
  1299. --- musl-0.9.15/arch/sh/bits/setjmp.h 1970-01-01 01:00:00.000000000 +0100
  1300. +++ musl-git/arch/sh/bits/setjmp.h 2014-03-17 16:49:44.000000000 +0100
  1301. @@ -0,0 +1 @@
  1302. +typedef unsigned long __jmp_buf[13];
  1303. diff -Nur musl-0.9.15/arch/sh/bits/shm.h musl-git/arch/sh/bits/shm.h
  1304. --- musl-0.9.15/arch/sh/bits/shm.h 1970-01-01 01:00:00.000000000 +0100
  1305. +++ musl-git/arch/sh/bits/shm.h 2014-03-17 16:49:44.000000000 +0100
  1306. @@ -0,0 +1,28 @@
  1307. +#define SHMLBA 16384
  1308. +
  1309. +struct shmid_ds
  1310. +{
  1311. + struct ipc_perm shm_perm;
  1312. + size_t shm_segsz;
  1313. + time_t shm_atime;
  1314. + int __unused1;
  1315. + time_t shm_dtime;
  1316. + int __unused2;
  1317. + time_t shm_ctime;
  1318. + int __unused3;
  1319. + pid_t shm_cpid;
  1320. + pid_t shm_lpid;
  1321. + unsigned long shm_nattch;
  1322. + unsigned long __pad1;
  1323. + unsigned long __pad2;
  1324. +};
  1325. +
  1326. +struct shminfo {
  1327. + unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
  1328. +};
  1329. +
  1330. +struct shm_info {
  1331. + int __used_ids;
  1332. + unsigned long shm_tot, shm_rss, shm_swp;
  1333. + unsigned long __swap_attempts, __swap_successes;
  1334. +};
  1335. diff -Nur musl-0.9.15/arch/sh/bits/signal.h musl-git/arch/sh/bits/signal.h
  1336. --- musl-0.9.15/arch/sh/bits/signal.h 1970-01-01 01:00:00.000000000 +0100
  1337. +++ musl-git/arch/sh/bits/signal.h 2014-03-17 16:49:44.000000000 +0100
  1338. @@ -0,0 +1,76 @@
  1339. +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  1340. + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  1341. +
  1342. +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  1343. +typedef int greg_t, gregset_t[16];
  1344. +typedef int freg_t, fpregset_t[16];
  1345. +typedef struct sigcontext {
  1346. + unsigned long oldmask;
  1347. + unsigned long sc_regs[16];
  1348. + unsigned long sc_pc, sc_pr, sc_sr;
  1349. + unsigned long sc_gbr, sc_mach, sc_macl;
  1350. + unsigned long sc_fpregs[16];
  1351. + unsigned long sc_xfpregs[16];
  1352. + unsigned int sc_fpscr, sc_fpul, sc_ownedfp;
  1353. +} mcontext_t;
  1354. +#else
  1355. +typedef struct {
  1356. + unsigned long __regs[58];
  1357. +} mcontext_t;
  1358. +#endif
  1359. +
  1360. +typedef struct __ucontext {
  1361. + unsigned long uc_flags;
  1362. + struct __ucontext *uc_link;
  1363. + stack_t uc_stack;
  1364. + mcontext_t uc_mcontext;
  1365. + sigset_t uc_sigmask;
  1366. +} ucontext_t;
  1367. +
  1368. +#define SA_NOCLDSTOP 1
  1369. +#define SA_NOCLDWAIT 2
  1370. +#define SA_SIGINFO 4
  1371. +#define SA_ONSTACK 0x08000000
  1372. +#define SA_RESTART 0x10000000
  1373. +#define SA_NODEFER 0x40000000
  1374. +#define SA_RESETHAND 0x80000000
  1375. +#define SA_RESTORER 0x04000000
  1376. +
  1377. +#endif
  1378. +
  1379. +#define SIGHUP 1
  1380. +#define SIGINT 2
  1381. +#define SIGQUIT 3
  1382. +#define SIGILL 4
  1383. +#define SIGTRAP 5
  1384. +#define SIGABRT 6
  1385. +#define SIGIOT SIGABRT
  1386. +#define SIGBUS 7
  1387. +#define SIGFPE 8
  1388. +#define SIGKILL 9
  1389. +#define SIGUSR1 10
  1390. +#define SIGSEGV 11
  1391. +#define SIGUSR2 12
  1392. +#define SIGPIPE 13
  1393. +#define SIGALRM 14
  1394. +#define SIGTERM 15
  1395. +#define SIGSTKFLT 16
  1396. +#define SIGCHLD 17
  1397. +#define SIGCONT 18
  1398. +#define SIGSTOP 19
  1399. +#define SIGTSTP 20
  1400. +#define SIGTTIN 21
  1401. +#define SIGTTOU 22
  1402. +#define SIGURG 23
  1403. +#define SIGXCPU 24
  1404. +#define SIGXFSZ 25
  1405. +#define SIGVTALRM 26
  1406. +#define SIGPROF 27
  1407. +#define SIGWINCH 28
  1408. +#define SIGIO 29
  1409. +#define SIGPOLL 29
  1410. +#define SIGPWR 30
  1411. +#define SIGSYS 31
  1412. +#define SIGUNUSED SIGSYS
  1413. +
  1414. +#define _NSIG 65
  1415. diff -Nur musl-0.9.15/arch/sh/bits/socket.h musl-git/arch/sh/bits/socket.h
  1416. --- musl-0.9.15/arch/sh/bits/socket.h 1970-01-01 01:00:00.000000000 +0100
  1417. +++ musl-git/arch/sh/bits/socket.h 2014-03-17 16:49:44.000000000 +0100
  1418. @@ -0,0 +1,17 @@
  1419. +struct msghdr
  1420. +{
  1421. + void *msg_name;
  1422. + socklen_t msg_namelen;
  1423. + struct iovec *msg_iov;
  1424. + int msg_iovlen;
  1425. + void *msg_control;
  1426. + socklen_t msg_controllen;
  1427. + int msg_flags;
  1428. +};
  1429. +
  1430. +struct cmsghdr
  1431. +{
  1432. + socklen_t cmsg_len;
  1433. + int cmsg_level;
  1434. + int cmsg_type;
  1435. +};
  1436. diff -Nur musl-0.9.15/arch/sh/bits/statfs.h musl-git/arch/sh/bits/statfs.h
  1437. --- musl-0.9.15/arch/sh/bits/statfs.h 1970-01-01 01:00:00.000000000 +0100
  1438. +++ musl-git/arch/sh/bits/statfs.h 2014-03-17 16:49:44.000000000 +0100
  1439. @@ -0,0 +1,7 @@
  1440. +struct statfs {
  1441. + unsigned long f_type, f_bsize;
  1442. + fsblkcnt_t f_blocks, f_bfree, f_bavail;
  1443. + fsfilcnt_t f_files, f_ffree;
  1444. + fsid_t f_fsid;
  1445. + unsigned long f_namelen, f_frsize, f_flags, f_spare[4];
  1446. +};
  1447. diff -Nur musl-0.9.15/arch/sh/bits/stat.h musl-git/arch/sh/bits/stat.h
  1448. --- musl-0.9.15/arch/sh/bits/stat.h 1970-01-01 01:00:00.000000000 +0100
  1449. +++ musl-git/arch/sh/bits/stat.h 2014-03-17 16:49:44.000000000 +0100
  1450. @@ -0,0 +1,22 @@
  1451. +/* copied from kernel definition, but with padding replaced
  1452. + * by the corresponding correctly-sized userspace types. */
  1453. +
  1454. +struct stat
  1455. +{
  1456. + dev_t st_dev;
  1457. + int __st_dev_padding;
  1458. + long __st_ino_truncated;
  1459. + mode_t st_mode;
  1460. + nlink_t st_nlink;
  1461. + uid_t st_uid;
  1462. + gid_t st_gid;
  1463. + dev_t st_rdev;
  1464. + int __st_rdev_padding;
  1465. + off_t st_size;
  1466. + blksize_t st_blksize;
  1467. + blkcnt_t st_blocks;
  1468. + struct timespec st_atim;
  1469. + struct timespec st_mtim;
  1470. + struct timespec st_ctim;
  1471. + ino_t st_ino;
  1472. +};
  1473. diff -Nur musl-0.9.15/arch/sh/bits/stdarg.h musl-git/arch/sh/bits/stdarg.h
  1474. --- musl-0.9.15/arch/sh/bits/stdarg.h 1970-01-01 01:00:00.000000000 +0100
  1475. +++ musl-git/arch/sh/bits/stdarg.h 2014-03-17 16:49:44.000000000 +0100
  1476. @@ -0,0 +1,4 @@
  1477. +#define va_start(v,l) __builtin_va_start(v,l)
  1478. +#define va_end(v) __builtin_va_end(v)
  1479. +#define va_arg(v,l) __builtin_va_arg(v,l)
  1480. +#define va_copy(d,s) __builtin_va_copy(d,s)
  1481. diff -Nur musl-0.9.15/arch/sh/bits/stdint.h musl-git/arch/sh/bits/stdint.h
  1482. --- musl-0.9.15/arch/sh/bits/stdint.h 1970-01-01 01:00:00.000000000 +0100
  1483. +++ musl-git/arch/sh/bits/stdint.h 2014-03-17 16:49:44.000000000 +0100
  1484. @@ -0,0 +1,20 @@
  1485. +typedef int32_t int_fast16_t;
  1486. +typedef int32_t int_fast32_t;
  1487. +typedef uint32_t uint_fast16_t;
  1488. +typedef uint32_t uint_fast32_t;
  1489. +
  1490. +#define INT_FAST16_MIN INT32_MIN
  1491. +#define INT_FAST32_MIN INT32_MIN
  1492. +
  1493. +#define INT_FAST16_MAX INT32_MAX
  1494. +#define INT_FAST32_MAX INT32_MAX
  1495. +
  1496. +#define UINT_FAST16_MAX UINT32_MAX
  1497. +#define UINT_FAST32_MAX UINT32_MAX
  1498. +
  1499. +#define INTPTR_MIN INT32_MIN
  1500. +#define INTPTR_MAX INT32_MAX
  1501. +#define UINTPTR_MAX UINT32_MAX
  1502. +#define PTRDIFF_MIN INT32_MIN
  1503. +#define PTRDIFF_MAX INT32_MAX
  1504. +#define SIZE_MAX UINT32_MAX
  1505. diff -Nur musl-0.9.15/arch/sh/bits/syscall.h musl-git/arch/sh/bits/syscall.h
  1506. --- musl-0.9.15/arch/sh/bits/syscall.h 1970-01-01 01:00:00.000000000 +0100
  1507. +++ musl-git/arch/sh/bits/syscall.h 2014-03-17 16:49:44.000000000 +0100
  1508. @@ -0,0 +1,684 @@
  1509. +#define __NR_restart_syscall 0
  1510. +#define __NR_exit 1
  1511. +#define __NR_fork 2
  1512. +#define __NR_read 3
  1513. +#define __NR_write 4
  1514. +#define __NR_open 5
  1515. +#define __NR_close 6
  1516. +#define __NR_waitpid 7
  1517. +#define __NR_creat 8
  1518. +#define __NR_link 9
  1519. +#define __NR_unlink 10
  1520. +#define __NR_execve 11
  1521. +#define __NR_chdir 12
  1522. +#define __NR_time 13
  1523. +#define __NR_mknod 14
  1524. +#define __NR_chmod 15
  1525. +#define __NR_lchown 16
  1526. +#define __NR_oldstat 18
  1527. +#define __NR_lseek 19
  1528. +#define __NR_getpid 20
  1529. +#define __NR_mount 21
  1530. +#define __NR_umount 22
  1531. +#define __NR_setuid 23
  1532. +#define __NR_getuid 24
  1533. +#define __NR_stime 25
  1534. +#define __NR_ptrace 26
  1535. +#define __NR_alarm 27
  1536. +#define __NR_oldfstat 28
  1537. +#define __NR_pause 29
  1538. +#define __NR_utime 30
  1539. +#define __NR_access 33
  1540. +#define __NR_nice 34
  1541. +#define __NR_sync 36
  1542. +#define __NR_kill 37
  1543. +#define __NR_rename 38
  1544. +#define __NR_mkdir 39
  1545. +#define __NR_rmdir 40
  1546. +#define __NR_dup 41
  1547. +#define __NR_pipe 42
  1548. +#define __NR_times 43
  1549. +#define __NR_brk 45
  1550. +#define __NR_setgid 46
  1551. +#define __NR_getgid 47
  1552. +#define __NR_signal 48
  1553. +#define __NR_geteuid 49
  1554. +#define __NR_getegid 50
  1555. +#define __NR_acct 51
  1556. +#define __NR_umount2 52
  1557. +#define __NR_ioctl 54
  1558. +#define __NR_fcntl 55
  1559. +#define __NR_setpgid 57
  1560. +#define __NR_umask 60
  1561. +#define __NR_chroot 61
  1562. +#define __NR_ustat 62
  1563. +#define __NR_dup2 63
  1564. +#define __NR_getppid 64
  1565. +#define __NR_getpgrp 65
  1566. +#define __NR_setsid 66
  1567. +#define __NR_sigaction 67
  1568. +#define __NR_sgetmask 68
  1569. +#define __NR_ssetmask 69
  1570. +#define __NR_setreuid 70
  1571. +#define __NR_setregid 71
  1572. +#define __NR_sigsuspend 72
  1573. +#define __NR_sigpending 73
  1574. +#define __NR_sethostname 74
  1575. +#define __NR_setrlimit 75
  1576. +#define __NR_getrlimit 76
  1577. +#define __NR_getrusage 77
  1578. +#define __NR_gettimeofday 78
  1579. +#define __NR_settimeofday 79
  1580. +#define __NR_getgroups 80
  1581. +#define __NR_setgroups 81
  1582. +#define __NR_symlink 83
  1583. +#define __NR_oldlstat 84
  1584. +#define __NR_readlink 85
  1585. +#define __NR_uselib 86
  1586. +#define __NR_swapon 87
  1587. +#define __NR_reboot 88
  1588. +#define __NR_readdir 89
  1589. +#define __NR_mmap 90
  1590. +#define __NR_munmap 91
  1591. +#define __NR_truncate 92
  1592. +#define __NR_ftruncate 93
  1593. +#define __NR_fchmod 94
  1594. +#define __NR_fchown 95
  1595. +#define __NR_getpriority 96
  1596. +#define __NR_setpriority 97
  1597. +#define __NR_statfs 99
  1598. +#define __NR_fstatfs 100
  1599. +#define __NR_socketcall 102
  1600. +#define __NR_syslog 103
  1601. +#define __NR_setitimer 104
  1602. +#define __NR_getitimer 105
  1603. +#define __NR_stat 106
  1604. +#define __NR_lstat 107
  1605. +#define __NR_fstat 108
  1606. +#define __NR_olduname 109
  1607. +#define __NR_vhangup 111
  1608. +#define __NR_wait4 114
  1609. +#define __NR_swapoff 115
  1610. +#define __NR_sysinfo 116
  1611. +#define __NR_ipc 117
  1612. +#define __NR_fsync 118
  1613. +#define __NR_sigreturn 119
  1614. +#define __NR_clone 120
  1615. +#define __NR_setdomainname 121
  1616. +#define __NR_uname 122
  1617. +#define __NR_cacheflush 123
  1618. +#define __NR_adjtimex 124
  1619. +#define __NR_mprotect 125
  1620. +#define __NR_sigprocmask 126
  1621. +#define __NR_init_module 128
  1622. +#define __NR_delete_module 129
  1623. +#define __NR_quotactl 131
  1624. +#define __NR_getpgid 132
  1625. +#define __NR_fchdir 133
  1626. +#define __NR_bdflush 134
  1627. +#define __NR_sysfs 135
  1628. +#define __NR_personality 136
  1629. +#define __NR_setfsuid 138
  1630. +#define __NR_setfsgid 139
  1631. +#define __NR__llseek 140
  1632. +#define __NR_getdents 141
  1633. +#define __NR__newselect 142
  1634. +#define __NR_flock 143
  1635. +#define __NR_msync 144
  1636. +#define __NR_readv 145
  1637. +#define __NR_writev 146
  1638. +#define __NR_getsid 147
  1639. +#define __NR_fdatasync 148
  1640. +#define __NR__sysctl 149
  1641. +#define __NR_mlock 150
  1642. +#define __NR_munlock 151
  1643. +#define __NR_mlockall 152
  1644. +#define __NR_munlockall 153
  1645. +#define __NR_sched_setparam 154
  1646. +#define __NR_sched_getparam 155
  1647. +#define __NR_sched_setscheduler 156
  1648. +#define __NR_sched_getscheduler 157
  1649. +#define __NR_sched_yield 158
  1650. +#define __NR_sched_get_priority_max 159
  1651. +#define __NR_sched_get_priority_min 160
  1652. +#define __NR_sched_rr_get_interval 161
  1653. +#define __NR_nanosleep 162
  1654. +#define __NR_mremap 163
  1655. +#define __NR_setresuid 164
  1656. +#define __NR_getresuid 165
  1657. +#define __NR_poll 168
  1658. +#define __NR_nfsservctl 169
  1659. +#define __NR_setresgid 170
  1660. +#define __NR_getresgid 171
  1661. +#define __NR_prctl 172
  1662. +#define __NR_rt_sigreturn 173
  1663. +#define __NR_rt_sigaction 174
  1664. +#define __NR_rt_sigprocmask 175
  1665. +#define __NR_rt_sigpending 176
  1666. +#define __NR_rt_sigtimedwait 177
  1667. +#define __NR_rt_sigqueueinfo 178
  1668. +#define __NR_rt_sigsuspend 179
  1669. +#define __NR_pread64 180
  1670. +#define __NR_pwrite64 181
  1671. +#define __NR_chown 182
  1672. +#define __NR_getcwd 183
  1673. +#define __NR_capget 184
  1674. +#define __NR_capset 185
  1675. +#define __NR_sigaltstack 186
  1676. +#define __NR_sendfile 187
  1677. +#define __NR_vfork 190
  1678. +#define __NR_ugetrlimit 191
  1679. +#define __NR_mmap2 192
  1680. +#define __NR_truncate64 193
  1681. +#define __NR_ftruncate64 194
  1682. +#define __NR_stat64 195
  1683. +#define __NR_lstat64 196
  1684. +#define __NR_fstat64 197
  1685. +#define __NR_lchown32 198
  1686. +#define __NR_getuid32 199
  1687. +#define __NR_getgid32 200
  1688. +#define __NR_geteuid32 201
  1689. +#define __NR_getegid32 202
  1690. +#define __NR_setreuid32 203
  1691. +#define __NR_setregid32 204
  1692. +#define __NR_getgroups32 205
  1693. +#define __NR_setgroups32 206
  1694. +#define __NR_fchown32 207
  1695. +#define __NR_setresuid32 208
  1696. +#define __NR_getresuid32 209
  1697. +#define __NR_setresgid32 210
  1698. +#define __NR_getresgid32 211
  1699. +#define __NR_chown32 212
  1700. +#define __NR_setuid32 213
  1701. +#define __NR_setgid32 214
  1702. +#define __NR_setfsuid32 215
  1703. +#define __NR_setfsgid32 216
  1704. +#define __NR_pivot_root 217
  1705. +#define __NR_mincore 218
  1706. +#define __NR_madvise 219
  1707. +#define __NR_getdents64 220
  1708. +#define __NR_fcntl64 221
  1709. +#define __NR_gettid 224
  1710. +#define __NR_readahead 225
  1711. +#define __NR_setxattr 226
  1712. +#define __NR_lsetxattr 227
  1713. +#define __NR_fsetxattr 228
  1714. +#define __NR_getxattr 229
  1715. +#define __NR_lgetxattr 230
  1716. +#define __NR_fgetxattr 231
  1717. +#define __NR_listxattr 232
  1718. +#define __NR_llistxattr 233
  1719. +#define __NR_flistxattr 234
  1720. +#define __NR_removexattr 235
  1721. +#define __NR_lremovexattr 236
  1722. +#define __NR_fremovexattr 237
  1723. +#define __NR_tkill 238
  1724. +#define __NR_sendfile64 239
  1725. +#define __NR_futex 240
  1726. +#define __NR_sched_setaffinity 241
  1727. +#define __NR_sched_getaffinity 242
  1728. +#define __NR_io_setup 245
  1729. +#define __NR_io_destroy 246
  1730. +#define __NR_io_getevents 247
  1731. +#define __NR_io_submit 248
  1732. +#define __NR_io_cancel 249
  1733. +#define __NR_fadvise64 250
  1734. +#define __NR_exit_group 252
  1735. +#define __NR_lookup_dcookie 253
  1736. +#define __NR_epoll_create 254
  1737. +#define __NR_epoll_ctl 255
  1738. +#define __NR_epoll_wait 256
  1739. +#define __NR_remap_file_pages 257
  1740. +#define __NR_set_tid_address 258
  1741. +#define __NR_timer_create 259
  1742. +#define __NR_timer_settime 260
  1743. +#define __NR_timer_gettime 261
  1744. +#define __NR_timer_getoverrun 262
  1745. +#define __NR_timer_delete 263
  1746. +#define __NR_clock_settime 264
  1747. +#define __NR_clock_gettime 265
  1748. +#define __NR_clock_getres 266
  1749. +#define __NR_clock_nanosleep 267
  1750. +#define __NR_statfs64 268
  1751. +#define __NR_fstatfs64 269
  1752. +#define __NR_tgkill 270
  1753. +#define __NR_utimes 271
  1754. +#define __NR_fadvise64_64 272
  1755. +#define __NR_mbind 274
  1756. +#define __NR_get_mempolicy 275
  1757. +#define __NR_set_mempolicy 276
  1758. +#define __NR_mq_open 277
  1759. +#define __NR_mq_unlink 278
  1760. +#define __NR_mq_timedsend 279
  1761. +#define __NR_mq_timedreceive 280
  1762. +#define __NR_mq_notify 281
  1763. +#define __NR_mq_getsetattr 282
  1764. +#define __NR_kexec_load 283
  1765. +#define __NR_waitid 284
  1766. +#define __NR_add_key 285
  1767. +#define __NR_request_key 286
  1768. +#define __NR_keyctl 287
  1769. +#define __NR_ioprio_set 288
  1770. +#define __NR_ioprio_get 289
  1771. +#define __NR_inotify_init 290
  1772. +#define __NR_inotify_add_watch 291
  1773. +#define __NR_inotify_rm_watch 292
  1774. +#define __NR_migrate_pages 294
  1775. +#define __NR_openat 295
  1776. +#define __NR_mkdirat 296
  1777. +#define __NR_mknodat 297
  1778. +#define __NR_fchownat 298
  1779. +#define __NR_futimesat 299
  1780. +#define __NR_fstatat64 300
  1781. +#define __NR_unlinkat 301
  1782. +#define __NR_renameat 302
  1783. +#define __NR_linkat 303
  1784. +#define __NR_symlinkat 304
  1785. +#define __NR_readlinkat 305
  1786. +#define __NR_fchmodat 306
  1787. +#define __NR_faccessat 307
  1788. +#define __NR_pselect6 308
  1789. +#define __NR_ppoll 309
  1790. +#define __NR_unshare 310
  1791. +#define __NR_set_robust_list 311
  1792. +#define __NR_get_robust_list 312
  1793. +#define __NR_splice 313
  1794. +#define __NR_sync_file_range 314
  1795. +#define __NR_tee 315
  1796. +#define __NR_vmsplice 316
  1797. +#define __NR_move_pages 317
  1798. +#define __NR_getcpu 318
  1799. +#define __NR_epoll_pwait 319
  1800. +#define __NR_utimensat 320
  1801. +#define __NR_signalfd 321
  1802. +#define __NR_timerfd_create 322
  1803. +#define __NR_eventfd 323
  1804. +#define __NR_fallocate 324
  1805. +#define __NR_timerfd_settime 325
  1806. +#define __NR_timerfd_gettime 326
  1807. +#define __NR_signalfd4 327
  1808. +#define __NR_eventfd2 328
  1809. +#define __NR_epoll_create1 329
  1810. +#define __NR_dup3 330
  1811. +#define __NR_pipe2 331
  1812. +#define __NR_inotify_init1 332
  1813. +#define __NR_preadv 333
  1814. +#define __NR_pwritev 334
  1815. +#define __NR_rt_tgsigqueueinfo 335
  1816. +#define __NR_perf_event_open 336
  1817. +#define __NR_fanotify_init 337
  1818. +#define __NR_fanotify_mark 338
  1819. +#define __NR_prlimit64 339
  1820. +#define __NR_socket 340
  1821. +#define __NR_bind 341
  1822. +#define __NR_connect 342
  1823. +#define __NR_listen 343
  1824. +#define __NR_accept 344
  1825. +#define __NR_getsockname 345
  1826. +#define __NR_getpeername 346
  1827. +#define __NR_socketpair 347
  1828. +#define __NR_send 348
  1829. +#define __NR_sendto 349
  1830. +#define __NR_recv 350
  1831. +#define __NR_recvfrom 351
  1832. +#define __NR_shutdown 352
  1833. +#define __NR_setsockopt 353
  1834. +#define __NR_getsockopt 354
  1835. +#define __NR_sendmsg 355
  1836. +#define __NR_recvmsg 356
  1837. +#define __NR_recvmmsg 357
  1838. +#define __NR_accept4 358
  1839. +#define __NR_name_to_handle_at 359
  1840. +#define __NR_open_by_handle_at 360
  1841. +#define __NR_clock_adjtime 361
  1842. +#define __NR_syncfs 362
  1843. +#define __NR_sendmmsg 363
  1844. +#define __NR_setns 364
  1845. +#define __NR_process_vm_readv 365
  1846. +#define __NR_process_vm_writev 366
  1847. +#define __NR_kcmp 367
  1848. +#define __NR_finit_module 368
  1849. +
  1850. +
  1851. +/* Repeated with SYS_ prefix */
  1852. +
  1853. +#define SYS_restart_syscall 0
  1854. +#define SYS_exit 1
  1855. +#define SYS_fork 2
  1856. +#define SYS_read 3
  1857. +#define SYS_write 4
  1858. +#define SYS_open 5
  1859. +#define SYS_close 6
  1860. +#define SYS_waitpid 7
  1861. +#define SYS_creat 8
  1862. +#define SYS_link 9
  1863. +#define SYS_unlink 10
  1864. +#define SYS_execve 11
  1865. +#define SYS_chdir 12
  1866. +#define SYS_time 13
  1867. +#define SYS_mknod 14
  1868. +#define SYS_chmod 15
  1869. +#define SYS_lchown 16
  1870. +#define SYS_oldstat 18
  1871. +#define SYS_lseek 19
  1872. +#define SYS_getpid 20
  1873. +#define SYS_mount 21
  1874. +#define SYS_umount 22
  1875. +#define SYS_setuid 23
  1876. +#define SYS_getuid 24
  1877. +#define SYS_stime 25
  1878. +#define SYS_ptrace 26
  1879. +#define SYS_alarm 27
  1880. +#define SYS_oldfstat 28
  1881. +#define SYS_pause 29
  1882. +#define SYS_utime 30
  1883. +#define SYS_access 33
  1884. +#define SYS_nice 34
  1885. +#define SYS_sync 36
  1886. +#define SYS_kill 37
  1887. +#define SYS_rename 38
  1888. +#define SYS_mkdir 39
  1889. +#define SYS_rmdir 40
  1890. +#define SYS_dup 41
  1891. +#define SYS_pipe 42
  1892. +#define SYS_times 43
  1893. +#define SYS_brk 45
  1894. +#define SYS_setgid 46
  1895. +#define SYS_getgid 47
  1896. +#define SYS_signal 48
  1897. +#define SYS_geteuid 49
  1898. +#define SYS_getegid 50
  1899. +#define SYS_acct 51
  1900. +#define SYS_umount2 52
  1901. +#define SYS_ioctl 54
  1902. +#define SYS_fcntl 55
  1903. +#define SYS_setpgid 57
  1904. +#define SYS_umask 60
  1905. +#define SYS_chroot 61
  1906. +#define SYS_ustat 62
  1907. +#define SYS_dup2 63
  1908. +#define SYS_getppid 64
  1909. +#define SYS_getpgrp 65
  1910. +#define SYS_setsid 66
  1911. +#define SYS_sigaction 67
  1912. +#define SYS_sgetmask 68
  1913. +#define SYS_ssetmask 69
  1914. +#define SYS_setreuid 70
  1915. +#define SYS_setregid 71
  1916. +#define SYS_sigsuspend 72
  1917. +#define SYS_sigpending 73
  1918. +#define SYS_sethostname 74
  1919. +#define SYS_setrlimit 75
  1920. +#define SYS_getrlimit 76
  1921. +#define SYS_getrusage 77
  1922. +#define SYS_gettimeofday 78
  1923. +#define SYS_settimeofday 79
  1924. +#define SYS_getgroups 80
  1925. +#define SYS_setgroups 81
  1926. +#define SYS_symlink 83
  1927. +#define SYS_oldlstat 84
  1928. +#define SYS_readlink 85
  1929. +#define SYS_uselib 86
  1930. +#define SYS_swapon 87
  1931. +#define SYS_reboot 88
  1932. +#define SYS_readdir 89
  1933. +#define SYS_mmap 90
  1934. +#define SYS_munmap 91
  1935. +#define SYS_truncate 92
  1936. +#define SYS_ftruncate 93
  1937. +#define SYS_fchmod 94
  1938. +#define SYS_fchown 95
  1939. +#define SYS_getpriority 96
  1940. +#define SYS_setpriority 97
  1941. +#define SYS_statfs 99
  1942. +#define SYS_fstatfs 100
  1943. +#define SYS_socketcall 102
  1944. +#define SYS_syslog 103
  1945. +#define SYS_setitimer 104
  1946. +#define SYS_getitimer 105
  1947. +#define SYS_stat 106
  1948. +#define SYS_lstat 107
  1949. +#define SYS_fstat 108
  1950. +#define SYS_olduname 109
  1951. +#define SYS_vhangup 111
  1952. +#define SYS_wait4 114
  1953. +#define SYS_swapoff 115
  1954. +#define SYS_sysinfo 116
  1955. +#define SYS_ipc 117
  1956. +#define SYS_fsync 118
  1957. +#define SYS_sigreturn 119
  1958. +#define SYS_clone 120
  1959. +#define SYS_setdomainname 121
  1960. +#define SYS_uname 122
  1961. +#define SYS_cacheflush 123
  1962. +#define SYS_adjtimex 124
  1963. +#define SYS_mprotect 125
  1964. +#define SYS_sigprocmask 126
  1965. +#define SYS_init_module 128
  1966. +#define SYS_delete_module 129
  1967. +#define SYS_quotactl 131
  1968. +#define SYS_getpgid 132
  1969. +#define SYS_fchdir 133
  1970. +#define SYS_bdflush 134
  1971. +#define SYS_sysfs 135
  1972. +#define SYS_personality 136
  1973. +#define SYS_setfsuid 138
  1974. +#define SYS_setfsgid 139
  1975. +#define SYS__llseek 140
  1976. +#define SYS_getdents 141
  1977. +#define SYS__newselect 142
  1978. +#define SYS_flock 143
  1979. +#define SYS_msync 144
  1980. +#define SYS_readv 145
  1981. +#define SYS_writev 146
  1982. +#define SYS_getsid 147
  1983. +#define SYS_fdatasync 148
  1984. +#define SYS__sysctl 149
  1985. +#define SYS_mlock 150
  1986. +#define SYS_munlock 151
  1987. +#define SYS_mlockall 152
  1988. +#define SYS_munlockall 153
  1989. +#define SYS_sched_setparam 154
  1990. +#define SYS_sched_getparam 155
  1991. +#define SYS_sched_setscheduler 156
  1992. +#define SYS_sched_getscheduler 157
  1993. +#define SYS_sched_yield 158
  1994. +#define SYS_sched_get_priority_max 159
  1995. +#define SYS_sched_get_priority_min 160
  1996. +#define SYS_sched_rr_get_interval 161
  1997. +#define SYS_nanosleep 162
  1998. +#define SYS_mremap 163
  1999. +#define SYS_setresuid 164
  2000. +#define SYS_getresuid 165
  2001. +#define SYS_poll 168
  2002. +#define SYS_nfsservctl 169
  2003. +#define SYS_setresgid 170
  2004. +#define SYS_getresgid 171
  2005. +#define SYS_prctl 172
  2006. +#define SYS_rt_sigreturn 173
  2007. +#define SYS_rt_sigaction 174
  2008. +#define SYS_rt_sigprocmask 175
  2009. +#define SYS_rt_sigpending 176
  2010. +#define SYS_rt_sigtimedwait 177
  2011. +#define SYS_rt_sigqueueinfo 178
  2012. +#define SYS_rt_sigsuspend 179
  2013. +#define SYS_pread64 180
  2014. +#define SYS_pwrite64 181
  2015. +#define SYS_chown 182
  2016. +#define SYS_getcwd 183
  2017. +#define SYS_capget 184
  2018. +#define SYS_capset 185
  2019. +#define SYS_sigaltstack 186
  2020. +#define SYS_sendfile 187
  2021. +#define SYS_vfork 190
  2022. +#define SYS_ugetrlimit 191
  2023. +#define SYS_mmap2 192
  2024. +#define SYS_truncate64 193
  2025. +#define SYS_ftruncate64 194
  2026. +#define SYS_stat64 195
  2027. +#define SYS_lstat64 196
  2028. +#define SYS_fstat64 197
  2029. +#define SYS_lchown32 198
  2030. +#define SYS_getuid32 199
  2031. +#define SYS_getgid32 200
  2032. +#define SYS_geteuid32 201
  2033. +#define SYS_getegid32 202
  2034. +#define SYS_setreuid32 203
  2035. +#define SYS_setregid32 204
  2036. +#define SYS_getgroups32 205
  2037. +#define SYS_setgroups32 206
  2038. +#define SYS_fchown32 207
  2039. +#define SYS_setresuid32 208
  2040. +#define SYS_getresuid32 209
  2041. +#define SYS_setresgid32 210
  2042. +#define SYS_getresgid32 211
  2043. +#define SYS_chown32 212
  2044. +#define SYS_setuid32 213
  2045. +#define SYS_setgid32 214
  2046. +#define SYS_setfsuid32 215
  2047. +#define SYS_setfsgid32 216
  2048. +#define SYS_pivot_root 217
  2049. +#define SYS_mincore 218
  2050. +#define SYS_madvise 219
  2051. +#define SYS_getdents64 220
  2052. +#define SYS_fcntl64 221
  2053. +#define SYS_gettid 224
  2054. +#define SYS_readahead 225
  2055. +#define SYS_setxattr 226
  2056. +#define SYS_lsetxattr 227
  2057. +#define SYS_fsetxattr 228
  2058. +#define SYS_getxattr 229
  2059. +#define SYS_lgetxattr 230
  2060. +#define SYS_fgetxattr 231
  2061. +#define SYS_listxattr 232
  2062. +#define SYS_llistxattr 233
  2063. +#define SYS_flistxattr 234
  2064. +#define SYS_removexattr 235
  2065. +#define SYS_lremovexattr 236
  2066. +#define SYS_fremovexattr 237
  2067. +#define SYS_tkill 238
  2068. +#define SYS_sendfile64 239
  2069. +#define SYS_futex 240
  2070. +#define SYS_sched_setaffinity 241
  2071. +#define SYS_sched_getaffinity 242
  2072. +#define SYS_io_setup 245
  2073. +#define SYS_io_destroy 246
  2074. +#define SYS_io_getevents 247
  2075. +#define SYS_io_submit 248
  2076. +#define SYS_io_cancel 249
  2077. +#define SYS_fadvise64 250
  2078. +#define SYS_exit_group 252
  2079. +#define SYS_lookup_dcookie 253
  2080. +#define SYS_epoll_create 254
  2081. +#define SYS_epoll_ctl 255
  2082. +#define SYS_epoll_wait 256
  2083. +#define SYS_remap_file_pages 257
  2084. +#define SYS_set_tid_address 258
  2085. +#define SYS_timer_create 259
  2086. +#define SYS_timer_settime 260
  2087. +#define SYS_timer_gettime 261
  2088. +#define SYS_timer_getoverrun 262
  2089. +#define SYS_timer_delete 263
  2090. +#define SYS_clock_settime 264
  2091. +#define SYS_clock_gettime 265
  2092. +#define SYS_clock_getres 266
  2093. +#define SYS_clock_nanosleep 267
  2094. +#define SYS_statfs64 268
  2095. +#define SYS_fstatfs64 269
  2096. +#define SYS_tgkill 270
  2097. +#define SYS_utimes 271
  2098. +#define SYS_fadvise64_64 272
  2099. +#define SYS_mbind 274
  2100. +#define SYS_get_mempolicy 275
  2101. +#define SYS_set_mempolicy 276
  2102. +#define SYS_mq_open 277
  2103. +#define SYS_mq_unlink 278
  2104. +#define SYS_mq_timedsend 279
  2105. +#define SYS_mq_timedreceive 280
  2106. +#define SYS_mq_notify 281
  2107. +#define SYS_mq_getsetattr 282
  2108. +#define SYS_kexec_load 283
  2109. +#define SYS_waitid 284
  2110. +#define SYS_add_key 285
  2111. +#define SYS_request_key 286
  2112. +#define SYS_keyctl 287
  2113. +#define SYS_ioprio_set 288
  2114. +#define SYS_ioprio_get 289
  2115. +#define SYS_inotify_init 290
  2116. +#define SYS_inotify_add_watch 291
  2117. +#define SYS_inotify_rm_watch 292
  2118. +#define SYS_migrate_pages 294
  2119. +#define SYS_openat 295
  2120. +#define SYS_mkdirat 296
  2121. +#define SYS_mknodat 297
  2122. +#define SYS_fchownat 298
  2123. +#define SYS_futimesat 299
  2124. +#define SYS_fstatat64 300
  2125. +#define SYS_unlinkat 301
  2126. +#define SYS_renameat 302
  2127. +#define SYS_linkat 303
  2128. +#define SYS_symlinkat 304
  2129. +#define SYS_readlinkat 305
  2130. +#define SYS_fchmodat 306
  2131. +#define SYS_faccessat 307
  2132. +#define SYS_pselect6 308
  2133. +#define SYS_ppoll 309
  2134. +#define SYS_unshare 310
  2135. +#define SYS_set_robust_list 311
  2136. +#define SYS_get_robust_list 312
  2137. +#define SYS_splice 313
  2138. +#define SYS_sync_file_range 314
  2139. +#define SYS_tee 315
  2140. +#define SYS_vmsplice 316
  2141. +#define SYS_move_pages 317
  2142. +#define SYS_getcpu 318
  2143. +#define SYS_epoll_pwait 319
  2144. +#define SYS_utimensat 320
  2145. +#define SYS_signalfd 321
  2146. +#define SYS_timerfd_create 322
  2147. +#define SYS_eventfd 323
  2148. +#define SYS_fallocate 324
  2149. +#define SYS_timerfd_settime 325
  2150. +#define SYS_timerfd_gettime 326
  2151. +#define SYS_signalfd4 327
  2152. +#define SYS_eventfd2 328
  2153. +#define SYS_epoll_create1 329
  2154. +#define SYS_dup3 330
  2155. +#define SYS_pipe2 331
  2156. +#define SYS_inotify_init1 332
  2157. +#define SYS_preadv 333
  2158. +#define SYS_pwritev 334
  2159. +#define SYS_rt_tgsigqueueinfo 335
  2160. +#define SYS_perf_event_open 336
  2161. +#define SYS_fanotify_init 337
  2162. +#define SYS_fanotify_mark 338
  2163. +#define SYS_prlimit64 339
  2164. +#define SYS_socket 340
  2165. +#define SYS_bind 341
  2166. +#define SYS_connect 342
  2167. +#define SYS_listen 343
  2168. +#define SYS_accept 344
  2169. +#define SYS_getsockname 345
  2170. +#define SYS_getpeername 346
  2171. +#define SYS_socketpair 347
  2172. +#define SYS_send 348
  2173. +#define SYS_sendto 349
  2174. +#define SYS_recv 350
  2175. +#define SYS_recvfrom 351
  2176. +#define SYS_shutdown 352
  2177. +#define SYS_setsockopt 353
  2178. +#define SYS_getsockopt 354
  2179. +#define SYS_sendmsg 355
  2180. +#define SYS_recvmsg 356
  2181. +#define SYS_recvmmsg 357
  2182. +#define SYS_accept4 358
  2183. +#define SYS_name_to_handle_at 359
  2184. +#define SYS_open_by_handle_at 360
  2185. +#define SYS_clock_adjtime 361
  2186. +#define SYS_syncfs 362
  2187. +#define SYS_sendmmsg 363
  2188. +#define SYS_setns 364
  2189. +#define SYS_process_vm_readv 365
  2190. +#define SYS_process_vm_writev 366
  2191. +#define SYS_kcmp 367
  2192. +#define SYS_finit_module 368
  2193. diff -Nur musl-0.9.15/arch/sh/bits/termios.h musl-git/arch/sh/bits/termios.h
  2194. --- musl-0.9.15/arch/sh/bits/termios.h 1970-01-01 01:00:00.000000000 +0100
  2195. +++ musl-git/arch/sh/bits/termios.h 2014-03-17 16:49:44.000000000 +0100
  2196. @@ -0,0 +1,160 @@
  2197. +struct termios
  2198. +{
  2199. + tcflag_t c_iflag;
  2200. + tcflag_t c_oflag;
  2201. + tcflag_t c_cflag;
  2202. + tcflag_t c_lflag;
  2203. + cc_t c_line;
  2204. + cc_t c_cc[NCCS];
  2205. + speed_t __c_ispeed;
  2206. + speed_t __c_ospeed;
  2207. +};
  2208. +
  2209. +#define VINTR 0
  2210. +#define VQUIT 1
  2211. +#define VERASE 2
  2212. +#define VKILL 3
  2213. +#define VEOF 4
  2214. +#define VTIME 5
  2215. +#define VMIN 6
  2216. +#define VSWTC 7
  2217. +#define VSTART 8
  2218. +#define VSTOP 9
  2219. +#define VSUSP 10
  2220. +#define VEOL 11
  2221. +#define VREPRINT 12
  2222. +#define VDISCARD 13
  2223. +#define VWERASE 14
  2224. +#define VLNEXT 15
  2225. +#define VEOL2 16
  2226. +
  2227. +#define IGNBRK 0000001
  2228. +#define BRKINT 0000002
  2229. +#define IGNPAR 0000004
  2230. +#define PARMRK 0000010
  2231. +#define INPCK 0000020
  2232. +#define ISTRIP 0000040
  2233. +#define INLCR 0000100
  2234. +#define IGNCR 0000200
  2235. +#define ICRNL 0000400
  2236. +#define IUCLC 0001000
  2237. +#define IXON 0002000
  2238. +#define IXANY 0004000
  2239. +#define IXOFF 0010000
  2240. +#define IMAXBEL 0020000
  2241. +#define IUTF8 0040000
  2242. +
  2243. +#define OPOST 0000001
  2244. +#define OLCUC 0000002
  2245. +#define ONLCR 0000004
  2246. +#define OCRNL 0000010
  2247. +#define ONOCR 0000020
  2248. +#define ONLRET 0000040
  2249. +#define OFILL 0000100
  2250. +#define OFDEL 0000200
  2251. +#define NLDLY 0000400
  2252. +#define NL0 0000000
  2253. +#define NL1 0000400
  2254. +#define CRDLY 0003000
  2255. +#define CR0 0000000
  2256. +#define CR1 0001000
  2257. +#define CR2 0002000
  2258. +#define CR3 0003000
  2259. +#define TABDLY 0014000
  2260. +#define TAB0 0000000
  2261. +#define TAB1 0004000
  2262. +#define TAB2 0010000
  2263. +#define TAB3 0014000
  2264. +#define BSDLY 0020000
  2265. +#define BS0 0000000
  2266. +#define BS1 0020000
  2267. +#define FFDLY 0100000
  2268. +#define FF0 0000000
  2269. +#define FF1 0100000
  2270. +
  2271. +#define VTDLY 0040000
  2272. +#define VT0 0000000
  2273. +#define VT1 0040000
  2274. +
  2275. +#define B0 0000000
  2276. +#define B50 0000001
  2277. +#define B75 0000002
  2278. +#define B110 0000003
  2279. +#define B134 0000004
  2280. +#define B150 0000005
  2281. +#define B200 0000006
  2282. +#define B300 0000007
  2283. +#define B600 0000010
  2284. +#define B1200 0000011
  2285. +#define B1800 0000012
  2286. +#define B2400 0000013
  2287. +#define B4800 0000014
  2288. +#define B9600 0000015
  2289. +#define B19200 0000016
  2290. +#define B38400 0000017
  2291. +
  2292. +#define B57600 0010001
  2293. +#define B115200 0010002
  2294. +#define B230400 0010003
  2295. +#define B460800 0010004
  2296. +#define B500000 0010005
  2297. +#define B576000 0010006
  2298. +#define B921600 0010007
  2299. +#define B1000000 0010010
  2300. +#define B1152000 0010011
  2301. +#define B1500000 0010012
  2302. +#define B2000000 0010013
  2303. +#define B2500000 0010014
  2304. +#define B3000000 0010015
  2305. +#define B3500000 0010016
  2306. +#define B4000000 0010017
  2307. +
  2308. +#define CBAUD 0010017
  2309. +
  2310. +#define CSIZE 0000060
  2311. +#define CS5 0000000
  2312. +#define CS6 0000020
  2313. +#define CS7 0000040
  2314. +#define CS8 0000060
  2315. +#define CSTOPB 0000100
  2316. +#define CREAD 0000200
  2317. +#define PARENB 0000400
  2318. +#define PARODD 0001000
  2319. +#define HUPCL 0002000
  2320. +#define CLOCAL 0004000
  2321. +
  2322. +#define ISIG 0000001
  2323. +#define ICANON 0000002
  2324. +#define ECHO 0000010
  2325. +#define ECHOE 0000020
  2326. +#define ECHOK 0000040
  2327. +#define ECHONL 0000100
  2328. +#define NOFLSH 0000200
  2329. +#define TOSTOP 0000400
  2330. +#define IEXTEN 0100000
  2331. +
  2332. +#define ECHOCTL 0001000
  2333. +#define ECHOPRT 0002000
  2334. +#define ECHOKE 0004000
  2335. +#define FLUSHO 0010000
  2336. +#define PENDIN 0040000
  2337. +
  2338. +#define TCOOFF 0
  2339. +#define TCOON 1
  2340. +#define TCIOFF 2
  2341. +#define TCION 3
  2342. +
  2343. +#define TCIFLUSH 0
  2344. +#define TCOFLUSH 1
  2345. +#define TCIOFLUSH 2
  2346. +
  2347. +#define TCSANOW 0
  2348. +#define TCSADRAIN 1
  2349. +#define TCSAFLUSH 2
  2350. +
  2351. +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  2352. +#define CBAUDEX 0010000
  2353. +#define CRTSCTS 020000000000
  2354. +#define EXTPROC 0200000
  2355. +#define XTABS 0014000
  2356. +#endif
  2357. diff -Nur musl-0.9.15/arch/sh/bits/user.h musl-git/arch/sh/bits/user.h
  2358. --- musl-0.9.15/arch/sh/bits/user.h 1970-01-01 01:00:00.000000000 +0100
  2359. +++ musl-git/arch/sh/bits/user.h 2014-03-17 16:49:44.000000000 +0100
  2360. @@ -0,0 +1,75 @@
  2361. +#undef __WORDSIZE
  2362. +#define __WORDSIZE 32
  2363. +
  2364. +#define REG_REG0 0
  2365. +#define REG_REG15 15
  2366. +#define REG_PC 16
  2367. +#define REG_PR 17
  2368. +#define REG_SR 18
  2369. +#define REG_GBR 19
  2370. +#define REG_MACH 20
  2371. +#define REG_MACL 21
  2372. +#define REG_SYSCALL 22
  2373. +#define REG_FPREG0 23
  2374. +#define REG_FPREG15 38
  2375. +#define REG_XFREG0 39
  2376. +#define REG_XFREG15 54
  2377. +#define REG_FPSCR 55
  2378. +#define REG_FPUL 56
  2379. +
  2380. +struct pt_regs {
  2381. + unsigned long regs[16];
  2382. + unsigned long pc;
  2383. + unsigned long pr;
  2384. + unsigned long sr;
  2385. + unsigned long gbr;
  2386. + unsigned long mach;
  2387. + unsigned long macl;
  2388. + long tra;
  2389. +};
  2390. +
  2391. +struct pt_dspregs {
  2392. + unsigned long a1;
  2393. + unsigned long a0g;
  2394. + unsigned long a1g;
  2395. + unsigned long m0;
  2396. + unsigned long m1;
  2397. + unsigned long a0;
  2398. + unsigned long x0;
  2399. + unsigned long x1;
  2400. + unsigned long y0;
  2401. + unsigned long y1;
  2402. + unsigned long dsr;
  2403. + unsigned long rs;
  2404. + unsigned long re;
  2405. + unsigned long mod;
  2406. +};
  2407. +
  2408. +struct user_fpu_struct {
  2409. + unsigned long fp_regs[16];
  2410. + unsigned long xfp_regs[16];
  2411. + unsigned long fpscr;
  2412. + unsigned long fpul;
  2413. +};
  2414. +
  2415. +#define ELF_NGREG 23
  2416. +typedef unsigned long elf_greg_t;
  2417. +typedef elf_greg_t elf_gregset_t[ELF_NGREG];
  2418. +typedef struct user_fpu_struct elf_fpregset_t;
  2419. +
  2420. +struct user {
  2421. + struct pt_regs regs;
  2422. + struct user_fpu_struct fpu;
  2423. + int u_fpvalid;
  2424. + unsigned long u_tsize;
  2425. + unsigned long u_dsize;
  2426. + unsigned long u_ssize;
  2427. + unsigned long start_code;
  2428. + unsigned long start_data;
  2429. + unsigned long start_stack;
  2430. + long int signal;
  2431. + unsigned long u_ar0;
  2432. + struct user_fpu_struct *u_fpstate;
  2433. + unsigned long magic;
  2434. + char u_comm[32];
  2435. +};
  2436. diff -Nur musl-0.9.15/arch/sh/crt_arch.h musl-git/arch/sh/crt_arch.h
  2437. --- musl-0.9.15/arch/sh/crt_arch.h 1970-01-01 01:00:00.000000000 +0100
  2438. +++ musl-git/arch/sh/crt_arch.h 2014-03-17 16:49:44.000000000 +0100
  2439. @@ -0,0 +1,12 @@
  2440. +__asm__("\
  2441. +.global _start \n\
  2442. +_start: \n\
  2443. + mov r15, r4 \n\
  2444. + mov #-16, r0 \n\
  2445. + and r0, r15 \n\
  2446. + bsr __cstart \n\
  2447. + nop \n\
  2448. +");
  2449. +
  2450. +/* used by gcc for switching the FPU between single and double precision */
  2451. +const unsigned long __fpscr_values[2] = { 0, 0x80000 };
  2452. diff -Nur musl-0.9.15/arch/sh/pthread_arch.h musl-git/arch/sh/pthread_arch.h
  2453. --- musl-0.9.15/arch/sh/pthread_arch.h 1970-01-01 01:00:00.000000000 +0100
  2454. +++ musl-git/arch/sh/pthread_arch.h 2014-03-17 16:49:44.000000000 +0100
  2455. @@ -0,0 +1,11 @@
  2456. +static inline struct pthread *__pthread_self()
  2457. +{
  2458. + char *self;
  2459. + __asm__ __volatile__ ("stc gbr,%0" : "=r" (self) );
  2460. + return (struct pthread *) (self + 8 - sizeof(struct pthread));
  2461. +}
  2462. +
  2463. +#define TLS_ABOVE_TP
  2464. +#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) - 8)
  2465. +
  2466. +#define CANCEL_REG_IP 17
  2467. diff -Nur musl-0.9.15/arch/sh/reloc.h musl-git/arch/sh/reloc.h
  2468. --- musl-0.9.15/arch/sh/reloc.h 1970-01-01 01:00:00.000000000 +0100
  2469. +++ musl-git/arch/sh/reloc.h 2014-03-17 16:49:44.000000000 +0100
  2470. @@ -0,0 +1,47 @@
  2471. +#if __BYTE_ORDER == __BIG_ENDIAN
  2472. +#define ENDIAN_SUFFIX "eb"
  2473. +#else
  2474. +#define ENDIAN_SUFFIX ""
  2475. +#endif
  2476. +
  2477. +#define LDSO_ARCH "sh" ENDIAN_SUFFIX
  2478. +
  2479. +#define IS_COPY(x) ((x) == R_SH_COPY)
  2480. +#define IS_PLT(x) ((x) == R_SH_JMP_SLOT)
  2481. +
  2482. +static inline void do_single_reloc(
  2483. + struct dso *self, unsigned char *base_addr,
  2484. + size_t *reloc_addr, int type, size_t addend,
  2485. + Sym *sym, size_t sym_size,
  2486. + struct symdef def, size_t sym_val)
  2487. +{
  2488. + switch(type) {
  2489. + case R_SH_GLOB_DAT:
  2490. + case R_SH_JMP_SLOT:
  2491. + *reloc_addr = sym_val;
  2492. + break;
  2493. + case R_SH_RELATIVE:
  2494. + *reloc_addr = (size_t)base_addr + addend;
  2495. + break;
  2496. + case R_SH_DIR32:
  2497. + *reloc_addr = sym_val + addend;
  2498. + break;
  2499. + case R_SH_REL32:
  2500. + *reloc_addr = sym_val + addend - (size_t)reloc_addr + (size_t)base_addr;
  2501. + break;
  2502. + case R_SH_COPY:
  2503. + memcpy(reloc_addr, (void *)sym_val, sym_size);
  2504. + break;
  2505. + case R_SH_TLS_DTPMOD32:
  2506. + *reloc_addr += def.dso ? def.dso->tls_id : self->tls_id;
  2507. + break;
  2508. + case R_SH_TLS_DTPOFF32:
  2509. + *reloc_addr += def.sym->st_value;
  2510. + break;
  2511. + case R_SH_TLS_TPOFF32:
  2512. + *reloc_addr += def.sym
  2513. + ? def.sym->st_value + def.dso->tls_offset + 8
  2514. + : self->tls_offset + 8;
  2515. + break;
  2516. + }
  2517. +}
  2518. diff -Nur musl-0.9.15/arch/sh/src/atomic.c musl-git/arch/sh/src/atomic.c
  2519. --- musl-0.9.15/arch/sh/src/atomic.c 1970-01-01 01:00:00.000000000 +0100
  2520. +++ musl-git/arch/sh/src/atomic.c 2014-03-17 16:49:44.000000000 +0100
  2521. @@ -0,0 +1,146 @@
  2522. +#include "libc.h"
  2523. +
  2524. +#define LLSC_CLOBBERS "r0", "t", "memory"
  2525. +#define LLSC_START(mem) \
  2526. + "0: movli.l @" mem ", r0\n"
  2527. +#define LLSC_END(mem) \
  2528. + "1: movco.l r0, @" mem "\n" \
  2529. + " bf 0b\n" \
  2530. + " synco\n"
  2531. +
  2532. +/* gusa is a hack in the kernel which lets you create a sequence of instructions
  2533. + * which will be restarted if the process is preempted in the middle of the
  2534. + * sequence. It will do for implementing atomics on non-smp systems. ABI is:
  2535. + * r0 = address of first instruction after the atomic sequence
  2536. + * r1 = original stack pointer
  2537. + * r15 = -1 * length of atomic sequence in bytes
  2538. + */
  2539. +#define GUSA_CLOBBERS "r0", "r1", "memory"
  2540. +#define GUSA_START(mem,old,nop) \
  2541. + " .align 2\n" \
  2542. + " mova 1f, r0\n" \
  2543. + nop \
  2544. + " mov r15, r1\n" \
  2545. + " mov #(0f-1f), r15\n" \
  2546. + "0: mov.l @" mem ", " old "\n"
  2547. +/* the target of mova must be 4 byte aligned, so we may need a nop */
  2548. +#define GUSA_START_ODD(mem,old) GUSA_START(mem,old,"")
  2549. +#define GUSA_START_EVEN(mem,old) GUSA_START(mem,old,"\tnop\n")
  2550. +#define GUSA_END(mem,new) \
  2551. + " mov.l " new ", @" mem "\n" \
  2552. + "1: mov r1, r15\n"
  2553. +
  2554. +#define CPU_HAS_LLSC 0x0040
  2555. +
  2556. +int __sh_cas(volatile int *p, int t, int s)
  2557. +{
  2558. + int old;
  2559. + if (__hwcap & CPU_HAS_LLSC) {
  2560. + __asm__ __volatile__(
  2561. + LLSC_START("%1")
  2562. + " mov r0, %0\n"
  2563. + " cmp/eq %0, %2\n"
  2564. + " bf 1f\n"
  2565. + " mov %3, r0\n"
  2566. + LLSC_END("%1")
  2567. + : "=&r"(old) : "r"(p), "r"(t), "r"(s) : LLSC_CLOBBERS);
  2568. + } else {
  2569. + __asm__ __volatile__(
  2570. + GUSA_START_EVEN("%1", "%0")
  2571. + " cmp/eq %0, %2\n"
  2572. + " bf 1f\n"
  2573. + GUSA_END("%1", "%3")
  2574. + : "=&r"(old) : "r"(p), "r"(t), "r"(s) : GUSA_CLOBBERS, "t");
  2575. + }
  2576. + return old;
  2577. +}
  2578. +
  2579. +int __sh_swap(volatile int *x, int v)
  2580. +{
  2581. + int old;
  2582. + if (__hwcap & CPU_HAS_LLSC) {
  2583. + __asm__ __volatile__(
  2584. + LLSC_START("%1")
  2585. + " mov r0, %0\n"
  2586. + " mov %2, r0\n"
  2587. + LLSC_END("%1")
  2588. + : "=&r"(old) : "r"(x), "r"(v) : LLSC_CLOBBERS);
  2589. + } else {
  2590. + __asm__ __volatile__(
  2591. + GUSA_START_EVEN("%1", "%0")
  2592. + GUSA_END("%1", "%2")
  2593. + : "=&r"(old) : "r"(x), "r"(v) : GUSA_CLOBBERS);
  2594. + }
  2595. + return old;
  2596. +}
  2597. +
  2598. +int __sh_fetch_add(volatile int *x, int v)
  2599. +{
  2600. + int old, dummy;
  2601. + if (__hwcap & CPU_HAS_LLSC) {
  2602. + __asm__ __volatile__(
  2603. + LLSC_START("%1")
  2604. + " mov r0, %0\n"
  2605. + " add %2, r0\n"
  2606. + LLSC_END("%1")
  2607. + : "=&r"(old) : "r"(x), "r"(v) : LLSC_CLOBBERS);
  2608. + } else {
  2609. + __asm__ __volatile__(
  2610. + GUSA_START_EVEN("%2", "%0")
  2611. + " mov %0, %1\n"
  2612. + " add %3, %1\n"
  2613. + GUSA_END("%2", "%1")
  2614. + : "=&r"(old), "=&r"(dummy) : "r"(x), "r"(v) : GUSA_CLOBBERS);
  2615. + }
  2616. + return old;
  2617. +}
  2618. +
  2619. +void __sh_store(volatile int *p, int x)
  2620. +{
  2621. + if (__hwcap & CPU_HAS_LLSC) {
  2622. + __asm__ __volatile__(
  2623. + " mov.l %1, @%0\n"
  2624. + " synco\n"
  2625. + : : "r"(p), "r"(x) : "memory");
  2626. + } else {
  2627. + __asm__ __volatile__(
  2628. + " mov.l %1, @%0\n"
  2629. + : : "r"(p), "r"(x) : "memory");
  2630. + }
  2631. +}
  2632. +
  2633. +void __sh_and(volatile int *x, int v)
  2634. +{
  2635. + int dummy;
  2636. + if (__hwcap & CPU_HAS_LLSC) {
  2637. + __asm__ __volatile__(
  2638. + LLSC_START("%0")
  2639. + " and %1, r0\n"
  2640. + LLSC_END("%0")
  2641. + : : "r"(x), "r"(v) : LLSC_CLOBBERS);
  2642. + } else {
  2643. + __asm__ __volatile__(
  2644. + GUSA_START_ODD("%1", "%0")
  2645. + " and %2, %0\n"
  2646. + GUSA_END("%1", "%0")
  2647. + : "=&r"(dummy) : "r"(x), "r"(v) : GUSA_CLOBBERS);
  2648. + }
  2649. +}
  2650. +
  2651. +void __sh_or(volatile int *x, int v)
  2652. +{
  2653. + int dummy;
  2654. + if (__hwcap & CPU_HAS_LLSC) {
  2655. + __asm__ __volatile__(
  2656. + LLSC_START("%0")
  2657. + " or %1, r0\n"
  2658. + LLSC_END("%0")
  2659. + : : "r"(x), "r"(v) : LLSC_CLOBBERS);
  2660. + } else {
  2661. + __asm__ __volatile__(
  2662. + GUSA_START_ODD("%1", "%0")
  2663. + " or %2, %0\n"
  2664. + GUSA_END("%1", "%0")
  2665. + : "=&r"(dummy) : "r"(x), "r"(v) : GUSA_CLOBBERS);
  2666. + }
  2667. +}
  2668. diff -Nur musl-0.9.15/arch/sh/src/__fpsrc_values.c musl-git/arch/sh/src/__fpsrc_values.c
  2669. --- musl-0.9.15/arch/sh/src/__fpsrc_values.c 1970-01-01 01:00:00.000000000 +0100
  2670. +++ musl-git/arch/sh/src/__fpsrc_values.c 2014-03-17 16:49:44.000000000 +0100
  2671. @@ -0,0 +1,5 @@
  2672. +#include "libc.h"
  2673. +
  2674. +/* used by gcc for switching the FPU between single and double precision */
  2675. +const unsigned long __fpscr_values[2] ATTR_LIBC_VISIBILITY = { 0, 0x80000 };
  2676. +
  2677. diff -Nur musl-0.9.15/arch/sh/syscall_arch.h musl-git/arch/sh/syscall_arch.h
  2678. --- musl-0.9.15/arch/sh/syscall_arch.h 1970-01-01 01:00:00.000000000 +0100
  2679. +++ musl-git/arch/sh/syscall_arch.h 2014-03-17 16:49:44.000000000 +0100
  2680. @@ -0,0 +1,87 @@
  2681. +#define __SYSCALL_LL_E(x) \
  2682. +((union { long long ll; long l[2]; }){ .ll = x }).l[0], \
  2683. +((union { long long ll; long l[2]; }){ .ll = x }).l[1]
  2684. +#define __SYSCALL_LL_O(x) __SYSCALL_LL_E((x))
  2685. +
  2686. +/* The extra OR instructions are to work around a hardware bug:
  2687. + * http://documentation.renesas.com/doc/products/mpumcu/tu/tnsh7456ae.pdf
  2688. + */
  2689. +#define __asm_syscall(trapno, ...) do { \
  2690. + __asm__ __volatile__ ( \
  2691. + "trapa #" #trapno "\n" \
  2692. + "or r0, r0\n" \
  2693. + "or r0, r0\n" \
  2694. + "or r0, r0\n" \
  2695. + "or r0, r0\n" \
  2696. + "or r0, r0\n" \
  2697. + : "=r"(r0) : __VA_ARGS__ : "memory"); \
  2698. + return r0; \
  2699. + } while (0)
  2700. +
  2701. +static inline long __syscall0(long n)
  2702. +{
  2703. + register long r3 __asm__("r3") = n;
  2704. + register long r0 __asm__("r0");
  2705. + __asm_syscall(16, "r"(r3));
  2706. +}
  2707. +
  2708. +static inline long __syscall1(long n, long a)
  2709. +{
  2710. + register long r3 __asm__("r3") = n;
  2711. + register long r4 __asm__("r4") = a;
  2712. + register long r0 __asm__("r0");
  2713. + __asm_syscall(17, "r"(r3), "r"(r4));
  2714. +}
  2715. +
  2716. +static inline long __syscall2(long n, long a, long b)
  2717. +{
  2718. + register long r3 __asm__("r3") = n;
  2719. + register long r4 __asm__("r4") = a;
  2720. + register long r5 __asm__("r5") = b;
  2721. + register long r0 __asm__("r0");
  2722. + __asm_syscall(18, "r"(r3), "r"(r4), "r"(r5));
  2723. +}
  2724. +
  2725. +static inline long __syscall3(long n, long a, long b, long c)
  2726. +{
  2727. + register long r3 __asm__("r3") = n;
  2728. + register long r4 __asm__("r4") = a;
  2729. + register long r5 __asm__("r5") = b;
  2730. + register long r6 __asm__("r6") = c;
  2731. + register long r0 __asm__("r0");
  2732. + __asm_syscall(19, "r"(r3), "r"(r4), "r"(r5), "r"(r6));
  2733. +}
  2734. +
  2735. +static inline long __syscall4(long n, long a, long b, long c, long d)
  2736. +{
  2737. + register long r3 __asm__("r3") = n;
  2738. + register long r4 __asm__("r4") = a;
  2739. + register long r5 __asm__("r5") = b;
  2740. + register long r6 __asm__("r6") = c;
  2741. + register long r7 __asm__("r7") = d;
  2742. + register long r0 __asm__("r0");
  2743. + __asm_syscall(20, "r"(r3), "r"(r4), "r"(r5), "r"(r6), "r"(r7));
  2744. +}
  2745. +
  2746. +static inline long __syscall5(long n, long a, long b, long c, long d, long e)
  2747. +{
  2748. + register long r3 __asm__("r3") = n;
  2749. + register long r4 __asm__("r4") = a;
  2750. + register long r5 __asm__("r5") = b;
  2751. + register long r6 __asm__("r6") = c;
  2752. + register long r7 __asm__("r7") = d;
  2753. + register long r0 __asm__("r0") = e;
  2754. + __asm_syscall(21, "r"(r3), "r"(r4), "r"(r5), "r"(r6), "r"(r7), "0"(r0));
  2755. +}
  2756. +
  2757. +static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
  2758. +{
  2759. + register long r3 __asm__("r3") = n;
  2760. + register long r4 __asm__("r4") = a;
  2761. + register long r5 __asm__("r5") = b;
  2762. + register long r6 __asm__("r6") = c;
  2763. + register long r7 __asm__("r7") = d;
  2764. + register long r0 __asm__("r0") = e;
  2765. + register long r1 __asm__("r1") = f;
  2766. + __asm_syscall(22, "r"(r3), "r"(r4), "r"(r5), "r"(r6), "r"(r7), "0"(r0), "r"(r1));
  2767. +}
  2768. diff -Nur musl-0.9.15/arch/x32/atomic.h musl-git/arch/x32/atomic.h
  2769. --- musl-0.9.15/arch/x32/atomic.h 1970-01-01 01:00:00.000000000 +0100
  2770. +++ musl-git/arch/x32/atomic.h 2014-03-17 16:49:44.000000000 +0100
  2771. @@ -0,0 +1,125 @@
  2772. +#ifndef _INTERNAL_ATOMIC_H
  2773. +#define _INTERNAL_ATOMIC_H
  2774. +
  2775. +#include <stdint.h>
  2776. +
  2777. +static inline int a_ctz_64(uint64_t x)
  2778. +{
  2779. + __asm__( "bsf %1,%0" : "=r"(x) : "r"(x) );
  2780. + return x;
  2781. +}
  2782. +
  2783. +static inline int a_ctz_l(unsigned long x)
  2784. +{
  2785. + __asm__( "bsf %1,%0" : "=r"(x) : "r"(x) );
  2786. + return x;
  2787. +}
  2788. +
  2789. +static inline void a_and_64(volatile uint64_t *p, uint64_t v)
  2790. +{
  2791. + __asm__( "lock ; and %1, %0"
  2792. + : "=m"(*p) : "r"(v) : "memory" );
  2793. +}
  2794. +
  2795. +static inline void a_or_64(volatile uint64_t *p, uint64_t v)
  2796. +{
  2797. + __asm__( "lock ; or %1, %0"
  2798. + : "=m"(*p) : "r"(v) : "memory" );
  2799. +}
  2800. +
  2801. +static inline void a_store_l(volatile void *p, long x)
  2802. +{
  2803. + __asm__( "mov %1, %0" : "=m"(*(long *)p) : "r"(x) : "memory" );
  2804. +}
  2805. +
  2806. +static inline void a_or_l(volatile void *p, long v)
  2807. +{
  2808. + __asm__( "lock ; or %1, %0"
  2809. + : "=m"(*(long *)p) : "r"(v) : "memory" );
  2810. +}
  2811. +
  2812. +static inline void *a_cas_p(volatile void *p, void *t, void *s)
  2813. +{
  2814. + __asm__( "lock ; cmpxchg %3, %1"
  2815. + : "=a"(t), "=m"(*(long *)p) : "a"(t), "r"(s) : "memory" );
  2816. + return t;
  2817. +}
  2818. +
  2819. +static inline long a_cas_l(volatile void *p, long t, long s)
  2820. +{
  2821. + __asm__( "lock ; cmpxchg %3, %1"
  2822. + : "=a"(t), "=m"(*(long *)p) : "a"(t), "r"(s) : "memory" );
  2823. + return t;
  2824. +}
  2825. +
  2826. +static inline int a_cas(volatile int *p, int t, int s)
  2827. +{
  2828. + __asm__( "lock ; cmpxchg %3, %1"
  2829. + : "=a"(t), "=m"(*p) : "a"(t), "r"(s) : "memory" );
  2830. + return t;
  2831. +}
  2832. +
  2833. +static inline void *a_swap_p(void *volatile *x, void *v)
  2834. +{
  2835. + __asm__( "xchg %0, %1" : "=r"(v), "=m"(*(void **)x) : "0"(v) : "memory" );
  2836. + return v;
  2837. +}
  2838. +static inline long a_swap_l(volatile void *x, long v)
  2839. +{
  2840. + __asm__( "xchg %0, %1" : "=r"(v), "=m"(*(long *)x) : "0"(v) : "memory" );
  2841. + return v;
  2842. +}
  2843. +
  2844. +static inline void a_or(volatile void *p, int v)
  2845. +{
  2846. + __asm__( "lock ; or %1, %0"
  2847. + : "=m"(*(int *)p) : "r"(v) : "memory" );
  2848. +}
  2849. +
  2850. +static inline void a_and(volatile void *p, int v)
  2851. +{
  2852. + __asm__( "lock ; and %1, %0"
  2853. + : "=m"(*(int *)p) : "r"(v) : "memory" );
  2854. +}
  2855. +
  2856. +static inline int a_swap(volatile int *x, int v)
  2857. +{
  2858. + __asm__( "xchg %0, %1" : "=r"(v), "=m"(*x) : "0"(v) : "memory" );
  2859. + return v;
  2860. +}
  2861. +
  2862. +#define a_xchg a_swap
  2863. +
  2864. +static inline int a_fetch_add(volatile int *x, int v)
  2865. +{
  2866. + __asm__( "lock ; xadd %0, %1" : "=r"(v), "=m"(*x) : "0"(v) : "memory" );
  2867. + return v;
  2868. +}
  2869. +
  2870. +static inline void a_inc(volatile int *x)
  2871. +{
  2872. + __asm__( "lock ; incl %0" : "=m"(*x) : "m"(*x) : "memory" );
  2873. +}
  2874. +
  2875. +static inline void a_dec(volatile int *x)
  2876. +{
  2877. + __asm__( "lock ; decl %0" : "=m"(*x) : "m"(*x) : "memory" );
  2878. +}
  2879. +
  2880. +static inline void a_store(volatile int *p, int x)
  2881. +{
  2882. + __asm__( "mov %1, %0" : "=m"(*p) : "r"(x) : "memory" );
  2883. +}
  2884. +
  2885. +static inline void a_spin()
  2886. +{
  2887. + __asm__ __volatile__( "pause" : : : "memory" );
  2888. +}
  2889. +
  2890. +static inline void a_crash()
  2891. +{
  2892. + __asm__ __volatile__( "hlt" : : : "memory" );
  2893. +}
  2894. +
  2895. +
  2896. +#endif
  2897. diff -Nur musl-0.9.15/arch/x32/bits/alltypes.h.in musl-git/arch/x32/bits/alltypes.h.in
  2898. --- musl-0.9.15/arch/x32/bits/alltypes.h.in 1970-01-01 01:00:00.000000000 +0100
  2899. +++ musl-git/arch/x32/bits/alltypes.h.in 2014-03-17 16:49:44.000000000 +0100
  2900. @@ -0,0 +1,28 @@
  2901. +#define _Addr int
  2902. +#define _Int64 long long
  2903. +#define _Reg long long
  2904. +
  2905. +TYPEDEF __builtin_va_list va_list;
  2906. +TYPEDEF __builtin_va_list __isoc_va_list;
  2907. +
  2908. +#ifndef __cplusplus
  2909. +TYPEDEF long wchar_t;
  2910. +#endif
  2911. +TYPEDEF unsigned wint_t;
  2912. +
  2913. +#if defined(__FLT_EVAL_METHOD__) && __FLT_EVAL_METHOD__ == 2
  2914. +TYPEDEF long double float_t;
  2915. +TYPEDEF long double double_t;
  2916. +#else
  2917. +TYPEDEF float float_t;
  2918. +TYPEDEF double double_t;
  2919. +#endif
  2920. +
  2921. +TYPEDEF long long time_t;
  2922. +TYPEDEF long long suseconds_t;
  2923. +
  2924. +TYPEDEF struct { union { int __i[14]; unsigned long __s[7]; } __u; } pthread_attr_t;
  2925. +TYPEDEF struct { union { int __i[10]; void *__p[5]; } __u; } pthread_mutex_t;
  2926. +TYPEDEF struct { union { int __i[12]; void *__p[6]; } __u; } pthread_cond_t;
  2927. +TYPEDEF struct { union { int __i[14]; void *__p[7]; } __u; } pthread_rwlock_t;
  2928. +TYPEDEF struct { union { int __i[8]; void *__p[4]; } __u; } pthread_barrier_t;
  2929. diff -Nur musl-0.9.15/arch/x32/bits/endian.h musl-git/arch/x32/bits/endian.h
  2930. --- musl-0.9.15/arch/x32/bits/endian.h 1970-01-01 01:00:00.000000000 +0100
  2931. +++ musl-git/arch/x32/bits/endian.h 2014-03-17 16:49:44.000000000 +0100
  2932. @@ -0,0 +1 @@
  2933. +#define __BYTE_ORDER __LITTLE_ENDIAN
  2934. diff -Nur musl-0.9.15/arch/x32/bits/errno.h musl-git/arch/x32/bits/errno.h
  2935. --- musl-0.9.15/arch/x32/bits/errno.h 1970-01-01 01:00:00.000000000 +0100
  2936. +++ musl-git/arch/x32/bits/errno.h 2014-03-17 16:49:44.000000000 +0100
  2937. @@ -0,0 +1,134 @@
  2938. +#define EPERM 1
  2939. +#define ENOENT 2
  2940. +#define ESRCH 3
  2941. +#define EINTR 4
  2942. +#define EIO 5
  2943. +#define ENXIO 6
  2944. +#define E2BIG 7
  2945. +#define ENOEXEC 8
  2946. +#define EBADF 9
  2947. +#define ECHILD 10
  2948. +#define EAGAIN 11
  2949. +#define ENOMEM 12
  2950. +#define EACCES 13
  2951. +#define EFAULT 14
  2952. +#define ENOTBLK 15
  2953. +#define EBUSY 16
  2954. +#define EEXIST 17
  2955. +#define EXDEV 18
  2956. +#define ENODEV 19
  2957. +#define ENOTDIR 20
  2958. +#define EISDIR 21
  2959. +#define EINVAL 22
  2960. +#define ENFILE 23
  2961. +#define EMFILE 24
  2962. +#define ENOTTY 25
  2963. +#define ETXTBSY 26
  2964. +#define EFBIG 27
  2965. +#define ENOSPC 28
  2966. +#define ESPIPE 29
  2967. +#define EROFS 30
  2968. +#define EMLINK 31
  2969. +#define EPIPE 32
  2970. +#define EDOM 33
  2971. +#define ERANGE 34
  2972. +#define EDEADLK 35
  2973. +#define ENAMETOOLONG 36
  2974. +#define ENOLCK 37
  2975. +#define ENOSYS 38
  2976. +#define ENOTEMPTY 39
  2977. +#define ELOOP 40
  2978. +#define EWOULDBLOCK EAGAIN
  2979. +#define ENOMSG 42
  2980. +#define EIDRM 43
  2981. +#define ECHRNG 44
  2982. +#define EL2NSYNC 45
  2983. +#define EL3HLT 46
  2984. +#define EL3RST 47
  2985. +#define ELNRNG 48
  2986. +#define EUNATCH 49
  2987. +#define ENOCSI 50
  2988. +#define EL2HLT 51
  2989. +#define EBADE 52
  2990. +#define EBADR 53
  2991. +#define EXFULL 54
  2992. +#define ENOANO 55
  2993. +#define EBADRQC 56
  2994. +#define EBADSLT 57
  2995. +#define EDEADLOCK EDEADLK
  2996. +#define EBFONT 59
  2997. +#define ENOSTR 60
  2998. +#define ENODATA 61
  2999. +#define ETIME 62
  3000. +#define ENOSR 63
  3001. +#define ENONET 64
  3002. +#define ENOPKG 65
  3003. +#define EREMOTE 66
  3004. +#define ENOLINK 67
  3005. +#define EADV 68
  3006. +#define ESRMNT 69
  3007. +#define ECOMM 70
  3008. +#define EPROTO 71
  3009. +#define EMULTIHOP 72
  3010. +#define EDOTDOT 73
  3011. +#define EBADMSG 74
  3012. +#define EOVERFLOW 75
  3013. +#define ENOTUNIQ 76
  3014. +#define EBADFD 77
  3015. +#define EREMCHG 78
  3016. +#define ELIBACC 79
  3017. +#define ELIBBAD 80
  3018. +#define ELIBSCN 81
  3019. +#define ELIBMAX 82
  3020. +#define ELIBEXEC 83
  3021. +#define EILSEQ 84
  3022. +#define ERESTART 85
  3023. +#define ESTRPIPE 86
  3024. +#define EUSERS 87
  3025. +#define ENOTSOCK 88
  3026. +#define EDESTADDRREQ 89
  3027. +#define EMSGSIZE 90
  3028. +#define EPROTOTYPE 91
  3029. +#define ENOPROTOOPT 92
  3030. +#define EPROTONOSUPPORT 93
  3031. +#define ESOCKTNOSUPPORT 94
  3032. +#define EOPNOTSUPP 95
  3033. +#define ENOTSUP EOPNOTSUPP
  3034. +#define EPFNOSUPPORT 96
  3035. +#define EAFNOSUPPORT 97
  3036. +#define EADDRINUSE 98
  3037. +#define EADDRNOTAVAIL 99
  3038. +#define ENETDOWN 100
  3039. +#define ENETUNREACH 101
  3040. +#define ENETRESET 102
  3041. +#define ECONNABORTED 103
  3042. +#define ECONNRESET 104
  3043. +#define ENOBUFS 105
  3044. +#define EISCONN 106
  3045. +#define ENOTCONN 107
  3046. +#define ESHUTDOWN 108
  3047. +#define ETOOMANYREFS 109
  3048. +#define ETIMEDOUT 110
  3049. +#define ECONNREFUSED 111
  3050. +#define EHOSTDOWN 112
  3051. +#define EHOSTUNREACH 113
  3052. +#define EALREADY 114
  3053. +#define EINPROGRESS 115
  3054. +#define ESTALE 116
  3055. +#define EUCLEAN 117
  3056. +#define ENOTNAM 118
  3057. +#define ENAVAIL 119
  3058. +#define EISNAM 120
  3059. +#define EREMOTEIO 121
  3060. +#define EDQUOT 122
  3061. +#define ENOMEDIUM 123
  3062. +#define EMEDIUMTYPE 124
  3063. +#define ECANCELED 125
  3064. +#define ENOKEY 126
  3065. +#define EKEYEXPIRED 127
  3066. +#define EKEYREVOKED 128
  3067. +#define EKEYREJECTED 129
  3068. +#define EOWNERDEAD 130
  3069. +#define ENOTRECOVERABLE 131
  3070. +#define ERFKILL 132
  3071. +#define EHWPOISON 133
  3072. diff -Nur musl-0.9.15/arch/x32/bits/fcntl.h musl-git/arch/x32/bits/fcntl.h
  3073. --- musl-0.9.15/arch/x32/bits/fcntl.h 1970-01-01 01:00:00.000000000 +0100
  3074. +++ musl-git/arch/x32/bits/fcntl.h 2014-03-17 16:49:44.000000000 +0100
  3075. @@ -0,0 +1,39 @@
  3076. +#define O_CREAT 0100
  3077. +#define O_EXCL 0200
  3078. +#define O_NOCTTY 0400
  3079. +#define O_TRUNC 01000
  3080. +#define O_APPEND 02000
  3081. +#define O_NONBLOCK 04000
  3082. +#define O_DSYNC 010000
  3083. +#define O_SYNC 04010000
  3084. +#define O_RSYNC 04010000
  3085. +#define O_DIRECTORY 0200000
  3086. +#define O_NOFOLLOW 0400000
  3087. +#define O_CLOEXEC 02000000
  3088. +
  3089. +#define O_ASYNC 020000
  3090. +#define O_DIRECT 040000
  3091. +#define O_LARGEFILE 0
  3092. +#define O_NOATIME 01000000
  3093. +#define O_TMPFILE 020200000
  3094. +#define O_NDELAY O_NONBLOCK
  3095. +
  3096. +#define F_DUPFD 0
  3097. +#define F_GETFD 1
  3098. +#define F_SETFD 2
  3099. +#define F_GETFL 3
  3100. +#define F_SETFL 4
  3101. +
  3102. +#define F_SETOWN 8
  3103. +#define F_GETOWN 9
  3104. +#define F_SETSIG 10
  3105. +#define F_GETSIG 11
  3106. +
  3107. +#define F_GETLK 5
  3108. +#define F_SETLK 6
  3109. +#define F_SETLKW 7
  3110. +
  3111. +#define F_SETOWN_EX 15
  3112. +#define F_GETOWN_EX 16
  3113. +
  3114. +#define F_GETOWNER_UIDS 17
  3115. diff -Nur musl-0.9.15/arch/x32/bits/fenv.h musl-git/arch/x32/bits/fenv.h
  3116. --- musl-0.9.15/arch/x32/bits/fenv.h 1970-01-01 01:00:00.000000000 +0100
  3117. +++ musl-git/arch/x32/bits/fenv.h 2014-03-17 16:49:44.000000000 +0100
  3118. @@ -0,0 +1,34 @@
  3119. +#define FE_INVALID 1
  3120. +#define __FE_DENORM 2
  3121. +#define FE_DIVBYZERO 4
  3122. +#define FE_OVERFLOW 8
  3123. +#define FE_UNDERFLOW 16
  3124. +#define FE_INEXACT 32
  3125. +
  3126. +#define FE_ALL_EXCEPT 63
  3127. +
  3128. +#define FE_TONEAREST 0
  3129. +#define FE_DOWNWARD 0x400
  3130. +#define FE_UPWARD 0x800
  3131. +#define FE_TOWARDZERO 0xc00
  3132. +
  3133. +typedef unsigned short fexcept_t;
  3134. +
  3135. +typedef struct {
  3136. + unsigned short __control_word;
  3137. + unsigned short __unused1;
  3138. + unsigned short __status_word;
  3139. + unsigned short __unused2;
  3140. + unsigned short __tags;
  3141. + unsigned short __unused3;
  3142. + unsigned int __eip;
  3143. + unsigned short __cs_selector;
  3144. + unsigned int __opcode:11;
  3145. + unsigned int __unused4:5;
  3146. + unsigned int __data_offset;
  3147. + unsigned short __data_selector;
  3148. + unsigned short __unused5;
  3149. + unsigned int __mxcsr;
  3150. +} fenv_t;
  3151. +
  3152. +#define FE_DFL_ENV ((const fenv_t *) -1)
  3153. diff -Nur musl-0.9.15/arch/x32/bits/float.h musl-git/arch/x32/bits/float.h
  3154. --- musl-0.9.15/arch/x32/bits/float.h 1970-01-01 01:00:00.000000000 +0100
  3155. +++ musl-git/arch/x32/bits/float.h 2014-03-17 16:49:44.000000000 +0100
  3156. @@ -0,0 +1,21 @@
  3157. +#define FLT_ROUNDS 1
  3158. +#ifdef __FLT_EVAL_METHOD__
  3159. +#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
  3160. +#else
  3161. +#define FLT_EVAL_METHOD 0
  3162. +#endif
  3163. +
  3164. +#define LDBL_TRUE_MIN 3.6451995318824746025e-4951L
  3165. +#define LDBL_MIN 3.3621031431120935063e-4932L
  3166. +#define LDBL_MAX 1.1897314953572317650e+4932L
  3167. +#define LDBL_EPSILON 1.0842021724855044340e-19L
  3168. +
  3169. +#define LDBL_MANT_DIG 64
  3170. +#define LDBL_MIN_EXP (-16381)
  3171. +#define LDBL_MAX_EXP 16384
  3172. +
  3173. +#define LDBL_DIG 18
  3174. +#define LDBL_MIN_10_EXP (-4931)
  3175. +#define LDBL_MAX_10_EXP 4932
  3176. +
  3177. +#define DECIMAL_DIG 21
  3178. diff -Nur musl-0.9.15/arch/x32/bits/ioctl.h musl-git/arch/x32/bits/ioctl.h
  3179. --- musl-0.9.15/arch/x32/bits/ioctl.h 1970-01-01 01:00:00.000000000 +0100
  3180. +++ musl-git/arch/x32/bits/ioctl.h 2014-03-17 16:49:44.000000000 +0100
  3181. @@ -0,0 +1,197 @@
  3182. +#define _IOC(a,b,c,d) ( ((a)<<30) | ((b)<<8) | (c) | ((d)<<16) )
  3183. +#define _IOC_NONE 0U
  3184. +#define _IOC_WRITE 1U
  3185. +#define _IOC_READ 2U
  3186. +
  3187. +#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
  3188. +#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
  3189. +#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
  3190. +#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
  3191. +
  3192. +#define TCGETS 0x5401
  3193. +#define TCSETS 0x5402
  3194. +#define TCSETSW 0x5403
  3195. +#define TCSETSF 0x5404
  3196. +#define TCGETA 0x5405
  3197. +#define TCSETA 0x5406
  3198. +#define TCSETAW 0x5407
  3199. +#define TCSETAF 0x5408
  3200. +#define TCSBRK 0x5409
  3201. +#define TCXONC 0x540A
  3202. +#define TCFLSH 0x540B
  3203. +#define TIOCEXCL 0x540C
  3204. +#define TIOCNXCL 0x540D
  3205. +#define TIOCSCTTY 0x540E
  3206. +#define TIOCGPGRP 0x540F
  3207. +#define TIOCSPGRP 0x5410
  3208. +#define TIOCOUTQ 0x5411
  3209. +#define TIOCSTI 0x5412
  3210. +#define TIOCGWINSZ 0x5413
  3211. +#define TIOCSWINSZ 0x5414
  3212. +#define TIOCMGET 0x5415
  3213. +#define TIOCMBIS 0x5416
  3214. +#define TIOCMBIC 0x5417
  3215. +#define TIOCMSET 0x5418
  3216. +#define TIOCGSOFTCAR 0x5419
  3217. +#define TIOCSSOFTCAR 0x541A
  3218. +#define FIONREAD 0x541B
  3219. +#define TIOCINQ FIONREAD
  3220. +#define TIOCLINUX 0x541C
  3221. +#define TIOCCONS 0x541D
  3222. +#define TIOCGSERIAL 0x541E
  3223. +#define TIOCSSERIAL 0x541F
  3224. +#define TIOCPKT 0x5420
  3225. +#define FIONBIO 0x5421
  3226. +#define TIOCNOTTY 0x5422
  3227. +#define TIOCSETD 0x5423
  3228. +#define TIOCGETD 0x5424
  3229. +#define TCSBRKP 0x5425
  3230. +#define TIOCTTYGSTRUCT 0x5426
  3231. +#define TIOCSBRK 0x5427
  3232. +#define TIOCCBRK 0x5428
  3233. +#define TIOCGSID 0x5429
  3234. +#define TIOCGPTN 0x80045430
  3235. +#define TIOCSPTLCK 0x40045431
  3236. +#define TCGETX 0x5432
  3237. +#define TCSETX 0x5433
  3238. +#define TCSETXF 0x5434
  3239. +#define TCSETXW 0x5435
  3240. +
  3241. +#define FIONCLEX 0x5450
  3242. +#define FIOCLEX 0x5451
  3243. +#define FIOASYNC 0x5452
  3244. +#define TIOCSERCONFIG 0x5453
  3245. +#define TIOCSERGWILD 0x5454
  3246. +#define TIOCSERSWILD 0x5455
  3247. +#define TIOCGLCKTRMIOS 0x5456
  3248. +#define TIOCSLCKTRMIOS 0x5457
  3249. +#define TIOCSERGSTRUCT 0x5458
  3250. +#define TIOCSERGETLSR 0x5459
  3251. +#define TIOCSERGETMULTI 0x545A
  3252. +#define TIOCSERSETMULTI 0x545B
  3253. +
  3254. +#define TIOCMIWAIT 0x545C
  3255. +#define TIOCGICOUNT 0x545D
  3256. +#define TIOCGHAYESESP 0x545E
  3257. +#define TIOCSHAYESESP 0x545F
  3258. +#define FIOQSIZE 0x5460
  3259. +
  3260. +#define TIOCPKT_DATA 0
  3261. +#define TIOCPKT_FLUSHREAD 1
  3262. +#define TIOCPKT_FLUSHWRITE 2
  3263. +#define TIOCPKT_STOP 4
  3264. +#define TIOCPKT_START 8
  3265. +#define TIOCPKT_NOSTOP 16
  3266. +#define TIOCPKT_DOSTOP 32
  3267. +#define TIOCPKT_IOCTL 64
  3268. +
  3269. +#define TIOCSER_TEMT 0x01
  3270. +
  3271. +struct winsize {
  3272. + unsigned short ws_row;
  3273. + unsigned short ws_col;
  3274. + unsigned short ws_xpixel;
  3275. + unsigned short ws_ypixel;
  3276. +};
  3277. +
  3278. +#define TIOCM_LE 0x001
  3279. +#define TIOCM_DTR 0x002
  3280. +#define TIOCM_RTS 0x004
  3281. +#define TIOCM_ST 0x008
  3282. +#define TIOCM_SR 0x010
  3283. +#define TIOCM_CTS 0x020
  3284. +#define TIOCM_CAR 0x040
  3285. +#define TIOCM_RNG 0x080
  3286. +#define TIOCM_DSR 0x100
  3287. +#define TIOCM_CD TIOCM_CAR
  3288. +#define TIOCM_RI TIOCM_RNG
  3289. +#define TIOCM_OUT1 0x2000
  3290. +#define TIOCM_OUT2 0x4000
  3291. +#define TIOCM_LOOP 0x8000
  3292. +#define TIOCM_MODEM_BITS TIOCM_OUT2
  3293. +
  3294. +#define N_TTY 0
  3295. +#define N_SLIP 1
  3296. +#define N_MOUSE 2
  3297. +#define N_PPP 3
  3298. +#define N_STRIP 4
  3299. +#define N_AX25 5
  3300. +#define N_X25 6
  3301. +#define N_6PACK 7
  3302. +#define N_MASC 8
  3303. +#define N_R3964 9
  3304. +#define N_PROFIBUS_FDL 10
  3305. +#define N_IRDA 11
  3306. +#define N_SMSBLOCK 12
  3307. +#define N_HDLC 13
  3308. +#define N_SYNC_PPP 14
  3309. +#define N_HCI 15
  3310. +
  3311. +#define FIOSETOWN 0x8901
  3312. +#define SIOCSPGRP 0x8902
  3313. +#define FIOGETOWN 0x8903
  3314. +#define SIOCGPGRP 0x8904
  3315. +#define SIOCATMARK 0x8905
  3316. +#define SIOCGSTAMP 0x8906
  3317. +
  3318. +#define SIOCADDRT 0x890B
  3319. +#define SIOCDELRT 0x890C
  3320. +#define SIOCRTMSG 0x890D
  3321. +
  3322. +#define SIOCGIFNAME 0x8910
  3323. +#define SIOCSIFLINK 0x8911
  3324. +#define SIOCGIFCONF 0x8912
  3325. +#define SIOCGIFFLAGS 0x8913
  3326. +#define SIOCSIFFLAGS 0x8914
  3327. +#define SIOCGIFADDR 0x8915
  3328. +#define SIOCSIFADDR 0x8916
  3329. +#define SIOCGIFDSTADDR 0x8917
  3330. +#define SIOCSIFDSTADDR 0x8918
  3331. +#define SIOCGIFBRDADDR 0x8919
  3332. +#define SIOCSIFBRDADDR 0x891a
  3333. +#define SIOCGIFNETMASK 0x891b
  3334. +#define SIOCSIFNETMASK 0x891c
  3335. +#define SIOCGIFMETRIC 0x891d
  3336. +#define SIOCSIFMETRIC 0x891e
  3337. +#define SIOCGIFMEM 0x891f
  3338. +#define SIOCSIFMEM 0x8920
  3339. +#define SIOCGIFMTU 0x8921
  3340. +#define SIOCSIFMTU 0x8922
  3341. +#define SIOCSIFHWADDR 0x8924
  3342. +#define SIOCGIFENCAP 0x8925
  3343. +#define SIOCSIFENCAP 0x8926
  3344. +#define SIOCGIFHWADDR 0x8927
  3345. +#define SIOCGIFSLAVE 0x8929
  3346. +#define SIOCSIFSLAVE 0x8930
  3347. +#define SIOCADDMULTI 0x8931
  3348. +#define SIOCDELMULTI 0x8932
  3349. +#define SIOCGIFINDEX 0x8933
  3350. +#define SIOGIFINDEX SIOCGIFINDEX
  3351. +#define SIOCSIFPFLAGS 0x8934
  3352. +#define SIOCGIFPFLAGS 0x8935
  3353. +#define SIOCDIFADDR 0x8936
  3354. +#define SIOCSIFHWBROADCAST 0x8937
  3355. +#define SIOCGIFCOUNT 0x8938
  3356. +
  3357. +#define SIOCGIFBR 0x8940
  3358. +#define SIOCSIFBR 0x8941
  3359. +
  3360. +#define SIOCGIFTXQLEN 0x8942
  3361. +#define SIOCSIFTXQLEN 0x8943
  3362. +
  3363. +#define SIOCDARP 0x8953
  3364. +#define SIOCGARP 0x8954
  3365. +#define SIOCSARP 0x8955
  3366. +
  3367. +#define SIOCDRARP 0x8960
  3368. +#define SIOCGRARP 0x8961
  3369. +#define SIOCSRARP 0x8962
  3370. +
  3371. +#define SIOCGIFMAP 0x8970
  3372. +#define SIOCSIFMAP 0x8971
  3373. +
  3374. +#define SIOCADDDLCI 0x8980
  3375. +#define SIOCDELDLCI 0x8981
  3376. +
  3377. +#define SIOCDEVPRIVATE 0x89F0
  3378. +#define SIOCPROTOPRIVATE 0x89E0
  3379. diff -Nur musl-0.9.15/arch/x32/bits/io.h musl-git/arch/x32/bits/io.h
  3380. --- musl-0.9.15/arch/x32/bits/io.h 1970-01-01 01:00:00.000000000 +0100
  3381. +++ musl-git/arch/x32/bits/io.h 2014-03-17 16:49:44.000000000 +0100
  3382. @@ -0,0 +1,77 @@
  3383. +static __inline void outb(unsigned char __val, unsigned short __port)
  3384. +{
  3385. + __asm__ volatile ("outb %0,%1" : : "a" (__val), "dN" (__port));
  3386. +}
  3387. +
  3388. +static __inline void outw(unsigned short __val, unsigned short __port)
  3389. +{
  3390. + __asm__ volatile ("outw %0,%1" : : "a" (__val), "dN" (__port));
  3391. +}
  3392. +
  3393. +static __inline void outl(unsigned int __val, unsigned short __port)
  3394. +{
  3395. + __asm__ volatile ("outl %0,%1" : : "a" (__val), "dN" (__port));
  3396. +}
  3397. +
  3398. +static __inline unsigned char inb(unsigned short __port)
  3399. +{
  3400. + unsigned char __val;
  3401. + __asm__ volatile ("inb %1,%0" : "=a" (__val) : "dN" (__port));
  3402. + return __val;
  3403. +}
  3404. +
  3405. +static __inline unsigned short inw(unsigned short __port)
  3406. +{
  3407. + unsigned short __val;
  3408. + __asm__ volatile ("inw %1,%0" : "=a" (__val) : "dN" (__port));
  3409. + return __val;
  3410. +}
  3411. +
  3412. +static __inline unsigned int inl(unsigned short __port)
  3413. +{
  3414. + unsigned int __val;
  3415. + __asm__ volatile ("inl %1,%0" : "=a" (__val) : "dN" (__port));
  3416. + return __val;
  3417. +}
  3418. +
  3419. +static __inline void outsb(unsigned short __port, const void *__buf, unsigned long __n)
  3420. +{
  3421. + __asm__ volatile ("cld; rep; outsb"
  3422. + : "+S" (__buf), "+c" (__n)
  3423. + : "d" (__port));
  3424. +}
  3425. +
  3426. +static __inline void outsw(unsigned short __port, const void *__buf, unsigned long __n)
  3427. +{
  3428. + __asm__ volatile ("cld; rep; outsw"
  3429. + : "+S" (__buf), "+c" (__n)
  3430. + : "d" (__port));
  3431. +}
  3432. +
  3433. +static __inline void outsl(unsigned short __port, const void *__buf, unsigned long __n)
  3434. +{
  3435. + __asm__ volatile ("cld; rep; outsl"
  3436. + : "+S" (__buf), "+c"(__n)
  3437. + : "d" (__port));
  3438. +}
  3439. +
  3440. +static __inline void insb(unsigned short __port, void *__buf, unsigned long __n)
  3441. +{
  3442. + __asm__ volatile ("cld; rep; insb"
  3443. + : "+D" (__buf), "+c" (__n)
  3444. + : "d" (__port));
  3445. +}
  3446. +
  3447. +static __inline void insw(unsigned short __port, void *__buf, unsigned long __n)
  3448. +{
  3449. + __asm__ volatile ("cld; rep; insw"
  3450. + : "+D" (__buf), "+c" (__n)
  3451. + : "d" (__port));
  3452. +}
  3453. +
  3454. +static __inline void insl(unsigned short __port, void *__buf, unsigned long __n)
  3455. +{
  3456. + __asm__ volatile ("cld; rep; insl"
  3457. + : "+D" (__buf), "+c" (__n)
  3458. + : "d" (__port));
  3459. +}
  3460. diff -Nur musl-0.9.15/arch/x32/bits/ipc.h musl-git/arch/x32/bits/ipc.h
  3461. --- musl-0.9.15/arch/x32/bits/ipc.h 1970-01-01 01:00:00.000000000 +0100
  3462. +++ musl-git/arch/x32/bits/ipc.h 2014-03-17 16:49:44.000000000 +0100
  3463. @@ -0,0 +1,14 @@
  3464. +struct ipc_perm
  3465. +{
  3466. + key_t __ipc_perm_key;
  3467. + uid_t uid;
  3468. + gid_t gid;
  3469. + uid_t cuid;
  3470. + gid_t cgid;
  3471. + mode_t mode;
  3472. + int __ipc_perm_seq;
  3473. + long long __pad1;
  3474. + long long __pad2;
  3475. +};
  3476. +
  3477. +#define IPC_64 0
  3478. diff -Nur musl-0.9.15/arch/x32/bits/limits.h musl-git/arch/x32/bits/limits.h
  3479. --- musl-0.9.15/arch/x32/bits/limits.h 1970-01-01 01:00:00.000000000 +0100
  3480. +++ musl-git/arch/x32/bits/limits.h 2014-03-17 16:49:44.000000000 +0100
  3481. @@ -0,0 +1,8 @@
  3482. +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  3483. + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  3484. +#define PAGE_SIZE 4096
  3485. +#define LONG_BIT 32
  3486. +#endif
  3487. +
  3488. +#define LONG_MAX 0x7fffffffL
  3489. +#define LLONG_MAX 0x7fffffffffffffffLL
  3490. diff -Nur musl-0.9.15/arch/x32/bits/mman.h musl-git/arch/x32/bits/mman.h
  3491. --- musl-0.9.15/arch/x32/bits/mman.h 1970-01-01 01:00:00.000000000 +0100
  3492. +++ musl-git/arch/x32/bits/mman.h 2014-03-17 16:49:44.000000000 +0100
  3493. @@ -0,0 +1,62 @@
  3494. +#define MAP_FAILED ((void *) -1)
  3495. +
  3496. +#define PROT_NONE 0
  3497. +#define PROT_READ 1
  3498. +#define PROT_WRITE 2
  3499. +#define PROT_EXEC 4
  3500. +#define PROT_GROWSDOWN 0x01000000
  3501. +#define PROT_GROWSUP 0x02000000
  3502. +
  3503. +#define MAP_SHARED 0x01
  3504. +#define MAP_PRIVATE 0x02
  3505. +#define MAP_FIXED 0x10
  3506. +
  3507. +#define MAP_TYPE 0x0f
  3508. +#define MAP_FILE 0x00
  3509. +#define MAP_ANON 0x20
  3510. +#define MAP_ANONYMOUS MAP_ANON
  3511. +#define MAP_32BIT 0x40
  3512. +#define MAP_NORESERVE 0x4000
  3513. +#define MAP_GROWSDOWN 0x0100
  3514. +#define MAP_DENYWRITE 0x0800
  3515. +#define MAP_EXECUTABLE 0x1000
  3516. +#define MAP_LOCKED 0x2000
  3517. +#define MAP_POPULATE 0x8000
  3518. +#define MAP_NONBLOCK 0x10000
  3519. +#define MAP_STACK 0x20000
  3520. +#define MAP_HUGETLB 0x40000
  3521. +
  3522. +#define POSIX_MADV_NORMAL 0
  3523. +#define POSIX_MADV_RANDOM 1
  3524. +#define POSIX_MADV_SEQUENTIAL 2
  3525. +#define POSIX_MADV_WILLNEED 3
  3526. +#define POSIX_MADV_DONTNEED 0
  3527. +
  3528. +#define MS_ASYNC 1
  3529. +#define MS_INVALIDATE 2
  3530. +#define MS_SYNC 4
  3531. +
  3532. +#define MCL_CURRENT 1
  3533. +#define MCL_FUTURE 2
  3534. +
  3535. +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  3536. +#define MADV_NORMAL 0
  3537. +#define MADV_RANDOM 1
  3538. +#define MADV_SEQUENTIAL 2
  3539. +#define MADV_WILLNEED 3
  3540. +#define MADV_DONTNEED 4
  3541. +#define MADV_REMOVE 9
  3542. +#define MADV_DONTFORK 10
  3543. +#define MADV_DOFORK 11
  3544. +#define MADV_MERGEABLE 12
  3545. +#define MADV_UNMERGEABLE 13
  3546. +#define MADV_HUGEPAGE 14
  3547. +#define MADV_NOHUGEPAGE 15
  3548. +#define MADV_DONTDUMP 16
  3549. +#define MADV_DODUMP 17
  3550. +#define MADV_HWPOISON 100
  3551. +#define MADV_SOFT_OFFLINE 101
  3552. +
  3553. +#define MREMAP_MAYMOVE 1
  3554. +#define MREMAP_FIXED 2
  3555. +#endif
  3556. diff -Nur musl-0.9.15/arch/x32/bits/msg.h musl-git/arch/x32/bits/msg.h
  3557. --- musl-0.9.15/arch/x32/bits/msg.h 1970-01-01 01:00:00.000000000 +0100
  3558. +++ musl-git/arch/x32/bits/msg.h 2014-03-17 16:49:44.000000000 +0100
  3559. @@ -0,0 +1,16 @@
  3560. +struct msqid_ds
  3561. +{
  3562. + struct ipc_perm msg_perm;
  3563. + time_t msg_stime;
  3564. + time_t msg_rtime;
  3565. + time_t msg_ctime;
  3566. + unsigned long msg_cbytes;
  3567. + long __unused1;
  3568. + msgqnum_t msg_qnum;
  3569. + long __unused2;
  3570. + msglen_t msg_qbytes;
  3571. + long __unused3;
  3572. + pid_t msg_lspid;
  3573. + pid_t msg_lrpid;
  3574. + unsigned long long __unused[2];
  3575. +};
  3576. diff -Nur musl-0.9.15/arch/x32/bits/posix.h musl-git/arch/x32/bits/posix.h
  3577. --- musl-0.9.15/arch/x32/bits/posix.h 1970-01-01 01:00:00.000000000 +0100
  3578. +++ musl-git/arch/x32/bits/posix.h 2014-03-17 16:49:44.000000000 +0100
  3579. @@ -0,0 +1,2 @@
  3580. +#define _POSIX_V6_LP64_OFF64 1
  3581. +#define _POSIX_V7_LP64_OFF64 1
  3582. diff -Nur musl-0.9.15/arch/x32/bits/reg.h musl-git/arch/x32/bits/reg.h
  3583. --- musl-0.9.15/arch/x32/bits/reg.h 1970-01-01 01:00:00.000000000 +0100
  3584. +++ musl-git/arch/x32/bits/reg.h 2014-03-17 16:49:44.000000000 +0100
  3585. @@ -0,0 +1,29 @@
  3586. +#undef __WORDSIZE
  3587. +#define __WORDSIZE 32
  3588. +#define R15 0
  3589. +#define R14 1
  3590. +#define R13 2
  3591. +#define R12 3
  3592. +#define RBP 4
  3593. +#define RBX 5
  3594. +#define R11 6
  3595. +#define R10 7
  3596. +#define R9 8
  3597. +#define R8 9
  3598. +#define RAX 10
  3599. +#define RCX 11
  3600. +#define RDX 12
  3601. +#define RSI 13
  3602. +#define RDI 14
  3603. +#define ORIG_RAX 15
  3604. +#define RIP 16
  3605. +#define CS 17
  3606. +#define EFLAGS 18
  3607. +#define RSP 19
  3608. +#define SS 20
  3609. +#define FS_BASE 21
  3610. +#define GS_BASE 22
  3611. +#define DS 23
  3612. +#define ES 24
  3613. +#define FS 25
  3614. +#define GS 26
  3615. diff -Nur musl-0.9.15/arch/x32/bits/sem.h musl-git/arch/x32/bits/sem.h
  3616. --- musl-0.9.15/arch/x32/bits/sem.h 1970-01-01 01:00:00.000000000 +0100
  3617. +++ musl-git/arch/x32/bits/sem.h 2014-03-17 16:49:44.000000000 +0100
  3618. @@ -0,0 +1,16 @@
  3619. +struct semid_ds {
  3620. + struct ipc_perm sem_perm;
  3621. + time_t sem_otime;
  3622. + time_t __unused1;
  3623. + time_t sem_ctime;
  3624. + time_t __unused2;
  3625. +#if __BYTE_ORDER == __LITTLE_ENDIAN
  3626. + unsigned short sem_nsems;
  3627. + char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
  3628. +#else
  3629. + char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
  3630. + unsigned short sem_nsems;
  3631. +#endif
  3632. + time_t __unused3;
  3633. + time_t __unused4;
  3634. +};
  3635. diff -Nur musl-0.9.15/arch/x32/bits/setjmp.h musl-git/arch/x32/bits/setjmp.h
  3636. --- musl-0.9.15/arch/x32/bits/setjmp.h 1970-01-01 01:00:00.000000000 +0100
  3637. +++ musl-git/arch/x32/bits/setjmp.h 2014-03-17 16:49:44.000000000 +0100
  3638. @@ -0,0 +1 @@
  3639. +typedef unsigned long long __jmp_buf[8];
  3640. diff -Nur musl-0.9.15/arch/x32/bits/shm.h musl-git/arch/x32/bits/shm.h
  3641. --- musl-0.9.15/arch/x32/bits/shm.h 1970-01-01 01:00:00.000000000 +0100
  3642. +++ musl-git/arch/x32/bits/shm.h 2014-03-17 16:49:44.000000000 +0100
  3643. @@ -0,0 +1,33 @@
  3644. +#define SHMLBA 4096
  3645. +
  3646. +struct shmid_ds
  3647. +{
  3648. + struct ipc_perm shm_perm;
  3649. + size_t shm_segsz;
  3650. + time_t shm_atime;
  3651. + time_t shm_dtime;
  3652. + time_t shm_ctime;
  3653. + pid_t shm_cpid;
  3654. + pid_t shm_lpid;
  3655. + unsigned long shm_nattch;
  3656. + unsigned long __pad0;
  3657. + unsigned long long __pad1;
  3658. + unsigned long long __pad2;
  3659. +};
  3660. +
  3661. +struct shminfo {
  3662. + unsigned long shmmax, __pad0, shmmin, __pad1, shmmni, __pad2,
  3663. + shmseg, __pad3, shmall, __pad4;
  3664. + unsigned long long __unused[4];
  3665. +};
  3666. +
  3667. +struct shm_info {
  3668. + int __used_ids;
  3669. + int __pad_ids;
  3670. + unsigned long shm_tot, __pad0, shm_rss, __pad1, shm_swp, __pad2;
  3671. + unsigned long __swap_attempts, __pad3, __swap_successes, __pad4;
  3672. +}
  3673. +#ifdef __GNUC__
  3674. +__attribute__((__aligned__(8)))
  3675. +#endif
  3676. +;
  3677. diff -Nur musl-0.9.15/arch/x32/bits/signal.h musl-git/arch/x32/bits/signal.h
  3678. --- musl-0.9.15/arch/x32/bits/signal.h 1970-01-01 01:00:00.000000000 +0100
  3679. +++ musl-git/arch/x32/bits/signal.h 2014-03-17 16:49:44.000000000 +0100
  3680. @@ -0,0 +1,119 @@
  3681. +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  3682. + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  3683. +
  3684. +#ifdef _GNU_SOURCE
  3685. +#define REG_R8 0
  3686. +#define REG_R9 1
  3687. +#define REG_R10 2
  3688. +#define REG_R11 3
  3689. +#define REG_R12 4
  3690. +#define REG_R13 5
  3691. +#define REG_R14 6
  3692. +#define REG_R15 7
  3693. +#define REG_RDI 8
  3694. +#define REG_RSI 9
  3695. +#define REG_RBP 10
  3696. +#define REG_RBX 11
  3697. +#define REG_RDX 12
  3698. +#define REG_RAX 13
  3699. +#define REG_RCX 14
  3700. +#define REG_RSP 15
  3701. +#define REG_RIP 16
  3702. +#define REG_EFL 17
  3703. +#define REG_CSGSFS 18
  3704. +#define REG_ERR 19
  3705. +#define REG_TRAPNO 20
  3706. +#define REG_OLDMASK 21
  3707. +#define REG_CR2 22
  3708. +#endif
  3709. +
  3710. +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  3711. +typedef long long greg_t, gregset_t[23];
  3712. +typedef struct _fpstate {
  3713. + unsigned short cwd, swd, ftw, fop;
  3714. + unsigned long long rip, rdp;
  3715. + unsigned mxcsr, mxcr_mask;
  3716. + struct {
  3717. + unsigned short significand[4], exponent, padding[3];
  3718. + } _st[8];
  3719. + struct {
  3720. + unsigned element[4];
  3721. + } _xmm[16];
  3722. + unsigned padding[24];
  3723. +} *fpregset_t;
  3724. +struct sigcontext {
  3725. + unsigned long long r8, r9, r10, r11, r12, r13, r14, r15;
  3726. + unsigned long long rdi, rsi, rbp, rbx, rdx, rax, rcx, rsp, rip, eflags;
  3727. + unsigned short cs, gs, fs, __pad0;
  3728. + unsigned long long err, trapno, oldmask, cr2;
  3729. + struct _fpstate *fpstate;
  3730. + unsigned long long __reserved1[8];
  3731. +};
  3732. +typedef struct {
  3733. + gregset_t gregs;
  3734. + fpregset_t fpregs;
  3735. + unsigned long long __reserved1[8];
  3736. +} mcontext_t;
  3737. +#else
  3738. +typedef struct {
  3739. + unsigned long long __space[32];
  3740. +} mcontext_t;
  3741. +#endif
  3742. +
  3743. +typedef struct __ucontext {
  3744. + unsigned long uc_flags;
  3745. + struct __ucontext *uc_link;
  3746. + stack_t uc_stack;
  3747. + mcontext_t uc_mcontext;
  3748. + sigset_t uc_sigmask;
  3749. + unsigned long long __fpregs_mem[64];
  3750. +} ucontext_t;
  3751. +
  3752. +#define SA_NOCLDSTOP 1
  3753. +#define SA_NOCLDWAIT 2
  3754. +#define SA_SIGINFO 4
  3755. +#define SA_ONSTACK 0x08000000
  3756. +#define SA_RESTART 0x10000000
  3757. +#define SA_NODEFER 0x40000000
  3758. +#define SA_RESETHAND 0x80000000
  3759. +#define SA_RESTORER 0x04000000
  3760. +
  3761. +#endif
  3762. +
  3763. +#define SIGHUP 1
  3764. +#define SIGINT 2
  3765. +#define SIGQUIT 3
  3766. +#define SIGILL 4
  3767. +#define SIGTRAP 5
  3768. +#define SIGABRT 6
  3769. +#define SIGIOT SIGABRT
  3770. +#define SIGBUS 7
  3771. +#define SIGFPE 8
  3772. +#define SIGKILL 9
  3773. +#define SIGUSR1 10
  3774. +#define SIGSEGV 11
  3775. +#define SIGUSR2 12
  3776. +#define SIGPIPE 13
  3777. +#define SIGALRM 14
  3778. +#define SIGTERM 15
  3779. +#define SIGSTKFLT 16
  3780. +#define SIGCHLD 17
  3781. +#define SIGCONT 18
  3782. +#define SIGSTOP 19
  3783. +#define SIGTSTP 20
  3784. +#define SIGTTIN 21
  3785. +#define SIGTTOU 22
  3786. +#define SIGURG 23
  3787. +#define SIGXCPU 24
  3788. +#define SIGXFSZ 25
  3789. +#define SIGVTALRM 26
  3790. +#define SIGPROF 27
  3791. +#define SIGWINCH 28
  3792. +#define SIGIO 29
  3793. +#define SIGPOLL 29
  3794. +#define SIGPWR 30
  3795. +#define SIGSYS 31
  3796. +#define SIGUNUSED SIGSYS
  3797. +
  3798. +#define _NSIG 65
  3799. +
  3800. diff -Nur musl-0.9.15/arch/x32/bits/socket.h musl-git/arch/x32/bits/socket.h
  3801. --- musl-0.9.15/arch/x32/bits/socket.h 1970-01-01 01:00:00.000000000 +0100
  3802. +++ musl-git/arch/x32/bits/socket.h 2014-03-17 16:49:44.000000000 +0100
  3803. @@ -0,0 +1,18 @@
  3804. +struct msghdr
  3805. +{
  3806. + void *msg_name;
  3807. + socklen_t msg_namelen;
  3808. + struct iovec *msg_iov;
  3809. + int msg_iovlen, __pad1;
  3810. + void *msg_control;
  3811. + socklen_t msg_controllen, __pad2;
  3812. + int msg_flags;
  3813. +};
  3814. +
  3815. +struct cmsghdr
  3816. +{
  3817. + socklen_t cmsg_len;
  3818. + int __pad1;
  3819. + int cmsg_level;
  3820. + int cmsg_type;
  3821. +};
  3822. diff -Nur musl-0.9.15/arch/x32/bits/statfs.h musl-git/arch/x32/bits/statfs.h
  3823. --- musl-0.9.15/arch/x32/bits/statfs.h 1970-01-01 01:00:00.000000000 +0100
  3824. +++ musl-git/arch/x32/bits/statfs.h 2014-03-18 13:19:59.000000000 +0100
  3825. @@ -0,0 +1,9 @@
  3826. +struct statfs {
  3827. + unsigned long f_type, __pad0, f_bsize, __pad1;
  3828. + fsblkcnt_t f_blocks, f_bfree, f_bavail;
  3829. + fsfilcnt_t f_files, f_ffree;
  3830. + fsid_t f_fsid;
  3831. + unsigned long f_namelen, __pad2, f_frsize, __pad3;
  3832. + unsigned long f_flags, __pad4;
  3833. + unsigned long long f_spare[4];
  3834. +};
  3835. diff -Nur musl-0.9.15/arch/x32/bits/stat.h musl-git/arch/x32/bits/stat.h
  3836. --- musl-0.9.15/arch/x32/bits/stat.h 1970-01-01 01:00:00.000000000 +0100
  3837. +++ musl-git/arch/x32/bits/stat.h 2014-03-17 16:49:44.000000000 +0100
  3838. @@ -0,0 +1,22 @@
  3839. +/* copied from kernel definition, but with padding replaced
  3840. + * by the corresponding correctly-sized userspace types. */
  3841. +
  3842. +struct stat {
  3843. + dev_t st_dev;
  3844. + ino_t st_ino;
  3845. + nlink_t st_nlink;
  3846. +
  3847. + mode_t st_mode;
  3848. + uid_t st_uid;
  3849. + gid_t st_gid;
  3850. + unsigned int __pad0;
  3851. + dev_t st_rdev;
  3852. + off_t st_size;
  3853. + blksize_t st_blksize;
  3854. + blkcnt_t st_blocks;
  3855. +
  3856. + struct timespec st_atim;
  3857. + struct timespec st_mtim;
  3858. + struct timespec st_ctim;
  3859. + long long __unused[3];
  3860. +};
  3861. diff -Nur musl-0.9.15/arch/x32/bits/stdarg.h musl-git/arch/x32/bits/stdarg.h
  3862. --- musl-0.9.15/arch/x32/bits/stdarg.h 1970-01-01 01:00:00.000000000 +0100
  3863. +++ musl-git/arch/x32/bits/stdarg.h 2014-03-17 16:49:44.000000000 +0100
  3864. @@ -0,0 +1,4 @@
  3865. +#define va_start(v,l) __builtin_va_start(v,l)
  3866. +#define va_end(v) __builtin_va_end(v)
  3867. +#define va_arg(v,l) __builtin_va_arg(v,l)
  3868. +#define va_copy(d,s) __builtin_va_copy(d,s)
  3869. diff -Nur musl-0.9.15/arch/x32/bits/stdint.h musl-git/arch/x32/bits/stdint.h
  3870. --- musl-0.9.15/arch/x32/bits/stdint.h 1970-01-01 01:00:00.000000000 +0100
  3871. +++ musl-git/arch/x32/bits/stdint.h 2014-03-17 16:49:44.000000000 +0100
  3872. @@ -0,0 +1,20 @@
  3873. +typedef int32_t int_fast16_t;
  3874. +typedef int32_t int_fast32_t;
  3875. +typedef uint32_t uint_fast16_t;
  3876. +typedef uint32_t uint_fast32_t;
  3877. +
  3878. +#define INT_FAST16_MIN INT32_MIN
  3879. +#define INT_FAST32_MIN INT32_MIN
  3880. +
  3881. +#define INT_FAST16_MAX INT32_MAX
  3882. +#define INT_FAST32_MAX INT32_MAX
  3883. +
  3884. +#define UINT_FAST16_MAX UINT32_MAX
  3885. +#define UINT_FAST32_MAX UINT32_MAX
  3886. +
  3887. +#define INTPTR_MIN INT32_MIN
  3888. +#define INTPTR_MAX INT32_MAX
  3889. +#define UINTPTR_MAX UINT32_MAX
  3890. +#define PTRDIFF_MIN INT32_MIN
  3891. +#define PTRDIFF_MAX INT32_MAX
  3892. +#define SIZE_MAX UINT32_MAX
  3893. diff -Nur musl-0.9.15/arch/x32/bits/syscall.h musl-git/arch/x32/bits/syscall.h
  3894. --- musl-0.9.15/arch/x32/bits/syscall.h 1970-01-01 01:00:00.000000000 +0100
  3895. +++ musl-git/arch/x32/bits/syscall.h 2014-03-17 16:49:44.000000000 +0100
  3896. @@ -0,0 +1,634 @@
  3897. +#define __X32_SYSCALL_BIT 0x40000000
  3898. +#define __NR_read (__X32_SYSCALL_BIT + 0)
  3899. +#define __NR_write (__X32_SYSCALL_BIT + 1)
  3900. +#define __NR_open (__X32_SYSCALL_BIT + 2)
  3901. +#define __NR_close (__X32_SYSCALL_BIT + 3)
  3902. +#define __NR_stat (__X32_SYSCALL_BIT + 4)
  3903. +#define __NR_fstat (__X32_SYSCALL_BIT + 5)
  3904. +#define __NR_lstat (__X32_SYSCALL_BIT + 6)
  3905. +#define __NR_poll (__X32_SYSCALL_BIT + 7)
  3906. +#define __NR_lseek (__X32_SYSCALL_BIT + 8)
  3907. +#define __NR_mmap (__X32_SYSCALL_BIT + 9)
  3908. +#define __NR_mprotect (__X32_SYSCALL_BIT + 10)
  3909. +#define __NR_munmap (__X32_SYSCALL_BIT + 11)
  3910. +#define __NR_brk (__X32_SYSCALL_BIT + 12)
  3911. +#define __NR_rt_sigprocmask (__X32_SYSCALL_BIT + 14)
  3912. +#define __NR_pread64 (__X32_SYSCALL_BIT + 17)
  3913. +#define __NR_pwrite64 (__X32_SYSCALL_BIT + 18)
  3914. +#define __NR_access (__X32_SYSCALL_BIT + 21)
  3915. +#define __NR_pipe (__X32_SYSCALL_BIT + 22)
  3916. +#define __NR_select (__X32_SYSCALL_BIT + 23)
  3917. +#define __NR_sched_yield (__X32_SYSCALL_BIT + 24)
  3918. +#define __NR_mremap (__X32_SYSCALL_BIT + 25)
  3919. +#define __NR_msync (__X32_SYSCALL_BIT + 26)
  3920. +#define __NR_mincore (__X32_SYSCALL_BIT + 27)
  3921. +#define __NR_madvise (__X32_SYSCALL_BIT + 28)
  3922. +#define __NR_shmget (__X32_SYSCALL_BIT + 29)
  3923. +#define __NR_shmat (__X32_SYSCALL_BIT + 30)
  3924. +#define __NR_shmctl (__X32_SYSCALL_BIT + 31)
  3925. +#define __NR_dup (__X32_SYSCALL_BIT + 32)
  3926. +#define __NR_dup2 (__X32_SYSCALL_BIT + 33)
  3927. +#define __NR_pause (__X32_SYSCALL_BIT + 34)
  3928. +#define __NR_nanosleep (__X32_SYSCALL_BIT + 35)
  3929. +#define __NR_getitimer (__X32_SYSCALL_BIT + 36)
  3930. +#define __NR_alarm (__X32_SYSCALL_BIT + 37)
  3931. +#define __NR_setitimer (__X32_SYSCALL_BIT + 38)
  3932. +#define __NR_getpid (__X32_SYSCALL_BIT + 39)
  3933. +#define __NR_sendfile (__X32_SYSCALL_BIT + 40)
  3934. +#define __NR_socket (__X32_SYSCALL_BIT + 41)
  3935. +#define __NR_connect (__X32_SYSCALL_BIT + 42)
  3936. +#define __NR_accept (__X32_SYSCALL_BIT + 43)
  3937. +#define __NR_sendto (__X32_SYSCALL_BIT + 44)
  3938. +#define __NR_shutdown (__X32_SYSCALL_BIT + 48)
  3939. +#define __NR_bind (__X32_SYSCALL_BIT + 49)
  3940. +#define __NR_listen (__X32_SYSCALL_BIT + 50)
  3941. +#define __NR_getsockname (__X32_SYSCALL_BIT + 51)
  3942. +#define __NR_getpeername (__X32_SYSCALL_BIT + 52)
  3943. +#define __NR_socketpair (__X32_SYSCALL_BIT + 53)
  3944. +#define __NR_clone (__X32_SYSCALL_BIT + 56)
  3945. +#define __NR_fork (__X32_SYSCALL_BIT + 57)
  3946. +#define __NR_vfork (__X32_SYSCALL_BIT + 58)
  3947. +#define __NR_exit (__X32_SYSCALL_BIT + 60)
  3948. +#define __NR_wait4 (__X32_SYSCALL_BIT + 61)
  3949. +#define __NR_kill (__X32_SYSCALL_BIT + 62)
  3950. +#define __NR_uname (__X32_SYSCALL_BIT + 63)
  3951. +#define __NR_semget (__X32_SYSCALL_BIT + 64)
  3952. +#define __NR_semop (__X32_SYSCALL_BIT + 65)
  3953. +#define __NR_semctl (__X32_SYSCALL_BIT + 66)
  3954. +#define __NR_shmdt (__X32_SYSCALL_BIT + 67)
  3955. +#define __NR_msgget (__X32_SYSCALL_BIT + 68)
  3956. +#define __NR_msgsnd (__X32_SYSCALL_BIT + 69)
  3957. +#define __NR_msgrcv (__X32_SYSCALL_BIT + 70)
  3958. +#define __NR_msgctl (__X32_SYSCALL_BIT + 71)
  3959. +#define __NR_fcntl (__X32_SYSCALL_BIT + 72)
  3960. +#define __NR_flock (__X32_SYSCALL_BIT + 73)
  3961. +#define __NR_fsync (__X32_SYSCALL_BIT + 74)
  3962. +#define __NR_fdatasync (__X32_SYSCALL_BIT + 75)
  3963. +#define __NR_truncate (__X32_SYSCALL_BIT + 76)
  3964. +#define __NR_ftruncate (__X32_SYSCALL_BIT + 77)
  3965. +#define __NR_getdents (__X32_SYSCALL_BIT + 78)
  3966. +#define __NR_getcwd (__X32_SYSCALL_BIT + 79)
  3967. +#define __NR_chdir (__X32_SYSCALL_BIT + 80)
  3968. +#define __NR_fchdir (__X32_SYSCALL_BIT + 81)
  3969. +#define __NR_rename (__X32_SYSCALL_BIT + 82)
  3970. +#define __NR_mkdir (__X32_SYSCALL_BIT + 83)
  3971. +#define __NR_rmdir (__X32_SYSCALL_BIT + 84)
  3972. +#define __NR_creat (__X32_SYSCALL_BIT + 85)
  3973. +#define __NR_link (__X32_SYSCALL_BIT + 86)
  3974. +#define __NR_unlink (__X32_SYSCALL_BIT + 87)
  3975. +#define __NR_symlink (__X32_SYSCALL_BIT + 88)
  3976. +#define __NR_readlink (__X32_SYSCALL_BIT + 89)
  3977. +#define __NR_chmod (__X32_SYSCALL_BIT + 90)
  3978. +#define __NR_fchmod (__X32_SYSCALL_BIT + 91)
  3979. +#define __NR_chown (__X32_SYSCALL_BIT + 92)
  3980. +#define __NR_fchown (__X32_SYSCALL_BIT + 93)
  3981. +#define __NR_lchown (__X32_SYSCALL_BIT + 94)
  3982. +#define __NR_umask (__X32_SYSCALL_BIT + 95)
  3983. +#define __NR_gettimeofday (__X32_SYSCALL_BIT + 96)
  3984. +#define __NR_getrlimit (__X32_SYSCALL_BIT + 97)
  3985. +#define __NR_getrusage (__X32_SYSCALL_BIT + 98)
  3986. +#define __NR_sysinfo (__X32_SYSCALL_BIT + 99)
  3987. +#define __NR_times (__X32_SYSCALL_BIT + 100)
  3988. +#define __NR_getuid (__X32_SYSCALL_BIT + 102)
  3989. +#define __NR_syslog (__X32_SYSCALL_BIT + 103)
  3990. +#define __NR_getgid (__X32_SYSCALL_BIT + 104)
  3991. +#define __NR_setuid (__X32_SYSCALL_BIT + 105)
  3992. +#define __NR_setgid (__X32_SYSCALL_BIT + 106)
  3993. +#define __NR_geteuid (__X32_SYSCALL_BIT + 107)
  3994. +#define __NR_getegid (__X32_SYSCALL_BIT + 108)
  3995. +#define __NR_setpgid (__X32_SYSCALL_BIT + 109)
  3996. +#define __NR_getppid (__X32_SYSCALL_BIT + 110)
  3997. +#define __NR_getpgrp (__X32_SYSCALL_BIT + 111)
  3998. +#define __NR_setsid (__X32_SYSCALL_BIT + 112)
  3999. +#define __NR_setreuid (__X32_SYSCALL_BIT + 113)
  4000. +#define __NR_setregid (__X32_SYSCALL_BIT + 114)
  4001. +#define __NR_getgroups (__X32_SYSCALL_BIT + 115)
  4002. +#define __NR_setgroups (__X32_SYSCALL_BIT + 116)
  4003. +#define __NR_setresuid (__X32_SYSCALL_BIT + 117)
  4004. +#define __NR_getresuid (__X32_SYSCALL_BIT + 118)
  4005. +#define __NR_setresgid (__X32_SYSCALL_BIT + 119)
  4006. +#define __NR_getresgid (__X32_SYSCALL_BIT + 120)
  4007. +#define __NR_getpgid (__X32_SYSCALL_BIT + 121)
  4008. +#define __NR_setfsuid (__X32_SYSCALL_BIT + 122)
  4009. +#define __NR_setfsgid (__X32_SYSCALL_BIT + 123)
  4010. +#define __NR_getsid (__X32_SYSCALL_BIT + 124)
  4011. +#define __NR_capget (__X32_SYSCALL_BIT + 125)
  4012. +#define __NR_capset (__X32_SYSCALL_BIT + 126)
  4013. +#define __NR_rt_sigsuspend (__X32_SYSCALL_BIT + 130)
  4014. +#define __NR_utime (__X32_SYSCALL_BIT + 132)
  4015. +#define __NR_mknod (__X32_SYSCALL_BIT + 133)
  4016. +#define __NR_personality (__X32_SYSCALL_BIT + 135)
  4017. +#define __NR_ustat (__X32_SYSCALL_BIT + 136)
  4018. +#define __NR_statfs (__X32_SYSCALL_BIT + 137)
  4019. +#define __NR_fstatfs (__X32_SYSCALL_BIT + 138)
  4020. +#define __NR_sysfs (__X32_SYSCALL_BIT + 139)
  4021. +#define __NR_getpriority (__X32_SYSCALL_BIT + 140)
  4022. +#define __NR_setpriority (__X32_SYSCALL_BIT + 141)
  4023. +#define __NR_sched_setparam (__X32_SYSCALL_BIT + 142)
  4024. +#define __NR_sched_getparam (__X32_SYSCALL_BIT + 143)
  4025. +#define __NR_sched_setscheduler (__X32_SYSCALL_BIT + 144)
  4026. +#define __NR_sched_getscheduler (__X32_SYSCALL_BIT + 145)
  4027. +#define __NR_sched_get_priority_max (__X32_SYSCALL_BIT + 146)
  4028. +#define __NR_sched_get_priority_min (__X32_SYSCALL_BIT + 147)
  4029. +#define __NR_sched_rr_get_interval (__X32_SYSCALL_BIT + 148)
  4030. +#define __NR_mlock (__X32_SYSCALL_BIT + 149)
  4031. +#define __NR_munlock (__X32_SYSCALL_BIT + 150)
  4032. +#define __NR_mlockall (__X32_SYSCALL_BIT + 151)
  4033. +#define __NR_munlockall (__X32_SYSCALL_BIT + 152)
  4034. +#define __NR_vhangup (__X32_SYSCALL_BIT + 153)
  4035. +#define __NR_modify_ldt (__X32_SYSCALL_BIT + 154)
  4036. +#define __NR_pivot_root (__X32_SYSCALL_BIT + 155)
  4037. +#define __NR_prctl (__X32_SYSCALL_BIT + 157)
  4038. +#define __NR_arch_prctl (__X32_SYSCALL_BIT + 158)
  4039. +#define __NR_adjtimex (__X32_SYSCALL_BIT + 159)
  4040. +#define __NR_setrlimit (__X32_SYSCALL_BIT + 160)
  4041. +#define __NR_chroot (__X32_SYSCALL_BIT + 161)
  4042. +#define __NR_sync (__X32_SYSCALL_BIT + 162)
  4043. +#define __NR_acct (__X32_SYSCALL_BIT + 163)
  4044. +#define __NR_settimeofday (__X32_SYSCALL_BIT + 164)
  4045. +#define __NR_mount (__X32_SYSCALL_BIT + 165)
  4046. +#define __NR_umount2 (__X32_SYSCALL_BIT + 166)
  4047. +#define __NR_swapon (__X32_SYSCALL_BIT + 167)
  4048. +#define __NR_swapoff (__X32_SYSCALL_BIT + 168)
  4049. +#define __NR_reboot (__X32_SYSCALL_BIT + 169)
  4050. +#define __NR_sethostname (__X32_SYSCALL_BIT + 170)
  4051. +#define __NR_setdomainname (__X32_SYSCALL_BIT + 171)
  4052. +#define __NR_iopl (__X32_SYSCALL_BIT + 172)
  4053. +#define __NR_ioperm (__X32_SYSCALL_BIT + 173)
  4054. +#define __NR_init_module (__X32_SYSCALL_BIT + 175)
  4055. +#define __NR_delete_module (__X32_SYSCALL_BIT + 176)
  4056. +#define __NR_quotactl (__X32_SYSCALL_BIT + 179)
  4057. +#define __NR_getpmsg (__X32_SYSCALL_BIT + 181)
  4058. +#define __NR_putpmsg (__X32_SYSCALL_BIT + 182)
  4059. +#define __NR_afs_syscall (__X32_SYSCALL_BIT + 183)
  4060. +#define __NR_tuxcall (__X32_SYSCALL_BIT + 184)
  4061. +#define __NR_security (__X32_SYSCALL_BIT + 185)
  4062. +#define __NR_gettid (__X32_SYSCALL_BIT + 186)
  4063. +#define __NR_readahead (__X32_SYSCALL_BIT + 187)
  4064. +#define __NR_setxattr (__X32_SYSCALL_BIT + 188)
  4065. +#define __NR_lsetxattr (__X32_SYSCALL_BIT + 189)
  4066. +#define __NR_fsetxattr (__X32_SYSCALL_BIT + 190)
  4067. +#define __NR_getxattr (__X32_SYSCALL_BIT + 191)
  4068. +#define __NR_lgetxattr (__X32_SYSCALL_BIT + 192)
  4069. +#define __NR_fgetxattr (__X32_SYSCALL_BIT + 193)
  4070. +#define __NR_listxattr (__X32_SYSCALL_BIT + 194)
  4071. +#define __NR_llistxattr (__X32_SYSCALL_BIT + 195)
  4072. +#define __NR_flistxattr (__X32_SYSCALL_BIT + 196)
  4073. +#define __NR_removexattr (__X32_SYSCALL_BIT + 197)
  4074. +#define __NR_lremovexattr (__X32_SYSCALL_BIT + 198)
  4075. +#define __NR_fremovexattr (__X32_SYSCALL_BIT + 199)
  4076. +#define __NR_tkill (__X32_SYSCALL_BIT + 200)
  4077. +#define __NR_time (__X32_SYSCALL_BIT + 201)
  4078. +#define __NR_futex (__X32_SYSCALL_BIT + 202)
  4079. +#define __NR_sched_setaffinity (__X32_SYSCALL_BIT + 203)
  4080. +#define __NR_sched_getaffinity (__X32_SYSCALL_BIT + 204)
  4081. +#define __NR_io_setup (__X32_SYSCALL_BIT + 206)
  4082. +#define __NR_io_destroy (__X32_SYSCALL_BIT + 207)
  4083. +#define __NR_io_getevents (__X32_SYSCALL_BIT + 208)
  4084. +#define __NR_io_submit (__X32_SYSCALL_BIT + 209)
  4085. +#define __NR_io_cancel (__X32_SYSCALL_BIT + 210)
  4086. +#define __NR_lookup_dcookie (__X32_SYSCALL_BIT + 212)
  4087. +#define __NR_epoll_create (__X32_SYSCALL_BIT + 213)
  4088. +#define __NR_remap_file_pages (__X32_SYSCALL_BIT + 216)
  4089. +#define __NR_getdents64 (__X32_SYSCALL_BIT + 217)
  4090. +#define __NR_set_tid_address (__X32_SYSCALL_BIT + 218)
  4091. +#define __NR_restart_syscall (__X32_SYSCALL_BIT + 219)
  4092. +#define __NR_semtimedop (__X32_SYSCALL_BIT + 220)
  4093. +#define __NR_fadvise64 (__X32_SYSCALL_BIT + 221)
  4094. +#define __NR_timer_settime (__X32_SYSCALL_BIT + 223)
  4095. +#define __NR_timer_gettime (__X32_SYSCALL_BIT + 224)
  4096. +#define __NR_timer_getoverrun (__X32_SYSCALL_BIT + 225)
  4097. +#define __NR_timer_delete (__X32_SYSCALL_BIT + 226)
  4098. +#define __NR_clock_settime (__X32_SYSCALL_BIT + 227)
  4099. +#define __NR_clock_gettime (__X32_SYSCALL_BIT + 228)
  4100. +#define __NR_clock_getres (__X32_SYSCALL_BIT + 229)
  4101. +#define __NR_clock_nanosleep (__X32_SYSCALL_BIT + 230)
  4102. +#define __NR_exit_group (__X32_SYSCALL_BIT + 231)
  4103. +#define __NR_epoll_wait (__X32_SYSCALL_BIT + 232)
  4104. +#define __NR_epoll_ctl (__X32_SYSCALL_BIT + 233)
  4105. +#define __NR_tgkill (__X32_SYSCALL_BIT + 234)
  4106. +#define __NR_utimes (__X32_SYSCALL_BIT + 235)
  4107. +#define __NR_mbind (__X32_SYSCALL_BIT + 237)
  4108. +#define __NR_set_mempolicy (__X32_SYSCALL_BIT + 238)
  4109. +#define __NR_get_mempolicy (__X32_SYSCALL_BIT + 239)
  4110. +#define __NR_mq_open (__X32_SYSCALL_BIT + 240)
  4111. +#define __NR_mq_unlink (__X32_SYSCALL_BIT + 241)
  4112. +#define __NR_mq_timedsend (__X32_SYSCALL_BIT + 242)
  4113. +#define __NR_mq_timedreceive (__X32_SYSCALL_BIT + 243)
  4114. +#define __NR_mq_getsetattr (__X32_SYSCALL_BIT + 245)
  4115. +#define __NR_add_key (__X32_SYSCALL_BIT + 248)
  4116. +#define __NR_request_key (__X32_SYSCALL_BIT + 249)
  4117. +#define __NR_keyctl (__X32_SYSCALL_BIT + 250)
  4118. +#define __NR_ioprio_set (__X32_SYSCALL_BIT + 251)
  4119. +#define __NR_ioprio_get (__X32_SYSCALL_BIT + 252)
  4120. +#define __NR_inotify_init (__X32_SYSCALL_BIT + 253)
  4121. +#define __NR_inotify_add_watch (__X32_SYSCALL_BIT + 254)
  4122. +#define __NR_inotify_rm_watch (__X32_SYSCALL_BIT + 255)
  4123. +#define __NR_migrate_pages (__X32_SYSCALL_BIT + 256)
  4124. +#define __NR_openat (__X32_SYSCALL_BIT + 257)
  4125. +#define __NR_mkdirat (__X32_SYSCALL_BIT + 258)
  4126. +#define __NR_mknodat (__X32_SYSCALL_BIT + 259)
  4127. +#define __NR_fchownat (__X32_SYSCALL_BIT + 260)
  4128. +#define __NR_futimesat (__X32_SYSCALL_BIT + 261)
  4129. +#define __NR_newfstatat (__X32_SYSCALL_BIT + 262)
  4130. +#define __NR_unlinkat (__X32_SYSCALL_BIT + 263)
  4131. +#define __NR_renameat (__X32_SYSCALL_BIT + 264)
  4132. +#define __NR_linkat (__X32_SYSCALL_BIT + 265)
  4133. +#define __NR_symlinkat (__X32_SYSCALL_BIT + 266)
  4134. +#define __NR_readlinkat (__X32_SYSCALL_BIT + 267)
  4135. +#define __NR_fchmodat (__X32_SYSCALL_BIT + 268)
  4136. +#define __NR_faccessat (__X32_SYSCALL_BIT + 269)
  4137. +#define __NR_pselect6 (__X32_SYSCALL_BIT + 270)
  4138. +#define __NR_ppoll (__X32_SYSCALL_BIT + 271)
  4139. +#define __NR_unshare (__X32_SYSCALL_BIT + 272)
  4140. +#define __NR_splice (__X32_SYSCALL_BIT + 275)
  4141. +#define __NR_tee (__X32_SYSCALL_BIT + 276)
  4142. +#define __NR_sync_file_range (__X32_SYSCALL_BIT + 277)
  4143. +#define __NR_utimensat (__X32_SYSCALL_BIT + 280)
  4144. +#define __NR_epoll_pwait (__X32_SYSCALL_BIT + 281)
  4145. +#define __NR_signalfd (__X32_SYSCALL_BIT + 282)
  4146. +#define __NR_timerfd_create (__X32_SYSCALL_BIT + 283)
  4147. +#define __NR_eventfd (__X32_SYSCALL_BIT + 284)
  4148. +#define __NR_fallocate (__X32_SYSCALL_BIT + 285)
  4149. +#define __NR_timerfd_settime (__X32_SYSCALL_BIT + 286)
  4150. +#define __NR_timerfd_gettime (__X32_SYSCALL_BIT + 287)
  4151. +#define __NR_accept4 (__X32_SYSCALL_BIT + 288)
  4152. +#define __NR_signalfd4 (__X32_SYSCALL_BIT + 289)
  4153. +#define __NR_eventfd2 (__X32_SYSCALL_BIT + 290)
  4154. +#define __NR_epoll_create1 (__X32_SYSCALL_BIT + 291)
  4155. +#define __NR_dup3 (__X32_SYSCALL_BIT + 292)
  4156. +#define __NR_pipe2 (__X32_SYSCALL_BIT + 293)
  4157. +#define __NR_inotify_init1 (__X32_SYSCALL_BIT + 294)
  4158. +#define __NR_perf_event_open (__X32_SYSCALL_BIT + 298)
  4159. +#define __NR_fanotify_init (__X32_SYSCALL_BIT + 300)
  4160. +#define __NR_fanotify_mark (__X32_SYSCALL_BIT + 301)
  4161. +#define __NR_prlimit64 (__X32_SYSCALL_BIT + 302)
  4162. +#define __NR_name_to_handle_at (__X32_SYSCALL_BIT + 303)
  4163. +#define __NR_open_by_handle_at (__X32_SYSCALL_BIT + 304)
  4164. +#define __NR_clock_adjtime (__X32_SYSCALL_BIT + 305)
  4165. +#define __NR_syncfs (__X32_SYSCALL_BIT + 306)
  4166. +#define __NR_setns (__X32_SYSCALL_BIT + 308)
  4167. +#define __NR_getcpu (__X32_SYSCALL_BIT + 309)
  4168. +#define __NR_kcmp (__X32_SYSCALL_BIT + 312)
  4169. +#define __NR_finit_module (__X32_SYSCALL_BIT + 313)
  4170. +#define __NR_rt_sigaction (__X32_SYSCALL_BIT + 512)
  4171. +#define __NR_rt_sigreturn (__X32_SYSCALL_BIT + 513)
  4172. +#define __NR_ioctl (__X32_SYSCALL_BIT + 514)
  4173. +#define __NR_readv (__X32_SYSCALL_BIT + 515)
  4174. +#define __NR_writev (__X32_SYSCALL_BIT + 516)
  4175. +#define __NR_recvfrom (__X32_SYSCALL_BIT + 517)
  4176. +#define __NR_sendmsg (__X32_SYSCALL_BIT + 518)
  4177. +#define __NR_recvmsg (__X32_SYSCALL_BIT + 519)
  4178. +#define __NR_execve (__X32_SYSCALL_BIT + 520)
  4179. +#define __NR_ptrace (__X32_SYSCALL_BIT + 521)
  4180. +#define __NR_rt_sigpending (__X32_SYSCALL_BIT + 522)
  4181. +#define __NR_rt_sigtimedwait (__X32_SYSCALL_BIT + 523)
  4182. +#define __NR_rt_sigqueueinfo (__X32_SYSCALL_BIT + 524)
  4183. +#define __NR_sigaltstack (__X32_SYSCALL_BIT + 525)
  4184. +#define __NR_timer_create (__X32_SYSCALL_BIT + 526)
  4185. +#define __NR_mq_notify (__X32_SYSCALL_BIT + 527)
  4186. +#define __NR_kexec_load (__X32_SYSCALL_BIT + 528)
  4187. +#define __NR_waitid (__X32_SYSCALL_BIT + 529)
  4188. +#define __NR_set_robust_list (__X32_SYSCALL_BIT + 530)
  4189. +#define __NR_get_robust_list (__X32_SYSCALL_BIT + 531)
  4190. +#define __NR_vmsplice (__X32_SYSCALL_BIT + 532)
  4191. +#define __NR_move_pages (__X32_SYSCALL_BIT + 533)
  4192. +#define __NR_preadv (__X32_SYSCALL_BIT + 534)
  4193. +#define __NR_pwritev (__X32_SYSCALL_BIT + 535)
  4194. +#define __NR_rt_tgsigqueueinfo (__X32_SYSCALL_BIT + 536)
  4195. +#define __NR_recvmmsg (__X32_SYSCALL_BIT + 537)
  4196. +#define __NR_sendmmsg (__X32_SYSCALL_BIT + 538)
  4197. +#define __NR_process_vm_readv (__X32_SYSCALL_BIT + 539)
  4198. +#define __NR_process_vm_writev (__X32_SYSCALL_BIT + 540)
  4199. +#define __NR_setsockopt (__X32_SYSCALL_BIT + 541)
  4200. +#define __NR_getsockopt (__X32_SYSCALL_BIT + 542)
  4201. +
  4202. +#undef __NR_fstatat
  4203. +#undef __NR_pread
  4204. +#undef __NR_pwrite
  4205. +#undef __NR_getdents
  4206. +#define __NR_fstatat __NR_newfstatat
  4207. +#define __NR_pread __NR_pread64
  4208. +#define __NR_pwrite __NR_pwrite64
  4209. +#define __NR_getdents __NR_getdents64
  4210. +#define __NR_fadvise __NR_fadvise64
  4211. +
  4212. +
  4213. +
  4214. +/* Repeat with SYS_ prefix */
  4215. +
  4216. +
  4217. +
  4218. +#define SYS_read __NR_read
  4219. +#define SYS_write __NR_write
  4220. +#define SYS_open __NR_open
  4221. +#define SYS_close __NR_close
  4222. +#define SYS_stat __NR_stat
  4223. +#define SYS_fstat __NR_fstat
  4224. +#define SYS_lstat __NR_lstat
  4225. +#define SYS_poll __NR_poll
  4226. +#define SYS_lseek __NR_lseek
  4227. +#define SYS_mmap __NR_mmap
  4228. +#define SYS_mprotect __NR_mprotect
  4229. +#define SYS_munmap __NR_munmap
  4230. +#define SYS_brk __NR_brk
  4231. +#define SYS_rt_sigprocmask __NR_rt_sigprocmask
  4232. +#define SYS_pread64 __NR_pread64
  4233. +#define SYS_pwrite64 __NR_pwrite64
  4234. +#define SYS_access __NR_access
  4235. +#define SYS_pipe __NR_pipe
  4236. +#define SYS_select __NR_select
  4237. +#define SYS_sched_yield __NR_sched_yield
  4238. +#define SYS_mremap __NR_mremap
  4239. +#define SYS_msync __NR_msync
  4240. +#define SYS_mincore __NR_mincore
  4241. +#define SYS_madvise __NR_madvise
  4242. +#define SYS_shmget __NR_shmget
  4243. +#define SYS_shmat __NR_shmat
  4244. +#define SYS_shmctl __NR_shmctl
  4245. +#define SYS_dup __NR_dup
  4246. +#define SYS_dup2 __NR_dup2
  4247. +#define SYS_pause __NR_pause
  4248. +#define SYS_nanosleep __NR_nanosleep
  4249. +#define SYS_getitimer __NR_getitimer
  4250. +#define SYS_alarm __NR_alarm
  4251. +#define SYS_setitimer __NR_setitimer
  4252. +#define SYS_getpid __NR_getpid
  4253. +#define SYS_sendfile __NR_sendfile
  4254. +#define SYS_socket __NR_socket
  4255. +#define SYS_connect __NR_connect
  4256. +#define SYS_accept __NR_accept
  4257. +#define SYS_sendto __NR_sendto
  4258. +#define SYS_shutdown __NR_shutdown
  4259. +#define SYS_bind __NR_bind
  4260. +#define SYS_listen __NR_listen
  4261. +#define SYS_getsockname __NR_getsockname
  4262. +#define SYS_getpeername __NR_getpeername
  4263. +#define SYS_socketpair __NR_socketpair
  4264. +#define SYS_clone __NR_clone
  4265. +#define SYS_fork __NR_fork
  4266. +#define SYS_vfork __NR_vfork
  4267. +#define SYS_exit __NR_exit
  4268. +#define SYS_wait4 __NR_wait4
  4269. +#define SYS_kill __NR_kill
  4270. +#define SYS_uname __NR_uname
  4271. +#define SYS_semget __NR_semget
  4272. +#define SYS_semop __NR_semop
  4273. +#define SYS_semctl __NR_semctl
  4274. +#define SYS_shmdt __NR_shmdt
  4275. +#define SYS_msgget __NR_msgget
  4276. +#define SYS_msgsnd __NR_msgsnd
  4277. +#define SYS_msgrcv __NR_msgrcv
  4278. +#define SYS_msgctl __NR_msgctl
  4279. +#define SYS_fcntl __NR_fcntl
  4280. +#define SYS_flock __NR_flock
  4281. +#define SYS_fsync __NR_fsync
  4282. +#define SYS_fdatasync __NR_fdatasync
  4283. +#define SYS_truncate __NR_truncate
  4284. +#define SYS_ftruncate __NR_ftruncate
  4285. +#define SYS_getdents __NR_getdents
  4286. +#define SYS_getcwd __NR_getcwd
  4287. +#define SYS_chdir __NR_chdir
  4288. +#define SYS_fchdir __NR_fchdir
  4289. +#define SYS_rename __NR_rename
  4290. +#define SYS_mkdir __NR_mkdir
  4291. +#define SYS_rmdir __NR_rmdir
  4292. +#define SYS_creat __NR_creat
  4293. +#define SYS_link __NR_link
  4294. +#define SYS_unlink __NR_unlink
  4295. +#define SYS_symlink __NR_symlink
  4296. +#define SYS_readlink __NR_readlink
  4297. +#define SYS_chmod __NR_chmod
  4298. +#define SYS_fchmod __NR_fchmod
  4299. +#define SYS_chown __NR_chown
  4300. +#define SYS_fchown __NR_fchown
  4301. +#define SYS_lchown __NR_lchown
  4302. +#define SYS_umask __NR_umask
  4303. +#define SYS_gettimeofday __NR_gettimeofday
  4304. +#define SYS_getrlimit __NR_getrlimit
  4305. +#define SYS_getrusage __NR_getrusage
  4306. +#define SYS_sysinfo __NR_sysinfo
  4307. +#define SYS_times __NR_times
  4308. +#define SYS_getuid __NR_getuid
  4309. +#define SYS_syslog __NR_syslog
  4310. +#define SYS_getgid __NR_getgid
  4311. +#define SYS_setuid __NR_setuid
  4312. +#define SYS_setgid __NR_setgid
  4313. +#define SYS_geteuid __NR_geteuid
  4314. +#define SYS_getegid __NR_getegid
  4315. +#define SYS_setpgid __NR_setpgid
  4316. +#define SYS_getppid __NR_getppid
  4317. +#define SYS_getpgrp __NR_getpgrp
  4318. +#define SYS_setsid __NR_setsid
  4319. +#define SYS_setreuid __NR_setreuid
  4320. +#define SYS_setregid __NR_setregid
  4321. +#define SYS_getgroups __NR_getgroups
  4322. +#define SYS_setgroups __NR_setgroups
  4323. +#define SYS_setresuid __NR_setresuid
  4324. +#define SYS_getresuid __NR_getresuid
  4325. +#define SYS_setresgid __NR_setresgid
  4326. +#define SYS_getresgid __NR_getresgid
  4327. +#define SYS_getpgid __NR_getpgid
  4328. +#define SYS_setfsuid __NR_setfsuid
  4329. +#define SYS_setfsgid __NR_setfsgid
  4330. +#define SYS_getsid __NR_getsid
  4331. +#define SYS_capget __NR_capget
  4332. +#define SYS_capset __NR_capset
  4333. +#define SYS_rt_sigsuspend __NR_rt_sigsuspend
  4334. +#define SYS_utime __NR_utime
  4335. +#define SYS_mknod __NR_mknod
  4336. +#define SYS_personality __NR_personality
  4337. +#define SYS_ustat __NR_ustat
  4338. +#define SYS_statfs __NR_statfs
  4339. +#define SYS_fstatfs __NR_fstatfs
  4340. +#define SYS_sysfs __NR_sysfs
  4341. +#define SYS_getpriority __NR_getpriority
  4342. +#define SYS_setpriority __NR_setpriority
  4343. +#define SYS_sched_setparam __NR_sched_setparam
  4344. +#define SYS_sched_getparam __NR_sched_getparam
  4345. +#define SYS_sched_setscheduler __NR_sched_setscheduler
  4346. +#define SYS_sched_getscheduler __NR_sched_getscheduler
  4347. +#define SYS_sched_get_priority_max __NR_sched_get_priority_max
  4348. +#define SYS_sched_get_priority_min __NR_sched_get_priority_min
  4349. +#define SYS_sched_rr_get_interval __NR_sched_rr_get_interval
  4350. +#define SYS_mlock __NR_mlock
  4351. +#define SYS_munlock __NR_munlock
  4352. +#define SYS_mlockall __NR_mlockall
  4353. +#define SYS_munlockall __NR_munlockall
  4354. +#define SYS_vhangup __NR_vhangup
  4355. +#define SYS_modify_ldt __NR_modify_ldt
  4356. +#define SYS_pivot_root __NR_pivot_root
  4357. +#define SYS_prctl __NR_prctl
  4358. +#define SYS_arch_prctl __NR_arch_prctl
  4359. +#define SYS_adjtimex __NR_adjtimex
  4360. +#define SYS_setrlimit __NR_setrlimit
  4361. +#define SYS_chroot __NR_chroot
  4362. +#define SYS_sync __NR_sync
  4363. +#define SYS_acct __NR_acct
  4364. +#define SYS_settimeofday __NR_settimeofday
  4365. +#define SYS_mount __NR_mount
  4366. +#define SYS_umount2 __NR_umount2
  4367. +#define SYS_swapon __NR_swapon
  4368. +#define SYS_swapoff __NR_swapoff
  4369. +#define SYS_reboot __NR_reboot
  4370. +#define SYS_sethostname __NR_sethostname
  4371. +#define SYS_setdomainname __NR_setdomainname
  4372. +#define SYS_iopl __NR_iopl
  4373. +#define SYS_ioperm __NR_ioperm
  4374. +#define SYS_init_module __NR_init_module
  4375. +#define SYS_delete_module __NR_delete_module
  4376. +#define SYS_quotactl __NR_quotactl
  4377. +#define SYS_getpmsg __NR_getpmsg
  4378. +#define SYS_putpmsg __NR_putpmsg
  4379. +#define SYS_afs_syscall __NR_afs_syscall
  4380. +#define SYS_tuxcall __NR_tuxcall
  4381. +#define SYS_security __NR_security
  4382. +#define SYS_gettid __NR_gettid
  4383. +#define SYS_readahead __NR_readahead
  4384. +#define SYS_setxattr __NR_setxattr
  4385. +#define SYS_lsetxattr __NR_lsetxattr
  4386. +#define SYS_fsetxattr __NR_fsetxattr
  4387. +#define SYS_getxattr __NR_getxattr
  4388. +#define SYS_lgetxattr __NR_lgetxattr
  4389. +#define SYS_fgetxattr __NR_fgetxattr
  4390. +#define SYS_listxattr __NR_listxattr
  4391. +#define SYS_llistxattr __NR_llistxattr
  4392. +#define SYS_flistxattr __NR_flistxattr
  4393. +#define SYS_removexattr __NR_removexattr
  4394. +#define SYS_lremovexattr __NR_lremovexattr
  4395. +#define SYS_fremovexattr __NR_fremovexattr
  4396. +#define SYS_tkill __NR_tkill
  4397. +#define SYS_time __NR_time
  4398. +#define SYS_futex __NR_futex
  4399. +#define SYS_sched_setaffinity __NR_sched_setaffinity
  4400. +#define SYS_sched_getaffinity __NR_sched_getaffinity
  4401. +#define SYS_io_setup __NR_io_setup
  4402. +#define SYS_io_destroy __NR_io_destroy
  4403. +#define SYS_io_getevents __NR_io_getevents
  4404. +#define SYS_io_submit __NR_io_submit
  4405. +#define SYS_io_cancel __NR_io_cancel
  4406. +#define SYS_lookup_dcookie __NR_lookup_dcookie
  4407. +#define SYS_epoll_create __NR_epoll_create
  4408. +#define SYS_remap_file_pages __NR_remap_file_pages
  4409. +#define SYS_getdents64 __NR_getdents64
  4410. +#define SYS_set_tid_address __NR_set_tid_address
  4411. +#define SYS_restart_syscall __NR_restart_syscall
  4412. +#define SYS_semtimedop __NR_semtimedop
  4413. +#define SYS_fadvise64 __NR_fadvise64
  4414. +#define SYS_timer_settime __NR_timer_settime
  4415. +#define SYS_timer_gettime __NR_timer_gettime
  4416. +#define SYS_timer_getoverrun __NR_timer_getoverrun
  4417. +#define SYS_timer_delete __NR_timer_delete
  4418. +#define SYS_clock_settime __NR_clock_settime
  4419. +#define SYS_clock_gettime __NR_clock_gettime
  4420. +#define SYS_clock_getres __NR_clock_getres
  4421. +#define SYS_clock_nanosleep __NR_clock_nanosleep
  4422. +#define SYS_exit_group __NR_exit_group
  4423. +#define SYS_epoll_wait __NR_epoll_wait
  4424. +#define SYS_epoll_ctl __NR_epoll_ctl
  4425. +#define SYS_tgkill __NR_tgkill
  4426. +#define SYS_utimes __NR_utimes
  4427. +#define SYS_mbind __NR_mbind
  4428. +#define SYS_set_mempolicy __NR_set_mempolicy
  4429. +#define SYS_get_mempolicy __NR_get_mempolicy
  4430. +#define SYS_mq_open __NR_mq_open
  4431. +#define SYS_mq_unlink __NR_mq_unlink
  4432. +#define SYS_mq_timedsend __NR_mq_timedsend
  4433. +#define SYS_mq_timedreceive __NR_mq_timedreceive
  4434. +#define SYS_mq_getsetattr __NR_mq_getsetattr
  4435. +#define SYS_add_key __NR_add_key
  4436. +#define SYS_request_key __NR_request_key
  4437. +#define SYS_keyctl __NR_keyctl
  4438. +#define SYS_ioprio_set __NR_ioprio_set
  4439. +#define SYS_ioprio_get __NR_ioprio_get
  4440. +#define SYS_inotify_init __NR_inotify_init
  4441. +#define SYS_inotify_add_watch __NR_inotify_add_watch
  4442. +#define SYS_inotify_rm_watch __NR_inotify_rm_watch
  4443. +#define SYS_migrate_pages __NR_migrate_pages
  4444. +#define SYS_openat __NR_openat
  4445. +#define SYS_mkdirat __NR_mkdirat
  4446. +#define SYS_mknodat __NR_mknodat
  4447. +#define SYS_fchownat __NR_fchownat
  4448. +#define SYS_futimesat __NR_futimesat
  4449. +#define SYS_newfstatat __NR_newfstatat
  4450. +#define SYS_unlinkat __NR_unlinkat
  4451. +#define SYS_renameat __NR_renameat
  4452. +#define SYS_linkat __NR_linkat
  4453. +#define SYS_symlinkat __NR_symlinkat
  4454. +#define SYS_readlinkat __NR_readlinkat
  4455. +#define SYS_fchmodat __NR_fchmodat
  4456. +#define SYS_faccessat __NR_faccessat
  4457. +#define SYS_pselect6 __NR_pselect6
  4458. +#define SYS_ppoll __NR_ppoll
  4459. +#define SYS_unshare __NR_unshare
  4460. +#define SYS_splice __NR_splice
  4461. +#define SYS_tee __NR_tee
  4462. +#define SYS_sync_file_range __NR_sync_file_range
  4463. +#define SYS_utimensat __NR_utimensat
  4464. +#define SYS_epoll_pwait __NR_epoll_pwait
  4465. +#define SYS_signalfd __NR_signalfd
  4466. +#define SYS_timerfd_create __NR_timerfd_create
  4467. +#define SYS_eventfd __NR_eventfd
  4468. +#define SYS_fallocate __NR_fallocate
  4469. +#define SYS_timerfd_settime __NR_timerfd_settime
  4470. +#define SYS_timerfd_gettime __NR_timerfd_gettime
  4471. +#define SYS_accept4 __NR_accept4
  4472. +#define SYS_signalfd4 __NR_signalfd4
  4473. +#define SYS_eventfd2 __NR_eventfd2
  4474. +#define SYS_epoll_create1 __NR_epoll_create1
  4475. +#define SYS_dup3 __NR_dup3
  4476. +#define SYS_pipe2 __NR_pipe2
  4477. +#define SYS_inotify_init1 __NR_inotify_init1
  4478. +#define SYS_perf_event_open __NR_perf_event_open
  4479. +#define SYS_fanotify_init __NR_fanotify_init
  4480. +#define SYS_fanotify_mark __NR_fanotify_mark
  4481. +#define SYS_prlimit64 __NR_prlimit64
  4482. +#define SYS_name_to_handle_at __NR_name_to_handle_at
  4483. +#define SYS_open_by_handle_at __NR_open_by_handle_at
  4484. +#define SYS_clock_adjtime __NR_clock_adjtime
  4485. +#define SYS_syncfs __NR_syncfs
  4486. +#define SYS_setns __NR_setns
  4487. +#define SYS_getcpu __NR_getcpu
  4488. +#define SYS_kcmp __NR_kcmp
  4489. +#define SYS_finit_module __NR_finit_module
  4490. +#define SYS_rt_sigaction __NR_rt_sigaction
  4491. +#define SYS_rt_sigreturn __NR_rt_sigreturn
  4492. +#define SYS_ioctl __NR_ioctl
  4493. +#define SYS_readv __NR_readv
  4494. +#define SYS_writev __NR_writev
  4495. +#define SYS_recvfrom __NR_recvfrom
  4496. +#define SYS_sendmsg __NR_sendmsg
  4497. +#define SYS_recvmsg __NR_recvmsg
  4498. +#define SYS_execve __NR_execve
  4499. +#define SYS_ptrace __NR_ptrace
  4500. +#define SYS_rt_sigpending __NR_rt_sigpending
  4501. +#define SYS_rt_sigtimedwait __NR_rt_sigtimedwait
  4502. +#define SYS_rt_sigqueueinfo __NR_rt_sigqueueinfo
  4503. +#define SYS_sigaltstack __NR_sigaltstack
  4504. +#define SYS_timer_create __NR_timer_create
  4505. +#define SYS_mq_notify __NR_mq_notify
  4506. +#define SYS_kexec_load __NR_kexec_load
  4507. +#define SYS_waitid __NR_waitid
  4508. +#define SYS_set_robust_list __NR_set_robust_list
  4509. +#define SYS_get_robust_list __NR_get_robust_list
  4510. +#define SYS_vmsplice __NR_vmsplice
  4511. +#define SYS_move_pages __NR_move_pages
  4512. +#define SYS_preadv __NR_preadv
  4513. +#define SYS_pwritev __NR_pwritev
  4514. +#define SYS_rt_tgsigqueueinfo __NR_rt_tgsigqueueinfo
  4515. +#define SYS_recvmmsg __NR_recvmmsg
  4516. +#define SYS_sendmmsg __NR_sendmmsg
  4517. +#define SYS_process_vm_readv __NR_process_vm_readv
  4518. +#define SYS_process_vm_writev __NR_process_vm_writev
  4519. +#define SYS_setsockopt __NR_setsockopt
  4520. +#define SYS_getsockopt __NR_getsockopt
  4521. +
  4522. +#undef SYS_fstatat
  4523. +#undef SYS_pread
  4524. +#undef SYS_pwrite
  4525. +#undef SYS_getdents
  4526. +#define SYS_fstatat SYS_newfstatat
  4527. +#define SYS_pread SYS_pread64
  4528. +#define SYS_pwrite SYS_pwrite64
  4529. +#define SYS_getdents SYS_getdents64
  4530. +#define SYS_fadvise SYS_fadvise64
  4531. diff -Nur musl-0.9.15/arch/x32/bits/termios.h musl-git/arch/x32/bits/termios.h
  4532. --- musl-0.9.15/arch/x32/bits/termios.h 1970-01-01 01:00:00.000000000 +0100
  4533. +++ musl-git/arch/x32/bits/termios.h 2014-03-17 16:49:44.000000000 +0100
  4534. @@ -0,0 +1,160 @@
  4535. +struct termios
  4536. +{
  4537. + tcflag_t c_iflag;
  4538. + tcflag_t c_oflag;
  4539. + tcflag_t c_cflag;
  4540. + tcflag_t c_lflag;
  4541. + cc_t c_line;
  4542. + cc_t c_cc[NCCS];
  4543. + speed_t __c_ispeed;
  4544. + speed_t __c_ospeed;
  4545. +};
  4546. +
  4547. +#define VINTR 0
  4548. +#define VQUIT 1
  4549. +#define VERASE 2
  4550. +#define VKILL 3
  4551. +#define VEOF 4
  4552. +#define VTIME 5
  4553. +#define VMIN 6
  4554. +#define VSWTC 7
  4555. +#define VSTART 8
  4556. +#define VSTOP 9
  4557. +#define VSUSP 10
  4558. +#define VEOL 11
  4559. +#define VREPRINT 12
  4560. +#define VDISCARD 13
  4561. +#define VWERASE 14
  4562. +#define VLNEXT 15
  4563. +#define VEOL2 16
  4564. +
  4565. +#define IGNBRK 0000001
  4566. +#define BRKINT 0000002
  4567. +#define IGNPAR 0000004
  4568. +#define PARMRK 0000010
  4569. +#define INPCK 0000020
  4570. +#define ISTRIP 0000040
  4571. +#define INLCR 0000100
  4572. +#define IGNCR 0000200
  4573. +#define ICRNL 0000400
  4574. +#define IUCLC 0001000
  4575. +#define IXON 0002000
  4576. +#define IXANY 0004000
  4577. +#define IXOFF 0010000
  4578. +#define IMAXBEL 0020000
  4579. +#define IUTF8 0040000
  4580. +
  4581. +#define OPOST 0000001
  4582. +#define OLCUC 0000002
  4583. +#define ONLCR 0000004
  4584. +#define OCRNL 0000010
  4585. +#define ONOCR 0000020
  4586. +#define ONLRET 0000040
  4587. +#define OFILL 0000100
  4588. +#define OFDEL 0000200
  4589. +#define NLDLY 0000400
  4590. +#define NL0 0000000
  4591. +#define NL1 0000400
  4592. +#define CRDLY 0003000
  4593. +#define CR0 0000000
  4594. +#define CR1 0001000
  4595. +#define CR2 0002000
  4596. +#define CR3 0003000
  4597. +#define TABDLY 0014000
  4598. +#define TAB0 0000000
  4599. +#define TAB1 0004000
  4600. +#define TAB2 0010000
  4601. +#define TAB3 0014000
  4602. +#define BSDLY 0020000
  4603. +#define BS0 0000000
  4604. +#define BS1 0020000
  4605. +#define FFDLY 0100000
  4606. +#define FF0 0000000
  4607. +#define FF1 0100000
  4608. +
  4609. +#define VTDLY 0040000
  4610. +#define VT0 0000000
  4611. +#define VT1 0040000
  4612. +
  4613. +#define B0 0000000
  4614. +#define B50 0000001
  4615. +#define B75 0000002
  4616. +#define B110 0000003
  4617. +#define B134 0000004
  4618. +#define B150 0000005
  4619. +#define B200 0000006
  4620. +#define B300 0000007
  4621. +#define B600 0000010
  4622. +#define B1200 0000011
  4623. +#define B1800 0000012
  4624. +#define B2400 0000013
  4625. +#define B4800 0000014
  4626. +#define B9600 0000015
  4627. +#define B19200 0000016
  4628. +#define B38400 0000017
  4629. +
  4630. +#define B57600 0010001
  4631. +#define B115200 0010002
  4632. +#define B230400 0010003
  4633. +#define B460800 0010004
  4634. +#define B500000 0010005
  4635. +#define B576000 0010006
  4636. +#define B921600 0010007
  4637. +#define B1000000 0010010
  4638. +#define B1152000 0010011
  4639. +#define B1500000 0010012
  4640. +#define B2000000 0010013
  4641. +#define B2500000 0010014
  4642. +#define B3000000 0010015
  4643. +#define B3500000 0010016
  4644. +#define B4000000 0010017
  4645. +
  4646. +#define CBAUD 0010017
  4647. +
  4648. +#define CSIZE 0000060
  4649. +#define CS5 0000000
  4650. +#define CS6 0000020
  4651. +#define CS7 0000040
  4652. +#define CS8 0000060
  4653. +#define CSTOPB 0000100
  4654. +#define CREAD 0000200
  4655. +#define PARENB 0000400
  4656. +#define PARODD 0001000
  4657. +#define HUPCL 0002000
  4658. +#define CLOCAL 0004000
  4659. +
  4660. +#define ISIG 0000001
  4661. +#define ICANON 0000002
  4662. +#define ECHO 0000010
  4663. +#define ECHOE 0000020
  4664. +#define ECHOK 0000040
  4665. +#define ECHONL 0000100
  4666. +#define NOFLSH 0000200
  4667. +#define TOSTOP 0000400
  4668. +#define IEXTEN 0100000
  4669. +
  4670. +#define ECHOCTL 0001000
  4671. +#define ECHOPRT 0002000
  4672. +#define ECHOKE 0004000
  4673. +#define FLUSHO 0010000
  4674. +#define PENDIN 0040000
  4675. +
  4676. +#define TCOOFF 0
  4677. +#define TCOON 1
  4678. +#define TCIOFF 2
  4679. +#define TCION 3
  4680. +
  4681. +#define TCIFLUSH 0
  4682. +#define TCOFLUSH 1
  4683. +#define TCIOFLUSH 2
  4684. +
  4685. +#define TCSANOW 0
  4686. +#define TCSADRAIN 1
  4687. +#define TCSAFLUSH 2
  4688. +
  4689. +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  4690. +#define CBAUDEX 0010000
  4691. +#define CRTSCTS 020000000000
  4692. +#define EXTPROC 0200000
  4693. +#define XTABS 0014000
  4694. +#endif
  4695. diff -Nur musl-0.9.15/arch/x32/bits/user.h musl-git/arch/x32/bits/user.h
  4696. --- musl-0.9.15/arch/x32/bits/user.h 1970-01-01 01:00:00.000000000 +0100
  4697. +++ musl-git/arch/x32/bits/user.h 2014-03-17 16:49:44.000000000 +0100
  4698. @@ -0,0 +1,44 @@
  4699. +#undef __WORDSIZE
  4700. +#define __WORDSIZE 64
  4701. +
  4702. +typedef struct user_fpregs_struct
  4703. +{
  4704. + uint16_t cwd, swd, ftw, fop;
  4705. + uint64_t rip, rdp;
  4706. + uint32_t mxcsr, mxcs_mask;
  4707. + uint32_t st_space[32], xmm_space[64], padding[24];
  4708. +} elf_fpregset_t;
  4709. +
  4710. +struct user_regs_struct
  4711. +{
  4712. + unsigned long r15, r14, r13, r12, rbp, rbx, r11, r10, r9, r8;
  4713. + unsigned long rax, rcx, rdx, rsi, rdi, orig_rax, rip;
  4714. + unsigned long cs, eflags, rsp, ss, fs_base, gs_base, ds, es, fs, gs;
  4715. +};
  4716. +#define ELF_NGREG 27
  4717. +typedef unsigned long long elf_greg_t, elf_gregset_t[ELF_NGREG];
  4718. +
  4719. +struct user
  4720. +{
  4721. + struct user_regs_struct regs;
  4722. + int u_fpvalid;
  4723. + struct user_fpregs_struct i387;
  4724. + unsigned long u_tsize;
  4725. + unsigned long u_dsize;
  4726. + unsigned long u_ssize;
  4727. + unsigned long start_code;
  4728. + unsigned long start_stack;
  4729. + long signal;
  4730. + int reserved;
  4731. + struct user_regs_struct *u_ar0;
  4732. + struct user_fpregs_struct *u_fpstate;
  4733. + unsigned long magic;
  4734. + char u_comm[32];
  4735. + unsigned long u_debugreg[8];
  4736. +};
  4737. +
  4738. +#define PAGE_MASK (~(PAGE_SIZE-1))
  4739. +#define NBPG PAGE_SIZE
  4740. +#define UPAGES 1
  4741. +#define HOST_TEXT_START_ADDR (u.start_code)
  4742. +#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
  4743. diff -Nur musl-0.9.15/arch/x32/crt_arch.h musl-git/arch/x32/crt_arch.h
  4744. --- musl-0.9.15/arch/x32/crt_arch.h 1970-01-01 01:00:00.000000000 +0100
  4745. +++ musl-git/arch/x32/crt_arch.h 2014-03-17 16:49:44.000000000 +0100
  4746. @@ -0,0 +1,9 @@
  4747. +__asm__("\
  4748. +.text \n\
  4749. +.global _start \n\
  4750. +_start: \n\
  4751. + xor %rbp,%rbp \n\
  4752. + mov %rsp,%rdi \n\
  4753. + andq $-16,%rsp \n\
  4754. + call __cstart \n\
  4755. +");
  4756. diff -Nur musl-0.9.15/arch/x32/pthread_arch.h musl-git/arch/x32/pthread_arch.h
  4757. --- musl-0.9.15/arch/x32/pthread_arch.h 1970-01-01 01:00:00.000000000 +0100
  4758. +++ musl-git/arch/x32/pthread_arch.h 2014-03-17 16:49:44.000000000 +0100
  4759. @@ -0,0 +1,10 @@
  4760. +static inline struct pthread *__pthread_self()
  4761. +{
  4762. + struct pthread *self;
  4763. + __asm__ __volatile__ ("mov %%fs:0,%0" : "=r" (self) );
  4764. + return self;
  4765. +}
  4766. +
  4767. +#define TP_ADJ(p) (p)
  4768. +
  4769. +#define CANCEL_REG_IP 16
  4770. diff -Nur musl-0.9.15/arch/x32/reloc.h musl-git/arch/x32/reloc.h
  4771. --- musl-0.9.15/arch/x32/reloc.h 1970-01-01 01:00:00.000000000 +0100
  4772. +++ musl-git/arch/x32/reloc.h 2014-03-17 16:49:44.000000000 +0100
  4773. @@ -0,0 +1,46 @@
  4774. +#include <stdint.h>
  4775. +#include <string.h>
  4776. +#include <elf.h>
  4777. +
  4778. +#define LDSO_ARCH "x32"
  4779. +
  4780. +#define IS_COPY(x) ((x)==R_X86_64_COPY)
  4781. +#define IS_PLT(x) ((x)==R_X86_64_JUMP_SLOT)
  4782. +
  4783. +static inline void do_single_reloc(
  4784. + struct dso *self, unsigned char *base_addr,
  4785. + size_t *reloc_addr, int type, size_t addend,
  4786. + Sym *sym, size_t sym_size,
  4787. + struct symdef def, size_t sym_val)
  4788. +{
  4789. + switch(type) {
  4790. + case R_X86_64_GLOB_DAT:
  4791. + case R_X86_64_JUMP_SLOT:
  4792. + case R_X86_64_64:
  4793. + *reloc_addr = sym_val + addend;
  4794. + break;
  4795. + case R_X86_64_32:
  4796. + *(uint32_t *)reloc_addr = sym_val + addend;
  4797. + break;
  4798. + case R_X86_64_PC32:
  4799. + *reloc_addr = sym_val + addend - (size_t)reloc_addr + (size_t)base_addr;
  4800. + break;
  4801. + case R_X86_64_RELATIVE:
  4802. + *reloc_addr = (size_t)base_addr + addend;
  4803. + break;
  4804. + case R_X86_64_COPY:
  4805. + memcpy(reloc_addr, (void *)sym_val, sym_size);
  4806. + break;
  4807. + case R_X86_64_DTPMOD64:
  4808. + *reloc_addr = def.dso ? def.dso->tls_id : self->tls_id;
  4809. + break;
  4810. + case R_X86_64_DTPOFF64:
  4811. + *reloc_addr = def.sym->st_value + addend;
  4812. + break;
  4813. + case R_X86_64_TPOFF64:
  4814. + *reloc_addr = (def.sym
  4815. + ? def.sym->st_value - def.dso->tls_offset
  4816. + : 0 - self->tls_offset) + addend;
  4817. + break;
  4818. + }
  4819. +}
  4820. diff -Nur musl-0.9.15/arch/x32/src/syscall_cp_fixup.c musl-git/arch/x32/src/syscall_cp_fixup.c
  4821. --- musl-0.9.15/arch/x32/src/syscall_cp_fixup.c 1970-01-01 01:00:00.000000000 +0100
  4822. +++ musl-git/arch/x32/src/syscall_cp_fixup.c 2014-03-17 16:49:44.000000000 +0100
  4823. @@ -0,0 +1,31 @@
  4824. +#include <sys/syscall.h>
  4825. +long __syscall_cp_internal(volatile void*, long long, long long, long long, long long,
  4826. + long long, long long, long long);
  4827. +
  4828. +struct __timespec { long long tv_sec; long tv_nsec; };
  4829. +struct __timespec_kernel { long long tv_sec; long long tv_nsec; };
  4830. +#define __tsc(X) ((struct __timespec*)(unsigned long)(X))
  4831. +#define __fixup(X) do { if(X) X = (unsigned long) (&(struct __timespec_kernel) \
  4832. + { .tv_sec = __tsc(X)->tv_sec, .tv_nsec = __tsc(X)->tv_nsec}); } while(0)
  4833. +
  4834. +long __syscall_cp_asm (volatile void * foo, long long n, long long a1, long long a2, long long a3,
  4835. + long long a4, long long a5, long long a6) {
  4836. + switch (n) {
  4837. + case SYS_mq_timedsend: case SYS_mq_timedreceive: case SYS_pselect6:
  4838. + __fixup(a5);
  4839. + break;
  4840. + case SYS_futex:
  4841. + if((a2 & (~128 /* FUTEX_PRIVATE_FLAG */)) == 0 /* FUTEX_WAIT */)
  4842. + __fixup(a4);
  4843. + break;
  4844. + case SYS_clock_nanosleep:
  4845. + case SYS_rt_sigtimedwait: case SYS_ppoll:
  4846. + __fixup(a3);
  4847. + break;
  4848. + case SYS_nanosleep:
  4849. + __fixup(a1);
  4850. + break;
  4851. + }
  4852. + return __syscall_cp_internal(foo, n, a1, a2, a3, a4, a5, a6);
  4853. +}
  4854. +
  4855. diff -Nur musl-0.9.15/arch/x32/src/sysinfo.c musl-git/arch/x32/src/sysinfo.c
  4856. --- musl-0.9.15/arch/x32/src/sysinfo.c 1970-01-01 01:00:00.000000000 +0100
  4857. +++ musl-git/arch/x32/src/sysinfo.c 2014-03-17 16:49:44.000000000 +0100
  4858. @@ -0,0 +1,47 @@
  4859. +#include <sys/sysinfo.h>
  4860. +#include "syscall.h"
  4861. +
  4862. +#define klong long long
  4863. +#define kulong unsigned long long
  4864. +
  4865. +struct kernel_sysinfo {
  4866. + klong uptime;
  4867. + kulong loads[3];
  4868. + kulong totalram;
  4869. + kulong freeram;
  4870. + kulong sharedram;
  4871. + kulong bufferram;
  4872. + kulong totalswap;
  4873. + kulong freeswap;
  4874. + short procs;
  4875. + short pad;
  4876. + kulong totalhigh;
  4877. + kulong freehigh;
  4878. + unsigned mem_unit;
  4879. +};
  4880. +
  4881. +int __x32_sysinfo(struct sysinfo *info)
  4882. +{
  4883. + struct kernel_sysinfo tmp;
  4884. + int ret = syscall(SYS_sysinfo, &tmp);
  4885. + if(ret == -1) return ret;
  4886. + info->uptime = tmp.uptime;
  4887. + info->loads[0] = tmp.loads[0];
  4888. + info->loads[1] = tmp.loads[1];
  4889. + info->loads[2] = tmp.loads[2];
  4890. + kulong shifts;
  4891. + kulong max = tmp.totalram | tmp.totalswap;
  4892. + __asm__("bsr %1,%0" : "=r"(shifts) : "r"(max));
  4893. + shifts = shifts >= 32 ? shifts - 31 : 0;
  4894. + info->totalram = tmp.totalram >> shifts;
  4895. + info->freeram = tmp.freeram >> shifts;
  4896. + info->sharedram = tmp.sharedram >> shifts;
  4897. + info->bufferram = tmp.bufferram >> shifts;
  4898. + info->totalswap = tmp.totalswap >> shifts;
  4899. + info->freeswap = tmp.freeswap >> shifts;
  4900. + info->procs = tmp.procs ;
  4901. + info->totalhigh = tmp.totalhigh >> shifts;
  4902. + info->freehigh = tmp.freehigh >> shifts;
  4903. + info->mem_unit = (tmp.mem_unit ? tmp.mem_unit : 1) << shifts;
  4904. + return ret;
  4905. +}
  4906. diff -Nur musl-0.9.15/arch/x32/syscall_arch.h musl-git/arch/x32/syscall_arch.h
  4907. --- musl-0.9.15/arch/x32/syscall_arch.h 1970-01-01 01:00:00.000000000 +0100
  4908. +++ musl-git/arch/x32/syscall_arch.h 2014-03-17 16:49:44.000000000 +0100
  4909. @@ -0,0 +1,117 @@
  4910. +#define __SYSCALL_LL_E(x) (x)
  4911. +#define __SYSCALL_LL_O(x) (x)
  4912. +
  4913. +#define __scc(X) sizeof(1?(X):0ULL) < 8 ? (unsigned long) (X) : (long long) (X)
  4914. +typedef long long syscall_arg_t;
  4915. +struct __timespec { long long tv_sec; long tv_nsec; };
  4916. +struct __timespec_kernel { long long tv_sec; long long tv_nsec; };
  4917. +#define __tsc(X) ((struct __timespec*)(unsigned long)(X))
  4918. +#define __fixup(X) do { if(X) X = (unsigned long) (&(struct __timespec_kernel) \
  4919. + { .tv_sec = __tsc(X)->tv_sec, .tv_nsec = __tsc(X)->tv_nsec}); } while(0)
  4920. +#define __fixup_case_2 \
  4921. + case SYS_nanosleep: \
  4922. + __fixup(a1); break; \
  4923. + case SYS_clock_settime: \
  4924. + __fixup(a2); break;
  4925. +#define __fixup_case_3 \
  4926. + case SYS_clock_nanosleep: case SYS_rt_sigtimedwait: case SYS_ppoll: \
  4927. + __fixup(a3); break; \
  4928. + case SYS_utimensat: \
  4929. + if(a3) a3 = (unsigned long) ((struct __timespec_kernel[2]) { \
  4930. + [0] = {.tv_sec = __tsc(a3)[0].tv_sec, .tv_nsec = __tsc(a3)[0].tv_nsec}, \
  4931. + [1] = {.tv_sec = __tsc(a3)[1].tv_sec, .tv_nsec = __tsc(a3)[1].tv_nsec}, \
  4932. + }); break;
  4933. +#define __fixup_case_4 \
  4934. + case SYS_futex: \
  4935. + if((a2 & (~128 /* FUTEX_PRIVATE_FLAG */)) == 0 /* FUTEX_WAIT */) __fixup(a4); break;
  4936. +#define __fixup_case_5 \
  4937. + case SYS_mq_timedsend: case SYS_mq_timedreceive: case SYS_pselect6: \
  4938. + __fixup(a5); break;
  4939. +
  4940. +static __inline long __syscall0(long long n)
  4941. +{
  4942. + unsigned long ret;
  4943. + __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n) : "rcx", "r11", "memory");
  4944. + return ret;
  4945. +}
  4946. +
  4947. +static __inline long __syscall1(long long n, long long a1)
  4948. +{
  4949. + unsigned long ret;
  4950. + __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1) : "rcx", "r11", "memory");
  4951. + return ret;
  4952. +}
  4953. +
  4954. +static __inline long __syscall2(long long n, long long a1, long long a2)
  4955. +{
  4956. + unsigned long ret;
  4957. + struct __timespec *ts2 = 0;
  4958. + switch (n) {
  4959. + __fixup_case_2;
  4960. + }
  4961. + __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2)
  4962. + : "rcx", "r11", "memory");
  4963. + return ret;
  4964. +}
  4965. +
  4966. +static __inline long __syscall3(long long n, long long a1, long long a2, long long a3)
  4967. +{
  4968. + unsigned long ret;
  4969. + switch (n) {
  4970. + __fixup_case_2;
  4971. + __fixup_case_3;
  4972. + }
  4973. + __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
  4974. + "d"(a3) : "rcx", "r11", "memory");
  4975. + return ret;
  4976. +}
  4977. +
  4978. +static __inline long __syscall4(long long n, long long a1, long long a2, long long a3,
  4979. + long long a4_)
  4980. +{
  4981. + unsigned long ret;
  4982. + register long long a4 __asm__("r10") = a4_;
  4983. + switch (n) {
  4984. + __fixup_case_2;
  4985. + __fixup_case_3;
  4986. + __fixup_case_4;
  4987. + }
  4988. + __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
  4989. + "d"(a3), "r"(a4): "rcx", "r11", "memory");
  4990. + return ret;
  4991. +}
  4992. +
  4993. +static __inline long __syscall5(long long n, long long a1, long long a2, long long a3,
  4994. + long long a4_, long long a5_)
  4995. +{
  4996. + unsigned long ret;
  4997. + register long long a4 __asm__("r10") = a4_;
  4998. + register long long a5 __asm__("r8") = a5_;
  4999. + switch (n) {
  5000. + __fixup_case_2;
  5001. + __fixup_case_3;
  5002. + __fixup_case_4;
  5003. + __fixup_case_5;
  5004. + }
  5005. + __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
  5006. + "d"(a3), "r"(a4), "r"(a5) : "rcx", "r11", "memory");
  5007. + return ret;
  5008. +}
  5009. +
  5010. +static __inline long __syscall6(long long n, long long a1, long long a2, long long a3,
  5011. + long long a4_, long long a5_, long long a6_)
  5012. +{
  5013. + unsigned long ret;
  5014. + register long long a4 __asm__("r10") = a4_;
  5015. + register long long a5 __asm__("r8") = a5_;
  5016. + register long long a6 __asm__("r9") = a6_;
  5017. + switch (n) {
  5018. + __fixup_case_2;
  5019. + __fixup_case_3;
  5020. + __fixup_case_4;
  5021. + __fixup_case_5;
  5022. + }
  5023. + __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
  5024. + "d"(a3), "r"(a4), "r"(a5), "r"(a6) : "rcx", "r11", "memory");
  5025. + return ret;
  5026. +}
  5027. diff -Nur musl-0.9.15/arch/x86_64/atomic.h musl-git/arch/x86_64/atomic.h
  5028. --- musl-0.9.15/arch/x86_64/atomic.h 2014-01-03 21:12:17.000000000 +0100
  5029. +++ musl-git/arch/x86_64/atomic.h 2014-03-17 16:49:44.000000000 +0100
  5030. @@ -5,38 +5,36 @@
  5031. static inline int a_ctz_64(uint64_t x)
  5032. {
  5033. - long r;
  5034. - __asm__( "bsf %1,%0" : "=r"(r) : "r"(x) );
  5035. - return r;
  5036. + __asm__( "bsf %1,%0" : "=r"(x) : "r"(x) );
  5037. + return x;
  5038. }
  5039. static inline int a_ctz_l(unsigned long x)
  5040. {
  5041. - long r;
  5042. - __asm__( "bsf %1,%0" : "=r"(r) : "r"(x) );
  5043. - return r;
  5044. + __asm__( "bsf %1,%0" : "=r"(x) : "r"(x) );
  5045. + return x;
  5046. }
  5047. static inline void a_and_64(volatile uint64_t *p, uint64_t v)
  5048. {
  5049. - __asm__( "lock ; andq %1, %0"
  5050. - : "=m"(*(long *)p) : "r"(v) : "memory" );
  5051. + __asm__( "lock ; and %1, %0"
  5052. + : "=m"(*p) : "r"(v) : "memory" );
  5053. }
  5054. static inline void a_or_64(volatile uint64_t *p, uint64_t v)
  5055. {
  5056. - __asm__( "lock ; orq %1, %0"
  5057. - : "=m"(*(long *)p) : "r"(v) : "memory" );
  5058. + __asm__( "lock ; or %1, %0"
  5059. + : "=m"(*p) : "r"(v) : "memory" );
  5060. }
  5061. static inline void a_store_l(volatile void *p, long x)
  5062. {
  5063. - __asm__( "movq %1, %0" : "=m"(*(long *)p) : "r"(x) : "memory" );
  5064. + __asm__( "mov %1, %0" : "=m"(*(long *)p) : "r"(x) : "memory" );
  5065. }
  5066. static inline void a_or_l(volatile void *p, long v)
  5067. {
  5068. - __asm__( "lock ; orq %1, %0"
  5069. + __asm__( "lock ; or %1, %0"
  5070. : "=m"(*(long *)p) : "r"(v) : "memory" );
  5071. }
  5072. @@ -56,7 +54,7 @@
  5073. static inline int a_cas(volatile int *p, int t, int s)
  5074. {
  5075. - __asm__( "lock ; cmpxchgl %3, %1"
  5076. + __asm__( "lock ; cmpxchg %3, %1"
  5077. : "=a"(t), "=m"(*p) : "a"(t), "r"(s) : "memory" );
  5078. return t;
  5079. }
  5080. @@ -74,13 +72,13 @@
  5081. static inline void a_or(volatile void *p, int v)
  5082. {
  5083. - __asm__( "lock ; orl %1, %0"
  5084. + __asm__( "lock ; or %1, %0"
  5085. : "=m"(*(int *)p) : "r"(v) : "memory" );
  5086. }
  5087. static inline void a_and(volatile void *p, int v)
  5088. {
  5089. - __asm__( "lock ; andl %1, %0"
  5090. + __asm__( "lock ; and %1, %0"
  5091. : "=m"(*(int *)p) : "r"(v) : "memory" );
  5092. }
  5093. @@ -110,7 +108,7 @@
  5094. static inline void a_store(volatile int *p, int x)
  5095. {
  5096. - __asm__( "movl %1, %0" : "=m"(*p) : "r"(x) : "memory" );
  5097. + __asm__( "mov %1, %0" : "=m"(*p) : "r"(x) : "memory" );
  5098. }
  5099. static inline void a_spin()
  5100. diff -Nur musl-0.9.15/arch/x86_64/bits/sem.h musl-git/arch/x86_64/bits/sem.h
  5101. --- musl-0.9.15/arch/x86_64/bits/sem.h 1970-01-01 01:00:00.000000000 +0100
  5102. +++ musl-git/arch/x86_64/bits/sem.h 2014-03-17 16:49:44.000000000 +0100
  5103. @@ -0,0 +1,16 @@
  5104. +struct semid_ds {
  5105. + struct ipc_perm sem_perm;
  5106. + time_t sem_otime;
  5107. + time_t __unused1;
  5108. + time_t sem_ctime;
  5109. + time_t __unused2;
  5110. +#if __BYTE_ORDER == __LITTLE_ENDIAN
  5111. + unsigned short sem_nsems;
  5112. + char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
  5113. +#else
  5114. + char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
  5115. + unsigned short sem_nsems;
  5116. +#endif
  5117. + time_t __unused3;
  5118. + time_t __unused4;
  5119. +};
  5120. diff -Nur musl-0.9.15/arch/x86_64/bits/shm.h musl-git/arch/x86_64/bits/shm.h
  5121. --- musl-0.9.15/arch/x86_64/bits/shm.h 2014-01-03 21:12:17.000000000 +0100
  5122. +++ musl-git/arch/x86_64/bits/shm.h 2014-03-17 16:49:44.000000000 +0100
  5123. @@ -13,3 +13,14 @@
  5124. unsigned long __pad1;
  5125. unsigned long __pad2;
  5126. };
  5127. +
  5128. +struct shminfo {
  5129. + unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
  5130. +};
  5131. +
  5132. +struct shm_info {
  5133. + int __used_ids;
  5134. + unsigned long shm_tot, shm_rss, shm_swp;
  5135. + unsigned long __swap_attempts, __swap_successes;
  5136. +};
  5137. +
  5138. diff -Nur musl-0.9.15/arch/x86_64/bits/stat.h musl-git/arch/x86_64/bits/stat.h
  5139. --- musl-0.9.15/arch/x86_64/bits/stat.h 2014-01-03 21:12:17.000000000 +0100
  5140. +++ musl-git/arch/x86_64/bits/stat.h 2014-03-17 16:49:44.000000000 +0100
  5141. @@ -2,7 +2,7 @@
  5142. * by the corresponding correctly-sized userspace types. */
  5143. struct stat {
  5144. - unsigned long st_dev;
  5145. + dev_t st_dev;
  5146. ino_t st_ino;
  5147. nlink_t st_nlink;
  5148. diff -Nur musl-0.9.15/arch/x86_64/bits/termios.h musl-git/arch/x86_64/bits/termios.h
  5149. --- musl-0.9.15/arch/x86_64/bits/termios.h 2014-01-03 21:12:17.000000000 +0100
  5150. +++ musl-git/arch/x86_64/bits/termios.h 2014-03-17 16:49:44.000000000 +0100
  5151. @@ -42,6 +42,7 @@
  5152. #define IXANY 0004000
  5153. #define IXOFF 0010000
  5154. #define IMAXBEL 0020000
  5155. +#define IUTF8 0040000
  5156. #define OPOST 0000001
  5157. #define OLCUC 0000002
  5158. @@ -75,9 +76,6 @@
  5159. #define VT0 0000000
  5160. #define VT1 0040000
  5161. -/* ?? */
  5162. -#define XTABS 0014000
  5163. -
  5164. #define B0 0000000
  5165. #define B50 0000001
  5166. #define B75 0000002
  5167. @@ -125,8 +123,6 @@
  5168. #define HUPCL 0002000
  5169. #define CLOCAL 0004000
  5170. -#define CRTSCTS 020000000000
  5171. -
  5172. #define ISIG 0000001
  5173. #define ICANON 0000002
  5174. #define ECHO 0000010
  5175. @@ -137,14 +133,11 @@
  5176. #define TOSTOP 0000400
  5177. #define IEXTEN 0100000
  5178. -/* Extensions? */
  5179. -#define CBAUDEX 0010000
  5180. #define ECHOCTL 0001000
  5181. #define ECHOPRT 0002000
  5182. #define ECHOKE 0004000
  5183. #define FLUSHO 0010000
  5184. #define PENDIN 0040000
  5185. -#define EXTPROC 0200000
  5186. #define TCOOFF 0
  5187. #define TCOON 1
  5188. @@ -158,3 +151,10 @@
  5189. #define TCSANOW 0
  5190. #define TCSADRAIN 1
  5191. #define TCSAFLUSH 2
  5192. +
  5193. +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  5194. +#define CBAUDEX 0010000
  5195. +#define CRTSCTS 020000000000
  5196. +#define EXTPROC 0200000
  5197. +#define XTABS 0014000
  5198. +#endif
  5199. diff -Nur musl-0.9.15/arch/x86_64/pthread_arch.h musl-git/arch/x86_64/pthread_arch.h
  5200. --- musl-0.9.15/arch/x86_64/pthread_arch.h 2014-01-03 21:12:17.000000000 +0100
  5201. +++ musl-git/arch/x86_64/pthread_arch.h 2014-03-17 16:49:44.000000000 +0100
  5202. @@ -1,7 +1,7 @@
  5203. static inline struct pthread *__pthread_self()
  5204. {
  5205. struct pthread *self;
  5206. - __asm__ __volatile__ ("movq %%fs:0,%0" : "=r" (self) );
  5207. + __asm__ __volatile__ ("mov %%fs:0,%0" : "=r" (self) );
  5208. return self;
  5209. }
  5210. diff -Nur musl-0.9.15/configure musl-git/configure
  5211. --- musl-0.9.15/configure 2014-01-03 21:12:17.000000000 +0100
  5212. +++ musl-git/configure 2014-03-18 13:19:59.000000000 +0100
  5213. @@ -222,12 +222,16 @@
  5214. # Convert to just ARCH
  5215. #
  5216. case "$target" in
  5217. +# Catch these early to simplify matching for 32-bit archs
  5218. +mips64*|powerpc64*) fail "$0: unsupported target \"$target\"" ;;
  5219. arm*) ARCH=arm ;;
  5220. i?86*) ARCH=i386 ;;
  5221. +x86_64-x32*|x32*|x86_64*x32) ARCH=x32 ;;
  5222. x86_64*) ARCH=x86_64 ;;
  5223. -mips-*|mipsel-*) ARCH=mips ;;
  5224. -microblaze-*) ARCH=microblaze ;;
  5225. -powerpc-*) ARCH=powerpc ;;
  5226. +mips*) ARCH=mips ;;
  5227. +microblaze*) ARCH=microblaze ;;
  5228. +powerpc*) ARCH=powerpc ;;
  5229. +sh[1-9bel-]*|sh|superh*) ARCH=sh ;;
  5230. unknown) fail "$0: unable to detect target arch; try $0 --target=..." ;;
  5231. *) fail "$0: unknown or unsupported target \"$target\"" ;;
  5232. esac
  5233. @@ -381,6 +385,7 @@
  5234. tryflag CFLAGS_AUTO -Wno-unused-value
  5235. tryflag CFLAGS_AUTO -Wno-unused-but-set-variable
  5236. tryflag CFLAGS_AUTO -Wno-unknown-pragmas
  5237. +tryflag CFLAGS_AUTO -Wno-pointer-to-int-cast
  5238. fi
  5239. # Some patched GCC builds have these defaults messed up...
  5240. @@ -410,12 +415,33 @@
  5241. trycppif __ARM_PCS_VFP "$t" && SUBARCH=${SUBARCH}hf
  5242. fi
  5243. -test "$ARCH" = "mips" && trycppif "_MIPSEL || __MIPSEL || __MIPSEL__" "$t" \
  5244. -&& SUBARCH=${SUBARCH}el
  5245. +if test "$ARCH" = "mips" ; then
  5246. +trycppif "_MIPSEL || __MIPSEL || __MIPSEL__" "$t" && SUBARCH=${SUBARCH}el
  5247. +trycppif __mips_soft_float "$t" && SUBARCH=${SUBARCH}-sf
  5248. +fi
  5249. test "$ARCH" = "microblaze" && trycppif __MICROBLAZEEL__ "$t" \
  5250. && SUBARCH=${SUBARCH}el
  5251. +if test "$ARCH" = "sh" ; then
  5252. +trycppif __BIG_ENDIAN__ "$t" && SUBARCH=${SUBARCH}eb
  5253. +if trycppif __SH_FPU_ANY__ "$t" ; then
  5254. +# Some sh configurations are broken and replace double with float
  5255. +# rather than using softfloat when the fpu is present but only
  5256. +# supports single precision. Reject them.
  5257. +printf "checking whether compiler's double type is IEEE double... "
  5258. +echo 'typedef char dblcheck[(int)sizeof(double)-5];' > "$tmpc"
  5259. +if $CC $CFLAGS_C99FSE $CPPFLAGS $CFLAGS -c -o /dev/null "$tmpc" >/dev/null 2>&1 ; then
  5260. +printf "yes\n"
  5261. +else
  5262. +printf "no\n"
  5263. +fail "$0: error: compiler's floating point configuration is unsupported"
  5264. +fi
  5265. +else
  5266. +SUBARCH=${SUBARCH}-nofpu
  5267. +fi
  5268. +fi
  5269. +
  5270. test "$SUBARCH" \
  5271. && printf "configured for %s variant: %s\n" "$ARCH" "$ARCH$SUBARCH"
  5272. diff -Nur musl-0.9.15/COPYRIGHT musl-git/COPYRIGHT
  5273. --- musl-0.9.15/COPYRIGHT 2014-01-03 21:12:17.000000000 +0100
  5274. +++ musl-git/COPYRIGHT 2014-03-17 16:49:44.000000000 +0100
  5275. @@ -1,6 +1,6 @@
  5276. musl as a whole is licensed under the following standard MIT license:
  5277. -Copyright © 2005-2013 Rich Felker
  5278. +Copyright © 2005-2014 Rich Felker
  5279. Permission is hereby granted, free of charge, to any person obtaining
  5280. a copy of this software and associated documentation files (the
  5281. @@ -79,7 +79,7 @@
  5282. from Bionic libc, used on Android.
  5283. All other files which have no copyright comments are original works
  5284. -Copyright © 2005-2013 Rich Felker, the main author of this library.
  5285. +Copyright © 2005-2014 Rich Felker, the main author of this library.
  5286. The decision to exclude such comments is intentional, as it should be
  5287. possible to carry around the complete source code on tiny storage
  5288. media. All public header files (include/* and arch/*/bits/*) should be
  5289. diff -Nur musl-0.9.15/crt/superh/crti.s musl-git/crt/superh/crti.s
  5290. --- musl-0.9.15/crt/superh/crti.s 1970-01-01 01:00:00.000000000 +0100
  5291. +++ musl-git/crt/superh/crti.s 2014-03-17 16:49:44.000000000 +0100
  5292. @@ -0,0 +1,13 @@
  5293. +.section .init
  5294. +.global _init
  5295. +.type _init, @function
  5296. +_init:
  5297. + sts.l pr, @-r15
  5298. + nop
  5299. +
  5300. +.section .fini
  5301. +.global _fini
  5302. +.type _fini, @function
  5303. +_fini:
  5304. + sts.l pr, @-r15
  5305. + nop
  5306. diff -Nur musl-0.9.15/crt/superh/crtn.s musl-git/crt/superh/crtn.s
  5307. --- musl-0.9.15/crt/superh/crtn.s 1970-01-01 01:00:00.000000000 +0100
  5308. +++ musl-git/crt/superh/crtn.s 2014-03-17 16:49:44.000000000 +0100
  5309. @@ -0,0 +1,9 @@
  5310. +.section .init
  5311. + lds.l @r15+, pr
  5312. + rts
  5313. + nop
  5314. +
  5315. +.section .fini
  5316. + lds.l @r15+, pr
  5317. + rts
  5318. + nop
  5319. diff -Nur musl-0.9.15/crt/x32/crti.s musl-git/crt/x32/crti.s
  5320. --- musl-0.9.15/crt/x32/crti.s 1970-01-01 01:00:00.000000000 +0100
  5321. +++ musl-git/crt/x32/crti.s 2014-03-17 16:49:44.000000000 +0100
  5322. @@ -0,0 +1,9 @@
  5323. +.section .init
  5324. +.global _init
  5325. +_init:
  5326. + push %rax
  5327. +
  5328. +.section .fini
  5329. +.global _fini
  5330. +_fini:
  5331. + push %rax
  5332. diff -Nur musl-0.9.15/crt/x32/crtn.s musl-git/crt/x32/crtn.s
  5333. --- musl-0.9.15/crt/x32/crtn.s 1970-01-01 01:00:00.000000000 +0100
  5334. +++ musl-git/crt/x32/crtn.s 2014-03-17 16:49:44.000000000 +0100
  5335. @@ -0,0 +1,7 @@
  5336. +.section .init
  5337. + pop %rax
  5338. + ret
  5339. +
  5340. +.section .fini
  5341. + pop %rax
  5342. + ret
  5343. diff -Nur musl-0.9.15/.gitignore musl-git/.gitignore
  5344. --- musl-0.9.15/.gitignore 1970-01-01 01:00:00.000000000 +0100
  5345. +++ musl-git/.gitignore 2014-03-17 16:49:44.000000000 +0100
  5346. @@ -0,0 +1,11 @@
  5347. +*.o
  5348. +*.lo
  5349. +*.a
  5350. +*.so
  5351. +*.so.1
  5352. +arch/*/bits/alltypes.h
  5353. +config.mak
  5354. +include/bits
  5355. +tools/musl-gcc
  5356. +lib/musl-gcc.specs
  5357. +src/internal/version.h
  5358. diff -Nur musl-0.9.15/include/arpa/inet.h musl-git/include/arpa/inet.h
  5359. --- musl-0.9.15/include/arpa/inet.h 2014-01-03 21:12:17.000000000 +0100
  5360. +++ musl-git/include/arpa/inet.h 2014-03-17 16:49:44.000000000 +0100
  5361. @@ -20,7 +20,7 @@
  5362. const char *inet_ntop (int, const void *__restrict, char *__restrict, socklen_t);
  5363. int inet_aton (const char *, struct in_addr *);
  5364. -struct in_addr inet_makeaddr(int, int);
  5365. +struct in_addr inet_makeaddr(in_addr_t, in_addr_t);
  5366. in_addr_t inet_lnaof(struct in_addr);
  5367. in_addr_t inet_netof(struct in_addr);
  5368. diff -Nur musl-0.9.15/include/dlfcn.h musl-git/include/dlfcn.h
  5369. --- musl-0.9.15/include/dlfcn.h 2014-01-03 21:12:17.000000000 +0100
  5370. +++ musl-git/include/dlfcn.h 2014-03-17 16:49:44.000000000 +0100
  5371. @@ -31,7 +31,7 @@
  5372. const char *dli_sname;
  5373. void *dli_saddr;
  5374. } Dl_info;
  5375. -int dladdr(void *, Dl_info *);
  5376. +int dladdr(const void *, Dl_info *);
  5377. int dlinfo(void *, int, void *);
  5378. #endif
  5379. diff -Nur musl-0.9.15/include/elf.h musl-git/include/elf.h
  5380. --- musl-0.9.15/include/elf.h 2014-01-03 21:12:17.000000000 +0100
  5381. +++ musl-git/include/elf.h 2014-03-17 16:49:44.000000000 +0100
  5382. @@ -1153,6 +1153,7 @@
  5383. #define EF_MIPS_64BIT_WHIRL 16
  5384. #define EF_MIPS_ABI2 32
  5385. #define EF_MIPS_ABI_ON32 64
  5386. +#define EF_MIPS_NAN2008 1024
  5387. #define EF_MIPS_ARCH 0xf0000000
  5388. @@ -2092,6 +2093,117 @@
  5389. #define R_AARCH64_NONE 0
  5390. #define R_AARCH64_ABS64 257
  5391. #define R_AARCH64_ABS32 258
  5392. +#define R_AARCH64_ABS16 259
  5393. +#define R_AARCH64_PREL64 260
  5394. +#define R_AARCH64_PREL32 261
  5395. +#define R_AARCH64_PREL16 262
  5396. +#define R_AARCH64_MOVW_UABS_G0 263
  5397. +#define R_AARCH64_MOVW_UABS_G0_NC 264
  5398. +#define R_AARCH64_MOVW_UABS_G1 265
  5399. +#define R_AARCH64_MOVW_UABS_G1_NC 266
  5400. +#define R_AARCH64_MOVW_UABS_G2 267
  5401. +#define R_AARCH64_MOVW_UABS_G2_NC 268
  5402. +#define R_AARCH64_MOVW_UABS_G3 269
  5403. +#define R_AARCH64_MOVW_SABS_G0 270
  5404. +#define R_AARCH64_MOVW_SABS_G1 271
  5405. +#define R_AARCH64_MOVW_SABS_G2 272
  5406. +#define R_AARCH64_LD_PREL_LO19 273
  5407. +#define R_AARCH64_ADR_PREL_LO21 274
  5408. +#define R_AARCH64_ADR_PREL_PG_HI21 275
  5409. +#define R_AARCH64_ADR_PREL_PG_HI21_NC 276
  5410. +#define R_AARCH64_ADD_ABS_LO12_NC 277
  5411. +#define R_AARCH64_LDST8_ABS_LO12_NC 278
  5412. +#define R_AARCH64_TSTBR14 279
  5413. +#define R_AARCH64_CONDBR19 280
  5414. +#define R_AARCH64_JUMP26 282
  5415. +#define R_AARCH64_CALL26 283
  5416. +#define R_AARCH64_LDST16_ABS_LO12_NC 284
  5417. +#define R_AARCH64_LDST32_ABS_LO12_NC 285
  5418. +#define R_AARCH64_LDST64_ABS_LO12_NC 286
  5419. +#define R_AARCH64_MOVW_PREL_G0 287
  5420. +#define R_AARCH64_MOVW_PREL_G0_NC 288
  5421. +#define R_AARCH64_MOVW_PREL_G1 289
  5422. +#define R_AARCH64_MOVW_PREL_G1_NC 290
  5423. +#define R_AARCH64_MOVW_PREL_G2 291
  5424. +#define R_AARCH64_MOVW_PREL_G2_NC 292
  5425. +#define R_AARCH64_MOVW_PREL_G3 293
  5426. +#define R_AARCH64_LDST128_ABS_LO12_NC 299
  5427. +#define R_AARCH64_MOVW_GOTOFF_G0 300
  5428. +#define R_AARCH64_MOVW_GOTOFF_G0_NC 301
  5429. +#define R_AARCH64_MOVW_GOTOFF_G1 302
  5430. +#define R_AARCH64_MOVW_GOTOFF_G1_NC 303
  5431. +#define R_AARCH64_MOVW_GOTOFF_G2 304
  5432. +#define R_AARCH64_MOVW_GOTOFF_G2_NC 305
  5433. +#define R_AARCH64_MOVW_GOTOFF_G3 306
  5434. +#define R_AARCH64_GOTREL64 307
  5435. +#define R_AARCH64_GOTREL32 308
  5436. +#define R_AARCH64_GOT_LD_PREL19 309
  5437. +#define R_AARCH64_LD64_GOTOFF_LO15 310
  5438. +#define R_AARCH64_ADR_GOT_PAGE 311
  5439. +#define R_AARCH64_LD64_GOT_LO12_NC 312
  5440. +#define R_AARCH64_LD64_GOTPAGE_LO15 313
  5441. +#define R_AARCH64_TLSGD_ADR_PREL21 512
  5442. +#define R_AARCH64_TLSGD_ADR_PAGE21 513
  5443. +#define R_AARCH64_TLSGD_ADD_LO12_NC 514
  5444. +#define R_AARCH64_TLSGD_MOVW_G1 515
  5445. +#define R_AARCH64_TLSGD_MOVW_G0_NC 516
  5446. +#define R_AARCH64_TLSLD_ADR_PREL21 517
  5447. +#define R_AARCH64_TLSLD_ADR_PAGE21 518
  5448. +#define R_AARCH64_TLSLD_ADD_LO12_NC 519
  5449. +#define R_AARCH64_TLSLD_MOVW_G1 520
  5450. +#define R_AARCH64_TLSLD_MOVW_G0_NC 521
  5451. +#define R_AARCH64_TLSLD_LD_PREL19 522
  5452. +#define R_AARCH64_TLSLD_MOVW_DTPREL_G2 523
  5453. +#define R_AARCH64_TLSLD_MOVW_DTPREL_G1 524
  5454. +#define R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC 525
  5455. +#define R_AARCH64_TLSLD_MOVW_DTPREL_G0 526
  5456. +#define R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC 527
  5457. +#define R_AARCH64_TLSLD_ADD_DTPREL_HI12 528
  5458. +#define R_AARCH64_TLSLD_ADD_DTPREL_LO12 529
  5459. +#define R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC 530
  5460. +#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12 531
  5461. +#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC 532
  5462. +#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12 533
  5463. +#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC 534
  5464. +#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12 535
  5465. +#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC 536
  5466. +#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12 537
  5467. +#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC 538
  5468. +#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 539
  5469. +#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC 540
  5470. +#define R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 541
  5471. +#define R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC 542
  5472. +#define R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 543
  5473. +#define R_AARCH64_TLSLE_MOVW_TPREL_G2 544
  5474. +#define R_AARCH64_TLSLE_MOVW_TPREL_G1 545
  5475. +#define R_AARCH64_TLSLE_MOVW_TPREL_G1_NC 546
  5476. +#define R_AARCH64_TLSLE_MOVW_TPREL_G0 547
  5477. +#define R_AARCH64_TLSLE_MOVW_TPREL_G0_NC 548
  5478. +#define R_AARCH64_TLSLE_ADD_TPREL_HI12 549
  5479. +#define R_AARCH64_TLSLE_ADD_TPREL_LO12 550
  5480. +#define R_AARCH64_TLSLE_ADD_TPREL_LO12_NC 551
  5481. +#define R_AARCH64_TLSLE_LDST8_TPREL_LO12 552
  5482. +#define R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC 553
  5483. +#define R_AARCH64_TLSLE_LDST16_TPREL_LO12 554
  5484. +#define R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC 555
  5485. +#define R_AARCH64_TLSLE_LDST32_TPREL_LO12 556
  5486. +#define R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC 557
  5487. +#define R_AARCH64_TLSLE_LDST64_TPREL_LO12 558
  5488. +#define R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC 559
  5489. +#define R_AARCH64_TLSDESC_LD_PREL19 560
  5490. +#define R_AARCH64_TLSDESC_ADR_PREL21 561
  5491. +#define R_AARCH64_TLSDESC_ADR_PAGE21 562
  5492. +#define R_AARCH64_TLSDESC_LD64_LO12 563
  5493. +#define R_AARCH64_TLSDESC_ADD_LO12 564
  5494. +#define R_AARCH64_TLSDESC_OFF_G1 565
  5495. +#define R_AARCH64_TLSDESC_OFF_G0_NC 566
  5496. +#define R_AARCH64_TLSDESC_LDR 567
  5497. +#define R_AARCH64_TLSDESC_ADD 568
  5498. +#define R_AARCH64_TLSDESC_CALL 569
  5499. +#define R_AARCH64_TLSLE_LDST128_TPREL_LO12 570
  5500. +#define R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC 571
  5501. +#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12 572
  5502. +#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC 573
  5503. #define R_AARCH64_COPY 1024
  5504. #define R_AARCH64_GLOB_DAT 1025
  5505. #define R_AARCH64_JUMP_SLOT 1026
  5506. diff -Nur musl-0.9.15/include/fcntl.h musl-git/include/fcntl.h
  5507. --- musl-0.9.15/include/fcntl.h 2014-01-03 21:12:17.000000000 +0100
  5508. +++ musl-git/include/fcntl.h 2014-03-17 16:49:44.000000000 +0100
  5509. @@ -148,6 +148,7 @@
  5510. #define SPLICE_F_MORE 4
  5511. #define SPLICE_F_GIFT 8
  5512. int fallocate(int, int, off_t, off_t);
  5513. +#define fallocate64 fallocate
  5514. ssize_t readahead(int, off_t, size_t);
  5515. int sync_file_range(int, off_t, off_t, unsigned);
  5516. ssize_t vmsplice(int, const struct iovec *, size_t, unsigned);
  5517. @@ -160,6 +161,7 @@
  5518. #define F_GETLK64 F_GETLK
  5519. #define F_SETLK64 F_SETLK
  5520. #define F_SETLKW64 F_SETLKW
  5521. +#define flock64 flock
  5522. #define open64 open
  5523. #define openat64 openat
  5524. #define creat64 creat
  5525. diff -Nur musl-0.9.15/include/math.h musl-git/include/math.h
  5526. --- musl-0.9.15/include/math.h 2014-01-03 21:12:17.000000000 +0100
  5527. +++ musl-git/include/math.h 2014-03-17 16:49:44.000000000 +0100
  5528. @@ -42,12 +42,14 @@
  5529. static __inline unsigned __FLOAT_BITS(float __f)
  5530. {
  5531. - union {float __f; unsigned __i;} __u = {__f};
  5532. + union {float __f; unsigned __i;} __u;
  5533. + __u.__f = __f;
  5534. return __u.__i;
  5535. }
  5536. static __inline unsigned long long __DOUBLE_BITS(double __f)
  5537. {
  5538. - union {double __f; unsigned long long __i;} __u = {__f};
  5539. + union {double __f; unsigned long long __i;} __u;
  5540. + __u.__f = __f;
  5541. return __u.__i;
  5542. }
  5543. diff -Nur musl-0.9.15/include/netdb.h musl-git/include/netdb.h
  5544. --- musl-0.9.15/include/netdb.h 2014-01-03 21:12:17.000000000 +0100
  5545. +++ musl-git/include/netdb.h 2014-03-17 16:49:44.000000000 +0100
  5546. @@ -131,6 +131,7 @@
  5547. #define TRY_AGAIN 2
  5548. #define NO_RECOVERY 3
  5549. #define NO_DATA 4
  5550. +#define NO_ADDRESS NO_DATA
  5551. #endif
  5552. #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  5553. diff -Nur musl-0.9.15/include/netinet/if_ether.h musl-git/include/netinet/if_ether.h
  5554. --- musl-0.9.15/include/netinet/if_ether.h 2014-01-03 21:12:17.000000000 +0100
  5555. +++ musl-git/include/netinet/if_ether.h 2014-03-17 16:49:44.000000000 +0100
  5556. @@ -54,6 +54,7 @@
  5557. #define ETH_P_8021AH 0x88E7
  5558. #define ETH_P_MVRP 0x88F5
  5559. #define ETH_P_1588 0x88F7
  5560. +#define ETH_P_PRP 0x88FB
  5561. #define ETH_P_FCOE 0x8906
  5562. #define ETH_P_TDLS 0x890D
  5563. #define ETH_P_FIP 0x8914
  5564. diff -Nur musl-0.9.15/include/netinet/in.h musl-git/include/netinet/in.h
  5565. --- musl-0.9.15/include/netinet/in.h 2014-01-03 21:12:17.000000000 +0100
  5566. +++ musl-git/include/netinet/in.h 2014-03-17 16:49:44.000000000 +0100
  5567. @@ -149,7 +149,7 @@
  5568. (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0xe))
  5569. #define __ARE_4_EQUAL(a,b) \
  5570. - (!( 0[a]-0[b] | 1[a]-1[b] | 2[a]-2[b] | 3[a]-3[b] ))
  5571. + (!( (0[a]-0[b]) | (1[a]-1[b]) | (2[a]-2[b]) | (3[a]-3[b]) ))
  5572. #define IN6_ARE_ADDR_EQUAL(a,b) \
  5573. __ARE_4_EQUAL((const uint32_t *)(a), (const uint32_t *)(b))
  5574. @@ -211,27 +211,13 @@
  5575. #define IP_MULTICAST_ALL 49
  5576. #define IP_UNICAST_IF 50
  5577. -#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  5578. -#define MCAST_JOIN_GROUP 42
  5579. -#define MCAST_BLOCK_SOURCE 43
  5580. -#define MCAST_UNBLOCK_SOURCE 44
  5581. -#define MCAST_LEAVE_GROUP 45
  5582. -#define MCAST_JOIN_SOURCE_GROUP 46
  5583. -#define MCAST_LEAVE_SOURCE_GROUP 47
  5584. -#define MCAST_MSFILTER 48
  5585. -
  5586. -#define MCAST_EXCLUDE 0
  5587. -#define MCAST_INCLUDE 1
  5588. -#endif
  5589. -
  5590. #define IP_RECVRETOPTS IP_RETOPTS
  5591. #define IP_PMTUDISC_DONT 0
  5592. #define IP_PMTUDISC_WANT 1
  5593. #define IP_PMTUDISC_DO 2
  5594. #define IP_PMTUDISC_PROBE 3
  5595. -
  5596. -#define SOL_IP 0
  5597. +#define IP_PMTUDISC_INTERFACE 4
  5598. #define IP_DEFAULT_MULTICAST_TTL 1
  5599. #define IP_DEFAULT_MULTICAST_LOOP 1
  5600. @@ -243,6 +229,19 @@
  5601. char ip_opts[40];
  5602. };
  5603. +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  5604. +
  5605. +#define MCAST_JOIN_GROUP 42
  5606. +#define MCAST_BLOCK_SOURCE 43
  5607. +#define MCAST_UNBLOCK_SOURCE 44
  5608. +#define MCAST_LEAVE_GROUP 45
  5609. +#define MCAST_JOIN_SOURCE_GROUP 46
  5610. +#define MCAST_LEAVE_SOURCE_GROUP 47
  5611. +#define MCAST_MSFILTER 48
  5612. +
  5613. +#define MCAST_EXCLUDE 0
  5614. +#define MCAST_INCLUDE 1
  5615. +
  5616. struct ip_mreq
  5617. {
  5618. struct in_addr imr_multiaddr;
  5619. @@ -273,7 +272,6 @@
  5620. (sizeof(struct ip_msfilter) - sizeof(struct in_addr) \
  5621. + (numsrc) * sizeof(struct in_addr))
  5622. -#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  5623. struct group_req {
  5624. uint32_t gr_interface;
  5625. struct sockaddr_storage gr_group;
  5626. @@ -295,7 +293,6 @@
  5627. #define GROUP_FILTER_SIZE(numsrc) \
  5628. (sizeof(struct group_filter) - sizeof(struct sockaddr_storage) \
  5629. + (numsrc) * sizeof(struct sockaddr_storage))
  5630. -#endif
  5631. struct in_pktinfo
  5632. {
  5633. @@ -315,6 +312,7 @@
  5634. struct sockaddr_in6 ip6m_addr;
  5635. uint32_t ip6m_mtu;
  5636. };
  5637. +#endif
  5638. #define IPV6_ADDRFORM 1
  5639. #define IPV6_2292PKTINFO 2
  5640. @@ -324,7 +322,6 @@
  5641. #define IPV6_2292PKTOPTIONS 6
  5642. #define IPV6_CHECKSUM 7
  5643. #define IPV6_2292HOPLIMIT 8
  5644. -#define SCM_SRCRT IPV6_RXSRCRT
  5645. #define IPV6_NEXTHOP 9
  5646. #define IPV6_AUTHHDR 10
  5647. #define IPV6_UNICAST_HOPS 16
  5648. @@ -363,15 +360,11 @@
  5649. #define IPV6_RXHOPOPTS IPV6_HOPOPTS
  5650. #define IPV6_RXDSTOPTS IPV6_DSTOPTS
  5651. -
  5652. #define IPV6_PMTUDISC_DONT 0
  5653. #define IPV6_PMTUDISC_WANT 1
  5654. #define IPV6_PMTUDISC_DO 2
  5655. #define IPV6_PMTUDISC_PROBE 3
  5656. -#define SOL_IPV6 41
  5657. -#define SOL_ICMPV6 58
  5658. -
  5659. #define IPV6_RTHDR_LOOSE 0
  5660. #define IPV6_RTHDR_STRICT 1
  5661. diff -Nur musl-0.9.15/include/netinet/tcp.h musl-git/include/netinet/tcp.h
  5662. --- musl-0.9.15/include/netinet/tcp.h 2014-01-03 21:12:17.000000000 +0100
  5663. +++ musl-git/include/netinet/tcp.h 2014-03-17 16:49:44.000000000 +0100
  5664. @@ -44,42 +44,80 @@
  5665. #define SOL_TCP 6
  5666. #include <sys/types.h>
  5667. #include <sys/socket.h>
  5668. -#endif
  5669. +#include <stdint.h>
  5670. +#include <endian.h>
  5671. +
  5672. +typedef uint32_t tcp_seq;
  5673. +#define TH_FIN 0x01
  5674. +#define TH_SYN 0x02
  5675. +#define TH_RST 0x04
  5676. +#define TH_PUSH 0x08
  5677. +#define TH_ACK 0x10
  5678. +#define TH_URG 0x20
  5679. +
  5680. +struct tcphdr {
  5681. #ifdef _GNU_SOURCE
  5682. -#include <endian.h>
  5683. -struct tcphdr
  5684. -{
  5685. - u_int16_t source;
  5686. - u_int16_t dest;
  5687. - u_int32_t seq;
  5688. - u_int32_t ack_seq;
  5689. +#ifdef __GNUC__
  5690. + __extension__
  5691. +#endif
  5692. + union { struct {
  5693. +
  5694. + uint16_t source;
  5695. + uint16_t dest;
  5696. + uint32_t seq;
  5697. + uint32_t ack_seq;
  5698. +#if __BYTE_ORDER == __LITTLE_ENDIAN
  5699. + uint16_t res1:4;
  5700. + uint16_t doff:4;
  5701. + uint16_t fin:1;
  5702. + uint16_t syn:1;
  5703. + uint16_t rst:1;
  5704. + uint16_t psh:1;
  5705. + uint16_t ack:1;
  5706. + uint16_t urg:1;
  5707. + uint16_t res2:2;
  5708. +#else
  5709. + uint16_t doff:4;
  5710. + uint16_t res1:4;
  5711. + uint16_t res2:2;
  5712. + uint16_t urg:1;
  5713. + uint16_t ack:1;
  5714. + uint16_t psh:1;
  5715. + uint16_t rst:1;
  5716. + uint16_t syn:1;
  5717. + uint16_t fin:1;
  5718. +#endif
  5719. + uint16_t window;
  5720. + uint16_t check;
  5721. + uint16_t urg_ptr;
  5722. +
  5723. + }; struct {
  5724. +#endif
  5725. +
  5726. + uint16_t th_sport;
  5727. + uint16_t th_dport;
  5728. + uint32_t th_seq;
  5729. + uint32_t th_ack;
  5730. #if __BYTE_ORDER == __LITTLE_ENDIAN
  5731. - u_int16_t res1:4;
  5732. - u_int16_t doff:4;
  5733. - u_int16_t fin:1;
  5734. - u_int16_t syn:1;
  5735. - u_int16_t rst:1;
  5736. - u_int16_t psh:1;
  5737. - u_int16_t ack:1;
  5738. - u_int16_t urg:1;
  5739. - u_int16_t res2:2;
  5740. + uint8_t th_x2:4;
  5741. + uint8_t th_off:4;
  5742. #else
  5743. - u_int16_t doff:4;
  5744. - u_int16_t res1:4;
  5745. - u_int16_t res2:2;
  5746. - u_int16_t urg:1;
  5747. - u_int16_t ack:1;
  5748. - u_int16_t psh:1;
  5749. - u_int16_t rst:1;
  5750. - u_int16_t syn:1;
  5751. - u_int16_t fin:1;
  5752. -#endif
  5753. - u_int16_t window;
  5754. - u_int16_t check;
  5755. - u_int16_t urg_ptr;
  5756. + uint8_t th_off:4;
  5757. + uint8_t th_x2:4;
  5758. +#endif
  5759. + uint8_t th_flags;
  5760. + uint16_t th_win;
  5761. + uint16_t th_sum;
  5762. + uint16_t th_urp;
  5763. +
  5764. +#ifdef _GNU_SOURCE
  5765. + }; };
  5766. +#endif
  5767. };
  5768. +#endif
  5769. +#ifdef _GNU_SOURCE
  5770. #define TCPI_OPT_TIMESTAMPS 1
  5771. #define TCPI_OPT_SACK 2
  5772. #define TCPI_OPT_WSCALE 4
  5773. @@ -93,37 +131,37 @@
  5774. struct tcp_info
  5775. {
  5776. - u_int8_t tcpi_state;
  5777. - u_int8_t tcpi_ca_state;
  5778. - u_int8_t tcpi_retransmits;
  5779. - u_int8_t tcpi_probes;
  5780. - u_int8_t tcpi_backoff;
  5781. - u_int8_t tcpi_options;
  5782. - u_int8_t tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4;
  5783. - u_int32_t tcpi_rto;
  5784. - u_int32_t tcpi_ato;
  5785. - u_int32_t tcpi_snd_mss;
  5786. - u_int32_t tcpi_rcv_mss;
  5787. - u_int32_t tcpi_unacked;
  5788. - u_int32_t tcpi_sacked;
  5789. - u_int32_t tcpi_lost;
  5790. - u_int32_t tcpi_retrans;
  5791. - u_int32_t tcpi_fackets;
  5792. - u_int32_t tcpi_last_data_sent;
  5793. - u_int32_t tcpi_last_ack_sent;
  5794. - u_int32_t tcpi_last_data_recv;
  5795. - u_int32_t tcpi_last_ack_recv;
  5796. - u_int32_t tcpi_pmtu;
  5797. - u_int32_t tcpi_rcv_ssthresh;
  5798. - u_int32_t tcpi_rtt;
  5799. - u_int32_t tcpi_rttvar;
  5800. - u_int32_t tcpi_snd_ssthresh;
  5801. - u_int32_t tcpi_snd_cwnd;
  5802. - u_int32_t tcpi_advmss;
  5803. - u_int32_t tcpi_reordering;
  5804. - u_int32_t tcpi_rcv_rtt;
  5805. - u_int32_t tcpi_rcv_space;
  5806. - u_int32_t tcpi_total_retrans;
  5807. + uint8_t tcpi_state;
  5808. + uint8_t tcpi_ca_state;
  5809. + uint8_t tcpi_retransmits;
  5810. + uint8_t tcpi_probes;
  5811. + uint8_t tcpi_backoff;
  5812. + uint8_t tcpi_options;
  5813. + uint8_t tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4;
  5814. + uint32_t tcpi_rto;
  5815. + uint32_t tcpi_ato;
  5816. + uint32_t tcpi_snd_mss;
  5817. + uint32_t tcpi_rcv_mss;
  5818. + uint32_t tcpi_unacked;
  5819. + uint32_t tcpi_sacked;
  5820. + uint32_t tcpi_lost;
  5821. + uint32_t tcpi_retrans;
  5822. + uint32_t tcpi_fackets;
  5823. + uint32_t tcpi_last_data_sent;
  5824. + uint32_t tcpi_last_ack_sent;
  5825. + uint32_t tcpi_last_data_recv;
  5826. + uint32_t tcpi_last_ack_recv;
  5827. + uint32_t tcpi_pmtu;
  5828. + uint32_t tcpi_rcv_ssthresh;
  5829. + uint32_t tcpi_rtt;
  5830. + uint32_t tcpi_rttvar;
  5831. + uint32_t tcpi_snd_ssthresh;
  5832. + uint32_t tcpi_snd_cwnd;
  5833. + uint32_t tcpi_advmss;
  5834. + uint32_t tcpi_reordering;
  5835. + uint32_t tcpi_rcv_rtt;
  5836. + uint32_t tcpi_rcv_space;
  5837. + uint32_t tcpi_total_retrans;
  5838. };
  5839. #define TCP_MD5SIG_MAXKEYLEN 80
  5840. @@ -131,10 +169,10 @@
  5841. struct tcp_md5sig
  5842. {
  5843. struct sockaddr_storage tcpm_addr;
  5844. - u_int16_t __tcpm_pad1;
  5845. - u_int16_t tcpm_keylen;
  5846. - u_int32_t __tcpm_pad2;
  5847. - u_int8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN];
  5848. + uint16_t __tcpm_pad1;
  5849. + uint16_t tcpm_keylen;
  5850. + uint32_t __tcpm_pad2;
  5851. + uint8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN];
  5852. };
  5853. #endif
  5854. diff -Nur musl-0.9.15/include/netinet/udp.h musl-git/include/netinet/udp.h
  5855. --- musl-0.9.15/include/netinet/udp.h 2014-01-03 21:12:17.000000000 +0100
  5856. +++ musl-git/include/netinet/udp.h 2014-03-17 16:49:44.000000000 +0100
  5857. @@ -5,19 +5,22 @@
  5858. extern "C" {
  5859. #endif
  5860. +#include <features.h>
  5861. #include <stdint.h>
  5862. -struct udphdr {
  5863. - uint16_t source;
  5864. - uint16_t dest;
  5865. - uint16_t len;
  5866. - uint16_t check;
  5867. -};
  5868. -
  5869. +#ifdef _GNU_SOURCE
  5870. #define uh_sport source
  5871. #define uh_dport dest
  5872. #define uh_ulen len
  5873. #define uh_sum check
  5874. +#endif
  5875. +
  5876. +struct udphdr {
  5877. + uint16_t uh_sport;
  5878. + uint16_t uh_dport;
  5879. + uint16_t uh_ulen;
  5880. + uint16_t uh_sum;
  5881. +};
  5882. #define UDP_CORK 1
  5883. #define UDP_ENCAP 100
  5884. diff -Nur musl-0.9.15/include/sched.h musl-git/include/sched.h
  5885. --- musl-0.9.15/include/sched.h 2014-01-03 21:12:17.000000000 +0100
  5886. +++ musl-git/include/sched.h 2014-03-17 16:49:44.000000000 +0100
  5887. @@ -78,7 +78,7 @@
  5888. int sched_getaffinity(pid_t, size_t, cpu_set_t *);
  5889. int sched_setaffinity(pid_t, size_t, const cpu_set_t *);
  5890. -#define __CPU_op_S(i, size, set, op) ( (i)/8 >= (size) ? 0 : \
  5891. +#define __CPU_op_S(i, size, set, op) ( (i)/8U >= (size) ? 0 : \
  5892. ((set)->__bits[(i)/8/sizeof(long)] op (1UL<<((i)%(8*sizeof(long))))) )
  5893. #define CPU_SET_S(i, size, set) __CPU_op_S(i, size, set, |=)
  5894. diff -Nur musl-0.9.15/include/signal.h musl-git/include/signal.h
  5895. --- musl-0.9.15/include/signal.h 2014-01-03 21:12:17.000000000 +0100
  5896. +++ musl-git/include/signal.h 2014-03-17 16:49:44.000000000 +0100
  5897. @@ -227,8 +227,8 @@
  5898. typedef void (*sighandler_t)(int);
  5899. void (*bsd_signal(int, void (*)(int)))(int);
  5900. int sigisemptyset(const sigset_t *);
  5901. -int sigorset (sigset_t *, sigset_t *, sigset_t *);
  5902. -int sigandset(sigset_t *, sigset_t *, sigset_t *);
  5903. +int sigorset (sigset_t *, const sigset_t *, const sigset_t *);
  5904. +int sigandset(sigset_t *, const sigset_t *, const sigset_t *);
  5905. #define SA_NOMASK SA_NODEFER
  5906. #define SA_ONESHOT SA_RESETHAND
  5907. diff -Nur musl-0.9.15/include/stdlib.h musl-git/include/stdlib.h
  5908. --- musl-0.9.15/include/stdlib.h 2014-01-03 21:12:17.000000000 +0100
  5909. +++ musl-git/include/stdlib.h 2014-03-17 16:49:44.000000000 +0100
  5910. @@ -93,7 +93,7 @@
  5911. #define WSTOPSIG(s) WEXITSTATUS(s)
  5912. #define WIFEXITED(s) (!WTERMSIG(s))
  5913. #define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001)>>8) > 0x7f00)
  5914. -#define WIFSIGNALED(s) (((s)&0xffff)-1 < 0xffu)
  5915. +#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
  5916. int posix_memalign (void **, size_t, size_t);
  5917. int setenv (const char *, const char *, int);
  5918. diff -Nur musl-0.9.15/include/sys/inotify.h musl-git/include/sys/inotify.h
  5919. --- musl-0.9.15/include/sys/inotify.h 2014-01-03 21:12:17.000000000 +0100
  5920. +++ musl-git/include/sys/inotify.h 2014-03-17 16:49:44.000000000 +0100
  5921. @@ -48,7 +48,7 @@
  5922. int inotify_init(void);
  5923. int inotify_init1(int);
  5924. int inotify_add_watch(int, const char *, uint32_t);
  5925. -int inotify_rm_watch(int, uint32_t);
  5926. +int inotify_rm_watch(int, int);
  5927. #ifdef __cplusplus
  5928. }
  5929. diff -Nur musl-0.9.15/include/sys/mman.h musl-git/include/sys/mman.h
  5930. --- musl-0.9.15/include/sys/mman.h 2014-01-03 21:12:17.000000000 +0100
  5931. +++ musl-git/include/sys/mman.h 2014-03-17 16:49:44.000000000 +0100
  5932. @@ -33,7 +33,7 @@
  5933. #ifdef _GNU_SOURCE
  5934. void *mremap (void *, size_t, size_t, int, ...);
  5935. -int remap_file_pages (void *, size_t, int, ssize_t, int);
  5936. +int remap_file_pages (void *, size_t, int, size_t, int);
  5937. #endif
  5938. #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  5939. diff -Nur musl-0.9.15/include/sys/procfs.h musl-git/include/sys/procfs.h
  5940. --- musl-0.9.15/include/sys/procfs.h 2014-01-03 21:12:17.000000000 +0100
  5941. +++ musl-git/include/sys/procfs.h 2014-03-17 16:49:44.000000000 +0100
  5942. @@ -40,7 +40,7 @@
  5943. char pr_zomb;
  5944. char pr_nice;
  5945. unsigned long int pr_flag;
  5946. -#if __WORDSIZE == 32
  5947. +#if UINTPTR_MAX == 0xffffffff
  5948. unsigned short int pr_uid;
  5949. unsigned short int pr_gid;
  5950. #else
  5951. diff -Nur musl-0.9.15/include/sys/sem.h musl-git/include/sys/sem.h
  5952. --- musl-0.9.15/include/sys/sem.h 2014-01-03 21:12:17.000000000 +0100
  5953. +++ musl-git/include/sys/sem.h 2014-03-17 16:49:44.000000000 +0100
  5954. @@ -27,22 +27,7 @@
  5955. #include <endian.h>
  5956. -struct semid_ds {
  5957. - struct ipc_perm sem_perm;
  5958. - long sem_otime;
  5959. - unsigned long __unused1;
  5960. - long sem_ctime;
  5961. - unsigned long __unused2;
  5962. -#if __BYTE_ORDER == __LITTLE_ENDIAN
  5963. - unsigned short sem_nsems;
  5964. - char __sem_nsems_pad[sizeof(long)-sizeof(short)];
  5965. -#else
  5966. - char __sem_nsems_pad[sizeof(long)-sizeof(short)];
  5967. - unsigned short sem_nsems;
  5968. -#endif
  5969. - unsigned long __unused3;
  5970. - unsigned long __unused4;
  5971. -};
  5972. +#include <bits/sem.h>
  5973. #define _SEM_SEMUN_UNDEFINED 1
  5974. diff -Nur musl-0.9.15/include/sys/shm.h musl-git/include/sys/shm.h
  5975. --- musl-0.9.15/include/sys/shm.h 2014-01-03 21:12:17.000000000 +0100
  5976. +++ musl-git/include/sys/shm.h 2014-03-17 16:49:44.000000000 +0100
  5977. @@ -14,6 +14,13 @@
  5978. #include <bits/alltypes.h>
  5979. #include <sys/ipc.h>
  5980. +
  5981. +#ifdef _GNU_SOURCE
  5982. +#define __used_ids used_ids
  5983. +#define __swap_attempts swap_attempts
  5984. +#define __swap_successes swap_successes
  5985. +#endif
  5986. +
  5987. #include <bits/shm.h>
  5988. #define SHM_R 0400
  5989. @@ -33,20 +40,6 @@
  5990. #define SHM_HUGETLB 04000
  5991. #define SHM_NORESERVE 010000
  5992. -struct shminfo {
  5993. - unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
  5994. -};
  5995. -
  5996. -struct shm_info {
  5997. - int used_ids;
  5998. - unsigned long shm_tot, shm_rss, shm_swp;
  5999. -#ifdef _GNU_SOURCE
  6000. - unsigned long swap_attempts, swap_successes;
  6001. -#else
  6002. - unsigned long __reserved[2];
  6003. -#endif
  6004. -};
  6005. -
  6006. typedef unsigned long shmatt_t;
  6007. void *shmat(int, const void *, int);
  6008. diff -Nur musl-0.9.15/include/sys/socket.h musl-git/include/sys/socket.h
  6009. --- musl-0.9.15/include/sys/socket.h 2014-01-03 21:12:17.000000000 +0100
  6010. +++ musl-git/include/sys/socket.h 2014-03-17 16:49:44.000000000 +0100
  6011. @@ -202,11 +202,16 @@
  6012. #define SO_LOCK_FILTER 44
  6013. #define SO_SELECT_ERR_QUEUE 45
  6014. #define SO_BUSY_POLL 46
  6015. +#define SO_MAX_PACING_RATE 47
  6016. #ifndef SOL_SOCKET
  6017. #define SOL_SOCKET 1
  6018. #endif
  6019. +#define SOL_IP 0
  6020. +#define SOL_IPV6 41
  6021. +#define SOL_ICMPV6 58
  6022. +
  6023. #define SOL_RAW 255
  6024. #define SOL_DECNET 261
  6025. #define SOL_X25 262
  6026. diff -Nur musl-0.9.15/include/sys/sysctl.h musl-git/include/sys/sysctl.h
  6027. --- musl-0.9.15/include/sys/sysctl.h 2014-01-03 21:12:17.000000000 +0100
  6028. +++ musl-git/include/sys/sysctl.h 1970-01-01 01:00:00.000000000 +0100
  6029. @@ -1,17 +0,0 @@
  6030. -#ifndef _SYS_SYSCTL_H
  6031. -#define _SYS_SYSCTL_H
  6032. -
  6033. -#ifdef __cplusplus
  6034. -extern "C" {
  6035. -#endif
  6036. -
  6037. -#define __NEED_size_t
  6038. -#include <bits/alltypes.h>
  6039. -
  6040. -int sysctl (int *, int, void *, size_t *, void *, size_t);
  6041. -
  6042. -#ifdef __cplusplus
  6043. -}
  6044. -#endif
  6045. -
  6046. -#endif
  6047. diff -Nur musl-0.9.15/include/sys/time.h musl-git/include/sys/time.h
  6048. --- musl-0.9.15/include/sys/time.h 2014-01-03 21:12:17.000000000 +0100
  6049. +++ musl-git/include/sys/time.h 2014-03-17 16:49:44.000000000 +0100
  6050. @@ -51,6 +51,17 @@
  6051. ((a)->tv_usec += 1000000, (a)->tv_sec--) )
  6052. #endif
  6053. +#if defined(_GNU_SOURCE)
  6054. +#define TIMEVAL_TO_TIMESPEC(tv, ts) ( \
  6055. + (ts)->tv_sec = (tv)->tv_sec, \
  6056. + (ts)->tv_nsec = (tv)->tv_usec * 1000, \
  6057. + (void)0 )
  6058. +#define TIMESPEC_TO_TIMEVAL(tv, ts) ( \
  6059. + (tv)->tv_sec = (ts)->tv_sec, \
  6060. + (tv)->tv_usec = (ts)->tv_nsec / 1000, \
  6061. + (void)0 )
  6062. +#endif
  6063. +
  6064. #ifdef __cplusplus
  6065. }
  6066. #endif
  6067. diff -Nur musl-0.9.15/include/sys/wait.h musl-git/include/sys/wait.h
  6068. --- musl-0.9.15/include/sys/wait.h 2014-01-03 21:12:17.000000000 +0100
  6069. +++ musl-git/include/sys/wait.h 2014-03-17 16:49:44.000000000 +0100
  6070. @@ -50,7 +50,7 @@
  6071. #define WCOREDUMP(s) ((s) & 0x80)
  6072. #define WIFEXITED(s) (!WTERMSIG(s))
  6073. #define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001)>>8) > 0x7f00)
  6074. -#define WIFSIGNALED(s) (((s)&0xffff)-1 < 0xffu)
  6075. +#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
  6076. #define WIFCONTINUED(s) ((s) == 0xffff)
  6077. #ifdef __cplusplus
  6078. diff -Nur musl-0.9.15/include/syslog.h musl-git/include/syslog.h
  6079. --- musl-0.9.15/include/syslog.h 2014-01-03 21:12:17.000000000 +0100
  6080. +++ musl-git/include/syslog.h 2014-03-17 16:49:44.000000000 +0100
  6081. @@ -21,7 +21,7 @@
  6082. #define LOG_MAKEPRI(f, p) (((f)<<3)|(p))
  6083. #define LOG_MASK(p) (1<<(p))
  6084. -#define LOG_UPTO(p) ((1<<(p)+1)-1)
  6085. +#define LOG_UPTO(p) ((1<<((p)+1))-1)
  6086. #define LOG_KERN (0<<3)
  6087. #define LOG_USER (1<<3)
  6088. diff -Nur musl-0.9.15/include/time.h musl-git/include/time.h
  6089. --- musl-0.9.15/include/time.h 2014-01-03 21:12:17.000000000 +0100
  6090. +++ musl-git/include/time.h 2014-03-17 16:49:44.000000000 +0100
  6091. @@ -125,7 +125,7 @@
  6092. #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  6093. -int stime(time_t *);
  6094. +int stime(const time_t *);
  6095. time_t timegm(struct tm *);
  6096. #endif
  6097. diff -Nur musl-0.9.15/include/utmp.h musl-git/include/utmp.h
  6098. --- musl-0.9.15/include/utmp.h 2014-01-03 21:12:17.000000000 +0100
  6099. +++ musl-git/include/utmp.h 2014-03-17 16:49:44.000000000 +0100
  6100. @@ -10,6 +10,7 @@
  6101. #define ACCOUNTING 9
  6102. #define UT_NAMESIZE 32
  6103. #define UT_HOSTSIZE 256
  6104. +#define UT_LINESIZE 32
  6105. struct lastlog {
  6106. time_t ll_time;
  6107. @@ -22,6 +23,8 @@
  6108. #define ut_addr ut_addr_v6[0]
  6109. #define utmp utmpx
  6110. #define utmpname(x) (-1)
  6111. +#define e_exit __e_exit
  6112. +#define e_termination __e_termination
  6113. void endutent(void);
  6114. struct utmp *getutent(void);
  6115. diff -Nur musl-0.9.15/include/utmpx.h musl-git/include/utmpx.h
  6116. --- musl-0.9.15/include/utmpx.h 2014-01-03 21:12:17.000000000 +0100
  6117. +++ musl-git/include/utmpx.h 2014-03-17 16:49:44.000000000 +0100
  6118. @@ -5,6 +5,8 @@
  6119. extern "C" {
  6120. #endif
  6121. +#include <features.h>
  6122. +
  6123. #define __NEED_pid_t
  6124. #define __NEED_time_t
  6125. #define __NEED_suseconds_t
  6126. @@ -12,19 +14,17 @@
  6127. #include <bits/alltypes.h>
  6128. -#define UT_LINESIZE 32
  6129. -
  6130. struct utmpx
  6131. {
  6132. short ut_type;
  6133. pid_t ut_pid;
  6134. - char ut_line[UT_LINESIZE];
  6135. + char ut_line[32];
  6136. char ut_id[4];
  6137. char ut_user[32];
  6138. char ut_host[256];
  6139. struct {
  6140. - short e_termination;
  6141. - short e_exit;
  6142. + short __e_termination;
  6143. + short __e_exit;
  6144. } ut_exit;
  6145. long ut_session;
  6146. struct timeval ut_tv;
  6147. @@ -39,7 +39,11 @@
  6148. struct utmpx *pututxline(const struct utmpx *);
  6149. void setutxent(void);
  6150. +#if defined(_BSD_SOURCE) | defined(_GNU_SOURCE)
  6151. +#define e_exit __e_exit
  6152. +#define e_termination __e_termination
  6153. void updwtmpx(const char *, const struct utmpx *);
  6154. +#endif
  6155. #define EMPTY 0
  6156. #define RUN_LVL 1
  6157. diff -Nur musl-0.9.15/src/crypt/crypt_des.c musl-git/src/crypt/crypt_des.c
  6158. --- musl-0.9.15/src/crypt/crypt_des.c 2014-01-03 21:12:17.000000000 +0100
  6159. +++ musl-git/src/crypt/crypt_des.c 2014-03-17 16:49:44.000000000 +0100
  6160. @@ -692,7 +692,7 @@
  6161. return saltbits;
  6162. }
  6163. -static void des_setkey(const unsigned char *key, struct expanded_key *ekey)
  6164. +void __des_setkey(const unsigned char *key, struct expanded_key *ekey)
  6165. {
  6166. uint32_t k0, k1, rawkey0, rawkey1;
  6167. unsigned int shifts, round, i, ibit;
  6168. @@ -753,7 +753,7 @@
  6169. /*
  6170. * l_in, r_in, l_out, and r_out are in pseudo-"big-endian" format.
  6171. */
  6172. -static void do_des(uint32_t l_in, uint32_t r_in,
  6173. +void __do_des(uint32_t l_in, uint32_t r_in,
  6174. uint32_t *l_out, uint32_t *r_out,
  6175. uint32_t count, uint32_t saltbits, const struct expanded_key *ekey)
  6176. {
  6177. @@ -862,7 +862,7 @@
  6178. ((uint32_t)in[5] << 16) |
  6179. ((uint32_t)in[4] << 24);
  6180. - do_des(rawl, rawr, &l_out, &r_out, count, saltbits, ekey);
  6181. + __do_des(rawl, rawr, &l_out, &r_out, count, saltbits, ekey);
  6182. out[0] = l_out >> 24;
  6183. out[1] = l_out >> 16;
  6184. @@ -894,7 +894,7 @@
  6185. if (*key)
  6186. key++;
  6187. }
  6188. - des_setkey(keybuf, &ekey);
  6189. + __des_setkey(keybuf, &ekey);
  6190. if (*setting == _PASSWORD_EFMT1) {
  6191. /*
  6192. @@ -929,7 +929,7 @@
  6193. q = keybuf;
  6194. while (q <= &keybuf[sizeof(keybuf) - 1] && *key)
  6195. *q++ ^= *key++ << 1;
  6196. - des_setkey(keybuf, &ekey);
  6197. + __des_setkey(keybuf, &ekey);
  6198. }
  6199. memcpy(output, setting, 9);
  6200. @@ -957,7 +957,7 @@
  6201. /*
  6202. * Do it.
  6203. */
  6204. - do_des(0, 0, &r0, &r1, count, setup_salt(salt), &ekey);
  6205. + __do_des(0, 0, &r0, &r1, count, setup_salt(salt), &ekey);
  6206. /*
  6207. * Now encode the result...
  6208. diff -Nur musl-0.9.15/src/crypt/encrypt.c musl-git/src/crypt/encrypt.c
  6209. --- musl-0.9.15/src/crypt/encrypt.c 1970-01-01 01:00:00.000000000 +0100
  6210. +++ musl-git/src/crypt/encrypt.c 2014-03-17 16:49:44.000000000 +0100
  6211. @@ -0,0 +1,60 @@
  6212. +#include <stdint.h>
  6213. +#include <stdlib.h>
  6214. +#include <unistd.h>
  6215. +
  6216. +struct expanded_key {
  6217. + uint32_t l[16], r[16];
  6218. +};
  6219. +
  6220. +void __des_setkey(const unsigned char *key, struct expanded_key *ekey);
  6221. +void __do_des(uint32_t l_in, uint32_t r_in,
  6222. + uint32_t *l_out, uint32_t *r_out,
  6223. + uint32_t count, uint32_t saltbits, const struct expanded_key *ekey);
  6224. +
  6225. +
  6226. +static struct expanded_key __encrypt_key;
  6227. +
  6228. +void setkey(const char *key)
  6229. +{
  6230. + unsigned char bkey[8];
  6231. + int i, j;
  6232. +
  6233. + for (i = 0; i < 8; i++) {
  6234. + bkey[i] = 0;
  6235. + for (j = 7; j >= 0; j--, key++)
  6236. + bkey[i] |= (uint32_t)(*key & 1) << j;
  6237. + }
  6238. +
  6239. + __des_setkey(bkey, &__encrypt_key);
  6240. +}
  6241. +
  6242. +void encrypt(char *block, int edflag)
  6243. +{
  6244. + struct expanded_key decrypt_key, *key;
  6245. + uint32_t b[2];
  6246. + int i, j;
  6247. + char *p;
  6248. +
  6249. + p = block;
  6250. + for (i = 0; i < 2; i++) {
  6251. + b[i] = 0;
  6252. + for (j = 31; j >= 0; j--, p++)
  6253. + b[i] |= (uint32_t)(*p & 1) << j;
  6254. + }
  6255. +
  6256. + key = &__encrypt_key;
  6257. + if (edflag) {
  6258. + key = &decrypt_key;
  6259. + for (i = 0; i < 16; i++) {
  6260. + decrypt_key.l[i] = __encrypt_key.l[15-i];
  6261. + decrypt_key.r[i] = __encrypt_key.r[15-i];
  6262. + }
  6263. + }
  6264. +
  6265. + __do_des(b[0], b[1], b, b + 1, 1, 0, key);
  6266. +
  6267. + p = block;
  6268. + for (i = 0; i < 2; i++)
  6269. + for (j = 31; j >= 0; j--)
  6270. + *p++ = b[i]>>j & 1;
  6271. +}
  6272. diff -Nur musl-0.9.15/src/dirent/readdir.c musl-git/src/dirent/readdir.c
  6273. --- musl-0.9.15/src/dirent/readdir.c 2014-01-03 21:12:17.000000000 +0100
  6274. +++ musl-git/src/dirent/readdir.c 2014-03-17 16:49:44.000000000 +0100
  6275. @@ -1,5 +1,7 @@
  6276. #include <dirent.h>
  6277. +#include <errno.h>
  6278. #include "__dirent.h"
  6279. +#include "syscall.h"
  6280. #include "libc.h"
  6281. int __getdents(int, struct dirent *, size_t);
  6282. @@ -9,8 +11,11 @@
  6283. struct dirent *de;
  6284. if (dir->buf_pos >= dir->buf_end) {
  6285. - int len = __getdents(dir->fd, (void *)dir->buf, sizeof dir->buf);
  6286. - if (len <= 0) return 0;
  6287. + int len = __syscall(SYS_getdents, dir->fd, dir->buf, sizeof dir->buf);
  6288. + if (len <= 0) {
  6289. + if (len < 0 && len != -ENOENT) errno = -len;
  6290. + return 0;
  6291. + }
  6292. dir->buf_end = len;
  6293. dir->buf_pos = 0;
  6294. }
  6295. diff -Nur musl-0.9.15/src/errno/strerror.c musl-git/src/errno/strerror.c
  6296. --- musl-0.9.15/src/errno/strerror.c 2014-01-03 21:12:17.000000000 +0100
  6297. +++ musl-git/src/errno/strerror.c 2014-03-17 16:49:44.000000000 +0100
  6298. @@ -1,7 +1,7 @@
  6299. #include <errno.h>
  6300. #include <string.h>
  6301. -#define E(a,b) a,
  6302. +#define E(a,b) ((unsigned char)a),
  6303. static const unsigned char errid[] = {
  6304. #include "__strerror.h"
  6305. };
  6306. @@ -16,6 +16,12 @@
  6307. {
  6308. const char *s;
  6309. int i;
  6310. + /* mips has one error code outside of the 8-bit range due to a
  6311. + * historical typo, so we just remap it. */
  6312. + if (EDQUOT==1133) {
  6313. + if (e==109) e=-1;
  6314. + else if (e==EDQUOT) e=109;
  6315. + }
  6316. for (i=0; errid[i] && errid[i] != e; i++);
  6317. for (s=errmsg; i; s++, i--) for (; *s; s++);
  6318. return (char *)s;
  6319. diff -Nur musl-0.9.15/src/fcntl/fcntl.c musl-git/src/fcntl/fcntl.c
  6320. --- musl-0.9.15/src/fcntl/fcntl.c 2014-01-03 21:12:17.000000000 +0100
  6321. +++ musl-git/src/fcntl/fcntl.c 2014-03-17 16:49:44.000000000 +0100
  6322. @@ -7,17 +7,17 @@
  6323. int fcntl(int fd, int cmd, ...)
  6324. {
  6325. - long arg;
  6326. + unsigned long arg;
  6327. va_list ap;
  6328. va_start(ap, cmd);
  6329. - arg = va_arg(ap, long);
  6330. + arg = va_arg(ap, unsigned long);
  6331. va_end(ap);
  6332. if (cmd == F_SETFL) arg |= O_LARGEFILE;
  6333. - if (cmd == F_SETLKW) return syscall_cp(SYS_fcntl, fd, cmd, arg);
  6334. + if (cmd == F_SETLKW) return syscall_cp(SYS_fcntl, fd, cmd, (void *)arg);
  6335. if (cmd == F_GETOWN) {
  6336. struct f_owner_ex ex;
  6337. int ret = __syscall(SYS_fcntl, fd, F_GETOWN_EX, &ex);
  6338. - if (ret == -EINVAL) return __syscall(SYS_fcntl, fd, cmd, arg);
  6339. + if (ret == -EINVAL) return __syscall(SYS_fcntl, fd, cmd, (void *)arg);
  6340. if (ret) return __syscall_ret(ret);
  6341. return ex.type == F_OWNER_PGRP ? -ex.pid : ex.pid;
  6342. }
  6343. @@ -37,5 +37,14 @@
  6344. if (ret >= 0) __syscall(SYS_fcntl, ret, F_SETFD, FD_CLOEXEC);
  6345. return __syscall_ret(ret);
  6346. }
  6347. - return syscall(SYS_fcntl, fd, cmd, arg);
  6348. + switch (cmd) {
  6349. + case F_SETLK:
  6350. + case F_SETLKW:
  6351. + case F_GETLK:
  6352. + case F_GETOWN_EX:
  6353. + case F_SETOWN_EX:
  6354. + return syscall(SYS_fcntl, fd, cmd, (void *)arg);
  6355. + default:
  6356. + return syscall(SYS_fcntl, fd, cmd, arg);
  6357. + }
  6358. }
  6359. diff -Nur musl-0.9.15/src/fcntl/posix_fadvise.c musl-git/src/fcntl/posix_fadvise.c
  6360. --- musl-0.9.15/src/fcntl/posix_fadvise.c 2014-01-03 21:12:17.000000000 +0100
  6361. +++ musl-git/src/fcntl/posix_fadvise.c 2014-03-17 16:49:44.000000000 +0100
  6362. @@ -1,8 +1,11 @@
  6363. #include <fcntl.h>
  6364. #include "syscall.h"
  6365. +#include "libc.h"
  6366. int posix_fadvise(int fd, off_t base, off_t len, int advice)
  6367. {
  6368. return -(__syscall)(SYS_fadvise, fd, __SYSCALL_LL_O(base),
  6369. __SYSCALL_LL_E(len), advice);
  6370. }
  6371. +
  6372. +LFS64(posix_fadvise);
  6373. diff -Nur musl-0.9.15/src/fcntl/posix_fallocate.c musl-git/src/fcntl/posix_fallocate.c
  6374. --- musl-0.9.15/src/fcntl/posix_fallocate.c 2014-01-03 21:12:17.000000000 +0100
  6375. +++ musl-git/src/fcntl/posix_fallocate.c 2014-03-17 16:49:44.000000000 +0100
  6376. @@ -1,8 +1,11 @@
  6377. #include <fcntl.h>
  6378. #include "syscall.h"
  6379. +#include "libc.h"
  6380. int posix_fallocate(int fd, off_t base, off_t len)
  6381. {
  6382. return -__syscall(SYS_fallocate, fd, 0, __SYSCALL_LL_E(base),
  6383. __SYSCALL_LL_E(len));
  6384. }
  6385. +
  6386. +LFS64(posix_fallocate);
  6387. diff -Nur musl-0.9.15/src/fenv/i386/fenv.s musl-git/src/fenv/i386/fenv.s
  6388. --- musl-0.9.15/src/fenv/i386/fenv.s 2014-01-03 21:12:17.000000000 +0100
  6389. +++ musl-git/src/fenv/i386/fenv.s 2014-03-17 16:49:44.000000000 +0100
  6390. @@ -126,7 +126,7 @@
  6391. push %eax
  6392. push %eax
  6393. push %eax
  6394. - push %eax
  6395. + pushl $0xffff
  6396. push %eax
  6397. pushl $0x37f
  6398. fldenv (%esp)
  6399. diff -Nur musl-0.9.15/src/fenv/mipsel-sf/fenv.sub musl-git/src/fenv/mipsel-sf/fenv.sub
  6400. --- musl-0.9.15/src/fenv/mipsel-sf/fenv.sub 1970-01-01 01:00:00.000000000 +0100
  6401. +++ musl-git/src/fenv/mipsel-sf/fenv.sub 2014-03-17 16:49:44.000000000 +0100
  6402. @@ -0,0 +1 @@
  6403. +../fenv.c
  6404. diff -Nur musl-0.9.15/src/fenv/mips-sf/fenv.sub musl-git/src/fenv/mips-sf/fenv.sub
  6405. --- musl-0.9.15/src/fenv/mips-sf/fenv.sub 1970-01-01 01:00:00.000000000 +0100
  6406. +++ musl-git/src/fenv/mips-sf/fenv.sub 2014-03-17 16:49:44.000000000 +0100
  6407. @@ -0,0 +1 @@
  6408. +../fenv.c
  6409. diff -Nur musl-0.9.15/src/fenv/sh/fenv.s musl-git/src/fenv/sh/fenv.s
  6410. --- musl-0.9.15/src/fenv/sh/fenv.s 1970-01-01 01:00:00.000000000 +0100
  6411. +++ musl-git/src/fenv/sh/fenv.s 2014-03-17 16:49:44.000000000 +0100
  6412. @@ -0,0 +1,74 @@
  6413. +.global fegetround
  6414. +.type fegetround, @function
  6415. +fegetround:
  6416. + sts fpscr, r0
  6417. + rts
  6418. + and #3, r0
  6419. +
  6420. +.global __fesetround
  6421. +.type __fesetround, @function
  6422. +__fesetround:
  6423. + sts fpscr, r0
  6424. + or r4, r0
  6425. + lds r0, fpscr
  6426. + rts
  6427. + mov #0, r0
  6428. +
  6429. +.global fetestexcept
  6430. +.type fetestexcept, @function
  6431. +fetestexcept:
  6432. + sts fpscr, r0
  6433. + and r4, r0
  6434. + rts
  6435. + and #0x7c, r0
  6436. +
  6437. +.global feclearexcept
  6438. +.type feclearexcept, @function
  6439. +feclearexcept:
  6440. + mov r4, r0
  6441. + and #0x7c, r0
  6442. + not r0, r4
  6443. + sts fpscr, r0
  6444. + and r4, r0
  6445. + lds r0, fpscr
  6446. + rts
  6447. + mov #0, r0
  6448. +
  6449. +.global feraiseexcept
  6450. +.type feraiseexcept, @function
  6451. +feraiseexcept:
  6452. + mov r4, r0
  6453. + and #0x7c, r0
  6454. + sts fpscr, r4
  6455. + or r4, r0
  6456. + lds r0, fpscr
  6457. + rts
  6458. + mov #0, r0
  6459. +
  6460. +.global fegetenv
  6461. +.type fegetenv, @function
  6462. +fegetenv:
  6463. + sts fpscr, r0
  6464. + mov.l r0, @r4
  6465. + rts
  6466. + mov #0, r0
  6467. +
  6468. +.global fesetenv
  6469. +.type fesetenv, @function
  6470. +fesetenv:
  6471. + mov r4, r0
  6472. + cmp/eq #-1, r0
  6473. + bf 1f
  6474. +
  6475. + ! the default environment is complicated by the fact that we need to
  6476. + ! preserve the current precision bit, which we do not know a priori
  6477. + sts fpscr, r0
  6478. + mov #8, r1
  6479. + swap.w r1, r1
  6480. + bra 2f
  6481. + and r1, r0
  6482. +
  6483. +1: mov.l @r4, r0 ! non-default environment
  6484. +2: lds r0, fpscr
  6485. + rts
  6486. + mov #0, r0
  6487. diff -Nur musl-0.9.15/src/fenv/sheb-nofpu/fenv.sub musl-git/src/fenv/sheb-nofpu/fenv.sub
  6488. --- musl-0.9.15/src/fenv/sheb-nofpu/fenv.sub 1970-01-01 01:00:00.000000000 +0100
  6489. +++ musl-git/src/fenv/sheb-nofpu/fenv.sub 2014-03-17 16:49:44.000000000 +0100
  6490. @@ -0,0 +1 @@
  6491. +../fenv.c
  6492. diff -Nur musl-0.9.15/src/fenv/sh-nofpu/fenv.sub musl-git/src/fenv/sh-nofpu/fenv.sub
  6493. --- musl-0.9.15/src/fenv/sh-nofpu/fenv.sub 1970-01-01 01:00:00.000000000 +0100
  6494. +++ musl-git/src/fenv/sh-nofpu/fenv.sub 2014-03-17 16:49:44.000000000 +0100
  6495. @@ -0,0 +1 @@
  6496. +../fenv.c
  6497. diff -Nur musl-0.9.15/src/fenv/x32/fenv.s musl-git/src/fenv/x32/fenv.s
  6498. --- musl-0.9.15/src/fenv/x32/fenv.s 1970-01-01 01:00:00.000000000 +0100
  6499. +++ musl-git/src/fenv/x32/fenv.s 2014-03-17 16:49:44.000000000 +0100
  6500. @@ -0,0 +1,97 @@
  6501. +.global feclearexcept
  6502. +.type feclearexcept,@function
  6503. +feclearexcept:
  6504. + # maintain exceptions in the sse mxcsr, clear x87 exceptions
  6505. + mov %edi,%ecx
  6506. + and $0x3f,%ecx
  6507. + fnstsw %ax
  6508. + test %eax,%ecx
  6509. + jz 1f
  6510. + fnclex
  6511. +1: stmxcsr -8(%esp)
  6512. + and $0x3f,%eax
  6513. + or %eax,-8(%esp)
  6514. + test %ecx,-8(%esp)
  6515. + jz 1f
  6516. + not %ecx
  6517. + and %ecx,-8(%esp)
  6518. + ldmxcsr -8(%esp)
  6519. +1: xor %eax,%eax
  6520. + ret
  6521. +
  6522. +.global feraiseexcept
  6523. +.type feraiseexcept,@function
  6524. +feraiseexcept:
  6525. + and $0x3f,%edi
  6526. + stmxcsr -8(%esp)
  6527. + or %edi,-8(%esp)
  6528. + ldmxcsr -8(%esp)
  6529. + xor %eax,%eax
  6530. + ret
  6531. +
  6532. +.global __fesetround
  6533. +.type __fesetround,@function
  6534. +__fesetround:
  6535. + push %rax
  6536. + xor %eax,%eax
  6537. + mov %edi,%ecx
  6538. + fnstcw (%esp)
  6539. + andb $0xf3,1(%esp)
  6540. + or %ch,1(%esp)
  6541. + fldcw (%esp)
  6542. + stmxcsr (%esp)
  6543. + shl $3,%ch
  6544. + andb $0x9f,1(%esp)
  6545. + or %ch,1(%esp)
  6546. + ldmxcsr (%esp)
  6547. + pop %rcx
  6548. + ret
  6549. +
  6550. +.global fegetround
  6551. +.type fegetround,@function
  6552. +fegetround:
  6553. + push %rax
  6554. + stmxcsr (%esp)
  6555. + pop %rax
  6556. + shr $3,%eax
  6557. + and $0xc00,%eax
  6558. + ret
  6559. +
  6560. +.global fegetenv
  6561. +.type fegetenv,@function
  6562. +fegetenv:
  6563. + xor %eax,%eax
  6564. + fnstenv (%edi)
  6565. + stmxcsr 28(%edi)
  6566. + ret
  6567. +
  6568. +.global fesetenv
  6569. +.type fesetenv,@function
  6570. +fesetenv:
  6571. + xor %eax,%eax
  6572. + inc %edi
  6573. + jz 1f
  6574. + fldenv -1(%edi)
  6575. + ldmxcsr 27(%edi)
  6576. + ret
  6577. +1: push %rax
  6578. + push %rax
  6579. + pushq $0xffff
  6580. + pushq $0x37f
  6581. + fldenv (%esp)
  6582. + pushq $0x1f80
  6583. + ldmxcsr (%esp)
  6584. + add $40,%esp
  6585. + ret
  6586. +
  6587. +.global fetestexcept
  6588. +.type fetestexcept,@function
  6589. +fetestexcept:
  6590. + and $0x3f,%edi
  6591. + push %rax
  6592. + stmxcsr (%esp)
  6593. + pop %rsi
  6594. + fnstsw %ax
  6595. + or %esi,%eax
  6596. + and %edi,%eax
  6597. + ret
  6598. diff -Nur musl-0.9.15/src/fenv/x86_64/fenv.s musl-git/src/fenv/x86_64/fenv.s
  6599. --- musl-0.9.15/src/fenv/x86_64/fenv.s 2014-01-03 21:12:17.000000000 +0100
  6600. +++ musl-git/src/fenv/x86_64/fenv.s 2014-03-17 16:49:44.000000000 +0100
  6601. @@ -76,7 +76,7 @@
  6602. ret
  6603. 1: push %rax
  6604. push %rax
  6605. - push %rax
  6606. + pushq $0xffff
  6607. pushq $0x37f
  6608. fldenv (%rsp)
  6609. pushq $0x1f80
  6610. diff -Nur musl-0.9.15/src/internal/sh/syscall.s musl-git/src/internal/sh/syscall.s
  6611. --- musl-0.9.15/src/internal/sh/syscall.s 1970-01-01 01:00:00.000000000 +0100
  6612. +++ musl-git/src/internal/sh/syscall.s 2014-03-17 16:49:44.000000000 +0100
  6613. @@ -0,0 +1,22 @@
  6614. +.global __syscall
  6615. +.type __syscall, @function
  6616. +__syscall:
  6617. + ! The kernel syscall entry point documents that the trap number indicates
  6618. + ! the number of arguments being passed, but it then ignores that information.
  6619. + ! Since we do not actually know how many arguments are being passed, we will
  6620. + ! say there are six, since that is the maximum we support here.
  6621. + mov r4, r3
  6622. + mov r5, r4
  6623. + mov r6, r5
  6624. + mov r7, r6
  6625. + mov.l @r15, r7
  6626. + mov.l @(4,r15), r0
  6627. + mov.l @(8,r15), r1
  6628. + trapa #22
  6629. + or r0, r0
  6630. + or r0, r0
  6631. + or r0, r0
  6632. + or r0, r0
  6633. + or r0, r0
  6634. + rts
  6635. + nop
  6636. diff -Nur musl-0.9.15/src/internal/stdio_impl.h musl-git/src/internal/stdio_impl.h
  6637. --- musl-0.9.15/src/internal/stdio_impl.h 2014-01-03 21:12:17.000000000 +0100
  6638. +++ musl-git/src/internal/stdio_impl.h 2014-03-17 16:49:44.000000000 +0100
  6639. @@ -17,6 +17,7 @@
  6640. #define F_EOF 16
  6641. #define F_ERR 32
  6642. #define F_SVB 64
  6643. +#define F_APP 128
  6644. struct _IO_FILE {
  6645. unsigned flags;
  6646. diff -Nur musl-0.9.15/src/internal/syscall.h musl-git/src/internal/syscall.h
  6647. --- musl-0.9.15/src/internal/syscall.h 2014-01-03 21:12:17.000000000 +0100
  6648. +++ musl-git/src/internal/syscall.h 2014-03-17 16:49:44.000000000 +0100
  6649. @@ -1,22 +1,28 @@
  6650. #ifndef _INTERNAL_SYSCALL_H
  6651. #define _INTERNAL_SYSCALL_H
  6652. -#if defined(__PIC__) && (100*__GNUC__+__GNUC_MINOR__ >= 303)
  6653. -__attribute__((visibility("protected")))
  6654. -#endif
  6655. -long __syscall_ret(unsigned long), __syscall(long, ...),
  6656. - __syscall_cp(long, long, long, long, long, long, long);
  6657. -
  6658. #include <sys/syscall.h>
  6659. #include "syscall_arch.h"
  6660. -#define __syscall1(n,a) __syscall1(n,(long)(a))
  6661. -#define __syscall2(n,a,b) __syscall2(n,(long)(a),(long)(b))
  6662. -#define __syscall3(n,a,b,c) __syscall3(n,(long)(a),(long)(b),(long)(c))
  6663. -#define __syscall4(n,a,b,c,d) __syscall4(n,(long)(a),(long)(b),(long)(c),(long)(d))
  6664. -#define __syscall5(n,a,b,c,d,e) __syscall5(n,(long)(a),(long)(b),(long)(c),(long)(d),(long)(e))
  6665. -#define __syscall6(n,a,b,c,d,e,f) __syscall6(n,(long)(a),(long)(b),(long)(c),(long)(d),(long)(e),(long)(f))
  6666. -#define __syscall7(n,a,b,c,d,e,f,g) (__syscall)(n,(long)(a),(long)(b),(long)(c),(long)(d),(long)(e),(long)(f),(long)g)
  6667. +#ifndef __scc
  6668. +#define __scc(X) ((long) (X))
  6669. +typedef long syscall_arg_t;
  6670. +#endif
  6671. +
  6672. +#if defined(__PIC__) && (100*__GNUC__+__GNUC_MINOR__ >= 303)
  6673. +__attribute__((visibility("protected")))
  6674. +#endif
  6675. +long __syscall_ret(unsigned long), __syscall(syscall_arg_t, ...),
  6676. + __syscall_cp(syscall_arg_t, syscall_arg_t, syscall_arg_t, syscall_arg_t,
  6677. + syscall_arg_t, syscall_arg_t, syscall_arg_t);
  6678. +
  6679. +#define __syscall1(n,a) __syscall1(n,__scc(a))
  6680. +#define __syscall2(n,a,b) __syscall2(n,__scc(a),__scc(b))
  6681. +#define __syscall3(n,a,b,c) __syscall3(n,__scc(a),__scc(b),__scc(c))
  6682. +#define __syscall4(n,a,b,c,d) __syscall4(n,__scc(a),__scc(b),__scc(c),__scc(d))
  6683. +#define __syscall5(n,a,b,c,d,e) __syscall5(n,__scc(a),__scc(b),__scc(c),__scc(d),__scc(e))
  6684. +#define __syscall6(n,a,b,c,d,e,f) __syscall6(n,__scc(a),__scc(b),__scc(c),__scc(d),__scc(e),__scc(f))
  6685. +#define __syscall7(n,a,b,c,d,e,f,g) (__syscall)(n,__scc(a),__scc(b),__scc(c),__scc(d),__scc(e),__scc(f),__scc(g))
  6686. #define __SYSCALL_NARGS_X(a,b,c,d,e,f,g,h,n,...) n
  6687. #define __SYSCALL_NARGS(...) __SYSCALL_NARGS_X(__VA_ARGS__,7,6,5,4,3,2,1,0,)
  6688. @@ -31,12 +37,12 @@
  6689. #define socketcall_cp __socketcall_cp
  6690. #define __syscall_cp0(n) (__syscall_cp)(n,0,0,0,0,0,0)
  6691. -#define __syscall_cp1(n,a) (__syscall_cp)(n,(long)(a),0,0,0,0,0)
  6692. -#define __syscall_cp2(n,a,b) (__syscall_cp)(n,(long)(a),(long)(b),0,0,0,0)
  6693. -#define __syscall_cp3(n,a,b,c) (__syscall_cp)(n,(long)(a),(long)(b),(long)(c),0,0,0)
  6694. -#define __syscall_cp4(n,a,b,c,d) (__syscall_cp)(n,(long)(a),(long)(b),(long)(c),(long)(d),0,0)
  6695. -#define __syscall_cp5(n,a,b,c,d,e) (__syscall_cp)(n,(long)(a),(long)(b),(long)(c),(long)(d),(long)(e),0)
  6696. -#define __syscall_cp6(n,a,b,c,d,e,f) (__syscall_cp)(n,(long)(a),(long)(b),(long)(c),(long)(d),(long)(e),(long)(f))
  6697. +#define __syscall_cp1(n,a) (__syscall_cp)(n,__scc(a),0,0,0,0,0)
  6698. +#define __syscall_cp2(n,a,b) (__syscall_cp)(n,__scc(a),__scc(b),0,0,0,0)
  6699. +#define __syscall_cp3(n,a,b,c) (__syscall_cp)(n,__scc(a),__scc(b),__scc(c),0,0,0)
  6700. +#define __syscall_cp4(n,a,b,c,d) (__syscall_cp)(n,__scc(a),__scc(b),__scc(c),__scc(d),0,0)
  6701. +#define __syscall_cp5(n,a,b,c,d,e) (__syscall_cp)(n,__scc(a),__scc(b),__scc(c),__scc(d),__scc(e),0)
  6702. +#define __syscall_cp6(n,a,b,c,d,e,f) (__syscall_cp)(n,__scc(a),__scc(b),__scc(c),__scc(d),__scc(e),__scc(f))
  6703. #define __syscall_cp(...) __SYSCALL_DISP(__syscall_cp,__VA_ARGS__)
  6704. #define syscall_cp(...) __syscall_ret(__syscall_cp(__VA_ARGS__))
  6705. diff -Nur musl-0.9.15/src/internal/x32/syscall.s musl-git/src/internal/x32/syscall.s
  6706. --- musl-0.9.15/src/internal/x32/syscall.s 1970-01-01 01:00:00.000000000 +0100
  6707. +++ musl-git/src/internal/x32/syscall.s 2014-03-17 16:49:44.000000000 +0100
  6708. @@ -0,0 +1,12 @@
  6709. +.global __syscall
  6710. +.type __syscall,@function
  6711. +__syscall:
  6712. + movq %rdi,%rax
  6713. + movq %rsi,%rdi
  6714. + movq %rdx,%rsi
  6715. + movq %rcx,%rdx
  6716. + movq %r8,%r10
  6717. + movq %r9,%r8
  6718. + movq 8(%rsp),%r9
  6719. + syscall
  6720. + ret
  6721. diff -Nur musl-0.9.15/src/ipc/semctl.c musl-git/src/ipc/semctl.c
  6722. --- musl-0.9.15/src/ipc/semctl.c 2014-01-03 21:12:17.000000000 +0100
  6723. +++ musl-git/src/ipc/semctl.c 2014-03-17 16:49:44.000000000 +0100
  6724. @@ -3,16 +3,26 @@
  6725. #include "syscall.h"
  6726. #include "ipc.h"
  6727. +union semun {
  6728. + int val;
  6729. + struct semid_ds *buf;
  6730. + unsigned short *array;
  6731. +};
  6732. +
  6733. int semctl(int id, int num, int cmd, ...)
  6734. {
  6735. - long arg;
  6736. + union semun arg = {0};
  6737. va_list ap;
  6738. - va_start(ap, cmd);
  6739. - arg = va_arg(ap, long);
  6740. - va_end(ap);
  6741. + switch (cmd) {
  6742. + case SETVAL: case GETALL: case SETALL: case IPC_STAT: case IPC_SET:
  6743. + case IPC_INFO: case SEM_INFO: case SEM_STAT:
  6744. + va_start(ap, cmd);
  6745. + arg = va_arg(ap, union semun);
  6746. + va_end(ap);
  6747. + }
  6748. #ifdef SYS_semctl
  6749. - return syscall(SYS_semctl, id, num, cmd | IPC_64, arg);
  6750. + return syscall(SYS_semctl, id, num, cmd | IPC_64, arg.buf);
  6751. #else
  6752. - return syscall(SYS_ipc, IPCOP_semctl, id, num, cmd | IPC_64, &arg);
  6753. + return syscall(SYS_ipc, IPCOP_semctl, id, num, cmd | IPC_64, &arg.buf);
  6754. #endif
  6755. }
  6756. diff -Nur musl-0.9.15/src/ldso/dladdr.c musl-git/src/ldso/dladdr.c
  6757. --- musl-0.9.15/src/ldso/dladdr.c 2014-01-03 21:12:17.000000000 +0100
  6758. +++ musl-git/src/ldso/dladdr.c 2014-03-17 16:49:44.000000000 +0100
  6759. @@ -1,9 +1,9 @@
  6760. #define _GNU_SOURCE
  6761. #include <dlfcn.h>
  6762. -int __dladdr(void *, Dl_info *);
  6763. +int __dladdr(const void *, Dl_info *);
  6764. -int dladdr(void *addr, Dl_info *info)
  6765. +int dladdr(const void *addr, Dl_info *info)
  6766. {
  6767. return __dladdr(addr, info);
  6768. }
  6769. diff -Nur musl-0.9.15/src/ldso/dynlink.c musl-git/src/ldso/dynlink.c
  6770. --- musl-0.9.15/src/ldso/dynlink.c 2014-01-03 21:12:17.000000000 +0100
  6771. +++ musl-git/src/ldso/dynlink.c 2014-03-17 16:49:44.000000000 +0100
  6772. @@ -253,7 +253,8 @@
  6773. name = strings + sym->st_name;
  6774. ctx = IS_COPY(type) ? head->next : head;
  6775. def = find_sym(ctx, name, IS_PLT(type));
  6776. - if (!def.sym && sym->st_info>>4 != STB_WEAK) {
  6777. + if (!def.sym && (sym->st_shndx != SHN_UNDEF
  6778. + || sym->st_info>>4 != STB_WEAK)) {
  6779. snprintf(errbuf, sizeof errbuf,
  6780. "Error relocating %s: %s: symbol not found",
  6781. dso->name, name);
  6782. @@ -1331,7 +1332,7 @@
  6783. return 0;
  6784. }
  6785. -int __dladdr(void *addr, Dl_info *info)
  6786. +int __dladdr(const void *addr, Dl_info *info)
  6787. {
  6788. struct dso *p;
  6789. Sym *sym;
  6790. @@ -1441,7 +1442,7 @@
  6791. {
  6792. return 0;
  6793. }
  6794. -int __dladdr (void *addr, Dl_info *info)
  6795. +int __dladdr (const void *addr, Dl_info *info)
  6796. {
  6797. return 0;
  6798. }
  6799. diff -Nur musl-0.9.15/src/ldso/sh/dlsym.s musl-git/src/ldso/sh/dlsym.s
  6800. --- musl-0.9.15/src/ldso/sh/dlsym.s 1970-01-01 01:00:00.000000000 +0100
  6801. +++ musl-git/src/ldso/sh/dlsym.s 2014-03-17 16:49:44.000000000 +0100
  6802. @@ -0,0 +1,10 @@
  6803. +.text
  6804. +.global dlsym
  6805. +.type dlsym, @function
  6806. +dlsym:
  6807. + mov.l L1, r0
  6808. + braf r0
  6809. +1: mov.l @r15, r6
  6810. +
  6811. +.align 2
  6812. +L1: .long __dlsym@PLT-(1b-.)
  6813. diff -Nur musl-0.9.15/src/ldso/sh/start.s musl-git/src/ldso/sh/start.s
  6814. --- musl-0.9.15/src/ldso/sh/start.s 1970-01-01 01:00:00.000000000 +0100
  6815. +++ musl-git/src/ldso/sh/start.s 2014-03-17 16:49:44.000000000 +0100
  6816. @@ -0,0 +1,26 @@
  6817. +.text
  6818. +.global _start
  6819. +.type _start, @function
  6820. +_start:
  6821. + mov.l @r15, r4
  6822. + mov r15, r5
  6823. + mov.l L1, r0
  6824. + bsrf r0
  6825. + add #4, r5
  6826. +
  6827. +2: mov r0, r2
  6828. + mov.l @r15+, r1
  6829. +1: mov.l @r15+, r0
  6830. + cmp/eq #-1, r0
  6831. + bt/s 1b
  6832. + add #-1, r1
  6833. +
  6834. + add #1, r1
  6835. + mov.l r0, @-r15
  6836. + mov.l r1, @-r15
  6837. + mov #0, r4
  6838. + jmp @r2
  6839. + nop
  6840. +
  6841. +.align 2
  6842. +L1: .long __dynlink@PLT-(2b-.)
  6843. diff -Nur musl-0.9.15/src/ldso/x32/dlsym.s musl-git/src/ldso/x32/dlsym.s
  6844. --- musl-0.9.15/src/ldso/x32/dlsym.s 1970-01-01 01:00:00.000000000 +0100
  6845. +++ musl-git/src/ldso/x32/dlsym.s 2014-03-17 16:49:44.000000000 +0100
  6846. @@ -0,0 +1,6 @@
  6847. +.text
  6848. +.global dlsym
  6849. +.type dlsym,@function
  6850. +dlsym:
  6851. + mov (%rsp),%rdx
  6852. + jmp __dlsym
  6853. diff -Nur musl-0.9.15/src/ldso/x32/start.s musl-git/src/ldso/x32/start.s
  6854. --- musl-0.9.15/src/ldso/x32/start.s 1970-01-01 01:00:00.000000000 +0100
  6855. +++ musl-git/src/ldso/x32/start.s 2014-03-17 16:49:44.000000000 +0100
  6856. @@ -0,0 +1,24 @@
  6857. +.text
  6858. +.global _start
  6859. +_start:
  6860. + mov (%rsp),%rdi /* move argc into 1st argument slot */
  6861. + lea 4(%rsp),%rsi /* move argv into 2nd argument slot */
  6862. + call __dynlink
  6863. + /* in case the dynlinker was called directly, it sets the "consumed"
  6864. + argv values to -1. so we must loop over the array as long as -1
  6865. + is in the top argv slot, decrement argc, and then set the stackpointer
  6866. + to the new argc as well as argc's new value.
  6867. + as the x32 abi has longs in the argv array, we cannot use push/pop.*/
  6868. + movl (%rsp),%edi /* copy argc into edi */
  6869. + xor %rdx,%rdx /* we use rdx as an offset to the current argv member */
  6870. +1: dec %edi
  6871. + addl $4, %edx
  6872. + movl (%rsp, %rdx), %esi
  6873. + cmp $-1,%esi
  6874. + jz 1b
  6875. + inc %edi
  6876. + subl $4, %edx
  6877. + lea (%rsp, %rdx), %rsp /* set rsp to new argv[-1] */
  6878. + movl %edi, (%rsp) /* write new argc there */
  6879. + xor %edx,%edx
  6880. + jmp *%rax
  6881. diff -Nur musl-0.9.15/src/linux/clone.c musl-git/src/linux/clone.c
  6882. --- musl-0.9.15/src/linux/clone.c 1970-01-01 01:00:00.000000000 +0100
  6883. +++ musl-git/src/linux/clone.c 2014-03-17 16:49:44.000000000 +0100
  6884. @@ -0,0 +1,19 @@
  6885. +#include <stdarg.h>
  6886. +#include <unistd.h>
  6887. +#include "pthread_impl.h"
  6888. +#include "syscall.h"
  6889. +
  6890. +int clone(int (*func)(void *), void *stack, int flags, void *arg, ...)
  6891. +{
  6892. + va_list ap;
  6893. + pid_t *ptid, *ctid;
  6894. + void *tls;
  6895. +
  6896. + va_start(ap, arg);
  6897. + ptid = va_arg(ap, pid_t *);
  6898. + tls = va_arg(ap, void *);
  6899. + ctid = va_arg(ap, pid_t *);
  6900. + va_end(ap);
  6901. +
  6902. + return __syscall_ret(__clone(func, stack, flags, arg, ptid, tls, ctid));
  6903. +}
  6904. diff -Nur musl-0.9.15/src/linux/fallocate.c musl-git/src/linux/fallocate.c
  6905. --- musl-0.9.15/src/linux/fallocate.c 2014-01-03 21:12:17.000000000 +0100
  6906. +++ musl-git/src/linux/fallocate.c 2014-03-17 16:49:44.000000000 +0100
  6907. @@ -1,9 +1,13 @@
  6908. #define _GNU_SOURCE
  6909. #include <fcntl.h>
  6910. #include "syscall.h"
  6911. +#include "libc.h"
  6912. int fallocate(int fd, int mode, off_t base, off_t len)
  6913. {
  6914. return syscall(SYS_fallocate, fd, mode, __SYSCALL_LL_E(base),
  6915. __SYSCALL_LL_E(len));
  6916. }
  6917. +
  6918. +#undef fallocate64
  6919. +LFS64(fallocate);
  6920. diff -Nur musl-0.9.15/src/linux/inotify.c musl-git/src/linux/inotify.c
  6921. --- musl-0.9.15/src/linux/inotify.c 2014-01-03 21:12:17.000000000 +0100
  6922. +++ musl-git/src/linux/inotify.c 2014-03-17 16:49:44.000000000 +0100
  6923. @@ -15,7 +15,7 @@
  6924. return syscall(SYS_inotify_add_watch, fd, pathname, mask);
  6925. }
  6926. -int inotify_rm_watch(int fd, uint32_t wd)
  6927. +int inotify_rm_watch(int fd, int wd)
  6928. {
  6929. return syscall(SYS_inotify_rm_watch, fd, wd);
  6930. }
  6931. diff -Nur musl-0.9.15/src/linux/remap_file_pages.c musl-git/src/linux/remap_file_pages.c
  6932. --- musl-0.9.15/src/linux/remap_file_pages.c 2014-01-03 21:12:17.000000000 +0100
  6933. +++ musl-git/src/linux/remap_file_pages.c 2014-03-17 16:49:44.000000000 +0100
  6934. @@ -2,7 +2,7 @@
  6935. #include <sys/mman.h>
  6936. #include "syscall.h"
  6937. -int remap_file_pages(void *addr, size_t size, int prot, ssize_t pgoff, int flags)
  6938. +int remap_file_pages(void *addr, size_t size, int prot, size_t pgoff, int flags)
  6939. {
  6940. return syscall(SYS_remap_file_pages, addr, size, prot, pgoff, flags);
  6941. }
  6942. diff -Nur musl-0.9.15/src/linux/stime.c musl-git/src/linux/stime.c
  6943. --- musl-0.9.15/src/linux/stime.c 2014-01-03 21:12:17.000000000 +0100
  6944. +++ musl-git/src/linux/stime.c 2014-03-17 16:49:44.000000000 +0100
  6945. @@ -2,7 +2,7 @@
  6946. #include <time.h>
  6947. #include <sys/time.h>
  6948. -int stime(time_t *t)
  6949. +int stime(const time_t *t)
  6950. {
  6951. struct timeval tv = { .tv_sec = *t, .tv_usec = 0 };
  6952. return settimeofday(&tv, (void *)0);
  6953. diff -Nur musl-0.9.15/src/linux/x32/sysinfo.s musl-git/src/linux/x32/sysinfo.s
  6954. --- musl-0.9.15/src/linux/x32/sysinfo.s 1970-01-01 01:00:00.000000000 +0100
  6955. +++ musl-git/src/linux/x32/sysinfo.s 2014-03-17 16:49:44.000000000 +0100
  6956. @@ -0,0 +1,5 @@
  6957. +.text
  6958. +.global sysinfo
  6959. +.type sysinfo,@function
  6960. +sysinfo:
  6961. + jmp __x32_sysinfo
  6962. diff -Nur musl-0.9.15/src/locale/wcsxfrm.c musl-git/src/locale/wcsxfrm.c
  6963. --- musl-0.9.15/src/locale/wcsxfrm.c 2014-01-03 21:12:17.000000000 +0100
  6964. +++ musl-git/src/locale/wcsxfrm.c 2014-03-17 16:49:44.000000000 +0100
  6965. @@ -6,10 +6,12 @@
  6966. size_t __wcsxfrm_l(wchar_t *restrict dest, const wchar_t *restrict src, size_t n, locale_t loc)
  6967. {
  6968. size_t l = wcslen(src);
  6969. - if (l >= n) {
  6970. + if (l < n) {
  6971. + wmemcpy(dest, src, l+1);
  6972. + } else if (n) {
  6973. wmemcpy(dest, src, n-1);
  6974. dest[n-1] = 0;
  6975. - } else wcscpy(dest, src);
  6976. + }
  6977. return l;
  6978. }
  6979. diff -Nur musl-0.9.15/src/math/i386/remainderf.s musl-git/src/math/i386/remainderf.s
  6980. --- musl-0.9.15/src/math/i386/remainderf.s 2014-01-03 21:12:18.000000000 +0100
  6981. +++ musl-git/src/math/i386/remainderf.s 2014-03-17 16:49:44.000000000 +0100
  6982. @@ -1,6 +1,9 @@
  6983. .global remainderf
  6984. .type remainderf,@function
  6985. remainderf:
  6986. +.weak dremf
  6987. +.type dremf,@function
  6988. +dremf:
  6989. flds 8(%esp)
  6990. flds 4(%esp)
  6991. 1: fprem1
  6992. diff -Nur musl-0.9.15/src/math/i386/remainder.s musl-git/src/math/i386/remainder.s
  6993. --- musl-0.9.15/src/math/i386/remainder.s 2014-01-03 21:12:18.000000000 +0100
  6994. +++ musl-git/src/math/i386/remainder.s 2014-03-17 16:49:44.000000000 +0100
  6995. @@ -1,6 +1,9 @@
  6996. .global remainder
  6997. .type remainder,@function
  6998. remainder:
  6999. +.weak drem
  7000. +.type drem,@function
  7001. +drem:
  7002. fldl 12(%esp)
  7003. fldl 4(%esp)
  7004. 1: fprem1
  7005. diff -Nur musl-0.9.15/src/math/x32/acosl.s musl-git/src/math/x32/acosl.s
  7006. --- musl-0.9.15/src/math/x32/acosl.s 1970-01-01 01:00:00.000000000 +0100
  7007. +++ musl-git/src/math/x32/acosl.s 2014-03-17 16:49:44.000000000 +0100
  7008. @@ -0,0 +1,16 @@
  7009. +# see ../i386/acos.s
  7010. +
  7011. +.global acosl
  7012. +.type acosl,@function
  7013. +acosl:
  7014. + fldt 8(%esp)
  7015. +1: fld %st(0)
  7016. + fld1
  7017. + fsub %st(0),%st(1)
  7018. + fadd %st(2)
  7019. + fmulp
  7020. + fsqrt
  7021. + fabs
  7022. + fxch %st(1)
  7023. + fpatan
  7024. + ret
  7025. diff -Nur musl-0.9.15/src/math/x32/asinl.s musl-git/src/math/x32/asinl.s
  7026. --- musl-0.9.15/src/math/x32/asinl.s 1970-01-01 01:00:00.000000000 +0100
  7027. +++ musl-git/src/math/x32/asinl.s 2014-03-17 16:49:44.000000000 +0100
  7028. @@ -0,0 +1,12 @@
  7029. +.global asinl
  7030. +.type asinl,@function
  7031. +asinl:
  7032. + fldt 8(%esp)
  7033. +1: fld %st(0)
  7034. + fld1
  7035. + fsub %st(0),%st(1)
  7036. + fadd %st(2)
  7037. + fmulp
  7038. + fsqrt
  7039. + fpatan
  7040. + ret
  7041. diff -Nur musl-0.9.15/src/math/x32/atan2l.s musl-git/src/math/x32/atan2l.s
  7042. --- musl-0.9.15/src/math/x32/atan2l.s 1970-01-01 01:00:00.000000000 +0100
  7043. +++ musl-git/src/math/x32/atan2l.s 2014-03-17 16:49:44.000000000 +0100
  7044. @@ -0,0 +1,7 @@
  7045. +.global atan2l
  7046. +.type atan2l,@function
  7047. +atan2l:
  7048. + fldt 8(%esp)
  7049. + fldt 24(%esp)
  7050. + fpatan
  7051. + ret
  7052. diff -Nur musl-0.9.15/src/math/x32/atanl.s musl-git/src/math/x32/atanl.s
  7053. --- musl-0.9.15/src/math/x32/atanl.s 1970-01-01 01:00:00.000000000 +0100
  7054. +++ musl-git/src/math/x32/atanl.s 2014-03-17 16:49:44.000000000 +0100
  7055. @@ -0,0 +1,7 @@
  7056. +.global atanl
  7057. +.type atanl,@function
  7058. +atanl:
  7059. + fldt 8(%esp)
  7060. + fld1
  7061. + fpatan
  7062. + ret
  7063. diff -Nur musl-0.9.15/src/math/x32/ceill.s musl-git/src/math/x32/ceill.s
  7064. --- musl-0.9.15/src/math/x32/ceill.s 1970-01-01 01:00:00.000000000 +0100
  7065. +++ musl-git/src/math/x32/ceill.s 2014-03-17 16:49:44.000000000 +0100
  7066. @@ -0,0 +1 @@
  7067. +# see floorl.s
  7068. diff -Nur musl-0.9.15/src/math/x32/exp2l.s musl-git/src/math/x32/exp2l.s
  7069. --- musl-0.9.15/src/math/x32/exp2l.s 1970-01-01 01:00:00.000000000 +0100
  7070. +++ musl-git/src/math/x32/exp2l.s 2014-03-17 16:49:44.000000000 +0100
  7071. @@ -0,0 +1,90 @@
  7072. +.global expm1l
  7073. +.type expm1l,@function
  7074. +expm1l:
  7075. + fldt 8(%esp)
  7076. + fldl2e
  7077. + fmulp
  7078. + movl $0xc2820000,-4(%esp)
  7079. + flds -4(%esp)
  7080. + fucomp %st(1)
  7081. + fnstsw %ax
  7082. + sahf
  7083. + fld1
  7084. + jb 1f
  7085. + # x*log2e <= -65, return -1 without underflow
  7086. + fstp %st(1)
  7087. + fchs
  7088. + ret
  7089. +1: fld %st(1)
  7090. + fabs
  7091. + fucom %st(1)
  7092. + fnstsw %ax
  7093. + fstp %st(0)
  7094. + fstp %st(0)
  7095. + sahf
  7096. + ja 1f
  7097. + f2xm1
  7098. + ret
  7099. +1: push %rax
  7100. + call 1f
  7101. + pop %rax
  7102. + fld1
  7103. + fsubrp
  7104. + ret
  7105. +
  7106. +.global exp2l
  7107. +.type exp2l,@function
  7108. +exp2l:
  7109. + fldt 8(%esp)
  7110. +1: fld %st(0)
  7111. + sub $16,%esp
  7112. + fstpt (%esp)
  7113. + mov 8(%esp),%ax
  7114. + and $0x7fff,%ax
  7115. + cmp $0x3fff+13,%ax
  7116. + jb 4f # |x| < 8192
  7117. + cmp $0x3fff+15,%ax
  7118. + jae 3f # |x| >= 32768
  7119. + fsts (%esp)
  7120. + cmpl $0xc67ff800,(%esp)
  7121. + jb 2f # x > -16382
  7122. + movl $0x5f000000,(%esp)
  7123. + flds (%esp) # 0x1p63
  7124. + fld %st(1)
  7125. + fsub %st(1)
  7126. + faddp
  7127. + fucomp %st(1)
  7128. + fnstsw
  7129. + sahf
  7130. + je 2f # x - 0x1p63 + 0x1p63 == x
  7131. + movl $1,(%esp)
  7132. + flds (%esp) # 0x1p-149
  7133. + fdiv %st(1)
  7134. + fstps (%esp) # raise underflow
  7135. +2: fld1
  7136. + fld %st(1)
  7137. + frndint
  7138. + fxch %st(2)
  7139. + fsub %st(2) # st(0)=x-rint(x), st(1)=1, st(2)=rint(x)
  7140. + f2xm1
  7141. + faddp # 2^(x-rint(x))
  7142. +1: fscale
  7143. + fstp %st(1)
  7144. + add $16,%esp
  7145. + ret
  7146. +3: xor %eax,%eax
  7147. +4: cmp $0x3fff-64,%ax
  7148. + fld1
  7149. + jb 1b # |x| < 0x1p-64
  7150. + fstpt (%esp)
  7151. + fistl 8(%esp)
  7152. + fildl 8(%esp)
  7153. + fsubrp %st(1)
  7154. + addl $0x3fff,8(%esp)
  7155. + f2xm1
  7156. + fld1
  7157. + faddp # 2^(x-rint(x))
  7158. + fldt (%esp) # 2^rint(x)
  7159. + fmulp
  7160. + add $16,%esp
  7161. + ret
  7162. diff -Nur musl-0.9.15/src/math/x32/expl.s musl-git/src/math/x32/expl.s
  7163. --- musl-0.9.15/src/math/x32/expl.s 1970-01-01 01:00:00.000000000 +0100
  7164. +++ musl-git/src/math/x32/expl.s 2014-03-17 16:49:44.000000000 +0100
  7165. @@ -0,0 +1,101 @@
  7166. +# exp(x) = 2^hi + 2^hi (2^lo - 1)
  7167. +# where hi+lo = log2e*x with 128bit precision
  7168. +# exact log2e*x calculation depends on nearest rounding mode
  7169. +# using the exact multiplication method of Dekker and Veltkamp
  7170. +
  7171. +.global expl
  7172. +.type expl,@function
  7173. +expl:
  7174. + fldt 8(%esp)
  7175. +
  7176. + # interesting case: 0x1p-32 <= |x| < 16384
  7177. + # check if (exponent|0x8000) is in [0xbfff-32, 0xbfff+13]
  7178. + mov 16(%esp), %ax
  7179. + or $0x8000, %ax
  7180. + sub $0xbfdf, %ax
  7181. + cmp $45, %ax
  7182. + jbe 2f
  7183. + test %ax, %ax
  7184. + fld1
  7185. + js 1f
  7186. + # if |x|>=0x1p14 or nan return 2^trunc(x)
  7187. + fscale
  7188. + fstp %st(1)
  7189. + ret
  7190. + # if |x|<0x1p-32 return 1+x
  7191. +1: faddp
  7192. + ret
  7193. +
  7194. + # should be 0x1.71547652b82fe178p0L == 0x3fff b8aa3b29 5c17f0bc
  7195. + # it will be wrong on non-nearest rounding mode
  7196. +2: fldl2e
  7197. + sub $48, %esp
  7198. + # hi = log2e_hi*x
  7199. + # 2^hi = exp2l(hi)
  7200. + fmul %st(1),%st
  7201. + fld %st(0)
  7202. + fstpt (%esp)
  7203. + fstpt 16(%esp)
  7204. + fstpt 32(%esp)
  7205. + call exp2l
  7206. + # if 2^hi == inf return 2^hi
  7207. + fld %st(0)
  7208. + fstpt (%esp)
  7209. + cmpw $0x7fff, 8(%esp)
  7210. + je 1f
  7211. + fldt 32(%esp)
  7212. + fldt 16(%esp)
  7213. + # fpu stack: 2^hi x hi
  7214. + # exact mult: x*log2e
  7215. + fld %st(1)
  7216. + # c = 0x1p32+1
  7217. + movq $0x41f0000000100000,%rax
  7218. + pushq %rax
  7219. + fldl (%esp)
  7220. + # xh = x - c*x + c*x
  7221. + # xl = x - xh
  7222. + fmulp
  7223. + fld %st(2)
  7224. + fsub %st(1), %st
  7225. + faddp
  7226. + fld %st(2)
  7227. + fsub %st(1), %st
  7228. + # yh = log2e_hi - c*log2e_hi + c*log2e_hi
  7229. + movq $0x3ff7154765200000,%rax
  7230. + pushq %rax
  7231. + fldl (%esp)
  7232. + # fpu stack: 2^hi x hi xh xl yh
  7233. + # lo = hi - xh*yh + xl*yh
  7234. + fld %st(2)
  7235. + fmul %st(1), %st
  7236. + fsubp %st, %st(4)
  7237. + fmul %st(1), %st
  7238. + faddp %st, %st(3)
  7239. + # yl = log2e_hi - yh
  7240. + movq $0x3de705fc2f000000,%rax
  7241. + pushq %rax
  7242. + fldl (%esp)
  7243. + # fpu stack: 2^hi x lo xh xl yl
  7244. + # lo += xh*yl + xl*yl
  7245. + fmul %st, %st(2)
  7246. + fmulp %st, %st(1)
  7247. + fxch %st(2)
  7248. + faddp
  7249. + faddp
  7250. + # log2e_lo
  7251. + movq $0xbfbe,%rax
  7252. + pushq %rax
  7253. + movq $0x82f0025f2dc582ee,%rax
  7254. + pushq %rax
  7255. + fldt (%esp)
  7256. + add $40,%esp
  7257. + # fpu stack: 2^hi x lo log2e_lo
  7258. + # lo += log2e_lo*x
  7259. + # return 2^hi + 2^hi (2^lo - 1)
  7260. + fmulp %st, %st(2)
  7261. + faddp
  7262. + f2xm1
  7263. + fmul %st(1), %st
  7264. + faddp
  7265. +1: add $48, %esp
  7266. + ret
  7267. diff -Nur musl-0.9.15/src/math/x32/expm1l.s musl-git/src/math/x32/expm1l.s
  7268. --- musl-0.9.15/src/math/x32/expm1l.s 1970-01-01 01:00:00.000000000 +0100
  7269. +++ musl-git/src/math/x32/expm1l.s 2014-03-17 16:49:44.000000000 +0100
  7270. @@ -0,0 +1 @@
  7271. +# see exp2l.s
  7272. diff -Nur musl-0.9.15/src/math/x32/fabsf.s musl-git/src/math/x32/fabsf.s
  7273. --- musl-0.9.15/src/math/x32/fabsf.s 1970-01-01 01:00:00.000000000 +0100
  7274. +++ musl-git/src/math/x32/fabsf.s 2014-03-17 16:49:44.000000000 +0100
  7275. @@ -0,0 +1,7 @@
  7276. +.global fabsf
  7277. +.type fabsf,@function
  7278. +fabsf:
  7279. + mov $0x7fffffff,%eax
  7280. + movq %rax,%xmm1
  7281. + andps %xmm1,%xmm0
  7282. + ret
  7283. diff -Nur musl-0.9.15/src/math/x32/fabsl.s musl-git/src/math/x32/fabsl.s
  7284. --- musl-0.9.15/src/math/x32/fabsl.s 1970-01-01 01:00:00.000000000 +0100
  7285. +++ musl-git/src/math/x32/fabsl.s 2014-03-17 16:49:44.000000000 +0100
  7286. @@ -0,0 +1,6 @@
  7287. +.global fabsl
  7288. +.type fabsl,@function
  7289. +fabsl:
  7290. + fldt 8(%esp)
  7291. + fabs
  7292. + ret
  7293. diff -Nur musl-0.9.15/src/math/x32/fabs.s musl-git/src/math/x32/fabs.s
  7294. --- musl-0.9.15/src/math/x32/fabs.s 1970-01-01 01:00:00.000000000 +0100
  7295. +++ musl-git/src/math/x32/fabs.s 2014-03-17 16:49:44.000000000 +0100
  7296. @@ -0,0 +1,9 @@
  7297. +.global fabs
  7298. +.type fabs,@function
  7299. +fabs:
  7300. + xor %eax,%eax
  7301. + dec %rax
  7302. + shr %rax
  7303. + movq %rax,%xmm1
  7304. + andpd %xmm1,%xmm0
  7305. + ret
  7306. diff -Nur musl-0.9.15/src/math/x32/floorl.s musl-git/src/math/x32/floorl.s
  7307. --- musl-0.9.15/src/math/x32/floorl.s 1970-01-01 01:00:00.000000000 +0100
  7308. +++ musl-git/src/math/x32/floorl.s 2014-03-17 16:49:44.000000000 +0100
  7309. @@ -0,0 +1,27 @@
  7310. +.global floorl
  7311. +.type floorl,@function
  7312. +floorl:
  7313. + fldt 8(%esp)
  7314. +1: mov $0x7,%al
  7315. +1: fstcw 8(%esp)
  7316. + mov 9(%esp),%ah
  7317. + mov %al,9(%esp)
  7318. + fldcw 8(%esp)
  7319. + frndint
  7320. + mov %ah,9(%esp)
  7321. + fldcw 8(%esp)
  7322. + ret
  7323. +
  7324. +.global ceill
  7325. +.type ceill,@function
  7326. +ceill:
  7327. + fldt 8(%esp)
  7328. + mov $0xb,%al
  7329. + jmp 1b
  7330. +
  7331. +.global truncl
  7332. +.type truncl,@function
  7333. +truncl:
  7334. + fldt 8(%esp)
  7335. + mov $0xf,%al
  7336. + jmp 1b
  7337. diff -Nur musl-0.9.15/src/math/x32/fmodl.s musl-git/src/math/x32/fmodl.s
  7338. --- musl-0.9.15/src/math/x32/fmodl.s 1970-01-01 01:00:00.000000000 +0100
  7339. +++ musl-git/src/math/x32/fmodl.s 2014-03-17 16:49:44.000000000 +0100
  7340. @@ -0,0 +1,11 @@
  7341. +.global fmodl
  7342. +.type fmodl,@function
  7343. +fmodl:
  7344. + fldt 24(%esp)
  7345. + fldt 8(%esp)
  7346. +1: fprem
  7347. + fstsw %ax
  7348. + sahf
  7349. + jp 1b
  7350. + fstp %st(1)
  7351. + ret
  7352. diff -Nur musl-0.9.15/src/math/x32/llrintf.s musl-git/src/math/x32/llrintf.s
  7353. --- musl-0.9.15/src/math/x32/llrintf.s 1970-01-01 01:00:00.000000000 +0100
  7354. +++ musl-git/src/math/x32/llrintf.s 2014-03-17 16:49:44.000000000 +0100
  7355. @@ -0,0 +1,5 @@
  7356. +.global llrintf
  7357. +.type llrintf,@function
  7358. +llrintf:
  7359. + cvtss2si %xmm0,%rax
  7360. + ret
  7361. diff -Nur musl-0.9.15/src/math/x32/llrintl.s musl-git/src/math/x32/llrintl.s
  7362. --- musl-0.9.15/src/math/x32/llrintl.s 1970-01-01 01:00:00.000000000 +0100
  7363. +++ musl-git/src/math/x32/llrintl.s 2014-03-17 16:49:44.000000000 +0100
  7364. @@ -0,0 +1,7 @@
  7365. +.global llrintl
  7366. +.type llrintl,@function
  7367. +llrintl:
  7368. + fldt 8(%esp)
  7369. + fistpll 8(%esp)
  7370. + mov 8(%esp),%rax
  7371. + ret
  7372. diff -Nur musl-0.9.15/src/math/x32/llrint.s musl-git/src/math/x32/llrint.s
  7373. --- musl-0.9.15/src/math/x32/llrint.s 1970-01-01 01:00:00.000000000 +0100
  7374. +++ musl-git/src/math/x32/llrint.s 2014-03-17 16:49:44.000000000 +0100
  7375. @@ -0,0 +1,5 @@
  7376. +.global llrint
  7377. +.type llrint,@function
  7378. +llrint:
  7379. + cvtsd2si %xmm0,%rax
  7380. + ret
  7381. diff -Nur musl-0.9.15/src/math/x32/log10l.s musl-git/src/math/x32/log10l.s
  7382. --- musl-0.9.15/src/math/x32/log10l.s 1970-01-01 01:00:00.000000000 +0100
  7383. +++ musl-git/src/math/x32/log10l.s 2014-03-17 16:49:44.000000000 +0100
  7384. @@ -0,0 +1,7 @@
  7385. +.global log10l
  7386. +.type log10l,@function
  7387. +log10l:
  7388. + fldlg2
  7389. + fldt 8(%esp)
  7390. + fyl2x
  7391. + ret
  7392. diff -Nur musl-0.9.15/src/math/x32/log1pl.s musl-git/src/math/x32/log1pl.s
  7393. --- musl-0.9.15/src/math/x32/log1pl.s 1970-01-01 01:00:00.000000000 +0100
  7394. +++ musl-git/src/math/x32/log1pl.s 2014-03-17 16:49:44.000000000 +0100
  7395. @@ -0,0 +1,15 @@
  7396. +.global log1pl
  7397. +.type log1pl,@function
  7398. +log1pl:
  7399. + mov 14(%esp),%eax
  7400. + fldln2
  7401. + and $0x7fffffff,%eax
  7402. + fldt 8(%esp)
  7403. + cmp $0x3ffd9400,%eax
  7404. + ja 1f
  7405. + fyl2xp1
  7406. + ret
  7407. +1: fld1
  7408. + faddp
  7409. + fyl2x
  7410. + ret
  7411. diff -Nur musl-0.9.15/src/math/x32/log2l.s musl-git/src/math/x32/log2l.s
  7412. --- musl-0.9.15/src/math/x32/log2l.s 1970-01-01 01:00:00.000000000 +0100
  7413. +++ musl-git/src/math/x32/log2l.s 2014-03-17 16:49:44.000000000 +0100
  7414. @@ -0,0 +1,7 @@
  7415. +.global log2l
  7416. +.type log2l,@function
  7417. +log2l:
  7418. + fld1
  7419. + fldt 8(%esp)
  7420. + fyl2x
  7421. + ret
  7422. diff -Nur musl-0.9.15/src/math/x32/logl.s musl-git/src/math/x32/logl.s
  7423. --- musl-0.9.15/src/math/x32/logl.s 1970-01-01 01:00:00.000000000 +0100
  7424. +++ musl-git/src/math/x32/logl.s 2014-03-17 16:49:44.000000000 +0100
  7425. @@ -0,0 +1,7 @@
  7426. +.global logl
  7427. +.type logl,@function
  7428. +logl:
  7429. + fldln2
  7430. + fldt 8(%esp)
  7431. + fyl2x
  7432. + ret
  7433. diff -Nur musl-0.9.15/src/math/x32/lrintf.s musl-git/src/math/x32/lrintf.s
  7434. --- musl-0.9.15/src/math/x32/lrintf.s 1970-01-01 01:00:00.000000000 +0100
  7435. +++ musl-git/src/math/x32/lrintf.s 2014-03-17 16:49:44.000000000 +0100
  7436. @@ -0,0 +1,5 @@
  7437. +.global lrintf
  7438. +.type lrintf,@function
  7439. +lrintf:
  7440. + cvtss2si %xmm0,%rax
  7441. + ret
  7442. diff -Nur musl-0.9.15/src/math/x32/lrintl.s musl-git/src/math/x32/lrintl.s
  7443. --- musl-0.9.15/src/math/x32/lrintl.s 1970-01-01 01:00:00.000000000 +0100
  7444. +++ musl-git/src/math/x32/lrintl.s 2014-03-17 16:49:44.000000000 +0100
  7445. @@ -0,0 +1,7 @@
  7446. +.global lrintl
  7447. +.type lrintl,@function
  7448. +lrintl:
  7449. + fldt 8(%esp)
  7450. + fistpll 8(%esp)
  7451. + mov 8(%esp),%rax
  7452. + ret
  7453. diff -Nur musl-0.9.15/src/math/x32/lrint.s musl-git/src/math/x32/lrint.s
  7454. --- musl-0.9.15/src/math/x32/lrint.s 1970-01-01 01:00:00.000000000 +0100
  7455. +++ musl-git/src/math/x32/lrint.s 2014-03-17 16:49:44.000000000 +0100
  7456. @@ -0,0 +1,5 @@
  7457. +.global lrint
  7458. +.type lrint,@function
  7459. +lrint:
  7460. + cvtsd2si %xmm0,%rax
  7461. + ret
  7462. diff -Nur musl-0.9.15/src/math/x32/remainderl.s musl-git/src/math/x32/remainderl.s
  7463. --- musl-0.9.15/src/math/x32/remainderl.s 1970-01-01 01:00:00.000000000 +0100
  7464. +++ musl-git/src/math/x32/remainderl.s 2014-03-17 16:49:44.000000000 +0100
  7465. @@ -0,0 +1,11 @@
  7466. +.global remainderl
  7467. +.type remainderl,@function
  7468. +remainderl:
  7469. + fldt 24(%esp)
  7470. + fldt 8(%esp)
  7471. +1: fprem1
  7472. + fstsw %ax
  7473. + sahf
  7474. + jp 1b
  7475. + fstp %st(1)
  7476. + ret
  7477. diff -Nur musl-0.9.15/src/math/x32/rintl.s musl-git/src/math/x32/rintl.s
  7478. --- musl-0.9.15/src/math/x32/rintl.s 1970-01-01 01:00:00.000000000 +0100
  7479. +++ musl-git/src/math/x32/rintl.s 2014-03-17 16:49:44.000000000 +0100
  7480. @@ -0,0 +1,6 @@
  7481. +.global rintl
  7482. +.type rintl,@function
  7483. +rintl:
  7484. + fldt 8(%esp)
  7485. + frndint
  7486. + ret
  7487. diff -Nur musl-0.9.15/src/math/x32/sqrtf.s musl-git/src/math/x32/sqrtf.s
  7488. --- musl-0.9.15/src/math/x32/sqrtf.s 1970-01-01 01:00:00.000000000 +0100
  7489. +++ musl-git/src/math/x32/sqrtf.s 2014-03-17 16:49:44.000000000 +0100
  7490. @@ -0,0 +1,4 @@
  7491. +.global sqrtf
  7492. +.type sqrtf,@function
  7493. +sqrtf: sqrtss %xmm0, %xmm0
  7494. + ret
  7495. diff -Nur musl-0.9.15/src/math/x32/sqrtl.s musl-git/src/math/x32/sqrtl.s
  7496. --- musl-0.9.15/src/math/x32/sqrtl.s 1970-01-01 01:00:00.000000000 +0100
  7497. +++ musl-git/src/math/x32/sqrtl.s 2014-03-17 16:49:44.000000000 +0100
  7498. @@ -0,0 +1,5 @@
  7499. +.global sqrtl
  7500. +.type sqrtl,@function
  7501. +sqrtl: fldt 8(%esp)
  7502. + fsqrt
  7503. + ret
  7504. diff -Nur musl-0.9.15/src/math/x32/sqrt.s musl-git/src/math/x32/sqrt.s
  7505. --- musl-0.9.15/src/math/x32/sqrt.s 1970-01-01 01:00:00.000000000 +0100
  7506. +++ musl-git/src/math/x32/sqrt.s 2014-03-17 16:49:44.000000000 +0100
  7507. @@ -0,0 +1,4 @@
  7508. +.global sqrt
  7509. +.type sqrt,@function
  7510. +sqrt: sqrtsd %xmm0, %xmm0
  7511. + ret
  7512. diff -Nur musl-0.9.15/src/math/x32/truncl.s musl-git/src/math/x32/truncl.s
  7513. --- musl-0.9.15/src/math/x32/truncl.s 1970-01-01 01:00:00.000000000 +0100
  7514. +++ musl-git/src/math/x32/truncl.s 2014-03-17 16:49:44.000000000 +0100
  7515. @@ -0,0 +1 @@
  7516. +# see floorl.s
  7517. diff -Nur musl-0.9.15/src/misc/nftw.c musl-git/src/misc/nftw.c
  7518. --- musl-0.9.15/src/misc/nftw.c 2014-01-03 21:12:18.000000000 +0100
  7519. +++ musl-git/src/misc/nftw.c 2014-03-17 16:49:44.000000000 +0100
  7520. @@ -46,8 +46,7 @@
  7521. type = FTW_F;
  7522. }
  7523. - if ((flags & FTW_MOUNT) && h
  7524. - && (st.st_dev != h->dev || st.st_ino != h->ino))
  7525. + if ((flags & FTW_MOUNT) && h && st.st_dev != h->dev)
  7526. return 0;
  7527. new.chain = h;
  7528. diff -Nur musl-0.9.15/src/misc/pty.c musl-git/src/misc/pty.c
  7529. --- musl-0.9.15/src/misc/pty.c 2014-01-03 21:12:18.000000000 +0100
  7530. +++ musl-git/src/misc/pty.c 2014-03-17 16:49:44.000000000 +0100
  7531. @@ -26,7 +26,7 @@
  7532. {
  7533. int pty, err;
  7534. if (!buf) len = 0;
  7535. - if ((err = __syscall(SYS_ioctl, fd, TIOCGPTN, &pty))) return err;
  7536. + if ((err = __syscall(SYS_ioctl, fd, TIOCGPTN, &pty))) return -err;
  7537. if (snprintf(buf, len, "/dev/pts/%d", pty) >= len) return ERANGE;
  7538. return 0;
  7539. }
  7540. diff -Nur musl-0.9.15/src/misc/syscall.c musl-git/src/misc/syscall.c
  7541. --- musl-0.9.15/src/misc/syscall.c 2014-01-03 21:12:18.000000000 +0100
  7542. +++ musl-git/src/misc/syscall.c 2014-03-18 22:16:18.000000000 +0100
  7543. @@ -6,14 +6,14 @@
  7544. long syscall(long n, ...)
  7545. {
  7546. va_list ap;
  7547. - long a,b,c,d,e,f;
  7548. + syscall_arg_t a,b,c,d,e,f;
  7549. va_start(ap, n);
  7550. - a=va_arg(ap, long);
  7551. - b=va_arg(ap, long);
  7552. - c=va_arg(ap, long);
  7553. - d=va_arg(ap, long);
  7554. - e=va_arg(ap, long);
  7555. - f=va_arg(ap, long);
  7556. + a=va_arg(ap, syscall_arg_t);
  7557. + b=va_arg(ap, syscall_arg_t);
  7558. + c=va_arg(ap, syscall_arg_t);
  7559. + d=va_arg(ap, syscall_arg_t);
  7560. + e=va_arg(ap, syscall_arg_t);
  7561. + f=va_arg(ap, syscall_arg_t);
  7562. va_end(ap);
  7563. return __syscall_ret(__syscall(n,a,b,c,d,e,f));
  7564. }
  7565. diff -Nur musl-0.9.15/src/network/accept4.c musl-git/src/network/accept4.c
  7566. --- musl-0.9.15/src/network/accept4.c 2014-01-03 21:12:18.000000000 +0100
  7567. +++ musl-git/src/network/accept4.c 2014-03-17 16:49:44.000000000 +0100
  7568. @@ -1,9 +1,20 @@
  7569. #define _GNU_SOURCE
  7570. #include <sys/socket.h>
  7571. +#include <errno.h>
  7572. +#include <fcntl.h>
  7573. #include "syscall.h"
  7574. #include "libc.h"
  7575. int accept4(int fd, struct sockaddr *restrict addr, socklen_t *restrict len, int flg)
  7576. {
  7577. - return socketcall_cp(accept4, fd, addr, len, flg, 0, 0);
  7578. + if (!flg) return accept(fd, addr, len);
  7579. + int ret = socketcall_cp(accept4, fd, addr, len, flg, 0, 0);
  7580. + if (ret>=0 || (errno != ENOSYS && errno != EINVAL)) return ret;
  7581. + ret = accept(fd, addr, len);
  7582. + if (ret<0) return ret;
  7583. + if (flg & SOCK_CLOEXEC)
  7584. + __syscall(SYS_fcntl, ret, F_SETFD, FD_CLOEXEC);
  7585. + if (flg & SOCK_NONBLOCK)
  7586. + __syscall(SYS_fcntl, ret, F_SETFL, O_NONBLOCK);
  7587. + return ret;
  7588. }
  7589. diff -Nur musl-0.9.15/src/network/inet_legacy.c musl-git/src/network/inet_legacy.c
  7590. --- musl-0.9.15/src/network/inet_legacy.c 2014-01-03 21:12:18.000000000 +0100
  7591. +++ musl-git/src/network/inet_legacy.c 2014-03-17 16:49:44.000000000 +0100
  7592. @@ -16,9 +16,8 @@
  7593. return 1;
  7594. }
  7595. -struct in_addr inet_makeaddr(int net, int host)
  7596. +struct in_addr inet_makeaddr(in_addr_t n, in_addr_t h)
  7597. {
  7598. - uint32_t n = net, h = host;
  7599. if (n < 256) h |= n<<24;
  7600. else if (n < 65536) h |= n<<16;
  7601. else h |= n<<8;
  7602. diff -Nur musl-0.9.15/src/network/proto.c musl-git/src/network/proto.c
  7603. --- musl-0.9.15/src/network/proto.c 2014-01-03 21:12:18.000000000 +0100
  7604. +++ musl-git/src/network/proto.c 2014-03-17 16:49:44.000000000 +0100
  7605. @@ -4,7 +4,7 @@
  7606. /* do we really need all these?? */
  7607. static int idx;
  7608. -static const unsigned char protos[][6] = {
  7609. +static const unsigned char protos[][8] = {
  7610. "\000ip",
  7611. "\001icmp",
  7612. "\002igmp",
  7613. @@ -13,7 +13,9 @@
  7614. "\014pup",
  7615. "\021udp",
  7616. "\026idp",
  7617. - "\377raw"
  7618. + "\051ipv6",
  7619. + "\072icmpv6",
  7620. + "\377raw",
  7621. "\0\0"
  7622. };
  7623. diff -Nur musl-0.9.15/src/prng/random.c musl-git/src/prng/random.c
  7624. --- musl-0.9.15/src/prng/random.c 2014-01-03 21:12:18.000000000 +0100
  7625. +++ musl-git/src/prng/random.c 2014-03-17 16:49:44.000000000 +0100
  7626. @@ -1,10 +1,3 @@
  7627. -/*
  7628. - * random.c - Copyright © 2011 Szabolcs Nagy
  7629. - * Permission to use, copy, modify, and/or distribute this code
  7630. - * for any purpose with or without fee is hereby granted.
  7631. - * There is no warranty.
  7632. -*/
  7633. -
  7634. #include <stdlib.h>
  7635. #include <stdint.h>
  7636. #include "libc.h"
  7637. @@ -12,11 +5,7 @@
  7638. /*
  7639. this code uses the same lagged fibonacci generator as the
  7640. original bsd random implementation except for the seeding
  7641. -
  7642. -different seeds produce different sequences with long period
  7643. -(other libcs seed the state with a park-miller generator
  7644. -when seed=0 some fail to produce good random sequence
  7645. -others produce the same sequence as another seed)
  7646. +which was broken in the original
  7647. */
  7648. static uint32_t init[] = {
  7649. @@ -98,6 +87,7 @@
  7650. n = 63;
  7651. x = (uint32_t*)state + 1;
  7652. __srandom(seed);
  7653. + savestate();
  7654. UNLOCK(lock);
  7655. return old;
  7656. }
  7657. diff -Nur musl-0.9.15/src/process/posix_spawn.c musl-git/src/process/posix_spawn.c
  7658. --- musl-0.9.15/src/process/posix_spawn.c 2014-01-03 21:12:18.000000000 +0100
  7659. +++ musl-git/src/process/posix_spawn.c 2014-03-17 16:49:44.000000000 +0100
  7660. @@ -166,7 +166,7 @@
  7661. close(args.p[0]);
  7662. - if (!ec) *res = pid;
  7663. + if (!ec && res) *res = pid;
  7664. pthread_sigmask(SIG_SETMASK, &args.oldmask, 0);
  7665. pthread_setcancelstate(cs, 0);
  7666. diff -Nur musl-0.9.15/src/process/x32/vfork.s musl-git/src/process/x32/vfork.s
  7667. --- musl-0.9.15/src/process/x32/vfork.s 1970-01-01 01:00:00.000000000 +0100
  7668. +++ musl-git/src/process/x32/vfork.s 2014-03-17 16:49:44.000000000 +0100
  7669. @@ -0,0 +1,12 @@
  7670. +.global __vfork
  7671. +.weak vfork
  7672. +.type __vfork,@function
  7673. +.type vfork,@function
  7674. +__vfork:
  7675. +vfork:
  7676. + pop %rdx
  7677. + mov $0x4000003a,%eax /* SYS_vfork */
  7678. + syscall
  7679. + push %rdx
  7680. + mov %rax,%rdi
  7681. + jmp __syscall_ret
  7682. diff -Nur musl-0.9.15/src/setjmp/mipsel-sf/longjmp.sub musl-git/src/setjmp/mipsel-sf/longjmp.sub
  7683. --- musl-0.9.15/src/setjmp/mipsel-sf/longjmp.sub 1970-01-01 01:00:00.000000000 +0100
  7684. +++ musl-git/src/setjmp/mipsel-sf/longjmp.sub 2014-03-17 16:49:44.000000000 +0100
  7685. @@ -0,0 +1 @@
  7686. +../mips-sf/longjmp.s
  7687. diff -Nur musl-0.9.15/src/setjmp/mipsel-sf/setjmp.sub musl-git/src/setjmp/mipsel-sf/setjmp.sub
  7688. --- musl-0.9.15/src/setjmp/mipsel-sf/setjmp.sub 1970-01-01 01:00:00.000000000 +0100
  7689. +++ musl-git/src/setjmp/mipsel-sf/setjmp.sub 2014-03-17 16:49:44.000000000 +0100
  7690. @@ -0,0 +1 @@
  7691. +../mips-sf/setjmp.s
  7692. diff -Nur musl-0.9.15/src/setjmp/mips-sf/longjmp.s musl-git/src/setjmp/mips-sf/longjmp.s
  7693. --- musl-0.9.15/src/setjmp/mips-sf/longjmp.s 1970-01-01 01:00:00.000000000 +0100
  7694. +++ musl-git/src/setjmp/mips-sf/longjmp.s 2014-03-17 16:49:44.000000000 +0100
  7695. @@ -0,0 +1,25 @@
  7696. +.set noreorder
  7697. +
  7698. +.global _longjmp
  7699. +.global longjmp
  7700. +.type _longjmp,@function
  7701. +.type longjmp,@function
  7702. +_longjmp:
  7703. +longjmp:
  7704. + move $2, $5
  7705. + bne $2, $0, 1f
  7706. + nop
  7707. + addu $2, $2, 1
  7708. +1: lw $ra, 0($4)
  7709. + lw $sp, 4($4)
  7710. + lw $16, 8($4)
  7711. + lw $17, 12($4)
  7712. + lw $18, 16($4)
  7713. + lw $19, 20($4)
  7714. + lw $20, 24($4)
  7715. + lw $21, 28($4)
  7716. + lw $22, 32($4)
  7717. + lw $23, 36($4)
  7718. + lw $30, 40($4)
  7719. + jr $ra
  7720. + lw $28, 44($4)
  7721. diff -Nur musl-0.9.15/src/setjmp/mips-sf/longjmp.sub musl-git/src/setjmp/mips-sf/longjmp.sub
  7722. --- musl-0.9.15/src/setjmp/mips-sf/longjmp.sub 1970-01-01 01:00:00.000000000 +0100
  7723. +++ musl-git/src/setjmp/mips-sf/longjmp.sub 2014-03-17 16:49:44.000000000 +0100
  7724. @@ -0,0 +1 @@
  7725. +longjmp.s
  7726. diff -Nur musl-0.9.15/src/setjmp/mips-sf/setjmp.s musl-git/src/setjmp/mips-sf/setjmp.s
  7727. --- musl-0.9.15/src/setjmp/mips-sf/setjmp.s 1970-01-01 01:00:00.000000000 +0100
  7728. +++ musl-git/src/setjmp/mips-sf/setjmp.s 2014-03-17 16:49:44.000000000 +0100
  7729. @@ -0,0 +1,25 @@
  7730. +.set noreorder
  7731. +
  7732. +.global __setjmp
  7733. +.global _setjmp
  7734. +.global setjmp
  7735. +.type __setjmp,@function
  7736. +.type _setjmp,@function
  7737. +.type setjmp,@function
  7738. +__setjmp:
  7739. +_setjmp:
  7740. +setjmp:
  7741. + sw $ra, 0($4)
  7742. + sw $sp, 4($4)
  7743. + sw $16, 8($4)
  7744. + sw $17, 12($4)
  7745. + sw $18, 16($4)
  7746. + sw $19, 20($4)
  7747. + sw $20, 24($4)
  7748. + sw $21, 28($4)
  7749. + sw $22, 32($4)
  7750. + sw $23, 36($4)
  7751. + sw $30, 40($4)
  7752. + sw $28, 44($4)
  7753. + jr $ra
  7754. + li $2, 0
  7755. diff -Nur musl-0.9.15/src/setjmp/mips-sf/setjmp.sub musl-git/src/setjmp/mips-sf/setjmp.sub
  7756. --- musl-0.9.15/src/setjmp/mips-sf/setjmp.sub 1970-01-01 01:00:00.000000000 +0100
  7757. +++ musl-git/src/setjmp/mips-sf/setjmp.sub 2014-03-17 16:49:44.000000000 +0100
  7758. @@ -0,0 +1 @@
  7759. +setjmp.s
  7760. diff -Nur musl-0.9.15/src/setjmp/sh/longjmp.s musl-git/src/setjmp/sh/longjmp.s
  7761. --- musl-0.9.15/src/setjmp/sh/longjmp.s 1970-01-01 01:00:00.000000000 +0100
  7762. +++ musl-git/src/setjmp/sh/longjmp.s 2014-03-17 16:49:44.000000000 +0100
  7763. @@ -0,0 +1,26 @@
  7764. +.global _longjmp
  7765. +.global longjmp
  7766. +.type _longjmp, @function
  7767. +.type longjmp, @function
  7768. +_longjmp:
  7769. +longjmp:
  7770. + mov.l @r4+, r8
  7771. + mov.l @r4+, r9
  7772. + mov.l @r4+, r10
  7773. + mov.l @r4+, r11
  7774. + mov.l @r4+, r12
  7775. + mov.l @r4+, r13
  7776. + mov.l @r4+, r14
  7777. + mov.l @r4+, r15
  7778. + lds.l @r4+, pr
  7779. + fmov.s @r4+, fr12
  7780. + fmov.s @r4+, fr13
  7781. + fmov.s @r4+, fr14
  7782. + fmov.s @r4+, fr15
  7783. +
  7784. + tst r5, r5
  7785. + movt r0
  7786. + add r5, r0
  7787. +
  7788. + rts
  7789. + nop
  7790. diff -Nur musl-0.9.15/src/setjmp/sh/setjmp.s musl-git/src/setjmp/sh/setjmp.s
  7791. --- musl-0.9.15/src/setjmp/sh/setjmp.s 1970-01-01 01:00:00.000000000 +0100
  7792. +++ musl-git/src/setjmp/sh/setjmp.s 2014-03-17 16:49:44.000000000 +0100
  7793. @@ -0,0 +1,25 @@
  7794. +.global __setjmp
  7795. +.global _setjmp
  7796. +.global setjmp
  7797. +.type __setjmp, @function
  7798. +.type _setjmp, @function
  7799. +.type setjmp, @function
  7800. +__setjmp:
  7801. +_setjmp:
  7802. +setjmp:
  7803. + add #52, r4
  7804. + fmov.s fr15, @-r4
  7805. + fmov.s fr14, @-r4
  7806. + fmov.s fr13, @-r4
  7807. + fmov.s fr12, @-r4
  7808. + sts.l pr, @-r4
  7809. + mov.l r15 @-r4
  7810. + mov.l r14, @-r4
  7811. + mov.l r13, @-r4
  7812. + mov.l r12, @-r4
  7813. + mov.l r11, @-r4
  7814. + mov.l r10, @-r4
  7815. + mov.l r9, @-r4
  7816. + mov.l r8, @-r4
  7817. + rts
  7818. + mov #0, r0
  7819. diff -Nur musl-0.9.15/src/setjmp/sheb-nofpu/longjmp.sub musl-git/src/setjmp/sheb-nofpu/longjmp.sub
  7820. --- musl-0.9.15/src/setjmp/sheb-nofpu/longjmp.sub 1970-01-01 01:00:00.000000000 +0100
  7821. +++ musl-git/src/setjmp/sheb-nofpu/longjmp.sub 2014-03-17 16:49:44.000000000 +0100
  7822. @@ -0,0 +1 @@
  7823. +../sh-nofpu/longjmp.s
  7824. diff -Nur musl-0.9.15/src/setjmp/sheb-nofpu/setjmp.sub musl-git/src/setjmp/sheb-nofpu/setjmp.sub
  7825. --- musl-0.9.15/src/setjmp/sheb-nofpu/setjmp.sub 1970-01-01 01:00:00.000000000 +0100
  7826. +++ musl-git/src/setjmp/sheb-nofpu/setjmp.sub 2014-03-17 16:49:44.000000000 +0100
  7827. @@ -0,0 +1 @@
  7828. +../sh-nofpu/setjmp.s
  7829. diff -Nur musl-0.9.15/src/setjmp/sh-nofpu/longjmp.s musl-git/src/setjmp/sh-nofpu/longjmp.s
  7830. --- musl-0.9.15/src/setjmp/sh-nofpu/longjmp.s 1970-01-01 01:00:00.000000000 +0100
  7831. +++ musl-git/src/setjmp/sh-nofpu/longjmp.s 2014-03-17 16:49:44.000000000 +0100
  7832. @@ -0,0 +1,22 @@
  7833. +.global _longjmp
  7834. +.global longjmp
  7835. +.type _longjmp, @function
  7836. +.type longjmp, @function
  7837. +_longjmp:
  7838. +longjmp:
  7839. + mov.l @r4+, r8
  7840. + mov.l @r4+, r9
  7841. + mov.l @r4+, r10
  7842. + mov.l @r4+, r11
  7843. + mov.l @r4+, r12
  7844. + mov.l @r4+, r13
  7845. + mov.l @r4+, r14
  7846. + mov.l @r4+, r15
  7847. + lds.l @r4+, pr
  7848. +
  7849. + tst r5, r5
  7850. + movt r0
  7851. + add r5, r0
  7852. +
  7853. + rts
  7854. + nop
  7855. diff -Nur musl-0.9.15/src/setjmp/sh-nofpu/longjmp.sub musl-git/src/setjmp/sh-nofpu/longjmp.sub
  7856. --- musl-0.9.15/src/setjmp/sh-nofpu/longjmp.sub 1970-01-01 01:00:00.000000000 +0100
  7857. +++ musl-git/src/setjmp/sh-nofpu/longjmp.sub 2014-03-17 16:49:44.000000000 +0100
  7858. @@ -0,0 +1 @@
  7859. +longjmp.s
  7860. diff -Nur musl-0.9.15/src/setjmp/sh-nofpu/setjmp.s musl-git/src/setjmp/sh-nofpu/setjmp.s
  7861. --- musl-0.9.15/src/setjmp/sh-nofpu/setjmp.s 1970-01-01 01:00:00.000000000 +0100
  7862. +++ musl-git/src/setjmp/sh-nofpu/setjmp.s 2014-03-17 16:49:44.000000000 +0100
  7863. @@ -0,0 +1,21 @@
  7864. +.global __setjmp
  7865. +.global _setjmp
  7866. +.global setjmp
  7867. +.type __setjmp, @function
  7868. +.type _setjmp, @function
  7869. +.type setjmp, @function
  7870. +__setjmp:
  7871. +_setjmp:
  7872. +setjmp:
  7873. + add #36, r4
  7874. + sts.l pr, @-r4
  7875. + mov.l r15 @-r4
  7876. + mov.l r14, @-r4
  7877. + mov.l r13, @-r4
  7878. + mov.l r12, @-r4
  7879. + mov.l r11, @-r4
  7880. + mov.l r10, @-r4
  7881. + mov.l r9, @-r4
  7882. + mov.l r8, @-r4
  7883. + rts
  7884. + mov #0, r0
  7885. diff -Nur musl-0.9.15/src/setjmp/sh-nofpu/setjmp.sub musl-git/src/setjmp/sh-nofpu/setjmp.sub
  7886. --- musl-0.9.15/src/setjmp/sh-nofpu/setjmp.sub 1970-01-01 01:00:00.000000000 +0100
  7887. +++ musl-git/src/setjmp/sh-nofpu/setjmp.sub 2014-03-17 16:49:44.000000000 +0100
  7888. @@ -0,0 +1 @@
  7889. +setjmp.s
  7890. diff -Nur musl-0.9.15/src/setjmp/x32/longjmp.s musl-git/src/setjmp/x32/longjmp.s
  7891. --- musl-0.9.15/src/setjmp/x32/longjmp.s 1970-01-01 01:00:00.000000000 +0100
  7892. +++ musl-git/src/setjmp/x32/longjmp.s 2014-03-17 16:49:44.000000000 +0100
  7893. @@ -0,0 +1,22 @@
  7894. +/* Copyright 2011-2012 Nicholas J. Kain, licensed under standard MIT license */
  7895. +.global _longjmp
  7896. +.global longjmp
  7897. +.type _longjmp,@function
  7898. +.type longjmp,@function
  7899. +_longjmp:
  7900. +longjmp:
  7901. + mov %rsi,%rax /* val will be longjmp return */
  7902. + test %rax,%rax
  7903. + jnz 1f
  7904. + inc %rax /* if val==0, val=1 per longjmp semantics */
  7905. +1:
  7906. + mov (%rdi),%rbx /* rdi is the jmp_buf, restore regs from it */
  7907. + mov 8(%rdi),%rbp
  7908. + mov 16(%rdi),%r12
  7909. + mov 24(%rdi),%r13
  7910. + mov 32(%rdi),%r14
  7911. + mov 40(%rdi),%r15
  7912. + mov 48(%rdi),%rdx /* this ends up being the stack pointer */
  7913. + mov %rdx,%rsp
  7914. + mov 56(%rdi),%rdx /* this is the instruction pointer */
  7915. + jmp *%rdx /* goto saved address without altering rsp */
  7916. diff -Nur musl-0.9.15/src/setjmp/x32/setjmp.s musl-git/src/setjmp/x32/setjmp.s
  7917. --- musl-0.9.15/src/setjmp/x32/setjmp.s 1970-01-01 01:00:00.000000000 +0100
  7918. +++ musl-git/src/setjmp/x32/setjmp.s 2014-03-17 16:49:44.000000000 +0100
  7919. @@ -0,0 +1,22 @@
  7920. +/* Copyright 2011-2012 Nicholas J. Kain, licensed under standard MIT license */
  7921. +.global __setjmp
  7922. +.global _setjmp
  7923. +.global setjmp
  7924. +.type __setjmp,@function
  7925. +.type _setjmp,@function
  7926. +.type setjmp,@function
  7927. +__setjmp:
  7928. +_setjmp:
  7929. +setjmp:
  7930. + mov %rbx,(%rdi) /* rdi is jmp_buf, move registers onto it */
  7931. + mov %rbp,8(%rdi)
  7932. + mov %r12,16(%rdi)
  7933. + mov %r13,24(%rdi)
  7934. + mov %r14,32(%rdi)
  7935. + mov %r15,40(%rdi)
  7936. + lea 8(%rsp),%rdx /* this is our rsp WITHOUT current ret addr */
  7937. + mov %rdx,48(%rdi)
  7938. + mov (%rsp),%rdx /* save return addr ptr for new rip */
  7939. + mov %rdx,56(%rdi)
  7940. + xor %rax,%rax /* always return 0 */
  7941. + ret
  7942. diff -Nur musl-0.9.15/src/signal/sh/restore.s musl-git/src/signal/sh/restore.s
  7943. --- musl-0.9.15/src/signal/sh/restore.s 1970-01-01 01:00:00.000000000 +0100
  7944. +++ musl-git/src/signal/sh/restore.s 2014-03-17 16:49:44.000000000 +0100
  7945. @@ -0,0 +1,24 @@
  7946. +.global __restore
  7947. +.type __restore, @function
  7948. +__restore:
  7949. + mov #119, r3 !__NR_sigreturn
  7950. + trapa #16
  7951. +
  7952. + or r0, r0
  7953. + or r0, r0
  7954. + or r0, r0
  7955. + or r0, r0
  7956. + or r0, r0
  7957. +
  7958. +.global __restore_rt
  7959. +.type __restore_rt, @function
  7960. +__restore_rt:
  7961. + mov #100, r3 !__NR_rt_sigreturn
  7962. + add #73, r3
  7963. + trapa #16
  7964. +
  7965. + or r0, r0
  7966. + or r0, r0
  7967. + or r0, r0
  7968. + or r0, r0
  7969. + or r0, r0
  7970. diff -Nur musl-0.9.15/src/signal/sh/sigsetjmp.s musl-git/src/signal/sh/sigsetjmp.s
  7971. --- musl-0.9.15/src/signal/sh/sigsetjmp.s 1970-01-01 01:00:00.000000000 +0100
  7972. +++ musl-git/src/signal/sh/sigsetjmp.s 2014-03-17 16:49:44.000000000 +0100
  7973. @@ -0,0 +1,27 @@
  7974. +.global sigsetjmp
  7975. +.type sigsetjmp, @function
  7976. +sigsetjmp:
  7977. + mov.l r5, @(36,r4)
  7978. + tst r5, r5
  7979. + bf 2f
  7980. +
  7981. + sts.l pr, @-r15
  7982. + mov.l r4, @-r15
  7983. + mov r4, r6
  7984. + add #40, r6
  7985. + mov #0, r5
  7986. + mov #2, r4
  7987. + mov.l L1, r0
  7988. + bsrf r0
  7989. + nop
  7990. +1: mov.l @r15+, r4
  7991. + lds.l @r15+, pr
  7992. +
  7993. +2: mov.l L2, r0
  7994. + braf r0
  7995. + nop
  7996. +3:
  7997. +
  7998. +.align 2
  7999. +L1: .long pthread_sigmask@PLT-(1b-.)
  8000. +L2: .long setjmp@PLT-(3b-.)
  8001. diff -Nur musl-0.9.15/src/signal/sigandset.c musl-git/src/signal/sigandset.c
  8002. --- musl-0.9.15/src/signal/sigandset.c 2014-01-03 21:12:18.000000000 +0100
  8003. +++ musl-git/src/signal/sigandset.c 2014-03-17 16:49:44.000000000 +0100
  8004. @@ -3,7 +3,7 @@
  8005. #define SST_SIZE (_NSIG/8/sizeof(long))
  8006. -int sigandset(sigset_t *dest, sigset_t *left, sigset_t *right)
  8007. +int sigandset(sigset_t *dest, const sigset_t *left, const sigset_t *right)
  8008. {
  8009. unsigned long i = 0, *d = (void*) dest, *l = (void*) left, *r = (void*) right;
  8010. for(; i < SST_SIZE; i++) d[i] = l[i] & r[i];
  8011. diff -Nur musl-0.9.15/src/signal/sigorset.c musl-git/src/signal/sigorset.c
  8012. --- musl-0.9.15/src/signal/sigorset.c 2014-01-03 21:12:18.000000000 +0100
  8013. +++ musl-git/src/signal/sigorset.c 2014-03-17 16:49:44.000000000 +0100
  8014. @@ -3,7 +3,7 @@
  8015. #define SST_SIZE (_NSIG/8/sizeof(long))
  8016. -int sigorset(sigset_t *dest, sigset_t *left, sigset_t *right)
  8017. +int sigorset(sigset_t *dest, const sigset_t *left, const sigset_t *right)
  8018. {
  8019. unsigned long i = 0, *d = (void*) dest, *l = (void*) left, *r = (void*) right;
  8020. for(; i < SST_SIZE; i++) d[i] = l[i] | r[i];
  8021. diff -Nur musl-0.9.15/src/signal/x32/restore.s musl-git/src/signal/x32/restore.s
  8022. --- musl-0.9.15/src/signal/x32/restore.s 1970-01-01 01:00:00.000000000 +0100
  8023. +++ musl-git/src/signal/x32/restore.s 2014-03-17 16:49:44.000000000 +0100
  8024. @@ -0,0 +1,8 @@
  8025. +.global __restore_rt
  8026. +.global __restore
  8027. +.type __restore_rt,@function
  8028. +.type __restore,@function
  8029. +__restore_rt:
  8030. +__restore:
  8031. + movl $0x40000201, %eax /* SYS_rt_sigreturn */
  8032. + syscall
  8033. diff -Nur musl-0.9.15/src/signal/x32/sigsetjmp.s musl-git/src/signal/x32/sigsetjmp.s
  8034. --- musl-0.9.15/src/signal/x32/sigsetjmp.s 1970-01-01 01:00:00.000000000 +0100
  8035. +++ musl-git/src/signal/x32/sigsetjmp.s 2014-03-17 16:49:44.000000000 +0100
  8036. @@ -0,0 +1,14 @@
  8037. +/* Copyright 2011-2012 Nicholas J. Kain, licensed under standard MIT license */
  8038. +.global sigsetjmp
  8039. +.type sigsetjmp,@function
  8040. +sigsetjmp:
  8041. + andl %esi,%esi
  8042. + movq %rsi,64(%rdi)
  8043. + jz 1f
  8044. + pushq %rdi
  8045. + leaq 72(%rdi),%rdx
  8046. + xorl %esi,%esi
  8047. + movl $2,%edi
  8048. + call sigprocmask
  8049. + popq %rdi
  8050. +1: jmp setjmp
  8051. diff -Nur musl-0.9.15/src/stdio/__fdopen.c musl-git/src/stdio/__fdopen.c
  8052. --- musl-0.9.15/src/stdio/__fdopen.c 2014-01-03 21:12:18.000000000 +0100
  8053. +++ musl-git/src/stdio/__fdopen.c 2014-03-17 16:49:44.000000000 +0100
  8054. @@ -32,7 +32,9 @@
  8055. /* Set append mode on fd if opened for append */
  8056. if (*mode == 'a') {
  8057. int flags = __syscall(SYS_fcntl, fd, F_GETFL);
  8058. - __syscall(SYS_fcntl, fd, F_SETFL, flags | O_APPEND);
  8059. + if (!(flags & O_APPEND))
  8060. + __syscall(SYS_fcntl, fd, F_SETFL, flags | O_APPEND);
  8061. + f->flags |= F_APP;
  8062. }
  8063. f->fd = fd;
  8064. diff -Nur musl-0.9.15/src/stdio/ftell.c musl-git/src/stdio/ftell.c
  8065. --- musl-0.9.15/src/stdio/ftell.c 2014-01-03 21:12:18.000000000 +0100
  8066. +++ musl-git/src/stdio/ftell.c 2014-03-17 16:49:44.000000000 +0100
  8067. @@ -4,7 +4,9 @@
  8068. off_t __ftello_unlocked(FILE *f)
  8069. {
  8070. - off_t pos = f->seek(f, 0, SEEK_CUR);
  8071. + off_t pos = f->seek(f, 0,
  8072. + (f->flags & F_APP) && f->wpos > f->wbase
  8073. + ? SEEK_END : SEEK_CUR);
  8074. if (pos < 0) return pos;
  8075. /* Adjust for data in buffer. */
  8076. diff -Nur musl-0.9.15/src/stdio/vfprintf.c musl-git/src/stdio/vfprintf.c
  8077. --- musl-0.9.15/src/stdio/vfprintf.c 2014-01-03 21:12:18.000000000 +0100
  8078. +++ musl-git/src/stdio/vfprintf.c 2014-03-17 16:49:44.000000000 +0100
  8079. @@ -207,7 +207,8 @@
  8080. static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t)
  8081. {
  8082. - uint32_t big[(LDBL_MAX_EXP+LDBL_MANT_DIG)/9+1];
  8083. + uint32_t big[(LDBL_MANT_DIG+28)/29 + 1 // mantissa expansion
  8084. + + (LDBL_MAX_EXP+LDBL_MANT_DIG+28+8)/9]; // exponent expansion
  8085. uint32_t *a, *d, *r, *z;
  8086. int e2=0, e, i, j, l;
  8087. char buf[9+LDBL_MANT_DIG/4], *s;
  8088. @@ -313,7 +314,7 @@
  8089. }
  8090. while (e2<0) {
  8091. uint32_t carry=0, *b;
  8092. - int sh=MIN(9,-e2);
  8093. + int sh=MIN(9,-e2), need=1+(p+LDBL_MANT_DIG/3+8)/9;
  8094. for (d=a; d<z; d++) {
  8095. uint32_t rm = *d & (1<<sh)-1;
  8096. *d = (*d>>sh) + carry;
  8097. @@ -323,7 +324,7 @@
  8098. if (carry) *z++ = carry;
  8099. /* Avoid (slow!) computation past requested precision */
  8100. b = (t|32)=='f' ? r : a;
  8101. - if (z-b > 2+p/9) z = b+2+p/9;
  8102. + if (z-b > need) z = b+need;
  8103. e2+=sh;
  8104. }
  8105. diff -Nur musl-0.9.15/src/stdio/vfscanf.c musl-git/src/stdio/vfscanf.c
  8106. --- musl-0.9.15/src/stdio/vfscanf.c 2014-01-03 21:12:18.000000000 +0100
  8107. +++ musl-git/src/stdio/vfscanf.c 2014-03-17 16:49:44.000000000 +0100
  8108. @@ -328,3 +328,5 @@
  8109. FUNLOCK(f);
  8110. return matches;
  8111. }
  8112. +
  8113. +weak_alias(vfscanf,__isoc99_vfscanf);
  8114. diff -Nur musl-0.9.15/src/thread/arm/clone.s musl-git/src/thread/arm/clone.s
  8115. --- musl-0.9.15/src/thread/arm/clone.s 2014-01-03 21:12:18.000000000 +0100
  8116. +++ musl-git/src/thread/arm/clone.s 2014-03-17 16:49:44.000000000 +0100
  8117. @@ -1,10 +1,7 @@
  8118. .text
  8119. .global __clone
  8120. -.weak clone
  8121. .type __clone,%function
  8122. -.type clone,%function
  8123. __clone:
  8124. -clone:
  8125. stmfd sp!,{r4,r5,r6,r7}
  8126. mov r7,#120
  8127. mov r6,r3
  8128. diff -Nur musl-0.9.15/src/thread/cancel_dummy.c musl-git/src/thread/cancel_dummy.c
  8129. --- musl-0.9.15/src/thread/cancel_dummy.c 2014-01-03 21:12:18.000000000 +0100
  8130. +++ musl-git/src/thread/cancel_dummy.c 2014-03-17 16:49:44.000000000 +0100
  8131. @@ -1,6 +1,9 @@
  8132. #include "pthread_impl.h"
  8133. +#include "syscall.h"
  8134. -static long sccp(long nr, long u, long v, long w, long x, long y, long z)
  8135. +static long sccp(syscall_arg_t nr,
  8136. + syscall_arg_t u, syscall_arg_t v, syscall_arg_t w,
  8137. + syscall_arg_t x, syscall_arg_t y, syscall_arg_t z)
  8138. {
  8139. return (__syscall)(nr, u, v, w, x, y, z);
  8140. }
  8141. diff -Nur musl-0.9.15/src/thread/cancel_impl.c musl-git/src/thread/cancel_impl.c
  8142. --- musl-0.9.15/src/thread/cancel_impl.c 2014-01-03 21:12:18.000000000 +0100
  8143. +++ musl-git/src/thread/cancel_impl.c 2014-03-17 16:49:44.000000000 +0100
  8144. @@ -1,4 +1,5 @@
  8145. #include "pthread_impl.h"
  8146. +#include "syscall.h"
  8147. void __cancel()
  8148. {
  8149. @@ -8,9 +9,13 @@
  8150. pthread_exit(PTHREAD_CANCELED);
  8151. }
  8152. -long __syscall_cp_asm(volatile void *, long, long, long, long, long, long, long);
  8153. +long __syscall_cp_asm(volatile void *, syscall_arg_t,
  8154. + syscall_arg_t, syscall_arg_t, syscall_arg_t,
  8155. + syscall_arg_t, syscall_arg_t, syscall_arg_t);
  8156. -long (__syscall_cp)(long nr, long u, long v, long w, long x, long y, long z)
  8157. +long (__syscall_cp)(syscall_arg_t nr,
  8158. + syscall_arg_t u, syscall_arg_t v, syscall_arg_t w,
  8159. + syscall_arg_t x, syscall_arg_t y, syscall_arg_t z)
  8160. {
  8161. pthread_t self;
  8162. long r;
  8163. diff -Nur musl-0.9.15/src/thread/clone.c musl-git/src/thread/clone.c
  8164. --- musl-0.9.15/src/thread/clone.c 2014-01-03 21:12:18.000000000 +0100
  8165. +++ musl-git/src/thread/clone.c 2014-03-17 16:49:44.000000000 +0100
  8166. @@ -1,10 +1,7 @@
  8167. #include <errno.h>
  8168. -#include "libc.h"
  8169. +#include "pthread_impl.h"
  8170. int __clone(int (*func)(void *), void *stack, int flags, void *arg, ...)
  8171. {
  8172. - errno = ENOSYS;
  8173. - return -1;
  8174. + return -ENOSYS;
  8175. }
  8176. -
  8177. -weak_alias(__clone, clone);
  8178. diff -Nur musl-0.9.15/src/thread/i386/clone.s musl-git/src/thread/i386/clone.s
  8179. --- musl-0.9.15/src/thread/i386/clone.s 2014-01-03 21:12:18.000000000 +0100
  8180. +++ musl-git/src/thread/i386/clone.s 2014-03-17 16:49:44.000000000 +0100
  8181. @@ -1,10 +1,7 @@
  8182. .text
  8183. .global __clone
  8184. -.weak clone
  8185. .type __clone,@function
  8186. -.type clone,@function
  8187. __clone:
  8188. -clone:
  8189. push %ebp
  8190. mov %esp,%ebp
  8191. push %ebx
  8192. diff -Nur musl-0.9.15/src/thread/microblaze/clone.s musl-git/src/thread/microblaze/clone.s
  8193. --- musl-0.9.15/src/thread/microblaze/clone.s 2014-01-03 21:12:18.000000000 +0100
  8194. +++ musl-git/src/thread/microblaze/clone.s 2014-03-17 16:49:44.000000000 +0100
  8195. @@ -1,14 +1,11 @@
  8196. .global __clone
  8197. -.weak clone
  8198. .type __clone,@function
  8199. -.type clone,@function
  8200. # r5, r6, r7, r8, r9, r10, stack
  8201. # fn, st, fl, ar, pt, tl, ct
  8202. # fl, st, __, pt, ct, tl
  8203. __clone:
  8204. -clone:
  8205. andi r6, r6, -16
  8206. addi r6, r6, -16
  8207. swi r5, r6, 0
  8208. @@ -23,7 +20,7 @@
  8209. beqi r3, 1f
  8210. rtsd r15, 8
  8211. nop
  8212. -
  8213. +
  8214. 1: lwi r3, r1, 0
  8215. lwi r5, r1, 4
  8216. brald r15, r3
  8217. diff -Nur musl-0.9.15/src/thread/sh/clone.s musl-git/src/thread/sh/clone.s
  8218. --- musl-0.9.15/src/thread/sh/clone.s 1970-01-01 01:00:00.000000000 +0100
  8219. +++ musl-git/src/thread/sh/clone.s 2014-03-17 16:49:44.000000000 +0100
  8220. @@ -0,0 +1,47 @@
  8221. +.text
  8222. +.global __clone
  8223. +.type __clone, @function
  8224. +__clone:
  8225. +! incoming: fn stack flags arg ptid tls ctid
  8226. +! r4 r5 r6 r7 @r15 @(4,r15) @(8,r15)
  8227. +
  8228. + mov #-16, r0
  8229. + and r0, r5
  8230. +
  8231. + mov r4, r1 ! r1 = fn
  8232. + mov r7, r2 ! r2 = arg
  8233. +
  8234. + mov #120, r3 ! r3 = __NR_clone
  8235. + mov r6, r4 ! r4 = flags
  8236. + !mov r5, r5 ! r5 = stack
  8237. + mov.l @r15, r6 ! r6 = ptid
  8238. + mov.l @(8,r15), r7 ! r7 = ctid
  8239. + mov.l @(4,r15), r0 ! r0 = tls
  8240. + trapa #21
  8241. +
  8242. + or r0, r0
  8243. + or r0, r0
  8244. + or r0, r0
  8245. + or r0, r0
  8246. + or r0, r0
  8247. +
  8248. + cmp/eq #0, r0
  8249. + bt 1f
  8250. +
  8251. + ! we are the parent, return
  8252. + rts
  8253. + nop
  8254. +
  8255. +1: ! we are the child, call fn(arg)
  8256. + jsr @r1
  8257. + mov r2, r4
  8258. +
  8259. + mov #1, r3 ! __NR_exit
  8260. + mov r0, r4
  8261. + trapa #17
  8262. +
  8263. + or r0, r0
  8264. + or r0, r0
  8265. + or r0, r0
  8266. + or r0, r0
  8267. + or r0, r0
  8268. diff -Nur musl-0.9.15/src/thread/sh/__set_thread_area.s musl-git/src/thread/sh/__set_thread_area.s
  8269. --- musl-0.9.15/src/thread/sh/__set_thread_area.s 1970-01-01 01:00:00.000000000 +0100
  8270. +++ musl-git/src/thread/sh/__set_thread_area.s 2014-03-17 16:49:44.000000000 +0100
  8271. @@ -0,0 +1,5 @@
  8272. +.global __set_thread_area
  8273. +.type __set_thread_area, @function
  8274. +__set_thread_area:
  8275. + rts
  8276. + ldc r4, gbr
  8277. diff -Nur musl-0.9.15/src/thread/sh/syscall_cp.s musl-git/src/thread/sh/syscall_cp.s
  8278. --- musl-0.9.15/src/thread/sh/syscall_cp.s 1970-01-01 01:00:00.000000000 +0100
  8279. +++ musl-git/src/thread/sh/syscall_cp.s 2014-03-17 16:49:44.000000000 +0100
  8280. @@ -0,0 +1,39 @@
  8281. +.text
  8282. +.global __syscall_cp_asm
  8283. +.type __syscall_cp_asm, @function
  8284. +__syscall_cp_asm:
  8285. +
  8286. +.global __cp_begin
  8287. +__cp_begin:
  8288. + mov.l @r4, r4
  8289. + tst r4, r4
  8290. + bt 2f
  8291. +
  8292. + mov.l L1, r0
  8293. + braf r0
  8294. + nop
  8295. +1:
  8296. +
  8297. +.align 2
  8298. +L1: .long __cancel@PLT-(1b-.)
  8299. +
  8300. +2: mov r5, r3
  8301. + mov r6, r4
  8302. + mov r7, r5
  8303. + mov.l @r15, r6
  8304. + mov.l @(4,r15), r7
  8305. + mov.l @(8,r15), r0
  8306. + mov.l @(12,r15), r1
  8307. + trapa #22
  8308. +
  8309. +.global __cp_end
  8310. +__cp_end:
  8311. + ! work around hardware bug
  8312. + or r0, r0
  8313. + or r0, r0
  8314. + or r0, r0
  8315. + or r0, r0
  8316. + or r0, r0
  8317. +
  8318. + rts
  8319. + nop
  8320. diff -Nur musl-0.9.15/src/thread/sh/__unmapself.s musl-git/src/thread/sh/__unmapself.s
  8321. --- musl-0.9.15/src/thread/sh/__unmapself.s 1970-01-01 01:00:00.000000000 +0100
  8322. +++ musl-git/src/thread/sh/__unmapself.s 2014-03-17 16:49:44.000000000 +0100
  8323. @@ -0,0 +1,22 @@
  8324. +.text
  8325. +.global __unmapself
  8326. +.type __unmapself, @function
  8327. +__unmapself:
  8328. + mov #91, r3 ! SYS_munmap
  8329. + trapa #18
  8330. +
  8331. + or r0, r0
  8332. + or r0, r0
  8333. + or r0, r0
  8334. + or r0, r0
  8335. + or r0, r0
  8336. +
  8337. + mov #1, r3 ! SYS_exit
  8338. + mov #0, r4
  8339. + trapa #17
  8340. +
  8341. + or r0, r0
  8342. + or r0, r0
  8343. + or r0, r0
  8344. + or r0, r0
  8345. + or r0, r0
  8346. diff -Nur musl-0.9.15/src/thread/__wait.c musl-git/src/thread/__wait.c
  8347. --- musl-0.9.15/src/thread/__wait.c 2014-01-03 21:12:18.000000000 +0100
  8348. +++ musl-git/src/thread/__wait.c 2014-03-17 16:49:44.000000000 +0100
  8349. @@ -10,6 +10,6 @@
  8350. }
  8351. if (waiters) a_inc(waiters);
  8352. while (*addr==val)
  8353. - __syscall(SYS_futex, (long)addr, FUTEX_WAIT|priv, val, 0);
  8354. + __syscall(SYS_futex, addr, FUTEX_WAIT|priv, val, 0);
  8355. if (waiters) a_dec(waiters);
  8356. }
  8357. diff -Nur musl-0.9.15/src/thread/x32/clone.s musl-git/src/thread/x32/clone.s
  8358. --- musl-0.9.15/src/thread/x32/clone.s 1970-01-01 01:00:00.000000000 +0100
  8359. +++ musl-git/src/thread/x32/clone.s 2014-03-17 16:49:44.000000000 +0100
  8360. @@ -0,0 +1,25 @@
  8361. +.text
  8362. +.global __clone
  8363. +.type __clone,@function
  8364. +__clone:
  8365. + movl $0x40000038,%eax /* SYS_clone */
  8366. + mov %rdi,%r11
  8367. + mov %rdx,%rdi
  8368. + mov %r8,%rdx
  8369. + mov %r9,%r8
  8370. + mov 8(%rsp),%r10
  8371. + mov %r11,%r9
  8372. + and $-16,%rsi
  8373. + sub $8,%rsi
  8374. + mov %rcx,(%rsi)
  8375. + syscall
  8376. + test %eax,%eax
  8377. + jnz 1f
  8378. + xor %ebp,%ebp
  8379. + pop %rdi
  8380. + call *%r9
  8381. + mov %eax,%edi
  8382. + movl $0x4000003c,%eax /* SYS_exit */
  8383. + syscall
  8384. + hlt
  8385. +1: ret
  8386. diff -Nur musl-0.9.15/src/thread/x32/__set_thread_area.s musl-git/src/thread/x32/__set_thread_area.s
  8387. --- musl-0.9.15/src/thread/x32/__set_thread_area.s 1970-01-01 01:00:00.000000000 +0100
  8388. +++ musl-git/src/thread/x32/__set_thread_area.s 2014-03-17 16:49:44.000000000 +0100
  8389. @@ -0,0 +1,10 @@
  8390. +/* Copyright 2011-2012 Nicholas J. Kain, licensed under standard MIT license */
  8391. +.text
  8392. +.global __set_thread_area
  8393. +.type __set_thread_area,@function
  8394. +__set_thread_area:
  8395. + mov %rdi,%rsi /* shift for syscall */
  8396. + movl $0x1002,%edi /* SET_FS register */
  8397. + movl $0x4000009e,%eax /* set fs segment to */
  8398. + syscall /* arch_prctl(SET_FS, arg)*/
  8399. + ret
  8400. diff -Nur musl-0.9.15/src/thread/x32/syscall_cp.s musl-git/src/thread/x32/syscall_cp.s
  8401. --- musl-0.9.15/src/thread/x32/syscall_cp.s 1970-01-01 01:00:00.000000000 +0100
  8402. +++ musl-git/src/thread/x32/syscall_cp.s 2014-03-17 16:49:44.000000000 +0100
  8403. @@ -0,0 +1,23 @@
  8404. +.text
  8405. +.global __syscall_cp_internal
  8406. +.type __syscall_cp_internal,@function
  8407. +__syscall_cp_internal:
  8408. +
  8409. +.global __cp_begin
  8410. +__cp_begin:
  8411. + mov (%rdi),%eax
  8412. + test %eax,%eax
  8413. + jnz __cancel
  8414. + mov %rdi,%r11
  8415. + mov %rsi,%rax
  8416. + mov %rdx,%rdi
  8417. + mov %rcx,%rsi
  8418. + mov %r8,%rdx
  8419. + mov %r9,%r10
  8420. + mov 8(%rsp),%r8
  8421. + mov 16(%rsp),%r9
  8422. + mov %r11,8(%rsp)
  8423. + syscall
  8424. +.global __cp_end
  8425. +__cp_end:
  8426. + ret
  8427. diff -Nur musl-0.9.15/src/thread/x32/__unmapself.s musl-git/src/thread/x32/__unmapself.s
  8428. --- musl-0.9.15/src/thread/x32/__unmapself.s 1970-01-01 01:00:00.000000000 +0100
  8429. +++ musl-git/src/thread/x32/__unmapself.s 2014-03-17 16:49:44.000000000 +0100
  8430. @@ -0,0 +1,10 @@
  8431. +/* Copyright 2011-2012 Nicholas J. Kain, licensed under standard MIT license */
  8432. +.text
  8433. +.global __unmapself
  8434. +.type __unmapself,@function
  8435. +__unmapself:
  8436. + movl $0x4000000b,%eax /* SYS_munmap */
  8437. + syscall /* munmap(arg2,arg3) */
  8438. + xor %rdi,%rdi /* exit() args: always return success */
  8439. + movl $0x4000003c,%eax /* SYS_exit */
  8440. + syscall /* exit(0) */
  8441. diff -Nur musl-0.9.15/src/thread/x86_64/clone.s musl-git/src/thread/x86_64/clone.s
  8442. --- musl-0.9.15/src/thread/x86_64/clone.s 2014-01-03 21:12:18.000000000 +0100
  8443. +++ musl-git/src/thread/x86_64/clone.s 2014-03-17 16:49:44.000000000 +0100
  8444. @@ -1,10 +1,7 @@
  8445. .text
  8446. .global __clone
  8447. -.weak clone
  8448. .type __clone,@function
  8449. -.type clone,@function
  8450. __clone:
  8451. -clone:
  8452. xor %eax,%eax
  8453. mov $56,%al
  8454. mov %rdi,%r11
  8455. diff -Nur musl-0.9.15/src/time/timer_delete.c musl-git/src/time/timer_delete.c
  8456. --- musl-0.9.15/src/time/timer_delete.c 2014-01-03 21:12:18.000000000 +0100
  8457. +++ musl-git/src/time/timer_delete.c 2014-03-17 16:49:44.000000000 +0100
  8458. @@ -10,5 +10,5 @@
  8459. __wake(&td->timer_id, 1, 1);
  8460. return 0;
  8461. }
  8462. - return __syscall(SYS_timer_delete, (long)t);
  8463. + return __syscall(SYS_timer_delete, t);
  8464. }
  8465. diff -Nur musl-0.9.15/src/time/timer_getoverrun.c musl-git/src/time/timer_getoverrun.c
  8466. --- musl-0.9.15/src/time/timer_getoverrun.c 2014-01-03 21:12:18.000000000 +0100
  8467. +++ musl-git/src/time/timer_getoverrun.c 2014-03-17 16:49:44.000000000 +0100
  8468. @@ -8,5 +8,5 @@
  8469. pthread_t td = (void *)((uintptr_t)t << 1);
  8470. t = (void *)(uintptr_t)(td->timer_id & INT_MAX);
  8471. }
  8472. - return syscall(SYS_timer_getoverrun, (long)t);
  8473. + return syscall(SYS_timer_getoverrun, t);
  8474. }
  8475. diff -Nur musl-0.9.15/src/time/timer_gettime.c musl-git/src/time/timer_gettime.c
  8476. --- musl-0.9.15/src/time/timer_gettime.c 2014-01-03 21:12:18.000000000 +0100
  8477. +++ musl-git/src/time/timer_gettime.c 2014-03-17 16:49:44.000000000 +0100
  8478. @@ -8,5 +8,5 @@
  8479. pthread_t td = (void *)((uintptr_t)t << 1);
  8480. t = (void *)(uintptr_t)(td->timer_id & INT_MAX);
  8481. }
  8482. - return syscall(SYS_timer_gettime, (long)t, val);
  8483. + return syscall(SYS_timer_gettime, t, val);
  8484. }
  8485. diff -Nur musl-0.9.15/src/time/timer_settime.c musl-git/src/time/timer_settime.c
  8486. --- musl-0.9.15/src/time/timer_settime.c 2014-01-03 21:12:18.000000000 +0100
  8487. +++ musl-git/src/time/timer_settime.c 2014-03-17 16:49:44.000000000 +0100
  8488. @@ -8,5 +8,5 @@
  8489. pthread_t td = (void *)((uintptr_t)t << 1);
  8490. t = (void *)(uintptr_t)(td->timer_id & INT_MAX);
  8491. }
  8492. - return syscall(SYS_timer_settime, (long)t, flags, val, old);
  8493. + return syscall(SYS_timer_settime, t, flags, val, old);
  8494. }
  8495. diff -Nur musl-0.9.15/src/unistd/sh/pipe.s musl-git/src/unistd/sh/pipe.s
  8496. --- musl-0.9.15/src/unistd/sh/pipe.s 1970-01-01 01:00:00.000000000 +0100
  8497. +++ musl-git/src/unistd/sh/pipe.s 2014-03-17 16:49:44.000000000 +0100
  8498. @@ -0,0 +1,27 @@
  8499. +.global pipe
  8500. +.type pipe, @function
  8501. +pipe:
  8502. + mov #42, r3
  8503. + trapa #17
  8504. +
  8505. + ! work around hardware bug
  8506. + or r0, r0
  8507. + or r0, r0
  8508. + or r0, r0
  8509. + or r0, r0
  8510. + or r0, r0
  8511. +
  8512. + cmp/pz r0
  8513. + bt 1f
  8514. +
  8515. + mov.l L1, r1
  8516. + braf r1
  8517. + mov r0, r4
  8518. +
  8519. +1: mov.l r0, @(0,r4)
  8520. + mov.l r1, @(4,r4)
  8521. + rts
  8522. + mov #0, r0
  8523. +
  8524. +.align 2
  8525. +L1: .long __syscall_ret@PLT-(1b-.)
  8526. diff -Nur musl-0.9.15/tools/install.sh musl-git/tools/install.sh
  8527. --- musl-0.9.15/tools/install.sh 2014-01-03 21:12:18.000000000 +0100
  8528. +++ musl-git/tools/install.sh 2014-03-17 16:49:44.000000000 +0100
  8529. @@ -51,6 +51,7 @@
  8530. ln -s "$1" "$tmp"
  8531. else
  8532. cat < "$1" > "$tmp"
  8533. +chmod "$mode" "$tmp"
  8534. fi
  8535. mv -f "$tmp" "$2"
  8536. @@ -60,6 +61,4 @@
  8537. exit 1
  8538. }
  8539. -test "$symlink" || chmod "$mode" "$2"
  8540. -
  8541. exit 0