libc.info-13 298 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568
  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: BSD Wait Functions, Next: Process Creation Example, Prev: Process Completion Status, Up: Processes
  2438. 27.9 BSD Process Wait Function
  2439. ==============================
  2440. The GNU C Library also provides the ‘wait3’ function for compatibility
  2441. with BSD. This function is declared in ‘sys/wait.h’. It is the
  2442. predecessor to ‘wait4’, which is more flexible. ‘wait3’ is now
  2443. obsolete.
  2444. -- Function: pid_t wait3 (int *STATUS-PTR, int OPTIONS, struct rusage
  2445. *USAGE)
  2446. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2447. Concepts::.
  2448. If USAGE is a null pointer, ‘wait3’ is equivalent to ‘waitpid (-1,
  2449. STATUS-PTR, OPTIONS)’.
  2450. If USAGE is not null, ‘wait3’ stores usage figures for the child
  2451. process in ‘*RUSAGE’ (but only if the child has terminated, not if
  2452. it has stopped). *Note Resource Usage::.
  2453. 
  2454. File: libc.info, Node: Process Creation Example, Prev: BSD Wait Functions, Up: Processes
  2455. 27.10 Process Creation Example
  2456. ==============================
  2457. Here is an example program showing how you might write a function
  2458. similar to the built-in ‘system’. It executes its COMMAND argument
  2459. using the equivalent of ‘sh -c COMMAND’.
  2460. #include <stddef.h>
  2461. #include <stdlib.h>
  2462. #include <unistd.h>
  2463. #include <sys/types.h>
  2464. #include <sys/wait.h>
  2465. /* Execute the command using this shell program. */
  2466. #define SHELL "/bin/sh"
  2467. int
  2468. my_system (const char *command)
  2469. {
  2470. int status;
  2471. pid_t pid;
  2472. pid = fork ();
  2473. if (pid == 0)
  2474. {
  2475. /* This is the child process. Execute the shell command. */
  2476. execl (SHELL, SHELL, "-c", command, NULL);
  2477. _exit (EXIT_FAILURE);
  2478. }
  2479. else if (pid < 0)
  2480. /* The fork failed. Report failure. */
  2481. status = -1;
  2482. else
  2483. /* This is the parent process. Wait for the child to complete. */
  2484. if (waitpid (pid, &status, 0) != pid)
  2485. status = -1;
  2486. return status;
  2487. }
  2488. There are a couple of things you should pay attention to in this
  2489. example.
  2490. Remember that the first ‘argv’ argument supplied to the program
  2491. represents the name of the program being executed. That is why, in the
  2492. call to ‘execl’, ‘SHELL’ is supplied once to name the program to execute
  2493. and a second time to supply a value for ‘argv[0]’.
  2494. The ‘execl’ call in the child process doesn't return if it is
  2495. successful. If it fails, you must do something to make the child
  2496. process terminate. Just returning a bad status code with ‘return’ would
  2497. leave two processes running the original program. Instead, the right
  2498. behavior is for the child process to report failure to its parent
  2499. process.
  2500. Call ‘_exit’ to accomplish this. The reason for using ‘_exit’
  2501. instead of ‘exit’ is to avoid flushing fully buffered streams such as
  2502. ‘stdout’. The buffers of these streams probably contain data that was
  2503. copied from the parent process by the ‘fork’, data that will be output
  2504. eventually by the parent process. Calling ‘exit’ in the child would
  2505. output the data twice. *Note Termination Internals::.
  2506. 
  2507. File: libc.info, Node: Inter-Process Communication, Next: Job Control, Prev: Processes, Up: Top
  2508. 28 Inter-Process Communication
  2509. ******************************
  2510. This chapter describes the GNU C Library inter-process communication
  2511. primitives.
  2512. * Menu:
  2513. * Semaphores:: Support for creating and managing semaphores
  2514. 
  2515. File: libc.info, Node: Semaphores, Up: Inter-Process Communication
  2516. 28.1 Semaphores
  2517. ===============
  2518. The GNU C Library implements the semaphore APIs as defined in POSIX and
  2519. System V. Semaphores can be used by multiple processes to coordinate
  2520. shared resources. The following is a complete list of the semaphore
  2521. functions provided by the GNU C Library.
  2522. 28.1.1 System V Semaphores
  2523. --------------------------
  2524. -- Function: int semctl (int SEMID, int SEMNUM, int CMD)
  2525. Preliminary: | MT-Safe | AS-Safe | AC-Unsafe corrupt/linux | *Note
  2526. POSIX Safety Concepts::.
  2527. -- Function: int semget (key_t KEY, int NSEMS, int SEMFLG)
  2528. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2529. Concepts::.
  2530. -- Function: int semop (int SEMID, struct sembuf *SOPS, size_t NSOPS)
  2531. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2532. Concepts::.
  2533. -- Function: int semtimedop (int SEMID, struct sembuf *SOPS, size_t
  2534. NSOPS, const struct timespec *TIMEOUT)
  2535. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2536. Concepts::.
  2537. 28.1.2 POSIX Semaphores
  2538. -----------------------
  2539. The GNU C Library provides POSIX semaphores as well. These functions'
  2540. names begin with ‘sem_’ and they are declared in ‘semaphore.h’. *Note
  2541. POSIX Semaphores::.
  2542. 
  2543. File: libc.info, Node: Job Control, Next: Name Service Switch, Prev: Inter-Process Communication, Up: Top
  2544. 29 Job Control
  2545. **************
  2546. “Job control” refers to the protocol for allowing a user to move between
  2547. multiple “process groups” (or “jobs”) within a single “login session”.
  2548. The job control facilities are set up so that appropriate behavior for
  2549. most programs happens automatically and they need not do anything
  2550. special about job control. So you can probably ignore the material in
  2551. this chapter unless you are writing a shell or login program.
  2552. You need to be familiar with concepts relating to process creation
  2553. (*note Process Creation Concepts::) and signal handling (*note Signal
  2554. Handling::) in order to understand this material presented in this
  2555. chapter.
  2556. Some old systems do not support job control, but GNU systems always
  2557. have, and it is a required feature in the 2001 revision of POSIX.1
  2558. (*note POSIX::). If you need to be portable to old systems, you can use
  2559. the ‘_POSIX_JOB_CONTROL’ macro to test at compile-time whether the
  2560. system supports job control. *Note System Options::.
  2561. * Menu:
  2562. * Concepts of Job Control:: Jobs can be controlled by a shell.
  2563. * Controlling Terminal:: How a process gets its controlling terminal.
  2564. * Access to the Terminal:: How processes share the controlling terminal.
  2565. * Orphaned Process Groups:: Jobs left after the user logs out.
  2566. * Implementing a Shell:: What a shell must do to implement job control.
  2567. * Functions for Job Control:: Functions to control process groups.
  2568. 
  2569. File: libc.info, Node: Concepts of Job Control, Next: Controlling Terminal, Up: Job Control
  2570. 29.1 Concepts of Job Control
  2571. ============================
  2572. The fundamental purpose of an interactive shell is to read commands from
  2573. the user's terminal and create processes to execute the programs
  2574. specified by those commands. It can do this using the ‘fork’ (*note
  2575. Creating a Process::) and ‘exec’ (*note Executing a File::) functions.
  2576. A single command may run just one process--but often one command uses
  2577. several processes. If you use the ‘|’ operator in a shell command, you
  2578. explicitly request several programs in their own processes. But even if
  2579. you run just one program, it can use multiple processes internally. For
  2580. example, a single compilation command such as ‘cc -c foo.c’ typically
  2581. uses four processes (though normally only two at any given time). If
  2582. you run ‘make’, its job is to run other programs in separate processes.
  2583. The processes belonging to a single command are called a “process
  2584. group” or “job”. This is so that you can operate on all of them at
  2585. once. For example, typing ‘C-c’ sends the signal ‘SIGINT’ to terminate
  2586. all the processes in the foreground process group.
  2587. A “session” is a larger group of processes. Normally all the
  2588. processes that stem from a single login belong to the same session.
  2589. Every process belongs to a process group. When a process is created,
  2590. it becomes a member of the same process group and session as its parent
  2591. process. You can put it in another process group using the ‘setpgid’
  2592. function, provided the process group belongs to the same session.
  2593. The only way to put a process in a different session is to make it
  2594. the initial process of a new session, or a “session leader”, using the
  2595. ‘setsid’ function. This also puts the session leader into a new process
  2596. group, and you can't move it out of that process group again.
  2597. Usually, new sessions are created by the system login program, and
  2598. the session leader is the process running the user's login shell.
  2599. A shell that supports job control must arrange to control which job
  2600. can use the terminal at any time. Otherwise there might be multiple
  2601. jobs trying to read from the terminal at once, and confusion about which
  2602. process should receive the input typed by the user. To prevent this,
  2603. the shell must cooperate with the terminal driver using the protocol
  2604. described in this chapter.
  2605. The shell can give unlimited access to the controlling terminal to
  2606. only one process group at a time. This is called the “foreground job”
  2607. on that controlling terminal. Other process groups managed by the shell
  2608. that are executing without such access to the terminal are called
  2609. “background jobs”.
  2610. If a background job needs to read from its controlling terminal, it
  2611. is “stopped” by the terminal driver; if the ‘TOSTOP’ mode is set,
  2612. likewise for writing. The user can stop a foreground job by typing the
  2613. SUSP character (*note Special Characters::) and a program can stop any
  2614. job by sending it a ‘SIGSTOP’ signal. It's the responsibility of the
  2615. shell to notice when jobs stop, to notify the user about them, and to
  2616. provide mechanisms for allowing the user to interactively continue
  2617. stopped jobs and switch jobs between foreground and background.
  2618. *Note Access to the Terminal::, for more information about I/O to the
  2619. controlling terminal.
  2620. 
  2621. File: libc.info, Node: Controlling Terminal, Next: Access to the Terminal, Prev: Concepts of Job Control, Up: Job Control
  2622. 29.2 Controlling Terminal of a Process
  2623. ======================================
  2624. One of the attributes of a process is its controlling terminal. Child
  2625. processes created with ‘fork’ inherit the controlling terminal from
  2626. their parent process. In this way, all the processes in a session
  2627. inherit the controlling terminal from the session leader. A session
  2628. leader that has control of a terminal is called the “controlling
  2629. process” of that terminal.
  2630. You generally do not need to worry about the exact mechanism used to
  2631. allocate a controlling terminal to a session, since it is done for you
  2632. by the system when you log in.
  2633. An individual process disconnects from its controlling terminal when
  2634. it calls ‘setsid’ to become the leader of a new session. *Note Process
  2635. Group Functions::.
  2636. 
  2637. File: libc.info, Node: Access to the Terminal, Next: Orphaned Process Groups, Prev: Controlling Terminal, Up: Job Control
  2638. 29.3 Access to the Controlling Terminal
  2639. =======================================
  2640. Processes in the foreground job of a controlling terminal have
  2641. unrestricted access to that terminal; background processes do not. This
  2642. section describes in more detail what happens when a process in a
  2643. background job tries to access its controlling terminal.
  2644. When a process in a background job tries to read from its controlling
  2645. terminal, the process group is usually sent a ‘SIGTTIN’ signal. This
  2646. normally causes all of the processes in that group to stop (unless they
  2647. handle the signal and don't stop themselves). However, if the reading
  2648. process is ignoring or blocking this signal, then ‘read’ fails with an
  2649. ‘EIO’ error instead.
  2650. Similarly, when a process in a background job tries to write to its
  2651. controlling terminal, the default behavior is to send a ‘SIGTTOU’ signal
  2652. to the process group. However, the behavior is modified by the ‘TOSTOP’
  2653. bit of the local modes flags (*note Local Modes::). If this bit is not
  2654. set (which is the default), then writing to the controlling terminal is
  2655. always permitted without sending a signal. Writing is also permitted if
  2656. the ‘SIGTTOU’ signal is being ignored or blocked by the writing process.
  2657. Most other terminal operations that a program can do are treated as
  2658. reading or as writing. (The description of each operation should say
  2659. which.)
  2660. For more information about the primitive ‘read’ and ‘write’
  2661. functions, see *note I/O Primitives::.
  2662. 
  2663. File: libc.info, Node: Orphaned Process Groups, Next: Implementing a Shell, Prev: Access to the Terminal, Up: Job Control
  2664. 29.4 Orphaned Process Groups
  2665. ============================
  2666. When a controlling process terminates, its terminal becomes free and a
  2667. new session can be established on it. (In fact, another user could log
  2668. in on the terminal.) This could cause a problem if any processes from
  2669. the old session are still trying to use that terminal.
  2670. To prevent problems, process groups that continue running even after
  2671. the session leader has terminated are marked as “orphaned process
  2672. groups”.
  2673. When a process group becomes an orphan, its processes are sent a
  2674. ‘SIGHUP’ signal. Ordinarily, this causes the processes to terminate.
  2675. However, if a program ignores this signal or establishes a handler for
  2676. it (*note Signal Handling::), it can continue running as in the orphan
  2677. process group even after its controlling process terminates; but it
  2678. still cannot access the terminal any more.
  2679. 
  2680. File: libc.info, Node: Implementing a Shell, Next: Functions for Job Control, Prev: Orphaned Process Groups, Up: Job Control
  2681. 29.5 Implementing a Job Control Shell
  2682. =====================================
  2683. This section describes what a shell must do to implement job control, by
  2684. presenting an extensive sample program to illustrate the concepts
  2685. involved.
  2686. * Menu:
  2687. * Data Structures:: Introduction to the sample shell.
  2688. * Initializing the Shell:: What the shell must do to take
  2689. responsibility for job control.
  2690. * Launching Jobs:: Creating jobs to execute commands.
  2691. * Foreground and Background:: Putting a job in foreground of background.
  2692. * Stopped and Terminated Jobs:: Reporting job status.
  2693. * Continuing Stopped Jobs:: How to continue a stopped job in
  2694. the foreground or background.
  2695. * Missing Pieces:: Other parts of the shell.
  2696. 
  2697. File: libc.info, Node: Data Structures, Next: Initializing the Shell, Up: Implementing a Shell
  2698. 29.5.1 Data Structures for the Shell
  2699. ------------------------------------
  2700. All of the program examples included in this chapter are part of a
  2701. simple shell program. This section presents data structures and utility
  2702. functions which are used throughout the example.
  2703. The sample shell deals mainly with two data structures. The ‘job’
  2704. type contains information about a job, which is a set of subprocesses
  2705. linked together with pipes. The ‘process’ type holds information about
  2706. a single subprocess. Here are the relevant data structure declarations:
  2707. /* A process is a single process. */
  2708. typedef struct process
  2709. {
  2710. struct process *next; /* next process in pipeline */
  2711. char **argv; /* for exec */
  2712. pid_t pid; /* process ID */
  2713. char completed; /* true if process has completed */
  2714. char stopped; /* true if process has stopped */
  2715. int status; /* reported status value */
  2716. } process;
  2717. /* A job is a pipeline of processes. */
  2718. typedef struct job
  2719. {
  2720. struct job *next; /* next active job */
  2721. char *command; /* command line, used for messages */
  2722. process *first_process; /* list of processes in this job */
  2723. pid_t pgid; /* process group ID */
  2724. char notified; /* true if user told about stopped job */
  2725. struct termios tmodes; /* saved terminal modes */
  2726. int stdin, stdout, stderr; /* standard i/o channels */
  2727. } job;
  2728. /* The active jobs are linked into a list. This is its head. */
  2729. job *first_job = NULL;
  2730. Here are some utility functions that are used for operating on ‘job’
  2731. objects.
  2732. /* Find the active job with the indicated PGID. */
  2733. job *
  2734. find_job (pid_t pgid)
  2735. {
  2736. job *j;
  2737. for (j = first_job; j; j = j->next)
  2738. if (j->pgid == pgid)
  2739. return j;
  2740. return NULL;
  2741. }
  2742. /* Return true if all processes in the job have stopped or completed. */
  2743. int
  2744. job_is_stopped (job *j)
  2745. {
  2746. process *p;
  2747. for (p = j->first_process; p; p = p->next)
  2748. if (!p->completed && !p->stopped)
  2749. return 0;
  2750. return 1;
  2751. }
  2752. /* Return true if all processes in the job have completed. */
  2753. int
  2754. job_is_completed (job *j)
  2755. {
  2756. process *p;
  2757. for (p = j->first_process; p; p = p->next)
  2758. if (!p->completed)
  2759. return 0;
  2760. return 1;
  2761. }
  2762. 
  2763. File: libc.info, Node: Initializing the Shell, Next: Launching Jobs, Prev: Data Structures, Up: Implementing a Shell
  2764. 29.5.2 Initializing the Shell
  2765. -----------------------------
  2766. When a shell program that normally performs job control is started, it
  2767. has to be careful in case it has been invoked from another shell that is
  2768. already doing its own job control.
  2769. A subshell that runs interactively has to ensure that it has been
  2770. placed in the foreground by its parent shell before it can enable job
  2771. control itself. It does this by getting its initial process group ID
  2772. with the ‘getpgrp’ function, and comparing it to the process group ID of
  2773. the current foreground job associated with its controlling terminal
  2774. (which can be retrieved using the ‘tcgetpgrp’ function).
  2775. If the subshell is not running as a foreground job, it must stop
  2776. itself by sending a ‘SIGTTIN’ signal to its own process group. It may
  2777. not arbitrarily put itself into the foreground; it must wait for the
  2778. user to tell the parent shell to do this. If the subshell is continued
  2779. again, it should repeat the check and stop itself again if it is still
  2780. not in the foreground.
  2781. Once the subshell has been placed into the foreground by its parent
  2782. shell, it can enable its own job control. It does this by calling
  2783. ‘setpgid’ to put itself into its own process group, and then calling
  2784. ‘tcsetpgrp’ to place this process group into the foreground.
  2785. When a shell enables job control, it should set itself to ignore all
  2786. the job control stop signals so that it doesn't accidentally stop
  2787. itself. You can do this by setting the action for all the stop signals
  2788. to ‘SIG_IGN’.
  2789. A subshell that runs non-interactively cannot and should not support
  2790. job control. It must leave all processes it creates in the same process
  2791. group as the shell itself; this allows the non-interactive shell and its
  2792. child processes to be treated as a single job by the parent shell. This
  2793. is easy to do--just don't use any of the job control primitives--but you
  2794. must remember to make the shell do it.
  2795. Here is the initialization code for the sample shell that shows how
  2796. to do all of this.
  2797. /* Keep track of attributes of the shell. */
  2798. #include <sys/types.h>
  2799. #include <termios.h>
  2800. #include <unistd.h>
  2801. pid_t shell_pgid;
  2802. struct termios shell_tmodes;
  2803. int shell_terminal;
  2804. int shell_is_interactive;
  2805. /* Make sure the shell is running interactively as the foreground job
  2806. before proceeding. */
  2807. void
  2808. init_shell ()
  2809. {
  2810. /* See if we are running interactively. */
  2811. shell_terminal = STDIN_FILENO;
  2812. shell_is_interactive = isatty (shell_terminal);
  2813. if (shell_is_interactive)
  2814. {
  2815. /* Loop until we are in the foreground. */
  2816. while (tcgetpgrp (shell_terminal) != (shell_pgid = getpgrp ()))
  2817. kill (- shell_pgid, SIGTTIN);
  2818. /* Ignore interactive and job-control signals. */
  2819. signal (SIGINT, SIG_IGN);
  2820. signal (SIGQUIT, SIG_IGN);
  2821. signal (SIGTSTP, SIG_IGN);
  2822. signal (SIGTTIN, SIG_IGN);
  2823. signal (SIGTTOU, SIG_IGN);
  2824. signal (SIGCHLD, SIG_IGN);
  2825. /* Put ourselves in our own process group. */
  2826. shell_pgid = getpid ();
  2827. if (setpgid (shell_pgid, shell_pgid) < 0)
  2828. {
  2829. perror ("Couldn't put the shell in its own process group");
  2830. exit (1);
  2831. }
  2832. /* Grab control of the terminal. */
  2833. tcsetpgrp (shell_terminal, shell_pgid);
  2834. /* Save default terminal attributes for shell. */
  2835. tcgetattr (shell_terminal, &shell_tmodes);
  2836. }
  2837. }
  2838. 
  2839. File: libc.info, Node: Launching Jobs, Next: Foreground and Background, Prev: Initializing the Shell, Up: Implementing a Shell
  2840. 29.5.3 Launching Jobs
  2841. ---------------------
  2842. Once the shell has taken responsibility for performing job control on
  2843. its controlling terminal, it can launch jobs in response to commands
  2844. typed by the user.
  2845. To create the processes in a process group, you use the same ‘fork’
  2846. and ‘exec’ functions described in *note Process Creation Concepts::.
  2847. Since there are multiple child processes involved, though, things are a
  2848. little more complicated and you must be careful to do things in the
  2849. right order. Otherwise, nasty race conditions can result.
  2850. You have two choices for how to structure the tree of parent-child
  2851. relationships among the processes. You can either make all the
  2852. processes in the process group be children of the shell process, or you
  2853. can make one process in group be the ancestor of all the other processes
  2854. in that group. The sample shell program presented in this chapter uses
  2855. the first approach because it makes bookkeeping somewhat simpler.
  2856. As each process is forked, it should put itself in the new process
  2857. group by calling ‘setpgid’; see *note Process Group Functions::. The
  2858. first process in the new group becomes its “process group leader”, and
  2859. its process ID becomes the “process group ID” for the group.
  2860. The shell should also call ‘setpgid’ to put each of its child
  2861. processes into the new process group. This is because there is a
  2862. potential timing problem: each child process must be put in the process
  2863. group before it begins executing a new program, and the shell depends on
  2864. having all the child processes in the group before it continues
  2865. executing. If both the child processes and the shell call ‘setpgid’,
  2866. this ensures that the right things happen no matter which process gets
  2867. to it first.
  2868. If the job is being launched as a foreground job, the new process
  2869. group also needs to be put into the foreground on the controlling
  2870. terminal using ‘tcsetpgrp’. Again, this should be done by the shell as
  2871. well as by each of its child processes, to avoid race conditions.
  2872. The next thing each child process should do is to reset its signal
  2873. actions.
  2874. During initialization, the shell process set itself to ignore job
  2875. control signals; see *note Initializing the Shell::. As a result, any
  2876. child processes it creates also ignore these signals by inheritance.
  2877. This is definitely undesirable, so each child process should explicitly
  2878. set the actions for these signals back to ‘SIG_DFL’ just after it is
  2879. forked.
  2880. Since shells follow this convention, applications can assume that
  2881. they inherit the correct handling of these signals from the parent
  2882. process. But every application has a responsibility not to mess up the
  2883. handling of stop signals. Applications that disable the normal
  2884. interpretation of the SUSP character should provide some other mechanism
  2885. for the user to stop the job. When the user invokes this mechanism, the
  2886. program should send a ‘SIGTSTP’ signal to the process group of the
  2887. process, not just to the process itself. *Note Signaling Another
  2888. Process::.
  2889. Finally, each child process should call ‘exec’ in the normal way.
  2890. This is also the point at which redirection of the standard input and
  2891. output channels should be handled. *Note Duplicating Descriptors::, for
  2892. an explanation of how to do this.
  2893. Here is the function from the sample shell program that is
  2894. responsible for launching a program. The function is executed by each
  2895. child process immediately after it has been forked by the shell, and
  2896. never returns.
  2897. void
  2898. launch_process (process *p, pid_t pgid,
  2899. int infile, int outfile, int errfile,
  2900. int foreground)
  2901. {
  2902. pid_t pid;
  2903. if (shell_is_interactive)
  2904. {
  2905. /* Put the process into the process group and give the process group
  2906. the terminal, if appropriate.
  2907. This has to be done both by the shell and in the individual
  2908. child processes because of potential race conditions. */
  2909. pid = getpid ();
  2910. if (pgid == 0) pgid = pid;
  2911. setpgid (pid, pgid);
  2912. if (foreground)
  2913. tcsetpgrp (shell_terminal, pgid);
  2914. /* Set the handling for job control signals back to the default. */
  2915. signal (SIGINT, SIG_DFL);
  2916. signal (SIGQUIT, SIG_DFL);
  2917. signal (SIGTSTP, SIG_DFL);
  2918. signal (SIGTTIN, SIG_DFL);
  2919. signal (SIGTTOU, SIG_DFL);
  2920. signal (SIGCHLD, SIG_DFL);
  2921. }
  2922. /* Set the standard input/output channels of the new process. */
  2923. if (infile != STDIN_FILENO)
  2924. {
  2925. dup2 (infile, STDIN_FILENO);
  2926. close (infile);
  2927. }
  2928. if (outfile != STDOUT_FILENO)
  2929. {
  2930. dup2 (outfile, STDOUT_FILENO);
  2931. close (outfile);
  2932. }
  2933. if (errfile != STDERR_FILENO)
  2934. {
  2935. dup2 (errfile, STDERR_FILENO);
  2936. close (errfile);
  2937. }
  2938. /* Exec the new process. Make sure we exit. */
  2939. execvp (p->argv[0], p->argv);
  2940. perror ("execvp");
  2941. exit (1);
  2942. }
  2943. If the shell is not running interactively, this function does not do
  2944. anything with process groups or signals. Remember that a shell not
  2945. performing job control must keep all of its subprocesses in the same
  2946. process group as the shell itself.
  2947. Next, here is the function that actually launches a complete job.
  2948. After creating the child processes, this function calls some other
  2949. functions to put the newly created job into the foreground or
  2950. background; these are discussed in *note Foreground and Background::.
  2951. void
  2952. launch_job (job *j, int foreground)
  2953. {
  2954. process *p;
  2955. pid_t pid;
  2956. int mypipe[2], infile, outfile;
  2957. infile = j->stdin;
  2958. for (p = j->first_process; p; p = p->next)
  2959. {
  2960. /* Set up pipes, if necessary. */
  2961. if (p->next)
  2962. {
  2963. if (pipe (mypipe) < 0)
  2964. {
  2965. perror ("pipe");
  2966. exit (1);
  2967. }
  2968. outfile = mypipe[1];
  2969. }
  2970. else
  2971. outfile = j->stdout;
  2972. /* Fork the child processes. */
  2973. pid = fork ();
  2974. if (pid == 0)
  2975. /* This is the child process. */
  2976. launch_process (p, j->pgid, infile,
  2977. outfile, j->stderr, foreground);
  2978. else if (pid < 0)
  2979. {
  2980. /* The fork failed. */
  2981. perror ("fork");
  2982. exit (1);
  2983. }
  2984. else
  2985. {
  2986. /* This is the parent process. */
  2987. p->pid = pid;
  2988. if (shell_is_interactive)
  2989. {
  2990. if (!j->pgid)
  2991. j->pgid = pid;
  2992. setpgid (pid, j->pgid);
  2993. }
  2994. }
  2995. /* Clean up after pipes. */
  2996. if (infile != j->stdin)
  2997. close (infile);
  2998. if (outfile != j->stdout)
  2999. close (outfile);
  3000. infile = mypipe[0];
  3001. }
  3002. format_job_info (j, "launched");
  3003. if (!shell_is_interactive)
  3004. wait_for_job (j);
  3005. else if (foreground)
  3006. put_job_in_foreground (j, 0);
  3007. else
  3008. put_job_in_background (j, 0);
  3009. }
  3010. 
  3011. File: libc.info, Node: Foreground and Background, Next: Stopped and Terminated Jobs, Prev: Launching Jobs, Up: Implementing a Shell
  3012. 29.5.4 Foreground and Background
  3013. --------------------------------
  3014. Now let's consider what actions must be taken by the shell when it
  3015. launches a job into the foreground, and how this differs from what must
  3016. be done when a background job is launched.
  3017. When a foreground job is launched, the shell must first give it
  3018. access to the controlling terminal by calling ‘tcsetpgrp’. Then, the
  3019. shell should wait for processes in that process group to terminate or
  3020. stop. This is discussed in more detail in *note Stopped and Terminated
  3021. Jobs::.
  3022. When all of the processes in the group have either completed or
  3023. stopped, the shell should regain control of the terminal for its own
  3024. process group by calling ‘tcsetpgrp’ again. Since stop signals caused
  3025. by I/O from a background process or a SUSP character typed by the user
  3026. are sent to the process group, normally all the processes in the job
  3027. stop together.
  3028. The foreground job may have left the terminal in a strange state, so
  3029. the shell should restore its own saved terminal modes before continuing.
  3030. In case the job is merely stopped, the shell should first save the
  3031. current terminal modes so that it can restore them later if the job is
  3032. continued. The functions for dealing with terminal modes are
  3033. ‘tcgetattr’ and ‘tcsetattr’; these are described in *note Terminal
  3034. Modes::.
  3035. Here is the sample shell's function for doing all of this.
  3036. /* Put job J in the foreground. If CONT is nonzero,
  3037. restore the saved terminal modes and send the process group a
  3038. ‘SIGCONT’ signal to wake it up before we block. */
  3039. void
  3040. put_job_in_foreground (job *j, int cont)
  3041. {
  3042. /* Put the job into the foreground. */
  3043. tcsetpgrp (shell_terminal, j->pgid);
  3044. /* Send the job a continue signal, if necessary. */
  3045. if (cont)
  3046. {
  3047. tcsetattr (shell_terminal, TCSADRAIN, &j->tmodes);
  3048. if (kill (- j->pgid, SIGCONT) < 0)
  3049. perror ("kill (SIGCONT)");
  3050. }
  3051. /* Wait for it to report. */
  3052. wait_for_job (j);
  3053. /* Put the shell back in the foreground. */
  3054. tcsetpgrp (shell_terminal, shell_pgid);
  3055. /* Restore the shell's terminal modes. */
  3056. tcgetattr (shell_terminal, &j->tmodes);
  3057. tcsetattr (shell_terminal, TCSADRAIN, &shell_tmodes);
  3058. }
  3059. If the process group is launched as a background job, the shell
  3060. should remain in the foreground itself and continue to read commands
  3061. from the terminal.
  3062. In the sample shell, there is not much that needs to be done to put a
  3063. job into the background. Here is the function it uses:
  3064. /* Put a job in the background. If the cont argument is true, send
  3065. the process group a ‘SIGCONT’ signal to wake it up. */
  3066. void
  3067. put_job_in_background (job *j, int cont)
  3068. {
  3069. /* Send the job a continue signal, if necessary. */
  3070. if (cont)
  3071. if (kill (-j->pgid, SIGCONT) < 0)
  3072. perror ("kill (SIGCONT)");
  3073. }
  3074. 
  3075. File: libc.info, Node: Stopped and Terminated Jobs, Next: Continuing Stopped Jobs, Prev: Foreground and Background, Up: Implementing a Shell
  3076. 29.5.5 Stopped and Terminated Jobs
  3077. ----------------------------------
  3078. When a foreground process is launched, the shell must block until all of
  3079. the processes in that job have either terminated or stopped. It can do
  3080. this by calling the ‘waitpid’ function; see *note Process Completion::.
  3081. Use the ‘WUNTRACED’ option so that status is reported for processes that
  3082. stop as well as processes that terminate.
  3083. The shell must also check on the status of background jobs so that it
  3084. can report terminated and stopped jobs to the user; this can be done by
  3085. calling ‘waitpid’ with the ‘WNOHANG’ option. A good place to put a such
  3086. a check for terminated and stopped jobs is just before prompting for a
  3087. new command.
  3088. The shell can also receive asynchronous notification that there is
  3089. status information available for a child process by establishing a
  3090. handler for ‘SIGCHLD’ signals. *Note Signal Handling::.
  3091. In the sample shell program, the ‘SIGCHLD’ signal is normally
  3092. ignored. This is to avoid reentrancy problems involving the global data
  3093. structures the shell manipulates. But at specific times when the shell
  3094. is not using these data structures--such as when it is waiting for input
  3095. on the terminal--it makes sense to enable a handler for ‘SIGCHLD’. The
  3096. same function that is used to do the synchronous status checks
  3097. (‘do_job_notification’, in this case) can also be called from within
  3098. this handler.
  3099. Here are the parts of the sample shell program that deal with
  3100. checking the status of jobs and reporting the information to the user.
  3101. /* Store the status of the process PID that was returned by waitpid.
  3102. Return 0 if all went well, nonzero otherwise. */
  3103. int
  3104. mark_process_status (pid_t pid, int status)
  3105. {
  3106. job *j;
  3107. process *p;
  3108. if (pid > 0)
  3109. {
  3110. /* Update the record for the process. */
  3111. for (j = first_job; j; j = j->next)
  3112. for (p = j->first_process; p; p = p->next)
  3113. if (p->pid == pid)
  3114. {
  3115. p->status = status;
  3116. if (WIFSTOPPED (status))
  3117. p->stopped = 1;
  3118. else
  3119. {
  3120. p->completed = 1;
  3121. if (WIFSIGNALED (status))
  3122. fprintf (stderr, "%d: Terminated by signal %d.\n",
  3123. (int) pid, WTERMSIG (p->status));
  3124. }
  3125. return 0;
  3126. }
  3127. fprintf (stderr, "No child process %d.\n", pid);
  3128. return -1;
  3129. }
  3130. else if (pid == 0 || errno == ECHILD)
  3131. /* No processes ready to report. */
  3132. return -1;
  3133. else {
  3134. /* Other weird errors. */
  3135. perror ("waitpid");
  3136. return -1;
  3137. }
  3138. }
  3139. /* Check for processes that have status information available,
  3140. without blocking. */
  3141. void
  3142. update_status (void)
  3143. {
  3144. int status;
  3145. pid_t pid;
  3146. do
  3147. pid = waitpid (WAIT_ANY, &status, WUNTRACED|WNOHANG);
  3148. while (!mark_process_status (pid, status));
  3149. }
  3150. /* Check for processes that have status information available,
  3151. blocking until all processes in the given job have reported. */
  3152. void
  3153. wait_for_job (job *j)
  3154. {
  3155. int status;
  3156. pid_t pid;
  3157. do
  3158. pid = waitpid (WAIT_ANY, &status, WUNTRACED);
  3159. while (!mark_process_status (pid, status)
  3160. && !job_is_stopped (j)
  3161. && !job_is_completed (j));
  3162. }
  3163. /* Format information about job status for the user to look at. */
  3164. void
  3165. format_job_info (job *j, const char *status)
  3166. {
  3167. fprintf (stderr, "%ld (%s): %s\n", (long)j->pgid, status, j->command);
  3168. }
  3169. /* Notify the user about stopped or terminated jobs.
  3170. Delete terminated jobs from the active job list. */
  3171. void
  3172. do_job_notification (void)
  3173. {
  3174. job *j, *jlast, *jnext;
  3175. /* Update status information for child processes. */
  3176. update_status ();
  3177. jlast = NULL;
  3178. for (j = first_job; j; j = jnext)
  3179. {
  3180. jnext = j->next;
  3181. /* If all processes have completed, tell the user the job has
  3182. completed and delete it from the list of active jobs. */
  3183. if (job_is_completed (j)) {
  3184. format_job_info (j, "completed");
  3185. if (jlast)
  3186. jlast->next = jnext;
  3187. else
  3188. first_job = jnext;
  3189. free_job (j);
  3190. }
  3191. /* Notify the user about stopped jobs,
  3192. marking them so that we won't do this more than once. */
  3193. else if (job_is_stopped (j) && !j->notified) {
  3194. format_job_info (j, "stopped");
  3195. j->notified = 1;
  3196. jlast = j;
  3197. }
  3198. /* Don't say anything about jobs that are still running. */
  3199. else
  3200. jlast = j;
  3201. }
  3202. }
  3203. 
  3204. File: libc.info, Node: Continuing Stopped Jobs, Next: Missing Pieces, Prev: Stopped and Terminated Jobs, Up: Implementing a Shell
  3205. 29.5.6 Continuing Stopped Jobs
  3206. ------------------------------
  3207. The shell can continue a stopped job by sending a ‘SIGCONT’ signal to
  3208. its process group. If the job is being continued in the foreground, the
  3209. shell should first invoke ‘tcsetpgrp’ to give the job access to the
  3210. terminal, and restore the saved terminal settings. After continuing a
  3211. job in the foreground, the shell should wait for the job to stop or
  3212. complete, as if the job had just been launched in the foreground.
  3213. The sample shell program handles both newly created and continued
  3214. jobs with the same pair of functions, ‘put_job_in_foreground’ and
  3215. ‘put_job_in_background’. The definitions of these functions were given
  3216. in *note Foreground and Background::. When continuing a stopped job, a
  3217. nonzero value is passed as the CONT argument to ensure that the
  3218. ‘SIGCONT’ signal is sent and the terminal modes reset, as appropriate.
  3219. This leaves only a function for updating the shell's internal
  3220. bookkeeping about the job being continued:
  3221. /* Mark a stopped job J as being running again. */
  3222. void
  3223. mark_job_as_running (job *j)
  3224. {
  3225. Process *p;
  3226. for (p = j->first_process; p; p = p->next)
  3227. p->stopped = 0;
  3228. j->notified = 0;
  3229. }
  3230. /* Continue the job J. */
  3231. void
  3232. continue_job (job *j, int foreground)
  3233. {
  3234. mark_job_as_running (j);
  3235. if (foreground)
  3236. put_job_in_foreground (j, 1);
  3237. else
  3238. put_job_in_background (j, 1);
  3239. }
  3240. 
  3241. File: libc.info, Node: Missing Pieces, Prev: Continuing Stopped Jobs, Up: Implementing a Shell
  3242. 29.5.7 The Missing Pieces
  3243. -------------------------
  3244. The code extracts for the sample shell included in this chapter are only
  3245. a part of the entire shell program. In particular, nothing at all has
  3246. been said about how ‘job’ and ‘program’ data structures are allocated
  3247. and initialized.
  3248. Most real shells provide a complex user interface that has support
  3249. for a command language; variables; abbreviations, substitutions, and
  3250. pattern matching on file names; and the like. All of this is far too
  3251. complicated to explain here! Instead, we have concentrated on showing
  3252. how to implement the core process creation and job control functions
  3253. that can be called from such a shell.
  3254. Here is a table summarizing the major entry points we have presented:
  3255. ‘void init_shell (void)’
  3256. Initialize the shell's internal state. *Note Initializing the
  3257. Shell::.
  3258. ‘void launch_job (job *J, int FOREGROUND)’
  3259. Launch the job J as either a foreground or background job. *Note
  3260. Launching Jobs::.
  3261. ‘void do_job_notification (void)’
  3262. Check for and report any jobs that have terminated or stopped. Can
  3263. be called synchronously or within a handler for ‘SIGCHLD’ signals.
  3264. *Note Stopped and Terminated Jobs::.
  3265. ‘void continue_job (job *J, int FOREGROUND)’
  3266. Continue the job J. *Note Continuing Stopped Jobs::.
  3267. Of course, a real shell would also want to provide other functions
  3268. for managing jobs. For example, it would be useful to have commands to
  3269. list all active jobs or to send a signal (such as ‘SIGKILL’) to a job.
  3270. 
  3271. File: libc.info, Node: Functions for Job Control, Prev: Implementing a Shell, Up: Job Control
  3272. 29.6 Functions for Job Control
  3273. ==============================
  3274. This section contains detailed descriptions of the functions relating to
  3275. job control.
  3276. * Menu:
  3277. * Identifying the Terminal:: Determining the controlling terminal's name.
  3278. * Process Group Functions:: Functions for manipulating process groups.
  3279. * Terminal Access Functions:: Functions for controlling terminal access.
  3280. 
  3281. File: libc.info, Node: Identifying the Terminal, Next: Process Group Functions, Up: Functions for Job Control
  3282. 29.6.1 Identifying the Controlling Terminal
  3283. -------------------------------------------
  3284. You can use the ‘ctermid’ function to get a file name that you can use
  3285. to open the controlling terminal. In the GNU C Library, it returns the
  3286. same string all the time: ‘"/dev/tty"’. That is a special "magic" file
  3287. name that refers to the controlling terminal of the current process (if
  3288. it has one). To find the name of the specific terminal device, use
  3289. ‘ttyname’; *note Is It a Terminal::.
  3290. The function ‘ctermid’ is declared in the header file ‘stdio.h’.
  3291. -- Function: char * ctermid (char *STRING)
  3292. Preliminary: | MT-Safe !posix/!string | AS-Safe | AC-Safe | *Note
  3293. POSIX Safety Concepts::.
  3294. The ‘ctermid’ function returns a string containing the file name of
  3295. the controlling terminal for the current process. If STRING is not
  3296. a null pointer, it should be an array that can hold at least
  3297. ‘L_ctermid’ characters; the string is returned in this array.
  3298. Otherwise, a pointer to a string in a static area is returned,
  3299. which might get overwritten on subsequent calls to this function.
  3300. An empty string is returned if the file name cannot be determined
  3301. for any reason. Even if a file name is returned, access to the
  3302. file it represents is not guaranteed.
  3303. -- Macro: int L_ctermid
  3304. The value of this macro is an integer constant expression that
  3305. represents the size of a string large enough to hold the file name
  3306. returned by ‘ctermid’.
  3307. See also the ‘isatty’ and ‘ttyname’ functions, in *note Is It a
  3308. Terminal::.
  3309. 
  3310. File: libc.info, Node: Process Group Functions, Next: Terminal Access Functions, Prev: Identifying the Terminal, Up: Functions for Job Control
  3311. 29.6.2 Process Group Functions
  3312. ------------------------------
  3313. Here are descriptions of the functions for manipulating process groups.
  3314. Your program should include the header files ‘sys/types.h’ and
  3315. ‘unistd.h’ to use these functions.
  3316. -- Function: pid_t setsid (void)
  3317. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3318. Concepts::.
  3319. The ‘setsid’ function creates a new session. The calling process
  3320. becomes the session leader, and is put in a new process group whose
  3321. process group ID is the same as the process ID of that process.
  3322. There are initially no other processes in the new process group,
  3323. and no other process groups in the new session.
  3324. This function also makes the calling process have no controlling
  3325. terminal.
  3326. The ‘setsid’ function returns the new process group ID of the
  3327. calling process if successful. A return value of ‘-1’ indicates an
  3328. error. The following ‘errno’ error conditions are defined for this
  3329. function:
  3330. ‘EPERM’
  3331. The calling process is already a process group leader, or
  3332. there is already another process group around that has the
  3333. same process group ID.
  3334. -- Function: pid_t getsid (pid_t PID)
  3335. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3336. Concepts::.
  3337. The ‘getsid’ function returns the process group ID of the session
  3338. leader of the specified process. If a PID is ‘0’, the process
  3339. group ID of the session leader of the current process is returned.
  3340. In case of error ‘-1’ is returned and ‘errno’ is set. The
  3341. following ‘errno’ error conditions are defined for this function:
  3342. ‘ESRCH’
  3343. There is no process with the given process ID PID.
  3344. ‘EPERM’
  3345. The calling process and the process specified by PID are in
  3346. different sessions, and the implementation doesn't allow to
  3347. access the process group ID of the session leader of the
  3348. process with ID PID from the calling process.
  3349. -- Function: pid_t getpgrp (void)
  3350. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3351. Concepts::.
  3352. The ‘getpgrp’ function returns the process group ID of the calling
  3353. process.
  3354. -- Function: int getpgid (pid_t PID)
  3355. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3356. Concepts::.
  3357. The ‘getpgid’ function returns the process group ID of the process
  3358. PID. You can supply a value of ‘0’ for the PID argument to get
  3359. information about the calling process.
  3360. In case of error ‘-1’ is returned and ‘errno’ is set. The
  3361. following ‘errno’ error conditions are defined for this function:
  3362. ‘ESRCH’
  3363. There is no process with the given process ID PID.
  3364. ‘EPERM’
  3365. The calling process and the process specified by PID are in
  3366. different sessions, and the implementation doesn't allow to
  3367. access the process group ID of the process with ID PID from
  3368. the calling process.
  3369. -- Function: int setpgid (pid_t PID, pid_t PGID)
  3370. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3371. Concepts::.
  3372. The ‘setpgid’ function puts the process PID into the process group
  3373. PGID. As a special case, either PID or PGID can be zero to
  3374. indicate the process ID of the calling process.
  3375. If the operation is successful, ‘setpgid’ returns zero. Otherwise
  3376. it returns ‘-1’. The following ‘errno’ error conditions are
  3377. defined for this function:
  3378. ‘EACCES’
  3379. The child process named by PID has executed an ‘exec’ function
  3380. since it was forked.
  3381. ‘EINVAL’
  3382. The value of the PGID is not valid.
  3383. ‘ENOSYS’
  3384. The system doesn't support job control.
  3385. ‘EPERM’
  3386. The process indicated by the PID argument is a session leader,
  3387. or is not in the same session as the calling process, or the
  3388. value of the PGID argument doesn't match a process group ID in
  3389. the same session as the calling process.
  3390. ‘ESRCH’
  3391. The process indicated by the PID argument is not the calling
  3392. process or a child of the calling process.
  3393. -- Function: int setpgrp (pid_t PID, pid_t PGID)
  3394. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3395. Concepts::.
  3396. This is the BSD Unix name for ‘setpgid’. Both functions do exactly
  3397. the same thing.
  3398. 
  3399. File: libc.info, Node: Terminal Access Functions, Prev: Process Group Functions, Up: Functions for Job Control
  3400. 29.6.3 Functions for Controlling Terminal Access
  3401. ------------------------------------------------
  3402. These are the functions for reading or setting the foreground process
  3403. group of a terminal. You should include the header files ‘sys/types.h’
  3404. and ‘unistd.h’ in your application to use these functions.
  3405. Although these functions take a file descriptor argument to specify
  3406. the terminal device, the foreground job is associated with the terminal
  3407. file itself and not a particular open file descriptor.
  3408. -- Function: pid_t tcgetpgrp (int FILEDES)
  3409. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3410. Concepts::.
  3411. This function returns the process group ID of the foreground
  3412. process group associated with the terminal open on descriptor
  3413. FILEDES.
  3414. If there is no foreground process group, the return value is a
  3415. number greater than ‘1’ that does not match the process group ID of
  3416. any existing process group. This can happen if all of the
  3417. processes in the job that was formerly the foreground job have
  3418. terminated, and no other job has yet been moved into the
  3419. foreground.
  3420. In case of an error, a value of ‘-1’ is returned. The following
  3421. ‘errno’ error conditions are defined for this function:
  3422. ‘EBADF’
  3423. The FILEDES argument is not a valid file descriptor.
  3424. ‘ENOSYS’
  3425. The system doesn't support job control.
  3426. ‘ENOTTY’
  3427. The terminal file associated with the FILEDES argument isn't
  3428. the controlling terminal of the calling process.
  3429. -- Function: int tcsetpgrp (int FILEDES, pid_t PGID)
  3430. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3431. Concepts::.
  3432. This function is used to set a terminal's foreground process group
  3433. ID. The argument FILEDES is a descriptor which specifies the
  3434. terminal; PGID specifies the process group. The calling process
  3435. must be a member of the same session as PGID and must have the same
  3436. controlling terminal.
  3437. For terminal access purposes, this function is treated as output.
  3438. If it is called from a background process on its controlling
  3439. terminal, normally all processes in the process group are sent a
  3440. ‘SIGTTOU’ signal. The exception is if the calling process itself
  3441. is ignoring or blocking ‘SIGTTOU’ signals, in which case the
  3442. operation is performed and no signal is sent.
  3443. If successful, ‘tcsetpgrp’ returns ‘0’. A return value of ‘-1’
  3444. indicates an error. The following ‘errno’ error conditions are
  3445. defined for this function:
  3446. ‘EBADF’
  3447. The FILEDES argument is not a valid file descriptor.
  3448. ‘EINVAL’
  3449. The PGID argument is not valid.
  3450. ‘ENOSYS’
  3451. The system doesn't support job control.
  3452. ‘ENOTTY’
  3453. The FILEDES isn't the controlling terminal of the calling
  3454. process.
  3455. ‘EPERM’
  3456. The PGID isn't a process group in the same session as the
  3457. calling process.
  3458. -- Function: pid_t tcgetsid (int FILDES)
  3459. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3460. Concepts::.
  3461. This function is used to obtain the process group ID of the session
  3462. for which the terminal specified by FILDES is the controlling
  3463. terminal. If the call is successful the group ID is returned.
  3464. Otherwise the return value is ‘(pid_t) -1’ and the global variable
  3465. ‘errno’ is set to the following value:
  3466. ‘EBADF’
  3467. The FILEDES argument is not a valid file descriptor.
  3468. ‘ENOTTY’
  3469. The calling process does not have a controlling terminal, or
  3470. the file is not the controlling terminal.
  3471. 
  3472. File: libc.info, Node: Name Service Switch, Next: Users and Groups, Prev: Job Control, Up: Top
  3473. 30 System Databases and Name Service Switch
  3474. *******************************************
  3475. Various functions in the C Library need to be configured to work
  3476. correctly in the local environment. Traditionally, this was done by
  3477. using files (e.g., ‘/etc/passwd’), but other nameservices (like the
  3478. Network Information Service (NIS) and the Domain Name Service (DNS))
  3479. became popular, and were hacked into the C library, usually with a fixed
  3480. search order.
  3481. The GNU C Library contains a cleaner solution to this problem. It is
  3482. designed after a method used by Sun Microsystems in the C library of
  3483. Solaris 2. The GNU C Library follows their name and calls this scheme
  3484. “Name Service Switch” (NSS).
  3485. Though the interface might be similar to Sun's version there is no
  3486. common code. We never saw any source code of Sun's implementation and
  3487. so the internal interface is incompatible. This also manifests in the
  3488. file names we use as we will see later.
  3489. * Menu:
  3490. * NSS Basics:: What is this NSS good for.
  3491. * NSS Configuration File:: Configuring NSS.
  3492. * NSS Module Internals:: How does it work internally.
  3493. * Extending NSS:: What to do to add services or databases.
  3494. 
  3495. File: libc.info, Node: NSS Basics, Next: NSS Configuration File, Prev: Name Service Switch, Up: Name Service Switch
  3496. 30.1 NSS Basics
  3497. ===============
  3498. The basic idea is to put the implementation of the different services
  3499. offered to access the databases in separate modules. This has some
  3500. advantages:
  3501. 1. Contributors can add new services without adding them to the GNU C
  3502. Library.
  3503. 2. The modules can be updated separately.
  3504. 3. The C library image is smaller.
  3505. To fulfill the first goal above, the ABI of the modules will be
  3506. described below. For getting the implementation of a new service right
  3507. it is important to understand how the functions in the modules get
  3508. called. They are in no way designed to be used by the programmer
  3509. directly. Instead the programmer should only use the documented and
  3510. standardized functions to access the databases.
  3511. The databases available in the NSS are
  3512. ‘aliases’
  3513. Mail aliases
  3514. ‘ethers’
  3515. Ethernet numbers,
  3516. ‘group’
  3517. Groups of users, *note Group Database::.
  3518. ‘gshadow’
  3519. Group passphrase hashes and related information.
  3520. ‘hosts’
  3521. Host names and numbers, *note Host Names::.
  3522. ‘initgroups’
  3523. Supplementary group access list.
  3524. ‘netgroup’
  3525. Network wide list of host and users, *note Netgroup Database::.
  3526. ‘networks’
  3527. Network names and numbers, *note Networks Database::.
  3528. ‘passwd’
  3529. User identities, *note User Database::.
  3530. ‘protocols’
  3531. Network protocols, *note Protocols Database::.
  3532. ‘publickey’
  3533. Public keys for Secure RPC.
  3534. ‘rpc’
  3535. Remote procedure call names and numbers.
  3536. ‘services’
  3537. Network services, *note Services Database::.
  3538. ‘shadow’
  3539. User passphrase hashes and related information.
  3540. More databases may be added later.
  3541. 
  3542. File: libc.info, Node: NSS Configuration File, Next: NSS Module Internals, Prev: NSS Basics, Up: Name Service Switch
  3543. 30.2 The NSS Configuration File
  3544. ===============================
  3545. Somehow the NSS code must be told about the wishes of the user. For
  3546. this reason there is the file ‘/etc/nsswitch.conf’. For each database,
  3547. this file contains a specification of how the lookup process should
  3548. work. The file could look like this:
  3549. # /etc/nsswitch.conf
  3550. #
  3551. # Name Service Switch configuration file.
  3552. #
  3553. passwd: db files
  3554. shadow: files
  3555. group: db files
  3556. hosts: files dns
  3557. networks: files
  3558. ethers: db files
  3559. protocols: db files
  3560. rpc: db files
  3561. services: db files
  3562. The first column is the database as you can guess from the table
  3563. above. The rest of the line specifies how the lookup process works.
  3564. Please note that you specify the way it works for each database
  3565. individually. This cannot be done with the old way of a monolithic
  3566. implementation.
  3567. The configuration specification for each database can contain two
  3568. different items:
  3569. • the service specification like ‘files’, ‘db’, or ‘nis’.
  3570. • the reaction on lookup result like ‘[NOTFOUND=return]’.
  3571. * Menu:
  3572. * Services in the NSS configuration:: Service names in the NSS configuration.
  3573. * Actions in the NSS configuration:: React appropriately to the lookup result.
  3574. * Notes on NSS Configuration File:: Things to take care about while
  3575. configuring NSS.
  3576. 
  3577. File: libc.info, Node: Services in the NSS configuration, Next: Actions in the NSS configuration, Prev: NSS Configuration File, Up: NSS Configuration File
  3578. 30.2.1 Services in the NSS configuration File
  3579. ---------------------------------------------
  3580. The above example file mentions five different services: ‘files’, ‘db’,
  3581. ‘dns’, ‘nis’, and ‘nisplus’. This does not mean these services are
  3582. available on all sites and neither does it mean these are all the
  3583. services which will ever be available.
  3584. In fact, these names are simply strings which the NSS code uses to
  3585. find the implicitly addressed functions. The internal interface will be
  3586. described later. Visible to the user are the modules which implement an
  3587. individual service.
  3588. Assume the service NAME shall be used for a lookup. The code for
  3589. this service is implemented in a module called ‘libnss_NAME’. On a
  3590. system supporting shared libraries this is in fact a shared library with
  3591. the name (for example) ‘libnss_NAME.so.2’. The number at the end is the
  3592. currently used version of the interface which will not change
  3593. frequently. Normally the user should not have to be cognizant of these
  3594. files since they should be placed in a directory where they are found
  3595. automatically. Only the names of all available services are important.
  3596. Lastly, some system software may make use of the NSS configuration
  3597. file to store their own configuration for similar purposes. Examples of
  3598. this include the ‘automount’ service which is used by ‘autofs’.
  3599. 
  3600. File: libc.info, Node: Actions in the NSS configuration, Next: Notes on NSS Configuration File, Prev: Services in the NSS configuration, Up: NSS Configuration File
  3601. 30.2.2 Actions in the NSS configuration
  3602. ---------------------------------------
  3603. The second item in the specification gives the user much finer control
  3604. on the lookup process. Action items are placed between two service
  3605. names and are written within brackets. The general form is
  3606. ‘[’ ( ‘!’? STATUS ‘=’ ACTION )+ ‘]’
  3607. where
  3608. STATUS ⇒ success | notfound | unavail | tryagain
  3609. ACTION ⇒ return | continue
  3610. The case of the keywords is insignificant. The STATUS values are the
  3611. results of a call to a lookup function of a specific service. They
  3612. mean:
  3613. ‘success’
  3614. No error occurred and the wanted entry is returned. The default
  3615. action for this is ‘return’.
  3616. ‘notfound’
  3617. The lookup process works ok but the needed value was not found.
  3618. The default action is ‘continue’.
  3619. ‘unavail’
  3620. The service is permanently unavailable. This can either mean the
  3621. needed file is not available, or, for DNS, the server is not
  3622. available or does not allow queries. The default action is
  3623. ‘continue’.
  3624. ‘tryagain’
  3625. The service is temporarily unavailable. This could mean a file is
  3626. locked or a server currently cannot accept more connections. The
  3627. default action is ‘continue’.
  3628. The ACTION values mean:
  3629. ‘return’
  3630. If the status matches, stop the lookup process at this service
  3631. specification. If an entry is available, provide it to the
  3632. application. If an error occurred, report it to the application.
  3633. In case of a prior ‘merge’ action, the data is combined with
  3634. previous lookup results, as explained below.
  3635. ‘continue’
  3636. If the status matches, proceed with the lookup process at the next
  3637. entry, discarding the result of the current lookup (and any merged
  3638. data). An exception is the ‘initgroups’ database and the ‘success’
  3639. status, where ‘continue’ acts like ‘merge’ below.
  3640. ‘merge’
  3641. Proceed with the lookup process, retaining the current lookup
  3642. result. This action is useful only with the ‘success’ status. If
  3643. a subsequent service lookup succeeds and has a matching ‘return’
  3644. specification, the results are merged, the lookup process ends, and
  3645. the merged results are returned to the application. If the
  3646. following service has a matching ‘merge’ action, the lookup process
  3647. continues, retaining the combined data from this and any previous
  3648. lookups.
  3649. After a ‘merge’ action, errors from subsequent lookups are ignored,
  3650. and the data gathered so far will be returned.
  3651. The ‘merge’ only applies to the ‘success’ status. It is currently
  3652. implemented for the ‘group’ database and its group members field,
  3653. ‘gr_mem’. If specified for other databases, it causes the lookup
  3654. to fail (if the STATUS matches).
  3655. When processing ‘merge’ for ‘group’ membership, the group GID and
  3656. name must be identical for both entries. If only one or the other
  3657. is a match, the behavior is undefined.
  3658. If we have a line like
  3659. ethers: nisplus [NOTFOUND=return] db files
  3660. this is equivalent to
  3661. ethers: nisplus [SUCCESS=return NOTFOUND=return UNAVAIL=continue
  3662. TRYAGAIN=continue]
  3663. db [SUCCESS=return NOTFOUND=continue UNAVAIL=continue
  3664. TRYAGAIN=continue]
  3665. files
  3666. (except that it would have to be written on one line). The default
  3667. value for the actions are normally what you want, and only need to be
  3668. changed in exceptional cases.
  3669. If the optional ‘!’ is placed before the STATUS this means the
  3670. following action is used for all statuses but STATUS itself. I.e., ‘!’
  3671. is negation as in the C language (and others).
  3672. Before we explain the exception which makes this action item
  3673. necessary one more remark: obviously it makes no sense to add another
  3674. action item after the ‘files’ service. Since there is no other service
  3675. following the action _always_ is ‘return’.
  3676. Now, why is this ‘[NOTFOUND=return]’ action useful? To understand
  3677. this we should know that the ‘nisplus’ service is often complete; i.e.,
  3678. if an entry is not available in the NIS+ tables it is not available
  3679. anywhere else. This is what is expressed by this action item: it is
  3680. useless to examine further services since they will not give us a
  3681. result.
  3682. The situation would be different if the NIS+ service is not available
  3683. because the machine is booting. In this case the return value of the
  3684. lookup function is not ‘notfound’ but instead ‘unavail’. And as you can
  3685. see in the complete form above: in this situation the ‘db’ and ‘files’
  3686. services are used. Neat, isn't it? The system administrator need not
  3687. pay special care for the time the system is not completely ready to work
  3688. (while booting or shutdown or network problems).
  3689. 
  3690. File: libc.info, Node: Notes on NSS Configuration File, Prev: Actions in the NSS configuration, Up: NSS Configuration File
  3691. 30.2.3 Notes on the NSS Configuration File
  3692. ------------------------------------------
  3693. Finally a few more hints. The NSS implementation is not completely
  3694. helpless if ‘/etc/nsswitch.conf’ does not exist. For all supported
  3695. databases there is a default value so it should normally be possible to
  3696. get the system running even if the file is corrupted or missing.
  3697. For the ‘hosts’ and ‘networks’ databases the default value is ‘files
  3698. dns’. I.e., local configuration will override the contents of the
  3699. domain name system (DNS).
  3700. The ‘passwd’, ‘group’, and ‘shadow’ databases was traditionally
  3701. handled in a special way. The appropriate files in the ‘/etc’ directory
  3702. were read but if an entry with a name starting with a ‘+’ character was
  3703. found NIS was used. This kind of lookup was removed and now the default
  3704. value for the services is ‘files’. libnss_compat no longer depends on
  3705. libnsl and can be used without NIS.
  3706. For all other databases the default value is ‘files’.
  3707. A second point is that the user should try to optimize the lookup
  3708. process. The different service have different response times. A simple
  3709. file look up on a local file could be fast, but if the file is long and
  3710. the needed entry is near the end of the file this may take quite some
  3711. time. In this case it might be better to use the ‘db’ service which
  3712. allows fast local access to large data sets.
  3713. Often the situation is that some global information like NIS must be
  3714. used. So it is unavoidable to use service entries like ‘nis’ etc. But
  3715. one should avoid slow services like this if possible.
  3716. 
  3717. File: libc.info, Node: NSS Module Internals, Next: Extending NSS, Prev: NSS Configuration File, Up: Name Service Switch
  3718. 30.3 NSS Module Internals
  3719. =========================
  3720. Now it is time to describe what the modules look like. The functions
  3721. contained in a module are identified by their names. I.e., there is no
  3722. jump table or the like. How this is done is of no interest here; those
  3723. interested in this topic should read about Dynamic Linking.
  3724. * Menu:
  3725. * NSS Module Names:: Construction of the interface function of
  3726. the NSS modules.
  3727. * NSS Modules Interface:: Programming interface in the NSS module
  3728. functions.
  3729. 
  3730. File: libc.info, Node: NSS Module Names, Next: NSS Modules Interface, Prev: NSS Module Internals, Up: NSS Module Internals
  3731. 30.3.1 The Naming Scheme of the NSS Modules
  3732. -------------------------------------------
  3733. The name of each function consists of various parts:
  3734. _nss_SERVICE_FUNCTION
  3735. SERVICE of course corresponds to the name of the module this function
  3736. is found in.(1) The FUNCTION part is derived from the interface
  3737. function in the C library itself. If the user calls the function
  3738. ‘gethostbyname’ and the service used is ‘files’ the function
  3739. _nss_files_gethostbyname_r
  3740. in the module
  3741. libnss_files.so.2
  3742. is used. You see, what is explained above in not the whole truth. In
  3743. fact the NSS modules only contain reentrant versions of the lookup
  3744. functions. I.e., if the user would call the ‘gethostbyname_r’ function
  3745. this also would end in the above function. For all user interface
  3746. functions the C library maps this call to a call to the reentrant
  3747. function. For reentrant functions this is trivial since the interface
  3748. is (nearly) the same. For the non-reentrant version the library keeps
  3749. internal buffers which are used to replace the user supplied buffer.
  3750. I.e., the reentrant functions _can_ have counterparts. No service
  3751. module is forced to have functions for all databases and all kinds to
  3752. access them. If a function is not available it is simply treated as if
  3753. the function would return ‘unavail’ (*note Actions in the NSS
  3754. configuration::).
  3755. The file name ‘libnss_files.so.2’ would be on a Solaris 2 system
  3756. ‘nss_files.so.2’. This is the difference mentioned above. Sun's NSS
  3757. modules are usable as modules which get indirectly loaded only.
  3758. The NSS modules in the GNU C Library are prepared to be used as
  3759. normal libraries themselves. This is _not_ true at the moment, though.
  3760. However, the organization of the name space in the modules does not make
  3761. it impossible like it is for Solaris. Now you can see why the modules
  3762. are still libraries.(2)
  3763. ---------- Footnotes ----------
  3764. (1) Now you might ask why this information is duplicated. The answer
  3765. is that we want to make it possible to link directly with these shared
  3766. objects.
  3767. (2) There is a second explanation: we were too lazy to change the
  3768. Makefiles to allow the generation of shared objects not starting with
  3769. ‘lib’ but don't tell this to anybody.
  3770. 
  3771. File: libc.info, Node: NSS Modules Interface, Prev: NSS Module Names, Up: NSS Module Internals
  3772. 30.3.2 The Interface of the Function in NSS Modules
  3773. ---------------------------------------------------
  3774. Now we know about the functions contained in the modules. It is now
  3775. time to describe the types. When we mentioned the reentrant versions of
  3776. the functions above, this means there are some additional arguments
  3777. (compared with the standard, non-reentrant versions). The prototypes
  3778. for the non-reentrant and reentrant versions of our function above are:
  3779. struct hostent *gethostbyname (const char *name)
  3780. int gethostbyname_r (const char *name, struct hostent *result_buf,
  3781. char *buf, size_t buflen, struct hostent **result,
  3782. int *h_errnop)
  3783. The actual prototype of the function in the NSS modules in this case is
  3784. enum nss_status _nss_files_gethostbyname_r (const char *name,
  3785. struct hostent *result_buf,
  3786. char *buf, size_t buflen,
  3787. int *errnop, int *h_errnop)
  3788. I.e., the interface function is in fact the reentrant function with
  3789. the change of the return value, the omission of the RESULT parameter,
  3790. and the addition of the ERRNOP parameter. While the user-level function
  3791. returns a pointer to the result the reentrant function return an ‘enum
  3792. nss_status’ value:
  3793. ‘NSS_STATUS_TRYAGAIN’
  3794. numeric value ‘-2’
  3795. ‘NSS_STATUS_UNAVAIL’
  3796. numeric value ‘-1’
  3797. ‘NSS_STATUS_NOTFOUND’
  3798. numeric value ‘0’
  3799. ‘NSS_STATUS_SUCCESS’
  3800. numeric value ‘1’
  3801. Now you see where the action items of the ‘/etc/nsswitch.conf’ file are
  3802. used.
  3803. If you study the source code you will find there is a fifth value:
  3804. ‘NSS_STATUS_RETURN’. This is an internal use only value, used by a few
  3805. functions in places where none of the above value can be used. If
  3806. necessary the source code should be examined to learn about the details.
  3807. In case the interface function has to return an error it is important
  3808. that the correct error code is stored in ‘*ERRNOP’. Some return status
  3809. values have only one associated error code, others have more.
  3810. ‘NSS_STATUS_TRYAGAIN’ ‘EAGAIN’ One of the functions used ran
  3811. temporarily out of resources or a
  3812. service is currently not
  3813. available.
  3814. ‘ERANGE’ The provided buffer is not large
  3815. enough. The function should be
  3816. called again with a larger buffer.
  3817. ‘NSS_STATUS_UNAVAIL’ ‘ENOENT’ A necessary input file cannot be
  3818. found.
  3819. ‘NSS_STATUS_NOTFOUND’ ‘ENOENT’ The requested entry is not
  3820. available.
  3821. ‘NSS_STATUS_NOTFOUND’ ‘SUCCESS’ There are no entries. Use this to
  3822. avoid returning errors for
  3823. inactive services which may be
  3824. enabled at a later time. This is
  3825. not the same as the service being
  3826. temporarily unavailable.
  3827. These are proposed values. There can be other error codes and the
  3828. described error codes can have different meaning. *With one exception:*
  3829. when returning ‘NSS_STATUS_TRYAGAIN’ the error code ‘ERANGE’ _must_ mean
  3830. that the user provided buffer is too small. Everything else is
  3831. non-critical.
  3832. In statically linked programs, the main application and NSS modules
  3833. do not share the same thread-local variable ‘errno’, which is the reason
  3834. why there is an explicit ERRNOP function argument.
  3835. The above function has something special which is missing for almost
  3836. all the other module functions. There is an argument H_ERRNOP. This
  3837. points to a variable which will be filled with the error code in case
  3838. the execution of the function fails for some reason. (In statically
  3839. linked programs, the thread-local variable ‘h_errno’ is not shared with
  3840. the main application.)
  3841. The ‘getXXXbyYYY’ functions are the most important functions in the
  3842. NSS modules. But there are others which implement the other ways to
  3843. access system databases (say for the user database, there are
  3844. ‘setpwent’, ‘getpwent’, and ‘endpwent’). These will be described in
  3845. more detail later. Here we give a general way to determine the
  3846. signature of the module function:
  3847. • the return value is ‘enum nss_status’;
  3848. • the name (*note NSS Module Names::);
  3849. • the first arguments are identical to the arguments of the
  3850. non-reentrant function;
  3851. • the next four arguments are:
  3852. ‘STRUCT_TYPE *result_buf’
  3853. pointer to buffer where the result is stored. ‘STRUCT_TYPE’
  3854. is normally a struct which corresponds to the database.
  3855. ‘char *buffer’
  3856. pointer to a buffer where the function can store additional
  3857. data for the result etc.
  3858. ‘size_t buflen’
  3859. length of the buffer pointed to by BUFFER.
  3860. ‘int *errnop’
  3861. the low-level error code to return to the application. If the
  3862. return value is not ‘NSS_STATUS_SUCCESS’, ‘*ERRNOP’ needs to
  3863. be set to a non-zero value. An NSS module should never set
  3864. ‘*ERRNOP’ to zero. The value ‘ERANGE’ is special, as
  3865. described above.
  3866. • possibly a last argument H_ERRNOP, for the host name and network
  3867. name lookup functions. If the return value is not
  3868. ‘NSS_STATUS_SUCCESS’, ‘*H_ERRNOP’ needs to be set to a non-zero
  3869. value. A generic error code is ‘NETDB_INTERNAL’, which instructs
  3870. the caller to examine ‘*ERRNOP’ for further details. (This
  3871. includes the ‘ERANGE’ special case.)
  3872. This table is correct for all functions but the ‘set...ent’ and
  3873. ‘end...ent’ functions.
  3874. 
  3875. File: libc.info, Node: Extending NSS, Prev: NSS Module Internals, Up: Name Service Switch
  3876. 30.4 Extending NSS
  3877. ==================
  3878. One of the advantages of NSS mentioned above is that it can be extended
  3879. quite easily. There are two ways in which the extension can happen:
  3880. adding another database or adding another service. The former is
  3881. normally done only by the C library developers. It is here only
  3882. important to remember that adding another database is independent from
  3883. adding another service because a service need not support all databases
  3884. or lookup functions.
  3885. A designer/implementer of a new service is therefore free to choose
  3886. the databases s/he is interested in and leave the rest for later (or
  3887. completely aside).
  3888. * Menu:
  3889. * Adding another Service to NSS:: What is to do to add a new service.
  3890. * NSS Module Function Internals:: Guidelines for writing new NSS
  3891. service functions.
  3892. 
  3893. File: libc.info, Node: Adding another Service to NSS, Next: NSS Module Function Internals, Prev: Extending NSS, Up: Extending NSS
  3894. 30.4.1 Adding another Service to NSS
  3895. ------------------------------------
  3896. The sources for a new service need not (and should not) be part of the
  3897. GNU C Library itself. The developer retains complete control over the
  3898. sources and its development. The links between the C library and the
  3899. new service module consists solely of the interface functions.
  3900. Each module is designed following a specific interface specification.
  3901. For now the version is 2 (the interface in version 1 was not adequate)
  3902. and this manifests in the version number of the shared library object of
  3903. the NSS modules: they have the extension ‘.2’. If the interface changes
  3904. again in an incompatible way, this number will be increased. Modules
  3905. using the old interface will still be usable.
  3906. Developers of a new service will have to make sure that their module
  3907. is created using the correct interface number. This means the file
  3908. itself must have the correct name and on ELF systems the “soname”
  3909. (Shared Object Name) must also have this number. Building a module from
  3910. a bunch of object files on an ELF system using GNU CC could be done like
  3911. this:
  3912. gcc -shared -o libnss_NAME.so.2 -Wl,-soname,libnss_NAME.so.2 OBJECTS
  3913. *note Options for Linking: (gcc)Link Options, to learn more about this
  3914. command line.
  3915. To use the new module the library must be able to find it. This can
  3916. be achieved by using options for the dynamic linker so that it will
  3917. search the directory where the binary is placed. For an ELF system this
  3918. could be done by adding the wanted directory to the value of
  3919. ‘LD_LIBRARY_PATH’.
  3920. But this is not always possible since some programs (those which run
  3921. under IDs which do not belong to the user) ignore this variable.
  3922. Therefore the stable version of the module should be placed into a
  3923. directory which is searched by the dynamic linker. Normally this should
  3924. be the directory ‘$prefix/lib’, where ‘$prefix’ corresponds to the value
  3925. given to configure using the ‘--prefix’ option. But be careful: this
  3926. should only be done if it is clear the module does not cause any harm.
  3927. System administrators should be careful.
  3928. 
  3929. File: libc.info, Node: NSS Module Function Internals, Prev: Adding another Service to NSS, Up: Extending NSS
  3930. 30.4.2 Internals of the NSS Module Functions
  3931. --------------------------------------------
  3932. Until now we only provided the syntactic interface for the functions in
  3933. the NSS module. In fact there is not much more we can say since the
  3934. implementation obviously is different for each function. But a few
  3935. general rules must be followed by all functions.
  3936. In fact there are four kinds of different functions which may appear
  3937. in the interface. All derive from the traditional ones for system
  3938. databases. DB in the following table is normally an abbreviation for
  3939. the database (e.g., it is ‘pw’ for the user database).
  3940. ‘enum nss_status _nss_DATABASE_setDBent (void)’
  3941. This function prepares the service for following operations. For a
  3942. simple file based lookup this means files could be opened, for
  3943. other services this function simply is a noop.
  3944. One special case for this function is that it takes an additional
  3945. argument for some DATABASEs (i.e., the interface is ‘int setDBent
  3946. (int)’). *note Host Names::, which describes the ‘sethostent’
  3947. function.
  3948. The return value should be NSS_STATUS_SUCCESS or according to the
  3949. table above in case of an error (*note NSS Modules Interface::).
  3950. ‘enum nss_status _nss_DATABASE_endDBent (void)’
  3951. This function simply closes all files which are still open or
  3952. removes buffer caches. If there are no files or buffers to remove
  3953. this is again a simple noop.
  3954. There normally is no return value other than NSS_STATUS_SUCCESS.
  3955. ‘enum nss_status _nss_DATABASE_getDBent_r (STRUCTURE *result, char *buffer, size_t buflen, int *errnop)’
  3956. Since this function will be called several times in a row to
  3957. retrieve one entry after the other it must keep some kind of state.
  3958. But this also means the functions are not really reentrant. They
  3959. are reentrant only in that simultaneous calls to this function will
  3960. not try to write the retrieved data in the same place (as it would
  3961. be the case for the non-reentrant functions); instead, it writes to
  3962. the structure pointed to by the RESULT parameter. But the calls
  3963. share a common state and in the case of a file access this means
  3964. they return neighboring entries in the file.
  3965. The buffer of length BUFLEN pointed to by BUFFER can be used for
  3966. storing some additional data for the result. It is _not_
  3967. guaranteed that the same buffer will be passed for the next call of
  3968. this function. Therefore one must not misuse this buffer to save
  3969. some state information from one call to another.
  3970. Before the function returns with a failure code, the implementation
  3971. should store the value of the local ‘errno’ variable in the
  3972. variable pointed to be ERRNOP. This is important to guarantee the
  3973. module working in statically linked programs. The stored value
  3974. must not be zero.
  3975. As explained above this function could also have an additional last
  3976. argument. This depends on the database used; it happens only for
  3977. ‘host’ and ‘networks’.
  3978. The function shall return ‘NSS_STATUS_SUCCESS’ as long as there are
  3979. more entries. When the last entry was read it should return
  3980. ‘NSS_STATUS_NOTFOUND’. When the buffer given as an argument is too
  3981. small for the data to be returned ‘NSS_STATUS_TRYAGAIN’ should be
  3982. returned. When the service was not formerly initialized by a call
  3983. to ‘_nss_DATABASE_setDBent’ all return values allowed for this
  3984. function can also be returned here.
  3985. ‘enum nss_status _nss_DATABASE_getDBbyXX_r (PARAMS, STRUCTURE *result, char *buffer, size_t buflen, int *errnop)’
  3986. This function shall return the entry from the database which is
  3987. addressed by the PARAMS. The type and number of these arguments
  3988. vary. It must be individually determined by looking to the
  3989. user-level interface functions. All arguments given to the
  3990. non-reentrant version are here described by PARAMS.
  3991. The result must be stored in the structure pointed to by RESULT.
  3992. If there are additional data to return (say strings, where the
  3993. RESULT structure only contains pointers) the function must use the
  3994. BUFFER of length BUFLEN. There must not be any references to
  3995. non-constant global data.
  3996. The implementation of this function should honor the STAYOPEN flag
  3997. set by the ‘setDBent’ function whenever this makes sense.
  3998. Before the function returns, the implementation should store the
  3999. value of the local ‘errno’ variable in the variable pointed to by
  4000. ERRNOP. This is important to guarantee the module works in
  4001. statically linked programs.
  4002. Again, this function takes an additional last argument for the
  4003. ‘host’ and ‘networks’ database.
  4004. The return value should as always follow the rules given above
  4005. (*note NSS Modules Interface::).
  4006. 
  4007. File: libc.info, Node: Users and Groups, Next: System Management, Prev: Name Service Switch, Up: Top
  4008. 31 Users and Groups
  4009. *******************
  4010. Every user who can log in on the system is identified by a unique number
  4011. called the “user ID”. Each process has an effective user ID which says
  4012. which user's access permissions it has.
  4013. Users are classified into “groups” for access control purposes. Each
  4014. process has one or more “group ID values” which say which groups the
  4015. process can use for access to files.
  4016. The effective user and group IDs of a process collectively form its
  4017. “persona”. This determines which files the process can access.
  4018. Normally, a process inherits its persona from the parent process, but
  4019. under special circumstances a process can change its persona and thus
  4020. change its access permissions.
  4021. Each file in the system also has a user ID and a group ID. Access
  4022. control works by comparing the user and group IDs of the file with those
  4023. of the running process.
  4024. The system keeps a database of all the registered users, and another
  4025. database of all the defined groups. There are library functions you can
  4026. use to examine these databases.
  4027. * Menu:
  4028. * User and Group IDs:: Each user has a unique numeric ID;
  4029. likewise for groups.
  4030. * Process Persona:: The user IDs and group IDs of a process.
  4031. * Why Change Persona:: Why a program might need to change
  4032. its user and/or group IDs.
  4033. * How Change Persona:: Changing the user and group IDs.
  4034. * Reading Persona:: How to examine the user and group IDs.
  4035. * Setting User ID:: Functions for setting the user ID.
  4036. * Setting Groups:: Functions for setting the group IDs.
  4037. * Enable/Disable Setuid:: Turning setuid access on and off.
  4038. * Setuid Program Example:: The pertinent parts of one sample program.
  4039. * Tips for Setuid:: How to avoid granting unlimited access.
  4040. * Who Logged In:: Getting the name of the user who logged in,
  4041. or of the real user ID of the current process.
  4042. * User Accounting Database:: Keeping information about users and various
  4043. actions in databases.
  4044. * User Database:: Functions and data structures for
  4045. accessing the user database.
  4046. * Group Database:: Functions and data structures for
  4047. accessing the group database.
  4048. * Database Example:: Example program showing the use of database
  4049. inquiry functions.
  4050. * Netgroup Database:: Functions for accessing the netgroup database.
  4051. 
  4052. File: libc.info, Node: User and Group IDs, Next: Process Persona, Up: Users and Groups
  4053. 31.1 User and Group IDs
  4054. =======================
  4055. Each user account on a computer system is identified by a “user name”
  4056. (or “login name”) and “user ID”. Normally, each user name has a unique
  4057. user ID, but it is possible for several login names to have the same
  4058. user ID. The user names and corresponding user IDs are stored in a data
  4059. base which you can access as described in *note User Database::.
  4060. Users are classified in “groups”. Each user name belongs to one
  4061. “default group” and may also belong to any number of “supplementary
  4062. groups”. Users who are members of the same group can share resources
  4063. (such as files) that are not accessible to users who are not a member of
  4064. that group. Each group has a “group name” and “group ID”. *Note Group
  4065. Database::, for how to find information about a group ID or group name.
  4066. 
  4067. File: libc.info, Node: Process Persona, Next: Why Change Persona, Prev: User and Group IDs, Up: Users and Groups
  4068. 31.2 The Persona of a Process
  4069. =============================
  4070. At any time, each process has an “effective user ID”, a “effective group
  4071. ID”, and a set of “supplementary group IDs”. These IDs determine the
  4072. privileges of the process. They are collectively called the “persona”
  4073. of the process, because they determine "who it is" for purposes of
  4074. access control.
  4075. Your login shell starts out with a persona which consists of your
  4076. user ID, your default group ID, and your supplementary group IDs (if you
  4077. are in more than one group). In normal circumstances, all your other
  4078. processes inherit these values.
  4079. A process also has a “real user ID” which identifies the user who
  4080. created the process, and a “real group ID” which identifies that user's
  4081. default group. These values do not play a role in access control, so we
  4082. do not consider them part of the persona. But they are also important.
  4083. Both the real and effective user ID can be changed during the
  4084. lifetime of a process. *Note Why Change Persona::.
  4085. For details on how a process's effective user ID and group IDs affect
  4086. its permission to access files, see *note Access Permission::.
  4087. The effective user ID of a process also controls permissions for
  4088. sending signals using the ‘kill’ function. *Note Signaling Another
  4089. Process::.
  4090. Finally, there are many operations which can only be performed by a
  4091. process whose effective user ID is zero. A process with this user ID is
  4092. a “privileged process”. Commonly the user name ‘root’ is associated
  4093. with user ID 0, but there may be other user names with this ID.
  4094. 
  4095. File: libc.info, Node: Why Change Persona, Next: How Change Persona, Prev: Process Persona, Up: Users and Groups
  4096. 31.3 Why Change the Persona of a Process?
  4097. =========================================
  4098. The most obvious situation where it is necessary for a process to change
  4099. its user and/or group IDs is the ‘login’ program. When ‘login’ starts
  4100. running, its user ID is ‘root’. Its job is to start a shell whose user
  4101. and group IDs are those of the user who is logging in. (To accomplish
  4102. this fully, ‘login’ must set the real user and group IDs as well as its
  4103. persona. But this is a special case.)
  4104. The more common case of changing persona is when an ordinary user
  4105. program needs access to a resource that wouldn't ordinarily be
  4106. accessible to the user actually running it.
  4107. For example, you may have a file that is controlled by your program
  4108. but that shouldn't be read or modified directly by other users, either
  4109. because it implements some kind of locking protocol, or because you want
  4110. to preserve the integrity or privacy of the information it contains.
  4111. This kind of restricted access can be implemented by having the program
  4112. change its effective user or group ID to match that of the resource.
  4113. Thus, imagine a game program that saves scores in a file. The game
  4114. program itself needs to be able to update this file no matter who is
  4115. running it, but if users can write the file without going through the
  4116. game, they can give themselves any scores they like. Some people
  4117. consider this undesirable, or even reprehensible. It can be prevented
  4118. by creating a new user ID and login name (say, ‘games’) to own the
  4119. scores file, and make the file writable only by this user. Then, when
  4120. the game program wants to update this file, it can change its effective
  4121. user ID to be that for ‘games’. In effect, the program must adopt the
  4122. persona of ‘games’ so it can write to the scores file.
  4123. 
  4124. File: libc.info, Node: How Change Persona, Next: Reading Persona, Prev: Why Change Persona, Up: Users and Groups
  4125. 31.4 How an Application Can Change Persona
  4126. ==========================================
  4127. The ability to change the persona of a process can be a source of
  4128. unintentional privacy violations, or even intentional abuse. Because of
  4129. the potential for problems, changing persona is restricted to special
  4130. circumstances.
  4131. You can't arbitrarily set your user ID or group ID to anything you
  4132. want; only privileged processes can do that. Instead, the normal way
  4133. for a program to change its persona is that it has been set up in
  4134. advance to change to a particular user or group. This is the function
  4135. of the setuid and setgid bits of a file's access mode. *Note Permission
  4136. Bits::.
  4137. When the setuid bit of an executable file is on, executing that file
  4138. gives the process a third user ID: the “file user ID”. This ID is set to
  4139. the owner ID of the file. The system then changes the effective user ID
  4140. to the file user ID. The real user ID remains as it was. Likewise, if
  4141. the setgid bit is on, the process is given a “file group ID” equal to
  4142. the group ID of the file, and its effective group ID is changed to the
  4143. file group ID.
  4144. If a process has a file ID (user or group), then it can at any time
  4145. change its effective ID to its real ID and back to its file ID. Programs
  4146. use this feature to relinquish their special privileges except when they
  4147. actually need them. This makes it less likely that they can be tricked
  4148. into doing something inappropriate with their privileges.
  4149. *Portability Note:* Older systems do not have file IDs. To determine
  4150. if a system has this feature, you can test the compiler define
  4151. ‘_POSIX_SAVED_IDS’. (In the POSIX standard, file IDs are known as saved
  4152. IDs.)
  4153. *Note File Attributes::, for a more general discussion of file modes
  4154. and accessibility.
  4155. 
  4156. File: libc.info, Node: Reading Persona, Next: Setting User ID, Prev: How Change Persona, Up: Users and Groups
  4157. 31.5 Reading the Persona of a Process
  4158. =====================================
  4159. Here are detailed descriptions of the functions for reading the user and
  4160. group IDs of a process, both real and effective. To use these
  4161. facilities, you must include the header files ‘sys/types.h’ and
  4162. ‘unistd.h’.
  4163. -- Data Type: uid_t
  4164. This is an integer data type used to represent user IDs. In the
  4165. GNU C Library, this is an alias for ‘unsigned int’.
  4166. -- Data Type: gid_t
  4167. This is an integer data type used to represent group IDs. In the
  4168. GNU C Library, this is an alias for ‘unsigned int’.
  4169. -- Function: uid_t getuid (void)
  4170. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  4171. Concepts::.
  4172. The ‘getuid’ function returns the real user ID of the process.
  4173. -- Function: gid_t getgid (void)
  4174. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  4175. Concepts::.
  4176. The ‘getgid’ function returns the real group ID of the process.
  4177. -- Function: uid_t geteuid (void)
  4178. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  4179. Concepts::.
  4180. The ‘geteuid’ function returns the effective user ID of the
  4181. process.
  4182. -- Function: gid_t getegid (void)
  4183. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  4184. Concepts::.
  4185. The ‘getegid’ function returns the effective group ID of the
  4186. process.
  4187. -- Function: int getgroups (int COUNT, gid_t *GROUPS)
  4188. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  4189. Concepts::.
  4190. The ‘getgroups’ function is used to inquire about the supplementary
  4191. group IDs of the process. Up to COUNT of these group IDs are
  4192. stored in the array GROUPS; the return value from the function is
  4193. the number of group IDs actually stored. If COUNT is smaller than
  4194. the total number of supplementary group IDs, then ‘getgroups’
  4195. returns a value of ‘-1’ and ‘errno’ is set to ‘EINVAL’.
  4196. If COUNT is zero, then ‘getgroups’ just returns the total number of
  4197. supplementary group IDs. On systems that do not support
  4198. supplementary groups, this will always be zero.
  4199. Here's how to use ‘getgroups’ to read all the supplementary group
  4200. IDs:
  4201. gid_t *
  4202. read_all_groups (void)
  4203. {
  4204. int ngroups = getgroups (0, NULL);
  4205. gid_t *groups
  4206. = (gid_t *) xmalloc (ngroups * sizeof (gid_t));
  4207. int val = getgroups (ngroups, groups);
  4208. if (val < 0)
  4209. {
  4210. free (groups);
  4211. return NULL;
  4212. }
  4213. return groups;
  4214. }
  4215. 
  4216. File: libc.info, Node: Setting User ID, Next: Setting Groups, Prev: Reading Persona, Up: Users and Groups
  4217. 31.6 Setting the User ID
  4218. ========================
  4219. This section describes the functions for altering the user ID (real
  4220. and/or effective) of a process. To use these facilities, you must
  4221. include the header files ‘sys/types.h’ and ‘unistd.h’.
  4222. -- Function: int seteuid (uid_t NEWEUID)
  4223. Preliminary: | MT-Safe | AS-Unsafe lock | AC-Unsafe lock | *Note
  4224. POSIX Safety Concepts::.
  4225. This function sets the effective user ID of a process to NEWEUID,
  4226. provided that the process is allowed to change its effective user
  4227. ID. A privileged process (effective user ID zero) can change its
  4228. effective user ID to any legal value. An unprivileged process with
  4229. a file user ID can change its effective user ID to its real user ID
  4230. or to its file user ID. Otherwise, a process may not change its
  4231. effective user ID at all.
  4232. The ‘seteuid’ function returns a value of ‘0’ to indicate
  4233. successful completion, and a value of ‘-1’ to indicate an error.
  4234. The following ‘errno’ error conditions are defined for this
  4235. function:
  4236. ‘EINVAL’
  4237. The value of the NEWEUID argument is invalid.
  4238. ‘EPERM’
  4239. The process may not change to the specified ID.
  4240. Older systems (those without the ‘_POSIX_SAVED_IDS’ feature) do not
  4241. have this function.
  4242. -- Function: int setuid (uid_t NEWUID)
  4243. Preliminary: | MT-Safe | AS-Unsafe lock | AC-Unsafe lock | *Note
  4244. POSIX Safety Concepts::.
  4245. If the calling process is privileged, this function sets both the
  4246. real and effective user IDs of the process to NEWUID. It also
  4247. deletes the file user ID of the process, if any. NEWUID may be any
  4248. legal value. (Once this has been done, there is no way to recover
  4249. the old effective user ID.)
  4250. If the process is not privileged, and the system supports the
  4251. ‘_POSIX_SAVED_IDS’ feature, then this function behaves like
  4252. ‘seteuid’.
  4253. The return values and error conditions are the same as for
  4254. ‘seteuid’.
  4255. -- Function: int setreuid (uid_t RUID, uid_t EUID)
  4256. Preliminary: | MT-Safe | AS-Unsafe lock | AC-Unsafe lock | *Note
  4257. POSIX Safety Concepts::.
  4258. This function sets the real user ID of the process to RUID and the
  4259. effective user ID to EUID. If RUID is ‘-1’, it means not to change
  4260. the real user ID; likewise if EUID is ‘-1’, it means not to change
  4261. the effective user ID.
  4262. The ‘setreuid’ function exists for compatibility with 4.3 BSD Unix,
  4263. which does not support file IDs. You can use this function to swap
  4264. the effective and real user IDs of the process. (Privileged
  4265. processes are not limited to this particular usage.) If file IDs
  4266. are supported, you should use that feature instead of this
  4267. function. *Note Enable/Disable Setuid::.
  4268. The return value is ‘0’ on success and ‘-1’ on failure. The
  4269. following ‘errno’ error conditions are defined for this function:
  4270. ‘EPERM’
  4271. The process does not have the appropriate privileges; you do
  4272. not have permission to change to the specified ID.
  4273. 
  4274. File: libc.info, Node: Setting Groups, Next: Enable/Disable Setuid, Prev: Setting User ID, Up: Users and Groups
  4275. 31.7 Setting the Group IDs
  4276. ==========================
  4277. This section describes the functions for altering the group IDs (real
  4278. and effective) of a process. To use these facilities, you must include
  4279. the header files ‘sys/types.h’ and ‘unistd.h’.
  4280. -- Function: int setegid (gid_t NEWGID)
  4281. Preliminary: | MT-Safe | AS-Unsafe lock | AC-Unsafe lock | *Note
  4282. POSIX Safety Concepts::.
  4283. This function sets the effective group ID of the process to NEWGID,
  4284. provided that the process is allowed to change its group ID. Just
  4285. as with ‘seteuid’, if the process is privileged it may change its
  4286. effective group ID to any value; if it isn't, but it has a file
  4287. group ID, then it may change to its real group ID or file group ID;
  4288. otherwise it may not change its effective group ID.
  4289. Note that a process is only privileged if its effective _user_ ID
  4290. is zero. The effective group ID only affects access permissions.
  4291. The return values and error conditions for ‘setegid’ are the same
  4292. as those for ‘seteuid’.
  4293. This function is only present if ‘_POSIX_SAVED_IDS’ is defined.
  4294. -- Function: int setgid (gid_t NEWGID)
  4295. Preliminary: | MT-Safe | AS-Unsafe lock | AC-Unsafe lock | *Note
  4296. POSIX Safety Concepts::.
  4297. This function sets both the real and effective group ID of the
  4298. process to NEWGID, provided that the process is privileged. It
  4299. also deletes the file group ID, if any.
  4300. If the process is not privileged, then ‘setgid’ behaves like
  4301. ‘setegid’.
  4302. The return values and error conditions for ‘setgid’ are the same as
  4303. those for ‘seteuid’.
  4304. -- Function: int setregid (gid_t RGID, gid_t EGID)
  4305. Preliminary: | MT-Safe | AS-Unsafe lock | AC-Unsafe lock | *Note
  4306. POSIX Safety Concepts::.
  4307. This function sets the real group ID of the process to RGID and the
  4308. effective group ID to EGID. If RGID is ‘-1’, it means not to
  4309. change the real group ID; likewise if EGID is ‘-1’, it means not to
  4310. change the effective group ID.
  4311. The ‘setregid’ function is provided for compatibility with 4.3 BSD
  4312. Unix, which does not support file IDs. You can use this function
  4313. to swap the effective and real group IDs of the process.
  4314. (Privileged processes are not limited to this usage.) If file IDs
  4315. are supported, you should use that feature instead of using this
  4316. function. *Note Enable/Disable Setuid::.
  4317. The return values and error conditions for ‘setregid’ are the same
  4318. as those for ‘setreuid’.
  4319. ‘setuid’ and ‘setgid’ behave differently depending on whether the
  4320. effective user ID at the time is zero. If it is not zero, they behave
  4321. like ‘seteuid’ and ‘setegid’. If it is, they change both effective and
  4322. real IDs and delete the file ID. To avoid confusion, we recommend you
  4323. always use ‘seteuid’ and ‘setegid’ except when you know the effective
  4324. user ID is zero and your intent is to change the persona permanently.
  4325. This case is rare--most of the programs that need it, such as ‘login’
  4326. and ‘su’, have already been written.
  4327. Note that if your program is setuid to some user other than ‘root’,
  4328. there is no way to drop privileges permanently.
  4329. The system also lets privileged processes change their supplementary
  4330. group IDs. To use ‘setgroups’ or ‘initgroups’, your programs should
  4331. include the header file ‘grp.h’.
  4332. -- Function: int setgroups (size_t COUNT, const gid_t *GROUPS)
  4333. Preliminary: | MT-Safe | AS-Unsafe lock | AC-Unsafe lock | *Note
  4334. POSIX Safety Concepts::.
  4335. This function sets the process's supplementary group IDs. It can
  4336. only be called from privileged processes. The COUNT argument
  4337. specifies the number of group IDs in the array GROUPS.
  4338. This function returns ‘0’ if successful and ‘-1’ on error. The
  4339. following ‘errno’ error conditions are defined for this function:
  4340. ‘EPERM’
  4341. The calling process is not privileged.
  4342. -- Function: int initgroups (const char *USER, gid_t GROUP)
  4343. Preliminary: | MT-Safe locale | AS-Unsafe dlopen plugin heap lock |
  4344. AC-Unsafe corrupt mem fd lock | *Note POSIX Safety Concepts::.
  4345. The ‘initgroups’ function sets the process's supplementary group
  4346. IDs to be the normal default for the user name USER. The group
  4347. GROUP is automatically included.
  4348. This function works by scanning the group database for all the
  4349. groups USER belongs to. It then calls ‘setgroups’ with the list it
  4350. has constructed.
  4351. The return values and error conditions are the same as for
  4352. ‘setgroups’.
  4353. If you are interested in the groups a particular user belongs to, but
  4354. do not want to change the process's supplementary group IDs, you can use
  4355. ‘getgrouplist’. To use ‘getgrouplist’, your programs should include the
  4356. header file ‘grp.h’.
  4357. -- Function: int getgrouplist (const char *USER, gid_t GROUP, gid_t
  4358. *GROUPS, int *NGROUPS)
  4359. Preliminary: | MT-Safe locale | AS-Unsafe dlopen plugin heap lock |
  4360. AC-Unsafe corrupt mem fd lock | *Note POSIX Safety Concepts::.
  4361. The ‘getgrouplist’ function scans the group database for all the
  4362. groups USER belongs to. Up to *NGROUPS group IDs corresponding to
  4363. these groups are stored in the array GROUPS; the return value from
  4364. the function is the number of group IDs actually stored. If
  4365. *NGROUPS is smaller than the total number of groups found, then
  4366. ‘getgrouplist’ returns a value of ‘-1’ and stores the actual number
  4367. of groups in *NGROUPS. The group GROUP is automatically included
  4368. in the list of groups returned by ‘getgrouplist’.
  4369. Here's how to use ‘getgrouplist’ to read all supplementary groups
  4370. for USER:
  4371. gid_t *
  4372. supplementary_groups (char *user)
  4373. {
  4374. int ngroups = 16;
  4375. gid_t *groups
  4376. = (gid_t *) xmalloc (ngroups * sizeof (gid_t));
  4377. struct passwd *pw = getpwnam (user);
  4378. if (pw == NULL)
  4379. return NULL;
  4380. if (getgrouplist (pw->pw_name, pw->pw_gid, groups, &ngroups) < 0)
  4381. {
  4382. groups = xreallocarray (ngroups, sizeof *groups);
  4383. getgrouplist (pw->pw_name, pw->pw_gid, groups, &ngroups);
  4384. }
  4385. return groups;
  4386. }
  4387. 
  4388. File: libc.info, Node: Enable/Disable Setuid, Next: Setuid Program Example, Prev: Setting Groups, Up: Users and Groups
  4389. 31.8 Enabling and Disabling Setuid Access
  4390. =========================================
  4391. A typical setuid program does not need its special access all of the
  4392. time. It's a good idea to turn off this access when it isn't needed, so
  4393. it can't possibly give unintended access.
  4394. If the system supports the ‘_POSIX_SAVED_IDS’ feature, you can
  4395. accomplish this with ‘seteuid’. When the game program starts, its real
  4396. user ID is ‘jdoe’, its effective user ID is ‘games’, and its saved user
  4397. ID is also ‘games’. The program should record both user ID values once
  4398. at the beginning, like this:
  4399. user_user_id = getuid ();
  4400. game_user_id = geteuid ();
  4401. Then it can turn off game file access with
  4402. seteuid (user_user_id);
  4403. and turn it on with
  4404. seteuid (game_user_id);
  4405. Throughout this process, the real user ID remains ‘jdoe’ and the file
  4406. user ID remains ‘games’, so the program can always set its effective
  4407. user ID to either one.
  4408. On other systems that don't support file user IDs, you can turn
  4409. setuid access on and off by using ‘setreuid’ to swap the real and
  4410. effective user IDs of the process, as follows:
  4411. setreuid (geteuid (), getuid ());
  4412. This special case is always allowed--it cannot fail.
  4413. Why does this have the effect of toggling the setuid access? Suppose
  4414. a game program has just started, and its real user ID is ‘jdoe’ while
  4415. its effective user ID is ‘games’. In this state, the game can write the
  4416. scores file. If it swaps the two uids, the real becomes ‘games’ and the
  4417. effective becomes ‘jdoe’; now the program has only ‘jdoe’ access.
  4418. Another swap brings ‘games’ back to the effective user ID and restores
  4419. access to the scores file.
  4420. In order to handle both kinds of systems, test for the saved user ID
  4421. feature with a preprocessor conditional, like this:
  4422. #ifdef _POSIX_SAVED_IDS
  4423. seteuid (user_user_id);
  4424. #else
  4425. setreuid (geteuid (), getuid ());
  4426. #endif
  4427. 
  4428. File: libc.info, Node: Setuid Program Example, Next: Tips for Setuid, Prev: Enable/Disable Setuid, Up: Users and Groups
  4429. 31.9 Setuid Program Example
  4430. ===========================
  4431. Here's an example showing how to set up a program that changes its
  4432. effective user ID.
  4433. This is part of a game program called ‘caber-toss’ that manipulates a
  4434. file ‘scores’ that should be writable only by the game program itself.
  4435. The program assumes that its executable file will be installed with the
  4436. setuid bit set and owned by the same user as the ‘scores’ file.
  4437. Typically, a system administrator will set up an account like ‘games’
  4438. for this purpose.
  4439. The executable file is given mode ‘4755’, so that doing an ‘ls -l’ on
  4440. it produces output like:
  4441. -rwsr-xr-x 1 games 184422 Jul 30 15:17 caber-toss
  4442. The setuid bit shows up in the file modes as the ‘s’.
  4443. The scores file is given mode ‘644’, and doing an ‘ls -l’ on it
  4444. shows:
  4445. -rw-r--r-- 1 games 0 Jul 31 15:33 scores
  4446. Here are the parts of the program that show how to set up the changed
  4447. user ID. This program is conditionalized so that it makes use of the
  4448. file IDs feature if it is supported, and otherwise uses ‘setreuid’ to
  4449. swap the effective and real user IDs.
  4450. #include <stdio.h>
  4451. #include <sys/types.h>
  4452. #include <unistd.h>
  4453. #include <stdlib.h>
  4454. /* Remember the effective and real UIDs. */
  4455. static uid_t euid, ruid;
  4456. /* Restore the effective UID to its original value. */
  4457. void
  4458. do_setuid (void)
  4459. {
  4460. int status;
  4461. #ifdef _POSIX_SAVED_IDS
  4462. status = seteuid (euid);
  4463. #else
  4464. status = setreuid (ruid, euid);
  4465. #endif
  4466. if (status < 0) {
  4467. fprintf (stderr, "Couldn't set uid.\n");
  4468. exit (status);
  4469. }
  4470. }
  4471. /* Set the effective UID to the real UID. */
  4472. void
  4473. undo_setuid (void)
  4474. {
  4475. int status;
  4476. #ifdef _POSIX_SAVED_IDS
  4477. status = seteuid (ruid);
  4478. #else
  4479. status = setreuid (euid, ruid);
  4480. #endif
  4481. if (status < 0) {
  4482. fprintf (stderr, "Couldn't set uid.\n");
  4483. exit (status);
  4484. }
  4485. }
  4486. /* Main program. */
  4487. int
  4488. main (void)
  4489. {
  4490. /* Remember the real and effective user IDs. */
  4491. ruid = getuid ();
  4492. euid = geteuid ();
  4493. undo_setuid ();
  4494. /* Do the game and record the score. */
  4495. ...
  4496. }
  4497. Notice how the first thing the ‘main’ function does is to set the
  4498. effective user ID back to the real user ID. This is so that any other
  4499. file accesses that are performed while the user is playing the game use
  4500. the real user ID for determining permissions. Only when the program
  4501. needs to open the scores file does it switch back to the file user ID,
  4502. like this:
  4503. /* Record the score. */
  4504. int
  4505. record_score (int score)
  4506. {
  4507. FILE *stream;
  4508. char *myname;
  4509. /* Open the scores file. */
  4510. do_setuid ();
  4511. stream = fopen (SCORES_FILE, "a");
  4512. undo_setuid ();
  4513. /* Write the score to the file. */
  4514. if (stream)
  4515. {
  4516. myname = cuserid (NULL);
  4517. if (score < 0)
  4518. fprintf (stream, "%10s: Couldn't lift the caber.\n", myname);
  4519. else
  4520. fprintf (stream, "%10s: %d feet.\n", myname, score);
  4521. fclose (stream);
  4522. return 0;
  4523. }
  4524. else
  4525. return -1;
  4526. }
  4527. 
  4528. File: libc.info, Node: Tips for Setuid, Next: Who Logged In, Prev: Setuid Program Example, Up: Users and Groups
  4529. 31.10 Tips for Writing Setuid Programs
  4530. ======================================
  4531. It is easy for setuid programs to give the user access that isn't
  4532. intended--in fact, if you want to avoid this, you need to be careful.
  4533. Here are some guidelines for preventing unintended access and minimizing
  4534. its consequences when it does occur:
  4535. • Don't have ‘setuid’ programs with privileged user IDs such as
  4536. ‘root’ unless it is absolutely necessary. If the resource is
  4537. specific to your particular program, it's better to define a new,
  4538. nonprivileged user ID or group ID just to manage that resource.
  4539. It's better if you can write your program to use a special group
  4540. than a special user.
  4541. • Be cautious about using the ‘exec’ functions in combination with
  4542. changing the effective user ID. Don't let users of your program
  4543. execute arbitrary programs under a changed user ID. Executing a
  4544. shell is especially bad news. Less obviously, the ‘execlp’ and
  4545. ‘execvp’ functions are a potential risk (since the program they
  4546. execute depends on the user's ‘PATH’ environment variable).
  4547. If you must ‘exec’ another program under a changed ID, specify an
  4548. absolute file name (*note File Name Resolution::) for the
  4549. executable, and make sure that the protections on that executable
  4550. and _all_ containing directories are such that ordinary users
  4551. cannot replace it with some other program.
  4552. You should also check the arguments passed to the program to make
  4553. sure they do not have unexpected effects. Likewise, you should
  4554. examine the environment variables. Decide which arguments and
  4555. variables are safe, and reject all others.
  4556. You should never use ‘system’ in a privileged program, because it
  4557. invokes a shell.
  4558. • Only use the user ID controlling the resource in the part of the
  4559. program that actually uses that resource. When you're finished
  4560. with it, restore the effective user ID back to the actual user's
  4561. user ID. *Note Enable/Disable Setuid::.
  4562. • If the ‘setuid’ part of your program needs to access other files
  4563. besides the controlled resource, it should verify that the real
  4564. user would ordinarily have permission to access those files. You
  4565. can use the ‘access’ function (*note Access Permission::) to check
  4566. this; it uses the real user and group IDs, rather than the
  4567. effective IDs.
  4568. 
  4569. File: libc.info, Node: Who Logged In, Next: User Accounting Database, Prev: Tips for Setuid, Up: Users and Groups
  4570. 31.11 Identifying Who Logged In
  4571. ===============================
  4572. You can use the functions listed in this section to determine the login
  4573. name of the user who is running a process, and the name of the user who
  4574. logged in the current session. See also the function ‘getuid’ and
  4575. friends (*note Reading Persona::). How this information is collected by
  4576. the system and how to control/add/remove information from the background
  4577. storage is described in *note User Accounting Database::.
  4578. The ‘getlogin’ function is declared in ‘unistd.h’, while ‘cuserid’
  4579. and ‘L_cuserid’ are declared in ‘stdio.h’.
  4580. -- Function: char * getlogin (void)
  4581. Preliminary: | MT-Unsafe race:getlogin race:utent sig:ALRM timer
  4582. locale | AS-Unsafe dlopen plugin heap lock | AC-Unsafe corrupt lock
  4583. fd mem | *Note POSIX Safety Concepts::.
  4584. The ‘getlogin’ function returns a pointer to a string containing
  4585. the name of the user logged in on the controlling terminal of the
  4586. process, or a null pointer if this information cannot be
  4587. determined. The string is statically allocated and might be
  4588. overwritten on subsequent calls to this function or to ‘cuserid’.
  4589. -- Function: char * cuserid (char *STRING)
  4590. Preliminary: | MT-Unsafe race:cuserid/!string locale | AS-Unsafe
  4591. dlopen plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note
  4592. POSIX Safety Concepts::.
  4593. The ‘cuserid’ function returns a pointer to a string containing a
  4594. user name associated with the effective ID of the process. If
  4595. STRING is not a null pointer, it should be an array that can hold
  4596. at least ‘L_cuserid’ characters; the string is returned in this
  4597. array. Otherwise, a pointer to a string in a static area is
  4598. returned. This string is statically allocated and might be
  4599. overwritten on subsequent calls to this function or to ‘getlogin’.
  4600. The use of this function is deprecated since it is marked to be
  4601. withdrawn in XPG4.2 and has already been removed from newer
  4602. revisions of POSIX.1.
  4603. -- Macro: int L_cuserid
  4604. An integer constant that indicates how long an array you might need
  4605. to store a user name.
  4606. These functions let your program identify positively the user who is
  4607. running or the user who logged in this session. (These can differ when
  4608. setuid programs are involved; see *note Process Persona::.) The user
  4609. cannot do anything to fool these functions.
  4610. For most purposes, it is more useful to use the environment variable
  4611. ‘LOGNAME’ to find out who the user is. This is more flexible precisely
  4612. because the user can set ‘LOGNAME’ arbitrarily. *Note Standard
  4613. Environment::.
  4614. 
  4615. File: libc.info, Node: User Accounting Database, Next: User Database, Prev: Who Logged In, Up: Users and Groups
  4616. 31.12 The User Accounting Database
  4617. ==================================
  4618. Most Unix-like operating systems keep track of logged in users by
  4619. maintaining a user accounting database. This user accounting database
  4620. stores for each terminal, who has logged on, at what time, the process
  4621. ID of the user's login shell, etc., etc., but also stores information
  4622. about the run level of the system, the time of the last system reboot,
  4623. and possibly more.
  4624. The user accounting database typically lives in ‘/etc/utmp’,
  4625. ‘/var/adm/utmp’ or ‘/var/run/utmp’. However, these files should *never*
  4626. be accessed directly. For reading information from and writing
  4627. information to the user accounting database, the functions described in
  4628. this section should be used.
  4629. * Menu:
  4630. * Manipulating the Database:: Scanning and modifying the user
  4631. accounting database.
  4632. * XPG Functions:: A standardized way for doing the same thing.
  4633. * Logging In and Out:: Functions from BSD that modify the user
  4634. accounting database.
  4635. 
  4636. File: libc.info, Node: Manipulating the Database, Next: XPG Functions, Up: User Accounting Database
  4637. 31.12.1 Manipulating the User Accounting Database
  4638. -------------------------------------------------
  4639. These functions and the corresponding data structures are declared in
  4640. the header file ‘utmp.h’.
  4641. -- Data Type: struct exit_status
  4642. The ‘exit_status’ data structure is used to hold information about
  4643. the exit status of processes marked as ‘DEAD_PROCESS’ in the user
  4644. accounting database.
  4645. ‘short int e_termination’
  4646. The exit status of the process.
  4647. ‘short int e_exit’
  4648. The exit status of the process.
  4649. -- Data Type: struct utmp
  4650. The ‘utmp’ data structure is used to hold information about entries
  4651. in the user accounting database. On GNU systems it has the
  4652. following members:
  4653. ‘short int ut_type’
  4654. Specifies the type of login; one of ‘EMPTY’, ‘RUN_LVL’,
  4655. ‘BOOT_TIME’, ‘OLD_TIME’, ‘NEW_TIME’, ‘INIT_PROCESS’,
  4656. ‘LOGIN_PROCESS’, ‘USER_PROCESS’, ‘DEAD_PROCESS’ or
  4657. ‘ACCOUNTING’.
  4658. ‘pid_t ut_pid’
  4659. The process ID number of the login process.
  4660. ‘char ut_line[]’
  4661. The device name of the tty (without ‘/dev/’).
  4662. ‘char ut_id[]’
  4663. The inittab ID of the process.
  4664. ‘char ut_user[]’
  4665. The user's login name.
  4666. ‘char ut_host[]’
  4667. The name of the host from which the user logged in.
  4668. ‘struct exit_status ut_exit’
  4669. The exit status of a process marked as ‘DEAD_PROCESS’.
  4670. ‘long ut_session’
  4671. The Session ID, used for windowing.
  4672. ‘struct timeval ut_tv’
  4673. Time the entry was made. For entries of type ‘OLD_TIME’ this
  4674. is the time when the system clock changed, and for entries of
  4675. type ‘NEW_TIME’ this is the time the system clock was set to.
  4676. ‘int32_t ut_addr_v6[4]’
  4677. The Internet address of a remote host.
  4678. The ‘ut_type’, ‘ut_pid’, ‘ut_id’, ‘ut_tv’, and ‘ut_host’ fields are
  4679. not available on all systems. Portable applications therefore should be
  4680. prepared for these situations. To help do this the ‘utmp.h’ header
  4681. provides macros ‘_HAVE_UT_TYPE’, ‘_HAVE_UT_PID’, ‘_HAVE_UT_ID’,
  4682. ‘_HAVE_UT_TV’, and ‘_HAVE_UT_HOST’ if the respective field is available.
  4683. The programmer can handle the situations by using ‘#ifdef’ in the
  4684. program code.
  4685. The following macros are defined for use as values for the ‘ut_type’
  4686. member of the ‘utmp’ structure. The values are integer constants.
  4687. ‘EMPTY’
  4688. This macro is used to indicate that the entry contains no valid
  4689. user accounting information.
  4690. ‘RUN_LVL’
  4691. This macro is used to identify the system's runlevel.
  4692. ‘BOOT_TIME’
  4693. This macro is used to identify the time of system boot.
  4694. ‘OLD_TIME’
  4695. This macro is used to identify the time when the system clock
  4696. changed.
  4697. ‘NEW_TIME’
  4698. This macro is used to identify the time after the system clock
  4699. changed.
  4700. ‘INIT_PROCESS’
  4701. This macro is used to identify a process spawned by the init
  4702. process.
  4703. ‘LOGIN_PROCESS’
  4704. This macro is used to identify the session leader of a logged in
  4705. user.
  4706. ‘USER_PROCESS’
  4707. This macro is used to identify a user process.
  4708. ‘DEAD_PROCESS’
  4709. This macro is used to identify a terminated process.
  4710. ‘ACCOUNTING’
  4711. ???
  4712. The size of the ‘ut_line’, ‘ut_id’, ‘ut_user’ and ‘ut_host’ arrays
  4713. can be found using the ‘sizeof’ operator.
  4714. Many older systems have, instead of an ‘ut_tv’ member, an ‘ut_time’
  4715. member, usually of type ‘time_t’, for representing the time associated
  4716. with the entry. Therefore, for backwards compatibility only, ‘utmp.h’
  4717. defines ‘ut_time’ as an alias for ‘ut_tv.tv_sec’.
  4718. -- Function: void setutent (void)
  4719. Preliminary: | MT-Unsafe race:utent | AS-Unsafe lock | AC-Unsafe
  4720. lock fd | *Note POSIX Safety Concepts::.
  4721. This function opens the user accounting database to begin scanning
  4722. it. You can then call ‘getutent’, ‘getutid’ or ‘getutline’ to read
  4723. entries and ‘pututline’ to write entries.
  4724. If the database is already open, it resets the input to the
  4725. beginning of the database.
  4726. -- Function: struct utmp * getutent (void)
  4727. Preliminary: | MT-Unsafe init race:utent race:utentbuf sig:ALRM
  4728. timer | AS-Unsafe heap lock | AC-Unsafe lock fd mem | *Note POSIX
  4729. Safety Concepts::.
  4730. The ‘getutent’ function reads the next entry from the user
  4731. accounting database. It returns a pointer to the entry, which is
  4732. statically allocated and may be overwritten by subsequent calls to
  4733. ‘getutent’. You must copy the contents of the structure if you
  4734. wish to save the information or you can use the ‘getutent_r’
  4735. function which stores the data in a user-provided buffer.
  4736. A null pointer is returned in case no further entry is available.
  4737. -- Function: void endutent (void)
  4738. Preliminary: | MT-Unsafe race:utent | AS-Unsafe lock | AC-Unsafe
  4739. lock fd | *Note POSIX Safety Concepts::.
  4740. This function closes the user accounting database.
  4741. -- Function: struct utmp * getutid (const struct utmp *ID)
  4742. Preliminary: | MT-Unsafe init race:utent sig:ALRM timer | AS-Unsafe
  4743. lock heap | AC-Unsafe lock mem fd | *Note POSIX Safety Concepts::.
  4744. This function searches forward from the current point in the
  4745. database for an entry that matches ID. If the ‘ut_type’ member of
  4746. the ID structure is one of ‘RUN_LVL’, ‘BOOT_TIME’, ‘OLD_TIME’ or
  4747. ‘NEW_TIME’ the entries match if the ‘ut_type’ members are
  4748. identical. If the ‘ut_type’ member of the ID structure is
  4749. ‘INIT_PROCESS’, ‘LOGIN_PROCESS’, ‘USER_PROCESS’ or ‘DEAD_PROCESS’,
  4750. the entries match if the ‘ut_type’ member of the entry read from
  4751. the database is one of these four, and the ‘ut_id’ members match.
  4752. However if the ‘ut_id’ member of either the ID structure or the
  4753. entry read from the database is empty it checks if the ‘ut_line’
  4754. members match instead. If a matching entry is found, ‘getutid’
  4755. returns a pointer to the entry, which is statically allocated, and
  4756. may be overwritten by a subsequent call to ‘getutent’, ‘getutid’ or
  4757. ‘getutline’. You must copy the contents of the structure if you
  4758. wish to save the information.
  4759. A null pointer is returned in case the end of the database is
  4760. reached without a match.
  4761. The ‘getutid’ function may cache the last read entry. Therefore,
  4762. if you are using ‘getutid’ to search for multiple occurrences, it
  4763. is necessary to zero out the static data after each call.
  4764. Otherwise ‘getutid’ could just return a pointer to the same entry
  4765. over and over again.
  4766. -- Function: struct utmp * getutline (const struct utmp *LINE)
  4767. Preliminary: | MT-Unsafe init race:utent sig:ALRM timer | AS-Unsafe
  4768. heap lock | AC-Unsafe lock fd mem | *Note POSIX Safety Concepts::.
  4769. This function searches forward from the current point in the
  4770. database until it finds an entry whose ‘ut_type’ value is
  4771. ‘LOGIN_PROCESS’ or ‘USER_PROCESS’, and whose ‘ut_line’ member
  4772. matches the ‘ut_line’ member of the LINE structure. If it finds
  4773. such an entry, it returns a pointer to the entry which is
  4774. statically allocated, and may be overwritten by a subsequent call
  4775. to ‘getutent’, ‘getutid’ or ‘getutline’. You must copy the
  4776. contents of the structure if you wish to save the information.
  4777. A null pointer is returned in case the end of the database is
  4778. reached without a match.
  4779. The ‘getutline’ function may cache the last read entry. Therefore
  4780. if you are using ‘getutline’ to search for multiple occurrences, it
  4781. is necessary to zero out the static data after each call.
  4782. Otherwise ‘getutline’ could just return a pointer to the same entry
  4783. over and over again.
  4784. -- Function: struct utmp * pututline (const struct utmp *UTMP)
  4785. Preliminary: | MT-Unsafe race:utent sig:ALRM timer | AS-Unsafe lock
  4786. | AC-Unsafe lock fd | *Note POSIX Safety Concepts::.
  4787. The ‘pututline’ function inserts the entry ‘*UTMP’ at the
  4788. appropriate place in the user accounting database. If it finds
  4789. that it is not already at the correct place in the database, it
  4790. uses ‘getutid’ to search for the position to insert the entry,
  4791. however this will not modify the static structure returned by
  4792. ‘getutent’, ‘getutid’ and ‘getutline’. If this search fails, the
  4793. entry is appended to the database.
  4794. The ‘pututline’ function returns a pointer to a copy of the entry
  4795. inserted in the user accounting database, or a null pointer if the
  4796. entry could not be added. The following ‘errno’ error conditions
  4797. are defined for this function:
  4798. ‘EPERM’
  4799. The process does not have the appropriate privileges; you
  4800. cannot modify the user accounting database.
  4801. All the ‘get*’ functions mentioned before store the information they
  4802. return in a static buffer. This can be a problem in multi-threaded
  4803. programs since the data returned for the request is overwritten by the
  4804. return value data in another thread. Therefore the GNU C Library
  4805. provides as extensions three more functions which return the data in a
  4806. user-provided buffer.
  4807. -- Function: int getutent_r (struct utmp *BUFFER, struct utmp **RESULT)
  4808. Preliminary: | MT-Unsafe race:utent sig:ALRM timer | AS-Unsafe lock
  4809. | AC-Unsafe lock fd | *Note POSIX Safety Concepts::.
  4810. The ‘getutent_r’ is equivalent to the ‘getutent’ function. It
  4811. returns the next entry from the database. But instead of storing
  4812. the information in a static buffer it stores it in the buffer
  4813. pointed to by the parameter BUFFER.
  4814. If the call was successful, the function returns ‘0’ and the
  4815. pointer variable pointed to by the parameter RESULT contains a
  4816. pointer to the buffer which contains the result (this is most
  4817. probably the same value as BUFFER). If something went wrong during
  4818. the execution of ‘getutent_r’ the function returns ‘-1’.
  4819. This function is a GNU extension.
  4820. -- Function: int getutid_r (const struct utmp *ID, struct utmp *BUFFER,
  4821. struct utmp **RESULT)
  4822. Preliminary: | MT-Unsafe race:utent sig:ALRM timer | AS-Unsafe lock
  4823. | AC-Unsafe lock fd | *Note POSIX Safety Concepts::.
  4824. This function retrieves just like ‘getutid’ the next entry matching
  4825. the information stored in ID. But the result is stored in the
  4826. buffer pointed to by the parameter BUFFER.
  4827. If successful the function returns ‘0’ and the pointer variable
  4828. pointed to by the parameter RESULT contains a pointer to the buffer
  4829. with the result (probably the same as RESULT. If not successful
  4830. the function return ‘-1’.
  4831. This function is a GNU extension.
  4832. -- Function: int getutline_r (const struct utmp *LINE, struct utmp
  4833. *BUFFER, struct utmp **RESULT)
  4834. Preliminary: | MT-Unsafe race:utent sig:ALRM timer | AS-Unsafe lock
  4835. | AC-Unsafe lock fd | *Note POSIX Safety Concepts::.
  4836. This function retrieves just like ‘getutline’ the next entry
  4837. matching the information stored in LINE. But the result is stored
  4838. in the buffer pointed to by the parameter BUFFER.
  4839. If successful the function returns ‘0’ and the pointer variable
  4840. pointed to by the parameter RESULT contains a pointer to the buffer
  4841. with the result (probably the same as RESULT. If not successful
  4842. the function return ‘-1’.
  4843. This function is a GNU extension.
  4844. In addition to the user accounting database, most systems keep a
  4845. number of similar databases. For example most systems keep a log file
  4846. with all previous logins (usually in ‘/etc/wtmp’ or ‘/var/log/wtmp’).
  4847. For specifying which database to examine, the following function
  4848. should be used.
  4849. -- Function: int utmpname (const char *FILE)
  4850. Preliminary: | MT-Unsafe race:utent | AS-Unsafe lock heap |
  4851. AC-Unsafe lock mem | *Note POSIX Safety Concepts::.
  4852. The ‘utmpname’ function changes the name of the database to be
  4853. examined to FILE, and closes any previously opened database. By
  4854. default ‘getutent’, ‘getutid’, ‘getutline’ and ‘pututline’ read
  4855. from and write to the user accounting database.
  4856. The following macros are defined for use as the FILE argument:
  4857. -- Macro: char * _PATH_UTMP
  4858. This macro is used to specify the user accounting database.
  4859. -- Macro: char * _PATH_WTMP
  4860. This macro is used to specify the user accounting log file.
  4861. The ‘utmpname’ function returns a value of ‘0’ if the new name was
  4862. successfully stored, and a value of ‘-1’ to indicate an error.
  4863. Note that ‘utmpname’ does not try to open the database, and that
  4864. therefore the return value does not say anything about whether the
  4865. database can be successfully opened.
  4866. Specially for maintaining log-like databases the GNU C Library
  4867. provides the following function:
  4868. -- Function: void updwtmp (const char *WTMP_FILE, const struct utmp
  4869. *UTMP)
  4870. Preliminary: | MT-Unsafe sig:ALRM timer | AS-Unsafe | AC-Unsafe fd
  4871. | *Note POSIX Safety Concepts::.
  4872. The ‘updwtmp’ function appends the entry *UTMP to the database
  4873. specified by WTMP_FILE. For possible values for the WTMP_FILE
  4874. argument see the ‘utmpname’ function.
  4875. *Portability Note:* Although many operating systems provide a subset
  4876. of these functions, they are not standardized. There are often subtle
  4877. differences in the return types, and there are considerable differences
  4878. between the various definitions of ‘struct utmp’. When programming for
  4879. the GNU C Library, it is probably best to stick with the functions
  4880. described in this section. If however, you want your program to be
  4881. portable, consider using the XPG functions described in *note XPG
  4882. Functions::, or take a look at the BSD compatible functions in *note
  4883. Logging In and Out::.
  4884. 
  4885. File: libc.info, Node: XPG Functions, Next: Logging In and Out, Prev: Manipulating the Database, Up: User Accounting Database
  4886. 31.12.2 XPG User Accounting Database Functions
  4887. ----------------------------------------------
  4888. These functions, described in the X/Open Portability Guide, are declared
  4889. in the header file ‘utmpx.h’.
  4890. -- Data Type: struct utmpx
  4891. The ‘utmpx’ data structure contains at least the following members:
  4892. ‘short int ut_type’
  4893. Specifies the type of login; one of ‘EMPTY’, ‘RUN_LVL’,
  4894. ‘BOOT_TIME’, ‘OLD_TIME’, ‘NEW_TIME’, ‘INIT_PROCESS’,
  4895. ‘LOGIN_PROCESS’, ‘USER_PROCESS’ or ‘DEAD_PROCESS’.
  4896. ‘pid_t ut_pid’
  4897. The process ID number of the login process.
  4898. ‘char ut_line[]’
  4899. The device name of the tty (without ‘/dev/’).
  4900. ‘char ut_id[]’
  4901. The inittab ID of the process.
  4902. ‘char ut_user[]’
  4903. The user's login name.
  4904. ‘struct timeval ut_tv’
  4905. Time the entry was made. For entries of type ‘OLD_TIME’ this
  4906. is the time when the system clock changed, and for entries of
  4907. type ‘NEW_TIME’ this is the time the system clock was set to.
  4908. In the GNU C Library, ‘struct utmpx’ is identical to ‘struct utmp’
  4909. except for the fact that including ‘utmpx.h’ does not make visible
  4910. the declaration of ‘struct exit_status’.
  4911. The following macros are defined for use as values for the ‘ut_type’
  4912. member of the ‘utmpx’ structure. The values are integer constants and
  4913. are, in the GNU C Library, identical to the definitions in ‘utmp.h’.
  4914. ‘EMPTY’
  4915. This macro is used to indicate that the entry contains no valid
  4916. user accounting information.
  4917. ‘RUN_LVL’
  4918. This macro is used to identify the system's runlevel.
  4919. ‘BOOT_TIME’
  4920. This macro is used to identify the time of system boot.
  4921. ‘OLD_TIME’
  4922. This macro is used to identify the time when the system clock
  4923. changed.
  4924. ‘NEW_TIME’
  4925. This macro is used to identify the time after the system clock
  4926. changed.
  4927. ‘INIT_PROCESS’
  4928. This macro is used to identify a process spawned by the init
  4929. process.
  4930. ‘LOGIN_PROCESS’
  4931. This macro is used to identify the session leader of a logged in
  4932. user.
  4933. ‘USER_PROCESS’
  4934. This macro is used to identify a user process.
  4935. ‘DEAD_PROCESS’
  4936. This macro is used to identify a terminated process.
  4937. The size of the ‘ut_line’, ‘ut_id’ and ‘ut_user’ arrays can be found
  4938. using the ‘sizeof’ operator.
  4939. -- Function: void setutxent (void)
  4940. Preliminary: | MT-Unsafe race:utent | AS-Unsafe lock | AC-Unsafe
  4941. lock fd | *Note POSIX Safety Concepts::.
  4942. This function is similar to ‘setutent’. In the GNU C Library it is
  4943. simply an alias for ‘setutent’.
  4944. -- Function: struct utmpx * getutxent (void)
  4945. Preliminary: | MT-Unsafe init race:utent sig:ALRM timer | AS-Unsafe
  4946. heap lock | AC-Unsafe lock fd mem | *Note POSIX Safety Concepts::.
  4947. The ‘getutxent’ function is similar to ‘getutent’, but returns a
  4948. pointer to a ‘struct utmpx’ instead of ‘struct utmp’. In the GNU C
  4949. Library it simply is an alias for ‘getutent’.
  4950. -- Function: void endutxent (void)
  4951. Preliminary: | MT-Unsafe race:utent | AS-Unsafe lock | AC-Unsafe
  4952. lock | *Note POSIX Safety Concepts::.
  4953. This function is similar to ‘endutent’. In the GNU C Library it is
  4954. simply an alias for ‘endutent’.
  4955. -- Function: struct utmpx * getutxid (const struct utmpx *ID)
  4956. Preliminary: | MT-Unsafe init race:utent sig:ALRM timer | AS-Unsafe
  4957. lock heap | AC-Unsafe lock mem fd | *Note POSIX Safety Concepts::.
  4958. This function is similar to ‘getutid’, but uses ‘struct utmpx’
  4959. instead of ‘struct utmp’. In the GNU C Library it is simply an
  4960. alias for ‘getutid’.
  4961. -- Function: struct utmpx * getutxline (const struct utmpx *LINE)
  4962. Preliminary: | MT-Unsafe init race:utent sig:ALRM timer | AS-Unsafe
  4963. heap lock | AC-Unsafe lock fd mem | *Note POSIX Safety Concepts::.
  4964. This function is similar to ‘getutid’, but uses ‘struct utmpx’
  4965. instead of ‘struct utmp’. In the GNU C Library it is simply an
  4966. alias for ‘getutline’.
  4967. -- Function: struct utmpx * pututxline (const struct utmpx *UTMP)
  4968. Preliminary: | MT-Unsafe race:utent sig:ALRM timer | AS-Unsafe lock
  4969. | AC-Unsafe lock fd | *Note POSIX Safety Concepts::.
  4970. The ‘pututxline’ function is functionally identical to ‘pututline’,
  4971. but uses ‘struct utmpx’ instead of ‘struct utmp’. In the GNU C
  4972. Library, ‘pututxline’ is simply an alias for ‘pututline’.
  4973. -- Function: int utmpxname (const char *FILE)
  4974. Preliminary: | MT-Unsafe race:utent | AS-Unsafe lock heap |
  4975. AC-Unsafe lock mem | *Note POSIX Safety Concepts::.
  4976. The ‘utmpxname’ function is functionally identical to ‘utmpname’.
  4977. In the GNU C Library, ‘utmpxname’ is simply an alias for
  4978. ‘utmpname’.
  4979. You can translate between a traditional ‘struct utmp’ and an XPG
  4980. ‘struct utmpx’ with the following functions. In the GNU C Library,
  4981. these functions are merely copies, since the two structures are
  4982. identical.
  4983. -- Function: int getutmp (const struct utmpx *UTMPX, struct utmp *UTMP)
  4984. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  4985. Concepts::.
  4986. ‘getutmp’ copies the information, insofar as the structures are
  4987. compatible, from UTMPX to UTMP.
  4988. -- Function: int getutmpx (const struct utmp *UTMP, struct utmpx
  4989. *UTMPX)
  4990. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  4991. Concepts::.
  4992. ‘getutmpx’ copies the information, insofar as the structures are
  4993. compatible, from UTMP to UTMPX.
  4994. 
  4995. File: libc.info, Node: Logging In and Out, Prev: XPG Functions, Up: User Accounting Database
  4996. 31.12.3 Logging In and Out
  4997. --------------------------
  4998. These functions, derived from BSD, are available in the separate
  4999. ‘libutil’ library, and declared in ‘utmp.h’.
  5000. Note that the ‘ut_user’ member of ‘struct utmp’ is called ‘ut_name’
  5001. in BSD. Therefore, ‘ut_name’ is defined as an alias for ‘ut_user’ in
  5002. ‘utmp.h’.
  5003. -- Function: int login_tty (int FILEDES)
  5004. Preliminary: | MT-Unsafe race:ttyname | AS-Unsafe heap lock |
  5005. AC-Unsafe lock fd mem | *Note POSIX Safety Concepts::.
  5006. This function makes FILEDES the controlling terminal of the current
  5007. process, redirects standard input, standard output and standard
  5008. error output to this terminal, and closes FILEDES.
  5009. This function returns ‘0’ on successful completion, and ‘-1’ on
  5010. error.
  5011. -- Function: void login (const struct utmp *ENTRY)
  5012. Preliminary: | MT-Unsafe race:utent sig:ALRM timer | AS-Unsafe lock
  5013. heap | AC-Unsafe lock corrupt fd mem | *Note POSIX Safety
  5014. Concepts::.
  5015. The ‘login’ functions inserts an entry into the user accounting
  5016. database. The ‘ut_line’ member is set to the name of the terminal
  5017. on standard input. If standard input is not a terminal ‘login’
  5018. uses standard output or standard error output to determine the name
  5019. of the terminal. If ‘struct utmp’ has a ‘ut_type’ member, ‘login’
  5020. sets it to ‘USER_PROCESS’, and if there is an ‘ut_pid’ member, it
  5021. will be set to the process ID of the current process. The
  5022. remaining entries are copied from ENTRY.
  5023. A copy of the entry is written to the user accounting log file.
  5024. -- Function: int logout (const char *UT_LINE)
  5025. Preliminary: | MT-Unsafe race:utent sig:ALRM timer | AS-Unsafe lock
  5026. heap | AC-Unsafe lock fd mem | *Note POSIX Safety Concepts::.
  5027. This function modifies the user accounting database to indicate
  5028. that the user on UT_LINE has logged out.
  5029. The ‘logout’ function returns ‘1’ if the entry was successfully
  5030. written to the database, or ‘0’ on error.
  5031. -- Function: void logwtmp (const char *UT_LINE, const char *UT_NAME,
  5032. const char *UT_HOST)
  5033. Preliminary: | MT-Unsafe sig:ALRM timer | AS-Unsafe | AC-Unsafe fd
  5034. | *Note POSIX Safety Concepts::.
  5035. The ‘logwtmp’ function appends an entry to the user accounting log
  5036. file, for the current time and the information provided in the
  5037. UT_LINE, UT_NAME and UT_HOST arguments.
  5038. *Portability Note:* The BSD ‘struct utmp’ only has the ‘ut_line’,
  5039. ‘ut_name’, ‘ut_host’ and ‘ut_time’ members. Older systems do not even
  5040. have the ‘ut_host’ member.
  5041. 
  5042. File: libc.info, Node: User Database, Next: Group Database, Prev: User Accounting Database, Up: Users and Groups
  5043. 31.13 User Database
  5044. ===================
  5045. This section describes how to search and scan the database of registered
  5046. users. The database itself is kept in the file ‘/etc/passwd’ on most
  5047. systems, but on some systems a special network server gives access to
  5048. it.
  5049. Historically, this database included one-way hashes of user
  5050. passphrases, as well as public information about each user (such as
  5051. their user ID and full name). Many of the names of functions and data
  5052. structures associated with this database, and the filename ‘/etc/passwd’
  5053. itself, reflect this history. However, the information in this database
  5054. is available to all users, and it is no longer considered safe to make
  5055. passphrase hashes available to all users, so they have been moved to a
  5056. "shadow" database that can only be accessed with special privileges.
  5057. * Menu:
  5058. * User Data Structure:: What each user record contains.
  5059. * Lookup User:: How to look for a particular user.
  5060. * Scanning All Users:: Scanning the list of all users, one by one.
  5061. * Writing a User Entry:: How a program can rewrite a user's record.
  5062. 
  5063. File: libc.info, Node: User Data Structure, Next: Lookup User, Up: User Database
  5064. 31.13.1 The Data Structure that Describes a User
  5065. ------------------------------------------------
  5066. The functions and data structures for accessing the system user database
  5067. are declared in the header file ‘pwd.h’.
  5068. -- Data Type: struct passwd
  5069. The ‘passwd’ data structure is used to hold information about
  5070. entries in the system user data base. It has at least the
  5071. following members:
  5072. ‘char *pw_name’
  5073. The user's login name.
  5074. ‘char *pw_passwd’
  5075. Historically, this field would hold the one-way hash of the
  5076. user's passphrase. Nowadays, it will almost always be the
  5077. single character ‘x’, indicating that the hash is in the
  5078. shadow database.
  5079. ‘uid_t pw_uid’
  5080. The user ID number.
  5081. ‘gid_t pw_gid’
  5082. The user's default group ID number.
  5083. ‘char *pw_gecos’
  5084. A string typically containing the user's real name, and
  5085. possibly other information such as a phone number.
  5086. ‘char *pw_dir’
  5087. The user's home directory, or initial working directory. This
  5088. might be a null pointer, in which case the interpretation is
  5089. system-dependent.
  5090. ‘char *pw_shell’
  5091. The user's default shell, or the initial program run when the
  5092. user logs in. This might be a null pointer, indicating that
  5093. the system default should be used.
  5094. 
  5095. File: libc.info, Node: Lookup User, Next: Scanning All Users, Prev: User Data Structure, Up: User Database
  5096. 31.13.2 Looking Up One User
  5097. ---------------------------
  5098. You can search the system user database for information about a specific
  5099. user using ‘getpwuid’ or ‘getpwnam’. These functions are declared in
  5100. ‘pwd.h’.
  5101. -- Function: struct passwd * getpwuid (uid_t UID)
  5102. Preliminary: | MT-Unsafe race:pwuid locale | AS-Unsafe dlopen
  5103. plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note POSIX
  5104. Safety Concepts::.
  5105. This function returns a pointer to a statically-allocated structure
  5106. containing information about the user whose user ID is UID. This
  5107. structure may be overwritten on subsequent calls to ‘getpwuid’.
  5108. A null pointer value indicates there is no user in the data base
  5109. with user ID UID.
  5110. -- Function: int getpwuid_r (uid_t UID, struct passwd *RESULT_BUF, char
  5111. *BUFFER, size_t BUFLEN, struct passwd **RESULT)
  5112. Preliminary: | MT-Safe locale | AS-Unsafe dlopen plugin heap lock |
  5113. AC-Unsafe corrupt lock fd mem | *Note POSIX Safety Concepts::.
  5114. This function is similar to ‘getpwuid’ in that it returns
  5115. information about the user whose user ID is UID. However, it fills
  5116. the user supplied structure pointed to by RESULT_BUF with the
  5117. information instead of using a static buffer. The first BUFLEN
  5118. bytes of the additional buffer pointed to by BUFFER are used to
  5119. contain additional information, normally strings which are pointed
  5120. to by the elements of the result structure.
  5121. If a user with ID UID is found, the pointer returned in RESULT
  5122. points to the record which contains the wanted data (i.e., RESULT
  5123. contains the value RESULT_BUF). If no user is found or if an error
  5124. occurred, the pointer returned in RESULT is a null pointer. The
  5125. function returns zero or an error code. If the buffer BUFFER is
  5126. too small to contain all the needed information, the error code
  5127. ‘ERANGE’ is returned and ‘errno’ is set to ‘ERANGE’.
  5128. -- Function: struct passwd * getpwnam (const char *NAME)
  5129. Preliminary: | MT-Unsafe race:pwnam locale | AS-Unsafe dlopen
  5130. plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note POSIX
  5131. Safety Concepts::.
  5132. This function returns a pointer to a statically-allocated structure
  5133. containing information about the user whose user name is NAME.
  5134. This structure may be overwritten on subsequent calls to
  5135. ‘getpwnam’.
  5136. A null pointer return indicates there is no user named NAME.
  5137. -- Function: int getpwnam_r (const char *NAME, struct passwd
  5138. *RESULT_BUF, char *BUFFER, size_t BUFLEN, struct passwd
  5139. **RESULT)
  5140. Preliminary: | MT-Safe locale | AS-Unsafe dlopen plugin heap lock |
  5141. AC-Unsafe corrupt lock fd mem | *Note POSIX Safety Concepts::.
  5142. This function is similar to ‘getpwnam’ in that it returns
  5143. information about the user whose user name is NAME. However, like
  5144. ‘getpwuid_r’, it fills the user supplied buffers in RESULT_BUF and
  5145. BUFFER with the information instead of using a static buffer.
  5146. The return values are the same as for ‘getpwuid_r’.
  5147. 
  5148. File: libc.info, Node: Scanning All Users, Next: Writing a User Entry, Prev: Lookup User, Up: User Database
  5149. 31.13.3 Scanning the List of All Users
  5150. --------------------------------------
  5151. This section explains how a program can read the list of all users in
  5152. the system, one user at a time. The functions described here are
  5153. declared in ‘pwd.h’.
  5154. You can use the ‘fgetpwent’ function to read user entries from a
  5155. particular file.
  5156. -- Function: struct passwd * fgetpwent (FILE *STREAM)
  5157. Preliminary: | MT-Unsafe race:fpwent | AS-Unsafe corrupt lock |
  5158. AC-Unsafe corrupt lock | *Note POSIX Safety Concepts::.
  5159. This function reads the next user entry from STREAM and returns a
  5160. pointer to the entry. The structure is statically allocated and is
  5161. rewritten on subsequent calls to ‘fgetpwent’. You must copy the
  5162. contents of the structure if you wish to save the information.
  5163. The stream must correspond to a file in the same format as the
  5164. standard user database file.
  5165. -- Function: int fgetpwent_r (FILE *STREAM, struct passwd *RESULT_BUF,
  5166. char *BUFFER, size_t BUFLEN, struct passwd **RESULT)
  5167. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe corrupt lock
  5168. | *Note POSIX Safety Concepts::.
  5169. This function is similar to ‘fgetpwent’ in that it reads the next
  5170. user entry from STREAM. But the result is returned in the
  5171. structure pointed to by RESULT_BUF. The first BUFLEN bytes of the
  5172. additional buffer pointed to by BUFFER are used to contain
  5173. additional information, normally strings which are pointed to by
  5174. the elements of the result structure.
  5175. The stream must correspond to a file in the same format as the
  5176. standard user database file.
  5177. If the function returns zero RESULT points to the structure with
  5178. the wanted data (normally this is in RESULT_BUF). If errors
  5179. occurred the return value is nonzero and RESULT contains a null
  5180. pointer.
  5181. The way to scan all the entries in the user database is with
  5182. ‘setpwent’, ‘getpwent’, and ‘endpwent’.
  5183. -- Function: void setpwent (void)
  5184. Preliminary: | MT-Unsafe race:pwent locale | AS-Unsafe dlopen
  5185. plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note POSIX
  5186. Safety Concepts::.
  5187. This function initializes a stream which ‘getpwent’ and
  5188. ‘getpwent_r’ use to read the user database.
  5189. -- Function: struct passwd * getpwent (void)
  5190. Preliminary: | MT-Unsafe race:pwent race:pwentbuf locale |
  5191. AS-Unsafe dlopen plugin heap lock | AC-Unsafe corrupt lock fd mem |
  5192. *Note POSIX Safety Concepts::.
  5193. The ‘getpwent’ function reads the next entry from the stream
  5194. initialized by ‘setpwent’. It returns a pointer to the entry. The
  5195. structure is statically allocated and is rewritten on subsequent
  5196. calls to ‘getpwent’. You must copy the contents of the structure
  5197. if you wish to save the information.
  5198. A null pointer is returned when no more entries are available.
  5199. -- Function: int getpwent_r (struct passwd *RESULT_BUF, char *BUFFER,
  5200. size_t BUFLEN, struct passwd **RESULT)
  5201. Preliminary: | MT-Unsafe race:pwent locale | AS-Unsafe dlopen
  5202. plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note POSIX
  5203. Safety Concepts::.
  5204. This function is similar to ‘getpwent’ in that it returns the next
  5205. entry from the stream initialized by ‘setpwent’. Like
  5206. ‘fgetpwent_r’, it uses the user-supplied buffers in RESULT_BUF and
  5207. BUFFER to return the information requested.
  5208. The return values are the same as for ‘fgetpwent_r’.
  5209. -- Function: void endpwent (void)
  5210. Preliminary: | MT-Unsafe race:pwent locale | AS-Unsafe dlopen
  5211. plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note POSIX
  5212. Safety Concepts::.
  5213. This function closes the internal stream used by ‘getpwent’ or
  5214. ‘getpwent_r’.
  5215. 
  5216. File: libc.info, Node: Writing a User Entry, Prev: Scanning All Users, Up: User Database
  5217. 31.13.4 Writing a User Entry
  5218. ----------------------------
  5219. -- Function: int putpwent (const struct passwd *P, FILE *STREAM)
  5220. Preliminary: | MT-Safe locale | AS-Unsafe corrupt | AC-Unsafe lock
  5221. corrupt | *Note POSIX Safety Concepts::.
  5222. This function writes the user entry ‘*P’ to the stream STREAM, in
  5223. the format used for the standard user database file. The return
  5224. value is zero on success and nonzero on failure.
  5225. This function exists for compatibility with SVID. We recommend that
  5226. you avoid using it, because it makes sense only on the assumption
  5227. that the ‘struct passwd’ structure has no members except the
  5228. standard ones; on a system which merges the traditional Unix data
  5229. base with other extended information about users, adding an entry
  5230. using this function would inevitably leave out much of the
  5231. important information.
  5232. The group and user ID fields are left empty if the group or user
  5233. name starts with a - or +.
  5234. The function ‘putpwent’ is declared in ‘pwd.h’.
  5235. 
  5236. File: libc.info, Node: Group Database, Next: Database Example, Prev: User Database, Up: Users and Groups
  5237. 31.14 Group Database
  5238. ====================
  5239. This section describes how to search and scan the database of registered
  5240. groups. The database itself is kept in the file ‘/etc/group’ on most
  5241. systems, but on some systems a special network service provides access
  5242. to it.
  5243. * Menu:
  5244. * Group Data Structure:: What each group record contains.
  5245. * Lookup Group:: How to look for a particular group.
  5246. * Scanning All Groups:: Scanning the list of all groups.
  5247. 
  5248. File: libc.info, Node: Group Data Structure, Next: Lookup Group, Up: Group Database
  5249. 31.14.1 The Data Structure for a Group
  5250. --------------------------------------
  5251. The functions and data structures for accessing the system group
  5252. database are declared in the header file ‘grp.h’.
  5253. -- Data Type: struct group
  5254. The ‘group’ structure is used to hold information about an entry in
  5255. the system group database. It has at least the following members:
  5256. ‘char *gr_name’
  5257. The name of the group.
  5258. ‘gid_t gr_gid’
  5259. The group ID of the group.
  5260. ‘char **gr_mem’
  5261. A vector of pointers to the names of users in the group. Each
  5262. user name is a null-terminated string, and the vector itself
  5263. is terminated by a null pointer.
  5264. 
  5265. File: libc.info, Node: Lookup Group, Next: Scanning All Groups, Prev: Group Data Structure, Up: Group Database
  5266. 31.14.2 Looking Up One Group
  5267. ----------------------------
  5268. You can search the group database for information about a specific group
  5269. using ‘getgrgid’ or ‘getgrnam’. These functions are declared in
  5270. ‘grp.h’.
  5271. -- Function: struct group * getgrgid (gid_t GID)
  5272. Preliminary: | MT-Unsafe race:grgid locale | AS-Unsafe dlopen
  5273. plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note POSIX
  5274. Safety Concepts::.
  5275. This function returns a pointer to a statically-allocated structure
  5276. containing information about the group whose group ID is GID. This
  5277. structure may be overwritten by subsequent calls to ‘getgrgid’.
  5278. A null pointer indicates there is no group with ID GID.
  5279. -- Function: int getgrgid_r (gid_t GID, struct group *RESULT_BUF, char
  5280. *BUFFER, size_t BUFLEN, struct group **RESULT)
  5281. Preliminary: | MT-Safe locale | AS-Unsafe dlopen plugin heap lock |
  5282. AC-Unsafe corrupt lock fd mem | *Note POSIX Safety Concepts::.
  5283. This function is similar to ‘getgrgid’ in that it returns
  5284. information about the group whose group ID is GID. However, it
  5285. fills the user supplied structure pointed to by RESULT_BUF with the
  5286. information instead of using a static buffer. The first BUFLEN
  5287. bytes of the additional buffer pointed to by BUFFER are used to
  5288. contain additional information, normally strings which are pointed
  5289. to by the elements of the result structure.
  5290. If a group with ID GID is found, the pointer returned in RESULT
  5291. points to the record which contains the wanted data (i.e., RESULT
  5292. contains the value RESULT_BUF). If no group is found or if an
  5293. error occurred, the pointer returned in RESULT is a null pointer.
  5294. The function returns zero or an error code. If the buffer BUFFER
  5295. is too small to contain all the needed information, the error code
  5296. ‘ERANGE’ is returned and ‘errno’ is set to ‘ERANGE’.
  5297. -- Function: struct group * getgrnam (const char *NAME)
  5298. Preliminary: | MT-Unsafe race:grnam locale | AS-Unsafe dlopen
  5299. plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note POSIX
  5300. Safety Concepts::.
  5301. This function returns a pointer to a statically-allocated structure
  5302. containing information about the group whose group name is NAME.
  5303. This structure may be overwritten by subsequent calls to
  5304. ‘getgrnam’.
  5305. A null pointer indicates there is no group named NAME.
  5306. -- Function: int getgrnam_r (const char *NAME, struct group
  5307. *RESULT_BUF, char *BUFFER, size_t BUFLEN, struct group
  5308. **RESULT)
  5309. Preliminary: | MT-Safe locale | AS-Unsafe dlopen plugin heap lock |
  5310. AC-Unsafe corrupt lock fd mem | *Note POSIX Safety Concepts::.
  5311. This function is similar to ‘getgrnam’ in that it returns
  5312. information about the group whose group name is NAME. Like
  5313. ‘getgrgid_r’, it uses the user supplied buffers in RESULT_BUF and
  5314. BUFFER, not a static buffer.
  5315. The return values are the same as for ‘getgrgid_r’.
  5316. 
  5317. File: libc.info, Node: Scanning All Groups, Prev: Lookup Group, Up: Group Database
  5318. 31.14.3 Scanning the List of All Groups
  5319. ---------------------------------------
  5320. This section explains how a program can read the list of all groups in
  5321. the system, one group at a time. The functions described here are
  5322. declared in ‘grp.h’.
  5323. You can use the ‘fgetgrent’ function to read group entries from a
  5324. particular file.
  5325. -- Function: struct group * fgetgrent (FILE *STREAM)
  5326. Preliminary: | MT-Unsafe race:fgrent | AS-Unsafe corrupt lock |
  5327. AC-Unsafe corrupt lock | *Note POSIX Safety Concepts::.
  5328. The ‘fgetgrent’ function reads the next entry from STREAM. It
  5329. returns a pointer to the entry. The structure is statically
  5330. allocated and is overwritten on subsequent calls to ‘fgetgrent’.
  5331. You must copy the contents of the structure if you wish to save the
  5332. information.
  5333. The stream must correspond to a file in the same format as the
  5334. standard group database file.
  5335. -- Function: int fgetgrent_r (FILE *STREAM, struct group *RESULT_BUF,
  5336. char *BUFFER, size_t BUFLEN, struct group **RESULT)
  5337. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe corrupt lock
  5338. | *Note POSIX Safety Concepts::.
  5339. This function is similar to ‘fgetgrent’ in that it reads the next
  5340. user entry from STREAM. But the result is returned in the
  5341. structure pointed to by RESULT_BUF. The first BUFLEN bytes of the
  5342. additional buffer pointed to by BUFFER are used to contain
  5343. additional information, normally strings which are pointed to by
  5344. the elements of the result structure.
  5345. This stream must correspond to a file in the same format as the
  5346. standard group database file.
  5347. If the function returns zero RESULT points to the structure with
  5348. the wanted data (normally this is in RESULT_BUF). If errors
  5349. occurred the return value is non-zero and RESULT contains a null
  5350. pointer.
  5351. The way to scan all the entries in the group database is with
  5352. ‘setgrent’, ‘getgrent’, and ‘endgrent’.
  5353. -- Function: void setgrent (void)
  5354. Preliminary: | MT-Unsafe race:grent locale | AS-Unsafe dlopen
  5355. plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note POSIX
  5356. Safety Concepts::.
  5357. This function initializes a stream for reading from the group data
  5358. base. You use this stream by calling ‘getgrent’ or ‘getgrent_r’.
  5359. -- Function: struct group * getgrent (void)
  5360. Preliminary: | MT-Unsafe race:grent race:grentbuf locale |
  5361. AS-Unsafe dlopen plugin heap lock | AC-Unsafe corrupt lock fd mem |
  5362. *Note POSIX Safety Concepts::.
  5363. The ‘getgrent’ function reads the next entry from the stream
  5364. initialized by ‘setgrent’. It returns a pointer to the entry. The
  5365. structure is statically allocated and is overwritten on subsequent
  5366. calls to ‘getgrent’. You must copy the contents of the structure
  5367. if you wish to save the information.
  5368. -- Function: int getgrent_r (struct group *RESULT_BUF, char *BUFFER,
  5369. size_t BUFLEN, struct group **RESULT)
  5370. Preliminary: | MT-Unsafe race:grent locale | AS-Unsafe dlopen
  5371. plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note POSIX
  5372. Safety Concepts::.
  5373. This function is similar to ‘getgrent’ in that it returns the next
  5374. entry from the stream initialized by ‘setgrent’. Like
  5375. ‘fgetgrent_r’, it places the result in user-supplied buffers
  5376. pointed to by RESULT_BUF and BUFFER.
  5377. If the function returns zero RESULT contains a pointer to the data
  5378. (normally equal to RESULT_BUF). If errors occurred the return
  5379. value is non-zero and RESULT contains a null pointer.
  5380. -- Function: void endgrent (void)
  5381. Preliminary: | MT-Unsafe race:grent locale | AS-Unsafe dlopen
  5382. plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note POSIX
  5383. Safety Concepts::.
  5384. This function closes the internal stream used by ‘getgrent’ or
  5385. ‘getgrent_r’.
  5386. 
  5387. File: libc.info, Node: Database Example, Next: Netgroup Database, Prev: Group Database, Up: Users and Groups
  5388. 31.15 User and Group Database Example
  5389. =====================================
  5390. Here is an example program showing the use of the system database
  5391. inquiry functions. The program prints some information about the user
  5392. running the program.
  5393. #include <grp.h>
  5394. #include <pwd.h>
  5395. #include <sys/types.h>
  5396. #include <unistd.h>
  5397. #include <stdlib.h>
  5398. #include <stdio.h>
  5399. int
  5400. main (void)
  5401. {
  5402. uid_t me;
  5403. struct passwd *my_passwd;
  5404. struct group *my_group;
  5405. char **members;
  5406. /* Get information about the user ID. */
  5407. me = getuid ();
  5408. my_passwd = getpwuid (me);
  5409. if (!my_passwd)
  5410. {
  5411. printf ("Couldn't find out about user %d.\n", (int) me);
  5412. exit (EXIT_FAILURE);
  5413. }
  5414. /* Print the information. */
  5415. printf ("I am %s.\n", my_passwd->pw_gecos);
  5416. printf ("My login name is %s.\n", my_passwd->pw_name);
  5417. printf ("My uid is %d.\n", (int) (my_passwd->pw_uid));
  5418. printf ("My home directory is %s.\n", my_passwd->pw_dir);
  5419. printf ("My default shell is %s.\n", my_passwd->pw_shell);
  5420. /* Get information about the default group ID. */
  5421. my_group = getgrgid (my_passwd->pw_gid);
  5422. if (!my_group)
  5423. {
  5424. printf ("Couldn't find out about group %d.\n",
  5425. (int) my_passwd->pw_gid);
  5426. exit (EXIT_FAILURE);
  5427. }
  5428. /* Print the information. */
  5429. printf ("My default group is %s (%d).\n",
  5430. my_group->gr_name, (int) (my_passwd->pw_gid));
  5431. printf ("The members of this group are:\n");
  5432. members = my_group->gr_mem;
  5433. while (*members)
  5434. {
  5435. printf (" %s\n", *(members));
  5436. members++;
  5437. }
  5438. return EXIT_SUCCESS;
  5439. }
  5440. Here is some output from this program:
  5441. I am Throckmorton Snurd.
  5442. My login name is snurd.
  5443. My uid is 31093.
  5444. My home directory is /home/fsg/snurd.
  5445. My default shell is /bin/sh.
  5446. My default group is guest (12).
  5447. The members of this group are:
  5448. friedman
  5449. tami
  5450. 
  5451. File: libc.info, Node: Netgroup Database, Prev: Database Example, Up: Users and Groups
  5452. 31.16 Netgroup Database
  5453. =======================
  5454. * Menu:
  5455. * Netgroup Data:: Data in the Netgroup database and where
  5456. it comes from.
  5457. * Lookup Netgroup:: How to look for a particular netgroup.
  5458. * Netgroup Membership:: How to test for netgroup membership.
  5459. 
  5460. File: libc.info, Node: Netgroup Data, Next: Lookup Netgroup, Up: Netgroup Database
  5461. 31.16.1 Netgroup Data
  5462. ---------------------
  5463. Sometimes it is useful to group users according to other criteria (*note
  5464. Group Database::). E.g., it is useful to associate a certain group of
  5465. users with a certain machine. On the other hand grouping of host names
  5466. is not supported so far.
  5467. In Sun Microsystems' SunOS appeared a new kind of database, the
  5468. netgroup database. It allows grouping hosts, users, and domains freely,
  5469. giving them individual names. To be more concrete, a netgroup is a list
  5470. of triples consisting of a host name, a user name, and a domain name
  5471. where any of the entries can be a wildcard entry matching all inputs. A
  5472. last possibility is that names of other netgroups can also be given in
  5473. the list specifying a netgroup. So one can construct arbitrary
  5474. hierarchies without loops.
  5475. Sun's implementation allows netgroups only for the ‘nis’ or ‘nisplus’
  5476. service, *note Services in the NSS configuration::. The implementation
  5477. in the GNU C Library has no such restriction. An entry in either of the
  5478. input services must have the following form:
  5479. GROUPNAME ( GROUPNAME | (HOSTNAME,USERNAME,domainname) )+
  5480. Any of the fields in the triple can be empty which means anything
  5481. matches. While describing the functions we will see that the opposite
  5482. case is useful as well. I.e., there may be entries which will not match
  5483. any input. For entries like this, a name consisting of the single
  5484. character ‘-’ shall be used.
  5485. 
  5486. File: libc.info, Node: Lookup Netgroup, Next: Netgroup Membership, Prev: Netgroup Data, Up: Netgroup Database
  5487. 31.16.2 Looking up one Netgroup
  5488. -------------------------------
  5489. The lookup functions for netgroups are a bit different than all other
  5490. system database handling functions. Since a single netgroup can contain
  5491. many entries a two-step process is needed. First a single netgroup is
  5492. selected and then one can iterate over all entries in this netgroup.
  5493. These functions are declared in ‘netdb.h’.
  5494. -- Function: int setnetgrent (const char *NETGROUP)
  5495. Preliminary: | MT-Unsafe race:netgrent locale | AS-Unsafe dlopen
  5496. plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note POSIX
  5497. Safety Concepts::.
  5498. A call to this function initializes the internal state of the
  5499. library to allow following calls of ‘getnetgrent’ to iterate over
  5500. all entries in the netgroup with name NETGROUP.
  5501. When the call is successful (i.e., when a netgroup with this name
  5502. exists) the return value is ‘1’. When the return value is ‘0’ no
  5503. netgroup of this name is known or some other error occurred.
  5504. It is important to remember that there is only one single state for
  5505. iterating the netgroups. Even if the programmer uses the
  5506. ‘getnetgrent_r’ function the result is not really reentrant since always
  5507. only one single netgroup at a time can be processed. If the program
  5508. needs to process more than one netgroup simultaneously she must protect
  5509. this by using external locking. This problem was introduced in the
  5510. original netgroups implementation in SunOS and since we must stay
  5511. compatible it is not possible to change this.
  5512. Some other functions also use the netgroups state. Currently these
  5513. are the ‘innetgr’ function and parts of the implementation of the
  5514. ‘compat’ service part of the NSS implementation.
  5515. -- Function: int getnetgrent (char **HOSTP, char **USERP, char
  5516. **DOMAINP)
  5517. Preliminary: | MT-Unsafe race:netgrent race:netgrentbuf locale |
  5518. AS-Unsafe dlopen plugin heap lock | AC-Unsafe corrupt lock fd mem |
  5519. *Note POSIX Safety Concepts::.
  5520. This function returns the next unprocessed entry of the currently
  5521. selected netgroup. The string pointers, in which addresses are
  5522. passed in the arguments HOSTP, USERP, and DOMAINP, will contain
  5523. after a successful call pointers to appropriate strings. If the
  5524. string in the next entry is empty the pointer has the value ‘NULL’.
  5525. The returned string pointers are only valid if none of the netgroup
  5526. related functions are called.
  5527. The return value is ‘1’ if the next entry was successfully read. A
  5528. value of ‘0’ means no further entries exist or internal errors
  5529. occurred.
  5530. -- Function: int getnetgrent_r (char **HOSTP, char **USERP, char
  5531. **DOMAINP, char *BUFFER, size_t BUFLEN)
  5532. Preliminary: | MT-Unsafe race:netgrent locale | AS-Unsafe dlopen
  5533. plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note POSIX
  5534. Safety Concepts::.
  5535. This function is similar to ‘getnetgrent’ with only one exception:
  5536. the strings the three string pointers HOSTP, USERP, and DOMAINP
  5537. point to, are placed in the buffer of BUFLEN bytes starting at
  5538. BUFFER. This means the returned values are valid even after other
  5539. netgroup related functions are called.
  5540. The return value is ‘1’ if the next entry was successfully read and
  5541. the buffer contains enough room to place the strings in it. ‘0’ is
  5542. returned in case no more entries are found, the buffer is too
  5543. small, or internal errors occurred.
  5544. This function is a GNU extension. The original implementation in
  5545. the SunOS libc does not provide this function.
  5546. -- Function: void endnetgrent (void)
  5547. Preliminary: | MT-Unsafe race:netgrent | AS-Unsafe dlopen plugin
  5548. heap lock | AC-Unsafe corrupt lock fd mem | *Note POSIX Safety
  5549. Concepts::.
  5550. This function frees all buffers which were allocated to process the
  5551. last selected netgroup. As a result all string pointers returned
  5552. by calls to ‘getnetgrent’ are invalid afterwards.
  5553. 
  5554. File: libc.info, Node: Netgroup Membership, Prev: Lookup Netgroup, Up: Netgroup Database
  5555. 31.16.3 Testing for Netgroup Membership
  5556. ---------------------------------------
  5557. It is often not necessary to scan the whole netgroup since often the
  5558. only interesting question is whether a given entry is part of the
  5559. selected netgroup.
  5560. -- Function: int innetgr (const char *NETGROUP, const char *HOST, const
  5561. char *USER, const char *DOMAIN)
  5562. Preliminary: | MT-Unsafe race:netgrent locale | AS-Unsafe dlopen
  5563. plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note POSIX
  5564. Safety Concepts::.
  5565. This function tests whether the triple specified by the parameters
  5566. HOST, USER, and DOMAIN is part of the netgroup NETGROUP. Using
  5567. this function has the advantage that
  5568. 1. no other netgroup function can use the global netgroup state
  5569. since internal locking is used and
  5570. 2. the function is implemented more efficiently than successive
  5571. calls to the other ‘set’/‘get’/‘endnetgrent’ functions.
  5572. Any of the pointers HOST, USER, or DOMAIN can be ‘NULL’ which means
  5573. any value is accepted in this position. This is also true for the
  5574. name ‘-’ which should not match any other string otherwise.
  5575. The return value is ‘1’ if an entry matching the given triple is
  5576. found in the netgroup. The return value is ‘0’ if the netgroup
  5577. itself is not found, the netgroup does not contain the triple or
  5578. internal errors occurred.
  5579. 
  5580. File: libc.info, Node: System Management, Next: System Configuration, Prev: Users and Groups, Up: Top
  5581. 32 System Management
  5582. ********************
  5583. This chapter describes facilities for controlling the system that
  5584. underlies a process (including the operating system and hardware) and
  5585. for getting information about it. Anyone can generally use the
  5586. informational facilities, but usually only a properly privileged process
  5587. can make changes.
  5588. * Menu:
  5589. * Host Identification:: Determining the name of the machine.
  5590. * Platform Type:: Determining operating system and basic
  5591. machine type
  5592. * Filesystem Handling:: Controlling/querying mounts
  5593. To get information on parameters of the system that are built into
  5594. the system, such as the maximum length of a filename, *note System
  5595. Configuration::.
  5596. 
  5597. File: libc.info, Node: Host Identification, Next: Platform Type, Up: System Management
  5598. 32.1 Host Identification
  5599. ========================
  5600. This section explains how to identify the particular system on which
  5601. your program is running. First, let's review the various ways computer
  5602. systems are named, which is a little complicated because of the history
  5603. of the development of the Internet.
  5604. Every Unix system (also known as a host) has a host name, whether
  5605. it's connected to a network or not. In its simplest form, as used
  5606. before computer networks were an issue, it's just a word like ‘chicken’.
  5607. But any system attached to the Internet or any network like it
  5608. conforms to a more rigorous naming convention as part of the Domain Name
  5609. System (DNS). In the DNS, every host name is composed of two parts:
  5610. 1. hostname
  5611. 2. domain name
  5612. You will note that "hostname" looks a lot like "host name", but is
  5613. not the same thing, and that people often incorrectly refer to entire
  5614. host names as "domain names."
  5615. In the DNS, the full host name is properly called the FQDN (Fully
  5616. Qualified Domain Name) and consists of the hostname, then a period, then
  5617. the domain name. The domain name itself usually has multiple components
  5618. separated by periods. So for example, a system's hostname may be
  5619. ‘chicken’ and its domain name might be ‘ai.mit.edu’, so its FQDN (which
  5620. is its host name) is ‘chicken.ai.mit.edu’.
  5621. Adding to the confusion, though, is that the DNS is not the only name
  5622. space in which a computer needs to be known. Another name space is the
  5623. NIS (aka YP) name space. For NIS purposes, there is another domain
  5624. name, which is called the NIS domain name or the YP domain name. It
  5625. need not have anything to do with the DNS domain name.
  5626. Confusing things even more is the fact that in the DNS, it is
  5627. possible for multiple FQDNs to refer to the same system. However, there
  5628. is always exactly one of them that is the true host name, and it is
  5629. called the canonical FQDN.
  5630. In some contexts, the host name is called a "node name."
  5631. For more information on DNS host naming, see *note Host Names::.
  5632. Prototypes for these functions appear in ‘unistd.h’.
  5633. The programs ‘hostname’, ‘hostid’, and ‘domainname’ work by calling
  5634. these functions.
  5635. -- Function: int gethostname (char *NAME, size_t SIZE)
  5636. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5637. Concepts::.
  5638. This function returns the host name of the system on which it is
  5639. called, in the array NAME. The SIZE argument specifies the size of
  5640. this array, in bytes. Note that this is _not_ the DNS hostname.
  5641. If the system participates in the DNS, this is the FQDN (see
  5642. above).
  5643. The return value is ‘0’ on success and ‘-1’ on failure. In the GNU
  5644. C Library, ‘gethostname’ fails if SIZE is not large enough; then
  5645. you can try again with a larger array. The following ‘errno’ error
  5646. condition is defined for this function:
  5647. ‘ENAMETOOLONG’
  5648. The SIZE argument is less than the size of the host name plus
  5649. one.
  5650. On some systems, there is a symbol for the maximum possible host
  5651. name length: ‘MAXHOSTNAMELEN’. It is defined in ‘sys/param.h’.
  5652. But you can't count on this to exist, so it is cleaner to handle
  5653. failure and try again.
  5654. ‘gethostname’ stores the beginning of the host name in NAME even if
  5655. the host name won't entirely fit. For some purposes, a truncated
  5656. host name is good enough. If it is, you can ignore the error code.
  5657. -- Function: int sethostname (const char *NAME, size_t LENGTH)
  5658. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5659. Concepts::.
  5660. The ‘sethostname’ function sets the host name of the system that
  5661. calls it to NAME, a string with length LENGTH. Only privileged
  5662. processes are permitted to do this.
  5663. Usually ‘sethostname’ gets called just once, at system boot time.
  5664. Often, the program that calls it sets it to the value it finds in
  5665. the file ‘/etc/hostname’.
  5666. Be sure to set the host name to the full host name, not just the
  5667. DNS hostname (see above).
  5668. The return value is ‘0’ on success and ‘-1’ on failure. The
  5669. following ‘errno’ error condition is defined for this function:
  5670. ‘EPERM’
  5671. This process cannot set the host name because it is not
  5672. privileged.
  5673. -- Function: int getdomainname (char *NAME, size_t LENGTH)
  5674. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5675. Concepts::.
  5676. ‘getdomainname’ returns the NIS (aka YP) domain name of the system
  5677. on which it is called. Note that this is not the more popular DNS
  5678. domain name. Get that with ‘gethostname’.
  5679. The specifics of this function are analogous to ‘gethostname’,
  5680. above.
  5681. -- Function: int setdomainname (const char *NAME, size_t LENGTH)
  5682. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5683. Concepts::.
  5684. ‘setdomainname’ sets the NIS (aka YP) domain name of the system on
  5685. which it is called. Note that this is not the more popular DNS
  5686. domain name. Set that with ‘sethostname’.
  5687. The specifics of this function are analogous to ‘sethostname’,
  5688. above.
  5689. -- Function: long int gethostid (void)
  5690. Preliminary: | MT-Safe hostid env locale | AS-Unsafe dlopen plugin
  5691. corrupt heap lock | AC-Unsafe lock corrupt mem fd | *Note POSIX
  5692. Safety Concepts::.
  5693. This function returns the "host ID" of the machine the program is
  5694. running on. By convention, this is usually the primary Internet IP
  5695. address of that machine, converted to a ‘long int’. However, on
  5696. some systems it is a meaningless but unique number which is
  5697. hard-coded for each machine.
  5698. This is not widely used. It arose in BSD 4.2, but was dropped in
  5699. BSD 4.4. It is not required by POSIX.
  5700. The proper way to query the IP address is to use ‘gethostbyname’ on
  5701. the results of ‘gethostname’. For more information on IP
  5702. addresses, *Note Host Addresses::.
  5703. -- Function: int sethostid (long int ID)
  5704. Preliminary: | MT-Unsafe const:hostid | AS-Unsafe | AC-Unsafe
  5705. corrupt fd | *Note POSIX Safety Concepts::.
  5706. The ‘sethostid’ function sets the "host ID" of the host machine to
  5707. ID. Only privileged processes are permitted to do this. Usually
  5708. it happens just once, at system boot time.
  5709. The proper way to establish the primary IP address of a system is
  5710. to configure the IP address resolver to associate that IP address
  5711. with the system's host name as returned by ‘gethostname’. For
  5712. example, put a record for the system in ‘/etc/hosts’.
  5713. See ‘gethostid’ above for more information on host ids.
  5714. The return value is ‘0’ on success and ‘-1’ on failure. The
  5715. following ‘errno’ error conditions are defined for this function:
  5716. ‘EPERM’
  5717. This process cannot set the host name because it is not
  5718. privileged.
  5719. ‘ENOSYS’
  5720. The operating system does not support setting the host ID. On
  5721. some systems, the host ID is a meaningless but unique number
  5722. hard-coded for each machine.
  5723. 
  5724. File: libc.info, Node: Platform Type, Next: Filesystem Handling, Prev: Host Identification, Up: System Management
  5725. 32.2 Platform Type Identification
  5726. =================================
  5727. You can use the ‘uname’ function to find out some information about the
  5728. type of computer your program is running on. This function and the
  5729. associated data type are declared in the header file ‘sys/utsname.h’.
  5730. As a bonus, ‘uname’ also gives some information identifying the
  5731. particular system your program is running on. This is the same
  5732. information which you can get with functions targeted to this purpose
  5733. described in *note Host Identification::.
  5734. -- Data Type: struct utsname
  5735. The ‘utsname’ structure is used to hold information returned by the
  5736. ‘uname’ function. It has the following members:
  5737. ‘char sysname[]’
  5738. This is the name of the operating system in use.
  5739. ‘char release[]’
  5740. This is the current release level of the operating system
  5741. implementation.
  5742. ‘char version[]’
  5743. This is the current version level within the release of the
  5744. operating system.
  5745. ‘char machine[]’
  5746. This is a description of the type of hardware that is in use.
  5747. Some systems provide a mechanism to interrogate the kernel
  5748. directly for this information. On systems without such a
  5749. mechanism, the GNU C Library fills in this field based on the
  5750. configuration name that was specified when building and
  5751. installing the library.
  5752. GNU uses a three-part name to describe a system configuration;
  5753. the three parts are CPU, MANUFACTURER and SYSTEM-TYPE, and
  5754. they are separated with dashes. Any possible combination of
  5755. three names is potentially meaningful, but most such
  5756. combinations are meaningless in practice and even the
  5757. meaningful ones are not necessarily supported by any
  5758. particular GNU program.
  5759. Since the value in ‘machine’ is supposed to describe just the
  5760. hardware, it consists of the first two parts of the
  5761. configuration name: ‘CPU-MANUFACTURER’. For example, it might
  5762. be one of these:
  5763. ‘"sparc-sun"’, ‘"i386-ANYTHING"’, ‘"m68k-hp"’,
  5764. ‘"m68k-sony"’, ‘"m68k-sun"’, ‘"mips-dec"’
  5765. ‘char nodename[]’
  5766. This is the host name of this particular computer. In the GNU
  5767. C Library, the value is the same as that returned by
  5768. ‘gethostname’; see *note Host Identification::.
  5769. ‘gethostname’ is implemented with a call to ‘uname’.
  5770. ‘char domainname[]’
  5771. This is the NIS or YP domain name. It is the same value
  5772. returned by ‘getdomainname’; see *note Host Identification::.
  5773. This element is a relatively recent invention and use of it is
  5774. not as portable as use of the rest of the structure.
  5775. -- Function: int uname (struct utsname *INFO)
  5776. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5777. Concepts::.
  5778. The ‘uname’ function fills in the structure pointed to by INFO with
  5779. information about the operating system and host machine. A
  5780. non-negative return value indicates that the data was successfully
  5781. stored.
  5782. ‘-1’ as the return value indicates an error. The only error
  5783. possible is ‘EFAULT’, which we normally don't mention as it is
  5784. always a possibility.
  5785. 
  5786. File: libc.info, Node: Filesystem Handling, Prev: Platform Type, Up: System Management
  5787. 32.3 Controlling and Querying Mounts
  5788. ====================================
  5789. All files are in filesystems, and before you can access any file, its
  5790. filesystem must be mounted. Because of Unix's concept of _Everything is
  5791. a file_, mounting of filesystems is central to doing almost anything.
  5792. This section explains how to find out what filesystems are currently
  5793. mounted and what filesystems are available for mounting, and how to
  5794. change what is mounted.
  5795. The classic filesystem is the contents of a disk drive. The concept
  5796. is considerably more abstract, though, and lots of things other than
  5797. disk drives can be mounted.
  5798. Some block devices don't correspond to traditional devices like disk
  5799. drives. For example, a loop device is a block device whose driver uses
  5800. a regular file in another filesystem as its medium. So if that regular
  5801. file contains appropriate data for a filesystem, you can by mounting the
  5802. loop device essentially mount a regular file.
  5803. Some filesystems aren't based on a device of any kind. The "proc"
  5804. filesystem, for example, contains files whose data is made up by the
  5805. filesystem driver on the fly whenever you ask for it. And when you
  5806. write to it, the data you write causes changes in the system. No data
  5807. gets stored.
  5808. * Menu:
  5809. * Mount Information:: What is or could be mounted?
  5810. * Mount-Unmount-Remount:: Controlling what is mounted and how
  5811. 
  5812. File: libc.info, Node: Mount Information, Next: Mount-Unmount-Remount, Up: Filesystem Handling
  5813. 32.3.1 Mount Information
  5814. ------------------------
  5815. For some programs it is desirable and necessary to access information
  5816. about whether a certain filesystem is mounted and, if it is, where, or
  5817. simply to get lists of all the available filesystems. The GNU C Library
  5818. provides some functions to retrieve this information portably.
  5819. Traditionally Unix systems have a file named ‘/etc/fstab’ which
  5820. describes all possibly mounted filesystems. The ‘mount’ program uses
  5821. this file to mount at startup time of the system all the necessary
  5822. filesystems. The information about all the filesystems actually mounted
  5823. is normally kept in a file named either ‘/var/run/mtab’ or ‘/etc/mtab’.
  5824. Both files share the same syntax and it is crucial that this syntax is
  5825. followed all the time. Therefore it is best to never directly write to
  5826. the files. The functions described in this section can do this and they
  5827. also provide the functionality to convert the external textual
  5828. representation to the internal representation.
  5829. Note that the ‘fstab’ and ‘mtab’ files are maintained on a system by
  5830. _convention_. It is possible for the files not to exist or not to be
  5831. consistent with what is really mounted or available to mount, if the
  5832. system's administration policy allows it. But programs that mount and
  5833. unmount filesystems typically maintain and use these files as described
  5834. herein.
  5835. The filenames given above should never be used directly. The
  5836. portable way to handle these files is to use the macros ‘_PATH_FSTAB’,
  5837. defined in ‘fstab.h’, or ‘_PATH_MNTTAB’, defined in ‘mntent.h’ and
  5838. ‘paths.h’, for ‘fstab’; and the macro ‘_PATH_MOUNTED’, also defined in
  5839. ‘mntent.h’ and ‘paths.h’, for ‘mtab’. There are also two alternate
  5840. macro names ‘FSTAB’, ‘MNTTAB’, and ‘MOUNTED’ defined but these names are
  5841. deprecated and kept only for backward compatibility. The names
  5842. ‘_PATH_MNTTAB’ and ‘_PATH_MOUNTED’ should always be used.
  5843. * Menu:
  5844. * fstab:: The ‘fstab’ file
  5845. * mtab:: The ‘mtab’ file
  5846. * Other Mount Information:: Other (non-libc) sources of mount information
  5847. 
  5848. File: libc.info, Node: fstab, Next: mtab, Up: Mount Information
  5849. 32.3.1.1 The ‘fstab’ file
  5850. .........................
  5851. The internal representation for entries of the file is ‘struct fstab’,
  5852. defined in ‘fstab.h’.
  5853. -- Data Type: struct fstab
  5854. This structure is used with the ‘getfsent’, ‘getfsspec’, and
  5855. ‘getfsfile’ functions.
  5856. ‘char *fs_spec’
  5857. This element describes the device from which the filesystem is
  5858. mounted. Normally this is the name of a special device, such
  5859. as a hard disk partition, but it could also be a more or less
  5860. generic string. For “NFS” it would be a hostname and
  5861. directory name combination.
  5862. Even though the element is not declared ‘const’ it shouldn't
  5863. be modified. The missing ‘const’ has historic reasons, since
  5864. this function predates ISO C. The same is true for the other
  5865. string elements of this structure.
  5866. ‘char *fs_file’
  5867. This describes the mount point on the local system. I.e.,
  5868. accessing any file in this filesystem has implicitly or
  5869. explicitly this string as a prefix.
  5870. ‘char *fs_vfstype’
  5871. This is the type of the filesystem. Depending on what the
  5872. underlying kernel understands it can be any string.
  5873. ‘char *fs_mntops’
  5874. This is a string containing options passed to the kernel with
  5875. the ‘mount’ call. Again, this can be almost anything. There
  5876. can be more than one option, separated from the others by a
  5877. comma. Each option consists of a name and an optional value
  5878. part, introduced by an ‘=’ character.
  5879. If the value of this element must be processed it should
  5880. ideally be done using the ‘getsubopt’ function; see *note
  5881. Suboptions::.
  5882. ‘const char *fs_type’
  5883. This name is poorly chosen. This element points to a string
  5884. (possibly in the ‘fs_mntops’ string) which describes the modes
  5885. with which the filesystem is mounted. ‘fstab’ defines five
  5886. macros to describe the possible values:
  5887. ‘FSTAB_RW’
  5888. The filesystem gets mounted with read and write enabled.
  5889. ‘FSTAB_RQ’
  5890. The filesystem gets mounted with read and write enabled.
  5891. Write access is restricted by quotas.
  5892. ‘FSTAB_RO’
  5893. The filesystem gets mounted read-only.
  5894. ‘FSTAB_SW’
  5895. This is not a real filesystem, it is a swap device.
  5896. ‘FSTAB_XX’
  5897. This entry from the ‘fstab’ file is totally ignored.
  5898. Testing for equality with these values must happen using
  5899. ‘strcmp’ since these are all strings. Comparing the pointer
  5900. will probably always fail.
  5901. ‘int fs_freq’
  5902. This element describes the dump frequency in days.
  5903. ‘int fs_passno’
  5904. This element describes the pass number on parallel dumps. It
  5905. is closely related to the ‘dump’ utility used on Unix systems.
  5906. To read the entire content of the of the ‘fstab’ file the GNU C
  5907. Library contains a set of three functions which are designed in the
  5908. usual way.
  5909. -- Function: int setfsent (void)
  5910. Preliminary: | MT-Unsafe race:fsent | AS-Unsafe heap corrupt lock |
  5911. AC-Unsafe corrupt lock mem fd | *Note POSIX Safety Concepts::.
  5912. This function makes sure that the internal read pointer for the
  5913. ‘fstab’ file is at the beginning of the file. This is done by
  5914. either opening the file or resetting the read pointer.
  5915. Since the file handle is internal to the libc this function is not
  5916. thread-safe.
  5917. This function returns a non-zero value if the operation was
  5918. successful and the ‘getfs*’ functions can be used to read the
  5919. entries of the file.
  5920. -- Function: void endfsent (void)
  5921. Preliminary: | MT-Unsafe race:fsent | AS-Unsafe heap corrupt lock |
  5922. AC-Unsafe corrupt lock mem fd | *Note POSIX Safety Concepts::.
  5923. This function makes sure that all resources acquired by a prior
  5924. call to ‘setfsent’ (explicitly or implicitly by calling ‘getfsent’)
  5925. are freed.
  5926. -- Function: struct fstab * getfsent (void)
  5927. Preliminary: | MT-Unsafe race:fsent locale | AS-Unsafe corrupt heap
  5928. lock | AC-Unsafe corrupt lock mem | *Note POSIX Safety Concepts::.
  5929. This function returns the next entry of the ‘fstab’ file. If this
  5930. is the first call to any of the functions handling ‘fstab’ since
  5931. program start or the last call of ‘endfsent’, the file will be
  5932. opened.
  5933. The function returns a pointer to a variable of type ‘struct
  5934. fstab’. This variable is shared by all threads and therefore this
  5935. function is not thread-safe. If an error occurred ‘getfsent’
  5936. returns a ‘NULL’ pointer.
  5937. -- Function: struct fstab * getfsspec (const char *NAME)
  5938. Preliminary: | MT-Unsafe race:fsent locale | AS-Unsafe corrupt heap
  5939. lock | AC-Unsafe corrupt lock mem | *Note POSIX Safety Concepts::.
  5940. This function returns the next entry of the ‘fstab’ file which has
  5941. a string equal to NAME pointed to by the ‘fs_spec’ element. Since
  5942. there is normally exactly one entry for each special device it
  5943. makes no sense to call this function more than once for the same
  5944. argument. If this is the first call to any of the functions
  5945. handling ‘fstab’ since program start or the last call of
  5946. ‘endfsent’, the file will be opened.
  5947. The function returns a pointer to a variable of type ‘struct
  5948. fstab’. This variable is shared by all threads and therefore this
  5949. function is not thread-safe. If an error occurred ‘getfsent’
  5950. returns a ‘NULL’ pointer.
  5951. -- Function: struct fstab * getfsfile (const char *NAME)
  5952. Preliminary: | MT-Unsafe race:fsent locale | AS-Unsafe corrupt heap
  5953. lock | AC-Unsafe corrupt lock mem | *Note POSIX Safety Concepts::.
  5954. This function returns the next entry of the ‘fstab’ file which has
  5955. a string equal to NAME pointed to by the ‘fs_file’ element. Since
  5956. there is normally exactly one entry for each mount point it makes
  5957. no sense to call this function more than once for the same
  5958. argument. If this is the first call to any of the functions
  5959. handling ‘fstab’ since program start or the last call of
  5960. ‘endfsent’, the file will be opened.
  5961. The function returns a pointer to a variable of type ‘struct
  5962. fstab’. This variable is shared by all threads and therefore this
  5963. function is not thread-safe. If an error occurred ‘getfsent’
  5964. returns a ‘NULL’ pointer.
  5965. 
  5966. File: libc.info, Node: mtab, Next: Other Mount Information, Prev: fstab, Up: Mount Information
  5967. 32.3.1.2 The ‘mtab’ file
  5968. ........................
  5969. The following functions and data structure access the ‘mtab’ file.
  5970. -- Data Type: struct mntent
  5971. This structure is used with the ‘getmntent’, ‘getmntent_r’,
  5972. ‘addmntent’, and ‘hasmntopt’ functions.
  5973. ‘char *mnt_fsname’
  5974. This element contains a pointer to a string describing the
  5975. name of the special device from which the filesystem is
  5976. mounted. It corresponds to the ‘fs_spec’ element in ‘struct
  5977. fstab’.
  5978. ‘char *mnt_dir’
  5979. This element points to a string describing the mount point of
  5980. the filesystem. It corresponds to the ‘fs_file’ element in
  5981. ‘struct fstab’.
  5982. ‘char *mnt_type’
  5983. ‘mnt_type’ describes the filesystem type and is therefore
  5984. equivalent to ‘fs_vfstype’ in ‘struct fstab’. ‘mntent.h’
  5985. defines a few symbolic names for some of the values this
  5986. string can have. But since the kernel can support arbitrary
  5987. filesystems it does not make much sense to give them symbolic
  5988. names. If one knows the symbol name one also knows the
  5989. filesystem name. Nevertheless here follows the list of the
  5990. symbols provided in ‘mntent.h’.
  5991. ‘MNTTYPE_IGNORE’
  5992. This symbol expands to ‘"ignore"’. The value is
  5993. sometimes used in ‘fstab’ files to make sure entries are
  5994. not used without removing them.
  5995. ‘MNTTYPE_NFS’
  5996. Expands to ‘"nfs"’. Using this macro sometimes could
  5997. make sense since it names the default NFS implementation,
  5998. in case both version 2 and 3 are supported.
  5999. ‘MNTTYPE_SWAP’
  6000. This symbol expands to ‘"swap"’. It names the special
  6001. ‘fstab’ entry which names one of the possibly multiple
  6002. swap partitions.
  6003. ‘char *mnt_opts’
  6004. The element contains a string describing the options used
  6005. while mounting the filesystem. As for the equivalent element
  6006. ‘fs_mntops’ of ‘struct fstab’ it is best to use the function
  6007. ‘getsubopt’ (*note Suboptions::) to access the parts of this
  6008. string.
  6009. The ‘mntent.h’ file defines a number of macros with string
  6010. values which correspond to some of the options understood by
  6011. the kernel. There might be many more options which are
  6012. possible so it doesn't make much sense to rely on these macros
  6013. but to be consistent here is the list:
  6014. ‘MNTOPT_DEFAULTS’
  6015. Expands to ‘"defaults"’. This option should be used
  6016. alone since it indicates all values for the customizable
  6017. values are chosen to be the default.
  6018. ‘MNTOPT_RO’
  6019. Expands to ‘"ro"’. See the ‘FSTAB_RO’ value, it means
  6020. the filesystem is mounted read-only.
  6021. ‘MNTOPT_RW’
  6022. Expands to ‘"rw"’. See the ‘FSTAB_RW’ value, it means
  6023. the filesystem is mounted with read and write
  6024. permissions.
  6025. ‘MNTOPT_SUID’
  6026. Expands to ‘"suid"’. This means that the SUID bit (*note
  6027. How Change Persona::) is respected when a program from
  6028. the filesystem is started.
  6029. ‘MNTOPT_NOSUID’
  6030. Expands to ‘"nosuid"’. This is the opposite of
  6031. ‘MNTOPT_SUID’, the SUID bit for all files from the
  6032. filesystem is ignored.
  6033. ‘MNTOPT_NOAUTO’
  6034. Expands to ‘"noauto"’. At startup time the ‘mount’
  6035. program will ignore this entry if it is started with the
  6036. ‘-a’ option to mount all filesystems mentioned in the
  6037. ‘fstab’ file.
  6038. As for the ‘FSTAB_*’ entries introduced above it is important
  6039. to use ‘strcmp’ to check for equality.
  6040. ‘mnt_freq’
  6041. This elements corresponds to ‘fs_freq’ and also specifies the
  6042. frequency in days in which dumps are made.
  6043. ‘mnt_passno’
  6044. This element is equivalent to ‘fs_passno’ with the same
  6045. meaning which is uninteresting for all programs beside ‘dump’.
  6046. For accessing the ‘mtab’ file there is again a set of three functions
  6047. to access all entries in a row. Unlike the functions to handle ‘fstab’
  6048. these functions do not access a fixed file and there is even a thread
  6049. safe variant of the get function. Besides this the GNU C Library
  6050. contains functions to alter the file and test for specific options.
  6051. -- Function: FILE * setmntent (const char *FILE, const char *MODE)
  6052. Preliminary: | MT-Safe | AS-Unsafe heap lock | AC-Unsafe mem fd
  6053. lock | *Note POSIX Safety Concepts::.
  6054. The ‘setmntent’ function prepares the file named FILE which must be
  6055. in the format of a ‘fstab’ and ‘mtab’ file for the upcoming
  6056. processing through the other functions of the family. The MODE
  6057. parameter can be chosen in the way the OPENTYPE parameter for
  6058. ‘fopen’ (*note Opening Streams::) can be chosen. If the file is
  6059. opened for writing the file is also allowed to be empty.
  6060. If the file was successfully opened ‘setmntent’ returns a file
  6061. handle for future use. Otherwise the return value is ‘NULL’ and
  6062. ‘errno’ is set accordingly.
  6063. -- Function: int endmntent (FILE *STREAM)
  6064. Preliminary: | MT-Safe | AS-Unsafe heap lock | AC-Unsafe lock mem
  6065. fd | *Note POSIX Safety Concepts::.
  6066. This function takes for the STREAM parameter a file handle which
  6067. previously was returned from the ‘setmntent’ call. ‘endmntent’
  6068. closes the stream and frees all resources.
  6069. The return value is 1 unless an error occurred in which case it is
  6070. 0.
  6071. -- Function: struct mntent * getmntent (FILE *STREAM)
  6072. Preliminary: | MT-Unsafe race:mntentbuf locale | AS-Unsafe corrupt
  6073. heap init | AC-Unsafe init corrupt lock mem | *Note POSIX Safety
  6074. Concepts::.
  6075. The ‘getmntent’ function takes as the parameter a file handle
  6076. previously returned by a successful call to ‘setmntent’. It
  6077. returns a pointer to a static variable of type ‘struct mntent’
  6078. which is filled with the information from the next entry from the
  6079. file currently read.
  6080. The file format used prescribes the use of spaces or tab characters
  6081. to separate the fields. This makes it harder to use names
  6082. containing one of these characters (e.g., mount points using
  6083. spaces). Therefore these characters are encoded in the files and
  6084. the ‘getmntent’ function takes care of the decoding while reading
  6085. the entries back in. ‘'\040'’ is used to encode a space character,
  6086. ‘'\011'’ to encode a tab character, ‘'\012'’ to encode a newline
  6087. character, and ‘'\\'’ to encode a backslash.
  6088. If there was an error or the end of the file is reached the return
  6089. value is ‘NULL’.
  6090. This function is not thread-safe since all calls to this function
  6091. return a pointer to the same static variable. ‘getmntent_r’ should
  6092. be used in situations where multiple threads access the file.
  6093. -- Function: struct mntent * getmntent_r (FILE *STREAM, struct mntent
  6094. *RESULT, char *BUFFER, int BUFSIZE)
  6095. Preliminary: | MT-Safe locale | AS-Unsafe corrupt heap | AC-Unsafe
  6096. corrupt lock mem | *Note POSIX Safety Concepts::.
  6097. The ‘getmntent_r’ function is the reentrant variant of ‘getmntent’.
  6098. It also returns the next entry from the file and returns a pointer.
  6099. The actual variable the values are stored in is not static, though.
  6100. Instead the function stores the values in the variable pointed to
  6101. by the RESULT parameter. Additional information (e.g., the strings
  6102. pointed to by the elements of the result) are kept in the buffer of
  6103. size BUFSIZE pointed to by BUFFER.
  6104. Escaped characters (space, tab, backslash) are converted back in
  6105. the same way as it happens for ‘getmentent’.
  6106. The function returns a ‘NULL’ pointer in error cases. Errors could
  6107. be:
  6108. • error while reading the file,
  6109. • end of file reached,
  6110. • BUFSIZE is too small for reading a complete new entry.
  6111. -- Function: int addmntent (FILE *STREAM, const struct mntent *MNT)
  6112. Preliminary: | MT-Safe race:stream locale | AS-Unsafe corrupt |
  6113. AC-Unsafe corrupt | *Note POSIX Safety Concepts::.
  6114. The ‘addmntent’ function allows adding a new entry to the file
  6115. previously opened with ‘setmntent’. The new entries are always
  6116. appended. I.e., even if the position of the file descriptor is not
  6117. at the end of the file this function does not overwrite an existing
  6118. entry following the current position.
  6119. The implication of this is that to remove an entry from a file one
  6120. has to create a new file while leaving out the entry to be removed
  6121. and after closing the file remove the old one and rename the new
  6122. file to the chosen name.
  6123. This function takes care of spaces and tab characters in the names
  6124. to be written to the file. It converts them and the backslash
  6125. character into the format described in the ‘getmntent’ description
  6126. above.
  6127. This function returns 0 in case the operation was successful.
  6128. Otherwise the return value is 1 and ‘errno’ is set appropriately.
  6129. -- Function: char * hasmntopt (const struct mntent *MNT, const char
  6130. *OPT)
  6131. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  6132. Concepts::.
  6133. This function can be used to check whether the string pointed to by
  6134. the ‘mnt_opts’ element of the variable pointed to by MNT contains
  6135. the option OPT. If this is true a pointer to the beginning of the
  6136. option in the ‘mnt_opts’ element is returned. If no such option
  6137. exists the function returns ‘NULL’.
  6138. This function is useful to test whether a specific option is
  6139. present but when all options have to be processed one is better off
  6140. with using the ‘getsubopt’ function to iterate over all options in
  6141. the string.
  6142. 
  6143. File: libc.info, Node: Other Mount Information, Prev: mtab, Up: Mount Information
  6144. 32.3.1.3 Other (Non-libc) Sources of Mount Information
  6145. ......................................................
  6146. On a system with a Linux kernel and the ‘proc’ filesystem, you can get
  6147. information on currently mounted filesystems from the file ‘mounts’ in
  6148. the ‘proc’ filesystem. Its format is similar to that of the ‘mtab’
  6149. file, but represents what is truly mounted without relying on facilities
  6150. outside the kernel to keep ‘mtab’ up to date.
  6151. 
  6152. File: libc.info, Node: Mount-Unmount-Remount, Prev: Mount Information, Up: Filesystem Handling
  6153. 32.3.2 Mount, Unmount, Remount
  6154. ------------------------------
  6155. This section describes the functions for mounting, unmounting, and
  6156. remounting filesystems.
  6157. Only the superuser can mount, unmount, or remount a filesystem.
  6158. These functions do not access the ‘fstab’ and ‘mtab’ files. You
  6159. should maintain and use these separately. *Note Mount Information::.
  6160. The symbols in this section are declared in ‘sys/mount.h’.
  6161. -- Function: int mount (const char *SPECIAL_FILE, const char *DIR,
  6162. const char *FSTYPE, unsigned long int OPTIONS, const void
  6163. *DATA)
  6164. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  6165. Concepts::.
  6166. ‘mount’ mounts or remounts a filesystem. The two operations are
  6167. quite different and are merged rather unnaturally into this one
  6168. function. The ‘MS_REMOUNT’ option, explained below, determines
  6169. whether ‘mount’ mounts or remounts.
  6170. For a mount, the filesystem on the block device represented by the
  6171. device special file named SPECIAL_FILE gets mounted over the mount
  6172. point DIR. This means that the directory DIR (along with any files
  6173. in it) is no longer visible; in its place (and still with the name
  6174. DIR) is the root directory of the filesystem on the device.
  6175. As an exception, if the filesystem type (see below) is one which is
  6176. not based on a device (e.g. "proc"), ‘mount’ instantiates a
  6177. filesystem and mounts it over DIR and ignores SPECIAL_FILE.
  6178. For a remount, DIR specifies the mount point where the filesystem
  6179. to be remounted is (and remains) mounted and SPECIAL_FILE is
  6180. ignored. Remounting a filesystem means changing the options that
  6181. control operations on the filesystem while it is mounted. It does
  6182. not mean unmounting and mounting again.
  6183. For a mount, you must identify the type of the filesystem with
  6184. FSTYPE. This type tells the kernel how to access the filesystem
  6185. and can be thought of as the name of a filesystem driver. The
  6186. acceptable values are system dependent. On a system with a Linux
  6187. kernel and the ‘proc’ filesystem, the list of possible values is in
  6188. the file ‘filesystems’ in the ‘proc’ filesystem (e.g. type ‘cat
  6189. /proc/filesystems’ to see the list). With a Linux kernel, the
  6190. types of filesystems that ‘mount’ can mount, and their type names,
  6191. depends on what filesystem drivers are configured into the kernel
  6192. or loaded as loadable kernel modules. An example of a common value
  6193. for FSTYPE is ‘ext2’.
  6194. For a remount, ‘mount’ ignores FSTYPE.
  6195. OPTIONS specifies a variety of options that apply until the
  6196. filesystem is unmounted or remounted. The precise meaning of an
  6197. option depends on the filesystem and with some filesystems, an
  6198. option may have no effect at all. Furthermore, for some
  6199. filesystems, some of these options (but never ‘MS_RDONLY’) can be
  6200. overridden for individual file accesses via ‘ioctl’.
  6201. OPTIONS is a bit string with bit fields defined using the following
  6202. mask and masked value macros:
  6203. ‘MS_MGC_MASK’
  6204. This multibit field contains a magic number. If it does not
  6205. have the value ‘MS_MGC_VAL’, ‘mount’ assumes all the following
  6206. bits are zero and the DATA argument is a null string,
  6207. regardless of their actual values.
  6208. ‘MS_REMOUNT’
  6209. This bit on means to remount the filesystem. Off means to
  6210. mount it.
  6211. ‘MS_RDONLY’
  6212. This bit on specifies that no writing to the filesystem shall
  6213. be allowed while it is mounted. This cannot be overridden by
  6214. ‘ioctl’. This option is available on nearly all filesystems.
  6215. ‘MS_NOSUID’
  6216. This bit on specifies that Setuid and Setgid permissions on
  6217. files in the filesystem shall be ignored while it is mounted.
  6218. ‘MS_NOEXEC’
  6219. This bit on specifies that no files in the filesystem shall be
  6220. executed while the filesystem is mounted.
  6221. ‘MS_NODEV’
  6222. This bit on specifies that no device special files in the
  6223. filesystem shall be accessible while the filesystem is
  6224. mounted.
  6225. ‘MS_SYNCHRONOUS’
  6226. This bit on specifies that all writes to the filesystem while
  6227. it is mounted shall be synchronous; i.e., data shall be synced
  6228. before each write completes rather than held in the buffer
  6229. cache.
  6230. ‘MS_MANDLOCK’
  6231. This bit on specifies that mandatory locks on files shall be
  6232. permitted while the filesystem is mounted.
  6233. ‘MS_NOATIME’
  6234. This bit on specifies that access times of files shall not be
  6235. updated when the files are accessed while the filesystem is
  6236. mounted.
  6237. ‘MS_NODIRATIME’
  6238. This bit on specifies that access times of directories shall
  6239. not be updated when the directories are accessed while the
  6240. filesystem in mounted.
  6241. Any bits not covered by the above masks should be set off;
  6242. otherwise, results are undefined.
  6243. The meaning of DATA depends on the filesystem type and is
  6244. controlled entirely by the filesystem driver in the kernel.
  6245. Example:
  6246. #include <sys/mount.h>
  6247. mount("/dev/hdb", "/cdrom", "iso9660", MS_MGC_VAL | MS_RDONLY | MS_NOSUID, "");
  6248. mount("/dev/hda2", "/mnt", "", MS_MGC_VAL | MS_REMOUNT, "");
  6249. Appropriate arguments for ‘mount’ are conventionally recorded in
  6250. the ‘fstab’ table. *Note Mount Information::.
  6251. The return value is zero if the mount or remount is successful.
  6252. Otherwise, it is ‘-1’ and ‘errno’ is set appropriately. The values
  6253. of ‘errno’ are filesystem dependent, but here is a general list:
  6254. ‘EPERM’
  6255. The process is not superuser.
  6256. ‘ENODEV’
  6257. The file system type FSTYPE is not known to the kernel.
  6258. ‘ENOTBLK’
  6259. The file DEV is not a block device special file.
  6260. ‘EBUSY’
  6261. • The device is already mounted.
  6262. • The mount point is busy. (E.g. it is some process'
  6263. working directory or has a filesystem mounted on it
  6264. already).
  6265. • The request is to remount read-only, but there are files
  6266. open for writing.
  6267. ‘EINVAL’
  6268. • A remount was attempted, but there is no filesystem
  6269. mounted over the specified mount point.
  6270. • The supposed filesystem has an invalid superblock.
  6271. ‘EACCES’
  6272. • The filesystem is inherently read-only (possibly due to a
  6273. switch on the device) and the process attempted to mount
  6274. it read/write (by setting the ‘MS_RDONLY’ bit off).
  6275. • SPECIAL_FILE or DIR is not accessible due to file
  6276. permissions.
  6277. • SPECIAL_FILE is not accessible because it is in a
  6278. filesystem that is mounted with the ‘MS_NODEV’ option.
  6279. ‘EM_FILE’
  6280. The table of dummy devices is full. ‘mount’ needs to create a
  6281. dummy device (aka "unnamed" device) if the filesystem being
  6282. mounted is not one that uses a device.
  6283. -- Function: int umount2 (const char *FILE, int FLAGS)
  6284. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  6285. Concepts::.
  6286. ‘umount2’ unmounts a filesystem.
  6287. You can identify the filesystem to unmount either by the device
  6288. special file that contains the filesystem or by the mount point.
  6289. The effect is the same. Specify either as the string FILE.
  6290. FLAGS contains the one-bit field identified by the following mask
  6291. macro:
  6292. ‘MNT_FORCE’
  6293. This bit on means to force the unmounting even if the
  6294. filesystem is busy, by making it unbusy first. If the bit is
  6295. off and the filesystem is busy, ‘umount2’ fails with ‘errno’ =
  6296. ‘EBUSY’. Depending on the filesystem, this may override all,
  6297. some, or no busy conditions.
  6298. All other bits in FLAGS should be set to zero; otherwise, the
  6299. result is undefined.
  6300. Example:
  6301. #include <sys/mount.h>
  6302. umount2("/mnt", MNT_FORCE);
  6303. umount2("/dev/hdd1", 0);
  6304. After the filesystem is unmounted, the directory that was the mount
  6305. point is visible, as are any files in it.
  6306. As part of unmounting, ‘umount2’ syncs the filesystem.
  6307. If the unmounting is successful, the return value is zero.
  6308. Otherwise, it is ‘-1’ and ‘errno’ is set accordingly:
  6309. ‘EPERM’
  6310. The process is not superuser.
  6311. ‘EBUSY’
  6312. The filesystem cannot be unmounted because it is busy. E.g.
  6313. it contains a directory that is some process's working
  6314. directory or a file that some process has open. With some
  6315. filesystems in some cases, you can avoid this failure with the
  6316. ‘MNT_FORCE’ option.
  6317. ‘EINVAL’
  6318. FILE validly refers to a file, but that file is neither a
  6319. mount point nor a device special file of a currently mounted
  6320. filesystem.
  6321. This function is not available on all systems.
  6322. -- Function: int umount (const char *FILE)
  6323. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  6324. Concepts::.
  6325. ‘umount’ does the same thing as ‘umount2’ with FLAGS set to zeroes.
  6326. It is more widely available than ‘umount2’ but since it lacks the
  6327. possibility to forcefully unmount a filesystem is deprecated when
  6328. ‘umount2’ is also available.