libc.info-11 290 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282
  1. This is libc.info, produced by makeinfo version 7.3 from libc.texinfo.
  2. This is ‘The GNU C Library Reference Manual’, for version 2.43.
  3. Copyright © 1993-2026 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Free Software Needs Free Documentation" and
  8. "GNU Lesser General Public License", the Front-Cover texts being "A GNU
  9. Manual", and with the Back-Cover Texts as in (a) below. A copy of the
  10. license is included in the section entitled "GNU Free Documentation
  11. License".
  12. (a) The FSF's Back-Cover Text is: "You have the freedom to copy and
  13. modify this GNU manual. Buying copies from the FSF supports it in
  14. developing GNU and promoting software freedom."
  15. INFO-DIR-SECTION Software libraries
  16. START-INFO-DIR-ENTRY
  17. * Libc: (libc). C library.
  18. END-INFO-DIR-ENTRY
  19. INFO-DIR-SECTION GNU C library functions and macros
  20. START-INFO-DIR-ENTRY
  21. * ALTWERASE: (libc)Local Modes.
  22. * ARGP_ERR_UNKNOWN: (libc)Argp Parser Functions.
  23. * ARG_MAX: (libc)General Limits.
  24. * BAUD_MAX: (libc)Line Speed.
  25. * BC_BASE_MAX: (libc)Utility Limits.
  26. * BC_DIM_MAX: (libc)Utility Limits.
  27. * BC_SCALE_MAX: (libc)Utility Limits.
  28. * BC_STRING_MAX: (libc)Utility Limits.
  29. * BRKINT: (libc)Input Modes.
  30. * BUFSIZ: (libc)Controlling Buffering.
  31. * CCTS_OFLOW: (libc)Control Modes.
  32. * CHAR_BIT: (libc)Width of Type.
  33. * CHILD_MAX: (libc)General Limits.
  34. * CIGNORE: (libc)Control Modes.
  35. * CLK_TCK: (libc)Processor Time.
  36. * CLOCAL: (libc)Control Modes.
  37. * CLOCKS_PER_SEC: (libc)CPU Time.
  38. * CLOCK_BOOTTIME: (libc)Getting the Time.
  39. * CLOCK_BOOTTIME_ALARM: (libc)Getting the Time.
  40. * CLOCK_MONOTONIC: (libc)Getting the Time.
  41. * CLOCK_MONOTONIC_COARSE: (libc)Getting the Time.
  42. * CLOCK_MONOTONIC_RAW: (libc)Getting the Time.
  43. * CLOCK_PROCESS_CPUTIME_ID: (libc)Getting the Time.
  44. * CLOCK_REALTIME: (libc)Getting the Time.
  45. * CLOCK_REALTIME_ALARM: (libc)Getting the Time.
  46. * CLOCK_REALTIME_COARSE: (libc)Getting the Time.
  47. * CLOCK_TAI: (libc)Getting the Time.
  48. * CLOCK_THREAD_CPUTIME_ID: (libc)Getting the Time.
  49. * COLL_WEIGHTS_MAX: (libc)Utility Limits.
  50. * CPU_ALLOC: (libc)CPU Affinity.
  51. * CPU_ALLOC_SIZE: (libc)CPU Affinity.
  52. * CPU_AND: (libc)CPU Affinity.
  53. * CPU_AND_S: (libc)CPU Affinity.
  54. * CPU_CLR: (libc)CPU Affinity.
  55. * CPU_CLR_S: (libc)CPU Affinity.
  56. * CPU_COUNT: (libc)CPU Affinity.
  57. * CPU_COUNT_S: (libc)CPU Affinity.
  58. * CPU_EQUAL: (libc)CPU Affinity.
  59. * CPU_EQUAL_S: (libc)CPU Affinity.
  60. * CPU_FEATURE_ACTIVE: (libc)X86.
  61. * CPU_FEATURE_PRESENT: (libc)X86.
  62. * CPU_FREE: (libc)CPU Affinity.
  63. * CPU_ISSET: (libc)CPU Affinity.
  64. * CPU_ISSET_S: (libc)CPU Affinity.
  65. * CPU_OR: (libc)CPU Affinity.
  66. * CPU_OR_S: (libc)CPU Affinity.
  67. * CPU_SET: (libc)CPU Affinity.
  68. * CPU_SETSIZE: (libc)CPU Affinity.
  69. * CPU_SET_S: (libc)CPU Affinity.
  70. * CPU_XOR: (libc)CPU Affinity.
  71. * CPU_XOR_S: (libc)CPU Affinity.
  72. * CPU_ZERO: (libc)CPU Affinity.
  73. * CPU_ZERO_S: (libc)CPU Affinity.
  74. * CREAD: (libc)Control Modes.
  75. * CRTS_IFLOW: (libc)Control Modes.
  76. * CS5: (libc)Control Modes.
  77. * CS6: (libc)Control Modes.
  78. * CS7: (libc)Control Modes.
  79. * CS8: (libc)Control Modes.
  80. * CSIZE: (libc)Control Modes.
  81. * CSTOPB: (libc)Control Modes.
  82. * DLFO_EH_SEGMENT_TYPE: (libc)Dynamic Linker Introspection.
  83. * DLFO_STRUCT_HAS_EH_COUNT: (libc)Dynamic Linker Introspection.
  84. * DLFO_STRUCT_HAS_EH_DBASE: (libc)Dynamic Linker Introspection.
  85. * DTTOIF: (libc)Directory Entries.
  86. * E2BIG: (libc)Error Codes.
  87. * EACCES: (libc)Error Codes.
  88. * EADDRINUSE: (libc)Error Codes.
  89. * EADDRNOTAVAIL: (libc)Error Codes.
  90. * EADV: (libc)Error Codes.
  91. * EAFNOSUPPORT: (libc)Error Codes.
  92. * EAGAIN: (libc)Error Codes.
  93. * EALREADY: (libc)Error Codes.
  94. * EAUTH: (libc)Error Codes.
  95. * EBACKGROUND: (libc)Error Codes.
  96. * EBADE: (libc)Error Codes.
  97. * EBADF: (libc)Error Codes.
  98. * EBADFD: (libc)Error Codes.
  99. * EBADMSG: (libc)Error Codes.
  100. * EBADR: (libc)Error Codes.
  101. * EBADRPC: (libc)Error Codes.
  102. * EBADRQC: (libc)Error Codes.
  103. * EBADSLT: (libc)Error Codes.
  104. * EBFONT: (libc)Error Codes.
  105. * EBUSY: (libc)Error Codes.
  106. * ECANCELED: (libc)Error Codes.
  107. * ECHILD: (libc)Error Codes.
  108. * ECHO: (libc)Local Modes.
  109. * ECHOCTL: (libc)Local Modes.
  110. * ECHOE: (libc)Local Modes.
  111. * ECHOK: (libc)Local Modes.
  112. * ECHOKE: (libc)Local Modes.
  113. * ECHONL: (libc)Local Modes.
  114. * ECHOPRT: (libc)Local Modes.
  115. * ECHRNG: (libc)Error Codes.
  116. * ECOMM: (libc)Error Codes.
  117. * ECONNABORTED: (libc)Error Codes.
  118. * ECONNREFUSED: (libc)Error Codes.
  119. * ECONNRESET: (libc)Error Codes.
  120. * ED: (libc)Error Codes.
  121. * EDEADLK: (libc)Error Codes.
  122. * EDEADLOCK: (libc)Error Codes.
  123. * EDESTADDRREQ: (libc)Error Codes.
  124. * EDIED: (libc)Error Codes.
  125. * EDOM: (libc)Error Codes.
  126. * EDOTDOT: (libc)Error Codes.
  127. * EDQUOT: (libc)Error Codes.
  128. * EEXIST: (libc)Error Codes.
  129. * EFAULT: (libc)Error Codes.
  130. * EFBIG: (libc)Error Codes.
  131. * EFTYPE: (libc)Error Codes.
  132. * EGRATUITOUS: (libc)Error Codes.
  133. * EGREGIOUS: (libc)Error Codes.
  134. * EHOSTDOWN: (libc)Error Codes.
  135. * EHOSTUNREACH: (libc)Error Codes.
  136. * EHWPOISON: (libc)Error Codes.
  137. * EIDRM: (libc)Error Codes.
  138. * EIEIO: (libc)Error Codes.
  139. * EILSEQ: (libc)Error Codes.
  140. * EINPROGRESS: (libc)Error Codes.
  141. * EINTR: (libc)Error Codes.
  142. * EINVAL: (libc)Error Codes.
  143. * EIO: (libc)Error Codes.
  144. * EISCONN: (libc)Error Codes.
  145. * EISDIR: (libc)Error Codes.
  146. * EISNAM: (libc)Error Codes.
  147. * EKEYEXPIRED: (libc)Error Codes.
  148. * EKEYREJECTED: (libc)Error Codes.
  149. * EKEYREVOKED: (libc)Error Codes.
  150. * EL2HLT: (libc)Error Codes.
  151. * EL2NSYNC: (libc)Error Codes.
  152. * EL3HLT: (libc)Error Codes.
  153. * EL3RST: (libc)Error Codes.
  154. * ELIBACC: (libc)Error Codes.
  155. * ELIBBAD: (libc)Error Codes.
  156. * ELIBEXEC: (libc)Error Codes.
  157. * ELIBMAX: (libc)Error Codes.
  158. * ELIBSCN: (libc)Error Codes.
  159. * ELNRNG: (libc)Error Codes.
  160. * ELOOP: (libc)Error Codes.
  161. * EMEDIUMTYPE: (libc)Error Codes.
  162. * EMFILE: (libc)Error Codes.
  163. * EMLINK: (libc)Error Codes.
  164. * EMSGSIZE: (libc)Error Codes.
  165. * EMULTIHOP: (libc)Error Codes.
  166. * ENAMETOOLONG: (libc)Error Codes.
  167. * ENAVAIL: (libc)Error Codes.
  168. * ENEEDAUTH: (libc)Error Codes.
  169. * ENETDOWN: (libc)Error Codes.
  170. * ENETRESET: (libc)Error Codes.
  171. * ENETUNREACH: (libc)Error Codes.
  172. * ENFILE: (libc)Error Codes.
  173. * ENOANO: (libc)Error Codes.
  174. * ENOBUFS: (libc)Error Codes.
  175. * ENOCSI: (libc)Error Codes.
  176. * ENODATA: (libc)Error Codes.
  177. * ENODEV: (libc)Error Codes.
  178. * ENOENT: (libc)Error Codes.
  179. * ENOEXEC: (libc)Error Codes.
  180. * ENOKEY: (libc)Error Codes.
  181. * ENOLCK: (libc)Error Codes.
  182. * ENOLINK: (libc)Error Codes.
  183. * ENOMEDIUM: (libc)Error Codes.
  184. * ENOMEM: (libc)Error Codes.
  185. * ENOMSG: (libc)Error Codes.
  186. * ENONET: (libc)Error Codes.
  187. * ENOPKG: (libc)Error Codes.
  188. * ENOPROTOOPT: (libc)Error Codes.
  189. * ENOSPC: (libc)Error Codes.
  190. * ENOSR: (libc)Error Codes.
  191. * ENOSTR: (libc)Error Codes.
  192. * ENOSYS: (libc)Error Codes.
  193. * ENOTBLK: (libc)Error Codes.
  194. * ENOTCONN: (libc)Error Codes.
  195. * ENOTDIR: (libc)Error Codes.
  196. * ENOTEMPTY: (libc)Error Codes.
  197. * ENOTNAM: (libc)Error Codes.
  198. * ENOTRECOVERABLE: (libc)Error Codes.
  199. * ENOTSOCK: (libc)Error Codes.
  200. * ENOTSUP: (libc)Error Codes.
  201. * ENOTTY: (libc)Error Codes.
  202. * ENOTUNIQ: (libc)Error Codes.
  203. * ENXIO: (libc)Error Codes.
  204. * EOF: (libc)EOF and Errors.
  205. * EOPNOTSUPP: (libc)Error Codes.
  206. * EOVERFLOW: (libc)Error Codes.
  207. * EOWNERDEAD: (libc)Error Codes.
  208. * EPERM: (libc)Error Codes.
  209. * EPFNOSUPPORT: (libc)Error Codes.
  210. * EPIPE: (libc)Error Codes.
  211. * EPROCLIM: (libc)Error Codes.
  212. * EPROCUNAVAIL: (libc)Error Codes.
  213. * EPROGMISMATCH: (libc)Error Codes.
  214. * EPROGUNAVAIL: (libc)Error Codes.
  215. * EPROTO: (libc)Error Codes.
  216. * EPROTONOSUPPORT: (libc)Error Codes.
  217. * EPROTOTYPE: (libc)Error Codes.
  218. * EQUIV_CLASS_MAX: (libc)Utility Limits.
  219. * ERANGE: (libc)Error Codes.
  220. * EREMCHG: (libc)Error Codes.
  221. * EREMOTE: (libc)Error Codes.
  222. * EREMOTEIO: (libc)Error Codes.
  223. * ERESTART: (libc)Error Codes.
  224. * ERFKILL: (libc)Error Codes.
  225. * EROFS: (libc)Error Codes.
  226. * ERPCMISMATCH: (libc)Error Codes.
  227. * ESHUTDOWN: (libc)Error Codes.
  228. * ESOCKTNOSUPPORT: (libc)Error Codes.
  229. * ESPIPE: (libc)Error Codes.
  230. * ESRCH: (libc)Error Codes.
  231. * ESRMNT: (libc)Error Codes.
  232. * ESTALE: (libc)Error Codes.
  233. * ESTRPIPE: (libc)Error Codes.
  234. * ETIME: (libc)Error Codes.
  235. * ETIMEDOUT: (libc)Error Codes.
  236. * ETOOMANYREFS: (libc)Error Codes.
  237. * ETXTBSY: (libc)Error Codes.
  238. * EUCLEAN: (libc)Error Codes.
  239. * EUNATCH: (libc)Error Codes.
  240. * EUSERS: (libc)Error Codes.
  241. * EWOULDBLOCK: (libc)Error Codes.
  242. * EXDEV: (libc)Error Codes.
  243. * EXFULL: (libc)Error Codes.
  244. * EXIT_FAILURE: (libc)Exit Status.
  245. * EXIT_SUCCESS: (libc)Exit Status.
  246. * EXPR_NEST_MAX: (libc)Utility Limits.
  247. * FD_CLOEXEC: (libc)Descriptor Flags.
  248. * FD_CLR: (libc)Waiting for I/O.
  249. * FD_ISSET: (libc)Waiting for I/O.
  250. * FD_SET: (libc)Waiting for I/O.
  251. * FD_SETSIZE: (libc)Waiting for I/O.
  252. * FD_ZERO: (libc)Waiting for I/O.
  253. * FE_SNANS_ALWAYS_SIGNAL: (libc)Infinity and NaN.
  254. * FILENAME_MAX: (libc)Limits for Files.
  255. * FLUSHO: (libc)Local Modes.
  256. * FOPEN_MAX: (libc)Opening Streams.
  257. * FP_ILOGB0: (libc)Exponents and Logarithms.
  258. * FP_ILOGBNAN: (libc)Exponents and Logarithms.
  259. * FP_LLOGB0: (libc)Exponents and Logarithms.
  260. * FP_LLOGBNAN: (libc)Exponents and Logarithms.
  261. * F_DUPFD: (libc)Duplicating Descriptors.
  262. * F_GETFD: (libc)Descriptor Flags.
  263. * F_GETFL: (libc)Getting File Status Flags.
  264. * F_GETLK: (libc)File Locks.
  265. * F_GETOWN: (libc)Interrupt Input.
  266. * F_OFD_GETLK: (libc)Open File Description Locks.
  267. * F_OFD_SETLK: (libc)Open File Description Locks.
  268. * F_OFD_SETLKW: (libc)Open File Description Locks.
  269. * F_OK: (libc)Testing File Access.
  270. * F_SETFD: (libc)Descriptor Flags.
  271. * F_SETFL: (libc)Getting File Status Flags.
  272. * F_SETLK: (libc)File Locks.
  273. * F_SETLKW: (libc)File Locks.
  274. * F_SETOWN: (libc)Interrupt Input.
  275. * HUGE_VAL: (libc)Math Error Reporting.
  276. * HUGE_VALF: (libc)Math Error Reporting.
  277. * HUGE_VALL: (libc)Math Error Reporting.
  278. * HUGE_VAL_FN: (libc)Math Error Reporting.
  279. * HUGE_VAL_FNx: (libc)Math Error Reporting.
  280. * HUPCL: (libc)Control Modes.
  281. * I: (libc)Complex Numbers.
  282. * ICANON: (libc)Local Modes.
  283. * ICRNL: (libc)Input Modes.
  284. * IEXTEN: (libc)Local Modes.
  285. * IFNAMSIZ: (libc)Interface Naming.
  286. * IFTODT: (libc)Directory Entries.
  287. * IGNBRK: (libc)Input Modes.
  288. * IGNCR: (libc)Input Modes.
  289. * IGNPAR: (libc)Input Modes.
  290. * IMAXBEL: (libc)Input Modes.
  291. * INADDR_ANY: (libc)Host Address Data Type.
  292. * INADDR_BROADCAST: (libc)Host Address Data Type.
  293. * INADDR_LOOPBACK: (libc)Host Address Data Type.
  294. * INADDR_NONE: (libc)Host Address Data Type.
  295. * INFINITY: (libc)Infinity and NaN.
  296. * INLCR: (libc)Input Modes.
  297. * INPCK: (libc)Input Modes.
  298. * IPPORT_RESERVED: (libc)Ports.
  299. * IPPORT_USERRESERVED: (libc)Ports.
  300. * ISIG: (libc)Local Modes.
  301. * ISTRIP: (libc)Input Modes.
  302. * IXANY: (libc)Input Modes.
  303. * IXOFF: (libc)Input Modes.
  304. * IXON: (libc)Input Modes.
  305. * LINE_MAX: (libc)Utility Limits.
  306. * LINK_MAX: (libc)Limits for Files.
  307. * L_ctermid: (libc)Identifying the Terminal.
  308. * L_cuserid: (libc)Who Logged In.
  309. * L_tmpnam: (libc)Temporary Files.
  310. * MAXNAMLEN: (libc)Limits for Files.
  311. * MAXSYMLINKS: (libc)Symbolic Links.
  312. * MAX_CANON: (libc)Limits for Files.
  313. * MAX_INPUT: (libc)Limits for Files.
  314. * MB_CUR_MAX: (libc)Selecting the Conversion.
  315. * MB_LEN_MAX: (libc)Selecting the Conversion.
  316. * MDMBUF: (libc)Control Modes.
  317. * MSG_DONTROUTE: (libc)Socket Data Options.
  318. * MSG_OOB: (libc)Socket Data Options.
  319. * MSG_PEEK: (libc)Socket Data Options.
  320. * NAME_MAX: (libc)Limits for Files.
  321. * NAN: (libc)Infinity and NaN.
  322. * NCCS: (libc)Mode Data Types.
  323. * NGROUPS_MAX: (libc)General Limits.
  324. * NOFLSH: (libc)Local Modes.
  325. * NOKERNINFO: (libc)Local Modes.
  326. * NSIG: (libc)Standard Signals.
  327. * NULL: (libc)Null Pointer Constant.
  328. * ONLCR: (libc)Output Modes.
  329. * ONOEOT: (libc)Output Modes.
  330. * OPEN_MAX: (libc)General Limits.
  331. * OPOST: (libc)Output Modes.
  332. * OXTABS: (libc)Output Modes.
  333. * O_ACCMODE: (libc)Access Modes.
  334. * O_APPEND: (libc)Operating Modes.
  335. * O_ASYNC: (libc)Operating Modes.
  336. * O_CREAT: (libc)Open-time Flags.
  337. * O_DIRECTORY: (libc)Open-time Flags.
  338. * O_EXCL: (libc)Open-time Flags.
  339. * O_EXEC: (libc)Access Modes.
  340. * O_EXLOCK: (libc)Open-time Flags.
  341. * O_FSYNC: (libc)Operating Modes.
  342. * O_IGNORE_CTTY: (libc)Open-time Flags.
  343. * O_NDELAY: (libc)Operating Modes.
  344. * O_NOATIME: (libc)Operating Modes.
  345. * O_NOCTTY: (libc)Open-time Flags.
  346. * O_NOFOLLOW: (libc)Open-time Flags.
  347. * O_NOLINK: (libc)Open-time Flags.
  348. * O_NONBLOCK: (libc)Open-time Flags.
  349. * O_NONBLOCK: (libc)Operating Modes.
  350. * O_NOTRANS: (libc)Open-time Flags.
  351. * O_PATH: (libc)Access Modes.
  352. * O_RDONLY: (libc)Access Modes.
  353. * O_RDWR: (libc)Access Modes.
  354. * O_READ: (libc)Access Modes.
  355. * O_SHLOCK: (libc)Open-time Flags.
  356. * O_SYNC: (libc)Operating Modes.
  357. * O_TMPFILE: (libc)Open-time Flags.
  358. * O_TRUNC: (libc)Open-time Flags.
  359. * O_WRITE: (libc)Access Modes.
  360. * O_WRONLY: (libc)Access Modes.
  361. * PARENB: (libc)Control Modes.
  362. * PARMRK: (libc)Input Modes.
  363. * PARODD: (libc)Control Modes.
  364. * PATH_MAX: (libc)Limits for Files.
  365. * PA_FLAG_MASK: (libc)Parsing a Template String.
  366. * PENDIN: (libc)Local Modes.
  367. * PF_FILE: (libc)Local Namespace Details.
  368. * PF_INET6: (libc)Internet Namespace.
  369. * PF_INET: (libc)Internet Namespace.
  370. * PF_LOCAL: (libc)Local Namespace Details.
  371. * PF_UNIX: (libc)Local Namespace Details.
  372. * PIPE_BUF: (libc)Limits for Files.
  373. * PTHREAD_ATTR_NO_SIGMASK_NP: (libc)Initial Thread Signal Mask.
  374. * P_tmpdir: (libc)Temporary Files.
  375. * RAND_MAX: (libc)ISO Random.
  376. * RE_DUP_MAX: (libc)General Limits.
  377. * RLIM_INFINITY: (libc)Limits on Resources.
  378. * RSEQ_SIG: (libc)Restartable Sequences.
  379. * R_OK: (libc)Testing File Access.
  380. * SA_NOCLDSTOP: (libc)Flags for Sigaction.
  381. * SA_NOCLDWAIT: (libc)Flags for Sigaction.
  382. * SA_NODEFER: (libc)Flags for Sigaction.
  383. * SA_ONSTACK: (libc)Flags for Sigaction.
  384. * SA_RESETHAND: (libc)Flags for Sigaction.
  385. * SA_RESTART: (libc)Flags for Sigaction.
  386. * SA_SIGINFO: (libc)Flags for Sigaction.
  387. * SEEK_CUR: (libc)File Positioning.
  388. * SEEK_END: (libc)File Positioning.
  389. * SEEK_SET: (libc)File Positioning.
  390. * SIGABRT: (libc)Program Error Signals.
  391. * SIGALRM: (libc)Alarm Signals.
  392. * SIGBUS: (libc)Program Error Signals.
  393. * SIGCHLD: (libc)Job Control Signals.
  394. * SIGCLD: (libc)Job Control Signals.
  395. * SIGCONT: (libc)Job Control Signals.
  396. * SIGEMT: (libc)Program Error Signals.
  397. * SIGFPE: (libc)Program Error Signals.
  398. * SIGHUP: (libc)Termination Signals.
  399. * SIGILL: (libc)Program Error Signals.
  400. * SIGINFO: (libc)Miscellaneous Signals.
  401. * SIGINT: (libc)Termination Signals.
  402. * SIGIO: (libc)Asynchronous I/O Signals.
  403. * SIGIOT: (libc)Program Error Signals.
  404. * SIGKILL: (libc)Termination Signals.
  405. * SIGLOST: (libc)Operation Error Signals.
  406. * SIGPIPE: (libc)Operation Error Signals.
  407. * SIGPOLL: (libc)Asynchronous I/O Signals.
  408. * SIGPROF: (libc)Alarm Signals.
  409. * SIGPWR: (libc)Miscellaneous Signals.
  410. * SIGQUIT: (libc)Termination Signals.
  411. * SIGSEGV: (libc)Program Error Signals.
  412. * SIGSTKFLT: (libc)Program Error Signals.
  413. * SIGSTOP: (libc)Job Control Signals.
  414. * SIGSYS: (libc)Program Error Signals.
  415. * SIGTERM: (libc)Termination Signals.
  416. * SIGTRAP: (libc)Program Error Signals.
  417. * SIGTSTP: (libc)Job Control Signals.
  418. * SIGTTIN: (libc)Job Control Signals.
  419. * SIGTTOU: (libc)Job Control Signals.
  420. * SIGURG: (libc)Asynchronous I/O Signals.
  421. * SIGUSR1: (libc)Miscellaneous Signals.
  422. * SIGUSR2: (libc)Miscellaneous Signals.
  423. * SIGVTALRM: (libc)Alarm Signals.
  424. * SIGWINCH: (libc)Miscellaneous Signals.
  425. * SIGXCPU: (libc)Operation Error Signals.
  426. * SIGXFSZ: (libc)Operation Error Signals.
  427. * SIG_ERR: (libc)Basic Signal Handling.
  428. * SNAN: (libc)Infinity and NaN.
  429. * SNANF: (libc)Infinity and NaN.
  430. * SNANFN: (libc)Infinity and NaN.
  431. * SNANFNx: (libc)Infinity and NaN.
  432. * SNANL: (libc)Infinity and NaN.
  433. * SOCK_DGRAM: (libc)Communication Styles.
  434. * SOCK_RAW: (libc)Communication Styles.
  435. * SOCK_RDM: (libc)Communication Styles.
  436. * SOCK_SEQPACKET: (libc)Communication Styles.
  437. * SOCK_STREAM: (libc)Communication Styles.
  438. * SOL_SOCKET: (libc)Socket-Level Options.
  439. * SPEED_MAX: (libc)Line Speed.
  440. * SSIZE_MAX: (libc)General Limits.
  441. * STREAM_MAX: (libc)General Limits.
  442. * SUN_LEN: (libc)Local Namespace Details.
  443. * S_IFMT: (libc)Testing File Type.
  444. * S_ISBLK: (libc)Testing File Type.
  445. * S_ISCHR: (libc)Testing File Type.
  446. * S_ISDIR: (libc)Testing File Type.
  447. * S_ISFIFO: (libc)Testing File Type.
  448. * S_ISLNK: (libc)Testing File Type.
  449. * S_ISREG: (libc)Testing File Type.
  450. * S_ISSOCK: (libc)Testing File Type.
  451. * S_TYPEISMQ: (libc)Testing File Type.
  452. * S_TYPEISSEM: (libc)Testing File Type.
  453. * S_TYPEISSHM: (libc)Testing File Type.
  454. * TIME_UTC: (libc)Getting the Time.
  455. * TMP_MAX: (libc)Temporary Files.
  456. * TOSTOP: (libc)Local Modes.
  457. * TZNAME_MAX: (libc)General Limits.
  458. * VDISCARD: (libc)Other Special.
  459. * VDSUSP: (libc)Signal Characters.
  460. * VEOF: (libc)Editing Characters.
  461. * VEOL2: (libc)Editing Characters.
  462. * VEOL: (libc)Editing Characters.
  463. * VERASE: (libc)Editing Characters.
  464. * VINTR: (libc)Signal Characters.
  465. * VKILL: (libc)Editing Characters.
  466. * VLNEXT: (libc)Other Special.
  467. * VMIN: (libc)Noncanonical Input.
  468. * VQUIT: (libc)Signal Characters.
  469. * VREPRINT: (libc)Editing Characters.
  470. * VSTART: (libc)Start/Stop Characters.
  471. * VSTATUS: (libc)Other Special.
  472. * VSTOP: (libc)Start/Stop Characters.
  473. * VSUSP: (libc)Signal Characters.
  474. * VTIME: (libc)Noncanonical Input.
  475. * VWERASE: (libc)Editing Characters.
  476. * WCHAR_MAX: (libc)Extended Char Intro.
  477. * WCHAR_MIN: (libc)Extended Char Intro.
  478. * WCOREDUMP: (libc)Process Completion Status.
  479. * WEOF: (libc)EOF and Errors.
  480. * WEOF: (libc)Extended Char Intro.
  481. * WEXITSTATUS: (libc)Process Completion Status.
  482. * WIFEXITED: (libc)Process Completion Status.
  483. * WIFSIGNALED: (libc)Process Completion Status.
  484. * WIFSTOPPED: (libc)Process Completion Status.
  485. * WSTOPSIG: (libc)Process Completion Status.
  486. * WTERMSIG: (libc)Process Completion Status.
  487. * W_OK: (libc)Testing File Access.
  488. * X_OK: (libc)Testing File Access.
  489. * _Complex_I: (libc)Complex Numbers.
  490. * _Exit: (libc)Termination Internals.
  491. * _Fork: (libc)Creating a Process.
  492. * _IOFBF: (libc)Controlling Buffering.
  493. * _IOLBF: (libc)Controlling Buffering.
  494. * _IONBF: (libc)Controlling Buffering.
  495. * _Imaginary_I: (libc)Complex Numbers.
  496. * _PATH_UTMP: (libc)Manipulating the Database.
  497. * _PATH_WTMP: (libc)Manipulating the Database.
  498. * _POSIX2_C_DEV: (libc)System Options.
  499. * _POSIX2_C_VERSION: (libc)Version Supported.
  500. * _POSIX2_FORT_DEV: (libc)System Options.
  501. * _POSIX2_FORT_RUN: (libc)System Options.
  502. * _POSIX2_LOCALEDEF: (libc)System Options.
  503. * _POSIX2_SW_DEV: (libc)System Options.
  504. * _POSIX_CHOWN_RESTRICTED: (libc)Options for Files.
  505. * _POSIX_JOB_CONTROL: (libc)System Options.
  506. * _POSIX_NO_TRUNC: (libc)Options for Files.
  507. * _POSIX_SAVED_IDS: (libc)System Options.
  508. * _POSIX_VDISABLE: (libc)Options for Files.
  509. * _POSIX_VERSION: (libc)Version Supported.
  510. * __fbufsize: (libc)Controlling Buffering.
  511. * __flbf: (libc)Controlling Buffering.
  512. * __fpending: (libc)Controlling Buffering.
  513. * __fpurge: (libc)Flushing Buffers.
  514. * __freadable: (libc)Opening Streams.
  515. * __freading: (libc)Opening Streams.
  516. * __fsetlocking: (libc)Streams and Threads.
  517. * __fwritable: (libc)Opening Streams.
  518. * __fwriting: (libc)Opening Streams.
  519. * __gconv_end_fct: (libc)glibc iconv Implementation.
  520. * __gconv_fct: (libc)glibc iconv Implementation.
  521. * __gconv_init_fct: (libc)glibc iconv Implementation.
  522. * __ppc_get_timebase: (libc)PowerPC.
  523. * __ppc_get_timebase_freq: (libc)PowerPC.
  524. * __ppc_mdoio: (libc)PowerPC.
  525. * __ppc_mdoom: (libc)PowerPC.
  526. * __ppc_set_ppr_low: (libc)PowerPC.
  527. * __ppc_set_ppr_med: (libc)PowerPC.
  528. * __ppc_set_ppr_med_high: (libc)PowerPC.
  529. * __ppc_set_ppr_med_low: (libc)PowerPC.
  530. * __ppc_set_ppr_very_low: (libc)PowerPC.
  531. * __ppc_yield: (libc)PowerPC.
  532. * __riscv_flush_icache: (libc)RISC-V.
  533. * __va_copy: (libc)Argument Macros.
  534. * __x86_get_cpuid_feature_leaf: (libc)X86.
  535. * _dl_find_object: (libc)Dynamic Linker Introspection.
  536. * _exit: (libc)Termination Internals.
  537. * _flushlbf: (libc)Flushing Buffers.
  538. * _tolower: (libc)Case Conversion.
  539. * _toupper: (libc)Case Conversion.
  540. * a64l: (libc)Encode Binary Data.
  541. * abort: (libc)Aborting a Program.
  542. * abs: (libc)Absolute Value.
  543. * accept: (libc)Accepting Connections.
  544. * access: (libc)Testing File Access.
  545. * acos: (libc)Inverse Trig Functions.
  546. * acosf: (libc)Inverse Trig Functions.
  547. * acosfN: (libc)Inverse Trig Functions.
  548. * acosfNx: (libc)Inverse Trig Functions.
  549. * acosh: (libc)Hyperbolic Functions.
  550. * acoshf: (libc)Hyperbolic Functions.
  551. * acoshfN: (libc)Hyperbolic Functions.
  552. * acoshfNx: (libc)Hyperbolic Functions.
  553. * acoshl: (libc)Hyperbolic Functions.
  554. * acosl: (libc)Inverse Trig Functions.
  555. * acospi: (libc)Inverse Trig Functions.
  556. * acospif: (libc)Inverse Trig Functions.
  557. * acospifN: (libc)Inverse Trig Functions.
  558. * acospifNx: (libc)Inverse Trig Functions.
  559. * acospil: (libc)Inverse Trig Functions.
  560. * addmntent: (libc)mtab.
  561. * addseverity: (libc)Adding Severity Classes.
  562. * adjtime: (libc)Setting and Adjusting the Time.
  563. * adjtimex: (libc)Setting and Adjusting the Time.
  564. * aio_cancel64: (libc)Cancel AIO Operations.
  565. * aio_cancel: (libc)Cancel AIO Operations.
  566. * aio_error64: (libc)Status of AIO Operations.
  567. * aio_error: (libc)Status of AIO Operations.
  568. * aio_fsync64: (libc)Synchronizing AIO Operations.
  569. * aio_fsync: (libc)Synchronizing AIO Operations.
  570. * aio_init: (libc)Configuration of AIO.
  571. * aio_read64: (libc)Asynchronous Reads/Writes.
  572. * aio_read: (libc)Asynchronous Reads/Writes.
  573. * aio_return64: (libc)Status of AIO Operations.
  574. * aio_return: (libc)Status of AIO Operations.
  575. * aio_suspend64: (libc)Synchronizing AIO Operations.
  576. * aio_suspend: (libc)Synchronizing AIO Operations.
  577. * aio_write64: (libc)Asynchronous Reads/Writes.
  578. * aio_write: (libc)Asynchronous Reads/Writes.
  579. * alarm: (libc)Setting an Alarm.
  580. * aligned_alloc: (libc)Aligned Memory Blocks.
  581. * alloca: (libc)Variable Size Automatic.
  582. * alphasort64: (libc)Scanning Directory Content.
  583. * alphasort: (libc)Scanning Directory Content.
  584. * arc4random: (libc)High Quality Random.
  585. * arc4random_buf: (libc)High Quality Random.
  586. * arc4random_uniform: (libc)High Quality Random.
  587. * argp_error: (libc)Argp Helper Functions.
  588. * argp_failure: (libc)Argp Helper Functions.
  589. * argp_help: (libc)Argp Help.
  590. * argp_parse: (libc)Argp.
  591. * argp_state_help: (libc)Argp Helper Functions.
  592. * argp_usage: (libc)Argp Helper Functions.
  593. * argz_add: (libc)Argz Functions.
  594. * argz_add_sep: (libc)Argz Functions.
  595. * argz_append: (libc)Argz Functions.
  596. * argz_count: (libc)Argz Functions.
  597. * argz_create: (libc)Argz Functions.
  598. * argz_create_sep: (libc)Argz Functions.
  599. * argz_delete: (libc)Argz Functions.
  600. * argz_extract: (libc)Argz Functions.
  601. * argz_insert: (libc)Argz Functions.
  602. * argz_next: (libc)Argz Functions.
  603. * argz_replace: (libc)Argz Functions.
  604. * argz_stringify: (libc)Argz Functions.
  605. * asctime: (libc)Formatting Calendar Time.
  606. * asctime_r: (libc)Formatting Calendar Time.
  607. * asin: (libc)Inverse Trig Functions.
  608. * asinf: (libc)Inverse Trig Functions.
  609. * asinfN: (libc)Inverse Trig Functions.
  610. * asinfNx: (libc)Inverse Trig Functions.
  611. * asinh: (libc)Hyperbolic Functions.
  612. * asinhf: (libc)Hyperbolic Functions.
  613. * asinhfN: (libc)Hyperbolic Functions.
  614. * asinhfNx: (libc)Hyperbolic Functions.
  615. * asinhl: (libc)Hyperbolic Functions.
  616. * asinl: (libc)Inverse Trig Functions.
  617. * asinpi: (libc)Inverse Trig Functions.
  618. * asinpif: (libc)Inverse Trig Functions.
  619. * asinpifN: (libc)Inverse Trig Functions.
  620. * asinpifNx: (libc)Inverse Trig Functions.
  621. * asinpil: (libc)Inverse Trig Functions.
  622. * asprintf: (libc)Dynamic Output.
  623. * assert: (libc)Consistency Checking.
  624. * assert_perror: (libc)Consistency Checking.
  625. * atan2: (libc)Inverse Trig Functions.
  626. * atan2f: (libc)Inverse Trig Functions.
  627. * atan2fN: (libc)Inverse Trig Functions.
  628. * atan2fNx: (libc)Inverse Trig Functions.
  629. * atan2l: (libc)Inverse Trig Functions.
  630. * atan2pi: (libc)Inverse Trig Functions.
  631. * atan2pif: (libc)Inverse Trig Functions.
  632. * atan2pifN: (libc)Inverse Trig Functions.
  633. * atan2pifNx: (libc)Inverse Trig Functions.
  634. * atan2pil: (libc)Inverse Trig Functions.
  635. * atan: (libc)Inverse Trig Functions.
  636. * atanf: (libc)Inverse Trig Functions.
  637. * atanfN: (libc)Inverse Trig Functions.
  638. * atanfNx: (libc)Inverse Trig Functions.
  639. * atanh: (libc)Hyperbolic Functions.
  640. * atanhf: (libc)Hyperbolic Functions.
  641. * atanhfN: (libc)Hyperbolic Functions.
  642. * atanhfNx: (libc)Hyperbolic Functions.
  643. * atanhl: (libc)Hyperbolic Functions.
  644. * atanl: (libc)Inverse Trig Functions.
  645. * atanpi: (libc)Inverse Trig Functions.
  646. * atanpif: (libc)Inverse Trig Functions.
  647. * atanpifN: (libc)Inverse Trig Functions.
  648. * atanpifNx: (libc)Inverse Trig Functions.
  649. * atanpil: (libc)Inverse Trig Functions.
  650. * atexit: (libc)Cleanups on Exit.
  651. * atof: (libc)Parsing of Floats.
  652. * atoi: (libc)Parsing of Integers.
  653. * atol: (libc)Parsing of Integers.
  654. * atoll: (libc)Parsing of Integers.
  655. * backtrace: (libc)Backtraces.
  656. * backtrace_symbols: (libc)Backtraces.
  657. * backtrace_symbols_fd: (libc)Backtraces.
  658. * basename: (libc)Finding Tokens in a String.
  659. * basename: (libc)Finding Tokens in a String.
  660. * bcmp: (libc)String/Array Comparison.
  661. * bcopy: (libc)Copying Strings and Arrays.
  662. * bind: (libc)Setting Address.
  663. * bind_textdomain_codeset: (libc)Charset conversion in gettext.
  664. * bindtextdomain: (libc)Locating gettext catalog.
  665. * brk: (libc)Resizing the Data Segment.
  666. * bsearch: (libc)Array Search Function.
  667. * btowc: (libc)Converting a Character.
  668. * bzero: (libc)Copying Strings and Arrays.
  669. * cabs: (libc)Absolute Value.
  670. * cabsf: (libc)Absolute Value.
  671. * cabsfN: (libc)Absolute Value.
  672. * cabsfNx: (libc)Absolute Value.
  673. * cabsl: (libc)Absolute Value.
  674. * cacos: (libc)Inverse Trig Functions.
  675. * cacosf: (libc)Inverse Trig Functions.
  676. * cacosfN: (libc)Inverse Trig Functions.
  677. * cacosfNx: (libc)Inverse Trig Functions.
  678. * cacosh: (libc)Hyperbolic Functions.
  679. * cacoshf: (libc)Hyperbolic Functions.
  680. * cacoshfN: (libc)Hyperbolic Functions.
  681. * cacoshfNx: (libc)Hyperbolic Functions.
  682. * cacoshl: (libc)Hyperbolic Functions.
  683. * cacosl: (libc)Inverse Trig Functions.
  684. * call_once: (libc)Call Once.
  685. * calloc: (libc)Allocating Cleared Space.
  686. * canonicalize: (libc)FP Bit Twiddling.
  687. * canonicalize_file_name: (libc)Symbolic Links.
  688. * canonicalizef: (libc)FP Bit Twiddling.
  689. * canonicalizefN: (libc)FP Bit Twiddling.
  690. * canonicalizefNx: (libc)FP Bit Twiddling.
  691. * canonicalizel: (libc)FP Bit Twiddling.
  692. * carg: (libc)Operations on Complex.
  693. * cargf: (libc)Operations on Complex.
  694. * cargfN: (libc)Operations on Complex.
  695. * cargfNx: (libc)Operations on Complex.
  696. * cargl: (libc)Operations on Complex.
  697. * casin: (libc)Inverse Trig Functions.
  698. * casinf: (libc)Inverse Trig Functions.
  699. * casinfN: (libc)Inverse Trig Functions.
  700. * casinfNx: (libc)Inverse Trig Functions.
  701. * casinh: (libc)Hyperbolic Functions.
  702. * casinhf: (libc)Hyperbolic Functions.
  703. * casinhfN: (libc)Hyperbolic Functions.
  704. * casinhfNx: (libc)Hyperbolic Functions.
  705. * casinhl: (libc)Hyperbolic Functions.
  706. * casinl: (libc)Inverse Trig Functions.
  707. * catan: (libc)Inverse Trig Functions.
  708. * catanf: (libc)Inverse Trig Functions.
  709. * catanfN: (libc)Inverse Trig Functions.
  710. * catanfNx: (libc)Inverse Trig Functions.
  711. * catanh: (libc)Hyperbolic Functions.
  712. * catanhf: (libc)Hyperbolic Functions.
  713. * catanhfN: (libc)Hyperbolic Functions.
  714. * catanhfNx: (libc)Hyperbolic Functions.
  715. * catanhl: (libc)Hyperbolic Functions.
  716. * catanl: (libc)Inverse Trig Functions.
  717. * catclose: (libc)The catgets Functions.
  718. * catgets: (libc)The catgets Functions.
  719. * catopen: (libc)The catgets Functions.
  720. * cbrt: (libc)Exponents and Logarithms.
  721. * cbrtf: (libc)Exponents and Logarithms.
  722. * cbrtfN: (libc)Exponents and Logarithms.
  723. * cbrtfNx: (libc)Exponents and Logarithms.
  724. * cbrtl: (libc)Exponents and Logarithms.
  725. * ccos: (libc)Trig Functions.
  726. * ccosf: (libc)Trig Functions.
  727. * ccosfN: (libc)Trig Functions.
  728. * ccosfNx: (libc)Trig Functions.
  729. * ccosh: (libc)Hyperbolic Functions.
  730. * ccoshf: (libc)Hyperbolic Functions.
  731. * ccoshfN: (libc)Hyperbolic Functions.
  732. * ccoshfNx: (libc)Hyperbolic Functions.
  733. * ccoshl: (libc)Hyperbolic Functions.
  734. * ccosl: (libc)Trig Functions.
  735. * ceil: (libc)Rounding Functions.
  736. * ceilf: (libc)Rounding Functions.
  737. * ceilfN: (libc)Rounding Functions.
  738. * ceilfNx: (libc)Rounding Functions.
  739. * ceill: (libc)Rounding Functions.
  740. * cexp: (libc)Exponents and Logarithms.
  741. * cexpf: (libc)Exponents and Logarithms.
  742. * cexpfN: (libc)Exponents and Logarithms.
  743. * cexpfNx: (libc)Exponents and Logarithms.
  744. * cexpl: (libc)Exponents and Logarithms.
  745. * cfgetibaud: (libc)Line Speed.
  746. * cfgetispeed: (libc)Line Speed.
  747. * cfgetobaud: (libc)Line Speed.
  748. * cfgetospeed: (libc)Line Speed.
  749. * cfmakeraw: (libc)Noncanonical Input.
  750. * cfsetbaud: (libc)Line Speed.
  751. * cfsetibaud: (libc)Line Speed.
  752. * cfsetispeed: (libc)Line Speed.
  753. * cfsetobaud: (libc)Line Speed.
  754. * cfsetospeed: (libc)Line Speed.
  755. * cfsetspeed: (libc)Line Speed.
  756. * chdir: (libc)Working Directory.
  757. * chmod: (libc)Setting Permissions.
  758. * chown: (libc)File Owner.
  759. * cimag: (libc)Operations on Complex.
  760. * cimagf: (libc)Operations on Complex.
  761. * cimagfN: (libc)Operations on Complex.
  762. * cimagfNx: (libc)Operations on Complex.
  763. * cimagl: (libc)Operations on Complex.
  764. * clearenv: (libc)Environment Access.
  765. * clearerr: (libc)Error Recovery.
  766. * clearerr_unlocked: (libc)Error Recovery.
  767. * clock: (libc)CPU Time.
  768. * clock_getres: (libc)Getting the Time.
  769. * clock_gettime: (libc)Getting the Time.
  770. * clock_nanosleep: (libc)Sleeping.
  771. * clock_settime: (libc)Setting and Adjusting the Time.
  772. * clog10: (libc)Exponents and Logarithms.
  773. * clog10f: (libc)Exponents and Logarithms.
  774. * clog10fN: (libc)Exponents and Logarithms.
  775. * clog10fNx: (libc)Exponents and Logarithms.
  776. * clog10l: (libc)Exponents and Logarithms.
  777. * clog: (libc)Exponents and Logarithms.
  778. * clogf: (libc)Exponents and Logarithms.
  779. * clogfN: (libc)Exponents and Logarithms.
  780. * clogfNx: (libc)Exponents and Logarithms.
  781. * clogl: (libc)Exponents and Logarithms.
  782. * close: (libc)Opening and Closing Files.
  783. * close_range: (libc)Opening and Closing Files.
  784. * closedir: (libc)Reading/Closing Directory.
  785. * closefrom: (libc)Opening and Closing Files.
  786. * closelog: (libc)closelog.
  787. * cnd_broadcast: (libc)ISO C Condition Variables.
  788. * cnd_destroy: (libc)ISO C Condition Variables.
  789. * cnd_init: (libc)ISO C Condition Variables.
  790. * cnd_signal: (libc)ISO C Condition Variables.
  791. * cnd_timedwait: (libc)ISO C Condition Variables.
  792. * cnd_wait: (libc)ISO C Condition Variables.
  793. * compoundn: (libc)Exponents and Logarithms.
  794. * compoundnf: (libc)Exponents and Logarithms.
  795. * compoundnfN: (libc)Exponents and Logarithms.
  796. * compoundnfNx: (libc)Exponents and Logarithms.
  797. * compoundnl: (libc)Exponents and Logarithms.
  798. * confstr: (libc)String Parameters.
  799. * conj: (libc)Operations on Complex.
  800. * conjf: (libc)Operations on Complex.
  801. * conjfN: (libc)Operations on Complex.
  802. * conjfNx: (libc)Operations on Complex.
  803. * conjl: (libc)Operations on Complex.
  804. * connect: (libc)Connecting.
  805. * copy_file_range: (libc)Copying File Data.
  806. * copysign: (libc)FP Bit Twiddling.
  807. * copysignf: (libc)FP Bit Twiddling.
  808. * copysignfN: (libc)FP Bit Twiddling.
  809. * copysignfNx: (libc)FP Bit Twiddling.
  810. * copysignl: (libc)FP Bit Twiddling.
  811. * cos: (libc)Trig Functions.
  812. * cosf: (libc)Trig Functions.
  813. * cosfN: (libc)Trig Functions.
  814. * cosfNx: (libc)Trig Functions.
  815. * cosh: (libc)Hyperbolic Functions.
  816. * coshf: (libc)Hyperbolic Functions.
  817. * coshfN: (libc)Hyperbolic Functions.
  818. * coshfNx: (libc)Hyperbolic Functions.
  819. * coshl: (libc)Hyperbolic Functions.
  820. * cosl: (libc)Trig Functions.
  821. * cospi: (libc)Trig Functions.
  822. * cospif: (libc)Trig Functions.
  823. * cospifN: (libc)Trig Functions.
  824. * cospifNx: (libc)Trig Functions.
  825. * cospil: (libc)Trig Functions.
  826. * cpow: (libc)Exponents and Logarithms.
  827. * cpowf: (libc)Exponents and Logarithms.
  828. * cpowfN: (libc)Exponents and Logarithms.
  829. * cpowfNx: (libc)Exponents and Logarithms.
  830. * cpowl: (libc)Exponents and Logarithms.
  831. * cproj: (libc)Operations on Complex.
  832. * cprojf: (libc)Operations on Complex.
  833. * cprojfN: (libc)Operations on Complex.
  834. * cprojfNx: (libc)Operations on Complex.
  835. * cprojl: (libc)Operations on Complex.
  836. * creal: (libc)Operations on Complex.
  837. * crealf: (libc)Operations on Complex.
  838. * crealfN: (libc)Operations on Complex.
  839. * crealfNx: (libc)Operations on Complex.
  840. * creall: (libc)Operations on Complex.
  841. * creat64: (libc)Opening and Closing Files.
  842. * creat: (libc)Opening and Closing Files.
  843. * csin: (libc)Trig Functions.
  844. * csinf: (libc)Trig Functions.
  845. * csinfN: (libc)Trig Functions.
  846. * csinfNx: (libc)Trig Functions.
  847. * csinh: (libc)Hyperbolic Functions.
  848. * csinhf: (libc)Hyperbolic Functions.
  849. * csinhfN: (libc)Hyperbolic Functions.
  850. * csinhfNx: (libc)Hyperbolic Functions.
  851. * csinhl: (libc)Hyperbolic Functions.
  852. * csinl: (libc)Trig Functions.
  853. * csqrt: (libc)Exponents and Logarithms.
  854. * csqrtf: (libc)Exponents and Logarithms.
  855. * csqrtfN: (libc)Exponents and Logarithms.
  856. * csqrtfNx: (libc)Exponents and Logarithms.
  857. * csqrtl: (libc)Exponents and Logarithms.
  858. * ctan: (libc)Trig Functions.
  859. * ctanf: (libc)Trig Functions.
  860. * ctanfN: (libc)Trig Functions.
  861. * ctanfNx: (libc)Trig Functions.
  862. * ctanh: (libc)Hyperbolic Functions.
  863. * ctanhf: (libc)Hyperbolic Functions.
  864. * ctanhfN: (libc)Hyperbolic Functions.
  865. * ctanhfNx: (libc)Hyperbolic Functions.
  866. * ctanhl: (libc)Hyperbolic Functions.
  867. * ctanl: (libc)Trig Functions.
  868. * ctermid: (libc)Identifying the Terminal.
  869. * ctime: (libc)Formatting Calendar Time.
  870. * ctime_r: (libc)Formatting Calendar Time.
  871. * cuserid: (libc)Who Logged In.
  872. * daddl: (libc)Misc FP Arithmetic.
  873. * dcgettext: (libc)Translation with gettext.
  874. * dcngettext: (libc)Advanced gettext functions.
  875. * ddivl: (libc)Misc FP Arithmetic.
  876. * dfmal: (libc)Misc FP Arithmetic.
  877. * dgettext: (libc)Translation with gettext.
  878. * difftime: (libc)Calculating Elapsed Time.
  879. * dirfd: (libc)Opening a Directory.
  880. * dirname: (libc)Finding Tokens in a String.
  881. * div: (libc)Integer Division.
  882. * dlinfo: (libc)Dynamic Linker Introspection.
  883. * dmull: (libc)Misc FP Arithmetic.
  884. * dngettext: (libc)Advanced gettext functions.
  885. * dprintf: (libc)Formatted Output Functions.
  886. * drand48: (libc)SVID Random.
  887. * drand48_r: (libc)SVID Random.
  888. * drem: (libc)Remainder Functions.
  889. * dremf: (libc)Remainder Functions.
  890. * dreml: (libc)Remainder Functions.
  891. * dsqrtl: (libc)Misc FP Arithmetic.
  892. * dsubl: (libc)Misc FP Arithmetic.
  893. * dup2: (libc)Duplicating Descriptors.
  894. * dup3: (libc)Duplicating Descriptors.
  895. * dup: (libc)Duplicating Descriptors.
  896. * ecvt: (libc)System V Number Conversion.
  897. * ecvt_r: (libc)System V Number Conversion.
  898. * endfsent: (libc)fstab.
  899. * endgrent: (libc)Scanning All Groups.
  900. * endhostent: (libc)Host Names.
  901. * endmntent: (libc)mtab.
  902. * endnetent: (libc)Networks Database.
  903. * endnetgrent: (libc)Lookup Netgroup.
  904. * endprotoent: (libc)Protocols Database.
  905. * endpwent: (libc)Scanning All Users.
  906. * endservent: (libc)Services Database.
  907. * endutent: (libc)Manipulating the Database.
  908. * endutxent: (libc)XPG Functions.
  909. * envz_add: (libc)Envz Functions.
  910. * envz_entry: (libc)Envz Functions.
  911. * envz_get: (libc)Envz Functions.
  912. * envz_merge: (libc)Envz Functions.
  913. * envz_remove: (libc)Envz Functions.
  914. * envz_strip: (libc)Envz Functions.
  915. * epoll_create: (libc)Other Low-Level I/O APIs.
  916. * epoll_wait: (libc)Other Low-Level I/O APIs.
  917. * erand48: (libc)SVID Random.
  918. * erand48_r: (libc)SVID Random.
  919. * erf: (libc)Special Functions.
  920. * erfc: (libc)Special Functions.
  921. * erfcf: (libc)Special Functions.
  922. * erfcfN: (libc)Special Functions.
  923. * erfcfNx: (libc)Special Functions.
  924. * erfcl: (libc)Special Functions.
  925. * erff: (libc)Special Functions.
  926. * erffN: (libc)Special Functions.
  927. * erffNx: (libc)Special Functions.
  928. * erfl: (libc)Special Functions.
  929. * err: (libc)Error Messages.
  930. * errno: (libc)Checking for Errors.
  931. * error: (libc)Error Messages.
  932. * error_at_line: (libc)Error Messages.
  933. * errx: (libc)Error Messages.
  934. * execl: (libc)Executing a File.
  935. * execle: (libc)Executing a File.
  936. * execlp: (libc)Executing a File.
  937. * execv: (libc)Executing a File.
  938. * execve: (libc)Executing a File.
  939. * execvp: (libc)Executing a File.
  940. * exit: (libc)Normal Termination.
  941. * exp10: (libc)Exponents and Logarithms.
  942. * exp10f: (libc)Exponents and Logarithms.
  943. * exp10fN: (libc)Exponents and Logarithms.
  944. * exp10fNx: (libc)Exponents and Logarithms.
  945. * exp10l: (libc)Exponents and Logarithms.
  946. * exp10m1: (libc)Exponents and Logarithms.
  947. * exp10m1f: (libc)Exponents and Logarithms.
  948. * exp10m1fN: (libc)Exponents and Logarithms.
  949. * exp10m1fNx: (libc)Exponents and Logarithms.
  950. * exp10m1l: (libc)Exponents and Logarithms.
  951. * exp2: (libc)Exponents and Logarithms.
  952. * exp2f: (libc)Exponents and Logarithms.
  953. * exp2fN: (libc)Exponents and Logarithms.
  954. * exp2fNx: (libc)Exponents and Logarithms.
  955. * exp2l: (libc)Exponents and Logarithms.
  956. * exp2m1: (libc)Exponents and Logarithms.
  957. * exp2m1f: (libc)Exponents and Logarithms.
  958. * exp2m1fN: (libc)Exponents and Logarithms.
  959. * exp2m1fNx: (libc)Exponents and Logarithms.
  960. * exp2m1l: (libc)Exponents and Logarithms.
  961. * exp: (libc)Exponents and Logarithms.
  962. * expf: (libc)Exponents and Logarithms.
  963. * expfN: (libc)Exponents and Logarithms.
  964. * expfNx: (libc)Exponents and Logarithms.
  965. * expl: (libc)Exponents and Logarithms.
  966. * explicit_bzero: (libc)Erasing Sensitive Data.
  967. * expm1: (libc)Exponents and Logarithms.
  968. * expm1f: (libc)Exponents and Logarithms.
  969. * expm1fN: (libc)Exponents and Logarithms.
  970. * expm1fNx: (libc)Exponents and Logarithms.
  971. * expm1l: (libc)Exponents and Logarithms.
  972. * fMaddfN: (libc)Misc FP Arithmetic.
  973. * fMaddfNx: (libc)Misc FP Arithmetic.
  974. * fMdivfN: (libc)Misc FP Arithmetic.
  975. * fMdivfNx: (libc)Misc FP Arithmetic.
  976. * fMfmafN: (libc)Misc FP Arithmetic.
  977. * fMfmafNx: (libc)Misc FP Arithmetic.
  978. * fMmulfN: (libc)Misc FP Arithmetic.
  979. * fMmulfNx: (libc)Misc FP Arithmetic.
  980. * fMsqrtfN: (libc)Misc FP Arithmetic.
  981. * fMsqrtfNx: (libc)Misc FP Arithmetic.
  982. * fMsubfN: (libc)Misc FP Arithmetic.
  983. * fMsubfNx: (libc)Misc FP Arithmetic.
  984. * fMxaddfN: (libc)Misc FP Arithmetic.
  985. * fMxaddfNx: (libc)Misc FP Arithmetic.
  986. * fMxdivfN: (libc)Misc FP Arithmetic.
  987. * fMxdivfNx: (libc)Misc FP Arithmetic.
  988. * fMxfmafN: (libc)Misc FP Arithmetic.
  989. * fMxfmafNx: (libc)Misc FP Arithmetic.
  990. * fMxmulfN: (libc)Misc FP Arithmetic.
  991. * fMxmulfNx: (libc)Misc FP Arithmetic.
  992. * fMxsqrtfN: (libc)Misc FP Arithmetic.
  993. * fMxsqrtfNx: (libc)Misc FP Arithmetic.
  994. * fMxsubfN: (libc)Misc FP Arithmetic.
  995. * fMxsubfNx: (libc)Misc FP Arithmetic.
  996. * fabs: (libc)Absolute Value.
  997. * fabsf: (libc)Absolute Value.
  998. * fabsfN: (libc)Absolute Value.
  999. * fabsfNx: (libc)Absolute Value.
  1000. * fabsl: (libc)Absolute Value.
  1001. * faccessat: (libc)Testing File Access.
  1002. * fadd: (libc)Misc FP Arithmetic.
  1003. * faddl: (libc)Misc FP Arithmetic.
  1004. * fchdir: (libc)Working Directory.
  1005. * fchmod: (libc)Setting Permissions.
  1006. * fchown: (libc)File Owner.
  1007. * fclose: (libc)Closing Streams.
  1008. * fcloseall: (libc)Closing Streams.
  1009. * fcntl: (libc)Control Operations.
  1010. * fcvt: (libc)System V Number Conversion.
  1011. * fcvt_r: (libc)System V Number Conversion.
  1012. * fdatasync: (libc)Synchronizing I/O.
  1013. * fdim: (libc)Misc FP Arithmetic.
  1014. * fdimf: (libc)Misc FP Arithmetic.
  1015. * fdimfN: (libc)Misc FP Arithmetic.
  1016. * fdimfNx: (libc)Misc FP Arithmetic.
  1017. * fdiml: (libc)Misc FP Arithmetic.
  1018. * fdiv: (libc)Misc FP Arithmetic.
  1019. * fdivl: (libc)Misc FP Arithmetic.
  1020. * fdopen: (libc)Descriptors and Streams.
  1021. * fdopendir: (libc)Opening a Directory.
  1022. * feclearexcept: (libc)Status bit operations.
  1023. * fedisableexcept: (libc)Control Functions.
  1024. * feenableexcept: (libc)Control Functions.
  1025. * fegetenv: (libc)Control Functions.
  1026. * fegetexcept: (libc)Control Functions.
  1027. * fegetexceptflag: (libc)Status bit operations.
  1028. * fegetmode: (libc)Control Functions.
  1029. * fegetround: (libc)Rounding.
  1030. * feholdexcept: (libc)Control Functions.
  1031. * feof: (libc)EOF and Errors.
  1032. * feof_unlocked: (libc)EOF and Errors.
  1033. * feraiseexcept: (libc)Status bit operations.
  1034. * ferror: (libc)EOF and Errors.
  1035. * ferror_unlocked: (libc)EOF and Errors.
  1036. * fesetenv: (libc)Control Functions.
  1037. * fesetexcept: (libc)Status bit operations.
  1038. * fesetexceptflag: (libc)Status bit operations.
  1039. * fesetmode: (libc)Control Functions.
  1040. * fesetround: (libc)Rounding.
  1041. * fetestexcept: (libc)Status bit operations.
  1042. * fetestexceptflag: (libc)Status bit operations.
  1043. * feupdateenv: (libc)Control Functions.
  1044. * fexecve: (libc)Executing a File.
  1045. * fflush: (libc)Flushing Buffers.
  1046. * fflush_unlocked: (libc)Flushing Buffers.
  1047. * ffma: (libc)Misc FP Arithmetic.
  1048. * ffmal: (libc)Misc FP Arithmetic.
  1049. * fgetc: (libc)Character Input.
  1050. * fgetc_unlocked: (libc)Character Input.
  1051. * fgetgrent: (libc)Scanning All Groups.
  1052. * fgetgrent_r: (libc)Scanning All Groups.
  1053. * fgetpos64: (libc)Portable Positioning.
  1054. * fgetpos: (libc)Portable Positioning.
  1055. * fgetpwent: (libc)Scanning All Users.
  1056. * fgetpwent_r: (libc)Scanning All Users.
  1057. * fgets: (libc)Line Input.
  1058. * fgets_unlocked: (libc)Line Input.
  1059. * fgetwc: (libc)Character Input.
  1060. * fgetwc_unlocked: (libc)Character Input.
  1061. * fgetws: (libc)Line Input.
  1062. * fgetws_unlocked: (libc)Line Input.
  1063. * fileno: (libc)Descriptors and Streams.
  1064. * fileno_unlocked: (libc)Descriptors and Streams.
  1065. * finite: (libc)Floating Point Classes.
  1066. * finitef: (libc)Floating Point Classes.
  1067. * finitel: (libc)Floating Point Classes.
  1068. * flockfile: (libc)Streams and Threads.
  1069. * floor: (libc)Rounding Functions.
  1070. * floorf: (libc)Rounding Functions.
  1071. * floorfN: (libc)Rounding Functions.
  1072. * floorfNx: (libc)Rounding Functions.
  1073. * floorl: (libc)Rounding Functions.
  1074. * fma: (libc)Misc FP Arithmetic.
  1075. * fmaf: (libc)Misc FP Arithmetic.
  1076. * fmafN: (libc)Misc FP Arithmetic.
  1077. * fmafNx: (libc)Misc FP Arithmetic.
  1078. * fmal: (libc)Misc FP Arithmetic.
  1079. * fmax: (libc)Misc FP Arithmetic.
  1080. * fmaxf: (libc)Misc FP Arithmetic.
  1081. * fmaxfN: (libc)Misc FP Arithmetic.
  1082. * fmaxfNx: (libc)Misc FP Arithmetic.
  1083. * fmaximum: (libc)Misc FP Arithmetic.
  1084. * fmaximum_mag: (libc)Misc FP Arithmetic.
  1085. * fmaximum_mag_num: (libc)Misc FP Arithmetic.
  1086. * fmaximum_mag_numf: (libc)Misc FP Arithmetic.
  1087. * fmaximum_mag_numfN: (libc)Misc FP Arithmetic.
  1088. * fmaximum_mag_numfNx: (libc)Misc FP Arithmetic.
  1089. * fmaximum_mag_numl: (libc)Misc FP Arithmetic.
  1090. * fmaximum_magf: (libc)Misc FP Arithmetic.
  1091. * fmaximum_magfN: (libc)Misc FP Arithmetic.
  1092. * fmaximum_magfNx: (libc)Misc FP Arithmetic.
  1093. * fmaximum_magl: (libc)Misc FP Arithmetic.
  1094. * fmaximum_num: (libc)Misc FP Arithmetic.
  1095. * fmaximum_numf: (libc)Misc FP Arithmetic.
  1096. * fmaximum_numfN: (libc)Misc FP Arithmetic.
  1097. * fmaximum_numfNx: (libc)Misc FP Arithmetic.
  1098. * fmaximum_numl: (libc)Misc FP Arithmetic.
  1099. * fmaximumf: (libc)Misc FP Arithmetic.
  1100. * fmaximumfN: (libc)Misc FP Arithmetic.
  1101. * fmaximumfNx: (libc)Misc FP Arithmetic.
  1102. * fmaximuml: (libc)Misc FP Arithmetic.
  1103. * fmaxl: (libc)Misc FP Arithmetic.
  1104. * fmaxmag: (libc)Misc FP Arithmetic.
  1105. * fmaxmagf: (libc)Misc FP Arithmetic.
  1106. * fmaxmagfN: (libc)Misc FP Arithmetic.
  1107. * fmaxmagfNx: (libc)Misc FP Arithmetic.
  1108. * fmaxmagl: (libc)Misc FP Arithmetic.
  1109. * fmemopen: (libc)String Streams.
  1110. * fmin: (libc)Misc FP Arithmetic.
  1111. * fminf: (libc)Misc FP Arithmetic.
  1112. * fminfN: (libc)Misc FP Arithmetic.
  1113. * fminfNx: (libc)Misc FP Arithmetic.
  1114. * fminimum: (libc)Misc FP Arithmetic.
  1115. * fminimum_mag: (libc)Misc FP Arithmetic.
  1116. * fminimum_mag_num: (libc)Misc FP Arithmetic.
  1117. * fminimum_mag_numf: (libc)Misc FP Arithmetic.
  1118. * fminimum_mag_numfN: (libc)Misc FP Arithmetic.
  1119. * fminimum_mag_numfNx: (libc)Misc FP Arithmetic.
  1120. * fminimum_mag_numl: (libc)Misc FP Arithmetic.
  1121. * fminimum_magf: (libc)Misc FP Arithmetic.
  1122. * fminimum_magfN: (libc)Misc FP Arithmetic.
  1123. * fminimum_magfNx: (libc)Misc FP Arithmetic.
  1124. * fminimum_magl: (libc)Misc FP Arithmetic.
  1125. * fminimum_num: (libc)Misc FP Arithmetic.
  1126. * fminimum_numf: (libc)Misc FP Arithmetic.
  1127. * fminimum_numfN: (libc)Misc FP Arithmetic.
  1128. * fminimum_numfNx: (libc)Misc FP Arithmetic.
  1129. * fminimum_numl: (libc)Misc FP Arithmetic.
  1130. * fminimumf: (libc)Misc FP Arithmetic.
  1131. * fminimumfN: (libc)Misc FP Arithmetic.
  1132. * fminimumfNx: (libc)Misc FP Arithmetic.
  1133. * fminimuml: (libc)Misc FP Arithmetic.
  1134. * fminl: (libc)Misc FP Arithmetic.
  1135. * fminmag: (libc)Misc FP Arithmetic.
  1136. * fminmagf: (libc)Misc FP Arithmetic.
  1137. * fminmagfN: (libc)Misc FP Arithmetic.
  1138. * fminmagfNx: (libc)Misc FP Arithmetic.
  1139. * fminmagl: (libc)Misc FP Arithmetic.
  1140. * fmod: (libc)Remainder Functions.
  1141. * fmodf: (libc)Remainder Functions.
  1142. * fmodfN: (libc)Remainder Functions.
  1143. * fmodfNx: (libc)Remainder Functions.
  1144. * fmodl: (libc)Remainder Functions.
  1145. * fmtmsg: (libc)Printing Formatted Messages.
  1146. * fmul: (libc)Misc FP Arithmetic.
  1147. * fmull: (libc)Misc FP Arithmetic.
  1148. * fnmatch: (libc)Wildcard Matching.
  1149. * fopen64: (libc)Opening Streams.
  1150. * fopen: (libc)Opening Streams.
  1151. * fopencookie: (libc)Streams and Cookies.
  1152. * fork: (libc)Creating a Process.
  1153. * forkpty: (libc)Pseudo-Terminal Pairs.
  1154. * fpathconf: (libc)Pathconf.
  1155. * fpclassify: (libc)Floating Point Classes.
  1156. * fprintf: (libc)Formatted Output Functions.
  1157. * fputc: (libc)Simple Output.
  1158. * fputc_unlocked: (libc)Simple Output.
  1159. * fputs: (libc)Simple Output.
  1160. * fputs_unlocked: (libc)Simple Output.
  1161. * fputwc: (libc)Simple Output.
  1162. * fputwc_unlocked: (libc)Simple Output.
  1163. * fputws: (libc)Simple Output.
  1164. * fputws_unlocked: (libc)Simple Output.
  1165. * fread: (libc)Block Input/Output.
  1166. * fread_unlocked: (libc)Block Input/Output.
  1167. * free: (libc)Freeing after Malloc.
  1168. * free_aligned_sized: (libc)Freeing after Malloc.
  1169. * free_sized: (libc)Freeing after Malloc.
  1170. * freopen64: (libc)Opening Streams.
  1171. * freopen: (libc)Opening Streams.
  1172. * frexp: (libc)Normalization Functions.
  1173. * frexpf: (libc)Normalization Functions.
  1174. * frexpfN: (libc)Normalization Functions.
  1175. * frexpfNx: (libc)Normalization Functions.
  1176. * frexpl: (libc)Normalization Functions.
  1177. * fromfp: (libc)Rounding Functions.
  1178. * fromfpf: (libc)Rounding Functions.
  1179. * fromfpfN: (libc)Rounding Functions.
  1180. * fromfpfNx: (libc)Rounding Functions.
  1181. * fromfpl: (libc)Rounding Functions.
  1182. * fromfpx: (libc)Rounding Functions.
  1183. * fromfpxf: (libc)Rounding Functions.
  1184. * fromfpxfN: (libc)Rounding Functions.
  1185. * fromfpxfNx: (libc)Rounding Functions.
  1186. * fromfpxl: (libc)Rounding Functions.
  1187. * fscanf: (libc)Formatted Input Functions.
  1188. * fseek: (libc)File Positioning.
  1189. * fseeko64: (libc)File Positioning.
  1190. * fseeko: (libc)File Positioning.
  1191. * fsetpos64: (libc)Portable Positioning.
  1192. * fsetpos: (libc)Portable Positioning.
  1193. * fsqrt: (libc)Misc FP Arithmetic.
  1194. * fsqrtl: (libc)Misc FP Arithmetic.
  1195. * fstat64: (libc)Reading Attributes.
  1196. * fstat: (libc)Reading Attributes.
  1197. * fstatat64: (libc)Reading Attributes.
  1198. * fstatat: (libc)Reading Attributes.
  1199. * fsub: (libc)Misc FP Arithmetic.
  1200. * fsubl: (libc)Misc FP Arithmetic.
  1201. * fsync: (libc)Synchronizing I/O.
  1202. * ftell: (libc)File Positioning.
  1203. * ftello64: (libc)File Positioning.
  1204. * ftello: (libc)File Positioning.
  1205. * ftruncate64: (libc)File Size.
  1206. * ftruncate: (libc)File Size.
  1207. * ftrylockfile: (libc)Streams and Threads.
  1208. * ftw64: (libc)Working with Directory Trees.
  1209. * ftw: (libc)Working with Directory Trees.
  1210. * funlockfile: (libc)Streams and Threads.
  1211. * futimens: (libc)File Times.
  1212. * futimes: (libc)File Times.
  1213. * fwide: (libc)Streams and I18N.
  1214. * fwprintf: (libc)Formatted Output Functions.
  1215. * fwrite: (libc)Block Input/Output.
  1216. * fwrite_unlocked: (libc)Block Input/Output.
  1217. * fwscanf: (libc)Formatted Input Functions.
  1218. * gamma: (libc)Special Functions.
  1219. * gammaf: (libc)Special Functions.
  1220. * gammal: (libc)Special Functions.
  1221. * gcvt: (libc)System V Number Conversion.
  1222. * get_avphys_pages: (libc)Query Memory Parameters.
  1223. * get_current_dir_name: (libc)Working Directory.
  1224. * get_nprocs: (libc)Processor Resources.
  1225. * get_nprocs_conf: (libc)Processor Resources.
  1226. * get_phys_pages: (libc)Query Memory Parameters.
  1227. * getauxval: (libc)Auxiliary Vector.
  1228. * getc: (libc)Character Input.
  1229. * getc_unlocked: (libc)Character Input.
  1230. * getchar: (libc)Character Input.
  1231. * getchar_unlocked: (libc)Character Input.
  1232. * getcontext: (libc)System V contexts.
  1233. * getcpu: (libc)CPU Affinity.
  1234. * getcwd: (libc)Working Directory.
  1235. * getdate: (libc)General Time String Parsing.
  1236. * getdate_r: (libc)General Time String Parsing.
  1237. * getdelim: (libc)Line Input.
  1238. * getdents64: (libc)Low-level Directory Access.
  1239. * getdomainname: (libc)Host Identification.
  1240. * getegid: (libc)Reading Persona.
  1241. * getentropy: (libc)Unpredictable Bytes.
  1242. * getenv: (libc)Environment Access.
  1243. * geteuid: (libc)Reading Persona.
  1244. * getfsent: (libc)fstab.
  1245. * getfsfile: (libc)fstab.
  1246. * getfsspec: (libc)fstab.
  1247. * getgid: (libc)Reading Persona.
  1248. * getgrent: (libc)Scanning All Groups.
  1249. * getgrent_r: (libc)Scanning All Groups.
  1250. * getgrgid: (libc)Lookup Group.
  1251. * getgrgid_r: (libc)Lookup Group.
  1252. * getgrnam: (libc)Lookup Group.
  1253. * getgrnam_r: (libc)Lookup Group.
  1254. * getgrouplist: (libc)Setting Groups.
  1255. * getgroups: (libc)Reading Persona.
  1256. * gethostbyaddr: (libc)Host Names.
  1257. * gethostbyaddr_r: (libc)Host Names.
  1258. * gethostbyname2: (libc)Host Names.
  1259. * gethostbyname2_r: (libc)Host Names.
  1260. * gethostbyname: (libc)Host Names.
  1261. * gethostbyname_r: (libc)Host Names.
  1262. * gethostent: (libc)Host Names.
  1263. * gethostid: (libc)Host Identification.
  1264. * gethostname: (libc)Host Identification.
  1265. * getitimer: (libc)Setting an Alarm.
  1266. * getline: (libc)Line Input.
  1267. * getloadavg: (libc)Processor Resources.
  1268. * getlogin: (libc)Who Logged In.
  1269. * getmntent: (libc)mtab.
  1270. * getmntent_r: (libc)mtab.
  1271. * getnetbyaddr: (libc)Networks Database.
  1272. * getnetbyname: (libc)Networks Database.
  1273. * getnetent: (libc)Networks Database.
  1274. * getnetgrent: (libc)Lookup Netgroup.
  1275. * getnetgrent_r: (libc)Lookup Netgroup.
  1276. * getopt: (libc)Using Getopt.
  1277. * getopt_long: (libc)Getopt Long Options.
  1278. * getopt_long_only: (libc)Getopt Long Options.
  1279. * getpagesize: (libc)Query Memory Parameters.
  1280. * getpass: (libc)getpass.
  1281. * getpayload: (libc)FP Bit Twiddling.
  1282. * getpayloadf: (libc)FP Bit Twiddling.
  1283. * getpayloadfN: (libc)FP Bit Twiddling.
  1284. * getpayloadfNx: (libc)FP Bit Twiddling.
  1285. * getpayloadl: (libc)FP Bit Twiddling.
  1286. * getpeername: (libc)Who is Connected.
  1287. * getpgid: (libc)Process Group Functions.
  1288. * getpgrp: (libc)Process Group Functions.
  1289. * getpid: (libc)Process Identification.
  1290. * getppid: (libc)Process Identification.
  1291. * getpriority: (libc)Traditional Scheduling Functions.
  1292. * getprotobyname: (libc)Protocols Database.
  1293. * getprotobynumber: (libc)Protocols Database.
  1294. * getprotoent: (libc)Protocols Database.
  1295. * getpt: (libc)Allocation.
  1296. * getpwent: (libc)Scanning All Users.
  1297. * getpwent_r: (libc)Scanning All Users.
  1298. * getpwnam: (libc)Lookup User.
  1299. * getpwnam_r: (libc)Lookup User.
  1300. * getpwuid: (libc)Lookup User.
  1301. * getpwuid_r: (libc)Lookup User.
  1302. * getrandom: (libc)Unpredictable Bytes.
  1303. * getrlimit64: (libc)Limits on Resources.
  1304. * getrlimit: (libc)Limits on Resources.
  1305. * getrusage: (libc)Resource Usage.
  1306. * gets: (libc)Line Input.
  1307. * getservbyname: (libc)Services Database.
  1308. * getservbyport: (libc)Services Database.
  1309. * getservent: (libc)Services Database.
  1310. * getsid: (libc)Process Group Functions.
  1311. * getsockname: (libc)Reading Address.
  1312. * getsockopt: (libc)Socket Option Functions.
  1313. * getsubopt: (libc)Suboptions.
  1314. * gettext: (libc)Translation with gettext.
  1315. * gettid: (libc)Process Identification.
  1316. * gettimeofday: (libc)Getting the Time.
  1317. * getuid: (libc)Reading Persona.
  1318. * getumask: (libc)Setting Permissions.
  1319. * getutent: (libc)Manipulating the Database.
  1320. * getutent_r: (libc)Manipulating the Database.
  1321. * getutid: (libc)Manipulating the Database.
  1322. * getutid_r: (libc)Manipulating the Database.
  1323. * getutline: (libc)Manipulating the Database.
  1324. * getutline_r: (libc)Manipulating the Database.
  1325. * getutmp: (libc)XPG Functions.
  1326. * getutmpx: (libc)XPG Functions.
  1327. * getutxent: (libc)XPG Functions.
  1328. * getutxid: (libc)XPG Functions.
  1329. * getutxline: (libc)XPG Functions.
  1330. * getw: (libc)Character Input.
  1331. * getwc: (libc)Character Input.
  1332. * getwc_unlocked: (libc)Character Input.
  1333. * getwchar: (libc)Character Input.
  1334. * getwchar_unlocked: (libc)Character Input.
  1335. * getwd: (libc)Working Directory.
  1336. * glob64: (libc)Calling Glob.
  1337. * glob: (libc)Calling Glob.
  1338. * globfree64: (libc)More Flags for Globbing.
  1339. * globfree: (libc)More Flags for Globbing.
  1340. * gmtime: (libc)Broken-down Time.
  1341. * gmtime_r: (libc)Broken-down Time.
  1342. * grantpt: (libc)Allocation.
  1343. * gsignal: (libc)Signaling Yourself.
  1344. * gtty: (libc)BSD Terminal Modes.
  1345. * hasmntopt: (libc)mtab.
  1346. * hcreate: (libc)Hash Search Function.
  1347. * hcreate_r: (libc)Hash Search Function.
  1348. * hdestroy: (libc)Hash Search Function.
  1349. * hdestroy_r: (libc)Hash Search Function.
  1350. * hsearch: (libc)Hash Search Function.
  1351. * hsearch_r: (libc)Hash Search Function.
  1352. * htonl: (libc)Byte Order.
  1353. * htons: (libc)Byte Order.
  1354. * hypot: (libc)Exponents and Logarithms.
  1355. * hypotf: (libc)Exponents and Logarithms.
  1356. * hypotfN: (libc)Exponents and Logarithms.
  1357. * hypotfNx: (libc)Exponents and Logarithms.
  1358. * hypotl: (libc)Exponents and Logarithms.
  1359. * iconv: (libc)Generic Conversion Interface.
  1360. * iconv_close: (libc)Generic Conversion Interface.
  1361. * iconv_open: (libc)Generic Conversion Interface.
  1362. * if_freenameindex: (libc)Interface Naming.
  1363. * if_indextoname: (libc)Interface Naming.
  1364. * if_nameindex: (libc)Interface Naming.
  1365. * if_nametoindex: (libc)Interface Naming.
  1366. * ilogb: (libc)Exponents and Logarithms.
  1367. * ilogbf: (libc)Exponents and Logarithms.
  1368. * ilogbfN: (libc)Exponents and Logarithms.
  1369. * ilogbfNx: (libc)Exponents and Logarithms.
  1370. * ilogbl: (libc)Exponents and Logarithms.
  1371. * imaxabs: (libc)Absolute Value.
  1372. * imaxdiv: (libc)Integer Division.
  1373. * in6addr_any: (libc)Host Address Data Type.
  1374. * in6addr_loopback: (libc)Host Address Data Type.
  1375. * index: (libc)Search Functions.
  1376. * inet_addr: (libc)Host Address Functions.
  1377. * inet_aton: (libc)Host Address Functions.
  1378. * inet_lnaof: (libc)Host Address Functions.
  1379. * inet_makeaddr: (libc)Host Address Functions.
  1380. * inet_netof: (libc)Host Address Functions.
  1381. * inet_network: (libc)Host Address Functions.
  1382. * inet_ntoa: (libc)Host Address Functions.
  1383. * inet_ntop: (libc)Host Address Functions.
  1384. * inet_pton: (libc)Host Address Functions.
  1385. * initgroups: (libc)Setting Groups.
  1386. * initstate: (libc)BSD Random.
  1387. * initstate_r: (libc)BSD Random.
  1388. * innetgr: (libc)Netgroup Membership.
  1389. * ioctl: (libc)IOCTLs.
  1390. * isalnum: (libc)Classification of Characters.
  1391. * isalpha: (libc)Classification of Characters.
  1392. * isascii: (libc)Classification of Characters.
  1393. * isatty: (libc)Is It a Terminal.
  1394. * isblank: (libc)Classification of Characters.
  1395. * iscanonical: (libc)Floating Point Classes.
  1396. * iscntrl: (libc)Classification of Characters.
  1397. * isdigit: (libc)Classification of Characters.
  1398. * iseqsig: (libc)FP Comparison Functions.
  1399. * isfinite: (libc)Floating Point Classes.
  1400. * isgraph: (libc)Classification of Characters.
  1401. * isgreater: (libc)FP Comparison Functions.
  1402. * isgreaterequal: (libc)FP Comparison Functions.
  1403. * isinf: (libc)Floating Point Classes.
  1404. * isinff: (libc)Floating Point Classes.
  1405. * isinfl: (libc)Floating Point Classes.
  1406. * isless: (libc)FP Comparison Functions.
  1407. * islessequal: (libc)FP Comparison Functions.
  1408. * islessgreater: (libc)FP Comparison Functions.
  1409. * islower: (libc)Classification of Characters.
  1410. * isnan: (libc)Floating Point Classes.
  1411. * isnan: (libc)Floating Point Classes.
  1412. * isnanf: (libc)Floating Point Classes.
  1413. * isnanl: (libc)Floating Point Classes.
  1414. * isnormal: (libc)Floating Point Classes.
  1415. * isprint: (libc)Classification of Characters.
  1416. * ispunct: (libc)Classification of Characters.
  1417. * issignaling: (libc)Floating Point Classes.
  1418. * isspace: (libc)Classification of Characters.
  1419. * issubnormal: (libc)Floating Point Classes.
  1420. * isunordered: (libc)FP Comparison Functions.
  1421. * isupper: (libc)Classification of Characters.
  1422. * iswalnum: (libc)Classification of Wide Characters.
  1423. * iswalpha: (libc)Classification of Wide Characters.
  1424. * iswblank: (libc)Classification of Wide Characters.
  1425. * iswcntrl: (libc)Classification of Wide Characters.
  1426. * iswctype: (libc)Classification of Wide Characters.
  1427. * iswdigit: (libc)Classification of Wide Characters.
  1428. * iswgraph: (libc)Classification of Wide Characters.
  1429. * iswlower: (libc)Classification of Wide Characters.
  1430. * iswprint: (libc)Classification of Wide Characters.
  1431. * iswpunct: (libc)Classification of Wide Characters.
  1432. * iswspace: (libc)Classification of Wide Characters.
  1433. * iswupper: (libc)Classification of Wide Characters.
  1434. * iswxdigit: (libc)Classification of Wide Characters.
  1435. * isxdigit: (libc)Classification of Characters.
  1436. * iszero: (libc)Floating Point Classes.
  1437. * j0: (libc)Special Functions.
  1438. * j0f: (libc)Special Functions.
  1439. * j0fN: (libc)Special Functions.
  1440. * j0fNx: (libc)Special Functions.
  1441. * j0l: (libc)Special Functions.
  1442. * j1: (libc)Special Functions.
  1443. * j1f: (libc)Special Functions.
  1444. * j1fN: (libc)Special Functions.
  1445. * j1fNx: (libc)Special Functions.
  1446. * j1l: (libc)Special Functions.
  1447. * jn: (libc)Special Functions.
  1448. * jnf: (libc)Special Functions.
  1449. * jnfN: (libc)Special Functions.
  1450. * jnfNx: (libc)Special Functions.
  1451. * jnl: (libc)Special Functions.
  1452. * jrand48: (libc)SVID Random.
  1453. * jrand48_r: (libc)SVID Random.
  1454. * kill: (libc)Signaling Another Process.
  1455. * killpg: (libc)Signaling Another Process.
  1456. * l64a: (libc)Encode Binary Data.
  1457. * labs: (libc)Absolute Value.
  1458. * lcong48: (libc)SVID Random.
  1459. * lcong48_r: (libc)SVID Random.
  1460. * ldexp: (libc)Normalization Functions.
  1461. * ldexpf: (libc)Normalization Functions.
  1462. * ldexpfN: (libc)Normalization Functions.
  1463. * ldexpfNx: (libc)Normalization Functions.
  1464. * ldexpl: (libc)Normalization Functions.
  1465. * ldiv: (libc)Integer Division.
  1466. * lfind: (libc)Array Search Function.
  1467. * lgamma: (libc)Special Functions.
  1468. * lgamma_r: (libc)Special Functions.
  1469. * lgammaf: (libc)Special Functions.
  1470. * lgammafN: (libc)Special Functions.
  1471. * lgammafN_r: (libc)Special Functions.
  1472. * lgammafNx: (libc)Special Functions.
  1473. * lgammafNx_r: (libc)Special Functions.
  1474. * lgammaf_r: (libc)Special Functions.
  1475. * lgammal: (libc)Special Functions.
  1476. * lgammal_r: (libc)Special Functions.
  1477. * link: (libc)Hard Links.
  1478. * linkat: (libc)Hard Links.
  1479. * lio_listio64: (libc)Asynchronous Reads/Writes.
  1480. * lio_listio: (libc)Asynchronous Reads/Writes.
  1481. * listen: (libc)Listening.
  1482. * llabs: (libc)Absolute Value.
  1483. * lldiv: (libc)Integer Division.
  1484. * llogb: (libc)Exponents and Logarithms.
  1485. * llogbf: (libc)Exponents and Logarithms.
  1486. * llogbfN: (libc)Exponents and Logarithms.
  1487. * llogbfNx: (libc)Exponents and Logarithms.
  1488. * llogbl: (libc)Exponents and Logarithms.
  1489. * llrint: (libc)Rounding Functions.
  1490. * llrintf: (libc)Rounding Functions.
  1491. * llrintfN: (libc)Rounding Functions.
  1492. * llrintfNx: (libc)Rounding Functions.
  1493. * llrintl: (libc)Rounding Functions.
  1494. * llround: (libc)Rounding Functions.
  1495. * llroundf: (libc)Rounding Functions.
  1496. * llroundfN: (libc)Rounding Functions.
  1497. * llroundfNx: (libc)Rounding Functions.
  1498. * llroundl: (libc)Rounding Functions.
  1499. * localeconv: (libc)The Lame Way to Locale Data.
  1500. * localtime: (libc)Broken-down Time.
  1501. * localtime_r: (libc)Broken-down Time.
  1502. * log10: (libc)Exponents and Logarithms.
  1503. * log10f: (libc)Exponents and Logarithms.
  1504. * log10fN: (libc)Exponents and Logarithms.
  1505. * log10fNx: (libc)Exponents and Logarithms.
  1506. * log10l: (libc)Exponents and Logarithms.
  1507. * log10p1: (libc)Exponents and Logarithms.
  1508. * log10p1f: (libc)Exponents and Logarithms.
  1509. * log10p1fN: (libc)Exponents and Logarithms.
  1510. * log10p1fNx: (libc)Exponents and Logarithms.
  1511. * log10p1l: (libc)Exponents and Logarithms.
  1512. * log1p: (libc)Exponents and Logarithms.
  1513. * log1pf: (libc)Exponents and Logarithms.
  1514. * log1pfN: (libc)Exponents and Logarithms.
  1515. * log1pfNx: (libc)Exponents and Logarithms.
  1516. * log1pl: (libc)Exponents and Logarithms.
  1517. * log2: (libc)Exponents and Logarithms.
  1518. * log2f: (libc)Exponents and Logarithms.
  1519. * log2fN: (libc)Exponents and Logarithms.
  1520. * log2fNx: (libc)Exponents and Logarithms.
  1521. * log2l: (libc)Exponents and Logarithms.
  1522. * log2p1: (libc)Exponents and Logarithms.
  1523. * log2p1f: (libc)Exponents and Logarithms.
  1524. * log2p1fN: (libc)Exponents and Logarithms.
  1525. * log2p1fNx: (libc)Exponents and Logarithms.
  1526. * log2p1l: (libc)Exponents and Logarithms.
  1527. * log: (libc)Exponents and Logarithms.
  1528. * logb: (libc)Exponents and Logarithms.
  1529. * logbf: (libc)Exponents and Logarithms.
  1530. * logbfN: (libc)Exponents and Logarithms.
  1531. * logbfNx: (libc)Exponents and Logarithms.
  1532. * logbl: (libc)Exponents and Logarithms.
  1533. * logf: (libc)Exponents and Logarithms.
  1534. * logfN: (libc)Exponents and Logarithms.
  1535. * logfNx: (libc)Exponents and Logarithms.
  1536. * login: (libc)Logging In and Out.
  1537. * login_tty: (libc)Logging In and Out.
  1538. * logl: (libc)Exponents and Logarithms.
  1539. * logout: (libc)Logging In and Out.
  1540. * logp1: (libc)Exponents and Logarithms.
  1541. * logp1f: (libc)Exponents and Logarithms.
  1542. * logp1fN: (libc)Exponents and Logarithms.
  1543. * logp1fNx: (libc)Exponents and Logarithms.
  1544. * logp1l: (libc)Exponents and Logarithms.
  1545. * logwtmp: (libc)Logging In and Out.
  1546. * longjmp: (libc)Non-Local Details.
  1547. * lrand48: (libc)SVID Random.
  1548. * lrand48_r: (libc)SVID Random.
  1549. * lrint: (libc)Rounding Functions.
  1550. * lrintf: (libc)Rounding Functions.
  1551. * lrintfN: (libc)Rounding Functions.
  1552. * lrintfNx: (libc)Rounding Functions.
  1553. * lrintl: (libc)Rounding Functions.
  1554. * lround: (libc)Rounding Functions.
  1555. * lroundf: (libc)Rounding Functions.
  1556. * lroundfN: (libc)Rounding Functions.
  1557. * lroundfNx: (libc)Rounding Functions.
  1558. * lroundl: (libc)Rounding Functions.
  1559. * lsearch: (libc)Array Search Function.
  1560. * lseek64: (libc)File Position Primitive.
  1561. * lseek: (libc)File Position Primitive.
  1562. * lstat64: (libc)Reading Attributes.
  1563. * lstat: (libc)Reading Attributes.
  1564. * lutimes: (libc)File Times.
  1565. * madvise: (libc)Memory-mapped I/O.
  1566. * makecontext: (libc)System V contexts.
  1567. * mallinfo2: (libc)Statistics of Malloc.
  1568. * malloc: (libc)Basic Allocation.
  1569. * mallopt: (libc)Malloc Tunable Parameters.
  1570. * mblen: (libc)Non-reentrant Character Conversion.
  1571. * mbrlen: (libc)Converting a Character.
  1572. * mbrtowc: (libc)Converting a Character.
  1573. * mbsinit: (libc)Keeping the state.
  1574. * mbsnrtowcs: (libc)Converting Strings.
  1575. * mbsrtowcs: (libc)Converting Strings.
  1576. * mbstowcs: (libc)Non-reentrant String Conversion.
  1577. * mbtowc: (libc)Non-reentrant Character Conversion.
  1578. * mcheck: (libc)Heap Consistency Checking.
  1579. * memalign: (libc)Aligned Memory Blocks.
  1580. * memalignment: (libc)Aligned Memory Blocks.
  1581. * memccpy: (libc)Copying Strings and Arrays.
  1582. * memchr: (libc)Search Functions.
  1583. * memcmp: (libc)String/Array Comparison.
  1584. * memcpy: (libc)Copying Strings and Arrays.
  1585. * memfd_create: (libc)Memory-mapped I/O.
  1586. * memfrob: (libc)Obfuscating Data.
  1587. * memmem: (libc)Search Functions.
  1588. * memmove: (libc)Copying Strings and Arrays.
  1589. * mempcpy: (libc)Copying Strings and Arrays.
  1590. * memrchr: (libc)Search Functions.
  1591. * memset: (libc)Copying Strings and Arrays.
  1592. * memset_explicit: (libc)Erasing Sensitive Data.
  1593. * mkdir: (libc)Creating Directories.
  1594. * mkdirat: (libc)Creating Directories.
  1595. * mkdtemp: (libc)Temporary Files.
  1596. * mkfifo: (libc)FIFO Special Files.
  1597. * mknod: (libc)Making Special Files.
  1598. * mkstemp: (libc)Temporary Files.
  1599. * mktemp: (libc)Temporary Files.
  1600. * mktime: (libc)Broken-down Time.
  1601. * mlock2: (libc)Page Lock Functions.
  1602. * mlock: (libc)Page Lock Functions.
  1603. * mlockall: (libc)Page Lock Functions.
  1604. * mmap64: (libc)Memory-mapped I/O.
  1605. * mmap: (libc)Memory-mapped I/O.
  1606. * modf: (libc)Rounding Functions.
  1607. * modff: (libc)Rounding Functions.
  1608. * modffN: (libc)Rounding Functions.
  1609. * modffNx: (libc)Rounding Functions.
  1610. * modfl: (libc)Rounding Functions.
  1611. * mount: (libc)Mount-Unmount-Remount.
  1612. * mprobe: (libc)Heap Consistency Checking.
  1613. * mprotect: (libc)Memory Protection.
  1614. * mrand48: (libc)SVID Random.
  1615. * mrand48_r: (libc)SVID Random.
  1616. * mremap: (libc)Memory-mapped I/O.
  1617. * mseal: (libc)Memory Protection.
  1618. * msync: (libc)Memory-mapped I/O.
  1619. * mtrace: (libc)Tracing malloc.
  1620. * mtx_destroy: (libc)ISO C Mutexes.
  1621. * mtx_init: (libc)ISO C Mutexes.
  1622. * mtx_lock: (libc)ISO C Mutexes.
  1623. * mtx_timedlock: (libc)ISO C Mutexes.
  1624. * mtx_trylock: (libc)ISO C Mutexes.
  1625. * mtx_unlock: (libc)ISO C Mutexes.
  1626. * munlock: (libc)Page Lock Functions.
  1627. * munlockall: (libc)Page Lock Functions.
  1628. * munmap: (libc)Memory-mapped I/O.
  1629. * muntrace: (libc)Tracing malloc.
  1630. * nan: (libc)FP Bit Twiddling.
  1631. * nanf: (libc)FP Bit Twiddling.
  1632. * nanfN: (libc)FP Bit Twiddling.
  1633. * nanfNx: (libc)FP Bit Twiddling.
  1634. * nanl: (libc)FP Bit Twiddling.
  1635. * nanosleep: (libc)Sleeping.
  1636. * nearbyint: (libc)Rounding Functions.
  1637. * nearbyintf: (libc)Rounding Functions.
  1638. * nearbyintfN: (libc)Rounding Functions.
  1639. * nearbyintfNx: (libc)Rounding Functions.
  1640. * nearbyintl: (libc)Rounding Functions.
  1641. * nextafter: (libc)FP Bit Twiddling.
  1642. * nextafterf: (libc)FP Bit Twiddling.
  1643. * nextafterfN: (libc)FP Bit Twiddling.
  1644. * nextafterfNx: (libc)FP Bit Twiddling.
  1645. * nextafterl: (libc)FP Bit Twiddling.
  1646. * nextdown: (libc)FP Bit Twiddling.
  1647. * nextdownf: (libc)FP Bit Twiddling.
  1648. * nextdownfN: (libc)FP Bit Twiddling.
  1649. * nextdownfNx: (libc)FP Bit Twiddling.
  1650. * nextdownl: (libc)FP Bit Twiddling.
  1651. * nexttoward: (libc)FP Bit Twiddling.
  1652. * nexttowardf: (libc)FP Bit Twiddling.
  1653. * nexttowardl: (libc)FP Bit Twiddling.
  1654. * nextup: (libc)FP Bit Twiddling.
  1655. * nextupf: (libc)FP Bit Twiddling.
  1656. * nextupfN: (libc)FP Bit Twiddling.
  1657. * nextupfNx: (libc)FP Bit Twiddling.
  1658. * nextupl: (libc)FP Bit Twiddling.
  1659. * nftw64: (libc)Working with Directory Trees.
  1660. * nftw: (libc)Working with Directory Trees.
  1661. * ngettext: (libc)Advanced gettext functions.
  1662. * nice: (libc)Traditional Scheduling Functions.
  1663. * nl_langinfo: (libc)The Elegant and Fast Way.
  1664. * nrand48: (libc)SVID Random.
  1665. * nrand48_r: (libc)SVID Random.
  1666. * ntohl: (libc)Byte Order.
  1667. * ntohs: (libc)Byte Order.
  1668. * ntp_adjtime: (libc)Setting and Adjusting the Time.
  1669. * ntp_gettime: (libc)Setting and Adjusting the Time.
  1670. * obstack_1grow: (libc)Growing Objects.
  1671. * obstack_1grow_fast: (libc)Extra Fast Growing.
  1672. * obstack_alignment_mask: (libc)Obstacks Data Alignment.
  1673. * obstack_alloc: (libc)Allocation in an Obstack.
  1674. * obstack_base: (libc)Status of an Obstack.
  1675. * obstack_blank: (libc)Growing Objects.
  1676. * obstack_blank_fast: (libc)Extra Fast Growing.
  1677. * obstack_chunk_size: (libc)Obstack Chunks.
  1678. * obstack_copy0: (libc)Allocation in an Obstack.
  1679. * obstack_copy: (libc)Allocation in an Obstack.
  1680. * obstack_finish: (libc)Growing Objects.
  1681. * obstack_free: (libc)Freeing Obstack Objects.
  1682. * obstack_grow0: (libc)Growing Objects.
  1683. * obstack_grow: (libc)Growing Objects.
  1684. * obstack_init: (libc)Preparing for Obstacks.
  1685. * obstack_int_grow: (libc)Growing Objects.
  1686. * obstack_int_grow_fast: (libc)Extra Fast Growing.
  1687. * obstack_next_free: (libc)Status of an Obstack.
  1688. * obstack_object_size: (libc)Growing Objects.
  1689. * obstack_object_size: (libc)Status of an Obstack.
  1690. * obstack_printf: (libc)Dynamic Output.
  1691. * obstack_ptr_grow: (libc)Growing Objects.
  1692. * obstack_ptr_grow_fast: (libc)Extra Fast Growing.
  1693. * obstack_room: (libc)Extra Fast Growing.
  1694. * obstack_vprintf: (libc)Variable Arguments Output.
  1695. * offsetof: (libc)Structure Measurement.
  1696. * on_exit: (libc)Cleanups on Exit.
  1697. * open64: (libc)Opening and Closing Files.
  1698. * open: (libc)Opening and Closing Files.
  1699. * open_memstream: (libc)String Streams.
  1700. * openat2: (libc)Opening and Closing Files.
  1701. * openat64: (libc)Opening and Closing Files.
  1702. * openat: (libc)Opening and Closing Files.
  1703. * opendir: (libc)Opening a Directory.
  1704. * openlog: (libc)openlog.
  1705. * openpty: (libc)Pseudo-Terminal Pairs.
  1706. * parse_printf_format: (libc)Parsing a Template String.
  1707. * pathconf: (libc)Pathconf.
  1708. * pause: (libc)Using Pause.
  1709. * pclose: (libc)Pipe to a Subprocess.
  1710. * perror: (libc)Error Messages.
  1711. * pidfd_getpid: (libc)Querying a Process.
  1712. * pipe: (libc)Creating a Pipe.
  1713. * pkey_alloc: (libc)Memory Protection.
  1714. * pkey_free: (libc)Memory Protection.
  1715. * pkey_get: (libc)Memory Protection.
  1716. * pkey_mprotect: (libc)Memory Protection.
  1717. * pkey_set: (libc)Memory Protection.
  1718. * poll: (libc)Other Low-Level I/O APIs.
  1719. * popen: (libc)Pipe to a Subprocess.
  1720. * posix_fallocate64: (libc)Storage Allocation.
  1721. * posix_fallocate: (libc)Storage Allocation.
  1722. * posix_memalign: (libc)Aligned Memory Blocks.
  1723. * posix_openpt: (libc)Allocation.
  1724. * pow: (libc)Exponents and Logarithms.
  1725. * powf: (libc)Exponents and Logarithms.
  1726. * powfN: (libc)Exponents and Logarithms.
  1727. * powfNx: (libc)Exponents and Logarithms.
  1728. * powl: (libc)Exponents and Logarithms.
  1729. * pown: (libc)Exponents and Logarithms.
  1730. * pownf: (libc)Exponents and Logarithms.
  1731. * pownfN: (libc)Exponents and Logarithms.
  1732. * pownfNx: (libc)Exponents and Logarithms.
  1733. * pownl: (libc)Exponents and Logarithms.
  1734. * powr: (libc)Exponents and Logarithms.
  1735. * powrf: (libc)Exponents and Logarithms.
  1736. * powrfN: (libc)Exponents and Logarithms.
  1737. * powrfNx: (libc)Exponents and Logarithms.
  1738. * powrl: (libc)Exponents and Logarithms.
  1739. * pread64: (libc)I/O Primitives.
  1740. * pread: (libc)I/O Primitives.
  1741. * preadv2: (libc)Scatter-Gather.
  1742. * preadv64: (libc)Scatter-Gather.
  1743. * preadv64v2: (libc)Scatter-Gather.
  1744. * preadv: (libc)Scatter-Gather.
  1745. * printf: (libc)Formatted Output Functions.
  1746. * printf_size: (libc)Predefined Printf Handlers.
  1747. * printf_size_info: (libc)Predefined Printf Handlers.
  1748. * psignal: (libc)Signal Messages.
  1749. * pthread_attr_destroy: (libc)Creating and Destroying Threads.
  1750. * pthread_attr_getaffinity_np: (libc)Thread CPU Affinity.
  1751. * pthread_attr_getdetachstate: (libc)Creating and Destroying Threads.
  1752. * pthread_attr_getsigmask_np: (libc)Initial Thread Signal Mask.
  1753. * pthread_attr_init: (libc)Creating and Destroying Threads.
  1754. * pthread_attr_setaffinity_np: (libc)Thread CPU Affinity.
  1755. * pthread_attr_setdetachstate: (libc)Creating and Destroying Threads.
  1756. * pthread_attr_setsigmask_np: (libc)Initial Thread Signal Mask.
  1757. * pthread_barrier_destroy: (libc)POSIX Barriers.
  1758. * pthread_barrier_init: (libc)POSIX Barriers.
  1759. * pthread_barrier_wait: (libc)POSIX Barriers.
  1760. * pthread_clockjoin_np: (libc)Joining Threads.
  1761. * pthread_cond_clockwait: (libc)Waiting with Explicit Clocks.
  1762. * pthread_create: (libc)Creating and Destroying Threads.
  1763. * pthread_detach: (libc)Creating and Destroying Threads.
  1764. * pthread_equal: (libc)POSIX Threads Other APIs.
  1765. * pthread_getaffinity_np: (libc)Thread CPU Affinity.
  1766. * pthread_getattr_default_np: (libc)Default Thread Attributes.
  1767. * pthread_getcpuclockid: (libc)POSIX Threads Other APIs.
  1768. * pthread_getname_np: (libc)Thread Names.
  1769. * pthread_getspecific: (libc)Thread-specific Data.
  1770. * pthread_gettid_np: (libc)Process Identification.
  1771. * pthread_join: (libc)Creating and Destroying Threads.
  1772. * pthread_key_create: (libc)Thread-specific Data.
  1773. * pthread_key_delete: (libc)Thread-specific Data.
  1774. * pthread_kill: (libc)Creating and Destroying Threads.
  1775. * pthread_mutex_clocklock: (libc)POSIX Mutexes.
  1776. * pthread_mutex_destroy: (libc)POSIX Mutexes.
  1777. * pthread_mutex_init: (libc)POSIX Mutexes.
  1778. * pthread_mutex_lock: (libc)POSIX Mutexes.
  1779. * pthread_mutex_timedlock: (libc)POSIX Mutexes.
  1780. * pthread_mutex_trylock: (libc)POSIX Mutexes.
  1781. * pthread_mutex_unlock: (libc)POSIX Mutexes.
  1782. * pthread_mutexattr_destroy: (libc)POSIX Mutexes.
  1783. * pthread_mutexattr_gettype: (libc)POSIX Mutexes.
  1784. * pthread_mutexattr_init: (libc)POSIX Mutexes.
  1785. * pthread_mutexattr_settype: (libc)POSIX Mutexes.
  1786. * pthread_once: (libc)POSIX Threads Other APIs.
  1787. * pthread_rwlock_clockrdlock: (libc)Waiting with Explicit Clocks.
  1788. * pthread_rwlock_clockwrlock: (libc)Waiting with Explicit Clocks.
  1789. * pthread_self: (libc)Creating and Destroying Threads.
  1790. * pthread_setaffinity_np: (libc)Thread CPU Affinity.
  1791. * pthread_setattr_default_np: (libc)Default Thread Attributes.
  1792. * pthread_setname_np: (libc)Thread Names.
  1793. * pthread_setspecific: (libc)Thread-specific Data.
  1794. * pthread_sigmask: (libc)POSIX Threads Other APIs.
  1795. * pthread_spin_destroy: (libc)POSIX Spin Locks.
  1796. * pthread_spin_init: (libc)POSIX Spin Locks.
  1797. * pthread_spin_lock: (libc)POSIX Spin Locks.
  1798. * pthread_spin_trylock: (libc)POSIX Spin Locks.
  1799. * pthread_spin_unlock: (libc)POSIX Spin Locks.
  1800. * pthread_timedjoin_np: (libc)Joining Threads.
  1801. * pthread_tryjoin_np: (libc)Joining Threads.
  1802. * ptsname: (libc)Allocation.
  1803. * ptsname_r: (libc)Allocation.
  1804. * putc: (libc)Simple Output.
  1805. * putc_unlocked: (libc)Simple Output.
  1806. * putchar: (libc)Simple Output.
  1807. * putchar_unlocked: (libc)Simple Output.
  1808. * putenv: (libc)Environment Access.
  1809. * putpwent: (libc)Writing a User Entry.
  1810. * puts: (libc)Simple Output.
  1811. * pututline: (libc)Manipulating the Database.
  1812. * pututxline: (libc)XPG Functions.
  1813. * putw: (libc)Simple Output.
  1814. * putwc: (libc)Simple Output.
  1815. * putwc_unlocked: (libc)Simple Output.
  1816. * putwchar: (libc)Simple Output.
  1817. * putwchar_unlocked: (libc)Simple Output.
  1818. * pwrite64: (libc)I/O Primitives.
  1819. * pwrite: (libc)I/O Primitives.
  1820. * pwritev2: (libc)Scatter-Gather.
  1821. * pwritev64: (libc)Scatter-Gather.
  1822. * pwritev64v2: (libc)Scatter-Gather.
  1823. * pwritev: (libc)Scatter-Gather.
  1824. * qecvt: (libc)System V Number Conversion.
  1825. * qecvt_r: (libc)System V Number Conversion.
  1826. * qfcvt: (libc)System V Number Conversion.
  1827. * qfcvt_r: (libc)System V Number Conversion.
  1828. * qgcvt: (libc)System V Number Conversion.
  1829. * qsort: (libc)Array Sort Function.
  1830. * raise: (libc)Signaling Yourself.
  1831. * rand: (libc)ISO Random.
  1832. * rand_r: (libc)ISO Random.
  1833. * random: (libc)BSD Random.
  1834. * random_r: (libc)BSD Random.
  1835. * rawmemchr: (libc)Search Functions.
  1836. * read: (libc)I/O Primitives.
  1837. * readdir64: (libc)Reading/Closing Directory.
  1838. * readdir64_r: (libc)Reading/Closing Directory.
  1839. * readdir: (libc)Reading/Closing Directory.
  1840. * readdir_r: (libc)Reading/Closing Directory.
  1841. * readlink: (libc)Symbolic Links.
  1842. * readv: (libc)Scatter-Gather.
  1843. * realloc: (libc)Changing Block Size.
  1844. * reallocarray: (libc)Changing Block Size.
  1845. * realpath: (libc)Symbolic Links.
  1846. * recv: (libc)Receiving Data.
  1847. * recvfrom: (libc)Receiving Datagrams.
  1848. * recvmsg: (libc)Other Socket APIs.
  1849. * regcomp: (libc)POSIX Regexp Compilation.
  1850. * regerror: (libc)Regexp Cleanup.
  1851. * regexec: (libc)Matching POSIX Regexps.
  1852. * regfree: (libc)Regexp Cleanup.
  1853. * register_printf_function: (libc)Registering New Conversions.
  1854. * remainder: (libc)Remainder Functions.
  1855. * remainderf: (libc)Remainder Functions.
  1856. * remainderfN: (libc)Remainder Functions.
  1857. * remainderfNx: (libc)Remainder Functions.
  1858. * remainderl: (libc)Remainder Functions.
  1859. * remove: (libc)Deleting Files.
  1860. * rename: (libc)Renaming Files.
  1861. * renameat: (libc)Renaming Files.
  1862. * rewind: (libc)File Positioning.
  1863. * rewinddir: (libc)Random Access Directory.
  1864. * rindex: (libc)Search Functions.
  1865. * rint: (libc)Rounding Functions.
  1866. * rintf: (libc)Rounding Functions.
  1867. * rintfN: (libc)Rounding Functions.
  1868. * rintfNx: (libc)Rounding Functions.
  1869. * rintl: (libc)Rounding Functions.
  1870. * rmdir: (libc)Deleting Files.
  1871. * rootn: (libc)Exponents and Logarithms.
  1872. * rootnf: (libc)Exponents and Logarithms.
  1873. * rootnfN: (libc)Exponents and Logarithms.
  1874. * rootnfNx: (libc)Exponents and Logarithms.
  1875. * rootnl: (libc)Exponents and Logarithms.
  1876. * round: (libc)Rounding Functions.
  1877. * roundeven: (libc)Rounding Functions.
  1878. * roundevenf: (libc)Rounding Functions.
  1879. * roundevenfN: (libc)Rounding Functions.
  1880. * roundevenfNx: (libc)Rounding Functions.
  1881. * roundevenl: (libc)Rounding Functions.
  1882. * roundf: (libc)Rounding Functions.
  1883. * roundfN: (libc)Rounding Functions.
  1884. * roundfNx: (libc)Rounding Functions.
  1885. * roundl: (libc)Rounding Functions.
  1886. * rpmatch: (libc)Yes-or-No Questions.
  1887. * rsqrt: (libc)Exponents and Logarithms.
  1888. * rsqrtf: (libc)Exponents and Logarithms.
  1889. * rsqrtfN: (libc)Exponents and Logarithms.
  1890. * rsqrtfNx: (libc)Exponents and Logarithms.
  1891. * rsqrtl: (libc)Exponents and Logarithms.
  1892. * sbrk: (libc)Resizing the Data Segment.
  1893. * scalb: (libc)Normalization Functions.
  1894. * scalbf: (libc)Normalization Functions.
  1895. * scalbl: (libc)Normalization Functions.
  1896. * scalbln: (libc)Normalization Functions.
  1897. * scalblnf: (libc)Normalization Functions.
  1898. * scalblnfN: (libc)Normalization Functions.
  1899. * scalblnfNx: (libc)Normalization Functions.
  1900. * scalblnl: (libc)Normalization Functions.
  1901. * scalbn: (libc)Normalization Functions.
  1902. * scalbnf: (libc)Normalization Functions.
  1903. * scalbnfN: (libc)Normalization Functions.
  1904. * scalbnfNx: (libc)Normalization Functions.
  1905. * scalbnl: (libc)Normalization Functions.
  1906. * scandir64: (libc)Scanning Directory Content.
  1907. * scandir: (libc)Scanning Directory Content.
  1908. * scanf: (libc)Formatted Input Functions.
  1909. * sched_get_priority_max: (libc)Basic Scheduling Functions.
  1910. * sched_get_priority_min: (libc)Basic Scheduling Functions.
  1911. * sched_getaffinity: (libc)CPU Affinity.
  1912. * sched_getattr: (libc)Extensible Scheduling.
  1913. * sched_getcpu: (libc)CPU Affinity.
  1914. * sched_getparam: (libc)Basic Scheduling Functions.
  1915. * sched_getscheduler: (libc)Basic Scheduling Functions.
  1916. * sched_rr_get_interval: (libc)Basic Scheduling Functions.
  1917. * sched_setaffinity: (libc)CPU Affinity.
  1918. * sched_setattr: (libc)Extensible Scheduling.
  1919. * sched_setparam: (libc)Basic Scheduling Functions.
  1920. * sched_setscheduler: (libc)Basic Scheduling Functions.
  1921. * sched_yield: (libc)Basic Scheduling Functions.
  1922. * secure_getenv: (libc)Environment Access.
  1923. * seed48: (libc)SVID Random.
  1924. * seed48_r: (libc)SVID Random.
  1925. * seekdir: (libc)Random Access Directory.
  1926. * select: (libc)Waiting for I/O.
  1927. * sem_clockwait: (libc)POSIX Semaphores.
  1928. * sem_close: (libc)POSIX Semaphores.
  1929. * sem_destroy: (libc)POSIX Semaphores.
  1930. * sem_getvalue: (libc)POSIX Semaphores.
  1931. * sem_init: (libc)POSIX Semaphores.
  1932. * sem_open: (libc)POSIX Semaphores.
  1933. * sem_post: (libc)POSIX Semaphores.
  1934. * sem_timedwait: (libc)POSIX Semaphores.
  1935. * sem_trywait: (libc)POSIX Semaphores.
  1936. * sem_unlink: (libc)POSIX Semaphores.
  1937. * sem_wait: (libc)POSIX Semaphores.
  1938. * semctl: (libc)Semaphores.
  1939. * semget: (libc)Semaphores.
  1940. * semop: (libc)Semaphores.
  1941. * semtimedop: (libc)Semaphores.
  1942. * send: (libc)Sending Data.
  1943. * sendmsg: (libc)Other Socket APIs.
  1944. * sendto: (libc)Sending Datagrams.
  1945. * setbuf: (libc)Controlling Buffering.
  1946. * setbuffer: (libc)Controlling Buffering.
  1947. * setcontext: (libc)System V contexts.
  1948. * setdomainname: (libc)Host Identification.
  1949. * setegid: (libc)Setting Groups.
  1950. * setenv: (libc)Environment Access.
  1951. * seteuid: (libc)Setting User ID.
  1952. * setfsent: (libc)fstab.
  1953. * setgid: (libc)Setting Groups.
  1954. * setgrent: (libc)Scanning All Groups.
  1955. * setgroups: (libc)Setting Groups.
  1956. * sethostent: (libc)Host Names.
  1957. * sethostid: (libc)Host Identification.
  1958. * sethostname: (libc)Host Identification.
  1959. * setitimer: (libc)Setting an Alarm.
  1960. * setjmp: (libc)Non-Local Details.
  1961. * setlinebuf: (libc)Controlling Buffering.
  1962. * setlocale: (libc)Setting the Locale.
  1963. * setlogmask: (libc)setlogmask.
  1964. * setmntent: (libc)mtab.
  1965. * setnetent: (libc)Networks Database.
  1966. * setnetgrent: (libc)Lookup Netgroup.
  1967. * setpayload: (libc)FP Bit Twiddling.
  1968. * setpayloadf: (libc)FP Bit Twiddling.
  1969. * setpayloadfN: (libc)FP Bit Twiddling.
  1970. * setpayloadfNx: (libc)FP Bit Twiddling.
  1971. * setpayloadl: (libc)FP Bit Twiddling.
  1972. * setpayloadsig: (libc)FP Bit Twiddling.
  1973. * setpayloadsigf: (libc)FP Bit Twiddling.
  1974. * setpayloadsigfN: (libc)FP Bit Twiddling.
  1975. * setpayloadsigfNx: (libc)FP Bit Twiddling.
  1976. * setpayloadsigl: (libc)FP Bit Twiddling.
  1977. * setpgid: (libc)Process Group Functions.
  1978. * setpgrp: (libc)Process Group Functions.
  1979. * setpriority: (libc)Traditional Scheduling Functions.
  1980. * setprotoent: (libc)Protocols Database.
  1981. * setpwent: (libc)Scanning All Users.
  1982. * setregid: (libc)Setting Groups.
  1983. * setreuid: (libc)Setting User ID.
  1984. * setrlimit64: (libc)Limits on Resources.
  1985. * setrlimit: (libc)Limits on Resources.
  1986. * setservent: (libc)Services Database.
  1987. * setsid: (libc)Process Group Functions.
  1988. * setsockopt: (libc)Socket Option Functions.
  1989. * setstate: (libc)BSD Random.
  1990. * setstate_r: (libc)BSD Random.
  1991. * settimeofday: (libc)Setting and Adjusting the Time.
  1992. * setuid: (libc)Setting User ID.
  1993. * setutent: (libc)Manipulating the Database.
  1994. * setutxent: (libc)XPG Functions.
  1995. * setvbuf: (libc)Controlling Buffering.
  1996. * shm_open: (libc)Memory-mapped I/O.
  1997. * shm_unlink: (libc)Memory-mapped I/O.
  1998. * shutdown: (libc)Closing a Socket.
  1999. * sigabbrev_np: (libc)Signal Messages.
  2000. * sigaction: (libc)Advanced Signal Handling.
  2001. * sigaddset: (libc)Signal Sets.
  2002. * sigaltstack: (libc)Signal Stack.
  2003. * sigblock: (libc)BSD Signal Handling.
  2004. * sigdelset: (libc)Signal Sets.
  2005. * sigdescr_np: (libc)Signal Messages.
  2006. * sigemptyset: (libc)Signal Sets.
  2007. * sigfillset: (libc)Signal Sets.
  2008. * siginterrupt: (libc)BSD Signal Handling.
  2009. * sigismember: (libc)Signal Sets.
  2010. * siglongjmp: (libc)Non-Local Exits and Signals.
  2011. * sigmask: (libc)BSD Signal Handling.
  2012. * signal: (libc)Basic Signal Handling.
  2013. * signbit: (libc)FP Bit Twiddling.
  2014. * significand: (libc)Normalization Functions.
  2015. * significandf: (libc)Normalization Functions.
  2016. * significandl: (libc)Normalization Functions.
  2017. * sigpause: (libc)BSD Signal Handling.
  2018. * sigpending: (libc)Checking for Pending Signals.
  2019. * sigprocmask: (libc)Process Signal Mask.
  2020. * sigsetjmp: (libc)Non-Local Exits and Signals.
  2021. * sigsetmask: (libc)BSD Signal Handling.
  2022. * sigstack: (libc)Signal Stack.
  2023. * sigsuspend: (libc)Sigsuspend.
  2024. * sin: (libc)Trig Functions.
  2025. * sincos: (libc)Trig Functions.
  2026. * sincosf: (libc)Trig Functions.
  2027. * sincosfN: (libc)Trig Functions.
  2028. * sincosfNx: (libc)Trig Functions.
  2029. * sincosl: (libc)Trig Functions.
  2030. * sinf: (libc)Trig Functions.
  2031. * sinfN: (libc)Trig Functions.
  2032. * sinfNx: (libc)Trig Functions.
  2033. * sinh: (libc)Hyperbolic Functions.
  2034. * sinhf: (libc)Hyperbolic Functions.
  2035. * sinhfN: (libc)Hyperbolic Functions.
  2036. * sinhfNx: (libc)Hyperbolic Functions.
  2037. * sinhl: (libc)Hyperbolic Functions.
  2038. * sinl: (libc)Trig Functions.
  2039. * sinpi: (libc)Trig Functions.
  2040. * sinpif: (libc)Trig Functions.
  2041. * sinpifN: (libc)Trig Functions.
  2042. * sinpifNx: (libc)Trig Functions.
  2043. * sinpil: (libc)Trig Functions.
  2044. * sleep: (libc)Sleeping.
  2045. * snprintf: (libc)Formatted Output Functions.
  2046. * socket: (libc)Creating a Socket.
  2047. * socketpair: (libc)Socket Pairs.
  2048. * sprintf: (libc)Formatted Output Functions.
  2049. * sqrt: (libc)Exponents and Logarithms.
  2050. * sqrtf: (libc)Exponents and Logarithms.
  2051. * sqrtfN: (libc)Exponents and Logarithms.
  2052. * sqrtfNx: (libc)Exponents and Logarithms.
  2053. * sqrtl: (libc)Exponents and Logarithms.
  2054. * srand48: (libc)SVID Random.
  2055. * srand48_r: (libc)SVID Random.
  2056. * srand: (libc)ISO Random.
  2057. * srandom: (libc)BSD Random.
  2058. * srandom_r: (libc)BSD Random.
  2059. * sscanf: (libc)Formatted Input Functions.
  2060. * ssignal: (libc)Basic Signal Handling.
  2061. * stat64: (libc)Reading Attributes.
  2062. * stat: (libc)Reading Attributes.
  2063. * stdc_bit_ceil_uc: (libc)Bit Manipulation.
  2064. * stdc_bit_ceil_ui: (libc)Bit Manipulation.
  2065. * stdc_bit_ceil_ul: (libc)Bit Manipulation.
  2066. * stdc_bit_ceil_ull: (libc)Bit Manipulation.
  2067. * stdc_bit_ceil_us: (libc)Bit Manipulation.
  2068. * stdc_bit_floor_uc: (libc)Bit Manipulation.
  2069. * stdc_bit_floor_ui: (libc)Bit Manipulation.
  2070. * stdc_bit_floor_ul: (libc)Bit Manipulation.
  2071. * stdc_bit_floor_ull: (libc)Bit Manipulation.
  2072. * stdc_bit_floor_us: (libc)Bit Manipulation.
  2073. * stdc_bit_width_uc: (libc)Bit Manipulation.
  2074. * stdc_bit_width_ui: (libc)Bit Manipulation.
  2075. * stdc_bit_width_ul: (libc)Bit Manipulation.
  2076. * stdc_bit_width_ull: (libc)Bit Manipulation.
  2077. * stdc_bit_width_us: (libc)Bit Manipulation.
  2078. * stdc_count_ones_uc: (libc)Bit Manipulation.
  2079. * stdc_count_ones_ui: (libc)Bit Manipulation.
  2080. * stdc_count_ones_ul: (libc)Bit Manipulation.
  2081. * stdc_count_ones_ull: (libc)Bit Manipulation.
  2082. * stdc_count_ones_us: (libc)Bit Manipulation.
  2083. * stdc_count_zeros_uc: (libc)Bit Manipulation.
  2084. * stdc_count_zeros_ui: (libc)Bit Manipulation.
  2085. * stdc_count_zeros_ul: (libc)Bit Manipulation.
  2086. * stdc_count_zeros_ull: (libc)Bit Manipulation.
  2087. * stdc_count_zeros_us: (libc)Bit Manipulation.
  2088. * stdc_first_leading_one_uc: (libc)Bit Manipulation.
  2089. * stdc_first_leading_one_ui: (libc)Bit Manipulation.
  2090. * stdc_first_leading_one_ul: (libc)Bit Manipulation.
  2091. * stdc_first_leading_one_ull: (libc)Bit Manipulation.
  2092. * stdc_first_leading_one_us: (libc)Bit Manipulation.
  2093. * stdc_first_leading_zero_uc: (libc)Bit Manipulation.
  2094. * stdc_first_leading_zero_ui: (libc)Bit Manipulation.
  2095. * stdc_first_leading_zero_ul: (libc)Bit Manipulation.
  2096. * stdc_first_leading_zero_ull: (libc)Bit Manipulation.
  2097. * stdc_first_leading_zero_us: (libc)Bit Manipulation.
  2098. * stdc_first_trailing_one_uc: (libc)Bit Manipulation.
  2099. * stdc_first_trailing_one_ui: (libc)Bit Manipulation.
  2100. * stdc_first_trailing_one_ul: (libc)Bit Manipulation.
  2101. * stdc_first_trailing_one_ull: (libc)Bit Manipulation.
  2102. * stdc_first_trailing_one_us: (libc)Bit Manipulation.
  2103. * stdc_first_trailing_zero_uc: (libc)Bit Manipulation.
  2104. * stdc_first_trailing_zero_ui: (libc)Bit Manipulation.
  2105. * stdc_first_trailing_zero_ul: (libc)Bit Manipulation.
  2106. * stdc_first_trailing_zero_ull: (libc)Bit Manipulation.
  2107. * stdc_first_trailing_zero_us: (libc)Bit Manipulation.
  2108. * stdc_has_single_bit_uc: (libc)Bit Manipulation.
  2109. * stdc_has_single_bit_ui: (libc)Bit Manipulation.
  2110. * stdc_has_single_bit_ul: (libc)Bit Manipulation.
  2111. * stdc_has_single_bit_ull: (libc)Bit Manipulation.
  2112. * stdc_has_single_bit_us: (libc)Bit Manipulation.
  2113. * stdc_leading_ones_uc: (libc)Bit Manipulation.
  2114. * stdc_leading_ones_ui: (libc)Bit Manipulation.
  2115. * stdc_leading_ones_ul: (libc)Bit Manipulation.
  2116. * stdc_leading_ones_ull: (libc)Bit Manipulation.
  2117. * stdc_leading_ones_us: (libc)Bit Manipulation.
  2118. * stdc_leading_zeros_uc: (libc)Bit Manipulation.
  2119. * stdc_leading_zeros_ui: (libc)Bit Manipulation.
  2120. * stdc_leading_zeros_ul: (libc)Bit Manipulation.
  2121. * stdc_leading_zeros_ull: (libc)Bit Manipulation.
  2122. * stdc_leading_zeros_us: (libc)Bit Manipulation.
  2123. * stdc_trailing_ones_uc: (libc)Bit Manipulation.
  2124. * stdc_trailing_ones_ui: (libc)Bit Manipulation.
  2125. * stdc_trailing_ones_ul: (libc)Bit Manipulation.
  2126. * stdc_trailing_ones_ull: (libc)Bit Manipulation.
  2127. * stdc_trailing_ones_us: (libc)Bit Manipulation.
  2128. * stdc_trailing_zeros_uc: (libc)Bit Manipulation.
  2129. * stdc_trailing_zeros_ui: (libc)Bit Manipulation.
  2130. * stdc_trailing_zeros_ul: (libc)Bit Manipulation.
  2131. * stdc_trailing_zeros_ull: (libc)Bit Manipulation.
  2132. * stdc_trailing_zeros_us: (libc)Bit Manipulation.
  2133. * stime: (libc)Setting and Adjusting the Time.
  2134. * stpcpy: (libc)Copying Strings and Arrays.
  2135. * stpncpy: (libc)Truncating Strings.
  2136. * strcasecmp: (libc)String/Array Comparison.
  2137. * strcasestr: (libc)Search Functions.
  2138. * strcat: (libc)Concatenating Strings.
  2139. * strchr: (libc)Search Functions.
  2140. * strchrnul: (libc)Search Functions.
  2141. * strcmp: (libc)String/Array Comparison.
  2142. * strcoll: (libc)Collation Functions.
  2143. * strcpy: (libc)Copying Strings and Arrays.
  2144. * strcspn: (libc)Search Functions.
  2145. * strdup: (libc)Copying Strings and Arrays.
  2146. * strdupa: (libc)Copying Strings and Arrays.
  2147. * strerror: (libc)Error Messages.
  2148. * strerror_l: (libc)Error Messages.
  2149. * strerror_r: (libc)Error Messages.
  2150. * strerror_r: (libc)Error Messages.
  2151. * strerrordesc_np: (libc)Error Messages.
  2152. * strerrorname_np: (libc)Error Messages.
  2153. * strfmon: (libc)Formatting Numbers.
  2154. * strfromd: (libc)Printing of Floats.
  2155. * strfromf: (libc)Printing of Floats.
  2156. * strfromfN: (libc)Printing of Floats.
  2157. * strfromfNx: (libc)Printing of Floats.
  2158. * strfroml: (libc)Printing of Floats.
  2159. * strfry: (libc)Shuffling Bytes.
  2160. * strftime: (libc)Formatting Calendar Time.
  2161. * strftime_l: (libc)Formatting Calendar Time.
  2162. * strlcat: (libc)Truncating Strings.
  2163. * strlcpy: (libc)Truncating Strings.
  2164. * strlen: (libc)String Length.
  2165. * strncasecmp: (libc)String/Array Comparison.
  2166. * strncat: (libc)Truncating Strings.
  2167. * strncmp: (libc)String/Array Comparison.
  2168. * strncpy: (libc)Truncating Strings.
  2169. * strndup: (libc)Truncating Strings.
  2170. * strndupa: (libc)Truncating Strings.
  2171. * strnlen: (libc)String Length.
  2172. * strpbrk: (libc)Search Functions.
  2173. * strptime: (libc)Low-Level Time String Parsing.
  2174. * strrchr: (libc)Search Functions.
  2175. * strsep: (libc)Finding Tokens in a String.
  2176. * strsignal: (libc)Signal Messages.
  2177. * strspn: (libc)Search Functions.
  2178. * strstr: (libc)Search Functions.
  2179. * strtod: (libc)Parsing of Floats.
  2180. * strtof: (libc)Parsing of Floats.
  2181. * strtofN: (libc)Parsing of Floats.
  2182. * strtofNx: (libc)Parsing of Floats.
  2183. * strtoimax: (libc)Parsing of Integers.
  2184. * strtok: (libc)Finding Tokens in a String.
  2185. * strtok_r: (libc)Finding Tokens in a String.
  2186. * strtol: (libc)Parsing of Integers.
  2187. * strtold: (libc)Parsing of Floats.
  2188. * strtoll: (libc)Parsing of Integers.
  2189. * strtoq: (libc)Parsing of Integers.
  2190. * strtoul: (libc)Parsing of Integers.
  2191. * strtoull: (libc)Parsing of Integers.
  2192. * strtoumax: (libc)Parsing of Integers.
  2193. * strtouq: (libc)Parsing of Integers.
  2194. * strverscmp: (libc)String/Array Comparison.
  2195. * strxfrm: (libc)Collation Functions.
  2196. * stty: (libc)BSD Terminal Modes.
  2197. * swapcontext: (libc)System V contexts.
  2198. * swprintf: (libc)Formatted Output Functions.
  2199. * swscanf: (libc)Formatted Input Functions.
  2200. * symlink: (libc)Symbolic Links.
  2201. * sync: (libc)Synchronizing I/O.
  2202. * syscall: (libc)System Calls.
  2203. * sysconf: (libc)Sysconf Definition.
  2204. * syslog: (libc)syslog; vsyslog.
  2205. * system: (libc)Running a Command.
  2206. * sysv_signal: (libc)Basic Signal Handling.
  2207. * tan: (libc)Trig Functions.
  2208. * tanf: (libc)Trig Functions.
  2209. * tanfN: (libc)Trig Functions.
  2210. * tanfNx: (libc)Trig Functions.
  2211. * tanh: (libc)Hyperbolic Functions.
  2212. * tanhf: (libc)Hyperbolic Functions.
  2213. * tanhfN: (libc)Hyperbolic Functions.
  2214. * tanhfNx: (libc)Hyperbolic Functions.
  2215. * tanhl: (libc)Hyperbolic Functions.
  2216. * tanl: (libc)Trig Functions.
  2217. * tanpi: (libc)Trig Functions.
  2218. * tanpif: (libc)Trig Functions.
  2219. * tanpifN: (libc)Trig Functions.
  2220. * tanpifNx: (libc)Trig Functions.
  2221. * tanpil: (libc)Trig Functions.
  2222. * tcdrain: (libc)Line Control.
  2223. * tcflow: (libc)Line Control.
  2224. * tcflush: (libc)Line Control.
  2225. * tcgetattr: (libc)Mode Functions.
  2226. * tcgetpgrp: (libc)Terminal Access Functions.
  2227. * tcgetsid: (libc)Terminal Access Functions.
  2228. * tcsendbreak: (libc)Line Control.
  2229. * tcsetattr: (libc)Mode Functions.
  2230. * tcsetpgrp: (libc)Terminal Access Functions.
  2231. * tdelete: (libc)Tree Search Function.
  2232. * tdestroy: (libc)Tree Search Function.
  2233. * telldir: (libc)Random Access Directory.
  2234. * tempnam: (libc)Temporary Files.
  2235. * textdomain: (libc)Locating gettext catalog.
  2236. * tfind: (libc)Tree Search Function.
  2237. * tgamma: (libc)Special Functions.
  2238. * tgammaf: (libc)Special Functions.
  2239. * tgammafN: (libc)Special Functions.
  2240. * tgammafNx: (libc)Special Functions.
  2241. * tgammal: (libc)Special Functions.
  2242. * tgkill: (libc)Signaling Another Process.
  2243. * thrd_create: (libc)ISO C Thread Management.
  2244. * thrd_current: (libc)ISO C Thread Management.
  2245. * thrd_detach: (libc)ISO C Thread Management.
  2246. * thrd_equal: (libc)ISO C Thread Management.
  2247. * thrd_exit: (libc)ISO C Thread Management.
  2248. * thrd_join: (libc)ISO C Thread Management.
  2249. * thrd_sleep: (libc)ISO C Thread Management.
  2250. * thrd_yield: (libc)ISO C Thread Management.
  2251. * time: (libc)Getting the Time.
  2252. * timegm: (libc)Broken-down Time.
  2253. * timelocal: (libc)Broken-down Time.
  2254. * times: (libc)Processor Time.
  2255. * timespec_get: (libc)Getting the Time.
  2256. * timespec_getres: (libc)Getting the Time.
  2257. * tmpfile64: (libc)Temporary Files.
  2258. * tmpfile: (libc)Temporary Files.
  2259. * tmpnam: (libc)Temporary Files.
  2260. * tmpnam_r: (libc)Temporary Files.
  2261. * toascii: (libc)Case Conversion.
  2262. * tolower: (libc)Case Conversion.
  2263. * totalorder: (libc)FP Comparison Functions.
  2264. * totalorderf: (libc)FP Comparison Functions.
  2265. * totalorderfN: (libc)FP Comparison Functions.
  2266. * totalorderfNx: (libc)FP Comparison Functions.
  2267. * totalorderl: (libc)FP Comparison Functions.
  2268. * totalordermag: (libc)FP Comparison Functions.
  2269. * totalordermagf: (libc)FP Comparison Functions.
  2270. * totalordermagfN: (libc)FP Comparison Functions.
  2271. * totalordermagfNx: (libc)FP Comparison Functions.
  2272. * totalordermagl: (libc)FP Comparison Functions.
  2273. * toupper: (libc)Case Conversion.
  2274. * towctrans: (libc)Wide Character Case Conversion.
  2275. * towlower: (libc)Wide Character Case Conversion.
  2276. * towupper: (libc)Wide Character Case Conversion.
  2277. * trunc: (libc)Rounding Functions.
  2278. * truncate64: (libc)File Size.
  2279. * truncate: (libc)File Size.
  2280. * truncf: (libc)Rounding Functions.
  2281. * truncfN: (libc)Rounding Functions.
  2282. * truncfNx: (libc)Rounding Functions.
  2283. * truncl: (libc)Rounding Functions.
  2284. * tsearch: (libc)Tree Search Function.
  2285. * tss_create: (libc)ISO C Thread-local Storage.
  2286. * tss_delete: (libc)ISO C Thread-local Storage.
  2287. * tss_get: (libc)ISO C Thread-local Storage.
  2288. * tss_set: (libc)ISO C Thread-local Storage.
  2289. * ttyname: (libc)Is It a Terminal.
  2290. * ttyname_r: (libc)Is It a Terminal.
  2291. * twalk: (libc)Tree Search Function.
  2292. * twalk_r: (libc)Tree Search Function.
  2293. * tzset: (libc)Time Zone State.
  2294. * uabs: (libc)Absolute Value.
  2295. * ufromfp: (libc)Rounding Functions.
  2296. * ufromfpf: (libc)Rounding Functions.
  2297. * ufromfpfN: (libc)Rounding Functions.
  2298. * ufromfpfNx: (libc)Rounding Functions.
  2299. * ufromfpl: (libc)Rounding Functions.
  2300. * ufromfpx: (libc)Rounding Functions.
  2301. * ufromfpxf: (libc)Rounding Functions.
  2302. * ufromfpxfN: (libc)Rounding Functions.
  2303. * ufromfpxfNx: (libc)Rounding Functions.
  2304. * ufromfpxl: (libc)Rounding Functions.
  2305. * ulabs: (libc)Absolute Value.
  2306. * ulimit: (libc)Limits on Resources.
  2307. * ullabs: (libc)Absolute Value.
  2308. * umask: (libc)Setting Permissions.
  2309. * umaxabs: (libc)Absolute Value.
  2310. * umount2: (libc)Mount-Unmount-Remount.
  2311. * umount: (libc)Mount-Unmount-Remount.
  2312. * uname: (libc)Platform Type.
  2313. * ungetc: (libc)How Unread.
  2314. * ungetwc: (libc)How Unread.
  2315. * unlink: (libc)Deleting Files.
  2316. * unlinkat: (libc)Deleting Files.
  2317. * unlockpt: (libc)Allocation.
  2318. * unsetenv: (libc)Environment Access.
  2319. * updwtmp: (libc)Manipulating the Database.
  2320. * utime: (libc)File Times.
  2321. * utimensat: (libc)File Times.
  2322. * utimes: (libc)File Times.
  2323. * utmpname: (libc)Manipulating the Database.
  2324. * utmpxname: (libc)XPG Functions.
  2325. * va_arg: (libc)Argument Macros.
  2326. * va_copy: (libc)Argument Macros.
  2327. * va_end: (libc)Argument Macros.
  2328. * va_start: (libc)Argument Macros.
  2329. * valloc: (libc)Aligned Memory Blocks.
  2330. * vasprintf: (libc)Variable Arguments Output.
  2331. * vdprintf: (libc)Variable Arguments Output.
  2332. * verr: (libc)Error Messages.
  2333. * verrx: (libc)Error Messages.
  2334. * versionsort64: (libc)Scanning Directory Content.
  2335. * versionsort: (libc)Scanning Directory Content.
  2336. * vfork: (libc)Creating a Process.
  2337. * vfprintf: (libc)Variable Arguments Output.
  2338. * vfscanf: (libc)Variable Arguments Input.
  2339. * vfwprintf: (libc)Variable Arguments Output.
  2340. * vfwscanf: (libc)Variable Arguments Input.
  2341. * vlimit: (libc)Limits on Resources.
  2342. * vprintf: (libc)Variable Arguments Output.
  2343. * vscanf: (libc)Variable Arguments Input.
  2344. * vsnprintf: (libc)Variable Arguments Output.
  2345. * vsprintf: (libc)Variable Arguments Output.
  2346. * vsscanf: (libc)Variable Arguments Input.
  2347. * vswprintf: (libc)Variable Arguments Output.
  2348. * vswscanf: (libc)Variable Arguments Input.
  2349. * vsyslog: (libc)syslog; vsyslog.
  2350. * vwarn: (libc)Error Messages.
  2351. * vwarnx: (libc)Error Messages.
  2352. * vwprintf: (libc)Variable Arguments Output.
  2353. * vwscanf: (libc)Variable Arguments Input.
  2354. * wait3: (libc)BSD Wait Functions.
  2355. * wait4: (libc)Process Completion.
  2356. * wait: (libc)Process Completion.
  2357. * waitpid: (libc)Process Completion.
  2358. * warn: (libc)Error Messages.
  2359. * warnx: (libc)Error Messages.
  2360. * wcpcpy: (libc)Copying Strings and Arrays.
  2361. * wcpncpy: (libc)Truncating Strings.
  2362. * wcrtomb: (libc)Converting a Character.
  2363. * wcscasecmp: (libc)String/Array Comparison.
  2364. * wcscat: (libc)Concatenating Strings.
  2365. * wcschr: (libc)Search Functions.
  2366. * wcschrnul: (libc)Search Functions.
  2367. * wcscmp: (libc)String/Array Comparison.
  2368. * wcscoll: (libc)Collation Functions.
  2369. * wcscpy: (libc)Copying Strings and Arrays.
  2370. * wcscspn: (libc)Search Functions.
  2371. * wcsdup: (libc)Copying Strings and Arrays.
  2372. * wcsftime: (libc)Formatting Calendar Time.
  2373. * wcslcat: (libc)Truncating Strings.
  2374. * wcslcpy: (libc)Truncating Strings.
  2375. * wcslen: (libc)String Length.
  2376. * wcsncasecmp: (libc)String/Array Comparison.
  2377. * wcsncat: (libc)Truncating Strings.
  2378. * wcsncmp: (libc)String/Array Comparison.
  2379. * wcsncpy: (libc)Truncating Strings.
  2380. * wcsnlen: (libc)String Length.
  2381. * wcsnrtombs: (libc)Converting Strings.
  2382. * wcspbrk: (libc)Search Functions.
  2383. * wcsrchr: (libc)Search Functions.
  2384. * wcsrtombs: (libc)Converting Strings.
  2385. * wcsspn: (libc)Search Functions.
  2386. * wcsstr: (libc)Search Functions.
  2387. * wcstod: (libc)Parsing of Floats.
  2388. * wcstof: (libc)Parsing of Floats.
  2389. * wcstofN: (libc)Parsing of Floats.
  2390. * wcstofNx: (libc)Parsing of Floats.
  2391. * wcstoimax: (libc)Parsing of Integers.
  2392. * wcstok: (libc)Finding Tokens in a String.
  2393. * wcstol: (libc)Parsing of Integers.
  2394. * wcstold: (libc)Parsing of Floats.
  2395. * wcstoll: (libc)Parsing of Integers.
  2396. * wcstombs: (libc)Non-reentrant String Conversion.
  2397. * wcstoq: (libc)Parsing of Integers.
  2398. * wcstoul: (libc)Parsing of Integers.
  2399. * wcstoull: (libc)Parsing of Integers.
  2400. * wcstoumax: (libc)Parsing of Integers.
  2401. * wcstouq: (libc)Parsing of Integers.
  2402. * wcswcs: (libc)Search Functions.
  2403. * wcsxfrm: (libc)Collation Functions.
  2404. * wctob: (libc)Converting a Character.
  2405. * wctomb: (libc)Non-reentrant Character Conversion.
  2406. * wctrans: (libc)Wide Character Case Conversion.
  2407. * wctype: (libc)Classification of Wide Characters.
  2408. * wmemchr: (libc)Search Functions.
  2409. * wmemcmp: (libc)String/Array Comparison.
  2410. * wmemcpy: (libc)Copying Strings and Arrays.
  2411. * wmemmove: (libc)Copying Strings and Arrays.
  2412. * wmempcpy: (libc)Copying Strings and Arrays.
  2413. * wmemset: (libc)Copying Strings and Arrays.
  2414. * wordexp: (libc)Calling Wordexp.
  2415. * wordfree: (libc)Calling Wordexp.
  2416. * wprintf: (libc)Formatted Output Functions.
  2417. * write: (libc)I/O Primitives.
  2418. * writev: (libc)Scatter-Gather.
  2419. * wscanf: (libc)Formatted Input Functions.
  2420. * y0: (libc)Special Functions.
  2421. * y0f: (libc)Special Functions.
  2422. * y0fN: (libc)Special Functions.
  2423. * y0fNx: (libc)Special Functions.
  2424. * y0l: (libc)Special Functions.
  2425. * y1: (libc)Special Functions.
  2426. * y1f: (libc)Special Functions.
  2427. * y1fN: (libc)Special Functions.
  2428. * y1fNx: (libc)Special Functions.
  2429. * y1l: (libc)Special Functions.
  2430. * yn: (libc)Special Functions.
  2431. * ynf: (libc)Special Functions.
  2432. * ynfN: (libc)Special Functions.
  2433. * ynfNx: (libc)Special Functions.
  2434. * ynl: (libc)Special Functions.
  2435. END-INFO-DIR-ENTRY
  2436. 
  2437. File: libc.info, Node: Time Zone State, Next: Time Functions Example, Prev: TZ Variable, Up: Calendar Time
  2438. 22.5.7 State Variables for Time Zones
  2439. -------------------------------------
  2440. For compatibility with POSIX, the GNU C Library defines global state
  2441. variables that depend on time zone rules specified by the ‘TZ’
  2442. environment variable. However, these state variables are obsolescent
  2443. and are planned to be removed in a future version of POSIX, and programs
  2444. generally should avoid them because they are not thread-safe and their
  2445. values are specified only when ‘TZ’ uses the proleptic format. *Note TZ
  2446. Variable::. Programs should instead use the ‘tm_gmtoff’ and ‘tm_zone’
  2447. members of ‘struct tm’. *Note Broken-down Time::.
  2448. -- Function: void tzset (void)
  2449. Preliminary: | MT-Safe env locale | AS-Unsafe heap lock | AC-Unsafe
  2450. lock mem fd | *Note POSIX Safety Concepts::.
  2451. The ‘tzset’ function initializes the state variables from the value
  2452. of the ‘TZ’ environment variable. It is not usually necessary for
  2453. your program to call this function, partly because your program
  2454. should not use the state variables, and partly because this
  2455. function is called automatically when you use the time conversion
  2456. functions ‘localtime’, ‘mktime’, ‘strftime’, ‘strftime_l’, and
  2457. ‘wcsftime’, or the deprecated function ‘ctime’. Behavior is
  2458. undefined if one thread accesses any of these variables directly
  2459. while another thread is calling ‘tzset’ or any other function that
  2460. is required or allowed to behave as if it called ‘tzset’.
  2461. -- Variable: char * tzname [2]
  2462. The array ‘tzname’ contains two strings, which are abbreviations of
  2463. time zones (standard and Daylight Saving) that the user has
  2464. selected. ‘tzname[0]’ abbreviates a standard time zone (for
  2465. example, "EST"), and ‘tzname[1]’ abbreviates a time zone when
  2466. daylight saving time is in use (for example, "EDT"). These
  2467. correspond to the STD and DST strings (respectively) when the ‘TZ’
  2468. environment variable uses the proleptic format. The string values
  2469. are unspecified if ‘TZ’ uses the geographical format, so it is
  2470. generally better to use the broken-down time structure's ‘tm_zone’
  2471. member instead.
  2472. In the GNU C Library, the strings have a storage lifetime that
  2473. lasts indefinitely; on some other platforms, the lifetime lasts
  2474. only until ‘TZ’ is changed.
  2475. The ‘tzname’ array is initialized by ‘tzset’. Though the strings
  2476. are declared as ‘char *’ the user must refrain from modifying them.
  2477. Modifying the strings will almost certainly lead to trouble.
  2478. -- Variable: long int timezone
  2479. This contains the difference between UTC and local standard time,
  2480. in seconds west of the Prime Meridian. For example, in the U.S.
  2481. Eastern time zone, the value is ‘5*60*60’. Unlike the ‘tm_gmtoff’
  2482. member of the broken-down time structure, this value is not
  2483. adjusted for daylight saving, and its sign is reversed. The value
  2484. is unspecified if ‘TZ’ uses the geographical format, so it is
  2485. generally better to use the broken-down time structure's
  2486. ‘tm_gmtoff’ member instead.
  2487. -- Variable: int daylight
  2488. This variable is nonzero if daylight saving time rules apply. A
  2489. nonzero value does not necessarily mean that daylight saving time
  2490. is now in effect; it means only that daylight saving time is
  2491. sometimes in effect. This variable has little or no practical use;
  2492. it is present for POSIX compatibility.
  2493. 
  2494. File: libc.info, Node: Time Functions Example, Prev: Time Zone State, Up: Calendar Time
  2495. 22.5.8 Time Functions Example
  2496. -----------------------------
  2497. Here is an example program showing the use of some of the calendar time
  2498. functions.
  2499. #include <time.h>
  2500. #include <stdio.h>
  2501. int
  2502. main (void)
  2503. {
  2504. /* This buffer is big enough that the strftime calls
  2505. below cannot possibly exhaust it. */
  2506. char buf[256];
  2507. /* Get the current time. */
  2508. time_t curtime = time (NULL);
  2509. /* Convert it to local time representation. */
  2510. struct tm *lt = localtime (&curtime);
  2511. if (!lt)
  2512. return 1;
  2513. /* Print the date and time in a simple format
  2514. that is independent of locale. */
  2515. strftime (buf, sizeof buf, "%Y-%m-%d %H:%M:%S", lt);
  2516. puts (buf);
  2517. /* Print it in a nicer English format. */
  2518. strftime (buf, sizeof buf, "Today is %A, %B %d.", lt);
  2519. puts (buf);
  2520. strftime (buf, sizeof buf, "The time is %I:%M %p.", lt);
  2521. puts (buf);
  2522. return 0;
  2523. }
  2524. It produces output like this:
  2525. 2024-06-09 13:50:06
  2526. Today is Sunday, June 09.
  2527. The time is 01:50 PM.
  2528. 
  2529. File: libc.info, Node: Setting an Alarm, Next: Sleeping, Prev: Calendar Time, Up: Date and Time
  2530. 22.6 Setting an Alarm
  2531. =====================
  2532. The ‘alarm’ and ‘setitimer’ functions provide a mechanism for a process
  2533. to interrupt itself in the future. They do this by setting a timer;
  2534. when the timer expires, the process receives a signal.
  2535. Each process has three independent interval timers available:
  2536. • A real-time timer that counts elapsed time. This timer sends a
  2537. ‘SIGALRM’ signal to the process when it expires.
  2538. • A virtual timer that counts processor time used by the process.
  2539. This timer sends a ‘SIGVTALRM’ signal to the process when it
  2540. expires.
  2541. • A profiling timer that counts both processor time used by the
  2542. process, and processor time spent in system calls on behalf of the
  2543. process. This timer sends a ‘SIGPROF’ signal to the process when
  2544. it expires.
  2545. This timer is useful for profiling in interpreters. The interval
  2546. timer mechanism does not have the fine granularity necessary for
  2547. profiling native code.
  2548. You can only have one timer of each kind set at any given time. If
  2549. you set a timer that has not yet expired, that timer is simply reset to
  2550. the new value.
  2551. You should establish a handler for the appropriate alarm signal using
  2552. ‘signal’ or ‘sigaction’ before issuing a call to ‘setitimer’ or ‘alarm’.
  2553. Otherwise, an unusual chain of events could cause the timer to expire
  2554. before your program establishes the handler. In this case it would be
  2555. terminated, since termination is the default action for the alarm
  2556. signals. *Note Signal Handling::.
  2557. To be able to use the alarm function to interrupt a system call which
  2558. might block otherwise indefinitely it is important to _not_ set the
  2559. ‘SA_RESTART’ flag when registering the signal handler using ‘sigaction’.
  2560. When not using ‘sigaction’ things get even uglier: the ‘signal’ function
  2561. has fixed semantics with respect to restarts. The BSD semantics for
  2562. this function is to set the flag. Therefore, if ‘sigaction’ for
  2563. whatever reason cannot be used, it is necessary to use ‘sysv_signal’ and
  2564. not ‘signal’.
  2565. The ‘setitimer’ function is the primary means for setting an alarm.
  2566. This facility is declared in the header file ‘sys/time.h’. The ‘alarm’
  2567. function, declared in ‘unistd.h’, provides a somewhat simpler interface
  2568. for setting the real-time timer.
  2569. -- Data Type: struct itimerval
  2570. This structure is used to specify when a timer should expire. It
  2571. contains the following members:
  2572. ‘struct timeval it_interval’
  2573. This is the period between successive timer interrupts. If
  2574. zero, the alarm will only be sent once.
  2575. ‘struct timeval it_value’
  2576. This is the period between now and the first timer interrupt.
  2577. If zero, the alarm is disabled.
  2578. The ‘struct timeval’ data type is described in *note Time Types::.
  2579. -- Function: int setitimer (int WHICH, const struct itimerval *NEW,
  2580. struct itimerval *OLD)
  2581. Preliminary: | MT-Safe timer | AS-Safe | AC-Safe | *Note POSIX
  2582. Safety Concepts::.
  2583. The ‘setitimer’ function sets the timer specified by WHICH
  2584. according to NEW. The WHICH argument can have a value of
  2585. ‘ITIMER_REAL’, ‘ITIMER_VIRTUAL’, or ‘ITIMER_PROF’.
  2586. If OLD is not a null pointer, ‘setitimer’ returns information about
  2587. any previous unexpired timer of the same kind in the structure it
  2588. points to.
  2589. The return value is ‘0’ on success and ‘-1’ on failure. The
  2590. following ‘errno’ error conditions are defined for this function:
  2591. ‘EINVAL’
  2592. The timer period is too large.
  2593. -- Function: int getitimer (int WHICH, struct itimerval *OLD)
  2594. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2595. Concepts::.
  2596. The ‘getitimer’ function stores information about the timer
  2597. specified by WHICH in the structure pointed at by OLD.
  2598. The return value and error conditions are the same as for
  2599. ‘setitimer’.
  2600. ‘ITIMER_REAL’
  2601. This constant can be used as the WHICH argument to the ‘setitimer’
  2602. and ‘getitimer’ functions to specify the real-time timer.
  2603. ‘ITIMER_VIRTUAL’
  2604. This constant can be used as the WHICH argument to the ‘setitimer’
  2605. and ‘getitimer’ functions to specify the virtual timer.
  2606. ‘ITIMER_PROF’
  2607. This constant can be used as the WHICH argument to the ‘setitimer’
  2608. and ‘getitimer’ functions to specify the profiling timer.
  2609. -- Function: unsigned int alarm (unsigned int SECONDS)
  2610. Preliminary: | MT-Safe timer | AS-Safe | AC-Safe | *Note POSIX
  2611. Safety Concepts::.
  2612. The ‘alarm’ function sets the real-time timer to expire in SECONDS
  2613. seconds. If you want to cancel any existing alarm, you can do this
  2614. by calling ‘alarm’ with a SECONDS argument of zero.
  2615. The return value indicates how many seconds remain before the
  2616. previous alarm would have been sent. If there was no previous
  2617. alarm, ‘alarm’ returns zero.
  2618. The ‘alarm’ function could be defined in terms of ‘setitimer’ like
  2619. this:
  2620. unsigned int
  2621. alarm (unsigned int seconds)
  2622. {
  2623. struct itimerval old, new;
  2624. new.it_interval.tv_usec = 0;
  2625. new.it_interval.tv_sec = 0;
  2626. new.it_value.tv_usec = 0;
  2627. new.it_value.tv_sec = (long int) seconds;
  2628. if (setitimer (ITIMER_REAL, &new, &old) < 0)
  2629. return 0;
  2630. else
  2631. return old.it_value.tv_sec;
  2632. }
  2633. There is an example showing the use of the ‘alarm’ function in *note
  2634. Handler Returns::.
  2635. If you simply want your process to wait for a given number of
  2636. seconds, you should use the ‘sleep’ function. *Note Sleeping::.
  2637. You shouldn't count on the signal arriving precisely when the timer
  2638. expires. In a multiprocessing environment there is typically some
  2639. amount of delay involved.
  2640. *Portability Note:* The ‘setitimer’ and ‘getitimer’ functions are
  2641. derived from BSD Unix, while the ‘alarm’ function is specified by POSIX.
  2642. ‘setitimer’ is more powerful than ‘alarm’, but ‘alarm’ is more widely
  2643. used.
  2644. 
  2645. File: libc.info, Node: Sleeping, Prev: Setting an Alarm, Up: Date and Time
  2646. 22.7 Sleeping
  2647. =============
  2648. The function ‘sleep’ gives a simple way to make the program wait for a
  2649. short interval. If your program doesn't use signals (except to
  2650. terminate), then you can expect ‘sleep’ to wait reliably throughout the
  2651. specified interval. Otherwise, ‘sleep’ can return sooner if a signal
  2652. arrives; if you want to wait for a given interval regardless of signals,
  2653. use ‘select’ (*note Waiting for I/O::) and don't specify any descriptors
  2654. to wait for.
  2655. -- Function: unsigned int sleep (unsigned int SECONDS)
  2656. Preliminary: | MT-Unsafe sig:SIGCHLD/linux | AS-Unsafe | AC-Unsafe
  2657. | *Note POSIX Safety Concepts::.
  2658. The ‘sleep’ function waits for SECONDS seconds or until a signal is
  2659. delivered, whichever happens first.
  2660. If ‘sleep’ returns because the requested interval is over, it
  2661. returns a value of zero. If it returns because of delivery of a
  2662. signal, its return value is the remaining time in the sleep
  2663. interval.
  2664. The ‘sleep’ function is declared in ‘unistd.h’.
  2665. Resist the temptation to implement a sleep for a fixed amount of time
  2666. by using the return value of ‘sleep’, when nonzero, to call ‘sleep’
  2667. again. This will work with a certain amount of accuracy as long as
  2668. signals arrive infrequently. But each signal can cause the eventual
  2669. wakeup time to be off by an additional second or so. Suppose a few
  2670. signals happen to arrive in rapid succession by bad luck--there is no
  2671. limit on how much this could shorten or lengthen the wait.
  2672. Instead, compute the calendar time at which the program should stop
  2673. waiting, and keep trying to wait until that calendar time. This won't
  2674. be off by more than a second. With just a little more work, you can use
  2675. ‘select’ and make the waiting period quite accurate. (Of course, heavy
  2676. system load can cause additional unavoidable delays--unless the machine
  2677. is dedicated to one application, there is no way you can avoid this.)
  2678. On some systems, ‘sleep’ can do strange things if your program uses
  2679. ‘SIGALRM’ explicitly. Even if ‘SIGALRM’ signals are being ignored or
  2680. blocked when ‘sleep’ is called, ‘sleep’ might return prematurely on
  2681. delivery of a ‘SIGALRM’ signal. If you have established a handler for
  2682. ‘SIGALRM’ signals and a ‘SIGALRM’ signal is delivered while the process
  2683. is sleeping, the action taken might be just to cause ‘sleep’ to return
  2684. instead of invoking your handler. And, if ‘sleep’ is interrupted by
  2685. delivery of a signal whose handler requests an alarm or alters the
  2686. handling of ‘SIGALRM’, this handler and ‘sleep’ will interfere.
  2687. On GNU systems, it is safe to use ‘sleep’ and ‘SIGALRM’ in the same
  2688. program, because ‘sleep’ does not work by means of ‘SIGALRM’.
  2689. -- Function: int nanosleep (const struct timespec *REQUESTED_TIME,
  2690. struct timespec *REMAINING_TIME)
  2691. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2692. Concepts::.
  2693. If resolution to seconds is not enough, the ‘nanosleep’ function
  2694. can be used. As the name suggests the sleep interval can be
  2695. specified in nanoseconds. The actual elapsed time of the sleep
  2696. interval might be longer since the system rounds the elapsed time
  2697. you request up to the next integer multiple of the actual
  2698. resolution the system can deliver.
  2699. ‘*REQUESTED_TIME’ is the elapsed time of the interval you want to
  2700. sleep.
  2701. If REMAINING_TIME is not the null pointer, the function returns as
  2702. ‘*REMAINING_TIME’ the elapsed time left in the interval for which
  2703. you requested to sleep. If the interval completed without getting
  2704. interrupted by a signal, this is zero.
  2705. ‘struct timespec’ is described in *note Time Types::.
  2706. If the function returns because the interval is over, it returns
  2707. zero. Otherwise it returns -1 and sets the global variable ‘errno’
  2708. to one of the following values:
  2709. ‘EINTR’
  2710. The call was interrupted because a signal was delivered to the
  2711. thread. If the REMAINING_TIME parameter is not the null
  2712. pointer, the structure pointed to by REMAINING_TIME is updated
  2713. to contain the remaining elapsed time.
  2714. ‘EINVAL’
  2715. The nanosecond value in the REQUESTED_TIME parameter contains
  2716. an invalid value. Either the value is negative or greater
  2717. than or equal to 1000 million.
  2718. This function is a cancellation point in multi-threaded programs.
  2719. This is a problem if the thread allocates some resources (like
  2720. memory, file descriptors, semaphores or whatever) at the time
  2721. ‘nanosleep’ is called. If the thread gets canceled, these
  2722. resources stay allocated until the program ends. To avoid this,
  2723. calls to ‘nanosleep’ should be protected using cancellation
  2724. handlers.
  2725. The ‘nanosleep’ function is declared in ‘time.h’.
  2726. -- Function: int clock_nanosleep (clockid_t CLOCK, int FLAGS, const
  2727. struct timespec *REQUESTED_TIME, struct timespec
  2728. *REMAINING_TIME)
  2729. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2730. Concepts::.
  2731. This function is similar to ‘nanosleep’ while additionally
  2732. providing the caller with a way to specify the clock to be used to
  2733. measure elapsed time and express the sleep interval in absolute or
  2734. relative terms. It returns zero when returning because the
  2735. interval is over, and a positive error number corresponding to the
  2736. error encountered otherwise. This is different from ‘nanosleep’,
  2737. which returns -1 upon failure and sets the global variable ‘errno’
  2738. according to the error encountered instead.
  2739. Except for the return value convention and the way to communicate
  2740. an error condition the call:
  2741. nanosleep (REQUESTED_TIME, REMAINING_TIME)
  2742. is analogous to:
  2743. clock_nanosleep (CLOCK_REALTIME, 0, REQUESTED_TIME, REMAINING_TIME)
  2744. The CLOCK argument specifies the clock to use. *Note Getting the
  2745. Time::, for the ‘clockid_t’ type and possible values of CLOCK. Not
  2746. all clocks listed are supported for use with ‘clock_nanosleep’.
  2747. For details, see the manual page clock_nanosleep(2) (Latest,
  2748. online:
  2749. <https://man7.org/linux/man-pages/man2/clock_nanosleep.2.html>)
  2750. *Note Linux Kernel::.
  2751. The FLAGS argument is either ‘0’ or ‘TIMER_ABSTIME’. If FLAGS is
  2752. ‘0’, then ‘clock_nanosleep’ interprets REQUESTED_TIME as an
  2753. interval relative to the current time specified by CLOCK. If it is
  2754. ‘TIMER_ABSTIME’ instead, REQUESTED_TIME specifies an absolute time
  2755. measured by CLOCK; if at the time of the call the value requested
  2756. is less than or equal to the clock specified, then the function
  2757. returns right away. When FLAGS is ‘TIMER_ABSTIME’, REMAINING_TIME
  2758. is not updated.
  2759. The ‘clock_nanosleep’ function returns error codes as positive
  2760. return values. The error conditions for ‘clock_nanosleep’ are the
  2761. same as for ‘nanosleep’, with the following conditions additionally
  2762. defined:
  2763. ‘EINVAL’
  2764. The CLOCK argument is not a valid clock.
  2765. ‘EOPNOTSUPP’
  2766. The CLOCK argument is not supported by the kernel for
  2767. ‘clock_nanosleep’.
  2768. The ‘clock_nanosleep’ function is declared in ‘time.h’.
  2769. 
  2770. File: libc.info, Node: Resource Usage And Limitation, Next: Non-Local Exits, Prev: Date and Time, Up: Top
  2771. 23 Resource Usage And Limitation
  2772. ********************************
  2773. This chapter describes functions for examining how much of various kinds
  2774. of resources (CPU time, memory, etc.) a process has used and getting
  2775. and setting limits on future usage.
  2776. * Menu:
  2777. * Resource Usage:: Measuring various resources used.
  2778. * Limits on Resources:: Specifying limits on resource usage.
  2779. * Priority:: Reading or setting process run priority.
  2780. * Memory Resources:: Querying memory available resources.
  2781. * Processor Resources:: Learn about the processors available.
  2782. 
  2783. File: libc.info, Node: Resource Usage, Next: Limits on Resources, Up: Resource Usage And Limitation
  2784. 23.1 Resource Usage
  2785. ===================
  2786. The function ‘getrusage’ and the data type ‘struct rusage’ are used to
  2787. examine the resource usage of a process. They are declared in
  2788. ‘sys/resource.h’.
  2789. -- Function: int getrusage (int PROCESSES, struct rusage *RUSAGE)
  2790. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2791. Concepts::.
  2792. This function reports resource usage totals for processes specified
  2793. by PROCESSES, storing the information in ‘*RUSAGE’.
  2794. In most systems, PROCESSES has only two valid values:
  2795. ‘RUSAGE_SELF’
  2796. Just the current process.
  2797. ‘RUSAGE_CHILDREN’
  2798. All child processes (direct and indirect) that have already
  2799. terminated.
  2800. The return value of ‘getrusage’ is zero for success, and ‘-1’ for
  2801. failure.
  2802. ‘EINVAL’
  2803. The argument PROCESSES is not valid.
  2804. One way of getting resource usage for a particular child process is
  2805. with the function ‘wait4’, which returns totals for a child when it
  2806. terminates. *Note BSD Wait Functions::.
  2807. -- Data Type: struct rusage
  2808. This data type stores various resource usage statistics. It has
  2809. the following members, and possibly others:
  2810. ‘struct timeval ru_utime’
  2811. Time spent executing user instructions.
  2812. ‘struct timeval ru_stime’
  2813. Time spent in operating system code on behalf of PROCESSES.
  2814. ‘long int ru_maxrss’
  2815. The maximum resident set size used, in kilobytes. That is,
  2816. the maximum number of kilobytes of physical memory that
  2817. PROCESSES used simultaneously.
  2818. ‘long int ru_ixrss’
  2819. An integral value expressed in kilobytes times ticks of
  2820. execution, which indicates the amount of memory used by text
  2821. that was shared with other processes.
  2822. ‘long int ru_idrss’
  2823. An integral value expressed the same way, which is the amount
  2824. of unshared memory used for data.
  2825. ‘long int ru_isrss’
  2826. An integral value expressed the same way, which is the amount
  2827. of unshared memory used for stack space.
  2828. ‘long int ru_minflt’
  2829. The number of page faults which were serviced without
  2830. requiring any I/O.
  2831. ‘long int ru_majflt’
  2832. The number of page faults which were serviced by doing I/O.
  2833. ‘long int ru_nswap’
  2834. The number of times PROCESSES was swapped entirely out of main
  2835. memory.
  2836. ‘long int ru_inblock’
  2837. The number of times the file system had to read from the disk
  2838. on behalf of PROCESSES.
  2839. ‘long int ru_oublock’
  2840. The number of times the file system had to write to the disk
  2841. on behalf of PROCESSES.
  2842. ‘long int ru_msgsnd’
  2843. Number of IPC messages sent.
  2844. ‘long int ru_msgrcv’
  2845. Number of IPC messages received.
  2846. ‘long int ru_nsignals’
  2847. Number of signals received.
  2848. ‘long int ru_nvcsw’
  2849. The number of times PROCESSES voluntarily invoked a context
  2850. switch (usually to wait for some service).
  2851. ‘long int ru_nivcsw’
  2852. The number of times an involuntary context switch took place
  2853. (because a time slice expired, or another process of higher
  2854. priority was scheduled).
  2855. 
  2856. File: libc.info, Node: Limits on Resources, Next: Priority, Prev: Resource Usage, Up: Resource Usage And Limitation
  2857. 23.2 Limiting Resource Usage
  2858. ============================
  2859. You can specify limits for the resource usage of a process. When the
  2860. process tries to exceed a limit, it may get a signal, or the system call
  2861. by which it tried to do so may fail, depending on the resource. Each
  2862. process initially inherits its limit values from its parent, but it can
  2863. subsequently change them.
  2864. There are two per-process limits associated with a resource:
  2865. “current limit”
  2866. The current limit is the value the system will not allow usage to
  2867. exceed. It is also called the "soft limit" because the process
  2868. being limited can generally raise the current limit at will.
  2869. “maximum limit”
  2870. The maximum limit is the maximum value to which a process is
  2871. allowed to set its current limit. It is also called the "hard
  2872. limit" because there is no way for a process to get around it. A
  2873. process may lower its own maximum limit, but only the superuser may
  2874. increase a maximum limit.
  2875. The symbols for use with ‘getrlimit’, ‘setrlimit’, ‘getrlimit64’, and
  2876. ‘setrlimit64’ are defined in ‘sys/resource.h’.
  2877. -- Function: int getrlimit (int RESOURCE, struct rlimit *RLP)
  2878. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2879. Concepts::.
  2880. Read the current and maximum limits for the resource RESOURCE and
  2881. store them in ‘*RLP’.
  2882. The return value is ‘0’ on success and ‘-1’ on failure. The only
  2883. possible ‘errno’ error condition is ‘EFAULT’.
  2884. When the sources are compiled with ‘_FILE_OFFSET_BITS == 64’ on a
  2885. 32-bit system this function is in fact ‘getrlimit64’. Thus, the
  2886. LFS interface transparently replaces the old interface.
  2887. -- Function: int getrlimit64 (int RESOURCE, struct rlimit64 *RLP)
  2888. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2889. Concepts::.
  2890. This function is similar to ‘getrlimit’ but its second parameter is
  2891. a pointer to a variable of type ‘struct rlimit64’, which allows it
  2892. to read values which wouldn't fit in the member of a ‘struct
  2893. rlimit’.
  2894. If the sources are compiled with ‘_FILE_OFFSET_BITS == 64’ on a
  2895. 32-bit machine, this function is available under the name
  2896. ‘getrlimit’ and so transparently replaces the old interface.
  2897. -- Function: int setrlimit (int RESOURCE, const struct rlimit *RLP)
  2898. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2899. Concepts::.
  2900. Change the current and maximum limits of the process for the
  2901. resource RESOURCE to the values provided in ‘*RLP’.
  2902. The return value is ‘0’ on success and ‘-1’ on failure. The
  2903. following ‘errno’ error condition is possible:
  2904. ‘EPERM’
  2905. • The process tried to raise a current limit beyond the
  2906. maximum limit.
  2907. • The process tried to raise a maximum limit, but is not
  2908. superuser.
  2909. When the sources are compiled with ‘_FILE_OFFSET_BITS == 64’ on a
  2910. 32-bit system this function is in fact ‘setrlimit64’. Thus, the
  2911. LFS interface transparently replaces the old interface.
  2912. -- Function: int setrlimit64 (int RESOURCE, const struct rlimit64 *RLP)
  2913. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2914. Concepts::.
  2915. This function is similar to ‘setrlimit’ but its second parameter is
  2916. a pointer to a variable of type ‘struct rlimit64’ which allows it
  2917. to set values which wouldn't fit in the member of a ‘struct
  2918. rlimit’.
  2919. If the sources are compiled with ‘_FILE_OFFSET_BITS == 64’ on a
  2920. 32-bit machine this function is available under the name
  2921. ‘setrlimit’ and so transparently replaces the old interface.
  2922. -- Data Type: struct rlimit
  2923. This structure is used with ‘getrlimit’ to receive limit values,
  2924. and with ‘setrlimit’ to specify limit values for a particular
  2925. process and resource. It has two fields:
  2926. ‘rlim_t rlim_cur’
  2927. The current limit
  2928. ‘rlim_t rlim_max’
  2929. The maximum limit.
  2930. For ‘getrlimit’, the structure is an output; it receives the
  2931. current values. For ‘setrlimit’, it specifies the new values.
  2932. For the LFS functions a similar type is defined in ‘sys/resource.h’.
  2933. -- Data Type: struct rlimit64
  2934. This structure is analogous to the ‘rlimit’ structure above, but
  2935. its components have wider ranges. It has two fields:
  2936. ‘rlim64_t rlim_cur’
  2937. This is analogous to ‘rlimit.rlim_cur’, but with a different
  2938. type.
  2939. ‘rlim64_t rlim_max’
  2940. This is analogous to ‘rlimit.rlim_max’, but with a different
  2941. type.
  2942. Here is a list of resources for which you can specify a limit.
  2943. Memory and file sizes are measured in bytes.
  2944. ‘RLIMIT_CPU’
  2945. The maximum amount of CPU time the process can use. If it runs for
  2946. longer than this, it gets a signal: ‘SIGXCPU’. The value is
  2947. measured in seconds. *Note Operation Error Signals::.
  2948. ‘RLIMIT_FSIZE’
  2949. The maximum size of file the process can create. Trying to write a
  2950. larger file causes a signal: ‘SIGXFSZ’. *Note Operation Error
  2951. Signals::.
  2952. ‘RLIMIT_DATA’
  2953. The maximum size of data memory for the process. If the process
  2954. tries to allocate data memory beyond this amount, the allocation
  2955. function fails.
  2956. ‘RLIMIT_STACK’
  2957. The maximum stack size for the process. If the process tries to
  2958. extend its stack past this size, it gets a ‘SIGSEGV’ signal. *Note
  2959. Program Error Signals::.
  2960. ‘RLIMIT_CORE’
  2961. The maximum size core file that this process can create. If the
  2962. process terminates and would dump a core file larger than this,
  2963. then no core file is created. So setting this limit to zero
  2964. prevents core files from ever being created.
  2965. ‘RLIMIT_RSS’
  2966. The maximum amount of physical memory that this process should get.
  2967. This parameter is a guide for the system's scheduler and memory
  2968. allocator; the system may give the process more memory when there
  2969. is a surplus.
  2970. ‘RLIMIT_MEMLOCK’
  2971. The maximum amount of memory that can be locked into physical
  2972. memory (so it will never be paged out).
  2973. ‘RLIMIT_NPROC’
  2974. The maximum number of processes that can be created with the same
  2975. user ID. If you have reached the limit for your user ID, ‘fork’
  2976. will fail with ‘EAGAIN’. *Note Creating a Process::.
  2977. ‘RLIMIT_NOFILE’
  2978. ‘RLIMIT_OFILE’
  2979. The maximum number of files that the process can open. If it tries
  2980. to open more files than this, its open attempt fails with ‘errno’
  2981. ‘EMFILE’. *Note Error Codes::. Not all systems support this
  2982. limit; GNU does, and 4.4 BSD does.
  2983. ‘RLIMIT_AS’
  2984. The maximum size of total memory that this process should get. If
  2985. the process tries to allocate more memory beyond this amount with,
  2986. for example, ‘brk’, ‘malloc’, ‘mmap’ or ‘sbrk’, the allocation
  2987. function fails.
  2988. ‘RLIM_NLIMITS’
  2989. The number of different resource limits. Any valid RESOURCE
  2990. operand must be less than ‘RLIM_NLIMITS’.
  2991. -- Constant: rlim_t RLIM_INFINITY
  2992. This constant stands for a value of "infinity" when supplied as the
  2993. limit value in ‘setrlimit’.
  2994. The following are historical functions to do some of what the
  2995. functions above do. The functions above are better choices.
  2996. ‘ulimit’ and the command symbols are declared in ‘ulimit.h’.
  2997. -- Function: long int ulimit (int CMD, ...)
  2998. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2999. Concepts::.
  3000. ‘ulimit’ gets the current limit or sets the current and maximum
  3001. limit for a particular resource for the calling process according
  3002. to the command CMD.
  3003. If you are getting a limit, the command argument is the only
  3004. argument. If you are setting a limit, there is a second argument:
  3005. ‘long int’ LIMIT which is the value to which you are setting the
  3006. limit.
  3007. The CMD values and the operations they specify are:
  3008. ‘GETFSIZE’
  3009. Get the current limit on the size of a file, in units of 512
  3010. bytes.
  3011. ‘SETFSIZE’
  3012. Set the current and maximum limit on the size of a file to
  3013. LIMIT * 512 bytes.
  3014. There are also some other CMD values that may do things on some
  3015. systems, but they are not supported.
  3016. Only the superuser may increase a maximum limit.
  3017. When you successfully get a limit, the return value of ‘ulimit’ is
  3018. that limit, which is never negative. When you successfully set a
  3019. limit, the return value is zero. When the function fails, the
  3020. return value is ‘-1’ and ‘errno’ is set according to the reason:
  3021. ‘EPERM’
  3022. A process tried to increase a maximum limit, but is not
  3023. superuser.
  3024. ‘vlimit’ and its resource symbols are declared in ‘sys/vlimit.h’.
  3025. -- Function: int vlimit (int RESOURCE, int LIMIT)
  3026. Preliminary: | MT-Unsafe race:setrlimit | AS-Unsafe | AC-Safe |
  3027. *Note POSIX Safety Concepts::.
  3028. ‘vlimit’ sets the current limit for a resource for a process.
  3029. RESOURCE identifies the resource:
  3030. ‘LIM_CPU’
  3031. Maximum CPU time. Same as ‘RLIMIT_CPU’ for ‘setrlimit’.
  3032. ‘LIM_FSIZE’
  3033. Maximum file size. Same as ‘RLIMIT_FSIZE’ for ‘setrlimit’.
  3034. ‘LIM_DATA’
  3035. Maximum data memory. Same as ‘RLIMIT_DATA’ for ‘setrlimit’.
  3036. ‘LIM_STACK’
  3037. Maximum stack size. Same as ‘RLIMIT_STACK’ for ‘setrlimit’.
  3038. ‘LIM_CORE’
  3039. Maximum core file size. Same as ‘RLIMIT_COR’ for ‘setrlimit’.
  3040. ‘LIM_MAXRSS’
  3041. Maximum physical memory. Same as ‘RLIMIT_RSS’ for
  3042. ‘setrlimit’.
  3043. The return value is zero for success, and ‘-1’ with ‘errno’ set
  3044. accordingly for failure:
  3045. ‘EPERM’
  3046. The process tried to set its current limit beyond its maximum
  3047. limit.
  3048. 
  3049. File: libc.info, Node: Priority, Next: Memory Resources, Prev: Limits on Resources, Up: Resource Usage And Limitation
  3050. 23.3 Process CPU Priority And Scheduling
  3051. ========================================
  3052. When multiple processes simultaneously require CPU time, the system's
  3053. scheduling policy and process CPU priorities determine which processes
  3054. get it. This section describes how that determination is made and GNU C
  3055. Library functions to control it.
  3056. It is common to refer to CPU scheduling simply as scheduling and a
  3057. process' CPU priority simply as the process' priority, with the CPU
  3058. resource being implied. Bear in mind, though, that CPU time is not the
  3059. only resource a process uses or that processes contend for. In some
  3060. cases, it is not even particularly important. Giving a process a high
  3061. "priority" may have very little effect on how fast a process runs with
  3062. respect to other processes. The priorities discussed in this section
  3063. apply only to CPU time.
  3064. CPU scheduling is a complex issue and different systems do it in
  3065. wildly different ways. New ideas continually develop and find their way
  3066. into the intricacies of the various systems' scheduling algorithms.
  3067. This section discusses the general concepts, some specifics of systems
  3068. that commonly use the GNU C Library, and some standards.
  3069. For simplicity, we talk about CPU contention as if there is only one
  3070. CPU in the system. But all the same principles apply when a processor
  3071. has multiple CPUs, and knowing that the number of processes that can run
  3072. at any one time is equal to the number of CPUs, you can easily
  3073. extrapolate the information.
  3074. The functions described in this section are all defined by the
  3075. POSIX.1 and POSIX.1b standards (the ‘sched...’ functions are POSIX.1b).
  3076. However, POSIX does not define any semantics for the values that these
  3077. functions get and set. In this chapter, the semantics are based on the
  3078. Linux kernel's implementation of the POSIX standard. As you will see,
  3079. the Linux implementation is quite the inverse of what the authors of the
  3080. POSIX syntax had in mind.
  3081. * Menu:
  3082. * Absolute Priority:: The first tier of priority. Posix
  3083. * Realtime Scheduling:: Scheduling among the process nobility
  3084. * Basic Scheduling Functions:: Get/set scheduling policy, priority
  3085. * Extensible Scheduling:: Parameterized scheduling policies.
  3086. * Traditional Scheduling:: Scheduling among the vulgar masses
  3087. * CPU Affinity:: Limiting execution to certain CPUs
  3088. 
  3089. File: libc.info, Node: Absolute Priority, Next: Realtime Scheduling, Up: Priority
  3090. 23.3.1 Absolute Priority
  3091. ------------------------
  3092. Every process has an absolute priority, and it is represented by a
  3093. number. The higher the number, the higher the absolute priority.
  3094. On systems of the past, and most systems today, all processes have
  3095. absolute priority 0 and this section is irrelevant. In that case, *Note
  3096. Traditional Scheduling::. Absolute priorities were invented to
  3097. accommodate realtime systems, in which it is vital that certain
  3098. processes be able to respond to external events happening in real time,
  3099. which means they cannot wait around while some other process that _wants
  3100. to_, but doesn't _need to_ run occupies the CPU.
  3101. When two processes are in contention to use the CPU at any instant,
  3102. the one with the higher absolute priority always gets it. This is true
  3103. even if the process with the lower priority is already using the CPU
  3104. (i.e., the scheduling is preemptive). Of course, we're only talking
  3105. about processes that are running or "ready to run," which means they are
  3106. ready to execute instructions right now. When a process blocks to wait
  3107. for something like I/O, its absolute priority is irrelevant.
  3108. *NB:* The term "runnable" is a synonym for "ready to run."
  3109. When two processes are running or ready to run and both have the same
  3110. absolute priority, it's more interesting. In that case, who gets the
  3111. CPU is determined by the scheduling policy. If the processes have
  3112. absolute priority 0, the traditional scheduling policy described in
  3113. *note Traditional Scheduling:: applies. Otherwise, the policies
  3114. described in *note Realtime Scheduling:: apply.
  3115. You normally give an absolute priority above 0 only to a process that
  3116. can be trusted not to hog the CPU. Such processes are designed to block
  3117. (or terminate) after relatively short CPU runs.
  3118. A process begins life with the same absolute priority as its parent
  3119. process. Functions described in *note Basic Scheduling Functions:: can
  3120. change it.
  3121. Only a privileged process can change a process' absolute priority to
  3122. something other than ‘0’. Only a privileged process or the target
  3123. process' owner can change its absolute priority at all.
  3124. POSIX requires absolute priority values used with the realtime
  3125. scheduling policies to be consecutive with a range of at least 32. On
  3126. Linux, they are 1 through 99. The functions ‘sched_get_priority_max’
  3127. and ‘sched_set_priority_min’ portably tell you what the range is on a
  3128. particular system.
  3129. 23.3.1.1 Using Absolute Priority
  3130. ................................
  3131. One thing you must keep in mind when designing real time applications is
  3132. that having higher absolute priority than any other process doesn't
  3133. guarantee the process can run continuously. Two things that can wreck a
  3134. good CPU run are interrupts and page faults.
  3135. Interrupt handlers live in that limbo between processes. The CPU is
  3136. executing instructions, but they aren't part of any process. An
  3137. interrupt will stop even the highest priority process. So you must
  3138. allow for slight delays and make sure that no device in the system has
  3139. an interrupt handler that could cause too long a delay between
  3140. instructions for your process.
  3141. Similarly, a page fault causes what looks like a straightforward
  3142. sequence of instructions to take a long time. The fact that other
  3143. processes get to run while the page faults in is of no consequence,
  3144. because as soon as the I/O is complete, the higher priority process will
  3145. kick them out and run again, but the wait for the I/O itself could be a
  3146. problem. To neutralize this threat, use ‘mlock’ or ‘mlockall’.
  3147. There are a few ramifications of the absoluteness of this priority on
  3148. a single-CPU system that you need to keep in mind when you choose to set
  3149. a priority and also when you're working on a program that runs with high
  3150. absolute priority. Consider a process that has higher absolute priority
  3151. than any other process in the system and due to a bug in its program, it
  3152. gets into an infinite loop. It will never cede the CPU. You can't run a
  3153. command to kill it because your command would need to get the CPU in
  3154. order to run. The errant program is in complete control. It controls
  3155. the vertical, it controls the horizontal.
  3156. There are two ways to avoid this: 1) keep a shell running somewhere
  3157. with a higher absolute priority or 2) keep a controlling terminal
  3158. attached to the high priority process group. All the priority in the
  3159. world won't stop an interrupt handler from running and delivering a
  3160. signal to the process if you hit Control-C.
  3161. Some systems use absolute priority as a means of allocating a fixed
  3162. percentage of CPU time to a process. To do this, a super high priority
  3163. privileged process constantly monitors the process' CPU usage and raises
  3164. its absolute priority when the process isn't getting its entitled share
  3165. and lowers it when the process is exceeding it.
  3166. *NB:* The absolute priority is sometimes called the "static
  3167. priority." We don't use that term in this manual because it misses the
  3168. most important feature of the absolute priority: its absoluteness.
  3169. 
  3170. File: libc.info, Node: Realtime Scheduling, Next: Basic Scheduling Functions, Prev: Absolute Priority, Up: Priority
  3171. 23.3.2 Realtime Scheduling
  3172. --------------------------
  3173. Whenever two processes with the same absolute priority are ready to run,
  3174. the kernel has a decision to make, because only one can run at a time.
  3175. If the processes have absolute priority 0, the kernel makes this
  3176. decision as described in *note Traditional Scheduling::. Otherwise, the
  3177. decision is as described in this section.
  3178. If two processes are ready to run but have different absolute
  3179. priorities, the decision is much simpler, and is described in *note
  3180. Absolute Priority::.
  3181. Each process has a scheduling policy. For processes with absolute
  3182. priority other than zero, there are two available:
  3183. 1. First Come First Served
  3184. 2. Round Robin
  3185. The most sensible case is where all the processes with a certain
  3186. absolute priority have the same scheduling policy. We'll discuss that
  3187. first.
  3188. In Round Robin, processes share the CPU, each one running for a small
  3189. quantum of time ("time slice") and then yielding to another in a
  3190. circular fashion. Of course, only processes that are ready to run and
  3191. have the same absolute priority are in this circle.
  3192. In First Come First Served, the process that has been waiting the
  3193. longest to run gets the CPU, and it keeps it until it voluntarily
  3194. relinquishes the CPU, runs out of things to do (blocks), or gets
  3195. preempted by a higher priority process.
  3196. First Come First Served, along with maximal absolute priority and
  3197. careful control of interrupts and page faults, is the one to use when a
  3198. process absolutely, positively has to run at full CPU speed or not at
  3199. all.
  3200. Judicious use of ‘sched_yield’ function invocations by processes with
  3201. First Come First Served scheduling policy forms a good compromise
  3202. between Round Robin and First Come First Served.
  3203. To understand how scheduling works when processes of different
  3204. scheduling policies occupy the same absolute priority, you have to know
  3205. the nitty gritty details of how processes enter and exit the ready to
  3206. run list.
  3207. In both cases, the ready to run list is organized as a true queue,
  3208. where a process gets pushed onto the tail when it becomes ready to run
  3209. and is popped off the head when the scheduler decides to run it. Note
  3210. that ready to run and running are two mutually exclusive states. When
  3211. the scheduler runs a process, that process is no longer ready to run and
  3212. no longer in the ready to run list. When the process stops running, it
  3213. may go back to being ready to run again.
  3214. The only difference between a process that is assigned the Round
  3215. Robin scheduling policy and a process that is assigned First Come First
  3216. Serve is that in the former case, the process is automatically booted
  3217. off the CPU after a certain amount of time. When that happens, the
  3218. process goes back to being ready to run, which means it enters the queue
  3219. at the tail. The time quantum we're talking about is small. Really
  3220. small. This is not your father's timesharing. For example, with the
  3221. Linux kernel, the round robin time slice is a thousand times shorter
  3222. than its typical time slice for traditional scheduling.
  3223. A process begins life with the same scheduling policy as its parent
  3224. process. Functions described in *note Basic Scheduling Functions:: can
  3225. change it.
  3226. Only a privileged process can set the scheduling policy of a process
  3227. that has absolute priority higher than 0.
  3228. 
  3229. File: libc.info, Node: Basic Scheduling Functions, Next: Extensible Scheduling, Prev: Realtime Scheduling, Up: Priority
  3230. 23.3.3 Basic Scheduling Functions
  3231. ---------------------------------
  3232. This section describes functions in the GNU C Library for setting the
  3233. absolute priority and scheduling policy of a process.
  3234. *Portability Note:* On systems that have the functions in this
  3235. section, the macro _POSIX_PRIORITY_SCHEDULING is defined in
  3236. ‘<unistd.h>’.
  3237. For the case that the scheduling policy is traditional scheduling,
  3238. more functions to fine tune the scheduling are in *note Traditional
  3239. Scheduling::.
  3240. Don't try to make too much out of the naming and structure of these
  3241. functions. They don't match the concepts described in this manual
  3242. because the functions are as defined by POSIX.1b, but the implementation
  3243. on systems that use the GNU C Library is the inverse of what the POSIX
  3244. structure contemplates. The POSIX scheme assumes that the primary
  3245. scheduling parameter is the scheduling policy and that the priority
  3246. value, if any, is a parameter of the scheduling policy. In the
  3247. implementation, though, the priority value is king and the scheduling
  3248. policy, if anything, only fine tunes the effect of that priority.
  3249. The symbols in this section are declared by including file ‘sched.h’.
  3250. *Portability Note:* In POSIX, the ‘pid_t’ arguments of the functions
  3251. below refer to process IDs. On Linux, they are actually thread IDs, and
  3252. control how specific threads are scheduled with regards to the entire
  3253. system. The resulting behavior does not conform to POSIX. This is why
  3254. the following description refers to tasks and tasks IDs, and not
  3255. processes and process IDs.
  3256. -- Data Type: struct sched_param
  3257. This structure describes an absolute priority.
  3258. ‘int sched_priority’
  3259. absolute priority value
  3260. -- Function: int sched_setscheduler (pid_t PID, int POLICY, const
  3261. struct sched_param *PARAM)
  3262. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3263. Concepts::.
  3264. This function sets both the absolute priority and the scheduling
  3265. policy for a task.
  3266. It assigns the absolute priority value given by PARAM and the
  3267. scheduling policy POLICY to the task with ID PID, or the calling
  3268. task if PID is zero. If POLICY is negative, ‘sched_setscheduler’
  3269. keeps the existing scheduling policy.
  3270. The following macros represent the valid values for POLICY:
  3271. ‘SCHED_OTHER’
  3272. Traditional Scheduling
  3273. ‘SCHED_FIFO’
  3274. First In First Out
  3275. ‘SCHED_RR’
  3276. Round Robin
  3277. On success, the return value is ‘0’. Otherwise, it is ‘-1’ and
  3278. ‘ERRNO’ is set accordingly. The ‘errno’ values specific to this
  3279. function are:
  3280. ‘EPERM’
  3281. • The calling task does not have ‘CAP_SYS_NICE’ permission
  3282. and POLICY is not ‘SCHED_OTHER’ (or it's negative and the
  3283. existing policy is not ‘SCHED_OTHER’.
  3284. • The calling task does not have ‘CAP_SYS_NICE’ permission
  3285. and its owner is not the target task's owner. I.e., the
  3286. effective uid of the calling task is neither the
  3287. effective nor the real uid of task PID.
  3288. ‘ESRCH’
  3289. There is no task with pid PID and PID is not zero.
  3290. ‘EINVAL’
  3291. • POLICY does not identify an existing scheduling policy.
  3292. • The absolute priority value identified by *PARAM is
  3293. outside the valid range for the scheduling policy POLICY
  3294. (or the existing scheduling policy if POLICY is negative)
  3295. or PARAM is null. ‘sched_get_priority_max’ and
  3296. ‘sched_get_priority_min’ tell you what the valid range
  3297. is.
  3298. • PID is negative.
  3299. -- Function: int sched_getscheduler (pid_t PID)
  3300. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3301. Concepts::.
  3302. This function returns the scheduling policy assigned to the task
  3303. with ID PID, or the calling task if PID is zero.
  3304. The return value is the scheduling policy. See
  3305. ‘sched_setscheduler’ for the possible values.
  3306. If the function fails, the return value is instead ‘-1’ and ‘errno’
  3307. is set accordingly.
  3308. The ‘errno’ values specific to this function are:
  3309. ‘ESRCH’
  3310. There is no task with pid PID and it is not zero.
  3311. ‘EINVAL’
  3312. PID is negative.
  3313. Note that this function is not an exact mate to
  3314. ‘sched_setscheduler’ because while that function sets the
  3315. scheduling policy and the absolute priority, this function gets
  3316. only the scheduling policy. To get the absolute priority, use
  3317. ‘sched_getparam’.
  3318. -- Function: int sched_setparam (pid_t PID, const struct sched_param
  3319. *PARAM)
  3320. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3321. Concepts::.
  3322. This function sets a task's absolute priority.
  3323. It is functionally identical to ‘sched_setscheduler’ with POLICY =
  3324. ‘-1’.
  3325. -- Function: int sched_getparam (pid_t PID, struct sched_param *PARAM)
  3326. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3327. Concepts::.
  3328. This function returns a task's absolute priority.
  3329. PID is the task ID of the task whose absolute priority you want to
  3330. know.
  3331. PARAM is a pointer to a structure in which the function stores the
  3332. absolute priority of the task.
  3333. On success, the return value is ‘0’. Otherwise, it is ‘-1’ and
  3334. ‘errno’ is set accordingly. The ‘errno’ values specific to this
  3335. function are:
  3336. ‘ESRCH’
  3337. There is no task with ID PID and it is not zero.
  3338. ‘EINVAL’
  3339. PID is negative.
  3340. -- Function: int sched_get_priority_min (int POLICY)
  3341. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3342. Concepts::.
  3343. This function returns the lowest absolute priority value that is
  3344. allowable for a task with scheduling policy POLICY.
  3345. On Linux, it is 0 for SCHED_OTHER and 1 for everything else.
  3346. On success, the return value is ‘0’. Otherwise, it is ‘-1’ and
  3347. ‘ERRNO’ is set accordingly. The ‘errno’ values specific to this
  3348. function are:
  3349. ‘EINVAL’
  3350. POLICY does not identify an existing scheduling policy.
  3351. -- Function: int sched_get_priority_max (int POLICY)
  3352. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3353. Concepts::.
  3354. This function returns the highest absolute priority value that is
  3355. allowable for a task that with scheduling policy POLICY.
  3356. On Linux, it is 0 for SCHED_OTHER and 99 for everything else.
  3357. On success, the return value is ‘0’. Otherwise, it is ‘-1’ and
  3358. ‘ERRNO’ is set accordingly. The ‘errno’ values specific to this
  3359. function are:
  3360. ‘EINVAL’
  3361. POLICY does not identify an existing scheduling policy.
  3362. -- Function: int sched_rr_get_interval (pid_t PID, struct timespec
  3363. *INTERVAL)
  3364. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3365. Concepts::.
  3366. This function returns the length of the quantum (time slice) used
  3367. with the Round Robin scheduling policy, if it is used, for the task
  3368. with task ID PID.
  3369. It returns the length of time as INTERVAL.
  3370. With a Linux kernel, the round robin time slice is always 150
  3371. microseconds, and PID need not even be a real pid.
  3372. The return value is ‘0’ on success and in the pathological case
  3373. that it fails, the return value is ‘-1’ and ‘errno’ is set
  3374. accordingly. There is nothing specific that can go wrong with this
  3375. function, so there are no specific ‘errno’ values.
  3376. -- Function: int sched_yield (void)
  3377. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3378. Concepts::.
  3379. This function voluntarily gives up the task's claim on the CPU.
  3380. Depending on the scheduling policy in effect and the tasks ready to
  3381. run on the system, another task may be scheduled to run instead.
  3382. A call to ‘sched_yield’ does not guarantee that a different task
  3383. from the calling task is scheduled as a result; it depends on the
  3384. scheduling policy used on the target system. It is possible that
  3385. the call may not result in any visible effect, i.e., the same task
  3386. gets scheduled again.
  3387. For example on Linux systems, when a simple priority-based FIFO
  3388. scheduling policy (‘SCHED_FIFO’) is in effect, the calling task is
  3389. made immediately ready to run (as opposed to running, which is what
  3390. it was before). This means that if it has absolute priority higher
  3391. than 0, it gets pushed onto the tail of the queue of tasks that
  3392. share its absolute priority and are ready to run, and it will run
  3393. again when its turn next arrives. If its absolute priority is 0,
  3394. it is more complicated, but still has the effect of yielding the
  3395. CPU to other tasks. If there are no other tasks that share the
  3396. calling task's absolute priority, it will be scheduled again as if
  3397. ‘sched_yield’ was never called.
  3398. Another example could be a time slice based preemptive round-robin
  3399. policy, such as the ‘SCHED_RR’ policy on Linux. It is possible
  3400. with this policy that the calling task is scheduled again because
  3401. it still has time left in its slice.
  3402. To the extent that the containing program is oblivious to what
  3403. other processes in the system are doing and how fast it executes,
  3404. this function appears as a no-op.
  3405. The return value is ‘0’ on success and in the pathological case
  3406. that it fails, the return value is ‘-1’ and ‘errno’ is set
  3407. accordingly. There is nothing specific that can go wrong with this
  3408. function, so there are no specific ‘errno’ values.
  3409. 
  3410. File: libc.info, Node: Extensible Scheduling, Next: Traditional Scheduling, Prev: Basic Scheduling Functions, Up: Priority
  3411. 23.3.4 Extensible Scheduling
  3412. ----------------------------
  3413. The type ‘struct sched_attr’ and the functions ‘sched_setattr’ and
  3414. ‘sched_getattr’ are used to implement scheduling policies with multiple
  3415. parameters (not just priority and niceness).
  3416. It is expected that these interfaces will be compatible with all
  3417. future scheduling policies.
  3418. For additional information about scheduling policies, consult the
  3419. manual pages sched(7) (Latest, online:
  3420. <https://man7.org/linux/man-pages/man7/sched.7.html>) *Note Linux
  3421. Kernel:: and sched_setattr(2) (Latest, online:
  3422. <https://man7.org/linux/man-pages/man2/sched_setattr.2.html>) *Note
  3423. Linux Kernel::.
  3424. *Note:* Calling the ‘sched_setattr’ function is incompatible with
  3425. support for ‘PTHREAD_PRIO_PROTECT’ mutexes.
  3426. -- Data Type: struct sched_attr
  3427. The ‘sched_attr’ structure describes a parameterized scheduling
  3428. policy.
  3429. *Portability note:* In the future, additional fields can be added
  3430. to ‘struct sched_attr’ at the end, so that the size of this data
  3431. type changes. Do not use it in places where this matters, such as
  3432. structure fields in installed header files, where such a change
  3433. could impact the application binary interface (ABI).
  3434. The following generic fields are available.
  3435. ‘size’
  3436. The actually used size of the data structure. See the
  3437. description of the functions ‘sched_setattr’ and
  3438. ‘sched_getattr’ below how this field is used to support
  3439. extension of ‘struct sched_attr’ with more fields.
  3440. ‘sched_policy’
  3441. The scheduling policy. This field determines which fields in
  3442. the structure are used, and how the ‘sched_flags’ field is
  3443. interpreted.
  3444. ‘sched_flags’
  3445. Scheduling flags associated with the scheduling policy.
  3446. In addition to the generic fields, policy-specific fields are
  3447. available. For additional information, consult the manual page
  3448. sched_setattr(2) (Latest, online:
  3449. <https://man7.org/linux/man-pages/man2/sched_setattr.2.html>) *Note
  3450. Linux Kernel::.
  3451. -- Function: int sched_setattr (pid_t TID, struct sched_attr *ATTR,
  3452. unsigned int flags)
  3453. | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::.
  3454. This functions applies the scheduling policy described by ‘*ATTR’
  3455. to the thread TID (the value zero denotes the current thread).
  3456. It is recommended to initialize unused fields to zero, either using
  3457. ‘memset’, or using a structure initializer. The ‘ATTR->SIZE’ field
  3458. should be set to ‘sizeof (struct sched_attr)’, to inform the kernel
  3459. of the structure version in use.
  3460. The FLAGS argument must be zero. Other values may become available
  3461. in the future.
  3462. On failure, ‘sched_setattr’ returns -1 and sets ‘errno’. The
  3463. following errors are related the way extensibility is handled.
  3464. ‘E2BIG’
  3465. A field in ‘*ATTR’ has a non-zero value, but is unknown to the
  3466. kernel. The application could try to apply a modified policy,
  3467. where more fields are zero.
  3468. ‘EINVAL’
  3469. The policy in ‘ATTR->sched_policy’ is unknown to the kernel,
  3470. or flags are set in ‘ATTR->sched_flags’ that the kernel does
  3471. not know how to interpret. The application could try with
  3472. fewer flags set, or a different scheduling policy.
  3473. This error also occurs if ATTR is ‘NULL’ or FLAGS is not zero.
  3474. ‘EPERM’
  3475. The current thread is not sufficiently privileged to assign
  3476. the policy, either because access to the policy is restricted
  3477. in general, or because the current thread does not have the
  3478. rights to change the scheduling policy of the thread TID.
  3479. Other error codes depend on the scheduling policy.
  3480. -- Function: int sched_getattr (pid_t TID, struct sched_attr *ATTR,
  3481. unsigned int size, unsigned int flags)
  3482. | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::.
  3483. This function obtains the scheduling policy of the thread TID (zero
  3484. denotes the current thread) and store it in ‘*ATTR’, which must
  3485. have space for at least SIZE bytes.
  3486. The FLAGS argument must be zero. Other values may become available
  3487. in the future.
  3488. Upon success, ‘ATTR->size’ contains the size of the structure
  3489. version used by the kernel. Fields with offsets greater or equal
  3490. to ‘ATTR->size’ may not be overwritten by the kernel. To obtain
  3491. predictable values for unknown fields, use ‘memset’ to set all SIZE
  3492. bytes to zero prior to calling ‘sched_getattr’.
  3493. On failure, ‘sched_getattr’ returns -1 and sets ‘errno’. If
  3494. ‘errno’ is ‘E2BIG’, this means that the buffer is not large large
  3495. enough, and the application could retry with a larger buffer.
  3496. 
  3497. File: libc.info, Node: Traditional Scheduling, Next: CPU Affinity, Prev: Extensible Scheduling, Up: Priority
  3498. 23.3.5 Traditional Scheduling
  3499. -----------------------------
  3500. This section is about the scheduling among processes whose absolute
  3501. priority is 0. When the system hands out the scraps of CPU time that
  3502. are left over after the processes with higher absolute priority have
  3503. taken all they want, the scheduling described herein determines who
  3504. among the great unwashed processes gets them.
  3505. * Menu:
  3506. * Traditional Scheduling Intro::
  3507. * Traditional Scheduling Functions::
  3508. 
  3509. File: libc.info, Node: Traditional Scheduling Intro, Next: Traditional Scheduling Functions, Up: Traditional Scheduling
  3510. 23.3.5.1 Introduction To Traditional Scheduling
  3511. ...............................................
  3512. Long before there was absolute priority (See *note Absolute Priority::),
  3513. Unix systems were scheduling the CPU using this system. When POSIX came
  3514. in like the Romans and imposed absolute priorities to accommodate the
  3515. needs of realtime processing, it left the indigenous Absolute Priority
  3516. Zero processes to govern themselves by their own familiar scheduling
  3517. policy.
  3518. Indeed, absolute priorities higher than zero are not available on
  3519. many systems today and are not typically used when they are, being
  3520. intended mainly for computers that do realtime processing. So this
  3521. section describes the only scheduling many programmers need to be
  3522. concerned about.
  3523. But just to be clear about the scope of this scheduling: Any time a
  3524. process with an absolute priority of 0 and a process with an absolute
  3525. priority higher than 0 are ready to run at the same time, the one with
  3526. absolute priority 0 does not run. If it's already running when the
  3527. higher priority ready-to-run process comes into existence, it stops
  3528. immediately.
  3529. In addition to its absolute priority of zero, every process has
  3530. another priority, which we will refer to as "dynamic priority" because
  3531. it changes over time. The dynamic priority is meaningless for processes
  3532. with an absolute priority higher than zero.
  3533. The dynamic priority sometimes determines who gets the next turn on
  3534. the CPU. Sometimes it determines how long turns last. Sometimes it
  3535. determines whether a process can kick another off the CPU.
  3536. In Linux, the value is a combination of these things, but mostly it
  3537. just determines the length of the time slice. The higher a process'
  3538. dynamic priority, the longer a shot it gets on the CPU when it gets one.
  3539. If it doesn't use up its time slice before giving up the CPU to do
  3540. something like wait for I/O, it is favored for getting the CPU back when
  3541. it's ready for it, to finish out its time slice. Other than that,
  3542. selection of processes for new time slices is basically round robin.
  3543. But the scheduler does throw a bone to the low priority processes: A
  3544. process' dynamic priority rises every time it is snubbed in the
  3545. scheduling process. In Linux, even the fat kid gets to play.
  3546. The fluctuation of a process' dynamic priority is regulated by
  3547. another value: The "nice" value. The nice value is an integer, usually
  3548. in the range -20 to 20, and represents an upper limit on a process'
  3549. dynamic priority. The higher the nice number, the lower that limit.
  3550. On a typical Linux system, for example, a process with a nice value
  3551. of 20 can get only 10 milliseconds on the CPU at a time, whereas a
  3552. process with a nice value of -20 can achieve a high enough priority to
  3553. get 400 milliseconds.
  3554. The idea of the nice value is deferential courtesy. In the
  3555. beginning, in the Unix garden of Eden, all processes shared equally in
  3556. the bounty of the computer system. But not all processes really need
  3557. the same share of CPU time, so the nice value gave a courteous process
  3558. the ability to refuse its equal share of CPU time that others might
  3559. prosper. Hence, the higher a process' nice value, the nicer the process
  3560. is. (Then a snake came along and offered some process a negative nice
  3561. value and the system became the crass resource allocation system we know
  3562. today.)
  3563. Dynamic priorities tend upward and downward with an objective of
  3564. smoothing out allocation of CPU time and giving quick response time to
  3565. infrequent requests. But they never exceed their nice limits, so on a
  3566. heavily loaded CPU, the nice value effectively determines how fast a
  3567. process runs.
  3568. In keeping with the socialistic heritage of Unix process priority, a
  3569. process begins life with the same nice value as its parent process and
  3570. can raise it at will. A process can also raise the nice value of any
  3571. other process owned by the same user (or effective user). But only a
  3572. privileged process can lower its nice value. A privileged process can
  3573. also raise or lower another process' nice value.
  3574. GNU C Library functions for getting and setting nice values are
  3575. described in *Note Traditional Scheduling Functions::.
  3576. 
  3577. File: libc.info, Node: Traditional Scheduling Functions, Prev: Traditional Scheduling Intro, Up: Traditional Scheduling
  3578. 23.3.5.2 Functions For Traditional Scheduling
  3579. .............................................
  3580. This section describes how you can read and set the nice value of a
  3581. process. All these symbols are declared in ‘sys/resource.h’.
  3582. The function and macro names are defined by POSIX, and refer to
  3583. "priority," but the functions actually have to do with nice values, as
  3584. the terms are used both in the manual and POSIX.
  3585. The range of valid nice values depends on the kernel, but typically
  3586. it runs from ‘-20’ to ‘20’. A lower nice value corresponds to higher
  3587. priority for the process. These constants describe the range of
  3588. priority values:
  3589. ‘PRIO_MIN’
  3590. The lowest valid nice value.
  3591. ‘PRIO_MAX’
  3592. The highest valid nice value.
  3593. -- Function: int getpriority (int CLASS, int ID)
  3594. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3595. Concepts::.
  3596. Return the nice value of a set of processes; CLASS and ID specify
  3597. which ones (see below). If the processes specified do not all have
  3598. the same nice value, this returns the lowest value that any of them
  3599. has.
  3600. On success, the return value is ‘0’. Otherwise, it is ‘-1’ and
  3601. ‘errno’ is set accordingly. The ‘errno’ values specific to this
  3602. function are:
  3603. ‘ESRCH’
  3604. The combination of CLASS and ID does not match any existing
  3605. process.
  3606. ‘EINVAL’
  3607. The value of CLASS is not valid.
  3608. If the return value is ‘-1’, it could indicate failure, or it could
  3609. be the nice value. The only way to make certain is to set ‘errno =
  3610. 0’ before calling ‘getpriority’, then use ‘errno != 0’ afterward as
  3611. the criterion for failure.
  3612. -- Function: int setpriority (int CLASS, int ID, int NICEVAL)
  3613. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3614. Concepts::.
  3615. Set the nice value of a set of processes to NICEVAL; CLASS and ID
  3616. specify which ones (see below).
  3617. The return value is ‘0’ on success, and ‘-1’ on failure. The
  3618. following ‘errno’ error condition are possible for this function:
  3619. ‘ESRCH’
  3620. The combination of CLASS and ID does not match any existing
  3621. process.
  3622. ‘EINVAL’
  3623. The value of CLASS is not valid.
  3624. ‘EPERM’
  3625. The call would set the nice value of a process which is owned
  3626. by a different user than the calling process (i.e., the target
  3627. process' real or effective uid does not match the calling
  3628. process' effective uid) and the calling process does not have
  3629. ‘CAP_SYS_NICE’ permission.
  3630. ‘EACCES’
  3631. The call would lower the process' nice value and the process
  3632. does not have ‘CAP_SYS_NICE’ permission.
  3633. The arguments CLASS and ID together specify a set of processes in
  3634. which you are interested. These are the possible values of CLASS:
  3635. ‘PRIO_PROCESS’
  3636. One particular process. The argument ID is a process ID (pid).
  3637. ‘PRIO_PGRP’
  3638. All the processes in a particular process group. The argument ID
  3639. is a process group ID (pgid).
  3640. ‘PRIO_USER’
  3641. All the processes owned by a particular user (i.e., whose real uid
  3642. indicates the user). The argument ID is a user ID (uid).
  3643. If the argument ID is 0, it stands for the calling process, its
  3644. process group, or its owner (real uid), according to CLASS.
  3645. -- Function: int nice (int INCREMENT)
  3646. Preliminary: | MT-Unsafe race:setpriority | AS-Unsafe | AC-Safe |
  3647. *Note POSIX Safety Concepts::.
  3648. Increment the nice value of the calling process by INCREMENT. The
  3649. return value is the new nice value on success, and ‘-1’ on failure.
  3650. In the case of failure, ‘errno’ will be set to the same values as
  3651. for ‘setpriority’.
  3652. Here is an equivalent definition of ‘nice’:
  3653. int
  3654. nice (int increment)
  3655. {
  3656. int result, old = getpriority (PRIO_PROCESS, 0);
  3657. result = setpriority (PRIO_PROCESS, 0, old + increment);
  3658. if (result != -1)
  3659. return old + increment;
  3660. else
  3661. return -1;
  3662. }
  3663. 
  3664. File: libc.info, Node: CPU Affinity, Prev: Traditional Scheduling, Up: Priority
  3665. 23.3.6 Limiting execution to certain CPUs
  3666. -----------------------------------------
  3667. On a multi-processor system the operating system usually distributes the
  3668. different processes which are runnable on all available CPUs in a way
  3669. which allows the system to work most efficiently. Which processes and
  3670. threads run can to some extend be controlled with the scheduling
  3671. functionality described in the last sections. But which CPU finally
  3672. executes which process or thread is not covered.
  3673. There are a number of reasons why a program might want to have
  3674. control over this aspect of the system as well:
  3675. • One thread or process is responsible for absolutely critical work
  3676. which under no circumstances must be interrupted or hindered from
  3677. making progress by other processes or threads using CPU resources.
  3678. In this case the special process would be confined to a CPU which
  3679. no other process or thread is allowed to use.
  3680. • The access to certain resources (RAM, I/O ports) has different
  3681. costs from different CPUs. This is the case in NUMA (Non-Uniform
  3682. Memory Architecture) machines. Preferably memory should be
  3683. accessed locally but this requirement is usually not visible to the
  3684. scheduler. Therefore forcing a process or thread to the CPUs which
  3685. have local access to the most-used memory helps to significantly
  3686. boost the performance.
  3687. • In controlled runtimes resource allocation and book-keeping work
  3688. (for instance garbage collection) is performance local to
  3689. processors. This can help to reduce locking costs if the resources
  3690. do not have to be protected from concurrent accesses from different
  3691. processors.
  3692. The POSIX standard up to this date is of not much help to solve this
  3693. problem. The Linux kernel provides a set of interfaces to allow
  3694. specifying _affinity sets_ for a process. The scheduler will schedule
  3695. the thread or process on CPUs specified by the affinity masks. The
  3696. interfaces which the GNU C Library define follow to some extent the
  3697. Linux kernel interface.
  3698. -- Data Type: cpu_set_t
  3699. This data set is a bitset where each bit represents a CPU. How the
  3700. system's CPUs are mapped to bits in the bitset is system dependent.
  3701. The data type has a fixed size; it is strongly recommended to
  3702. allocate a dynamically sized set based on the actual number of CPUs
  3703. detected, such as via ‘get_nprocs_conf()’, and use the ‘CPU_*_S’
  3704. variants instead of the fixed-size ones.
  3705. This type is a GNU extension and is defined in ‘sched.h’.
  3706. To manipulate the bitset, to set and reset bits, and thus add and
  3707. remove CPUs from the sets, a number of macros are defined. Some of the
  3708. macros take a CPU number as a parameter. Here it is important to never
  3709. exceed the size of the bitset, either ‘CPU_SETSIZE’ for fixed sets or
  3710. the allocated size for dynamic sets. For each macro there is a
  3711. fixed-size version (documented below) and a dynamic-sized version (with
  3712. a ‘_S’ suffix).
  3713. -- Macro: int CPU_SETSIZE
  3714. The value of this macro is the maximum number of CPUs which can be
  3715. handled with a fixed ‘cpu_set_t’ object.
  3716. For applications that require CPU sets larger than the built-in size,
  3717. a set of macros that support dynamically-sized sets are defined.
  3718. -- Macro: size_t CPU_ALLOC_SIZE (size_t COUNT)
  3719. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3720. Concepts::.
  3721. Given a count of CPUs to hold, returns the size of the set to
  3722. allocate. This return value is appropriate to be used in the *_S
  3723. macros.
  3724. This macro is a GNU extension and is defined in ‘sched.h’.
  3725. -- Macro: cpu_set_t * CPU_ALLOC (size_t COUNT)
  3726. Preliminary: | MT-Safe | AS-Unsafe lock | AC-Unsafe lock fd mem |
  3727. *Note POSIX Safety Concepts::.
  3728. Given the count of CPUs to hold, returns a set large enough to hold
  3729. them; that is, the resulting set will be valid for CPUs numbered 0
  3730. through COUNT-1, inclusive. This set must be freed via ‘CPU_FREE’
  3731. to avoid memory leaks. Warning: the argument is the CPU _count_
  3732. and not the size returned by ‘CPU_ALLOC_SIZE’.
  3733. This macro is a GNU extension and is defined in ‘sched.h’.
  3734. -- Macro: void CPU_FREE (cpu_set_t *SET)
  3735. Preliminary: | MT-Safe | AS-Unsafe lock | AC-Unsafe lock fd mem |
  3736. *Note POSIX Safety Concepts::.
  3737. Frees a CPU set previously allocated by ‘CPU_ALLOC’.
  3738. This macro is a GNU extension and is defined in ‘sched.h’.
  3739. The type ‘cpu_set_t’ should be considered opaque; all manipulation
  3740. should happen via the ‘CPU_*’ macros described below.
  3741. -- Macro: void CPU_ZERO (cpu_set_t *SET)
  3742. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3743. Concepts::.
  3744. This macro initializes the CPU set SET to be the empty set.
  3745. This macro is a GNU extension and is defined in ‘sched.h’.
  3746. -- Macro: void CPU_SET (int CPU, cpu_set_t *SET)
  3747. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3748. Concepts::.
  3749. This macro adds CPU to the CPU set SET.
  3750. The CPU parameter must not have side effects since it is evaluated
  3751. more than once.
  3752. This macro is a GNU extension and is defined in ‘sched.h’.
  3753. -- Macro: void CPU_CLR (int CPU, cpu_set_t *SET)
  3754. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3755. Concepts::.
  3756. This macro removes CPU from the CPU set SET.
  3757. The CPU parameter must not have side effects since it is evaluated
  3758. more than once.
  3759. This macro is a GNU extension and is defined in ‘sched.h’.
  3760. -- Macro: cpu_set_t * CPU_AND (cpu_set_t *DEST, cpu_set_t *SRC1,
  3761. cpu_set_t *SRC2)
  3762. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3763. Concepts::.
  3764. This macro populates DEST with only those CPUs included in both
  3765. SRC1 and SRC2. Its value is DEST.
  3766. This macro is a GNU extension and is defined in ‘sched.h’.
  3767. -- Macro: cpu_set_t * CPU_OR (cpu_set_t *DEST, cpu_set_t *SRC1,
  3768. cpu_set_t *SRC2)
  3769. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3770. Concepts::.
  3771. This macro populates DEST with those CPUs included in either SRC1
  3772. or SRC2. Its value is DEST.
  3773. This macro is a GNU extension and is defined in ‘sched.h’.
  3774. -- Macro: cpu_set_t * CPU_XOR (cpu_set_t *DEST, cpu_set_t *SRC1,
  3775. cpu_set_t *SRC2)
  3776. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3777. Concepts::.
  3778. This macro populates DEST with those CPUs included in either SRC1
  3779. or SRC2, but not both. Its value is DEST.
  3780. This macro is a GNU extension and is defined in ‘sched.h’.
  3781. -- Macro: int CPU_ISSET (int CPU, const cpu_set_t *SET)
  3782. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3783. Concepts::.
  3784. This macro returns a nonzero value (true) if CPU is a member of the
  3785. CPU set SET, and zero (false) otherwise.
  3786. The CPU parameter must not have side effects since it is evaluated
  3787. more than once.
  3788. This macro is a GNU extension and is defined in ‘sched.h’.
  3789. -- Macro: int CPU_COUNT (const cpu_set_t *SET)
  3790. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3791. Concepts::.
  3792. This macro returns the count of CPUs (bits) set in SET.
  3793. This macro is a GNU extension and is defined in ‘sched.h’.
  3794. -- Macro: int CPU_EQUAL (cpu_set_t *SRC1, cpu_set_t *SRC2)
  3795. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3796. Concepts::.
  3797. This macro returns nonzero if the two sets SET1 and SET2 have the
  3798. same contents; that is, the set of CPUs represented by both sets is
  3799. identical.
  3800. This macro is a GNU extension and is defined in ‘sched.h’.
  3801. -- Macro: void CPU_ZERO_S (size_t SIZE, cpu_set_t *SET)
  3802. -- Macro: void CPU_SET_S (int CPU, size_t SIZE, cpu_set_t *SET)
  3803. -- Macro: void CPU_CLR_S (int CPU, size_t SIZE, cpu_set_t *SET)
  3804. -- Macro: cpu_set_t * CPU_AND_S (size_t SIZE, cpu_set_t *DEST,
  3805. cpu_set_t *SRC1, cpu_set_t *SRC2)
  3806. -- Macro: cpu_set_t * CPU_OR_S (size_t SIZE, cpu_set_t *DEST, cpu_set_t
  3807. *SRC1, cpu_set_t *SRC2)
  3808. -- Macro: cpu_set_t * CPU_XOR_S (size_t SIZE, cpu_set_t *DEST,
  3809. cpu_set_t *SRC1, cpu_set_t *SRC2)
  3810. -- Macro: int CPU_ISSET_S (int CPU, size_t SIZE, const cpu_set_t *SET)
  3811. -- Macro: int CPU_COUNT_S (size_t SIZE, const cpu_set_t *SET)
  3812. -- Macro: int CPU_EQUAL_S (size_t SIZE, cpu_set_t *SRC1, cpu_set_t
  3813. *SRC2)
  3814. Each of these macros performs the same action as its non-‘_S’
  3815. variant, but takes a SIZE argument to specify the set size. This SIZE
  3816. argument is as returned by the ‘CPU_ALLOC_SIZE’ macro, defined above.
  3817. CPU bitsets can be constructed from scratch or the currently
  3818. installed affinity mask can be retrieved from the system.
  3819. -- Function: int sched_getaffinity (pid_t PID, size_t CPUSETSIZE,
  3820. cpu_set_t *CPUSET)
  3821. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3822. Concepts::.
  3823. This function stores the CPU affinity mask for the process or
  3824. thread with the ID PID in the CPUSETSIZE bytes long bitmap pointed
  3825. to by CPUSET. If successful, the function always initializes all
  3826. bits in the ‘cpu_set_t’ object and returns zero.
  3827. If PID does not correspond to a process or thread on the system the
  3828. or the function fails for some other reason, it returns ‘-1’ and
  3829. ‘errno’ is set to represent the error condition.
  3830. ‘ESRCH’
  3831. No process or thread with the given ID found.
  3832. ‘EFAULT’
  3833. The pointer CPUSET does not point to a valid object.
  3834. This function is a GNU extension and is declared in ‘sched.h’.
  3835. Note that it is not portably possible to use this information to
  3836. retrieve the information for different POSIX threads. A separate
  3837. interface must be provided for that.
  3838. -- Function: int sched_setaffinity (pid_t PID, size_t CPUSETSIZE, const
  3839. cpu_set_t *CPUSET)
  3840. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3841. Concepts::.
  3842. This function installs the CPUSETSIZE bytes long affinity mask
  3843. pointed to by CPUSET for the process or thread with the ID PID. If
  3844. successful the function returns zero and the scheduler will in the
  3845. future take the affinity information into account.
  3846. If the function fails it will return ‘-1’ and ‘errno’ is set to the
  3847. error code:
  3848. ‘ESRCH’
  3849. No process or thread with the given ID found.
  3850. ‘EFAULT’
  3851. The pointer CPUSET does not point to a valid object.
  3852. ‘EINVAL’
  3853. The bitset is not valid. This might mean that the affinity
  3854. set might not leave a processor for the process or thread to
  3855. run on.
  3856. This function is a GNU extension and is declared in ‘sched.h’.
  3857. -- Function: int getcpu (unsigned int *cpu, unsigned int *node)
  3858. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3859. Concepts::.
  3860. The ‘getcpu’ function identifies the processor and node on which
  3861. the calling thread or process is currently running and writes them
  3862. into the integers pointed to by the CPU and NODE arguments. The
  3863. processor is a unique nonnegative integer identifying a CPU. The
  3864. node is a unique nonnegative integer identifying a NUMA node. When
  3865. either CPU or NODE is ‘NULL’, nothing is written to the respective
  3866. pointer.
  3867. The return value is ‘0’ on success and ‘-1’ on failure. The
  3868. following ‘errno’ error condition is defined for this function:
  3869. ‘ENOSYS’
  3870. The operating system does not support this function.
  3871. This function is Linux-specific and is declared in ‘sched.h’.
  3872. -- Function: int sched_getcpu (void)
  3873. Similar to ‘getcpu’ but with a simpler interface. On success,
  3874. returns a nonnegative number identifying the CPU on which the
  3875. current thread is running. Returns ‘-1’ on failure. The following
  3876. ‘errno’ error condition is defined for this function:
  3877. ‘ENOSYS’
  3878. The operating system does not support this function.
  3879. This function is Linux-specific and is declared in ‘sched.h’.
  3880. Here's an example of how to use most of the above to limit the number
  3881. of CPUs a process runs on, not including error handling or good logic on
  3882. CPU choices:
  3883. #define _GNU_SOURCE
  3884. #include <sched.h>
  3885. #include <sys/sysinfo.h>
  3886. #include <unistd.h>
  3887. void
  3888. limit_cpus (void)
  3889. {
  3890. unsigned int mycpu;
  3891. size_t nproc, cssz, cpu;
  3892. cpu_set_t *cs;
  3893. getcpu (&mycpu, NULL);
  3894. nproc = get_nprocs_conf ();
  3895. cssz = CPU_ALLOC_SIZE (nproc);
  3896. cs = CPU_ALLOC (nproc);
  3897. sched_getaffinity (0, cssz, cs);
  3898. if (CPU_COUNT_S (cssz, cs) > nproc / 2)
  3899. {
  3900. for (cpu = nproc / 2; cpu < nproc; cpu ++)
  3901. if (cpu != mycpu)
  3902. CPU_CLR_S (cpu, cssz, cs);
  3903. sched_setaffinity (0, cssz, cs);
  3904. }
  3905. CPU_FREE (cs);
  3906. }
  3907. 
  3908. File: libc.info, Node: Memory Resources, Next: Processor Resources, Prev: Priority, Up: Resource Usage And Limitation
  3909. 23.4 Querying memory available resources
  3910. ========================================
  3911. The amount of memory available in the system and the way it is organized
  3912. determines oftentimes the way programs can and have to work. For
  3913. functions like ‘mmap’ it is necessary to know about the size of
  3914. individual memory pages and knowing how much memory is available enables
  3915. a program to select appropriate sizes for, say, caches. Before we get
  3916. into these details a few words about memory subsystems in traditional
  3917. Unix systems will be given.
  3918. * Menu:
  3919. * Memory Subsystem:: Overview about traditional Unix memory handling.
  3920. * Query Memory Parameters:: How to get information about the memory
  3921. subsystem?
  3922. 
  3923. File: libc.info, Node: Memory Subsystem, Next: Query Memory Parameters, Up: Memory Resources
  3924. 23.4.1 Overview about traditional Unix memory handling
  3925. ------------------------------------------------------
  3926. Unix systems normally provide processes virtual address spaces. This
  3927. means that the addresses of the memory regions do not have to correspond
  3928. directly to the addresses of the actual physical memory which stores the
  3929. data. An extra level of indirection is introduced which translates
  3930. virtual addresses into physical addresses. This is normally done by the
  3931. hardware of the processor.
  3932. Using a virtual address space has several advantages. The most
  3933. important is process isolation. The different processes running on the
  3934. system cannot interfere directly with each other. No process can write
  3935. into the address space of another process (except when shared memory is
  3936. used but then it is wanted and controlled).
  3937. Another advantage of virtual memory is that the address space the
  3938. processes see can actually be larger than the physical memory available.
  3939. The physical memory can be extended by storage on an external media
  3940. where the content of currently unused memory regions is stored. The
  3941. address translation can then intercept accesses to these memory regions
  3942. and make memory content available again by loading the data back into
  3943. memory. This concept makes it necessary that programs which have to use
  3944. lots of memory know the difference between available virtual address
  3945. space and available physical memory. If the working set of virtual
  3946. memory of all the processes is larger than the available physical memory
  3947. the system will slow down dramatically due to constant swapping of
  3948. memory content from the memory to the storage media and back. This is
  3949. called "thrashing".
  3950. A final aspect of virtual memory which is important and follows from
  3951. what is said in the last paragraph is the granularity of the virtual
  3952. address space handling. When we said that the virtual address handling
  3953. stores memory content externally it cannot do this on a byte-by-byte
  3954. basis. The administrative overhead does not allow this (leaving alone
  3955. the processor hardware). Instead several thousand bytes are handled
  3956. together and form a “page”. The size of each page is always a power of
  3957. two bytes. The smallest page size in use today is 4096, with 8192,
  3958. 16384, and 65536 being other popular sizes.
  3959. 
  3960. File: libc.info, Node: Query Memory Parameters, Prev: Memory Subsystem, Up: Memory Resources
  3961. 23.4.2 How to get information about the memory subsystem?
  3962. ---------------------------------------------------------
  3963. The page size of the virtual memory the process sees is essential to
  3964. know in several situations. Some programming interfaces (e.g., ‘mmap’,
  3965. *note Memory-mapped I/O::) require the user to provide information
  3966. adjusted to the page size. In the case of ‘mmap’ it is necessary to
  3967. provide a length argument which is a multiple of the page size. Another
  3968. place where the knowledge about the page size is useful is in memory
  3969. allocation. If one allocates pieces of memory in larger chunks which
  3970. are then subdivided by the application code it is useful to adjust the
  3971. size of the larger blocks to the page size. If the total memory
  3972. requirement for the block is close (but not larger) to a multiple of the
  3973. page size the kernel's memory handling can work more effectively since
  3974. it only has to allocate memory pages which are fully used. (To do this
  3975. optimization it is necessary to know a bit about the memory allocator
  3976. which will require a bit of memory itself for each block and this
  3977. overhead must not push the total size over the page size multiple.)
  3978. The page size traditionally was a compile time constant. But recent
  3979. development of processors changed this. Processors now support
  3980. different page sizes and they can possibly even vary among different
  3981. processes on the same system. Therefore the system should be queried at
  3982. runtime about the current page size and no assumptions (except about it
  3983. being a power of two) should be made.
  3984. The correct interface to query about the page size is ‘sysconf’
  3985. (*note Sysconf Definition::) with the parameter ‘_SC_PAGESIZE’. There
  3986. is a much older interface available, too.
  3987. -- Function: int getpagesize (void)
  3988. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3989. Concepts::.
  3990. The ‘getpagesize’ function returns the page size of the process.
  3991. This value is fixed for the runtime of the process but can vary in
  3992. different runs of the application.
  3993. The function is declared in ‘unistd.h’.
  3994. Widely available on System V derived systems is a method to get
  3995. information about the physical memory the system has. The call
  3996. sysconf (_SC_PHYS_PAGES)
  3997. returns the total number of pages of physical memory the system has.
  3998. This does not mean all this memory is available. This information can
  3999. be found using
  4000. sysconf (_SC_AVPHYS_PAGES)
  4001. These two values help to optimize applications. The value returned
  4002. for ‘_SC_AVPHYS_PAGES’ is the amount of memory the application can use
  4003. without hindering any other process (given that no other process
  4004. increases its memory usage). The value returned for ‘_SC_PHYS_PAGES’ is
  4005. more or less a hard limit for the working set. If all applications
  4006. together constantly use more than that amount of memory the system is in
  4007. trouble.
  4008. The GNU C Library provides in addition to these already described way
  4009. to get this information two functions. They are declared in the file
  4010. ‘sys/sysinfo.h’. Programmers should prefer to use the ‘sysconf’ method
  4011. described above.
  4012. -- Function: long int get_phys_pages (void)
  4013. Preliminary: | MT-Safe | AS-Unsafe heap lock | AC-Unsafe lock fd
  4014. mem | *Note POSIX Safety Concepts::.
  4015. The ‘get_phys_pages’ function returns the total number of pages of
  4016. physical memory the system has. To get the amount of memory this
  4017. number has to be multiplied by the page size.
  4018. This function is a GNU extension.
  4019. -- Function: long int get_avphys_pages (void)
  4020. Preliminary: | MT-Safe | AS-Unsafe heap lock | AC-Unsafe lock fd
  4021. mem | *Note POSIX Safety Concepts::.
  4022. The ‘get_avphys_pages’ function returns the number of available
  4023. pages of physical memory the system has. To get the amount of
  4024. memory this number has to be multiplied by the page size.
  4025. This function is a GNU extension.
  4026. 
  4027. File: libc.info, Node: Processor Resources, Prev: Memory Resources, Up: Resource Usage And Limitation
  4028. 23.5 Learn about the processors available
  4029. =========================================
  4030. The use of threads or processes with shared memory allows an application
  4031. to take advantage of all the processing power a system can provide. If
  4032. the task can be parallelized the optimal way to write an application is
  4033. to have at any time as many processes running as there are processors.
  4034. To determine the number of processors available to the system one can
  4035. run
  4036. sysconf (_SC_NPROCESSORS_CONF)
  4037. which returns the number of processors the operating system configured.
  4038. But it might be possible for the operating system to disable individual
  4039. processors and so the call
  4040. sysconf (_SC_NPROCESSORS_ONLN)
  4041. returns the number of processors which are currently online (i.e.,
  4042. available).
  4043. For these two pieces of information the GNU C Library also provides
  4044. functions to get the information directly. The functions are declared
  4045. in ‘sys/sysinfo.h’.
  4046. -- Function: int get_nprocs_conf (void)
  4047. Preliminary: | MT-Safe | AS-Unsafe heap lock | AC-Unsafe lock fd
  4048. mem | *Note POSIX Safety Concepts::.
  4049. The ‘get_nprocs_conf’ function returns the number of processors the
  4050. operating system configured.
  4051. This function is a GNU extension.
  4052. -- Function: int get_nprocs (void)
  4053. Preliminary: | MT-Safe | AS-Safe | AC-Safe fd | *Note POSIX Safety
  4054. Concepts::.
  4055. The ‘get_nprocs’ function returns the number of available
  4056. processors.
  4057. This function is a GNU extension.
  4058. Before starting more threads it should be checked whether the
  4059. processors are not already overused. Unix systems calculate something
  4060. called the “load average”. This is a number indicating how many
  4061. processes were running. This number is an average over different
  4062. periods of time (normally 1, 5, and 15 minutes).
  4063. -- Function: int getloadavg (double LOADAVG[], int NELEM)
  4064. Preliminary: | MT-Safe | AS-Safe | AC-Safe fd | *Note POSIX Safety
  4065. Concepts::.
  4066. This function gets the 1, 5 and 15 minute load averages of the
  4067. system. The values are placed in LOADAVG. ‘getloadavg’ will place
  4068. at most NELEM elements into the array but never more than three
  4069. elements. The return value is the number of elements written to
  4070. LOADAVG, or -1 on error.
  4071. This function is declared in ‘stdlib.h’.
  4072. 
  4073. File: libc.info, Node: Non-Local Exits, Next: Signal Handling, Prev: Resource Usage And Limitation, Up: Top
  4074. 24 Non-Local Exits
  4075. ******************
  4076. Sometimes when your program detects an unusual situation inside a deeply
  4077. nested set of function calls, you would like to be able to immediately
  4078. return to an outer level of control. This section describes how you can
  4079. do such “non-local exits” using the ‘setjmp’ and ‘longjmp’ functions.
  4080. * Menu:
  4081. * Intro: Non-Local Intro. When and how to use these facilities.
  4082. * Details: Non-Local Details. Functions for non-local exits.
  4083. * Non-Local Exits and Signals:: Portability issues.
  4084. * System V contexts:: Complete context control a la System V.
  4085. 
  4086. File: libc.info, Node: Non-Local Intro, Next: Non-Local Details, Up: Non-Local Exits
  4087. 24.1 Introduction to Non-Local Exits
  4088. ====================================
  4089. As an example of a situation where a non-local exit can be useful,
  4090. suppose you have an interactive program that has a "main loop" that
  4091. prompts for and executes commands. Suppose the "read" command reads
  4092. input from a file, doing some lexical analysis and parsing of the input
  4093. while processing it. If a low-level input error is detected, it would
  4094. be useful to be able to return immediately to the "main loop" instead of
  4095. having to make each of the lexical analysis, parsing, and processing
  4096. phases all have to explicitly deal with error situations initially
  4097. detected by nested calls.
  4098. (On the other hand, if each of these phases has to do a substantial
  4099. amount of cleanup when it exits--such as closing files, deallocating
  4100. buffers or other data structures, and the like--then it can be more
  4101. appropriate to do a normal return and have each phase do its own
  4102. cleanup, because a non-local exit would bypass the intervening phases
  4103. and their associated cleanup code entirely. Alternatively, you could
  4104. use a non-local exit but do the cleanup explicitly either before or
  4105. after returning to the "main loop".)
  4106. In some ways, a non-local exit is similar to using the ‘return’
  4107. statement to return from a function. But while ‘return’ abandons only a
  4108. single function call, transferring control back to the point at which it
  4109. was called, a non-local exit can potentially abandon many levels of
  4110. nested function calls.
  4111. You identify return points for non-local exits by calling the
  4112. function ‘setjmp’. This function saves information about the execution
  4113. environment in which the call to ‘setjmp’ appears in an object of type
  4114. ‘jmp_buf’. Execution of the program continues normally after the call
  4115. to ‘setjmp’, but if an exit is later made to this return point by
  4116. calling ‘longjmp’ with the corresponding ‘jmp_buf’ object, control is
  4117. transferred back to the point where ‘setjmp’ was called. The return
  4118. value from ‘setjmp’ is used to distinguish between an ordinary return
  4119. and a return made by a call to ‘longjmp’, so calls to ‘setjmp’ usually
  4120. appear in an ‘if’ statement.
  4121. Here is how the example program described above might be set up:
  4122. #include <setjmp.h>
  4123. #include <stdlib.h>
  4124. #include <stdio.h>
  4125. jmp_buf main_loop;
  4126. void
  4127. abort_to_main_loop (int status)
  4128. {
  4129. longjmp (main_loop, status);
  4130. }
  4131. void
  4132. do_command (void)
  4133. {
  4134. char buffer[128];
  4135. if (fgets (buffer, 128, stdin) == NULL)
  4136. abort_to_main_loop (-1);
  4137. else
  4138. exit (EXIT_SUCCESS);
  4139. }
  4140. int
  4141. main (void)
  4142. {
  4143. while (1)
  4144. if (setjmp (main_loop))
  4145. puts ("Back at main loop....");
  4146. else
  4147. do_command ();
  4148. }
  4149. The function ‘abort_to_main_loop’ causes an immediate transfer of
  4150. control back to the main loop of the program, no matter where it is
  4151. called from.
  4152. The flow of control inside the ‘main’ function may appear a little
  4153. mysterious at first, but it is actually a common idiom with ‘setjmp’. A
  4154. normal call to ‘setjmp’ returns zero, so the "else" clause of the
  4155. conditional is executed. If ‘abort_to_main_loop’ is called somewhere
  4156. within the execution of ‘do_command’, then it actually appears as if the
  4157. _same_ call to ‘setjmp’ in ‘main’ were returning a second time with a
  4158. value of ‘-1’.
  4159. So, the general pattern for using ‘setjmp’ looks something like:
  4160. if (setjmp (BUFFER))
  4161. /* Code to clean up after premature return. */
  4162. ...
  4163. else
  4164. /* Code to be executed normally after setting up the return point. */
  4165. ...
  4166. 
  4167. File: libc.info, Node: Non-Local Details, Next: Non-Local Exits and Signals, Prev: Non-Local Intro, Up: Non-Local Exits
  4168. 24.2 Details of Non-Local Exits
  4169. ===============================
  4170. Here are the details on the functions and data structures used for
  4171. performing non-local exits. These facilities are declared in
  4172. ‘setjmp.h’.
  4173. -- Data Type: jmp_buf
  4174. Objects of type ‘jmp_buf’ hold the state information to be restored
  4175. by a non-local exit. The contents of a ‘jmp_buf’ identify a
  4176. specific place to return to.
  4177. -- Macro: int setjmp (jmp_buf STATE)
  4178. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  4179. Concepts::.
  4180. When called normally, ‘setjmp’ stores information about the
  4181. execution state of the program in STATE and returns zero. If
  4182. ‘longjmp’ is later used to perform a non-local exit to this STATE,
  4183. ‘setjmp’ returns a nonzero value.
  4184. -- Function: void longjmp (jmp_buf STATE, int VALUE)
  4185. Preliminary: | MT-Safe | AS-Unsafe plugin corrupt lock/hurd |
  4186. AC-Unsafe corrupt lock/hurd | *Note POSIX Safety Concepts::.
  4187. This function restores current execution to the state saved in
  4188. STATE, and continues execution from the call to ‘setjmp’ that
  4189. established that return point. Returning from ‘setjmp’ by means of
  4190. ‘longjmp’ returns the VALUE argument that was passed to ‘longjmp’,
  4191. rather than ‘0’. (But if VALUE is given as ‘0’, ‘setjmp’ returns
  4192. ‘1’).
  4193. There are a lot of obscure but important restrictions on the use of
  4194. ‘setjmp’ and ‘longjmp’. Most of these restrictions are present because
  4195. non-local exits require a fair amount of magic on the part of the C
  4196. compiler and can interact with other parts of the language in strange
  4197. ways.
  4198. The ‘setjmp’ function is actually a macro without an actual function
  4199. definition, so you shouldn't try to ‘#undef’ it or take its address. In
  4200. addition, calls to ‘setjmp’ are safe in only the following contexts:
  4201. • As the test expression of a selection or iteration statement (such
  4202. as ‘if’, ‘switch’, or ‘while’).
  4203. • As one operand of an equality or comparison operator that appears
  4204. as the test expression of a selection or iteration statement. The
  4205. other operand must be an integer constant expression.
  4206. • As the operand of a unary ‘!’ operator, that appears as the test
  4207. expression of a selection or iteration statement.
  4208. • By itself as an expression statement.
  4209. Return points are valid only during the dynamic extent of the
  4210. function that called ‘setjmp’ to establish them. If you ‘longjmp’ to a
  4211. return point that was established in a function that has already
  4212. returned, unpredictable and disastrous things are likely to happen.
  4213. You should use a nonzero VALUE argument to ‘longjmp’. While
  4214. ‘longjmp’ refuses to pass back a zero argument as the return value from
  4215. ‘setjmp’, this is intended as a safety net against accidental misuse and
  4216. is not really good programming style.
  4217. When you perform a non-local exit, accessible objects generally
  4218. retain whatever values they had at the time ‘longjmp’ was called. The
  4219. exception is that the values of automatic variables local to the
  4220. function containing the ‘setjmp’ call that have been changed since the
  4221. call to ‘setjmp’ are indeterminate, unless you have declared them
  4222. ‘volatile’.
  4223. 
  4224. File: libc.info, Node: Non-Local Exits and Signals, Next: System V contexts, Prev: Non-Local Details, Up: Non-Local Exits
  4225. 24.3 Non-Local Exits and Signals
  4226. ================================
  4227. In BSD Unix systems, ‘setjmp’ and ‘longjmp’ also save and restore the
  4228. set of blocked signals; see *note Blocking Signals::. However, the
  4229. POSIX.1 standard requires ‘setjmp’ and ‘longjmp’ not to change the set
  4230. of blocked signals, and provides an additional pair of functions
  4231. (‘sigsetjmp’ and ‘siglongjmp’) to get the BSD behavior.
  4232. The behavior of ‘setjmp’ and ‘longjmp’ in the GNU C Library is
  4233. controlled by feature test macros; see *note Feature Test Macros::. The
  4234. default in the GNU C Library is the POSIX.1 behavior rather than the BSD
  4235. behavior.
  4236. The facilities in this section are declared in the header file
  4237. ‘setjmp.h’.
  4238. -- Data Type: sigjmp_buf
  4239. This is similar to ‘jmp_buf’, except that it can also store state
  4240. information about the set of blocked signals.
  4241. -- Function: int sigsetjmp (sigjmp_buf STATE, int SAVESIGS)
  4242. Preliminary: | MT-Safe | AS-Unsafe lock/hurd | AC-Unsafe lock/hurd
  4243. | *Note POSIX Safety Concepts::.
  4244. This is similar to ‘setjmp’. If SAVESIGS is nonzero, the set of
  4245. blocked signals is saved in STATE and will be restored if a
  4246. ‘siglongjmp’ is later performed with this STATE.
  4247. -- Function: void siglongjmp (sigjmp_buf STATE, int VALUE)
  4248. Preliminary: | MT-Safe | AS-Unsafe plugin corrupt lock/hurd |
  4249. AC-Unsafe corrupt lock/hurd | *Note POSIX Safety Concepts::.
  4250. This is similar to ‘longjmp’ except for the type of its STATE
  4251. argument. If the ‘sigsetjmp’ call that set this STATE used a
  4252. nonzero SAVESIGS flag, ‘siglongjmp’ also restores the set of
  4253. blocked signals.
  4254. 
  4255. File: libc.info, Node: System V contexts, Prev: Non-Local Exits and Signals, Up: Non-Local Exits
  4256. 24.4 Complete Context Control
  4257. =============================
  4258. The Unix standard provides one more set of functions to control the
  4259. execution path and these functions are more powerful than those
  4260. discussed in this chapter so far. These functions were part of the
  4261. original System V API and by this route were added to the Unix API.
  4262. Besides on branded Unix implementations these interfaces are not widely
  4263. available. Not all platforms and/or architectures the GNU C Library is
  4264. available on provide this interface. Use ‘configure’ to detect the
  4265. availability.
  4266. Similar to the ‘jmp_buf’ and ‘sigjmp_buf’ types used for the
  4267. variables to contain the state of the ‘longjmp’ functions the interfaces
  4268. of interest here have an appropriate type as well. Objects of this type
  4269. are normally much larger since more information is contained. The type
  4270. is also used in a few more places as we will see. The types and
  4271. functions described in this section are all defined and declared
  4272. respectively in the ‘ucontext.h’ header file.
  4273. -- Data Type: ucontext_t
  4274. The ‘ucontext_t’ type is defined as a structure with at least the
  4275. following elements:
  4276. ‘ucontext_t *uc_link’
  4277. This is a pointer to the next context structure which is used
  4278. if the context described in the current structure returns.
  4279. ‘sigset_t uc_sigmask’
  4280. Set of signals which are blocked when this context is used.
  4281. ‘stack_t uc_stack’
  4282. Stack used for this context. The value need not be (and
  4283. normally is not) the stack pointer. *Note Signal Stack::.
  4284. ‘mcontext_t uc_mcontext’
  4285. This element contains the actual state of the process. The
  4286. ‘mcontext_t’ type is also defined in this header but the
  4287. definition should be treated as opaque. Any use of knowledge
  4288. of the type makes applications less portable.
  4289. Objects of this type have to be created by the user. The
  4290. initialization and modification happens through one of the following
  4291. functions:
  4292. -- Function: int getcontext (ucontext_t *UCP)
  4293. Preliminary: | MT-Safe race:ucp | AS-Safe | AC-Safe | *Note POSIX
  4294. Safety Concepts::.
  4295. The ‘getcontext’ function initializes the variable pointed to by
  4296. UCP with the context of the calling thread. The context contains
  4297. the content of the registers, the signal mask, and the current
  4298. stack. Executing the contents would start at the point where the
  4299. ‘getcontext’ call just returned.
  4300. *Compatibility Note:* Depending on the operating system,
  4301. information about the current context's stack may be in the
  4302. ‘uc_stack’ field of UCP, or it may instead be in
  4303. architecture-specific subfields of the ‘uc_mcontext’ field.
  4304. The function returns ‘0’ if successful. Otherwise it returns ‘-1’
  4305. and sets ‘errno’ accordingly.
  4306. The ‘getcontext’ function is similar to ‘setjmp’ but it does not
  4307. provide an indication of whether ‘getcontext’ is returning for the first
  4308. time or whether an initialized context has just been restored. If this
  4309. is necessary the user has to determine this herself. This must be done
  4310. carefully since the context contains registers which might contain
  4311. register variables. This is a good situation to define variables with
  4312. ‘volatile’.
  4313. Once the context variable is initialized it can be used as is or it
  4314. can be modified using the ‘makecontext’ function. The latter is
  4315. normally done when implementing co-routines or similar constructs.
  4316. -- Function: void makecontext (ucontext_t *UCP, void (*FUNC) (void),
  4317. int ARGC, ...)
  4318. Preliminary: | MT-Safe race:ucp | AS-Safe | AC-Safe | *Note POSIX
  4319. Safety Concepts::.
  4320. The UCP parameter passed to ‘makecontext’ shall be initialized by a
  4321. call to ‘getcontext’. The context will be modified in a way such
  4322. that if the context is resumed it will start by calling the
  4323. function ‘func’ which gets ARGC integer arguments passed. The
  4324. integer arguments which are to be passed should follow the ARGC
  4325. parameter in the call to ‘makecontext’.
  4326. Before the call to this function the ‘uc_stack’ and ‘uc_link’
  4327. element of the UCP structure should be initialized. The ‘uc_stack’
  4328. element describes the stack which is used for this context. No two
  4329. contexts which are used at the same time should use the same memory
  4330. region for a stack.
  4331. The ‘uc_link’ element of the object pointed to by UCP should be a
  4332. pointer to the context to be executed when the function FUNC
  4333. returns or it should be a null pointer. See ‘setcontext’ for more
  4334. information about the exact use.
  4335. While allocating the memory for the stack one has to be careful.
  4336. Most modern processors keep track of whether a certain memory region is
  4337. allowed to contain code which is executed or not. Data segments and
  4338. heap memory are normally not tagged to allow this. The result is that
  4339. programs would fail. Examples for such code include the calling
  4340. sequences the GNU C compiler generates for calls to nested functions.
  4341. Safe ways to allocate stacks correctly include using memory on the
  4342. original thread's stack or explicitly allocating memory tagged for
  4343. execution using ‘mmap’ (*note Memory-mapped I/O::).
  4344. *Compatibility note*: The current Unix standard is very imprecise
  4345. about the way the stack is allocated. All implementations seem to agree
  4346. that the ‘uc_stack’ element must be used but the values stored in the
  4347. elements of the ‘stack_t’ value are unclear. The GNU C Library and most
  4348. other Unix implementations require the ‘ss_sp’ value of the ‘uc_stack’
  4349. element to point to the base of the memory region allocated for the
  4350. stack and the size of the memory region is stored in ‘ss_size’. There
  4351. are implementations out there which require ‘ss_sp’ to be set to the
  4352. value the stack pointer will have (which can, depending on the direction
  4353. the stack grows, be different). This difference makes the ‘makecontext’
  4354. function hard to use and it requires detection of the platform at
  4355. compile time.
  4356. -- Function: int setcontext (const ucontext_t *UCP)
  4357. Preliminary: | MT-Safe race:ucp | AS-Unsafe corrupt | AC-Unsafe
  4358. corrupt | *Note POSIX Safety Concepts::.
  4359. The ‘setcontext’ function restores the context described by UCP.
  4360. The context is not modified and can be reused as often as wanted.
  4361. If the context was created by ‘getcontext’ execution resumes with
  4362. the registers filled with the same values and the same stack as if
  4363. the ‘getcontext’ call just returned.
  4364. If the context was modified with a call to ‘makecontext’ execution
  4365. continues with the function passed to ‘makecontext’ which gets the
  4366. specified parameters passed. If this function returns execution is
  4367. resumed in the context which was referenced by the ‘uc_link’
  4368. element of the context structure passed to ‘makecontext’ at the
  4369. time of the call. If ‘uc_link’ was a null pointer the application
  4370. terminates normally with an exit status value of ‘EXIT_SUCCESS’
  4371. (*note Program Termination::).
  4372. If the context was created by a call to a signal handler or from
  4373. any other source then the behaviour of ‘setcontext’ is unspecified.
  4374. Since the context contains information about the stack no two
  4375. threads should use the same context at the same time. The result
  4376. in most cases would be disastrous.
  4377. The ‘setcontext’ function does not return unless an error occurred
  4378. in which case it returns ‘-1’.
  4379. The ‘setcontext’ function simply replaces the current context with
  4380. the one described by the UCP parameter. This is often useful but there
  4381. are situations where the current context has to be preserved.
  4382. -- Function: int swapcontext (ucontext_t *restrict OUCP, const
  4383. ucontext_t *restrict UCP)
  4384. Preliminary: | MT-Safe race:oucp race:ucp | AS-Unsafe corrupt |
  4385. AC-Unsafe corrupt | *Note POSIX Safety Concepts::.
  4386. The ‘swapcontext’ function is similar to ‘setcontext’ but instead
  4387. of just replacing the current context the latter is first saved in
  4388. the object pointed to by OUCP as if this was a call to
  4389. ‘getcontext’. The saved context would resume after the call to
  4390. ‘swapcontext’.
  4391. Once the current context is saved the context described in UCP is
  4392. installed and execution continues as described in this context.
  4393. If ‘swapcontext’ succeeds the function does not return unless the
  4394. context OUCP is used without prior modification by ‘makecontext’.
  4395. The return value in this case is ‘0’. If the function fails it
  4396. returns ‘-1’ and sets ‘errno’ accordingly.
  4397. Example for SVID Context Handling
  4398. =================================
  4399. The easiest way to use the context handling functions is as a
  4400. replacement for ‘setjmp’ and ‘longjmp’. The context contains on most
  4401. platforms more information which may lead to fewer surprises but this
  4402. also means using these functions is more expensive (besides being less
  4403. portable).
  4404. int
  4405. random_search (int n, int (*fp) (int, ucontext_t *))
  4406. {
  4407. volatile int cnt = 0;
  4408. ucontext_t uc;
  4409. /* Safe current context. */
  4410. if (getcontext (&uc) < 0)
  4411. return -1;
  4412. /* If we have not tried N times try again. */
  4413. if (cnt++ < n)
  4414. /* Call the function with a new random number
  4415. and the context. */
  4416. if (fp (rand (), &uc) != 0)
  4417. /* We found what we were looking for. */
  4418. return 1;
  4419. /* Not found. */
  4420. return 0;
  4421. }
  4422. Using contexts in such a way enables emulating exception handling.
  4423. The search functions passed in the FP parameter could be very large,
  4424. nested, and complex which would make it complicated (or at least would
  4425. require a lot of code) to leave the function with an error value which
  4426. has to be passed down to the caller. By using the context it is
  4427. possible to leave the search function in one step and allow restarting
  4428. the search which also has the nice side effect that it can be
  4429. significantly faster.
  4430. Something which is harder to implement with ‘setjmp’ and ‘longjmp’ is
  4431. to switch temporarily to a different execution path and then resume
  4432. where execution was stopped.
  4433. #include <signal.h>
  4434. #include <stdio.h>
  4435. #include <stdlib.h>
  4436. #include <ucontext.h>
  4437. #include <sys/time.h>
  4438. /* Set by the signal handler. */
  4439. static volatile int expired;
  4440. /* The contexts. */
  4441. static ucontext_t uc[3];
  4442. /* We do only a certain number of switches. */
  4443. static int switches;
  4444. /* This is the function doing the work. It is just a
  4445. skeleton, real code has to be filled in. */
  4446. static void
  4447. f (int n)
  4448. {
  4449. int m = 0;
  4450. while (1)
  4451. {
  4452. /* This is where the work would be done. */
  4453. if (++m % 100 == 0)
  4454. {
  4455. putchar ('.');
  4456. fflush (stdout);
  4457. }
  4458. /* Regularly the EXPIRE variable must be checked. */
  4459. if (expired)
  4460. {
  4461. /* We do not want the program to run forever. */
  4462. if (++switches == 20)
  4463. return;
  4464. printf ("\nswitching from %d to %d\n", n, 3 - n);
  4465. expired = 0;
  4466. /* Switch to the other context, saving the current one. */
  4467. swapcontext (&uc[n], &uc[3 - n]);
  4468. }
  4469. }
  4470. }
  4471. /* This is the signal handler which simply set the variable. */
  4472. void
  4473. handler (int signal)
  4474. {
  4475. expired = 1;
  4476. }
  4477. int
  4478. main (void)
  4479. {
  4480. struct sigaction sa;
  4481. struct itimerval it;
  4482. char st1[8192];
  4483. char st2[8192];
  4484. /* Initialize the data structures for the interval timer. */
  4485. sa.sa_flags = SA_RESTART;
  4486. sigfillset (&sa.sa_mask);
  4487. sa.sa_handler = handler;
  4488. it.it_interval.tv_sec = 0;
  4489. it.it_interval.tv_usec = 1;
  4490. it.it_value = it.it_interval;
  4491. /* Install the timer and get the context we can manipulate. */
  4492. if (sigaction (SIGPROF, &sa, NULL) < 0
  4493. || setitimer (ITIMER_PROF, &it, NULL) < 0
  4494. || getcontext (&uc[1]) == -1
  4495. || getcontext (&uc[2]) == -1)
  4496. abort ();
  4497. /* Create a context with a separate stack which causes the
  4498. function ‘f’ to be call with the parameter ‘1’.
  4499. Note that the ‘uc_link’ points to the main context
  4500. which will cause the program to terminate once the function
  4501. return. */
  4502. uc[1].uc_link = &uc[0];
  4503. uc[1].uc_stack.ss_sp = st1;
  4504. uc[1].uc_stack.ss_size = sizeof st1;
  4505. makecontext (&uc[1], (void (*) (void)) f, 1, 1);
  4506. /* Similarly, but ‘2’ is passed as the parameter to ‘f’. */
  4507. uc[2].uc_link = &uc[0];
  4508. uc[2].uc_stack.ss_sp = st2;
  4509. uc[2].uc_stack.ss_size = sizeof st2;
  4510. makecontext (&uc[2], (void (*) (void)) f, 1, 2);
  4511. /* Start running. */
  4512. swapcontext (&uc[0], &uc[1]);
  4513. putchar ('\n');
  4514. return 0;
  4515. }
  4516. This an example how the context functions can be used to implement
  4517. co-routines or cooperative multi-threading. All that has to be done is
  4518. to call every once in a while ‘swapcontext’ to continue running a
  4519. different context. It is not recommended to do the context switching
  4520. from the signal handler directly since leaving the signal handler via
  4521. ‘setcontext’ if the signal was delivered during code that was not
  4522. asynchronous signal safe could lead to problems. Setting a variable in
  4523. the signal handler and checking it in the body of the functions which
  4524. are executed is a safer approach. Since ‘swapcontext’ is saving the
  4525. current context it is possible to have multiple different scheduling
  4526. points in the code. Execution will always resume where it was left.
  4527. 
  4528. File: libc.info, Node: Signal Handling, Next: Program Basics, Prev: Non-Local Exits, Up: Top
  4529. 25 Signal Handling
  4530. ******************
  4531. A “signal” is a software interrupt delivered to a process. The
  4532. operating system uses signals to report exceptional situations to an
  4533. executing program. Some signals report errors such as references to
  4534. invalid memory addresses; others report asynchronous events, such as
  4535. disconnection of a phone line.
  4536. The GNU C Library defines a variety of signal types, each for a
  4537. particular kind of event. Some kinds of events make it inadvisable or
  4538. impossible for the program to proceed as usual, and the corresponding
  4539. signals normally abort the program. Other kinds of signals that report
  4540. harmless events are ignored by default.
  4541. If you anticipate an event that causes signals, you can define a
  4542. handler function and tell the operating system to run it when that
  4543. particular type of signal arrives.
  4544. Finally, one process can send a signal to another process; this
  4545. allows a parent process to abort a child, or two related processes to
  4546. communicate and synchronize.
  4547. * Menu:
  4548. * Concepts of Signals:: Introduction to the signal facilities.
  4549. * Standard Signals:: Particular kinds of signals with
  4550. standard names and meanings.
  4551. * Signal Actions:: Specifying what happens when a
  4552. particular signal is delivered.
  4553. * Defining Handlers:: How to write a signal handler function.
  4554. * Interrupted Primitives:: Signal handlers affect use of ‘open’,
  4555. ‘read’, ‘write’ and other functions.
  4556. * Generating Signals:: How to send a signal to a process.
  4557. * Blocking Signals:: Making the system hold signals temporarily.
  4558. * Waiting for a Signal:: Suspending your program until a signal
  4559. arrives.
  4560. * Signal Stack:: Using a Separate Signal Stack.
  4561. * BSD Signal Handling:: Additional functions for backward
  4562. compatibility with BSD.
  4563. 
  4564. File: libc.info, Node: Concepts of Signals, Next: Standard Signals, Up: Signal Handling
  4565. 25.1 Basic Concepts of Signals
  4566. ==============================
  4567. This section explains basic concepts of how signals are generated, what
  4568. happens after a signal is delivered, and how programs can handle
  4569. signals.
  4570. * Menu:
  4571. * Kinds of Signals:: Some examples of what can cause a signal.
  4572. * Signal Generation:: Concepts of why and how signals occur.
  4573. * Delivery of Signal:: Concepts of what a signal does to the
  4574. process.
  4575. 
  4576. File: libc.info, Node: Kinds of Signals, Next: Signal Generation, Up: Concepts of Signals
  4577. 25.1.1 Some Kinds of Signals
  4578. ----------------------------
  4579. A signal reports the occurrence of an exceptional event. These are some
  4580. of the events that can cause (or “generate”, or “raise”) a signal:
  4581. • A program error such as dividing by zero or issuing an address
  4582. outside the valid range.
  4583. • A user request to interrupt or terminate the program. Most
  4584. environments are set up to let a user suspend the program by typing
  4585. ‘C-z’, or terminate it with ‘C-c’. Whatever key sequence is used,
  4586. the operating system sends the proper signal to interrupt the
  4587. process.
  4588. • The termination of a child process.
  4589. • Expiration of a timer or alarm.
  4590. • A call to ‘kill’ or ‘raise’ by the same process.
  4591. • A call to ‘kill’ from another process. Signals are a limited but
  4592. useful form of interprocess communication.
  4593. • An attempt to perform an I/O operation that cannot be done.
  4594. Examples are reading from a pipe that has no writer (*note Pipes
  4595. and FIFOs::), and reading or writing to a terminal in certain
  4596. situations (*note Job Control::).
  4597. Each of these kinds of events (excepting explicit calls to ‘kill’ and
  4598. ‘raise’) generates its own particular kind of signal. The various kinds
  4599. of signals are listed and described in detail in *note Standard
  4600. Signals::.
  4601. 
  4602. File: libc.info, Node: Signal Generation, Next: Delivery of Signal, Prev: Kinds of Signals, Up: Concepts of Signals
  4603. 25.1.2 Concepts of Signal Generation
  4604. ------------------------------------
  4605. In general, the events that generate signals fall into three major
  4606. categories: errors, external events, and explicit requests.
  4607. An error means that a program has done something invalid and cannot
  4608. continue execution. But not all kinds of errors generate signals--in
  4609. fact, most do not. For example, opening a nonexistent file is an error,
  4610. but it does not raise a signal; instead, ‘open’ returns ‘-1’. In
  4611. general, errors that are necessarily associated with certain library
  4612. functions are reported by returning a value that indicates an error.
  4613. The errors which raise signals are those which can happen anywhere in
  4614. the program, not just in library calls. These include division by zero
  4615. and invalid memory addresses.
  4616. An external event generally has to do with I/O or other processes.
  4617. These include the arrival of input, the expiration of a timer, and the
  4618. termination of a child process.
  4619. An explicit request means the use of a library function such as
  4620. ‘kill’ whose purpose is specifically to generate a signal.
  4621. Signals may be generated “synchronously” or “asynchronously”. A
  4622. synchronous signal pertains to a specific action in the program, and is
  4623. delivered (unless blocked) during that action. Most errors generate
  4624. signals synchronously, and so do explicit requests by a process to
  4625. generate a signal for that same process. On some machines, certain
  4626. kinds of hardware errors (usually floating-point exceptions) are not
  4627. reported completely synchronously, but may arrive a few instructions
  4628. later.
  4629. Asynchronous signals are generated by events outside the control of
  4630. the process that receives them. These signals arrive at unpredictable
  4631. times during execution. External events generate signals
  4632. asynchronously, and so do explicit requests that apply to some other
  4633. process.
  4634. A given type of signal is either typically synchronous or typically
  4635. asynchronous. For example, signals for errors are typically synchronous
  4636. because errors generate signals synchronously. But any type of signal
  4637. can be generated synchronously or asynchronously with an explicit
  4638. request.
  4639. 
  4640. File: libc.info, Node: Delivery of Signal, Prev: Signal Generation, Up: Concepts of Signals
  4641. 25.1.3 How Signals Are Delivered
  4642. --------------------------------
  4643. When a signal is generated, it becomes “pending”. Normally it remains
  4644. pending for just a short period of time and then is “delivered” to the
  4645. process that was signaled. However, if that kind of signal is currently
  4646. “blocked”, it may remain pending indefinitely--until signals of that
  4647. kind are “unblocked”. Once unblocked, it will be delivered immediately.
  4648. *Note Blocking Signals::.
  4649. When the signal is delivered, whether right away or after a long
  4650. delay, the “specified action” for that signal is taken. For certain
  4651. signals, such as ‘SIGKILL’ and ‘SIGSTOP’, the action is fixed, but for
  4652. most signals, the program has a choice: ignore the signal, specify a
  4653. “handler function”, or accept the “default action” for that kind of
  4654. signal. The program specifies its choice using functions such as
  4655. ‘signal’ or ‘sigaction’ (*note Signal Actions::). We sometimes say that
  4656. a handler “catches” the signal. While the handler is running, that
  4657. particular signal is normally blocked.
  4658. If the specified action for a kind of signal is to ignore it, then
  4659. any such signal which is generated is discarded immediately. This
  4660. happens even if the signal is also blocked at the time. A signal
  4661. discarded in this way will never be delivered, not even if the program
  4662. subsequently specifies a different action for that kind of signal and
  4663. then unblocks it.
  4664. If a signal arrives which the program has neither handled nor
  4665. ignored, its “default action” takes place. Each kind of signal has its
  4666. own default action, documented below (*note Standard Signals::). For
  4667. most kinds of signals, the default action is to terminate the process.
  4668. For certain kinds of signals that represent "harmless" events, the
  4669. default action is to do nothing.
  4670. When a signal terminates a process, its parent process can determine
  4671. the cause of termination by examining the termination status code
  4672. reported by the ‘wait’ or ‘waitpid’ functions. (This is discussed in
  4673. more detail in *note Process Completion::.) The information it can get
  4674. includes the fact that termination was due to a signal and the kind of
  4675. signal involved. If a program you run from a shell is terminated by a
  4676. signal, the shell typically prints some kind of error message.
  4677. The signals that normally represent program errors have a special
  4678. property: when one of these signals terminates the process, it also
  4679. writes a “core dump file” which records the state of the process at the
  4680. time of termination. You can examine the core dump with a debugger to
  4681. investigate what caused the error.
  4682. If you raise a "program error" signal by explicit request, and this
  4683. terminates the process, it makes a core dump file just as if the signal
  4684. had been due directly to an error.
  4685. 
  4686. File: libc.info, Node: Standard Signals, Next: Signal Actions, Prev: Concepts of Signals, Up: Signal Handling
  4687. 25.2 Standard Signals
  4688. =====================
  4689. This section lists the names for various standard kinds of signals and
  4690. describes what kind of event they mean. Each signal name is a macro
  4691. which stands for a positive integer--the “signal number” for that kind
  4692. of signal. Your programs should never make assumptions about the
  4693. numeric code for a particular kind of signal, but rather refer to them
  4694. always by the names defined here. This is because the number for a
  4695. given kind of signal can vary from system to system, but the meanings of
  4696. the names are standardized and fairly uniform.
  4697. The signal names are defined in the header file ‘signal.h’.
  4698. -- Macro: int NSIG
  4699. The value of this symbolic constant is the total number of signals
  4700. defined. Since the signal numbers are allocated consecutively,
  4701. ‘NSIG’ is also one greater than the largest defined signal number.
  4702. * Menu:
  4703. * Program Error Signals:: Used to report serious program errors.
  4704. * Termination Signals:: Used to interrupt and/or terminate the
  4705. program.
  4706. * Alarm Signals:: Used to indicate expiration of timers.
  4707. * Asynchronous I/O Signals:: Used to indicate input is available.
  4708. * Job Control Signals:: Signals used to support job control.
  4709. * Operation Error Signals:: Used to report operational system errors.
  4710. * Miscellaneous Signals:: Miscellaneous Signals.
  4711. * Signal Messages:: Printing a message describing a signal.
  4712. 
  4713. File: libc.info, Node: Program Error Signals, Next: Termination Signals, Up: Standard Signals
  4714. 25.2.1 Program Error Signals
  4715. ----------------------------
  4716. The following signals are generated when a serious program error is
  4717. detected by the operating system or the computer itself. In general,
  4718. all of these signals are indications that your program is seriously
  4719. broken in some way, and there's usually no way to continue the
  4720. computation which encountered the error.
  4721. Some programs handle program error signals in order to tidy up before
  4722. terminating; for example, programs that turn off echoing of terminal
  4723. input should handle program error signals in order to turn echoing back
  4724. on. The handler should end by specifying the default action for the
  4725. signal that happened and then reraising it; this will cause the program
  4726. to terminate with that signal, as if it had not had a handler. (*Note
  4727. Termination in Handler::.)
  4728. Termination is the sensible ultimate outcome from a program error in
  4729. most programs. However, programming systems such as Lisp that can load
  4730. compiled user programs might need to keep executing even if a user
  4731. program incurs an error. These programs have handlers which use
  4732. ‘longjmp’ to return control to the command level.
  4733. The default action for all of these signals is to cause the process
  4734. to terminate. If you block or ignore these signals or establish
  4735. handlers for them that return normally, your program will probably break
  4736. horribly when such signals happen, unless they are generated by ‘raise’
  4737. or ‘kill’ instead of a real error.
  4738. When one of these program error signals terminates a process, it also
  4739. writes a “core dump file” which records the state of the process at the
  4740. time of termination. The core dump file is named ‘core’ and is written
  4741. in whichever directory is current in the process at the time. (On
  4742. GNU/Hurd systems, you can specify the file name for core dumps with the
  4743. environment variable ‘COREFILE’.) The purpose of core dump files is so
  4744. that you can examine them with a debugger to investigate what caused the
  4745. error.
  4746. -- Macro: int SIGFPE
  4747. The ‘SIGFPE’ signal reports a fatal arithmetic error. Although the
  4748. name is derived from "floating-point exception", this signal
  4749. actually covers all arithmetic errors, including division by zero
  4750. and overflow. If a program stores integer data in a location which
  4751. is then used in a floating-point operation, this often causes an
  4752. "invalid operation" exception, because the processor cannot
  4753. recognize the data as a floating-point number.
  4754. Actual floating-point exceptions are a complicated subject because
  4755. there are many types of exceptions with subtly different meanings,
  4756. and the ‘SIGFPE’ signal doesn't distinguish between them. The
  4757. ‘IEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE Std
  4758. 754-1985 and ANSI/IEEE Std 854-1987)’ defines various
  4759. floating-point exceptions and requires conforming computer systems
  4760. to report their occurrences. However, this standard does not
  4761. specify how the exceptions are reported, or what kinds of handling
  4762. and control the operating system can offer to the programmer.
  4763. BSD systems provide the ‘SIGFPE’ handler with an extra argument that
  4764. distinguishes various causes of the exception. In order to access this
  4765. argument, you must define the handler to accept two arguments, which
  4766. means you must cast it to a one-argument function type in order to
  4767. establish the handler. The GNU C Library does provide this extra
  4768. argument, but the value is meaningful only on operating systems that
  4769. provide the information (BSD systems and GNU systems).
  4770. ‘FPE_INTOVF_TRAP’
  4771. Integer overflow (impossible in a C program unless you enable
  4772. overflow trapping in a hardware-specific fashion).
  4773. ‘FPE_INTDIV_TRAP’
  4774. Integer division by zero.
  4775. ‘FPE_SUBRNG_TRAP’
  4776. Subscript-range (something that C programs never check for).
  4777. ‘FPE_FLTOVF_TRAP’
  4778. Floating overflow trap.
  4779. ‘FPE_FLTDIV_TRAP’
  4780. Floating/decimal division by zero.
  4781. ‘FPE_FLTUND_TRAP’
  4782. Floating underflow trap. (Trapping on floating underflow is not
  4783. normally enabled.)
  4784. ‘FPE_DECOVF_TRAP’
  4785. Decimal overflow trap. (Only a few machines have decimal
  4786. arithmetic and C never uses it.)
  4787. -- Macro: int SIGILL
  4788. The name of this signal is derived from "illegal instruction"; it
  4789. usually means your program is trying to execute garbage or a
  4790. privileged instruction. Since the C compiler generates only valid
  4791. instructions, ‘SIGILL’ typically indicates that the executable file
  4792. is corrupted, or that you are trying to execute data. Some common
  4793. ways of getting into the latter situation are by passing an invalid
  4794. object where a pointer to a function was expected, or by writing
  4795. past the end of an automatic array (or similar problems with
  4796. pointers to automatic variables) and corrupting other data on the
  4797. stack such as the return address of a stack frame.
  4798. ‘SIGILL’ can also be generated when the stack overflows, or when
  4799. the system has trouble running the handler for a signal.
  4800. -- Macro: int SIGSEGV
  4801. This signal is generated when a program tries to read or write
  4802. outside the memory that is allocated for it, or to write memory
  4803. that can only be read. (Actually, the signals only occur when the
  4804. program goes far enough outside to be detected by the system's
  4805. memory protection mechanism.) The name is an abbreviation for
  4806. "segmentation violation".
  4807. Common ways of getting a ‘SIGSEGV’ condition include dereferencing
  4808. a null or uninitialized pointer, or when you use a pointer to step
  4809. through an array, but fail to check for the end of the array. It
  4810. varies among systems whether dereferencing a null pointer generates
  4811. ‘SIGSEGV’ or ‘SIGBUS’.
  4812. -- Macro: int SIGBUS
  4813. This signal is generated when an invalid pointer is dereferenced.
  4814. Like ‘SIGSEGV’, this signal is typically the result of
  4815. dereferencing an uninitialized pointer. The difference between the
  4816. two is that ‘SIGSEGV’ indicates an invalid access to valid memory,
  4817. while ‘SIGBUS’ indicates an access to an invalid address. In
  4818. particular, ‘SIGBUS’ signals often result from dereferencing a
  4819. misaligned pointer, such as referring to a four-word integer at an
  4820. address not divisible by four. (Each kind of computer has its own
  4821. requirements for address alignment.)
  4822. The name of this signal is an abbreviation for "bus error".
  4823. -- Macro: int SIGABRT
  4824. This signal indicates an error detected by the program itself and
  4825. reported by calling ‘abort’. *Note Aborting a Program::.
  4826. -- Macro: int SIGIOT
  4827. Generated by the PDP-11 "iot" instruction. On most machines, this
  4828. is just another name for ‘SIGABRT’.
  4829. -- Macro: int SIGTRAP
  4830. Generated by the machine's breakpoint instruction, and possibly
  4831. other trap instructions. This signal is used by debuggers. Your
  4832. program will probably only see ‘SIGTRAP’ if it is somehow executing
  4833. bad instructions.
  4834. -- Macro: int SIGEMT
  4835. Emulator trap; this results from certain unimplemented instructions
  4836. which might be emulated in software, or the operating system's
  4837. failure to properly emulate them.
  4838. -- Macro: int SIGSYS
  4839. System call event. This signal may be generated by a valid system
  4840. call which requested an invalid sub-function, and also by the
  4841. SECCOMP filter when it filters or traps a system call.
  4842. If the system call itself is invalid or unsupported by the kernel,
  4843. the call will not raise this signal, but will return ‘ENOSYS’.
  4844. -- Macro: int SIGSTKFLT
  4845. Coprocessor stack fault. Obsolete, no longer generated. This
  4846. signal may be used by applications in much the way ‘SIGUSR1’ and
  4847. ‘SIGUSR2’ are.
  4848. 
  4849. File: libc.info, Node: Termination Signals, Next: Alarm Signals, Prev: Program Error Signals, Up: Standard Signals
  4850. 25.2.2 Termination Signals
  4851. --------------------------
  4852. These signals are all used to tell a process to terminate, in one way or
  4853. another. They have different names because they're used for slightly
  4854. different purposes, and programs might want to handle them differently.
  4855. The reason for handling these signals is usually so your program can
  4856. tidy up as appropriate before actually terminating. For example, you
  4857. might want to save state information, delete temporary files, or restore
  4858. the previous terminal modes. Such a handler should end by specifying
  4859. the default action for the signal that happened and then reraising it;
  4860. this will cause the program to terminate with that signal, as if it had
  4861. not had a handler. (*Note Termination in Handler::.)
  4862. The (obvious) default action for all of these signals is to cause the
  4863. process to terminate.
  4864. -- Macro: int SIGTERM
  4865. The ‘SIGTERM’ signal is a generic signal used to cause program
  4866. termination. Unlike ‘SIGKILL’, this signal can be blocked,
  4867. handled, and ignored. It is the normal way to politely ask a
  4868. program to terminate.
  4869. The shell command ‘kill’ generates ‘SIGTERM’ by default.
  4870. -- Macro: int SIGINT
  4871. The ‘SIGINT’ ("program interrupt") signal is sent when the user
  4872. types the INTR character (normally ‘C-c’). *Note Special
  4873. Characters::, for information about terminal driver support for
  4874. ‘C-c’.
  4875. -- Macro: int SIGQUIT
  4876. The ‘SIGQUIT’ signal is similar to ‘SIGINT’, except that it's
  4877. controlled by a different key--the QUIT character, usually
  4878. ‘C-\’--and produces a core dump when it terminates the process,
  4879. just like a program error signal. You can think of this as a
  4880. program error condition "detected" by the user.
  4881. *Note Program Error Signals::, for information about core dumps.
  4882. *Note Special Characters::, for information about terminal driver
  4883. support.
  4884. Certain kinds of cleanups are best omitted in handling ‘SIGQUIT’.
  4885. For example, if the program creates temporary files, it should
  4886. handle the other termination requests by deleting the temporary
  4887. files. But it is better for ‘SIGQUIT’ not to delete them, so that
  4888. the user can examine them in conjunction with the core dump.
  4889. -- Macro: int SIGKILL
  4890. The ‘SIGKILL’ signal is used to cause immediate program
  4891. termination. It cannot be handled or ignored, and is therefore
  4892. always fatal. It is also not possible to block this signal.
  4893. This signal is usually generated only by explicit request. Since
  4894. it cannot be handled, you should generate it only as a last resort,
  4895. after first trying a less drastic method such as ‘C-c’ or
  4896. ‘SIGTERM’. If a process does not respond to any other termination
  4897. signals, sending it a ‘SIGKILL’ signal will almost always cause it
  4898. to go away.
  4899. In fact, if ‘SIGKILL’ fails to terminate a process, that by itself
  4900. constitutes an operating system bug which you should report.
  4901. The system will generate ‘SIGKILL’ for a process itself under some
  4902. unusual conditions where the program cannot possibly continue to
  4903. run (even to run a signal handler).
  4904. -- Macro: int SIGHUP
  4905. The ‘SIGHUP’ ("hang-up") signal is used to report that the user's
  4906. terminal is disconnected, perhaps because a network or telephone
  4907. connection was broken. For more information about this, see *note
  4908. Control Modes::.
  4909. This signal is also used to report the termination of the
  4910. controlling process on a terminal to jobs associated with that
  4911. session; this termination effectively disconnects all processes in
  4912. the session from the controlling terminal. For more information,
  4913. see *note Termination Internals::.
  4914. 
  4915. File: libc.info, Node: Alarm Signals, Next: Asynchronous I/O Signals, Prev: Termination Signals, Up: Standard Signals
  4916. 25.2.3 Alarm Signals
  4917. --------------------
  4918. These signals are used to indicate the expiration of timers. *Note
  4919. Setting an Alarm::, for information about functions that cause these
  4920. signals to be sent.
  4921. The default behavior for these signals is to cause program
  4922. termination. This default is rarely useful, but no other default would
  4923. be useful; most of the ways of using these signals would require handler
  4924. functions in any case.
  4925. -- Macro: int SIGALRM
  4926. This signal typically indicates expiration of a timer that measures
  4927. real or clock time. It is used by the ‘alarm’ function, for
  4928. example.
  4929. -- Macro: int SIGVTALRM
  4930. This signal typically indicates expiration of a timer that measures
  4931. CPU time used by the current process. The name is an abbreviation
  4932. for "virtual time alarm".
  4933. -- Macro: int SIGPROF
  4934. This signal typically indicates expiration of a timer that measures
  4935. both CPU time used by the current process, and CPU time expended on
  4936. behalf of the process by the system. Such a timer is used to
  4937. implement code profiling facilities, hence the name of this signal.
  4938. 
  4939. File: libc.info, Node: Asynchronous I/O Signals, Next: Job Control Signals, Prev: Alarm Signals, Up: Standard Signals
  4940. 25.2.4 Asynchronous I/O Signals
  4941. -------------------------------
  4942. The signals listed in this section are used in conjunction with
  4943. asynchronous I/O facilities. You have to take explicit action by
  4944. calling ‘fcntl’ to enable a particular file descriptor to generate these
  4945. signals (*note Interrupt Input::). The default action for these signals
  4946. is to ignore them.
  4947. -- Macro: int SIGIO
  4948. This signal is sent when a file descriptor is ready to perform
  4949. input or output.
  4950. On most operating systems, terminals and sockets are the only kinds
  4951. of files that can generate ‘SIGIO’; other kinds, including ordinary
  4952. files, never generate ‘SIGIO’ even if you ask them to.
  4953. On GNU systems ‘SIGIO’ will always be generated properly if you
  4954. successfully set asynchronous mode with ‘fcntl’.
  4955. -- Macro: int SIGURG
  4956. This signal is sent when "urgent" or out-of-band data arrives on a
  4957. socket. *Note Out-of-Band Data::.
  4958. -- Macro: int SIGPOLL
  4959. This is a System V signal name, more or less similar to ‘SIGIO’.
  4960. It is defined only for compatibility.
  4961. 
  4962. File: libc.info, Node: Job Control Signals, Next: Operation Error Signals, Prev: Asynchronous I/O Signals, Up: Standard Signals
  4963. 25.2.5 Job Control Signals
  4964. --------------------------
  4965. These signals are used to support job control. If your system doesn't
  4966. support job control, then these macros are defined but the signals
  4967. themselves can't be raised or handled.
  4968. You should generally leave these signals alone unless you really
  4969. understand how job control works. *Note Job Control::.
  4970. -- Macro: int SIGCHLD
  4971. This signal is sent to a parent process whenever one of its child
  4972. processes terminates or stops.
  4973. The default action for this signal is to ignore it. If you
  4974. establish a handler for this signal while there are child processes
  4975. that have terminated but not reported their status via ‘wait’ or
  4976. ‘waitpid’ (*note Process Completion::), whether your new handler
  4977. applies to those processes or not depends on the particular
  4978. operating system.
  4979. -- Macro: int SIGCLD
  4980. This is an obsolete name for ‘SIGCHLD’.
  4981. -- Macro: int SIGCONT
  4982. You can send a ‘SIGCONT’ signal to a process to make it continue.
  4983. This signal is special--it always makes the process continue if it
  4984. is stopped, before the signal is delivered. The default behavior
  4985. is to do nothing else. You cannot block this signal. You can set
  4986. a handler, but ‘SIGCONT’ always makes the process continue
  4987. regardless.
  4988. Most programs have no reason to handle ‘SIGCONT’; they simply
  4989. resume execution without realizing they were ever stopped. You can
  4990. use a handler for ‘SIGCONT’ to make a program do something special
  4991. when it is stopped and continued--for example, to reprint a prompt
  4992. when it is suspended while waiting for input.
  4993. -- Macro: int SIGSTOP
  4994. The ‘SIGSTOP’ signal stops the process. It cannot be handled,
  4995. ignored, or blocked.
  4996. -- Macro: int SIGTSTP
  4997. The ‘SIGTSTP’ signal is an interactive stop signal. Unlike
  4998. ‘SIGSTOP’, this signal can be handled and ignored.
  4999. Your program should handle this signal if you have a special need
  5000. to leave files or system tables in a secure state when a process is
  5001. stopped. For example, programs that turn off echoing should handle
  5002. ‘SIGTSTP’ so they can turn echoing back on before stopping.
  5003. This signal is generated when the user types the SUSP character
  5004. (normally ‘C-z’). For more information about terminal driver
  5005. support, see *note Special Characters::.
  5006. -- Macro: int SIGTTIN
  5007. A process cannot read from the user's terminal while it is running
  5008. as a background job. When any process in a background job tries to
  5009. read from the terminal, all of the processes in the job are sent a
  5010. ‘SIGTTIN’ signal. The default action for this signal is to stop
  5011. the process. For more information about how this interacts with
  5012. the terminal driver, see *note Access to the Terminal::.
  5013. -- Macro: int SIGTTOU
  5014. This is similar to ‘SIGTTIN’, but is generated when a process in a
  5015. background job attempts to write to the terminal or set its modes.
  5016. Again, the default action is to stop the process. ‘SIGTTOU’ is
  5017. only generated for an attempt to write to the terminal if the
  5018. ‘TOSTOP’ output mode is set; *note Output Modes::.
  5019. While a process is stopped, no more signals can be delivered to it
  5020. until it is continued, except ‘SIGKILL’ signals and (obviously)
  5021. ‘SIGCONT’ signals. The signals are marked as pending, but not delivered
  5022. until the process is continued. The ‘SIGKILL’ signal always causes
  5023. termination of the process and can't be blocked, handled or ignored.
  5024. You can ignore ‘SIGCONT’, but it always causes the process to be
  5025. continued anyway if it is stopped. Sending a ‘SIGCONT’ signal to a
  5026. process causes any pending stop signals for that process to be
  5027. discarded. Likewise, any pending ‘SIGCONT’ signals for a process are
  5028. discarded when it receives a stop signal.
  5029. When a process in an orphaned process group (*note Orphaned Process
  5030. Groups::) receives a ‘SIGTSTP’, ‘SIGTTIN’, or ‘SIGTTOU’ signal and does
  5031. not handle it, the process does not stop. Stopping the process would
  5032. probably not be very useful, since there is no shell program that will
  5033. notice it stop and allow the user to continue it. What happens instead
  5034. depends on the operating system you are using. Some systems may do
  5035. nothing; others may deliver another signal instead, such as ‘SIGKILL’ or
  5036. ‘SIGHUP’. On GNU/Hurd systems, the process dies with ‘SIGKILL’; this
  5037. avoids the problem of many stopped, orphaned processes lying around the
  5038. system.
  5039. 
  5040. File: libc.info, Node: Operation Error Signals, Next: Miscellaneous Signals, Prev: Job Control Signals, Up: Standard Signals
  5041. 25.2.6 Operation Error Signals
  5042. ------------------------------
  5043. These signals are used to report various errors generated by an
  5044. operation done by the program. They do not necessarily indicate a
  5045. programming error in the program, but an error that prevents an
  5046. operating system call from completing. The default action for all of
  5047. them is to cause the process to terminate.
  5048. -- Macro: int SIGPIPE
  5049. Broken pipe. If you use pipes or FIFOs, you have to design your
  5050. application so that one process opens the pipe for reading before
  5051. another starts writing. If the reading process never starts, or
  5052. terminates unexpectedly, writing to the pipe or FIFO raises a
  5053. ‘SIGPIPE’ signal. If ‘SIGPIPE’ is blocked, handled or ignored, the
  5054. offending call fails with ‘EPIPE’ instead.
  5055. Pipes and FIFO special files are discussed in more detail in *note
  5056. Pipes and FIFOs::.
  5057. Another cause of ‘SIGPIPE’ is when you try to output to a socket
  5058. that isn't connected. *Note Sending Data::.
  5059. -- Macro: int SIGLOST
  5060. Resource lost. On GNU/Hurd systems, ‘SIGLOST’ is generated when
  5061. any server program dies unexpectedly. It is usually fine to ignore
  5062. the signal; whatever call was made to the server that died just
  5063. returns an error. This signal's original purpose of signalling a
  5064. lost NFS lock is obsolete.
  5065. -- Macro: int SIGXCPU
  5066. CPU time limit exceeded. This signal is generated when the process
  5067. exceeds its soft resource limit on CPU time. *Note Limits on
  5068. Resources::.
  5069. -- Macro: int SIGXFSZ
  5070. File size limit exceeded. This signal is generated when the
  5071. process attempts to extend a file so it exceeds the process's soft
  5072. resource limit on file size. *Note Limits on Resources::.
  5073. 
  5074. File: libc.info, Node: Miscellaneous Signals, Next: Signal Messages, Prev: Operation Error Signals, Up: Standard Signals
  5075. 25.2.7 Miscellaneous Signals
  5076. ----------------------------
  5077. These signals are used for various other purposes. In general, they
  5078. will not affect your program unless it explicitly uses them for
  5079. something.
  5080. -- Macro: int SIGUSR1
  5081. -- Macro: int SIGUSR2
  5082. The ‘SIGUSR1’ and ‘SIGUSR2’ signals are set aside for you to use
  5083. any way you want. They're useful for simple interprocess
  5084. communication, if you write a signal handler for them in the
  5085. program that receives the signal.
  5086. There is an example showing the use of ‘SIGUSR1’ and ‘SIGUSR2’ in
  5087. *note Signaling Another Process::.
  5088. The default action is to terminate the process.
  5089. -- Macro: int SIGWINCH
  5090. Window size change. This is generated on some systems (including
  5091. GNU) when the terminal driver's record of the number of rows and
  5092. columns on the screen is changed. The default action is to ignore
  5093. it.
  5094. If a program does full-screen display, it should handle ‘SIGWINCH’.
  5095. When the signal arrives, it should fetch the new screen size and
  5096. reformat its display accordingly.
  5097. This macro was originally a BSD extension, but was added in
  5098. POSIX.1-2024.
  5099. -- Macro: int SIGINFO
  5100. Information request. On 4.4 BSD and GNU/Hurd systems, this signal
  5101. is sent to all the processes in the foreground process group of the
  5102. controlling terminal when the user types the STATUS character in
  5103. canonical mode; *note Signal Characters::.
  5104. If the process is the leader of the process group, the default
  5105. action is to print some status information about the system and
  5106. what the process is doing. Otherwise the default is to do nothing.
  5107. -- Macro: int SIGPWR
  5108. Power lost or restored. On s390x Linux systems, this signal is
  5109. generated when a machine check warning is issued, and is sent to
  5110. the process designated to receive ctrl-alt-del notifications.
  5111. Otherwise, it is up to userspace applications to generate this
  5112. signal and manage notifications as to the type of power event that
  5113. happened.
  5114. The default action is to terminate the process.
  5115. 
  5116. File: libc.info, Node: Signal Messages, Prev: Miscellaneous Signals, Up: Standard Signals
  5117. 25.2.8 Signal Messages
  5118. ----------------------
  5119. We mentioned above that the shell prints a message describing the signal
  5120. that terminated a child process. The clean way to print a message
  5121. describing a signal is to use the functions ‘strsignal’ and ‘psignal’.
  5122. These functions use a signal number to specify which kind of signal to
  5123. describe. The signal number may come from the termination status of a
  5124. child process (*note Process Completion::) or it may come from a signal
  5125. handler in the same process.
  5126. -- Function: char * strsignal (int SIGNUM)
  5127. Preliminary: | MT-Unsafe race:strsignal locale | AS-Unsafe init
  5128. i18n corrupt heap | AC-Unsafe init corrupt mem | *Note POSIX Safety
  5129. Concepts::.
  5130. This function returns a pointer to a statically-allocated string
  5131. containing a message describing the signal SIGNUM. You should not
  5132. modify the contents of this string; and, since it can be rewritten
  5133. on subsequent calls, you should save a copy of it if you need to
  5134. reference it later.
  5135. This function is a GNU extension, declared in the header file
  5136. ‘string.h’.
  5137. -- Function: void psignal (int SIGNUM, const char *MESSAGE)
  5138. Preliminary: | MT-Safe locale | AS-Unsafe corrupt i18n heap |
  5139. AC-Unsafe lock corrupt mem | *Note POSIX Safety Concepts::.
  5140. This function prints a message describing the signal SIGNUM to the
  5141. standard error output stream ‘stderr’; see *note Standard
  5142. Streams::.
  5143. If you call ‘psignal’ with a MESSAGE that is either a null pointer
  5144. or an empty string, ‘psignal’ just prints the message corresponding
  5145. to SIGNUM, adding a trailing newline.
  5146. If you supply a non-null MESSAGE argument, then ‘psignal’ prefixes
  5147. its output with this string. It adds a colon and a space character
  5148. to separate the MESSAGE from the string corresponding to SIGNUM.
  5149. This function is a BSD feature, declared in the header file
  5150. ‘signal.h’.
  5151. -- Function: const char * sigdescr_np (int SIGNUM)
  5152. | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::.
  5153. This function returns the message describing the signal SIGNUM or
  5154. ‘NULL’ for invalid signal number (e.g "Hangup" for ‘SIGHUP’).
  5155. Different than ‘strsignal’ the returned description is not
  5156. translated. The message points to a static storage whose lifetime
  5157. is the whole lifetime of the program.
  5158. This function is a GNU extension, declared in the header file
  5159. ‘string.h’.
  5160. -- Function: const char * sigabbrev_np (int SIGNUM)
  5161. | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::.
  5162. This function returns the abbreviation describing the signal SIGNUM
  5163. or ‘NULL’ for invalid signal number. The message points to a
  5164. static storage whose lifetime is the whole lifetime of the program.
  5165. This function is a GNU extension, declared in the header file
  5166. ‘string.h’.
  5167. 
  5168. File: libc.info, Node: Signal Actions, Next: Defining Handlers, Prev: Standard Signals, Up: Signal Handling
  5169. 25.3 Specifying Signal Actions
  5170. ==============================
  5171. The simplest way to change the action for a signal is to use the
  5172. ‘signal’ function. You can specify a built-in action (such as to ignore
  5173. the signal), or you can “establish a handler”.
  5174. The GNU C Library also implements the more versatile ‘sigaction’
  5175. facility. This section describes both facilities and gives suggestions
  5176. on which to use when.
  5177. * Menu:
  5178. * Basic Signal Handling:: The simple ‘signal’ function.
  5179. * Advanced Signal Handling:: The more powerful ‘sigaction’ function.
  5180. * Signal and Sigaction:: How those two functions interact.
  5181. * Sigaction Function Example:: An example of using the sigaction function.
  5182. * Flags for Sigaction:: Specifying options for signal handling.
  5183. * Initial Signal Actions:: How programs inherit signal actions.
  5184. 
  5185. File: libc.info, Node: Basic Signal Handling, Next: Advanced Signal Handling, Up: Signal Actions
  5186. 25.3.1 Basic Signal Handling
  5187. ----------------------------
  5188. The ‘signal’ function provides a simple interface for establishing an
  5189. action for a particular signal. The function and associated macros are
  5190. declared in the header file ‘signal.h’.
  5191. -- Data Type: sighandler_t
  5192. This is the type of signal handler functions. Signal handlers take
  5193. one integer argument specifying the signal number, and have return
  5194. type ‘void’. So, you should define handler functions like this:
  5195. void HANDLER (int signum) { ... }
  5196. The name ‘sighandler_t’ for this data type is a GNU extension.
  5197. -- Function: sighandler_t signal (int SIGNUM, sighandler_t ACTION)
  5198. Preliminary: | MT-Safe sigintr | AS-Safe | AC-Safe | *Note POSIX
  5199. Safety Concepts::.
  5200. The ‘signal’ function establishes ACTION as the action for the
  5201. signal SIGNUM.
  5202. The first argument, SIGNUM, identifies the signal whose behavior
  5203. you want to control, and should be a signal number. The proper way
  5204. to specify a signal number is with one of the symbolic signal names
  5205. (*note Standard Signals::)--don't use an explicit number, because
  5206. the numerical code for a given kind of signal may vary from
  5207. operating system to operating system.
  5208. The second argument, ACTION, specifies the action to use for the
  5209. signal SIGNUM. This can be one of the following:
  5210. ‘SIG_DFL’
  5211. ‘SIG_DFL’ specifies the default action for the particular
  5212. signal. The default actions for various kinds of signals are
  5213. stated in *note Standard Signals::.
  5214. ‘SIG_IGN’
  5215. ‘SIG_IGN’ specifies that the signal should be ignored.
  5216. Your program generally should not ignore signals that
  5217. represent serious events or that are normally used to request
  5218. termination. You cannot ignore the ‘SIGKILL’ or ‘SIGSTOP’
  5219. signals at all. You can ignore program error signals like
  5220. ‘SIGSEGV’, but ignoring the error won't enable the program to
  5221. continue executing meaningfully. Ignoring user requests such
  5222. as ‘SIGINT’, ‘SIGQUIT’, and ‘SIGTSTP’ is unfriendly.
  5223. When you do not wish signals to be delivered during a certain
  5224. part of the program, the thing to do is to block them, not
  5225. ignore them. *Note Blocking Signals::.
  5226. ‘HANDLER’
  5227. Supply the address of a handler function in your program, to
  5228. specify running this handler as the way to deliver the signal.
  5229. For more information about defining signal handler functions,
  5230. see *note Defining Handlers::.
  5231. If you set the action for a signal to ‘SIG_IGN’, or if you set it
  5232. to ‘SIG_DFL’ and the default action is to ignore that signal, then
  5233. any pending signals of that type are discarded (even if they are
  5234. blocked). Discarding the pending signals means that they will
  5235. never be delivered, not even if you subsequently specify another
  5236. action and unblock this kind of signal.
  5237. The ‘signal’ function returns the action that was previously in
  5238. effect for the specified SIGNUM. You can save this value and
  5239. restore it later by calling ‘signal’ again.
  5240. If ‘signal’ can't honor the request, it returns ‘SIG_ERR’ instead.
  5241. The following ‘errno’ error conditions are defined for this
  5242. function:
  5243. ‘EINVAL’
  5244. You specified an invalid SIGNUM; or you tried to ignore or
  5245. provide a handler for ‘SIGKILL’ or ‘SIGSTOP’.
  5246. *Compatibility Note:* A problem encountered when working with the
  5247. ‘signal’ function is that it has different semantics on BSD and SVID
  5248. systems. The difference is that on SVID systems the signal handler is
  5249. deinstalled after signal delivery. On BSD systems the handler must be
  5250. explicitly deinstalled. In the GNU C Library we use the BSD version by
  5251. default. To use the SVID version you can either use the function
  5252. ‘sysv_signal’ (see below) or use the ‘_XOPEN_SOURCE’ feature select
  5253. macro (*note Feature Test Macros::). In general, use of these functions
  5254. should be avoided because of compatibility problems. It is better to
  5255. use ‘sigaction’ if it is available since the results are much more
  5256. reliable.
  5257. Here is a simple example of setting up a handler to delete temporary
  5258. files when certain fatal signals happen:
  5259. #include <signal.h>
  5260. void
  5261. termination_handler (int signum)
  5262. {
  5263. struct temp_file *p;
  5264. for (p = temp_file_list; p; p = p->next)
  5265. unlink (p->name);
  5266. }
  5267. int
  5268. main (void)
  5269. {
  5270. ...
  5271. if (signal (SIGINT, termination_handler) == SIG_IGN)
  5272. signal (SIGINT, SIG_IGN);
  5273. if (signal (SIGHUP, termination_handler) == SIG_IGN)
  5274. signal (SIGHUP, SIG_IGN);
  5275. if (signal (SIGTERM, termination_handler) == SIG_IGN)
  5276. signal (SIGTERM, SIG_IGN);
  5277. ...
  5278. }
  5279. Note that if a given signal was previously set to be ignored, this code
  5280. avoids altering that setting. This is because non-job-control shells
  5281. often ignore certain signals when starting children, and it is important
  5282. for the children to respect this.
  5283. We do not handle ‘SIGQUIT’ or the program error signals in this
  5284. example because these are designed to provide information for debugging
  5285. (a core dump), and the temporary files may give useful information.
  5286. -- Function: sighandler_t sysv_signal (int SIGNUM, sighandler_t ACTION)
  5287. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5288. Concepts::.
  5289. The ‘sysv_signal’ implements the behavior of the standard ‘signal’
  5290. function as found on SVID systems. The difference to BSD systems
  5291. is that the handler is deinstalled after a delivery of a signal.
  5292. *Compatibility Note:* As said above for ‘signal’, this function
  5293. should be avoided when possible. ‘sigaction’ is the preferred
  5294. method.
  5295. -- Function: sighandler_t ssignal (int SIGNUM, sighandler_t ACTION)
  5296. Preliminary: | MT-Safe sigintr | AS-Safe | AC-Safe | *Note POSIX
  5297. Safety Concepts::.
  5298. The ‘ssignal’ function does the same thing as ‘signal’; it is
  5299. provided only for compatibility with SVID.
  5300. -- Macro: sighandler_t SIG_ERR
  5301. The value of this macro is used as the return value from ‘signal’
  5302. to indicate an error.
  5303. 
  5304. File: libc.info, Node: Advanced Signal Handling, Next: Signal and Sigaction, Prev: Basic Signal Handling, Up: Signal Actions
  5305. 25.3.2 Advanced Signal Handling
  5306. -------------------------------
  5307. The ‘sigaction’ function has the same basic effect as ‘signal’: to
  5308. specify how a signal should be handled by the process. However,
  5309. ‘sigaction’ offers more control, at the expense of more complexity. In
  5310. particular, ‘sigaction’ allows you to specify additional flags to
  5311. control when the signal is generated and how the handler is invoked.
  5312. The ‘sigaction’ function is declared in ‘signal.h’.
  5313. -- Data Type: struct sigaction
  5314. Structures of type ‘struct sigaction’ are used in the ‘sigaction’
  5315. function to specify all the information about how to handle a
  5316. particular signal. This structure contains at least the following
  5317. members:
  5318. ‘sighandler_t sa_handler’
  5319. This is used in the same way as the ACTION argument to the
  5320. ‘signal’ function. The value can be ‘SIG_DFL’, ‘SIG_IGN’, or
  5321. a function pointer. *Note Basic Signal Handling::.
  5322. ‘void (*sa_sigaction) (int SIGNUM, siginfo_t *INFO, void *UCONTEXT)’
  5323. This is an alternate to ‘sa_handler’ that is used when the
  5324. ‘sa_flags’ includes the ‘flag SA_SIGINFO’. Note that this and
  5325. ‘sa_handler’ overlap; only ever set one at a time.
  5326. The contents of the INFO and UCONTEXT structures are kernel
  5327. and architecture dependent. Please see sigaction(2) (Latest,
  5328. online:
  5329. <https://man7.org/linux/man-pages/man2/sigaction.2.html>)
  5330. *Note Linux Kernel:: for details.
  5331. ‘sigset_t sa_mask’
  5332. This specifies a set of signals to be blocked while the
  5333. handler runs. Blocking is explained in *note Blocking for
  5334. Handler::. Note that the signal that was delivered is
  5335. automatically blocked by default before its handler is
  5336. started; this is true regardless of the value in ‘sa_mask’.
  5337. If you want that signal not to be blocked within its handler,
  5338. you must write code in the handler to unblock it.
  5339. ‘int sa_flags’
  5340. This specifies various flags which can affect the behavior of
  5341. the signal. These are described in more detail in *note Flags
  5342. for Sigaction::.
  5343. -- Function: int sigaction (int SIGNUM, const struct sigaction
  5344. *restrict ACTION, struct sigaction *restrict OLD-ACTION)
  5345. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5346. Concepts::.
  5347. The ACTION argument is used to set up a new action for the signal
  5348. SIGNUM, while the OLD-ACTION argument is used to return information
  5349. about the action previously associated with this signal. (In other
  5350. words, OLD-ACTION has the same purpose as the ‘signal’ function's
  5351. return value--you can check to see what the old action in effect
  5352. for the signal was, and restore it later if you want.)
  5353. Either ACTION or OLD-ACTION can be a null pointer. If OLD-ACTION
  5354. is a null pointer, this simply suppresses the return of information
  5355. about the old action. If ACTION is a null pointer, the action
  5356. associated with the signal SIGNUM is unchanged; this allows you to
  5357. inquire about how a signal is being handled without changing that
  5358. handling.
  5359. The return value from ‘sigaction’ is zero if it succeeds, and ‘-1’
  5360. on failure. The following ‘errno’ error conditions are defined for
  5361. this function:
  5362. ‘EINVAL’
  5363. The SIGNUM argument is not valid, or you are trying to trap or
  5364. ignore ‘SIGKILL’ or ‘SIGSTOP’.
  5365. 
  5366. File: libc.info, Node: Signal and Sigaction, Next: Sigaction Function Example, Prev: Advanced Signal Handling, Up: Signal Actions
  5367. 25.3.3 Interaction of ‘signal’ and ‘sigaction’
  5368. ----------------------------------------------
  5369. It's possible to use both the ‘signal’ and ‘sigaction’ functions within
  5370. a single program, but you have to be careful because they can interact
  5371. in slightly strange ways.
  5372. The ‘sigaction’ function specifies more information than the ‘signal’
  5373. function, so the return value from ‘signal’ cannot express the full
  5374. range of ‘sigaction’ possibilities. Therefore, if you use ‘signal’ to
  5375. save and later reestablish an action, it may not be able to reestablish
  5376. properly a handler that was established with ‘sigaction’.
  5377. To avoid having problems as a result, always use ‘sigaction’ to save
  5378. and restore a handler if your program uses ‘sigaction’ at all. Since
  5379. ‘sigaction’ is more general, it can properly save and reestablish any
  5380. action, regardless of whether it was established originally with
  5381. ‘signal’ or ‘sigaction’.
  5382. On some systems if you establish an action with ‘signal’ and then
  5383. examine it with ‘sigaction’, the handler address that you get may not be
  5384. the same as what you specified with ‘signal’. It may not even be
  5385. suitable for use as an action argument with ‘signal’. But you can rely
  5386. on using it as an argument to ‘sigaction’. This problem never happens
  5387. on GNU systems.
  5388. So, you're better off using one or the other of the mechanisms
  5389. consistently within a single program.
  5390. *Portability Note:* The basic ‘signal’ function is a feature of
  5391. ISO C, while ‘sigaction’ is part of the POSIX.1 standard. If you are
  5392. concerned about portability to non-POSIX systems, then you should use
  5393. the ‘signal’ function instead.
  5394. 
  5395. File: libc.info, Node: Sigaction Function Example, Next: Flags for Sigaction, Prev: Signal and Sigaction, Up: Signal Actions
  5396. 25.3.4 ‘sigaction’ Function Example
  5397. -----------------------------------
  5398. In *note Basic Signal Handling::, we gave an example of establishing a
  5399. simple handler for termination signals using ‘signal’. Here is an
  5400. equivalent example using ‘sigaction’:
  5401. #include <signal.h>
  5402. void
  5403. termination_handler (int signum)
  5404. {
  5405. struct temp_file *p;
  5406. for (p = temp_file_list; p; p = p->next)
  5407. unlink (p->name);
  5408. }
  5409. int
  5410. main (void)
  5411. {
  5412. ...
  5413. struct sigaction new_action, old_action;
  5414. /* Set up the structure to specify the new action. */
  5415. new_action.sa_handler = termination_handler;
  5416. sigemptyset (&new_action.sa_mask);
  5417. new_action.sa_flags = 0;
  5418. sigaction (SIGINT, NULL, &old_action);
  5419. if (old_action.sa_handler != SIG_IGN)
  5420. sigaction (SIGINT, &new_action, NULL);
  5421. sigaction (SIGHUP, NULL, &old_action);
  5422. if (old_action.sa_handler != SIG_IGN)
  5423. sigaction (SIGHUP, &new_action, NULL);
  5424. sigaction (SIGTERM, NULL, &old_action);
  5425. if (old_action.sa_handler != SIG_IGN)
  5426. sigaction (SIGTERM, &new_action, NULL);
  5427. ...
  5428. }
  5429. The program just loads the ‘new_action’ structure with the desired
  5430. parameters and passes it in the ‘sigaction’ call. The usage of
  5431. ‘sigemptyset’ is described later; see *note Blocking Signals::.
  5432. As in the example using ‘signal’, we avoid handling signals
  5433. previously set to be ignored. Here we can avoid altering the signal
  5434. handler even momentarily, by using the feature of ‘sigaction’ that lets
  5435. us examine the current action without specifying a new one.
  5436. Here is another example. It retrieves information about the current
  5437. action for ‘SIGINT’ without changing that action.
  5438. struct sigaction query_action;
  5439. if (sigaction (SIGINT, NULL, &query_action) < 0)
  5440. /* ‘sigaction’ returns -1 in case of error. */
  5441. else if (query_action.sa_handler == SIG_DFL)
  5442. /* ‘SIGINT’ is handled in the default, fatal manner. */
  5443. else if (query_action.sa_handler == SIG_IGN)
  5444. /* ‘SIGINT’ is ignored. */
  5445. else
  5446. /* A programmer-defined signal handler is in effect. */
  5447. 
  5448. File: libc.info, Node: Flags for Sigaction, Next: Initial Signal Actions, Prev: Sigaction Function Example, Up: Signal Actions
  5449. 25.3.5 Flags for ‘sigaction’
  5450. ----------------------------
  5451. The ‘sa_flags’ member of the ‘sigaction’ structure is a catch-all for
  5452. special features. Most of the time, ‘SA_RESTART’ is a good value to use
  5453. for this field.
  5454. The value of ‘sa_flags’ is interpreted as a bit mask. Thus, you
  5455. should choose the flags you want to set, OR those flags together, and
  5456. store the result in the ‘sa_flags’ member of your ‘sigaction’ structure.
  5457. Each signal number has its own set of flags. Each call to
  5458. ‘sigaction’ affects one particular signal number, and the flags that you
  5459. specify apply only to that particular signal.
  5460. In the GNU C Library, establishing a handler with ‘signal’ sets all
  5461. the flags to zero except for ‘SA_RESTART’, whose value depends on the
  5462. settings you have made with ‘siginterrupt’. *Note Interrupted
  5463. Primitives::, to see what this is about.
  5464. These macros are defined in the header file ‘signal.h’.
  5465. -- Macro: int SA_NOCLDSTOP
  5466. This flag is meaningful only for the ‘SIGCHLD’ signal. When the
  5467. flag is set, the system delivers the signal for a terminated child
  5468. process but not for one that is stopped. By default, ‘SIGCHLD’ is
  5469. delivered for both terminated children and stopped children.
  5470. Setting this flag for a signal other than ‘SIGCHLD’ has no effect.
  5471. -- Macro: int SA_NOCLDWAIT
  5472. This flag is meaningful only for the ‘SIGCHLD’ signal. When the
  5473. flag is set, the terminated child will not wait for the parent to
  5474. reap it, or become a zombie if not reaped. The child will instead
  5475. be reaped by the kernel immediately on termination, similar to
  5476. setting SIGCHLD to SIG_IGN.
  5477. Setting this flag for a signal other than ‘SIGCHLD’ has no effect.
  5478. -- Macro: int SA_NODEFER
  5479. Normally a signal is added to the signal mask while running its own
  5480. handler; this negates that, so that the same signal can be received
  5481. while it's handler is running. Note that if the signal is included
  5482. in ‘sa_mask’, it is masked regardless of this flag. Only useful
  5483. when assigning a function as a signal handler.
  5484. -- Macro: int SA_ONSTACK
  5485. If this flag is set for a particular signal number, the system uses
  5486. the signal stack when delivering that kind of signal. *Note Signal
  5487. Stack::. If a signal with this flag arrives and you have not set a
  5488. signal stack, the normal user stack is used instead, as if the flag
  5489. had not been set.
  5490. -- Macro: int SA_RESETHAND
  5491. Resets the handler for a signal to SIG_DFL, at the moment specified
  5492. handler function begins. I.e. the handler is called once, then
  5493. the action resets.
  5494. -- Macro: int SA_RESTART
  5495. This flag controls what happens when a signal is delivered during
  5496. certain primitives (such as ‘open’, ‘read’ or ‘write’), and the
  5497. signal handler returns normally. There are two alternatives: the
  5498. library function can resume, or it can return failure with error
  5499. code ‘EINTR’.
  5500. The choice is controlled by the ‘SA_RESTART’ flag for the
  5501. particular kind of signal that was delivered. If the flag is set,
  5502. returning from a handler resumes the library function. If the flag
  5503. is clear, returning from a handler makes the function fail. *Note
  5504. Interrupted Primitives::.
  5505. -- Macro: int SA_SIGINFO
  5506. Indicates that the ‘sa_sigaction’ three-argument form of the
  5507. handler should be used in setting up a handler instead of the
  5508. one-argument ‘sa_handler’ form.
  5509. 
  5510. File: libc.info, Node: Initial Signal Actions, Prev: Flags for Sigaction, Up: Signal Actions
  5511. 25.3.6 Initial Signal Actions
  5512. -----------------------------
  5513. When a new process is created (*note Creating a Process::), it inherits
  5514. handling of signals from its parent process. However, when you load a
  5515. new process image using the ‘exec’ function (*note Executing a File::),
  5516. any signals that you've defined your own handlers for revert to their
  5517. ‘SIG_DFL’ handling. (If you think about it a little, this makes sense;
  5518. the handler functions from the old program are specific to that program,
  5519. and aren't even present in the address space of the new program image.)
  5520. Of course, the new program can establish its own handlers.
  5521. When a program is run by a shell, the shell normally sets the initial
  5522. actions for the child process to ‘SIG_DFL’ or ‘SIG_IGN’, as appropriate.
  5523. It's a good idea to check to make sure that the shell has not set up an
  5524. initial action of ‘SIG_IGN’ before you establish your own signal
  5525. handlers.
  5526. Here is an example of how to establish a handler for ‘SIGHUP’, but
  5527. not if ‘SIGHUP’ is currently ignored:
  5528. ...
  5529. struct sigaction temp;
  5530. sigaction (SIGHUP, NULL, &temp);
  5531. if (temp.sa_handler != SIG_IGN)
  5532. {
  5533. temp.sa_handler = handle_sighup;
  5534. sigemptyset (&temp.sa_mask);
  5535. sigaction (SIGHUP, &temp, NULL);
  5536. }
  5537. 
  5538. File: libc.info, Node: Defining Handlers, Next: Interrupted Primitives, Prev: Signal Actions, Up: Signal Handling
  5539. 25.4 Defining Signal Handlers
  5540. =============================
  5541. This section describes how to write a signal handler function that can
  5542. be established with the ‘signal’ or ‘sigaction’ functions.
  5543. A signal handler is just a function that you compile together with
  5544. the rest of the program. Instead of directly invoking the function, you
  5545. use ‘signal’ or ‘sigaction’ to tell the operating system to call it when
  5546. a signal arrives. This is known as “establishing” the handler. *Note
  5547. Signal Actions::.
  5548. There are two basic strategies you can use in signal handler
  5549. functions:
  5550. • You can have the handler function note that the signal arrived by
  5551. tweaking some global data structures, and then return normally.
  5552. • You can have the handler function terminate the program or transfer
  5553. control to a point where it can recover from the situation that
  5554. caused the signal.
  5555. You need to take special care in writing handler functions because
  5556. they can be called asynchronously. That is, a handler might be called
  5557. at any point in the program, unpredictably. If two signals arrive
  5558. during a very short interval, one handler can run within another. This
  5559. section describes what your handler should do, and what you should
  5560. avoid.
  5561. * Menu:
  5562. * Handler Returns:: Handlers that return normally, and what
  5563. this means.
  5564. * Termination in Handler:: How handler functions terminate a program.
  5565. * Longjmp in Handler:: Nonlocal transfer of control out of a
  5566. signal handler.
  5567. * Signals in Handler:: What happens when signals arrive while
  5568. the handler is already occupied.
  5569. * Merged Signals:: When a second signal arrives before the
  5570. first is handled.
  5571. * Nonreentrancy:: Do not call any functions unless you know they
  5572. are reentrant with respect to signals.
  5573. * Atomic Data Access:: A single handler can run in the middle of
  5574. reading or writing a single object.
  5575. 
  5576. File: libc.info, Node: Handler Returns, Next: Termination in Handler, Up: Defining Handlers
  5577. 25.4.1 Signal Handlers that Return
  5578. ----------------------------------
  5579. Handlers which return normally are usually used for signals such as
  5580. ‘SIGALRM’ and the I/O and interprocess communication signals. But a
  5581. handler for ‘SIGINT’ might also return normally after setting a flag
  5582. that tells the program to exit at a convenient time.
  5583. It is not safe to return normally from the handler for a program
  5584. error signal, because the behavior of the program when the handler
  5585. function returns is not defined after a program error. *Note Program
  5586. Error Signals::.
  5587. Handlers that return normally must modify some global variable in
  5588. order to have any effect. Typically, the variable is one that is
  5589. examined periodically by the program during normal operation. Its data
  5590. type should be ‘sig_atomic_t’ for reasons described in *note Atomic Data
  5591. Access::.
  5592. Here is a simple example of such a program. It executes the body of
  5593. the loop until it has noticed that a ‘SIGALRM’ signal has arrived. This
  5594. technique is useful because it allows the iteration in progress when the
  5595. signal arrives to complete before the loop exits.
  5596. #include <signal.h>
  5597. #include <stdio.h>
  5598. #include <stdlib.h>
  5599. #include <unistd.h>
  5600. /* This flag controls termination of the main loop. */
  5601. volatile sig_atomic_t keep_going = 1;
  5602. /* The signal handler just clears the flag and re-enables itself. */
  5603. void
  5604. catch_alarm (int sig)
  5605. {
  5606. keep_going = 0;
  5607. signal (sig, catch_alarm);
  5608. }
  5609. void
  5610. do_stuff (void)
  5611. {
  5612. puts ("Doing stuff while waiting for alarm....");
  5613. }
  5614. int
  5615. main (void)
  5616. {
  5617. /* Establish a handler for SIGALRM signals. */
  5618. signal (SIGALRM, catch_alarm);
  5619. /* Set an alarm to go off in a little while. */
  5620. alarm (2);
  5621. /* Check the flag once in a while to see when to quit. */
  5622. while (keep_going)
  5623. do_stuff ();
  5624. return EXIT_SUCCESS;
  5625. }
  5626. 
  5627. File: libc.info, Node: Termination in Handler, Next: Longjmp in Handler, Prev: Handler Returns, Up: Defining Handlers
  5628. 25.4.2 Handlers That Terminate the Process
  5629. ------------------------------------------
  5630. Handler functions that terminate the program are typically used to cause
  5631. orderly cleanup or recovery from program error signals and interactive
  5632. interrupts.
  5633. The cleanest way for a handler to terminate the process is to raise
  5634. the same signal that ran the handler in the first place. Here is how to
  5635. do this:
  5636. volatile sig_atomic_t fatal_error_in_progress = 0;
  5637. void
  5638. fatal_error_signal (int sig)
  5639. {
  5640. /* Since this handler is established for more than one kind of signal,
  5641. it might still get invoked recursively by delivery of some other kind
  5642. of signal. Use a static variable to keep track of that. */
  5643. if (fatal_error_in_progress)
  5644. raise (sig);
  5645. fatal_error_in_progress = 1;
  5646. /* Now do the clean up actions:
  5647. - reset terminal modes
  5648. - kill child processes
  5649. - remove lock files */
  5650. ...
  5651. /* Now reraise the signal. We reactivate the signal's
  5652. default handling, which is to terminate the process.
  5653. We could just call ‘exit’ or ‘abort’,
  5654. but reraising the signal sets the return status
  5655. from the process correctly. */
  5656. signal (sig, SIG_DFL);
  5657. raise (sig);
  5658. }
  5659. 
  5660. File: libc.info, Node: Longjmp in Handler, Next: Signals in Handler, Prev: Termination in Handler, Up: Defining Handlers
  5661. 25.4.3 Nonlocal Control Transfer in Handlers
  5662. --------------------------------------------
  5663. You can do a nonlocal transfer of control out of a signal handler using
  5664. the ‘setjmp’ and ‘longjmp’ facilities (*note Non-Local Exits::).
  5665. When the handler does a nonlocal control transfer, the part of the
  5666. program that was running will not continue. If this part of the program
  5667. was in the middle of updating an important data structure, the data
  5668. structure will remain inconsistent. Since the program does not
  5669. terminate, the inconsistency is likely to be noticed later on.
  5670. There are two ways to avoid this problem. One is to block the signal
  5671. for the parts of the program that update important data structures.
  5672. Blocking the signal delays its delivery until it is unblocked, once the
  5673. critical updating is finished. *Note Blocking Signals::.
  5674. The other way is to re-initialize the crucial data structures in the
  5675. signal handler, or to make their values consistent.
  5676. Here is a rather schematic example showing the reinitialization of
  5677. one global variable.
  5678. #include <signal.h>
  5679. #include <setjmp.h>
  5680. jmp_buf return_to_top_level;
  5681. volatile sig_atomic_t waiting_for_input;
  5682. void
  5683. handle_sigint (int signum)
  5684. {
  5685. /* We may have been waiting for input when the signal arrived,
  5686. but we are no longer waiting once we transfer control. */
  5687. waiting_for_input = 0;
  5688. longjmp (return_to_top_level, 1);
  5689. }
  5690. int
  5691. main (void)
  5692. {
  5693. ...
  5694. signal (SIGINT, sigint_handler);
  5695. ...
  5696. while (1) {
  5697. prepare_for_command ();
  5698. if (setjmp (return_to_top_level) == 0)
  5699. read_and_execute_command ();
  5700. }
  5701. }
  5702. /* Imagine this is a subroutine used by various commands. */
  5703. char *
  5704. read_data ()
  5705. {
  5706. if (input_from_terminal) {
  5707. waiting_for_input = 1;
  5708. ...
  5709. waiting_for_input = 0;
  5710. } else {
  5711. ...
  5712. }
  5713. }
  5714. 
  5715. File: libc.info, Node: Signals in Handler, Next: Merged Signals, Prev: Longjmp in Handler, Up: Defining Handlers
  5716. 25.4.4 Signals Arriving While a Handler Runs
  5717. --------------------------------------------
  5718. What happens if another signal arrives while your signal handler
  5719. function is running?
  5720. When the handler for a particular signal is invoked, that signal is
  5721. automatically blocked until the handler returns. That means that if two
  5722. signals of the same kind arrive close together, the second one will be
  5723. held until the first has been handled. (The handler can explicitly
  5724. unblock the signal using ‘sigprocmask’, if you want to allow more
  5725. signals of this type to arrive; see *note Process Signal Mask::.)
  5726. However, your handler can still be interrupted by delivery of another
  5727. kind of signal. To avoid this, you can use the ‘sa_mask’ member of the
  5728. action structure passed to ‘sigaction’ to explicitly specify which
  5729. signals should be blocked while the signal handler runs. These signals
  5730. are in addition to the signal for which the handler was invoked, and any
  5731. other signals that are normally blocked by the process. *Note Blocking
  5732. for Handler::.
  5733. When the handler returns, the set of blocked signals is restored to
  5734. the value it had before the handler ran. So using ‘sigprocmask’ inside
  5735. the handler only affects what signals can arrive during the execution of
  5736. the handler itself, not what signals can arrive once the handler
  5737. returns.
  5738. *Portability Note:* Always use ‘sigaction’ to establish a handler for
  5739. a signal that you expect to receive asynchronously, if you want your
  5740. program to work properly on System V Unix. On this system, the handling
  5741. of a signal whose handler was established with ‘signal’ automatically
  5742. sets the signal's action back to ‘SIG_DFL’, and the handler must
  5743. re-establish itself each time it runs. This practice, while
  5744. inconvenient, does work when signals cannot arrive in succession.
  5745. However, if another signal can arrive right away, it may arrive before
  5746. the handler can re-establish itself. Then the second signal would
  5747. receive the default handling, which could terminate the process.
  5748. 
  5749. File: libc.info, Node: Merged Signals, Next: Nonreentrancy, Prev: Signals in Handler, Up: Defining Handlers
  5750. 25.4.5 Signals Close Together Merge into One
  5751. --------------------------------------------
  5752. If multiple signals of the same type are delivered to your process
  5753. before your signal handler has a chance to be invoked at all, the
  5754. handler may only be invoked once, as if only a single signal had
  5755. arrived. In effect, the signals merge into one. This situation can
  5756. arise when the signal is blocked, or in a multiprocessing environment
  5757. where the system is busy running some other processes while the signals
  5758. are delivered. This means, for example, that you cannot reliably use a
  5759. signal handler to count signals. The only distinction you can reliably
  5760. make is whether at least one signal has arrived since a given time in
  5761. the past.
  5762. Here is an example of a handler for ‘SIGCHLD’ that compensates for
  5763. the fact that the number of signals received may not equal the number of
  5764. child processes that generate them. It assumes that the program keeps
  5765. track of all the child processes with a chain of structures as follows:
  5766. struct process
  5767. {
  5768. struct process *next;
  5769. /* The process ID of this child. */
  5770. int pid;
  5771. /* The descriptor of the pipe or pseudo terminal
  5772. on which output comes from this child. */
  5773. int input_descriptor;
  5774. /* Nonzero if this process has stopped or terminated. */
  5775. sig_atomic_t have_status;
  5776. /* The status of this child; 0 if running,
  5777. otherwise a status value from ‘waitpid’. */
  5778. int status;
  5779. };
  5780. struct process *process_list;
  5781. This example also uses a flag to indicate whether signals have
  5782. arrived since some time in the past--whenever the program last cleared
  5783. it to zero.
  5784. /* Nonzero means some child's status has changed
  5785. so look at ‘process_list’ for the details. */
  5786. int process_status_change;
  5787. Here is the handler itself:
  5788. void
  5789. sigchld_handler (int signo)
  5790. {
  5791. int old_errno = errno;
  5792. while (1) {
  5793. register int pid;
  5794. int w;
  5795. struct process *p;
  5796. /* Keep asking for a status until we get a definitive result. */
  5797. do
  5798. {
  5799. errno = 0;
  5800. pid = waitpid (WAIT_ANY, &w, WNOHANG | WUNTRACED);
  5801. }
  5802. while (pid <= 0 && errno == EINTR);
  5803. if (pid <= 0) {
  5804. /* A real failure means there are no more
  5805. stopped or terminated child processes, so return. */
  5806. errno = old_errno;
  5807. return;
  5808. }
  5809. /* Find the process that signaled us, and record its status. */
  5810. for (p = process_list; p; p = p->next)
  5811. if (p->pid == pid) {
  5812. p->status = w;
  5813. /* Indicate that the ‘status’ field
  5814. has data to look at. We do this only after storing it. */
  5815. p->have_status = 1;
  5816. /* If process has terminated, stop waiting for its output. */
  5817. if (WIFSIGNALED (w) || WIFEXITED (w))
  5818. if (p->input_descriptor)
  5819. FD_CLR (p->input_descriptor, &input_wait_mask);
  5820. /* The program should check this flag from time to time
  5821. to see if there is any news in ‘process_list’. */
  5822. ++process_status_change;
  5823. }
  5824. /* Loop around to handle all the processes
  5825. that have something to tell us. */
  5826. }
  5827. }
  5828. Here is the proper way to check the flag ‘process_status_change’:
  5829. if (process_status_change) {
  5830. struct process *p;
  5831. process_status_change = 0;
  5832. for (p = process_list; p; p = p->next)
  5833. if (p->have_status) {
  5834. ... Examine ‘p->status’ ...
  5835. }
  5836. }
  5837. It is vital to clear the flag before examining the list; otherwise, if a
  5838. signal were delivered just before the clearing of the flag, and after
  5839. the appropriate element of the process list had been checked, the status
  5840. change would go unnoticed until the next signal arrived to set the flag
  5841. again. You could, of course, avoid this problem by blocking the signal
  5842. while scanning the list, but it is much more elegant to guarantee
  5843. correctness by doing things in the right order.
  5844. The loop which checks process status avoids examining ‘p->status’
  5845. until it sees that status has been validly stored. This is to make sure
  5846. that the status cannot change in the middle of accessing it. Once
  5847. ‘p->have_status’ is set, it means that the child process is stopped or
  5848. terminated, and in either case, it cannot stop or terminate again until
  5849. the program has taken notice. *Note Atomic Usage::, for more
  5850. information about coping with interruptions during accesses of a
  5851. variable.
  5852. Here is another way you can test whether the handler has run since
  5853. the last time you checked. This technique uses a counter which is never
  5854. changed outside the handler. Instead of clearing the count, the program
  5855. remembers the previous value and sees whether it has changed since the
  5856. previous check. The advantage of this method is that different parts of
  5857. the program can check independently, each part checking whether there
  5858. has been a signal since that part last checked.
  5859. sig_atomic_t process_status_change;
  5860. sig_atomic_t last_process_status_change;
  5861. ...
  5862. {
  5863. sig_atomic_t prev = last_process_status_change;
  5864. last_process_status_change = process_status_change;
  5865. if (last_process_status_change != prev) {
  5866. struct process *p;
  5867. for (p = process_list; p; p = p->next)
  5868. if (p->have_status) {
  5869. ... Examine ‘p->status’ ...
  5870. }
  5871. }
  5872. }
  5873. 
  5874. File: libc.info, Node: Nonreentrancy, Next: Atomic Data Access, Prev: Merged Signals, Up: Defining Handlers
  5875. 25.4.6 Signal Handling and Nonreentrant Functions
  5876. -------------------------------------------------
  5877. Handler functions usually don't do very much. The best practice is to
  5878. write a handler that does nothing but set an external variable that the
  5879. program checks regularly, and leave all serious work to the program.
  5880. This is best because the handler can be called asynchronously, at
  5881. unpredictable times--perhaps in the middle of a primitive function, or
  5882. even between the beginning and the end of a C operator that requires
  5883. multiple instructions. The data structures being manipulated might
  5884. therefore be in an inconsistent state when the handler function is
  5885. invoked. Even copying one ‘int’ variable into another can take two
  5886. instructions on most machines.
  5887. This means you have to be very careful about what you do in a signal
  5888. handler.
  5889. • If your handler needs to access any global variables from your
  5890. program, declare those variables ‘volatile’. This tells the
  5891. compiler that the value of the variable might change
  5892. asynchronously, and inhibits certain optimizations that would be
  5893. invalidated by such modifications.
  5894. • If you call a function in the handler, make sure it is “reentrant”
  5895. with respect to signals, or else make sure that the signal cannot
  5896. interrupt a call to a related function.
  5897. A function can be non-reentrant if it uses memory that is not on the
  5898. stack.
  5899. • If a function uses a static variable or a global variable, or a
  5900. dynamically-allocated object that it finds for itself, then it is
  5901. non-reentrant and any two calls to the function can interfere.
  5902. For example, suppose that the signal handler uses ‘gethostbyname’.
  5903. This function returns its value in a static object, reusing the
  5904. same object each time. If the signal happens to arrive during a
  5905. call to ‘gethostbyname’, or even after one (while the program is
  5906. still using the value), it will clobber the value that the program
  5907. asked for.
  5908. However, if the program does not use ‘gethostbyname’ or any other
  5909. function that returns information in the same object, or if it
  5910. always blocks signals around each use, then you are safe.
  5911. There are a large number of library functions that return values in
  5912. a fixed object, always reusing the same object in this fashion, and
  5913. all of them cause the same problem. Function descriptions in this
  5914. manual always mention this behavior.
  5915. • If a function uses and modifies an object that you supply, then it
  5916. is potentially non-reentrant; two calls can interfere if they use
  5917. the same object.
  5918. This case arises when you do I/O using streams. Suppose that the
  5919. signal handler prints a message with ‘fprintf’. Suppose that the
  5920. program was in the middle of an ‘fprintf’ call using the same
  5921. stream when the signal was delivered. Both the signal handler's
  5922. message and the program's data could be corrupted, because both
  5923. calls operate on the same data structure--the stream itself.
  5924. However, if you know that the stream that the handler uses cannot
  5925. possibly be used by the program at a time when signals can arrive,
  5926. then you are safe. It is no problem if the program uses some other
  5927. stream.
  5928. • On most systems, ‘malloc’ and ‘free’ are not reentrant, because
  5929. they use a static data structure which records what memory blocks
  5930. are free. As a result, no library functions that allocate or free
  5931. memory are reentrant. This includes functions that allocate space
  5932. to store a result.
  5933. The best way to avoid the need to allocate memory in a handler is
  5934. to allocate in advance space for signal handlers to use.
  5935. The best way to avoid freeing memory in a handler is to flag or
  5936. record the objects to be freed, and have the program check from
  5937. time to time whether anything is waiting to be freed. But this
  5938. must be done with care, because placing an object on a chain is not
  5939. atomic, and if it is interrupted by another signal handler that
  5940. does the same thing, you could "lose" one of the objects.
  5941. • Any function that modifies ‘errno’ is non-reentrant, but you can
  5942. correct for this: in the handler, save the original value of
  5943. ‘errno’ and restore it before returning normally. This prevents
  5944. errors that occur within the signal handler from being confused
  5945. with errors from system calls at the point the program is
  5946. interrupted to run the handler.
  5947. This technique is generally applicable; if you want to call in a
  5948. handler a function that modifies a particular object in memory, you
  5949. can make this safe by saving and restoring that object.
  5950. • Merely reading from a memory object is safe provided that you can
  5951. deal with any of the values that might appear in the object at a
  5952. time when the signal can be delivered. Keep in mind that
  5953. assignment to some data types requires more than one instruction,
  5954. which means that the handler could run "in the middle of" an
  5955. assignment to the variable if its type is not atomic. *Note Atomic
  5956. Data Access::.
  5957. • Merely writing into a memory object is safe as long as a sudden
  5958. change in the value, at any time when the handler might run, will
  5959. not disturb anything.
  5960. 
  5961. File: libc.info, Node: Atomic Data Access, Prev: Nonreentrancy, Up: Defining Handlers
  5962. 25.4.7 Atomic Data Access and Signal Handling
  5963. ---------------------------------------------
  5964. Whether the data in your application concerns atoms, or mere text, you
  5965. have to be careful about the fact that access to a single datum is not
  5966. necessarily “atomic”. This means that it can take more than one
  5967. instruction to read or write a single object. In such cases, a signal
  5968. handler might be invoked in the middle of reading or writing the object.
  5969. There are three ways you can cope with this problem. You can use
  5970. data types that are always accessed atomically; you can carefully
  5971. arrange that nothing untoward happens if an access is interrupted, or
  5972. you can block all signals around any access that had better not be
  5973. interrupted (*note Blocking Signals::).
  5974. * Menu:
  5975. * Non-atomic Example:: A program illustrating interrupted access.
  5976. * Types: Atomic Types. Data types that guarantee no interruption.
  5977. * Usage: Atomic Usage. Proving that interruption is harmless.
  5978. 
  5979. File: libc.info, Node: Non-atomic Example, Next: Atomic Types, Up: Atomic Data Access
  5980. 25.4.7.1 Problems with Non-Atomic Access
  5981. ........................................
  5982. Here is an example which shows what can happen if a signal handler runs
  5983. in the middle of modifying a variable. (Interrupting the reading of a
  5984. variable can also lead to paradoxical results, but here we only show
  5985. writing.)
  5986. #include <signal.h>
  5987. #include <stdio.h>
  5988. volatile struct two_words { int a, b; } memory;
  5989. void
  5990. handler(int signum)
  5991. {
  5992. printf ("%d,%d\n", memory.a, memory.b);
  5993. alarm (1);
  5994. }
  5995. int
  5996. main (void)
  5997. {
  5998. static struct two_words zeros = { 0, 0 }, ones = { 1, 1 };
  5999. signal (SIGALRM, handler);
  6000. memory = zeros;
  6001. alarm (1);
  6002. while (1)
  6003. {
  6004. memory = zeros;
  6005. memory = ones;
  6006. }
  6007. }
  6008. This program fills ‘memory’ with zeros, ones, zeros, ones,
  6009. alternating forever; meanwhile, once per second, the alarm signal
  6010. handler prints the current contents. (Calling ‘printf’ in the handler
  6011. is safe in this program because it is certainly not being called outside
  6012. the handler when the signal happens.)
  6013. Clearly, this program can print a pair of zeros or a pair of ones.
  6014. But that's not all it can do! On most machines, it takes several
  6015. instructions to store a new value in ‘memory’, and the value is stored
  6016. one word at a time. If the signal is delivered in between these
  6017. instructions, the handler might find that ‘memory.a’ is zero and
  6018. ‘memory.b’ is one (or vice versa).
  6019. On some machines it may be possible to store a new value in ‘memory’
  6020. with just one instruction that cannot be interrupted. On these
  6021. machines, the handler will always print two zeros or two ones.
  6022. 
  6023. File: libc.info, Node: Atomic Types, Next: Atomic Usage, Prev: Non-atomic Example, Up: Atomic Data Access
  6024. 25.4.7.2 Atomic Types
  6025. .....................
  6026. To avoid uncertainty about interrupting access to a variable, you can
  6027. use a particular data type for which access is always atomic:
  6028. ‘sig_atomic_t’. Reading and writing this data type is guaranteed to
  6029. happen in a single instruction, so there's no way for a handler to run
  6030. "in the middle" of an access.
  6031. The type ‘sig_atomic_t’ is always an integer data type, but which one
  6032. it is, and how many bits it contains, may vary from machine to machine.
  6033. -- Data Type: sig_atomic_t
  6034. This is an integer data type. Objects of this type are always
  6035. accessed atomically.
  6036. In practice, you can assume that ‘int’ is atomic. You can also
  6037. assume that pointer types are atomic; that is very convenient. Both of
  6038. these assumptions are true on all of the machines that the GNU C Library
  6039. supports and on all POSIX systems we know of.
  6040. 
  6041. File: libc.info, Node: Atomic Usage, Prev: Atomic Types, Up: Atomic Data Access
  6042. 25.4.7.3 Atomic Usage Patterns
  6043. ..............................
  6044. Certain patterns of access avoid any problem even if an access is
  6045. interrupted. For example, a flag which is set by the handler, and
  6046. tested and cleared by the main program from time to time, is always safe
  6047. even if access actually requires two instructions. To show that this is
  6048. so, we must consider each access that could be interrupted, and show
  6049. that there is no problem if it is interrupted.
  6050. An interrupt in the middle of testing the flag is safe because either
  6051. it's recognized to be nonzero, in which case the precise value doesn't
  6052. matter, or it will be seen to be nonzero the next time it's tested.
  6053. An interrupt in the middle of clearing the flag is no problem because
  6054. either the value ends up zero, which is what happens if a signal comes
  6055. in just before the flag is cleared, or the value ends up nonzero, and
  6056. subsequent events occur as if the signal had come in just after the flag
  6057. was cleared. As long as the code handles both of these cases properly,
  6058. it can also handle a signal in the middle of clearing the flag. (This
  6059. is an example of the sort of reasoning you need to do to figure out
  6060. whether non-atomic usage is safe.)
  6061. Sometimes you can ensure uninterrupted access to one object by
  6062. protecting its use with another object, perhaps one whose type
  6063. guarantees atomicity. *Note Merged Signals::, for an example.
  6064. 
  6065. File: libc.info, Node: Interrupted Primitives, Next: Generating Signals, Prev: Defining Handlers, Up: Signal Handling
  6066. 25.5 Primitives Interrupted by Signals
  6067. ======================================
  6068. A signal can arrive and be handled while an I/O primitive such as ‘open’
  6069. or ‘read’ is waiting for an I/O device. If the signal handler returns,
  6070. the system faces the question: what should happen next?
  6071. POSIX specifies one approach: make the primitive fail right away.
  6072. The error code for this kind of failure is ‘EINTR’. This is flexible,
  6073. but usually inconvenient. Typically, POSIX applications that use signal
  6074. handlers must check for ‘EINTR’ after each library function that can
  6075. return it, in order to try the call again. Often programmers forget to
  6076. check, which is a common source of error.
  6077. The GNU C Library provides a convenient way to retry a call after a
  6078. temporary failure, with the macro ‘TEMP_FAILURE_RETRY’:
  6079. -- Macro: TEMP_FAILURE_RETRY (EXPRESSION)
  6080. This macro evaluates EXPRESSION once, and examines its value as
  6081. type ‘long int’. If the value equals ‘-1’, that indicates a
  6082. failure and ‘errno’ should be set to show what kind of failure. If
  6083. it fails and reports error code ‘EINTR’, ‘TEMP_FAILURE_RETRY’
  6084. evaluates it again, and over and over until the result is not a
  6085. temporary failure.
  6086. The value returned by ‘TEMP_FAILURE_RETRY’ is whatever value
  6087. EXPRESSION produced.
  6088. BSD avoids ‘EINTR’ entirely and provides a more convenient approach:
  6089. to restart the interrupted primitive, instead of making it fail. If you
  6090. choose this approach, you need not be concerned with ‘EINTR’.
  6091. You can choose either approach with the GNU C Library. If you use
  6092. ‘sigaction’ to establish a signal handler, you can specify how that
  6093. handler should behave. If you specify the ‘SA_RESTART’ flag, return
  6094. from that handler will resume a primitive; otherwise, return from that
  6095. handler will cause ‘EINTR’. *Note Flags for Sigaction::.
  6096. Another way to specify the choice is with the ‘siginterrupt’
  6097. function. *Note BSD Signal Handling::.
  6098. When you don't specify with ‘sigaction’ or ‘siginterrupt’ what a
  6099. particular handler should do, it uses a default choice. The default
  6100. choice in the GNU C Library is to make primitives fail with ‘EINTR’.
  6101. The description of each primitive affected by this issue lists
  6102. ‘EINTR’ among the error codes it can return.
  6103. There is one situation where resumption never happens no matter which
  6104. choice you make: when a data-transfer function such as ‘read’ or ‘write’
  6105. is interrupted by a signal after transferring part of the data. In this
  6106. case, the function returns the number of bytes already transferred,
  6107. indicating partial success.
  6108. This might at first appear to cause unreliable behavior on
  6109. record-oriented devices (including datagram sockets; *note Datagrams::),
  6110. where splitting one ‘read’ or ‘write’ into two would read or write two
  6111. records. Actually, there is no problem, because interruption after a
  6112. partial transfer cannot happen on such devices; they always transfer an
  6113. entire record in one burst, with no waiting once data transfer has
  6114. started.