#include "wizard/studio.h"#include "wizard/exception.h"#include "wizard/exception-private.h"#include "wizard/hashmap.h"#include "wizard/log.h"#include "wizard/memory_.h"#include "wizard/option.h"#include "wizard/random_.h"#include "wizard/resource_.h"#include "wizard/semaphore.h"#include "wizard/signature.h"#include "wizard/splay-tree.h"#include "wizard/string_.h"#include "wizard/string-private.h"#include "wizard/token.h"#include "wizard/utility.h"
Go to the source code of this file.
| #define O_NOFOLLOW 0 |
Referenced by AcquireUniqueFileResource().
| #define TMP_MAX 238328 |
Referenced by AcquireUniqueFileResource().
| #define WizardResourceInfinity (~0UL) |
Definition at line 62 of file resource.c.
Referenced by AcquireWizardResource().
| typedef struct _ResourceInfo ResourceInfo |
| WizardExport WizardBooleanType AcquireUniqueFilename | ( | char * | path, | |
| ExceptionInfo * | exception | |||
| ) |
Definition at line 136 of file resource.c.
References AcquireUniqueFileResource(), close, GetWizardModule, ResourceError, ThrowWizardException(), WizardFalse, and WizardTrue.
| WizardExport int AcquireUniqueFileResource | ( | const char * | path, | |
| char * | filename, | |||
| ExceptionInfo * | exception | |||
| ) |
Definition at line 246 of file resource.c.
References AcquireRandomInfo(), AcquireSemaphoreInfo(), AcquireWizardResource(), AddValueToSplayTree(), close, CompareSplayTreeString(), ConstantString(), DestroyStringInfo(), DestroyTemporaryResources(), FileResource, GetPathTemplate(), GetRandomKey(), GetStringInfoDatum(), GetStringInfoLength(), GetWizardModule, LockSemaphoreInfo(), LogWizardEvent(), NewSplayTree(), O_BINARY, O_NOFOLLOW, open, random_info, RelinquishWizardMemory(), resource_semaphore, ResourceDomain, ResourceError, ResourceEvent, S_MODE, SHA256Hash, temporary_resources, ThrowWizardException(), TMP_MAX, UnlockSemaphoreInfo(), WizardAssert, and WizardFalse.
Referenced by AcquireUniqueFilename().
| WizardExport WizardBooleanType AcquireWizardResource | ( | const ResourceType | type, | |
| const WizardSizeType | size | |||
| ) |
Definition at line 362 of file resource.c.
References AcquireSemaphoreInfo(), _ResourceInfo::area, _ResourceInfo::area_limit, AreaResource, _ResourceInfo::disk, _ResourceInfo::disk_limit, DiskResource, _ResourceInfo::file, _ResourceInfo::file_limit, FileResource, FormatWizardSize(), GetWizardModule, LockSemaphoreInfo(), LogWizardEvent(), _ResourceInfo::map, _ResourceInfo::map_limit, MapResource, _ResourceInfo::memory, _ResourceInfo::memory_limit, MemoryResource, resource_info, resource_semaphore, ResourceEvent, UnlockSemaphoreInfo(), WizardFalse, WizardOptionToMnemonic(), WizardResourceInfinity, WizardResourceOptions, and WizardTrue.
Referenced by AcquireUniqueFileResource().
| WizardExport void AsynchronousResourceComponentTerminus | ( | void | ) |
Definition at line 477 of file resource.c.
References DestroyRandomInfo(), GetNextKeyInSplayTree(), random_info, ResetSplayTreeIterator(), and temporary_resources.
Referenced by WizardSignalHandler().
| static void* DestroyTemporaryResources | ( | void * | temporary_resource | ) | [static] |
Definition at line 180 of file resource.c.
Referenced by AcquireUniqueFileResource().
| static WizardBooleanType GetPathTemplate | ( | const char * | path, | |
| char * | filename | |||
| ) | [static] |
Definition at line 186 of file resource.c.
References ConstantString(), CopyWizardString(), DirectorySeparator, FormatWizardString(), GetEnvironmentValue(), RelinquishWizardMemory(), S_ISDIR, and WizardTrue.
Referenced by AcquireUniqueFileResource().
| WizardExport WizardSizeType GetWizardResource | ( | const ResourceType | type | ) |
Definition at line 520 of file resource.c.
References AcquireSemaphoreInfo(), _ResourceInfo::area, AreaResource, _ResourceInfo::disk, DiskResource, _ResourceInfo::file, FileResource, LockSemaphoreInfo(), _ResourceInfo::map, MapResource, _ResourceInfo::memory, MemoryResource, resource_info, resource_semaphore, and UnlockSemaphoreInfo().
| WizardExport WizardSizeType GetWizardResourceLimit | ( | const ResourceType | type | ) |
Definition at line 585 of file resource.c.
References AcquireSemaphoreInfo(), _ResourceInfo::area_limit, AreaResource, _ResourceInfo::disk_limit, DiskResource, _ResourceInfo::file_limit, FileResource, LockSemaphoreInfo(), _ResourceInfo::map_limit, MapResource, _ResourceInfo::memory_limit, MemoryResource, resource_info, resource_semaphore, and UnlockSemaphoreInfo().
| WizardExport WizardBooleanType ListWizardResourceInfo | ( | FILE * | file, | |
| ExceptionInfo * | wizard_unusedexception | |||
| ) |
Definition at line 653 of file resource.c.
References AcquireSemaphoreInfo(), _ResourceInfo::area_limit, _ResourceInfo::disk_limit, _ResourceInfo::file_limit, FormatWizardSize(), LockSemaphoreInfo(), _ResourceInfo::map_limit, _ResourceInfo::memory_limit, resource_info, resource_semaphore, UnlockSemaphoreInfo(), WizardFalse, and WizardTrue.
| WizardExport WizardBooleanType RelinquishUniqueFileResource | ( | const char * | path, | |
| const WizardBooleanType | trash | |||
| ) |
Definition at line 798 of file resource.c.
References DeleteNodeFromSplayTree(), GetNextKeyInSplayTree(), GetWizardModule, LocaleCompare(), LogWizardEvent(), ResetSplayTreeIterator(), ResourceDomain, ResourceEvent, temporary_resources, WizardAssert, WizardFalse, and WizardTrue.
| WizardExport void RelinquishWizardResource | ( | const ResourceType | type, | |
| const WizardSizeType | size | |||
| ) |
Definition at line 705 of file resource.c.
References AcquireSemaphoreInfo(), _ResourceInfo::area, _ResourceInfo::area_limit, AreaResource, _ResourceInfo::disk, _ResourceInfo::disk_limit, DiskResource, _ResourceInfo::file, _ResourceInfo::file_limit, FileResource, FormatWizardSize(), GetWizardModule, LockSemaphoreInfo(), LogWizardEvent(), _ResourceInfo::map, _ResourceInfo::map_limit, MapResource, _ResourceInfo::memory, _ResourceInfo::memory_limit, MemoryResource, resource_info, resource_semaphore, ResourceEvent, UnlockSemaphoreInfo(), WizardFalse, WizardOptionToMnemonic(), WizardResourceOptions, and WizardTrue.
| WizardExport WizardBooleanType ResourceComponentGenesis | ( | void | ) |
Definition at line 850 of file resource.c.
References _SC_OPEN_MAX, _SC_PAGESIZE, _SC_PHYS_PAGES, AcquireSemaphoreInfo(), AreaResource, DestroyString(), DiskResource, FileResource, GetEnvironmentValue(), MapResource, MemoryResource, resource_semaphore, SetWizardResourceLimit(), StringToUnsignedLong(), sysconf, WizardMax(), and WizardTrue.
Referenced by WizardsToolkitGenesis().
| WizardExport void ResourceComponentTerminus | ( | void | ) |
Definition at line 945 of file resource.c.
References AcquireSemaphoreInfo(), DestroySemaphoreInfo(), DestroySplayTree(), LockSemaphoreInfo(), resource_semaphore, temporary_resources, and UnlockSemaphoreInfo().
Referenced by WizardsToolkitTerminus().
| WizardExport WizardBooleanType SetWizardResourceLimit | ( | const ResourceType | type, | |
| const WizardSizeType | limit | |||
| ) |
Definition at line 981 of file resource.c.
References AcquireSemaphoreInfo(), _ResourceInfo::area_limit, AreaResource, _ResourceInfo::disk_limit, DiskResource, _ResourceInfo::file_limit, FileResource, LockSemaphoreInfo(), _ResourceInfo::map_limit, MapResource, _ResourceInfo::memory_limit, MemoryResource, resource_info, resource_semaphore, UnlockSemaphoreInfo(), and WizardTrue.
Referenced by ResourceComponentGenesis().
| static ssize_t WizardMax | ( | const ssize_t | x, | |
| const ssize_t | y | |||
| ) | [inline, static] |
Definition at line 843 of file resource.c.
Referenced by ResourceComponentGenesis().
RandomInfo* random_info = (RandomInfo *) NULL [static] |
Definition at line 88 of file resource.c.
Referenced by AcquireRandomInfo(), AcquireUniqueFileResource(), and AsynchronousResourceComponentTerminus().
ResourceInfo resource_info [static] |
{
WizardULLConstant(0),
WizardULLConstant(0),
WizardULLConstant(0),
WizardULLConstant(0),
WizardULLConstant(0),
WizardULLConstant(2048)*1024*1024,
WizardULLConstant(1536)*1024*1024,
WizardULLConstant(8192)*1024*1024,
WizardResourceInfinity,
WizardULLConstant(768)
}
Definition at line 91 of file resource.c.
Referenced by AcquireWizardResource(), GetWizardResource(), GetWizardResourceLimit(), ListWizardResourceInfo(), RelinquishWizardResource(), and SetWizardResourceLimit().
SemaphoreInfo* resource_semaphore = (SemaphoreInfo *) NULL [static] |
Definition at line 106 of file resource.c.
Referenced by AcquireUniqueFileResource(), AcquireWizardResource(), GetWizardResource(), GetWizardResourceLimit(), ListWizardResourceInfo(), RelinquishWizardResource(), ResourceComponentGenesis(), ResourceComponentTerminus(), and SetWizardResourceLimit().
SplayTreeInfo* temporary_resources = (SplayTreeInfo *) NULL [static] |
Definition at line 109 of file resource.c.
Referenced by AcquireUniqueFileResource(), AsynchronousResourceComponentTerminus(), RelinquishUniqueFileResource(), and ResourceComponentTerminus().
1.6.2-20100208