libc.info-12 293 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511
  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: Generating Signals, Next: Blocking Signals, Prev: Interrupted Primitives, Up: Signal Handling
  2438. 25.6 Generating Signals
  2439. =======================
  2440. Besides signals that are generated as a result of a hardware trap or
  2441. interrupt, your program can explicitly send signals to itself or to
  2442. another process.
  2443. * Menu:
  2444. * Signaling Yourself:: A process can send a signal to itself.
  2445. * Signaling Another Process:: Send a signal to another process.
  2446. * Permission for kill:: Permission for using ‘kill’.
  2447. * Kill Example:: Using ‘kill’ for Communication.
  2448. 
  2449. File: libc.info, Node: Signaling Yourself, Next: Signaling Another Process, Up: Generating Signals
  2450. 25.6.1 Signaling Yourself
  2451. -------------------------
  2452. A process can send itself a signal with the ‘raise’ function. This
  2453. function is declared in ‘signal.h’.
  2454. -- Function: int raise (int SIGNUM)
  2455. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2456. Concepts::.
  2457. The ‘raise’ function sends the signal SIGNUM to the calling
  2458. process. It returns zero if successful and a nonzero value if it
  2459. fails. About the only reason for failure would be if the value of
  2460. SIGNUM is invalid.
  2461. -- Function: int gsignal (int SIGNUM)
  2462. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2463. Concepts::.
  2464. The ‘gsignal’ function does the same thing as ‘raise’; it is
  2465. provided only for compatibility with SVID.
  2466. One convenient use for ‘raise’ is to reproduce the default behavior
  2467. of a signal that you have trapped. For instance, suppose a user of your
  2468. program types the SUSP character (usually ‘C-z’; *note Special
  2469. Characters::) to send it an interactive stop signal (‘SIGTSTP’), and you
  2470. want to clean up some internal data buffers before stopping. You might
  2471. set this up like this:
  2472. #include <signal.h>
  2473. /* When a stop signal arrives, set the action back to the default
  2474. and then resend the signal after doing cleanup actions. */
  2475. void
  2476. tstp_handler (int sig)
  2477. {
  2478. signal (SIGTSTP, SIG_DFL);
  2479. /* Do cleanup actions here. */
  2480. ...
  2481. raise (SIGTSTP);
  2482. }
  2483. /* When the process is continued again, restore the signal handler. */
  2484. void
  2485. cont_handler (int sig)
  2486. {
  2487. signal (SIGCONT, cont_handler);
  2488. signal (SIGTSTP, tstp_handler);
  2489. }
  2490. /* Enable both handlers during program initialization. */
  2491. int
  2492. main (void)
  2493. {
  2494. signal (SIGCONT, cont_handler);
  2495. signal (SIGTSTP, tstp_handler);
  2496. ...
  2497. }
  2498. *Portability note:* ‘raise’ was invented by the ISO C committee.
  2499. Older systems may not support it, so using ‘kill’ may be more portable.
  2500. *Note Signaling Another Process::.
  2501. 
  2502. File: libc.info, Node: Signaling Another Process, Next: Permission for kill, Prev: Signaling Yourself, Up: Generating Signals
  2503. 25.6.2 Signaling Another Process
  2504. --------------------------------
  2505. The ‘kill’ function can be used to send a signal to another process. In
  2506. spite of its name, it can be used for a lot of things other than causing
  2507. a process to terminate. Some examples of situations where you might
  2508. want to send signals between processes are:
  2509. • A parent process starts a child to perform a task--perhaps having
  2510. the child running an infinite loop--and then terminates the child
  2511. when the task is no longer needed.
  2512. • A process executes as part of a group, and needs to terminate or
  2513. notify the other processes in the group when an error or other
  2514. event occurs.
  2515. • Two processes need to synchronize while working together.
  2516. This section assumes that you know a little bit about how processes
  2517. work. For more information on this subject, see *note Processes::.
  2518. The ‘kill’ function is declared in ‘signal.h’.
  2519. -- Function: int kill (pid_t PID, int SIGNUM)
  2520. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2521. Concepts::.
  2522. The ‘kill’ function sends the signal SIGNUM to the process or
  2523. process group specified by PID. Besides the signals listed in
  2524. *note Standard Signals::, SIGNUM can also have a value of zero to
  2525. check the validity of the PID.
  2526. The PID specifies the process or process group to receive the
  2527. signal:
  2528. ‘PID > 0’
  2529. The process whose identifier is PID. (On Linux, the signal is
  2530. sent to the entire process even if PID is a thread ID distinct
  2531. from the process ID.)
  2532. ‘PID == 0’
  2533. All processes in the same process group as the sender.
  2534. ‘PID < -1’
  2535. The process group whose identifier is −PID.
  2536. ‘PID == -1’
  2537. If the process is privileged, send the signal to all processes
  2538. except for some special system processes. Otherwise, send the
  2539. signal to all processes with the same effective user ID.
  2540. A process can send a signal to itself with a call like
  2541. ‘kill (getpid(), SIGNUM)’. If ‘kill’ is used by a process to send
  2542. a signal to itself, and the signal is not blocked, then ‘kill’
  2543. delivers at least one signal (which might be some other pending
  2544. unblocked signal instead of the signal SIGNUM) to that process
  2545. before it returns.
  2546. The return value from ‘kill’ is zero if the signal can be sent
  2547. successfully. Otherwise, no signal is sent, and a value of ‘-1’ is
  2548. returned. If PID specifies sending a signal to several processes,
  2549. ‘kill’ succeeds if it can send the signal to at least one of them.
  2550. There's no way you can tell which of the processes got the signal
  2551. or whether all of them did.
  2552. The following ‘errno’ error conditions are defined for this
  2553. function:
  2554. ‘EINVAL’
  2555. The SIGNUM argument is an invalid or unsupported number.
  2556. ‘EPERM’
  2557. You do not have the privilege to send a signal to the process
  2558. or any of the processes in the process group named by PID.
  2559. ‘ESRCH’
  2560. The PID argument does not refer to an existing process or
  2561. group.
  2562. -- Function: int tgkill (pid_t PID, pid_t TID, int SIGNUM)
  2563. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2564. Concepts::.
  2565. The ‘tgkill’ function sends the signal SIGNUM to the thread or
  2566. process with ID TID, like the ‘kill’ function, but only if the
  2567. process ID of the thread TID is equal to PID. If the target thread
  2568. belongs to another process, the function fails with ‘ESRCH’.
  2569. The ‘tgkill’ function can be used to avoid sending a signal to a
  2570. thread in the wrong process if the caller ensures that the passed
  2571. PID value is not reused by the kernel (for example, if it is the
  2572. process ID of the current process, as returned by ‘getpid’).
  2573. -- Function: int killpg (int PGID, int SIGNUM)
  2574. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2575. Concepts::.
  2576. This is similar to ‘kill’, but sends signal SIGNUM to the process
  2577. group PGID. This function is provided for compatibility with BSD;
  2578. using ‘kill’ to do this is more portable.
  2579. As a simple example of ‘kill’, the call ‘kill (getpid (), SIG)’ has
  2580. the same effect as ‘raise (SIG)’.
  2581. 
  2582. File: libc.info, Node: Permission for kill, Next: Kill Example, Prev: Signaling Another Process, Up: Generating Signals
  2583. 25.6.3 Permission for using ‘kill’
  2584. ----------------------------------
  2585. There are restrictions that prevent you from using ‘kill’ to send
  2586. signals to any random process. These are intended to prevent antisocial
  2587. behavior such as arbitrarily killing off processes belonging to another
  2588. user. In typical use, ‘kill’ is used to pass signals between parent,
  2589. child, and sibling processes, and in these situations you normally do
  2590. have permission to send signals. The only common exception is when you
  2591. run a setuid program in a child process; if the program changes its real
  2592. UID as well as its effective UID, you may not have permission to send a
  2593. signal. The ‘su’ program does this.
  2594. Whether a process has permission to send a signal to another process
  2595. is determined by the user IDs of the two processes. This concept is
  2596. discussed in detail in *note Process Persona::.
  2597. Generally, for a process to be able to send a signal to another
  2598. process, either the sending process must belong to a privileged user
  2599. (like ‘root’), or the real or effective user ID of the sending process
  2600. must match the real or effective user ID of the receiving process. If
  2601. the receiving process has changed its effective user ID from the
  2602. set-user-ID mode bit on its process image file, then the owner of the
  2603. process image file is used in place of its current effective user ID. In
  2604. some implementations, a parent process might be able to send signals to
  2605. a child process even if the user ID's don't match, and other
  2606. implementations might enforce other restrictions.
  2607. The ‘SIGCONT’ signal is a special case. It can be sent if the sender
  2608. is part of the same session as the receiver, regardless of user IDs.
  2609. 
  2610. File: libc.info, Node: Kill Example, Prev: Permission for kill, Up: Generating Signals
  2611. 25.6.4 Using ‘kill’ for Communication
  2612. -------------------------------------
  2613. Here is a longer example showing how signals can be used for
  2614. interprocess communication. This is what the ‘SIGUSR1’ and ‘SIGUSR2’
  2615. signals are provided for. Since these signals are fatal by default, the
  2616. process that is supposed to receive them must trap them through ‘signal’
  2617. or ‘sigaction’.
  2618. In this example, a parent process forks a child process and then
  2619. waits for the child to complete its initialization. The child process
  2620. tells the parent when it is ready by sending it a ‘SIGUSR1’ signal,
  2621. using the ‘kill’ function.
  2622. #include <signal.h>
  2623. #include <stdio.h>
  2624. #include <stdlib.h>
  2625. #include <sys/types.h>
  2626. #include <unistd.h>
  2627. /* When a ‘SIGUSR1’ signal arrives, set this variable. */
  2628. volatile sig_atomic_t usr_interrupt = 0;
  2629. void
  2630. synch_signal (int sig)
  2631. {
  2632. usr_interrupt = 1;
  2633. }
  2634. /* The child process executes this function. */
  2635. void
  2636. child_function (void)
  2637. {
  2638. /* Perform initialization. */
  2639. printf ("I'm here!!! My pid is %d.\n", (int) getpid ());
  2640. /* Let parent know you're done. */
  2641. kill (getppid (), SIGUSR1);
  2642. /* Continue with execution. */
  2643. puts ("Bye, now....");
  2644. exit (0);
  2645. }
  2646. int
  2647. main (void)
  2648. {
  2649. struct sigaction usr_action;
  2650. sigset_t block_mask;
  2651. pid_t child_id;
  2652. /* Establish the signal handler. */
  2653. sigfillset (&block_mask);
  2654. usr_action.sa_handler = synch_signal;
  2655. usr_action.sa_mask = block_mask;
  2656. usr_action.sa_flags = 0;
  2657. sigaction (SIGUSR1, &usr_action, NULL);
  2658. /* Create the child process. */
  2659. child_id = fork ();
  2660. if (child_id == 0)
  2661. child_function (); /* Does not return. */
  2662. /* Busy wait for the child to send a signal. */
  2663. while (!usr_interrupt)
  2664. ;
  2665. /* Now continue execution. */
  2666. puts ("That's all, folks!");
  2667. return 0;
  2668. }
  2669. This example uses a busy wait, which is bad, because it wastes CPU
  2670. cycles that other programs could otherwise use. It is better to ask the
  2671. system to wait until the signal arrives. See the example in *note
  2672. Waiting for a Signal::.
  2673. 
  2674. File: libc.info, Node: Blocking Signals, Next: Waiting for a Signal, Prev: Generating Signals, Up: Signal Handling
  2675. 25.7 Blocking Signals
  2676. =====================
  2677. Blocking a signal means telling the operating system to hold it and
  2678. deliver it later. Generally, a program does not block signals
  2679. indefinitely--it might as well ignore them by setting their actions to
  2680. ‘SIG_IGN’. But it is useful to block signals briefly, to prevent them
  2681. from interrupting sensitive operations. For instance:
  2682. • You can use the ‘sigprocmask’ function to block signals while you
  2683. modify global variables that are also modified by the handlers for
  2684. these signals.
  2685. • You can set ‘sa_mask’ in your ‘sigaction’ call to block certain
  2686. signals while a particular signal handler runs. This way, the
  2687. signal handler can run without being interrupted itself by signals.
  2688. * Menu:
  2689. * Why Block:: The purpose of blocking signals.
  2690. * Signal Sets:: How to specify which signals to
  2691. block.
  2692. * Process Signal Mask:: Blocking delivery of signals to your
  2693. process during normal execution.
  2694. * Testing for Delivery:: Blocking to Test for Delivery of
  2695. a Signal.
  2696. * Blocking for Handler:: Blocking additional signals while a
  2697. handler is being run.
  2698. * Checking for Pending Signals:: Checking for Pending Signals
  2699. * Remembering a Signal:: How you can get almost the same
  2700. effect as blocking a signal, by
  2701. handling it and setting a flag
  2702. to be tested later.
  2703. 
  2704. File: libc.info, Node: Why Block, Next: Signal Sets, Up: Blocking Signals
  2705. 25.7.1 Why Blocking Signals is Useful
  2706. -------------------------------------
  2707. Temporary blocking of signals with ‘sigprocmask’ gives you a way to
  2708. prevent interrupts during critical parts of your code. If signals
  2709. arrive in that part of the program, they are delivered later, after you
  2710. unblock them.
  2711. One example where this is useful is for sharing data between a signal
  2712. handler and the rest of the program. If the type of the data is not
  2713. ‘sig_atomic_t’ (*note Atomic Data Access::), then the signal handler
  2714. could run when the rest of the program has only half finished reading or
  2715. writing the data. This would lead to confusing consequences.
  2716. To make the program reliable, you can prevent the signal handler from
  2717. running while the rest of the program is examining or modifying that
  2718. data--by blocking the appropriate signal around the parts of the program
  2719. that touch the data.
  2720. Blocking signals is also necessary when you want to perform a certain
  2721. action only if a signal has not arrived. Suppose that the handler for
  2722. the signal sets a flag of type ‘sig_atomic_t’; you would like to test
  2723. the flag and perform the action if the flag is not set. This is
  2724. unreliable. Suppose the signal is delivered immediately after you test
  2725. the flag, but before the consequent action: then the program will
  2726. perform the action even though the signal has arrived.
  2727. The only way to test reliably for whether a signal has yet arrived is
  2728. to test while the signal is blocked.
  2729. 
  2730. File: libc.info, Node: Signal Sets, Next: Process Signal Mask, Prev: Why Block, Up: Blocking Signals
  2731. 25.7.2 Signal Sets
  2732. ------------------
  2733. All of the signal blocking functions use a data structure called a
  2734. “signal set” to specify what signals are affected. Thus, every activity
  2735. involves two stages: creating the signal set, and then passing it as an
  2736. argument to a library function.
  2737. These facilities are declared in the header file ‘signal.h’.
  2738. -- Data Type: sigset_t
  2739. The ‘sigset_t’ data type is used to represent a signal set.
  2740. Internally, it may be implemented as either an integer or structure
  2741. type.
  2742. For portability, use only the functions described in this section
  2743. to initialize, change, and retrieve information from ‘sigset_t’
  2744. objects--don't try to manipulate them directly.
  2745. There are two ways to initialize a signal set. You can initially
  2746. specify it to be empty with ‘sigemptyset’ and then add specified signals
  2747. individually. Or you can specify it to be full with ‘sigfillset’ and
  2748. then delete specified signals individually.
  2749. You must always initialize the signal set with one of these two
  2750. functions before using it in any other way. Don't try to set all the
  2751. signals explicitly because the ‘sigset_t’ object might include some
  2752. other information (like a version field) that needs to be initialized as
  2753. well. (In addition, it's not wise to put into your program an
  2754. assumption that the system has no signals aside from the ones you know
  2755. about.)
  2756. -- Function: int sigemptyset (sigset_t *SET)
  2757. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2758. Concepts::.
  2759. This function initializes the signal set SET to exclude all of the
  2760. defined signals. It always returns ‘0’.
  2761. -- Function: int sigfillset (sigset_t *SET)
  2762. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2763. Concepts::.
  2764. This function initializes the signal set SET to include all of the
  2765. defined signals. Again, the return value is ‘0’.
  2766. -- Function: int sigaddset (sigset_t *SET, int SIGNUM)
  2767. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2768. Concepts::.
  2769. This function adds the signal SIGNUM to the signal set SET. All
  2770. ‘sigaddset’ does is modify SET; it does not block or unblock any
  2771. signals.
  2772. The return value is ‘0’ on success and ‘-1’ on failure. The
  2773. following ‘errno’ error condition is defined for this function:
  2774. ‘EINVAL’
  2775. The SIGNUM argument doesn't specify a valid signal.
  2776. -- Function: int sigdelset (sigset_t *SET, int SIGNUM)
  2777. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2778. Concepts::.
  2779. This function removes the signal SIGNUM from the signal set SET.
  2780. All ‘sigdelset’ does is modify SET; it does not block or unblock
  2781. any signals. The return value and error conditions are the same as
  2782. for ‘sigaddset’.
  2783. Finally, there is a function to test what signals are in a signal
  2784. set:
  2785. -- Function: int sigismember (const sigset_t *SET, int SIGNUM)
  2786. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2787. Concepts::.
  2788. The ‘sigismember’ function tests whether the signal SIGNUM is a
  2789. member of the signal set SET. It returns ‘1’ if the signal is in
  2790. the set, ‘0’ if not, and ‘-1’ if there is an error.
  2791. The following ‘errno’ error condition is defined for this function:
  2792. ‘EINVAL’
  2793. The SIGNUM argument doesn't specify a valid signal.
  2794. 
  2795. File: libc.info, Node: Process Signal Mask, Next: Testing for Delivery, Prev: Signal Sets, Up: Blocking Signals
  2796. 25.7.3 Process Signal Mask
  2797. --------------------------
  2798. The collection of signals that are currently blocked is called the
  2799. “signal mask”. Each process has its own signal mask. When you create a
  2800. new process (*note Creating a Process::), it inherits its parent's mask.
  2801. You can block or unblock signals with total flexibility by modifying the
  2802. signal mask.
  2803. The prototype for the ‘sigprocmask’ function is in ‘signal.h’.
  2804. Note that you must not use ‘sigprocmask’ in multi-threaded processes,
  2805. because each thread has its own signal mask and there is no single
  2806. process signal mask. According to POSIX, the behavior of ‘sigprocmask’
  2807. in a multi-threaded process is "unspecified". Instead, use
  2808. ‘pthread_sigmask’.
  2809. -- Function: int sigprocmask (int HOW, const sigset_t *restrict SET,
  2810. sigset_t *restrict OLDSET)
  2811. Preliminary: | MT-Unsafe race:sigprocmask/bsd(SIG_UNBLOCK) |
  2812. AS-Unsafe lock/hurd | AC-Unsafe lock/hurd | *Note POSIX Safety
  2813. Concepts::.
  2814. The ‘sigprocmask’ function is used to examine or change the calling
  2815. process's signal mask. The HOW argument determines how the signal
  2816. mask is changed, and must be one of the following values:
  2817. ‘SIG_BLOCK’
  2818. Block the signals in ‘set’--add them to the existing mask. In
  2819. other words, the new mask is the union of the existing mask
  2820. and SET.
  2821. ‘SIG_UNBLOCK’
  2822. Unblock the signals in SET--remove them from the existing
  2823. mask.
  2824. ‘SIG_SETMASK’
  2825. Use SET for the mask; ignore the previous value of the mask.
  2826. The last argument, OLDSET, is used to return information about the
  2827. old process signal mask. If you just want to change the mask
  2828. without looking at it, pass a null pointer as the OLDSET argument.
  2829. Similarly, if you want to know what's in the mask without changing
  2830. it, pass a null pointer for SET (in this case the HOW argument is
  2831. not significant). The OLDSET argument is often used to remember
  2832. the previous signal mask in order to restore it later. (Since the
  2833. signal mask is inherited over ‘fork’ and ‘exec’ calls, you can't
  2834. predict what its contents are when your program starts running.)
  2835. If invoking ‘sigprocmask’ causes any pending signals to be
  2836. unblocked, at least one of those signals is delivered to the
  2837. process before ‘sigprocmask’ returns. The order in which pending
  2838. signals are delivered is not specified, but you can control the
  2839. order explicitly by making multiple ‘sigprocmask’ calls to unblock
  2840. various signals one at a time.
  2841. The ‘sigprocmask’ function returns ‘0’ if successful, and ‘-1’ to
  2842. indicate an error. The following ‘errno’ error conditions are
  2843. defined for this function:
  2844. ‘EINVAL’
  2845. The HOW argument is invalid.
  2846. You can't block the ‘SIGKILL’ and ‘SIGSTOP’ signals, but if the
  2847. signal set includes these, ‘sigprocmask’ just ignores them instead
  2848. of returning an error status.
  2849. Remember, too, that blocking program error signals such as ‘SIGFPE’
  2850. leads to undesirable results for signals generated by an actual
  2851. program error (as opposed to signals sent with ‘raise’ or ‘kill’).
  2852. This is because your program may be too broken to be able to
  2853. continue executing to a point where the signal is unblocked again.
  2854. *Note Program Error Signals::.
  2855. 
  2856. File: libc.info, Node: Testing for Delivery, Next: Blocking for Handler, Prev: Process Signal Mask, Up: Blocking Signals
  2857. 25.7.4 Blocking to Test for Delivery of a Signal
  2858. ------------------------------------------------
  2859. Now for a simple example. Suppose you establish a handler for ‘SIGALRM’
  2860. signals that sets a flag whenever a signal arrives, and your main
  2861. program checks this flag from time to time and then resets it. You can
  2862. prevent additional ‘SIGALRM’ signals from arriving in the meantime by
  2863. wrapping the critical part of the code with calls to ‘sigprocmask’, like
  2864. this:
  2865. /* This variable is set by the SIGALRM signal handler. */
  2866. volatile sig_atomic_t flag = 0;
  2867. int
  2868. main (void)
  2869. {
  2870. sigset_t block_alarm;
  2871. ...
  2872. /* Initialize the signal mask. */
  2873. sigemptyset (&block_alarm);
  2874. sigaddset (&block_alarm, SIGALRM);
  2875. while (1)
  2876. {
  2877. /* Check if a signal has arrived; if so, reset the flag. */
  2878. sigprocmask (SIG_BLOCK, &block_alarm, NULL);
  2879. if (flag)
  2880. {
  2881. ACTIONS-IF-NOT-ARRIVED
  2882. flag = 0;
  2883. }
  2884. sigprocmask (SIG_UNBLOCK, &block_alarm, NULL);
  2885. ...
  2886. }
  2887. }
  2888. 
  2889. File: libc.info, Node: Blocking for Handler, Next: Checking for Pending Signals, Prev: Testing for Delivery, Up: Blocking Signals
  2890. 25.7.5 Blocking Signals for a Handler
  2891. -------------------------------------
  2892. When a signal handler is invoked, you usually want it to be able to
  2893. finish without being interrupted by another signal. From the moment the
  2894. handler starts until the moment it finishes, you must block signals that
  2895. might confuse it or corrupt its data.
  2896. When a handler function is invoked on a signal, that signal is
  2897. automatically blocked (in addition to any other signals that are already
  2898. in the process's signal mask) during the time the handler is running.
  2899. If you set up a handler for ‘SIGTSTP’, for instance, then the arrival of
  2900. that signal forces further ‘SIGTSTP’ signals to wait during the
  2901. execution of the handler.
  2902. However, by default, other kinds of signals are not blocked; they can
  2903. arrive during handler execution.
  2904. The reliable way to block other kinds of signals during the execution
  2905. of the handler is to use the ‘sa_mask’ member of the ‘sigaction’
  2906. structure.
  2907. Here is an example:
  2908. #include <signal.h>
  2909. #include <stddef.h>
  2910. void catch_stop ();
  2911. void
  2912. install_handler (void)
  2913. {
  2914. struct sigaction setup_action;
  2915. sigset_t block_mask;
  2916. sigemptyset (&block_mask);
  2917. /* Block other terminal-generated signals while handler runs. */
  2918. sigaddset (&block_mask, SIGINT);
  2919. sigaddset (&block_mask, SIGQUIT);
  2920. setup_action.sa_handler = catch_stop;
  2921. setup_action.sa_mask = block_mask;
  2922. setup_action.sa_flags = 0;
  2923. sigaction (SIGTSTP, &setup_action, NULL);
  2924. }
  2925. This is more reliable than blocking the other signals explicitly in
  2926. the code for the handler. If you block signals explicitly in the
  2927. handler, you can't avoid at least a short interval at the beginning of
  2928. the handler where they are not yet blocked.
  2929. You cannot remove signals from the process's current mask using this
  2930. mechanism. However, you can make calls to ‘sigprocmask’ within your
  2931. handler to block or unblock signals as you wish.
  2932. In any case, when the handler returns, the system restores the mask
  2933. that was in place before the handler was entered. If any signals that
  2934. become unblocked by this restoration are pending, the process will
  2935. receive those signals immediately, before returning to the code that was
  2936. interrupted.
  2937. 
  2938. File: libc.info, Node: Checking for Pending Signals, Next: Remembering a Signal, Prev: Blocking for Handler, Up: Blocking Signals
  2939. 25.7.6 Checking for Pending Signals
  2940. -----------------------------------
  2941. You can find out which signals are pending at any time by calling
  2942. ‘sigpending’. This function is declared in ‘signal.h’.
  2943. -- Function: int sigpending (sigset_t *SET)
  2944. Preliminary: | MT-Safe | AS-Unsafe lock/hurd | AC-Unsafe lock/hurd
  2945. | *Note POSIX Safety Concepts::.
  2946. The ‘sigpending’ function stores information about pending signals
  2947. in SET. If there is a pending signal that is blocked from
  2948. delivery, then that signal is a member of the returned set. (You
  2949. can test whether a particular signal is a member of this set using
  2950. ‘sigismember’; see *note Signal Sets::.)
  2951. The return value is ‘0’ if successful, and ‘-1’ on failure.
  2952. Testing whether a signal is pending is not often useful. Testing
  2953. when that signal is not blocked is almost certainly bad design.
  2954. Here is an example.
  2955. #include <signal.h>
  2956. #include <stddef.h>
  2957. sigset_t base_mask, waiting_mask;
  2958. sigemptyset (&base_mask);
  2959. sigaddset (&base_mask, SIGINT);
  2960. sigaddset (&base_mask, SIGTSTP);
  2961. /* Block user interrupts while doing other processing. */
  2962. sigprocmask (SIG_SETMASK, &base_mask, NULL);
  2963. ...
  2964. /* After a while, check to see whether any signals are pending. */
  2965. sigpending (&waiting_mask);
  2966. if (sigismember (&waiting_mask, SIGINT)) {
  2967. /* User has tried to kill the process. */
  2968. }
  2969. else if (sigismember (&waiting_mask, SIGTSTP)) {
  2970. /* User has tried to stop the process. */
  2971. }
  2972. Remember that if there is a particular signal pending for your
  2973. process, additional signals of that same type that arrive in the
  2974. meantime might be discarded. For example, if a ‘SIGINT’ signal is
  2975. pending when another ‘SIGINT’ signal arrives, your program will probably
  2976. only see one of them when you unblock this signal.
  2977. *Portability Note:* The ‘sigpending’ function is new in POSIX.1.
  2978. Older systems have no equivalent facility.
  2979. 
  2980. File: libc.info, Node: Remembering a Signal, Prev: Checking for Pending Signals, Up: Blocking Signals
  2981. 25.7.7 Remembering a Signal to Act On Later
  2982. -------------------------------------------
  2983. Instead of blocking a signal using the library facilities, you can get
  2984. almost the same results by making the handler set a flag to be tested
  2985. later, when you "unblock". Here is an example:
  2986. /* If this flag is nonzero, don't handle the signal right away. */
  2987. volatile sig_atomic_t signal_pending;
  2988. /* This is nonzero if a signal arrived and was not handled. */
  2989. volatile sig_atomic_t defer_signal;
  2990. void
  2991. handler (int signum)
  2992. {
  2993. if (defer_signal)
  2994. signal_pending = signum;
  2995. else
  2996. ... /* "Really" handle the signal. */
  2997. }
  2998. ...
  2999. void
  3000. update_mumble (int frob)
  3001. {
  3002. /* Prevent signals from having immediate effect. */
  3003. defer_signal++;
  3004. /* Now update ‘mumble’, without worrying about interruption. */
  3005. mumble.a = 1;
  3006. mumble.b = hack ();
  3007. mumble.c = frob;
  3008. /* We have updated ‘mumble’. Handle any signal that came in. */
  3009. defer_signal--;
  3010. if (defer_signal == 0 && signal_pending != 0)
  3011. raise (signal_pending);
  3012. }
  3013. Note how the particular signal that arrives is stored in
  3014. ‘signal_pending’. That way, we can handle several types of inconvenient
  3015. signals with the same mechanism.
  3016. We increment and decrement ‘defer_signal’ so that nested critical
  3017. sections will work properly; thus, if ‘update_mumble’ were called with
  3018. ‘signal_pending’ already nonzero, signals would be deferred not only
  3019. within ‘update_mumble’, but also within the caller. This is also why we
  3020. do not check ‘signal_pending’ if ‘defer_signal’ is still nonzero.
  3021. The incrementing and decrementing of ‘defer_signal’ each require more
  3022. than one instruction; it is possible for a signal to happen in the
  3023. middle. But that does not cause any problem. If the signal happens
  3024. early enough to see the value from before the increment or decrement,
  3025. that is equivalent to a signal which came before the beginning of the
  3026. increment or decrement, which is a case that works properly.
  3027. It is absolutely vital to decrement ‘defer_signal’ before testing
  3028. ‘signal_pending’, because this avoids a subtle bug. If we did these
  3029. things in the other order, like this,
  3030. if (defer_signal == 1 && signal_pending != 0)
  3031. raise (signal_pending);
  3032. defer_signal--;
  3033. then a signal arriving in between the ‘if’ statement and the decrement
  3034. would be effectively "lost" for an indefinite amount of time. The
  3035. handler would merely set ‘defer_signal’, but the program having already
  3036. tested this variable, it would not test the variable again.
  3037. Bugs like these are called “timing errors”. They are especially bad
  3038. because they happen only rarely and are nearly impossible to reproduce.
  3039. You can't expect to find them with a debugger as you would find a
  3040. reproducible bug. So it is worth being especially careful to avoid
  3041. them.
  3042. (You would not be tempted to write the code in this order, given the
  3043. use of ‘defer_signal’ as a counter which must be tested along with
  3044. ‘signal_pending’. After all, testing for zero is cleaner than testing
  3045. for one. But if you did not use ‘defer_signal’ as a counter, and gave
  3046. it values of zero and one only, then either order might seem equally
  3047. simple. This is a further advantage of using a counter for
  3048. ‘defer_signal’: it will reduce the chance you will write the code in the
  3049. wrong order and create a subtle bug.)
  3050. 
  3051. File: libc.info, Node: Waiting for a Signal, Next: Signal Stack, Prev: Blocking Signals, Up: Signal Handling
  3052. 25.8 Waiting for a Signal
  3053. =========================
  3054. If your program is driven by external events, or uses signals for
  3055. synchronization, then when it has nothing to do it should probably wait
  3056. until a signal arrives.
  3057. * Menu:
  3058. * Using Pause:: The simple way, using ‘pause’.
  3059. * Pause Problems:: Why the simple way is often not very good.
  3060. * Sigsuspend:: Reliably waiting for a specific signal.
  3061. 
  3062. File: libc.info, Node: Using Pause, Next: Pause Problems, Up: Waiting for a Signal
  3063. 25.8.1 Using ‘pause’
  3064. --------------------
  3065. The simple way to wait until a signal arrives is to call ‘pause’.
  3066. Please read about its disadvantages, in the following section, before
  3067. you use it.
  3068. -- Function: int pause (void)
  3069. Preliminary: | MT-Unsafe race:sigprocmask/!bsd!linux | AS-Unsafe
  3070. lock/hurd | AC-Unsafe lock/hurd | *Note POSIX Safety Concepts::.
  3071. The ‘pause’ function suspends program execution until a signal
  3072. arrives whose action is either to execute a handler function, or to
  3073. terminate the process.
  3074. If the signal causes a handler function to be executed, then
  3075. ‘pause’ returns. This is considered an unsuccessful return (since
  3076. "successful" behavior would be to suspend the program forever), so
  3077. the return value is ‘-1’. Even if you specify that other
  3078. primitives should resume when a system handler returns (*note
  3079. Interrupted Primitives::), this has no effect on ‘pause’; it always
  3080. fails when a signal is handled.
  3081. The following ‘errno’ error conditions are defined for this
  3082. function:
  3083. ‘EINTR’
  3084. The function was interrupted by delivery of a signal.
  3085. If the signal causes program termination, ‘pause’ doesn't return
  3086. (obviously).
  3087. This function is a cancellation point in multithreaded programs.
  3088. This is a problem if the thread allocates some resources (like
  3089. memory, file descriptors, semaphores or whatever) at the time
  3090. ‘pause’ is called. If the thread gets cancelled these resources
  3091. stay allocated until the program ends. To avoid this calls to
  3092. ‘pause’ should be protected using cancellation handlers.
  3093. The ‘pause’ function is declared in ‘unistd.h’.
  3094. 
  3095. File: libc.info, Node: Pause Problems, Next: Sigsuspend, Prev: Using Pause, Up: Waiting for a Signal
  3096. 25.8.2 Problems with ‘pause’
  3097. ----------------------------
  3098. The simplicity of ‘pause’ can conceal serious timing errors that can
  3099. make a program hang mysteriously.
  3100. It is safe to use ‘pause’ if the real work of your program is done by
  3101. the signal handlers themselves, and the "main program" does nothing but
  3102. call ‘pause’. Each time a signal is delivered, the handler will do the
  3103. next batch of work that is to be done, and then return, so that the main
  3104. loop of the program can call ‘pause’ again.
  3105. You can't safely use ‘pause’ to wait until one more signal arrives,
  3106. and then resume real work. Even if you arrange for the signal handler
  3107. to cooperate by setting a flag, you still can't use ‘pause’ reliably.
  3108. Here is an example of this problem:
  3109. /* ‘usr_interrupt’ is set by the signal handler. */
  3110. if (!usr_interrupt)
  3111. pause ();
  3112. /* Do work once the signal arrives. */
  3113. ...
  3114. This has a bug: the signal could arrive after the variable
  3115. ‘usr_interrupt’ is checked, but before the call to ‘pause’. If no
  3116. further signals arrive, the process would never wake up again.
  3117. You can put an upper limit on the excess waiting by using ‘sleep’ in
  3118. a loop, instead of using ‘pause’. (*Note Sleeping::, for more about
  3119. ‘sleep’.) Here is what this looks like:
  3120. /* ‘usr_interrupt’ is set by the signal handler.
  3121. while (!usr_interrupt)
  3122. sleep (1);
  3123. /* Do work once the signal arrives. */
  3124. ...
  3125. For some purposes, that is good enough. But with a little more
  3126. complexity, you can wait reliably until a particular signal handler is
  3127. run, using ‘sigsuspend’. *Note Sigsuspend::.
  3128. 
  3129. File: libc.info, Node: Sigsuspend, Prev: Pause Problems, Up: Waiting for a Signal
  3130. 25.8.3 Using ‘sigsuspend’
  3131. -------------------------
  3132. The clean and reliable way to wait for a signal to arrive is to block it
  3133. and then use ‘sigsuspend’. By using ‘sigsuspend’ in a loop, you can
  3134. wait for certain kinds of signals, while letting other kinds of signals
  3135. be handled by their handlers.
  3136. -- Function: int sigsuspend (const sigset_t *SET)
  3137. Preliminary: | MT-Unsafe race:sigprocmask/!bsd!linux | AS-Unsafe
  3138. lock/hurd | AC-Unsafe lock/hurd | *Note POSIX Safety Concepts::.
  3139. This function replaces the process's signal mask with SET and then
  3140. suspends the process until a signal is delivered whose action is
  3141. either to terminate the process or invoke a signal handling
  3142. function. In other words, the program is effectively suspended
  3143. until one of the signals that is not a member of SET arrives.
  3144. If the process is woken up by delivery of a signal that invokes a
  3145. handler function, and the handler function returns, then
  3146. ‘sigsuspend’ also returns.
  3147. The mask remains SET only as long as ‘sigsuspend’ is waiting. The
  3148. function ‘sigsuspend’ always restores the previous signal mask when
  3149. it returns.
  3150. The return value and error conditions are the same as for ‘pause’.
  3151. With ‘sigsuspend’, you can replace the ‘pause’ or ‘sleep’ loop in the
  3152. previous section with something completely reliable:
  3153. sigset_t mask, oldmask;
  3154. ...
  3155. /* Set up the mask of signals to temporarily block. */
  3156. sigemptyset (&mask);
  3157. sigaddset (&mask, SIGUSR1);
  3158. ...
  3159. /* Wait for a signal to arrive. */
  3160. sigprocmask (SIG_BLOCK, &mask, &oldmask);
  3161. while (!usr_interrupt)
  3162. sigsuspend (&oldmask);
  3163. sigprocmask (SIG_UNBLOCK, &mask, NULL);
  3164. This last piece of code is a little tricky. The key point to
  3165. remember here is that when ‘sigsuspend’ returns, it resets the process's
  3166. signal mask to the original value, the value from before the call to
  3167. ‘sigsuspend’--in this case, the ‘SIGUSR1’ signal is once again blocked.
  3168. The second call to ‘sigprocmask’ is necessary to explicitly unblock this
  3169. signal.
  3170. One other point: you may be wondering why the ‘while’ loop is
  3171. necessary at all, since the program is apparently only waiting for one
  3172. ‘SIGUSR1’ signal. The answer is that the mask passed to ‘sigsuspend’
  3173. permits the process to be woken up by the delivery of other kinds of
  3174. signals, as well--for example, job control signals. If the process is
  3175. woken up by a signal that doesn't set ‘usr_interrupt’, it just suspends
  3176. itself again until the "right" kind of signal eventually arrives.
  3177. This technique takes a few more lines of preparation, but that is
  3178. needed just once for each kind of wait criterion you want to use. The
  3179. code that actually waits is just four lines.
  3180. 
  3181. File: libc.info, Node: Signal Stack, Next: BSD Signal Handling, Prev: Waiting for a Signal, Up: Signal Handling
  3182. 25.9 Using a Separate Signal Stack
  3183. ==================================
  3184. A signal stack is a special area of memory to be used as the execution
  3185. stack during signal handlers. It should be fairly large, to avoid any
  3186. danger that it will overflow in turn; the macro ‘SIGSTKSZ’ is defined to
  3187. a canonical size for signal stacks. You can use ‘malloc’ to allocate
  3188. the space for the stack. Then call ‘sigaltstack’ or ‘sigstack’ to tell
  3189. the system to use that space for the signal stack.
  3190. You don't need to write signal handlers differently in order to use a
  3191. signal stack. Switching from one stack to the other happens
  3192. automatically. (Some non-GNU debuggers on some machines may get
  3193. confused if you examine a stack trace while a handler that uses the
  3194. signal stack is running.)
  3195. There are two interfaces for telling the system to use a separate
  3196. signal stack. ‘sigstack’ is the older interface, which comes from 4.2
  3197. BSD. ‘sigaltstack’ is the newer interface, and comes from 4.4 BSD. The
  3198. ‘sigaltstack’ interface has the advantage that it does not require your
  3199. program to know which direction the stack grows, which depends on the
  3200. specific machine and operating system.
  3201. -- Data Type: stack_t
  3202. This structure describes a signal stack. It contains the following
  3203. members:
  3204. ‘void *ss_sp’
  3205. This points to the base of the signal stack.
  3206. ‘size_t ss_size’
  3207. This is the size (in bytes) of the signal stack which ‘ss_sp’
  3208. points to. You should set this to however much space you
  3209. allocated for the stack.
  3210. There are two macros defined in ‘signal.h’ that you should use
  3211. in calculating this size:
  3212. ‘SIGSTKSZ’
  3213. This is the canonical size for a signal stack. It is
  3214. judged to be sufficient for normal uses.
  3215. ‘MINSIGSTKSZ’
  3216. This is the amount of signal stack space the operating
  3217. system needs just to implement signal delivery. The size
  3218. of a signal stack *must* be greater than this.
  3219. For most cases, just using ‘SIGSTKSZ’ for ‘ss_size’ is
  3220. sufficient. But if you know how much stack space your
  3221. program's signal handlers will need, you may want to use
  3222. a different size. In this case, you should allocate
  3223. ‘MINSIGSTKSZ’ additional bytes for the signal stack and
  3224. increase ‘ss_size’ accordingly.
  3225. ‘int ss_flags’
  3226. This field contains the bitwise OR of these flags:
  3227. ‘SS_DISABLE’
  3228. This tells the system that it should not use the signal
  3229. stack.
  3230. ‘SS_ONSTACK’
  3231. This is set by the system, and indicates that the signal
  3232. stack is currently in use. If this bit is not set, then
  3233. signals will be delivered on the normal user stack.
  3234. -- Function: int sigaltstack (const stack_t *restrict STACK, stack_t
  3235. *restrict OLDSTACK)
  3236. Preliminary: | MT-Safe | AS-Unsafe lock/hurd | AC-Unsafe lock/hurd
  3237. | *Note POSIX Safety Concepts::.
  3238. The ‘sigaltstack’ function specifies an alternate stack for use
  3239. during signal handling. When a signal is received by the process
  3240. and its action indicates that the signal stack is used, the system
  3241. arranges a switch to the currently installed signal stack while the
  3242. handler for that signal is executed.
  3243. If OLDSTACK is not a null pointer, information about the currently
  3244. installed signal stack is returned in the location it points to.
  3245. If STACK is not a null pointer, then this is installed as the new
  3246. stack for use by signal handlers.
  3247. The return value is ‘0’ on success and ‘-1’ on failure. If
  3248. ‘sigaltstack’ fails, it sets ‘errno’ to one of these values:
  3249. ‘EINVAL’
  3250. You tried to disable a stack that was in fact currently in
  3251. use.
  3252. ‘ENOMEM’
  3253. The size of the alternate stack was too small. It must be
  3254. greater than ‘MINSIGSTKSZ’.
  3255. Here is the older ‘sigstack’ interface. You should use ‘sigaltstack’
  3256. instead on systems that have it.
  3257. -- Data Type: struct sigstack
  3258. This structure describes a signal stack. It contains the following
  3259. members:
  3260. ‘void *ss_sp’
  3261. This is the stack pointer. If the stack grows downwards on
  3262. your machine, this should point to the top of the area you
  3263. allocated. If the stack grows upwards, it should point to the
  3264. bottom.
  3265. ‘int ss_onstack’
  3266. This field is true if the process is currently using this
  3267. stack.
  3268. -- Function: int sigstack (struct sigstack *STACK, struct sigstack
  3269. *OLDSTACK)
  3270. Preliminary: | MT-Safe | AS-Unsafe lock/hurd | AC-Unsafe lock/hurd
  3271. | *Note POSIX Safety Concepts::.
  3272. The ‘sigstack’ function specifies an alternate stack for use during
  3273. signal handling. When a signal is received by the process and its
  3274. action indicates that the signal stack is used, the system arranges
  3275. a switch to the currently installed signal stack while the handler
  3276. for that signal is executed.
  3277. If OLDSTACK is not a null pointer, information about the currently
  3278. installed signal stack is returned in the location it points to.
  3279. If STACK is not a null pointer, then this is installed as the new
  3280. stack for use by signal handlers.
  3281. The return value is ‘0’ on success and ‘-1’ on failure.
  3282. 
  3283. File: libc.info, Node: BSD Signal Handling, Prev: Signal Stack, Up: Signal Handling
  3284. 25.10 BSD Signal Handling
  3285. =========================
  3286. This section describes alternative signal handling functions derived
  3287. from BSD Unix. These facilities were an advance, in their time; today,
  3288. they are mostly obsolete, and supported mainly for compatibility with
  3289. BSD Unix.
  3290. There are many similarities between the BSD and POSIX signal handling
  3291. facilities, because the POSIX facilities were inspired by the BSD
  3292. facilities. Besides having different names for all the functions to
  3293. avoid conflicts, the main difference between the two is that BSD Unix
  3294. represents signal masks as an ‘int’ bit mask, rather than as a
  3295. ‘sigset_t’ object.
  3296. The BSD facilities are declared in ‘signal.h’.
  3297. -- Function: int siginterrupt (int SIGNUM, int FAILFLAG)
  3298. Preliminary: | MT-Unsafe const:sigintr | AS-Unsafe | AC-Unsafe
  3299. corrupt | *Note POSIX Safety Concepts::.
  3300. This function specifies which approach to use when certain
  3301. primitives are interrupted by handling signal SIGNUM. If FAILFLAG
  3302. is false, signal SIGNUM restarts primitives. If FAILFLAG is true,
  3303. handling SIGNUM causes these primitives to fail with error code
  3304. ‘EINTR’. *Note Interrupted Primitives::.
  3305. This function has been replaced by the ‘SA_RESTART’ flag of the
  3306. ‘sigaction’ function. *Note Advanced Signal Handling::.
  3307. -- Macro: int sigmask (int SIGNUM)
  3308. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3309. Concepts::.
  3310. This macro returns a signal mask that has the bit for signal SIGNUM
  3311. set. You can bitwise-OR the results of several calls to ‘sigmask’
  3312. together to specify more than one signal. For example,
  3313. (sigmask (SIGTSTP) | sigmask (SIGSTOP)
  3314. | sigmask (SIGTTIN) | sigmask (SIGTTOU))
  3315. specifies a mask that includes all the job-control stop signals.
  3316. This macro has been replaced by the ‘sigset_t’ type and the
  3317. associated signal set manipulation functions. *Note Signal Sets::.
  3318. -- Function: int sigblock (int MASK)
  3319. Preliminary: | MT-Safe | AS-Unsafe lock/hurd | AC-Unsafe lock/hurd
  3320. | *Note POSIX Safety Concepts::.
  3321. This function is equivalent to ‘sigprocmask’ (*note Process Signal
  3322. Mask::) with a HOW argument of ‘SIG_BLOCK’: it adds the signals
  3323. specified by MASK to the calling process's set of blocked signals.
  3324. The return value is the previous set of blocked signals.
  3325. -- Function: int sigsetmask (int MASK)
  3326. Preliminary: | MT-Safe | AS-Unsafe lock/hurd | AC-Unsafe lock/hurd
  3327. | *Note POSIX Safety Concepts::.
  3328. This function is equivalent to ‘sigprocmask’ (*note Process Signal
  3329. Mask::) with a HOW argument of ‘SIG_SETMASK’: it sets the calling
  3330. process's signal mask to MASK. The return value is the previous
  3331. set of blocked signals.
  3332. -- Function: int sigpause (int MASK)
  3333. Preliminary: | MT-Unsafe race:sigprocmask/!bsd!linux | AS-Unsafe
  3334. lock/hurd | AC-Unsafe lock/hurd | *Note POSIX Safety Concepts::.
  3335. This function is the equivalent of ‘sigsuspend’ (*note Waiting for
  3336. a Signal::): it sets the calling process's signal mask to MASK, and
  3337. waits for a signal to arrive. On return the previous set of
  3338. blocked signals is restored.
  3339. 
  3340. File: libc.info, Node: Program Basics, Next: Processes, Prev: Signal Handling, Up: Top
  3341. 26 The Basic Program/System Interface
  3342. *************************************
  3343. “Processes” are the primitive units for allocation of system resources.
  3344. Each process has its own address space and (usually) one thread of
  3345. control. A process executes a program; you can have multiple processes
  3346. executing the same program, but each process has its own copy of the
  3347. program within its own address space and executes it independently of
  3348. the other copies. Though it may have multiple threads of control within
  3349. the same program and a program may be composed of multiple logically
  3350. separate modules, a process always executes exactly one program.
  3351. Note that we are using a specific definition of "program" for the
  3352. purposes of this manual, which corresponds to a common definition in the
  3353. context of Unix systems. In popular usage, "program" enjoys a much
  3354. broader definition; it can refer for example to a system's kernel, an
  3355. editor macro, a complex package of software, or a discrete section of
  3356. code executing within a process.
  3357. Writing the program is what this manual is all about. This chapter
  3358. explains the most basic interface between your program and the system
  3359. that runs, or calls, it. This includes passing of parameters (arguments
  3360. and environment) from the system, requesting basic services from the
  3361. system, and telling the system the program is done.
  3362. A program starts another program with the ‘exec’ family of system
  3363. calls. This chapter looks at program startup from the execee's point of
  3364. view. To see the event from the execor's point of view, see *note
  3365. Executing a File::.
  3366. * Menu:
  3367. * Program Arguments:: Parsing your program's command-line arguments
  3368. * Environment Variables:: Less direct parameters affecting your program
  3369. * Auxiliary Vector:: Least direct parameters affecting your program
  3370. * System Calls:: Requesting service from the system
  3371. * Program Termination:: Telling the system you're done; return status
  3372. 
  3373. File: libc.info, Node: Program Arguments, Next: Environment Variables, Up: Program Basics
  3374. 26.1 Program Arguments
  3375. ======================
  3376. The system starts a C program by calling the function ‘main’. It is up
  3377. to you to write a function named ‘main’--otherwise, you won't even be
  3378. able to link your program without errors.
  3379. In ISO C you can define ‘main’ either to take no arguments, or to
  3380. take two arguments that represent the command line arguments to the
  3381. program, like this:
  3382. int main (int ARGC, char *ARGV[])
  3383. The command line arguments are the whitespace-separated tokens given
  3384. in the shell command used to invoke the program; thus, in ‘cat foo bar’,
  3385. the arguments are ‘foo’ and ‘bar’. The only way a program can look at
  3386. its command line arguments is via the arguments of ‘main’. If ‘main’
  3387. doesn't take arguments, then you cannot get at the command line.
  3388. The value of the ARGC argument is the number of command line
  3389. arguments. The ARGV argument is a vector of C strings; its elements are
  3390. the individual command line argument strings. The file name of the
  3391. program being run is also included in the vector as the first element;
  3392. the value of ARGC counts this element. A null pointer always follows
  3393. the last element: ‘ARGV[ARGC]’ is this null pointer.
  3394. For the command ‘cat foo bar’, ARGC is 3 and ARGV has three elements,
  3395. ‘"cat"’, ‘"foo"’ and ‘"bar"’.
  3396. In Unix systems you can define ‘main’ a third way, using three
  3397. arguments:
  3398. int main (int ARGC, char *ARGV[], char *ENVP[])
  3399. The first two arguments are just the same. The third argument ENVP
  3400. gives the program's environment; it is the same as the value of
  3401. ‘environ’. *Note Environment Variables::. POSIX.1 does not allow this
  3402. three-argument form, so to be portable it is best to write ‘main’ to
  3403. take two arguments, and use the value of ‘environ’.
  3404. * Menu:
  3405. * Argument Syntax:: By convention, options start with a hyphen.
  3406. * Parsing Program Arguments:: Ways to parse program options and arguments.
  3407. 
  3408. File: libc.info, Node: Argument Syntax, Next: Parsing Program Arguments, Up: Program Arguments
  3409. 26.1.1 Program Argument Syntax Conventions
  3410. ------------------------------------------
  3411. POSIX recommends these conventions for command line arguments. ‘getopt’
  3412. (*note Getopt::) and ‘argp_parse’ (*note Argp::) make it easy to
  3413. implement them.
  3414. • Arguments are options if they begin with a hyphen delimiter (‘-’).
  3415. • Multiple options may follow a hyphen delimiter in a single token if
  3416. the options do not take arguments. Thus, ‘-abc’ is equivalent to
  3417. ‘-a -b -c’.
  3418. • Option names are single alphanumeric characters (as for ‘isalnum’;
  3419. *note Classification of Characters::).
  3420. • Certain options require an argument. For example, the ‘-o’ option
  3421. of the ‘ld’ command requires an argument--an output file name.
  3422. • An option and its argument may or may not appear as separate
  3423. tokens. (In other words, the whitespace separating them is
  3424. optional.) Thus, ‘-o foo’ and ‘-ofoo’ are equivalent.
  3425. • Options typically precede other non-option arguments.
  3426. The implementations of ‘getopt’ and ‘argp_parse’ in the GNU C
  3427. Library normally make it appear as if all the option arguments were
  3428. specified before all the non-option arguments for the purposes of
  3429. parsing, even if the user of your program intermixed option and
  3430. non-option arguments. They do this by reordering the elements of
  3431. the ARGV array. This behavior is nonstandard; if you want to
  3432. suppress it, define the ‘_POSIX_OPTION_ORDER’ environment variable.
  3433. *Note Standard Environment::.
  3434. • The argument ‘--’ terminates all options; any following arguments
  3435. are treated as non-option arguments, even if they begin with a
  3436. hyphen.
  3437. • A token consisting of a single hyphen character is interpreted as
  3438. an ordinary non-option argument. By convention, it is used to
  3439. specify input from or output to the standard input and output
  3440. streams.
  3441. • Options may be supplied in any order, or appear multiple times.
  3442. The interpretation is left up to the particular application
  3443. program.
  3444. GNU adds “long options” to these conventions. Long options consist
  3445. of ‘--’ followed by a name made of alphanumeric characters and dashes.
  3446. Option names are typically one to three words long, with hyphens to
  3447. separate words. Users can abbreviate the option names as long as the
  3448. abbreviations are unique.
  3449. To specify an argument for a long option, write ‘--NAME=VALUE’. This
  3450. syntax enables a long option to accept an argument that is itself
  3451. optional.
  3452. Eventually, GNU systems will provide completion for long option names
  3453. in the shell.
  3454. 
  3455. File: libc.info, Node: Parsing Program Arguments, Prev: Argument Syntax, Up: Program Arguments
  3456. 26.1.2 Parsing Program Arguments
  3457. --------------------------------
  3458. If the syntax for the command line arguments to your program is simple
  3459. enough, you can simply pick the arguments off from ARGV by hand. But
  3460. unless your program takes a fixed number of arguments, or all of the
  3461. arguments are interpreted in the same way (as file names, for example),
  3462. you are usually better off using ‘getopt’ (*note Getopt::) or
  3463. ‘argp_parse’ (*note Argp::) to do the parsing.
  3464. ‘getopt’ is more standard (the short-option only version of it is a
  3465. part of the POSIX standard), but using ‘argp_parse’ is often easier,
  3466. both for very simple and very complex option structures, because it does
  3467. more of the dirty work for you.
  3468. * Menu:
  3469. * Getopt:: Parsing program options using ‘getopt’.
  3470. * Argp:: Parsing program options using ‘argp_parse’.
  3471. * Suboptions:: Some programs need more detailed options.
  3472. * Suboptions Example:: This shows how it could be done for ‘mount’.
  3473. 
  3474. File: libc.info, Node: Getopt, Next: Argp, Up: Parsing Program Arguments
  3475. 26.2 Parsing program options using ‘getopt’
  3476. ===========================================
  3477. The ‘getopt’ and ‘getopt_long’ functions automate some of the chore
  3478. involved in parsing typical unix command line options.
  3479. * Menu:
  3480. * Using Getopt:: Using the ‘getopt’ function.
  3481. * Example of Getopt:: An example of parsing options with ‘getopt’.
  3482. * Getopt Long Options:: GNU suggests utilities accept long-named
  3483. options; here is one way to do.
  3484. * Getopt Long Option Example:: An example of using ‘getopt_long’.
  3485. 
  3486. File: libc.info, Node: Using Getopt, Next: Example of Getopt, Up: Getopt
  3487. 26.2.1 Using the ‘getopt’ function
  3488. ----------------------------------
  3489. Here are the details about how to call the ‘getopt’ function. To use
  3490. this facility, your program must include the header file ‘unistd.h’.
  3491. -- Variable: int opterr
  3492. If the value of this variable is nonzero, then ‘getopt’ prints an
  3493. error message to the standard error stream if it encounters an
  3494. unknown option character or an option with a missing required
  3495. argument. This is the default behavior. If you set this variable
  3496. to zero, ‘getopt’ does not print any messages, but it still returns
  3497. the character ‘?’ to indicate an error.
  3498. -- Variable: int optopt
  3499. When ‘getopt’ encounters an unknown option character or an option
  3500. with a missing required argument, it stores that option character
  3501. in this variable. You can use this for providing your own
  3502. diagnostic messages.
  3503. -- Variable: int optind
  3504. This variable is set by ‘getopt’ to the index of the next element
  3505. of the ARGV array to be processed. Once ‘getopt’ has found all of
  3506. the option arguments, you can use this variable to determine where
  3507. the remaining non-option arguments begin. The initial value of
  3508. this variable is ‘1’.
  3509. -- Variable: char * optarg
  3510. This variable is set by ‘getopt’ to point at the value of the
  3511. option argument, for those options that accept arguments.
  3512. -- Function: int getopt (int ARGC, char *const *ARGV, const char
  3513. *OPTIONS)
  3514. Preliminary: | MT-Unsafe race:getopt env | AS-Unsafe heap i18n lock
  3515. corrupt | AC-Unsafe mem lock corrupt | *Note POSIX Safety
  3516. Concepts::.
  3517. The ‘getopt’ function gets the next option argument from the
  3518. argument list specified by the ARGV and ARGC arguments. Normally
  3519. these values come directly from the arguments received by ‘main’.
  3520. The OPTIONS argument is a string that specifies the option
  3521. characters that are valid for this program. An option character in
  3522. this string can be followed by a colon (‘:’) to indicate that it
  3523. takes a required argument. If an option character is followed by
  3524. two colons (‘::’), its argument is optional; this is a GNU
  3525. extension.
  3526. ‘getopt’ has three ways to deal with options that follow
  3527. non-options ARGV elements. The special argument ‘--’ forces in all
  3528. cases the end of option scanning.
  3529. • The default is to permute the contents of ARGV while scanning
  3530. it so that eventually all the non-options are at the end.
  3531. This allows options to be given in any order, even with
  3532. programs that were not written to expect this.
  3533. • If the OPTIONS argument string begins with a hyphen (‘-’),
  3534. this is treated specially. It permits arguments that are not
  3535. options to be returned as if they were associated with option
  3536. character ‘\1’.
  3537. • POSIX demands the following behavior: the first non-option
  3538. stops option processing. This mode is selected by either
  3539. setting the environment variable ‘POSIXLY_CORRECT’ or
  3540. beginning the OPTIONS argument string with a plus sign (‘+’).
  3541. The ‘getopt’ function returns the option character for the next
  3542. command line option. When no more option arguments are available,
  3543. it returns ‘-1’. There may still be more non-option arguments; you
  3544. must compare the external variable ‘optind’ against the ARGC
  3545. parameter to check this.
  3546. If the option has an argument, ‘getopt’ returns the argument by
  3547. storing it in the variable OPTARG. You don't ordinarily need to
  3548. copy the ‘optarg’ string, since it is a pointer into the original
  3549. ARGV array, not into a static area that might be overwritten.
  3550. If ‘getopt’ finds an option character in ARGV that was not included
  3551. in OPTIONS, or a missing option argument, it returns ‘?’ and sets
  3552. the external variable ‘optopt’ to the actual option character. If
  3553. the first character of OPTIONS is a colon (‘:’), then ‘getopt’
  3554. returns ‘:’ instead of ‘?’ to indicate a missing option argument.
  3555. In addition, if the external variable ‘opterr’ is nonzero (which is
  3556. the default), ‘getopt’ prints an error message.
  3557. 
  3558. File: libc.info, Node: Example of Getopt, Next: Getopt Long Options, Prev: Using Getopt, Up: Getopt
  3559. 26.2.2 Example of Parsing Arguments with ‘getopt’
  3560. -------------------------------------------------
  3561. Here is an example showing how ‘getopt’ is typically used. The key
  3562. points to notice are:
  3563. • Normally, ‘getopt’ is called in a loop. When ‘getopt’ returns
  3564. ‘-1’, indicating no more options are present, the loop terminates.
  3565. • A ‘switch’ statement is used to dispatch on the return value from
  3566. ‘getopt’. In typical use, each case just sets a variable that is
  3567. used later in the program.
  3568. • A second loop is used to process the remaining non-option
  3569. arguments.
  3570. #include <ctype.h>
  3571. #include <stdio.h>
  3572. #include <stdlib.h>
  3573. #include <unistd.h>
  3574. int
  3575. main (int argc, char **argv)
  3576. {
  3577. int aflag = 0;
  3578. int bflag = 0;
  3579. char *cvalue = NULL;
  3580. int index;
  3581. int c;
  3582. opterr = 0;
  3583. while ((c = getopt (argc, argv, "abc:")) != -1)
  3584. switch (c)
  3585. {
  3586. case 'a':
  3587. aflag = 1;
  3588. break;
  3589. case 'b':
  3590. bflag = 1;
  3591. break;
  3592. case 'c':
  3593. cvalue = optarg;
  3594. break;
  3595. case '?':
  3596. if (optopt == 'c')
  3597. fprintf (stderr, "Option -%c requires an argument.\n", optopt);
  3598. else if (isprint (optopt))
  3599. fprintf (stderr, "Unknown option `-%c'.\n", optopt);
  3600. else
  3601. fprintf (stderr,
  3602. "Unknown option character `\\x%x'.\n",
  3603. optopt);
  3604. return 1;
  3605. default:
  3606. abort ();
  3607. }
  3608. printf ("aflag = %d, bflag = %d, cvalue = %s\n",
  3609. aflag, bflag, cvalue);
  3610. for (index = optind; index < argc; index++)
  3611. printf ("Non-option argument %s\n", argv[index]);
  3612. return 0;
  3613. }
  3614. Here are some examples showing what this program prints with
  3615. different combinations of arguments:
  3616. % testopt
  3617. aflag = 0, bflag = 0, cvalue = (null)
  3618. % testopt -a -b
  3619. aflag = 1, bflag = 1, cvalue = (null)
  3620. % testopt -ab
  3621. aflag = 1, bflag = 1, cvalue = (null)
  3622. % testopt -c foo
  3623. aflag = 0, bflag = 0, cvalue = foo
  3624. % testopt -cfoo
  3625. aflag = 0, bflag = 0, cvalue = foo
  3626. % testopt arg1
  3627. aflag = 0, bflag = 0, cvalue = (null)
  3628. Non-option argument arg1
  3629. % testopt -a arg1
  3630. aflag = 1, bflag = 0, cvalue = (null)
  3631. Non-option argument arg1
  3632. % testopt -c foo arg1
  3633. aflag = 0, bflag = 0, cvalue = foo
  3634. Non-option argument arg1
  3635. % testopt -a -- -b
  3636. aflag = 1, bflag = 0, cvalue = (null)
  3637. Non-option argument -b
  3638. % testopt -a -
  3639. aflag = 1, bflag = 0, cvalue = (null)
  3640. Non-option argument -
  3641. 
  3642. File: libc.info, Node: Getopt Long Options, Next: Getopt Long Option Example, Prev: Example of Getopt, Up: Getopt
  3643. 26.2.3 Parsing Long Options with ‘getopt_long’
  3644. ----------------------------------------------
  3645. To accept GNU-style long options as well as single-character options,
  3646. use ‘getopt_long’ instead of ‘getopt’. This function is declared in
  3647. ‘getopt.h’, not ‘unistd.h’. You should make every program accept long
  3648. options if it uses any options, for this takes little extra work and
  3649. helps beginners remember how to use the program.
  3650. -- Data Type: struct option
  3651. This structure describes a single long option name for the sake of
  3652. ‘getopt_long’. The argument LONGOPTS must be an array of these
  3653. structures, one for each long option. Terminate the array with an
  3654. element containing all zeros.
  3655. The ‘struct option’ structure has these fields:
  3656. ‘const char *name’
  3657. This field is the name of the option. It is a string.
  3658. ‘int has_arg’
  3659. This field says whether the option takes an argument. It is
  3660. an integer, and there are three legitimate values:
  3661. ‘no_argument’, ‘required_argument’ and ‘optional_argument’.
  3662. ‘int *flag’
  3663. ‘int val’
  3664. These fields control how to report or act on the option when
  3665. it occurs.
  3666. If ‘flag’ is a null pointer, then the ‘val’ is a value which
  3667. identifies this option. Often these values are chosen to
  3668. uniquely identify particular long options.
  3669. If ‘flag’ is not a null pointer, it should be the address of
  3670. an ‘int’ variable which is the flag for this option. The
  3671. value in ‘val’ is the value to store in the flag to indicate
  3672. that the option was seen.
  3673. -- Function: int getopt_long (int ARGC, char *const *ARGV, const char
  3674. *SHORTOPTS, const struct option *LONGOPTS, int *INDEXPTR)
  3675. Preliminary: | MT-Unsafe race:getopt env | AS-Unsafe heap i18n lock
  3676. corrupt | AC-Unsafe mem lock corrupt | *Note POSIX Safety
  3677. Concepts::.
  3678. Decode options from the vector ARGV (whose length is ARGC). The
  3679. argument SHORTOPTS describes the short options to accept, just as
  3680. it does in ‘getopt’. The argument LONGOPTS describes the long
  3681. options to accept (see above).
  3682. When ‘getopt_long’ encounters a short option, it does the same
  3683. thing that ‘getopt’ would do: it returns the character code for the
  3684. option, and stores the option's argument (if it has one) in
  3685. ‘optarg’.
  3686. When ‘getopt_long’ encounters a long option, it takes actions based
  3687. on the ‘flag’ and ‘val’ fields of the definition of that option.
  3688. The option name may be abbreviated as long as the abbreviation is
  3689. unique.
  3690. If ‘flag’ is a null pointer, then ‘getopt_long’ returns the
  3691. contents of ‘val’ to indicate which option it found. You should
  3692. arrange distinct values in the ‘val’ field for options with
  3693. different meanings, so you can decode these values after
  3694. ‘getopt_long’ returns. If the long option is equivalent to a short
  3695. option, you can use the short option's character code in ‘val’.
  3696. If ‘flag’ is not a null pointer, that means this option should just
  3697. set a flag in the program. The flag is a variable of type ‘int’
  3698. that you define. Put the address of the flag in the ‘flag’ field.
  3699. Put in the ‘val’ field the value you would like this option to
  3700. store in the flag. In this case, ‘getopt_long’ returns ‘0’.
  3701. For any long option, ‘getopt_long’ tells you the index in the array
  3702. LONGOPTS of the options definition, by storing it into ‘*INDEXPTR’.
  3703. You can get the name of the option with ‘LONGOPTS[*INDEXPTR].name’.
  3704. So you can distinguish among long options either by the values in
  3705. their ‘val’ fields or by their indices. You can also distinguish
  3706. in this way among long options that set flags.
  3707. When a long option has an argument, ‘getopt_long’ puts the argument
  3708. value in the variable ‘optarg’ before returning. When the option
  3709. has no argument, the value in ‘optarg’ is a null pointer. This is
  3710. how you can tell whether an optional argument was supplied.
  3711. When ‘getopt_long’ has no more options to handle, it returns ‘-1’,
  3712. and leaves in the variable ‘optind’ the index in ARGV of the next
  3713. remaining argument.
  3714. Since long option names were used before ‘getopt_long’ was invented
  3715. there are program interfaces which require programs to recognize options
  3716. like ‘-option value’ instead of ‘--option value’. To enable these
  3717. programs to use the GNU getopt functionality there is one more function
  3718. available.
  3719. -- Function: int getopt_long_only (int ARGC, char *const *ARGV, const
  3720. char *SHORTOPTS, const struct option *LONGOPTS, int *INDEXPTR)
  3721. Preliminary: | MT-Unsafe race:getopt env | AS-Unsafe heap i18n lock
  3722. corrupt | AC-Unsafe mem lock corrupt | *Note POSIX Safety
  3723. Concepts::.
  3724. The ‘getopt_long_only’ function is equivalent to the ‘getopt_long’
  3725. function but it allows the user of the application to pass long
  3726. options with only ‘-’ instead of ‘--’. The ‘--’ prefix is still
  3727. recognized but instead of looking through the short options if a
  3728. ‘-’ is seen it is first tried whether this parameter names a long
  3729. option. If not, it is parsed as a short option. In case both
  3730. short and long options could be matched (this can happen with
  3731. single letter long options), the short option is preferred (with
  3732. some caveats). For long options, abbreviations are detected as
  3733. well.
  3734. Assuming ‘getopt_long_only’ is used starting an application with
  3735. app -foo
  3736. the ‘getopt_long_only’ will first look for a long option named
  3737. ‘foo’. If this is not found, the short options ‘f’, ‘o’, and again
  3738. ‘o’ are recognized.
  3739. It gets more interesting with single letter long options. If we
  3740. define options in the following way
  3741. static struct option long_options[] = {
  3742. {"f", no_argument, 0, 0 },
  3743. {"foo", no_argument, 0, 0 },
  3744. {0, 0, 0, 0 },
  3745. };
  3746. use ‘"f"’ (as a C string) as an option string and start the
  3747. application with ‘-f’, the short option will be matched. ‘--f’
  3748. will match the long one. And both ‘-fo’ and ‘-foo’ will match the
  3749. long option ‘"foo"’.
  3750. Be aware that if the option string would be ‘"f:"’ (thus the short
  3751. option requires an argument), using just ‘-f’ leads to an error.
  3752. But using ‘-fo’ results in the long option being matched. For
  3753. passing an argument in this situation, you need to do it as two
  3754. arguments (‘-f’, ‘o’). Though any other value would work in a
  3755. single argument (e.g., ‘-f1’), since it would not match a long
  3756. option (or its abbreviation).
  3757. 
  3758. File: libc.info, Node: Getopt Long Option Example, Prev: Getopt Long Options, Up: Getopt
  3759. 26.2.4 Example of Parsing Long Options with ‘getopt_long’
  3760. ---------------------------------------------------------
  3761. #include <stdio.h>
  3762. #include <stdlib.h>
  3763. #include <getopt.h>
  3764. /* Flag set by ‘--verbose’. */
  3765. static int verbose_flag;
  3766. int
  3767. main (int argc, char **argv)
  3768. {
  3769. int c;
  3770. while (1)
  3771. {
  3772. static struct option long_options[] =
  3773. {
  3774. /* These options set a flag. */
  3775. {"verbose", no_argument, &verbose_flag, 1},
  3776. {"brief", no_argument, &verbose_flag, 0},
  3777. /* These options don't set a flag.
  3778. We distinguish them by their indices. */
  3779. {"add", no_argument, 0, 'a'},
  3780. {"append", no_argument, 0, 'b'},
  3781. {"delete", required_argument, 0, 'd'},
  3782. {"create", required_argument, 0, 'c'},
  3783. {"file", required_argument, 0, 'f'},
  3784. {0, 0, 0, 0}
  3785. };
  3786. /* ‘getopt_long’ stores the option index here. */
  3787. int option_index = 0;
  3788. c = getopt_long (argc, argv, "abc:d:f:",
  3789. long_options, &option_index);
  3790. /* Detect the end of the options. */
  3791. if (c == -1)
  3792. break;
  3793. switch (c)
  3794. {
  3795. case 0:
  3796. /* If this option set a flag, do nothing else now. */
  3797. if (long_options[option_index].flag != 0)
  3798. break;
  3799. printf ("option %s", long_options[option_index].name);
  3800. if (optarg)
  3801. printf (" with arg %s", optarg);
  3802. printf ("\n");
  3803. break;
  3804. case 'a':
  3805. puts ("option -a");
  3806. break;
  3807. case 'b':
  3808. puts ("option -b");
  3809. break;
  3810. case 'c':
  3811. printf ("option -c with value '%s'\n", optarg);
  3812. break;
  3813. case 'd':
  3814. printf ("option -d with value '%s'\n", optarg);
  3815. break;
  3816. case 'f':
  3817. printf ("option -f with value '%s'\n", optarg);
  3818. break;
  3819. case '?':
  3820. /* ‘getopt_long’ already printed an error message. */
  3821. break;
  3822. default:
  3823. abort ();
  3824. }
  3825. }
  3826. /* Instead of reporting ‘--verbose’
  3827. and ‘--brief’ as they are encountered,
  3828. we report the final status resulting from them. */
  3829. if (verbose_flag)
  3830. puts ("verbose flag is set");
  3831. /* Print any remaining command line arguments (not options). */
  3832. if (optind < argc)
  3833. {
  3834. printf ("non-option ARGV-elements: ");
  3835. while (optind < argc)
  3836. printf ("%s ", argv[optind++]);
  3837. putchar ('\n');
  3838. }
  3839. exit (0);
  3840. }
  3841. 
  3842. File: libc.info, Node: Argp, Next: Suboptions, Prev: Getopt, Up: Parsing Program Arguments
  3843. 26.3 Parsing Program Options with Argp
  3844. ======================================
  3845. “Argp” is an interface for parsing unix-style argument vectors. *Note
  3846. Program Arguments::.
  3847. Argp provides features unavailable in the more commonly used ‘getopt’
  3848. interface. These features include automatically producing output in
  3849. response to the ‘--help’ and ‘--version’ options, as described in the
  3850. GNU coding standards. Using argp makes it less likely that programmers
  3851. will neglect to implement these additional options or keep them up to
  3852. date.
  3853. Argp also provides the ability to merge several independently defined
  3854. option parsers into one, mediating conflicts between them and making the
  3855. result appear seamless. A library can export an argp option parser that
  3856. user programs might employ in conjunction with their own option parsers,
  3857. resulting in less work for the user programs. Some programs may use
  3858. only argument parsers exported by libraries, thereby achieving
  3859. consistent and efficient option-parsing for abstractions implemented by
  3860. the libraries.
  3861. The header file ‘<argp.h>’ should be included to use argp.
  3862. 26.3.1 The ‘argp_parse’ Function
  3863. --------------------------------
  3864. The main interface to argp is the ‘argp_parse’ function. In many cases,
  3865. calling ‘argp_parse’ is the only argument-parsing code needed in ‘main’.
  3866. *Note Program Arguments::.
  3867. -- Function: error_t argp_parse (const struct argp *ARGP, int ARGC,
  3868. char **ARGV, unsigned FLAGS, int *ARG_INDEX, void *INPUT)
  3869. Preliminary: | MT-Unsafe race:argpbuf locale env | AS-Unsafe heap
  3870. i18n lock corrupt | AC-Unsafe mem lock corrupt | *Note POSIX Safety
  3871. Concepts::.
  3872. The ‘argp_parse’ function parses the arguments in ARGV, of length
  3873. ARGC, using the argp parser ARGP. *Note Argp Parsers::. Passing a
  3874. null pointer for ARGP is the same as using a ‘struct argp’
  3875. containing all zeros.
  3876. FLAGS is a set of flag bits that modify the parsing behavior.
  3877. *Note Argp Flags::. INPUT is passed through to the argp parser
  3878. ARGP, and has meaning defined by ARGP. A typical usage is to pass
  3879. a pointer to a structure which is used for specifying parameters to
  3880. the parser and passing back the results.
  3881. Unless the ‘ARGP_NO_EXIT’ or ‘ARGP_NO_HELP’ flags are included in
  3882. FLAGS, calling ‘argp_parse’ may result in the program exiting.
  3883. This behavior is true if an error is detected, or when an unknown
  3884. option is encountered. *Note Program Termination::.
  3885. If ARG_INDEX is non-null, the index of the first unparsed option in
  3886. ARGV is returned as a value.
  3887. The return value is zero for successful parsing, or an error code
  3888. (*note Error Codes::) if an error is detected. Different argp
  3889. parsers may return arbitrary error codes, but the standard error
  3890. codes are: ‘ENOMEM’ if a memory allocation error occurred, or
  3891. ‘EINVAL’ if an unknown option or option argument is encountered.
  3892. * Menu:
  3893. * Globals: Argp Global Variables. Global argp parameters.
  3894. * Parsers: Argp Parsers. Defining parsers for use with ‘argp_parse’.
  3895. * Flags: Argp Flags. Flags that modify the behavior of ‘argp_parse’.
  3896. * Help: Argp Help. Printing help messages when not parsing.
  3897. * Examples: Argp Examples. Simple examples of programs using argp.
  3898. * Customization: Argp User Customization.
  3899. Users may control the ‘--help’ output format.
  3900. 
  3901. File: libc.info, Node: Argp Global Variables, Next: Argp Parsers, Up: Argp
  3902. 26.3.2 Argp Global Variables
  3903. ----------------------------
  3904. These variables make it easy for user programs to implement the
  3905. ‘--version’ option and provide a bug-reporting address in the ‘--help’
  3906. output. These are implemented in argp by default.
  3907. -- Variable: const char * argp_program_version
  3908. If defined or set by the user program to a non-zero value, then a
  3909. ‘--version’ option is added when parsing with ‘argp_parse’, which
  3910. will print the ‘--version’ string followed by a newline and exit.
  3911. The exception to this is if the ‘ARGP_NO_EXIT’ flag is used.
  3912. -- Variable: const char * argp_program_bug_address
  3913. If defined or set by the user program to a non-zero value,
  3914. ‘argp_program_bug_address’ should point to a string that will be
  3915. printed at the end of the standard output for the ‘--help’ option,
  3916. embedded in a sentence that says ‘Report bugs to ADDRESS.’.
  3917. -- Variable: argp_program_version_hook
  3918. If defined or set by the user program to a non-zero value, a
  3919. ‘--version’ option is added when parsing with ‘arg_parse’, which
  3920. prints the program version and exits with a status of zero. This
  3921. is not the case if the ‘ARGP_NO_HELP’ flag is used. If the
  3922. ‘ARGP_NO_EXIT’ flag is set, the exit behavior of the program is
  3923. suppressed or modified, as when the argp parser is going to be used
  3924. by other programs.
  3925. It should point to a function with this type of signature:
  3926. void PRINT-VERSION (FILE *STREAM, struct argp_state *STATE)
  3927. *Note Argp Parsing State::, for an explanation of STATE.
  3928. This variable takes precedence over ‘argp_program_version’, and is
  3929. useful if a program has version information not easily expressed in
  3930. a simple string.
  3931. -- Variable: error_t argp_err_exit_status
  3932. This is the exit status used when argp exits due to a parsing
  3933. error. If not defined or set by the user program, this defaults
  3934. to: ‘EX_USAGE’ from ‘<sysexits.h>’.
  3935. 
  3936. File: libc.info, Node: Argp Parsers, Next: Argp Flags, Prev: Argp Global Variables, Up: Argp
  3937. 26.3.3 Specifying Argp Parsers
  3938. ------------------------------
  3939. The first argument to the ‘argp_parse’ function is a pointer to a
  3940. ‘struct argp’, which is known as an “argp parser”:
  3941. -- Data Type: struct argp
  3942. This structure specifies how to parse a given set of options and
  3943. arguments, perhaps in conjunction with other argp parsers. It has
  3944. the following fields:
  3945. ‘const struct argp_option *options’
  3946. A pointer to a vector of ‘argp_option’ structures specifying
  3947. which options this argp parser understands; it may be zero if
  3948. there are no options at all. *Note Argp Option Vectors::.
  3949. ‘argp_parser_t parser’
  3950. A pointer to a function that defines actions for this parser;
  3951. it is called for each option parsed, and at other well-defined
  3952. points in the parsing process. A value of zero is the same as
  3953. a pointer to a function that always returns
  3954. ‘ARGP_ERR_UNKNOWN’. *Note Argp Parser Functions::.
  3955. ‘const char *args_doc’
  3956. If non-zero, a string describing what non-option arguments are
  3957. called by this parser. This is only used to print the
  3958. ‘Usage:’ message. If it contains newlines, the strings
  3959. separated by them are considered alternative usage patterns
  3960. and printed on separate lines. Lines after the first are
  3961. prefixed by ‘ or: ’ instead of ‘Usage:’.
  3962. ‘const char *doc’
  3963. If non-zero, a string containing extra text to be printed
  3964. before and after the options in a long help message, with the
  3965. two sections separated by a vertical tab (‘'\v'’, ‘'\013'’)
  3966. character. By convention, the documentation before the
  3967. options is just a short string explaining what the program
  3968. does. Documentation printed after the options describe
  3969. behavior in more detail.
  3970. ‘const struct argp_child *children’
  3971. A pointer to a vector of ‘argp_child’ structures. This
  3972. pointer specifies which additional argp parsers should be
  3973. combined with this one. *Note Argp Children::.
  3974. ‘char *(*help_filter)(int KEY, const char *TEXT, void *INPUT)’
  3975. If non-zero, a pointer to a function that filters the output
  3976. of help messages. *Note Argp Help Filtering::.
  3977. ‘const char *argp_domain’
  3978. If non-zero, the strings used in the argp library are
  3979. translated using the domain described by this string. If
  3980. zero, the current default domain is used.
  3981. Of the above group, ‘options’, ‘parser’, ‘args_doc’, and the ‘doc’
  3982. fields are usually all that are needed. If an argp parser is defined as
  3983. an initialized C variable, only the fields used need be specified in the
  3984. initializer. The rest will default to zero due to the way C structure
  3985. initialization works. This design is exploited in most argp structures;
  3986. the most-used fields are grouped near the beginning, the unused fields
  3987. left unspecified.
  3988. * Menu:
  3989. * Options: Argp Option Vectors. Specifying options in an argp parser.
  3990. * Argp Parser Functions:: Defining actions for an argp parser.
  3991. * Children: Argp Children. Combining multiple argp parsers.
  3992. * Help Filtering: Argp Help Filtering. Customizing help output for an argp parser.
  3993. 
  3994. File: libc.info, Node: Argp Option Vectors, Next: Argp Parser Functions, Prev: Argp Parsers, Up: Argp Parsers
  3995. 26.3.4 Specifying Options in an Argp Parser
  3996. -------------------------------------------
  3997. The ‘options’ field in a ‘struct argp’ points to a vector of ‘struct
  3998. argp_option’ structures, each of which specifies an option that the argp
  3999. parser supports. Multiple entries may be used for a single option
  4000. provided it has multiple names. This should be terminated by an entry
  4001. with zero in all fields. Note that when using an initialized C array
  4002. for options, writing ‘{ 0 }’ is enough to achieve this.
  4003. -- Data Type: struct argp_option
  4004. This structure specifies a single option that an argp parser
  4005. understands, as well as how to parse and document that option. It
  4006. has the following fields:
  4007. ‘const char *name’
  4008. The long name for this option, corresponding to the long
  4009. option ‘--NAME’; this field may be zero if this option _only_
  4010. has a short name. To specify multiple names for an option,
  4011. additional entries may follow this one, with the
  4012. ‘OPTION_ALIAS’ flag set. *Note Argp Option Flags::.
  4013. ‘int key’
  4014. The integer key provided by the current option to the option
  4015. parser. If KEY has a value that is a printable ASCII
  4016. character (i.e., ‘isascii (KEY)’ is true), it _also_ specifies
  4017. a short option ‘-CHAR’, where CHAR is the ASCII character with
  4018. the code KEY.
  4019. ‘const char *arg’
  4020. If non-zero, this is the name of an argument associated with
  4021. this option, which must be provided (e.g., with the
  4022. ‘--NAME=VALUE’ or ‘-CHAR VALUE’ syntaxes), unless the
  4023. ‘OPTION_ARG_OPTIONAL’ flag (*note Argp Option Flags::) is set,
  4024. in which case it _may_ be provided.
  4025. ‘int flags’
  4026. Flags associated with this option, some of which are referred
  4027. to above. *Note Argp Option Flags::.
  4028. ‘const char *doc’
  4029. A documentation string for this option, for printing in help
  4030. messages.
  4031. If both the ‘name’ and ‘key’ fields are zero, this string will
  4032. be printed tabbed left from the normal option column, making
  4033. it useful as a group header. This will be the first thing
  4034. printed in its group. In this usage, it's conventional to end
  4035. the string with a ‘:’ character.
  4036. ‘int group’
  4037. Group identity for this option.
  4038. In a long help message, options are sorted alphabetically
  4039. within each group, and the groups presented in the order 0, 1,
  4040. 2, ..., N, −M, ..., −2, −1.
  4041. Every entry in an options array with this field 0 will inherit
  4042. the group number of the previous entry, or zero if it's the
  4043. first one. If it's a group header with ‘name’ and ‘key’
  4044. fields both zero, the previous entry + 1 is the default.
  4045. Automagic options such as ‘--help’ are put into group −1.
  4046. Note that because of C structure initialization rules, this
  4047. field often need not be specified, because 0 is the correct
  4048. value.
  4049. * Menu:
  4050. * Flags: Argp Option Flags. Flags for options.
  4051. 
  4052. File: libc.info, Node: Argp Option Flags, Up: Argp Option Vectors
  4053. 26.3.4.1 Flags for Argp Options
  4054. ...............................
  4055. The following flags may be or'd together in the ‘flags’ field of a
  4056. ‘struct argp_option’. These flags control various aspects of how that
  4057. option is parsed or displayed in help messages:
  4058. ‘OPTION_ARG_OPTIONAL’
  4059. The argument associated with this option is optional.
  4060. ‘OPTION_HIDDEN’
  4061. This option isn't displayed in any help messages.
  4062. ‘OPTION_ALIAS’
  4063. This option is an alias for the closest previous non-alias option.
  4064. This means that it will be displayed in the same help entry, and
  4065. will inherit fields other than ‘name’ and ‘key’ from the option
  4066. being aliased.
  4067. ‘OPTION_DOC’
  4068. This option isn't actually an option and should be ignored by the
  4069. actual option parser. It is an arbitrary section of documentation
  4070. that should be displayed in much the same manner as the options.
  4071. This is known as a “documentation option”.
  4072. If this flag is set, then the option ‘name’ field is displayed
  4073. unmodified (e.g., no ‘--’ prefix is added) at the left-margin where
  4074. a _short_ option would normally be displayed, and this
  4075. documentation string is left in its usual place. For purposes of
  4076. sorting, any leading whitespace and punctuation is ignored, unless
  4077. the first non-whitespace character is ‘-’. This entry is displayed
  4078. after all options, after ‘OPTION_DOC’ entries with a leading ‘-’,
  4079. in the same group.
  4080. ‘OPTION_NO_USAGE’
  4081. This option shouldn't be included in 'long' usage messages, but
  4082. should still be included in other help messages. This is intended
  4083. for options that are completely documented in an argp's ‘args_doc’
  4084. field. *Note Argp Parsers::. Including this option in the generic
  4085. usage list would be redundant, and should be avoided.
  4086. For instance, if ‘args_doc’ is ‘"FOO BAR\n-x BLAH"’, and the ‘-x’
  4087. option's purpose is to distinguish these two cases, ‘-x’ should
  4088. probably be marked ‘OPTION_NO_USAGE’.
  4089. 
  4090. File: libc.info, Node: Argp Parser Functions, Next: Argp Children, Prev: Argp Option Vectors, Up: Argp Parsers
  4091. 26.3.5 Argp Parser Functions
  4092. ----------------------------
  4093. The function pointed to by the ‘parser’ field in a ‘struct argp’ (*note
  4094. Argp Parsers::) defines what actions take place in response to each
  4095. option or argument parsed. It is also used as a hook, allowing a parser
  4096. to perform tasks at certain other points during parsing.
  4097. Argp parser functions have the following type signature:
  4098. error_t PARSER (int KEY, char *ARG, struct argp_state *STATE)
  4099. where the arguments are as follows:
  4100. KEY
  4101. For each option that is parsed, PARSER is called with a value of
  4102. KEY from that option's ‘key’ field in the option vector. *Note
  4103. Argp Option Vectors::. PARSER is also called at other times with
  4104. special reserved keys, such as ‘ARGP_KEY_ARG’ for non-option
  4105. arguments. *Note Argp Special Keys::.
  4106. ARG
  4107. If KEY is an option, ARG is its given value. This defaults to zero
  4108. if no value is specified. Only options that have a non-zero ‘arg’
  4109. field can ever have a value. These must _always_ have a value
  4110. unless the ‘OPTION_ARG_OPTIONAL’ flag is specified. If the input
  4111. being parsed specifies a value for an option that doesn't allow
  4112. one, an error results before PARSER ever gets called.
  4113. If KEY is ‘ARGP_KEY_ARG’, ARG is a non-option argument. Other
  4114. special keys always have a zero ARG.
  4115. STATE
  4116. STATE points to a ‘struct argp_state’, containing useful
  4117. information about the current parsing state for use by PARSER.
  4118. *Note Argp Parsing State::.
  4119. When PARSER is called, it should perform whatever action is
  4120. appropriate for KEY, and return ‘0’ for success, ‘ARGP_ERR_UNKNOWN’ if
  4121. the value of KEY is not handled by this parser function, or a unix error
  4122. code if a real error occurred. *Note Error Codes::.
  4123. -- Macro: int ARGP_ERR_UNKNOWN
  4124. Argp parser functions should return ‘ARGP_ERR_UNKNOWN’ for any KEY
  4125. value they do not recognize, or for non-option arguments (‘KEY ==
  4126. ARGP_KEY_ARG’) that they are not equipped to handle.
  4127. A typical parser function uses a switch statement on KEY:
  4128. error_t
  4129. parse_opt (int key, char *arg, struct argp_state *state)
  4130. {
  4131. switch (key)
  4132. {
  4133. case OPTION_KEY:
  4134. ACTION
  4135. break;
  4136. ...
  4137. default:
  4138. return ARGP_ERR_UNKNOWN;
  4139. }
  4140. return 0;
  4141. }
  4142. * Menu:
  4143. * Keys: Argp Special Keys. Special values for the KEY argument.
  4144. * State: Argp Parsing State. What the STATE argument refers to.
  4145. * Functions: Argp Helper Functions. Functions to help during argp parsing.
  4146. 
  4147. File: libc.info, Node: Argp Special Keys, Next: Argp Parsing State, Up: Argp Parser Functions
  4148. 26.3.5.1 Special Keys for Argp Parser Functions
  4149. ...............................................
  4150. In addition to key values corresponding to user options, the KEY
  4151. argument to argp parser functions may have a number of other special
  4152. values. In the following example ARG and STATE refer to parser function
  4153. arguments. *Note Argp Parser Functions::.
  4154. ‘ARGP_KEY_ARG’
  4155. This is not an option at all, but rather a command line argument,
  4156. whose value is pointed to by ARG.
  4157. When there are multiple parser functions in play due to argp
  4158. parsers being combined, it's impossible to know which one will
  4159. handle a specific argument. Each is called until one returns 0 or
  4160. an error other than ‘ARGP_ERR_UNKNOWN’; if an argument is not
  4161. handled, ‘argp_parse’ immediately returns success, without parsing
  4162. any more arguments.
  4163. Once a parser function returns success for this key, that fact is
  4164. recorded, and the ‘ARGP_KEY_NO_ARGS’ case won't be used.
  4165. _However_, if while processing the argument a parser function
  4166. decrements the ‘next’ field of its STATE argument, the option won't
  4167. be considered processed; this is to allow you to actually modify
  4168. the argument, perhaps into an option, and have it processed again.
  4169. ‘ARGP_KEY_ARGS’
  4170. If a parser function returns ‘ARGP_ERR_UNKNOWN’ for ‘ARGP_KEY_ARG’,
  4171. it is immediately called again with the key ‘ARGP_KEY_ARGS’, which
  4172. has a similar meaning, but is slightly more convenient for
  4173. consuming all remaining arguments. ARG is 0, and the tail of the
  4174. argument vector may be found at ‘STATE->argv + STATE->next’. If
  4175. success is returned for this key, and ‘STATE->next’ is unchanged,
  4176. all remaining arguments are considered to have been consumed.
  4177. Otherwise, the amount by which ‘STATE->next’ has been adjusted
  4178. indicates how many were used. Here's an example that uses both,
  4179. for different args:
  4180. ...
  4181. case ARGP_KEY_ARG:
  4182. if (STATE->arg_num == 0)
  4183. /* First argument */
  4184. first_arg = ARG;
  4185. else
  4186. /* Let the next case parse it. */
  4187. return ARGP_KEY_UNKNOWN;
  4188. break;
  4189. case ARGP_KEY_ARGS:
  4190. remaining_args = STATE->argv + STATE->next;
  4191. num_remaining_args = STATE->argc - STATE->next;
  4192. break;
  4193. ‘ARGP_KEY_END’
  4194. This indicates that there are no more command line arguments.
  4195. Parser functions are called in a different order, children first.
  4196. This allows each parser to clean up its state for the parent.
  4197. ‘ARGP_KEY_NO_ARGS’
  4198. Because it's common to do some special processing if there aren't
  4199. any non-option args, parser functions are called with this key if
  4200. they didn't successfully process any non-option arguments. This is
  4201. called just before ‘ARGP_KEY_END’, where more general validity
  4202. checks on previously parsed arguments take place.
  4203. ‘ARGP_KEY_INIT’
  4204. This is passed in before any parsing is done. Afterwards, the
  4205. values of each element of the ‘child_input’ field of STATE, if any,
  4206. are copied to each child's state to be the initial value of the
  4207. ‘input’ when _their_ parsers are called.
  4208. ‘ARGP_KEY_SUCCESS’
  4209. Passed in when parsing has successfully been completed, even if
  4210. arguments remain.
  4211. ‘ARGP_KEY_ERROR’
  4212. Passed in if an error has occurred and parsing is terminated. In
  4213. this case a call with a key of ‘ARGP_KEY_SUCCESS’ is never made.
  4214. ‘ARGP_KEY_FINI’
  4215. The final key ever seen by any parser, even after
  4216. ‘ARGP_KEY_SUCCESS’ and ‘ARGP_KEY_ERROR’. Any resources allocated
  4217. by ‘ARGP_KEY_INIT’ may be freed here. At times, certain resources
  4218. allocated are to be returned to the caller after a successful
  4219. parse. In that case, those particular resources can be freed in
  4220. the ‘ARGP_KEY_ERROR’ case.
  4221. In all cases, ‘ARGP_KEY_INIT’ is the first key seen by parser
  4222. functions, and ‘ARGP_KEY_FINI’ the last, unless an error was returned by
  4223. the parser for ‘ARGP_KEY_INIT’. Other keys can occur in one the
  4224. following orders. OPT refers to an arbitrary option key:
  4225. OPT... ‘ARGP_KEY_NO_ARGS’ ‘ARGP_KEY_END’ ‘ARGP_KEY_SUCCESS’
  4226. The arguments being parsed did not contain any non-option
  4227. arguments.
  4228. ( OPT | ‘ARGP_KEY_ARG’ )... ‘ARGP_KEY_END’ ‘ARGP_KEY_SUCCESS’
  4229. All non-option arguments were successfully handled by a parser
  4230. function. There may be multiple parser functions if multiple argp
  4231. parsers were combined.
  4232. ( OPT | ‘ARGP_KEY_ARG’ )... ‘ARGP_KEY_SUCCESS’
  4233. Some non-option argument went unrecognized.
  4234. This occurs when every parser function returns ‘ARGP_KEY_UNKNOWN’
  4235. for an argument, in which case parsing stops at that argument if
  4236. ARG_INDEX is a null pointer. Otherwise an error occurs.
  4237. In all cases, if a non-null value for ARG_INDEX gets passed to
  4238. ‘argp_parse’, the index of the first unparsed command-line argument is
  4239. passed back in that value.
  4240. If an error occurs and is either detected by argp or because a parser
  4241. function returned an error value, each parser is called with
  4242. ‘ARGP_KEY_ERROR’. No further calls are made, except the final call with
  4243. ‘ARGP_KEY_FINI’.
  4244. 
  4245. File: libc.info, Node: Argp Parsing State, Next: Argp Helper Functions, Prev: Argp Special Keys, Up: Argp Parser Functions
  4246. 26.3.5.2 Argp Parsing State
  4247. ...........................
  4248. The third argument to argp parser functions (*note Argp Parser
  4249. Functions::) is a pointer to a ‘struct argp_state’, which contains
  4250. information about the state of the option parsing.
  4251. -- Data Type: struct argp_state
  4252. This structure has the following fields, which may be modified as
  4253. noted:
  4254. ‘const struct argp *const root_argp’
  4255. The top level argp parser being parsed. Note that this is
  4256. often _not_ the same ‘struct argp’ passed into ‘argp_parse’ by
  4257. the invoking program. *Note Argp::. It is an internal argp
  4258. parser that contains options implemented by ‘argp_parse’
  4259. itself, such as ‘--help’.
  4260. ‘int argc’
  4261. ‘char **argv’
  4262. The argument vector being parsed. This may be modified.
  4263. ‘int next’
  4264. The index in ‘argv’ of the next argument to be parsed. This
  4265. may be modified.
  4266. One way to consume all remaining arguments in the input is to
  4267. set ‘STATE->next = STATE->argc’, perhaps after recording the
  4268. value of the ‘next’ field to find the consumed arguments. The
  4269. current option can be re-parsed immediately by decrementing
  4270. this field, then modifying ‘STATE->argv[STATE->next]’ to
  4271. reflect the option that should be reexamined.
  4272. ‘unsigned flags’
  4273. The flags supplied to ‘argp_parse’. These may be modified,
  4274. although some flags may only take effect when ‘argp_parse’ is
  4275. first invoked. *Note Argp Flags::.
  4276. ‘unsigned arg_num’
  4277. While calling a parsing function with the KEY argument
  4278. ‘ARGP_KEY_ARG’, this represents the number of the current arg,
  4279. starting at 0. It is incremented after each ‘ARGP_KEY_ARG’
  4280. call returns. At all other times, this is the number of
  4281. ‘ARGP_KEY_ARG’ arguments that have been processed.
  4282. ‘int quoted’
  4283. If non-zero, the index in ‘argv’ of the first argument
  4284. following a special ‘--’ argument. This prevents anything
  4285. that follows from being interpreted as an option. It is only
  4286. set after argument parsing has proceeded past this point.
  4287. ‘void *input’
  4288. An arbitrary pointer passed in from the caller of
  4289. ‘argp_parse’, in the INPUT argument.
  4290. ‘void **child_inputs’
  4291. These are values that will be passed to child parsers. This
  4292. vector will be the same length as the number of children in
  4293. the current parser. Each child parser will be given the value
  4294. of ‘STATE->child_inputs[I]’ as _its_ ‘STATE->input’ field,
  4295. where I is the index of the child in the this parser's
  4296. ‘children’ field. *Note Argp Children::.
  4297. ‘void *hook’
  4298. For the parser function's use. Initialized to 0, but
  4299. otherwise ignored by argp.
  4300. ‘char *name’
  4301. The name used when printing messages. This is initialized to
  4302. ‘argv[0]’, or ‘program_invocation_name’ if ‘argv[0]’ is
  4303. unavailable.
  4304. ‘FILE *err_stream’
  4305. ‘FILE *out_stream’
  4306. The stdio streams used when argp prints. Error messages are
  4307. printed to ‘err_stream’, all other output, such as ‘--help’
  4308. output) to ‘out_stream’. These are initialized to ‘stderr’
  4309. and ‘stdout’ respectively. *Note Standard Streams::.
  4310. ‘void *pstate’
  4311. Private, for use by the argp implementation.
  4312. 
  4313. File: libc.info, Node: Argp Helper Functions, Prev: Argp Parsing State, Up: Argp Parser Functions
  4314. 26.3.5.3 Functions For Use in Argp Parsers
  4315. ..........................................
  4316. Argp provides a number of functions available to the user of argp (*note
  4317. Argp Parser Functions::), mostly for producing error messages. These
  4318. take as their first argument the STATE argument to the parser function.
  4319. *Note Argp Parsing State::.
  4320. -- Function: void argp_usage (const struct argp_state *STATE)
  4321. Preliminary: | MT-Unsafe race:argpbuf env locale | AS-Unsafe heap
  4322. i18n corrupt | AC-Unsafe mem corrupt lock | *Note POSIX Safety
  4323. Concepts::.
  4324. Outputs the standard usage message for the argp parser referred to
  4325. by STATE to ‘STATE->err_stream’ and terminates the program with
  4326. ‘exit (argp_err_exit_status)’. *Note Argp Global Variables::.
  4327. -- Function: void argp_error (const struct argp_state *STATE, const
  4328. char *FMT, ...)
  4329. Preliminary: | MT-Unsafe race:argpbuf env locale | AS-Unsafe heap
  4330. i18n corrupt | AC-Unsafe mem corrupt lock | *Note POSIX Safety
  4331. Concepts::.
  4332. Prints the printf format string FMT and following args, preceded by
  4333. the program name and ‘:’, and followed by a ‘Try ... --help’
  4334. message, and terminates the program with an exit status of
  4335. ‘argp_err_exit_status’. *Note Argp Global Variables::.
  4336. -- Function: void argp_failure (const struct argp_state *STATE, int
  4337. STATUS, int ERRNUM, const char *FMT, ...)
  4338. Preliminary: | MT-Safe | AS-Unsafe corrupt heap | AC-Unsafe lock
  4339. corrupt mem | *Note POSIX Safety Concepts::.
  4340. Similar to the standard GNU error-reporting function ‘error’, this
  4341. prints the program name and ‘:’, the printf format string FMT, and
  4342. the appropriate following args. If it is non-zero, the standard
  4343. unix error text for ERRNUM is printed. If STATUS is non-zero, it
  4344. terminates the program with that value as its exit status.
  4345. The difference between ‘argp_failure’ and ‘argp_error’ is that
  4346. ‘argp_error’ is for _parsing errors_, whereas ‘argp_failure’ is for
  4347. other problems that occur during parsing but don't reflect a
  4348. syntactic problem with the input, such as illegal values for
  4349. options, bad phase of the moon, etc.
  4350. -- Function: void argp_state_help (const struct argp_state *STATE, FILE
  4351. *STREAM, unsigned FLAGS)
  4352. Preliminary: | MT-Unsafe race:argpbuf env locale | AS-Unsafe heap
  4353. i18n corrupt | AC-Unsafe mem corrupt lock | *Note POSIX Safety
  4354. Concepts::.
  4355. Outputs a help message for the argp parser referred to by STATE, to
  4356. STREAM. The FLAGS argument determines what sort of help message is
  4357. produced. *Note Argp Help Flags::.
  4358. Error output is sent to ‘STATE->err_stream’, and the program name
  4359. printed is ‘STATE->name’.
  4360. The output or program termination behavior of these functions may be
  4361. suppressed if the ‘ARGP_NO_EXIT’ or ‘ARGP_NO_ERRS’ flags are passed to
  4362. ‘argp_parse’. *Note Argp Flags::.
  4363. This behavior is useful if an argp parser is exported for use by
  4364. other programs (e.g., by a library), and may be used in a context where
  4365. it is not desirable to terminate the program in response to parsing
  4366. errors. In argp parsers intended for such general use, and for the case
  4367. where the program _doesn't_ terminate, calls to any of these functions
  4368. should be followed by code that returns the appropriate error code:
  4369. if (BAD ARGUMENT SYNTAX)
  4370. {
  4371. argp_usage (STATE);
  4372. return EINVAL;
  4373. }
  4374. If a parser function will _only_ be used when ‘ARGP_NO_EXIT’ is not set,
  4375. the return may be omitted.
  4376. 
  4377. File: libc.info, Node: Argp Children, Next: Argp Help Filtering, Prev: Argp Parser Functions, Up: Argp Parsers
  4378. 26.3.6 Combining Multiple Argp Parsers
  4379. --------------------------------------
  4380. The ‘children’ field in a ‘struct argp’ enables other argp parsers to be
  4381. combined with the referencing one for the parsing of a single set of
  4382. arguments. This field should point to a vector of ‘struct argp_child’,
  4383. which is terminated by an entry having a value of zero in the ‘argp’
  4384. field.
  4385. Where conflicts between combined parsers arise, as when two specify
  4386. an option with the same name, the parser conflicts are resolved in favor
  4387. of the parent argp parser(s), or the earlier of the argp parsers in the
  4388. list of children.
  4389. -- Data Type: struct argp_child
  4390. An entry in the list of subsidiary argp parsers pointed to by the
  4391. ‘children’ field in a ‘struct argp’. The fields are as follows:
  4392. ‘const struct argp *argp’
  4393. The child argp parser, or zero to end of the list.
  4394. ‘int flags’
  4395. Flags for this child.
  4396. ‘const char *header’
  4397. If non-zero, this is an optional header to be printed within
  4398. help output before the child options. As a side-effect, a
  4399. non-zero value forces the child options to be grouped
  4400. together. To achieve this effect without actually printing a
  4401. header string, use a value of ‘""’. As with header strings
  4402. specified in an option entry, the conventional value of the
  4403. last character is ‘:’. *Note Argp Option Vectors::.
  4404. ‘int group’
  4405. This is where the child options are grouped relative to the
  4406. other 'consolidated' options in the parent argp parser. The
  4407. values are the same as the ‘group’ field in ‘struct
  4408. argp_option’. *Note Argp Option Vectors::. All
  4409. child-groupings follow parent options at a particular group
  4410. level. If both this field and ‘header’ are zero, then the
  4411. child's options aren't grouped together, they are merged with
  4412. parent options at the parent option group level.
  4413. 
  4414. File: libc.info, Node: Argp Flags, Next: Argp Help, Prev: Argp Parsers, Up: Argp
  4415. 26.3.7 Flags for ‘argp_parse’
  4416. -----------------------------
  4417. The default behavior of ‘argp_parse’ is designed to be convenient for
  4418. the most common case of parsing program command line argument. To
  4419. modify these defaults, the following flags may be or'd together in the
  4420. FLAGS argument to ‘argp_parse’:
  4421. ‘ARGP_PARSE_ARGV0’
  4422. Don't ignore the first element of the ARGV argument to
  4423. ‘argp_parse’. Unless ‘ARGP_NO_ERRS’ is set, the first element of
  4424. the argument vector is skipped for option parsing purposes, as it
  4425. corresponds to the program name in a command line.
  4426. ‘ARGP_NO_ERRS’
  4427. Don't print error messages for unknown options to ‘stderr’; unless
  4428. this flag is set, ‘ARGP_PARSE_ARGV0’ is ignored, as ‘argv[0]’ is
  4429. used as the program name in the error messages. This flag implies
  4430. ‘ARGP_NO_EXIT’. This is based on the assumption that silent
  4431. exiting upon errors is bad behavior.
  4432. ‘ARGP_NO_ARGS’
  4433. Don't parse any non-option args. Normally these are parsed by
  4434. calling the parse functions with a key of ‘ARGP_KEY_ARG’, the
  4435. actual argument being the value. This flag needn't normally be
  4436. set, as the default behavior is to stop parsing as soon as an
  4437. argument fails to be parsed. *Note Argp Parser Functions::.
  4438. ‘ARGP_IN_ORDER’
  4439. Parse options and arguments in the same order they occur on the
  4440. command line. Normally they're rearranged so that all options come
  4441. first.
  4442. ‘ARGP_NO_HELP’
  4443. Don't provide the standard long option ‘--help’, which ordinarily
  4444. causes usage and option help information to be output to ‘stdout’
  4445. and ‘exit (0)’.
  4446. ‘ARGP_NO_EXIT’
  4447. Don't exit on errors, although they may still result in error
  4448. messages.
  4449. ‘ARGP_LONG_ONLY’
  4450. Use the GNU getopt 'long-only' rules for parsing arguments. This
  4451. allows long-options to be recognized with only a single ‘-’ (i.e.,
  4452. ‘-help’). This results in a less useful interface, and its use is
  4453. discouraged as it conflicts with the way most GNU programs work as
  4454. well as the GNU coding standards.
  4455. ‘ARGP_SILENT’
  4456. Turns off any message-printing/exiting options, specifically
  4457. ‘ARGP_NO_EXIT’, ‘ARGP_NO_ERRS’, and ‘ARGP_NO_HELP’.
  4458. 
  4459. File: libc.info, Node: Argp Help Filtering, Prev: Argp Children, Up: Argp Parsers
  4460. 26.3.8 Customizing Argp Help Output
  4461. -----------------------------------
  4462. The ‘help_filter’ field in a ‘struct argp’ is a pointer to a function
  4463. that filters the text of help messages before displaying them. They
  4464. have a function signature like:
  4465. char *HELP-FILTER (int KEY, const char *TEXT, void *INPUT)
  4466. Where KEY is either a key from an option, in which case TEXT is that
  4467. option's help text. *Note Argp Option Vectors::. Alternately, one of
  4468. the special keys with names beginning with ‘ARGP_KEY_HELP_’ might be
  4469. used, describing which other help text TEXT will contain. *Note Argp
  4470. Help Filter Keys::.
  4471. The function should return either TEXT if it remains as-is, or a
  4472. replacement string allocated using ‘malloc’. This will be either be
  4473. freed by argp or zero, which prints nothing. The value of TEXT is
  4474. supplied _after_ any translation has been done, so if any of the
  4475. replacement text needs translation, it will be done by the filter
  4476. function. INPUT is either the input supplied to ‘argp_parse’ or it is
  4477. zero, if ‘argp_help’ was called directly by the user.
  4478. * Menu:
  4479. * Keys: Argp Help Filter Keys. Special KEY values for help filter functions.
  4480. 
  4481. File: libc.info, Node: Argp Help Filter Keys, Up: Argp Help Filtering
  4482. 26.3.8.1 Special Keys for Argp Help Filter Functions
  4483. ....................................................
  4484. The following special values may be passed to an argp help filter
  4485. function as the first argument in addition to key values for user
  4486. options. They specify which help text the TEXT argument contains:
  4487. ‘ARGP_KEY_HELP_PRE_DOC’
  4488. The help text preceding options.
  4489. ‘ARGP_KEY_HELP_POST_DOC’
  4490. The help text following options.
  4491. ‘ARGP_KEY_HELP_HEADER’
  4492. The option header string.
  4493. ‘ARGP_KEY_HELP_EXTRA’
  4494. This is used after all other documentation; TEXT is zero for this
  4495. key.
  4496. ‘ARGP_KEY_HELP_DUP_ARGS_NOTE’
  4497. The explanatory note printed when duplicate option arguments have
  4498. been suppressed.
  4499. ‘ARGP_KEY_HELP_ARGS_DOC’
  4500. The argument doc string; formally the ‘args_doc’ field from the
  4501. argp parser. *Note Argp Parsers::.
  4502. 
  4503. File: libc.info, Node: Argp Help, Next: Argp Examples, Prev: Argp Flags, Up: Argp
  4504. 26.3.9 The ‘argp_help’ Function
  4505. -------------------------------
  4506. Normally programs using argp need not be written with particular
  4507. printing argument-usage-type help messages in mind as the standard
  4508. ‘--help’ option is handled automatically by argp. Typical error cases
  4509. can be handled using ‘argp_usage’ and ‘argp_error’. *Note Argp Helper
  4510. Functions::. However, if it's desirable to print a help message in some
  4511. context other than parsing the program options, argp offers the
  4512. ‘argp_help’ interface.
  4513. -- Function: void argp_help (const struct argp *ARGP, FILE *STREAM,
  4514. unsigned FLAGS, char *NAME)
  4515. Preliminary: | MT-Unsafe race:argpbuf env locale | AS-Unsafe heap
  4516. i18n corrupt | AC-Unsafe mem corrupt lock | *Note POSIX Safety
  4517. Concepts::.
  4518. This outputs a help message for the argp parser ARGP to STREAM.
  4519. The type of messages printed will be determined by FLAGS.
  4520. Any options such as ‘--help’ that are implemented automatically by
  4521. argp itself will _not_ be present in the help output; for this
  4522. reason it is best to use ‘argp_state_help’ if calling from within
  4523. an argp parser function. *Note Argp Helper Functions::.
  4524. * Menu:
  4525. * Flags: Argp Help Flags. Specifying what sort of help message to print.
  4526. 
  4527. File: libc.info, Node: Argp Help Flags, Up: Argp Help
  4528. 26.3.10 Flags for the ‘argp_help’ Function
  4529. ------------------------------------------
  4530. When calling ‘argp_help’ (*note Argp Help::) or ‘argp_state_help’ (*note
  4531. Argp Helper Functions::) the exact output is determined by the FLAGS
  4532. argument. This should consist of any of the following flags, or'd
  4533. together:
  4534. ‘ARGP_HELP_USAGE’
  4535. A unix ‘Usage:’ message that explicitly lists all options.
  4536. ‘ARGP_HELP_SHORT_USAGE’
  4537. A unix ‘Usage:’ message that displays an appropriate placeholder to
  4538. indicate where the options go; useful for showing the non-option
  4539. argument syntax.
  4540. ‘ARGP_HELP_SEE’
  4541. A ‘Try ... for more help’ message; ‘...’ contains the program name
  4542. and ‘--help’.
  4543. ‘ARGP_HELP_LONG’
  4544. A verbose option help message that gives each option available
  4545. along with its documentation string.
  4546. ‘ARGP_HELP_PRE_DOC’
  4547. The part of the argp parser doc string preceding the verbose option
  4548. help.
  4549. ‘ARGP_HELP_POST_DOC’
  4550. The part of the argp parser doc string that following the verbose
  4551. option help.
  4552. ‘ARGP_HELP_DOC’
  4553. ‘(ARGP_HELP_PRE_DOC | ARGP_HELP_POST_DOC)’
  4554. ‘ARGP_HELP_BUG_ADDR’
  4555. A message that prints where to report bugs for this program, if the
  4556. ‘argp_program_bug_address’ variable contains this information.
  4557. ‘ARGP_HELP_LONG_ONLY’
  4558. This will modify any output to reflect the ‘ARGP_LONG_ONLY’ mode.
  4559. The following flags are only understood when used with
  4560. ‘argp_state_help’. They control whether the function returns after
  4561. printing its output, or terminates the program:
  4562. ‘ARGP_HELP_EXIT_ERR’
  4563. This will terminate the program with ‘exit (argp_err_exit_status)’.
  4564. ‘ARGP_HELP_EXIT_OK’
  4565. This will terminate the program with ‘exit (0)’.
  4566. The following flags are combinations of the basic flags for printing
  4567. standard messages:
  4568. ‘ARGP_HELP_STD_ERR’
  4569. Assuming that an error message for a parsing error has printed,
  4570. this prints a message on how to get help, and terminates the
  4571. program with an error.
  4572. ‘ARGP_HELP_STD_USAGE’
  4573. This prints a standard usage message and terminates the program
  4574. with an error. This is used when no other specific error messages
  4575. are appropriate or available.
  4576. ‘ARGP_HELP_STD_HELP’
  4577. This prints the standard response for a ‘--help’ option, and
  4578. terminates the program successfully.
  4579. 
  4580. File: libc.info, Node: Argp Examples, Next: Argp User Customization, Prev: Argp Help, Up: Argp
  4581. 26.3.11 Argp Examples
  4582. ---------------------
  4583. These example programs demonstrate the basic usage of argp.
  4584. * Menu:
  4585. * 1: Argp Example 1. A minimal program using argp.
  4586. * 2: Argp Example 2. A program using only default options.
  4587. * 3: Argp Example 3. A simple program with user options.
  4588. * 4: Argp Example 4. Combining multiple argp parsers.
  4589. 
  4590. File: libc.info, Node: Argp Example 1, Next: Argp Example 2, Up: Argp Examples
  4591. 26.3.11.1 A Minimal Program Using Argp
  4592. ......................................
  4593. This is perhaps the smallest program possible that uses argp. It won't
  4594. do much except give an error message and exit when there are any
  4595. arguments, and prints a rather pointless message for ‘--help’.
  4596. /* This is (probably) the smallest possible program that
  4597. uses argp. It won't do much except give an error
  4598. messages and exit when there are any arguments, and print
  4599. a (rather pointless) messages for -help. */
  4600. #include <stdlib.h>
  4601. #include <argp.h>
  4602. int
  4603. main (int argc, char **argv)
  4604. {
  4605. argp_parse (0, argc, argv, 0, 0, 0);
  4606. exit (0);
  4607. }
  4608. 
  4609. File: libc.info, Node: Argp Example 2, Next: Argp Example 3, Prev: Argp Example 1, Up: Argp Examples
  4610. 26.3.11.2 A Program Using Argp with Only Default Options
  4611. ........................................................
  4612. This program doesn't use any options or arguments, it uses argp to be
  4613. compliant with the GNU standard command line format.
  4614. In addition to giving no arguments and implementing a ‘--help’
  4615. option, this example has a ‘--version’ option, which will put the given
  4616. documentation string and bug address in the ‘--help’ output, as per GNU
  4617. standards.
  4618. The variable ‘argp’ contains the argument parser specification.
  4619. Adding fields to this structure is the way most parameters are passed to
  4620. ‘argp_parse’. The first three fields are normally used, but they are
  4621. not in this small program. There are also two global variables that
  4622. argp can use defined here, ‘argp_program_version’ and
  4623. ‘argp_program_bug_address’. They are considered global variables
  4624. because they will almost always be constant for a given program, even if
  4625. they use different argument parsers for various tasks.
  4626. /* This program doesn't use any options or arguments, but uses
  4627. argp to be compliant with the GNU standard command line
  4628. format.
  4629. In addition to making sure no arguments are given, and
  4630. implementing a -help option, this example will have a
  4631. -version option, and will put the given documentation string
  4632. and bug address in the -help output, as per GNU standards.
  4633. The variable ARGP contains the argument parser specification;
  4634. adding fields to this structure is the way most parameters are
  4635. passed to argp_parse (the first three fields are usually used,
  4636. but not in this small program). There are also two global
  4637. variables that argp knows about defined here,
  4638. ARGP_PROGRAM_VERSION and ARGP_PROGRAM_BUG_ADDRESS (they are
  4639. global variables because they will almost always be constant
  4640. for a given program, even if it uses different argument
  4641. parsers for various tasks). */
  4642. #include <stdlib.h>
  4643. #include <argp.h>
  4644. const char *argp_program_version =
  4645. "argp-ex2 1.0";
  4646. const char *argp_program_bug_address =
  4647. "<bug-gnu-utils@gnu.org>";
  4648. /* Program documentation. */
  4649. static char doc[] =
  4650. "Argp example #2 -- a pretty minimal program using argp";
  4651. /* Our argument parser. The ‘options’, ‘parser’, and
  4652. ‘args_doc’ fields are zero because we have neither options or
  4653. arguments; ‘doc’ and ‘argp_program_bug_address’ will be
  4654. used in the output for ‘--help’, and the ‘--version’
  4655. option will print out ‘argp_program_version’. */
  4656. static struct argp argp = { 0, 0, 0, doc };
  4657. int
  4658. main (int argc, char **argv)
  4659. {
  4660. argp_parse (&argp, argc, argv, 0, 0, 0);
  4661. exit (0);
  4662. }
  4663. 
  4664. File: libc.info, Node: Argp Example 3, Next: Argp Example 4, Prev: Argp Example 2, Up: Argp Examples
  4665. 26.3.11.3 A Program Using Argp with User Options
  4666. ................................................
  4667. This program uses the same features as example 2, adding user options
  4668. and arguments.
  4669. We now use the first four fields in ‘argp’ (*note Argp Parsers::) and
  4670. specify ‘parse_opt’ as the parser function. *Note Argp Parser
  4671. Functions::.
  4672. Note that in this example, ‘main’ uses a structure to communicate
  4673. with the ‘parse_opt’ function, a pointer to which it passes in the
  4674. ‘input’ argument to ‘argp_parse’. *Note Argp::. It is retrieved by
  4675. ‘parse_opt’ through the ‘input’ field in its ‘state’ argument. *Note
  4676. Argp Parsing State::. Of course, it's also possible to use global
  4677. variables instead, but using a structure like this is somewhat more
  4678. flexible and clean.
  4679. /* This program uses the same features as example 2, and uses options and
  4680. arguments.
  4681. We now use the first four fields in ARGP, so here's a description of them:
  4682. OPTIONS - A pointer to a vector of struct argp_option (see below)
  4683. PARSER - A function to parse a single option, called by argp
  4684. ARGS_DOC - A string describing how the non-option arguments should look
  4685. DOC - A descriptive string about this program; if it contains a
  4686. vertical tab character (\v), the part after it will be
  4687. printed *following* the options
  4688. The function PARSER takes the following arguments:
  4689. KEY - An integer specifying which option this is (taken
  4690. from the KEY field in each struct argp_option), or
  4691. a special key specifying something else; the only
  4692. special keys we use here are ARGP_KEY_ARG, meaning
  4693. a non-option argument, and ARGP_KEY_END, meaning
  4694. that all arguments have been parsed
  4695. ARG - For an option KEY, the string value of its
  4696. argument, or NULL if it has none
  4697. STATE- A pointer to a struct argp_state, containing
  4698. various useful information about the parsing state; used here
  4699. are the INPUT field, which reflects the INPUT argument to
  4700. argp_parse, and the ARG_NUM field, which is the number of the
  4701. current non-option argument being parsed
  4702. It should return either 0, meaning success, ARGP_ERR_UNKNOWN, meaning the
  4703. given KEY wasn't recognized, or an errno value indicating some other
  4704. error.
  4705. Note that in this example, main uses a structure to communicate with the
  4706. parse_opt function, a pointer to which it passes in the INPUT argument to
  4707. argp_parse. Of course, it's also possible to use global variables
  4708. instead, but this is somewhat more flexible.
  4709. The OPTIONS field contains a pointer to a vector of struct argp_option's;
  4710. that structure has the following fields (if you assign your option
  4711. structures using array initialization like this example, unspecified
  4712. fields will be defaulted to 0, and need not be specified):
  4713. NAME - The name of this option's long option (may be zero)
  4714. KEY - The KEY to pass to the PARSER function when parsing this option,
  4715. *and* the name of this option's short option, if it is a
  4716. printable ascii character
  4717. ARG - The name of this option's argument, if any
  4718. FLAGS - Flags describing this option; some of them are:
  4719. OPTION_ARG_OPTIONAL - The argument to this option is optional
  4720. OPTION_ALIAS - This option is an alias for the
  4721. previous option
  4722. OPTION_HIDDEN - Don't show this option in -help output
  4723. DOC - A documentation string for this option, shown in -help output
  4724. An options vector should be terminated by an option with all fields zero. */
  4725. #include <stdlib.h>
  4726. #include <argp.h>
  4727. const char *argp_program_version =
  4728. "argp-ex3 1.0";
  4729. const char *argp_program_bug_address =
  4730. "<bug-gnu-utils@gnu.org>";
  4731. /* Program documentation. */
  4732. static char doc[] =
  4733. "Argp example #3 -- a program with options and arguments using argp";
  4734. /* A description of the arguments we accept. */
  4735. static char args_doc[] = "ARG1 ARG2";
  4736. /* The options we understand. */
  4737. static struct argp_option options[] = {
  4738. {"verbose", 'v', 0, 0, "Produce verbose output" },
  4739. {"quiet", 'q', 0, 0, "Don't produce any output" },
  4740. {"silent", 's', 0, OPTION_ALIAS },
  4741. {"output", 'o', "FILE", 0,
  4742. "Output to FILE instead of standard output" },
  4743. { 0 }
  4744. };
  4745. /* Used by ‘main’ to communicate with ‘parse_opt’. */
  4746. struct arguments
  4747. {
  4748. char *args[2]; /* ARG1 & ARG2 */
  4749. int silent, verbose;
  4750. char *output_file;
  4751. };
  4752. /* Parse a single option. */
  4753. static error_t
  4754. parse_opt (int key, char *arg, struct argp_state *state)
  4755. {
  4756. /* Get the INPUT argument from ‘argp_parse’, which we
  4757. know is a pointer to our arguments structure. */
  4758. struct arguments *arguments = state->input;
  4759. switch (key)
  4760. {
  4761. case 'q': case 's':
  4762. arguments->silent = 1;
  4763. break;
  4764. case 'v':
  4765. arguments->verbose = 1;
  4766. break;
  4767. case 'o':
  4768. arguments->output_file = arg;
  4769. break;
  4770. case ARGP_KEY_ARG:
  4771. if (state->arg_num >= 2)
  4772. /* Too many arguments. */
  4773. argp_usage (state);
  4774. arguments->args[state->arg_num] = arg;
  4775. break;
  4776. case ARGP_KEY_END:
  4777. if (state->arg_num < 2)
  4778. /* Not enough arguments. */
  4779. argp_usage (state);
  4780. break;
  4781. default:
  4782. return ARGP_ERR_UNKNOWN;
  4783. }
  4784. return 0;
  4785. }
  4786. /* Our argp parser. */
  4787. static struct argp argp = { options, parse_opt, args_doc, doc };
  4788. int
  4789. main (int argc, char **argv)
  4790. {
  4791. struct arguments arguments;
  4792. /* Default values. */
  4793. arguments.silent = 0;
  4794. arguments.verbose = 0;
  4795. arguments.output_file = "-";
  4796. /* Parse our arguments; every option seen by ‘parse_opt’ will
  4797. be reflected in ‘arguments’. */
  4798. argp_parse (&argp, argc, argv, 0, 0, &arguments);
  4799. printf ("ARG1 = %s\nARG2 = %s\nOUTPUT_FILE = %s\n"
  4800. "VERBOSE = %s\nSILENT = %s\n",
  4801. arguments.args[0], arguments.args[1],
  4802. arguments.output_file,
  4803. arguments.verbose ? "yes" : "no",
  4804. arguments.silent ? "yes" : "no");
  4805. exit (0);
  4806. }
  4807. 
  4808. File: libc.info, Node: Argp Example 4, Prev: Argp Example 3, Up: Argp Examples
  4809. 26.3.11.4 A Program Using Multiple Combined Argp Parsers
  4810. ........................................................
  4811. This program uses the same features as example 3, but has more options,
  4812. and presents more structure in the ‘--help’ output. It also illustrates
  4813. how you can 'steal' the remainder of the input arguments past a certain
  4814. point for programs that accept a list of items. It also illustrates the
  4815. KEY value ‘ARGP_KEY_NO_ARGS’, which is only given if no non-option
  4816. arguments were supplied to the program. *Note Argp Special Keys::.
  4817. For structuring help output, two features are used: _headers_ and a
  4818. two part option string. The _headers_ are entries in the options
  4819. vector. *Note Argp Option Vectors::. The first four fields are zero.
  4820. The two part documentation string are in the variable ‘doc’, which
  4821. allows documentation both before and after the options. *Note Argp
  4822. Parsers::, the two parts of ‘doc’ are separated by a vertical-tab
  4823. character (‘'\v'’, or ‘'\013'’). By convention, the documentation
  4824. before the options is a short string stating what the program does, and
  4825. after any options it is longer, describing the behavior in more detail.
  4826. All documentation strings are automatically filled for output, although
  4827. newlines may be included to force a line break at a particular point.
  4828. In addition, documentation strings are passed to the ‘gettext’ function,
  4829. for possible translation into the current locale.
  4830. /* This program uses the same features as example 3, but has more
  4831. options, and somewhat more structure in the -help output. It
  4832. also shows how you can 'steal' the remainder of the input
  4833. arguments past a certain point, for programs that accept a
  4834. list of items. It also shows the special argp KEY value
  4835. ARGP_KEY_NO_ARGS, which is only given if no non-option
  4836. arguments were supplied to the program.
  4837. For structuring the help output, two features are used,
  4838. *headers* which are entries in the options vector with the
  4839. first four fields being zero, and a two part documentation
  4840. string (in the variable DOC), which allows documentation both
  4841. before and after the options; the two parts of DOC are
  4842. separated by a vertical-tab character ('\v', or '\013'). By
  4843. convention, the documentation before the options is just a
  4844. short string saying what the program does, and that afterwards
  4845. is longer, describing the behavior in more detail. All
  4846. documentation strings are automatically filled for output,
  4847. although newlines may be included to force a line break at a
  4848. particular point. All documentation strings are also passed to
  4849. the 'gettext' function, for possible translation into the
  4850. current locale. */
  4851. #include <stdlib.h>
  4852. #include <error.h>
  4853. #include <argp.h>
  4854. const char *argp_program_version =
  4855. "argp-ex4 1.0";
  4856. const char *argp_program_bug_address =
  4857. "<bug-gnu-utils@prep.ai.mit.edu>";
  4858. /* Program documentation. */
  4859. static char doc[] =
  4860. "Argp example #4 -- a program with somewhat more complicated\
  4861. options\
  4862. \vThis part of the documentation comes *after* the options;\
  4863. note that the text is automatically filled, but it's possible\
  4864. to force a line-break, e.g.\n<-- here.";
  4865. /* A description of the arguments we accept. */
  4866. static char args_doc[] = "ARG1 [STRING...]";
  4867. /* Keys for options without short-options. */
  4868. #define OPT_ABORT 1 /* -abort */
  4869. /* The options we understand. */
  4870. static struct argp_option options[] = {
  4871. {"verbose", 'v', 0, 0, "Produce verbose output" },
  4872. {"quiet", 'q', 0, 0, "Don't produce any output" },
  4873. {"silent", 's', 0, OPTION_ALIAS },
  4874. {"output", 'o', "FILE", 0,
  4875. "Output to FILE instead of standard output" },
  4876. {0,0,0,0, "The following options should be grouped together:" },
  4877. {"repeat", 'r', "COUNT", OPTION_ARG_OPTIONAL,
  4878. "Repeat the output COUNT (default 10) times"},
  4879. {"abort", OPT_ABORT, 0, 0, "Abort before showing any output"},
  4880. { 0 }
  4881. };
  4882. /* Used by ‘main’ to communicate with ‘parse_opt’. */
  4883. struct arguments
  4884. {
  4885. char *arg1; /* ARG1 */
  4886. char **strings; /* [STRING...] */
  4887. int silent, verbose, abort; /* ‘-s’, ‘-v’, ‘--abort’ */
  4888. char *output_file; /* FILE arg to ‘--output’ */
  4889. int repeat_count; /* COUNT arg to ‘--repeat’ */
  4890. };
  4891. /* Parse a single option. */
  4892. static error_t
  4893. parse_opt (int key, char *arg, struct argp_state *state)
  4894. {
  4895. /* Get the ‘input’ argument from ‘argp_parse’, which we
  4896. know is a pointer to our arguments structure. */
  4897. struct arguments *arguments = state->input;
  4898. switch (key)
  4899. {
  4900. case 'q': case 's':
  4901. arguments->silent = 1;
  4902. break;
  4903. case 'v':
  4904. arguments->verbose = 1;
  4905. break;
  4906. case 'o':
  4907. arguments->output_file = arg;
  4908. break;
  4909. case 'r':
  4910. arguments->repeat_count = arg ? atoi (arg) : 10;
  4911. break;
  4912. case OPT_ABORT:
  4913. arguments->abort = 1;
  4914. break;
  4915. case ARGP_KEY_NO_ARGS:
  4916. argp_usage (state);
  4917. case ARGP_KEY_ARG:
  4918. /* Here we know that ‘state->arg_num == 0’, since we
  4919. force argument parsing to end before any more arguments can
  4920. get here. */
  4921. arguments->arg1 = arg;
  4922. /* Now we consume all the rest of the arguments.
  4923. ‘state->next’ is the index in ‘state->argv’ of the
  4924. next argument to be parsed, which is the first STRING
  4925. we're interested in, so we can just use
  4926. ‘&state->argv[state->next]’ as the value for
  4927. arguments->strings.
  4928. _In addition_, by setting ‘state->next’ to the end
  4929. of the arguments, we can force argp to stop parsing here and
  4930. return. */
  4931. arguments->strings = &state->argv[state->next];
  4932. state->next = state->argc;
  4933. break;
  4934. default:
  4935. return ARGP_ERR_UNKNOWN;
  4936. }
  4937. return 0;
  4938. }
  4939. /* Our argp parser. */
  4940. static struct argp argp = { options, parse_opt, args_doc, doc };
  4941. int
  4942. main (int argc, char **argv)
  4943. {
  4944. int i, j;
  4945. struct arguments arguments;
  4946. /* Default values. */
  4947. arguments.silent = 0;
  4948. arguments.verbose = 0;
  4949. arguments.output_file = "-";
  4950. arguments.repeat_count = 1;
  4951. arguments.abort = 0;
  4952. /* Parse our arguments; every option seen by ‘parse_opt’ will be
  4953. reflected in ‘arguments’. */
  4954. argp_parse (&argp, argc, argv, 0, 0, &arguments);
  4955. if (arguments.abort)
  4956. error (10, 0, "ABORTED");
  4957. for (i = 0; i < arguments.repeat_count; i++)
  4958. {
  4959. printf ("ARG1 = %s\n", arguments.arg1);
  4960. printf ("STRINGS = ");
  4961. for (j = 0; arguments.strings[j]; j++)
  4962. printf (j == 0 ? "%s" : ", %s", arguments.strings[j]);
  4963. printf ("\n");
  4964. printf ("OUTPUT_FILE = %s\nVERBOSE = %s\nSILENT = %s\n",
  4965. arguments.output_file,
  4966. arguments.verbose ? "yes" : "no",
  4967. arguments.silent ? "yes" : "no");
  4968. }
  4969. exit (0);
  4970. }
  4971. 
  4972. File: libc.info, Node: Argp User Customization, Prev: Argp Examples, Up: Argp
  4973. 26.3.12 Argp User Customization
  4974. -------------------------------
  4975. The formatting of argp ‘--help’ output may be controlled to some extent
  4976. by a program's users, by setting the ‘ARGP_HELP_FMT’ environment
  4977. variable to a comma-separated list of tokens. Whitespace is ignored:
  4978. ‘dup-args’
  4979. ‘no-dup-args’
  4980. These turn “duplicate-argument-mode” on or off. In duplicate
  4981. argument mode, if an option that accepts an argument has multiple
  4982. names, the argument is shown for each name. Otherwise, it is only
  4983. shown for the first long option. A note is subsequently printed so
  4984. the user knows that it applies to other names as well. The default
  4985. is ‘no-dup-args’, which is less consistent, but prettier.
  4986. ‘dup-args-note’
  4987. ‘no-dup-args-note’
  4988. These will enable or disable the note informing the user of
  4989. suppressed option argument duplication. The default is
  4990. ‘dup-args-note’.
  4991. ‘short-opt-col=N’
  4992. This prints the first short option in column N. The default is 2.
  4993. ‘long-opt-col=N’
  4994. This prints the first long option in column N. The default is 6.
  4995. ‘doc-opt-col=N’
  4996. This prints 'documentation options' (*note Argp Option Flags::) in
  4997. column N. The default is 2.
  4998. ‘opt-doc-col=N’
  4999. This prints the documentation for options starting in column N.
  5000. The default is 29.
  5001. ‘header-col=N’
  5002. This will indent the group headers that document groups of options
  5003. to column N. The default is 1.
  5004. ‘usage-indent=N’
  5005. This will indent continuation lines in ‘Usage:’ messages to column
  5006. N. The default is 12.
  5007. ‘rmargin=N’
  5008. This will word wrap help output at or before column N. The default
  5009. is 79.
  5010. 
  5011. File: libc.info, Node: Suboptions, Next: Suboptions Example, Prev: Argp, Up: Parsing Program Arguments
  5012. 26.3.12.1 Parsing of Suboptions
  5013. ...............................
  5014. Having a single level of options is sometimes not enough. There might
  5015. be too many options which have to be available or a set of options is
  5016. closely related.
  5017. For this case some programs use suboptions. One of the most
  5018. prominent programs is certainly ‘mount’(8). The ‘-o’ option take one
  5019. argument which itself is a comma separated list of options. To ease the
  5020. programming of code like this the function ‘getsubopt’ is available.
  5021. -- Function: int getsubopt (char **restrict OPTIONP, char *const
  5022. *restrict TOKENS, char **restrict VALUEP)
  5023. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5024. Concepts::.
  5025. The OPTIONP parameter must be a pointer to a variable containing
  5026. the address of the string to process. When the function returns,
  5027. the reference is updated to point to the next suboption or to the
  5028. terminating ‘\0’ character if there are no more suboptions
  5029. available.
  5030. The TOKENS parameter references an array of strings containing the
  5031. known suboptions. All strings must be ‘\0’ terminated and to mark
  5032. the end a null pointer must be stored. When ‘getsubopt’ finds a
  5033. possible legal suboption it compares it with all strings available
  5034. in the TOKENS array and returns the index in the string as the
  5035. indicator.
  5036. In case the suboption has an associated value introduced by a ‘=’
  5037. character, a pointer to the value is returned in VALUEP. The
  5038. string is ‘\0’ terminated. If no argument is available VALUEP is
  5039. set to the null pointer. By doing this the caller can check
  5040. whether a necessary value is given or whether no unexpected value
  5041. is present.
  5042. In case the next suboption in the string is not mentioned in the
  5043. TOKENS array the starting address of the suboption including a
  5044. possible value is returned in VALUEP and the return value of the
  5045. function is ‘-1’.
  5046. 
  5047. File: libc.info, Node: Suboptions Example, Prev: Suboptions, Up: Parsing Program Arguments
  5048. 26.3.13 Parsing of Suboptions Example
  5049. -------------------------------------
  5050. The code which might appear in the ‘mount’(8) program is a perfect
  5051. example of the use of ‘getsubopt’:
  5052. #include <stdio.h>
  5053. #include <stdlib.h>
  5054. #include <unistd.h>
  5055. int do_all;
  5056. const char *type;
  5057. int read_size;
  5058. int write_size;
  5059. int read_only;
  5060. enum
  5061. {
  5062. RO_OPTION = 0,
  5063. RW_OPTION,
  5064. READ_SIZE_OPTION,
  5065. WRITE_SIZE_OPTION,
  5066. THE_END
  5067. };
  5068. const char *mount_opts[] =
  5069. {
  5070. [RO_OPTION] = "ro",
  5071. [RW_OPTION] = "rw",
  5072. [READ_SIZE_OPTION] = "rsize",
  5073. [WRITE_SIZE_OPTION] = "wsize",
  5074. [THE_END] = NULL
  5075. };
  5076. int
  5077. main (int argc, char **argv)
  5078. {
  5079. char *subopts, *value;
  5080. int opt;
  5081. while ((opt = getopt (argc, argv, "at:o:")) != -1)
  5082. switch (opt)
  5083. {
  5084. case 'a':
  5085. do_all = 1;
  5086. break;
  5087. case 't':
  5088. type = optarg;
  5089. break;
  5090. case 'o':
  5091. subopts = optarg;
  5092. while (*subopts != '\0')
  5093. switch (getsubopt (&subopts, (char * const *) mount_opts, &value))
  5094. {
  5095. case RO_OPTION:
  5096. read_only = 1;
  5097. break;
  5098. case RW_OPTION:
  5099. read_only = 0;
  5100. break;
  5101. case READ_SIZE_OPTION:
  5102. if (value == NULL)
  5103. abort ();
  5104. read_size = atoi (value);
  5105. break;
  5106. case WRITE_SIZE_OPTION:
  5107. if (value == NULL)
  5108. abort ();
  5109. write_size = atoi (value);
  5110. break;
  5111. default:
  5112. /* Unknown suboption. */
  5113. printf ("Unknown suboption `%s'\n", value);
  5114. break;
  5115. }
  5116. break;
  5117. default:
  5118. abort ();
  5119. }
  5120. /* Do the real work. */
  5121. return 0;
  5122. }
  5123. 
  5124. File: libc.info, Node: Environment Variables, Next: Auxiliary Vector, Prev: Program Arguments, Up: Program Basics
  5125. 26.4 Environment Variables
  5126. ==========================
  5127. When a program is executed, it receives information about the context in
  5128. which it was invoked in two ways. The first mechanism uses the ARGV and
  5129. ARGC arguments to its ‘main’ function, and is discussed in *note Program
  5130. Arguments::. The second mechanism uses “environment variables” and is
  5131. discussed in this section.
  5132. The ARGV mechanism is typically used to pass command-line arguments
  5133. specific to the particular program being invoked. The environment, on
  5134. the other hand, keeps track of information that is shared by many
  5135. programs, changes infrequently, and that is less frequently used.
  5136. The environment variables discussed in this section are the same
  5137. environment variables that you set using assignments and the ‘export’
  5138. command in the shell. Programs executed from the shell inherit all of
  5139. the environment variables from the shell.
  5140. Standard environment variables are used for information about the
  5141. user's home directory, terminal type, current locale, and so on; you can
  5142. define additional variables for other purposes. The set of all
  5143. environment variables that have values is collectively known as the
  5144. “environment”.
  5145. Names of environment variables are case-sensitive and must not
  5146. contain the character ‘=’. System-defined environment variables are
  5147. invariably uppercase.
  5148. The values of environment variables can be anything that can be
  5149. represented as a string. A value must not contain an embedded null
  5150. character, since this is assumed to terminate the string.
  5151. * Menu:
  5152. * Environment Access:: How to get and set the values of
  5153. environment variables.
  5154. * Standard Environment:: These environment variables have
  5155. standard interpretations.
  5156. 
  5157. File: libc.info, Node: Environment Access, Next: Standard Environment, Up: Environment Variables
  5158. 26.4.1 Environment Access
  5159. -------------------------
  5160. The value of an environment variable can be accessed with the ‘getenv’
  5161. function. This is declared in the header file ‘stdlib.h’.
  5162. Libraries should use ‘secure_getenv’ instead of ‘getenv’, so that
  5163. they do not accidentally use untrusted environment variables.
  5164. Modifications of environment variables are not allowed in multi-threaded
  5165. programs. The ‘getenv’ and ‘secure_getenv’ functions can be safely used
  5166. in multi-threaded programs.
  5167. -- Function: char * getenv (const char *NAME)
  5168. Preliminary: | MT-Safe env | AS-Safe | AC-Safe | *Note POSIX Safety
  5169. Concepts::.
  5170. This function returns a string that is the value of the environment
  5171. variable NAME. You must not modify this string. In some non-Unix
  5172. systems not using the GNU C Library, it might be overwritten by
  5173. subsequent calls to ‘getenv’ (but not by any other library
  5174. function). If the environment variable NAME is not defined, the
  5175. value is a null pointer.
  5176. -- Function: char * secure_getenv (const char *NAME)
  5177. Preliminary: | MT-Safe env | AS-Safe | AC-Safe | *Note POSIX Safety
  5178. Concepts::.
  5179. This function is similar to ‘getenv’, but it returns a null pointer
  5180. if the environment is untrusted. This happens when the program
  5181. file has SUID or SGID bits set. General-purpose libraries should
  5182. always prefer this function over ‘getenv’ to avoid vulnerabilities
  5183. if the library is referenced from a SUID/SGID program.
  5184. This function was originally a GNU extension, but was added in
  5185. POSIX.1-2024.
  5186. -- Function: int putenv (char *STRING)
  5187. Preliminary: | MT-Unsafe const:env | AS-Unsafe heap lock |
  5188. AC-Unsafe corrupt lock mem | *Note POSIX Safety Concepts::.
  5189. The ‘putenv’ function adds or removes definitions from the
  5190. environment. If the STRING is of the form ‘NAME=VALUE’, the
  5191. definition is added to the environment. Otherwise, the STRING is
  5192. interpreted as the name of an environment variable, and any
  5193. definition for this variable in the environment is removed.
  5194. If the function is successful it returns ‘0’. Otherwise the return
  5195. value is nonzero and ‘errno’ is set to indicate the error.
  5196. The difference to the ‘setenv’ function is that the exact string
  5197. given as the parameter STRING is put into the environment. If the
  5198. user should change the string after the ‘putenv’ call this will
  5199. reflect automatically in the environment. This also requires that
  5200. STRING not be an automatic variable whose scope is left before the
  5201. variable is removed from the environment. The same applies of
  5202. course to dynamically allocated variables which are freed later.
  5203. This function is part of the extended Unix interface. You should
  5204. define _XOPEN_SOURCE before including any header.
  5205. -- Function: int setenv (const char *NAME, const char *VALUE, int
  5206. REPLACE)
  5207. Preliminary: | MT-Unsafe const:env | AS-Unsafe heap lock |
  5208. AC-Unsafe corrupt lock mem | *Note POSIX Safety Concepts::.
  5209. The ‘setenv’ function can be used to add a new definition to the
  5210. environment. The entry with the name NAME is replaced by the value
  5211. ‘NAME=VALUE’. Please note that this is also true if VALUE is the
  5212. empty string. To do this a new string is created and the strings
  5213. NAME and VALUE are copied. A null pointer for the VALUE parameter
  5214. is illegal. If the environment already contains an entry with key
  5215. NAME the REPLACE parameter controls the action. If replace is
  5216. zero, nothing happens. Otherwise the old entry is replaced by the
  5217. new one.
  5218. Please note that you cannot remove an entry completely using this
  5219. function.
  5220. If the function is successful it returns ‘0’. Otherwise the
  5221. environment is unchanged and the return value is ‘-1’ and ‘errno’
  5222. is set.
  5223. This function was originally part of the BSD library but is now
  5224. part of the Unix standard.
  5225. -- Function: int unsetenv (const char *NAME)
  5226. Preliminary: | MT-Unsafe const:env | AS-Unsafe lock | AC-Unsafe
  5227. lock | *Note POSIX Safety Concepts::.
  5228. Using this function one can remove an entry completely from the
  5229. environment. If the environment contains an entry with the key
  5230. NAME this whole entry is removed. A call to this function is
  5231. equivalent to a call to ‘putenv’ when the VALUE part of the string
  5232. is empty.
  5233. The function returns ‘-1’ if NAME is a null pointer, points to an
  5234. empty string, or points to a string containing a ‘=’ character. It
  5235. returns ‘0’ if the call succeeded.
  5236. This function was originally part of the BSD library but is now
  5237. part of the Unix standard. The BSD version had no return value,
  5238. though.
  5239. There is one more function to modify the whole environment. This
  5240. function is said to be used in the POSIX.9 (POSIX bindings for Fortran
  5241. 77) and so one should expect it did made it into POSIX.1. But this
  5242. never happened. But we still provide this function as a GNU extension
  5243. to enable writing standard compliant Fortran environments.
  5244. -- Function: int clearenv (void)
  5245. Preliminary: | MT-Unsafe const:env | AS-Unsafe heap lock |
  5246. AC-Unsafe lock mem | *Note POSIX Safety Concepts::.
  5247. The ‘clearenv’ function removes all entries from the environment.
  5248. Using ‘putenv’ and ‘setenv’ new entries can be added again later.
  5249. If the function is successful it returns ‘0’. Otherwise the return
  5250. value is nonzero.
  5251. You can deal directly with the underlying representation of
  5252. environment objects to add more variables to the environment (for
  5253. example, to communicate with another program you are about to execute;
  5254. *note Executing a File::).
  5255. -- Variable: char ** environ
  5256. The environment is represented as an array of strings. Each string
  5257. is of the format ‘NAME=VALUE’. The order in which strings appear
  5258. in the environment is not significant, but the same NAME must not
  5259. appear more than once. The last element of the array is a null
  5260. pointer.
  5261. This variable is declared in the header file ‘unistd.h’.
  5262. If you just want to get the value of an environment variable, use
  5263. ‘getenv’.
  5264. Unix systems, and GNU systems, pass the initial value of ‘environ’ as
  5265. the third argument to ‘main’. *Note Program Arguments::.
  5266. 
  5267. File: libc.info, Node: Standard Environment, Prev: Environment Access, Up: Environment Variables
  5268. 26.4.2 Standard Environment Variables
  5269. -------------------------------------
  5270. These environment variables have standard meanings. This doesn't mean
  5271. that they are always present in the environment; but if these variables
  5272. _are_ present, they have these meanings. You shouldn't try to use these
  5273. environment variable names for some other purpose.
  5274. ‘HOME’
  5275. This is a string representing the user's “home directory”, or
  5276. initial default working directory.
  5277. The user can set ‘HOME’ to any value. If you need to make sure to
  5278. obtain the proper home directory for a particular user, you should
  5279. not use ‘HOME’; instead, look up the user's name in the user
  5280. database (*note User Database::).
  5281. For most purposes, it is better to use ‘HOME’, precisely because
  5282. this lets the user specify the value.
  5283. ‘LOGNAME’
  5284. This is the name that the user used to log in. Since the value in
  5285. the environment can be tweaked arbitrarily, this is not a reliable
  5286. way to identify the user who is running a program; a function like
  5287. ‘getlogin’ (*note Who Logged In::) is better for that purpose.
  5288. For most purposes, it is better to use ‘LOGNAME’, precisely because
  5289. this lets the user specify the value.
  5290. ‘PATH’
  5291. A “path” is a sequence of directory names which is used for
  5292. searching for a file. The variable ‘PATH’ holds a path used for
  5293. searching for programs to be run.
  5294. The ‘execlp’ and ‘execvp’ functions (*note Executing a File::) use
  5295. this environment variable, as do many shells and other utilities
  5296. which are implemented in terms of those functions.
  5297. The syntax of a path is a sequence of directory names separated by
  5298. colons. An empty string instead of a directory name stands for the
  5299. current directory (*note Working Directory::).
  5300. A typical value for this environment variable might be a string
  5301. like:
  5302. :/bin:/etc:/usr/bin:/usr/new/X11:/usr/new:/usr/local/bin
  5303. This means that if the user tries to execute a program named ‘foo’,
  5304. the system will look for files named ‘foo’, ‘/bin/foo’, ‘/etc/foo’,
  5305. and so on. The first of these files that exists is the one that is
  5306. executed.
  5307. ‘TERM’
  5308. This specifies the kind of terminal that is receiving program
  5309. output. Some programs can make use of this information to take
  5310. advantage of special escape sequences or terminal modes supported
  5311. by particular kinds of terminals. Many programs which use the
  5312. termcap library (*note Find: (termcap)Finding a Terminal
  5313. Description.) use the ‘TERM’ environment variable, for example.
  5314. ‘TZ’
  5315. This specifies the time zone ruleset. *Note TZ Variable::.
  5316. ‘LANG’
  5317. This specifies the default locale to use for attribute categories
  5318. where neither ‘LC_ALL’ nor the specific environment variable for
  5319. that category is set. *Note Locales::, for more information about
  5320. locales.
  5321. ‘LC_ALL’
  5322. If this environment variable is set it overrides the selection for
  5323. all the locales done using the other ‘LC_*’ environment variables.
  5324. The value of the other ‘LC_*’ environment variables is simply
  5325. ignored in this case.
  5326. ‘LC_COLLATE’
  5327. This specifies what locale to use for string sorting.
  5328. ‘LC_CTYPE’
  5329. This specifies what locale to use for character sets and character
  5330. classification.
  5331. ‘LC_MESSAGES’
  5332. This specifies what locale to use for printing messages and to
  5333. parse responses.
  5334. ‘LC_MONETARY’
  5335. This specifies what locale to use for formatting monetary values.
  5336. ‘LC_NUMERIC’
  5337. This specifies what locale to use for formatting numbers.
  5338. ‘LC_TIME’
  5339. This specifies what locale to use for formatting date/time values.
  5340. ‘NLSPATH’
  5341. This specifies the directories in which the ‘catopen’ function
  5342. looks for message translation catalogs.
  5343. ‘_POSIX_OPTION_ORDER’
  5344. If this environment variable is defined, it suppresses the usual
  5345. reordering of command line arguments by ‘getopt’ and ‘argp_parse’.
  5346. *Note Argument Syntax::.
  5347. 
  5348. File: libc.info, Node: Auxiliary Vector, Next: System Calls, Prev: Environment Variables, Up: Program Basics
  5349. 26.5 Auxiliary Vector
  5350. =====================
  5351. When a program is executed, it receives information from the operating
  5352. system about the environment in which it is operating. The form of this
  5353. information is a table of key-value pairs, where the keys are from the
  5354. set of ‘AT_’ values in ‘elf.h’. Some of the data is provided by the
  5355. kernel for libc consumption, and may be obtained by ordinary interfaces,
  5356. such as ‘sysconf’. However, on a platform-by-platform basis there may
  5357. be information that is not available any other way.
  5358. 26.5.1 Definition of ‘getauxval’
  5359. --------------------------------
  5360. -- Function: unsigned long int getauxval (unsigned long int TYPE)
  5361. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5362. Concepts::.
  5363. This function is used to inquire about the entries in the auxiliary
  5364. vector. The TYPE argument should be one of the ‘AT_’ symbols
  5365. defined in ‘elf.h’. If a matching entry is found, the value is
  5366. returned; if the entry is not found, zero is returned and ‘errno’
  5367. is set to ‘ENOENT’.
  5368. *Note:* There is no relationship between the ‘AT_’ constants
  5369. defined in ‘elf.h’ and the file name lookup flags in ‘fcntl.h’.
  5370. *Note Descriptor-Relative Access::.
  5371. For some platforms, the key ‘AT_HWCAP’ is the easiest way to inquire
  5372. about any instruction set extensions available at runtime. In this
  5373. case, there will (of necessity) be a platform-specific set of ‘HWCAP_’
  5374. values masked together that describe the capabilities of the cpu on
  5375. which the program is being executed.
  5376. 
  5377. File: libc.info, Node: System Calls, Next: Program Termination, Prev: Auxiliary Vector, Up: Program Basics
  5378. 26.6 System Calls
  5379. =================
  5380. A system call is a request for service that a program makes of the
  5381. kernel. The service is generally something that only the kernel has the
  5382. privilege to do, such as doing I/O. Programmers don't normally need to
  5383. be concerned with system calls because there are functions in the GNU C
  5384. Library to do virtually everything that system calls do. These
  5385. functions work by making system calls themselves. For example, there is
  5386. a system call that changes the permissions of a file, but you don't need
  5387. to know about it because you can just use the GNU C Library's ‘chmod’
  5388. function.
  5389. System calls are sometimes called syscalls or kernel calls, and this
  5390. interface is mostly a purely mechanical translation from the kernel's
  5391. ABI to the C ABI. For the set of syscalls where we do not guarantee
  5392. POSIX Thread cancellation the wrappers only organize the incoming
  5393. arguments from the C calling convention to the calling convention of the
  5394. target kernel. For the set of syscalls where we provided POSIX Thread
  5395. cancellation the wrappers set some internal state in the library to
  5396. support cancellation, but this does not impact the behaviour of the
  5397. syscall provided by the kernel.
  5398. In some cases, if the GNU C Library detects that a system call has
  5399. been superseded by a more capable one, the wrapper may map the old call
  5400. to the new one. For example, ‘dup2’ is implemented via ‘dup3’ by
  5401. passing an additional empty flags argument, and ‘open’ calls ‘openat’
  5402. passing the additional ‘AT_FDCWD’. Sometimes even more is done, such as
  5403. converting between 32-bit and 64-bit time values. In general, though,
  5404. such processing is only to make the system call better match the C ABI,
  5405. rather than change its functionality.
  5406. However, there are times when you want to make a system call
  5407. explicitly, and for that, the GNU C Library provides the ‘syscall’
  5408. function. ‘syscall’ is harder to use and less portable than functions
  5409. like ‘chmod’, but easier and more portable than coding the system call
  5410. in assembler instructions.
  5411. ‘syscall’ is most useful when you are working with a system call
  5412. which is special to your system or is newer than the GNU C Library you
  5413. are using. ‘syscall’ is implemented in an entirely generic way; the
  5414. function does not know anything about what a particular system call does
  5415. or even if it is valid.
  5416. The description of ‘syscall’ in this section assumes a certain
  5417. protocol for system calls on the various platforms on which the GNU C
  5418. Library runs. That protocol is not defined by any strong authority, but
  5419. we won't describe it here either because anyone who is coding ‘syscall’
  5420. probably won't accept anything less than kernel and C library source
  5421. code as a specification of the interface between them anyway.
  5422. ‘syscall’ does not provide cancellation logic, even if the system
  5423. call you're calling is listed as cancellable above.
  5424. Using ‘syscall’ with system calls that affect the internal state of
  5425. process of thread will likely result in undefined behavior. For this
  5426. reason, at least the following system call numbers are not supported
  5427. when invoked via ‘syscall’: ‘SYS_clone’, ‘SYS_clone2’, ‘SYS_clone3’,
  5428. ‘SYS_rt_sigreturn’, ‘SYS_sigreturn’, ‘SYS_vfork’.
  5429. ‘syscall’ is declared in ‘unistd.h’.
  5430. -- Function: long int syscall (long int SYSNO, ...)
  5431. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5432. Concepts::.
  5433. ‘syscall’ performs a generic system call.
  5434. SYSNO is the system call number. Each kind of system call is
  5435. identified by a number. Macros for all the possible system call
  5436. numbers are defined in ‘sys/syscall.h’
  5437. The remaining arguments are the arguments for the system call, in
  5438. order, and their meanings depend on the kind of system call. If
  5439. you code more arguments than the system call takes, the extra ones
  5440. to the right are ignored.
  5441. The return value is the return value from the system call, unless
  5442. the system call failed. In that case, ‘syscall’ returns ‘-1’ and
  5443. sets ‘errno’ to an error code that the system call returned. Note
  5444. that system calls do not return ‘-1’ when they succeed.
  5445. If you specify an invalid SYSNO, ‘syscall’ returns ‘-1’ with
  5446. ‘errno’ = ‘ENOSYS’.
  5447. Example:
  5448. #include <unistd.h>
  5449. #include <sys/syscall.h>
  5450. #include <errno.h>
  5451. ...
  5452. int rc;
  5453. rc = syscall(SYS_chmod, "/etc/passwd", 0444);
  5454. if (rc == -1)
  5455. fprintf(stderr, "chmod failed, errno = %d\n", errno);
  5456. This, if all the compatibility stars are aligned, is equivalent to
  5457. the following preferable code:
  5458. #include <sys/types.h>
  5459. #include <sys/stat.h>
  5460. #include <errno.h>
  5461. ...
  5462. int rc;
  5463. rc = chmod("/etc/passwd", 0444);
  5464. if (rc == -1)
  5465. fprintf(stderr, "chmod failed, errno = %d\n", errno);
  5466. 
  5467. File: libc.info, Node: Program Termination, Prev: System Calls, Up: Program Basics
  5468. 26.7 Program Termination
  5469. ========================
  5470. The usual way for a program to terminate is simply for its ‘main’
  5471. function to return. The “exit status value” returned from the ‘main’
  5472. function is used to report information back to the process's parent
  5473. process or shell.
  5474. A program can also terminate normally by calling the ‘exit’ function.
  5475. In addition, programs can be terminated by signals; this is discussed
  5476. in more detail in *note Signal Handling::. The ‘abort’ function causes
  5477. a signal that kills the program.
  5478. * Menu:
  5479. * Normal Termination:: If a program calls ‘exit’, a
  5480. process terminates normally.
  5481. * Exit Status:: The ‘exit status’ provides information
  5482. about why the process terminated.
  5483. * Cleanups on Exit:: A process can run its own cleanup
  5484. functions upon normal termination.
  5485. * Aborting a Program:: The ‘abort’ function causes
  5486. abnormal program termination.
  5487. * Termination Internals:: What happens when a process terminates.
  5488. 
  5489. File: libc.info, Node: Normal Termination, Next: Exit Status, Up: Program Termination
  5490. 26.7.1 Normal Termination
  5491. -------------------------
  5492. A process terminates normally when its program signals it is done by
  5493. calling ‘exit’. Returning from ‘main’ is equivalent to calling ‘exit’,
  5494. and the value that ‘main’ returns is used as the argument to ‘exit’.
  5495. -- Function: void exit (int STATUS)
  5496. Preliminary: | MT-Unsafe race:exit | AS-Unsafe corrupt | AC-Unsafe
  5497. corrupt lock | *Note POSIX Safety Concepts::.
  5498. The ‘exit’ function tells the system that the program is done,
  5499. which causes it to terminate the process.
  5500. STATUS is the program's exit status, which becomes part of the
  5501. process' termination status. This function does not return.
  5502. Normal termination causes the following actions:
  5503. 1. Functions that were registered with the ‘atexit’ or ‘on_exit’
  5504. functions are called in the reverse order of their registration.
  5505. This mechanism allows your application to specify its own "cleanup"
  5506. actions to be performed at program termination. Typically, this is
  5507. used to do things like saving program state information in a file,
  5508. or unlocking locks in shared data bases.
  5509. 2. All open streams are closed, writing out any buffered output data.
  5510. See *note Closing Streams::. In addition, temporary files opened
  5511. with the ‘tmpfile’ function are removed; see *note Temporary
  5512. Files::.
  5513. 3. ‘_exit’ is called, terminating the program. *Note Termination
  5514. Internals::.
  5515. 
  5516. File: libc.info, Node: Exit Status, Next: Cleanups on Exit, Prev: Normal Termination, Up: Program Termination
  5517. 26.7.2 Exit Status
  5518. ------------------
  5519. When a program exits, it can return to the parent process a small amount
  5520. of information about the cause of termination, using the “exit status”.
  5521. This is a value between 0 and 255 that the exiting process passes as an
  5522. argument to ‘exit’.
  5523. Normally you should use the exit status to report very broad
  5524. information about success or failure. You can't provide a lot of detail
  5525. about the reasons for the failure, and most parent processes would not
  5526. want much detail anyway.
  5527. There are conventions for what sorts of status values certain
  5528. programs should return. The most common convention is simply 0 for
  5529. success and 1 for failure. Programs that perform comparison use a
  5530. different convention: they use status 1 to indicate a mismatch, and
  5531. status 2 to indicate an inability to compare. Your program should
  5532. follow an existing convention if an existing convention makes sense for
  5533. it.
  5534. A general convention reserves status values 128 and up for special
  5535. purposes. In particular, the value 128 is used to indicate failure to
  5536. execute another program in a subprocess. This convention is not
  5537. universally obeyed, but it is a good idea to follow it in your programs.
  5538. *Warning:* Don't try to use the number of errors as the exit status.
  5539. This is actually not very useful; a parent process would generally not
  5540. care how many errors occurred. Worse than that, it does not work,
  5541. because the status value is truncated to eight bits. Thus, if the
  5542. program tried to report 256 errors, the parent would receive a report of
  5543. 0 errors--that is, success.
  5544. For the same reason, it does not work to use the value of ‘errno’ as
  5545. the exit status--these can exceed 255.
  5546. *Portability note:* Some non-POSIX systems use different conventions
  5547. for exit status values. For greater portability, you can use the macros
  5548. ‘EXIT_SUCCESS’ and ‘EXIT_FAILURE’ for the conventional status value for
  5549. success and failure, respectively. They are declared in the file
  5550. ‘stdlib.h’.
  5551. -- Macro: int EXIT_SUCCESS
  5552. This macro can be used with the ‘exit’ function to indicate
  5553. successful program completion.
  5554. On POSIX systems, the value of this macro is ‘0’. On other
  5555. systems, the value might be some other (possibly non-constant)
  5556. integer expression.
  5557. -- Macro: int EXIT_FAILURE
  5558. This macro can be used with the ‘exit’ function to indicate
  5559. unsuccessful program completion in a general sense.
  5560. On POSIX systems, the value of this macro is ‘1’. On other
  5561. systems, the value might be some other (possibly non-constant)
  5562. integer expression. Other nonzero status values also indicate
  5563. failures. Certain programs use different nonzero status values to
  5564. indicate particular kinds of "non-success". For example, ‘diff’
  5565. uses status value ‘1’ to mean that the files are different, and ‘2’
  5566. or more to mean that there was difficulty in opening the files.
  5567. Don't confuse a program's exit status with a process' termination
  5568. status. There are lots of ways a process can terminate besides having
  5569. its program finish. In the event that the process termination _is_
  5570. caused by program termination (i.e., ‘exit’), though, the program's exit
  5571. status becomes part of the process' termination status.
  5572. 
  5573. File: libc.info, Node: Cleanups on Exit, Next: Aborting a Program, Prev: Exit Status, Up: Program Termination
  5574. 26.7.3 Cleanups on Exit
  5575. -----------------------
  5576. Your program can arrange to run its own cleanup functions if normal
  5577. termination happens. If you are writing a library for use in various
  5578. application programs, then it is unreliable to insist that all
  5579. applications call the library's cleanup functions explicitly before
  5580. exiting. It is much more robust to make the cleanup invisible to the
  5581. application, by setting up a cleanup function in the library itself
  5582. using ‘atexit’ or ‘on_exit’.
  5583. -- Function: int atexit (void (*FUNCTION) (void))
  5584. Preliminary: | MT-Safe | AS-Unsafe heap lock | AC-Unsafe lock mem |
  5585. *Note POSIX Safety Concepts::.
  5586. The ‘atexit’ function registers the function FUNCTION to be called
  5587. at normal program termination. The FUNCTION is called with no
  5588. arguments.
  5589. The return value from ‘atexit’ is zero on success and nonzero if
  5590. the function cannot be registered.
  5591. -- Function: int on_exit (void (*FUNCTION)(int STATUS, void *ARG), void
  5592. *ARG)
  5593. Preliminary: | MT-Safe | AS-Unsafe heap lock | AC-Unsafe lock mem |
  5594. *Note POSIX Safety Concepts::.
  5595. This function is a somewhat more powerful variant of ‘atexit’. It
  5596. accepts two arguments, a function FUNCTION and an arbitrary pointer
  5597. ARG. At normal program termination, the FUNCTION is called with
  5598. two arguments: the STATUS value passed to ‘exit’, and the ARG.
  5599. This function is included in the GNU C Library only for
  5600. compatibility for SunOS, and may not be supported by other
  5601. implementations.
  5602. Here's a trivial program that illustrates the use of ‘exit’ and
  5603. ‘atexit’:
  5604. #include <stdio.h>
  5605. #include <stdlib.h>
  5606. void
  5607. bye (void)
  5608. {
  5609. puts ("Goodbye, cruel world....");
  5610. }
  5611. int
  5612. main (void)
  5613. {
  5614. atexit (bye);
  5615. exit (EXIT_SUCCESS);
  5616. }
  5617. When this program is executed, it just prints the message and exits.
  5618. 
  5619. File: libc.info, Node: Aborting a Program, Next: Termination Internals, Prev: Cleanups on Exit, Up: Program Termination
  5620. 26.7.4 Aborting a Program
  5621. -------------------------
  5622. You can abort your program using the ‘abort’ function. The prototype
  5623. for this function is in ‘stdlib.h’.
  5624. -- Function: void abort (void)
  5625. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5626. Concepts::.
  5627. The ‘abort’ function causes abnormal program termination. This
  5628. does not execute cleanup functions registered with ‘atexit’ or
  5629. ‘on_exit’.
  5630. This function actually terminates the process by raising a
  5631. ‘SIGABRT’ signal, and your program can include a handler to
  5632. intercept this signal; see *note Signal Handling::.
  5633. If either the signal handler does not terminate the process, or if
  5634. the signal is blocked, ‘abort’ will reset the signal disposition to
  5635. the default ‘SIG_DFL’ action and raise the signal again.
  5636. 
  5637. File: libc.info, Node: Termination Internals, Prev: Aborting a Program, Up: Program Termination
  5638. 26.7.5 Termination Internals
  5639. ----------------------------
  5640. The ‘_exit’ function is the primitive used for process termination by
  5641. ‘exit’. It is declared in the header file ‘unistd.h’.
  5642. -- Function: void _exit (int STATUS)
  5643. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5644. Concepts::.
  5645. The ‘_exit’ function is the primitive for causing a process to
  5646. terminate with status STATUS. Calling this function does not
  5647. execute cleanup functions registered with ‘atexit’ or ‘on_exit’.
  5648. -- Function: void _Exit (int STATUS)
  5649. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5650. Concepts::.
  5651. The ‘_Exit’ function is the ISO C equivalent to ‘_exit’. The ISO C
  5652. committee members were not sure whether the definitions of ‘_exit’
  5653. and ‘_Exit’ were compatible so they have not used the POSIX name.
  5654. This function was introduced in ISO C99 and is declared in
  5655. ‘stdlib.h’.
  5656. When a process terminates for any reason--either because the program
  5657. terminates, or as a result of a signal--the following things happen:
  5658. • All open file descriptors in the process are closed. *Note
  5659. Low-Level I/O::. Note that streams are not flushed automatically
  5660. when the process terminates; see *note I/O on Streams::.
  5661. • A process exit status is saved to be reported back to the parent
  5662. process via ‘wait’ or ‘waitpid’; see *note Process Completion::.
  5663. If the program exited, this status includes as its low-order 8 bits
  5664. the program exit status.
  5665. • Any child processes of the process being terminated are assigned a
  5666. new parent process. (On most systems, including GNU, this is the
  5667. ‘init’ process, with process ID 1.)
  5668. • A ‘SIGCHLD’ signal is sent to the parent process.
  5669. • If the process is a session leader that has a controlling terminal,
  5670. then a ‘SIGHUP’ signal is sent to each process in the foreground
  5671. job, and the controlling terminal is disassociated from that
  5672. session. *Note Job Control::.
  5673. • If termination of a process causes a process group to become
  5674. orphaned, and any member of that process group is stopped, then a
  5675. ‘SIGHUP’ signal and a ‘SIGCONT’ signal are sent to each process in
  5676. the group. *Note Job Control::.
  5677. 
  5678. File: libc.info, Node: Processes, Next: Inter-Process Communication, Prev: Program Basics, Up: Top
  5679. 27 Processes
  5680. ************
  5681. “Processes” are the primitive units for allocation of system resources.
  5682. Each process has its own address space and (usually) one thread of
  5683. control. A process executes a program; you can have multiple processes
  5684. executing the same program, but each process has its own copy of the
  5685. program within its own address space and executes it independently of
  5686. the other copies.
  5687. Processes are organized hierarchically. Each process has a “parent
  5688. process” which explicitly arranged to create it. The processes created
  5689. by a given parent are called its “child processes”. A child inherits
  5690. many of its attributes from the parent process.
  5691. This chapter describes how a program can create, terminate, and
  5692. control child processes. Actually, there are three distinct operations
  5693. involved: creating a new child process, causing the new process to
  5694. execute a program, and coordinating the completion of the child process
  5695. with the original program.
  5696. The ‘system’ function provides a simple, portable mechanism for
  5697. running another program; it does all three steps automatically. If you
  5698. need more control over the details of how this is done, you can use the
  5699. primitive functions to do each step individually instead.
  5700. * Menu:
  5701. * Running a Command:: The easy way to run another program.
  5702. * Process Creation Concepts:: An overview of the hard way to do it.
  5703. * Process Identification:: How to get the process ID of a process.
  5704. * Creating a Process:: How to fork a child process.
  5705. * Querying a Process:: How to query a child process.
  5706. * Executing a File:: How to make a process execute another program.
  5707. * Process Completion:: How to tell when a child process has completed.
  5708. * Process Completion Status:: How to interpret the status value
  5709. returned from a child process.
  5710. * BSD Wait Functions:: More functions, for backward compatibility.
  5711. * Process Creation Example:: A complete example program.
  5712. 
  5713. File: libc.info, Node: Running a Command, Next: Process Creation Concepts, Up: Processes
  5714. 27.1 Running a Command
  5715. ======================
  5716. The easy way to run another program is to use the ‘system’ function.
  5717. This function does all the work of running a subprogram, but it doesn't
  5718. give you much control over the details: you have to wait until the
  5719. subprogram terminates before you can do anything else.
  5720. -- Function: int system (const char *COMMAND)
  5721. Preliminary: | MT-Safe | AS-Unsafe plugin heap lock | AC-Unsafe
  5722. lock mem | *Note POSIX Safety Concepts::.
  5723. This function executes COMMAND as a shell command. In the GNU C
  5724. Library, it always uses the default shell ‘sh’ to run the command.
  5725. In particular, it searches the directories in ‘PATH’ to find
  5726. programs to execute. The return value is ‘-1’ if it wasn't
  5727. possible to create the shell process, and otherwise is the status
  5728. of the shell process. *Note Process Completion::, for details on
  5729. how this status code can be interpreted.
  5730. If the COMMAND argument is a null pointer, a return value of zero
  5731. indicates that no command processor is available.
  5732. This function is a cancellation point in multi-threaded programs.
  5733. This is a problem if the thread allocates some resources (like
  5734. memory, file descriptors, semaphores or whatever) at the time
  5735. ‘system’ is called. If the thread gets canceled these resources
  5736. stay allocated until the program ends. To avoid this calls to
  5737. ‘system’ should be protected using cancellation handlers.
  5738. The ‘system’ function is declared in the header file ‘stdlib.h’.
  5739. *Portability Note:* Some C implementations may not have any notion of
  5740. a command processor that can execute other programs. You can determine
  5741. whether a command processor exists by executing ‘system (NULL)’; if the
  5742. return value is nonzero, a command processor is available.
  5743. The ‘popen’ and ‘pclose’ functions (*note Pipe to a Subprocess::) are
  5744. closely related to the ‘system’ function. They allow the parent process
  5745. to communicate with the standard input and output channels of the
  5746. command being executed.
  5747. 
  5748. File: libc.info, Node: Process Creation Concepts, Next: Process Identification, Prev: Running a Command, Up: Processes
  5749. 27.2 Process Creation Concepts
  5750. ==============================
  5751. This section gives an overview of processes and of the steps involved in
  5752. creating a process and making it run another program.
  5753. A new processes is created when one of the functions ‘posix_spawn’,
  5754. ‘fork’, ‘_Fork’, ‘vfork’, or ‘pidfd_spawn’ is called. (The ‘system’ and
  5755. ‘popen’ also create new processes internally.) Due to the name of the
  5756. ‘fork’ function, the act of creating a new process is sometimes called
  5757. “forking” a process. Each new process (the “child process” or
  5758. “subprocess”) is allocated a process ID, distinct from the process ID of
  5759. the parent process. *Note Process Identification::.
  5760. After forking a child process, both the parent and child processes
  5761. continue to execute normally. If you want your program to wait for a
  5762. child process to finish executing before continuing, you must do this
  5763. explicitly after the fork operation, by calling ‘wait’ or ‘waitpid’
  5764. (*note Process Completion::). These functions give you limited
  5765. information about why the child terminated--for example, its exit status
  5766. code.
  5767. A newly forked child process continues to execute the same program as
  5768. its parent process, at the point where the ‘fork’ or ‘_Fork’ call
  5769. returns. You can use the return value from ‘fork’ or ‘_Fork’ to tell
  5770. whether the program is running in the parent process or the child.
  5771. Having several processes run the same program is only occasionally
  5772. useful. But the child can execute another program using one of the
  5773. ‘exec’ functions; see *note Executing a File::. The program that the
  5774. process is executing is called its “process image”. Starting execution
  5775. of a new program causes the process to forget all about its previous
  5776. process image; when the new program exits, the process exits too,
  5777. instead of returning to the previous process image.
  5778. 
  5779. File: libc.info, Node: Process Identification, Next: Creating a Process, Prev: Process Creation Concepts, Up: Processes
  5780. 27.3 Process Identification
  5781. ===========================
  5782. Each process is named by a “process ID” number, a value of type ‘pid_t’.
  5783. A process ID is allocated to each process when it is created. Process
  5784. IDs are reused over time. The lifetime of a process ends when the
  5785. parent process of the corresponding process waits on the process ID
  5786. after the process has terminated. *Note Process Completion::. (The
  5787. parent process can arrange for such waiting to happen implicitly.) A
  5788. process ID uniquely identifies a process only during the lifetime of the
  5789. process. As a rule of thumb, this means that the process must still be
  5790. running.
  5791. Process IDs can also denote process groups and sessions. *Note Job
  5792. Control::.
  5793. On Linux, threads created by ‘pthread_create’ also receive a “thread
  5794. ID”. The thread ID of the initial (main) thread is the same as the
  5795. process ID of the entire process. Thread IDs for subsequently created
  5796. threads are distinct. They are allocated from the same numbering space
  5797. as process IDs. Process IDs and thread IDs are sometimes also referred
  5798. to collectively as “task IDs”. In contrast to processes, threads are
  5799. never waited for explicitly, so a thread ID becomes eligible for reuse
  5800. as soon as a thread exits or is canceled. This is true even for
  5801. joinable threads, not just detached threads. Threads are assigned to a
  5802. “thread group”. In the GNU C Library implementation running on Linux,
  5803. the process ID is the thread group ID of all threads in the process.
  5804. You can get the process ID of a process by calling ‘getpid’. The
  5805. function ‘getppid’ returns the process ID of the parent of the current
  5806. process (this is also known as the “parent process ID”). Your program
  5807. should include the header files ‘unistd.h’ and ‘sys/types.h’ to use
  5808. these functions.
  5809. -- Data Type: pid_t
  5810. The ‘pid_t’ data type is a signed integer type which is capable of
  5811. representing a process ID. In the GNU C Library, this is an ‘int’.
  5812. -- Function: pid_t getpid (void)
  5813. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5814. Concepts::.
  5815. The ‘getpid’ function returns the process ID of the current
  5816. process.
  5817. -- Function: pid_t getppid (void)
  5818. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5819. Concepts::.
  5820. The ‘getppid’ function returns the process ID of the parent of the
  5821. current process.
  5822. -- Function: pid_t gettid (void)
  5823. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5824. Concepts::.
  5825. The ‘gettid’ function returns the thread ID of the current thread.
  5826. The returned value is obtained from the Linux kernel and is not
  5827. subject to caching. See the discussion of thread IDs above,
  5828. especially regarding reuse of the IDs of threads which have exited.
  5829. This function is specific to Linux.
  5830. -- Function: pid_t pthread_gettid_np (pthread_t THREAD)
  5831. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5832. Concepts::.
  5833. This function returns the same value that ‘gettid’ would return if
  5834. executed on the running thread THREAD.
  5835. If THREAD is no longer running but it is joinable, it is
  5836. unspecified whether this function returns −1, or if it returns the
  5837. thread ID of the thread while it was running. If THREAD is not
  5838. running and is not joinable, the behavior is undefined.
  5839. *Portability Note:* Linux thread IDs can be reused rather quickly,
  5840. so this function differs from the ‘pthread_getunique_np’ function
  5841. found on other systems.
  5842. This function is specific to Linux.
  5843. 
  5844. File: libc.info, Node: Creating a Process, Next: Querying a Process, Prev: Process Identification, Up: Processes
  5845. 27.4 Creating a Process
  5846. =======================
  5847. The ‘fork’ function is the primitive for creating a process. It is
  5848. declared in the header file ‘unistd.h’.
  5849. -- Function: pid_t fork (void)
  5850. Preliminary: | MT-Safe | AS-Unsafe plugin | AC-Unsafe lock | *Note
  5851. POSIX Safety Concepts::.
  5852. The ‘fork’ function creates a new process.
  5853. If the operation is successful, there are then both parent and
  5854. child processes and both see ‘fork’ return, but with different
  5855. values: it returns a value of ‘0’ in the child process and returns
  5856. the child's process ID in the parent process.
  5857. If process creation failed, ‘fork’ returns a value of ‘-1’ in the
  5858. parent process. The following ‘errno’ error conditions are defined
  5859. for ‘fork’:
  5860. ‘EAGAIN’
  5861. There aren't enough system resources to create another
  5862. process, or the user already has too many processes running.
  5863. This means exceeding the ‘RLIMIT_NPROC’ resource limit, which
  5864. can usually be increased; *note Limits on Resources::.
  5865. ‘ENOMEM’
  5866. The process requires more space than the system can supply.
  5867. The specific attributes of the child process that differ from the
  5868. parent process are:
  5869. • The child process has its own unique process ID.
  5870. • The parent process ID of the child process is the process ID of its
  5871. parent process.
  5872. • The child process gets its own copies of the parent process's open
  5873. file descriptors. Subsequently changing attributes of the file
  5874. descriptors in the parent process won't affect the file descriptors
  5875. in the child, and vice versa. *Note Control Operations::.
  5876. However, the file position associated with each descriptor is
  5877. shared by both processes; *note File Position::.
  5878. • The elapsed processor times for the child process are set to zero;
  5879. see *note Processor Time::.
  5880. • The child doesn't inherit file locks set by the parent process.
  5881. *Note Control Operations::.
  5882. • The child doesn't inherit alarms set by the parent process. *Note
  5883. Setting an Alarm::.
  5884. • The set of pending signals (*note Delivery of Signal::) for the
  5885. child process is cleared. (The child process inherits its mask of
  5886. blocked signals and signal actions from the parent process.)
  5887. -- Function: pid_t _Fork (void)
  5888. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5889. Concepts::.
  5890. The ‘_Fork’ function is similar to ‘fork’, but it does not invoke
  5891. any callbacks registered with ‘pthread_atfork’, nor does it reset
  5892. any internal state or locks (such as the ‘malloc’ locks). In the
  5893. new subprocess, only async-signal-safe functions may be called,
  5894. such as ‘dup2’ or ‘execve’.
  5895. The ‘_Fork’ function is an async-signal-safe replacement of ‘fork’.
  5896. This function was originally a GNU extension, but was added in
  5897. POSIX.1-2024.
  5898. -- Function: pid_t vfork (void)
  5899. Preliminary: | MT-Safe | AS-Unsafe plugin | AC-Unsafe lock | *Note
  5900. POSIX Safety Concepts::.
  5901. The ‘vfork’ function is similar to ‘fork’ but on some systems it is
  5902. more efficient; however, there are restrictions you must follow to
  5903. use it safely.
  5904. While ‘fork’ makes a complete copy of the calling process's address
  5905. space and allows both the parent and child to execute
  5906. independently, ‘vfork’ does not make this copy. Instead, the child
  5907. process created with ‘vfork’ shares its parent's address space
  5908. until it calls ‘_exit’ or one of the ‘exec’ functions. In the
  5909. meantime, the parent process suspends execution.
  5910. You must be very careful not to allow the child process created
  5911. with ‘vfork’ to modify any global data or even local variables
  5912. shared with the parent. Furthermore, the child process cannot
  5913. return from (or do a long jump out of) the function that called
  5914. ‘vfork’! This would leave the parent process's control information
  5915. very confused. If in doubt, use ‘fork’ instead.
  5916. Some operating systems don't really implement ‘vfork’. The GNU C
  5917. Library permits you to use ‘vfork’ on all systems, but actually
  5918. executes ‘fork’ if ‘vfork’ isn't available. If you follow the
  5919. proper precautions for using ‘vfork’, your program will still work
  5920. even if the system uses ‘fork’ instead.
  5921. 
  5922. File: libc.info, Node: Querying a Process, Next: Executing a File, Prev: Creating a Process, Up: Processes
  5923. 27.5 Querying a Process
  5924. =======================
  5925. The file descriptor returned by the ‘pidfd_fork’ function can be used to
  5926. query process extra information.
  5927. -- Function: pid_t pidfd_getpid (int FD)
  5928. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5929. Concepts::.
  5930. The ‘pidfd_getpid’ function retrieves the process ID associated
  5931. with process file descriptor created with ‘pid_spawn’,
  5932. ‘pidfd_fork’, or ‘pidfd_open’.
  5933. If the operation fails, ‘pidfd_getpid’ return ‘-1’ and the
  5934. following ‘errno’ error conditionas are defined:
  5935. ‘EBADF’
  5936. The input file descriptor is invalid, does not have a pidfd
  5937. associated, or an error has occurred parsing the kernel data.
  5938. ‘EREMOTE’
  5939. There is no process ID to denote the process in the current
  5940. namespace.
  5941. ‘ESRCH’
  5942. The process for which the file descriptor refers to is
  5943. terminated.
  5944. ‘ENOENT’
  5945. The procfs is not mounted.
  5946. ‘ENFILE.’
  5947. Too many open files in system (‘pidfd_open’ tries to open a
  5948. procfs file and read its contents).
  5949. ‘ENOMEM’
  5950. Insufficient kernel memory was available.
  5951. This function is specific to Linux.
  5952. 
  5953. File: libc.info, Node: Executing a File, Next: Process Completion, Prev: Querying a Process, Up: Processes
  5954. 27.6 Executing a File
  5955. =====================
  5956. This section describes the ‘exec’ family of functions, for executing a
  5957. file as a process image. You can use these functions to make a child
  5958. process execute a new program after it has been forked.
  5959. To see the effects of ‘exec’ from the point of view of the called
  5960. program, see *note Program Basics::.
  5961. The functions in this family differ in how you specify the arguments,
  5962. but otherwise they all do the same thing. They are declared in the
  5963. header file ‘unistd.h’.
  5964. -- Function: int execv (const char *FILENAME, char *const ARGV[])
  5965. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5966. Concepts::.
  5967. The ‘execv’ function executes the file named by FILENAME as a new
  5968. process image.
  5969. The ARGV argument is an array of null-terminated strings that is
  5970. used to provide a value for the ‘argv’ argument to the ‘main’
  5971. function of the program to be executed. The last element of this
  5972. array must be a null pointer. By convention, the first element of
  5973. this array is the file name of the program sans directory names.
  5974. *Note Program Arguments::, for full details on how programs can
  5975. access these arguments.
  5976. The environment for the new process image is taken from the
  5977. ‘environ’ variable of the current process image; see *note
  5978. Environment Variables::, for information about environments.
  5979. -- Function: int execl (const char *FILENAME, const char *ARG0, ...)
  5980. Preliminary: | MT-Safe | AS-Unsafe heap | AC-Unsafe mem | *Note
  5981. POSIX Safety Concepts::.
  5982. This is similar to ‘execv’, but the ARGV strings are specified
  5983. individually instead of as an array. A null pointer must be passed
  5984. as the last such argument.
  5985. -- Function: int execve (const char *FILENAME, char *const ARGV[], char
  5986. *const ENV[])
  5987. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5988. Concepts::.
  5989. This is similar to ‘execv’, but permits you to specify the
  5990. environment for the new program explicitly as the ENV argument.
  5991. This should be an array of strings in the same format as for the
  5992. ‘environ’ variable; see *note Environment Access::.
  5993. -- Function: int fexecve (int FD, char *const ARGV[], char *const
  5994. ENV[])
  5995. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5996. Concepts::.
  5997. This is similar to ‘execve’, but instead of identifying the program
  5998. executable by its pathname, the file descriptor FD is used. The
  5999. descriptor must have been opened with the ‘O_RDONLY’ flag or (on
  6000. Linux) the ‘O_PATH’ flag.
  6001. On Linux, ‘fexecve’ can fail with an error of ‘ENOSYS’ if ‘/proc’
  6002. has not been mounted and the kernel lacks support for the
  6003. underlying ‘execveat’ system call.
  6004. -- Function: int execle (const char *FILENAME, const char *ARG0, ...,
  6005. char *const ENV[])
  6006. Preliminary: | MT-Safe | AS-Unsafe heap | AC-Unsafe mem | *Note
  6007. POSIX Safety Concepts::.
  6008. This is similar to ‘execl’, but permits you to specify the
  6009. environment for the new program explicitly. The environment
  6010. argument is passed following the null pointer that marks the last
  6011. ARGV argument, and should be an array of strings in the same format
  6012. as for the ‘environ’ variable.
  6013. -- Function: int execvp (const char *FILENAME, char *const ARGV[])
  6014. Preliminary: | MT-Safe env | AS-Unsafe heap | AC-Unsafe mem | *Note
  6015. POSIX Safety Concepts::.
  6016. The ‘execvp’ function is similar to ‘execv’, except that it
  6017. searches the directories listed in the ‘PATH’ environment variable
  6018. (*note Standard Environment::) to find the full file name of a file
  6019. from FILENAME if FILENAME does not contain a slash.
  6020. This function is useful for executing system utility programs,
  6021. because it looks for them in the places that the user has chosen.
  6022. Shells use it to run the commands that users type.
  6023. -- Function: int execlp (const char *FILENAME, const char *ARG0, ...)
  6024. Preliminary: | MT-Safe env | AS-Unsafe heap | AC-Unsafe mem | *Note
  6025. POSIX Safety Concepts::.
  6026. This function is like ‘execl’, except that it performs the same
  6027. file name searching as the ‘execvp’ function.
  6028. The size of the argument list and environment list taken together
  6029. must not be greater than ‘ARG_MAX’ bytes. *Note General Limits::. On
  6030. GNU/Hurd systems, the size (which compares against ‘ARG_MAX’) includes,
  6031. for each string, the number of characters in the string, plus the size
  6032. of a ‘char *’, plus one, rounded up to a multiple of the size of a ‘char
  6033. *’. Other systems may have somewhat different rules for counting.
  6034. These functions normally don't return, since execution of a new
  6035. program causes the currently executing program to go away completely. A
  6036. value of ‘-1’ is returned in the event of a failure. In addition to the
  6037. usual file name errors (*note File Name Errors::), the following ‘errno’
  6038. error conditions are defined for these functions:
  6039. ‘E2BIG’
  6040. The combined size of the new program's argument list and
  6041. environment list is larger than ‘ARG_MAX’ bytes. GNU/Hurd systems
  6042. have no specific limit on the argument list size, so this error
  6043. code cannot result, but you may get ‘ENOMEM’ instead if the
  6044. arguments are too big for available memory.
  6045. ‘ENOEXEC’
  6046. The specified file can't be executed because it isn't in the right
  6047. format.
  6048. ‘ENOMEM’
  6049. Executing the specified file requires more storage than is
  6050. available.
  6051. If execution of the new file succeeds, it updates the access time
  6052. field of the file as if the file had been read. *Note File Times::, for
  6053. more details about access times of files.
  6054. The point at which the file is closed again is not specified, but is
  6055. at some point before the process exits or before another process image
  6056. is executed.
  6057. Executing a new process image completely changes the contents of
  6058. memory, copying only the argument and environment strings to new
  6059. locations. But many other attributes of the process are unchanged:
  6060. • The process ID and the parent process ID. *Note Process Creation
  6061. Concepts::.
  6062. • Session and process group membership. *Note Concepts of Job
  6063. Control::.
  6064. • Real user ID and group ID, and supplementary group IDs. *Note
  6065. Process Persona::.
  6066. • Pending alarms. *Note Setting an Alarm::.
  6067. • Current working directory and root directory. *Note Working
  6068. Directory::. On GNU/Hurd systems, the root directory is not copied
  6069. when executing a setuid program; instead the system default root
  6070. directory is used for the new program.
  6071. • File mode creation mask. *Note Setting Permissions::.
  6072. • Process signal mask; see *note Process Signal Mask::.
  6073. • Pending signals; see *note Blocking Signals::.
  6074. • Elapsed processor time associated with the process; see *note
  6075. Processor Time::.
  6076. If the set-user-ID and set-group-ID mode bits of the process image
  6077. file are set, this affects the effective user ID and effective group ID
  6078. (respectively) of the process. These concepts are discussed in detail
  6079. in *note Process Persona::.
  6080. Signals that are set to be ignored in the existing process image are
  6081. also set to be ignored in the new process image. All other signals are
  6082. set to the default action in the new process image. For more
  6083. information about signals, see *note Signal Handling::.
  6084. File descriptors open in the existing process image remain open in
  6085. the new process image, unless they have the ‘FD_CLOEXEC’ (close-on-exec)
  6086. flag set. The files that remain open inherit all attributes of the open
  6087. file descriptors from the existing process image, including file locks.
  6088. File descriptors are discussed in *note Low-Level I/O::.
  6089. Streams, by contrast, cannot survive through ‘exec’ functions,
  6090. because they are located in the memory of the process itself. The new
  6091. process image has no streams except those it creates afresh. Each of
  6092. the streams in the pre-‘exec’ process image has a descriptor inside it,
  6093. and these descriptors do survive through ‘exec’ (provided that they do
  6094. not have ‘FD_CLOEXEC’ set). The new process image can reconnect these
  6095. to new streams using ‘fdopen’ (*note Descriptors and Streams::).
  6096. 
  6097. File: libc.info, Node: Process Completion, Next: Process Completion Status, Prev: Executing a File, Up: Processes
  6098. 27.7 Process Completion
  6099. =======================
  6100. The functions described in this section are used to wait for a child
  6101. process to terminate or stop, and determine its status. These functions
  6102. are declared in the header file ‘sys/wait.h’.
  6103. -- Function: pid_t waitpid (pid_t PID, int *STATUS-PTR, int OPTIONS)
  6104. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  6105. Concepts::.
  6106. The ‘waitpid’ function is used to request status information from a
  6107. child process whose process ID is PID. Normally, the calling
  6108. process is suspended until the child process makes status
  6109. information available by terminating.
  6110. Other values for the PID argument have special interpretations. A
  6111. value of ‘-1’ or ‘WAIT_ANY’ requests status information for any
  6112. child process; a value of ‘0’ or ‘WAIT_MYPGRP’ requests information
  6113. for any child process in the same process group as the calling
  6114. process; and any other negative value − PGID requests information
  6115. for any child process whose process group ID is PGID.
  6116. If status information for a child process is available immediately,
  6117. this function returns immediately without waiting. If more than
  6118. one eligible child process has status information available, one of
  6119. them is chosen randomly, and its status is returned immediately.
  6120. To get the status from the other eligible child processes, you need
  6121. to call ‘waitpid’ again.
  6122. The OPTIONS argument is a bit mask. Its value should be the
  6123. bitwise OR (that is, the ‘|’ operator) of zero or more of the
  6124. ‘WNOHANG’ and ‘WUNTRACED’ flags. You can use the ‘WNOHANG’ flag to
  6125. indicate that the parent process shouldn't wait; and the
  6126. ‘WUNTRACED’ flag to request status information from stopped
  6127. processes as well as processes that have terminated.
  6128. The status information from the child process is stored in the
  6129. object that STATUS-PTR points to, unless STATUS-PTR is a null
  6130. pointer.
  6131. This function is a cancellation point in multi-threaded programs.
  6132. This is a problem if the thread allocates some resources (like
  6133. memory, file descriptors, semaphores or whatever) at the time
  6134. ‘waitpid’ is called. If the thread gets canceled these resources
  6135. stay allocated until the program ends. To avoid this calls to
  6136. ‘waitpid’ should be protected using cancellation handlers.
  6137. The return value is normally the process ID of the child process
  6138. whose status is reported. If there are child processes but none of
  6139. them is waiting to be noticed, ‘waitpid’ will block until one is.
  6140. However, if the ‘WNOHANG’ option was specified, ‘waitpid’ will
  6141. return zero instead of blocking.
  6142. If a specific PID to wait for was given to ‘waitpid’, it will
  6143. ignore all other children (if any). Therefore if there are
  6144. children waiting to be noticed but the child whose PID was
  6145. specified is not one of them, ‘waitpid’ will block or return zero
  6146. as described above.
  6147. A value of ‘-1’ is returned in case of error. The following
  6148. ‘errno’ error conditions are defined for this function:
  6149. ‘EINTR’
  6150. The function was interrupted by delivery of a signal to the
  6151. calling process. *Note Interrupted Primitives::.
  6152. ‘ECHILD’
  6153. There are no child processes to wait for, or the specified PID
  6154. is not a child of the calling process.
  6155. ‘EINVAL’
  6156. An invalid value was provided for the OPTIONS argument.
  6157. These symbolic constants are defined as values for the PID argument
  6158. to the ‘waitpid’ function.
  6159. ‘WAIT_ANY’
  6160. This constant macro (whose value is ‘-1’) specifies that ‘waitpid’
  6161. should return status information about any child process.
  6162. ‘WAIT_MYPGRP’
  6163. This constant (with value ‘0’) specifies that ‘waitpid’ should
  6164. return status information about any child process in the same
  6165. process group as the calling process.
  6166. These symbolic constants are defined as flags for the OPTIONS
  6167. argument to the ‘waitpid’ function. You can bitwise-OR the flags
  6168. together to obtain a value to use as the argument.
  6169. ‘WNOHANG’
  6170. This flag specifies that ‘waitpid’ should return immediately
  6171. instead of waiting, if there is no child process ready to be
  6172. noticed.
  6173. ‘WUNTRACED’
  6174. This flag specifies that ‘waitpid’ should report the status of any
  6175. child processes that have been stopped as well as those that have
  6176. terminated.
  6177. -- Function: pid_t wait (int *STATUS-PTR)
  6178. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  6179. Concepts::.
  6180. This is a simplified version of ‘waitpid’, and is used to wait
  6181. until any one child process terminates. The call:
  6182. wait (&status)
  6183. is exactly equivalent to:
  6184. waitpid (-1, &status, 0)
  6185. This function is a cancellation point in multi-threaded programs.
  6186. This is a problem if the thread allocates some resources (like
  6187. memory, file descriptors, semaphores or whatever) at the time
  6188. ‘wait’ is called. If the thread gets canceled these resources stay
  6189. allocated until the program ends. To avoid this calls to ‘wait’
  6190. should be protected using cancellation handlers.
  6191. -- Function: pid_t wait4 (pid_t PID, int *STATUS-PTR, int OPTIONS,
  6192. struct rusage *USAGE)
  6193. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  6194. Concepts::.
  6195. If USAGE is a null pointer, ‘wait4’ is equivalent to ‘waitpid (PID,
  6196. STATUS-PTR, OPTIONS)’.
  6197. If USAGE is not null, ‘wait4’ stores usage figures for the child
  6198. process in ‘*RUSAGE’ (but only if the child has terminated, not if
  6199. it has stopped). *Note Resource Usage::.
  6200. This function is a BSD extension.
  6201. Here's an example of how to use ‘waitpid’ to get the status from all
  6202. child processes that have terminated, without ever waiting. This
  6203. function is designed to be a handler for ‘SIGCHLD’, the signal that
  6204. indicates that at least one child process has terminated.
  6205. void
  6206. sigchld_handler (int signum)
  6207. {
  6208. int pid, status, serrno;
  6209. serrno = errno;
  6210. while (1)
  6211. {
  6212. pid = waitpid (WAIT_ANY, &status, WNOHANG);
  6213. if (pid < 0)
  6214. {
  6215. perror ("waitpid");
  6216. break;
  6217. }
  6218. if (pid == 0)
  6219. break;
  6220. notice_termination (pid, status);
  6221. }
  6222. errno = serrno;
  6223. }
  6224. 
  6225. File: libc.info, Node: Process Completion Status, Next: BSD Wait Functions, Prev: Process Completion, Up: Processes
  6226. 27.8 Process Completion Status
  6227. ==============================
  6228. If the exit status value (*note Program Termination::) of the child
  6229. process is zero, then the status value reported by ‘waitpid’ or ‘wait’
  6230. is also zero. You can test for other kinds of information encoded in
  6231. the returned status value using the following macros. These macros are
  6232. defined in the header file ‘sys/wait.h’.
  6233. -- Macro: int WIFEXITED (int STATUS)
  6234. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  6235. Concepts::.
  6236. This macro returns a nonzero value if the child process terminated
  6237. normally with ‘exit’ or ‘_exit’.
  6238. -- Macro: int WEXITSTATUS (int STATUS)
  6239. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  6240. Concepts::.
  6241. If ‘WIFEXITED’ is true of STATUS, this macro returns the low-order
  6242. 8 bits of the exit status value from the child process. *Note Exit
  6243. Status::.
  6244. -- Macro: int WIFSIGNALED (int STATUS)
  6245. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  6246. Concepts::.
  6247. This macro returns a nonzero value if the child process terminated
  6248. because it received a signal that was not handled. *Note Signal
  6249. Handling::.
  6250. -- Macro: int WTERMSIG (int STATUS)
  6251. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  6252. Concepts::.
  6253. If ‘WIFSIGNALED’ is true of STATUS, this macro returns the signal
  6254. number of the signal that terminated the child process.
  6255. -- Macro: int WCOREDUMP (int STATUS)
  6256. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  6257. Concepts::.
  6258. This macro returns a nonzero value if the child process terminated
  6259. and produced a core dump.
  6260. This macro was originally a BSD extension, but was added in
  6261. POSIX.1-2024.
  6262. -- Macro: int WIFSTOPPED (int STATUS)
  6263. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  6264. Concepts::.
  6265. This macro returns a nonzero value if the child process is stopped.
  6266. -- Macro: int WSTOPSIG (int STATUS)
  6267. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  6268. Concepts::.
  6269. If ‘WIFSTOPPED’ is true of STATUS, this macro returns the signal
  6270. number of the signal that caused the child process to stop.