libc.info-8 293 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607
  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: File Size, Next: Storage Allocation, Prev: File Times, Up: File Attributes
  2438. 14.10.10 File Size
  2439. ------------------
  2440. Normally file sizes are maintained automatically. A file begins with a
  2441. size of 0 and is automatically extended when data is written past its
  2442. end. It is also possible to empty a file completely by an ‘open’ or
  2443. ‘fopen’ call.
  2444. However, sometimes it is necessary to _reduce_ the size of a file.
  2445. This can be done with the ‘truncate’ and ‘ftruncate’ functions. They
  2446. were introduced in BSD Unix. ‘ftruncate’ was later added to POSIX.1.
  2447. Some systems allow you to extend a file (creating holes) with these
  2448. functions. This is useful when using memory-mapped I/O (*note
  2449. Memory-mapped I/O::), where files are not automatically extended.
  2450. However, it is not portable but must be implemented if ‘mmap’ allows
  2451. mapping of files (i.e., ‘_POSIX_MAPPED_FILES’ is defined).
  2452. Using these functions on anything other than a regular file gives
  2453. _undefined_ results. On many systems, such a call will appear to
  2454. succeed, without actually accomplishing anything.
  2455. -- Function: int truncate (const char *FILENAME, off_t LENGTH)
  2456. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2457. Concepts::.
  2458. The ‘truncate’ function changes the size of FILENAME to LENGTH. If
  2459. LENGTH is shorter than the previous length, data at the end will be
  2460. lost. The file must be writable by the user to perform this
  2461. operation.
  2462. If LENGTH is longer, holes will be added to the end. However, some
  2463. systems do not support this feature and will leave the file
  2464. unchanged.
  2465. When the source file is compiled with ‘_FILE_OFFSET_BITS == 64’ the
  2466. ‘truncate’ function is in fact ‘truncate64’ and the type ‘off_t’
  2467. has 64 bits which makes it possible to handle files up to 2^63
  2468. bytes in length.
  2469. The return value is 0 for success, or -1 for an error. In addition
  2470. to the usual file name errors, the following errors may occur:
  2471. ‘EACCES’
  2472. The file is a directory or not writable.
  2473. ‘EINVAL’
  2474. LENGTH is negative.
  2475. ‘EFBIG’
  2476. The operation would extend the file beyond the limits of the
  2477. operating system.
  2478. ‘EIO’
  2479. A hardware I/O error occurred.
  2480. ‘EPERM’
  2481. The file is "append-only" or "immutable".
  2482. ‘EINTR’
  2483. The operation was interrupted by a signal.
  2484. -- Function: int truncate64 (const char *NAME, off64_t LENGTH)
  2485. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2486. Concepts::.
  2487. This function is similar to the ‘truncate’ function. The
  2488. difference is that the LENGTH argument is 64 bits wide even on 32
  2489. bits machines, which allows the handling of files with sizes up to
  2490. 2^63 bytes.
  2491. When the source file is compiled with ‘_FILE_OFFSET_BITS == 64’ on
  2492. a 32 bits machine this function is actually available under the
  2493. name ‘truncate’ and so transparently replaces the 32 bits
  2494. interface.
  2495. -- Function: int ftruncate (int FD, off_t LENGTH)
  2496. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2497. Concepts::.
  2498. This is like ‘truncate’, but it works on a file descriptor FD for
  2499. an opened file instead of a file name to identify the object. The
  2500. file must be opened for writing to successfully carry out the
  2501. operation.
  2502. The POSIX standard leaves it implementation defined what happens if
  2503. the specified new LENGTH of the file is bigger than the original
  2504. size. The ‘ftruncate’ function might simply leave the file alone
  2505. and do nothing or it can increase the size to the desired size. In
  2506. this later case the extended area should be zero-filled. So using
  2507. ‘ftruncate’ is no reliable way to increase the file size but if it
  2508. is possible it is probably the fastest way. The function also
  2509. operates on POSIX shared memory segments if these are implemented
  2510. by the system.
  2511. ‘ftruncate’ is especially useful in combination with ‘mmap’. Since
  2512. the mapped region must have a fixed size one cannot enlarge the
  2513. file by writing something beyond the last mapped page. Instead one
  2514. has to enlarge the file itself and then remap the file with the new
  2515. size. The example below shows how this works.
  2516. When the source file is compiled with ‘_FILE_OFFSET_BITS == 64’ the
  2517. ‘ftruncate’ function is in fact ‘ftruncate64’ and the type ‘off_t’
  2518. has 64 bits which makes it possible to handle files up to 2^63
  2519. bytes in length.
  2520. The return value is 0 for success, or -1 for an error. The
  2521. following errors may occur:
  2522. ‘EBADF’
  2523. FD does not correspond to an open file.
  2524. ‘EACCES’
  2525. FD is a directory or not open for writing.
  2526. ‘EINVAL’
  2527. LENGTH is negative.
  2528. ‘EFBIG’
  2529. The operation would extend the file beyond the limits of the
  2530. operating system.
  2531. ‘EIO’
  2532. A hardware I/O error occurred.
  2533. ‘EPERM’
  2534. The file is "append-only" or "immutable".
  2535. ‘EINTR’
  2536. The operation was interrupted by a signal.
  2537. -- Function: int ftruncate64 (int ID, off64_t LENGTH)
  2538. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2539. Concepts::.
  2540. This function is similar to the ‘ftruncate’ function. The
  2541. difference is that the LENGTH argument is 64 bits wide even on 32
  2542. bits machines which allows the handling of files with sizes up to
  2543. 2^63 bytes.
  2544. When the source file is compiled with ‘_FILE_OFFSET_BITS == 64’ on
  2545. a 32 bits machine this function is actually available under the
  2546. name ‘ftruncate’ and so transparently replaces the 32 bits
  2547. interface.
  2548. As announced here is a little example of how to use ‘ftruncate’ in
  2549. combination with ‘mmap’:
  2550. int fd;
  2551. void *start;
  2552. size_t len;
  2553. int
  2554. add (off_t at, void *block, size_t size)
  2555. {
  2556. if (at + size > len)
  2557. {
  2558. /* Resize the file and remap. */
  2559. size_t ps = sysconf (_SC_PAGESIZE);
  2560. size_t ns = (at + size + ps - 1) & ~(ps - 1);
  2561. void *np;
  2562. if (ftruncate (fd, ns) < 0)
  2563. return -1;
  2564. np = mmap (NULL, ns, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
  2565. if (np == MAP_FAILED)
  2566. return -1;
  2567. start = np;
  2568. len = ns;
  2569. }
  2570. memcpy ((char *) start + at, block, size);
  2571. return 0;
  2572. }
  2573. The function ‘add’ writes a block of memory at an arbitrary position
  2574. in the file. If the current size of the file is too small it is
  2575. extended. Note that it is extended by a whole number of pages. This is
  2576. a requirement of ‘mmap’. The program has to keep track of the real
  2577. size, and when it has finished a final ‘ftruncate’ call should set the
  2578. real size of the file.
  2579. 
  2580. File: libc.info, Node: Storage Allocation, Prev: File Size, Up: File Attributes
  2581. 14.10.11 Storage Allocation
  2582. ---------------------------
  2583. Most file systems support allocating large files in a non-contiguous
  2584. fashion: the file is split into _fragments_ which are allocated
  2585. sequentially, but the fragments themselves can be scattered across the
  2586. disk. File systems generally try to avoid such fragmentation because it
  2587. decreases performance, but if a file gradually increases in size, there
  2588. might be no other option than to fragment it. In addition, many file
  2589. systems support _sparse files_ with _holes_: regions of null bytes for
  2590. which no backing storage has been allocated by the file system. When
  2591. the holes are finally overwritten with data, fragmentation can occur as
  2592. well.
  2593. Explicit allocation of storage for yet-unwritten parts of the file
  2594. can help the system to avoid fragmentation. Additionally, if storage
  2595. pre-allocation fails, it is possible to report the out-of-disk error
  2596. early, often without filling up the entire disk. However, due to
  2597. deduplication, copy-on-write semantics, and file compression, such
  2598. pre-allocation may not reliably prevent the out-of-disk-space error from
  2599. occurring later. Checking for write errors is still required, and
  2600. writes to memory-mapped regions created with ‘mmap’ can still result in
  2601. ‘SIGBUS’.
  2602. -- Function: int posix_fallocate (int FD, off_t OFFSET, off_t LENGTH)
  2603. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2604. Concepts::.
  2605. Allocate backing store for the region of LENGTH bytes starting at
  2606. byte OFFSET in the file for the descriptor FD. The file length is
  2607. increased to ‘LENGTH + OFFSET’ if necessary.
  2608. FD must be a regular file opened for writing, or ‘EBADF’ is
  2609. returned. If there is insufficient disk space to fulfill the
  2610. allocation request, ‘ENOSPC’ is returned.
  2611. *Note:* If ‘fallocate’ is not available (because the file system
  2612. does not support it), ‘posix_fallocate’ is emulated, which has the
  2613. following drawbacks:
  2614. • It is very inefficient because all file system blocks in the
  2615. requested range need to be examined (even if they have been
  2616. allocated before) and potentially rewritten. In contrast,
  2617. with proper ‘fallocate’ support (see below), the file system
  2618. can examine the internal file allocation data structures and
  2619. eliminate holes directly, maybe even using unwritten extents
  2620. (which are pre-allocated but uninitialized on disk).
  2621. • There is a race condition if another thread or process
  2622. modifies the underlying file in the to-be-allocated area.
  2623. Non-null bytes could be overwritten with null bytes.
  2624. • If FD has been opened with the ‘O_WRONLY’ flag, the function
  2625. will fail with an ‘errno’ value of ‘EBADF’.
  2626. • If FD has been opened with the ‘O_APPEND’ flag, the function
  2627. will fail with an ‘errno’ value of ‘EBADF’.
  2628. • If LENGTH is zero, ‘ftruncate’ is used to increase the file
  2629. size as requested, without allocating file system blocks.
  2630. There is a race condition which means that ‘ftruncate’ can
  2631. accidentally truncate the file if it has been extended
  2632. concurrently.
  2633. On Linux, if an application does not benefit from emulation or if
  2634. the emulation is harmful due to its inherent race conditions, the
  2635. application can use the Linux-specific ‘fallocate’ function, with a
  2636. zero flag argument. For the ‘fallocate’ function, the GNU C
  2637. Library does not perform allocation emulation if the file system
  2638. does not support allocation. Instead, an ‘EOPNOTSUPP’ is returned
  2639. to the caller.
  2640. -- Function: int posix_fallocate64 (int FD, off64_t OFFSET, off64_t
  2641. LENGTH)
  2642. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2643. Concepts::.
  2644. This function is a variant of ‘posix_fallocate64’ which accepts
  2645. 64-bit file offsets on all platforms.
  2646. 
  2647. File: libc.info, Node: Making Special Files, Next: Temporary Files, Prev: File Attributes, Up: File System Interface
  2648. 14.11 Making Special Files
  2649. ==========================
  2650. The ‘mknod’ function is the primitive for making special files, such as
  2651. files that correspond to devices. The GNU C Library includes this
  2652. function for compatibility with BSD.
  2653. The prototype for ‘mknod’ is declared in ‘sys/stat.h’.
  2654. -- Function: int mknod (const char *FILENAME, mode_t MODE, dev_t DEV)
  2655. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2656. Concepts::.
  2657. The ‘mknod’ function makes a special file with name FILENAME. The
  2658. MODE specifies the mode of the file, and may include the various
  2659. special file bits, such as ‘S_IFCHR’ (for a character special file)
  2660. or ‘S_IFBLK’ (for a block special file). *Note Testing File
  2661. Type::.
  2662. The DEV argument specifies which device the special file refers to.
  2663. Its exact interpretation depends on the kind of special file being
  2664. created.
  2665. The return value is ‘0’ on success and ‘-1’ on error. In addition
  2666. to the usual file name errors (*note File Name Errors::), the
  2667. following ‘errno’ error conditions are defined for this function:
  2668. ‘EPERM’
  2669. The calling process is not privileged. Only the superuser can
  2670. create special files.
  2671. ‘ENOSPC’
  2672. The directory or file system that would contain the new file
  2673. is full and cannot be extended.
  2674. ‘EROFS’
  2675. The directory containing the new file can't be modified
  2676. because it's on a read-only file system.
  2677. ‘EEXIST’
  2678. There is already a file named FILENAME. If you want to
  2679. replace this file, you must remove the old file explicitly
  2680. first.
  2681. 
  2682. File: libc.info, Node: Temporary Files, Prev: Making Special Files, Up: File System Interface
  2683. 14.12 Temporary Files
  2684. =====================
  2685. If you need to use a temporary file in your program, you can use the
  2686. ‘tmpfile’ function to open it. Or you can use the ‘tmpnam’ (better:
  2687. ‘tmpnam_r’) function to provide a name for a temporary file and then you
  2688. can open it in the usual way with ‘fopen’.
  2689. The ‘tempnam’ function is like ‘tmpnam’ but lets you choose what
  2690. directory temporary files will go in, and something about what their
  2691. file names will look like. Important for multi-threaded programs is
  2692. that ‘tempnam’ is reentrant, while ‘tmpnam’ is not since it returns a
  2693. pointer to a static buffer.
  2694. These facilities are declared in the header file ‘stdio.h’.
  2695. -- Function: FILE * tmpfile (void)
  2696. Preliminary: | MT-Safe | AS-Unsafe heap lock | AC-Unsafe mem fd
  2697. lock | *Note POSIX Safety Concepts::.
  2698. This function creates a temporary binary file for update mode, as
  2699. if by calling ‘fopen’ with mode ‘"wb+"’. The file is deleted
  2700. automatically when it is closed or when the program terminates.
  2701. (On some other ISO C systems the file may fail to be deleted if the
  2702. program terminates abnormally).
  2703. This function is reentrant.
  2704. When the sources are compiled with ‘_FILE_OFFSET_BITS == 64’ on a
  2705. 32-bit system this function is in fact ‘tmpfile64’, i.e., the LFS
  2706. interface transparently replaces the old interface.
  2707. -- Function: FILE * tmpfile64 (void)
  2708. Preliminary: | MT-Safe | AS-Unsafe heap lock | AC-Unsafe mem fd
  2709. lock | *Note POSIX Safety Concepts::.
  2710. This function is similar to ‘tmpfile’, but the stream it returns a
  2711. pointer to was opened using ‘tmpfile64’. Therefore this stream can
  2712. be used for files larger than 2^31 bytes on 32-bit machines.
  2713. Please note that the return type is still ‘FILE *’. There is no
  2714. special ‘FILE’ type for the LFS interface.
  2715. If the sources are compiled with ‘_FILE_OFFSET_BITS == 64’ on a 32
  2716. bits machine this function is available under the name ‘tmpfile’
  2717. and so transparently replaces the old interface.
  2718. -- Function: char * tmpnam (char *RESULT)
  2719. Preliminary: | MT-Unsafe race:tmpnam/!result | AS-Unsafe | AC-Safe
  2720. | *Note POSIX Safety Concepts::.
  2721. This function constructs and returns a valid file name that does
  2722. not refer to any existing file. If the RESULT argument is a null
  2723. pointer, the return value is a pointer to an internal static
  2724. string, which might be modified by subsequent calls and therefore
  2725. makes this function non-reentrant. Otherwise, the RESULT argument
  2726. should be a pointer to an array of at least ‘L_tmpnam’ characters,
  2727. and the result is written into that array.
  2728. It is possible for ‘tmpnam’ to fail if you call it too many times
  2729. without removing previously-created files. This is because the
  2730. limited length of the temporary file names gives room for only a
  2731. finite number of different names. If ‘tmpnam’ fails it returns a
  2732. null pointer.
  2733. *Warning:* Between the time the pathname is constructed and the
  2734. file is created another process might have created a file with the
  2735. same name using ‘tmpnam’, leading to a possible security hole. The
  2736. implementation generates names which can hardly be predicted, but
  2737. when opening the file you should use the ‘O_EXCL’ flag. Using
  2738. ‘tmpfile’ or ‘mkstemp’ is a safe way to avoid this problem.
  2739. -- Function: char * tmpnam_r (char *RESULT)
  2740. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2741. Concepts::.
  2742. This function is nearly identical to the ‘tmpnam’ function, except
  2743. that if RESULT is a null pointer it returns a null pointer.
  2744. This guarantees reentrancy because the non-reentrant situation of
  2745. ‘tmpnam’ cannot happen here.
  2746. *Warning*: This function has the same security problems as
  2747. ‘tmpnam’.
  2748. -- Macro: int L_tmpnam
  2749. The value of this macro is an integer constant expression that
  2750. represents the minimum size of a string large enough to hold a file
  2751. name generated by the ‘tmpnam’ function.
  2752. -- Macro: int TMP_MAX
  2753. The macro ‘TMP_MAX’ is a lower bound for how many temporary names
  2754. you can create with ‘tmpnam’. You can rely on being able to call
  2755. ‘tmpnam’ at least this many times before it might fail saying you
  2756. have made too many temporary file names.
  2757. With the GNU C Library, you can create a very large number of
  2758. temporary file names. If you actually created the files, you would
  2759. probably run out of disk space before you ran out of names. Some
  2760. other systems have a fixed, small limit on the number of temporary
  2761. files. The limit is never less than ‘25’.
  2762. -- Function: char * tempnam (const char *DIR, const char *PREFIX)
  2763. Preliminary: | MT-Safe env | AS-Unsafe heap | AC-Unsafe mem | *Note
  2764. POSIX Safety Concepts::.
  2765. This function generates a unique temporary file name. If PREFIX is
  2766. not a null pointer, up to five characters of this string are used
  2767. as a prefix for the file name. The return value is a string newly
  2768. allocated with ‘malloc’, so you should release its storage with
  2769. ‘free’ when it is no longer needed.
  2770. Because the string is dynamically allocated this function is
  2771. reentrant.
  2772. The directory prefix for the temporary file name is determined by
  2773. testing each of the following in sequence. The directory must
  2774. exist and be writable.
  2775. • The environment variable ‘TMPDIR’, if it is defined. For
  2776. security reasons this only happens if the program is not SUID
  2777. or SGID enabled.
  2778. • The DIR argument, if it is not a null pointer.
  2779. • The value of the ‘P_tmpdir’ macro.
  2780. • The directory ‘/tmp’.
  2781. This function is defined for SVID compatibility.
  2782. *Warning:* Between the time the pathname is constructed and the
  2783. file is created another process might have created a file with the
  2784. same name using ‘tempnam’, leading to a possible security hole.
  2785. The implementation generates names which can hardly be predicted,
  2786. but when opening the file you should use the ‘O_EXCL’ flag. Using
  2787. ‘tmpfile’ or ‘mkstemp’ is a safe way to avoid this problem.
  2788. -- SVID Macro: char * P_tmpdir
  2789. This macro is the name of the default directory for temporary
  2790. files.
  2791. Older Unix systems did not have the functions just described.
  2792. Instead they used ‘mktemp’ and ‘mkstemp’. Both of these functions work
  2793. by modifying a file name template string you pass. The last six
  2794. characters of this string must be ‘XXXXXX’. These six ‘X’s are replaced
  2795. with six characters which make the whole string a unique file name.
  2796. Usually the template string is something like ‘/tmp/PREFIXXXXXXX’, and
  2797. each program uses a unique PREFIX.
  2798. *NB:* Because ‘mktemp’ and ‘mkstemp’ modify the template string, you
  2799. _must not_ pass string constants to them. String constants are normally
  2800. in read-only storage, so your program would crash when ‘mktemp’ or
  2801. ‘mkstemp’ tried to modify the string. These functions are declared in
  2802. the header file ‘stdlib.h’.
  2803. -- Function: char * mktemp (char *TEMPLATE)
  2804. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2805. Concepts::.
  2806. The ‘mktemp’ function generates a unique file name by modifying
  2807. TEMPLATE as described above. If successful, it returns TEMPLATE as
  2808. modified. If ‘mktemp’ cannot find a unique file name, it makes
  2809. TEMPLATE an empty string and returns that. If TEMPLATE does not
  2810. end with ‘XXXXXX’, ‘mktemp’ returns a null pointer.
  2811. *Warning:* Between the time the pathname is constructed and the
  2812. file is created another process might have created a file with the
  2813. same name using ‘mktemp’, leading to a possible security hole. The
  2814. implementation generates names which can hardly be predicted, but
  2815. when opening the file you should use the ‘O_EXCL’ flag. Using
  2816. ‘mkstemp’ is a safe way to avoid this problem.
  2817. -- Function: int mkstemp (char *TEMPLATE)
  2818. Preliminary: | MT-Safe | AS-Safe | AC-Safe fd | *Note POSIX Safety
  2819. Concepts::.
  2820. The ‘mkstemp’ function generates a unique file name just as
  2821. ‘mktemp’ does, but it also opens the file for you with ‘open’
  2822. (*note Opening and Closing Files::). If successful, it modifies
  2823. TEMPLATE in place and returns a file descriptor for that file open
  2824. for reading and writing. If ‘mkstemp’ cannot create a
  2825. uniquely-named file, it returns ‘-1’. If TEMPLATE does not end
  2826. with ‘XXXXXX’, ‘mkstemp’ returns ‘-1’ and does not modify TEMPLATE.
  2827. The file is opened using mode ‘0600’. If the file is meant to be
  2828. used by other users this mode must be changed explicitly.
  2829. Unlike ‘mktemp’, ‘mkstemp’ is actually guaranteed to create a unique
  2830. file that cannot possibly clash with any other program trying to create
  2831. a temporary file. This is because it works by calling ‘open’ with the
  2832. ‘O_EXCL’ flag, which says you want to create a new file and get an error
  2833. if the file already exists.
  2834. -- Function: char * mkdtemp (char *TEMPLATE)
  2835. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  2836. Concepts::.
  2837. The ‘mkdtemp’ function creates a directory with a unique name. If
  2838. it succeeds, it overwrites TEMPLATE with the name of the directory,
  2839. and returns TEMPLATE. As with ‘mktemp’ and ‘mkstemp’, TEMPLATE
  2840. should be a string ending with ‘XXXXXX’.
  2841. If ‘mkdtemp’ cannot create an uniquely named directory, it returns
  2842. ‘NULL’ and sets ‘errno’ appropriately. If TEMPLATE does not end
  2843. with ‘XXXXXX’, ‘mkdtemp’ returns ‘NULL’ and does not modify
  2844. TEMPLATE. ‘errno’ will be set to ‘EINVAL’ in this case.
  2845. The directory is created using mode ‘0700’.
  2846. The directory created by ‘mkdtemp’ cannot clash with temporary files
  2847. or directories created by other users. This is because directory
  2848. creation always works like ‘open’ with ‘O_EXCL’. *Note Creating
  2849. Directories::.
  2850. The ‘mkdtemp’ function comes from OpenBSD.
  2851. 
  2852. File: libc.info, Node: Pipes and FIFOs, Next: Sockets, Prev: File System Interface, Up: Top
  2853. 15 Pipes and FIFOs
  2854. ******************
  2855. A “pipe” is a mechanism for interprocess communication; data written to
  2856. the pipe by one process can be read by another process. The data is
  2857. handled in a first-in, first-out (FIFO) order. The pipe has no name; it
  2858. is created for one use and both ends must be inherited from the single
  2859. process which created the pipe.
  2860. A “FIFO special file” is similar to a pipe, but instead of being an
  2861. anonymous, temporary connection, a FIFO has a name or names like any
  2862. other file. Processes open the FIFO by name in order to communicate
  2863. through it.
  2864. A pipe or FIFO has to be open at both ends simultaneously. If you
  2865. read from a pipe or FIFO file that doesn't have any processes writing to
  2866. it (perhaps because they have all closed the file, or exited), the read
  2867. returns end-of-file. Writing to a pipe or FIFO that doesn't have a
  2868. reading process is treated as an error condition; it generates a
  2869. ‘SIGPIPE’ signal, and fails with error code ‘EPIPE’ if the signal is
  2870. handled or blocked.
  2871. Neither pipes nor FIFO special files allow file positioning. Both
  2872. reading and writing operations happen sequentially; reading from the
  2873. beginning of the file and writing at the end.
  2874. * Menu:
  2875. * Creating a Pipe:: Making a pipe with the ‘pipe’ function.
  2876. * Pipe to a Subprocess:: Using a pipe to communicate with a
  2877. child process.
  2878. * FIFO Special Files:: Making a FIFO special file.
  2879. * Pipe Atomicity:: When pipe (or FIFO) I/O is atomic.
  2880. 
  2881. File: libc.info, Node: Creating a Pipe, Next: Pipe to a Subprocess, Up: Pipes and FIFOs
  2882. 15.1 Creating a Pipe
  2883. ====================
  2884. The primitive for creating a pipe is the ‘pipe’ function. This creates
  2885. both the reading and writing ends of the pipe. It is not very useful
  2886. for a single process to use a pipe to talk to itself. In typical use, a
  2887. process creates a pipe just before it forks one or more child processes
  2888. (*note Creating a Process::). The pipe is then used for communication
  2889. either between the parent or child processes, or between two sibling
  2890. processes.
  2891. The ‘pipe’ function is declared in the header file ‘unistd.h’.
  2892. -- Function: int pipe (int FILEDES[2])
  2893. Preliminary: | MT-Safe | AS-Safe | AC-Safe fd | *Note POSIX Safety
  2894. Concepts::.
  2895. The ‘pipe’ function creates a pipe and puts the file descriptors
  2896. for the reading and writing ends of the pipe (respectively) into
  2897. ‘FILEDES[0]’ and ‘FILEDES[1]’.
  2898. An easy way to remember that the input end comes first is that file
  2899. descriptor ‘0’ is standard input, and file descriptor ‘1’ is
  2900. standard output.
  2901. If successful, ‘pipe’ returns a value of ‘0’. On failure, ‘-1’ is
  2902. returned. The following ‘errno’ error conditions are defined for
  2903. this function:
  2904. ‘EMFILE’
  2905. The process has too many files open.
  2906. ‘ENFILE’
  2907. There are too many open files in the entire system. *Note
  2908. Error Codes::, for more information about ‘ENFILE’. This
  2909. error never occurs on GNU/Hurd systems.
  2910. Here is an example of a simple program that creates a pipe. This
  2911. program uses the ‘fork’ function (*note Creating a Process::) to create
  2912. a child process. The parent process writes data to the pipe, which is
  2913. read by the child process.
  2914. #include <sys/types.h>
  2915. #include <unistd.h>
  2916. #include <stdio.h>
  2917. #include <stdlib.h>
  2918. /* Read characters from the pipe and echo them to ‘stdout’. */
  2919. void
  2920. read_from_pipe (int file)
  2921. {
  2922. FILE *stream;
  2923. int c;
  2924. stream = fdopen (file, "r");
  2925. while ((c = fgetc (stream)) != EOF)
  2926. putchar (c);
  2927. fclose (stream);
  2928. }
  2929. /* Write some random text to the pipe. */
  2930. void
  2931. write_to_pipe (int file)
  2932. {
  2933. FILE *stream;
  2934. stream = fdopen (file, "w");
  2935. fprintf (stream, "hello, world!\n");
  2936. fprintf (stream, "goodbye, world!\n");
  2937. fclose (stream);
  2938. }
  2939. int
  2940. main (void)
  2941. {
  2942. pid_t pid;
  2943. int mypipe[2];
  2944. /* Create the pipe. */
  2945. if (pipe (mypipe))
  2946. {
  2947. fprintf (stderr, "Pipe failed.\n");
  2948. return EXIT_FAILURE;
  2949. }
  2950. /* Create the child process. */
  2951. pid = fork ();
  2952. if (pid == (pid_t) 0)
  2953. {
  2954. /* This is the child process.
  2955. Close other end first. */
  2956. close (mypipe[1]);
  2957. read_from_pipe (mypipe[0]);
  2958. return EXIT_SUCCESS;
  2959. }
  2960. else if (pid < (pid_t) 0)
  2961. {
  2962. /* The fork failed. */
  2963. fprintf (stderr, "Fork failed.\n");
  2964. return EXIT_FAILURE;
  2965. }
  2966. else
  2967. {
  2968. /* This is the parent process.
  2969. Close other end first. */
  2970. close (mypipe[0]);
  2971. write_to_pipe (mypipe[1]);
  2972. return EXIT_SUCCESS;
  2973. }
  2974. }
  2975. 
  2976. File: libc.info, Node: Pipe to a Subprocess, Next: FIFO Special Files, Prev: Creating a Pipe, Up: Pipes and FIFOs
  2977. 15.2 Pipe to a Subprocess
  2978. =========================
  2979. A common use of pipes is to send data to or receive data from a program
  2980. being run as a subprocess. One way of doing this is by using a
  2981. combination of ‘pipe’ (to create the pipe), ‘fork’ (to create the
  2982. subprocess), ‘dup2’ (to force the subprocess to use the pipe as its
  2983. standard input or output channel), and ‘exec’ (to execute the new
  2984. program). Or, you can use ‘popen’ and ‘pclose’.
  2985. The advantage of using ‘popen’ and ‘pclose’ is that the interface is
  2986. much simpler and easier to use. But it doesn't offer as much
  2987. flexibility as using the low-level functions directly.
  2988. -- Function: FILE * popen (const char *COMMAND, const char *MODE)
  2989. Preliminary: | MT-Safe | AS-Unsafe heap corrupt | AC-Unsafe corrupt
  2990. lock fd mem | *Note POSIX Safety Concepts::.
  2991. The ‘popen’ function is closely related to the ‘system’ function;
  2992. see *note Running a Command::. It executes the shell command
  2993. COMMAND as a subprocess. However, instead of waiting for the
  2994. command to complete, it creates a pipe to the subprocess and
  2995. returns a stream that corresponds to that pipe.
  2996. If you specify a MODE argument of ‘"r"’, you can read from the
  2997. stream to retrieve data from the standard output channel of the
  2998. subprocess. The subprocess inherits its standard input channel
  2999. from the parent process.
  3000. Similarly, if you specify a MODE argument of ‘"w"’, you can write
  3001. to the stream to send data to the standard input channel of the
  3002. subprocess. The subprocess inherits its standard output channel
  3003. from the parent process.
  3004. In the event of an error ‘popen’ returns a null pointer. This
  3005. might happen if the pipe or stream cannot be created, if the
  3006. subprocess cannot be forked, or if the program cannot be executed.
  3007. -- Function: int pclose (FILE *STREAM)
  3008. Preliminary: | MT-Safe | AS-Unsafe heap plugin corrupt lock |
  3009. AC-Unsafe corrupt lock fd mem | *Note POSIX Safety Concepts::.
  3010. The ‘pclose’ function is used to close a stream created by ‘popen’.
  3011. It waits for the child process to terminate and returns its status
  3012. value, as for the ‘system’ function.
  3013. Here is an example showing how to use ‘popen’ and ‘pclose’ to filter
  3014. output through another program, in this case the paging program ‘more’.
  3015. #include <stdio.h>
  3016. #include <stdlib.h>
  3017. void
  3018. write_data (FILE * stream)
  3019. {
  3020. int i;
  3021. for (i = 0; i < 100; i++)
  3022. fprintf (stream, "%d\n", i);
  3023. if (ferror (stream))
  3024. {
  3025. fprintf (stderr, "Output to stream failed.\n");
  3026. exit (EXIT_FAILURE);
  3027. }
  3028. }
  3029. int
  3030. main (void)
  3031. {
  3032. FILE *output;
  3033. output = popen ("more", "w");
  3034. if (!output)
  3035. {
  3036. fprintf (stderr,
  3037. "incorrect parameters or too many files.\n");
  3038. return EXIT_FAILURE;
  3039. }
  3040. write_data (output);
  3041. if (pclose (output) != 0)
  3042. {
  3043. fprintf (stderr,
  3044. "Could not run more or other error.\n");
  3045. }
  3046. return EXIT_SUCCESS;
  3047. }
  3048. 
  3049. File: libc.info, Node: FIFO Special Files, Next: Pipe Atomicity, Prev: Pipe to a Subprocess, Up: Pipes and FIFOs
  3050. 15.3 FIFO Special Files
  3051. =======================
  3052. A FIFO special file is similar to a pipe, except that it is created in a
  3053. different way. Instead of being an anonymous communications channel, a
  3054. FIFO special file is entered into the file system by calling ‘mkfifo’.
  3055. Once you have created a FIFO special file in this way, any process
  3056. can open it for reading or writing, in the same way as an ordinary file.
  3057. However, it has to be open at both ends simultaneously before you can
  3058. proceed to do any input or output operations on it. Opening a FIFO for
  3059. reading normally blocks until some other process opens the same FIFO for
  3060. writing, and vice versa.
  3061. The ‘mkfifo’ function is declared in the header file ‘sys/stat.h’.
  3062. -- Function: int mkfifo (const char *FILENAME, mode_t MODE)
  3063. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3064. Concepts::.
  3065. The ‘mkfifo’ function makes a FIFO special file with name FILENAME.
  3066. The MODE argument is used to set the file's permissions; see *note
  3067. Setting Permissions::.
  3068. The normal, successful return value from ‘mkfifo’ is ‘0’. In the
  3069. case of an error, ‘-1’ is returned. In addition to the usual file
  3070. name errors (*note File Name Errors::), the following ‘errno’ error
  3071. conditions are defined for this function:
  3072. ‘EEXIST’
  3073. The named file already exists.
  3074. ‘ENOSPC’
  3075. The directory or file system cannot be extended.
  3076. ‘EROFS’
  3077. The directory that would contain the file resides on a
  3078. read-only file system.
  3079. 
  3080. File: libc.info, Node: Pipe Atomicity, Prev: FIFO Special Files, Up: Pipes and FIFOs
  3081. 15.4 Atomicity of Pipe I/O
  3082. ==========================
  3083. Reading or writing pipe data is “atomic” if the size of data written is
  3084. not greater than ‘PIPE_BUF’. This means that the data transfer seems to
  3085. be an instantaneous unit, in that nothing else in the system can observe
  3086. a state in which it is partially complete. Atomic I/O may not begin
  3087. right away (it may need to wait for buffer space or for data), but once
  3088. it does begin it finishes immediately.
  3089. Reading or writing a larger amount of data may not be atomic; for
  3090. example, output data from other processes sharing the descriptor may be
  3091. interspersed. Also, once ‘PIPE_BUF’ characters have been written,
  3092. further writes will block until some characters are read.
  3093. *Note Limits for Files::, for information about the ‘PIPE_BUF’
  3094. parameter.
  3095. 
  3096. File: libc.info, Node: Sockets, Next: Low-Level Terminal Interface, Prev: Pipes and FIFOs, Up: Top
  3097. 16 Sockets
  3098. **********
  3099. This chapter describes the GNU facilities for interprocess communication
  3100. using sockets.
  3101. A “socket” is a generalized interprocess communication channel. Like
  3102. a pipe, a socket is represented as a file descriptor. Unlike pipes
  3103. sockets support communication between unrelated processes, and even
  3104. between processes running on different machines that communicate over a
  3105. network. Sockets are the primary means of communicating with other
  3106. machines; ‘telnet’, ‘rlogin’, ‘ftp’, ‘talk’ and the other familiar
  3107. network programs use sockets.
  3108. Not all operating systems support sockets. In the GNU C Library, the
  3109. header file ‘sys/socket.h’ exists regardless of the operating system,
  3110. and the socket functions always exist, but if the system does not really
  3111. support sockets these functions always fail.
  3112. *Incomplete:* We do not currently document the facilities for
  3113. broadcast messages or for configuring Internet interfaces. The
  3114. reentrant functions and some newer functions that are related to IPv6
  3115. aren't documented either so far.
  3116. * Menu:
  3117. * Socket Concepts:: Basic concepts you need to know about.
  3118. * Communication Styles::Stream communication, datagrams and other styles.
  3119. * Socket Addresses:: How socket names ("addresses") work.
  3120. * Interface Naming:: Identifying specific network interfaces.
  3121. * Local Namespace:: Details about the local namespace.
  3122. * Internet Namespace:: Details about the Internet namespace.
  3123. * Misc Namespaces:: Other namespaces not documented fully here.
  3124. * Open/Close Sockets:: Creating sockets and destroying them.
  3125. * Connections:: Operations on sockets with connection state.
  3126. * Datagrams:: Operations on datagram sockets.
  3127. * Inetd:: Inetd is a daemon that starts servers on request.
  3128. The most convenient way to write a server
  3129. is to make it work with Inetd.
  3130. * Socket Options:: Miscellaneous low-level socket options.
  3131. * Networks Database:: Accessing the database of network names.
  3132. * Other Socket APIs:: Other socket-related functions.
  3133. 
  3134. File: libc.info, Node: Socket Concepts, Next: Communication Styles, Up: Sockets
  3135. 16.1 Socket Concepts
  3136. ====================
  3137. When you create a socket, you must specify the style of communication
  3138. you want to use and the type of protocol that should implement it. The
  3139. “communication style” of a socket defines the user-level semantics of
  3140. sending and receiving data on the socket. Choosing a communication
  3141. style specifies the answers to questions such as these:
  3142. • *What are the units of data transmission?* Some communication
  3143. styles regard the data as a sequence of bytes with no larger
  3144. structure; others group the bytes into records (which are known in
  3145. this context as “packets”).
  3146. • *Can data be lost during normal operation?* Some communication
  3147. styles guarantee that all the data sent arrives in the order it was
  3148. sent (barring system or network crashes); other styles occasionally
  3149. lose data as a normal part of operation, and may sometimes deliver
  3150. packets more than once or in the wrong order.
  3151. Designing a program to use unreliable communication styles usually
  3152. involves taking precautions to detect lost or misordered packets
  3153. and to retransmit data as needed.
  3154. • *Is communication entirely with one partner?* Some communication
  3155. styles are like a telephone call--you make a “connection” with one
  3156. remote socket and then exchange data freely. Other styles are like
  3157. mailing letters--you specify a destination address for each message
  3158. you send.
  3159. You must also choose a “namespace” for naming the socket. A socket
  3160. name ("address") is meaningful only in the context of a particular
  3161. namespace. In fact, even the data type to use for a socket name may
  3162. depend on the namespace. Namespaces are also called "domains", but we
  3163. avoid that word as it can be confused with other usage of the same term.
  3164. Each namespace has a symbolic name that starts with ‘PF_’. A
  3165. corresponding symbolic name starting with ‘AF_’ designates the address
  3166. format for that namespace.
  3167. Finally you must choose the “protocol” to carry out the
  3168. communication. The protocol determines what low-level mechanism is used
  3169. to transmit and receive data. Each protocol is valid for a particular
  3170. namespace and communication style; a namespace is sometimes called a
  3171. “protocol family” because of this, which is why the namespace names
  3172. start with ‘PF_’.
  3173. The rules of a protocol apply to the data passing between two
  3174. programs, perhaps on different computers; most of these rules are
  3175. handled by the operating system and you need not know about them. What
  3176. you do need to know about protocols is this:
  3177. • In order to have communication between two sockets, they must
  3178. specify the _same_ protocol.
  3179. • Each protocol is meaningful with particular style/namespace
  3180. combinations and cannot be used with inappropriate combinations.
  3181. For example, the TCP protocol fits only the byte stream style of
  3182. communication and the Internet namespace.
  3183. • For each combination of style and namespace there is a “default
  3184. protocol”, which you can request by specifying 0 as the protocol
  3185. number. And that's what you should normally do--use the default.
  3186. Throughout the following description at various places
  3187. variables/parameters to denote sizes are required. And here the trouble
  3188. starts. In the first implementations the type of these variables was
  3189. simply ‘int’. On most machines at that time an ‘int’ was 32 bits wide,
  3190. which created a _de facto_ standard requiring 32-bit variables. This is
  3191. important since references to variables of this type are passed to the
  3192. kernel.
  3193. Then the POSIX people came and unified the interface with the words
  3194. "all size values are of type ‘size_t’". On 64-bit machines ‘size_t’ is
  3195. 64 bits wide, so pointers to variables were no longer possible.
  3196. The Unix98 specification provides a solution by introducing a type
  3197. ‘socklen_t’. This type is used in all of the cases that POSIX changed
  3198. to use ‘size_t’. The only requirement of this type is that it be an
  3199. unsigned type of at least 32 bits. Therefore, implementations which
  3200. require that references to 32-bit variables be passed can be as happy as
  3201. implementations which use 64-bit values.
  3202. 
  3203. File: libc.info, Node: Communication Styles, Next: Socket Addresses, Prev: Socket Concepts, Up: Sockets
  3204. 16.2 Communication Styles
  3205. =========================
  3206. The GNU C Library includes support for several different kinds of
  3207. sockets, each with different characteristics. This section describes
  3208. the supported socket types. The symbolic constants listed here are
  3209. defined in ‘sys/socket.h’.
  3210. -- Macro: int SOCK_STREAM
  3211. The ‘SOCK_STREAM’ style is like a pipe (*note Pipes and FIFOs::).
  3212. It operates over a connection with a particular remote socket and
  3213. transmits data reliably as a stream of bytes.
  3214. Use of this style is covered in detail in *note Connections::.
  3215. -- Macro: int SOCK_DGRAM
  3216. The ‘SOCK_DGRAM’ style is used for sending individually-addressed
  3217. packets unreliably. It is the diametrical opposite of
  3218. ‘SOCK_STREAM’.
  3219. Each time you write data to a socket of this kind, that data
  3220. becomes one packet. Since ‘SOCK_DGRAM’ sockets do not have
  3221. connections, you must specify the recipient address with each
  3222. packet.
  3223. The only guarantee that the system makes about your requests to
  3224. transmit data is that it will try its best to deliver each packet
  3225. you send. It may succeed with the sixth packet after failing with
  3226. the fourth and fifth packets; the seventh packet may arrive before
  3227. the sixth, and may arrive a second time after the sixth.
  3228. The typical use for ‘SOCK_DGRAM’ is in situations where it is
  3229. acceptable to simply re-send a packet if no response is seen in a
  3230. reasonable amount of time.
  3231. *Note Datagrams::, for detailed information about how to use
  3232. datagram sockets.
  3233. -- Macro: int SOCK_RAW
  3234. This style provides access to low-level network protocols and
  3235. interfaces. Ordinary user programs usually have no need to use
  3236. this style.
  3237. 
  3238. File: libc.info, Node: Socket Addresses, Next: Interface Naming, Prev: Communication Styles, Up: Sockets
  3239. 16.3 Socket Addresses
  3240. =====================
  3241. The name of a socket is normally called an “address”. The functions and
  3242. symbols for dealing with socket addresses were named inconsistently,
  3243. sometimes using the term "name" and sometimes using "address". You can
  3244. regard these terms as synonymous where sockets are concerned.
  3245. A socket newly created with the ‘socket’ function has no address.
  3246. Other processes can find it for communication only if you give it an
  3247. address. We call this “binding” the address to the socket, and the way
  3248. to do it is with the ‘bind’ function.
  3249. You need only be concerned with the address of a socket if other
  3250. processes are to find it and start communicating with it. You can
  3251. specify an address for other sockets, but this is usually pointless; the
  3252. first time you send data from a socket, or use it to initiate a
  3253. connection, the system assigns an address automatically if you have not
  3254. specified one.
  3255. Occasionally a client needs to specify an address because the server
  3256. discriminates based on address; for example, the rsh and rlogin
  3257. protocols look at the client's socket address and only bypass passphrase
  3258. checking if it is less than ‘IPPORT_RESERVED’ (*note Ports::).
  3259. The details of socket addresses vary depending on what namespace you
  3260. are using. *Note Local Namespace::, or *note Internet Namespace::, for
  3261. specific information.
  3262. Regardless of the namespace, you use the same functions ‘bind’ and
  3263. ‘getsockname’ to set and examine a socket's address. These functions
  3264. use a phony data type, ‘struct sockaddr *’, to accept the address. In
  3265. practice, the address lives in a structure of some other data type
  3266. appropriate to the address format you are using, but you cast its
  3267. address to ‘struct sockaddr *’ when you pass it to ‘bind’.
  3268. * Menu:
  3269. * Address Formats:: About ‘struct sockaddr’.
  3270. * Setting Address:: Binding an address to a socket.
  3271. * Reading Address:: Reading the address of a socket.
  3272. 
  3273. File: libc.info, Node: Address Formats, Next: Setting Address, Up: Socket Addresses
  3274. 16.3.1 Address Formats
  3275. ----------------------
  3276. The functions ‘bind’ and ‘getsockname’ use the generic data type ‘struct
  3277. sockaddr *’ to represent a pointer to a socket address. You can't use
  3278. this data type effectively to interpret an address or construct one; for
  3279. that, you must use the proper data type for the socket's namespace.
  3280. Thus, the usual practice is to construct an address of the proper
  3281. namespace-specific type, then cast a pointer to ‘struct sockaddr *’ when
  3282. you call ‘bind’ or ‘getsockname’.
  3283. The one piece of information that you can get from the ‘struct
  3284. sockaddr’ data type is the “address format designator”. This tells you
  3285. which data type to use to understand the address fully.
  3286. The symbols in this section are defined in the header file
  3287. ‘sys/socket.h’.
  3288. -- Data Type: struct sockaddr
  3289. The ‘struct sockaddr’ type itself has the following members:
  3290. ‘short int sa_family’
  3291. This is the code for the address format of this address. It
  3292. identifies the format of the data which follows.
  3293. ‘char sa_data[14]’
  3294. This is the actual socket address data, which is
  3295. format-dependent. Its length also depends on the format, and
  3296. may well be more than 14. The length 14 of ‘sa_data’ is
  3297. essentially arbitrary.
  3298. Each address format has a symbolic name which starts with ‘AF_’.
  3299. Each of them corresponds to a ‘PF_’ symbol which designates the
  3300. corresponding namespace. Here is a list of address format names:
  3301. ‘AF_LOCAL’
  3302. This designates the address format that goes with the local
  3303. namespace. (‘PF_LOCAL’ is the name of that namespace.) *Note
  3304. Local Namespace Details::, for information about this address
  3305. format.
  3306. ‘AF_UNIX’
  3307. This is a synonym for ‘AF_LOCAL’. Although ‘AF_LOCAL’ is mandated
  3308. by POSIX.1g, ‘AF_UNIX’ is portable to more systems. ‘AF_UNIX’ was
  3309. the traditional name stemming from BSD, so even most POSIX systems
  3310. support it. It is also the name of choice in the Unix98
  3311. specification. (The same is true for ‘PF_UNIX’ vs. ‘PF_LOCAL’).
  3312. ‘AF_FILE’
  3313. This is another synonym for ‘AF_LOCAL’, for compatibility.
  3314. (‘PF_FILE’ is likewise a synonym for ‘PF_LOCAL’.)
  3315. ‘AF_INET’
  3316. This designates the address format that goes with the Internet
  3317. namespace. (‘PF_INET’ is the name of that namespace.) *Note
  3318. Internet Address Formats::.
  3319. ‘AF_INET6’
  3320. This is similar to ‘AF_INET’, but refers to the IPv6 protocol.
  3321. (‘PF_INET6’ is the name of the corresponding namespace.)
  3322. ‘AF_UNSPEC’
  3323. This designates no particular address format. It is used only in
  3324. rare cases, such as to clear out the default destination address of
  3325. a "connected" datagram socket. *Note Sending Datagrams::.
  3326. The corresponding namespace designator symbol ‘PF_UNSPEC’ exists
  3327. for completeness, but there is no reason to use it in a program.
  3328. ‘sys/socket.h’ defines symbols starting with ‘AF_’ for many different
  3329. kinds of networks, most or all of which are not actually implemented.
  3330. We will document those that really work as we receive information about
  3331. how to use them.
  3332. 
  3333. File: libc.info, Node: Setting Address, Next: Reading Address, Prev: Address Formats, Up: Socket Addresses
  3334. 16.3.2 Setting the Address of a Socket
  3335. --------------------------------------
  3336. Use the ‘bind’ function to assign an address to a socket. The prototype
  3337. for ‘bind’ is in the header file ‘sys/socket.h’. For examples of use,
  3338. see *note Local Socket Example::, or see *note Inet Example::.
  3339. -- Function: int bind (int SOCKET, struct sockaddr *ADDR, socklen_t
  3340. LENGTH)
  3341. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3342. Concepts::.
  3343. The ‘bind’ function assigns an address to the socket SOCKET. The
  3344. ADDR and LENGTH arguments specify the address; the detailed format
  3345. of the address depends on the namespace. The first part of the
  3346. address is always the format designator, which specifies a
  3347. namespace, and says that the address is in the format of that
  3348. namespace.
  3349. The return value is ‘0’ on success and ‘-1’ on failure. The
  3350. following ‘errno’ error conditions are defined for this function:
  3351. ‘EBADF’
  3352. The SOCKET argument is not a valid file descriptor.
  3353. ‘ENOTSOCK’
  3354. The descriptor SOCKET is not a socket.
  3355. ‘EADDRNOTAVAIL’
  3356. The specified address is not available on this machine.
  3357. ‘EADDRINUSE’
  3358. Some other socket is already using the specified address.
  3359. ‘EINVAL’
  3360. The socket SOCKET already has an address.
  3361. ‘EACCES’
  3362. You do not have permission to access the requested address.
  3363. (In the Internet domain, only the super-user is allowed to
  3364. specify a port number in the range 0 through ‘IPPORT_RESERVED’
  3365. minus one; see *note Ports::.)
  3366. Additional conditions may be possible depending on the particular
  3367. namespace of the socket.
  3368. 
  3369. File: libc.info, Node: Reading Address, Prev: Setting Address, Up: Socket Addresses
  3370. 16.3.3 Reading the Address of a Socket
  3371. --------------------------------------
  3372. Use the function ‘getsockname’ to examine the address of an Internet
  3373. socket. The prototype for this function is in the header file
  3374. ‘sys/socket.h’.
  3375. -- Function: int getsockname (int SOCKET, struct sockaddr *ADDR,
  3376. socklen_t *LENGTH-PTR)
  3377. Preliminary: | MT-Safe | AS-Safe | AC-Safe mem/hurd | *Note POSIX
  3378. Safety Concepts::.
  3379. The ‘getsockname’ function returns information about the address of
  3380. the socket SOCKET in the locations specified by the ADDR and
  3381. LENGTH-PTR arguments. Note that the LENGTH-PTR is a pointer; you
  3382. should initialize it to be the allocation size of ADDR, and on
  3383. return it contains the actual size of the address data.
  3384. The format of the address data depends on the socket namespace.
  3385. The length of the information is usually fixed for a given
  3386. namespace, so normally you can know exactly how much space is
  3387. needed and can provide that much. The usual practice is to
  3388. allocate a place for the value using the proper data type for the
  3389. socket's namespace, then cast its address to ‘struct sockaddr *’ to
  3390. pass it to ‘getsockname’.
  3391. The return value is ‘0’ on success and ‘-1’ on error. The
  3392. following ‘errno’ error conditions are defined for this function:
  3393. ‘EBADF’
  3394. The SOCKET argument is not a valid file descriptor.
  3395. ‘ENOTSOCK’
  3396. The descriptor SOCKET is not a socket.
  3397. ‘ENOBUFS’
  3398. There are not enough internal buffers available for the
  3399. operation.
  3400. You can't read the address of a socket in the file namespace. This
  3401. is consistent with the rest of the system; in general, there's no way to
  3402. find a file's name from a descriptor for that file.
  3403. 
  3404. File: libc.info, Node: Interface Naming, Next: Local Namespace, Prev: Socket Addresses, Up: Sockets
  3405. 16.4 Interface Naming
  3406. =====================
  3407. Each network interface has a name. This usually consists of a few
  3408. letters that relate to the type of interface, which may be followed by a
  3409. number if there is more than one interface of that type. Examples might
  3410. be ‘lo’ (the loopback interface) and ‘eth0’ (the first Ethernet
  3411. interface).
  3412. Although such names are convenient for humans, it would be clumsy to
  3413. have to use them whenever a program needs to refer to an interface. In
  3414. such situations an interface is referred to by its “index”, which is an
  3415. arbitrarily-assigned small positive integer.
  3416. The following functions, constants and data types are declared in the
  3417. header file ‘net/if.h’.
  3418. -- Constant: size_t IFNAMSIZ
  3419. This constant defines the maximum buffer size needed to hold an
  3420. interface name, including its terminating zero byte.
  3421. -- Function: unsigned int if_nametoindex (const char *IFNAME)
  3422. Preliminary: | MT-Safe | AS-Unsafe lock | AC-Unsafe lock fd | *Note
  3423. POSIX Safety Concepts::.
  3424. This function yields the interface index corresponding to a
  3425. particular name specified with IFNAME.
  3426. The return value is the interface index on success. On failure,
  3427. the function's return value is zero and ‘errno’ is set accordingly.
  3428. The following ‘errno’ values are specific to this function:
  3429. ‘ENODEV’
  3430. There is no interface by the name requested.
  3431. Additionally, since ‘if_nametoindex’ invokes ‘socket’ internally,
  3432. ‘errno’ may also be set to a value listed for the ‘socket’ function
  3433. (*note Creating a Socket::).
  3434. -- Function: char * if_indextoname (unsigned int IFINDEX, char *IFNAME)
  3435. Preliminary: | MT-Safe | AS-Unsafe lock | AC-Unsafe lock fd | *Note
  3436. POSIX Safety Concepts::.
  3437. This function maps an interface index IFINDEX to its corresponding
  3438. name. The returned name is placed in the buffer pointed to by
  3439. IFNAME, which must be at least ‘IFNAMSIZ’ bytes in length.
  3440. The return value is IFNAME on success. On failure, the function's
  3441. return value is a null pointer and ‘errno’ is set accordingly. The
  3442. following ‘errno’ values are specific to this function:
  3443. ‘ENXIO’
  3444. There is no interface at the index requested.
  3445. Additionally, since ‘if_indextoname’ invokes ‘socket’ internally,
  3446. ‘errno’ may also be set to a value listed for the ‘socket’ function
  3447. (*note Creating a Socket::).
  3448. -- Data Type: struct if_nameindex
  3449. This data type is used to hold the information about a single
  3450. interface. It has the following members:
  3451. ‘unsigned int if_index;’
  3452. This is the interface index.
  3453. ‘char *if_name’
  3454. This is the null-terminated index name.
  3455. -- Function: struct if_nameindex * if_nameindex (void)
  3456. Preliminary: | MT-Safe | AS-Unsafe heap lock/hurd | AC-Unsafe
  3457. lock/hurd fd mem | *Note POSIX Safety Concepts::.
  3458. This function returns an array of ‘if_nameindex’ structures, one
  3459. for every interface that is present. The end of the list is
  3460. indicated by a structure with an interface of 0 and a null name
  3461. pointer. If an error occurs, this function returns a null pointer.
  3462. The returned structure must be freed with ‘if_freenameindex’ after
  3463. use.
  3464. -- Function: void if_freenameindex (struct if_nameindex *PTR)
  3465. Preliminary: | MT-Safe | AS-Unsafe heap | AC-Unsafe mem | *Note
  3466. POSIX Safety Concepts::.
  3467. This function frees the structure returned by an earlier call to
  3468. ‘if_nameindex’.
  3469. 
  3470. File: libc.info, Node: Local Namespace, Next: Internet Namespace, Prev: Interface Naming, Up: Sockets
  3471. 16.5 The Local Namespace
  3472. ========================
  3473. This section describes the details of the local namespace, whose
  3474. symbolic name (required when you create a socket) is ‘PF_LOCAL’. The
  3475. local namespace is also known as "Unix domain sockets". Another name is
  3476. file namespace since socket addresses are normally implemented as file
  3477. names.
  3478. * Menu:
  3479. * Concepts: Local Namespace Concepts. What you need to understand.
  3480. * Details: Local Namespace Details. Address format, symbolic names, etc.
  3481. * Example: Local Socket Example. Example of creating a socket.
  3482. 
  3483. File: libc.info, Node: Local Namespace Concepts, Next: Local Namespace Details, Up: Local Namespace
  3484. 16.5.1 Local Namespace Concepts
  3485. -------------------------------
  3486. In the local namespace socket addresses are file names. You can specify
  3487. any file name you want as the address of the socket, but you must have
  3488. write permission on the directory containing it. It's common to put
  3489. these files in the ‘/tmp’ directory.
  3490. One peculiarity of the local namespace is that the name is only used
  3491. when opening the connection; once open the address is not meaningful and
  3492. may not exist.
  3493. Another peculiarity is that you cannot connect to such a socket from
  3494. another machine-not even if the other machine shares the file system
  3495. which contains the name of the socket. You can see the socket in a
  3496. directory listing, but connecting to it never succeeds. Some programs
  3497. take advantage of this, such as by asking the client to send its own
  3498. process ID, and using the process IDs to distinguish between clients.
  3499. However, we recommend you not use this method in protocols you design,
  3500. as we might someday permit connections from other machines that mount
  3501. the same file systems. Instead, send each new client an identifying
  3502. number if you want it to have one.
  3503. After you close a socket in the local namespace, you should delete
  3504. the file name from the file system. Use ‘unlink’ or ‘remove’ to do
  3505. this; see *note Deleting Files::.
  3506. The local namespace supports just one protocol for any communication
  3507. style; it is protocol number ‘0’.
  3508. 
  3509. File: libc.info, Node: Local Namespace Details, Next: Local Socket Example, Prev: Local Namespace Concepts, Up: Local Namespace
  3510. 16.5.2 Details of Local Namespace
  3511. ---------------------------------
  3512. To create a socket in the local namespace, use the constant ‘PF_LOCAL’
  3513. as the NAMESPACE argument to ‘socket’ or ‘socketpair’. This constant is
  3514. defined in ‘sys/socket.h’.
  3515. -- Macro: int PF_LOCAL
  3516. This designates the local namespace, in which socket addresses are
  3517. local names, and its associated family of protocols. ‘PF_LOCAL’ is
  3518. the macro used by POSIX.1g.
  3519. -- Macro: int PF_UNIX
  3520. This is a synonym for ‘PF_LOCAL’, for compatibility's sake.
  3521. -- Macro: int PF_FILE
  3522. This is a synonym for ‘PF_LOCAL’, for compatibility's sake.
  3523. The structure for specifying socket names in the local namespace is
  3524. defined in the header file ‘sys/un.h’:
  3525. -- Data Type: struct sockaddr_un
  3526. This structure is used to specify local namespace socket addresses.
  3527. It has the following members:
  3528. ‘short int sun_family’
  3529. This identifies the address family or format of the socket
  3530. address. You should store the value ‘AF_LOCAL’ to designate
  3531. the local namespace. *Note Socket Addresses::.
  3532. ‘char sun_path[108]’
  3533. This is the file name to use.
  3534. *Incomplete:* Why is 108 a magic number? RMS suggests making
  3535. this a zero-length array and tweaking the following example to
  3536. use ‘alloca’ to allocate an appropriate amount of storage
  3537. based on the length of the filename.
  3538. You should compute the LENGTH parameter for a socket address in the
  3539. local namespace as the sum of the size of the ‘sun_family’ component and
  3540. the string length (_not_ the allocation size!) of the file name string.
  3541. This can be done using the macro ‘SUN_LEN’:
  3542. -- Macro: int SUN_LEN (_struct sockaddr_un *_ PTR)
  3543. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3544. Concepts::.
  3545. This macro computes the length of the socket address in the local
  3546. namespace.
  3547. 
  3548. File: libc.info, Node: Local Socket Example, Prev: Local Namespace Details, Up: Local Namespace
  3549. 16.5.3 Example of Local-Namespace Sockets
  3550. -----------------------------------------
  3551. Here is an example showing how to create and name a socket in the local
  3552. namespace.
  3553. #include <stddef.h>
  3554. #include <stdio.h>
  3555. #include <errno.h>
  3556. #include <stdlib.h>
  3557. #include <string.h>
  3558. #include <sys/socket.h>
  3559. #include <sys/un.h>
  3560. int
  3561. make_named_socket (const char *filename)
  3562. {
  3563. struct sockaddr_un name;
  3564. int sock;
  3565. size_t size;
  3566. /* Create the socket. */
  3567. sock = socket (PF_LOCAL, SOCK_DGRAM, 0);
  3568. if (sock < 0)
  3569. {
  3570. perror ("socket");
  3571. exit (EXIT_FAILURE);
  3572. }
  3573. /* Bind a name to the socket. */
  3574. name.sun_family = AF_LOCAL;
  3575. strncpy (name.sun_path, filename, sizeof (name.sun_path));
  3576. name.sun_path[sizeof (name.sun_path) - 1] = '\0';
  3577. /* The size of the address is
  3578. the offset of the start of the filename,
  3579. plus its length (not including the terminating null byte).
  3580. Alternatively you can just do:
  3581. size = SUN_LEN (&name);
  3582. */
  3583. size = (offsetof (struct sockaddr_un, sun_path)
  3584. + strlen (name.sun_path));
  3585. if (bind (sock, (struct sockaddr *) &name, size) < 0)
  3586. {
  3587. perror ("bind");
  3588. exit (EXIT_FAILURE);
  3589. }
  3590. return sock;
  3591. }
  3592. 
  3593. File: libc.info, Node: Internet Namespace, Next: Misc Namespaces, Prev: Local Namespace, Up: Sockets
  3594. 16.6 The Internet Namespace
  3595. ===========================
  3596. This section describes the details of the protocols and socket naming
  3597. conventions used in the Internet namespace.
  3598. Originally the Internet namespace used only IP version 4 (IPv4).
  3599. With the growing number of hosts on the Internet, a new protocol with a
  3600. larger address space was necessary: IP version 6 (IPv6). IPv6
  3601. introduces 128-bit addresses (IPv4 has 32-bit addresses) and other
  3602. features, and will eventually replace IPv4.
  3603. To create a socket in the IPv4 Internet namespace, use the symbolic
  3604. name ‘PF_INET’ of this namespace as the NAMESPACE argument to ‘socket’
  3605. or ‘socketpair’. For IPv6 addresses you need the macro ‘PF_INET6’.
  3606. These macros are defined in ‘sys/socket.h’.
  3607. -- Macro: int PF_INET
  3608. This designates the IPv4 Internet namespace and associated family
  3609. of protocols.
  3610. -- Macro: int PF_INET6
  3611. This designates the IPv6 Internet namespace and associated family
  3612. of protocols.
  3613. A socket address for the Internet namespace includes the following
  3614. components:
  3615. • The address of the machine you want to connect to. Internet
  3616. addresses can be specified in several ways; these are discussed in
  3617. *note Internet Address Formats::, *note Host Addresses:: and *note
  3618. Host Names::.
  3619. • A port number for that machine. *Note Ports::.
  3620. You must ensure that the address and port number are represented in a
  3621. canonical format called “network byte order”. *Note Byte Order::, for
  3622. information about this.
  3623. * Menu:
  3624. * Internet Address Formats:: How socket addresses are specified in the
  3625. Internet namespace.
  3626. * Host Addresses:: All about host addresses of Internet host.
  3627. * Ports:: Internet port numbers.
  3628. * Services Database:: Ports may have symbolic names.
  3629. * Byte Order:: Different hosts may use different byte
  3630. ordering conventions; you need to
  3631. canonicalize host address and port number.
  3632. * Protocols Database:: Referring to protocols by name.
  3633. * Inet Example:: Putting it all together.
  3634. 
  3635. File: libc.info, Node: Internet Address Formats, Next: Host Addresses, Up: Internet Namespace
  3636. 16.6.1 Internet Socket Address Formats
  3637. --------------------------------------
  3638. In the Internet namespace, for both IPv4 (‘AF_INET’) and IPv6
  3639. (‘AF_INET6’), a socket address consists of a host address and a port on
  3640. that host. In addition, the protocol you choose serves effectively as a
  3641. part of the address because local port numbers are meaningful only
  3642. within a particular protocol.
  3643. The data types for representing socket addresses in the Internet
  3644. namespace are defined in the header file ‘netinet/in.h’.
  3645. -- Data Type: struct sockaddr_in
  3646. This is the data type used to represent socket addresses in the
  3647. Internet namespace. It has the following members:
  3648. ‘sa_family_t sin_family’
  3649. This identifies the address family or format of the socket
  3650. address. You should store the value ‘AF_INET’ in this member.
  3651. The address family is stored in host byte order. *Note Socket
  3652. Addresses::.
  3653. ‘struct in_addr sin_addr’
  3654. This is the IPv4 address. *Note Host Addresses::, and *note
  3655. Host Names::, for how to get a value to store here. The IPv4
  3656. address is stored in network byte order.
  3657. ‘unsigned short int sin_port’
  3658. This is the port number. *Note Ports::. The port number is
  3659. stored in network byte order.
  3660. When you call ‘bind’ or ‘getsockname’, you should specify ‘sizeof
  3661. (struct sockaddr_in)’ as the LENGTH parameter if you are using an IPv4
  3662. Internet namespace socket address.
  3663. -- Data Type: struct sockaddr_in6
  3664. This is the data type used to represent socket addresses in the
  3665. IPv6 namespace. It has the following members:
  3666. ‘sa_family_t sin6_family’
  3667. This identifies the address family or format of the socket
  3668. address. You should store the value of ‘AF_INET6’ in this
  3669. member. *Note Socket Addresses::. The address family is
  3670. stored in host byte order.
  3671. ‘struct in6_addr sin6_addr’
  3672. This is the IPv6 address of the host machine. *Note Host
  3673. Addresses::, and *note Host Names::, for how to get a value to
  3674. store here. The address is stored in network byte order.
  3675. ‘uint32_t sin6_flowinfo’
  3676. This combines the IPv6 traffic class and flow label values, as
  3677. found in the IPv6 header. This field is stored in network
  3678. byte order. Only the 28 lower bits (of the number in network
  3679. byte order) are used; the remaining bits must be zero. The
  3680. lower 20 bits are the flow label, and bits 20 to 27 are the
  3681. the traffic class. Typically, this field is zero.
  3682. ‘uint32_t sin6_scope_id’
  3683. For link-local addresses, this identifies the interface on
  3684. which this address is valid. The scope ID is stored in host
  3685. byte order. Typically, this field is zero.
  3686. ‘uint16_t sin6_port’
  3687. This is the port number. *Note Ports::. The port number is
  3688. stored in network byte order.
  3689. 
  3690. File: libc.info, Node: Host Addresses, Next: Ports, Prev: Internet Address Formats, Up: Internet Namespace
  3691. 16.6.2 Host Addresses
  3692. ---------------------
  3693. Each computer on the Internet has one or more “Internet addresses”,
  3694. numbers which identify that computer among all those on the Internet.
  3695. Users typically write IPv4 numeric host addresses as sequences of four
  3696. numbers, separated by periods, as in ‘128.52.46.32’, and IPv6 numeric
  3697. host addresses as sequences of up to eight numbers separated by colons,
  3698. as in ‘5f03:1200:836f:c100::1’.
  3699. Each computer also has one or more “host names”, which are strings of
  3700. words separated by periods, as in ‘www.gnu.org’.
  3701. Programs that let the user specify a host typically accept both
  3702. numeric addresses and host names. To open a connection a program needs
  3703. a numeric address, and so must convert a host name to the numeric
  3704. address it stands for.
  3705. * Menu:
  3706. * Abstract Host Addresses:: What a host number consists of.
  3707. * Data type: Host Address Data Type. Data type for a host number.
  3708. * Functions: Host Address Functions. Functions to operate on them.
  3709. * Names: Host Names. Translating host names to host numbers.
  3710. 
  3711. File: libc.info, Node: Abstract Host Addresses, Next: Host Address Data Type, Up: Host Addresses
  3712. 16.6.2.1 Internet Host Addresses
  3713. ................................
  3714. Each computer on the Internet has one or more Internet addresses,
  3715. numbers which identify that computer among all those on the Internet.
  3716. An IPv4 Internet host address is a number containing four bytes of
  3717. data. Historically these are divided into two parts, a “network number”
  3718. and a “local network address number” within that network. In the
  3719. mid-1990s classless addresses were introduced which changed this
  3720. behavior. Since some functions implicitly expect the old definitions,
  3721. we first describe the class-based network and will then describe
  3722. classless addresses. IPv6 uses only classless addresses and therefore
  3723. the following paragraphs don't apply.
  3724. The class-based IPv4 network number consists of the first one, two or
  3725. three bytes; the rest of the bytes are the local address.
  3726. IPv4 network numbers are registered with the Network Information
  3727. Center (NIC), and are divided into three classes--A, B and C. The local
  3728. network address numbers of individual machines are registered with the
  3729. administrator of the particular network.
  3730. Class A networks have single-byte numbers in the range 0 to 127.
  3731. There are only a small number of Class A networks, but they can each
  3732. support a very large number of hosts. Medium-sized Class B networks
  3733. have two-byte network numbers, with the first byte in the range 128 to
  3734. 191. Class C networks are the smallest; they have three-byte network
  3735. numbers, with the first byte in the range 192-255. Thus, the first 1,
  3736. 2, or 3 bytes of an Internet address specify a network. The remaining
  3737. bytes of the Internet address specify the address within that network.
  3738. The Class A network 0 is reserved for broadcast to all networks. In
  3739. addition, the host number 0 within each network is reserved for
  3740. broadcast to all hosts in that network. These uses are obsolete now but
  3741. for compatibility reasons you shouldn't use network 0 and host number 0.
  3742. The Class A network 127 is reserved for loopback; you can always use
  3743. the Internet address ‘127.0.0.1’ to refer to the host machine.
  3744. Since a single machine can be a member of multiple networks, it can
  3745. have multiple Internet host addresses. However, there is never supposed
  3746. to be more than one machine with the same host address.
  3747. There are four forms of the “standard numbers-and-dots notation” for
  3748. Internet addresses:
  3749. ‘A.B.C.D’
  3750. This specifies all four bytes of the address individually and is
  3751. the commonly used representation.
  3752. ‘A.B.C’
  3753. The last part of the address, C, is interpreted as a 2-byte
  3754. quantity. This is useful for specifying host addresses in a Class
  3755. B network with network address number ‘A.B’.
  3756. ‘A.B’
  3757. The last part of the address, B, is interpreted as a 3-byte
  3758. quantity. This is useful for specifying host addresses in a Class
  3759. A network with network address number A.
  3760. ‘A’
  3761. If only one part is given, this corresponds directly to the host
  3762. address number.
  3763. Within each part of the address, the usual C conventions for
  3764. specifying the radix apply. In other words, a leading ‘0x’ or ‘0X’
  3765. implies hexadecimal radix; a leading ‘0’ implies octal; and otherwise
  3766. decimal radix is assumed.
  3767. Classless Addresses
  3768. ...................
  3769. IPv4 addresses (and IPv6 addresses also) are now considered classless;
  3770. the distinction between classes A, B and C can be ignored. Instead an
  3771. IPv4 host address consists of a 32-bit address and a 32-bit mask. The
  3772. mask contains set bits for the network part and cleared bits for the
  3773. host part. The network part is contiguous from the left, with the
  3774. remaining bits representing the host. As a consequence, the netmask can
  3775. simply be specified as the number of set bits. Classes A, B and C are
  3776. just special cases of this general rule. For example, class A addresses
  3777. have a netmask of ‘255.0.0.0’ or a prefix length of 8.
  3778. Classless IPv4 network addresses are written in numbers-and-dots
  3779. notation with the prefix length appended and a slash as separator. For
  3780. example the class A network 10 is written as ‘10.0.0.0/8’.
  3781. IPv6 Addresses
  3782. ..............
  3783. IPv6 addresses contain 128 bits (IPv4 has 32 bits) of data. A host
  3784. address is usually written as eight 16-bit hexadecimal numbers that are
  3785. separated by colons. Two colons are used to abbreviate strings of
  3786. consecutive zeros. For example, the IPv6 loopback address
  3787. ‘0:0:0:0:0:0:0:1’ can just be written as ‘::1’.
  3788. 
  3789. File: libc.info, Node: Host Address Data Type, Next: Host Address Functions, Prev: Abstract Host Addresses, Up: Host Addresses
  3790. 16.6.2.2 Host Address Data Type
  3791. ...............................
  3792. IPv4 Internet host addresses are represented in some contexts as
  3793. integers (type ‘uint32_t’). In other contexts, the integer is packaged
  3794. inside a structure of type ‘struct in_addr’. It would be better if the
  3795. usage were made consistent, but it is not hard to extract the integer
  3796. from the structure or put the integer into a structure.
  3797. You will find older code that uses ‘unsigned long int’ for IPv4
  3798. Internet host addresses instead of ‘uint32_t’ or ‘struct in_addr’.
  3799. Historically ‘unsigned long int’ was a 32-bit number but with 64-bit
  3800. machines this has changed. Using ‘unsigned long int’ might break the
  3801. code if it is used on machines where this type doesn't have 32 bits.
  3802. ‘uint32_t’ is specified by Unix98 and guaranteed to have 32 bits.
  3803. IPv6 Internet host addresses have 128 bits and are packaged inside a
  3804. structure of type ‘struct in6_addr’.
  3805. The following basic definitions for Internet addresses are declared
  3806. in the header file ‘netinet/in.h’:
  3807. -- Data Type: struct in_addr
  3808. This data type is used in certain contexts to contain an IPv4
  3809. Internet host address. It has just one field, named ‘s_addr’,
  3810. which records the host address number as an ‘uint32_t’.
  3811. -- Macro: uint32_t INADDR_LOOPBACK
  3812. You can use this constant to stand for "the address of this
  3813. machine," instead of finding its actual address. It is the IPv4
  3814. Internet address ‘127.0.0.1’, which is usually called ‘localhost’.
  3815. This special constant saves you the trouble of looking up the
  3816. address of your own machine. Also, the system usually implements
  3817. ‘INADDR_LOOPBACK’ specially, avoiding any network traffic for the
  3818. case of one machine talking to itself.
  3819. -- Macro: uint32_t INADDR_ANY
  3820. You can use this constant to stand for "any incoming address" when
  3821. binding to an address. *Note Setting Address::. This is the usual
  3822. address to give in the ‘sin_addr’ member of ‘struct sockaddr_in’
  3823. when you want to accept Internet connections.
  3824. -- Macro: uint32_t INADDR_BROADCAST
  3825. This constant is the address you use to send a broadcast message.
  3826. -- Macro: uint32_t INADDR_NONE
  3827. This constant is returned by some functions to indicate an error.
  3828. -- Data Type: struct in6_addr
  3829. This data type is used to store an IPv6 address. It stores 128
  3830. bits of data, which can be accessed (via a union) in a variety of
  3831. ways.
  3832. -- Constant: struct in6_addr in6addr_loopback
  3833. This constant is the IPv6 address ‘::1’, the loopback address. See
  3834. above for a description of what this means. The macro
  3835. ‘IN6ADDR_LOOPBACK_INIT’ is provided to allow you to initialize your
  3836. own variables to this value.
  3837. -- Constant: struct in6_addr in6addr_any
  3838. This constant is the IPv6 address ‘::’, the unspecified address.
  3839. See above for a description of what this means. The macro
  3840. ‘IN6ADDR_ANY_INIT’ is provided to allow you to initialize your own
  3841. variables to this value.
  3842. 
  3843. File: libc.info, Node: Host Address Functions, Next: Host Names, Prev: Host Address Data Type, Up: Host Addresses
  3844. 16.6.2.3 Host Address Functions
  3845. ...............................
  3846. These additional functions for manipulating Internet addresses are
  3847. declared in the header file ‘arpa/inet.h’. They represent Internet
  3848. addresses in network byte order, and network numbers and
  3849. local-address-within-network numbers in host byte order. *Note Byte
  3850. Order::, for an explanation of network and host byte order.
  3851. -- Function: int inet_aton (const char *NAME, struct in_addr *ADDR)
  3852. Preliminary: | MT-Safe locale | AS-Safe | AC-Safe | *Note POSIX
  3853. Safety Concepts::.
  3854. This function converts the IPv4 Internet host address NAME from the
  3855. standard numbers-and-dots notation into binary data and stores it
  3856. in the ‘struct in_addr’ that ADDR points to. ‘inet_aton’ returns
  3857. nonzero if the address is valid, zero if not.
  3858. -- Function: uint32_t inet_addr (const char *NAME)
  3859. Preliminary: | MT-Safe locale | AS-Safe | AC-Safe | *Note POSIX
  3860. Safety Concepts::.
  3861. This function converts the IPv4 Internet host address NAME from the
  3862. standard numbers-and-dots notation into binary data. If the input
  3863. is not valid, ‘inet_addr’ returns ‘INADDR_NONE’. This is an
  3864. obsolete interface to ‘inet_aton’, described immediately above. It
  3865. is obsolete because ‘INADDR_NONE’ is a valid address
  3866. (255.255.255.255), and ‘inet_aton’ provides a cleaner way to
  3867. indicate error return.
  3868. -- Function: uint32_t inet_network (const char *NAME)
  3869. Preliminary: | MT-Safe locale | AS-Safe | AC-Safe | *Note POSIX
  3870. Safety Concepts::.
  3871. This function extracts the network number from the address NAME,
  3872. given in the standard numbers-and-dots notation. The returned
  3873. address is in host order. If the input is not valid,
  3874. ‘inet_network’ returns ‘-1’.
  3875. The function works only with traditional IPv4 class A, B and C
  3876. network types. It doesn't work with classless addresses and
  3877. shouldn't be used anymore.
  3878. -- Function: char * inet_ntoa (struct in_addr ADDR)
  3879. Preliminary: | MT-Safe locale | AS-Unsafe race | AC-Safe | *Note
  3880. POSIX Safety Concepts::.
  3881. This function converts the IPv4 Internet host address ADDR to a
  3882. string in the standard numbers-and-dots notation. The return value
  3883. is a pointer into a statically-allocated buffer. Subsequent calls
  3884. will overwrite the same buffer, so you should copy the string if
  3885. you need to save it.
  3886. In multi-threaded programs each thread has its own
  3887. statically-allocated buffer. But still subsequent calls of
  3888. ‘inet_ntoa’ in the same thread will overwrite the result of the
  3889. last call.
  3890. Instead of ‘inet_ntoa’ the newer function ‘inet_ntop’ which is
  3891. described below should be used since it handles both IPv4 and IPv6
  3892. addresses.
  3893. -- Function: struct in_addr inet_makeaddr (uint32_t NET, uint32_t
  3894. LOCAL)
  3895. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3896. Concepts::.
  3897. This function makes an IPv4 Internet host address by combining the
  3898. network number NET with the local-address-within-network number
  3899. LOCAL.
  3900. -- Function: uint32_t inet_lnaof (struct in_addr ADDR)
  3901. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3902. Concepts::.
  3903. This function returns the local-address-within-network part of the
  3904. Internet host address ADDR.
  3905. The function works only with traditional IPv4 class A, B and C
  3906. network types. It doesn't work with classless addresses and
  3907. shouldn't be used anymore.
  3908. -- Function: uint32_t inet_netof (struct in_addr ADDR)
  3909. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3910. Concepts::.
  3911. This function returns the network number part of the Internet host
  3912. address ADDR.
  3913. The function works only with traditional IPv4 class A, B and C
  3914. network types. It doesn't work with classless addresses and
  3915. shouldn't be used anymore.
  3916. -- Function: int inet_pton (int AF, const char *CP, void *BUF)
  3917. Preliminary: | MT-Safe locale | AS-Safe | AC-Safe | *Note POSIX
  3918. Safety Concepts::.
  3919. This function converts an Internet address (either IPv4 or IPv6)
  3920. from presentation (textual) to network (binary) format. AF should
  3921. be either ‘AF_INET’ or ‘AF_INET6’, as appropriate for the type of
  3922. address being converted. CP is a pointer to the input string, and
  3923. BUF is a pointer to a buffer for the result. It is the caller's
  3924. responsibility to make sure the buffer is large enough.
  3925. The return value is ‘1’ on success and ‘0’ if CP does not point to
  3926. a valid address string for the address family AF requested. On
  3927. failure, the function's return value is ‘-1’ and ‘errno’ is set
  3928. accordingly. The following ‘errno’ values are specific to this
  3929. function:
  3930. ‘EAFNOSUPPORT’
  3931. The address family requested is neither ‘AF_INET’ nor
  3932. ‘AF_INET6’.
  3933. -- Function: const char * inet_ntop (int AF, const void *CP, char *BUF,
  3934. socklen_t LEN)
  3935. Preliminary: | MT-Safe locale | AS-Safe | AC-Safe | *Note POSIX
  3936. Safety Concepts::.
  3937. This function converts an Internet address (either IPv4 or IPv6)
  3938. from network (binary) to presentation (textual) form. AF should be
  3939. either ‘AF_INET’ or ‘AF_INET6’, as appropriate. CP is a pointer to
  3940. the address to be converted. BUF should be a pointer to a buffer
  3941. to hold the result, and LEN is the length of this buffer.
  3942. The return value is BUF on success. On failure, the function's
  3943. return value is a null pointer and ‘errno’ is set accordingly. The
  3944. following ‘errno’ values are specific to this function:
  3945. ‘EAFNOSUPPORT’
  3946. The address family requested is neither ‘AF_INET’ nor
  3947. ‘AF_INET6’.
  3948. ‘ENOSPC’
  3949. Insufficient space available for the result in the buffer
  3950. provided.
  3951. 
  3952. File: libc.info, Node: Host Names, Prev: Host Address Functions, Up: Host Addresses
  3953. 16.6.2.4 Host Names
  3954. ...................
  3955. Besides the standard numbers-and-dots notation for Internet addresses,
  3956. you can also refer to a host by a symbolic name. The advantage of a
  3957. symbolic name is that it is usually easier to remember. For example,
  3958. the machine with Internet address ‘158.121.106.19’ is also known as
  3959. ‘alpha.gnu.org’; and other machines in the ‘gnu.org’ domain can refer to
  3960. it simply as ‘alpha’.
  3961. Internally, the system uses a database to keep track of the mapping
  3962. between host names and host numbers. This database is usually either
  3963. the file ‘/etc/hosts’ or an equivalent provided by a name server. The
  3964. functions and other symbols for accessing this database are declared in
  3965. ‘netdb.h’. They are BSD features, defined unconditionally if you
  3966. include ‘netdb.h’.
  3967. -- Data Type: struct hostent
  3968. This data type is used to represent an entry in the hosts database.
  3969. It has the following members:
  3970. ‘char *h_name’
  3971. This is the "official" name of the host.
  3972. ‘char **h_aliases’
  3973. These are alternative names for the host, represented as a
  3974. null-terminated vector of strings.
  3975. ‘int h_addrtype’
  3976. This is the host address type; in practice, its value is
  3977. always either ‘AF_INET’ or ‘AF_INET6’, with the latter being
  3978. used for IPv6 hosts. In principle other kinds of addresses
  3979. could be represented in the database as well as Internet
  3980. addresses; if this were done, you might find a value in this
  3981. field other than ‘AF_INET’ or ‘AF_INET6’. *Note Socket
  3982. Addresses::.
  3983. ‘int h_length’
  3984. This is the length, in bytes, of each address.
  3985. ‘char **h_addr_list’
  3986. This is the vector of addresses for the host. (Recall that
  3987. the host might be connected to multiple networks and have
  3988. different addresses on each one.) The vector is terminated by
  3989. a null pointer.
  3990. ‘char *h_addr’
  3991. This is a synonym for ‘h_addr_list[0]’; in other words, it is
  3992. the first host address.
  3993. As far as the host database is concerned, each address is just a
  3994. block of memory ‘h_length’ bytes long. But in other contexts there is
  3995. an implicit assumption that you can convert IPv4 addresses to a ‘struct
  3996. in_addr’ or an ‘uint32_t’. Host addresses in a ‘struct hostent’
  3997. structure are always given in network byte order; see *note Byte
  3998. Order::.
  3999. You can use ‘gethostbyname’, ‘gethostbyname2’ or ‘gethostbyaddr’ to
  4000. search the hosts database for information about a particular host. The
  4001. information is returned in a statically-allocated structure; you must
  4002. copy the information if you need to save it across calls. You can also
  4003. use ‘getaddrinfo’ and ‘getnameinfo’ to obtain this information.
  4004. -- Function: struct hostent * gethostbyname (const char *NAME)
  4005. Preliminary: | MT-Unsafe race:hostbyname env locale | AS-Unsafe
  4006. dlopen plugin corrupt heap lock | AC-Unsafe lock corrupt mem fd |
  4007. *Note POSIX Safety Concepts::.
  4008. The ‘gethostbyname’ function returns information about the host
  4009. named NAME. If the lookup fails, it returns a null pointer.
  4010. -- Function: struct hostent * gethostbyname2 (const char *NAME, int AF)
  4011. Preliminary: | MT-Unsafe race:hostbyname2 env locale | AS-Unsafe
  4012. dlopen plugin corrupt heap lock | AC-Unsafe lock corrupt mem fd |
  4013. *Note POSIX Safety Concepts::.
  4014. The ‘gethostbyname2’ function is like ‘gethostbyname’, but allows
  4015. the caller to specify the desired address family (e.g. ‘AF_INET’ or
  4016. ‘AF_INET6’) of the result.
  4017. -- Function: struct hostent * gethostbyaddr (const void *ADDR,
  4018. socklen_t LENGTH, int FORMAT)
  4019. Preliminary: | MT-Unsafe race:hostbyaddr env locale | AS-Unsafe
  4020. dlopen plugin corrupt heap lock | AC-Unsafe lock corrupt mem fd |
  4021. *Note POSIX Safety Concepts::.
  4022. The ‘gethostbyaddr’ function returns information about the host
  4023. with Internet address ADDR. The parameter ADDR is not really a
  4024. pointer to char - it can be a pointer to an IPv4 or an IPv6
  4025. address. The LENGTH argument is the size (in bytes) of the address
  4026. at ADDR. FORMAT specifies the address format; for an IPv4 Internet
  4027. address, specify a value of ‘AF_INET’; for an IPv6 Internet
  4028. address, use ‘AF_INET6’.
  4029. If the lookup fails, ‘gethostbyaddr’ returns a null pointer.
  4030. If the name lookup by ‘gethostbyname’ or ‘gethostbyaddr’ fails, you
  4031. can find out the reason by looking at the value of the variable
  4032. ‘h_errno’. (It would be cleaner design for these functions to set
  4033. ‘errno’, but use of ‘h_errno’ is compatible with other systems.)
  4034. Here are the error codes that you may find in ‘h_errno’:
  4035. ‘HOST_NOT_FOUND’
  4036. No such host is known in the database.
  4037. ‘TRY_AGAIN’
  4038. This condition happens when the name server could not be contacted.
  4039. If you try again later, you may succeed then.
  4040. ‘NO_RECOVERY’
  4041. A non-recoverable error occurred.
  4042. ‘NO_ADDRESS’
  4043. The host database contains an entry for the name, but it doesn't
  4044. have an associated Internet address.
  4045. The lookup functions above all have one thing in common: they are not
  4046. reentrant and therefore unusable in multi-threaded applications.
  4047. Therefore provides the GNU C Library a new set of functions which can be
  4048. used in this context.
  4049. -- Function: int gethostbyname_r (const char *restrict NAME, struct
  4050. hostent *restrict RESULT_BUF, char *restrict BUF, size_t
  4051. BUFLEN, struct hostent **restrict RESULT, int *restrict
  4052. H_ERRNOP)
  4053. Preliminary: | MT-Safe env locale | AS-Unsafe dlopen plugin corrupt
  4054. heap lock | AC-Unsafe lock corrupt mem fd | *Note POSIX Safety
  4055. Concepts::.
  4056. The ‘gethostbyname_r’ function returns information about the host
  4057. named NAME. The caller must pass a pointer to an object of type
  4058. ‘struct hostent’ in the RESULT_BUF parameter. In addition the
  4059. function may need extra buffer space and the caller must pass a
  4060. pointer and the size of the buffer in the BUF and BUFLEN
  4061. parameters.
  4062. A pointer to the buffer, in which the result is stored, is
  4063. available in ‘*RESULT’ after the function call successfully
  4064. returned. The buffer passed as the BUF parameter can be freed only
  4065. once the caller has finished with the result hostent struct, or has
  4066. copied it including all the other memory that it points to. If an
  4067. error occurs or if no entry is found, the pointer ‘*RESULT’ is a
  4068. null pointer. Success is signalled by a zero return value. If the
  4069. function failed the return value is an error number. In addition
  4070. to the errors defined for ‘gethostbyname’ it can also be ‘ERANGE’.
  4071. In this case the call should be repeated with a larger buffer.
  4072. Additional error information is not stored in the global variable
  4073. ‘h_errno’ but instead in the object pointed to by H_ERRNOP.
  4074. Here's a small example:
  4075. struct hostent *
  4076. gethostname (char *host)
  4077. {
  4078. struct hostent *hostbuf, *hp;
  4079. size_t hstbuflen;
  4080. char *tmphstbuf;
  4081. int res;
  4082. int herr;
  4083. hostbuf = malloc (sizeof (struct hostent));
  4084. hstbuflen = 1024;
  4085. tmphstbuf = malloc (hstbuflen);
  4086. while ((res = gethostbyname_r (host, hostbuf, tmphstbuf, hstbuflen,
  4087. &hp, &herr)) == ERANGE)
  4088. {
  4089. /* Enlarge the buffer. */
  4090. tmphstbuf = reallocarray (tmphstbuf, hstbuflen, 2);
  4091. hstbuflen *= 2;
  4092. }
  4093. free (tmphstbuf);
  4094. /* Check for errors. */
  4095. if (res || hp == NULL)
  4096. return NULL;
  4097. return hp;
  4098. }
  4099. -- Function: int gethostbyname2_r (const char *NAME, int AF, struct
  4100. hostent *restrict RESULT_BUF, char *restrict BUF, size_t
  4101. BUFLEN, struct hostent **restrict RESULT, int *restrict
  4102. H_ERRNOP)
  4103. Preliminary: | MT-Safe env locale | AS-Unsafe dlopen plugin corrupt
  4104. heap lock | AC-Unsafe lock corrupt mem fd | *Note POSIX Safety
  4105. Concepts::.
  4106. The ‘gethostbyname2_r’ function is like ‘gethostbyname_r’, but
  4107. allows the caller to specify the desired address family (e.g.
  4108. ‘AF_INET’ or ‘AF_INET6’) for the result.
  4109. -- Function: int gethostbyaddr_r (const void *ADDR, socklen_t LENGTH,
  4110. int FORMAT, struct hostent *restrict RESULT_BUF, char
  4111. *restrict BUF, size_t BUFLEN, struct hostent **restrict
  4112. RESULT, int *restrict H_ERRNOP)
  4113. Preliminary: | MT-Safe env locale | AS-Unsafe dlopen plugin corrupt
  4114. heap lock | AC-Unsafe lock corrupt mem fd | *Note POSIX Safety
  4115. Concepts::.
  4116. The ‘gethostbyaddr_r’ function returns information about the host
  4117. with Internet address ADDR. The parameter ADDR is not really a
  4118. pointer to char - it can be a pointer to an IPv4 or an IPv6
  4119. address. The LENGTH argument is the size (in bytes) of the address
  4120. at ADDR. FORMAT specifies the address format; for an IPv4 Internet
  4121. address, specify a value of ‘AF_INET’; for an IPv6 Internet
  4122. address, use ‘AF_INET6’.
  4123. Similar to the ‘gethostbyname_r’ function, the caller must provide
  4124. buffers for the result and memory used internally. In case of
  4125. success the function returns zero. Otherwise the value is an error
  4126. number where ‘ERANGE’ has the special meaning that the
  4127. caller-provided buffer is too small.
  4128. You can also scan the entire hosts database one entry at a time using
  4129. ‘sethostent’, ‘gethostent’ and ‘endhostent’. Be careful when using
  4130. these functions because they are not reentrant.
  4131. -- Function: void sethostent (int STAYOPEN)
  4132. Preliminary: | MT-Unsafe race:hostent env locale | AS-Unsafe dlopen
  4133. plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note POSIX
  4134. Safety Concepts::.
  4135. This function opens the hosts database to begin scanning it. You
  4136. can then call ‘gethostent’ to read the entries.
  4137. If the STAYOPEN argument is nonzero, this sets a flag so that
  4138. subsequent calls to ‘gethostbyname’ or ‘gethostbyaddr’ will not
  4139. close the database (as they usually would). This makes for more
  4140. efficiency if you call those functions several times, by avoiding
  4141. reopening the database for each call.
  4142. -- Function: struct hostent * gethostent (void)
  4143. Preliminary: | MT-Unsafe race:hostent race:hostentbuf env locale |
  4144. AS-Unsafe dlopen plugin heap lock | AC-Unsafe corrupt lock fd mem |
  4145. *Note POSIX Safety Concepts::.
  4146. This function returns the next entry in the hosts database. It
  4147. returns a null pointer if there are no more entries.
  4148. -- Function: void endhostent (void)
  4149. Preliminary: | MT-Unsafe race:hostent env locale | AS-Unsafe dlopen
  4150. plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note POSIX
  4151. Safety Concepts::.
  4152. This function closes the hosts database.
  4153. 
  4154. File: libc.info, Node: Ports, Next: Services Database, Prev: Host Addresses, Up: Internet Namespace
  4155. 16.6.3 Internet Ports
  4156. ---------------------
  4157. A socket address in the Internet namespace consists of a machine's
  4158. Internet address plus a “port number” which distinguishes the sockets on
  4159. a given machine (for a given protocol). Port numbers range from 0 to
  4160. 65,535.
  4161. Port numbers less than ‘IPPORT_RESERVED’ are reserved for standard
  4162. servers, such as ‘finger’ and ‘telnet’. There is a database that keeps
  4163. track of these, and you can use the ‘getservbyname’ function to map a
  4164. service name onto a port number; see *note Services Database::.
  4165. If you write a server that is not one of the standard ones defined in
  4166. the database, you must choose a port number for it. Use a number
  4167. greater than ‘IPPORT_USERRESERVED’; such numbers are reserved for
  4168. servers and won't ever be generated automatically by the system.
  4169. Avoiding conflicts with servers being run by other users is up to you.
  4170. When you use a socket without specifying its address, the system
  4171. generates a port number for it. This number is between
  4172. ‘IPPORT_RESERVED’ and ‘IPPORT_USERRESERVED’.
  4173. On the Internet, it is actually legitimate to have two different
  4174. sockets with the same port number, as long as they never both try to
  4175. communicate with the same socket address (host address plus port
  4176. number). You shouldn't duplicate a port number except in special
  4177. circumstances where a higher-level protocol requires it. Normally, the
  4178. system won't let you do it; ‘bind’ normally insists on distinct port
  4179. numbers. To reuse a port number, you must set the socket option
  4180. ‘SO_REUSEADDR’. *Note Socket-Level Options::.
  4181. These macros are defined in the header file ‘netinet/in.h’.
  4182. -- Macro: int IPPORT_RESERVED
  4183. Port numbers less than ‘IPPORT_RESERVED’ are reserved for superuser
  4184. use.
  4185. -- Macro: int IPPORT_USERRESERVED
  4186. Port numbers greater than or equal to ‘IPPORT_USERRESERVED’ are
  4187. reserved for explicit use; they will never be allocated
  4188. automatically.
  4189. 
  4190. File: libc.info, Node: Services Database, Next: Byte Order, Prev: Ports, Up: Internet Namespace
  4191. 16.6.4 The Services Database
  4192. ----------------------------
  4193. The database that keeps track of "well-known" services is usually either
  4194. the file ‘/etc/services’ or an equivalent from a name server. You can
  4195. use these utilities, declared in ‘netdb.h’, to access the services
  4196. database.
  4197. -- Data Type: struct servent
  4198. This data type holds information about entries from the services
  4199. database. It has the following members:
  4200. ‘char *s_name’
  4201. This is the "official" name of the service.
  4202. ‘char **s_aliases’
  4203. These are alternate names for the service, represented as an
  4204. array of strings. A null pointer terminates the array.
  4205. ‘int s_port’
  4206. This is the port number for the service. Port numbers are
  4207. given in network byte order; see *note Byte Order::.
  4208. ‘char *s_proto’
  4209. This is the name of the protocol to use with this service.
  4210. *Note Protocols Database::.
  4211. To get information about a particular service, use the
  4212. ‘getservbyname’ or ‘getservbyport’ functions. The information is
  4213. returned in a statically-allocated structure; you must copy the
  4214. information if you need to save it across calls.
  4215. -- Function: struct servent * getservbyname (const char *NAME, const
  4216. char *PROTO)
  4217. Preliminary: | MT-Unsafe race:servbyname locale | AS-Unsafe dlopen
  4218. plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note POSIX
  4219. Safety Concepts::.
  4220. The ‘getservbyname’ function returns information about the service
  4221. named NAME using protocol PROTO. If it can't find such a service,
  4222. it returns a null pointer.
  4223. This function is useful for servers as well as for clients; servers
  4224. use it to determine which port they should listen on (*note
  4225. Listening::).
  4226. -- Function: struct servent * getservbyport (int PORT, const char
  4227. *PROTO)
  4228. Preliminary: | MT-Unsafe race:servbyport locale | AS-Unsafe dlopen
  4229. plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note POSIX
  4230. Safety Concepts::.
  4231. The ‘getservbyport’ function returns information about the service
  4232. at port PORT using protocol PROTO. If it can't find such a
  4233. service, it returns a null pointer.
  4234. You can also scan the services database using ‘setservent’, ‘getservent’
  4235. and ‘endservent’. Be careful when using these functions because they
  4236. are not reentrant.
  4237. -- Function: void setservent (int STAYOPEN)
  4238. Preliminary: | MT-Unsafe race:servent locale | AS-Unsafe dlopen
  4239. plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note POSIX
  4240. Safety Concepts::.
  4241. This function opens the services database to begin scanning it.
  4242. If the STAYOPEN argument is nonzero, this sets a flag so that
  4243. subsequent calls to ‘getservbyname’ or ‘getservbyport’ will not
  4244. close the database (as they usually would). This makes for more
  4245. efficiency if you call those functions several times, by avoiding
  4246. reopening the database for each call.
  4247. -- Function: struct servent * getservent (void)
  4248. Preliminary: | MT-Unsafe race:servent race:serventbuf locale |
  4249. AS-Unsafe dlopen plugin heap lock | AC-Unsafe corrupt lock fd mem |
  4250. *Note POSIX Safety Concepts::.
  4251. This function returns the next entry in the services database. If
  4252. there are no more entries, it returns a null pointer.
  4253. -- Function: void endservent (void)
  4254. Preliminary: | MT-Unsafe race:servent locale | AS-Unsafe dlopen
  4255. plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note POSIX
  4256. Safety Concepts::.
  4257. This function closes the services database.
  4258. 
  4259. File: libc.info, Node: Byte Order, Next: Protocols Database, Prev: Services Database, Up: Internet Namespace
  4260. 16.6.5 Byte Order Conversion
  4261. ----------------------------
  4262. Different kinds of computers use different conventions for the ordering
  4263. of bytes within a word. Some computers put the most significant byte
  4264. within a word first (this is called "big-endian" order), and others put
  4265. it last ("little-endian" order).
  4266. So that machines with different byte order conventions can
  4267. communicate, the Internet protocols specify a canonical byte order
  4268. convention for data transmitted over the network. This is known as
  4269. “network byte order”.
  4270. When establishing an Internet socket connection, you must make sure
  4271. that the data in the ‘sin_port’ and ‘sin_addr’ members of the
  4272. ‘sockaddr_in’ structure are represented in network byte order. If you
  4273. are encoding integer data in the messages sent through the socket, you
  4274. should convert this to network byte order too. If you don't do this,
  4275. your program may fail when running on or talking to other kinds of
  4276. machines.
  4277. If you use ‘getservbyname’ and ‘gethostbyname’ or ‘inet_addr’ to get
  4278. the port number and host address, the values are already in network byte
  4279. order, and you can copy them directly into the ‘sockaddr_in’ structure.
  4280. Otherwise, you have to convert the values explicitly. Use ‘htons’
  4281. and ‘ntohs’ to convert values for the ‘sin_port’ member. Use ‘htonl’
  4282. and ‘ntohl’ to convert IPv4 addresses for the ‘sin_addr’ member.
  4283. (Remember, ‘struct in_addr’ is equivalent to ‘uint32_t’.) These
  4284. functions are declared in ‘netinet/in.h’.
  4285. -- Function: uint16_t htons (uint16_t HOSTSHORT)
  4286. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  4287. Concepts::.
  4288. This function converts the ‘uint16_t’ integer HOSTSHORT from host
  4289. byte order to network byte order.
  4290. -- Function: uint16_t ntohs (uint16_t NETSHORT)
  4291. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  4292. Concepts::.
  4293. This function converts the ‘uint16_t’ integer NETSHORT from network
  4294. byte order to host byte order.
  4295. -- Function: uint32_t htonl (uint32_t HOSTLONG)
  4296. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  4297. Concepts::.
  4298. This function converts the ‘uint32_t’ integer HOSTLONG from host
  4299. byte order to network byte order.
  4300. This is used for IPv4 Internet addresses.
  4301. -- Function: uint32_t ntohl (uint32_t NETLONG)
  4302. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  4303. Concepts::.
  4304. This function converts the ‘uint32_t’ integer NETLONG from network
  4305. byte order to host byte order.
  4306. This is used for IPv4 Internet addresses.
  4307. 
  4308. File: libc.info, Node: Protocols Database, Next: Inet Example, Prev: Byte Order, Up: Internet Namespace
  4309. 16.6.6 Protocols Database
  4310. -------------------------
  4311. The communications protocol used with a socket controls low-level
  4312. details of how data are exchanged. For example, the protocol implements
  4313. things like checksums to detect errors in transmissions, and routing
  4314. instructions for messages. Normal user programs have little reason to
  4315. mess with these details directly.
  4316. The default communications protocol for the Internet namespace
  4317. depends on the communication style. For stream communication, the
  4318. default is TCP ("transmission control protocol"). For datagram
  4319. communication, the default is UDP ("user datagram protocol"). For
  4320. reliable datagram communication, the default is RDP ("reliable datagram
  4321. protocol"). You should nearly always use the default.
  4322. Internet protocols are generally specified by a name instead of a
  4323. number. The network protocols that a host knows about are stored in a
  4324. database. This is usually either derived from the file
  4325. ‘/etc/protocols’, or it may be an equivalent provided by a name server.
  4326. You look up the protocol number associated with a named protocol in the
  4327. database using the ‘getprotobyname’ function.
  4328. Here are detailed descriptions of the utilities for accessing the
  4329. protocols database. These are declared in ‘netdb.h’.
  4330. -- Data Type: struct protoent
  4331. This data type is used to represent entries in the network
  4332. protocols database. It has the following members:
  4333. ‘char *p_name’
  4334. This is the official name of the protocol.
  4335. ‘char **p_aliases’
  4336. These are alternate names for the protocol, specified as an
  4337. array of strings. The last element of the array is a null
  4338. pointer.
  4339. ‘int p_proto’
  4340. This is the protocol number (in host byte order); use this
  4341. member as the PROTOCOL argument to ‘socket’.
  4342. You can use ‘getprotobyname’ and ‘getprotobynumber’ to search the
  4343. protocols database for a specific protocol. The information is returned
  4344. in a statically-allocated structure; you must copy the information if
  4345. you need to save it across calls.
  4346. -- Function: struct protoent * getprotobyname (const char *NAME)
  4347. Preliminary: | MT-Unsafe race:protobyname locale | AS-Unsafe dlopen
  4348. plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note POSIX
  4349. Safety Concepts::.
  4350. The ‘getprotobyname’ function returns information about the network
  4351. protocol named NAME. If there is no such protocol, it returns a
  4352. null pointer.
  4353. -- Function: struct protoent * getprotobynumber (int PROTOCOL)
  4354. Preliminary: | MT-Unsafe race:protobynumber locale | AS-Unsafe
  4355. dlopen plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note
  4356. POSIX Safety Concepts::.
  4357. The ‘getprotobynumber’ function returns information about the
  4358. network protocol with number PROTOCOL. If there is no such
  4359. protocol, it returns a null pointer.
  4360. You can also scan the whole protocols database one protocol at a time
  4361. by using ‘setprotoent’, ‘getprotoent’ and ‘endprotoent’. Be careful
  4362. when using these functions because they are not reentrant.
  4363. -- Function: void setprotoent (int STAYOPEN)
  4364. Preliminary: | MT-Unsafe race:protoent locale | AS-Unsafe dlopen
  4365. plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note POSIX
  4366. Safety Concepts::.
  4367. This function opens the protocols database to begin scanning it.
  4368. If the STAYOPEN argument is nonzero, this sets a flag so that
  4369. subsequent calls to ‘getprotobyname’ or ‘getprotobynumber’ will not
  4370. close the database (as they usually would). This makes for more
  4371. efficiency if you call those functions several times, by avoiding
  4372. reopening the database for each call.
  4373. -- Function: struct protoent * getprotoent (void)
  4374. Preliminary: | MT-Unsafe race:protoent race:protoentbuf locale |
  4375. AS-Unsafe dlopen plugin heap lock | AC-Unsafe corrupt lock fd mem |
  4376. *Note POSIX Safety Concepts::.
  4377. This function returns the next entry in the protocols database. It
  4378. returns a null pointer if there are no more entries.
  4379. -- Function: void endprotoent (void)
  4380. Preliminary: | MT-Unsafe race:protoent locale | AS-Unsafe dlopen
  4381. plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note POSIX
  4382. Safety Concepts::.
  4383. This function closes the protocols database.
  4384. 
  4385. File: libc.info, Node: Inet Example, Prev: Protocols Database, Up: Internet Namespace
  4386. 16.6.7 Internet Socket Example
  4387. ------------------------------
  4388. Here is an example showing how to create and name a socket in the
  4389. Internet namespace. The newly created socket exists on the machine that
  4390. the program is running on. Rather than finding and using the machine's
  4391. Internet address, this example specifies ‘INADDR_ANY’ as the host
  4392. address; the system replaces that with the machine's actual address.
  4393. #include <stdio.h>
  4394. #include <stdlib.h>
  4395. #include <sys/socket.h>
  4396. #include <netinet/in.h>
  4397. int
  4398. make_socket (uint16_t port)
  4399. {
  4400. int sock;
  4401. struct sockaddr_in name;
  4402. /* Create the socket. */
  4403. sock = socket (PF_INET, SOCK_STREAM, 0);
  4404. if (sock < 0)
  4405. {
  4406. perror ("socket");
  4407. exit (EXIT_FAILURE);
  4408. }
  4409. /* Give the socket a name. */
  4410. name.sin_family = AF_INET;
  4411. name.sin_port = htons (port);
  4412. name.sin_addr.s_addr = htonl (INADDR_ANY);
  4413. if (bind (sock, (struct sockaddr *) &name, sizeof (name)) < 0)
  4414. {
  4415. perror ("bind");
  4416. exit (EXIT_FAILURE);
  4417. }
  4418. return sock;
  4419. }
  4420. Here is another example, showing how you can fill in a ‘sockaddr_in’
  4421. structure, given a host name string and a port number:
  4422. #include <stdio.h>
  4423. #include <stdlib.h>
  4424. #include <sys/socket.h>
  4425. #include <netinet/in.h>
  4426. #include <netdb.h>
  4427. void
  4428. init_sockaddr (struct sockaddr_in *name,
  4429. const char *hostname,
  4430. uint16_t port)
  4431. {
  4432. struct hostent *hostinfo;
  4433. name->sin_family = AF_INET;
  4434. name->sin_port = htons (port);
  4435. hostinfo = gethostbyname (hostname);
  4436. if (hostinfo == NULL)
  4437. {
  4438. fprintf (stderr, "Unknown host %s.\n", hostname);
  4439. exit (EXIT_FAILURE);
  4440. }
  4441. name->sin_addr = *(struct in_addr *) hostinfo->h_addr;
  4442. }
  4443. 
  4444. File: libc.info, Node: Misc Namespaces, Next: Open/Close Sockets, Prev: Internet Namespace, Up: Sockets
  4445. 16.7 Other Namespaces
  4446. =====================
  4447. Certain other namespaces and associated protocol families are supported
  4448. but not documented yet because they are not often used. ‘PF_NS’ refers
  4449. to the Xerox Network Software protocols. ‘PF_ISO’ stands for Open
  4450. Systems Interconnect. ‘PF_CCITT’ refers to protocols from CCITT.
  4451. ‘socket.h’ defines these symbols and others naming protocols not
  4452. actually implemented.
  4453. ‘PF_IMPLINK’ is used for communicating between hosts and Internet
  4454. Message Processors. For information on this and ‘PF_ROUTE’, an
  4455. occasionally-used local area routing protocol, see the GNU Hurd Manual
  4456. (to appear in the future).
  4457. 
  4458. File: libc.info, Node: Open/Close Sockets, Next: Connections, Prev: Misc Namespaces, Up: Sockets
  4459. 16.8 Opening and Closing Sockets
  4460. ================================
  4461. This section describes the actual library functions for opening and
  4462. closing sockets. The same functions work for all namespaces and
  4463. connection styles.
  4464. * Menu:
  4465. * Creating a Socket:: How to open a socket.
  4466. * Closing a Socket:: How to close a socket.
  4467. * Socket Pairs:: These are created like pipes.
  4468. 
  4469. File: libc.info, Node: Creating a Socket, Next: Closing a Socket, Up: Open/Close Sockets
  4470. 16.8.1 Creating a Socket
  4471. ------------------------
  4472. The primitive for creating a socket is the ‘socket’ function, declared
  4473. in ‘sys/socket.h’.
  4474. -- Function: int socket (int NAMESPACE, int STYLE, int PROTOCOL)
  4475. Preliminary: | MT-Safe | AS-Safe | AC-Safe fd | *Note POSIX Safety
  4476. Concepts::.
  4477. This function creates a socket and specifies communication style
  4478. STYLE, which should be one of the socket styles listed in *note
  4479. Communication Styles::. The NAMESPACE argument specifies the
  4480. namespace; it must be ‘PF_LOCAL’ (*note Local Namespace::) or
  4481. ‘PF_INET’ (*note Internet Namespace::). PROTOCOL designates the
  4482. specific protocol (*note Socket Concepts::); zero is usually right
  4483. for PROTOCOL.
  4484. The return value from ‘socket’ is the file descriptor for the new
  4485. socket, or ‘-1’ in case of error. The following ‘errno’ error
  4486. conditions are defined for this function:
  4487. ‘EAFNOSUPPORT’
  4488. The NAMESPACE requested is not supported.
  4489. ‘ESOCKTNOSUPPORT’
  4490. ‘EPROTONOSUPPORT’
  4491. ‘EPROTOTYPE’
  4492. The STYLE is not supported by the NAMESPACE specified.
  4493. ‘EPROTONOSUPPORT’
  4494. The PROTOCOL is not supported by the NAMESPACE specified.
  4495. ‘EINVAL’
  4496. The STYLE or PROTOCOL requested is not valid.
  4497. ‘EMFILE’
  4498. The process already has too many file descriptors open.
  4499. ‘ENFILE’
  4500. The system already has too many file descriptors open.
  4501. ‘EACCES’
  4502. ‘EPERM’
  4503. The process does not have the privilege to create a socket of
  4504. the specified STYLE or PROTOCOL.
  4505. ‘ENOBUFS’
  4506. ‘ENOMEM’
  4507. Insufficient memory was available.
  4508. The file descriptor returned by the ‘socket’ function supports both
  4509. read and write operations. However, like pipes, sockets do not
  4510. support file positioning operations.
  4511. For examples of how to call the ‘socket’ function, see *note Local
  4512. Socket Example::, or *note Inet Example::.
  4513. 
  4514. File: libc.info, Node: Closing a Socket, Next: Socket Pairs, Prev: Creating a Socket, Up: Open/Close Sockets
  4515. 16.8.2 Closing a Socket
  4516. -----------------------
  4517. When you have finished using a socket, you can simply close its file
  4518. descriptor with ‘close’; see *note Opening and Closing Files::. If
  4519. there is still data waiting to be transmitted over the connection,
  4520. normally ‘close’ tries to complete this transmission. You can control
  4521. this behavior using the ‘SO_LINGER’ socket option to specify a timeout
  4522. period; see *note Socket Options::.
  4523. You can also shut down only reception or transmission on a connection
  4524. by calling ‘shutdown’, which is declared in ‘sys/socket.h’.
  4525. -- Function: int shutdown (int SOCKET, int HOW)
  4526. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  4527. Concepts::.
  4528. The ‘shutdown’ function shuts down the connection of socket SOCKET.
  4529. The argument HOW specifies what action to perform:
  4530. ‘SHUT_RD’
  4531. Stop receiving data on the socket.
  4532. ‘SHUT_WR’
  4533. Indicate to the peer that no further data will be transmitted
  4534. on the socket. This indication is ordered with regard to past
  4535. send operations on the socket, and data pending at the time of
  4536. the call is still delivered.
  4537. ‘SHUT_RDWR’
  4538. Combine the actions of ‘SHUT_RD’ and ‘SHUT_WR’.
  4539. The return value is ‘0’ on success and ‘-1’ on failure. The
  4540. following generic ‘errno’ error conditions are defined for this
  4541. function:
  4542. ‘EBADF’
  4543. SOCKET is not a valid file descriptor.
  4544. ‘ENOTSOCK’
  4545. SOCKET is not a socket.
  4546. ‘ENOTCONN’
  4547. SOCKET is not connected.
  4548. Additional errors can be reported for specific socket types.
  4549. The exact impact of the ‘shutdown’ function depends on the socket
  4550. protocol and its implementation. In portable code, the ‘shutdown’
  4551. function cannot be used on its own to gracefully terminate a connection
  4552. which is operated in full-duplex mode (with both peers sending data).
  4553. On Linux, when ‘SHUT_RD’ is used to shut down a TCP socket, any
  4554. pending data in the incoming socket buffer and any data that arrives
  4555. subsequently is discarded, without reporting an error or generating a
  4556. TCP RST segment. Attempts to read data from this socket using ‘recv’
  4557. and similar functions (*note Receiving Data::) return zero. (Other
  4558. systems may treat ‘SHUT_RD’ with pending data as a data loss event and
  4559. generate RST segments. Linux ‘AF_LOCAL’/‘AF_UNIX’ sockets also report
  4560. errors to peers.)
  4561. Similarly, when ‘SHUT_WR’ is used on a Linux TCP socket, a FIN
  4562. segment is sent to the peer, ordered after any data written previously
  4563. to the socket. After encountering the FIN segment, the peer will
  4564. recognize this as an end-of-stream condition.
  4565. 
  4566. File: libc.info, Node: Socket Pairs, Prev: Closing a Socket, Up: Open/Close Sockets
  4567. 16.8.3 Socket Pairs
  4568. -------------------
  4569. A “socket pair” consists of a pair of connected (but unnamed) sockets.
  4570. It is very similar to a pipe and is used in much the same way. Socket
  4571. pairs are created with the ‘socketpair’ function, declared in
  4572. ‘sys/socket.h’. A socket pair is much like a pipe; the main difference
  4573. is that the socket pair is bidirectional, whereas the pipe has one
  4574. input-only end and one output-only end (*note Pipes and FIFOs::).
  4575. -- Function: int socketpair (int NAMESPACE, int STYLE, int PROTOCOL,
  4576. int FILEDES[2])
  4577. Preliminary: | MT-Safe | AS-Safe | AC-Safe fd | *Note POSIX Safety
  4578. Concepts::.
  4579. This function creates a socket pair, returning the file descriptors
  4580. in ‘FILEDES[0]’ and ‘FILEDES[1]’. The socket pair is a full-duplex
  4581. communications channel, so that both reading and writing may be
  4582. performed at either end.
  4583. The NAMESPACE, STYLE and PROTOCOL arguments are interpreted as for
  4584. the ‘socket’ function. STYLE should be one of the communication
  4585. styles listed in *note Communication Styles::. The NAMESPACE
  4586. argument specifies the namespace, which must be ‘AF_LOCAL’ (*note
  4587. Local Namespace::); PROTOCOL specifies the communications protocol,
  4588. but zero is the only meaningful value.
  4589. If STYLE specifies a connectionless communication style, then the
  4590. two sockets you get are not _connected_, strictly speaking, but
  4591. each of them knows the other as the default destination address, so
  4592. they can send packets to each other.
  4593. The ‘socketpair’ function returns ‘0’ on success and ‘-1’ on
  4594. failure. The following ‘errno’ error conditions are defined for
  4595. this function:
  4596. ‘EMFILE’
  4597. The process has too many file descriptors open.
  4598. ‘EAFNOSUPPORT’
  4599. The specified namespace is not supported.
  4600. ‘EPROTONOSUPPORT’
  4601. The specified protocol is not supported.
  4602. ‘EOPNOTSUPP’
  4603. The specified protocol does not support the creation of socket
  4604. pairs.
  4605. 
  4606. File: libc.info, Node: Connections, Next: Datagrams, Prev: Open/Close Sockets, Up: Sockets
  4607. 16.9 Using Sockets with Connections
  4608. ===================================
  4609. The most common communication styles involve making a connection to a
  4610. particular other socket, and then exchanging data with that socket over
  4611. and over. Making a connection is asymmetric; one side (the “client”)
  4612. acts to request a connection, while the other side (the “server”) makes
  4613. a socket and waits for the connection request.
  4614. * Menu:
  4615. * Connecting:: What the client program must do.
  4616. * Listening:: How a server program waits for requests.
  4617. * Accepting Connections:: What the server does when it gets a request.
  4618. * Who is Connected:: Getting the address of the
  4619. other side of a connection.
  4620. * Transferring Data:: How to send and receive data.
  4621. * Byte Stream Example:: An example program: a client for communicating
  4622. over a byte stream socket in the Internet namespace.
  4623. * Server Example:: A corresponding server program.
  4624. * Out-of-Band Data:: This is an advanced feature.
  4625. 
  4626. File: libc.info, Node: Connecting, Next: Listening, Up: Connections
  4627. 16.9.1 Making a Connection
  4628. --------------------------
  4629. In making a connection, the client makes a connection while the server
  4630. waits for and accepts the connection. Here we discuss what the client
  4631. program must do with the ‘connect’ function, which is declared in
  4632. ‘sys/socket.h’.
  4633. -- Function: int connect (int SOCKET, struct sockaddr *ADDR, socklen_t
  4634. LENGTH)
  4635. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  4636. Concepts::.
  4637. The ‘connect’ function initiates a connection from the socket with
  4638. file descriptor SOCKET to the socket whose address is specified by
  4639. the ADDR and LENGTH arguments. (This socket is typically on
  4640. another machine, and it must be already set up as a server.) *Note
  4641. Socket Addresses::, for information about how these arguments are
  4642. interpreted.
  4643. Normally, ‘connect’ waits until the server responds to the request
  4644. before it returns. You can set nonblocking mode on the socket
  4645. SOCKET to make ‘connect’ return immediately without waiting for the
  4646. response. *Note File Status Flags::, for information about
  4647. nonblocking mode.
  4648. The normal return value from ‘connect’ is ‘0’. If an error occurs,
  4649. ‘connect’ returns ‘-1’. The following ‘errno’ error conditions are
  4650. defined for this function:
  4651. ‘EBADF’
  4652. The socket SOCKET is not a valid file descriptor.
  4653. ‘ENOTSOCK’
  4654. File descriptor SOCKET is not a socket.
  4655. ‘EADDRNOTAVAIL’
  4656. The specified address is not available on the remote machine.
  4657. ‘EAFNOSUPPORT’
  4658. The namespace of the ADDR is not supported by this socket.
  4659. ‘EISCONN’
  4660. The socket SOCKET is already connected.
  4661. ‘ETIMEDOUT’
  4662. The attempt to establish the connection timed out.
  4663. ‘ECONNREFUSED’
  4664. The server has actively refused to establish the connection.
  4665. ‘ENETUNREACH’
  4666. The network of the given ADDR isn't reachable from this host.
  4667. ‘EADDRINUSE’
  4668. The socket address of the given ADDR is already in use.
  4669. ‘EINPROGRESS’
  4670. The socket SOCKET is non-blocking and the connection could not
  4671. be established immediately. You can determine when the
  4672. connection is completely established with ‘select’; *note
  4673. Waiting for I/O::. Another ‘connect’ call on the same socket,
  4674. before the connection is completely established, will fail
  4675. with ‘EALREADY’.
  4676. ‘EALREADY’
  4677. The socket SOCKET is non-blocking and already has a pending
  4678. connection in progress (see ‘EINPROGRESS’ above).
  4679. This function is defined as a cancellation point in multi-threaded
  4680. programs, so one has to be prepared for this and make sure that
  4681. allocated resources (like memory, file descriptors, semaphores or
  4682. whatever) are freed even if the thread is canceled.
  4683. 
  4684. File: libc.info, Node: Listening, Next: Accepting Connections, Prev: Connecting, Up: Connections
  4685. 16.9.2 Listening for Connections
  4686. --------------------------------
  4687. Now let us consider what the server process must do to accept
  4688. connections on a socket. First it must use the ‘listen’ function to
  4689. enable connection requests on the socket, and then accept each incoming
  4690. connection with a call to ‘accept’ (*note Accepting Connections::).
  4691. Once connection requests are enabled on a server socket, the ‘select’
  4692. function reports when the socket has a connection ready to be accepted
  4693. (*note Waiting for I/O::).
  4694. The ‘listen’ function is not allowed for sockets using connectionless
  4695. communication styles.
  4696. You can write a network server that does not even start running until
  4697. a connection to it is requested. *Note Inetd Servers::.
  4698. In the Internet namespace, there are no special protection mechanisms
  4699. for controlling access to a port; any process on any machine can make a
  4700. connection to your server. If you want to restrict access to your
  4701. server, make it examine the addresses associated with connection
  4702. requests or implement some other handshaking or identification protocol.
  4703. In the local namespace, the ordinary file protection bits control who
  4704. has access to connect to the socket.
  4705. -- Function: int listen (int SOCKET, int N)
  4706. Preliminary: | MT-Safe | AS-Safe | AC-Safe fd | *Note POSIX Safety
  4707. Concepts::.
  4708. The ‘listen’ function enables the socket SOCKET to accept
  4709. connections, thus making it a server socket.
  4710. The argument N specifies the length of the queue for pending
  4711. connections. When the queue fills, new clients attempting to
  4712. connect fail with ‘ECONNREFUSED’ until the server calls ‘accept’ to
  4713. accept a connection from the queue.
  4714. The ‘listen’ function returns ‘0’ on success and ‘-1’ on failure.
  4715. The following ‘errno’ error conditions are defined for this
  4716. function:
  4717. ‘EBADF’
  4718. The argument SOCKET is not a valid file descriptor.
  4719. ‘ENOTSOCK’
  4720. The argument SOCKET is not a socket.
  4721. ‘EOPNOTSUPP’
  4722. The socket SOCKET does not support this operation.
  4723. 
  4724. File: libc.info, Node: Accepting Connections, Next: Who is Connected, Prev: Listening, Up: Connections
  4725. 16.9.3 Accepting Connections
  4726. ----------------------------
  4727. When a server receives a connection request, it can complete the
  4728. connection by accepting the request. Use the function ‘accept’ to do
  4729. this.
  4730. A socket that has been established as a server can accept connection
  4731. requests from multiple clients. The server's original socket _does not
  4732. become part of the connection_; instead, ‘accept’ makes a new socket
  4733. which participates in the connection. ‘accept’ returns the descriptor
  4734. for this socket. The server's original socket remains available for
  4735. listening for further connection requests.
  4736. The number of pending connection requests on a server socket is
  4737. finite. If connection requests arrive from clients faster than the
  4738. server can act upon them, the queue can fill up and additional requests
  4739. are refused with an ‘ECONNREFUSED’ error. You can specify the maximum
  4740. length of this queue as an argument to the ‘listen’ function, although
  4741. the system may also impose its own internal limit on the length of this
  4742. queue.
  4743. -- Function: int accept (int SOCKET, struct sockaddr *ADDR, socklen_t
  4744. *LENGTH_PTR)
  4745. Preliminary: | MT-Safe | AS-Safe | AC-Safe fd | *Note POSIX Safety
  4746. Concepts::.
  4747. This function is used to accept a connection request on the server
  4748. socket SOCKET.
  4749. The ‘accept’ function waits if there are no connections pending,
  4750. unless the socket SOCKET has nonblocking mode set. (You can use
  4751. ‘select’ to wait for a pending connection, with a nonblocking
  4752. socket.) *Note File Status Flags::, for information about
  4753. nonblocking mode.
  4754. The ADDR and LENGTH-PTR arguments are used to return information
  4755. about the name of the client socket that initiated the connection.
  4756. *Note Socket Addresses::, for information about the format of the
  4757. information.
  4758. Accepting a connection does not make SOCKET part of the connection.
  4759. Instead, it creates a new socket which becomes connected. The
  4760. normal return value of ‘accept’ is the file descriptor for the new
  4761. socket.
  4762. After ‘accept’, the original socket SOCKET remains open and
  4763. unconnected, and continues listening until you close it. You can
  4764. accept further connections with SOCKET by calling ‘accept’ again.
  4765. If an error occurs, ‘accept’ returns ‘-1’. The following ‘errno’
  4766. error conditions are defined for this function:
  4767. ‘EBADF’
  4768. The SOCKET argument is not a valid file descriptor.
  4769. ‘ENOTSOCK’
  4770. The descriptor SOCKET argument is not a socket.
  4771. ‘EOPNOTSUPP’
  4772. The descriptor SOCKET does not support this operation.
  4773. ‘EWOULDBLOCK’
  4774. SOCKET has nonblocking mode set, and there are no pending
  4775. connections immediately available.
  4776. This function is defined as a cancellation point in multi-threaded
  4777. programs, so one has to be prepared for this and make sure that
  4778. allocated resources (like memory, file descriptors, semaphores or
  4779. whatever) are freed even if the thread is canceled.
  4780. The ‘accept’ function is not allowed for sockets using connectionless
  4781. communication styles.
  4782. 
  4783. File: libc.info, Node: Who is Connected, Next: Transferring Data, Prev: Accepting Connections, Up: Connections
  4784. 16.9.4 Who is Connected to Me?
  4785. ------------------------------
  4786. -- Function: int getpeername (int SOCKET, struct sockaddr *ADDR,
  4787. socklen_t *LENGTH-PTR)
  4788. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  4789. Concepts::.
  4790. The ‘getpeername’ function returns the address of the socket that
  4791. SOCKET is connected to; it stores the address in the memory space
  4792. specified by ADDR and LENGTH-PTR. It stores the length of the
  4793. address in ‘*LENGTH-PTR’.
  4794. *Note Socket Addresses::, for information about the format of the
  4795. address. In some operating systems, ‘getpeername’ works only for
  4796. sockets in the Internet domain.
  4797. The return value is ‘0’ on success and ‘-1’ on error. The
  4798. following ‘errno’ error conditions are defined for this function:
  4799. ‘EBADF’
  4800. The argument SOCKET is not a valid file descriptor.
  4801. ‘ENOTSOCK’
  4802. The descriptor SOCKET is not a socket.
  4803. ‘ENOTCONN’
  4804. The socket SOCKET is not connected.
  4805. ‘ENOBUFS’
  4806. There are not enough internal buffers available.
  4807. 
  4808. File: libc.info, Node: Transferring Data, Next: Byte Stream Example, Prev: Who is Connected, Up: Connections
  4809. 16.9.5 Transferring Data
  4810. ------------------------
  4811. Once a socket has been connected to a peer, you can use the ordinary
  4812. ‘read’ and ‘write’ operations (*note I/O Primitives::) to transfer data.
  4813. A socket is a two-way communications channel, so read and write
  4814. operations can be performed at either end.
  4815. There are also some I/O modes that are specific to socket operations.
  4816. In order to specify these modes, you must use the ‘recv’ and ‘send’
  4817. functions instead of the more generic ‘read’ and ‘write’ functions. The
  4818. ‘recv’ and ‘send’ functions take an additional argument which you can
  4819. use to specify various flags to control special I/O modes. For example,
  4820. you can specify the ‘MSG_OOB’ flag to read or write out-of-band data,
  4821. the ‘MSG_PEEK’ flag to peek at input, or the ‘MSG_DONTROUTE’ flag to
  4822. control inclusion of routing information on output.
  4823. * Menu:
  4824. * Sending Data:: Sending data with ‘send’.
  4825. * Receiving Data:: Reading data with ‘recv’.
  4826. * Socket Data Options:: Using ‘send’ and ‘recv’.
  4827. 
  4828. File: libc.info, Node: Sending Data, Next: Receiving Data, Up: Transferring Data
  4829. 16.9.5.1 Sending Data
  4830. .....................
  4831. The ‘send’ function is declared in the header file ‘sys/socket.h’. If
  4832. your FLAGS argument is zero, you can just as well use ‘write’ instead of
  4833. ‘send’; see *note I/O Primitives::. If the socket was connected but the
  4834. connection has broken, you get a ‘SIGPIPE’ signal for any use of ‘send’
  4835. or ‘write’ (*note Miscellaneous Signals::).
  4836. -- Function: ssize_t send (int SOCKET, const void *BUFFER, size_t SIZE,
  4837. int FLAGS)
  4838. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  4839. Concepts::.
  4840. The ‘send’ function is like ‘write’, but with the additional flags
  4841. FLAGS. The possible values of FLAGS are described in *note Socket
  4842. Data Options::.
  4843. This function returns the number of bytes transmitted, or ‘-1’ on
  4844. failure. If the socket is nonblocking, then ‘send’ (like ‘write’)
  4845. can return after sending just part of the data. *Note File Status
  4846. Flags::, for information about nonblocking mode.
  4847. Note, however, that a successful return value merely indicates that
  4848. the message has been sent without error, not necessarily that it
  4849. has been received without error.
  4850. The following ‘errno’ error conditions are defined for this
  4851. function:
  4852. ‘EBADF’
  4853. The SOCKET argument is not a valid file descriptor.
  4854. ‘EINTR’
  4855. The operation was interrupted by a signal before any data was
  4856. sent. *Note Interrupted Primitives::.
  4857. ‘ENOTSOCK’
  4858. The descriptor SOCKET is not a socket.
  4859. ‘EMSGSIZE’
  4860. The socket type requires that the message be sent atomically,
  4861. but the message is too large for this to be possible.
  4862. ‘EWOULDBLOCK’
  4863. Nonblocking mode has been set on the socket, and the write
  4864. operation would block. (Normally ‘send’ blocks until the
  4865. operation can be completed.)
  4866. ‘ENOBUFS’
  4867. There is not enough internal buffer space available.
  4868. ‘ENOTCONN’
  4869. You never connected this socket.
  4870. ‘EPIPE’
  4871. This socket was connected but the connection is now broken.
  4872. In this case, ‘send’ generates a ‘SIGPIPE’ signal first; if
  4873. that signal is ignored or blocked, or if its handler returns,
  4874. then ‘send’ fails with ‘EPIPE’.
  4875. This function is defined as a cancellation point in multi-threaded
  4876. programs, so one has to be prepared for this and make sure that
  4877. allocated resources (like memory, file descriptors, semaphores or
  4878. whatever) are freed even if the thread is canceled.
  4879. 
  4880. File: libc.info, Node: Receiving Data, Next: Socket Data Options, Prev: Sending Data, Up: Transferring Data
  4881. 16.9.5.2 Receiving Data
  4882. .......................
  4883. The ‘recv’ function is declared in the header file ‘sys/socket.h’. If
  4884. your FLAGS argument is zero, you can just as well use ‘read’ instead of
  4885. ‘recv’; see *note I/O Primitives::.
  4886. -- Function: ssize_t recv (int SOCKET, void *BUFFER, size_t SIZE, int
  4887. FLAGS)
  4888. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  4889. Concepts::.
  4890. The ‘recv’ function is like ‘read’, but with the additional flags
  4891. FLAGS. The possible values of FLAGS are described in *note Socket
  4892. Data Options::.
  4893. If nonblocking mode is set for SOCKET, and no data are available to
  4894. be read, ‘recv’ fails immediately rather than waiting. *Note File
  4895. Status Flags::, for information about nonblocking mode.
  4896. This function returns the number of bytes received, or ‘-1’ on
  4897. failure. The following ‘errno’ error conditions are defined for
  4898. this function:
  4899. ‘EBADF’
  4900. The SOCKET argument is not a valid file descriptor.
  4901. ‘ENOTSOCK’
  4902. The descriptor SOCKET is not a socket.
  4903. ‘EWOULDBLOCK’
  4904. Nonblocking mode has been set on the socket, and the read
  4905. operation would block. (Normally, ‘recv’ blocks until there
  4906. is input available to be read.)
  4907. ‘EINTR’
  4908. The operation was interrupted by a signal before any data was
  4909. read. *Note Interrupted Primitives::.
  4910. ‘ENOTCONN’
  4911. You never connected this socket.
  4912. This function is defined as a cancellation point in multi-threaded
  4913. programs, so one has to be prepared for this and make sure that
  4914. allocated resources (like memory, file descriptors, semaphores or
  4915. whatever) are freed even if the thread is canceled.
  4916. 
  4917. File: libc.info, Node: Socket Data Options, Prev: Receiving Data, Up: Transferring Data
  4918. 16.9.5.3 Socket Data Options
  4919. ............................
  4920. The FLAGS argument to ‘send’ and ‘recv’ is a bit mask. You can
  4921. bitwise-OR the values of the following macros together to obtain a value
  4922. for this argument. All are defined in the header file ‘sys/socket.h’.
  4923. -- Macro: int MSG_OOB
  4924. Send or receive out-of-band data. *Note Out-of-Band Data::.
  4925. -- Macro: int MSG_PEEK
  4926. Look at the data but don't remove it from the input queue. This is
  4927. only meaningful with input functions such as ‘recv’, not with
  4928. ‘send’.
  4929. -- Macro: int MSG_DONTROUTE
  4930. Don't include routing information in the message. This is only
  4931. meaningful with output operations, and is usually only of interest
  4932. for diagnostic or routing programs. We don't try to explain it
  4933. here.
  4934. 
  4935. File: libc.info, Node: Byte Stream Example, Next: Server Example, Prev: Transferring Data, Up: Connections
  4936. 16.9.6 Byte Stream Socket Example
  4937. ---------------------------------
  4938. Here is an example client program that makes a connection for a byte
  4939. stream socket in the Internet namespace. It doesn't do anything
  4940. particularly interesting once it has connected to the server; it just
  4941. sends a text string to the server and exits.
  4942. This program uses ‘init_sockaddr’ to set up the socket address; see
  4943. *note Inet Example::.
  4944. #include <stdio.h>
  4945. #include <errno.h>
  4946. #include <stdlib.h>
  4947. #include <string.h>
  4948. #include <unistd.h>
  4949. #include <sys/types.h>
  4950. #include <sys/socket.h>
  4951. #include <netinet/in.h>
  4952. #include <netdb.h>
  4953. #define PORT 5555
  4954. #define MESSAGE "Yow!!! Are we having fun yet?!?"
  4955. #define SERVERHOST "www.gnu.org"
  4956. void
  4957. write_to_server (int filedes)
  4958. {
  4959. int nbytes;
  4960. nbytes = write (filedes, MESSAGE, strlen (MESSAGE) + 1);
  4961. if (nbytes < 0)
  4962. {
  4963. perror ("write");
  4964. exit (EXIT_FAILURE);
  4965. }
  4966. }
  4967. int
  4968. main (void)
  4969. {
  4970. extern void init_sockaddr (struct sockaddr_in *name,
  4971. const char *hostname,
  4972. uint16_t port);
  4973. int sock;
  4974. struct sockaddr_in servername;
  4975. /* Create the socket. */
  4976. sock = socket (PF_INET, SOCK_STREAM, 0);
  4977. if (sock < 0)
  4978. {
  4979. perror ("socket (client)");
  4980. exit (EXIT_FAILURE);
  4981. }
  4982. /* Connect to the server. */
  4983. init_sockaddr (&servername, SERVERHOST, PORT);
  4984. if (0 > connect (sock,
  4985. (struct sockaddr *) &servername,
  4986. sizeof (servername)))
  4987. {
  4988. perror ("connect (client)");
  4989. exit (EXIT_FAILURE);
  4990. }
  4991. /* Send data to the server. */
  4992. write_to_server (sock);
  4993. close (sock);
  4994. exit (EXIT_SUCCESS);
  4995. }
  4996. 
  4997. File: libc.info, Node: Server Example, Next: Out-of-Band Data, Prev: Byte Stream Example, Up: Connections
  4998. 16.9.7 Byte Stream Connection Server Example
  4999. --------------------------------------------
  5000. The server end is much more complicated. Since we want to allow
  5001. multiple clients to be connected to the server at the same time, it
  5002. would be incorrect to wait for input from a single client by simply
  5003. calling ‘read’ or ‘recv’. Instead, the right thing to do is to use
  5004. ‘select’ (*note Waiting for I/O::) to wait for input on all of the open
  5005. sockets. This also allows the server to deal with additional connection
  5006. requests.
  5007. This particular server doesn't do anything interesting once it has
  5008. gotten a message from a client. It does close the socket for that
  5009. client when it detects an end-of-file condition (resulting from the
  5010. client shutting down its end of the connection).
  5011. This program uses ‘make_socket’ to set up the socket address; see
  5012. *note Inet Example::.
  5013. #include <arpa/inet.h>
  5014. #include <stdio.h>
  5015. #include <errno.h>
  5016. #include <stdlib.h>
  5017. #include <unistd.h>
  5018. #include <sys/types.h>
  5019. #include <sys/socket.h>
  5020. #include <netinet/in.h>
  5021. #include <netdb.h>
  5022. #define PORT 5555
  5023. #define MAXMSG 512
  5024. int
  5025. read_from_client (int filedes)
  5026. {
  5027. char buffer[MAXMSG];
  5028. int nbytes;
  5029. nbytes = read (filedes, buffer, MAXMSG);
  5030. if (nbytes < 0)
  5031. {
  5032. /* Read error. */
  5033. perror ("read");
  5034. exit (EXIT_FAILURE);
  5035. }
  5036. else if (nbytes == 0)
  5037. /* End-of-file. */
  5038. return -1;
  5039. else
  5040. {
  5041. /* Data read. */
  5042. fprintf (stderr, "Server: got message: `%s'\n", buffer);
  5043. return 0;
  5044. }
  5045. }
  5046. int
  5047. main (void)
  5048. {
  5049. extern int make_socket (uint16_t port);
  5050. int sock;
  5051. fd_set active_fd_set, read_fd_set;
  5052. int i;
  5053. struct sockaddr_in clientname;
  5054. socklen_t size;
  5055. /* Create the socket and set it up to accept connections. */
  5056. sock = make_socket (PORT);
  5057. if (listen (sock, 1) < 0)
  5058. {
  5059. perror ("listen");
  5060. exit (EXIT_FAILURE);
  5061. }
  5062. /* Initialize the set of active sockets. */
  5063. FD_ZERO (&active_fd_set);
  5064. FD_SET (sock, &active_fd_set);
  5065. while (1)
  5066. {
  5067. /* Block until input arrives on one or more active sockets. */
  5068. read_fd_set = active_fd_set;
  5069. if (select (FD_SETSIZE, &read_fd_set, NULL, NULL, NULL) < 0)
  5070. {
  5071. perror ("select");
  5072. exit (EXIT_FAILURE);
  5073. }
  5074. /* Service all the sockets with input pending. */
  5075. for (i = 0; i < FD_SETSIZE; ++i)
  5076. if (FD_ISSET (i, &read_fd_set))
  5077. {
  5078. if (i == sock)
  5079. {
  5080. /* Connection request on original socket. */
  5081. int new;
  5082. size = sizeof (clientname);
  5083. new = accept (sock,
  5084. (struct sockaddr *) &clientname,
  5085. &size);
  5086. if (new < 0)
  5087. {
  5088. perror ("accept");
  5089. exit (EXIT_FAILURE);
  5090. }
  5091. fprintf (stderr,
  5092. "Server: connect from host %s, port %hd.\n",
  5093. inet_ntoa (clientname.sin_addr),
  5094. ntohs (clientname.sin_port));
  5095. FD_SET (new, &active_fd_set);
  5096. }
  5097. else
  5098. {
  5099. /* Data arriving on an already-connected socket. */
  5100. if (read_from_client (i) < 0)
  5101. {
  5102. close (i);
  5103. FD_CLR (i, &active_fd_set);
  5104. }
  5105. }
  5106. }
  5107. }
  5108. }
  5109. 
  5110. File: libc.info, Node: Out-of-Band Data, Prev: Server Example, Up: Connections
  5111. 16.9.8 Out-of-Band Data
  5112. -----------------------
  5113. Streams with connections permit “out-of-band” data that is delivered
  5114. with higher priority than ordinary data. Typically the reason for
  5115. sending out-of-band data is to send notice of an exceptional condition.
  5116. To send out-of-band data use ‘send’, specifying the flag ‘MSG_OOB’
  5117. (*note Sending Data::).
  5118. Out-of-band data are received with higher priority because the
  5119. receiving process need not read it in sequence; to read the next
  5120. available out-of-band data, use ‘recv’ with the ‘MSG_OOB’ flag (*note
  5121. Receiving Data::). Ordinary read operations do not read out-of-band
  5122. data; they read only ordinary data.
  5123. When a socket finds that out-of-band data are on their way, it sends
  5124. a ‘SIGURG’ signal to the owner process or process group of the socket.
  5125. You can specify the owner using the ‘F_SETOWN’ command to the ‘fcntl’
  5126. function; see *note Interrupt Input::. You must also establish a
  5127. handler for this signal, as described in *note Signal Handling::, in
  5128. order to take appropriate action such as reading the out-of-band data.
  5129. Alternatively, you can test for pending out-of-band data, or wait
  5130. until there is out-of-band data, using the ‘select’ function; it can
  5131. wait for an exceptional condition on the socket. *Note Waiting for
  5132. I/O::, for more information about ‘select’.
  5133. Notification of out-of-band data (whether with ‘SIGURG’ or with
  5134. ‘select’) indicates that out-of-band data are on the way; the data may
  5135. not actually arrive until later. If you try to read the out-of-band
  5136. data before it arrives, ‘recv’ fails with an ‘EWOULDBLOCK’ error.
  5137. Sending out-of-band data automatically places a "mark" in the stream
  5138. of ordinary data, showing where in the sequence the out-of-band data
  5139. "would have been". This is useful when the meaning of out-of-band data
  5140. is "cancel everything sent so far". Here is how you can test, in the
  5141. receiving process, whether any ordinary data was sent before the mark:
  5142. success = ioctl (socket, SIOCATMARK, &atmark);
  5143. The ‘integer’ variable ATMARK is set to a nonzero value if the
  5144. socket's read pointer has reached the "mark".
  5145. Here's a function to discard any ordinary data preceding the
  5146. out-of-band mark:
  5147. int
  5148. discard_until_mark (int socket)
  5149. {
  5150. while (1)
  5151. {
  5152. /* This is not an arbitrary limit; any size will do. */
  5153. char buffer[1024];
  5154. int atmark, success;
  5155. /* If we have reached the mark, return. */
  5156. success = ioctl (socket, SIOCATMARK, &atmark);
  5157. if (success < 0)
  5158. perror ("ioctl");
  5159. if (atmark)
  5160. return;
  5161. /* Otherwise, read a bunch of ordinary data and discard it.
  5162. This is guaranteed not to read past the mark
  5163. if it starts before the mark. */
  5164. success = read (socket, buffer, sizeof buffer);
  5165. if (success < 0)
  5166. perror ("read");
  5167. }
  5168. }
  5169. If you don't want to discard the ordinary data preceding the mark,
  5170. you may need to read some of it anyway, to make room in internal system
  5171. buffers for the out-of-band data. If you try to read out-of-band data
  5172. and get an ‘EWOULDBLOCK’ error, try reading some ordinary data (saving
  5173. it so that you can use it when you want it) and see if that makes room.
  5174. Here is an example:
  5175. struct buffer
  5176. {
  5177. char *buf;
  5178. int size;
  5179. struct buffer *next;
  5180. };
  5181. /* Read the out-of-band data from SOCKET and return it
  5182. as a 'struct buffer', which records the address of the data
  5183. and its size.
  5184. It may be necessary to read some ordinary data
  5185. in order to make room for the out-of-band data.
  5186. If so, the ordinary data are saved as a chain of buffers
  5187. found in the 'next' field of the value. */
  5188. struct buffer *
  5189. read_oob (int socket)
  5190. {
  5191. struct buffer *tail = 0;
  5192. struct buffer *list = 0;
  5193. while (1)
  5194. {
  5195. /* This is an arbitrary limit.
  5196. Does anyone know how to do this without a limit? */
  5197. #define BUF_SZ 1024
  5198. char *buf = (char *) xmalloc (BUF_SZ);
  5199. int success;
  5200. int atmark;
  5201. /* Try again to read the out-of-band data. */
  5202. success = recv (socket, buf, BUF_SZ, MSG_OOB);
  5203. if (success >= 0)
  5204. {
  5205. /* We got it, so return it. */
  5206. struct buffer *link
  5207. = (struct buffer *) xmalloc (sizeof (struct buffer));
  5208. link->buf = buf;
  5209. link->size = success;
  5210. link->next = list;
  5211. return link;
  5212. }
  5213. /* If we fail, see if we are at the mark. */
  5214. success = ioctl (socket, SIOCATMARK, &atmark);
  5215. if (success < 0)
  5216. perror ("ioctl");
  5217. if (atmark)
  5218. {
  5219. /* At the mark; skipping past more ordinary data cannot help.
  5220. So just wait a while. */
  5221. sleep (1);
  5222. continue;
  5223. }
  5224. /* Otherwise, read a bunch of ordinary data and save it.
  5225. This is guaranteed not to read past the mark
  5226. if it starts before the mark. */
  5227. success = read (socket, buf, BUF_SZ);
  5228. if (success < 0)
  5229. perror ("read");
  5230. /* Save this data in the buffer list. */
  5231. {
  5232. struct buffer *link
  5233. = (struct buffer *) xmalloc (sizeof (struct buffer));
  5234. link->buf = buf;
  5235. link->size = success;
  5236. /* Add the new link to the end of the list. */
  5237. if (tail)
  5238. tail->next = link;
  5239. else
  5240. list = link;
  5241. tail = link;
  5242. }
  5243. }
  5244. }
  5245. 
  5246. File: libc.info, Node: Datagrams, Next: Inetd, Prev: Connections, Up: Sockets
  5247. 16.10 Datagram Socket Operations
  5248. ================================
  5249. This section describes how to use communication styles that don't use
  5250. connections (styles ‘SOCK_DGRAM’ and ‘SOCK_RDM’). Using these styles,
  5251. you group data into packets and each packet is an independent
  5252. communication. You specify the destination for each packet
  5253. individually.
  5254. Datagram packets are like letters: you send each one independently
  5255. with its own destination address, and they may arrive in the wrong order
  5256. or not at all.
  5257. The ‘listen’ and ‘accept’ functions are not allowed for sockets using
  5258. connectionless communication styles.
  5259. * Menu:
  5260. * Sending Datagrams:: Sending packets on a datagram socket.
  5261. * Receiving Datagrams:: Receiving packets on a datagram socket.
  5262. * Datagram Example:: An example program: packets sent over a
  5263. datagram socket in the local namespace.
  5264. * Example Receiver:: Another program, that receives those packets.
  5265. 
  5266. File: libc.info, Node: Sending Datagrams, Next: Receiving Datagrams, Up: Datagrams
  5267. 16.10.1 Sending Datagrams
  5268. -------------------------
  5269. The normal way of sending data on a datagram socket is by using the
  5270. ‘sendto’ function, declared in ‘sys/socket.h’.
  5271. You can call ‘connect’ on a datagram socket, but this only specifies
  5272. a default destination for further data transmission on the socket. When
  5273. a socket has a default destination you can use ‘send’ (*note Sending
  5274. Data::) or even ‘write’ (*note I/O Primitives::) to send a packet there.
  5275. You can cancel the default destination by calling ‘connect’ using an
  5276. address format of ‘AF_UNSPEC’ in the ADDR argument. *Note Connecting::,
  5277. for more information about the ‘connect’ function.
  5278. -- Function: ssize_t sendto (int SOCKET, const void *BUFFER, size_t
  5279. SIZE, int FLAGS, struct sockaddr *ADDR, socklen_t LENGTH)
  5280. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5281. Concepts::.
  5282. The ‘sendto’ function transmits the data in the BUFFER through the
  5283. socket SOCKET to the destination address specified by the ADDR and
  5284. LENGTH arguments. The SIZE argument specifies the number of bytes
  5285. to be transmitted.
  5286. The FLAGS are interpreted the same way as for ‘send’; see *note
  5287. Socket Data Options::.
  5288. The return value and error conditions are also the same as for
  5289. ‘send’, but you cannot rely on the system to detect errors and
  5290. report them; the most common error is that the packet is lost or
  5291. there is no-one at the specified address to receive it, and the
  5292. operating system on your machine usually does not know this.
  5293. It is also possible for one call to ‘sendto’ to report an error
  5294. owing to a problem related to a previous call.
  5295. This function is defined as a cancellation point in multi-threaded
  5296. programs, so one has to be prepared for this and make sure that
  5297. allocated resources (like memory, file descriptors, semaphores or
  5298. whatever) are freed even if the thread is canceled.
  5299. 
  5300. File: libc.info, Node: Receiving Datagrams, Next: Datagram Example, Prev: Sending Datagrams, Up: Datagrams
  5301. 16.10.2 Receiving Datagrams
  5302. ---------------------------
  5303. The ‘recvfrom’ function reads a packet from a datagram socket and also
  5304. tells you where it was sent from. This function is declared in
  5305. ‘sys/socket.h’.
  5306. -- Function: ssize_t recvfrom (int SOCKET, void *BUFFER, size_t SIZE,
  5307. int FLAGS, struct sockaddr *ADDR, socklen_t *LENGTH-PTR)
  5308. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5309. Concepts::.
  5310. The ‘recvfrom’ function reads one packet from the socket SOCKET
  5311. into the buffer BUFFER. The SIZE argument specifies the maximum
  5312. number of bytes to be read.
  5313. If the packet is longer than SIZE bytes, then you get the first
  5314. SIZE bytes of the packet and the rest of the packet is lost.
  5315. There's no way to read the rest of the packet. Thus, when you use
  5316. a packet protocol, you must always know how long a packet to
  5317. expect.
  5318. The ADDR and LENGTH-PTR arguments are used to return the address
  5319. where the packet came from. *Note Socket Addresses::. For a
  5320. socket in the local domain the address information won't be
  5321. meaningful, since you can't read the address of such a socket
  5322. (*note Local Namespace::). You can specify a null pointer as the
  5323. ADDR argument if you are not interested in this information.
  5324. The FLAGS are interpreted the same way as for ‘recv’ (*note Socket
  5325. Data Options::). The return value and error conditions are also
  5326. the same as for ‘recv’.
  5327. This function is defined as a cancellation point in multi-threaded
  5328. programs, so one has to be prepared for this and make sure that
  5329. allocated resources (like memory, file descriptors, semaphores or
  5330. whatever) are freed even if the thread is canceled.
  5331. You can use plain ‘recv’ (*note Receiving Data::) instead of
  5332. ‘recvfrom’ if you don't need to find out who sent the packet (either
  5333. because you know where it should come from or because you treat all
  5334. possible senders alike). Even ‘read’ can be used if you don't want to
  5335. specify FLAGS (*note I/O Primitives::).
  5336. If you need more flexibility and/or control over sending and
  5337. receiving packets, see ‘sendmsg’ and ‘recvmsg’ (*note Other Socket
  5338. APIs::).
  5339. 
  5340. File: libc.info, Node: Datagram Example, Next: Example Receiver, Prev: Receiving Datagrams, Up: Datagrams
  5341. 16.10.3 Datagram Socket Example
  5342. -------------------------------
  5343. Here is a set of example programs that send messages over a datagram
  5344. stream in the local namespace. Both the client and server programs use
  5345. the ‘make_named_socket’ function that was presented in *note Local
  5346. Socket Example::, to create and name their sockets.
  5347. First, here is the server program. It sits in a loop waiting for
  5348. messages to arrive, bouncing each message back to the sender. Obviously
  5349. this isn't a particularly useful program, but it does show the general
  5350. ideas involved.
  5351. #include <stdio.h>
  5352. #include <errno.h>
  5353. #include <stdlib.h>
  5354. #include <sys/socket.h>
  5355. #include <sys/un.h>
  5356. #include <unistd.h>
  5357. #define SERVER "/tmp/serversocket"
  5358. #define MAXMSG 512
  5359. int
  5360. main (void)
  5361. {
  5362. int sock;
  5363. char message[MAXMSG];
  5364. struct sockaddr_un name;
  5365. socklen_t size;
  5366. int nbytes;
  5367. /* Remove the filename first, it's ok if the call fails */
  5368. unlink (SERVER);
  5369. /* Make the socket, then loop endlessly. */
  5370. sock = make_named_socket (SERVER);
  5371. while (1)
  5372. {
  5373. /* Wait for a datagram. */
  5374. size = sizeof (name);
  5375. nbytes = recvfrom (sock, message, MAXMSG, 0,
  5376. (struct sockaddr *) & name, &size);
  5377. if (nbytes < 0)
  5378. {
  5379. perror ("recfrom (server)");
  5380. exit (EXIT_FAILURE);
  5381. }
  5382. /* Give a diagnostic message. */
  5383. fprintf (stderr, "Server: got message: %s\n", message);
  5384. /* Bounce the message back to the sender. */
  5385. nbytes = sendto (sock, message, nbytes, 0,
  5386. (struct sockaddr *) & name, size);
  5387. if (nbytes < 0)
  5388. {
  5389. perror ("sendto (server)");
  5390. exit (EXIT_FAILURE);
  5391. }
  5392. }
  5393. }
  5394. 
  5395. File: libc.info, Node: Example Receiver, Prev: Datagram Example, Up: Datagrams
  5396. 16.10.4 Example of Reading Datagrams
  5397. ------------------------------------
  5398. Here is the client program corresponding to the server above.
  5399. It sends a datagram to the server and then waits for a reply. Notice
  5400. that the socket for the client (as well as for the server) in this
  5401. example has to be given a name. This is so that the server can direct a
  5402. message back to the client. Since the socket has no associated
  5403. connection state, the only way the server can do this is by referencing
  5404. the name of the client.
  5405. #include <stdio.h>
  5406. #include <errno.h>
  5407. #include <unistd.h>
  5408. #include <stdlib.h>
  5409. #include <sys/socket.h>
  5410. #include <sys/un.h>
  5411. #define SERVER "/tmp/serversocket"
  5412. #define CLIENT "/tmp/mysocket"
  5413. #define MAXMSG 512
  5414. #define MESSAGE "Yow!!! Are we having fun yet?!?"
  5415. int
  5416. main (void)
  5417. {
  5418. extern int make_named_socket (const char *name);
  5419. int sock;
  5420. char message[MAXMSG];
  5421. struct sockaddr_un name;
  5422. size_t size;
  5423. int nbytes;
  5424. /* Make the socket. */
  5425. sock = make_named_socket (CLIENT);
  5426. /* Initialize the server socket address. */
  5427. name.sun_family = AF_LOCAL;
  5428. strcpy (name.sun_path, SERVER);
  5429. size = strlen (name.sun_path) + sizeof (name.sun_family);
  5430. /* Send the datagram. */
  5431. nbytes = sendto (sock, MESSAGE, strlen (MESSAGE) + 1, 0,
  5432. (struct sockaddr *) & name, size);
  5433. if (nbytes < 0)
  5434. {
  5435. perror ("sendto (client)");
  5436. exit (EXIT_FAILURE);
  5437. }
  5438. /* Wait for a reply. */
  5439. nbytes = recvfrom (sock, message, MAXMSG, 0, NULL, 0);
  5440. if (nbytes < 0)
  5441. {
  5442. perror ("recfrom (client)");
  5443. exit (EXIT_FAILURE);
  5444. }
  5445. /* Print a diagnostic message. */
  5446. fprintf (stderr, "Client: got message: %s\n", message);
  5447. /* Clean up. */
  5448. remove (CLIENT);
  5449. close (sock);
  5450. }
  5451. Keep in mind that datagram socket communications are unreliable. In
  5452. this example, the client program waits indefinitely if the message never
  5453. reaches the server or if the server's response never comes back. It's
  5454. up to the user running the program to kill and restart it if desired. A
  5455. more automatic solution could be to use ‘select’ (*note Waiting for
  5456. I/O::) to establish a timeout period for the reply, and in case of
  5457. timeout either re-send the message or shut down the socket and exit.
  5458. 
  5459. File: libc.info, Node: Inetd, Next: Socket Options, Prev: Datagrams, Up: Sockets
  5460. 16.11 The ‘inetd’ Daemon
  5461. ========================
  5462. We've explained above how to write a server program that does its own
  5463. listening. Such a server must already be running in order for anyone to
  5464. connect to it.
  5465. Another way to provide a service on an Internet port is to let the
  5466. daemon program ‘inetd’ do the listening. ‘inetd’ is a program that runs
  5467. all the time and waits (using ‘select’) for messages on a specified set
  5468. of ports. When it receives a message, it accepts the connection (if the
  5469. socket style calls for connections) and then forks a child process to
  5470. run the corresponding server program. You specify the ports and their
  5471. programs in the file ‘/etc/inetd.conf’.
  5472. * Menu:
  5473. * Inetd Servers::
  5474. * Configuring Inetd::
  5475. 
  5476. File: libc.info, Node: Inetd Servers, Next: Configuring Inetd, Up: Inetd
  5477. 16.11.1 ‘inetd’ Servers
  5478. -----------------------
  5479. Writing a server program to be run by ‘inetd’ is very simple. Each time
  5480. someone requests a connection to the appropriate port, a new server
  5481. process starts. The connection already exists at this time; the socket
  5482. is available as the standard input descriptor and as the standard output
  5483. descriptor (descriptors 0 and 1) in the server process. Thus the server
  5484. program can begin reading and writing data right away. Often the
  5485. program needs only the ordinary I/O facilities; in fact, a
  5486. general-purpose filter program that knows nothing about sockets can work
  5487. as a byte stream server run by ‘inetd’.
  5488. You can also use ‘inetd’ for servers that use connectionless
  5489. communication styles. For these servers, ‘inetd’ does not try to accept
  5490. a connection since no connection is possible. It just starts the server
  5491. program, which can read the incoming datagram packet from descriptor 0.
  5492. The server program can handle one request and then exit, or you can
  5493. choose to write it to keep reading more requests until no more arrive,
  5494. and then exit. You must specify which of these two techniques the
  5495. server uses when you configure ‘inetd’.
  5496. 
  5497. File: libc.info, Node: Configuring Inetd, Prev: Inetd Servers, Up: Inetd
  5498. 16.11.2 Configuring ‘inetd’
  5499. ---------------------------
  5500. The file ‘/etc/inetd.conf’ tells ‘inetd’ which ports to listen to and
  5501. what server programs to run for them. Normally each entry in the file
  5502. is one line, but you can split it onto multiple lines provided all but
  5503. the first line of the entry start with whitespace. Lines that start
  5504. with ‘#’ are comments.
  5505. Here are two standard entries in ‘/etc/inetd.conf’:
  5506. ftp stream tcp nowait root /libexec/ftpd ftpd
  5507. talk dgram udp wait root /libexec/talkd talkd
  5508. An entry has this format:
  5509. SERVICE STYLE PROTOCOL WAIT USERNAME PROGRAM ARGUMENTS
  5510. The SERVICE field says which service this program provides. It
  5511. should be the name of a service defined in ‘/etc/services’. ‘inetd’
  5512. uses SERVICE to decide which port to listen on for this entry.
  5513. The fields STYLE and PROTOCOL specify the communication style and the
  5514. protocol to use for the listening socket. The style should be the name
  5515. of a communication style, converted to lower case and with ‘SOCK_’
  5516. deleted--for example, ‘stream’ or ‘dgram’. PROTOCOL should be one of
  5517. the protocols listed in ‘/etc/protocols’. The typical protocol names
  5518. are ‘tcp’ for byte stream connections and ‘udp’ for unreliable
  5519. datagrams.
  5520. The WAIT field should be either ‘wait’ or ‘nowait’. Use ‘wait’ if
  5521. STYLE is a connectionless style and the server, once started, handles
  5522. multiple requests as they come in. Use ‘nowait’ if ‘inetd’ should start
  5523. a new process for each message or request that comes in. If STYLE uses
  5524. connections, then WAIT *must* be ‘nowait’.
  5525. USER is the user name that the server should run as. ‘inetd’ runs as
  5526. root, so it can set the user ID of its children arbitrarily. It's best
  5527. to avoid using ‘root’ for USER if you can; but some servers, such as
  5528. Telnet and FTP, read a username and passphrase themselves. These
  5529. servers need to be root initially so they can log in as commanded by the
  5530. data coming over the network.
  5531. PROGRAM together with ARGUMENTS specifies the command to run to start
  5532. the server. PROGRAM should be an absolute file name specifying the
  5533. executable file to run. ARGUMENTS consists of any number of
  5534. whitespace-separated words, which become the command-line arguments of
  5535. PROGRAM. The first word in ARGUMENTS is argument zero, which should by
  5536. convention be the program name itself (sans directories).
  5537. If you edit ‘/etc/inetd.conf’, you can tell ‘inetd’ to reread the
  5538. file and obey its new contents by sending the ‘inetd’ process the
  5539. ‘SIGHUP’ signal. You'll have to use ‘ps’ to determine the process ID of
  5540. the ‘inetd’ process as it is not fixed.
  5541. 
  5542. File: libc.info, Node: Socket Options, Next: Networks Database, Prev: Inetd, Up: Sockets
  5543. 16.12 Socket Options
  5544. ====================
  5545. This section describes how to read or set various options that modify
  5546. the behavior of sockets and their underlying communications protocols.
  5547. When you are manipulating a socket option, you must specify which
  5548. “level” the option pertains to. This describes whether the option
  5549. applies to the socket interface, or to a lower-level communications
  5550. protocol interface.
  5551. * Menu:
  5552. * Socket Option Functions:: The basic functions for setting and getting
  5553. socket options.
  5554. * Socket-Level Options:: Details of the options at the socket level.
  5555. 
  5556. File: libc.info, Node: Socket Option Functions, Next: Socket-Level Options, Up: Socket Options
  5557. 16.12.1 Socket Option Functions
  5558. -------------------------------
  5559. Here are the functions for examining and modifying socket options. They
  5560. are declared in ‘sys/socket.h’.
  5561. -- Function: int getsockopt (int SOCKET, int LEVEL, int OPTNAME, void
  5562. *OPTVAL, socklen_t *OPTLEN-PTR)
  5563. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5564. Concepts::.
  5565. The ‘getsockopt’ function gets information about the value of
  5566. option OPTNAME at level LEVEL for socket SOCKET.
  5567. The option value is stored in the buffer that OPTVAL points to.
  5568. Before the call, you should supply in ‘*OPTLEN-PTR’ the size of
  5569. this buffer; on return, it contains the number of bytes of
  5570. information actually stored in the buffer.
  5571. Most options interpret the OPTVAL buffer as a single ‘int’ value.
  5572. The actual return value of ‘getsockopt’ is ‘0’ on success and ‘-1’
  5573. on failure. The following ‘errno’ error conditions are defined:
  5574. ‘EBADF’
  5575. The SOCKET argument is not a valid file descriptor.
  5576. ‘ENOTSOCK’
  5577. The descriptor SOCKET is not a socket.
  5578. ‘ENOPROTOOPT’
  5579. The OPTNAME doesn't make sense for the given LEVEL.
  5580. -- Function: int setsockopt (int SOCKET, int LEVEL, int OPTNAME, const
  5581. void *OPTVAL, socklen_t OPTLEN)
  5582. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5583. Concepts::.
  5584. This function is used to set the socket option OPTNAME at level
  5585. LEVEL for socket SOCKET. The value of the option is passed in the
  5586. buffer OPTVAL of size OPTLEN.
  5587. The return value and error codes for ‘setsockopt’ are the same as
  5588. for ‘getsockopt’.
  5589. 
  5590. File: libc.info, Node: Socket-Level Options, Prev: Socket Option Functions, Up: Socket Options
  5591. 16.12.2 Socket-Level Options
  5592. ----------------------------
  5593. -- Constant: int SOL_SOCKET
  5594. Use this constant as the LEVEL argument to ‘getsockopt’ or
  5595. ‘setsockopt’ to manipulate the socket-level options described in
  5596. this section.
  5597. Here is a table of socket-level option names; all are defined in the
  5598. header file ‘sys/socket.h’.
  5599. ‘SO_DEBUG’
  5600. This option toggles recording of debugging information in the
  5601. underlying protocol modules. The value has type ‘int’; a nonzero
  5602. value means "yes".
  5603. ‘SO_REUSEADDR’
  5604. This option controls whether ‘bind’ (*note Setting Address::)
  5605. should permit reuse of local addresses for this socket. If you
  5606. enable this option, you can actually have two sockets with the same
  5607. Internet port number; but the system won't allow you to use the two
  5608. identically-named sockets in a way that would confuse the Internet.
  5609. The reason for this option is that some higher-level Internet
  5610. protocols, including FTP, require you to keep reusing the same port
  5611. number.
  5612. The value has type ‘int’; a nonzero value means "yes".
  5613. ‘SO_KEEPALIVE’
  5614. This option controls whether the underlying protocol should
  5615. periodically transmit messages on a connected socket. If the peer
  5616. fails to respond to these messages, the connection is considered
  5617. broken. The value has type ‘int’; a nonzero value means "yes".
  5618. ‘SO_DONTROUTE’
  5619. This option controls whether outgoing messages bypass the normal
  5620. message routing facilities. If set, messages are sent directly to
  5621. the network interface instead. The value has type ‘int’; a nonzero
  5622. value means "yes".
  5623. ‘SO_LINGER’
  5624. This option specifies what should happen when the socket of a type
  5625. that promises reliable delivery still has untransmitted messages
  5626. when it is closed; see *note Closing a Socket::. The value has
  5627. type ‘struct linger’.
  5628. -- Data Type: struct linger
  5629. This structure type has the following members:
  5630. ‘int l_onoff’
  5631. This field is interpreted as a boolean. If nonzero,
  5632. ‘close’ blocks until the data are transmitted or the
  5633. timeout period has expired.
  5634. ‘int l_linger’
  5635. This specifies the timeout period, in seconds.
  5636. ‘SO_BROADCAST’
  5637. This option controls whether datagrams may be broadcast from the
  5638. socket. The value has type ‘int’; a nonzero value means "yes".
  5639. ‘SO_OOBINLINE’
  5640. If this option is set, out-of-band data received on the socket is
  5641. placed in the normal input queue. This permits it to be read using
  5642. ‘read’ or ‘recv’ without specifying the ‘MSG_OOB’ flag. *Note
  5643. Out-of-Band Data::. The value has type ‘int’; a nonzero value
  5644. means "yes".
  5645. ‘SO_SNDBUF’
  5646. This option gets or sets the size of the output buffer. The value
  5647. is a ‘size_t’, which is the size in bytes.
  5648. ‘SO_RCVBUF’
  5649. This option gets or sets the size of the input buffer. The value
  5650. is a ‘size_t’, which is the size in bytes.
  5651. ‘SO_STYLE’
  5652. ‘SO_TYPE’
  5653. This option can be used with ‘getsockopt’ only. It is used to get
  5654. the socket's communication style. ‘SO_TYPE’ is the historical
  5655. name, and ‘SO_STYLE’ is the preferred name in GNU. The value has
  5656. type ‘int’ and its value designates a communication style; see
  5657. *note Communication Styles::.
  5658. ‘SO_ERROR’
  5659. This option can be used with ‘getsockopt’ only. It is used to
  5660. reset the error status of the socket. The value is an ‘int’, which
  5661. represents the previous error status.
  5662. 
  5663. File: libc.info, Node: Networks Database, Next: Other Socket APIs, Prev: Socket Options, Up: Sockets
  5664. 16.13 Networks Database
  5665. =======================
  5666. Many systems come with a database that records a list of networks known
  5667. to the system developer. This is usually kept either in the file
  5668. ‘/etc/networks’ or in an equivalent from a name server. This data base
  5669. is useful for routing programs such as ‘route’, but it is not useful for
  5670. programs that simply communicate over the network. We provide functions
  5671. to access this database, which are declared in ‘netdb.h’.
  5672. -- Data Type: struct netent
  5673. This data type is used to represent information about entries in
  5674. the networks database. It has the following members:
  5675. ‘char *n_name’
  5676. This is the "official" name of the network.
  5677. ‘char **n_aliases’
  5678. These are alternative names for the network, represented as a
  5679. vector of strings. A null pointer terminates the array.
  5680. ‘int n_addrtype’
  5681. This is the type of the network number; this is always equal
  5682. to ‘AF_INET’ for Internet networks.
  5683. ‘unsigned long int n_net’
  5684. This is the network number. Network numbers are returned in
  5685. host byte order; see *note Byte Order::.
  5686. Use the ‘getnetbyname’ or ‘getnetbyaddr’ functions to search the
  5687. networks database for information about a specific network. The
  5688. information is returned in a statically-allocated structure; you must
  5689. copy the information if you need to save it.
  5690. -- Function: struct netent * getnetbyname (const char *NAME)
  5691. Preliminary: | MT-Unsafe race:netbyname env locale | AS-Unsafe
  5692. dlopen plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note
  5693. POSIX Safety Concepts::.
  5694. The ‘getnetbyname’ function returns information about the network
  5695. named NAME. It returns a null pointer if there is no such network.
  5696. -- Function: struct netent * getnetbyaddr (uint32_t NET, int TYPE)
  5697. Preliminary: | MT-Unsafe race:netbyaddr locale | AS-Unsafe dlopen
  5698. plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note POSIX
  5699. Safety Concepts::.
  5700. The ‘getnetbyaddr’ function returns information about the network
  5701. of type TYPE with number NET. You should specify a value of
  5702. ‘AF_INET’ for the TYPE argument for Internet networks.
  5703. ‘getnetbyaddr’ returns a null pointer if there is no such network.
  5704. You can also scan the networks database using ‘setnetent’,
  5705. ‘getnetent’ and ‘endnetent’. Be careful when using these functions
  5706. because they are not reentrant.
  5707. -- Function: void setnetent (int STAYOPEN)
  5708. Preliminary: | MT-Unsafe race:netent env locale | AS-Unsafe dlopen
  5709. plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note POSIX
  5710. Safety Concepts::.
  5711. This function opens and rewinds the networks database.
  5712. If the STAYOPEN argument is nonzero, this sets a flag so that
  5713. subsequent calls to ‘getnetbyname’ or ‘getnetbyaddr’ will not close
  5714. the database (as they usually would). This makes for more
  5715. efficiency if you call those functions several times, by avoiding
  5716. reopening the database for each call.
  5717. -- Function: struct netent * getnetent (void)
  5718. Preliminary: | MT-Unsafe race:netent race:netentbuf env locale |
  5719. AS-Unsafe dlopen plugin heap lock | AC-Unsafe corrupt lock fd mem |
  5720. *Note POSIX Safety Concepts::.
  5721. This function returns the next entry in the networks database. It
  5722. returns a null pointer if there are no more entries.
  5723. -- Function: void endnetent (void)
  5724. Preliminary: | MT-Unsafe race:netent env locale | AS-Unsafe dlopen
  5725. plugin heap lock | AC-Unsafe corrupt lock fd mem | *Note POSIX
  5726. Safety Concepts::.
  5727. This function closes the networks database.
  5728. 
  5729. File: libc.info, Node: Other Socket APIs, Prev: Networks Database, Up: Sockets
  5730. 16.14 Other Socket APIs
  5731. =======================
  5732. -- Data Type: struct msghdr
  5733. -- Function: ssize_t sendmsg (int SOCKET, const struct msghdr *MESSAGE,
  5734. int FLAGS)
  5735. This documentation is a stub. For additional information on this
  5736. function, consult the manual page sendmsg(2) (Latest, online:
  5737. <https://man7.org/linux/man-pages/man2/sendmsg.2.html>) *Note Linux
  5738. Kernel::.
  5739. -- Function: ssize_t recvmsg (int SOCKET, struct msghdr *MESSAGE, int
  5740. FLAGS)
  5741. This documentation is a stub. For additional information on this
  5742. function, consult the manual page recvmsg(2) (Latest, online:
  5743. <https://man7.org/linux/man-pages/man2/recvmsg.2.html>) *Note Linux
  5744. Kernel::.
  5745. 
  5746. File: libc.info, Node: Low-Level Terminal Interface, Next: Syslog, Prev: Sockets, Up: Top
  5747. 17 Low-Level Terminal Interface
  5748. *******************************
  5749. This chapter describes functions that are specific to terminal devices.
  5750. You can use these functions to do things like turn off input echoing;
  5751. set serial line characteristics such as line speed and flow control; and
  5752. change which characters are used for end-of-file, command-line editing,
  5753. sending signals, and similar control functions.
  5754. Most of the functions in this chapter operate on file descriptors.
  5755. *Note Low-Level I/O::, for more information about what a file descriptor
  5756. is and how to open a file descriptor for a terminal device.
  5757. * Menu:
  5758. * Terminal Device Model:: The fundamental concepts of a terminal device
  5759. * Is It a Terminal:: How to determine if a file is a terminal
  5760. device, and what its name is.
  5761. * I/O Queues:: About flow control and typeahead.
  5762. * Canonical or Not:: Two basic styles of input processing.
  5763. * Terminal Modes:: How to examine and modify flags controlling
  5764. details of terminal I/O: echoing,
  5765. signals, editing. Posix.
  5766. * BSD Terminal Modes:: BSD compatible terminal mode setting
  5767. * Line Control:: Sending break sequences, clearing
  5768. terminal buffers ...
  5769. * Noncanon Example:: How to read single characters without echo.
  5770. * getpass:: Prompting the user for a passphrase.
  5771. * Pseudo-Terminals:: How to open a pseudo-terminal.
  5772. 
  5773. File: libc.info, Node: Terminal Device Model, Next: Is It a Terminal, Up: Low-Level Terminal Interface
  5774. 17.1 Terminal Device Model
  5775. ==========================
  5776. A “terminal device”, abbreviated ‘tty’ (for “teletype”), is a character
  5777. device which implements a set of functionality appropriate for
  5778. communications devices, and which can host an interactive login session.
  5779. Conceptually, a terminal device implements an RS232 asynchronous serial
  5780. interface, but the actual hardware implementation may be entirely
  5781. different, or it may be entirely virtual, notably *note
  5782. Pseudo-Terminals::.
  5783. For a true conventional asynchronous serial port, such as RS232/V.24,
  5784. RS422/V.11, RS423, or RS485, the functionality is generally as
  5785. described, whereas for other devices, the meaning of serial port
  5786. specific functionality such as modem control signals, BREAK, and line
  5787. speed is device specific.
  5788. The rest of this section is described in terms of a physical RS232
  5789. interface.
  5790. The RS232 specification assumes the host (Data Terminal Equipment,
  5791. DTE) connects to a modem (Data Communications Equipment, DCE),
  5792. regardless of if a physical modem is present or not.
  5793. In addition to the serial data, the DTE provides a set of control
  5794. signals to the DCE, and the DCE a set of status signals to the DTE. The
  5795. full RS232 and V.24 specifications provide a large number of signals,
  5796. but the ones that are typically implemented in contemporary hardware and
  5797. are relevant to the terminal device interface are:
  5798. DTR - Data Terminal Ready (control)
  5799. If asserted (true), the DTE is ready to accept/continue an incoming
  5800. communications session. If deasserted (false), this is a “modem
  5801. disconnect request” to the DCE. The DCE may, but is not required
  5802. to, trigger a modem disconnect in response.
  5803. RTS - Request To Send (control)
  5804. This signal is also referred to as Ready To Receive (RTR).
  5805. If asserted, the DTE is ready to accept data. If deasserted, the
  5806. DCE is requested to hold data temporarily without disconnecting.
  5807. This is known as hardware or RTS/CTS “flow control” and can be
  5808. handled automatically if the appropriate terminal mode flags are
  5809. set.
  5810. DSR - Data Set Ready (status)
  5811. If asserted, the DCE is ready to communicate, but may or may not
  5812. have a connection to a remote peer.
  5813. DCD - Data Carrier Detect (status)
  5814. If asserted, the DCE has a connection to the remote peer. If
  5815. deasserted, this is a “modem disconnect” signal to the DTE. A modem
  5816. disconnect may be triggered in response to the DTR control signal
  5817. being deasserted, or it may be caused by an external event.
  5818. CTS - Clear To Send (status)
  5819. If asserted, the DCE is ready to accept data. If deasserted, the
  5820. DTE is requested to hold data temporarily but should not interpret
  5821. it as a disconnect. This is the DCE to DTE part of RTS/CTS flow
  5822. control.
  5823. RI - Ring Indicator (status)
  5824. If asserted, this indicates that a remote peer is requesting to
  5825. connect ("the phone is ringing"). Depending on how the DCE is
  5826. configured, the DTE may need to assert the DTR control signal
  5827. before the DCE will accept the incoming connection.
  5828. 
  5829. File: libc.info, Node: Is It a Terminal, Next: I/O Queues, Prev: Terminal Device Model, Up: Low-Level Terminal Interface
  5830. 17.2 Identifying Terminals
  5831. ==========================
  5832. The functions described in this chapter only work on files that
  5833. correspond to terminal devices. You can find out whether a file
  5834. descriptor is associated with a terminal by using the ‘isatty’ function.
  5835. Prototypes for the functions in this section are declared in the
  5836. header file ‘unistd.h’.
  5837. -- Function: int isatty (int FILEDES)
  5838. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5839. Concepts::.
  5840. This function returns ‘1’ if FILEDES is a file descriptor
  5841. associated with an open terminal device, and 0 otherwise.
  5842. If a file descriptor is associated with a terminal, you can get its
  5843. associated file name using the ‘ttyname’ function. See also the
  5844. ‘ctermid’ function, described in *note Identifying the Terminal::.
  5845. -- Function: char * ttyname (int FILEDES)
  5846. Preliminary: | MT-Unsafe race:ttyname | AS-Unsafe heap lock |
  5847. AC-Unsafe lock fd mem | *Note POSIX Safety Concepts::.
  5848. If the file descriptor FILEDES is associated with a terminal
  5849. device, the ‘ttyname’ function returns a pointer to a
  5850. statically-allocated, null-terminated string containing the file
  5851. name of the terminal file. The value is a null pointer if the file
  5852. descriptor isn't associated with a terminal, or the file name
  5853. cannot be determined.
  5854. -- Function: int ttyname_r (int FILEDES, char *BUF, size_t LEN)
  5855. Preliminary: | MT-Safe | AS-Unsafe heap | AC-Unsafe mem fd | *Note
  5856. POSIX Safety Concepts::.
  5857. The ‘ttyname_r’ function is similar to the ‘ttyname’ function
  5858. except that it places its result into the user-specified buffer
  5859. starting at BUF with length LEN.
  5860. The normal return value from ‘ttyname_r’ is 0. Otherwise an error
  5861. number is returned to indicate the error. The following ‘errno’
  5862. error conditions are defined for this function:
  5863. ‘EBADF’
  5864. The FILEDES argument is not a valid file descriptor.
  5865. ‘ENOTTY’
  5866. The FILEDES is not associated with a terminal.
  5867. ‘ERANGE’
  5868. The buffer length LEN is too small to store the string to be
  5869. returned.
  5870. ‘ENODEV’
  5871. The FILEDES is associated with a terminal device that is a
  5872. slave pseudo-terminal, but the file name associated with that
  5873. device could not be determined. This is a GNU extension.
  5874. 
  5875. File: libc.info, Node: I/O Queues, Next: Canonical or Not, Prev: Is It a Terminal, Up: Low-Level Terminal Interface
  5876. 17.3 I/O Queues
  5877. ===============
  5878. Many of the remaining functions in this section refer to the input and
  5879. output queues of a terminal device. These queues implement a form of
  5880. buffering _within the kernel_ independent of the buffering implemented
  5881. by I/O streams (*note I/O on Streams::).
  5882. The “terminal input queue” is also sometimes referred to as its
  5883. “typeahead buffer”. It holds the characters that have been received
  5884. from the terminal but not yet read by any process.
  5885. The size of the input queue is described by the ‘MAX_INPUT’ and
  5886. ‘_POSIX_MAX_INPUT’ parameters; see *note Limits for Files::. You are
  5887. guaranteed a queue size of at least ‘MAX_INPUT’, but the queue might be
  5888. larger, and might even dynamically change size. If input flow control
  5889. is enabled by setting the ‘IXOFF’ input mode bit (*note Input Modes::),
  5890. the terminal driver transmits STOP and START characters to the terminal
  5891. when necessary to prevent the queue from overflowing. Otherwise, input
  5892. may be lost if it comes in too fast from the terminal. In canonical
  5893. mode, all input stays in the queue until a newline character is
  5894. received, so the terminal input queue can fill up when you type a very
  5895. long line. *Note Canonical or Not::.
  5896. The “terminal output queue” is like the input queue, but for output;
  5897. it contains characters that have been written by processes, but not yet
  5898. transmitted to the terminal. If output flow control is enabled by
  5899. setting the ‘IXON’ input mode bit (*note Input Modes::), the terminal
  5900. driver obeys START and STOP characters sent by the terminal to stop and
  5901. restart transmission of output.
  5902. “Clearing” the terminal input queue means discarding any characters
  5903. that have been received but not yet read. Similarly, clearing the
  5904. terminal output queue means discarding any characters that have been
  5905. written but not yet transmitted.
  5906. 
  5907. File: libc.info, Node: Canonical or Not, Next: Terminal Modes, Prev: I/O Queues, Up: Low-Level Terminal Interface
  5908. 17.4 Two Styles of Input: Canonical or Not
  5909. ==========================================
  5910. POSIX systems support two basic modes of input: canonical and
  5911. noncanonical.
  5912. In “canonical input processing” mode, terminal input is processed in
  5913. lines terminated by newline (‘'\n'’), EOF, or EOL characters. No input
  5914. can be read until an entire line has been typed by the user, and the
  5915. ‘read’ function (*note I/O Primitives::) returns at most a single line
  5916. of input, no matter how many bytes are requested.
  5917. In canonical input mode, the operating system provides input editing
  5918. facilities: some characters are interpreted specially to perform editing
  5919. operations within the current line of text, such as ERASE and KILL.
  5920. *Note Editing Characters::.
  5921. The constants ‘_POSIX_MAX_CANON’ and ‘MAX_CANON’ parameterize the
  5922. maximum number of bytes which may appear in a single line of canonical
  5923. input. *Note Limits for Files::. You are guaranteed a maximum line
  5924. length of at least ‘MAX_CANON’ bytes, but the maximum might be larger,
  5925. and might even dynamically change size.
  5926. In “noncanonical input processing” mode, characters are not grouped
  5927. into lines, and ERASE and KILL processing is not performed. The
  5928. granularity with which bytes are read in noncanonical input mode is
  5929. controlled by the MIN and TIME settings. *Note Noncanonical Input::.
  5930. Most programs use canonical input mode, because this gives the user a
  5931. way to edit input line by line. The usual reason to use noncanonical
  5932. mode is when the program accepts single-character commands or provides
  5933. its own editing facilities.
  5934. The choice of canonical or noncanonical input is controlled by the
  5935. ‘ICANON’ flag in the ‘c_lflag’ member of ‘struct termios’. *Note Local
  5936. Modes::.
  5937. 
  5938. File: libc.info, Node: Terminal Modes, Next: BSD Terminal Modes, Prev: Canonical or Not, Up: Low-Level Terminal Interface
  5939. 17.5 Terminal Modes
  5940. ===================
  5941. This section describes the various terminal attributes that control how
  5942. input and output are done. The functions, data structures, and symbolic
  5943. constants are all declared in the header file ‘termios.h’.
  5944. Don't confuse terminal attributes with file attributes. A device
  5945. special file which is associated with a terminal has file attributes as
  5946. described in *note File Attributes::. These are unrelated to the
  5947. attributes of the terminal device itself, which are discussed in this
  5948. section.
  5949. * Menu:
  5950. * Mode Data Types:: The data type ‘struct termios’ and
  5951. related types.
  5952. * Mode Functions:: Functions to read and set the terminal
  5953. attributes.
  5954. * Setting Modes:: The right way to set terminal attributes
  5955. reliably.
  5956. * Input Modes:: Flags controlling low-level input handling.
  5957. * Output Modes:: Flags controlling low-level output handling.
  5958. * Control Modes:: Flags controlling serial port behavior.
  5959. * Local Modes:: Flags controlling high-level input handling.
  5960. * Line Speed:: How to read and set the terminal line speed.
  5961. * Special Characters:: Characters that have special effects,
  5962. and how to change them.
  5963. * Noncanonical Input:: Controlling how long to wait for input.
  5964. 
  5965. File: libc.info, Node: Mode Data Types, Next: Mode Functions, Up: Terminal Modes
  5966. 17.5.1 Terminal Mode Data Types
  5967. -------------------------------
  5968. The entire collection of attributes of a terminal is stored in a
  5969. structure of type ‘struct termios’. This structure is used with the
  5970. functions ‘tcgetattr’ and ‘tcsetattr’ to read and set the attributes.
  5971. -- Data Type: struct termios
  5972. A ‘struct termios’ records all the I/O attributes of a terminal.
  5973. The structure includes at least the following members:
  5974. ‘tcflag_t c_iflag’
  5975. A bit mask specifying flags for input modes; see *note Input
  5976. Modes::.
  5977. ‘tcflag_t c_oflag’
  5978. A bit mask specifying flags for output modes; see *note Output
  5979. Modes::.
  5980. ‘tcflag_t c_cflag’
  5981. A bit mask specifying flags for control modes; see *note
  5982. Control Modes::.
  5983. ‘tcflag_t c_lflag’
  5984. A bit mask specifying flags for local modes; see *note Local
  5985. Modes::.
  5986. ‘cc_t c_cc[NCCS]’
  5987. An array specifying which characters are associated with
  5988. various control functions; see *note Special Characters::.
  5989. The ‘struct termios’ structure also contains members which encode
  5990. input and output transmission speeds, but the representation is not
  5991. specified. *Note Line Speed::, for how to examine and store the
  5992. speed values.
  5993. The following sections describe the details of the members of the
  5994. ‘struct termios’ structure.
  5995. -- Data Type: tcflag_t
  5996. This is an unsigned integer type used to represent the various bit
  5997. masks for terminal flags.
  5998. -- Data Type: cc_t
  5999. This is an unsigned integer type used to represent characters
  6000. associated with various terminal control functions.
  6001. -- Macro: int NCCS
  6002. The value of this macro is the number of elements in the ‘c_cc’
  6003. array.
  6004. 
  6005. File: libc.info, Node: Mode Functions, Next: Setting Modes, Prev: Mode Data Types, Up: Terminal Modes
  6006. 17.5.2 Terminal Mode Functions
  6007. ------------------------------
  6008. -- Function: int tcgetattr (int FILEDES, struct termios *TERMIOS-P)
  6009. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  6010. Concepts::.
  6011. This function is used to examine the attributes of the terminal
  6012. device with file descriptor FILEDES. The attributes are returned
  6013. in the structure that TERMIOS-P points to.
  6014. If successful, ‘tcgetattr’ returns 0. A return value of -1
  6015. indicates an error. The following ‘errno’ error conditions are
  6016. defined for this function:
  6017. ‘EBADF’
  6018. The FILEDES argument is not a valid file descriptor.
  6019. ‘ENOTTY’
  6020. The FILEDES is not associated with a terminal.
  6021. -- Function: int tcsetattr (int FILEDES, int WHEN, const struct termios
  6022. *TERMIOS-P)
  6023. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  6024. Concepts::.
  6025. This function sets the attributes of the terminal device with file
  6026. descriptor FILEDES. The new attributes are taken from the
  6027. structure that TERMIOS-P points to.
  6028. The WHEN argument specifies how to deal with input and output
  6029. already queued. It can be one of the following values:
  6030. ‘TCSANOW’
  6031. Make the change immediately.
  6032. ‘TCSADRAIN’
  6033. Make the change after waiting until all queued output has been
  6034. written. You should usually use this option when changing
  6035. parameters that affect output.
  6036. ‘TCSAFLUSH’
  6037. This is like ‘TCSADRAIN’, but also discards any queued input.
  6038. ‘TCSASOFT’
  6039. This is a flag bit that you can add to any of the above
  6040. alternatives. Its meaning is to inhibit alteration of the
  6041. state of the terminal hardware. It is a BSD extension; it is
  6042. only supported on BSD systems and GNU/Hurd systems.
  6043. Using ‘TCSASOFT’ is exactly the same as setting the ‘CIGNORE’
  6044. bit in the ‘c_cflag’ member of the structure TERMIOS-P points
  6045. to. *Note Control Modes::, for a description of ‘CIGNORE’.
  6046. If this function is called from a background process on its
  6047. controlling terminal, normally all processes in the process group
  6048. are sent a ‘SIGTTOU’ signal, in the same way as if the process were
  6049. trying to write to the terminal. The exception is if the calling
  6050. process itself is ignoring or blocking ‘SIGTTOU’ signals, in which
  6051. case the operation is performed and no signal is sent. *Note Job
  6052. Control::.
  6053. If successful, ‘tcsetattr’ returns 0. A return value of -1
  6054. indicates an error. The following ‘errno’ error conditions are
  6055. defined for this function:
  6056. ‘EBADF’
  6057. The FILEDES argument is not a valid file descriptor.
  6058. ‘ENOTTY’
  6059. The FILEDES is not associated with a terminal.
  6060. ‘EINVAL’
  6061. Either the value of the ‘when’ argument is not valid, or there
  6062. is something wrong with the data in the TERMIOS-P argument.
  6063. Although ‘tcgetattr’ and ‘tcsetattr’ specify the terminal device with
  6064. a file descriptor, the attributes are those of the terminal device
  6065. itself and not of the file descriptor. This means that the effects of
  6066. changing terminal attributes are persistent; if another process opens
  6067. the terminal file later on, it will see the changed attributes even
  6068. though it doesn't have anything to do with the open file descriptor you
  6069. originally specified in changing the attributes.
  6070. Similarly, if a single process has multiple or duplicated file
  6071. descriptors for the same terminal device, changing the terminal
  6072. attributes affects input and output to all of these file descriptors.
  6073. This means, for example, that you can't open one file descriptor or
  6074. stream to read from a terminal in the normal line-buffered, echoed mode;
  6075. and simultaneously have another file descriptor for the same terminal
  6076. that you use to read from it in single-character, non-echoed mode.
  6077. Instead, you have to explicitly switch the terminal back and forth
  6078. between the two modes.
  6079. 
  6080. File: libc.info, Node: Setting Modes, Next: Input Modes, Prev: Mode Functions, Up: Terminal Modes
  6081. 17.5.3 Setting Terminal Modes Properly
  6082. --------------------------------------
  6083. When you set terminal modes, you should call ‘tcgetattr’ first to get
  6084. the current modes of the particular terminal device, modify only those
  6085. modes that you are really interested in, and store the result with
  6086. ‘tcsetattr’.
  6087. It's a bad idea to simply initialize a ‘struct termios’ structure to
  6088. a chosen set of attributes and pass it directly to ‘tcsetattr’. Your
  6089. program may be run years from now, on systems that support members not
  6090. documented in this manual. The way to avoid setting these members to
  6091. unreasonable values is to avoid changing them.
  6092. What's more, different terminal devices may require different mode
  6093. settings in order to function properly. So you should avoid blindly
  6094. copying attributes from one terminal device to another.
  6095. When a member contains a collection of independent flags, as the
  6096. ‘c_iflag’, ‘c_oflag’ and ‘c_cflag’ members do, even setting the entire
  6097. member is a bad idea, because particular operating systems have their
  6098. own flags. Instead, you should start with the current value of the
  6099. member and alter only the flags whose values matter in your program,
  6100. leaving any other flags unchanged.
  6101. Here is an example of how to set one flag (‘ISTRIP’) in the ‘struct
  6102. termios’ structure while properly preserving all the other data in the
  6103. structure:
  6104. int
  6105. set_istrip (int desc, int value)
  6106. {
  6107. struct termios settings;
  6108. int result;
  6109. result = tcgetattr (desc, &settings);
  6110. if (result < 0)
  6111. {
  6112. perror ("error in tcgetattr");
  6113. return 0;
  6114. }
  6115. settings.c_iflag &= ~ISTRIP;
  6116. if (value)
  6117. settings.c_iflag |= ISTRIP;
  6118. result = tcsetattr (desc, TCSANOW, &settings);
  6119. if (result < 0)
  6120. {
  6121. perror ("error in tcsetattr");
  6122. return 0;
  6123. }
  6124. return 1;
  6125. }
  6126. 
  6127. File: libc.info, Node: Input Modes, Next: Output Modes, Prev: Setting Modes, Up: Terminal Modes
  6128. 17.5.4 Input Modes
  6129. ------------------
  6130. This section describes the terminal attribute flags that control fairly
  6131. low-level aspects of input processing: handling of parity errors, break
  6132. signals, flow control, and <RET> and <LFD> characters.
  6133. All of these flags are bits in the ‘c_iflag’ member of the ‘struct
  6134. termios’ structure. The member is an integer, and you change flags
  6135. using the operators ‘&’, ‘|’ and ‘^’. Don't try to specify the entire
  6136. value for ‘c_iflag’--instead, change only specific flags and leave the
  6137. rest untouched (*note Setting Modes::).
  6138. -- Macro: tcflag_t INPCK
  6139. If this bit is set, input parity checking is enabled. If it is not
  6140. set, no checking at all is done for parity errors on input; the
  6141. characters are simply passed through to the application.
  6142. Parity checking on input processing is independent of whether
  6143. parity detection and generation on the underlying terminal hardware
  6144. is enabled; see *note Control Modes::. For example, you could
  6145. clear the ‘INPCK’ input mode flag and set the ‘PARENB’ control mode
  6146. flag to ignore parity errors on input, but still generate parity on
  6147. output.
  6148. If this bit is set, what happens when a parity error is detected
  6149. depends on whether the ‘IGNPAR’ or ‘PARMRK’ bits are set. If
  6150. neither of these bits are set, a byte with a parity error is passed
  6151. to the application as a ‘'\0'’ character.
  6152. -- Macro: tcflag_t IGNPAR
  6153. If this bit is set, any byte with a framing or parity error is
  6154. ignored. This is only useful if ‘INPCK’ is also set.
  6155. -- Macro: tcflag_t PARMRK
  6156. If this bit is set, input bytes with parity or framing errors are
  6157. marked when passed to the program. This bit is meaningful only
  6158. when ‘INPCK’ is set and ‘IGNPAR’ is not set.
  6159. The way erroneous bytes are marked is with two preceding bytes,
  6160. ‘377’ and ‘0’. Thus, the program actually reads three bytes for
  6161. one erroneous byte received from the terminal.
  6162. If a valid byte has the value ‘0377’, and ‘ISTRIP’ (see below) is
  6163. not set, the program might confuse it with the prefix that marks a
  6164. parity error. So a valid byte ‘0377’ is passed to the program as
  6165. two bytes, ‘0377’ ‘0377’, in this case.
  6166. -- Macro: tcflag_t ISTRIP
  6167. If this bit is set, valid input bytes are stripped to seven bits;
  6168. otherwise, all eight bits are available for programs to read.
  6169. -- Macro: tcflag_t IGNBRK
  6170. If this bit is set, break conditions are ignored.
  6171. A “break condition” is defined in the context of asynchronous
  6172. serial data transmission as a series of zero-value bits longer than
  6173. a single byte.
  6174. -- Macro: tcflag_t BRKINT
  6175. If this bit is set and ‘IGNBRK’ is not set, a break condition
  6176. clears the terminal input and output queues and raises a ‘SIGINT’
  6177. signal for the foreground process group associated with the
  6178. terminal.
  6179. If neither ‘BRKINT’ nor ‘IGNBRK’ are set, a break condition is
  6180. passed to the application as a single ‘'\0'’ character if ‘PARMRK’
  6181. is not set, or otherwise as a three-character sequence ‘'\377'’,
  6182. ‘'\0'’, ‘'\0'’.
  6183. -- Macro: tcflag_t IGNCR
  6184. If this bit is set, carriage return characters (‘'\r'’) are
  6185. discarded on input. Discarding carriage return may be useful on
  6186. terminals that send both carriage return and linefeed when you type
  6187. the <RET> key.
  6188. -- Macro: tcflag_t ICRNL
  6189. If this bit is set and ‘IGNCR’ is not set, carriage return
  6190. characters (‘'\r'’) received as input are passed to the application
  6191. as newline characters (‘'\n'’).
  6192. -- Macro: tcflag_t INLCR
  6193. If this bit is set, newline characters (‘'\n'’) received as input
  6194. are passed to the application as carriage return characters
  6195. (‘'\r'’).
  6196. -- Macro: tcflag_t IXOFF
  6197. If this bit is set, start/stop control on input is enabled. In
  6198. other words, the computer sends STOP and START characters as
  6199. necessary to prevent input from coming in faster than programs are
  6200. reading it. The idea is that the actual terminal hardware that is
  6201. generating the input data responds to a STOP character by
  6202. suspending transmission, and to a START character by resuming
  6203. transmission. *Note Start/Stop Characters::.
  6204. -- Macro: tcflag_t IXON
  6205. If this bit is set, start/stop control on output is enabled. In
  6206. other words, if the computer receives a STOP character, it suspends
  6207. output until a START character is received. In this case, the STOP
  6208. and START characters are never passed to the application program.
  6209. If this bit is not set, then START and STOP can be read as ordinary
  6210. characters. *Note Start/Stop Characters::.
  6211. -- Macro: tcflag_t IXANY
  6212. If this bit is set, any input character restarts output when output
  6213. has been suspended with the STOP character. Otherwise, only the
  6214. START character restarts output.
  6215. This is a BSD extension; it exists only on BSD systems and
  6216. GNU/Linux and GNU/Hurd systems.
  6217. -- Macro: tcflag_t IMAXBEL
  6218. If this bit is set, then filling up the terminal input buffer sends
  6219. a BEL character (code ‘007’) to the terminal to ring the bell.
  6220. This is a BSD extension.
  6221. 
  6222. File: libc.info, Node: Output Modes, Next: Control Modes, Prev: Input Modes, Up: Terminal Modes
  6223. 17.5.5 Output Modes
  6224. -------------------
  6225. This section describes the terminal flags and fields that control how
  6226. output characters are translated and padded for display. All of these
  6227. are contained in the ‘c_oflag’ member of the ‘struct termios’ structure.
  6228. The ‘c_oflag’ member itself is an integer, and you change the flags
  6229. and fields using the operators ‘&’, ‘|’, and ‘^’. Don't try to specify
  6230. the entire value for ‘c_oflag’--instead, change only specific flags and
  6231. leave the rest untouched (*note Setting Modes::).
  6232. -- Macro: tcflag_t OPOST
  6233. If this bit is set, output data is processed in some unspecified
  6234. way so that it is displayed appropriately on the terminal device.
  6235. This typically includes mapping newline characters (‘'\n'’) onto
  6236. carriage return and linefeed pairs.
  6237. If this bit isn't set, the characters are transmitted as-is.
  6238. The following three bits are effective only if ‘OPOST’ is set.
  6239. -- Macro: tcflag_t ONLCR
  6240. If this bit is set, convert the newline character on output into a
  6241. pair of characters, carriage return followed by linefeed.
  6242. -- Macro: tcflag_t OXTABS
  6243. If this bit is set, convert tab characters on output into the
  6244. appropriate number of spaces to emulate a tab stop every eight
  6245. columns. This bit exists only on BSD systems and GNU/Hurd systems;
  6246. on GNU/Linux systems it is available as ‘XTABS’.
  6247. -- Macro: tcflag_t ONOEOT
  6248. If this bit is set, discard ‘C-d’ characters (code ‘004’) on
  6249. output. These characters cause many dial-up terminals to
  6250. disconnect. This bit exists only on BSD systems and GNU/Hurd
  6251. systems.
  6252. 
  6253. File: libc.info, Node: Control Modes, Next: Local Modes, Prev: Output Modes, Up: Terminal Modes
  6254. 17.5.6 Control Modes
  6255. --------------------
  6256. This section describes the terminal flags and fields that control
  6257. parameters usually associated with asynchronous serial data
  6258. transmission. These flags may not make sense for other kinds of
  6259. terminal ports (such as a network connection pseudo-terminal). All of
  6260. these are contained in the ‘c_cflag’ member of the ‘struct termios’
  6261. structure.
  6262. The ‘c_cflag’ member itself is an integer, and you change the flags
  6263. and fields using the operators ‘&’, ‘|’, and ‘^’. Don't try to specify
  6264. the entire value for ‘c_cflag’--instead, change only specific flags and
  6265. leave the rest untouched (*note Setting Modes::).
  6266. -- Macro: tcflag_t CLOCAL
  6267. If this bit is set, it indicates that the terminal is connected
  6268. "locally" and that the modem status lines (such as carrier detect)
  6269. should be ignored.
  6270. On many systems if this bit is not set and you call ‘open’ without
  6271. the ‘O_NONBLOCK’ flag set, ‘open’ blocks until a modem connection
  6272. is established.
  6273. If this bit is not set and a modem disconnect is detected, a
  6274. ‘SIGHUP’ signal is sent to the controlling process group for the
  6275. terminal (if it has one). Normally, this causes the process to
  6276. exit; see *note Signal Handling::. Reading from the terminal after
  6277. a disconnect causes an end-of-file condition, and writing causes an
  6278. ‘EIO’ error to be returned. The terminal device must be closed and
  6279. reopened to clear the condition.
  6280. -- Macro: tcflag_t HUPCL
  6281. If this bit is set, a modem disconnect request is generated when
  6282. all processes that have the terminal device open have either closed
  6283. the file or exited.
  6284. -- Macro: tcflag_t CREAD
  6285. If this bit is set, input can be read from the terminal.
  6286. Otherwise, input is discarded when it arrives.
  6287. -- Macro: tcflag_t CSTOPB
  6288. If this bit is set, two stop bits are used. Otherwise, only one
  6289. stop bit is used.
  6290. -- Macro: tcflag_t PARENB
  6291. If this bit is set, generation and detection of a parity bit are
  6292. enabled. *Note Input Modes::, for information on how input parity
  6293. errors are handled.
  6294. If this bit is not set, no parity bit is added to output
  6295. characters, and input characters are not checked for correct
  6296. parity.
  6297. -- Macro: tcflag_t PARODD
  6298. This bit is only useful if ‘PARENB’ is set. If ‘PARODD’ is set,
  6299. odd parity is used, otherwise even parity is used.
  6300. The control mode flags also includes a field for the number of bits
  6301. per character. You can use the ‘CSIZE’ macro as a mask to extract the
  6302. value, like this: ‘settings.c_cflag & CSIZE’.
  6303. -- Macro: tcflag_t CSIZE
  6304. This is a mask for the number of bits per character.
  6305. -- Macro: tcflag_t CS5
  6306. This specifies five bits per byte.
  6307. -- Macro: tcflag_t CS6
  6308. This specifies six bits per byte.
  6309. -- Macro: tcflag_t CS7
  6310. This specifies seven bits per byte.
  6311. -- Macro: tcflag_t CS8
  6312. This specifies eight bits per byte.
  6313. The following four bits are BSD extensions; these exist only on BSD
  6314. systems and GNU/Hurd systems.
  6315. -- Macro: tcflag_t CCTS_OFLOW
  6316. If this bit is set, enable flow control of output based on the CTS
  6317. wire (RS232 protocol).
  6318. -- Macro: tcflag_t CRTS_IFLOW
  6319. If this bit is set, enable flow control of input based on the RTS
  6320. wire (RS232 protocol).
  6321. -- Macro: tcflag_t MDMBUF
  6322. If this bit is set, enable carrier-based flow control of output.
  6323. -- Macro: tcflag_t CIGNORE
  6324. If this bit is set, it says to ignore the control modes and line
  6325. speed values entirely. This is only meaningful in a call to
  6326. ‘tcsetattr’.
  6327. The ‘c_cflag’ member and the line speed values returned by
  6328. ‘cfgetispeed’, ‘cfgetospeed’, ‘cfgetibaud’ and ‘cfsetibaud’ will be
  6329. unaffected by the call. ‘CIGNORE’ is useful if you want to set all
  6330. the software modes in the other members, but leave the hardware
  6331. details in ‘c_cflag’ unchanged. (This is how the ‘TCSASOFT’ flag
  6332. to ‘tcsetattr’ works.)
  6333. This bit is never set in the structure filled in by ‘tcgetattr’.