|
WizardsToolkit
1.0.7
|
#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"#include "wizard/utility-private.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 63 of file resource.c.
Referenced by AcquireWizardResource(), and ListWizardResourceInfo().
| typedef struct _ResourceInfo ResourceInfo |
| WizardExport WizardBooleanType AcquireUniqueFilename | ( | char * | path, |
| ExceptionInfo * | exception | ||
| ) |
Definition at line 137 of file resource.c.
References AcquireUniqueFileResource(), WizardFalse, close, ThrowWizardException(), GetWizardModule, ResourceError, and WizardTrue.
| WizardExport int AcquireUniqueFileResource | ( | const char * | path, |
| char * | filename, | ||
| ExceptionInfo * | exception | ||
| ) |
Definition at line 248 of file resource.c.
References WizardAssert, ResourceDomain, LogWizardEvent(), ResourceEvent, GetWizardModule, random_info, AcquireRandomInfo(), SHA256Hash, TMP_MAX, GetPathTemplate(), GetRandomKey(), GetStringInfoDatum(), GetStringInfoLength(), DestroyStringInfo(), setmode, O_BINARY, open_utf8(), O_NOFOLLOW, S_MODE, AcquireWizardResource(), FileResource, WizardFalse, close, ThrowWizardException(), ResourceError, remove_utf8(), resource_semaphore, AcquireSemaphoreInfo(), LockSemaphoreInfo(), temporary_resources, NewSplayTree(), CompareSplayTreeString(), DestroyTemporaryResources(), UnlockSemaphoreInfo(), AddValueToSplayTree(), and ConstantString().
Referenced by AcquireUniqueFilename().
| WizardExport WizardBooleanType AcquireWizardResource | ( | const ResourceType | type, |
| const WizardSizeType | size | ||
| ) |
Definition at line 373 of file resource.c.
References MaxTextExtent, WizardFalse, FormatWizardSize(), resource_semaphore, AcquireSemaphoreInfo(), LockSemaphoreInfo(), AreaResource, resource_info, _ResourceInfo::area, _ResourceInfo::area_limit, WizardResourceInfinity, WizardTrue, MemoryResource, _ResourceInfo::memory, _ResourceInfo::memory_limit, MapResource, _ResourceInfo::map, _ResourceInfo::map_limit, DiskResource, _ResourceInfo::disk, _ResourceInfo::disk_limit, FileResource, _ResourceInfo::file, _ResourceInfo::file_limit, UnlockSemaphoreInfo(), LogWizardEvent(), ResourceEvent, GetWizardModule, WizardOptionToMnemonic(), and WizardResourceOptions.
Referenced by AcquireUniqueFileResource().
| WizardExport void AsynchronousResourceComponentTerminus | ( | void | ) |
Definition at line 488 of file resource.c.
References temporary_resources, ResetSplayTreeIterator(), GetNextKeyInSplayTree(), remove_utf8(), random_info, and DestroyRandomInfo().
Referenced by WizardSignalHandler().
| static void* DestroyTemporaryResources | ( | void * | temporary_resource | ) | [static] |
Definition at line 181 of file resource.c.
References remove_utf8(), and DestroyString().
Referenced by AcquireUniqueFileResource().
| static WizardBooleanType GetPathTemplate | ( | const char * | path, |
| char * | filename | ||
| ) | [static] |
Definition at line 188 of file resource.c.
References stat, CopyWizardString(), MaxTextExtent, ConstantString(), GetEnvironmentValue(), WizardTrue, RelinquishWizardMemory(), stat_utf8(), S_ISDIR, DirectorySeparator, and FormatLocaleString().
Referenced by AcquireUniqueFileResource().
| WizardExport WizardSizeType GetWizardResource | ( | const ResourceType | type | ) |
Definition at line 531 of file resource.c.
References resource_semaphore, AcquireSemaphoreInfo(), LockSemaphoreInfo(), AreaResource, resource_info, _ResourceInfo::area, MemoryResource, _ResourceInfo::memory, MapResource, _ResourceInfo::map, DiskResource, _ResourceInfo::disk, FileResource, _ResourceInfo::file, and UnlockSemaphoreInfo().
| WizardExport WizardSizeType GetWizardResourceLimit | ( | const ResourceType | type | ) |
Definition at line 597 of file resource.c.
References resource_semaphore, AcquireSemaphoreInfo(), LockSemaphoreInfo(), AreaResource, resource_info, _ResourceInfo::area_limit, MemoryResource, _ResourceInfo::memory_limit, MapResource, _ResourceInfo::map_limit, DiskResource, _ResourceInfo::disk_limit, FileResource, _ResourceInfo::file_limit, and UnlockSemaphoreInfo().
| WizardExport WizardBooleanType ListWizardResourceInfo | ( | FILE * | file, |
| ExceptionInfo * | wizard_unusedexception | ||
| ) |
Definition at line 665 of file resource.c.
References MaxTextExtent, resource_semaphore, AcquireSemaphoreInfo(), LockSemaphoreInfo(), FormatWizardSize(), resource_info, _ResourceInfo::area_limit, WizardFalse, _ResourceInfo::map_limit, WizardTrue, _ResourceInfo::memory_limit, CopyWizardString(), _ResourceInfo::disk_limit, WizardResourceInfinity, _ResourceInfo::file_limit, and UnlockSemaphoreInfo().
| WizardExport WizardBooleanType RelinquishUniqueFileResource | ( | const char * | path, |
| const WizardBooleanType | trash | ||
| ) |
Definition at line 812 of file resource.c.
References WizardAssert, ResourceDomain, LogWizardEvent(), ResourceEvent, GetWizardModule, temporary_resources, ResetSplayTreeIterator(), GetNextKeyInSplayTree(), LocaleCompare(), DeleteNodeFromSplayTree(), WizardFalse, WizardTrue, and remove_utf8().
| WizardExport void RelinquishWizardResource | ( | const ResourceType | type, |
| const WizardSizeType | size | ||
| ) |
Definition at line 719 of file resource.c.
References MaxTextExtent, FormatWizardSize(), WizardFalse, resource_semaphore, AcquireSemaphoreInfo(), LockSemaphoreInfo(), AreaResource, resource_info, _ResourceInfo::area, _ResourceInfo::area_limit, MemoryResource, _ResourceInfo::memory, WizardTrue, _ResourceInfo::memory_limit, MapResource, _ResourceInfo::map, _ResourceInfo::map_limit, DiskResource, _ResourceInfo::disk, _ResourceInfo::disk_limit, FileResource, _ResourceInfo::file, _ResourceInfo::file_limit, UnlockSemaphoreInfo(), LogWizardEvent(), ResourceEvent, GetWizardModule, WizardOptionToMnemonic(), and WizardResourceOptions.
| WizardExport WizardBooleanType ResourceComponentGenesis | ( | void | ) |
Definition at line 864 of file resource.c.
References AcquireSemaphoreInfo(), resource_semaphore, sysconf, _SC_PAGESIZE, _SC_PHYS_PAGES, SetWizardResourceLimit(), AreaResource, MemoryResource, MapResource, GetEnvironmentValue(), StringToUnsignedLong(), DestroyString(), DiskResource, _SC_OPEN_MAX, FileResource, WizardMax(), and WizardTrue.
Referenced by WizardsToolkitGenesis().
| WizardExport void ResourceComponentTerminus | ( | void | ) |
Definition at line 959 of file resource.c.
References resource_semaphore, AcquireSemaphoreInfo(), LockSemaphoreInfo(), temporary_resources, DestroySplayTree(), UnlockSemaphoreInfo(), and DestroySemaphoreInfo().
Referenced by WizardsToolkitTerminus().
| WizardExport WizardBooleanType SetWizardResourceLimit | ( | const ResourceType | type, |
| const WizardSizeType | limit | ||
| ) |
Definition at line 995 of file resource.c.
References resource_semaphore, AcquireSemaphoreInfo(), LockSemaphoreInfo(), AreaResource, resource_info, _ResourceInfo::area_limit, MemoryResource, _ResourceInfo::memory_limit, MapResource, _ResourceInfo::map_limit, DiskResource, _ResourceInfo::disk_limit, FileResource, _ResourceInfo::file_limit, UnlockSemaphoreInfo(), and WizardTrue.
Referenced by ResourceComponentGenesis().
| static ssize_t WizardMax | ( | const ssize_t | x, |
| const ssize_t | y | ||
| ) | [inline, static] |
Definition at line 857 of file resource.c.
Referenced by ResourceComponentGenesis().
RandomInfo* random_info = (RandomInfo *) NULL [static] |
Definition at line 89 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(1536)*1024*1024/sizeof(void *),
WizardULLConstant(1536)*1024*1024,
WizardULLConstant(3072)*1024*1024,
WizardResourceInfinity,
WizardULLConstant(768)
}
Definition at line 92 of file resource.c.
Referenced by AcquireWizardResource(), GetWizardResource(), GetWizardResourceLimit(), ListWizardResourceInfo(), RelinquishWizardResource(), and SetWizardResourceLimit().
SemaphoreInfo* resource_semaphore = (SemaphoreInfo *) NULL [static] |
Definition at line 107 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 110 of file resource.c.
Referenced by AcquireUniqueFileResource(), AsynchronousResourceComponentTerminus(), RelinquishUniqueFileResource(), and ResourceComponentTerminus().