$NetBSD: patch-bs,v 1.1.1.1 2005/05/04 08:56:51 agc Exp $
Index: tests/premote_string.c
===================================================================
RCS file: /usr/cvsroot/nasd/nasd-1.3/tests/premote_string.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- tests/premote_string.c 21 Mar 2005 08:52:03 -0000 1.1.1.1
+++ tests/premote_string.c 21 Mar 2005 17:07:32 -0000 1.2
@@ -1,781 +1,781 @@
/* Constants for the rot13 "encryption" active disk test */
-char nasd_premote_plaintext[]="
The compilation environment
+char nasd_premote_plaintext[]="The compilation environment
\n"
+"\n"
+" \n"
+" The compilation environment of the NASD tree itself uses\n"
+" imake. To generate Makefiles, run the itomf\n"
+" script at the top of the NASD tree. On some platforms, this may\n"
+" require platform-specific arguments. Additional arguments may be\n"
+" specified to instruct the system that it should also build\n"
+" portions of the tree which are not built by default.\n"
+"
\n"
+" After the Makefiles are generated, a make depend from\n"
+" the top of the tree will create all automatically-generated source\n"
+" files, and add dependencies to all of the Makefiles.\n"
+"\n"
+"
\n"
+" Finally, make from the top of the tree will build all\n"
+" default components, and whatever non-default components were\n"
+" specified to itomf as well.\n"
+"\n"
+"
\n"
+" At any time, make Makefile in a directory will\n"
+" regenerate the Makefile from its corresponding\n"
+" Imakefile
. Note that this new Makefile
\n"
+" will not include dependencies; another make depend is\n"
+" necessary for that. make Makefiles will regenerate\n"
+" Makefiles in all subdirectories of the current directory, but not\n"
+" in the directory itself. make depend will regenerate\n"
+" dependencies for all subdirectories as well as the current\n"
+" directory.\n"
+"\n"
+"
\n"
+" The make clean production will remove any generated\n"
+" objects and executables, most editor backup files, and\n"
+" locally-generated source files in the current directory and all\n"
+" subdirectories. The make sterile production will remove\n"
+" all generated files (including Makefiles) in the current directory\n"
+" and all subdirectories, along with most editor backup files.\n"
+"\n"
+"
Configuring the compilation environment for your system
\n"
+"\n"
+" Names, locations, and arguments of system-local executables are\n"
+" specified in config/NASD_site.def
. For instance, if\n"
+" your platform has located sed in a nonstandard\n"
+" location, the path to find it is specified by setting the\n"
+" SED
variable in this file. All system-specific\n"
+" compilation options should be handled here, such as compiler\n"
+" flags, locations of executables, library paths, extra libraries to\n"
+" link against, et cetera. Modifications to this file will not take\n"
+" effect until the relevant Makefiles are regenerated (see above).\n"
+"\n"
+"Introduction
\n"
+"\n"
+"Many applications and subsystems within the NASD tree have a need to\n"
+"dynamically allocate and deallocate fixed-size structures. The preferred\n"
+"mechanism for doing so is the freelist mechanism. This set of\n"
+"interfaces provides support for maintaining pools of fixed-size chunks\n"
+"of memory, which may require explicit initialization and deinitialization\n"
+"to use.\n"
+"\n"
+"
\n"
+"If a programmer wishes to maintain caches of allocated\n"
+"but unused memory, the freelist mechanism should be used. There are\n"
+"several reasons for this. One is that using a consistent set of interfaces\n"
+"to do so helps others to read code they are unfamiliar with and identify\n"
+"what it does. Another is that the freelist mechanism is capable of collecting\n"
+"and reporting statistics on how each pool of memory was used, allowing\n"
+"better tuning of the system. A third is that by using a common, unified\n"
+"mechanism for managing allocated but currently unused chunks of memory,\n"
+"the NASD system is capable of reclaiming chunks of memory which are currently\n"
+"unused. This is especially useful in low-memory environments.\n"
+"\n"
+"
Using freelists
\n"
+"\n"
+"To use freelists, be sure the memory\n"
+"module is properly initialized, and include nasd/nasd_freelist.h
.\n"
+"Freelists have type nasd_freelist_t
.\n"
+"The freelist interface is implemented as a set of macros for efficiency.\n"
+"To minimize overhead and debugging complexity, the freelist mechanism does\n"
+"not maintain additional data for individual allocations. Instead, it requires\n"
+"that users of the freelist interface provide for it typing and dereferencing\n"
+"information for the items in the freelist. This means that many of the\n"
+"freelist macros take as arguments the cast of the item type maintained in\n"
+"the list. The name of the structure or union element within this cast type\n"
+"is a pointer to the item type itself. For example, if one were\n"
+"maintaining a list of nasd_foo_t
, that could mean that:\n"
+"
\n"
+"The cast for items in the freelist is (nasd_foo_t *)
. The\n"
+"pointer to the item type, henceforth referred to as the next\n"
+"pointer, is another_foo
. To minimize overhead, the freelist\n"
+"mechanism allows users to set the next pointer arbitrarily whenever\n"
+"items are not in the freelist. This is handy for items which are\n"
+"maintained in lists when they are allocated - the list pointer can then\n"
+"be reused as the next pointer.\n"
+"\n"
+"\n"
+"Sometimes, it is desirable to maintain freelists of items which do not\n"
+"naturally contain fields which are correctly-formed next pointers.\n"
+"If there is a void pointer in the item type, it is acceptable to use\n"
+"this in place of the next pointer. The preferred mechanism for dealing\n"
+"with this is to create a union
. For instance, to\n"
+"maintain a freelist of arrays of eight kilobytes of memory:
\n"
+"
\n"
+"In this example, next
is a valid next pointer for the freelist\n"
+"mechanism, and the data field of nasd_foo_t
is an eight kilobyte\n"
+"array.\n"
+"\n"
+"Basic freelists
\n"
+"\n"
+"The most basic kind of freelist is one which maintains chunks of data whose\n"
+"contents may be arbitrary, but require no special initialization or\n"
+"deinitialization. To use such a freelist, first declare a pointer to\n"
+"type nasd_freelist_t
. Create the empty freelist by calling\n"
+"NASD_FREELIST_CREATE()
. This takes four arguments. The\n"
+"first is the freelist pointer. The second is the maximum number of these\n"
+"items which should ever reside in the freelist at a particular time (extras will be\n"
+"returned to the system immediately). The third is how many additional\n"
+"items to allocate whenever the freelist is empty and an allocation is\n"
+"desired. The final argument is the size of the item. If the freelist\n"
+"pointer is NULL
after evaluating NASD_FREELIST_CREATE()
,\n"
+"the list itself could not be created.\n"
+"\n"
+"
\n"
+"It is often desirable at this point to make this newly-created freelist\n"
+"be non-empty, so that when the code begins executing, initial trips through\n"
+"not-yet-executed codepaths do not incur tremendous allocation costs. Do\n"
+"this by calling NASD_FREELIST_PRIME()
, which takes four\n"
+"arguments. The first argument is the freelist pointer. The second is the\n"
+"number of items to create and add to the list. The third is the next\n"
+"pointer, and the fourth is the item cast.\n"
+"\n"
+"
\n"
+"To retrieve an item from the freelist, call NASD_FREELIST_GET()
.\n"
+"This takes four arguments. The first is the freelist pointer. The second\n"
+"is a pointer to be assigned with the address of the object retrieved from\n"
+"the freelist. The third is the next pointer, and the fourth is the item\n"
+"cast.\n"
+"\n"
+"
\n"
+"To return an item to a freelist, call NASD_FREELIST_FREE()
.\n"
+"This takes three arguments. The first is the freelist pointer. The\n"
+"second is the address of the item to return. The third is the next\n"
+"pointer.\n"
+"\n"
+"
\n"
+"When a freelist is no longer needed, it (along with its current contents)\n"
+"may be deallocated with NASD_FREELIST_DESTROY()
. This\n"
+"macro takes three arguments. The first is the freelist pointer. The\n"
+"second is the next pointer. The third is the item cast.\n"
+"\n"
+"
\n"
+"Example: Let's say we have a type nasd_foo_t
, for which we\n"
+"wish to maintain a freelist. We might have something like:
\n"
+"
\n"
+"\n"
+"
\n"
+"\n"
+"
Freelists with initialized items
\n"
+"\n"
+"Sometimes, it is desirable to have the items in a freelist maintain\n"
+"state across allocate and free operations. For instance, each item\n"
+"might contain a mutex. Rather than initialize and destroy a mutex\n"
+"each time an item is allocated from or freed to the freelist, it is\n"
+"more desirable to initialize a mutex each time an item is created for\n"
+"the freelist, and deinitialize it whenever the item is returned to\n"
+"the system. To that end, the freelist mechanism provides variants\n"
+"on the above interfaces: NASD_FREELIST_PRIME_INIT()
,\n"
+"NASD_FREELIST_GET_INIT()
, NASD_FREELIST_FREE_CLEAN()
,\n"
+"and NASD_FREELIST_DESTROY_CLEAN()
.\n"
+"\n"
+"\n"
+"NASD_FREELIST_PRIME_INIT()
and NASD_FREELIST_GET_INIT()
\n"
+"are very similar to NASD_FREELIST_PRIME()
and NASD_FREELIST_GET()
,\n"
+"respectively. Each takes an additional argument, however, which is an\n"
+"initialization function. This function should take a pointer to\n"
+"the item type as its sole argument, and return nasd_status_t
.\n"
+"If the initialization is successful, it should return NASD_SUCCESS
.\n"
+"Otherwise, it should return a meaningful error code. Likewise,\n"
+"NASD_FREELIST_FREE_CLEAN()
, and NASD_FREELIST_DESTROY_CLEAN()
\n"
+"take an additional argument which is a function returning void that takes\n"
+"a pointer to the item type as its sole argument. This function is responsible\n"
+"for reversing the action of the init function. For example, if we added a mutex\n"
+"and a condition variable to nasd_foo_t
in our earlier example, we would\n"
+"get:\n"
+"
\n"
+"\n"
+"Now every nasd_foo_t
resulting from a call to nasd_get_foo()
\n"
+"contains validly-initialized mutex and condition variables.\n"
+"\n"
+"
\n"
+"
Advanced topics
\n"
+"\n"
+"Sometimes item initialization and cleanup functions might desire additional\n"
+"out-of-band data. For this reason, the _INIT
and _CLEAN
\n"
+"macros also have _INIT_ARG
and _CLEAN_ARG
variants.\n"
+"These variants take an additional argument after the init or clean function\n"
+"which is passed as a second argument to the init or clean functions themselves.\n"
+"Because the freelist interface is entirely macroized, these arguments may have\n"
+"any type.\n"
+"\n"
+"\n"
+"Freelists protect against accesses by multiple threads by using internal\n"
+"mutexes. These mutexes may be accessed directly by operationg on\n"
+"NASD_FREELIST_MUTEX_OF(freelist_pointer)
. To lock\n"
+"this mutex, use NASD_FREELIST_DO_LOCK(freelist_pointer)
.\n"
+"To unlock it, use NASD_FREELIST_DO_UNLOCK(freelist_pointer)
.\n"
+"The header file nasd_freelist.h
provides variants of many of\n"
+"the freelist interfaces which do not take or release locks themselves. If\n"
+"you use this, you are responsible for correctly synchronizing access to the\n"
+"freelist. This has the opportunity for providing greater efficiency when\n"
+"batching operations, or when performing operations already protected by\n"
+"other locks.\n"
+"\n"
+"
\n"
+"If NASD_FREELIST_STATS
is defined nonzero in nasd_options.h
,\n"
+"when each freelist is destroyed, statistics about operations performed on it\n"
+"are printed, including the number of times items were allocated and freed\n"
+"from the list, how many times the list ran empty and how many more items had to be\n"
+"allocated, the largest number of unused items that was ever in the list, and\n"
+"the largest number of items that was ever allocated at a time, among others.\n"
+;
+
+char nasd_premote_ciphertext[] = "Gur pbzcvyngvba raivebazrag\n"
+"\n"
+" \n"
+" Gur pbzcvyngvba raivebazrag bs gur ANFQ gerr vgfrys hfrf\n"
+" vznxr. Gb trarengr Znxrsvyrf, eha gur vgbzs\n"
+" fpevcg ng gur gbc bs gur ANFQ gerr. Ba fbzr cyngsbezf, guvf znl\n"
+" erdhver cyngsbez-fcrpvsvp nethzragf. Nqqvgvbany nethzragf znl or\n"
+" fcrpvsvrq gb vafgehpg gur flfgrz gung vg fubhyq nyfb ohvyq\n"
+" cbegvbaf bs gur gerr juvpu ner abg ohvyg ol qrsnhyg.\n"
+" \n"
+" Nsgre gur Znxrsvyrf ner trarengrq, n znxr qrcraq sebz\n"
+" gur gbc bs gur gerr jvyy perngr nyy nhgbzngvpnyyl-trarengrq fbhepr\n"
+" svyrf, naq nqq qrcraqrapvrf gb nyy bs gur Znxrsvyrf.\n"
+"\n"
+" \n"
+" Svanyyl, znxr sebz gur gbc bs gur gerr jvyy ohvyq nyy\n"
+" qrsnhyg pbzcbaragf, naq jungrire aba-qrsnhyg pbzcbaragf jrer\n"
+" fcrpvsvrq gb vgbzs nf jryy.\n"
+"\n"
+" \n"
+" Ng nal gvzr, znxr Znxrsvyr va n qverpgbel jvyy\n"
+" ertrarengr gur Znxrsvyr sebz vgf pbeerfcbaqvat\n"
+" Vznxrsvyr. Abgr gung guvf arj Znxrsvyr\n"
+" jvyy abg vapyhqr qrcraqrapvrf; nabgure znxr qrcraq vf\n"
+" arprffnel sbe gung. znxr Znxrsvyrf jvyy ertrarengr\n"
+" Znxrsvyrf va nyy fhoqverpgbevrf bs gur pheerag qverpgbel, ohg abg\n"
+" va gur qverpgbel vgfrys. znxr qrcraq jvyy ertrarengr\n"
+" qrcraqrapvrf sbe nyy fhoqverpgbevrf nf jryy nf gur pheerag\n"
+" qverpgbel.\n"
+"\n"
+" \n"
+" Gur znxr pyrna cebqhpgvba jvyy erzbir nal trarengrq\n"
+" bowrpgf naq rkrphgnoyrf, zbfg rqvgbe onpxhc svyrf, naq\n"
+" ybpnyyl-trarengrq fbhepr svyrf va gur pheerag qverpgbel naq nyy\n"
+" fhoqverpgbevrf. Gur znxr fgrevyr cebqhpgvba jvyy erzbir\n"
+" nyy trarengrq svyrf (vapyhqvat Znxrsvyrf) va gur pheerag qverpgbel\n"
+" naq nyy fhoqverpgbevrf, nybat jvgu zbfg rqvgbe onpxhc svyrf.\n"
+"\n"
+" Pbasvthevat gur pbzcvyngvba raivebazrag sbe lbhe flfgrz\n"
+"\n"
+" Anzrf, ybpngvbaf, naq nethzragf bs flfgrz-ybpny rkrphgnoyrf ner\n"
+" fcrpvsvrq va pbasvt/ANFQ_fvgr.qrs. Sbe vafgnapr, vs\n"
+" lbhe cyngsbez unf ybpngrq frq va n abafgnaqneq\n"
+" ybpngvba, gur cngu gb svaq vg vf fcrpvsvrq ol frggvat gur\n"
+" FRQ inevnoyr va guvf svyr. Nyy flfgrz-fcrpvsvp\n"
+" pbzcvyngvba bcgvbaf fubhyq or unaqyrq urer, fhpu nf pbzcvyre\n"
+" syntf, ybpngvbaf bs rkrphgnoyrf, yvoenel cnguf, rkgen yvoenevrf gb\n"
+" yvax ntnvafg, rg prgren. Zbqvsvpngvbaf gb guvf svyr jvyy abg gnxr\n"
+" rssrpg hagvy gur eryrinag Znxrsvyrf ner ertrarengrq (frr nobir).\n"
+"\n"
+"Vagebqhpgvba\n"
+"\n"
+"Znal nccyvpngvbaf naq fhoflfgrzf jvguva gur ANFQ gerr unir n arrq gb\n"
+"qlanzvpnyyl nyybpngr naq qrnyybpngr svkrq-fvmr fgehpgherf. Gur cersreerq\n"
+"zrpunavfz sbe qbvat fb vf gur serryvfg zrpunavfz. Guvf frg bs\n"
+"vagresnprf cebivqrf fhccbeg sbe znvagnvavat cbbyf bs svkrq-fvmr puhaxf\n"
+"bs zrzbel, juvpu znl erdhver rkcyvpvg vavgvnyvmngvba naq qrvavgvnyvmngvba\n"
+"gb hfr.\n"
+"\n"
+"\n"
+"Vs n cebtenzzre jvfurf gb znvagnva pnpurf bs nyybpngrq\n"
+"ohg hahfrq zrzbel, gur serryvfg zrpunavfz fubhyq or hfrq. Gurer ner\n"
+"frireny ernfbaf sbe guvf. Bar vf gung hfvat n pbafvfgrag frg bs vagresnprf\n"
+"gb qb fb urycf bguref gb ernq pbqr gurl ner hasnzvyvne jvgu naq vqragvsl\n"
+"jung vg qbrf. Nabgure vf gung gur serryvfg zrpunavfz vf pncnoyr bs pbyyrpgvat\n"
+"naq ercbegvat fgngvfgvpf ba ubj rnpu cbby bs zrzbel jnf hfrq, nyybjvat\n"
+"orggre ghavat bs gur flfgrz. N guveq vf gung ol hfvat n pbzzba, havsvrq\n"
+"zrpunavfz sbe znantvat nyybpngrq ohg pheeragyl hahfrq puhaxf bs zrzbel,\n"
+"gur ANFQ flfgrz vf pncnoyr bs erpynvzvat puhaxf bs zrzbel juvpu ner pheeragyl\n"
+"hahfrq. Guvf vf rfcrpvnyyl hfrshy va ybj-zrzbel raivebazragf.\n"
+"\n"
+"Hfvat serryvfgf\n"
+"\n"
+"Gb hfr serryvfgf, or fher gur zrzbel\n"
+"zbqhyr vf cebcreyl vavgvnyvmrq, naq vapyhqr anfq/anfq_serryvfg.u.\n"
+"Serryvfgf unir glcr anfq_serryvfg_g.\n"
+"Gur serryvfg vagresnpr vf vzcyrzragrq nf n frg bs znpebf sbe rssvpvrapl.\n"
+"Gb zvavzvmr bireurnq naq qrohttvat pbzcyrkvgl, gur serryvfg zrpunavfz qbrf\n"
+"abg znvagnva nqqvgvbany qngn sbe vaqvivqhny nyybpngvbaf. Vafgrnq, vg erdhverf\n"
+"gung hfref bs gur serryvfg vagresnpr cebivqr sbe vg glcvat naq qrersrerapvat\n"
+"vasbezngvba sbe gur vgrzf va gur serryvfg. Guvf zrnaf gung znal bs gur\n"
+"serryvfg znpebf gnxr nf nethzragf gur pnfg bs gur vgrz glcr znvagnvarq va\n"
+"gur yvfg. Gur anzr bs gur fgehpgher be havba ryrzrag jvguva guvf pnfg glcr\n"
+"vf n cbvagre gb gur vgrz glcr vgfrys. Sbe rknzcyr, vs bar jrer\n"
+"znvagnvavat n yvfg bs anfq_sbb_g, gung pbhyq zrna gung:\n"
+"\n"
+"Tvira\n"
+"\n"
+"glcrqrs fgehpg anfq_sbb_f anfq_sbb_g;\n"
+"fgehpg anfq_sbb_f {\n"
+"&aofc;&aofc;/* npghny qngn sbe anfq_sbb_g urer */\n"
+"&aofc;&aofc;anfq_sbb_g&aofc;&aofc;*nabgure_sbb;\n"
+"};\n"
+"\n"
+"\n"
+"Gur pnfg sbe vgrzf va gur serryvfg vf (anfq_sbb_g *). Gur\n"
+"cbvagre gb gur vgrz glcr, uraprsbegu ersreerq gb nf gur arkg\n"
+"cbvagre, vf nabgure_sbb. Gb zvavzvmr bireurnq, gur serryvfg\n"
+"zrpunavfz nyybjf hfref gb frg gur arkg cbvagre neovgenevyl jurarire\n"
+"vgrzf ner abg va gur serryvfg. Guvf vf unaql sbe vgrzf juvpu ner\n"
+"znvagnvarq va yvfgf jura gurl ner nyybpngrq - gur yvfg cbvagre pna gura\n"
+"or erhfrq nf gur arkg cbvagre.\n"
+"\n"
+"\n"
+"Fbzrgvzrf, vg vf qrfvenoyr gb znvagnva serryvfgf bs vgrzf juvpu qb abg\n"
+"anghenyyl pbagnva svryqf juvpu ner pbeerpgyl-sbezrq arkg cbvagref.\n"
+"Vs gurer vf n ibvq cbvagre va gur vgrz glcr, vg vf npprcgnoyr gb hfr\n"
+"guvf va cynpr bs gur arkg cbvagre. Gur cersreerq zrpunavfz sbe qrnyvat\n"
+"jvgu guvf vf gb perngr n havba. Sbe vafgnapr, gb\n"
+"znvagnva n serryvfg bs neenlf bs rvtug xvybolgrf bs zrzbel:\n"
+"\n"
+"glcrqrs havba anfq_sbb_h anfq_sbb_g;\n"
+"havba anfq_sbb_h {\n"
+"&aofc;&aofc;pune&aofc;&aofc;&aofc;&aofc;&aofc;&aofc;&aofc;&aofc;&aofc;qngn[8192];\n"
+"&aofc;&aofc;anfq_sbb_g&aofc;&aofc;*arkg;\n"
+"};\n"
+"\n"
+"Va guvf rknzcyr, arkg vf n inyvq arkg cbvagre sbe gur serryvfg\n"
+"zrpunavfz, naq gur qngn svryq bs anfq_sbb_g vf na rvtug xvybolgr\n"
+"neenl.\n"
+"\n"
+"Onfvp serryvfgf\n"
+"\n"
+"Gur zbfg onfvp xvaq bs serryvfg vf bar juvpu znvagnvaf puhaxf bs qngn jubfr\n"
+"pbagragf znl or neovgenel, ohg erdhver ab fcrpvny vavgvnyvmngvba be\n"
+"qrvavgvnyvmngvba. Gb hfr fhpu n serryvfg, svefg qrpyner n cbvagre gb\n"
+"glcr anfq_serryvfg_g. Perngr gur rzcgl serryvfg ol pnyyvat\n"
+"ANFQ_SERRYVFG_PERNGR(). Guvf gnxrf sbhe nethzragf. Gur\n"
+"svefg vf gur serryvfg cbvagre. Gur frpbaq vf gur znkvzhz ahzore bs gurfr\n"
+"vgrzf juvpu fubhyq rire erfvqr va gur serryvfg ng n cnegvphyne gvzr (rkgenf jvyy or\n"
+"erghearq gb gur flfgrz vzzrqvngryl). Gur guveq vf ubj znal nqqvgvbany\n"
+"vgrzf gb nyybpngr jurarire gur serryvfg vf rzcgl naq na nyybpngvba vf\n"
+"qrfverq. Gur svany nethzrag vf gur fvmr bs gur vgrz. Vs gur serryvfg\n"
+"cbvagre vf AHYY nsgre rinyhngvat ANFQ_SERRYVFG_PERNGR(),\n"
+"gur yvfg vgfrys pbhyq abg or perngrq.\n"
+"\n"
+"\n"
+"Vg vf bsgra qrfvenoyr ng guvf cbvag gb znxr guvf arjyl-perngrq serryvfg\n"
+"or aba-rzcgl, fb gung jura gur pbqr ortvaf rkrphgvat, vavgvny gevcf guebhtu\n"
+"abg-lrg-rkrphgrq pbqrcnguf qb abg vaphe gerzraqbhf nyybpngvba pbfgf. Qb\n"
+"guvf ol pnyyvat ANFQ_SERRYVFG_CEVZR(), juvpu gnxrf sbhe\n"
+"nethzragf. Gur svefg nethzrag vf gur serryvfg cbvagre. Gur frpbaq vf gur\n"
+"ahzore bs vgrzf gb perngr naq nqq gb gur yvfg. Gur guveq vf gur arkg\n"
+"cbvagre, naq gur sbhegu vf gur vgrz pnfg.\n"
+"\n"
+"\n"
+"Gb ergevrir na vgrz sebz gur serryvfg, pnyy ANFQ_SERRYVFG_TRG().\n"
+"Guvf gnxrf sbhe nethzragf. Gur svefg vf gur serryvfg cbvagre. Gur frpbaq\n"
+"vf n cbvagre gb or nffvtarq jvgu gur nqqerff bs gur bowrpg ergevrirq sebz\n"
+"gur serryvfg. Gur guveq vf gur arkg cbvagre, naq gur sbhegu vf gur vgrz\n"
+"pnfg.\n"
+"\n"
+"\n"
+"Gb erghea na vgrz gb n serryvfg, pnyy ANFQ_SERRYVFG_SERR().\n"
+"Guvf gnxrf guerr nethzragf. Gur svefg vf gur serryvfg cbvagre. Gur\n"
+"frpbaq vf gur nqqerff bs gur vgrz gb erghea. Gur guveq vf gur arkg\n"
+"cbvagre.\n"
+"\n"
+"\n"
+"Jura n serryvfg vf ab ybatre arrqrq, vg (nybat jvgu vgf pheerag pbagragf)\n"
+"znl or qrnyybpngrq jvgu ANFQ_SERRYVFG_QRFGEBL(). Guvf\n"
+"znpeb gnxrf guerr nethzragf. Gur svefg vf gur serryvfg cbvagre. Gur\n"
+"frpbaq vf gur arkg cbvagre. Gur guveq vf gur vgrz pnfg.\n"
+"\n"
+"\n"
+"Rknzcyr: Yrg'f fnl jr unir n glcr anfq_sbb_g, sbe juvpu jr\n"
+"jvfu gb znvagnva n serryvfg. Jr zvtug unir fbzrguvat yvxr:\n"
+"\n"
+"glcrqrs fgehpg anfq_sbb_f anfq_sbb_g;\n"
+"fgehpg anfq_sbb_f {\n"
+"&aofc;&aofc;/* npghny qngn sbe anfq_sbb_g urer */\n"
+"&aofc;&aofc;anfq_sbb_g&aofc;&aofc;*nabgure_sbb;\n"
+"};\n"
+"\n"
+"anfq_serryvfg_g *anfq_sbb_serryvfg;\n"
+"#qrsvar ANFQ_ZNK_SERR_SBB 1024 /* Znkvzhz ahzore bs sbbf\n"
+" * gb unir va gur serryvfg\n"
+" * ng n gvzr\n"
+" */\n"
+"#qrsvar ANFQ_SBB_VAP 64 /* Ubj znal sbbf gb nqq gb\n"
+" * gur serryvfg ng n gvzr\n"
+" * jura jr eha bhg\n"
+" */\n"
+"#qrsvar ANFQ_SBB_VAVGVNY 32 /* Ubj znal sbbf gb perngr\n"
+" * ng fgneg bs qnl\n"
+" */\n"
+"\n"
+"anfq_fgnghf_g\n"
+"anfq_vavg_sbb_serryvfg()\n"
+"{\n"
+" ANFQ_SERRYVFG_PERNGR(anfq_sbb_serryvfg, ANFQ_ZNK_SERR_SBB,\n"
+" ANFQ_SBB_VAP, fvmrbs(anfq_sbb_g));\n"
+" vs (anfq_sbb_serryvfg == AHYY) {\n"
+" erghea(ANFQ_AB_ZRZ);\n"
+" }\n"
+"\n"
+" ANFQ_SERRYVFG_CEVZR(anfq_sbb_serryvfg, ANFQ_SBB_VAVGVNY,arkg,\n"
+" (anfq_sbb_g *));\n"
+"\n"
+" erghea(ANFQ_FHPPRFF);\n"
+"}\n"
+"\n"
+"anfq_fgnghf_g\n"
+"anfq_trg_sbb(\n"
+"&aofc;&aofc;anfq_sbb_g&aofc;&aofc;**sbb_c)\n"
+"{\n"
+" ANFQ_SERRYVFG_TRG(anfq_sbb_serryvfg,*sbb_c,arkg,(anfq_sbb_g *));\n"
+" vs (*sbb_c == AHYY)\n"
+" erghea(ANFQ_AB_ZRZ);\n"
+" erghea(ANFQ_FHPPRFF);\n"
+"}\n"
+"\n"
+"ibvq\n"
+"anfq_serr_sbb(\n"
+"&aofc;&aofc;anfq_sbb_g&aofc;&aofc;*sbb)\n"
+"{\n"
+" ANFQ_SERRYVFG_SERR(anfq_sbb_serryvfg,sbb,arkg);\n"
+"}\n"
+"\n"
+"ibvq\n"
+"anfq_fuhgqbja_sbb_serryvfg()\n"
+"{\n"
+" ANFQ_SERRYVFG_QRFGEBL(anfq_sbb_serryvfg,arkg,(anfq_sbb_g *));\n"
+"}\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"Serryvfgf jvgu vavgvnyvmrq vgrzf\n"
+"\n"
+"Fbzrgvzrf, vg vf qrfvenoyr gb unir gur vgrzf va n serryvfg znvagnva\n"
+"fgngr npebff nyybpngr naq serr bcrengvbaf. Sbe vafgnapr, rnpu vgrz\n"
+"zvtug pbagnva n zhgrk. Engure guna vavgvnyvmr naq qrfgebl n zhgrk\n"
+"rnpu gvzr na vgrz vf nyybpngrq sebz be serrq gb gur serryvfg, vg vf\n"
+"zber qrfvenoyr gb vavgvnyvmr n zhgrk rnpu gvzr na vgrz vf perngrq sbe\n"
+"gur serryvfg, naq qrvavgvnyvmr vg jurarire gur vgrz vf erghearq gb\n"
+"gur flfgrz. Gb gung raq, gur serryvfg zrpunavfz cebivqrf inevnagf\n"
+"ba gur nobir vagresnprf: ANFQ_SERRYVFG_CEVZR_VAVG(),\n"
+"ANFQ_SERRYVFG_TRG_VAVG(), ANFQ_SERRYVFG_SERR_PYRNA(),\n"
+"naq ANFQ_SERRYVFG_QRFGEBL_PYRNA().\n"
+"\n"
+"\n"
+"ANFQ_SERRYVFG_CEVZR_VAVG() naq ANFQ_SERRYVFG_TRG_VAVG()\n"
+"ner irel fvzvyne gb ANFQ_SERRYVFG_CEVZR() naq ANFQ_SERRYVFG_TRG(),\n"
+"erfcrpgviryl. Rnpu gnxrf na nqqvgvbany nethzrag, ubjrire, juvpu vf na\n"
+"vavgvnyvmngvba shapgvba. Guvf shapgvba fubhyq gnxr n cbvagre gb\n"
+"gur vgrz glcr nf vgf fbyr nethzrag, naq erghea anfq_fgnghf_g.\n"
+"Vs gur vavgvnyvmngvba vf fhpprffshy, vg fubhyq erghea ANFQ_FHPPRFF.\n"
+"Bgurejvfr, vg fubhyq erghea n zrnavatshy reebe pbqr. Yvxrjvfr,\n"
+"ANFQ_SERRYVFG_SERR_PYRNA(), naq ANFQ_SERRYVFG_QRFGEBL_PYRNA()\n"
+"gnxr na nqqvgvbany nethzrag juvpu vf n shapgvba ergheavat ibvq gung gnxrf\n"
+"n cbvagre gb gur vgrz glcr nf vgf fbyr nethzrag. Guvf shapgvba vf erfcbafvoyr\n"
+"sbe erirefvat gur npgvba bs gur vavg shapgvba. Sbe rknzcyr, vs jr nqqrq n zhgrk\n"
+"naq n pbaqvgvba inevnoyr gb anfq_sbb_g va bhe rneyvre rknzcyr, jr jbhyq\n"
+"trg:\n"
+"\n"
+"glcrqrs fgehpg anfq_sbb_f anfq_sbb_g;\n"
+"fgehpg anfq_sbb_f {\n"
+"&aofc;&aofc;ANFQ_QRPYNER_ZHGRK(zhgrk)\n"
+"&aofc;&aofc;ANFQ_QRPYNER_PBAQ(pbaq)\n"
+"&aofc;&aofc;/* bgure qngn sbe anfq_sbb_g urer */\n"
+"&aofc;&aofc;anfq_sbb_g&aofc;&aofc;*nabgure_sbb;\n"
+"};\n"
+"\n"
+"anfq_serryvfg_g *anfq_sbb_serryvfg;\n"
+"#qrsvar ANFQ_ZNK_SERR_SBB 1024 /* Znkvzhz ahzore bs sbbf\n"
+" * gb unir va gur serryvfg\n"
+" * ng n gvzr\n"
+" */\n"
+"#qrsvar ANFQ_SBB_VAP 64 /* Ubj znal sbbf gb nqq gb\n"
+" * gur serryvfg ng n gvzr\n"
+" * jura jr eha bhg\n"
+" */\n"
+"#qrsvar ANFQ_SBB_VAVGVNY 32 /* Ubj znal sbbf gb perngr\n"
+" * ng fgneg bs qnl\n"
+" */\n"
+"\n"
+"fgngvp anfq_fgnghf_g\n"
+"vavg_sbb(\n"
+" anfq_sbb_g *sbb)\n"
+"{\n"
+" anfq_fgnghf_g ep;\n"
+"\n"
+" ep = anfq_zhgrk_vavg(&sbb->ybpx);\n"
+" vs (ep)\n"
+" erghea(ep);\n"
+" ep = anfq_pbaq_vavg(&sbb->pbaq);\n"
+" vs (ep) {\n"
+" anfq_zhgrk_qrfgebl(&sbb->ybpx);\n"
+" erghea(ep);\n"
+" }\n"
+" erghea(ANFQ_FHPPRFF);\n"
+"}\n"
+"\n"
+"fgngvp ibvq\n"
+"pyrna_sbb(\n"
+" anfq_sbb_g *sbb)\n"
+"{\n"
+" anfq_fgnghf_g ep;\n"
+"\n"
+" ep = anfq_zhgrk_qrfgebl(&sbb->ybpx);\n"
+" vs (ep) {\n"
+" cevags(JNEAVAT: tbg 0k%k (%f) qrfgeblvat sbb ybpxa,\n"
+" ep, anfq_reebe_fgevat(ep));\n"
+" }\n"
+" ep = anfq_pbaq_qrfgebl(&sbb->pbaq);\n"
+" vs (ep) {\n"
+" cevags(JNEAVAT: tbg 0k%k (%f) qrfgeblvat sbb pbaqa,\n"
+" ep, anfq_reebe_fgevat(ep));\n"
+" }\n"
+"}\n"
+"\n"
+"anfq_fgnghf_g\n"
+"anfq_vavg_sbb_serryvfg()\n"
+"{\n"
+" ANFQ_SERRYVFG_PERNGR(anfq_sbb_serryvfg, ANFQ_ZNK_SERR_SBB,\n"
+" ANFQ_SBB_VAP, fvmrbs(anfq_sbb_g));\n"
+" vs (anfq_sbb_serryvfg == AHYY) {\n"
+" erghea(ANFQ_AB_ZRZ);\n"
+" }\n"
+"\n"
+" ANFQ_SERRYVFG_CEVZR_VAVG(anfq_sbb_serryvfg, ANFQ_SBB_VAVGVNY, arkg,\n"
+" (anfq_sbb_g *), vavg_sbb);\n"
+"\n"
+" erghea(ANFQ_FHPPRFF);\n"
+"}\n"
+"\n"
+"anfq_fgnghf_g\n"
+"anfq_trg_sbb(\n"
+"&aofc;&aofc;anfq_sbb_g&aofc;&aofc;**sbb_c)\n"
+"{\n"
+" ANFQ_SERRYVFG_TRG_VAVG(anfq_sbb_serryvfg, *sbb_c,\n"
+" arkg, (anfq_sbb_g *), vavg_sbb);\n"
+" vs (*sbb_c == AHYY)\n"
+" erghea(ANFQ_AB_ZRZ);\n"
+" erghea(ANFQ_FHPPRFF);\n"
+"}\n"
+"\n"
+"ibvq\n"
+"anfq_serr_sbb(\n"
+"&aofc;&aofc;anfq_sbb_g&aofc;&aofc;*sbb)\n"
+"{\n"
+" ANFQ_SERRYVFG_SERR_PYRNA(anfq_sbb_serryvfg, sbb, arkg, pyrna_sbb);\n"
+"}\n"
+"\n"
+"ibvq\n"
+"anfq_fuhgqbja_sbb_serryvfg()\n"
+"{\n"
+" ANFQ_SERRYVFG_QRFGEBL(anfq_sbb_serryvfg, arkg, (anfq_sbb_g *), pyrna_sbb);\n"
+"}\n"
+"\n"
+"\n"
+"Abj rirel anfq_sbb_g erfhygvat sebz n pnyy gb anfq_trg_sbb()\n"
+"pbagnvaf inyvqyl-vavgvnyvmrq zhgrk naq pbaqvgvba inevnoyrf.\n"
+"\n"
+"\n"
+"Nqinaprq gbcvpf\n"
+"\n"
+"Fbzrgvzrf vgrz vavgvnyvmngvba naq pyrnahc shapgvbaf zvtug qrfver nqqvgvbany\n"
+"bhg-bs-onaq qngn. Sbe guvf ernfba, gur _VAVG naq _PYRNA\n"
+"znpebf nyfb unir _VAVG_NET naq _PYRNA_NET inevnagf.\n"
+"Gurfr inevnagf gnxr na nqqvgvbany nethzrag nsgre gur vavg be pyrna shapgvba\n"
+"juvpu vf cnffrq nf n frpbaq nethzrag gb gur vavg be pyrna shapgvbaf gurzfryirf.\n"
+"Orpnhfr gur serryvfg vagresnpr vf ragveryl znpebvmrq, gurfr nethzragf znl unir\n"
+"nal glcr.\n"
+"\n"
+"\n"
+"Serryvfgf cebgrpg ntnvafg npprffrf ol zhygvcyr guernqf ol hfvat vagreany\n"
+"zhgrkrf. Gurfr zhgrkrf znl or npprffrq qverpgyl ol bcrengvbat ba\n"
+"ANFQ_SERRYVFG_ZHGRK_BS(serryvfg_cbvagre). Gb ybpx\n"
+"guvf zhgrk, hfr ANFQ_SERRYVFG_QB_YBPX(serryvfg_cbvagre).\n"
+"Gb haybpx vg, hfr ANFQ_SERRYVFG_QB_HAYBPX(serryvfg_cbvagre).\n"
+"Gur urnqre svyr anfq_serryvfg.u cebivqrf inevnagf bs znal bs\n"
+"gur serryvfg vagresnprf juvpu qb abg gnxr be eryrnfr ybpxf gurzfryirf. Vs\n"
+"lbh hfr guvf, lbh ner erfcbafvoyr sbe pbeerpgyl flapuebavmvat npprff gb gur\n"
+"serryvfg. Guvf unf gur bccbeghavgl sbe cebivqvat terngre rssvpvrapl jura\n"
+"ongpuvat bcrengvbaf, be jura cresbezvat bcrengvbaf nyernql cebgrpgrq ol\n"
+"bgure ybpxf.\n"
+"\n"
+"\n"
+"Vs ANFQ_SERRYVFG_FGNGF vf qrsvarq abamreb va anfq_bcgvbaf.u,\n"
+"jura rnpu serryvfg vf qrfgeblrq, fgngvfgvpf nobhg bcrengvbaf cresbezrq ba vg\n"
+"ner cevagrq, vapyhqvat gur ahzore bs gvzrf vgrzf jrer nyybpngrq naq serrq\n"
+"sebz gur yvfg, ubj znal gvzrf gur yvfg ena rzcgl naq ubj znal zber vgrzf unq gb or\n"
+"nyybpngrq, gur ynetrfg ahzore bs hahfrq vgrzf gung jnf rire va gur yvfg, naq\n"
+"gur ynetrfg ahzore bs vgrzf gung jnf rire nyybpngrq ng n gvzr, nzbat bguref.\n"
+;
-
- The compilation environment of the NASD tree itself uses
- imake. To generate Makefiles, run the itomf
- script at the top of the NASD tree. On some platforms, this may
- require platform-specific arguments. Additional arguments may be
- specified to instruct the system that it should also build
- portions of the tree which are not built by default.
-
- After the Makefiles are generated, a make depend from
- the top of the tree will create all automatically-generated source
- files, and add dependencies to all of the Makefiles.
-
- Finally, make from the top of the tree will build all
- default components, and whatever non-default components were
- specified to itomf as well.
-
- At any time, make Makefile in a directory will
- regenerate the Makefile from its corresponding
- Imakefile
. Note that this new Makefile
- will not include dependencies; another make depend is
- necessary for that. make Makefiles will regenerate
- Makefiles in all subdirectories of the current directory, but not
- in the directory itself. make depend will regenerate
- dependencies for all subdirectories as well as the current
- directory.
-
- The make clean production will remove any generated
- objects and executables, most editor backup files, and
- locally-generated source files in the current directory and all
- subdirectories. The make sterile production will remove
- all generated files (including Makefiles) in the current directory
- and all subdirectories, along with most editor backup files.
-
-
Configuring the compilation environment for your system
-
- Names, locations, and arguments of system-local executables are
- specified in config/NASD_site.def
. For instance, if
- your platform has located sed in a nonstandard
- location, the path to find it is specified by setting the
- SED
variable in this file. All system-specific
- compilation options should be handled here, such as compiler
- flags, locations of executables, library paths, extra libraries to
- link against, et cetera. Modifications to this file will not take
- effect until the relevant Makefiles are regenerated (see above).
-
-Introduction
-
-Many applications and subsystems within the NASD tree have a need to
-dynamically allocate and deallocate fixed-size structures. The preferred
-mechanism for doing so is the freelist mechanism. This set of
-interfaces provides support for maintaining pools of fixed-size chunks
-of memory, which may require explicit initialization and deinitialization
-to use.
-
-
-If a programmer wishes to maintain caches of allocated
-but unused memory, the freelist mechanism should be used. There are
-several reasons for this. One is that using a consistent set of interfaces
-to do so helps others to read code they are unfamiliar with and identify
-what it does. Another is that the freelist mechanism is capable of collecting
-and reporting statistics on how each pool of memory was used, allowing
-better tuning of the system. A third is that by using a common, unified
-mechanism for managing allocated but currently unused chunks of memory,
-the NASD system is capable of reclaiming chunks of memory which are currently
-unused. This is especially useful in low-memory environments.
-
-
Using freelists
-
-To use freelists, be sure the memory
-module is properly initialized, and include nasd/nasd_freelist.h
.
-Freelists have type nasd_freelist_t
.
-The freelist interface is implemented as a set of macros for efficiency.
-To minimize overhead and debugging complexity, the freelist mechanism does
-not maintain additional data for individual allocations. Instead, it requires
-that users of the freelist interface provide for it typing and dereferencing
-information for the items in the freelist. This means that many of the
-freelist macros take as arguments the cast of the item type maintained in
-the list. The name of the structure or union element within this cast type
-is a pointer to the item type itself. For example, if one were
-maintaining a list of nasd_foo_t
, that could mean that:
-
-The cast for items in the freelist is (nasd_foo_t *)
. The
-pointer to the item type, henceforth referred to as the next
-pointer, is another_foo
. To minimize overhead, the freelist
-mechanism allows users to set the next pointer arbitrarily whenever
-items are not in the freelist. This is handy for items which are
-maintained in lists when they are allocated - the list pointer can then
-be reused as the next pointer.
-
-
-Sometimes, it is desirable to maintain freelists of items which do not
-naturally contain fields which are correctly-formed next pointers.
-If there is a void pointer in the item type, it is acceptable to use
-this in place of the next pointer. The preferred mechanism for dealing
-with this is to create a union
. For instance, to
-maintain a freelist of arrays of eight kilobytes of memory:
-
-In this example, next
is a valid next pointer for the freelist
-mechanism, and the data field of nasd_foo_t
is an eight kilobyte
-array.
-
-Basic freelists
-
-The most basic kind of freelist is one which maintains chunks of data whose
-contents may be arbitrary, but require no special initialization or
-deinitialization. To use such a freelist, first declare a pointer to
-type nasd_freelist_t
. Create the empty freelist by calling
-NASD_FREELIST_CREATE()
. This takes four arguments. The
-first is the freelist pointer. The second is the maximum number of these
-items which should ever reside in the freelist at a particular time (extras will be
-returned to the system immediately). The third is how many additional
-items to allocate whenever the freelist is empty and an allocation is
-desired. The final argument is the size of the item. If the freelist
-pointer is NULL
after evaluating NASD_FREELIST_CREATE()
,
-the list itself could not be created.
-
-
-It is often desirable at this point to make this newly-created freelist
-be non-empty, so that when the code begins executing, initial trips through
-not-yet-executed codepaths do not incur tremendous allocation costs. Do
-this by calling NASD_FREELIST_PRIME()
, which takes four
-arguments. The first argument is the freelist pointer. The second is the
-number of items to create and add to the list. The third is the next
-pointer, and the fourth is the item cast.
-
-
-To retrieve an item from the freelist, call NASD_FREELIST_GET()
.
-This takes four arguments. The first is the freelist pointer. The second
-is a pointer to be assigned with the address of the object retrieved from
-the freelist. The third is the next pointer, and the fourth is the item
-cast.
-
-
-To return an item to a freelist, call NASD_FREELIST_FREE()
.
-This takes three arguments. The first is the freelist pointer. The
-second is the address of the item to return. The third is the next
-pointer.
-
-
-When a freelist is no longer needed, it (along with its current contents)
-may be deallocated with NASD_FREELIST_DESTROY()
. This
-macro takes three arguments. The first is the freelist pointer. The
-second is the next pointer. The third is the item cast.
-
-
-Example: Let's say we have a type nasd_foo_t
, for which we
-wish to maintain a freelist. We might have something like:
-
-
-
-
-
Freelists with initialized items
-
-Sometimes, it is desirable to have the items in a freelist maintain
-state across allocate and free operations. For instance, each item
-might contain a mutex. Rather than initialize and destroy a mutex
-each time an item is allocated from or freed to the freelist, it is
-more desirable to initialize a mutex each time an item is created for
-the freelist, and deinitialize it whenever the item is returned to
-the system. To that end, the freelist mechanism provides variants
-on the above interfaces: NASD_FREELIST_PRIME_INIT()
,
-NASD_FREELIST_GET_INIT()
, NASD_FREELIST_FREE_CLEAN()
,
-and NASD_FREELIST_DESTROY_CLEAN()
.
-
-
-NASD_FREELIST_PRIME_INIT()
and NASD_FREELIST_GET_INIT()
-are very similar to NASD_FREELIST_PRIME()
and NASD_FREELIST_GET()
,
-respectively. Each takes an additional argument, however, which is an
-initialization function. This function should take a pointer to
-the item type as its sole argument, and return nasd_status_t
.
-If the initialization is successful, it should return NASD_SUCCESS
.
-Otherwise, it should return a meaningful error code. Likewise,
-NASD_FREELIST_FREE_CLEAN()
, and NASD_FREELIST_DESTROY_CLEAN()
-take an additional argument which is a function returning void that takes
-a pointer to the item type as its sole argument. This function is responsible
-for reversing the action of the init function. For example, if we added a mutex
-and a condition variable to nasd_foo_t
in our earlier example, we would
-get:
-
-
-Now every nasd_foo_t
resulting from a call to nasd_get_foo()
-contains validly-initialized mutex and condition variables.
-
-
-
Advanced topics
-
-Sometimes item initialization and cleanup functions might desire additional
-out-of-band data. For this reason, the _INIT
and _CLEAN
-macros also have _INIT_ARG
and _CLEAN_ARG
variants.
-These variants take an additional argument after the init or clean function
-which is passed as a second argument to the init or clean functions themselves.
-Because the freelist interface is entirely macroized, these arguments may have
-any type.
-
-
-Freelists protect against accesses by multiple threads by using internal
-mutexes. These mutexes may be accessed directly by operationg on
-NASD_FREELIST_MUTEX_OF(freelist_pointer)
. To lock
-this mutex, use NASD_FREELIST_DO_LOCK(freelist_pointer)
.
-To unlock it, use NASD_FREELIST_DO_UNLOCK(freelist_pointer)
.
-The header file nasd_freelist.h
provides variants of many of
-the freelist interfaces which do not take or release locks themselves. If
-you use this, you are responsible for correctly synchronizing access to the
-freelist. This has the opportunity for providing greater efficiency when
-batching operations, or when performing operations already protected by
-other locks.
-
-
-If NASD_FREELIST_STATS
is defined nonzero in nasd_options.h
,
-when each freelist is destroyed, statistics about operations performed on it
-are printed, including the number of times items were allocated and freed
-from the list, how many times the list ran empty and how many more items had to be
-allocated, the largest number of unused items that was ever in the list, and
-the largest number of items that was ever allocated at a time, among others.
-";
-
-char nasd_premote_ciphertext[] = "Gur pbzcvyngvba raivebazrag
-
-
- Gur pbzcvyngvba raivebazrag bs gur ANFQ gerr vgfrys hfrf
- vznxr. Gb trarengr Znxrsvyrf, eha gur vgbzs
- fpevcg ng gur gbc bs gur ANFQ gerr. Ba fbzr cyngsbezf, guvf znl
- erdhver cyngsbez-fcrpvsvp nethzragf. Nqqvgvbany nethzragf znl or
- fcrpvsvrq gb vafgehpg gur flfgrz gung vg fubhyq nyfb ohvyq
- cbegvbaf bs gur gerr juvpu ner abg ohvyg ol qrsnhyg.
-
- Nsgre gur Znxrsvyrf ner trarengrq, n znxr qrcraq sebz
- gur gbc bs gur gerr jvyy perngr nyy nhgbzngvpnyyl-trarengrq fbhepr
- svyrf, naq nqq qrcraqrapvrf gb nyy bs gur Znxrsvyrf.
-
-
- Svanyyl, znxr sebz gur gbc bs gur gerr jvyy ohvyq nyy
- qrsnhyg pbzcbaragf, naq jungrire aba-qrsnhyg pbzcbaragf jrer
- fcrpvsvrq gb vgbzs nf jryy.
-
-
- Ng nal gvzr, znxr Znxrsvyr va n qverpgbel jvyy
- ertrarengr gur Znxrsvyr sebz vgf pbeerfcbaqvat
- Vznxrsvyr. Abgr gung guvf arj Znxrsvyr
- jvyy abg vapyhqr qrcraqrapvrf; nabgure znxr qrcraq vf
- arprffnel sbe gung. znxr Znxrsvyrf jvyy ertrarengr
- Znxrsvyrf va nyy fhoqverpgbevrf bs gur pheerag qverpgbel, ohg abg
- va gur qverpgbel vgfrys. znxr qrcraq jvyy ertrarengr
- qrcraqrapvrf sbe nyy fhoqverpgbevrf nf jryy nf gur pheerag
- qverpgbel.
-
-
- Gur znxr pyrna cebqhpgvba jvyy erzbir nal trarengrq
- bowrpgf naq rkrphgnoyrf, zbfg rqvgbe onpxhc svyrf, naq
- ybpnyyl-trarengrq fbhepr svyrf va gur pheerag qverpgbel naq nyy
- fhoqverpgbevrf. Gur znxr fgrevyr cebqhpgvba jvyy erzbir
- nyy trarengrq svyrf (vapyhqvat Znxrsvyrf) va gur pheerag qverpgbel
- naq nyy fhoqverpgbevrf, nybat jvgu zbfg rqvgbe onpxhc svyrf.
-
- Pbasvthevat gur pbzcvyngvba raivebazrag sbe lbhe flfgrz
-
- Anzrf, ybpngvbaf, naq nethzragf bs flfgrz-ybpny rkrphgnoyrf ner
- fcrpvsvrq va pbasvt/ANFQ_fvgr.qrs. Sbe vafgnapr, vs
- lbhe cyngsbez unf ybpngrq frq va n abafgnaqneq
- ybpngvba, gur cngu gb svaq vg vf fcrpvsvrq ol frggvat gur
- FRQ inevnoyr va guvf svyr. Nyy flfgrz-fcrpvsvp
- pbzcvyngvba bcgvbaf fubhyq or unaqyrq urer, fhpu nf pbzcvyre
- syntf, ybpngvbaf bs rkrphgnoyrf, yvoenel cnguf, rkgen yvoenevrf gb
- yvax ntnvafg, rg prgren. Zbqvsvpngvbaf gb guvf svyr jvyy abg gnxr
- rssrpg hagvy gur eryrinag Znxrsvyrf ner ertrarengrq (frr nobir).
-
-Vagebqhpgvba
-
-Znal nccyvpngvbaf naq fhoflfgrzf jvguva gur ANFQ gerr unir n arrq gb
-qlanzvpnyyl nyybpngr naq qrnyybpngr svkrq-fvmr fgehpgherf. Gur cersreerq
-zrpunavfz sbe qbvat fb vf gur serryvfg zrpunavfz. Guvf frg bs
-vagresnprf cebivqrf fhccbeg sbe znvagnvavat cbbyf bs svkrq-fvmr puhaxf
-bs zrzbel, juvpu znl erdhver rkcyvpvg vavgvnyvmngvba naq qrvavgvnyvmngvba
-gb hfr.
-
-
-Vs n cebtenzzre jvfurf gb znvagnva pnpurf bs nyybpngrq
-ohg hahfrq zrzbel, gur serryvfg zrpunavfz fubhyq or hfrq. Gurer ner
-frireny ernfbaf sbe guvf. Bar vf gung hfvat n pbafvfgrag frg bs vagresnprf
-gb qb fb urycf bguref gb ernq pbqr gurl ner hasnzvyvne jvgu naq vqragvsl
-jung vg qbrf. Nabgure vf gung gur serryvfg zrpunavfz vf pncnoyr bs pbyyrpgvat
-naq ercbegvat fgngvfgvpf ba ubj rnpu cbby bs zrzbel jnf hfrq, nyybjvat
-orggre ghavat bs gur flfgrz. N guveq vf gung ol hfvat n pbzzba, havsvrq
-zrpunavfz sbe znantvat nyybpngrq ohg pheeragyl hahfrq puhaxf bs zrzbel,
-gur ANFQ flfgrz vf pncnoyr bs erpynvzvat puhaxf bs zrzbel juvpu ner pheeragyl
-hahfrq. Guvf vf rfcrpvnyyl hfrshy va ybj-zrzbel raivebazragf.
-
-Hfvat serryvfgf
-
-Gb hfr serryvfgf, or fher gur zrzbel
-zbqhyr vf cebcreyl vavgvnyvmrq, naq vapyhqr anfq/anfq_serryvfg.u.
-Serryvfgf unir glcr anfq_serryvfg_g.
-Gur serryvfg vagresnpr vf vzcyrzragrq nf n frg bs znpebf sbe rssvpvrapl.
-Gb zvavzvmr bireurnq naq qrohttvat pbzcyrkvgl, gur serryvfg zrpunavfz qbrf
-abg znvagnva nqqvgvbany qngn sbe vaqvivqhny nyybpngvbaf. Vafgrnq, vg erdhverf
-gung hfref bs gur serryvfg vagresnpr cebivqr sbe vg glcvat naq qrersrerapvat
-vasbezngvba sbe gur vgrzf va gur serryvfg. Guvf zrnaf gung znal bs gur
-serryvfg znpebf gnxr nf nethzragf gur pnfg bs gur vgrz glcr znvagnvarq va
-gur yvfg. Gur anzr bs gur fgehpgher be havba ryrzrag jvguva guvf pnfg glcr
-vf n cbvagre gb gur vgrz glcr vgfrys. Sbe rknzcyr, vs bar jrer
-znvagnvavat n yvfg bs anfq_sbb_g, gung pbhyq zrna gung:
-
-Tvira
-
-glcrqrs fgehpg anfq_sbb_f anfq_sbb_g;
-fgehpg anfq_sbb_f {
-&aofc;&aofc;/* npghny qngn sbe anfq_sbb_g urer */
-&aofc;&aofc;anfq_sbb_g&aofc;&aofc;*nabgure_sbb;
-};
-
-
-Gur pnfg sbe vgrzf va gur serryvfg vf (anfq_sbb_g *). Gur
-cbvagre gb gur vgrz glcr, uraprsbegu ersreerq gb nf gur arkg
-cbvagre, vf nabgure_sbb. Gb zvavzvmr bireurnq, gur serryvfg
-zrpunavfz nyybjf hfref gb frg gur arkg cbvagre neovgenevyl jurarire
-vgrzf ner abg va gur serryvfg. Guvf vf unaql sbe vgrzf juvpu ner
-znvagnvarq va yvfgf jura gurl ner nyybpngrq - gur yvfg cbvagre pna gura
-or erhfrq nf gur arkg cbvagre.
-
-
-Fbzrgvzrf, vg vf qrfvenoyr gb znvagnva serryvfgf bs vgrzf juvpu qb abg
-anghenyyl pbagnva svryqf juvpu ner pbeerpgyl-sbezrq arkg cbvagref.
-Vs gurer vf n ibvq cbvagre va gur vgrz glcr, vg vf npprcgnoyr gb hfr
-guvf va cynpr bs gur arkg cbvagre. Gur cersreerq zrpunavfz sbe qrnyvat
-jvgu guvf vf gb perngr n havba. Sbe vafgnapr, gb
-znvagnva n serryvfg bs neenlf bs rvtug xvybolgrf bs zrzbel:
-
-glcrqrs havba anfq_sbb_h anfq_sbb_g;
-havba anfq_sbb_h {
-&aofc;&aofc;pune&aofc;&aofc;&aofc;&aofc;&aofc;&aofc;&aofc;&aofc;&aofc;qngn[8192];
-&aofc;&aofc;anfq_sbb_g&aofc;&aofc;*arkg;
-};
-
-Va guvf rknzcyr, arkg vf n inyvq arkg cbvagre sbe gur serryvfg
-zrpunavfz, naq gur qngn svryq bs anfq_sbb_g vf na rvtug xvybolgr
-neenl.
-
-Onfvp serryvfgf
-
-Gur zbfg onfvp xvaq bs serryvfg vf bar juvpu znvagnvaf puhaxf bs qngn jubfr
-pbagragf znl or neovgenel, ohg erdhver ab fcrpvny vavgvnyvmngvba be
-qrvavgvnyvmngvba. Gb hfr fhpu n serryvfg, svefg qrpyner n cbvagre gb
-glcr anfq_serryvfg_g. Perngr gur rzcgl serryvfg ol pnyyvat
-ANFQ_SERRYVFG_PERNGR(). Guvf gnxrf sbhe nethzragf. Gur
-svefg vf gur serryvfg cbvagre. Gur frpbaq vf gur znkvzhz ahzore bs gurfr
-vgrzf juvpu fubhyq rire erfvqr va gur serryvfg ng n cnegvphyne gvzr (rkgenf jvyy or
-erghearq gb gur flfgrz vzzrqvngryl). Gur guveq vf ubj znal nqqvgvbany
-vgrzf gb nyybpngr jurarire gur serryvfg vf rzcgl naq na nyybpngvba vf
-qrfverq. Gur svany nethzrag vf gur fvmr bs gur vgrz. Vs gur serryvfg
-cbvagre vf AHYY nsgre rinyhngvat ANFQ_SERRYVFG_PERNGR(),
-gur yvfg vgfrys pbhyq abg or perngrq.
-
-
-Vg vf bsgra qrfvenoyr ng guvf cbvag gb znxr guvf arjyl-perngrq serryvfg
-or aba-rzcgl, fb gung jura gur pbqr ortvaf rkrphgvat, vavgvny gevcf guebhtu
-abg-lrg-rkrphgrq pbqrcnguf qb abg vaphe gerzraqbhf nyybpngvba pbfgf. Qb
-guvf ol pnyyvat ANFQ_SERRYVFG_CEVZR(), juvpu gnxrf sbhe
-nethzragf. Gur svefg nethzrag vf gur serryvfg cbvagre. Gur frpbaq vf gur
-ahzore bs vgrzf gb perngr naq nqq gb gur yvfg. Gur guveq vf gur arkg
-cbvagre, naq gur sbhegu vf gur vgrz pnfg.
-
-
-Gb ergevrir na vgrz sebz gur serryvfg, pnyy ANFQ_SERRYVFG_TRG().
-Guvf gnxrf sbhe nethzragf. Gur svefg vf gur serryvfg cbvagre. Gur frpbaq
-vf n cbvagre gb or nffvtarq jvgu gur nqqerff bs gur bowrpg ergevrirq sebz
-gur serryvfg. Gur guveq vf gur arkg cbvagre, naq gur sbhegu vf gur vgrz
-pnfg.
-
-
-Gb erghea na vgrz gb n serryvfg, pnyy ANFQ_SERRYVFG_SERR().
-Guvf gnxrf guerr nethzragf. Gur svefg vf gur serryvfg cbvagre. Gur
-frpbaq vf gur nqqerff bs gur vgrz gb erghea. Gur guveq vf gur arkg
-cbvagre.
-
-
-Jura n serryvfg vf ab ybatre arrqrq, vg (nybat jvgu vgf pheerag pbagragf)
-znl or qrnyybpngrq jvgu ANFQ_SERRYVFG_QRFGEBL(). Guvf
-znpeb gnxrf guerr nethzragf. Gur svefg vf gur serryvfg cbvagre. Gur
-frpbaq vf gur arkg cbvagre. Gur guveq vf gur vgrz pnfg.
-
-
-Rknzcyr: Yrg'f fnl jr unir n glcr anfq_sbb_g, sbe juvpu jr
-jvfu gb znvagnva n serryvfg. Jr zvtug unir fbzrguvat yvxr:
-
-glcrqrs fgehpg anfq_sbb_f anfq_sbb_g;
-fgehpg anfq_sbb_f {
-&aofc;&aofc;/* npghny qngn sbe anfq_sbb_g urer */
-&aofc;&aofc;anfq_sbb_g&aofc;&aofc;*nabgure_sbb;
-};
-
-anfq_serryvfg_g *anfq_sbb_serryvfg;
-#qrsvar ANFQ_ZNK_SERR_SBB 1024 /* Znkvzhz ahzore bs sbbf
- * gb unir va gur serryvfg
- * ng n gvzr
- */
-#qrsvar ANFQ_SBB_VAP 64 /* Ubj znal sbbf gb nqq gb
- * gur serryvfg ng n gvzr
- * jura jr eha bhg
- */
-#qrsvar ANFQ_SBB_VAVGVNY 32 /* Ubj znal sbbf gb perngr
- * ng fgneg bs qnl
- */
-
-anfq_fgnghf_g
-anfq_vavg_sbb_serryvfg()
-{
- ANFQ_SERRYVFG_PERNGR(anfq_sbb_serryvfg, ANFQ_ZNK_SERR_SBB,
- ANFQ_SBB_VAP, fvmrbs(anfq_sbb_g));
- vs (anfq_sbb_serryvfg == AHYY) {
- erghea(ANFQ_AB_ZRZ);
- }
-
- ANFQ_SERRYVFG_CEVZR(anfq_sbb_serryvfg, ANFQ_SBB_VAVGVNY,arkg,
- (anfq_sbb_g *));
-
- erghea(ANFQ_FHPPRFF);
-}
-
-anfq_fgnghf_g
-anfq_trg_sbb(
-&aofc;&aofc;anfq_sbb_g&aofc;&aofc;**sbb_c)
-{
- ANFQ_SERRYVFG_TRG(anfq_sbb_serryvfg,*sbb_c,arkg,(anfq_sbb_g *));
- vs (*sbb_c == AHYY)
- erghea(ANFQ_AB_ZRZ);
- erghea(ANFQ_FHPPRFF);
-}
-
-ibvq
-anfq_serr_sbb(
-&aofc;&aofc;anfq_sbb_g&aofc;&aofc;*sbb)
-{
- ANFQ_SERRYVFG_SERR(anfq_sbb_serryvfg,sbb,arkg);
-}
-
-ibvq
-anfq_fuhgqbja_sbb_serryvfg()
-{
- ANFQ_SERRYVFG_QRFGEBL(anfq_sbb_serryvfg,arkg,(anfq_sbb_g *));
-}
-
-
-
-
-Serryvfgf jvgu vavgvnyvmrq vgrzf
-
-Fbzrgvzrf, vg vf qrfvenoyr gb unir gur vgrzf va n serryvfg znvagnva
-fgngr npebff nyybpngr naq serr bcrengvbaf. Sbe vafgnapr, rnpu vgrz
-zvtug pbagnva n zhgrk. Engure guna vavgvnyvmr naq qrfgebl n zhgrk
-rnpu gvzr na vgrz vf nyybpngrq sebz be serrq gb gur serryvfg, vg vf
-zber qrfvenoyr gb vavgvnyvmr n zhgrk rnpu gvzr na vgrz vf perngrq sbe
-gur serryvfg, naq qrvavgvnyvmr vg jurarire gur vgrz vf erghearq gb
-gur flfgrz. Gb gung raq, gur serryvfg zrpunavfz cebivqrf inevnagf
-ba gur nobir vagresnprf: ANFQ_SERRYVFG_CEVZR_VAVG(),
-ANFQ_SERRYVFG_TRG_VAVG(), ANFQ_SERRYVFG_SERR_PYRNA(),
-naq ANFQ_SERRYVFG_QRFGEBL_PYRNA().
-
-
-ANFQ_SERRYVFG_CEVZR_VAVG() naq ANFQ_SERRYVFG_TRG_VAVG()
-ner irel fvzvyne gb ANFQ_SERRYVFG_CEVZR() naq ANFQ_SERRYVFG_TRG(),
-erfcrpgviryl. Rnpu gnxrf na nqqvgvbany nethzrag, ubjrire, juvpu vf na
-vavgvnyvmngvba shapgvba. Guvf shapgvba fubhyq gnxr n cbvagre gb
-gur vgrz glcr nf vgf fbyr nethzrag, naq erghea anfq_fgnghf_g.
-Vs gur vavgvnyvmngvba vf fhpprffshy, vg fubhyq erghea ANFQ_FHPPRFF.
-Bgurejvfr, vg fubhyq erghea n zrnavatshy reebe pbqr. Yvxrjvfr,
-ANFQ_SERRYVFG_SERR_PYRNA(), naq ANFQ_SERRYVFG_QRFGEBL_PYRNA()
-gnxr na nqqvgvbany nethzrag juvpu vf n shapgvba ergheavat ibvq gung gnxrf
-n cbvagre gb gur vgrz glcr nf vgf fbyr nethzrag. Guvf shapgvba vf erfcbafvoyr
-sbe erirefvat gur npgvba bs gur vavg shapgvba. Sbe rknzcyr, vs jr nqqrq n zhgrk
-naq n pbaqvgvba inevnoyr gb anfq_sbb_g va bhe rneyvre rknzcyr, jr jbhyq
-trg:
-
-glcrqrs fgehpg anfq_sbb_f anfq_sbb_g;
-fgehpg anfq_sbb_f {
-&aofc;&aofc;ANFQ_QRPYNER_ZHGRK(zhgrk)
-&aofc;&aofc;ANFQ_QRPYNER_PBAQ(pbaq)
-&aofc;&aofc;/* bgure qngn sbe anfq_sbb_g urer */
-&aofc;&aofc;anfq_sbb_g&aofc;&aofc;*nabgure_sbb;
-};
-
-anfq_serryvfg_g *anfq_sbb_serryvfg;
-#qrsvar ANFQ_ZNK_SERR_SBB 1024 /* Znkvzhz ahzore bs sbbf
- * gb unir va gur serryvfg
- * ng n gvzr
- */
-#qrsvar ANFQ_SBB_VAP 64 /* Ubj znal sbbf gb nqq gb
- * gur serryvfg ng n gvzr
- * jura jr eha bhg
- */
-#qrsvar ANFQ_SBB_VAVGVNY 32 /* Ubj znal sbbf gb perngr
- * ng fgneg bs qnl
- */
-
-fgngvp anfq_fgnghf_g
-vavg_sbb(
- anfq_sbb_g *sbb)
-{
- anfq_fgnghf_g ep;
-
- ep = anfq_zhgrk_vavg(&sbb->ybpx);
- vs (ep)
- erghea(ep);
- ep = anfq_pbaq_vavg(&sbb->pbaq);
- vs (ep) {
- anfq_zhgrk_qrfgebl(&sbb->ybpx);
- erghea(ep);
- }
- erghea(ANFQ_FHPPRFF);
-}
-
-fgngvp ibvq
-pyrna_sbb(
- anfq_sbb_g *sbb)
-{
- anfq_fgnghf_g ep;
-
- ep = anfq_zhgrk_qrfgebl(&sbb->ybpx);
- vs (ep) {
- cevags(JNEAVAT: tbg 0k%k (%f) qrfgeblvat sbb ybpxa,
- ep, anfq_reebe_fgevat(ep));
- }
- ep = anfq_pbaq_qrfgebl(&sbb->pbaq);
- vs (ep) {
- cevags(JNEAVAT: tbg 0k%k (%f) qrfgeblvat sbb pbaqa,
- ep, anfq_reebe_fgevat(ep));
- }
-}
-
-anfq_fgnghf_g
-anfq_vavg_sbb_serryvfg()
-{
- ANFQ_SERRYVFG_PERNGR(anfq_sbb_serryvfg, ANFQ_ZNK_SERR_SBB,
- ANFQ_SBB_VAP, fvmrbs(anfq_sbb_g));
- vs (anfq_sbb_serryvfg == AHYY) {
- erghea(ANFQ_AB_ZRZ);
- }
-
- ANFQ_SERRYVFG_CEVZR_VAVG(anfq_sbb_serryvfg, ANFQ_SBB_VAVGVNY, arkg,
- (anfq_sbb_g *), vavg_sbb);
-
- erghea(ANFQ_FHPPRFF);
-}
-
-anfq_fgnghf_g
-anfq_trg_sbb(
-&aofc;&aofc;anfq_sbb_g&aofc;&aofc;**sbb_c)
-{
- ANFQ_SERRYVFG_TRG_VAVG(anfq_sbb_serryvfg, *sbb_c,
- arkg, (anfq_sbb_g *), vavg_sbb);
- vs (*sbb_c == AHYY)
- erghea(ANFQ_AB_ZRZ);
- erghea(ANFQ_FHPPRFF);
-}
-
-ibvq
-anfq_serr_sbb(
-&aofc;&aofc;anfq_sbb_g&aofc;&aofc;*sbb)
-{
- ANFQ_SERRYVFG_SERR_PYRNA(anfq_sbb_serryvfg, sbb, arkg, pyrna_sbb);
-}
-
-ibvq
-anfq_fuhgqbja_sbb_serryvfg()
-{
- ANFQ_SERRYVFG_QRFGEBL(anfq_sbb_serryvfg, arkg, (anfq_sbb_g *), pyrna_sbb);
-}
-
-
-Abj rirel anfq_sbb_g erfhygvat sebz n pnyy gb anfq_trg_sbb()
-pbagnvaf inyvqyl-vavgvnyvmrq zhgrk naq pbaqvgvba inevnoyrf.
-
-
-Nqinaprq gbcvpf
-
-Fbzrgvzrf vgrz vavgvnyvmngvba naq pyrnahc shapgvbaf zvtug qrfver nqqvgvbany
-bhg-bs-onaq qngn. Sbe guvf ernfba, gur _VAVG naq _PYRNA
-znpebf nyfb unir _VAVG_NET naq _PYRNA_NET inevnagf.
-Gurfr inevnagf gnxr na nqqvgvbany nethzrag nsgre gur vavg be pyrna shapgvba
-juvpu vf cnffrq nf n frpbaq nethzrag gb gur vavg be pyrna shapgvbaf gurzfryirf.
-Orpnhfr gur serryvfg vagresnpr vf ragveryl znpebvmrq, gurfr nethzragf znl unir
-nal glcr.
-
-
-Serryvfgf cebgrpg ntnvafg npprffrf ol zhygvcyr guernqf ol hfvat vagreany
-zhgrkrf. Gurfr zhgrkrf znl or npprffrq qverpgyl ol bcrengvbat ba
-ANFQ_SERRYVFG_ZHGRK_BS(serryvfg_cbvagre). Gb ybpx
-guvf zhgrk, hfr ANFQ_SERRYVFG_QB_YBPX(serryvfg_cbvagre).
-Gb haybpx vg, hfr ANFQ_SERRYVFG_QB_HAYBPX(serryvfg_cbvagre).
-Gur urnqre svyr anfq_serryvfg.u cebivqrf inevnagf bs znal bs
-gur serryvfg vagresnprf juvpu qb abg gnxr be eryrnfr ybpxf gurzfryirf. Vs
-lbh hfr guvf, lbh ner erfcbafvoyr sbe pbeerpgyl flapuebavmvat npprff gb gur
-serryvfg. Guvf unf gur bccbeghavgl sbe cebivqvat terngre rssvpvrapl jura
-ongpuvat bcrengvbaf, be jura cresbezvat bcrengvbaf nyernql cebgrpgrq ol
-bgure ybpxf.
-
-
-Vs ANFQ_SERRYVFG_FGNGF vf qrsvarq abamreb va anfq_bcgvbaf.u,
-jura rnpu serryvfg vf qrfgeblrq, fgngvfgvpf nobhg bcrengvbaf cresbezrq ba vg
-ner cevagrq, vapyhqvat gur ahzore bs gvzrf vgrzf jrer nyybpngrq naq serrq
-sebz gur yvfg, ubj znal gvzrf gur yvfg ena rzcgl naq ubj znal zber vgrzf unq gb or
-nyybpngrq, gur ynetrfg ahzore bs hahfrq vgrzf gung jnf rire va gur yvfg, naq
-gur ynetrfg ahzore bs vgrzf gung jnf rire nyybpngrq ng n gvzr, nzbat bguref.
-";
-
-
-
-