63#define WizardResourceInfinity (~0UL)
146 if (close(file) == -1)
148 "unable to close file `%s': %s",path,strerror(errno));
184 temporary_resource=
DestroyString((
char *) temporary_resource);
185 return((
void *) NULL);
203 "wizard-%.20gXXXXXXXXXXXX",(
double) getpid());
204 if ((path == (
const char *) NULL) || (*path !=
'\0'))
209 if (directory == (
char *) NULL)
211#if defined(WIZARDSTOOLKIT_WINDOWS_SUPPORT) || defined(__OS2__) || defined(__CYGWIN__)
212 if (directory == (
char *) NULL)
214 if (directory == (
char *) NULL)
218 if (directory == (
char *) NULL)
221 if (directory == (
char *) NULL)
230 if ((status != 0) || !
S_ISDIR(file_info.st_mode))
237 "%swizard-%.20gXXXXXXXXXXXX",directory,(
double) getpid());
244 for (p=filename; *p !=
'\0'; p++)
253#if !defined(O_NOFOLLOW)
257# define TMP_MAX 238328
271 portable_filename[] =
272 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";
291 for (i=0; i < (ssize_t)
TMP_MAX; i++)
301 p=filename+strlen(filename)-12;
305 c=(int) (datum[j] & 0x3f);
306 *p++=portable_filename[c];
309#if defined(WIZARDSTOOLKIT_HAVE_MKSTEMP)
310 file=mkstemp(filename);
313#if defined(WIZARDSTOOLKIT_HAVE_FCHMOD)
314 (void) fchmod(file,0600);
323 p=filename+strlen(filename)-12;
327 c=(int) (datum[j] & 0x3f);
328 *p++=portable_filename[c];
333 if ((file >= 0) || (errno != EEXIST))
341 if (close(file) == -1)
343 "unable to close file `%s': %s",filename,strerror(errno));
346 "unable to remove file `%s': %s",filename,strerror(errno));
357 (
const void *) NULL);
487 resource_request,resource_current,resource_limit);
523 while (path != (
const char *) NULL)
697 if (file == (
const FILE *) NULL)
712 (void) fprintf(file,
"File Area Memory Map Disk\n");
713 (void) fprintf(file,
"----------------------------------------------------\n");
714 (void) fprintf(file,
"%4g %9s %9s %9s %9s\n",(
double)
815 resource_request,resource_current,resource_limit);
855 while (p != (
char *) NULL)
861 if (p != (
char *) NULL)
906#if defined(WIZARDSTOOLKIT_HAVE_SYSCONF) && defined(_SC_PAGESIZE)
907 pagesize=sysconf(_SC_PAGESIZE);
908#elif defined(WIZARDSTOOLKIT_HAVE_GETPAGESIZE) && defined(POSIX)
909 pagesize=getpagesize();
912#if defined(WIZARDSTOOLKIT_HAVE_SYSCONF) && defined(_SC_PHYS_PAGES)
913 pages=sysconf(_SC_PHYS_PAGES);
915 memory=(size_t) ((pages+512)/1024)*((pagesize+512)/1024);
916 if ((pagesize <= 0) || (pages <= 0))
918#if defined(PixelCacheThreshold)
919 memory=PixelCacheThreshold;
925 if (limit != (
char *) NULL)
931 if (limit != (
char *) NULL)
937 if (limit != (
char *) NULL)
943 if (limit != (
char *) NULL)
949#if defined(WIZARDSTOOLKIT_HAVE_SYSCONF) && defined(_SC_OPEN_MAX)
950 files=sysconf(_SC_OPEN_MAX);
951#elif defined(WIZARDSTOOLKIT_HAVE_GETDTABLESIZE) && defined(POSIX)
952 files=getdtablesize();
957 if (limit != (
char *) NULL)
#define WizardAssert(domain, predicate)
WizardExport WizardBooleanType ThrowWizardException(ExceptionInfo *exception, const char *module, const char *function, const size_t line, const ExceptionType severity, const char *format,...)
WizardExport ssize_t FormatLocaleString(char *string, const size_t length, const char *format,...)
WizardBooleanType LogWizardEvent(const LogEventType type, const char *module, const char *function, const size_t line, const char *format,...)
#define GetWizardModule()
WizardExport void * RelinquishWizardMemory(void *memory)
WizardExport const char * WizardOptionToMnemonic(const WizardOption option, const ssize_t type)
WizardExport RandomInfo * AcquireRandomInfo(const HashType hash)
WizardExport StringInfo * GetRandomKey(RandomInfo *random_info, const size_t length)
WizardExport RandomInfo * DestroyRandomInfo(RandomInfo *random_info)
WizardExport WizardSizeType GetWizardResourceLimit(const ResourceType type)
WizardExport WizardBooleanType GetPathTemplate(const char *path, char *filename)
static void * DestroyTemporaryResources(void *temporary_resource)
WizardExport WizardBooleanType ResourceComponentGenesis(void)
WizardExport WizardBooleanType ListWizardResourceInfo(FILE *file, ExceptionInfo *wizard_unused(exception))
static ResourceInfo resource_info
WizardExport WizardSizeType GetWizardResource(const ResourceType type)
WizardExport WizardBooleanType SetWizardResourceLimit(const ResourceType type, const WizardSizeType limit)
WizardExport WizardBooleanType AcquireWizardResource(const ResourceType type, const WizardSizeType size)
static RandomInfo * random_info
#define WizardResourceInfinity
static SemaphoreInfo * resource_semaphore
WizardExport void RelinquishWizardResource(const ResourceType type, const WizardSizeType size)
WizardExport WizardBooleanType RelinquishUniqueFileResource(const char *path, const WizardBooleanType trash)
WizardExport WizardBooleanType AcquireUniqueFilename(char *path, ExceptionInfo *exception)
WizardExport int AcquireUniqueFileResource(const char *path, char *filename, ExceptionInfo *exception)
WizardExport void AsynchronousResourceComponentTerminus(void)
static SplayTreeInfo * temporary_resources
WizardExport void ResourceComponentTerminus(void)
struct _ResourceInfo ResourceInfo
#define WizardFormatExtent
WizardExport void RelinquishSemaphoreInfo(SemaphoreInfo **semaphore_info)
WizardExport SemaphoreInfo * AcquireSemaphoreInfo(void)
WizardExport void LockSemaphoreInfo(SemaphoreInfo *semaphore_info)
WizardExport void UnlockSemaphoreInfo(SemaphoreInfo *semaphore_info)
WizardExport void ActivateSemaphoreInfo(SemaphoreInfo **semaphore_info)
WizardExport WizardBooleanType DeleteNodeFromSplayTree(SplayTreeInfo *splay_tree, const void *key)
WizardExport const void * GetNextKeyInSplayTree(SplayTreeInfo *splay_tree)
WizardExport void ResetSplayTreeIterator(SplayTreeInfo *splay_tree)
WizardExport int CompareSplayTreeString(const void *target, const void *source)
WizardExport SplayTreeInfo * DestroySplayTree(SplayTreeInfo *splay_tree)
WizardExport WizardBooleanType AddValueToSplayTree(SplayTreeInfo *splay_tree, const void *key, const void *value)
WizardExport SplayTreeInfo * NewSplayTree(int(*compare)(const void *, const void *), void *(*relinquish_key)(void *), void *(*relinquish_value)(void *))
static unsigned long StringToUnsignedLong(const char *value)
WizardExport char * DestroyString(char *string)
WizardExport ssize_t FormatWizardSize(const WizardSizeType size, const WizardBooleanType bi, const size_t length, char *format)
WizardExport int LocaleCompare(const char *p, const char *q)
WizardExport char * ConstantString(const char *source)
WizardExport size_t GetStringInfoLength(const StringInfo *string_info)
WizardExport unsigned char * GetStringInfoDatum(const StringInfo *string_info)
WizardExport char * GetEnvironmentValue(const char *name)
WizardExport size_t CopyWizardString(char *destination, const char *source, const size_t length)
WizardExport StringInfo * DestroyStringInfo(StringInfo *string_info)
WizardSizeType area_limit
WizardSizeType memory_limit
WizardSizeType file_limit
WizardSizeType disk_limit
#define DirectorySeparator
static int open_utf8(const char *path, int flags, mode_t mode)
static int remove_utf8(const char *path)
static int stat_utf8(const char *path, struct stat *attributes)
#define WizardULLConstant(c)